Fix: Apercu sur bon de rceptions de livraison
This commit is contained in:
parent
b2bd442db9
commit
ffe32f655c
@ -61,7 +61,7 @@ if ($_GET["action"] == 'specimen')
|
||||
|
||||
$obj = new $classname($db);
|
||||
|
||||
if ($obj->write_pdf_file($commande) > 0)
|
||||
if ($obj->write_file($commande) > 0)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=commande&file=SPECIMEN.pdf");
|
||||
return;
|
||||
|
||||
@ -21,7 +21,6 @@
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
@ -64,7 +64,7 @@ if ($_GET["action"] == 'specimen')
|
||||
|
||||
$obj = new $classname($db);
|
||||
|
||||
if ($obj->write_pdf_file($facture,$langs) > 0)
|
||||
if ($obj->write_file($facture,$langs) > 0)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=facture&file=SPECIMEN.pdf");
|
||||
return;
|
||||
|
||||
@ -62,7 +62,7 @@ if ($_GET["action"] == 'specimen')
|
||||
|
||||
$obj = new $classname($db);
|
||||
|
||||
if ($obj->write_pdf_file($inter,$langs) > 0)
|
||||
if ($obj->write_file($inter,$langs) > 0)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=ficheinter&file=SPECIMEN.pdf");
|
||||
return;
|
||||
|
||||
@ -62,7 +62,7 @@ if ($_GET["action"] == 'specimen')
|
||||
|
||||
$obj = new $classname($db);
|
||||
|
||||
if ($obj->write_pdf_file($commande,$langs) > 0)
|
||||
if ($obj->write_file($commande,$langs) > 0)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=commande_fournisseur&file=SPECIMEN.pdf");
|
||||
return;
|
||||
|
||||
@ -21,7 +21,6 @@
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -46,6 +45,35 @@ if (!$user->admin) accessforbidden();
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
if ($_GET["action"] == 'specimen')
|
||||
{
|
||||
$modele=$_GET["module"];
|
||||
|
||||
$exp = new Expedition($db);
|
||||
$exp->initAsSpecimen();
|
||||
$exp->fetch_commande();
|
||||
|
||||
// Charge le modele
|
||||
$dir = DOL_DOCUMENT_ROOT . "/livraison/mods/pdf/";
|
||||
$file = "pdf_".$modele.".modules.php";
|
||||
if (file_exists($dir.$file))
|
||||
{
|
||||
$classname = "pdf_".$modele;
|
||||
require_once($dir.$file);
|
||||
|
||||
$obj = new $classname($db);
|
||||
|
||||
if ($obj->write_file($exp,$langs) > 0)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=livraison&file=SPECIMEN.pdf");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorModuleNotFound").'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($_GET["action"] == 'set')
|
||||
{
|
||||
@ -166,47 +194,47 @@ if ($handle)
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
if (substr($file, 0, 14) == 'mod_livraison_' && substr($file, strlen($file)-3, 3) == 'php')
|
||||
{
|
||||
$file = substr($file, 0, strlen($file)-4);
|
||||
{
|
||||
$file = substr($file, 0, strlen($file)-4);
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT ."/livraison/mods/".$file.".php");
|
||||
require_once(DOL_DOCUMENT_ROOT ."/livraison/mods/".$file.".php");
|
||||
|
||||
$module = new $file;
|
||||
$module = new $file;
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$module->nom."</td><td>\n";
|
||||
print $module->info();
|
||||
print '</td>';
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$module->nom."</td><td>\n";
|
||||
print $module->info();
|
||||
print '</td>';
|
||||
|
||||
// Affiche example
|
||||
print '<td nowrap="nowrap">'.$module->getExample().'</td>';
|
||||
|
||||
print '<td align="center">';
|
||||
if ($conf->global->LIVRAISON_ADDON == "$file")
|
||||
{
|
||||
print img_tick($langs->trans("Activated"));
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.$file.'" alt="'.$langs->trans("Default").'">'.$langs->trans("Default").'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
$livraison=new Livraison($db);
|
||||
|
||||
// Info
|
||||
$htmltooltip='';
|
||||
$nextval=$module->getNextValue($mysoc,$livraison);
|
||||
if ($nextval != $langs->trans("NotAvailable"))
|
||||
{
|
||||
$htmltooltip='<b>'.$langs->trans("NextValue").'</b>: '.$nextval;
|
||||
}
|
||||
print '<td align="center">';
|
||||
print $html->textwithhelp('',$htmltooltip,1,0);
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
}
|
||||
// Affiche example
|
||||
print '<td nowrap="nowrap">'.$module->getExample().'</td>';
|
||||
|
||||
print '<td align="center">';
|
||||
if ($conf->global->LIVRAISON_ADDON == "$file")
|
||||
{
|
||||
print img_tick($langs->trans("Activated"));
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.$file.'" alt="'.$langs->trans("Default").'">'.$langs->trans("Default").'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
$livraison=new Livraison($db);
|
||||
|
||||
// Info
|
||||
$htmltooltip='';
|
||||
$nextval=$module->getNextValue($mysoc,$livraison);
|
||||
if ($nextval != $langs->trans("NotAvailable"))
|
||||
{
|
||||
$htmltooltip='<b>'.$langs->trans("NextValue").'</b>: '.$nextval;
|
||||
}
|
||||
print '<td align="center">';
|
||||
print $html->textwithhelp('',$htmltooltip,1,0);
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
@ -272,9 +300,9 @@ if(is_dir($dir))
|
||||
print $name;
|
||||
print "</td><td>\n";
|
||||
require_once($dir.$file);
|
||||
$obj = new $classname($db);
|
||||
$module = new $classname($db);
|
||||
|
||||
print $obj->description;
|
||||
print $module->description;
|
||||
print '</td>';
|
||||
|
||||
// Activ
|
||||
|
||||
@ -64,7 +64,7 @@ if ($_GET["action"] == 'specimen')
|
||||
|
||||
$module = new $classname($db);
|
||||
|
||||
if ($module->write_pdf_file($propal) > 0)
|
||||
if ($module->write_file($propal) > 0)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=propal&file=SPECIMEN.pdf");
|
||||
return;
|
||||
|
||||
@ -197,7 +197,7 @@ class BordereauChequeBlochet
|
||||
\param month mois du rapport
|
||||
\param year annee du rapport
|
||||
*/
|
||||
function write_pdf_file($_dir, $number)
|
||||
function write_file($_dir, $number)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
|
||||
@ -418,7 +418,7 @@ class RemiseCheque
|
||||
|
||||
$pdf->account = &$account;
|
||||
|
||||
$pdf->write_pdf_file(DOL_DATA_ROOT.'/compta/bordereau', $this->number );
|
||||
$pdf->write_file(DOL_DATA_ROOT.'/compta/bordereau', $this->number );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -55,7 +55,7 @@ if (! $year) { $year=date("Y"); }
|
||||
if ($_POST["action"] == 'gen')
|
||||
{
|
||||
$rap = new pdf_paiement($db);
|
||||
$rap->write_pdf_file($dir, $_POST["remonth"], $_POST["reyear"]);
|
||||
$rap->write_file($dir, $_POST["remonth"], $_POST["reyear"]);
|
||||
|
||||
$year = $_POST["reyear"];
|
||||
}
|
||||
|
||||
@ -79,7 +79,7 @@ class methode_expedition
|
||||
}
|
||||
}
|
||||
|
||||
function write_pdf_file($id)
|
||||
function write_file($id)
|
||||
{
|
||||
global $user;
|
||||
$propale = new Propal($this->db,"",$id);
|
||||
|
||||
@ -165,7 +165,7 @@ function supplier_order_pdf_create($db, $comid, $modele='',$outputlangs='')
|
||||
|
||||
$obj = new $classname($db);
|
||||
|
||||
if ($obj->write_pdf_file($comid,$outputlangs) > 0)
|
||||
if ($obj->write_file($comid,$outputlangs) > 0)
|
||||
{
|
||||
// on supprime l'image correspondant au preview
|
||||
supplier_order_delete_preview($db, $comid);
|
||||
|
||||
@ -123,7 +123,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
\remarks MAIN_INFO_TVAINTRA
|
||||
\remarks MAIN_INFO_LOGO
|
||||
*/
|
||||
function write_pdf_file($com,$outputlangs='')
|
||||
function write_file($com,$outputlangs='')
|
||||
{
|
||||
global $user,$langs,$conf;
|
||||
|
||||
|
||||
@ -199,7 +199,7 @@ function commande_pdf_create($db, $id, $modele='', $outputlangs='')
|
||||
|
||||
$obj = new $classname($db);
|
||||
|
||||
if ($obj->write_pdf_file($id, $outputlangs) > 0)
|
||||
if ($obj->write_file($id, $outputlangs) > 0)
|
||||
{
|
||||
// on supprime l'image correspondant au preview
|
||||
commande_delete_preview($db, $id);
|
||||
|
||||
@ -74,7 +74,7 @@ class pdf_edison extends ModelePDFCommandes
|
||||
\param id id de la propale à générer
|
||||
\return int 1=ok, 0=ko
|
||||
*/
|
||||
function write_pdf_file($com,$outputlangs='')
|
||||
function write_file($com,$outputlangs='')
|
||||
{
|
||||
global $user,$conf,$langs,$mysco;
|
||||
|
||||
|
||||
@ -101,7 +101,7 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
\param com Objet commande à générer
|
||||
\return int 1=ok, 0=ko
|
||||
*/
|
||||
function write_pdf_file($com,$outputlangs='')
|
||||
function write_file($com,$outputlangs='')
|
||||
{
|
||||
global $user,$langs,$conf;
|
||||
|
||||
|
||||
@ -192,7 +192,7 @@ function facture_pdf_create($db, $id, $message='', $modele='', $outputlangs='')
|
||||
$obj = new $classname($db);
|
||||
$obj->message = $message;
|
||||
|
||||
if ($obj->write_pdf_file($id, $outputlangs) > 0)
|
||||
if ($obj->write_file($id, $outputlangs) > 0)
|
||||
{
|
||||
// Succès de la création de la facture. On génère le fichier meta
|
||||
facture_meta_create($db, $id);
|
||||
|
||||
@ -101,7 +101,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
* \param fac Objet facture à générer (ou id si ancienne methode)
|
||||
* \return int 1=ok, 0=ko
|
||||
*/
|
||||
function write_pdf_file($fac,$outputlangs='')
|
||||
function write_file($fac,$outputlangs='')
|
||||
{
|
||||
global $user,$langs,$conf;
|
||||
|
||||
|
||||
@ -77,7 +77,7 @@ class pdf_huitre extends ModelePDFFactures
|
||||
* \param fac Objet facture à générer (ou id si ancienne methode)
|
||||
* \return int 1=ok, 0=ko
|
||||
*/
|
||||
function write_pdf_file($fac,$outputlangs='')
|
||||
function write_file($fac,$outputlangs='')
|
||||
{
|
||||
global $user,$langs,$conf;
|
||||
|
||||
|
||||
@ -97,7 +97,7 @@ class pdf_oursin extends ModelePDFFactures
|
||||
* \remarks MAIN_INFO_CAPITAL
|
||||
* \remarks MAIN_INFO_TVAINTRA
|
||||
*/
|
||||
function write_pdf_file($fac,$outputlangs='')
|
||||
function write_file($fac,$outputlangs='')
|
||||
{
|
||||
global $user,$langs,$conf;
|
||||
|
||||
|
||||
@ -192,7 +192,7 @@ function fichinter_pdf_create($db, $id, $modele='', $outputlangs='')
|
||||
|
||||
$obj = new $classname($db);
|
||||
|
||||
if ($obj->write_pdf_file($id,$outputlangs) > 0)
|
||||
if ($obj->write_file($id,$outputlangs) > 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -18,8 +18,6 @@
|
||||
* or see http://www.gnu.org/
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -79,7 +77,7 @@ class pdf_soleil extends ModelePDFFicheinter
|
||||
\param fichinter Object fichinter
|
||||
\return int 1=ok, 0=ko
|
||||
*/
|
||||
function write_pdf_file($fichinter,$outputlangs='')
|
||||
function write_file($fichinter,$outputlangs='')
|
||||
{
|
||||
global $user,$langs,$conf,$mysoc;
|
||||
|
||||
|
||||
@ -195,7 +195,7 @@ function propale_pdf_create($db, $id, $modele='', $outputlangs='')
|
||||
|
||||
$obj = new $classname($db);
|
||||
|
||||
if ($obj->write_pdf_file($id, $outputlangs) > 0)
|
||||
if ($obj->write_file($id, $outputlangs) > 0)
|
||||
{
|
||||
// on supprime l'image correspondant au preview
|
||||
propale_delete_preview($db, $id);
|
||||
|
||||
@ -99,7 +99,7 @@ class pdf_propale_azur extends ModelePDFPropales
|
||||
\param propale Objet propal à générer (ou id si ancienne methode)
|
||||
\return int 1=ok, 0=ko
|
||||
*/
|
||||
function write_pdf_file($propale,$outputlangs='')
|
||||
function write_file($propale,$outputlangs='')
|
||||
{
|
||||
global $user,$langs,$conf;
|
||||
|
||||
|
||||
@ -77,7 +77,7 @@ class pdf_propale_bleu extends ModelePDFPropales
|
||||
\param propale Objet propal
|
||||
\return int 1=ok, 0=ko
|
||||
*/
|
||||
function write_pdf_file($propale,$outputlangs='')
|
||||
function write_file($propale,$outputlangs='')
|
||||
{
|
||||
global $user,$conf,$langs,$mysoc;
|
||||
|
||||
|
||||
@ -78,7 +78,7 @@ class pdf_propale_jaune extends ModelePDFPropales
|
||||
\param propale Objet propal
|
||||
\return int 1=ok, 0=ko
|
||||
*/
|
||||
function write_pdf_file($propale,$outputlangs='')
|
||||
function write_file($propale,$outputlangs='')
|
||||
{
|
||||
global $user,$conf,$langs;
|
||||
|
||||
|
||||
@ -81,7 +81,7 @@ class pdf_propale_rouge extends ModelePDFPropales
|
||||
\param propale Objet propal
|
||||
\return int 1=ok, 0=ko
|
||||
*/
|
||||
function write_pdf_file($propale,$outputlangs='')
|
||||
function write_file($propale,$outputlangs='')
|
||||
{
|
||||
global $user,$conf,$langs;
|
||||
|
||||
|
||||
@ -79,7 +79,7 @@ class pdf_propale_vert extends ModelePDFPropales
|
||||
\param propale Objet propal
|
||||
\return int 1=ok, 0=ko
|
||||
*/
|
||||
function write_pdf_file($propale,$outputlangs='')
|
||||
function write_file($propale,$outputlangs='')
|
||||
{
|
||||
global $user,$conf,$langs;
|
||||
|
||||
|
||||
@ -166,7 +166,7 @@ class pdf_paiement extends FPDF
|
||||
\param month mois du rapport
|
||||
\param year annee du rapport
|
||||
*/
|
||||
function write_pdf_file($_dir, $month, $year)
|
||||
function write_file($_dir, $month, $year)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
@ -218,7 +218,7 @@ class pdf_paiement extends FPDF
|
||||
$sql .= " AND date_format(p.datep, '%Y%m') = " . sprintf("%04d%02d",$year,$month);
|
||||
$sql .= " ORDER BY p.datep ASC, pf.fk_paiement ASC";
|
||||
|
||||
dolibarr_syslog("pdf_paiement::write_pdf_file sql=".$sql);
|
||||
dolibarr_syslog("pdf_paiement::write_file sql=".$sql);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005-2006 Regis Houssin <regis.houssin@cap-networks.com>
|
||||
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2006-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -19,7 +19,6 @@
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -207,7 +206,7 @@ class Livraison extends CommonObject
|
||||
* Lit un bon de livraison
|
||||
*
|
||||
*/
|
||||
function fetch ($id)
|
||||
function fetch($id)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@ -219,7 +218,6 @@ class Livraison extends CommonObject
|
||||
$sql .= " WHERE l.rowid = ".$id." AND c.rowid = l.fk_commande";
|
||||
|
||||
$result = $this->db->query($sql) ;
|
||||
|
||||
if ( $result )
|
||||
{
|
||||
$obj = $this->db->fetch_object($result);
|
||||
|
||||
@ -180,7 +180,7 @@ function delivery_order_pdf_create($db, $deliveryid, $modele='', $outputlangs=''
|
||||
|
||||
$obj = new $classname($db);
|
||||
|
||||
if ($obj->write_pdf_file($deliveryid,$outputlangs) > 0)
|
||||
if ($obj->write_file($deliveryid,$outputlangs) > 0)
|
||||
{
|
||||
// on supprime l'image correspondant au preview
|
||||
delivery_order_delete_preview($db, $deliveryid);
|
||||
|
||||
@ -20,7 +20,6 @@
|
||||
* or see http://www.gnu.org/
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -71,21 +70,37 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
|
||||
|
||||
/**
|
||||
\brief Fonction générant le bon de livraison sur le disque
|
||||
\param id id du bon de livraison à générer
|
||||
\return int 1=ok, 0=ko
|
||||
\param delivery Object livraison à générer
|
||||
\return int 1=ok, 0=ko
|
||||
*/
|
||||
function write_pdf_file($id)
|
||||
function write_file($delivery)
|
||||
{
|
||||
global $user,$conf,$langs;
|
||||
|
||||
$delivery = new Livraison($this->db);
|
||||
if ($delivery->fetch($id))
|
||||
{
|
||||
$deliveryref = sanitize_string($delivery->ref);
|
||||
if ($conf->livraison->dir_output)
|
||||
{
|
||||
|
||||
$dir = $conf->livraison->dir_output . "/" . $deliveryref ;
|
||||
global $user,$conf,$langs;
|
||||
|
||||
$langs->load("main");
|
||||
$langs->load("bills");
|
||||
$langs->load("products");
|
||||
$langs->load("deliveries");
|
||||
|
||||
if ($conf->livraison->dir_output)
|
||||
{
|
||||
// If $delivery is id instead of object
|
||||
if (! is_object($delivery))
|
||||
{
|
||||
$id = $delivery;
|
||||
$delivery = new Livraison($this->db);
|
||||
$delivery->fetch($id);
|
||||
$delivery->id = $id;
|
||||
if ($result < 0)
|
||||
{
|
||||
dolibarr_print_error($db,$delivery->error);
|
||||
}
|
||||
}
|
||||
|
||||
$deliveryref = sanitize_string($delivery->ref);
|
||||
$dir = $conf->livraison->dir_output;
|
||||
if (! eregi('specimen',$deliveryref)) $dir.= "/" . $deliveryref;
|
||||
$file = $dir . "/" . $deliveryref . ".pdf";
|
||||
|
||||
if (! file_exists($dir))
|
||||
{
|
||||
@ -95,17 +110,17 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$langs->transnoentities("ErrorConstantNotDefined","LIVRAISON_OUTPUTDIR");
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$langs->transnoentities("ErrorConstantNotDefined","LIVRAISON_OUTPUTDIR");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
$file = $dir . "/" . $deliveryref . ".pdf";
|
||||
$file = $dir . "/" . $deliveryref . ".pdf";
|
||||
|
||||
if (file_exists($dir))
|
||||
{
|
||||
if (file_exists($dir))
|
||||
{
|
||||
// Protection et encryption du pdf
|
||||
if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
||||
{
|
||||
@ -243,7 +258,6 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
|
||||
$pdf->Output($file);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@ -19,7 +19,6 @@
|
||||
* or see http://www.gnu.org/
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -110,24 +109,10 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
|
||||
/**
|
||||
\brief Fonction générant la commande sur le disque
|
||||
\param id Id de la commande à générer
|
||||
\param delivery Object livraison à générer
|
||||
\return int 1=ok, 0=ko
|
||||
\remarks Variables utilisées
|
||||
\remarks MAIN_INFO_SOCIETE_NOM
|
||||
\remarks MAIN_INFO_ADRESSE
|
||||
\remarks MAIN_INFO_CP
|
||||
\remarks MAIN_INFO_VILLE
|
||||
\remarks MAIN_INFO_TEL
|
||||
\remarks MAIN_INFO_FAX
|
||||
\remarks MAIN_INFO_WEB
|
||||
\remarks MAIN_INFO_SIRET
|
||||
\remarks MAIN_INFO_SIREN
|
||||
\remarks MAIN_INFO_RCS
|
||||
\remarks MAIN_INFO_CAPITAL
|
||||
\remarks MAIN_INFO_TVAINTRA
|
||||
\remarks MAIN_INFO_LOGO
|
||||
*/
|
||||
function write_pdf_file($id)
|
||||
function write_file($delivery)
|
||||
{
|
||||
global $user,$langs,$conf;
|
||||
|
||||
@ -138,16 +123,25 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
|
||||
if ($conf->livraison->dir_output)
|
||||
{
|
||||
$delivery = new Livraison($this->db);
|
||||
$delivery->fetch($id);
|
||||
$delivery->id = $id;
|
||||
$lignesdelivery = $delivery->fetch_lignes();
|
||||
|
||||
// If $delivery is id instead of object
|
||||
if (! is_object($delivery))
|
||||
{
|
||||
$id = $delivery;
|
||||
$delivery = new Livraison($this->db);
|
||||
$delivery->fetch($id);
|
||||
$delivery->id = $id;
|
||||
if ($result < 0)
|
||||
{
|
||||
dolibarr_print_error($db,$delivery->error);
|
||||
}
|
||||
}
|
||||
|
||||
$nblignes = sizeof($lignesdelivery);
|
||||
|
||||
$deliveryref = sanitize_string($delivery->ref);
|
||||
$dir = $conf->livraison->dir_output . "/" . $deliveryref;
|
||||
$file = $dir . "/" . $deliveryref . ".pdf";
|
||||
$deliveryref = sanitize_string($delivery->ref);
|
||||
$dir = $conf->livraison->dir_output;
|
||||
if (! eregi('specimen',$deliveryref)) $dir.= "/" . $deliveryref;
|
||||
$file = $dir . "/" . $deliveryref . ".pdf";
|
||||
|
||||
if (! file_exists($dir))
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user