diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php
index a2a2ac7de4a..ae1b65bca5f 100644
--- a/htdocs/commande/fiche.php
+++ b/htdocs/commande/fiche.php
@@ -745,13 +745,13 @@ else
$head[$h][1] = $langs->trans('ComptaCard');
$h++;
}
-
+
if ($conf->use_preview_tabs)
- {
- $head[$h][0] = DOL_URL_ROOT.'/commande/apercu.php?id='.$commande->id;
- $head[$h][1] = $langs->trans("Preview");
- $h++;
- }
+ {
+ $head[$h][0] = DOL_URL_ROOT.'/commande/apercu.php?id='.$commande->id;
+ $head[$h][1] = $langs->trans("Preview");
+ $h++;
+ }
$head[$h][0] = DOL_URL_ROOT.'/commande/info.php?id='.$commande->id;
$head[$h][1] = $langs->trans('Info');
@@ -760,8 +760,8 @@ else
dolibarr_fiche_head($head, $hselected, $langs->trans('Order').': '.$commande->ref);
/*
- * Confirmation de la suppression de la commande
- */
+ * Confirmation de la suppression de la commande
+ */
if ($_GET['action'] == 'delete')
{
$html->form_confirm('fiche.php?id='.$id, $langs->trans('DeleteOrder'), $langs->trans('ConfirmDeleteOrder'), 'confirm_delete');
@@ -769,8 +769,8 @@ else
}
/*
- * Confirmation de la validation
- */
+ * Confirmation de la validation
+ */
if ($_GET['action'] == 'valid')
{
//$numfa = commande_get_num($soc);
@@ -779,8 +779,8 @@ else
}
/*
- * Confirmation de la cloture
- */
+ * Confirmation de la cloture
+ */
if ($_GET['action'] == 'cloture')
{
//$numfa = commande_get_num($soc);
@@ -789,8 +789,8 @@ else
}
/*
- * Confirmation de l'annulation
- */
+ * Confirmation de l'annulation
+ */
if ($_GET['action'] == 'annuler')
{
$html->form_confirm('fiche.php?id='.$id, $langs->trans('Cancel'), $langs->trans('ConfirmCancelOrder'), 'confirm_cancel');
@@ -798,26 +798,26 @@ else
}
/*
- * Commande
- */
+ * Commande
+ */
$nbrow=8;
if ($conf->projet->enabled) $nbrow++;
print '
';
- // Ref
+ // Ref
print '| '.$langs->trans('Ref').' | ';
print ''.$commande->ref.' | ';
print '
';
// Ref commande client
print '| ';
- print '';
+ print ' | ';
if ($user->rights->commande->creer && $_GET['action'] == 'refcdeclient')
{
print ' | ';
print '
';
-
- // Société
+
+ // Sociét
print '| '.$langs->trans('Company').' | ';
print '';
print ''.$soc->nom.' | ';
@@ -852,23 +852,23 @@ else
}
print '';
print '
';
-
+
// Date de livraison
print '| ';
print '';
print ' | ';
if ($_GET['action'] == 'editdate_livraison')
{
print '';
+ print '';
+ $html->select_date($commande->date_livraison,'liv_','','','',"setdate_livraison");
+ print '';
+ print '';
}
else
{
@@ -888,21 +888,21 @@ else
{
print nl2br($commande->note);
}
-
+
print ' | ';
print '
';
-
-
+
+
// Adresse de livraison
print '| ';
print '';
print ' | ';
-
+
if ($_GET['action'] == 'editdelivery_adress')
{
$html->form_adresse_livraison($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->adresse_livraison_id,$_GET['socid'],'adresse_livraison_id','commande',$commande->id);
@@ -912,13 +912,13 @@ else
$html->form_adresse_livraison($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->adresse_livraison_id,$_GET['socid'],'none','commande',$commande->id);
}
print ' |
';
-
+
// Conditions et modes de réglement
print '| ';
print '';
print ' | ';
@@ -948,31 +948,31 @@ else
}
print ' |
';
- // Projet
- if ($conf->projet->enabled)
- {
- $langs->load('projects');
- print '| ';
- print '';
- print ' | ';
- if ($_GET['action'] == 'classer')
- {
- $html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->soc_id, $commande->projet_id, 'projetid');
- }
- else
- {
- $html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->soc_id, $commande->projet_id, 'none');
- }
- print ' |
';
- }
+ // Projet
+ if ($conf->projet->enabled)
+ {
+ $langs->load('projects');
+ print '| ';
+ print '';
+ print ' | ';
+ if ($_GET['action'] == 'classer')
+ {
+ $html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->soc_id, $commande->projet_id, 'projetid');
+ }
+ else
+ {
+ $html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->soc_id, $commande->projet_id, 'none');
+ }
+ print ' |
';
+ }
// Lignes de 3 colonnes
- // Total HT
+ // Total HT
print '| '.$langs->trans('TotalHT').' | ';
print ''.price($commande->total_ht).' | ';
print ''.$langs->trans('Currency'.$conf->monnaie).' |
';
@@ -980,7 +980,7 @@ else
// Total TVA
print '| '.$langs->trans('TotalVAT').' | '.price($commande->total_tva).' | ';
print ''.$langs->trans('Currency'.$conf->monnaie).' |
';
-
+
// Total TTC
print '| '.$langs->trans('TotalTTC').' | '.price($commande->total_ttc).' | ';
print ''.$langs->trans('Currency'.$conf->monnaie).' |
';
@@ -989,21 +989,21 @@ else
print '| '.$langs->trans('Status').' | ';
print ''.$commande->getLibStatut(4).' | ';
print '
';
-
+
print '
';
print "\n";
-
+
/*
- * Lignes de commandes
- */
+ * Lignes de commandes
+ */
$sql = 'SELECT l.fk_product, l.description, l.price, l.qty, l.rowid, l.tva_tx, l.remise_percent, l.subprice,';
$sql.= ' p.label as product, p.ref, p.fk_product_type, p.rowid as prodid';
-
+
if ($conf->global->COM_ADD_PROD_DESC && !$conf->global->CHANGE_PROD_DESC)
- {
- $sql.= ', p.description as product_desc';
- }
-
+ {
+ $sql.= ', p.description as product_desc';
+ }
+
$sql.= ' FROM '.MAIN_DB_PREFIX.'commandedet as l';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product=p.rowid';
$sql.= ' WHERE l.fk_commande = '.$commande->id;
@@ -1047,12 +1047,12 @@ else
else print img_object($langs->trans('ShowProduct'),'product');
print ' '.$objp->ref.' - '.stripslashes(nl2br($objp->product));
print ($objp->description && $objp->description!=$objp->product)?'
'.stripslashes(nl2br($objp->description)):'';
-
+
if ($conf->global->COM_ADD_PROD_DESC && !$conf->global->CHANGE_PROD_DESC)
- {
- print '
'.nl2br(stripslashes($objp->product_desc));
- }
-
+ {
+ print '
'.nl2br(stripslashes($objp->product_desc));
+ }
+
print '';
}
else
@@ -1060,7 +1060,7 @@ else
print ''.stripslashes(nl2br($objp->description));
print ' | ';
}
-
+
print ''.$objp->tva_tx.'% | ';
print ''.price($objp->subprice).' | ';
print ''.$objp->qty.' | ';
@@ -1115,9 +1115,9 @@ else
print '';
print '';
if($soc->tva_assuj == "0")
- print '0';
+ print '0';
else
- print $html->select_tva('eltva_tx',$objp->tva_tx,$mysoc,$soc);
+ print $html->select_tva('eltva_tx',$objp->tva_tx,$mysoc,$soc);
print ' | ';
print ' | ';
print ' | ';
@@ -1139,9 +1139,9 @@ else
}
/*
- * Lignes de remise
- */
-
+ * Lignes de remise
+ */
+
// Remise relative
$var=!$var;
print '';
/*
- * Ajouter une ligne
- */
+ * Ajouter une ligne
+ */
if ($commande->statut == 0 && $user->rights->commande->creer && ($_GET['action'] == '' || $_GET['action'] == 'builddoc' || $_GET['action'] == 'modif'))
{
print '';
@@ -1276,9 +1276,9 @@ else
print ' | ';
print '';
if($soc->tva_assuj == "0")
- print '0';
+ print '0';
else
- print $html->select_tva('tva_tx',$conf->defaulttx,$mysoc,$soc);
+ print $html->select_tva('tva_tx',$conf->defaulttx,$mysoc,$soc);
print ' | ';
print ' | ';
print ' | ';
@@ -1298,9 +1298,9 @@ else
print '';
// multiprix
if($conf->global->PRODUIT_MULTIPRICES == 1)
- $html->select_produits('','p_idprod','',$conf->produit->limit_size,$soc->price_level);
+ $html->select_produits('','p_idprod','',$conf->produit->limit_size,$soc->price_level);
else
- $html->select_produits('','p_idprod','',$conf->produit->limit_size);
+ $html->select_produits('','p_idprod','',$conf->produit->limit_size);
print ' ';
print '';
print ' | ';
@@ -1316,8 +1316,8 @@ else
print '';
/*
- * Boutons actions
- */
+ * Boutons actions
+ */
if ($user->societe_id == 0 && $commande->statut < 3 && ($_GET['action'] == '' || $_GET['action'] == 'builddoc' || $_GET['action'] == 'modif'))
{
print '';
@@ -1330,35 +1330,35 @@ else
print '
'.$langs->trans('Valid').'';
}
}
-
+
// Edit
- if ($commande->statut == 1)
- {
- if ($user->rights->commande->creer)
- {
- print '
'.$langs->trans('Edit').'';
- }
- }
+ if ($commande->statut == 1)
+ {
+ if ($user->rights->commande->creer)
+ {
+ print '
'.$langs->trans('Edit').'';
+ }
+ }
// Build PDF
if ($user->rights->commande->creer)
{
print '
'.$langs->trans("BuildPDF").'';
}
-
+
// Send
- if ($commande->statut == 1)
- {
- if ($user->rights->commande->envoyer)
- {
- $comref = sanitize_string($commande->ref);
- $file = $conf->commande->dir_output . '/'.$comref.'/'.$comref.'.pdf';
- if (file_exists($file))
- {
- print '
'.$langs->trans('Send').'';
- }
- }
- }
+ if ($commande->statut == 1)
+ {
+ if ($user->rights->commande->envoyer)
+ {
+ $comref = sanitize_string($commande->ref);
+ $file = $conf->commande->dir_output . '/'.$comref.'/'.$comref.'.pdf';
+ if (file_exists($file))
+ {
+ print '
'.$langs->trans('Send').'';
+ }
+ }
+ }
// Ship
if ($conf->expedition->enabled && $commande->statut > 0 && $commande->statut < 3 && $user->rights->expedition->creer)
@@ -1387,7 +1387,7 @@ else
{
print '
'.$langs->trans('Delete').'';
}
-
+
print '
';
}
print '
';
@@ -1396,9 +1396,9 @@ else
print '';
/*
- * Documents générés
- *
- */
+ * Documents générés
+ *
+ */
$comref = sanitize_string($commande->ref);
$comref = str_replace("(","",$comref);
$comref = str_replace(")","",$comref);
@@ -1407,29 +1407,29 @@ else
$filedir = $conf->commande->dir_output . '/' . $comref;
$urlsource=$_SERVER["PHP_SELF"]."?id=".$commande->id;
$genallowed=$user->rights->commande->creer;
- $delallowed=$user->rights->commande->supprimer;
+ $delallowed=$user->rights->commande->supprimer;
$var=true;
/*
if (file_exists($file))
{
- print_titre($langs->trans('Documents'));
- print '';
- print '| '.$langs->trans('Order').' PDF | ';
- print ''.$commande->ref.'.pdf | ';
- print ''.filesize($file). ' bytes | ';
- print ''.strftime('%d %b %Y %H:%M:%S',filemtime($file)).' | ';
- print ' ';
- print ' ';
- print ' ';
+ print_titre($langs->trans('Documents'));
+ print '';
+ print '| '.$langs->trans('Order').' PDF | ';
+ print ''.$commande->ref.'.pdf | ';
+ print ''.filesize($file). ' bytes | ';
+ print ''.strftime('%d %b %Y %H:%M:%S',filemtime($file)).' | ';
+ print ' ';
+ print ' ';
+ print ' ';
}
*/
//$html->show_documents('propal',$filename,$filedir,$urlsource,$genallowed,$delallowed,$propal->modelpdf);
$html->show_documents('commande',$comref,$filedir,$urlsource,$genallowed,$delallowed,$commande->modelpdf);
/*
- * Liste des factures
- */
+ * Liste des factures
+ */
$sql = 'SELECT f.rowid,f.facnumber, f.total_ttc, '.$db->pdate('f.datef').' as df';
$sql .= ' FROM '.MAIN_DB_PREFIX.'facture as f, '.MAIN_DB_PREFIX.'co_fa as cf';
$sql .= ' WHERE f.rowid = cf.fk_facture AND cf.fk_commande = '. $commande->id;
@@ -1469,8 +1469,8 @@ else
print ' | ';
/*
- * Liste des expéditions
- */
+ * Liste des expéditions
+ */
$sql = 'SELECT e.rowid,e.ref,'.$db->pdate('e.date_expedition').' as de';
$sql .= ' FROM '.MAIN_DB_PREFIX.'expedition as e';
$sql .= ' WHERE e.fk_commande = '. $commande->id;
@@ -1504,99 +1504,99 @@ else
dolibarr_print_error($db);
}
print ' |
';
-
- /*
- * Liste des actions propres à la commande
- */
- $sql = 'SELECT id, '.$db->pdate('a.datea'). ' as da, label, note, fk_user_author' ;
- $sql .= ' FROM '.MAIN_DB_PREFIX.'actioncomm as a';
- $sql .= ' WHERE a.fk_commande = '.$commande->id ;
- if ($socidp) $sql .= ' AND a.fk_soc = '.$socidp;
- $resql = $db->query($sql);
- if ($resql)
- {
- $num = $db->num_rows($resql);
- if ($num)
- {
- print '
';
- print_titre($langs->trans('ActionsOnOrder'));
- $i = 0;
- $total = 0;
- $var=true;
- print '';
- print '| '.$langs->trans('Ref').' | '.$langs->trans('Date').' | '.$langs->trans('Action').' | '.$langs->trans('By').' |
';
- print "\n";
+ /*
+ * Liste des actions propres à la commande
+ */
+ $sql = 'SELECT id, '.$db->pdate('a.datea'). ' as da, label, note, fk_user_author' ;
+ $sql .= ' FROM '.MAIN_DB_PREFIX.'actioncomm as a';
+ $sql .= ' WHERE a.fk_commande = '.$commande->id ;
+ if ($socidp) $sql .= ' AND a.fk_soc = '.$socidp;
+ $resql = $db->query($sql);
+ if ($resql)
+ {
+ $num = $db->num_rows($resql);
+ if ($num)
+ {
+ print '
';
+ print_titre($langs->trans('ActionsOnOrder'));
+ $i = 0;
+ $total = 0;
+ $var=true;
- while ($i < $num)
- {
- $objp = $db->fetch_object($resql);
- $var=!$var;
- print '';
- print '| '.img_object($langs->trans('ShowTask'),'task').' '.$objp->id.' | ';
- print ''.dolibarr_print_date($objp->da)." | \n";
- print ''.stripslashes($objp->label).' | ';
- $authoract = new User($db);
- $authoract->id = $objp->fk_user_author;
- $authoract->fetch('');
- print ''.$authoract->code.' | ';
- print "
\n";
- $i++;
- }
- print '
';
- }
- }
- else
- {
- dolibarr_print_error($db);
- }
+ print '';
+ print '| '.$langs->trans('Ref').' | '.$langs->trans('Date').' | '.$langs->trans('Action').' | '.$langs->trans('By').' |
';
+ print "\n";
+
+ while ($i < $num)
+ {
+ $objp = $db->fetch_object($resql);
+ $var=!$var;
+ print '';
+ print '| '.img_object($langs->trans('ShowTask'),'task').' '.$objp->id.' | ';
+ print ''.dolibarr_print_date($objp->da)." | \n";
+ print ''.stripslashes($objp->label).' | ';
+ $authoract = new User($db);
+ $authoract->id = $objp->fk_user_author;
+ $authoract->fetch('');
+ print ''.$authoract->code.' | ';
+ print "
\n";
+ $i++;
+ }
+ print '
';
+ }
+ }
+ else
+ {
+ dolibarr_print_error($db);
+ }
- /*
- * Action presend
- *
- */
- if ($_GET['action'] == 'presend')
- {
- print '
';
- print_titre($langs->trans('SendOrderByMail'));
-
- $soc = new Societe($db);
- $soc->fetch($commande->soc_id);
+ /*
+ * Action presend
+ *
+ */
+ if ($_GET['action'] == 'presend')
+ {
+ print '
';
+ print_titre($langs->trans('SendOrderByMail'));
- $liste[0]=" ";
- foreach ($soc->contact_email_array() as $key=>$value)
- {
- $liste[$key]=$value;
- }
+ $soc = new Societe($db);
+ $soc->fetch($commande->soc_id);
- // Créé l'objet formulaire mail
- include_once('../html.formmail.class.php');
- $formmail = new FormMail($db);
- $formmail->fromname = $user->fullname;
- $formmail->frommail = $user->email;
- $formmail->withfrom=1;
- $formmail->withto=$liste;
- $formmail->withcc=1;
- $formmail->withtopic=$langs->trans('SendOrderRef','__ORDERREF__');
- $formmail->withfile=1;
- $formmail->withbody=1;
- // Tableau des substitutions
- $formmail->substit['__ORDERREF__']=$commande->ref;
- // Tableau des paramètres complémentaires
- $formmail->param['action']='send';
- $formmail->param['models']='order_send';
- $formmail->param['orderid']=$commande->id;
- $formmail->param['returnurl']=DOL_URL_ROOT.'/commande/fiche.php?id='.$commande->id;
+ $liste[0]=" ";
+ foreach ($soc->contact_email_array() as $key=>$value)
+ {
+ $liste[$key]=$value;
+ }
+
+ // Créé l'objet formulaire mail
+ include_once('../html.formmail.class.php');
+ $formmail = new FormMail($db);
+ $formmail->fromname = $user->fullname;
+ $formmail->frommail = $user->email;
+ $formmail->withfrom=1;
+ $formmail->withto=$liste;
+ $formmail->withcc=1;
+ $formmail->withtopic=$langs->trans('SendOrderRef','__ORDERREF__');
+ $formmail->withfile=1;
+ $formmail->withbody=1;
+ // Tableau des substitutions
+ $formmail->substit['__ORDERREF__']=$commande->ref;
+ // Tableau des paramètres complémentaires
+ $formmail->param['action']='send';
+ $formmail->param['models']='order_send';
+ $formmail->param['orderid']=$commande->id;
+ $formmail->param['returnurl']=DOL_URL_ROOT.'/commande/fiche.php?id='.$commande->id;
+
+ $formmail->show_form();
+ }
- $formmail->show_form();
- }
-
}
else
{
- /* Commande non trouvée */
- print 'Commande inexistante ou accés refusé';
+ // Commande non trouvée
+ dolibarr_print_error($db);
}
}
}