Lieferscheine: Benutzerdef. Variablen in Lieferadressen gefixt
authorBernd Bleßmann <bernd@kivitendo-premium.de>
Tue, 25 Aug 2020 14:09:21 +0000 (16:09 +0200)
committerBernd Bleßmann <bernd@kivitendo-premium.de>
Tue, 25 Aug 2020 14:17:06 +0000 (16:17 +0200)
bin/mozilla/do.pl
templates/webpages/do/form_footer.html
templates/webpages/do/form_header.html

index fef0940..bd906d4 100644 (file)
@@ -466,11 +466,6 @@ sub form_header {
 
   $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.File kivi.MassDeliveryOrderPrint kivi.SalesPurchase kivi.Part kivi.CustomerVendor kivi.Validator ckeditor/ckeditor ckeditor/adapters/jquery kivi.io));
 
-  my @custom_hidden;
-  push @custom_hidden, map { "shiptocvar_" . $_->name } @{ SL::DB::Manager::CustomVariableConfig->get_all(where => [ module => 'ShipTo' ]) };
-
-  $::form->{HIDDENS} = [ map { +{ name => $_, value => $::form->{$_} } } (@custom_hidden) ];
-
   setup_do_action_bar();
 
   $form->header();
@@ -501,8 +496,15 @@ sub form_footer {
   $form->{PRINT_OPTIONS}      = setup_sales_purchase_print_options();
   $form->{ALL_DELIVERY_TERMS} = SL::DB::Manager::DeliveryTerm->get_all_sorted();
 
+  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('do/form_footer',
-    {transfer_default         => ($::instance_conf->get_transfer_default)});
+    {transfer_default => ($::instance_conf->get_transfer_default),
+     shipto_cvars     => $shipto_cvars});
 
   $main::lxdebug->leave_sub();
 }
index 68d8f07..1ad546c 100644 (file)
@@ -67,7 +67,7 @@
 
  [%- IF !delivered %]
   <div id="shipto_inputs" class="hidden">
-   [%- PROCESS 'common/_ship_to_dialog.html' vc_obj=VC_OBJ %]
+   [%- PROCESS 'common/_ship_to_dialog.html' vc_obj=VC_OBJ cvars=shipto_cvars %]
   </div>
  [%- END %]
 
index 6e7c499..59fa98e 100644 (file)
   <input type="hidden" name="type" id="type" value="[% HTML.escape(type) %]">
   <input type="hidden" name="vc" id="vc" value="[% HTML.escape(vc) %]">
   <input type="hidden" name="lastmtime" id="lastmtime" value="[% HTML.escape(lastmtime) %]">
-[%- FOREACH row = HIDDENS %]
-   [% L.hidden_tag(row.name, row.value) %]
-[%- END %]
 
   <p>
    <table width="100%">