noalyss-commit
[Top][All Lists]
Advanced

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

[Noalyss-commit] [noalyss] 54/219: NEW : ICard , you can hide or show th


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 54/219: NEW : ICard , you can hide or show the accounting in the search box with the functions ICard->hide_accounting and ICard->show_accounting
Date: Mon, 18 Dec 2017 13:22:37 -0500 (EST)

sparkyx pushed a commit to branch master
in repository noalyss.

commit 0e18bd15f2d51b90679996073094c8c194c36a52
Author: Dany De Bontridder <address@hidden>
Date:   Sat Sep 16 11:48:42 2017 +0200

    NEW : ICard , you can hide or show the accounting
    in the search box with the functions ICard->hide_accounting
    and ICard->show_accounting
---
 html/js/card.js                  | 16 +++++++++++++++-
 include/ajax/ajax_card.php       |  3 ++-
 include/lib/icard.class.php      | 15 ++++++++++++++-
 include/template/card_result.php |  9 ++++++++-
 4 files changed, 39 insertions(+), 4 deletions(-)

diff --git a/html/js/card.js b/html/js/card.js
index 8b4fa93..ddd44cb 100644
--- a/html/js/card.js
+++ b/html/js/card.js
@@ -64,6 +64,7 @@ function boxsearch_card(p_dossier)
  *  - inp input text to update with the quickcode
  *  - label field to update with the name
  *  - ctl the id to fill with the HTML answer (ending with _content)
+ *  - acc 1 if accounting are visible
  */
 function search_card(obj)
 {
@@ -86,10 +87,17 @@ function search_card(obj)
                jrn=-1;
            }
         }
+        var accvis=obj.accvis;
+        if ( accvis == undefined ) {
+            accvis=0;
+        } else {
+            accvis=obj.accvis;
+        }
        var query=encodeJSON({'gDossier':gDossier,
                       'inp':inp,'label':label,'price':price,'tvaid':tvaid,
                       'ctl':'search_card','op2':'fs','jrn':jrn,
-                      'typecard':typecard,'query':string_to_search,'op':'card'
+                      'typecard':typecard,'query':string_to_search,'op':'card',
+                      'accvis':accvis
                              });
        if (  $('search_card') ) {
            removeDiv('search_card');
@@ -259,6 +267,12 @@ function search_get_card(obj)
     {
         queryString+="&ctl="+obj.ctl;
     }
+    if ( obj.elements['accvis'] ) 
+    {
+        queryString+="&accvis="+$F(accvis);
+    } else {
+        queryString+="&accvis=0";
+    }
     $('asearch').innerHTML=loading();
     var action=new Ajax.Request ( 'ajax_misc.php',
                                   {
diff --git a/include/ajax/ajax_card.php b/include/ajax/ajax_card.php
index 0685c92..59b51da 100644
--- a/include/ajax/ajax_card.php
+++ b/include/ajax/ajax_card.php
@@ -51,6 +51,7 @@
  * - ctl (to return)
  * - popup
  * - ref if we want to refresh the window
+ * - acc is accounting is visible or not
  *\see fiche fiche::Save constant.php
  */
 if ( ! defined('ALLOWED')) die (_('Accès non autorisé'));
@@ -350,7 +351,7 @@ case 'fs':
        $r.='</span>';
     $r.=dossier::hidden().HtmlInput::hidden('op','fs');
     $array=array();
-    foreach (array('query','inp','jrn','label','typecard','price','tvaid') as 
$i)
+    foreach 
(array('accvis','query','inp','jrn','label','typecard','price','tvaid') as $i)
     {
         if  (isset(${$i}) )
         {
diff --git a/include/lib/icard.class.php b/include/lib/icard.class.php
index 6d76216..2b809c9 100644
--- a/include/lib/icard.class.php
+++ b/include/lib/icard.class.php
@@ -132,6 +132,19 @@ class ICard extends HtmlInput
         $this->choice_create=1;
        $this->autocomplete=1;
         $this->style=' style="vertical-align:50%"';
+        $this->accvis=1; //!< account_visible =1 otherwise 0
+    }
+    /**
+     * @brief in the search box, the accounting will be hidden
+     */
+    function hide_accounting() {
+        $this->accvis=0;
+    }
+    /**
+     * @brief in the search box, the accounting will be shown it is the default
+     */
+    function show_accounting() {
+        $this->accvis=1;
     }
     /*!\brief set the javascript callback function
      * by default it is update_value called BEFORE the querystring is send
@@ -297,7 +310,7 @@ class ICard extends HtmlInput
         if ( $this->readOnly==true) return '';
                if ( ! isset($this->id )) $this->id=$this->name;
         $a="";
-        foreach (array('typecard','jrn','label','price','tvaid') as $att)
+        foreach (array('typecard','jrn','label','price','tvaid','accvis') as 
$att)
         {
             if (isset($this->$att) )
                 $a.="this.".$att."='".$this->$att."';";
diff --git a/include/template/card_result.php b/include/template/card_result.php
index 3bf77d4..6c38fad 100644
--- a/include/template/card_result.php
+++ b/include/template/card_result.php
@@ -9,14 +9,21 @@
 <?php for ($i=0;$i<sizeof($array);$i++) : ?>
     <?php $class=($i%2==0)?'odd':'even';?>
 <tr class="<?php echo $class;?>">
-<td style="padding-right:55px">
+    <td style="padding-right:55px">
 <a href="javascript:void(0)" class="detail" onclick="<?php echo 
$array[$i]['javascript']?>">
 <?php echo $array[$i]['quick_code']?>
 </a>
 </td>
+<?php 
+//---------------------------------------------------------------------------
+// if accvis == 1 then show the accounting 
+//---------------------------------------------------------------------------
+if ( $accvis == 1 ) :
+    ?>
 <td>
    <?php echo 
HtmlInput::history_account($array[$i]['accounting'],$array[$i]['accounting']); 
?>
 </td>
+<?php endif;?>
 <td>
    <?php echo $array[$i]['name']?>
 </td>



reply via email to

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