mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-24 02:11:27 +01:00
New: Les generateurs de code barre sont externaliss en modules.
This commit is contained in:
@@ -35,6 +35,10 @@ http://www.fsf.org/licensing/licenses/index_html
|
||||
Copyright
|
||||
---------
|
||||
|
||||
Copyright (C) 2008
|
||||
- Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
- Regis Houssin <regis@dolibarr.fr>
|
||||
|
||||
Copyright (C) 2007
|
||||
- Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
- Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -18,7 +18,6 @@
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -30,6 +29,8 @@
|
||||
|
||||
require("./pre.inc.php");
|
||||
|
||||
$dir = DOL_DOCUMENT_ROOT."/includes/modules/barcode/";
|
||||
|
||||
$langs->load("admin");
|
||||
|
||||
if (!$user->admin)
|
||||
@@ -38,9 +39,10 @@ if (!$user->admin)
|
||||
if ($_POST["action"] == 'setcoder')
|
||||
{
|
||||
$sqlp = "UPDATE ".MAIN_DB_PREFIX."c_barcode_type";
|
||||
$sqlp.= " SET coder = " . $_POST["coder"];
|
||||
$sqlp.= " SET coder = '" . $_POST["coder"]."'";
|
||||
$sqlp.= " WHERE rowid = ". $_POST["code_id"];
|
||||
$resql=$db->query($sqlp);
|
||||
//print $sqlp;
|
||||
}
|
||||
else if ($_POST["action"] == 'setgenbarcodelocation')
|
||||
{
|
||||
@@ -55,12 +57,49 @@ else if ($_POST["action"] == 'setproductusebarcode')
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$html = new Form($db);
|
||||
|
||||
llxHeader('',$langs->trans("BarcodeSetup"),'BarcodeConfiguration');
|
||||
|
||||
print_fiche_titre($langs->trans("BarcodeSetup"),'','setup');
|
||||
|
||||
// Detect bar codes modules
|
||||
$barcodelist=array();
|
||||
|
||||
clearstatcache();
|
||||
|
||||
$handle=opendir($dir);
|
||||
|
||||
$var=true;
|
||||
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
if (substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')
|
||||
{
|
||||
if (is_readable($dir.$file))
|
||||
{
|
||||
if (eregi('(.*)\.modules\.php',$file,$reg))
|
||||
{
|
||||
$filebis=$reg[1];
|
||||
|
||||
// Chargement de la classe de codage
|
||||
require_once($dir.$file);
|
||||
$classname = "mod".ucfirst($filebis);
|
||||
$module = new $classname($db);
|
||||
|
||||
// Show modules according to features level
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
|
||||
|
||||
$barcodelist[$filebis]=$module->info();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* CHOIX ENCODAGE
|
||||
*/
|
||||
@@ -76,7 +115,7 @@ print '<td width="200" align="center">'.$langs->trans("Example").'</td>';
|
||||
print '<td align="center" width="60">'.$langs->trans("CodeBarGenerator").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$sql = "SELECT rowid, code, libelle, coder, example";
|
||||
$sql = "SELECT rowid, code as encoding, libelle, coder, example";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_barcode_type";
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
@@ -92,7 +131,7 @@ if ($resql)
|
||||
print '<tr '.$bc[$var].'><td width="100">';
|
||||
print $obj->libelle;
|
||||
print "</td><td>\n";
|
||||
print $langs->trans('BarcodeDesc'.$obj->code);
|
||||
print $langs->trans('BarcodeDesc'.$obj->encoding);
|
||||
//print "L'EAN se compose de 8 caract<63>res, 7 chiffres plus une cl<63> de contr<74>le.<br>";
|
||||
//print "L'utilisation des symbologies EAN8 impose la souscription et l'abonnement aupr<70>s d'organisme tel que GENCOD.<br>";
|
||||
//print "Codes num<75>riques utilis<69>s exclusivement <20> l'identification des produits susceptibles d'<27>tre vendus au grand public.";
|
||||
@@ -102,9 +141,21 @@ if ($resql)
|
||||
print '<td align="center">';
|
||||
if ($obj->coder)
|
||||
{
|
||||
$url=dol_genbarcode($obj->example,$obj->code,$obj->coder);
|
||||
if ($url) print '<img src="'.$url.'">';
|
||||
else print $langs->trans("FormatNotSupportedByGenerator");
|
||||
// Chargement de la classe de codage
|
||||
require_once($dir.$obj->coder.".modules.php");
|
||||
$classname = "mod".ucfirst($obj->coder);
|
||||
$module = new $classname($db);
|
||||
|
||||
if ($module->encodingIsSupported($obj->encoding))
|
||||
{
|
||||
$url=DOL_URL_ROOT.'/viewimage.php?modulepart=barcode&generator='.urlencode($obj->coder).'&code='.urlencode($obj->example).'&encoding='.urlencode($obj->encoding);
|
||||
//print $url;
|
||||
print '<img src="'.$url.'" border="0">';
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("FormatNotSupportedByGenerator");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -113,7 +164,7 @@ if ($resql)
|
||||
print '</td>';
|
||||
|
||||
print '<td align="center">';
|
||||
print $html->setBarcodeEncoder($obj->coder,$obj->rowid,'form'.$i);
|
||||
print $html->setBarcodeEncoder($obj->coder,$barcodelist,$obj->rowid,'form'.$i);
|
||||
print "</td></tr>\n";
|
||||
$var=!$var;
|
||||
$i++;
|
||||
|
||||
@@ -3559,9 +3559,8 @@ class Form
|
||||
* \param selected Id code pr<70>-s<>lectionn<6E>
|
||||
* \param code_id Id du code barre
|
||||
* \param idForm Id du formulaire
|
||||
* Todo : ajouter une v<>rification de d<>sactivation du code barre si il est d<>j<EFBFBD> utilis<69> dans un module
|
||||
*/
|
||||
function setBarcodeEncoder($selected=0,$code_id,$idForm='formbarcode')
|
||||
function setBarcodeEncoder($selected=0,$barcodelist,$code_id,$idForm='formbarcode')
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
@@ -3579,8 +3578,10 @@ class Form
|
||||
$select_encoder.= '<select class="flat" name="coder" onChange="barcode_coder_save(\''.$idForm.'\')">';
|
||||
$select_encoder.= '<option value="0"'.($selected==0?' selected="true"':'').' '.$disable.'>'.$langs->trans('Disable').'</option>';
|
||||
$select_encoder.= '<option value="-1" disabled="disabled">--------------------</option>';
|
||||
$select_encoder.= '<option value="1"'.($selected==1?' selected="true"':'').'>PHP-Barcode</option>';
|
||||
$select_encoder.= '<option value="2"'.($selected==2?' selected="true"':'').'>PI_Barcode</option>';
|
||||
foreach($barcodelist as $key => $value)
|
||||
{
|
||||
$select_encoder.= '<option value="'.$key.'"'.($selected==$key?' selected="true"':'').'>'.$value.'</option>';
|
||||
}
|
||||
$select_encoder.= '</select></form>';
|
||||
|
||||
return $select_encoder;
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
|
||||
*/
|
||||
|
||||
require_once('../../../master.inc.php');
|
||||
|
||||
/* CONFIGURATION */
|
||||
|
||||
@@ -86,6 +85,7 @@ else
|
||||
//$genbarcode_loc = "/usr/local/bin/genbarcode";
|
||||
$genbarcode_loc = $conf->global->GENBARCODE_LOCATION;
|
||||
}
|
||||
//dolibarr_syslog("genbarcode_loc=".$genbarcode_loc);
|
||||
|
||||
|
||||
/* CONFIGURATION ENDS HERE */
|
||||
@@ -432,6 +432,7 @@ function barcode_encode($code,$encoding){
|
||||
|
||||
function barcode_print($code, $encoding="ANY", $scale = 2 ,$mode = "png" ){
|
||||
$bars=barcode_encode($code,$encoding);
|
||||
dolibarr_syslog("$code $encoding $scale $mode ".join(',',$bars));
|
||||
if (!$bars) return;
|
||||
if (!$mode) $mode="png";
|
||||
if (eregi($mode,"^(text|txt|plain)$")) print barcode_outtext($bars['text'],$bars['bars']);
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
|
||||
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2005 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
* 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
|
||||
@@ -14,40 +17,30 @@
|
||||
* 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.
|
||||
* or see http://www.gnu.org/
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/genbarcode.php
|
||||
\brief Générateur de codes barres
|
||||
\file htdocs/includes/modules/barcode/modules_barcode.php
|
||||
\ingroup barcode
|
||||
\brief Fichier contenant la classe mère de generation des codes barres
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
require_once('php-barcode.php');
|
||||
require_once(DOL_DOCUMENT_ROOT.'/lib/functions.inc.php');
|
||||
|
||||
|
||||
/**
|
||||
\class ModeleBarCode
|
||||
\brief Classe mère des modèles de code barre
|
||||
*/
|
||||
|
||||
class ModeleBarCode
|
||||
{
|
||||
var $error='';
|
||||
|
||||
function getvar($name){
|
||||
global $_GET, $_POST;
|
||||
if (isset($_GET[$name])) return $_GET[$name];
|
||||
else if (isset($_POST[$name])) return $_POST[$name];
|
||||
else return false;
|
||||
}
|
||||
|
||||
if (get_magic_quotes_gpc()){
|
||||
$code=stripslashes(getvar('code'));
|
||||
} else {
|
||||
$code=getvar('code');
|
||||
}
|
||||
if ($code) barcode_print($code,getvar('encoding'),getvar('scale'),getvar('mode'));
|
||||
|
||||
/*
|
||||
* call
|
||||
* http://........./barcode.php?code=012345678901
|
||||
* or
|
||||
* http://........./barcode.php?code=012345678901&encoding=EAN&scale=4&mode=png
|
||||
*
|
||||
*/
|
||||
|
||||
?>
|
||||
109
htdocs/includes/modules/barcode/phpbarcode.modules.php
Normal file
109
htdocs/includes/modules/barcode/phpbarcode.modules.php
Normal file
@@ -0,0 +1,109 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
* 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.
|
||||
* or see http://www.gnu.org/
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/includes/modules/barcode/phpbarcode.modules.php
|
||||
\ingroup facture
|
||||
\brief Fichier contenant la classe du mod<6F>le de generation code barre phpbarcode
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/barcode/modules_barcode.php");
|
||||
|
||||
/** \class modPhpbarcode
|
||||
\brief Classe du mod<6F>le de num<75>rotation de generation code barre phpbarcode
|
||||
*/
|
||||
|
||||
class modPhpbarcode extends ModeleBarCode
|
||||
{
|
||||
var $version='dolibarr'; // 'development', 'experimental', 'dolibarr'
|
||||
var $error='';
|
||||
|
||||
/** \brief Renvoi la description du modele de num<75>rotation
|
||||
* \return string Texte descripif
|
||||
*/
|
||||
function info()
|
||||
{
|
||||
global $langs;
|
||||
|
||||
return 'Php-barcode';
|
||||
}
|
||||
|
||||
/** \brief Test si les num<75>ros d<>j<EFBFBD> en vigueur dans la base ne provoquent pas de
|
||||
* de conflits qui empechera cette num<75>rotation de fonctionner.
|
||||
* \return boolean false si conflit, true si ok
|
||||
*/
|
||||
function canBeActivated()
|
||||
{
|
||||
global $langs;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Return true if encodinf is supported
|
||||
\return int >0 if supported, 0 if not
|
||||
*/
|
||||
function encodingIsSupported($encoding)
|
||||
{
|
||||
$supported=0;
|
||||
if ($encoding == 'EAN8') $supported=1;
|
||||
if ($encoding == 'EAN13') $supported=1;
|
||||
if ($encoding == 'ISBN') $supported=1;
|
||||
if ($encoding == 'C39') $supported=1;
|
||||
if ($encoding == 'C128') $supported=1;
|
||||
return $supported;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Retourne fichier image
|
||||
\param $code Valeur num<75>rique a coder
|
||||
\param $encoding Mode de codage
|
||||
\param $readable Code lisible
|
||||
*/
|
||||
function buildBarCode($code,$encoding,$readable='Y')
|
||||
{
|
||||
global $_GET,$_ENV,$_SERVER;
|
||||
global $conf;
|
||||
global $genbarcode_loc, $bar_color, $bg_color, $text_color, $font_loc;
|
||||
|
||||
if (! $this->encodingIsSupported($encoding)) return -1;
|
||||
|
||||
if ($encoding == 'EAN8' || $encoding == 'EAN13') $encoding = 'EAN';
|
||||
if ($encoding == 'C39' || $encoding == 'C128') $encoding = substr($encoding,1);
|
||||
|
||||
$scale=1; $mode='png';
|
||||
|
||||
$_GET["code"]=$code;
|
||||
$_GET["encoding"]=$encoding;
|
||||
$_GET["scale"]=$scale;
|
||||
$_GET["mode"]=$mode;
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT.'/includes/barcode/php-barcode/php-barcode.php');
|
||||
if ($code) barcode_print($code,$encoding,$scale,$mode);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
103
htdocs/includes/modules/barcode/pibarcode.modules.php
Normal file
103
htdocs/includes/modules/barcode/pibarcode.modules.php
Normal file
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
* 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.
|
||||
* or see http://www.gnu.org/
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/includes/modules/barcode/pibarcode.modules.php
|
||||
\ingroup facture
|
||||
\brief Fichier contenant la classe du mod<6F>le de generation code barre pibarcode
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/barcode/modules_barcode.php");
|
||||
|
||||
/** \class modPibarcode
|
||||
\brief Classe du mod<6F>le de generation code barre pibarcode
|
||||
*/
|
||||
|
||||
class modPibarcode extends ModeleBarCode
|
||||
{
|
||||
var $version='dolibarr'; // 'development', 'experimental', 'dolibarr'
|
||||
var $error='';
|
||||
|
||||
/** \brief Renvoi la description du modele de num<75>rotation
|
||||
* \return string Texte descripif
|
||||
*/
|
||||
function info()
|
||||
{
|
||||
global $langs;
|
||||
|
||||
return 'Pi-barcode';
|
||||
}
|
||||
|
||||
/** \brief Test si les num<75>ros d<>j<EFBFBD> en vigueur dans la base ne provoquent pas de
|
||||
* de conflits qui empechera cette num<75>rotation de fonctionner.
|
||||
* \return boolean false si conflit, true si ok
|
||||
*/
|
||||
function canBeActivated()
|
||||
{
|
||||
global $langs;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Return true if encodinf is supported
|
||||
\return int >0 if supported, 0 if not
|
||||
*/
|
||||
function encodingIsSupported($encoding)
|
||||
{
|
||||
$supported=0;
|
||||
if ($encoding == 'EAN8') $supported=1;
|
||||
if ($encoding == 'EAN13') $supported=1;
|
||||
if ($encoding == 'UPC') $supported=1;
|
||||
if ($encoding == 'C39') $supported=1;
|
||||
if ($encoding == 'C128') $supported=1;
|
||||
return $supported;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Retourne fichier image
|
||||
\param $code Valeur num<75>rique a coder
|
||||
\param $encoding Mode de codage
|
||||
\param $readable Code lisible
|
||||
*/
|
||||
function buildBarCode($code,$encoding,$readable='Y')
|
||||
{
|
||||
global $_GET;
|
||||
|
||||
if (! $this->encodingIsSupported($encoding)) return -1;
|
||||
|
||||
if ($encoding == 'EAN8' || $encoding == 'EAN13') $encoding = 'EAN';
|
||||
|
||||
$_GET["code"]=$code;
|
||||
$_GET["type"]=$encoding;
|
||||
$_GET["height"]=50;
|
||||
$_GET["readable"]=$readable;
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT.'/includes/barcode/pi_barcode/pi_barcode.php');
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -3506,31 +3506,6 @@ function viewExcelFileContent($file_to_include='',$max_rows=0,$max_cols=0)
|
||||
</SCRIPT>";
|
||||
}
|
||||
|
||||
/**
|
||||
\brief G<>n<EFBFBD>rateur de codes barres
|
||||
\param $code Valeur num<75>rique a coder
|
||||
\param $encoding Mode de codage
|
||||
\param $generator G<>n<EFBFBD>rateur utilis<69> (1=php-barcode, 2=pi_barcode)
|
||||
\param $readable Code lisible
|
||||
\return url
|
||||
*/
|
||||
function dol_genbarcode($code,$encoding,$generator=1,$readable='Y')
|
||||
{
|
||||
$url='';
|
||||
|
||||
if ($encoding == 'EAN8' || $encoding == 'EAN13') $encoding = 'EAN';
|
||||
|
||||
if ($generator == 1)
|
||||
{
|
||||
if ($encoding == 'C39' || $encoding == 'C128') $encoding = substr($encoding,1);
|
||||
$url = DOL_URL_ROOT.'/includes/barcode/php-barcode/genbarcode.php?code='.$code.'&encoding='.$encoding.'&scale=1';
|
||||
}
|
||||
else if ($generator == 2)
|
||||
{
|
||||
$url = DOL_URL_ROOT.'/includes/barcode/pi_barcode/pi_barcode.php?code='.$code.'&type='.$encoding.'&height=50&readable='.$readable;
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Retourne un tableau des mois ou le mois s<>lectionn<6E>
|
||||
|
||||
@@ -100,7 +100,8 @@ print '</tr>';
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="2">'.$product->libelle.'</td>';
|
||||
|
||||
// Barcode image
|
||||
print '<td width="300" align="center" rowspan="5"><img src="'.dol_genbarcode($product->barcode,$product->barcode_type_code,$product->barcode_type_coder).'"></td>';
|
||||
$url=DOL_URL_ROOT.'/viewimage.php?modulepart=barcode&generator='.urlencode($product->barcode_type_coder).'&code='.urlencode($product->barcode).'&encoding='.urlencode($product->barcode_type_code);
|
||||
print '<td width="300" align="center" rowspan="5"><img src="'.$url.'"></td>';
|
||||
|
||||
print '</tr>';
|
||||
|
||||
|
||||
@@ -260,6 +260,7 @@ if ($modulepart)
|
||||
$accessallowed=1;
|
||||
$original_file=DOL_DATA_ROOT.'/graph/fournisseur/'.$original_file;
|
||||
}
|
||||
|
||||
// Wrapping pour les graph des produits
|
||||
if ($modulepart == 'graph_product')
|
||||
{
|
||||
@@ -267,6 +268,13 @@ if ($modulepart)
|
||||
$original_file=DOL_DATA_ROOT.'/graph/product/'.$original_file;
|
||||
}
|
||||
|
||||
// Wrapping pour les code barre
|
||||
if ($modulepart == 'barcode')
|
||||
{
|
||||
$accessallowed=1;
|
||||
$original_file='';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Security:
|
||||
@@ -290,29 +298,53 @@ if (eregi('\.\.',$original_file) || eregi('[<>|]',$original_file))
|
||||
|
||||
|
||||
|
||||
// Ouvre et renvoi fichier
|
||||
clearstatcache();
|
||||
$filename = basename($original_file);
|
||||
|
||||
dolibarr_syslog("viewimage.php return file $original_file $filename content-type=$type");
|
||||
|
||||
if (! file_exists($original_file))
|
||||
if ($modulepart == 'barcode')
|
||||
{
|
||||
$langs->load("main");
|
||||
dolibarr_print_error(0,$langs->trans("ErrorFileDoesNotExists",$_GET["file"]));
|
||||
exit;
|
||||
}
|
||||
// Output files with barcode generators
|
||||
$dir = DOL_DOCUMENT_ROOT."/includes/modules/barcode/";
|
||||
|
||||
// Les drois sont ok et fichier trouv<75>
|
||||
if ($type)
|
||||
{
|
||||
header('Content-type: '.$type);
|
||||
$generator=$_GET["generator"];
|
||||
$code=$_GET["code"];
|
||||
$encoding=$_GET["encoding"];
|
||||
$readable=$_GET["readable"];
|
||||
|
||||
// Chargement de la classe de codage
|
||||
require_once($dir.$generator.".modules.php");
|
||||
$classname = "mod".ucfirst($generator);
|
||||
$module = new $classname($db);
|
||||
if ($module->encodingIsSupported($encoding))
|
||||
{
|
||||
$result=$module->buildBarCode($code,$encoding,$readable);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Ouvre et renvoi fichier
|
||||
clearstatcache();
|
||||
|
||||
// Output files on disk
|
||||
$filename = basename($original_file);
|
||||
|
||||
dolibarr_syslog("viewimage.php return file $original_file $filename content-type=$type");
|
||||
|
||||
if (! file_exists($original_file))
|
||||
{
|
||||
$langs->load("main");
|
||||
dolibarr_print_error(0,$langs->trans("ErrorFileDoesNotExists",$_GET["file"]));
|
||||
exit;
|
||||
}
|
||||
|
||||
// Les drois sont ok et fichier trouv<75>
|
||||
if ($type)
|
||||
{
|
||||
header('Content-type: '.$type);
|
||||
}
|
||||
else
|
||||
{
|
||||
header('Content-type: image/png');
|
||||
}
|
||||
|
||||
readfile($original_file);
|
||||
}
|
||||
|
||||
readfile($original_file);
|
||||
|
||||
?>
|
||||
|
||||
@@ -48,6 +48,7 @@ if (empty($conf->global->PHPWEBCALENDAR_URL))
|
||||
$webcal=new WebCal();
|
||||
if (! $webcal->localdb->connected || ! $webcal->localdb->database_selected)
|
||||
{
|
||||
$langs->load("admin");
|
||||
llxHeader();
|
||||
if ($webcal->localdb->connected == 1 && $webcal->localdb->database_selected != 1)
|
||||
{
|
||||
|
||||
@@ -9,3 +9,5 @@ delete from llx_const where name='MAIN_GRAPH_LIBRARY' and (value like 'phplot%'
|
||||
|
||||
ALTER TABLE llx_societe_adresse_livraison ADD COLUMN tel varchar(20) after fk_pays;
|
||||
ALTER TABLE llx_societe_adresse_livraison ADD COLUMN fax varchar(20) after tel;
|
||||
|
||||
alter table llx_c_barcode_type modify coder varchar(16) NOT NULL;
|
||||
|
||||
@@ -23,6 +23,6 @@ create table llx_c_barcode
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
code varchar(16) NOT NULL,
|
||||
libelle varchar(50) NOT NULL,
|
||||
coder integer NOT NULL DEFAULT 0,
|
||||
coder varchar(16) NOT NULL,
|
||||
example varchar(16) NOT NULL
|
||||
)type=innodb;
|
||||
|
||||
Reference in New Issue
Block a user