[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 69/119: Improve Input_Switch , do not echo bu
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 69/119: Improve Input_Switch , do not echo but returns string |
Date: |
Mon, 26 Oct 2020 18:27:24 -0400 (EDT) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 30688bda9d5edda7a8da833ad97bef4573b6fce9
Author: Dany De Bontridder <danydb@noalyss.eu>
AuthorDate: Sat Oct 10 19:35:10 2020 +0200
Improve Input_Switch , do not echo but returns string
---
include/lib/input_switch.class.php | 15 ++++++++-------
include/template/param_jrn.php | 2 +-
scenario/HtmlInput.test.php | 8 ++++----
3 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/include/lib/input_switch.class.php
b/include/lib/input_switch.class.php
index ba67d7f..3d8345c 100644
--- a/include/lib/input_switch.class.php
+++ b/include/lib/input_switch.class.php
@@ -45,6 +45,7 @@ class InputSwitch extends HtmlInput
function input($p_name=NULL, $p_value=NULL)
{
+ $r="";
if ($p_name!=NULL)
$this->value_container=$p_name;
if ($p_value!==NULL)
@@ -56,25 +57,25 @@ class InputSwitch extends HtmlInput
throw new Exception(_("Valeur invalide"),1);
}
if ($this->readOnly == TRUE) {
- $this->display();
- return;
+ return $this->display();
}
- echo HtmlInput::hidden($this->value_container, $this->value);
+ $r.= HtmlInput::hidden($this->value_container, $this->value);
$this->javascript=sprintf('toggle_onoff(\'%s\',\'%s\');%s;',$this->icon,$this->value_container,$this->javascript);
if ($this->value=='1') {
- echo Icon_Action::iconon($this->icon, $this->javascript);
+ $r.=Icon_Action::iconon($this->icon, $this->javascript);
} else {
- echo Icon_Action::iconoff($this->icon, $this->javascript);
+ $r.=Icon_Action::iconoff($this->icon, $this->javascript);
}
+ return $r;
}
function display()
{
if ($this->value=='1') {
- echo Icon_Action::iconon($this->icon, "");
+ return Icon_Action::iconon($this->icon, "");
} else {
- echo Icon_Action::iconoff($this->icon, "");
+ return Icon_Action::iconoff($this->icon, "");
}
}
diff --git a/include/template/param_jrn.php b/include/template/param_jrn.php
index 6c73529..1d0ce32 100644
--- a/include/template/param_jrn.php
+++ b/include/template/param_jrn.php
@@ -98,7 +98,7 @@ if ( $type == 'ACH' || $type == 'VEN'||$new):
<td>
<?php
$negative->javascript="toggle_row_warning_enable('negative_amount','row_warning')";
- $negative->input();
+ echo $negative->input();
?>
</td>
</tr>
diff --git a/scenario/HtmlInput.test.php b/scenario/HtmlInput.test.php
index 027f4eb..363a8fd 100644
--- a/scenario/HtmlInput.test.php
+++ b/scenario/HtmlInput.test.php
@@ -61,25 +61,25 @@ $http=new HttpInput();
<pre>
$input_switch=new InputSwitch('input_switch_value',<?php echo
$http->get("input_switch_value","string","0")?>);
- $input_switch->input();
+ echo $input_switch->input();
</pre>
input_switch
<?php
$input_switch=new
InputSwitch('input_switch_value',$http->get("input_switch_value","string","0"));
- $input_switch->input();
+ echo $input_switch->input();
?>
<h2>ReadOnly</h2>
<pre>
$input_switch=new InputSwitch('input_switch_readonly',0);
$input_switch->readOnly=TRUE;
- $input_switch->input();
+ echo $input_switch->input();
</pre>
input_switch
<?php
$input_switch=new InputSwitch('input_switch_readonly',0);
$input_switch->readOnly=TRUE;
- $input_switch->input();
+ echo $input_switch->input();
?>
<h1>Submit</h1>
<pre>
- [Noalyss-commit] [noalyss] 75/119: Fix : by default new contact options were not added to document_type, (continued)
- [Noalyss-commit] [noalyss] 75/119: Fix : by default new contact options were not added to document_type, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 63/119: Bug #1839 : : accentuated character broken, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 76/119: Add : upgrade scrip added, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 24/119: Merge branch 'master' of gitlab.noalyss.eu:noalyss/noalyss, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 25/119: erge branch 'dev-7400-7500', Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 33/119: doc, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 41/119: Rewriting of Predefined Operation. You can add new Predefined Operation, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 51/119: Add group of tag to an action, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 59/119: prevent divide by zero in formula, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 65/119: Rewriting of card attributes, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 69/119: Improve Input_Switch , do not echo but returns string,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 66/119: Multiple contact Search on selected attribute, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 77/119: fix upgrade145.sql , default value must be 1 for actif, sql wrong, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 78/119: Fix FollowUp : price Purchase or Sale, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 79/119: protect, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 86/119: Follow up cosmetic add title to anchor, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 87/119: Document Type : CFGACTION cannot add new document, fix order in dialog box, Fix= cannot delete action cause cascade on action_person, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 89/119: upgrade db 146, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 91/119: Follow-up correct link, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 97/119: Fix : generate document remove "extract", Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 105/119: Follow-Up Cosmetic, form before creating a new follow-up action, Dany De Bontridder, 2020/10/26