mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
NEW Add color on categories
This commit is contained in:
parent
27b1f2ecc6
commit
c8e0839296
|
|
@ -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 '</td></tr>';
|
||||
|
||||
// Color
|
||||
print '<tr><td>'.$langs->trans("Color").'</td><td>';
|
||||
print $formother->select_color($color,'color');
|
||||
print '</td></tr>';
|
||||
|
||||
// Parent category
|
||||
print '<tr><td>'.$langs->trans("AddIn").'</td><td>';
|
||||
print $form->select_all_categories($type, $catorigin);
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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 '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td class="fieldrequired">';
|
||||
print '<tr><td class="fieldrequired" width="25%">';
|
||||
print $langs->trans("Ref").'</td>';
|
||||
print '<td><input type="text" size="25" id="label" name ="label" value="'.$object->label.'" />';
|
||||
print '</tr>';
|
||||
|
||||
// Description
|
||||
print '<tr>';
|
||||
print '<td class="fieldrequired" width="25%">'.$langs->trans("Description").'</td>';
|
||||
print '<td class="fieldrequired">'.$langs->trans("Description").'</td>';
|
||||
print '<td >';
|
||||
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 '</td></tr>';
|
|||
|
||||
// Color
|
||||
print '<tr>';
|
||||
print '<td class="fieldrequired" width="25%">'.$langs->trans("Color").'</td>';
|
||||
print '<td>'.$langs->trans("Color").'</td>';
|
||||
print '<td >';
|
||||
print $formother->select_color($color, 'color');
|
||||
print $formother->select_color($object->color, 'color');
|
||||
print '</td></tr>';
|
||||
|
||||
// Parent category
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user