Fix emailcollector

This commit is contained in:
Laurent Destailleur
2018-11-05 15:31:41 +01:00
parent 9556a6dfb9
commit d65bf1fbc7
5 changed files with 25 additions and 22 deletions

View File

@@ -668,7 +668,7 @@ function dol_include_once($relpath, $classname='')
/** /**
* Return path of url or filesystem. Return alternate root if exists. * Return path of url or filesystem. Can check into alternate dir or alternate dir + main dir depending on value of $returnemptyifnotfound.
* *
* @param string $path Relative path to file (if mode=0) or relative url (if mode=1). Ie: mydir/myfile, ../myfile * @param string $path Relative path to file (if mode=0) or relative url (if mode=1). Ie: mydir/myfile, ../myfile
* @param int $type 0=Used for a Filesystem path, 1=Used for an URL path (output relative), 2=Used for an URL path (output full path using same host that current url), 3=Used for an URL path (output full path using host defined into $dolibarr_main_url_root of conf file) * @param int $type 0=Used for a Filesystem path, 1=Used for an URL path (output relative), 2=Used for an URL path (output full path using same host that current url), 3=Used for an URL path (output full path using host defined into $dolibarr_main_url_root of conf file)
@@ -688,7 +688,10 @@ function dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
$res = DOL_DOCUMENT_ROOT.'/'.$path; // Standard default path $res = DOL_DOCUMENT_ROOT.'/'.$path; // Standard default path
foreach ($conf->file->dol_document_root as $key => $dirroot) // ex: array(["main"]=>"/home/main/htdocs", ["alt0"]=>"/home/dirmod/htdocs", ...) foreach ($conf->file->dol_document_root as $key => $dirroot) // ex: array(["main"]=>"/home/main/htdocs", ["alt0"]=>"/home/dirmod/htdocs", ...)
{ {
if ($key == 'main') continue; if ($key == 'main')
{
continue;
}
if (file_exists($dirroot.'/'.$path)) if (file_exists($dirroot.'/'.$path))
{ {
$res=$dirroot.'/'.$path; $res=$dirroot.'/'.$path;

View File

@@ -86,8 +86,8 @@ class EmailCollector extends CommonObject
'user' => array('type'=>'varchar(128)', 'label'=>'User', 'visible'=>1, 'enabled'=>1, 'position'=>101, 'notnull'=>1, 'index'=>1, 'comment'=>"IMAP login",), 'user' => array('type'=>'varchar(128)', 'label'=>'User', 'visible'=>1, 'enabled'=>1, 'position'=>101, 'notnull'=>1, 'index'=>1, 'comment'=>"IMAP login",),
'password' => array('type'=>'password', 'label'=>'Password', 'visible'=>-1, 'enabled'=>1, 'position'=>102, 'notnull'=>1, 'comment'=>"IMAP password",), 'password' => array('type'=>'password', 'label'=>'Password', 'visible'=>-1, 'enabled'=>1, 'position'=>102, 'notnull'=>1, 'comment'=>"IMAP password",),
'source_directory' => array('type'=>'varchar(255)', 'label'=>'MailboxSourceDirectory', 'visible'=>-1, 'enabled'=>1, 'position'=>103, 'notnull'=>-1, 'default' => 'Inbox'), 'source_directory' => array('type'=>'varchar(255)', 'label'=>'MailboxSourceDirectory', 'visible'=>-1, 'enabled'=>1, 'position'=>103, 'notnull'=>-1, 'default' => 'Inbox'),
'filter' => array('type'=>'text', 'label'=>'Filter', 'visible'=>1, 'enabled'=>1, 'position'=>105), //'filter' => array('type'=>'text', 'label'=>'Filter', 'visible'=>1, 'enabled'=>1, 'position'=>105),
'actiontodo' => array('type'=>'varchar(255)', 'label'=>'ActionToDo', 'visible'=>1, 'enabled'=>1, 'position'=>106), //'actiontodo' => array('type'=>'varchar(255)', 'label'=>'ActionToDo', 'visible'=>1, 'enabled'=>1, 'position'=>106),
'target_directory' => array('type'=>'varchar(255)', 'label'=>'MailboxTargetDirectory', 'visible'=>1, 'enabled'=>1, 'position'=>110, 'notnull'=>1, 'comment'=>"Where to store messages once processed"), 'target_directory' => array('type'=>'varchar(255)', 'label'=>'MailboxTargetDirectory', 'visible'=>1, 'enabled'=>1, 'position'=>110, 'notnull'=>1, 'comment'=>"Where to store messages once processed"),
'datelastresult' => array('type'=>'datetime', 'label'=>'DateLastResult', 'visible'=>-2, 'enabled'=>1, 'position'=>121, 'notnull'=>-1,), 'datelastresult' => array('type'=>'datetime', 'label'=>'DateLastResult', 'visible'=>-2, 'enabled'=>1, 'position'=>121, 'notnull'=>-1,),
'lastresult' => array('type'=>'varchar(255)', 'label'=>'LastResult', 'visible'=>1, 'enabled'=>1, 'position'=>122, 'notnull'=>-1,), 'lastresult' => array('type'=>'varchar(255)', 'label'=>'LastResult', 'visible'=>1, 'enabled'=>1, 'position'=>122, 'notnull'=>-1,),

View File

@@ -151,8 +151,6 @@ CREATE TABLE llx_emailcollector_emailcollector(
user varchar(128), user varchar(128),
password varchar(128), password varchar(128),
source_directory varchar(255), source_directory varchar(255),
filter text,
actiontodos varchar(255),
target_directory varchar(255), target_directory varchar(255),
datelastresult datetime, datelastresult datetime,
lastresult varchar(255), lastresult varchar(255),

View File

@@ -25,8 +25,6 @@ CREATE TABLE llx_emailcollector_emailcollector(
user varchar(128), user varchar(128),
password varchar(128), password varchar(128),
source_directory varchar(255), source_directory varchar(255),
filter text,
actiontodo varchar(255),
target_directory varchar(255), target_directory varchar(255),
datelastresult datetime, datelastresult datetime,
lastresult varchar(255), lastresult varchar(255),

View File

@@ -1563,6 +1563,8 @@ elseif (! empty($module))
if ($action != 'editfile' || empty($file)) if ($action != 'editfile' || empty($file))
{ {
try { try {
//$pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath'];
$pathtoclass = strtolower($module).'/class/'.strtolower($tabobj).'.class.php'; $pathtoclass = strtolower($module).'/class/'.strtolower($tabobj).'.class.php';
$pathtoapi = strtolower($module).'/class/api_'.strtolower($module).'.class.php'; $pathtoapi = strtolower($module).'/class/api_'.strtolower($module).'.class.php';
$pathtoagenda = strtolower($module).'/'.strtolower($tabobj).'_agenda.php'; $pathtoagenda = strtolower($module).'/'.strtolower($tabobj).'_agenda.php';
@@ -1578,20 +1580,22 @@ elseif (! empty($module))
$pathtopicto = strtolower($module).'/img/object_'.strtolower($tabobj).'.png'; $pathtopicto = strtolower($module).'/img/object_'.strtolower($tabobj).'.png';
$pathtoscript = strtolower($module).'/scripts/'.strtolower($tabobj).'.php'; $pathtoscript = strtolower($module).'/scripts/'.strtolower($tabobj).'.php';
$realpathtoclass = dol_buildpath($pathtoclass, 0, 1); //var_dump($pathtolib);
$realpathtoapi = dol_buildpath($pathtoapi, 0, 1);
$realpathtoagenda = dol_buildpath($pathtoagenda, 0, 1); $realpathtoclass = dol_buildpath($pathtoclass, 0, 2);
$realpathtocard = dol_buildpath($pathtocard, 0, 1); $realpathtoapi = dol_buildpath($pathtoapi, 0, 2);
$realpathtodocument = dol_buildpath($pathtodocument, 0, 1); $realpathtoagenda = dol_buildpath($pathtoagenda, 0, 2);
$realpathtolist = dol_buildpath($pathtolist, 0, 1); $realpathtocard = dol_buildpath($pathtocard, 0, 2);
$realpathtonote = dol_buildpath($pathtonote, 0, 1); $realpathtodocument = dol_buildpath($pathtodocument, 0, 2);
$realpathtophpunit = dol_buildpath($pathtophpunit, 0, 1); $realpathtolist = dol_buildpath($pathtolist, 0, 2);
$realpathtosql = dol_buildpath($pathtosql, 0, 1); $realpathtonote = dol_buildpath($pathtonote, 0, 2);
$realpathtosqlextra = dol_buildpath($pathtosqlextra, 0, 1); $realpathtophpunit = dol_buildpath($pathtophpunit, 0, 2);
$realpathtosqlkey = dol_buildpath($pathtosqlkey, 0, 1); $realpathtosql = dol_buildpath($pathtosql, 0, 2);
$realpathtolib = dol_buildpath($pathtolib, 0, 1); $realpathtosqlextra = dol_buildpath($pathtosqlextra, 0, 2);
$realpathtopicto = dol_buildpath($pathtopicto, 0, 1); $realpathtosqlkey = dol_buildpath($pathtosqlkey, 0, 2);
$realpathtoscript = dol_buildpath($pathtoscript, 0, 1); $realpathtolib = dol_buildpath($pathtolib, 0, 2);
$realpathtopicto = dol_buildpath($pathtopicto, 0, 2);
$realpathtoscript = dol_buildpath($pathtoscript, 0, 2);
print '<div class="fichehalfleft">'; print '<div class="fichehalfleft">';
print '<span class="fa fa-file-o"></span> '.$langs->trans("ClassFile").' : <strong>'.($realpathtoclass?'':'<strike>').$pathtoclass.($realpathtoclass?'':'</strike>').'</strong>'; print '<span class="fa fa-file-o"></span> '.$langs->trans("ClassFile").' : <strong>'.($realpathtoclass?'':'<strike>').$pathtoclass.($realpathtoclass?'':'</strike>').'</strong>';