From 6e403e6ce0097af91ba420b2f679c6d55d3b5a52 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 7 Dec 2020 18:29:14 +0100 Subject: [PATCH] Fix warnings --- htdocs/comm/propal/class/propal.class.php | 12 ++++++++++-- htdocs/core/class/commonobject.class.php | 2 +- test/phpunit/PropalTest.php | 6 +++--- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index c761f8b3321..dfbae271881 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1099,7 +1099,7 @@ class Propal extends CommonObject if ($this->id) { $this->ref = '(PROV'.$this->id.')'; - $sql = 'UPDATE '.MAIN_DB_PREFIX."propal SET ref='".$this->db->escape($this->ref)."' WHERE rowid=".$this->id; + $sql = 'UPDATE '.MAIN_DB_PREFIX."propal SET ref='".$this->db->escape($this->ref)."' WHERE rowid=".((int) $this->id); dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql = $this->db->query($sql); @@ -1111,7 +1111,7 @@ class Propal extends CommonObject } // Add object linked - if (!$error && $this->id && is_array($this->linked_objects) && !empty($this->linked_objects)) + if (!$error && $this->id && !empty($this->linked_objects) && is_array($this->linked_objects)) { foreach ($this->linked_objects as $origin => $tmp_origin_id) { @@ -3753,7 +3753,10 @@ class PropaleLigne extends CommonObjectLine public $product_type = Product::TYPE_PRODUCT; public $qty; + public $tva_tx; + public $vat_src_code; + public $subprice; public $remise_percent; public $fk_remise_except; @@ -3805,6 +3808,11 @@ class PropaleLigne extends CommonObjectLine * @see $product_label */ public $libelle; + /** + * @deprecated + * @see $product_label + */ + public $label; /** * Product label * @var string diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 33ac1aba696..6ecdfb93bb5 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3161,7 +3161,7 @@ abstract class CommonObject $this->multicurrency_total_ttc += isset($this->revenuestamp) ? ($this->revenuestamp * $multicurrency_tx) : 0; // Situations totals - if ($this->situation_cycle_ref && $this->situation_counter > 1 && method_exists($this, 'get_prev_sits') && $this->type != $this::TYPE_CREDIT_NOTE) + if (!empty($this->situation_cycle_ref) && $this->situation_counter > 1 && method_exists($this, 'get_prev_sits') && $this->type != $this::TYPE_CREDIT_NOTE) { $prev_sits = $this->get_prev_sits(); diff --git a/test/phpunit/PropalTest.php b/test/phpunit/PropalTest.php index 068fb53b052..ea678e8df34 100644 --- a/test/phpunit/PropalTest.php +++ b/test/phpunit/PropalTest.php @@ -190,11 +190,11 @@ class PropalTest extends PHPUnit\Framework\TestCase $langs=$this->savlangs; $db=$this->savdb; - $localobject->note_private='New note private after update'; - $result=$localobject->update($user); + $localobject->note_private = 'New note private after update'; + $result = $localobject->update($user); $this->assertLessThan($result, 0); - print __METHOD__." id=".$id." result=".$result."\n"; + print __METHOD__." id=".$localobject->id." result=".$result."\n"; return $localobject; }