From d208e6dccb276e0a5722f7487069b30ee850b6fe Mon Sep 17 00:00:00 2001 From: jekkos-t520 Date: Tue, 10 Feb 2015 10:56:37 +0100 Subject: [PATCH] set menubar font sizes to px instead of pt add item_number duplication check when adding new items fix barcode on receivings receipt (after completion) change backup db download format to gz --- application/controllers/config.php | 6 +- application/controllers/items.php | 325 ++++++++++--------- application/controllers/receivings.php | 2 +- application/controllers/secure_area.php | 5 + application/language/en/items_lang.php | 1 + application/language/es/items_lang.php | 5 +- application/language/fr/items_lang.php | 5 +- application/language/id/items_lang.php | 5 +- application/language/nl-BE/items_lang.php | 3 +- application/language/ru/items_lang.php | 5 +- application/language/th/items_lang.php | 3 +- application/language/tr/items_lang.php | 3 +- application/language/zh/items_lang.php | 5 +- application/libraries/MY_Form_validation.php | 22 ++ application/views/items/form.php | 17 +- application/views/partial/header.php | 4 +- css/menubar.css | 8 +- js/common.js | 28 +- translations/items_lang.csv | 5 +- 19 files changed, 261 insertions(+), 196 deletions(-) create mode 100755 application/libraries/MY_Form_validation.php diff --git a/application/controllers/config.php b/application/controllers/config.php index 152c46236..92bff75b1 100644 --- a/application/controllers/config.php +++ b/application/controllers/config.php @@ -133,13 +133,13 @@ class Config extends Secure_area { $this->load->dbutil(); $prefs = array( - 'format' => 'zip', + 'format' => 'gzip', 'filename' => 'ospos.sql' ); - $backup =& $this->dbutil->backup($prefs); + $backup = $this->dbutil->backup($prefs); - $file_name = 'ospos-' . date("Y-m-d-H-i-s") .'.zip'; + $file_name = 'ospos-' . date("Y-m-d-H-i-s") .'.gz'; $save = 'uploads/'.$file_name; $this->load->helper('file'); diff --git a/application/controllers/items.php b/application/controllers/items.php index b8a5c813e..a9be7eb3a 100644 --- a/application/controllers/items.php +++ b/application/controllers/items.php @@ -365,8 +365,9 @@ class Items extends Secure_area implements iData_controller $employee_id=$this->Employee->get_logged_in_employee_info()->person_id; $cur_item_info = $this->Item->get_info($item_id); - - if($this->Item->save($item_data,$item_id)) + + $validated = $this->validate_item() || $item_id != -1; + if($validated && $this->Item->save($item_data,$item_id)) { $success = TRUE; $new_item = FALSE; @@ -432,12 +433,32 @@ class Items extends Secure_area implements iData_controller } else//failure { - echo json_encode(array('success'=>false,'message'=>$this->lang->line('items_error_adding_updating').' '. - $item_data['name'],'item_id'=>-1)); + $error_messages = $this->form_validation->get_error_messages(); + echo json_encode(array('success'=>false, + 'error_messages'=>$error_messages, + 'message'=>$this->lang->line('items_error_adding_updating').' ' + .$item_data['name'],'item_id'=>-1)); } } + function validate_item() + { + $this->load->library('form_validation'); + $this->form_validation->set_rules('item_number', 'lang:items_item_number', 'callback_item_number_check'); + return $this->form_validation->run(); + } + + function item_number_check($item_number) + { + if ($this->Item->get_item_id($item_number) != FALSE) + { + $this->form_validation->set_message('item_number_check', $this->lang->line('items_item_number_exists')); + return FALSE; + } + return TRUE; + } + function _handle_image_upload() { $this->load->helper('directory'); @@ -506,7 +527,7 @@ class Items extends Secure_area implements iData_controller { $item_data["$key"]=$value == '' ? null : $value; } - elseif($value!='' and !(in_array($key, array('item_ids', 'tax_names', 'tax_percents')))) + elseif($value!='' and !(in_array($key, array('item_ids', 'tax_names', 'tax_percents', 'category')))) { $item_data["$key"]=$value; } @@ -562,153 +583,153 @@ class Items extends Secure_area implements iData_controller $this->load->view("items/excel_import", null); } - function do_excel_import() - { - $msg = 'do_excel_import'; - $failCodes = array(); - if ($_FILES['file_path']['error']!=UPLOAD_ERR_OK) + function do_excel_import() + { + $msg = 'do_excel_import'; + $failCodes = array(); + if ($_FILES['file_path']['error']!=UPLOAD_ERR_OK) + { + $msg = $this->lang->line('items_excel_import_failed'); + echo json_encode( array('success'=>false,'message'=>$msg) ); + return; + } + else { - $msg = $this->lang->line('items_excel_import_failed'); - echo json_encode( array('success'=>false,'message'=>$msg) ); - return; - } - else - { - if (($handle = fopen($_FILES['file_path']['tmp_name'], "r")) !== FALSE) - { - //Skip first row - fgetcsv($handle); - - $i=1; - while (($data = fgetcsv($handle)) !== FALSE) - { - - $item_data = array( - 'name' => $data[1], - 'description' => $data[11], - 'category' => $data[2], - 'cost_price' => $data[4], - 'unit_price' => $data[5], - 'reorder_level' => $data[10], - 'supplier_id' => $this->Supplier->exists($data[3]) ? $data[3] : null, - 'allow_alt_description' => $data[12] != '' ? '1' : '0', - 'is_serialized' => $data[13] != '' ? '1' : '0', - 'custom1' => $data[14], /** GARRISON ADDED 5/6/2013 **/ - 'custom2' => $data[15], /** GARRISON ADDED 5/6/2013 **/ - 'custom3' => $data[16], /** GARRISON ADDED 5/6/2013 **/ - 'custom4' => $data[17], /** GARRISON ADDED 5/6/2013 **/ - 'custom5' => $data[18], /** GARRISON ADDED 5/6/2013 **/ - 'custom6' => $data[19], /** GARRISON ADDED 5/6/2013 **/ - 'custom7' => $data[20], /** GARRISON ADDED 5/6/2013 **/ - 'custom8' => $data[21], /** GARRISON ADDED 5/6/2013 **/ - 'custom9' => $data[22], /** GARRISON ADDED 5/6/2013 **/ - 'custom10' => $data[23] /** GARRISON ADDED 5/6/2013 **/ - ); - $item_number = $data[0]; - - if ($item_number != "") - { - $item_data['item_number'] = $item_number; - } - - if($this->Item->save($item_data)) - { - $items_taxes_data = null; - //tax 1 - if( is_numeric($data[7]) && $data[6]!='' ) - { - $items_taxes_data[] = array('name'=>$data[6], 'percent'=>$data[7] ); - } + if (($handle = fopen($_FILES['file_path']['tmp_name'], "r")) !== FALSE) + { + //Skip first row + fgetcsv($handle); - //tax 2 - if( is_numeric($data[9]) && $data[8]!='' ) - { - $items_taxes_data[] = array('name'=>$data[8], 'percent'=>$data[9] ); - } + $i=1; + while (($data = fgetcsv($handle)) !== FALSE) + { - // save tax values - if(count($items_taxes_data) > 0) - { - $this->Item_taxes->save($items_taxes_data, $item_data['item_id']); - } - - // quantities & inventory Info - $employee_id=$this->Employee->get_logged_in_employee_info()->person_id; - $emp_info=$this->Employee->get_info($employee_id); - $comment ='Qty CSV Imported'; - - $cols = count($data); - - // array to store information if location got a quantity - $quantity_added_to_location = array(); - foreach($this->Stock_locations->get_location_ids_as_array() as $loction_id) - { - $quantity_added_to_location[$location_id] = false; - } - for ($col = 24; $col < $cols; $col = $col + 2) - { - $item_quantity_data = array( - 'item_id' => $item_data['item_id'], - 'location_id' => $data[$col], - 'quantity' => $data[$col + 1], - ); - $this->Item_quantities->save($item_quantity_data, $item_data['item_id'], $data[$col]); - - $excel_data = array - ( - 'trans_items'=>$item_data['item_id'], - 'trans_user'=>$employee_id, - 'trans_comment'=>$comment, - 'trans_location'=>$data[$col], - 'trans_inventory'=>$data[$col + 1] - ); - $this->db->insert('inventory',$excel_data); + $item_data = array( + 'name' => $data[1], + 'description' => $data[11], + 'category' => $data[2], + 'cost_price' => $data[4], + 'unit_price' => $data[5], + 'reorder_level' => $data[10], + 'supplier_id' => $this->Supplier->exists($data[3]) ? $data[3] : null, + 'allow_alt_description' => $data[12] != '' ? '1' : '0', + 'is_serialized' => $data[13] != '' ? '1' : '0', + 'custom1' => $data[14], /** GARRISON ADDED 5/6/2013 **/ + 'custom2' => $data[15], /** GARRISON ADDED 5/6/2013 **/ + 'custom3' => $data[16], /** GARRISON ADDED 5/6/2013 **/ + 'custom4' => $data[17], /** GARRISON ADDED 5/6/2013 **/ + 'custom5' => $data[18], /** GARRISON ADDED 5/6/2013 **/ + 'custom6' => $data[19], /** GARRISON ADDED 5/6/2013 **/ + 'custom7' => $data[20], /** GARRISON ADDED 5/6/2013 **/ + 'custom8' => $data[21], /** GARRISON ADDED 5/6/2013 **/ + 'custom9' => $data[22], /** GARRISON ADDED 5/6/2013 **/ + 'custom10' => $data[23] /** GARRISON ADDED 5/6/2013 **/ + ); + $item_number = $data[0]; - $quantity_added_to_location[$data[$col]] = true; - } + if ($item_number != "") + { + $item_data['item_number'] = $item_number; + } - /* - * now iterate through the array and check for which location_id no entry into item_quantities was made yet - * those get an entry with quantity as 0. - * unfortunately a bit duplicate code from above... - */ - foreach($quantity_added_to_location as $location_id => $added) - { - if($added === false) - { - $item_quantity_data = array( - 'item_id' => $item_data['item_id'], - 'location_id' => $location_id, - 'quantity' => 0, - ); - $this->Item_quantities->save($item_quantity_data, $item_data['item_id'], $data[$col]); - - $excel_data = array - ( - 'trans_items'=>$item_data['item_id'], - 'trans_user'=>$employee_id, - 'trans_comment'=>$comment, - 'trans_location'=>$location_id, - 'trans_inventory'=>0 - ); - $this->db->insert('inventory',$excel_data); - } - } - } - else//insert or update item failure - { - $failCodes[] = $i; - } - } - - $i++; - } - else - { - echo json_encode( array('success'=>false,'message'=>'Your upload file has no data or not in supported format.') ); - return; - } - } + if($this->Item->save($item_data)) + { + $items_taxes_data = null; + //tax 1 + if( is_numeric($data[7]) && $data[6]!='' ) + { + $items_taxes_data[] = array('name'=>$data[6], 'percent'=>$data[7] ); + } + + //tax 2 + if( is_numeric($data[9]) && $data[8]!='' ) + { + $items_taxes_data[] = array('name'=>$data[8], 'percent'=>$data[9] ); + } + + // save tax values + if(count($items_taxes_data) > 0) + { + $this->Item_taxes->save($items_taxes_data, $item_data['item_id']); + } + + // quantities & inventory Info + $employee_id=$this->Employee->get_logged_in_employee_info()->person_id; + $emp_info=$this->Employee->get_info($employee_id); + $comment ='Qty CSV Imported'; + + $cols = count($data); + + // array to store information if location got a quantity + $quantity_added_to_location = array(); + foreach($this->Stock_locations->get_location_ids_as_array() as $loction_id) + { + $quantity_added_to_location[$location_id] = false; + } + for ($col = 24; $col < $cols; $col = $col + 2) + { + $item_quantity_data = array( + 'item_id' => $item_data['item_id'], + 'location_id' => $data[$col], + 'quantity' => $data[$col + 1], + ); + $this->Item_quantities->save($item_quantity_data, $item_data['item_id'], $data[$col]); + + $excel_data = array + ( + 'trans_items'=>$item_data['item_id'], + 'trans_user'=>$employee_id, + 'trans_comment'=>$comment, + 'trans_location'=>$data[$col], + 'trans_inventory'=>$data[$col + 1] + ); + $this->db->insert('inventory',$excel_data); + + $quantity_added_to_location[$data[$col]] = true; + } + + /* + * now iterate through the array and check for which location_id no entry into item_quantities was made yet + * those get an entry with quantity as 0. + * unfortunately a bit duplicate code from above... + */ + foreach($quantity_added_to_location as $location_id => $added) + { + if($added === false) + { + $item_quantity_data = array( + 'item_id' => $item_data['item_id'], + 'location_id' => $location_id, + 'quantity' => 0, + ); + $this->Item_quantities->save($item_quantity_data, $item_data['item_id'], $data[$col]); + + $excel_data = array + ( + 'trans_items'=>$item_data['item_id'], + 'trans_user'=>$employee_id, + 'trans_comment'=>$comment, + 'trans_location'=>$location_id, + 'trans_inventory'=>0 + ); + $this->db->insert('inventory',$excel_data); + } + } + } + else//insert or update item failure + { + $failCodes[] = $i; + } + } + + $i++; + } + else + { + echo json_encode( array('success'=>false,'message'=>'Your upload file has no data or not in supported format.') ); + return; + } + } $success = true; if(count($failCodes) > 1) @@ -732,15 +753,5 @@ class Items extends Secure_area implements iData_controller return 400; } - function item_number_check($item_number) - { - if ($this->Item->get_item_id($item_number) != FALSE) - { - $this->form_validation->set_message('item_number_check', $this->lang->line('items_item_number_exists')); - echo json_encode(array('success'=>false,'message'=>$this->lang->line('items_error_adding'))); - } - echo json_encode(array('success'=>true,'message'=>$this->lang->line('items_successful_adding'))); - } - } ?> diff --git a/application/controllers/receivings.php b/application/controllers/receivings.php index 64492ac76..6afae835a 100644 --- a/application/controllers/receivings.php +++ b/application/controllers/receivings.php @@ -217,7 +217,7 @@ class Receivings extends Secure_area $data['error_message'] = $this->lang->line('receivings_transaction_failed'); } $barcode_config=array('barcode_type'=>1,'barcode_width'=>180, 'barcode_height'=>30, 'barcode_quality'=>100); - $data['barcode']=$this->barcode_lib->generate_barcode($receiving_id,$barcode_config); + $data['barcode']=$this->barcode_lib->generate_barcode($data['receiving_id'],$barcode_config); $this->load->view("receivings/receipt",$data); $this->receiving_lib->clear_all(); } diff --git a/application/controllers/secure_area.php b/application/controllers/secure_area.php index dff0bf988..bbf6bf2d7 100644 --- a/application/controllers/secure_area.php +++ b/application/controllers/secure_area.php @@ -23,6 +23,11 @@ class Secure_area extends CI_Controller //load up global data $logged_in_employee_info=$this->Employee->get_logged_in_employee_info(); $data['allowed_modules']=$this->Module->get_allowed_modules($logged_in_employee_info->person_id); + $data['backup_allowed']=false; + foreach($data['allowed_modules']->result_array() as $module) + { + $data['backup_allowed']|=$module['module_id']==='config'; + } $data['user_info']=$logged_in_employee_info; $data['controller_name']=$module_id; $this->load->vars($data); diff --git a/application/language/en/items_lang.php b/application/language/en/items_lang.php index 29bd9610e..47bd0826e 100644 --- a/application/language/en/items_lang.php +++ b/application/language/en/items_lang.php @@ -81,3 +81,4 @@ $lang["items_upc_database"] = "UPC Database"; $lang["items_update"] = "Update Item"; $lang["items_use_inventory_menu"] = "Use Inv. Menu"; $lang["items_image"] = "Avatar"; +$lang["items_item_number_exists"] = "The item number is already present in the database"; diff --git a/application/language/es/items_lang.php b/application/language/es/items_lang.php index c0371da65..da720d1b8 100644 --- a/application/language/es/items_lang.php +++ b/application/language/es/items_lang.php @@ -63,7 +63,7 @@ $lang["items_sales_tax_1"] = "Impuesto de Ventas 1"; $lang["items_sales_tax_2"] = "Impuesto de Ventas 2"; $lang["items_search_custom_items"] = "Buscar en campos personalizados"; $lang["items_serialized_items"] = "Artículos Serializados"; -$lang["items_stock_location"] = ""; +$lang["items_stock_location"] = "Stock location"; $lang["items_successful_adding"] = "Has agregado satisfactoriamente un artículo"; $lang["items_successful_bulk_edit"] = "Has actualizado satisfactoriamente los artículos seleccionados"; $lang["items_successful_deleted"] = "Has borrado satisfactoriamente"; @@ -80,4 +80,5 @@ $lang["items_unit_price_required"] = "Precio de Venta es requerido"; $lang["items_upc_database"] = "Base de datos UPC"; $lang["items_update"] = "Actualizar Artículo"; $lang["items_use_inventory_menu"] = "Usar Menú de Inventario"; -$lang["items_image"] = ""; +$lang["items_image"] = "Avatar"; +$lang["items_item_number_exists"] = "The item number is already present in the database"; diff --git a/application/language/fr/items_lang.php b/application/language/fr/items_lang.php index 3d8ebde8f..7116149fd 100644 --- a/application/language/fr/items_lang.php +++ b/application/language/fr/items_lang.php @@ -63,7 +63,7 @@ $lang["items_sales_tax_1"] = "Taxe Vente"; $lang["items_sales_tax_2"] = "Taxe Vente 2"; $lang["items_search_custom_items"] = "Rechercher dans les Champs Choisis"; $lang["items_serialized_items"] = "Items Serialisés"; -$lang["items_stock_location"] = ""; +$lang["items_stock_location"] = "Stock location"; $lang["items_successful_adding"] = "Ajout enregistré"; $lang["items_successful_bulk_edit"] = "Édition réussie"; $lang["items_successful_deleted"] = "Suppréssion réussie"; @@ -80,4 +80,5 @@ $lang["items_unit_price_required"] = "Le Prix de revente est requis"; $lang["items_upc_database"] = "Base de Données UPC"; $lang["items_update"] = "Éditer Item"; $lang["items_use_inventory_menu"] = "Utiliser Menu Inv."; -$lang["items_image"] = ""; +$lang["items_image"] = "Avatar"; +$lang["items_item_number_exists"] = "The item number is already present in the database"; diff --git a/application/language/id/items_lang.php b/application/language/id/items_lang.php index 5c04a228a..828978df4 100644 --- a/application/language/id/items_lang.php +++ b/application/language/id/items_lang.php @@ -63,7 +63,7 @@ $lang["items_sales_tax_1"] = "Pajak Penjualan1"; $lang["items_sales_tax_2"] = "Pajak Penjualan2"; $lang["items_search_custom_items"] = "Cari secara manual"; $lang["items_serialized_items"] = "Serial Item"; -$lang["items_stock_location"] = ""; +$lang["items_stock_location"] = "Stock location"; $lang["items_successful_adding"] = "Item Barang telah berhasil ditambahkan"; $lang["items_successful_bulk_edit"] = "Anda telah berhasil memperbarui item yang dipilih"; $lang["items_successful_deleted"] = "Item Barang telah berhasil dihapus"; @@ -80,4 +80,5 @@ $lang["items_unit_price_required"] = "Harga Jual wajib diisi"; $lang["items_upc_database"] = "Database UPC"; $lang["items_update"] = "Ubah"; $lang["items_use_inventory_menu"] = "Gunakan Inv. Menu"; -$lang["items_image"] = ""; +$lang["items_image"] = "Avatar"; +$lang["items_item_number_exists"] = "The item number is already present in the database"; diff --git a/application/language/nl-BE/items_lang.php b/application/language/nl-BE/items_lang.php index a5d487617..d3efc59bd 100755 --- a/application/language/nl-BE/items_lang.php +++ b/application/language/nl-BE/items_lang.php @@ -63,7 +63,7 @@ $lang["items_sales_tax_1"] = "VAT"; $lang["items_sales_tax_2"] = "VAT 2"; $lang["items_search_custom_items"] = "Doorzoek Tags"; $lang["items_serialized_items"] = "Optelbare producten"; -$lang["items_stock_location"] = ""; +$lang["items_stock_location"] = "Stock locatie"; $lang["items_successful_adding"] = "Product succesvol toegevoegd"; $lang["items_successful_bulk_edit"] = "Producten werden succesvol bewaard"; $lang["items_successful_deleted"] = "Er werd(en)"; @@ -81,3 +81,4 @@ $lang["items_upc_database"] = "UPC Database"; $lang["items_update"] = "Bewerk Product"; $lang["items_use_inventory_menu"] = "Use Inv. Menu"; $lang["items_image"] = "Afbeelding"; +$lang["items_item_number_exists"] = "De barcode nummer is reeds aanwezig in de database"; diff --git a/application/language/ru/items_lang.php b/application/language/ru/items_lang.php index 7123baf2b..d12a45142 100644 --- a/application/language/ru/items_lang.php +++ b/application/language/ru/items_lang.php @@ -63,7 +63,7 @@ $lang["items_sales_tax_1"] = "Налог на покупку"; $lang["items_sales_tax_2"] = "Налог на покупку 2"; $lang["items_search_custom_items"] = "Искать в дополнительных товарях"; $lang["items_serialized_items"] = "Сериализованные товары"; -$lang["items_stock_location"] = ""; +$lang["items_stock_location"] = "Stock location"; $lang["items_successful_adding"] = "Вы успешно добавлен товар"; $lang["items_successful_bulk_edit"] = "Вы успешно обновили выбранных товаров"; $lang["items_successful_deleted"] = "Вы успешно удалили"; @@ -80,4 +80,5 @@ $lang["items_unit_price_required"] = "Розничная цена обязате $lang["items_upc_database"] = "UPC база данных"; $lang["items_update"] = "Обновить Товар"; $lang["items_use_inventory_menu"] = "Используйте меню инвентаря"; -$lang["items_image"] = ""; +$lang["items_image"] = "Avatar"; +$lang["items_item_number_exists"] = "The item number is already present in the database"; diff --git a/application/language/th/items_lang.php b/application/language/th/items_lang.php index 5449feb66..6fc53a773 100644 --- a/application/language/th/items_lang.php +++ b/application/language/th/items_lang.php @@ -80,4 +80,5 @@ $lang["items_unit_price_required"] = "ราคาต่อหน่วยต้ $lang["items_upc_database"] = "UPC ฐานข้อมูล"; $lang["items_update"] = "ปรับแต่งสินค้า"; $lang["items_use_inventory_menu"] = "ใช้เมนูสินค้าคงเหลือ"; -$lang["items_image"] = ""; +$lang["items_image"] = "Avatar"; +$lang["items_item_number_exists"] = "The item number is already present in the database"; diff --git a/application/language/tr/items_lang.php b/application/language/tr/items_lang.php index 39f20e866..0ee376cd5 100644 --- a/application/language/tr/items_lang.php +++ b/application/language/tr/items_lang.php @@ -80,4 +80,5 @@ $lang["items_unit_price_required"] = "Satış Fiyatı zorunlu alandır"; $lang["items_upc_database"] = "UPC Veritabanı"; $lang["items_update"] = "Ürün Güncelle"; $lang["items_use_inventory_menu"] = "Stok Menüsünü Kullan"; -$lang["items_image"] = ""; +$lang["items_image"] = "Avatar"; +$lang["items_item_number_exists"] = "The item number is already present in the database"; diff --git a/application/language/zh/items_lang.php b/application/language/zh/items_lang.php index 79f90f7a2..c2f2d55d2 100755 --- a/application/language/zh/items_lang.php +++ b/application/language/zh/items_lang.php @@ -63,7 +63,7 @@ $lang["items_sales_tax_1"] = "營業稅"; $lang["items_sales_tax_2"] = "營業稅 2"; $lang["items_search_custom_items"] = "Search Custom Fields"; $lang["items_serialized_items"] = "序列化產品"; -$lang["items_stock_location"] = ""; +$lang["items_stock_location"] = "Stock location"; $lang["items_successful_adding"] = "已成功新增產品"; $lang["items_successful_bulk_edit"] = "您已成功更新所選產品"; $lang["items_successful_deleted"] = "刪除成功"; @@ -80,4 +80,5 @@ $lang["items_unit_price_required"] = "單價為必填欄位"; $lang["items_upc_database"] = "UPC Database"; $lang["items_update"] = "更新產品"; $lang["items_use_inventory_menu"] = "使用庫存清單"; -$lang["items_image"] = ""; +$lang["items_image"] = "Avatar"; +$lang["items_item_number_exists"] = "The item number is already present in the database"; diff --git a/application/libraries/MY_Form_validation.php b/application/libraries/MY_Form_validation.php new file mode 100755 index 000000000..3572f2400 --- /dev/null +++ b/application/libraries/MY_Form_validation.php @@ -0,0 +1,22 @@ +error_string; + } + + function get_error_messages() + { + return $this->_error_array; + } + +} + +?> \ No newline at end of file diff --git a/application/views/items/form.php b/application/views/items/form.php index c8e5fd58d..b66c84eaa 100644 --- a/application/views/items/form.php +++ b/application/views/items/form.php @@ -403,13 +403,16 @@ $(document).ready(function() submitHandler:function(form) { $(form).ajaxSubmit({ - success:function(response) - { - tb_remove(); - post_item_form_submit(response); - }, - dataType:'json' - }); + success:function(response) + { + if (handle_validation(response)) + { + tb_remove(); + post_item_form_submit(response); + } + }, + dataType:'json' + }); }, errorLabelContainer: "#error_message_box", diff --git a/application/views/partial/header.php b/application/views/partial/header.php index aa55cb6a0..32a37006c 100644 --- a/application/views/partial/header.php +++ b/application/views/partial/header.php @@ -29,7 +29,7 @@