[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 06/12: Bug : follow up mixed description and
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 06/12: Bug : follow up mixed description and comment |
Date: |
Sun, 8 Nov 2020 15:52:14 -0500 (EST) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 80a0993ce731d44bddd068d1583f05432447570f
Author: Dany wm De Bontridder <danydb@noalyss.eu>
AuthorDate: Sat Nov 7 14:22:54 2020 +0100
Bug : follow up mixed description and comment
---
include/class/follow_up.class.php | 59 +++++++++--------
include/template/detail-action.php | 128 ++++++++++++++++++++-----------------
2 files changed, 101 insertions(+), 86 deletions(-)
diff --git a/include/class/follow_up.class.php
b/include/class/follow_up.class.php
index 6d740cd..010958b 100644
--- a/include/class/follow_up.class.php
+++ b/include/class/follow_up.class.php
@@ -596,7 +596,12 @@ class Follow_Up
if (trim($this->ag_comment)!='' &&
Document_Option::can_add_comment($this->ag_id))
{
$this->db->exec_sql("insert into action_gestion_comment
(ag_id,tech_user,agc_comment) values ($1,$2,$3)"
- , array($this->ag_id, $_SESSION['g_user'],
$this->ag_comment));
+ , array($this->ag_id, $_SESSION['g_user'], $this->ag_comment));
+ }
+ if (trim($this->ag_description)!='' &&
Document_Option::can_add_comment($this->ag_id))
+ {
+ $this->db->exec_sql("insert into action_gestion_comment
(ag_id,tech_user,agc_comment) values ($1,$2,$3)"
+ , array($this->ag_id, $_SESSION['g_user'],
$this->ag_description));
}
$this->insert_operation();
$this->insert_action();
@@ -905,6 +910,11 @@ class Follow_Up
$this->db->exec_sql("insert into action_gestion_comment
(ag_id,tech_user,agc_comment) values ($1,$2,$3)"
, array($this->ag_id, $_SESSION['g_user'],
$this->ag_comment));
}
+ if (trim($this->ag_description)!='')
+ {
+ $this->db->exec_sql("insert into action_gestion_comment
(ag_id,tech_user,agc_comment) values ($1,$2,$3)"
+ , array($this->ag_id, $_SESSION['g_user'],
$this->ag_description));
+ }
$this->insert_operation();
$this->insert_action();
return true;
@@ -949,29 +959,24 @@ class Follow_Up
function fromArray($p_array)
{
global $g_user;
- $this->ag_id=(isset($p_array['ag_id']))?$p_array['ag_id']:0;
- $this->ag_ref=(isset($p_array['ag_ref']))?$p_array['ag_ref']:"";
-
$this->qcode_dest=(isset($p_array['qcode_dest']))?$p_array['qcode_dest']:"";
-
$this->f_id_dest=(isset($p_array['f_id_dest']))?$p_array['f_id_dest']:null;
-
$this->ag_timestamp=(isset($p_array['ag_timestamp']))?$p_array['ag_timestamp']:date('d.m.Y');
-
$this->qcode_dest=(isset($p_array['qcode_dest']))?$p_array['qcode_dest']:"";
- $this->dt_id=(isset($p_array['dt_id']))?$p_array['dt_id']:"";
- $this->ag_state=(isset($p_array['ag_state']))?$p_array['ag_state']:2;
- $this->ag_ref=(isset($p_array['ag_ref']))?$p_array['ag_ref']:"";
- $this->ag_title=(isset($p_array['ag_title']))?$p_array['ag_title']:"";
- $this->ag_hour=(isset($p_array['ag_hour']))?$p_array['ag_hour']:"";
-
$this->ag_dest=(isset($p_array['ag_dest']))?$p_array['ag_dest']:$g_user->get_profile();
-
$this->ag_priority=(isset($p_array['ag_priority']))?$p_array['ag_priority']:2;
-
$this->ag_contact=(isset($p_array['ag_contact']))?$p_array['ag_contact']:"";
-
$this->ag_comment=(isset($p_array['ag_comment']))?$p_array['ag_comment']:"";
-
$this->ag_remind_date=(isset($p_array['ag_remind_date']))?$p_array['ag_remind_date']:null;
-
$this->operation=(isset($p_array['operation']))?$p_array['operation']:null;
- /**
- * @todo
- * deprecated : to remove
- $this->op = (isset($p_array['op'])) ? $p_array['op'] : null;
- */
- $this->action=(isset($p_array['action']))?$p_array['action']:null;
+ $http=new HttpInput();
+ $this->ag_id=$http->extract($p_array,"ag_id","number",0);
+ $this->ag_ref=$http->extract($p_array,"ag_ref","string","");
+ $this->qcode_dest=$http->extract($p_array,"qcode_dest","string","");
+ $this->f_id_dest=$http->extract($p_array,"f_id_dest","string",null);
+
$this->ag_timestamp=$http->extract($p_array,"ag_timestamp","string",date('d.m.Y'));
+ $this->dt_id=$http->extract($p_array,"dt_id","string","");
+ $this->ag_state=$http->extract($p_array,"ag_state","number",2);
+ $this->ag_title=$http->extract($p_array,"ag_title","string","");
+ $this->ag_hour=$http->extract($p_array,"ag_hour","string","");
+
$this->ag_dest=$http->extract($p_array,"ag_dest","string",$g_user->get_profile());
+ $this->ag_priority=$http->extract($p_array,"ag_priority","string","2");
+ $this->ag_contact=$http->extract($p_array,"ag_contact","string","");
+ $this->ag_comment=$http->extract($p_array,"ag_comment","string","");
+
$this->ag_description=$http->extract($p_array,"ag_description","string","");
+
$this->ag_remind_date=$http->extract($p_array,"ag_remind_date","string",null);
+ $this->operation=$http->extract($p_array,"operation","string",null);
+ $this->action=$http->extract($p_array,"action","string",null);
}
/**
@@ -1520,7 +1525,7 @@ class Follow_Up
* @brief show the cell content in Display for the tags
* called also by ajax
*/
- function tag_cell()
+ function tag_cell($p_view='UPD')
{
global $g_user;
$a_tag=$this->tag_get();
@@ -1529,7 +1534,7 @@ class Follow_Up
{
echo '<span class="tagcell">';
echo $a_tag[$e]['t_tag'];
- if ($g_user->can_write_action($this->ag_id)==true)
+ if ($g_user->can_write_action($this->ag_id)==true && $p_view !=
'READ')
{
$js_remove=sprintf("action_tag_remove('%s','%s','%s')",
dossier::id(), $this->ag_id, $a_tag[$e]['t_id']);
echo Icon_Action::trash(uniqid(), $js_remove);
@@ -1539,7 +1544,7 @@ class Follow_Up
echo ' ';
}
- if ($g_user->can_write_action($this->ag_id)==true)
+ if ($p_view != 'READ' && $g_user->can_write_action($this->ag_id)==true)
{
$js=sprintf("onclick=\"action_tag_select('%s','%s')\"",
dossier::id(), $this->ag_id);
echo HtmlInput::button('tag_bt', _('Ajout étiquette'), $js,
'smallbutton');
diff --git a/include/template/detail-action.php
b/include/template/detail-action.php
index 1e13df7..3cb5071 100644
--- a/include/template/detail-action.php
+++ b/include/template/detail-action.php
@@ -74,7 +74,7 @@ $uniq=uniqid("tab",TRUE);
<td id="concerned_card_td">
<?php
echo $this->display_linked();
- if ($g_user->can_write_action($this->ag_id) == true ):
+ if ($p_view != 'READ' &&
$g_user->can_write_action($this->ag_id) == true ):
echo HtmlInput::button_action_add_concerned_card(
$this->ag_id);
endif;
?>
@@ -160,7 +160,7 @@ $uniq=uniqid("tab",TRUE);
<td id="action_tag_td">
<?php
- $this->tag_cell();
+ $this->tag_cell($p_view);
?>
</td>
</TR>
@@ -253,47 +253,48 @@ function small(p_id_textarea){
// description
$description = new ITextarea("ag_description");
$description->id="ag_description";
- //---------------------------------- Description
-------------------------------------------------------------------
- if ( count($acomment)> 0) {
- $editable_description =
Document_Option::is_enable_editable_description($this->dt_id);
- if ( $editable_description == true){
- echo h2(_("Description"));
- $itDescription=new ITextarea("ag_description");
- $itDescription->style='class="input_text field_follow_up"
style="height:21rem;width:98%"';
-
- $ag_description_id= $acomment[0]['agc_id'];
- $itDescription->value=$acomment[0]['agc_comment'];
- $itDescription->id="ag_description";
-
- // One editable comment is available
- $editable_description=new Inplace_Edit($itDescription);
- $editable_description->add_json_param("op",
"followup_comment_oneedit");
- $editable_description->add_json_param("agc_id",
$ag_description_id);
- $editable_description->add_json_param("ag_id", $ag_id);
- $editable_description->add_json_param("gDossier", Dossier::id());
- $editable_description->set_callback("ajax_misc.php");
-
- echo $editable_description->input();
- }
- elseif ($p_view == 'READ' || $editable_description == false)
- {
- echo h2(_("Description"));
-
- echo '<pre class="field_follow_up">';
+ //---------------------------------- Description
-------------------------------------------------------------------
+ if ( count($acomment)> 0) {
+ $has_description = true;
+ $editable_description =
Document_Option::is_enable_editable_description($this->dt_id);
+ if ( $p_view != 'READ' && $editable_description == true){
+ echo h2(_("Description"));
+ $itDescription=new ITextarea("ag_description");
+ $itDescription->style='class="input_text field_follow_up"
style="height:21rem;width:98%"';
+
+ $ag_description_id= $acomment[0]['agc_id'];
+ $itDescription->value=$acomment[0]['agc_comment'];
+ $itDescription->id="ag_description";
+
+ // One editable comment is available
+ $editable_description=new Inplace_Edit($itDescription);
+ $editable_description->add_json_param("op",
"followup_comment_oneedit");
+ $editable_description->add_json_param("agc_id",
$ag_description_id);
+ $editable_description->add_json_param("ag_id", $ag_id);
+ $editable_description->add_json_param("gDossier",
Dossier::id());
+ $editable_description->set_callback("ajax_misc.php");
+
+ echo $editable_description->input();
+ }
+ elseif ($p_view == 'READ' || $editable_description == false)
+ {
+ echo h2(_("Description"));
+
+ echo '<pre class="field_follow_up">';
echo h($acomment[0]['agc_comment']);
echo '</pre>';
- }
- } else {
- echo h2(_("Description"));
- echo $desc->input();
+ }
+ } else {
+ echo h2(_("Description"));
+ echo $description->input();
}
-
- //---------------------------------- Comment
-----------------------------------------------------------------------
+
+ //---------------------------------- Comment
-----------------------------------------------------------------------
if ( Document_Option::can_add_comment($ag_id) &&
Document_Option::option_comment($this->dt_id) == "ONE_EDIT" )
{
- if (count($acomment) > 1 && $p_view != 'READ') {
+ if (count($acomment) > 1 ) {
echo h2(_("Commentaire"));
$comment=new ITextarea("ag_comment_edit");
$comment->style='class="input_text field_follow_up"
style="height:21rem;width:98%"';
@@ -302,34 +303,40 @@ function small(p_id_textarea){
$comment->value=(count($acomment) > 1
)?$acomment[1]['agc_comment']:'';
$comment->id="ag_comment_edit";
- // One editable comment is available
- $editable_comment=new Inplace_Edit($comment);
- $editable_comment->add_json_param("op",
"followup_comment_oneedit");
- $editable_comment->add_json_param("agc_id", $ag_comment_id);
- $editable_comment->add_json_param("ag_id", $ag_id);
- $editable_comment->add_json_param("gDossier", Dossier::id());
- $editable_comment->set_callback("ajax_misc.php");
- echo '<p></p>';
- echo $editable_comment->input();
+ if ( $p_view != 'READ') {
+
+ // One editable comment is available
+ $editable_comment=new Inplace_Edit($comment);
+ $editable_comment->add_json_param("op",
"followup_comment_oneedit");
+ $editable_comment->add_json_param("agc_id", $ag_comment_id);
+ $editable_comment->add_json_param("ag_id", $ag_id);
+ $editable_comment->add_json_param("gDossier", Dossier::id());
+ $editable_comment->set_callback("ajax_misc.php");
+ echo '<p></p>';
+ echo $editable_comment->input();
+ } else {
+ echo '<p></p>';
+ echo $comment->display();
+ }
} else {
echo '<span class="noprint">';
- if ( $p_view == 'UPD' && Document_Option::can_add_comment($ag_id)
) {
- echo '<p></p>';
- echo $desc->input();
-
+ if ( $p_view == 'UPD' && $has_description &&
Document_Option::can_add_comment($ag_id) ) {
+ echo h2(_("Commentaire"));
+ echo '<p></p>';
+ echo $desc->input();
+
}
echo '</span>';
}
}
- if ( Document_Option::can_add_comment($ag_id)
+ if ( count($acomment) > 0
+ && Document_Option::can_add_comment($ag_id)
&& Document_Option::option_comment($this->dt_id) == "SOME_FIXED")
{
- if( count($acomment) >0 ) echo h2(_("Commentaire"));
+ echo h2(_("Commentaire"));
for( $c=1;$c<count($acomment);$c++){
- if ($c == 0) { $m_desc=_('Description');}
- else
- { $m_desc=_('Commentaire');}
+ $m_desc=_('Commentaire');
$comment="";
if ( $p_view != 'READ' && $c > 0)
{
@@ -360,13 +367,16 @@ function small(p_id_textarea){
echo '<p></p>';
echo $comment;
} // end for
- echo '<span class="noprint">';
- if ( $p_view == 'UPD' && Document_Option::can_add_comment($ag_id)) {
+ if ( $has_description && $p_view == 'UPD' &&
Document_Option::can_add_comment($ag_id)) {
+ echo '<span class="noprint">';
echo '<p></p>';
- echo $desc->input();
-
+ echo $desc->input();
+
+ }
+ echo '</span>';
+ if ($p_view == 'UPD') {
+
}
- echo '</span>';
}
- [Noalyss-commit] [noalyss] branch master updated (67dc4a8 -> 9d5d626), Dany De Bontridder, 2020/11/08
- [Noalyss-commit] [noalyss] 02/12: Cosmetic : install structure input, Dany De Bontridder, 2020/11/08
- [Noalyss-commit] [noalyss] 01/12: Cosmetic : follow up, Dany De Bontridder, 2020/11/08
- [Noalyss-commit] [noalyss] 03/12: Cosmetic, Dany De Bontridder, 2020/11/08
- [Noalyss-commit] [noalyss] 04/12: Bug : incompatibilty with php 7.4, Dany De Bontridder, 2020/11/08
- [Noalyss-commit] [noalyss] 05/12: ergonomy : add waiting box, Dany De Bontridder, 2020/11/08
- [Noalyss-commit] [noalyss] 06/12: Bug : follow up mixed description and comment,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 09/12: Print Accounting : export pdf does not work, Dany De Bontridder, 2020/11/08
- [Noalyss-commit] [noalyss] 10/12: Bug : when ledger not found, Dany De Bontridder, 2020/11/08
- [Noalyss-commit] [noalyss] 07/12: task #0001861: Plage de cases à cocher , search action, Dany De Bontridder, 2020/11/08
- [Noalyss-commit] [noalyss] 08/12: Remove direct access _GET, Dany De Bontridder, 2020/11/08
- [Noalyss-commit] [noalyss] 12/12: Bug : follow-up , add a new security against the duplicate for Follo_Up reference (ag_ref), Dany De Bontridder, 2020/11/08
- [Noalyss-commit] [noalyss] 11/12: Improve Test, Dany De Bontridder, 2020/11/08