Merge branch 'b-3.6.1' of ../kivitendo-erp_20220811
[kivitendo-erp.git] / templates / webpages / client_config / form.html
index d195e2a..79c2cdd 100644 (file)
-[%- USE T8 %][%- USE L %][% USE LxERP %]
+[%- USE L %][% USE LxERP %][% USE HTML %][%- USE JavaScript -%]
+ <script type="text/javascript" src="js/common.js"></script>
+ <script type="text/javascript">
+  <!--
+var warehouses = [
+ [%- USE warehouses_it = Iterator(SELF.all_warehouses) %][%- FOREACH warehouse = warehouses_it %]
+  { id:   [% warehouse.id %],
+    bins: [
+     [% USE bins_it = Iterator(warehouse.bins_sorted) %][% FOREACH bin = bins_it %]
+      { id: [% bin.id %], description: "[% JavaScript.escape(bin.description) %]" }[% UNLESS bins_it.last %],[% END %]
+     [% END %]
+   ] }[% UNLESS warehouses_it.last %],[% END %]
+ [% END %]
+];
 
-<h1>[% title | html %]</h1>
+function warehouse_selected(warehouse_id, bin_id, bin_id_name) {
+  // bin_id_name is optional and only used in client_config.html
+  bin_id_name = bin_id_name || 'bin_id';
 
-[% PROCESS 'common/flash.html' %]
+  // Remove all bins safe for the empty entry
+  var bin_select = $('#' + bin_id_name);
+  bin_select.find('option').filter('[value!=""]').remove();
 
-<form action='controller.pl' method='POST'>
+  // Find selected warehouse
+  var warehouse = warehouses.filter(function(elt) { return elt.id == warehouse_id; })[0];
+  if (!warehouse)
+    return;
 
-<table>
+  // Add bins as options to select.
+  $(warehouse.bins).each(function(idx, bin) {
+    bin_select.append($('<option>', { value: bin.id, selected: bin.id == bin_id }).text(bin.description));
+  });
+}
 
- <tr class='listheading'>
-   <th colspan="3">[% 'Posting Configuration' | $T8 %]</th>
- </tr>
- <tr>
-   <td align="right">[% 'Payments Changeable' | $T8 %]</td>
-   <td>[% L.select_tag('payments_changeable', SELF.payment_options, value_key => 'value', title_key => 'title', default => SELF.payments_changeable) %]</td>
-   <td>[% 'Should payments be and when should they be changeable after posting?' | $T8 %]</td>
- </tr>
- <tr>
-   <td align="right">[% 'Accounting method' | $T8 %]</td>
-   <td>[% L.select_tag('accounting_method', SELF.accounting_options, value_key => 'value', title_key => 'title', default => SELF.accounting_method) %]</td>
-   <td>[% 'This option controls the posting and calculation behavior for the accounting method.' | $T8 %]</td>
- </tr>
- <tr>
-   <td align="right">[% 'Inventory system' | $T8 %]</td>
-   <td>[% L.select_tag('inventory_system', SELF.inventory_options, value_key => 'value', title_key => 'title', default => SELF.inventory_system) %]</td>
-   <td>
-     [% 'This option controls the inventory system.' | $T8 %]<br>
-     [% 'ATTENTION! You can not simply change it from periodic to perpetual once you started posting.' | $T8 %]
-   </td>
- </tr>
- <tr>
-   <td align="right">[% 'Profit determination' | $T8 %]</td>
-   <td>[% L.select_tag('profit_determination', SELF.profit_options, value_key => 'value', title_key => 'title', default => SELF.profit_determination) %]</td>
-   <td>[% 'This option controls the method used for profit determination.' | $T8 %]</td>
- </tr>
+function enable_template_controls() {
+  var existing = $('#use_templates_existing').prop('checked');
+  $('#defaults_templates').prop('disabled', !existing);
+  $('#new_templates,#new_master_templates').prop('disabled', existing);
+}
 
- <tr> </tr>
- <tr> </tr>
+function verifyMBSize(elem) {
+  var fsize = parseInt($('#doc_max_filesize_MB').val());
+  $('#defaults_doc_max_filesize').val(fsize*1000000.0);
+  $('#doc_max_filesize_MB').val(fsize);
+}
 
- <tr class='listheading'>
-   <th colspan="3">[% 'DATEV check configuration' | $T8 %]</th>
- </tr>
- <tr>
-   <td colspan="3">[% 'It is possible to make a quick DATEV export everytime you post a record to ensure things work nicely with their data requirements. This will result in a slight overhead though you can enable this for each type of record independantly.' | $T8 %]</td>
- </tr>
- <tr>
-   <td align="right">[% 'Check on sales invoice' | $T8 %]</td>
-   <td>[% L.yes_no_tag('datev_check_on_sales_invoice', SELF.datev_check_on_sales_invoice) %]</td>
-   <td>[% 'Perform check when a sales invoice or a payment for a sales invoice is posted?' | $T8 %]</td>
- </tr>
- <tr>
-   <td align="right">[% 'Check on purchase invoice' | $T8 %]</td>
-   <td>[% L.yes_no_tag('datev_check_on_purchase_invoice', SELF.datev_check_on_purchase_invoice) %]</td>
-   <td>[% 'Perform check when a purchase invoice or a payment for a purchase invoice is posted?' | $T8 %]</td>
- </tr>
- <tr>
-   <td align="right">[% 'Check on ar transaction' | $T8 %]</td>
-   <td>[% L.yes_no_tag('datev_check_on_ar_transaction', SELF.datev_check_on_ar_transaction) %]</td>
-   <td>[% 'Perform check when an ar transaction is posted?' | $T8 %]</td>
- </tr>
- <tr>
-   <td align="right">[% 'Check on ap transaction' | $T8 %]</td>
-   <td>[% L.yes_no_tag('datev_check_on_ap_transaction', SELF.datev_check_on_ap_transaction) %]</td>
-   <td>[% 'Perform check when an ap transaction is posted?' | $T8 %]</td>
- </tr>
- <tr>
-   <td align="right">[% 'Check on gl transaction' | $T8 %]</td>
-   <td>[% L.yes_no_tag('datev_check_on_gl_transaction', SELF.datev_check_on_gl_transaction) %]</td>
-   <td>[% 'Perform check when a gl transaction is posted?' | $T8 %]</td>
- </tr>
+function verifyRootPath(elem) {
+  if ( elem.value == "" ) {
+    elem.value="./documents";
+  }
+}
 
- <tr> </tr>
- <tr> </tr>
+function checkavailable_filebackend(elem) {
+  var selval = elem.value;
+  if ( selval == 'Webdav' && $("#defaults_doc_webdav").val() == 0 ) {
+     elem.value = 'Filesystem';
+  }
+  if ( elem.value == 'Filesystem' && $("#defaults_doc_files").val() == 0 ) {
+     elem.value = 'None';
+  }
+  return false;
+}
 
- <tr class='listheading'>
-   <th colspan="3">[% 'Warehouse' | $T8 %]</th>
- </tr>
- <tr>
-   <td align="right">[% 'Show Bestbefore' | $T8 %]</td>
-   <td>
-     [% L.yes_no_tag('show_bestbefore', SELF.show_bestbefore) %]
-   </td>
-   <td>
-     [% 'Show fields used for the best before date?' | $T8 %]<br>
-     [% 'ATTENTION! If you enabled this feature you can not simply turn it off again without taking care that best_before fields are emptied in the database.' | $T8 %]<br>
-     [% 'This can be done with the following query:' | $T8 %]<br>
-     <br>
-     UPDATE inventory SET bestbefore = NULL; <br>
-     <br>
-     [% 'Any stock contents containing a best before date will be impossible to stock out otherwise.' | $T8 %]
-   </td>
- </tr>
+$(function() {
+  warehouse_selected([% SELF.defaults.warehouse_id || -1 %], [% SELF.defaults.bin_id || -1 %], 'bin_id');
+  warehouse_selected([% SELF.defaults.warehouse_id_ignore_onhand || -1 %], [% SELF.defaults.bin_id_ignore_onhand || -1 %], 'bin_id_ignore_onhand');
+  warehouse_selected([% SELF.defaults.stocktaking_warehouse_id || -1 %], [% SELF.defaults.stocktaking_bin_id || -1 %], 'stocktaking_bin_id');
 
-</table>
+  enable_template_controls();
+  $('#doc_max_filesize_MB').val(parseInt($('#defaults_doc_max_filesize').val())/1000000.0);
+  $('#use_templates_existing,#use_templates_new').change(enable_template_controls);
+})
+    -->
+ </script>
+<h1>[% title | html %]</h1>
 
-<br>
+[% INCLUDE 'common/flash.html' %]
 
-[%- L.hidden_tag('action',  'ClientConfig/dispatch')  %]
-[%- L.submit_tag('action_save',  LxERP.t8('Save'))  %]
+<form action='controller.pl' method='POST' id='form'>
+ <div class="tabwidget">
+  <ul>
+   <li><a href="#miscellaneous">[% LxERP.t8('Miscellaneous') %]</a></li>
+   <li><a href="#ranges_of_numbers">[% LxERP.t8('Ranges of numbers') %]</a></li>
+   <li><a href="#default_accounts">[% LxERP.t8('Default Accounts') %]</a></li>
+   <li><a href="#posting_configuration">[% LxERP.t8('Posting Configuration') %]</a></li>
+   [% IF FORM.feature_datev %]
+     <li><a href="#datev_check_configuration">[% LxERP.t8('DATEV configuration') %]</a></li>
+   [% END %]
+   <li><a href="#orders_deleteable">[% LxERP.t8('Orders / Delivery Orders deleteable') %]</a></li>
+[%- IF INSTANCE_CONF.get_doc_storage %]
+   <li><a href="#attachments">[% LxERP.t8('Global Attachments') %]</a></li>
+[%- END %]
+   <li><a href="#warehouse">[% LxERP.t8('Warehouse') %]</a></li>
+   <li><a href="#features">[% LxERP.t8('Features') %]</a></li>
+   <li><a href="#stocktaking">[% LxERP.t8('Stocktaking') %]</a></li>
+   <li><a href="#record_links">[% LxERP.t8('Linked Records') %]</a></li>
+  </ul>
 
+[% PROCESS 'client_config/_ranges_of_numbers.html' %]
+[% PROCESS 'client_config/_default_accounts.html' %]
+[% PROCESS 'client_config/_posting_configuration.html' %]
+[% PROCESS 'client_config/_datev_check_configuration.html' %]
+[% PROCESS 'client_config/_orders_deleteable.html' %]
+[%- IF INSTANCE_CONF.get_doc_storage %]
+[% PROCESS 'client_config/_attachments.html' %]
+[%- END %]
+[% PROCESS 'client_config/_warehouse.html' %]
+[% PROCESS 'client_config/_features.html' %]
+[% PROCESS 'client_config/_stocktaking.html' %]
+[% PROCESS 'client_config/_record_links.html' %]
+[% PROCESS 'client_config/_miscellaneous.html' %]
+ </div>
 </form>