Merge pull request #1985 from FHenry/3.6

Fix extrafield from list feature where filter is provided
This commit is contained in:
Laurent Destailleur 2014-10-30 17:49:03 +01:00
commit bb72932601
3 changed files with 15 additions and 6 deletions

View File

@ -11,6 +11,7 @@ English Dolibarr ChangeLog
- Fix: right and error management #1961 - Fix: right and error management #1961
- Fix: Fix Error when trying to clone an Order #1943 - Fix: Fix Error when trying to clone an Order #1943
- Fix: [ bug #1618 ] PHP Error thrown when saving a barcode - Fix: [ bug #1618 ] PHP Error thrown when saving a barcode
- Fix: webservice Thirdparty parameter lastname for invidual creation is now lastname and not ref
***** ChangeLog for 3.6.1 compared to 3.6.* ***** ***** ChangeLog for 3.6.1 compared to 3.6.* *****
For users: For users:

View File

@ -743,15 +743,17 @@ class ExtraFields
if (strpos($InfoFieldList[4], 'extra')!==false) if (strpos($InfoFieldList[4], 'extra')!==false)
{ {
$sql.= ' as main, '.MAIN_DB_PREFIX .$InfoFieldList[0].'_extrafields as extra'; $sql.= ' as main, '.MAIN_DB_PREFIX .$InfoFieldList[0].'_extrafields as extra';
$sqlwhere.= ' AND extra.fk_object=main.'.$InfoFieldList[2]. ' AND '.$InfoFieldList[4]; $sqlwhere.= ' WHERE extra.fk_object=main.'.$InfoFieldList[2]. ' AND '.$InfoFieldList[4];
} }
else else
{ {
$sqlwhere.= ' AND '.$InfoFieldList[4]; $sqlwhere.= ' WHERE '.$InfoFieldList[4];
} }
}else {
$sqlwhere.= ' WHERE 1';
} }
if (in_array($InfoFieldList[0],array('tablewithentity'))) $sqlwhere.= ' AND entity = '.$conf->entity; // Some tables may have field, some other not. For the moment we disable it. if (in_array($InfoFieldList[0],array('tablewithentity'))) $sqlwhere.= ' AND entity = '.$conf->entity; // Some tables may have field, some other not. For the moment we disable it.
$sql.=preg_replace('/^ AND /','',$sqlwhere); //$sql.=preg_replace('/^ AND /','',$sqlwhere);
//print $sql; //print $sql;
dol_syslog(get_class($this).'::showInputField type=sellist sql='.$sql); dol_syslog(get_class($this).'::showInputField type=sellist sql='.$sql);
@ -979,7 +981,10 @@ class ExtraFields
{ {
foreach ($fields_label as $field_toshow) foreach ($fields_label as $field_toshow)
{ {
$translabel=$langs->trans($obj->$field_toshow); $translabel='';
if (!empty($obj->$field_toshow)) {
$translabel=$langs->trans($obj->$field_toshow);
}
if ($translabel!=$field_toshow) { if ($translabel!=$field_toshow) {
$value.=dol_trunc($translabel,18).' '; $value.=dol_trunc($translabel,18).' ';
}else { }else {
@ -989,7 +994,10 @@ class ExtraFields
} }
else else
{ {
$translabel=$langs->trans($obj->$InfoFieldList[1]); $translabel='';
if (!empty($obj->$InfoFieldList[1])) {
$translabel=$langs->trans($obj->$InfoFieldList[1]);
}
if ($translabel!=$obj->$InfoFieldList[1]) { if ($translabel!=$obj->$InfoFieldList[1]) {
$value=dol_trunc($translabel,18); $value=dol_trunc($translabel,18);
}else { }else {

View File

@ -460,7 +460,7 @@ function createThirdParty($authentication,$thirdparty)
$result=$newobject->create($fuser); $result=$newobject->create($fuser);
if ($newobject->particulier && $result > 0) { if ($newobject->particulier && $result > 0) {
$newobject->firstname = $thirdparty['firstname']; $newobject->firstname = $thirdparty['firstname'];
$newobject->name_bis = $thirdparty['ref']; $newobject->name_bis = $thirdparty['lastname'];
$result = $newobject->create_individual($fuser); $result = $newobject->create_individual($fuser);
} }
if ($result <= 0) if ($result <= 0)