From eb51b680aaa445baae6d22cebe708dde87a0e224 Mon Sep 17 00:00:00 2001 From: jekkos-t520 Date: Thu, 2 Oct 2014 23:26:29 +0200 Subject: [PATCH] Show stock location names in employee form --- .gitignore | 1 + application/config/constants.php | 4 ++++ application/libraries/Receiving_lib.php | 1 - application/libraries/Sale_lib.php | 1 - application/models/stock_locations.php | 1 - database/2.3_to_2.3.1.sql | 9 +++++++++ database/database.sql | 4 ++-- 7 files changed, 16 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 58bf03044..1ce5a940a 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ git-svn-diff.py *.swp *.rej *.orig +*~ diff --git a/application/config/constants.php b/application/config/constants.php index 4a879d360..17c81baa6 100644 --- a/application/config/constants.php +++ b/application/config/constants.php @@ -36,6 +36,10 @@ define('FOPEN_READ_WRITE_CREATE', 'a+b'); define('FOPEN_WRITE_CREATE_STRICT', 'xb'); define('FOPEN_READ_WRITE_CREATE_STRICT', 'x+b'); +/* + | Precision for calculations performed on decimals + */ +define("PRECISION", 3); /* End of file constants.php */ /* Location: ./application/config/constants.php */ \ No newline at end of file diff --git a/application/libraries/Receiving_lib.php b/application/libraries/Receiving_lib.php index 89b4270cc..ca9351abc 100644 --- a/application/libraries/Receiving_lib.php +++ b/application/libraries/Receiving_lib.php @@ -1,5 +1,4 @@ db->from('stock_locations'); - $this->db->where('deleted',0); $this->db->where('location_id',$location_id); return $this->db->get()->row()->location_name; } diff --git a/database/2.3_to_2.3.1.sql b/database/2.3_to_2.3.1.sql index 46375dbc2..c76c87580 100644 --- a/database/2.3_to_2.3.1.sql +++ b/database/2.3_to_2.3.1.sql @@ -22,3 +22,12 @@ INSERT INTO `ospos_permissions` (`module_id`, `person_id`) SELECT 'reports_sales -- add config options for tax inclusive sales INSERT INTO `ospos_app_config` (`key`, `value`) VALUES ('tax_included', '0'); + +-- add cascading deletes on modules +ALTER TABLE `ospos_permissions` DROP FOREIGN KEY `ospos_permissions_ibfk_1`; +ALTER TABLE `ospos_permissions` ADD CONSTRAINT `ospos_permissions_ibfk_1` FOREIGN KEY (`person_id`) REFERENCES `ospos`.`ospos_employee`(`person_id`) ON DELETE CASCADE ON UPDATE RESTRICT; + +ALTER TABLE `ospos_permissions` DROP FOREIGN KEY `ospos_permissions_ibfk_2`; +ALTER TABLE `ospos_permissions` ADD CONSTRAINT `ospos_permissions_ibfk_2` FOREIGN KEY (`module_id`) REFERENCES `ospos`.`ospos_modules`(`module_id`) ON DELETE CASCADE ON UPDATE RESTRICT; + + diff --git a/database/database.sql b/database/database.sql index c75b13601..025d542cc 100644 --- a/database/database.sql +++ b/database/database.sql @@ -675,8 +675,8 @@ ALTER TABLE `ospos_item_kit_items` -- Constraints for table `ospos_permissions` -- ALTER TABLE `ospos_permissions` - ADD CONSTRAINT `ospos_permissions_ibfk_1` FOREIGN KEY (`person_id`) REFERENCES `ospos_employees` (`person_id`), - ADD CONSTRAINT `ospos_permissions_ibfk_2` FOREIGN KEY (`module_id`) REFERENCES `ospos_modules` (`module_id`); + ADD CONSTRAINT `ospos_permissions_ibfk_1` FOREIGN KEY (`person_id`) REFERENCES `ospos_employees` (`person_id`) ON DELETE CASCADE, + ADD CONSTRAINT `ospos_permissions_ibfk_2` FOREIGN KEY (`module_id`) REFERENCES `ospos_modules` (`module_id`) ON DELETE CASCADE; -- -- Constraints for table `ospos_receivings`