diff --git a/htdocs/categories/card.php b/htdocs/categories/card.php
index 814badf95a7..6c4c1a39bdd 100644
--- a/htdocs/categories/card.php
+++ b/htdocs/categories/card.php
@@ -29,6 +29,7 @@
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
$langs->load("categories");
@@ -46,6 +47,7 @@ $urlfrom = GETPOST('urlfrom','alpha');
$socid=GETPOST('socid','int');
$label=GETPOST('label');
$description=GETPOST('description');
+$color=GETPOST('color');
$visible=GETPOST('visible');
$parent=GETPOST('parent');
@@ -124,6 +126,7 @@ if ($action == 'add' && $user->rights->categorie->creer)
$object->label = $label;
+ $object->color = $color;
$object->description = dol_htmlcleanlastbr($description);
$object->socid = ($socid ? $socid : 'null');
$object->visible = $visible;
@@ -210,6 +213,7 @@ if (($action == 'add' || $action == 'confirmed') && $user->rights->categorie->cr
*/
$form = new Form($db);
+$formother = new FormOther($db);
llxHeader("","",$langs->trans("Categories"));
@@ -250,6 +254,11 @@ if ($user->rights->categorie->creer)
$doleditor->Create();
print '';
+ // Color
+ print '
| '.$langs->trans("Color").' | ';
+ print $formother->select_color($color,'color');
+ print ' |
';
+
// Parent category
print '| '.$langs->trans("AddIn").' | ';
print $form->select_all_categories($type, $catorigin);
diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php
index acc569dcec3..ac051a45666 100644
--- a/htdocs/categories/class/categorie.class.php
+++ b/htdocs/categories/class/categorie.class.php
@@ -368,7 +368,7 @@ class Categorie extends CommonObject
$sql = "UPDATE ".MAIN_DB_PREFIX."categorie";
$sql.= " SET label = '".$this->db->escape($this->label)."',";
- $sql.= " description = '".$this->db->escape($this->description)."'";
+ $sql.= " description = '".$this->db->escape($this->description)."',";
$sql.= " color = '".$this->db->escape($this->color)."'";
if (! empty($conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER))
{
diff --git a/htdocs/categories/edit.php b/htdocs/categories/edit.php
index 228f02eb881..83d3547d1b8 100644
--- a/htdocs/categories/edit.php
+++ b/htdocs/categories/edit.php
@@ -27,6 +27,7 @@
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
$langs->load("categories");
@@ -84,15 +85,17 @@ if ($action == 'update' && $user->rights->categorie->creer)
if (empty($categorie->label))
{
+ $error++;
$action = 'create';
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Label")), 'errors');
}
if (empty($categorie->description))
{
+ $error++;
$action = 'create';
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Description")), 'errors');
}
- if (empty($categorie->error))
+ if (! $error && empty($categorie->error))
{
$ret = $extrafields->setOptionalsFromPost($extralabels,$categorie);
if ($ret < 0) $error++;
@@ -120,6 +123,7 @@ if ($action == 'update' && $user->rights->categorie->creer)
*/
$form = new Form($db);
+$formother = new FormOther($db);
llxHeader("","",$langs->trans("Categories"));
@@ -140,14 +144,14 @@ dol_fiche_head('');
print '';
// Ref
-print '| ';
+print ' | | ';
print $langs->trans("Ref").' | ';
print '';
print ' | ';
// Description
print '';
-print '| '.$langs->trans("Description").' | ';
+print ''.$langs->trans("Description").' | ';
print '';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor('description',$object->description,'',200,'dolibarr_notes','',false,true,$conf->fckeditor->enabled,ROWS_6,50);
@@ -156,9 +160,9 @@ print ' | ';
// Color
print '';
-print '| '.$langs->trans("Color").' | ';
+print ''.$langs->trans("Color").' | ';
print '';
-print $formother->select_color($color, 'color');
+print $formother->select_color($object->color, 'color');
print ' | ';
// Parent category
|