]> wagnertech.de Git - mfinanz.git/blobdiff - bin/mozilla/is.pl
Bei VK-Rechnung "als neu speichern" Wechselkurs löschen
[mfinanz.git] / bin / mozilla / is.pl
index 1650303486dbf652e4d163ed8e3e28b117361e79..4418d83d19ef0a986502fe87fc6577c3d82abce1 100644 (file)
@@ -154,6 +154,7 @@ sub invoice_links {
                         taxincluded currency cp_id intnotes id shipto_id
                         delivery_term_id));
 
+  $form->{shipto} = 1 if $editing || $form->{convert_from_oe_ids} || $form->{convert_from_do_ids};
   IS->get_customer(\%myconfig, \%$form);
 
   #quote all_customer Bug 133
@@ -378,10 +379,12 @@ sub form_header {
     shiptoname shiptostreet shiptozipcode shiptocity shiptocountry  shiptocontact shiptophone shiptofax
     shiptoemail shiptodepartment_1 shiptodepartment_2  shiptocp_gender message email subject cc bcc taxaccounts cursor_fokus
     convert_from_do_ids convert_from_oe_ids
-    show_details rowcount callback draft_id draft_description customer_discount gldate
+    show_details
   ), @custom_hiddens,
   map { $_.'_rate', $_.'_description', $_.'_taxnumber' } split / /, $form->{taxaccounts}];
 
+  $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.SalesPurchase));
+
   $form->header();
 
   print $form->parse_html_template("is/form_header", \%TMPL_VAR);
@@ -813,11 +816,14 @@ sub use_as_new {
 
   $main::auth->assert('invoice_edit');
 
-  delete @{ $form }{qw(printed emailed queued invnumber invdate deliverydate id datepaid_1 gldate_1 acc_trans_id_1 source_1 memo_1 paid_1 exchangerate_1 AP_paid_1 storno locked)};
-  $form->{paidaccounts} = 1;
+  delete @{ $form }{qw(printed emailed queued invnumber invdate exchangerate forex deliverydate id datepaid_1 gldate_1 acc_trans_id_1 source_1 memo_1 paid_1 exchangerate_1 AP_paid_1 storno locked)};
   $form->{rowcount}--;
-  $form->{invdate} = $form->current_date(\%myconfig);
-  $form->{duedate} = $form->get_duedate(\%myconfig, $form->{invdate}) || $form->{invdate};
+  $form->{paidaccounts} = 1;
+  $form->{invdate}      = $form->current_date(\%myconfig);
+  $form->{duedate}      = $form->get_duedate(\%myconfig, $form->{invdate}) || $form->{invdate};
+  $form->{employee_id}  = SL::DB::Manager::Employee->current->id;
+  $form->{forex}        = $form->check_exchangerate(\%myconfig, $form->{currency}, $form->{invdate}, 'buy');
+  $form->{exchangerate} = $form->{forex} if $form->{forex};
 
   # remember pricegroups for "use as new"
   IS->get_pricegroups_for_parts(\%myconfig, \%$form);
@@ -1022,6 +1028,10 @@ sub yes {
   $main::lxdebug->leave_sub();
 }
 
+sub post_and_e_mail {
+  e_mail();
+};
+
 sub e_mail {
   $main::lxdebug->enter_sub();