Add patch from patrick raguin to support barcode on third parties

This commit is contained in:
Laurent Destailleur 2008-08-27 23:55:24 +00:00
parent 1f22ba919d
commit 2bbfa2a5a1
3 changed files with 35 additions and 6 deletions

View File

@ -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<EFBFBD>rer les codes barres
\brief Module pour gerer les codes barres
\version $Id$
*/
/**

View File

@ -4,6 +4,7 @@
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2008 Patrick Raguin <patrick.raguin@auuguria.net>
*
* 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 '<tr><td>'.$langs->trans('Gencod').'</td><td colspan="3"><input type="text" name="gencod">';
print $soc->gencod;
print '</textarea></td></tr>';
}
print '<tr><td>'.$langs->trans('Address').'</td><td colspan="3"><textarea name="adresse" cols="40" rows="3" wrap="soft">';
print $soc->adresse;
print '</textarea></td></tr>';
@ -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 '<tr><td valign="top">'.$langs->trans('Gencod').'</td><td colspan="3"><input type="text" name="gencod" value="'.$soc->gencod.'">';
print '</td></tr>';
}
print '<tr><td valign="top">'.$langs->trans('Address').'</td><td colspan="3"><textarea name="adresse" cols="40" rows="3" wrap="soft">';
print $soc->adresse;
print '</textarea></td></tr>';
@ -986,7 +1002,12 @@ else
if ($soc->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
print '</td></tr>';
}
if ($conf->global->MAIN_MODULE_BARCODE)
{
print '<tr><td>'.$langs->trans('Gencod').'</td><td colspan="3">'.$soc->gencod.'</td></tr>';
}
print "<tr><td valign=\"top\">".$langs->trans('Address')."</td><td colspan=\"3\">".nl2br($soc->adresse)."</td></tr>";
print '<tr><td width="25%">'.$langs->trans('Zip').'</td><td width="25%">'.$soc->cp."</td>";

View File

@ -5,6 +5,7 @@
* Copyright (C) 2003 Brian Fraval <brian@fraval.org>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2008 Patrick Raguin <patrick.raguin@auguria.net>
*
* 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);