Revision 3c1ceacd
Von Moritz Bunkus vor mehr als 16 Jahren hinzugefügt
SL/DO.pm | ||
---|---|---|
342 | 342 |
# save printed, emailed, queued |
343 | 343 |
$form->save_status($dbh); |
344 | 344 |
|
345 |
$self->close_order_if_delivered('do_id' => $form->{id},
|
|
346 |
'type' => $form->{type} eq 'sales_delivery_order' ? 'sales' : 'purchase',
|
|
347 |
'dbh' => $dbh,);
|
|
345 |
$self->mark_order_if_delivered('do_id' => $form->{id},
|
|
346 |
'type' => $form->{type} eq 'sales_delivery_order' ? 'sales' : 'purchase', |
|
347 |
'dbh' => $dbh,); |
|
348 | 348 |
|
349 | 349 |
my $rc = $dbh->commit(); |
350 | 350 |
|
... | ... | |
357 | 357 |
return $rc; |
358 | 358 |
} |
359 | 359 |
|
360 |
sub close_order_if_delivered {
|
|
360 |
sub mark_order_if_delivered {
|
|
361 | 361 |
$main::lxdebug->enter_sub(); |
362 | 362 |
|
363 | 363 |
my $self = shift; |
... | ... | |
434 | 434 |
$main::lxdebug->leave_sub(); |
435 | 435 |
} |
436 | 436 |
|
437 |
sub close_orders { |
|
438 |
$main::lxdebug->enter_sub(); |
|
439 |
|
|
440 |
my $self = shift; |
|
441 |
my %params = @_; |
|
442 |
|
|
443 |
Common::check_params(\%params, qw(ids)); |
|
444 |
|
|
445 |
if (('ARRAY' ne ref $params{ids}) || !scalar @{ $params{ids} }) { |
|
446 |
$main::lxdebug->leave_sub(); |
|
447 |
return; |
|
448 |
} |
|
449 |
|
|
450 |
my $myconfig = \%main::myconfig; |
|
451 |
my $form = $main::form; |
|
452 |
|
|
453 |
my $dbh = $params{dbh} || $form->get_standard_dbh($myconfig); |
|
454 |
|
|
455 |
my $query = qq|UPDATE delivery_orders SET closed = TRUE WHERE id IN (| . join(', ', ('?') x scalar(@{ $params{ids} })) . qq|)|; |
|
456 |
|
|
457 |
do_query($form, $dbh, $query, map { conv_i($_) } @{ $params{ids} }); |
|
458 |
|
|
459 |
$dbh->commit() unless ($params{dbh}); |
|
460 |
|
|
461 |
$main::lxdebug->leave_sub(); |
|
462 |
} |
|
463 |
|
|
437 | 464 |
sub delete { |
438 | 465 |
$main::lxdebug->enter_sub(); |
439 | 466 |
|
SL/IR.pm | ||
---|---|---|
37 | 37 |
use SL::AM; |
38 | 38 |
use SL::Common; |
39 | 39 |
use SL::DBUtils; |
40 |
use SL::DO; |
|
40 | 41 |
use SL::MoreCommon; |
41 | 42 |
use List::Util qw(min); |
42 | 43 |
|
... | ... | |
538 | 539 |
|
539 | 540 |
Common::webdav_folder($form) if ($main::webdav); |
540 | 541 |
|
541 |
my $rc = 1; |
|
542 |
my @close_do_ids = map { $_ * 1 } grep { $_ } split m/\s+/, $form->{close_do_ids}; |
|
543 |
if (scalar @close_do_ids) { |
|
544 |
DO->close_orders('dbh' => $dbh, |
|
545 |
'ids' => \@close_do_ids); |
|
546 |
} |
|
542 | 547 |
|
548 |
my $rc = 1; |
|
543 | 549 |
if (!$provided_dbh) { |
544 | 550 |
$rc = $dbh->commit(); |
545 | 551 |
$dbh->disconnect(); |
SL/IS.pm | ||
---|---|---|
40 | 40 |
use SL::CVar; |
41 | 41 |
use SL::Common; |
42 | 42 |
use SL::DBUtils; |
43 |
use SL::DO; |
|
43 | 44 |
use SL::MoreCommon; |
44 | 45 |
use Data::Dumper; |
45 | 46 |
|
... | ... | |
969 | 970 |
|
970 | 971 |
Common::webdav_folder($form) if ($main::webdav); |
971 | 972 |
|
973 |
my @close_do_ids = map { $_ * 1 } grep { $_ } split m/\s+/, $form->{close_do_ids}; |
|
974 |
|
|
975 |
if (scalar @close_do_ids) { |
|
976 |
DO->close_orders('dbh' => $dbh, |
|
977 |
'ids' => \@close_do_ids); |
|
978 |
} |
|
979 |
|
|
972 | 980 |
my $rc = 1; |
973 | 981 |
if (!$provided_dbh) { |
974 | 982 |
$dbh->commit(); |
bin/mozilla/do.pl | ||
---|---|---|
648 | 648 |
check_do_access(); |
649 | 649 |
$auth->assert($form->{type} eq 'purchase_delivery_order' ? 'vendor_invoice_edit' : 'invoice_edit'); |
650 | 650 |
|
651 |
$form->{close_do_ids} = $form->{id}; |
|
652 |
|
|
651 | 653 |
$form->{deliverydate} = $form->{transdate}; |
652 | 654 |
$form->{transdate} = $form->{invdate} = $form->current_date(\%myconfig); |
653 | 655 |
$form->{duedate} = $form->current_date(\%myconfig, $form->{invdate}, $form->{terms} * 1); |
... | ... | |
740 | 742 |
'back_button' => 1); |
741 | 743 |
} |
742 | 744 |
|
745 |
$form->{close_do_ids} = join ' ', @do_ids; |
|
743 | 746 |
$form->{deliverydate} = $form->{transdate}; |
744 | 747 |
$form->{transdate} = $form->current_date(\%myconfig); |
745 | 748 |
$form->{duedate} = $form->current_date(\%myconfig, $form->{invdate}, $form->{terms} * 1); |
bin/mozilla/ir.pl | ||
---|---|---|
806 | 806 |
</tr> |
807 | 807 |
</table> |
808 | 808 |
<br> |
809 |
|; |
|
809 |
| . $cgi->hidden('-name' => 'close_do_ids', '-default' => [$form->{close_do_ids}]);
|
|
810 | 810 |
|
811 | 811 |
$invdate = $form->datetonum($form->{invdate}, \%myconfig); |
812 | 812 |
$closedto = $form->datetonum($form->{closedto}, \%myconfig); |
bin/mozilla/is.pl | ||
---|---|---|
1192 | 1192 |
$cgi->hidden("-name" => "callback", "-value" => $form->{callback}) |
1193 | 1193 |
. $cgi->hidden('-name' => 'draft_id', '-default' => [$form->{draft_id}]) |
1194 | 1194 |
. $cgi->hidden('-name' => 'draft_description', '-default' => [$form->{draft_description}]) |
1195 |
. $cgi->hidden('-name' => 'close_do_ids', '-default' => [$form->{close_do_ids}]) |
|
1195 | 1196 |
. qq| |
1196 | 1197 |
</form> |
1197 | 1198 |
|
Auch abrufbar als: Unified diff
------------------------------------------------------------------------
r7135 | mbunkus | 2008-06-20 10:56:08 +0200 (Fri, 20 Jun 2008) | 1 line
Wenn eine Rechnung aus einem oder mehreren Lieferscheinen erstellt wird, so wird beim Buchen der Rechnung automatisch alle Lieferscheine als geschlossen markiert, aus denen die Rechnung erstellt wurde.
------------------------------------------------------------------------