Ajout bouton "Annuler" sur page creation categorie
This commit is contained in:
parent
8124d494bd
commit
3ffe25a633
@ -474,6 +474,7 @@ class Categorie
|
|||||||
* label = nom de la categorie
|
* label = nom de la categorie
|
||||||
* fulllabel = nom avec chemin complet de la categorie
|
* fulllabel = nom avec chemin complet de la categorie
|
||||||
* fullpath = chemin complet compose des id
|
* fullpath = chemin complet compose des id
|
||||||
|
* \param type Type de categories (0=produit, 1=fournisseur, 2=client)
|
||||||
* \return array Tableau de array
|
* \return array Tableau de array
|
||||||
*/
|
*/
|
||||||
function get_full_arbo($type)
|
function get_full_arbo($type)
|
||||||
@ -481,6 +482,8 @@ class Categorie
|
|||||||
// Charge tableau des meres
|
// Charge tableau des meres
|
||||||
$sql = "SELECT fk_categorie_mere as id_mere, fk_categorie_fille as id_fille";
|
$sql = "SELECT fk_categorie_mere as id_mere, fk_categorie_fille as id_fille";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."categorie_association";
|
$sql.= " FROM ".MAIN_DB_PREFIX."categorie_association";
|
||||||
|
|
||||||
|
dolibarr_syslog("Categorie::get_full_arbo sql=".$sql);
|
||||||
$res = $this->db->query ($sql);
|
$res = $this->db->query ($sql);
|
||||||
if ($res)
|
if ($res)
|
||||||
{
|
{
|
||||||
@ -502,6 +505,8 @@ class Categorie
|
|||||||
$sql.= " ON c.rowid=ca.fk_categorie_mere";
|
$sql.= " ON c.rowid=ca.fk_categorie_mere";
|
||||||
$sql.= " WHERE c.type = ".$type;
|
$sql.= " WHERE c.type = ".$type;
|
||||||
$sql.= " ORDER BY c.label, c.rowid";
|
$sql.= " ORDER BY c.label, c.rowid";
|
||||||
|
|
||||||
|
dolibarr_syslog("Categorie::get_full_arbo sql=".$sql);
|
||||||
$res = $this->db->query ($sql);
|
$res = $this->db->query ($sql);
|
||||||
if ($res)
|
if ($res)
|
||||||
{
|
{
|
||||||
@ -866,7 +871,6 @@ class Categorie
|
|||||||
$sql.= " WHERE ct.fk_".$type." = ".$id." AND c.type = ".$typeid;
|
$sql.= " WHERE ct.fk_".$type." = ".$id." AND c.type = ".$typeid;
|
||||||
|
|
||||||
$res = $this->db->query ($sql);
|
$res = $this->db->query ($sql);
|
||||||
|
|
||||||
if ($res)
|
if ($res)
|
||||||
{
|
{
|
||||||
while ($cat = $this->db->fetch_array ($res))
|
while ($cat = $this->db->fetch_array ($res))
|
||||||
|
|||||||
@ -20,7 +20,6 @@
|
|||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
* $Source$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -110,7 +109,7 @@ if (isset($_REQUEST["catMere"]) && $_REQUEST["catMere"]>=0)
|
|||||||
$html = new Form($db);
|
$html = new Form($db);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Fiche objet client/fournisseur
|
* Fiche categorie de client et/ou fournisseur
|
||||||
*/
|
*/
|
||||||
if ($_GET["socid"])
|
if ($_GET["socid"])
|
||||||
{
|
{
|
||||||
@ -186,26 +185,21 @@ if ($_GET["socid"])
|
|||||||
|
|
||||||
if ($mesg) print($mesg);
|
if ($mesg) print($mesg);
|
||||||
|
|
||||||
if ($soc->client)
|
if ($soc->client) formCategory($db,$soc,$type,2);
|
||||||
{
|
|
||||||
formCategory($db,$soc,$type,2);
|
if ($soc->client && $soc->fournisseur) print '<br><br>';
|
||||||
print '<br><br>';
|
|
||||||
}
|
|
||||||
if ($soc->fournisseur) formCategory($db,$soc,$type,1);
|
if ($soc->fournisseur) formCategory($db,$soc,$type,1);
|
||||||
}
|
}
|
||||||
else if ($_GET["id"] || $_GET["ref"])
|
else if ($_GET["id"] || $_GET["ref"])
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Fiche produit
|
* Fiche categorie de produit
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once(DOL_DOCUMENT_ROOT."/lib/product.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/lib/product.lib.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/product.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/product.class.php");
|
||||||
|
|
||||||
/*
|
// Produit
|
||||||
* Creation de l'objet produit correspondant à l'id
|
|
||||||
*/
|
|
||||||
|
|
||||||
$product = new Product($db);
|
$product = new Product($db);
|
||||||
if ($_GET["ref"]) $result = $product->fetch('',$_GET["ref"]);
|
if ($_GET["ref"]) $result = $product->fetch('',$_GET["ref"]);
|
||||||
if ($_GET["id"]) $result = $product->fetch($_GET["id"]);
|
if ($_GET["id"]) $result = $product->fetch($_GET["id"]);
|
||||||
@ -254,23 +248,22 @@ else if ($_GET["id"] || $_GET["ref"])
|
|||||||
if ($mesg) print($mesg);
|
if ($mesg) print($mesg);
|
||||||
|
|
||||||
formCategory($db,$product,'product',0);
|
formCategory($db,$product,'product',0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Fonction Barre d'actions
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Fonction Barre d'actions
|
||||||
|
*/
|
||||||
function formCategory($db,$object,$type,$typeid)
|
function formCategory($db,$object,$type,$typeid)
|
||||||
{
|
{
|
||||||
global $user,$langs,$html;
|
global $user,$langs,$html,$bc;
|
||||||
|
|
||||||
|
if ($typeid == 0) $title = $langs->trans("ProductsCategoriesShort");
|
||||||
|
if ($typeid == 1) $title = $langs->trans("SuppliersCategoriesShort");
|
||||||
|
if ($typeid == 2) $title = $langs->trans("CustomersCategoriesShort");
|
||||||
if ($type == 'societe')
|
if ($type == 'societe')
|
||||||
{
|
{
|
||||||
$nameId = 'socid';
|
$nameId = 'socid';
|
||||||
if ($typeid == 2) $title = $langs->trans("CustomersCategoriesShort");
|
|
||||||
if ($typeid == 1) $title = $langs->trans("SuppliersCategoriesShort");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -304,9 +297,11 @@ function formCategory($db,$object,$type,$typeid)
|
|||||||
|
|
||||||
if (sizeof($cats) > 0)
|
if (sizeof($cats) > 0)
|
||||||
{
|
{
|
||||||
print_fiche_titre($langs->trans("CompanyIsInCategories"));
|
if ($typeid == 0) $title=$langs->trans("ProductIsInCategories");
|
||||||
|
if ($typeid == 1) $title=$langs->trans("CompanyIsInSuppliersCategories");
|
||||||
|
if ($typeid == 2) $title=$langs->trans("CompanyIsInCustomersCategories");
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Categories").'</td></tr>';
|
print '<tr class="liste_titre"><td colspan="2">'.$title.':</td></tr>';
|
||||||
|
|
||||||
$var = true;
|
$var = true;
|
||||||
foreach ($cats as $cat)
|
foreach ($cats as $cat)
|
||||||
@ -337,7 +332,7 @@ function formCategory($db,$object,$type,$typeid)
|
|||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print "</table><br/>\n";
|
print "</table>\n";
|
||||||
}
|
}
|
||||||
else if($cats < 0)
|
else if($cats < 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -51,13 +51,28 @@ if ($_REQUEST['origin'])
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Actions
|
||||||
|
*/
|
||||||
|
|
||||||
llxHeader("","",$langs->trans("Categories"));
|
|
||||||
$html = new Form($db);
|
|
||||||
|
|
||||||
// Action ajout d'une catégorie
|
|
||||||
if ($_POST["action"] == 'add' && $user->rights->categorie->creer)
|
if ($_POST["action"] == 'add' && $user->rights->categorie->creer)
|
||||||
{
|
{
|
||||||
|
// Action ajout d'une catégorie
|
||||||
|
if ($_POST["cancel"])
|
||||||
|
{
|
||||||
|
if ($idProdOrigin)
|
||||||
|
{
|
||||||
|
header("Location: ".DOL_URL_ROOT.'/categories/categorie.php?id='.$idProdOrigin);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
if ($idSupplierOrigin || $idCompanyOrigin)
|
||||||
|
{
|
||||||
|
header("Location: ".DOL_URL_ROOT.'/categories/categorie.php?socid='.$idCompanyOrigin);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
$categorie = new Categorie($db);
|
$categorie = new Categorie($db);
|
||||||
|
|
||||||
$categorie->label = $_POST["nom"];
|
$categorie->label = $_POST["nom"];
|
||||||
@ -87,6 +102,15 @@ if ($_POST["action"] == 'add' && $user->rights->categorie->creer)
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
llxHeader("","",$langs->trans("Categories"));
|
||||||
|
$html = new Form($db);
|
||||||
|
|
||||||
|
if ($_POST["action"] == 'add' && $user->rights->categorie->creer)
|
||||||
|
{
|
||||||
/*
|
/*
|
||||||
* Action confirmation de création de la catégorie
|
* Action confirmation de création de la catégorie
|
||||||
*/
|
*/
|
||||||
@ -168,7 +192,9 @@ if ($user->rights->categorie->creer)
|
|||||||
print $html->selectyesno("visible", 1,1);
|
print $html->selectyesno("visible", 1,1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
print '<tr><td colspan="2" align="center">';
|
print '<tr><td colspan="2" align="center">';
|
||||||
print '<input type="submit" class="button" value="'.$langs->trans("CreateThisCat").'" name="creation" id="creation"/>';
|
print '<input type="submit" class="button" value="'.$langs->trans("CreateThisCat").'" name="creation" id="creation" />';
|
||||||
|
print ' ';
|
||||||
|
print '<input type="submit" class="button" value="'.$langs->trans("Cancel").'" name="cancel" />';
|
||||||
print '</td></tr></form>';
|
print '</td></tr></form>';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1682,9 +1682,8 @@ class Form
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Retourne la liste des catégories en fonction
|
* \brief Retourne la liste des catégories du type choisi
|
||||||
* du nombre choisi.
|
* \param type Type de categories (0=produit, 1=fournisseur, 2=client)
|
||||||
* \param type Type de categories
|
|
||||||
* \param selected Id categorie preselectionnee
|
* \param selected Id categorie preselectionnee
|
||||||
* \param select_name Nom formulaire HTML
|
* \param select_name Nom formulaire HTML
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -41,7 +41,8 @@ WasAddedSuccessfully=a
|
|||||||
CategorySuccessfullyCreated=La catégorie %s a été ajouté avec succès.
|
CategorySuccessfullyCreated=La catégorie %s a été ajouté avec succès.
|
||||||
ProductIsInCategories=Ce produit/service est dans les catégories suivantes
|
ProductIsInCategories=Ce produit/service est dans les catégories suivantes
|
||||||
SupplierIsInCategories=Ce fournisseur est dans les catégories suivantes
|
SupplierIsInCategories=Ce fournisseur est dans les catégories suivantes
|
||||||
CompanyIsInCategories=Cette societé est dans les catégories suivantes
|
CompanyIsInCustomersCategories=Cette societé est dans les catégories clients suivantes
|
||||||
|
CompanyIsInSuppliersCategories=Cette societé est dans les catégories fournisseurs suivantes
|
||||||
ProductHasNoCategory=Ce produit/service n'est dans aucune catégorie en particulier
|
ProductHasNoCategory=Ce produit/service n'est dans aucune catégorie en particulier
|
||||||
SupplierHasNoCategory=Ce fournisseur n'est dans aucune catégorie en particulier
|
SupplierHasNoCategory=Ce fournisseur n'est dans aucune catégorie en particulier
|
||||||
CompanyHasNoCategory=Cette societé n'est dans aucune catégorie en particulier
|
CompanyHasNoCategory=Cette societé n'est dans aucune catégorie en particulier
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user