From 275bf67bb7f936783afce8e6fffcfb1b5e77dfec Mon Sep 17 00:00:00 2001 From: fhenry <florian.henry@open-concept.pro> Date: Tue, 9 Apr 2013 17:18:07 +0200 Subject: [PATCH] [ task #811 ] Uniformanize note field --- htdocs/comm/propal.php | 7 +- htdocs/comm/propal/class/propal.class.php | 15 +- htdocs/comm/propal/note.php | 5 +- htdocs/commande/class/commande.class.php | 11 +- htdocs/commande/fiche.php | 14 +- htdocs/commande/note.php | 5 +- .../deplacement/class/deplacement.class.php | 9 +- htdocs/compta/deplacement/fiche.php | 7 +- htdocs/compta/dons/class/don.class.php | 23 +- htdocs/compta/dons/fiche.php | 14 +- htdocs/compta/facture.php | 35 +-- .../facture/class/facture-rec.class.php | 14 +- htdocs/compta/facture/class/facture.class.php | 15 +- htdocs/compta/facture/fiche-rec.php | 7 +- htdocs/compta/facture/list.php | 5 +- htdocs/compta/facture/note.php | 5 +- htdocs/contact/class/contact.class.php | 16 +- htdocs/contact/fiche.php | 58 +++-- htdocs/contrat/class/contrat.class.php | 13 +- htdocs/contrat/fiche.php | 29 +-- htdocs/contrat/note.php | 4 +- htdocs/core/class/commonobject.class.php | 55 +++-- htdocs/core/lib/company.lib.php | 5 +- htdocs/core/lib/sendings.lib.php | 5 + .../doc/pdf_expedition_merou.modules.php | 22 ++ htdocs/core/tpl/notes.tpl.php | 17 +- htdocs/expedition/class/expedition.class.php | 20 +- htdocs/expedition/fiche.php | 20 +- htdocs/expedition/note.php | 160 ++++++++++++++ htdocs/fichinter/fiche.php | 12 +- htdocs/fichinter/note.php | 3 +- .../class/fournisseur.commande.class.php | 9 +- .../fourn/class/fournisseur.facture.class.php | 13 +- htdocs/fourn/commande/fiche.php | 34 +-- htdocs/fourn/facture/fiche.php | 28 ++- htdocs/fourn/facture/note.php | 199 +++++++++--------- htdocs/holiday/class/holiday.class.php | 5 +- .../install/mysql/migration/3.3.0-3.4.0.sql | 16 ++ htdocs/install/mysql/tables/llx_commande.sql | 2 +- .../mysql/tables/llx_commande_fournisseur.sql | 4 +- htdocs/install/mysql/tables/llx_contrat.sql | 2 +- .../install/mysql/tables/llx_deplacement.sql | 2 +- htdocs/install/mysql/tables/llx_don.sql | 2 +- .../install/mysql/tables/llx_expedition.sql | 3 +- htdocs/install/mysql/tables/llx_facture.sql | 2 +- .../mysql/tables/llx_facture_fourn.sql | 2 +- .../install/mysql/tables/llx_facture_rec.sql | 2 +- htdocs/install/mysql/tables/llx_holiday.sql | 4 +- htdocs/install/mysql/tables/llx_livraison.sql | 2 +- htdocs/install/mysql/tables/llx_propal.sql | 2 +- htdocs/install/mysql/tables/llx_societe.sql | 2 +- htdocs/install/mysql/tables/llx_socpeople.sql | 2 +- htdocs/livraison/class/livraison.class.php | 21 +- htdocs/livraison/fiche.php | 20 +- htdocs/societe/class/societe.class.php | 15 +- htdocs/societe/note.php | 94 +++------ .../webservices/demo_wsclient_order.php-NORUN | 4 +- htdocs/webservices/server_invoice.php | 8 +- htdocs/webservices/server_order.php | 8 +- .../webservices/server_supplier_invoice.php | 6 +- htdocs/webservices/server_thirdparty.php | 13 +- test/phpunit/ContactTest.php | 17 +- test/phpunit/HolidayTest.php | 18 +- test/phpunit/SocieteTest.php | 17 +- 64 files changed, 789 insertions(+), 419 deletions(-) create mode 100644 htdocs/expedition/note.php diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 42bf3e5d084..b27609b6b28 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -8,7 +8,8 @@ * Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2011 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr> -* + * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or @@ -237,9 +238,9 @@ else if ($action == 'setnote_public' && $user->rights->propal->creer) if ($result < 0) dol_print_error($db,$object->error); } -else if ($action == 'setnote' && $user->rights->propal->creer) +else if ($action == 'setnote_private' && $user->rights->propal->creer) { - $result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES)); + $result=$object->update_note_private(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES)); if ($result < 0) dol_print_error($db,$object->error); } diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 13d2e6e87a4..1c514dd679a 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -8,7 +8,8 @@ * Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr> * Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2011 Philippe Grand <philippe.grand@atoo-net.com> - * Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr> + * Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr> + * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -673,7 +674,7 @@ class Propal extends CommonObject $sql.= ", datec"; $sql.= ", ref"; $sql.= ", fk_user_author"; - $sql.= ", note"; + $sql.= ", note_private"; $sql.= ", note_public"; $sql.= ", model_pdf"; $sql.= ", fin_validite"; @@ -698,7 +699,7 @@ class Propal extends CommonObject $sql.= ", '".$this->db->idate($now)."'"; $sql.= ", '(PROV)'"; $sql.= ", ".($user->id > 0 ? "'".$user->id."'":"null"); - $sql.= ", '".$this->db->escape($this->note)."'"; + $sql.= ", '".$this->db->escape($this->note_private)."'"; $sql.= ", '".$this->db->escape($this->note_public)."'"; $sql.= ", '".$this->modelpdf."'"; $sql.= ", ".($this->fin_validite!=''?"'".$this->db->idate($this->fin_validite)."'":"null"); @@ -1000,7 +1001,7 @@ class Propal extends CommonObject $sql.= ", p.fin_validite as dfv"; $sql.= ", p.date_livraison as date_livraison"; $sql.= ", p.model_pdf, p.ref_client, p.extraparams"; - $sql.= ", p.note as note_private, p.note_public"; + $sql.= ", p.note_private, p.note_public"; $sql.= ", p.fk_projet, p.fk_statut"; $sql.= ", p.fk_user_author, p.fk_user_valid, p.fk_user_cloture"; $sql.= ", p.fk_delivery_address"; @@ -1584,7 +1585,7 @@ class Propal extends CommonObject $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."propal"; - $sql.= " SET fk_statut = ".$statut.", note = '".$this->db->escape($note)."', date_cloture=".$this->db->idate($now).", fk_user_cloture=".$user->id; + $sql.= " SET fk_statut = ".$statut.", note_private = '".$this->db->escape($note)."', date_cloture=".$this->db->idate($now).", fk_user_cloture=".$user->id; $sql.= " WHERE rowid = ".$this->id; $resql=$this->db->query($sql); @@ -1614,7 +1615,7 @@ class Propal extends CommonObject $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."propal"; - $sql.= " SET fk_statut = ".$statut.", note = '".$this->db->escape($note)."', date_cloture=".$this->db->idate($now).", fk_user_cloture=".$user->id; + $sql.= " SET fk_statut = ".$statut.", note_private = '".$this->db->escape($note)."', date_cloture=".$this->db->idate($now).", fk_user_cloture=".$user->id; $sql.= " WHERE rowid = ".$this->id; $resql=$this->db->query($sql); @@ -2322,7 +2323,7 @@ class Propal extends CommonObject $this->demand_reason_id = 1; $this->demand_reason_code = 'SRC_00'; $this->note_public='This is a comment (public)'; - $this->note='This is a comment (private)'; + $this->note_private='This is a comment (private)'; // Lines $nbp = 5; $xnbp = 0; diff --git a/htdocs/comm/propal/note.php b/htdocs/comm/propal/note.php index 4603bd82682..663530a92c9 100644 --- a/htdocs/comm/propal/note.php +++ b/htdocs/comm/propal/note.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> + * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -54,10 +55,10 @@ if ($action == 'setnote_public' && $user->rights->propale->creer) if ($result < 0) dol_print_error($db,$object->error); } -else if ($action == 'setnote' && $user->rights->propale->creer) +else if ($action == 'setnote_private' && $user->rights->propale->creer) { $object->fetch($id); - $result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES)); + $result=$object->update_note_private(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES)); if ($result < 0) dol_print_error($db,$object->error); } diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index cab6e77be23..0270b0327dd 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -6,6 +6,7 @@ * Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011 Jean Heimburger <jean@tiaris.info> * Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr> + * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU *General Public License as published by @@ -630,7 +631,7 @@ class Commande extends CommonOrder $this->db->begin(); $sql = "INSERT INTO ".MAIN_DB_PREFIX."commande ("; - $sql.= " ref, fk_soc, date_creation, fk_user_author, fk_projet, date_commande, source, note, note_public, ref_client, ref_int"; + $sql.= " ref, fk_soc, date_creation, fk_user_author, fk_projet, date_commande, source, note_private, note_public, ref_client, ref_int"; $sql.= ", model_pdf, fk_cond_reglement, fk_mode_reglement, fk_availability, fk_input_reason, date_livraison, fk_delivery_address"; $sql.= ", remise_absolue, remise_percent"; $sql.= ", entity"; @@ -639,7 +640,7 @@ class Commande extends CommonOrder $sql.= ", ".($this->fk_project?$this->fk_project:"null"); $sql.= ", ".$this->db->idate($date); $sql.= ", ".($this->source>=0 && $this->source != '' ?$this->source:'null'); - $sql.= ", '".$this->db->escape($this->note)."'"; + $sql.= ", '".$this->db->escape($this->note_private)."'"; $sql.= ", '".$this->db->escape($this->note_public)."'"; $sql.= ", '".$this->db->escape($this->ref_client)."'"; $sql.= ", ".($this->ref_int?"'".$this->db->escape($this->ref_int)."'":"null"); @@ -952,7 +953,7 @@ class Commande extends CommonOrder $this->fk_delivery_address = $object->fk_delivery_address; $this->contact_id = $object->contactid; $this->ref_client = $object->ref_client; - $this->note = $object->note; + $this->note_private = $object->note_private; $this->note_public = $object->note_public; $this->origin = $object->element; @@ -1267,7 +1268,7 @@ class Commande extends CommonOrder $sql.= ', c.date_commande'; $sql.= ', c.date_livraison'; $sql.= ', c.fk_projet, c.remise_percent, c.remise, c.remise_absolue, c.source, c.facture as billed'; - $sql.= ', c.note as note_private, c.note_public, c.ref_client, c.ref_ext, c.ref_int, c.model_pdf, c.fk_delivery_address, c.extraparams'; + $sql.= ', c.note_private, c.note_public, c.ref_client, c.ref_ext, c.ref_int, c.model_pdf, c.fk_delivery_address, c.extraparams'; $sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle'; $sql.= ', cr.code as cond_reglement_code, cr.libelle as cond_reglement_libelle, cr.libelle_facture as cond_reglement_libelle_doc'; $sql.= ', ca.code as availability_code'; @@ -2697,7 +2698,7 @@ class Commande extends CommonOrder $this->availability_code = 'DSP'; $this->demand_reason_code = 'SRC_00'; $this->note_public='This is a comment (public)'; - $this->note='This is a comment (private)'; + $this->note_private='This is a comment (private)'; // Lines $nbp = 5; $xnbp = 0; diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 455eb698722..af01fcd87c0 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -45,6 +45,7 @@ if (! empty($conf->projet->enabled)) { require DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; } +require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $langs->load('orders'); $langs->load('sendings'); @@ -225,7 +226,7 @@ else if ($action == 'add' && $user->rights->commande->creer) $db->begin(); $object->date_commande = $datecommande; - $object->note = GETPOST('note'); + $object->note_private = GETPOST('note_private'); $object->note_public = GETPOST('note_public'); $object->source = GETPOST('source_id'); $object->fk_project = GETPOST('projectid'); @@ -538,9 +539,9 @@ else if ($action == 'setnote_public' && $user->rights->commande->creer) if ($result < 0) dol_print_error($db,$object->error); } -else if ($action == 'setnote' && $user->rights->commande->creer) +else if ($action == 'setnote_private' && $user->rights->commande->creer) { - $result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES)); + $result=$object->update_note_rivate(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES)); if ($result < 0) dol_print_error($db,$object->error); } @@ -1411,9 +1412,6 @@ $formorder = new FormOrder($db); *********************************************************************/ if ($action == 'create' && $user->rights->commande->creer) { - //WYSIWYG Editor - require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - print_fiche_titre($langs->trans('CreateOrder')); dol_htmloutput_mesg($mesg,$mesgs,'error'); @@ -1470,7 +1468,7 @@ if ($action == 'create' && $user->rights->commande->creer) $datedelivery = (!empty($objectsrc->date_livraison)?$objectsrc->date_livraison:''); - $note_private = (! empty($objectsrc->note) ? $objectsrc->note : (! empty($objectsrc->note_private) ? $objectsrc->note_private : '')); + $note_private = (! empty($objectsrc->note_private) ? $objectsrc->note_private : (! empty($objectsrc->note_private) ? $objectsrc->note_private : '')); $note_public = (! empty($objectsrc->note_public) ? $objectsrc->note_public : ''); // Object source contacts list @@ -1632,7 +1630,7 @@ if ($action == 'create' && $user->rights->commande->creer) print '<td class="border" valign="top">'.$langs->trans('NotePrivate').'</td>'; print '<td valign="top" colspan="2">'; - $doleditor=new DolEditor('note', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); + $doleditor=new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); print $doleditor->Create(1); //print '<textarea name="note" wrap="soft" cols="70" rows="'.ROWS_3.'">'.$note_private.'</textarea>'; print '</td></tr>'; diff --git a/htdocs/commande/note.php b/htdocs/commande/note.php index 194d7f5e91c..29078518237 100644 --- a/htdocs/commande/note.php +++ b/htdocs/commande/note.php @@ -2,6 +2,7 @@ /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> + * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -61,10 +62,10 @@ if ($action == 'setnote_public' && $user->rights->commande->creer) if ($result < 0) dol_print_error($db,$object->error); } -else if ($action == 'setnote' && $user->rights->commande->creer) +else if ($action == 'setnote_private' && $user->rights->commande->creer) { $object->fetch($id); - $result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES)); + $result=$object->update_note_private(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES)); if ($result < 0) dol_print_error($db,$object->error); } diff --git a/htdocs/compta/deplacement/class/deplacement.class.php b/htdocs/compta/deplacement/class/deplacement.class.php index 1c8820cbd2b..66644cde848 100644 --- a/htdocs/compta/deplacement/class/deplacement.class.php +++ b/htdocs/compta/deplacement/class/deplacement.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2009-2012 Regis Houssin <regis.houssin@capnetworks.com> + * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -101,7 +102,7 @@ class Deplacement extends CommonObject $sql.= ", fk_user_author"; $sql.= ", fk_user"; $sql.= ", type"; - $sql.= ", note"; + $sql.= ", note_private"; $sql.= ", note_public"; $sql.= ", fk_projet"; $sql.= ", fk_soc"; @@ -195,7 +196,7 @@ class Deplacement extends CommonObject $sql .= " , fk_user = ".$this->fk_user; $sql .= " , fk_user_modif = ".$user->id; $sql .= " , fk_soc = ".($this->socid > 0?$this->socid:'null'); - $sql .= " , note = ".($this->note_private?"'".$this->db->escape($this->note_private)."'":"null"); + $sql .= " , note_private = ".($this->note_private?"'".$this->db->escape($this->note_private)."'":"null"); $sql .= " , note_public = ".($this->note_public?"'".$this->db->escape($this->note_public)."'":"null"); $sql .= " , fk_projet = ".($this->fk_project>0?$this->fk_project:0); $sql .= " WHERE rowid = ".$this->id; @@ -223,7 +224,7 @@ class Deplacement extends CommonObject */ function fetch($id) { - $sql = "SELECT rowid, fk_user, type, fk_statut, km, fk_soc, dated, note, note_public, fk_projet, extraparams"; + $sql = "SELECT rowid, fk_user, type, fk_statut, km, fk_soc, dated, note_private, note_public, fk_projet, extraparams"; $sql.= " FROM ".MAIN_DB_PREFIX."deplacement"; $sql.= " WHERE rowid = ".$id; @@ -241,7 +242,7 @@ class Deplacement extends CommonObject $this->km = $obj->km; $this->type = $obj->type; $this->statut = $obj->fk_statut; - $this->note_private = $obj->note; + $this->note_private = $obj->note_private; $this->note_public = $obj->note_public; $this->fk_project = $obj->fk_projet; diff --git a/htdocs/compta/deplacement/fiche.php b/htdocs/compta/deplacement/fiche.php index 1e20d91c350..c7a7c6b7a2e 100644 --- a/htdocs/compta/deplacement/fiche.php +++ b/htdocs/compta/deplacement/fiche.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es> + * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -234,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->setValueFrom('note_public',GETPOST('note_public','alpha')); + $result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES)); if ($result < 0) dol_print_error($db, $object->error); } -else if ($action == 'setnote' && $user->rights->deplacement->creer) +else if ($action == 'setnote_private' && $user->rights->deplacement->creer) { $object->fetch($id); - $result=$object->setValueFrom('note',GETPOST('note','alpha')); + $result=$object->update_note_private(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES)); if ($result < 0) dol_print_error($db, $object->error); } diff --git a/htdocs/compta/dons/class/don.class.php b/htdocs/compta/dons/class/don.class.php index 9ca97617db6..f5d477de48f 100644 --- a/htdocs/compta/dons/class/don.class.php +++ b/htdocs/compta/dons/class/don.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2009 Regis Houssin <regis.houssin@capnetworks.com> + * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -51,7 +52,8 @@ class Don extends CommonObject var $fk_project; var $modepaiement; var $modepaiementid; - var $note; + var $note_private; + var $note_public; var $statut; var $projet; @@ -191,7 +193,8 @@ class Don extends CommonObject $this->address = 'Twist road'; $this->zip = '99999'; $this->town = 'Town'; - $this->note_public='SPECIMEN'; + $this->note_private='Private note'; + $this->note_public='Public note'; $this->email='email@email.com'; $this->note=''; $this->statut=1; @@ -319,7 +322,8 @@ class Don extends CommonObject $sql.= ", country"; $sql.= ", public"; $sql.= ", fk_don_projet"; - $sql.= ", note"; + $sql.= ", note_private"; + $sql.= ", note_public"; $sql.= ", fk_user_author"; $sql.= ", fk_user_valid"; $sql.= ", datedon"; @@ -340,7 +344,8 @@ class Don extends CommonObject $sql.= ", '".$this->db->escape($this->country)."'"; // TODO use country_id $sql.= ", ".$this->public; $sql.= ", ".($this->fk_project > 0?$this->fk_project:"null"); - $sql.= ", '".$this->db->escape($this->note)."'"; + $sql.= ", ".(!empty($this->note_private)?("'".$this->db->escape($this->note_private)."'"):"NULL"); + $sql.= ", ".(!empty($this->note_public)?("'".$this->db->escape($this->note_public)."'"):"NULL"); $sql.= ", ".$user->id; $sql.= ", null"; $sql.= ", '".$this->db->idate($this->date)."'"; @@ -400,7 +405,8 @@ class Don extends CommonObject $sql .= ",country='".$this->db->escape($this->country)."'"; // TODO use country_id $sql .= ",public=".$this->public; $sql .= ",fk_don_projet=".($this->fk_project>0?$this->fk_project:'null'); - $sql .= ",note='".$this->db->escape($this->note)."'"; + $sql .= ",note_private=".(!empty($this->note_private)?("'".$this->db->escape($this->note_private)."'"):"NULL"); + $sql .= ",note_public=".(!empty($this->note_public)?("'".$this->db->escape($this->note_public)."'"):"NULL"); $sql .= ",datedon='".$this->db->idate($this->date)."'"; $sql .= ",email='".$this->email."'"; $sql .= ",phone='".$this->phone."'"; @@ -463,7 +469,9 @@ class Don extends CommonObject global $conf; $sql = "SELECT d.rowid, d.datec, d.tms as datem, d.datedon,"; - $sql.= " d.firstname, d.lastname, d.societe, d.amount, d.fk_statut, d.address, d.zip, d.town, d.country, d.public, d.amount, d.fk_paiement, d.note, cp.libelle, d.email, d.phone, d.phone_mobile, d.fk_don_projet,"; + $sql.= " d.firstname, d.lastname, d.societe, d.amount, d.fk_statut, d.address, d.zip, d.town, "; + $sql.= " d.country, d.public, d.amount, d.fk_paiement, d.note_private, d.note_public, cp.libelle, d.email, d.phone, "; + $sql.= " d.phone_mobile, d.fk_don_projet,"; $sql.= " p.title as project_label"; $sql.= " FROM ".MAIN_DB_PREFIX."don as d"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = d.fk_don_projet"; @@ -501,7 +509,8 @@ class Don extends CommonObject $this->modepaiementid = $obj->fk_paiement; $this->modepaiement = $obj->libelle; $this->amount = $obj->amount; - $this->note = $obj->note; + $this->note_private = $obj->note_private; + $this->note_public = $obj->note_public; $this->commentaire = $obj->note; // deprecated } return 1; diff --git a/htdocs/compta/dons/fiche.php b/htdocs/compta/dons/fiche.php index 8c916b7c5f2..e04c6699848 100644 --- a/htdocs/compta/dons/fiche.php +++ b/htdocs/compta/dons/fiche.php @@ -2,6 +2,7 @@ /* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> + * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -98,7 +99,8 @@ if ($action == 'update') $don->note = $_POST["note"]; $don->public = $_POST["public"]; $don->fk_project = $_POST["projectid"]; - $don->note = $_POST["comment"]; + $don->note_private= GETPOST("note_private"); + $don->note_public = GETPOST("note_public"); $don->modepaiementid = $_POST["modepaiement"]; if ($don->update($user) > 0) @@ -146,10 +148,10 @@ if ($action == 'add') $don->country = $_POST["country"]; $don->email = $_POST["email"]; $don->date = $donation_date; - $don->note = $_POST["note"]; + $don->note_private= GETPOST("note_private"); + $don->note_public = GETPOST("note_public"); $don->public = $_POST["public"]; $don->fk_project = $_POST["projectid"]; - $don->note = $_POST["comment"]; $don->modepaiementid = $_POST["modepaiement"]; if ($don->create($user) > 0) @@ -283,7 +285,7 @@ if ($action == 'create') print '</td>'; print '<td rowspan="'.$nbrows.'" valign="top">'.$langs->trans("Comments").' :<br>'; - print "<textarea name=\"comment\" wrap=\"soft\" cols=\"40\" rows=\"15\">".$_POST["comment"]."</textarea></td>"; + print "<textarea name=\"note_private\" wrap=\"soft\" cols=\"40\" rows=\"15\">".GETPOST("note_private")."</textarea></td>"; print "</tr>"; // Amount @@ -371,7 +373,7 @@ if (! empty($id) && $action == 'edit') print '</td>'; print '<td rowspan="'.$nbrows.'" valign="top">'.$langs->trans("Comments").' :<br>'; - print "<textarea name=\"comment\" wrap=\"soft\" cols=\"40\" rows=\"15\">".$don->note."</textarea></td>"; + print "<textarea name=\"note_private\" wrap=\"soft\" cols=\"40\" rows=\"15\">".$don->note_private."</textarea></td>"; print "</tr>"; // Amount @@ -471,7 +473,7 @@ if (! empty($id) && $action != 'edit') print "</td>"; print '<td rowspan="'.$nbrows.'" valign="top" width="50%">'.$langs->trans("Comments").' :<br>'; - print nl2br($don->note).'</td></tr>'; + print nl2br($don->note_private).'</td></tr>'; print "<tr>".'<td>'.$langs->trans("Amount").'</td><td>'.price($don->amount).' '.$langs->trans("Currency".$conf->currency).'</td></tr>'; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index e4b7e923ef0..7248e124b46 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -8,6 +8,7 @@ * Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2013 Jean-Francois FERRY <jfefe@aternatik.fr> + * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -43,6 +44,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php'; if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $langs->load('bills'); $langs->load('companies'); @@ -355,10 +357,10 @@ else if ($action == 'setnote_public' && $user->rights->facture->creer) if ($result < 0) dol_print_error($db,$object->error); } -else if ($action == 'setnote' && $user->rights->facture->creer) +else if ($action == 'setnote_private' && $user->rights->facture->creer) { $object->fetch($id); - $result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES)); + $result=$object->update_note_private(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES)); if ($result < 0) dol_print_error($db,$object->error); } @@ -695,7 +697,7 @@ else if ($action == 'add' && $user->rights->facture->creer) //$result=$object->fetch($_POST['fac_avoir']); - $object->socid = $_POST['socid']; + $object->socid = GETPOST('socid','int'); $object->number = $_POST['facnumber']; $object->date = $datefacture; $object->note_public = trim($_POST['note_public']); @@ -742,12 +744,12 @@ else if ($action == 'add' && $user->rights->facture->creer) if (! $error) { - $object->socid = $_POST['socid']; + $object->socid = GETPOST('socid','int'); $object->type = $_POST['type']; $object->number = $_POST['facnumber']; $object->date = $datefacture; $object->note_public = trim($_POST['note_public']); - $object->note = trim($_POST['note']); + $object->note_private = trim($_POST['note_private']); $object->ref_client = $_POST['ref_client']; $object->ref_int = $_POST['ref_int']; $object->modelpdf = $_POST['model']; @@ -778,12 +780,12 @@ else if ($action == 'add' && $user->rights->facture->creer) if (! $error) { // Si facture standard - $object->socid = $_POST['socid']; - $object->type = $_POST['type']; + $object->socid = GETPOST('socid','int'); + $object->type = GETPOST('type'); $object->number = $_POST['facnumber']; $object->date = $datefacture; $object->note_public = trim($_POST['note_public']); - $object->note = trim($_POST['note']); + $object->note_private = trim($_POST['note_private']); $object->ref_client = $_POST['ref_client']; $object->ref_int = $_POST['ref_int']; $object->modelpdf = $_POST['model']; @@ -2113,12 +2115,15 @@ if ($action == 'create') print '<tr>'; print '<td class="border" valign="top">'.$langs->trans('NotePublic').'</td>'; print '<td valign="top" colspan="2">'; - print '<textarea name="note_public" wrap="soft" cols="70" rows="'.ROWS_3.'">'; + $note_public=''; if (is_object($objectsrc)) // Take value from source object { - print $objectsrc->note_public; + $note_public=$objectsrc->note_public; } - print '</textarea></td></tr>'; + $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); + print $doleditor->Create(1); + + //print '<textarea name="note_public" wrap="soft" cols="70" rows="'.ROWS_3.'">'.$note_public.'</textarea></td></tr>'; // Private note if (empty($user->societe_id)) @@ -2126,12 +2131,14 @@ if ($action == 'create') print '<tr>'; print '<td class="border" valign="top">'.$langs->trans('NotePrivate').'</td>'; print '<td valign="top" colspan="2">'; - print '<textarea name="note" wrap="soft" cols="70" rows="'.ROWS_3.'">'; + $note_private=''; if (! empty($origin) && ! empty($originid) && is_object($objectsrc)) // Take value from source object { - print $objectsrc->note; + $note_private=$objectsrc->note_private; } - print '</textarea></td></tr>'; + $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); + print $doleditor->Create(1); + //print '<textarea name="note_private" wrap="soft" cols="70" rows="'.ROWS_3.'">'.$note_private.'.</textarea></td></tr>'; } if (! empty($origin) && ! empty($originid) && is_object($objectsrc)) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 4e168d0645f..1651407d746 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2009-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es> + * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -54,7 +55,8 @@ class FactureRec extends Facture var $remise; var $tva; var $total; - var $note; + var $note_private; + var $note_public; var $db_table; var $propalid; var $fk_project; @@ -111,7 +113,8 @@ class FactureRec extends Facture $sql.= ", datec"; $sql.= ", amount"; $sql.= ", remise"; - $sql.= ", note"; + $sql.= ", note_private"; + $sql.= ", note_public"; $sql.= ", fk_user_author"; $sql.= ", fk_projet"; $sql.= ", fk_cond_reglement"; @@ -124,7 +127,8 @@ class FactureRec extends Facture $sql.= ", ".$this->db->idate($now); $sql.= ", '".$facsrc->amount."'"; $sql.= ", '".$facsrc->remise."'"; - $sql.= ", '".$this->db->escape($this->note)."'"; + $sql.= ", ".(!empty($this->note_private)?("'".$this->db->escape($this->note_private)."'"):"NULL"); + $sql.= ", ".(!empty($this->note_public)?("'".$this->db->escape($this->note_public)."'"):"NULL"); $sql.= ", '".$user->id."'"; $sql.= ", ".(! empty($facsrc->fk_project)?"'".$facsrc->fk_project."'":"null"); $sql.= ", '".$facsrc->cond_reglement_id."'"; @@ -201,7 +205,7 @@ class FactureRec extends Facture { $sql = 'SELECT f.titre,f.fk_soc,f.amount,f.tva,f.total,f.total_ttc,f.remise_percent,f.remise_absolue,f.remise'; $sql.= ', f.date_lim_reglement as dlr'; - $sql.= ', f.note, f.note_public, f.fk_user_author'; + $sql.= ', f.note_private, f.note_public, f.fk_user_author'; $sql.= ', f.fk_mode_reglement, f.fk_cond_reglement'; $sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle'; $sql.= ', c.code as cond_reglement_code, c.libelle as cond_reglement_libelle, c.libelle_facture as cond_reglement_libelle_doc'; @@ -249,7 +253,7 @@ class FactureRec extends Facture $this->cond_reglement_doc = $obj->cond_reglement_libelle_doc; $this->fk_project = $obj->fk_projet; $this->fk_facture_source = $obj->fk_facture_source; - $this->note = $obj->note; + $this->note_private = $obj->note_private; $this->note_public = $obj->note_public; $this->user_author = $obj->fk_user_author; $this->modelpdf = $obj->model_pdf; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 6c19894e7f1..f4dc4527c74 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -11,6 +11,7 @@ * Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2012 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2013 Cedric Gross <c.gross@kreiz-it.fr> + * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -144,7 +145,7 @@ class Facture extends CommonInvoice if (empty($this->type)) $this->type = 0; $this->ref_client=trim($this->ref_client); $this->note=(isset($this->note) ? trim($this->note) : trim($this->note_private)); // deprecated - $this->note_private=(isset($this->note_private) ? trim($this->note_private) : trim($this->note)); + $this->note_private=(isset($this->note_private) ? trim($this->note_private) : trim($this->note_private)); $this->note_public=trim($this->note_public); if (! $this->cond_reglement_id) $this->cond_reglement_id = 0; if (! $this->mode_reglement_id) $this->mode_reglement_id = 0; @@ -190,7 +191,7 @@ class Facture extends CommonInvoice // Clean parametres if (! $this->type) $this->type = 0; $this->ref_client=trim($this->ref_client); - $this->note=trim($this->note); + $this->note_private=trim($this->note_private); $this->note_public=trim($this->note_public); //if (! $this->remise) $this->remise = 0; if (! $this->mode_reglement_id) $this->mode_reglement_id = 0; @@ -213,7 +214,7 @@ class Facture extends CommonInvoice $sql.= ", remise_absolue"; $sql.= ", remise_percent"; $sql.= ", datef"; - $sql.= ", note"; + $sql.= ", note_private"; $sql.= ", note_public"; $sql.= ", ref_client, ref_int"; $sql.= ", fk_facture_source, fk_user_author, fk_projet"; @@ -516,7 +517,7 @@ class Facture extends CommonInvoice $facture->socid = $this->socid; $facture->date = $this->date; $facture->note_public = $this->note_public; - $facture->note = $this->note; + $facture->note_private = $this->note_private; $facture->ref_client = $this->ref_client; $facture->modelpdf = $this->modelpdf; $facture->fk_project = $this->fk_project; @@ -703,7 +704,7 @@ class Facture extends CommonInvoice $this->fk_delivery_address = $object->fk_delivery_address; $this->contact_id = $object->contactid; $this->ref_client = $object->ref_client; - $this->note = $object->note; + $this->note_private = $object->note_private; $this->note_public = $object->note_public; $this->origin = $object->element; @@ -802,7 +803,7 @@ class Facture extends CommonInvoice $sql.= ', f.datec as datec'; $sql.= ', f.date_valid as datev'; $sql.= ', f.tms as datem'; - $sql.= ', f.note as note_private, f.note_public, f.fk_statut, f.paye, f.close_code, f.close_note, f.fk_user_author, f.fk_user_valid, f.model_pdf'; + $sql.= ', f.note_private, f.note_public, f.fk_statut, f.paye, f.close_code, f.close_note, f.fk_user_author, f.fk_user_valid, f.model_pdf'; $sql.= ', f.fk_facture_source'; $sql.= ', f.fk_mode_reglement, f.fk_cond_reglement, f.fk_projet, f.extraparams'; $sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle'; @@ -1061,7 +1062,7 @@ class Facture extends CommonInvoice $sql.= " fk_cond_reglement=".(isset($this->cond_reglement_id)?$this->cond_reglement_id:"null").","; $sql.= " fk_mode_reglement=".(isset($this->mode_reglement_id)?$this->mode_reglement_id:"null").","; $sql.= " date_lim_reglement=".(strval($this->date_lim_reglement)!='' ? "'".$this->db->idate($this->date_lim_reglement)."'" : 'null').","; - $sql.= " note=".(isset($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null").","; + $sql.= " note_private=".(isset($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null").","; $sql.= " note_public=".(isset($this->note_public)?"'".$this->db->escape($this->note_public)."'":"null").","; $sql.= " model_pdf=".(isset($this->modelpdf)?"'".$this->db->escape($this->modelpdf)."'":"null").","; $sql.= " import_key=".(isset($this->import_key)?"'".$this->db->escape($this->import_key)."'":"null").""; diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index 804c34cf701..54d0c800920 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -2,6 +2,7 @@ /* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> + * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -72,7 +73,7 @@ if ($action == 'add') if (! $error) { $object->titre = GETPOST('titre', 'alpha'); - $object->note = GETPOST('note'); + $object->note_private = GETPOST('note_private'); $object->usenewprice = GETPOST('usenewprice'); if ($object->create($user, $id) > 0) @@ -143,7 +144,7 @@ if ($action == 'create') // Note print '<td rowspan="'.$rowspan.'" valign="top">'; - print '<textarea class="flat" name="note" wrap="soft" cols="60" rows="'.ROWS_4.'"></textarea>'; + print '<textarea class="flat" name="note_private" wrap="soft" cols="60" rows="'.ROWS_4.'"></textarea>'; print '</td></tr>'; // Author @@ -394,7 +395,7 @@ else $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id,'none'); print "</td></tr>"; - print '<tr><td>'.$langs->trans("Note").'</td><td colspan="3">'.nl2br($object->note)."</td></tr>"; + print '<tr><td>'.$langs->trans("Note").'</td><td colspan="3">'.nl2br($object->note_private)."</td></tr>"; print "</table>"; diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 796bf769698..1003dd23700 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -7,6 +7,7 @@ * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr> + * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -140,7 +141,7 @@ if (! $sall) $sql = 'SELECT'; else $sql = 'SELECT DISTINCT'; $sql.= ' f.rowid as facid, f.facnumber, f.type, f.increment, f.total as total_ht, f.tva as total_tva, f.total_ttc,'; $sql.= ' f.datef as df, f.date_lim_reglement as datelimite,'; -$sql.= ' f.paye as paye, f.fk_statut, f.note,'; +$sql.= ' f.paye as paye, f.fk_statut,'; $sql.= ' s.nom, s.rowid as socid'; if (! $sall) $sql.= ', SUM(pf.amount) as am'; // To be able to sort on status $sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s'; @@ -210,7 +211,7 @@ if (! $sall) { $sql.= ' GROUP BY f.rowid, f.facnumber, f.type, f.increment, f.total, f.total_ttc,'; $sql.= ' f.datef, f.date_lim_reglement,'; - $sql.= ' f.paye, f.fk_statut, f.note,'; + $sql.= ' f.paye, f.fk_statut,'; $sql.= ' s.nom, s.rowid'; } else diff --git a/htdocs/compta/facture/note.php b/htdocs/compta/facture/note.php index a96f5643b80..484dff7020f 100644 --- a/htdocs/compta/facture/note.php +++ b/htdocs/compta/facture/note.php @@ -2,6 +2,7 @@ /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> + * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -56,10 +57,10 @@ if ($action == 'setnote_public' && $user->rights->facture->creer) if ($result < 0) dol_print_error($db,$object->error); } -else if ($action == 'setnote' && $user->rights->facture->creer) +else if ($action == 'setnote_private' && $user->rights->facture->creer) { $object->fetch($id); - $result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES)); + $result=$object->update_note_private(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES)); if ($result < 0) dol_print_error($db,$object->error); } diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 73bdbc4a0f4..65c0407cb97 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -5,6 +5,7 @@ * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerker@telenet.be> * Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr> + * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -63,7 +64,8 @@ class Contact extends CommonObject var $birthday; var $default_lang; var $note_public; // Public note - var $note; // Private note + var $note; // deprecated + var $note_private; // Private note var $no_email; // 1=Don't send e-mail to this contact, 0=do var $ref_facturation; // Nb de reference facture pour lequel il est contact @@ -238,7 +240,8 @@ class Contact extends CommonObject $sql .= ", poste='".$this->db->escape($this->poste)."'"; $sql .= ", fax='".$this->db->escape($this->fax)."'"; $sql .= ", email='".$this->db->escape($this->email)."'"; - $sql .= ", note='".$this->db->escape($this->note)."'"; + $sql .= ", note_private='".$this->db->escape($this->note_private)."'"; + $sql .= ", note_public='".$this->db->escape($this->note_public)."'"; $sql .= ", phone = '".$this->db->escape($this->phone_pro)."'"; $sql .= ", phone_perso = '".$this->db->escape($this->phone_perso)."'"; $sql .= ", phone_mobile = '".$this->db->escape($this->phone_mobile)."'"; @@ -366,7 +369,7 @@ class Contact extends CommonObject if ($this->phone_perso && ! empty($conf->global->LDAP_CONTACT_FIELD_HOMEPHONE)) $info[$conf->global->LDAP_CONTACT_FIELD_HOMEPHONE] = $this->phone_perso; if ($this->phone_mobile && ! empty($conf->global->LDAP_CONTACT_FIELD_MOBILE)) $info[$conf->global->LDAP_CONTACT_FIELD_MOBILE] = $this->phone_mobile; if ($this->fax && ! empty($conf->global->LDAP_CONTACT_FIELD_FAX)) $info[$conf->global->LDAP_CONTACT_FIELD_FAX] = $this->fax; - if ($this->note && ! empty($conf->global->LDAP_CONTACT_FIELD_DESCRIPTION)) $info[$conf->global->LDAP_CONTACT_FIELD_DESCRIPTION] = $this->note; + if ($this->note_private && ! empty($conf->global->LDAP_CONTACT_FIELD_DESCRIPTION)) $info[$conf->global->LDAP_CONTACT_FIELD_DESCRIPTION] = $this->note_private; if ($this->email && ! empty($conf->global->LDAP_CONTACT_FIELD_MAIL)) $info[$conf->global->LDAP_CONTACT_FIELD_MAIL] = $this->email; if ($conf->global->LDAP_SERVER_TYPE == 'egroupware') @@ -482,7 +485,7 @@ class Contact extends CommonObject $sql.= " c.fk_departement,"; $sql.= " c.birthday,"; $sql.= " c.poste, c.phone, c.phone_perso, c.phone_mobile, c.fax, c.email, c.jabberid,"; - $sql.= " c.priv, c.note, c.default_lang, c.no_email, c.canvas,"; + $sql.= " c.priv, c.note_private, c.note_public, c.default_lang, c.no_email, c.canvas,"; $sql.= " c.import_key,"; $sql.= " p.libelle as country, p.code as country_code,"; $sql.= " d.nom as state, d.code_departement as state_code,"; @@ -538,7 +541,8 @@ class Contact extends CommonObject $this->mail = $obj->email; $this->birthday = $this->db->jdate($obj->birthday); - $this->note = $obj->note; + $this->note_private = $obj->note_private; + $this->note_public = $obj->note_public; $this->default_lang = $obj->default_lang; $this->no_email = $obj->no_email; $this->user_id = $obj->user_id; @@ -1008,7 +1012,7 @@ class Contact extends CommonObject $this->fax = '0909090909'; $this->note_public='This is a comment (public)'; - $this->note='This is a comment (private)'; + $this->note_private='This is a comment (private)'; $socid = rand(1, $num_socs); $this->socid = $socids[$socid]; diff --git a/htdocs/contact/fiche.php b/htdocs/contact/fiche.php index db0fe091cd9..a0ca630a423 100644 --- a/htdocs/contact/fiche.php +++ b/htdocs/contact/fiche.php @@ -4,6 +4,7 @@ * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be> + * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -32,6 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/contact.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $langs->load("companies"); $langs->load("users"); @@ -152,7 +154,8 @@ if (empty($reshook)) $object->jabberid = $_POST["jabberid"]; $object->no_email = $_POST["no_email"]; $object->priv = $_POST["priv"]; - $object->note = $_POST["note"]; + $object->note_public = GETPOST("note_public"); + $object->note_private = GETPOST("note_private"); // Note: Correct date should be completed with location to have exact GM time of birth. $object->birthday = dol_mktime(0,0,0,$_POST["birthdaymonth"],$_POST["birthdayday"],$_POST["birthdayyear"]); @@ -247,7 +250,8 @@ if (empty($reshook)) $object->jabberid = $_POST["jabberid"]; $object->no_email = $_POST["no_email"]; $object->priv = $_POST["priv"]; - $object->note = $_POST["note"]; + $object->note_public = GETPOST("note_public"); + $object->note_private = GETPOST("note_private"); // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels,$object); @@ -499,8 +503,21 @@ else print $form->selectarray('priv',$selectarray,(isset($_POST["priv"])?$_POST["priv"]:$object->priv),0); print '</td></tr>'; - // Note - print '<tr><td valign="top">'.$langs->trans("Note").'</td><td colspan="3" valign="top"><textarea name="note" cols="70" rows="'.ROWS_3.'">'.(isset($_POST["note"])?$_POST["note"]:$object->note).'</textarea></td></tr>'; + // Note Public + print '<tr><td valign="top">'.$langs->trans("NotePublic").'</td>'; + print '<td colspan="3" valign="top">'; + $doleditor = new DolEditor('note_public', GETPOST('note_public'), '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); + print $doleditor->Create(1); + //print '<textarea name="note" cols="70" rows="'.ROWS_3.'">'.(isset($_POST["note"])?$_POST["note"]:$object->note).'</textarea>'; + print '</td></tr>'; + + // Note Private + print '<tr><td valign="top">'.$langs->trans("NotePrivate").'</td>'; + print '<td colspan="3" valign="top">'; + $doleditor = new DolEditor('note_private', GETPOST('note_private'), '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); + print $doleditor->Create(1); + //print '<textarea name="note" cols="70" rows="'.ROWS_3.'">'.(isset($_POST["note"])?$_POST["note"]:$object->note).'</textarea>'; + print '</td></tr>'; // Other attributes $parameters=array('colspan' => ' colspan="3"'); @@ -703,11 +720,23 @@ else print $form->selectarray('priv',$selectarray,$object->priv,0); print '</td></tr>'; - // Note - print '<tr><td valign="top">'.$langs->trans("Note").'</td><td colspan="3">'; - print '<textarea name="note" cols="70" rows="'.ROWS_3.'">'; - print isset($_POST["note"])?$_POST["note"]:$object->note; - print '</textarea></td></tr>'; + // Note Public + print '<tr><td valign="top">'.$langs->trans("NotePublic").'</td><td colspan="3">'; + $doleditor = new DolEditor('note_public', $object->note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); + print $doleditor->Create(1); + // print '<textarea name="note" cols="70" rows="'.ROWS_3.'">'; + // print isset($_POST["note"])?$_POST["note"]:$object->note; + // print '</textarea></td></tr>'; + print '</td></tr>'; + + // Note Private + print '<tr><td valign="top">'.$langs->trans("NotePrivate").'</td><td colspan="3">'; + $doleditor = new DolEditor('note_private', $object->note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); + print $doleditor->Create(1); + // print '<textarea name="note" cols="70" rows="'.ROWS_3.'">'; + // print isset($_POST["note"])?$_POST["note"]:$object->note; + // print '</textarea></td></tr>'; + print '</td></tr>'; // Other attributes $parameters=array('colspan' => ' colspan="3"'); @@ -908,9 +937,14 @@ else print $object->LibPubPriv($object->priv); print '</td></tr>'; - // Note - print '<tr><td valign="top">'.$langs->trans("Note").'</td><td colspan="3">'; - print nl2br($object->note); + // Note Public + print '<tr><td valign="top">'.$langs->trans("NotePublic").'</td><td colspan="3">'; + print nl2br($object->note_public); + print '</td></tr>'; + + // Note Private + print '<tr><td valign="top">'.$langs->trans("NotePrivate").'</td><td colspan="3">'; + print nl2br($object->note_private); print '</td></tr>'; // Other attributes diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index d85b8fb89b1..afbc82ab391 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -5,7 +5,8 @@ * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr> * Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es> - * Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr> + * Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr> + * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -338,7 +339,7 @@ class Contrat extends CommonObject $sql.= " fk_user_author,"; $sql.= " fk_projet,"; $sql.= " fk_commercial_signature, fk_commercial_suivi,"; - $sql.= " note as note_private, note_public, extraparams"; + $sql.= " note_private, note_public, extraparams"; $sql.= " FROM ".MAIN_DB_PREFIX."contrat"; if ($ref) { @@ -649,7 +650,7 @@ class Contrat extends CommonObject // Insert contract $sql = "INSERT INTO ".MAIN_DB_PREFIX."contrat (datec, fk_soc, fk_user_author, date_contrat,"; $sql.= " fk_commercial_signature, fk_commercial_suivi, fk_projet,"; - $sql.= " ref, entity, note, note_public)"; + $sql.= " ref, entity, note_private, note_public)"; $sql.= " VALUES (".$this->db->idate($now).",".$this->socid.",".$user->id; $sql.= ",".$this->db->idate($this->date_contrat); $sql.= ",".($this->commercial_signature_id>0?$this->commercial_signature_id:"NULL"); @@ -657,7 +658,7 @@ class Contrat extends CommonObject $sql.= ",".($this->fk_project>0?$this->fk_project:"NULL"); $sql.= ", ".(dol_strlen($this->ref)<=0 ? "null" : "'".$this->ref."'"); $sql.= ", ".$conf->entity; - $sql.= ", ".(!empty($this->note)?("'".$this->db->escape($this->note)."'"):"NULL"); + $sql.= ", ".(!empty($this->note_private)?("'".$this->db->escape($this->note_private)."'"):"NULL"); $sql.= ", ".(!empty($this->note_public)?("'".$this->db->escape($this->note_public)."'"):"NULL"); $sql.= ")"; $resql=$this->db->query($sql); @@ -1605,8 +1606,8 @@ class Contrat extends CommonObject $this->date_contrat = dol_now(); $this->commercial_signature_id = 1; $this->commercial_suivi_id = 1; - $this->note='This is a comment (private)'; - $this->note='This is a comment (public)'; + $this->note_private='This is a comment (private)'; + $this->note_public='This is a comment (public)'; $this->fk_projet = 0; // Lines $nbp = 5; diff --git a/htdocs/contrat/fiche.php b/htdocs/contrat/fiche.php index f0fd4cd66ea..368971e6ea4 100644 --- a/htdocs/contrat/fiche.php +++ b/htdocs/contrat/fiche.php @@ -4,7 +4,8 @@ * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es> - * Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr> + * Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr> + * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -32,6 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/contract.lib.php'; require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/contract/modules_contract.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; if (! empty($conf->produit->enabled) || ! empty($conf->service->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; if (! empty($conf->projet->enabled)) { @@ -182,7 +184,7 @@ if ($action == 'add' && $user->rights->contrat->creer) $object->commercial_suivi_id = GETPOST('commercial_suivi_id','int'); $object->commercial_signature_id = GETPOST('commercial_signature_id','int'); - $object->note = GETPOST('note','alpha'); + $object->note_private = GETPOST('note_private','alpha'); $object->note_public = GETPOST('note_public','alpha'); $object->fk_project = GETPOST('projectid','int'); $object->remise_percent = GETPOST('remise_percent','alpha'); @@ -660,9 +662,9 @@ else if ($action == 'setnote_public' && $user->rights->contrat->creer) if ($result < 0) dol_print_error($db,$object->error); } -else if ($action == 'setnote' && $user->rights->contrat->creer) +else if ($action == 'setnote_private' && $user->rights->contrat->creer) { - $result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES)); + $result=$object->update_note_private(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES)); if ($result < 0) dol_print_error($db,$object->error); } @@ -785,7 +787,7 @@ if ($action == 'create') $soc = $objectsrc->client; - $note_private = (! empty($objectsrc->note) ? $objectsrc->note : (! empty($objectsrc->note_private) ? $objectsrc->note_private : '')); + $note_private = (! empty($objectsrc->note_private) ? $objectsrc->note_private : ''); $note_public = (! empty($objectsrc->note_public) ? $objectsrc->note_public : ''); // Object source contacts list @@ -794,7 +796,7 @@ if ($action == 'create') } else { $projectid = GETPOST('projectid','int'); - $note_private = GETPOST("note"); + $note_private = GETPOST("note_private"); $note_public = GETPOST("note_public"); } @@ -869,25 +871,16 @@ if ($action == 'create') print '<tr><td>'.$langs->trans("NotePublic").'</td><td valign="top">'; - require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $doleditor=new DolEditor('note_public', $note_public, '', '100', 'dolibarr_notes', 'In', 1, true, true, ROWS_3, 70); print $doleditor->Create(1); - /* - print '<textarea name="note_public" wrap="soft" cols="70" rows="'.ROWS_3.'">'; - print $note_public; - print '</textarea></td></tr>'; - */ + if (! $user->societe_id) { print '<tr><td>'.$langs->trans("NotePrivate").'</td><td valign="top">'; - require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor('note', $note_private, '', '100', 'dolibarr_notes', 'In', 1, true, true, ROWS_3, 70); + $doleditor=new DolEditor('note_private', $note_private, '', '100', 'dolibarr_notes', 'In', 1, true, true, ROWS_3, 70); print $doleditor->Create(1); - /* - print '<textarea name="note" wrap="soft" cols="70" rows="'.ROWS_3.'">'; - print $note_private; - print '</textarea>';*/ print '</td></tr>'; } diff --git a/htdocs/contrat/note.php b/htdocs/contrat/note.php index f502d10d39b..cf347cf2973 100644 --- a/htdocs/contrat/note.php +++ b/htdocs/contrat/note.php @@ -54,9 +54,9 @@ if ($action == 'setnote_public' && $user->rights->contrat->creer) if ($result < 0) dol_print_error($db,$object->error); } -else if ($action == 'setnote' && $user->rights->contrat->creer) +else if ($action == 'setnote_private' && $user->rights->contrat->creer) { - $result=$object->update_note(dol_html_entity_decode(dol_htmlcleanlastbr(GETPOST('note')), ENT_QUOTES)); + $result=$object->update_note_private(dol_html_entity_decode(dol_htmlcleanlastbr(GETPOST('note_private')), ENT_QUOTES)); 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 f7bc6938043..e4972596d22 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1402,43 +1402,66 @@ abstract class CommonObject /** * Update private note of element * - * @param string $note New value for note + * @param string $note_private New value for note * @return int <0 if KO, >0 if OK */ - function update_note($note) + function update_note_private($note_private) { if (! $this->table_element) { - dol_syslog(get_class($this)."::update_note was called on objet with property table_element not defined", LOG_ERR); + 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; - // TODO uniformize fields to note_private - if ($this->table_element == 'fichinter' || $this->table_element == 'projet' || $this->table_element == 'projet_task') - { - $sql.= " SET note_private = '".$this->db->escape($note)."'"; - } - else - { - $sql.= " SET note = '".$this->db->escape($note)."'"; - } + $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 sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update_note_private sql=".$sql, LOG_DEBUG); if ($this->db->query($sql)) { - $this->note = $note; // deprecated $this->note_private = $note; return 1; } else { $this->error=$this->db->error(); - dol_syslog(get_class($this)."::update_note error=".$this->error, LOG_ERR); + 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) + { + if (! $this->table_element) + { + dol_syslog(get_class($this)."::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 = ".(!empty($note)?("'".$this->db->escape($note)."'"):"NULL"); + $sql.= " WHERE rowid =". $this->id; + + dol_syslog(get_class($this)."::update_note sql=".$sql, LOG_DEBUG); + if ($this->db->query($sql)) + { + $this->note = $note; // deprecated + return 1; + } + else + { + $this->error=$this->db->error(); + dol_syslog(get_class($this)."::update_note error=".$this->error, LOG_ERR); + return -1; + } + } /** * Update public note of element @@ -1455,7 +1478,7 @@ abstract class CommonObject } $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; - $sql.= " SET note_public = '".$this->db->escape($note_public)."'"; + $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); diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index cb701a07c8d..c591b2c023c 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -3,6 +3,7 @@ * Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com> * Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com> + * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -85,7 +86,7 @@ function societe_prepare_head($object) if ($user->societe_id == 0) { // Notes - $head[$h][0] = DOL_URL_ROOT.'/societe/note.php?socid='.$object->id; + $head[$h][0] = DOL_URL_ROOT.'/societe/note.php?id='.$object->id; $head[$h][1] = $langs->trans("Note"); $head[$h][2] = 'note'; $h++; @@ -529,7 +530,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') } print "</tr>"; - $sql = "SELECT p.rowid, p.lastname, p.firstname, p.fk_pays, p.poste, p.phone, p.phone_mobile, p.fax, p.email, p.note "; + $sql = "SELECT p.rowid, p.lastname, p.firstname, p.fk_pays, p.poste, p.phone, p.phone_mobile, p.fax, p.email "; $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p"; $sql .= " WHERE p.fk_soc = ".$object->id; $sql .= " ORDER by p.datec"; diff --git a/htdocs/core/lib/sendings.lib.php b/htdocs/core/lib/sendings.lib.php index 78fd0b9f0e0..2d4728c07d4 100644 --- a/htdocs/core/lib/sendings.lib.php +++ b/htdocs/core/lib/sendings.lib.php @@ -63,6 +63,11 @@ function shipping_prepare_head($object) $head[$h][1] = $langs->trans("ContactsAddresses"); $head[$h][2] = 'contact'; $h++; + + $head[$h][0] = DOL_URL_ROOT."/expedition/note.php?id=".$object->id; + $head[$h][1] = $langs->trans("Notes"); + $head[$h][2] = 'note'; + $h++; // Show more tabs from modules // Entries must be declared in modules descriptor with line diff --git a/htdocs/core/modules/expedition/doc/pdf_expedition_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_expedition_merou.modules.php index 39c70faab79..4f6f04cc742 100644 --- a/htdocs/core/modules/expedition/doc/pdf_expedition_merou.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_expedition_merou.modules.php @@ -2,6 +2,7 @@ /* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com> + * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -191,6 +192,27 @@ class pdf_expedition_merou extends ModelePdfExpedition $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10); $tab_height = $this->page_hauteur - $tab_top - $heightforfooter; $tab_height_newpage = $this->page_hauteur - $tab_top_newpage - $heightforfooter; + + // Affiche notes + if (! empty($object->note_public)) + { + $pdf->SetFont('','', $default_font_size - 1); + $pdf->writeHTMLCell(190, 3, $this->marge_gauche, $tab_top, dol_htmlentitiesbr($object->note_public), 0, 1); + $nexY = $pdf->GetY(); + $height_note=$nexY-$tab_top; + + // Rect prend une longueur en 3eme param + $pdf->SetDrawColor(192,192,192); + $pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+1); + + $tab_height = $tab_height - $height_note; + $tab_top = $nexY+6; + } + else + { + $height_note=0; + } + $pdf->SetFillColor(240,240,240); $pdf->SetTextColor(0,0,0); diff --git a/htdocs/core/tpl/notes.tpl.php b/htdocs/core/tpl/notes.tpl.php index 1fb10e66fda..e0acf0489e8 100644 --- a/htdocs/core/tpl/notes.tpl.php +++ b/htdocs/core/tpl/notes.tpl.php @@ -1,5 +1,6 @@ <?php /* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com> + * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,19 +19,21 @@ $module = $object->element; $note_public = 'note_public'; -$note_private = 'note'; +$note_private = 'note_private'; $colwidth=(isset($colwidth)?$colwidth:25); $permission=(isset($permission)?$permission:(isset($user->rights->$module->creer)?$user->rights->$module->creer:0)); // If already defined by caller page $moreparam=(isset($moreparam)?$moreparam:''); // Special cases -if ($module == 'propal') { $permission=$user->rights->propale->creer; } -elseif ($module == 'fichinter') { $permission=$user->rights->ficheinter->creer; $note_private = 'note_private'; } -elseif ($module == 'project') { $permission=$user->rights->projet->creer; $note_private = 'note_private'; } -elseif ($module == 'project_task') { $permission=$user->rights->projet->creer; $note_private = 'note_private'; } -elseif ($module == 'invoice_supplier') { $permission=$user->rights->fournisseur->facture->creer; } -elseif ($module == 'order_supplier') { $permission=$user->rights->fournisseur->commande->creer; } +if ($module == 'propal') { $permission=$user->rights->propale->creer;} +elseif ($module == 'fichinter') { $permission=$user->rights->ficheinter->creer;} +elseif ($module == 'project') { $permission=$user->rights->projet->creer;} +elseif ($module == 'project_task') { $permission=$user->rights->projet->creer;} +elseif ($module == 'invoice_supplier') { $permission=$user->rights->fournisseur->facture->creer;} +elseif ($module == 'order_supplier') { $permission=$user->rights->fournisseur->commande->creer;} +elseif ($module == 'societe') { $permission=$user->rights->societe->creer;} +elseif ($module == 'shipping') { $permission=$user->rights->expedition->creer;} if (! empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) $typeofdata='ckeditor:dolibarr_notes:100%:200::1:12:100'; else $typeofdata='textarea:12:100'; diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 9896eb50486..9a59d25d262 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -4,6 +4,7 @@ * Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be> * Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es> + * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -56,6 +57,8 @@ class Expedition extends CommonObject var $tracking_url; var $statut; var $billed; + var $note_public; + var $note_private; var $trueWeight; var $weight_units; @@ -191,6 +194,8 @@ class Expedition extends CommonObject $sql.= ", height"; $sql.= ", weight_units"; $sql.= ", size_units"; + $sql.= ", note_private"; + $sql.= ", note_public"; $sql.= ") VALUES ("; $sql.= "'(PROV)'"; $sql.= ", ".$conf->entity; @@ -210,6 +215,8 @@ class Expedition extends CommonObject $sql.= ", ".$this->sizeH; // TODO Should use this->trueHeight $sql.= ", ".$this->weight_units; $sql.= ", ".$this->size_units; + $sql.= ", ".(!empty($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null"); + $sql.= ", ".(!empty($this->note_public)?"'".$this->db->escape($this->note_public)."'":"null"); $sql.= ")"; $resql=$this->db->query($sql); @@ -341,6 +348,7 @@ class Expedition extends CommonObject $sql.= ", e.date_expedition as date_expedition, e.model_pdf, e.fk_address, e.date_delivery"; $sql.= ", e.fk_expedition_methode, e.tracking_number"; $sql.= ", el.fk_source as origin_id, el.sourcetype as origin"; + $sql.= ", e.note_private, e.note_public"; $sql.= " FROM ".MAIN_DB_PREFIX."expedition as e"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = e.rowid AND el.targettype = '".$this->element."'"; $sql.= " WHERE e.entity = ".$conf->entity; @@ -387,6 +395,9 @@ class Expedition extends CommonObject $this->height_units = $obj->size_units; $this->trueDepth = $obj->size; $this->depth_units = $obj->size_units; + + $this->note_public = $obj->note_public; + $this->note_private = $obj->note_private; // A denormalized value $this->trueSize = $obj->size."x".$obj->width."x".$obj->height; @@ -690,7 +701,8 @@ class Expedition extends CommonObject if (isset($this->size_units)) $this->size_units=trim($this->size_units); if (isset($this->weight_units)) $this->weight_units=trim($this->weight_units); if (isset($this->trueWeight)) $this->weight=trim($this->trueWeight); - if (isset($this->note)) $this->note=trim($this->note); + if (isset($this->note_private)) $this->note=trim($this->note_private); + if (isset($this->note_public)) $this->note=trim($this->note_public); if (isset($this->model_pdf)) $this->model_pdf=trim($this->model_pdf); @@ -721,7 +733,8 @@ class Expedition extends CommonObject $sql.= " size=".(($this->trueDepth != '')?$this->trueDepth:"null").","; $sql.= " weight_units=".(isset($this->weight_units)?$this->weight_units:"null").","; $sql.= " weight=".(($this->trueWeight != '')?$this->trueWeight:"null").","; - $sql.= " note=".(isset($this->note)?"'".$this->db->escape($this->note)."'":"null").","; + $sql.= " note_private=".(isset($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null").","; + $sql.= " note_public=".(isset($this->note_public)?"'".$this->db->escape($this->note_public)."'":"null").","; $sql.= " model_pdf=".(isset($this->model_pdf)?"'".$this->db->escape($this->model_pdf)."'":"null").","; $sql.= " entity=".$conf->entity; @@ -1093,6 +1106,9 @@ class Expedition extends CommonObject $this->origin_id = 1; $this->origin = 'commande'; + + $this->note_private = 'Private note'; + $this->note_public = 'Public note'; $nbp = 5; $xnbp = 0; diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php index 390e4081066..51d19ff2fa6 100644 --- a/htdocs/expedition/fiche.php +++ b/htdocs/expedition/fiche.php @@ -4,6 +4,7 @@ * Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es> + * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -32,6 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/sendings.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/expedition/modules_expedition.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; @@ -107,6 +109,8 @@ if ($action == 'add') $object->shipping_method_id = GETPOST('shipping_method_id','int'); $object->tracking_number = GETPOST('tracking_number','alpha'); $object->ref_int = GETPOST('ref_int','alpha'); + $object->note_private = GETPOST('note_private'); + $object->note_public = GETPOST('note_public'); $num=count($objectsrc->lines); $totalqty=0; @@ -629,12 +633,22 @@ if ($action == 'create') print $form->select_date($object->date_livraison?$object->date_livraison:-1,'date_delivery',1,1); print "</td>\n"; print '</tr>'; + + // Note Public + print '<tr><td>'.$langs->trans("NotePublic").'</td>'; + print '<td colspan="3">'; + $doleditor = new DolEditor('note_public', $object->note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); + print $doleditor->Create(1); + print "</td></tr>"; - // Note - if ($object->note && ! $user->societe_id) + // Note Private + if ($object->note_private && ! $user->societe_id) { print '<tr><td>'.$langs->trans("NotePrivate").'</td>'; - print '<td colspan="3">'.nl2br($object->note)."</td></tr>"; + print '<td colspan="3">'; + $doleditor = new DolEditor('note_private', $object->note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); + print $doleditor->Create(1); + print "</td></tr>"; } // Weight diff --git a/htdocs/expedition/note.php b/htdocs/expedition/note.php new file mode 100644 index 00000000000..17613c72b58 --- /dev/null +++ b/htdocs/expedition/note.php @@ -0,0 +1,160 @@ +<?php +/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> + * Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net> +* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> +* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** + * \file htdocs/expedition/note.php +* \ingroup expedition +* \brief Note card expedition +*/ + +error_reporting(E_ALL); +ini_set('display_errors', true); +ini_set('html_errors', false); + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/sendings.lib.php'; + +$langs->load("sendings"); +$langs->load("companies"); +$langs->load("bills"); +$langs->load('deliveries'); +$langs->load('orders'); +$langs->load('stocks'); +$langs->load('other'); +$langs->load('propal'); + +$id=(GETPOST('id','int')?GETPOST('id','int'):GETPOST('facid','int')); // For backward compatibility +$ref=GETPOST('ref','alpha'); +$action=GETPOST('action','alpha'); + +// Security check +$socid=''; +if ($user->societe_id) $socid=$user->societe_id; +$result=restrictedArea($user, $origin, $origin_id); + +$object = new Expedition($db); +$object->fetch($id); + + +/******************************************************************************/ +/* Actions */ +/******************************************************************************/ + +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)); + 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)); + if ($result < 0) dol_print_error($db,$object->error); +} + + +/******************************************************************************/ +/* Affichage fiche */ +/******************************************************************************/ + +llxHeader(); + +$form = new Form($db); + +if ($id > 0 || ! empty($ref)) +{ + + $soc = new Societe($db); + $soc->fetch($object->socid); + + $head=shipping_prepare_head($object); + dol_fiche_head($head, 'note', $langs->trans("Sending"), 0, 'sending'); + + print '<table class="border" width="100%">'; + + $linkback = '<a href="'.DOL_URL_ROOT.'/expedition/liste.php">'.$langs->trans("BackToList").'</a>'; + + // Ref + print '<tr><td width="20%">'.$langs->trans("Ref").'</td>'; + print '<td colspan="3">'; + print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); + print '</td></tr>'; + + // Customer + print '<tr><td width="20%">'.$langs->trans("Customer").'</td>'; + print '<td colspan="3">'.$soc->getNomUrl(1).'</td>'; + print "</tr>"; + + // Linked documents + if ($typeobject == 'commande' && $object->$typeobject->id && ! empty($conf->commande->enabled)) + { + print '<tr><td>'; + $objectsrc=new Commande($db); + $objectsrc->fetch($object->$typeobject->id); + print $langs->trans("RefOrder").'</td>'; + print '<td colspan="3">'; + print $objectsrc->getNomUrl(1,'commande'); + print "</td>\n"; + print '</tr>'; + } + if ($typeobject == 'propal' && $object->$typeobject->id && ! empty($conf->propal->enabled)) + { + print '<tr><td>'; + $objectsrc=new Propal($db); + $objectsrc->fetch($object->$typeobject->id); + print $langs->trans("RefProposal").'</td>'; + print '<td colspan="3">'; + print $objectsrc->getNomUrl(1,'expedition'); + print "</td>\n"; + print '</tr>'; + } + + // Ref customer + print '<tr><td>'.$langs->trans("RefCustomer").'</td>'; + print '<td colspan="3">'.$object->ref_customer."</a></td>\n"; + print '</tr>'; + + // Date creation + print '<tr><td>'.$langs->trans("DateCreation").'</td>'; + print '<td colspan="3">'.dol_print_date($object->date_creation,"day")."</td>\n"; + print '</tr>'; + + // Delivery date planed + print '<tr><td>'.$langs->trans("DateDeliveryPlanned").'</td>'; + print '<td colspan="3">'.dol_print_date($object->date_delivery,"dayhourtext")."</td>\n"; + print '</tr>'; + + print '</table>'; + + print '<br>'; + + include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; + + dol_fiche_end(); +} + + +llxFooter(); + +$db->close(); +?> diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php index e355ebd0c96..3886edb30f9 100644 --- a/htdocs/fichinter/fiche.php +++ b/htdocs/fichinter/fiche.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es> + * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -39,6 +40,7 @@ if (! empty($conf->global->FICHEINTER_ADDON) && is_readable(DOL_DOCUMENT_ROOT ." { require_once DOL_DOCUMENT_ROOT ."/core/modules/fichinter/mod_".$conf->global->FICHEINTER_ADDON.'.php'; } +require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $langs->load("companies"); $langs->load("interventions"); @@ -977,16 +979,20 @@ if ($action == 'create') print '<tr>'; print '<td class="border" valign="top">'.$langs->trans('NotePublic').'</td>'; print '<td valign="top" colspan="2">'; - print '<textarea name="note_public" cols="80" rows="'.ROWS_3.'">'.$note_public.'</textarea>'; + $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); + print $doleditor->Create(1); + //print '<textarea name="note_public" cols="80" rows="'.ROWS_3.'">'.$note_public.'</textarea>'; print '</td></tr>'; // Private note - if (! $user->societe_id) + if (!empty($user->societe_id)) { print '<tr>'; print '<td class="border" valign="top">'.$langs->trans('NotePrivate').'</td>'; print '<td valign="top" colspan="2">'; - print '<textarea name="note_private" cols="80" rows="'.ROWS_3.'">'.$note_private.'</textarea>'; + $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); + print $doleditor->Create(1); + //print '<textarea name="note_private" cols="80" rows="'.ROWS_3.'">'.$note_private.'</textarea>'; print '</td></tr>'; } diff --git a/htdocs/fichinter/note.php b/htdocs/fichinter/note.php index 054933139d8..a2de821e6c7 100644 --- a/htdocs/fichinter/note.php +++ b/htdocs/fichinter/note.php @@ -1,6 +1,7 @@ <?php /* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es> + * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -53,7 +54,7 @@ if ($action == 'setnote_public' && $user->rights->ficheinter->creer) else if ($action == 'setnote_private' && $user->rights->ficheinter->creer) { - $result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES)); + $result=$object->update_note_private(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES)); if ($result < 0) dol_print_error($db,$object->error); } diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 99a443c71db..90e5afa1726 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -6,6 +6,7 @@ * Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2013 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2012 Marcos García <marcosgdf@gmail.com> + * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -121,7 +122,7 @@ class CommandeFournisseur extends CommonOrder $sql.= " c.date_creation, c.date_valid, c.date_approve,"; $sql.= " c.fk_user_author, c.fk_user_valid, c.fk_user_approve,"; $sql.= " c.date_commande as date_commande, c.date_livraison as date_livraison, c.fk_cond_reglement, c.fk_mode_reglement, c.fk_projet as fk_project, c.remise_percent, c.source, c.fk_input_method,"; - $sql.= " c.note as note_private, c.note_public, c.model_pdf, c.extraparams,"; + $sql.= " c.note_private, c.note_public, c.model_pdf, c.extraparams,"; $sql.= " cm.libelle as methode_commande,"; $sql.= " cr.code as cond_reglement_code, cr.libelle as cond_reglement_libelle,"; $sql.= " p.code as mode_reglement_code, p.libelle as mode_reglement_libelle"; @@ -927,7 +928,7 @@ class CommandeFournisseur extends CommonOrder $sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_fournisseur ("; $sql.= "ref"; $sql.= ", ref_supplier"; - $sql.= ", note"; + $sql.= ", note_private"; $sql.= ", note_public"; $sql.= ", entity"; $sql.= ", fk_soc"; @@ -942,7 +943,7 @@ class CommandeFournisseur extends CommonOrder $sql.= " VALUES ("; $sql.= "''"; $sql.= ", '".$this->ref_supplier."'"; - $sql.= ", '".$this->note."'"; + $sql.= ", '".$this->note_private."'"; $sql.= ", '".$this->note_public."'"; $sql.= ", ".$conf->entity; $sql.= ", ".$this->socid; @@ -1874,7 +1875,7 @@ class CommandeFournisseur extends CommonOrder $this->cond_reglement_code = 'RECEP'; $this->mode_reglement_code = 'CHQ'; $this->note_public='This is a comment (public)'; - $this->note='This is a comment (private)'; + $this->note_private='This is a comment (private)'; // Lines $nbp = 5; $xnbp = 0; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index e1d084939ac..d3c7d12d98a 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -6,6 +6,7 @@ * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com> + * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -140,7 +141,7 @@ class FactureFournisseur extends CommonInvoice $sql.= ", fk_soc"; $sql.= ", datec"; $sql.= ", datef"; - $sql.= ", note"; + $sql.= ", note_private"; $sql.= ", note_public"; $sql.= ", fk_user_author"; $sql.= ", date_lim_reglement"; @@ -153,7 +154,7 @@ class FactureFournisseur extends CommonInvoice $sql.= ", ".$this->socid; $sql.= ", '".$this->db->idate($now)."'"; $sql.= ", '".$this->db->idate($this->date)."'"; - $sql.= ", '".$this->db->escape($this->note)."'"; + $sql.= ", '".$this->db->escape($this->note_private)."'"; $sql.= ", '".$this->db->escape($this->note_public)."'"; $sql.= ", ".$user->id.","; $sql.= $this->date_echeance!=''?"'".$this->db->idate($this->date_echeance)."'":"null"; @@ -297,7 +298,7 @@ class FactureFournisseur extends CommonInvoice $sql.= " t.fk_projet,"; $sql.= " t.fk_cond_reglement,"; $sql.= " t.date_lim_reglement,"; - $sql.= " t.note as note_private,"; + $sql.= " t.note_private,"; $sql.= " t.note_public,"; $sql.= " t.model_pdf,"; $sql.= " t.import_key,"; @@ -496,7 +497,7 @@ class FactureFournisseur extends CommonInvoice if (isset($this->fk_facture_source)) $this->fk_facture_source=trim($this->fk_facture_source); if (isset($this->fk_project)) $this->fk_project=trim($this->fk_project); if (isset($this->fk_cond_reglement)) $this->fk_cond_reglement=trim($this->fk_cond_reglement); - if (isset($this->note)) $this->note=trim($this->note); + if (isset($this->note_private)) $this->note=trim($this->note_private); if (isset($this->note_public)) $this->note_public=trim($this->note_public); if (isset($this->model_pdf)) $this->model_pdf=trim($this->model_pdf); if (isset($this->import_key)) $this->import_key=trim($this->import_key); @@ -535,7 +536,7 @@ class FactureFournisseur extends CommonInvoice $sql.= " fk_projet=".(isset($this->fk_project)?$this->fk_project:"null").","; $sql.= " fk_cond_reglement=".(isset($this->fk_cond_reglement)?$this->fk_cond_reglement:"null").","; $sql.= " date_lim_reglement=".(dol_strlen($this->date_echeance)!=0 ? "'".$this->db->idate($this->date_echeance)."'" : 'null').","; - $sql.= " note=".(isset($this->note)?"'".$this->db->escape($this->note)."'":"null").","; + $sql.= " note_private=".(isset($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null").","; $sql.= " note_public=".(isset($this->note_public)?"'".$this->db->escape($this->note_public)."'":"null").","; $sql.= " model_pdf=".(isset($this->model_pdf)?"'".$this->db->escape($this->model_pdf)."'":"null").","; $sql.= " import_key=".(isset($this->import_key)?"'".$this->db->escape($this->import_key)."'":"null").""; @@ -1433,7 +1434,7 @@ class FactureFournisseur extends CommonInvoice $this->cond_reglement_code = 'RECEP'; $this->mode_reglement_code = 'CHQ'; $this->note_public='This is a comment (public)'; - $this->note='This is a comment (private)'; + $this->note_private='This is a comment (private)'; // Lines $nbp = 5; $xnbp = 0; diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index 6ba577c152b..7a5128cca45 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -6,6 +6,7 @@ * Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2012 Marcos García <marcosgdf@gmail.com> + * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -37,6 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; if (!empty($conf->produit->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; if (!empty($conf->projet->enabled)) @@ -142,9 +144,9 @@ else if ($action == 'setnote_public' && $user->rights->fournisseur->commande->cr if ($result < 0) dol_print_error($db,$object->error); } -else if ($action == 'setnote' && $user->rights->fournisseur->commande->creer) +else if ($action == 'setnote_private' && $user->rights->fournisseur->commande->creer) { - $result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES)); + $result=$object->update_note_private(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES)); if ($result < 0) dol_print_error($db,$object->error); } @@ -675,7 +677,7 @@ else if ($action == 'add' && $user->rights->fournisseur->commande->creer) // Creation commande $object->ref_supplier = GETPOST('refsupplier'); $object->socid = $socid; - $object->note = GETPOST('note'); + $object->note_private = GETPOST('note_private'); $object->note_public = GETPOST('note_public'); $id = $object->create($user); @@ -997,15 +999,25 @@ if ($action=="create") print '</tr>'; print '</td></tr>'; - - print '<tr><td>'.$langs->trans('Note').'</td>'; - print '<td><textarea name="note" wrap="soft" cols="60" rows="'.ROWS_5.'"></textarea></td>'; + + print '<tr><td>'.$langs->trans('NotePublic').'</td>'; + print '<td>'; + $doleditor = new DolEditor('note_public', GETPOST('note_public'), '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); + print $doleditor->Create(1); + print '</td>'; + //print '<textarea name="note_public" wrap="soft" cols="60" rows="'.ROWS_5.'"></textarea>'; print '</tr>'; - print '<tr><td>'.$langs->trans('NotePublic').'</td>'; - print '<td><textarea name="note_public" wrap="soft" cols="60" rows="'.ROWS_5.'"></textarea></td>'; + print '<tr><td>'.$langs->trans('NotePrivate').'</td>'; + print '<td>'; + $doleditor = new DolEditor('note_private', GETPOST('note_private'), '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); + print $doleditor->Create(1); + print '</td>'; + //print '<td><textarea name="note_private" wrap="soft" cols="60" rows="'.ROWS_5.'"></textarea></td>'; print '</tr>'; + + // Other options $parameters=array(); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook @@ -1504,9 +1516,7 @@ elseif (! empty($object->id)) $parameters=array('fk_parent_line'=>$line->fk_parent_line, 'line'=>$line,'var'=>$var,'num'=>$num,'i'=>$i); $reshook=$hookmanager->executeHooks('formEditProductOptions',$parameters,$object,$action); } - - // Description - Editor wysiwyg - require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $nbrows=ROWS_2; if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; $doleditor=new DolEditor('eldesc',$line->description,'',200,'dolibarr_details','',false,true,$conf->global->FCKEDITOR_ENABLE_DETAILS,$nbrows,70); @@ -1532,8 +1542,6 @@ elseif (! empty($object->id)) */ if ($object->statut == 0 && $user->rights->fournisseur->commande->creer && $action <> 'editline') { - //WYSIWYG Editor - require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; print '<tr class="liste_titre">'; print '<td>'; diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index e1ff199de6d..4393023f07c 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -6,6 +6,7 @@ * Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com> + * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -35,6 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; if (!empty($conf->produit->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; if (!empty($conf->projet->enabled)) @@ -212,10 +214,10 @@ elseif ($action == 'setnote_public' && $user->rights->fournisseur->facture->cree $result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES)); if ($result < 0) dol_print_error($db,$object->error); } -elseif ($action == 'setnote' && $user->rights->fournisseur->facture->creer) +elseif ($action == 'setnote_private' && $user->rights->fournisseur->facture->creer) { $object->fetch($id); - $result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES)); + $result=$object->update_note_private(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES)); if ($result < 0) dol_print_error($db,$object->error); } @@ -273,7 +275,8 @@ elseif ($action == 'add' && $user->rights->fournisseur->facture->creer) $object->libelle = $_POST['libelle']; $object->date = $datefacture; $object->date_echeance = $datedue; - $object->note_public = $_POST['note']; + $object->note_public = GETPOST('note_public'); + $object->note_private = GETPOST('note_private'); // If creation from another object of another module if ($_POST['origin'] && $_POST['originid']) @@ -1152,7 +1155,20 @@ if ($action == 'create') print '</td></tr>'; print '<tr><td>'.$langs->trans('NotePublic').'</td>'; - print '<td><textarea name="note" wrap="soft" cols="60" rows="'.ROWS_5.'"></textarea></td>'; + print '<td>'; + $doleditor = new DolEditor('note_public', GETPOST('note_public'), '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); + print $doleditor->Create(1); + print '</td>'; + // print '<td><textarea name="note" wrap="soft" cols="60" rows="'.ROWS_5.'"></textarea></td>'; + print '</tr>'; + + // Private note + print '<tr><td>'.$langs->trans('NotePrivate').'</td>'; + print '<td>'; + $doleditor = new DolEditor('note_private', GETPOST('note_private'), '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); + print $doleditor->Create(1); + print '</td>'; + // print '<td><textarea name="note" wrap="soft" cols="60" rows="'.ROWS_5.'"></textarea></td>'; print '</tr>'; if (is_object($objectsrc)) @@ -1702,8 +1718,6 @@ else $reshook=$hookmanager->executeHooks('formEditProductOptions',$parameters,$object,$action); } - // Description - Editor wysiwyg - require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $nbrows=ROWS_2; if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; $doleditor=new DolEditor('desc',$object->lines[$i]->description,'',128,'dolibarr_details','',false,true,$conf->global->FCKEDITOR_ENABLE_DETAILS,$nbrows,70); @@ -1849,8 +1863,6 @@ else $reshook=$hookmanager->executeHooks('formCreateSupplierProductOptions',$parameters,$object,$action); } - // Editor wysiwyg - require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $nbrows=ROWS_2; if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; $doleditor=new DolEditor('dp_desc',GETPOST("dp_desc"),'',100,'dolibarr_details','',false,true,$conf->global->FCKEDITOR_ENABLE_DETAILS,$nbrows,70); diff --git a/htdocs/fourn/facture/note.php b/htdocs/fourn/facture/note.php index bbdd1b5f60f..834858788e9 100644 --- a/htdocs/fourn/facture/note.php +++ b/htdocs/fourn/facture/note.php @@ -2,26 +2,27 @@ /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see <http://www.gnu.org/licenses/>. + * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. */ /** * \file htdocs/fourn/facture/note.php * \ingroup facture - * \brief Fiche de notes sur une facture fournisseur - */ +* \brief Fiche de notes sur une facture fournisseur +*/ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php'; @@ -50,21 +51,21 @@ $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)); - if ($result < 0) dol_print_error($db,$object->error); + $result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES)); + if ($result < 0) dol_print_error($db,$object->error); } -elseif ($action == 'setnote' && $user->rights->fournisseur->facture->creer) +elseif ($action == 'setnote_private' && $user->rights->fournisseur->facture->creer) { - $result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES)); - if ($result < 0) dol_print_error($db,$object->error); + $result=$object->update_note_private(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES)); + if ($result < 0) dol_print_error($db,$object->error); } // Set label if ($action == 'setlabel' && $user->rights->fournisseur->facture->creer) { - $object->label=$_POST['label']; - $result=$object->update($user); - if ($result < 0) dol_print_error($db); + $object->label=$_POST['label']; + $result=$object->update($user); + if ($result < 0) dol_print_error($db); } @@ -78,82 +79,82 @@ llxHeader(); if ($id) { - $object->fetch_thirdparty(); - - $head = facturefourn_prepare_head($object); - $titre=$langs->trans('SupplierInvoice'); - dol_fiche_head($head, 'note', $titre, 0, 'bill'); - - - print '<table class="border" width="100%">'; - - $linkback = '<a href="'.DOL_URL_ROOT.'/fourn/facture/index.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>'; - - // Ref - print '<tr><td width="20%" nowrap="nowrap">'.$langs->trans("Ref").'</td><td colspan="3">'; - print $form->showrefnav($object, 'facid', $linkback, 1, 'rowid', 'ref', $morehtmlref); - print '</td>'; - print "</tr>\n"; - - // Ref supplier - print '<tr><td nowrap="nowrap">'.$langs->trans("RefSupplier").'</td><td colspan="3">'.$object->ref_supplier.'</td>'; - print "</tr>\n"; - - // Company - print '<tr><td>'.$langs->trans('Supplier').'</td><td colspan="3">'.$object->thirdparty->getNomUrl(1).'</td></tr>'; - - // Type - print '<tr><td>'.$langs->trans('Type').'</td><td colspan="4">'; - print $object->getLibType(); - if ($object->type == 1) - { - $facreplaced=new FactureFournisseur($db); - $facreplaced->fetch($object->fk_facture_source); - print ' ('.$langs->transnoentities("ReplaceInvoice",$facreplaced->getNomUrl(1)).')'; - } - if ($object->type == 2) - { - $facusing=new FactureFournisseur($db); - $facusing->fetch($object->fk_facture_source); - print ' ('.$langs->transnoentities("CorrectInvoice",$facusing->getNomUrl(1)).')'; - } - - $facidavoir=$object->getListIdAvoirFromInvoice(); - if (count($facidavoir) > 0) - { - print ' ('.$langs->transnoentities("InvoiceHasAvoir"); - $i=0; - foreach($facidavoir as $fid) - { - if ($i==0) print ' '; - else print ','; - $facavoir=new FactureFournisseur($db); - $facavoir->fetch($fid); - print $facavoir->getNomUrl(1); - } - print ')'; - } - if ($facidnext > 0) - { - $facthatreplace=new FactureFournisseur($db); - $facthatreplace->fetch($facidnext); - print ' ('.$langs->transnoentities("ReplacedByInvoice",$facthatreplace->getNomUrl(1)).')'; - } - print '</td></tr>'; - - // Label - print '<tr><td>'.$form->editfieldkey("Label",'label',$object->label,$object,0).'</td><td colspan="3">'; - print $form->editfieldval("Label",'label',$object->label,$object,0); - print '</td>'; - - print "</table>"; - - print '<br>'; - - $colwidth=20; - include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; - - dol_fiche_end(); + $object->fetch_thirdparty(); + + $head = facturefourn_prepare_head($object); + $titre=$langs->trans('SupplierInvoice'); + dol_fiche_head($head, 'note', $titre, 0, 'bill'); + + + print '<table class="border" width="100%">'; + + $linkback = '<a href="'.DOL_URL_ROOT.'/fourn/facture/index.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>'; + + // Ref + print '<tr><td width="20%" nowrap="nowrap">'.$langs->trans("Ref").'</td><td colspan="3">'; + print $form->showrefnav($object, 'facid', $linkback, 1, 'rowid', 'ref', $morehtmlref); + print '</td>'; + print "</tr>\n"; + + // Ref supplier + print '<tr><td nowrap="nowrap">'.$langs->trans("RefSupplier").'</td><td colspan="3">'.$object->ref_supplier.'</td>'; + print "</tr>\n"; + + // Company + print '<tr><td>'.$langs->trans('Supplier').'</td><td colspan="3">'.$object->thirdparty->getNomUrl(1).'</td></tr>'; + + // Type + print '<tr><td>'.$langs->trans('Type').'</td><td colspan="4">'; + print $object->getLibType(); + if ($object->type == 1) + { + $facreplaced=new FactureFournisseur($db); + $facreplaced->fetch($object->fk_facture_source); + print ' ('.$langs->transnoentities("ReplaceInvoice",$facreplaced->getNomUrl(1)).')'; + } + if ($object->type == 2) + { + $facusing=new FactureFournisseur($db); + $facusing->fetch($object->fk_facture_source); + print ' ('.$langs->transnoentities("CorrectInvoice",$facusing->getNomUrl(1)).')'; + } + + $facidavoir=$object->getListIdAvoirFromInvoice(); + if (count($facidavoir) > 0) + { + print ' ('.$langs->transnoentities("InvoiceHasAvoir"); + $i=0; + foreach($facidavoir as $fid) + { + if ($i==0) print ' '; + else print ','; + $facavoir=new FactureFournisseur($db); + $facavoir->fetch($fid); + print $facavoir->getNomUrl(1); + } + print ')'; + } + if ($facidnext > 0) + { + $facthatreplace=new FactureFournisseur($db); + $facthatreplace->fetch($facidnext); + print ' ('.$langs->transnoentities("ReplacedByInvoice",$facthatreplace->getNomUrl(1)).')'; + } + print '</td></tr>'; + + // Label + print '<tr><td>'.$form->editfieldkey("Label",'label',$object->label,$object,0).'</td><td colspan="3">'; + print $form->editfieldval("Label",'label',$object->label,$object,0); + print '</td>'; + + print "</table>"; + + print '<br>'; + + $colwidth=20; + include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; + + dol_fiche_end(); } diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 8dfaf85ac71..a861496cb72 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com> * Copyright (C) 2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com> + * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -192,7 +193,7 @@ class Holiday extends CommonObject $sql.= " cp.date_cancel,"; $sql.= " cp.fk_user_cancel,"; $sql.= " cp.detail_refuse,"; - $sql.= " cp.note,"; + $sql.= " cp.note_private,"; $sql.= " cp.note_public"; $sql.= " FROM ".MAIN_DB_PREFIX."holiday as cp"; $sql.= " WHERE cp.rowid = ".$id; @@ -223,7 +224,7 @@ class Holiday extends CommonObject $this->date_cancel = $this->db->jdate($obj->date_cancel); $this->fk_user_cancel = $obj->fk_user_cancel; $this->detail_refuse = $obj->detail_refuse; - $this->note = $obj->note; + $this->note_private = $obj->note_private; $this->note_public = $obj->note_public; } $this->db->free($resql); diff --git a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql index fef019afd87..b2be5f7fa14 100755 --- a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql +++ b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql @@ -243,3 +243,19 @@ ALTER TABLE llx_facture_fourn_det ADD COLUMN info_bits integer NOT NULL DEFAULT ALTER TABLE llx_actioncomm ADD COLUMN transparency integer after fk_user_action; INSERT INTO llx_c_action_trigger (rowid,code,label,description,elementtype,rang) VALUES (29,'FICHINTER_SENTBYMAIL','Intervention sent by mail','Executed when a intervention is sent by mail','ficheinter',29); + +ALTER TABLE llx_expedition CHANGE COLUMN note note_private text; +ALTER TABLE llx_expedition ADD COLUMN note_public text after note_private; +ALTER TABLE llx_livraison CHANGE COLUMN note note_private text; +ALTER TABLE llx_facture CHANGE COLUMN note note_private text; +ALTER TABLE llx_commande CHANGE COLUMN note note_private text; +ALTER TABLE llx_propal CHANGE COLUMN note note_private text; +ALTER TABLE llx_commande_fournisseur CHANGE COLUMN note note_private text; +ALTER TABLE llx_contrat CHANGE COLUMN note note_private text; +ALTER TABLE llx_deplacement CHANGE COLUMN note note_private text; +ALTER TABLE llx_don CHANGE COLUMN note note_private text; +ALTER TABLE llx_facture_fourn CHANGE COLUMN note note_private text; +ALTER TABLE llx_facture_rec CHANGE COLUMN note note_private text; +ALTER TABLE llx_holiday CHANGE COLUMN note note_private text; +ALTER TABLE llx_societe CHANGE COLUMN note note_private text; +ALTER TABLE llx_socpeople CHANGE COLUMN note note_private text; diff --git a/htdocs/install/mysql/tables/llx_commande.sql b/htdocs/install/mysql/tables/llx_commande.sql index 0ef0eddb739..325b1f3fe13 100644 --- a/htdocs/install/mysql/tables/llx_commande.sql +++ b/htdocs/install/mysql/tables/llx_commande.sql @@ -50,7 +50,7 @@ create table llx_commande localtax2 double(24,8) default 0, -- total localtax2 total_ht double(24,8) default 0, total_ttc double(24,8) default 0, - note text, + note_private text, note_public text, model_pdf varchar(255), diff --git a/htdocs/install/mysql/tables/llx_commande_fournisseur.sql b/htdocs/install/mysql/tables/llx_commande_fournisseur.sql index ac9e49d604f..51e57452397 100644 --- a/htdocs/install/mysql/tables/llx_commande_fournisseur.sql +++ b/htdocs/install/mysql/tables/llx_commande_fournisseur.sql @@ -50,7 +50,7 @@ create table llx_commande_fournisseur localtax2 double(24,8) default 0, total_ht double(24,8) default 0, total_ttc double(24,8) default 0, - note text, + note_private text, note_public text, model_pdf varchar(255), @@ -61,4 +61,4 @@ create table llx_commande_fournisseur import_key varchar(14), extraparams varchar(255) -- for stock other parameters with json format -)ENGINE=innodb; \ No newline at end of file +)ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_contrat.sql b/htdocs/install/mysql/tables/llx_contrat.sql index e952c8eb073..7521eb0aa1b 100644 --- a/htdocs/install/mysql/tables/llx_contrat.sql +++ b/htdocs/install/mysql/tables/llx_contrat.sql @@ -37,7 +37,7 @@ create table llx_contrat fk_user_author integer NOT NULL default 0, fk_user_mise_en_service integer, fk_user_cloture integer, - note text, + note_private text, note_public text, import_key varchar(14), extraparams varchar(255) -- for stock other parameters with json format diff --git a/htdocs/install/mysql/tables/llx_deplacement.sql b/htdocs/install/mysql/tables/llx_deplacement.sql index acf774f41ec..34c4ab103cd 100644 --- a/htdocs/install/mysql/tables/llx_deplacement.sql +++ b/htdocs/install/mysql/tables/llx_deplacement.sql @@ -34,7 +34,7 @@ create table llx_deplacement km real, fk_soc integer, fk_projet integer DEFAULT 0, - note text, + note_private text, note_public text, extraparams varchar(255) -- for stock other parameters with json format diff --git a/htdocs/install/mysql/tables/llx_don.sql b/htdocs/install/mysql/tables/llx_don.sql index 40ab90eab80..259cac22966 100644 --- a/htdocs/install/mysql/tables/llx_don.sql +++ b/htdocs/install/mysql/tables/llx_don.sql @@ -44,7 +44,7 @@ create table llx_don fk_don_projet integer NULL, -- projet auquel est fait le don fk_user_author integer NOT NULL, fk_user_valid integer NULL, - note text, + note_private text, note_public text, model_pdf varchar(255), import_key varchar(14) diff --git a/htdocs/install/mysql/tables/llx_expedition.sql b/htdocs/install/mysql/tables/llx_expedition.sql index ef30ce38f7a..6e7bccf08e3 100644 --- a/htdocs/install/mysql/tables/llx_expedition.sql +++ b/htdocs/install/mysql/tables/llx_expedition.sql @@ -48,7 +48,8 @@ create table llx_expedition size integer, -- depth weight_units integer, -- unit of weight weight integer, -- weight - note text, + note_private text, + note_public text, model_pdf varchar(255) )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_facture.sql b/htdocs/install/mysql/tables/llx_facture.sql index a9046b49065..62ea8936e90 100644 --- a/htdocs/install/mysql/tables/llx_facture.sql +++ b/htdocs/install/mysql/tables/llx_facture.sql @@ -68,7 +68,7 @@ create table llx_facture fk_mode_reglement integer, -- mode de reglement (Virement, Prelevement) date_lim_reglement date, -- date limite de reglement - note text, + note_private text, note_public text, model_pdf varchar(255), import_key varchar(14), diff --git a/htdocs/install/mysql/tables/llx_facture_fourn.sql b/htdocs/install/mysql/tables/llx_facture_fourn.sql index 372004c4477..c2d26a9c7cb 100644 --- a/htdocs/install/mysql/tables/llx_facture_fourn.sql +++ b/htdocs/install/mysql/tables/llx_facture_fourn.sql @@ -61,7 +61,7 @@ create table llx_facture_fourn fk_cond_reglement integer DEFAULT 1 NOT NULL, -- condition de reglement (30 jours, fin de mois ...) date_lim_reglement date, -- date limite de reglement - note text, + note_private text, note_public text, model_pdf varchar(255), import_key varchar(14), diff --git a/htdocs/install/mysql/tables/llx_facture_rec.sql b/htdocs/install/mysql/tables/llx_facture_rec.sql index 8283de388dc..0a935a3623d 100644 --- a/htdocs/install/mysql/tables/llx_facture_rec.sql +++ b/htdocs/install/mysql/tables/llx_facture_rec.sql @@ -43,7 +43,7 @@ create table llx_facture_rec fk_mode_reglement integer DEFAULT 0, -- mode de reglement (Virement, Prelevement) date_lim_reglement date, -- date limite de reglement - note text, + note_private text, note_public text, usenewprice integer, diff --git a/htdocs/install/mysql/tables/llx_holiday.sql b/htdocs/install/mysql/tables/llx_holiday.sql index c83590c84c7..582b00034ff 100644 --- a/htdocs/install/mysql/tables/llx_holiday.sql +++ b/htdocs/install/mysql/tables/llx_holiday.sql @@ -34,7 +34,7 @@ fk_user_refuse integer DEFAULT NULL, date_cancel DATETIME DEFAULT NULL, fk_user_cancel integer DEFAULT NULL, detail_refuse varchar( 250 ) DEFAULT NULL, -note text, +note_private text, note_public text ) -ENGINE=innodb; \ No newline at end of file +ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_livraison.sql b/htdocs/install/mysql/tables/llx_livraison.sql index 780e2f50633..a940e191199 100644 --- a/htdocs/install/mysql/tables/llx_livraison.sql +++ b/htdocs/install/mysql/tables/llx_livraison.sql @@ -37,7 +37,7 @@ create table llx_livraison fk_address integer, -- delivery address (deprecated) fk_statut smallint DEFAULT 0, total_ht double(24,8) DEFAULT 0, - note text, + note_private text, note_public text, model_pdf varchar(255) diff --git a/htdocs/install/mysql/tables/llx_propal.sql b/htdocs/install/mysql/tables/llx_propal.sql index 2964e768e47..3155eed6370 100644 --- a/htdocs/install/mysql/tables/llx_propal.sql +++ b/htdocs/install/mysql/tables/llx_propal.sql @@ -57,7 +57,7 @@ create table llx_propal fk_cond_reglement integer, -- condition de reglement (30 jours, fin de mois ...) fk_mode_reglement integer, -- mode de reglement (Virement, Prelevement) - note text, + note_private text, note_public text, model_pdf varchar(255), date_livraison date DEFAULT NULL, -- delivery date diff --git a/htdocs/install/mysql/tables/llx_societe.sql b/htdocs/install/mysql/tables/llx_societe.sql index b0d601fff47..95ceadec503 100644 --- a/htdocs/install/mysql/tables/llx_societe.sql +++ b/htdocs/install/mysql/tables/llx_societe.sql @@ -62,7 +62,7 @@ create table llx_societe tva_intra varchar(20), -- tva capital real, -- capital de la societe fk_stcomm integer DEFAULT 0 NOT NULL, -- commercial statut - note text, -- + note_private text, -- note_public text, -- prefix_comm varchar(5), -- prefix commercial client tinyint DEFAULT 0, -- client 0/1/2 diff --git a/htdocs/install/mysql/tables/llx_socpeople.sql b/htdocs/install/mysql/tables/llx_socpeople.sql index 921580394a8..d06e91e5395 100644 --- a/htdocs/install/mysql/tables/llx_socpeople.sql +++ b/htdocs/install/mysql/tables/llx_socpeople.sql @@ -46,7 +46,7 @@ create table llx_socpeople priv smallint NOT NULL DEFAULT 0, fk_user_creat integer DEFAULT 0, -- user qui a creel'enregistrement fk_user_modif integer, - note text, + note_private text, note_public text, default_lang varchar(6), canvas varchar(32), -- type of canvas if used (null by default) diff --git a/htdocs/livraison/class/livraison.class.php b/htdocs/livraison/class/livraison.class.php index d5dce8c6830..ea1962be34c 100644 --- a/htdocs/livraison/class/livraison.class.php +++ b/htdocs/livraison/class/livraison.class.php @@ -4,6 +4,7 @@ * Copyright (C) 2006-2007 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be> * Copyright (C) 2011-2012 Philippe Grand <philippe.grand@atoo-net.com> + * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -49,6 +50,9 @@ class Livraison extends CommonObject var $socid; var $ref_customer; var $statut; + + var $note_public; + var $note_private; var $expedition_id; @@ -106,15 +110,19 @@ class Livraison extends CommonObject $sql.= ", fk_user_author"; $sql.= ", date_delivery"; $sql.= ", fk_address"; + $sql.= ", note_private"; + $sql.= ", note_public"; $sql.= ") VALUES ("; $sql.= "'(PROV)'"; $sql.= ", ".$conf->entity; $sql.= ", ".$this->socid; - $sql.= ", '".$this->ref_customer."'"; + $sql.= ", '".$this->db->escape($this->ref_customer)."'"; $sql.= ", ".$this->db->idate($now); $sql.= ", ".$user->id; $sql.= ", ".($this->date_delivery?"'".$this->db->idate($this->date_delivery)."'":"null"); $sql.= ", ".($this->fk_delivery_address > 0 ? $this->fk_delivery_address : "null"); + $sql.= ", ".(!empty($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null"); + $sql.= ", ".(!empty($this->note_public)?"'".$this->db->escape($this->note_public)."'":"null"); $sql.= ")"; dol_syslog("Livraison::create sql=".$sql, LOG_DEBUG); @@ -253,7 +261,7 @@ class Livraison extends CommonObject global $conf; $sql = "SELECT l.rowid, l.fk_soc, l.date_creation, l.date_valid, l.ref, l.ref_customer, l.fk_user_author,"; - $sql.=" l.total_ht, l.fk_statut, l.fk_user_valid, l.note, l.note_public"; + $sql.=" l.total_ht, l.fk_statut, l.fk_user_valid, l.note_private, l.note_public"; $sql.= ", l.date_delivery, l.fk_address, l.model_pdf"; $sql.= ", el.fk_source as origin_id, el.sourcetype as origin"; $sql.= " FROM ".MAIN_DB_PREFIX."livraison as l"; @@ -279,7 +287,8 @@ class Livraison extends CommonObject $this->user_author_id = $obj->fk_user_author; $this->user_valid_id = $obj->fk_user_valid; $this->fk_delivery_address = $obj->fk_address; - $this->note = $obj->note; + $this->note = $obj->note_private; //TODO deprecated + $this->note_private = $obj->note_private; $this->note_public = $obj->note_public; $this->modelpdf = $obj->model_pdf; $this->origin = $obj->origin; // May be 'shipping' @@ -488,7 +497,8 @@ class Livraison extends CommonObject $this->origin = $expedition->element; $this->origin_id = $expedition->id; - $this->note = $expedition->note; + $this->note_private = $expedition->note_private; + $this->note_public = $expedition->note_public; $this->fk_project = $expedition->fk_project; $this->date_delivery = $expedition->date_delivery; $this->fk_delivery_address = $expedition->fk_delivery_address; @@ -792,7 +802,8 @@ class Livraison extends CommonObject $this->specimen=1; $this->socid = 1; $this->date_delivery = $now; - $this->note_public='SPECIMEN'; + $this->note_public='Pulbic note'; + $this->note_private='Private note'; $i=0; $line=new LivraisonLigne($this->db); diff --git a/htdocs/livraison/fiche.php b/htdocs/livraison/fiche.php index b3ae95fd512..2849daa9c67 100644 --- a/htdocs/livraison/fiche.php +++ b/htdocs/livraison/fiche.php @@ -4,6 +4,7 @@ * Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be> + * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -446,7 +447,7 @@ else $delivery = new Livraison($db); $result = $delivery->fetch($id); $delivery->fetch_thirdparty(); - + $expedition=new Expedition($db); $result = $expedition->fetch($delivery->origin_id); $typeobject = $expedition->origin; @@ -537,6 +538,23 @@ else print '<tr><td>'.$langs->trans("DateReceived").'</td>'; print '<td colspan="3">'.dol_print_date($delivery->date_delivery,'daytext')."</td>\n"; print '</tr>'; + + // Note Public + print '<tr><td>'.$langs->trans("NotePublic").'</td>'; + print '<td colspan="3">'; + print nl2br($delivery->note_public); + /*$doleditor = new DolEditor('note_public', $object->note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); + print $doleditor->Create(1);*/ + print "</td></tr>"; + + // Note Private + print '<tr><td>'.$langs->trans("NotePrivate").'</td>'; + print '<td colspan="3">'; + print nl2br($delivery->note_private); + /*$doleditor = new DolEditor('note_pprivate', $object->note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); + print $doleditor->Create(1);*/ + print "</td></tr>"; + // Statut print '<tr><td>'.$langs->trans("Status").'</td>'; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 97291206ad4..da5927128ae 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -7,6 +7,7 @@ * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2008 Patrick Raguin <patrick.raguin@auguria.net> * Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es> + * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -118,7 +119,9 @@ class Societe extends CommonObject var $code_compta; var $code_compta_fournisseur; - var $note; + var $note; //TODO deprecated + var $note_private; + var $note_public; //! code statut prospect var $stcomm_id; var $statut_commercial; @@ -698,7 +701,7 @@ class Societe extends CommonObject $sql .= ', s.status'; $sql .= ', s.price_level'; $sql .= ', s.tms as date_update'; - $sql .= ', s.phone, s.fax, s.email, s.url, s.zip, s.town, s.note, s.client, s.fournisseur'; + $sql .= ', s.phone, s.fax, s.email, s.url, s.zip, s.town, s.note_private, s.note_public, s.client, s.fournisseur'; $sql .= ', s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4, s.idprof5, s.idprof6'; $sql .= ', s.capital, s.tva_intra'; $sql .= ', s.fk_typent as typent_id'; @@ -832,7 +835,9 @@ class Societe extends CommonObject $this->client = $obj->client; $this->fournisseur = $obj->fournisseur; - $this->note = $obj->note; + $this->note = $obj->note_private; //TODO Deprecatedfor backward comtability + $this->note_private = $obj->note_private; + $this->note_public = $obj->note_public; $this->default_lang = $obj->default_lang; $this->logo = $obj->logo; @@ -2444,7 +2449,7 @@ class Societe extends CommonObject $this->zip=empty($conf->global->MAIN_INFO_SOCIETE_ZIP)?'':$conf->global->MAIN_INFO_SOCIETE_ZIP; $this->town=empty($conf->global->MAIN_INFO_SOCIETE_TOWN)?'':$conf->global->MAIN_INFO_SOCIETE_TOWN; $this->state_id=empty($conf->global->MAIN_INFO_SOCIETE_DEPARTEMENT)?'':$conf->global->MAIN_INFO_SOCIETE_DEPARTEMENT; - $this->note=empty($conf->global->MAIN_INFO_SOCIETE_NOTE)?'':$conf->global->MAIN_INFO_SOCIETE_NOTE; + $this->note_private=empty($conf->global->MAIN_INFO_SOCIETE_NOTE)?'':$conf->global->MAIN_INFO_SOCIETE_NOTE; $this->nom=$this->name; // deprecated @@ -2541,7 +2546,7 @@ class Societe extends CommonObject $this->tva_assuj=1; $this->tva_intra='EU1234567'; $this->note_public='This is a comment (public)'; - $this->note='This is a comment (private)'; + $this->note_private='This is a comment (private)'; $this->idprof1='idprof1'; $this->idprof2='idprof2'; diff --git a/htdocs/societe/note.php b/htdocs/societe/note.php index 01a43230f7f..0d09f21da25 100644 --- a/htdocs/societe/note.php +++ b/htdocs/societe/note.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es> + * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,6 +25,10 @@ * \ingroup societe */ +error_reporting(E_ALL); +ini_set('display_errors', true); +ini_set('html_errors', false); + require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; @@ -32,39 +37,45 @@ $action = GETPOST('action'); $langs->load("companies"); // Security check -$socid = GETPOST('socid','int'); -if ($user->societe_id) $socid=$user->societe_id; -$result = restrictedArea($user, 'societe', $socid, '&societe'); +$id = GETPOST('id','int'); +if ($user->societe_id) $id=$user->societe_id; +$result = restrictedArea($user, 'societe', $id, '&societe'); $object = new Societe($db); -if ($socid > 0) $object->fetch($socid); +if ($id > 0) $object->fetch($id); /* * Actions */ -if ($action == 'add' && ! GETPOST('cancel')) +/******************************************************************************/ +/* Actions */ +/******************************************************************************/ + +if ($action == 'setnote_public' && $user->rights->propale->creer) { - $result=$object->update_note($_POST["note"]); - if ($result < 0) - { - $errors[]=$object->errors; - } + $object->fetch($id); + $result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES)); + 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)); + if ($result < 0) setEventMessage($object->error,'errors'); +} /* * View */ -if ($conf->global->MAIN_DIRECTEDITMODE && $user->rights->societe->creer) $action='edit'; - $form = new Form($db); $help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; llxHeader('',$langs->trans("ThirdParty").' - '.$langs->trans("Notes"),$help_url); -if ($socid > 0) +if ($id > 0) { /* * Affichage onglets @@ -73,7 +84,6 @@ if ($socid > 0) $head = societe_prepare_head($object); - dol_fiche_head($head, 'note', $langs->trans("ThirdParty"),0,'company'); @@ -110,61 +120,17 @@ if ($socid > 0) print '</td></tr>'; } - print '<tr><td valign="top">'.$langs->trans("Note").'</td>'; - print '<td valign="top">'; - if ($action == 'edit' && $user->rights->societe->creer) - { - print '<input type="hidden" name="action" value="add" />'; - print '<input type="hidden" name="socid" value="'.$object->id.'" />'; - - // Editeur wysiwyg - require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor('note',$object->note,'',360,'dolibarr_notes','In',true,false,$conf->global->FCKEDITOR_ENABLE_SOCIETE,20,70); - $doleditor->Create(); - } - else - { - print dol_textishtml($object->note)?$object->note:dol_nl2br($object->note,1,true); - } - print "</td></tr>"; - print "</table>"; - - if ($action == 'edit') - { - print '<center><br>'; - print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">'; - print ' '; - print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">'; - print '</center>'; - } - - print '</form>'; + + print '<br>'; + + include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; + dol_fiche_end(); } -dol_htmloutput_errors('',$errors); - - -/* - * Buttons - */ - -if ($action != 'edit') -{ - print '<div class="tabsAction">'; - - if ($user->rights->societe->creer) - { - print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?socid='.$object->id.'&action=edit">'.$langs->trans("Modify").'</a>'; - } - - print '</div>'; -} - llxFooter(); - $db->close(); -?> +?> \ No newline at end of file diff --git a/htdocs/webservices/demo_wsclient_order.php-NORUN b/htdocs/webservices/demo_wsclient_order.php-NORUN index 5617c5cdd5d..dedb4cdf1e0 100755 --- a/htdocs/webservices/demo_wsclient_order.php-NORUN +++ b/htdocs/webservices/demo_wsclient_order.php-NORUN @@ -136,6 +136,6 @@ echo '</pre>'; echo '<h4>SOAP Message</h4>'; echo '<pre>' . htmlspecialchars($soapclient2->response, ENT_QUOTES) . '</pre>'; -echo '</body>'."\n";; -echo '</html>'."\n";; +echo '</body>'."\n"; +echo '</html>'."\n"; ?> diff --git a/htdocs/webservices/server_invoice.php b/htdocs/webservices/server_invoice.php index 014eba8fcb4..3e5d6305102 100755 --- a/htdocs/webservices/server_invoice.php +++ b/htdocs/webservices/server_invoice.php @@ -161,7 +161,7 @@ $server->wsdl->addComplexType( 'total_net' => array('name'=>'type','type'=>'xsd:double'), 'total_vat' => array('name'=>'type','type'=>'xsd:double'), 'total' => array('name'=>'type','type'=>'xsd:double'), - 'note' => array('name'=>'note','type'=>'xsd:string'), + 'note_private' => array('name'=>'note_private','type'=>'xsd:string'), 'note_public' => array('name'=>'note_public','type'=>'xsd:string'), 'status' => array('name'=>'status','type'=>'xsd:int'), 'close_code' => array('name'=>'close_code','type'=>'xsd:string'), @@ -324,7 +324,7 @@ function getInvoice($authentication,$id='',$ref='',$ref_ext='') 'total_net' => $invoice->total_ht, 'total_vat' => $invoice->total_tva, 'total' => $invoice->total_ttc, - 'note' => $invoice->note?$invoice->note:'', + 'note_private' => $invoice->note_private?$invoice->note_private:'', 'note_public' => $invoice->note_public?$invoice->note_public:'', 'status'=> $invoice->statut, 'close_code' => $invoice->close_code?$invoice->close_code:'', @@ -454,7 +454,7 @@ function getInvoicesForThirdParty($authentication,$idthirdparty) 'total_net' => $invoice->total_ht, 'total_vat' => $invoice->total_tva, 'total' => $invoice->total_ttc, - 'note' => $invoice->note?$invoice->note:'', + 'note_private' => $invoice->note_private?$invoice->note_private:'', 'note_public' => $invoice->note_public?$invoice->note_public:'', 'status'=> $invoice->statut, 'close_code' => $invoice->close_code?$invoice->close_code:'', @@ -517,7 +517,7 @@ function createInvoice($authentication,$invoice) $newobject->type=$invoice['type']; $newobject->ref_ext=$invoice['ref_ext']; $newobject->date=dol_stringtotime($invoice['date'],'dayrfc'); - $newobject->note=$invoice['note']; + $newobject->note_private=$invoice['note_private']; $newobject->note_public=$invoice['note_public']; $newobject->statut=$invoice['status']; $newobject->fk_project=$invoice['project_id']; diff --git a/htdocs/webservices/server_order.php b/htdocs/webservices/server_order.php index ee311e17bc1..25839b5d76d 100644 --- a/htdocs/webservices/server_order.php +++ b/htdocs/webservices/server_order.php @@ -179,7 +179,7 @@ $server->wsdl->addComplexType( 'remise_percent' => array('name'=>'remise_percent','type'=>'xsd:string'), 'remise_absolue' => array('name'=>'remise_absolue','type'=>'xsd:string'), 'source' => array('name'=>'source','type'=>'xsd:string'), - 'note' => array('name'=>'note','type'=>'xsd:string'), + 'note_private' => array('name'=>'note_private','type'=>'xsd:string'), 'note_public' => array('name'=>'note_public','type'=>'xsd:string'), 'project_id' => array('name'=>'project_id','type'=>'xsd:string'), @@ -399,7 +399,7 @@ function getOrder($authentication,$id='',$ref='',$ref_ext='') 'source' => $order->source, 'facturee' => $order->facturee, - 'note' => $order->note, + 'note_private' => $order->note_private, 'note_public' => $order->note_public, 'cond_reglement_id' => $order->cond_reglement_id, 'cond_reglement_code' => $order->cond_reglement_code, @@ -556,7 +556,7 @@ function getOrdersForThirdParty($authentication,$idthirdparty) 'source' => $order->source, 'facturee' => $order->facturee, - 'note' => $order->note, + 'note_private' => $order->note_private, 'note_public' => $order->note_public, 'cond_reglement_id' => $order->cond_reglement_id, 'cond_reglement' => $order->cond_reglement, @@ -633,7 +633,7 @@ function createOrder($authentication,$order) $newobject->ref_ext=$order['ref_ext']; $newobject->date=dol_stringtotime($order['date'],'dayrfc'); $newobject->date_lim_reglement=dol_stringtotime($order['date_due'],'dayrfc'); - $newobject->note=$order['note']; + $newobject->note_private=$order['note_private']; $newobject->note_public=$order['note_public']; $newobject->statut=$order['status']; $newobject->facturee=$order['facturee']; diff --git a/htdocs/webservices/server_supplier_invoice.php b/htdocs/webservices/server_supplier_invoice.php index 42e5dda7636..0655b0cd729 100755 --- a/htdocs/webservices/server_supplier_invoice.php +++ b/htdocs/webservices/server_supplier_invoice.php @@ -144,7 +144,7 @@ $server->wsdl->addComplexType( 'total_net' => array('name'=>'type','type'=>'xsd:double'), 'total_vat' => array('name'=>'type','type'=>'xsd:double'), 'total' => array('name'=>'type','type'=>'xsd:double'), - 'note' => array('name'=>'note','type'=>'xsd:string'), + 'note_private' => array('name'=>'note_private','type'=>'xsd:string'), 'note_public' => array('name'=>'note_public','type'=>'xsd:string'), 'status' => array('name'=>'status','type'=>'xsd:int'), 'close_code' => array('name'=>'close_code','type'=>'xsd:string'), @@ -293,7 +293,7 @@ function getSupplierInvoice($authentication,$id='',$ref='',$ref_ext='') 'date_term'=>dol_print_date($invoice->date_echeance,'dayhourrfc'), 'label'=>$invoice->libelle, 'paid'=>$invoice->paye, - 'note'=>$invoice->note, + 'note_private'=>$invoice->note_private, 'note_public'=>$invoice->note_public, 'close_code'=>$invoice->close_code, 'close_note'=>$invoice->close_note, @@ -425,7 +425,7 @@ function getSupplierInvoicesForThirdParty($authentication,$idthirdparty) 'date_term'=>dol_print_date($invoice->date_echeance,'dayhourrfc'), 'label'=>$invoice->libelle, 'paid'=>$invoice->paye, - 'note'=>$invoice->note, + 'note_private'=>$invoice->note_private, 'note_public'=>$invoice->note_public, 'close_code'=>$invoice->close_code, 'close_note'=>$invoice->close_note, diff --git a/htdocs/webservices/server_thirdparty.php b/htdocs/webservices/server_thirdparty.php index 525d6df3bf3..448da44ece2 100755 --- a/htdocs/webservices/server_thirdparty.php +++ b/htdocs/webservices/server_thirdparty.php @@ -98,7 +98,8 @@ $thirdparty_fields= array( 'supplier_code_accountancy' => array('name'=>'supplier_code_accountancy','type'=>'xsd:string'), 'date_creation' => array('name'=>'date_creation','type'=>'xsd:dateTime'), 'date_modification' => array('name'=>'date_modification','type'=>'xsd:dateTime'), - 'note' => array('name'=>'note','type'=>'xsd:string'), + 'note_private' => array('name'=>'note_private','type'=>'xsd:string'), + 'note_public' => array('name'=>'note_public','type'=>'xsd:string'), 'address' => array('name'=>'address','type'=>'xsd:string'), 'zip' => array('name'=>'zip','type'=>'xsd:string'), 'town' => array('name'=>'town','type'=>'xsd:string'), @@ -323,7 +324,9 @@ function getThirdParty($authentication,$id='',$ref='',$ref_ext='') 'capital' => $thirdparty->capital, 'barcode' => $thirdparty->barcode, 'vat_used' => $thirdparty->tva_assuj, - 'vat_number' => $thirdparty->tva_intra); + 'vat_number' => $thirdparty->tva_intra, + 'note_private' => $thirdparty->note_private, + 'note_public' => $thirdparty->note_public); //Retreive all extrafield for thirdsparty // fetch optionals attributes and labels @@ -410,7 +413,8 @@ function createThirdParty($authentication,$thirdparty) $newobject->code_compta=$thirdparty['customer_code_accountancy']; $newobject->code_compta_fournisseur=$thirdparty['supplier_code_accountancy']; $newobject->date_creation=$now; - $newobject->note=$thirdparty['note']; + $newobject->note_private=$thirdparty['note_private']; + $newobject->note_public=$thirdparty['note_public']; $newobject->address=$thirdparty['address']; $newobject->zip=$thirdparty['zip']; $newobject->town=$thirdparty['town']; @@ -530,7 +534,8 @@ function updateThirdParty($authentication,$thirdparty) $object->code_compta=$thirdparty['customer_code_accountancy']; $object->code_compta_fournisseur=$thirdparty['supplier_code_accountancy']; $object->date_creation=$now; - $object->note=$thirdparty['note']; + $object->note_private=$thirdparty['note_private']; + $object->note_public=$thirdparty['note_public']; $object->address=$thirdparty['address']; $object->zip=$thirdparty['zip']; $object->town=$thirdparty['town']; diff --git a/test/phpunit/ContactTest.php b/test/phpunit/ContactTest.php index 83dd603ba3e..bac26a28485 100755 --- a/test/phpunit/ContactTest.php +++ b/test/phpunit/ContactTest.php @@ -189,8 +189,8 @@ class ContactTest extends PHPUnit_Framework_TestCase $localobject->oldcopy=dol_clone($localobject); - $localobject->note='New note after update'; - //$localobject->note_public='New note public after update'; + $localobject->note_private='New private note after update'; + $localobject->note_public='New public note after update'; $localobject->lastname='New name'; $localobject->firstname='New firstname'; $localobject->address='New address'; @@ -205,15 +205,18 @@ class ContactTest extends PHPUnit_Framework_TestCase $localobject->email='newemail@newemail.com'; $localobject->jabberid='New im id'; $localobject->default_lang='es_ES'; + $result=$localobject->update($localobject->id,$user); print __METHOD__." id=".$localobject->id." result=".$result."\n"; $this->assertLessThan($result, 0, 'Contact::update error'); - $result=$localobject->update_note($localobject->note); + + $result=$localobject->update_note_private($localobject->note_private); print __METHOD__." id=".$localobject->id." result=".$result."\n"; - $this->assertLessThan($result, 0, 'Contact::update_note error'); - //$result=$localobject->update_note_public($localobject->note_public); - //print __METHOD__." id=".$localobject->id." result=".$result."\n"; - //$this->assertLessThan($result, 0); + $this->assertLessThan($result, 0, 'Contact::update_note_private error'); + + $result=$localobject->update_note_public($localobject->note_public); + print __METHOD__." id=".$localobject->id." result=".$result."\n"; + $this->assertLessThan($result, 0, 'Contact::update_note_public error'); $newobject=new Contact($this->savdb); $result=$newobject->fetch($localobject->id); diff --git a/test/phpunit/HolidayTest.php b/test/phpunit/HolidayTest.php index eabfdf4bcfc..f0bb254ce25 100644 --- a/test/phpunit/HolidayTest.php +++ b/test/phpunit/HolidayTest.php @@ -183,8 +183,8 @@ class HolidayTest extends PHPUnit_Framework_TestCase $localobject->oldcopy=dol_clone($localobject); - $localobject->note='New note after update'; - //$localobject->note_public='New note public after update'; + $localobject->note_private='New private note after update'; + $localobject->note_public='New public note after update'; $localobject->lastname='New name'; $localobject->firstname='New firstname'; $localobject->address='New address'; @@ -199,15 +199,19 @@ class HolidayTest extends PHPUnit_Framework_TestCase $localobject->email='newemail@newemail.com'; $localobject->jabberid='New im id'; $localobject->default_lang='es_ES'; + $result=$localobject->update($localobject->id,$user); print __METHOD__." id=".$localobject->id." result=".$result."\n"; $this->assertLessThan($result, 0, 'Holiday::update error'); - $result=$localobject->update_note($localobject->note); + + $result=$localobject->update_note_private($localobject->note_private); print __METHOD__." id=".$localobject->id." result=".$result."\n"; - $this->assertLessThan($result, 0, 'Holiday::update_note error'); - //$result=$localobject->update_note_public($localobject->note_public); - //print __METHOD__." id=".$localobject->id." result=".$result."\n"; - //$this->assertLessThan($result, 0); + $this->assertLessThan($result, 0, 'Holiday::update_note_private error'); + + $result=$localobject->update_note_public($localobject->note_public); + print __METHOD__." id=".$localobject->id." result=".$result."\n"; + $this->assertLessThan($result, 0, 'Holiday::update_note_public error'); + $newobject=new Holiday($this->savdb); $result=$newobject->fetch($localobject->id); diff --git a/test/phpunit/SocieteTest.php b/test/phpunit/SocieteTest.php index c7b3434218d..619bf98dbe7 100755 --- a/test/phpunit/SocieteTest.php +++ b/test/phpunit/SocieteTest.php @@ -189,8 +189,8 @@ class SocieteTest extends PHPUnit_Framework_TestCase $langs=$this->savlangs; $db=$this->savdb; - $localobject->note='New note after update'; - //$localobject->note_public='New note public after update'; + $localobject->note_private='New private note after update'; + $localobject->note_public='New public note after update'; $localobject->name='New name'; $localobject->address='New address'; $localobject->zip='New zip'; @@ -205,15 +205,18 @@ class SocieteTest extends PHPUnit_Framework_TestCase $localobject->idprof2='new idprof2'; $localobject->idprof3='new idprof3'; $localobject->idprof4='new idprof4'; + $result=$localobject->update($localobject->id,$user); print __METHOD__." id=".$localobject->id." result=".$result."\n"; $this->assertLessThan($result, 0); - $result=$localobject->update_note($localobject->note); + + $result=$localobject->update_note_private($localobject->note_private); print __METHOD__." id=".$localobject->id." result=".$result."\n"; - $this->assertLessThan($result, 0); - //$result=$localobject->update_note_public($localobject->note_public); - //print __METHOD__." id=".$localobject->id." result=".$result."\n"; - //$this->assertLessThan($result, 0); + $this->assertLessThan($result, 0, 'Holiday::update_note_private error'); + + $result=$localobject->update_note_public($localobject->note_public); + print __METHOD__." id=".$localobject->id." result=".$result."\n"; + $this->assertLessThan($result, 0, 'Holiday::update_note_public error'); $newobject=new Societe($this->savdb); $result=$newobject->fetch($localobject->id); -- GitLab