Merge branch 'b-3.6.1' of ../kivitendo-erp_20220811
[kivitendo-erp.git] / templates / webpages / do / form_header.html
index 52b0e70..bee0ee6 100644 (file)
@@ -1,15 +1,33 @@
 [%- USE T8 %]
 [%- USE HTML %]
 [%- USE LxERP %]
-[%- USE L %]
+[%- USE L %][%- USE P -%]
+
+[%# Determine which shipping address to show if the delivery order has been shipped already. %]
+[%- IF delivered;
+      SET shipto_label = [];
+      IF shipto_id;
+        FOREACH row = ALL_SHIPTO ;
+          IF row.shipto_id == shipto_id ;
+            SET shipto_label = [ row.shiptoname, row.shiptodepartment_1, row.shiptostreet, row.shiptocity ] ;
+          END ;
+        END ;
+      ELSE ;
+        SET shipto_label = [ shiptoname, shiptodepartment_1, shiptostreet, shiptocity ] ;
+      END ;
+
+      SET shipto_label = shipto_label.grep('.') ;
+      IF !shipto_label.size ;
+        shipto_label = [ LxERP.t8('no shipping address') ] ;
+      END ;
+    END ; %]
+
 <h1>[% title %]</h1>
 
  <script type="text/javascript" src="js/show_form_details.js"></script>
  <script type="text/javascript" src="js/show_history.js"></script>
  <script type="text/javascript" src="js/show_vc_details.js"></script>
- <script type="text/javascript" src="js/common.js"></script>
  <script type="text/javascript" src="js/delivery_customer_selection.js"></script>
- <script type="text/javascript" src="js/vendor_selection.js"></script>
  <script type="text/javascript" src="js/calculate_qty.js"></script>
  <script type="text/javascript" src="js/stock_in_out.js"></script>
  <script type="text/javascript" src="js/follow_up.js"></script>
  </style>
 
  [%- IF vc == 'customer' %]
- [%- SET vc = 'customer' %]
- [%- SET the_vc_id = customer_id %]
- [%- SET the_vc = customer %]
- [%- SET the_oldvc = oldcustomer %]
  [%- SET is_customer = '1' %]
  [%- ELSE %]
  [%- SET vc = 'vendor' %]
- [%- SET the_vc_id = vendor_id %]
- [%- SET the_vc = vendor %]
- [%- SET the_oldvc = oldvendor %]
  [%- SET is_customer = '0' %]
  [%- END %]
+ [%- SET vc_id = vc _ "_id" %]
  [%- IF delivered %]
  [%- SET DISABLED = ' disabled' %]
  [%- END %]
@@ -45,7 +57,7 @@
  <p><font color="#ff0000">[% ERRORS.join('<br>') %]</font></p>
  [%- END %]
 
- <form method="post" name="do" action="do.pl">
+ <form id="form" method="post" name="do" action="do.pl">
 
  <div id="do_tabs" class="tabwidget">
   <ul>
 [%- IF INSTANCE_CONF.get_webdav %]
    <li><a href="#ui-tabs-webdav">[% 'WebDAV' | $T8 %]</a></li>
 [%- END %]
-[%- IF id %]
+[%- IF id AND INSTANCE_CONF.get_doc_storage %]
+      <li><a href="controller.pl?action=File/list&file_type=document&object_type=[% HTML.escape(type) %]&object_id=[% HTML.url(id) %]">[% 'Documents' | $T8 %]</a></li>
+      <li><a href="controller.pl?action=File/list&file_type=attachment&object_type=[% HTML.escape(type) %]&object_id=[% HTML.url(id) %]">[% 'Attachments' | $T8 %]</a></li>
+[%- END %]
+[%- IF id AND AUTH.assert('record_links', 1) %]
    <li><a href="controller.pl?action=RecordLinks/ajax_list&object_model=DeliveryOrder&object_id=[% HTML.url(id) %]">[% 'Linked Records' | $T8 %]</a></li>
 [%- END %]
   </ul>
 
   <div id="ui-tabs-basic-data">
 
-  <input type="hidden" name="follow_up_trans_id_1" value="[% HTML.escape(id) %]">
-  <input type="hidden" name="follow_up_trans_type_1" value="[% HTML.escape(type) %]">
-  <input type="hidden" name="follow_up_trans_info_1" value="[% HTML.escape(follow_up_trans_info) %]">
-  <input type="hidden" name="follow_up_rowcount" value="1">
-
-
-  <input type="hidden" name="action" value="[% HTML.escape(action) %]">
-  <input type="hidden" name="bcc" value="[% HTML.escape(bcc) %]">
-  <input type="hidden" name="business" value="[% HTML.escape(business) %]">
-  <input type="hidden" name="cc" value="[% HTML.escape(cc) %]">
-  <input type="hidden" name="closed" value="[% HTML.escape(closed) %]">
-  <input type="hidden" name="convert_from_oe_ids" value="[% HTML.escape(convert_from_oe_ids) %]">
-  <input type="hidden" name="currency" value="[% HTML.escape(currency) %]">
-  <input type="hidden" name="customer_klass" value="[% HTML.escape(customer_klass) %]">
-  <input type="hidden" name="discount" value="[% HTML.escape(discount) %]">
-  <input type="hidden" name="dunning_amount" value="[% HTML.escape(dunning_amount) %]">
-  <input type="hidden" name="email" value="[% HTML.escape(email) %]">
-  <input type="hidden" name="emailed" value="[% HTML.escape(emailed) %]">
-  <input type="hidden" name="format" value="[% HTML.escape(format) %]">
-  <input type="hidden" name="formname" value="[% HTML.escape(formname) %]">
-  <input type="hidden" name="id" value="[% HTML.escape(id) %]">
-  <input type="hidden" name="max_dunning_level" value="[% HTML.escape(max_dunning_level) %]">
-  <input type="hidden" name="media" value="[% HTML.escape(media) %]">
-  <input type="hidden" name="message" value="[% HTML.escape(message) %]">
-  <input type="hidden" name="printed" value="[% HTML.escape(printed) %]">
-  <input type="hidden" name="proforma" value="[% HTML.escape(proforma) %]">
-  <input type="hidden" name="queued" value="[% HTML.escape(queued) %]">
-  <input type="hidden" name="saved_donumber" value="[% HTML.escape(saved_donumber) %]">
-  <input type="hidden" name="shiptocity" value="[% HTML.escape(shiptocity) %]">
-  <input type="hidden" name="shiptocontact" value="[% HTML.escape(shiptocontact) %]">
-  <input type="hidden" name="shiptocp_gender" value="[% HTML.escape(shiptocp_gender) %]">
-  <input type="hidden" name="shiptocountry" value="[% HTML.escape(shiptocountry) %]">
-  <input type="hidden" name="shiptodepartment_1" value="[% HTML.escape(shiptodepartment_1) %]">
-  <input type="hidden" name="shiptodepartment_2" value="[% HTML.escape(shiptodepartment_2) %]">
-  <input type="hidden" name="shiptoemail" value="[% HTML.escape(shiptoemail) %]">
-  <input type="hidden" name="shiptofax" value="[% HTML.escape(shiptofax) %]">
-  <input type="hidden" name="shiptoname" value="[% HTML.escape(shiptoname) %]">
-  <input type="hidden" name="shiptophone" value="[% HTML.escape(shiptophone) %]">
-  <input type="hidden" name="shiptostreet" value="[% HTML.escape(shiptostreet) %]">
-  <input type="hidden" name="shiptozipcode" value="[% HTML.escape(shiptozipcode) %]">
-  <input type="hidden" name="shiptocp_gender" value="[% HTML.escape(shiptocp_gender) %]">
-  <input type="hidden" name="show_details" value="[% HTML.escape(show_details) %]">
-  <input type="hidden" name="subject" value="[% HTML.escape(subject) %]">
-  <input type="hidden" name="taxincluded" value="[% HTML.escape(taxincluded) %]">
-  <input type="hidden" name="taxzone_id" value="[% HTML.escape(taxzone_id) %]">
-  <input type="hidden" name="title" value="[% HTML.escape(title) %]">
-  <input type="hidden" name="type" value="[% HTML.escape(type) %]">
-  <input type="hidden" name="vc" value="[% HTML.escape(vc) %]">
-  <input type="hidden" name="lastmtime" value="[% HTML.escape(lastmtime) %]">
+  <input type="hidden" name="follow_up_trans_id_1" id="follow_up_trans_id_1" value="[% HTML.escape(id) %]">
+  <input type="hidden" name="follow_up_trans_type_1" id="follow_up_trans_type_1" value="[% HTML.escape(type) %]">
+  <input type="hidden" name="follow_up_trans_info_1" id="follow_up_trans_info_1" value="[% HTML.escape(follow_up_trans_info) %]">
+  <input type="hidden" name="follow_up_rowcount" id="follow_up_rowcount" value="1">
+
+
+  <input type="hidden" name="business" id="business" value="[% HTML.escape(business) %]">
+  <input type="hidden" name="closed" id="closed" value="[% HTML.escape(closed) %]">
+  <input type="hidden" name="convert_from_oe_ids" id="convert_from_oe_ids" value="[% HTML.escape(convert_from_oe_ids) %]">
+  <input type="hidden" name="currency" id="currency" value="[% HTML.escape(currency) %]">
+  <input type="hidden" name="customer_pricegroup_id" id="customer_pricegroup_id" value="[% HTML.escape(customer_pricegroup_id) %]">
+  <input type="hidden" name="discount" id="discount" value="[% HTML.escape(discount) %]">
+  <input type="hidden" name="dunning_amount" id="dunning_amount" value="[% HTML.escape(dunning_amount) %]">
+  <input type="hidden" name="emailed" id="emailed" value="[% HTML.escape(emailed) %]">
+  <input type="hidden" name="id" id="id" value="[% HTML.escape(id) %]">
+  <input type="hidden" name="max_dunning_level" id="max_dunning_level" value="[% HTML.escape(max_dunning_level) %]">
+  <input type="hidden" name="printed" id="printed" value="[% HTML.escape(printed) %]">
+  <input type="hidden" name="proforma" id="proforma" value="[% HTML.escape(proforma) %]">
+  <input type="hidden" name="queued" id="queued" value="[% HTML.escape(queued) %]">
+  <input type="hidden" name="saved_donumber" id="saved_donumber" value="[% HTML.escape(saved_donumber) %]">
+ [%- IF delivered %]
+  <input type="hidden" name="shipto_id" id="shipto_id" value="[% HTML.escape(shipto_id) %]">
+  <input type="hidden" name="shiptocity" id="shiptocity" value="[% HTML.escape(shiptocity) %]">
+  <input type="hidden" name="shiptocontact" id="shiptocontact" value="[% HTML.escape(shiptocontact) %]">
+  <input type="hidden" name="shiptocp_gender" id="shiptocp_gender" value="[% HTML.escape(shiptocp_gender) %]">
+  <input type="hidden" name="shiptocountry" id="shiptocountry" value="[% HTML.escape(shiptocountry) %]">
+  <input type="hidden" name="shiptogln" id="shiptogln" value="[% HTML.escape(shiptogln) %]">
+  <input type="hidden" name="shiptodepartment_1" id="shiptodepartment_1" value="[% HTML.escape(shiptodepartment_1) %]">
+  <input type="hidden" name="shiptodepartment_2" id="shiptodepartment_2" value="[% HTML.escape(shiptodepartment_2) %]">
+  <input type="hidden" name="shiptoemail" id="shiptoemail" value="[% HTML.escape(shiptoemail) %]">
+  <input type="hidden" name="shiptofax" id="shiptofax" value="[% HTML.escape(shiptofax) %]">
+  <input type="hidden" name="shiptoname" id="shiptoname" value="[% HTML.escape(shiptoname) %]">
+  <input type="hidden" name="shiptophone" id="shiptophone" value="[% HTML.escape(shiptophone) %]">
+  <input type="hidden" name="shiptostreet" id="shiptostreet" value="[% HTML.escape(shiptostreet) %]">
+  <input type="hidden" name="shiptozipcode" id="shiptozipcode" value="[% HTML.escape(shiptozipcode) %]">
+  <input type="hidden" name="shiptocp_gender" id="shiptocp_gender" value="[% HTML.escape(shiptocp_gender) %]">
+ [%- END %]
+  <input type="hidden" name="show_details" id="show_details" value="[% HTML.escape(show_details) %]">
+  <input type="hidden" name="taxincluded" id="taxincluded" value="[% HTML.escape(taxincluded) %]">
+  <input type="hidden" name="taxzone_id" id="taxzone_id" value="[% HTML.escape(taxzone_id) %]">
+  <input type="hidden" name="title" id="title" value="[% HTML.escape(title) %]">
+  <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) %]">
+  <input type="hidden" name="tax_point" id="tax_point" value="[% HTML.escape(tax_point) %]">
 
   <p>
    <table width="100%">
      <td>
       <table width="100%">
        <tr>
-        <input type="hidden" name="[% vc %]_id" value="[% HTML.escape(the_vc_id) %]">
-        <input type="hidden" name="old[% vc %]" value="[% HTML.escape(the_oldvc) %]">
-        <input type="hidden" name="tradediscount" value="[% HTML.escape(tradediscount) %]">
         <th align="right">[% IF is_customer %][% 'Customer' | $T8 %][% ELSE %][% 'Vendor' | $T8 %][% END %]</th>
         <td>
-         [%- UNLESS !delivered && SHOW_VC_DROP_DOWN %]
-         <input type="text" value="[% HTML.escape(oldvcname) %]" name="[% HTML.escape(vc) %]"[% RO %]>
-         [%- ELSE %]
-         <select name="[% vc %]" class="fixed_width" onchange="document.do.update_button.click();"[% RO %]>
-          [%- FOREACH row = ALL_VC %]
-          <option value="[% HTML.escape(row.value) %]" [% IF the_oldvc == row.value %] selected[% END %]>[% HTML.escape(row.name) %]</option>
-          [%- END %]
-         </select>
-         <input type="hidden" name="select[% vc %]" value="1">
-         [%- END %]
-         <input type="button" value="[% 'Details (one letter abbreviation)' | $T8 %]" onclick="show_vc_details('[% vc %]')">
+         [% IF RO %]
+          [% P.hidden_tag(vc_id, $vc_id) %]
+          [% HTML.escape(VC_OBJ.name) %]
+         [% ELSE %]
+          [% P.customer_vendor.picker(vc_id, $vc_id, type=vc, class="fixed_width", onchange="\$('#update_button').click()") %]
+         [% END %]
+         [% P.hidden_tag("previous_" _ vc_id, $vc_id) %]
+         [% P.button_tag("show_vc_details('" _ HTML.escape(vc) _ "')", LxERP.t8("Details (one letter abbreviation)")) %]
         </td>
 
         [%- IF ALL_CONTACTS.size %]
          <th align="right">[% 'Contact Person' | $T8 %]</th>
          <td>
           [%- IF delivered %]
-          <input type="hidden" name="cp_id" value="[% HTML.escape(cp_id) %]">
-          [%- IF cp_id == row.cp_id %]
-          [%- HTML.escape(row.cp_name) %][%- IF row.cp_abteilung %] ([% HTML.escape(row.cp_abteilung) %])[% END -%]
-          [%- END %]
+            [% L.hidden_tag("cp_id", cp_id) %]
+            [% HTML.escape(CONTACT_OBJ.full_name) %][% IF CONTACT_OBJ.cp_abteilung %] ([% HTML.escape(CONTACT_OBJ.cp_abteilung) %])[% END %]
           [%- ELSE %]
             [% L.select_tag('cp_id', ALL_CONTACTS, default = cp_id, value_key = 'cp_id', title_key = 'full_name_dep', with_empty = 1, style='width: 250px') %]
           [%- END %]
         </tr>
         [%- END %]
 
-        [%- IF ALL_SHIPTO.size %]
         <tr>
          <th align="right">[% 'Shipping Address' | $T8 %]</th>
          <td>
           [%- IF delivered %]
-          <input type="hidden" name="shipto_id" value="[% HTML.escape(shipto_id) %]">
-          [%- FOREACH row = ALL_SHIPTO %]
-          [%- IF shipto_id == row.shipto_id %]
-          [%- HTML.escape(row.shiptoname) -%]
-          [%- IF row.shiptodepartment_1 %]; [% HTML.escape(row.shiptodepartment_1) -%][% END -%]
-          [%- IF row.shiptostreet %]; [% HTML.escape(row.shiptostreet) -%][% END -%]
-          [%- IF row.shiptocity %]; [% HTML.escape(row.shiptocity) -%][% END -%]
-          [%- END %]
-          [%- END %]
-
+           [% HTML.escape(shipto_label.join('; ')) %]
           [%- ELSE %]
+           [%- IF ALL_SHIPTO.size %]
             [% shiptos = [ [ "", LxERP.t8("No/individual shipping address") ] ] ;
                L.select_tag('shipto_id', shiptos.import(ALL_SHIPTO), default=shipto_id, value_key='shipto_id', title_key='displayable_id', style='width: 250px') %]
+           [%- END %]
+           [% L.button_tag("kivi.SalesPurchase.edit_custom_shipto()", LxERP.t8("Custom shipto")) %]
           [%- END %]
          </td>
         </tr>
+
+        [%- IF (vc == 'customer') && VC_OBJ.additional_billing_addresses.as_list.size %]
+        <tr>
+          <th align="right">[% 'Custom Billing Address' | $T8 %]</th>
+          <td>
+            [% L.select_tag('billing_address_id', VC_OBJ.additional_billing_addresses,
+                            with_empty=1, default=billing_address_id, value_key='id', title_key='displayable_id', style='width: 250px') %]
+          </td>
+        </tr>
         [%- END %]
 
         [%- IF business %]
         [%- END %]
        </tr>
 
+       [%- IF ALL_LANGUAGES.size %]
+       <tr>
+        <th align="right" nowrap>[% 'Language' | $T8 %]</th>
+        <td colspan="3">
+         [% L.select_tag('language_id', ALL_LANGUAGES, default = language_id, title_key = 'description', with_empty = 1, style = 'width: 250px' )%]
+        </td>
+       </tr>
+       [%- END %]
+
        [%- IF ALL_DEPARTMENTS.size %]
        <tr>
         <th align="right" nowrap>[% 'Department' | $T8 %]</th>
         <td colspan="3">
           [% IF ( delivered ) %]
             [% L.hidden_tag('department_id', department_id) %]
+          [% ELSE %]
+            [% L.select_tag('department_id', ALL_DEPARTMENTS, default = department_id, title_key = 'description', with_empty = 1, style = 'width: 250px', disabled = delivered )%]
           [% END %]
-          [% L.select_tag('department_id', ALL_DEPARTMENTS, default = department_id, title_key = 'description', with_empty = 1, style = 'width: 250px', disabled = delivered )%]
        </td>
        </tr>
        [%- END %]
 
        <tr>
         <th align="right">[% 'Transaction description' | $T8 %]</th>
-        <td colspan="3"><input name="transaction_description" id="transaction_description" size="35" value="[% HTML.escape(transaction_description) %]"[% RO %]></td>
+        <td colspan="3">[% L.input_tag("transaction_description", transaction_description, size=35, "data-validate"=(INSTANCE_CONF.get_require_transaction_description_ps ? 'required' : ''), readonly=delivered) %]</td>
        </tr>
 
       </table>
 
        <tr>
         <th width="70%" align="right" nowrap>[% 'Delivery Order Number' | $T8 %]</th>
-        <td><input name="donumber" size="11" value="[% HTML.escape(donumber) %]"[% RO %]></td>
+        <td>
+[%- IF !is_customer || INSTANCE_CONF.get_sales_purchase_record_numbers_changeable %]
+          [% L.input_tag("donumber", donumber, size="11", readonly=delivered) %]
+[%- ELSIF id %]
+          [% HTML.escape(donumber) %]
+          [% L.hidden_tag("donumber", donumber) %]
+[%- ELSE %]
+          [% LxERP.t8("will be set upon saving") %]
+[%- END %]
+        </td>
        </tr>
 
        <tr>
         <th width="70%" align="right" nowrap>[% 'Order Number' | $T8 %]</th>
-        <td><input name="ordnumber" size="11" value="[% HTML.escape(ordnumber) %]"[% RO %]></td>
+        <td><input name="ordnumber" id="ordnumber" size="11" value="[% HTML.escape(ordnumber) %]"[% RO %]></td>
        </tr>
 
        <tr>
         <th width="70%" align="right" nowrap>[% IF is_customer %][% 'Customer Order Number' | $T8 %][% ELSE %][% 'Vendor Order Number' | $T8 %][% END %]</th>
-        <td><input name="cusordnumber" size="11" value="[% HTML.escape(cusordnumber) %]"[% RO %]></td>
+        <td><input name="cusordnumber" id="cusordnumber" size="11" value="[% HTML.escape(cusordnumber) %]"[% RO %]></td>
        </tr>
 
        <tr>