Merge branch '10.0' of git@github.com:Dolibarr/dolibarr.git into 11.0
This commit is contained in:
commit
496d429dcd
@ -56,6 +56,8 @@ $subcat = false;
|
|||||||
if (GETPOST('subcat', 'alpha') === 'yes') {
|
if (GETPOST('subcat', 'alpha') === 'yes') {
|
||||||
$subcat = true;
|
$subcat = true;
|
||||||
}
|
}
|
||||||
|
$categorie = new Categorie($db);
|
||||||
|
|
||||||
// product/service
|
// product/service
|
||||||
$selected_type = GETPOST('search_type', 'int');
|
$selected_type = GETPOST('search_type', 'int');
|
||||||
if ($selected_type =='') $selected_type = -1;
|
if ($selected_type =='') $selected_type = -1;
|
||||||
@ -233,10 +235,6 @@ if ($modecompta == 'CREANCES-DETTES')
|
|||||||
{
|
{
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product";
|
||||||
}
|
}
|
||||||
elseif ($selected_cat) // Into a specific category
|
|
||||||
{
|
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_product as cp";
|
|
||||||
}
|
|
||||||
$sql.= " WHERE l.fk_facture = f.rowid";
|
$sql.= " WHERE l.fk_facture = f.rowid";
|
||||||
$sql.= " AND f.fk_statut in (1,2)";
|
$sql.= " AND f.fk_statut in (1,2)";
|
||||||
$sql.= " AND l.product_type in (0,1)";
|
$sql.= " AND l.product_type in (0,1)";
|
||||||
@ -257,10 +255,24 @@ if ($modecompta == 'CREANCES-DETTES')
|
|||||||
$sql.=" AND cp.fk_product is null";
|
$sql.=" AND cp.fk_product is null";
|
||||||
}
|
}
|
||||||
elseif ($selected_cat) { // Into a specific category
|
elseif ($selected_cat) { // Into a specific category
|
||||||
$sql.= " AND (c.rowid = ".$selected_cat;
|
|
||||||
if ($subcat) $sql.=" OR c.fk_parent = " . $selected_cat;
|
if ($subcat)
|
||||||
$sql.= ")";
|
{
|
||||||
$sql.= " AND cp.fk_categorie = c.rowid AND cp.fk_product = p.rowid";
|
$TListOfCats = $categorie->get_full_arbo('product', $selected_cat, 1);
|
||||||
|
|
||||||
|
$listofcatsql = "";
|
||||||
|
foreach ($TListOfCats as $key => $cat)
|
||||||
|
{
|
||||||
|
if ($key !== 0) $listofcatsql .= ",";
|
||||||
|
$listofcatsql .= $cat['rowid'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql.= " AND (p.rowid IN ";
|
||||||
|
$sql .= " (SELECT fk_product FROM ".MAIN_DB_PREFIX."categorie_product cp WHERE ";
|
||||||
|
if ($subcat) $sql .= "cp.fk_categorie IN (". $listofcatsql.")";
|
||||||
|
else $sql.="cp.fk_categorie = ".$selected_cat;
|
||||||
|
$sql.= "))";
|
||||||
}
|
}
|
||||||
if($selected_soc > 0) $sql .= " AND soc.rowid=".$selected_soc;
|
if($selected_soc > 0) $sql .= " AND soc.rowid=".$selected_soc;
|
||||||
$sql.= " AND f.entity IN (".getEntity('invoice').")";
|
$sql.= " AND f.entity IN (".getEntity('invoice').")";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user