Trivial errors in not set bank charge account, retained earnings or profit/loss year...
[fa-stable.git] / sales / manage / sales_points.php
index 6282cf7f6d5e5c2fc3ab2679338284d06bbaeb62..c76196e50d557926d8a0b0c1ebc034810a530474 100644 (file)
@@ -9,8 +9,8 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
     See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
 ***********************************************************************/
-$page_security = 15;
-$path_to_root="../..";
+$page_security = 'SA_POSSETUP';
+$path_to_root = "../..";
 include_once($path_to_root . "/includes/session.inc");
 
 page(_("POS settings"));
@@ -64,9 +64,15 @@ if ($Mode=='UPDATE_ITEM' && can_process())
 
 if ($Mode == 'Delete')
 {
-       delete_sales_point($selected_id);
-       display_notification(_('Selected point of sale has been deleted'));
-       $Mode = 'RESET';
+       $sql = "SELECT * FROM ".TB_PREF."users WHERE print_profile=".db_escape($selected_id);
+       $res = db_query($sql, "canot check pos usage");
+       if (db_num_rows($res)) {
+               display_error(_("Cannot delete this POS because it is used in users setup."));
+       } else {
+               delete_sales_point($selected_id);
+               display_notification(_('Selected point of sale has been deleted'));
+               $Mode = 'RESET';
+       }
 }
 
 if ($Mode == 'RESET')