diff --git a/doc/images/dolibarr_screenshot3.png b/doc/images/dolibarr_screenshot3.png index aa40826dc57..7eca448db7b 100644 Binary files a/doc/images/dolibarr_screenshot3.png and b/doc/images/dolibarr_screenshot3.png differ diff --git a/htdocs/categories/categorie.class.php b/htdocs/categories/categorie.class.php index b3e8270039c..1385c963899 100644 --- a/htdocs/categories/categorie.class.php +++ b/htdocs/categories/categorie.class.php @@ -700,26 +700,21 @@ class Categorie } /** - * Check if no category with same label already exists + * \brief Check if no category with same label already exists + * \return boolean 1 if already exist, 0 otherwise, -1 if error */ function already_exists() { $sql = "SELECT count(c.rowid)"; $sql.= " FROM ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_association as ca"; $sql.= " WHERE c.label = '".addslashes($this -> label)."' AND type=".$this->type; - /*if($this -> id_mere != "") - { - $sql.= " AND c.rowid = ca.fk_categorie_fille"; - $sql.= " AND ca.fk_categorie_mere = '".$this -> id_mere."'"; - } - */ dol_syslog("Categorie::already_exists sql=".$sql); $res = $this->db->query($sql); if ($res) { $obj = $this->db->fetch_array($res); - if($obj[0] > 0) return true; - else return false; + if($obj[0] > 0) return 1; + else return 0; } else { diff --git a/htdocs/categories/fiche.php b/htdocs/categories/fiche.php index 7b5ee2df81b..f8046b3d0b4 100644 --- a/htdocs/categories/fiche.php +++ b/htdocs/categories/fiche.php @@ -1,8 +1,8 @@ - * Copyright (C) 2006-2008 Laurent Destailleur + * Copyright (C) 2006-2009 Laurent Destailleur * Copyright (C) 2005-2008 Regis Houssin - * Copyright (C) 2007 Patrick Raguin + * 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 @@ -20,11 +20,11 @@ */ /** - \file htdocs/categories/fiche.php - \ingroup category - \brief Page creation nouvelle categorie - \version $Id$ -*/ + * \file htdocs/categories/fiche.php + * \ingroup category + * \brief Page to create a new category + * \version $Id$ + */ require "./pre.inc.php"; require_once(DOL_DOCUMENT_ROOT."/categories/categorie.class.php"); @@ -128,7 +128,8 @@ if ($_POST["action"] == 'add' && $user->rights->categorie->creer) $_GET["action"] = 'create'; } - if ($categorie->error =="") + // Create category in database + if (! $categorie->error) { $result = $categorie->create(); if ($result > 0) @@ -171,6 +172,9 @@ if ($_POST["action"] == 'add' && $user->rights->categorie->creer) } +/* + * View + */ llxHeader("","",$langs->trans("Categories")); $html = new Form($db); @@ -182,12 +186,6 @@ if ($user->rights->categorie->creer) */ if ($_GET["action"] == 'create' || $_POST["addcat"] == 'addcat') { - if($categorie->error != "") - { - print '
'; - print $categorie->error; - print '
'; - } print '
'; print ''; print ''; @@ -207,6 +205,13 @@ if ($user->rights->categorie->creer) print_fiche_titre($langs->trans("CreateCat")); + if ($categorie->error) + { + print '
'; + print $categorie->error; + print '
'; + } + print ''; print ''; print '
'.$langs->trans("Ref").''; diff --git a/htdocs/langs/en_US/categories.lang b/htdocs/langs/en_US/categories.lang index ae338db7e84..38962da9f9c 100644 --- a/htdocs/langs/en_US/categories.lang +++ b/htdocs/langs/en_US/categories.lang @@ -53,7 +53,7 @@ SupplierHasNoCategory=This supplier is not in any categories CompanyHasNoCategory=This company is not in any categories ClassifyInCategory=Classify in category NoneCategory=None -CategoryExistsAtSameLevel=This category already exists at same place +CategoryExistsAtSameLevel=This category already exists with this ref ReturnInProduct=Back to product/service card ReturnInSupplier=Back to supplier card ReturnInCompany=Back to customer/prospect card diff --git a/htdocs/langs/fr_FR/categories.lang b/htdocs/langs/fr_FR/categories.lang index e0248448248..a251b9f0c25 100644 --- a/htdocs/langs/fr_FR/categories.lang +++ b/htdocs/langs/fr_FR/categories.lang @@ -53,7 +53,7 @@ SupplierHasNoCategory=Ce fournisseur n'est dans aucune catégorie en particulier CompanyHasNoCategory=Cette societé n'est dans aucune catégorie en particulier ClassifyInCategory=Classer dans la catégorie NoneCategory=Aucune -CategoryExistsAtSameLevel=Cette catégorie existe déjà au même endroit +CategoryExistsAtSameLevel=Cette catégorie existe déjà pour cette référence ReturnInProduct=Retour sur la fiche produit/service ReturnInSupplier=Retour sur la fiche fournisseur ReturnInCompany=Retour sur la fiche client/prospect