From 8c628bc813314305792d8d5d2cc374b0b9fa7f50 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Wed, 19 Nov 2003 14:29:22 +0000 Subject: [PATCH] Modif de la barre d'action --- htdocs/commande/fiche.php | 180 ++++++++------------------------------ 1 file changed, 38 insertions(+), 142 deletions(-) diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index bb69c85cc27..8b2a8f03660 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -22,6 +22,7 @@ require("./pre.inc.php"); $user->getrights('commande'); +$user->getrights('expedition'); if (!$user->rights->commande->lire) accessforbidden(); @@ -111,15 +112,21 @@ if ($HTTP_POST_VARS["action"] == 'addligne' && $user->rights->commande->creer) } } -if ($action == 'updateligne' && $user->rights->commande->creer) +if ($HTTP_POST_VARS["action"] == 'updateligne' && $user->rights->commande->creer) { - $fac = new Commande($db,"",$id); - $commande->fetch($id); - $result = $commande->updateline(rowid, - $HTTP_POST_VARS["desc"], - $HTTP_POST_VARS["price"], - $HTTP_POST_VARS["qty"], - $HTTP_POST_VARS["remise_percent"]); + $commande = new Commande($db,"",$_GET["id"]); + if ($commande->fetch($_GET["id"]) ) + { + $result = $commande->update_line($HTTP_POST_VARS["elrowid"], + $HTTP_POST_VARS["eldesc"], + $HTTP_POST_VARS["elprice"], + $HTTP_POST_VARS["elqty"], + $HTTP_POST_VARS["elremise_percent"]); + } + else + { + print "Erreur"; + } } if ($action == 'deleteline' && $user->rights->commande->creer) @@ -152,7 +159,7 @@ if ($HTTP_POST_VARS["action"] == 'confirm_delete' && $HTTP_POST_VARS["confirm"] $commande = new Commande($db); $commande->id = $_GET["id"]; $commande->delete(); - Header("Location: liste.php"); + Header("Location: index.php"); } } @@ -382,6 +389,7 @@ else /* */ /* *************************************************************************** */ { + $id = $_GET["id"]; if ($id > 0) { $commande = New Commande($db); @@ -399,7 +407,7 @@ else * Confirmation de la suppression de la commande * */ - if ($action == 'delete') + if ($_GET["action"] == 'delete') { $html->form_confirm("$PHP_SELF?id=$id","Supprimer la commande","Etes-vous sûr de vouloir supprimer cette commande ?","confirm_delete"); } @@ -433,7 +441,7 @@ else print ''; print ""; - print "'; print '"; - if ($action == 'editline' && $rowid == $objp->rowid) + if ($_GET["action"] == 'editline' && $_GET["rowid"] == $objp->rowid) { print ""; print ''; - print ''; + print ''; print ""; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; print ''; print '' . "\n"; print "\n"; @@ -656,7 +664,7 @@ else * Fin Ajout ligne * */ - if ($user->societe_id == 0) + if ($user->societe_id == 0 && $commande->statut < 3) { print '

Client"; + print ''; print ''.$soc->nom.''; @@ -569,16 +577,16 @@ else } print "
 % %
'; @@ -670,14 +678,19 @@ else } else { - print ""; + print ''; } - - print ""; + if ($commande->statut > 0 && $commande->statut < 3 && $user->rights->expedition->creer) + { + print ''; + } + else + { + print ''; + } - print ''; print ''; @@ -694,7 +707,8 @@ else } elseif ($commande->statut == 1) { - if ($user->rights->commande->valider) + $nb_expedition = $commande->nb_expedition(); + if ($user->rights->commande->valider && $nb_expedition == 0) { print ""; } @@ -793,115 +807,6 @@ else print '
---Expédier---Annuler la commande

'; } /* - * - * - */ - if ($action == 'presend') - { - $replytoname = $user->fullname; - $from_name = $replytoname; - - $replytomail = $user->email; - $from_mail = $replytomail; - - print "
\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 "

"; - } - - if ($action == 'prerelance') - { - $replytoname = $user->fullname; - $from_name = $replytoname; - - $replytomail = $user->email; - $from_mail = $replytomail; - - print "
\n"; - print ''; - print ''; - print ''; - - print_titre("Envoyer une relance"); - 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 "
"; - } - - /* - * Propales - * - - $sql = "SELECT ".$db->pdate("p.datep")." as dp, p.price, p.ref, p.rowid as propalid"; - $sql .= " FROM llx_propal as p, llx_fa_pr as fp WHERE fp.fk_propal = p.rowid AND fp.fk_commande = $id"; - - $result = $db->query($sql); - if ($result) - { - $num = $db->num_rows(); - if ($num) - { - $i = 0; $total = 0; - print "

"; - if ($num >1) - { - print_titre("Propositions commerciales associées"); - } - else - { - print_titre("Proposition commerciale associée"); - } - - print ''; - print ''; - print ""; - print ""; - print ''; - print "\n"; - - $var=True; - while ($i < $num) - { - $objp = $db->fetch_object( $i); - $var=!$var; - print ""; - print "\n"; - print "\n"; - print ''; - print ""; - $total = $total + $objp->price; - $i++; - } - print "\n"; - print "
NuméroDatePrix
propalid\">$objp->ref".strftime("%d %B %Y",$objp->dp)."'.price($objp->price).'
Total : ".price($total)." $_MONNAIE HT
"; - } - } else { - print $db->error(); - } - * * */ @@ -911,16 +816,7 @@ else /* Commande non trouvée */ print "Commande inexistante ou accés refusé"; } - } else { - /*************************************************************************** - * * - * Mode Liste * - * * - * * - ***************************************************************************/ - - } - + } } $db->close();