noalyss-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Noalyss-commit] [noalyss] 12/29: Suivi : description modifiable


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 12/29: Suivi : description modifiable
Date: Wed, 4 Nov 2020 11:08:41 -0500 (EST)

sparkyx pushed a commit to branch master
in repository noalyss.

commit 0f4b05ab461a1a6bd3cac8cae466f1fda2573cee
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Sat Oct 31 00:20:50 2020 +0100

    Suivi : description modifiable
---
 .../class/action_document_type_mtable.class.php    |   7 ++
 include/class/document_option.class.php            |  18 ++++
 .../template/action_document_type_mtable_input.php |  11 ++
 include/template/detail-action.php                 | 114 ++++++++++++++-------
 include/template/follow_up_detail_display.php      |   2 +
 5 files changed, 117 insertions(+), 35 deletions(-)

diff --git a/include/class/action_document_type_mtable.class.php 
b/include/class/action_document_type_mtable.class.php
index f56b1f2..574d8ac 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 388284b..30630b2 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 25f2426..b0a3289 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");
 ?>
         </li> 
+        
+        <li>
+            <?php
+            $description=new ICheckBox("editable_description",1);
+            if ( 
Document_Option::is_enable_editable_description($table->dt_id)) 
$description->set_check(1); 
+                else $description->set_check(0);
+                
+            echo $description->input();
+            echo _("Description modifiable");
+            ?>
+        </li>
         <li>
 <?php
 $i=new ICheckBox("followup_comment",1);
diff --git a/include/template/detail-action.php 
b/include/template/detail-action.php
index 1d64516..cee6c9a 100644
--- a/include/template/detail-action.php
+++ b/include/template/detail-action.php
@@ -242,22 +242,62 @@ function small(p_id_textarea){
     <?php echo $title->input();
     ?>
 </p>
-    <div style="margin-left:10px;">
+    <div>
+        <?php 
+/**********************************************************************************************************************
+ * Start BLOCK Comment and description
+ 
**********************************************************************************************************************/
+?>
    <?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>';
+   // 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%"';
             
-            $comment=new ITextarea("ag_comment_edit");
-            $comment->style='class="input_text field_follow_up" 
style="height:21rem"';
+            $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();
+   }
+   
+   //---------------------------------- 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;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 '<p></p>';
             echo $editable_comment->input();
-            
+        } else {
+            echo '<span class="noprint">';
+            if (  $p_view == 'UPD' && Document_Option::can_add_comment($ag_id) 
&& $add_comment)  {
+            echo '<p></p>';
+            echo $desc->input();
+     
+            }
+            echo '</span>';
         }
-        
-        
-    } 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<count($acomment);$c++){
+        echo h2(_("Commentaire"));
+
+        for( $c=1;$c<count($acomment);$c++){
             if ($c == 0) { $m_desc=_('Description');}
             else
              { $m_desc=_('Commentaire');}
@@ -309,26 +357,22 @@ function small(p_id_textarea){
             }
             $comment=preg_replace('/#([0-9]+)/','<a class="line" 
href="javascript:void()" onclick="view_action(\1,'.
                     Dossier::id().',0)" >\1</a>',$comment);
+            echo '<p></p>';
             echo $comment;
-     }
-}
-echo '<span class="noprint">';
-if (  Document_Option::can_add_comment($ag_id) && 
Document_Option::option_comment($this->dt_id) == "SOME_FIXED")  {
+        } // end for
+        echo '<span class="noprint">';
+        if (  $p_view == 'UPD' && Document_Option::can_add_comment($ag_id))  {
+            echo '<p></p>';
         echo $desc->input();
      
-}
-echo '</span>';
+        }
+        echo '</span>';
+    }
+
+    
+
 ?>
 
-<?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;">
-</p>
-<?php endif; ?>
   </div>
 </div>
 <?php 
@@ -353,9 +397,9 @@ if ( $this->ag_id > 0 && 
Document_Option::is_enable_operation_detail($this->dt_i
   
 
 <div class="myfieldset" id="div_action_attached_doc">
-  <legend>
+  <h2>
      <?php echo _('Pièces attachées')?>
-  </legend>
+  </h2>
     <div class="noprint">
         <?php 
 
/**********************************************************************************************************************
diff --git a/include/template/follow_up_detail_display.php 
b/include/template/follow_up_detail_display.php
index 0b3946f..e10cd34 100644
--- a/include/template/follow_up_detail_display.php
+++ b/include/template/follow_up_detail_display.php
@@ -41,6 +41,8 @@ $option_detail= 
Document_Option::option_operation_detail($document_type);
 $menu=new Default_Menu();
 ?>
 <div id="follow_up_detail">
+    
+    <?php echo h2(_("Détail opération")) ?>
     <?php echo HtmlInput::hidden("nb_item", $article_count); ?>
 
     <table style="width:100%"  id="sold_item">



reply via email to

[Prev in Thread] Current Thread [Next in Thread]