From 9d0fb43fb1f8e7b88cdcfaba52aec39ee9a0a317 Mon Sep 17 00:00:00 2001 From: jekkos-t520 Date: Sun, 15 Feb 2015 12:53:56 +0100 Subject: [PATCH 1/4] add file extension to company logo filename --- application/controllers/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/controllers/config.php b/application/controllers/config.php index aa708f59f..35c84d697 100644 --- a/application/controllers/config.php +++ b/application/controllers/config.php @@ -58,7 +58,7 @@ class Config extends Secure_area if (!empty($upload_data['orig_name'])) { - $batch_save_data['company_logo'] = $upload_data['raw_name']; + $batch_save_data['company_logo'] = $upload_data['raw_name'] . $upload_data['file_ext']; } $result = $this->Appconfig->batch_save( $batch_save_data ); From c7c4ac15d6a1b4dcaaea9b74644738dea0b7d62f Mon Sep 17 00:00:00 2001 From: jekkos-t520 Date: Mon, 16 Feb 2015 18:31:06 +0100 Subject: [PATCH 2/4] Set update_row response datatype to html Remove MY_Validation override (not needed anymore) Add jquery validation check for account_number --- application/controllers/customers.php | 6 ++++ application/language/en/customers_lang.php | 1 + application/language/es/customers_lang.php | 1 + application/language/fr/customers_lang.php | 1 + application/language/id/customers_lang.php | 1 + application/language/nl-BE/customers_lang.php | 1 + application/language/ru/customers_lang.php | 1 + application/language/th/customers_lang.php | 1 + application/language/tr/customers_lang.php | 1 + application/language/zh/customers_lang.php | 1 + application/libraries/MY_Form_validation.php | 22 ------------- application/models/customer.php | 13 ++++++++ application/views/customers/form.php | 22 ++++++++++++- js/manage_tables.js | 2 +- translations/customers_lang.csv | 31 ++++++++++--------- 15 files changed, 66 insertions(+), 39 deletions(-) delete mode 100755 application/libraries/MY_Form_validation.php diff --git a/application/controllers/customers.php b/application/controllers/customers.php index f1c27102c..3a6c69c25 100644 --- a/application/controllers/customers.php +++ b/application/controllers/customers.php @@ -93,6 +93,12 @@ class Customers extends Person_controller } } + function check_account_number() + { + $exists = $this->Customer->account_number_exists($this->input->post('account_number'),$this->input->post('person_id')); + echo json_encode(array('success'=>!$exists,'message'=>$this->lang->line('customers_account_number_duplicate'))); + } + /* This deletes customers from the customers table */ diff --git a/application/language/en/customers_lang.php b/application/language/en/customers_lang.php index 2be5b8e8f..e6c55d4e3 100644 --- a/application/language/en/customers_lang.php +++ b/application/language/en/customers_lang.php @@ -14,3 +14,4 @@ $lang["customers_successful_deleted"] = "You have successfully deleted"; $lang["customers_successful_updating"] = "You have successfully updated customer"; $lang["customers_taxable"] = "Taxable"; $lang["customers_update"] = "Update Customer"; +$lang["customers_account_number_duplicate"] = "This account number is already present in the database"; diff --git a/application/language/es/customers_lang.php b/application/language/es/customers_lang.php index 3c5502a54..726286fe2 100644 --- a/application/language/es/customers_lang.php +++ b/application/language/es/customers_lang.php @@ -14,3 +14,4 @@ $lang["customers_successful_deleted"] = "Has borrado satisfactoriamente a"; $lang["customers_successful_updating"] = "No se ha podido agregar el cliente"; $lang["customers_taxable"] = "Gravable"; $lang["customers_update"] = "Actualizar Cliente"; +$lang["customers_account_number_duplicate"] = "This account number is already present in the database"; diff --git a/application/language/fr/customers_lang.php b/application/language/fr/customers_lang.php index c7f87820d..890e1312f 100644 --- a/application/language/fr/customers_lang.php +++ b/application/language/fr/customers_lang.php @@ -14,3 +14,4 @@ $lang["customers_successful_deleted"] = "Suppréssion réussie"; $lang["customers_successful_updating"] = "Édition client réussie"; $lang["customers_taxable"] = "Imposable"; $lang["customers_update"] = "Éditer Client"; +$lang["customers_account_number_duplicate"] = "This account number is already present in the database"; diff --git a/application/language/id/customers_lang.php b/application/language/id/customers_lang.php index a6eb32d1c..15b15381b 100644 --- a/application/language/id/customers_lang.php +++ b/application/language/id/customers_lang.php @@ -14,3 +14,4 @@ $lang["customers_successful_deleted"] = "Anda telah berhasil menghapus pelanggan $lang["customers_successful_updating"] = "Anda telah berhasil memperbarui pelanggan"; $lang["customers_taxable"] = "Dapat dikenakan pajak"; $lang["customers_update"] = "Ubah Pelanggan"; +$lang["customers_account_number_duplicate"] = "This account number is already present in the database"; diff --git a/application/language/nl-BE/customers_lang.php b/application/language/nl-BE/customers_lang.php index 28ea02a9a..70f9b59e1 100755 --- a/application/language/nl-BE/customers_lang.php +++ b/application/language/nl-BE/customers_lang.php @@ -14,3 +14,4 @@ $lang["customers_successful_deleted"] = "Er werd(en)"; $lang["customers_successful_updating"] = "Wijzigingen klantgegevens bewaard voor "; $lang["customers_taxable"] = "Belastbaar"; $lang["customers_update"] = "Bewerk Klant"; +$lang["customers_account_number_duplicate"] = "Deze VAT nummer is reeds aanwezig in de database"; diff --git a/application/language/ru/customers_lang.php b/application/language/ru/customers_lang.php index cb80f894c..5c213a1d4 100644 --- a/application/language/ru/customers_lang.php +++ b/application/language/ru/customers_lang.php @@ -14,3 +14,4 @@ $lang["customers_successful_deleted"] = "Вы успешно удалили"; $lang["customers_successful_updating"] = "Вы успешно обновили клиент"; $lang["customers_taxable"] = "облагаемый"; $lang["customers_update"] = "Обновлять Клиент"; +$lang["customers_account_number_duplicate"] = "This account number is already present in the database"; diff --git a/application/language/th/customers_lang.php b/application/language/th/customers_lang.php index 15e9b796d..509d1a503 100644 --- a/application/language/th/customers_lang.php +++ b/application/language/th/customers_lang.php @@ -14,3 +14,4 @@ $lang["customers_successful_deleted"] = "คุณได้ทำการลบ $lang["customers_successful_updating"] = "คุณได้ทำการแก้ไขข้อมูลลูกค้าเรียบร้อยแล้ว"; $lang["customers_taxable"] = "ต้องเสียภาษี"; $lang["customers_update"] = "แก้ไขข้อมูลลูกค้า"; +$lang["customers_account_number_duplicate"] = "This account number is already present in the database"; diff --git a/application/language/tr/customers_lang.php b/application/language/tr/customers_lang.php index 15cc0a344..d114bd11d 100644 --- a/application/language/tr/customers_lang.php +++ b/application/language/tr/customers_lang.php @@ -14,3 +14,4 @@ $lang["customers_successful_deleted"] = "Silme başarılı"; $lang["customers_successful_updating"] = "Müşteri güncellendi"; $lang["customers_taxable"] = "Vergilendirilebilir"; $lang["customers_update"] = "Müşteri Güncelle"; +$lang["customers_account_number_duplicate"] = "This account number is already present in the database"; diff --git a/application/language/zh/customers_lang.php b/application/language/zh/customers_lang.php index b90f216b9..84320a35b 100755 --- a/application/language/zh/customers_lang.php +++ b/application/language/zh/customers_lang.php @@ -14,3 +14,4 @@ $lang["customers_successful_deleted"] = "成功刪除"; $lang["customers_successful_updating"] = "成功更新顧客"; $lang["customers_taxable"] = "應課稅"; $lang["customers_update"] = "更新客戶"; +$lang["customers_account_number_duplicate"] = "This account number is already present in the database"; diff --git a/application/libraries/MY_Form_validation.php b/application/libraries/MY_Form_validation.php deleted file mode 100755 index 3572f2400..000000000 --- a/application/libraries/MY_Form_validation.php +++ /dev/null @@ -1,22 +0,0 @@ -error_string; - } - - function get_error_messages() - { - return $this->_error_array; - } - -} - -?> \ No newline at end of file diff --git a/application/models/customer.php b/application/models/customer.php index 8b0e54913..1b686c25a 100644 --- a/application/models/customer.php +++ b/application/models/customer.php @@ -14,6 +14,19 @@ class Customer extends Person return ($query->num_rows()==1); } + function account_number_exists($account_number,$person_id='') + { + $this->db->from('customers'); + $this->db->where('account_number', $account_number); + if (!empty($person_id)) + { + $this->db->where('person_id !=', $person_id); + } + $query=$this->db->get(); + return ($query->num_rows()==1); + } + + /* Returns all the customers */ diff --git a/application/views/customers/form.php b/application/views/customers/form.php index 507368450..e7ebcc95a 100644 --- a/application/views/customers/form.php +++ b/application/views/customers/form.php @@ -12,6 +12,7 @@ echo form_open('customers/save/'.$person_info->person_id,array('id'=>'customer_f 'account_number', 'id'=>'account_number', + 'class'=>'account_number', 'value'=>$person_info->account_number) );?> @@ -41,6 +42,24 @@ echo form_close(); //validation and submit handling $(document).ready(function() { + + $.validator.addMethod("account_number", function(value, element) + { + return JSON.parse($.ajax( + { + type: 'POST', + url: '', + data: {'person_id' : 'person_id; ?>', 'account_number' : $(element).val() }, + success: function(response) + { + success=response.success; + }, + async:false, + dataType: 'json' + }).responseText).success; + + }, 'lang->line("customers_account_number_duplicate"); ?>'); + $('#customer_form').validate({ submitHandler:function(form) { @@ -60,7 +79,8 @@ $(document).ready(function() { first_name: "required", last_name: "required", - email: "email" + email: "email", + account_number: { account_number: true } }, messages: { diff --git a/js/manage_tables.js b/js/manage_tables.js index e4fc35b91..67534ed28 100644 --- a/js/manage_tables.js +++ b/js/manage_tables.js @@ -292,7 +292,7 @@ function update_row(row_id,url,callback) reinit_row(row_id); hightlight_row(row_id); callback && typeof(callback) == "function" && callback(); - }); + }, 'html'); } function reinit_row(checkbox_id) diff --git a/translations/customers_lang.csv b/translations/customers_lang.csv index 6a9d25aa6..eb14d748d 100644 --- a/translations/customers_lang.csv +++ b/translations/customers_lang.csv @@ -1,15 +1,16 @@ -"label","nl-BE","es","en","fr","zh","ru","th","tr","id" -"customers_account_number","Btwnummer","Cuenta #","Account #","# Compte","帳號 #","Номер счота","บัญชี #","Hesap No","No.Pelanggan" -"customers_basic_information","Klantgegevens","Información de Clientes","Customer Information","Informations Client","客戶資訊","Информация о клиенте","ข้อมูลลูกค้า","Müşteri bilgisi","Informasi Pelanggan" -"customers_cannot_be_deleted","De geselecteerde klanten konden niet worden verwijderd. Eén of meerdere klanten hebben verkoopsgegevens in de database zitten.","No se pudo borrar los clientes seleccionados. Uno o más de éstos tiene ventas.","Could not deleted selected customers, one or more of the selected customers has sales.","Impossible de supprimer. Un ou plusiers client(s) sélectionné(s) ont des ventes.","無法刪除選定的客戶,選定的客戶存有銷售紀錄。","Невозможно удалить выбранных клиентов, один или более из них имеет продаж.","ไม่สามารลบลูกค้าที่ถูกเลือก, ลูกค้าที่ถูกเลือกถูขายไปแล้ว.","Seçili müşteriler silinemedi, müşterilerin satışları var.","pelanggan terpilih tidak bisa dihapus; satu atau lebih dari pelanggan yang dipilih memiliki penjualan." -"customers_confirm_delete","Bent u zeker dat u de geselecteerde klanten wil verwijderen?","¿Estás seguro(a) de que quieres borrar a los clientes seleccionados?","Are you sure you want to delete the selected customers?","Etes vous sûr(e) de vouloir supprimer ces clients?","你確定要刪除選定的客戶?","Вы уверены, что хотите удалить выбранных клиентов?","ยืนยันลบข้อมูลลูกค้า?","Seçili müşteriyi silmek istediğinize emin misiniz?","Apakah Anda yakin ingin menghapus pelanggan yang dipilih?" -"customers_customer","Klant","Cliente","Customer","Client","客戶","Клиент","ลูกค้า","Müşteri","Pelanggan" -"customers_error_adding_updating","Fout bij het toevoegen/bewerken van een klant","Error agregando/actualizando cliente","Error adding/updating customer","Érreur lors de l\'ajout/suppression de client","添加/更新客戶錯誤","Ошибка при добавлении/обновлении клиента","แก้ไขข้อมูลลูกค้าผิดพลาด","Müşteri ekleme/güncelleme hatası","Menambah / Memperbarui Pelanggan Salah" -"customers_new","Nieuwe Klant","Nuevo Cliente","New Customer","Nouveau Client","新客戶","Новый Клиент","ลูกค้าใหม่","Yeni Müşteri","Pelanggan Baru" -"customers_none_selected","U hebt geen klanten geselecteerd","No has selccionado clientes para ser borrados","You have not selected any customers to delete","Vous n\\\'avez pas sélectionné de client à supprimer","您還沒有選擇任何客戶進行刪除","Вы не выбрали ни клиентов, чтобы удалить.","คุณยังไม่ได้ทำการเลือกลูกค้า","Silmek için müşteri seçmediniz","Anda belum memilih pelanggan untuk dihapus" -"customers_one_or_multiple","klant(en) verwijderd","cliente(s)","customer(s)","client(s)","客戶","клиент(ов)","ลูกค้า","müşteri","pelanggan" -"customers_successful_adding","Klant succesvol aangemaakt","Has agregado satisfactoriamente el cliente","You have successfully added customer","Vous avez ajouté un nouveau client","成功新增顧客","Вы успешно добавили клиентов","คุณได้ทำการเพิ่มลูกค้าเรียบร้อยแล้ว","Müşteri eklendi","Anda telah berhasil menambah pelanggan" -"customers_successful_deleted","Er werd(en)","Has borrado satisfactoriamente a","You have successfully deleted","Suppréssion réussie","成功刪除","Вы успешно удалили","คุณได้ทำการลบข้อมูลเรียบร้อยแล้ว","Silme başarılı","Anda telah berhasil menghapus pelanggan" -"customers_successful_updating","Wijzigingen klantgegevens bewaard voor ","No se ha podido agregar el cliente","You have successfully updated customer","Édition client réussie","成功更新顧客","Вы успешно обновили клиент","คุณได้ทำการแก้ไขข้อมูลลูกค้าเรียบร้อยแล้ว","Müşteri güncellendi","Anda telah berhasil memperbarui pelanggan" -"customers_taxable","Belastbaar","Gravable","Taxable","Imposable","應課稅","облагаемый","ต้องเสียภาษี","Vergilendirilebilir","Dapat dikenakan pajak" -"customers_update","Bewerk Klant","Actualizar Cliente","Update Customer","Éditer Client","更新客戶","Обновлять Клиент","แก้ไขข้อมูลลูกค้า","Müşteri Güncelle","Ubah Pelanggan" +label,nl-BE,es,en,fr,zh,ru,th,tr,id +customers_account_number,Btwnummer,Cuenta #,Account #,# Compte,帳號 #,Номер счота,บัญชี #,Hesap No,No.Pelanggan +customers_basic_information,Klantgegevens,Información de Clientes,Customer Information,Informations Client,客戶資訊,Информация о клиенте,ข้อมูลลูกค้า,Müşteri bilgisi,Informasi Pelanggan +customers_cannot_be_deleted,De geselecteerde klanten konden niet worden verwijderd. Eén of meerdere klanten hebben verkoopsgegevens in de database zitten.,No se pudo borrar los clientes seleccionados. Uno o más de éstos tiene ventas.,"Could not deleted selected customers, one or more of the selected customers has sales.",Impossible de supprimer. Un ou plusiers client(s) sélectionné(s) ont des ventes.,無法刪除選定的客戶,選定的客戶存有銷售紀錄。,"Невозможно удалить выбранных клиентов, один или более из них имеет продаж.","ไม่สามารลบลูกค้าที่ถูกเลือก, ลูกค้าที่ถูกเลือกถูขายไปแล้ว.","Seçili müşteriler silinemedi, müşterilerin satışları var.",pelanggan terpilih tidak bisa dihapus; satu atau lebih dari pelanggan yang dipilih memiliki penjualan. +customers_confirm_delete,Bent u zeker dat u de geselecteerde klanten wil verwijderen?,¿Estás seguro(a) de que quieres borrar a los clientes seleccionados?,Are you sure you want to delete the selected customers?,Etes vous sûr(e) de vouloir supprimer ces clients?,你確定要刪除選定的客戶?,"Вы уверены, что хотите удалить выбранных клиентов?",ยืนยันลบข้อมูลลูกค้า?,Seçili müşteriyi silmek istediğinize emin misiniz?,Apakah Anda yakin ingin menghapus pelanggan yang dipilih? +customers_customer,Klant,Cliente,Customer,Client,客戶,Клиент,ลูกค้า,Müşteri,Pelanggan +customers_error_adding_updating,Fout bij het toevoegen/bewerken van een klant,Error agregando/actualizando cliente,Error adding/updating customer,Érreur lors de l\'ajout/suppression de client,添加/更新客戶錯誤,Ошибка при добавлении/обновлении клиента,แก้ไขข้อมูลลูกค้าผิดพลาด,Müşteri ekleme/güncelleme hatası,Menambah / Memperbarui Pelanggan Salah +customers_new,Nieuwe Klant,Nuevo Cliente,New Customer,Nouveau Client,新客戶,Новый Клиент,ลูกค้าใหม่,Yeni Müşteri,Pelanggan Baru +customers_none_selected,U hebt geen klanten geselecteerd,No has selccionado clientes para ser borrados,You have not selected any customers to delete,Vous n\\\'avez pas sélectionné de client à supprimer,您還沒有選擇任何客戶進行刪除,"Вы не выбрали ни клиентов, чтобы удалить.",คุณยังไม่ได้ทำการเลือกลูกค้า,Silmek için müşteri seçmediniz,Anda belum memilih pelanggan untuk dihapus +customers_one_or_multiple,klant(en) verwijderd,cliente(s),customer(s),client(s),客戶,клиент(ов),ลูกค้า,müşteri,pelanggan +customers_successful_adding,Klant succesvol aangemaakt,Has agregado satisfactoriamente el cliente,You have successfully added customer,Vous avez ajouté un nouveau client,成功新增顧客,Вы успешно добавили клиентов,คุณได้ทำการเพิ่มลูกค้าเรียบร้อยแล้ว,Müşteri eklendi,Anda telah berhasil menambah pelanggan +customers_successful_deleted,Er werd(en),Has borrado satisfactoriamente a,You have successfully deleted,Suppréssion réussie,成功刪除,Вы успешно удалили,คุณได้ทำการลบข้อมูลเรียบร้อยแล้ว,Silme başarılı,Anda telah berhasil menghapus pelanggan +customers_successful_updating,Wijzigingen klantgegevens bewaard voor ,No se ha podido agregar el cliente,You have successfully updated customer,Édition client réussie,成功更新顧客,Вы успешно обновили клиент,คุณได้ทำการแก้ไขข้อมูลลูกค้าเรียบร้อยแล้ว,Müşteri güncellendi,Anda telah berhasil memperbarui pelanggan +customers_taxable,Belastbaar,Gravable,Taxable,Imposable,應課稅,облагаемый,ต้องเสียภาษี,Vergilendirilebilir,Dapat dikenakan pajak +customers_update,Bewerk Klant,Actualizar Cliente,Update Customer,Éditer Client,更新客戶,Обновлять Клиент,แก้ไขข้อมูลลูกค้า,Müşteri Güncelle,Ubah Pelanggan +customers_account_number_duplicate,Deze VAT nummer is reeds aanwezig in de database,This account number is already present in the database,This account number is already present in the database,This account number is already present in the database,This account number is already present in the database,This account number is already present in the database,This account number is already present in the database,This account number is already present in the database,This account number is already present in the database From 40eef74aa0ad953a4ae1eaaefa726cf469ea3536 Mon Sep 17 00:00:00 2001 From: jekkos-t520 Date: Tue, 17 Feb 2015 11:06:28 +0100 Subject: [PATCH 3/4] Adapt load_config hook to fallback to english if no valid language is present Move CI system language files back to their correct location (form_validation_lang) Add upload_lang.php and email_lang.php to system files (default english version for the time being) Add account_number check when importing customer data from excel Avoid unnecessary calls to check_item_number when importing items from excel --- application/controllers/customers.php | 15 +++- application/controllers/items.php | 3 +- application/core/MY_Lang.php | 90 +++++++++++++++++++ application/hooks/load_config.php | 12 ++- .../language/fr/form_validation_lang.php | 18 ---- .../language/nl-BE/form_validation_lang.php | 18 ---- .../language/th/form_validation_lang.php | 18 ---- application/libraries/MY_Language.php | 26 ------ system/language/es/email_lang.php | 24 +++++ .../language/es}/form_validation_lang.php | 0 system/language/es/upload_lang.php | 22 +++++ system/language/id/email_lang.php | 24 +++++ .../language/id}/form_validation_lang.php | 0 system/language/id/upload_lang.php | 22 +++++ system/language/index.html | 30 +++++-- system/language/ru/email_lang.php | 24 +++++ .../language/ru}/form_validation_lang.php | 0 system/language/ru/upload_lang.php | 22 +++++ system/language/th/email_lang.php | 24 +++++ .../language/th}/form_validation_lang.php | 0 system/language/th/upload_lang.php | 22 +++++ system/language/tr/email_lang.php | 24 +++++ .../language/tr/form_validation_lang.php | 0 system/language/tr/upload_lang.php | 22 +++++ system/language/zh/email_lang.php | 24 +++++ .../language/zh/form_validation_lang.php | 0 system/language/zh/upload_lang.php | 22 +++++ 27 files changed, 410 insertions(+), 96 deletions(-) create mode 100644 application/core/MY_Lang.php delete mode 100644 application/language/fr/form_validation_lang.php delete mode 100644 application/language/nl-BE/form_validation_lang.php delete mode 100644 application/language/th/form_validation_lang.php delete mode 100644 application/libraries/MY_Language.php create mode 100644 system/language/es/email_lang.php rename {application/language/en => system/language/es}/form_validation_lang.php (100%) create mode 100644 system/language/es/upload_lang.php create mode 100644 system/language/id/email_lang.php rename {application/language/es => system/language/id}/form_validation_lang.php (100%) create mode 100644 system/language/id/upload_lang.php create mode 100644 system/language/ru/email_lang.php rename {application/language/id => system/language/ru}/form_validation_lang.php (100%) create mode 100644 system/language/ru/upload_lang.php create mode 100644 system/language/th/email_lang.php rename {application/language/ru => system/language/th}/form_validation_lang.php (100%) create mode 100644 system/language/th/upload_lang.php create mode 100644 system/language/tr/email_lang.php rename {application => system}/language/tr/form_validation_lang.php (100%) create mode 100644 system/language/tr/upload_lang.php create mode 100644 system/language/zh/email_lang.php rename {application => system}/language/zh/form_validation_lang.php (100%) create mode 100644 system/language/zh/upload_lang.php diff --git a/application/controllers/customers.php b/application/controllers/customers.php index 3a6c69c25..d8cb101bb 100644 --- a/application/controllers/customers.php +++ b/application/controllers/customers.php @@ -165,11 +165,18 @@ class Customers extends Person_controller ); $customer_data=array( - 'account_number'=>$data[12]=='' ? null:$data[12], - 'taxable'=>$data[13]=='' ? 0:1, + 'taxable'=>$data[13]=='' ? 0:1 ); - if(!$this->Customer->save($person_data,$customer_data)) + $account_number = $data[12]; + $invalidated = false; + if ($account_number != "") + { + $customer_data['account_number'] = $account_number; + $invalidated = $this->Customer->account_number_exists($account_number); + } + + if($invalidated || !$this->Customer->save($person_data,$customer_data)) { $failCodes[] = $i; } @@ -185,7 +192,7 @@ class Customers extends Person_controller } $success = true; - if(count($failCodes) > 1) + if(count($failCodes) > 0) { $msg = "Most customers imported. But some were not, here is list of their CODE (" .count($failCodes) ."): ".implode(", ", $failCodes); $success = false; diff --git a/application/controllers/items.php b/application/controllers/items.php index e85a9831a..b34b96d4d 100644 --- a/application/controllers/items.php +++ b/application/controllers/items.php @@ -613,11 +613,12 @@ class Items extends Secure_area implements iData_controller 'custom10' => $data[23] /** GARRISON ADDED 5/6/2013 **/ ); $item_number = $data[0]; + $invalidated = false; if ($item_number != "") { $item_data['item_number'] = $item_number; + $invalidated = $this->Item->item_number_exists($item_number); } - $invalidated = $this->Item->item_number_exists($item_number); } else { diff --git a/application/core/MY_Lang.php b/application/core/MY_Lang.php new file mode 100644 index 000000000..75e8c596e --- /dev/null +++ b/application/core/MY_Lang.php @@ -0,0 +1,90 @@ +config->set_item( 'language', $idiom ); + $loaded = $this->is_loaded; + $this->is_loaded = array(); + + foreach($loaded as $file) + { + $this->load( str_replace( '_lang.php', '', $file ) ); + } + } + } + + /** + * Fetch a single line of text from the language array. Takes variable number + * of arguments and supports wildcards in the form of '%1', '%2', etc. + * Overloaded function. + * + * @access public + * @return mixed false if not found or the language string + */ + function line($line = '') + { + //get the arguments passed to the function + $args = func_get_args(); + + //count the number of arguments + $c = count($args); + + //if one or more arguments, perform the necessary processing + if ($c) + { + //first argument should be the actual language line key + //so remove it from the array (pop from front) + $line = array_shift($args); + + //check to make sure the key is valid and load the line + if ($line == '') + { + $line = FALSE; + } + else + { + if (isset($this->language[$line])) + { + $line = $this->language[$line]; + //if the line exists and more function arguments remain + //perform wildcard replacements + if ($args) + { + $i = 1; + foreach ($args as $arg) + { + $line = preg_replace('/\%'.$i.'/', $arg, $line); + $i++; + } + } + } + else + { + // just return label name (with TBD) + $line = $line . ' (TBD)'; + log_message('error', 'Could not find the language line "'.$line.'"'); + } + } + } + else + { + //if no arguments given, no language line available + $line = false; + } + + return $line; + } +} + +?> diff --git a/application/hooks/load_config.php b/application/hooks/load_config.php index d1f969771..57b487684 100644 --- a/application/hooks/load_config.php +++ b/application/hooks/load_config.php @@ -14,16 +14,22 @@ function load_config() if ( $CI->config->item( 'language' ) ) { $CI->config->set_item( 'language', $CI->config->item( 'language' ) ); - - $map = directory_map('./application/language/' . $CI->config->item( 'language' )); + // fallback to english if language folder does not exist + $language = $CI->config->item( 'language' ); + if (!file_exists('./application/language/' . $language)) + { + $language = 'en'; + } + $map = directory_map('./application/language/' . $language); foreach($map as $file) { if ( substr(strrchr($file,'.'),1) == "php") { - $CI->lang->load( str_replace( '_lang.php', '', $file ) ); + $CI->lang->load( str_replace( '_lang.php', '', $file ), $language); } } + } //Set timezone from config database diff --git a/application/language/fr/form_validation_lang.php b/application/language/fr/form_validation_lang.php deleted file mode 100644 index 7b8fec6b3..000000000 --- a/application/language/fr/form_validation_lang.php +++ /dev/null @@ -1,18 +0,0 @@ -config->set_item( 'language', $idiom ); - $loaded = $this->is_loaded; - $this->is_loaded = array(); - - foreach($loaded as $file) - { - $this->load( str_replace( '_lang.php', '', $file ) ); - } - } - } -} - -?> diff --git a/system/language/es/email_lang.php b/system/language/es/email_lang.php new file mode 100644 index 000000000..e3bd113cb --- /dev/null +++ b/system/language/es/email_lang.php @@ -0,0 +1,24 @@ + - - 403 Forbidden - - +Directory access is forbidden.

+$lang['email_must_be_array'] = "The email validation method must be passed an array."; +$lang['email_invalid_address'] = "Invalid email address: %s"; +$lang['email_attachment_missing'] = "Unable to locate the following email attachment: %s"; +$lang['email_attachment_unreadable'] = "Unable to open this attachment: %s"; +$lang['email_no_recipients'] = "You must include recipients: To, Cc, or Bcc"; +$lang['email_send_failure_phpmail'] = "Unable to send email using PHP mail(). Your server might not be configured to send mail using this method."; +$lang['email_send_failure_sendmail'] = "Unable to send email using PHP Sendmail. Your server might not be configured to send mail using this method."; +$lang['email_send_failure_smtp'] = "Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method."; +$lang['email_sent'] = "Your message has been successfully sent using the following protocol: %s"; +$lang['email_no_socket'] = "Unable to open a socket to Sendmail. Please check settings."; +$lang['email_no_hostname'] = "You did not specify a SMTP hostname."; +$lang['email_smtp_error'] = "The following SMTP error was encountered: %s"; +$lang['email_no_smtp_unpw'] = "Error: You must assign a SMTP username and password."; +$lang['email_failed_smtp_login'] = "Failed to send AUTH LOGIN command. Error: %s"; +$lang['email_smtp_auth_un'] = "Failed to authenticate username. Error: %s"; +$lang['email_smtp_auth_pw'] = "Failed to authenticate password. Error: %s"; +$lang['email_smtp_data_failure'] = "Unable to send data: %s"; +$lang['email_exit_status'] = "Exit status code: %s"; - - \ No newline at end of file + +/* End of file email_lang.php */ +/* Location: ./system/language/english/email_lang.php */ \ No newline at end of file diff --git a/system/language/ru/email_lang.php b/system/language/ru/email_lang.php new file mode 100644 index 000000000..e3bd113cb --- /dev/null +++ b/system/language/ru/email_lang.php @@ -0,0 +1,24 @@ + Date: Tue, 17 Feb 2015 11:14:28 +0100 Subject: [PATCH 4/4] Add proper location id for 0 quantities --- application/controllers/items.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/controllers/items.php b/application/controllers/items.php index b34b96d4d..404f49ffe 100644 --- a/application/controllers/items.php +++ b/application/controllers/items.php @@ -664,7 +664,7 @@ class Items extends Secure_area implements iData_controller 'location_id' => $location_id, 'quantity' => $data[$col + 1], ); - $this->Item_quantities->save($item_quantity_data, $item_data['item_id'], $data[$col]); + $this->Item_quantities->save($item_quantity_data, $item_data['item_id'], $location_id); $excel_data = array ( 'trans_items'=>$item_data['item_id'],