Works on ODT import
This commit is contained in:
parent
bdf4bbaa1f
commit
9f7bb65a1d
@ -129,7 +129,7 @@ class FormFile
|
|||||||
* \param genallowed Generation is allowed (1/0 or array of formats)
|
* \param genallowed Generation is allowed (1/0 or array of formats)
|
||||||
* \param delallowed Remove is allowed (1/0)
|
* \param delallowed Remove is allowed (1/0)
|
||||||
* \param modelselected Model to preselect by default
|
* \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 forcenomultilang Do not show language option (even if MAIN_MULTILANGS defined)
|
||||||
* \param iconPDF Show only PDF icon with link (1/0)
|
* \param iconPDF Show only PDF icon with link (1/0)
|
||||||
* \param maxfilenamelength Max length for filename shown
|
* \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
|
* \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
|
* \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)
|
// filedir = conf->...dir_ouput."/".get_exdir(id)
|
||||||
include_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php');
|
include_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php');
|
||||||
@ -339,7 +339,7 @@ class FormFile
|
|||||||
|
|
||||||
// Language code (if multilang)
|
// Language code (if multilang)
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
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');
|
include_once(DOL_DOCUMENT_ROOT.'/html.formadmin.class.php');
|
||||||
$formadmin=new FormAdmin($this->db);
|
$formadmin=new FormAdmin($this->db);
|
||||||
@ -357,9 +357,9 @@ class FormFile
|
|||||||
print '<input class="button" ';
|
print '<input class="button" ';
|
||||||
//print ((is_array($modellist) && sizeof($modellist))?'':' disabled="true"') // Always allow button "Generate" (even if no model activated)
|
//print ((is_array($modellist) && sizeof($modellist))?'':' disabled="true"') // Always allow button "Generate" (even if no model activated)
|
||||||
print ' type="submit" value="'.$buttonlabel.'"';
|
print ' type="submit" value="'.$buttonlabel.'"';
|
||||||
if (! $showwarning && ! is_array($modellist) && empty($modellist)) print ' disabled="true"';
|
if (! $allowgenifempty && ! is_array($modellist) && empty($modellist)) print ' disabled="true"';
|
||||||
print '>';
|
print '>';
|
||||||
if ($showwarning && ! is_array($modellist) && empty($modellist))
|
if ($allowgenifempty && ! is_array($modellist) && empty($modellist))
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
print ' '.img_warning($langs->trans("WarningNoDocumentModelActivated"));
|
print ' '.img_warning($langs->trans("WarningNoDocumentModelActivated"));
|
||||||
|
|||||||
@ -54,7 +54,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc
|
|||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
|
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
$this->name = "Generic ODT";
|
$this->name = "ODT templates";
|
||||||
$this->description = $langs->trans("DocumentModelOdt");
|
$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
|
$this->scandir = 'COMPANY_ADDON_PDF_ODT_PATH'; // Name of constant that is used to save list of directories to scan
|
||||||
|
|
||||||
|
|||||||
@ -1019,7 +1019,7 @@ function picto_from_langcode($codelang)
|
|||||||
*/
|
*/
|
||||||
function getListOfModels($db,$type)
|
function getListOfModels($db,$type)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf,$langs;
|
||||||
$liste=array();
|
$liste=array();
|
||||||
$found=0;
|
$found=0;
|
||||||
|
|
||||||
@ -1041,9 +1041,9 @@ function getListOfModels($db,$type)
|
|||||||
|
|
||||||
$obj = $db->fetch_object($resql);
|
$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.
|
// 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;
|
$const=$obj->description;
|
||||||
$dirtoscan.=($dirtoscan?',':'').preg_replace('/[\r\n]+/',',',trim($conf->global->$const));
|
$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
|
else
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user