: '';
flash_later('info', $text);
- my @redirect_params = (
- action => 'edit',
- type => $self->type,
- id => $self->order->id,
- );
+ my @redirect_params;
+ if ($::form->{back_to_caller}) {
+ @redirect_params = $::form->{callback} ? ($::form->{callback})
+ : (controller => 'LoginScreen', action => 'user_login');
+
+ } else {
+ @redirect_params = (
+ action => 'edit',
+ type => $self->type,
+ id => $self->order->id,
+ callback => $::form->{callback},
+ );
+ }
$self->redirect_to(@redirect_params);
}
],
disabled => !$may_edit_create ? t8('You do not have the permissions to access this function.') : undef,
],
+ action => [
+ t8('Save and Close'),
+ call => [ 'kivi.Order.save', 'save', $::instance_conf->get_order_warn_duplicate_parts,
+ $::instance_conf->get_order_warn_no_deliverydate,
+ 1
+ ],
+ checks => [ 'kivi.Order.check_save_active_periodic_invoices', ['kivi.validate_form','#order_form'],
+ @req_trans_cost_art, @req_cusordnumber,
+ ],
+ disabled => !$may_edit_create ? t8('You do not have the permissions to access this function.') : undef,
+ ],
action => [
t8('Save as new'),
call => [ 'kivi.Order.save', 'save_as_new', $::instance_conf->get_order_warn_duplicate_parts ],
}
};
- ns.save = function(action, warn_on_duplicates, warn_on_reqdate) {
+ ns.save = function(action, warn_on_duplicates, warn_on_reqdate, back_to_caller) {
if (!ns.check_cv()) return;
if (warn_on_duplicates && !ns.check_duplicate_parts()) return;
if (warn_on_reqdate && !ns.check_valid_reqdate()) return;
var data = $('#order_form').serializeArray();
data.push({ name: 'action', value: 'Order/' + action });
+ if (back_to_caller) data.push({ name: 'back_to_caller', value: '1' });
+
$.post("controller.pl", data, kivi.eval_json_result);
};