X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FController%2FOrder.pm;h=af7858a5d271f44a9d6713a54d56ba0f0ec0c21c;hb=0ca7f6f9d4603bb146c2c653a6edb73d70f609d5;hp=67402c0598209dd5f13189547731a7397c79d05c;hpb=b24afac71c944667fdf55ad734e92b9d9c4ca905;p=kivitendo-erp.git diff --git a/SL/Controller/Order.pm b/SL/Controller/Order.pm index 67402c059..af7858a5d 100644 --- a/SL/Controller/Order.pm +++ b/SL/Controller/Order.pm @@ -197,11 +197,19 @@ sub action_save { : ''; 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); } @@ -519,18 +527,20 @@ sub action_send_email { $::form->{id} = $self->order->id; # this is used in SL::Mailer to create a linked record to the mail $::form->send_email(\%::myconfig, $::form->{print_options}->{format}); - # internal notes - my $intnotes = $self->order->intnotes; - $intnotes .= "\n\n" if $self->order->intnotes; - $intnotes .= t8('[email]') . "\n"; - $intnotes .= t8('Date') . ": " . $::locale->format_date_object(DateTime->now_local, precision => 'seconds') . "\n"; - $intnotes .= t8('To (email)') . ": " . $::form->{email} . "\n"; - $intnotes .= t8('Cc') . ": " . $::form->{cc} . "\n" if $::form->{cc}; - $intnotes .= t8('Bcc') . ": " . $::form->{bcc} . "\n" if $::form->{bcc}; - $intnotes .= t8('Subject') . ": " . $::form->{subject} . "\n\n"; - $intnotes .= t8('Message') . ": " . SL::HTML::Util->strip($::form->{message}); + # internal notes unless no email journal + unless ($::instance_conf->get_email_journal) { + my $intnotes = $self->order->intnotes; + $intnotes .= "\n\n" if $self->order->intnotes; + $intnotes .= t8('[email]') . "\n"; + $intnotes .= t8('Date') . ": " . $::locale->format_date_object(DateTime->now_local, precision => 'seconds') . "\n"; + $intnotes .= t8('To (email)') . ": " . $::form->{email} . "\n"; + $intnotes .= t8('Cc') . ": " . $::form->{cc} . "\n" if $::form->{cc}; + $intnotes .= t8('Bcc') . ": " . $::form->{bcc} . "\n" if $::form->{bcc}; + $intnotes .= t8('Subject') . ": " . $::form->{subject} . "\n\n"; + $intnotes .= t8('Message') . ": " . SL::HTML::Util->strip($::form->{message}); - $self->order->update_attributes(intnotes => $intnotes); + $self->order->update_attributes(intnotes => $intnotes); + } $self->save_history('MAILED'); @@ -1678,7 +1688,7 @@ sub new_item { sub setup_order_from_cv { my ($order) = @_; - $order->$_($order->customervendor->$_) for (qw(taxzone_id payment_id delivery_term_id currency_id)); + $order->$_($order->customervendor->$_) for (qw(taxzone_id payment_id delivery_term_id currency_id language_id)); $order->intnotes($order->customervendor->notes); @@ -1845,7 +1855,10 @@ sub workflow_sales_or_request_for_quotation { my $destination_type = $::form->{type} eq sales_order_type() ? sales_quotation_type() : request_quotation_type(); $self->order(SL::DB::Order->new_from($self->order, destination_type => $destination_type)); - $self->{converted_from_oe_id} = delete $::form->{id}; + delete $::form->{id}; + + # no linked records from order to quotations + delete $::form->{$_} for qw(converted_from_oe_id converted_from_orderitems_ids); # set item ids to new fake id, to identify them as new items foreach my $item (@{$self->order->items_sorted}) { @@ -2050,6 +2063,17 @@ sub setup_edit_action_bar { ], 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 ], @@ -2202,6 +2226,22 @@ sub setup_edit_action_bar { only_if => $deletion_allowed, ], + combobox => [ + action => [ + t8('more') + ], + action => [ + t8('History'), + call => [ 'set_history_window', $self->order->id, 'id' ], + disabled => !$self->order->id ? t8('This record has not been saved yet.') : undef, + ], + action => [ + t8('Follow-Up'), + call => [ 'kivi.Order.follow_up_window' ], + disabled => !$self->order->id ? t8('This object has not been saved yet.') : undef, + only_if => $::auth->assert('productivity', 1), + ], + ], # end of combobox "more" ); } }