Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 40c2c37c

Von Moritz Bunkus vor etwa 15 Jahren hinzugefügt

  • ID 40c2c37c2db3224e2fa477fd77c34b044a1825d3
  • Vorgänger fb52c155
  • Nachfolger 5dfee15a

Beim Buchen von Rechnungen/Zahlungen das Feld "datepaid" richtig setzen.

Zusätzlich noch ein Datenbankupgradescript, das die Felder in
bestehenden Einträgen berichtigt.

Unterschiede anzeigen:

SL/AP.pm
35 35
package AP;
36 36

  
37 37
use SL::DBUtils;
38
use SL::IO;
38 39
use SL::MoreCommon;
39 40

  
40 41
use strict;
......
155 156
  # amount for total AP
156 157
  $form->{payables} = $form->{invtotal};
157 158

  
158
  $form->{datepaid} = $form->{transdate} unless ($form->{datepaid});
159
  my $datepaid = ($form->{invpaid} != 0) ? $form->{datepaid} : undef;
160

  
161 159
  # update exchangerate
162 160
  if (($form->{currency} ne $form->{defaultcurrency}) && !$exchangerate) {
163 161
    $form->update_exchangerate($dbh, $form->{currency}, $form->{transdate}, 0,
......
195 193

  
196 194
    $query = qq|UPDATE ap SET
197 195
                invnumber = ?, transdate = ?, ordnumber = ?, vendor_id = ?, taxincluded = ?,
198
                amount = ?, duedate = ?, paid = ?, datepaid = ?, netamount = ?,
196
                amount = ?, duedate = ?, paid = ?, netamount = ?,
199 197
                curr = ?, notes = ?, department_id = ?, storno = ?, storno_id = ?
200 198
               WHERE id = ?|;
201 199
    @values = ($form->{invnumber}, conv_date($form->{transdate}),
202 200
                  $form->{ordnumber}, conv_i($form->{vendor_id}),
203 201
                  $form->{taxincluded} ? 't' : 'f', $form->{invtotal},
204 202
                  conv_date($form->{duedate}), $form->{invpaid},
205
                  conv_date($datepaid), $form->{netamount},
203
                  $form->{netamount},
206 204
                  $form->{currency}, $form->{notes},
207 205
                  conv_i($form->{department_id}), $form->{storno},
208 206
                  $form->{storno_id}, $form->{id});
......
354 352
    do_query($form, $dbh, $query,  $form->{invpaid}, $form->{invpaid} ? conv_date($form->{datepaid}) : undef, conv_i($form->{id}));
355 353
  }
356 354

  
355
  IO->set_datepaid(table => 'ap', id => $form->{id}, dbh => $dbh);
356

  
357 357
  my $rc = 1;
358 358
  if (!$provided_dbh) {
359 359
    $dbh->commit();
......
786 786
    do_query($form, $dbh, $query, (values %$row));
787 787
  }
788 788

  
789
  map { IO->set_datepaid(table => 'ap', id => $_, dbh => $dbh) } ($id, $new_id);
790

  
789 791
  $dbh->commit;
790 792

  
791 793
  $main::lxdebug->leave_sub();

Auch abrufbar als: Unified diff