From bc50a2996e5913d40cd8c0396c4e8a8ad91899a8 Mon Sep 17 00:00:00 2001 From: sparkyx Date: Sun, 16 Jul 2023 18:00:40 +0200 Subject: [PATCH] PHP8.1 compatibility --- include/class/database.class.php | 4 ++-- include/lib/itext.class.php | 2 +- include/lib/table_data_sql.class.php | 2 +- include/template/ledger_detail_ach.php | 2 +- include/template/ledger_detail_ven.php | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/class/database.class.php b/include/class/database.class.php index deee87aff..320fb3724 100644 --- a/include/class/database.class.php +++ b/include/class/database.class.php @@ -39,7 +39,7 @@ class Database extends DatabaseCore function __construct($p_database_id = 0, $p_type = 'dos') { - if (IsNumber($p_database_id) == false || strlen($p_database_id) > 10) + if (IsNumber($p_database_id) == false || strlen($p_database_id??"") > 10) die("-->Dossier invalide [$p_database_id]"); $noalyss_user = (defined("noalyss_user")) ? noalyss_user : phpcompta_user; $password = (defined("noalyss_password")) ? noalyss_password : phpcompta_password; @@ -90,7 +90,7 @@ class Database extends DatabaseCore if (pg_num_rows($ret) != 0) { $r = pg_fetch_array($ret, 0); $old_oid = $r['jr_pj']; - if (strlen($old_oid) != 0) + if (strlen($old_oid??"") != 0) $this->lo_unlink( $old_oid); } // Load new document diff --git a/include/lib/itext.class.php b/include/lib/itext.class.php index 08f1d377d..1eb3d009b 100644 --- a/include/lib/itext.class.php +++ b/include/lib/itext.class.php @@ -108,7 +108,7 @@ class IText extends HtmlInput $extra=(isset($this->extra))?$this->extra:""; $readonly=" readonly "; - $this->value=htmlentities($this->value, ENT_COMPAT|ENT_QUOTES, "UTF-8"); + $this->value=htmlentities($this->value??"", ENT_COMPAT|ENT_QUOTES, "UTF-8"); $this->style=' class="input_text_ro" '; if ( ! isset ($this->css_size)) { diff --git a/include/lib/table_data_sql.class.php b/include/lib/table_data_sql.class.php index 2d130cf3f..25d92028d 100644 --- a/include/lib/table_data_sql.class.php +++ b/include/lib/table_data_sql.class.php @@ -179,7 +179,7 @@ abstract class Table_Data_SQL extends Data_SQL $sql=$this->build_query(); $pk=$this->primary_key; // primary cannot be null or empty - if (trim($this->$pk)==="" || $this->$pk===null) { + if (trim($this->$pk??"")==="" || $this->$pk===null) { $this->pk=-1; return false; } diff --git a/include/template/ledger_detail_ach.php b/include/template/ledger_detail_ach.php index be053c68a..6285e910d 100644 --- a/include/template/ledger_detail_ach.php +++ b/include/template/ledger_detail_ach.php @@ -67,7 +67,7 @@ global $div,$g_parameter,$cn,$access,$jr_id,$obj; value = strip_tags($obj->det->jr_comment); + $itext->value = strip_tags($obj->det->jr_comment??""); $itext->size = 40; echo td(_('Libellé')) . td($itext->input(), ' colspan="2" '); ?> diff --git a/include/template/ledger_detail_ven.php b/include/template/ledger_detail_ven.php index 7af1fb7b5..216d53a15 100644 --- a/include/template/ledger_detail_ven.php +++ b/include/template/ledger_detail_ven.php @@ -78,7 +78,7 @@ $str_anc = ""; value = strip_tags($obj->det->jr_comment); + $itext->value = strip_tags($obj->det->jr_comment??""); $itext->size = 40; echo td(_('Libellé')) . td($itext->input(), ' colspan="2" '); ?>