diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php index 0d33d222d42..4a204acc241 100644 --- a/htdocs/admin/expedition.php +++ b/htdocs/admin/expedition.php @@ -317,8 +317,6 @@ if(is_dir($dir)) $htmltooltip.='
'.$langs->trans("Height").': '.$module->page_hauteur; $htmltooltip.='
'.$langs->trans("FeaturesSupported").':'; $htmltooltip.='
'.$langs->trans("Logo").': '.yn($module->option_logo); - $htmltooltip.='
'.$langs->trans("PaymentMode").': '.yn($module->option_modereg); - $htmltooltip.='
'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg); print 'tooltip_properties($htmltooltip).'>'.img_help(0).''; print ''; diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index bde0b700252..ee77ad3df3e 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -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 ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print '
'.$langs->trans('Order').' PDF'.$commande->ref.'.pdf'.filesize($file). ' bytes'.strftime('%d %b %Y %H:%M:%S',filemtime($file)).'
'; - print '
'; - } - */ - //$html->show_documents('propal',$filename,$filedir,$urlsource,$genallowed,$delallowed,$propal->modelpdf); $html->show_documents('commande',$comref,$filedir,$urlsource,$genallowed,$delallowed,$commande->modelpdf); /* diff --git a/htdocs/expedition/commande.php b/htdocs/expedition/commande.php index 939307672bb..d1b7b6eda5e 100644 --- a/htdocs/expedition/commande.php +++ b/htdocs/expedition/commande.php @@ -463,7 +463,7 @@ if ($_GET["id"] > 0) */ if ($reste_a_livrer_total > 0 && $conf->stock->enabled) { - print '
'; + print '
'; foreach ($reste_a_livrer as $key => $value) { if ($value > 0) @@ -526,9 +526,9 @@ if ($_GET["id"] > 0) print_titre($langs->trans("OtherSendingsForSameOrder")); print '
'; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; print ''; print "\n"; @@ -538,6 +538,7 @@ if ($_GET["id"] > 0) $var=!$var; $objp = $db->fetch_object($resql); print ""; + print ''; if ($objp->fk_product > 0) { $product = new Product($db); @@ -553,7 +554,6 @@ if ($_GET["id"] > 0) print "\n"; } print ''; - print ''; print ''; $i++; } diff --git a/htdocs/expedition/expedition.class.php b/htdocs/expedition/expedition.class.php index aa795ecb04f..971c1073013 100644 --- a/htdocs/expedition/expedition.class.php +++ b/htdocs/expedition/expedition.class.php @@ -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 diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php index 3ab0bcb0cfb..bdb047931a8 100644 --- a/htdocs/expedition/fiche.php +++ b/htdocs/expedition/fiche.php @@ -1,6 +1,6 @@ - * Copyright (C) 2005 Laurent Destailleur + * Copyright (C) 2005-2006 Laurent Destailleur * Copyright (C) 2005 Simon TOSSER * * 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 ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; print "\n"; $var=true; @@ -486,7 +491,7 @@ else print ''.$langs->trans("Validate").''; } - print ''.$langs->trans('BuildPDF').''; + print ''.$langs->trans('BuildPDF').''; if ($expedition->brouillon && $user->rights->expedition->supprimer) { @@ -495,7 +500,9 @@ else print ''; } - + print "\n"; + + print "
'.$langs->trans("Description").'Quan. livrée'.$langs->trans("Sending").''.$langs->trans("Sending").''.$langs->trans("Description").''.$langs->trans("QtyShipped").''.$langs->trans("Date").'
'.img_object($langs->trans("ShowSending"),'sending').' '.$objp->ref.'".stripslashes(nl2br($objp->description))."'.$objp->qty_livre.''.img_object($langs->trans("ShowSending"),'sending').' '.$objp->ref.''.dolibarr_print_date($objp->date_expedition).'
'.$langs->trans("Products").'Quan. commandéeQuan. livrée'.$langs->trans("Products").''.$langs->trans("QtyOrdered").''.$langs->trans("QtyShipped").'
"; /* * 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 ''; - print ''; - print ''; + print ''; + print ''; + print ''; print ''; print "\n"; @@ -562,6 +564,7 @@ else $var=!$var; $objp = $db->fetch_object($resql); print ""; + print ''; if ($objp->fk_product > 0) { $product = new Product($db); @@ -577,8 +580,8 @@ else print "\n"; } print ''; - print ''; print ''; + 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 "
'.$langs->trans("Description").'Quan. livrée'.$langs->trans("Sending").''.$langs->trans("Sending").''.$langs->trans("Description").''.$langs->trans("QtyShipped").''.$langs->trans("Date").'
'.img_object($langs->trans("ShowSending"),'sending').' '.$objp->ref.'".stripslashes(nl2br($objp->description))."'.$objp->qty_livre.''.img_object($langs->trans("ShowSending"),'sending').' '.$objp->ref.''.dolibarr_print_date($objp->date_expedition).'
"; - print_titre("Documents"); + print_titre("Orders"); print ''; print ""; @@ -613,57 +615,51 @@ else print ''; print "
".$langs->trans("Order")." PDF
\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 "\n"; - - $var=True; - while ($i < $num) - { - $objp = $db->fetch_object($resql); - $var=!$var; - print ""; - print "\n"; - print ''; - print ""; - $i++; - } - print "
".$langs->trans("Date")."".$langs->trans("Action")."
".strftime("%d %B %Y",$objp->da)."'.stripslashes($objp->note).'
"; - } - $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 "\n"; + + $var=True; + while ($i < $num) + { + $objp = $db->fetch_object($resql); + $var=!$var; + print ""; + print "\n"; + print ''; + print ""; + $i++; + } + print "
".$langs->trans("Date")."".$langs->trans("Action")."
".strftime("%d %B %Y",$objp->da)."'.stripslashes($objp->note).'
"; + } + $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 ''; - // Affiche nom fichier avec lien download - print ''; - // Affiche taille fichier - print ''; - // Affiche date fichier - print ''; - - if ($delallowed) - { - print ''; - } - - print ''; - - $i++; + print_titre($langs->trans("Documents")); + print '
'.$mimetype.''.$file.''; - print ''.filesize($filedir."/".$file). ' bytes'.strftime("%d %b %Y %H:%M:%S",filemtime($filedir."/".$file)).''.img_delete().'
'; } - } - - 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;