Fix: Add missing global conf,langs

This commit is contained in:
Laurent Destailleur 2010-05-28 18:13:17 +00:00
parent f4ac09230e
commit c1df931c5a

View File

@ -61,19 +61,19 @@ class CommonObject
} }
/** /**
* \brief Ajoute un contact associe au l'entite definie dans $this->element * \brief Add a link between element $this->element and a contact
* \param fk_socpeople Id du contact a ajouter * \param fk_socpeople Id of contact to link
* \param type_contact Type de contact (code ou id) * \param type_contact Type of contact (code or id)
* \param source external=Contact externe (llx_socpeople), internal=Contact interne (llx_user) * \param source external=Contact extern (llx_socpeople), internal=Contact intern (llx_user)
* \return int <0 si erreur, >0 si ok * \return int <0 if KO, >0 if OK
*/ */
function add_contact($fk_socpeople, $type_contact, $source='external',$notrigger=0) function add_contact($fk_socpeople, $type_contact, $source='external',$notrigger=0)
{ {
global $conf,$langs; global $user,$conf,$langs;
dol_syslog("CommonObject::add_contact $fk_socpeople, $type_contact, $source"); dol_syslog("CommonObject::add_contact $fk_socpeople, $type_contact, $source");
// Verification parametres // Check parameters
if ($fk_socpeople <= 0) if ($fk_socpeople <= 0)
{ {
$this->error=$langs->trans("ErrorWrongValueForParameter","1"); $this->error=$langs->trans("ErrorWrongValueForParameter","1");
@ -108,7 +108,7 @@ class CommonObject
} }
} }
$datecreate = time(); $datecreate = dol_now();
// Insertion dans la base // Insertion dans la base
$sql = "INSERT INTO ".MAIN_DB_PREFIX."element_contact"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."element_contact";
@ -143,7 +143,7 @@ class CommonObject
} }
else else
{ {
$this->error=$this->db->error()." - $sql"; $this->error=$this->db->error();
dol_syslog($this->error,LOG_ERR); dol_syslog($this->error,LOG_ERR);
return -1; return -1;
} }
@ -151,11 +151,11 @@ class CommonObject
} }
/** /**
* \brief Mise a jour du statut d'un contact * \brief Update a link to contact line
* \param rowid La reference du lien contact-entite * \param rowid Id of line contact-element
* \param statut Le nouveau statut * \param statut New status of link
* \param type_contact_id Description du type de contact * \param type_contact_id Id of contact type
* \return int <0 si erreur, =0 si ok * \return int <0 if KO, >= 0 if OK
*/ */
function update_contact($rowid, $statut, $type_contact_id) function update_contact($rowid, $statut, $type_contact_id)
{ {
@ -177,13 +177,13 @@ class CommonObject
} }
/** /**
* \brief Supprime une ligne de contact * \brief Delete a link to contact line
* \param rowid La reference du contact * \param rowid Id of link line to delete
* \return statur >0 si ok, <0 si ko * \return statur >0 si ok, <0 si ko
*/ */
function delete_contact($rowid,$notrigger=0) function delete_contact($rowid,$notrigger=0)
{ {
global $conf; global $user,$langs,$conf;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."element_contact"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."element_contact";
$sql.= " WHERE rowid =".$rowid; $sql.= " WHERE rowid =".$rowid;
@ -212,13 +212,13 @@ class CommonObject
} }
/** /**
* \brief Supprime une ligne de contact * \brief Delete all links between an object $this and all its contacts
* \return statur >0 si ok, <0 si ko * \return int >0 if OK, <0 if KO
*/ */
function delete_linked_contact() function delete_linked_contact()
{ {
$temp = array(); $temp = array();
$typeContact = $this->liste_type_contact(0); $typeContact = $this->liste_type_contact('');
foreach($typeContact as $key => $value) foreach($typeContact as $key => $value)
{ {