From b87a29806dd23c7864131310467365c84ce3e4d7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Dec 2011 00:16:19 +0100 Subject: [PATCH 01/13] Fix: Message --- htdocs/comm/action/class/actioncomm.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index e6e62350ec3..cc83a8a4894 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -3,17 +3,17 @@ * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2011 Juanjo Menent - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ @@ -133,7 +133,7 @@ class ActionComm extends CommonObject } else if ($result == 0) { - $this->error='Failed to get record with code AC_OTH from dictionnary "type of events"'; + $this->error='Failed to get record with code '.$this->type_code.' from dictionnary "type of events"'; return -1; } else From 1f37dc906f26d6d0b8471bc011acafcee569edd1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Dec 2011 11:59:41 +0100 Subject: [PATCH 02/13] Qual: Uniformize name of barcode into "barcode". --- htdocs/admin/company.php | 4 ++-- htdocs/categories/categorie.php | 2 +- htdocs/core/class/commondocgenerator.class.php | 4 ++-- htdocs/core/modules/modSociete.class.php | 4 ++-- htdocs/install/mysql/migration/3.1.0-3.2.0.sql | 3 +++ htdocs/install/mysql/tables/llx_societe.sql | 2 +- htdocs/societe/agenda.php | 2 +- htdocs/societe/canvas/actions_card_common.class.php | 4 ++-- .../societe/canvas/company/tpl/card_create.tpl.php | 2 +- htdocs/societe/canvas/company/tpl/card_edit.tpl.php | 2 +- htdocs/societe/canvas/company/tpl/card_view.tpl.php | 2 +- .../canvas/individual/tpl/card_create.tpl.php | 2 +- .../societe/canvas/individual/tpl/card_edit.tpl.php | 2 +- .../societe/canvas/individual/tpl/card_view.tpl.php | 2 +- htdocs/societe/class/societe.class.php | 10 +++++----- htdocs/societe/soc.php | 12 ++++++------ test/phpunit/Example_import_company_1.csv | 2 +- 17 files changed, 32 insertions(+), 29 deletions(-) diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 41da98b8ac9..6d0e2278485 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -66,7 +66,7 @@ if ( (isset($_POST["action"]) && $_POST["action"] == 'update' && empty($_POST["c dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MAIL",$_POST["mail"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_WEB",$_POST["web"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOTE",$_POST["note"],'chaine',0,'',$conf->entity); - dolibarr_set_const($db, "MAIN_INFO_SOCIETE_GENCOD",$_POST["gencod"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_INFO_SOCIETE_GENCOD",$_POST["barcode"],'chaine',0,'',$conf->entity); if ($_FILES["logo"]["tmp_name"]) { if (preg_match('/([^\\/:]+)$/i',$_FILES["logo"]["name"],$reg)) @@ -346,7 +346,7 @@ if ((isset($_GET["action"]) && $_GET["action"] == 'edit') { $var=!$var; print ''.$langs->trans("Gencod").''; - print ''; + print ''; print ''; } diff --git a/htdocs/categories/categorie.php b/htdocs/categories/categorie.php index 21cf1ad4cc9..c36e9be33c1 100644 --- a/htdocs/categories/categorie.php +++ b/htdocs/categories/categorie.php @@ -222,7 +222,7 @@ if ($socid) if ($conf->global->MAIN_MODULE_BARCODE) { - print ''.$langs->trans('Gencod').''.$soc->gencod.''; + print ''.$langs->trans('Gencod').''.$soc->barcode.''; } // Address diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 0a8ae2d18ff..ed49e784dad 100755 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -89,7 +89,7 @@ abstract class CommonDocGenerator 'mycompany_web'=>$mysoc->url, 'mycompany_juridicalstatus'=>$mysoc->forme_juridique, 'mycompany_capital'=>$mysoc->capital, - 'mycompany_barcode'=>$mysoc->gencod, + 'mycompany_barcode'=>$mysoc->barcode, 'mycompany_idprof1'=>$mysoc->idprof1, 'mycompany_idprof2'=>$mysoc->idprof2, 'mycompany_idprof3'=>$mysoc->idprof3, @@ -121,7 +121,7 @@ abstract class CommonDocGenerator 'company_country_code'=>$object->country_code, 'company_country'=>$outputlangs->transnoentitiesnoconv("Country".$object->country_code), 'company_web'=>$object->url, - 'company_barcode'=>$object->gencod, + 'company_barcode'=>$object->barcode, 'company_vatnumber'=>$object->tva_intra, 'company_customercode'=>$object->code_client, 'company_suppliercode'=>$object->code_fournisseur, diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 43946280014..14b6df6195f 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -268,11 +268,11 @@ class modSociete extends DolibarrModules $this->import_label[$r]='ImportDataset_company_1'; $this->import_icon[$r]='company'; $this->import_tables_array[$r]=array('s'=>MAIN_DB_PREFIX.'societe'); // List of tables to insert into (insert done in same order) - $this->import_fields_array[$r]=array('s.nom'=>"Name*",'s.status'=>"Status",'s.client'=>"Customer*",'s.fournisseur'=>"Supplier*",'s.datec'=>"DateCreation",'s.code_client'=>"CustomerCode",'s.code_fournisseur'=>"SupplierCode",'s.address'=>"Address",'s.cp'=>"Zip",'s.ville'=>"Town",'s.tel'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.email'=>"Email",'s.siret'=>"IdProf1",'s.siren'=>"IdProf2",'s.ape'=>"IdProf3",'s.idprof4'=>"IdProf4",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital",'s.note'=>"Note",'s.fk_typent'=>"ThirdPartyType",'s.fk_effectif'=>"Effectif","s.fk_forme_juridique"=>"JuridicalStatus",'s.fk_prospectlevel'=>'ProspectLevel','s.fk_stcomm'=>'ProspectStatus','s.default_lang'=>'DefaultLanguage','s.gencod'=>'BarCode'); + $this->import_fields_array[$r]=array('s.nom'=>"Name*",'s.status'=>"Status",'s.client'=>"Customer*",'s.fournisseur'=>"Supplier*",'s.datec'=>"DateCreation",'s.code_client'=>"CustomerCode",'s.code_fournisseur'=>"SupplierCode",'s.address'=>"Address",'s.cp'=>"Zip",'s.ville'=>"Town",'s.tel'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.email'=>"Email",'s.siret'=>"IdProf1",'s.siren'=>"IdProf2",'s.ape'=>"IdProf3",'s.idprof4'=>"IdProf4",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital",'s.note'=>"Note",'s.fk_typent'=>"ThirdPartyType",'s.fk_effectif'=>"Effectif","s.fk_forme_juridique"=>"JuridicalStatus",'s.fk_prospectlevel'=>'ProspectLevel','s.fk_stcomm'=>'ProspectStatus','s.default_lang'=>'DefaultLanguage','s.barcode'=>'BarCode'); $this->import_entities_array[$r]=array(); // We define here only fields that use another picto $this->import_regex_array[$r]=array('s.status'=>'^[0|1]','s.client'=>'^[0|1|2|3]','s.fournisseur'=>'^[0|1]'); //$this->import_regex_array[$r]=array('s.status'=>'^[0|1]','s.client'=>'^[0|1|2|3]','s.fournisseur'=>'^[0|1]','s.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$','s.fk_typent'=>array('rule'=>'fetchidfromcode','file'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch'))); - $this->import_examplevalues_array[$r]=array('s.nom'=>"MyBigCompany",'s.status'=>"0 (closed) or 1 (active)",'s.client'=>'0 (no customer no prospect)/1 (customer)/2 (prospect)/3 (customer and prospect)','s.fournisseur'=>'0 or 1','s.datec'=>dol_print_date(mktime(),'YYYY-MM-DD'),'s.code_client'=>"CU01-0001",'s.code_fournisseur'=>"SU01-0001",'s.address'=>"61 jump street",'s.cp'=>"123456",'s.ville'=>"Big town",'s.tel'=>"0101010101",'s.fax'=>"0101010102",'s.url'=>"http://mycompany.com",'s.email'=>"test@mycompany.com",'s.siret'=>"",'s.siren'=>"",'s.ape'=>"",'s.idprof4'=>"",'s.tva_intra'=>"FR0123456789",'s.capital'=>"10000",'s.note'=>"This is an example of note for record",'s.fk_typent'=>"2",'s.fk_effectif'=>"3","s.fk_forme_juridique"=>"1",'s.fk_prospectlevel'=>'PL_MEDIUM','s.fk_stcomm'=>'','s.default_lang'=>'en_US','s.gencod'=>'123456789'); + $this->import_examplevalues_array[$r]=array('s.nom'=>"MyBigCompany",'s.status'=>"0 (closed) or 1 (active)",'s.client'=>'0 (no customer no prospect)/1 (customer)/2 (prospect)/3 (customer and prospect)','s.fournisseur'=>'0 or 1','s.datec'=>dol_print_date(mktime(),'YYYY-MM-DD'),'s.code_client'=>"CU01-0001",'s.code_fournisseur'=>"SU01-0001",'s.address'=>"61 jump street",'s.cp'=>"123456",'s.ville'=>"Big town",'s.tel'=>"0101010101",'s.fax'=>"0101010102",'s.url'=>"http://mycompany.com",'s.email'=>"test@mycompany.com",'s.siret'=>"",'s.siren'=>"",'s.ape'=>"",'s.idprof4'=>"",'s.tva_intra'=>"FR0123456789",'s.capital'=>"10000",'s.note'=>"This is an example of note for record",'s.fk_typent'=>"2",'s.fk_effectif'=>"3","s.fk_forme_juridique"=>"1",'s.fk_prospectlevel'=>'PL_MEDIUM','s.fk_stcomm'=>'','s.default_lang'=>'en_US','s.barcode'=>'123456789'); // Import list of contact and attributes /* $r++; diff --git a/htdocs/install/mysql/migration/3.1.0-3.2.0.sql b/htdocs/install/mysql/migration/3.1.0-3.2.0.sql index a4b7fe38f94..50432e0f64d 100755 --- a/htdocs/install/mysql/migration/3.1.0-3.2.0.sql +++ b/htdocs/install/mysql/migration/3.1.0-3.2.0.sql @@ -103,3 +103,6 @@ ALTER TABLE llx_facture MODIFY ref_client varchar(255); UPDATE llx_societe SET fk_stcomm = 0 WHERE fk_stcomm IS NULL; ALTER TABLE llx_societe MODIFY COLUMN fk_stcomm integer NOT NULL; +ALTER TABLE llx_societe CHANGE COLUMN gencod barcode varchar(255); +ALTER TABLE llx_societe ADD COLUMN fk_barcode_type integer DEFAULT 0; + diff --git a/htdocs/install/mysql/tables/llx_societe.sql b/htdocs/install/mysql/tables/llx_societe.sql index c0dd6594457..84f0e32360c 100644 --- a/htdocs/install/mysql/tables/llx_societe.sql +++ b/htdocs/install/mysql/tables/llx_societe.sql @@ -80,7 +80,7 @@ create table llx_societe tva_assuj tinyint DEFAULT 1, -- assujeti ou non a la TVA localtax1_assuj tinyint DEFAULT 0, -- assujeti ou non a local tax 1 localtax2_assuj tinyint DEFAULT 0, -- assujeti ou non a local tax 2 - gencod varchar(255), -- barcode + barcode varchar(255), -- barcode price_level integer NULL, -- level of price for multiprices default_lang varchar(6), -- default language logo varchar(255), diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php index f4717cc264c..c0f90fc6c58 100644 --- a/htdocs/societe/agenda.php +++ b/htdocs/societe/agenda.php @@ -107,7 +107,7 @@ if ($_GET["socid"]) if ($conf->global->MAIN_MODULE_BARCODE) { - print ''.$langs->trans('Gencod').''.$soc->gencod.''; + print ''.$langs->trans('Gencod').''.$soc->barcode.''; } print "".$langs->trans('Address').""; diff --git a/htdocs/societe/canvas/actions_card_common.class.php b/htdocs/societe/canvas/actions_card_common.class.php index ff9430a0136..ace94099d33 100644 --- a/htdocs/societe/canvas/actions_card_common.class.php +++ b/htdocs/societe/canvas/actions_card_common.class.php @@ -153,7 +153,7 @@ abstract class ActionsCardCommon $this->object->code_client = $_POST["code_client"]; $this->object->code_fournisseur = $_POST["code_fournisseur"]; $this->object->capital = $_POST["capital"]; - $this->object->gencod = $_POST["gencod"]; + $this->object->barcode = $_POST["barcode"]; $this->object->canvas = GETPOST("canvas"); $this->object->tva_assuj = $_POST["assujtva_value"]; @@ -686,7 +686,7 @@ abstract class ActionsCardCommon $this->object->idprof4 = $_POST["idprof4"]; $this->object->typent_id = $_POST["typent_id"]; $this->object->effectif_id = $_POST["effectif_id"]; - $this->object->gencod = $_POST["gencod"]; + $this->object->barcode = $_POST["barcode"]; $this->object->forme_juridique_code = $_POST["forme_juridique_code"]; $this->object->default_lang = $_POST["default_lang"]; $this->object->commercial_id = $_POST["commercial_id"]; diff --git a/htdocs/societe/canvas/company/tpl/card_create.tpl.php b/htdocs/societe/canvas/company/tpl/card_create.tpl.php index 02faff3b9cc..54d640bbc36 100644 --- a/htdocs/societe/canvas/company/tpl/card_create.tpl.php +++ b/htdocs/societe/canvas/company/tpl/card_create.tpl.php @@ -98,7 +98,7 @@ global->MAIN_MODULE_BARCODE) { ?> trans('Gencod'); ?> - + diff --git a/htdocs/societe/canvas/company/tpl/card_edit.tpl.php b/htdocs/societe/canvas/company/tpl/card_edit.tpl.php index 4aff1d27bf1..22ea8a64594 100644 --- a/htdocs/societe/canvas/company/tpl/card_edit.tpl.php +++ b/htdocs/societe/canvas/company/tpl/card_edit.tpl.php @@ -115,7 +115,7 @@ if ($this->control->tpl['fournisseur']) { global->MAIN_MODULE_BARCODE) { ?> trans('Gencod'); ?> - + diff --git a/htdocs/societe/canvas/company/tpl/card_view.tpl.php b/htdocs/societe/canvas/company/tpl/card_view.tpl.php index d5921d91243..033bba3a773 100644 --- a/htdocs/societe/canvas/company/tpl/card_view.tpl.php +++ b/htdocs/societe/canvas/company/tpl/card_view.tpl.php @@ -72,7 +72,7 @@ dol_fiche_head($head, 'card', $langs->trans("ThirdParty"),0,'company'); global->MAIN_MODULE_BARCODE) { ?> trans('Gencod'); ?> - control->tpl['gencod']; ?> + control->tpl['barcode']; ?> diff --git a/htdocs/societe/canvas/individual/tpl/card_create.tpl.php b/htdocs/societe/canvas/individual/tpl/card_create.tpl.php index 9c651e54e88..68c78cdc7ac 100644 --- a/htdocs/societe/canvas/individual/tpl/card_create.tpl.php +++ b/htdocs/societe/canvas/individual/tpl/card_create.tpl.php @@ -110,7 +110,7 @@ dol_htmloutput_errors($this->control->tpl['error'],$this->control->tpl['errors'] global->MAIN_MODULE_BARCODE) { ?> trans('Gencod'); ?> - + diff --git a/htdocs/societe/canvas/individual/tpl/card_edit.tpl.php b/htdocs/societe/canvas/individual/tpl/card_edit.tpl.php index 5b427bbec03..38b41e45b37 100644 --- a/htdocs/societe/canvas/individual/tpl/card_edit.tpl.php +++ b/htdocs/societe/canvas/individual/tpl/card_edit.tpl.php @@ -112,7 +112,7 @@ if ($this->control->tpl['fournisseur']) { global->MAIN_MODULE_BARCODE) { ?> trans('Gencod'); ?> - + diff --git a/htdocs/societe/canvas/individual/tpl/card_view.tpl.php b/htdocs/societe/canvas/individual/tpl/card_view.tpl.php index 7f3c1c0e4fc..78396bbc4a4 100644 --- a/htdocs/societe/canvas/individual/tpl/card_view.tpl.php +++ b/htdocs/societe/canvas/individual/tpl/card_view.tpl.php @@ -71,7 +71,7 @@ dol_fiche_head($head, 'card', $langs->trans("ThirdParty"),0,'company'); global->MAIN_MODULE_BARCODE) { ?> trans('Gencod'); ?> - control->tpl['gencod']; ?> + control->tpl['barcode']; ?> diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index f154a18d0cf..1c82b1b8447 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -74,7 +74,7 @@ class Societe extends CommonObject var $fax; var $email; var $url; - var $gencod; + var $barcode; // 4 identifiants professionnels (leur utilisation depend du pays) var $siren; // IdProf1 - Deprecated @@ -437,7 +437,7 @@ class Societe extends CommonObject $this->forme_juridique_code=trim($this->forme_juridique_code); //Gencod - $this->gencod=trim($this->gencod); + $this->barcode=trim($this->barcode); // For automatic creation if ($this->code_client == -1) $this->get_codeclient($this->prefix_comm,0); @@ -505,7 +505,7 @@ class Societe extends CommonObject $sql .= ",client = " . ($this->client?$this->client:0); $sql .= ",fournisseur = " . ($this->fournisseur?$this->fournisseur:0); - $sql .= ",gencod = ".($this->gencod?"'".$this->gencod."'":"null"); + $sql .= ",barcode = ".($this->barcode?"'".$this->barcode."'":"null"); $sql .= ",default_lang = ".($this->default_lang?"'".$this->default_lang."'":"null"); $sql .= ",logo = ".($this->logo?"'".$this->logo."'":"null"); @@ -637,7 +637,7 @@ class Societe extends CommonObject $sql .= ', s.fk_typent as typent_id'; $sql .= ', s.fk_effectif as effectif_id'; $sql .= ', s.fk_forme_juridique as forme_juridique_code'; - $sql .= ', s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur, s.parent, s.gencod'; + $sql .= ', s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur, s.parent, s.barcode'; $sql .= ', s.fk_departement, s.fk_pays, s.fk_stcomm, s.remise_client, s.mode_reglement, s.cond_reglement, s.tva_assuj'; $sql .= ', s.localtax1_assuj, s.localtax2_assuj, s.fk_prospectlevel, s.default_lang, s.logo'; $sql .= ', s.import_key'; @@ -736,7 +736,7 @@ class Societe extends CommonObject $this->code_compta = $obj->code_compta; $this->code_compta_fournisseur = $obj->code_compta_fournisseur; - $this->gencod = $obj->gencod; + $this->barcode = $obj->barcode; $this->tva_assuj = $obj->tva_assuj; $this->tva_intra = $obj->tva_intra; diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index b8b5c36296f..6fa4a04e167 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -135,7 +135,7 @@ if (empty($reshook)) $object->code_client = $_POST["code_client"]; $object->code_fournisseur = $_POST["code_fournisseur"]; $object->capital = $_POST["capital"]; - $object->gencod = $_POST["gencod"]; + $object->barcode = $_POST["barcode"]; $object->tva_intra = $_POST["tva_intra"]; $object->tva_assuj = $_POST["assujtva_value"]; @@ -535,7 +535,7 @@ else $object->email = $_POST["email"]; $object->url = $_POST["url"]; $object->capital = $_POST["capital"]; - $object->gencod = $_POST["gencod"]; + $object->barcode = $_POST["barcode"]; $object->idprof1 = $_POST["idprof1"]; $object->idprof2 = $_POST["idprof2"]; $object->idprof3 = $_POST["idprof3"]; @@ -757,7 +757,7 @@ else // Barcode if ($conf->global->MAIN_MODULE_BARCODE) { - print ''.$langs->trans('Gencod').''; + print ''.$langs->trans('Gencod').''; print ''; } @@ -1040,7 +1040,7 @@ else $object->idprof4=$_POST["idprof4"]; $object->typent_id=$_POST["typent_id"]; $object->effectif_id=$_POST["effectif_id"]; - $object->gencod=$_POST["gencod"]; + $object->barcode=$_POST["barcode"]; $object->forme_juridique_code=$_POST["forme_juridique_code"]; $object->default_lang=$_POST["default_lang"]; @@ -1201,7 +1201,7 @@ else // Barcode if ($conf->global->MAIN_MODULE_BARCODE) { - print ''.$langs->trans('Gencod').''; + print ''.$langs->trans('Gencod').''; print ''; } @@ -1515,7 +1515,7 @@ else // Barcode if ($conf->global->MAIN_MODULE_BARCODE) { - print ''.$langs->trans('Gencod').''.$object->gencod.''; + print ''.$langs->trans('Gencod').''.$object->barcode.''; } // Address diff --git a/test/phpunit/Example_import_company_1.csv b/test/phpunit/Example_import_company_1.csv index a5bbe397f16..34f99a6b728 100755 --- a/test/phpunit/Example_import_company_1.csv +++ b/test/phpunit/Example_import_company_1.csv @@ -1,2 +1,2 @@ -"Name* (s.nom)";"Status (s.status)";"Customer* (s.client)";"Supplier* (s.fournisseur)";"DateCreation (s.datec)";"CustomerCode (s.code_client)";"SupplierCode (s.code_fournisseur)";"Address (s.address)";"Zip (s.cp)";"Town (s.ville)";"Phone (s.tel)";"Fax (s.fax)";"Url (s.url)";"Email (s.email)";"IdProf1 (s.siret)";"IdProf2 (s.siren)";"IdProf3 (s.ape)";"IdProf4 (s.idprof4)";"VATIntraShort (s.tva_intra)";"Capital (s.capital)";"Note (s.note)";"ThirdPartyType (s.fk_typent)";"Effectif (s.fk_effectif)";"JuridicalStatus (s.fk_forme_juridique)";"ProspectLevel (s.fk_prospectlevel)";"ProspectStatus (s.fk_stcomm)";"DefaultLanguage (s.default_lang)";"BarCode (s.gencod)" +"Name* (s.nom)";"Status (s.status)";"Customer* (s.client)";"Supplier* (s.fournisseur)";"DateCreation (s.datec)";"CustomerCode (s.code_client)";"SupplierCode (s.code_fournisseur)";"Address (s.address)";"Zip (s.cp)";"Town (s.ville)";"Phone (s.tel)";"Fax (s.fax)";"Url (s.url)";"Email (s.email)";"IdProf1 (s.siret)";"IdProf2 (s.siren)";"IdProf3 (s.ape)";"IdProf4 (s.idprof4)";"VATIntraShort (s.tva_intra)";"Capital (s.capital)";"Note (s.note)";"ThirdPartyType (s.fk_typent)";"Effectif (s.fk_effectif)";"JuridicalStatus (s.fk_forme_juridique)";"ProspectLevel (s.fk_prospectlevel)";"ProspectStatus (s.fk_stcomm)";"DefaultLanguage (s.default_lang)";"BarCode (s.barcode)" "MyBigCompanyImport1";1;3;1;01/01/00;"CU01-0001";"SU01-0001";"61 jump street";123456;"Big town";101010101;101010102;"http://mycompany.com";"test@mycompany.com";;;;;"FR0123456789";10000;"This is an example of note for record";2;3;1;"PL_MEDIUM";1;"en_US";123456789 From 740c24e99167966cbb74beff3ceeb3e2103d0563 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Dec 2011 12:58:39 +0100 Subject: [PATCH 03/13] New: barcode is now visible on main tab. --- htdocs/core/lib/product.lib.php | 9 -- htdocs/product/barcode.php | 165 ------------------------- htdocs/product/class/product.class.php | 42 +++++-- htdocs/product/fiche.php | 78 +++++++++++- 4 files changed, 103 insertions(+), 191 deletions(-) delete mode 100644 htdocs/product/barcode.php diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index 5944af367e6..14bd3be67a2 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -64,15 +64,6 @@ function product_prepare_head($object, $user) $h++; } - // Show barcode tab - if ($conf->global->MAIN_MODULE_BARCODE && $user->rights->barcode->lire) - { - $head[$h][0] = DOL_URL_ROOT."/product/barcode.php?id=".$object->id; - $head[$h][1] = $langs->trans("BarCode"); - $head[$h][2] = 'barcode'; - $h++; - } - // Multilangs if($conf->global->MAIN_MULTILANGS) { diff --git a/htdocs/product/barcode.php b/htdocs/product/barcode.php deleted file mode 100644 index e7aadd55177..00000000000 --- a/htdocs/product/barcode.php +++ /dev/null @@ -1,165 +0,0 @@ - - * Copyright (C) 2004-2011 Laurent Destailleur - * Copyright (C) 2005-2011 Regis Houssin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/product/barcode.php - * \ingroup product - * \brief Page with bar code informations of product - */ - -require("../main.inc.php"); -require_once(DOL_DOCUMENT_ROOT."/core/lib/product.lib.php"); -require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php"); -require_once(DOL_DOCUMENT_ROOT."/core/class/html.formbarcode.class.php"); - -$langs->load("products"); -$langs->load("bills"); - -$id = GETPOST('id','int'); -$ref = GETPOST('ref','alpha'); -$action = GETPOST('action','alpha'); - -// Security check -$fieldvalue = (! empty($id) ? $id : $ref); -$fieldname = (! empty($ref) ? 'ref' : 'rowid'); -if ($user->societe_id) $socid=$user->societe_id; -$result=restrictedArea($user,'produit|service&barcode',$fieldvalue,'product','','',$fieldname); - -$object = new Product($db); - -/* - * Actions - */ - -// Modification du type de code barre -if ($action == 'setbarcodetype' && $user->rights->barcode->creer) -{ - $object->fetch($id); - $object->barcode_type = $_POST['barcodetype_id']; - $result = $object->update_barcode_type($user); - Header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); - exit; -} - -// Modification du code barre -if ($action == 'setbarcode' && $user->rights->barcode->creer) -{ - $object->fetch($id); - $object->barcode = $_POST['barcode']; //Todo: ajout verification de la validite du code barre en fonction du type - $result = $object->update_barcode($user); - Header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); - exit; -} - - -/* - * View - */ - -llxHeader("","",$langs->trans("BarCode")); - -$form = new Form($db); -$formbarcode = new FormBarCode($db); - -$result = $object->fetch($id,$ref); - -$head=product_prepare_head($object, $user); -$titre=$langs->trans("CardProduct".$object->type); -$picto=($object->type==1?'service':'product'); -dol_fiche_head($head, 'barcode', $titre, 0, $picto); - - -print ''."\n"; - -// Reference -print ''; -print ''; -print ''."\n"; - -// Libelle -print ''; - -// Barcode image -$url=DOL_URL_ROOT.'/viewimage.php?modulepart=barcode&generator='.urlencode($object->barcode_type_coder).'&code='.urlencode($object->barcode).'&encoding='.urlencode($object->barcode_type_code); -print ''; - -print ''."\n"; - -// Status (to sell) -print ''; - -// Status (to buy) -print ''; - -// Barcode type -print ''."\n"; - -// Barcode value -print ''."\n"; - -print "
'.$langs->trans("Ref").''; -print $form->showrefnav($object,'ref','',1,'ref'); -print '
'.$langs->trans("Label").''.$object->libelle.''; -print ''; -print ''; -print '
'.$langs->trans("Status").' ('.$langs->trans("Sell").')'.''; -print $object->getLibStatut(2,0); -print '
'.$langs->trans("Status").' ('.$langs->trans("Buy").')'.''; -print $object->getLibStatut(2,1); -print '
'; -print ''; -print '
'; -print $langs->trans("BarcodeType"); -print ''; -if (($_GET['action'] != 'editbarcodetype') && $user->rights->barcode->creer) print 'id.'">'.img_edit($langs->trans('SetBarcodeType'),1).'
'; -print '
'; -if ($_GET['action'] == 'editbarcodetype') -{ - $formbarcode->form_barcode_type($_SERVER['PHP_SELF'].'?id='.$object->id,$object->barcode_type,'barcodetype_id'); -} -else -{ - print $object->barcode_type_label?$object->barcode_type_label:'
'.$langs->trans("SetDefaultBarcodeType").'
'; -} -print '
'; -print ''; -print '
'; -print $langs->trans("BarcodeValue"); -print ''; -if (($_GET['action'] != 'editbarcode') && $user->rights->barcode->creer) print 'id.'">'.img_edit($langs->trans('SetBarcode'),1).'
'; -print '
'; -if ($_GET['action'] == 'editbarcode') -{ - print '
'; - print ''; - print ''; - print ''; - print ' '; -} -else -{ - print $object->barcode; -} -print '
\n"; -print "\n"; - -$db->close(); - -llxFooter(); -?> diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 8192b4bb9e6..c85b1af7357 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -403,7 +403,7 @@ class Product extends CommonObject global $langs, $conf; $error=0; - + // Verification parametres if (! $this->libelle) $this->libelle = 'MISSING LABEL'; @@ -2547,18 +2547,18 @@ class Product extends CommonObject /** - * Show photos of a product (nbmax maximum) + * Show photos of a product (nbmax maximum) + * TODO Move this into html.formproduct.class.php * - * @param sdir Directory to scan - * @param size 0=original size, 1 use thumbnail if possible - * @param nbmax Nombre maximum de photos (0=pas de max) - * @param nbbyrow Nombre vignettes par ligne (si mode vignette) - * @param showfilename 1=Show filename - * @param showaction 1=Show icon with action links (resize, delete) - * @param maxHeight Max height of image when size=1 - * @param maxWidth Max width of image when size=1 - * @return string Html code to show photo. Number of photos shown is saved in this->nbphoto - * TODO Move this into html.formproduct.class.php + * @param sdir Directory to scan + * @param size 0=original size, 1 use thumbnail if possible + * @param nbmax Nombre maximum de photos (0=pas de max) + * @param nbbyrow Nombre vignettes par ligne (si mode vignette) + * @param showfilename 1=Show filename + * @param showaction 1=Show icon with action links (resize, delete) + * @param maxHeight Max height of image when size=1 + * @param maxWidth Max width of image when size=1 + * @return string Html code to show photo. Number of photos shown is saved in this->nbphoto */ function show_photos($sdir,$size=0,$nbmax=0,$nbbyrow=5,$showfilename=0,$showaction=0,$maxHeight=120,$maxWidth=160) { @@ -2572,7 +2572,6 @@ class Product extends CommonObject $dirthumb = $dir.'thumbs/'; $pdirthumb = $pdir.'thumbs/'; - $return =''."\n"; /*$return.="