From: Thomas Mudrunka Date: Wed, 25 Jul 2012 21:41:34 +0000 (+0200) Subject: Oprava nekterych veci rozbitych pri prechodu na novy system carovych kodu X-Git-Url: http://git.harvie.cz/?p=mirrors%2FSokoMan.git;a=commitdiff_plain;h=7661315fc5e169b250fb080552d18050040d9108 Oprava nekterych veci rozbitych pri prechodu na novy system carovych kodu --- diff --git a/assistants/stats/reserve.inc.php b/assistants/stats/reserve.inc.php index b60ec2d..d8e92db 100644 --- a/assistants/stats/reserve.inc.php +++ b/assistants/stats/reserve.inc.php @@ -1,14 +1,12 @@ 'SELECT model_id,model_name,model_barcode,model_reserve,model_reserve as item_quantity_to_buy'. - ' FROM model'. + "Nakoupit: Došlo úplně (Urgent WishList)" + => 'SELECT model_id,model_name,barcode_name,model_reserve,model_reserve as item_quantity_to_buy'. + ' FROM model LEFT JOIN barcode USING(model_id)'. ' WHERE model_reserve>0 AND NOT EXISTS'. - ' (SELECT item_id FROM item WHERE model.model_id=item.model_id AND status_id=1 AND item_quantity>0 AND item_valid_till=0)', -*/ + ' (SELECT item_id FROM item WHERE barcode.barcode_id=item.barcode_id AND status_id=1 AND item_quantity>0 AND item_valid_till=0)', "Nakoupit: Dochází (WishList)" - => 'SELECT model_id,model_name,model_barcode,model_reserve,'. + => 'SELECT model_id,model_name,barcode_name,model_reserve,'. ' COUNT(item_id),SUM(item_quantity),model_reserve-SUM(item_quantity) as item_quantity_to_buy'. ' FROM item LEFT JOIN barcode USING(barcode_id) LEFT JOIN model USING(model_id)'. ' WHERE item_valid_till=0 AND status_id=1'. diff --git a/assistants/stats/stock.inc.php b/assistants/stats/stock.inc.php index 1cec846..82eb2bc 100644 --- a/assistants/stats/stock.inc.php +++ b/assistants/stats/stock.inc.php @@ -1,7 +1,7 @@ 'SELECT room_id,room_name,model_id,model_name,model_barcode,model_price_out,COUNT(item_id),SUM(item_quantity)'. + => 'SELECT room_id,room_name,model_id,model_name,barcode_name,model_price_out,COUNT(item_id),SUM(item_quantity)'. ' FROM item LEFT JOIN barcode USING(barcode_id) LEFT JOIN model USING(model_id) LEFT JOIN room USING(room_id)'. ' WHERE item_valid_till=0 AND status_id=1'. ' GROUP BY model_id,room_id'. diff --git a/index.php b/index.php index b40fc88..ced77fb 100755 --- a/index.php +++ b/index.php @@ -361,7 +361,7 @@ EOF; $relations = array( //TODO: Autodetect??? //TODO: Add [edit] link to all classes 'model' => array( 'model_id' => array(array('item',$where_url),array('barcode',$where_url),array('edit','model/%v/edit/'),array('barcode',$insert_url)), - //'model_barcode' => array(array('store','assistant/%d?barcode=%v')), + 'model_barcode' => array(array('store','assistant/%d?barcode=%v')), 'barcode_name' => array(array('store','assistant/%d?barcode=%v')), 'model_name' => array(array('google','http://google.com/search?q=%v')) //TODO: add manufacturer to google query ), @@ -458,8 +458,8 @@ EOF; function table_hide_columns(&$table, $class) { //TODO: Move to build_query_select() !!! :-))) $fields_hide = array( - 'model' => array('model_barcode','barcode_name'), - 'barcode' => array('model_barcode','model_price_in','model_price_out','model_reserve','producer_name','producer_note','model_eshop_hide','category_name','model_countable','model_descript'), + 'model' => array('barcode_name'), + 'barcode' => array('model_price_in','model_price_out','model_reserve','producer_name','producer_note','model_eshop_hide','category_name','model_countable','model_descript'), 'item' => array('model_descript','model_price_in','model_price_out','barcode_name','model_barcode','model_countable','model_reserve','model_eshop_hide','room_descript','room_author','producer_name','producer_note','vendor_note','location_author','location_gps','location_description') ); //print_r($table); die(); diff --git a/install.sql b/install.sql index c69ac1a..aedb948 100644 --- a/install.sql +++ b/install.sql @@ -230,7 +230,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2012-07-24 15:47:56 +-- Dump completed on 2012-07-25 23:41:18 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -273,7 +273,7 @@ CREATE TABLE `item` ( CONSTRAINT `item_ibfk_6` FOREIGN KEY (`vendor_id`) REFERENCES `vendor` (`vendor_id`), CONSTRAINT `item_ibfk_8` FOREIGN KEY (`status_id`) REFERENCES `status` (`status_id`), CONSTRAINT `item_ibfk_9` FOREIGN KEY (`room_id`) REFERENCES `room` (`room_id`) -) ENGINE=InnoDB AUTO_INCREMENT=46 DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci; +) ENGINE=InnoDB AUTO_INCREMENT=47 DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `model`; /*!40101 SET @saved_cs_client = @@character_set_client */; @@ -283,7 +283,6 @@ CREATE TABLE `model` ( `model_name` varchar(64) COLLATE utf8_czech_ci NOT NULL, `producer_id` int(11) NOT NULL DEFAULT '0', `category_id` int(11) NOT NULL DEFAULT '0', - `model_barcode` varchar(128) COLLATE utf8_czech_ci NOT NULL, `model_countable` int(1) NOT NULL DEFAULT '1', `model_price_in` decimal(9,2) DEFAULT NULL, `model_price_out` decimal(9,2) DEFAULT NULL, @@ -291,7 +290,6 @@ CREATE TABLE `model` ( `model_eshop_hide` int(1) unsigned NOT NULL DEFAULT '0', `model_descript` varchar(1024) COLLATE utf8_czech_ci NOT NULL, PRIMARY KEY (`model_id`), - UNIQUE KEY `model_barcode` (`model_barcode`), KEY `category_id` (`category_id`), KEY `producer_id` (`producer_id`), CONSTRAINT `model_ibfk_1` FOREIGN KEY (`category_id`) REFERENCES `category` (`category_id`), @@ -308,7 +306,7 @@ CREATE TABLE `barcode` ( PRIMARY KEY (`barcode_id`), KEY `model_id` (`model_id`), CONSTRAINT `barcode_ibfk_1` FOREIGN KEY (`model_id`) REFERENCES `model` (`model_id`) -) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci; +) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;