diff --git a/htdocs/commande/commande.class.php b/htdocs/commande/commande.class.php index ed922726d01..1485e48ad70 100644 --- a/htdocs/commande/commande.class.php +++ b/htdocs/commande/commande.class.php @@ -943,9 +943,8 @@ class Commande extends CommonObject { if ($user->rights->commande->creer) { - $sql = "UPDATE ".MAIN_DB_PREFIX."commande SET model_pdf = '$modelpdf'"; - $sql .= " WHERE rowid = $this->id AND fk_statut < 2 ;"; + $sql.= " WHERE rowid = ".$this->id; if ($this->db->query($sql) ) { @@ -970,7 +969,7 @@ class Commande extends CommonObject $this->lignes = array(); $sql = 'SELECT l.rowid, l.fk_product, l.fk_commande, l.description, l.price, l.qty, l.tva_tx,'; $sql.= ' l.remise_percent, l.subprice, l.rang, l.coef, l.label,'; - $sql.= ' p.ref as product_ref, p.description as product_desc'; + $sql.= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type'; $sql.= ' FROM '.MAIN_DB_PREFIX.'commandedet as l'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON (p.rowid = l.fk_product)'; $sql.= ' WHERE l.fk_commande = '.$this->id; @@ -1001,9 +1000,10 @@ class Commande extends CommonObject $ligne->coef = $objp->coef; $ligne->rang = $objp->rang; - $ligne->libelle = $objp->label; // Label produit - $ligne->product_desc = $objp->product_desc; // Description produit - $ligne->ref = $objp->product_ref; + $ligne->ref = $objp->product_ref; + $ligne->libelle = $objp->label; // Label produit + $ligne->product_desc = $objp->product_desc; // Description produit + $ligne->fk_product_type= $objp->fk_product_type; // Produit ou service $this->lignes[$i] = $ligne; $i++; @@ -1012,14 +1012,27 @@ class Commande extends CommonObject } return $this->lignes; } - + + + /** + * \brief Renvoie nombre de lignes de type produits. Doit etre appelé après fetch_lignes + * \return int <0 si ko, Nbre de lignes produits sinon + */ + function getNbOfProductsLines() + { + $nb=0; + foreach($this->lignes as $ligne) + { + if ($ligne->fk_product_type == 0) $nb++; + } + return $nb; + } /** - * - * - */ - - function fetch_adresse_livraison($id) + * + * + */ + function fetch_adresse_livraison($id) { $idadresse = $id; $adresse = new Societe($this->db); @@ -1414,7 +1427,7 @@ class Commande extends CommonObject } /** - * \brief Renvoi la liste des propal (éventuellement filtrée sur un user) dans un tableau + * \brief Renvoi la liste des commandes (éventuellement filtrée sur un user) dans un tableau * \param brouillon 0=non brouillon, 1=brouillon * \param user Objet user de filtre * \return int -1 si erreur, tableau résultat si ok diff --git a/htdocs/commande/contact.php b/htdocs/commande/contact.php index 69b8f0d067d..027abe74013 100644 --- a/htdocs/commande/contact.php +++ b/htdocs/commande/contact.php @@ -234,7 +234,7 @@ if ($id > 0) print ''; // Ref - print '"; diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 69b50ece82a..3ee082e3d2b 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -1600,7 +1600,8 @@ else } // Ship - if ($commande->statut > 0 && $commande->statut < 3 && $user->rights->expedition->creer) + if ($commande->statut > 0 && $commande->statut < 3 && $user->rights->expedition->creer + && $commande->getNbOfProductsLines() > 0) { print ''.$langs->trans('ShipProduct').''; } @@ -1690,59 +1691,8 @@ else } print '
'.$langs->trans("Ref").''; + print '
'.$langs->trans("Ref").''; print $commande->ref; print "
'; - /* - * Liste des expéditions - */ - $sql = 'SELECT e.rowid as expedition_id, e.ref,'.$db->pdate('e.date_expedition').' as de'; - if ($conf->livraison->enabled) $sql .= ", l.rowid as livraison_id, l.ref as livraison_ref"; - $sql .= ' FROM '.MAIN_DB_PREFIX.'expedition as e'; - if ($conf->livraison->enabled) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."livraison as l ON l.fk_expedition = e.rowid"; - $sql .= ' WHERE e.fk_commande = '. $commande->id; + // Rien a droite - $result = $db->query($sql); - if ($result) - { - $num = $db->num_rows($result); - if ($num) - { - print_titre($langs->trans('Sendings')); - $i = 0; $total = 0; - print ''; - print ''; - if ($conf->livraison->enabled) - { - print ''; - } - print ''; - - $var=True; - while ($i < $num) - { - $objp = $db->fetch_object($result); - $var=!$var; - print ''; - print ''; - if ($conf->livraison->enabled) - { - if ($objp->livraison_id) - { - print ''; - } - else - { - print ''; - } - } - print ''; - $i++; - } - print '
'.$langs->trans('Sendings').''.$langs->trans("DeliveryOrder").''.$langs->trans('Date').'
'.img_object($langs->trans('ShowSending'),'sending').' '.$objp->ref.''.img_object($langs->trans("ShowSending"),'generic').' '.$objp->livraison_ref.''.$langs->trans("CreateDeliveryOrder").''.dolibarr_print_date($objp->de).'
'; - } - } - else - { - dolibarr_print_error($db); - } print '
'; /* diff --git a/htdocs/commande/note.php b/htdocs/commande/note.php index 25761251ccc..6dc0415c6d8 100644 --- a/htdocs/commande/note.php +++ b/htdocs/commande/note.php @@ -111,7 +111,7 @@ if ($_GET["id"]) print ''; // Ref - print '"; diff --git a/htdocs/compta/commande/fiche.php b/htdocs/compta/commande/fiche.php index 2c3d97b780c..9d47d8b49b0 100644 --- a/htdocs/compta/commande/fiche.php +++ b/htdocs/compta/commande/fiche.php @@ -538,22 +538,22 @@ if ($_GET["id"] > 0) } - print '
'.$langs->trans("Ref").''; + print '
'.$langs->trans("Ref").''; print $commande->ref; print "
'; - - - /* - * Documents générés - * - */ - $comref = sanitize_string($commande->ref); - $file = $conf->commande->dir_output . '/' . $comref . '/' . $comref . '.pdf'; - $relativepath = $comref.'/'.$comref.'.pdf'; - $filedir = $conf->commande->dir_output . '/' . $comref; - $urlsource=$_SERVER["PHP_SELF"]."?id=".$commande->id; - $genallowed=0; - $delallowed=0; - - $somethingshown=$html->show_documents('commande',$comref,$filedir,$urlsource,$genallowed,$delallowed,$commande->modelpdf); + print '
'; + + + /* + * Documents générés + * + */ + $comref = sanitize_string($commande->ref); + $file = $conf->commande->dir_output . '/' . $comref . '/' . $comref . '.pdf'; + $relativepath = $comref.'/'.$comref.'.pdf'; + $filedir = $conf->commande->dir_output . '/' . $comref; + $urlsource=$_SERVER["PHP_SELF"]."?id=".$commande->id; + $genallowed=0; + $delallowed=0; + + $somethingshown=$html->show_documents('commande',$comref,$filedir,$urlsource,$genallowed,$delallowed,$commande->modelpdf); /* * Liste des factures @@ -598,38 +598,73 @@ if ($_GET["id"] > 0) print ''; - /* - * Liste des expéditions - */ - $sql = "SELECT e.rowid as expedition_id, e.ref,".$db->pdate("e.date_expedition")." as de"; - if ($conf->livraison->enabled) $sql .= ", l.rowid as livraison_id, l.ref as livraison_ref"; - $sql .= " FROM ".MAIN_DB_PREFIX."expedition as e"; - if ($conf->livraison->enabled) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."livraison as l ON l.fk_expedition = e.rowid"; - $sql .= " WHERE e.fk_commande = ". $commande->id; + // Rien a droite - $result = $db->query($sql); - if ($result) + print "
"; + + + /* + * Liste des expéditions + */ + $sql = "SELECT cd.fk_product, cd.description, cd.rowid, cd.qty as qty_commande"; + $sql .= " , ed.qty as qty_livre, e.ref, ed.fk_expedition as expedition_id"; + $sql .= ",".$db->pdate("e.date_expedition")." as date_expedition"; + if ($conf->livraison->enabled) $sql .= ", l.rowid as livraison_id, l.ref as livraison_ref"; + $sql .= " FROM ".MAIN_DB_PREFIX."commandedet as cd"; + $sql .= " , ".MAIN_DB_PREFIX."expeditiondet as ed, ".MAIN_DB_PREFIX."expedition as e"; + if ($conf->livraison->enabled) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."livraison as l ON l.fk_expedition = e.rowid"; + $sql .= " WHERE cd.fk_commande = ".$commande->id; + $sql .= " AND cd.rowid = ed.fk_commande_ligne"; + $sql .= " AND ed.fk_expedition = e.rowid"; + $sql .= " ORDER BY cd.fk_product"; + + $resql = $db->query($sql); + if ($resql) { - $num = $db->num_rows($result); + $num = $db->num_rows($resql); + $i = 0; + if ($num) { - print_titre($langs->trans("Sendings")); - $i = 0; $total = 0; - print ''; - print ""; + if ($somethingshown) print '
'; + + print_titre($langs->trans("SendingsForSameOrder")); + print '
".$langs->trans("Sendings")."
'; + print ''; + print ''; + print ''; + print ''; + print ''; if ($conf->livraison->enabled) { print ''; } - print "\n"; + print "\n"; $var=True; while ($i < $num) { - $objp = $db->fetch_object($result); $var=!$var; + $objp = $db->fetch_object($resql); print ""; - print ''; + print ''; + + if ($objp->fk_product > 0) + { + $product = new Product($db); + $product->fetch($objp->fk_product); + + print ''; + } + else + { + print "\n"; + } + print ''; + print ''; if ($conf->livraison->enabled) { if ($objp->livraison_id) @@ -641,19 +676,20 @@ if ($_GET["id"] > 0) print ''; } } - print "\n"; + print ''; + $i++; } - print "
'.$langs->trans("Sending").''.$langs->trans("Product").''.$langs->trans("QtyShipped").''.$langs->trans("Date").''.$langs->trans("DeliveryOrder").'".$langs->trans("Date")."
'.img_object($langs->trans("ShowSending"),"sending").' '.$objp->ref.''.img_object($langs->trans("ShowSending"),'sending').' '.$objp->ref.''; + print ''.img_object($langs->trans("ShowProduct"),"product").' '.$product->ref.' - '.$product->libelle; + if ($objp->description) print '
'.nl2br($objp->description); + print '
".stripslashes(nl2br($objp->description))."'.$objp->qty_livre.''.dolibarr_print_date($objp->date_expedition).''.$langs->trans("CreateDeliveryOrder").'".dolibarr_print_date($objp->de)."
"; + + print '
'; } + $db->free($resql); } else { dolibarr_print_error($db); } - - print ""; - + } else { diff --git a/htdocs/expedition/commande.php b/htdocs/expedition/commande.php index b6a91c14ee4..592d798d777 100644 --- a/htdocs/expedition/commande.php +++ b/htdocs/expedition/commande.php @@ -422,9 +422,33 @@ if ($_GET["id"] > 0) } + + + print ''; - print "
'; + + /* + * Documents générés + * + */ + $comref = sanitize_string($commande->ref); + $file = $conf->commande->dir_output . '/' . $comref . '/' . $comref . '.pdf'; + $relativepath = $comref.'/'.$comref.'.pdf'; + $filedir = $conf->commande->dir_output . '/' . $comref; + $urlsource=$_SERVER["PHP_SELF"]."?id=".$commande->id; + $genallowed=0; + $delallowed=0; + + $somethingshown=$html->show_documents('commande',$comref,$filedir,$urlsource,$genallowed,$delallowed,$commande->modelpdf); + + + print ''; + + // Bouton expedier avec gestion des stocks if ($conf->stock->enabled && $reste_a_livrer_total > 0 && $commande->statut > 0 && $commande->statut < 3 && $user->rights->expedition->creer) { + print_titre($langs->trans("NewSending")); + print '
'; print ''; print ''; @@ -454,12 +478,17 @@ if ($_GET["id"] > 0) print ''; print '

"; + print ""; print "\n"; + + $somethingshown=1; } + print ""; + + /* - * Déjà livré + * Liste des expéditions */ $sql = "SELECT cd.fk_product, cd.description, cd.rowid, cd.qty as qty_commande"; $sql .= " , ed.qty as qty_livre, e.ref, ed.fk_expedition as expedition_id"; @@ -471,7 +500,6 @@ if ($_GET["id"] > 0) $sql .= " WHERE cd.fk_commande = ".$commande->id; $sql .= " AND cd.rowid = ed.fk_commande_ligne"; $sql .= " AND ed.fk_expedition = e.rowid"; - $sql .= " AND e.fk_statut > 0"; $sql .= " ORDER BY cd.fk_product"; $resql = $db->query($sql); @@ -482,9 +510,9 @@ if ($_GET["id"] > 0) if ($num) { - print '
'; + if ($somethingshown) print '
'; - print_titre($langs->trans("OtherSendingsForSameOrder")); + print_titre($langs->trans("SendingsForSameOrder")); print ''; print ''; print ''; diff --git a/htdocs/expedition/expedition.class.php b/htdocs/expedition/expedition.class.php index 3f9852da39a..817cde8c680 100644 --- a/htdocs/expedition/expedition.class.php +++ b/htdocs/expedition/expedition.class.php @@ -40,6 +40,7 @@ class Expedition extends CommonObject var $id; var $brouillon; var $entrepot_id; + var $modelpdf; /** @@ -192,11 +193,12 @@ class Expedition extends CommonObject { global $conf; - $sql = "SELECT e.rowid, e.date_creation, e.ref, e.fk_user_author, e.fk_statut, e.fk_commande, e.fk_entrepot"; - $sql.= ", ".$this->db->pdate("e.date_expedition")." as date_expedition, c.fk_adresse_livraison"; + $sql = "SELECT e.rowid, e.date_creation, e.ref, e.fk_user_author, e.fk_statut, e.fk_commande, e.fk_entrepot,"; + $sql.= " ".$this->db->pdate("e.date_expedition")." as date_expedition, e.model_pdf,"; + $sql.= " c.fk_adresse_livraison"; if ($conf->livraison->enabled) $sql.=", l.rowid as livraison_id"; - $sql.= " FROM ".MAIN_DB_PREFIX."commande as c"; - $sql.= ", ".MAIN_DB_PREFIX."expedition as e"; + $sql.= " FROM ".MAIN_DB_PREFIX."commande as c,"; + $sql.= " ".MAIN_DB_PREFIX."expedition as e"; if ($conf->livraison->enabled) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."livraison as l ON e.rowid = l.fk_expedition"; $sql.= " WHERE e.rowid = ".$id; $sql.= " AND e.fk_commande = c.rowid"; @@ -219,6 +221,7 @@ class Expedition extends CommonObject $this->date = $obj->date_expedition; $this->entrepot_id = $obj->fk_entrepot; $this->adresse_livraison_id = $obj->fk_adresse_livraison; + $this->modelpdf = $obj->model_pdf; $this->db->free($result); if ($this->statut == 0) $this->brouillon = 1; @@ -519,6 +522,8 @@ class Expedition extends CommonObject return -1; } } + + /** * Classe la commande * @@ -540,6 +545,32 @@ class Expedition extends CommonObject } + /** + * \brief Positionne modele derniere generation + * \param user Objet use qui modifie + * \param modelpdf Nom du modele + */ + function set_pdf_model($user, $modelpdf) + { + if ($user->rights->expedition->creer) + { + $sql = "UPDATE ".MAIN_DB_PREFIX."expedition SET model_pdf = '$modelpdf'"; + $sql.= " WHERE rowid = ".$this->id; + + if ($this->db->query($sql) ) + { + $this->modelpdf=$modelpdf; + return 1; + } + else + { + dolibarr_print_error($this->db); + return 0; + } + } + } + + /* * Lit la commande associée * @@ -588,22 +619,39 @@ class Expedition extends CommonObject } /** - * \brief Retourne le libellé du statut d'un entrepot (ouvert, fermé) + * \brief Retourne le libellé du statut d'une expedition * \return string Libellé */ - function getLibStatut() + function getLibStatut($mode=0) { - return $this->LibStatut($this->statut); + return $this->LibStatut($this->statut,$mode); } - /** - * \brief Renvoi le libellé d'un statut donné - * \param statut id statut - * \return string Libellé - */ - function LibStatut($statut) + /** + * \brief Renvoi le libellé d'un statut donné + * \param statut Id statut + * \param mode 0=libellé long, 1=libellé court, 2=Picto + Libellé court, 3=Picto, 4=Picto + Libellé long, 5=Libellé court + Picto + * \return string Libellé + */ + function LibStatut($statut,$mode) { - return $this->statuts[$statut]; + global $langs; + + if ($mode==0) + { + if ($statut==0) return $this->statuts[$statut]; + if ($statut==1) return $this->statuts[$statut]; + } + if ($mode==1) + { + if ($statut==0) return $this->statuts[$statut]; + if ($statut==1) return $this->statuts[$statut]; + } + if ($mode == 4) + { + if ($statut==0) return img_picto($langs->trans('StatusSendingDraft'),'statut0').' '.$langs->trans('StatusSendingDraft'); + if ($statut==1) return img_picto($langs->trans('StatusSendingValidated'),'statut4').' '.$langs->trans('StatusSendingValidated'); + } } } diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php index 7bbdfa4c171..96a90345788 100644 --- a/htdocs/expedition/fiche.php +++ b/htdocs/expedition/fiche.php @@ -139,12 +139,20 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes') */ 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']); + if ($_REQUEST['model']) + { + $expedition->set_pdf_model($user, $_REQUEST['model']); + } + if ($_REQUEST['lang_id']) { $outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs"); $outputlangs->setDefaultLang($_REQUEST['lang_id']); } - $result=expedition_pdf_create($db, $_REQUEST['id'],$_REQUEST['model'],$outputlangs); + $result=expedition_pdf_create($db, $expedition->id,$expedition->modelpdf,$outputlangs); if ($result <= 0) { dolibarr_print_error($db,$result); @@ -513,7 +521,7 @@ else // Statut print ''; - print '\n"; + print '\n"; print ''; if (!$conf->expedition->enabled && $conf->stock->enabled) @@ -617,8 +625,11 @@ else print ''.$langs->trans("DeliveryOrder").''; } - print ''.$langs->trans('BuildPDF').''; - + if ($user->rights->expedition->lire && ($expedition->statut > 0)) + { + print ''.$langs->trans('BuildPDF').''; + } + if ($expedition->brouillon && $user->rights->expedition->supprimer) { print ''.$langs->trans("Delete").''; @@ -639,7 +650,7 @@ else $urlsource = $_SERVER["PHP_SELF"]."?id=".$expedition->id; - $genallowed=$user->rights->expedition->creer && ($expedition->statut > 0); + $genallowed=$user->rights->expedition->lire && ($expedition->statut > 0); $delallowed=$user->rights->expedition->supprimer; //$genallowed=1; //$delallowed=0; @@ -648,7 +659,7 @@ else if ($genallowed && ! $somethingshown) $somethingshown=1; /* - * Déjà livre + * Autres expeditions */ $sql = "SELECT cd.fk_product, cd.description, cd.rowid, cd.qty as qty_commande"; $sql .= " , ed.qty as qty_livre, e.ref, ed.fk_expedition as expedition_id"; @@ -659,7 +670,6 @@ else $sql .= " AND e.rowid <> ".$expedition->id; $sql .= " AND cd.rowid = ed.fk_commande_ligne"; $sql .= " AND ed.fk_expedition = e.rowid"; - $sql .= " AND e.fk_statut > 0"; $sql .= " ORDER BY cd.fk_product"; $resql = $db->query($sql); @@ -716,102 +726,11 @@ else dolibarr_print_error($db); } - /* - * Commandes associées - * - */ - $file = $conf->commande->dir_output . "/" . $commande->ref . "/" . $commande->ref . ".pdf"; - $relativepath = $commande->ref . "/" . $commande->ref . ".pdf"; - - $var=true; - - if (file_exists($file)) - { - print '
'; - print_titre("Orders"); - print '
'.$langs->trans("Sending").'
'.$langs->trans("Status").''.$expedition->getLibStatut()."'.$expedition->getLibStatut(4)."
'; - - print ""; - print ''; - print ''; - print ''; - print ''; - - print "
PDF'.$commande->ref.'.pdf'.filesize($file). ' bytes'.strftime("%d %b %Y %H:%M:%S",filemtime($file)).'
\n"; - } - print ''; - - /* - * Liste des actions - * - */ - print_titre("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->socidp." 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') - { - $replytoname = $user->fullname; - $from_name = $replytoname; - - $replytomail = $user->email; - $from_mail = $replytomail; - - print "
id&action=send\">\n"; - print ''; - print ''; - - print "

Envoyer la commande par mail"; - print ""; - print '"; - print ""; - print ""; - print "
Destinataire'; - - $form = new Form($db); - $form->select_array("destinataire",$soc->contact_email_array()); - - print "email\">
Expéditeur$from_name$from_mail
Reply-to$replytoname$replytomail
"; - - print "

"; - } - + // Rien a droite + print ''; } diff --git a/htdocs/expedition/mods/pdf/pdf_expedition_merou.modules.php b/htdocs/expedition/mods/pdf/pdf_expedition_merou.modules.php index baacab0a024..b6f921cf225 100644 --- a/htdocs/expedition/mods/pdf/pdf_expedition_merou.modules.php +++ b/htdocs/expedition/mods/pdf/pdf_expedition_merou.modules.php @@ -87,6 +87,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition $outputlangs->load("bills"); $outputlangs->load("propal"); $outputlangs->load("products"); + $outputlangs->load("sendings"); $outputlangs->setPhpLang(); @@ -171,7 +172,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition //Generation du tableau $this->_tableau($pdf, $tab_top, $tab_height, $nexY); //Recuperation des produits de la commande. - $this->expe->commande->fetch_lignes(); + $this->expe->commande->fetch_lignes(1); $Produits = $this->expe->commande->lignes; $nblignes = sizeof($Produits); for ($i = 0 ; $i < $nblignes ; $i++){ @@ -188,7 +189,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition //Insertion du libelle $pdf->SetFont('Arial','', 7); $pdf->SetXY (50, $curY ); - $pdf->MultiCell(130, 5, stripslashes($Prod->libelle), 0, 'L', 0); + $pdf->MultiCell(130, 5, $Prod->libelle, 0, 'L', 0); //Insertion de la quantite $pdf->SetFont('Arial','', 7); $pdf->SetXY (180, $curY ); @@ -319,7 +320,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition $pdf->SetXY(60,7); $pdf->SetFont('Arial','B',14); $pdf->SetTextColor(0,0,0); - $pdf->MultiCell(0, 8, "BON DE LIVRAISON", '' , 'L'); + $pdf->MultiCell(0, 8, $langs->trans("SendingSheet"), '' , 'L'); //Num Expedition $Yoff = $Yoff+7; $Xoff = 115; @@ -327,10 +328,10 @@ Class pdf_expedition_merou extends ModelePdfExpedition $pdf->SetXY($Xoff,$Yoff); $pdf->SetFont('Arial','',8); $pdf->SetTextColor(0,0,0); - $pdf->MultiCell(0, 8, $langs->trans("Ref: ").$exp->ref, '' , 'L'); + $pdf->MultiCell(0, 8, $langs->trans("RefSending").': '.$exp->ref, '' , 'L'); //$this->Code39($Xoff+43, $Yoff+1, $this->expe->ref,$ext = true, $cks = false, $w = 0.4, $h = 4, $wide = true); //Num Commande - $Yoff = $Yoff+10; + $Yoff = $Yoff+4; // $pdf->rect($Xoff, $Yoff, 85, 8); $pdf->SetXY($Xoff,$Yoff); $pdf->SetFont('Arial','',8); diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang index 151ce7fbafc..5257de67009 100755 --- a/htdocs/langs/en_US/orders.lang +++ b/htdocs/langs/en_US/orders.lang @@ -56,7 +56,8 @@ OrdersStatistics=Orders' statistics NumberOfOrdersByMonth=Number of orders by month ListOfOrders=List of orders CloseOrder=Close order -ConfirmCloseOrder=Are you sure you want to close this order ? +ConfirmCloseOrder=Are you sure you want to close this order ? Once an order is closed, it can only be billed. +ConfirmCloseOrderIfSending=Are you sure you want to close this order ? You must close an order only when all shipping are done. ConfirmDeleteOrder=Are you sure you want to delete this order ? ConfirmValidateOrder=Are you sure you want to validate this order ? ConfirmCancelOrder=Are you sure you want to cancel this order ? diff --git a/htdocs/langs/en_US/sendings.lang b/htdocs/langs/en_US/sendings.lang index 65a61c2e4ac..4afb8322f63 100644 --- a/htdocs/langs/en_US/sendings.lang +++ b/htdocs/langs/en_US/sendings.lang @@ -1,4 +1,5 @@ # Dolibarr language file - en_US - sendings +RefSending=Ref. sending Sending=Sending Sendings=Sendings SendingsArea=Sendings area @@ -18,5 +19,11 @@ QtyShipped=Qty shipped QtyReceived=Qty received QtyToShip=Qty to ship KeepToShip=Keep to ship -OtherSendingsForSameOrder=Other sendings already shipped -SendingsToValidate=Sending to validate \ No newline at end of file +OtherSendingsForSameOrder=Other sendings for this order +SendingsForSameOrder=Sendings for this order +SendingsToValidate=Sending to validate +StatusSendingDraft=Draft +StatusSendingValidated=Validated (products to ship or already received) +StatusSendingDraftShort=Draft +StatusSendingValidatedShort=Validated +SendingSheet=Sending sheet \ No newline at end of file diff --git a/htdocs/langs/fr_FR/orders.lang b/htdocs/langs/fr_FR/orders.lang index 61d1826ef80..b0d47124851 100755 --- a/htdocs/langs/fr_FR/orders.lang +++ b/htdocs/langs/fr_FR/orders.lang @@ -56,7 +56,8 @@ OrdersStatistics=Statistiques des commandes NumberOfOrdersByMonth=Nombre de commandes par mois ListOfOrders=Liste des commandes CloseOrder=Cloturer commande -ConfirmCloseOrder=Êtes-vous sur de vouloir cloturer cette commande ? +ConfirmCloseOrder=Êtes-vous sur de vouloir cloturer cette commande ? Une fois une commande cloturée, elle doit être facturée. +ConfirmCloseOrderIfSending=Êtes-vous sur de vouloir cloturer cette commande ? Vous ne devez cloturer une commande qu'une fois les produits expédiés. ConfirmDeleteOrder=Êtes-vous sur de vouloir effacer cette commande ? ConfirmValidateOrder=Êtes-vous sur de vouloir valider cette commande ? ConfirmCancelOrder=Êtes-vous sur de vouloir annuler cette commande ? diff --git a/htdocs/langs/fr_FR/sendings.lang b/htdocs/langs/fr_FR/sendings.lang index c8157f89ddb..f58f5f28a90 100644 --- a/htdocs/langs/fr_FR/sendings.lang +++ b/htdocs/langs/fr_FR/sendings.lang @@ -1,4 +1,5 @@ # Dolibarr language file - fr_FR - sendings +RefSending=Réf. expédition Sending=Expédition Sendings=Expéditions SendingsArea=Espace expéditions @@ -18,5 +19,11 @@ QtyShipped=Qt QtyToShip=Qté à expédier QtyReceived=Qté reçue KeepToShip=Reste à expédier -OtherSendingsForSameOrder=Autres expéditions déjà envoyés -SendingsToValidate=Expéditions à valider \ No newline at end of file +OtherSendingsForSameOrder=Autres expéditions pour cette commande +SendingsForSameOrder=Expéditions pour cette commandes +SendingsToValidate=Expéditions à valider +StatusSendingDraft=Brouillon +StatusSendingValidated=Validée (produits à envoyer ou reçus) +StatusSendingDraftShort=Brouillon +StatusSendingValidatedShort=Validée +SendingSheet=Bon d'expédition \ No newline at end of file diff --git a/htdocs/lib/order.lib.php b/htdocs/lib/order.lib.php index 3cb1f400663..ad06bbf4354 100644 --- a/htdocs/lib/order.lib.php +++ b/htdocs/lib/order.lib.php @@ -49,7 +49,7 @@ function commande_prepare_head($commande) if (($conf->expedition->enabled || $conf->livraison->enabled) && $user->rights->expedition->lire) { $head[$h][0] = DOL_URL_ROOT.'/expedition/commande.php?id='.$commande->id; - $head[$h][1] = $langs->trans("SendingCard"); + $head[$h][1] = $langs->trans("Sendings"); $head[$h][2] = 'shipping'; $h++; } @@ -58,7 +58,7 @@ function commande_prepare_head($commande) if ($conf->facture->enabled) { $head[$h][0] = DOL_URL_ROOT.'/compta/commande/fiche.php?id='.$commande->id; - $head[$h][1] = $langs->trans("ComptaCard"); + $head[$h][1] = $langs->trans("Compta"); $head[$h][2] = 'accountancy'; $h++; } diff --git a/htdocs/livraison/fiche.php b/htdocs/livraison/fiche.php index 412e01051c6..97730fa9f42 100644 --- a/htdocs/livraison/fiche.php +++ b/htdocs/livraison/fiche.php @@ -628,101 +628,11 @@ else dolibarr_print_error($db); } - /* - * Commandes associées - * - */ - $file = $conf->commande->dir_output . "/" . $commande->ref . "/" . $commande->ref . ".pdf"; - $relativepath = $commande->ref . "/" . $commande->ref . ".pdf"; - - $var=true; - - if (file_exists($file)) - { - print '
'; - print_titre("Orders"); - 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)).'
\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->socidp." AND a.fk_action in (9,10)"; - $sql .= " AND a.fk_commande = ".$livraison->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') - { - $replytoname = $user->fullname; - $from_name = $replytoname; - - $replytomail = $user->email; - $from_mail = $replytomail; - - print "
id&action=send\">\n"; - print ''; - print ''; - - print "

Envoyer le bon de livraison par mail"; - print ""; - print '"; - print ""; - print ""; - print "
Destinataire'; - - $form = new Form($db); - $form->select_array("destinataire",$soc->contact_email_array()); - - print "email\">
Expéditeur$from_name$from_mail
Reply-to$replytoname$replytomail
"; - - print "

"; - } - + // Rien à droite + print ''; }