Item kit barcode review fixes (#3090)

This commit is contained in:
Jeroen Peelaerts
2021-02-08 21:52:49 +01:00
committed by jekkos
parent 6705e5f259
commit df45d8baf6
4 changed files with 4 additions and 7 deletions

View File

@@ -117,7 +117,6 @@ class Item_kits extends Secure_Controller
$item['item_id'] = $this->xss_clean($item_kit_item['item_id']);
$item['quantity'] = $this->xss_clean($item_kit_item['quantity']);
$items[] = $item;
}

View File

@@ -412,7 +412,7 @@ class Sales extends Secure_Controller
// Add kit item to order if one is assigned
$pieces = explode(' ', $item_id_or_number_or_item_kit_or_receipt);
$item_kit_id = (count($pieces) > 1) ? $pieces[1] : $item_id_or_number_or_item_kit_or_receipt;
$item_kit_id = (count($pieces) > 1) ? $pieces[1] : $item_id_or_number_or_item_kit_or_receipt;
$item_kit_info = $this->Item_kit->get_info($item_kit_id);
$kit_item_id = $item_kit_info->kit_item_id;
$kit_price_option = $item_kit_info->price_option;

View File

@@ -50,16 +50,15 @@ class Item_kit extends CI_Model
return FALSE;
}
$this->db->from('item_kits');
$this->db->where('item_kit_number', (string) $item_kit_number);
// check if $item_id is a number and not a string starting with 0
// because cases like 00012345 will be seen as a number where it is a barcode
if(ctype_digit($item_kit_id) && substr($item_kit_id, 0, 1) != '0')
if(ctype_digit($item_kit_id) && substr($item_kit_id, 0, 1) !== '0')
{
$this->db->where('item_kit_id !=', (int) $item_kit_id);
}
return ($this->db->get()->num_rows() >= 1);
return ($this->db->get('item_kits')->num_rows() >= 1);
}
/*

View File

@@ -133,7 +133,6 @@
'name'=>'print_option',
'type'=>'radio',
'value'=>1,
'value'=>1,
'checked'=>$item_kit_info->print_option == PRINT_PRICED)
); ?> <?php echo $this->lang->line('item_kits_priced_only'); ?>
</label>
@@ -296,7 +295,7 @@ $(document).ready(function()
name: "<?php echo $this->lang->line('items_name_required'); ?>",
category: "<?php echo $this->lang->line('items_category_required'); ?>",
item_kit_number: "<?php echo $this->lang->line('item_kits_item_number_duplicate'); ?>"
}
}
}, form_support.error));
});