+ if (key_in_foreign_table($selected_id, 'bom', 'loc_code'))
+ {
+ display_error(_("Cannot delete this location because it is used by some related records in other tables."));
+ return false;
+ }
+
+ if (key_in_foreign_table($selected_id, 'grn_batch', 'loc_code'))
+ {
+ display_error(_("Cannot delete this location because it is used by some related records in other tables."));
+ return false;
+ }
+ if (key_in_foreign_table($selected_id, 'purch_orders', 'into_stock_location'))
+ {
+ display_error(_("Cannot delete this location because it is used by some related records in other tables."));
+ return false;
+ }
+ if (key_in_foreign_table($selected_id, 'sales_orders', 'from_stk_loc'))
+ {
+ display_error(_("Cannot delete this location because it is used by some related records in other tables."));
+ return false;
+ }
+ if (key_in_foreign_table($selected_id, 'sales_pos', 'pos_location'))
+ {
+ display_error(_("Cannot delete this location because it is used by some related records in other tables."));
+ return false;
+ }