From d7e9c9214426a8a33c652b0a5997144afef0899e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 19 Dec 2015 13:55:27 +0100 Subject: [PATCH] Fix bad link on category Fix cancel button on categories Css enhancement. --- htdocs/categories/categorie.php | 2 +- htdocs/categories/edit.php | 45 +++++++++++++--------- htdocs/categories/index.php | 5 ++- htdocs/categories/viewcat.php | 13 ++++--- htdocs/comm/action/card.php | 2 + htdocs/core/class/html.form.class.php | 2 +- htdocs/core/class/html.formother.class.php | 2 +- htdocs/core/lib/treeview.lib.php | 3 +- htdocs/core/lib/usergroups.lib.php | 14 +++---- htdocs/theme/eldy/style.css.php | 15 ++++++++ htdocs/theme/md/style.css.php | 18 +++++++++ 11 files changed, 84 insertions(+), 37 deletions(-) diff --git a/htdocs/categories/categorie.php b/htdocs/categories/categorie.php index d86a351cdff..1775c14767d 100644 --- a/htdocs/categories/categorie.php +++ b/htdocs/categories/categorie.php @@ -2,7 +2,7 @@ /* Copyright (C) 2001-2007 Rodolphe Quiedeville * Copyright (C) 2005 Brice Davoleau * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2006-2014 Laurent Destailleur + * Copyright (C) 2006-2015 Laurent Destailleur * Copyright (C) 2007 Patrick Raguin * Copyright (C) 2010 Juanjo Menent * Copyright (C) 2013 Florian Henry diff --git a/htdocs/categories/edit.php b/htdocs/categories/edit.php index 9ffd7ac6401..715547c3311 100644 --- a/htdocs/categories/edit.php +++ b/htdocs/categories/edit.php @@ -36,6 +36,7 @@ $ref=GETPOST('ref'); $type=GETPOST('type'); $action=GETPOST('action'); $confirm=GETPOST('confirm'); +$cancel=GETPOST('cancel'); $socid=GETPOST('socid','int'); $label=GETPOST('label'); @@ -54,6 +55,10 @@ if ($id == "") $result = restrictedArea($user, 'categorie', $id, '&category'); $object = new Categorie($db); +if ($id > 0) +{ + $result=$object->fetch($id); +} $extrafields = new ExtraFields($db); $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); @@ -61,52 +66,56 @@ $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('categorycard')); + /* * Actions */ +if ($cancel) +{ + header('Location: '.DOL_URL_ROOT.'/categories/viewcat.php?id='.$object->id.'&type='.$type); + exit; +} + // Action mise a jour d'une categorie if ($action == 'update' && $user->rights->categorie->creer) { - $categorie = new Categorie($db); - $result=$categorie->fetch($id); - - $categorie->label = $label; - $categorie->description = dol_htmlcleanlastbr($description); - $categorie->color = $color; - $categorie->socid = ($socid ? $socid : 'null'); - $categorie->visible = $visible; + $object->label = $label; + $object->description = dol_htmlcleanlastbr($description); + $object->color = $color; + $object->socid = ($socid ? $socid : 'null'); + $object->visible = $visible; if ($parent != "-1") - $categorie->fk_parent = $parent; + $object->fk_parent = $parent; else - $categorie->fk_parent = ""; + $object->fk_parent = ""; - if (empty($categorie->label)) + if (empty($object->label)) { $error++; $action = 'edit'; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors'); } - if (! $error && empty($categorie->error)) + if (! $error && empty($object->error)) { - $ret = $extrafields->setOptionalsFromPost($extralabels,$categorie); + $ret = $extrafields->setOptionalsFromPost($extralabels,$object); if ($ret < 0) $error++; - if (! $error && $categorie->update($user) > 0) + if (! $error && $object->update($user) > 0) { - header('Location: '.DOL_URL_ROOT.'/categories/viewcat.php?id='.$categorie->id.'&type='.$type); + header('Location: '.DOL_URL_ROOT.'/categories/viewcat.php?id='.$object->id.'&type='.$type); exit; } else { - setEventMessages($categorie->error, $categorie->errors, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } else { - setEventMessages($categorie->error, $categorie->errors, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } @@ -176,7 +185,7 @@ print ''; dol_fiche_end(); -print '
'; +print '
 
'; print ''; diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php index ff585212dff..e57cd22d5fd 100644 --- a/htdocs/categories/index.php +++ b/htdocs/categories/index.php @@ -146,6 +146,7 @@ foreach($fulltree as $key => $val) { $categstatic->id=$val['id']; $categstatic->ref=$val['label']; + $categstatic->color=$val['color']; $categstatic->type=$type; $li=$categstatic->getNomUrl(1,'',60); $desc=dol_htmlcleanlastbr($val['description']); @@ -153,8 +154,8 @@ foreach($fulltree as $key => $val) $data[] = array( 'rowid'=>$val['rowid'], 'fk_menu'=>$val['fk_parent'], - 'entry'=>''. + 'entry'=>'
'.$li. - ''.dolGetFirstLineOfText($desc).'
'. + ''. ''. '
color?' style="background: #'.$categstatic->color.';"':' style="background: #aaa"').'>'.$li.''.dolGetFirstLineOfText($desc).''.img_view().'
' ); diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 39f8d62fb7b..3b5d0b64a86 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -1,6 +1,6 @@ - * Copyright (C) 2006-2010 Laurent Destailleur + * Copyright (C) 2006-2015 Laurent Destailleur * Copyright (C) 2007 Patrick Raguin * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2015 Raphaƫl Doursenaud @@ -294,6 +294,7 @@ else print "\n"; } + // List of products or services (type is type of category) if ($object->type == Categorie::TYPE_PRODUCT) { @@ -339,7 +340,7 @@ if ($object->type == Categorie::TYPE_PRODUCT) $var=!$var; print "\t\n"; print ''; - print $prod->getNomUrl(1,'category'); + print $prod->getNomUrl(1); print "\n"; print ''.$prod->label."\n"; // Link to delete from category @@ -390,7 +391,7 @@ if ($object->type == Categorie::TYPE_SUPPLIER) print "\t\n"; print ''; - print $soc->getNomUrl(1,'category_supplier'); + print $soc->getNomUrl(1); print "\n"; // Link to delete from category print ''; @@ -444,7 +445,7 @@ if($object->type == Categorie::TYPE_CUSTOMER) $var=!$var; print "\t\n"; print ''; - print $soc->getNomUrl(1,'category'); + print $soc->getNomUrl(1); print "\n"; // Link to delete from category print ''; @@ -497,7 +498,7 @@ if ($object->type == Categorie::TYPE_MEMBER) print "\t\n"; print ''; $member->ref=$member->login; - print $member->getNomUrl(1,0,'category'); + print $member->getNomUrl(1,0); print "\n"; print ''.$member->lastname."\n"; print ''.$member->firstname."\n"; @@ -526,7 +527,7 @@ if ($object->type == Categorie::TYPE_MEMBER) } } -//Categorie contact +// Categorie contact if($object->type == Categorie::TYPE_CONTACT) { $contacts = $object->getObjectsInCateg("contact"); diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 0f561622bd1..440a5d11833 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1081,8 +1081,10 @@ if ($id > 0) print ''; + print '

'; + print ''; // Thirdparty - Contact diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 4b86fa378cd..6d8eaf3c495 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4909,7 +4909,7 @@ class Form $ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formated text foreach($ways as $way) { - $toprint[] = '
  • color?' style="background: #'.$c->color.';"':'').'>'.img_object('','category').' '.$way.'
  • '; + $toprint[] = '
  • color?' style="background: #'.$c->color.';"':' style="background: #aaa"').'>'.img_object('','category').' '.$way.'
  • '; } } return '
      '.implode(' ', $toprint).'
    '; diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 51cf8a9c7a7..d6f1521e49d 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -598,7 +598,7 @@ class FormOther include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; $color = colorArrayToHex(colorStringToArray($color,array()),''); - if ($color) print ''; + if ($color) print ''; else print $textifnotdefined; } diff --git a/htdocs/core/lib/treeview.lib.php b/htdocs/core/lib/treeview.lib.php index b3f3e16a3bd..e900931037e 100644 --- a/htdocs/core/lib/treeview.lib.php +++ b/htdocs/core/lib/treeview.lib.php @@ -98,6 +98,7 @@ function tree_showpad(&$fulltree,$key,$silent=0) /** * Recursive function to output menu tree.
    • ...
    + * It is also used for the tree of categories. * Note: To have this function working, check you have loaded the js and css for treeview. * $arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', * '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js'); @@ -132,7 +133,7 @@ function tree_recur($tab, $pere, $rang, $iddivjstree='iddivjstree') print '
      '; } - if ($rang > 10) return; // Protection contre boucle infinie + if ($rang > 50) return; // Protect against infinite loop. Max 50 depth //ballayage du tableau $sizeoftab=count($tab); diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index c1d13b49429..ed95bdc4023 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -410,7 +410,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) else { $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''); - if ($color) print ''; + if ($color) print ''; else print ''; } if ($edit) print '
      ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; @@ -430,7 +430,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) else { $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKBODY,array()),''); - if ($color) print ''; + if ($color) print ''; else print $langs->trans("Default"); } print '   ('.$langs->trans("Default").': ffffff, '.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; @@ -455,7 +455,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) else { $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''); - if ($color) print ''; + if ($color) print ''; else print ''; } if ($edit) print '
      ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; @@ -474,7 +474,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) else { $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''); - if ($color) print ''; + if ($color) print ''; else print $langs->trans("Default"); } print '   ('.$langs->trans("Default").': 7882aa, '.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; @@ -567,7 +567,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER,array()),''); if ($color) { - if ($color != 'edf4fb') print ''; + if ($color != 'edf4fb') print ''; else print $langs->trans("Default"); } else print $langs->trans("None"); @@ -595,7 +595,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) else { $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''); - if ($color) print ''; + if ($color) print ''; else print ''; } if ($edit) print '
      ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; @@ -614,7 +614,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) else { $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK,array()),''); - if ($color) print ''; + if ($color) print ''; else print $langs->trans("Default"); } print '   ('.$langs->trans("Default").': 000078, '.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index e31cbb4e5d4..e2f40105c4a 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -636,6 +636,7 @@ div.ficheaddleft { padding-right: 1px; padding-top: 1px; padding-bottom: 1px; + width: 44px; } div.attacharea { padding-top: 10px; @@ -3642,7 +3643,21 @@ a span.select2-chosen .noborderoncategories { border: none !important; + border-radius: 5px !important; + box-shadow: none; + -webkit-box-shadow: none !important; + box-shadow: none !important; + color: #fff !important; } +span.noborderoncategories a, li.noborderoncategories a { + color: #fff; + line-height: normal; + vertical-align: top; +} +span.noborderoncategories { + padding: 3px 5px 0px 5px; +} + /* ============================================================================== */ /* Multiselect with checkbox */ diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index dd93e172366..742a0a93a19 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -686,6 +686,7 @@ div.ficheaddleft { padding-right: 1px; padding-top: 1px; padding-bottom: 1px; + width: 44px; } div.attacharea { padding-top: 10px; @@ -3482,6 +3483,23 @@ a span.select2-chosen overflow: hidden; } +.noborderoncategories { + border: none !important; + border-radius: 5px !important; + box-shadow: none; + -webkit-box-shadow: none !important; + box-shadow: none !important; + color: #fff !important; +} +span.noborderoncategories a, li.noborderoncategories a { + color: #fff; + line-height: normal; + vertical-align: top; +} +span.noborderoncategories { + padding: 3px 5px 0px 5px; +} + /* ============================================================================== */ /* Multiselect with checkbox */