Fix: Debug sur la gnration des bon de livraisons et uniformisation du code

This commit is contained in:
Laurent Destailleur 2006-05-06 21:09:26 +00:00
parent e79f7d1495
commit 8afb758862
12 changed files with 439 additions and 350 deletions

View File

@ -317,8 +317,6 @@ if(is_dir($dir))
$htmltooltip.='<br><b>'.$langs->trans("Height").'</b>: '.$module->page_hauteur;
$htmltooltip.='<br>'.$langs->trans("FeaturesSupported").':';
$htmltooltip.='<br><b>'.$langs->trans("Logo").'</b>: '.yn($module->option_logo);
$htmltooltip.='<br><b>'.$langs->trans("PaymentMode").'</b>: '.yn($module->option_modereg);
$htmltooltip.='<br><b>'.$langs->trans("PaymentConditions").'</b>: '.yn($module->option_condreg);
print '<td align="center" '.$html->tooltip_properties($htmltooltip).'>'.img_help(0).'</td>';
print '</td></tr>';

View File

@ -1386,22 +1386,6 @@ else
$genallowed=$user->rights->commande->creer;
$delallowed=$user->rights->commande->supprimer;
$var=true;
/*
if (file_exists($file))
{
print_titre($langs->trans('Documents'));
print '<table width="100%" class="border">';
print '<tr '.$bc[$var].'><td>'.$langs->trans('Order').' PDF</td>';
print '<td><a href="'.DOL_URL_ROOT . '/document.php?modulepart=commande&file='.urlencode($relativepath).'">'.$commande->ref.'.pdf</a></td>';
print '<td align="right">'.filesize($file). ' bytes</td>';
print '<td align="right">'.strftime('%d %b %Y %H:%M:%S',filemtime($file)).'</td>';
print '</tr>';
print '</table>';
print '<br>';
}
*/
//$html->show_documents('propal',$filename,$filedir,$urlsource,$genallowed,$delallowed,$propal->modelpdf);
$html->show_documents('commande',$comref,$filedir,$urlsource,$genallowed,$delallowed,$commande->modelpdf);
/*

View File

@ -463,7 +463,7 @@ if ($_GET["id"] > 0)
*/
if ($reste_a_livrer_total > 0 && $conf->stock->enabled)
{
print '<br><table class="liste" width="100%"><tr>';
print '<br><table class="liste" width="100%">';
foreach ($reste_a_livrer as $key => $value)
{
if ($value > 0)
@ -526,9 +526,9 @@ if ($_GET["id"] > 0)
print_titre($langs->trans("OtherSendingsForSameOrder"));
print '<table class="liste" width="100%">';
print '<tr class="liste_titre">';
print '<td width="54%">'.$langs->trans("Description").'</td>';
print '<td align="center">Quan. livrée</td>';
print '<td align="center">'.$langs->trans("Sending").'</td>';
print '<td align="left">'.$langs->trans("Sending").'</td>';
print '<td>'.$langs->trans("Description").'</td>';
print '<td align="center">'.$langs->trans("QtyShipped").'</td>';
print '<td align="center">'.$langs->trans("Date").'</td>';
print "</tr>\n";
@ -538,6 +538,7 @@ if ($_GET["id"] > 0)
$var=!$var;
$objp = $db->fetch_object($resql);
print "<tr $bc[$var]>";
print '<td align="left"><a href="'.DOL_URL_ROOT.'/expedition/fiche.php?id='.$objp->expedition_id.'">'.img_object($langs->trans("ShowSending"),'sending').' '.$objp->ref.'<a></td>';
if ($objp->fk_product > 0)
{
$product = new Product($db);
@ -553,7 +554,6 @@ if ($_GET["id"] > 0)
print "<td>".stripslashes(nl2br($objp->description))."</td>\n";
}
print '<td align="center">'.$objp->qty_livre.'</td>';
print '<td align="center"><a href="'.DOL_URL_ROOT.'/expedition/fiche.php?id='.$objp->expedition_id.'">'.img_object($langs->trans("ShowSending"),'sending').' '.$objp->ref.'<a></td>';
print '<td align="center">'.dolibarr_print_date($objp->date_expedition).'</td>';
$i++;
}

View File

@ -66,7 +66,7 @@ class Expedition
* \param user Objet du user qui cré
* \return int <0 si erreur, id expédition créée si ok
*/
function create($user)
function create($user)
{
require_once DOL_DOCUMENT_ROOT ."/product/stock/mouvementstock.class.php";
$error = 0;
@ -451,42 +451,6 @@ class Expedition
}
}
/**
* Genere le pdf
*/
function PdfWrite()
{
global $conf;
//EXPEDITION_ADDON_PDF
if (defined("EXPEDITION_ADDON_PDF") && strlen(EXPEDITION_ADDON_PDF) > 0)
{
$module_file_name = DOL_DOCUMENT_ROOT."/expedition/mods/pdf/pdf_expedition_".EXPEDITION_ADDON_PDF.".modules.php";
$mod = "pdf_expedition_".EXPEDITION_ADDON_PDF;
$this->fetch_commande();
require_once($module_file_name);
$pdf = new $mod($this->db);
//$dir = $conf->expedition->dir_output . "/" .get_exdir($this->id); //test
$dir = $conf->expedition->dir_output . "/" .$this->ref;
if (! file_exists($dir))
{
create_exdir($dir);
}
//$file = $dir . $this->id . ".pdf"; //test
$file = $dir . $this->ref . ".pdf";
if (file_exists($dir))
{
$pdf->generate($this, $file);
}
}
}
/*
* Lit la commande associée

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
*
* This program is free software; you can redistribute it and/or modify
@ -31,6 +31,7 @@
*/
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT ."/expedition/mods/pdf/ModelePdfExpedition.class.php");
require_once(DOL_DOCUMENT_ROOT."/product.class.php");
require_once(DOL_DOCUMENT_ROOT."/propal.class.php");
require_once(DOL_DOCUMENT_ROOT."/product/stock/entrepot.class.php");
@ -119,12 +120,16 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes')
/*
* Générer ou regénérer le PDF
*/
if ($_GET["action"] == 'pdf')
if ($_REQUEST['action'] == 'builddoc') // En get ou en post
{
$expedition = new Expedition($db);
$expedition->fetch($_GET["id"]);
$expedition->PdfWrite();
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
$result=expedition_pdf_create($db, $_REQUEST['id'],$_REQUEST['model'],$outputlangs);
if ($result <= 0)
{
dolibarr_print_error($db,$result);
exit;
}
}
@ -427,9 +432,9 @@ else
$i = 0;
print '<tr class="liste_titre">';
print '<td width="54%">'.$langs->trans("Products").'</td>';
print '<td align="center">Quan. commandée</td>';
print '<td align="center">Quan. livrée</td>';
print '<td>'.$langs->trans("Products").'</td>';
print '<td align="center">'.$langs->trans("QtyOrdered").'</td>';
print '<td align="center">'.$langs->trans("QtyShipped").'</td>';
print "</tr>\n";
$var=true;
@ -486,7 +491,7 @@ else
print '<a class="butAction" href="fiche.php?id='.$expedition->id.'&amp;action=valid">'.$langs->trans("Validate").'</a>';
}
print '<a class="butAction" href="fiche.php?id='.$expedition->id.'&amp;action=pdf">'.$langs->trans('BuildPDF').'</a>';
print '<a class="butAction" href="fiche.php?id='.$expedition->id.'&amp;action=builddoc">'.$langs->trans('BuildPDF').'</a>';
if ($expedition->brouillon && $user->rights->expedition->supprimer)
{
@ -495,7 +500,9 @@ else
print '</div>';
}
print "\n";
print "<table width=\"100%\" cellspacing=2><tr><td width=\"50%\" valign=\"top\">";
/*
* Documents générés
@ -512,15 +519,10 @@ else
//$genallowed=$user->rights->expedition->creer;
//$delallowed=$user->rights->expedition->supprimer;
$genallowed=0;
$genallowed=1;
$delallowed=0;
$var=true;
print "<br>\n";
$html->show_documents('expedition',$filename,$filedir,$urlsource,$genallowed,$delallowed,$expedition->modelpdf);
$result=$html->show_documents('expedition',$filename,$filedir,$urlsource,$genallowed,$delallowed,$expedition->modelpdf);
/*
* Déjà livre
@ -550,9 +552,9 @@ else
print_titre($langs->trans("OtherSendingsForSameOrder"));
print '<table class="liste" width="100%">';
print '<tr class="liste_titre">';
print '<td width="54%">'.$langs->trans("Description").'</td>';
print '<td align="center">Quan. livrée</td>';
print '<td align="center">'.$langs->trans("Sending").'</td>';
print '<td align="left">'.$langs->trans("Sending").'</td>';
print '<td>'.$langs->trans("Description").'</td>';
print '<td align="center">'.$langs->trans("QtyShipped").'</td>';
print '<td align="center">'.$langs->trans("Date").'</td>';
print "</tr>\n";
@ -562,6 +564,7 @@ else
$var=!$var;
$objp = $db->fetch_object($resql);
print "<tr $bc[$var]>";
print '<td align="left"><a href="'.DOL_URL_ROOT.'/expedition/fiche.php?id='.$objp->expedition_id.'">'.img_object($langs->trans("ShowSending"),'sending').' '.$objp->ref.'<a></td>';
if ($objp->fk_product > 0)
{
$product = new Product($db);
@ -577,8 +580,8 @@ else
print "<td>".stripslashes(nl2br($objp->description))."</td>\n";
}
print '<td align="center">'.$objp->qty_livre.'</td>';
print '<td align="center"><a href="'.DOL_URL_ROOT.'/expedition/fiche.php?id='.$objp->expedition_id.'">'.img_object($langs->trans("ShowSending"),'sending').' '.$objp->ref.'<a></td>';
print '<td align="center">'.dolibarr_print_date($objp->date_expedition).'</td>';
print '</tr>';
$i++;
}
@ -591,7 +594,7 @@ else
}
/*
* Documents générés
* Commandes associées
*
*/
$file = $conf->commande->dir_output . "/" . $commande->ref . "/" . $commande->ref . ".pdf";
@ -602,8 +605,7 @@ else
if (file_exists($file))
{
print '<br>';
print "<table width=\"100%\" cellspacing=2><tr><td width=\"50%\" valign=\"top\">";
print_titre("Documents");
print_titre("Orders");
print '<table width="100%" class="border">';
print "<tr $bc[$true]><td>".$langs->trans("Order")." PDF</td>";
@ -613,57 +615,51 @@ else
print '</tr>';
print "</table>\n";
print '</td><td valign="top" width="50%">';
print_titre("Actions");
/*
* Liste des actions
*
*/
$sql = "SELECT ".$db->pdate("a.datea")." as da, a.note";
$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
$sql .= " WHERE a.fk_soc = ".$commande->soc_id." AND a.fk_action in (9,10)";
$sql .= " AND a.fk_commande = ".$expedition->id;
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
if ($num)
{
$i = 0;
print '<table class="border" width="100%">';
print "<tr $bc[$var]><td>".$langs->trans("Date")."</td><td>".$langs->trans("Action")."</td></tr>\n";
$var=True;
while ($i < $num)
{
$objp = $db->fetch_object($resql);
$var=!$var;
print "<tr $bc[$var]>";
print "<td>".strftime("%d %B %Y",$objp->da)."</td>\n";
print '<td>'.stripslashes($objp->note).'</td>';
print "</tr>";
$i++;
}
print "</table>";
}
$db->free($resql);
}
else
{
dolibarr_print_error($db);
}
/*
*
*
*/
print "</td></tr></table>";
}
}
print '</td><td valign="top" width="50%">';
print_titre("Actions");
/*
*
* Liste des actions
*
*/
$sql = "SELECT ".$db->pdate("a.datea")." as da, a.note";
$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
$sql .= " WHERE a.fk_soc = ".$commande->soc_id." AND a.fk_action in (9,10)";
$sql .= " AND a.fk_commande = ".$expedition->id;
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
if ($num)
{
$i = 0;
print '<table class="border" width="100%">';
print "<tr $bc[$var]><td>".$langs->trans("Date")."</td><td>".$langs->trans("Action")."</td></tr>\n";
$var=True;
while ($i < $num)
{
$objp = $db->fetch_object($resql);
$var=!$var;
print "<tr $bc[$var]>";
print "<td>".strftime("%d %B %Y",$objp->da)."</td>\n";
print '<td>'.stripslashes($objp->note).'</td>';
print "</tr>";
$i++;
}
print "</table>";
}
$db->free($resql);
}
else
{
dolibarr_print_error($db);
}
if ($action == 'presend')
{
@ -691,6 +687,9 @@ else
print "<input type=\"submit\" value=\"Envoyer\"></form>";
}
print '</td></tr></table>';
}
else
{

View File

@ -27,8 +27,131 @@ require_once DOL_DOCUMENT_ROOT.'/includes/fpdf/DolibarrPdfBarCode.class.php';
Class ModelePdfExpedition extends DolibarrPdfBarCode
{
var $error='';
/**
\brief Renvoi le dernier message d'erreur de création de PDF de commande
*/
function pdferror()
{
return $this->error;
}
/**
* \brief Renvoi la liste des modèles actifs
* \return array Tableau des modeles (cle=id, valeur=libelle)
*/
function liste_modeles($db)
{
$type='shipping';
$liste=array();
$sql ="SELECT nom as id, nom as lib";
$sql.=" FROM ".MAIN_DB_PREFIX."document_model";
$sql.=" WHERE type = '".$type."'";
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num)
{
$row = $db->fetch_row($resql);
$liste[$row[0]]=$row[1];
$i++;
}
}
else
{
$this->error=$db->error();
return -1;
}
return $liste;
}
}
/*
\brief Crée un bon d'expedition sur disque
\param db objet base de donnée
\param id id de la propale à créer
\param modele force le modele à utiliser ('' par defaut)
\param outputlangs objet lang a utiliser pour traduction
*/
function expedition_pdf_create($db, $id, $modele='', $outputlangs='')
{
global $conf,$langs;
$langs->load("sendings");
$dir = DOL_DOCUMENT_ROOT."/expedition/mods/pdf/";
$modelisok=0;
$liste=array();
// Positionne modele sur le nom du modele de commande à utiliser
$file = "pdf_expedition_".$modele.".modules.php";
if ($modele && file_exists($dir.$file)) $modelisok=1;
// Si model pas encore bon
if (! $modelisok)
{
if ($conf->global->EXPEDITION_ADDON_PDF) $modele = $conf->global->EXPEDITION_ADDON_PDF;
$file = "pdf_expedition_".$modele.".modules.php";
if (file_exists($dir.$file)) $modelisok=1;
}
// Si model pas encore bon
if (! $modelisok)
{
$model=new ModelePDFExpedition();
$liste=$model->liste_modeles($db);
$modele=key($liste); // Renvoie premiere valeur de clé trouvé dans le tableau
$file = "pdf_expedition_".$modele.".modules.php";
if (file_exists($dir.$file)) $modelisok=1;
}
// Charge le modele
if ($modelisok)
{
$classname = "pdf_expedition_".$modele;
require_once($dir.$file);
$obj = new $classname($db);
$expedition = new Expedition($db);
$result=$expedition->fetch($id);
$expeditionref = sanitize_string($expedition->ref);
$dir = $conf->expedition->dir_output . "/" . $expeditionref;
$file = $dir . "/" . $expeditionref . ".pdf";
if ($obj->generate($expedition, $file))
// if ( $obj->write_pdf_file($id, $outputlangs) > 0)
{
// on supprime l'image correspondant au preview
// commande_delete_preview($db, $id);
return 1;
}
else
{
dolibarr_syslog("Erreur dans expedition_pdf_create");
dolibarr_print_error($db,$obj->pdferror());
return 0;
}
}
else
{
if (! $conf->global->EXPEDITION_ADDON_PDF)
{
print $langs->trans("Error")." ".$langs->trans("Error_EPXEDITION_ADDON_PDF_NotDefined");
}
else
{
print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$dir.$file);
}
return 0;
}
}
?>

View File

@ -27,97 +27,99 @@ require_once DOL_DOCUMENT_ROOT."/expedition/mods/pdf/ModelePdfExpedition.class.p
Class pdf_expedition_dorade extends ModelePdfExpedition
{
function pdf_expedition_dorade($db=0)
{
$this->db = $db;
$this->name = "dorade";
$this->description = "Modèle identique au rouget utilisé pour debug uniquement.";
}
function Header()
{
$this->rect(5, 5, 200, 30);
$this->Code39(8, 8, $this->expe->ref);
$this->SetFont('Arial','', 14);
$this->Text(105, 12, "Bordereau d'expédition : ".$this->expe->ref);
$this->Text(105, 18, "Date : " . strftime("%a %e %b %Y", $this->expe->date));
$this->Text(105, 26, "Page : ". $this->PageNo() ."/{nb}", 0);
//
$this->rect(5, 40, 200, 30);
$this->Code39(8, 44, $this->expe->commande->ref);
$this->SetFont('Arial','', 14);
$this->Text(105, 48, "Numéro de Commande : ".$this->expe->commande->ref);
$this->Text(105, 54, "Date de la commande : " . strftime("%e %b %Y", $this->expe->commande->date));
//
$this->rect(5, 80, 200, 210);
$this->tableau_top = 80;
$this->SetFont('Arial','', 12);
$a = $this->tableau_top + 5;
$this->Text(8, $a, "Référence");
$this->Text(40, $a, "Description");
$this->Text(174, $a, "Quantitée");
$this->SetFont('Arial','', 8);
$this->Text(166, $a+4, "Commandée");
$this->Text(190, $a+4, "Livrée");
}
function generate(&$objExpe, $filename)
{
$this->expe = $objExpe;
$this->expe->fetch_commande();
$this->pdf = new ModelePdfExpedition();
$this->pdf->expe = &$this->expe;
$this->pdf->Open();
$this->pdf->AliasNbPages();
$this->pdf->AddPage();
$this->pdf->SetTitle($objExpe->ref);
$this->pdf->SetSubject("Bordereau d'expedition");
$this->pdf->SetCreator("Dolibarr ".DOL_VERSION);
//$this->pdf->SetAuthor($user->fullname);
/*
*
*/
$this->pdf->SetTextColor(0,0,0);
$this->pdf->SetFont('Arial','', 16);
$this->expe->fetch_lignes();
for ($i = 0 ; $i < sizeof($this->expe->lignes) ; $i++)
function pdf_expedition_dorade($db=0)
{
$a = $this->pdf->tableau_top + 14 + ($i * 16);
$this->pdf->i25(8, ($a - 2), "000000".$this->expe->lignes[$i]->product_id, 1, 8);
$this->pdf->Text(40, $a, $this->expe->lignes[$i]->description);
$this->pdf->Text(170, $a, $this->expe->lignes[$i]->qty_commande);
$this->pdf->Text(194, $a, $this->expe->lignes[$i]->qty_expedition);
$this->db = $db;
$this->name = "dorade";
$this->description = "Modèle identique au rouget utilisé pour debug uniquement.";
}
function Header()
{
$this->rect(5, 5, 200, 30);
$this->Code39(8, 8, $this->expe->ref);
$this->SetFont('Arial','', 14);
$this->Text(105, 12, "Bordereau d'expédition : ".$this->expe->ref);
$this->Text(105, 18, "Date : " . strftime("%a %e %b %Y", $this->expe->date));
$this->Text(105, 26, "Page : ". $this->PageNo() ."/{nb}", 0);
//
$this->rect(5, 40, 200, 30);
$this->Code39(8, 44, $this->expe->commande->ref);
$this->SetFont('Arial','', 14);
$this->Text(105, 48, "Numéro de Commande : ".$this->expe->commande->ref);
$this->Text(105, 54, "Date de la commande : " . strftime("%e %b %Y", $this->expe->commande->date));
//
$this->rect(5, 80, 200, 210);
$this->tableau_top = 80;
$this->SetFont('Arial','', 12);
$a = $this->tableau_top + 5;
$this->Text(8, $a, "Référence");
$this->Text(40, $a, "Description");
$this->Text(174, $a, "Quantitée");
$this->SetFont('Arial','', 8);
$this->Text(166, $a+4, "Commandée");
$this->Text(190, $a+4, "Livrée");
}
function generate(&$objExpe, $filename)
{
$this->expe = $objExpe;
$this->expe->fetch_commande();
$this->pdf = new ModelePdfExpedition();
$this->pdf->expe = &$this->expe;
$this->pdf->Open();
$this->pdf->AliasNbPages();
$this->pdf->AddPage();
$this->pdf->SetTitle($objExpe->ref);
$this->pdf->SetSubject("Bordereau d'expedition");
$this->pdf->SetCreator("Dolibarr ".DOL_VERSION);
//$this->pdf->SetAuthor($user->fullname);
/*
*
*/
$this->pdf->SetTextColor(0,0,0);
$this->pdf->SetFont('Arial','', 16);
$this->expe->fetch_lignes();
for ($i = 0 ; $i < sizeof($this->expe->lignes) ; $i++)
{
$a = $this->pdf->tableau_top + 14 + ($i * 16);
$this->pdf->i25(8, ($a - 2), "000000".$this->expe->lignes[$i]->product_id, 1, 8);
$this->pdf->Text(40, $a, $this->expe->lignes[$i]->description);
$this->pdf->Text(170, $a, $this->expe->lignes[$i]->qty_commande);
$this->pdf->Text(194, $a, $this->expe->lignes[$i]->qty_expedition);
}
$this->pdf->Output($filename);
return 1;
}
$this->pdf->Output($filename);
}
}
?>

View File

@ -25,9 +25,11 @@
require_once DOL_DOCUMENT_ROOT."/expedition/mods/pdf/ModelePdfExpedition.class.php";
require_once DOL_DOCUMENT_ROOT."/contact.class.php";
Class pdf_expedition_merou extends ModelePdfExpedition{
Class pdf_expedition_merou extends ModelePdfExpedition
{
function pdf_expedition_merou($db=0){
function pdf_expedition_merou($db=0)
{
$this->db = $db;
$this->name = "Merou";
$this->description = "Modele Merou 2xA5 \n
@ -37,6 +39,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition{
|element->commande,source->external,code->EXPEDITEUR \n
|element->commande,source->external,code->DESTINATAIRE \n
";
$this->type = 'pdf';
}
//*****************************
@ -66,10 +69,11 @@ Class pdf_expedition_merou extends ModelePdfExpedition{
//Creation du livreur
$idcontact = $this->expe->commande->getIdContact('internal','LIVREUR');
$this->livreur = new User($this->db,$idcontact[0]);
$this->livreur->fetch();
if ($idcontact[0]) $this->livreur->fetch();
//Verificatio nde la configuration
if ($conf->expedition->dir_output){
//Verification de la configuration
if ($conf->expedition->dir_output)
{
$forbidden_chars=array("/","\\",":","*","?","\"","<",">","|","[","]",",",";","=");
$expref = str_replace($forbidden_chars,"_",$this->expe->ref);
$dir = $conf->expedition->dir_output . "/" . $this->expe->ref . "/" ;
@ -84,8 +88,9 @@ Class pdf_expedition_merou extends ModelePdfExpedition{
}
}
//Si le dossier existe
if (file_exists($dir)){
// Initialisation Bon vierge
if (file_exists($dir))
{
// Initialisation Bon vierge
$this->FPDF('l','mm','A5');
$this->Open();
$this->AddPage();

View File

@ -26,77 +26,81 @@ require_once DOL_DOCUMENT_ROOT."/expedition/mods/pdf/ModelePdfExpedition.class.p
Class pdf_expedition_rouget extends ModelePdfExpedition
{
function pdf_expedition_rouget($db=0)
{
$this->db = $db;
$this->name = "rouget";
$this->description = "Modèle simple.";
}
function Header()
{
$this->rect(5, 5, 200, 30);
$this->Code39(8, 8, $this->expe->ref);
$this->SetFont('Arial','', 14);
$this->Text(105, 12, "Bordereau d'expédition : ".$this->expe->ref);
$this->Text(105, 18, "Date : " . strftime("%d %b %Y", $this->expe->date));
$this->Text(105, 24, "Page : ". $this->PageNo() ."/{nb}", 0);
$this->rect(5, 40, 200, 250);
$this->tableau_top = 40;
$this->SetFont('Arial','', 10);
$a = $this->tableau_top + 5;
$this->Text(10, $a, "Produit");
$this->Text(166, $a, "Quantitée");
$this->Text(166, $a+4, "Commandée");
$this->Text(190, $a, "Livrée");
}
function generate(&$objExpe, $filename)
{
$this->expe = $objExpe;
$this->pdf = new ModelePdfExpedition();
$this->pdf->expe = &$this->expe;
$this->pdf->Open();
$this->pdf->AliasNbPages();
$this->pdf->AddPage();
$this->pdf->SetTitle($objExpe->ref);
$this->pdf->SetSubject("Proposition commerciale");
$this->pdf->SetCreator("Dolibarr ".DOL_VERSION);
//$this->pdf->SetAuthor($user->fullname);
/*
*
*/
$this->pdf->SetTextColor(0,0,0);
$this->pdf->SetFont('Arial','', 14);
$this->expe->fetch_lignes();
for ($i = 0 ; $i < sizeof($this->expe->lignes) ; $i++)
function pdf_expedition_rouget($db=0)
{
$a = $this->pdf->tableau_top + 14 + ($i * 7);
$this->pdf->Text(8, $a, $this->expe->lignes[$i]->description);
$this->pdf->Text(170, $a, $this->expe->lignes[$i]->qty_commande);
$this->pdf->Text(194, $a, $this->expe->lignes[$i]->qty_expedition);
$this->db = $db;
$this->name = "rouget";
$this->description = "Modèle simple.";
}
function Header()
{
$this->rect(5, 5, 200, 30);
$this->Code39(8, 8, $this->expe->ref);
$this->SetFont('Arial','', 14);
$this->Text(105, 12, "Bordereau d'expédition : ".$this->expe->ref);
$this->Text(105, 18, "Date : " . strftime("%d %b %Y", $this->expe->date));
$this->Text(105, 24, "Page : ". $this->PageNo() ."/{nb}", 0);
$this->rect(5, 40, 200, 250);
$this->tableau_top = 40;
$this->SetFont('Arial','', 10);
$a = $this->tableau_top + 5;
$this->Text(10, $a, "Produit");
$this->Text(166, $a, "Quantitée");
$this->Text(166, $a+4, "Commandée");
$this->Text(190, $a, "Livrée");
}
function generate(&$objExpe, $filename)
{
global $langs;
$this->expe = $objExpe;
$this->pdf = new FPDF();
$this->pdf->expe = &$this->expe;
$this->pdf->Open();
$this->pdf->AliasNbPages();
$this->pdf->AddPage();
$this->pdf->SetTitle($objExpe->ref);
$this->pdf->SetSubject($langs->trans("Sending"));
$this->pdf->SetCreator("Dolibarr ".DOL_VERSION);
//$this->pdf->SetAuthor($user->fullname);
/*
*
*/
$this->pdf->SetTextColor(0,0,0);
$this->pdf->SetFont('Arial','', 14);
$this->expe->fetch_lignes();
for ($i = 0 ; $i < sizeof($this->expe->lignes) ; $i++)
{
$a = $this->pdf->tableau_top + 14 + ($i * 7);
$this->pdf->Text(8, $a, $this->expe->lignes[$i]->description);
$this->pdf->Text(170, $a, $this->expe->lignes[$i]->qty_commande);
$this->pdf->Text(194, $a, $this->expe->lignes[$i]->qty_expedition);
}
$this->pdf->Output($filename);
return 1;
}
$this->pdf->Output($filename);
}
}
?>

View File

@ -2322,7 +2322,17 @@ class Form
$modellist=$model->liste_modeles($this->db);
}
}
else if ($modulepart == 'ficheinter')
elseif ($modulepart == 'expedition')
{
if (is_array($genallowed)) $modellist=$genallowed;
else
{
include_once(DOL_DOCUMENT_ROOT.'/expedition/mods/pdf/ModelePdfExpedition.class.php');
$model=new ModelePDFExpedition();
$modellist=$model->liste_modeles($this->db);
}
}
else if ($modulepart == 'ficheinter')
{
if (is_array($genallowed)) $modellist=$genallowed;
else
@ -2424,58 +2434,57 @@ class Form
// Affiche en-tete tableau
$headershown=1;
print_titre($langs->trans("Documents"));
print '<table class="border" width="100%">';
}
// Défini chemin relatif par rapport au module pour lien download
$relativepath=$filename."/".$file;
if ($modulepart == 'expedition') { $relativepath = get_exdir($filename).$file; }
if ($modulepart == 'don') { $relativepath = get_exdir($filename).$file; }
if ($modulepart == 'export') { $relativepath = $file; }
// Défini le type MIME du document
if (eregi('\.([^\.]+)$',$file,$reg)) $extension=$reg[1];
$mimetype=strtoupper($extension);
if ($extension == 'pdf') $mimetype='PDF';
if ($extension == 'html') $mimetype='HTML';
if (eregi('\-detail\.pdf',$file)) $mimetype='PDF Détaillé';
print "<tr $bc[$var]>";
// Affiche colonne type MIME
print '<td nowrap>'.$mimetype.'</td>';
// Affiche nom fichier avec lien download
print '<td><a href="'.DOL_URL_ROOT . '/document.php?modulepart='.$modulepart.'&file='.urlencode($relativepath).'">'.$file.'</a>';
print '</td>';
// Affiche taille fichier
print '<td align="right">'.filesize($filedir."/".$file). ' bytes</td>';
// Affiche date fichier
print '<td align="right">'.strftime("%d %b %Y %H:%M:%S",filemtime($filedir."/".$file)).'</td>';
if ($delallowed)
{
print '<td><a href="'.$urlsource.'&action=remove_file&modulepart='.$modulepart.'&file='.urlencode($relativepath).'">'.img_delete().'</a></td>';
}
print '</tr>';
$i++;
print_titre($langs->trans("Documents"));
print '<table class="border" width="100%">';
}
}
if ($headershown)
{
// Affiche pied du tableau
print "</table>\n";
if ($genallowed)
{
print '</form>';
}
}
return $i;
// Défini chemin relatif par rapport au module pour lien download
$relativepath=$filename."/".$file;
if ($modulepart == 'don') { $relativepath = get_exdir($filename).$file; }
if ($modulepart == 'export') { $relativepath = $file; }
// Défini le type MIME du document
if (eregi('\.([^\.]+)$',$file,$reg)) $extension=$reg[1];
$mimetype=strtoupper($extension);
if ($extension == 'pdf') $mimetype='PDF';
if ($extension == 'html') $mimetype='HTML';
if (eregi('\-detail\.pdf',$file)) $mimetype='PDF Détaillé';
print "<tr $bc[$var]>";
// Affiche colonne type MIME
print '<td nowrap>'.$mimetype.'</td>';
// Affiche nom fichier avec lien download
print '<td><a href="'.DOL_URL_ROOT . '/document.php?modulepart='.$modulepart.'&file='.urlencode($relativepath).'">'.$file.'</a>';
print '</td>';
// Affiche taille fichier
print '<td align="right">'.filesize($filedir."/".$file). ' bytes</td>';
// Affiche date fichier
print '<td align="right">'.strftime("%d %b %Y %H:%M:%S",filemtime($filedir."/".$file)).'</td>';
if ($delallowed)
{
print '<td><a href="'.$urlsource.'&action=remove_file&modulepart='.$modulepart.'&file='.urlencode($relativepath).'">'.img_delete().'</a></td>';
}
print '</tr>';
$i++;
}
}
if ($headershown)
{
// Affiche pied du tableau
print "</table>\n";
if ($genallowed)
{
print '</form>';
}
}
return $i;
}
}

View File

@ -139,7 +139,7 @@ class ModeleNumRefCommandes
/*
\brief Crée un bon de commande sur disque en fonction du modèle de COMMANDE_ADDON_PDF
\brief Crée un bon de commande sur disque en fonction d'un modèle
\param db objet base de donnée
\param id id de la propale à créer
\param modele force le modele à utiliser ('' par defaut)

View File

@ -163,6 +163,7 @@ delete from llx_document_model where nom='adytek';
delete from llx_document_model where nom='rouge' and type='order';
delete from llx_document_model where nom='azur' and type='order';
delete from llx_document_model where nom='orange' and type='propal';
delete from llx_document_model where nom='transporteur' and type='shipping';
alter table llx_actioncomm add column fk_commande integer after propalrowid;