';
- print '| '.$langs->trans('DateEndPropal').' | ';
+ print ' | '.$langs->trans('DateEndPropal').' | ';
if ($propal->fin_validite)
{
print dolibarr_print_date($propal->fin_validite,'%a %d %B %Y');
diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php
index f8bc418b3b6..d3f903ac721 100644
--- a/htdocs/commande/fiche.php
+++ b/htdocs/commande/fiche.php
@@ -1353,7 +1353,7 @@ else
print ' ';
}
// é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");
$oFCKeditor = new FCKeditor('eldesc');
diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index 21afb5dceea..327c95efbe7 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -1896,7 +1896,7 @@ else
print ' ';
}
// é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");
$oFCKeditor = new FCKeditor('desc');
diff --git a/htdocs/includes/modules/commande/pdf_einstein.modules.php b/htdocs/includes/modules/commande/pdf_einstein.modules.php
index dd47005d39f..2a34bdce6bd 100644
--- a/htdocs/includes/modules/commande/pdf_einstein.modules.php
+++ b/htdocs/includes/modules/commande/pdf_einstein.modules.php
@@ -40,6 +40,8 @@ require_once(DOL_DOCUMENT_ROOT."/product.class.php");
class pdf_einstein extends ModelePDFCommandes
{
+ var $emetteur; // Objet societe qui emet
+
/**
\brief Constructeur
@@ -47,7 +49,7 @@ class pdf_einstein extends ModelePDFCommandes
*/
function pdf_einstein($db)
{
- global $conf,$langs;
+ global $conf,$langs,$mysoc;
$this->db = $db;
$this->name = "einstein";
@@ -72,21 +74,9 @@ class pdf_einstein extends ModelePDFCommandes
if (defined("FACTURE_TVAOPTION") && FACTURE_TVAOPTION == 'franchise')
$this->franchise=1;
- // Recupere code pays de l'emmetteur
- $this->emetteur->code_pays=substr($langs->defaultlang,-2); // Par defaut, si on trouve pas
- $sql = "SELECT code from ".MAIN_DB_PREFIX."c_pays";
- $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();
+ // Recupere emmetteur
+ $this->emetteur=$mysoc;
+ if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // Par defaut, si n'était pas défini
// Defini position des colonnes
$this->posxdesc=$this->marge_gauche+1;
@@ -96,6 +86,7 @@ class pdf_einstein extends ModelePDFCommandes
$this->posxdiscount=162;
$this->postotalht=177;
+ $this->tva=array();
$this->atleastoneratenotnull=0;
$this->atleastonediscount=0;
}
@@ -113,20 +104,6 @@ class pdf_einstein extends ModelePDFCommandes
\brief Fonction générant la commande sur le disque
\param id Id de la commande à générer
\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='')
{
@@ -218,11 +195,11 @@ class pdf_einstein extends ModelePDFCommandes
$curY = $nexY;
// 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 ($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
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
- if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC)
+ if ($conf->fckeditor->enabled)
{
$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)
{
- global $conf,$mysoc;
+ global $conf;
$outputlangs->load("main");
$outputlangs->load("bills");
@@ -677,8 +654,8 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->SetXY($this->marge_gauche,$posy);
// Logo
- $logo=$conf->societe->dir_logos.'/'.$mysoc->logo;
- if ($mysoc->logo)
+ $logo=$conf->societe->dir_logos.'/'.$this->emetteur->logo;
+ if ($this->emetteur->logo)
{
if (is_readable($logo))
{
@@ -739,28 +716,28 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->SetTextColor(0,0,60);
$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');
- else $pdf->MultiCell(80, 4, $mysoc->nom, 0, 'L');
+ else $pdf->MultiCell(80, 4, $this->emetteur->nom, 0, 'L');
// Caractéristiques emetteur
$carac_emetteur = '';
if (defined("FAC_PDF_ADRESSE") && FAC_PDF_ADRESSE) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).FAC_PDF_ADRESSE;
else {
- $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$mysoc->adresse;
- $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$mysoc->cp.' '.$mysoc->ville;
+ $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$this->emetteur->adresse;
+ $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$this->emetteur->cp.' '.$this->emetteur->ville;
}
$carac_emetteur .= "\n";
// 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
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
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
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->SetXY($this->marge_gauche+2,$posy+8);
@@ -812,36 +789,36 @@ class pdf_einstein extends ModelePDFCommandes
// Premiere ligne d'info réglementaires
$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;
- }
- if ($conf->global->MAIN_INFO_APE)
- {
- $ligne1.=($ligne1?" - ":"").$outputlangs->transcountry("ProfId3",$this->emetteur->code_pays).": ".MAIN_INFO_APE;
+ $ligne1.=($ligne1?" - ":"").$outputlangs->transcountry("ProfId1",$this->emetteur->pays_code).": ".$this->emetteur->profid1;
}
// Deuxieme ligne d'info réglementaires
$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);
@@ -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;
+}
+
?>
diff --git a/htdocs/includes/modules/facture/pdf_crabe.modules.php b/htdocs/includes/modules/facture/pdf_crabe.modules.php
index 28a3ce29e9f..7a92caebe4b 100644
--- a/htdocs/includes/modules/facture/pdf_crabe.modules.php
+++ b/htdocs/includes/modules/facture/pdf_crabe.modules.php
@@ -214,11 +214,11 @@ class pdf_crabe extends ModelePDFFactures
$curY = $nexY;
// 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 ($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
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
- if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC)
+ if ($conf->fckeditor->enabled)
{
$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;
+}
+
?>
diff --git a/htdocs/includes/modules/propale/pdf_propale_azur.modules.php b/htdocs/includes/modules/propale/pdf_propale_azur.modules.php
index 3f5d2f240f8..852530f6b1c 100644
--- a/htdocs/includes/modules/propale/pdf_propale_azur.modules.php
+++ b/htdocs/includes/modules/propale/pdf_propale_azur.modules.php
@@ -213,18 +213,19 @@ class pdf_propale_azur extends ModelePDFPropales
$curY = $nexY;
// Description de la ligne produit
- $libelleproduitservice=$propale->lignes[$i]->libelle;
- if ($propale->lignes[$i]->desc&&$propale->lignes[$i]->desc!=$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 ($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
if ($propale->lignes[$i]->fk_product)
{
$prodser = new Product($this->db);
-
$prodser->fetch($propale->lignes[$i]->fk_product);
+
+ // On ajoute la ref
if ($prodser->ref)
{
$prefix_prodserv = "";
@@ -236,10 +237,10 @@ class pdf_propale_azur extends ModelePDFPropales
$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 ($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";
$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
- if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC)
- {
- $pdf->writeHTMLCell(108, 4, $this->posxdesc-1, $curY, $libelleproduitservice, 0, 1);
- }
- else
- {
- $pdf->SetXY ($this->posxdesc-1, $curY);
- $pdf->MultiCell(108, 4, $libelleproduitservice, 0, 'J');
- }
+ if ($conf->fckeditor->enabled)
+ {
+ $pdf->writeHTMLCell(108, 4, $this->posxdesc-1, $curY, $libelleproduitservice, 0, 1);
+ }
+ else
+ {
+ $pdf->SetXY ($this->posxdesc-1, $curY);
+ $pdf->MultiCell(108, 4, $libelleproduitservice, 0, 'J');
+ }
$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;
+}
+
?>
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index 69b14ffe62e..a8c33e4991d 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -529,5 +529,6 @@ DeliveryOrderModel=Products deliveries receipt model
DeliveriesOrderAbility=Products deliveries receipt ability
##### FCKeditor #####
ActivateFCKeditor=Activate FCKeditor for:
-FCKeditorForProductDescription=Creation/edition of products/services description (in all modules)
-FCKeditorForMailing=Creation/edition mailings
\ No newline at end of file
+FCKeditorForProductDescription=WYSIWIG creation/edition of products/services description and note
+FCKeditorForDetails=WYSIWIG creation/edition of details lines for all entities (proposals, orders, invoices, etc...)
+FCKeditorForMailing=WYSIWIG creation/edition of mailings
diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang
index 6f14493d48b..0e8adc13581 100644
--- a/htdocs/langs/fr_FR/admin.lang
+++ b/htdocs/langs/fr_FR/admin.lang
@@ -529,5 +529,6 @@ DeliveryOrderModel=Mod
DeliveriesOrderAbility=Prise en charge des bons de réception client
##### FCKeditor #####
ActivateFCKeditor=Activer FCKeditor pour :
-FCKeditorForProductDescription=Création/édition de la description des produits/services (dans tous les modules)
-FCKeditorForMailing=Création/édition des mailings
\ No newline at end of file
+FCKeditorForProductDescription=Création/édition WYSIWIG de la description et note des produits/services
+FCKeditorForDetails=Création/édition WYSIWIG des lignes details des entités (commandes, propales, factures, etc...)
+FCKeditorForMailing=Création/édition WYSIWIG des mailings
diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php
index 46f4182153f..8a51a1e0378 100644
--- a/htdocs/product/fiche.php
+++ b/htdocs/product/fiche.php
@@ -451,18 +451,19 @@ if ($_GET["action"] == 'create' && $user->rights->produit->creer)
// Description
print ' |