Leave item_number empty if Code39/128 is selected

Added Empty UPC checkbox in Items view to easily select empty items that need barcode code generation and in case of EAN8/13 fill in item_number
Added language for Empty UPC string
Indentation/spacing adjustment
This commit is contained in:
FrancescoUK
2015-09-15 17:49:51 +01:00
parent cf0276c772
commit 10ea821b2a
14 changed files with 64 additions and 36 deletions

View File

@@ -37,20 +37,21 @@ class Items extends Secure_area implements iData_controller
{
$search = $this->input->post('search');
$this->item_lib->set_item_location($this->input->post('stock_location'));
$stock_location=$this->item_lib->get_item_location();
$stock_location = $this->item_lib->get_item_location();
$data['search_section_state'] = $this->input->post('search_section_state');
$low_inventory=$this->input->post('low_inventory');
$is_serialized=$this->input->post('is_serialized');
$no_description=$this->input->post('no_description');
$search_custom=$this->input->post('search_custom');
$is_deleted=$this->input->post('is_deleted'); // Parq 131215
$empty_upc = $this->input->post('empty_upc');
$low_inventory = $this->input->post('low_inventory');
$is_serialized = $this->input->post('is_serialized');
$no_description = $this->input->post('no_description');
$search_custom = $this->input->post('search_custom');
$is_deleted = $this->input->post('is_deleted'); // Parq 131215
$limit_from = $this->input->post('limit_from');
$lines_per_page = $this->Appconfig->get('lines_per_page');
$items = $this->Item->search($search,$stock_location,$low_inventory,$is_serialized,$no_description,$search_custom,$is_deleted,$lines_per_page,$limit_from);
$data_rows=get_items_manage_table_data_rows($items,$this);
$total_rows = $this->Item->get_found_rows($search,$stock_location,$low_inventory,$is_serialized,$no_description,$search_custom,$is_deleted);
$items = $this->Item->search($search,$stock_location,$empty_upc,$low_inventory,$is_serialized,$no_description,$search_custom,$is_deleted,$lines_per_page,$limit_from);
$data_rows = get_items_manage_table_data_rows($items,$this);
$total_rows = $this->Item->get_found_rows($search,$stock_location,$empty_upc,$low_inventory,$is_serialized,$no_description,$search_custom,$is_deleted);
$links = $this->_initialize_pagination($this->Item, $lines_per_page, $limit_from, $total_rows, 'search');
$data_rows=get_items_manage_table_data_rows($items,$this);
$data_rows = get_items_manage_table_data_rows($items,$this);
$this->_remove_duplicate_cookies();
echo json_encode(array('total_rows' => $total_rows, 'rows' => $data_rows, 'pagination' => $links));
}
@@ -242,8 +243,7 @@ class Items extends Secure_area implements iData_controller
{
$quantity = $this->Item_quantities->get_item_quantity($item_id,$location['location_id'])->quantity;
$quantity = ($item_id == -1) ? null: $quantity;
$location_array[$location['location_id']] = array('location_name'=>$location['location_name'],
'quantity'=>$quantity);
$location_array[$location['location_id']] = array('location_name'=>$location['location_name'], 'quantity'=>$quantity);
$data['stock_locations']= $location_array;
}
$this->load->view("items/form",$data);
@@ -298,8 +298,8 @@ class Items extends Secure_area implements iData_controller
// check the list of items to see if any item_number field is empty
foreach($result as $item)
{
// update the UPC/EAN/ISBN field if empty with the newly generated barcode
if ($item['item_number'] == '')
// update the UPC/EAN/ISBN field if empty / null with the newly generated barcode
if ($item['item_number'] == '' || $item['item_number'] == null)
{
// get the newly generated barcode
$item['item_number'] = $this->barcode_lib->get_barcode($item, $config);
@@ -371,7 +371,7 @@ class Items extends Secure_area implements iData_controller
'allow_alt_description'=>$this->input->post('allow_alt_description'),
'is_serialized'=>$this->input->post('is_serialized'),
'deleted'=>$this->input->post('is_deleted'), /** Parq 131215 **/
'custom1'=>$this->input->post('custom1'), /**GARRISON ADDED 4/21/2013**/
'custom1'=>$this->input->post('custom1'),/**GARRISON ADDED 4/21/2013**/
'custom2'=>$this->input->post('custom2'),/**GARRISON ADDED 4/21/2013**/
'custom3'=>$this->input->post('custom3'),/**GARRISON ADDED 4/21/2013**/
'custom4'=>$this->input->post('custom4'),/**GARRISON ADDED 4/21/2013**/

View File

@@ -41,6 +41,7 @@ $lang["items_item"] = "Item";
$lang["items_item_number"] = "UPC/EAN/ISBN";
$lang["items_item_number_duplicate"] = "The item number is already present in the database";
$lang["items_location"] = "Location";
$lang["items_empty_upc_items"] = "Empty UPC Items";
$lang["items_low_inventory_items"] = "Out Of Stock Items";
$lang["items_manually_editing_of_quantity"] = "Manual Edit of Quantity";
$lang["items_must_select_item_for_barcode"] = "You must select at least 1 item to generate barcodes";

View File

@@ -41,6 +41,7 @@ $lang["items_item"] = "Artículo";
$lang["items_item_number"] = "UPC/EAN/ISBN";
$lang["items_item_number_duplicate"] = "El número de artículo ya esta presente en la base de datos";
$lang["items_location"] = "Ubicación";
$lang["items_empty_upc_items"] = "Empty UPC Items";
$lang["items_low_inventory_items"] = "Artículos de Inventario Escaso";
$lang["items_manually_editing_of_quantity"] = "Edición Manual de Cantidad";
$lang["items_must_select_item_for_barcode"] = "Debes seleccionar al menos 1 artículo para generar códigos de barras";

View File

@@ -41,6 +41,7 @@ $lang["items_item"] = "Item";
$lang["items_item_number"] = "UPC/EAN/ISBN";
$lang["items_item_number_duplicate"] = "The item number is already present in the database";
$lang["items_location"] = "Location";
$lang["items_empty_upc_items"] = "Empty UPC Items";
$lang["items_low_inventory_items"] = "Items à Stock Faible";
$lang["items_manually_editing_of_quantity"] = "Édition Manuelle de Quantité";
$lang["items_must_select_item_for_barcode"] = "Vous devez sélectionner au moins un item";

View File

@@ -41,6 +41,7 @@ $lang["items_item"] = "Item";
$lang["items_item_number"] = "Kode Barang";
$lang["items_item_number_duplicate"] = "The item number is already present in the database";
$lang["items_location"] = "Lokasi Barang";
$lang["items_empty_upc_items"] = "Empty UPC Items";
$lang["items_low_inventory_items"] = "Daftar Stock Rendah";
$lang["items_manually_editing_of_quantity"] = "Perubahan jumlah Stok secara manual";
$lang["items_must_select_item_for_barcode"] = "Anda harus memilih minimal 1 item untuk membuat barcode";

View File

@@ -41,6 +41,7 @@ $lang["items_item"] = "Product";
$lang["items_item_number"] = "UPC/EAN/ISBN";
$lang["items_item_number_duplicate"] = "De barcode nummer is reeds aanwezig in de database";
$lang["items_location"] = "Locatie";
$lang["items_empty_upc_items"] = "Empty UPC Items";
$lang["items_low_inventory_items"] = "Producten niet in stock";
$lang["items_manually_editing_of_quantity"] = "Manuele aanpassing hoeveelheid";
$lang["items_must_select_item_for_barcode"] = "U moet ten minste 1 product selecteren om een barcode te genereren";

View File

@@ -41,6 +41,7 @@ $lang["items_item"] = "Товар";
$lang["items_item_number"] = "UPC/EAN/ISBN";
$lang["items_item_number_duplicate"] = "The item number is already present in the database";
$lang["items_location"] = "место";
$lang["items_empty_upc_items"] = "Empty UPC Items";
$lang["items_low_inventory_items"] = "Низкий инвентаризации товары";
$lang["items_manually_editing_of_quantity"] = "Руководство Изменить количество";
$lang["items_must_select_item_for_barcode"] = "Вы должны выбрать хотя бы 1 товар для создания штрих-кодов";

View File

@@ -41,6 +41,7 @@ $lang["items_item"] = "สินค้า";
$lang["items_item_number"] = "โค๊ด";
$lang["items_item_number_duplicate"] = "The item number is already present in the database";
$lang["items_location"] = "ที่ตั้ง";
$lang["items_empty_upc_items"] = "Empty UPC Items";
$lang["items_low_inventory_items"] = "สินค้าคงเหลือน้อย";
$lang["items_manually_editing_of_quantity"] = "แก้ไขจำนวน";
$lang["items_must_select_item_for_barcode"] = "คุต้องเลือกสินค้าอย่างน้อยหนึ่งอย่างเพื่อจะสร้างบาร์โค๊ด";

View File

@@ -41,6 +41,7 @@ $lang["items_item"] = "Ürün";
$lang["items_item_number"] = "UPC/EAN/ISBN";
$lang["items_item_number_duplicate"] = "The item number is already present in the database";
$lang["items_location"] = "Yer";
$lang["items_empty_upc_items"] = "Empty UPC Items";
$lang["items_low_inventory_items"] = "";
$lang["items_manually_editing_of_quantity"] = "Elle adet düzeltme";
$lang["items_must_select_item_for_barcode"] = "Barkod üretmek için en az bir ürün seçmelisiniz";

View File

@@ -41,6 +41,7 @@ $lang["items_item"] = "產品";
$lang["items_item_number"] = "UPC/EAN/ISBN";
$lang["items_item_number_duplicate"] = "The item number is already present in the database";
$lang["items_location"] = "位置";
$lang["items_empty_upc_items"] = "Empty UPC Items";
$lang["items_low_inventory_items"] = "低庫存產品";
$lang["items_manually_editing_of_quantity"] = "手動編輯數量";
$lang["items_must_select_item_for_barcode"] = "您必須至少選擇一個產品生才能產生條碼";

View File

@@ -42,7 +42,7 @@ class Barcode_lib
return $data;
}
private function _get_barcode_instance($barcode_type)
private function get_barcode_instance($barcode_type)
{
switch($barcode_type)
{
@@ -69,7 +69,7 @@ class Barcode_lib
{
try
{
$barcode = $this->_get_barcode_instance($barcode_config['barcode_type']);
$barcode = $this->get_barcode_instance($barcode_config['barcode_type']);
$barcode_content = $barcode_config['barcode_content'] !== "id" && isset($item['item_number']) ? $item['item_number'] : $item['item_id'];
$barcode->setData($barcode_content);
@@ -90,12 +90,20 @@ class Barcode_lib
{
try
{
$barcode = $this->_get_barcode_instance($barcode_config['barcode_type']);
$barcode = $this->get_barcode_instance($barcode_config['barcode_type']);
$barcode_content = $barcode_config['barcode_content'] !== "id" && isset($item['item_number']) ? $item['item_number'] : $item['item_id'];
$barcode->setData($barcode_content);
return $barcode->getData();
$code = $barcode->getData();
// in case no new code is generated like in Code39 and Code128 return an empty string because we don't want to override it with a pure item_id
if( $code == $item['item_id'] )
{
$code = null;
}
return $code;
}
catch(Exception $e)
{

View File

@@ -7,13 +7,13 @@ class Item extends CI_Model
function exists($item_id)
{
$this->db->from('items');
$this->db->where('item_id',$item_id);
$this->db->where('item_id', $item_id);
$query = $this->db->get();
return ($query->num_rows()==1);
}
function item_number_exists($item_number,$item_id='')
function item_number_exists($item_number, $item_id='')
{
$this->db->from('items');
$this->db->where('item_number', $item_number);
@@ -32,7 +32,7 @@ class Item extends CI_Model
return $this->db->count_all_results();
}
function get_found_rows($search,$stock_location_id=-1,$low_inventory=0,$is_serialized=0,$no_description=0,$search_custom=0,$is_deleted=0)
function get_found_rows($search, $stock_location_id=-1, $empty_upc=0, $low_inventory=0, $is_serialized=0, $no_description=0, $search_custom=0, $is_deleted=0)
{
$this->db->from("items");
$this->db->join('suppliers', 'suppliers.person_id = items.supplier_id', 'left');
@@ -66,17 +66,21 @@ class Item extends CI_Model
}
}
$this->db->where('items.deleted', $is_deleted);
if ($low_inventory !=0 )
if ($empty_upc !=0)
{
$this->db->where('item_number', null);
}
if ($low_inventory !=0)
{
$this->db->where('quantity <=', 'reorder_level');
}
if ($is_serialized !=0 )
if ($is_serialized !=0)
{
$this->db->where('is_serialized', 1);
}
if ($no_description!=0 )
if ($no_description!=0)
{
$this->db->where('items.description','');
$this->db->where('items.description', '');
}
return $this->db->get()->num_rows();
}
@@ -110,7 +114,7 @@ class Item extends CI_Model
$this->db->select('suppliers.company_name');
$this->db->from('items');
$this->db->join('suppliers', 'suppliers.person_id = items.supplier_id', 'left');
$this->db->where('item_id',$item_id);
$this->db->where('item_id', $item_id);
$query = $this->db->get();
@@ -142,8 +146,8 @@ class Item extends CI_Model
{
$this->db->from('items');
$this->db->join('suppliers', 'suppliers.person_id = items.supplier_id', 'left');
$this->db->where('item_number',$item_number);
$this->db->where('items.deleted',0); // Parq 131226
$this->db->where('item_number', $item_number);
$this->db->where('items.deleted', 0); // Parq 131226
$query = $this->db->get();
@@ -611,14 +615,14 @@ class Item extends CI_Model
/*
Persform a search on items
*/
function search($search,$stock_location_id=-1,$low_inventory=0,$is_serialized=0,$no_description=0,$search_custom=0,$deleted=0,$rows = 0,$limit_from = 0)
function search($search, $stock_location_id=-1, $empty_upc=0, $low_inventory=0, $is_serialized=0, $no_description=0, $search_custom=0, $deleted=0, $rows = 0, $limit_from = 0)
{
$this->db->from("items");
$this->db->join('suppliers', 'suppliers.person_id = items.supplier_id', 'left');
if ($stock_location_id > -1)
{
$this->db->join('item_quantities','item_quantities.item_id=items.item_id');
$this->db->where('location_id',$stock_location_id);
$this->db->join('item_quantities', 'item_quantities.item_id=items.item_id');
$this->db->where('location_id', $stock_location_id);
}
if (!empty($search))
{
@@ -645,17 +649,21 @@ class Item extends CI_Model
}
}
$this->db->where('items.deleted', $deleted);
if ($low_inventory !=0 )
if ($empty_upc !=0)
{
$this->db->where('item_number', null);
}
if ($low_inventory !=0)
{
$this->db->where('quantity <=', 'reorder_level');
}
if ($is_serialized !=0 )
if ($is_serialized !=0)
{
$this->db->where('is_serialized', 1);
}
if ($no_description!=0 )
if ($no_description!=0)
{
$this->db->where('items.description','');
$this->db->where('items.description', '');
}
$this->db->order_by('items.name', "asc");
if ($rows > 0) {

View File

@@ -153,6 +153,8 @@ function show_hide_search_filter(search_filter_section, switchImgTag) {
</div>
<?php echo form_open("$controller_name/search",array('id'=>'search_form')); ?>
<div id="search_filter_section" style="display: <?php echo isset($search_section_state)? ( ($search_section_state)? 'block' : 'none') : 'none';?>;background-color:#EEEEEE;">
<?php echo form_label($this->lang->line('items_empty_upc_items').' '.':', 'empty_upc');?>
<?php echo form_checkbox(array('name'=>'empty_upc','id'=>'empty_upc','value'=>1,'checked'=> isset($empty_upc)? ( ($empty_upc)? 1 : 0) : 0)).' | ';?>
<?php echo form_label($this->lang->line('items_low_inventory_items').' '.':', 'low_inventory');?>
<?php echo form_checkbox(array('name'=>'low_inventory','id'=>'low_inventory','value'=>1,'checked'=> isset($low_inventory)? ( ($low_inventory)? 1 : 0) : 0)).' | ';?>
<?php echo form_label($this->lang->line('items_serialized_items').' '.':', 'is_serialized');?>

View File

@@ -40,6 +40,7 @@ items_item,Product,Artículo,Item,Item,產品,Товар,สินค้า,Ür
items_item_number,UPC/EAN/ISBN,UPC/EAN/ISBN,UPC/EAN/ISBN,UPC/EAN/ISBN,UPC/EAN/ISBN,UPC/EAN/ISBN,โค๊ด,UPC/EAN/ISBN,Kode Barang
items_item_number_duplicate,De barcode nummer is reeds aanwezig in de database,El número de artículo ya esta presente en la base de datos,The item number is already present in the database,The item number is already present in the database,The item number is already present in the database,The item number is already present in the database,The item number is already present in the database,The item number is already present in the database,The item number is already present in the database
items_location,Locatie,Ubicación,Location,Location,位置,место,ที่ตั้ง,Yer,Lokasi Barang
items_empty_upc_items,Empty UPC Items,Empty UPC Items,Empty UPC Items,Empty UPC Items,Empty UPC Items,Empty UPC Items,Empty UPC Items,Empty UPC Items,Empty UPC Items
items_low_inventory_items,Producten niet in stock,Artículos de Inventario Escaso,Out Of Stock Items,Items à Stock Faible,低庫存產品,Низкий инвентаризации товары,สินค้าคงเหลือน้อย,,Daftar Stock Rendah
items_manually_editing_of_quantity,Manuele aanpassing hoeveelheid,Edición Manual de Cantidad,Manual Edit of Quantity,Édition Manuelle de Quantité,手動編輯數量,Руководство Изменить количество,แก้ไขจำนวน,Elle adet düzeltme,Perubahan jumlah Stok secara manual
items_must_select_item_for_barcode,U moet ten minste 1 product selecteren om een barcode te genereren,Debes seleccionar al menos 1 artículo para generar códigos de barras,You must select at least 1 item to generate barcodes,Vous devez sélectionner au moins un item,您必須至少選擇一個產品生才能產生條碼,Вы должны выбрать хотя бы 1 товар для создания штрих-кодов,คุต้องเลือกสินค้าอย่างน้อยหนึ่งอย่างเพื่อจะสร้างบาร์โค๊ด,Barkod üretmek için en az bir ürün seçmelisiniz,Anda harus memilih minimal 1 item untuk membuat barcode
1 label nl-BE es en fr zh ru th tr id
40 items_item_number UPC/EAN/ISBN UPC/EAN/ISBN UPC/EAN/ISBN UPC/EAN/ISBN UPC/EAN/ISBN UPC/EAN/ISBN โค๊ด UPC/EAN/ISBN Kode Barang
41 items_item_number_duplicate De barcode nummer is reeds aanwezig in de database El número de artículo ya esta presente en la base de datos The item number is already present in the database The item number is already present in the database The item number is already present in the database The item number is already present in the database The item number is already present in the database The item number is already present in the database The item number is already present in the database
42 items_location Locatie Ubicación Location Location 位置 место ที่ตั้ง Yer Lokasi Barang
43 items_empty_upc_items Empty UPC Items Empty UPC Items Empty UPC Items Empty UPC Items Empty UPC Items Empty UPC Items Empty UPC Items Empty UPC Items Empty UPC Items
44 items_low_inventory_items Producten niet in stock Artículos de Inventario Escaso Out Of Stock Items Items à Stock Faible 低庫存產品 Низкий инвентаризации товары สินค้าคงเหลือน้อย Daftar Stock Rendah
45 items_manually_editing_of_quantity Manuele aanpassing hoeveelheid Edición Manual de Cantidad Manual Edit of Quantity Édition Manuelle de Quantité 手動編輯數量 Руководство Изменить количество แก้ไขจำนวน Elle adet düzeltme Perubahan jumlah Stok secara manual
46 items_must_select_item_for_barcode U moet ten minste 1 product selecteren om een barcode te genereren Debes seleccionar al menos 1 artículo para generar códigos de barras You must select at least 1 item to generate barcodes Vous devez sélectionner au moins un item 您必須至少選擇一個產品生才能產生條碼 Вы должны выбрать хотя бы 1 товар для создания штрих-кодов คุต้องเลือกสินค้าอย่างน้อยหนึ่งอย่างเพื่อจะสร้างบาร์โค๊ด Barkod üretmek için en az bir ürün seçmelisiniz Anda harus memilih minimal 1 item untuk membuat barcode