is.pl->post entwirrt.
authorSven Schöling <s.schoeling@linet-services.de>
Fri, 23 Mar 2007 15:29:16 +0000 (15:29 +0000)
committerSven Schöling <s.schoeling@linet-services.de>
Fri, 23 Mar 2007 15:29:16 +0000 (15:29 +0000)
emails speichern/buchen nun rechnungen/auftraege vor dem aufrufen der maske

bin/mozilla/io.pl
bin/mozilla/is.pl
bin/mozilla/oe.pl
locale/de/dn
locale/de/ic
locale/de/io
locale/de/ir
locale/de/is
locale/de/oe

index 5b2b55c..56cdd2f 100644 (file)
@@ -1291,7 +1291,7 @@ sub request_for_quotation {
   quotation();
 }
 
-sub e_mail {
+sub edit_e_mail {
   $lxdebug->enter_sub();
   if ($form->{second_run}) {
     $form->{print_and_post} = 0;
index 8632805..c2bfd97 100644 (file)
@@ -1452,38 +1452,19 @@ sub post {
   }
 
   relink_accounts();
-  if ($print_post) {
-    if (!(IS->post_invoice(\%myconfig, \%$form))) {
-      $form->error($locale->text('Cannot post invoice!'));
-    }
-    remove_draft() if $form->{remove_draft};
-    # saving the history
-       if(!exists $form->{addition}) {
-         $form->{addition} = "PRINTED AND POSTED";
-         $form->save_history($form->dbconnect(\%myconfig));
-    }
-    # /saving the history
-    
-  } else {
-    if (IS->post_invoice(\%myconfig, \%$form)){
-      remove_draft() if $form->{remove_draft};
-       # saving the history
-        if(!exists $form->{addition}) {
-                       if($form->{storno}) {
-                               $form->{addition} = "STORNO";
-                       }
-                       else {
-                               $form->{addition} = "POSTED";
-                       }
-                       $form->save_history($form->dbconnect(\%myconfig));
-       }
-       # /saving the history
-    
-       $form->redirect(
-            $form->{label} . " $form->{invnumber} " . $locale->text('posted!'));
-       }
-    $form->error($locale->text('Cannot post invoice!'));
+  $form->error($locale->text('Cannot post invoice!'))
+    unless IS->post_invoice(\%myconfig, \%$form);
+  remove_draft() if $form->{remove_draft};
+
+  if(!exists $form->{addition}) {
+    $form->{addition} = $print_post     ? "PRINTED AND POSTED" :
+                        $form->{storno} ? "STORNO"             :
+                                          "POSTED";
+    $form->save_history($form->dbconnect(\%myconfig));
   }
+  
+  $form->redirect( $form->{label} . " $form->{invnumber} " . $locale->text('posted!'))
+    unless $print_post;
 
   $lxdebug->leave_sub();
 }
@@ -1662,3 +1643,18 @@ sub yes {
 
   $lxdebug->leave_sub();
 }
+
+sub e_mail {
+  $lxdebug->enter_sub();
+
+  $form->{postasnew} = 1;
+  $print_post        = 1;
+
+  map { delete $form->{$_} } qw(printed emailed queued);
+
+  &post;
+
+  &edit_e_mail;
+
+  $lxdebug->leave_sub();
+}
index da5ab00..abf4bf6 100644 (file)
@@ -2509,3 +2509,26 @@ sub poso {
   $lxdebug->leave_sub();
 }
 
+sub e_mail {
+  $lxdebug->enter_sub();
+
+  $form->{saveasnew}      = 1;
+  $form->{closed}         = 0;
+  $form->{print_and_save} = 1;
+  map { delete $form->{$_} } qw(printed emailed queued);
+
+  # Let Lx-Office assign a new order number if the user hasn't changed the
+  # previous one. If it has been changed manually then use it as-is.
+  my $idx = $form->{type} =~ /_quotation$/ ? "quonumber" : "ordnumber";
+  if ($form->{saved_xyznumber} &&
+      ($form->{saved_xyznumber} eq $form->{$idx})) {
+    delete($form->{$idx});
+  }
+
+  &save;
+
+  &edit_e_mail;
+
+  $lxdebug->leave_sub();
+}
+
index a3ad9db..f1c8c2d 100644 (file)
@@ -241,8 +241,8 @@ $self->{subs} = {
   'delivery_customer_selection' => 'delivery_customer_selection',
   'display_form'                => 'display_form',
   'display_row'                 => 'display_row',
-  'e_mail'                      => 'e_mail',
   'edit_config'                 => 'edit_config',
+  'edit_e_mail'                 => 'edit_e_mail',
   'employee_selection_internal' => 'employee_selection_internal',
   'format_dates'                => 'format_dates',
   'gl_transaction'              => 'gl_transaction',
index 823eee1..50f9d30 100644 (file)
@@ -288,8 +288,8 @@ $self->{subs} = {
   'display'                     => 'display',
   'display_form'                => 'display_form',
   'display_row'                 => 'display_row',
-  'e_mail'                      => 'e_mail',
   'edit'                        => 'edit',
+  'edit_e_mail'                 => 'edit_e_mail',
   'employee_selection_internal' => 'employee_selection_internal',
   'form_footer'                 => 'form_footer',
   'form_header'                 => 'form_header',
index f7215ee..9ad8d6a 100644 (file)
@@ -176,7 +176,7 @@ $self->{subs} = {
   'delivery_customer_selection' => 'delivery_customer_selection',
   'display_form'                => 'display_form',
   'display_row'                 => 'display_row',
-  'e_mail'                      => 'e_mail',
+  'edit_e_mail'                 => 'edit_e_mail',
   'employee_selection_internal' => 'employee_selection_internal',
   'format_dates'                => 'format_dates',
   'invoicetotal'                => 'invoicetotal',
index c79f688..facca96 100644 (file)
@@ -253,8 +253,8 @@ $self->{subs} = {
   'display_row'                 => 'display_row',
   'dont_load_draft'             => 'dont_load_draft',
   'draft_action_dispatcher'     => 'draft_action_dispatcher',
-  'e_mail'                      => 'e_mail',
   'edit'                        => 'edit',
+  'edit_e_mail'                 => 'edit_e_mail',
   'employee_selection_internal' => 'employee_selection_internal',
   'form_footer'                 => 'form_footer',
   'form_header'                 => 'form_header',
index 502985d..6332f6f 100644 (file)
@@ -278,8 +278,8 @@ $self->{subs} = {
   'display_row'                 => 'display_row',
   'dont_load_draft'             => 'dont_load_draft',
   'draft_action_dispatcher'     => 'draft_action_dispatcher',
-  'e_mail'                      => 'e_mail',
   'edit'                        => 'edit',
+  'edit_e_mail'                 => 'edit_e_mail',
   'employee_selection_internal' => 'employee_selection_internal',
   'form_footer'                 => 'form_footer',
   'form_header'                 => 'form_header',
index 36e74f5..e700159 100644 (file)
@@ -288,6 +288,7 @@ $self->{subs} = {
   'display_row'                 => 'display_row',
   'e_mail'                      => 'e_mail',
   'edit'                        => 'edit',
+  'edit_e_mail'                 => 'edit_e_mail',
   'employee_selection_internal' => 'employee_selection_internal',
   'form_footer'                 => 'form_footer',
   'form_header'                 => 'form_header',