Nouveau #00022980002298: detail fiche ,historique du suivi

This commit is contained in:
sparkyx 2024-02-14 18:21:32 +01:00
parent 545362569a
commit 868dbdfbd0
7 changed files with 206 additions and 19 deletions

View file

@ -344,6 +344,8 @@ $path = array(
"operation_exercice+text"=>"ajax_operation_exercice", "operation_exercice+text"=>"ajax_operation_exercice",
// transfer operation to accountancy // transfer operation to accountancy
'operation_exercice+transfer'=>"ajax_operation_exercice", 'operation_exercice+transfer'=>"ajax_operation_exercice",
// view list of followup for a card
"view_followup_card"=>"ajax_follow_up",
) ; ) ;
if (array_key_exists($op, $path)) { if (array_key_exists($op, $path)) {

View file

@ -930,6 +930,44 @@ function view_history_card(p_value, dossier, p_exercice) {
} }
); );
} }
/*!
* \brief list followup of a card
* \param p_value int fiche.f_id of the card
*/
function view_followup_card(p_value, dossier) {
layer++;
var idbox = 'detfu' + layer;
var popup = {
'id': idbox,
'cssclass': 'inner_box',
'html': loading(),
'drag': false
};
var querystring = {
'gDossier': dossier,
'f_id': p_value,
'div': idbox,
"l": layer,
"op": "view_followup_card",
};
waiting_box();
var action = new Ajax.Request(
"ajax_misc.php",
{
method: 'get',
parameters: querystring,
onFailure: error_box,
onSuccess: function (req, xml) {
remove_waiting_box();
if (req.responseText === 'NOCONX') { reconnect();return;}
add_div(popup);
$(idbox).update(req.responseText);
g(idbox).style.top = calcy(140 + (layer * 3)) + "px";
}
}
);
}
/** /**
* update history view after changing the exercice * update history view after changing the exercice

View file

@ -634,6 +634,9 @@ function fill_ipopcard(obj)
if ( obj.nohistory != undefined) { if ( obj.nohistory != undefined) {
queryString+='&nohistory'; queryString+='&nohistory';
} }
if ( obj.nofollowup != undefined) {
queryString+='&nofollowup';
}
queryString=encodeURI(queryString); queryString=encodeURI(queryString);
var action=new Ajax.Request ( 'ajax_misc.php', var action=new Ajax.Request ( 'ajax_misc.php',
{ {

View file

@ -29,7 +29,7 @@
* - gDossier * - gDossier
* - op * - op
- dc Detail of a card - dc Detail of a card
parameter : $qcode , optional ro for readonly and nohistory without the history button parameter : $qcode , optional ro for readonly and nohistory without the history button, nofollowup
- bc Blank Card : display form for adding a card - bc Blank Card : display form for adding a card
parameter fd_id (fiche_def:fd_id) parameter fd_id (fiche_def:fd_id)
- st Show Type : select type of card - st Show Type : select type of card
@ -168,6 +168,7 @@ case 'dc':
$html.=HtmlInput::submit('save',_('Sauver')); $html.=HtmlInput::submit('save',_('Sauver'));
} }
if ( ! isset ($nohistory))$html.=HtmlInput::history_card_button($f->id,_('Historique')); if ( ! isset ($nohistory))$html.=HtmlInput::history_card_button($f->id,_('Historique'));
if ( ! isset ($nofollowup))$html.=HtmlInput::followup_card_button($f->id,_('Suivi'));
// Display a remove button if not used and can modify card // Display a remove button if not used and can modify card
if ( $can_modify == 1 && $f->is_used()==FALSE) if ( $can_modify == 1 && $f->is_used()==FALSE)
{ {

View file

@ -25,6 +25,7 @@ if (!defined('ALLOWED'))
* @file * @file
* @brief Update description on file * @brief Update description on file
*/ */
global $http,$cn;
$op=$http->request('op'); $op=$http->request('op');
global $g_user; global $g_user;
@ -138,4 +139,19 @@ if ($op == 'followup_comment_oneedit') {
break; break;
} }
return; return;
}
/**************************************************************************
* See list of follow-up evebt
*************************************************************************/
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)]);
$followup=new Follow_Up($cn);
echo $followup->view_list($query);
echo \HtmlInput::button_close($div);
return;
} }

View file

@ -634,13 +634,56 @@ class Follow_Up
$this->insert_operation(); $this->insert_operation();
$this->insert_action(); $this->insert_action();
} }
/**
* @brief return the SQL to make a list of actions
* Colum :
* - my_date string date action format DD.MM.YYYY
* - my_remind string date reminder format DD.MM.YYYY
* - str_last_comment string last colemnt format DD.MM.YYYY
* - last_comment date last comment
* - f_id_dest int fiche.f_id concerned card
* - s_value string state of the action (cloturé, à suivre ,...)
* - s_id int id of document_state
* - ag_title string Title of the follow-up
* - dt_value string Type of document
* - ag_ref, string ref of the action
* - ag_priority int priority of the action
* - ag_state, int state of the followup (see table : document_state )
* - dest string profil group
* - name string name of the recipient
* - qcode string qcode of the recipient
* - tag string list of tags separated by comma
* - tags_color string list of tag colors separated by comma
* @returns a SQL string to retrieve list of actions
*/
public static function SQL_list_action():string
{
$sql = " select 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.ag_id),ag_timestamp),'DD.MM.YY') as str_last_comment,
coalesce((select max(agc_date) from action_gestion_comment as agc where agc.ag_id=ag.ag_id),ag_timestamp) as last_comment,
f_id_dest,
s_id,
s_value,
ag_title,dt_value,ag_ref, ag_priority,ag_state,
coalesce((select p_name from profile where p_id=ag_dest),'Aucun groupe') as dest,
(select ad_value from fiche_Detail where f_id=ag.f_id_dest and ad_id=1) as name,
(select ad_value from fiche_Detail where f_id=ag.f_id_dest and ad_id=23) as qcode,
array_to_string((select array_agg(t1.t_tag) from action_tags as a1 join tags as t1 on (a1.t_id=t1.t_id) where a1.ag_id=ag.ag_id ),',') as tags,
array_to_string((select array_agg(t1.t_color) from action_tags as a1 join tags as t1 on (a1.t_id=t1.t_id) where a1.ag_id=ag.ag_id ),',') as tags_color
from action_gestion as ag
join document_type on (ag_type=dt_id)
join document_state on (ag_state=s_id)
";
return $sql;
}
/** /**
* @brief myList($p_base, $p_filter = "", $p_search = "") * @brief myList($p_base, $p_filter = "", $p_search = "")
* Show list of action by default if sorted on date * Show list of action by default if sorted on date
* @param $p_base base url with ac... * @param $p_base base url with ac...
* @param $p_filter filters on the document_type * @param $p_filter filters on the document_type
* @param $p_search must a valid sql command ( ex 'and ag_title like upper('%hjkh%')) * @param $p_search must a valid sql command ( ex 'and ag_title like upper('%hjkh%'))
* @see Follow_Up::create_query()
* @return string containing html code * @return string containing html code
*/ */
function myList($p_base, $p_filter="", $p_search="") function myList($p_base, $p_filter="", $p_search="")
@ -676,23 +719,9 @@ class Follow_Up
else else
$p_filter_doc=" 1=1 "; $p_filter_doc=" 1=1 ";
$sql=" // make SQL to find the action
select ag_id,to_char(ag_timestamp,'DD.MM.YYYY') as my_date, $sql=Follow_Up::SQL_list_action()." where $p_filter_doc $p_search $sort";
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.ag_id),ag_timestamp),'DD.MM.YY') as str_last_comment,
coalesce((select max(agc_date) from action_gestion_comment as agc where agc.ag_id=ag.ag_id),ag_timestamp) as last_comment,
f_id_dest,
s_value,
ag_title,dt_value,ag_ref, ag_priority,ag_state,
coalesce((select p_name from profile where p_id=ag_dest),'Aucun groupe') as dest,
(select ad_value from fiche_Detail where f_id=ag.f_id_dest and ad_id=1) as name,
(select ad_value from fiche_Detail where f_id=ag.f_id_dest and ad_id=23) as qcode,
array_to_string((select array_agg(t1.t_tag) from action_tags as a1 join tags as t1 on (a1.t_id=t1.t_id) where a1.ag_id=ag.ag_id ),',') as tags,
array_to_string((select array_agg(t1.t_color) from action_tags as a1 join tags as t1 on (a1.t_id=t1.t_id) where a1.ag_id=ag.ag_id ),',') as tags_color
from action_gestion as ag
join document_type on (ag_type=dt_id)
join document_state on (ag_state=s_id)
where $p_filter_doc $p_search $sort";
$max_line=$this->db->count_sql($sql); $max_line=$this->db->count_sql($sql);
$step=$_SESSION[SESSION_KEY.'g_pagesize']; $step=$_SESSION[SESSION_KEY.'g_pagesize'];
$page=(isset($_GET['offset']))?$_GET['page']:1; $page=(isset($_GET['offset']))?$_GET['page']:1;
@ -823,6 +852,17 @@ class Follow_Up
return $r; return $r;
} }
/**
* @brief display list of followup , used with card
* @param $query string SQL query
* @return void
*/
function view_list($query)
{
$sql=Follow_Up::SQL_list_action();
$sql = " $sql $query";
require_once NOALYSS_TEMPLATE."/follow_up-view_list.php";
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
/** /**
* \brief Update the data into the database, the field ag_description could contain some HTML tags and must be * \brief Update the data into the database, the field ag_description could contain some HTML tags and must be

View file

@ -0,0 +1,87 @@
<?php
/*
* This file is part of NOALYSS.
*
* NOALYSS 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.
*
* NOALYSS 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 NOALYSS; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright Author Dany De Bontridder danydb@aevalys.eu 13/02/24
/*!
* \file
* \brief display list of followup
*/
global $cn;
$array=$cn->get_array($sql);
if (empty ($array)) {
echo_warning("Aucun suivi ");
return;
}
$idx=0;
?>
<table class="result">
<thead>
<tr>
<th>Date</th>
<th>Référence</th>
<th>Titre</th>
<th>QCODE</th>
<th>Dernier commentaire</th>
<th>Etat</th>
<th></th>
</tr>
</thead>
<tbody>
<?php
foreach($array as $item) {
$even=($idx%2==0)?'class="odd"':'class="even"';
$idx++;
?>
<tr <?=$even?>>
<td><?=$item['my_date']?></td>
<td>
<?php
echo \HtmlInput::detail_action($item['ag_id'], $item['ag_ref']);
?>
</td>
<td><?=h($item['ag_title'])?></td>
<td><?=h($item['qcode'])?></td>
<td><?=$item['str_last_comment']?></td>
<td><?=h($item['s_value'])?></td>
<td>
<?php
if ($item['tags']!="") {
$aColor = explode(",", $item["tags_color"]);
$aTags = explode(",", $item["tags"]);
$nb_tag = count($aTags);
for ($x = 0; $x < $nb_tag; $x++) {
printf('<span style="font-size:75%%;padding:1px;border-color:transparent" class="tagcell tagcell-color%s">%s</span>', $aColor[$x], $aTags[$x]);
printf("&nbsp;");
} // end loop $x
}
?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>