[0002707] Added check for email uniqueness during password reset.
[fa-stable.git] / admin / gl_setup.php
index 997a2bda23fa0ef690efcee3523550427fdf9e17..aeae18d98da92513b120b824aa709182de6f4a49 100644 (file)
@@ -45,6 +45,20 @@ function can_process()
                set_focus('past_due_days');
                return false;
        }
+
+       $grn_act = get_company_pref('grn_clearing_act');
+       if ((get_post('grn_clearing_act') != $grn_act) && db_num_rows(get_grn_items(0, '', true)))
+       {
+               display_error(_("Before GRN Clearing Account can be changed all GRNs have to be invoiced"));
+               $_POST['grn_clearing_act'] = $grn_act;
+               set_focus('grn_clearing_account');
+               return false;
+       }
+       if (!is_account_balancesheet(get_post('retained_earnings_act')) || is_account_balancesheet(get_post('profit_loss_year_act')))
+       {
+               display_error(_("The Retained Earnings Account should be a Balance Account or the Profit and Loss Year Account should be an Expense Account (preferred the last one in the Expense Class)"));
+               return false;
+       }
        return true;
 }
 
@@ -58,7 +72,7 @@ if (isset($_POST['submit']) && can_process())
                'default_prompt_payment_act', 'default_inventory_act', 'default_cogs_act',
                'default_adj_act', 'default_inv_sales_act', 'default_assembly_act', 'legal_text',
                'past_due_days', 'default_workorder_required', 'default_dim_required',
-               'default_delivery_required',
+               'default_delivery_required', 'default_quote_valid_days', 'grn_clearing_act',
                'allow_negative_stock'=> 0, 'accumulate_shipping'=> 0,
                'po_over_receive' => 0.0, 'po_over_charge' => 0.0, 'default_credit_limit'=>0.0
 )));
@@ -75,6 +89,16 @@ start_outer_table(TABLESTYLE2);
 
 table_section(1);
 
+if (get_company_pref('grn_clearing_act') === null) { // available from 2.3.1, can be not defined on pre-2.4 installations
+       set_company_pref('grn_clearing_act', 'glsetup.purchase', 'varchar', 15, 0);
+       refresh_sys_prefs();
+}
+
+if (get_company_pref('default_quote_valid_days') === null) { // available from 2.3.23, can be not defined on pre-2.4 installations
+       set_company_pref('default_quote_valid_days', 'glsetup.sales', 'smallint', 6, 30);
+       refresh_sys_prefs();
+}
+
 $myrow = get_company_prefs();
 
 $_POST['retained_earnings_act']  = $myrow["retained_earnings_act"];
@@ -102,6 +126,8 @@ $_POST['po_over_receive'] = percent_format($myrow['po_over_receive']);
 $_POST['po_over_charge'] = percent_format($myrow['po_over_charge']);
 $_POST['past_due_days'] = $myrow['past_due_days'];
 
+$_POST['grn_clearing_act'] = $myrow['grn_clearing_act'];
+
 $_POST['default_credit_limit'] = $myrow['default_credit_limit'];
 $_POST['legal_text'] = $myrow['legal_text'];
 $_POST['accumulate_shipping'] = $myrow['accumulate_shipping'];
@@ -109,6 +135,7 @@ $_POST['accumulate_shipping'] = $myrow['accumulate_shipping'];
 $_POST['default_workorder_required'] = $myrow['default_workorder_required'];
 $_POST['default_dim_required'] = $myrow['default_dim_required'];
 $_POST['default_delivery_required'] = $myrow['default_delivery_required'];
+$_POST['default_quote_valid_days'] = $myrow['default_quote_valid_days'];
 
 //---------------
 
@@ -150,6 +177,8 @@ gl_all_accounts_list_row(_("Sales Discount Account:"), 'default_sales_discount_a
 
 gl_all_accounts_list_row(_("Prompt Payment Discount Account:"), 'default_prompt_payment_act');
 
+text_row(_("Quote Valid Days:"), 'default_quote_valid_days', $_POST['default_quote_valid_days'], 6, 6, '', "", _("days"));
+
 text_row(_("Delivery Required By:"), 'default_delivery_required', $_POST['default_delivery_required'], 6, 6, '', "", _("days"));
 
 //----------------
@@ -173,6 +202,8 @@ gl_all_accounts_list_row(_("Payable Account:"), 'creditors_act', $_POST['credito
 
 gl_all_accounts_list_row(_("Purchase Discount Account:"), 'pyt_discount_act', $_POST['pyt_discount_act']);
 
+gl_all_accounts_list_row(_("GRN Clearing Account:"), 'grn_clearing_act', get_post('grn_clearing_act'), true, false, _("No postings on GRN"));
+
 table_section_title(_("Inventory"));
 
 check_row(_("Allow Negative Inventory:"), 'allow_negative_stock', null);