diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index cfe4f3ad169..60ef207bb48 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -53,7 +53,7 @@ class Categorie extends CommonObject const TYPE_PROJECT = 6; const TYPE_BANK_LINE = 'bank_line'; public $picto = 'category'; - + /** * @var array ID mapping from type string @@ -557,7 +557,7 @@ class Categorie extends CommonObject $error++; } } - + if (! $error) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_lang"; @@ -814,7 +814,7 @@ class Categorie extends CommonObject $resql = $this->db->query($sql); if ($resql) { - while ($rec = $this->db->fetch_array($resql)) + while ($rec = $this->db->fetch_array($resql)) { if ($onlyids) { @@ -938,7 +938,7 @@ class Categorie extends CommonObject * * @return array Array of categories. this->cats and this->motherof are set. */ - function get_full_arbo($type,$markafterid=0) + function get_full_arbo($type, $markafterid=0) { global $conf, $langs; @@ -1355,7 +1355,7 @@ class Categorie extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."bank_class as a, ".MAIN_DB_PREFIX."bank_categ as c"; $sql.= " WHERE a.lineid=".$id." AND a.fk_categ = c.rowid"; $sql.= " ORDER BY c.label"; - + $res = $this->db->query($sql); if ($res) { @@ -1377,7 +1377,7 @@ class Categorie extends CommonObject { dol_print_error($this->db); return -1; - } + } } else { @@ -1385,7 +1385,7 @@ class Categorie extends CommonObject $sql .= " FROM " . MAIN_DB_PREFIX . "categorie_" . $this->MAP_CAT_TABLE[$type] . " as ct, " . MAIN_DB_PREFIX . "categorie as c"; $sql .= " WHERE ct.fk_categorie = c.rowid AND ct.fk_" . $this->MAP_CAT_FK[$type] . " = " . (int) $id . " AND c.type = " . $this->MAP_ID[$type]; $sql .= " AND c.entity IN (" . getEntity( 'category', 1 ) . ")"; - + $res = $this->db->query($sql); if ($res) { @@ -1408,7 +1408,7 @@ class Categorie extends CommonObject return -1; } } - + return $cats; } @@ -1434,7 +1434,7 @@ class Categorie extends CommonObject $cats = array(); // For backward compatibility - if (is_numeric( $type )) { + if (is_numeric($type)) { // We want to reverse lookup $map_type = array_flip( $this->MAP_ID ); $type = $map_type[$type]; @@ -1782,8 +1782,8 @@ class Categorie extends CommonObject { return ''; } - - + + /** * Initialise an instance with random values. * Used to build previews or test instances. diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php index b68da6fd597..ea4d60e9b5b 100644 --- a/htdocs/categories/index.php +++ b/htdocs/categories/index.php @@ -36,9 +36,8 @@ $langs->load("categories"); if (! $user->rights->categorie->lire) accessforbidden(); $id=GETPOST('id','int'); -$type=(GETPOST('type') ? GETPOST('type') : Categorie::TYPE_PRODUCT); +$type=(GETPOST('type','aZ09') ? GETPOST('type','aZ09') : Categorie::TYPE_PRODUCT); $catname=GETPOST('catname','alpha'); -$section=(GETPOST('section')?GETPOST('section'):0); /* @@ -48,14 +47,15 @@ $section=(GETPOST('section')?GETPOST('section'):0); $categstatic = new Categorie($db); $form = new Form($db); -if ($type == Categorie::TYPE_PRODUCT) $title=$langs->trans("ProductsCategoriesArea"); -elseif ($type == Categorie::TYPE_SUPPLIER) $title=$langs->trans("SuppliersCategoriesArea"); -elseif ($type == Categorie::TYPE_CUSTOMER) $title=$langs->trans("CustomersCategoriesArea"); -elseif ($type == Categorie::TYPE_MEMBER) $title=$langs->trans("MembersCategoriesArea"); -elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactsCategoriesArea"); -elseif ($type == Categorie::TYPE_ACCOUNT) $title=$langs->trans("AccountsCategoriesArea"); -elseif ($type == Categorie::TYPE_PROJECT) $title=$langs->trans("ProjectsCategoriesArea"); -else $title=$langs->trans("CategoriesArea"); +if ($type == Categorie::TYPE_PRODUCT) { $title=$langs->trans("ProductsCategoriesArea"); $typetext='product'; } +elseif ($type == Categorie::TYPE_SUPPLIER) { $title=$langs->trans("SuppliersCategoriesArea"); $typetext='supplier'; } +elseif ($type == Categorie::TYPE_CUSTOMER) { $title=$langs->trans("CustomersCategoriesArea"); $typetext='customer'; } +elseif ($type == Categorie::TYPE_MEMBER) { $title=$langs->trans("MembersCategoriesArea"); $typetext='member'; } +elseif ($type == Categorie::TYPE_CONTACT) { $title=$langs->trans("ContactsCategoriesArea"); $typetext='contact'; } +elseif ($type == Categorie::TYPE_ACCOUNT) { $title=$langs->trans("AccountsCategoriesArea"); $typetext='account'; } +elseif ($type == Categorie::TYPE_USER) { $title=$langs->trans("UsersCategoriesArea"); $typetext='user'; } +elseif ($type == Categorie::TYPE_PROJECT) { $title=$langs->trans("ProjectsCategoriesArea"); $typetext='project'; } +else { $title=$langs->trans("CategoriesArea"); $typetext='unknown'; } $arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js'); $arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css'); @@ -104,7 +104,7 @@ print '
| '.$langs->trans("FoundCats").' | '; $out.=$sublink; // The image must have the class 'boxhandle' beause it's value used in DOM draggable objects to define the area used to catch the full object @@ -273,7 +273,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" $out.= ''; $out.= ' |