]> wagnertech.de Git - mfinanz.git/blobdiff - bin/mozilla/oe.pl
Zahlungserinnerung an Rechnungsadresse schicken - Weiche für Absender
[mfinanz.git] / bin / mozilla / oe.pl
index 940d076605a1ead495d2e6fcae97be0fc9d20a3c..9bad69ae98d6ffef81df2dfed72ecb4492247c81 100644 (file)
@@ -48,6 +48,8 @@ use List::MoreUtils qw(uniq any none);
 use List::Util qw(min max reduce sum);
 use Data::Dumper;
 
+use SL::Controller::Order;
+
 use SL::DB::Customer;
 use SL::DB::TaxZone;
 use SL::DB::PaymentTerm;
@@ -184,6 +186,14 @@ sub edit {
 
   # editing without stuff to edit? try adding it first
   if ($form->{rowcount} && !$form->{print_and_save}) {
+    if ($::instance_conf->get_feature_experimental_order) {
+      my $c = SL::Controller::Order->new;
+      $c->action_edit_collective();
+
+      $main::lxdebug->leave_sub();
+      $::dispatcher->end_request;
+    }
+
     my $id;
     map { $id++ if $form->{"multi_id_$_"} } (1 .. $form->{rowcount});
     if (!$id) {
@@ -633,8 +643,6 @@ sub form_header {
       $form->{shipto_id} = $form->{CFDD_shipto_id};
   }
 
-  push @custom_hiddens, map { "shiptocvar_" . $_->name } @{ SL::DB::Manager::CustomVariableConfig->get_all(where => [ module => 'ShipTo' ]) };
-
   $TMPL_VAR->{HIDDENS} = [ map { name => $_, value => $form->{$_} },
      qw(id type vc proforma queued printed emailed
         title creditlimit creditremaining tradediscount business
@@ -731,6 +739,12 @@ sub form_footer {
 
   my $print_options_html = setup_sales_purchase_print_options();
 
+  my $shipto_cvars       = SL::DB::Shipto->new->cvars_by_config;
+  foreach my $var (@{ $shipto_cvars }) {
+    my $name = "shiptocvar_" . $var->config->name;
+    $var->value($form->{$name}) if exists $form->{$name};
+  }
+
   print $form->parse_html_template("oe/form_footer", {
      %$TMPL_VAR,
      print_options   => $print_options_html,
@@ -740,6 +754,7 @@ sub form_footer {
      is_req_quo      => scalar ($form->{type} =~ /request_quotation$/),
      is_sales_ord    => scalar ($form->{type} =~ /sales_order$/),
      is_pur_ord      => scalar ($form->{type} =~ /purchase_order$/),
+     shipto_cvars    => $shipto_cvars,
   });
 
   $main::lxdebug->leave_sub();
@@ -1223,7 +1238,7 @@ sub orders {
 
   my $idx = 1;
 
-  my $edit_url = ($::instance_conf->get_feature_experimental)
+  my $edit_url = ($::instance_conf->get_feature_experimental_order)
                ? build_std_url('script=controller.pl', 'action=Order/edit', 'type')
                : build_std_url('action=edit', 'type', 'vc');
 
@@ -2133,7 +2148,7 @@ sub report_for_todo_list {
   my $content;
 
   if (@{ $quotations }) {
-    my $edit_url = ($::instance_conf->get_feature_experimental)
+    my $edit_url = ($::instance_conf->get_feature_experimental_order)
                  ? build_std_url('script=controller.pl', 'action=Order/edit')
                  : build_std_url('script=oe.pl', 'action=edit');