From 79cc0871640b08bbe5c5e7b132e7bcc934d20823 Mon Sep 17 00:00:00 2001 From: Thomas Mudrunka Date: Wed, 11 Apr 2012 12:56:21 +0200 Subject: [PATCH] Do tabulky item pridany sloupecky s datem nakupu --- assistants/migrations.inc.php | 6 ++++++ install.sql | 4 +++- locale/cs/messages.inc.php | 2 ++ 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 assistants/migrations.inc.php diff --git a/assistants/migrations.inc.php b/assistants/migrations.inc.php new file mode 100644 index 0000000..95d3b86 --- /dev/null +++ b/assistants/migrations.inc.php @@ -0,0 +1,6 @@ +

populate column item_date_bought

db->safe_query_fetch('SELECT item_id,MIN(item_valid_from) AS item_valid_from FROM item GROUP BY item_id;'); +//print_r($data); +echo("START TRANSACTION;\n"); +foreach($data as $line) echo("UPDATE item SET item_date_bought='".$line['item_valid_from']."' WHERE item_id=".$line['item_id'].";\n"); +echo("COMMIT;\n"); diff --git a/install.sql b/install.sql index aff3558..6d991ec 100644 --- a/install.sql +++ b/install.sql @@ -202,7 +202,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2012-03-19 12:20:46 +-- Dump completed on 2012-04-11 12:55:35 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -228,6 +228,8 @@ CREATE TABLE `item` ( `item_price_in` decimal(9,2) NOT NULL DEFAULT '0.00', `item_price_out` decimal(9,2) DEFAULT NULL, `item_customer` int(11) DEFAULT NULL, + `item_date_bought` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `item_date_sold` timestamp NULL DEFAULT '0000-00-00 00:00:00', `item_note` varchar(512) COLLATE utf8_czech_ci DEFAULT NULL, `item_author` int(11) NOT NULL, `item_valid_till` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', diff --git a/locale/cs/messages.inc.php b/locale/cs/messages.inc.php index a5f05ea..1dbb7e7 100644 --- a/locale/cs/messages.inc.php +++ b/locale/cs/messages.inc.php @@ -17,6 +17,8 @@ $LOCALE_MESSAGES = array( 'item_price_in' => 'Nákupní cena', 'item_price_out' => 'Prodejní cena', 'item_customer' => 'Zákazník', + 'item_date_bought' => 'Koupeno', + 'item_date_sold' => 'Prodáno', 'item_note' => 'Poznámka k položce (umístění,...)', 'item_author' => 'Odpovědný', 'item_author_backend' => 'Odpovědný', -- 2.30.2