Browse Source

Fix emailcollector

Laurent Destailleur 6 years ago
parent
commit
d65bf1fbc7

+ 5 - 2
htdocs/core/lib/functions.lib.php

@@ -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	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
 		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))
 			{
 				$res=$dirroot.'/'.$path;

+ 2 - 2
htdocs/emailcollector/class/emailcollector.class.php

@@ -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",),
 		'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'),
-		'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),
+		//'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),
 		'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,),
 		'lastresult'    => array('type'=>'varchar(255)', 'label'=>'LastResult', 'visible'=>1, 'enabled'=>1, 'position'=>122, 'notnull'=>-1,),

+ 0 - 2
htdocs/install/mysql/migration/8.0.0-9.0.0.sql

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

+ 0 - 2
htdocs/install/mysql/tables/llx_emailcollector_emailcollector.sql

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

+ 18 - 14
htdocs/modulebuilder/index.php

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