From b3674eaa7bf070b95c449ff0977bddccebe72679 Mon Sep 17 00:00:00 2001 From: sparkyx Date: Sun, 8 Jan 2023 20:22:37 +0100 Subject: [PATCH] Fix bug : new document w/o description Change print_r by var_export Improve PHPUNIT --- include/class/contact.class.php | 2 +- include/lib/ac_common.php | 8 ++++---- include/lib/http_input.class.php | 2 +- include/lib/manage_table_sql.class.php | 2 +- include/template/follow_up-display.php | 11 +++++++++-- unit-test/bootstrap.php.example | 2 ++ 6 files changed, 18 insertions(+), 9 deletions(-) diff --git a/include/class/contact.class.php b/include/class/contact.class.php index efbce2378..ad85550fc 100644 --- a/include/class/contact.class.php +++ b/include/class/contact.class.php @@ -167,7 +167,7 @@ class contact extends Fiche } $ps_sql .= $limit ; if (DEBUGNOALYSS > 1) { - print_r("Contact::fetch ($ps_sql)"); + var_export("Contact::fetch ($ps_sql)"); } return $this->cn->get_array($ps_sql); } diff --git a/include/lib/ac_common.php b/include/lib/ac_common.php index ad7629754..a2659f714 100644 --- a/include/lib/ac_common.php +++ b/include/lib/ac_common.php @@ -1403,9 +1403,9 @@ function is_msie() */ function record_log($p_message) { - error_log("noalyss".print_r($p_message,true),0); - error_log("noalyss GET [".json_encode($_GET)."]"); - error_log("_POST [".json_encode($_POST)."]",0); + error_log("noalyss".var_export($p_message,true),0); + error_log("noalyss GET [".json_encode($_GET,0,10)."]"); + error_log("_POST [".json_encode($_POST,0,10)."]",0); } if(!function_exists('tracedebug')) { function tracedebug($file,$var, $label = NULL) { @@ -1685,4 +1685,4 @@ function linkTo($p_url) } else { return $p_url; } -} \ No newline at end of file +} diff --git a/include/lib/http_input.class.php b/include/lib/http_input.class.php index 56a3676c0..535573f4b 100644 --- a/include/lib/http_input.class.php +++ b/include/lib/http_input.class.php @@ -47,7 +47,7 @@ class HttpInput } public function __toString(): string { - return "http_input".print_r($this,true); + return "http_input".var_export($this,true); } public function get_array() { diff --git a/include/lib/manage_table_sql.class.php b/include/lib/manage_table_sql.class.php index 37c9f98f0..ba52307db 100644 --- a/include/lib/manage_table_sql.class.php +++ b/include/lib/manage_table_sql.class.php @@ -1530,7 +1530,7 @@ function check() } /** - * @brief usually contain a link and calls another page, it must overriden + * @brief usually contain a link and calls another page, it must be overriden * @param array $p_row is the current database row * @return void */ diff --git a/include/template/follow_up-display.php b/include/template/follow_up-display.php index f2230a7a9..807dbc2ed 100644 --- a/include/template/follow_up-display.php +++ b/include/template/follow_up-display.php @@ -308,8 +308,15 @@ function small(p_id_textarea){ echo '
'; echo $description->input(); echo '
'; - } else { - // no description and no comment + } elseif ( $p_view != 'READ' ) { + // no description and no comment it is a new document + + echo h2(_("Description")); + $description->set_enrichText('enrich'); + $description->style='style="height:250px;width:90%;"'; + echo '
'; + echo $description->input(); + echo '
'; } diff --git a/unit-test/bootstrap.php.example b/unit-test/bootstrap.php.example index c9dad86d8..68ba8c025 100644 --- a/unit-test/bootstrap.php.example +++ b/unit-test/bootstrap.php.example @@ -19,6 +19,8 @@ */ // Copyright Author Dany De Bontridder danydb@aevalys.eu +define ('NOALYSS_URL','PHPUNIT'); +define ('DIRTEST',__DIR__); /** * constant.php contains a autoloader for classes