-
+ |
-
+
{{if empty($displayParams.splitDateTime)}}
|
-
+ |
{{else}}
{{/if}}
diff --git a/include/SugarFields/Fields/Wysiwyg/SugarFieldWysiwyg.php b/include/SugarFields/Fields/Wysiwyg/SugarFieldWysiwyg.php
index ce8c908c5..87922c285 100644
--- a/include/SugarFields/Fields/Wysiwyg/SugarFieldWysiwyg.php
+++ b/include/SugarFields/Fields/Wysiwyg/SugarFieldWysiwyg.php
@@ -82,7 +82,7 @@ class SugarFieldWysiwyg extends SugarFieldBase {
$config['plugins'] = 'print code preview fullpage searchreplace autolink directionality visualblocks visualchars fullscreen image link media codesample table charmap hr pagebreak nonbreaking anchor insertdatetime advlist lists textcolor wordcount imagetools contextmenu colorpicker textpattern ';
$config['elements'] = "#{$form_name} "."#".$vardef['name'];
$config['selector'] = "#{$form_name} "."#".$vardef['name'];
- $config['content_css'] = 'vendor/tinymce/tinymce/skins/lightgray/content.min.css';
+ $config['content_css'] = './../../vendor/tinymce/tinymce/skins/lightgray/content.min.css';
$config['toolbar1'] = 'formatselect | bold italic strikethrough forecolor backcolor | link | alignleft aligncenter alignright alignjustify | numlist bullist outdent indent | removeformat';
$config['theme'] = 'modern';
diff --git a/include/SugarFolders/SugarFolders.php b/include/SugarFolders/SugarFolders.php
index d6f5d7e96..a55d4171c 100755
--- a/include/SugarFolders/SugarFolders.php
+++ b/include/SugarFolders/SugarFolders.php
@@ -466,15 +466,16 @@ class SugarFolder
*/
public function generateArchiveFolderQuery()
{
- $query = "SELECT emails.id , emails.name, emails.date_sent_received, emails.status, emails.type, emails.flagged, ".
- "emails.reply_to_status, emails_text.from_addr, emails_text.to_addrs, 'Emails'".
- " polymorphic_module FROM emails JOIN emails_text on emails.id = emails_text.email_id ".
- "WHERE emails.deleted=0 AND emails.type NOT IN ('out', 'draft')"." AND emails.status NOT IN ('sent', 'draft') AND emails.id IN (".
- "SELECT eear.email_id FROM emails_email_addr_rel eear " .
- "JOIN email_addr_bean_rel eabr ON eabr.email_address_id=eear.email_address_id AND".
- " eabr.bean_id = " . $this->db->quoted($this->currentUser->id) . " AND eabr.bean_module = 'Users' WHERE eear.deleted=0)";
-
- return $query;
+ return "SELECT emails.id , emails.name, emails.date_sent_received, emails.status, emails.type, emails.flagged, " .
+ "emails.reply_to_status, emails_text.from_addr, emails_text.to_addrs, 'Emails' polymorphic_module " .
+ "FROM emails " .
+ "JOIN emails_text on emails.id = emails_text.email_id " .
+ "JOIN emails_email_addr_rel eear ON eear.email_id = emails.id " .
+ "JOIN email_addr_bean_rel eabr ON eabr.email_address_id=eear.email_address_id " .
+ "WHERE emails.deleted=0 AND emails.type NOT IN ('out', 'draft') AND emails.status NOT IN ('sent', 'draft') " .
+ "AND eabr.bean_id = " . $this->db->quoted($this->currentUser->id) . " AND eabr.bean_module = 'Users' " .
+ "AND eear.deleted=0 " .
+ "GROUP BY id";
}
public function generateSugarsDynamicFolderQuery()
@@ -579,10 +580,46 @@ class SugarFolder
return $metadata;
}
+ /**
+ * Get the count of items for dynamic folder
+ *
+ * @param bool $unread
+ * @return int
+ */
+ public function getDynamicFolderCount($unread = false)
+ {
+ $selectQuery = $this->generateSugarsDynamicFolderQuery();
+ $pattern = '/SELECT(.*?)(\s){1}FROM(\s){1}/is'; // ignores the case
+
+ if ($this->folder_type === 'archived') {
+ $replacement = 'SELECT count(DISTINCT emails.id) c FROM ';
+ $modifiedSelectQuery = preg_replace($pattern, $replacement, $selectQuery, 1);
+
+ // remove GROUP BY statement
+ $pattern = '/GROUP BY id(\s)?/s';
+ $modifiedSelectQuery = preg_replace($pattern, '', $modifiedSelectQuery, 1);
+ } else {
+ $replacement = 'SELECT count(*) c FROM ';
+ $modifiedSelectQuery = preg_replace($pattern, $replacement, $selectQuery, 1);
+ }
+
+ $query = from_html($modifiedSelectQuery);
+
+ if ($unread) {
+ $query .= " AND emails.status = 'unread'";
+ }
+
+ $res = $this->db->query($query);
+
+ $result = $this->db->fetchByAssoc($res);
+
+ return $result['c'];
+ }
+
/**
* Get the count of items
*
- * @param string $folderId
+ * @param string $folderId
* @return int
*/
public function getCountItems($folderId)
@@ -590,23 +627,19 @@ class SugarFolder
$this->retrieve($folderId);
if ($this->is_dynamic) {
- $pattern = '/SELECT(.*?)(\s){1}FROM(\s){1}/is'; // ignores the case
- $replacement = 'SELECT count(*) c FROM ';
- $modifiedSelectQuery = preg_replace($pattern, $replacement, $this->generateSugarsDynamicFolderQuery(), 1);
-
- $res = $this->db->query(from_html($modifiedSelectQuery));
- } else {
- // get items and iterate through them
- $query = "SELECT count(*) c FROM folders_rel JOIN emails ON emails.id = folders_rel.polymorphic_id" .
- " WHERE folder_id = " . $this->db->quoted($folderId) . " AND folders_rel.deleted = 0 AND emails.deleted = 0";
-
- if ($this->is_group) {
- $query .= " AND (emails.assigned_user_id is null or emails.assigned_user_id = '')";
- }
-
- $res = $this->db->query($query);
+ return $this->getDynamicFolderCount();
}
+ // Get items and iterate through them
+ $query = "SELECT count(*) c FROM folders_rel JOIN emails ON emails.id = folders_rel.polymorphic_id" .
+ " WHERE folder_id = " . $this->db->quoted($folderId) . " AND folders_rel.deleted = 0 AND emails.deleted = 0";
+
+ if ($this->is_group) {
+ $query .= " AND (emails.assigned_user_id is null or emails.assigned_user_id = '')";
+ }
+
+ $res = $this->db->query($query);
+
$result = $this->db->fetchByAssoc($res);
return $result['c'];
@@ -615,7 +648,7 @@ class SugarFolder
/**
* Get a count of the Unread Items
*
- * @param string $folderId
+ * @param string $folderId
* @return integer
*/
public function getCountUnread($folderId)
@@ -623,26 +656,23 @@ class SugarFolder
$this->retrieve($folderId);
if ($this->is_dynamic) {
- $pattern = '/SELECT(.*?)(\s){1}FROM(\s){1}/is'; // ignores the case
- $replacement = 'SELECT count(*) c FROM ';
- $modified_select_query = preg_replace($pattern, $replacement, $this->generateSugarsDynamicFolderQuery(), 1);
- $r = $this->db->query(from_html($modified_select_query) . " AND emails.status = 'unread'");
- } else {
- // get items and iterate through them
- $query = "SELECT count(*) c FROM folders_rel fr JOIN emails on fr.folder_id = " . $this->db->quoted($folderId) .
- " AND fr.deleted = 0 " .
- "AND fr.polymorphic_id = emails.id AND emails.status = 'unread' AND emails.deleted = 0";
-
- if ($this->is_group) {
- $query .= " AND (emails.assigned_user_id is null or emails.assigned_user_id = '')";
- }
-
- $r = $this->db->query($query);
+ return $this->getDynamicFolderCount(true);
}
- $a = $this->db->fetchByAssoc($r);
+ // Get items and iterate through them
+ $query = "SELECT count(*) c FROM folders_rel fr JOIN emails on fr.folder_id = " . $this->db->quoted($folderId) .
+ " AND fr.deleted = 0 " .
+ "AND fr.polymorphic_id = emails.id AND emails.status = 'unread' AND emails.deleted = 0";
- return $a['c'];
+ if ($this->is_group) {
+ $query .= " AND (emails.assigned_user_id is null or emails.assigned_user_id = '')";
+ }
+
+ $res = $this->db->query($query);
+
+ $result = $this->db->fetchByAssoc($res);
+
+ return $result['c'];
}
diff --git a/include/SugarLogger/SugarLogger.php b/include/SugarLogger/SugarLogger.php
index 4e365e296..2e5243325 100755
--- a/include/SugarLogger/SugarLogger.php
+++ b/include/SugarLogger/SugarLogger.php
@@ -68,6 +68,7 @@ class SugarLogger implements LoggerTemplate
protected $filesuffix = "";
protected $date_suffix = "";
protected $log_dir = '.';
+ protected $defaultPerms = 0664;
/**
@@ -127,6 +128,7 @@ class SugarLogger implements LoggerTemplate
$this->logSize = $config->get('logger.file.maxSize', $this->logSize);
$this->maxLogs = $config->get('logger.file.maxLogs', $this->maxLogs);
$this->filesuffix = $config->get('logger.file.suffix', $this->filesuffix);
+ $this->defaultPerms = $config->get('logger.file.perms', $this->defaultPerms);
$log_dir = $config->get('log_dir', $this->log_dir);
$this->log_dir = $log_dir . (empty($log_dir)?'':'/');
unset($config);
@@ -149,22 +151,25 @@ class SugarLogger implements LoggerTemplate
/**
* Checks to see if the SugarLogger file can be created and written to
+ * @noinspection PhpUndefinedFieldInspection
+ * @return bool
*/
protected function _fileCanBeCreatedAndWrittenTo()
{
- $this->_attemptToCreateIfNecessary();
- return file_exists($this->full_log_file) && is_writable($this->full_log_file);
- }
-
- /**
- * Creates the SugarLogger file if it doesn't exist
- */
- protected function _attemptToCreateIfNecessary()
- {
- if (file_exists($this->full_log_file)) {
- return;
+ if (is_writable($this->full_log_file)) {
+ return true;
}
- @touch($this->full_log_file);
+
+ if (!is_file($this->full_log_file)) {
+ @touch($this->full_log_file);
+ if ($this->defaultPerms !== false) {
+ @chmod($this->full_log_file, $this->defaultPerms);
+ }
+
+ return is_writable($this->full_log_file);
+ }
+
+ return false;
}
/**
diff --git a/include/SugarObjects/forms/PersonFormBase.php b/include/SugarObjects/forms/PersonFormBase.php
index ec402b825..4e09aec11 100755
--- a/include/SugarObjects/forms/PersonFormBase.php
+++ b/include/SugarObjects/forms/PersonFormBase.php
@@ -60,7 +60,7 @@ abstract class PersonFormBase extends FormBase
{
public $moduleName;
public $objectName;
-
+
/**
* buildTableForm
*
@@ -76,30 +76,28 @@ abstract class PersonFormBase extends FormBase
global $app_strings;
$newLinkLabel = 'LNK_NEW_' . strtoupper($this->objectName);
-
+
$cols = count($rows[0]) * 2 + 1;
-
+
if ($action != 'ShowDuplicates') {
$duplicateLabel = string_format($app_strings['MSG_DUPLICATE'], array(strtolower($this->objectName), $this->moduleName));
- $form = '';
+ $form = '';
$form .= " |