diff --git a/htdocs/includes/modules/facture/pdf_crabe.modules.php b/htdocs/includes/modules/facture/pdf_crabe.modules.php index 488df648108..8e62223139b 100644 --- a/htdocs/includes/modules/facture/pdf_crabe.modules.php +++ b/htdocs/includes/modules/facture/pdf_crabe.modules.php @@ -269,13 +269,13 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetXY ($this->posxdiscount, $curY); if ($fac->lignes[$i]->remise_percent) { - $pdf->MultiCell($this->postotalht-$this->posxdiscount-1, 4, dol_print_reduction($fac->lignes[$i]->remise_percent,$outputlangs), 0, 'R'); + $pdf->MultiCell($this->postotalht-$this->posxdiscount-1, 3, dol_print_reduction($fac->lignes[$i]->remise_percent,$outputlangs), 0, 'R'); } // Total HT ligne $pdf->SetXY ($this->postotalht, $curY); $total = price($fac->lignes[$i]->total_ht); - $pdf->MultiCell(26, 4, $total, 0, 'R', 0); + $pdf->MultiCell(26, 3, $total, 0, 'R', 0); // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva $tvaligne=$fac->lignes[$i]->total_tva; @@ -289,7 +289,7 @@ class pdf_crabe extends ModelePDFFactures // Cherche nombre de lignes a venir pour savoir si place suffisante if ($i < ($nblignes - 1)) // If it's not last line { - //on r�cup�re la description du produit suivant + //on recupere la description du produit suivant $follow_descproduitservice = $fac->lignes[$i+1]->desc; //on compte le nombre de ligne afin de verifier la place disponible (largeur de ligne 52 caracteres) $nblineFollowDesc = dol_nboflines_bis($follow_descproduitservice,52)*4; @@ -416,16 +416,17 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetXY ($tab3_posx, $tab3_top - 5); $pdf->MultiCell(60, 5, $outputlangs->transnoentities("PaymentsAlreadyDone"), 0, 'L', 0); - $pdf->Rect($tab3_posx, $tab3_top-1, $tab3_width, $tab3_height); + $pdf->line($tab3_posx, $tab3_top-1+$tab3_height, $tab3_posx+$tab3_width, $tab3_top-1+$tab3_height); - $pdf->SetXY ($tab3_posx, $tab3_top-1 ); - $pdf->MultiCell(20, 4, $outputlangs->transnoentities("Payment"), 0, 'L', 0); - $pdf->SetXY ($tab3_posx+21, $tab3_top-1 ); - $pdf->MultiCell(20, 4, $outputlangs->transnoentities("Amount"), 0, 'L', 0); - $pdf->SetXY ($tab3_posx+41, $tab3_top-1 ); - $pdf->MultiCell(20, 4, $outputlangs->transnoentities("Type"), 0, 'L', 0); - $pdf->SetXY ($tab3_posx+60, $tab3_top-1 ); - $pdf->MultiCell(20, 4, $outputlangs->transnoentities("Num"), 0, 'L', 0); + $pdf->SetFont('Arial','',6); + $pdf->SetXY ($tab3_posx, $tab3_top ); + $pdf->MultiCell(20, 3, $outputlangs->transnoentities("Payment"), 0, 'L', 0); + $pdf->SetXY ($tab3_posx+21, $tab3_top ); + $pdf->MultiCell(20, 3, $outputlangs->transnoentities("Amount"), 0, 'L', 0); + $pdf->SetXY ($tab3_posx+41, $tab3_top ); + $pdf->MultiCell(20, 3, $outputlangs->transnoentities("Type"), 0, 'L', 0); + $pdf->SetXY ($tab3_posx+60, $tab3_top ); + $pdf->MultiCell(20, 3, $outputlangs->transnoentities("Num"), 0, 'L', 0); $y=0; @@ -450,13 +451,13 @@ class pdf_crabe extends ModelePDFFactures $invoice->fetch($obj->fk_facture_source); $pdf->SetXY ($tab3_posx, $tab3_top+$y ); - $pdf->MultiCell(20, 4,'', 0, 'L', 0); + $pdf->MultiCell(20, 3,'', 0, 'L', 0); $pdf->SetXY ($tab3_posx+21, $tab3_top+$y); - $pdf->MultiCell(20, 4, price($obj->amount_ttc), 0, 'L', 0); + $pdf->MultiCell(20, 3, price($obj->amount_ttc), 0, 'L', 0); $pdf->SetXY ($tab3_posx+41, $tab3_top+$y); - $pdf->MultiCell(20, 4, $outputlangs->trans("CreditNote"), 0, 'L', 0); + $pdf->MultiCell(20, 3, $outputlangs->trans("CreditNote"), 0, 'L', 0); $pdf->SetXY ($tab3_posx+60, $tab3_top+$y); - $pdf->MultiCell(20, 4, $invoice->ref, 0, 'L', 0); + $pdf->MultiCell(20, 3, $invoice->ref, 0, 'L', 0); $pdf->line($tab3_posx, $tab3_top+$y+3, $tab3_posx+$tab3_width, $tab3_top+$y+3 ); @@ -485,9 +486,9 @@ class pdf_crabe extends ModelePDFFactures $row = $this->db->fetch_row($resql); $pdf->SetXY ($tab3_posx, $tab3_top+$y ); - $pdf->MultiCell(20, 4, dolibarr_print_date($row[0],'day',false,$outputlangs), 0, 'L', 0); + $pdf->MultiCell(20, 3, dolibarr_print_date($row[0],'day',false,$outputlangs), 0, 'L', 0); $pdf->SetXY ($tab3_posx+21, $tab3_top+$y); - $pdf->MultiCell(20, 4, price($row[1]), 0, 'L', 0); + $pdf->MultiCell(20, 3, price($row[1]), 0, 'L', 0); $pdf->SetXY ($tab3_posx+41, $tab3_top+$y); switch ($row[2]) { @@ -513,9 +514,9 @@ class pdf_crabe extends ModelePDFFactures $oper = 'CHQ'; break; } - $pdf->MultiCell(20, 4, $oper, 0, 'L', 0); + $pdf->MultiCell(20, 3, $oper, 0, 'L', 0); $pdf->SetXY ($tab3_posx+60, $tab3_top+$y); - $pdf->MultiCell(20, 4, $row[3], 0, 'L', 0); + $pdf->MultiCell(20, 3, $row[3], 0, 'L', 0); $pdf->line($tab3_posx, $tab3_top+$y+3, $tab3_posx+$tab3_width, $tab3_top+$y+3 ); diff --git a/htdocs/includes/modules/facture/pdf_oursin.modules.php b/htdocs/includes/modules/facture/pdf_oursin.modules.php index 5d9bda00b70..80fd8e21913 100644 --- a/htdocs/includes/modules/facture/pdf_oursin.modules.php +++ b/htdocs/includes/modules/facture/pdf_oursin.modules.php @@ -361,13 +361,13 @@ class pdf_oursin extends ModelePDFFactures $invoice->fetch($obj->fk_facture_source); $pdf->SetXY ($tab3_posx, $tab3_top+$y ); - $pdf->MultiCell(20, 4,'', 0, 'L', 0); + $pdf->MultiCell(20, 3,'', 0, 'L', 0); $pdf->SetXY ($tab3_posx+21, $tab3_top+$y); - $pdf->MultiCell(20, 4, price($obj->amount_ttc), 0, 'L', 0); + $pdf->MultiCell(20, 3, price($obj->amount_ttc), 0, 'L', 0); $pdf->SetXY ($tab3_posx+41, $tab3_top+$y); - $pdf->MultiCell(20, 4, $outputlangs->trans("CreditNote"), 0, 'L', 0); + $pdf->MultiCell(20, 3, $outputlangs->trans("CreditNote"), 0, 'L', 0); $pdf->SetXY ($tab3_posx+60, $tab3_top+$y); - $pdf->MultiCell(20, 4, $invoice->ref, 0, 'L', 0); + $pdf->MultiCell(20, 3, $invoice->ref, 0, 'L', 0); $pdf->line($tab3_posx, $tab3_top+$y+3, $tab3_posx+$tab3_width, $tab3_top+$y+3 ); @@ -397,9 +397,9 @@ class pdf_oursin extends ModelePDFFactures $row = $this->db->fetch_row($resql); $pdf->SetXY ($tab3_posx, $tab3_top+$y ); - $pdf->MultiCell(20, 4, dolibarr_print_date($row[0],'day',false,$outputlangs), 0, 'L', 0); + $pdf->MultiCell(20, 3, dolibarr_print_date($row[0],'day',false,$outputlangs), 0, 'L', 0); $pdf->SetXY ($tab3_posx+21, $tab3_top+$y); - $pdf->MultiCell(20, 4, price($row[1]), 0, 'L', 0); + $pdf->MultiCell(20, 3, price($row[1]), 0, 'L', 0); $pdf->SetXY ($tab3_posx+41, $tab3_top+$y); switch ($row[2]) { @@ -425,9 +425,9 @@ class pdf_oursin extends ModelePDFFactures $oper = 'CHQ'; break; } - $pdf->MultiCell(20, 4, $oper, 0, 'L', 0); + $pdf->MultiCell(20, 3, $oper, 0, 'L', 0); $pdf->SetXY ($tab3_posx+60, $tab3_top+$y); - $pdf->MultiCell(20, 4, $row[3], 0, 'L', 0); + $pdf->MultiCell(20, 3, $row[3], 0, 'L', 0); $pdf->line($tab3_posx, $tab3_top+$y+3, $tab3_posx+$tab3_width, $tab3_top+$y+3 ); @@ -577,7 +577,7 @@ class pdf_oursin extends ModelePDFFactures /** - * \brief Affiche le total � payer + * \brief Affiche le total a payer * \param pdf objet PDF * \param fac objet facture * \param deja_regle montant deja regle diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index a083022cad0..0a6ed487ad1 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -355,6 +355,30 @@ September=September October=October November=November December=December +Month01=jan +Month02=feb +Month03=mar +Month04=apr +Month05=may +Month06=jun +Month07=jul +Month08=aug +Month09=sep +Month10=oct +Month11=nov +Month12=dec +MonthShort01=jan +MonthShort02=feb +MonthShort03=mar +MonthShort04=apr +MonthShort05=may +MonthShort06=jun +MonthShort07=jul +MonthShort08=aug +MonthShort09=sep +MonthShort10=oct +MonthShort11=nov +MonthShort12=dec AttachedFiles=Attached files and documents FileTransferComplete=File was updloaded successfuly DateFormatYYYYMM=YYYY-MM diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index d10e6c671a9..dd9746518bb 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -356,6 +356,30 @@ September=septembre October=octobre November=novembre December=décembre +Month01=janvier +Month02=février +Month03=mars +Month04=avril +Month05=mai +Month06=juin +Month07=juillet +Month08=août +Month09=septembre +Month10=octobre +Month11=novembre +Month12=décembre +MonthShort01=jan. +MonthShort02=fév. +MonthShort03=mars +MonthShort04=avr. +MonthShort05=mai +MonthShort06=juin +MonthShort07=juil. +MonthShort08=août +MonthShort09=sep. +MonthShort10=oct. +MonthShort11=nov. +MonthShort12=déc. AttachedFiles=Fichiers et documents joints FileTransferComplete=Le fichier a été correctement transféré DateFormatYYYYMM=YYYY-MM diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php index 47e15ab4e71..fa643f7ba94 100644 --- a/htdocs/lib/functions.lib.php +++ b/htdocs/lib/functions.lib.php @@ -371,7 +371,8 @@ function dolibarr_print_date($time,$format='',$to_gmt=false,$outputlangs='') } /** - * \brief Output date in a string format according to outputlang (or lang if not defined) + * \brief Output date in a string format according to outputlangs (or langs if not defined). + * But return charset is always UTF-8. * \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", @@ -380,7 +381,7 @@ function dolibarr_print_date($time,$format='',$to_gmt=false,$outputlangs='') * "day", "daytext", "dayhour", "dayhourldap", "dayhourtext" * \param to_gmt false=output string if for local server TZ users, true=output string is for GMT users * \param outputlangs Object lang that contains charset_output property to define output - * This means output is endoded in UTF-8 in default case. + * This means output is encoded in UTF-8 in default case. * \return string Formated date or '' if time is null */ function dol_print_date($time,$format='',$to_gmt=false,$outputlangs='') @@ -390,23 +391,30 @@ function dol_print_date($time,$format='',$to_gmt=false,$outputlangs='') // Si format non defini, on prend $conf->format_date_text_short sinon %Y-%m-%d %H:%M:%S if (! $format) $format=(isset($conf->format_date_text_short) ? $conf->format_date_text_short : '%Y-%m-%d %H:%M:%S'); - if ($format == 'day') $format=$conf->format_date_short; - if ($format == 'hour') $format=$conf->format_hour_short; - if ($format == 'daytext') $format=$conf->format_date_text; - if ($format == 'daytextshort') $format=$conf->format_date_text_short; - if ($format == 'dayhour') $format=$conf->format_date_hour_short; - if ($format == 'dayhourtext') $format=$conf->format_date_hour_text; + if ($format == 'day') $format=$conf->format_date_short; + if ($format == 'hour') $format=$conf->format_hour_short; + if ($format == 'daytext') $format=$conf->format_date_text; + if ($format == 'daytextshort') $format=$conf->format_date_text_short; + if ($format == 'dayhour') $format=$conf->format_date_hour_short; + if ($format == 'dayhourtext') $format=$conf->format_date_hour_text; if ($format == 'dayhourtextshort') $format=$conf->format_date_hour_text_short; - if ($format == 'dayhourlog') $format='%Y%m%d%H%M%S'; - if ($format == 'dayhourldap') $format='%Y%m%d%H%M%SZ'; - if ($format == 'dayhourxcard') $format='%Y%m%dT%H%M%SZ'; + if ($format == 'dayhourlog') $format='%Y%m%d%H%M%S'; + if ($format == 'dayhourldap') $format='%Y%m%d%H%M%SZ'; + if ($format == 'dayhourxcard') $format='%Y%m%dT%H%M%SZ'; // If date undefined or "", we return "" 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); + } + // 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)) @@ -421,7 +429,8 @@ function dol_print_date($time,$format='',$to_gmt=false,$outputlangs='') $smin = $reg[5]; $ssec = $reg[6]; - $ret=adodb_strftime($format,dolibarr_mktime($shour,$smin,$ssec,$smonth,$sday,$syear),$to_gmt); + $time=dolibarr_mktime($shour,$smin,$ssec,$smonth,$sday,$syear); + $ret=adodb_strftime($format,$time,$to_gmt); } else { @@ -434,14 +443,28 @@ function dol_print_date($time,$format='',$to_gmt=false,$outputlangs='') } // What is page code of texts from strftime functions ? - $pagecodefrom='ISO-8859-1'; - $localtime=setlocale(LC_TIME,0); +// $pagecodefrom='ISO-8859-1'; +// $localtime=setlocale(LC_TIME,0); //print $localtime; - if (eregi('UTF',$localtime)) $pagecodefrom='UTF-8'; +// if (eregi('UTF',$localtime)) $pagecodefrom='UTF-8'; if (! is_object($outputlangs)) $outputlangs=$langs; - return $outputlangs->convToOutputCharset($ret,$pagecodefrom); + if (eregi('__b__',$format)) + { + // 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); + //print 'monthtext='.$monthtext.' monthtextshort='.$monthtextshort; + $ret=ereg_replace('__b__',$monthtextshort,$ret); + $ret=ereg_replace('__B__',$monthtext,$ret); + //print 'x'.$outputlangs->charset_output.'-'.$ret.'x'; + //return $ret; + } + +// return $outputlangs->convToOutputCharset($ret,$pagecodefrom); + return $ret; } @@ -2684,15 +2707,15 @@ function print_date_range($date_start,$date_end,$format = '',$outputlangs='') if ($date_start && $date_end) { - print ' ('.$langs->trans('DateFromTo',dolibarr_print_date($date_start, $format, false, $outputlangs),dolibarr_print_date($date_end, $format, false, $outputlangs)).')'; + print ' ('.$outputlangs->trans('DateFromTo',dolibarr_print_date($date_start, $format, false, $outputlangs),dolibarr_print_date($date_end, $format, false, $outputlangs)).')'; } if ($date_start && ! $date_end) { - print ' ('.$langs->trans('DateFrom',dolibarr_print_date($date_start, $format, false, $outputlangs)).')'; + print ' ('.$outputlangs->trans('DateFrom',dolibarr_print_date($date_start, $format, false, $outputlangs)).')'; } if (! $date_start && $date_end) { - print ' ('.$langs->trans('DateUntil',dolibarr_print_date($date_end, $format, false, $outputlangs)).')'; + print ' ('.$outputlangs->trans('DateUntil',dolibarr_print_date($date_end, $format, false, $outputlangs)).')'; } } diff --git a/htdocs/lib/pdf.lib.php b/htdocs/lib/pdf.lib.php index 95d3dabe5c9..179bd48f7bf 100644 --- a/htdocs/lib/pdf.lib.php +++ b/htdocs/lib/pdf.lib.php @@ -161,7 +161,7 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass //print 'e'.$ligne.'t'.dol_nboflines($ligne);exit; $posy=$marge_basse + ($nbofligne*3) + ($ligne1?3:0) + ($ligne2?3:0); - if ($ligne) + if ($ligne) // Free text { $pdf->SetXY($marge_gauche,-$posy); $pdf->MultiCell(190, 3, $ligne, 0, 'L', 0); @@ -191,7 +191,7 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass /** - * \brief Return line description translated in outputlangs but encoded in UTF8 + * \brief Return line description translated in outputlangs and encoded in UTF8 * \param line Line to format * \param outputlang Object lang for output */ @@ -256,30 +256,42 @@ function pdf_getlinedesc($line,$outputlangs) if ($prodser->ref) { $prefix_prodserv = ""; - if($prodser->isservice()) + if ($conf->global->PRODUCT_ADD_TYPE_IN_DOCUMENTS) // In standard mode, we do not show this { - $prefix_prodserv = $outputlangs->transnoentitiesnoconv("Service")." "; + if($prodser->isservice()) + { + $prefix_prodserv = $outputlangs->transnoentitiesnoconv("Service")." "; + } + else + { + $prefix_prodserv = $outputlangs->transnoentitiesnoconv("Product")." "; + } } - else - { - $prefix_prodserv = $outputlangs->transnoentitiesnoconv("Product")." "; - } - + $libelleproduitservice=$prefix_prodserv.$prodser->ref." - ".$libelleproduitservice; } - } $libelleproduitservice=dol_htmlentitiesbr($libelleproduitservice,1); if ($line->date_start || $line->date_end) { - // Affichage duree si il y en a une - $period="("; - if ($line->date_start) $period.=$outputlangs->transnoentitiesnoconv("From")." ".dolibarr_print_date($line->date_start,'',false); - if ($period) $period.=" "; - if ($line->date_end) $period.=$outputlangs->transnoentitiesnoconv("to")." ".dolibarr_print_date($line->date_end,'',false); + // Show duration if exists + if ($line->date_start && $line->date_end) + { + $period='('.$outputlangs->transnoentitiesnoconv('DateFromTo',dolibarr_print_date($line->date_start, $format, false, $outputlangs),dolibarr_print_date($line->date_end, $format, false, $outputlangs)).')'; + } + if ($line->date_start && ! $line->date_end) + { + $period='('.$outputlangs->transnoentitiesnoconv('DateFrom',dolibarr_print_date($line->date_start, $format, false, $outputlangs)).')'; + } + if (! $line->date_start && $line->date_end) + { + $period='('.$outputlangs->transnoentitiesnoconv('DateUntil',dolibarr_print_date($line->date_end, $format, false, $outputlangs)).')'; + } $period.=")"; + //print '>'.$outputlangs->charset_output.','.$period; $libelleproduitservice.="
".dol_htmlentitiesbr($period,1); + //print $libelleproduitservice; } return $libelleproduitservice; }