diff --git a/htdocs/adherents/adherent.class.php b/htdocs/adherents/adherent.class.php
index 9120b1c0b45..859e2c513f5 100644
--- a/htdocs/adherents/adherent.class.php
+++ b/htdocs/adherents/adherent.class.php
@@ -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)
\param user Utilisateur qui realise la mise a jour
diff --git a/htdocs/comm/propal/note.php b/htdocs/comm/propal/note.php
index f9f8661a8c6..f1fa6103d85 100644
--- a/htdocs/comm/propal/note.php
+++ b/htdocs/comm/propal/note.php
@@ -52,7 +52,7 @@ if ($_POST["action"] == 'update_public' && $user->rights->propale->creer)
$db->begin();
- $res=$propal->update_note_public($_POST["note_public"]);
+ $res=$propal->update_note_public($_POST["note_public"],$user);
if ($res < 0)
{
$mesg='
'.$propal->error.'
';
@@ -71,7 +71,7 @@ if ($_POST['action'] == 'update' && $user->rights->propale->creer)
$db->begin();
- $res=$propal->update_note($_POST["note"]);
+ $res=$propal->update_note($_POST["note"],$user);
if ($res < 0)
{
$mesg=''.$propal->error.'
';
diff --git a/htdocs/commande/commande.class.php b/htdocs/commande/commande.class.php
index bcef788a424..c6c948c5ed2 100644
--- a/htdocs/commande/commande.class.php
+++ b/htdocs/commande/commande.class.php
@@ -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
diff --git a/htdocs/commande/note.php b/htdocs/commande/note.php
index d3c41e109c5..7a922424024 100644
--- a/htdocs/commande/note.php
+++ b/htdocs/commande/note.php
@@ -58,7 +58,7 @@ if ($_POST["action"] == 'update_public' && $user->rights->commande->creer)
{
$db->begin();
- $res=$commande->update_note_public($_POST["note_public"]);
+ $res=$commande->update_note_public($_POST["note_public"],$user);
if ($res < 0)
{
$mesg=''.$commande->error.'
';
@@ -74,7 +74,7 @@ if ($_POST["action"] == 'update' && $user->rights->commande->creer)
{
$db->begin();
- $res=$commande->update_note($_POST["note"]);
+ $res=$commande->update_note($_POST["note"],$user);
if ($res < 0)
{
$mesg=''.$commande->error.'
';
diff --git a/htdocs/commonobject.class.php b/htdocs/commonobject.class.php
index 4ec2844f156..ac2476282bc 100644
--- a/htdocs/commonobject.class.php
+++ b/htdocs/commonobject.class.php
@@ -326,17 +326,17 @@ class CommonObject
return $result;
}
- /**
+ /**
* \brief Charge le contact d'id $id dans this->contact
* \param contactid Id du contact
* \return int <0 if KO, >0 if OK
*/
- function fetch_contact($contactid)
- {
+ function fetch_contact($contactid)
+ {
require_once(DOL_DOCUMENT_ROOT."/contact.class.php");
- $contact = new Contact($this->db);
- $result=$contact->fetch($contactid);
- $this->contact = $contact;
+ $contact = new Contact($this->db);
+ $result=$contact->fetch($contactid);
+ $this->contact = $contact;
return $result;
}
@@ -364,19 +364,19 @@ class CommonObject
return $result;
}
- /**
+ /**
* \brief Charge le user d'id userid dans this->user
* \param userid Id du contact
* \return int <0 if KO, >0 if OK
*/
- function fetch_user($userid)
- {
- $user = new User($this->db, $userid);
+ function fetch_user($userid)
+ {
+ $user = new User($this->db, $userid);
$result=$user->fetch();
- $this->user = $user;
+ $this->user = $user;
return $result;
}
-
+
/**
* \brief Charge l'adresse de livraison d'id $this->adresse_livraison_id dans this->deliveryaddress
* \param userid Id du contact
@@ -389,7 +389,7 @@ class CommonObject
$this->deliveryaddress = $address;
return $result;
}
-
+
/**
* \brief Retourne la liste déroulante des sociétés
* \param object Fetch du document
@@ -400,7 +400,7 @@ class CommonObject
function selectCompaniesForNewContact($object, $var_id, $selected = '', $htmlname = 'newcompany')
{
global $conf, $langs;
-
+
// On recherche les societes
$sql = "SELECT s.rowid, s.nom FROM";
$sql .= " ".MAIN_DB_PREFIX."societe as s";
@@ -476,9 +476,9 @@ class CommonObject
}
}
-
+
/**
- *
+ *
*/
function selectTypeContact($object, $defValue, $htmlname = 'type', $source)
{
@@ -521,7 +521,7 @@ class CommonObject
$row = $this->db->fetch_row($result);
$this->ref_previous = $row[0];
-
+
$sql = "SELECT MIN(".$fieldid.")";
$sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element;
$sql.= " WHERE ".$fieldid." > '".addslashes($this->ref)."'";
@@ -537,11 +537,11 @@ class CommonObject
}
$row = $this->db->fetch_row($result);
$this->ref_next = $row[0];
-
+
return 1;
}
-
-
+
+
/**
* \brief On récupère les id de liste_contact
* \param source Source du contact external (llx_socpeople) ou internal (llx_user)
@@ -561,7 +561,7 @@ class CommonObject
return $contactAlreadySelected;
}
-
+
/**
* \brief Link ekement with a project
* \param projid Project id to link element to
@@ -579,7 +579,7 @@ class CommonObject
if ($projid) $sql.= ' SET fk_projet = '.$projid;
else $sql.= ' SET fk_projet = NULL';
$sql.= ' WHERE rowid = '.$this->id;
-
+
dolibarr_syslog("CommonObject::set_project sql=".$sql);
if ($this->db->query($sql))
{
@@ -592,7 +592,7 @@ class CommonObject
}
}
-
+
/**
* \brief Set last model used by doc generator
* \param user User object that make change
@@ -626,8 +626,8 @@ class CommonObject
return 0;
}
}
-
-
+
+
/**
* \brief Stocke un numéro de rang pour toutes les lignes de
* detail d'une facture qui n'en ont pas.
@@ -761,7 +761,68 @@ class CommonObject
dolibarr_print_error($this->db);
}
}
- }
+ }
+
+ /**
+ * \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;
+ }
+ }
+
}
?>
diff --git a/htdocs/compta/facture/note.php b/htdocs/compta/facture/note.php
index 701a5da5e90..164582d9019 100644
--- a/htdocs/compta/facture/note.php
+++ b/htdocs/compta/facture/note.php
@@ -57,7 +57,7 @@ if ($_POST["action"] == 'update_public' && $user->rights->facture->creer)
{
$db->begin();
- $res=$fac->update_note_public($_POST["note_public"]);
+ $res=$fac->update_note_public($_POST["note_public"],$user);
if ($res < 0)
{
$mesg=''.$fac->error.'
';
@@ -73,7 +73,7 @@ if ($_POST["action"] == 'update' && $user->rights->facture->creer)
{
$db->begin();
- $res=$fac->update_note($_POST["note"]);
+ $res=$fac->update_note($_POST["note"],$user);
if ($res < 0)
{
$mesg=''.$fac->error.'
';
diff --git a/htdocs/contrat/contrat.class.php b/htdocs/contrat/contrat.class.php
index 14c7d227c96..c3d9edf84e1 100644
--- a/htdocs/contrat/contrat.class.php
+++ b/htdocs/contrat/contrat.class.php
@@ -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
* \param mode 0=libellé long, 1=libellé court, 2=Picto + Libellé court, 3=Picto, 4=Picto + Libellé long, 5=Libellé court + Picto
diff --git a/htdocs/contrat/note.php b/htdocs/contrat/note.php
index a9de39dcdd3..aa623cc2f5a 100644
--- a/htdocs/contrat/note.php
+++ b/htdocs/contrat/note.php
@@ -77,7 +77,7 @@ if ($_POST["action"] == 'update_public' && $user->rights->contrat->creer)
{
$db->begin();
- $res=$contrat->update_note_public($_POST["note_public"]);
+ $res=$contrat->update_note_public($_POST["note_public"],$user);
if ($res < 0)
{
$mesg=''.$contrat->error.'
';
@@ -93,7 +93,7 @@ if ($_POST["action"] == 'update' && $user->rights->contrat->creer)
{
$db->begin();
- $res=$contrat->update_note($_POST["note"]);
+ $res=$contrat->update_note($_POST["note"],$user);
if ($res < 0)
{
$mesg=''.$contrat->error.'
';
diff --git a/htdocs/facture.class.php b/htdocs/facture.class.php
index 2fb825bda6f..70ad7f2e49c 100644
--- a/htdocs/facture.class.php
+++ b/htdocs/facture.class.php
@@ -108,8 +108,6 @@ class Facture extends CommonObject
function Facture($DB, $socid='', $facid='')
{
$this->db = $DB;
- $this->table = 'facture';
- $this->tabledetail = 'facturedet';
$this->id = $facid;
$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
* \param id Id de la facture a charger
diff --git a/htdocs/fichinter/fichinter.class.php b/htdocs/fichinter/fichinter.class.php
index 98c2e953773..b0b1bf013ca 100644
--- a/htdocs/fichinter/fichinter.class.php
+++ b/htdocs/fichinter/fichinter.class.php
@@ -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
- * \param id id de la fiche d'intervention
- */
- function info($id)
- {
+ * \brief Information sur l'objet fiche intervention
+ * \param id id de la fiche d'intervention
+ */
+ function info($id)
+ {
$sql = "SELECT f.rowid, ";
$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";
diff --git a/htdocs/fichinter/note.php b/htdocs/fichinter/note.php
index 586fce8e18f..2051bf5b300 100644
--- a/htdocs/fichinter/note.php
+++ b/htdocs/fichinter/note.php
@@ -46,7 +46,7 @@ if ($_POST["action"] == 'update_public' && $user->rights->ficheinter->creer)
$db->begin();
- $res=$fichinter->update_note($_POST["note_public"],'note_public');
+ $res=$fichinter->update_note_public($_POST["note_public"],$user);
if ($res < 0)
{
$mesg=''.$fichinter->error.'
';
@@ -65,7 +65,7 @@ if ($_POST['action'] == 'update' && $user->rights->ficheinter->creer)
$db->begin();
- $res=$fichinter->update_note($_POST["note_private"],'note_private');
+ $res=$fichinter->update_note($_POST["note_private"],$user);
if ($res < 0)
{
$mesg=''.$fichinter->error.'
';
diff --git a/htdocs/fourn/facture/note.php b/htdocs/fourn/facture/note.php
index 0ae2598b07a..6e45c962ea9 100644
--- a/htdocs/fourn/facture/note.php
+++ b/htdocs/fourn/facture/note.php
@@ -58,7 +58,7 @@ if ($_POST["action"] == 'update_public' && $user->rights->facture->creer)
{
$db->begin();
- $res=$fac->update_note_public($_POST["note_public"]);
+ $res=$fac->update_note_public($_POST["note_public"],$user);
if ($res < 0)
{
$mesg=''.$fac->error.'
';
@@ -74,7 +74,7 @@ if ($_POST["action"] == 'update' && $user->rights->fournisseur->facture->creer)
{
$db->begin();
- $res=$fac->update_note($_POST["note"]);
+ $res=$fac->update_note($_POST["note"],$user);
if ($res < 0)
{
$mesg=''.$fac->error.'
';
diff --git a/htdocs/propal.class.php b/htdocs/propal.class.php
index 0a13a637dca..58018d89952 100644
--- a/htdocs/propal.class.php
+++ b/htdocs/propal.class.php
@@ -1462,55 +1462,6 @@ class Propal 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.'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 � 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�glement de la facture
diff --git a/htdocs/user.class.php b/htdocs/user.class.php
index 4dbbafec074..90dc8fdb147 100644
--- a/htdocs/user.class.php
+++ b/htdocs/user.class.php
@@ -1074,43 +1074,14 @@ class User extends CommonObject
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
- * Fonction appelee lors d'une nouvelle connexion
- * \return <0 si echec, >=0 si ok
- */
- function update_last_login_date()
+ /**
+ * \brief Mise e jour en base de la date de deniere connexion d'un utilisateur
+ * Fonction appelee lors d'une nouvelle connexion
+ * \return <0 si echec, >=0 si ok
+ */
+ function update_last_login_date()
{
dolibarr_syslog ("Mise a jour date derniere connexion pour user->id=".$this->id);