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 $label;
|
||||
var $description;
|
||||
var $socid;
|
||||
var $statut;
|
||||
var $type; // 0=Produit, 1=Fournisseur, 2=Tiers
|
||||
|
||||
@ -124,6 +125,7 @@ class Categorie
|
||||
{
|
||||
global $langs;
|
||||
$langs->load('categories');
|
||||
|
||||
if ($this->already_exists ())
|
||||
{
|
||||
$this->error=$langs->trans("ImpossibleAddCat");
|
||||
@ -131,8 +133,8 @@ class Categorie
|
||||
return -1;
|
||||
}
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie (label, description, visible,type) ";
|
||||
$sql .= "VALUES ('".addslashes($this->label)."', '".addslashes($this->description)."', '".$this->visible."',".$this->type.")";
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie (label, description, fk_soc, visible, type) ";
|
||||
$sql .= "VALUES ('".addslashes($this->label)."', '".addslashes($this->description)."','".$this->socid."','".$this->visible."',".$this->type.")";
|
||||
|
||||
|
||||
$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
|
||||
@ -87,6 +94,7 @@ if ($_POST["action"] == 'add' && $user->rights->categorie->creer)
|
||||
$categorie->socid = $_POST["socid"];
|
||||
$categorie->visible = $_POST["visible"];
|
||||
$categorie->type = $_POST["type"];
|
||||
|
||||
if($_POST['catMere'] != "-1")
|
||||
$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)
|
||||
{
|
||||
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 '<input type="hidden" name="catMere" value="-1">';
|
||||
print '<input type="hidden" name="type" value="0">';
|
||||
print '<input type="hidden" name="visible" value="1">';
|
||||
}
|
||||
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_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,
|
||||
label VARCHAR(255), -- category name
|
||||
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
|
||||
type tinyint DEFAULT 1 NOT NULL -- category type (product, supplier, customer)
|
||||
)type=innodb;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user