Mandantenkonfiguration - Warengruppe als Pflichtfeld
authorG. Richardson <grichardson@kivitec.de>
Tue, 8 Feb 2022 15:28:09 +0000 (16:28 +0100)
committerG. Richardson <grichardson@kivitec.de>
Tue, 8 Feb 2022 15:32:21 +0000 (16:32 +0100)
Kann nun konfiguriert werden.

SL/DB/MetaSetup/Default.pm
SL/DB/Part.pm
doc/changelog
locale/de/all
locale/en/all
sql/Pg-upgrade2/defaults_partsgroup_required.sql [new file with mode: 0644]
templates/webpages/client_config/_features.html

index c422bab..ff3733a 100644 (file)
@@ -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' },
index 1ee4f26..89261af 100644 (file)
@@ -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 ]);
   };
index 53113b3..f73fd34 100644 (file)
@@ -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):
 
index b451f51..0807feb 100755 (executable)
@@ -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).',
index 24a4366..8ae48e1 100644 (file)
@@ -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 (file)
index 0000000..5250002
--- /dev/null
@@ -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;
index ce754c9..476ed16 100644 (file)
    <td>   [% L.yes_no_tag('defaults.normalize_part_descriptions', SELF.defaults.normalize_part_descriptions) %]</td>
    <td>[% LxERP.t8('Automatic deletion of leading, trailing and excessive (repetitive) spaces in part description and part notes. Affects the CSV import as well.') %]</td>
  </tr>
+ <tr>
+   <td align="right">[% LxERP.t8('Partsgroup is required for parts') %]</td>
+   <td>   [% L.yes_no_tag('defaults.partsgroup_required', SELF.defaults.partsgroup_required) %]</td>
+   <td>[% LxERP.t8('If enabled, when saving parts the partsgroup must be not be empty.') %]</td>
+ </tr>
 
   <tr><td class="listheading" colspan="4">[% LxERP.t8("Purchasing & Sales") %]</td></tr>