Fix: String must be saved as they are in database. Html detect and convert must be done on screen only.

This commit is contained in:
Laurent Destailleur 2008-03-21 00:27:37 +00:00
parent bd4c6bf2e4
commit 7f0e794251
26 changed files with 117 additions and 146 deletions

View File

@ -71,7 +71,7 @@ class Adherent extends CommonObject
var $morphy; var $morphy;
var $public; var $public;
var $commentaire; // Note var $note; // Note
var $statut; // -1:brouillon, 0:resilie, >=1:valide,paye var $statut; // -1:brouillon, 0:resilie, >=1:valide,paye
var $photo; var $photo;
@ -125,7 +125,7 @@ class Adherent extends CommonObject
\param addr_cc email cc \param addr_cc email cc
\param addr_bcc email bcc \param addr_bcc email bcc
\param deliveryreceipt demande accuse reception \param deliveryreceipt demande accuse reception
\param msgishtml 1=message is a html message, 0=message is not html, 2=auto detect \param msgishtml 1=String IS already html, 0=String IS NOT html, -1=Unknown need autodetection
\return int <0 si ko, >0 si ok \return int <0 si ko, >0 si ok
\remarks La particularite de cette fonction est de remplacer certains champs \remarks La particularite de cette fonction est de remplacer certains champs
\remarks par leur valeur pour l'adherent en l'occurrence : \remarks par leur valeur pour l'adherent en l'occurrence :
@ -137,10 +137,34 @@ class Adherent extends CommonObject
*/ */
function send_an_email($text,$subject, function send_an_email($text,$subject,
$filename_list=array(),$mimetype_list=array(),$mimefilename_list=array(), $filename_list=array(),$mimetype_list=array(),$mimefilename_list=array(),
$addr_cc="",$addr_bcc="",$deliveryreceipt=0,$msgishtml=0, $errors_to='') $addr_cc="",$addr_bcc="",$deliveryreceipt=0,$msgishtml=-1, $errors_to='')
{ {
global $conf,$langs; global $conf,$langs;
// Detect if message is HTML
if ($msgishtml == -1)
{
$msgishtml = 0;
if (dol_textishtml($text,1)) $msgishtml = 1;
}
$infos='';
$infos.= $langs->trans("Lastname").": $this->nom\n";
$infos.= $langs->trans("Firstname").": $this->prenom\n";
$infos.= $langs->trans("Company").": $this->societe\n";
$infos.= $langs->trans("Address").": $this->adresse\n";
$infos.= $langs->trans("Zip").": $this->cp\n";
$infos.= $langs->trans("Town").": $this->ville\n";
$infos.= $langs->trans("Country").": $this->pays\n";
$infos.= $langs->trans("EMail").": $this->email\n";
$infos.= $langs->trans("Login").": $this->login\n";
$infos.= $langs->trans("Password").": $this->pass\n";
$infos.= $langs->trans("Birthday").": $this->naiss\n";
$infos.= $langs->trans("Photo").": $this->photo\n";
$infos.= $langs->trans("Public").": ".yn($this->public)."\n";
if ($msgishtml) $infos = dol_htmlentities($infos);
// Substitutions
$patterns = array ( $patterns = array (
'/%PRENOM%/', '/%PRENOM%/',
'/%NOM%/', '/%NOM%/',
@ -157,30 +181,6 @@ class Adherent extends CommonObject
'/%LOGIN%/', '/%LOGIN%/',
'/%PASSWORD%/' '/%PASSWORD%/'
); );
$infos.= $langs->trans("Lastname").": $this->nom\n";
$infos.= $langs->trans("Firstname").": $this->prenom\n";
$infos.= $langs->trans("Company").": $this->societe\n";
$infos.= $langs->trans("Address").": $this->adresse\n";
$infos.= $langs->trans("Zip").": $this->cp\n";
$infos.= $langs->trans("Town").": $this->ville\n";
$infos.= $langs->trans("Country").": $this->pays\n";
$infos.= $langs->trans("EMail").": $this->email\n";
$infos.= $langs->trans("Login").": $this->login\n";
$infos.= $langs->trans("Password").": $this->pass\n";
$infos.= $langs->trans("Birthday").": $this->naiss\n";
$infos.= $langs->trans("Photo").": $this->photo\n";
$infos.= $langs->trans("Public").": ".yn($this->public)."\n";
// Is it an HTML Content ?
$html = $msgishtml;
if ($msgishtml == 2)
{
if (eregi('<html',$text)) $html = 1;
elseif (eregi('<body',$text)) $html = 1;
elseif (eregi('<br',$text)) $html = 1;
}
if ($html) $infos = nl2br($infos);
$replace = array ( $replace = array (
$this->prenom, $this->prenom,
$this->nom, $this->nom,
@ -207,7 +207,7 @@ class Adherent extends CommonObject
include_once(DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php"); include_once(DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php");
$mailfile = new CMailFile($subjectosend,$this->email,$from,$texttosend, $mailfile = new CMailFile($subjectosend,$this->email,$from,$texttosend,
$filename_list,$mimetype_list,$mimefilename_list, $filename_list,$mimetype_list,$mimefilename_list,
$addr_cc, $addr_bcc, $deliveryreceipt, $html); $addr_cc, $addr_bcc, $deliveryreceipt, $msgishtml);
if ($mailfile->sendfile()) if ($mailfile->sendfile())
{ {
return 1; return 1;
@ -471,7 +471,7 @@ class Adherent extends CommonObject
$sql.= ", phone=" .($this->phone?"'".addslashes($this->phone)."'":"null"); $sql.= ", phone=" .($this->phone?"'".addslashes($this->phone)."'":"null");
$sql.= ", phone_perso=" .($this->phone_perso?"'".addslashes($this->phone_perso)."'":"null"); $sql.= ", phone_perso=" .($this->phone_perso?"'".addslashes($this->phone_perso)."'":"null");
$sql.= ", phone_mobile=" .($this->phone_mobile?"'".addslashes($this->phone_mobile)."'":"null"); $sql.= ", phone_mobile=" .($this->phone_mobile?"'".addslashes($this->phone_mobile)."'":"null");
$sql.= ", note=" .($this->commentaire?"'".addslashes($this->commentaire)."'":"null"); $sql.= ", note=" .($this->note?"'".addslashes($this->note)."'":"null");
$sql.= ", photo=" .($this->photo?"'".$this->photo."'":"null"); $sql.= ", photo=" .($this->photo?"'".$this->photo."'":"null");
$sql.= ", public=" ."'".$this->public."'"; $sql.= ", public=" ."'".$this->public."'";
$sql.= ", statut=" .$this->statut; $sql.= ", statut=" .$this->statut;
@ -559,7 +559,7 @@ class Adherent extends CommonObject
$luser->office_phone=$this->phone; $luser->office_phone=$this->phone;
$luser->user_mobile=$this->phone_mobile; $luser->user_mobile=$this->phone_mobile;
$luser->note=$this->commentaire; $luser->note=$this->note;
$luser->fk_member=$this->id; $luser->fk_member=$this->id;
@ -940,7 +940,7 @@ class Adherent extends CommonObject
$this->datevalid = $obj->datevalid; $this->datevalid = $obj->datevalid;
$this->naiss = $obj->datenaiss; $this->naiss = $obj->datenaiss;
$this->commentaire = $obj->note; $this->note = $obj->note;
$this->morphy = $obj->morphy; $this->morphy = $obj->morphy;
$this->typeid = $obj->fk_adherent_type; $this->typeid = $obj->fk_adherent_type;
@ -1865,7 +1865,7 @@ class Adherent extends CommonObject
$this->phone = '0999999999'; $this->phone = '0999999999';
$this->phone_perso = '0999999998'; $this->phone_perso = '0999999998';
$this->phone_mobile = '0999999997'; $this->phone_mobile = '0999999997';
$this->commentaire='No comment'; $this->note='No comment';
$this->naiss=time(); $this->naiss=time();
$this->photo=''; $this->photo='';
$this->public=1; $this->public=1;
@ -1933,7 +1933,7 @@ class Adherent extends CommonObject
if ($this->phone_perso && $conf->global->LDAP_FIELD_PHONE_PERSO) $info[$conf->global->LDAP_FIELD_PHONE_PERSO] = $this->phone_perso; if ($this->phone_perso && $conf->global->LDAP_FIELD_PHONE_PERSO) $info[$conf->global->LDAP_FIELD_PHONE_PERSO] = $this->phone_perso;
if ($this->phone_mobile && $conf->global->LDAP_FIELD_MOBILE) $info[$conf->global->LDAP_FIELD_MOBILE] = $this->phone_mobile; if ($this->phone_mobile && $conf->global->LDAP_FIELD_MOBILE) $info[$conf->global->LDAP_FIELD_MOBILE] = $this->phone_mobile;
if ($this->fax && $conf->global->LDAP_FIELD_FAX) $info[$conf->global->LDAP_FIELD_FAX] = $this->fax; if ($this->fax && $conf->global->LDAP_FIELD_FAX) $info[$conf->global->LDAP_FIELD_FAX] = $this->fax;
if ($this->commentaire && $conf->global->LDAP_FIELD_DESCRIPTION) $info[$conf->global->LDAP_FIELD_DESCRIPTION] = $this->commentaire; if ($this->note && $conf->global->LDAP_FIELD_DESCRIPTION) $info[$conf->global->LDAP_FIELD_DESCRIPTION] = $this->note;
if ($this->naiss && $conf->global->LDAP_FIELD_BIRTHDATE) $info[$conf->global->LDAP_FIELD_BIRTHDATE] = dolibarr_print_date($this->naiss,'dayhourldap'); if ($this->naiss && $conf->global->LDAP_FIELD_BIRTHDATE) $info[$conf->global->LDAP_FIELD_BIRTHDATE] = dolibarr_print_date($this->naiss,'dayhourldap');
if (isset($this->statut) && $conf->global->LDAP_FIELD_MEMBER_STATUS) $info[$conf->global->LDAP_FIELD_MEMBER_STATUS] = $this->statut; if (isset($this->statut) && $conf->global->LDAP_FIELD_MEMBER_STATUS) $info[$conf->global->LDAP_FIELD_MEMBER_STATUS] = $this->statut;
if ($this->datefin && $conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION) $info[$conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION] = dolibarr_print_date($this->datefin,'dayhourldap'); if ($this->datefin && $conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION) $info[$conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION] = dolibarr_print_date($this->datefin,'dayhourldap');

View File

@ -43,8 +43,8 @@ class AdherentType extends CommonObject
var $libelle; var $libelle;
var $statut; var $statut;
var $cotisation; /**< Soumis à la cotisation */ var $cotisation; /**< Soumis à la cotisation */
var $vote; /** droit de vote ? */ var $vote; /**< droit de vote ? */
var $commentaire; /**< commentaire */ var $note; /**< commentaire */
var $mail_valid; /**< mail envoye lors de la validation */ var $mail_valid; /**< mail envoye lors de la validation */
@ -114,7 +114,7 @@ class AdherentType extends CommonObject
$sql.= "statut=".$this->statut.","; $sql.= "statut=".$this->statut.",";
$sql.= "libelle = '".addslashes($this->libelle) ."',"; $sql.= "libelle = '".addslashes($this->libelle) ."',";
$sql.= "cotisation='".$this->cotisation."',"; $sql.= "cotisation='".$this->cotisation."',";
$sql.= "note='".addslashes($this->commentaire)."',"; $sql.= "note='".addslashes($this->note)."',";
$sql.= "vote='".$this->vote."',"; $sql.= "vote='".$this->vote."',";
$sql.= "mail_valid='".addslashes($this->mail_valid)."'"; $sql.= "mail_valid='".addslashes($this->mail_valid)."'";
@ -186,7 +186,7 @@ class AdherentType extends CommonObject
$this->statut = $obj->statut; $this->statut = $obj->statut;
$this->cotisation = $obj->cotisation; $this->cotisation = $obj->cotisation;
$this->mail_valid = $obj->mail_valid; $this->mail_valid = $obj->mail_valid;
$this->commentaire = $obj->note; $this->note = $obj->note;
$this->vote = $obj->vote; $this->vote = $obj->vote;
} }
return 1; return 1;

View File

@ -139,7 +139,7 @@ if ($user->rights->adherent->cotisation->creer && $_POST["action"] == 'cotisatio
// Envoi mail // Envoi mail
if ($_POST["sendmail"]) if ($_POST["sendmail"])
{ {
$result=$adh->send_an_email($conf->global->ADHERENT_MAIL_COTIS,$conf->global->ADHERENT_MAIL_COTIS_SUBJECT,array(),array(),array(),"","",0,2); $result=$adh->send_an_email($conf->global->ADHERENT_MAIL_COTIS,$conf->global->ADHERENT_MAIL_COTIS_SUBJECT,array(),array(),array(),"","",0,-1);
if ($result < 0) $errmsg=$adh->error; if ($result < 0) $errmsg=$adh->error;
} }

View File

@ -144,7 +144,7 @@ if ($_REQUEST["action"] == 'update' && ! $_POST["cancel"])
$adh->naiss = $datenaiss; $adh->naiss = $datenaiss;
$adh->typeid = $_POST["type"]; $adh->typeid = $_POST["type"];
$adh->commentaire = $_POST["comment"]; $adh->note = $_POST["comment"];
$adh->morphy = $_POST["morphy"]; $adh->morphy = $_POST["morphy"];
$adh->amount = $_POST["amount"]; $adh->amount = $_POST["amount"];
@ -257,7 +257,7 @@ if ($user->rights->adherent->creer && $_POST["action"] == 'add')
$adh->naiss = $datenaiss; $adh->naiss = $datenaiss;
$adh->photo = $photo; $adh->photo = $photo;
$adh->typeid = $type; $adh->typeid = $type;
$adh->commentaire = $comment; $adh->note = $comment;
$adh->morphy = $morphy; $adh->morphy = $morphy;
foreach($_POST as $key => $value){ foreach($_POST as $key => $value){
if (ereg("^options_",$key)){ if (ereg("^options_",$key)){
@ -448,7 +448,7 @@ if ($user->rights->adherent->supprimer && $_POST["action"] == 'confirm_resign' &
{ {
if ($adh->email && $_POST["send_mail"]) if ($adh->email && $_POST["send_mail"])
{ {
$result=$adh->send_an_email($conf->global->ADHERENT_MAIL_RESIL,$conf->global->ADHERENT_MAIL_RESIL_SUBJECT,array(),array(),array(),"","",0,2); $result=$adh->send_an_email($conf->global->ADHERENT_MAIL_RESIL,$conf->global->ADHERENT_MAIL_RESIL_SUBJECT,array(),array(),array(),"","",0,-1);
} }
if ($result < 0) if ($result < 0)
{ {

View File

@ -15,16 +15,13 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/ */
/** /**
\file htdocs/adherents/note.php \file htdocs/adherents/note.php
\ingroup member \ingroup member
\brief Fiche de notes sur un adherent \brief Fiche de notes sur un adherent
\version $Revision$ \version $Id$
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
@ -116,17 +113,17 @@ if ($id)
{ {
// Editeur wysiwyg // Editeur wysiwyg
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php"); require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
$doleditor=new DolEditor('note',$adh->commentaire,280,'dolibarr_notes','In',true); $doleditor=new DolEditor('note',$adh->note,280,'dolibarr_notes','In',true);
$doleditor->Create(); $doleditor->Create();
} }
else else
{ {
print '<textarea name="note" cols="80" rows="10">'.$adh->commentaire.'</textarea>'; print '<textarea name="note" cols="80" rows="10">'.$adh->note.'</textarea>';
} }
} }
else else
{ {
print nl2br($adh->commentaire); print nl2br($adh->note);
} }
print "</td></tr>"; print "</td></tr>";

View File

@ -45,7 +45,7 @@ if ($user->rights->adherent->configurer && $_POST["action"] == 'add')
$adht->libelle = trim($_POST["libelle"]); $adht->libelle = trim($_POST["libelle"]);
$adht->cotisation = trim($_POST["cotisation"]); $adht->cotisation = trim($_POST["cotisation"]);
$adht->commentaire = trim($_POST["comment"]); $adht->note = trim($_POST["comment"]);
$adht->mail_valid = trim($_POST["mail_valid"]); $adht->mail_valid = trim($_POST["mail_valid"]);
$adht->vote = trim($_POST["vote"]); $adht->vote = trim($_POST["vote"]);
@ -79,7 +79,7 @@ if ($user->rights->adherent->configurer && $_POST["action"] == 'update')
$adht->id = $_POST["rowid"]; $adht->id = $_POST["rowid"];
$adht->libelle = trim($_POST["libelle"]); $adht->libelle = trim($_POST["libelle"]);
$adht->cotisation = trim($_POST["cotisation"]); $adht->cotisation = trim($_POST["cotisation"]);
$adht->commentaire = trim($_POST["comment"]); $adht->note = trim($_POST["comment"]);
$adht->mail_valid = trim($_POST["mail_valid"]); $adht->mail_valid = trim($_POST["mail_valid"]);
$adht->vote = trim($_POST["vote"]); $adht->vote = trim($_POST["vote"]);
@ -101,7 +101,8 @@ if ($user->rights->adherent->configurer && $_GET["action"] == 'delete')
if ($user->rights->adherent->configurer && $_GET["action"] == 'commentaire') if ($user->rights->adherent->configurer && $_GET["action"] == 'commentaire')
{ {
$don = new Don($db); $don = new Don($db);
$don->set_commentaire($rowid,$_POST["commentaire"]); $don->fetch($rowid);
$don->update_note($_POST["commentaire"]);
} }
@ -278,7 +279,7 @@ if ($rowid > 0)
print '</tr>'; print '</tr>';
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>'; print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>';
print nl2br($adht->commentaire)."</td></tr>"; print nl2br($adht->note)."</td></tr>";
print '<tr><td valign="top">'.$langs->trans("WelcomeEMail").'</td><td>'; print '<tr><td valign="top">'.$langs->trans("WelcomeEMail").'</td><td>';
print nl2br($adht->mail_valid)."</td></tr>"; print nl2br($adht->mail_valid)."</td></tr>";
@ -348,7 +349,7 @@ if ($rowid > 0)
print '</td></tr>'; print '</td></tr>';
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>'; print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>';
print "<textarea name=\"comment\" wrap=\"soft\" cols=\"90\" rows=\"3\">".$adht->commentaire."</textarea></td></tr>"; print "<textarea name=\"comment\" wrap=\"soft\" cols=\"90\" rows=\"3\">".$adht->note."</textarea></td></tr>";
print '<tr><td valign="top">'.$langs->trans("WelcomeEMail").'</td><td>'; print '<tr><td valign="top">'.$langs->trans("WelcomeEMail").'</td><td>';
if ($conf->fckeditor->enabled) if ($conf->fckeditor->enabled)

View File

@ -85,8 +85,7 @@ if ($_POST["action"] == 'send' && ! $_POST["cancel"])
if ($sendto) if ($sendto)
{ {
// Le message est-il en html // Le message est-il en html
$msgishtml=0; // Non par defaut $msgishtml=-1; // Unknown by default
//if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_MAILING) $msgishtml=1;
if (eregi('[ \t]*<html>',$message)) $msgishtml=1; if (eregi('[ \t]*<html>',$message)) $msgishtml=1;
// Pratique les substitutions sur le sujet et message // Pratique les substitutions sur le sujet et message

View File

@ -379,7 +379,7 @@ if ($_GET["action"] == 'create')
} }
print '</td></tr>'; print '</td></tr>';
// Si la societe est imposee, on propose ces contacts // Si la societe est imposee, on propose ses contacts
if ($_REQUEST["socid"]) if ($_REQUEST["socid"])
{ {
$contactid = $_REQUEST["contactid"]?$_REQUEST["contactid"]:''; $contactid = $_REQUEST["contactid"]?$_REQUEST["contactid"]:'';
@ -440,7 +440,7 @@ if ($_GET["action"] == 'create')
} }
else else
{ {
print '<textarea name="note" cols="90" rows="'.ROWS_8.'">'.$societe->note.'</textarea>'; print '<textarea name="note" cols="90" rows="'.ROWS_8.'"></textarea>';
} }
print '</td></tr>'; print '</td></tr>';
@ -704,7 +704,7 @@ if ($_GET["id"])
print '<tr><td valign="top">'.$langs->trans("Note").'</td><td colspan="3">'; print '<tr><td valign="top">'.$langs->trans("Note").'</td><td colspan="3">';
if ($conf->fckeditor->enabled) if ($conf->fckeditor->enabled)
{ {
// Editeur wysiwyg // Editeur wysiwyg
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php"); require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
$doleditor=new DolEditor('note',$act->note,280,'dolibarr_notes','In',true); $doleditor=new DolEditor('note',$act->note,280,'dolibarr_notes','In',true);
$doleditor->Create(); $doleditor->Create();
@ -785,7 +785,7 @@ if ($_GET["id"])
print $act->getLibStatut(4); print $act->getLibStatut(4);
print '</td></tr>'; print '</td></tr>';
// Objet li<EFBFBD> // Objet lie
if ($act->objet_url) if ($act->objet_url)
{ {
print '<tr><td>'.$langs->trans("LinkedObject").'</td>'; print '<tr><td>'.$langs->trans("LinkedObject").'</td>';
@ -794,8 +794,7 @@ if ($_GET["id"])
// Note // Note
print '<tr><td valign="top">'.$langs->trans("Note").'</td><td colspan="3">'; print '<tr><td valign="top">'.$langs->trans("Note").'</td><td colspan="3">';
if ($conf->fckeditor->enabled) print nl2br($act->note); print dol_htmlentities($act->note);
else print nl2br(htmlentities($act->note));
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';

View File

@ -94,8 +94,7 @@ if ($_POST["action"] == 'sendallconfirmed')
$errorsto = $obj->email_errorsto; $errorsto = $obj->email_errorsto;
// Le message est-il en html // Le message est-il en html
$msgishtml=0; // Non par defaut $msgishtml=-1; // Unknown by default
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_MAILING) $msgishtml=1;
if (eregi('[ \t]*<html>',$message)) $msgishtml=1; if (eregi('[ \t]*<html>',$message)) $msgishtml=1;
$i++; $i++;
@ -250,15 +249,13 @@ if ($_POST["action"] == 'send' && ! $_POST["cancel"])
$arr_name = array(); $arr_name = array();
// Le message est-il en html // Le message est-il en html
$msgishtml=0; // Non par defaut $msgishtml=-1; // Inconnu par defaut
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_MAILING) $msgishtml=1;
if (eregi('[ \t]*<html>',$message)) $msgishtml=1; if (eregi('[ \t]*<html>',$message)) $msgishtml=1;
// Pratique les substitutions sur le sujet et message // Pratique les substitutions sur le sujet et message
$mil->sujet=make_substitutions($mil->sujet,$substitutionarrayfortest); $mil->sujet=make_substitutions($mil->sujet,$substitutionarrayfortest);
$mil->body=make_substitutions($mil->body,$substitutionarrayfortest); $mil->body=make_substitutions($mil->body,$substitutionarrayfortest);
require_once(DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php");
$mailfile = new CMailFile($mil->sujet,$mil->sendto,$mil->email_from,$mil->body, $mailfile = new CMailFile($mil->sujet,$mil->sendto,$mil->email_from,$mil->body,
$arr_file,$arr_mime,$arr_name, $arr_file,$arr_mime,$arr_name,
'', '', 0, $msgishtml); '', '', 0, $msgishtml);
@ -434,7 +431,7 @@ if ($_GET["action"] == 'create')
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_MAILING) if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_MAILING)
{ {
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php"); require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
$doleditor=new DolEditor('body',$objp->description,320,'dolibarr_mailings','',true,false); $doleditor=new DolEditor('body','',320,'dolibarr_mailings','',true,false);
$doleditor->Create(); $doleditor->Create();
} }
else else

View File

@ -772,7 +772,7 @@ class CommonObject
{ {
if (! $this->table_element) if (! $this->table_element)
{ {
dolibarr_syslog("CommonObject::update_note was called on objet with property table_element not defined",LOG_ERR); dolibarr_syslog("CommonObject::update_note was called on objet with property table_element not defined", LOG_ERR);
return -1; return -1;
} }
@ -780,7 +780,7 @@ class CommonObject
$sql.= " SET note = '".addslashes($note)."'"; $sql.= " SET note = '".addslashes($note)."'";
$sql.= " WHERE rowid =". $this->id; $sql.= " WHERE rowid =". $this->id;
dolibarr_syslog("CommonObject::update_note sql=".$sql); dolibarr_syslog("CommonObject::update_note sql=".$sql, LOG_DEBUG);
if ($this->db->query($sql)) if ($this->db->query($sql))
{ {
$this->note = $note; $this->note = $note;
@ -789,6 +789,7 @@ class CommonObject
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->error();
dolibarr_syslog("CommonObject::update_note error=".$this->error, LOG_ERR);
return -1; return -1;
} }
} }

View File

@ -225,7 +225,7 @@ if ($_GET["action"] == 'create')
else else
{ {
print '<textarea class="flat" name="account_comment" cols="70" rows="10">'; print '<textarea class="flat" name="account_comment" cols="70" rows="10">';
print $mil->body.'</textarea>'; print $account->comment.'</textarea>';
} }
print '</td></tr>'; print '</td></tr>';
@ -464,7 +464,7 @@ else
else else
{ {
print '<textarea class="flat" name="account_comment" cols="70" rows="10">'; print '<textarea class="flat" name="account_comment" cols="70" rows="10">';
print $mil->body.'</textarea>'; print $account->comment.'</textarea>';
} }
print '</td></tr>'; print '</td></tr>';

View File

@ -66,7 +66,7 @@ if ($_POST["action"] == 'update')
$don->pays = $_POST["pays"]; $don->pays = $_POST["pays"];
$don->public = $_POST["public"]; $don->public = $_POST["public"];
$don->projetid = $_POST["projetid"]; $don->projetid = $_POST["projetid"];
$don->commentaire = $_POST["comment"]; $don->note = $_POST["comment"];
$don->modepaiementid = $_POST["modepaiement"]; $don->modepaiementid = $_POST["modepaiement"];
if ($don->update($user) > 0) if ($don->update($user) > 0)
@ -101,7 +101,7 @@ if ($_POST["action"] == 'add')
$don->pays = $_POST["pays"]; $don->pays = $_POST["pays"];
$don->public = $_POST["public"]; $don->public = $_POST["public"];
$don->projetid = $_POST["projetid"]; $don->projetid = $_POST["projetid"];
$don->commentaire = $_POST["comment"]; $don->note = $_POST["comment"];
$don->modepaiementid = $_POST["modepaiement"]; $don->modepaiementid = $_POST["modepaiement"];
if ($don->create($user) > 0) if ($don->create($user) > 0)
@ -127,7 +127,8 @@ if ($_GET["action"] == 'delete')
if ($_POST["action"] == 'commentaire') if ($_POST["action"] == 'commentaire')
{ {
$don = new Don($db); $don = new Don($db);
$don->set_commentaire($_POST["rowid"],$_POST["commentaire"]); $don->fetch($_POST["rowid"]);
$don->update_note($_POST["commentaire"]);
$_GET["rowid"] = $_POST["rowid"]; $_GET["rowid"] = $_POST["rowid"];
} }
if ($_GET["action"] == 'valid_promesse') if ($_GET["action"] == 'valid_promesse')
@ -265,7 +266,7 @@ if ($_GET["rowid"] && $_GET["action"] == 'edit')
if ($conf->projet->enabled) $nbrows++; if ($conf->projet->enabled) $nbrows++;
print '<td rowspan="'.$nbrows.'" valign="top">'.$langs->trans("Comments").' :<br>'; print '<td rowspan="'.$nbrows.'" valign="top">'.$langs->trans("Comments").' :<br>';
print "<textarea name=\"comment\" wrap=\"soft\" cols=\"40\" rows=\"15\">$don->commentaire</textarea></td></tr>"; print "<textarea name=\"comment\" wrap=\"soft\" cols=\"40\" rows=\"15\">".$don->note."</textarea></td></tr>";
if ($conf->projet->enabled) if ($conf->projet->enabled)
{ {
@ -354,7 +355,7 @@ if ($_GET["rowid"] && $_GET["action"] != 'edit')
if ($conf->projet->enabled) $nbrows++; if ($conf->projet->enabled) $nbrows++;
print '<td rowspan="'.$nbrows.'" valign="top" width="50%">'.$langs->trans("Comments").' :<br>'; print '<td rowspan="'.$nbrows.'" valign="top" width="50%">'.$langs->trans("Comments").' :<br>';
print nl2br($don->commentaire).'</td></tr>'; print nl2br($don->note).'</td></tr>';
if ($conf->projet->enabled) if ($conf->projet->enabled)
{ {

View File

@ -1007,11 +1007,11 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'relance') && ! $_POST['c
} }
$actiontypecode='AC_FAC'; $actiontypecode='AC_FAC';
$actionmsg ='Mail envoyé par '.$from.' à '.$sendto.'.<br>'; $actionmsg ="Mail envoyé par ".$from." à ".$sendto.".\n";
if ($message) if ($message)
{ {
$actionmsg.='Texte utilisé dans le corps du message:<br>'; $actionmsg.="Texte utilisé dans le corps du message:\n";
$actionmsg.=$message; $actionmsg.=$message;
} }
@ -1021,9 +1021,9 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'relance') && ! $_POST['c
{ {
$subject = 'Relance facture '.$fac->ref; $subject = 'Relance facture '.$fac->ref;
$actiontypecode='AC_FAC'; $actiontypecode='AC_FAC';
$actionmsg='Mail envoyé par '.$from.' à '.$sendto.'.<br>'; $actionmsg="Mail envoyé par ".$from." à ".$sendto.".\n";
if ($message) { if ($message) {
$actionmsg.='Texte utilisé dans le corps du message:<br>'; $actionmsg.="Texte utilisé dans le corps du message:\n";
$actionmsg.=$message; $actionmsg.=$message;
} }
$actionmsg2='Relance facture par mail'; $actionmsg2='Relance facture par mail';

View File

@ -35,6 +35,11 @@
class Don class Don
{ {
var $db;
var $error;
var $element='don';
var $table_element='don';
var $id; var $id;
var $db; var $db;
var $date; var $date;
@ -51,7 +56,7 @@ class Don
var $projetid; var $projetid;
var $modepaiement; var $modepaiement;
var $modepaiementid; var $modepaiementid;
var $commentaire; var $note;
var $statut; var $statut;
var $projet; var $projet;
@ -176,7 +181,7 @@ class Don
$this->ville = 'Town'; $this->ville = 'Town';
$this->note_public='SPECIMEN'; $this->note_public='SPECIMEN';
$this->email='email@email.com'; $this->email='email@email.com';
$this->commentaire=''; $this->note='';
$this->statut=1; $this->statut=1;
} }
@ -297,7 +302,7 @@ class Don
{ {
$sql .= " $this->projetid,"; $sql .= " $this->projetid,";
} }
$sql .= " '$this->commentaire', ".$user->id.", '$this->date','$this->email')"; $sql .= " '$this->note', ".$user->id.", '$this->date','$this->email')";
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) if ($result)
@ -333,7 +338,7 @@ class Don
$sql .= ",pays='".$this->pays."'"; $sql .= ",pays='".$this->pays."'";
$sql .= ",public=".$this->public; $sql .= ",public=".$this->public;
if ($this->projetid) { $sql .= ",fk_don_projet=".$this->projetid; } if ($this->projetid) { $sql .= ",fk_don_projet=".$this->projetid; }
$sql .= ",note='".$this->commentaire."'"; $sql .= ",note='".$this->note."'";
$sql .= ",datedon='".$this->date."'"; $sql .= ",datedon='".$this->date."'";
$sql .= ",email='".$this->email."'"; $sql .= ",email='".$this->email."'";
$sql .= ",fk_statut=".$this->statut; $sql .= ",fk_statut=".$this->statut;
@ -494,35 +499,6 @@ class Don
} }
} }
/*
* \brief Défini le commentaire
* \param rowid id du don à modifier
* \param commentaire commentaire à définir ('' par défaut)
*
*/
function set_commentaire($rowid, $commentaire='')
{
$sql = "UPDATE ".MAIN_DB_PREFIX."don SET note = '$commentaire'";
$sql .= " WHERE rowid = $rowid ;";
if ( $this->db->query( $sql) )
{
if ( $this->db->affected_rows() )
{
return 1;
}
else
{
return 0;
}
}
else
{
dolibarr_print_error($this->db);
return 0;
}
}
/* /*
* \brief Classe le don comme encaissé * \brief Classe le don comme encaissé

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2000-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2000-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org> * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -35,7 +35,7 @@
/** /**
* \class CMailFile * \class CMailFile
* \brief Classe d'envoi de mails et pieces jointes. Encapsule mail() avec d'eventuels attachements. * \brief Classe d'envoi de mails et pieces jointes. Encapsule mail() avec d'eventuels attachements.
* \remarks Usage: $mailfile = new CMailFile($subject,$sendto,$replyto,$message,$filepath,$mimetype,$filename,$cc,$ccc); * \remarks Usage: $mailfile = new CMailFile($subject,$sendto,$replyto,$message,$filepath,$mimetype,$filename,$cc,$ccc,$deliveryreceipt,$msgishtml,$errors_to);
* \remarks $mailfile->sendfile(); * \remarks $mailfile->sendfile();
*/ */
class CMailFile class CMailFile
@ -67,11 +67,11 @@ class CMailFile
\param addr_cc email cc \param addr_cc email cc
\param addr_bcc email bcc \param addr_bcc email bcc
\param deliveryreceipt demande accuse reception \param deliveryreceipt demande accuse reception
\param msgishtml 1=message is a html message, 0=message is not html, 2=auto detect \param msgishtml 1=String IS already html, 0=String IS NOT html, -1=Unknown need autodetection
*/ */
function CMailFile($subject,$to,$from,$msg, function CMailFile($subject,$to,$from,$msg,
$filename_list=array(),$mimetype_list=array(),$mimefilename_list=array(), $filename_list=array(),$mimetype_list=array(),$mimefilename_list=array(),
$addr_cc="",$addr_bcc="",$deliveryreceipt=0,$msgishtml=0, $errors_to='') $addr_cc="",$addr_bcc="",$deliveryreceipt=0,$msgishtml=0,$errors_to='')
{ {
dolibarr_syslog("CMailFile::CMailfile: from=$from, to=$to, addr_cc=$addr_cc, addr_bcc=$addr_bcc, errors_to=$errors_to"); dolibarr_syslog("CMailFile::CMailfile: from=$from, to=$to, addr_cc=$addr_cc, addr_bcc=$addr_bcc, errors_to=$errors_to");
dolibarr_syslog("CMailFile::CMailfile: subject=$subject, deliveryreceipt=$deliveryreceipt, msgishtml=$msgishtml"); dolibarr_syslog("CMailFile::CMailfile: subject=$subject, deliveryreceipt=$deliveryreceipt, msgishtml=$msgishtml");
@ -92,8 +92,8 @@ class CMailFile
if (eregi('^win',PHP_OS)) $this->eol="\r\n"; if (eregi('^win',PHP_OS)) $this->eol="\r\n";
if (eregi('^mac',PHP_OS)) $this->eol="\r"; if (eregi('^mac',PHP_OS)) $this->eol="\r";
// On defini si message HTML // Detect if message is HTML
if ($msgishtml == 2) if ($msgishtml == -1)
{ {
$this->msgishtml = 0; $this->msgishtml = 0;
if (dol_textishtml($msg,1)) $this->msgishtml = 1; if (dol_textishtml($msg,1)) $this->msgishtml = 1;

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2006-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -15,15 +15,12 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* or see http://www.gnu.org/ * or see http://www.gnu.org/
*
* $Id$
* $Source$
*/ */
/** /**
\file htdocs/lib/doleditor.class.php \file htdocs/lib/doleditor.class.php
\brief Classe permettant de gérer FCKEditor \brief Classe permettant de gérer FCKEditor
\version $Revision$ \version $Id$
*/ */
/** /**
@ -58,6 +55,9 @@ class DolEditor
dolibarr_syslog("DolEditor::DolEditor modulepart=".$modulepart); dolibarr_syslog("DolEditor::DolEditor modulepart=".$modulepart);
require_once(DOL_DOCUMENT_ROOT."/includes/fckeditor/fckeditor.php"); require_once(DOL_DOCUMENT_ROOT."/includes/fckeditor/fckeditor.php");
$content=dol_htmlentities($content); // If content is not HTML, we convert to HTML.
$this->editor = new FCKeditor($htmlname); $this->editor = new FCKeditor($htmlname);
$this->editor->BasePath = DOL_URL_ROOT.'/includes/fckeditor/' ; $this->editor->BasePath = DOL_URL_ROOT.'/includes/fckeditor/' ;
$this->editor->Value = $content; $this->editor->Value = $content;

View File

@ -2545,11 +2545,11 @@ function hexbin($hexa){
function dol_htmlentities($stringtoencode,$htmlinfo=-1) function dol_htmlentities($stringtoencode,$htmlinfo=-1)
{ {
if ($htmlinfo == 1) return $stringtoencode; if ($htmlinfo == 1) return $stringtoencode;
if ($htmlinfo == 0) return htmlentities($stringtoencode); if ($htmlinfo == 0) return nl2br(htmlentities($stringtoencode));
if ($htmlinfo == -1) if ($htmlinfo == -1)
{ {
if (dol_textishtml($stringtoencode)) return $stringtoencode; if (dol_textishtml($stringtoencode)) return $stringtoencode;
else return htmlentities($stringtoencode); else return nl2br(htmlentities($stringtoencode));
} }
return $stringtoencode; return $stringtoencode;
} }

View File

@ -59,11 +59,12 @@ print "</tr>\n";
$sql = "SELECT p.title, p.rowid, count(t.rowid)"; $sql = "SELECT p.title, p.rowid, count(t.rowid)";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user";
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql.= " FROM";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$socid) $sql .= " ".MAIN_DB_PREFIX."societe_commerciaux as sc,";
//$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t ON p.rowid = t.fk_projet"; $sql.= " ".MAIN_DB_PREFIX."projet as p";
$sql.= " , ".MAIN_DB_PREFIX."projet_task as t"; // pourquoi est-ce que c'était en commentaire ? //$sql.= " , ".MAIN_DB_PREFIX."projet_task as t"; // pourquoi est-ce que c'était en commentaire ? => Si on laisse ce lien, les projet sans taches se retrouvent invisibles
$sql.= " WHERE t.fk_projet = p.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t ON p.rowid = t.fk_projet";
$sql.= " WHERE 1 == 1";
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($socid) if ($socid)
{ {

View File

@ -104,7 +104,7 @@ if ($_POST["action"] == 'add')
$adh->note = $_POST["note"]; $adh->note = $_POST["note"];
$adh->pays = $_POST["pays"]; $adh->pays = $_POST["pays"];
$adh->typeid = $_POST["type"]; $adh->typeid = $_POST["type"];
$adh->commentaire = $_POST["comment"]; $adh->note = $_POST["comment"];
$adh->morphy = $_POST["morphy"]; $adh->morphy = $_POST["morphy"];
foreach($_POST as $key => $value){ foreach($_POST as $key => $value){

View File

@ -109,7 +109,7 @@ if ($action == 'update')
$adh->note = $_POST["note"]; $adh->note = $_POST["note"];
$adh->pays = $_POST["pays"]; $adh->pays = $_POST["pays"];
$adh->typeid = $_POST["type"]; $adh->typeid = $_POST["type"];
$adh->commentaire = $_POST["comment"]; $adh->note = $_POST["comment"];
$adh->morphy = $_POST["morphy"]; $adh->morphy = $_POST["morphy"];
// recuperation du statut et public // recuperation du statut et public
$adh->statut = $_POST["statut"]; $adh->statut = $_POST["statut"];

View File

@ -57,7 +57,7 @@ if ($rowid > 0)
print '<tr><td>Personne</td><td class="valeur">'.$adh->morphy.'&nbsp;</td>'; print '<tr><td>Personne</td><td class="valeur">'.$adh->morphy.'&nbsp;</td>';
print '<td rowspan="13" valign="top" width="50%">'; print '<td rowspan="13" valign="top" width="50%">';
print nl2br($adh->commentaire).'&nbsp;</td></tr>'; print nl2br($adh->note).'&nbsp;</td></tr>';
print '<tr><td width="15%">Prénom</td><td class="valeur" width="35%">'.$adh->prenom.'&nbsp;</td></tr>'; print '<tr><td width="15%">Prénom</td><td class="valeur" width="35%">'.$adh->prenom.'&nbsp;</td></tr>';

View File

@ -41,7 +41,7 @@ if ($conf->don->enabled)
} }
$don->email = $_POST["email"]; $don->email = $_POST["email"];
$don->amount = $_POST["montant"]; $don->amount = $_POST["montant"];
$don->commentaire = $_POST["commentaire"]; $don->note = $_POST["commentaire"];
if ($_POST["action"] == 'add') if ($_POST["action"] == 'add')

View File

@ -88,20 +88,20 @@ if ($_POST["action"] == 'send' || $_POST["action"] == 'relance')
if ($_POST["action"] == 'send') { if ($_POST["action"] == 'send') {
$subject = $langs->trans("Bill")." $fac->ref"; $subject = $langs->trans("Bill")." $fac->ref";
$actiontypeid=9; $actiontypeid=9;
$actionmsg ="Mail envoyé par $from à $sendto.<br>"; $actionmsg ="Mail envoyé par ".$from." à ".$sendto.".\n";
if ($message) { if ($message) {
$actionmsg.="Texte utilisé dans le corps du message:<br>"; $actionmsg.="Texte utilisé dans le corps du message:\n";
$actionmsg.="$message"; $actionmsg.=$message;
} }
$actionmsg2="Envoi facture par mail"; $actionmsg2="Envoi facture par mail";
} }
if ($_POST["action"] == 'relance') { if ($_POST["action"] == 'relance') {
$subject = "Relance facture $fac->ref"; $subject = "Relance facture $fac->ref";
$actiontypeid=9; $actiontypeid=9;
$actionmsg="Mail envoyé par $from à $sendto.<br>"; $actionmsg="Mail envoyé par ".$from." à ".$sendto.".\n";
if ($message) { if ($message) {
$actionmsg.="Texte utilisé dans le corps du message:<br>"; $actionmsg.="Texte utilisé dans le corps du message:\n";
$actionmsg.="$message"; $actionmsg.=$message;
} }
$actionmsg2="Relance facture par mail"; $actionmsg2="Relance facture par mail";
} }

View File

@ -1033,7 +1033,7 @@ class User extends CommonObject
$adh->phone=$this->office_phone; $adh->phone=$this->office_phone;
$adh->phone_mobile=$this->user_mobile; $adh->phone_mobile=$this->user_mobile;
$adh->commentaire=$this->note; $adh->note=$this->note;
$adh->user_id=$this->id; $adh->user_id=$this->id;
$adh->user_login=$this->login; $adh->user_login=$this->login;

View File

@ -202,7 +202,7 @@ if ($result >= 0)
$member->phone_mobile=$ldapuser[$conf->global->LDAP_FIELD_MOBILE]; $member->phone_mobile=$ldapuser[$conf->global->LDAP_FIELD_MOBILE];
$member->email=$ldapuser[$conf->global->LDAP_FIELD_MAIL]; $member->email=$ldapuser[$conf->global->LDAP_FIELD_MAIL];
$member->commentaire=$ldapuser[$conf->global->LDAP_FIELD_DESCRIPTION]; $member->note=$ldapuser[$conf->global->LDAP_FIELD_DESCRIPTION];
$member->morphy='phy'; $member->morphy='phy';
$member->photo=''; $member->photo='';
$member->public=1; $member->public=1;

View File

@ -96,8 +96,7 @@ if ($resql)
$errorsto = $obj->email_errorsto; $errorsto = $obj->email_errorsto;
// Le message est-il en html // Le message est-il en html
$msgishtml=0; // Non par defaut $msgishtml=-1; // Inconnu par defaut
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_MAILING) $msgishtml=1;
if (eregi('[ \t]*<html>',$message)) $msgishtml=1; if (eregi('[ \t]*<html>',$message)) $msgishtml=1;
$i++; $i++;