]> wagnertech.de Git - kivitendo-erp.git/commitdiff
Lieferadresse eingeben: Möglichkeit zum Kopieren aus Stammdaten
authorMoritz Bunkus <m.bunkus@linet-services.de>
Thu, 26 Jun 2014 08:19:45 +0000 (10:19 +0200)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Thu, 26 Jun 2014 08:26:59 +0000 (10:26 +0200)
Im Dialog für die Eingabe einer individuellen Lieferanschrift gibt es
nun die Möglichkeit, die Felder aus den Stammdaten des
Kunden/Lieferanten vorzubelegen. Dabei werden sowohl die
Rechnungsadresse als auch alle Lieferadressen angeboten.

Ist beim Abschicken in mindestens einem Feld etwas eingetragen, so wird
eine eventuell vorher ausgewählte shipto_id abgewählt, ansonsten
beibehalten.

Was momentan noch nicht angeboten wird, ist die Firmenadresse aus den
Mandantendaten, weil hier das Adressfeld leider nicht nach Straße,
Postleitzahl, Ort aufgeteilt ist. Ansonsten wäre das für Einkaufsbelege
sinnvoll.

bin/mozilla/io.pl
locale/de/all
templates/webpages/io/ship_to.html

index 97218877be33c9e27bebebf3b9de45fff7852b81..4cd88226972e18772ddbc39a3aef2f62f9835820 100644 (file)
@@ -47,9 +47,11 @@ use SL::CT;
 use SL::IC;
 use SL::IO;
 
+use SL::DB::Customer;
 use SL::DB::Default;
 use SL::DB::Language;
 use SL::DB::Printer;
+use SL::DB::Vendor;
 use SL::Helper::CreatePDF;
 use SL::Helper::Flash;
 
@@ -1713,8 +1715,11 @@ sub ship_to {
   $::form->{title}  = $::locale->text('Ship to');
   $::form->header;
 
+  my $vc_obj = ($::form->{vc} eq 'customer' ? "SL::DB::Customer" : "SL::DB::Vendor")->new(id => $::form->{$::form->{vc} . "_id"})->load;
+
   print $::form->parse_html_template('io/ship_to', { previousform => $previous_form,
                                                      nextsub      => $::form->{display_form} || 'display_form',
+                                                     vc_obj       => $vc_obj,
                                                    });
 
   $main::lxdebug->leave_sub();
index 9d354c0fe2350c1da9ae4d8bc2f0bb1c7b94b226..956d1b26aa6886f5ddf95965cccb6fa7a1d0b19d 100755 (executable)
@@ -488,6 +488,7 @@ $self->{texts} = {
   'Choose Vendor'               => 'Händler wählen',
   'Choose a Tax Number'         => 'Bitte eine Steuernummer angeben',
   'City'                        => 'Stadt',
+  'Clear fields'                => 'Felder leeren',
   'Cleared Balance'             => 'abgeschlossen',
   'Clearing Tax Received (No 71)' => 'Verrechnung des Erstattungsbetrages erwünscht (Zeile 71)',
   'Client'                      => 'Mandant',
@@ -540,6 +541,7 @@ $self->{texts} = {
   'Conversion to PDF failed: #1' => 'Konvertierung zu PDF schlug fehl: #1',
   'Copies'                      => 'Kopien',
   'Copy'                        => 'Kopieren',
+  'Copy address from master data' => 'Adresse aus Stammdaten kopieren',
   'Copy file from #1 to #2 failed: #3' => 'Kopieren der Datei von #1 nach #2 schlug fehl: #3',
   'Copy requirement spec'       => 'Pflichtenheft kopieren',
   'Copy template'               => 'Vorlage kopieren',
index 10f0ce2cc4edb9fe4c94a95faf9a5588e635ec46..ca5560c1035e7fbb55daba87cb1f6e8b51cfbb6e 100644 (file)
@@ -1,6 +1,81 @@
-[% USE HTML %][% USE L %][% USE LxERP %]
+[% USE HTML %][% USE L %][% USE LxERP %][%- USE JavaScript -%]
+
+<script type="text/javascript">
+  var addresses = [
+    { shiptoname:         "[% JavaScript.escape(vc_obj.name) %]",
+      shiptodepartment_1: "[% JavaScript.escape(vc_obj.department_1) %]",
+      shiptodepartment_2: "[% JavaScript.escape(vc_obj.department_2) %]",
+      shiptostreet:       "[% JavaScript.escape(vc_obj.street) %]",
+      shiptozipcode:      "[% JavaScript.escape(vc_obj.zipcode) %]",
+      shiptocity:         "[% JavaScript.escape(vc_obj.city) %]",
+      shiptocountry:      "[% JavaScript.escape(vc_obj.country) %]",
+      shiptocontact:      "[% JavaScript.escape(vc_obj.contact) %]",
+      shiptocp_gender:    "[% JavaScript.escape(vc_obj.cp_gender) %]",
+      shiptophone:        "[% JavaScript.escape(vc_obj.phone) %]",
+      shiptofax:          "[% JavaScript.escape(vc_obj.fax) %]",
+      shiptoemail:        "[% JavaScript.escape(vc_obj.email) %]"
+    }
+
+  [% FOREACH shipto = vc_obj.shipto %]
+    ,
+    { shiptoname:         "[% JavaScript.escape(shipto.shiptoname) %]",
+      shiptodepartment_1: "[% JavaScript.escape(shipto.shiptodepartment_1) %]",
+      shiptodepartment_2: "[% JavaScript.escape(shipto.shiptodepartment_2) %]",
+      shiptostreet:       "[% JavaScript.escape(shipto.shiptostreet) %]",
+      shiptozipcode:      "[% JavaScript.escape(shipto.shiptozipcode) %]",
+      shiptocity:         "[% JavaScript.escape(shipto.shiptocity) %]",
+      shiptocountry:      "[% JavaScript.escape(shipto.shiptocountry) %]",
+      shiptocontact:      "[% JavaScript.escape(shipto.shiptocontact) %]",
+      shiptocp_gender:    "[% JavaScript.escape(shipto.shiptocp_gender) %]",
+      shiptophone:        "[% JavaScript.escape(shipto.shiptophone) %]",
+      shiptofax:          "[% JavaScript.escape(shipto.shiptofax) %]",
+      shiptoemail:        "[% JavaScript.escape(shipto.shiptoemail) %]"
+    }
+  [% END %]
+  ];
+
+  function copy_address() {
+    var shipto = addresses[ $('#shipto_to_copy').val() ];
+    for (key in shipto)
+      $('#' + key).val(shipto[key]);
+  }
+
+  function clear_fields() {
+    var shipto = addresses[0];
+    for (key in shipto)
+      $('#' + key).val('');
+    $('#shiptocp_gender').val('m');
+  }
+
+  function clear_shipto_id_before_submit() {
+    var shipto = addresses[0];
+    for (key in shipto)
+      if ((key != 'shiptocp_gender') && ($('#' + key).val() != '')) {
+        $('#shipto_id').val('');
+        break;
+      }
+
+    $('form').submit();
+  }
+</script>
+
+[% select_options = [ [ 0, LxERP.t8("Billing Address") ] ] ;
+   FOREACH shipto = vc_obj.shipto ;
+     city  = shipto.shiptozipcode _ ' ' _ shipto.shiptocity ;
+     title = [ shipto.shiptoname, shipto.shiptostreet, city ] ;
+     CALL select_options.import([ [ loop.count, title.grep('\S').join("; ") ] ]) ;
+   END ;
+   '' %]
 
  <form method="post" action="[% HTML.escape(script) %]">
+  [% L.hidden_tag("shipto_id", shipto_id) %]
+
+  <p>
+   [% LxERP.t8("Copy address from master data") %]:
+   [% L.select_tag("", select_options, id="shipto_to_copy", style="width: 400px") %]
+   [% L.button_tag("copy_address()", LxERP.t8("Copy")) %]
+   [% L.button_tag("clear_fields()", LxERP.t8("Clear fields")) %]
+  </p>
 
   <table>
    <tr class="listheading">
   [% L.hidden_tag("nextsub", nextsub) %]
   [% L.hidden_tag("previousform", previousform) %]
 
-  [% L.submit_tag("__dummy", LxERP.t8("Continue")) %]
+  [% L.button_tag("clear_shipto_id_before_submit()", LxERP.t8("Continue")) %]
  </form>