Merge pull request #1963 from defrance69/patch-24
Update functions2.lib.php
This commit is contained in:
commit
fb76fc94b5
@ -581,9 +581,10 @@ function array2table($data,$tableMarkup=1,$tableoptions='',$troptions='',$tdopti
|
|||||||
* @param Societe $objsoc The company that own the object we need a counter for
|
* @param Societe $objsoc The company that own the object we need a counter for
|
||||||
* @param string $date Date to use for the {y},{m},{d} tags.
|
* @param string $date Date to use for the {y},{m},{d} tags.
|
||||||
* @param string $mode 'next' for next value or 'last' for last value
|
* @param string $mode 'next' for next value or 'last' for last value
|
||||||
|
* @param bool $bentityon activate the entity filterdefault is true (for modules not compatible with multicompany)
|
||||||
* @return string New value (numeric) or error message
|
* @return string New value (numeric) or error message
|
||||||
*/
|
*/
|
||||||
function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$mode='next')
|
function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$mode='next', $bentityon=true)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
@ -784,6 +785,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX.$table;
|
$sql.= " FROM ".MAIN_DB_PREFIX.$table;
|
||||||
$sql.= " WHERE ".$field." LIKE '".$maskLike."'";
|
$sql.= " WHERE ".$field." LIKE '".$maskLike."'";
|
||||||
$sql.= " AND ".$field." NOT LIKE '%PROV%'";
|
$sql.= " AND ".$field." NOT LIKE '%PROV%'";
|
||||||
|
if ($bentityon) // only if entity enable
|
||||||
$sql.= " AND entity IN (".getEntity($table, 1).")";
|
$sql.= " AND entity IN (".getEntity($table, 1).")";
|
||||||
if ($where) $sql.=$where;
|
if ($where) $sql.=$where;
|
||||||
if ($sqlwhere) $sql.=' AND '.$sqlwhere;
|
if ($sqlwhere) $sql.=' AND '.$sqlwhere;
|
||||||
@ -824,6 +826,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX.$table;
|
$sql.= " FROM ".MAIN_DB_PREFIX.$table;
|
||||||
$sql.= " WHERE ".$field." LIKE '".$maskLike."'";
|
$sql.= " WHERE ".$field." LIKE '".$maskLike."'";
|
||||||
$sql.= " AND ".$field." NOT LIKE '%PROV%'";
|
$sql.= " AND ".$field." NOT LIKE '%PROV%'";
|
||||||
|
if ($bentityon) // only if entity enable
|
||||||
$sql.= " AND entity IN (".getEntity($table, 1).")";
|
$sql.= " AND entity IN (".getEntity($table, 1).")";
|
||||||
if ($where) $sql.=$where;
|
if ($where) $sql.=$where;
|
||||||
if ($sqlwhere) $sql.=' AND '.$sqlwhere;
|
if ($sqlwhere) $sql.=' AND '.$sqlwhere;
|
||||||
@ -877,6 +880,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
|
|||||||
$maskrefclient_sql.= " FROM ".MAIN_DB_PREFIX.$table;
|
$maskrefclient_sql.= " FROM ".MAIN_DB_PREFIX.$table;
|
||||||
//$sql.= " WHERE ".$field." not like '(%'";
|
//$sql.= " WHERE ".$field." not like '(%'";
|
||||||
$maskrefclient_sql.= " WHERE ".$field." LIKE '".$maskrefclient_maskLike."'";
|
$maskrefclient_sql.= " WHERE ".$field." LIKE '".$maskrefclient_maskLike."'";
|
||||||
|
if ($bentityon) // only if entity enable
|
||||||
$maskrefclient_sql.= " AND entity IN (".getEntity($table, 1).")";
|
$maskrefclient_sql.= " AND entity IN (".getEntity($table, 1).")";
|
||||||
if ($where) $maskrefclient_sql.=$where; //use the same optional where as general mask
|
if ($where) $maskrefclient_sql.=$where; //use the same optional where as general mask
|
||||||
if ($sqlwhere) $maskrefclient_sql.=' AND '.$sqlwhere; //use the same sqlwhere as general mask
|
if ($sqlwhere) $maskrefclient_sql.=' AND '.$sqlwhere; //use the same sqlwhere as general mask
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user