diff --git a/htdocs/html.formfile.class.php b/htdocs/html.formfile.class.php
index 13dd7877c7c..1fc19aed571 100644
--- a/htdocs/html.formfile.class.php
+++ b/htdocs/html.formfile.class.php
@@ -129,7 +129,7 @@ class FormFile
* \param genallowed Generation is allowed (1/0 or array of formats)
* \param delallowed Remove is allowed (1/0)
* \param modelselected Model to preselect by default
- * \param showwarning Show warning if no model activated
+ * \param allowgenifempty Show warning if no model activated
* \param forcenomultilang Do not show language option (even if MAIN_MULTILANGS defined)
* \param iconPDF Show only PDF icon with link (1/0)
* \param maxfilenamelength Max length for filename shown
@@ -140,7 +140,7 @@ class FormFile
* \param codelang Default language code to use on lang combo box if multilang is enabled
* \return int <0 if KO, number of shown files if OK
*/
- function show_documents($modulepart,$filename,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$showwarning=1,$forcenomultilang=0,$iconPDF=0,$maxfilenamelength=28,$noform=0,$param='',$title='',$buttonlabel='',$codelang='')
+ function show_documents($modulepart,$filename,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$allowgenifempty=1,$forcenomultilang=0,$iconPDF=0,$maxfilenamelength=28,$noform=0,$param='',$title='',$buttonlabel='',$codelang='')
{
// filedir = conf->...dir_ouput."/".get_exdir(id)
include_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php');
@@ -339,7 +339,7 @@ class FormFile
// Language code (if multilang)
print '
';
- if (($showwarning || (is_array($modellist) && sizeof($modellist) > 0)) && $conf->global->MAIN_MULTILANGS && ! $forcenomultilang)
+ if (($allowgenifempty || (is_array($modellist) && sizeof($modellist) > 0)) && $conf->global->MAIN_MULTILANGS && ! $forcenomultilang)
{
include_once(DOL_DOCUMENT_ROOT.'/html.formadmin.class.php');
$formadmin=new FormAdmin($this->db);
@@ -357,9 +357,9 @@ class FormFile
print '';
- if ($showwarning && ! is_array($modellist) && empty($modellist))
+ if ($allowgenifempty && ! is_array($modellist) && empty($modellist))
{
$langs->load("errors");
print ' '.img_warning($langs->trans("WarningNoDocumentModelActivated"));
diff --git a/htdocs/includes/modules/societe/doc/doc_generic_odt.modules.php b/htdocs/includes/modules/societe/doc/doc_generic_odt.modules.php
index 91118236d42..b7a11a4e530 100644
--- a/htdocs/includes/modules/societe/doc/doc_generic_odt.modules.php
+++ b/htdocs/includes/modules/societe/doc/doc_generic_odt.modules.php
@@ -54,7 +54,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc
$langs->load("companies");
$this->db = $db;
- $this->name = "Generic ODT";
+ $this->name = "ODT templates";
$this->description = $langs->trans("DocumentModelOdt");
$this->scandir = 'COMPANY_ADDON_PDF_ODT_PATH'; // Name of constant that is used to save list of directories to scan
diff --git a/htdocs/lib/functions2.lib.php b/htdocs/lib/functions2.lib.php
index 96ffaeb86ca..e08a364874f 100644
--- a/htdocs/lib/functions2.lib.php
+++ b/htdocs/lib/functions2.lib.php
@@ -1019,7 +1019,7 @@ function picto_from_langcode($codelang)
*/
function getListOfModels($db,$type)
{
- global $conf;
+ global $conf,$langs;
$liste=array();
$found=0;
@@ -1041,9 +1041,9 @@ function getListOfModels($db,$type)
$obj = $db->fetch_object($resql);
- // If this generation module needs a directory scan, then description field is filled
+ // If this generation module needs to scan a directory, then description field is filled
// with the constant that contains list of directories to scan.
- if (! empty($obj->description))
+ if (! empty($obj->description)) // List of directories to scan is defined
{
$const=$obj->description;
$dirtoscan.=($dirtoscan?',':'').preg_replace('/[\r\n]+/',',',trim($conf->global->$const));
@@ -1064,9 +1064,16 @@ function getListOfModels($db,$type)
}
}
- foreach($listoffiles as $record)
+ if (sizeof($listoffiles))
{
- $liste[$obj->id.':'.$record['fullname']]=dol_trunc($record['name'],24,'middle');
+ foreach($listoffiles as $record)
+ {
+ $liste[$obj->id.':'.$record['fullname']]=dol_trunc($record['name'],24,'middle');
+ }
+ }
+ else
+ {
+ $liste[0]=$obj->label.': '.$langs->trans("None");
}
}
else