From 977bacbdaba7af84b7716233f8e34eb3d69c88a0 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 7 Oct 2008 10:37:04 +0000 Subject: [PATCH] Added ability to assign a category of product to a customer --- htdocs/categories/categorie.class.php | 2 +- htdocs/categories/viewcat.php | 23 ++++++++++++++++++----- htdocs/langs/en_US/categories.lang | 3 ++- htdocs/langs/fr_FR/categories.lang | 3 ++- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/htdocs/categories/categorie.class.php b/htdocs/categories/categorie.class.php index 3cabe51b737..aa3bfc2e921 100644 --- a/htdocs/categories/categorie.class.php +++ b/htdocs/categories/categorie.class.php @@ -182,7 +182,7 @@ class Categorie // Clean parameters $this->label=trim($this->label); $this->description=trim($this->description); - + if ($this->socid == -1) $this->socid = 0; $this->db->begin(); diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 63b78778dd7..7c984c685bb 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -2,7 +2,7 @@ /* Copyright (C) 2005 Matthieu Valleton * Copyright (C) 2006-2008 Laurent Destailleur * Copyright (C) 2007 Patrick Raguin - * Copyright (C) 2005-2007 Regis Houssin + * Copyright (C) 2005-2008 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -121,10 +121,23 @@ print $langs->trans("Description").''; print nl2br($c->description); print ''; -print ''; -print $langs->trans("Status").''; -print ($c->visible ? $langs->trans("Visible") : $langs->trans("Invisible")); -print ''; +if ($type == 0 && $conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER) +{ + $soc = new Societe($db); + $soc->fetch($c->socid); + + print ''; + print $langs->trans("AssignedToTheCustomer").''; + print $soc->getNomUrl(1); + print ''; +} +else +{ + print ''; + print $langs->trans("Status").''; + print ($c->visible ? $langs->trans("Visible") : $langs->trans("Invisible")); + print ''; +} print ''; diff --git a/htdocs/langs/en_US/categories.lang b/htdocs/langs/en_US/categories.lang index 0c506513b67..52ba35906db 100644 --- a/htdocs/langs/en_US/categories.lang +++ b/htdocs/langs/en_US/categories.lang @@ -71,4 +71,5 @@ ProductsCategoriesShort=Products categories ThisCategoryHasNoProduct=This category does not contain any product. ThisCategoryHasNoSupplier=This category does not contain any supplier. ThisCategoryHasNoCustomer=This category does not contain any customer. -AssignedToCustomer=Assigned to a customer \ No newline at end of file +AssignedToCustomer=Assigned to a customer +AssignedToTheCustomer=Assigned to the customer \ No newline at end of file diff --git a/htdocs/langs/fr_FR/categories.lang b/htdocs/langs/fr_FR/categories.lang index 55c280c7367..63962e05d0f 100644 --- a/htdocs/langs/fr_FR/categories.lang +++ b/htdocs/langs/fr_FR/categories.lang @@ -71,4 +71,5 @@ ProductsCategoriesShort=Cat ThisCategoryHasNoProduct=Cette catégorie ne contient aucun produit. ThisCategoryHasNoSupplier=Cette catégorie ne contient aucun fournisseur. ThisCategoryHasNoCustomer=Cette catégorie ne contient aucun client. -AssignedToCustomer=Attribuer à un client \ No newline at end of file +AssignedToCustomer=Attribuer à un client +AssignedToTheCustomer=Attribué au client \ No newline at end of file