Revision 8c1d5d75
Von Martin Helmling mh@waldpark.octosoft.eu vor fast 9 Jahren hinzugefügt
SL/AP.pm | ||
---|---|---|
148 | 148 |
$form->{id}); |
149 | 149 |
do_query($form, $dbh, $query, @values); |
150 | 150 |
|
151 |
$form->new_lastmtime('ap'); |
|
152 |
|
|
151 | 153 |
# add individual transactions |
152 | 154 |
for my $i (1 .. $form->{rowcount}) { |
153 | 155 |
if ($form->{"amount_$i"} != 0) { |
... | ... | |
349 | 351 |
if ($payments_only) { |
350 | 352 |
$query = qq|UPDATE ap SET paid = ?, datepaid = ? WHERE id = ?|; |
351 | 353 |
do_query($form, $dbh, $query, $form->{invpaid}, $form->{invpaid} ? conv_date($form->{datepaid}) : undef, conv_i($form->{id})); |
354 |
$form->new_lastmtime('ap'); |
|
352 | 355 |
} |
353 | 356 |
|
354 | 357 |
IO->set_datepaid(table => 'ap', id => $form->{id}, dbh => $dbh); |
... | ... | |
808 | 811 |
$query = qq|UPDATE ap SET paid = amount + paid, storno = 't' WHERE id = ?|; |
809 | 812 |
do_query($form, $dbh, $query, $id); |
810 | 813 |
|
814 |
$form->new_lastmtime('ap') if $id == $form->{id}; |
|
815 |
|
|
811 | 816 |
# now copy acc_trans entries |
812 | 817 |
$query = qq|SELECT a.*, c.link FROM acc_trans a LEFT JOIN chart c ON a.chart_id = c.id WHERE a.trans_id = ? ORDER BY a.acc_trans_id|; |
813 | 818 |
my $rowref = selectall_hashref_query($form, $dbh, $query, $id); |
... | ... | |
827 | 832 |
|
828 | 833 |
map { IO->set_datepaid(table => 'ap', id => $_, dbh => $dbh) } ($id, $new_id); |
829 | 834 |
|
835 |
$form->new_lastmtime('ap') if $storno_id == $form->{id}; |
|
836 |
|
|
830 | 837 |
$dbh->commit; |
831 | 838 |
|
832 | 839 |
$main::lxdebug->leave_sub(); |
SL/AR.pm | ||
---|---|---|
183 | 183 |
do_query($form, $dbh, $query, $form->{paid}, $form->{paid} ? conv_date($form->{datepaid}) : undef, conv_i($form->{id})); |
184 | 184 |
} |
185 | 185 |
|
186 |
$form->new_lastmtime('ar'); |
|
187 |
|
|
186 | 188 |
# add paid transactions |
187 | 189 |
for my $i (1 .. $form->{paidaccounts}) { |
188 | 190 |
|
... | ... | |
770 | 772 |
$query = qq|UPDATE ar SET paid = amount + paid, storno = 't' WHERE id = ?|; |
771 | 773 |
do_query($form, $dbh, $query, $id); |
772 | 774 |
|
775 |
$form->new_lastmtime('ar') if $id == $form->{id}; |
|
776 |
|
|
773 | 777 |
# now copy acc_trans entries |
774 | 778 |
$query = qq|SELECT a.*, c.link FROM acc_trans a LEFT JOIN chart c ON a.chart_id = c.id WHERE a.trans_id = ? ORDER BY a.acc_trans_id|; |
775 | 779 |
my $rowref = selectall_hashref_query($form, $dbh, $query, $id); |
... | ... | |
789 | 793 |
|
790 | 794 |
map { IO->set_datepaid(table => 'ar', id => $_, dbh => $dbh) } ($id, $new_id); |
791 | 795 |
|
796 |
$form->new_lastmtime('ar') if $storno_id == $form->{id}; |
|
797 |
|
|
792 | 798 |
$dbh->commit; |
793 | 799 |
|
794 | 800 |
$main::lxdebug->leave_sub(); |
SL/DO.pm | ||
---|---|---|
477 | 477 |
conv_i($form->{id})); |
478 | 478 |
do_query($form, $dbh, $query, @values); |
479 | 479 |
|
480 |
$form->new_lastmtime('delivery_orders'); |
|
481 |
|
|
480 | 482 |
$form->{name} = $form->{ $form->{vc} }; |
481 | 483 |
$form->{name} =~ s/--$form->{"$form->{vc}_id"}//; |
482 | 484 |
|
... | ... | |
605 | 607 |
do_query($form, $dbh, $query, map { conv_i($_) } @{ $params{ids} }); |
606 | 608 |
|
607 | 609 |
$dbh->commit() unless ($params{dbh}); |
610 |
$form->new_lastmtime('delivery_orders'); |
|
608 | 611 |
|
609 | 612 |
$main::lxdebug->leave_sub(); |
610 | 613 |
} |
SL/Form.pm | ||
---|---|---|
2590 | 2590 |
$main::lxdebug->leave_sub(); |
2591 | 2591 |
} |
2592 | 2592 |
|
2593 |
sub new_lastmtime { |
|
2594 |
my ($self, $table, $option) = @_; |
|
2595 |
|
|
2596 |
return unless $self->{id}; |
|
2597 |
croak ("wrong call, no valid table defined") unless $table =~ /^(oe|ar|ap|delivery_orders|parts)$/; |
|
2598 |
|
|
2599 |
my $query = "SELECT mtime, itime FROM " . $table . " WHERE id = ?"; |
|
2600 |
my $ref = selectfirst_hashref_query($self, $self->get_standard_dbh, $query, $self->{id}); |
|
2601 |
$ref->{mtime} ||= $ref->{itime}; |
|
2602 |
$self->{lastmtime} = $ref->{mtime}; |
|
2603 |
$main::lxdebug->message(LXDebug->DEBUG2(),"new lastmtime=".$self->{lastmtime}); |
|
2604 |
} |
|
2605 |
|
|
2593 | 2606 |
sub mtime_ischanged { |
2594 | 2607 |
my ($self, $table, $option) = @_; |
2595 | 2608 |
|
SL/IC.pm | ||
---|---|---|
399 | 399 |
); |
400 | 400 |
do_query($form, $dbh, $query, @values); |
401 | 401 |
|
402 |
$form->new_lastmtime('parts'); |
|
403 |
|
|
402 | 404 |
# delete translation records |
403 | 405 |
do_query($form, $dbh, qq|DELETE FROM translation WHERE parts_id = ?|, conv_i($form->{id})); |
404 | 406 |
|
... | ... | |
570 | 572 |
$qty * ($form->{weight} - $weight), conv_i($id)); |
571 | 573 |
do_query($form, $dbh, $query, @values); |
572 | 574 |
|
575 |
$form->new_lastmtime('parts') if $id == $form->{id}; |
|
576 |
|
|
573 | 577 |
$main::lxdebug->leave_sub(); |
574 | 578 |
} |
575 | 579 |
|
SL/IR.pm | ||
---|---|---|
690 | 690 |
if ($payments_only) { |
691 | 691 |
$query = qq|UPDATE ap SET paid = ? WHERE id = ?|; |
692 | 692 |
do_query($form, $dbh, $query, $form->{paid}, conv_i($form->{id})); |
693 |
|
|
693 |
$form->new_lastmtime('ap'); |
|
694 | 694 |
if (!$provided_dbh) { |
695 | 695 |
$dbh->commit(); |
696 | 696 |
$dbh->disconnect(); |
... | ... | |
745 | 745 |
do_query($form, $dbh, $query, conv_i($form->{id})); |
746 | 746 |
} |
747 | 747 |
|
748 |
$form->new_lastmtime('ap'); |
|
748 | 749 |
|
749 | 750 |
$form->{name} = $form->{vendor}; |
750 | 751 |
$form->{name} =~ s/--\Q$form->{vendor_id}\E//; |
SL/IS.pm | ||
---|---|---|
1244 | 1244 |
$query = qq|UPDATE ar SET paid = ? WHERE id = ?|; |
1245 | 1245 |
do_query($form, $dbh, $query, $form->{paid}, conv_i($form->{id})); |
1246 | 1246 |
|
1247 |
$form->new_lastmtime('ar'); |
|
1248 |
|
|
1247 | 1249 |
$dbh->commit if !$provided_dbh; |
1248 | 1250 |
|
1249 | 1251 |
$main::lxdebug->leave_sub(); |
... | ... | |
1299 | 1301 |
do_query($form, $dbh, qq|UPDATE ar SET paid = amount WHERE id = ?|, conv_i($form->{"id"})); |
1300 | 1302 |
} |
1301 | 1303 |
|
1304 |
$form->new_lastmtime('ar'); |
|
1305 |
|
|
1302 | 1306 |
$form->{name} = $form->{customer}; |
1303 | 1307 |
$form->{name} =~ s/--\Q$form->{customer_id}\E//; |
1304 | 1308 |
|
SL/OE.pm | ||
---|---|---|
696 | 696 |
conv_i($form->{id})); |
697 | 697 |
do_query($form, $dbh, $query, @values); |
698 | 698 |
|
699 |
$form->new_lastmtime('oe'); |
|
700 |
|
|
699 | 701 |
$form->{ordtotal} = $amount; |
700 | 702 |
|
701 | 703 |
$form->{name} = $form->{ $form->{vc} }; |
Auch abrufbar als: Unified diff
4. Überarbeitung Prüfen beim Speichern, ob Dokument geändert ist
An einigen Stellen wird nach dem Speichern nicht neu gelesen,
sondern die alten Forms-Variablen zum Aufbau der Webseite verwendet, z.B. "Auslagern".
Deshalb wird $form->lastmtime nun nach jedem Speichern aktualisiert.