From: Bernd Bleßmann Date: Wed, 27 Jan 2016 15:27:05 +0000 (+0100) Subject: Auftrags-Controller: Warnung beim Speichern mit doppelten Artikeln. X-Git-Tag: release-3.4.1~325 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=e09f2da35e02b34569254b5d1550aa5dd287761f;p=kivitendo-erp.git Auftrags-Controller: Warnung beim Speichern mit doppelten Artikeln. In der Mandantenkonfiguration (Features) abschaltbar. --- diff --git a/SL/DB/MetaSetup/Default.pm b/SL/DB/MetaSetup/Default.pm index 847112918..f762f3470 100644 --- a/SL/DB/MetaSetup/Default.pm +++ b/SL/DB/MetaSetup/Default.pm @@ -71,13 +71,14 @@ __PACKAGE__->meta->columns( normalize_part_descriptions => { type => 'boolean', default => 'true' }, normalize_vc_names => { type => 'boolean', default => 'true' }, order_always_project => { type => 'boolean', default => 'false' }, + order_warn_duplicate_parts => { 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' }, payments_changeable => { type => 'integer', default => '0', not_null => 1 }, pdonumber => { type => 'text' }, ponumber => { type => 'text' }, - precision => { type => 'numeric', precision => 15, scale => 5, default => '0.01', not_null => 1 }, + precision => { type => 'numeric', default => '0.01', not_null => 1, precision => 15, scale => 5 }, profit_determination => { type => 'text' }, project_status_id => { type => 'integer' }, project_type_id => { type => 'integer' }, @@ -89,8 +90,8 @@ __PACKAGE__->meta->columns( revtrans => { type => 'boolean', default => 'false' }, rfqnumber => { type => 'text' }, rmanumber => { type => 'text' }, - rndgain_accno_id => { type => 'integer'}, - rndloss_accno_id => { type => 'integer'}, + rndgain_accno_id => { type => 'integer' }, + rndloss_accno_id => { type => 'integer' }, sales_delivery_order_show_delete => { type => 'boolean', default => 'true' }, sales_order_show_delete => { type => 'boolean', default => 'true' }, sales_purchase_order_ship_missing_column => { type => 'boolean', default => 'false' }, diff --git a/js/kivi.Order.js b/js/kivi.Order.js index 3e6853554..eea906df5 100644 --- a/js/kivi.Order.js +++ b/js/kivi.Order.js @@ -14,8 +14,30 @@ namespace('kivi.Order', function(ns) { return true; }; - ns.save = function() { + ns.check_save_duplicate_parts = function() { + var id_arr = $('[name="order.orderitems[].parts_id"]').map(function() {return this.value;}).get(); + + var i, obj = {}, pos = []; + + for (i = 0; i < id_arr.length; i++) { + var id = id_arr[i]; + if (obj.hasOwnProperty(id)) { + pos.push(i + 1); + } + obj[id] = 0; + } + + if (pos.length > 0) { + return confirm(kivi.t8("There are duplicate parts at positions") + "\n" + + pos.join(', ') + "\n" + + kivi.t8("Do you really want to save?")); + } + return true; + }; + + ns.save = function(warn_on_duplicates) { if (!ns.check_cv()) return; + if (warn_on_duplicates && !ns.check_save_duplicate_parts()) return; var data = $('#order_form').serializeArray(); data.push({ name: 'action', value: 'Order/save' }); @@ -23,8 +45,9 @@ namespace('kivi.Order', function(ns) { $.post("controller.pl", data, kivi.eval_json_result); }; - ns.save_and_delivery_order = function() { + ns.save_and_delivery_order = function(warn_on_duplicates) { if (!ns.check_cv()) return; + if (warn_on_duplicates && !ns.check_save_duplicate_parts()) return; var data = $('#order_form').serializeArray(); data.push({ name: 'action', value: 'Order/save_and_delivery_order' }); diff --git a/js/locale/de.js b/js/locale/de.js index 6a29ba587..1c3fad3f2 100644 --- a/js/locale/de.js +++ b/js/locale/de.js @@ -36,6 +36,7 @@ namespace("kivi").setupLocale({ "Do you really want do continue?":"Wollen Sie wirklich fortfahren?", "Do you really want to cancel?":"Wollen Sie wirklich abbrechen?", "Do you really want to revert to this version?":"Wollen Sie wirklich auf diese Version zurücksetzen?", +"Do you really want to save?":"Wollen Sie wirklich speichern?", "Do you want to set the account number \"#1\" to \"#2\" and the name \"#3\" to \"#4\"?":"Soll die Kontonummer \"#1\" zu \"#2\" und den Name \"#3\" zu \"#4\" geändert werden?", "Download picture":"Bild herunterladen", "Edit":"Bearbeiten", @@ -79,6 +80,7 @@ namespace("kivi").setupLocale({ "The option field is empty.":"Das Optionsfeld ist leer.", "The recipient, subject or body is missing.":"Der Empfäger, der Betreff oder der Text ist leer.", "The selected database is still configured for client \"#1\". If you delete the database that client will stop working until you re-configure it. Do you still want to delete the database?":"Die auswählte Datenbank ist noch für Mandant \"#1\" konfiguriert. Wenn Sie die Datenbank löschen, wird der Mandanten nicht mehr funktionieren, bis er anders konfiguriert wurde. Wollen Sie die Datenbank trotzdem löschen?", +"There are duplicate parts at positions":"Es gibt doppelte Artikel bei den Positionen", "There are still transfers not matching the qty of the delivery order. Stock operations can not be changed later. Do you really want to proceed?":"Einige der Lagerbewegungen sind nicht vollständig und Lagerbewegungen können nachträglich nicht mehr verändert werden. Wollen Sie wirklich fortfahren?", "There is no connected chart.":"Es fehlt ein verknüpftes Buchungskonto.", "There is one or more sections for which no part has been assigned yet; therefore creating the new record is not possible yet.":"Es gibt einen oder mehrere Abschnitte ohne Artikelzuweisung; daher kann der neue Beleg noch nicht erstellt werden.", diff --git a/locale/de/all b/locale/de/all index 27ca6223f..42e432e2c 100755 --- a/locale/de/all +++ b/locale/de/all @@ -943,6 +943,7 @@ $self->{texts} = { 'Do you really want to delete this object?' => 'Wollen Sie dieses Objekt wirklich löschen?', 'Do you really want to delete this warehouse?' => 'Wollen Sie dieses Lager wirklich löschen?', 'Do you really want to revert to this version?' => 'Wollen Sie wirklich auf diese Version zurücksetzen?', + 'Do you really want to save?' => 'Wollen Sie wirklich speichern?', 'Do you want to limit your search?' => 'Wollen Sie Ihre Suche spezialisieren?', 'Do you want to carry this shipping address over to the new purchase order so that the vendor can deliver the goods directly to your customer?' => 'Wollen Sie diese Lieferadresse in den neuen Lieferantenauftrag übernehmen, damit der Händler die Waren direkt an Ihren Kunden liefern kann?', 'Do you want to overwrite your current title?' => 'Wollen Sie den aktuellen Titel überschreiben?', @@ -1388,6 +1389,7 @@ $self->{texts} = { 'If disabled sales orders cannot be converted into sales invoices directly.' => 'Falls deaktiviert, so können Verkaufsaufträge nicht direkt in Verkaufsrechnungen umgewandelt werden.', 'If disabled sales quotations cannot be converted into sales invoices directly.' => 'Falls deaktiviert, so können Verkaufsangebote nicht direkt in Verkaufsrechnungen umgewandelt werden.', 'If enabled a column will be shown in sales and purchase orders that lists both the amount and the value not shipped yet for each item.' => 'Falls eingeschaltet, wird für jede Position in Auftragsbestätigungen und Lieferantenaufträgen eine Spalte mit noch nicht gelieferter Menge und Wert angezeigt.', + '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).' => 'Falls eingeschaltet, wird eine Warnung angezeigt, wenn der Auftrag mehrere gleiche Artikel enthält (nur neuer Controller).', 'If enabled only those projects that are assigned to the currently selected customer are offered for selection in sales records.' => 'Wenn eingeschaltet, so werden in Verkaufsbelegen nur diejenigen Projekte zur Auswahl angeboten, die dem aktuell ausgewählten Kunden zugewiesen wurden.', 'If enabled purchase and sales records cannot be saved if no transaction description has been entered.' => 'Wenn angeschaltet, so können Einkaufs- und Verkaufsbelege nicht gespeichert werden, solange keine Vorgangsbezeichnung eingegeben wurde.', 'If missing then the start date will be used.' => 'Falls es fehlt, so wird die erste Rechnung für das Startdatum erzeugt.', @@ -2989,6 +2991,7 @@ $self->{texts} = { 'There are currently no open invoices, or none matches your filter conditions.' => 'Es gibt momentan keine offenen Rechnungen, oder keine erfüllt die Filterkriterien.', 'There are currently no open sales delivery orders.' => 'Es gibt zur Zeit keine offenen Verkaufslieferscheine.', 'There are double partnumbers in your database.' => 'In ihrer Datenbank befinden sich mehrfach vergebene Artikelnummern.', + 'There are duplicate parts at positions' => 'Es gibt doppelte Artikel bei den Positionen', 'There are entries in tax where taxkey is NULL.' => 'In der Datenbank sind Steuern ohne Steuerschlüssel vorhanden (in der Tabelle tax Spalte taxkey).', 'There are invalid taxnumbers in use.' => 'Es werden ungültige Steuerautomatik-Konten benutzt.', 'There are invalid transactions in your database.' => 'Sie haben ungültige Buchungen in Ihrer Datenbank.', @@ -3272,6 +3275,7 @@ $self->{texts} = { 'Warehouse management' => 'Lagerverwaltung/Bestandsveränderung', 'Warehouse saved.' => 'Lager gespeichert.', 'Warehouses' => 'Lager', + 'Warn before saving orders with duplicate parts (new controller only)' => 'Beim Speichern warnen, wenn doppelte Artikel in einem Auftrag sind', 'Warning' => 'Warnung', 'WebDAV' => 'WebDAV', 'WebDAV link' => 'WebDAV-Link', diff --git a/locale/en/all b/locale/en/all index 1711c580c..48370745c 100644 --- a/locale/en/all +++ b/locale/en/all @@ -744,6 +744,7 @@ $self->{texts} = { 'Do you really want to delete the selected links?' => '', 'Do you really want to delete this object?' => '', 'Do you really want to delete this warehouse?' => '', + 'Do you really want to save?' => '', 'Do you want to limit your search?' => '', 'Do you want to carry this shipping address over to the new purchase order so that the vendor can deliver the goods directly to your customer?' => '', 'Do you want to set the account number "#1" to "#2" and the name "#3" to "#4"?' => '', @@ -1096,7 +1097,7 @@ $self->{texts} = { 'IV' => '', 'If amounts differ more than "Maximal amount difference" (see settings), this item is marked as invalid.' => '', 'If checked the taxkey will not be exported in the DATEV Export, but only IF chart taxkeys differ from general ledger taxkeys' => '', - 'If configured this bin will be preselected for all new parts. Also this bin will be used as the master default bin, if default transfer out with master bin is activated.' => '', + '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).' => 'Falls eingeschaltet, wird eine Warnung angezeigt, wenn der Auftrag mehrere gleiche Artikel enthält (nur neuer Controller).', '', 'If the article type is set to \'mixed\' then a column called \'type\' must be present.' => '', 'If the automatic creation of invoices for fees and interest is switched on for a dunning level then the following accounts will be used for the invoice.' => '', 'If the database user listed above does not have the right to create a database then enter the name and password of the superuser below:' => '', @@ -2296,6 +2297,7 @@ $self->{texts} = { 'There are Bins defined in your master data.' => '', 'There are bookings to the account 3803 after 01.01.2007. If you didn\'t change this account manually to 19% the bookings are probably incorrect.' => '', 'There are double partnumbers in your database.' => '', + 'There are duplicate parts at positions' => '', 'There are entries in tax where taxkey is NULL.' => '', 'There are invalid taxnumbers in use.' => '', 'There are invalid transactions in your database.' => '', @@ -2512,6 +2514,7 @@ $self->{texts} = { 'Warehouse management' => '', 'Warehouse saved.' => '', 'Warehouses' => '', + 'Warn before saving orders with duplicate parts (new controller only)' => '', 'Warning' => '', 'WebDAV' => '', 'WebDAV link' => '', diff --git a/sql/Pg-upgrade2/defaults_order_warn_duplicate_parts.sql b/sql/Pg-upgrade2/defaults_order_warn_duplicate_parts.sql new file mode 100644 index 000000000..ba8cd662d --- /dev/null +++ b/sql/Pg-upgrade2/defaults_order_warn_duplicate_parts.sql @@ -0,0 +1,6 @@ +-- @tag: defaults_order_warn_duplicate_parts +-- @description: Mandantenkonfiguration: Warnung bei doppelten Artikeln in Aufträgen +-- @depends: release_3_3_0 +-- @encoding: utf-8 + +ALTER TABLE defaults ADD COLUMN order_warn_duplicate_parts BOOLEAN DEFAULT TRUE; diff --git a/templates/webpages/client_config/_features.html b/templates/webpages/client_config/_features.html index 5dad4e971..0a2eb02e1 100644 --- a/templates/webpages/client_config/_features.html +++ b/templates/webpages/client_config/_features.html @@ -101,6 +101,12 @@ [% LxERP.t8("If enabled a column will be shown in sales and purchase orders that lists both the amount and the value not shipped yet for each item.") %] + + [% LxERP.t8("Warn before saving orders with duplicate parts (new controller only)") %] + [% L.yes_no_tag("defaults.order_warn_duplicate_parts", SELF.defaults.order_warn_duplicate_parts) %] + [% 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).") %] + + [% LxERP.t8("E-mail") %] diff --git a/templates/webpages/order/form.html b/templates/webpages/order/form.html index 55ec92b00..221af11a7 100644 --- a/templates/webpages/order/form.html +++ b/templates/webpages/order/form.html @@ -43,10 +43,10 @@ [% L.hidden_tag('action', 'Order/dispatch') %] - [% L.button_tag('kivi.Order.save()', LxERP.t8('Save')) %] + [% L.button_tag('kivi.Order.save(' _ INSTANCE_CONF.get_order_warn_duplicate_parts _ ')', LxERP.t8('Save')) %] [% L.button_tag('kivi.Order.show_print_options()', LxERP.t8('Print')) %] [% L.button_tag('kivi.Order.email()', LxERP.t8('E-mail')) %] - [% L.button_tag('kivi.Order.save_and_delivery_order()', LxERP.t8('Save and Delivery Order')) %] + [% L.button_tag('kivi.Order.save_and_delivery_order(' _ INSTANCE_CONF.get_order_warn_duplicate_parts _ ')', LxERP.t8('Save and Delivery Order')) %] [%- IF SELF.order.id && ( (SELF.cv == 'customer' && INSTANCE_CONF.get_sales_order_show_delete) || (SELF.cv == 'vendor' && INSTANCE_CONF.get_purchase_order_show_delete) ) %] [% L.button_tag('kivi.Order.delete_order()', LxERP.t8('Delete'), confirm=LxERP.t8("Are you sure?")) %] [%- END %]