Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 3eab069a

Von Bernd Bleßmann vor mehr als 2 Jahren hinzugefügt

  • ID 3eab069a916662b17d40bbed62ddf2704a39590e
  • Vorgänger 2e2ad8bf
  • Nachfolger 763add59

Wiedervorlagen: Mehr Infos über Abschluss speichern und in den Masken zeigen

Unterschiede anzeigen:

SL/Controller/CustomerVendor.pm
938 938
    $self->{note} = SL::DB::Note->new(id => $::form->{note}->{id})->load();
939 939
    $self->{note_followup} = $self->{note}->follow_up;
940 940
    $self->{note_followup_link} = $self->{note_followup}->follow_up_link;
941

  
941 942
  } else {
942 943
    $self->{note} = SL::DB::Note->new();
943 944
    $self->{note_followup} = SL::DB::FollowUp->new();
......
952 953
  $self->{note_followup}->note($self->{note});
953 954
  $self->{note_followup}->created_by($curr_employee->id);
954 955

  
956
  if (delete $::form->{note_followup_done}) {
957
    $self->{note_followup}->done(SL::DB::FollowUpDone->new) if !$self->{note_followup}->done;
958
    $self->{note_followup}->done->employee_id(SL::DB::Manager::Employee->current->id);
959
  }
960

  
955 961
  $self->{note_followup_link}->trans_type($self->is_vendor() ? 'vendor' : 'customer');
956 962
  $self->{note_followup_link}->trans_info($self->{cv}->name);
957 963

  
SL/FU.pm
35 35
  if (!$params{id}) {
36 36
    ($params{id}) = selectrow_query($form, $dbh, qq|SELECT nextval('follow_up_id')|);
37 37

  
38
    $query = qq|INSERT INTO follow_ups (created_by, done, note_id, follow_up_date, id)
39
                VALUES ((SELECT id FROM employee WHERE login = ?), ?, ?, ?, ?)|;
38
    $query = qq|INSERT INTO follow_ups (created_by, note_id, follow_up_date, id)
39
                VALUES ((SELECT id FROM employee WHERE login = ?), ?, ?, ?)|;
40 40

  
41 41
    push @values, $::myconfig{login};
42 42

  
43 43
  } else {
44
    $query = qq|UPDATE follow_ups SET done = ?, note_id = ?, follow_up_date = ? WHERE id = ?|;
44
    $query = qq|UPDATE follow_ups SET note_id = ?, follow_up_date = ? WHERE id = ?|;
45 45
  }
46 46

  
47 47
  $params{note_id} = Notes->save('id'           => $params{note_id},
......
51 51
                                 'body'         => $params{body},
52 52
                                 'dbh'          => $dbh,);
53 53

  
54
  $params{done} = 1 if (!defined $params{done});
54
  do_query($form, $dbh, $query, @values, conv_i($params{note_id}), $params{follow_up_date}, conv_i($params{id}));
55 55

  
56
  do_query($form, $dbh, $query, @values, $params{done} ? 't' : 'f', conv_i($params{note_id}), $params{follow_up_date}, conv_i($params{id}));
56
  $params{done} = 1 if (!defined $params{done});
57
  if ($params{done}) {
58
    do_query($form, $dbh, qq|INSERT INTO follow_up_done (follow_up_id, employee_id) VALUES (?, (SELECT id FROM employee WHERE login = ?))|,
59
             conv_i($params{id}), $::myconfig{login});
60
  } else {
61
    do_query($form, $dbh, qq|DELETE FROM follow_up_done WHERE follow_up_id = ?|, conv_i($params{id}));
62
  }
57 63

  
58 64
  do_query($form, $dbh, qq|DELETE FROM follow_up_links WHERE follow_up_id = ?|, conv_i($params{id}));
59 65

  
......
89 95
  my $myconfig = \%main::myconfig;
90 96
  my $form     = $main::form;
91 97

  
92
  SL::DB->client->with_transaction(sub {
93
    do_query($form, SL::DB->client->dbh, qq|UPDATE follow_ups SET done = TRUE WHERE id = ?|, conv_i($params{id}));
94
    1;
95
  }) or do { die SL::DB->client->error };
98
  my ($done)   = selectrow_query($::form, SL::DB->client->dbh, qq|SELECT id FROM follow_up_done WHERE follow_up_id = ?|, conv_i($params{id}));
99
  if (!$done) {
100
    SL::DB->client->with_transaction(sub {
101
      do_query($form, SL::DB->client->dbh, qq|INSERT INTO follow_up_done (follow_up_id, employee_id) VALUES (?, (SELECT id FROM employee WHERE login = ?))|,
102
               conv_i($params{id}), $myconfig->{login});
103
      1;
104
    }) or do { die SL::DB->client->error };
105
  }
96 106

  
97 107
  $main::lxdebug->leave_sub();
98 108
}
......
137 147
  my ($query, @values);
138 148

  
139 149
  my ($employee_id) = selectrow_query($form, $dbh, qq|SELECT id FROM employee WHERE login = ?|, $::myconfig{login});
140
  $query            = qq|SELECT fu.*, n.subject, n.body, n.created_by
150
  $query            = qq|SELECT fu.*, n.subject, n.body, n.created_by,
151
                         follow_up_done.follow_up_id AS done,
152
                         date_trunc('second', follow_up_done.done_at) AS done_at,
153
                         COALESCE(done_by.name, done_by.login) AS done_by_employee_name
141 154
                         FROM follow_ups fu
142 155
                         LEFT JOIN notes n ON (fu.note_id = n.id)
143 156
                         LEFT JOIN follow_up_created_for_employees ON (follow_up_created_for_employees.follow_up_id = fu.id)
157
                         LEFT JOIN follow_up_done ON (follow_up_done.follow_up_id = fu.id)
158
                         LEFT JOIN employee done_by ON (follow_up_done.employee_id = done_by.id)
144 159
                         WHERE (fu.id = ?)
145 160
                           AND (   (fu.created_by = ?) OR (follow_up_created_for_employees.employee_id = ?)
146 161
                                OR (fu.created_by IN (SELECT DISTINCT what FROM follow_up_access WHERE who = ?)))|;
......
219 234

  
220 235
  if ($params{done} ne $params{not_done}) {
221 236
    my $not  = $params{not_done} ? 'NOT' : '';
222
    $where  .= qq| AND $not COALESCE(fu.done, FALSE)|;
237
    $where  .= qq| AND $not EXISTS (SELECT id FROM follow_up_done WHERE follow_up_id = fu.id)|;
223 238
  }
224 239

  
225 240
  if ($params{not_id}) {
......
286 301
  $query  = qq|SELECT DISTINCT fu.*, n.subject, n.body, n.created_by,
287 302
                 fu.follow_up_date <= current_date AS due,
288 303
                 fu.itime::DATE                    AS created_on,
289
                 COALESCE(eby.name,  eby.login)    AS created_by_name
304
                 COALESCE(eby.name,  eby.login)    AS created_by_name,
305
                 follow_up_done.follow_up_id       AS done
290 306
               FROM follow_ups fu
291 307
               LEFT JOIN notes    n    ON (fu.note_id          = n.id)
292 308
               LEFT JOIN employee eby  ON (n.created_by        = eby.id)
293 309
               LEFT JOIN follow_up_created_for_employees ON (follow_up_created_for_employees.follow_up_id = fu.id)
310
               LEFT JOIN follow_up_done ON (follow_up_done.follow_up_id = fu.id)
294 311
               WHERE ((fu.created_by = ?) OR (follow_up_created_for_employees.employee_id = ?)
295 312
                      $where_user)
296 313
                 $where
css/common.css
237 237
.thumbnail {
238 238
  cursor: pointer;
239 239
}
240

  
241
.fu_finished {
242
  background-color: #ADFFB6;
243
}
locale/de/all
1586 1586
  'Financial controlling report for open sales orders' => 'Finanzcontrollingbericht für offene Verkaufsaufträge',
1587 1587
  'Financial overview for #1'   => 'Finanzübersicht für #1',
1588 1588
  'Finish'                      => 'Abschließen',
1589
  'Finished'                    => 'Erledigt',
1589 1590
  'First 20 Lines'              => 'Nur erste 20 Datensätze',
1590 1591
  'Firstname'                   => 'Vorname',
1591 1592
  'Fix transaction'             => 'Buchung korrigieren',
......
4423 4424
  'assembled'                   => 'Gefertigt',
4424 4425
  'assembly'                    => 'Erzeugnis',
4425 4426
  'assembly_list'               => 'erzeugnisliste',
4427
  'at'                          => 'um',
4426 4428
  'averaged values, in invoice mode only useful when filtered by a part' => 'gemittelte Werte, im Rechnungsmodus nur sinnvoll wenn nach Artikel gefiltert wird',
4427 4429
  'averconsumed_br'             => 'Ø mtl.',
4428 4430
  'back'                        => 'zurück',
......
4440 4442
  'brutto'                      => 'brutto',
4441 4443
  'building data'               => 'Verarbeite Daten',
4442 4444
  'building report'             => 'Erstelle Bericht',
4445
  'by'                          => 'von',
4443 4446
  'can not allocate #1 units of #2, missing #3 units' => 'Kann keine #1 Einheiten von #2 belegen, es fehlen #3 Einheiten',
4444 4447
  'can not allocate enough resources for production' => 'Kann nicht genug Mengen für die Produktion belegen',
4445 4448
  'can only parse a pdf file'   => 'Kann nur eine gültige PDF-Datei verwenden.',
locale/en/all
1586 1586
  'Financial controlling report for open sales orders' => '',
1587 1587
  'Financial overview for #1'   => '',
1588 1588
  'Finish'                      => '',
1589
  'Finished'                    => '',
1589 1590
  'First 20 Lines'              => '',
1590 1591
  'Firstname'                   => '',
1591 1592
  'Fix transaction'             => '',
......
4422 4423
  'assembled'                   => '',
4423 4424
  'assembly'                    => '',
4424 4425
  'assembly_list'               => '',
4426
  'at'                          => '',
4425 4427
  'averaged values, in invoice mode only useful when filtered by a part' => '',
4426 4428
  'averconsumed_br'             => 'Ø monthly',
4427 4429
  'back'                        => '',
......
4439 4441
  'brutto'                      => '',
4440 4442
  'building data'               => '',
4441 4443
  'building report'             => '',
4444
  'by'                          => '',
4442 4445
  'can not allocate #1 units of #2, missing #3 units' => '',
4443 4446
  'can not allocate enough resources for production' => '',
4444 4447
  'can only parse a pdf file'   => '',
templates/webpages/customer_vendor/tabs/vcnotes.html
74 74

  
75 75
  <p>
76 76
    <table>
77
      [% IF SELF.note_followup.done -%]
78
      <tr class="fu_finished">
79
        <td>[% 'Finished' | $T8 %]</td>
80
        <td>[% 'by' | $T8 %] [% HTML.escape(SELF.note_followup.done.employee.safe_name) %]</td>
81
        <td colspan="2">[% 'at' | $T8 %] [% HTML.escape(SELF.note_followup.done.done_at_as_timestamp_s) %]</td>
82
      </tr>
83
      [% END %]
77 84
      <tr>
78 85
        <td valign="right">[% 'Subject' | $T8 %]</td>
79 86

  
......
121 128
     <td>
122 129
     <td valign="top">
123 130
      <table>
124
       <tr class="listheading"><th>[% LxERP.t8('Users that are a member in this group') %] ([% LxERP.t8('Click group to add the group\'s users') %])</th></tr>
131
       <tr class="listheading"><th>[% LxERP.t8('Users that are a member in this group') %] ([% LxERP.t8('click on a group to add the group\'s users') %])</th></tr>
125 132
        [% FOREACH auth_group = SELF.all_auth_groups %]
126 133
         <tr onclick="follow_up_do_select(this)" data-ids='[% FOREACH employee = auth_group.get_employees %][% employee.id %][% IF !loop.last %],[% END%][% END%]' class="interactive cursor-pointer">
127 134
          <td class="listrow1"><b>←&nbsp;[% auth_group.name %]</b>: [% auth_group.description %]</td>
......
138 145
        <td>&nbsp;</td>
139 146

  
140 147
        <td>
141
          [% L.checkbox_tag('note_followup.done', checked = SELF.note_followup.done) %]
148
          [% L.checkbox_tag('note_followup_done', checked = SELF.note_followup.done) %]
142 149
          <label for="note_followup_done">[% 'Follow-Up done' | $T8 %]</label>
143 150
        </td>
144 151
      </tr>
templates/webpages/fu/add_edit.html
20 20
  <input type="hidden" name="POPUP_MODE" value="[% HTML.escape(POPUP_MODE) %]">
21 21

  
22 22
  <table>
23
    [% IF done_at -%]
24
    <tr class="fu_finished">
25
      <td>[% 'Finished' | $T8 %]</td>
26
      <td>[% 'by' | $T8 %] [% HTML.escape(done_by_employee_name) %]</td>
27
      <td colspan="2">[% 'at' | $T8 %] [% HTML.escape(done_at) %]</td>
28
    </tr>
29
    [% END %]
23 30
    <tr>
24 31
     <td align="top">[% 'Follow-Up for user' | $T8 %]</td>
25 32
     <td valign="top">
......
43 50
     <td>
44 51
     <td valign="top">
45 52
      <table>
46
       <tr class="listheading"><th>[% LxERP.t8('Users that are a member in this group') %] ([% LxERP.t8('Click group to add the group\'s users') %])</th></tr>
53
       <tr class="listheading"><th>[% LxERP.t8('Users that are a member in this group') %] ([% LxERP.t8('click on a group to add the group\'s users') %])</th></tr>
47 54
        [% FOREACH auth_group = all_auth_groups %]
48 55
         <tr onclick="follow_up_do_select(this)" data-ids='[% FOREACH employee = auth_group.get_employees %][% employee.id %][% IF !loop.last %],[% END%][% END%]' class="interactive cursor-pointer">
49 56
          <td class="listrow1"><b>←&nbsp;[% auth_group.name %]</b>: [% auth_group.description %]</td>

Auch abrufbar als: Unified diff