From eefb211be797f15e1addc70d5c5abdb39a652f50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 18 Oct 2014 18:48:13 +0200 Subject: [PATCH] Update ajax.lib.php --- htdocs/core/lib/ajax.lib.php | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 6c24b1eac6f..84e1a536465 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -464,10 +464,12 @@ function ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0, * * @param int $object Object to set * @param string $code Name of constant : status or status_buy for product by example + * @param string $text_on Text if on + * @param string $text_off Text if off * @param array $input Array of type->list of CSS element to switch. Example: array('disabled'=>array(0=>'cssid')) * @return void */ -function ajax_object_onoff($object, $code, $input=array()) +function ajax_object_onoff($object, $code, $text_on, $text_off, $input=array()) { global $langs; @@ -532,14 +534,9 @@ function ajax_object_onoff($object, $code, $input=array()) }); }); '; - if ($code=='status') { - $out.= ''.img_picto($langs->trans("ProductStatusNotOnSell"),'switch_off').''; - $out.= ''.img_picto($langs->trans("ProductStatusOnSell"),'switch_on').''; - } - if ($code=='status_buy') { - $out.= ''.img_picto($langs->trans("ProductStatusNotOnBuy"),'switch_off').''; - $out.= ''.img_picto($langs->trans("ProductStatusOnBuy"),'switch_on').''; - } + $out.= ''.img_picto($langs->trans($text_off),'switch_off').''; + $out.= ''.img_picto($langs->trans($text_on),'switch_on').''; + return $out; }