From 7ea96d53a2e2e58286904e09bdcdaed5e1ad6671 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Nov 2017 18:12:01 +0100 Subject: [PATCH] Minor fixes --- htdocs/core/class/rssparser.class.php | 17 ++++++++++++----- htdocs/core/modules/modAgenda.class.php | 9 +++++++-- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/htdocs/core/class/rssparser.class.php b/htdocs/core/class/rssparser.class.php index 56e338b7eb8..1d3af953375 100644 --- a/htdocs/core/class/rssparser.class.php +++ b/htdocs/core/class/rssparser.class.php @@ -278,12 +278,19 @@ class RssParser dol_syslog(get_class($this)."::parser cache file ".$newpathofdestfile." is saved onto disk."); if (! dol_is_dir($cachedir)) dol_mkdir($cachedir); $fp = fopen($newpathofdestfile, 'w'); - fwrite($fp, $str); - fclose($fp); - if (! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK; - @chmod($newpathofdestfile, octdec($newmask)); + if ($fp) + { + fwrite($fp, $str); + fclose($fp); + if (! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK; + @chmod($newpathofdestfile, octdec($newmask)); - $this->_lastfetchdate=$nowgmt; + $this->_lastfetchdate=$nowgmt; + } + else + { + print 'Error, failed to open file '.$newpathofdestfile.' for write'; + } } unset($str); // Free memory diff --git a/htdocs/core/modules/modAgenda.class.php b/htdocs/core/modules/modAgenda.class.php index 2bb01d04553..89085ea4d6c 100644 --- a/htdocs/core/modules/modAgenda.class.php +++ b/htdocs/core/modules/modAgenda.class.php @@ -79,8 +79,13 @@ class modAgenda extends DolibarrModules $this->module_parts = array(); // Constants - //----------- + //----------- + // List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive) + // Example: $this->const=array(0=>array('MYMODULE_MYNEWCONST1','chaine','myvalue','This is a constant to add',1), + // 1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0, 'current', 1) + // ); $this->const = array(); + //$this->const[] = array('AGENDA_DEFAULT_FILTER_TYPE', 'chaine', 'AC_NON_AUTO', 'Default filter for type of event on agenda', 0, 'current'); $sqlreadactions="SELECT code, label, description FROM ".MAIN_DB_PREFIX."c_action_trigger ORDER by rang"; $resql = $this->db->query($sqlreadactions); if ($resql) @@ -90,7 +95,7 @@ class modAgenda extends DolibarrModules //if (preg_match('/_CREATE$/',$obj->code) && (! in_array($obj->code, array('COMPANY_CREATE','PRODUCT_CREATE','TASK_CREATE')))) continue; // We don't track such events (*_CREATE) by default, we prefer validation (except thirdparty/product/task creation because there is no validation). if (preg_match('/^TASK_/',$obj->code)) continue; // We don't track such events by default. //if (preg_match('/^_MODIFY/',$obj->code)) continue; // We don't track such events by default. - $this->const[] = array('MAIN_AGENDA_ACTIONAUTO_'.$obj->code, "chaine", "1"); + $this->const[] = array('MAIN_AGENDA_ACTIONAUTO_'.$obj->code, "chaine", "1", '', 0, 'current'); } } else