Fix several running time errors
This commit is contained in:
parent
36bd63c1a7
commit
ac80d4057d
@ -175,7 +175,7 @@ function convertSecondToTime($iSecond, $format='all', $lengthOfDay=86400, $lengt
|
|||||||
|
|
||||||
$sTime='';
|
$sTime='';
|
||||||
$sDay=0;
|
$sDay=0;
|
||||||
$sWeek='';
|
$sWeek=0;
|
||||||
|
|
||||||
if ($iSecond >= $lengthOfDay)
|
if ($iSecond >= $lengthOfDay)
|
||||||
{
|
{
|
||||||
@ -218,7 +218,7 @@ function convertSecondToTime($iSecond, $format='all', $lengthOfDay=86400, $lengt
|
|||||||
}
|
}
|
||||||
if ($format == 'allhourmin')
|
if ($format == 'allhourmin')
|
||||||
{
|
{
|
||||||
return sprintf("%02d",($sWeek*$lengthOfWeek*24 + $sDay*24 + (int) floor($iSecond/3600))).':'.sprintf("%02d",((int) floor(($iSecond % 3600)/60)));
|
return sprintf("%02d",($sWeek*$lengthOfWeek*24 + $sDay*24 + (int) floor($iSecond/3600))).':'.sprintf("%02d",((int) floor(($iSecond % 3600)/60)));
|
||||||
}
|
}
|
||||||
if ($format == 'allhour')
|
if ($format == 'allhour')
|
||||||
{
|
{
|
||||||
|
|||||||
@ -80,6 +80,7 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
|
|||||||
$result=array();
|
$result=array();
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
|
if (empty($info_bits)) $info_bits=0;
|
||||||
if (empty($txtva)) $txtva=0;
|
if (empty($txtva)) $txtva=0;
|
||||||
if (empty($seller) || ! is_object($seller))
|
if (empty($seller) || ! is_object($seller))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -127,6 +127,7 @@ class Holiday extends CommonObject
|
|||||||
// Check parameters
|
// Check parameters
|
||||||
if (empty($this->fk_user) || ! is_numeric($this->fk_user) || $this->fk_user < 0) { $this->error="ErrorBadParameter"; return -1; }
|
if (empty($this->fk_user) || ! is_numeric($this->fk_user) || $this->fk_user < 0) { $this->error="ErrorBadParameter"; return -1; }
|
||||||
if (empty($this->fk_validator) || ! is_numeric($this->fk_validator) || $this->fk_validator < 0) { $this->error="ErrorBadParameter"; return -1; }
|
if (empty($this->fk_validator) || ! is_numeric($this->fk_validator) || $this->fk_validator < 0) { $this->error="ErrorBadParameter"; return -1; }
|
||||||
|
if (empty($this->fk_type) || ! is_numeric($this->fk_type) || $this->fk_type < 0) { $this->error="ErrorBadParameter"; return -1; }
|
||||||
|
|
||||||
// Insert request
|
// Insert request
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."holiday(";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."holiday(";
|
||||||
@ -150,7 +151,7 @@ class Holiday extends CommonObject
|
|||||||
$sql.= " ".$this->halfday.",";
|
$sql.= " ".$this->halfday.",";
|
||||||
$sql.= " '1',";
|
$sql.= " '1',";
|
||||||
$sql.= " '".$this->fk_validator."',";
|
$sql.= " '".$this->fk_validator."',";
|
||||||
$sql.= " '".$this->fk_type."',";
|
$sql.= " ".$this->fk_type.",";
|
||||||
$sql.= " ".$user->id.",";
|
$sql.= " ".$user->id.",";
|
||||||
$sql.= " ".$conf->entity;
|
$sql.= " ".$conf->entity;
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
@ -868,7 +869,7 @@ class Holiday extends CommonObject
|
|||||||
{
|
{
|
||||||
$sql = "SELECT value";
|
$sql = "SELECT value";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."holiday_config";
|
$sql.= " FROM ".MAIN_DB_PREFIX."holiday_config";
|
||||||
$sql.= " WHERE name = '".$name."'";
|
$sql.= " WHERE name = '".$this->db->escape($name)."'";
|
||||||
|
|
||||||
dol_syslog(get_class($this).'::getConfCP name='.$name.' createifnotfound='.$createifnotfound, LOG_DEBUG);
|
dol_syslog(get_class($this).'::getConfCP name='.$name.' createifnotfound='.$createifnotfound, LOG_DEBUG);
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
@ -882,7 +883,7 @@ class Holiday extends CommonObject
|
|||||||
if ($createifnotfound)
|
if ($createifnotfound)
|
||||||
{
|
{
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."holiday_config(name, value)";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."holiday_config(name, value)";
|
||||||
$sql.= " VALUES('".$name."', '".$createifnotfound."')";
|
$sql.= " VALUES('".$this->db->escape($name)."', '".$this->db->escape($createifnotfound)."')";
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
@ -947,7 +948,7 @@ class Holiday extends CommonObject
|
|||||||
$nbUser = count($users);
|
$nbUser = count($users);
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."holiday_config SET";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."holiday_config SET";
|
||||||
$sql.= " value = '".$newdateforlastupdate."'";
|
$sql.= " value = '".$this->db->escape($newdateforlastupdate)."'";
|
||||||
$sql.= " WHERE name = 'lastUpdate'";
|
$sql.= " WHERE name = 'lastUpdate'";
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
|
|
||||||
@ -1634,6 +1635,7 @@ class Holiday extends CommonObject
|
|||||||
$this->date_fin=dol_now()+(24*3600);
|
$this->date_fin=dol_now()+(24*3600);
|
||||||
$this->fk_validator=1;
|
$this->fk_validator=1;
|
||||||
$this->halfday=0;
|
$this->halfday=0;
|
||||||
|
$this->fk_type=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -138,7 +138,6 @@ class MarginsLibTest extends PHPUnit_Framework_TestCase
|
|||||||
$this->assertEquals(20,$result[2]);
|
$this->assertEquals(20,$result[2]);
|
||||||
|
|
||||||
$result=getMarginInfos(10, 10, 19.6, 0, 0, 0, 8);
|
$result=getMarginInfos(10, 10, 19.6, 0, 0, 0, 8);
|
||||||
var_dump($result);
|
|
||||||
print __METHOD__." result[0]=".$result[0]."\n";
|
print __METHOD__." result[0]=".$result[0]."\n";
|
||||||
$this->assertEquals(8,$result[0]);
|
$this->assertEquals(8,$result[0]);
|
||||||
print __METHOD__." result[1]=".$result[1]."\n";
|
print __METHOD__." result[1]=".$result[1]."\n";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user