Amélioration du module fckeditor: On peut choisir d'activer l'édition WYSIWIG sur les desc produit et sur les lignes details indépendamment.

On peut aussi éditer les notes produits.
This commit is contained in:
Laurent Destailleur 2006-07-22 14:14:13 +00:00
parent f22d0e0305
commit 918958923e
11 changed files with 180 additions and 140 deletions

View File

@ -38,6 +38,7 @@ if (!$user->admin)
// Constante et traduction de la description du module // Constante et traduction de la description du module
$modules = array( $modules = array(
'PRODUCTDESC'=>'FCKeditorForProductDescription', 'PRODUCTDESC'=>'FCKeditorForProductDescription',
'DETAILS'=>'FCKeditorForDetails',
'MAILING'=>'FCKeditorForMailing', 'MAILING'=>'FCKeditorForMailing',
); );
@ -45,18 +46,19 @@ foreach($modules as $const => $desc)
{ {
if ($_GET["action"] == 'activate_'.strtolower($const)) if ($_GET["action"] == 'activate_'.strtolower($const))
{ {
dolibarr_set_const($db, "FCKEDITOR_ENABLE_".$const, "1"); dolibarr_set_const($db, "FCKEDITOR_ENABLE_".$const, "1");
Header("Location: fckeditor.php"); Header("Location: fckeditor.php");
exit; exit;
} }
else if ($_GET["action"] == 'disable_'.strtolower($const)) if ($_GET["action"] == 'disable_'.strtolower($const))
{ {
dolibarr_del_const($db, "FCKEDITOR_ENABLE_".$const); dolibarr_del_const($db, "FCKEDITOR_ENABLE_".$const);
Header("Location: fckeditor.php"); Header("Location: fckeditor.php");
exit; exit;
} }
} }
/* /*
* Affiche page * Affiche page
*/ */
@ -96,8 +98,6 @@ print "</tr>\n";
foreach($modules as $const => $desc) foreach($modules as $const => $desc)
{ {
$var=!$var; $var=!$var;
print "<form method=\"post\" action=\"fckeditor.php\">";
print '<input type="hidden" name="action" value="'.strtolower($const).'">';
print "<tr ".$bc[$var].">"; print "<tr ".$bc[$var].">";
print '<td>'.$langs->trans($desc).'</td>'; print '<td>'.$langs->trans($desc).'</td>';
print '<td align="center" width="20">'; print '<td align="center" width="20">';
@ -105,30 +105,28 @@ foreach($modules as $const => $desc)
$constante = FCKEDITOR_ENABLE_.$const; $constante = FCKEDITOR_ENABLE_.$const;
$value = $conf->global->$constante; $value = $conf->global->$constante;
if($value == 1) print $value == 1 ? img_tick() : '&nbsp;';
{
print img_tick();
}
print '</td>'; print '</td>';
print '<td align="center" width="100">'; print '<td align="center" width="100">';
if($value == 0) if($value == 0)
{ {
print '<a href="fckeditor.php?action=activate_'.strtolower($const).'">'.$langs->trans("Activate").'</a>'; print '<a href="fckeditor.php?action=activate_'.strtolower($const).'">'.$langs->trans("Activate").'</a>';
} }
else if($value == 1) else if($value == 1)
{ {
print '<a href="fckeditor.php?action=disable_'.strtolower($const).'">'.$langs->trans("Disable").'</a>'; print '<a href="fckeditor.php?action=disable_'.strtolower($const).'">'.$langs->trans("Disable").'</a>';
} }
print '</form>';
print "</td>";
print '</tr>';
} }
print "</td>"; print '</table>';
print '</tr>';
print '</table>';
$db->close(); $db->close();
llxFooter(); llxFooter('$Date$ - $Revision$');
?> ?>

View File

@ -1160,7 +1160,7 @@ if ($_GET['propalid'] > 0)
print '<br>'; print '<br>';
} }
// éditeur wysiwyg // éditeur wysiwyg
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC) if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_DETAILS)
{ {
require_once(DOL_DOCUMENT_ROOT."/includes/fckeditor/fckeditor.php"); require_once(DOL_DOCUMENT_ROOT."/includes/fckeditor/fckeditor.php");
$oFCKeditor = new FCKeditor('desc'); $oFCKeditor = new FCKeditor('desc');

View File

@ -119,10 +119,10 @@ if ($_GET['propalid'])
print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td colspan="3">'.$propal->ref_url.'</td></tr>'; print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td colspan="3">'.$propal->ref_url.'</td></tr>';
// Société // Société
print '<tr><td>'.$langs->trans('Company').'</td><td colspan="5">'.$societe->getNomUrl(1).'</td></tr>'; print '<tr><td>'.$langs->trans('Company').'</td><td colspan="3">'.$societe->getNomUrl(1).'</td></tr>';
// Ligne info remises tiers // Ligne info remises tiers
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="5">'; print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="3">';
if ($societe->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$societe->remise_client); if ($societe->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$societe->remise_client);
else print $langs->trans("CompanyHasNoRelativeDiscount"); else print $langs->trans("CompanyHasNoRelativeDiscount");
$absolute_discount=$societe->getCurrentDiscount(); $absolute_discount=$societe->getCurrentDiscount();
@ -133,14 +133,14 @@ if ($_GET['propalid'])
print '</td></tr>'; print '</td></tr>';
// Date // Date
print '<tr><td>'.$langs->trans('Date').'</td><td>'; print '<tr><td>'.$langs->trans('Date').'</td><td colspan="3">';
print dolibarr_print_date($propal->date,'%a %d %B %Y'); print dolibarr_print_date($propal->date,'%a %d %B %Y');
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
// Date fin propal // Date fin propal
print '<tr>'; print '<tr>';
print '<td>'.$langs->trans('DateEndPropal').'</td><td>'; print '<td>'.$langs->trans('DateEndPropal').'</td><td colspan="3">';
if ($propal->fin_validite) if ($propal->fin_validite)
{ {
print dolibarr_print_date($propal->fin_validite,'%a %d %B %Y'); print dolibarr_print_date($propal->fin_validite,'%a %d %B %Y');

View File

@ -1353,7 +1353,7 @@ else
print '<br>'; print '<br>';
} }
// éditeur wysiwyg // éditeur wysiwyg
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC) if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_DETAILS)
{ {
require_once(DOL_DOCUMENT_ROOT."/includes/fckeditor/fckeditor.php"); require_once(DOL_DOCUMENT_ROOT."/includes/fckeditor/fckeditor.php");
$oFCKeditor = new FCKeditor('eldesc'); $oFCKeditor = new FCKeditor('eldesc');

View File

@ -1896,7 +1896,7 @@ else
print '<br>'; print '<br>';
} }
// éditeur wysiwyg // éditeur wysiwyg
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC) if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_DETAILS)
{ {
require_once(DOL_DOCUMENT_ROOT."/includes/fckeditor/fckeditor.php"); require_once(DOL_DOCUMENT_ROOT."/includes/fckeditor/fckeditor.php");
$oFCKeditor = new FCKeditor('desc'); $oFCKeditor = new FCKeditor('desc');

View File

@ -40,6 +40,8 @@ require_once(DOL_DOCUMENT_ROOT."/product.class.php");
class pdf_einstein extends ModelePDFCommandes class pdf_einstein extends ModelePDFCommandes
{ {
var $emetteur; // Objet societe qui emet
/** /**
\brief Constructeur \brief Constructeur
@ -47,7 +49,7 @@ class pdf_einstein extends ModelePDFCommandes
*/ */
function pdf_einstein($db) function pdf_einstein($db)
{ {
global $conf,$langs; global $conf,$langs,$mysoc;
$this->db = $db; $this->db = $db;
$this->name = "einstein"; $this->name = "einstein";
@ -72,21 +74,9 @@ class pdf_einstein extends ModelePDFCommandes
if (defined("FACTURE_TVAOPTION") && FACTURE_TVAOPTION == 'franchise') if (defined("FACTURE_TVAOPTION") && FACTURE_TVAOPTION == 'franchise')
$this->franchise=1; $this->franchise=1;
// Recupere code pays de l'emmetteur // Recupere emmetteur
$this->emetteur->code_pays=substr($langs->defaultlang,-2); // Par defaut, si on trouve pas $this->emetteur=$mysoc;
$sql = "SELECT code from ".MAIN_DB_PREFIX."c_pays"; if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // Par defaut, si n'était pas défini
$sql .= " WHERE rowid = '".$conf->global->MAIN_INFO_SOCIETE_PAYS."'";
$result=$this->db->query($sql);
if ($result) {
$obj = $this->db->fetch_object($result);
if ($obj->code) $this->emetteur->code_pays=$obj->code;
}
else {
dolibarr_print_error($this->db);
}
$this->db->free($result);
$this->tva=array();
// Defini position des colonnes // Defini position des colonnes
$this->posxdesc=$this->marge_gauche+1; $this->posxdesc=$this->marge_gauche+1;
@ -96,6 +86,7 @@ class pdf_einstein extends ModelePDFCommandes
$this->posxdiscount=162; $this->posxdiscount=162;
$this->postotalht=177; $this->postotalht=177;
$this->tva=array();
$this->atleastoneratenotnull=0; $this->atleastoneratenotnull=0;
$this->atleastonediscount=0; $this->atleastonediscount=0;
} }
@ -113,20 +104,6 @@ class pdf_einstein extends ModelePDFCommandes
\brief Fonction générant la commande sur le disque \brief Fonction générant la commande sur le disque
\param id Id de la commande à générer \param id Id de la commande à générer
\return int 1=ok, 0=ko \return int 1=ok, 0=ko
\remarks Variables utilisées
\remarks MAIN_INFO_SOCIETE_NOM
\remarks MAIN_INFO_ADRESSE
\remarks MAIN_INFO_CP
\remarks MAIN_INFO_VILLE
\remarks MAIN_INFO_TEL
\remarks MAIN_INFO_FAX
\remarks MAIN_INFO_WEB
\remarks MAIN_INFO_SIRET
\remarks MAIN_INFO_SIREN
\remarks MAIN_INFO_RCS
\remarks MAIN_INFO_CAPITAL
\remarks MAIN_INFO_TVAINTRA
\remarks MAIN_INFO_LOGO
*/ */
function write_pdf_file($com,$outputlangs='') function write_pdf_file($com,$outputlangs='')
{ {
@ -218,11 +195,11 @@ class pdf_einstein extends ModelePDFCommandes
$curY = $nexY; $curY = $nexY;
// Description de la ligne produit // Description de la ligne produit
$libelleproduitservice=$com->lignes[$i]->libelle; $libelleproduitservice=_dol_htmlentities($com->lignes[$i]->libelle,0);
if ($com->lignes[$i]->desc&&$com->lignes[$i]->desc!=$com->lignes[$i]->libelle) if ($com->lignes[$i]->desc&&$com->lignes[$i]->desc!=$com->lignes[$i]->libelle)
{ {
if ($libelleproduitservice) $libelleproduitservice.="\n"; if ($libelleproduitservice) $libelleproduitservice.="\n";
$libelleproduitservice.=$com->lignes[$i]->desc; $libelleproduitservice.=_dol_htmlentities($com->lignes[$i]->desc,$conf->global->FCKEDITOR_ENABLE_DETAILS);
} }
// Si ligne associée à un code produit // Si ligne associée à un code produit
if ($com->lignes[$i]->fk_product) if ($com->lignes[$i]->fk_product)
@ -253,7 +230,7 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->SetFont('Arial','', 9); // Dans boucle pour gérer multi-page $pdf->SetFont('Arial','', 9); // Dans boucle pour gérer multi-page
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC) if ($conf->fckeditor->enabled)
{ {
$pdf->writeHTMLCell(108, 4, $this->posxdesc-1, $curY, $libelleproduitservice, 0, 1); $pdf->writeHTMLCell(108, 4, $this->posxdesc-1, $curY, $libelleproduitservice, 0, 1);
} }
@ -662,7 +639,7 @@ class pdf_einstein extends ModelePDFCommandes
*/ */
function _pagehead(&$pdf, $com, $showadress=1, $outputlangs) function _pagehead(&$pdf, $com, $showadress=1, $outputlangs)
{ {
global $conf,$mysoc; global $conf;
$outputlangs->load("main"); $outputlangs->load("main");
$outputlangs->load("bills"); $outputlangs->load("bills");
@ -677,8 +654,8 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->SetXY($this->marge_gauche,$posy); $pdf->SetXY($this->marge_gauche,$posy);
// Logo // Logo
$logo=$conf->societe->dir_logos.'/'.$mysoc->logo; $logo=$conf->societe->dir_logos.'/'.$this->emetteur->logo;
if ($mysoc->logo) if ($this->emetteur->logo)
{ {
if (is_readable($logo)) if (is_readable($logo))
{ {
@ -739,28 +716,28 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->SetTextColor(0,0,60); $pdf->SetTextColor(0,0,60);
$pdf->SetFont('Arial','B',11); $pdf->SetFont('Arial','B',11);
if (defined("FAC_PDF_SOCIETE_NOM") && FAC_PDF_SOCIETE_NOM) $pdf->MultiCell(80, 4, FAC_PDF_SOCIETE_NOM, 0, 'L'); if (defined("FAC_PDF_SOCIETE_NOM") && FAC_PDF_SOCIETE_NOM) $pdf->MultiCell(80, 4, FAC_PDF_SOCIETE_NOM, 0, 'L');
else $pdf->MultiCell(80, 4, $mysoc->nom, 0, 'L'); else $pdf->MultiCell(80, 4, $this->emetteur->nom, 0, 'L');
// Caractéristiques emetteur // Caractéristiques emetteur
$carac_emetteur = ''; $carac_emetteur = '';
if (defined("FAC_PDF_ADRESSE") && FAC_PDF_ADRESSE) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).FAC_PDF_ADRESSE; if (defined("FAC_PDF_ADRESSE") && FAC_PDF_ADRESSE) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).FAC_PDF_ADRESSE;
else { else {
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$mysoc->adresse; $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$this->emetteur->adresse;
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$mysoc->cp.' '.$mysoc->ville; $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$this->emetteur->cp.' '.$this->emetteur->ville;
} }
$carac_emetteur .= "\n"; $carac_emetteur .= "\n";
// Tel // Tel
if (defined("FAC_PDF_TEL") && FAC_PDF_TEL) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->trans("Phone").": ".FAC_PDF_TEL; if (defined("FAC_PDF_TEL") && FAC_PDF_TEL) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->trans("Phone").": ".FAC_PDF_TEL;
elseif ($mysoc->tel) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->trans("Phone").": ".$mysoc->tel; elseif ($this->emetteur->tel) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->trans("Phone").": ".$this->emetteur->tel;
// Fax // Fax
if (defined("FAC_PDF_FAX") && FAC_PDF_FAX) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->trans("Fax").": ".FAC_PDF_FAX; if (defined("FAC_PDF_FAX") && FAC_PDF_FAX) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->trans("Fax").": ".FAC_PDF_FAX;
elseif ($mysoc->fax) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->trans("Fax").": ".$mysoc->fax; elseif ($this->emetteur->fax) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->trans("Fax").": ".$this->emetteur->fax;
// EMail // EMail
if (defined("FAC_PDF_MEL") && FAC_PDF_MEL) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->trans("Email").": ".FAC_PDF_MEL; if (defined("FAC_PDF_MEL") && FAC_PDF_MEL) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->trans("Email").": ".FAC_PDF_MEL;
elseif ($mysoc->email) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->trans("Email").": ".$mysoc->email; elseif ($this->emetteur->email) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->trans("Email").": ".$this->emetteur->email;
// Web // Web
if (defined("FAC_PDF_WWW") && FAC_PDF_WWW) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->trans("Web").": ".FAC_PDF_WWW; if (defined("FAC_PDF_WWW") && FAC_PDF_WWW) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->trans("Web").": ".FAC_PDF_WWW;
elseif ($mysoc->url) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->trans("Web").": ".$mysoc->url; elseif ($this->emetteur->url) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->trans("Web").": ".$this->emetteur->url;
$pdf->SetFont('Arial','',9); $pdf->SetFont('Arial','',9);
$pdf->SetXY($this->marge_gauche+2,$posy+8); $pdf->SetXY($this->marge_gauche+2,$posy+8);
@ -812,36 +789,36 @@ class pdf_einstein extends ModelePDFCommandes
// Premiere ligne d'info réglementaires // Premiere ligne d'info réglementaires
$ligne1=""; $ligne1="";
if ($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE) if ($this->emetteur->forme_juridique_code)
{ {
$ligne1.=($ligne1?" - ":"").$html->forme_juridique_name($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE); $ligne1.=($ligne1?" - ":"").$html->forme_juridique_name($this->emetteur->forme_juridique_code);
} }
if ($conf->global->MAIN_INFO_CAPITAL) if ($this->emetteur->capital)
{ {
$ligne1.=($ligne1?" - ":"").$outputlangs->trans("CapitalOf",$conf->global->MAIN_INFO_CAPITAL)." ".$outputlangs->trans("Currency".$conf->monnaie); $ligne1.=($ligne1?" - ":"").$outputlangs->trans("CapitalOf",$this->emetteur->capital)." ".$outputlangs->trans("Currency".$conf->monnaie);
} }
if ($conf->global->MAIN_INFO_SIRET) if ($this->emetteur->profid2)
{ {
$ligne1.=($ligne1?" - ":"").$outputlangs->transcountry("ProfId2",$this->emetteur->code_pays).": ".$conf->global->MAIN_INFO_SIRET; $ligne1.=($ligne1?" - ":"").$outputlangs->transcountry("ProfId2",$this->emetteur->pays_code).": ".$this->emetteur->profid2;
} }
if ($conf->global->MAIN_INFO_SIREN && (! $conf->global->MAIN_INFO_SIRET || $this->emetteur->code_pays != 'FR')) if ($this->emetteur->profid1 && (! $this->emetteur->profid2 || $this->emetteur->pays_code != 'FR'))
{ {
$ligne1.=($ligne1?" - ":"").$outputlangs->transcountry("ProfId1",$this->emetteur->code_pays).": ".$conf->global->MAIN_INFO_SIREN; $ligne1.=($ligne1?" - ":"").$outputlangs->transcountry("ProfId1",$this->emetteur->pays_code).": ".$this->emetteur->profid1;
}
if ($conf->global->MAIN_INFO_APE)
{
$ligne1.=($ligne1?" - ":"").$outputlangs->transcountry("ProfId3",$this->emetteur->code_pays).": ".MAIN_INFO_APE;
} }
// Deuxieme ligne d'info réglementaires // Deuxieme ligne d'info réglementaires
$ligne2=""; $ligne2="";
if ($conf->global->MAIN_INFO_RCS) if ($this->emetteur->profid3)
{ {
$ligne2.=($ligne2?" - ":"").$outputlangs->transcountry("ProfId4",$this->emetteur->code_pays).": ".$conf->global->MAIN_INFO_RCS; $ligne2.=($ligne1?" - ":"").$outputlangs->transcountry("ProfId3",$this->emetteur->pays_code).": ".$this->emetteur->profid3;
} }
if ($conf->global->MAIN_INFO_TVAINTRA != '') if ($this->emetteur->profid4)
{ {
$ligne2.=($ligne2?" - ":"").$outputlangs->trans("VATIntraShort").": ".$conf->global->MAIN_INFO_TVAINTRA; $ligne2.=($ligne2?" - ":"").$outputlangs->transcountry("ProfId4",$this->emetteur->pays_code).": ".$this->emetteur->profid4;
}
if ($this->emetteur->tva_intra != '')
{
$ligne2.=($ligne2?" - ":"").$outputlangs->trans("VATIntraShort").": ".$this->emetteur->tva_intra;
} }
$pdf->SetFont('Arial','',8); $pdf->SetFont('Arial','',8);
@ -873,4 +850,17 @@ class pdf_einstein extends ModelePDFCommandes
} }
// Cette fonction est appelée pour coder ou non une chaine en html
// selon qu'on compte l'afficher dans le PDF avec:
// writeHTMLCell -> a besoin d'etre encodé en HTML
// MutliCell -> ne doit pas etre encodé en HTML
function _dol_htmlentities($stringtoencode,$isstringalreadyhtml)
{
global $conf;
if ($isstringalreadyhtml) return $stringtoencode;
if ($conf->fckeditor->enabled) return htmlentities($stringtoencode);
return $stringtoencode;
}
?> ?>

View File

@ -214,11 +214,11 @@ class pdf_crabe extends ModelePDFFactures
$curY = $nexY; $curY = $nexY;
// Description de la ligne produit // Description de la ligne produit
$libelleproduitservice=$fac->lignes[$i]->libelle; $libelleproduitservice=_dol_htmlentities($fac->lignes[$i]->libelle,0);
if ($fac->lignes[$i]->desc&&$fac->lignes[$i]->desc!=$fac->lignes[$i]->libelle) if ($fac->lignes[$i]->desc&&$fac->lignes[$i]->desc!=$fac->lignes[$i]->libelle)
{ {
if ($libelleproduitservice) $libelleproduitservice.="\n"; if ($libelleproduitservice) $libelleproduitservice.="\n";
$libelleproduitservice.=$fac->lignes[$i]->desc; $libelleproduitservice.=_dol_htmlentities($fac->lignes[$i]->desc,$conf->global->FCKEDITOR_ENABLE_DETAILS);
} }
// Si ligne associée à un code produit // Si ligne associée à un code produit
if ($fac->lignes[$i]->produit_id) if ($fac->lignes[$i]->produit_id)
@ -254,7 +254,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetFont('Arial','', 9); // Dans boucle pour gérer multi-page $pdf->SetFont('Arial','', 9); // Dans boucle pour gérer multi-page
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC) if ($conf->fckeditor->enabled)
{ {
$pdf->writeHTMLCell(108, 4, $this->posxdesc-1, $curY, $libelleproduitservice, 0, 1); $pdf->writeHTMLCell(108, 4, $this->posxdesc-1, $curY, $libelleproduitservice, 0, 1);
} }
@ -961,4 +961,17 @@ class pdf_crabe extends ModelePDFFactures
} }
// Cette fonction est appelée pour coder ou non une chaine en html
// selon qu'on compte l'afficher dans le PDF avec:
// writeHTMLCell -> a besoin d'etre encodé en HTML
// MutliCell -> ne doit pas etre encodé en HTML
function _dol_htmlentities($stringtoencode,$isstringalreadyhtml)
{
global $conf;
if ($isstringalreadyhtml) return $stringtoencode;
if ($conf->fckeditor->enabled) return htmlentities($stringtoencode);
return $stringtoencode;
}
?> ?>

View File

@ -213,18 +213,19 @@ class pdf_propale_azur extends ModelePDFPropales
$curY = $nexY; $curY = $nexY;
// Description de la ligne produit // Description de la ligne produit
$libelleproduitservice=$propale->lignes[$i]->libelle; $libelleproduitservice=_dol_htmlentities($propale->lignes[$i]->libelle,0);
if ($propale->lignes[$i]->desc&&$propale->lignes[$i]->desc!=$propale->lignes[$i]->libelle) if ($propale->lignes[$i]->desc && $propale->lignes[$i]->desc!=$propale->lignes[$i]->libelle)
{ {
if ($libelleproduitservice) $libelleproduitservice.="\n"; if ($libelleproduitservice) $libelleproduitservice.="\n";
$libelleproduitservice.=$propale->lignes[$i]->desc; $libelleproduitservice.=_dol_htmlentities($propale->lignes[$i]->desc,$conf->global->FCKEDITOR_ENABLE_DETAILS);
} }
// Si ligne associée à un code produit // Si ligne associée à un code produit
if ($propale->lignes[$i]->fk_product) if ($propale->lignes[$i]->fk_product)
{ {
$prodser = new Product($this->db); $prodser = new Product($this->db);
$prodser->fetch($propale->lignes[$i]->fk_product); $prodser->fetch($propale->lignes[$i]->fk_product);
// On ajoute la ref
if ($prodser->ref) if ($prodser->ref)
{ {
$prefix_prodserv = ""; $prefix_prodserv = "";
@ -236,10 +237,10 @@ class pdf_propale_azur extends ModelePDFPropales
$libelleproduitservice=$prefix_prodserv.$prodser->ref." - ".$libelleproduitservice; $libelleproduitservice=$prefix_prodserv.$prodser->ref." - ".$libelleproduitservice;
} }
// Ajoute description du produit // Ajoute description complète du produit
if ($conf->global->PROP_ADD_PROD_DESC && !$conf->global->PRODUIT_CHANGE_PROD_DESC) if ($conf->global->PROP_ADD_PROD_DESC && !$conf->global->PRODUIT_CHANGE_PROD_DESC)
{ {
if ($propale->lignes[$i]->product_desc&&$propale->lignes[$i]->product_desc!=$propale->lignes[$i]->libelle&&$propale->lignes[$i]->product_desc!=$propale->lignes[$i]->desc) if ($propale->lignes[$i]->product_desc && $propale->lignes[$i]->product_desc!=$propale->lignes[$i]->libelle && $propale->lignes[$i]->product_desc!=$propale->lignes[$i]->desc)
{ {
if ($libelleproduitservice) $libelleproduitservice.="\n"; if ($libelleproduitservice) $libelleproduitservice.="\n";
$libelleproduitservice.=$propale->lignes[$i]->product_desc; $libelleproduitservice.=$propale->lignes[$i]->product_desc;
@ -254,15 +255,15 @@ class pdf_propale_azur extends ModelePDFPropales
$pdf->SetFont('Arial','', 9); // Dans boucle pour gérer multi-page $pdf->SetFont('Arial','', 9); // Dans boucle pour gérer multi-page
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC) if ($conf->fckeditor->enabled)
{ {
$pdf->writeHTMLCell(108, 4, $this->posxdesc-1, $curY, $libelleproduitservice, 0, 1); $pdf->writeHTMLCell(108, 4, $this->posxdesc-1, $curY, $libelleproduitservice, 0, 1);
} }
else else
{ {
$pdf->SetXY ($this->posxdesc-1, $curY); $pdf->SetXY ($this->posxdesc-1, $curY);
$pdf->MultiCell(108, 4, $libelleproduitservice, 0, 'J'); $pdf->MultiCell(108, 4, $libelleproduitservice, 0, 'J');
} }
$nexY = $pdf->GetY(); $nexY = $pdf->GetY();
@ -867,4 +868,17 @@ class pdf_propale_azur extends ModelePDFPropales
} }
// Cette fonction est appelée pour coder ou non une chaine en html
// selon qu'on compte l'afficher dans le PDF avec:
// writeHTMLCell -> a besoin d'etre encodé en HTML
// MutliCell -> ne doit pas etre encodé en HTML
function _dol_htmlentities($stringtoencode,$isstringalreadyhtml)
{
global $conf;
if ($isstringalreadyhtml) return $stringtoencode;
if ($conf->fckeditor->enabled) return htmlentities($stringtoencode);
return $stringtoencode;
}
?> ?>

View File

@ -529,5 +529,6 @@ DeliveryOrderModel=Products deliveries receipt model
DeliveriesOrderAbility=Products deliveries receipt ability DeliveriesOrderAbility=Products deliveries receipt ability
##### FCKeditor ##### ##### FCKeditor #####
ActivateFCKeditor=Activate FCKeditor for: ActivateFCKeditor=Activate FCKeditor for:
FCKeditorForProductDescription=Creation/edition of products/services description (in all modules) FCKeditorForProductDescription=WYSIWIG creation/edition of products/services description and note
FCKeditorForMailing=Creation/edition mailings FCKeditorForDetails=WYSIWIG creation/edition of details lines for all entities (proposals, orders, invoices, etc...)
FCKeditorForMailing=WYSIWIG creation/edition of mailings

View File

@ -529,5 +529,6 @@ DeliveryOrderModel=Mod
DeliveriesOrderAbility=Prise en charge des bons de réception client DeliveriesOrderAbility=Prise en charge des bons de réception client
##### FCKeditor ##### ##### FCKeditor #####
ActivateFCKeditor=Activer FCKeditor pour : ActivateFCKeditor=Activer FCKeditor pour :
FCKeditorForProductDescription=Création/édition de la description des produits/services (dans tous les modules) FCKeditorForProductDescription=Création/édition WYSIWIG de la description et note des produits/services
FCKeditorForMailing=Création/édition des mailings FCKeditorForDetails=Création/édition WYSIWIG des lignes details des entités (commandes, propales, factures, etc...)
FCKeditorForMailing=Création/édition WYSIWIG des mailings

View File

@ -451,18 +451,19 @@ if ($_GET["action"] == 'create' && $user->rights->produit->creer)
// Description // Description
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>'; print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>';
if ($conf->fckeditor->enabled) if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC)
{ {
require_once(DOL_DOCUMENT_ROOT."/includes/fckeditor/fckeditor.php"); require_once(DOL_DOCUMENT_ROOT."/includes/fckeditor/fckeditor.php");
$oFCKeditor = new FCKeditor('desc'); $oFCKeditor = new FCKeditor('desc');
$oFCKeditor->Create() ; $oFCKeditor->Create() ;
} }
else else
{ {
print '<textarea name="desc" rows="4" cols="50">'; print '<textarea name="desc" rows="4" cols="50">';
} print '</textarea>';
}
print "</textarea></td></tr>"; print "</td></tr>";
if ($_GET["type"] == 1) if ($_GET["type"] == 1)
{ {
@ -475,9 +476,19 @@ if ($_GET["action"] == 'create' && $user->rights->produit->creer)
} }
// Note // Note
print '<tr><td valign="top">'.$langs->trans("Note").'</td><td>'; print '<tr><td valign="top">'.$langs->trans("NoteNotVisibleOnBill").'</td><td>';
print '<textarea name="note" rows="8" cols="50">'; if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC)
print "</textarea></td></tr>"; {
require_once(DOL_DOCUMENT_ROOT."/includes/fckeditor/fckeditor.php");
$oFCKeditor = new FCKeditor('note');
$oFCKeditor->Create() ;
}
else
{
print '<textarea name="note" rows="8" cols="50">';
print '</textarea>';
}
print "</td></tr>";
print '<tr><td colspan="3" align="center"><input type="submit" class="button" value="'.$langs->trans("Create").'"></td></tr>'; print '<tr><td colspan="3" align="center"><input type="submit" class="button" value="'.$langs->trans("Create").'"></td></tr>';
print '</table>'; print '</table>';
@ -765,7 +776,7 @@ if ($_GET["id"] || $_GET["ref"])
// Description // Description
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td colspan="2">'; print '<tr><td valign="top">'.$langs->trans("Description").'</td><td colspan="2">';
print "\n"; print "\n";
if ($conf->fckeditor->enabled) if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC)
{ {
require_once(DOL_DOCUMENT_ROOT."/includes/fckeditor/fckeditor.php"); require_once(DOL_DOCUMENT_ROOT."/includes/fckeditor/fckeditor.php");
$oFCKeditor = new FCKeditor('desc'); $oFCKeditor = new FCKeditor('desc');
@ -777,8 +788,8 @@ if ($_GET["id"] || $_GET["ref"])
print '<textarea name="desc" rows="4" cols="50">'; print '<textarea name="desc" rows="4" cols="50">';
print $product->description; print $product->description;
print "</textarea>"; print "</textarea>";
print "</td></tr>";
} }
print "</td></tr>";
print "\n"; print "\n";
if ($product->type == 1) if ($product->type == 1)
@ -798,9 +809,21 @@ if ($_GET["id"] || $_GET["ref"])
// Note // Note
print '<tr><td valign="top">'.$langs->trans("NoteNotVisibleOnBill").'</td><td colspan="2">'; print '<tr><td valign="top">'.$langs->trans("NoteNotVisibleOnBill").'</td><td colspan="2">';
print '<textarea name="note" rows="8" cols="50">'; if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC)
print $product->note; {
print "</textarea></td></tr>"; require_once(DOL_DOCUMENT_ROOT."/includes/fckeditor/fckeditor.php");
$oFCKeditor = new FCKeditor('note');
$oFCKeditor->Value = $product->note;
$oFCKeditor->Create() ;
}
else
{
print '<textarea name="note" rows="8" cols="50">';
print $product->description;
print "</textarea>";
}
print "</td></tr>";
print '<tr><td colspan="3" align="center"><input type="submit" class="button" value="'.$langs->trans("Save").'">&nbsp;'; print '<tr><td colspan="3" align="center"><input type="submit" class="button" value="'.$langs->trans("Save").'">&nbsp;';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></td></tr>'; print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></td></tr>';
print '</table>'; print '</table>';