New: Debut d'ajout de la gestion des codes barres
This commit is contained in:
parent
91cab05693
commit
41d9b34f03
135
htdocs/includes/modules/modBarcode.class.php
Normal file
135
htdocs/includes/modules/modBarcode.class.php
Normal file
@ -0,0 +1,135 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Regis Houssin <regis.houssin@cap-networks.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
\defgroup produit Module code barre
|
||||
\brief Module pour gérer les codes barres des produits
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/includes/modules/modBarcode.class.php
|
||||
\ingroup produit
|
||||
\brief Fichier de description et activation du module Barcode
|
||||
*/
|
||||
|
||||
include_once "DolibarrModules.class.php";
|
||||
|
||||
/**
|
||||
\class modBarcode
|
||||
\brief Classe de description et activation du module Barcode
|
||||
*/
|
||||
|
||||
class modBarcode extends DolibarrModules
|
||||
{
|
||||
|
||||
/**
|
||||
* \brief Constructeur. Definit les noms, constantes et boites
|
||||
* \param DB handler d'accès base
|
||||
*/
|
||||
function modBarcode($DB)
|
||||
{
|
||||
$this->db = $DB ;
|
||||
$this->numero = 55 ;
|
||||
|
||||
$this->family = "products";
|
||||
$this->name = "Codes barres";
|
||||
$this->description = "Gestion des codes barres des produits";
|
||||
|
||||
//$this->revision = explode(" ","$Revision$");
|
||||
$this->version = 'experimental'; // 'experimental' or 'dolibarr' or version
|
||||
//$this->version = $this->revision[1];
|
||||
|
||||
$this->const_name = "MAIN_MODULE_BARCODE";
|
||||
$this->const_config = MAIN_MODULE_BARCODE;
|
||||
$this->special = 0;
|
||||
$this->picto='product';
|
||||
|
||||
// Dir
|
||||
$this->dirs = array();
|
||||
|
||||
// Dépendances
|
||||
$this->depends = array("modProduit");
|
||||
$this->requiredby = array();
|
||||
|
||||
// Constantes
|
||||
$this->const = array();
|
||||
|
||||
// Boxes
|
||||
$this->boxes = array();
|
||||
// $this->boxes[0][0] = "Derniers produits/services enregistrés";
|
||||
// $this->boxes[0][1] = "box_produits.php";
|
||||
// $this->boxes[1][0] = "Derniers produits/services vendus";
|
||||
// $this->boxes[1][1] = "box_services_vendus.php";
|
||||
|
||||
// Permissions
|
||||
$this->rights = array();
|
||||
$this->rights_class = 'barcode';
|
||||
|
||||
$this->rights[1][0] = 300; // id de la permission
|
||||
$this->rights[1][1] = 'Lire les codes barres'; // libelle de la permission
|
||||
$this->rights[1][2] = 'r'; // type de la permission (déprécié à ce jour)
|
||||
$this->rights[1][3] = 1; // La permission est-elle une permission par défaut
|
||||
$this->rights[1][4] = 'lire';
|
||||
|
||||
$this->rights[2][0] = 301; // id de la permission
|
||||
$this->rights[2][1] = 'Créer/modifier les codes barres'; // libelle de la permission
|
||||
$this->rights[2][2] = 'w'; // type de la permission (déprécié à ce jour)
|
||||
$this->rights[2][3] = 0; // La permission est-elle une permission par défaut
|
||||
$this->rights[2][4] = 'creer';
|
||||
|
||||
$this->rights[4][0] = 302; // id de la permission
|
||||
$this->rights[4][1] = 'Supprimer les codes barres'; // libelle de la permission
|
||||
$this->rights[4][2] = 'd'; // type de la permission (déprécié à ce jour)
|
||||
$this->rights[4][3] = 0; // La permission est-elle une permission par défaut
|
||||
$this->rights[4][4] = 'supprimer';
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Fonction appelée lors de l'activation du module. Insère en base les constantes, boites, permissions du module.
|
||||
* Définit également les répertoires de données à créer pour ce module.
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
// Permissions
|
||||
$this->remove();
|
||||
|
||||
$sql = array();
|
||||
|
||||
return $this->_init($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Fonction appelée lors de la désactivation d'un module.
|
||||
* Supprime de la base les constantes, boites et permissions du module.
|
||||
*/
|
||||
function remove()
|
||||
{
|
||||
$sql = array();
|
||||
|
||||
return $this->_remove($sql);
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -4,7 +4,7 @@
|
||||
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
* Copyright (C) 2005 Regis Houssin <regis.houssin@cap-networks.com>
|
||||
* Copyright (C) 2005 Regis Houssin <regis.houssin@cap-networks.com>
|
||||
*
|
||||
* 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
|
||||
@ -251,6 +251,7 @@ $conf->produit->enabled=defined("MAIN_MODULE_PRODUIT")?MAIN_MODULE_PRODUIT:0;
|
||||
if ($conf->produit->enabled) require_once(DOL_DOCUMENT_ROOT ."/product.class.php");
|
||||
$conf->produit->dir_output=DOL_DATA_ROOT."/produit";
|
||||
$conf->produit->dir_images=DOL_DATA_ROOT."/produit/images";
|
||||
$conf->barcode->enabled=defined("MAIN_MODULE_BARCODE")?MAIN_MODULE_BARCODE:0;
|
||||
$conf->categorie->enabled=defined("MAIN_MODULE_CATEGORIE")?MAIN_MODULE_CATEGORIE:0;
|
||||
$conf->service->enabled=defined("MAIN_MODULE_SERVICE")?MAIN_MODULE_SERVICE:0;
|
||||
if ($conf->service->enabled) require_once(DOL_DOCUMENT_ROOT ."/product.class.php");
|
||||
|
||||
140
htdocs/product/barcode.php
Normal file
140
htdocs/product/barcode.php
Normal file
@ -0,0 +1,140 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Regis Houssin <regis.houssin@cap-networks.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/product/barcode.php
|
||||
\ingroup product
|
||||
\brief Page du code barre
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
|
||||
$langs->load("products");
|
||||
|
||||
$user->getrights('barcode');
|
||||
|
||||
if (!$user->rights->barcode->lire)
|
||||
accessforbidden();
|
||||
|
||||
$types[0] = $langs->trans("Product");
|
||||
$types[1] = $langs->trans("Service");
|
||||
|
||||
/*
|
||||
* Affiche historique prix
|
||||
*/
|
||||
|
||||
llxHeader("","",$langs->trans("BarCode"));
|
||||
|
||||
$product = new Product($db);
|
||||
$result = $product->fetch($_GET["id"]);
|
||||
|
||||
|
||||
$h=0;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/product/fiche.php?id=".$product->id;
|
||||
$head[$h][1] = $langs->trans("Card");
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/product/price.php?id=".$product->id;
|
||||
$head[$h][1] = $langs->trans("Price");
|
||||
$h++;
|
||||
|
||||
if($product->type == 0)
|
||||
{
|
||||
if ($user->rights->barcode->lire)
|
||||
{
|
||||
if ($conf->barcode->enabled)
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT."/product/barcode.php?id=".$product->id;
|
||||
$head[$h][1] = $langs->trans("BarCode");
|
||||
$hselected=$h;
|
||||
$h++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/product/photos.php?id=".$product->id;
|
||||
$head[$h][1] = $langs->trans("Photos");
|
||||
$h++;
|
||||
|
||||
if($product->type == 0)
|
||||
{
|
||||
if ($conf->stock->enabled)
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT."/product/stock/product.php?id=".$product->id;
|
||||
$head[$h][1] = $langs->trans("Stock");
|
||||
$h++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($conf->fournisseur->enabled) {
|
||||
$head[$h][0] = DOL_URL_ROOT."/product/fournisseurs.php?id=".$product->id;
|
||||
$head[$h][1] = $langs->trans("Suppliers");
|
||||
$h++;
|
||||
}
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/product/stats/fiche.php?id=".$product->id;
|
||||
$head[$h][1] = $langs->trans("Statistics");
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/product/stats/facture.php?id=".$product->id;
|
||||
$head[$h][1] = $langs->trans("Bills");
|
||||
$h++;
|
||||
|
||||
dolibarr_fiche_head($head, $hselected, $langs->trans("CardProduct".$product->type).' : '.$product->ref);
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr>';
|
||||
print '<td width="10%">'.$langs->trans("Ref").'</td><td colspan="2" width="40%">'.$product->ref.'</td>';
|
||||
print '</tr>';
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="2">'.$product->libelle.'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Prix
|
||||
print '<tr><td>'.$langs->trans("SellingPrice").'</td><td colspan="2">'.price($product->price).'</td></tr>';
|
||||
|
||||
// Statut
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="2">';
|
||||
if ($product->envente) print $langs->trans("OnSell");
|
||||
else print $langs->trans("NotOnSell");
|
||||
print '</td></tr>';
|
||||
|
||||
print "</table><br>\n";
|
||||
|
||||
print "</div>\n";
|
||||
|
||||
|
||||
/*
|
||||
* Affiche code barre
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
?>
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Régis Houssin <regis.houssin@cap-networks.com>
|
||||
*
|
||||
* 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
|
||||
@ -302,6 +303,19 @@ if ($_GET["id"])
|
||||
$head[$h][1] = $langs->trans("Price");
|
||||
$h++;
|
||||
|
||||
if($product->type == 0)
|
||||
{
|
||||
if ($user->rights->barcode->lire)
|
||||
{
|
||||
if ($conf->barcode->enabled)
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT."/product/barcode.php?id=".$product->id;
|
||||
$head[$h][1] = $langs->trans("BarCode");
|
||||
$h++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/product/photos.php?id=".$product->id;
|
||||
$head[$h][1] = $langs->trans("Photos");
|
||||
$h++;
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Regis Houssin <regis.houssin@cap-networks.com>
|
||||
*
|
||||
* 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
|
||||
@ -172,10 +173,24 @@ if ($_GET["id"])
|
||||
$head[$h][0] = DOL_URL_ROOT."/product/price.php?id=".$product->id;
|
||||
$head[$h][1] = $langs->trans("Price");
|
||||
$h++;
|
||||
|
||||
if($product->type == 0)
|
||||
{
|
||||
if ($user->rights->barcode->lire)
|
||||
{
|
||||
if ($conf->barcode->enabled)
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT."/product/barcode.php?id=".$product->id;
|
||||
$head[$h][1] = $langs->trans("BarCode");
|
||||
$h++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/product/photos.php?id=".$product->id;
|
||||
$head[$h][1] = $langs->trans("Photos");
|
||||
$h++;
|
||||
$head[$h][0] = DOL_URL_ROOT."/product/photos.php?id=".$product->id;
|
||||
$head[$h][1] = $langs->trans("Photos");
|
||||
$h++;
|
||||
|
||||
if($product->type == 0)
|
||||
{
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Regis Houssin <regis.houssin@cap-networks.com>
|
||||
*
|
||||
* 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
|
||||
@ -99,6 +100,20 @@ if ($_GET["id"])
|
||||
$head[$h][1] = $langs->trans("Price");
|
||||
$h++;
|
||||
|
||||
if($product->type == 0)
|
||||
{
|
||||
if ($user->rights->barcode->lire)
|
||||
{
|
||||
if ($conf->barcode->enabled)
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT."/product/barcode.php?id=".$product->id;
|
||||
$head[$h][1] = $langs->trans("BarCode");
|
||||
$h++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/product/photos.php?id=".$product->id;
|
||||
$head[$h][1] = $langs->trans("Photos");
|
||||
$hselected = $h;
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Regis Houssin <regis.houssin@cap-networks.com>
|
||||
*
|
||||
* 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
|
||||
@ -92,6 +93,20 @@ $head[$h][1] = $langs->trans("Price");
|
||||
$hselected=$h;
|
||||
$h++;
|
||||
|
||||
if($product->type == 0)
|
||||
{
|
||||
if ($user->rights->barcode->lire)
|
||||
{
|
||||
if ($conf->barcode->enabled)
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT."/product/barcode.php?id=".$product->id;
|
||||
$head[$h][1] = $langs->trans("BarCode");
|
||||
$h++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/product/photos.php?id=".$product->id;
|
||||
$head[$h][1] = $langs->trans("Photos");
|
||||
$h++;
|
||||
@ -117,7 +132,7 @@ $head[$h][1] = $langs->trans("Statistics");
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/product/stats/facture.php?id=".$product->id;
|
||||
$head[$h][1] = $langs->trans('Bills');
|
||||
$head[$h][1] = $langs->trans("Bills");
|
||||
$h++;
|
||||
|
||||
dolibarr_fiche_head($head, $hselected, $langs->trans("CardProduct".$product->type).' : '.$product->ref);
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Regis Houssin <regis.houssin@cap-networks.com>
|
||||
*
|
||||
* 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
|
||||
@ -80,6 +81,20 @@ if ($_GET["id"])
|
||||
$head[$h][1] = $langs->trans("Price");
|
||||
$h++;
|
||||
|
||||
if($product->type == 0)
|
||||
{
|
||||
if ($user->rights->barcode->lire)
|
||||
{
|
||||
if ($conf->barcode->enabled)
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT."/product/barcode.php?id=".$product->id;
|
||||
$head[$h][1] = $langs->trans("BarCode");
|
||||
$h++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/product/photos.php?id=".$product->id;
|
||||
$head[$h][1] = $langs->trans("Photos");
|
||||
$h++;
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (c) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Regis Houssin <regis.houssin@cap-networks.com>
|
||||
*
|
||||
* 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
|
||||
@ -115,6 +116,20 @@ if ($_GET["id"])
|
||||
$head[$h][1] = $langs->trans("Price");
|
||||
$h++;
|
||||
|
||||
if($product->type == 0)
|
||||
{
|
||||
if ($user->rights->barcode->lire)
|
||||
{
|
||||
if ($conf->barcode->enabled)
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT."/product/barcode.php?id=".$product->id;
|
||||
$head[$h][1] = $langs->trans("BarCode");
|
||||
$h++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/product/photos.php?id=".$product->id;
|
||||
$head[$h][1] = $langs->trans("Photos");
|
||||
$h++;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user