diff --git a/include/class/follow_up.class.php b/include/class/follow_up.class.php
index bc5bf8f53..2141cc2af 100644
--- a/include/class/follow_up.class.php
+++ b/include/class/follow_up.class.php
@@ -714,8 +714,9 @@ class Follow_Up
// 8
$table->add(_('Dernier comm.'), $url, 'order by last_comment_date nulls last', 'order by last_comment_date desc nulls last', 'dca', 'dcd');
// 9
- $table->add(_('Priorité'), $url, 'order by last_comment_date nulls last', 'order by last_comment_date desc nulls last', 'dca', 'dcd');
- $ord=(!isset($_GET['ord']))?"dcd":$_GET['ord'];
+ $table->add(_('Priorité'), $url, 'order by ag_priority ', 'order by ag_priority desc ', 'pra', 'prd');
+ $http=new HttpInput();
+ $ord=$http->get("ord","string","dcd");
$sort=$table->get_sql_order($ord);
if (noalyss_strlentrim($p_filter)!=0)
@@ -753,8 +754,7 @@ class Follow_Up
$r.='
'.$table->get_header(8).' | ';
$r.=''.$table->get_header(2).' | ';
$r.=''.$table->get_header(5).' | ';
-// $r.=''.$table->get_header(1).' | ';
- $r.=th('Priorité','style="width:5.57%"');
+ $r.=''.$table->get_header(9).' | ';
$r.=''.$table->get_header(6).' | ';
$r.=''.$table->get_header(7).' | ';
$r.=''.$table->get_header(3).' | ';
@@ -842,14 +842,6 @@ class Follow_Up
}
$r.="";
$r.="".$href.h($row['dest']).''." | ";
-
-
-
-
-
-
-
-
$r.="";
}
@@ -1430,18 +1422,18 @@ class Follow_Up
if ($p_array==null) $p_array=$_GET;
$http=new HttpInput();
$http->set_array($p_array);
- $search_docid=0; // search for a document
+
$action_query="";
$ag_state=""; //extract('action_query');
// if a query is request build the sql stmt
@@ -1591,7 +1583,7 @@ class Follow_Up
$p_search=self::create_query($this->db, $p_array);
$sql="
- select ag_id,
+ select ag.ag_id,
to_char(ag_timestamp,'DD.MM.YYYY') as my_date,
to_char(ag_remind_date,'DD.MM.YYYY') as my_remind,
to_char(coalesce((select max(agc_date) from action_gestion_comment as agc where agc.ag_id=ag_id),ag_timestamp),'DD.MM.YY') as last_comment,
diff --git a/unit-test/include/class/followupTest.php b/unit-test/include/class/followupTest.php
new file mode 100644
index 000000000..faece9a2f
--- /dev/null
+++ b/unit-test/include/class/followupTest.php
@@ -0,0 +1,122 @@
+
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ *
+ * Author : Dany De Bontridder danydb@noalyss.eu $(DATE)
+ */
+
+/**
+ * @file
+ * @brief noalyss
+ */
+
+use PHPUnit\Framework\TestCase;
+
+require DIRTEST . '/global.php';
+
+/**
+ * @testdox Class followupTest : used for ...
+ * @backupGlobals enabled
+ * @coversDefaultClass
+ */
+class FollowupTest extends TestCase
+{
+
+ /**
+ * @var Fiche
+ */
+ protected $object;
+ protected $connection;
+
+ /**
+ * Sets up the fixture, for example, opens a network connection.
+ * This method is called before a test method is executed.
+ */
+ protected function setUp(): void
+ {
+
+ $this->connection=\Dossier::connect();
+ $this->object=new Follow_Up($this->connection);
+ }
+
+ /**
+ * @testdox create query search by AG_ID
+ * @covers Follow_Up::create_query
+ * @backupGlobals enabled
+ */
+ function testSearch_Ag_ID()
+ {
+ global $g_user;
+ $g_user=new Noalyss_User($this->connection);
+ $query=Follow_Up::create_query($this->connection,array("ag_id"=>2));
+ $sql=Follow_Up::SQL_list_action()." where 1=1 $query";
+ $array=$this->connection->get_array($sql);
+ $this->assertEquals(2,$array[0]['ag_id']);
+ $this->assertEquals('COURRI6-1',$array[0]['ag_ref']);
+
+ }
+ /**
+ * @testdox create query search by Action_Query
+ * @covers Follow_Up::create_query
+ * @backupGlobals enabled
+ */
+ function testSearch_action_query()
+ {
+ global $g_user;
+ $g_user=new Noalyss_User($this->connection);
+ $query=Follow_Up::create_query($this->connection,array("action_query"=>'test'));
+ $sql=Follow_Up::SQL_list_action()." where 1=1 $query";
+ $array=$this->connection->get_array($sql);
+ $this->assertEquals(2, count($array));
+ $this->assertEquals(1,$array[0]['ag_id']);
+ $this->assertEquals('BONDEC3-1',$array[0]['ag_ref']);
+
+ }
+ /**
+ * @testdox create query search by QCode
+ * @covers Follow_Up::create_query
+ * @backupGlobals enabled
+ */
+ function testSearch_qcode()
+ {
+ global $g_user;
+ $g_user=new Noalyss_User($this->connection);
+ $query=Follow_Up::create_query($this->connection,array("qcode"=>'CLIENT1'));
+ $sql=Follow_Up::SQL_list_action()." where 1=1 $query";
+ $array=$this->connection->get_array($sql);
+ $this->assertEquals(1,$array[0]['ag_id']);
+ $this->assertEquals('BONDEC3-1',$array[0]['ag_ref']);
+ }
+
+ /**
+ * @testdox export and search with ag_id
+ * @covers Follow_Up::export_csv,Follow_Up::create_query
+ * @backupGlobals enabled
+ */
+ function testExport_CSV_Ag_ID()
+ {
+ global $g_user;
+ $g_user=new Noalyss_User($this->connection);
+ ob_start();
+ $this->object->export_csv(["ag_id"=>2]);
+ $content=ob_get_contents();
+ ob_end_clean();
+ $this->assertStringContainsString("COURRI6-1", $content);
+ }
+}
\ No newline at end of file