[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 110/119: Follow Up : an action can have sever
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 110/119: Follow Up : an action can have several parents |
Date: |
Mon, 26 Oct 2020 18:27:40 -0400 (EDT) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 997ca7620b38a642b3660a329ca1332ee79197a8
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Fri Oct 16 10:00:29 2020 +0200
Follow Up : an action can have several parents
---
include/action.common.inc.php | 1 -
include/class/follow_up.class.php | 115 +++++++++++++++++++-------------------
2 files changed, 59 insertions(+), 57 deletions(-)
diff --git a/include/action.common.inc.php b/include/action.common.inc.php
index 54ed0e3..ce874a8 100644
--- a/include/action.common.inc.php
+++ b/include/action.common.inc.php
@@ -30,7 +30,6 @@
*
*/
if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
-
$http=new HttpInput();
$supl_hidden = '';
if (isset($_REQUEST['sc']))
diff --git a/include/class/follow_up.class.php
b/include/class/follow_up.class.php
index 52aeecb..5810aa2 100644
--- a/include/class/follow_up.class.php
+++ b/include/class/follow_up.class.php
@@ -1773,8 +1773,9 @@ class Follow_Up
}
}
/**
- * Return the first parent of the event tree, or -1 if not found
- * @return integer (ag_id)
+ * Return the first parent of the event tree, or -1 if not found. The
parent is an action with a lower id,
+ * so it can happen than an action has several ones
+ * @return arrary of integer (ag_id)
*/
function get_parent() {
$value=$this->db->get_array('
@@ -1790,11 +1791,11 @@ class Follow_Up
where
p2.aga_greatest is not null and
p2.aga_greatest = p1.aga_least
- ) select * from t order by depth desc limit 1
+ ) select aga_least,aga_greatest,depth from t order by depth desc
' , array($this->ag_id)
);
if ( ! empty($value ) )
- return $value[0]['aga_least'];
+ return $value;
else
return -1;
}
@@ -1817,7 +1818,7 @@ class Follow_Up
aga_least,aga_greatest , 1
from
action_gestion_related
- where aga_least=$1
+ where aga_least=$1 or aga_greatest = $1
union all
select key_path||'-'||p2.aga_greatest::text,
p2.aga_least,p2.aga_greatest,depth + 1
@@ -1831,7 +1832,6 @@ class Follow_Up
from
action_gestion join t on (ag_id=aga_greatest)
join document_type on (ag_type=dt_id)
- order by key_path
";
$ret_array=$this->db->get_array($sql,array($p_id));
@@ -1855,15 +1855,17 @@ class Follow_Up
$base=HtmlInput::request_to_string(array("gDossier", "ac", "sb", "sc",
"f_id"))."&sa=detail";
- $parent=$this->get_parent();
if ($parent==-1)
{
echo _('Principal');
- $parent = $this->ag_id;
+ $parent=array();
+ $parent [0]['aga_least']= $this->ag_id;
}
- else
+
+ $nb_parent=count($parent);
+ for ($i=0;$i< $nb_parent;$i++)
{
- $fu_parent=new Follow_Up($this->db, $parent);
+ $fu_parent=new Follow_Up($this->db, $parent[$i]['aga_least']);
$fu_parent->get();
echo'<span class="highlight">';
$xaction=sprintf('view_action(%d,%d,%d)', $fu_parent->ag_id,
@@ -1874,56 +1876,57 @@ class Follow_Up
h($fu_parent->ag_title),
'('.h($fu_parent->ag_ref).')',
'</a>';
-
+
echo "</span>";
- }
- echo '<ul style="padding-left:10px;list-style-type: none;">';
- $action=$this->get_children($parent);
- for ($o=0; $o<count($action); $o++)
- {
- $class=($this->ag_id == $action[$o]['aga_greatest'])?'
class="highlight" ':'';
-
- // Count the number of direct parents
- $count_parent =$this->db->get_value('select count(*) from
action_gestion_related where aga_greatest =
$1',array($action[$o]['aga_greatest']));
- $direct_parent=($count_parent > 1 ) ? _('direct parent
').$count_parent:"";
-
- $margin=($action[$o]['depth']>1
)?str_repeat(" ",$action[$o]['depth']-1)."⇨":"";
- if ($p_view!='READ'&&$p_base!='ajax')
- {
- $rmAction=sprintf("return confirm_box(null,'"._('Voulez-vous
effacer cette action ')."', function () {remove_action('%s','%s','%s');});",
- dossier::id(), $action[$o]['aga_greatest'],
- $_REQUEST['ag_id']);
- $showAction='<a class="line"
href="'.$base."&ag_id=".$action[$o]['aga_greatest'].'">';
- $js='<a class="tinybutton"
id="acact'.$action[$o]['aga_greatest'].'" href="javascript:void(0)"
onclick="'.$rmAction.'">'.SMALLX.'</a>';
- echo '<li '.$class.'
id="act'.$action[$o]['aga_greatest'].'">'.$margin.$showAction.$action[$o]['str_date'].
-
h($action[$o]['title']).'('.h($action[$o]['action_ref']).')'.$direct_parent.'</a>'."
"
- .$js.'</li>';
- }
- else
- /*
- * Display detail requested from Ajax Div
- */
- if ($p_base=='ajax')
- {
- $xaction=sprintf('view_action(%d,%d,%d)',
$action[$o]['aga_greatest'],
- Dossier::id(), 1);
- $showAction='<a class="line" href="javascript:'.$xaction.'">';
- echo '<li '.$class.'
>'.$margin.$showAction.$action[$o]['str_date']." ".
-
h($action[$o]['title']).'('.h($action[$o]['action_ref']).')'.$direct_parent.'</a>'."
"
- .'</li>';
- }
- /*
- * READ ONLY
- */
- else
+ echo '<ul style="padding-left:10px;list-style-type: none;">';
+
+ $action=$this->get_children($parent[$i]['aga_least']);
+ for ($o=0; $o<count($action); $o++)
{
- $showAction='<a class="line"
href="'.$base."&ag_id=".$action[$o]['aga_greatest'].'">';
- echo '<li '.$class.'
>'.$margin.$showAction.$action[$o]['str_date']." ".
-
h($action[$o]['sub_title']).'('.h($action[$o]['action_ref']).')'.$direct_parent.'</a>'."
"
- .'</li>';
+ $class=($this->ag_id == $action[$o]['aga_greatest'])?'
class="highlight" ':'';
+
+ // Count the number of direct parents
+ $count_parent =$this->db->get_value('select count(*) from
action_gestion_related where aga_greatest =
$1',array($action[$o]['aga_greatest']));
+ $direct_parent=($count_parent > 1 ) ? _('direct parent
').$count_parent:"";
+
+ $margin=($action[$o]['depth']>1
)?str_repeat(" ",$action[$o]['depth']-1)."⇨":"";
+ if ($p_view!='READ'&&$p_base!='ajax')
+ {
+ $rmAction=sprintf("return
confirm_box(null,'"._('Voulez-vous effacer cette action ')."', function ()
{remove_action('%s','%s','%s');});",
+ dossier::id(), $action[$o]['aga_greatest'],
+ $_REQUEST['ag_id']);
+ $showAction='<a class="line"
href="'.$base."&ag_id=".$action[$o]['aga_greatest'].'">';
+ $js='<a class="tinybutton"
id="acact'.$action[$o]['aga_greatest'].'" href="javascript:void(0)"
onclick="'.$rmAction.'">'.SMALLX.'</a>';
+ echo '<li '.$class.'
id="act'.$action[$o]['aga_greatest'].'">'.$margin.$showAction.$action[$o]['str_date'].
+
h($action[$o]['title']).'('.h($action[$o]['action_ref']).')'.$direct_parent.'</a>'."
"
+ .$js.'</li>';
+ }
+ else
+ /*
+ * Display detail requested from Ajax Div
+ */
+ if ($p_base=='ajax')
+ {
+ $xaction=sprintf('view_action(%d,%d,%d)',
$action[$o]['aga_greatest'],
+ Dossier::id(), 1);
+ $showAction='<a class="line"
href="javascript:'.$xaction.'">';
+ echo '<li '.$class.'
>'.$margin.$showAction.$action[$o]['str_date']." ".
+
h($action[$o]['title']).'('.h($action[$o]['action_ref']).')'.$direct_parent.'</a>'."
"
+ .'</li>';
+ }
+ /*
+ * READ ONLY
+ */
+ else
+ {
+ $showAction='<a class="line"
href="'.$base."&ag_id=".$action[$o]['aga_greatest'].'">';
+ echo '<li '.$class.'
>'.$margin.$showAction.$action[$o]['str_date']." ".
+
h($action[$o]['sub_title']).'('.h($action[$o]['action_ref']).')'.$direct_parent.'</a>'."
"
+ .'</li>';
+ }
}
+ echo '</ul>';
}
- echo '</ul>';
}
/**
* Display the list of parent of the current Follow_Up
- [Noalyss-commit] [noalyss] 115/119: Analytic accountancy protect against divide by zero, (continued)
- [Noalyss-commit] [noalyss] 115/119: Analytic accountancy protect against divide by zero, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 82/119: Follow up search card, add a button to select all , cosmetic add qcode in dialog box for contact option, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 83/119: Bug : from VEN , cannot get the price, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 85/119: Follow-up fix order, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 88/119: Fix bug : follow up option contact are not remove when document type changed, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 99/119: Upgrade DB 147, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 102/119: remove dead code, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 106/119: Filter_Multiselect : make a search on select (multi-row), Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 104/119: Select_Box Add new position : absolute, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 111/119: Follow-Up improve search, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 110/119: Follow Up : an action can have several parents,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 119/119: Tache #0001859: PARAM/CFGDOC : icone fermer + bouton, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 116/119: Modern CheckBox, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 118/119: Fontello : fix icon-edit, Dany De Bontridder, 2020/10/26