[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 01/03: Task #1149 - Tableau de bord : ajout
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 01/03: Task #1149 - Tableau de bord : ajout des 10 derniers événement Show the last actions on the dashboard |
Date: |
Wed, 12 Aug 2015 21:36:15 +0000 |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 05fa397138c9083ffde0281b9b7af91a86778768
Author: Dany De Bontridder <address@hidden>
Date: Wed Aug 12 23:28:01 2015 +0200
Task #1149 - Tableau de bord : ajout des 10 derniers événement
Show the last actions on the dashboard
---
include/class_follow_up.php | 15 +++++++++---
include/constant.php | 1 +
include/template/dashboard.php | 49 ++++++++++++++++++++++++++++++++-------
3 files changed, 52 insertions(+), 13 deletions(-)
diff --git a/include/class_follow_up.php b/include/class_follow_up.php
index 4601de6..005e6e2 100644
--- a/include/class_follow_up.php
+++ b/include/class_follow_up.php
@@ -120,10 +120,12 @@ class Follow_Up
if ($p_mode=='R')
{
$sql=" (ag_dest in (select p_granted from user_sec_action_profile
where p_id=$profile ) ) ";
- }
- if ($p_mode=='W')
+ } else if ($p_mode=='W')
{
$sql=" ( ag_dest in (select p_granted from user_sec_action_profile
where p_id=$profile and ua_right='W' ) )";
+ } else {
+ error_log(_('Securité'));
+ throw new Exception(_('Securité'));
}
return $sql;
}
@@ -1073,16 +1075,21 @@ class Follow_Up
}
/**
- * \brief return the last p_limit operation into an array, there is no
security
+ * \brief return the last p_limit operation into an array, there is a
security
* on user
* \param $p_limit is the max of operation to return
* \return $p_array of Follow_Up object
*/
function get_last($p_limit)
{
+
$sql="select coalesce(vw_name,'Interne') as
vw_name,ag_id,ag_title,ag_ref, dt_value,to_char(ag_timestamp,'DD.MM.YYYY') as
ag_timestamp_fmt,ag_timestamp ".
" from action_gestion join document_type ".
- " on (ag_type=dt_id) left join vw_fiche_attr on
(f_id=f_id_dest) where ag_state in (2,3) order by ag_timestamp desc limit
$p_limit";
+ " on (ag_type=dt_id) "
+ . "left join vw_fiche_attr on (f_id=f_id_dest) "
+ . "where ag_state in (2,3) "
+ . "and ".self::sql_security_filter($this->db,'R').
+ "order by ag_timestamp desc limit $p_limit";
$array=$this->db->get_array($sql);
return $array;
}
diff --git a/include/constant.php b/include/constant.php
index 250b5cd..75b6e7d 100644
--- a/include/constant.php
+++ b/include/constant.php
@@ -113,6 +113,7 @@ define ('MAX_RECONCILE',25);
define ('MAX_QCODE',4);
define ('MAX_SEARCH_CARD',20);
define ('MAX_FOLDER_TO_SHOW',20);
+define ('MAX_ACTION_SHOW',20);
if ( DEBUG ) {
error_reporting(2147483647);
diff --git a/include/template/dashboard.php b/include/template/dashboard.php
index 73c11d2..a4e4221 100644
--- a/include/template/dashboard.php
+++ b/include/template/dashboard.php
@@ -261,22 +261,20 @@ for($i=0;$i<count($last_ledger);$i++):
$class=($i%2==0)?' class="even" ':' class="odd" ';
?>
<tr <?php echo $class ?>>
- <td><?php echo smaller_date($last_ledger[$i]['jr_date_fmt'])?>
+ <td class="box">
+ <?php echo smaller_date($last_ledger[$i]['jr_date_fmt'])?>
</td>
- <td>
- <?php echo $last_ledger[$i]['jrn_def_code']?>
- </td>
- <td>
+ <td class="box">
<?php echo $last_ledger[$i]['jr_pj_number']?>
</td>
-<td>
+<td class="box">
<?php echo h(mb_substr($last_ledger[$i]['jr_comment'],0,40,'UTF-8'))?>
</td>
-<td>
+<td class="box">
<?php echo HtmlInput::detail_op($last_ledger[$i]['jr_id'],
$last_ledger[$i]['jr_internal'])?>
</td>
-<td class="num">
+<td class="num box">
<?php echo nbm($last_ledger[$i]['jr_montant'])?>
</td>
@@ -285,7 +283,40 @@ for($i=0;$i<count($last_ledger);$i++):
</table>
</div>
-
+<div id="last_operation_management_div" class="box">
+ <?php
+ echo
HtmlInput::title_box(_('Suivi'),"last_operation_management_div",'zoom','onclick="action_show('.dossier::id().')"');
+ //echo HtmlInput::title_box(_('Suivi'),"last_operation_management_div");
+ ?>
+ <?php
+ require_once NOALYSS_INCLUDE.'/class_follow_up.php';
+ $gestion=new Follow_Up($cn);
+ $array=$gestion->get_last(MAX_ACTION_SHOW);
+ $len_array=count($array);
+ ?>
+ <table style="width: 100%">
+ <?php
+ for ($i=0;$i < $len_array;$i++) :
+ ?>
+ <tr class=" <?php echo ($i%2==0)?'even':'odd'?>">
+ <td class="box">
+ <?php echo smaller_date($array[$i]['ag_timestamp_fmt']) ;?>
+ </td>
+ <td class="box">
+ <?php echo HtmlInput::detail_action($array[$i]['ag_id'],
$array[$i]['ag_ref'], 1) ?>
+ </td>
+ <td class="box">
+ <?php echo mb_substr(h($array[$i]['vw_name']),0,15)?>
+ </td>
+ <td class="box cut">
+ <?php echo h($array[$i]['ag_title'])?>
+ </td>
+ </tr>
+ <?php
+ endfor;
+ ?>
+ </table>
+</div>
<div id="add_todo_list" class="box" style="display:none">
<script charset="utf-8" type="text/javascript" language="javascript">