Old ineffective sql_trail superseded by new improved db_trail logging only calls...
[fa-stable.git] / sales / manage / recurrent_invoices.php
index fef2ddc06ec07e14f71e5be188b612856077fa24..036819b522cb9bbc72b44b5fef25358bab46b41b 100644 (file)
@@ -80,26 +80,21 @@ if ($Mode=='ADD_ITEM' || $Mode=='UPDATE_ITEM')
 
        if ($input_error != 1)
        {
+               write_recurrent_invoice($selected_id, $_POST['description'], $_POST['order_no'], input_num('debtor_no'), 
+                       input_num('group_no'), input_num('days', 0), input_num('monthly', 0), $_POST['begin'], $_POST['end'],
+                       get_post('last_sent',null));
+
        if ($selected_id != -1) 
-       {
-               update_recurrent_invoice($selected_id, $_POST['description'], $_POST['order_no'], input_num('debtor_no'), 
-                       input_num('group_no'), input_num('days', 0), input_num('monthly', 0), $_POST['begin'], $_POST['end']);
-               if (isset($_POST['last_sent'])) 
-                               update_last_sent_recurrent_invoice($selected_id, $_POST['last_sent']);
                        $note = _('Selected recurrent invoice has been updated');
-       } 
        else 
-       {
-               add_recurrent_invoice($_POST['description'], $_POST['order_no'], input_num('debtor_no'), input_num('group_no'),
-                       input_num('days', 0), input_num('monthly', 0), $_POST['begin'], $_POST['end']);
                        $note = _('New recurrent invoice has been added');
-       }
-    
+
                display_notification($note);
                $Mode = 'RESET';
        }
 } 
 
+
 if ($Mode == 'Delete')
 {