From 19b55cb4c14251885e49124aec9ebe5fca9487c6 Mon Sep 17 00:00:00 2001 From: frederic34 Date: Mon, 6 Apr 2015 18:58:36 +0200 Subject: [PATCH] Add public note to members --- htdocs/adherents/class/adherent.class.php | 9 ++- htdocs/adherents/note.php | 65 +++---------------- htdocs/admin/ldap_members.php | 11 +++- .../install/mysql/migration/3.7.0-3.8.0.sql | 1 + htdocs/install/mysql/tables/llx_adherent.sql | 1 + htdocs/langs/en_US/admin.lang | 2 + 6 files changed, 32 insertions(+), 57 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 7a4510119dc..58593935a5f 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -7,6 +7,7 @@ * Copyright (C) 2009-2012 Regis Houssin * Copyright (C) 2014-2015 Alexandre Spangaro * Copyright (C) 2015 Marcos GarcĂ­a + * Copyright (C) 2015 Frederic France * * 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 @@ -78,6 +79,7 @@ class Adherent extends CommonObject var $morphy; var $public; var $note_private; // Private note + var $note_public; // Public note var $statut; // -1:brouillon, 0:resilie, >=1:valide,paye var $photo; @@ -448,6 +450,7 @@ class Adherent extends CommonObject $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_private=" .($this->note_private?"'".$this->db->escape($this->note_private)."'":"null"); + $sql.= ", note_public=" .($this->note_private?"'".$this->db->escape($this->note_public)."'":"null"); $sql.= ", photo=" .($this->photo?"'".$this->photo."'":"null"); $sql.= ", public='".$this->public."'"; $sql.= ", statut=" .$this->statut; @@ -1054,6 +1057,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_private,"; + $sql.= " d.note_public,"; $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,"; @@ -1135,6 +1139,7 @@ class Adherent extends CommonObject $this->birth = $this->db->jdate($obj->birthday); $this->note_private = $obj->note_private; + $this->note_public = $obj->note_public; $this->morphy = $obj->morphy; $this->typeid = $obj->fk_adherent_type; @@ -1561,7 +1566,8 @@ class Adherent extends CommonObject $result=''; $label = '' . $langs->trans("ShowMember") . ''; - $label.= '
' . $langs->trans('Ref') . ': ' . $this->ref; + if (! empty($this->ref)) + $label.= '
' . $langs->trans('Ref') . ': ' . $this->ref; if (! empty($this->firstname) || ! empty($this->lastname)) $label.= '
' . $langs->trans('Name') . ': ' . $this->getFullName($langs); $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; @@ -1875,6 +1881,7 @@ class Adherent extends CommonObject 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_private && ! empty($conf->global->LDAP_MEMBER_FIELD_DESCRIPTION)) $info[$conf->global->LDAP_MEMBER_FIELD_DESCRIPTION] = $this->note_private; + if ($this->note_public && ! empty($conf->global->LDAP_MEMBER_FIELD_NOTE_PUBLIC)) $info[$conf->global->LDAP_MEMBER_FIELD_NOTE_PUBLIC] = $this->note_public; 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 3a938e74034..79b7db086e6 100644 --- a/htdocs/adherents/note.php +++ b/htdocs/adherents/note.php @@ -1,6 +1,7 @@ - * Copyright (C) 2004-2014 Laurent Destailleur +/* Copyright (C) 2004 Rodolphe Quiedeville + * Copyright (C) 2004-2014 Laurent Destailleur + * Copyright (C) 2015 Frederic France * * 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 @@ -45,26 +46,13 @@ if ($result > 0) $result=$adht->fetch($object->typeid); } +$permissionnote=$user->rights->adherent->creer; // Used by the include of actions_setnotes.inc.php /* * Actions */ -if ($action == 'update' && $user->rights->adherent->creer && ! $_POST["cancel"]) -{ - $db->begin(); - - $res=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES), '_private'); - if ($res < 0) - { - setEventMessage($object->error, 'errors'); - $db->rollback(); - } - else - { - $db->commit(); - } -} +include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once @@ -129,49 +117,16 @@ if ($id) // Status print ''.$langs->trans("Status").''.$object->getLibStatut(4).''; - // Private note - print ''.$langs->trans("Note").''; - print ''; - if ($action == 'edit' && $user->rights->adherent->creer) - { - print ""; - print "id."\">"; - require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor('note_private',$object->note_private,'',280,'dolibarr_notes','',true,false,$conf->global->FCKEDITOR_ENABLE_SOCIETE,10,80); - $doleditor->Create(); - } - else - { - print dol_htmlentitiesbr($object->note_private); - } - print ""; - - if ($action == 'edit') - { - print ''; - print ''; - print '     '; - print ''; - print ''; - } - print ""; - print "\n"; + print '
'; - /* - * Actions - */ - print ''; - print '
'; + $colwidth='20'; + $permission = $user->rights->adherent->creer; // Used by the include of notes.tpl.php + include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; - if ($user->rights->adherent->creer && $action != 'edit') - { - print '"; - } - - print "
"; + dol_fiche_end(); } diff --git a/htdocs/admin/ldap_members.php b/htdocs/admin/ldap_members.php index bddf16f8670..8bac5068143 100644 --- a/htdocs/admin/ldap_members.php +++ b/htdocs/admin/ldap_members.php @@ -65,13 +65,14 @@ if ($action == 'setvalue' && $user->admin) if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_PHONE',GETPOST("fieldphone"),'chaine',0,'',$conf->entity)) $error++; if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_PHONE_PERSO',GETPOST("fieldphoneperso"),'chaine',0,'',$conf->entity)) $error++; if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_MOBILE',GETPOST("fieldmobile"),'chaine',0,'',$conf->entity)) $error++; - if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_SKYPE',GETPOST("fieldskype"),'chaine',0,'',$conf->entity)) $error++; + if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_SKYPE',GETPOST("fieldskype"),'chaine',0,'',$conf->entity)) $error++; if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_FAX',GETPOST("fieldfax"),'chaine',0,'',$conf->entity)) $error++; if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_ADDRESS',GETPOST("fieldaddress"),'chaine',0,'',$conf->entity)) $error++; if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_ZIP',GETPOST("fieldzip"),'chaine',0,'',$conf->entity)) $error++; if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_TOWN',GETPOST("fieldtown"),'chaine',0,'',$conf->entity)) $error++; if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_COUNTRY',GETPOST("fieldcountry"),'chaine',0,'',$conf->entity)) $error++; if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_DESCRIPTION',GETPOST("fielddescription"),'chaine',0,'',$conf->entity)) $error++; + if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_NOTE_PUBLIC',GETPOST("fieldnotepublic"),'chaine',0,'',$conf->entity)) $error++; if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_BIRTHDATE',GETPOST("fieldbirthdate"),'chaine',0,'',$conf->entity)) $error++; if (! dolibarr_set_const($db, 'LDAP_FIELD_MEMBER_STATUS',GETPOST("fieldstatus"),'chaine',0,'',$conf->entity)) $error++; if (! dolibarr_set_const($db, 'LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION', GETPOST("fieldendlastsubscription"),'chaine',0,'',$conf->entity)) $error++; @@ -312,6 +313,14 @@ print ''.$langs->trans("LDAPFieldDescriptionExample").''; print ' '; print ''; +// Public Note +$var=!$var; +print ''.$langs->trans("LDAPFieldNotePublic").''; +print ''; +print ''.$langs->trans("LDAPFieldNotePublicExample").''; +print ' '; +print ''; + // Birthday $var=!$var; print ''.$langs->trans("LDAPFieldBirthdate").''; 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 85757f85f15..d8f47651153 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 @@ -515,4 +515,5 @@ create table llx_c_price_global_variable_updater )ENGINE=innodb; ALTER TABLE llx_adherent CHANGE COLUMN note note_private text DEFAULT NULL; +ALTER TABLE llx_adherent ADD COLUMN note_public text DEFAULT NULL after note_private; diff --git a/htdocs/install/mysql/tables/llx_adherent.sql b/htdocs/install/mysql/tables/llx_adherent.sql index e6ffee2dc5b..493d5b1124d 100644 --- a/htdocs/install/mysql/tables/llx_adherent.sql +++ b/htdocs/install/mysql/tables/llx_adherent.sql @@ -55,6 +55,7 @@ create table llx_adherent 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_private text DEFAULT NULL, + note_public text DEFAULT NULL, datevalid datetime, -- date de validation datec datetime, -- date de creation tms timestamp, -- date de modification diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 984b9717dab..753ebc4073c 100755 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1338,6 +1338,8 @@ LDAPFieldCountry=Country LDAPFieldCountryExample=Example : c LDAPFieldDescription=Description LDAPFieldDescriptionExample=Example : description +LDAPFieldNotePublic=Public Note +LDAPFieldNotePublicExample=Example : publicnote LDAPFieldGroupMembers= Group members LDAPFieldGroupMembersExample= Example : uniqueMember LDAPFieldBirthdate=Birthdate