}
}
+sub action_save_and_purchase_order {
+ my ($self) = @_;
+
+ delete $::form->{previousform};
+ $::form->{callback} = $self->url_for(
+ controller => 'Order',
+ action => 'return_from_create_part',
+ type => 'purchase_order',
+ );
+
+ $self->_run_action('save');
+}
+
sub action_abort {
my ($self) = @_;
sub _set_javascript {
my ($self) = @_;
- $::request->layout->use_javascript("${_}.js") for qw(kivi.Part kivi.File kivi.PriceRule ckeditor/ckeditor ckeditor/adapters/jquery kivi.ShopPart);
+ $::request->layout->use_javascript("${_}.js") for qw(kivi.Part kivi.File kivi.PriceRule ckeditor/ckeditor ckeditor/adapters/jquery kivi.ShopPart kivi.Validator);
$::request->layout->add_javascripts_inline("\$(function(){kivi.PriceRule.load_price_rules_for_part(@{[ $self->part->id ]})});") if $self->part->id;
}
}
sub init_all_pricegroups {
- SL::DB::Manager::Pricegroup->get_all_sorted;
+ SL::DB::Manager::Pricegroup->get_all_sorted(query => [ obsolete => 0 ]);
}
# model used to filter/display the parts in the multi-items dialog
t8('Save'),
call => [ 'kivi.Part.save' ],
disabled => !$may_edit ? t8('You do not have the permissions to access this function.') : undef,
+ checks => ['kivi.validate_form'],
],
action => [
t8('Use as new'),
],
], # end of combobox "Save"
+ combobox => [
+ action => [ t8('Workflow') ],
+ action => [
+ t8('Save and Purchase Order'),
+ submit => [ '#ic', { action => "Part/save_and_purchase_order" } ],
+ checks => ['kivi.validate_form'],
+ disabled => !$self->part->id ? t8('The object has not been saved yet.')
+ : !$may_edit ? t8('You do not have the permissions to access this function.')
+ : !$::auth->assert('purchase_order_edit', 'may fail') ? t8('You do not have the permissions to access this function.')
+ : undef,
+ only_if => !$::form->{inline_create},
+ ],
+ ],
+
action => [
t8('Abort'),
submit => [ '#ic', { action => "Part/abort" } ],
- only_if => !!$::form->{show_abort},
+ only_if => !!$::form->{inline_create},
],
action => [