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