X-Git-Url: https://git.harvie.cz/?a=blobdiff_plain;f=assistants%2Fsell.inc.php;h=268f88f54db304bfd312fa688b60755d9524301e;hb=f94aa899b883c5d3218699245c0d75965d1d98fb;hp=ecdd3c6ce26603c3ed0fb6d8cd20db8f898b0be4;hpb=51630db6070ae1482106b1872d62f38c82b835d4;p=mirrors%2FSokoMan.git diff --git a/assistants/sell.inc.php b/assistants/sell.inc.php index ecdd3c6..268f88f 100644 --- a/assistants/sell.inc.php +++ b/assistants/sell.inc.php @@ -29,7 +29,8 @@ switch($SUBPATH[0]) { $current[$item_id]['item_author'] = $this->db->auth->get_user_id(); $forked_item = $current; - $model_id = $this->db->map_unique('item_serial', $item_serial, 'model_id', 'item'); + $barcode_id = $this->db->map_unique('item_id', $item_id, 'barcode_id', 'item'); + $model_id = $this->db->map_unique('barcode_id', $barcode_id, 'model_id', 'barcode'); $model_price_in = $this->db->map_unique('model_id', $model_id, 'model_price_in', 'model'); $model_price_out = $this->db->map_unique('model_id', $model_id, 'model_price_out', 'model'); @@ -49,6 +50,7 @@ switch($SUBPATH[0]) { $quantity_stored = $this->db->map_unique('item_serial', $item_serial, 'item_quantity', 'item', false); if(!is_numeric($quantity_stored)) $quantity_stored = 0; $item_quantity = $quantity_stored - $quantity_removed; + if($item_quantity < 0) $this->post_redirect_get("$URL_INTERNAL/1","You don't have enough stored items!"); echo("Stock: ".$quantity_stored."
Disposing/Selling: ".$quantity_removed."
Keeping: ".$item_quantity);