Qual: Factorize duplicate code
This commit is contained in:
parent
fe62f493e0
commit
6edf6c8100
@ -433,35 +433,6 @@ class Adherent extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Fonction qui met e jour le commentaire d'un adherent
|
|
||||||
\param note Note
|
|
||||||
\param user Utilisateur qui realise la mise a jour
|
|
||||||
\return int <0 si KO, >0 si OK
|
|
||||||
*/
|
|
||||||
function update_note($note,$user)
|
|
||||||
{
|
|
||||||
$this->db->begin();
|
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET";
|
|
||||||
$sql.= " note='".addslashes($note)."'";
|
|
||||||
$sql.= " WHERE rowid = ".$this->id;
|
|
||||||
|
|
||||||
dolibarr_syslog("Adherent::update_note sql=$sql");
|
|
||||||
$result = $this->db->query($sql);
|
|
||||||
if (! $result)
|
|
||||||
{
|
|
||||||
$this->error=$this->db->error();
|
|
||||||
$this->db->rollback();
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->commentaire = $note;
|
|
||||||
|
|
||||||
$this->db->commit();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Fonction qui met a jour l'adherent (sauf mot de passe)
|
\brief Fonction qui met a jour l'adherent (sauf mot de passe)
|
||||||
\param user Utilisateur qui realise la mise a jour
|
\param user Utilisateur qui realise la mise a jour
|
||||||
|
|||||||
@ -52,7 +52,7 @@ if ($_POST["action"] == 'update_public' && $user->rights->propale->creer)
|
|||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$res=$propal->update_note_public($_POST["note_public"]);
|
$res=$propal->update_note_public($_POST["note_public"],$user);
|
||||||
if ($res < 0)
|
if ($res < 0)
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$propal->error.'</div>';
|
$mesg='<div class="error">'.$propal->error.'</div>';
|
||||||
@ -71,7 +71,7 @@ if ($_POST['action'] == 'update' && $user->rights->propale->creer)
|
|||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$res=$propal->update_note($_POST["note"]);
|
$res=$propal->update_note($_POST["note"],$user);
|
||||||
if ($res < 0)
|
if ($res < 0)
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$propal->error.'</div>';
|
$mesg='<div class="error">'.$propal->error.'</div>';
|
||||||
|
|||||||
@ -1391,51 +1391,6 @@ class Commande extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Mets à jour les commentaires privés
|
|
||||||
* \param note Commentaire
|
|
||||||
* \return int <0 si ko, >0 si ok
|
|
||||||
*/
|
|
||||||
function update_note($note)
|
|
||||||
{
|
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande';
|
|
||||||
$sql.= " SET note = '".addslashes($note)."'";
|
|
||||||
$sql.= " WHERE rowid =". $this->id;
|
|
||||||
|
|
||||||
if ($this->db->query($sql))
|
|
||||||
{
|
|
||||||
$this->note = $note;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->error=$this->db->error();
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Mets à jour les commentaires publiques
|
|
||||||
* \param note_public Commentaire
|
|
||||||
* \return int <0 si ko, >0 si ok
|
|
||||||
*/
|
|
||||||
function update_note_public($note_public)
|
|
||||||
{
|
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande';
|
|
||||||
$sql.= " SET note_public = '".addslashes($note_public)."'";
|
|
||||||
$sql.= " WHERE rowid =". $this->id;
|
|
||||||
|
|
||||||
if ($this->db->query($sql))
|
|
||||||
{
|
|
||||||
$this->note_public = $note_public;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->error=$this->db->error();
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Définit une date de livraison
|
* \brief Définit une date de livraison
|
||||||
|
|||||||
@ -58,7 +58,7 @@ if ($_POST["action"] == 'update_public' && $user->rights->commande->creer)
|
|||||||
{
|
{
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$res=$commande->update_note_public($_POST["note_public"]);
|
$res=$commande->update_note_public($_POST["note_public"],$user);
|
||||||
if ($res < 0)
|
if ($res < 0)
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$commande->error.'</div>';
|
$mesg='<div class="error">'.$commande->error.'</div>';
|
||||||
@ -74,7 +74,7 @@ if ($_POST["action"] == 'update' && $user->rights->commande->creer)
|
|||||||
{
|
{
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$res=$commande->update_note($_POST["note"]);
|
$res=$commande->update_note($_POST["note"],$user);
|
||||||
if ($res < 0)
|
if ($res < 0)
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$commande->error.'</div>';
|
$mesg='<div class="error">'.$commande->error.'</div>';
|
||||||
|
|||||||
@ -762,6 +762,67 @@ class CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Update private note of element
|
||||||
|
* \param note New value for note
|
||||||
|
* \return int <0 if KO, >0 if OK
|
||||||
|
*/
|
||||||
|
function update_note($note)
|
||||||
|
{
|
||||||
|
if (! $this->table_element)
|
||||||
|
{
|
||||||
|
dolibarr_syslog("CommonObject::update_note was called on objet with property table_element not defined",LOG_ERR);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||||
|
$sql.= " SET note = '".addslashes($note)."'";
|
||||||
|
$sql.= " WHERE rowid =". $this->id;
|
||||||
|
|
||||||
|
dolibarr_syslog("CommonObject::update_note sql=".$sql);
|
||||||
|
if ($this->db->query($sql))
|
||||||
|
{
|
||||||
|
$this->note = $note;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->error=$this->db->error();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Update public note of element
|
||||||
|
* \param note_public New value for note
|
||||||
|
* \return int <0 if KO, >0 if OK
|
||||||
|
*/
|
||||||
|
function update_note_public($note_public)
|
||||||
|
{
|
||||||
|
if (! $this->table_element)
|
||||||
|
{
|
||||||
|
dolibarr_syslog("CommonObject::update_note_public was called on objet with property table_element not defined",LOG_ERR);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||||
|
$sql.= " SET note_public = '".addslashes($note_public)."'";
|
||||||
|
$sql.= " WHERE rowid =". $this->id;
|
||||||
|
|
||||||
|
dolibarr_syslog("CommonObject::update_note_public sql=".$sql);
|
||||||
|
if ($this->db->query($sql))
|
||||||
|
{
|
||||||
|
$this->note_public = $note_public;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->error=$this->db->error();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -57,7 +57,7 @@ if ($_POST["action"] == 'update_public' && $user->rights->facture->creer)
|
|||||||
{
|
{
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$res=$fac->update_note_public($_POST["note_public"]);
|
$res=$fac->update_note_public($_POST["note_public"],$user);
|
||||||
if ($res < 0)
|
if ($res < 0)
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$fac->error.'</div>';
|
$mesg='<div class="error">'.$fac->error.'</div>';
|
||||||
@ -73,7 +73,7 @@ if ($_POST["action"] == 'update' && $user->rights->facture->creer)
|
|||||||
{
|
{
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$res=$fac->update_note($_POST["note"]);
|
$res=$fac->update_note($_POST["note"],$user);
|
||||||
if ($res < 0)
|
if ($res < 0)
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$fac->error.'</div>';
|
$mesg='<div class="error">'.$fac->error.'</div>';
|
||||||
|
|||||||
@ -909,53 +909,6 @@ class Contrat extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Mets à jour les commentaires privés
|
|
||||||
* \param note Commentaire
|
|
||||||
* \return int <0 si ko, >0 si ok
|
|
||||||
*/
|
|
||||||
function update_note($note)
|
|
||||||
{
|
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'contrat';
|
|
||||||
$sql.= " SET note = '".addslashes($note)."'";
|
|
||||||
$sql.= " WHERE rowid =". $this->id;
|
|
||||||
|
|
||||||
if ($this->db->query($sql))
|
|
||||||
{
|
|
||||||
$this->note = $note;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->error=$this->db->error();
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Mets à jour les commentaires publiques
|
|
||||||
* \param note_public Commentaire
|
|
||||||
* \return int <0 si ko, >0 si ok
|
|
||||||
*/
|
|
||||||
function update_note_public($note_public)
|
|
||||||
{
|
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'contrat';
|
|
||||||
$sql.= " SET note_public = '".addslashes($note_public)."'";
|
|
||||||
$sql.= " WHERE rowid =". $this->id;
|
|
||||||
|
|
||||||
if ($this->db->query($sql))
|
|
||||||
{
|
|
||||||
$this->note_public = $note_public;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->error=$this->db->error();
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Retourne le libellé du statut du contrat
|
* \brief Retourne le libellé du statut du contrat
|
||||||
* \param mode 0=libellé long, 1=libellé court, 2=Picto + Libellé court, 3=Picto, 4=Picto + Libellé long, 5=Libellé court + Picto
|
* \param mode 0=libellé long, 1=libellé court, 2=Picto + Libellé court, 3=Picto, 4=Picto + Libellé long, 5=Libellé court + Picto
|
||||||
|
|||||||
@ -77,7 +77,7 @@ if ($_POST["action"] == 'update_public' && $user->rights->contrat->creer)
|
|||||||
{
|
{
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$res=$contrat->update_note_public($_POST["note_public"]);
|
$res=$contrat->update_note_public($_POST["note_public"],$user);
|
||||||
if ($res < 0)
|
if ($res < 0)
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$contrat->error.'</div>';
|
$mesg='<div class="error">'.$contrat->error.'</div>';
|
||||||
@ -93,7 +93,7 @@ if ($_POST["action"] == 'update' && $user->rights->contrat->creer)
|
|||||||
{
|
{
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$res=$contrat->update_note($_POST["note"]);
|
$res=$contrat->update_note($_POST["note"],$user);
|
||||||
if ($res < 0)
|
if ($res < 0)
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$contrat->error.'</div>';
|
$mesg='<div class="error">'.$contrat->error.'</div>';
|
||||||
|
|||||||
@ -108,8 +108,6 @@ class Facture extends CommonObject
|
|||||||
function Facture($DB, $socid='', $facid='')
|
function Facture($DB, $socid='', $facid='')
|
||||||
{
|
{
|
||||||
$this->db = $DB;
|
$this->db = $DB;
|
||||||
$this->table = 'facture';
|
|
||||||
$this->tabledetail = 'facturedet';
|
|
||||||
|
|
||||||
$this->id = $facid;
|
$this->id = $facid;
|
||||||
$this->socid = $socid;
|
$this->socid = $socid;
|
||||||
@ -2021,54 +2019,6 @@ class Facture extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Mets à jour les commentaires privés
|
|
||||||
* \param note Commentaire
|
|
||||||
* \return int <0 si ko, >0 si ok
|
|
||||||
*/
|
|
||||||
function update_note($note)
|
|
||||||
{
|
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table;
|
|
||||||
$sql.= " SET note = '".addslashes($note)."'";
|
|
||||||
$sql.= " WHERE rowid =". $this->id;
|
|
||||||
|
|
||||||
dolibarr_syslog("Facture.class::update_note sql=$sql");
|
|
||||||
if ($this->db->query($sql))
|
|
||||||
{
|
|
||||||
$this->note = $note;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->error=$this->db->error();
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Mets à jour les commentaires publiques
|
|
||||||
* \param note_public Commentaire
|
|
||||||
* \return int <0 si ko, >0 si ok
|
|
||||||
*/
|
|
||||||
function update_note_public($note_public)
|
|
||||||
{
|
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table;
|
|
||||||
$sql.= " SET note_public = '".addslashes($note_public)."'";
|
|
||||||
$sql.= " WHERE rowid =". $this->id;
|
|
||||||
|
|
||||||
dolibarr_syslog("Facture.class::update_note_public sql=$sql");
|
|
||||||
if ($this->db->query($sql))
|
|
||||||
{
|
|
||||||
$this->note_public = $note_public;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->error=$this->db->error();
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Charge les informations de l'onglet info dans l'objet facture
|
* \brief Charge les informations de l'onglet info dans l'objet facture
|
||||||
* \param id Id de la facture a charger
|
* \param id Id de la facture a charger
|
||||||
|
|||||||
@ -353,38 +353,12 @@ class Fichinter extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Mets a jour les commentaires publiques et prives
|
|
||||||
* \param note Commentaire
|
|
||||||
* \param type Type de note
|
|
||||||
* \return int <0 si ko, >0 si ok
|
|
||||||
*/
|
|
||||||
function update_note($note,$type)
|
|
||||||
{
|
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'fichinter';
|
|
||||||
$sql.= " SET ".$type." = '".addslashes($note)."'";
|
|
||||||
$sql.= " WHERE rowid =". $this->id;
|
|
||||||
|
|
||||||
dolibarr_syslog("Fichinter::update_note type=".$type." sql=".$sql);
|
|
||||||
|
|
||||||
if ($this->db->query($sql))
|
|
||||||
{
|
|
||||||
$this->$type = $type;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->error=$this->db->error();
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Information sur l'objet fiche intervention
|
* \brief Information sur l'objet fiche intervention
|
||||||
* \param id id de la fiche d'intervention
|
* \param id id de la fiche d'intervention
|
||||||
*/
|
*/
|
||||||
function info($id)
|
function info($id)
|
||||||
{
|
{
|
||||||
$sql = "SELECT f.rowid, ";
|
$sql = "SELECT f.rowid, ";
|
||||||
$sql.= $this->db->pdate("f.datec")." as datec, ".$this->db->pdate("f.date_valid")." as datev";
|
$sql.= $this->db->pdate("f.datec")." as datec, ".$this->db->pdate("f.date_valid")." as datev";
|
||||||
$sql.= ", f.fk_user_author, f.fk_user_valid";
|
$sql.= ", f.fk_user_author, f.fk_user_valid";
|
||||||
|
|||||||
@ -46,7 +46,7 @@ if ($_POST["action"] == 'update_public' && $user->rights->ficheinter->creer)
|
|||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$res=$fichinter->update_note($_POST["note_public"],'note_public');
|
$res=$fichinter->update_note_public($_POST["note_public"],$user);
|
||||||
if ($res < 0)
|
if ($res < 0)
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$fichinter->error.'</div>';
|
$mesg='<div class="error">'.$fichinter->error.'</div>';
|
||||||
@ -65,7 +65,7 @@ if ($_POST['action'] == 'update' && $user->rights->ficheinter->creer)
|
|||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$res=$fichinter->update_note($_POST["note_private"],'note_private');
|
$res=$fichinter->update_note($_POST["note_private"],$user);
|
||||||
if ($res < 0)
|
if ($res < 0)
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$fichinter->error.'</div>';
|
$mesg='<div class="error">'.$fichinter->error.'</div>';
|
||||||
|
|||||||
@ -58,7 +58,7 @@ if ($_POST["action"] == 'update_public' && $user->rights->facture->creer)
|
|||||||
{
|
{
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$res=$fac->update_note_public($_POST["note_public"]);
|
$res=$fac->update_note_public($_POST["note_public"],$user);
|
||||||
if ($res < 0)
|
if ($res < 0)
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$fac->error.'</div>';
|
$mesg='<div class="error">'.$fac->error.'</div>';
|
||||||
@ -74,7 +74,7 @@ if ($_POST["action"] == 'update' && $user->rights->fournisseur->facture->creer)
|
|||||||
{
|
{
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$res=$fac->update_note($_POST["note"]);
|
$res=$fac->update_note($_POST["note"],$user);
|
||||||
if ($res < 0)
|
if ($res < 0)
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$fac->error.'</div>';
|
$mesg='<div class="error">'.$fac->error.'</div>';
|
||||||
|
|||||||
@ -1462,55 +1462,6 @@ class Propal extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Mets <EFBFBD> jour les commentaires priv<EFBFBD>s
|
|
||||||
* \param note Commentaire
|
|
||||||
* \return int <0 si ko, >0 si ok
|
|
||||||
*/
|
|
||||||
function update_note($note)
|
|
||||||
{
|
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'propal';
|
|
||||||
$sql.= " SET note = '".addslashes($note)."'";
|
|
||||||
$sql.= " WHERE rowid =". $this->id;
|
|
||||||
|
|
||||||
dolibarr_syslog("Propal::update_note $sql");
|
|
||||||
|
|
||||||
if ($this->db->query($sql))
|
|
||||||
{
|
|
||||||
$this->note = $note;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->error=$this->db->error();
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Mets <EFBFBD> jour les commentaires publiques
|
|
||||||
* \param note_public Commentaire
|
|
||||||
* \return int <0 si ko, >0 si ok
|
|
||||||
*/
|
|
||||||
function update_note_public($note_public)
|
|
||||||
{
|
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'propal';
|
|
||||||
$sql.= " SET note_public = '".addslashes($note_public)."'";
|
|
||||||
$sql.= " WHERE rowid =". $this->id;
|
|
||||||
|
|
||||||
dolibarr_syslog("Propal::update_note_public $sql");
|
|
||||||
|
|
||||||
if ($this->db->query($sql))
|
|
||||||
{
|
|
||||||
$this->note_public = $note_public;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->error=$this->db->error();
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Change les conditions de r<EFBFBD>glement de la facture
|
* \brief Change les conditions de r<EFBFBD>glement de la facture
|
||||||
|
|||||||
@ -1074,43 +1074,14 @@ class User extends CommonObject
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Fonction qui met a jour le commentaire d'un utilisateur
|
|
||||||
\param note Note
|
|
||||||
\param user Utilisateur qui realise la mise a jour
|
|
||||||
\return int <0 si KO, >0 si OK
|
|
||||||
*/
|
|
||||||
function update_note($note,$user)
|
|
||||||
{
|
|
||||||
$this->db->begin();
|
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."user SET";
|
|
||||||
$sql.= " note='".addslashes($note)."'";
|
|
||||||
$sql.= " WHERE rowid = ".$this->id;
|
|
||||||
|
|
||||||
dolibarr_syslog("User::update_note sql=$sql");
|
|
||||||
$result = $this->db->query($sql);
|
|
||||||
if (! $result)
|
|
||||||
{
|
|
||||||
$this->error=$this->db->error();
|
|
||||||
$this->db->rollback();
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->note = $note;
|
|
||||||
|
|
||||||
$this->db->commit();
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Mise e jour en base de la date de deniere connexion d'un utilisateur
|
* \brief Mise e jour en base de la date de deniere connexion d'un utilisateur
|
||||||
* Fonction appelee lors d'une nouvelle connexion
|
* Fonction appelee lors d'une nouvelle connexion
|
||||||
* \return <0 si echec, >=0 si ok
|
* \return <0 si echec, >=0 si ok
|
||||||
*/
|
*/
|
||||||
function update_last_login_date()
|
function update_last_login_date()
|
||||||
{
|
{
|
||||||
dolibarr_syslog ("Mise a jour date derniere connexion pour user->id=".$this->id);
|
dolibarr_syslog ("Mise a jour date derniere connexion pour user->id=".$this->id);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user