noalyss-commit
[Top][All Lists]
Advanced

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

[Noalyss-commit] [noalyss] 02/03: Task #0002192: Pouvoir agrandir les de


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 02/03: Task #0002192: Pouvoir agrandir les descriptions lors de vente ,d'achat et opérations diverses
Date: Sat, 10 Sep 2022 14:35:44 -0400 (EDT)

sparkyx pushed a commit to branch master
in repository noalyss.

commit 521ba9ee45b70cc042112ae522fc18a8986461b0
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Sat Sep 10 19:56:19 2022 +0200

    Task #0002192: Pouvoir agrandir les descriptions lors de vente ,d'achat et 
opérations diverses
---
 html/js/noalyss_script.js               | 18 ++++++++++++++
 include/class/acc_ledger.class.php      | 44 ++++++++++++++++++---------------
 include/class/acc_ledger_sale.class.php |  3 ++-
 include/lib/icon_action.class.php       | 14 +++++++++++
 include/operation_ods_new.inc.php       |  4 ++-
 include/template/form_ledger_detail.php |  4 +--
 scenario/icon_actionTest.php            |  4 +++
 7 files changed, 67 insertions(+), 24 deletions(-)

diff --git a/html/js/noalyss_script.js b/html/js/noalyss_script.js
index 1cdc38f02..60b186f52 100644
--- a/html/js/noalyss_script.js
+++ b/html/js/noalyss_script.js
@@ -4127,3 +4127,21 @@ function reconnect(){
         }
     });
 }
+
+/**
+ * @brief enlarge an INPUT TEXT
+ *
+ */
+function enlarge_text(p_domid,p_size) {
+    try {
+        var element= document.getElementById(p_domid);
+        if ( !element) {console.error (`enlarge text doesn't exist 
[${p_domid}]`)}
+        var current_size=parseInt(element.getAttribute('size'));
+        element.setAttribute('size',current_size+parseInt(p_size));
+    } catch (e) {
+        console.error(`enlarge text fails with ${p_domid} ${p_size} `);
+        console.error(e.message);
+    }
+
+
+}
\ No newline at end of file
diff --git a/include/class/acc_ledger.class.php 
b/include/class/acc_ledger.class.php
index 80bec9839..6d76cf302 100644
--- a/include/class/acc_ledger.class.php
+++ b/include/class/acc_ledger.class.php
@@ -926,37 +926,41 @@ class Acc_Ledger  extends jrn_def_sql
         $wPJ->value=(isset($e_pj))?$e_pj:$default_pj;
         $ret.='</tr>';
         $ret.='<tr >';
-        $ret.='<td colspan="2" style="width:auto"> '._('Pièce').' : 
'.$wPJ->input();
-        $ret.=HtmlInput::hidden('e_pj_suggest', $default_pj);
-        $ret.='</tr>';
+        $ret.='<td style="width:auto"> '._('Pièce').' </td> ';
+        $ret.=td($wPJ->input());
         $ret.='</td>';
-
+        $ret.='</tr>';
         $ret.='<tr>';
-        $ret.='<td colspan="2" style="width:auto">';
-        $ret.=_('Libellé');
+        $ret.=td(_('Libellé'));
+        $ret.='<td>';
+
         $wDescription=new IText('desc');
         $wDescription->readonly=$p_readonly;
-        $wDescription->size="50";
+        $wDescription->size = (empty($desc))?60:strlen($desc)+5;
+        $wDescription->size = ($wDescription->size<60)?60:$wDescription->size;
         $wDescription->value=(isset($desc))?$desc:'';
-
         $ret.=$wDescription->input();
+        $ret.=Icon_Action::longer("desc",20);
         $ret.='</td>';
         $ret.='</tr>';
+        // Currency
+        $currency_select = $this->CurrencyInput("currency_code", 
"p_currency_rate" , "p_currency_euro");
+        
$currency_select->selected=$http->request('p_currency_code','string',0);
+
+        $currency_input=new INum("p_currency_rate");
+        $currency_input->prec=6;
+        $currency_input->id="p_currency_rate";
+        $currency_input->value=$http->request('p_currency_rate','string',1);
+        $ret.=tr(td(_("Devise")).td($currency_select->input().
+            
$currency_input->change('CurrencyComputeMisc(\'p_currency_rate\',\'p_currency_euro\');')));
+        $ret.='</div>';
+        $currency=new Acc_Currency($this->db,0);
 
         $ret.='</table>';
 
-        // Currency
-         $currency_select = $this->CurrencyInput("currency_code", 
"p_currency_rate" , "p_currency_euro");
-         
$currency_select->selected=$http->request('p_currency_code','string',0);
-         
-         $currency_input=new INum("p_currency_rate");
-         $currency_input->prec=6;
-         $currency_input->id="p_currency_rate";
-         $currency_input->value=$http->request('p_currency_rate','string',1);
-         $ret.=_("Devise")." ".$currency_select->input();
-         
$ret.=$currency_input->change('CurrencyComputeMisc(\'p_currency_rate\',\'p_currency_euro\');');
-         $currency=new Acc_Currency($this->db,0);
-         
+        $ret.=HtmlInput::hidden('e_pj_suggest', $default_pj);
+
+
          
         $nb_row=(isset($nb_item) )?$nb_item:$this->nb;
 
diff --git a/include/class/acc_ledger_sale.class.php 
b/include/class/acc_ledger_sale.class.php
index 9213986f8..9ca68cd19 100644
--- a/include/class/acc_ledger_sale.class.php
+++ b/include/class/acc_ledger_sale.class.php
@@ -1348,7 +1348,8 @@ EOF;
         $Commentaire = new IText();
         $Commentaire->table = 0;
         $Commentaire->setReadOnly(false);
-        $Commentaire->size = 60;
+        $Commentaire->size = (empty($e_comm))?60:strlen($e_comm)+5;
+        $Commentaire->size = ($Commentaire->size<60)?60:$Commentaire->size;
         $Commentaire->tabindex = 3;
 
         $label = Icon_Action::infobulle(1);
diff --git a/include/lib/icon_action.class.php 
b/include/lib/icon_action.class.php
index 3d7f7afe9..6e865164a 100644
--- a/include/lib/icon_action.class.php
+++ b/include/lib/icon_action.class.php
@@ -447,4 +447,18 @@ class Icon_Action
             uniqid(),$p_js,"&#xf142;");
         return $r;
     }
+
+    /**
+     * @brief Increase size of input_text (p_domid) with p_domid
+     * @param $p_domid domid of the input "text" element
+     * @param $p_size   size of the element
+     * @return string HTML string
+     */
+    static function longer($p_domid,$p_size) {
+        $r=sprintf('<span id="%s_longer" '.
+        ' onclick="enlarge_text(\'%s\',\'%s\') "'.
+        ' class="icon smallicon">%s</span>',
+        $p_domid,$p_domid,$p_size,"&#xe81c");
+        return $r;
+    }
 }
diff --git a/include/operation_ods_new.inc.php 
b/include/operation_ods_new.inc.php
index 1872c0cd4..5b5197a0b 100644
--- a/include/operation_ods_new.inc.php
+++ b/include/operation_ods_new.inc.php
@@ -27,7 +27,7 @@
 if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
 
 
-global $g_user,$g_parameter;
+global $g_user,$g_parameter,$http;
 $cn=Dossier::connect();
 
 $id_predef = $http->request('p_jrn_predef','number',-1);
@@ -67,6 +67,8 @@ if ( isset ($_GET['action']) && ! isset($_POST['correct']) && 
! isset($correct)
             {
                 $op->set_od_id($http->request('pre_def','number'));
                 $p_post=$op->compute_array();
+                // operation description are not in the same variable
+                $p_post['desc']=$p_post['e_comm'];
             }
        }
 }
diff --git a/include/template/form_ledger_detail.php 
b/include/template/form_ledger_detail.php
index 493a8e320..12ad9303b 100644
--- a/include/template/form_ledger_detail.php
+++ b/include/template/form_ledger_detail.php
@@ -61,10 +61,10 @@
     <tr>
         <td>
              <?php echo _('Libellé')?> 
-             <?php echo $label ; ?> 
+             <?php echo $label ; ?>
         </td>
         <td>
-            <?php echo $f_desc?>
+            <?php echo $f_desc, Icon_Action::longer("e_comm",20)?>
         </td>
     </tr>
     <tr>
diff --git a/scenario/icon_actionTest.php b/scenario/icon_actionTest.php
index 5823bc2ab..f35ea25a9 100644
--- a/scenario/icon_actionTest.php
+++ b/scenario/icon_actionTest.php
@@ -107,4 +107,8 @@ include_once NOALYSS_INCLUDE."/lib/icon_action.class.php";
 </p>
 <p>
     Option <?php echo Icon_Action::option( "alert('test')")?>
+</p>
+<p>
+    Increase INPUT TEXT Element
+    <input type="text" id="text_element" size="20"><?php echo 
Icon_Action::longer("text_element",50)?>
 </p>
\ No newline at end of file



reply via email to

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