From 2bbfa2a5a1104c8441e54f5de22d046de24adf54 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 27 Aug 2008 23:55:24 +0000 Subject: [PATCH] Add patch from patrick raguin to support barcode on third parties --- htdocs/includes/modules/modBarcode.class.php | 5 ++-- htdocs/soc.php | 25 ++++++++++++++++++-- htdocs/societe.class.php | 11 ++++++++- 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/htdocs/includes/modules/modBarcode.class.php b/htdocs/includes/modules/modBarcode.class.php index 819247cf0bf..7bc57728855 100644 --- a/htdocs/includes/modules/modBarcode.class.php +++ b/htdocs/includes/modules/modBarcode.class.php @@ -16,13 +16,12 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ */ /** \defgroup barcode Module code barre - \brief Module pour g�rer les codes barres + \brief Module pour gerer les codes barres + \version $Id$ */ /** diff --git a/htdocs/soc.php b/htdocs/soc.php index ef6aa7130b7..cf87b5d2c02 100644 --- a/htdocs/soc.php +++ b/htdocs/soc.php @@ -4,6 +4,7 @@ * Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2005 Eric Seigne * Copyright (C) 2005-2007 Regis Houssin + * Copyright (C) 2008 Patrick Raguin * * 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 @@ -95,6 +96,7 @@ if ((! $_POST["getcustomercode"] && ! $_POST["getsuppliercode"]) $soc->code_client = $_POST["code_client"]; $soc->code_fournisseur = $_POST["code_fournisseur"]; $soc->capital = $_POST["capital"]; + $soc->gencod = $_POST["gencod"]; $soc->tva_assuj = $_POST["assujtva_value"]; $soc->tva_intra_code = $_POST["tva_intra_code"]; @@ -318,6 +320,7 @@ if ($_POST["getcustomercode"] || $_POST["getsuppliercode"] || $soc->email=$_POST["email"]; $soc->url=$_POST["url"]; $soc->capital=$_POST["capital"]; + $soc->gencod=$_POST["gencod"]; $soc->siren=$_POST["idprof1"]; $soc->siret=$_POST["idprof2"]; $soc->ape=$_POST["idprof3"]; @@ -454,6 +457,13 @@ if ($_POST["getcustomercode"] || $_POST["getsuppliercode"] || } } + if ($conf->global->MAIN_MODULE_BARCODE) + { + print ''.$langs->trans('Gencod').''; + print $soc->gencod; + print ''; + } + print ''.$langs->trans('Address').''; @@ -677,7 +687,7 @@ elseif ($_GET["action"] == 'edit' || $_POST["action"] == 'edit') $soc->idprof4=$_POST["idprof4"]; $soc->typent_id=$_POST["typent_id"]; $soc->effectif_id=$_POST["effectif_id"]; - + $soc->gencod=$_POST["gencod"]; $soc->forme_juridique_code=$_POST["forme_juridique_code"]; $soc->tva_assuj = $_POST["assujtva_value"]; @@ -800,6 +810,12 @@ elseif ($_GET["action"] == 'edit' || $_POST["action"] == 'edit') } } + if ($conf->global->MAIN_MODULE_BARCODE) + { + print ''.$langs->trans('Gencod').''; + print ''; + } + print ''.$langs->trans('Address').''; @@ -986,7 +1002,12 @@ else if ($soc->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; print ''; } - + + if ($conf->global->MAIN_MODULE_BARCODE) + { + print ''.$langs->trans('Gencod').''.$soc->gencod.''; + } + print "".$langs->trans('Address')."".nl2br($soc->adresse).""; print ''.$langs->trans('Zip').''.$soc->cp.""; diff --git a/htdocs/societe.class.php b/htdocs/societe.class.php index 2f83e3616c9..2aff452f8f3 100644 --- a/htdocs/societe.class.php +++ b/htdocs/societe.class.php @@ -5,6 +5,7 @@ * Copyright (C) 2003 Brian Fraval * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2005-2007 Regis Houssin + * Copyright (C) 2008 Patrick Raguin * * 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 @@ -57,6 +58,7 @@ class Societe extends CommonObject var $fax; var $email; var $url; + var $gencod; // 4 identifiants professionnels (leur utilisation depend du pays) var $siren; // IdProf1 @@ -341,6 +343,9 @@ class Societe extends CommonObject $this->effectif_id=trim($this->effectif_id); $this->forme_juridique_code=trim($this->forme_juridique_code); + + //Gencod + $this->gencod=trim($this->gencod); // Pour code client/fournisseur automatique if ($this->code_client == -1) $this->get_codeclient($this->prefix_comm,0); @@ -390,6 +395,8 @@ class Societe extends CommonObject $sql .= ",client = " . $this->client; $sql .= ",fournisseur = " . $this->fournisseur; + $sql .= ",gencod = ".($this->gencod?"'".$this->gencod."'":"null"); + if ($allowmodcodeclient) { @@ -501,7 +508,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'; + $sql .= ', s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur, s.parent, s.gencod'; $sql .= ', s.fk_departement, s.fk_pays, s.fk_stcomm, s.remise_client, s.mode_reglement, s.cond_reglement, s.tva_assuj'; $sql .= ', s.fk_prospectlevel'; $sql .= ', fj.libelle as forme_juridique'; @@ -568,6 +575,8 @@ class Societe extends CommonObject $this->code_compta = $obj->code_compta; $this->code_compta_fournisseur = $obj->code_compta_fournisseur; + $this->gencod = $obj->gencod; + $this->tva_assuj = $obj->tva_assuj; $this->tva_intra = $obj->tva_intra; $this->tva_intra_code = substr($obj->tva_intra,0,2);