Fix phpcs

This commit is contained in:
Laurent Destailleur 2021-03-06 11:37:23 +01:00
parent 6b09452104
commit 0a0bb92689
3 changed files with 56 additions and 59 deletions

View File

@ -7426,11 +7426,9 @@ abstract class CommonObject
}
$value = (GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix)) ? dol_mktime(12, 0, 0, GETPOST($keyprefix.'options_'.$key.$keysuffix."month", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."day", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."year", 'int', 3)) : $datenotinstring;
}
if (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('datetime')))
{
if (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('datetime'))) {
$datenotinstring = $this->array_options['options_'.$key];
if (!is_numeric($this->array_options['options_'.$key])) // For backward compatibility
{
if (!is_numeric($this->array_options['options_'.$key])) { // For backward compatibility
$datenotinstring = $this->db->jdate($datenotinstring);
}
$value = (GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix)) ? dol_mktime(GETPOST($keyprefix.'options_'.$key.$keysuffix."hour", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."min", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."sec", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."month", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."day", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."year", 'int', 3), 'tzuserrel') : $datenotinstring;

View File

@ -213,8 +213,7 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element]
if (in_array($extrafields->attributes[$object->table_element]['type'][$tmpkeyextra], array('datetime'))) {
$datenotinstring = $object->array_options['options_'.$tmpkeyextra];
// print 'X'.$object->array_options['options_' . $tmpkeyextra].'-'.$datenotinstring.'x';
if (!is_numeric($object->array_options['options_'.$tmpkeyextra])) // For backward compatibility
{
if (!is_numeric($object->array_options['options_'.$tmpkeyextra])) { // For backward compatibility
$datenotinstring = $db->jdate($datenotinstring);
}
//print 'x'.$object->array_options['options_' . $tmpkeyextra].'-'.$datenotinstring.' - '.dol_print_date($datenotinstring, 'dayhour');

View File

@ -126,14 +126,14 @@ class FactureRecTest extends PHPUnit\Framework\TestCase
print __METHOD__."\n";
}
/**
* testFactureRecCreate
*
* @return int
*/
public function testFactureRecCreate()
{
global $conf,$user,$langs,$db;
/**
* testFactureRecCreate
*
* @return int
*/
public function testFactureRecCreate()
{
global $conf,$user,$langs,$db;
$conf=$this->savconf;
$user=$this->savuser;
@ -147,61 +147,61 @@ class FactureRecTest extends PHPUnit\Framework\TestCase
print __METHOD__." result=".$result."\n";
$localobject=new FactureRec($this->savdb);
$localobject->initAsSpecimen();
$result = $localobject->create($user, $localobjectinv->id);
$localobject->initAsSpecimen();
$result = $localobject->create($user, $localobjectinv->id);
print __METHOD__." result=".$result."\n";
$this->assertGreaterThan(0, $result, 'Create recurring invoice from common invoice');
print __METHOD__." result=".$result."\n";
$this->assertGreaterThan(0, $result, 'Create recurring invoice from common invoice');
return $result;
}
return $result;
}
/**
* testFactureRecFetch
*
* @param int $id Id of created recuriing invoice
* @return int
*
/**
* testFactureRecFetch
*
* @param int $id Id of created recuriing invoice
* @return int
*
* @depends testFactureRecCreate
* The depends says test is run only if previous is ok
*/
public function testFactureRecFetch($id)
{
global $conf,$user,$langs,$db;
$conf=$this->savconf;
$user=$this->savuser;
$langs=$this->savlangs;
$db=$this->savdb;
* The depends says test is run only if previous is ok
*/
public function testFactureRecFetch($id)
{
global $conf,$user,$langs,$db;
$conf=$this->savconf;
$user=$this->savuser;
$langs=$this->savlangs;
$db=$this->savdb;
$localobject=new FactureRec($this->savdb);
$result = $localobject->fetch($id);
$localobject=new FactureRec($this->savdb);
$result = $localobject->fetch($id);
print __METHOD__." result=".$result."\n";
$this->assertGreaterThan(0, $result);
return $result;
}
print __METHOD__." result=".$result."\n";
$this->assertGreaterThan(0, $result);
return $result;
}
/**
* Edit an object to test updates
*
* @param FactureRec $localobject Object Facture rec
* @return void
*/
public function changeProperties(&$localobject)
{
$localobject->note_private='New note';
//$localobject->note='New note after update';
}
/**
* Edit an object to test updates
*
* @param FactureRec $localobject Object Facture rec
* @return void
*/
public function changeProperties(&$localobject)
{
$localobject->note_private='New note';
//$localobject->note='New note after update';
}
/**
* Compare all public properties values of 2 objects
*
* @param Object $oA Object operand 1
* @param Object $oB Object operand 2
* @param boolean $ignoretype False will not report diff if type of value differs
* @param array $fieldstoignorearray Array of fields to ignore in diff
/**
* Compare all public properties values of 2 objects
*
* @param Object $oA Object operand 1
* @param Object $oB Object operand 2
* @param boolean $ignoretype False will not report diff if type of value differs
* @param array $fieldstoignorearray Array of fields to ignore in diff
* @return array Array with differences
*/
public function objCompare($oA, $oB, $ignoretype = true, $fieldstoignorearray = array('id'))