From fedfc383692d2cb07d68244b31e2b08b450329d4 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Mon, 16 Jan 2017 16:27:56 +0100 Subject: [PATCH] =?utf8?q?ActionBar:=20Verwendung=20bei=20Lager=20?= =?utf8?q?=E2=86=92=20Einlagern,=20Lager=20=E2=86=92=20Berichte=20?= =?utf8?q?=E2=86=92=20Lagerentnahme?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Controller/Inventory.pm | 36 +++++++++++++++++-- js/locale/de.js | 1 + locale/de/all | 1 + .../inventory/warehouse_selection_stock.html | 18 +++++----- .../webpages/inventory/warehouse_usage.html | 7 +--- 5 files changed, 44 insertions(+), 19 deletions(-) diff --git a/SL/Controller/Inventory.pm b/SL/Controller/Inventory.pm index 3306aa19c..b2dccb159 100644 --- a/SL/Controller/Inventory.pm +++ b/SL/Controller/Inventory.pm @@ -44,6 +44,7 @@ sub action_stock_in { $::request->layout->focus('#part_id_name'); my $transfer_types = WH->retrieve_transfer_types('in'); map { $_->{description} = $main::locale->text($_->{description}) } @{ $transfer_types }; + $self->setup_stock_in_action_bar; $self->render('inventory/warehouse_selection_stock', title => $::form->{title}, TRANSFER_TYPES => $transfer_types ); } @@ -56,6 +57,7 @@ sub action_stock_usage { 'bins' => 'BINS', }); $::request->layout->use_javascript("${_}.js") for qw(kivi.PartsWarehouse); + $self->setup_stock_usage_action_bar; $self->render('inventory/warehouse_usage', title => $::form->{title}, year => DateTime->today->year, @@ -365,7 +367,7 @@ sub action_usage { $report->set_options('raw_bottom_info_text' => $self->render('inventory/report_bottom', { output => 0 }) ); } - $report->generate_with_headers(); + $report->generate_with_headers(action_bar => 1); $main::lxdebug->leave_sub(); @@ -621,6 +623,35 @@ sub show_no_warehouses_error { $::form->show_generic_error($msg); } +sub setup_stock_in_action_bar { + my ($self, %params) = @_; + + for my $bar ($::request->layout->get('actionbar')) { + $bar->add( + action => [ + t8('Stock'), + submit => [ '#form', { action => 'Inventory/stock' } ], + checks => [ 'check_part_selection_before_stocking' ], + accesskey => 'enter', + ], + ); + } +} + +sub setup_stock_usage_action_bar { + my ($self, %params) = @_; + + for my $bar ($::request->layout->get('actionbar')) { + $bar->add( + action => [ + t8('Show'), + submit => [ '#form', { action => 'Inventory/usage' } ], + accesskey => 'enter', + ], + ); + } +} + 1; __END__ @@ -673,8 +704,7 @@ the format is adapted to this only for C and C: -Martin Helmling Emartin.helmling@opendynamic.deE +pMartin Helmling Emartin.helmling@opendynamic.deE =cut - diff --git a/js/locale/de.js b/js/locale/de.js index a4fedd7e2..6ba3771af 100644 --- a/js/locale/de.js +++ b/js/locale/de.js @@ -64,6 +64,7 @@ namespace("kivi").setupLocale({ "Map":"Karte", "More than one file selected, please set only one checkbox!":"Mehr als ein Element selektiert, bitte nur eine Box anklicken", "No":"Nein", +"No article has been selected yet.":"Es wurde noch kein Artikel ausgewählt.", "No delievery orders selected, please set one checkbox!":"Kein Lieferschein selektiert, bitte eine Box anklicken!", "No delivery orders have been selected.":"Es wurden keine Lieferscheine ausgewählt.", "No entries have been selected.":"Es wurden keine Einträge ausgewählt.", diff --git a/locale/de/all b/locale/de/all index 303b7dcd1..9ba028bd0 100755 --- a/locale/de/all +++ b/locale/de/all @@ -1839,6 +1839,7 @@ $self->{texts} = { 'No Journal' => 'Kein Journal', 'No Vendor was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Händler gefunden', 'No action defined.' => 'Keine Aktion definiert.', + 'No article has been selected yet.' => 'Es wurde noch kein Artikel ausgewählt.', 'No articles have been added yet.' => 'Es wurden noch keine Artikel hinzugefügt.', 'No background job has been created yet.' => 'Es wurden noch keine Hintergrund-Jobs angelegt.', 'No bank account chosen!' => 'Kein Bankkonto ausgewählt!', diff --git a/templates/webpages/inventory/warehouse_selection_stock.html b/templates/webpages/inventory/warehouse_selection_stock.html index c9ca33906..70b6e6fc1 100644 --- a/templates/webpages/inventory/warehouse_selection_stock.html +++ b/templates/webpages/inventory/warehouse_selection_stock.html @@ -7,7 +7,7 @@ [%- INCLUDE 'common/flash.html' %] -
+ @@ -66,9 +66,6 @@
[% L.input_tag('comment', FORM.comment, size=60) %]
- - -
@@ -86,14 +83,15 @@ function reload_warehouse_selection () { function reload_bin_selection () { $.post("controller.pl", { action: 'Inventory/warehouse_changed', warehouse_id: function(){ return $('#warehouse_id').val() } }, kivi.eval_json_result); } +function check_part_selection_before_stocking() { + if ($('#part_id').val() !== '') + return true; + + alert(kivi.t8('No article has been selected yet.')); + return false; +} $(function(){ $('#part_id').change(reload_warehouse_selection); - $('#part_id').change(function(){ - if ($('#part_id').val() > 0) - $('#action_stock').removeAttr('disabled'); - else - $('#action_stock').attr('disabled', 'disabled'); - }); $('#warehouse_id').change(reload_bin_selection); }) diff --git a/templates/webpages/inventory/warehouse_usage.html b/templates/webpages/inventory/warehouse_usage.html index 9151556e7..f52769415 100644 --- a/templates/webpages/inventory/warehouse_usage.html +++ b/templates/webpages/inventory/warehouse_usage.html @@ -9,7 +9,7 @@ [%- INCLUDE 'common/flash.html' %] -
+ @@ -118,9 +118,4 @@

- -

- - -

-- 2.20.1