diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php
index 660e9f8cc19..4cfd0bebc61 100644
--- a/htdocs/comm/propal.php
+++ b/htdocs/comm/propal.php
@@ -622,9 +622,9 @@ if ($_POST['action'] == "addligne" && $user->rights->propale->creer)
$tva_npr = get_default_npr($mysoc,$propal->client,$prod->tva_tx);
// On defini prix unitaire
- if ($conf->global->PRODUIT_MULTIPRICES)
+ if ($conf->global->PRODUIT_MULTIPRICES && isset($prod->multiprices_base_type[$propal->client->price_level]))
{
- $pu_ht = $prod->multiprices[$propal->client->price_level];
+ $pu_ht = $prod->multiprices[$propal->client->price_level];
$pu_ttc = $prod->multiprices_ttc[$propal->client->price_level];
$price_base_type = $prod->multiprices_base_type[$propal->client->price_level];
}
diff --git a/htdocs/commande/commande.class.php b/htdocs/commande/commande.class.php
index 6bc06e30eeb..a0fb4ef1536 100644
--- a/htdocs/commande/commande.class.php
+++ b/htdocs/commande/commande.class.php
@@ -1043,10 +1043,8 @@ class Commande extends CommonObject
$ligne->product_desc = $objp->product_desc; // Description produit
$ligne->fk_product_type = $objp->fk_product_type; // Produit ou service
- // Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
- // Save the start and end date of the line in the object
- $ligne->date_start = $this->db->idate($objp->date_start);
- $ligne->date_end = $this->db->idate($objp->date_end);
+ $ligne->date_start = $this->db->jdate($objp->date_start);
+ $ligne->date_end = $this->db->jdate($objp->date_end);
$this->lignes[$i] = $ligne;
$i++;
diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php
index 4138e517ba6..f1999925d3e 100644
--- a/htdocs/commande/fiche.php
+++ b/htdocs/commande/fiche.php
@@ -300,6 +300,7 @@ if ($_POST['action'] == 'addligne' && $user->rights->commande->creer)
}
$ret=$commande->fetch_client();
+ // Clean parameters
$suffixe = $_POST['idprod'] ? '_prod' : '';
$date_start=dolibarr_mktime(0, 0, 0, $_POST['date_start'.$suffixe.'month'], $_POST['date_start'.$suffixe.'day'], $_POST['date_start'.$suffixe.'year']);
$date_end=dolibarr_mktime(0, 0, 0, $_POST['date_end'.$suffixe.'month'], $_POST['date_end'.$suffixe.'day'], $_POST['date_end'.$suffixe.'year']);
@@ -355,6 +356,7 @@ if ($_POST['action'] == 'addligne' && $user->rights->commande->creer)
$tva_npr=eregi('\*',$_POST['tva_tx'])?1:0;
$desc=$_POST['dp_desc'];
}
+ $desc=dol_htmlcleanlastbr($desc);
$info_bits=0;
if ($tva_npr) $info_bits |= 0x01;
@@ -408,6 +410,8 @@ if ($_POST['action'] == 'updateligne' && $user->rights->commande->creer && $_POS
$commande = new Commande($db,'',$_POST['id']);
if (! $commande->fetch($_POST['id']) > 0) dolibarr_print_error($db);
+ // Clean parameters
+ $description=dol_htmlcleanlastbr($_POST['eldesc']);
$date_start=dolibarr_mktime(0, 0, 0, $_POST['date_start'.$suffixe.'month'], $_POST['date_start'.$suffixe.'day'], $_POST['date_start'.$suffixe.'year']);
$date_end=dolibarr_mktime(0, 0, 0, $_POST['date_end'.$suffixe.'month'], $_POST['date_end'.$suffixe.'day'], $_POST['date_end'.$suffixe.'year']);
@@ -426,7 +430,7 @@ if ($_POST['action'] == 'updateligne' && $user->rights->commande->creer && $_POS
else
{
$result = $commande->updateline($_POST['elrowid'],
- $_POST['eldesc'],
+ $description,
$_POST['pu'],
$_POST['qty'],
$_POST['elremise_percent'],
@@ -1505,7 +1509,7 @@ else
print nl2br($objp->description);
// Updated by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
// Print the start and end dates
- print_date_range($objp->date_start,$objp->date_end,'dayhour');
+ print_date_range($objp->date_start,$objp->date_end);
}
print '';
}
diff --git a/htdocs/compta/paiement/rapport.php b/htdocs/compta/paiement/rapport.php
index 5a15b7d68d3..3cc96c8f9f1 100644
--- a/htdocs/compta/paiement/rapport.php
+++ b/htdocs/compta/paiement/rapport.php
@@ -73,7 +73,7 @@ if ($_POST["action"] == 'gen')
dolibarr_syslog("Erreur dans commande_pdf_create");
dolibarr_print_error($db,$obj->pdferror());
}
-
+
$year = $_POST["reyear"];
}
@@ -127,6 +127,7 @@ print '
';
clearstatcache();
// Affiche lien sur autres années
+$linkforyear=array();
$found=0;
if (is_dir($dir))
{
diff --git a/htdocs/includes/modules/action/rapport.pdf.php b/htdocs/includes/modules/action/rapport.pdf.php
index e83ed1a6e28..7b7e89bca4e 100644
--- a/htdocs/includes/modules/action/rapport.pdf.php
+++ b/htdocs/includes/modules/action/rapport.pdf.php
@@ -197,7 +197,7 @@ class CommActionRapport
$y++;
$pdf->SetXY($this->marge_gauche, $y);
- $pdf->MultiCell(22, $height, dolibarr_print_date($obj->dp,"day")."\n".dolibarr_print_date($obj->dp,"hour"), 0, 'L', 0);
+ $pdf->MultiCell(22, $height, dol_print_date($obj->dp,"day")."\n".dolibarr_print_date($obj->dp,"hour"), 0, 'L', 0);
$y0 = $pdf->GetY();
$pdf->SetXY(26, $y);
diff --git a/htdocs/includes/modules/cheque/pdf/pdf_blochet.class.php b/htdocs/includes/modules/cheque/pdf/pdf_blochet.class.php
index 9294d3ef524..3173b9c16f5 100644
--- a/htdocs/includes/modules/cheque/pdf/pdf_blochet.class.php
+++ b/htdocs/includes/modules/cheque/pdf/pdf_blochet.class.php
@@ -201,7 +201,7 @@ class BordereauChequeBlochet extends FPDF
$pdf->Text(32, 19, $this->number);
$pdf->SetFont('Arial','B',10);
- $pdf->Text(32, 27, dolibarr_print_date($this->date,"day",false,$outputlangs));
+ $pdf->Text(32, 27, dol_print_date($this->date,"day",false,$outputlangs));
$pdf->SetFont('Arial','',10);
diff --git a/htdocs/includes/modules/commande/pdf_edison.modules.php b/htdocs/includes/modules/commande/pdf_edison.modules.php
index fd8de4f8c8f..4d1c1726366 100644
--- a/htdocs/includes/modules/commande/pdf_edison.modules.php
+++ b/htdocs/includes/modules/commande/pdf_edison.modules.php
@@ -441,7 +441,7 @@ class pdf_edison extends ModelePDFCommandes
$pdf->SetTextColor(200,0,0);
$pdf->SetFont('Arial','B',12);
- $pdf->Text(11, 88, $outputlangs->transnoentities("Date")." : " . dolibarr_print_date($com->date,'day',false,$outputlangs));
+ $pdf->Text(11, 88, $outputlangs->transnoentities("Date")." : " . dol_print_date($com->date,'day',false,$outputlangs));
$pdf->Text(11, 94, $outputlangs->transnoentities("Order")." ".$outputlangs->convToOutputCharset($com->ref));
}
diff --git a/htdocs/includes/modules/commande/pdf_einstein.modules.php b/htdocs/includes/modules/commande/pdf_einstein.modules.php
index 45b58c7706b..e7d5431ab9f 100644
--- a/htdocs/includes/modules/commande/pdf_einstein.modules.php
+++ b/htdocs/includes/modules/commande/pdf_einstein.modules.php
@@ -132,7 +132,7 @@ class pdf_einstein extends ModelePDFCommandes
}
$deja_regle = "";
- // D�finition de $dir et $file
+ // Definition de $dir et $file
if ($com->specimen)
{
$dir = $conf->commande->dir_output;
@@ -776,7 +776,7 @@ class pdf_einstein extends ModelePDFCommandes
$posy+=5;
$pdf->SetXY(100,$posy);
$pdf->SetTextColor(0,0,60);
- $pdf->MultiCell(100, 4, $outputlangs->transnoentities("OrderDate")." : " . dolibarr_print_date($object->date,"%d %b %Y",false,$outputlangs), '', 'R');
+ $pdf->MultiCell(100, 4, $outputlangs->transnoentities("OrderDate")." : " . dol_print_date($object->date,"%d %b %Y",false,$outputlangs,true), '', 'R');
if ($showadress)
{
diff --git a/htdocs/includes/modules/dons/html_cerfafr.modules.php b/htdocs/includes/modules/dons/html_cerfafr.modules.php
index f716c976955..b2b646f08c0 100644
--- a/htdocs/includes/modules/dons/html_cerfafr.modules.php
+++ b/htdocs/includes/modules/dons/html_cerfafr.modules.php
@@ -55,7 +55,7 @@ class html_cerfafr extends ModeleDon
\brief Renvoi derni�re erreur
\return string Derni�re erreur
*/
- function pdferror()
+ function pdferror()
{
return $this->error;
}
@@ -68,24 +68,26 @@ class html_cerfafr extends ModeleDon
{
return true;
}
-
-
+
+
/**
- \brief Fonction g�n�rant le recu sur le disque
- \param id Id du recu � g�n�rer
+ \brief Fonction generant le recu sur le disque
+ \param id Id du recu a generer
\return int >0 si ok, <0 si ko
*/
function write_file($don,$outputlangs)
{
global $user,$conf,$langs,$mysoc;
+ $now=gmmktime();
+
if (! is_object($outputlangs)) $outputlangs=$langs;
-
+
$langs->load("main");
-
+
if ($conf->don->dir_output)
{
- // D�finition de l'objet $don (pour compatibilite ascendante)
+ // Definition de l'objet $don (pour compatibilite ascendante)
if (! is_object($don))
{
$id = $don;
@@ -93,7 +95,7 @@ class html_cerfafr extends ModeleDon
$ret=$don->fetch($id);
}
- // D�finition de $dir et $file
+ // Definition de $dir et $file
if ($don->specimen)
{
$dir = $conf->don->dir_output;
@@ -105,7 +107,7 @@ class html_cerfafr extends ModeleDon
$dir = $conf->don->dir_output . "/" . get_exdir($donref,2);
$file = $dir . "/" . $donref . ".html";
}
-
+
if (! file_exists($dir))
{
if (create_exdir($dir) < 0)
@@ -114,17 +116,17 @@ class html_cerfafr extends ModeleDon
return -1;
}
}
-
+
if (file_exists($dir))
{
// Defini contenu
$donmodel=DOL_DOCUMENT_ROOT ."/includes/modules/dons/html_cerfafr.html";
$html = implode('', file($donmodel));
$html = eregi_replace('__REF__',$id,$html);
- $html = eregi_replace('__DATE__',dolibarr_print_date($don->date,'',false,$outputlangs),$html);
+ $html = eregi_replace('__DATE__',dol_print_date($don->date,'day',false,$outputlangs),$html);
$html = eregi_replace('__IP__',$user->ip,$html);
$html = eregi_replace('__AMOUNT__',$don->amount,$html);
- $html = eregi_replace('__CURRENCY__',$outputlangs->trans("Currency".$conf->monnaie),$html);
+ $html = eregi_replace('__CURRENCY__',$outputlangs->transnoconv("Currency".$conf->monnaie),$html);
$html = eregi_replace('__CURRENCYCODE__',$conf->monnaie,$html);
$html = eregi_replace('__MAIN_INFO_SOCIETE_NOM__',$mysoc->nom,$html);
$html = eregi_replace('__MAIN_INFO_SOCIETE_ADRESSE__',$mysoc->adresse,$html);
@@ -135,16 +137,16 @@ class html_cerfafr extends ModeleDon
$html = eregi_replace('__DONATOR_ZIP__',$don->cp,$html);
$html = eregi_replace('__DONATOR_TOWN__',$don->ville,$html);
$html = eregi_replace('__PAYMENTMODE_LIB__ ',$don->modepaiement,$html);
- $html = eregi_replace('__NOW__',dolibarr_print_date(time(),'',false,$outputlangs),$html);
-
+ $html = eregi_replace('__NOW__',dol_print_date($now,'',false,$outputlangs),$html);
+
// Sauve fichier sur disque
dolibarr_syslog("html_cerfafr::write_file $file");
- $handle=fopen($file,"w");
+ $handle=fopen($file,"w");
fwrite($handle,$html);
fclose($handle);
- if (! empty($conf->global->MAIN_UMASK))
+ if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
-
+
return 1;
}
else
@@ -163,7 +165,7 @@ class html_cerfafr extends ModeleDon
$this->error=$langs->trans("ErrorUnknown");
$langs->setPhpLang(); // On restaure langue session
return 0; // Erreur par defaut
-
+
}
}
diff --git a/htdocs/includes/modules/expedition/pdf/pdf_expedition_merou.modules.php b/htdocs/includes/modules/expedition/pdf/pdf_expedition_merou.modules.php
index 493ff28ea73..9e5e2714510 100644
--- a/htdocs/includes/modules/expedition/pdf/pdf_expedition_merou.modules.php
+++ b/htdocs/includes/modules/expedition/pdf/pdf_expedition_merou.modules.php
@@ -407,7 +407,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition
$pdf->SetXY($blSocX,$blSocY+20);
$pdf->SetFont('Arial','B',8);
$pdf->SetTextColor(0,0,0);
- $pdf->MultiCell(50, 8, $outputlangs->transnoentities("Date")." : " . dolibarr_print_date($exp->date,'day',false,$outputlangs), '' , 'L');
+ $pdf->MultiCell(50, 8, $outputlangs->transnoentities("Date")." : " . dol_print_date($exp->date,'day',false,$outputlangs,true), '' , 'L');
//Date Expedition
$pdf->SetXY($blSocX2,$blSocY+20);
$pdf->SetFont('Arial','B',8);
diff --git a/htdocs/includes/modules/expedition/pdf/pdf_expedition_rouget.modules.php b/htdocs/includes/modules/expedition/pdf/pdf_expedition_rouget.modules.php
index 60e6c9a276e..b723ad69c22 100644
--- a/htdocs/includes/modules/expedition/pdf/pdf_expedition_rouget.modules.php
+++ b/htdocs/includes/modules/expedition/pdf/pdf_expedition_rouget.modules.php
@@ -100,7 +100,7 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
$pdf->SetFont('Arial','', 14);
$pdf->Text($posx, 16, $outputlangs->transnoentities("SendingSheet")); // Bordereau expedition
$pdf->Text($posx, 22, $outputlangs->transnoentities("Ref") ." : ".$this->expe->ref);
- $pdf->Text($posx, 28, $outputlangs->transnoentities("Date")." : ".dolibarr_print_date($this->expe->date,"%d %b %Y",false,$outputlangs));
+ $pdf->Text($posx, 28, $outputlangs->transnoentities("Date")." : ".dol_print_date($this->expe->date,"%d %b %Y",false,$outputlangs,true));
$pdf->Text($posx, 34, $outputlangs->transnoentities("Page")." : ".$pdf->PageNo() ."/{nb}", 0);
if ($conf->barcode->enabled)
@@ -113,7 +113,7 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
$pdf->SetFont('Arial','', 14);
$pdf->Text($posx, 48, $outputlangs->transnoentities("Order"));
$pdf->Text($posx, 54, $outputlangs->transnoentities("Ref") ." : ".$this->expe->commande->ref);
- $pdf->Text($posx, 60, $outputlangs->transnoentities("Date")." : ".dolibarr_print_date($this->expe->commande->date,"%d %b %Y"));
+ $pdf->Text($posx, 60, $outputlangs->transnoentities("Date")." : ".dol_print_date($this->expe->commande->date,"%d %b %Y",false,$outputlangs,true));
}
diff --git a/htdocs/includes/modules/facture/modules_facture.php b/htdocs/includes/modules/facture/modules_facture.php
index b84af6c40ce..d172cfeeca5 100644
--- a/htdocs/includes/modules/facture/modules_facture.php
+++ b/htdocs/includes/modules/facture/modules_facture.php
@@ -226,10 +226,10 @@ function facture_pdf_create($db, $id, $message, $modele, $outputlangs)
}
/**
- \brief Cr�� un meta fichier � c�t� de la facture sur le disque pour faciliter les recherches en texte plein. Pourquoi ? tout simplement parcequ'en fin d'exercice quand je suis avec mon comptable je n'ai pas de connexion internet "rapide" pour retrouver en 2 secondes une facture non pay�e ou compliqu�e � g�rer ... avec un rgrep c'est vite fait bien fait [eric seigne
- \param db Objet base de donn�e
- \param facid Id de la facture � cr�er
- \param message Message
+ * \brief Cree un meta fichier a coté de la facture sur le disque pour faciliter les recherches en texte plein. Pourquoi ? tout simplement parcequ'en fin d'exercice quand je suis avec mon comptable je n'ai pas de connexion internet "rapide" pour retrouver en 2 secondes une facture non pay�e ou compliqu�e � g�rer ... avec un rgrep c'est vite fait bien fait [eric seigne
+ * \param db Objet base de donnee
+ * \param facid Id de la facture a creer
+ * \param message Message
*/
function facture_meta_create($db, $facid, $message="")
{
@@ -255,7 +255,7 @@ function facture_meta_create($db, $facid, $message="")
$nblignes = sizeof($fac->lignes);
$client = $fac->client->nom . " " . $fac->client->adresse . " " . $fac->client->cp . " " . $fac->client->ville;
$meta = "REFERENCE=\"" . $fac->ref . "\"
-DATE=\"" . dolibarr_print_date($fac->date) . "\"
+DATE=\"" . dol_print_date($fac->date,'') . "\"
NB_ITEMS=\"" . $nblignes . "\"
CLIENT=\"" . $client . "\"
TOTAL_HT=\"" . $fac->total_ht . "\"
diff --git a/htdocs/includes/modules/facture/pdf_crabe.modules.php b/htdocs/includes/modules/facture/pdf_crabe.modules.php
index 8e62223139b..002f47ceb37 100644
--- a/htdocs/includes/modules/facture/pdf_crabe.modules.php
+++ b/htdocs/includes/modules/facture/pdf_crabe.modules.php
@@ -486,7 +486,7 @@ class pdf_crabe extends ModelePDFFactures
$row = $this->db->fetch_row($resql);
$pdf->SetXY ($tab3_posx, $tab3_top+$y );
- $pdf->MultiCell(20, 3, dolibarr_print_date($row[0],'day',false,$outputlangs), 0, 'L', 0);
+ $pdf->MultiCell(20, 3, dol_print_date($row[0],'day',false,$outputlangs,true), 0, 'L', 0);
$pdf->SetXY ($tab3_posx+21, $tab3_top+$y);
$pdf->MultiCell(20, 3, price($row[1]), 0, 'L', 0);
$pdf->SetXY ($tab3_posx+41, $tab3_top+$y);
@@ -975,7 +975,7 @@ class pdf_crabe extends ModelePDFFactures
$posy+=5;
$pdf->SetXY(100,$posy);
$pdf->SetTextColor(0,0,60);
- $pdf->MultiCell(100, 3, $outputlangs->transnoentities("DateEcheance")." : " . dolibarr_print_date($object->date_lim_reglement,"day",false,$outputlangs), '', 'R');
+ $pdf->MultiCell(100, 3, $outputlangs->transnoentities("DateEcheance")." : " . dol_print_date($object->date_lim_reglement,"day",false,$outputlangs,true), '', 'R');
}
if ($showadress)
diff --git a/htdocs/includes/modules/facture/pdf_oursin.modules.php b/htdocs/includes/modules/facture/pdf_oursin.modules.php
index 80fd8e21913..a76bfabc402 100644
--- a/htdocs/includes/modules/facture/pdf_oursin.modules.php
+++ b/htdocs/includes/modules/facture/pdf_oursin.modules.php
@@ -397,7 +397,7 @@ class pdf_oursin extends ModelePDFFactures
$row = $this->db->fetch_row($resql);
$pdf->SetXY ($tab3_posx, $tab3_top+$y );
- $pdf->MultiCell(20, 3, dolibarr_print_date($row[0],'day',false,$outputlangs), 0, 'L', 0);
+ $pdf->MultiCell(20, 3, dol_print_date($row[0],'day',false,$outputlangs,true), 0, 'L', 0);
$pdf->SetXY ($tab3_posx+21, $tab3_top+$y);
$pdf->MultiCell(20, 3, price($row[1]), 0, 'L', 0);
$pdf->SetXY ($tab3_posx+41, $tab3_top+$y);
@@ -896,7 +896,7 @@ class pdf_oursin extends ModelePDFFactures
$pdf->SetFont('Arial','B',13);
$pdf->SetXY($this->marges['g'],$posy);
$pdf->SetTextColor(0,0,0);
- $pdf->MultiCell(100, 10, $outputlangs->transnoentities("Bill").' '.$outputlangs->transnoentities("Of").' '.dolibarr_print_date($fac->date,"%d %B %Y",false,$outputlangs), '' , 'L');
+ $pdf->MultiCell(100, 10, $outputlangs->transnoentities("Bill").' '.$outputlangs->transnoentities("Of").' '.dolibarr_print_date($fac->date,"%d %B %Y",false,$outputlangs,true), '' , 'L');
$pdf->SetFont('Arial','B',11);
$pdf->SetXY($this->marges['g'],$posy+6);
$pdf->SetTextColor(22,137,210);
diff --git a/htdocs/includes/modules/fichinter/pdf_soleil.modules.php b/htdocs/includes/modules/fichinter/pdf_soleil.modules.php
index 654e2906c0b..6cbcf6af647 100644
--- a/htdocs/includes/modules/fichinter/pdf_soleil.modules.php
+++ b/htdocs/includes/modules/fichinter/pdf_soleil.modules.php
@@ -286,7 +286,7 @@ class pdf_soleil extends ModelePDFFicheinter
{
$pdf->SetXY (10, $tab_top + $j * $height);
$pdf->writeHTMLCell(0, 4, $this->marge_gauche, $tab_top + $j * $height,
- dol_htmlentitiesbr($outputlangs->transnoentities("Date")." : ".dolibarr_print_date($fichinterligne->datei,'',false,$outputlangs)." - ".$outputlangs->transnoentities("Duration")." : ".ConvertSecondToTime($fichinterligne->duration),1,$outputlangs->charset_output), 0, 1, 0);
+ dol_htmlentitiesbr($outputlangs->transnoentities("Date")." : ".dol_print_date($fichinterligne->datei,'',false,$outputlangs,true)." - ".$outputlangs->transnoentities("Duration")." : ".ConvertSecondToTime($fichinterligne->duration),1,$outputlangs->charset_output), 0, 1, 0);
$tab_height+=4;
$pdf->SetXY (10, $tab_top + 4 + $j * $height);
diff --git a/htdocs/includes/modules/livraison/pdf/pdf_sirocco.modules.php b/htdocs/includes/modules/livraison/pdf/pdf_sirocco.modules.php
index 27b3b9403d7..a74dd23f0aa 100644
--- a/htdocs/includes/modules/livraison/pdf/pdf_sirocco.modules.php
+++ b/htdocs/includes/modules/livraison/pdf/pdf_sirocco.modules.php
@@ -410,7 +410,7 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
$pdf->SetTextColor(200,0,0);
$pdf->SetFont('Arial','B',12);
- $pdf->Text(11, 88, $outputlangs->transnoentities("Date")." : " . dolibarr_print_date($delivery->date_valid,"day",false,$outputlangs));
+ $pdf->Text(11, 88, $outputlangs->transnoentities("Date")." : " . dol_print_date($delivery->date_valid,"day",false,$outputlangs,true));
$pdf->Text(11, 94, $outputlangs->transnoentities("DeliveryOrder")." ".$outputlangs->convToOutputCharset($delivery->ref));
$pdf->SetFont('Arial','B',9);
diff --git a/htdocs/includes/modules/livraison/pdf/pdf_typhon.modules.php b/htdocs/includes/modules/livraison/pdf/pdf_typhon.modules.php
index 6e90af6c5ab..fa25801157a 100644
--- a/htdocs/includes/modules/livraison/pdf/pdf_typhon.modules.php
+++ b/htdocs/includes/modules/livraison/pdf/pdf_typhon.modules.php
@@ -471,7 +471,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
$pdf->SetTextColor(0,0,60);
if ($delivery->date_valid)
{
- $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Date")." : " . dolibarr_print_date($delivery->date_valid,"%d %b %Y",false,$outputlangs), '', 'R');
+ $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Date")." : " . dol_print_date($delivery->date_valid,"%d %b %Y",false,$outputlangs,true), '', 'R');
}
else
{
diff --git a/htdocs/includes/modules/mailings/fraise.modules.php b/htdocs/includes/modules/mailings/fraise.modules.php
index cc3b4c43f75..8c93a001224 100644
--- a/htdocs/includes/modules/mailings/fraise.modules.php
+++ b/htdocs/includes/modules/mailings/fraise.modules.php
@@ -162,7 +162,7 @@ class mailing_fraise extends MailingTargets
'fk_contact' => $obj->fk_contact,
'name' => $obj->name,
'firstname' => $obj->firstname,
- 'other' => $obj->datefin?($langs->transnoentities("DateEnd").'='.dolibarr_print_date($this->db->jdate($obj->datefin),'day')):'',
+ 'other' => $obj->datefin?($langs->transnoentities("DateEnd").'='.dol_print_date($this->db->jdate($obj->datefin),'day')):'',
'url' => $this->url($obj->id)
);
$old = $obj->email;
diff --git a/htdocs/includes/modules/propale/pdf_propale_azur.modules.php b/htdocs/includes/modules/propale/pdf_propale_azur.modules.php
index 15299a9c9c9..b2f0651b398 100644
--- a/htdocs/includes/modules/propale/pdf_propale_azur.modules.php
+++ b/htdocs/includes/modules/propale/pdf_propale_azur.modules.php
@@ -803,12 +803,12 @@ class pdf_propale_azur extends ModelePDFPropales
$posy+=5;
$pdf->SetXY(100,$posy);
$pdf->SetTextColor(0,0,60);
- $pdf->MultiCell(100, 3, $outputlangs->transnoentities("Date")." : " . dolibarr_print_date($object->date,"day",false,$outputlangs), '', 'R');
+ $pdf->MultiCell(100, 3, $outputlangs->transnoentities("Date")." : " . dol_print_date($object->date,"day",false,$outputlangs,true), '', 'R');
$posy+=5;
$pdf->SetXY(100,$posy);
$pdf->SetTextColor(0,0,60);
- $pdf->MultiCell(100, 3, $outputlangs->transnoentities("DateEndPropal")." : " . dolibarr_print_date($object->fin_validite,"day",false,$outputlangs), '', 'R');
+ $pdf->MultiCell(100, 3, $outputlangs->transnoentities("DateEndPropal")." : " . dol_print_date($object->fin_validite,"day",false,$outputlangs,true), '', 'R');
if ($showadress)
{
diff --git a/htdocs/includes/modules/propale/pdf_propale_jaune.modules.php b/htdocs/includes/modules/propale/pdf_propale_jaune.modules.php
index be98aec48b4..9049635f464 100644
--- a/htdocs/includes/modules/propale/pdf_propale_jaune.modules.php
+++ b/htdocs/includes/modules/propale/pdf_propale_jaune.modules.php
@@ -405,7 +405,7 @@ class pdf_propale_jaune extends ModelePDFPropales
$pdf->SetXY(10,90);
$pdf->MultiCell(110, 10, $outputlangs->transnoentities("Ref")." : ".$outputlangs->convToOutputCharset($propale->ref));
$pdf->SetXY(110,90);
- $pdf->MultiCell(100, 10, $outputlangs->transnoentities("Date")." : " . dolibarr_print_date($propale->date,'day',false,$outputlangs));
+ $pdf->MultiCell(100, 10, $outputlangs->transnoentities("Date")." : " . dol_print_date($propale->date,'day',false,$outputlangs,true));
$posy=39;
diff --git a/htdocs/includes/modules/rapport/pdf_paiement.class.php b/htdocs/includes/modules/rapport/pdf_paiement.class.php
index 2fd80434732..ba108a51851 100644
--- a/htdocs/includes/modules/rapport/pdf_paiement.class.php
+++ b/htdocs/includes/modules/rapport/pdf_paiement.class.php
@@ -100,7 +100,7 @@ class pdf_paiement extends FPDF
$month = sprintf("%02d",$month);
$year = sprintf("%04d",$year);
- $_file = $dir . "/payments-".$month."-".$year.".pdf";
+ $file = $dir . "/payments-".$month."-".$year.".pdf";
// Protection et encryption du pdf
if ($conf->global->PDF_SECURITY_ENCRYPTION)
@@ -116,9 +116,6 @@ class pdf_paiement extends FPDF
$pdf=new FPDI('P','mm',$this->format);
}
- $pdf->Open();
- $pagenb=0;
- $pdf->SetDrawColor(128,128,128);
$sql = "SELECT ".$this->db->pdate("p.datep")." as dp, f.facnumber";
//$sql .= ", c.libelle as paiement_type, p.num_paiement";
@@ -147,7 +144,7 @@ class pdf_paiement extends FPDF
$var=!$var;
$lines[$i][0] = $objp->facnumber;
- $lines[$i][1] = dolibarr_print_date($objp->dp,"%d %B %Y",false,$outputlangs);
+ $lines[$i][1] = dol_print_date($objp->dp,"%d %B %Y",false,$outputlangs,true);
//$lines[$i][2] = $objp->paiement_type ;
$lines[$i][2] = $langs->transnoentities("PaymentTypeShort".$objp->paiement_code);
$lines[$i][3] = $objp->num_paiement;
@@ -175,27 +172,37 @@ class pdf_paiement extends FPDF
// force to build at least one page if report has no line
$pages = 1;
}
- /*
- for ($i = 0 ; $i < $pages ; $i++)
- {
- $pdf->AddPage();
- $this->Header($pdf, $i+1, $pages, $outputlangs);
- $this->Body($pdf, $i+1, $lines, $outputlangs);
- }
- */
+
+ $pdf->Open();
+ $pagenb=0;
+ $pdf->SetDrawColor(128,128,128);
+
+ $pdf->SetTitle($outputlangs->transnoentities("Payments"));
+ $pdf->SetSubject($outputlangs->transnoentities("Payments"));
+ $pdf->SetCreator("Dolibarr ".DOL_VERSION);
+ $pdf->SetAuthor($outputlangs->convToOutputCharset($user->fullname));
+ //$pdf->SetKeyWords();
+ if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false);
+
+ $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
+ $pdf->SetAutoPageBreak(1,0);
// New page
- $this->AddPage();
+ $pdf->AddPage();
$pagenb++;
- $this->Header($pdf, 1, $pages, $outputlangs);
- $this->SetFont('Arial','', 9);
+ $this->_pagehead($pdf, $pages, 1, $outputlangs);
+ $pdf->SetFont('Arial','', 9);
$pdf->MultiCell(0, 3, '', 0, 'J'); // Set interline to 3
- $this->SetTextColor(0,0,0);
+ $pdf->SetTextColor(0,0,0);
$this->Body($pdf, 1, $lines, $outputlangs);
- $pdf->Output($_file);
+ $pdf->AliasNbPages();
+
+ $pdf->Close();
+
+ $pdf->Output($file);
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
@@ -209,17 +216,17 @@ class pdf_paiement extends FPDF
* \param page current page number
* \param pages number of pages
*/
- function Header(&$pdf, $page, $pages, $outputlangs)
+ function _pagehead(&$pdf, $page, $showadress=1, $outputlangs)
{
global $langs;
$title=$outputlangs->transnoentities("ListOfCustomerPayments");
- $title.=' - '.dolibarr_print_date(dolibarr_mktime(0,0,0,$this->month,1,$this->year),"%B %Y",false,$outputlangs);
+ $title.=' - '.dol_print_date(dolibarr_mktime(0,0,0,$this->month,1,$this->year),"%B %Y",false,$outputlangs,true);
$pdf->SetFont('Arial','B',12);
- $pdf->Text(76, 10, $title);
+ $pdf->Text(70, 10, $title);
- $pdf->SetFont('Arial','B',12);
- $pdf->Text(11, 16, $outputlangs->transnoentities("Date")." : ".dolibarr_print_date(time(),"day",false,$outputlangs));
+ $pdf->SetFont('Arial','',12);
+ $pdf->Text(11, 16, $outputlangs->transnoentities("DateBuild")." : ".dol_print_date(time(),"day",false,$outputlangs,true));
$pdf->SetFont('Arial','',12);
$pdf->Text(11, 22, $outputlangs->transnoentities("Page")." : ".$page);
@@ -266,7 +273,7 @@ class pdf_paiement extends FPDF
{
$page++;
$pdf->AddPage();
- $this->Header($pdf, $page, $pages, $outputlangs);
+ $this->_pagehead($pdf, $page, 0, $outputlangs);
$pdf->SetFont('Arial','', 9);
$yp = 0;
}
diff --git a/htdocs/includes/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/includes/modules/supplier_order/pdf/pdf_muscadet.modules.php
index 765f98f88d8..5cf3c03c23b 100644
--- a/htdocs/includes/modules/supplier_order/pdf/pdf_muscadet.modules.php
+++ b/htdocs/includes/modules/supplier_order/pdf/pdf_muscadet.modules.php
@@ -674,7 +674,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$posy+=6;
$pdf->SetXY(100,$posy);
$pdf->SetTextColor(0,0,60);
- $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Date")." : " . dolibarr_print_date($object->date,"day",false,$outputlangs), '', 'R');
+ $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Date")." : " . dol_print_date($object->date,"day",false,$outputlangs,true), '', 'R');
if ($showadress)
{
diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang
index d3cfb31f547..b0f08d0adba 100644
--- a/htdocs/langs/en_US/main.lang
+++ b/htdocs/langs/en_US/main.lang
@@ -186,6 +186,7 @@ DateRequest=Request date
DateProcess=Process date
DatePlanShort=Date planed
DateRealShort=Date real.
+DateBuild=Report build date
DurationYear=year
DurationMonth=month
DurationDay=day
diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang
index dd9746518bb..5a74c43f38f 100644
--- a/htdocs/langs/fr_FR/main.lang
+++ b/htdocs/langs/fr_FR/main.lang
@@ -185,6 +185,7 @@ DateRequest=Date demande
DateProcess=Date traitement
DatePlanShort=Date planif.
DateRealShort=Date réal.
+DateBuild=Date génération du rapport
DurationYear=an
DurationMonth=mois
DurationWeek=semaine
diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php
index 03ba98e43df..e77ac90cfcf 100644
--- a/htdocs/lib/functions.lib.php
+++ b/htdocs/lib/functions.lib.php
@@ -372,7 +372,7 @@ function dolibarr_print_date($time,$format='',$to_gmt=false,$outputlangs='')
/**
* \brief Output date in a string format according to outputlangs (or langs if not defined).
- * But return charset is always UTF-8.
+ * Return charset is always UTF-8, except if encodetoouput is defined. In this cas charset is output charset.
* \param time GM Timestamps date (or 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS' in server TZ)
* \param format Output date format
* "%d %b %Y",
@@ -383,7 +383,7 @@ function dolibarr_print_date($time,$format='',$to_gmt=false,$outputlangs='')
* \param outputlangs Object lang that contains language for text translation.
* \return string Formated date or '' if time is null
*/
-function dol_print_date($time,$format='',$to_gmt=false,$outputlangs='')
+function dol_print_date($time,$format='',$to_gmt=false,$outputlangs='',$encodetooutput=false)
{
global $conf,$langs;
@@ -406,14 +406,14 @@ function dol_print_date($time,$format='',$to_gmt=false,$outputlangs='')
if (strlen($time) == 0) return ''; // $time=0 allowed (it means 01/01/1970 00:00:00)
//print 'x'.$time;
-
+
if (eregi('%b',$format)) // There is some text to translate
{
// We inhibate translation to text made by strftime functions. We will use trans instead later.
- $format=ereg_replace('%b','__b__',$format);
- $format=ereg_replace('%B','__B__',$format);
+ $format=ereg_replace('%b','__b__',$format);
+ $format=ereg_replace('%B','__B__',$format);
}
-
+
// Analyse de la date (deprecated) Ex: 19700101, 19700101010000
if (eregi('^([0-9]+)\-([0-9]+)\-([0-9]+) ?([0-9]+)?:?([0-9]+)?:?([0-9]+)?',$time,$reg)
|| eregi('^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])$',$time,$reg))
@@ -447,8 +447,16 @@ function dol_print_date($time,$format='',$to_gmt=false,$outputlangs='')
{
// Here ret is string in PHP setup language (strftime was used). Now we convert to $outputlangs.
$month=adodb_strftime('%m',$time);
- $monthtext=$outputlangs->transnoentitiesnoconv('Month'.$month);
- $monthtextshort=$outputlangs->transnoentitiesnoconv('MonthShort'.$month);
+ if ($encodetooutput)
+ {
+ $monthtext=$outputlangs->transnoentities('Month'.$month);
+ $monthtextshort=$outputlangs->transnoentities('MonthShort'.$month);
+ }
+ else
+ {
+ $monthtext=$outputlangs->transnoentitiesnoconv('Month'.$month);
+ $monthtextshort=$outputlangs->transnoentitiesnoconv('MonthShort'.$month);
+ }
//print 'monthtext='.$monthtext.' monthtextshort='.$monthtextshort;
$ret=ereg_replace('__b__',$monthtextshort,$ret);
$ret=ereg_replace('__B__',$monthtext,$ret);
diff --git a/htdocs/lib/pdf.lib.php b/htdocs/lib/pdf.lib.php
index ab5977f8c74..7e467335e57 100644
--- a/htdocs/lib/pdf.lib.php
+++ b/htdocs/lib/pdf.lib.php
@@ -267,7 +267,7 @@ function pdf_getlinedesc($line,$outputlangs)
$prefix_prodserv = $outputlangs->transnoentitiesnoconv("Product")." ";
}
}
-
+
$libelleproduitservice=$prefix_prodserv.$prodser->ref." - ".$libelleproduitservice;
}
}
diff --git a/htdocs/product.class.php b/htdocs/product.class.php
index c821d80af5b..b9e26700c39 100644
--- a/htdocs/product.class.php
+++ b/htdocs/product.class.php
@@ -977,7 +977,7 @@ class Product extends CommonObject
}
}
- // multiprix
+ // Load multiprices array
if ($conf->global->PRODUIT_MULTIPRICES)
{
for ($i=1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++)
@@ -988,7 +988,6 @@ class Product extends CommonObject
$sql.= " where price_level=".$i." and";
$sql.= " fk_product = '".$this->id."'";
$sql.= " order by date_price DESC limit 1";
-
$result = $this->db->query($sql) ;
if ( $result )
{
@@ -1006,7 +1005,6 @@ class Product extends CommonObject
return -1;
}
}
-
}
$res=$this->load_stock();
diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php
index dd0aac71e4b..c93af7d3235 100644
--- a/htdocs/product/fiche.php
+++ b/htdocs/product/fiche.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2004-2008 Laurent Destailleur
+ * Copyright (C) 2004-2009 Laurent Destailleur
* Copyright (C) 2005 Eric Seigne
* Copyright (C) 2005-2007 Régis Houssin
* Copyright (C) 2006 Andre Cianfarani
@@ -94,8 +94,8 @@ if ($_POST["action"] == 'add' && $user->rights->produit->creer)
$product->tva_tx = $_POST["tva_tx"];
$product->type = $_POST["type"];
$product->status = $_POST["statut"];
- $product->description = $_POST["desc"];
- $product->note = $_POST["note"];
+ $product->description = dol_htmlcleanlastbr($_POST["desc"]);
+ $product->note = dol_htmlcleanlastbr($_POST["note"]);
$product->duration_value = $_POST["duration_value"];
$product->duration_unit = $_POST["duration_unit"];
$product->seuil_stock_alerte = $_POST["seuil_stock_alerte"];
@@ -154,8 +154,8 @@ $user->rights->produit->creer)
{
$product->ref = $_POST["ref"];
$product->libelle = $_POST["libelle"];
- $product->description = $_POST["desc"];
- $product->note = $_POST["note"];
+ $product->description = dol_htmlcleanlastbr($_POST["desc"]);
+ $product->note = dol_htmlcleanlastbr($_POST["note"]);
$product->status = $_POST["statut"];
$product->seuil_stock_alerte = $_POST["seuil_stock_alerte"];
$product->stock_loc = $_POST["stock_loc"];
diff --git a/htdocs/propal.class.php b/htdocs/propal.class.php
index 02a58cbc91e..f92b7a561dd 100644
--- a/htdocs/propal.class.php
+++ b/htdocs/propal.class.php
@@ -521,8 +521,8 @@ class Propal extends CommonObject
$sql = "INSERT INTO ".MAIN_DB_PREFIX."propal (fk_soc, price,";
$sql.= " remise, remise_percent, remise_absolue,";
$sql.= " tva, total, datep, datec, ref, fk_user_author, note, note_public, model_pdf, fin_validite,";
- $sql.= " fk_cond_reglement, fk_mode_reglement, ref_client";
- if ($conf->global->PROPALE_ADD_SHIPPING_DATE) $sql.= ", date_livraison";
+ $sql.= " fk_cond_reglement, fk_mode_reglement, ref_client,";
+ $sql.= " date_livraison";
$sql.= ") ";
$sql.= " VALUES (".$this->socid.", 0,";
$sql.= " ".$this->remise.", ".($this->remise_percent?$this->remise_percent:'null').", ".($this->remise_absolue?$this->remise_absolue:'null').",";
@@ -532,8 +532,8 @@ class Propal extends CommonObject
$sql.= "'".addslashes($this->note_public)."',";
$sql.= "'".$this->modelpdf."',".$this->db->idate($this->fin_validite).",";
$sql.= " ".$this->cond_reglement_id.", ".$this->mode_reglement_id.",";
- $sql.= "'".addslashes($this->ref_client)."'";
- if ($conf->global->PROPALE_ADD_SHIPPING_DATE) $sql.= ", ".($this->date_livraison?$this->db->idate($this->date_livraison):'null');
+ $sql.= "'".addslashes($this->ref_client)."',";
+ $sql.= " ".($this->date_livraison!=''?$this->db->idate($this->date_livraison):'null');
$sql.= ")";
dolibarr_syslog("Propal::create sql=".$sql, LOG_DEBUG);
@@ -2105,13 +2105,11 @@ class PropaleLigne
$sql.= ' total_ht, total_tva, total_ttc, marge_tx, marque_tx, special_code, rang)';
$sql.= " VALUES (".$this->fk_propal.",";
$sql.= " '".addslashes($this->desc)."',";
- if ($this->fk_product) { $sql.= "'".$this->fk_product."',"; }
- else { $sql.='null,'; }
- if ($this->fk_remise_except) $sql.= $this->fk_remise_except.",";
- else $sql.= 'null,';
+ $sql.= " ".($this->fk_product?"'".$this->fk_product."'":"null").",";
+ $sql.= " ".($this->fk_remise_except?"'".$this->fk_remise_except."'":"null").",";
$sql.= " ".price2num($this->qty).",";
$sql.= " ".price2num($this->tva_tx).",";
- $sql.= " ".price2num($this->subprice).",";
+ $sql.= " ".($this->subprice?price2num($this->subprice):'null').",";
$sql.= " ".price2num($this->remise_percent).",";
$sql.= " '".$this->info_bits."',";
$sql.= " ".price2num($this->total_ht).",";