* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id$ * $Source$ * */ /*! \file htdocs/expedition/fiche.php \ingroup expedition \brief Fiche descriptive d'une expedition \version $Revision$ */ require("./pre.inc.php"); $user->getrights('commande'); $user->getrights('expedition'); if (!$user->rights->expedition->lire) accessforbidden(); require("../propal.class.php"); require("../product/stock/entrepot.class.php"); /* * Sécurité accés client */ if ($user->societe_id > 0) { $action = ''; $socidp = $user->societe_id; } /* * */ if ($_POST["action"] == 'add') { $expedition = new Expedition($db); $expedition->date_expedition = time(); $expedition->note = $_POST["note"]; $expedition->commande_id = $_POST["commande_id"]; $expedition->entrepot_id = $_POST["entrepot_id"]; $commande = new Commande($db); $commande->fetch($expedition->commande_id); $commande->fetch_lignes(); for ($i = 0 ; $i < sizeof($commande->lignes) ; $i++) { $qty = "qtyl".$i; $idl = "idl".$i; if ($_POST[$qty] > 0) { $expedition->addline($_POST[$idl],$_POST[$qty]); } } $expedition->create($user); $id = $expedition->id; Header("Location:fiche.php?id=$id"); } /* * */ if ($_POST["action"] == 'confirm_valid' && $_POST["confirm"] == yes && $user->rights->expedition->valider) { $expedition = new Expedition($db); $expedition->fetch($_GET["id"]); $result = $expedition->valid($user); } if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == yes) { if ($user->rights->expedition->supprimer ) { $expedition = new Expedition($db); $expedition->id = $_GET["id"]; $expedition->delete(); Header("Location: liste.php"); } } /* * */ $html = new Form($db); /********************************************************************* * * Mode creation * * * ************************************************************************/ if ($_POST["action"] == 'create') { llxHeader('','Fiche expedition','ch-expedition.html',$form_search); print_titre("Créer une expédition"); $commande = new Commande($db); $commande->livraison_array(); if ( $commande->fetch($_POST["commande_id"])) { $soc = new Societe($db); $soc->fetch($commande->soc_id); $author = new User($db); $author->id = $commande->user_author_id; $author->fetch(); $entrepot = new Entrepot($db); /* * Commande */ print '
'; } else { print $db->error() . "