Bug 4817: g/l account inquiry can timeout due to slow sql. @Braath Waate.
[fa-stable.git] / admin / shipping_companies.php
index 9422d8464b461c395bf1ed42cd66962ac23ce93c..f83fad5a7ee521d90c6cc363e79bfbcba7418666 100644 (file)
@@ -53,7 +53,7 @@ if ($Mode == 'Delete')
 {
 // PREVENT DELETES IF DEPENDENT RECORDS IN 'sales_orders'
 
-       if (sales_orders_has_shipper($selected_id))
+       if (key_in_foreign_table($selected_id, 'sales_orders', 'ship_via'))
        {
                $cancel_delete = 1;
                display_error(_("Cannot delete this shipping company because sales orders have been created using this shipper."));
@@ -61,8 +61,7 @@ if ($Mode == 'Delete')
        else 
        {
                // PREVENT DELETES IF DEPENDENT RECORDS IN 'debtor_trans'
-
-               if (debtor_trans_has_shipper($selected_id))
+               if (key_in_foreign_table($selected_id, 'debtor_trans', 'ship_via'))
                {
                        $cancel_delete = 1;
                        display_error(_("Cannot delete this shipping company because invoices have been created using this shipping company."));
@@ -88,7 +87,7 @@ if ($Mode == 'RESET')
 $result = get_shippers(check_value('show_inactive'));
 
 start_form();
-start_table($table_style);
+start_table(TABLESTYLE);
 $th = array(_("Name"), _("Contact Person"), _("Phone Number"), _("Secondary Phone"), _("Address"), "", "");
 inactive_control_column($th);
 table_header($th);
@@ -114,7 +113,7 @@ end_table(1);
 
 //----------------------------------------------------------------------------------------------
 
-start_table($table_style2);
+start_table(TABLESTYLE2);
 
 if ($selected_id != -1) 
 {
@@ -148,4 +147,3 @@ submit_add_or_update_center($selected_id == -1, '', 'both');
 
 end_form();
 end_page();
-?>