From: G. Richardson Date: Tue, 8 Feb 2022 15:28:09 +0000 (+0100) Subject: Mandantenkonfiguration - Warengruppe als Pflichtfeld X-Git-Tag: kivitendo-mebil_0.1-0~10^2~2^2~219^2 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=f3bad0c2bf4ac1a731ee7f1d8da2cccde5f3f10c;p=kivitendo-erp.git Mandantenkonfiguration - Warengruppe als Pflichtfeld Kann nun konfiguriert werden. --- diff --git a/SL/DB/MetaSetup/Default.pm b/SL/DB/MetaSetup/Default.pm index c422bab6a..ff3733a7d 100644 --- a/SL/DB/MetaSetup/Default.pm +++ b/SL/DB/MetaSetup/Default.pm @@ -128,6 +128,7 @@ __PACKAGE__->meta->columns( 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' }, + partsgroup_required => { type => 'boolean', default => 'false', not_null => 1 }, payments_changeable => { type => 'integer', default => '0', not_null => 1 }, pdonumber => { type => 'text' }, ponumber => { type => 'text' }, diff --git a/SL/DB/Part.pm b/SL/DB/Part.pm index 1ee4f26ee..89261af01 100644 --- a/SL/DB/Part.pm +++ b/SL/DB/Part.pm @@ -139,6 +139,13 @@ sub validate { push @errors, $::locale->text('The unit is missing.') unless $self->unit; push @errors, $::locale->text('The buchungsgruppe is missing.') unless $self->buchungsgruppen_id or $self->buchungsgruppe; + if ( $::instance_conf->get_partsgroup_required + && ( !$self->partsgroup_id or ( $self->id && !$self->partsgroup_id && $self->partsgroup ) ) ) { + # when unsetting an existing partsgroup in the interface, $self->partsgroup_id will be undef but $self->partsgroup will still have a value + # this needs to be checked, as partsgroup dropdown has an empty value + push @errors, $::locale->text('The partsgroup is missing.'); + } + unless ( $self->id ) { push @errors, $::locale->text('The partnumber already exists.') if SL::DB::Manager::Part->get_all_count(where => [ partnumber => $self->partnumber ]); }; diff --git a/doc/changelog b/doc/changelog index 53113b382..f73fd3420 100644 --- a/doc/changelog +++ b/doc/changelog @@ -50,6 +50,7 @@ Kleinere neue Features und Detailverbesserungen: dass die Belegnummern von Belegen, die auf unserer Seite erzeugt werden, nicht mehr editierbar sind. In dem Fall vergibt kivitendo sie immer automatisch und zeigt sie in den Belegmasken nur noch an. +- Warengruppe kann nun als Pflichtfeld für Artikel konfiguriert werden. Bugfixes (Tracker: https://www.kivitendo.de/redmine): diff --git a/locale/de/all b/locale/de/all index b451f51b8..0807feb38 100755 --- a/locale/de/all +++ b/locale/de/all @@ -1727,6 +1727,7 @@ $self->{texts} = { '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 enabled sales invoices created using OpenDocument/OASIS format will include data for Swiss QR-Bill creation.' => 'Falls aktiviert, enthalten Rechnungen im OpenDocument/OASIS Format, Daten zur Schweizer QR-Rechnung.', 'If enabled the record links view starts always from the sales order including all sublevels' => 'Falls aktiv, werden die verknüpften Belege immer vom Verkaufsauftrag inkl. aller darunterliegenden Belege angezeigt', + 'If enabled, when saving parts the partsgroup must be not be empty.' => 'Falls aktiviert muß beim Speichern von Artikeln eine Warengruppe ausgewählt sein.', 'If item not found, allow creation of new item' => 'Falls Artikel nicht gefunden, erlaube Erfassen eines Neuen', 'If left empty the default sender from the kivitendo configuration will be used (key \'email_from\' in section \'periodic_invoices\'; current value: #1).' => 'Falls leer, so wird der Standardabsender aus der kivitendo-Konfiguration genutzt (Schlüssel »email_from« in Abschnitt »periodic_invoices«; aktueller Wert: #1).', 'If missing then the start date will be used.' => 'Falls es fehlt, so wird die erste Rechnung für das Startdatum erzeugt.', @@ -2442,6 +2443,7 @@ $self->{texts} = { 'Partsgroup' => 'Warengruppe', 'Partsgroup (database ID)' => 'Warengruppe (Datenbank-ID)', 'Partsgroup (name)' => 'Warengruppe (Name)', + 'Partsgroup is required for parts' => 'Warengruppe ist Pflichtfeld für Artikel', 'Partsgroups' => 'Warengruppen', 'Partsgroups where variables are shown' => 'Warengruppen, bei denen Variablen angezeigt werden', 'Password' => 'Passwort', @@ -3614,6 +3616,7 @@ $self->{texts} = { 'The parts for this delivery order have already been transferred out.' => 'Die Artikel dieses Lieferscheins wurden bereits ausgelagert.', 'The parts have been removed.' => 'Die Waren wurden aus dem Lager entnommen.', 'The parts have been transferred.' => 'Die Waren wurden umgelagert.', + 'The partsgroup is missing.' => 'Die Warengruppe fehlt.', 'The password is too long (maximum length: #1).' => 'Das Passwort ist zu lang (maximale Länge: #1).', 'The password is too short (minimum length: #1).' => 'Das Password ist zu kurz (minimale Länge: #1).', 'The password is weak (e.g. it can be found in a dictionary).' => 'Das Passwort ist schwach (z.B. wenn es in einem Wörterbuch steht).', diff --git a/locale/en/all b/locale/en/all index 24a4366d1..8ae48e1a8 100644 --- a/locale/en/all +++ b/locale/en/all @@ -1727,6 +1727,7 @@ $self->{texts} = { 'If enabled purchase and sales records cannot be saved if no transaction description has been entered.' => '', 'If enabled sales invoices created using OpenDocument/OASIS format will include data for Swiss QR-Bill creation.' => '', 'If enabled the record links view starts always from the sales order including all sublevels' => '', + 'If enabled, when saving parts the partsgroup must be not be empty.' => '', 'If item not found, allow creation of new item' => '', 'If left empty the default sender from the kivitendo configuration will be used (key \'email_from\' in section \'periodic_invoices\'; current value: #1).' => '', 'If missing then the start date will be used.' => '', @@ -2442,6 +2443,7 @@ $self->{texts} = { 'Partsgroup' => '', 'Partsgroup (database ID)' => '', 'Partsgroup (name)' => '', + 'Partsgroup is required for parts' => '', 'Partsgroups' => '', 'Partsgroups where variables are shown' => '', 'Password' => '', @@ -3613,6 +3615,7 @@ $self->{texts} = { 'The parts for this delivery order have already been transferred out.' => '', 'The parts have been removed.' => '', 'The parts have been transferred.' => '', + 'The partsgroup is missing.' => '', 'The password is too long (maximum length: #1).' => '', 'The password is too short (minimum length: #1).' => '', 'The password is weak (e.g. it can be found in a dictionary).' => '', diff --git a/sql/Pg-upgrade2/defaults_partsgroup_required.sql b/sql/Pg-upgrade2/defaults_partsgroup_required.sql new file mode 100644 index 000000000..52500029b --- /dev/null +++ b/sql/Pg-upgrade2/defaults_partsgroup_required.sql @@ -0,0 +1,5 @@ +-- @tag: defaults_partsgroup_required +-- @description: New setting to check that partsgroup is set when saving parts +-- @depends: release_3_5_8 + +ALTER TABLE defaults ADD COLUMN partsgroup_required boolean NOT NULL DEFAULT false; diff --git a/templates/webpages/client_config/_features.html b/templates/webpages/client_config/_features.html index ce754c9ca..476ed16b6 100644 --- a/templates/webpages/client_config/_features.html +++ b/templates/webpages/client_config/_features.html @@ -194,6 +194,11 @@ [% L.yes_no_tag('defaults.normalize_part_descriptions', SELF.defaults.normalize_part_descriptions) %] [% LxERP.t8('Automatic deletion of leading, trailing and excessive (repetitive) spaces in part description and part notes. Affects the CSV import as well.') %] + + [% LxERP.t8('Partsgroup is required for parts') %] + [% L.yes_no_tag('defaults.partsgroup_required', SELF.defaults.partsgroup_required) %] + [% LxERP.t8('If enabled, when saving parts the partsgroup must be not be empty.') %] + [% LxERP.t8("Purchasing & Sales") %]