X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fir.pl;h=159dc45e8941d0896c74b8453c3e777648f649ae;hb=47916a374217afc8d84bd147f0fada5086970bae;hp=284b2fe5d4fe2f105105d107371fa457d99877b5;hpb=ccc290effb308a410a43a016c1b6d69fc16c7eb6;p=kivitendo-erp.git
diff --git a/bin/mozilla/ir.pl b/bin/mozilla/ir.pl
index 284b2fe5d..159dc45e8 100644
--- a/bin/mozilla/ir.pl
+++ b/bin/mozilla/ir.pl
@@ -223,7 +223,7 @@ sub form_header {
$lxdebug->enter_sub();
# set option selected
- foreach $item (qw(AP vendor currency department employee)) {
+ foreach $item (qw(AP vendor currency department)) {
$form->{"select$item"} =~ s/ selected//;
$form->{"select$item"} =~
s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
@@ -286,9 +286,19 @@ 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 = ("");
@@ -309,8 +319,10 @@ sub form_header {
$labels{$item} = $item;
}
- $form->{currency} = $form->{defaultcurrency} unless $form->{currency};
- my $currencies = qq|
+ $form->{currency} = $form->{defaultcurrency} unless $form->{currency};
+ my $currencies;
+ if (scalar @values) {
+ $currencies = qq|
| . $locale->text('Currency') . qq| |
| .
@@ -318,7 +330,8 @@ sub form_header {
'-values' => \@values, '-labels' => \%labels)) . qq|
|
|;
-
+ }
+
%labels = ();
@values = ();
my $i = 0;
@@ -330,7 +343,7 @@ sub form_header {
| . $locale->text('Employee') . qq| |
| .
- NTI($cgi->popup_menu('-name' => 'employee', '-default' => $form->{"employee"},
+ NTI($cgi->popup_menu('-name' => 'employee_id', '-default' => $form->{"employee_id"},
'-values' => \@values, '-labels' => \%labels)) . qq|
|
|;
@@ -396,13 +409,13 @@ sub form_header {
# with JavaScript Calendar
$button1 = qq|
- |
-
+ text('button') . qq|> |
|;
$button2 = qq|
- |
-
+ text('button') . qq|> |
|;
@@ -454,40 +467,21 @@ sub form_header {
| . ($form->{saved_message} ? qq|$form->{saved_message}
| : "") . qq|
+$form->{title}
+
-
- $form->{title} |
-
-
-
-
-
-
+ |
-
- $vendors
- |
- . $locale->text('Contact Person') . qq| |
- $contact |
-
-
-
-
-
-
- |
-
-
-
- | . $locale->text('Credit Limit') . qq| |
- $form->{creditlimit} |
- |
- | . $locale->text('Remaining') . qq| |
- $form->{creditremaining} |
-
-
- |
+ $vendors
+
+
+
+ $contact
+
+ | . $locale->text('Credit Limit') . qq| |
+ $form->{creditlimit}; | . $locale->text('Remaining') . qq| $form->{creditremaining} |
+
| . $locale->text('Record in') . qq| |
|
@@ -523,13 +517,13 @@ sub form_header {
| . $locale->text('Order Date') . qq| |
- |
- |
+
+ |
| . $locale->text('Quotation Date') . qq| |
- |
- |
+
+ |
| . $locale->text('Project Number') . qq| |
@@ -830,6 +824,10 @@ sub form_footer {
$invdate = $form->datetonum($form->{invdate}, \%myconfig);
$closedto = $form->datetonum($form->{closedto}, \%myconfig);
+ print qq|
+|;
+
if ($form->{id}) {
my $show_storno = !$form->{storno} && !IS->has_storno(\%myconfig, $form, "ap");
@@ -851,9 +849,6 @@ sub form_footer {
}
- print qq||;
-
if (!$form->{id} && ($invdate > $closedto)) {
print qq| | .
@@ -1013,9 +1008,14 @@ sub storno {
$form->error($locale->text("Invoice has already been storno'd!"));
}
+ my $employee_id = $form->{employee_id};
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 };
# saving the history
if(!exists $form->{addition} && $form->{id} ne "") {
@@ -1030,7 +1030,8 @@ sub storno {
$form->{id} = "";
$form->{invnumber} = "Storno zu " . $form->{invnumber};
$form->{rowcount}++;
- &post();
+ $form->{employee_id} = $employee_id;
+ post();
$lxdebug->leave_sub();
}
@@ -1093,6 +1094,9 @@ sub post {
$form->isblank("invdate", $locale->text('Invoice Date missing!'));
$form->isblank("vendor", $locale->text('Vendor missing!'));
+ $form->{invnumber} =~ s/^\s*//g;
+ $form->{invnumber} =~ s/\s*$//g;
+
# if the vendor changed get new values
if (&check_name(vendor)) {
&update;
| |