diff --git a/data/CRMEntity.php b/data/CRMEntity.php index d57d536f320e39c48de80e55594e92e3a725a48f..c57f4570249120a8e86bd2cab1cb1304afbe7796 100644 --- a/data/CRMEntity.php +++ b/data/CRMEntity.php @@ -35,6 +35,7 @@ class CRMEntity { var $recordSource = 'CRM'; var $mode; + public $moduleName; /** * Detect if we are in bulk save mode, where some features can be turned-off * to improve performance. @@ -600,7 +601,7 @@ class CRMEntity { $fldvalue = decode_html($this->column_fields[$fieldname]); } } elseif ($uitype == 8) { - $this->column_fields[$fieldname] = rtrim($this->column_fields[$fieldname], ','); + $this->column_fields[$fieldname] = isset($this->column_fields[$fieldname]) ? rtrim($this->column_fields[$fieldname], ',') : ''; $ids = explode(',', $this->column_fields[$fieldname]); $json = new Zend_Json(); $fldvalue = $json->encode($ids); diff --git a/include/database/PearDatabase.php b/include/database/PearDatabase.php index d3dc4552b40dfbe211dde8e1fb50a56b8e1b8e5d..fdc021cf9cd624548a522a9e41acf45536aeac18 100644 --- a/include/database/PearDatabase.php +++ b/include/database/PearDatabase.php @@ -531,6 +531,7 @@ class PearDatabase{ function getRowCount(&$result){ global $log; + $rows = 0; if(isset($result) && !empty($result)) $rows= $result->RecordCount(); return $rows; diff --git a/layouts/v7/modules/Settings/MailConverter/Rule.tpl b/layouts/v7/modules/Settings/MailConverter/Rule.tpl index 3464341628859f723859d394fee3080df98336ad..6b10c87c2a4eaa29854892d0b45c4548ddfbcadd 100644 --- a/layouts/v7/modules/Settings/MailConverter/Rule.tpl +++ b/layouts/v7/modules/Settings/MailConverter/Rule.tpl @@ -12,7 +12,7 @@ <div class="details border1px"> <div class="ruleHead modal-header" style="cursor: move; min-height: 30px; padding: 10px 0px;"> <strong> - <img class="alignMiddle" src="{vimage_path('white-drag.png')}" style="margin-left: 10px;" /> {vtranslate('LBL_RULE', $QUALIFIED_MODULE)} <span class="sequenceNumber">{$RULE_COUNT}</span> : {vtranslate($RULE_MODEL->get('action'), $QUALIFIED_MODULE)} + <img class="alignMiddle" src="{vimage_path('white-drag.png')}" style="margin-left: 10px;" /> {vtranslate('LBL_RULE', $QUALIFIED_MODULE)} <span class="sequenceNumber">{(isset($RULE_COUNT)) ? $RULE_COUNT : ''}</span> : {vtranslate($RULE_MODEL->get('action'), $QUALIFIED_MODULE)} <div class="pull-right" style="padding-right: 10px;"> {foreach from=$RULE_MODEL->getRecordLinks() item=ACTION_LINK} <span {if stripos($ACTION_LINK->getUrl(), 'javascript:')===0} diff --git a/layouts/v7/modules/Settings/MailConverter/Step2.tpl b/layouts/v7/modules/Settings/MailConverter/Step2.tpl index 253e6d1384a2734042101cec5b557b135aac3db2..bf1c40ac6445c7b765ce9c657681e7130acc1cd3 100644 --- a/layouts/v7/modules/Settings/MailConverter/Step2.tpl +++ b/layouts/v7/modules/Settings/MailConverter/Step2.tpl @@ -8,7 +8,7 @@ ************************************************************************************} {strip} - {if $IMAP_ERROR || $CONNECTION_ERROR} + {if (isset($IMAP_ERROR) && $IMAP_ERROR) || (isset($CONNECTION_ERROR) && $CONNECTION_ERROR)} <div class="block"> <strong> {if $IMAP_ERROR} diff --git a/layouts/v7/modules/Vtiger/BreadCrumbs.tpl b/layouts/v7/modules/Vtiger/BreadCrumbs.tpl index 74ea4350c7caab4c56a3bc4d19965a8b028f8690..4f5bf922fe53e5b0d545e8f1e4a6a5698a22e78f 100644 --- a/layouts/v7/modules/Vtiger/BreadCrumbs.tpl +++ b/layouts/v7/modules/Vtiger/BreadCrumbs.tpl @@ -7,13 +7,13 @@ * All Rights Reserved. *************************************************************************************} -<div id="{$BREADCRUMB_ID}" class="breadcrumb"> +<div id="{(isset($BREADCRUMB_ID)) ? $BREADCRUMB_ID : ''}" class="breadcrumb"> <ul class="crumbs"> {assign var=ZINDEX value=9} {foreach key=CRUMBID item=STEPTEXT from=$BREADCRUMB_LABELS name=breadcrumbLabels} {assign var=INDEX value=$smarty.foreach.breadcrumbLabels.index} {assign var=INDEX value=$INDEX+1} - <li class="step {if $smarty.foreach.breadcrumbLabels.first} first {if isset($FIRSTBREADCRUMB)} {$FIRSTBREADCRUMB} {/if} {else} {if isset($ADDTIONALCLASS)} {$ADDTIONALCLASS} {/if}{/if} {if $smarty.foreach.breadcrumbLabels.last} last {/if} {if $ACTIVESTEP eq $INDEX}active{/if}" + <li class="step {if $smarty.foreach.breadcrumbLabels.first} first {if isset($FIRSTBREADCRUMB)} {$FIRSTBREADCRUMB} {/if} {else} {if isset($ADDTIONALCLASS)} {$ADDTIONALCLASS} {/if}{/if} {if $smarty.foreach.breadcrumbLabels.last} last {/if} {if isset($ACTIVESTEP) && $ACTIVESTEP eq $INDEX}active{/if}" id="{$CRUMBID}" data-value="{$INDEX}" style="z-index:{$ZINDEX}"> <a href="#"> <span class="stepNum">{$INDEX}</span> diff --git a/modules/Emails/Emails.php b/modules/Emails/Emails.php index 3663836f036d827a98a6cfc1df4a74fb7dae0848..1df7d3940029bbe6666d765499c9caa1aa88c1b8 100644 --- a/modules/Emails/Emails.php +++ b/modules/Emails/Emails.php @@ -65,6 +65,7 @@ class Emails extends CRMEntity { // Refers to vtiger_field.fieldname values. var $mandatory_fields = Array('subject', 'assigned_user_id'); + /** This function will set the columnfields for Email module */ function __construct() { diff --git a/modules/HelpDesk/HelpDesk.php b/modules/HelpDesk/HelpDesk.php index 324584655ecbc47abe2a30cebd39e0425898e803..9746ab940debd4031ee9fdbc155ac49dabcaf66e 100644 --- a/modules/HelpDesk/HelpDesk.php +++ b/modules/HelpDesk/HelpDesk.php @@ -96,6 +96,7 @@ class HelpDesk extends CRMEntity { // For Alphabetical search var $def_basicsearch_col = 'ticket_title'; + //var $groupTable = Array('vtiger_ticketgrouprelation','ticketid'); /** Constructor which will set the column_fields in this object diff --git a/modules/Settings/MailConverter/handlers/MailBox.php b/modules/Settings/MailConverter/handlers/MailBox.php index d02a8e9ec7582a640c4e861ea8916ed8a84005bc..a8ddc81c93bf3fc392c07f355965bcd96d3e4523 100644 --- a/modules/Settings/MailConverter/handlers/MailBox.php +++ b/modules/Settings/MailConverter/handlers/MailBox.php @@ -186,6 +186,7 @@ class Vtiger_MailBox { $imapfolders = imap_list($this->_imap, $this->_imapurl, '*'); if($imapfolders) { foreach($imapfolders as $imapfolder) { + if(!is_array($folders)) $folders = []; $folders[] = substr($imapfolder, strlen($this->_imapurl)); } } else { diff --git a/modules/Settings/MailConverter/handlers/MailRecord.php b/modules/Settings/MailConverter/handlers/MailRecord.php index c708905f23018d3fe7f5eaf73baefd05ceb56031..06d810da94bba20c6b06a92ca1a65057b6cb0029 100644 --- a/modules/Settings/MailConverter/handlers/MailRecord.php +++ b/modules/Settings/MailConverter/handlers/MailRecord.php @@ -219,9 +219,12 @@ class Vtiger_MailRecord { $this->_from = $this->__getEmailIdList($mailheader->from); $this->_fromname = self::__mime_decode($mailheader->from[0]->personal); - $this->_to = $this->__getEmailIdList($mailheader->to); - $this->_cc = $this->__getEmailIdList($mailheader->cc); - $this->_bcc = $this->__getEmailIdList($mailheader->bcc); + + if(!property_exists($mailheader,'to') && !property_exists($mailheader,'cc') && !property_exists($mailheader,'bcc')){ + $this->_to = $this->__getEmailIdList($mailheader->to); + $this->_cc = $this->__getEmailIdList($mailheader->cc); + $this->_bcc = $this->__getEmailIdList($mailheader->bcc); + } $this->_date = $mailheader->udate; @@ -291,14 +294,14 @@ class Vtiger_MailRecord { if ($p->parameters) { foreach ($p->parameters as $x) $params[ strtolower( $x->attribute ) ] = $x->value; } - if ($p->dparameters) { + if (property_exists($p,'dparameters') && $p->dparameters) { foreach ($p->dparameters as $x) $params[ strtolower( $x->attribute ) ] = $x->value; } // ATTACHMENT // Any part with a filename is an attachment, // so an attached text file (type 0) is not mistaken as the message. - if ($params['filename'] || $params['name']) { + if ((isset($params['filename']) && $params['filename']) || (isset($params['name']) && $params['name'])) { // filename may be given as 'Filename' or 'Name' or both $filename = ($params['filename'])? $params['filename'] : $params['name']; // filename may be encoded, so see imap_mime_header_decode() @@ -327,7 +330,7 @@ class Vtiger_MailRecord { } // SUBPART RECURSION - if ($p->parts) { + if (property_exists($p,'parts') && $p->parts) { foreach ($p->parts as $partno0=>$p2) $this->__getpart($imap,$messageid,$p2,$partno.'.'.($partno0+1)); // 1.2, 1.2.1, etc. } diff --git a/modules/Settings/MailConverter/handlers/MailScanner.php b/modules/Settings/MailConverter/handlers/MailScanner.php index 37c6f8c97a5bf0f1996b68b1db7f622ab204374c..96b42ce4330775cacaec44af01d2dc2ff793c292 100644 --- a/modules/Settings/MailConverter/handlers/MailScanner.php +++ b/modules/Settings/MailConverter/handlers/MailScanner.php @@ -244,7 +244,7 @@ class Vtiger_MailScanner { */ function LookupContact($email) { global $adb; - if($this->_cachedContactIds[$email]) { + if(isset($this->_cachedContactIds[$email]) && $this->_cachedContactIds[$email]) { $this->log("Reusing Cached Contact Id for email: $email"); return $this->_cachedContactIds[$email]; } @@ -296,7 +296,7 @@ class Vtiger_MailScanner { */ function LookupAccount($email) { global $adb; - if($this->_cachedAccountIds[$email]) { + if(isset($this->_cachedAccountIds[$email]) && $this->_cachedAccountIds[$email]) { $this->log("Reusing Cached Account Id for email: $email"); return $this->_cachedAccountIds[$email]; } @@ -393,7 +393,7 @@ class Vtiger_MailScanner { $contactid = $this->LookupContact($email); $contact_focus = false; if($contactid) { - if($this->_cachedContacts[$contactid]) { + if(isset($this->_cachedContacts[$contactid]) && $this->_cachedContacts[$contactid]) { $contact_focus = $this->_cachedContacts[$contactid]; $this->log("Reusing Cached Contact [" . $contact_focus->column_fields["lastname"] . '-' . $contact_focus->column_fields["firstname"] . "]"); diff --git a/modules/Settings/MailConverter/handlers/MailScannerAction.php b/modules/Settings/MailConverter/handlers/MailScannerAction.php index f769f16b6993207aacc675bacd3995d6a1ef5a83..6885aa121c8b0d2f6147082575042d22385f715f 100644 --- a/modules/Settings/MailConverter/handlers/MailScannerAction.php +++ b/modules/Settings/MailConverter/handlers/MailScannerAction.php @@ -20,6 +20,7 @@ require_once ('modules/Accounts/Accounts.php'); /** * Mail Scanner Action */ +#[\AllowDynamicProperties] class Vtiger_MailScannerAction { // actionid for this instance var $actionid = false; @@ -446,7 +447,7 @@ class Vtiger_MailScannerAction { $focus->column_fields["email_flag"] = 'MAILSCANNER'; $from=$mailrecord->_from[0]; - $to = $mailrecord->_to[0]; + $to = isset($mailrecord->_to[0]) ? $mailrecord->_to[0] : ''; $cc = (!empty($mailrecord->_cc))? implode(',', $mailrecord->_cc) : ''; $bcc= (!empty($mailrecord->_bcc))? implode(',', $mailrecord->_bcc) : ''; $flag=''; // 'SENT'/'SAVED' diff --git a/modules/Settings/MailConverter/handlers/MailScannerInfo.php b/modules/Settings/MailConverter/handlers/MailScannerInfo.php index df26120070e83d2995dafbc0fb1ac43a6dfb0976..9d72f231aea4a51516568f31e5c2f58b10d06abe 100644 --- a/modules/Settings/MailConverter/handlers/MailScannerInfo.php +++ b/modules/Settings/MailConverter/handlers/MailScannerInfo.php @@ -51,6 +51,8 @@ class Vtiger_MailScannerInfo { // Rules associated with this mail scanner var $rules = false; + public $debug; + /** * Constructor */ @@ -146,7 +148,7 @@ class Vtiger_MailScannerInfo { function dateBasedOnMailServerTimezone($format='d-M-Y') { $returnDate = NULL; ##--Fix for trac : http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/8051-## - if ($this->timezone && trim($this->timezone)) { + if (property_exists($this,'timezone') && $this->timezone && trim($this->timezone)) { $currentTZ = date_default_timezone_get(); list ($tzhours, $tzminutes) = explode(':', trim($this->time_zone)); $returnDate = date($format, strtotime(sprintf("%s hours %s minutes", $tzhours, $tzminutes))); diff --git a/modules/Settings/MailConverter/models/RuleRecord.php b/modules/Settings/MailConverter/models/RuleRecord.php index f972356b8c8c421d299a585280f3edb7e240bca1..9a8bbf56acd3d6423fe135803ed7da606444454b 100644 --- a/modules/Settings/MailConverter/models/RuleRecord.php +++ b/modules/Settings/MailConverter/models/RuleRecord.php @@ -19,6 +19,7 @@ class Settings_MailConverter_RuleRecord_Model extends Settings_Vtiger_Record_Mod var $cc = false; var $bcc = false; + public $actions = []; /** * Function to get Id of this record instance * @return <Integer> Id @@ -153,12 +154,15 @@ class Settings_MailConverter_RuleRecord_Model extends Settings_Vtiger_Record_Mod if ($actionString != $newActionString) { $actionId = ''; $actions = $this->getActions(); + $actionModel = ''; if ($actions) { - $actionModel = reset($this->getActions()); + $actionModel = reset($actions); $actionId = $actionModel->actionid; } //Svaing the Action info - $ruleModel->updateAction($actionModel->actionid, str_replace('_', ',', $newActionString)); + if($actionId) { + $ruleModel->updateAction($actionModel->actionid, str_replace('_', ',', $newActionString)); + } } return $ruleModel->ruleid; } @@ -186,8 +190,9 @@ class Settings_MailConverter_RuleRecord_Model extends Settings_Vtiger_Record_Mod if ($db->num_rows($result)) { $recordModel = new self(); $recordModel->setData($db->query_result_rowdata($result)); - $action = reset($recordModel->getActions()); - return $recordModel->set('action', str_replace(',', '_', $action->actiontext)); + $actions=$recordModel->getActions(); + $action = reset($actions); + return $recordModel->set('action', isset($action->actiontext) ? str_replace(',', '_', $action->actiontext) : ''); } return false; } @@ -207,8 +212,9 @@ class Settings_MailConverter_RuleRecord_Model extends Settings_Vtiger_Record_Mod $rowData = $db->query_result_rowdata($result,$i); $ruleModel = new self(); $ruleModel->setData($rowData); - $action = reset($ruleModel->getActions()); - $ruleModel->set('action', str_replace(',', '_', $action->actiontext)); + $actions = $ruleModel->getActions(); + $action = reset($actions); + $ruleModel->set('action', isset($action->actiontext) ? str_replace(',', '_', $action->actiontext) : ''); $assignedTo = Settings_MailConverter_RuleRecord_Model::getAssignedTo($rowData['scannerid'], $rowData['ruleid']); $ruleModel->set('assigned_to', $assignedTo[1]); $ruleModelsList[$rowData['ruleid']] = $ruleModel; @@ -231,8 +237,9 @@ class Settings_MailConverter_RuleRecord_Model extends Settings_Vtiger_Record_Mod $ruleModel->setData($rowData); $assignedTo = Settings_MailConverter_RuleRecord_Model::getAssignedTo($scannerId, $ruleId); $ruleModel->set('assigned_to', $assignedTo[1]); - $action = reset($ruleModel->getActions()); - return $ruleModel->set('action', str_replace(',', '_', $action->actiontext)); + $actions=$ruleModel->getActions(); + $action = reset($actions); + return $ruleModel->set('action', isset($action->actiontext) ? str_replace(',', '_', $action->actiontext) : ''); } return false; }