Ajout possibilit de dfinir un numro de tel et de fax sur une adresse de livraison
This commit is contained in:
parent
ead83d1322
commit
52db47529b
@ -47,6 +47,8 @@ class AdresseLivraison
|
||||
var $ville;
|
||||
var $pays_id;
|
||||
var $pays_code;
|
||||
var $tel;
|
||||
var $fax;
|
||||
var $note;
|
||||
|
||||
|
||||
@ -169,14 +171,20 @@ class AdresseLivraison
|
||||
|
||||
// Nettoyage des paramètres
|
||||
|
||||
$this->fk_societe=$socid;
|
||||
$this->label=trim($this->label);
|
||||
$this->nom=trim($this->nom);
|
||||
$this->adresse=trim($this->adresse);
|
||||
$this->cp=trim($this->cp);
|
||||
$this->ville=trim($this->ville);
|
||||
$this->pays_id=trim($this->pays_id);
|
||||
$this->note=trim($this->note);
|
||||
$this->fk_societe = $socid;
|
||||
$this->label = trim($this->label);
|
||||
$this->nom = trim($this->nom);
|
||||
$this->adresse = trim($this->adresse);
|
||||
$this->cp = trim($this->cp);
|
||||
$this->ville = trim($this->ville);
|
||||
$this->pays_id = trim($this->pays_id);
|
||||
$this->tel = trim($this->tel);
|
||||
$this->tel = ereg_replace(" ","",$this->tel);
|
||||
$this->tel = ereg_replace("\.","",$this->tel);
|
||||
$this->fax = trim($this->fax);
|
||||
$this->fax = ereg_replace(" ","",$this->fax);
|
||||
$this->fax = ereg_replace("\.","",$this->fax);
|
||||
$this->note = trim($this->note);
|
||||
|
||||
$result = $this->verify(); // Verifie que nom et label obligatoire
|
||||
|
||||
@ -197,6 +205,12 @@ class AdresseLivraison
|
||||
|
||||
$sql .= ",fk_pays = '" . ($this->pays_id?$this->pays_id:'0') ."'";
|
||||
$sql.= ",note = '" . addslashes($this->note) ."'";
|
||||
|
||||
if ($this->tel)
|
||||
{ $sql .= ",tel = '" . $this->tel ."'"; }
|
||||
|
||||
if ($this->fax)
|
||||
{ $sql .= ",fax = '" . $this->fax ."'"; }
|
||||
|
||||
if ($user) $sql .= ",fk_user_modif = '".$user->id."'";
|
||||
$sql .= " WHERE fk_societe = '" . $socid ."' AND rowid = '" . $idl ."'";
|
||||
@ -265,7 +279,7 @@ class AdresseLivraison
|
||||
{
|
||||
$sql = 'SELECT a.rowid as idl, a.label, a.nom, a.address,'.$this->db->pdate('a.datec').' as dc';
|
||||
$sql .= ','. $this->db->pdate('a.tms').' as date_update, a.fk_societe';
|
||||
$sql .= ', a.cp, a.ville, a.note, a.fk_pays';
|
||||
$sql .= ', a.cp, a.ville, a.note, a.fk_pays, a.tel, a.fax';
|
||||
$sql .= ', p.code as pays_code, p.libelle as pays';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'societe_adresse_livraison as a';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_pays as p ON a.fk_pays = p.rowid';
|
||||
@ -294,6 +308,8 @@ class AdresseLivraison
|
||||
$ligne->pays_id = $objp->fk_pays;
|
||||
$ligne->pays_code = $objp->fk_pays?$objp->pays_code:'';
|
||||
$ligne->pays = $objp->fk_pays?($langs->trans('Country'.$objp->pays_code)!='Country'.$objp->pays_code?strtoupper($langs->trans('Country'.$objp->pays_code)):$objp->pays):'';
|
||||
$ligne->tel = $objp->tel;
|
||||
$ligne->fax = $objp->fax;
|
||||
$ligne->note = $objp->note;
|
||||
|
||||
$this->lignes[$i] = $ligne;
|
||||
@ -334,7 +350,7 @@ class AdresseLivraison
|
||||
|
||||
$sql = 'SELECT a.rowid, a.fk_societe, a.label, a.nom, a.address,'.$this->db->pdate('a.datec').' as dc';
|
||||
$sql .= ','. $this->db->pdate('a.tms').' as date_update';
|
||||
$sql .= ', a.cp,a.ville, a.note, a.fk_pays';
|
||||
$sql .= ', a.cp,a.ville, a.note, a.fk_pays, a.tel, a.fax';
|
||||
$sql .= ', p.code as pays_code, p.libelle as pays';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'societe_adresse_livraison as a';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_pays as p ON a.fk_pays = p.rowid';
|
||||
@ -363,6 +379,8 @@ class AdresseLivraison
|
||||
$this->pays_code = $obj->fk_pays?$obj->pays_code:'';
|
||||
$this->pays = $obj->fk_pays?($langs->trans('Country'.$obj->pays_code)!='Country'.$obj->pays_code?$langs->trans('Country'.$obj->pays_code):$obj->pays):'';
|
||||
|
||||
$this->tel = $obj->tel;
|
||||
$this->fax = $obj->fax;
|
||||
$this->note = $obj->note;
|
||||
|
||||
$result = 1;
|
||||
@ -470,6 +488,8 @@ class AdresseLivraisonLigne
|
||||
var $pays_id;
|
||||
var $pays_code;
|
||||
var $pays;
|
||||
var $tel;
|
||||
var $fax;
|
||||
var $note;
|
||||
|
||||
function AdresseLivraisonLigne()
|
||||
|
||||
@ -58,6 +58,8 @@ if ($_POST["action"] == 'add' || $_POST["action"] == 'update')
|
||||
$livraison->cp = $_POST["cp"];
|
||||
$livraison->ville = $_POST["ville"];
|
||||
$livraison->pays_id = $_POST["pays_id"];
|
||||
$livraison->tel = $_POST["tel"];
|
||||
$livraison->fax = $_POST["fax"];
|
||||
$livraison->note = $_POST["note"];
|
||||
|
||||
if ($_POST["action"] == 'add')
|
||||
@ -179,6 +181,8 @@ if ($_GET["action"] == 'create' || $_POST["action"] == 'create')
|
||||
$livraison->adresse=$_POST["adresse"];
|
||||
$livraison->cp=$_POST["cp"];
|
||||
$livraison->ville=$_POST["ville"];
|
||||
$livraison->tel=$_POST["tel"];
|
||||
$livraison->fax=$_POST["fax"];
|
||||
$livraison->note=$_POST["note"];
|
||||
}
|
||||
|
||||
@ -236,6 +240,10 @@ if ($_GET["action"] == 'create' || $_POST["action"] == 'create')
|
||||
$form->select_pays($livraison->pays_id,'pays_id');
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Phone').'</td><td><input type="text" name="tel" value="'.$livraison->tel.'"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Fax').'</td><td><input type="text" name="fax" value="'.$livraison->fax.'"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Note').'</td><td colspan="3"><textarea name="note" cols="40" rows="6" wrap="soft">';
|
||||
print $livraison->note;
|
||||
print '</textarea></td></tr>';
|
||||
@ -281,6 +289,8 @@ elseif ($_GET["action"] == 'edit' || $_POST["action"] == 'edit')
|
||||
$livraison->zip=$_POST["zip"];
|
||||
$livraison->ville=$_POST["ville"];
|
||||
$livraison->pays_id=$_POST["pays_id"]?$_POST["pays_id"]:$conf->global->MAIN_INFO_SOCIETE_PAYS;
|
||||
$livraison->tel=$_POST["tel"];
|
||||
$livraison->fax=$_POST["fax"];
|
||||
$livraison->note=$_POST["note"];
|
||||
|
||||
// On positionne pays_id, pays_code et libelle du pays choisi
|
||||
@ -336,6 +346,10 @@ elseif ($_GET["action"] == 'edit' || $_POST["action"] == 'edit')
|
||||
$form->select_pays($livraison->pays_id,'pays_id');
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Phone').'</td><td><input type="text" name="tel" value="'.$livraison->tel.'"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Fax').'</td><td><input type="text" name="fax" value="'.$livraison->fax.'"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Note').'</td><td colspan="3"><textarea name="note" cols="40" rows="6" wrap="soft">';
|
||||
print $livraison->note;
|
||||
print '</textarea></td></tr>';
|
||||
@ -399,6 +413,11 @@ else
|
||||
print '<tr><td width="25%">'.$langs->trans('Town').'</td><td width="25%">'.$livraison->lignes[$i]->ville."</td></tr>";
|
||||
|
||||
print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">'.$livraison->lignes[$i]->pays.'</td>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Phone').'</td><td>'.dolibarr_print_phone($livraison->lignes[$i]->tel).'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Fax').'</td><td>'.dolibarr_print_phone($livraison->lignes[$i]->fax).'</td></tr>';
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
@ -6,3 +6,6 @@
|
||||
--
|
||||
|
||||
delete from llx_const where name='MAIN_GRAPH_LIBRARY' and (value like 'phplot%' or value like 'artichow%');
|
||||
|
||||
ALTER TABLE llx_societe_adresse_livraison ADD COLUMN tel varchar(20) after fk_pays;
|
||||
ALTER TABLE llx_societe_adresse_livraison ADD COLUMN fax varchar(20) after tel;
|
||||
@ -31,6 +31,8 @@ create table llx_societe_adresse_livraison
|
||||
cp varchar(10), -- zipcode
|
||||
ville varchar(50), -- town
|
||||
fk_pays integer DEFAULT 0, --
|
||||
tel varchar(20), -- phone number
|
||||
fax varchar(20), -- fax number
|
||||
note text, --
|
||||
fk_user_creat integer, -- utilisateur qui a créé l'info
|
||||
fk_user_modif integer -- utilisateur qui a modifié l'info
|
||||
|
||||
Loading…
Reference in New Issue
Block a user