Skip to content

Commit

Permalink
Add public note to members
Browse files Browse the repository at this point in the history
  • Loading branch information
frederic34 committed Apr 6, 2015
1 parent 3d161de commit 19b55cb
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 57 deletions.
9 changes: 8 additions & 1 deletion htdocs/adherents/class/adherent.class.php
Expand Up @@ -7,6 +7,7 @@
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
*
* 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
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -448,6 +450,7 @@ function update($user,$notrigger=0,$nosyncuser=0,$nosyncuserpass=0,$nosyncthirdp
$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;
Expand Down Expand Up @@ -1054,6 +1057,7 @@ function fetch($rowid,$ref='',$fk_soc='',$ref_ext='')
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,";
Expand Down Expand Up @@ -1135,6 +1139,7 @@ function fetch($rowid,$ref='',$fk_soc='',$ref_ext='')
$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;
Expand Down Expand Up @@ -1561,7 +1566,8 @@ function getNomUrl($withpicto=0,$maxlen=0,$option='card')

$result='';
$label = '<u>' . $langs->trans("ShowMember") . '</u>';
$label.= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
if (! empty($this->ref))
$label.= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
if (! empty($this->firstname) || ! empty($this->lastname))
$label.= '<br><b>' . $langs->trans('Name') . ':</b> ' . $this->getFullName($langs);
$linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
Expand Down Expand Up @@ -1875,6 +1881,7 @@ function _load_ldap_info()
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');
Expand Down
65 changes: 10 additions & 55 deletions htdocs/adherents/note.php
@@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
*
* 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
Expand Down Expand Up @@ -45,26 +46,13 @@
$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



Expand Down Expand Up @@ -129,49 +117,16 @@
// Status
print '<tr><td>'.$langs->trans("Status").'</td><td class="valeur">'.$object->getLibStatut(4).'</td></tr>';

// Private note
print '<tr><td valign="top">'.$langs->trans("Note").'</td>';
print '<td valign="top" colspan="3">';
if ($action == 'edit' && $user->rights->adherent->creer)
{
print "<input type=\"hidden\" name=\"action\" value=\"update\">";
print "<input type=\"hidden\" name=\"id\" value=\"".$object->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 "</td></tr>";

if ($action == 'edit')
{
print '<tr><td colspan="4" align="center">';
print '<input type="submit" class="button" name="update" value="'.$langs->trans("Save").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</td></tr>';
}

print "</table>";
print "</form>\n";
print '<br>';


/*
* Actions
*/
print '</div>';
print '<div class="tabsAction">';

if ($user->rights->adherent->creer && $action != 'edit')
{
print '<div class="inline-block divButAction"><a class="butAction" href="note.php?id='.$object->id.'&amp;action=edit">'.$langs->trans('Modify')."</a></div>";
}
$colwidth='20';
$permission = $user->rights->adherent->creer; // Used by the include of notes.tpl.php
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';

print "</div>";

dol_fiche_end();

}

Expand Down
11 changes: 10 additions & 1 deletion htdocs/admin/ldap_members.php
Expand Up @@ -65,13 +65,14 @@
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++;
Expand Down Expand Up @@ -312,6 +313,14 @@
print '<td align="right">&nbsp;</td>';
print '</tr>';

// Public Note
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldNotePublic").'</td><td>';
print '<input size="25" type="text" name="fieldnotepublic" value="'.$conf->global->LDAP_MEMBER_FIELD_NOTE_PUBLIC.'">';
print '</td><td>'.$langs->trans("LDAPFieldNotePublicExample").'</td>';
print '<td align="right">&nbsp;</td>';
print '</tr>';

// Birthday
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldBirthdate").'</td><td>';
Expand Down
1 change: 1 addition & 0 deletions htdocs/install/mysql/migration/3.7.0-3.8.0.sql
Expand Up @@ -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;

1 change: 1 addition & 0 deletions htdocs/install/mysql/tables/llx_adherent.sql
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions htdocs/langs/en_US/admin.lang
Expand Up @@ -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
Expand Down

0 comments on commit 19b55cb

Please sign in to comment.