From: Moritz Bunkus Date: Thu, 12 Jan 2017 16:35:42 +0000 (+0100) Subject: ActionBar: Verwendung bei Preisregeln X-Git-Tag: release-3.5.4~1327 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=b52b09d864eb75703562a5fdd8d2b09c66669927;p=kivitendo-erp.git ActionBar: Verwendung bei Preisregeln --- diff --git a/SL/Controller/PriceRule.pm b/SL/Controller/PriceRule.pm index 2ddccf15b..2ced8edd7 100644 --- a/SL/Controller/PriceRule.pm +++ b/SL/Controller/PriceRule.pm @@ -34,9 +34,11 @@ sub action_list { my $price_rules = $self->models->get; + $self->setup_search_action_bar; + $self->prepare_report; - $self->report_generator_list_objects(report => $self->{report}, objects => $price_rules, $::form->{inline} ? (layout => 0, header => 0) : ()); + $self->report_generator_list_objects(report => $self->{report}, objects => $price_rules, $::form->{inline} ? (layout => 0, header => 0) : (action_bar => 1)); } sub action_new { @@ -109,6 +111,7 @@ sub display_form { my ($self, %params) = @_; my $is_new = !$self->price_rule->id; my $title = $self->form_title(($is_new ? 'create' : 'edit'), $self->price_rule->type); + $self->setup_form_action_bar; $self->render('price_rule/form', title => $title, %params @@ -300,4 +303,75 @@ sub init_models { ); } +sub setup_search_action_bar { + my ($self, %params) = @_; + + return if $::form->{inline}; + + for my $bar ($::request->layout->get('actionbar')) { + $bar->add( + action => [ + t8('Search'), + submit => [ '#search_form', { action => 'PriceRule/list' } ], + accesskey => 'enter', + ], + action => [ + t8('Reset'), + call => [ 'kivi.PriceRule.reset_search_form' ], + ], + + combobox => [ + action => [ + t8('Add'), + ], + link => [ + t8('New Sales Price Rule'), + link => $self->url_for(action => 'new', 'price_rule.type' => 'customer', callback => $self->models->get_callback), + ], + link => [ + t8('New Purchase Price Rule'), + link => $self->url_for(action => 'new', 'price_rule.type' => 'vendor', callback => $self->models->get_callback), + ], + ], # end of combobox "Add" + ); + } +} + +sub setup_form_action_bar { + my ($self) = @_; + + my $is_new = !$self->price_rule->id; + + for my $bar ($::request->layout->get('actionbar')) { + $bar->add( + combobox => [ + action => [ + $is_new ? t8('Create') : t8('Save'), + submit => [ '#form', { action => 'PriceRule/' . ($is_new ? 'create' : 'update') } ], + accesskey => 'enter', + ], + action => [ + t8('Use as new'), + submit => [ '#form', { action => 'PriceRule/create' } ], + disabled => $is_new ? t8('The object has not been saved yet.') : undef, + ], + ], # end of combobox "Save" + + action => [ + t8('Delete'), + submit => [ '#form', { action => 'PriceRule/destroy' } ], + confirm => t8('Do you really want to delete this object?'), + disabled => $is_new ? t8('The object has not been saved yet.') + : $self->price_rule->in_use ? t8('This object has already been used.') + : undef, + ], + + link => [ + t8('Abort'), + link => $self->url_for(action => 'list', 'filter.type' => $self->price_rule->type), + ], + ); + } +} + 1; diff --git a/templates/webpages/price_rule/_filter.html b/templates/webpages/price_rule/_filter.html index 02c66db22..826191bf6 100644 --- a/templates/webpages/price_rule/_filter.html +++ b/templates/webpages/price_rule/_filter.html @@ -2,7 +2,7 @@ [%- USE L %] [%- USE LxERP %] [%- USE HTML %] -
+
[% 'Show Filter' | $T8 %] [% SELF.filter_summary | html %] @@ -86,13 +86,9 @@ -[% L.hidden_tag('action', 'PriceRule/dispatch') %] [% L.hidden_tag('sort_by', FORM.sort_by) %] [% L.hidden_tag('sort_dir', FORM.sort_dir) %] [% L.hidden_tag('page', FORM.page) %] -[% L.input_tag('action_list', LxERP.t8('Continue'), type = 'submit', class='submit') %] - -[% 'Reset' | $T8 %]
diff --git a/templates/webpages/price_rule/form.html b/templates/webpages/price_rule/form.html index 51f6066d3..70d8cf6e1 100644 --- a/templates/webpages/price_rule/form.html +++ b/templates/webpages/price_rule/form.html @@ -6,7 +6,7 @@ [%- INCLUDE 'common/flash.html' %] - + [% L.hidden_tag("price_rule.id", SELF.price_rule.id) %] [% L.hidden_tag("price_rule.type", SELF.price_rule.type) %] @@ -42,15 +42,4 @@

[% 'Then' | $T8 %]:

[% 'Set (set to)' | $T8 %] [% L.select_tag('price_rule.price_type', SELF.all_price_types, default=SELF.price_rule.price_type) %] [% 'to (set to)' | $T8 %] [% L.input_tag('price_rule.price_or_discount_as_number', SELF.price_rule.price_or_discount_as_number) %] [?]
- -

- [% L.hidden_tag("action", "PriceRule/dispatch") %] - [% L.hidden_tag("callback", FORM.callback) %] - [% L.submit_tag("action_" _ (SELF.price_rule.id ? "update" : "create"), LxERP.t8('Save')) %] - [%- IF SELF.price_rule.id %] - [% L.submit_tag("action_create", LxERP.t8('Save as new')) %] - [% L.submit_tag("action_destroy", LxERP.t8('Delete'), confirm=LxERP.t8('Do you really want to delete this object?')) IF !SELF.price_rule.in_use %] - [%- END %] - [%- LxERP.t8('Abort') %] -

diff --git a/templates/webpages/price_rule/report_bottom.html b/templates/webpages/price_rule/report_bottom.html index f471ab703..e61821280 100644 --- a/templates/webpages/price_rule/report_bottom.html +++ b/templates/webpages/price_rule/report_bottom.html @@ -2,8 +2,3 @@ [% USE T8 %] [% USE HTML %] [%- L.paginate_controls(models=SELF.models) %] - -[%- UNLESS FORM.inline %] -[% 'New Sales Price Rule' | $T8 %] -[% 'New Purchase Price Rule' | $T8 %] -[%- END %]