[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 08/29: FollowUp commentaire unique et modifia
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 08/29: FollowUp commentaire unique et modifiable |
Date: |
Wed, 4 Nov 2020 11:08:39 -0500 (EST) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit a8530b1f16ab9495d124885be66d1951eb4b7929
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Thu Oct 29 18:27:24 2020 +0100
FollowUp commentaire unique et modifiable
---
html/ajax_misc.php | 2 +
include/ajax/ajax_follow_up.php | 62 +++++++++++++
.../class/action_document_type_mtable.class.php | 14 ++-
include/class/document_option.class.php | 17 +++-
.../template/action_document_type_mtable_input.php | 5 ++
include/template/detail-action.php | 100 +++++++++++++++------
6 files changed, 167 insertions(+), 33 deletions(-)
diff --git a/html/ajax_misc.php b/html/ajax_misc.php
index 9a74ce0..713444d 100644
--- a/html/ajax_misc.php
+++ b/html/ajax_misc.php
@@ -250,6 +250,8 @@ $path = array(
'template_cat_category'=>'ajax_template_cat_category',
// From FollowUp , update a comment on a file
'update_comment_followUp'=>'ajax_follow_up',
+ // Update a follow up's comment
+ 'followup_comment_oneedit'=>'ajax_follow_up',
// TVA param
"tva_parameter"=>"ajax_tva_parameter",
// Display all cards using an accounting
diff --git a/include/ajax/ajax_follow_up.php b/include/ajax/ajax_follow_up.php
index bd44370..792c488 100644
--- a/include/ajax/ajax_follow_up.php
+++ b/include/ajax/ajax_follow_up.php
@@ -71,4 +71,66 @@ if ($op=='update_comment_followUp')
throw new Exception(__FILE__.':'.__LINE__.'Invalide value');
break;
}
+ return;
+}
+// Modify followup
+if ($op == 'followup_comment_oneedit') {
+ $input=$http->request('input');
+ $action=$http->request('ieaction', 'string', 'display');
+ $agc_id=$http->request('agc_id', "number");
+ $ag_id=$http->request('ag_id', "number");
+ global $g_user;
+ // check comment is the comment of this ag_id
+ $ctl_ag_id=$cn->get_value("select ag_id from action_gestion_comment where
agc_id=$1",[$agc_id]);
+ if ( $agc_id != -1 && $ctl_ag_id != $ag_id) {
+ record_log("FLP02 ag_id [$ag_id] <> ctl_ag_id [$ctl_ag_id]");
+ return;
+ }
+ // Build inplace input
+ $inplace_description=Inplace_Edit::build($input);
+ $inplace_description->set_callback("ajax_misc.php");
+
+ $inplace_description->add_json_param("ag_id", $ag_id);
+ $inplace_description->add_json_param("gDossier", Dossier::id());
+ $inplace_description->add_json_param("op", "followup_comment_oneedit");
+ switch ($action)
+ {
+ case 'display':
+ $inplace_description->add_json_param("agc_id", $agc_id);
+ echo $inplace_description->ajax_input();
+
+ break;
+ case 'ok':
+ if ($g_user->check_action(VIEWDOC)==1)
+ {
+ $value=strip_tags($http->request('value'));
+ if ($g_user->can_write_action($ag_id))
+ {
+ // retrieve the document
+ if ( $agc_id==-1) {
+ $agc_id= $cn->get_value("insert into
action_gestion_comment(ag_id,agc_comment,tech_user)
+ values ($1,$2,$3) returning agc_id"
,[$ag_id,$value,$g_user->login]);
+ } else {
+ $cn->exec_sql("update action_gestion_comment set
agc_comment=$1,tech_user=$2
+ where agc_id=$3
+ " ,[$value,$g_user->login,$agc_id]);
+ }
+
+ }
+ $inplace_description->add_json_param("agc_id", $agc_id);
+ $inplace_description->set_value($value);
+ }
+ echo $inplace_description->value();
+ break;
+ case 'cancel':
+ $inplace_description->add_json_param("agc_id", $agc_id);
+ echo '<pre>';
+ echo $inplace_description->value();
+ echo '</pre>';
+ break;
+ default:
+ throw new Exception(__FILE__.':'.__LINE__.'Invalide value');
+ break;
+ }
+ return;
}
\ No newline at end of file
diff --git a/include/class/action_document_type_mtable.class.php
b/include/class/action_document_type_mtable.class.php
index d0d3640..f56b1f2 100644
--- a/include/class/action_document_type_mtable.class.php
+++ b/include/class/action_document_type_mtable.class.php
@@ -80,8 +80,10 @@ class Action_Document_Type_MTable extends Manage_Table_SQL
$this->other['contact_multiple']=$http->request("det_contact_mul",
"string", 0);
$this->other['make_invoice']=$http->request("make_invoice", "string",
0);
$this->other['followup_comment']=$http->request("followup_comment",
"string", 0);
+ $this->other['enable_followup']=$http->request("enable_followup",
"string", 0);
$this->other['seq']=$http->request("seq", "string", 0);
$this->other['select_option_operation']=$http->request("select_option_operation",
"string", null);
+ $this->other['select_comment']=$http->request("select_comment",
"string", null);
$this->other["cor_id"]=$http->request("cor_id","array",[]);
$nb_corid=count($this->other["cor_id"]);
$http->set_empty(0);
@@ -244,7 +246,8 @@ class Action_Document_Type_MTable extends Manage_Table_SQL
// Save detail operation
$cn->exec_sql("insert into document_option
(do_code,document_type_id,do_enable,do_option) values ($1,$2,$3,$4)
on conflict on constraint document_option_un
- do update set do_enable=$3,do_option=$4", ["detail_operation",
+ do update set do_enable=$3,do_option=$4",
+ [ "detail_operation",
$object_sql->dt_id,
$this->other['detail_operation'],
$this->other['select_option_operation']
@@ -260,9 +263,14 @@ class Action_Document_Type_MTable extends Manage_Table_SQL
on conflict on constraint document_option_un
do update set do_enable=$3 ", ["make_invoice", $object_sql->dt_id,
$this->other['make_invoice']]);
// Option for comments
- $cn->exec_sql("insert into document_option
(do_code,document_type_id,do_enable) values ($1,$2,$3)
+ $cn->exec_sql("insert into document_option
(do_code,document_type_id,do_enable,do_option) values ($1,$2,$3,$4)
on conflict on constraint document_option_un
- do update set do_enable=$3 ", ["followup_comment",
$object_sql->dt_id, $this->other['followup_comment']]);
+ do update set do_enable=$3,do_option=$4 ",
+ [ "followup_comment",
+ $object_sql->dt_id,
+ $this->other['followup_comment'],
+ $this->other['select_comment']
+ ]);
// Option contact to save
$cn->exec_sql("delete from jnt_document_option_contact where
document_type_id=$1",[$object_sql->dt_id]);
diff --git a/include/class/document_option.class.php
b/include/class/document_option.class.php
index 4fd974c..388284b 100644
--- a/include/class/document_option.class.php
+++ b/include/class/document_option.class.php
@@ -129,5 +129,20 @@ class Document_Option
return false;
}
+
+ /**
+ * returns option from the operation_detail
+ *
+ * @param int $p_document_type Document_Type.dt_id
+ * @return string ONE_EDIT or SOME_FIXED
+ */
+ static function option_comment($p_document_type)
+ {
+ $cn=Dossier::connect();
+ $option_operation = $cn->get_value("select do_option from
document_option where document_type_id=$1 "
+ . " and do_code = $2",
+ [$p_document_type, 'followup_comment']);
+ return $option_operation;
+ }
-}
+ }
diff --git a/include/template/action_document_type_mtable_input.php
b/include/template/action_document_type_mtable_input.php
index a02401f..25f2426 100644
--- a/include/template/action_document_type_mtable_input.php
+++ b/include/template/action_document_type_mtable_input.php
@@ -100,6 +100,11 @@ $i=new ICheckBox("followup_comment",1);
if ( Document_Option::is_enable_comment($table->dt_id)) $i->set_check(1); else
$i->set_check(0);
echo $i->input();
echo _("Commentaire");
+$select_comment_type=new ISelect("select_comment");
+$select_comment_type->value=array(["value"=>"ONE_EDIT","label"=>_("Unique")],
+
["value"=>"SOME_FIXED","label"=>_("Multiples")]);
+$select_comment_type->set_value(Document_Option::option_comment($table->dt_id));
+echo $select_comment_type->input();
?>
</li>
</ul>
diff --git a/include/template/detail-action.php
b/include/template/detail-action.php
index f43d321..1d64516 100644
--- a/include/template/detail-action.php
+++ b/include/template/detail-action.php
@@ -245,43 +245,85 @@ function small(p_id_textarea){
<div style="margin-left:10px;">
<?php
$style_enl='style="display:inline"';$style_small='style="display:none"';
+ if ( Document_Option::can_add_comment($ag_id)
+ && Document_Option::option_comment($this->dt_id) == "ONE_EDIT")
+ {
+ if ( count($acomment)==0) {
+ echo $desc->input();
+ } else {
+ echo '<pre class="field_follow_up">';
+ echo h($acomment[0]['agc_comment']);
+ echo '</pre>';
+
+ $comment=new ITextarea("ag_comment_edit");
+ $comment->style='class="input_text field_follow_up"
style="height:21rem"';
+
+ $ag_comment_id= (count($acomment) > 1)?$acomment[1]['agc_id']:-1;
+ $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");
-for( $c=0;$c<count($acomment);$c++){
- if ($c == 0) { $m_desc=_('Description');}
- else
- { $m_desc=_('Commentaire');}
- $comment="";
- if ( $p_view != 'READ' && $c > 0)
- {
- $rmComment=sprintf("return confirm_box(null,'"._('Voulez-vous
effacer ce commentaire')." ?',function() {remove_comment('%s','%s');});",
- dossier::id(),
- $acomment[$c]['agc_id']);
- $js=Icon_Action::trash("accom".$acomment[$c]['agc_id'],
$rmComment);
- $comment= h($m_desc.'
'.$acomment[$c]['agc_id'].'('.$acomment[$c]['tech_user']."
".$acomment[$c]['str_agc_date'].')').$js.
- '<pre class="field_follow_up"
id="com'.$acomment[$c]['agc_id'].'"> '.
- " ".h($acomment[$c]['agc_comment']).'</pre>'
- ;
+ echo $editable_comment->input();
+
+ }
+
+
+ } elseif (Document_Option::can_add_comment($ag_id)
+ && Document_Option::option_comment($this->dt_id) == "SOME_FIXED")
+ {
+ for( $c=0;$c<count($acomment);$c++){
+ if ($c == 0) { $m_desc=_('Description');}
+ else
+ { $m_desc=_('Commentaire');}
+ $comment="";
+ if ( $p_view != 'READ' && $c > 0)
+ {
+ $rmComment=sprintf("return confirm_box(null,'"._('Voulez-vous
effacer ce commentaire').
+ " ?',function() {remove_comment('%s','%s');});",
+ dossier::id(),
+ $acomment[$c]['agc_id']);
+ $js=Icon_Action::trash("accom".$acomment[$c]['agc_id'],
$rmComment);
+ $comment= h($m_desc.'
'.$acomment[$c]['agc_id'].'('.$acomment[$c]['tech_user']." ".
+ $acomment[$c]['str_agc_date'].')').$js.
+ '<pre class="field_follow_up"
id="com'.$acomment[$c]['agc_id'].'"> '.
+ " ".h($acomment[$c]['agc_comment']).'</pre>'
+ ;
+
+ }
+ else
+ {
+ $comment=h($m_desc.'
'.$acomment[$c]['agc_id'].'('.$acomment[$c]['tech_user']." ".
+ $acomment[$c]['str_agc_date'].')').
+ '<pre class="field_follow_up"
id="com'.$acomment[$c]['agc_id'].'"> '.
+ "
".h($acomment[$c]['agc_comment']).'</pre>'
+ ;
- }
- else
- {
- $comment=h($m_desc.'
'.$acomment[$c]['agc_id'].'('.$acomment[$c]['tech_user']."
".$acomment[$c]['str_agc_date'].')').
- '<pre class="field_follow_up"
id="com'.$acomment[$c]['agc_id'].'"> '.
- " ".h($acomment[$c]['agc_comment']).'</pre>'
- ;
-
- }
- $comment=preg_replace('/#([0-9]+)/','<a class="line"
href="javascript:void()" onclick="view_action(\1,'.Dossier::id().',0)"
>\1</a>',$comment);
- echo $comment;
+ }
+ $comment=preg_replace('/#([0-9]+)/','<a class="line"
href="javascript:void()" onclick="view_action(\1,'.
+ Dossier::id().',0)" >\1</a>',$comment);
+ echo $comment;
+ }
}
echo '<span class="noprint">';
-if ( Document_Option::can_add_comment($ag_id) ) {
- echo $desc->input();
+if ( Document_Option::can_add_comment($ag_id) &&
Document_Option::option_comment($this->dt_id) == "SOME_FIXED") {
+ echo $desc->input();
+
}
echo '</span>';
?>
-<?php if ($p_view != "READ" && Document_Option::can_add_comment($ag_id)): ?>
+
+<?php if ($p_view != "READ"
+ && Document_Option::can_add_comment($ag_id)
+ && Document_Option::option_comment($this->dt_id) == "SOME_FIXED" ): ?>
+
<p class="noprint">
<input type="button" id="bt_enlarge" <?php echo $style_enl?> value="+"
onclick="enlarge('ag_comment');return false;">
<input type="button" id="bt_small" <?php echo $style_small?> value="-"
style="display:none" onclick="small('ag_comment');return false;">
- [Noalyss-commit] [noalyss] 11/29: Style : improve h2, (continued)
- [Noalyss-commit] [noalyss] 11/29: Style : improve h2, Dany De Bontridder, 2020/11/04
- [Noalyss-commit] [noalyss] 22/29: Cosmetic, Dany De Bontridder, 2020/11/04
- [Noalyss-commit] [noalyss] 25/29: cosmetic : waiting box, Dany De Bontridder, 2020/11/04
- [Noalyss-commit] [noalyss] 19/29: Predefined Operation filter by ledger, Dany De Bontridder, 2020/11/04
- [Noalyss-commit] [noalyss] 21/29: cosmetic , remove myfiedset class, unclosed tag , the title comment is not show if there is no comment, Dany De Bontridder, 2020/11/04
- [Noalyss-commit] [noalyss] 20/29: Cosmetic Admin List Folders : add close button, Dany De Bontridder, 2020/11/04
- [Noalyss-commit] [noalyss] 02/29: Sort by earliest one, Dany De Bontridder, 2020/11/04
- [Noalyss-commit] [noalyss] 07/29: 0001827: Delta des opérations liées basé sur le montant d'une seule opération, Dany De Bontridder, 2020/11/04
- [Noalyss-commit] [noalyss] 09/29: Adapt for Textarea, Dany De Bontridder, 2020/11/04
- [Noalyss-commit] [noalyss] 04/29: Followup : change moyenne par normale, Dany De Bontridder, 2020/11/04
- [Noalyss-commit] [noalyss] 08/29: FollowUp commentaire unique et modifiable,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 18/29: Follow UP detail do not show the "Add Rows button" in READ mode, Dany De Bontridder, 2020/11/04
- [Noalyss-commit] [noalyss] 23/29: Cosmetic : ledger name, Dany De Bontridder, 2020/11/04
- [Noalyss-commit] [noalyss] 24/29: Contact : navigation bar was not correct, Dany De Bontridder, 2020/11/04
- [Noalyss-commit] [noalyss] 29/29: Merge branch 'checkbox-range', Dany De Bontridder, 2020/11/04
- [Noalyss-commit] [noalyss] 28/29: Task #0001861: Plage de cases à cocher, Dany De Bontridder, 2020/11/04
- [Noalyss-commit] [noalyss] 12/29: Suivi : description modifiable, Dany De Bontridder, 2020/11/04
- [Noalyss-commit] [noalyss] 15/29: Document_State : rewriting, Dany De Bontridder, 2020/11/04
- [Noalyss-commit] [noalyss] 17/29: Security For document_state and tag_group, Dany De Bontridder, 2020/11/04
- [Noalyss-commit] [noalyss] 14/29: cosmetic : set the total and compute button outside of the frame, Dany De Bontridder, 2020/11/04
- [Noalyss-commit] [noalyss] 26/29: Cosmetic : add waiting box when searching by card category for Management customer, supplier, ..., Dany De Bontridder, 2020/11/04