Oprava nekterych veci rozbitych pri prechodu na novy system carovych kodu
authorThomas Mudrunka <tomas@mudrunka.cz>
Wed, 25 Jul 2012 21:41:34 +0000 (23:41 +0200)
committerThomas Mudrunka <tomas@mudrunka.cz>
Wed, 25 Jul 2012 21:41:34 +0000 (23:41 +0200)
assistants/stats/reserve.inc.php
assistants/stats/stock.inc.php
index.php
install.sql

index b60ec2d5a4d5c2385ebffa82c15bc474aefd2e48..d8e92dbcbf35f4a1e565a45effb4b3ef8a52ce29 100644 (file)
@@ -1,14 +1,12 @@
 <?php
 $queries += array(
-/*
-       "Nakoupit: Došlo úplně (Urgent WishList)" //TODO: Reinvent
-               => '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'.
index 1cec846ed47eb4d7e572938fe4c2e942f479e95d..82eb2bc8579aabb65d5d2bfb35f2d7aa8771a255 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 $queries += array(
        "Ceník + Počet kusů skladem (PriceList + Stock)"
-               => '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'.
index b40fc8859596c4afedff1297e45a7f360d5779b8..ced77fb406f9bf3bbfdbe837fbc54ea802fc61f9 100755 (executable)
--- 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();
index c69ac1a0dd8ae00db4c3f07eb2341896a8886e75..aedb948ac65aefd1933219cd21b274053e29d632 100644 (file)
@@ -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 */;
 
This page took 0.165315 seconds and 4 git commands to generate.