Feature: Ajout onlget note sur fiche utilisateur

This commit is contained in:
Laurent Destailleur 2007-09-08 09:44:26 +00:00
parent 9b6bd49d8f
commit f6d364b415
8 changed files with 241 additions and 27 deletions

View File

@ -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$
*/

View File

@ -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");
}

View File

@ -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 <b>%s</b> ?
DeleteLine=Delete line
ConfirmDeleteLine=Are you sure you want to delete this line ?
ConfirmDeleteLine=Are you sure you want to delete this line ?

View File

@ -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 <b>%s</b> ?
DeleteLine=Suppression de ligne
ConfirmDeleteLine=Êtes-vous sûr de vouloir effacer cette ligne ?
ConfirmDeleteLine=Êtes-vous sûr de vouloir effacer cette ligne ?

View File

@ -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;
}
?>
?>

View File

@ -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

167
htdocs/user/note.php Normal file
View File

@ -0,0 +1,167 @@
<?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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='<div class="error">'.$adh->error.'</div>';
$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 '<div class="error">'.$msg.'</div>';
print "<form method=\"post\" action=\"note.php\">";
print '<table class="border" width="100%">';
// Reference
print '<tr><td width="20%">'.$langs->trans('Ref').'</td>';
print '<td colspan="3">';
print $html->showrefnav($fuser,'id');
print '</td>';
print '</tr>';
// Nom
print '<tr><td>'.$langs->trans("Lastname").'</td><td class="valeur" colspan="3">'.$fuser->nom.'&nbsp;</td>';
print '</tr>';
// Prenom
print '<tr><td>'.$langs->trans("Firstname").'</td><td class="valeur" colspan="3">'.$fuser->prenom.'&nbsp;</td></tr>';
// Login
print '<tr><td>'.$langs->trans("Login").'</td><td class="valeur" colspan="3">'.$fuser->login.'&nbsp;</td></tr>';
// Note
print '<tr><td valign="top">'.$langs->trans("Note").'</td>';
print '<td valign="top" colspan="3">';
if ($action == 'edit' && $user->rights->user->user->creer)
{
print "<input type=\"hidden\" name=\"action\" value=\"update\">";
print "<input type=\"hidden\" name=\"id\" value=\"".$fuser->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 '<textarea name="note" cols="80" rows="10">'.$fuser->note.'</textarea>';
}
}
else
{
print nl2br($fuser->note);
}
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 '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</td></tr>';
}
print "</table>";
print "</form>\n";
/*
* Actions
*/
print '</div>';
print '<div class="tabsAction">';
if ($user->rights->user->user->creer && $action != 'edit')
{
print "<a class=\"butAction\" href=\"note.php?id=$fuser->id&amp;action=edit\">".$langs->trans('Edit')."</a>";
}
print "</div>";
}
$db->close();
llxFooter('$Date$ - $Revision$');
?>

View File

@ -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
--