Multiinsert zakazany tam, kde neni zadouci
authorThomas Mudrunka <tomas@mudrunka.cz>
Tue, 25 Oct 2011 06:51:41 +0000 (08:51 +0200)
committerThomas Mudrunka <tomas@mudrunka.cz>
Tue, 25 Oct 2011 06:51:41 +0000 (08:51 +0200)
assistants/store.inc.php
index.php

index a4dcbe8b1b3eb6cf143386b825b4defebdf4a996..8dd245c48bdb4ea48b73e7dd9abf80df7919dc12 100644 (file)
@@ -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;
 }
index 479e75cf9ff0a43010091226ff8cc217e4510d97..6e834fe54d872186804285b6598b5b5fbc6f1ac3 100755 (executable)
--- a/index.php
+++ b/index.php
@@ -407,6 +407,7 @@ EOF;
                        } else $hr = '<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'),
This page took 0.13657 seconds and 4 git commands to generate.