Permalink
Browse files

Pridani pruvodci pro vyskladneni do firmy a vyskladneni k zakaznikovi…

…, upraveno .gitignore
  • Loading branch information...
1 parent 7bcd6b4 commit ec28d06c976780c7cba78aa7d85d8d8d06095df3 @Harvie committed Aug 19, 2011
Showing with 52 additions and 0 deletions.
  1. +1 −0 .gitignore
  2. +23 −0 assistants/dispose.inc.php
  3. +26 −0 assistants/sell.inc.php
  4. +2 −0 index.php
View
1 .gitignore
@@ -1,3 +1,4 @@
+_*
*.bak
*.conf.php
.svn
View
23 assistants/dispose.inc.php
@@ -0,0 +1,23 @@
+<?php
+$script = $_SERVER['SCRIPT_NAME'].'/assistant/dispose';
+switch($step) {
+ default: case 1:
+?>
+<form action="<?=$script?>/2" method="GET">
+ item_serial: <input type="text" name="serial" />
+ <input type="submit" value="DISPOSE" />
+</form>
+<?php
+ break;
+ case 2:
+ $item_id = $this->db->map_unique('item_serial', $_GET['serial'], 'item_id', 'item');
+ $columns = $this->db->get_columns('item');
+ $selectbox = $this->db->columns_get_selectbox($columns, 'item');
+
+ $current = $this->db->get_listing('item', $item_id, 1);
+ $current[$item_id]['status_id'] = 2;
+
+ $action = $_SERVER['SCRIPT_NAME']."/item/$item_id/edit";
+ echo $this->html->render_insert_form('item', $columns, $selectbox, $current, false, $action);
+ break;
+}
View
26 assistants/sell.inc.php
@@ -0,0 +1,26 @@
+<?php
+//TODO: Merge SELL and DISPOSE to single file with parameter!
+//TODO: Add support for selling/disposing multiple items at once...
+//TODO: Reuse /item/$item_id/edit
+$script = $_SERVER['SCRIPT_NAME'].'/assistant/sell';
+switch($step) {
+ default: case 1:
+?>
+<form action="<?=$script?>/2" method="GET">
+ item_serial: <input type="text" name="serial" />
+ <input type="submit" value="SELL" />
+</form>
+<?php
+ break;
+ case 2:
+ $item_id = $this->db->map_unique('item_serial', $_GET['serial'], 'item_id', 'item');
+ $columns = $this->db->get_columns('item');
+ $selectbox = $this->db->columns_get_selectbox($columns, 'item');
+
+ $current = $this->db->get_listing('item', $item_id, 1);
+ $current[$item_id]['status_id'] = 3;
+
+ $action = $_SERVER['SCRIPT_NAME']."/item/$item_id/edit";
+ echo $this->html->render_insert_form('item', $columns, $selectbox, $current, false, $action);
+ break;
+}
View
2 index.php
@@ -149,6 +149,8 @@ function header($title='') {
<li><a href="#">Assistants</a>
<menu>
<li><a href="$script/assistant/store">store</a></li>
+ <li><a href="$script/assistant/dispose">dispose</a></li>
+ <li><a href="$script/assistant/sell">sell</a></li>
<li>&darr;&darr; BETA &darr;&darr;</li>
<li><a href="$script/assistant/new-item">new-item</a></li>
</menu>

0 comments on commit ec28d06

Please sign in to comment.