diff --git a/include/class/action_document_type_mtable.class.php b/include/class/action_document_type_mtable.class.php index f56b1f267..574d8ac29 100644 --- a/include/class/action_document_type_mtable.class.php +++ b/include/class/action_document_type_mtable.class.php @@ -80,6 +80,7 @@ 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['editable_description']=$http->request("editable_description", "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); @@ -258,6 +259,12 @@ class Action_Document_Type_MTable extends Manage_Table_SQL on conflict on constraint document_option_un do update set do_enable=$3 ", ["contact_multiple", $object_sql->dt_id, $this->other['contact_multiple']]); + // Save editable description + $cn->exec_sql("insert into document_option (do_code,document_type_id,do_enable) values ($1,$2,$3) + on conflict on constraint document_option_un + do update set do_enable=$3 ", ["editable_description", $object_sql->dt_id + , $this->other['editable_description']]); + // Save make invoice $cn->exec_sql("insert into document_option (do_code,document_type_id,do_enable) values ($1,$2,$3) on conflict on constraint document_option_un diff --git a/include/class/document_option.class.php b/include/class/document_option.class.php index 388284b5c..30630b21d 100644 --- a/include/class/document_option.class.php +++ b/include/class/document_option.class.php @@ -144,5 +144,23 @@ class Document_Option [$p_document_type, 'followup_comment']); return $option_operation; } + + /** + * returns true if it is possible to edit the description , otherwise false + * + * @param int $p_document_type Document_Type.dt_id + * @return boolean + */ + static function is_enable_editable_description($p_document_type) + { + $return=false; + $cn=Dossier::connect(); + if ($cn->get_value("select do_enable from document_option where document_type_id=$1 and do_code = $2", + [$p_document_type, 'editable_description'])=='1') + { + $return=true; + } + return $return; + } } diff --git a/include/template/action_document_type_mtable_input.php b/include/template/action_document_type_mtable_input.php index 25f2426b5..b0a32899f 100644 --- a/include/template/action_document_type_mtable_input.php +++ b/include/template/action_document_type_mtable_input.php @@ -94,6 +94,17 @@ echo $i->input(); echo _("Création de facture"); ?> + +
'; - echo h($acomment[0]['agc_comment']); - echo ''; - + echo h($acomment[0]['agc_comment']); + echo ''; + } + } else { + echo h2(_("Description")); + echo $desc->input(); + } + + //---------------------------------- 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') { + echo h2(_("Commentaire")); $comment=new ITextarea("ag_comment_edit"); - $comment->style='class="input_text field_follow_up" style="height:21rem"'; - + $comment->style='class="input_text field_follow_up" style="height:21rem;width:98%"'; + $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"; @@ -269,16 +309,24 @@ function small(p_id_textarea){ $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 ''; echo $editable_comment->input(); - + } else { + echo ''; } - - - } elseif (Document_Option::can_add_comment($ag_id) + } + if ( Document_Option::can_add_comment($ag_id) && Document_Option::option_comment($this->dt_id) == "SOME_FIXED") { - for( $c=0;$c