Fix: bug affichage code barre

This commit is contained in:
Regis Houssin 2009-05-03 17:28:14 +00:00
parent b3360827ba
commit 2d2687a642
5 changed files with 21 additions and 18 deletions

View File

@ -41,6 +41,7 @@ if ($_POST["action"] == 'setcoder')
$sqlp = "UPDATE ".MAIN_DB_PREFIX."c_barcode_type"; $sqlp = "UPDATE ".MAIN_DB_PREFIX."c_barcode_type";
$sqlp.= " SET coder = '" . $_POST["coder"]."'"; $sqlp.= " SET coder = '" . $_POST["coder"]."'";
$sqlp.= " WHERE rowid = ". $_POST["code_id"]; $sqlp.= " WHERE rowid = ". $_POST["code_id"];
$resql=$db->query($sqlp); $resql=$db->query($sqlp);
//print $sqlp; //print $sqlp;
} }
@ -132,7 +133,8 @@ print '<td align="center" width="60">'.$langs->trans("CodeBarGenerator").'</td>'
print "</tr>\n"; print "</tr>\n";
$sql = "SELECT rowid, code as encoding, libelle, coder, example"; $sql = "SELECT rowid, code as encoding, libelle, coder, example";
$sql .= " FROM ".MAIN_DB_PREFIX."c_barcode_type"; $sql.= " FROM ".MAIN_DB_PREFIX."c_barcode_type";
dol_syslog("admin/barcode.php sql=".$sql); dol_syslog("admin/barcode.php sql=".$sql);
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)

View File

@ -62,7 +62,8 @@ class FormBarCode
$disable = ''; $disable = '';
// On vérifie si le code de barre est déjà sélectionné par défaut dans le module produit // On vérifie si le code de barre est déjà sélectionné par défaut dans le module produit
if ($conf->produit->enabled && $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE == $code_id) if (($conf->produit->enabled && $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE == $code_id) ||
($conf->societe->enabled && $conf->global->GENBARCODE_BARCODETYPE_THIRDPARTY == $code_id))
{ {
$disable = 'disabled="disabled"'; $disable = 'disabled="disabled"';
} }

View File

@ -65,8 +65,8 @@ $font_loc = DOL_DOCUMENT_ROOT.'/includes/barcode/php-barcode/fonts/AerialBd.ttf'
/* Automatic-Detection of Font if running Windows /* Automatic-Detection of Font if running Windows
* kick this lines if you don't need them! */ * kick this lines if you don't need them! */
if (isset($_ENV['windir']) && file_exists($_ENV['windir'])){ if (isset($_SERVER['WINDIR']) && file_exists($_SERVER['WINDIR'])){
$font_loc=$_ENV['windir']."\Fonts\arialbd.ttf"; $font_loc=$_SERVER['WINDIR']."\Fonts\arialbd.ttf";
} }
/* ******************************************************************** */ /* ******************************************************************** */
@ -76,7 +76,7 @@ if (isset($_ENV['windir']) && file_exists($_ENV['windir'])){
* leave blank if you don't have them :( * leave blank if you don't have them :(
* genbarcode is needed to render encodings other than EAN-12/EAN-13/ISBN * genbarcode is needed to render encodings other than EAN-12/EAN-13/ISBN
*/ */
if (isset($_ENV['windir']) && file_exists($_ENV['windir'])) if (isset($_SERVER['WINDIR']) && file_exists($_SERVER['WINDIR']))
{ {
$genbarcode_loc = DOL_DOCUMENT_ROOT.'/includes/barcode/php-barcode/genbarcode/genbarcode.exe'; $genbarcode_loc = DOL_DOCUMENT_ROOT.'/includes/barcode/php-barcode/genbarcode/genbarcode.exe';
} }
@ -85,7 +85,7 @@ else
//$genbarcode_loc = "/usr/local/bin/genbarcode"; //$genbarcode_loc = "/usr/local/bin/genbarcode";
$genbarcode_loc = $conf->global->GENBARCODE_LOCATION; $genbarcode_loc = $conf->global->GENBARCODE_LOCATION;
} }
//dol_syslog("genbarcode_loc=".$genbarcode_loc); //dol_syslog("genbarcode_loc=".$genbarcode_loc." - env_windows=".$_SERVER['WINDIR']);
/* CONFIGURATION ENDS HERE */ /* CONFIGURATION ENDS HERE */

View File

@ -81,12 +81,12 @@ class modPhpbarcode extends ModeleBarCode
return $supported; return $supported;
} }
/** /**
* \brief Return an image file on output * \brief Return an image file on output
* \param $code Valeur numérique a coder * \param $code Valeur numérique a coder
* \param $encoding Mode de codage * \param $encoding Mode de codage
* \param $readable Code lisible * \param $readable Code lisible
*/ */
function buildBarCode($code,$encoding,$readable='Y') function buildBarCode($code,$encoding,$readable='Y')
{ {
global $_GET,$_ENV,$_SERVER; global $_GET,$_ENV,$_SERVER;
@ -111,15 +111,15 @@ class modPhpbarcode extends ModeleBarCode
return 1; return 1;
} }
/** /**
* \brief Save an image file on disk * \brief Save an image file on disk
* \param $code Valeur numérique a coder * \param $code Valeur numérique a coder
* \param $encoding Mode de codage * \param $encoding Mode de codage
* \param $readable Code lisible * \param $readable Code lisible
*/ */
function writeBarCode($code,$encoding,$readable='Y') function writeBarCode($code,$encoding,$readable='Y')
{ {
global $conf,$filebarcode; global $conf,$filebarcode;
create_exdir($conf->barcode->dir_temp); create_exdir($conf->barcode->dir_temp);
@ -130,7 +130,7 @@ class modPhpbarcode extends ModeleBarCode
$result=$this->buildBarCode($code,$encoding,$readable); $result=$this->buildBarCode($code,$encoding,$readable);
return $result; return $result;
} }
} }

View File

@ -292,21 +292,21 @@ if ($modulepart)
elseif ($modulepart == 'barcode') elseif ($modulepart == 'barcode')
{ {
$accessallowed=1; $accessallowed=1;
$original_file=''; // No files are built on disk $original_file=$conf->barcode->dir_temp.'/'.$original_file;
} }
// images des stats du commercial // images des stats du commercial
elseif ($modulepart == 'graph_comm') elseif ($modulepart == 'graph_comm')
{ {
$accessallowed=1; $accessallowed=1;
$original_file= $conf->commercial->dir_temp . '/' .$original_file ; // No files are built on disk $original_file= $conf->commercial->dir_temp . '/' .$original_file; // No files are built on disk
} }
// Wrapping generique (allows any module to open a file if file is in directory // Wrapping generique (allows any module to open a file if file is in directory
// called DOL_DATA_ROOT/modulepart. // called DOL_DATA_ROOT/modulepart.
else else
{ {
$accessallowed=1; $accessallowed=1;
$original_file=DOL_DATA_ROOT.'/'.$modulepart.'/'.$original_file; $original_file=DOL_DATA_ROOT.'/'.$modulepart.'/'.$original_file;
} }
} }
@ -367,7 +367,7 @@ else
exit; exit;
} }
// Les drois sont ok et fichier trouv<EFBFBD> // Les drois sont ok et fichier trouve
if ($type) if ($type)
{ {
header('Content-type: '.$type); header('Content-type: '.$type);