Fix: UTF encoding in memeber card export

This commit is contained in:
Laurent Destailleur 2009-03-12 23:14:35 +00:00
parent 017a947c82
commit 136d69dbfb
2 changed files with 21 additions and 17 deletions

View File

@ -49,7 +49,7 @@ $patterns = array (
'/%ANNEE%/' '/%ANNEE%/'
); );
$dir = $conf->adherent->dir_tmp; $dir = $conf->adherent->dir_tmp;
$file = $dir . "/tmpcard.pdf"; $file = $dir . "/tmpcard.pdf";
@ -61,7 +61,7 @@ if (! file_exists($dir))
return 0; return 0;
} }
} }
$pdf = new PDF_card('CARD', 1, 1); $pdf = new PDF_card('CARD', 1, 1);
$pdf->Open(); $pdf->Open();
@ -74,7 +74,7 @@ if (!isset($annee)){
} }
// requete en prenant que les adherents a jour de cotisation // requete en prenant que les adherents a jour de cotisation
$sql = "SELECT d.rowid, d.prenom, d.nom, d.societe, ".$db->pdate("d.datefin")." as datefin,"; $sql = "SELECT d.rowid, d.prenom, d.nom, d.societe, d.datefin,";
$sql.= " d.adresse, d.cp, d.ville, d.naiss, d.email, d.photo,"; $sql.= " d.adresse, d.cp, d.ville, d.naiss, d.email, d.photo,";
$sql.= " t.libelle as type,"; $sql.= " t.libelle as type,";
$sql.= " p.libelle as pays"; $sql.= " p.libelle as pays";
@ -91,16 +91,17 @@ if ($result)
while ($i < $num) while ($i < $num)
{ {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
// attribut a remplacer
// List of values to scan for a replacement
$replace = array ( $replace = array (
ucfirst(strtolower($objp->prenom)), $objp->prenom,
strtoupper($objp->nom), $objp->nom,
"http://".$_SERVER["SERVER_NAME"]."/", "http://".$_SERVER["SERVER_NAME"]."/",
$objp->societe, $objp->societe,
ucwords(strtolower($objp->adresse)), $objp->adresse,
$objp->cp, $objp->cp,
strtoupper($objp->ville), $objp->ville,
ucfirst(strtolower($objp->pays)), $objp->pays,
$objp->email, $objp->email,
$objp->naiss, $objp->naiss,
$objp->photo, $objp->photo,
@ -118,19 +119,19 @@ if ($result)
// Output to http strem // Output to http strem
$pdf->Output($file); $pdf->Output($file);
if (! empty($conf->global->MAIN_UMASK)) if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK)); @chmod($file, octdec($conf->global->MAIN_UMASK));
$db->close(); $db->close();
clearstatcache(); clearstatcache();
$attachment=true; $attachment=true;
if (! empty($conf->global->MAIN_DISABLE_FORCE_SAVEAS)) $attachment=false; if (! empty($conf->global->MAIN_DISABLE_FORCE_SAVEAS)) $attachment=false;
$filename='tmpcards.pdf'; $filename='tmpcards.pdf';
$type=dol_mimetype($filename); $type=dol_mimetype($filename);
if ($encoding) header('Content-Encoding: '.$encoding); if ($encoding) header('Content-Encoding: '.$encoding);
if ($type) header('Content-Type: '.$type); if ($type) header('Content-Type: '.$type);
if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"'); if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"');

View File

@ -279,7 +279,8 @@ class PDF_card extends FPDF {
$_PosX = $this->_Margin_Left+($this->_COUNTX*($this->_Width+$this->_X_Space)); $_PosX = $this->_Margin_Left+($this->_COUNTX*($this->_Width+$this->_X_Space));
$_PosY = $this->_Margin_Top+($this->_COUNTY*($this->_Height+$this->_Y_Space)); $_PosY = $this->_Margin_Top+($this->_COUNTY*($this->_Height+$this->_Y_Space));
if ($this->_Avery_Name == "CARD") { if ($this->_Avery_Name == "CARD")
{
$Tformat=$this->_Avery_Labels["CARD"]; $Tformat=$this->_Avery_Labels["CARD"];
//$this->_Pointille($_PosX,$_PosY,$_PosX+$this->_Width,$_PosY+$this->_Height,0.3,25); //$this->_Pointille($_PosX,$_PosY,$_PosX+$this->_Width,$_PosY+$this->_Height,0.3,25);
$this->_Croix($_PosX,$_PosY,$_PosX+$this->_Width,$_PosY+$this->_Height,0.3,10); $this->_Croix($_PosX,$_PosY,$_PosX+$this->_Width,$_PosY+$this->_Height,0.3,10);
@ -305,9 +306,11 @@ class PDF_card extends FPDF {
$this->Cell($this->_Width, $this->_Line_Height, $outputlangs->convToOutputCharset($footer),0,1,'C'); $this->Cell($this->_Width, $this->_Line_Height, $outputlangs->convToOutputCharset($footer),0,1,'C');
} }
}else{ }
else
{
$this->SetXY($_PosX+3, $_PosY+3); $this->SetXY($_PosX+3, $_PosY+3);
$this->MultiCell($this->_Width, $this->_Line_Height, $texte); $this->MultiCell($this->_Width, $this->_Line_Height, $outputlangs->convToOutputCharset($texte));
} }
$this->_COUNTY++; $this->_COUNTY++;