mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-24 02:11:27 +01:00
Several bug fixes from scrutinizer
This commit is contained in:
@@ -179,7 +179,7 @@ $c=getServerTimeZoneInt('summer');
|
||||
$daylight=(is_numeric($c) && is_numeric($b))?round($c-$b):'unknown';
|
||||
//print $a." ".$b." ".$c." ".$daylight;
|
||||
$val=($a>=0?'+':'').$a;
|
||||
$val.=' ('.($a==='unknown'?'unknown':($a>=0?'+':'').($a*3600)).')';
|
||||
$val.=' ('.($a=='unknown'?'unknown':($a>=0?'+':'').($a*3600)).')';
|
||||
$val.=' '.getServerTimeZoneString();
|
||||
$val.=' '.$langs->trans("DaylingSavingTime").': '.($daylight==='unknown'?'unknown':($a==$c?yn($daylight):yn(0).($daylight?' ('.$langs->trans('YesInSummer').')':'')));
|
||||
print $form->textwithtooltip($val,$txt,2,1,img_info(''));
|
||||
|
||||
@@ -1295,11 +1295,9 @@ class Categorie extends CommonObject
|
||||
*
|
||||
* @param string $sdir Repertoire destination finale
|
||||
* @param string $file Nom du fichier uploade
|
||||
* @param int $maxWidth Largeur maximum que dois faire la miniature (160 par defaut)
|
||||
* @param int $maxHeight Hauteur maximum que dois faire la miniature (120 par defaut)
|
||||
* @return void
|
||||
*/
|
||||
function add_photo($sdir, $file, $maxWidth = 160, $maxHeight = 120)
|
||||
function add_photo($sdir, $file)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
@@ -1321,36 +1319,11 @@ class Categorie extends CommonObject
|
||||
if (file_exists($originImage))
|
||||
{
|
||||
// Cree fichier en taille vignette
|
||||
$this->add_thumb($originImage,$maxWidth,$maxHeight);
|
||||
$this->add_thumb($originImage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build thumb
|
||||
*
|
||||
* @param string $file Chemin du fichier d'origine
|
||||
* @return void
|
||||
*/
|
||||
function add_thumb($file)
|
||||
{
|
||||
global $maxwidthsmall, $maxheightsmall, $maxwidthmini, $maxheightmini, $quality;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT .'/core/lib/images.lib.php'; // This define also $maxwidthsmall, $quality, ...
|
||||
|
||||
if (file_exists($file))
|
||||
{
|
||||
// Create small thumbs for company (Ratio is near 16/9)
|
||||
// Used on logon for example
|
||||
$imgThumbSmall = vignette($file, $maxwidthsmall, $maxheightsmall, '_small', $quality);
|
||||
|
||||
// Create mini thumbs for company (Ratio is near 16/9)
|
||||
// Used on menu or for setup page for example
|
||||
$imgThumbMini = vignette($file, $maxwidthmini, $maxheightmini, '_mini', $quality);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return tableau de toutes les photos de la categorie
|
||||
*
|
||||
|
||||
@@ -368,7 +368,7 @@ if ($resql)
|
||||
$nbprod++; // order contains real products
|
||||
$generic_product->id = $generic_commande->lines[$lig]->fk_product;
|
||||
if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product])) {
|
||||
$generic_product->load_stock(true);
|
||||
$generic_product->load_stock();
|
||||
$productstat_cache[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_reel;
|
||||
} else {
|
||||
$generic_product->stock_reel = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stock_reel'];
|
||||
|
||||
@@ -3458,6 +3458,31 @@ abstract class CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build thumb
|
||||
*
|
||||
* @param string $file Path file in UTF8 to original file to create thumbs from.
|
||||
* @return void
|
||||
*/
|
||||
function add_thumb($file)
|
||||
{
|
||||
global $maxwidthsmall, $maxheightsmall, $maxwidthmini, $maxheightmini, $quality;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT .'/core/lib/images.lib.php'; // This define also $maxwidthsmall, $quality, ...
|
||||
|
||||
$file_osencoded=dol_osencode($file);
|
||||
if (file_exists($file_osencoded))
|
||||
{
|
||||
// Create small thumbs for company (Ratio is near 16/9)
|
||||
// Used on logon for example
|
||||
$imgThumbSmall = vignette($file_osencoded, $maxwidthsmall, $maxheightsmall, '_small', $quality);
|
||||
|
||||
// Create mini thumbs for company (Ratio is near 16/9)
|
||||
// Used on menu or for setup page for example
|
||||
$imgThumbMini = vignette($file_osencoded, $maxwidthmini, $maxheightmini, '_mini', $quality);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Functions common to commonobject and commonobjectline */
|
||||
|
||||
|
||||
@@ -95,6 +95,7 @@ function getServerTimeZoneInt($refgmtdate='now')
|
||||
}
|
||||
else
|
||||
{
|
||||
$tmp=0;
|
||||
dol_print_error('','PHP version must be 5.3+');
|
||||
/*
|
||||
// Method 2 (does not include daylight, not supported by adodb)
|
||||
|
||||
@@ -4542,7 +4542,7 @@ function utf8_check($str)
|
||||
|
||||
|
||||
/**
|
||||
* Return an UTF-8 string encoded into OS filesystem encoding. This function is used to define
|
||||
* Return a string encoded into OS filesystem encoding. This function is used to define
|
||||
* value to pass to filesystem PHP functions.
|
||||
*
|
||||
* @param string $str String to encode (UTF-8)
|
||||
|
||||
@@ -138,6 +138,8 @@ class Product extends CommonObject
|
||||
var $stats_commande=array();
|
||||
var $stats_contrat=array();
|
||||
var $stats_facture=array();
|
||||
var $stats_commande_fournisseur=array();
|
||||
|
||||
var $multilangs=array();
|
||||
|
||||
//! Taille de l'image
|
||||
@@ -3311,31 +3313,6 @@ class Product extends CommonObject
|
||||
else return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build thumb
|
||||
*
|
||||
* @param string $file Chemin du fichier d'origine
|
||||
* @return void
|
||||
*/
|
||||
function add_thumb($file)
|
||||
{
|
||||
global $maxwidthsmall, $maxheightsmall, $maxwidthmini, $maxheightmini, $quality;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT .'/core/lib/images.lib.php'; // This define also $maxwidthsmall, $quality, ...
|
||||
|
||||
$file_osencoded=dol_osencode($file);
|
||||
if (file_exists($file_osencoded))
|
||||
{
|
||||
// Create small thumbs for company (Ratio is near 16/9)
|
||||
// Used on logon for example
|
||||
$imgThumbSmall = vignette($file, $maxwidthsmall, $maxheightsmall, '_small', $quality);
|
||||
|
||||
// Create mini thumbs for company (Ratio is near 16/9)
|
||||
// Used on menu or for setup page for example
|
||||
$imgThumbMini = vignette($file, $maxwidthmini, $maxheightmini, '_mini', $quality);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Affiche la premiere photo du produit
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user