\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 '
+ {/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}
+
+
+{/foreach}
+
+ {if $buttons.add.right}
+
+
+
\ 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;
+