From 0a0bb92689bed8c9d4ea13729ab5b5810eddbb83 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 6 Mar 2021 11:37:23 +0100 Subject: [PATCH] Fix phpcs --- htdocs/core/class/commonobject.class.php | 6 +- htdocs/core/tpl/extrafields_view.tpl.php | 3 +- test/phpunit/FactureRecTest.php | 106 +++++++++++------------ 3 files changed, 56 insertions(+), 59 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index f4bad5e5167..f80fcbce957 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -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; diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index 38fc565ac0e..e43548afc3f 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -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'); diff --git a/test/phpunit/FactureRecTest.php b/test/phpunit/FactureRecTest.php index a6e91695782..1fb62ecfd0e 100644 --- a/test/phpunit/FactureRecTest.php +++ b/test/phpunit/FactureRecTest.php @@ -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'))