diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 8e6772dec5d..6ca5b2fad02 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -1064,11 +1064,11 @@ class Categorie extends CommonObject */ function print_all_ways($sep = " >> ", $url='') { - $ways = array (); + $ways = array(); foreach ($this->get_all_ways() as $way) { - $w = array (); + $w = array(); foreach ($way as $cat) { if ($url == '') diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 28f81fc490a..82364874cfe 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4407,13 +4407,15 @@ class Form * @param array $selected Array with key+value preselected * @param int $key_in_label 1 pour afficher la key dans la valeur "[key] value" * @param int $value_as_key 1 to use value as key - * @param string $option Valeur de l'option en fonction du type choisi + * @param string $morecss Add more css style * @param int $translate Translate and encode value - * @param int $width Force width of select box. May be used only when using jquery couch. + * @param int $width Force width of select box. May be used only when using jquery couch. Example: 250, 95% + * @param string $moreattrib Add more options on select component. Example: 'disabled="disabled"' + * @param string $elemtype Type of element we show ('category', ...) * @return string HTML multiselect string * @see selectarray */ - static function multiselectarray($htmlname, $array, $selected=array(), $key_in_label=0, $value_as_key=0, $option='', $translate=0, $width=0) + static function multiselectarray($htmlname, $array, $selected=array(), $key_in_label=0, $value_as_key=0, $morecss='', $translate=0, $width=0, $moreattrib='',$elemtype='') { global $conf, $langs; @@ -4423,8 +4425,36 @@ class Form $tmpplugin=empty($conf->global->MAIN_USE_JQUERY_MULTISELECT)?constant('REQUIRE_JQUERY_MULTISELECT'):$conf->global->MAIN_USE_JQUERY_MULTISELECT; print ' '; @@ -4433,7 +4463,7 @@ class Form // Try also magic suggest // Add data-role="none" to disable jmobile decoration - $out = ''."\n"; if (is_array($array) && ! empty($array)) { if ($value_as_key) $array=array_combine($array, $array); @@ -4462,6 +4492,49 @@ class Form } + /** + * Render list of categories linked to object with id $id and type $type + * + * @param int $id Id of object + * @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact'). Old mode (0, 1, 2, ...) is deprecated. + * @param int $rendermode 0=Default, use multiselect. 1=Use text with link + * @return mixed Array of category objects or < 0 if KO + */ + function showCategories($id, $type, $rendermode=0) + { + global $db; + + $cat = new Categorie($db); + $categories = $cat->containing($id, $type); + + if ($rendermode == 1) + { + $toprint = array(); + foreach($categories as $c) + { + $ways = $c->print_all_ways(); + foreach($ways as $way) + { + $toprint[] = img_object('','category').' '.$way; + } + } + return implode('
', $toprint); + } + + if ($rendermode == 0) + { + $cate_arbo = $this->select_all_categories(0, '', 'parent', 64, 0, 1); + foreach($categories as $c) { + $arrayselected[] = $c->id; + } + + return $this->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, '100%', 'disabled="disabled"', 'category'); + } + + return 'ErrorBadValueForParameterRenderMode'; // Should not happened + } + + /** * Return an html string with a select combo box to choose yes or no * diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index 87e22ac8cc9..32e5fa4ba78 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -57,13 +57,14 @@ function product_prepare_head($object) } // Show category tab + /* No more required. Replaced with new multiselect component if (! empty($conf->categorie->enabled) && $user->rights->categorie->lire) { $head[$h][0] = DOL_URL_ROOT."/categories/categorie.php?id=".$object->id.'&type=0'; $head[$h][1] = $langs->trans('Categories'); $head[$h][2] = 'category'; $h++; - } + }*/ // Multilangs if (! empty($conf->global->MAIN_MULTILANGS)) diff --git a/htdocs/langs/fr_FR/other.lang b/htdocs/langs/fr_FR/other.lang index fd87446570e..b8087ff18c8 100644 --- a/htdocs/langs/fr_FR/other.lang +++ b/htdocs/langs/fr_FR/other.lang @@ -12,7 +12,6 @@ Notify_FICHINTER_VALIDATE=Validation fiche intervention Notify_FICHINTER_SENTBYMAIL=Envoi fiche d'intervention par email Notify_BILL_VALIDATE=Validation facture client Notify_BILL_UNVALIDATE=Dévalidation facture client -Notify_ORDER_SUPPLIER_VALIDATE=Commande fournisseur enregistrée Notify_ORDER_SUPPLIER_APPROVE=Approbation commande fournisseur Notify_ORDER_SUPPLIER_REFUSE=Refus commande fournisseur Notify_ORDER_VALIDATE=Validation commande client diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 33edc83dd85..41cb4f7ab23 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1174,7 +1174,7 @@ else $type = $langs->trans('Product'); if ($object->isservice()) $type = $langs->trans('Service'); - print_fiche_titre($langs->trans('Modify').' '.$type.' : '.(is_object($object->oldcopy)?$object->oldcopy->ref:$object->ref), ""); + //print_fiche_titre($langs->trans('Modify').' '.$type.' : '.(is_object($object->oldcopy)?$object->oldcopy->ref:$object->ref), ""); // Main official, simple, and not duplicated code print '
'."\n"; @@ -1182,6 +1182,12 @@ else print ''; print ''; print ''; + + $head=product_prepare_head($object); + $titre=$langs->trans("CardProduct".$object->type); + $picto=($object->type== Product::TYPE_SERVICE?'service':'product'); + dol_fiche_head($head, 'card', $titre, 0, $picto); + print ''; // Ref @@ -1374,7 +1380,7 @@ else foreach($cats as $cat) { $arrayselected[] = $cat->id; } - print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, 250); + print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, '100%'); print ""; // Units @@ -1409,10 +1415,10 @@ else print ''; print '
'; - - print '
'; //} + dol_fiche_end(); + print '
'; print ''; print '     '; @@ -1688,16 +1694,8 @@ else print ' '."\n"; // Categories - print ''.$langs->trans("Categories").''; - $cat = new Categorie($db); - $categories = $cat->containing($object->id,0); - $catarray = $form->select_all_categories(0, '', 'parent', 64, 0, 1); - - $toprint = array(); - foreach($categories as $c) { - $toprint[] = $catarray[$c->id]; - } - print implode('
', $toprint); + print ''.$langs->trans("Categories").''; + print $form->showCategories($object->id,'product'); print ""; print "\n"; diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index b21c457a1d5..f1598d3a87d 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -3054,11 +3054,23 @@ a span.select2-chosen .select2-container .select2-choice { background-image: none; } +.select2-choices .select2-search-choice { + border: 1px solid #aaa !important; +} .select2-results .select2-no-results, .select2-results .select2-searching, .select2-results .select2-ajax-error, .select2-results .select2-selection-limit { background: #FFFFFF; } - +.select2-container-multi.select2-container-disabled .select2-choices { + background-color: #FFFFFF; + background-image: none; + border: none; + cursor: default; +} +.select2-container-multi .select2-choices .select2-search-choice { + margin-top: 2px; + margin-bottom: 2px; +} /* ============================================================================== */ /* JMobile */