2
0
forked from Wavyzz/dolibarr

Merge branch '8.0' into 8.0_fix9964

This commit is contained in:
Laurent Destailleur
2018-12-14 19:37:40 +01:00
committed by GitHub
10 changed files with 64 additions and 37 deletions

View File

@@ -1910,26 +1910,35 @@ class ExtraFields
/**
* return array_options array of data of extrafields value of object sent by a search form
*
* @param array $extralabels $array of extrafields (@deprecated)
* @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names)
* @param string $keysuffix Suffix string to add into name and id of field (can be used to avoid duplicate names)
* @return array|int array_options set or 0 if no value
* @param array|string $extrafieldsobjectkey array of extrafields (old usage) or value of object->table_element (new usage)
* @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names)
* @param string $keysuffix Suffix string to add into name and id of field (can be used to avoid duplicate names)
* @return array|int array_options set or 0 if no value
*/
function getOptionalsFromPost($extralabels,$keyprefix='',$keysuffix='')
function getOptionalsFromPost($extrafieldsobjectkey, $keyprefix='', $keysuffix='')
{
global $_POST;
if (is_array($this->attributes[$object->table_element]['label'])) $extralabels=$this->attributes[$object->table_element]['label'];
if (is_string($extrafieldsobjectkey) && is_array($this->attributes[$extrafieldsobjectkey]['label']))
{
$extralabels = $this->attributes[$extrafieldsobjectkey]['label'];
}
else
{
$extralabels = $extrafieldsobjectkey;
}
$array_options = array();
if (is_array($extralabels))
{
$array_options = array();
// Get extra fields
foreach ($extralabels as $key => $value)
{
$key_type=$this->attribute_type[$key];
if (! empty($object->table_element) && is_array($this->attributes) && array_key_exists($object->table_element, $this->attributes)) {
$key_type=$this->attributes[$object->table_element]['type'][$key];
$key_type = '';
if (is_string($extrafieldsobjectkey))
{
$key_type = $this->attributes[$extrafieldsobjectkey]['type'][$key];
}
if (in_array($key_type,array('date','datetime')))
@@ -1959,8 +1968,7 @@ class ExtraFields
return $array_options;
}
else {
return 0;
}
return 0;
}
}

View File

@@ -321,13 +321,18 @@ function GETPOST($paramname, $check='none', $method=0, $filter=null, $options=nu
}
}
}
if (! empty($_SESSION['lastsearch_contextpage_'.$relativepathstring])) // If there is saved contextpage
// If there is saved contextpage, page or limit
if ($paramname == 'contextpage' && ! empty($_SESSION['lastsearch_contextpage_'.$relativepathstring]))
{
if ($paramname == 'contextpage')
{
$out = $_SESSION['lastsearch_contextpage_'.$relativepathstring];
//var_dump($paramname.' '.$out);
}
$out = $_SESSION['lastsearch_contextpage_'.$relativepathstring];
}
elseif ($paramname == 'page' && ! empty($_SESSION['lastsearch_page_'.$relativepathstring]))
{
$out = $_SESSION['lastsearch_page_'.$relativepathstring];
}
elseif ($paramname == 'limit' && ! empty($_SESSION['lastsearch_limit_'.$relativepathstring]))
{
$out = $_SESSION['lastsearch_limit_'.$relativepathstring];
}
}
// Else, retreive default values if we are not doing a sort

View File

@@ -477,14 +477,11 @@ class modSociete extends DolibarrModules
$this->import_tables_array[$r]=array('sr'=>MAIN_DB_PREFIX.'societe_rib');
$this->import_fields_array[$r]=array('sr.fk_soc'=>"ThirdPartyName*",'sr.bank'=>"Bank",
'sr.code_banque'=>"BankCode",'sr.code_guichet'=>"DeskCode",'sr.number'=>"BankAccountNumber*",
'sr.cle_rib'=>"BankAccountNumberKey",'sr.bic'=>"BIC",'sr.iban_prefix'=>"IBAN", 'sr.domiciliation'=>"BankAccountDomiciliation",'sr.proprio' => "BankAccountOwner", 'sr.owner_address' => "BankAccountOwnerAddress", 'sr.default_rib' => 'Default',
'sr.fk_departement'=>"StateId",'sr.fk_pays'=>"CountryCode"
'sr.cle_rib'=>"BankAccountNumberKey",'sr.bic'=>"BIC",'sr.iban_prefix'=>"IBAN", 'sr.domiciliation'=>"BankAccountDomiciliation",'sr.proprio' => "BankAccountOwner", 'sr.owner_address' => "BankAccountOwnerAddress", 'sr.default_rib' => 'Default'
);
$this->import_convertvalue_array[$r]=array(
'sr.fk_soc'=>array('rule'=>'fetchidfromref','classfile'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty'),
'sr.fk_departement'=>array('rule'=>'fetchidfromcodeid','classfile'=>'/core/class/cstate.class.php','class'=>'Cstate','method'=>'fetch','dict'=>'DictionaryState'),
'sr.fk_pays'=>array('rule'=>'fetchidfromcodeid','classfile'=>'/core/class/ccountry.class.php','class'=>'Ccountry','method'=>'fetch','dict'=>'DictionaryCountry'),
'sr.fk_soc'=>array('rule'=>'fetchidfromref','classfile'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty')
);
$this->import_examplevalues_array[$r]=array('sr.fk_soc'=>"MyBigCompany",'sr.bank'=>"ING",
'sr.code_banque'=>"0000", 'sr.code_guichet'=>"1111",'sr.number'=>"3333333333",