diff --git a/htdocs/adherents/note.php b/htdocs/adherents/note.php index fc5ea79a4b8..e269646e0eb 100644 --- a/htdocs/adherents/note.php +++ b/htdocs/adherents/note.php @@ -21,9 +21,9 @@ */ /** - \file htdocs/compta/facture/note.php - \ingroup facture - \brief Fiche de notes sur une facture + \file htdocs/adherents/note.php + \ingroup member + \brief Fiche de notes sur un adherent \version $Revision$ */ diff --git a/htdocs/admin/fckeditor.php b/htdocs/admin/fckeditor.php index 5ad6ea5b207..0561460e0c9 100644 --- a/htdocs/admin/fckeditor.php +++ b/htdocs/admin/fckeditor.php @@ -37,30 +37,33 @@ if (!$user->admin) // Constante et traduction de la description du module $modules = array( -'SOCIETE' => 'FCKeditorForCompany', +'USER' => 'FCKeditorForUsers', +'SOCIETE' => 'FCKeditorForCompany', // TODO Regrouper les 4 parm sur edit notes en 1 seul 'PRODUCTDESC' => 'FCKeditorForProduct', -'DETAILS' => 'FCKeditorForProductDetails', -'DETAILS_PERSO' => 'FCKeditorForProductDetailsPerso', +'MEMBER' => 'FCKeditorForMembers', 'MAILING' => 'FCKeditorForMailing', -'MEMBER' => 'FCKeditorForMembers' +'DETAILS' => 'FCKeditorForProductDetails', +'DETAILS_PERSO' => 'FCKeditorForProductDetailsPerso' ); // Conditions pour que l'option soit proposée $conditions = array( +'USER' => 1, 'SOCIETE' => $conf->societe->enabled, 'PRODUCTDESC' => ($conf->produit->enabled||$conf->service->enabled), -'DETAILS' => ($conf->facture->enabled||$conf->propal->enabled||$conf->commande->enabled), -'DETAILS_PERSO' => ($conf->facture->enabled||$conf->propal->enabled||$conf->commande->enabled), +'MEMBER' => $conf->adherent->enabled, 'MAILING' => $conf->mailing->enabled, -'MEMBER' => $conf->adherent->enabled +'DETAILS' => ($conf->facture->enabled||$conf->propal->enabled||$conf->commande->enabled), +'DETAILS_PERSO' => ($conf->facture->enabled||$conf->propal->enabled||$conf->commande->enabled) ); // Picto $picto = array( +'USER' => 'user', 'SOCIETE' => 'company', 'PRODUCTDESC' => 'product', -'DETAILS' => 'generic', -'DETAILS_PERSO' => 'generic', +'MEMBER' => 'user', 'MAILING' => 'email', -'MEMBER' => 'user' +'DETAILS' => 'generic', +'DETAILS_PERSO' => 'generic' ); @@ -70,7 +73,7 @@ foreach($modules as $const => $desc) { dolibarr_set_const($db, "FCKEDITOR_ENABLE_".$const, "1"); // Si fckeditor est activé dans la description produit/service, on l'active dans les formulaires - if ($const == 'PRODUCTDESC') + if ($const == 'PRODUCTDESC' && $conf->global->PRODUIT_DESC_IN_FORM) { dolibarr_set_const($db, "FCKEDITOR_ENABLE_DETAILS", "1"); } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index d7b20ad6605..604dd33d1a4 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -728,11 +728,12 @@ DeliveryOrderModel=Products deliveries receipt model DeliveriesOrderAbility=Products deliveries receipt ability ##### FCKeditor ##### ActivateFCKeditor=Activate FCKeditor for: -FCKeditorForCompany=WYSIWIG creation/edition of companies description and note -FCKeditorForProduct=WYSIWIG creation/edition of products/services description and note -FCKeditorForMembers=WYSIWIG creation/edition of members description and note -FCKeditorForProductDetails=WYSIWIG creation/edition of details lines for all entities (proposals, orders, invoices, etc...) -FCKeditorForProductDetailsPerso=WYSIWIG creation/edition of description for all personalized products (proposals, orders, invoices, etc...) +FCKeditorForMembers=WYSIWIG creation/edition of users' description and note +FCKeditorForCompany=WYSIWIG creation/edition of companies' description and note +FCKeditorForProduct=WYSIWIG creation/edition of products/services' description and note +FCKeditorForMembers=WYSIWIG creation/edition of members' description and note +FCKeditorForProductDetails=WYSIWIG creation/edition of products details lines for all entities (proposals, orders, invoices, etc...) +FCKeditorForProductDetailsPerso=WYSIWIG creation/edition of products personalized details lines for all entities (proposals, orders, invoices, etc...) FCKeditorForMailing=WYSIWIG creation/edition of mailings ##### OSCommerce 1 ##### OSCommerceErrorConnectOkButWrongDatabase=Connection succeeded but database doesn't look to be an OSCommerce database. @@ -777,4 +778,4 @@ ModifMenu=Menu change DeleteMenu=Delete menu entry ConfirmDeleteMenu=Are you sure you want to delete menu entry %s ? DeleteLine=Delete line -ConfirmDeleteLine=Are you sure you want to delete this line ? \ No newline at end of file +ConfirmDeleteLine=Are you sure you want to delete this line ? diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index d70fc3d3260..a9c81419b71 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -730,11 +730,12 @@ DeliveryOrderModel=Mod DeliveriesOrderAbility=Prise en charge des bons de réception client ##### FCKeditor ##### ActivateFCKeditor=Activer FCKeditor pour : -FCKeditorForCompany=Création/édition WYSIWIG des descriptions et notes des tiers -FCKeditorForProduct=Création/édition WYSIWIG des descriptions et notes des produits/services -FCKeditorForMembers=Création/édition WYSIWIG des descriptions et notes des adhérents -FCKeditorForProductDetails=Création/édition WYSIWIG des lignes details des produits (sur commandes, propales, factures, etc...) -FCKeditorForProductDetailsPerso=Création/édition WYSIWIG des descriptions des produits personnalisées (sur commandes, propales, factures, etc...) +FCKeditorForUsers=Création/édition WYSIWIG de la description et note des utilisateurs +FCKeditorForCompany=Création/édition WYSIWIG de la description et note des tiers +FCKeditorForProduct=Création/édition WYSIWIG de la description et note des produits/services +FCKeditorForMembers=Création/édition WYSIWIG de la description et note des adhérents +FCKeditorForProductDetails=Création/édition WYSIWIG des lignes details produits (sur commandes, propales, factures, etc...) +FCKeditorForProductDetailsPerso=Création/édition WYSIWIG des lignes details produits personnalisées (sur commandes, propales, factures, etc...) FCKeditorForMailing=Création/édition WYSIWIG des mailings ##### OSCommerce 1 ##### OSCommerceErrorConnectOkButWrongDatabase=La connexion a réussie mais la base ne semble pas etre une base OSCommerce. @@ -783,4 +784,4 @@ ModifMenu=Modification du menu DeleteMenu=Effacer entrée de menu ConfirmDeleteMenu=Etes-vous sur de vouloir supprimer l'entrée de menu %s ? DeleteLine=Suppression de ligne -ConfirmDeleteLine=Êtes-vous sûr de vouloir effacer cette ligne ? \ No newline at end of file +ConfirmDeleteLine=Êtes-vous sûr de vouloir effacer cette ligne ? diff --git a/htdocs/lib/usergroups.lib.php b/htdocs/lib/usergroups.lib.php index 076a8284c15..b9ec9e1657d 100644 --- a/htdocs/lib/usergroups.lib.php +++ b/htdocs/lib/usergroups.lib.php @@ -76,6 +76,11 @@ function user_prepare_head($user) $h++; } + $head[$h][0] = DOL_URL_ROOT.'/user/note.php?id='.$user->id; + $head[$h][1] = $langs->trans("Note"); + $head[$h][2] = 'note'; + $h++; + $head[$h][0] = DOL_URL_ROOT.'/user/info.php?id='.$user->id; $head[$h][1] = $langs->trans("Info"); $head[$h][2] = 'info'; @@ -114,4 +119,4 @@ function group_prepare_head($group) return $head; } -?> \ No newline at end of file +?> diff --git a/htdocs/user.class.php b/htdocs/user.class.php index dffac1af90f..f42ab518407 100644 --- a/htdocs/user.class.php +++ b/htdocs/user.class.php @@ -1014,6 +1014,34 @@ class User } + /** + \brief Fonction qui met à jour le commentaire d'un utilisateur + \param note Note + \param user Utilisateur qui réalise la mise a jour + \return int <0 si KO, >0 si OK + */ + function update_note($note,$user) + { + $this->db->begin(); + + $sql = "UPDATE ".MAIN_DB_PREFIX."user SET"; + $sql.= " note='".addslashes($note)."'"; + $sql.= " WHERE rowid = ".$this->id; + + dolibarr_syslog("User::update_note sql=$sql"); + $result = $this->db->query($sql); + if (! $result) + { + $this->error=$this->db->error(); + $this->db->rollback(); + return -1; + } + + $this->note = $note; + + $this->db->commit(); + return 1; + } /** * \brief Mise à jour en base de la date de deniere connexion d'un utilisateur diff --git a/htdocs/user/note.php b/htdocs/user/note.php new file mode 100644 index 00000000000..f9e99258f87 --- /dev/null +++ b/htdocs/user/note.php @@ -0,0 +1,167 @@ + + * Copyright (C) 2004-2007 Laurent Destailleur + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + */ + +/** + \file htdocs/user/note.php + \ingroup usergroup + \brief Fiche de notes sur un utilisateur Dolibarr + \version $Revision$ +*/ + +require("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT.'/lib/usergroups.lib.php'); +require_once(DOL_DOCUMENT_ROOT.'/user.class.php'); + +$action=isset($_GET["action"])?$_GET["action"]:(isset($_POST["action"])?$_POST["action"]:""); +$id=isset($_GET["id"])?$_GET["id"]:(isset($_POST["id"])?$_POST["id"]:""); + +$user->getrights('user'); + +$langs->load("companies"); +$langs->load("members"); +$langs->load("bills"); + +if (!$user->rights->user->user->lire) + accessforbidden(); + +$fuser = new User($db); +$fuser->id = $id; +$fuser->fetch(); + + +/******************************************************************************/ +/* Actions */ +/******************************************************************************/ + +if ($_POST["action"] == 'update' && $user->rights->user->user->creer && ! $_POST["cancel"]) +{ + $db->begin(); + + $res=$fuser->update_note($_POST["note"],$user); + if ($res < 0) + { + $mesg='
'.$adh->error.'
'; + $db->rollback(); + } + else + { + $db->commit(); + } +} + + + +/******************************************************************************/ +/* Affichage fiche */ +/******************************************************************************/ + +llxHeader(); + +$html = new Form($db); + +if ($id) +{ + $head = user_prepare_head($fuser); + + dolibarr_fiche_head($head, 'note', $langs->trans("User")); + + if ($msg) print '
'.$msg.'
'; + + print "
"; + + print ''; + + // Reference + print ''; + print ''; + print ''; + + // Nom + print ''; + print ''; + + // Prenom + print ''; + + // Login + print ''; + + // Note + print ''; + print '"; + + if ($action == 'edit') + { + print ''; + } + + print "
'.$langs->trans('Ref').''; + print $html->showrefnav($fuser,'id'); + print '
'.$langs->trans("Lastname").''.$fuser->nom.' 
'.$langs->trans("Firstname").''.$fuser->prenom.' 
'.$langs->trans("Login").''.$fuser->login.' 
'.$langs->trans("Note").''; + if ($action == 'edit' && $user->rights->user->user->creer) + { + print ""; + print "id."\">"; + if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_USER) + { + // Editeur wysiwyg + require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php"); + $doleditor=new DolEditor('note',$fuser->note,280,'dolibarr_notes','In',true); + $doleditor->Create(); + } + else + { + print ''; + } + } + else + { + print nl2br($fuser->note); + } + print "
'; + print ''; + print '   '; + print ''; + print '
"; + print "
\n"; + + + /* + * Actions + */ + print ''; + print '
'; + + if ($user->rights->user->user->creer && $action != 'edit') + { + print "id&action=edit\">".$langs->trans('Edit').""; + } + + print "
"; + + +} + +$db->close(); + +llxFooter('$Date$ - $Revision$'); +?> diff --git a/mysql/data/data.sql b/mysql/data/data.sql index 721ac0320e6..9899ce60753 100644 --- a/mysql/data/data.sql +++ b/mysql/data/data.sql @@ -156,6 +156,15 @@ insert into llx_const (name, value, type, note, visible) values ('ADHERENT_CARD_ insert into llx_const (name, value, type, note, visible) values ('ADHERENT_CARD_FOOTER_TEXT','Association AZERTY','chaine','Texte imprime sur le bas de la carte adherent',0); insert into llx_const (name, value, type, note, visible) values ('ADHERENT_CARD_TEXT','%TYPE% n° %ID%\r\n%PRENOM% %NOM%\r\n<%EMAIL%>\r\n%ADRESSE%\r\n%CP% %VILLE%\r\n%PAYS%','texte','Texte imprime sur la carte adherent',0); +-- +-- FCKEditor +-- +insert into llx_const (name, value, type, note, visible) values ('FCKEDITOR_ENABLE_USER', 1,'yesno','Activation fckeditor sur notes utilisateurs',0); +insert into llx_const (name, value, type, note, visible) values ('FCKEDITOR_ENABLE_SOCIETE', 1,'yesno','Activation fckeditor sur notes societe',0); +insert into llx_const (name, value, type, note, visible) values ('FCKEDITOR_ENABLE_PRODUCTDESC',1,'yesno','Activation fckeditor sur notes produits',0); +insert into llx_const (name, value, type, note, visible) values ('FCKEDITOR_ENABLE_MEMBER', 1,'yesno','Activation fckeditor sur notes adherent',0); +insert into llx_const (name, value, type, note, visible) values ('FCKEDITOR_ENABLE_MAILING', 1,'yesno','Activation fckeditor sur emailing',0); + -- -- OsCommerce 1 --