Interne Bemerkungen im Workflow von Einkaufslieferschein nach Rechnung nicht überschr...
[kivitendo-erp.git] / bin / mozilla / ir.pl
index 4209fdf..ddf5796 100644 (file)
@@ -101,8 +101,7 @@ sub invoice_links {
   $form->{vc} = 'vendor';
 
   # create links
-  $form->{webdav}   = $::lx_office_conf{features}->{webdav};
-  $form->{jsscript} = 1;
+  $form->{webdav}   = $::instance_conf->get_webdav;
 
   $form->create_links("AP", \%myconfig, "vendor");
 
@@ -117,7 +116,7 @@ sub invoice_links {
     }
   }
 
-  my ($payment_id, $language_id, $taxzone_id, $currency);
+  my ($payment_id, $language_id, $taxzone_id, $currency, $delivery_term_id, $intnotes);
   if ($form->{payment_id}) {
     $payment_id = $form->{payment_id};
   }
@@ -130,6 +129,12 @@ sub invoice_links {
   if ($form->{currency}) {
     $currency = $form->{currency};
   }
+  if ($form->{delivery_term_id}) {
+    $delivery_term_id = $form->{delivery_term_id};
+  }
+  if (exists $form->{intnotes}) {
+    $intnotes = $form->{intnotes};
+  }
 
   my $cp_id = $form->{cp_id};
   IR->get_vendor(\%myconfig, \%$form);
@@ -148,6 +153,12 @@ sub invoice_links {
   if ($currency) {
     $form->{currency} = $currency;
   }
+  if ($delivery_term_id) {
+    $form->{delivery_term_id} = $delivery_term_id;
+  }
+  if (defined $intnotes) {
+    $form->{intnotes} = $intnotes;
+  }
 
   my @curr = $form->get_all_currencies();
   map { $form->{selectcurrency} .= "<option>$_\n" } @curr;
@@ -329,8 +340,6 @@ sub form_header {
   $TMPL_VAR{creditwarning} = ($form->{creditlimit} != 0) && ($form->{creditremaining} < 0) && !$form->{update};
   $TMPL_VAR{is_credit_remaining_negativ} = $form->{creditremaining} =~ /-/;
 
-  $::request->{layout}->focus('#vendor');
-
   my $follow_up_vc         =  $form->{vendor};
   $follow_up_vc            =~ s/--\d*\s*$//;
   $TMPL_VAR{vendor_name} = $follow_up_vc;
@@ -357,7 +366,6 @@ sub form_header {
   ), @custom_hiddens,
   map { $_.'_rate', $_.'_description', $_.'_taxnumber' } split / /, $form->{taxaccounts}];
 
-  $form->{jsscript} = 1;
   $form->header();
 
   print $form->parse_html_template("ir/form_header", \%TMPL_VAR);
@@ -435,6 +443,8 @@ sub form_footer {
     $totalpaid += $form->{"paid_$i"};
   }
 
+  $form->{ALL_DELIVERY_TERMS} = SL::DB::Manager::DeliveryTerm->get_all_sorted();
+
   print $form->parse_html_template('ir/form_footer', {
     is_type_credit_note => ($form->{type} eq "credit_note"),
     totalpaid           => $totalpaid,
@@ -722,6 +732,8 @@ sub post {
   my $invdate      = $form->datetonum($form->{invdate},  \%myconfig);
   my $max_datepaid = _max_datepaid();
 
+  $form->error($locale->text('Cannot post transaction above the maximum future booking date!'))
+    if ($form->date_max_future($invdate, \%myconfig));
   $form->error($locale->text('Cannot post invoice for a closed period!')) if $max_datepaid && $form->date_closed($max_datepaid, \%myconfig);
 
   $form->isblank("exchangerate", $locale->text('Exchangerate missing!'))