X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fir.pl;h=e5b698db83cfb9b08f0fff5336e10ce0a6487736;hb=12c4c658bc579890462f96832d918337c2b2d484;hp=faaa3cc6461a07fc9ba66d0a35f2f28ce6094e71;hpb=83d48a07af73da318458780e40814cf89579cb94;p=kivitendo-erp.git diff --git a/bin/mozilla/ir.pl b/bin/mozilla/ir.pl index faaa3cc64..e5b698db8 100644 --- a/bin/mozilla/ir.pl +++ b/bin/mozilla/ir.pl @@ -275,7 +275,9 @@ sub form_header { "all" => 0, "old_id" => \@old_project_ids }, "taxzones" => "ALL_TAXZONES", - "currencies" => "ALL_CURRENCIES"); + "employees" => "ALL_SALESMEN", + "currencies" => "ALL_CURRENCIES", + "vendors" => "ALL_VENDORS"); my %labels; my @values = (undef); @@ -301,9 +303,10 @@ sub form_header { %labels = (); @values = (); + my $i = 0; 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}; @@ -315,7 +318,38 @@ sub form_header { '-values' => \@values, '-labels' => \%labels)) . qq| |; + + %labels = (); + @values = (); + my $i = 0; + 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_id', '-default' => $form->{"employee_id"}, + '-values' => \@values, '-labels' => \%labels)) . qq| + + |; + %labels = (); + @values = (); + my $i = 0; + foreach my $item (@{ $form->{"ALL_VENDORS"} }) { + push(@values, $item->{name}.qq|--|.$item->{"id"}); + $labels{$item->{"id"}} = $item->{"name"}.qq|--|.$item->{"id"}; + } + my $vendors = qq| + | . $locale->text('Vendor') . qq| + | . + NTI($cgi->popup_menu('-name' => 'vendor', '-default' => $form->{"vendor"}, + '-onChange' => 'document.getElementById(\'update_button\').click();', + '-values' => \@values, '-labels' => \%labels)) . qq| + |; + %labels = (); @values = (); foreach my $item (@{ $form->{"ALL_TAXZONES"} }) { @@ -344,19 +378,11 @@ sub form_header { |; } - $vendor = - ($form->{selectvendor}) - ? qq|\n| - : qq||; - $department = qq| | . $locale->text('Department') . qq| - - + + | if $form->{selectdepartment}; @@ -440,20 +466,18 @@ onchange="document.getElementById('update_button').click();">| . - - - + $vendors - {vendor_id}> - - + + + - + - - - + + + $taxzone $department @@ -479,7 +503,8 @@ onchange="document.getElementById('update_button').click();">| .
| . $locale->text('Vendor') . qq|$vendor| . $locale->text('Contact Person') . qq| $contact
+ @@ -463,11 +487,11 @@ onchange="document.getElementById('update_button').click();">| .
| . $locale->text('Credit Limit') . qq|$form->{creditremaining}
-
| . $locale->text('Record in') . qq|| . $locale->text('Record in') . qq|
- + $employees + @@ -662,7 +687,7 @@ sub form_footer {
| . $locale->text('Invoice Number') . qq|
$subtotal $tax - 0 + @@ -988,9 +1013,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 "") { @@ -1005,7 +1035,8 @@ sub storno { $form->{id} = ""; $form->{invnumber} = "Storno zu " . $form->{invnumber}; $form->{rowcount}++; - &post(); + $form->{employee_id} = $employee_id; + post(); $lxdebug->leave_sub(); } @@ -1068,6 +1099,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;
| . $locale->text('Total') . qq| $form->{invtotal}