mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Fix: Debug divers sur gestion des catgories
This commit is contained in:
parent
f0a09048ef
commit
c0e8e07d84
|
|
@ -85,7 +85,7 @@ print '<tr><td valign="top" width="30%">';
|
|||
?>
|
||||
<form method="post" action="<?php print $_SERVER['REQUEST_URI']; ?>">
|
||||
<input type="hidden" name="action" value="update">
|
||||
<table class="border">
|
||||
<table class="border" width="100%">
|
||||
<tr>
|
||||
<td><?php print $langs->trans("Label"); ?> :</td>
|
||||
|
||||
|
|
@ -93,15 +93,27 @@ print '<tr><td valign="top" width="30%">';
|
|||
print $categorie->label;
|
||||
?>" />
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php print $langs->trans("Description"); ?> :</td>
|
||||
|
||||
<td><textarea name='description' cols='40' rows='6' id='description'><?php
|
||||
print $categorie->description;
|
||||
?></textarea></td>
|
||||
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
print '<tr>';
|
||||
print '<td width="25%">'.$langs->trans("Description").':</td>';
|
||||
print '<td>';
|
||||
|
||||
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC)
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
|
||||
$doleditor=new DolEditor('description',$categorie->description,240,'dolibarr_notes');
|
||||
$doleditor->Create();
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<textarea name="description" rows="'.ROWS_6.'" cols="50">';
|
||||
print $categorie->description;
|
||||
print '</textarea>';
|
||||
}
|
||||
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
?>
|
||||
|
||||
<tr><td><?php print $langs->trans ("AddIn"); ?></td><td>
|
||||
<?php print $html->select_all_categories($categorie->id_mere);?>
|
||||
|
|
@ -124,4 +136,6 @@ print '<tr><td valign="top" width="30%">';
|
|||
print '</td></tr></table>';
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -46,11 +46,12 @@ if ($_REQUEST['origin'])
|
|||
$idprodorigin = $_REQUEST['origin'];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
llxHeader("","",$langs->trans("Categories"));
|
||||
$html = new Form($db);
|
||||
|
||||
|
||||
|
||||
// Action ajout d'une catégorie
|
||||
if ($_POST["action"] == 'add' && $user->rights->categorie->creer)
|
||||
{
|
||||
|
|
@ -60,8 +61,8 @@ if ($_POST["action"] == 'add' && $user->rights->categorie->creer)
|
|||
$categorie->description = $_POST["description"];
|
||||
$categorie->visible = $_POST["visible"];
|
||||
if($_POST['catMere'] != "-1")
|
||||
$categorie->id_mere = $_POST['catMere'];
|
||||
|
||||
$categorie->id_mere = $_POST['catMere'];
|
||||
|
||||
|
||||
if (!$categorie->label || !$categorie->description)
|
||||
{
|
||||
|
|
@ -74,37 +75,37 @@ if ($_POST["action"] == 'add' && $user->rights->categorie->creer)
|
|||
{
|
||||
$_GET["action"] = 'confirmed';
|
||||
$_POST["addcat"] = '';
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Action confirmation de création de la catégorie
|
||||
*/
|
||||
* Action confirmation de création de la catégorie
|
||||
*/
|
||||
|
||||
if ($_GET["action"] == 'confirmed')
|
||||
{
|
||||
print_titre($langs->trans("CatCreated"));
|
||||
if ($_GET["action"] == 'confirmed')
|
||||
{
|
||||
print_titre($langs->trans("CatCreated"));
|
||||
|
||||
print '<table border="0" width="100%">';
|
||||
print '<tr><td valign="top" width="30%">';
|
||||
print '<p>'.$langs->trans("TheCategorie").' '.$categorie->label.' '.$langs->trans("WasAddedSuccessfully").'</p>';
|
||||
|
||||
if ($_REQUEST['idprodorigin'])
|
||||
{
|
||||
$idprodorigin = $_REQUEST['idprodorigin'];
|
||||
print '<p><a class="butAction" href="'.DOL_URL_ROOT.'/product/categorie.php?id='.$idprodorigin.'">'.$langs->trans("ReturnInProduct").'</a></p>';
|
||||
}
|
||||
|
||||
print '</td></tr></table>';
|
||||
}
|
||||
print '<table border="0" width="100%">';
|
||||
print '<tr><td valign="top" width="30%">';
|
||||
print $langs->trans("TheCategorie").' '.$categorie->label.' '.$langs->trans("WasAddedSuccessfully");
|
||||
|
||||
if ($_REQUEST['idprodorigin'])
|
||||
{
|
||||
$idprodorigin = $_REQUEST['idprodorigin'];
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/product/categorie.php?id='.$idprodorigin.'">'.$langs->trans("ReturnInProduct").'</a>';
|
||||
}
|
||||
|
||||
print '</td></tr></table>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($user->rights->produit->creer)
|
||||
if ($user->rights->categorie->creer)
|
||||
{
|
||||
/*
|
||||
* Fiche en mode création
|
||||
*/
|
||||
* Fiche en mode création
|
||||
*/
|
||||
if ($_GET["action"] == 'create' || $_POST["addcat"] == 'addcat')
|
||||
{
|
||||
if($categorie->error != "")
|
||||
|
|
@ -126,11 +127,24 @@ if ($user->rights->produit->creer)
|
|||
|
||||
print '<table class="border" width="100%" class="notopnoleftnoright">';
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("Label").'</td><td><input name="nom" size"25" value="'.$categorie->label.'">';
|
||||
print '<td width="25%">'.$langs->trans("Label").'</td><td><input name="nom" size="25" value="'.$categorie->label.'">';
|
||||
print'</td></tr>';
|
||||
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>';
|
||||
print '<textarea name="description" rows="6" cols="50">';
|
||||
print $categorie->description.'</textarea></td></tr>';
|
||||
|
||||
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC)
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
|
||||
$doleditor=new DolEditor('description',$categorie->description,240,'dolibarr_notes');
|
||||
$doleditor->Create();
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<textarea name="description" rows="'.ROWS_6.'" cols="50">';
|
||||
print $categorie->description;
|
||||
print '</textarea>';
|
||||
}
|
||||
|
||||
print '</td></tr>';
|
||||
print '<tr><td>'.$langs->trans ("AddIn").'</td><td>';
|
||||
print $html->select_all_categories();
|
||||
print '</td></tr>';
|
||||
|
|
|
|||
|
|
@ -75,50 +75,54 @@ print '</td><td valign="top" width="70%">';
|
|||
* Catégories trouvées
|
||||
*/
|
||||
|
||||
if($_POST['catname']) {
|
||||
$cats = $c->rechercher_par_nom ($_POST['catname']);
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("FoundCats").'</td></tr>';
|
||||
|
||||
foreach ($cats as $cat)
|
||||
{
|
||||
$i = !$i;
|
||||
print "\t<tr ".$bc[$i].">\n";
|
||||
print "\t\t<td><a href='viewcat.php?id=".$cat->id."'>".$cat->label."</a></td>\n";
|
||||
print "\t\t<td>".$cat->description."</td>\n";
|
||||
print "\t</tr>\n";
|
||||
}
|
||||
print "</table>";
|
||||
|
||||
if($_POST['catname'])
|
||||
{
|
||||
$cats = $c->rechercher_par_nom ($_POST['catname']);
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("FoundCats").'</td></tr>';
|
||||
|
||||
$var=true;
|
||||
foreach ($cats as $cat)
|
||||
{
|
||||
$var = ! $var;
|
||||
print "\t<tr ".$bc[$var].">\n";
|
||||
print "\t\t<td><a href='viewcat.php?id=".$cat->id."'>".$cat->label."</a></td>\n";
|
||||
print "\t\t<td>".$cat->description."</td>\n";
|
||||
print "\t</tr>\n";
|
||||
}
|
||||
print "</table>";
|
||||
}
|
||||
|
||||
/*
|
||||
* Catégories principales
|
||||
*/
|
||||
* Catégories principales
|
||||
*/
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("AllCats").'</td><td>'.$langs->trans("Desc").'</td></tr>';
|
||||
|
||||
$c->get_categories_arbo();
|
||||
$cate_arbo = $c->get_arbo_each_cate();
|
||||
|
||||
foreach($cate_arbo as $key => $value)
|
||||
{
|
||||
$i = !$i;
|
||||
print "\t<tr ".$bc[$i].">\n";
|
||||
print '<td><a href="viewcat.php?id='.$value[1].'">'.$value[0].'</a></td>';
|
||||
print "\t</td>\n";
|
||||
print '<td>'.$c->get_desc($value[1]).'</td>';
|
||||
print "\t</td>\n";
|
||||
print "\t</tr>\n";
|
||||
}
|
||||
|
||||
|
||||
print "</table>";
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("AllCats").'</td><td>'.$langs->trans("Desc").'</td></tr>';
|
||||
|
||||
$c->get_categories_arbo();
|
||||
$cate_arbo = $c->get_arbo_each_cate();
|
||||
|
||||
if (is_array($cate_arbo))
|
||||
{
|
||||
$var=true;
|
||||
foreach($cate_arbo as $key => $value)
|
||||
{
|
||||
$var = ! $var;
|
||||
print "\t<tr ".$bc[$var].">\n";
|
||||
print '<td><a href="viewcat.php?id='.$value[1].'">'.$value[0].'</a></td>';
|
||||
print "\t</td>\n";
|
||||
print '<td>'.$c->get_desc($value[1]).'</td>';
|
||||
print "\t</td>\n";
|
||||
print "\t</tr>\n";
|
||||
}
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
|
||||
print '</td></tr></table>';
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -1200,7 +1200,7 @@ class Form
|
|||
$cat->get_categories_arbo();
|
||||
$cate_arbo = $cat->get_arbo_each_cate();
|
||||
$output = '<select name="'.$select_name.'">'; //creation des categories meres
|
||||
$output.= '<option value="-1" id="choix"> </option>\n';
|
||||
$output.= '<option value="-1" id="choix"> </option>';
|
||||
|
||||
if ($cate_arbo)
|
||||
{
|
||||
|
|
@ -1215,6 +1215,7 @@ class Form
|
|||
}
|
||||
|
||||
$output.= '</select>';
|
||||
$output.= "\n";
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -243,14 +243,14 @@ if ($_GET["id"] || $_GET["ref"])
|
|||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Categories").'</td></tr>';
|
||||
|
||||
$var = true;
|
||||
foreach ($cats as $cat)
|
||||
{
|
||||
|
||||
$ways = $cat->print_all_ways ();
|
||||
foreach ($ways as $way)
|
||||
{
|
||||
$i = !$i;
|
||||
print "<tr ".$bc[$i]."><td>".$way."</td>";
|
||||
$var = ! $var;
|
||||
print "<tr ".$bc[$var]."><td>".$way."</td>";
|
||||
print '<td align="right">'.img_delete($langs->trans("DeleteFromCat"))." <a href= '".DOL_URL_ROOT."/product/categorie.php?id=".$product->id."&cat=".$cat->id."'>".$langs->trans("DeleteFromCat")."</a></td></tr>\n";
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user