From: Thomas Mudrunka Date: Wed, 11 Apr 2012 17:26:03 +0000 (+0200) Subject: Nova tabulka location = Referencni commit pro pridavani novejch tabulek do systemu X-Git-Url: https://git.harvie.cz/?a=commitdiff_plain;h=928bb5a6f34a0edb17af5d5a96fecd523473951a;p=mirrors%2FSokoMan.git Nova tabulka location = Referencni commit pro pridavani novejch tabulek do systemu --- diff --git a/index.php b/index.php index 74fcaba..768a184 100755 --- a/index.php +++ b/index.php @@ -267,7 +267,7 @@ EOF; if($count) $assistants[$item] = "assistant/$item"; } - $tables=array('item','model','category','producer','vendor','room','status'); + $tables=array('item','model','category','producer','vendor','room','status','location'); foreach($tables as $table) { $listable[$table] = $table; @@ -371,7 +371,11 @@ EOF; 'producer' => array('producer_id' => array(array('item',$where_url), array('model',$where_url))), 'vendor' => array('vendor_id' => array(array('item',$where_url))), 'room' => array('room_id' => array(array('item',$where_url))), - 'status' => array('status_id' => array(array('item',$where_url))) + 'status' => array('status_id' => array(array('item',$where_url))), + 'location' => array( + 'location_id' => array(array('item',$where_url)), + 'location_name' => array(array('smokeping','http://tartarus.brevnov.czf/cgi-bin/smokeping.cgi?filter=%v')) + ) ); $relations_conditions=array( 'in_stock' => 'return(@$table[$id]["status_name"] == "stored");', @@ -406,6 +410,7 @@ EOF; 'producer_id' => 'producer_name', 'vendor_id' => 'vendor_name', 'room_id' => 'room_name', + 'location_id' => 'location_name', 'status_id' => 'status_name', 'item_author' => 'item_author_backend', 'item_customer' => 'item_customer', @@ -446,7 +451,7 @@ EOF; function table_hide_columns(&$table, $class) { //TODO: Move to build_query_select() !!! :-))) $fields_hide = array( - 'item' => array('model_descript','model_price_in','model_price_out','model_barcode','model_countable','model_reserve','model_eshop_hide','room_descript','room_author','producer_name','producer_note','vendor_note') + 'item' => array('model_descript','model_price_in','model_price_out','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(); if(isset($fields_hide[$class])) foreach($table as $id => $row) { @@ -611,7 +616,7 @@ class Sklad_DB extends PDO { function build_query_select($class, $id=false, $limit=false, $offset=0, $where=false, $search=false, $history=false, $order=false, $suffix_id='_id') { //Configuration $join = array( - 'item' => array('model', 'category', 'producer', 'vendor', 'room', 'status'), + 'item' => array('model', 'category', 'producer', 'vendor', 'room', 'location', 'status'), 'model' => array('category', 'producer') ); //TODO Autodetect using foreign keys? $fields_search = array( diff --git a/install.sql b/install.sql index 3fcba29..9efd44a 100644 --- a/install.sql +++ b/install.sql @@ -65,6 +65,34 @@ INSERT INTO `group` VALUES (0,'default','rw'),(0,'name','admin'),(2,'name','empl /*!40000 ALTER TABLE `group` ENABLE KEYS */; UNLOCK TABLES; +-- +-- Table structure for table `location` +-- + +DROP TABLE IF EXISTS `location`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `location` ( + `location_id` int(11) NOT NULL AUTO_INCREMENT, + `location_name` varchar(23) COLLATE utf8_czech_ci NOT NULL, + `location_author` int(11) unsigned DEFAULT NULL, + `location_description` text COLLATE utf8_czech_ci, + PRIMARY KEY (`location_id`), + UNIQUE KEY `location_name` (`location_name`), + KEY `location_author` (`location_author`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `location` +-- + +LOCK TABLES `location` WRITE; +/*!40000 ALTER TABLE `location` DISABLE KEYS */; +INSERT INTO `location` VALUES (0,'UNIVERSE',14,'Tady je všechno co nikde neni :-)'); +/*!40000 ALTER TABLE `location` ENABLE KEYS */; +UNLOCK TABLES; + -- -- Table structure for table `producer` -- @@ -202,7 +230,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2012-04-11 13:48:54 +-- Dump completed on 2012-04-11 19:25:14 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -227,6 +255,7 @@ CREATE TABLE `item` ( `status_id` int(11) NOT NULL DEFAULT '1', `item_price_in` decimal(9,2) NOT NULL DEFAULT '0.00', `item_price_out` decimal(9,2) DEFAULT NULL, + `location_id` int(11) DEFAULT '0', `item_customer` int(11) DEFAULT NULL, `item_date_bought` date NOT NULL DEFAULT '0000-00-00', `item_date_sold` date DEFAULT '0000-00-00', @@ -240,6 +269,8 @@ CREATE TABLE `item` ( KEY `model_id` (`model_id`), KEY `status_id` (`status_id`), KEY `room_id` (`room_id`), + KEY `location_id` (`location_id`), + CONSTRAINT `item_ibfk_10` FOREIGN KEY (`location_id`) REFERENCES `location` (`location_id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `item_ibfk_6` FOREIGN KEY (`vendor_id`) REFERENCES `vendor` (`vendor_id`), CONSTRAINT `item_ibfk_7` FOREIGN KEY (`model_id`) REFERENCES `model` (`model_id`), CONSTRAINT `item_ibfk_8` FOREIGN KEY (`status_id`) REFERENCES `status` (`status_id`), diff --git a/locale/cs/messages.inc.php b/locale/cs/messages.inc.php index 6858cda..5f296c8 100644 --- a/locale/cs/messages.inc.php +++ b/locale/cs/messages.inc.php @@ -40,6 +40,11 @@ $LOCALE_MESSAGES = array( 'room_descript' => 'Popis skladu', 'room_author' => 'Skladník', + 'location_name' => 'Umístění', + 'location_description' => 'Popis umístění', + 'location_gps' => 'GPS Souřadnice', + 'location_author' => 'Střešník', + 'producer_name' => 'Výrobce', 'producer_note' => 'Poznámka o výrobci', @@ -55,6 +60,7 @@ $LOCALE_MESSAGES = array( 'vendor_relations' => 'Od tohoto dodavatele', 'room_relations' => 'V tomto skladu', 'status_relations' => 'V tomto stavu', + 'location_relations' => 'V tomto umístění', '_relations' => ' jinde', 'sale_profit' => 'Zisk z prodeje', @@ -66,6 +72,7 @@ $LOCALE_MESSAGES = array( 'status' => '[stav]', 'vendor' => '[dodavatel]', 'category' => '[kategorie]', + 'location' => '[umístění]', 'model' => '[model]', 'user' => '[uživatel]',