From b8410445ff530a9ac7ab43eb19231e242137feec Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 27 Oct 2008 18:29:21 +0000 Subject: [PATCH] Added ability to assign a category of product to a customer --- htdocs/categories/categorie.class.php | 18 +++++++++++++----- htdocs/categories/viewcat.php | 14 ++++++++++++++ htdocs/langs/en_US/categories.lang | 3 ++- htdocs/langs/fr_FR/categories.lang | 3 ++- 4 files changed, 31 insertions(+), 7 deletions(-) diff --git a/htdocs/categories/categorie.class.php b/htdocs/categories/categorie.class.php index f5db96ef42a..fd54dd833d7 100644 --- a/htdocs/categories/categorie.class.php +++ b/htdocs/categories/categorie.class.php @@ -826,6 +826,7 @@ class Categorie return implode($sep, $w); } + /** * Retourne un tableau contenant la liste des catégories mères */ @@ -837,13 +838,20 @@ class Categorie $sql .= "WHERE fk_categorie_fille = ".$this->id; $res = $this->db->query ($sql); - - while ($cat = $this->db->fetch_array ($res)) + + if ($res) { - $meres[] = new Categorie ($this->db, $cat['fk_categorie_mere']); + while ($cat = $this->db->fetch_array ($res)) + { + $meres[] = new Categorie ($this->db, $cat['fk_categorie_mere']); + } + return $meres; + } + else + { + dolibarr_print_error ($this->db); + return -1; } - - return $meres; } /** diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index b7659fa2b9c..f85390b41bb 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -132,6 +132,20 @@ if ($type == 0 && $conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER) print $langs->trans("AssignedToTheCustomer").''; print $soc->getNomUrl(1); print ''; + + $catsMeres = $c->get_meres (); + + if ($catsMeres < 0) + { + dolibarr_print_error(); + } + else if (count($catsMeres) > 0) + { + print ''; + print $langs->trans("CategoryContents").''; + print ($c->visible ? $langs->trans("Visible") : $langs->trans("Invisible")); + print ''; + } } else { diff --git a/htdocs/langs/en_US/categories.lang b/htdocs/langs/en_US/categories.lang index e9fa03c4d04..9f1e4a397fa 100644 --- a/htdocs/langs/en_US/categories.lang +++ b/htdocs/langs/en_US/categories.lang @@ -73,4 +73,5 @@ ThisCategoryHasNoSupplier=This category does not contain any supplier. ThisCategoryHasNoCustomer=This category does not contain any customer. AssignedToCustomer=Assigned to a customer AssignedToTheCustomer=Assigned to the customer -InternalCategory=Inernal category \ No newline at end of file +InternalCategory=Inernal category +CategoryContents=Category contents \ No newline at end of file diff --git a/htdocs/langs/fr_FR/categories.lang b/htdocs/langs/fr_FR/categories.lang index be9da5e62e5..cfe15245830 100644 --- a/htdocs/langs/fr_FR/categories.lang +++ b/htdocs/langs/fr_FR/categories.lang @@ -73,4 +73,5 @@ ThisCategoryHasNoSupplier=Cette cat ThisCategoryHasNoCustomer=Cette catégorie ne contient aucun client. AssignedToCustomer=Attribuer à un client AssignedToTheCustomer=Attribué au client -InternalCategory=Catégorie interne \ No newline at end of file +InternalCategory=Catégorie interne +CategoryContents=Contenu de la catégorie \ No newline at end of file