X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=inline;f=bin%2Fmozilla%2Fis.pl;h=2d833b6b7cf8a20beeed209630f7cd3c551c6747;hb=9e152755a340c813514eb132de27349ae7a9e028;hp=b38cfd1d5446b3793fcd32ff9c4fc151990c308f;hpb=d8f9066b6970e13c4e517d3951b6df3bb544ef8b;p=kivitendo-erp.git
diff --git a/bin/mozilla/is.pl b/bin/mozilla/is.pl
index b38cfd1d5..2d833b6b7 100644
--- a/bin/mozilla/is.pl
+++ b/bin/mozilla/is.pl
@@ -94,14 +94,6 @@ sub edit {
$form->{javascript} = qq||;
#/show hhistory button
- if ($form->{type} eq "credit_note") {
- $form->{title} = $locale->text('Edit Credit Note');
- $form->{title} = $locale->text('Edit Storno Credit Note') if $form->{storno};
- } else {
- $form->{title} = $locale->text('Edit Sales Invoice');
- $form->{title} = $locale->text('Edit Storno Invoice') if $form->{storno};
- }
-
my ($language_id, $printer_id);
if ($form->{print_and_post}) {
$form->{action} = "print";
@@ -109,7 +101,16 @@ sub edit {
$language_id = $form->{language_id};
$printer_id = $form->{printer_id};
}
+
&invoice_links;
+ if ($form->{type} eq "credit_note") {
+ $form->{title} = $locale->text('Edit Credit Note');
+ $form->{title} = $locale->text('Edit Storno Credit Note') if $form->{storno};
+ } else {
+ $form->{title} = $locale->text('Edit Sales Invoice');
+ $form->{title} = $locale->text('Edit Storno Invoice') if $form->{storno};
+ }
+
&prepare_invoice;
if ($form->{print_and_post}) {
$form->{language_id} = $language_id;
@@ -132,8 +133,8 @@ sub invoice_links {
$form->{vc} = 'customer';
# create links
- $form->{webdav} = $main::webdav;
- $form->{lizenzen} = $main::lizenzen;
+ $form->{webdav} = $::lx_office_conf{features}->{webdav};
+ $form->{lizenzen} = $::lx_office_conf{features}->{lizenzen};
$form->create_links("AR", \%myconfig, "customer");
@@ -155,14 +156,6 @@ sub invoice_links {
$ref->{name} = $form->quote($ref->{name});
}
- # Load data for a specific order and update form fields
- my $order_data = OE->get_order_data_by_ordnumber(%$form) if $form->{ordnumber};
-
- # Copy the fields we need to %form
- for my $key (qw(payment_id salesman_id orddate taxzone_id quonumber)) {
- $form->{$key} = $order_data->{$key};
- }
-
$form->restore_vars(qw(id));
IS->retrieve_invoice(\%myconfig, \%$form);
@@ -274,7 +267,13 @@ sub prepare_invoice {
# get pricegroups for parts
IS->get_pricegroups_for_parts(\%myconfig, \%$form);
- set_pricegroup($_) for 1 .. $form->{rowcount};
+
+ # Problem: set_pricegroup resets the sellprice of old invoices to the price
+ # currently defined in the pricegroup, which is a problem if the price has
+ # changed, as the old invoice gets the new price
+ # set_pricegroup must never be called, when an old invoice is initially loaded
+
+ # set_pricegroup($_) for 1 .. $form->{rowcount};
}
$main::lxdebug->leave_sub();
}
@@ -334,7 +333,7 @@ sub form_header {
my @values = map { $_ } @{ $form->{ALL_CURRENCIES} };
my %labels = map { $_ => $_ } @{ $form->{ALL_CURRENCIES} };
$form->{currency} = $form->{defaultcurrency} unless $form->{currency};
- $TMPL_VAR{show_exchangerate} = $form->{currency} ne $form->{defaultcurrency};
+ $form->{show_exchangerate} = $form->{currency} ne $form->{defaultcurrency};
$TMPL_VAR{currencies} = NTI($::cgi->popup_menu('-name' => 'currency', '-default' => $form->{"currency"},
'-values' => \@values, '-labels' => \%labels)) if scalar @values;
push @custom_hiddens, "forex";
@@ -474,9 +473,9 @@ sub update {
$main::auth->assert('invoice_edit');
- my ($recursive_call) = shift;
+ my ($recursive_call) = @_;
-# map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) } qw(exchangerate creditlimit creditremaining) unless $recursive_call;
+ $form->{exchangerate} = $form->parse_amount(\%myconfig, $form->{exchangerate}) unless $recursive_call;
$form->{print_and_post} = 0 if $form->{second_run};
my $taxincluded = "checked" if $form->{taxincluded};
@@ -513,7 +512,11 @@ sub update {
my $rows = scalar @{ $form->{item_list} };
- $form->{"discount_$i"} = $form->format_amount(\%myconfig, $form->{customer_discount} * 100);
+ # Falls kein Kundenrabatt vorhanden ist, den aktuellen Rabatt nicht mit 0% überschreiben,
+ # da hier der Anwender schon manual einen Wert eingetragen haben könnte (analog zu qty) Bugfix: 1412
+ if ($form->{customer_discount}){
+ $form->{"discount_$i"} = $form->format_amount(\%myconfig, $form->{customer_discount} * 100);
+ }
if ($rows) {
$form->{"qty_$i"} = ($form->{"qty_$i"} * 1) ? $form->{"qty_$i"} : 1;
@@ -559,7 +562,7 @@ sub update {
$form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"});
- if ($main::lizenzen) {
+ if ($::lx_office_conf{features}->{lizenzen}) {
if ($form->{"inventory_accno_$i"} ne "") {
$form->{"lizenzen_$i"} = qq||;
foreach my $item (@{ $form->{LIZENZEN}{ $form->{"id_$i"} } }) {
@@ -635,7 +638,7 @@ sub post_payment {
# Das Problem hierbei ist, dass in IS.pm post_invoice IMMER alle Zahlungseingänge aus $form
# erneut gespeichert werden. Prinzipiell wäre es besser NUR die Ãnderungen des Rechnungs-
# belegs (neue Zahlung aber nichts anderes) zu speichern ...
- # Vielleicht könnte man ähnlich wie bei Rechnung löschen verfahren
+ # Vielleicht könnte man ähnlich wie bei Rechnung löschen verfahren
$form->error($locale->text('Cannot post payment for a closed period!'))
if ($form->date_closed($form->{"datepaid_$form->{paidaccounts}"}, \%myconfig));
@@ -784,6 +787,11 @@ sub use_as_template {
$form->{paidaccounts} = 1;
$form->{rowcount}--;
$form->{invdate} = $form->current_date(\%myconfig);
+
+ # remember pricegroups for "use as template"
+ IS->get_pricegroups_for_parts(\%myconfig, \%$form);
+ set_pricegroup($_) for 1 .. $form->{rowcount};
+
&display_form;
$main::lxdebug->leave_sub();
@@ -908,7 +916,8 @@ sub credit_note {
$form->{title} = $locale->text('Add Credit Note');
$form->{script} = 'is.pl';
-
+ # Bei Gutschriften bezug zur Rechnungsnummer
+ $form->{invnumber_for_credit_note} = $form->{invnumber};
# bo creates the id, reset it
map { delete $form->{$_} }
qw(id invnumber subject message cc bcc printed emailed queued);
@@ -957,7 +966,7 @@ sub yes {
$main::auth->assert('invoice_edit');
- if (IS->delete_invoice(\%myconfig, \%$form, $main::spool)) {
+ if (IS->delete_invoice(\%myconfig, \%$form)) {
# saving the history
if(!exists $form->{addition}) {
$form->{snumbers} = qq|invnumber_| . $form->{invnumber};