Fix: Call Image on this instead of pdf.
Fix: Missing parameter for photo.
This commit is contained in:
parent
4e2bce1600
commit
5551a5d4b4
@ -197,8 +197,8 @@ class pdf_standard
|
|||||||
// Center
|
// Center
|
||||||
if ($textright=='') // Only a left part
|
if ($textright=='') // Only a left part
|
||||||
{
|
{
|
||||||
if ($textleft == '%LOGO%' && $logo) $this->Image($logo,$_PosX+2,$_PosY+3+$this->_Line_Height,20);
|
if ($textleft == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+2,$_PosY+3+$this->_Line_Height,20);
|
||||||
else if ($textleft == '%PHOTO%' && $photo) $this->Image($photo,$_PosX+2,$_PosY+3+$this->_Line_Height,20);
|
else if ($textleft == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+2,$_PosY+3+$this->_Line_Height,20);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$pdf->SetXY($_PosX+3, $_PosY+3+$this->_Line_Height);
|
$pdf->SetXY($_PosX+3, $_PosY+3+$this->_Line_Height);
|
||||||
@ -232,8 +232,8 @@ class pdf_standard
|
|||||||
}
|
}
|
||||||
else // Only a right part
|
else // Only a right part
|
||||||
{
|
{
|
||||||
if ($textright == '%LOGO%' && $logo) $this->Image($logo,$_PosX+$this->_Width-21,$_PosY+1,20);
|
if ($textright == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+$this->_Width-21,$_PosY+1,20);
|
||||||
else if ($textright == '%PHOTO%' && $photo) $this->Image($photo,$_PosX+$this->_Width-21,$_PosY+1,20);
|
else if ($textright == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+$this->_Width-21,$_PosY+1,20);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$pdf->SetXY($_PosX+2, $_PosY+3+$this->_Line_Height);
|
$pdf->SetXY($_PosX+2, $_PosY+3+$this->_Line_Height);
|
||||||
@ -435,7 +435,7 @@ class pdf_standard
|
|||||||
$outputlangs->load("companies");
|
$outputlangs->load("companies");
|
||||||
$outputlangs->load("admin");
|
$outputlangs->load("admin");
|
||||||
$outputlangs->load("members");
|
$outputlangs->load("members");
|
||||||
|
|
||||||
if (empty($mode) || $mode == 'member')
|
if (empty($mode) || $mode == 'member')
|
||||||
{
|
{
|
||||||
$title=$outputlangs->transnoentities('MembersCards');
|
$title=$outputlangs->transnoentities('MembersCards');
|
||||||
|
|||||||
@ -122,7 +122,7 @@ class pdf_standardlabel
|
|||||||
* @param string $footer Footer
|
* @param string $footer Footer
|
||||||
* @param Translate $outputlangs Output langs
|
* @param Translate $outputlangs Output langs
|
||||||
* @param string $textright Text right
|
* @param string $textright Text right
|
||||||
* @param string $photo Photo (path to image file used as replacement for key %PHOTOS% into left, right header or footer text)
|
* @param string $photo Photo (full path to image file used as replacement for key %PHOTOS% into left, right, header or footer text)
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function Add_PDF_card(&$pdf,$textleft,$header,$footer,$outputlangs,$textright='',$photo='')
|
function Add_PDF_card(&$pdf,$textleft,$header,$footer,$outputlangs,$textright='',$photo='')
|
||||||
@ -185,8 +185,8 @@ class pdf_standardlabel
|
|||||||
// Center
|
// Center
|
||||||
if ($textright=='') // Only a left part
|
if ($textright=='') // Only a left part
|
||||||
{
|
{
|
||||||
if ($textleft == '%LOGO%' && $logo) $this->Image($logo,$_PosX+2,$_PosY+3+$this->_Line_Height,20);
|
if ($textleft == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+2,$_PosY+3+$this->_Line_Height,20);
|
||||||
else if ($textleft == '%PHOTO%' && $photo) $this->Image($photo,$_PosX+2,$_PosY+3+$this->_Line_Height,20);
|
else if ($textleft == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+2,$_PosY+3+$this->_Line_Height,20);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$pdf->SetXY($_PosX+3, $_PosY+3+$this->_Line_Height);
|
$pdf->SetXY($_PosX+3, $_PosY+3+$this->_Line_Height);
|
||||||
@ -219,8 +219,8 @@ class pdf_standardlabel
|
|||||||
}
|
}
|
||||||
else // Only a right part
|
else // Only a right part
|
||||||
{
|
{
|
||||||
if ($textright == '%LOGO%' && $logo) $this->Image($logo,$_PosX+$this->_Width-21,$_PosY+1,20);
|
if ($textright == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+$this->_Width-21,$_PosY+1,20);
|
||||||
else if ($textright == '%PHOTO%' && $photo) $this->Image($photo,$_PosX+$this->_Width-21,$_PosY+1,20);
|
else if ($textright == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+$this->_Width-21,$_PosY+1,20);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$pdf->SetXY($_PosX+2, $_PosY+3+$this->_Line_Height);
|
$pdf->SetXY($_PosX+2, $_PosY+3+$this->_Line_Height);
|
||||||
@ -397,7 +397,7 @@ class pdf_standardlabel
|
|||||||
/**
|
/**
|
||||||
* Function to build PDF on disk, then output on HTTP strem.
|
* Function to build PDF on disk, then output on HTTP strem.
|
||||||
*
|
*
|
||||||
* @param array $arrayofrecords Array of record informations (array('textleft'=>,'textheader'=>, ...'id'=>,'photo'=>)
|
* @param array $arrayofrecords Array of record informations (array('textleft'=>,'textheader'=>, ..., 'id'=>,'photo'=>)
|
||||||
* @param Translate $outputlangs Lang object for output language
|
* @param Translate $outputlangs Lang object for output language
|
||||||
* @param string $srctemplatepath Full path of source filename for generator using a template file
|
* @param string $srctemplatepath Full path of source filename for generator using a template file
|
||||||
* @param string $outputdir Output directory for pdf file
|
* @param string $outputdir Output directory for pdf file
|
||||||
@ -476,7 +476,7 @@ class pdf_standardlabel
|
|||||||
foreach($arrayofrecords as $val)
|
foreach($arrayofrecords as $val)
|
||||||
{
|
{
|
||||||
// imprime le texte specifique sur la carte
|
// imprime le texte specifique sur la carte
|
||||||
$this->Add_PDF_card($pdf,$val['textleft'],$val['textheader'],$val['textfooter'],$langs,$val['textright'],$val['id'],$val['photo']);
|
$this->Add_PDF_card($pdf,$val['textleft'],$val['textheader'],$val['textfooter'],$langs,$val['textright'],$val['photo']);
|
||||||
}
|
}
|
||||||
|
|
||||||
//$pdf->SetXY(10, 295);
|
//$pdf->SetXY(10, 295);
|
||||||
|
|||||||
@ -63,25 +63,25 @@ class ModelePDFLabels
|
|||||||
* Create a document onto disk accordign to template module
|
* Create a document onto disk accordign to template module
|
||||||
*
|
*
|
||||||
* @param DoliDB $db Database handler
|
* @param DoliDB $db Database handler
|
||||||
* @param array $arrayofmembers Array of members
|
* @param array $arrayofrecords Array of records
|
||||||
* @param string $modele Force le modele a utiliser ('' to not force)
|
* @param string $modele Force le modele a utiliser ('' to not force)
|
||||||
* @param Translate $outputlangs Objet lang a utiliser pour traduction
|
* @param Translate $outputlangs Objet lang a utiliser pour traduction
|
||||||
* @param string $outputdir Output directory
|
* @param string $outputdir Output directory
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function members_label_pdf_create($db, $arrayofmembers, $modele, $outputlangs, $outputdir='')
|
function members_label_pdf_create($db, $arrayofrecords, $modele, $outputlangs, $outputdir='')
|
||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf,$langs;
|
||||||
$langs->load("members");
|
$langs->load("members");
|
||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
// Increase limit for PDF build
|
// Increase limit for PDF build
|
||||||
$err=error_reporting();
|
$err=error_reporting();
|
||||||
error_reporting(0);
|
error_reporting(0);
|
||||||
@set_time_limit(120);
|
@set_time_limit(120);
|
||||||
error_reporting($err);
|
error_reporting($err);
|
||||||
|
|
||||||
$code='';
|
$code='';
|
||||||
$srctemplatepath='';
|
$srctemplatepath='';
|
||||||
|
|
||||||
@ -99,7 +99,7 @@ function members_label_pdf_create($db, $arrayofmembers, $modele, $outputlangs, $
|
|||||||
}
|
}
|
||||||
else $code=$modele;
|
else $code=$modele;
|
||||||
$modele='standardlabel';
|
$modele='standardlabel';
|
||||||
|
|
||||||
// If selected modele is a filename template (then $modele="modelname:filename")
|
// If selected modele is a filename template (then $modele="modelname:filename")
|
||||||
$tmp=explode(':',$modele,2);
|
$tmp=explode(':',$modele,2);
|
||||||
if (! empty($tmp[1]))
|
if (! empty($tmp[1]))
|
||||||
@ -108,7 +108,7 @@ function members_label_pdf_create($db, $arrayofmembers, $modele, $outputlangs, $
|
|||||||
$srctemplatepath=$tmp[1];
|
$srctemplatepath=$tmp[1];
|
||||||
}
|
}
|
||||||
else $srctemplatepath=$code;
|
else $srctemplatepath=$code;
|
||||||
|
|
||||||
// Search template files
|
// Search template files
|
||||||
$file=''; $classname=''; $filefound=0;
|
$file=''; $classname=''; $filefound=0;
|
||||||
$dirmodels=array('/');
|
$dirmodels=array('/');
|
||||||
@ -118,7 +118,7 @@ function members_label_pdf_create($db, $arrayofmembers, $modele, $outputlangs, $
|
|||||||
foreach(array('doc','pdf') as $prefix)
|
foreach(array('doc','pdf') as $prefix)
|
||||||
{
|
{
|
||||||
$file = $prefix."_".$modele.".class.php";
|
$file = $prefix."_".$modele.".class.php";
|
||||||
|
|
||||||
// On verifie l'emplacement du modele
|
// On verifie l'emplacement du modele
|
||||||
$file=dol_buildpath($reldir."core/modules/printsheet/doc/".$file,0);
|
$file=dol_buildpath($reldir."core/modules/printsheet/doc/".$file,0);
|
||||||
if (file_exists($file))
|
if (file_exists($file))
|
||||||
@ -130,18 +130,18 @@ function members_label_pdf_create($db, $arrayofmembers, $modele, $outputlangs, $
|
|||||||
}
|
}
|
||||||
if ($filefound) break;
|
if ($filefound) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Charge le modele
|
// Charge le modele
|
||||||
if ($filefound)
|
if ($filefound)
|
||||||
{
|
{
|
||||||
require_once $file;
|
require_once $file;
|
||||||
|
|
||||||
$obj = new $classname($db);
|
$obj = new $classname($db);
|
||||||
|
|
||||||
// We save charset_output to restore it because write_file can change it if needed for
|
// We save charset_output to restore it because write_file can change it if needed for
|
||||||
// output format that does not support UTF8.
|
// output format that does not support UTF8.
|
||||||
$sav_charset_output=$outputlangs->charset_output;
|
$sav_charset_output=$outputlangs->charset_output;
|
||||||
if ($obj->write_file($arrayofmembers, $outputlangs, $srctemplatepath, $outputdir) > 0)
|
if ($obj->write_file($arrayofrecords, $outputlangs, $srctemplatepath, $outputdir) > 0)
|
||||||
{
|
{
|
||||||
$outputlangs->charset_output=$sav_charset_output;
|
$outputlangs->charset_output=$sav_charset_output;
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user