[0000806] Branches were repeated in Customer Branches table when more than one genera...
[fa-stable.git] / sales / manage / recurrent_invoices.php
index a595815e0a10558350c8550e7bc135a1720d0af6..836fcab0b1934b5b5f1fc028ca9773ddd56a59bc 100644 (file)
@@ -41,13 +41,13 @@ if ($Mode=='ADD_ITEM' || $Mode=='UPDATE_ITEM')
        {
        if ($selected_id != -1) 
        {
-               update_recurrent_invoice($selected_id, $_POST['description'], $_POST['order_no'], $_POST['debtor_no']
-                       $_POST['group_no'], input_num('days', 0), input_num('monthly', 0), $_POST['begin'], $_POST['end']);
+               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']);
                        $note = _('Selected recurrent invoice has been updated');
        } 
        else 
        {
-               add_recurrent_invoice($_POST['description'], $_POST['order_no'], $_POST['debtor_no'], $_POST['group_no'],
+               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');
        }
@@ -89,7 +89,7 @@ while ($myrow = db_fetch($result))
 {
        $begin = sql2date($myrow["begin"]);
        $end = sql2date($myrow["end"]);
-       $last_sent = sql2date($myrow["last_sent"]);
+       $last_sent = $myrow["last_sent"] == '0000-00-00' ? '' : sql2date($myrow["last_sent"]);
        
        alt_table_row_color($k);