Skip to content

Commit

Permalink
Module member: move field note in note_private
Browse files Browse the repository at this point in the history
  • Loading branch information
aspangaro committed Apr 3, 2015
1 parent 4588b2b commit d897139
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 22 deletions.
18 changes: 9 additions & 9 deletions htdocs/adherents/class/adherent.class.php
Expand Up @@ -5,7 +5,7 @@
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2014-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -310,7 +310,7 @@ function create($user,$notrigger=0)
$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;
Expand Down Expand Up @@ -445,9 +445,9 @@ function update($user,$notrigger=0,$nosyncuser=0,$nosyncuserpass=0,$nosyncthirdp
$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;
Expand Down Expand Up @@ -1053,7 +1053,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,";
$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,";
Expand Down Expand Up @@ -1134,7 +1134,7 @@ function fetch($rowid,$ref='',$fk_soc='',$ref_ext='')
$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;
Expand Down Expand Up @@ -1801,7 +1801,7 @@ function initAsSpecimen()
$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;
Expand Down Expand Up @@ -1874,7 +1874,7 @@ function _load_ldap_info()
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');
Expand Down
14 changes: 7 additions & 7 deletions htdocs/adherents/note.php
Expand Up @@ -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';
Expand Down Expand Up @@ -54,7 +54,7 @@
{
$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');
Expand Down Expand Up @@ -82,7 +82,7 @@

dol_fiche_head($head, 'note', $langs->trans("Member"), 0, 'user');

print "<form method=\"post\" action=\"note.php\">";
print "<form method=\"post\" action=\"".$_SERVER['PHP_SELF']."\">";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';

print '<table class="border" width="100%">';
Expand Down Expand Up @@ -129,28 +129,28 @@
// Status
print '<tr><td>'.$langs->trans("Status").'</td><td class="valeur">'.$object->getLibStatut(4).'</td></tr>';

// Note
// 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',$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 "</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;';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</td></tr>';
}
Expand Down
3 changes: 3 additions & 0 deletions htdocs/install/mysql/migration/3.7.0-3.8.0.sql
Expand Up @@ -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;

2 changes: 1 addition & 1 deletion htdocs/install/mysql/tables/llx_adherent.sql
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions htdocs/public/members/new.php
Expand Up @@ -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
Expand All @@ -40,7 +40,7 @@

// 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);

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -335,7 +335,7 @@ function llxFooterVierge()
}
}

// 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')
Expand Down

0 comments on commit d897139

Please sign in to comment.