]> wagnertech.de Git - mfinanz.git/blobdiff - SL/Controller/Order.pm
Auftrags-Controller: Beleg neu Laden nach Mail
[mfinanz.git] / SL / Controller / Order.pm
index 12b9bae640b4e2f29f622c2a72dfe0f08b19c05a..bf0915b7ee2fed09693076e869525ca5a9a6052d 100644 (file)
@@ -452,6 +452,7 @@ sub action_send_email {
     $::form->{tmpdir}  = $sfile->get_path; # for Form::cleanup which may be called in Form::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, 'pdf');
 
   # internal notes
@@ -467,11 +468,15 @@ sub action_send_email {
 
   $self->order->update_attributes(intnotes => $intnotes);
 
-  $self->js
-      ->val('#order_intnotes', $intnotes)
-      ->run('kivi.Order.close_email_dialog')
-      ->flash('info', t8('The email has been sent.'))
-      ->render($self);
+  flash_later('info', t8('The email has been sent.'));
+
+  my @redirect_params = (
+    action => 'edit',
+    type   => $self->type,
+    id     => $self->order->id,
+  );
+
+  $self->redirect_to(@redirect_params);
 }
 
 # open the periodic invoices config dialog
@@ -1885,6 +1890,7 @@ sub setup_edit_action_bar {
         action => [
           t8('Save and E-mail'),
           call => [ 'kivi.Order.save', 'save_and_show_email_dialog', $::instance_conf->get_order_warn_duplicate_parts ],
+          disabled => !$self->order->id ? t8('This object has not been saved yet.') : undef,
         ],
         action => [
           t8('Download attachments of all parts'),