From d897139f255f397f861f5e04060a7bd13e4223a1 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Fri, 3 Apr 2015 06:54:08 +0200 Subject: [PATCH] Module member: move field note in note_private --- htdocs/adherents/class/adherent.class.php | 18 +++++++++--------- htdocs/adherents/note.php | 14 +++++++------- htdocs/install/mysql/migration/3.7.0-3.8.0.sql | 3 +++ htdocs/install/mysql/tables/llx_adherent.sql | 2 +- htdocs/public/members/new.php | 10 +++++----- 5 files changed, 25 insertions(+), 22 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index c8c4f9b9ad4..7a4510119dc 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -5,7 +5,7 @@ * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2009-2012 Regis Houssin - * Copyright (C) 2014 Alexandre Spangaro + * Copyright (C) 2014-2015 Alexandre Spangaro * Copyright (C) 2015 Marcos GarcĂ­a * * This program is free software; you can redistribute it and/or modify @@ -77,7 +77,7 @@ class Adherent extends CommonObject var $morphy; var $public; - var $note; // Private note + var $note_private; // Private note var $statut; // -1:brouillon, 0:resilie, >=1:valide,paye var $photo; @@ -310,7 +310,7 @@ class Adherent extends CommonObject $sql.= " VALUES ("; $sql.= " '".$this->db->idate($this->datec)."'"; $sql.= ", ".($this->login?"'".$this->db->escape($this->login)."'":"null"); - $sql.= ", ".($user->id>0?$user->id:"null"); // Can be null because member can be createb by a guest or a script + $sql.= ", ".($user->id>0?$user->id:"null"); // Can be null because member can be created by a guest or a script $sql.= ", null, null, '".$this->morphy."'"; $sql.= ", '".$this->typeid."'"; $sql.= ", ".$conf->entity; @@ -445,9 +445,9 @@ class Adherent extends CommonObject $sql.= ", email='".$this->email."'"; $sql.= ", skype='".$this->skype."'"; $sql.= ", phone=" .($this->phone?"'".$this->db->escape($this->phone)."'":"null"); - $sql.= ", phone_perso=" .($this->phone_perso?"'".$this->db->escape($this->phone_perso)."'":"null"); + $sql.= ", phone_perso=" .($this->phone_perso?"'".$this->db->escape($this->phone_perso)."'":"null"); $sql.= ", phone_mobile=" .($this->phone_mobile?"'".$this->db->escape($this->phone_mobile)."'":"null"); - $sql.= ", note=" .($this->note?"'".$this->db->escape($this->note)."'":"null"); + $sql.= ", note_private=" .($this->note_private?"'".$this->db->escape($this->note_private)."'":"null"); $sql.= ", photo=" .($this->photo?"'".$this->photo."'":"null"); $sql.= ", public='".$this->public."'"; $sql.= ", statut=" .$this->statut; @@ -1053,7 +1053,7 @@ class Adherent extends CommonObject { global $langs; - $sql = "SELECT d.rowid, d.ref_ext, d.civility as civility_id, d.firstname, d.lastname, d.societe as company, d.fk_soc, d.statut, d.public, d.address, d.zip, d.town, d.note,"; + $sql = "SELECT d.rowid, d.ref_ext, d.civility as civility_id, d.firstname, d.lastname, d.societe as company, d.fk_soc, d.statut, d.public, d.address, d.zip, d.town, d.note_private,"; $sql.= " d.email, d.skype, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass,"; $sql.= " d.photo, d.fk_adherent_type, d.morphy, d.entity,"; $sql.= " d.datec as datec,"; @@ -1134,7 +1134,7 @@ class Adherent extends CommonObject $this->datevalid = $this->db->jdate($obj->datev); $this->birth = $this->db->jdate($obj->birthday); - $this->note = $obj->note; + $this->note_private = $obj->note_private; $this->morphy = $obj->morphy; $this->typeid = $obj->fk_adherent_type; @@ -1801,7 +1801,7 @@ class Adherent extends CommonObject $this->phone = '0999999999'; $this->phone_perso = '0999999998'; $this->phone_mobile = '0999999997'; - $this->note='No comment'; + $this->note_private='No comment'; $this->birth=time(); $this->photo=''; $this->public=1; @@ -1874,7 +1874,7 @@ class Adherent extends CommonObject if ($this->phone_perso && ! empty($conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO] = $this->phone_perso; if ($this->phone_mobile && ! empty($conf->global->LDAP_MEMBER_FIELD_MOBILE)) $info[$conf->global->LDAP_MEMBER_FIELD_MOBILE] = $this->phone_mobile; if ($this->fax && ! empty($conf->global->LDAP_MEMBER_FIELD_FAX)) $info[$conf->global->LDAP_MEMBER_FIELD_FAX] = $this->fax; - if ($this->note && ! empty($conf->global->LDAP_MEMBER_FIELD_DESCRIPTION)) $info[$conf->global->LDAP_MEMBER_FIELD_DESCRIPTION] = $this->note; + if ($this->note_private && ! empty($conf->global->LDAP_MEMBER_FIELD_DESCRIPTION)) $info[$conf->global->LDAP_MEMBER_FIELD_DESCRIPTION] = $this->note_private; if ($this->birth && ! empty($conf->global->LDAP_MEMBER_FIELD_BIRTHDATE)) $info[$conf->global->LDAP_MEMBER_FIELD_BIRTHDATE] = dol_print_date($this->birth,'dayhourldap'); if (isset($this->statut) && ! empty($conf->global->LDAP_FIELD_MEMBER_STATUS)) $info[$conf->global->LDAP_FIELD_MEMBER_STATUS] = $this->statut; if ($this->datefin && ! empty($conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION)) $info[$conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION] = dol_print_date($this->datefin,'dayhourldap'); diff --git a/htdocs/adherents/note.php b/htdocs/adherents/note.php index 727b3a9bcdc..f0b202677c1 100644 --- a/htdocs/adherents/note.php +++ b/htdocs/adherents/note.php @@ -19,7 +19,7 @@ /** * \file htdocs/adherents/note.php * \ingroup member - * \brief Tabe for note of a member + * \brief Tab for note of a member */ require '../main.inc.php'; @@ -54,7 +54,7 @@ if ($action == 'update' && $user->rights->adherent->creer && ! $_POST["cancel"]) { $db->begin(); - $res=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES)); + $res=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES)); if ($res < 0) { setEventMessage($object->error, 'errors'); @@ -82,7 +82,7 @@ if ($id) dol_fiche_head($head, 'note', $langs->trans("Member"), 0, 'user'); - print "
"; + print ""; print ''; print ''; @@ -129,7 +129,7 @@ if ($id) // Status print ''; - // Note + // Private note print ''; print '"; @@ -150,7 +150,7 @@ if ($id) { print ''; } diff --git a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql index b1b4eccbf56..1379d7bc6c4 100644 --- a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql +++ b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql @@ -512,3 +512,6 @@ create table llx_c_price_global_variable_updater next_update integer DEFAULT 0, last_status text DEFAULT NULL )ENGINE=innodb; + +ALTER TABLE llx_adherent CHANGE COLUMN note note_private text DEFAULT NULL; + diff --git a/htdocs/install/mysql/tables/llx_adherent.sql b/htdocs/install/mysql/tables/llx_adherent.sql index e7f9c246834..e6ffee2dc5b 100644 --- a/htdocs/install/mysql/tables/llx_adherent.sql +++ b/htdocs/install/mysql/tables/llx_adherent.sql @@ -54,7 +54,7 @@ create table llx_adherent statut smallint NOT NULL DEFAULT 0, public smallint NOT NULL DEFAULT 0, -- certain champ de la fiche sont ils public ou pas ? datefin datetime, -- date de fin de validite de la cotisation - note text, + note_private text DEFAULT NULL, datevalid datetime, -- date de validation datec datetime, -- date de creation tms timestamp, -- date de modification diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index a6ac9ee1906..8fb06cd783e 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -25,9 +25,9 @@ * \brief Example of form to add a new member * * Note that you can add following constant to change behaviour of page - * MEMBER_NEWFORM_AMOUNT Default amount for autosubscribe form + * MEMBER_NEWFORM_AMOUNT Default amount for auto-subscribe form * MEMBER_NEWFORM_EDITAMOUNT Amount can be edited - * MEMBER_NEWFORM_PAYONLINE Suggest paypemt with paypal of paybox + * MEMBER_NEWFORM_PAYONLINE Suggest payment with paypal of paybox * MEMBER_NEWFORM_DOLIBARRTURNOVER Show field turnover (specific for dolibarr foundation) * MEMBER_URL_REDIRECT_SUBSCRIPTION Url to redirect once subscribe submitted * MEMBER_NEWFORM_FORCETYPE Force type of member @@ -40,7 +40,7 @@ define("NOCSRFCHECK",1); // We accept to go on this page from external web site. // For MultiCompany module. // Do not use GETPOST here, function is not defined and define must be done before including main.inc.php -// TODO This should be useless. Because entity must be retreive from object ref and not from url. +// TODO This should be useless. Because entity must be retrieve from object ref and not from url. $entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); if (is_numeric($entity)) define("DOLENTITY", $entity); @@ -138,7 +138,7 @@ function llxFooterVierge() * Actions */ -// Action called when page is submited +// Action called when page is submitted if ($action == 'add') { // test if login already exists @@ -335,7 +335,7 @@ if ($action == 'add') } } -// Action called after a submited was send and member created succesfully +// Action called after a submitted was send and member created successfully // If MEMBER_URL_REDIRECT_SUBSCRIPTION is set to url we never go here because a redirect was done to this url. // backtopage parameter with an url was set on member submit page, we never go here because a redirect was done to this url. if ($action == 'added')
'.$langs->trans("Status").''.$object->getLibStatut(4).'
'.$langs->trans("Note").''; if ($action == 'edit' && $user->rights->adherent->creer) @@ -137,12 +137,12 @@ if ($id) print ""; print "id."\">"; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor('note',$object->note,'',280,'dolibarr_notes','',true,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,10,80); + $doleditor=new DolEditor('note_private',$object->note_private,'',280,'dolibarr_notes','',true,false,$conf->global->FCKEDITOR_ENABLE_SOCIETE,10,80); $doleditor->Create(); } else { - print nl2br($object->note); + print dol_htmlentitiesbr($object->note_private); } print "
'; print ''; - print '   '; + print '     '; print ''; print '