Fix: Une seule page pour gérer les catégories des societes et placé dans le rep du module categorie.
This commit is contained in:
parent
2db82f2164
commit
e033d0e238
@ -168,7 +168,7 @@ if ($_GET["socid"] || $_GET["ref"])
|
|||||||
if ($user->rights->societe->creer)
|
if ($user->rights->societe->creer)
|
||||||
{
|
{
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '<form method="post" action="'.DOL_URL_ROOT.'/comm/categorie.php?socid='.$soc->id.'">';
|
print '<form method="post" action="'.DOL_URL_ROOT.'/categories/categorie.php?socid='.$soc->id.'">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td>';
|
print '<tr class="liste_titre"><td>';
|
||||||
print $langs->trans("ClassifyInCategory").' ';
|
print $langs->trans("ClassifyInCategory").' ';
|
||||||
@ -210,7 +210,7 @@ if ($_GET["socid"] || $_GET["ref"])
|
|||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
if ($user->rights->societe->creer)
|
if ($user->rights->societe->creer)
|
||||||
{
|
{
|
||||||
print "<a href= '".DOL_URL_ROOT."/comm/categorie.php?socid=".$soc->id."&removecat=".$cat->id."'>";
|
print "<a href= '".DOL_URL_ROOT."/categories/categorie.php?socid=".$soc->id."&removecat=".$cat->id."'>";
|
||||||
print img_delete($langs->trans("DeleteFromCat")).' ';
|
print img_delete($langs->trans("DeleteFromCat")).' ';
|
||||||
print $langs->trans("DeleteFromCat")."</a>";
|
print $langs->trans("DeleteFromCat")."</a>";
|
||||||
}
|
}
|
||||||
@ -101,18 +101,15 @@ if ($_POST["action"] == 'add' && $user->rights->categorie->creer)
|
|||||||
print '<tr><td valign="top" class="notopnoleft" width="30%">';
|
print '<tr><td valign="top" class="notopnoleft" width="30%">';
|
||||||
|
|
||||||
print '<div class="ok">'.$langs->trans("CategorySuccessfullyCreated",$categorie->label).'</div>';
|
print '<div class="ok">'.$langs->trans("CategorySuccessfullyCreated",$categorie->label).'</div>';
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
if ($idprodorigin)
|
if ($idprodorigin)
|
||||||
{
|
{
|
||||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/product/categorie.php?id='.$idprodorigin.'">'.$langs->trans("ReturnInProduct").'</a>';
|
print '<a class="butAction" href="'.DOL_URL_ROOT.'/product/categorie.php?id='.$idprodorigin.'">'.$langs->trans("ReturnInProduct").'</a>';
|
||||||
}
|
}
|
||||||
if ($idSupplierorigin)
|
if ($idSupplierorigin || $idCompanyorigin)
|
||||||
{
|
{
|
||||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/categorie.php?socid='.$idSupplierorigin.'">'.$langs->trans("ReturnInSupplier").'</a>';
|
print '<a class="butAction" href="'.DOL_URL_ROOT.'/categories/categorie.php?socid='.$idCompanyorigin.'">'.$langs->trans("ReturnInCompany").'</a>';
|
||||||
}
|
|
||||||
if ($idCompanyorigin)
|
|
||||||
{
|
|
||||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/categorie.php?socid='.$idCompanyorigin.'">'.$langs->trans("ReturnInCompany").'</a>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</td></tr></table>';
|
print '</td></tr></table>';
|
||||||
|
|||||||
@ -1,242 +0,0 @@
|
|||||||
<?php
|
|
||||||
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
|
||||||
* Copyright (C) 2005 Brice Davoleau <brice.davoleau@gmail.com>
|
|
||||||
* Copyright (C) 2005-2006 Regis Houssin <regis.houssin@cap-networks.com>
|
|
||||||
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
|
||||||
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
* $Source$
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
\file htdocs/product/categorie.php
|
|
||||||
\ingroup product
|
|
||||||
\brief Page de l'onglet categories de produits
|
|
||||||
\version $Revision$
|
|
||||||
*/
|
|
||||||
|
|
||||||
require("./pre.inc.php");
|
|
||||||
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
|
|
||||||
require_once(DOL_DOCUMENT_ROOT."/fourn/fournisseur.class.php");
|
|
||||||
require_once(DOL_DOCUMENT_ROOT."/categories/categorie.class.php");
|
|
||||||
|
|
||||||
$langs->load("categories");
|
|
||||||
$langs->load("companies");
|
|
||||||
|
|
||||||
if (!$user->rights->societe->lire) accessforbidden();
|
|
||||||
|
|
||||||
$mesg = '';
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Actions
|
|
||||||
*/
|
|
||||||
|
|
||||||
//on veut supprimer une catégorie
|
|
||||||
if ($_REQUEST["removecat"] && $user->rights->societe->creer)
|
|
||||||
{
|
|
||||||
$soc = new Fournisseur($db);
|
|
||||||
if ($_REQUEST["socid"]) $result = $soc->fetch($_REQUEST["socid"]);
|
|
||||||
|
|
||||||
$cat = new Categorie($db,$_REQUEST["removecat"]);
|
|
||||||
$result=$cat->del_type($soc,"societe");
|
|
||||||
}
|
|
||||||
|
|
||||||
//on veut ajouter une catégorie
|
|
||||||
if (isset($_REQUEST["catMere"]) && $_REQUEST["catMere"]>=0 && $user->rights->societe->creer)
|
|
||||||
{
|
|
||||||
$soc = new Fournisseur($db);
|
|
||||||
if ($_REQUEST["socid"]) $result = $soc->fetch($_REQUEST["socid"]);
|
|
||||||
|
|
||||||
$cat = new Categorie($db,$_REQUEST["catMere"]);
|
|
||||||
$result=$cat->add_type($soc,"societe");
|
|
||||||
if ($result >= 0)
|
|
||||||
{
|
|
||||||
$mesg='<div class="ok">'.$langs->trans("Added").'</div>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$mesg='<div class="error">'.$langs->trans("Error").' '.$cat->error.'</div>';
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Creation de l'objet fournisseur correspondant à l'id
|
|
||||||
*/
|
|
||||||
if ($_GET["socid"] || $_GET["ref"])
|
|
||||||
{
|
|
||||||
$soc = new Fournisseur($db);
|
|
||||||
if ($_GET["socid"]) $result = $soc->fetch($_GET["socid"]);
|
|
||||||
|
|
||||||
llxHeader("","",$langs->trans("CardSupplier".$soc->type));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$html = new Form($db);
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Fiche produit
|
|
||||||
*/
|
|
||||||
if ($_GET["socid"] || $_GET["ref"])
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Affichage onglets
|
|
||||||
*/
|
|
||||||
$head = societe_prepare_head($soc);
|
|
||||||
|
|
||||||
dolibarr_fiche_head($head, 'category', $soc->nom);
|
|
||||||
|
|
||||||
|
|
||||||
print '<table width="100%">';
|
|
||||||
print '<tr><td valign="top" width="50%">';
|
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
|
||||||
print '<tr><td width="20%">'.$langs->trans("Name").'</td><td width="80%" colspan="3">'.$soc->nom.'</td></tr>';
|
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="3">'.$soc->prefix_comm.'</td></tr>';
|
|
||||||
|
|
||||||
if ($soc->fournisseur)
|
|
||||||
{
|
|
||||||
print '<tr><td nowrap="nowrap">';
|
|
||||||
print $langs->trans('SupplierCode').'</td><td colspan="3">';
|
|
||||||
print $soc->code_fournisseur;
|
|
||||||
if ($soc->check_codefournisseur() <> 0) print ' '.$langs->trans("WrongSupplierCode");
|
|
||||||
print '</td></tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
print '<tr><td valign="top">'.$langs->trans("Address").'</td><td colspan="3">'.nl2br($soc->adresse).'</td></tr>';
|
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("Zip").'</td><td>'.$soc->cp.'</td>';
|
|
||||||
print '<td>'.$langs->trans("Town").'</td><td>'.$soc->ville.'</td></tr>';
|
|
||||||
print '<tr><td>'.$langs->trans("Country").'</td><td colspan="3">'.$soc->pays.'</td></tr>';
|
|
||||||
print '<tr><td>'.$langs->trans("Phone").'</td><td>'.dolibarr_print_phone($soc->tel).' </td><td>'.$langs->trans("Fax").'</td><td>'.dolibarr_print_phone($soc->fax).' </td></tr>';
|
|
||||||
print '<tr><td>'.$langs->trans("Web")."</td><td colspan=\"3\"><a href=\"http://$soc->url\">$soc->url</a> </td></tr>";
|
|
||||||
|
|
||||||
// Assujeti à TVA ou pas
|
|
||||||
print '<tr>';
|
|
||||||
print '<td nowrap="nowrap">'.$langs->trans('VATIsUsed').'</td><td colspan="3">';
|
|
||||||
print yn($soc->tva_assuj);
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
print '</table>';
|
|
||||||
|
|
||||||
print '</div>';
|
|
||||||
|
|
||||||
|
|
||||||
if ($mesg) print($mesg);
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Barre d'actions
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
print '<div class="tabsAction">';
|
|
||||||
if ($user->rights->categorie->creer)
|
|
||||||
{
|
|
||||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/categories/fiche.php?action=create&origin='.$soc->id.'&type=1">'.$langs->trans("NewCat").'</a>';
|
|
||||||
}
|
|
||||||
print '</div>';
|
|
||||||
|
|
||||||
|
|
||||||
// Formulaire ajout dans une categorie
|
|
||||||
if ($user->rights->societe->creer)
|
|
||||||
{
|
|
||||||
print '<br>';
|
|
||||||
print '<form method="post" action="'.DOL_URL_ROOT.'/fourn/categorie.php?socid='.$soc->id.'">';
|
|
||||||
print '<table class="noborder" width="100%">';
|
|
||||||
print '<tr class="liste_titre"><td>';
|
|
||||||
print $langs->trans("ClassifyInCategory").' ';
|
|
||||||
print $html->select_all_categories(1,$categorie->id_mere).' <input type="submit" class="button" value="'.$langs->trans("Classify").'"></td>';
|
|
||||||
print '</tr>';
|
|
||||||
print '</table>';
|
|
||||||
print '</form>';
|
|
||||||
print '<br/>';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$c = new Categorie($db);
|
|
||||||
|
|
||||||
if ($_GET["socid"])
|
|
||||||
{
|
|
||||||
$cats = $c->containing($_REQUEST["socid"],"societe");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (sizeof($cats) > 0)
|
|
||||||
{
|
|
||||||
print_fiche_titre($langs->trans("SupplierIsInCategories"));
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
$var = ! $var;
|
|
||||||
print "<tr ".$bc[$var].">";
|
|
||||||
|
|
||||||
// Categorie
|
|
||||||
print "<td>".$way."</td>";
|
|
||||||
|
|
||||||
// Lien supprimer
|
|
||||||
print '<td align="right">';
|
|
||||||
if ($user->rights->societe->creer)
|
|
||||||
{
|
|
||||||
print "<a href= '".DOL_URL_ROOT."/fourn/categorie.php?socid=".$soc->id."&removecat=".$cat->id."'>";
|
|
||||||
print img_delete($langs->trans("DeleteFromCat")).' ';
|
|
||||||
print $langs->trans("DeleteFromCat")."</a>";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print ' ';
|
|
||||||
}
|
|
||||||
print "</td>";
|
|
||||||
|
|
||||||
print "</tr>\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
print "</table><br/>\n";
|
|
||||||
}
|
|
||||||
else if($cats < 0)
|
|
||||||
{
|
|
||||||
print $langs->trans("ErrorUnknown");
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print $langs->trans("SupplierHasNoCategory")."<br/>";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
$db->close();
|
|
||||||
|
|
||||||
|
|
||||||
llxFooter('$Date$ - $Revision$');
|
|
||||||
?>
|
|
||||||
@ -67,7 +67,7 @@ function societe_prepare_head($objsoc)
|
|||||||
//affichage onglet catégorie
|
//affichage onglet catégorie
|
||||||
if ($conf->categorie->enabled)
|
if ($conf->categorie->enabled)
|
||||||
{
|
{
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/comm/categorie.php?socid='.$objsoc->id;
|
$head[$h][0] = DOL_URL_ROOT.'/categories/categorie.php?socid='.$objsoc->id;
|
||||||
$head[$h][1] = $langs->trans('Categories');
|
$head[$h][1] = $langs->trans('Categories');
|
||||||
$head[$h][2] = 'category';
|
$head[$h][2] = 'category';
|
||||||
$h++;
|
$h++;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user