From 7f0e7942516ff9de1b2469f44bc407a450017f23 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 21 Mar 2008 00:27:37 +0000 Subject: [PATCH] Fix: String must be saved as they are in database. Html detect and convert must be done on screen only. --- htdocs/adherents/adherent.class.php | 66 +++++++++---------- htdocs/adherents/adherent_type.class.php | 8 +-- htdocs/adherents/card_subscriptions.php | 2 +- htdocs/adherents/fiche.php | 6 +- htdocs/adherents/note.php | 11 ++-- htdocs/adherents/type.php | 11 ++-- htdocs/admin/mails.php | 3 +- htdocs/comm/action/fiche.php | 11 ++-- htdocs/comm/mailing/fiche.php | 9 +-- htdocs/commonobject.class.php | 5 +- htdocs/compta/bank/fiche.php | 4 +- htdocs/compta/dons/fiche.php | 11 ++-- htdocs/compta/facture.php | 8 +-- htdocs/don.class.php | 42 +++--------- htdocs/lib/CMailFile.class.php | 12 ++-- htdocs/lib/doleditor.class.php | 12 ++-- htdocs/lib/functions.inc.php | 4 +- htdocs/projet/index.php | 11 ++-- htdocs/public/adherents/new.php | 2 +- htdocs/public/adherents/priv_edit.php | 2 +- htdocs/public/adherents/priv_fiche.php | 2 +- htdocs/public/dons/index.php | 2 +- htdocs/telephonie/client/facture.php | 12 ++-- htdocs/user.class.php | 2 +- .../adherents/sync_member_ldap2dolibarr.php | 2 +- scripts/mailing/mailing-send.php | 3 +- 26 files changed, 117 insertions(+), 146 deletions(-) diff --git a/htdocs/adherents/adherent.class.php b/htdocs/adherents/adherent.class.php index 2bdd68fe6fd..30a5242d474 100644 --- a/htdocs/adherents/adherent.class.php +++ b/htdocs/adherents/adherent.class.php @@ -71,7 +71,7 @@ class Adherent extends CommonObject var $morphy; var $public; - var $commentaire; // Note + var $note; // Note var $statut; // -1:brouillon, 0:resilie, >=1:valide,paye var $photo; @@ -125,7 +125,7 @@ class Adherent extends CommonObject \param addr_cc email cc \param addr_bcc email bcc \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 \remarks La particularite de cette fonction est de remplacer certains champs \remarks par leur valeur pour l'adherent en l'occurrence : @@ -137,10 +137,34 @@ class Adherent extends CommonObject */ function send_an_email($text,$subject, $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; + // 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 ( '/%PRENOM%/', '/%NOM%/', @@ -157,30 +181,6 @@ class Adherent extends CommonObject '/%LOGIN%/', '/%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('prenom, $this->nom, @@ -207,7 +207,7 @@ class Adherent extends CommonObject include_once(DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php"); $mailfile = new CMailFile($subjectosend,$this->email,$from,$texttosend, $filename_list,$mimetype_list,$mimefilename_list, - $addr_cc, $addr_bcc, $deliveryreceipt, $html); + $addr_cc, $addr_bcc, $deliveryreceipt, $msgishtml); if ($mailfile->sendfile()) { return 1; @@ -471,7 +471,7 @@ class Adherent extends CommonObject $sql.= ", phone=" .($this->phone?"'".addslashes($this->phone)."'":"null"); $sql.= ", phone_perso=" .($this->phone_perso?"'".addslashes($this->phone_perso)."'":"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.= ", public=" ."'".$this->public."'"; $sql.= ", statut=" .$this->statut; @@ -559,7 +559,7 @@ class Adherent extends CommonObject $luser->office_phone=$this->phone; $luser->user_mobile=$this->phone_mobile; - $luser->note=$this->commentaire; + $luser->note=$this->note; $luser->fk_member=$this->id; @@ -940,7 +940,7 @@ class Adherent extends CommonObject $this->datevalid = $obj->datevalid; $this->naiss = $obj->datenaiss; - $this->commentaire = $obj->note; + $this->note = $obj->note; $this->morphy = $obj->morphy; $this->typeid = $obj->fk_adherent_type; @@ -1865,7 +1865,7 @@ class Adherent extends CommonObject $this->phone = '0999999999'; $this->phone_perso = '0999999998'; $this->phone_mobile = '0999999997'; - $this->commentaire='No comment'; + $this->note='No comment'; $this->naiss=time(); $this->photo=''; $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_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->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 (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'); diff --git a/htdocs/adherents/adherent_type.class.php b/htdocs/adherents/adherent_type.class.php index 8589f43dec3..76ef4d06973 100644 --- a/htdocs/adherents/adherent_type.class.php +++ b/htdocs/adherents/adherent_type.class.php @@ -43,8 +43,8 @@ class AdherentType extends CommonObject var $libelle; var $statut; var $cotisation; /**< Soumis à la cotisation */ - var $vote; /** droit de vote ? */ - var $commentaire; /**< commentaire */ + var $vote; /**< droit de vote ? */ + var $note; /**< commentaire */ var $mail_valid; /**< mail envoye lors de la validation */ @@ -114,7 +114,7 @@ class AdherentType extends CommonObject $sql.= "statut=".$this->statut.","; $sql.= "libelle = '".addslashes($this->libelle) ."',"; $sql.= "cotisation='".$this->cotisation."',"; - $sql.= "note='".addslashes($this->commentaire)."',"; + $sql.= "note='".addslashes($this->note)."',"; $sql.= "vote='".$this->vote."',"; $sql.= "mail_valid='".addslashes($this->mail_valid)."'"; @@ -186,7 +186,7 @@ class AdherentType extends CommonObject $this->statut = $obj->statut; $this->cotisation = $obj->cotisation; $this->mail_valid = $obj->mail_valid; - $this->commentaire = $obj->note; + $this->note = $obj->note; $this->vote = $obj->vote; } return 1; diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php index 7639599bddb..1e8670d8aef 100644 --- a/htdocs/adherents/card_subscriptions.php +++ b/htdocs/adherents/card_subscriptions.php @@ -139,7 +139,7 @@ if ($user->rights->adherent->cotisation->creer && $_POST["action"] == 'cotisatio // Envoi mail 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; } diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php index 19f1d0b3b7b..aab9b2bfa66 100644 --- a/htdocs/adherents/fiche.php +++ b/htdocs/adherents/fiche.php @@ -144,7 +144,7 @@ if ($_REQUEST["action"] == 'update' && ! $_POST["cancel"]) $adh->naiss = $datenaiss; $adh->typeid = $_POST["type"]; - $adh->commentaire = $_POST["comment"]; + $adh->note = $_POST["comment"]; $adh->morphy = $_POST["morphy"]; $adh->amount = $_POST["amount"]; @@ -257,7 +257,7 @@ if ($user->rights->adherent->creer && $_POST["action"] == 'add') $adh->naiss = $datenaiss; $adh->photo = $photo; $adh->typeid = $type; - $adh->commentaire = $comment; + $adh->note = $comment; $adh->morphy = $morphy; foreach($_POST as $key => $value){ if (ereg("^options_",$key)){ @@ -448,7 +448,7 @@ if ($user->rights->adherent->supprimer && $_POST["action"] == 'confirm_resign' & { 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) { diff --git a/htdocs/adherents/note.php b/htdocs/adherents/note.php index 35c1cb0ee8c..7a6ed6d8207 100644 --- a/htdocs/adherents/note.php +++ b/htdocs/adherents/note.php @@ -15,16 +15,13 @@ * 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/adherents/note.php \ingroup member \brief Fiche de notes sur un adherent - \version $Revision$ + \version $Id$ */ require("./pre.inc.php"); @@ -116,17 +113,17 @@ if ($id) { // Editeur wysiwyg 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(); } else { - print ''; + print ''; } } else { - print nl2br($adh->commentaire); + print nl2br($adh->note); } print ""; diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 62703a6b0bc..81536b9b198 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -45,7 +45,7 @@ if ($user->rights->adherent->configurer && $_POST["action"] == 'add') $adht->libelle = trim($_POST["libelle"]); $adht->cotisation = trim($_POST["cotisation"]); - $adht->commentaire = trim($_POST["comment"]); + $adht->note = trim($_POST["comment"]); $adht->mail_valid = trim($_POST["mail_valid"]); $adht->vote = trim($_POST["vote"]); @@ -79,7 +79,7 @@ if ($user->rights->adherent->configurer && $_POST["action"] == 'update') $adht->id = $_POST["rowid"]; $adht->libelle = trim($_POST["libelle"]); $adht->cotisation = trim($_POST["cotisation"]); - $adht->commentaire = trim($_POST["comment"]); + $adht->note = trim($_POST["comment"]); $adht->mail_valid = trim($_POST["mail_valid"]); $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') { $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 ''; print ''.$langs->trans("Description").''; - print nl2br($adht->commentaire).""; + print nl2br($adht->note).""; print ''.$langs->trans("WelcomeEMail").''; print nl2br($adht->mail_valid).""; @@ -348,7 +349,7 @@ if ($rowid > 0) print ''; print ''.$langs->trans("Description").''; - print ""; + print ""; print ''.$langs->trans("WelcomeEMail").''; if ($conf->fckeditor->enabled) diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 6b928866723..ef78a1b591b 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -85,8 +85,7 @@ if ($_POST["action"] == 'send' && ! $_POST["cancel"]) if ($sendto) { // Le message est-il en html - $msgishtml=0; // Non par defaut - //if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_MAILING) $msgishtml=1; + $msgishtml=-1; // Unknown by default if (eregi('[ \t]*',$message)) $msgishtml=1; // Pratique les substitutions sur le sujet et message diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index d175879237a..f41672b7f16 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -379,7 +379,7 @@ if ($_GET["action"] == 'create') } print ''; - // Si la societe est imposee, on propose ces contacts + // Si la societe est imposee, on propose ses contacts if ($_REQUEST["socid"]) { $contactid = $_REQUEST["contactid"]?$_REQUEST["contactid"]:''; @@ -440,7 +440,7 @@ if ($_GET["action"] == 'create') } else { - print ''; + print ''; } print ''; @@ -704,7 +704,7 @@ if ($_GET["id"]) print ''.$langs->trans("Note").''; if ($conf->fckeditor->enabled) { - // Editeur wysiwyg + // Editeur wysiwyg require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php"); $doleditor=new DolEditor('note',$act->note,280,'dolibarr_notes','In',true); $doleditor->Create(); @@ -785,7 +785,7 @@ if ($_GET["id"]) print $act->getLibStatut(4); print ''; - // Objet li� + // Objet lie if ($act->objet_url) { print ''.$langs->trans("LinkedObject").''; @@ -794,8 +794,7 @@ if ($_GET["id"]) // Note print ''.$langs->trans("Note").''; - if ($conf->fckeditor->enabled) print nl2br($act->note); - else print nl2br(htmlentities($act->note)); + print dol_htmlentities($act->note); print ''; print ''; diff --git a/htdocs/comm/mailing/fiche.php b/htdocs/comm/mailing/fiche.php index 967c79c7382..ebab542fb13 100644 --- a/htdocs/comm/mailing/fiche.php +++ b/htdocs/comm/mailing/fiche.php @@ -94,8 +94,7 @@ if ($_POST["action"] == 'sendallconfirmed') $errorsto = $obj->email_errorsto; // Le message est-il en html - $msgishtml=0; // Non par defaut - if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_MAILING) $msgishtml=1; + $msgishtml=-1; // Unknown by default if (eregi('[ \t]*',$message)) $msgishtml=1; $i++; @@ -250,15 +249,13 @@ if ($_POST["action"] == 'send' && ! $_POST["cancel"]) $arr_name = array(); // Le message est-il en html - $msgishtml=0; // Non par defaut - if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_MAILING) $msgishtml=1; + $msgishtml=-1; // Inconnu par defaut if (eregi('[ \t]*',$message)) $msgishtml=1; // Pratique les substitutions sur le sujet et message $mil->sujet=make_substitutions($mil->sujet,$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, $arr_file,$arr_mime,$arr_name, '', '', 0, $msgishtml); @@ -434,7 +431,7 @@ if ($_GET["action"] == 'create') if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_MAILING) { 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(); } else diff --git a/htdocs/commonobject.class.php b/htdocs/commonobject.class.php index 6ab078ac61b..9b8e6e77f93 100644 --- a/htdocs/commonobject.class.php +++ b/htdocs/commonobject.class.php @@ -772,7 +772,7 @@ class CommonObject { 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; } @@ -780,7 +780,7 @@ class CommonObject $sql.= " SET note = '".addslashes($note)."'"; $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)) { $this->note = $note; @@ -789,6 +789,7 @@ class CommonObject else { $this->error=$this->db->error(); + dolibarr_syslog("CommonObject::update_note error=".$this->error, LOG_ERR); return -1; } } diff --git a/htdocs/compta/bank/fiche.php b/htdocs/compta/bank/fiche.php index 6dc4a3a9e01..19c87fc672f 100644 --- a/htdocs/compta/bank/fiche.php +++ b/htdocs/compta/bank/fiche.php @@ -225,7 +225,7 @@ if ($_GET["action"] == 'create') else { print ''; + print $account->comment.''; } print ''; @@ -464,7 +464,7 @@ else else { print ''; + print $account->comment.''; } print ''; diff --git a/htdocs/compta/dons/fiche.php b/htdocs/compta/dons/fiche.php index 0f6fdcee5ac..6072af5a291 100644 --- a/htdocs/compta/dons/fiche.php +++ b/htdocs/compta/dons/fiche.php @@ -66,7 +66,7 @@ if ($_POST["action"] == 'update') $don->pays = $_POST["pays"]; $don->public = $_POST["public"]; $don->projetid = $_POST["projetid"]; - $don->commentaire = $_POST["comment"]; + $don->note = $_POST["comment"]; $don->modepaiementid = $_POST["modepaiement"]; if ($don->update($user) > 0) @@ -101,7 +101,7 @@ if ($_POST["action"] == 'add') $don->pays = $_POST["pays"]; $don->public = $_POST["public"]; $don->projetid = $_POST["projetid"]; - $don->commentaire = $_POST["comment"]; + $don->note = $_POST["comment"]; $don->modepaiementid = $_POST["modepaiement"]; if ($don->create($user) > 0) @@ -127,7 +127,8 @@ if ($_GET["action"] == 'delete') if ($_POST["action"] == 'commentaire') { $don = new Don($db); - $don->set_commentaire($_POST["rowid"],$_POST["commentaire"]); + $don->fetch($_POST["rowid"]); + $don->update_note($_POST["commentaire"]); $_GET["rowid"] = $_POST["rowid"]; } if ($_GET["action"] == 'valid_promesse') @@ -265,7 +266,7 @@ if ($_GET["rowid"] && $_GET["action"] == 'edit') if ($conf->projet->enabled) $nbrows++; print ''.$langs->trans("Comments").' :
'; - print ""; + print ""; if ($conf->projet->enabled) { @@ -354,7 +355,7 @@ if ($_GET["rowid"] && $_GET["action"] != 'edit') if ($conf->projet->enabled) $nbrows++; print ''.$langs->trans("Comments").' :
'; - print nl2br($don->commentaire).''; + print nl2br($don->note).''; if ($conf->projet->enabled) { diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index d68d846ce33..fa4204e778a 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1007,11 +1007,11 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'relance') && ! $_POST['c } $actiontypecode='AC_FAC'; - $actionmsg ='Mail envoyé par '.$from.' à '.$sendto.'.
'; + $actionmsg ="Mail envoyé par ".$from." à ".$sendto.".\n"; if ($message) { - $actionmsg.='Texte utilisé dans le corps du message:
'; + $actionmsg.="Texte utilisé dans le corps du message:\n"; $actionmsg.=$message; } @@ -1021,9 +1021,9 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'relance') && ! $_POST['c { $subject = 'Relance facture '.$fac->ref; $actiontypecode='AC_FAC'; - $actionmsg='Mail envoyé par '.$from.' à '.$sendto.'.
'; + $actionmsg="Mail envoyé par ".$from." à ".$sendto.".\n"; if ($message) { - $actionmsg.='Texte utilisé dans le corps du message:
'; + $actionmsg.="Texte utilisé dans le corps du message:\n"; $actionmsg.=$message; } $actionmsg2='Relance facture par mail'; diff --git a/htdocs/don.class.php b/htdocs/don.class.php index 8bc52241ce7..93e0ba84b68 100644 --- a/htdocs/don.class.php +++ b/htdocs/don.class.php @@ -35,6 +35,11 @@ class Don { + var $db; + var $error; + var $element='don'; + var $table_element='don'; + var $id; var $db; var $date; @@ -51,7 +56,7 @@ class Don var $projetid; var $modepaiement; var $modepaiementid; - var $commentaire; + var $note; var $statut; var $projet; @@ -176,7 +181,7 @@ class Don $this->ville = 'Town'; $this->note_public='SPECIMEN'; $this->email='email@email.com'; - $this->commentaire=''; + $this->note=''; $this->statut=1; } @@ -297,7 +302,7 @@ class Don { $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); if ($result) @@ -333,7 +338,7 @@ class Don $sql .= ",pays='".$this->pays."'"; $sql .= ",public=".$this->public; if ($this->projetid) { $sql .= ",fk_don_projet=".$this->projetid; } - $sql .= ",note='".$this->commentaire."'"; + $sql .= ",note='".$this->note."'"; $sql .= ",datedon='".$this->date."'"; $sql .= ",email='".$this->email."'"; $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é diff --git a/htdocs/lib/CMailFile.class.php b/htdocs/lib/CMailFile.class.php index 7550f347822..ba0d40a6e13 100644 --- a/htdocs/lib/CMailFile.class.php +++ b/htdocs/lib/CMailFile.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2003 Jean-Louis Bergamo - * Copyright (C) 2004-2006 Laurent Destailleur + * Copyright (C) 2004-2008 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 @@ -35,7 +35,7 @@ /** * \class CMailFile * \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(); */ class CMailFile @@ -67,11 +67,11 @@ class CMailFile \param addr_cc email cc \param addr_bcc email bcc \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, $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: subject=$subject, deliveryreceipt=$deliveryreceipt, msgishtml=$msgishtml"); @@ -92,8 +92,8 @@ class CMailFile if (eregi('^win',PHP_OS)) $this->eol="\r\n"; if (eregi('^mac',PHP_OS)) $this->eol="\r"; - // On defini si message HTML - if ($msgishtml == 2) + // Detect if message is HTML + if ($msgishtml == -1) { $this->msgishtml = 0; if (dol_textishtml($msg,1)) $this->msgishtml = 1; diff --git a/htdocs/lib/doleditor.class.php b/htdocs/lib/doleditor.class.php index 62e3274bba1..4bbf1a2daa6 100644 --- a/htdocs/lib/doleditor.class.php +++ b/htdocs/lib/doleditor.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2006-2008 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 @@ -15,15 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * or see http://www.gnu.org/ - * - * $Id$ - * $Source$ */ /** \file htdocs/lib/doleditor.class.php \brief Classe permettant de gérer FCKEditor - \version $Revision$ + \version $Id$ */ /** @@ -56,8 +53,11 @@ class DolEditor global $conf,$langs; dolibarr_syslog("DolEditor::DolEditor modulepart=".$modulepart); - + 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->BasePath = DOL_URL_ROOT.'/includes/fckeditor/' ; $this->editor->Value = $content; diff --git a/htdocs/lib/functions.inc.php b/htdocs/lib/functions.inc.php index 1eca055dab5..1e505b8eb15 100644 --- a/htdocs/lib/functions.inc.php +++ b/htdocs/lib/functions.inc.php @@ -2545,11 +2545,11 @@ function hexbin($hexa){ function dol_htmlentities($stringtoencode,$htmlinfo=-1) { if ($htmlinfo == 1) return $stringtoencode; - if ($htmlinfo == 0) return htmlentities($stringtoencode); + if ($htmlinfo == 0) return nl2br(htmlentities($stringtoencode)); if ($htmlinfo == -1) { if (dol_textishtml($stringtoencode)) return $stringtoencode; - else return htmlentities($stringtoencode); + else return nl2br(htmlentities($stringtoencode)); } return $stringtoencode; } diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index f188420b2ad..f98f71d1866 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -59,11 +59,12 @@ print "\n"; $sql = "SELECT p.title, p.rowid, count(t.rowid)"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; -$sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; -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_task as t"; // pourquoi est-ce que c'était en commentaire ? -$sql.= " WHERE t.fk_projet = p.rowid"; +$sql.= " FROM"; +if (!$user->rights->societe->client->voir && !$socid) $sql .= " ".MAIN_DB_PREFIX."societe_commerciaux as sc,"; +$sql.= " ".MAIN_DB_PREFIX."projet as p"; +//$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.= " 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 ($socid) { diff --git a/htdocs/public/adherents/new.php b/htdocs/public/adherents/new.php index af1bafd1128..af17372ae06 100644 --- a/htdocs/public/adherents/new.php +++ b/htdocs/public/adherents/new.php @@ -104,7 +104,7 @@ if ($_POST["action"] == 'add') $adh->note = $_POST["note"]; $adh->pays = $_POST["pays"]; $adh->typeid = $_POST["type"]; - $adh->commentaire = $_POST["comment"]; + $adh->note = $_POST["comment"]; $adh->morphy = $_POST["morphy"]; foreach($_POST as $key => $value){ diff --git a/htdocs/public/adherents/priv_edit.php b/htdocs/public/adherents/priv_edit.php index 58768aee803..f6fdb279e75 100644 --- a/htdocs/public/adherents/priv_edit.php +++ b/htdocs/public/adherents/priv_edit.php @@ -109,7 +109,7 @@ if ($action == 'update') $adh->note = $_POST["note"]; $adh->pays = $_POST["pays"]; $adh->typeid = $_POST["type"]; - $adh->commentaire = $_POST["comment"]; + $adh->note = $_POST["comment"]; $adh->morphy = $_POST["morphy"]; // recuperation du statut et public $adh->statut = $_POST["statut"]; diff --git a/htdocs/public/adherents/priv_fiche.php b/htdocs/public/adherents/priv_fiche.php index 3b68b36bb7a..3e568a64b16 100644 --- a/htdocs/public/adherents/priv_fiche.php +++ b/htdocs/public/adherents/priv_fiche.php @@ -57,7 +57,7 @@ if ($rowid > 0) print 'Personne'.$adh->morphy.' '; print ''; - print nl2br($adh->commentaire).' '; + print nl2br($adh->note).' '; print 'Prénom'.$adh->prenom.' '; diff --git a/htdocs/public/dons/index.php b/htdocs/public/dons/index.php index ea2026d2ef4..6975e084f19 100644 --- a/htdocs/public/dons/index.php +++ b/htdocs/public/dons/index.php @@ -41,7 +41,7 @@ if ($conf->don->enabled) } $don->email = $_POST["email"]; $don->amount = $_POST["montant"]; - $don->commentaire = $_POST["commentaire"]; + $don->note = $_POST["commentaire"]; if ($_POST["action"] == 'add') diff --git a/htdocs/telephonie/client/facture.php b/htdocs/telephonie/client/facture.php index 1034c928d35..c3be953c14e 100644 --- a/htdocs/telephonie/client/facture.php +++ b/htdocs/telephonie/client/facture.php @@ -88,20 +88,20 @@ if ($_POST["action"] == 'send' || $_POST["action"] == 'relance') if ($_POST["action"] == 'send') { $subject = $langs->trans("Bill")." $fac->ref"; $actiontypeid=9; - $actionmsg ="Mail envoyé par $from à $sendto.
"; + $actionmsg ="Mail envoyé par ".$from." à ".$sendto.".\n"; if ($message) { - $actionmsg.="Texte utilisé dans le corps du message:
"; - $actionmsg.="$message"; + $actionmsg.="Texte utilisé dans le corps du message:\n"; + $actionmsg.=$message; } $actionmsg2="Envoi facture par mail"; } if ($_POST["action"] == 'relance') { $subject = "Relance facture $fac->ref"; $actiontypeid=9; - $actionmsg="Mail envoyé par $from à $sendto.
"; + $actionmsg="Mail envoyé par ".$from." à ".$sendto.".\n"; if ($message) { - $actionmsg.="Texte utilisé dans le corps du message:
"; - $actionmsg.="$message"; + $actionmsg.="Texte utilisé dans le corps du message:\n"; + $actionmsg.=$message; } $actionmsg2="Relance facture par mail"; } diff --git a/htdocs/user.class.php b/htdocs/user.class.php index 0db8b9ef564..19b4daf3ebc 100644 --- a/htdocs/user.class.php +++ b/htdocs/user.class.php @@ -1033,7 +1033,7 @@ class User extends CommonObject $adh->phone=$this->office_phone; $adh->phone_mobile=$this->user_mobile; - $adh->commentaire=$this->note; + $adh->note=$this->note; $adh->user_id=$this->id; $adh->user_login=$this->login; diff --git a/scripts/adherents/sync_member_ldap2dolibarr.php b/scripts/adherents/sync_member_ldap2dolibarr.php index 73fbeb4f88a..44390b3ae6e 100644 --- a/scripts/adherents/sync_member_ldap2dolibarr.php +++ b/scripts/adherents/sync_member_ldap2dolibarr.php @@ -202,7 +202,7 @@ if ($result >= 0) $member->phone_mobile=$ldapuser[$conf->global->LDAP_FIELD_MOBILE]; $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->photo=''; $member->public=1; diff --git a/scripts/mailing/mailing-send.php b/scripts/mailing/mailing-send.php index c2e313773ba..5de958e7648 100644 --- a/scripts/mailing/mailing-send.php +++ b/scripts/mailing/mailing-send.php @@ -96,8 +96,7 @@ if ($resql) $errorsto = $obj->email_errorsto; // Le message est-il en html - $msgishtml=0; // Non par defaut - if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_MAILING) $msgishtml=1; + $msgishtml=-1; // Inconnu par defaut if (eregi('[ \t]*',$message)) $msgishtml=1; $i++;