diff --git a/ChangeLog b/ChangeLog index 798f3ef91f4..87e7f4ba18b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -151,6 +151,9 @@ Dolibarr better: no more required, were also removed. Use this new one if you were using one of them. - The trigger that activate or close a contract line is run on a contract line, not on contract. +Dolibarr 5.0 was frozen before PHP 7.1 was released. Unit tests are successful on PHP 7.1 but we don't have enough +feedback to confirm all application is compatible. Current officiel supported PHP versions are PHP 5.3 to 7.0. + ***** ChangeLog for 4.0.3 to 4.0.2 ***** FIX: #5853 $conf->global->$calc==0 || $conf->global->$calc==1 diff --git a/htdocs/core/lib/bank.lib.php b/htdocs/core/lib/bank.lib.php index 74078740080..1df180452c3 100644 --- a/htdocs/core/lib/bank.lib.php +++ b/htdocs/core/lib/bank.lib.php @@ -197,9 +197,10 @@ function checkBanForAccount($account) $rib = strtr($rib, "abcdefghijklmnopqrstuvwxyz", "12345678912345678923456789"); // Separation du rib en 3 groupes de 7 + 1 groupe de 2. // Multiplication de chaque groupe par les coef du tableau +var_dump($rib); for ($i = 0, $s = 0; $i < 3; $i++) { $code = substr($rib, 7 * $i, 7); - $s += (0 + $code) * $coef[$i]; + $s += (0 + (int) $code) * $coef[$i]; } // Soustraction du modulo 97 de $s a 97 pour obtenir la cle $cle_rib = 97 - ($s % 97); diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index a0d61144582..cd897071551 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -175,7 +175,7 @@ function convertSecondToTime($iSecond, $format='all', $lengthOfDay=86400, $lengt $sTime=''; $sDay=0; - $sWeek=''; + $sWeek=0; if ($iSecond >= $lengthOfDay) { @@ -218,7 +218,7 @@ function convertSecondToTime($iSecond, $format='all', $lengthOfDay=86400, $lengt } 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') { diff --git a/htdocs/core/lib/price.lib.php b/htdocs/core/lib/price.lib.php index e94c0c7dcfe..2fe652f6ac9 100644 --- a/htdocs/core/lib/price.lib.php +++ b/htdocs/core/lib/price.lib.php @@ -80,6 +80,7 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt $result=array(); // Clean parameters + if (empty($info_bits)) $info_bits=0; if (empty($txtva)) $txtva=0; if (empty($seller) || ! is_object($seller)) { diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index c51c99ff1ff..e69fd312f45 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -282,7 +282,7 @@ class Holiday extends CommonObject $sql = "SELECT"; $sql.= " cp.rowid,"; - + $sql.= " cp.fk_user,"; $sql.= " cp.date_create,"; $sql.= " cp.description,"; @@ -869,7 +869,7 @@ class Holiday extends CommonObject { $sql = "SELECT value"; $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); $result = $this->db->query($sql); @@ -883,7 +883,7 @@ class Holiday extends CommonObject if ($createifnotfound) { $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); if ($result) { @@ -948,7 +948,7 @@ class Holiday extends CommonObject $nbUser = count($users); $sql = "UPDATE ".MAIN_DB_PREFIX."holiday_config SET"; - $sql.= " value = '".$newdateforlastupdate."'"; + $sql.= " value = '".$this->db->escape($newdateforlastupdate)."'"; $sql.= " WHERE name = 'lastUpdate'"; $result = $this->db->query($sql); @@ -1635,6 +1635,7 @@ class Holiday extends CommonObject $this->date_fin=dol_now()+(24*3600); $this->fk_validator=1; $this->halfday=0; + $this->fk_type=1; } } diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index fd3445375a9..9248a07469c 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1909,10 +1909,9 @@ class Societe extends CommonObject if (! empty($conf->accounting->enabled) && $this->fournisseur) $label.= '
' . $langs->trans('SupplierAccountancyCode') . ': '. $this->code_compta_fournisseur; - if (! empty($this->logo)) + if (! empty($this->logo) && class_exists('Form')) { $label.= '
'; - //if (! is_object($form)) $form = new Form($db); $label.= Form::showphoto('societe', $this, 80, 0, 0, 'photowithmargin', 'mini'); $label.= '
'; } diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 8b5ab723bd3..e7614f06f9d 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1090,9 +1090,9 @@ if (($action == 'create') || ($action == 'adduserldap')) // Categories if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) { - print '' . fieldLabel( 'Categories', 'usercats' ) . ''; - $cate_arbo = $form->select_all_categories( Categorie::TYPE_USER, null, 'parent', null, null, 1 ); - print $form->multiselectarray( 'usercats', $cate_arbo, GETPOST( 'usercats', 'array' ), null, null, null, + print '' . fieldLabel('Categories', 'usercats') . ''; + $cate_arbo = $form->select_all_categories('user', null, 'parent', null, null, 1); + print $form->multiselectarray('usercats', $cate_arbo, GETPOST('usercats', 'array'), null, null, null, null, '90%' ); print ""; } diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index ceec023c72a..dc5b33d9246 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -330,7 +330,7 @@ class User extends CommonObject } else { - $this->error=$this->db->error(); + $this->error=$this->db->lasterror(); return -1; } diff --git a/test/phpunit/MarginsLibTest.php b/test/phpunit/MarginsLibTest.php index 7c2e8f68ef6..e6f130d2e3b 100644 --- a/test/phpunit/MarginsLibTest.php +++ b/test/phpunit/MarginsLibTest.php @@ -138,7 +138,6 @@ class MarginsLibTest extends PHPUnit_Framework_TestCase $this->assertEquals(20,$result[2]); $result=getMarginInfos(10, 10, 19.6, 0, 0, 0, 8); - var_dump($result); print __METHOD__." result[0]=".$result[0]."\n"; $this->assertEquals(8,$result[0]); print __METHOD__." result[1]=".$result[1]."\n"; diff --git a/test/phpunit/WebservicesUserTest.php b/test/phpunit/WebservicesUserTest.php index 9be97167104..78d3d311fe0 100644 --- a/test/phpunit/WebservicesUserTest.php +++ b/test/phpunit/WebservicesUserTest.php @@ -154,7 +154,7 @@ class WebservicesUserTest extends PHPUnit_Framework_TestCase // Test URL $result=''; - $parameters = array('authentication'=>$authentication,'ref'=>'admin'); + $parameters = array('authentication'=>$authentication,'id'=>0,'ref'=>'admin'); print __METHOD__."Call method ".$WS_METHOD."\n"; try { $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); @@ -177,11 +177,11 @@ class WebservicesUserTest extends PHPUnit_Framework_TestCase } print __METHOD__." result=".$result."\n"; - $this->assertEquals('OK',$result['result']['result_code']); + $this->assertEquals('OK', $result['result']['result_code'], 'Test on ref admin'); // Test URL $result=''; - $parameters = array('authentication'=>$authentication,'ref'=>'refthatdoesnotexists'); + $parameters = array('authentication'=>$authentication,'id'=>0,'ref'=>'refthatdoesnotexists'); print __METHOD__."Call method ".$WS_METHOD."\n"; try { $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); @@ -200,7 +200,7 @@ class WebservicesUserTest extends PHPUnit_Framework_TestCase } print __METHOD__." result=".$result."\n"; - $this->assertEquals('NOT_FOUND',$result['result']['result_code']); + $this->assertEquals('NOT_FOUND', $result['result']['result_code'], 'Test on ref that does not exists'); return $result; }