Debug modulebuilder

This commit is contained in:
Laurent Destailleur 2019-11-06 19:38:51 +01:00
parent 4455a21dab
commit 74f2983ee1
2 changed files with 15 additions and 3 deletions

View File

@ -5962,7 +5962,7 @@ class Form
* @param int $forcecombo Force to load all values and output a standard combobox (with no beautification)
* @param int $outputmode 0=HTML select string, 1=Array
* @param int $disabled 1=Html component is disabled
* @return string Return HTML string
* @return string|array Return HTML string
* @see selectForForms()
*/
public function selectForFormsList($objecttmp, $htmlname, $preselectedvalue, $showempty = '', $searchkey = '', $placeholder = '', $morecss = '', $moreparams = '', $forcecombo = 0, $outputmode = 0, $disabled = 0)
@ -5975,8 +5975,7 @@ class Form
if ($prefixforautocompletemode == 'societe') $prefixforautocompletemode='company';
$confkeyforautocompletemode=strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
$fieldstoshow='t.ref';
if (! empty($objecttmp->fields)) // For object that declare it, it is better to use declared fields ( like societe, contact, ...)
if (! empty($objecttmp->fields)) // For object that declare it, it is better to use declared fields (like societe, contact, ...)
{
$tmpfieldstoshow='';
foreach($objecttmp->fields as $key => $val)
@ -5985,6 +5984,18 @@ class Form
}
if ($tmpfieldstoshow) $fieldstoshow = $tmpfieldstoshow;
}
if (empty($fieldstoshow))
{
if (isset($objecttmp->fields['ref'])) {
$fieldstoshow='t.ref';
}
else
{
$langs->load("errors");
$this->error = $langs->trans("ErrorNoFieldWithAttributeShowoncombobox");
return $langs->trans('ErrorNoFieldWithAttributeShowoncombobox');
}
}
$out='';
$outarray=array();

View File

@ -222,6 +222,7 @@ ErrorDeletePaymentLinkedToAClosedInvoiceNotPossible=Error, delete payment linked
ErrorSearchCriteriaTooSmall=Search criteria too small.
ErrorObjectMustHaveStatusActiveToBeDisabled=Objects must have status 'Active' to be disabled
ErrorObjectMustHaveStatusDraftOrDisabledToBeActivated=Objects must have status 'Draft' or 'Disabled' to be enabled
ErrorNoFieldWithAttributeShowoncombobox=No fields has property 'showoncombobox' into definition of object '%s'. No way to show the combolist.
# Warnings
WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup.
WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user.