Revision 5486b4a9
Von Sven Schöling vor etwa 15 Jahren hinzugefügt
bin/mozilla/is.pl | ||
---|---|---|
42 | 42 |
require "bin/mozilla/arap.pl"; |
43 | 43 |
require "bin/mozilla/drafts.pl"; |
44 | 44 |
|
45 |
use strict; |
|
46 |
|
|
47 |
my $edit; |
|
48 |
my $payment; |
|
49 |
my $print_post; |
|
50 |
|
|
45 | 51 |
1; |
46 | 52 |
|
47 | 53 |
# end of main |
48 | 54 |
|
49 | 55 |
sub add { |
50 |
$lxdebug->enter_sub(); |
|
56 |
$main::lxdebug->enter_sub();
|
|
51 | 57 |
|
52 |
$auth->assert('invoice_edit'); |
|
58 |
my $form = $main::form; |
|
59 |
my $locale = $main::locale; |
|
53 | 60 |
|
54 |
return $lxdebug->leave_sub() if (load_draft_maybe()); |
|
61 |
$main::auth->assert('invoice_edit'); |
|
62 |
|
|
63 |
return $main::lxdebug->leave_sub() if (load_draft_maybe()); |
|
55 | 64 |
|
56 | 65 |
if ($form->{type} eq "credit_note") { |
57 | 66 |
$form->{title} = $locale->text('Add Credit Note'); |
... | ... | |
67 | 76 |
|
68 | 77 |
$form->{callback} = "$form->{script}?action=add&type=$form->{type}" unless $form->{callback}; |
69 | 78 |
|
70 |
$form{jsscript} = "date"; |
|
79 |
$form->{jsscript} = "date";
|
|
71 | 80 |
|
72 | 81 |
&invoice_links; |
73 | 82 |
&prepare_invoice; |
74 | 83 |
&display_form; |
75 | 84 |
|
76 |
$lxdebug->leave_sub(); |
|
85 |
$main::lxdebug->leave_sub();
|
|
77 | 86 |
} |
78 | 87 |
|
79 | 88 |
sub edit { |
80 |
$lxdebug->enter_sub(); |
|
89 |
$main::lxdebug->enter_sub(); |
|
90 |
|
|
91 |
my $form = $main::form; |
|
81 | 92 |
|
82 |
$auth->assert('invoice_edit'); |
|
93 |
$main::auth->assert('invoice_edit');
|
|
83 | 94 |
|
84 | 95 |
# show history button |
85 | 96 |
$form->{javascript} = qq|<script type="text/javascript" src="js/show_history.js"></script>|; |
86 | 97 |
#/show hhistory button |
87 | 98 |
|
88 | 99 |
$edit = 1; |
100 |
my ($language_id, $printer_id); |
|
89 | 101 |
if ($form->{print_and_post}) { |
90 | 102 |
$form->{action} = "print"; |
91 | 103 |
$form->{resubmit} = 1; |
... | ... | |
101 | 113 |
|
102 | 114 |
&display_form; |
103 | 115 |
|
104 |
$lxdebug->leave_sub(); |
|
116 |
$main::lxdebug->leave_sub();
|
|
105 | 117 |
} |
106 | 118 |
|
107 | 119 |
sub invoice_links { |
108 |
$lxdebug->enter_sub(); |
|
120 |
$main::lxdebug->enter_sub();
|
|
109 | 121 |
|
110 |
$auth->assert('invoice_edit'); |
|
122 |
my $form = $main::form; |
|
123 |
my %myconfig = %main::myconfig; |
|
124 |
|
|
125 |
$main::auth->assert('invoice_edit'); |
|
111 | 126 |
|
112 | 127 |
$form->{vc} = 'customer'; |
113 | 128 |
|
114 | 129 |
# create links |
115 |
$form->{webdav} = $webdav; |
|
116 |
$form->{lizenzen} = $lizenzen; |
|
130 |
$form->{webdav} = $main::webdav;
|
|
131 |
$form->{lizenzen} = $main::lizenzen;
|
|
117 | 132 |
|
118 | 133 |
$form->create_links("AR", \%myconfig, "customer"); |
119 | 134 |
|
... | ... | |
124 | 139 |
} |
125 | 140 |
} |
126 | 141 |
|
142 |
my $payment_id; |
|
127 | 143 |
if ($form->{payment_id}) { |
128 | 144 |
$payment_id = $form->{payment_id}; |
129 | 145 |
} |
146 |
my $language_id; |
|
130 | 147 |
if ($form->{language_id}) { |
131 | 148 |
$language_id = $form->{language_id}; |
132 | 149 |
} |
150 |
my $taxzone_id; |
|
133 | 151 |
if ($form->{taxzone_id}) { |
134 | 152 |
$taxzone_id = $form->{taxzone_id}; |
135 | 153 |
} |
154 |
my $id; |
|
136 | 155 |
if ($form->{id}) { |
137 | 156 |
$id = $form->{id}; |
138 | 157 |
} |
158 |
my $shipto_id; |
|
139 | 159 |
if ($form->{shipto_id}) { |
140 | 160 |
$shipto_id = $form->{shipto_id}; |
141 | 161 |
} |
142 | 162 |
|
143 |
$cp_id = $form->{cp_id}; |
|
163 |
my $cp_id = $form->{cp_id};
|
|
144 | 164 |
IS->get_customer(\%myconfig, \%$form); |
145 | 165 |
|
146 | 166 |
#quote all_customer Bug 133 |
147 |
foreach $ref (@{ $form->{all_customer} }) { |
|
167 |
foreach my $ref (@{ $form->{all_customer} }) {
|
|
148 | 168 |
$ref->{name} = $form->quote($ref->{name}); |
149 | 169 |
} |
150 | 170 |
if ($id) { |
... | ... | |
183 | 203 |
|
184 | 204 |
# forex |
185 | 205 |
$form->{forex} = $form->{exchangerate}; |
186 |
$exchangerate = ($form->{exchangerate}) ? $form->{exchangerate} : 1; |
|
206 |
my $exchangerate = ($form->{exchangerate}) ? $form->{exchangerate} : 1;
|
|
187 | 207 |
|
188 |
foreach $key (keys %{ $form->{AR_links} }) { |
|
189 |
foreach $ref (@{ $form->{AR_links}{$key} }) { |
|
208 |
foreach my $key (keys %{ $form->{AR_links} }) {
|
|
209 |
foreach my $ref (@{ $form->{AR_links}{$key} }) {
|
|
190 | 210 |
$form->{"select$key"} .= |
191 | 211 |
"<option>$ref->{accno}--$ref->{description}</option>\n"; |
192 | 212 |
} |
193 | 213 |
|
194 | 214 |
if ($key eq "AR_paid") { |
195 |
for $i (1 .. scalar @{ $form->{acc_trans}{$key} }) { |
|
215 |
next unless $form->{acc_trans}{$key}; |
|
216 |
for my $i (1 .. scalar @{ $form->{acc_trans}{$key} }) { |
|
196 | 217 |
$form->{"AR_paid_$i"} = |
197 | 218 |
"$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}"; |
198 | 219 |
|
... | ... | |
222 | 243 |
($form->datetonum($form->{invdate}, \%myconfig) <= |
223 | 244 |
$form->datetonum($form->{closedto}, \%myconfig)); |
224 | 245 |
|
225 |
$lxdebug->leave_sub(); |
|
246 |
$main::lxdebug->leave_sub();
|
|
226 | 247 |
} |
227 | 248 |
|
228 | 249 |
sub prepare_invoice { |
229 |
$lxdebug->enter_sub(); |
|
250 |
$main::lxdebug->enter_sub(); |
|
251 |
|
|
252 |
my $form = $main::form; |
|
253 |
my %myconfig = %main::myconfig; |
|
230 | 254 |
|
231 |
$auth->assert('invoice_edit'); |
|
255 |
$main::auth->assert('invoice_edit');
|
|
232 | 256 |
|
233 | 257 |
if ($form->{type} eq "credit_note") { |
234 | 258 |
$form->{type} = "credit_note"; |
... | ... | |
246 | 270 |
|
247 | 271 |
my $i = 0; |
248 | 272 |
|
249 |
foreach $ref (@{ $form->{invoice_details} }) { |
|
273 |
foreach my $ref (@{ $form->{invoice_details} }) {
|
|
250 | 274 |
$i++; |
251 | 275 |
|
252 | 276 |
map { $form->{"${_}_$i"} = $ref->{$_} } keys %{$ref}; |
253 | 277 |
$form->{"discount_$i"} = |
254 | 278 |
$form->format_amount(\%myconfig, $form->{"discount_$i"} * 100); |
255 |
($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/); |
|
279 |
my ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
|
|
256 | 280 |
$dec = length $dec; |
257 |
$decimalplaces = ($dec > 2) ? $dec : 2; |
|
281 |
my $decimalplaces = ($dec > 2) ? $dec : 2;
|
|
258 | 282 |
|
259 | 283 |
$form->{"sellprice_$i"} = |
260 | 284 |
$form->format_amount(\%myconfig, $form->{"sellprice_$i"}, |
... | ... | |
270 | 294 |
|
271 | 295 |
} |
272 | 296 |
} |
273 |
$lxdebug->leave_sub(); |
|
297 |
$main::lxdebug->leave_sub();
|
|
274 | 298 |
} |
275 | 299 |
|
276 | 300 |
sub form_header { |
277 |
$lxdebug->enter_sub(); |
|
301 |
$main::lxdebug->enter_sub(); |
|
302 |
|
|
303 |
my $form = $main::form; |
|
304 |
my %myconfig = %main::myconfig; |
|
305 |
my $locale = $main::locale; |
|
306 |
my $cgi = $main::cgi; |
|
278 | 307 |
|
279 |
$auth->assert('invoice_edit'); |
|
308 |
$main::auth->assert('invoice_edit');
|
|
280 | 309 |
|
281 | 310 |
$form->{employee_id} = $form->{old_employee_id} if $form->{old_employee_id}; |
282 | 311 |
$form->{salesman_id} = $form->{old_salesman_id} if $form->{old_salesman_id}; |
... | ... | |
294 | 323 |
$form->{radier} = ($form->current_date(\%myconfig) eq $form->{gldate}) ? 1 : 0; |
295 | 324 |
|
296 | 325 |
$payment = qq|<option value=""></option>|; |
297 |
foreach $item (@{ $form->{payment_terms} }) { |
|
326 |
foreach my $item (@{ $form->{payment_terms} }) {
|
|
298 | 327 |
if ($form->{payment_id} eq $item->{id}) { |
299 | 328 |
$payment .= qq|<option value="$item->{id}" selected>$item->{description}</option>|; |
300 | 329 |
} else { |
... | ... | |
427 | 456 |
$labels{$item->{id}} = $item->{name} ne "" ? $item->{name} : $item->{login}; |
428 | 457 |
} |
429 | 458 |
|
430 |
$salesman = |
|
459 |
my $salesman =
|
|
431 | 460 |
qq|<tr> <th align="right">| . $locale->text('Salesman') . qq|</th> |
432 | 461 |
<td>| . NTI($cgi->popup_menu('-name' => 'salesman_id', '-values' => \@values, '-labels' => \%labels, |
433 | 462 |
'-default' => $form->{salesman_id} ? $form->{salesman_id} : $form->{employee_id})) . qq| |
... | ... | |
441 | 470 |
$labels{$item->{"id"}} = $item->{"description"}; |
442 | 471 |
} |
443 | 472 |
|
473 |
my $taxzone; |
|
444 | 474 |
if (!$form->{"id"}) { |
445 | 475 |
$taxzone = qq| |
446 | 476 |
<tr> |
... | ... | |
462 | 492 |
} |
463 | 493 |
|
464 | 494 |
# set option selected |
465 |
foreach $item (qw(AR customer currency department employee)) { |
|
495 |
foreach my $item (qw(AR customer currency department employee)) {
|
|
466 | 496 |
$form->{"select$item"} =~ s/ selected//; |
467 | 497 |
$form->{"select$item"} =~ s/option>\Q$form->{$item}\E/option selected>$form->{$item}/; |
468 | 498 |
} |
469 | 499 |
|
470 |
$creditwarning = (($form->{creditlimit} != 0) && ($form->{creditremaining} < 0) && !$form->{update}) ? 1 : 0; |
|
500 |
my $creditwarning = (($form->{creditlimit} != 0) && ($form->{creditremaining} < 0) && !$form->{update}) ? 1 : 0;
|
|
471 | 501 |
|
472 | 502 |
$form->{exchangerate} = $form->format_amount(\%myconfig, $form->{exchangerate}); |
473 | 503 |
$form->{creditlimit} = $form->format_amount(\%myconfig, $form->{creditlimit}, 0, "0"); |
474 | 504 |
$form->{creditremaining} = $form->format_amount(\%myconfig, $form->{creditremaining}, 0, "0"); |
475 | 505 |
|
476 |
$exchangerate = ""; |
|
506 |
my $exchangerate = "";
|
|
477 | 507 |
if ($form->{currency} ne $form->{defaultcurrency}) { |
478 | 508 |
if ($form->{forex}) { |
479 | 509 |
$exchangerate .= qq|<th align="right">| . $locale->text('Exchangerate') . qq|</th> |
... | ... | |
485 | 515 |
} |
486 | 516 |
$exchangerate .= qq|\n<input type="hidden" name="forex" value="$form->{forex}">\n|; |
487 | 517 |
|
488 |
$department = qq| |
|
518 |
my $department = qq|
|
|
489 | 519 |
<tr> |
490 | 520 |
<th align="right" nowrap>| . $locale->text('Department') . qq|</th> |
491 | 521 |
<td colspan="3"><select name="department" style="width: 250px">$form->{selectdepartment}</select> |
... | ... | |
494 | 524 |
</tr> |
495 | 525 |
| if $form->{selectdepartment}; |
496 | 526 |
|
497 |
$n = ($form->{creditremaining} =~ /-/) ? "0" : "1"; |
|
527 |
my $n = ($form->{creditremaining} =~ /-/) ? "0" : "1";
|
|
498 | 528 |
|
529 |
my $business; |
|
499 | 530 |
if ($form->{business}) { |
500 | 531 |
$business = qq| |
501 | 532 |
<tr> |
... | ... | |
507 | 538 |
|; |
508 | 539 |
} |
509 | 540 |
|
541 |
my $dunning; |
|
510 | 542 |
if ($form->{max_dunning_level}) { |
511 | 543 |
$dunning = qq| |
512 | 544 |
<tr> |
... | ... | |
525 | 557 |
|
526 | 558 |
# use JavaScript Calendar or not |
527 | 559 |
$form->{jsscript} = 1; |
528 |
$jsscript = ""; |
|
560 |
my $jsscript = ""; |
|
561 |
my ($button1, $button2, $button3); |
|
529 | 562 |
if ($form->{type} eq "credit_note") { |
530 | 563 |
$button1 = qq| |
531 | 564 |
<td nowrap><input name="invdate" id="invdate" size="11" title="$myconfig{dateformat}" value="$form->{invdate}" onBlur=\"check_right_date_format(this)\"> |
... | ... | |
557 | 590 |
#write Trigger |
558 | 591 |
$jsscript = |
559 | 592 |
Form->write_trigger(\%myconfig, "3", |
560 |
"invdate", "BL", "trigger1",
|
|
593 |
"invdate", "BL", "trigger1", |
|
561 | 594 |
"duedate", "BL", "trigger2", |
562 | 595 |
"deliverydate", "BL", "trigger3"); |
563 | 596 |
} |
564 | 597 |
|
565 |
$credittext = $locale->text('Credit Limit exceeded!!!'); |
|
598 |
my $credittext = $locale->text('Credit Limit exceeded!!!');
|
|
566 | 599 |
|
567 | 600 |
my $follow_up_vc = $form->{customer}; |
568 | 601 |
$follow_up_vc =~ s/--\d*\s*$//; |
569 | 602 |
my $follow_up_trans_info = "$form->{invnumber} ($follow_up_vc)"; |
570 | 603 |
|
571 |
$onload = ($form->{resubmit} && ($form->{format} eq "html")) ? qq|window.open('about:blank','Beleg'); document.invoice.target = 'Beleg';document.invoice.submit()| |
|
604 |
my $onload = ($form->{resubmit} && ($form->{format} eq "html")) ? qq|window.open('about:blank','Beleg'); document.invoice.target = 'Beleg';document.invoice.submit()|
|
|
572 | 605 |
: ($form->{resubmit}) ? qq|document.invoice.submit()| |
573 | 606 |
: ($creditwarning) ? qq|alert('$credittext')| |
574 | 607 |
: "focus()"; |
... | ... | |
601 | 634 |
$form->hide_form(qw(id action type media format queued printed emailed title vc discount |
602 | 635 |
creditlimit creditremaining tradediscount business closedto locked shipped storno storno_id |
603 | 636 |
max_dunning_level dunning_amount |
604 |
shiptoname shiptostreet shiptozipcode shiptocity shiptocountry shiptocontact shiptophone shiptofax
|
|
637 |
shiptoname shiptostreet shiptozipcode shiptocity shiptocountry shiptocontact shiptophone shiptofax |
|
605 | 638 |
shiptoemail shiptodepartment_1 shiptodepartment_2 message email subject cc bcc taxaccounts cursor_fokus |
606 | 639 |
convert_from_do_ids convert_from_oe_ids), |
607 | 640 |
map { $_.'_rate', $_.'_description', $_.'_taxnumber' } split / /, $form->{taxaccounts} ); |
608 |
|
|
641 |
|
|
609 | 642 |
print qq|<p>$form->{saved_message}</p>| if $form->{saved_message}; |
610 | 643 |
|
611 | 644 |
print qq| |
... | ... | |
615 | 648 |
<input type="hidden" name="follow_up_trans_info_1" value="| . H($follow_up_trans_info) . qq|"> |
616 | 649 |
<input type="hidden" name="follow_up_rowcount" value="1"> |
617 | 650 |
|
618 |
<input type="hidden" name="lizenzen" value="$lizenzen"> |
|
651 |
<input type="hidden" name="lizenzen" value="$main::lizenzen">
|
|
619 | 652 |
|
620 | 653 |
<div class="listtop" width="100%">$form->{title}</div> |
621 | 654 |
|
... | ... | |
700 | 733 |
print qq| <tr> |
701 | 734 |
<th align="right" nowrap>| . $locale->text('Credit Note Number') . qq|</th> |
702 | 735 |
<td> |. |
703 |
$cgi->textfield("-name" => "invnumber", "-size" => 11, "-value" => $form->{invnumber}) .
|
|
736 |
$cgi->textfield("-name" => "invnumber", "-size" => 11, "-value" => $form->{invnumber}) . |
|
704 | 737 |
qq| </td> |
705 | 738 |
</tr> |
706 | 739 |
<tr> |
... | ... | |
711 | 744 |
print qq| <tr> |
712 | 745 |
<th align="right" nowrap>| . $locale->text('Invoice Number') . qq|</th> |
713 | 746 |
<td> |. |
714 |
$cgi->textfield("-name" => "invnumber", "-size" => 11, "-value" => $form->{invnumber}) .
|
|
747 |
$cgi->textfield("-name" => "invnumber", "-size" => 11, "-value" => $form->{invnumber}) . |
|
715 | 748 |
qq| </td> |
716 | 749 |
</tr> |
717 | 750 |
<tr> |
... | ... | |
725 | 758 |
<tr> |
726 | 759 |
<th align="right" nowrap>| . $locale->text('Delivery Order Number') . qq|</th> |
727 | 760 |
<td> |. |
728 |
$cgi->textfield("-name" => "donumber", "-size" => 11, "-value" => $form->{donumber}) .
|
|
761 |
$cgi->textfield("-name" => "donumber", "-size" => 11, "-value" => $form->{donumber}) . |
|
729 | 762 |
qq| </td> |
730 | 763 |
</tr> |
731 | 764 |
<tr> |
... | ... | |
736 | 769 |
print qq| <tr> |
737 | 770 |
<th align="right" nowrap>| . $locale->text('Order Number') . qq|</th> |
738 | 771 |
<td> |. |
739 |
$cgi->textfield("-name" => "ordnumber", "-size" => 11, "-value" => $form->{ordnumber}) .
|
|
772 |
$cgi->textfield("-name" => "ordnumber", "-size" => 11, "-value" => $form->{ordnumber}) . |
|
740 | 773 |
qq| </td> |
741 | 774 |
</tr> |
742 | 775 |
<tr> |
... | ... | |
747 | 780 |
<tr> |
748 | 781 |
<th align="right" nowrap>| . $locale->text('Quotation Number') . qq|</th> |
749 | 782 |
<td> |. |
750 |
$cgi->textfield("-name" => "quonumber", "-size" => 11, "-value" => $form->{quonumber}) .
|
|
783 |
$cgi->textfield("-name" => "quonumber", "-size" => 11, "-value" => $form->{quonumber}) . |
|
751 | 784 |
qq| </td> |
752 | 785 |
</tr> |
753 | 786 |
<tr> |
... | ... | |
758 | 791 |
<tr> |
759 | 792 |
<th align="right" nowrap>| . $locale->text('Customer Order Number') . qq|</th> |
760 | 793 |
<td> |. |
761 |
$cgi->textfield("-name" => "cusordnumber", "-size" => 11, "-value" => $form->{cusordnumber}) .
|
|
794 |
$cgi->textfield("-name" => "cusordnumber", "-size" => 11, "-value" => $form->{cusordnumber}) . |
|
762 | 795 |
qq| </td> |
763 | 796 |
</tr> |
764 | 797 |
<tr> |
... | ... | |
774 | 807 |
<tr> |
775 | 808 |
<td> |
776 | 809 |
</td> |
777 |
</tr>
|
|
810 |
</tr> |
|
778 | 811 |
$jsscript |
779 | 812 |
|; |
780 |
print qq|<input type="hidden" name="webdav" value="$webdav">|; |
|
813 |
print qq|<input type="hidden" name="webdav" value="$main::webdav">|;
|
|
781 | 814 |
|
782 |
$lxdebug->leave_sub(); |
|
815 |
$main::lxdebug->leave_sub();
|
|
783 | 816 |
} |
784 | 817 |
|
785 | 818 |
sub form_footer { |
786 |
$lxdebug->enter_sub(); |
|
819 |
$main::lxdebug->enter_sub(); |
|
820 |
|
|
821 |
my $form = $main::form; |
|
822 |
my %myconfig = %main::myconfig; |
|
823 |
my $locale = $main::locale; |
|
824 |
my $cgi = $main::cgi; |
|
787 | 825 |
|
788 |
$auth->assert('invoice_edit'); |
|
826 |
$main::auth->assert('invoice_edit');
|
|
789 | 827 |
|
790 | 828 |
$form->{invtotal} = $form->{invsubtotal}; |
791 | 829 |
|
830 |
my ($rows, $introws); |
|
792 | 831 |
if (($rows = $form->numtextrows($form->{notes}, 26, 8)) < 2) { |
793 | 832 |
$rows = 2; |
794 | 833 |
} |
... | ... | |
796 | 835 |
$introws = 2; |
797 | 836 |
} |
798 | 837 |
$rows = ($rows > $introws) ? $rows : $introws; |
799 |
$notes = |
|
838 |
my $notes =
|
|
800 | 839 |
qq|<textarea name="notes" rows="$rows" cols="26" wrap="soft">$form->{notes}</textarea>|; |
801 |
$intnotes = |
|
840 |
my $intnotes =
|
|
802 | 841 |
qq|<textarea name="intnotes" rows="$rows" cols="35" wrap="soft">$form->{intnotes}</textarea>|; |
803 | 842 |
|
804 | 843 |
$form->{taxincluded} = ($form->{taxincluded} ? "checked" : ""); |
805 | 844 |
|
806 |
$taxincluded = ""; |
|
845 |
my $taxincluded = "";
|
|
807 | 846 |
if ($form->{taxaccounts}) { |
808 | 847 |
$taxincluded = qq| |
809 | 848 |
<input name="taxincluded" class="checkbox" type="checkbox" $form->{taxincluded}> <b>| |
810 | 849 |
. $locale->text('Tax Included') . qq|</b><br><br>|; |
811 | 850 |
} |
812 | 851 |
|
852 |
my ($tax, $subtotal); |
|
813 | 853 |
if (!$form->{taxincluded}) { |
814 | 854 |
|
815 |
foreach $item (split / /, $form->{taxaccounts}) { |
|
855 |
foreach my $item (split / /, $form->{taxaccounts}) {
|
|
816 | 856 |
if ($form->{"${item}_base"}) { |
817 | 857 |
$form->{"${item}_total"} = |
818 | 858 |
$form->round_amount( |
... | ... | |
845 | 885 |
} |
846 | 886 |
|
847 | 887 |
if ($form->{taxincluded}) { |
848 |
foreach $item (split / /, $form->{taxaccounts}) { |
|
888 |
foreach my $item (split / /, $form->{taxaccounts}) {
|
|
849 | 889 |
if ($form->{"${item}_base"}) { |
850 | 890 |
$form->{"${item}_total"} = |
851 | 891 |
$form->round_amount( |
... | ... | |
947 | 987 |
</td> |
948 | 988 |
</tr> |
949 | 989 |
|; |
950 |
if ($webdav) { |
|
990 |
my $webdav_list; |
|
991 |
if ($main::webdav) { |
|
951 | 992 |
$webdav_list = qq| |
952 | 993 |
<tr> |
953 | 994 |
<td><hr size="3" noshade></td> |
... | ... | |
959 | 1000 |
<td align="left" width="30%"><b>Dateiname</b></td> |
960 | 1001 |
<td align="left" width="70%"><b>Webdavlink</b></td> |
961 | 1002 |
|; |
962 |
foreach $file (@{ $form->{WEBDAV} }) { |
|
1003 |
foreach my $file (@{ $form->{WEBDAV} }) {
|
|
963 | 1004 |
$webdav_list .= qq| |
964 | 1005 |
<tr> |
965 | 1006 |
<td align="left">$file->{name}</td> |
... | ... | |
996 | 1037 |
|; |
997 | 1038 |
} |
998 | 1039 |
|
1040 |
my @column_index; |
|
999 | 1041 |
if ($form->{currency} eq $form->{defaultcurrency}) { |
1000 | 1042 |
@column_index = qw(datepaid source memo paid AR_paid); |
1001 | 1043 |
} else { |
1002 | 1044 |
@column_index = qw(datepaid source memo paid exchangerate AR_paid); |
1003 | 1045 |
} |
1004 | 1046 |
|
1047 |
my %column_data; |
|
1005 | 1048 |
$column_data{datepaid} = "<th>" . $locale->text('Date') . "</th>"; |
1006 | 1049 |
$column_data{paid} = "<th>" . $locale->text('Amount') . "</th>"; |
1007 | 1050 |
$column_data{exchangerate} = "<th>" . $locale->text('Exch') . "</th>"; |
... | ... | |
1021 | 1064 |
my $totalpaid = 0; |
1022 | 1065 |
|
1023 | 1066 |
$form->{paidaccounts}++ if ($form->{"paid_$form->{paidaccounts}"}); |
1024 |
for $i (1 .. $form->{paidaccounts}) { |
|
1067 |
for my $i (1 .. $form->{paidaccounts}) {
|
|
1025 | 1068 |
|
1026 | 1069 |
print " |
1027 | 1070 |
<tr>\n"; |
... | ... | |
1042 | 1085 |
if ($form->{"exchangerate_$i"} == 0) { |
1043 | 1086 |
$form->{"exchangerate_$i"} = ""; |
1044 | 1087 |
} |
1045 |
$exchangerate = qq| |; |
|
1088 |
my $exchangerate = qq| |;
|
|
1046 | 1089 |
if ($form->{currency} ne $form->{defaultcurrency}) { |
1047 | 1090 |
if ($form->{"forex_$i"}) { |
1048 | 1091 |
$exchangerate = qq|<input type="hidden" name="exchangerate_$i" value="$form->{"exchangerate_$i"}">$form->{"exchangerate_$i"}|; |
... | ... | |
1109 | 1152 |
</table> |
1110 | 1153 |
|; |
1111 | 1154 |
|
1112 |
$invdate = $form->datetonum($form->{invdate}, \%myconfig); |
|
1113 |
$closedto = $form->datetonum($form->{closedto}, \%myconfig); |
|
1155 |
my $invdate = $form->datetonum($form->{invdate}, \%myconfig);
|
|
1156 |
my $closedto = $form->datetonum($form->{closedto}, \%myconfig);
|
|
1114 | 1157 |
|
1115 | 1158 |
if ($form->{id}) { |
1116 | 1159 |
my $show_storno = !$form->{storno} && !IS->has_storno(\%myconfig, $form, "ar") && (($totalpaid == 0) || ($totalpaid eq "")); |
... | ... | |
1187 | 1230 |
. qq|"> |; |
1188 | 1231 |
} |
1189 | 1232 |
# /button for saving history |
1190 |
|
|
1191 |
# mark_as_paid button
|
|
1192 |
if($form->{id} ne "") {
|
|
1193 |
print qq|<input type="submit" class="submit" name="action" value="|
|
|
1233 |
|
|
1234 |
# mark_as_paid button |
|
1235 |
if($form->{id} ne "") { |
|
1236 |
print qq|<input type="submit" class="submit" name="action" value="| |
|
1194 | 1237 |
. $locale->text('mark as paid') . qq|">|; |
1195 | 1238 |
} |
1196 | 1239 |
# /mark_as_paid button |
... | ... | |
1211 | 1254 |
</html> |
1212 | 1255 |
|; |
1213 | 1256 |
|
1214 |
$lxdebug->leave_sub(); |
|
1257 |
$main::lxdebug->leave_sub();
|
|
1215 | 1258 |
} |
1216 | 1259 |
|
1217 | 1260 |
sub mark_as_paid { |
1218 |
$lxdebug->enter_sub(); |
|
1261 |
$main::lxdebug->enter_sub(); |
|
1262 |
|
|
1263 |
my $form = $main::form; |
|
1264 |
my %myconfig = %main::myconfig; |
|
1219 | 1265 |
|
1220 |
$auth->assert('invoice_edit'); |
|
1266 |
$main::auth->assert('invoice_edit');
|
|
1221 | 1267 |
|
1222 |
&mark_as_paid_common(\%myconfig,"ar");
|
|
1268 |
&mark_as_paid_common(\%myconfig,"ar"); |
|
1223 | 1269 |
|
1224 |
$lxdebug->leave_sub(); |
|
1270 |
$main::lxdebug->leave_sub();
|
|
1225 | 1271 |
} |
1226 | 1272 |
|
1227 | 1273 |
sub update { |
1228 |
$lxdebug->enter_sub(); |
|
1274 |
$main::lxdebug->enter_sub();
|
|
1229 | 1275 |
|
1230 |
$auth->assert('invoice_edit'); |
|
1276 |
my $form = $main::form; |
|
1277 |
my %myconfig = %main::myconfig; |
|
1278 |
|
|
1279 |
$main::auth->assert('invoice_edit'); |
|
1231 | 1280 |
|
1232 | 1281 |
my ($recursive_call) = shift; |
1233 | 1282 |
|
1234 | 1283 |
map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) } qw(exchangerate creditlimit creditremaining) unless $recursive_call; |
1235 | 1284 |
|
1236 | 1285 |
$form->{print_and_post} = 0 if $form->{second_run}; |
1237 |
$taxincluded = "checked" if $form->{taxincluded}; |
|
1286 |
my $taxincluded = "checked" if $form->{taxincluded};
|
|
1238 | 1287 |
$form->{update} = 1; |
1239 | 1288 |
|
1240 |
&check_name(customer);
|
|
1289 |
&check_name("customer");
|
|
1241 | 1290 |
|
1242 | 1291 |
$form->{taxincluded} ||= $taxincluded; |
1243 | 1292 |
|
1244 | 1293 |
$form->{forex} = $form->check_exchangerate(\%myconfig, $form->{currency}, $form->{invdate}, 'buy'); |
1245 | 1294 |
$form->{exchangerate} = $form->{forex} if $form->{forex}; |
1246 | 1295 |
|
1247 |
for $i (1 .. $form->{paidaccounts}) { |
|
1296 |
for my $i (1 .. $form->{paidaccounts}) {
|
|
1248 | 1297 |
next unless $form->{"paid_$i"}; |
1249 | 1298 |
map { $form->{"${_}_$i"} = $form->parse_amount(\%myconfig, $form->{"${_}_$i"}) } qw(paid exchangerate); |
1250 | 1299 |
$form->{"forex_$i"} = $form->check_exchangerate(\%myconfig, $form->{currency}, $form->{"datepaid_$i"}, 'buy'); |
1251 | 1300 |
$form->{"exchangerate_$i"} = $form->{"forex_$i"} if $form->{"forex_$i"}; |
1252 | 1301 |
} |
1253 | 1302 |
|
1254 |
$i = $form->{rowcount}; |
|
1255 |
$exchangerate = $form->{exchangerate} || 1; |
|
1303 |
my $i = $form->{rowcount};
|
|
1304 |
my $exchangerate = $form->{exchangerate} || 1;
|
|
1256 | 1305 |
|
1257 | 1306 |
# if last row empty, check the form otherwise retrieve new item |
1258 | 1307 |
if ( ($form->{"partnumber_$i"} eq "") |
... | ... | |
1266 | 1315 |
|
1267 | 1316 |
IS->retrieve_item(\%myconfig, \%$form); |
1268 | 1317 |
|
1269 |
$rows = scalar @{ $form->{item_list} }; |
|
1318 |
my $rows = scalar @{ $form->{item_list} };
|
|
1270 | 1319 |
|
1271 | 1320 |
$form->{"discount_$i"} = $form->format_amount(\%myconfig, $form->{customer_discount} * 100); |
1272 | 1321 |
|
... | ... | |
1280 | 1329 |
|
1281 | 1330 |
} else { |
1282 | 1331 |
|
1283 |
$sellprice = $form->parse_amount(\%myconfig, $form->{"sellprice_$i"}); |
|
1332 |
my $sellprice = $form->parse_amount(\%myconfig, $form->{"sellprice_$i"});
|
|
1284 | 1333 |
|
1285 | 1334 |
map { $form->{item_list}[$i]{$_} =~ s/\"/"/g } qw(partnumber description unit); |
1286 | 1335 |
map { $form->{"${_}_$i"} = $form->{item_list}[0]{$_} } keys %{ $form->{item_list}[0] }; |
1287 |
|
|
1336 |
|
|
1288 | 1337 |
$form->{payment_id} = $form->{"part_payment_id_$i"} if $form->{"part_payment_id_$i"} ne ""; |
1289 | 1338 |
$form->{"discount_$i"} = 0 if $form->{"not_discountable_$i"}; |
1290 | 1339 |
|
1291 | 1340 |
$form->{"marge_price_factor_$i"} = $form->{item_list}->[0]->{price_factor}; |
1292 | 1341 |
|
1293 | 1342 |
($sellprice || $form->{"sellprice_$i"}) =~ /\.(\d+)/; |
1294 |
$decimalplaces = max 2, length $1; |
|
1343 |
my $decimalplaces = max 2, length $1;
|
|
1295 | 1344 |
|
1296 | 1345 |
if ($sellprice) { |
1297 | 1346 |
$form->{"sellprice_$i"} = $sellprice; |
... | ... | |
1303 | 1352 |
|
1304 | 1353 |
$form->{"listprice_$i"} /= $exchangerate; |
1305 | 1354 |
|
1306 |
$amount = $form->{"sellprice_$i"} * $form->{"qty_$i"} * (1 - $form->{"discount_$i"} / 100); |
|
1355 |
my $amount = $form->{"sellprice_$i"} * $form->{"qty_$i"} * (1 - $form->{"discount_$i"} / 100);
|
|
1307 | 1356 |
map { $form->{"${_}_base"} = 0 } split / /, $form->{taxaccounts}; |
1308 | 1357 |
map { $form->{"${_}_base"} += $amount } split / /, $form->{"taxaccounts_$i"}; |
1309 | 1358 |
map { $amount += ($form->{"${_}_base"} * $form->{"${_}_rate"}) } split / /, $form->{"taxaccounts_$i"} if !$form->{taxincluded}; |
... | ... | |
1314 | 1363 |
|
1315 | 1364 |
$form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"}); |
1316 | 1365 |
|
1317 |
if ($lizenzen) { |
|
1366 |
if ($main::lizenzen) {
|
|
1318 | 1367 |
if ($form->{"inventory_accno_$i"} ne "") { |
1319 | 1368 |
$form->{"lizenzen_$i"} = qq|<option></option>|; |
1320 |
foreach $item (@{ $form->{LIZENZEN}{ $form->{"id_$i"} } }) { |
|
1369 |
foreach my $item (@{ $form->{LIZENZEN}{ $form->{"id_$i"} } }) {
|
|
1321 | 1370 |
$form->{"lizenzen_$i"} .= qq|<option value="$item->{"id"}">$item->{"licensenumber"}</option>|; |
1322 | 1371 |
} |
1323 | 1372 |
$form->{"lizenzen_$i"} .= qq|<option value=-1>Neue Lizenz</option>|; |
... | ... | |
1351 | 1400 |
} |
1352 | 1401 |
} |
1353 | 1402 |
} |
1354 |
$lxdebug->leave_sub(); |
|
1403 |
$main::lxdebug->leave_sub();
|
|
1355 | 1404 |
} |
1356 | 1405 |
|
1357 | 1406 |
sub post_payment { |
1358 |
$lxdebug->enter_sub(); |
|
1407 |
$main::lxdebug->enter_sub(); |
|
1408 |
|
|
1409 |
my $form = $main::form; |
|
1410 |
my %myconfig = %main::myconfig; |
|
1411 |
my $locale = $main::locale; |
|
1412 |
|
|
1413 |
$main::auth->assert('invoice_edit'); |
|
1359 | 1414 |
|
1360 |
$auth->assert('invoice_edit');
|
|
1415 |
our $invdate;
|
|
1361 | 1416 |
|
1362 | 1417 |
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig); |
1363 |
for $i (1 .. $form->{paidaccounts}) { |
|
1418 |
for my $i (1 .. $form->{paidaccounts}) {
|
|
1364 | 1419 |
if ($form->{"paid_$i"}) { |
1365 |
$datepaid = $form->datetonum($form->{"datepaid_$i"}, \%myconfig); |
|
1420 |
my $datepaid = $form->datetonum($form->{"datepaid_$i"}, \%myconfig);
|
|
1366 | 1421 |
|
1367 | 1422 |
$form->isblank("datepaid_$i", $locale->text('Payment date missing!')); |
1368 | 1423 |
|
... | ... | |
1386 | 1441 |
$form->error($locale->text('Cannot post payment!')); |
1387 | 1442 |
|
1388 | 1443 |
|
1389 |
$lxdebug->leave_sub(); |
|
1444 |
$main::lxdebug->leave_sub();
|
|
1390 | 1445 |
} |
1391 | 1446 |
|
1392 | 1447 |
sub post { |
1393 |
$lxdebug->enter_sub(); |
|
1448 |
$main::lxdebug->enter_sub();
|
|
1394 | 1449 |
|
1395 |
$auth->assert('invoice_edit'); |
|
1450 |
my $form = $main::form; |
|
1451 |
my %myconfig = %main::myconfig; |
|
1452 |
my $locale = $main::locale; |
|
1453 |
|
|
1454 |
$main::auth->assert('invoice_edit'); |
|
1396 | 1455 |
|
1397 | 1456 |
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig); |
1398 | 1457 |
$form->isblank("invdate", $locale->text('Invoice Date missing!')); |
... | ... | |
1404 | 1463 |
$form->{invnumber} =~ s/\s*$//g; |
1405 | 1464 |
|
1406 | 1465 |
# if oldcustomer ne customer redo form |
1407 |
if (&check_name(customer)) {
|
|
1466 |
if (&check_name('customer')) {
|
|
1408 | 1467 |
&update; |
1409 | 1468 |
exit; |
1410 | 1469 |
} |
... | ... | |
1414 | 1473 |
|
1415 | 1474 |
&validate_items; |
1416 | 1475 |
|
1417 |
$closedto = $form->datetonum($form->{closedto}, \%myconfig); |
|
1418 |
$invdate = $form->datetonum($form->{invdate}, \%myconfig); |
|
1476 |
my $closedto = $form->datetonum($form->{closedto}, \%myconfig);
|
|
1477 |
my $invdate = $form->datetonum($form->{invdate}, \%myconfig);
|
|
1419 | 1478 |
|
1420 | 1479 |
$form->error($locale->text('Cannot post invoice for a closed period!')) |
1421 | 1480 |
if ($invdate <= $closedto); |
... | ... | |
1423 | 1482 |
$form->isblank("exchangerate", $locale->text('Exchangerate missing!')) |
1424 | 1483 |
if ($form->{currency} ne $form->{defaultcurrency}); |
1425 | 1484 |
|
1426 |
for $i (1 .. $form->{paidaccounts}) { |
|
1485 |
for my $i (1 .. $form->{paidaccounts}) {
|
|
1427 | 1486 |
if ($form->parse_amount(\%myconfig, $form->{"paid_$i"})) { |
1428 |
$datepaid = $form->datetonum($form->{"datepaid_$i"}, \%myconfig); |
|
1487 |
my $datepaid = $form->datetonum($form->{"datepaid_$i"}, \%myconfig);
|
|
1429 | 1488 |
|
1430 | 1489 |
$form->isblank("datepaid_$i", $locale->text('Payment date missing!')); |
1431 | 1490 |
|
... | ... | |
1474 | 1533 |
$form->redirect( $form->{label} . " $form->{invnumber} " . $locale->text('posted!')) |
1475 | 1534 |
unless $print_post; |
1476 | 1535 |
|
1477 |
$lxdebug->leave_sub(); |
|
1536 |
$main::lxdebug->leave_sub();
|
|
1478 | 1537 |
} |
1479 | 1538 |
|
1480 | 1539 |
sub print_and_post { |
1481 |
$lxdebug->enter_sub(); |
|
1540 |
$main::lxdebug->enter_sub(); |
|
1541 |
|
|
1542 |
my $form = $main::form; |
|
1482 | 1543 |
|
1483 |
$auth->assert('invoice_edit'); |
|
1544 |
$main::auth->assert('invoice_edit');
|
|
1484 | 1545 |
|
1485 |
$old_form = new Form; |
|
1546 |
my $old_form = new Form;
|
|
1486 | 1547 |
$print_post = 1; |
1487 | 1548 |
$form->{print_and_post} = 1; |
1488 | 1549 |
&post(); |
1489 | 1550 |
|
1490 | 1551 |
&edit(); |
1491 |
$lxdebug->leave_sub(); |
|
1552 |
$main::lxdebug->leave_sub();
|
|
1492 | 1553 |
|
1493 | 1554 |
} |
1494 | 1555 |
|
1495 | 1556 |
sub use_as_template { |
1496 |
$lxdebug->enter_sub(); |
|
1557 |
$main::lxdebug->enter_sub(); |
|
1558 |
|
|
1559 |
my $form = $main::form; |
|
1560 |
my %myconfig = %main::myconfig; |
|
1497 | 1561 |
|
1498 |
$auth->assert('invoice_edit'); |
|
1562 |
$main::auth->assert('invoice_edit');
|
|
1499 | 1563 |
|
1500 | 1564 |
map { delete $form->{$_} } qw(printed emailed queued invnumber invdate deliverydate id datepaid_1 source_1 memo_1 paid_1 exchangerate_1 AP_paid_1 storno); |
1501 | 1565 |
$form->{paidaccounts} = 1; |
... | ... | |
1503 | 1567 |
$form->{invdate} = $form->current_date(\%myconfig); |
1504 | 1568 |
&display_form; |
1505 | 1569 |
|
1506 |
$lxdebug->leave_sub(); |
|
1570 |
$main::lxdebug->leave_sub();
|
|
1507 | 1571 |
} |
1508 | 1572 |
|
1509 | 1573 |
sub storno { |
1510 |
$lxdebug->enter_sub(); |
|
1574 |
$main::lxdebug->enter_sub();
|
|
1511 | 1575 |
|
1512 |
$auth->assert('invoice_edit'); |
|
1576 |
my $form = $main::form; |
|
1577 |
my %myconfig = %main::myconfig; |
|
1578 |
my $locale = $main::locale; |
|
1579 |
|
|
1580 |
$main::auth->assert('invoice_edit'); |
|
1513 | 1581 |
|
1514 | 1582 |
if ($form->{storno}) { |
1515 | 1583 |
$form->error($locale->text('Cannot storno storno invoice!')); |
... | ... | |
1536 | 1604 |
$form->{rowcount}++; |
1537 | 1605 |
|
1538 | 1606 |
post(); |
1539 |
$lxdebug->leave_sub(); |
|
1607 |
$main::lxdebug->leave_sub();
|
|
1540 | 1608 |
} |
1541 | 1609 |
|
1542 | 1610 |
sub preview { |
1543 |
$lxdebug->enter_sub(); |
|
1611 |
$main::lxdebug->enter_sub(); |
|
1612 |
|
|
1613 |
my $form = $main::form; |
|
1544 | 1614 |
|
1545 |
$auth->assert('invoice_edit'); |
|
1615 |
$main::auth->assert('invoice_edit');
|
|
1546 | 1616 |
|
1547 | 1617 |
$form->{preview} = 1; |
1548 |
$old_form = new Form; |
|
1618 |
my $old_form = new Form;
|
|
1549 | 1619 |
for (keys %$form) { $old_form->{$_} = $form->{$_} } |
1550 | 1620 |
|
1551 | 1621 |
&print_form($old_form); |
1552 |
$lxdebug->leave_sub(); |
|
1622 |
$main::lxdebug->leave_sub();
|
|
1553 | 1623 |
|
1554 | 1624 |
} |
1555 | 1625 |
|
1556 | 1626 |
sub delete { |
1557 |
$lxdebug->enter_sub(); |
|
1627 |
$main::lxdebug->enter_sub(); |
|
1628 |
|
|
1629 |
my $form = $main::form; |
|
1630 |
my $locale = $main::locale; |
|
1558 | 1631 |
|
1559 |
$auth->assert('invoice_edit'); |
|
1632 |
$main::auth->assert('invoice_edit');
|
|
1560 | 1633 |
|
1561 | 1634 |
if ($form->{second_run}) { |
1562 | 1635 |
$form->{print_and_post} = 0; |
... | ... | |
1572 | 1645 |
# delete action variable |
1573 | 1646 |
map { delete $form->{$_} } qw(action header); |
1574 | 1647 |
|
1575 |
foreach $key (keys %$form) { |
|
1648 |
foreach my $key (keys %$form) {
|
|
1576 | 1649 |
next if (($key eq 'login') || ($key eq 'password') || ('' ne ref $form->{$key})); |
1577 | 1650 |
$form->{$key} =~ s/\"/"/g; |
1578 | 1651 |
print qq|<input type="hidden" name="$key" value="$form->{$key}">\n|; |
... | ... | |
1592 | 1665 |
</form> |
1593 | 1666 |
|; |
1594 | 1667 |
|
1595 |
$lxdebug->leave_sub(); |
|
1668 |
$main::lxdebug->leave_sub();
|
|
1596 | 1669 |
} |
1597 | 1670 |
|
1598 | 1671 |
sub credit_note { |
1599 |
$lxdebug->enter_sub(); |
|
1672 |
$main::lxdebug->enter_sub();
|
|
1600 | 1673 |
|
1601 |
$auth->assert('invoice_edit'); |
|
1674 |
my $form = $main::form; |
|
1675 |
my %myconfig = %main::myconfig; |
|
1676 |
my $locale = $main::locale; |
|
1677 |
|
|
1678 |
$main::auth->assert('invoice_edit'); |
|
1602 | 1679 |
|
1603 | 1680 |
$form->{transdate} = $form->{invdate} = $form->current_date(\%myconfig); |
1604 | 1681 |
$form->{duedate} = |
... | ... | |
1611 | 1688 |
|
1612 | 1689 |
$form->{title} = $locale->text('Add Credit Note'); |
1613 | 1690 |
$form->{script} = 'is.pl'; |
1614 |
$script = "is"; |
|
1615 |
$buysell = 'buy'; |
|
1691 |
our $script = "is";
|
|
1692 |
our $buysell = 'buy';
|
|
1616 | 1693 |
|
1617 | 1694 |
|
1618 | 1695 |
# bo creates the id, reset it |
... | ... | |
1622 | 1699 |
$form->{type} = "credit_note"; |
1623 | 1700 |
|
1624 | 1701 |
|
1625 |
map { $form->{"select$_"} = "" } ($form->{vc}, currency);
|
|
1702 |
map { $form->{"select$_"} = "" } ($form->{vc}, 'currency');
|
|
1626 | 1703 |
|
1627 | 1704 |
map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) } |
1628 | 1705 |
qw(creditlimit creditremaining); |
1629 | 1706 |
|
1630 |
$currency = $form->{currency}; |
|
1707 |
my $currency = $form->{currency};
|
|
1631 | 1708 |
&invoice_links; |
1632 | 1709 |
|
1633 | 1710 |
$form->{currency} = $currency; |
... | ... | |
1641 | 1718 |
|
1642 | 1719 |
&display_form; |
1643 | 1720 |
|
1644 |
$lxdebug->leave_sub(); |
|
1721 |
$main::lxdebug->leave_sub();
|
|
1645 | 1722 |
} |
1646 | 1723 |
|
1647 | 1724 |
sub yes { |
1648 |
$lxdebug->enter_sub(); |
|
1725 |
$main::lxdebug->enter_sub(); |
|
1726 |
|
|
1727 |
my $form = $main::form; |
|
1728 |
my %myconfig = %main::myconfig; |
|
1729 |
my $locale = $main::locale; |
|
1649 | 1730 |
|
1650 |
$auth->assert('invoice_edit'); |
|
1731 |
$main::auth->assert('invoice_edit');
|
|
1651 | 1732 |
|
1652 |
if (IS->delete_invoice(\%myconfig, \%$form, $spool)) { |
|
1733 |
if (IS->delete_invoice(\%myconfig, \%$form, $main::spool)) {
|
|
1653 | 1734 |
# saving the history |
1654 | 1735 |
if(!exists $form->{addition}) { |
1655 | 1736 |
$form->{snumbers} = qq|invnumber_| . $form->{invnumber}; |
... | ... | |
1661 | 1742 |
} |
1662 | 1743 |
$form->error($locale->text('Cannot delete invoice!')); |
1663 | 1744 |
|
1664 |
$lxdebug->leave_sub(); |
|
1745 |
$main::lxdebug->leave_sub();
|
|
1665 | 1746 |
} |
1666 | 1747 |
|
1667 | 1748 |
sub e_mail { |
1668 |
$lxdebug->enter_sub(); |
|
1749 |
$main::lxdebug->enter_sub(); |
|
1750 |
|
|
1751 |
my $form = $main::form; |
|
1669 | 1752 |
|
1670 |
$auth->assert('invoice_edit'); |
|
1753 |
$main::auth->assert('invoice_edit');
|
|
1671 | 1754 |
|
1672 | 1755 |
if (!$form->{id}) { |
1673 | 1756 |
$print_post = 1; |
... | ... | |
1681 | 1764 |
|
1682 | 1765 |
edit_e_mail(); |
1683 | 1766 |
|
1684 |
$lxdebug->leave_sub(); |
|
1767 |
$main::lxdebug->leave_sub();
|
|
1685 | 1768 |
} |
Auch abrufbar als: Unified diff
is strict