Ajout bouton "Annuler" sur page creation categorie
This commit is contained in:
parent
8124d494bd
commit
3ffe25a633
@ -468,19 +468,22 @@ class Categorie
|
||||
* \brief Reconstruit l'arborescence des catégories sous la forme d'un tableau
|
||||
* Renvoi un tableau de tableau('id','id_mere',...) trié selon
|
||||
* arbre et avec:
|
||||
* id = id de la categorie
|
||||
* id_mere = id de la categorie mere
|
||||
* id_children = tableau des id enfant
|
||||
* label = nom de la categorie
|
||||
* fulllabel = nom avec chemin complet de la categorie
|
||||
* fullpath = chemin complet compose des id
|
||||
* \return array Tableau de array
|
||||
* id = id de la categorie
|
||||
* id_mere = id de la categorie mere
|
||||
* id_children = tableau des id enfant
|
||||
* label = nom de la categorie
|
||||
* fulllabel = nom avec chemin complet de la categorie
|
||||
* fullpath = chemin complet compose des id
|
||||
* \param type Type de categories (0=produit, 1=fournisseur, 2=client)
|
||||
* \return array Tableau de array
|
||||
*/
|
||||
function get_full_arbo($type)
|
||||
{
|
||||
// Charge tableau des meres
|
||||
$sql = "SELECT fk_categorie_mere as id_mere, fk_categorie_fille as id_fille";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."categorie_association";
|
||||
|
||||
dolibarr_syslog("Categorie::get_full_arbo sql=".$sql);
|
||||
$res = $this->db->query ($sql);
|
||||
if ($res)
|
||||
{
|
||||
@ -502,6 +505,8 @@ class Categorie
|
||||
$sql.= " ON c.rowid=ca.fk_categorie_mere";
|
||||
$sql.= " WHERE c.type = ".$type;
|
||||
$sql.= " ORDER BY c.label, c.rowid";
|
||||
|
||||
dolibarr_syslog("Categorie::get_full_arbo sql=".$sql);
|
||||
$res = $this->db->query ($sql);
|
||||
if ($res)
|
||||
{
|
||||
@ -866,7 +871,6 @@ class Categorie
|
||||
$sql.= " WHERE ct.fk_".$type." = ".$id." AND c.type = ".$typeid;
|
||||
|
||||
$res = $this->db->query ($sql);
|
||||
|
||||
if ($res)
|
||||
{
|
||||
while ($cat = $this->db->fetch_array ($res))
|
||||
|
||||
@ -20,7 +20,6 @@
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -110,7 +109,7 @@ if (isset($_REQUEST["catMere"]) && $_REQUEST["catMere"]>=0)
|
||||
$html = new Form($db);
|
||||
|
||||
/*
|
||||
* Fiche objet client/fournisseur
|
||||
* Fiche categorie de client et/ou fournisseur
|
||||
*/
|
||||
if ($_GET["socid"])
|
||||
{
|
||||
@ -186,26 +185,21 @@ if ($_GET["socid"])
|
||||
|
||||
if ($mesg) print($mesg);
|
||||
|
||||
if ($soc->client)
|
||||
{
|
||||
formCategory($db,$soc,$type,2);
|
||||
print '<br><br>';
|
||||
}
|
||||
if ($soc->client) formCategory($db,$soc,$type,2);
|
||||
|
||||
if ($soc->client && $soc->fournisseur) print '<br><br>';
|
||||
|
||||
if ($soc->fournisseur) formCategory($db,$soc,$type,1);
|
||||
}
|
||||
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."/product.class.php");
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/product.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/product.class.php");
|
||||
|
||||
/*
|
||||
* Creation de l'objet produit correspondant à l'id
|
||||
*/
|
||||
|
||||
// Produit
|
||||
$product = new Product($db);
|
||||
if ($_GET["ref"]) $result = $product->fetch('',$_GET["ref"]);
|
||||
if ($_GET["id"]) $result = $product->fetch($_GET["id"]);
|
||||
@ -213,9 +207,9 @@ else if ($_GET["id"] || $_GET["ref"])
|
||||
llxHeader("","",$langs->trans("CardProduct".$product->type));
|
||||
|
||||
|
||||
$head=product_prepare_head($product, $user);
|
||||
$titre=$langs->trans("CardProduct".$product->type);
|
||||
dolibarr_fiche_head($head, 'category', $titre);
|
||||
$head=product_prepare_head($product, $user);
|
||||
$titre=$langs->trans("CardProduct".$product->type);
|
||||
dolibarr_fiche_head($head, 'category', $titre);
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
@ -230,8 +224,8 @@ else if ($_GET["id"] || $_GET["ref"])
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$product->libelle.'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Prix
|
||||
print '<tr><td>'.$langs->trans("SellingPrice").'</td><td colspan="2">';
|
||||
// Prix
|
||||
print '<tr><td>'.$langs->trans("SellingPrice").'</td><td colspan="2">';
|
||||
if ($product->price_base_type == 'TTC')
|
||||
{
|
||||
print price($product->price_ttc).' '.$langs->trans($product->price_base_type);
|
||||
@ -242,10 +236,10 @@ else if ($_GET["id"] || $_GET["ref"])
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Statut
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="2">';
|
||||
// Statut
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="2">';
|
||||
print $product->getLibStatut(2);
|
||||
print '</td></tr>';
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
@ -254,23 +248,22 @@ else if ($_GET["id"] || $_GET["ref"])
|
||||
if ($mesg) print($mesg);
|
||||
|
||||
formCategory($db,$product,'product',0);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Fonction Barre d'actions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Fonction Barre d'actions
|
||||
*/
|
||||
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')
|
||||
{
|
||||
$nameId = 'socid';
|
||||
if ($typeid == 2) $title = $langs->trans("CustomersCategoriesShort");
|
||||
if ($typeid == 1) $title = $langs->trans("SuppliersCategoriesShort");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -304,9 +297,11 @@ function formCategory($db,$object,$type,$typeid)
|
||||
|
||||
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 '<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;
|
||||
foreach ($cats as $cat)
|
||||
@ -337,7 +332,7 @@ function formCategory($db,$object,$type,$typeid)
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
print "</table><br/>\n";
|
||||
print "</table>\n";
|
||||
}
|
||||
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)
|
||||
{
|
||||
// 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->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
|
||||
*/
|
||||
@ -168,7 +192,9 @@ if ($user->rights->categorie->creer)
|
||||
print $html->selectyesno("visible", 1,1);
|
||||
print '</td></tr>';
|
||||
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>';
|
||||
|
||||
}
|
||||
|
||||
@ -1682,9 +1682,8 @@ class Form
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Retourne la liste des catégories en fonction
|
||||
* du nombre choisi.
|
||||
* \param type Type de categories
|
||||
* \brief Retourne la liste des catégories du type choisi
|
||||
* \param type Type de categories (0=produit, 1=fournisseur, 2=client)
|
||||
* \param selected Id categorie preselectionnee
|
||||
* \param select_name Nom formulaire HTML
|
||||
*/
|
||||
|
||||
@ -41,7 +41,8 @@ WasAddedSuccessfully=a
|
||||
CategorySuccessfullyCreated=La catégorie %s a été ajouté avec succès.
|
||||
ProductIsInCategories=Ce produit/service 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
|
||||
SupplierHasNoCategory=Ce fournisseur 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