Umstellung der HTML-Vorlagen aus templates/webpages/rp von HTML::Template auf Template.
[kivitendo-erp.git] / bin / mozilla / is.pl
index bfcad9e..65cc060 100644 (file)
@@ -37,6 +37,7 @@ use Data::Dumper;
 use List::Util qw(max);
 
 require "bin/mozilla/io.pl";
+require "bin/mozilla/invoice_io.pl";
 require "bin/mozilla/arap.pl";
 require "bin/mozilla/drafts.pl";
 
@@ -312,15 +313,16 @@ sub form_header {
   my @old_project_ids = ($form->{"globalproject_id"});
   map { push @old_project_ids, $form->{"project_id_$_"} if $form->{"project_id_$_"}; } 1..$form->{"rowcount"};
 
-  $form->get_lists("contacts"   => "ALL_CONTACTS",
-                   "shipto"     => "ALL_SHIPTO",
-                   "projects"   => { "key"    => "ALL_PROJECTS",
-                                     "all"    => 0,
-                                     "old_id" => \@old_project_ids },
-                   "employees"  => "ALL_SALESMEN",
-                   "taxzones"   => "ALL_TAXZONES",
-                   "currencies" => "ALL_CURRENCIES",
-                   "customers"  => "ALL_CUSTOMERS");
+  $form->get_lists("contacts"      => "ALL_CONTACTS",
+                   "shipto"        => "ALL_SHIPTO",
+                   "projects"      => { "key"    => "ALL_PROJECTS",
+                                        "all"    => 0,
+                                        "old_id" => \@old_project_ids },
+                   "employees"     => "ALL_SALESMEN",
+                   "taxzones"      => "ALL_TAXZONES",
+                   "currencies"    => "ALL_CURRENCIES",
+                   "customers"     => "ALL_CUSTOMERS",
+                   "price_factors" => "ALL_PRICE_FACTORS");
 
   my %labels;
   my @values = (undef);
@@ -598,7 +600,7 @@ sub form_header {
                       max_dunning_level dunning_amount
                       shiptoname shiptostreet shiptozipcode shiptocity shiptocountry  shiptocontact shiptophone shiptofax 
                       shiptoemail shiptodepartment_1 shiptodepartment_2 message email subject cc bcc taxaccounts),
-                      map { $_.'_rate', $_,'_description', $_.'_taxnumber' } split / /, $form->{taxaccounts} );
+                      map { $_.'_rate', $_.'_description', $_.'_taxnumber' } split / /, $form->{taxaccounts} );
    
   print qq|<p>$form->{saved_message}</p>| if $form->{saved_message};
 
@@ -1169,7 +1171,9 @@ sub mark_as_paid {
 sub update {
   $lxdebug->enter_sub();
 
-  map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) } qw(exchangerate creditlimit creditremaining);
+  my ($recursive_call) = shift;
+
+  map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) } qw(exchangerate creditlimit creditremaining) unless $recursive_call;
 
   $form->{print_and_post} = 0         if $form->{second_run};
   $taxincluded            = "checked" if $form->{taxincluded};
@@ -1226,6 +1230,8 @@ sub update {
         $form->{payment_id}    = $form->{"part_payment_id_$i"} if $form->{"part_payment_id_$i"} ne "";
         $form->{"discount_$i"} = 0                             if $form->{"not_discountable_$i"};
 
+        $form->{"marge_price_factor_$i"} = $form->{item_list}->[0]->{price_factor};
+
         ($sellprice || $form->{"sellprice_$i"}) =~ /\.(\d+)/;
         $decimalplaces = max 2, length $1;