X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fis.pl;h=f02e066ddc65eecdd8b134499bc287d2ae4da4fb;hb=47916a374217afc8d84bd147f0fada5086970bae;hp=59d4b479053bcbc73252bce6aefbad24de0aa59e;hpb=83d48a07af73da318458780e40814cf89579cb94;p=kivitendo-erp.git
diff --git a/bin/mozilla/is.pl b/bin/mozilla/is.pl
index 59d4b4790..f02e066dd 100644
--- a/bin/mozilla/is.pl
+++ b/bin/mozilla/is.pl
@@ -170,9 +170,8 @@ sub invoice_links {
$form->{oldcustomer} = "$form->{customer}--$form->{customer_id}";
if (@{ $form->{all_customer} }) {
- $form->{customer} = "$form->{customer}--$form->{customer_id}";
- map { $form->{selectcustomer} .= "\n" }
- (@{ $form->{all_customer} });
+ $form->{customer} = "$form->{customer}--$form->{customer_id}";
+ $form->{selectcustomer} = "$form->{customer}--$form->{customer_id}";
}
# departments
@@ -188,13 +187,6 @@ sub invoice_links {
$form->{employee} = "$form->{employee}--$form->{employee_id}";
- # sales staff
- if ($form->{all_employees}) {
- $form->{selectemployee} = "";
- map { $form->{selectemployee} .= "\n" }
- (@{ $form->{all_employees} });
- }
-
# forex
$form->{forex} = $form->{exchangerate};
$exchangerate = ($form->{exchangerate}) ? $form->{exchangerate} : 1;
@@ -338,7 +330,8 @@ sub form_header {
"old_id" => \@old_project_ids },
"employees" => "ALL_SALESMEN",
"taxzones" => "ALL_TAXZONES",
- "currencies" => "ALL_CURRENCIES");
+ "currencies" => "ALL_CURRENCIES",
+ "customers" => "ALL_CUSTOMERS");
my %labels;
my @values = (undef);
@@ -347,10 +340,53 @@ sub form_header {
$labels{$item->{"cp_id"}} = $item->{"cp_name"} .
($item->{"cp_abteilung"} ? " ($item->{cp_abteilung})" : "");
}
- my $contact =
- NTI($cgi->popup_menu('-name' => 'cp_id', '-values' => \@values,
- '-labels' => \%labels, '-default' => $form->{"cp_id"}));
+ my $contact;
+ if (scalar @values > 1) {
+ $contact = qq|
+
+ | . $locale->text('Contact Person') . qq| |
+ | .
+ NTI($cgi->popup_menu('-name' => 'cp_id', '-values' => \@values,
+ '-labels' => \%labels, '-default' => $form->{"cp_id"}))
+ . qq|
+ |
+
|;
+ }
+
+ %labels = ();
+ @values = ();
+ foreach my $item (@{ $form->{"ALL_SALESMEN"} }) {
+ push(@values, $item->{"id"});
+ $labels{$item->{"id"}} = $item->{"name"};
+ }
+
+ my $employees = qq|
+
+ | . $locale->text('Employee') . qq| |
+ | .
+ NTI($cgi->popup_menu('-name' => 'employee', '-default' => $form->{"employee_id"},
+ '-values' => \@values, '-labels' => \%labels)) . qq|
+ |
+
|;
+
+ %labels = ();
+ @values = ();
+ foreach my $item (@{ $form->{"ALL_CUSTOMERS"} }) {
+ push(@values, $item->{name}.qq|--|.$item->{"id"});
+ $labels{$item->{"id"}} = $item->{name}.qq|--|.$item->{"id"};
+ }
+
+ my $customers = qq|
+ | . $locale->text('Customer') . qq| |
+ | .
+ (($myconfig{vclimit} <= scalar(@values))
+ ? qq||
+ : (NTI($cgi->popup_menu('-name' => 'customer', '-default' => $form->{oldcustomer},
+ '-onChange' => 'document.getElementById(\'update_button\').click();',
+ '-values' => \@values, '-labels' => \%labels)))) . qq|
+ | |;
+
%labels = ();
@values = ("");
foreach my $item (@{ $form->{"ALL_SHIPTO"} }) {
@@ -359,22 +395,28 @@ sub form_header {
$item->{"shiptoname"} . " " . $item->{"shiptodepartment_1"};
}
- my $shipto = qq|
- | . $locale->text('Shipping Address') . qq| |
- | .
- NTI($cgi->popup_menu('-name' => 'shipto_id', '-values' => \@values,
- '-labels' => \%labels, '-default' => $form->{"shipto_id"}))
+ my $shipto;
+ if (scalar @values > 1) {
+ $shipto = qq|
+ |
+ | . $locale->text('Shipping Address') . qq| |
+ | .
+ NTI($cgi->popup_menu('-name' => 'shipto_id', '-values' => \@values,
+ '-labels' => \%labels, '-default' => $form->{"shipto_id"}))
. qq| | |;
+ }
%labels = ();
@values = ();
foreach my $item (@{ $form->{"ALL_CURRENCIES"} }) {
- push(@values, $item->{"currency"});
- $labels{$item->{"currency"}} = $item->{"currency"};
+ push(@values, $item);
+ $labels{$item} = $item;
}
$form->{currency} = $form->{defaultcurrency} unless $form->{currency};
- my $currencies = qq|
+ my $currencies;
+ if (scalar @values) {
+ $currencies = qq|
| . $locale->text('Currency') . qq| |
| .
@@ -382,6 +424,7 @@ sub form_header {
'-values' => \@values, '-labels' => \%labels)) . qq|
|
|;
+ }
%labels = ();
@values = ("");
@@ -483,14 +526,6 @@ sub form_header {
|;
- $customer =
- ($form->{selectcustomer})
- ? qq|\n|
- : qq||;
-
$department = qq|
| . $locale->text('Department') . qq| |
@@ -517,20 +552,15 @@ onchange="document.getElementById('update_button').click();">| .
if ($form->{max_dunning_level}) {
$dunning = qq|
-
-
-
-
- | . $locale->text('Max. Dunning Level') . qq|: |
- $form->{max_dunning_level} |
- | . $locale->text('Dunning Amount') . qq|: |
- |
- . $form->format_amount(\%myconfig, $form->{dunning_amount},2)
- . qq| |
-
-
- |
-
+
+ | . $locale->text('Max. Dunning Level') . qq|: |
+
+ $form->{max_dunning_level};
+ | . $locale->text('Dunning Amount') . qq|: |
+ . $form->format_amount(\%myconfig, $form->{dunning_amount},2)
+ . qq|
+ |
+
|;
}
@@ -544,8 +574,8 @@ onchange="document.getElementById('update_button').click();">| .
# with JavaScript Calendar
$button1 = qq|
- |
-
+ | |;
#write Trigger
@@ -566,18 +596,18 @@ onchange="document.getElementById('update_button').click();">| .
# with JavaScript Calendar
$button1 = qq|
- |
-
+ |
|;
$button2 = qq|
- |
-
+ |
|;
$button3 = qq|
- |
-
+ |
|;
@@ -641,44 +671,27 @@ print qq|
+$form->{title}
+
-
- $form->{title} |
-
-
-
-
-
-
-
-
- | . $locale->text('Customer') . qq| |
- $customer |
-
-
-
- |
- . $locale->text('Contact Person') . qq| |
- $contact |
-
-
- |
-
-
-
- | . $locale->text('Credit Limit') . qq| |
- $form->{creditlimit} |
- |
- | . $locale->text('Remaining') . qq| |
- $form->{creditremaining} |
-
-
- |
- $shipto
-
- $business
- $dunning
+
+
+
+ $customers
+
+
+
+
+
+ $contact
+ $shipto
+
+ | . $locale->text('Credit Limit') . qq| |
+ $form->{creditlimit}; | . $locale->text('Remaining') . qq| $form->{creditremaining} |
+
+ $dunning
+ $business
| . $locale->text('Record in') . qq| |
|
@@ -700,7 +713,11 @@ print qq|
| . $locale->text('Ship via') . qq| |
|
- |;
+
+
+ | . $locale->text('Transaction description') . qq| |
+ | . $cgi->textfield("-name" => "transaction_description", "-size" => 35, "-value" => $form->{transaction_description}) . qq| |
+ |;
#
#
#
@@ -723,14 +740,9 @@ print qq|
#
print qq|
|
-
+ |
-
- | . $locale->text('Employee') . qq| |
- |
-
- |
-
+ $employees
$salesman
|;
if ($form->{type} eq "credit_note") {
@@ -766,8 +778,8 @@ print qq|
| . $locale->text('Order Date') . qq| |
- |
- |
+
+ |
| . $locale->text('Quotation Number') . qq| |
@@ -775,8 +787,8 @@ print qq|
| . $locale->text('Quotation Date') . qq| |
- |
- |
+
+ |
| . $locale->text('Customer Order Number') . qq| |
@@ -831,13 +843,13 @@ sub form_footer {
qq||;
$intnotes =
qq||;
-
- $form->{taxincluded} = ($form->{taxincluded}) ? "checked" : "";
+
+ $form->{taxincluded} = ($form->{taxincluded} ? "checked" : "");
$taxincluded = "";
if ($form->{taxaccounts}) {
$taxincluded = qq|
- {taxincluded}> |
+ {taxincluded}> |
. $locale->text('Tax Included') . qq|
|;
}
@@ -1194,10 +1206,19 @@ sub update {
$form->{print_and_post} = 0;
}
+
+ if($form->{taxincluded}) {
+ $taxincluded = "checked";
+ }
$form->{update} = 1;
&check_name(customer);
+ if(!$form->{taxincluded}) {
+ $form->{taxincluded} = $taxincluded;
+ }
+
+
$form->{exchangerate} = $exchangerate
if (
$form->{forex} = (
@@ -1385,6 +1406,9 @@ sub post {
$form->isblank("invdate", $locale->text('Invoice Date missing!'));
$form->isblank("customer", $locale->text('Customer missing!'));
+ $form->{invnumber} =~ s/^\s*//g;
+ $form->{invnumber} =~ s/\s*$//g;
+
# if oldcustomer ne customer redo form
if (&check_name(customer)) {
&update;
@@ -1495,21 +1519,25 @@ sub storno {
}
map({ my $key = $_; delete($form->{$key})
- unless (grep({ $key eq $_ } qw(login password id type))); }
+ unless (grep({ $key eq $_ } qw(login password id stylesheet type))); }
keys(%{ $form }));
- &invoice_links;
- &prepare_invoice;
+ invoice_links();
+ prepare_invoice();
relink_accounts();
+ # Payments must not be recorded for the new storno invoice.
+ $form->{paidaccounts} = 0;
+ map { my $key = $_; delete $form->{$key} if grep { $key =~ /^$_/ } qw(datepaid_ source_ memo_ paid_ exchangerate_ AR_paid_) } keys %{ $form };
+
$form->{storno_id} = $form->{id};
$form->{storno} = 1;
$form->{id} = "";
$form->{invnumber} = "Storno zu " . $form->{invnumber};
+ $form->{rowcount}++;
- &post();
+ post();
$lxdebug->leave_sub();
-
}
sub preview {
| | | |