Fixed php 5.3 function name conflict.
[fa-stable.git] / sales / manage / recurrent_invoices.php
index c432e201fc441415334a1b023dbadee768a0c5f5..cdbc3bfaa2dc33a048df928ee4a429597df7b35f 100644 (file)
@@ -1,8 +1,16 @@
 <?php
-
-
-$page_security = 3;
-$path_to_root="../..";
+/**********************************************************************
+    Copyright (C) FrontAccounting, LLC.
+       Released under the terms of the GNU General Public License, GPL, 
+       as published by the Free Software Foundation, either version 3 
+       of the License, or (at your option) any later version.
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+    See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
+***********************************************************************/
+$page_security = 'SA_SRECURRENT';
+$path_to_root = "../..";
 include($path_to_root . "/includes/session.inc");
 include($path_to_root . "/includes/ui.inc");
 
@@ -14,7 +22,6 @@ if ($use_date_picker)
 
 page(_("Recurrent Invoices"), false, false, "", $js);
 
-
 simple_page_mode(true);
 
 if ($Mode=='ADD_ITEM' || $Mode=='UPDATE_ITEM') 
@@ -38,8 +45,8 @@ if ($Mode=='ADD_ITEM' || $Mode=='UPDATE_ITEM')
                        order_no=".db_escape($_POST['order_no']).", 
                        debtor_no=".db_escape($_POST['debtor_no']).", 
                        group_no=".db_escape($_POST['group_no']).", 
-                       days=".input_num('days').", 
-                       monthly=".input_num('monthly').", 
+                       days=".input_num('days', 0).", 
+                       monthly=".input_num('monthly', 0).", 
                        begin='".date2sql($_POST['begin'])."', 
                        end='".date2sql($_POST['end'])."' 
                        WHERE id = '$selected_id'";
@@ -50,7 +57,7 @@ if ($Mode=='ADD_ITEM' || $Mode=='UPDATE_ITEM')
                $sql = "INSERT INTO ".TB_PREF."recurrent_invoices (description, order_no, debtor_no,
                        group_no, days, monthly, begin, end, last_sent) VALUES (".db_escape($_POST['description']) . ", "
                        .db_escape($_POST['order_no']).", ".db_escape($_POST['debtor_no']).", "
-                       .db_escape($_POST['group_no']).", ".input_num('days').", ".input_num('monthly').", '"
+                       .db_escape($_POST['group_no']).", ".input_num('days', 0).", ".input_num('monthly', 0).", '"
                        .date2sql($_POST['begin'])."', '".date2sql($_POST['end'])."', '".date2sql(Add_Years($_POST['begin'], -5))."')";
                        $note = _('New recurrent invoice has been added');
        }
@@ -107,7 +114,7 @@ while ($myrow = db_fetch($result))
        alt_table_row_color($k);
                
        label_cell($myrow["description"]);
-       label_cell(get_customer_trans_view_str(30, $myrow["order_no"]));
+       label_cell(get_customer_trans_view_str(ST_SALESORDER, $myrow["order_no"]));
        if ($myrow["debtor_no"] == 0)
        {
                label_cell("");
@@ -124,7 +131,7 @@ while ($myrow = db_fetch($result))
        label_cell($end);
        label_cell($last_sent);
        edit_button_cell("Edit".$myrow["id"], _("Edit"));
-       edit_button_cell("Delete".$myrow["id"], _("Delete"));
+       delete_button_cell("Delete".$myrow["id"], _("Delete"));
        end_row();
 }
 end_table();
@@ -136,7 +143,7 @@ echo '<br>';
 
 start_form();
 
-start_table("$table_style2 width=40%");
+start_table($table_style2);
 
 if ($selected_id != -1) 
 {
@@ -155,9 +162,9 @@ if ($selected_id != -1)
                $_POST['monthly']  = $myrow["monthly"];
                $_POST['begin']  = sql2date($myrow["begin"]);
                $_POST['end']  = sql2date($myrow["end"]);
-       }
+       } 
        hidden("selected_id", $selected_id);
-} 
+}
 
 
 text_row_ex(_("Description:"), 'description', 50); 
@@ -171,9 +178,9 @@ if ($_POST['debtor_no'] > 0)
 else   
        sales_groups_list_row(_("Sales Group:"), 'group_no', null, " ");
 
-small_amount_row(_("Days:"), 'days', null, null, null, 0);
+small_amount_row(_("Days:"), 'days', 0, null, null, 0);
 
-small_amount_row(_("Monthly:"), 'monthly', null, null, null, 0);
+small_amount_row(_("Monthly:"), 'monthly', 0, null, null, 0);
 
 date_row(_("Begin:"), 'begin');
 
@@ -181,7 +188,7 @@ date_row(_("End:"), 'end', null, null, 0, 0, 5);
 
 end_table(1);
 
-submit_add_or_update_center($selected_id == -1, '', true);
+submit_add_or_update_center($selected_id == -1, '', 'both');
 
 end_form();