From f4330a11fee793ddeba03db850ecd9de2254e2cf Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 19 Mar 2024 12:48:36 +0100 Subject: [PATCH] Fix PHPdoc, casts for correct type to strcmp --- htdocs/projet/class/project.class.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index c8ded1e1b76..f1355fc7a85 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -155,7 +155,7 @@ class Project extends CommonObject public $public; //!< Tell if this is a public or private project /** - * @var float budget Amount + * @var float|string budget Amount (May need price2num) */ public $budget_amount; @@ -190,17 +190,17 @@ class Project extends CommonObject public $accept_booth_suggestions; /** - * @var float Event organization: registration price + * @var float|string Event organization: registration price (may need price2num) */ public $price_registration; /** - * @var float Event organization: booth price + * @var float|string Event organization: booth price (may need price2num) */ public $price_booth; /** - * @var float Max attendees + * @var int|string Max attendees (may be empty/need cast to iint) */ public $max_attendees; @@ -480,16 +480,16 @@ class Project extends CommonObject $sql .= ", ".($this->date_start != '' ? "'".$this->db->idate($this->date_start)."'" : 'null'); $sql .= ", ".($this->date_end != '' ? "'".$this->db->idate($this->date_end)."'" : 'null'); $sql .= ", ".(strcmp($this->opp_amount, '') ? price2num($this->opp_amount) : 'null'); - $sql .= ", ".(strcmp($this->budget_amount, '') ? price2num($this->budget_amount) : 'null'); + $sql .= ", ".(strcmp((string) $this->budget_amount, '') ? price2num($this->budget_amount) : 'null'); $sql .= ", ".($this->usage_opportunity ? 1 : 0); $sql .= ", ".($this->usage_task ? 1 : 0); $sql .= ", ".($this->usage_bill_time ? 1 : 0); $sql .= ", ".($this->usage_organize_event ? 1 : 0); $sql .= ", ".($this->accept_conference_suggestions ? 1 : 0); $sql .= ", ".($this->accept_booth_suggestions ? 1 : 0); - $sql .= ", ".(strcmp($this->price_registration, '') ? price2num($this->price_registration) : 'null'); - $sql .= ", ".(strcmp($this->price_booth, '') ? price2num($this->price_booth) : 'null'); - $sql .= ", ".(strcmp($this->max_attendees, '') ? ((int) $this->max_attendees) : 'null'); + $sql .= ", ".(strcmp((string) $this->price_registration, '') ? price2num($this->price_registration) : 'null'); + $sql .= ", ".(strcmp((string) $this->price_booth, '') ? price2num($this->price_booth) : 'null'); + $sql .= ", ".(strcmp((string) $this->max_attendees, '') ? ((int) $this->max_attendees) : 'null'); $sql .= ", ".($this->date_start_event != '' ? "'".$this->db->idate($this->date_start_event)."'" : 'null'); $sql .= ", ".($this->date_end_event != '' ? "'".$this->db->idate($this->date_end_event)."'" : 'null'); $sql .= ", ".($this->location ? "'".$this->db->escape($this->location)."'" : 'null'); @@ -605,8 +605,8 @@ class Project extends CommonObject $sql .= ", accept_conference_suggestions = ".($this->accept_conference_suggestions ? 1 : 0); $sql .= ", accept_booth_suggestions = ".($this->accept_booth_suggestions ? 1 : 0); $sql .= ", price_registration = ".(isset($this->price_registration) && strcmp($this->price_registration, '') ? price2num($this->price_registration) : "null"); - $sql .= ", price_booth = ".(isset($this->price_booth) && strcmp($this->price_booth, '') ? price2num($this->price_booth) : "null"); - $sql .= ", max_attendees = ".(strcmp($this->max_attendees, '') ? price2num($this->max_attendees) : "null"); + $sql .= ", price_booth = ".(isset($this->price_booth) && strcmp((string) $this->price_booth, '') ? price2num($this->price_booth) : "null"); + $sql .= ", max_attendees = ".(strcmp((string) $this->max_attendees, '') ? (int) $this->max_attendees : "null"); $sql .= ", date_start_event = ".($this->date_start_event != '' ? "'".$this->db->idate($this->date_start_event)."'" : 'null'); $sql .= ", date_end_event = ".($this->date_end_event != '' ? "'".$this->db->idate($this->date_end_event)."'" : 'null'); $sql .= ", location = '".$this->db->escape($this->location)."'";