]> wagnertech.de Git - kivitendo-erp.git/commitdiff
Inventory Helper: Bessere Fehlermeldung bei fehlenden Parametern
authorMartin Helmling martin.helmling@octosoft.eu <martin.helmling@octosoft.eu>
Thu, 19 Mar 2020 16:25:31 +0000 (17:25 +0100)
committerSven Schöling <s.schoeling@googlemail.com>
Fri, 27 Nov 2020 15:27:45 +0000 (16:27 +0100)
Alle Fehler im allocate() des Inventory-Helpers werden nun per
SL::X::Inventory::Allocation Fehlermethode erzeugt,
damit es eine einheitliche Prüfung geben kann.

verbessert egw 12413

SL/Helper/Inventory.pm
locale/de/all

index 53887666663cd02dd39bb48c18b44088c7db0ad3..cd50907805a8d7a91b0e49d327bcfa5dbc952bc0 100644 (file)
@@ -167,8 +167,17 @@ sub get_onhand {
 sub allocate {
   my (%params) = @_;
 
-  my $part = $params{part} or Carp::croak('allocate needs a part');
-  my $qty  = $params{qty}  or Carp::croak('allocate needs a qty');
+  die SL::X::Inventory::Allocation->new(
+    error => 'allocate needs a part',
+    msg => t8("Method allocate needs the parameter 'part'"),
+  ) unless $params{part};
+  die SL::X::Inventory::Allocation->new(
+    error => 'allocate needs a qty',
+    msg => t8("Method allocate needs the parameter 'qty'"),
+  ) unless $params{qty};
+
+  my $part = $params{part};
+  my $qty  = $params{qty};
 
   return () if $qty <= 0;
 
index 4f3384afdea97da01a6dfe3f385c7421048dda58..202108d7061d3a4f7c18414d8d91009b2bc55ef9 100755 (executable)
@@ -1963,6 +1963,8 @@ $self->{texts} = {
   'Meta tag keywords'           => 'Metatag Keywords',
   'Meta tag title'              => 'Metatag Titel',
   'Method'                      => 'Verfahren',
+  'Method allocate needs the parameter \'part\'' => 'Es fehlt der Parameter \'part\'',
+  'Method allocate needs the parameter \'qty\'' => 'Es fehlt der Parameter \'qty\' oder die Menge ist 0',
   'Microfiche'                  => 'Mikrofilm',
   'Minimum Amount'              => 'Mindestbetrag',
   'Miscellaneous'               => 'Verschiedenes',