diff --git a/htdocs/categories/card.php b/htdocs/categories/card.php
index 814badf95a769..6c4c1a39bdd38 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 @@
$socid=GETPOST('socid','int');
$label=GETPOST('label');
$description=GETPOST('description');
+$color=GETPOST('color');
$visible=GETPOST('visible');
$parent=GETPOST('parent');
@@ -124,6 +126,7 @@
$object->label = $label;
+ $object->color = $color;
$object->description = dol_htmlcleanlastbr($description);
$object->socid = ($socid ? $socid : 'null');
$object->visible = $visible;
@@ -210,6 +213,7 @@
*/
$form = new Form($db);
+$formother = new FormOther($db);
llxHeader("","",$langs->trans("Categories"));
@@ -250,6 +254,11 @@
$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 acc569dcec32b..ac051a45666b3 100644
--- a/htdocs/categories/class/categorie.class.php
+++ b/htdocs/categories/class/categorie.class.php
@@ -368,7 +368,7 @@ function update($user='')
$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 228f02eb8814c..83d3547d1b88f 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 (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 @@
*/
$form = new Form($db);
+$formother = new FormOther($db);
llxHeader("","",$langs->trans("Categories"));
@@ -140,14 +144,14 @@
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 @@
// 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
|