From f5baa075b591dfe92e9516aa55ec0daac9957d1d Mon Sep 17 00:00:00 2001 From: Thomas Mudrunka Date: Tue, 25 Oct 2011 08:51:41 +0200 Subject: [PATCH] Multiinsert zakazany tam, kde neni zadouci --- assistants/store.inc.php | 4 +++- index.php | 7 ++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/assistants/store.inc.php b/assistants/store.inc.php index a4dcbe8..8dd245c 100644 --- a/assistants/store.inc.php +++ b/assistants/store.inc.php @@ -17,11 +17,13 @@ switch($SUBPATH[0]) { $disable_cols = array('status_id','item_price_out','item_customer', 'model_id','item_quantity'); if($this->db->map_unique('model_barcode', $_GET['barcode'], 'model_countable', 'model')) { + $multi_insert = true; //$disable_cols[] = 'item_quantity'; $item_serial = ''; $item_quantity = $quantity_added = 1; $action = $_SERVER['SCRIPT_NAME'].'/item/new'; } else { + $multi_insert = false; $quantity_added = $_GET['quantity']; if($quantity_added <= 0) $this->post_redirect_get("$URL_INTERNAL/1","Can't store non-possitive amount of items!"); if(!is_numeric($quantity_added)) $quantity_added = 1; @@ -50,6 +52,6 @@ switch($SUBPATH[0]) { 'item_author' => $this->db->auth->get_user_id() )); - echo $this->html->render_insert_form('item', $columns, $selectbox, $current, $disable_cols, $action); + echo $this->html->render_insert_form('item', $columns, $selectbox, $current, $disable_cols, $action, $multi_insert); break; } diff --git a/index.php b/index.php index 479e75c..6e834fe 100755 --- a/index.php +++ b/index.php @@ -407,6 +407,7 @@ EOF; } else $hr = '
'; //$args[] = false; $args[] = $parts; + $html .= call_user_func_array(array($this, 'render_insert_form'), $args); $html .= $hr; } @@ -733,11 +734,11 @@ class Sklad_UI { return $this->html->render_insert_form($class, $columns, $selectbox); } - function render_form_edit($class, $id) { + function render_form_edit($class, $id, $multi_insert) { $columns = $this->db->get_columns($class); $selectbox = $this->db->columns_get_selectbox($columns, $class); $current = $this->db->get_listing($class, $id, 1); - return $this->html->render_insert_form($class, $columns, $selectbox, $current); + return $this->html->render_insert_form($class, $columns, $selectbox, $current, false, false, $multi_insert); } function render_single_record_details($class, $id) { @@ -776,7 +777,7 @@ class Sklad_UI { $html.=$this->render_listing_navigation($class, '*', $limit, $offset); } if($edit) { - $html.= $this->render_form_edit($class, $id); + $html.= $this->render_form_edit($class, $id, false); $action = $_SERVER['SCRIPT_NAME']."/$class/$id/delete"; $html.=$this->html->form($action,'POST',array( array(false,'DELETE','submit'), -- 2.30.2