Liefertermin Erinnerung für Auftrags-Controller
authorJan Büren <jan@kivitendo-premium.de>
Wed, 18 Jul 2018 12:43:33 +0000 (14:43 +0200)
committerJan Büren <jan@kivitendo-premium.de>
Wed, 18 Jul 2018 12:43:33 +0000 (14:43 +0200)
Falls in Mandanten-Konfig aktiviert, wird ein leerer Eintrag in
Liefertermin in Aufträgen beim Speichern oder
beim Workflow 'Speichern und Lieferschein' angemahnt.

SL/Controller/Order.pm
SL/DB/MetaSetup/Default.pm
js/kivi.Order.js
sql/Pg-upgrade2/defaults_order_warn_no_deliverydate.sql [new file with mode: 0644]
templates/webpages/client_config/_features.html

index ace7acc..d4395b5 100644 (file)
@@ -1472,7 +1472,9 @@ sub _setup_edit_action_bar {
       combobox => [
         action => [
           t8('Save'),
-          call      => [ 'kivi.Order.save', 'save', $::instance_conf->get_order_warn_duplicate_parts ],
+          call      => [ 'kivi.Order.save', 'save', $::instance_conf->get_order_warn_duplicate_parts,
+                                                    $::instance_conf->get_order_warn_no_deliverydate,
+                                                                                                      ],
           checks    => [ 'kivi.Order.check_save_active_periodic_invoices' ],
         ],
         action => [
@@ -1483,7 +1485,9 @@ sub _setup_edit_action_bar {
         ],
         action => [
           t8('Save and Delivery Order'),
-          call      => [ 'kivi.Order.save', 'save_and_delivery_order', $::instance_conf->get_order_warn_duplicate_parts ],
+          call      => [ 'kivi.Order.save', 'save_and_delivery_order', $::instance_conf->get_order_warn_duplicate_parts,
+                                                                       $::instance_conf->get_order_warn_no_deliverydate,
+                                                                                                                        ],
           checks    => [ 'kivi.Order.check_save_active_periodic_invoices' ],
           only_if   => (any { $self->type eq $_ } (_sales_order_type(), _purchase_order_type()))
         ],
index b6a3af5..87d676b 100644 (file)
@@ -99,6 +99,7 @@ __PACKAGE__->meta->columns(
   normalize_vc_names                        => { type => 'boolean', default => 'true' },
   order_always_project                      => { type => 'boolean', default => 'false' },
   order_warn_duplicate_parts                => { type => 'boolean', default => 'true' },
+  order_warn_no_deliverydate                => { type => 'boolean', default => 'true' },
   parts_image_css                           => { type => 'text', default => 'border:0;float:left;max-width:250px;margin-top:20px:margin-right:10px;margin-left:10px;' },
   parts_listing_image                       => { type => 'boolean', default => 'true' },
   parts_show_image                          => { type => 'boolean', default => 'true' },
index 21d29ca..298a8b5 100644 (file)
@@ -35,9 +35,19 @@ namespace('kivi.Order', function(ns) {
     return true;
   };
 
-  ns.save = function(action, warn_on_duplicates) {
+  ns.check_valid_reqdate = function() {
+    if ($('#order_reqdate').val() === '') {
+      alert(kivi.t8('Please select a delivery date.'));
+      return false;
+    } else {
+      return true;
+    }
+  };
+
+  ns.save = function(action, warn_on_duplicates, warn_on_reqdate) {
     if (!ns.check_cv()) return;
     if (warn_on_duplicates && !ns.check_save_duplicate_parts()) return;
+    if (warn_on_reqdate    && !ns.check_valid_reqdate()) return;
 
     var data = $('#order_form').serializeArray();
     data.push({ name: 'action', value: 'Order/' + action });
diff --git a/sql/Pg-upgrade2/defaults_order_warn_no_deliverydate.sql b/sql/Pg-upgrade2/defaults_order_warn_no_deliverydate.sql
new file mode 100644 (file)
index 0000000..6ec78a3
--- /dev/null
@@ -0,0 +1,5 @@
+-- @tag: defaults_order_warn_no_deliverydate
+-- @description: Mandantenkonfiguration: Warnung falls kein Liefertermin eingetragen wurden
+-- @depends: release_3_5_2
+
+ALTER TABLE defaults ADD COLUMN order_warn_no_deliverydate BOOLEAN DEFAULT TRUE;
index 7a952a8..cf72e80 100644 (file)
    <td>[% L.yes_no_tag("defaults.order_warn_duplicate_parts", SELF.defaults.order_warn_duplicate_parts) %]</td>
    <td>[% LxERP.t8("If enabled a warning will be shown in sales and purchase orders if there are two or more positions of the same part (new controller only).") %]</td>
   </tr>
+  <tr>
+   <td align="right">[% LxERP.t8("Warn before saving orders without a delivery date") %]</td>
+   <td>[% L.yes_no_tag("defaults.order_warn_no_deliverydate", SELF.defaults.order_warn_no_deliverydate) %]</td>
+   <td>[% LxERP.t8("If enabled a warning will be shown in sales and purchase orders if there the delivery date is empty.") %]</td>
+  </tr>
 
   <tr><td class="listheading" colspan="4">[% LxERP.t8("E-mail") %]</td></tr>