diff -Naur --exclude=CVS --exclude='.*' --exclude='*~' --exclude='*.bak' --exclude=conf.php --exclude=documents --exclude='.*' 24_patch_casiers/htdocs/admin/facture.php 24_apres_patch/htdocs/admin/facture.php --- 24_patch_casiers/htdocs/admin/facture.php 2008-07-05 16:20:05.000000000 +0200 +++ 24_apres_patch/htdocs/admin/facture.php 2008-08-27 15:24:41.000000000 +0200 @@ -161,6 +162,11 @@ dolibarr_set_const($db, "FAC_FORCE_DATE_VALIDATION",$_POST["forcedate"]); } +if ($_POST["action"] == 'setshowlocker') +{ + dolibarr_set_const($db, "FAC_SHOW_LOCKER",$_POST["showlocker"]); +} + if ($_POST["action"] == 'set_disable_repeatable') { dolibarr_set_const($db, "FACTURE_DISABLE_RECUR",$_POST["disable_repeatable"]); @@ -572,6 +577,22 @@ print "\n"; print ''; +if($conf->stock->enabled && $conf->global->STOCK_LOCKER) +{ + // Show locker + $var=! $var; + print '
'; + print ''; + print ''; + print $langs->trans("ShowLocker"); + print ''; + print $html->selectyesno("showlocker",$conf->global->FAC_SHOW_LOCKER,1); + print ''; + print ''; + print "\n"; + print '
'; +} + // Active facture r�currentes $var=! $var; print '
'; diff -Naur --exclude=CVS --exclude='.*' --exclude='*~' --exclude='*.bak' --exclude=conf.php --exclude=documents --exclude='.*' 24_patch_casiers/htdocs/admin/stock.php 24_apres_patch/htdocs/admin/stock.php --- 24_patch_casiers/htdocs/admin/stock.php 2008-07-26 14:10:24.000000000 +0200 +++ 24_apres_patch/htdocs/admin/stock.php 2008-08-27 15:27:47.000000000 +0200 @@ -52,6 +52,7 @@ Header("Location: stock.php"); exit; } + // Mode of stock changement elseif ( $_POST["action"] == 'stock_bill' || $_POST["action"] == 'stock_validateorder' @@ -76,6 +77,13 @@ $db->rollback(); dolibarr_print_error("Error in some requests", LOG_ERR); } +} +elseif ($_POST["action"] == 'stock_locker') +{ + dolibarr_set_const($db, "STOCK_LOCKER",$_POST["stock_locker"]); + if($_POST["stock_locker"]) dolibarr_set_const($db, "MAIN_DISABLE_JAVASCRIPT", 0); + Header("Location: stock.php"); + exit; } @@ -178,6 +186,24 @@ print "
\n\n\n"; } +// casiers activation/desactivation + $var=!$var; + + print ""; + print ''.$langs->trans("WarehouseUseLocker") ; + print ' ('.$langs->trans("AvailableOnlyIfJavascriptAndAjaxNotDisabled").')' ; + print ''; + + print ''; + print "
"; + print ""; + print $html->selectyesno("stock_locker",$conf->global->STOCK_LOCKER,1); + + print ''; + print '
'; + print "\n"; + print "\n"; + print ''; $db->close(); diff -Naur --exclude=CVS --exclude='.*' --exclude='*~' --exclude='*.bak' --exclude=conf.php --exclude=documents --exclude='.*' 24_patch_casiers/htdocs/facture.class.php 24_apres_patch/htdocs/facture.class.php --- 24_patch_casiers/htdocs/facture.class.php 2008-07-31 18:31:01.000000000 +0200 +++ 24_apres_patch/htdocs/facture.class.php 2008-08-27 15:29:05.000000000 +0200 @@ -545,11 +545,13 @@ $sql.= ' l.remise, l.remise_percent, l.fk_remise_except, l.subprice,'; $sql.= ' '.$this->db->pdate('l.date_start').' as date_start,'.$this->db->pdate('l.date_end').' as date_end,'; $sql.= ' l.info_bits, l.total_ht, l.total_tva, l.total_ttc, l.fk_code_ventilation, l.fk_export_compta,'; - $sql.= ' p.fk_product_type as fk_product_type, p.label as label, p.description as product_desc'; + $sql.= ' p.fk_product_type as fk_product_type, p.label as label, p.description as product_desc, k.code as locker'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facturedet as l'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid'; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as s ON s.fk_product = p.rowid'; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'locker as k ON s.fk_locker = k.rowid'; $sql.= ' WHERE l.fk_facture = '.$this->id; - $sql.= ' ORDER BY l.rang'; + $sql.= ' ORDER BY k.code'; dolibarr_syslog('Facture::fetch_lines sql='.$sql, LOG_DEBUG); $result = $this->db->query($sql); @@ -584,7 +586,8 @@ $faclig->total_ttc = $objp->total_ttc; $faclig->export_compta = $objp->fk_export_compta; $faclig->code_ventilation = $objp->fk_code_ventilation; - + $faclig->locker = $objp->locker; + // Ne plus utiliser $faclig->price = $objp->price; $faclig->remise = $objp->remise; diff -Naur --exclude=CVS --exclude='.*' --exclude='*~' --exclude='*.bak' --exclude=conf.php --exclude=documents --exclude='.*' 24_patch_casiers/htdocs/includes/modules/facture/pdf_crabe.modules.php 24_apres_patch/htdocs/includes/modules/facture/pdf_crabe.modules.php --- 24_patch_casiers/htdocs/includes/modules/facture/pdf_crabe.modules.php 2008-08-07 09:50:04.000000000 +0200 +++ 24_apres_patch/htdocs/includes/modules/facture/pdf_crabe.modules.php 2008-08-27 15:31:25.000000000 +0200 @@ -87,6 +87,7 @@ // Defini position des colonnes $this->posxdesc=$this->marge_gauche+1; + $this->posxlocker=100; $this->posxtva=113; $this->posxup=126; $this->posxqty=145; @@ -115,6 +116,7 @@ $outputlangs->load("companies"); $outputlangs->load("bills"); $outputlangs->load("products"); + $outputlangs->load("stocks"); $outputlangs->setPhpLang(); @@ -296,11 +298,19 @@ $pdf->SetFont('Arial','', 9); // Dans boucle pour gerer multi-page // Description - $pdf->writeHTMLCell($this->posxtva-$this->posxdesc-1, 3, $this->posxdesc-1, $curY, $libelleproduitservice, 0, 1); - + $pdf->writeHTMLCell($this->posxlocker-$this->posxdesc-1, 3, $this->posxdesc-1, $curY, $libelleproduitservice, 0, 1); + $pdf->SetFont('Arial','', 9); // On repositionne la police par defaut $nexY = $pdf->GetY(); + + //Locker + if ($conf->stock->enabled && $conf->global->STOCK_LOCKER && $conf->global->FAC_SHOW_LOCKER) + { + $pdf->SetXY ($this->posxlocker-5, $curY); + $pdf->MultiCell($this->posxtva-$this->posxlocker-1, 3, $fac->lignes[$i]->locker, 0, 'R'); + } + // TVA $pdf->SetXY ($this->posxtva, $curY); $pdf->MultiCell($this->posxup-$this->posxtva-1, 3, vatrate($fac->lignes[$i]->tva_tx,1,$fac->lignes[$i]->info_bits), 0, 'R'); @@ -894,6 +904,14 @@ $pdf->SetXY ($this->posxdesc-1, $tab_top+2); $pdf->MultiCell(108,2, $outputlangs->transnoentities("Designation"),'','L'); + if ($conf->stock->enabled && $conf->global->STOCK_LOCKER && $conf->global->FAC_SHOW_LOCKER) + { + $pdf->line($this->posxlocker-5, $tab_top, $this->posxlocker-5, $tab_top + $tab_height); + $pdf->SetXY ($this->posxlocker-8, $tab_top+2); + $pdf->MultiCell($this->posxup-$this->posxlocker-1,2, $outputlangs->transnoentities("Locker"),'','C'); + + } + $pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height); $pdf->SetXY ($this->posxtva-1, $tab_top+2); $pdf->MultiCell($this->posxup-$this->posxtva-1,2, $outputlangs->transnoentities("VAT"),'','C'); diff -Naur --exclude=CVS --exclude='.*' --exclude='*~' --exclude='*.bak' --exclude=conf.php --exclude=documents --exclude='.*' 24_patch_casiers/htdocs/includes/modules/facture/pdf_oursin.modules.php 24_apres_patch/htdocs/includes/modules/facture/pdf_oursin.modules.php --- 24_patch_casiers/htdocs/includes/modules/facture/pdf_oursin.modules.php 2008-07-31 16:25:00.000000000 +0200 +++ 24_apres_patch/htdocs/includes/modules/facture/pdf_oursin.modules.php 2008-08-27 15:32:15.000000000 +0200 @@ -210,6 +210,13 @@ $nexY = $pdf->GetY(); + //Locker + if ($conf->stock->enabled && $conf->global->STOCK_LOCKER && $conf->global->FAC_SHOW_LOCKER) + { + $pdf->SetXY ($this->marges['g']+100, $curY); + $pdf->MultiCell(10, 5, $fac->lignes[$i]->locker, 0, 'C'); + } + // TVA if ($this->franchise!=1) { @@ -220,7 +227,7 @@ $pdf->SetXY ($this->marges['g']+132, $curY); $pdf->MultiCell(16, 5, price($fac->lignes[$i]->subprice), 0, 'R', 0); - // Quantit + // Quantité $pdf->SetXY ($this->marges['g']+150, $curY); $pdf->MultiCell(10, 5, $fac->lignes[$i]->qty, 0, 'R'); @@ -595,6 +602,7 @@ $pdf->SetFont('Arial','B',10); $pdf->Text($this->marges['g']+2,$tab_top + 5, $langs->transnoentities("Designation")); + if ($conf->stock->enabled && $conf->global->STOCK_LOCKER && $conf->global->FAC_SHOW_LOCKER) $pdf->Text($this->marges['g']+100, $tab_top + 5, $langs->transnoentities("Locker")); if ($this->franchise!=1) $pdf->Text($this->marges['g']+120, $tab_top + 5, $langs->transnoentities("VAT")); $pdf->Text($this->marges['g']+135, $tab_top + 5,$langs->transnoentities("PriceUHT")); $pdf->Text($this->marges['g']+153, $tab_top + 5, $langs->transnoentities("Qty")); diff -Naur --exclude=CVS --exclude='.*' --exclude='*~' --exclude='*.bak' --exclude=conf.php --exclude=documents --exclude='.*' 24_patch_casiers/htdocs/langs/fr_FR/admin.lang 24_apres_patch/htdocs/langs/fr_FR/admin.lang --- 24_patch_casiers/htdocs/langs/fr_FR/admin.lang 2008-08-21 09:58:46.000000000 +0200 +++ 24_apres_patch/htdocs/langs/fr_FR/admin.lang 2008-08-27 15:33:28.000000000 +0200 @@ -640,6 +640,7 @@ CreditNote=Avoir CreditNotes=Avoirs ForceInvoiceDate=Forcer la date de facture à la date de validation +ShowLocker=Afficher une colonne casier dans la facture DisableRepeatable=Désactiver les factures récurrentes SuggestedPaymentModesIfNotDefinedInInvoice=Modes de paiements suggérés par défaut si non défini au niveau de la facture EnableEditDeleteValidInvoice=Activer la possibilité d'éditer/supprimer une facture validée sans paiement diff -Naur --exclude=CVS --exclude='.*' --exclude='*~' --exclude='*.bak' --exclude=conf.php --exclude=documents --exclude='.*' 24_patch_casiers/htdocs/langs/fr_FR/stocks.lang 24_apres_patch/htdocs/langs/fr_FR/stocks.lang --- 24_patch_casiers/htdocs/langs/fr_FR/stocks.lang 2008-07-26 14:14:57.000000000 +0200 +++ 24_apres_patch/htdocs/langs/fr_FR/stocks.lang 2008-08-27 15:33:59.000000000 +0200 @@ -39,6 +39,7 @@ QtyDispatched=Quantité ventilée OrderDispatch=Ventilation commande RuleForStockManagement=Règle de gestion de stock +WarehouseUseLocker=Utiliser le système de casiers dans les entrepôts DeStockReStockOnBill=Décrémente/Incrémente les stocks physiques sur les factures/avoirs (attention, dans cette version, c'est toujours dans le premier entrepot numero 1 que se fait l'ajustement) DeStockReStockOnValidateOrder=Décrémente/Incrémente les stocks physiques sur les commandes (attention, dans cette version, c'est toujours dans le premier entrepot numero 1 que se fait l'ajustement) DeStockReStockOnShipment=Décrémente/Incrémente les stocks physiques sur les expéditions (recommandé) @@ -56,3 +57,15 @@ IdWarehouse=Id entrepôt DescWareHouse=Description entrepôt LieuWareHouse=Lieu entrepôt +Locker=Casier +Lockers=Casiers +locker=Casier +LockerCode=Casier +DefaultLocker=Casier par default +SelectWareHouse=Sélection du casier +AddLocker=Ajouter un casier +locker_code=Code +locker_libelle=Libellé +locker_fk_entrepot=Entrepot +addCasiersTitle=Nouveau casier +LockerDeleted=Casier %s supprimé \ Pas de fin de ligne à la fin du fichier. diff -Naur --exclude=CVS --exclude='.*' --exclude='*~' --exclude='*.bak' --exclude=conf.php --exclude=documents --exclude='.*' 24_patch_casiers/htdocs/product/stock/add_locker.php 24_apres_patch/htdocs/product/stock/add_locker.php --- 24_patch_casiers/htdocs/product/stock/add_locker.php 1970-01-01 01:00:00.000000000 +0100 +++ 24_apres_patch/htdocs/product/stock/add_locker.php 2008-08-25 14:29:44.000000000 +0200 @@ -0,0 +1,116 @@ + + * Copyright (C) 2008 Patrick Raguin + * Copyright (C) 2008 < > + * + * 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: add_locker.php,v 2.4 2007/08/10 07:42:44 Exp $ + * $Source: htdocs/product/stock/add_locker.php,v $ + * + */ + +/** + \file htdocs/product/stock/add_locker.php + \ingroup product/stock + \brief add_casier + \version 2.4 +*/ + +require("./pre.inc.php"); + +// Instanciation d'un l'objet Smarty +$oSmarty = new Smarty(); + +$oSmarty->template_dir = './templates' ; +$oSmarty->compile_dir = './templates_c' ; + +$service = new service_locker($db) ; + + if ($_POST["action"] == 'add') +{ + $id = $service->add($_POST) ; + + if($id != -1) + { + $casier = new dao_locker($db) ; + $casier->fetch($id) ; + Header("Location: liste_locker.php?id=".$casier->getFk_entrepot()); + } + else + { + $error = $_GET['error']; + } + + +} + + +/********************************************************************* + * + * Mode creation + * + * + ************************************************************************/ +llxHeader('',$langs->trans("addCasiersTitle"),"addCasiersTitle"); + +$head[0][0] = DOL_URL_ROOT.'/product/stock/add_locker.php'; +$head[0][1] = $langs->trans("addCasiersTitle"); +$h++; +$a = 0; + +dolibarr_fiche_head($head, 0, $langs->trans("Locker")); + + +$html = new Form($db); + + + +if($user->rights->stock->creer) +{ + + // file to call when to form is validate + $action_form = "add_locker.php"; + $oSmarty->assign('action_form', $action_form); + + + // elements of the form + $data = $service->getAttributesAdd(); + + // foreign keys to display in the form + $listFk = $service->getAllFkDisplayed($db->escape($_GET['id'])); + + //Ajout variables smarty + $oSmarty->assign('button', $langs->trans('Add',$langs->trans('Locker'))); + $oSmarty->assign('data', $data); + $oSmarty->assign('listFk', $listFk); + $oSmarty->assign('error', $error); + +} +else +{ + $oSmarty->assign('error', $langs->trans('ErrorForbidden')); +} + // Affichage du template apr?s compilation + $oSmarty->display(DOL_DOCUMENT_ROOT.'/product/stock/templates/add_locker.tpl'); + + +//End of user code +?> diff -Naur --exclude=CVS --exclude='.*' --exclude='*~' --exclude='*.bak' --exclude=conf.php --exclude=documents --exclude='.*' 24_patch_casiers/htdocs/product/stock/ajax/functions.js 24_apres_patch/htdocs/product/stock/ajax/functions.js --- 24_patch_casiers/htdocs/product/stock/ajax/functions.js 1970-01-01 01:00:00.000000000 +0100 +++ 24_apres_patch/htdocs/product/stock/ajax/functions.js 2008-08-25 14:29:44.000000000 +0200 @@ -0,0 +1,82 @@ +/* Copyright (C) 2008 Samuel Bouchet + * Copyright (C) 2008 Patrick Raguin + * + * 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. + */ + +function ajaxFilter(file,input,output){ + new Ajax.Request(file, { + method: 'get', + parameters: { search: $F(input) }, + onSuccess: function(transport) { $(output).update(transport.responseText); } + }); + +} + +function ajaxSelect(file,params,output){ + new Ajax.Request(file, { + method: 'get', + parameters: params, + onSuccess: function(transport) {$(output).update(transport.responseText);} + }); + +} + +/** +* Return true if source == target, false in other cases +*/ +function compareEntrepots(){ + if( $('id_entrepot_destination').value == $('id_entrepot_source').value ){ + $('div_nbpieces').className = 'hidden' ; + $('div_lockers').className = 'visible' ; + return true ; + }else{ + $('div_nbpieces').className = 'visible' ; + $('div_lockers').className = 'hidden' ; + return false ; + } +} + +function entrepot_source_change(id){ + + compareEntrepots() ; + + // La source est toujours limit?e aux casiers de base + ajaxSelect( + 'ajax/locker_by_entrepot_id.php', + 'id_entrepot='+$('id_entrepot_source').value+'&id_product='+id, + 'id_locker_source' + ); + +} + +function entrepot_destination_change(id){ + + var equal = compareEntrepots() ; + + var page ; + if(equal){ + page = 'ajax/locker_by_entrepot_id_all.php' ; + } else { + page = 'ajax/locker_by_entrepot_id.php' ; + } + // on peut transf?rer vers n'importe o? + ajaxSelect( + page, + 'id_entrepot='+$('id_entrepot_destination').value+'&id_product='+id, + 'id_locker_destination' + ); + +} diff -Naur --exclude=CVS --exclude='.*' --exclude='*~' --exclude='*.bak' --exclude=conf.php --exclude=documents --exclude='.*' 24_patch_casiers/htdocs/product/stock/ajax/locker_by_entrepot_id_all.php 24_apres_patch/htdocs/product/stock/ajax/locker_by_entrepot_id_all.php --- 24_patch_casiers/htdocs/product/stock/ajax/locker_by_entrepot_id_all.php 1970-01-01 01:00:00.000000000 +0100 +++ 24_apres_patch/htdocs/product/stock/ajax/locker_by_entrepot_id_all.php 2008-08-25 14:29:44.000000000 +0200 @@ -0,0 +1,56 @@ + + * Copyright (C) 2008 Patrick Raguin + * Copyright (C) 2008 < > + * + * 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. + */ +require("./pre.inc.php") ; + +$service = new service_locker($db) ; +$fields = $service->getfkDisplayedFields() ; +$id_entrepot = $_GET["id_entrepot"] ; +$id_product = $_GET["id_product"] ; + + // print ''."\n" ; + +// requ?te SQL +$sql = "SELECT rowid, code FROM ".MAIN_DB_PREFIX."locker " ; +$sql .= " WHERE fk_entrepot = ".$db->escape($id_entrepot) ; + +$all = $db->query($sql) ; +if($all){ + + // for each entrepot + print '' ; + while($item = $db->fetch_object($all)) + { + + $sep = "" ; + + print ''."\n" ; + + $selected = "" ; + } + +} + +?> diff -Naur --exclude=CVS --exclude='.*' --exclude='*~' --exclude='*.bak' --exclude=conf.php --exclude=documents --exclude='.*' 24_patch_casiers/htdocs/product/stock/ajax/locker_by_entrepot_id.php 24_apres_patch/htdocs/product/stock/ajax/locker_by_entrepot_id.php --- 24_patch_casiers/htdocs/product/stock/ajax/locker_by_entrepot_id.php 1970-01-01 01:00:00.000000000 +0100 +++ 24_apres_patch/htdocs/product/stock/ajax/locker_by_entrepot_id.php 2008-08-25 14:29:44.000000000 +0200 @@ -0,0 +1,86 @@ + + * Copyright (C) 2008 Patrick Raguin + * Copyright (C) 2008 < > + * + * 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. + */ +require("./pre.inc.php") ; + +$langs->Load("main") ; + +$service = new service_locker($db) ; +$fields = $service->getfkDisplayedFields() ; +$id_entrepot = $_GET["id_entrepot"] ; +$id_product = $_GET["id_product"] ; + + // print ''."\n" ; + +// requ?te SQL +$sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."product_stock"; +$sql .= " WHERE fk_product = ".$id_product." AND fk_entrepot = ".$id_entrepot." AND fk_locker IS NOT NULL " ; + +$resql=$db->query($sql); +if ($resql) +{ + + $row = $db->fetch_object($resql); + // S'il existe d?ja un entrepot o? est stock? l'objet, on ne peut choisir qu'une seul casier dans cet entrepot + if ($row->nb > 0) + { + $sql = "SELECT l.rowid, l.code FROM ".MAIN_DB_PREFIX."locker l" ; + $sql .= " JOIN ".MAIN_DB_PREFIX."product_stock ps ON l.rowid = ps.fk_locker" ; + $sql .= " WHERE ps.fk_entrepot = ".$db->escape($id_entrepot) ; + $sql .= " AND ps.fk_product =".$db->escape($id_product) ; + + $optionNone = '' ; + + // Sinon on peut cr?er le stock dans n'importe lequel des casiers + } else { + $sql = "SELECT rowid, code FROM ".MAIN_DB_PREFIX."locker " ; + $sql .= " WHERE fk_entrepot = ".$db->escape($id_entrepot) ; + + $optionNone = '' ; + } + +} + +print $row->nb ; + +$all = $db->query($sql) ; +if($all){ + + // for each entrepot + $selected = " SELECTED "; + while($item = $db->fetch_object($all)) + { + + $sep = "" ; + + print ''."\n" ; + + $selected = "" ; + } + print $optionNone ; + +} + +?> diff -Naur --exclude=CVS --exclude='.*' --exclude='*~' --exclude='*.bak' --exclude=conf.php --exclude=documents --exclude='.*' 24_patch_casiers/htdocs/product/stock/ajax/locker_fk_entrepot_query.php 24_apres_patch/htdocs/product/stock/ajax/locker_fk_entrepot_query.php --- 24_patch_casiers/htdocs/product/stock/ajax/locker_fk_entrepot_query.php 1970-01-01 01:00:00.000000000 +0100 +++ 24_apres_patch/htdocs/product/stock/ajax/locker_fk_entrepot_query.php 2008-08-25 14:29:44.000000000 +0200 @@ -0,0 +1,67 @@ + + * Copyright (C) 2008 Patrick Raguin + * Copyright (C) 2008 < > + * + * 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. + */ +require("./pre.inc.php") ; + +$service = new service_entrepot($db) ; +$fields = $service->getfkDisplayedFields() ; +$search = $_GET["search"] ; + +// Generate the where clause +$where = ''; +if($search!=''){ + $or = '' ; + foreach ($fields as $att) { + if(($att["type"]!='boolean')&&($att["type"]!='datetime')&&($att["type"]!='date')){ + $where.=' '.$or.$att["attribute"].' LIKE \'%'.$search.'%\'' ; + $or = 'OR ' ; + } + $fieldnames[] = $att["attribute"]; + } +} + +$all = dao_entrepot::select($db,$fieldnames,$where,'') ; + +if($all){ + + // for each entrepot + $selected = " SELECTED "; + while($item = $db->fetch_object($all)) + { + + $sep = "" ; + + print ''."\n" ; + + $selected = "" ; + } +} + + +?> diff -Naur --exclude=CVS --exclude='.*' --exclude='*~' --exclude='*.bak' --exclude=conf.php --exclude=documents --exclude='.*' 24_patch_casiers/htdocs/product/stock/ajax/pre.inc.php 24_apres_patch/htdocs/product/stock/ajax/pre.inc.php --- 24_patch_casiers/htdocs/product/stock/ajax/pre.inc.php 1970-01-01 01:00:00.000000000 +0100 +++ 24_apres_patch/htdocs/product/stock/ajax/pre.inc.php 2008-08-25 14:29:44.000000000 +0200 @@ -0,0 +1,59 @@ + + * Copyright (C) 2004-2008 Laurent Destailleur + * Copyright (C) 2008 Samuel Bouchet + * Copyright (C) 2008 Patrick Raguin + * Copyright (C) 2008 < > + * + * 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. + */ + +/** \defgroup product/stock Module product/stock + \brief +*/ + +/** + \file htdocs/product/stock/ajax/pre.inc.php + \ingroup product/stock + \brief Description and activation file for Module product/stock + \version 2.4 + \author +*/ +//End of user code +require("../../../main.inc.php"); +require("../lib.php"); + +//Inclusion des DAO et des Services n?cessaires +require("../dao_locker.class.php"); +require("../service_locker.class.php"); + +//Start of user code UserCode htdocs/product/stock/ajax/pre.inc.php +function llxHeader($langs, $head = "", $title="", $help_url='') +{ + + top_menu($head, $title); + + $menu = new Menu(); + + left_menu($menu->liste, $help_url); +} +//End of user code +?> diff -Naur --exclude=CVS --exclude='.*' --exclude='*~' --exclude='*.bak' --exclude=conf.php --exclude=documents --exclude='.*' 24_patch_casiers/htdocs/product/stock/dao_locker.class.php 24_apres_patch/htdocs/product/stock/dao_locker.class.php --- 24_patch_casiers/htdocs/product/stock/dao_locker.class.php 1970-01-01 01:00:00.000000000 +0100 +++ 24_apres_patch/htdocs/product/stock/dao_locker.class.php 2008-08-25 14:29:44.000000000 +0200 @@ -0,0 +1,358 @@ + + * Copyright (C) 2008 Samuel Bouchet + * Copyright (C) 2008 Patrick Raguin + * Copyright (C) 2008 < > + * + * 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. + */ + +/** + \file htdocs/product/stock/dao_locker.class.php + \ingroup Locker + \brief This file is an example for a class file + \version 2.4 + \author +*/ + +// Put here all includes required by your class file + +/** + \class dao_locker + \brief Put here description of your class + \remarks Initialy built by build_class_from_table on 2008-06-06 09:29 +*/ +class dao_locker // extends CommonObject +{ + private $db; //!< To store db handler + private $error; //!< To return error code (or message) + private $errors=array(); + private $lastquery; //!< To return several error codes (or messages) + //private $element='locker'; //!< Id that identify managed objects + //private $table_element='locker'; //!< Name of table without prefix where object is stored + + private $id; + + private $code; + private $libelle; + private $fk_entrepot; + + + + /** + * \brief Constructor + * \param DB Database handler + */ + public function dao_locker($DB) + { + $this->db = $DB; + return 1; + } + + public function getId(){return $this->id;} + public function setId($value=''){$this->id = $value;} + + public function getCode() {return $this->code;} + public function setCode($value='') {$this->code = $value;} + public function getLibelle() {return $this->libelle;} + public function setLibelle($value='') {$this->libelle = $value;} + public function getFk_entrepot() {return $this->fk_entrepot;} + public function setFk_entrepot($value='') {$this->fk_entrepot = $value;} + + public function getErrors(){ return $this->errors; } + public function getError(){ return $this->error; } + public function getLastquery(){ return $this->db->lastquery(); } + + /** + * \brief Create in database + * \return int <0 si ko, 0 si ok + */ + public function create() + { + global $conf, $langs; + + // Clean parameters + + $this->code=trim($this->code); + $this->libelle=trim($this->libelle); + $this->fk_entrepot=trim($this->fk_entrepot); + + + // Check parameters + // Put here code to add control on parameters values + + // Insert request + + $sql = "INSERT INTO ".MAIN_DB_PREFIX."locker("; + + $sql.= "code,"; + $sql.= "libelle, "; + $sql.= "fk_entrepot"; + + $sql.= ") VALUES ("; + + $sql.= " ".(! isset($this->code)?'NULL':"'".$this->code."'").","; + $sql.= " ".(! isset($this->libelle)?'NULL':"'".$this->libelle."'").","; + $sql.= " ".((($this->fk_entrepot)=="")?'NULL':"'".$this->fk_entrepot."'"); + + $sql.= ")"; + + dolibarr_syslog("dao_locker::create sql=".$sql, LOG_DEBUG); + $resql=$this->db->query($sql); + + if ($resql) + { + $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."locker"); + + // Appel des triggers + include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); + $interface=new Interfaces($this->db); + $result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } + // Fin appel triggers + + return $this->id; + } + else + { + $this->error="Error ".$this->db->lasterror(); + $this->lastquery = $this->db->lastquery(); + dolibarr_syslog("dao_locker::create ".$this->error, LOG_ERR); + return -1; + } + } + + /* + * \brief Update database + * \param notrigger 0=no, 1=yes (no update trigger) + * \return int <0 if KO, 0 if OK + */ + public function update($notrigger=0) + { + global $conf, $langs; + + // Clean parameters + $this->code=trim($this->code); + $this->libelle=trim($this->libelle); + $this->fk_entrepot=trim($this->fk_entrepot); + + + // Check parameters + // Put here code to add control on parameters values + + // Update request + $sql = "UPDATE ".MAIN_DB_PREFIX."locker SET"; + + $sql.= " code='".addslashes($this->code)."',"; + $sql.= " libelle='".addslashes($this->libelle)."',"; + $sql.= " fk_entrepot=".((($this->fk_entrepot)=="")?'NULL':"'".$this->fk_entrepot."'").""; + + + $sql.= " WHERE rowid=".$this->id; + + + dolibarr_syslog("dao_locker::update sql=".$sql, LOG_DEBUG); + $resql = $this->db->query($sql); + if (! $resql) + { + $this->error="Error ".$this->db->lasterror(); + $this->lastquery = $this->db->lastquery(); + dolibarr_syslog("dao_locker::update ".$this->error, LOG_ERR); + return -1; + } + + if (! $notrigger) + { + // Appel des triggers + include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); + $interface=new Interfaces($this->db); + $result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } + // Fin appel triggers + } + + return 0; + } + + + /* + * \brief Load object in memory from database + * \param rowid rowid object + * \return int <0 if KO, 0 if OK + */ + public function fetch($id) + { + global $langs; + + $sql = "SELECT"; + + $sql.= " t.rowid,"; + $sql.= " t.code,"; + $sql.= " t.libelle , "; + $sql.= " t.fk_entrepot"; + + + $sql.= " FROM ".MAIN_DB_PREFIX."locker as t"; + $sql.= " WHERE t.rowid = ".$id; + + dolibarr_syslog("locker::fetch sql=".$sql, LOG_DEBUG); + $resql=$this->db->query($sql); + if ($resql) + { + if ($this->db->num_rows($resql)) + { + $obj = $this->db->fetch_object($resql); + + $this->id = $obj->rowid; + $this->code = $obj->code; + $this->libelle = $obj->libelle; + $this->fk_entrepot= $obj->fk_entrepot; + + } + else + { + $this->error="Error ".$this->db->lasterror(); + dolibarr_syslog("dao_locker::fetch ".$this->error, LOG_ERR); + return -2; + } + $this->db->free($resql); + + return 0; + } + else + { + $this->error="Error ".$this->db->lasterror(); + dolibarr_syslog("dao_locker::fetch ".$this->error, LOG_ERR); + return -1; + } + } + + + /* + * \brief Delete object in database + * \return int <0 if KO, 0 if OK + */ + public function delete($id='') + { + global $conf, $langs; + + if($id!='')$this->id = $id; + + $sql = "DELETE FROM ".MAIN_DB_PREFIX."locker"; + $sql.= " WHERE rowid=".$this->id; + + dolibarr_syslog("dao_locker::delete sql=".$sql); + $resql = $this->db->query($sql); + if (! $resql) + { + $this->error="Error ".$this->db->lasterror(); + dolibarr_syslog("dao_locker::delete ".$this->error, LOG_ERR); + return -1; + } + + // Appel des triggers + include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); + $interface=new Interfaces($this->db); + $result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } + // Fin appel triggers + + return 0; + } + + + /** + * \brief Initialise object with example values + * \remarks id must be 0 if object instance is a specimen. + */ + public function initAsSpecimen() + { + $this->id=0; + + $this->code=''; + $this->libelle=''; + $this->fk_entrepot=''; + + } + + + /** + * \brief Execute a select query + * \param $db object to manage the database + * \param $fields array containing all fields that must be selected + * \param $where condition of the WHERE clause (ie. "t.label = 'bar'") + * \param $order condition of the ORDER BY clause (ie. "t.rowid DESC") + * \return the result as a query result. + */ + public static function select($DB,$fields='',$where='',$order='') + { + global $langs; + + $sql = "SELECT "; + + if( $fields == ''){ + $sql.= " t.rowid,"; + $sql.= " t.code,"; + $sql.= " t.libelle , "; + $sql.= " t.fk_entrepot"; + } else { + $sql.= "t.".implode(", t.", $fields) ; + } + + $sql.= " FROM ".MAIN_DB_PREFIX."locker as t"; + if($where != '')$sql.= " WHERE ".$where; + if($order != '')$sql.= " ORDER BY ".$order; + + dolibarr_syslog("dao_locker::fetch sql=".$sql, LOG_DEBUG); + + + return $DB->query($sql); + + + + } + + /** + * \brief Execute select a query + * \param $query the query + * \return the result as a query result. + */ + public static function selectQuery($DB, $query,$where='',$order='') + { + global $langs; + + $sql = $query; + + if($where != '')$sql.= " WHERE ".$where; + if($order != '')$sql.= " ORDER BY ".$order; + + dolibarr_syslog("dao_locker::fetch sql=".$sql, LOG_DEBUG); + + + return $DB->query($sql); + + + } + + +} +//End of user code +?> diff -Naur --exclude=CVS --exclude='.*' --exclude='*~' --exclude='*.bak' --exclude=conf.php --exclude=documents --exclude='.*' 24_patch_casiers/htdocs/product/stock/edit_locker.php 24_apres_patch/htdocs/product/stock/edit_locker.php --- 24_patch_casiers/htdocs/product/stock/edit_locker.php 1970-01-01 01:00:00.000000000 +0100 +++ 24_apres_patch/htdocs/product/stock/edit_locker.php 2008-08-25 14:29:44.000000000 +0200 @@ -0,0 +1,110 @@ + + * Copyright (C) 2008 Patrick Raguin + * Copyright (C) 2008 < > + * + * 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: edit_locker.php,v 2.4 2007/08/10 07:42:44 Exp $ + * $Source: htdocs/product/stock/edit_locker.php,v $ + * + */ + +/** + \file htdocs/product/stock/edit_locker.php + \ingroup product/stock + \brief edit_casier + \version 2.4 +*/ + +require("./pre.inc.php"); + +// Instanciation d'un l'objet Smarty +$oSmarty = new Smarty(); + +$oSmarty->template_dir = './templates' ; +$oSmarty->compile_dir = './templates_c' ; + + + + + +$service = new service_locker($db) ; + +if ($_POST["action"] == 'update') +{ + $error = $service->update($_POST) ; + if($error == '') + { + } +} + +/********************************************************************* + * + * Mode Edition + * + * + ************************************************************************/ +if($_GET['id']) +{ + llxHeader('',$langs->trans("editCasiersTitle"),$langs->trans("editCasiersTitle")); + + $head[0][0] = DOL_URL_ROOT.'/product/stock/edit_locker.php?id='.$_GET['id']; + $head[0][1] = $langs->trans("editCasiersTitle"); + $h++; + $a = 0; + + dolibarr_fiche_head($head, 0, $langs->trans("Locker")); + + + $html = new Form($db); + + + if($user->rights->stock->creer) + { + + + // file to call when to form is validate + $action_form = "edit_locker.php"; + $oSmarty->assign('action_form', $action_form); + + + // elements of the form + $data = $service->getAttributesEdit($_GET['id']); + + // foreign keys to display in the form + $listFk = $service->getAllFkDisplayed($_GET['id']); + + $oSmarty->assign('listFk', $listFk); + $oSmarty->assign('button_edit', $langs->trans('edit',$langs->trans('Locker'))); + $oSmarty->assign('button_cancel', $langs->trans('Cancel')); + $oSmarty->assign('tab_form', $data); + $oSmarty->assign('id', $_GET['id']); + $oSmarty->assign('error', $error); + + } + else + { + $oSmarty->assign('error', $langs->trans('ErrorForbidden')); + } + + // Affichage du template apr?s compilation + $oSmarty->display(DOL_DOCUMENT_ROOT.'/product/stock/templates/edit_locker.tpl'); + + +} +//End of user code +?> diff -Naur --exclude=CVS --exclude='.*' --exclude='*~' --exclude='*.bak' --exclude=conf.php --exclude=documents --exclude='.*' 24_patch_casiers/htdocs/product/stock/fiche_locker.php 24_apres_patch/htdocs/product/stock/fiche_locker.php --- 24_patch_casiers/htdocs/product/stock/fiche_locker.php 1970-01-01 01:00:00.000000000 +0100 +++ 24_apres_patch/htdocs/product/stock/fiche_locker.php 2008-08-25 14:29:44.000000000 +0200 @@ -0,0 +1,140 @@ + + * Copyright (C) 2008 Patrick Raguin + * Copyright (C) 2008 < > + * + * 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: fiche_locker.tpl $ + * $Source: htdocs/product/stock/fiche_locker.php,v * to complete * $ + * + */ + +/** + \file htdocs/product/stock/fiche_locker.php + \ingroup + \brief * to complete * + \version 2.4 +*/ + +require("./pre.inc.php"); + +llxHeader("",$langs->trans("showCasiersTitle"),$langs->trans("showCasiersTitle")); + +//Sous forme d'onglets +$locker = new dao_locker($db) ; +$entrepot = new Entrepot($db); +$locker->fetch($_GET["id"]) ; +$entrepot->fetch($locker->getFk_entrepot()); + +$head = stockTabs($entrepot) ; + +$h = count($head) ; +$head[$h][0] = DOL_URL_ROOT.'/product/stock/fiche_locker.php?id='.$_GET["id"] ; +$head[$h][1] = $langs->trans("showCasiersTitle"); +$h++; + +dolibarr_fiche_head($head,count($head)-1, $langs->trans("Warehouse").': '.$entrepot->libelle); + + +// Instanciation d'un l'objet Smarty +$oSmarty = new Smarty(); + +$oSmarty->template_dir = './templates' ; +$oSmarty->compile_dir = './templates_c' ; + +//$oSmarty->debugging = true; + + +if($user->rights->stock->lire) +{ + /* ****************************************** + * Demande de confirmation pour suppression + ********************************************/ + if ($_GET["action"] == 'delete') + { + $service = new service_locker($db) ; + $oSmarty->assign('delete_form',$service->confirmDeleteForm()) ; + } + /* *********** + * Suppression + **************/ + if (($_POST["action"] == 'confirm_delete')&&($_POST["confirm"] == 'yes')) + { + $service = new service_locker($db) ; + $deleted = $service->delete($_GET['id']) ; + + if($deleted==0){ + + $deletion = array( + "message" => $langs->trans("LockerDeleted",$locker->getLibelle()), + "ok" => $langs->trans("Ok"), + "link" => DOL_URL_ROOT.'/product/stock/liste_locker.php?id='.$entrepot->id + ) ; + $oSmarty->assign('deletion',$deletion) ; + + } else { + $oSmarty->assign('errors',$service->getErrors()) ; + } + + + } else { + /* ****************************************** + * Get the data to show + ********************************************/ + if (isset($_GET['id'])){ + + $service = new service_locker($db) ; + + // Get Data + $data = $service->getAttributesShow($_GET['id']) ; + $oSmarty->assign('data',$data) ; + + + + //Right to edit + $buttons["edit"] = array( + "label" => $langs->trans('Edit',$langs->trans('locker')), + "right" => $user->rights->stock->creer, + "link" => DOL_URL_ROOT.'/product/stock/edit_locker.php?id='.$_GET["id"] + ) ; + + + //Right to delete + + $buttons["delete"] = array( + "label" => $langs->trans('Delete',$langs->trans('locker')), + "right" => $user->rights->stock->supprimer, + "link" => DOL_URL_ROOT.'/product/stock/fiche_locker.php?id='.$_GET["id"].'&action=delete' + ) ; + + $oSmarty->assign('buttons',$buttons) ; + + } + } +} +else +{ + $oSmarty->assign('errors', $langs->trans('ErrorForbidden')); +} + +$oSmarty->assign('missing',$langs->trans('not_found', $langs->trans('locker'))) ; + +$oSmarty->display("fiche_locker.tpl") ; + +//End of user code + +?> diff -Naur --exclude=CVS --exclude='.*' --exclude='*~' --exclude='*.bak' --exclude=conf.php --exclude=documents --exclude='.*' 24_patch_casiers/htdocs/product/stock/fiche.php 24_apres_patch/htdocs/product/stock/fiche.php --- 24_patch_casiers/htdocs/product/stock/fiche.php 2008-08-19 23:18:48.000000000 +0200 +++ 24_apres_patch/htdocs/product/stock/fiche.php 2008-08-27 15:37:03.000000000 +0200 @@ -206,34 +206,7 @@ /* * Affichage onglets */ - $h = 0; - - $head[$h][0] = DOL_URL_ROOT.'/product/stock/fiche.php?id='.$entrepot->id; - $head[$h][1] = $langs->trans("WarehouseCard"); - $hselected=$h; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/product/stock/mouvement.php?id='.$entrepot->id; - $head[$h][1] = $langs->trans("StockMovements"); - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/product/stock/fiche-valo.php?id='.$entrepot->id; - $head[$h][1] = $langs->trans("EnhancedValue"); - $h++; - - if ($conf->global->STOCK_USE_WAREHOUSE_BY_USER) - { - // Add the constant STOCK_USE_WAREHOUSE_BY_USER in cont table to use this feature. - // Should not be enabled by defaut because does not work yet correctly because - // there is no way to add values in the table llx_user_entrepot - $head[$h][0] = DOL_URL_ROOT.'/product/stock/user.php?id='.$entrepot->id; - $head[$h][1] = $langs->trans("Users"); - $h++; - } - - $head[$h][0] = DOL_URL_ROOT.'/product/stock/info.php?id='.$entrepot->id; - $head[$h][1] = $langs->trans("Info"); - $h++; + $head = stockTabs($entrepot,"WarehouseCard",$hselected) ; dolibarr_fiche_head($head, $hselected, $langs->trans("Warehouse").': '.$entrepot->libelle); @@ -316,15 +289,23 @@ print_liste_field_titre($langs->trans("Product"),"", "p.ref","&id=".$_GET['id'],"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Label"),"", "p.label","&id=".$_GET['id'],"","",$sortfield,$sortorder); + if ($conf->global->STOCK_LOCKER) + print_liste_field_titre($langs->trans("LockerCode"),"", "l.code","&id=".$_GET['id'],"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Units"),"", "ps.reel","&id=".$_GET['id'],"",'align="right"',$sortfield,$sortorder); print ""; $sql = "SELECT p.rowid as rowid, p.ref, p.label as produit, ps.reel as value "; - $sql .= " FROM ".MAIN_DB_PREFIX."product_stock ps, ".MAIN_DB_PREFIX."product p "; + if ($conf->global->STOCK_LOCKER) + $sql .= ",l.rowid as LockerId, l.code as LockerCode" ; + $sql .= " FROM ".MAIN_DB_PREFIX."product_stock ps" ; + if ($conf->global->STOCK_LOCKER) + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."locker as l ON ps.fk_locker = l.rowid"; + + $sql .= ", ".MAIN_DB_PREFIX."product p "; if ($conf->categorie->enabled && !$user->rights->categorie->voir) { $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON cp.fk_product = p.rowid"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cp.fk_categorie = c.rowid"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cp.fk_categorie = c.rowid"; } $sql .= " WHERE ps.fk_product = p.rowid "; $sql .= " AND ps.reel <> 0"; // We do not show if stock is 0 (no product in this warehouse) @@ -370,6 +351,10 @@ print img_object($langs->trans("ShowProduct"),"product").' '.$objp->ref; print ""; print ''.$objp->produit.''; + + if ($conf->global->STOCK_LOCKER) + print ''.$objp->LockerCode.''; + print ''.$objp->value.''; //print "entrepot_id\">"; //print img_object($langs->trans("ShowWarehous"),"stock").' '.$objp->stock; diff -Naur --exclude=CVS --exclude='.*' --exclude='*~' --exclude='*.bak' --exclude=conf.php --exclude=documents --exclude='.*' 24_patch_casiers/htdocs/product/stock/fiche-valo.php 24_apres_patch/htdocs/product/stock/fiche-valo.php --- 24_patch_casiers/htdocs/product/stock/fiche-valo.php 2008-08-25 23:56:37.000000000 +0200 +++ 24_apres_patch/htdocs/product/stock/fiche-valo.php 2008-08-27 15:38:56.000000000 +0200 @@ -53,34 +53,7 @@ /* * Affichage onglets */ - $h = 0; - - $head[$h][0] = DOL_URL_ROOT.'/product/stock/fiche.php?id='.$entrepot->id; - $head[$h][1] = $langs->trans("WarehouseCard"); - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/product/stock/mouvement.php?id='.$entrepot->id; - $head[$h][1] = $langs->trans("StockMovements"); - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/product/stock/fiche-valo.php?id='.$entrepot->id; - $head[$h][1] = $langs->trans("EnhancedValue"); - $hselected=$h; - $h++; - - if ($conf->global->STOCK_USE_WAREHOUSE_BY_USER) - { - // Add the constant STOCK_USE_WAREHOUSE_BY_USER in cont table to use this feature. - // Should not be enabled by defaut because does not work yet correctly because - // there is no way to add values in the table llx_user_entrepot - $head[$h][0] = DOL_URL_ROOT.'/product/stock/user.php?id='.$entrepot->id; - $head[$h][1] = $langs->trans("Users"); - $h++; - } - - $head[$h][0] = DOL_URL_ROOT.'/product/stock/info.php?id='.$entrepot->id; - $head[$h][1] = $langs->trans("Info"); - $h++; + $head = stockTabs($entrepot,"EnhancedValue",$hselected) ; dolibarr_fiche_head($head, $hselected, $langs->trans("Warehouse").': '.$entrepot->libelle); diff -Naur --exclude=CVS --exclude='.*' --exclude='*~' --exclude='*.bak' --exclude=conf.php --exclude=documents --exclude='.*' 24_patch_casiers/htdocs/product/stock/info.php 24_apres_patch/htdocs/product/stock/info.php --- 24_patch_casiers/htdocs/product/stock/info.php 2008-06-14 12:19:27.000000000 +0200 +++ 24_apres_patch/htdocs/product/stock/info.php 2008-08-27 15:39:45.000000000 +0200 @@ -43,34 +43,7 @@ /* * Affichage onglets */ -$h = 0; - -$head[$h][0] = DOL_URL_ROOT.'/product/stock/fiche.php?id='.$entrepot->id; -$head[$h][1] = $langs->trans("WarehouseCard"); -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/product/stock/mouvement.php?id='.$entrepot->id; -$head[$h][1] = $langs->trans("StockMovements"); -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/product/stock/fiche-valo.php?id='.$entrepot->id; -$head[$h][1] = $langs->trans("EnhancedValue"); -$h++; - - if ($conf->global->STOCK_USE_WAREHOUSE_BY_USER) - { - // Add the constant STOCK_USE_WAREHOUSE_BY_USER in cont table to use this feature. - // Should not be enabled by defaut because does not work yet correctly because - // there is no way to add values in the table llx_user_entrepot - $head[$h][0] = DOL_URL_ROOT.'/product/stock/user.php?id='.$entrepot->id; - $head[$h][1] = $langs->trans("Users"); - $h++; - } - -$head[$h][0] = DOL_URL_ROOT.'/product/stock/info.php?id='.$entrepot->id; -$head[$h][1] = $langs->trans("Info"); -$hselected=$h; -$h++; +$head = stockTabs($entrepot,"Info",$hselected) ; dolibarr_fiche_head($head, $hselected, $langs->trans("Warehouse").': '.$entrepot->libelle); diff -Naur --exclude=CVS --exclude='.*' --exclude='*~' --exclude='*.bak' --exclude=conf.php --exclude=documents --exclude='.*' 24_patch_casiers/htdocs/product/stock/lib.php 24_apres_patch/htdocs/product/stock/lib.php --- 24_patch_casiers/htdocs/product/stock/lib.php 1970-01-01 01:00:00.000000000 +0100 +++ 24_apres_patch/htdocs/product/stock/lib.php 2008-08-25 14:29:44.000000000 +0200 @@ -0,0 +1,220 @@ + + * Copyright (C) 2008 Patrick Raguin + * Copyright (C) 2008 < > + * + * 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. + */ + +/** + \file htdocs/product/stock/lib.php + \ingroup product/stock + \brief *complete here* + \version 2.4 + \author +*/ + +function getfieldToKeyFieldArray($query){ + + preg_match("/SELECT (.*) FROM/i",$query,$matches) ; // fields between select and FROM + $queryfields = explode(",",$matches[1]) ; // array of fields + + // get the id field per table + $tableidfields = array() ; + foreach($queryfields as $field){ + // en cas d'appel de fonction en sql on n garde que le contenu + if(strpos($field,"(")){ + $tmp = explode("(",$field) ; + $tmp = str_replace(")","",$tmp[1]) ; + } else { + $tmp = $field ; + } + // on r?cup?re la partie gauche du point pour avoir la table + $tmp = explode(".",$tmp) ; + + $table = trim($tmp[0]) ; + + $tmp = preg_split("/ as /i",$tmp[1]) ; + $fieldname = (isset($tmp[1]))? trim($tmp[1]) : trim($tmp[0]) ; + if($tmp[0]=="rowid"){ + $tableidfields[$table] = $fieldname ; + } + $keys[$fieldname] = $tableidfields[$table] ; + } + + return $keys ; +} + +/* + * \brief display the value according to the type + * \param $type type of the value + * \param $value value to display + * \return the value ready to be displayed + */ +function formatValue($type,$value){ + global $langs ; + + switch($type){ + case "datetime" : + return dolibarr_print_date($value,"dayhour") ; + break ; + case "date" : + return dolibarr_print_date($value,"day") ; + break ; + case "time" : + return dolibarr_print_date($value,"hour") ; + break ; + case "boolean" : + return yn($value) ; + break ; + case is_array($type): + return $langs->trans($type[$value]) ;// a label of a list need to be translated + break ; + default : + return $value ; + break ; + } +} + +/* + * \brief get html code according the type + * \param $type type of the value + * \param $attribute_name name of the attribute + * \param $value value of the attribute + * \param $null 0=no null, 1=null + * \param $form_name name of the form + * \param $textarea_rows number of rows to display if the type is 'textarea' + * \return html code + */ +function getHtmlForm($type,$attribute_name,$value='',$null=0,$form_name='',$textarea_rows=3){ + + $html = new Form($db); + + switch($type) + { + case "datetime": + + ob_start(); + $html->select_date($value,$attribute_name,'1','1',$null,$form_name,1); + $input = ob_get_contents(); + ob_end_clean(); + break; + + case "date": + ob_start(); + $html->select_date($value,$attribute_name,'0','0',$null,$form_name,1); + $input = ob_get_contents(); + ob_end_clean(); + break; + + case "time": + ob_start(); + $html->select_date($value,$attribute_name,'1','1',$null,$form_name,0); + $input = ob_get_contents(); + ob_end_clean(); + break; + + case "boolean": + $input = $html->selectyesno($attribute_name,$value,1); + break; + + case "text": + $input = ''; + break ; + + case is_array($type): + ob_start(); + $html->select_array($attribute_name,$type,$value,$null); + $input = ob_get_contents(); + ob_end_clean(); + break ; + + default: + $input = ''; + break; + } + + return $input; + +} + +/* + * \brief get the content of the ORDER BY clause + * \param $entityname name of the entity + * \param $fields array the list the displayed fields (from selectToArray) + * \return string the content of the ORDER BY clause + */ +function getORDERBY($entityname, $fields){ + + $sort = '' ; + if( isset($_GET['sortfield']) && ($_GET['entity']==$entityname) ) + { + //Ascending or Descending sort + ($_GET['sortorder']=='desc')? $order = 'DESC' : $order = 'ASC' ; + $att = $fields[$entityname][$entityname.'_'.$_GET['sortfield']] ; + $sort = $att["entity"].'.'.$att["attribute"].' '.$order ; + } + return $sort ; +} + +/* + * \brief get the content of the WHERE clause + * \param $entityname name of the entity + * \param $fields array the list the displayed fields (from selectToArray) + * \param &$params string that will contain the GET parameters corresponding to the WHERE clause + * \return string the content of the WHERE clause + */ +function getWHERE($entityname,$fields, &$params){ + global $db ; + + $where = '' ; + if( $_GET['search']==$entityname ) + { + // regenerate the get parameters for the search to preserve filter while sorting + $params[$entityname].='&search='.$entityname ; + + $and = '' ; + + foreach ($fields[$entityname] as $att) { + + if( $_GET[$entityname.$att["attribute"]] != ''){ + // write the get part of URL + $params[$entityname].='&'.$entityname.$att["attribute"].'='.$_GET[$entityname.$att["attribute"]] ; + + //compare booleans + if($att["type"]=='boolean'){ + $bool = (in_array(strtolower($_GET[$entityname.$att["attribute"]]),array(strtolower($langs->trans("yes")),'1')))? '1':'0'; + $where.=' '.$and.$att["entity"].'.'.$att["attribute"].' LIKE \'%'.$bool.'%\'' ; + + // compare dates + }else if(($att["type"]=='datetime')||($att["type"]=='date')){ + /*TODO : comparaison de dates*/ + // general text case + }else{ + $where.=' '.$and.$att["entity"].'.'.$att["attribute"].' LIKE \'%'.$db->escape($_GET[$entityname.$att["attribute"]]).'%\'' ; + } + $and = 'AND ' ; + } + } + } + + return $where ; +} + +?> diff -Naur --exclude=CVS --exclude='.*' --exclude='*~' --exclude='*.bak' --exclude=conf.php --exclude=documents --exclude='.*' 24_patch_casiers/htdocs/product/stock/liste_locker.php 24_apres_patch/htdocs/product/stock/liste_locker.php --- 24_patch_casiers/htdocs/product/stock/liste_locker.php 1970-01-01 01:00:00.000000000 +0100 +++ 24_apres_patch/htdocs/product/stock/liste_locker.php 2008-08-25 14:29:44.000000000 +0200 @@ -0,0 +1,128 @@ + + * Copyright (C) 2008 Patrick Raguin + * Copyright (C) 2008 < > + * + * 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: liste_locker.tpl $ + * $Source: htdocs/product/stock/liste_locker.php,v * to complete * $ + * + */ + +/** + \file htdocs/product/stock/liste_locker.php + \ingroup + \brief * to complete * + \version 2.4 +*/ + +require("./pre.inc.php"); + +// Instanciation d'un l'objet Smarty +$oSmarty = new Smarty(); + +$oSmarty->template_dir = './templates' ; +$oSmarty->compile_dir = './templates_c' ; + +if($user->rights->stock->lire) +{ + + // variables globales pour le template + $oSmarty->assign("img_up",img_up("Z-A")) ; + $oSmarty->assign("img_down",img_down("A-Z")) ; + $oSmarty->assign("this_link",'liste_locker.php') ; + $oSmarty->assign("img_search",DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png'); + $oSmarty->assign("img_searchclear",DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/searchclear.png'); + + $oSmarty->assign("buttons",array( + "add" => array( + "label" => $langs->trans("AddLocker"), + "link" => "add_locker.php?id=".$db->escape($_GET["id"]), + "right" => $user->rights->stock->creer + ) + )) ; + + $listes = array() ; // lists of data to display for each entity + $params = array() ; // lists of fields to display for each entity + $fields = array() ; // array of strings containing the GET parameters, ready to be used in URL + + + // list of locker + // object to manage the entity + $service = new service_locker($db) ; + $entityname = "locker" ; + + // usefull variables (name of the show page of the entity, list of the columns to show) + $fields[$entityname] = $service->getListDisplayedFields() ; + // will contain the get parameters for search data + $params[$entityname] = '' ; + // translation of the entity name + $trans[$entityname] = $langs->trans($entityname) ; + + // Reset the search if button_clear is activated + if($_GET["button_clear"]=="button_clear") $_GET = array() ; + + // specify a sort clause if asked + $orderby = getORDERBY($entityname, $fields) ; + + // specify a WHERE clause if filter are used, generate the params string too + $where = getWHERE($entityname,$fields,$params) ; + if ($where!="") + $where .= " AND " ; + $where.= "fk_entrepot = ".$db->escape($_GET['id']) ; + + // get the data from the service using the where and the order by clauses generated above + $listes[$entityname] = $service->getAllListDisplayed($where,$orderby) ; + + + $oSmarty->assign("listes",$listes) ; + $oSmarty->assign("fields",$fields) ; + $oSmarty->assign("params",$params) ; + $oSmarty->assign("types",$types) ; + + +} +else +{ + $oSmarty->assign('errors', $langs->trans('ErrorForbidden')); +} + +if ($_GET["id"]) +{ +if ($mesg) print $mesg; + + $entrepot = new Entrepot($db); + $result = $entrepot->fetch($_GET["id"]); + if ($result < 0) + { + dolibarr_print_error($db); + } + + llxHeader("","",$langs->trans("Locker")); + + $head = stockTabs($entrepot,"Locker",$hselected) ; + + dolibarr_fiche_head($head, $hselected, $langs->trans("Warehouse").': '.$entrepot->libelle); + + $oSmarty->display("liste_locker.tpl") ; + + print "" ; +} else { + Header("Location: liste.php"); +} + +//End of user code +?> diff -Naur --exclude=CVS --exclude='.*' --exclude='*~' --exclude='*.bak' --exclude=conf.php --exclude=documents --exclude='.*' 24_patch_casiers/htdocs/product/stock/mouvement.php 24_apres_patch/htdocs/product/stock/mouvement.php --- 24_patch_casiers/htdocs/product/stock/mouvement.php 2008-06-14 12:19:28.000000000 +0200 +++ 24_apres_patch/htdocs/product/stock/mouvement.php 2008-08-27 15:41:01.000000000 +0200 @@ -87,34 +87,7 @@ */ if ($_GET["id"]) { - $h = 0; - - $head[$h][0] = DOL_URL_ROOT.'/product/stock/fiche.php?id='.$entrepot->id; - $head[$h][1] = $langs->trans("WarehouseCard"); - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/product/stock/mouvement.php?id='.$entrepot->id; - $head[$h][1] = $langs->trans("StockMovements"); - $hselected=$h; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/product/stock/fiche-valo.php?id='.$entrepot->id; - $head[$h][1] = $langs->trans("EnhancedValue"); - $h++; - - if ($conf->global->STOCK_USE_WAREHOUSE_BY_USER) - { - // Add the constant STOCK_USE_WAREHOUSE_BY_USER in cont table to use this feature. - // Should not be enabled by defaut because does not work yet correctly because - // there is no way to add values in the table llx_user_entrepot - $head[$h][0] = DOL_URL_ROOT.'/product/stock/user.php?id='.$entrepot->id; - $head[$h][1] = $langs->trans("Users"); - $h++; - } - - $head[$h][0] = DOL_URL_ROOT.'/product/stock/info.php?id='.$entrepot->id; - $head[$h][1] = $langs->trans("Info"); - $h++; + $head = stockTabs($entrepot,"StockMovements",$hselected) ; dolibarr_fiche_head($head, $hselected, $langs->trans("Warehouse").': '.$entrepot->libelle); diff -Naur --exclude=CVS --exclude='.*' --exclude='*~' --exclude='*.bak' --exclude=conf.php --exclude=documents --exclude='.*' 24_patch_casiers/htdocs/product/stock/mouvementstock.class.php 24_apres_patch/htdocs/product/stock/mouvementstock.class.php --- 24_patch_casiers/htdocs/product/stock/mouvementstock.class.php 2008-06-17 16:53:41.000000000 +0200 +++ 24_apres_patch/htdocs/product/stock/mouvementstock.class.php 2008-08-27 15:43:10.000000000 +0200 @@ -45,8 +45,9 @@ * \brief Crée un mouvement en base * \return int <0 si ko, >0 si ok */ - function _create($user, $fk_product, $entrepot_id, $qty, $type, $price=0) + function _create($user, $fk_product, $entrepot_id, $qty, $type, $price=0,$locker='') { + if ($locker=='') $locker = 'NULL' ; $error = 0; dolibarr_syslog("MouvementStock::_Create $user->id, $fk_product, $entrepot_id, $qty, $type, $price"); @@ -96,8 +97,8 @@ else { $sql = "INSERT INTO ".MAIN_DB_PREFIX."product_stock"; - $sql.= " (reel, fk_entrepot, fk_product) VALUES "; - $sql.= " (".$qty.",".$entrepot_id.",".$fk_product.")"; + $sql.= " (reel, fk_entrepot, fk_product, fk_locker) VALUES "; + $sql.= " (".$qty.",".$entrepot_id.",".$fk_product.",".$locker.")"; } if ($this->db->query($sql)) @@ -401,9 +402,9 @@ * * */ - function reception($user, $fk_product, $entrepot_id, $qty, $price=0) + function reception($user, $fk_product, $entrepot_id, $qty, $price=0, $locker='') { - return $this->_create($user, $fk_product, $entrepot_id, $qty, 3, $price); + return $this->_create($user, $fk_product, $entrepot_id, $qty, 3, $price,$locker); } } diff -Naur --exclude=CVS --exclude='.*' --exclude='*~' --exclude='*.bak' --exclude=conf.php --exclude=documents --exclude='.*' 24_patch_casiers/htdocs/product/stock/pre.inc.php 24_apres_patch/htdocs/product/stock/pre.inc.php --- 24_patch_casiers/htdocs/product/stock/pre.inc.php 2006-12-11 22:13:55.000000000 +0100 +++ 24_apres_patch/htdocs/product/stock/pre.inc.php 2008-08-27 15:44:03.000000000 +0200 @@ -29,7 +29,17 @@ */ require("../../main.inc.php"); -require("./entrepot.class.php"); +require(DOL_DOCUMENT_ROOT."/product/stock/lib.php"); + +//Inclusion des DAO et des Services nécessaires +require(DOL_DOCUMENT_ROOT."/product/stock/dao_locker.class.php"); +require(DOL_DOCUMENT_ROOT."/product/stock/service_locker.class.php"); +require(DOL_DOCUMENT_ROOT."/product/stock/entrepot.class.php"); + +// inclusion de Smarty +require_once(DOL_DOCUMENT_ROOT.'/../external-libs/smarty/libs/Smarty.class.php'); + +$langs->load("stocks"); function llxHeader($head = "", $urlp = "", $title="") { @@ -52,4 +62,53 @@ left_menu($menu->liste); } + +function stockTabs($entrepot,$tabname='',&$selectedTab=0){ + + global $langs,$conf ; + $langs->load("stocks"); + + $h = 0; + + $head[$h][0] = DOL_URL_ROOT.'/product/stock/fiche.php?id='.$entrepot->id; + $head[$h][1] = $langs->trans("WarehouseCard"); + if($tabname=="WarehouseCard") $selectedTab=$h; + $h++; + + $head[$h][0] = DOL_URL_ROOT.'/product/stock/mouvement.php?id='.$entrepot->id; + $head[$h][1] = $langs->trans("StockMovements"); + if($tabname=="StockMovements") $selectedTab=$h; + $h++; + + $head[$h][0] = DOL_URL_ROOT.'/product/stock/fiche-valo.php?id='.$entrepot->id; + $head[$h][1] = $langs->trans("EnhancedValue"); + if($tabname=="EnhancedValue") $selectedTab=$h; + $h++; + + if ($conf->global->STOCK_USE_WAREHOUSE_BY_USER) + { + // Add the constant STOCK_USE_WAREHOUSE_BY_USER in cont table to use this feature. + // Should not be enabled by defaut because does not work yet correctly because + // there is no way to add values in the table llx_user_entrepot + $head[$h][0] = DOL_URL_ROOT.'/product/stock/user.php?id='.$entrepot->id; + $head[$h][1] = $langs->trans("Users"); + if($tabname=="Users") $selectedTab=$h; + $h++; + } + + $head[$h][0] = DOL_URL_ROOT.'/product/stock/info.php?id='.$entrepot->id; + $head[$h][1] = $langs->trans("Info"); + if($tabname=="Info") $selectedTab=$h; + $h++; + + if ($conf->global->STOCK_LOCKER){ + $head[$h][0] = DOL_URL_ROOT.'/product/stock/liste_locker.php?id='.$entrepot->id; + $head[$h][1] = $langs->trans("Lockers"); + if($tabname=="Locker") $selectedTab=$h; + $h++; + } + + return $head ; +} + ?> diff -Naur --exclude=CVS --exclude='.*' --exclude='*~' --exclude='*.bak' --exclude=conf.php --exclude=documents --exclude='.*' 24_patch_casiers/htdocs/product/stock/product.php 24_apres_patch/htdocs/product/stock/product.php --- 24_patch_casiers/htdocs/product/stock/product.php 2008-05-26 23:27:50.000000000 +0200 +++ 24_apres_patch/htdocs/product/stock/product.php 2008-08-27 16:33:12.000000000 +0200 @@ -32,6 +32,7 @@ require_once(DOL_DOCUMENT_ROOT."/product.class.php"); $langs->load("products"); +$langs->load("stocks") ; $langs->load("orders"); $langs->load("bills"); @@ -54,8 +55,69 @@ $product->create_stock($_POST["id_entrepot"], $_POST["nbpiece"]); } +if ($_POST["action"] == "update_default_locker") +{ + $id_product = $db->escape($_GET["id"]) ; + $id_current_entrepot = $db->escape($_POST["current_warehouse"]) ; + $id_locker = $db->escape($_POST["id_default_locker"]) ; + $id_entrepot = $db->escape($_POST["id_default_entrepot"]); + + // Plusieurs cas possibles selon le contexte + $sql = "SELECT fk_locker, fk_entrepot FROM ".MAIN_DB_PREFIX."product_stock"; + $sql.= " WHERE fk_product = ".$id_product ; + + $rs = $db->query($sql) ; + if($rs){ + $count = $db->num_rows($rs) ; + } else { + $count = -1 ; + } + + // Cas n°1 : Il n'existe aucun entrepot/casier par défaut. -> INSERT + if($count==0){ + $sql = "INSERT INTO ".MAIN_DB_PREFIX."product_stock(fk_product, fk_entrepot, reel, fk_locker)"; + $sql.= " VALUES (".$id_product.", ".$id_entrepot.", 0, ".$id_locker." )" ; + + // Cas n°2 : Il existe 1 ou plusieurs entrepots + }else if($count>0){ + $trouve = false ; + while($res = $db->fetch_object($rs)){ + if(($res->fk_entrepot == $_POST["id_default_entrepot"])&&($res->fk_locker == $_POST["id_default_locker"])) $trouve = true ; + } + + //Cas n°2-1 : L'entrepot choisi N'est PAS dans la liste -> UPDATE du dernier entrepot affecté + if(!$trouve){ + $sql = "UPDATE ".MAIN_DB_PREFIX."product_stock"; + $sql.= " SET fk_locker = ".$id_locker ; + $sql.= ", fk_entrepot = ".$id_entrepot ; + $sql.= " WHERE fk_product = ".$id_product." AND fk_entrepot = ".$id_current_entrepot ; + + //Cas n°2-2 : L'entrepot choisi EST dans la liste -> l'entrepot concerné est positionné à la fin par son rowid et donc désigné comme entrepot par défaut + } else{ + $sql = "SELECT max(rowid) as maxid FROM ".MAIN_DB_PREFIX."product_stock" ; + + $res_maxid = $db->query($sql) ; + $res = $db->fetch_object($res_maxid) ; + $maxid = $res->maxid ; + $maxid = $maxid +1 ; + + $db->free($res_maxid) ; + + $sql = "UPDATE ".MAIN_DB_PREFIX."product_stock"; + $sql.= " SET rowid = ".$maxid ; + $sql.= " WHERE fk_product = ".$id_product." AND fk_entrepot = ".$id_entrepot ; + } + + } + + //Dans tous les cas, on a une requéte à effectuer + $db->query($sql) ; +} + if ($_POST["action"] == "correct_stock" && $_POST["cancel"] <> $langs->trans("Cancel")) { + if($_POST["id_locker"]=='') $_POST["id_locker"] = 'NULL' ; + if (is_numeric($_POST["nbpiece"])) { $product = new Product($db); @@ -63,7 +125,8 @@ $product->correct_stock($user, $_POST["id_entrepot"], $_POST["nbpiece"], - $_POST["mouvement"]); + $_POST["mouvement"], + $_POST["id_locker"]); } } @@ -80,13 +143,21 @@ $product->correct_stock($user, $_POST["id_entrepot_source"], $_POST["nbpiece"], - 1); + 1, + $_POST["id_locker_source"]); $product->correct_stock($user, $_POST["id_entrepot_destination"], $_POST["nbpiece"], - 0); + 0, + $_POST["id_locker_destination"]); } + } else if($conf->global->STOCK_LOCKER) { + $sql = "UPDATE ".MAIN_DB_PREFIX."product_stock"; + $sql.= " SET fk_locker = ".$db->escape($_POST["id_locker_destination"]) ; + $sql.= " WHERE fk_product = ".$db->escape($_GET["id"])." AND fk_entrepot = ".$db->escape($_POST["id_entrepot_destination"]) ; + + $db->query($sql) ; } } @@ -100,7 +171,7 @@ if ($_GET["ref"]) $result = $product->fetch('',$_GET["ref"]); if ($_GET["id"]) $result = $product->fetch($_GET["id"]); - llxHeader("","",$langs->trans("CardProduct".$product->type)); + llxHeader('',"",$langs->trans("CardProduct".$product->type)); if ($result > 0) { @@ -211,6 +282,100 @@ print ''.$langs->trans("StockLimit").''; print ''.$product->seuil_stock_alerte.''; print ''; + + // Casier par défault + if($conf->global->STOCK_LOCKER) + { + print '
'.$langs->trans("DefaultLocker").'
' ; + print '' ; + + //récupération de l'entrepot par défaut + $sql = "SELECT fk_entrepot, fk_locker"; + $sql.= " FROM ".MAIN_DB_PREFIX."product_stock"; + $sql.= " WHERE fk_product = ".$db->escape($product->id); + $sql.= " ORDER BY rowid DESC LIMIT 0,1" ; + $result = $db->query($sql) ; + $selectedWarehouse = -1 ; + $selectedLocker = -1 ; + if ( $result ){ + if($db->num_rows($result)>0){ + $selected = $db->fetch_row($result) ; + $selectedWarehouse = $selected[0] ; + $selectedLocker = $selected[1] ; + } + } + // Liste des entrepot. + if($_GET['action']=="edit_default_locker"){ + print ''; + print ''; + + $sql = "SELECT e.rowid, e.label FROM ".MAIN_DB_PREFIX."entrepot as e" ; + $sql .= " WHERE statut = 1"; + $sql .= " ORDER BY e.rowid"; + + $onchange = "onchange=\"ajaxSelect('ajax/locker_by_entrepot_id_all.php','id_entrepot='+$('id_default_entrepot').value+'&id_product=".$_GET['id']."','id_default_locker');\"" ; + print '   " ; + + // casiers en fonction de l'entrepot + $sql = "SELECT rowid, code FROM ".MAIN_DB_PREFIX."locker " ; + $sql .= " WHERE fk_entrepot = ".$db->escape($selectedWarehouse) ; + $all = $db->query($sql) ; + + print '   ' ; + + print '' ; + } else { + $sql = "SELECT e.label FROM ".MAIN_DB_PREFIX."entrepot as e" ; + $sql .= " WHERE rowid = $selectedWarehouse"; + $resql=$db->query($sql); + if ($resql) + { + $obj= $db->fetch_object($resql) ; + print $obj->label ; + } + + $sql = "SELECT code FROM ".MAIN_DB_PREFIX."locker l JOIN ".MAIN_DB_PREFIX."product_stock ps ON ps.fk_locker = l.rowid " ; + $sql .= " WHERE ps.fk_entrepot = ".$db->escape($selectedWarehouse) ; + $sql .= " AND ps.fk_locker = ".$db->escape($selectedLocker) ; + $resql=$db->query($sql); + if ($resql) + { + $obj= $db->fetch_object($resql) ; + print ' - '.$obj->code ; + } + $db->free($resql); + + } + + + print '' ; + print '' ; + print '
' ; + } print ""; @@ -226,14 +391,18 @@ print "
id\" method=\"post\">\n"; print ''; print ''; - print ''; + print ''; // Entrepot - print ''; - print '' ; + if($conf->global->STOCK_LOCKER) + print ''; + + print ''; - print ''; + print ''; print ''; - print ''; print '
'.$langs->trans("Warehouse").''.$langs->trans("Warehouse").''; - print ''.$langs->trans("Locker").''; + print ''.$langs->trans("NumberOfUnit").''.$langs->trans("NumberOfUnit").'
 '; + print '
 '; print '
'; print '
'; @@ -271,12 +443,19 @@ print "
id\" method=\"post\">\n"; print ''; print ''; - print ''; + print '' ; + if($conf->global->STOCK_LOCKER) + print '' ; + print ''; - print ''; - print ''; + print '' ; + if($conf->global->STOCK_LOCKER) + print '' ; + print ''; + + print ''; print ''; print '
'.$langs->trans("Source").''.$langs->trans("Source").''.$langs->trans("Target").''.$langs->trans("Target").''.$langs->trans("NumberOfUnit").'
'.$langs->trans("NumberOfUnit").'
 '; print '
'; @@ -387,9 +578,11 @@ */ print '
'; print ''; +if($conf->global->STOCK_LOCKER) + print ''; print ''; -$sql = "SELECT e.rowid, e.label, ps.reel FROM ".MAIN_DB_PREFIX."entrepot as e, ".MAIN_DB_PREFIX."product_stock as ps"; +$sql = "SELECT e.rowid, e.label, l.code, ps.reel FROM ".MAIN_DB_PREFIX."entrepot as e, ".MAIN_DB_PREFIX."product_stock as ps LEFT OUTER JOIN ".MAIN_DB_PREFIX."locker as l ON ps.fk_locker = l.rowid"; $sql .= " WHERE ps.fk_entrepot = e.rowid AND ps.fk_product = ".$product->id; $sql .= " ORDER BY lower(e.label)"; @@ -407,6 +600,8 @@ $entrepotstatic->libelle=$obj->label; print ''; print ''; + if($conf->global->STOCK_LOCKER) + print ''; print ''; print ''; ; $total = $total + $obj->reel; @@ -414,7 +609,11 @@ $var=!$var; } } -print '"; +print '' ; +if($conf->global->STOCK_LOCKER) + print '' ; +print '"; + print "
'.$langs->trans("Warehouse").''.$langs->trans("LockerCode").''.$langs->trans("NumberOfUnit").'
'.$entrepotstatic->getNomUrl(1).''.$obj->code.''.$obj->reel.'
'.$langs->trans("Total").':'.$total."
'.$langs->trans("Total").':'.$total."
"; diff -Naur --exclude=CVS --exclude='.*' --exclude='*~' --exclude='*.bak' --exclude=conf.php --exclude=documents --exclude='.*' 24_patch_casiers/htdocs/product/stock/service_locker.class.php 24_apres_patch/htdocs/product/stock/service_locker.class.php --- 24_patch_casiers/htdocs/product/stock/service_locker.class.php 1970-01-01 01:00:00.000000000 +0100 +++ 24_apres_patch/htdocs/product/stock/service_locker.class.php 2008-08-25 14:29:44.000000000 +0200 @@ -0,0 +1,541 @@ + + * Copyright (C) 2008 Patrick Raguin + * Copyright (C) 2008 < > + * + * 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. + */ + +/** + \file htdocs/product/stock/service_locker.class.php + \ingroup Locker + \brief *complete here* + \version 2.4 + \author +*/ + +/** + \class lockerService + \brief Service managing locker + \remarks +*/ +class service_locker +{ + private $dao ; + protected $db ; + + public function getDAO(){ + return $this->dao ; + } + public function service_locker($db) + { + $this->db = $db ; + $this->dao = new dao_locker($db) ; + } + + /* + * \brief return an array with entries of the entity in database. This must be a select query and the rowid field must be selected as well. + * \return array(ID => array(property => array(info => value)) + */ + public function getFromQuery($query,$toDisplay='',$where='',$order=''){ + + global $langs ; + + // Check the query + if (stristr($query,'SELECT')) dolibarr_syslog("service_locker::getFromQuery. Query must be a SELECT statement : sql=".$query, LOG_DEBUG); + if (stristr($query,'rowid')) dolibarr_syslog("service_locker::getFromQuery. Query must select the rowid : sql=".$query, LOG_DEBUG); + + // execute the query + $all = dao_locker::selectQuery($this->db,$query,$where,$order) ; + + // return the result + return $this->selectToArray($all,$toDisplay,getfieldToKeyFieldArray($query)) ; + + } + + /* + * \brief return an array with entries from the result of query in parameter + * \param $result result of a query + * \param $toDisplay array("fieldName" => data). fieldname, the fields to be displayed + * \return array(ID => array(property => array(info => value)) + */ + public function selectToArray($result,$toDisplay ='',$keys=array()){ + + $liste = array() ; + + // If the query return smthg + if($result){ + + + // we browse the result set using the $item var + while($item = $this->db->fetch_object($result)){ + + //make the array + foreach($item as $entityfieldName => $value){ + + // get the name of the field without the entity + $fieldName = strtolower(str_replace("locker_","",$entityfieldName,$nbrReplace)) ; + + // display only recorded fields + if( @in_array($entityfieldName,$toDisplay) ||($toDisplay=='') ){ + + // generate or not the link + if(isset($item->$keys[$entityfieldName])){ + $link = $this->getLink($fieldName,$item->$keys[$entityfieldName]) ; + } else { + $link = '' ; + } + $liste[$item->rowid][$fieldName] = array( + "name" => $fieldName, + "type" => $this->getType($fieldName), + "value" => formatValue($this->getType($fieldName),$value), + "link" => $link + ) ; + + } + + } // end foreach + + } // end while + + }//end if + + return $liste ; + + } + + /* + * \brief return an array with entries of the entity in database + * \param $where condition of the WHERE clause (ie. "t.label = 'bar'") + * \param $order condition of the ORDER BY clause (ie. "t.rowid DESC") + * \return array(array(properties...,URL)) + */ + public function getAllFkDisplayed($id='',$where='',$order=''){ + + global $langs, $db ; + + if($id != '') $this->dao->fetch($id); + + $listFk = array() ; + + //entrepot + $fkService = new Entrepot($this->db) ; + + //fields to be selected + $sql = "SELECT e.rowid, e.label as entrepot_label"; + $sql.= " FROM ".MAIN_DB_PREFIX."entrepot e"; + if($id != '') $sql .= " WHERE e.rowid = ".$id; + + //select fk values according to conditions + $all = $db->query($sql) ; + + //R?cup?ration valeur de la cl? ?trang?re dans le post + if(isset($_POST['locker_fk_entrepot'])) + { + $value = $_POST['locker_fk_entrepot']; + } + else + { + $value = $this->dao->getFk_entrepot(); + } + + // add data about the foreign keys in the array + $listFk[] = array( + "entity" => "locker", + "attribute" => "fk_entrepot", + "value" => $value, + "label" => $langs->trans("locker_fk_entrepot"), + "null" => 1, + "values" => self::selectToArray($all,array("entrepot_label")) + ); + + return $listFk ; + } + + /* + * \brief return an array with entries of the entity in database + * \param $where condition of the WHERE clause (ie. "t.label = 'bar'") + * \param $order condition of the ORDER BY clause (ie. "t.rowid DESC") + * \return array(array(properties...,URL)) + */ + public function getAllListDisplayed($where='',$order=''){ + + // r?cup?ration de la liste des champs ? afficher + + $attributes =array(); // attributes to use in the SELECT query + $labels = array(); // name of the field to be displayed from the query. + $join = array(); // tables to join + + + + //Classe courante + $attributes[] = "locker.code as locker_code"; + $labels[] = "locker_code"; + $attributes[] = "locker.libelle as locker_libelle"; + $labels[] = "locker_libelle"; + + $query = "SELECT locker.rowid, ".implode(", ",$attributes)." "; + $query.= "FROM ".MAIN_DB_PREFIX."locker locker ".implode("",$join); + + return $this->getFromQuery($query,$labels,$where,$order) ; + } + + /* + * \brief return an array with entries of the fields to be displayed in the list + * \return array(property => translation) + */ + public function getListDisplayedFields(){ + + global $langs ; + + //get 1st part of the list from the parent object + + //The second using the current object properties + $fields["locker_code"] = array( + "entity" => "locker", + "attribute" => "code", + "type" => $this->getType("code"), + "label" => $langs->trans("locker_code") + ) ; + $fields["locker_libelle"] = array( + "entity" => "locker", + "attribute" => "libelle", + "type" => $this->getType("libelle"), + "label" => $langs->trans("locker_libelle") + ) ; + + return $fields ; + } + + /* + * \brief return an array with entries of the fields to be displayed in the combobox when invoked as foreign Key + * \return array(property => translation) + */ + public function getfkDisplayedFields(){ + + global $langs ; + + $fields = array() ; + + $fields["locker_code"] = array( + "entity" => "locker", + "attribute" => "code", + "type" => $this->getType("code"), + "label" => $langs->trans("locker_code") + ) ; + + return $fields ; + + + } + + /* + * \brief try to add the element + * \return $error '' if ok, string of the error if error. + */ + public function add($post){ + + global $langs ; + + $_locker = $this->dao; + + + //rowid + + + //code + $_locker->setCode($post["locker_code"]); + + //libelle + $_locker->setLibelle($post["locker_libelle"]); + + + //fk_entrepot + if($post["locker_fk_entrepot"] == '') + { + $error = $langs->trans("ErrorFieldRequired","fk_entrepot"); + } + $_locker->setFk_entrepot($post["locker_fk_entrepot"]); + + if(!isset($error)) + { + // Si tous les champs sont bien remplis on envoi la requ?te de cr?ation + if ( ($_locker->create())==-1) + { + // Si erreur lors de la cr?ation + $_GET['error'] = $langs->trans("Locker_error"); + return -1; + + } + else + { + + // La cr?ation s'est bien d?roul?e + return $_locker->getId(); + + } + } + else + { + $_GET['error'] = $error; + return -1; + } + + + } + + + /* + * \brief try to update the element + * \return $error '' if ok, string of the error if error. + */ + public function update($post){ + + global $langs ; + $this->dao->fetch($post['id']); + + if(!$post["cancel"]) + { + + + //locker_code + + $this->dao->setCode($post["locker_code"]); + + //locker_libelle + + $this->dao->setLibelle($post["locker_libelle"]); + + + //fk_entrepot + if($post["locker_fk_entrepot"] == '') + { + $error = $langs->trans("ErrorFieldRequired","fk_entrepot"); + } + $this->dao->setFk_entrepot($post["locker_fk_entrepot"]); + + + if(!isset($error)) + { + if ( $this->dao->update()!=0) + { + + $error = $langs->trans("Locker_error"); + return $error ; + + } + + } + } + else + { + Header("Location: fiche_locker.php?id=".$this->dao->getId()); + } + $_GET['id'] = $post['id']; + return $error ; + + } + + /* + * \brief Get data array from an occurence of the element + * \return array if ok, empty array if ko + */ + public function getAttributesShow($id){ + + global $langs ; + + $data = array() ; + + + if( $this->dao->fetch($id) == 0){ + $data[] = array( + "label" => $langs->trans("locker_code"), + "value" => formatValue($this->getType("code"),$this->dao->getCode()) + ); + + $data[] = array( + "label" => $langs->trans("locker_libelle"), + "value" => formatValue($this->getType("libelle"),$this->dao->getLibelle()) + ); + + + + } + + return $data ; + } + + + /* + * \brief Get attributes array from an entity + * \return array(array("class_name","attribut_name","type")) if ok, empty array if ko + */ + public function getAttributesAdd(){ + + global $langs ; + + $data = array() ; + + + + //Attribut de la classe courante + $data["locker_code"] = array( + "entity" => "locker", + "attribute" => "code", + "type" => self::getType("code"), + "label" => $langs->trans(locker."_".code), + "html_input" => getHtmlForm(self::getType("code"),"locker_code",$this->dao->getCode(),true) + ); + $data["locker_libelle"] = array( + "entity" => "locker", + "attribute" => "libelle", + "type" => self::getType("libelle"), + "label" => $langs->trans(locker."_".libelle), + "html_input" => getHtmlForm(self::getType("libelle"),"locker_libelle",$this->dao->getLibelle(),true) + ); + + return $data ; + } + + + /* + * \brief Get attributes and data array from an entity + * \return array(array("libelle","value")) if ok, empty array if ko + */ + public function getAttributesEdit($id){ + + global $langs ; + + $data = array() ; + + $this->dao->fetch($id); + + + //Attribut de la classe courante + + $data["locker_code"] = array( + "entity" => "locker", + "attribute" => "code", + "type" => self::getType("code"), + "value" => $this->dao->getCode(), + "label" => $langs->trans(locker."_".code), + "html_input" => getHtmlForm(self::getType("code"),"locker_code",$this->dao->getCode(),true) + ); + + $data["locker_libelle"] = array( + "entity" => "locker", + "attribute" => "libelle", + "type" => self::getType("libelle"), + "value" => $this->dao->getLibelle(), + "label" => $langs->trans(locker."_".libelle), + "html_input" => getHtmlForm(self::getType("libelle"),"locker_libelle",$this->dao->getLibelle(),true) + ); + + + return $data ; + } + + + /* + * \brief generate the html code for the confirmation form + * \return html code for the form + */ + public function confirmDeleteForm() + { + global $langs ; + + // On utlise la fonction de dolibar pour g?n?rer un formulaire de confirmation + // et on place ce texte g?n?rer dans une variable. + ob_start() ; + $form = new Form($db); + $form->form_confirm(DOL_URL_ROOT.'/product/stock/fiche_locker.php?id='.$_GET["id"],$langs->trans("delete",$langs->trans("locker")),$langs->trans("confirm_delete",$langs->trans("locker")),"confirm_delete"); + $html = ob_get_contents(); + ob_end_clean(); + + return $html ; + } + + /* + * \brief delete the element + * \param $id id to delete + * \return html code for the form + */ + public function delete($id) + { + return $this->dao->delete($id) ; + + + } + + public function getErrors() + { + return $this->dao->getErrors(); + } + + + /* + * \brief get the type of the field + * \param $field field to ask for the type + * \return the type + */ + public function getType($field){ + global $langs ; + + switch($field){ + case "rowid" : + return "integer" ; + break ; + case "code" : + return "string" ; + break ; + case "libelle" : + return "text" ; + break ; + case "entrepot_label" : + return "string" ; + break ; + default: + return "" ; + break ; + } + } + + /* + * \brief get the showPage of the entity + * \param $field field to ask for the type + * \return the type + */ + public function getLink($field,$ID){ + switch($field){ + + // foreign key + case "entrepot_label" : + return "fiche.php?id=".$ID ; + break ; + default : + return "fiche_locker.php?id=".$ID ; + } + } + + +} +//End of user code +?> diff -Naur --exclude=CVS --exclude='.*' --exclude='*~' --exclude='*.bak' --exclude=conf.php --exclude=documents --exclude='.*' 24_patch_casiers/htdocs/product/stock/templates/add_locker.tpl 24_apres_patch/htdocs/product/stock/templates/add_locker.tpl --- 24_patch_casiers/htdocs/product/stock/templates/add_locker.tpl 1970-01-01 01:00:00.000000000 +0100 +++ 24_apres_patch/htdocs/product/stock/templates/add_locker.tpl 2008-08-25 14:29:44.000000000 +0200 @@ -0,0 +1,63 @@ +{* Start of user code fichier htdocs/product/stock/templates/add_locker.tpl *} +{* Copyright (C) 2008 Samuel Bouchet + * Copyright (C) 2008 Patrick Raguin + * Copyright (C) 2008 < > + * + * 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. + *} + +{if isset($error)} +
{$error}
+{/if} + + + + + + + + + + {foreach from=$data item=attribut} + + + + + + {/foreach} + + {* for each foreign key *} + {foreach from=$listFk item=fk_form} + + + + + {/foreach} + + + + + +
{$attribut.label}{$attribut.html_input}
{$fk_form.label} + {* for each record *} + +
+ +{* End of user code *} diff -Naur --exclude=CVS --exclude='.*' --exclude='*~' --exclude='*.bak' --exclude=conf.php --exclude=documents --exclude='.*' 24_patch_casiers/htdocs/product/stock/templates/edit_locker.tpl 24_apres_patch/htdocs/product/stock/templates/edit_locker.tpl --- 24_patch_casiers/htdocs/product/stock/templates/edit_locker.tpl 1970-01-01 01:00:00.000000000 +0100 +++ 24_apres_patch/htdocs/product/stock/templates/edit_locker.tpl 2008-08-25 14:29:44.000000000 +0200 @@ -0,0 +1,66 @@ +{* Start of user code fichier htdocs/product/stock/templates/edit_locker.tpl *} + + + + +{* Copyright (C) 2008 Samuel Bouchet + * Copyright (C) 2008 Patrick Raguin + * Copyright (C) 2008 < > + * + * 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. + *} +{if isset($error)} +
{$error}
+{/if} + + + +
+ + + + + + + {foreach from=$tab_form item=tr_form} + + + + + + {/foreach} + + {* for each foreign key *} + {foreach from=$listFk item=fk_form} + + + + + {/foreach} + + + + +
{$tr_form.label}{$tr_form.html_input}
{$fk_form.label} + {* Pour chaque enregistrement *} + +
     
+
+{* End of user code *} diff -Naur --exclude=CVS --exclude='.*' --exclude='*~' --exclude='*.bak' --exclude=conf.php --exclude=documents --exclude='.*' 24_patch_casiers/htdocs/product/stock/templates/fiche_locker.tpl 24_apres_patch/htdocs/product/stock/templates/fiche_locker.tpl --- 24_patch_casiers/htdocs/product/stock/templates/fiche_locker.tpl 1970-01-01 01:00:00.000000000 +0100 +++ 24_apres_patch/htdocs/product/stock/templates/fiche_locker.tpl 2008-08-25 14:29:44.000000000 +0200 @@ -0,0 +1,63 @@ +{* Start of user code fichier htdocs/product/stock/templates/fiche_locker.tpl *} + + + + + +{* Copyright (C) 2008 Samuel Bouchet + * Copyright (C) 2008 Patrick Raguin + * Copyright (C) 2008 < > + * + * 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. + *} +{if !empty($errors)} +
+ {foreach from=$errors item=error} + {$error}
+ {/foreach} +
+{/if} + +{if isset($delete_form)} + {$delete_form}
+{/if} + +{if isset($deletion)} +
{$deletion.message}

+ {if isset($deletion.link)}{$deletion.ok}{/if} +{/if} + +{if !empty($data) } + + {foreach from=$data item=field} + + + + + {/foreach} +
{$field.label}{$field.value}
+ {if $buttons.edit.right || $buttons.delete.right} +
+ {if $buttons.edit.right}{$buttons.edit.label}{/if} + {if $buttons.delete.right}{$buttons.delete.label}{/if} + {/if} +
+{else} + {if !isset($deletion)} +
{$missing}
+ {/if} +{/if} + +{* End of user code fichier htdocs/product/stock/templates/fiche_locker.tpl *} diff -Naur --exclude=CVS --exclude='.*' --exclude='*~' --exclude='*.bak' --exclude=conf.php --exclude=documents --exclude='.*' 24_patch_casiers/htdocs/product/stock/templates/liste_locker.tpl 24_apres_patch/htdocs/product/stock/templates/liste_locker.tpl --- 24_patch_casiers/htdocs/product/stock/templates/liste_locker.tpl 1970-01-01 01:00:00.000000000 +0100 +++ 24_apres_patch/htdocs/product/stock/templates/liste_locker.tpl 2008-08-25 14:29:44.000000000 +0200 @@ -0,0 +1,68 @@ +{* Start of user code fichier htdocs/product/stock/templates/liste_locker.tpl *} + + + + +{* Copyright (C) 2008 Samuel Bouchet + * Copyright (C) 2008 Patrick Raguin + * Copyright (C) 2008 < > + * + * 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. + *} +{if !isset($errors)} +{foreach from=$listes key=entityname item=liste} +
+ + + {strip} + {foreach from=$fields.$entityname item=field} + + {/foreach} + + {/strip} + + {strip} + {foreach from=$fields.$entityname item=field} + {assign var='att_name' value=$entityname|cat:$field.attribute} + + {/foreach} + + + {/strip}{foreach from=$liste item=obj} + {strip} + {foreach from=$obj key=key item=att} + + {/foreach} + + {/strip} +{/foreach} +
{$field.label}{$img_down}{$img_up}
{if ($field.type != 'datetime')&&($field.type != '')}{/if} + + +
{if $att.link!=''}{/if}{$att.value}{if $att.link!=''}{/if}
+
+
+{/foreach} + + {if $buttons.add.right} +
+ {if $buttons.add.right}{$buttons.add.label}{/if} +
+ {/if} +{else} +
{$errors}
+{/if} + +{* End of user code fichier htdocs/product/stock/templates/liste_locker.tpl *} diff -Naur --exclude=CVS --exclude='.*' --exclude='*~' --exclude='*.bak' --exclude=conf.php --exclude=documents --exclude='.*' 24_patch_casiers/htdocs/product/stock/templates_c/%%2A^2A3^2A3C3236%%add_locker.tpl.php 24_apres_patch/htdocs/product/stock/templates_c/%%2A^2A3^2A3C3236%%add_locker.tpl.php --- 24_patch_casiers/htdocs/product/stock/templates_c/%%2A^2A3^2A3C3236%%add_locker.tpl.php 1970-01-01 01:00:00.000000000 +0100 +++ 24_apres_patch/htdocs/product/stock/templates_c/%%2A^2A3^2A3C3236%%add_locker.tpl.php 2008-08-25 14:29:44.000000000 +0200 @@ -0,0 +1,63 @@ + + +_tpl_vars['error'] )): ?> +
_tpl_vars['error']; ?> +
+ + + + +
+ + + + + + _tpl_vars['data']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): + foreach ($_from as $this->_tpl_vars['attribut']): +?> + + + + + + + + _tpl_vars['listFk']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): + foreach ($_from as $this->_tpl_vars['fk_form']): +?> + + + + + + + + + + +
_tpl_vars['attribut']['label']; ?> +_tpl_vars['attribut']['html_input']; ?> +
_tpl_vars['fk_form']['label']; ?> + + +
+
\ Pas de fin de ligne à la fin du fichier. diff -Naur --exclude=CVS --exclude='.*' --exclude='*~' --exclude='*.bak' --exclude=conf.php --exclude=documents --exclude='.*' 24_patch_casiers/htdocs/product/stock/templates_c/%%60^60C^60C71EC1%%add_locker.tpl.php 24_apres_patch/htdocs/product/stock/templates_c/%%60^60C^60C71EC1%%add_locker.tpl.php --- 24_patch_casiers/htdocs/product/stock/templates_c/%%60^60C^60C71EC1%%add_locker.tpl.php 1970-01-01 01:00:00.000000000 +0100 +++ 24_apres_patch/htdocs/product/stock/templates_c/%%60^60C^60C71EC1%%add_locker.tpl.php 2008-08-25 14:29:44.000000000 +0200 @@ -0,0 +1,63 @@ + + +_tpl_vars['error'] )): ?> +
_tpl_vars['error']; ?> +
+ + + + +
+ + + + + + _tpl_vars['data']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): + foreach ($_from as $this->_tpl_vars['attribut']): +?> + + + + + + + + _tpl_vars['listFk']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): + foreach ($_from as $this->_tpl_vars['fk_form']): +?> + + + + + + + + + + +
_tpl_vars['attribut']['label']; ?> +_tpl_vars['attribut']['html_input']; ?> +
_tpl_vars['fk_form']['label']; ?> + + +
+
\ Pas de fin de ligne à la fin du fichier. diff -Naur --exclude=CVS --exclude='.*' --exclude='*~' --exclude='*.bak' --exclude=conf.php --exclude=documents --exclude='.*' 24_patch_casiers/htdocs/product/stock/templates_c/%%71^710^710D180F%%fiche_locker.tpl.php 24_apres_patch/htdocs/product/stock/templates_c/%%71^710^710D180F%%fiche_locker.tpl.php --- 24_patch_casiers/htdocs/product/stock/templates_c/%%71^710^710D180F%%fiche_locker.tpl.php 1970-01-01 01:00:00.000000000 +0100 +++ 24_apres_patch/htdocs/product/stock/templates_c/%%71^710^710D180F%%fiche_locker.tpl.php 2008-08-25 14:29:44.000000000 +0200 @@ -0,0 +1,61 @@ + + + + + + +_tpl_vars['errors'] )): ?> +
+ _tpl_vars['errors']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): + foreach ($_from as $this->_tpl_vars['error']): +?> + _tpl_vars['error']; ?> +
+ +
+ + +_tpl_vars['delete_form'] )): ?> + _tpl_vars['delete_form']; ?> +
+ + +_tpl_vars['deletion'] )): ?> +
_tpl_vars['deletion']['message']; ?> +

+ _tpl_vars['deletion']['link'] )): ?>_tpl_vars['deletion']['ok']; ?> + + + +_tpl_vars['data'] )): ?> + + _tpl_vars['data']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): + foreach ($_from as $this->_tpl_vars['field']): +?> + + + + + +
_tpl_vars['field']['label']; ?> +_tpl_vars['field']['value']; ?> +
+ _tpl_vars['buttons']['edit']['right'] || $this->_tpl_vars['buttons']['delete']['right']): ?> +
+ _tpl_vars['buttons']['edit']['right']): ?>_tpl_vars['buttons']['edit']['label']; ?> + + _tpl_vars['buttons']['delete']['right']): ?>_tpl_vars['buttons']['delete']['label']; ?> + + +
+ + _tpl_vars['deletion'] )): ?> +
_tpl_vars['missing']; ?> +
+ + + \ Pas de fin de ligne à la fin du fichier. diff -Naur --exclude=CVS --exclude='.*' --exclude='*~' --exclude='*.bak' --exclude=conf.php --exclude=documents --exclude='.*' 24_patch_casiers/htdocs/product/stock/templates_c/%%CD^CDB^CDB1816E%%liste_locker.tpl.php 24_apres_patch/htdocs/product/stock/templates_c/%%CD^CDB^CDB1816E%%liste_locker.tpl.php --- 24_patch_casiers/htdocs/product/stock/templates_c/%%CD^CDB^CDB1816E%%liste_locker.tpl.php 1970-01-01 01:00:00.000000000 +0100 +++ 24_apres_patch/htdocs/product/stock/templates_c/%%CD^CDB^CDB1816E%%liste_locker.tpl.php 2008-08-25 14:29:44.000000000 +0200 @@ -0,0 +1,51 @@ + + array(array('modifier', 'cat', 'liste_locker.tpl', 38, false),array('function', 'cycle', 'liste_locker.tpl', 47, false),)), $this); ?> + + + + +_tpl_vars['errors'] )): ?> +_tpl_vars['listes']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): + foreach ($_from as $this->_tpl_vars['entityname'] => $this->_tpl_vars['liste']): +?> +
+ + + _tpl_vars['fields'][$this->_tpl_vars['entityname']]; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): + foreach ($_from as $this->_tpl_vars['field']): + echo ''; endforeach; endif; unset($_from); echo ''; ?> + + + _tpl_vars['fields'][$this->_tpl_vars['entityname']]; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): + foreach ($_from as $this->_tpl_vars['field']): + echo ''; $this->assign('att_name', ((is_array($_tmp=$this->_tpl_vars['entityname'])) ? $this->_run_mod_handler('cat', true, $_tmp, $this->_tpl_vars['field']['attribute']) : smarty_modifier_cat($_tmp, $this->_tpl_vars['field']['attribute']))); echo ''; endforeach; endif; unset($_from); echo ''; $_from = $this->_tpl_vars['liste']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): + foreach ($_from as $this->_tpl_vars['obj']): +?> + +">_tpl_vars['obj']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): + foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['att']): + echo ''; endforeach; endif; unset($_from); echo ''; ?> + + +
'; echo $this->_tpl_vars['field']['label']; echo ''; echo $this->_tpl_vars['img_down']; echo ''; echo $this->_tpl_vars['img_up']; echo '
'; if (( $this->_tpl_vars['field']['type'] != 'datetime' ) && ( $this->_tpl_vars['field']['type'] != '' )): echo ''; endif; echo '
'; if ($this->_tpl_vars['att']['link'] != ''): echo ''; endif; echo ''; echo $this->_tpl_vars['att']['value']; echo ''; if ($this->_tpl_vars['att']['link'] != ''): echo ''; endif; echo '
+
+
+ + + _tpl_vars['buttons']['add']['right']): ?> +
+ _tpl_vars['buttons']['add']['right']): ?>_tpl_vars['buttons']['add']['label']; ?> + +
+ + +
_tpl_vars['errors']; ?> +
+ + \ Pas de fin de ligne à la fin du fichier. diff -Naur --exclude=CVS --exclude='.*' --exclude='*~' --exclude='*.bak' --exclude=conf.php --exclude=documents --exclude='.*' 24_patch_casiers/htdocs/product.class.php 24_apres_patch/htdocs/product.class.php --- 24_patch_casiers/htdocs/product.class.php 2008-08-04 02:30:52.000000000 +0200 +++ 24_apres_patch/htdocs/product.class.php 2008-08-27 16:03:08.000000000 +0200 @@ -1998,19 +1998,20 @@ * \param id_entrepot id de l'entrepot * \param nbpiece nombre de pieces */ - function create_stock($id_entrepot, $nbpiece) + function create_stock($id_entrepot, $nbpiece, $id_locker = 'NULL') { global $user; $op[0] = "+".trim($nbpiece); $op[1] = "-".trim($nbpiece); $mouvement=0; // We add pieces + if($id_locker == '' ) $id_locker = 'NULL' ; $this->db->begin(); $sql = "INSERT INTO ".MAIN_DB_PREFIX."product_stock "; - $sql .= " (fk_product, fk_entrepot, reel)"; - $sql .= " VALUES ($this->id, $id_entrepot, $nbpiece)"; + $sql .= " (fk_product, fk_entrepot, reel, fk_locker)"; + $sql .= " VALUES ($this->id, $id_entrepot, $nbpiece, $id_locker)"; dolibarr_syslog("Product::create_stock sql=".$sql); $resql=$this->db->query($sql); @@ -2048,7 +2049,7 @@ * \param nbpiece nombre de pieces * \param mouvement 0 = ajout, 1 = suppression */ - function correct_stock($user, $id_entrepot, $nbpiece, $mouvement) + function correct_stock($user, $id_entrepot, $nbpiece, $mouvement,$id_locker='NULL') { if ($id_entrepot) { @@ -2062,12 +2063,12 @@ if ($row->nb > 0) { // Record already exists, we make an update - return $this->ajust_stock($user, $id_entrepot, $nbpiece, $mouvement); + return $this->ajust_stock($user, $id_entrepot, $nbpiece, $mouvement, $id_locker); } else { // Record not yet available, we make an insert - return $this->create_stock($id_entrepot, $nbpiece); + return $this->create_stock($id_entrepot, $nbpiece, $id_locker); } } else @@ -2086,15 +2087,18 @@ * \param nbpiece nombre de pieces * \param mouvement 0 = ajout, 1 = suppression */ - function ajust_stock($user, $id_entrepot, $nbpiece, $mouvement) + function ajust_stock($user, $id_entrepot, $nbpiece, $mouvement, $id_locker = 'NULL') { $op[0] = "+".trim($nbpiece); $op[1] = "-".trim($nbpiece); + if($id_locker == '' ) $id_locker = 'NULL' ; $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."product_stock"; $sql.= " SET reel = reel ".$op[$mouvement]; + if($conf->global->STOCK_LOCKER) + $sql.= ", fk_locker = ".$id_locker ; $sql.= " WHERE fk_product = ".$this->id." AND fk_entrepot = ".$id_entrepot; dolibarr_syslog("Product::ajust_stock sql=".$sql); diff -Naur --exclude=CVS --exclude='.*' --exclude='*~' --exclude='*.bak' --exclude=conf.php --exclude=documents --exclude='.*' 24_patch_casiers/mysql/tables/llx_locker.key.sql 24_apres_patch/mysql/tables/llx_locker.key.sql --- 24_patch_casiers/mysql/tables/llx_locker.key.sql 1970-01-01 01:00:00.000000000 +0100 +++ 24_apres_patch/mysql/tables/llx_locker.key.sql 2008-08-25 14:29:44.000000000 +0200 @@ -0,0 +1,25 @@ + +-- ============================================================================ +-- Copyright (C) 2008 Laurent Destailleur +-- Copyright (C) 2008 < > +-- +-- 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: llx_product/stock_locker.key.sql,v 2.4 2007/12/02 21:51:12 Exp $ +-- ============================================================================ + +ALTER TABLE `llx_locker` ADD INDEX ( `fk_entrepot` ); +ALTER TABLE `llx_locker` ADD FOREIGN KEY ( `fk_entrepot` ) REFERENCES `llx_entrepot` (`rowid`); + diff -Naur --exclude=CVS --exclude='.*' --exclude='*~' --exclude='*.bak' --exclude=conf.php --exclude=documents --exclude='.*' 24_patch_casiers/mysql/tables/llx_locker.sql 24_apres_patch/mysql/tables/llx_locker.sql --- 24_patch_casiers/mysql/tables/llx_locker.sql 1970-01-01 01:00:00.000000000 +0100 +++ 24_apres_patch/mysql/tables/llx_locker.sql 2008-08-25 14:29:44.000000000 +0200 @@ -0,0 +1,43 @@ + + +-- ============================================================================ +-- Copyright (C) 2008 Laurent Destailleur +-- Copyright (C) 2008 < > +-- +-- 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: llx_product/stock_Locker.sql,v 2.4 2007/12/02 21:51:12 Exp $ +-- ============================================================================ + +CREATE TABLE llx_locker +( + rowid INTEGER AUTO_INCREMENT PRIMARY KEY, + code VARCHAR(20), + libelle TEXT, fk_entrepot INTEGER + +)type=innodb; + + + + + + + + + + + + + diff -Naur --exclude=CVS --exclude='.*' --exclude='*~' --exclude='*.bak' --exclude=conf.php --exclude=documents --exclude='.*' 24_patch_casiers/mysql/tables/llx_product_stock.sql 24_apres_patch/mysql/tables/llx_product_stock.sql --- 24_patch_casiers/mysql/tables/llx_product_stock.sql 2008-07-03 00:37:52.000000000 +0200 +++ 24_apres_patch/mysql/tables/llx_product_stock.sql 2008-08-27 16:04:15.000000000 +0200 @@ -1,29 +1,30 @@ --- ============================================================================ --- Copyright (C) 2003 Rodolphe Quiedeville --- --- 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: llx_product_stock.sql,v 1.8 2008/07/02 22:37:52 eldy Exp $ --- ============================================================================ - -create table llx_product_stock -( - rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, - fk_product integer NOT NULL, - fk_entrepot integer NOT NULL, - reel integer -- stock réel -)type=innodb; - +-- ============================================================================ +-- Copyright (C) 2003 Rodolphe Quiedeville +-- +-- 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: llx_product_stock.sql,v 1.8 2008/07/02 22:37:52 eldy Exp $ +-- ============================================================================ + +create table llx_product_stock +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp, + fk_product integer NOT NULL, + fk_entrepot integer NOT NULL, + reel integer, -- stock réel + fk_locker integer NULL +)type=innodb; +