X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fdn.pl;h=bd96d3edc29db009f45eb5b066be86a297a543b7;hb=7dab0cbdf9c8d9f1463290ad577e90865d632e93;hp=50c602b408e778bdee621f7f8c4a15000c199a5e;hpb=d63831cbaf332f5280fd92e6134229fa4c109e00;p=kivitendo-erp.git
diff --git a/bin/mozilla/dn.pl b/bin/mozilla/dn.pl
index 50c602b40..bd96d3edc 100644
--- a/bin/mozilla/dn.pl
+++ b/bin/mozilla/dn.pl
@@ -105,7 +105,7 @@ sub edit_config {
@@ -453,7 +445,7 @@ sub show_invoices {
|;
-&print_options;
-print qq|
+ &print_options;
+ print qq|
@@ -569,6 +551,12 @@ sub save {
}
DN->save_config(\%myconfig, \%$form);
+ # saving the history
+ if(!exists $form->{addition} && $form->{id} ne "") {
+ $form->{addition} = "SAVED FOR DUNNING";
+ $form->save_history($form->dbconnect(\%myconfig));
+ }
+ # /saving the history
$form->redirect($locale->text('Dunning Process Config saved!'));
$lxdebug->leave_sub();
@@ -583,18 +571,14 @@ sub save_dunning {
if ($form->{groupinvoices}) {
while ($active) {
$lastcustomer = 0;
- $form->{inv_ids} = "";
+ $form->{inv_ids} = [];
$active = 0;
@rows = ();
for my $i (1 .. $form->{rowcount}) {
$form->{"active_$i"} *= 1;
$lastcustomer = $form->{"customer_id_$i"} unless ($lastcustomer);
if ($form->{"active_$i"} && ($form->{"customer_id_$i"} == $lastcustomer)) {
- if ($form->{inv_ids}) {
- $form->{inv_ids} .= qq|,$form->{"inv_id_$i"}|;
- } else {
- $form->{inv_ids} = qq|($form->{"inv_id_$i"}|;
- }
+ push(@{ $form->{inv_ids} }, $form->{"inv_id_$i"});
$form->{"active_$i"} = 0;
$form->{"customer_id_$i"} = 0;
push(@rows, $i);
@@ -604,8 +588,7 @@ sub save_dunning {
$form->{"customer_id_$i"} = 0;
}
}
- if ($form->{inv_ids} ne "") {
- $form->{inv_ids} .= ")";
+ if (scalar(@{ $form->{inv_ids} }) != 0) {
DN->save_dunning(\%myconfig, \%$form, \@rows, $userspath,$spool, $sendmail);
}
}
@@ -613,7 +596,7 @@ sub save_dunning {
for my $i (1 .. $form->{rowcount}) {
if ($form->{"active_$i"}) {
@rows = ();
- $form->{inv_ids} = qq|($form->{"inv_id_$i"})|;
+ $form->{inv_ids} = [ $form->{"inv_id_$i"} ];
push(@rows, $i);
DN->save_dunning(\%myconfig, \%$form, \@rows, $userspath,$spool, $sendmail);
}
@@ -622,7 +605,12 @@ sub save_dunning {
if($form->{DUNNING_PDFS}) {
DN->melt_pdfs(\%myconfig, \%$form,$spool);
}
-
+ # saving the history
+ if(!exists $form->{addition} && $form->{id} ne "") {
+ $form->{addition} = "DUNNING STARTED";
+ $form->save_history($form->dbconnect(\%myconfig));
+ }
+ # /saving the history
$form->redirect($locale->text('Dunning Process started for selected invoices!'));
$lxdebug->leave_sub();
@@ -780,7 +768,6 @@ sub search {
$button4
-
@@ -891,7 +878,7 @@ sub show_dunning {
- $form->{title} |
+ $form->{title} |
|;
@@ -901,10 +888,13 @@ sub show_dunning {
|;
my $i = 0;
+ my $j = 0;
+ my $previous_customer_id;
foreach $ref (@{ $form->{DUNNINGS} }) {
-
$i++;
- my $j = $i % 2;
+ $j++ if ($previous_customer_id != $ref->{customer_id});
+ $j = $j % 2;
+ $previous_customer_id = $ref->{customer_id};
print qq|
@@ -913,16 +903,20 @@ sub show_dunning {
$dunning = qq||;
-
-
- $column_data{dunning_description} = qq|$ref->{dunning_description} | |;
+ my $script = "";
+ if ($ref->{invoice}) {
+ $script = "is.pl";
+ } else {
+ $script = "ar.pl";
+ }
+ $column_data{dunning_description} = qq|{dunning_id}&customer_id=$ref->{customer_id}&format=pdf&media=screen&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$form->{callback}>$ref->{dunning_description} | |;
my $active = "checked";
$column_data{dunning_date} = qq|$ref->{dunning_date} | |;
$column_data{next_duedate} = qq|$ref->{dunning_duedate} | |;
$column_data{inv_duedate} = qq|$ref->{duedate} | |;
$column_data{invdate} = qq|$ref->{transdate} | |;
- $column_data{invnumber} = qq|{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$form->{callback}>$ref->{invnumber} | |;
+ $column_data{invnumber} = qq|{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$form->{callback}>$ref->{invnumber} | |;
$column_data{customername} = qq|$ref->{customername} | |;
$column_data{invamount} = qq|$ref->{amount} | |;
$column_data{fee} = qq|$ref->{fee} | |;
@@ -959,14 +953,6 @@ sub show_dunning {
{path}>
{login}>
{password}>
-|;
-
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
- }
-
- print qq|
@@ -978,5 +964,21 @@ sub show_dunning {
$lxdebug->leave_sub();
}
+
+sub print_dunning {
+ $lxdebug->enter_sub();
+
+ DN->print_dunning(\%myconfig, \%$form, $form->{dunning_id}, $form->{customer_id}, $userspath, $spool, $sendmail);
+
+ if($form->{DUNNING_PDFS}) {
+ DN->melt_pdfs(\%myconfig, \%$form,$spool);
+ } else {
+ $form->redirect($locale->text('Could not create dunning copy!'));
+ }
+
+ $lxdebug->leave_sub();
+
+}
+
# end of main