Added ability to assign a category of product to a customer
This commit is contained in:
parent
6a4cf19923
commit
bd083483b0
@ -45,6 +45,7 @@ class Categorie
|
|||||||
var $id_mere;
|
var $id_mere;
|
||||||
var $label;
|
var $label;
|
||||||
var $description;
|
var $description;
|
||||||
|
var $socid;
|
||||||
var $statut;
|
var $statut;
|
||||||
var $type; // 0=Produit, 1=Fournisseur, 2=Tiers
|
var $type; // 0=Produit, 1=Fournisseur, 2=Tiers
|
||||||
|
|
||||||
@ -124,6 +125,7 @@ class Categorie
|
|||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
$langs->load('categories');
|
$langs->load('categories');
|
||||||
|
|
||||||
if ($this->already_exists ())
|
if ($this->already_exists ())
|
||||||
{
|
{
|
||||||
$this->error=$langs->trans("ImpossibleAddCat");
|
$this->error=$langs->trans("ImpossibleAddCat");
|
||||||
@ -131,8 +133,8 @@ class Categorie
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie (label, description, visible,type) ";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie (label, description, fk_soc, visible, type) ";
|
||||||
$sql .= "VALUES ('".addslashes($this->label)."', '".addslashes($this->description)."', '".$this->visible."',".$this->type.")";
|
$sql .= "VALUES ('".addslashes($this->label)."', '".addslashes($this->description)."','".$this->socid."','".$this->visible."',".$this->type.")";
|
||||||
|
|
||||||
|
|
||||||
$res = $this->db->query ($sql);
|
$res = $this->db->query ($sql);
|
||||||
|
|||||||
@ -48,6 +48,13 @@ if ($_REQUEST['origin'])
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If socid provided by ajax company selector
|
||||||
|
if (! empty($_POST['socid_id']))
|
||||||
|
{
|
||||||
|
$_POST['socid'] = $_POST['socid_id'];
|
||||||
|
$_REQUEST['socid'] = $_REQUEST['socid_id'];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
@ -87,6 +94,7 @@ if ($_POST["action"] == 'add' && $user->rights->categorie->creer)
|
|||||||
$categorie->socid = $_POST["socid"];
|
$categorie->socid = $_POST["socid"];
|
||||||
$categorie->visible = $_POST["visible"];
|
$categorie->visible = $_POST["visible"];
|
||||||
$categorie->type = $_POST["type"];
|
$categorie->type = $_POST["type"];
|
||||||
|
|
||||||
if($_POST['catMere'] != "-1")
|
if($_POST['catMere'] != "-1")
|
||||||
$categorie->id_mere = $_POST['catMere'];
|
$categorie->id_mere = $_POST['catMere'];
|
||||||
|
|
||||||
@ -193,10 +201,10 @@ if ($user->rights->categorie->creer)
|
|||||||
if ($_GET['type'] == 0 && $conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER)
|
if ($_GET['type'] == 0 && $conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER)
|
||||||
{
|
{
|
||||||
print '<tr><td>'.$langs->trans ("AssignedToCustomer").'</td><td>';
|
print '<tr><td>'.$langs->trans ("AssignedToCustomer").'</td><td>';
|
||||||
print $html->select_societes('','socid','s.client = 1 AND s.fournisseur = 0',1);
|
print $html->select_societes($_REQUEST['socid_id'],'socid','s.client = 1 AND s.fournisseur = 0',1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
print '<input type="hidden" name="catMere" value="-1">';
|
print '<input type="hidden" name="catMere" value="-1">';
|
||||||
print '<input type="hidden" name="type" value="0">';
|
print '<input type="hidden" name="visible" value="1">';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -34,4 +34,4 @@ alter table llx_rights_def modify column type varchar(1);
|
|||||||
|
|
||||||
ALTER TABLE `llx_commandedet` ADD column `date_start` DATETIME DEFAULT NULL, ADD `date_end` DATETIME DEFAULT NULL ;
|
ALTER TABLE `llx_commandedet` ADD column `date_start` DATETIME DEFAULT NULL, ADD `date_end` DATETIME DEFAULT NULL ;
|
||||||
|
|
||||||
alter table llx_categorie add column fk_soc integer DEFAULT NULL after description;
|
alter table llx_categorie add column fk_soc integer DEFAULT 0 after description;
|
||||||
|
|||||||
@ -25,7 +25,7 @@ create table llx_categorie
|
|||||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
label VARCHAR(255), -- category name
|
label VARCHAR(255), -- category name
|
||||||
description text, -- description of the category
|
description text, -- description of the category
|
||||||
fk_soc integer DEFAULT NULL, -- attribution of the category has a company (for product only)
|
fk_soc integer DEFAULT 0, -- attribution of the category has a company (for product only)
|
||||||
visible tinyint DEFAULT 1 NOT NULL, -- determine if the products are visible or not
|
visible tinyint DEFAULT 1 NOT NULL, -- determine if the products are visible or not
|
||||||
type tinyint DEFAULT 1 NOT NULL -- category type (product, supplier, customer)
|
type tinyint DEFAULT 1 NOT NULL -- category type (product, supplier, customer)
|
||||||
)type=innodb;
|
)type=innodb;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user