From b496436fe3023fd5137684966787a40bdc31a917 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Apr 2013 10:58:38 +0200 Subject: [PATCH] Qual: Reduce number of methods. Mutualize update_note code. --- htdocs/adherents/note.php | 2 +- htdocs/adherents/type.php | 2 +- htdocs/categories/class/categorie.class.php | 39 +---------- htdocs/comm/propal.php | 4 +- htdocs/comm/propal/note.php | 4 +- htdocs/commande/fiche.php | 2 +- htdocs/commande/note.php | 4 +- htdocs/compta/deplacement/fiche.php | 4 +- htdocs/compta/facture.php | 4 +- htdocs/compta/facture/note.php | 4 +- htdocs/contrat/fiche.php | 4 +- htdocs/contrat/note.php | 4 +- htdocs/core/class/commonobject.class.php | 78 ++++----------------- htdocs/expedition/note.php | 4 +- htdocs/fichinter/fiche.php | 2 +- htdocs/fichinter/note.php | 4 +- htdocs/fourn/commande/fiche.php | 4 +- htdocs/fourn/commande/note.php | 2 +- htdocs/fourn/facture/fiche.php | 4 +- htdocs/fourn/facture/note.php | 4 +- htdocs/projet/class/project.class.php | 2 +- htdocs/projet/class/task.class.php | 2 +- htdocs/projet/note.php | 2 +- htdocs/projet/tasks/note.php | 2 +- htdocs/societe/note.php | 4 +- test/phpunit/CategorieTest.php | 4 -- 26 files changed, 52 insertions(+), 143 deletions(-) diff --git a/htdocs/adherents/note.php b/htdocs/adherents/note.php index c021ab5a373..d92447434d4 100644 --- a/htdocs/adherents/note.php +++ b/htdocs/adherents/note.php @@ -54,7 +54,7 @@ if ($action == 'update' && $user->rights->adherent->creer && ! $_POST["cancel"]) { $db->begin(); - $res=$object->update_note($_POST["note"],$user); + $res=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES)); if ($res < 0) { setEventMessage($object->error, 'errors'); diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index deb32ce29d0..2120d2d2a83 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -146,7 +146,7 @@ if ($action == 'commentaire' && $user->rights->adherent->configurer) { $don = new Don($db); $don->fetch($rowid); - $don->update_note($_POST["commentaire"]); + $don->update_note(dol_html_entity_decode(GETPOST('commentaire'), ENT_QUOTES)); } diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index c2c249f5e41..96c111f2dc0 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -477,7 +477,7 @@ class Categorie /** - * Retourne les filles de la categorie + * Return childs of a category * * @return void */ @@ -507,43 +507,6 @@ class Categorie } - /** - * Return category description - * - * @param int $cate Category id - * @return string Description - * @deprecated function not used ? - */ - function get_desc($cate) - { - $sql = "SELECT description FROM ".MAIN_DB_PREFIX."categorie"; - $sql.= " WHERE rowid = ".$cate; - - $res = $this->db->query($sql); - $n = $this->db->fetch_array($res); - - return($n[0]); - } - - /** - * La categorie $fille est-elle une fille de cette categorie ? - * - * @param Category $child Object category - * @return void - * @deprecated function not used ? - */ - function is_fille($child) - { - $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."categorie"; - $sql.= " WHERE fk_parent = ".$this->id." AND rowid = ".$child->id; - - $res = $this->db->query($sql); - $n = $this->db->fetch_array($res); - - return ($n[0] > 0); - } - - /** * Load this->motherof that is array(id_son=>id_parent, ...) * diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index b27609b6b28..9c77da67765 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -234,13 +234,13 @@ else if ($action == 'set_ref_client' && $user->rights->propal->creer) else if ($action == 'setnote_public' && $user->rights->propal->creer) { - $result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES)); + $result=$object->update_note(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES),'_public'); if ($result < 0) dol_print_error($db,$object->error); } else if ($action == 'setnote_private' && $user->rights->propal->creer) { - $result=$object->update_note_private(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES)); + $result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES),'_private'); if ($result < 0) dol_print_error($db,$object->error); } diff --git a/htdocs/comm/propal/note.php b/htdocs/comm/propal/note.php index 663530a92c9..09670340b89 100644 --- a/htdocs/comm/propal/note.php +++ b/htdocs/comm/propal/note.php @@ -51,14 +51,14 @@ $object = new Propal($db); if ($action == 'setnote_public' && $user->rights->propale->creer) { $object->fetch($id); - $result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES)); + $result=$object->update_note(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES),'_public'); if ($result < 0) dol_print_error($db,$object->error); } else if ($action == 'setnote_private' && $user->rights->propale->creer) { $object->fetch($id); - $result=$object->update_note_private(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES)); + $result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES),'_private'); if ($result < 0) dol_print_error($db,$object->error); } diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index af01fcd87c0..ce25c5cab31 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -535,7 +535,7 @@ else if ($action == 'setremiseabsolue' && $user->rights->commande->creer) else if ($action == 'setnote_public' && $user->rights->commande->creer) { - $result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES)); + $result=$object->update_note(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES),'_public'); if ($result < 0) dol_print_error($db,$object->error); } diff --git a/htdocs/commande/note.php b/htdocs/commande/note.php index 29078518237..c9ca34854b7 100644 --- a/htdocs/commande/note.php +++ b/htdocs/commande/note.php @@ -58,14 +58,14 @@ if (! $object->fetch($id, $ref) > 0) if ($action == 'setnote_public' && $user->rights->commande->creer) { $object->fetch($id); - $result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES)); + $result=$object->update_note(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES),'_public'); if ($result < 0) dol_print_error($db,$object->error); } else if ($action == 'setnote_private' && $user->rights->commande->creer) { $object->fetch($id); - $result=$object->update_note_private(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES)); + $result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES),'_private'); if ($result < 0) dol_print_error($db,$object->error); } diff --git a/htdocs/compta/deplacement/fiche.php b/htdocs/compta/deplacement/fiche.php index c7a7c6b7a2e..b09754c2405 100644 --- a/htdocs/compta/deplacement/fiche.php +++ b/htdocs/compta/deplacement/fiche.php @@ -235,13 +235,13 @@ else if ($action == 'setkm' && $user->rights->deplacement->creer) else if ($action == 'setnote_public' && $user->rights->deplacement->creer) { $object->fetch($id); - $result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES)); + $result=$object->update_note(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES),'_public'); if ($result < 0) dol_print_error($db, $object->error); } else if ($action == 'setnote_private' && $user->rights->deplacement->creer) { $object->fetch($id); - $result=$object->update_note_private(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES)); + $result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES),'_private'); if ($result < 0) dol_print_error($db, $object->error); } diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 7248e124b46..4c85064e427 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -353,14 +353,14 @@ else if ($action == 'set_ref_client' && $user->rights->facture->creer) else if ($action == 'setnote_public' && $user->rights->facture->creer) { $object->fetch($id); - $result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES)); + $result=$object->update_note(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES),'_public'); if ($result < 0) dol_print_error($db,$object->error); } else if ($action == 'setnote_private' && $user->rights->facture->creer) { $object->fetch($id); - $result=$object->update_note_private(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES)); + $result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES),'_private'); if ($result < 0) dol_print_error($db,$object->error); } diff --git a/htdocs/compta/facture/note.php b/htdocs/compta/facture/note.php index 484dff7020f..6092ba39e85 100644 --- a/htdocs/compta/facture/note.php +++ b/htdocs/compta/facture/note.php @@ -53,14 +53,14 @@ $object->fetch($id); if ($action == 'setnote_public' && $user->rights->facture->creer) { $object->fetch($id); - $result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES)); + $result=$object->update_note(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES),'_public'); if ($result < 0) dol_print_error($db,$object->error); } else if ($action == 'setnote_private' && $user->rights->facture->creer) { $object->fetch($id); - $result=$object->update_note_private(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES)); + $result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES),'_private'); if ($result < 0) dol_print_error($db,$object->error); } diff --git a/htdocs/contrat/fiche.php b/htdocs/contrat/fiche.php index 368971e6ea4..d3ef925158b 100644 --- a/htdocs/contrat/fiche.php +++ b/htdocs/contrat/fiche.php @@ -658,13 +658,13 @@ else if ($action == 'confirm_move' && $confirm == 'yes' && $user->rights->contra else if ($action == 'setnote_public' && $user->rights->contrat->creer) { - $result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES)); + $result=$object->update_note(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES),'_public'); if ($result < 0) dol_print_error($db,$object->error); } else if ($action == 'setnote_private' && $user->rights->contrat->creer) { - $result=$object->update_note_private(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES)); + $result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES),'_private'); if ($result < 0) dol_print_error($db,$object->error); } diff --git a/htdocs/contrat/note.php b/htdocs/contrat/note.php index cf347cf2973..ee66e4583f7 100644 --- a/htdocs/contrat/note.php +++ b/htdocs/contrat/note.php @@ -50,13 +50,13 @@ $object->fetch($id,$ref); if ($action == 'setnote_public' && $user->rights->contrat->creer) { - $result=$object->update_note_public(dol_html_entity_decode(dol_htmlcleanlastbr(GETPOST('note_public')), ENT_QUOTES)); + $result=$object->update_note(dol_html_entity_decode(dol_htmlcleanlastbr(GETPOST('note_public')), ENT_QUOTES),'_pubic'); if ($result < 0) dol_print_error($db,$object->error); } else if ($action == 'setnote_private' && $user->rights->contrat->creer) { - $result=$object->update_note_private(dol_html_entity_decode(dol_htmlcleanlastbr(GETPOST('note_private')), ENT_QUOTES)); + $result=$object->update_note(dol_html_entity_decode(dol_htmlcleanlastbr(GETPOST('note_private')), ENT_QUOTES),'_private'); if ($result < 0) dol_print_error($db,$object->error); } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index ea60874d2ca..b5d49b77dea 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1400,44 +1400,13 @@ abstract class CommonObject } /** - * Update private note of element + * Update note of element * - * @param string $note_private New value for note - * @return int <0 if KO, >0 if OK + * @param string $note New value for note + * @param string $suffix '', '_public' or '_private' + * @return int <0 if KO, >0 if OK */ - function update_note_private($note_private) - { - if (! $this->table_element) - { - dol_syslog(get_class($this)."::update_note_private 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_private = ".(!empty($note_private)?("'".$this->db->escape($note_private)."'"):"NULL"); - $sql.= " WHERE rowid =". $this->id; - - dol_syslog(get_class($this)."::update_note_private sql=".$sql, LOG_DEBUG); - if ($this->db->query($sql)) - { - $this->note_private = $note_private; - return 1; - } - else - { - $this->error=$this->db->error(); - dol_syslog(get_class($this)."::update_note_private error=".$this->error, LOG_ERR); - return -1; - } - } - - /** - * Update private note of element - * - * @param string $note New value for note - * @return int <0 if KO, >0 if OK - */ - function update_note($note) + function update_note($note,$suffix='') { if (! $this->table_element) { @@ -1446,7 +1415,7 @@ abstract class CommonObject } $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; - $sql.= " SET note = ".(!empty($note)?("'".$this->db->escape($note)."'"):"NULL"); + $sql.= " SET note".$suffix." = ".(!empty($note)?("'".$this->db->escape($note)."'"):"NULL"); $sql.= " WHERE rowid =". $this->id; dol_syslog(get_class($this)."::update_note sql=".$sql, LOG_DEBUG); @@ -1464,36 +1433,17 @@ abstract class CommonObject } /** - * Update public note of element - * - * @param string $note_public New value for note - * @return int <0 if KO, >0 if OK + * Update public note (kept for backward compatibility) + * + * @param string $note New value for note + * @return int <0 if KO, >0 if OK + * @deprecated */ - function update_note_public($note_public) + function update_note_public($note) { - if (! $this->table_element) - { - dol_syslog(get_class($this)."::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 = ".(!empty($note_public)?("'".$this->db->escape($note_public)."'"):"NULL"); - $sql.= " WHERE rowid =". $this->id; - - dol_syslog(get_class($this)."::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; - } + return $this->update_note($note,'_public'); } - + /** * Update total_ht, total_ttc and total_vat for an object (sum of lines) * diff --git a/htdocs/expedition/note.php b/htdocs/expedition/note.php index 17613c72b58..2fcd18fef13 100644 --- a/htdocs/expedition/note.php +++ b/htdocs/expedition/note.php @@ -61,14 +61,14 @@ $object->fetch($id); if ($action == 'setnote_public' && $user->rights->facture->creer) { $object->fetch($id); - $result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES)); + $result=$object->update_note(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES),'_public'); if ($result < 0) dol_print_error($db,$object->error); } else if ($action == 'setnote_private' && $user->rights->facture->creer) { $object->fetch($id); - $result=$object->update_note_private(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES)); + $result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES),'_private'); if ($result < 0) dol_print_error($db,$object->error); } diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php index 3886edb30f9..4e8b9e2b1d8 100644 --- a/htdocs/fichinter/fiche.php +++ b/htdocs/fichinter/fiche.php @@ -380,7 +380,7 @@ else if ($action == 'setdescription' && $user->rights->ficheinter->creer) else if ($action == 'setnote_public' && $user->rights->ficheinter->creer) { $object->fetch($id); - $result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES)); + $result=$object->update_note(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES),'_public'); if ($result < 0) dol_print_error($db,$object->error); } else if ($action == 'setnote_private' && $user->rights->ficheinter->creer) diff --git a/htdocs/fichinter/note.php b/htdocs/fichinter/note.php index a2de821e6c7..3b7e8b5c960 100644 --- a/htdocs/fichinter/note.php +++ b/htdocs/fichinter/note.php @@ -48,13 +48,13 @@ $object->fetch($id,$ref); if ($action == 'setnote_public' && $user->rights->ficheinter->creer) { - $result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES)); + $result=$object->update_note(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES),'_public'); if ($result < 0) dol_print_error($db,$object->error); } else if ($action == 'setnote_private' && $user->rights->ficheinter->creer) { - $result=$object->update_note_private(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES)); + $result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES),'_private'); if ($result < 0) dol_print_error($db,$object->error); } diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index 7a5128cca45..2be0c23e78b 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -140,13 +140,13 @@ else if ($action == 'setremisepercent' && $user->rights->fournisseur->commande-> else if ($action == 'setnote_public' && $user->rights->fournisseur->commande->creer) { - $result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES)); + $result=$object->update_note(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES),'_public'); if ($result < 0) dol_print_error($db,$object->error); } else if ($action == 'setnote_private' && $user->rights->fournisseur->commande->creer) { - $result=$object->update_note_private(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES)); + $result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES),'_private'); if ($result < 0) dol_print_error($db,$object->error); } diff --git a/htdocs/fourn/commande/note.php b/htdocs/fourn/commande/note.php index 63cd69a89a0..7d4fa0cd496 100644 --- a/htdocs/fourn/commande/note.php +++ b/htdocs/fourn/commande/note.php @@ -51,7 +51,7 @@ $object->fetch($id, $ref); if ($action == 'setnote_public' && $user->rights->fournisseur->commande->creer) { - $result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES)); + $result=$object->update_note(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES),'_public'); if ($result < 0) dol_print_error($db,$object->error); } elseif ($action == 'setnote' && $user->rights->fournisseur->commande->creer) diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index 4393023f07c..d85bd03e067 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -211,13 +211,13 @@ elseif ($action == 'setdate_lim_reglement' && $user->rights->fournisseur->factur elseif ($action == 'setnote_public' && $user->rights->fournisseur->facture->creer) { $object->fetch($id); - $result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES)); + $result=$object->update_note(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES),'_public'); if ($result < 0) dol_print_error($db,$object->error); } elseif ($action == 'setnote_private' && $user->rights->fournisseur->facture->creer) { $object->fetch($id); - $result=$object->update_note_private(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES)); + $result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES),'_private'); if ($result < 0) dol_print_error($db,$object->error); } diff --git a/htdocs/fourn/facture/note.php b/htdocs/fourn/facture/note.php index 834858788e9..116d0ce1c8b 100644 --- a/htdocs/fourn/facture/note.php +++ b/htdocs/fourn/facture/note.php @@ -51,12 +51,12 @@ $object->fetch($id,$ref); if ($action == 'setnote_public' && $user->rights->fournisseur->facture->creer) { - $result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES)); + $result=$object->update_note(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES),'_public'); if ($result < 0) dol_print_error($db,$object->error); } elseif ($action == 'setnote_private' && $user->rights->fournisseur->facture->creer) { - $result=$object->update_note_private(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES)); + $result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES),'_private'); if ($result < 0) dol_print_error($db,$object->error); } diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index d2864b08c11..b02b29eaa69 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -1011,7 +1011,7 @@ class Project extends CommonObject else { $this->db->begin(); - $res=$clone_project->update_note_public(dol_html_entity_decode($clone_project->note_public, ENT_QUOTES)); + $res=$clone_project->update_note(dol_html_entity_decode($clone_project->note_public, ENT_QUOTES),'_public'); if ($res < 0) { $this->error.=$clone_project->error; diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index f28e5d27e6d..d09647347e5 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -1027,7 +1027,7 @@ class Task extends CommonObject else { $this->db->begin(); - $res=$clone_task->update_note_public(dol_html_entity_decode($clone_task->note_public, ENT_QUOTES)); + $res=$clone_task->update_note(dol_html_entity_decode($clone_task->note_public, ENT_QUOTES),'_public'); if ($res < 0) { $this->error.=$clone_task->error; diff --git a/htdocs/projet/note.php b/htdocs/projet/note.php index e785cf778ab..26eafbc16d2 100644 --- a/htdocs/projet/note.php +++ b/htdocs/projet/note.php @@ -56,7 +56,7 @@ $result = restrictedArea($user, 'projet', $id); if ($action == 'setnote_public' && $user->rights->projet->creer) { $object->fetch($id); - $result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES)); + $result=$object->update_note(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES),'_public'); if ($result < 0) dol_print_error($db,$object->error); } diff --git a/htdocs/projet/tasks/note.php b/htdocs/projet/tasks/note.php index 6d5f9f666e9..9931bde0510 100644 --- a/htdocs/projet/tasks/note.php +++ b/htdocs/projet/tasks/note.php @@ -87,7 +87,7 @@ $permission=($user->rights->projet->creer || $user->rights->projet->all->creer); if ($action == 'setnote_public' && ! empty($permission)) { - $result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES)); + $result=$object->update_note(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES),'_public'); if ($result < 0) dol_print_error($db,$object->error); } diff --git a/htdocs/societe/note.php b/htdocs/societe/note.php index 0d09f21da25..e24fa8a8cdc 100644 --- a/htdocs/societe/note.php +++ b/htdocs/societe/note.php @@ -55,14 +55,14 @@ if ($id > 0) $object->fetch($id); if ($action == 'setnote_public' && $user->rights->propale->creer) { $object->fetch($id); - $result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES)); + $result=$object->update_note(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES),'_public'); if ($result < 0) setEventMessage($object->error,'errors'); } else if ($action == 'setnote_private' && $user->rights->propale->creer) { $object->fetch($id); - $result=$object->update_note_private(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES)); + $result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES),'_private'); if ($result < 0) setEventMessage($object->error,'errors'); } diff --git a/test/phpunit/CategorieTest.php b/test/phpunit/CategorieTest.php index 128a52796df..501781b309d 100755 --- a/test/phpunit/CategorieTest.php +++ b/test/phpunit/CategorieTest.php @@ -276,10 +276,6 @@ class CategorieTest extends PHPUnit_Framework_TestCase print __METHOD__." retarray size=".count($retarray)."\n"; $this->assertTrue(is_array($retarray)); - $retarray=$localobject->is_fille($localobject2); - print __METHOD__." retarry size=".count($retarray)."\n"; - $this->assertFalse($retarray); - return $localobject->id; }