diff --git a/htdocs/expedition/expedition.class.php b/htdocs/expedition/expedition.class.php index dc4f02afeaa..6eba15a658c 100644 --- a/htdocs/expedition/expedition.class.php +++ b/htdocs/expedition/expedition.class.php @@ -578,46 +578,46 @@ class Expedition extends CommonObject */ function fetch_commande() { - $this->commande =& new Commande($this->db); + $this->commande = & new Commande($this->db); $this->commande->fetch($this->commande_id); } - - function fetch_lignes() - { - $this->lignes = array(); - - $sql = "SELECT c.description, c.qty as qtycom, e.qty as qtyexp"; - $sql .= ", c.fk_product"; - $sql .= " FROM ".MAIN_DB_PREFIX."expeditiondet as e"; - $sql .= " , ".MAIN_DB_PREFIX."commandedet as c"; - - $sql .= " WHERE e.fk_expedition = ".$this->id; - $sql .= " AND e.fk_commande_ligne = c.rowid"; - - - $resql = $this->db->query($sql); - if ($resql) - { - $num = $this->db->num_rows($resql); - $i = 0; - while ($i < $num) - { - $ligne = new ExpeditionLigne($this->db); - $obj = $this->db->fetch_object($resql); - - $ligne->fk_product = $obj->fk_product; - $ligne->qty_commande = $obj->qtycom; - $ligne->qty_expedition = $obj->qtyexp; - $ligne->description = $obj->description; - - $this->lignes[$i] = $ligne; - $i++; - } - $this->db->free($resql); - } - return $this->lignes; - } + + function fetch_lignes() + { + $this->lignes = array(); + + $sql = "SELECT c.description, c.qty as qtycom, e.qty as qtyexp"; + $sql .= ", c.fk_product"; + $sql .= " FROM ".MAIN_DB_PREFIX."expeditiondet as e"; + $sql .= " , ".MAIN_DB_PREFIX."commandedet as c"; + + $sql .= " WHERE e.fk_expedition = ".$this->id; + $sql .= " AND e.fk_commande_ligne = c.rowid"; + + + $resql = $this->db->query($sql); + if ($resql) + { + $num = $this->db->num_rows($resql); + $i = 0; + while ($i < $num) + { + $ligne = new ExpeditionLigne($this->db); + $obj = $this->db->fetch_object($resql); + + $ligne->fk_product = $obj->fk_product; + $ligne->qty_commande = $obj->qtycom; + $ligne->qty_expedition = $obj->qtyexp; + $ligne->description = $obj->description; + + $this->lignes[$i] = $ligne; + $i++; + } + $this->db->free($resql); + } + return $this->lignes; + } /** * \brief Retourne le libellé du statut d'une expedition diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php index 68a23a36583..811e9f70684 100644 --- a/htdocs/expedition/fiche.php +++ b/htdocs/expedition/fiche.php @@ -142,7 +142,7 @@ if ($_REQUEST['action'] == 'builddoc') // En get ou en post // Sauvegarde le dernier modèle choisi pour générer un document $expedition = new Expedition($db, 0, $_REQUEST['id']); $expedition->fetch($_REQUEST['id']); - $expedition->fetch_commande(); + if ($_REQUEST['model']) { $expedition->set_pdf_model($user, $_REQUEST['model']); diff --git a/htdocs/expedition/mods/pdf/ModelePdfExpedition.class.php b/htdocs/expedition/mods/pdf/ModelePdfExpedition.class.php index b684ecb333c..cb7d286c8d8 100644 --- a/htdocs/expedition/mods/pdf/ModelePdfExpedition.class.php +++ b/htdocs/expedition/mods/pdf/ModelePdfExpedition.class.php @@ -122,7 +122,8 @@ function expedition_pdf_create($db, $id, $modele='', $outputlangs='') $expedition = new Expedition($db); $result=$expedition->fetch($id); - + $result=$expedition->fetch_commande(); + if ($obj->write_file($expedition, $langs) > 0) { // on supprime l'image correspondant au preview diff --git a/htdocs/expedition/mods/pdf/pdf_expedition_rouget.modules.php b/htdocs/expedition/mods/pdf/pdf_expedition_rouget.modules.php index 27072ad1a8d..8be3f3d388a 100644 --- a/htdocs/expedition/mods/pdf/pdf_expedition_rouget.modules.php +++ b/htdocs/expedition/mods/pdf/pdf_expedition_rouget.modules.php @@ -199,10 +199,10 @@ Class pdf_expedition_rouget extends ModelePdfExpedition $pdf->SetFont('Arial','', 10); $curY = $this->tableau_top + 5; $pdf->Text(12, $curY+2, $outputlangs->trans("Description")); - $pdf->Text(166, $curY, $outputlangs->trans("Qty")); - $pdf->Text(166, $curY+4, "Commandée"); - $pdf->Text(190, $curY, $outputlangs->trans("Qty")); - $pdf->Text(190, $curY+4, "Livrée"); + $pdf->Text(160, $curY, $outputlangs->trans("Qty")); + $pdf->Text(160, $curY+4, "Commandée"); + $pdf->Text(186, $curY, $outputlangs->trans("Qty")); + $pdf->Text(186, $curY+4, "Livrée"); $this->expe->fetch_lignes(); for ($i = 0 ; $i < sizeof($this->expe->lignes) ; $i++) @@ -243,20 +243,22 @@ Class pdf_expedition_rouget extends ModelePdfExpedition $pdf->SetFont('Arial','', 9); // Dans boucle pour gérer multi-page - if ($conf->fckeditor->enabled) { - $pdf->writeHTMLCell(108, 4, $this->posxdesc, $curY, $libelleproduitservice, 0, 1); + $pdf->writeHTMLCell(150, 3, $this->posxdesc, $curY, $libelleproduitservice, 0, 1); +// $pdf->SetXY ($this->posxdesc, $curY); +// $pdf->MultiCell(150, 3, "zzzz g dg fdgdfgfgfgfdg dfg dfgdfgfdggggggggggggggggggg f g fd g fdgfdgggggggggggggggggggggggggggg fg df g ff hf hz", 0, 'J'); } else { $pdf->SetXY ($this->posxdesc, $curY); - $pdf->MultiCell(108, 4, $libelleproduitservice, 0, 'J'); + $pdf->MultiCell(150, 3, $libelleproduitservice, 0, 'J'); } - - $pdf->Text(170, $curY, $this->expe->lignes[$i]->qty_commande); + $pdf->SetXY (160, $curY); + $pdf->MultiCell(30, 3, $this->expe->lignes[$i]->qty_commande); - $pdf->Text(194, $curY, $this->expe->lignes[$i]->qty_expedition); + $pdf->SetXY (186, $curY); + $pdf->MultiCell(30, 3, $this->expe->lignes[$i]->qty_expedition); } $pdf->AliasNbPages();