From 709e8944b7c800577a84db347c2fad553c72f437 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 14 Jan 2006 13:45:04 +0000 Subject: [PATCH] =?UTF-8?q?Fix:=20On=20exclut=20les=20expeditions=20brouil?= =?UTF-8?q?lons=20dans=20calcul=20des=20epxeditions=20livr=E9es=20Fix:=20L?= =?UTF-8?q?ien=20invalides?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/expedition/commande.php | 131 +++--- htdocs/expedition/fiche.php | 714 +++++++++++++++++---------------- 2 files changed, 430 insertions(+), 415 deletions(-) diff --git a/htdocs/expedition/commande.php b/htdocs/expedition/commande.php index 5d55d35402f..f048044733a 100644 --- a/htdocs/expedition/commande.php +++ b/htdocs/expedition/commande.php @@ -30,16 +30,16 @@ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/product.class.php"); +require_once(DOL_DOCUMENT_ROOT."/project.class.php"); +require_once(DOL_DOCUMENT_ROOT."/propal.class.php"); +require_once(DOL_DOCUMENT_ROOT."/product/stock/entrepot.class.php"); $user->getrights('commande'); $user->getrights('expedition'); if (!$user->rights->commande->lire) -accessforbidden(); + accessforbidden(); -require_once(DOL_DOCUMENT_ROOT."/project.class.php"); -require_once(DOL_DOCUMENT_ROOT."/propal.class.php"); -require_once(DOL_DOCUMENT_ROOT."/product/stock/entrepot.class.php"); // Sécurité accés client if ($user->societe_id > 0) @@ -60,6 +60,9 @@ if ($_POST["action"] == 'confirm_cloture' && $_POST["confirm"] == 'yes') } +$html = new Form($db); + + /* *************************************************************************** */ /* */ /* Mode vue et edition */ @@ -68,15 +71,13 @@ if ($_POST["action"] == 'confirm_cloture' && $_POST["confirm"] == 'yes') llxHeader('',$langs->trans("OrderCard")); -$html = new Form($db); - if ($_GET["id"] > 0) { $commande = New Commande($db); if ( $commande->fetch($_GET["id"]) > 0) { - $commande->livraison_array(); + $commande->livraison_array(1); $soc = new Societe($db); $soc->fetch($commande->soc_id); @@ -124,51 +125,51 @@ if ($_GET["id"] > 0) print "
"; } - // Onglet expedition + // Onglet commande print ''; - // Ref - print ''; - print ''; - print ''; - - // Société - print ''; - print ''; - print ''; - - $nbrow=3; - - // Ref commande client - print ''; - print ''; - print ''; - - print ''; - print ''; - print ''; - - print ''; - print ''; - print ''; + // Ref + print ''; + print ''; + print ''; + + // Société + print ''; + print ''; + print ''; + + $nbrow=3; + + // Ref commande client + print ''; + print ''; + print ''; + + print ''; + print ''; + print ''; + + print ''; + print ''; + print ''; print '
'.$langs->trans('Ref').''.$commande->ref.''.$langs->trans('Source').' : ' . $commande->sources[$commande->source] ; - if ($commande->source == 0) - { - // Si source = propal - $propal = new Propal($db); - $propal->fetch($commande->propale_id); - print ' -> '.$propal->ref.''; - } - print '
'.$langs->trans('Customer').''; - print ''.$soc->nom.'
'; - print ''; - print '
'; - print $langs->trans('RefCdeClient').''; - print '
'; - print '
'; - print $commande->ref_client; - print ''.$langs->trans('Note').' :
'; - print nl2br($commande->note); - print '
'.$langs->trans('Status').''.$commande->statuts[$commande->statut].'
'.$langs->trans('Date').''.dolibarr_print_date($commande->date,'%A %d %B %Y').'
'.$langs->trans('Ref').''.$commande->ref.''.$langs->trans('Source').' : ' . $commande->sources[$commande->source] ; + if ($commande->source == 0) + { + // Si source = propal + $propal = new Propal($db); + $propal->fetch($commande->propale_id); + print ' -> '.$propal->ref.''; + } + print '
'.$langs->trans('Customer').''; + print ''.$soc->nom.'
'; + print ''; + print '
'; + print $langs->trans('RefCdeClient').''; + print '
'; + print '
'; + print $commande->ref_client; + print ''.$langs->trans('Note').' :
'; + print nl2br($commande->note); + print '
'.$langs->trans('Status').''.$commande->statuts[$commande->statut].'
'.$langs->trans('Date').''.dolibarr_print_date($commande->date,'%A %d %B %Y').'
'; @@ -206,7 +207,7 @@ if ($_GET["id"] > 0) $reste_a_livrer = array(); while ($i < $num) { - $objp = $db->fetch_object(); + $objp = $db->fetch_object($resql); $var=!$var; print ""; @@ -373,25 +374,29 @@ if ($_GET["id"] > 0) /* * Déjà livré */ - $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"; - $sql .= " FROM ".MAIN_DB_PREFIX."commandedet as cd"; - $sql .= " , ".MAIN_DB_PREFIX."expeditiondet as ed, ".MAIN_DB_PREFIX."expedition as e"; - $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"; + $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"; + $sql .= " FROM ".MAIN_DB_PREFIX."commandedet as cd"; + $sql .= " , ".MAIN_DB_PREFIX."expeditiondet as ed, ".MAIN_DB_PREFIX."expedition as e"; + $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); if ($resql) { $num = $db->num_rows($resql); - $i = 0; + $i = 0; if ($num) { - print '
'; + print '
'; + + print_titre($langs->trans("OtherSendingsForSameOrder")); + print '
'; print ''; print ''; print ''; @@ -411,7 +416,7 @@ if ($_GET["id"] > 0) $product->fetch($objp->fk_product); print ''; } diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php index f68f39690ee..9382b872989 100644 --- a/htdocs/expedition/fiche.php +++ b/htdocs/expedition/fiche.php @@ -37,6 +37,7 @@ require_once(DOL_DOCUMENT_ROOT."/product/stock/entrepot.class.php"); $langs->load("bills"); +$user->getrights('expedition'); if (!$user->rights->expedition->lire) accessforbidden(); @@ -295,7 +296,7 @@ if ($_GET["action"] == 'create') * */ - print ''; + print ''; print "
'.$langs->trans("Description").'Quan. livrée'; - print ''.img_object($langs->trans("ShowProduct"),"product").' '.$product->ref.' - '.$product->libelle; + print ''.img_object($langs->trans("ShowProduct"),"product").' '.$product->ref.' - '.$product->libelle; if ($objp->description) print nl2br($objp->description); print '


"; print ''; } @@ -311,381 +312,390 @@ else /* */ /* *************************************************************************** */ { - - if ($_GET["id"] > 0) + if ($_GET["id"] > 0) { - $expedition = New Expedition($db); - $result = $expedition->fetch($_GET["id"]); - - if ( $expedition->id > 0) - { - $author = new User($db); - $author->id = $expedition->user_author_id; - $author->fetch(); - - llxHeader('','Fiche expedition','ch-expedition.html',$form_search,$author); - - $commande = New Commande($db); - $commande->fetch($expedition->commande_id); - - $soc = new Societe($db); - $soc->fetch($commande->soc_id); - - $h=0; - $head[$h][0] = DOL_URL_ROOT."/expedition/fiche.php?id=".$expedition->id; - $head[$h][1] = $langs->trans("SendingCard"); - $hselected = $h; - $h++; - - dolibarr_fiche_head($head, $hselected, $langs->trans("Sending")." : ".$expedition->ref); - - /* - * Confirmation de la suppression - * - */ - if ($_GET["action"] == 'delete') - { - $html->form_confirm("fiche.php?id=$expedition->id","Supprimer l'expedition","Etes-vous sûr de vouloir supprimer cette expedition ?","confirm_delete"); - print '
'; - } - - /* - * Confirmation de la validation - * - */ - if ($_GET["action"] == 'valid') - { - $html->form_confirm("fiche.php?id=$expedition->id","Valider l'expédition","Etes-vous sûr de vouloir valider cette expédition ?","confirm_valid"); - print '
'; - } - /* - * Confirmation de l'annulation - * - */ - if ($_GET["action"] == 'annuler') - { - $html->form_confirm("fiche.php?id=$expedition->id",$langs->trans("Cancel"),"Etes-vous sûr de vouloir annuler cette commande ?","confirm_cancel"); - print '
'; - } - - /* - * Commande - */ - if ($commande->brouillon == 1 && $user->rights->commande->creer) - { - print '
'; - print ''; - } - - print ''; - print ''; - print ''; - - print ''; - - print ""; - - print ''; - print '\n"; - print ''; - - print ''; - print "\n"; - - $entrepot = new Entrepot($db); - $entrepot->fetch($expedition->entrepot_id); - - print ''; - - print "
'.$langs->trans("Customer").''; - print ''.$soc->nom.''.$langs->trans("Author").''.$author->fullname.'
'.$langs->trans("Order").''.$commande->ref."  
'.$langs->trans("Date").'".strftime("%A %d %B %Y",$expedition->date)."'.$langs->trans("Warehouse").''.$entrepot->libelle.'
\n"; - - /* - * Lignes - * - */ - echo '
'; - - $sql = "SELECT cd.fk_product, cd.description, cd.rowid, cd.qty as qty_commande"; - $sql .= " , ed.qty as qty_livre"; - $sql .= " FROM ".MAIN_DB_PREFIX."commandedet as cd , ".MAIN_DB_PREFIX."expeditiondet as ed"; - $sql .= " WHERE ed.fk_expedition = $expedition->id AND cd.rowid = ed.fk_commande_ligne "; - - $resql = $db->query($sql); - - if ($resql) - { - $num_prod = $db->num_rows($resql); - $i = 0; - - print ''; - print ''; - print ''; - print ''; - print "\n"; - - $var=true; - while ($i < $num_prod) - { - $objp = $db->fetch_object($resql); - - $var=!$var; - print ""; - if ($objp->fk_product > 0) - { - $product = new Product($db); - $product->fetch($objp->fk_product); - - print ''; - } - else - { - print "\n"; - } - print ''; - print ''; - - print ""; - - $i++; - $var=!$var; - } - $db->free($resql); - } - else - { - dolibarr_print_error($db); - } - - print "
'.$langs->trans("Products").'Quan. commandéeQuan. livrée
'; - 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_commande.''.$objp->qty_livre.'
\n"; - - print "\n\n"; - - - /* - * - */ - if ($user->societe_id == 0) - { - print '
'; - - if ($expedition->statut == 0 && $user->rights->expedition->valider && $num_prod > 0) - { - print ''.$langs->trans("Validate").''; - } - - print ''.$langs->trans('BuildPDF').''; - - if ($expedition->brouillon && $user->rights->expedition->supprimer) - { - print ''.$langs->trans("Delete").''; - } - - print '
'; - } - - - /* - * Documents générés - */ - $filename=sanitize_string($expedition->id); - $filedir=$conf->expedition->dir_output . "/" .get_exdir($expedition->id); - $urlsource=$_SERVER["PHP_SELF"]."?id=".$expedition->id; - //$genallowed=$user->rights->expedition->creer; - //$delallowed=$user->rights->expedition->supprimer; - $genallowed=0; - $delallowed=0; - - $var=true; - - print "
\n"; - - $html->show_documents('expedition',$filename,$filedir,$urlsource,$genallowed,$delallowed,$expedition->modelpdf); - - - /* - * Déjà livré - */ - $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"; - $sql .= " FROM ".MAIN_DB_PREFIX."commandedet as cd"; - $sql .= " , ".MAIN_DB_PREFIX."expeditiondet as ed, ".MAIN_DB_PREFIX."expedition as e"; - $sql .= " WHERE cd.fk_commande = $expedition->commande_id"; - $sql .= " AND e.rowid <> $expedition->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) + $expedition = New Expedition($db); + $result = $expedition->fetch($_GET["id"]); + + if ( $expedition->id > 0) { - $num = $db->num_rows($resql); - $i = 0; - - if ($num) + $author = new User($db); + $author->id = $expedition->user_author_id; + $author->fetch(); + + llxHeader('','Fiche expedition','ch-expedition.html',$form_search,$author); + + $commande = New Commande($db); + $commande->fetch($expedition->commande_id); + + $soc = new Societe($db); + $soc->fetch($commande->soc_id); + + $h=0; + $head[$h][0] = DOL_URL_ROOT."/expedition/fiche.php?id=".$expedition->id; + $head[$h][1] = $langs->trans("SendingCard"); + $hselected = $h; + $h++; + + dolibarr_fiche_head($head, $hselected, $langs->trans("Sending")); + + /* + * Confirmation de la suppression + * + */ + if ($_GET["action"] == 'delete') { + $html->form_confirm("fiche.php?id=$expedition->id","Supprimer l'expedition","Etes-vous sûr de vouloir supprimer cette expedition ?","confirm_delete"); print '
'; - - print_titre($langs->trans("OtherSendingsForSameOrder")); - print ''; + } + + /* + * Confirmation de la validation + * + */ + if ($_GET["action"] == 'valid') + { + $html->form_confirm("fiche.php?id=$expedition->id","Valider l'expédition","Etes-vous sûr de vouloir valider cette expédition ?","confirm_valid"); + print '
'; + } + /* + * Confirmation de l'annulation + * + */ + if ($_GET["action"] == 'annuler') + { + $html->form_confirm("fiche.php?id=$expedition->id",$langs->trans("Cancel"),"Etes-vous sûr de vouloir annuler cette commande ?","confirm_cancel"); + print '
'; + } + + /* + * Commande + */ + if ($commande->brouillon == 1 && $user->rights->commande->creer) + { + print ''; + print ''; + } + + print '
'; + + // Ref + print ''; + print ''; + + // Client + print ''; + print ''; + + // Auteur + print ''; + + print ""; + + // Commande liée + print ''; + print '\n"; + print ''; + + // Date + print ''; + print "\n"; + + // Entrepot + $entrepot = new Entrepot($db); + $entrepot->fetch($expedition->entrepot_id); + print ''; + + print "
'.$langs->trans("Ref").''.$expedition->ref.'
'.$langs->trans("Customer").''; + print ''.$soc->nom.''.$langs->trans("Author").''.$author->fullname.'
'.$langs->trans("Order").''.$commande->ref."  
'.$langs->trans("Date").'".strftime("%A %d %B %Y",$expedition->date)."'.$langs->trans("Warehouse").''.$entrepot->libelle.'
\n"; + + /* + * Lignes produits + */ + echo '
'; + + $sql = "SELECT cd.fk_product, cd.description, cd.rowid, cd.qty as qty_commande"; + $sql .= " , ed.qty as qty_livre"; + $sql .= " FROM ".MAIN_DB_PREFIX."commandedet as cd , ".MAIN_DB_PREFIX."expeditiondet as ed"; + $sql .= " WHERE ed.fk_expedition = $expedition->id AND cd.rowid = ed.fk_commande_ligne "; + + $resql = $db->query($sql); + + if ($resql) + { + $num_prod = $db->num_rows($resql); + $i = 0; + print ''; - print ''; + print ''; + print ''; print ''; - print ''; - print ''; print "\n"; - - $var=True; - while ($i < $num) + + $var=true; + while ($i < $num_prod) { - $var=!$var; $objp = $db->fetch_object($resql); + + $var=!$var; print ""; if ($objp->fk_product > 0) { - $product = new Product($db); - $product->fetch($objp->fk_product); - - print ''; + $product = new Product($db); + $product->fetch($objp->fk_product); + + print ''; } else { print "\n"; } + print ''; print ''; - print ''; - print ''; + + print ""; + $i++; + $var=!$var; } - - print '
'.$langs->trans("Description").''.$langs->trans("Products").'Quan. commandéeQuan. livrée'.$langs->trans("Sending").''.$langs->trans("Date").'
'; - print ''.img_object($langs->trans("ShowProduct"),"product").' '.$product->ref.' - '.$product->libelle; - if ($objp->description) print nl2br($objp->description); - print ''; + 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_commande.''.$objp->qty_livre.''.img_object($langs->trans("ShowSending"),'sending').' '.$objp->ref.''.dolibarr_print_date($objp->date_expedition).'
'; + $db->free($resql); + } + else + { + dolibarr_print_error($db); + } + + print "\n"; + + print "\n\n"; + + + /* + * Boutons actions + */ + + if ($user->societe_id == 0) + { + print '
'; + + if ($expedition->statut == 0 && $user->rights->expedition->valider && $num_prod > 0) + { + print ''.$langs->trans("Validate").''; + } + + print ''.$langs->trans('BuildPDF').''; + + if ($expedition->brouillon && $user->rights->expedition->supprimer) + { + print ''.$langs->trans("Delete").''; + } + + print '
'; + } + + + /* + * Documents générés + */ + $filename=sanitize_string($expedition->id); + $filedir=$conf->expedition->dir_output . "/" .get_exdir($expedition->id); + $urlsource=$_SERVER["PHP_SELF"]."?id=".$expedition->id; + //$genallowed=$user->rights->expedition->creer; + //$delallowed=$user->rights->expedition->supprimer; + $genallowed=0; + $delallowed=0; + + $var=true; + + print "
\n"; + + $html->show_documents('expedition',$filename,$filedir,$urlsource,$genallowed,$delallowed,$expedition->modelpdf); + + + /* + * Déjà livre + */ + $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"; + $sql .= " FROM ".MAIN_DB_PREFIX."commandedet as cd"; + $sql .= " , ".MAIN_DB_PREFIX."expeditiondet as ed, ".MAIN_DB_PREFIX."expedition as e"; + $sql .= " WHERE cd.fk_commande = ".$expedition->commande_id; + $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); + if ($resql) + { + $num = $db->num_rows($resql); + $i = 0; + + if ($num) + { + print '
'; + + print_titre($langs->trans("OtherSendingsForSameOrder")); + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print "\n"; + + $var=True; + while ($i < $num) + { + $var=!$var; + $objp = $db->fetch_object($resql); + print ""; + if ($objp->fk_product > 0) + { + $product = new Product($db); + $product->fetch($objp->fk_product); + + print ''; + } + else + { + print "\n"; + } + print ''; + print ''; + print ''; + $i++; + } + + print '
'.$langs->trans("Description").'Quan. livrée'.$langs->trans("Sending").''.$langs->trans("Date").'
'; + 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.''.img_object($langs->trans("ShowSending"),'sending').' '.$objp->ref.''.dolibarr_print_date($objp->date_expedition).'
'; + } + $db->free($resql); + } + else { + dolibarr_print_error($db); + } + + /* + * Documents générés + * + */ + $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("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)).'
\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 = $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 "
"; + } + /* + * + * + */ + + 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 "

"; } - $db->free($resql); } - else { - dolibarr_print_error($db); - } - - /* - * Documents générés - * - */ - $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("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)).'
\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 = $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 "
"; - } - /* - * - * - */ - - 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 "

"; - } - } - else - { - /* Expedition non trouvée */ - llxHeader('','Fiche expedition','ch-expedition.html',$form_search); - print "Expedition inexistante ou accés refusé"; - } + else + { + /* Expedition non trouvée */ + llxHeader('','Fiche expedition','ch-expedition.html',$form_search); + print "Expedition inexistante ou accés refusé"; + } } - else + else { - /* Expedition non trouvée */ - llxHeader('','Fiche expedition','ch-expedition.html',$form_search); - print "Expedition inexistante ou accés refusé"; + /* Expedition non trouvée */ + llxHeader('','Fiche expedition','ch-expedition.html',$form_search); + print "Expedition inexistante ou accés refusé"; } }