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;
'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");',
'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',
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) {
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(
/*!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`
--
/*!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 */;
`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',
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`),
'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',
'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',
'status' => '[stav]',
'vendor' => '[dodavatel]',
'category' => '[kategorie]',
+ 'location' => '[umístění]',
'model' => '[model]',
'user' => '[uživatel]',