Merge branch '7.0' of git@github.com:Dolibarr/dolibarr.git into 7.0
This commit is contained in:
commit
af9fff4f83
@ -295,7 +295,7 @@ function dol_dir_list_in_database($path, $filter="", $excludefilter=null, $sortc
|
|||||||
* Complete $filearray with data from database.
|
* Complete $filearray with data from database.
|
||||||
* This will call doldir_list_indatabase to complate filearray.
|
* This will call doldir_list_indatabase to complate filearray.
|
||||||
*
|
*
|
||||||
* @param array $filearray Array of files get using dol_dir_list
|
* @param array $filearray Array of files get using dol_dir_list
|
||||||
* @param string $relativedir Relative dir from DOL_DATA_ROOT
|
* @param string $relativedir Relative dir from DOL_DATA_ROOT
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -715,9 +715,12 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
|
|||||||
global $conf,$user;
|
global $conf,$user;
|
||||||
|
|
||||||
if (! is_object($objsoc)) $valueforccc=$objsoc;
|
if (! is_object($objsoc)) $valueforccc=$objsoc;
|
||||||
else if($table == "commande_fournisseur" || $table == "facture_fourn" ) $valueforccc=$objsoc->code_fournisseur;
|
else if ($table == "commande_fournisseur" || $table == "facture_fourn" ) $valueforccc=$objsoc->code_fournisseur;
|
||||||
else $valueforccc=$objsoc->code_client;
|
else $valueforccc=$objsoc->code_client;
|
||||||
|
|
||||||
|
$sharetable = $table;
|
||||||
|
if ($table == 'facture' || $table == 'invoice') $sharetable = 'invoicenumber'; // for getEntity function
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
if ($date == '') $date=dol_now(); // We use local year and month of PHP server to search numbers
|
if ($date == '') $date=dol_now(); // We use local year and month of PHP server to search numbers
|
||||||
// but we should use local year and month of user
|
// but we should use local year and month of user
|
||||||
@ -979,7 +982,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
|
|||||||
$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
|
if ($bentityon) // only if entity enable
|
||||||
$sql.= " AND entity IN (".getEntity($table, 1).")";
|
$sql.= " AND entity IN (".getEntity($sharetable).")";
|
||||||
|
|
||||||
if ($where) $sql.=$where;
|
if ($where) $sql.=$where;
|
||||||
if ($sqlwhere) $sql.=' AND '.$sqlwhere;
|
if ($sqlwhere) $sql.=' AND '.$sqlwhere;
|
||||||
@ -1027,7 +1030,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
|
|||||||
$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
|
if ($bentityon) // only if entity enable
|
||||||
$sql.= " AND entity IN (".getEntity($table, 1).")";
|
$sql.= " AND entity IN (".getEntity($sharetable).")";
|
||||||
if ($where) $sql.=$where;
|
if ($where) $sql.=$where;
|
||||||
if ($sqlwhere) $sql.=' AND '.$sqlwhere;
|
if ($sqlwhere) $sql.=' AND '.$sqlwhere;
|
||||||
|
|
||||||
@ -1081,7 +1084,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
|
|||||||
//$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
|
if ($bentityon) // only if entity enable
|
||||||
$maskrefclient_sql.= " AND entity IN (".getEntity($table, 1).")";
|
$maskrefclient_sql.= " AND entity IN (".getEntity($sharetable).")";
|
||||||
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
|
||||||
$maskrefclient_sql.=' AND (SUBSTRING('.$field.', '.(strpos($maskwithnocode,$maskrefclient)+1).', '.dol_strlen($maskrefclient_maskclientcode).")='".$maskrefclient_clientcode."')";
|
$maskrefclient_sql.=' AND (SUBSTRING('.$field.', '.(strpos($maskwithnocode,$maskrefclient)+1).', '.dol_strlen($maskrefclient_maskclientcode).")='".$maskrefclient_clientcode."')";
|
||||||
|
|||||||
@ -153,7 +153,7 @@ class mod_facture_mars extends ModeleNumRefFactures
|
|||||||
$sql = "SELECT MAX(CAST(SUBSTRING(facnumber FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL
|
$sql = "SELECT MAX(CAST(SUBSTRING(facnumber FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture";
|
$sql.= " FROM ".MAIN_DB_PREFIX."facture";
|
||||||
$sql.= " WHERE facnumber LIKE '".$prefix."____-%'";
|
$sql.= " WHERE facnumber LIKE '".$prefix."____-%'";
|
||||||
$sql.= " AND entity IN (".getEntity('facture').")";
|
$sql.= " AND entity IN (".getEntity('invoicenumber').")";
|
||||||
|
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG);
|
dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG);
|
||||||
@ -177,7 +177,7 @@ class mod_facture_mars extends ModeleNumRefFactures
|
|||||||
$sql = "SELECT facnumber as ref";
|
$sql = "SELECT facnumber as ref";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture";
|
$sql.= " FROM ".MAIN_DB_PREFIX."facture";
|
||||||
$sql.= " WHERE facnumber LIKE '".$prefix."____-".$num."'";
|
$sql.= " WHERE facnumber LIKE '".$prefix."____-".$num."'";
|
||||||
$sql.= " AND entity IN (".getEntity('facture').")";
|
$sql.= " AND entity IN (".getEntity('invoicenumber').")";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG);
|
dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG);
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
|
|||||||
@ -169,7 +169,7 @@ class mod_facture_terre extends ModeleNumRefFactures
|
|||||||
$sql = "SELECT MAX(CAST(SUBSTRING(facnumber FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL
|
$sql = "SELECT MAX(CAST(SUBSTRING(facnumber FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture";
|
$sql.= " FROM ".MAIN_DB_PREFIX."facture";
|
||||||
$sql.= " WHERE facnumber LIKE '".$prefix."____-%'";
|
$sql.= " WHERE facnumber LIKE '".$prefix."____-%'";
|
||||||
$sql.= " AND entity IN (".getEntity('facture').")";
|
$sql.= " AND entity IN (".getEntity('invoicenumber').")";
|
||||||
|
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG);
|
dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG);
|
||||||
@ -193,7 +193,7 @@ class mod_facture_terre extends ModeleNumRefFactures
|
|||||||
$sql = "SELECT facnumber as ref";
|
$sql = "SELECT facnumber as ref";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture";
|
$sql.= " FROM ".MAIN_DB_PREFIX."facture";
|
||||||
$sql.= " WHERE facnumber LIKE '".$prefix."____-".$num."'";
|
$sql.= " WHERE facnumber LIKE '".$prefix."____-".$num."'";
|
||||||
$sql.= " AND entity IN (".getEntity('facture').")";
|
$sql.= " AND entity IN (".getEntity('invoicenumber').")";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG);
|
dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG);
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user