diff --git a/htdocs/categories/fiche.php b/htdocs/categories/fiche.php index fbfc66d9f31..b0e75e4fb5b 100644 --- a/htdocs/categories/fiche.php +++ b/htdocs/categories/fiche.php @@ -1,8 +1,8 @@ * Copyright (C) 2006-2008 Laurent Destailleur - * Copyright (C) 2005-2007 Regis Houssin - * Copyright (C) 2007 Patrick Raguin + * Copyright (C) 2005-2008 Regis Houssin + * Copyright (C) 2007 Patrick Raguin * * 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 @@ -36,7 +36,7 @@ if (isset ($_REQUEST['choix'])) $nbcats = $_REQUEST['choix']; } else -{ // par d�fault, une nouvelle cat�gorie sera dans une seule cat�gorie m�re +{ // par default, une nouvelle categorie sera dans une seule categorie mere $nbcats = 1; } @@ -55,32 +55,39 @@ if ($_REQUEST['origin']) if ($_POST["action"] == 'add' && $user->rights->categorie->creer) { - // Action ajout d'une cat�gorie + // Action ajout d'une categorie if ($_POST["cancel"]) { + print 'origin : '.$idProdOrigin; if ($idProdOrigin) { header("Location: ".DOL_URL_ROOT.'/categories/categorie.php?id='.$idProdOrigin.'&type='.$_GET["type"]); exit; } - if ($idCompanyOrigin) + else if ($idCompanyOrigin) { header("Location: ".DOL_URL_ROOT.'/categories/categorie.php?socid='.$idCompanyOrigin.'&type='.$_GET["type"]); exit; } - if ($idSupplierOrigin) + else if ($idSupplierOrigin) { header("Location: ".DOL_URL_ROOT.'/categories/categorie.php?socid='.$idSupplierOrigin.'&type='.$_GET["type"]); exit; } + else + { + header("Location: ".DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$_GET["type"]); + exit; + } } $categorie = new Categorie($db); $categorie->label = $_POST["nom"]; $categorie->description = $_POST["description"]; + $categorie->socid = $_POST["socid"]; $categorie->visible = $_POST["visible"]; - $categorie->type = $_POST["type"]; + $categorie->type = $_POST["type"]; if($_POST['catMere'] != "-1") $categorie->id_mere = $_POST['catMere']; @@ -184,12 +191,23 @@ if ($user->rights->categorie->creer) } print ''; - print ''.$langs->trans ("AddIn").''; - print $html->select_all_categories($_GET['type']); - print ''; - print ''.$langs->trans ("ContentsVisibleByAll").''; - print $html->selectyesno("visible", 1,1); - print ''; + if ($_GET['type'] == 0 && $conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER) + { + print ''.$langs->trans ("AssignedToCustomer").''; + print $html->select_societes('','socid','s.client = 1 AND s.fournisseur = 0',1); + print ''; + print ''; + print ''; + } + else + { + print ''.$langs->trans ("AddIn").''; + print $html->select_all_categories($_GET['type']); + print ''; + print ''.$langs->trans ("ContentsVisibleByAll").''; + print $html->selectyesno("visible", 1,1); + print ''; + } print ''; print ''; print '     '; diff --git a/htdocs/langs/en_US/categories.lang b/htdocs/langs/en_US/categories.lang index 20ab87df680..0c506513b67 100644 --- a/htdocs/langs/en_US/categories.lang +++ b/htdocs/langs/en_US/categories.lang @@ -70,4 +70,5 @@ CustomersCategoriesShort=Customers categories 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. \ No newline at end of file +ThisCategoryHasNoCustomer=This category does not contain any customer. +AssignedToCustomer=Assigned to a customer \ No newline at end of file diff --git a/htdocs/langs/fr_FR/categories.lang b/htdocs/langs/fr_FR/categories.lang index 0bac2f1d76a..55c280c7367 100644 --- a/htdocs/langs/fr_FR/categories.lang +++ b/htdocs/langs/fr_FR/categories.lang @@ -70,4 +70,5 @@ CustomersCategoriesShort=Cat ProductsCategoriesShort=Catégories produits ThisCategoryHasNoProduct=Cette catégorie ne contient aucun produit. ThisCategoryHasNoSupplier=Cette catégorie ne contient aucun fournisseur. -ThisCategoryHasNoCustomer=Cette catégorie ne contient aucun client. \ No newline at end of file +ThisCategoryHasNoCustomer=Cette catégorie ne contient aucun client. +AssignedToCustomer=Attribuer à un client \ No newline at end of file