dbut restructuration du code des catgories

This commit is contained in:
Regis Houssin 2006-02-22 14:38:14 +00:00
parent 0d06037203
commit d6454f3a07
3 changed files with 67 additions and 11 deletions

View File

@ -41,12 +41,10 @@ else
$nbcats = 1;
}
llxHeader("","",$langs->trans("Categories"));
$html = new Form($db);
/*
* Action création du produit
*/
@ -69,12 +67,62 @@ if ($_GET["action"] == 'create' && $user->rights->produit->creer)
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>';
print '<textarea name="description" rows="6" cols="50"';
print '</textarea></td></tr>';
print "<tr><td>";
print $langs->trans("AddIn").'&nbsp;';
print $langs->trans("Categories").'&nbsp;&nbsp;';
print $html->select_nombre_sous_categorie($nbcats,"choix");
print '</td><td></td></tr>';
print '<tr><td>';
print $langs->trans("AddIn").' ';
print $html->select_nombre_sous_categorie($nbcats,"choix").' ';
print $langs->trans("categories");
print '</td><td>';
print '<input type="submit" value="'.$langs->trans("modify").'" name="ok" />';
print '</td></tr>';
}
/*
* Affichage page accueil
*/
if ($_GET["action"] == 'confirmed' && $$user->rights->produit->creer)
{
print_titre($langs->trans("CatCreated"));
print '<table border="0" width="100%">';
print '<tr><td valign="top" width="30%">';
$categorie = new Categorie($db);
$categorie->label = $_REQUEST["nom"];
$categorie->description = $_REQUEST["description"];
$cats_meres = isset($_REQUEST['cats_meres']) ? $_REQUEST['cats_meres'] : array();
$res = $categorie->create();
if ($res < 0)
{
print '<p>'.$langs->trans("ImpossibleAddCat").' '.$categorie->label.'</p>';
}
else
{
print '<p>'.$langs->trans("TheCategorie").' '.$categorie->label.' '.$langs->trans("WasAddedSuccessfully").'</p>';
foreach ($cats_meres as $id)
{
$mere = new Categorie($db, $id);
$res = $mere->add_fille($categorie);
if ($res < 0)
{
print '<p>'.$langs->trans("TheCategorie").' '.$mere->label.' ('.$res.').</p>';
}
}
}
print '</td></tr></table>';
}
print '</table>';
/*
<td>

View File

@ -1,6 +1,7 @@
# Dolibarr language file - en_US - categories
Categorie=Category
Categories=categories
categories=categories
TheCategorie=The catégorie
In=In
AddIn=Add in
modify=modify
@ -27,4 +28,7 @@ ErrSameCatSelected=You selected the same category several times
ErrForgotCat=You forgot to choose the category
ErrForgotField=You forgot to inform the fields
ErrCatAlreadyExists=This name is already used
AddProductToCat=Add this product to a category?
AddProductToCat=Add this product to a category?
ImpossibleAddCat=Impossible to add the category
ImpossibleAssociateCategory=Impossible to associate the category to
WasAddedSuccessfully=was added successfully.

View File

@ -1,6 +1,7 @@
# Dolibarr language file - fr_FR - categories
Categorie=Catégorie
Categories=catégorie(s)
categories=catégorie(s)
TheCategorie=La catégorie
In=Dans
AddIn=Ajouter dans
modify=modifier
@ -28,3 +29,6 @@ ErrForgotCat=Vous avez oubli
ErrForgotField=Vous avez oublié de renseigner le champs
ErrCatAlreadyExists=Ce nom est déjà utilisé
AddProductToCat=Ajouter ce produit à une catégorie ?
ImpossibleAddCat=Impossible d'ajouter la catégorie
ImpossibleAssociateCategory=Impossible d'associer la catégorie ŕ
WasAddedSuccessfully=a été ajoutée avec succčs.