@@ -6,6 +6,6 @@ |
||
| 6 | 6 | * @copyright YetiForce Sp. z o.o |
| 7 | 7 | * @author Mariusz Krzaczkowski <[email protected]> |
| 8 | 8 | */ |
| 9 | -chdir(__DIR__.'/../'); |
|
| 9 | +chdir(__DIR__ . '/../'); |
|
| 10 | 10 | define('IS_PUBLIC_DIR', true); |
| 11 | 11 | require 'webservice.php'; |
@@ -6,6 +6,6 @@ |
||
| 6 | 6 | * @copyright YetiForce Sp. z o.o |
| 7 | 7 | * @author Mariusz Krzaczkowski <[email protected]> |
| 8 | 8 | */ |
| 9 | -chdir(__DIR__.'/../'); |
|
| 9 | +chdir(__DIR__ . '/../'); |
|
| 10 | 10 | define('IS_PUBLIC_DIR', true); |
| 11 | 11 | require 'cron.php'; |
@@ -6,6 +6,6 @@ |
||
| 6 | 6 | * @copyright YetiForce Sp. z o.o |
| 7 | 7 | * @author Mariusz Krzaczkowski <[email protected]> |
| 8 | 8 | */ |
| 9 | -chdir(__DIR__.'/../'); |
|
| 9 | +chdir(__DIR__ . '/../'); |
|
| 10 | 10 | define('IS_PUBLIC_DIR', true); |
| 11 | 11 | require 'dav.php'; |
@@ -6,6 +6,6 @@ |
||
| 6 | 6 | * @license YetiForce Public License 3.0 (licenses/LicenseEN.txt or yetiforce.com) |
| 7 | 7 | * @author Mariusz Krzaczkowski <[email protected]> |
| 8 | 8 | */ |
| 9 | -chdir(__DIR__.'/../'); |
|
| 9 | +chdir(__DIR__ . '/../'); |
|
| 10 | 10 | define('IS_PUBLIC_DIR', true); |
| 11 | 11 | require 'file.php'; |
@@ -42,9 +42,9 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | public function getUrl() |
| 44 | 44 | { |
| 45 | - $url = 'module='.$this->Module.'&view=Detail&record='.$this->Record.'&mode=showRecentRelation&page=1&limit='.$this->Data['limit']; |
|
| 45 | + $url = 'module=' . $this->Module . '&view=Detail&record=' . $this->Record . '&mode=showRecentRelation&page=1&limit=' . $this->Data['limit']; |
|
| 46 | 46 | foreach (self::getActions() as $type) { |
| 47 | - $url .= '&type[]='.$type; |
|
| 47 | + $url .= '&type[]=' . $type; |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | return $url; |
@@ -142,12 +142,12 @@ discard block |
||
| 142 | 142 | 'id' => 'vtiger_crmentity.crmid', |
| 143 | 143 | 'content' => 'a.subject', |
| 144 | 144 | 'user' => 'vtiger_crmentity.smownerid', |
| 145 | - 'time' => new \yii\db\Expression('CONCAT(a.date_start, '.$db->quoteValue(' ').', a.time_start)'), |
|
| 145 | + 'time' => new \yii\db\Expression('CONCAT(a.date_start, ' . $db->quoteValue(' ') . ', a.time_start)'), |
|
| 146 | 146 | ]) |
| 147 | 147 | ->from('vtiger_activity a') |
| 148 | 148 | ->innerJoin('vtiger_crmentity', 'vtiger_crmentity.crmid = a.activityid') |
| 149 | 149 | ->where(['vtiger_crmentity.deleted' => 0]) |
| 150 | - ->andWhere(['=', 'a.'.$field, $recordId]); |
|
| 150 | + ->andWhere(['=', 'a.' . $field, $recordId]); |
|
| 151 | 151 | \App\PrivilegeQuery::getConditions($query, 'Calendar', false, $recordId); |
| 152 | 152 | $queries[] = $query; |
| 153 | 153 | } |
@@ -10,203 +10,203 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | class Vtiger_HistoryRelation_Widget extends Vtiger_Basic_Widget |
| 12 | 12 | { |
| 13 | - /** |
|
| 14 | - * Names od classes that define color. |
|
| 15 | - * |
|
| 16 | - * @var string[] |
|
| 17 | - */ |
|
| 18 | - public static $colors = [ |
|
| 19 | - 'ModComments' => 'bg-primary', |
|
| 20 | - 'OSSMailViewReceived' => 'bg-danger', |
|
| 21 | - 'OSSMailViewSent' => 'bg-success', |
|
| 22 | - 'OSSMailViewInternal' => 'bg-primary', |
|
| 23 | - 'Calendar' => 'bg-warning', |
|
| 24 | - ]; |
|
| 13 | + /** |
|
| 14 | + * Names od classes that define color. |
|
| 15 | + * |
|
| 16 | + * @var string[] |
|
| 17 | + */ |
|
| 18 | + public static $colors = [ |
|
| 19 | + 'ModComments' => 'bg-primary', |
|
| 20 | + 'OSSMailViewReceived' => 'bg-danger', |
|
| 21 | + 'OSSMailViewSent' => 'bg-success', |
|
| 22 | + 'OSSMailViewInternal' => 'bg-primary', |
|
| 23 | + 'Calendar' => 'bg-warning', |
|
| 24 | + ]; |
|
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * Function gets modules name. |
|
| 28 | - * |
|
| 29 | - * @return string[] |
|
| 30 | - */ |
|
| 31 | - public static function getActions() |
|
| 32 | - { |
|
| 33 | - $modules = ['ModComments', 'OSSMailView', 'Calendar']; |
|
| 34 | - foreach ($modules as $key => $module) { |
|
| 35 | - if (!\App\Privilege::isPermitted($module)) { |
|
| 36 | - unset($modules[$key]); |
|
| 37 | - } |
|
| 38 | - } |
|
| 26 | + /** |
|
| 27 | + * Function gets modules name. |
|
| 28 | + * |
|
| 29 | + * @return string[] |
|
| 30 | + */ |
|
| 31 | + public static function getActions() |
|
| 32 | + { |
|
| 33 | + $modules = ['ModComments', 'OSSMailView', 'Calendar']; |
|
| 34 | + foreach ($modules as $key => $module) { |
|
| 35 | + if (!\App\Privilege::isPermitted($module)) { |
|
| 36 | + unset($modules[$key]); |
|
| 37 | + } |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - return $modules; |
|
| 41 | - } |
|
| 40 | + return $modules; |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - public function getUrl() |
|
| 44 | - { |
|
| 45 | - $url = 'module='.$this->Module.'&view=Detail&record='.$this->Record.'&mode=showRecentRelation&page=1&limit='.$this->Data['limit']; |
|
| 46 | - foreach (self::getActions() as $type) { |
|
| 47 | - $url .= '&type[]='.$type; |
|
| 48 | - } |
|
| 43 | + public function getUrl() |
|
| 44 | + { |
|
| 45 | + $url = 'module='.$this->Module.'&view=Detail&record='.$this->Record.'&mode=showRecentRelation&page=1&limit='.$this->Data['limit']; |
|
| 46 | + foreach (self::getActions() as $type) { |
|
| 47 | + $url .= '&type[]='.$type; |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - return $url; |
|
| 51 | - } |
|
| 50 | + return $url; |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - public function getWidget() |
|
| 54 | - { |
|
| 55 | - $this->Config['tpl'] = 'HistoryRelation.tpl'; |
|
| 56 | - $this->Config['url'] = $this->getUrl(); |
|
| 57 | - $widget = $this->Config; |
|
| 53 | + public function getWidget() |
|
| 54 | + { |
|
| 55 | + $this->Config['tpl'] = 'HistoryRelation.tpl'; |
|
| 56 | + $this->Config['url'] = $this->getUrl(); |
|
| 57 | + $widget = $this->Config; |
|
| 58 | 58 | |
| 59 | - return $widget; |
|
| 60 | - } |
|
| 59 | + return $widget; |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - public function getConfigTplName() |
|
| 63 | - { |
|
| 64 | - return 'HistoryRelationConfig'; |
|
| 65 | - } |
|
| 62 | + public function getConfigTplName() |
|
| 63 | + { |
|
| 64 | + return 'HistoryRelationConfig'; |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | - /** |
|
| 68 | - * Function gets records for timeline widget. |
|
| 69 | - * |
|
| 70 | - * @param \App\Request $request |
|
| 71 | - * @param Vtiger_Paging_Model $pagingModel |
|
| 72 | - * |
|
| 73 | - * @return array - List of records |
|
| 74 | - */ |
|
| 75 | - public static function getHistory(\App\Request $request, Vtiger_Paging_Model $pagingModel) |
|
| 76 | - { |
|
| 77 | - $recordId = $request->getInteger('record'); |
|
| 78 | - if ($request->isEmpty('type')) { |
|
| 79 | - return []; |
|
| 80 | - } |
|
| 81 | - $query = static::getQuery($recordId, $request->getModule(), $request->get('type')); |
|
| 82 | - if (empty($query)) { |
|
| 83 | - return []; |
|
| 84 | - } |
|
| 85 | - $startIndex = $pagingModel->getStartIndex(); |
|
| 86 | - $pageLimit = $pagingModel->getPageLimit(); |
|
| 67 | + /** |
|
| 68 | + * Function gets records for timeline widget. |
|
| 69 | + * |
|
| 70 | + * @param \App\Request $request |
|
| 71 | + * @param Vtiger_Paging_Model $pagingModel |
|
| 72 | + * |
|
| 73 | + * @return array - List of records |
|
| 74 | + */ |
|
| 75 | + public static function getHistory(\App\Request $request, Vtiger_Paging_Model $pagingModel) |
|
| 76 | + { |
|
| 77 | + $recordId = $request->getInteger('record'); |
|
| 78 | + if ($request->isEmpty('type')) { |
|
| 79 | + return []; |
|
| 80 | + } |
|
| 81 | + $query = static::getQuery($recordId, $request->getModule(), $request->get('type')); |
|
| 82 | + if (empty($query)) { |
|
| 83 | + return []; |
|
| 84 | + } |
|
| 85 | + $startIndex = $pagingModel->getStartIndex(); |
|
| 86 | + $pageLimit = $pagingModel->getPageLimit(); |
|
| 87 | 87 | |
| 88 | - $query->limit($pageLimit)->offset($startIndex); |
|
| 89 | - $history = []; |
|
| 90 | - $groups = Settings_Groups_Record_Model::getAll(); |
|
| 91 | - $groupIds = array_keys($groups); |
|
| 92 | - $dataReader = $query->createCommand()->query(); |
|
| 93 | - while ($row = $dataReader->read()) { |
|
| 94 | - if (in_array($row['user'], $groupIds)) { |
|
| 95 | - $row['isGroup'] = true; |
|
| 96 | - $row['userModel'] = $groups[$row['user']]; |
|
| 97 | - } else { |
|
| 98 | - $row['isGroup'] = false; |
|
| 99 | - $row['userModel'] = Users_Privileges_Model::getInstanceById($row['user']); |
|
| 100 | - } |
|
| 101 | - $row['class'] = self::$colors[$row['type']]; |
|
| 102 | - if (strpos($row['type'], 'OSSMailView') !== false) { |
|
| 103 | - $row['type'] = 'OSSMailView'; |
|
| 104 | - $row['url'] = Vtiger_Module_Model::getInstance('OSSMailView')->getPreviewViewUrl($row['id']); |
|
| 105 | - } else { |
|
| 106 | - $row['url'] = Vtiger_Module_Model::getInstance($row['type'])->getDetailViewUrl($row['id']); |
|
| 107 | - } |
|
| 108 | - $body = trim(App\Purifier::purify($row['body'])); |
|
| 109 | - if (!$request->getBoolean('isFullscreen')) { |
|
| 110 | - $body = App\TextParser::textTruncate($body, 100); |
|
| 111 | - } else { |
|
| 112 | - $body = str_replace(['<p></p>', '<p class="MsoNormal">'], ["\r\n", "\r\n"], App\Purifier::decodeHtml(App\Purifier::purify($body))); |
|
| 113 | - $body = nl2br(App\TextParser::textTruncate($body, 500), false); |
|
| 114 | - } |
|
| 115 | - $row['body'] = $body; |
|
| 116 | - $history[] = $row; |
|
| 117 | - } |
|
| 88 | + $query->limit($pageLimit)->offset($startIndex); |
|
| 89 | + $history = []; |
|
| 90 | + $groups = Settings_Groups_Record_Model::getAll(); |
|
| 91 | + $groupIds = array_keys($groups); |
|
| 92 | + $dataReader = $query->createCommand()->query(); |
|
| 93 | + while ($row = $dataReader->read()) { |
|
| 94 | + if (in_array($row['user'], $groupIds)) { |
|
| 95 | + $row['isGroup'] = true; |
|
| 96 | + $row['userModel'] = $groups[$row['user']]; |
|
| 97 | + } else { |
|
| 98 | + $row['isGroup'] = false; |
|
| 99 | + $row['userModel'] = Users_Privileges_Model::getInstanceById($row['user']); |
|
| 100 | + } |
|
| 101 | + $row['class'] = self::$colors[$row['type']]; |
|
| 102 | + if (strpos($row['type'], 'OSSMailView') !== false) { |
|
| 103 | + $row['type'] = 'OSSMailView'; |
|
| 104 | + $row['url'] = Vtiger_Module_Model::getInstance('OSSMailView')->getPreviewViewUrl($row['id']); |
|
| 105 | + } else { |
|
| 106 | + $row['url'] = Vtiger_Module_Model::getInstance($row['type'])->getDetailViewUrl($row['id']); |
|
| 107 | + } |
|
| 108 | + $body = trim(App\Purifier::purify($row['body'])); |
|
| 109 | + if (!$request->getBoolean('isFullscreen')) { |
|
| 110 | + $body = App\TextParser::textTruncate($body, 100); |
|
| 111 | + } else { |
|
| 112 | + $body = str_replace(['<p></p>', '<p class="MsoNormal">'], ["\r\n", "\r\n"], App\Purifier::decodeHtml(App\Purifier::purify($body))); |
|
| 113 | + $body = nl2br(App\TextParser::textTruncate($body, 500), false); |
|
| 114 | + } |
|
| 115 | + $row['body'] = $body; |
|
| 116 | + $history[] = $row; |
|
| 117 | + } |
|
| 118 | 118 | |
| 119 | - return $history; |
|
| 120 | - } |
|
| 119 | + return $history; |
|
| 120 | + } |
|
| 121 | 121 | |
| 122 | - /** |
|
| 123 | - * Function creates database query in order to get records for timeline widget. |
|
| 124 | - * |
|
| 125 | - * @param int $recordId |
|
| 126 | - * @param string $moduleName |
|
| 127 | - * @param array $type |
|
| 128 | - * |
|
| 129 | - * @return \App\Db\Query()|false |
|
| 130 | - */ |
|
| 131 | - public static function getQuery($recordId, $moduleName, $type) |
|
| 132 | - { |
|
| 133 | - $queries = []; |
|
| 134 | - $field = \App\ModuleHierarchy::getMappingRelatedField($moduleName); |
|
| 135 | - $db = App\Db::getInstance(); |
|
| 136 | - if (in_array('Calendar', $type)) { |
|
| 137 | - $query = (new \App\Db\Query()) |
|
| 138 | - ->select([ |
|
| 139 | - 'body' => new \yii\db\Expression($db->quoteValue('')), |
|
| 140 | - 'attachments_exist' => new \yii\db\Expression($db->quoteValue('')), |
|
| 141 | - 'type' => new \yii\db\Expression($db->quoteValue('Calendar')), |
|
| 142 | - 'id' => 'vtiger_crmentity.crmid', |
|
| 143 | - 'content' => 'a.subject', |
|
| 144 | - 'user' => 'vtiger_crmentity.smownerid', |
|
| 145 | - 'time' => new \yii\db\Expression('CONCAT(a.date_start, '.$db->quoteValue(' ').', a.time_start)'), |
|
| 146 | - ]) |
|
| 147 | - ->from('vtiger_activity a') |
|
| 148 | - ->innerJoin('vtiger_crmentity', 'vtiger_crmentity.crmid = a.activityid') |
|
| 149 | - ->where(['vtiger_crmentity.deleted' => 0]) |
|
| 150 | - ->andWhere(['=', 'a.'.$field, $recordId]); |
|
| 151 | - \App\PrivilegeQuery::getConditions($query, 'Calendar', false, $recordId); |
|
| 152 | - $queries[] = $query; |
|
| 153 | - } |
|
| 154 | - if (in_array('ModComments', $type)) { |
|
| 155 | - $query = (new \App\Db\Query()) |
|
| 156 | - ->select([ |
|
| 157 | - 'body' => new \yii\db\Expression($db->quoteValue('')), |
|
| 158 | - 'attachments_exist' => new \yii\db\Expression($db->quoteValue('')), |
|
| 159 | - 'type' => new \yii\db\Expression($db->quoteValue('ModComments')), |
|
| 160 | - 'id' => 'm.modcommentsid', |
|
| 161 | - 'content' => 'm.commentcontent', |
|
| 162 | - 'user' => 'vtiger_crmentity.smownerid', |
|
| 163 | - 'time' => 'vtiger_crmentity.createdtime', |
|
| 164 | - ]) |
|
| 165 | - ->from('vtiger_modcomments m') |
|
| 166 | - ->innerJoin('vtiger_crmentity', 'vtiger_crmentity.crmid = m.modcommentsid') |
|
| 167 | - ->where(['vtiger_crmentity.deleted' => 0]) |
|
| 168 | - ->andWhere(['=', 'related_to', $recordId]); |
|
| 169 | - \App\PrivilegeQuery::getConditions($query, 'ModComments', false, $recordId); |
|
| 170 | - $queries[] = $query; |
|
| 171 | - } |
|
| 172 | - if (in_array('OSSMailView', $type)) { |
|
| 173 | - $query = (new \App\Db\Query()) |
|
| 174 | - ->select([ |
|
| 175 | - 'body' => 'o.content', |
|
| 176 | - 'attachments_exist', |
|
| 177 | - 'type' => new \yii\db\Expression('CONCAT(\'OSSMailView\', o.ossmailview_sendtype)'), |
|
| 178 | - 'id' => 'o.ossmailviewid', |
|
| 179 | - 'content' => 'o.subject', |
|
| 180 | - 'user' => 'vtiger_crmentity.smownerid', |
|
| 181 | - 'time' => 'vtiger_crmentity.createdtime', |
|
| 182 | - ]) |
|
| 183 | - ->from('vtiger_ossmailview o') |
|
| 184 | - ->innerJoin('vtiger_crmentity', 'vtiger_crmentity.crmid = o.ossmailviewid') |
|
| 185 | - ->innerJoin('vtiger_ossmailview_relation r', 'r.ossmailviewid = o.ossmailviewid ') |
|
| 186 | - ->where(['vtiger_crmentity.deleted' => 0]) |
|
| 187 | - ->andWhere(['=', 'r.crmid', $recordId]); |
|
| 188 | - \App\PrivilegeQuery::getConditions($query, 'OSSMailView', false, $recordId); |
|
| 189 | - $queries[] = $query; |
|
| 190 | - } |
|
| 191 | - if (count($queries) == 1) { |
|
| 192 | - $sql = reset($queries); |
|
| 193 | - } else { |
|
| 194 | - $subQuery = reset($queries); |
|
| 195 | - $index = 0; |
|
| 196 | - foreach ($queries as $query) { |
|
| 197 | - if ($index !== 0) { |
|
| 198 | - $subQuery->union($query, true); |
|
| 199 | - } |
|
| 122 | + /** |
|
| 123 | + * Function creates database query in order to get records for timeline widget. |
|
| 124 | + * |
|
| 125 | + * @param int $recordId |
|
| 126 | + * @param string $moduleName |
|
| 127 | + * @param array $type |
|
| 128 | + * |
|
| 129 | + * @return \App\Db\Query()|false |
|
| 130 | + */ |
|
| 131 | + public static function getQuery($recordId, $moduleName, $type) |
|
| 132 | + { |
|
| 133 | + $queries = []; |
|
| 134 | + $field = \App\ModuleHierarchy::getMappingRelatedField($moduleName); |
|
| 135 | + $db = App\Db::getInstance(); |
|
| 136 | + if (in_array('Calendar', $type)) { |
|
| 137 | + $query = (new \App\Db\Query()) |
|
| 138 | + ->select([ |
|
| 139 | + 'body' => new \yii\db\Expression($db->quoteValue('')), |
|
| 140 | + 'attachments_exist' => new \yii\db\Expression($db->quoteValue('')), |
|
| 141 | + 'type' => new \yii\db\Expression($db->quoteValue('Calendar')), |
|
| 142 | + 'id' => 'vtiger_crmentity.crmid', |
|
| 143 | + 'content' => 'a.subject', |
|
| 144 | + 'user' => 'vtiger_crmentity.smownerid', |
|
| 145 | + 'time' => new \yii\db\Expression('CONCAT(a.date_start, '.$db->quoteValue(' ').', a.time_start)'), |
|
| 146 | + ]) |
|
| 147 | + ->from('vtiger_activity a') |
|
| 148 | + ->innerJoin('vtiger_crmentity', 'vtiger_crmentity.crmid = a.activityid') |
|
| 149 | + ->where(['vtiger_crmentity.deleted' => 0]) |
|
| 150 | + ->andWhere(['=', 'a.'.$field, $recordId]); |
|
| 151 | + \App\PrivilegeQuery::getConditions($query, 'Calendar', false, $recordId); |
|
| 152 | + $queries[] = $query; |
|
| 153 | + } |
|
| 154 | + if (in_array('ModComments', $type)) { |
|
| 155 | + $query = (new \App\Db\Query()) |
|
| 156 | + ->select([ |
|
| 157 | + 'body' => new \yii\db\Expression($db->quoteValue('')), |
|
| 158 | + 'attachments_exist' => new \yii\db\Expression($db->quoteValue('')), |
|
| 159 | + 'type' => new \yii\db\Expression($db->quoteValue('ModComments')), |
|
| 160 | + 'id' => 'm.modcommentsid', |
|
| 161 | + 'content' => 'm.commentcontent', |
|
| 162 | + 'user' => 'vtiger_crmentity.smownerid', |
|
| 163 | + 'time' => 'vtiger_crmentity.createdtime', |
|
| 164 | + ]) |
|
| 165 | + ->from('vtiger_modcomments m') |
|
| 166 | + ->innerJoin('vtiger_crmentity', 'vtiger_crmentity.crmid = m.modcommentsid') |
|
| 167 | + ->where(['vtiger_crmentity.deleted' => 0]) |
|
| 168 | + ->andWhere(['=', 'related_to', $recordId]); |
|
| 169 | + \App\PrivilegeQuery::getConditions($query, 'ModComments', false, $recordId); |
|
| 170 | + $queries[] = $query; |
|
| 171 | + } |
|
| 172 | + if (in_array('OSSMailView', $type)) { |
|
| 173 | + $query = (new \App\Db\Query()) |
|
| 174 | + ->select([ |
|
| 175 | + 'body' => 'o.content', |
|
| 176 | + 'attachments_exist', |
|
| 177 | + 'type' => new \yii\db\Expression('CONCAT(\'OSSMailView\', o.ossmailview_sendtype)'), |
|
| 178 | + 'id' => 'o.ossmailviewid', |
|
| 179 | + 'content' => 'o.subject', |
|
| 180 | + 'user' => 'vtiger_crmentity.smownerid', |
|
| 181 | + 'time' => 'vtiger_crmentity.createdtime', |
|
| 182 | + ]) |
|
| 183 | + ->from('vtiger_ossmailview o') |
|
| 184 | + ->innerJoin('vtiger_crmentity', 'vtiger_crmentity.crmid = o.ossmailviewid') |
|
| 185 | + ->innerJoin('vtiger_ossmailview_relation r', 'r.ossmailviewid = o.ossmailviewid ') |
|
| 186 | + ->where(['vtiger_crmentity.deleted' => 0]) |
|
| 187 | + ->andWhere(['=', 'r.crmid', $recordId]); |
|
| 188 | + \App\PrivilegeQuery::getConditions($query, 'OSSMailView', false, $recordId); |
|
| 189 | + $queries[] = $query; |
|
| 190 | + } |
|
| 191 | + if (count($queries) == 1) { |
|
| 192 | + $sql = reset($queries); |
|
| 193 | + } else { |
|
| 194 | + $subQuery = reset($queries); |
|
| 195 | + $index = 0; |
|
| 196 | + foreach ($queries as $query) { |
|
| 197 | + if ($index !== 0) { |
|
| 198 | + $subQuery->union($query, true); |
|
| 199 | + } |
|
| 200 | 200 | |
| 201 | - ++$index; |
|
| 202 | - } |
|
| 203 | - if ($subQuery) { |
|
| 204 | - $sql = (new \App\Db\Query())->from(['records' => $subQuery]); |
|
| 205 | - } else { |
|
| 206 | - return false; |
|
| 207 | - } |
|
| 208 | - } |
|
| 201 | + ++$index; |
|
| 202 | + } |
|
| 203 | + if ($subQuery) { |
|
| 204 | + $sql = (new \App\Db\Query())->from(['records' => $subQuery]); |
|
| 205 | + } else { |
|
| 206 | + return false; |
|
| 207 | + } |
|
| 208 | + } |
|
| 209 | 209 | |
| 210 | - return $sql->orderBy(['time' => SORT_DESC]); |
|
| 211 | - } |
|
| 210 | + return $sql->orderBy(['time' => SORT_DESC]); |
|
| 211 | + } |
|
| 212 | 212 | } |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | /** |
| 41 | 41 | * Function to get module instance of this record. |
| 42 | 42 | * |
| 43 | - * @return <type> |
|
| 43 | + * @return string |
|
| 44 | 44 | */ |
| 45 | 45 | public function getModule() |
| 46 | 46 | { |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | /** |
| 51 | 51 | * Function to set module to this record instance. |
| 52 | 52 | * |
| 53 | - * @param <Settings_CronTasks_Module_Model> $moduleModel |
|
| 53 | + * @param Settings_CronTasks_Module_Model $moduleModel |
|
| 54 | 54 | * |
| 55 | 55 | * @return <Settings_CronTasks_Record_Model> record model |
| 56 | 56 | */ |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | /** |
| 208 | 208 | * Function to get record instance by using id and moduleName. |
| 209 | 209 | * |
| 210 | - * @param <Integer> $recordId |
|
| 210 | + * @param integer $recordId |
|
| 211 | 211 | * @param string $qualifiedModuleName |
| 212 | 212 | * |
| 213 | 213 | * @return <Settings_CronTasks_Record_Model> RecordModel |
@@ -233,6 +233,9 @@ discard block |
||
| 233 | 233 | return false; |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | + /** |
|
| 237 | + * @param string $name |
|
| 238 | + */ |
|
| 236 | 239 | public static function getInstanceByName($name) |
| 237 | 240 | { |
| 238 | 241 | $query = (new \App\Db\Query()) |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | /** |
| 68 | 68 | * Create vtiger CRM block. |
| 69 | 69 | * |
| 70 | - * @param \Module $moduleInstance |
|
| 70 | + * @param boolean $moduleInstance |
|
| 71 | 71 | */ |
| 72 | 72 | public function __create($moduleInstance) |
| 73 | 73 | { |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | * |
| 150 | 150 | * @param FieldBasic $fieldInstance |
| 151 | 151 | * |
| 152 | - * @return Reference to this block instance |
|
| 152 | + * @return Block to this block instance |
|
| 153 | 153 | */ |
| 154 | 154 | public function addField(FieldBasic $fieldInstance) |
| 155 | 155 | { |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | * |
| 197 | 197 | * @param ModuleBasic $moduleInstance |
| 198 | 198 | * |
| 199 | - * @return self |
|
| 199 | + * @return boolean |
|
| 200 | 200 | */ |
| 201 | 201 | public static function getAllForModule(ModuleBasic $moduleInstance) |
| 202 | 202 | { |
@@ -38,7 +38,8 @@ discard block |
||
| 38 | 38 | /** |
| 39 | 39 | * set the value to the data. |
| 40 | 40 | * |
| 41 | - * @param type $value,$key |
|
| 41 | + * @param string $key |
|
| 42 | + * @param integer $value |
|
| 42 | 43 | */ |
| 43 | 44 | public function set($key, $value) |
| 44 | 45 | { |
@@ -195,6 +196,7 @@ discard block |
||
| 195 | 196 | |
| 196 | 197 | /** |
| 197 | 198 | * Helper function to check the status value. |
| 199 | + * @param integer $value |
|
| 198 | 200 | */ |
| 199 | 201 | public function statusEqual($value) |
| 200 | 202 | { |
@@ -271,7 +273,7 @@ discard block |
||
| 271 | 273 | /** |
| 272 | 274 | * Mark this instance as finished. |
| 273 | 275 | * |
| 274 | - * @return int |
|
| 276 | + * @return Cron |
|
| 275 | 277 | */ |
| 276 | 278 | public function markFinished() |
| 277 | 279 | { |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | * |
| 251 | 251 | * @param ModuleBasic $moduleInstance |
| 252 | 252 | * |
| 253 | - * @return self |
|
| 253 | + * @return boolean |
|
| 254 | 254 | */ |
| 255 | 255 | public static function getAllForModule(ModuleBasic $moduleInstance) |
| 256 | 256 | { |
@@ -309,6 +309,7 @@ discard block |
||
| 309 | 309 | * Function to remove uitype10 fields. |
| 310 | 310 | * |
| 311 | 311 | * @param Module Instance of module |
| 312 | + * @param ModuleBasic $moduleInstance |
|
| 312 | 313 | */ |
| 313 | 314 | public static function deleteUiType10Fields($moduleInstance) |
| 314 | 315 | { |
@@ -329,6 +330,7 @@ discard block |
||
| 329 | 330 | * Function to remove picklist-type or multiple choice picklist-type table. |
| 330 | 331 | * |
| 331 | 332 | * @param Module Instance of module |
| 333 | + * @param ModuleBasic $moduleInstance |
|
| 332 | 334 | */ |
| 333 | 335 | public static function deletePickLists($moduleInstance) |
| 334 | 336 | { |