diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 83f10b469c0..b21aab1af0e 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -203,7 +203,7 @@ class Form $ret.=$doleditor->Create(1); } $ret.=''; - + $ret.=''; $ret.=''; if (preg_match('/ckeditor|textarea/',$typeofdata)) $ret.='
'."\n"; @@ -493,7 +493,7 @@ class Form /** * Generate select HTML to choose massaction - * + * * @param string $selected Selected value * @param int $arrayofaction array('code'=>'label', ...). The code is the key stored into the GETPOST('massaction') when submitting action. * @return string Select list @@ -501,9 +501,9 @@ class Form function selectMassAction($selected, $arrayofaction) { global $conf,$langs,$hookmanager; - + if (count($arrayofaction) == 0) return; - + $disabled=0; $ret='
'; $ret.='
'; - + $ret.=' '; - + return $ret; } - + /** * Return combo list of activated countries, into language of user * @@ -1029,9 +1029,9 @@ class Form $textifempty=''; // Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. //if (! empty($conf->use_javascript_ajax) || $forcecombo) $textifempty=''; - if (! empty($conf->global->COMPANY_USE_SEARCH_TO_SELECT)) + if (! empty($conf->global->COMPANY_USE_SEARCH_TO_SELECT)) { - if ($showempty && ! is_numeric($showempty)) $textifempty=$langs->trans($showempty); + if ($showempty && ! is_numeric($showempty)) $textifempty=$langs->trans($showempty); else $textifempty.=$langs->trans("All"); } if ($showempty) $out.= ''."\n"; @@ -1350,7 +1350,7 @@ class Form * @param integer $show_every 0=default list, 1=add also a value "Everybody" at beginning of list * @param string $enableonlytext If option $enableonly is set, we use this text to explain into label why record is disabled. Not used if enableonly is empty. * @param string $morecss More css - * @param int $noactive Show only active users (this will also happened whatever is this option if USER_HIDE_INACTIVE_IN_COMBOBOX is on). + * @param int $noactive Show only active users (this will also happened whatever is this option if USER_HIDE_INACTIVE_IN_COMBOBOX is on). * @return string HTML select string * @see select_dolgroups */ @@ -1881,7 +1881,7 @@ class Form $outlabel=$objp->label; $outdesc=$objp->description; $outbarcode=$objp->barcode; - + $outtype=$objp->fk_product_type; $outdurationvalue=$outtype == Product::TYPE_SERVICE?substr($objp->duration,0,dol_strlen($objp->duration)-1):''; $outdurationunit=$outtype == Product::TYPE_SERVICE?substr($objp->duration,-1):''; @@ -1898,13 +1898,13 @@ class Form $opt.= $objp->ref; if ($outbarcode) $opt.=' ('.$outbarcode.')'; $opt.=' - '.dol_trunc($label,$maxlengtharticle).' - '; - + $objRef = $objp->ref; if (! empty($filterkey) && $filterkey != '') $objRef=preg_replace('/('.preg_quote($filterkey).')/i','$1',$objRef,1); $outval.=$objRef; if ($outbarcode) $outval.=' ('.$outbarcode.')'; $outval.=' - '.dol_trunc($label,$maxlengtharticle).' - '; - + $found=0; // Multiprice @@ -1986,9 +1986,9 @@ class Form } // Price by customer - if (empty($hidepriceinlabel) && !empty($conf->global->PRODUIT_CUSTOMER_PRICES)) + if (empty($hidepriceinlabel) && !empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { - if (!empty($objp->idprodcustprice)) + if (!empty($objp->idprodcustprice)) { $found = 1; @@ -2032,7 +2032,12 @@ class Form if (! empty($conf->stock->enabled) && isset($objp->stock) && $objp->fk_product_type == 0) { $opt.= ' - '.$langs->trans("Stock").':'.$objp->stock; - $outval.=' - '.$langs->transnoentities("Stock").':'.$objp->stock; + + if ($objp->stock > 0) { + $outval.= ' - '.$langs->transnoentities("Stock").':'.$objp->stock.''; + }elseif ($objp->stock <= 0) { + $outval.= ' - '.$langs->transnoentities("Stock").':'.$objp->stock.''; + } } if ($outdurationvalue && $outdurationunit) @@ -2066,7 +2071,7 @@ class Form { global $langs,$conf; global $price_level, $status, $finished; - + $selected_input_value=''; if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)) { @@ -2198,11 +2203,11 @@ class Form if ($filterkey && $filterkey != '') $label=preg_replace('/('.preg_quote($filterkey).')/i','$1',$label,1); $opt.=$objp->ref; - if (! empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) + if (! empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) $opt.=' ('.$objp->ref_fourn.')'; $opt.=' - '; $outval.=$objRef; - if (! empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) + if (! empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) $outval.=' ('.$objRefFourn.')'; $outval.=' - '; $opt.=dol_trunc($label, 72).' - '; @@ -2805,7 +2810,7 @@ class Form { // If not good status if ($active >= 0 && $arraytypes['active'] != $active) continue; - + // On passe si on a demande de filtrer sur des modes de paiments particuliers if (count($filterarray) && ! in_array($arraytypes['type'],$filterarray)) continue; @@ -3168,13 +3173,13 @@ class Form $langs->load("categories"); include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; - + // For backward compatibility if (is_numeric($type)) { dol_syslog(__METHOD__ . ': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING); } - + $cat = new Categorie($this->db); $cate_arbo = $cat->get_full_arbo($type,$excludeafterid); @@ -3794,7 +3799,7 @@ class Form } } } - + /** * Show form with multicurrency code * @@ -3824,7 +3829,7 @@ class Form print !empty($selected) ? currency_name($selected,1) : ' '; } } - + /** * Show form with multicurrency rate * @@ -3837,7 +3842,7 @@ class Form function form_multicurrency_rate($page, $rate='', $htmlname='multicurrency_tx', $currency='') { global $langs, $mysoc, $conf; - + if ($htmlname != "none") { print '
'; @@ -4068,7 +4073,7 @@ class Form /** * Return array of currencies in user language - * + * * @param string $selected preselected currency code * @param string $htmlname name of HTML select list * @param integer $useempty 1=Add empty line @@ -4081,7 +4086,7 @@ class Form $langs->loadCacheCurrencies(''); // Load ->cache_currencies $TCurrency = array(); - + $sql = 'SELECT code FROM '.MAIN_DB_PREFIX.'multicurrency'; $sql.= " WHERE entity IN ('".getEntity('mutlicurrency')."')"; $resql = $db->query($sql); @@ -4089,7 +4094,7 @@ class Form { while ($obj = $db->fetch_object($resql)) $TCurrency[$obj->code] = $obj->code; } - + $out=''; $out.= ''; return $out; } - + /** * Load into the cache vat rates of a country * @@ -4204,7 +4209,7 @@ class Form $defaulttx=preg_replace('/\s*\(.*\)/','',$defaulttx); } //var_dump($selectedrate.'-'.$defaulttx.'-'.$defaultnpr.'-'.$defaultcode); - + // Check parameters if (is_object($societe_vendeuse) && ! $societe_vendeuse->country_code) { @@ -4263,7 +4268,7 @@ class Form // Now we get list $num = $this->load_cache_vatrates($code_country); // If no vat defined, return -1 with message into this->error - + if ($num > 0) { // Definition du taux a pre-selectionner (si defaulttx non force et donc vaut -1 ou '') @@ -4304,7 +4309,7 @@ class Form $return.= '"'; if ($defaultcode) // If defaultcode is defined, we used it in priority to select combo option instead of using rate+npr flag { - if ($defaultcode == $rate['code']) $return.= ' selected'; + if ($defaultcode == $rate['code']) $return.= ' selected'; } elseif ($rate['txtva'] == $defaulttx && $rate['nprtva'] == $defaultnpr) { @@ -4313,7 +4318,7 @@ class Form $return.= '>'.vatrate($rate['libtva']); //$return.=($rate['code']?' '.$rate['code']:''); $return.= (empty($rate['code']) && $rate['nprtva']) ? ' *': ''; // We show the * (old behaviour only if new vat code is not used) - + $return.= ''; } @@ -4617,7 +4622,7 @@ class Form { $tmparray=dol_getdate($adddateof); $retstring.=' -