Fix: for shared thirdparties

Conflicts:

	htdocs/core/class/html.form.class.php
	htdocs/societe/societe.php
This commit is contained in:
Regis Houssin
2012-02-01 11:36:16 +01:00
parent f1d2d8f412
commit f2df94bf32
7 changed files with 794 additions and 472 deletions

View File

@@ -510,7 +510,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
$sql.= " FROM ".MAIN_DB_PREFIX.$table;
$sql.= " WHERE ".$field." LIKE '".$maskLike."'";
$sql.= " AND ".$field." NOT LIKE '%PROV%'";
$sql.= " AND entity = ".getEntity($table);
$sql.= " AND entity IN (".getEntity($table, 1).")";
if ($where) $sql.=$where;
if ($sqlwhere) $sql.=' AND '.$sqlwhere;
@@ -547,7 +547,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
$sql = "SELECT facnumber as ref";
$sql.= " FROM ".MAIN_DB_PREFIX."facture";
$sql.= " WHERE facnumber LIKE '".$maskLike."'";
$sql.= " AND entity = ".$conf->entity;
$sql.= " AND entity IN (".getEntity($table, 1).")";
dol_syslog("mod_facture_terre::getNextValue sql=".$sql);
$resql=$db->query($sql);
@@ -592,7 +592,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
$maskrefclient_sql.= " FROM ".MAIN_DB_PREFIX.$table;
//$sql.= " WHERE ".$field." not like '(%'";
$maskrefclient_sql.= " WHERE ".$field." LIKE '".$maskrefclient_maskLike."'";
$maskrefclient_sql.= " AND entity = ".$conf->entity;
$maskrefclient_sql.= " AND entity IN (".getEntity($table, 1).")";
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
$maskrefclient_sql.=' AND (SUBSTRING('.$field.', '.(strpos($maskwithnocode,$maskrefclient)+1).', '.dol_strlen($maskrefclient_maskclientcode).")='".$maskrefclient_clientcode."')";