From c63d4b462a68346e4e150ce6976ad503e337bfa9 Mon Sep 17 00:00:00 2001 From: sparkyx Date: Sat, 25 May 2024 16:39:10 +0200 Subject: [PATCH] Bug : ajax followup list --- include/ajax/ajax_follow_up.php | 5 +++-- include/template/follow_up-view_list.php | 3 ++- unit-test/include/class/followupTest.php | 22 ++++++++++++++++++++++ 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/include/ajax/ajax_follow_up.php b/include/ajax/ajax_follow_up.php index 3fc05737d..bdb035952 100644 --- a/include/ajax/ajax_follow_up.php +++ b/include/ajax/ajax_follow_up.php @@ -149,8 +149,9 @@ if ($op =="view_followup_card") $div=$http->get("div"); $card=new Fiche($cn,$http->get("f_id","number")); echo HtmlInput::title_box("Suivi ".h($card->strAttribut(ATTR_DEF_NAME)),$div); - $query=Follow_Up::create_query($cn,["qcode"=>$card->strAttribut(ATTR_DEF_QUICKCODE), - 'closed_action'=>true]); + + $query="where true=true ".Follow_Up::create_query($cn,["qcode"=>$card->strAttribut(ATTR_DEF_QUICKCODE), + 'closed_action'=>true]); $followup=new Follow_Up($cn); echo $followup->view_list($query,' limit 25'); echo \HtmlInput::button_close($div); diff --git a/include/template/follow_up-view_list.php b/include/template/follow_up-view_list.php index e44a7e9ac..8706109a2 100644 --- a/include/template/follow_up-view_list.php +++ b/include/template/follow_up-view_list.php @@ -22,6 +22,7 @@ * \brief display list of followup */ global $cn; +$cn=$this->db; $array=$cn->get_array($sql); if (empty ($array)) { echo_warning("Aucun suivi "); @@ -62,7 +63,7 @@ echo \HtmlInput::filter_table("view_list_tb", "0,1,2,3,4,5", 1); - + diff --git a/unit-test/include/class/followupTest.php b/unit-test/include/class/followupTest.php index faece9a2f..6c01c66f4 100644 --- a/unit-test/include/class/followupTest.php +++ b/unit-test/include/class/followupTest.php @@ -119,4 +119,26 @@ class FollowupTest extends TestCase ob_end_clean(); $this->assertStringContainsString("COURRI6-1", $content); } + /** + * @testdox test the output of view_followup_card + * @covers Follow_Up::view_list,Follow_Up::create_query + * @backupGlobals enabled + */ + function testAjax_View_list() + { + global $g_user; + $g_user=new Noalyss_User($this->connection); + + $CARD_ID=22; + $get=array( "op"=>"view_followup_card",'f_id'=>22,'gDossier'=>DOSSIER,'div'=>'unit_test'); + $_REQUEST=$_POST=$_GET=$get; + ob_start(); + require_once NOALYSS_HOME.'/ajax_misc.php'; + $content=ob_get_contents(); + ob_end_clean(); + $this->assertStringContainsString("BONDEC3-1", $content); + $this->assertTrue(mb_strlen($content)==1613,"error result not valid $content size = ".mb_strlen($content)); + + + } } \ No newline at end of file