";
/*
* 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 " \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 '';
print '';
- print ''.$langs->trans("Description").' ';
- print 'Quan. livrée ';
- print ''.$langs->trans("Sending").' ';
+ print ''.$langs->trans("Sending").' ';
+ print ''.$langs->trans("Description").' ';
+ print ''.$langs->trans("QtyShipped").' ';
print ''.$langs->trans("Date").' ';
print " \n";
@@ -562,6 +564,7 @@ else
$var=!$var;
$objp = $db->fetch_object($resql);
print "";
+ print ''.img_object($langs->trans("ShowSending"),'sending').' '.$objp->ref.' ';
if ($objp->fk_product > 0)
{
$product = new Product($db);
@@ -577,8 +580,8 @@ else
print "".stripslashes(nl2br($objp->description))." \n";
}
print ''.$objp->qty_livre.' ';
- print ''.img_object($langs->trans("ShowSending"),'sending').' '.$objp->ref.' ';
print ''.dolibarr_print_date($objp->date_expedition).' ';
+ print ' ';
$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 ' ';
- print "";
- print_titre("Documents");
+ print_titre("Orders");
print '';
print "".$langs->trans("Order")." PDF ";
@@ -613,57 +615,51 @@ else
print ' ';
print "
\n";
- print ' ';
- 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 '';
- print "".$langs->trans("Date")." ".$langs->trans("Action")." \n";
-
- $var=True;
- while ($i < $num)
- {
- $objp = $db->fetch_object($resql);
- $var=!$var;
- print "";
- print "".strftime("%d %B %Y",$objp->da)." \n";
- print ''.stripslashes($objp->note).' ';
- print " ";
- $i++;
- }
- print "
";
- }
- $db->free($resql);
- }
- else
- {
- dolibarr_print_error($db);
- }
-
- /*
- *
- *
- */
- print "
";
- }
+ }
+
+
+ print '';
+
+
+ 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 '';
+ print "".$langs->trans("Date")." ".$langs->trans("Action")." \n";
+
+ $var=True;
+ while ($i < $num)
+ {
+ $objp = $db->fetch_object($resql);
+ $var=!$var;
+ print "";
+ print "".strftime("%d %B %Y",$objp->da)." \n";
+ print ''.stripslashes($objp->note).' ';
+ print " ";
+ $i++;
+ }
+ print "
";
+ }
+ $db->free($resql);
+ }
+ else
+ {
+ dolibarr_print_error($db);
+ }
if ($action == 'presend')
{
@@ -691,6 +687,9 @@ else
print " ";
}
+
+ print '
';
+
}
else
{
diff --git a/htdocs/expedition/mods/pdf/ModelePdfExpedition.class.php b/htdocs/expedition/mods/pdf/ModelePdfExpedition.class.php
index 85ba1c8426e..f94f7d7d900 100644
--- a/htdocs/expedition/mods/pdf/ModelePdfExpedition.class.php
+++ b/htdocs/expedition/mods/pdf/ModelePdfExpedition.class.php
@@ -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;
+ }
+}
+
?>
diff --git a/htdocs/expedition/mods/pdf/pdf_expedition_dorade.modules.php b/htdocs/expedition/mods/pdf/pdf_expedition_dorade.modules.php
index c7065f7f0b4..ed0e1649042 100644
--- a/htdocs/expedition/mods/pdf/pdf_expedition_dorade.modules.php
+++ b/htdocs/expedition/mods/pdf/pdf_expedition_dorade.modules.php
@@ -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);
- }
}
?>
diff --git a/htdocs/expedition/mods/pdf/pdf_expedition_merou.modules.php b/htdocs/expedition/mods/pdf/pdf_expedition_merou.modules.php
index c2c640bc83c..0c603eb885d 100644
--- a/htdocs/expedition/mods/pdf/pdf_expedition_merou.modules.php
+++ b/htdocs/expedition/mods/pdf/pdf_expedition_merou.modules.php
@@ -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();
diff --git a/htdocs/expedition/mods/pdf/pdf_expedition_rouget.modules.php b/htdocs/expedition/mods/pdf/pdf_expedition_rouget.modules.php
index 073195c6cad..f7a7d04ab63 100644
--- a/htdocs/expedition/mods/pdf/pdf_expedition_rouget.modules.php
+++ b/htdocs/expedition/mods/pdf/pdf_expedition_rouget.modules.php
@@ -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);
- }
}
?>
diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php
index 644810a1955..20c3a109b75 100644
--- a/htdocs/html.form.class.php
+++ b/htdocs/html.form.class.php
@@ -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 '';
- }
-
- // 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 "";
-
- // Affiche colonne type MIME
- print ''.$mimetype.' ';
- // Affiche nom fichier avec lien download
- print ''.$file.' ';
- print ' ';
- // Affiche taille fichier
- print ''.filesize($filedir."/".$file). ' bytes ';
- // Affiche date fichier
- print ''.strftime("%d %b %Y %H:%M:%S",filemtime($filedir."/".$file)).' ';
-
- if ($delallowed)
- {
- print ''.img_delete().' ';
- }
-
- print ' ';
-
- $i++;
+ print_titre($langs->trans("Documents"));
+ print '';
}
- }
-
- if ($headershown)
- {
- // Affiche pied du tableau
- print "
\n";
- if ($genallowed)
- {
- print '';
- }
- }
- 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 "";
+
+ // Affiche colonne type MIME
+ print ''.$mimetype.' ';
+ // Affiche nom fichier avec lien download
+ print ''.$file.' ';
+ print ' ';
+ // Affiche taille fichier
+ print ''.filesize($filedir."/".$file). ' bytes ';
+ // Affiche date fichier
+ print ''.strftime("%d %b %Y %H:%M:%S",filemtime($filedir."/".$file)).' ';
+
+ if ($delallowed)
+ {
+ print ''.img_delete().' ';
+ }
+
+ print ' ';
+
+ $i++;
+ }
}
+
+ if ($headershown)
+ {
+ // Affiche pied du tableau
+ print "
\n";
+ if ($genallowed)
+ {
+ print '';
+ }
+ }
+
+ return $i;
+}
}
diff --git a/htdocs/includes/modules/commande/modules_commande.php b/htdocs/includes/modules/commande/modules_commande.php
index 2a6d7e8a0f2..74c92ce9078 100644
--- a/htdocs/includes/modules/commande/modules_commande.php
+++ b/htdocs/includes/modules/commande/modules_commande.php
@@ -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)
diff --git a/mysql/migration/2.0.0-2.1.0.sql b/mysql/migration/2.0.0-2.1.0.sql
index d90bcd32b19..da00a987619 100644
--- a/mysql/migration/2.0.0-2.1.0.sql
+++ b/mysql/migration/2.0.0-2.1.0.sql
@@ -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;