Fix: encryption of special char of contacts
This commit is contained in:
parent
7ad8b95295
commit
52dfed2d53
@ -41,7 +41,7 @@ class Contact extends CommonObject
|
||||
var $error;
|
||||
var $element='contact';
|
||||
var $table_element='socpeople';
|
||||
|
||||
|
||||
var $id;
|
||||
var $civilite_id;
|
||||
var $name;
|
||||
@ -52,7 +52,7 @@ class Contact extends CommonObject
|
||||
var $fk_pays;
|
||||
var $socid; // fk_soc
|
||||
var $status; // 0=brouillon, 1=4=actif, 5=inactif
|
||||
|
||||
|
||||
var $code;
|
||||
var $email;
|
||||
var $birthday;
|
||||
@ -71,11 +71,11 @@ class Contact extends CommonObject
|
||||
* \param DB Habler d'acc<EFBFBD>s base
|
||||
* \param id Id contact
|
||||
*/
|
||||
function Contact($DB, $id=0)
|
||||
function Contact($DB, $id=0)
|
||||
{
|
||||
$this->db = $DB;
|
||||
$this->id = $id;
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -87,7 +87,7 @@ class Contact extends CommonObject
|
||||
function create($user)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
|
||||
// Clean parameters
|
||||
$this->name=trim($this->name);
|
||||
if (! $this->socid) $this->socid = 0;
|
||||
@ -101,13 +101,13 @@ class Contact extends CommonObject
|
||||
$sql.= " ".($user->id > 0 ? "'".$user->id."'":"null").",";
|
||||
$sql.= $this->priv;
|
||||
$sql.= ")";
|
||||
|
||||
|
||||
dolibarr_syslog("Contact::create sql=".$sql);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."socpeople");
|
||||
|
||||
|
||||
$result=$this->update($this->id, $user, 1);
|
||||
if ($result < 0)
|
||||
{
|
||||
@ -142,19 +142,19 @@ class Contact extends CommonObject
|
||||
function update($id, $user=0, $notrigger=0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
|
||||
$this->id = $id;
|
||||
|
||||
|
||||
// Nettoyage parametres
|
||||
$this->name=trim($this->name);
|
||||
$this->firstname=trim($this->firstname);
|
||||
|
||||
|
||||
$this->email=trim($this->email);
|
||||
$this->phone_pro=trim($this->phone_pro);
|
||||
$this->phone_perso=trim($this->phone_perso);
|
||||
$this->phone_mobile=trim($this->phone_mobile);
|
||||
$this->fax=trim($this->fax);
|
||||
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET ";
|
||||
if ($this->socid > 0) $sql .= " fk_soc='".addslashes($this->socid)."',";
|
||||
if ($this->socid == -1) $sql .= " fk_soc=null,";
|
||||
@ -198,8 +198,8 @@ class Contact extends CommonObject
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* \brief Retourne chaine DN complete dans l'annuaire LDAP pour l'objet
|
||||
* \param info Info string loaded by _load_ldap_info
|
||||
@ -229,8 +229,8 @@ class Contact extends CommonObject
|
||||
|
||||
// Object classes
|
||||
$info["objectclass"]=split(',',$conf->global->LDAP_CONTACT_OBJECT_CLASS);
|
||||
|
||||
// Champs
|
||||
|
||||
// Champs
|
||||
if ($this->getFullName($langs) && $conf->global->LDAP_FIELD_FULLNAME) $info[$conf->global->LDAP_FIELD_FULLNAME] = utf8_encode($this->getFullName($langs));
|
||||
if ($this->name && $conf->global->LDAP_FIELD_NAME) $info[$conf->global->LDAP_FIELD_NAME] = utf8_encode($this->name);
|
||||
if ($this->firstname && $conf->global->LDAP_FIELD_FIRSTNAME) $info[$conf->global->LDAP_FIELD_FIRSTNAME] = utf8_encode($this->firstname);
|
||||
@ -281,11 +281,11 @@ class Contact extends CommonObject
|
||||
if ($this->email) $info["rfc822Mailbox"] = $this->email;
|
||||
if ($this->phone_mobile) $info["phpgwCellTelephoneNumber"] = $this->phone_mobile;
|
||||
}
|
||||
|
||||
|
||||
return $info;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* \brief Mise <EFBFBD> jour des alertes
|
||||
* \param id id du contact
|
||||
@ -295,30 +295,30 @@ class Contact extends CommonObject
|
||||
{
|
||||
// Mis a jour contact
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET rowid=".$id;
|
||||
|
||||
|
||||
if ($this->birthday) // <0 si avant 1970, >0 si apres 1970
|
||||
{
|
||||
if (eregi('^[0-9]+\-',$this->birthday))
|
||||
{
|
||||
// Si date = chaine (ne devrait pas arriver)
|
||||
$sql .= ", birthday='".$this->birthday."'";
|
||||
}
|
||||
else
|
||||
{
|
||||
// Si date = timestamp
|
||||
$sql .= ", birthday=".$this->db->idate($this->birthday);
|
||||
$sql .= ", birthday='".$this->birthday."'";
|
||||
}
|
||||
else
|
||||
{
|
||||
// Si date = timestamp
|
||||
$sql .= ", birthday=".$this->db->idate($this->birthday);
|
||||
}
|
||||
}
|
||||
if ($user) $sql .= ", fk_user_modif=".$user->id;
|
||||
$sql .= " WHERE rowid=".$id;
|
||||
//print "update_perso: ".$this->birthday.'-'.$this->db->idate($this->birthday);
|
||||
dolibarr_syslog("Contact::update_perso this->birthday=".$this->birthday." - sql=".$sql);
|
||||
dolibarr_syslog("Contact::update_perso this->birthday=".$this->birthday." - sql=".$sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
}
|
||||
|
||||
|
||||
// Mis a jour alerte birthday
|
||||
if ($this->birthday_alert)
|
||||
{
|
||||
@ -378,7 +378,7 @@ class Contact extends CommonObject
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON c.rowid = u.fk_socpeople";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON c.fk_soc = s.rowid";
|
||||
$sql.= " WHERE c.rowid = ". $id;
|
||||
|
||||
|
||||
dolibarr_syslog("Contact::fetch sql=".$sql);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
@ -386,7 +386,7 @@ class Contact extends CommonObject
|
||||
if ($this->db->num_rows($resql))
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
$this->ref = $obj->rowid;
|
||||
$this->civilite_id = $obj->civilite_id;
|
||||
@ -402,12 +402,12 @@ class Contact extends CommonObject
|
||||
$this->fk_pays = $obj->fk_pays;
|
||||
$this->pays_code = $obj->fk_pays?$obj->pays_code:'';
|
||||
$this->pays = ($obj->fk_pays > 0)?$langs->transnoentities("Country".$obj->pays_code):$langs->transnoentities("SelectCountry");
|
||||
|
||||
|
||||
$this->societeid = $obj->fk_soc;
|
||||
$this->socid = $obj->fk_soc;
|
||||
$this->socname = $obj->socname;
|
||||
$this->poste = $obj->poste;
|
||||
|
||||
|
||||
$this->phone_pro = trim($obj->phone);
|
||||
$this->fax = trim($obj->fax);
|
||||
$this->phone_perso = trim($obj->phone_perso);
|
||||
@ -417,7 +417,7 @@ class Contact extends CommonObject
|
||||
$this->jabberid = $obj->jabberid;
|
||||
$this->priv = $obj->priv;
|
||||
$this->mail = $obj->email;
|
||||
|
||||
|
||||
$this->birthday = dol_stringtotime($obj->birthday);
|
||||
//print "fetch: ".$obj->birthday.'-'.$this->birthday;
|
||||
$this->birthday_alert = $obj->birthday_alert;
|
||||
@ -429,14 +429,14 @@ class Contact extends CommonObject
|
||||
$sql = "SELECT u.rowid ";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||
$sql .= " WHERE u.fk_socpeople = ". $this->id;
|
||||
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($this->db->num_rows($resql))
|
||||
{
|
||||
$uobj = $this->db->fetch_object($resql);
|
||||
|
||||
|
||||
$this->user_id = $uobj->rowid;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
@ -447,21 +447,21 @@ class Contact extends CommonObject
|
||||
dolibarr_syslog("Contact::fetch ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
// Charge alertes du user
|
||||
if ($user)
|
||||
{
|
||||
$sql = "SELECT fk_user";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."user_alert";
|
||||
$sql .= " WHERE fk_user = ".$user->id." AND fk_contact = ".$id;
|
||||
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($this->db->num_rows($resql))
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
|
||||
$this->birthday_alert = 1;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
@ -489,8 +489,8 @@ class Contact extends CommonObject
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* \brief Charge le nombre d'elements auquel est li<EFBFBD> ce contact
|
||||
* ref_facturation
|
||||
@ -509,7 +509,7 @@ class Contact extends CommonObject
|
||||
$sql.=" GROUP BY tc.element";
|
||||
|
||||
dolibarr_syslog("Contact::load_ref_elements sql=".$sql);
|
||||
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -541,14 +541,14 @@ class Contact extends CommonObject
|
||||
function delete($notrigger=0)
|
||||
{
|
||||
global $conf, $langs, $user;
|
||||
|
||||
|
||||
$error=0;
|
||||
|
||||
|
||||
$this->old_name = $obj->name;
|
||||
$this->old_firstname = $obj->firstname;
|
||||
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
// Get all rowid of element_contact linked to a type that is link to llx_socpeople
|
||||
@ -563,7 +563,7 @@ class Contact extends CommonObject
|
||||
if ($resql)
|
||||
{
|
||||
$num=$this->db->num_rows($resql);
|
||||
|
||||
|
||||
$i=0;
|
||||
while ($i < $num && ! $error)
|
||||
{
|
||||
@ -588,7 +588,7 @@ class Contact extends CommonObject
|
||||
$this->error=$this->db->error().' sql='.$sql;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."socpeople";
|
||||
@ -611,10 +611,10 @@ class Contact extends CommonObject
|
||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
}
|
||||
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
@ -625,7 +625,7 @@ class Contact extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* \brief Charge les informations sur le contact, depuis la base
|
||||
* \param id id du contact <EFBFBD> charger
|
||||
@ -636,33 +636,33 @@ class Contact extends CommonObject
|
||||
$sql .= ", ".$this->db->pdate("c.tms")." as tms, c.fk_user_modif";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as c";
|
||||
$sql .= " WHERE c.rowid = ".$id;
|
||||
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($this->db->num_rows($resql))
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
|
||||
|
||||
if ($obj->fk_user_creat) {
|
||||
$cuser = new User($this->db, $obj->fk_user_creat);
|
||||
$cuser->fetch();
|
||||
$this->user_creation = $cuser;
|
||||
}
|
||||
|
||||
|
||||
if ($obj->fk_user_modif) {
|
||||
$muser = new User($this->db, $obj->fk_user_modif);
|
||||
$muser->fetch();
|
||||
$this->user_modification = $muser;
|
||||
}
|
||||
|
||||
|
||||
$this->date_creation = $obj->datec;
|
||||
$this->date_modification = $obj->tms;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
$this->db->free($resql);
|
||||
}
|
||||
else
|
||||
@ -670,7 +670,7 @@ class Contact extends CommonObject
|
||||
print $this->db->error();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* \brief Renvoi nombre d'emailings re<EFBFBD>u par le contact avec son email
|
||||
* \return int Nombre d'emailings
|
||||
@ -686,7 +686,7 @@ class Contact extends CommonObject
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$nb=$obj->nb;
|
||||
|
||||
|
||||
$this->db->free($resql);
|
||||
return $nb;
|
||||
}
|
||||
@ -695,7 +695,7 @@ class Contact extends CommonObject
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Renvoie nom clicable (avec eventuellement le picto)
|
||||
@ -708,9 +708,9 @@ class Contact extends CommonObject
|
||||
function getNomUrl($withpicto=0,$option='',$maxlen=0)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
|
||||
$result='';
|
||||
|
||||
|
||||
$lien = '<a href="'.DOL_URL_ROOT.'/contact/fiche.php?id='.$this->id.'">';
|
||||
$lienfin='</a>';
|
||||
|
||||
@ -736,40 +736,42 @@ class Contact extends CommonObject
|
||||
$langs->load("dict");
|
||||
|
||||
$code=$this->civilite_id;
|
||||
return $langs->trans("Civility".$code)!="Civility".$code ? $langs->trans("Civility".$code) : $code;
|
||||
return $langs->trans("Civility".$code)!="Civility".$code ? $langs->trans("Civility".$code) : $code;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Return full name (name+' '+lastname)
|
||||
* \param langs Lang for output
|
||||
* \param option 0=No option, 1=Add civility
|
||||
* \param nameorder 0=Lastname+Firstname, 1=Firstname+Lastname
|
||||
* \param langs Lang object for output
|
||||
* \param option 0=No option, 1=Add civility
|
||||
* \param nameorder 0=Lastname+Firstname, 1=Firstname+Lastname
|
||||
* \return string String with full name
|
||||
*/
|
||||
function getFullName($langs,$option=0,$nameorder=0)
|
||||
{
|
||||
$ret='';
|
||||
if ($option && $this->civilite_id)
|
||||
{
|
||||
{
|
||||
if ($langs->transnoentities("Civility".$this->civilite_id)!="Civility".$this->civilite_id) $ret.=$langs->transnoentities("Civility".$this->civilite_id).' ';
|
||||
else $ret.=$this->civilite_id.' ';
|
||||
}
|
||||
|
||||
|
||||
if ($nameorder)
|
||||
{
|
||||
if ($this->firstname) $ret.=$this->firstname.' ';
|
||||
if ($this->name) $ret.=$this->name.' ';
|
||||
if ($this->firstname) $ret.=$langs->convToOutputCharset($this->firstname);
|
||||
if ($this->firstname && $this->name) $ret.=' ';
|
||||
if ($this->name) $ret.=$langs->convToOutputCharset($this->name);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($this->name) $ret.=$this->name.' ';
|
||||
if ($this->firstname) $ret.=$this->firstname.' ';
|
||||
if ($this->name) $ret.=$langs->convToOutputCharset($this->name);
|
||||
if ($this->firstname && $this->name) $ret.=' ';
|
||||
if ($this->firstname) $ret.=$langs->convToOutputCharset($this->firstname);
|
||||
}
|
||||
return trim($ret);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* \brief Retourne le libell<EFBFBD> du statut du contact
|
||||
* \param mode 0=libell<EFBFBD> long, 1=libell<EFBFBD> court, 2=Picto + Libell<EFBFBD> court, 3=Picto, 4=Picto + Libell<EFBFBD> long, 5=Libell<EFBFBD> court + Picto
|
||||
@ -789,7 +791,7 @@ class Contact extends CommonObject
|
||||
function LibStatut($statut,$mode)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
|
||||
if ($mode == 0)
|
||||
{
|
||||
if ($statut==0) return $langs->trans('StatusContactDraft');
|
||||
|
||||
@ -869,11 +869,11 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
$pdf->SetFont('Arial','B',11);
|
||||
$pdf->MultiCell(96,4, $outputlangs->convToOutputCharset($object->client->nom), 0, 'L');
|
||||
|
||||
// Nom client
|
||||
$carac_client = "\n".$outputlangs->convToOutputCharset($object->contact->getFullName($outputlangs,1,1));
|
||||
// Customer name
|
||||
$carac_client = "\n".$object->contact->getFullName($outputlangs,1,1);
|
||||
|
||||
// Caract<EFBFBD>ristiques client
|
||||
$carac_client.="\n".$outputlangs->convToOutputCharset($object->contact->adresse);
|
||||
// Customer properties
|
||||
$carac_client.="\n".$outputlangs->convToOutputCharset($object->contact->address);
|
||||
$carac_client.="\n".$outputlangs->convToOutputCharset($object->contact->cp) . " " . $outputlangs->convToOutputCharset($object->contact->ville)."\n";
|
||||
//Pays si different de l'emetteur
|
||||
if ($this->emetteur->pays_code != $object->contact->pays_code)
|
||||
@ -883,7 +883,7 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
}
|
||||
else
|
||||
{
|
||||
// Nom client
|
||||
// Customer name
|
||||
$pdf->SetXY(102,$posy+3);
|
||||
$pdf->SetFont('Arial','B',11);
|
||||
$pdf->MultiCell(96,4, $outputlangs->convToOutputCharset($object->client->nom), 0, 'L');
|
||||
@ -896,7 +896,7 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
// On v<>rifie si c'est une soci<63>t<EFBFBD> ou un particulier
|
||||
if( !preg_match('#'.$object->contact->getFullName($outputlangs,1).'#isU',$object->client->nom) )
|
||||
{
|
||||
$carac_client .= "\n".$outputlangs->convToOutputCharset($object->contact->getFullName($outputlangs,1,1));
|
||||
$carac_client .= "\n".$object->contact->getFullName($outputlangs,1,1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1077,6 +1077,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
// Cadre client destinataire
|
||||
$pdf->rect(100, $posy, 100, $hautcadre);
|
||||
|
||||
|
||||
// If BILLING contact defined on invoice, we use it
|
||||
$usecontact=false;
|
||||
if ($conf->global->FACTURE_USE_BILL_CONTACT_AS_RECIPIENT)
|
||||
@ -1094,21 +1095,15 @@ class pdf_crabe extends ModelePDFFactures
|
||||
$pdf->SetXY(102,$posy+3);
|
||||
$pdf->SetFont('Arial','B',11);
|
||||
// On peut utiliser le nom de la societe du contact facturation
|
||||
if ($conf->global->FACTURE_USE_COMPANY_NAME_OF_BILL_CONTACT)
|
||||
{
|
||||
$socname = $object->contact->socname;
|
||||
}
|
||||
else
|
||||
{
|
||||
$socname = $object->client->nom;
|
||||
}
|
||||
if ($conf->global->FACTURE_USE_COMPANY_NAME_OF_BILL_CONTACT) $socname = $object->contact->socname;
|
||||
else $socname = $object->client->nom;
|
||||
$pdf->MultiCell(96,4, $outputlangs->convToOutputCharset($socname), 0, 'L');
|
||||
|
||||
// Nom client
|
||||
// Customer name
|
||||
$carac_client = "\n".$object->contact->getFullName($outputlangs,1,1);
|
||||
|
||||
// Caracteristiques client
|
||||
$carac_client.="\n".$outputlangs->convToOutputCharset($object->contact->adresse);
|
||||
// Customer properties
|
||||
$carac_client.="\n".$outputlangs->convToOutputCharset($object->contact->address);
|
||||
$carac_client.="\n".$outputlangs->convToOutputCharset($object->contact->cp) . " " . $outputlangs->convToOutputCharset($object->contact->ville)."\n";
|
||||
//Pays si different de l'emetteur
|
||||
if ($this->emetteur->pays_code != $object->contact->pays_code)
|
||||
|
||||
@ -845,12 +845,12 @@ class pdf_propale_azur extends ModelePDFPropales
|
||||
|
||||
$pdf->SetXY($this->marge_gauche+2,$posy+3);
|
||||
|
||||
// Nom emetteur
|
||||
// Customer name
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
$pdf->SetFont('Arial','B',11);
|
||||
$pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->nom), 0, 'L');
|
||||
|
||||
// Caracteristiques emetteur
|
||||
// Customer properties
|
||||
$carac_emetteur = '';
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->convToOutputCharset($this->emetteur->adresse);
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->convToOutputCharset($this->emetteur->cp).' '.$outputlangs->convToOutputCharset($this->emetteur->ville);
|
||||
@ -879,7 +879,9 @@ class pdf_propale_azur extends ModelePDFPropales
|
||||
// Cadre client destinataire
|
||||
$pdf->rect(100, $posy, 100, $hautcadre);
|
||||
|
||||
// If BILLING contact defined on invoice, we use it
|
||||
|
||||
// If BILLING contact defined, we use it
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
$usecontact=false;
|
||||
if ($conf->global->PROPALE_USE_CUSTOMER_CONTACT_AS_RECIPIENT)
|
||||
{
|
||||
@ -890,7 +892,6 @@ class pdf_propale_azur extends ModelePDFPropales
|
||||
$result=$object->fetch_contact($arrayidcontact[0]);
|
||||
}
|
||||
}
|
||||
|
||||
if ($usecontact)
|
||||
{
|
||||
// Nom societe
|
||||
@ -902,7 +903,7 @@ class pdf_propale_azur extends ModelePDFPropales
|
||||
$carac_client = "\n".$object->contact->getFullName($outputlangs,1,1);
|
||||
|
||||
// Caractéristiques client
|
||||
$carac_client.="\n".$outputlangs->convToOutputCharset($object->contact->adresse);
|
||||
$carac_client.="\n".$outputlangs->convToOutputCharset($object->contact->address);
|
||||
$carac_client.="\n".$outputlangs->convToOutputCharset($object->contact->cp) . " " . $outputlangs->convToOutputCharset($object->contact->ville)."\n";
|
||||
//Pays si different de l'emetteur
|
||||
if ($this->emetteur->pays_code != $object->contact->pays_code)
|
||||
|
||||
@ -348,6 +348,8 @@ class pdf_propale_jaune extends ModelePDFPropales
|
||||
|
||||
function _pagehead(&$pdf, $propale, $outputlangs)
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
//Affiche le filigrane brouillon - Print Draft Watermark
|
||||
if($propale->statut==0 && defined("PROPALE_DRAFT_WATERMARK") )
|
||||
{
|
||||
@ -394,17 +396,7 @@ class pdf_propale_jaune extends ModelePDFPropales
|
||||
$pdf->SetTextColor(0,0,200);
|
||||
$pdf->MultiCell(200, 20, $outputlangs->transnoentities("CommercialProposal"), '' , 'C');
|
||||
|
||||
/*
|
||||
* Adresse Client
|
||||
*/
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
$pdf->SetFont('Arial','B',12);
|
||||
$propale->fetch_client();
|
||||
$pdf->SetXY(102,42);
|
||||
$pdf->MultiCell(96,5, $outputlangs->convToOutputCharset($propale->client->nom));
|
||||
$pdf->SetFont('Arial','B',11);
|
||||
$pdf->SetXY(102,$pdf->GetY());
|
||||
$pdf->MultiCell(96,5, $outputlangs->convToOutputCharset($propale->client->adresse) . "\n" . $outputlangs->convToOutputCharset($propale->client->cp) . " " . $outputlangs->convToOutputCharset($propale->client->ville));
|
||||
// Cadre client destinataire
|
||||
$pdf->rect(100, 40, 100, 40);
|
||||
|
||||
$pdf->SetTextColor(200,0,0);
|
||||
@ -417,6 +409,80 @@ class pdf_propale_jaune extends ModelePDFPropales
|
||||
$pdf->MultiCell(110, 10, $outputlangs->transnoentities("Ref")." : ".$outputlangs->convToOutputCharset($propale->ref));
|
||||
$pdf->SetXY(110,90);
|
||||
$pdf->MultiCell(100, 10, $outputlangs->transnoentities("Date")." : " . dolibarr_print_date($propale->date,'day',false,$outputlangs));
|
||||
|
||||
|
||||
$posy=39;
|
||||
|
||||
$object=$propale;
|
||||
$object->fetch_client();
|
||||
|
||||
|
||||
// If BILLING contact defined, we use it
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
$usecontact=false;
|
||||
if ($conf->global->PROPALE_USE_CUSTOMER_CONTACT_AS_RECIPIENT)
|
||||
{
|
||||
$arrayidcontact=$object->getIdContact('external','CUSTOMER');
|
||||
if (sizeof($arrayidcontact) > 0)
|
||||
{
|
||||
$usecontact=true;
|
||||
$result=$object->fetch_contact($arrayidcontact[0]);
|
||||
}
|
||||
}
|
||||
if ($usecontact)
|
||||
{
|
||||
// Nom societe
|
||||
$pdf->SetXY(102,$posy+3);
|
||||
$pdf->SetFont('Arial','B',11);
|
||||
$pdf->MultiCell(96,4, $outputlangs->convToOutputCharset($object->client->nom), 0, 'L');
|
||||
|
||||
// Nom client
|
||||
$carac_client = "\n".$object->contact->getFullName($outputlangs,1,1);
|
||||
|
||||
// Caractéristiques client
|
||||
$carac_client.="\n".$outputlangs->convToOutputCharset($object->contact->address);
|
||||
$carac_client.="\n".$outputlangs->convToOutputCharset($object->contact->cp) . " " . $outputlangs->convToOutputCharset($object->contact->ville)."\n";
|
||||
//Pays si different de l'emetteur
|
||||
if ($this->emetteur->pays_code != $object->contact->pays_code)
|
||||
{
|
||||
$carac_client.=$outputlangs->convToOutputCharset($object->contact->pays)."\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Nom client
|
||||
$pdf->SetXY(102,$posy+3);
|
||||
$pdf->SetFont('Arial','B',11);
|
||||
$pdf->MultiCell(96,4, $outputlangs->convToOutputCharset($object->client->nom), 0, 'L');
|
||||
|
||||
// Nom du contact suivi propal si c'est une société
|
||||
$arrayidcontact = $object->getIdContact('external','CUSTOMER');
|
||||
if (sizeof($arrayidcontact) > 0)
|
||||
{
|
||||
$object->fetch_contact($arrayidcontact[0]);
|
||||
// On vérifie si c'est une société ou un particulier
|
||||
if( !preg_match('#'.$object->contact->getFullName($outputlangs,1).'#isU',$object->client->nom) )
|
||||
{
|
||||
$carac_client .= "\n".$object->contact->getFullName($outputlangs,1,1);
|
||||
}
|
||||
}
|
||||
|
||||
// Caractéristiques client
|
||||
$carac_client.="\n".$outputlangs->convToOutputCharset($object->client->adresse);
|
||||
$carac_client.="\n".$outputlangs->convToOutputCharset($object->client->cp) . " " . $outputlangs->convToOutputCharset($object->client->ville)."\n";
|
||||
|
||||
//Pays si different de l'emetteur
|
||||
if ($this->emetteur->pays_code != $object->client->pays_code)
|
||||
{
|
||||
$carac_client.=$outputlangs->convToOutputCharset($object->client->pays)."\n";
|
||||
}
|
||||
}
|
||||
// Numéro TVA intracom
|
||||
if ($object->client->tva_intra) $carac_client.="\n".$outputlangs->transnoentities("VATIntraShort").': '.$object->client->tva_intra;
|
||||
$pdf->SetFont('Arial','',9);
|
||||
$posy=$pdf->GetY()-9; //Auto Y coord readjust for multiline name
|
||||
$pdf->SetXY(102,$posy+6);
|
||||
$pdf->MultiCell(86,4, $carac_client);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@ -378,10 +378,10 @@ class Translate {
|
||||
|
||||
|
||||
/**
|
||||
* \brief Retourne la version traduite du texte pass<EFBFBD> en param<EFBFBD>tre
|
||||
* \brief Return translated value of a text string
|
||||
* Si il n'y a pas de correspondance pour ce texte, on cherche dans fichier alternatif
|
||||
* et si toujours pas trouv<EFBFBD>, il est retourn<EFBFBD> tel quel.
|
||||
* Les param<EFBFBD>tres de cette m<EFBFBD>thode ne doivent pas contenir de balises HTML.
|
||||
* et si toujours pas trouve, il est retourne tel quel.
|
||||
* Parameters of this method must not contains any HTML tags.
|
||||
* \param key cl<EFBFBD> de chaine a traduire
|
||||
* \param param1 chaine de param1
|
||||
* \param param2 chaine de param1
|
||||
|
||||
Loading…
Reference in New Issue
Block a user