[-] BO : fixed bug on Invoice generation in AdminInvoices

This commit is contained in:
aFolletete
2012-01-02 17:30:11 +00:00
parent fca37421ac
commit 8923947406
6 changed files with 73 additions and 49 deletions
+18 -18
View File
@@ -32,14 +32,14 @@ class PDFCore
{
public $filename;
public $pdf_renderer;
public $objects;
public $template;
public $objects;
public $template;
const TEMPLATE_INVOICE = 'Invoice';
const TEMPLATE_ORDER_RETURN = 'OrderReturn';
const TEMPLATE_ORDER_SLIP = 'OrderSlip';
const TEMPLATE_DELIVERY_SLIP = 'DeliverySlip';
const TEMPLATE_SUPPLY_ORDER_FORM = 'SupplyOrderForm';
const TEMPLATE_INVOICE = 'Invoice';
const TEMPLATE_ORDER_RETURN = 'OrderReturn';
const TEMPLATE_ORDER_SLIP = 'OrderSlip';
const TEMPLATE_DELIVERY_SLIP = 'DeliverySlip';
const TEMPLATE_SUPPLY_ORDER_FORM = 'SupplyOrderForm';
public function __construct($objects, $template, $smarty)
{
@@ -48,26 +48,26 @@ class PDFCore
$this->smarty = $smarty;
$this->objects = $objects;
if (!($objects instanceof Iterator))
if (!($objects instanceof Iterator) && !is_array($objects))
$this->objects = array($objects);
}
public function render($display = true)
{
$render = false;
$render = false;
$this->pdf_renderer->setFontForLang('fr');
foreach ($this->objects as $object)
{
$template = $this->getTemplateObject($object);
if (!$template)
continue;
$template = $this->getTemplateObject($object);
if (!$template)
continue;
if (empty($this->filename))
{
$this->filename = $template->getFilename();
if (count($this->objects) > 1)
$this->filename = $template->getBulkFilename();
}
if (empty($this->filename))
{
$this->filename = $template->getFilename();
if (count($this->objects) > 1)
$this->filename = $template->getBulkFilename();
}
$template->assignHookData($object);