@@ -149,6 +149,10 @@ discard block |
||
| 149 | 149 | return $hierarchy; |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | + /** |
|
| 153 | + * @param integer $id |
|
| 154 | + * @param integer[] $encountered_accounts |
|
| 155 | + */ |
|
| 152 | 156 | public function __getParentEmployees($id, &$parent_accounts, &$encountered_accounts) |
| 153 | 157 | { |
| 154 | 158 | $adb = PearDatabase::getInstance(); |
@@ -200,6 +204,9 @@ discard block |
||
| 200 | 204 | return $parent_accounts; |
| 201 | 205 | } |
| 202 | 206 | |
| 207 | + /** |
|
| 208 | + * @param integer $id |
|
| 209 | + */ |
|
| 203 | 210 | public function __getChildEmployees($id, &$child_accounts, $depth) |
| 204 | 211 | { |
| 205 | 212 | $adb = PearDatabase::getInstance(); |
@@ -284,16 +284,18 @@ discard block |
||
| 284 | 284 | |
| 285 | 285 | |
| 286 | 286 | |
| 287 | - if ($singlepane_view == 'true') |
|
| 288 | - $returnset = '&return_module=' . $this_module . '&return_action=DetailView&return_id=' . $id; |
|
| 289 | - else |
|
| 290 | - $returnset = '&return_module=' . $this_module . '&return_action=CallRelatedList&return_id=' . $id; |
|
| 287 | + if ($singlepane_view == 'true') { |
|
| 288 | + $returnset = '&return_module=' . $this_module . '&return_action=DetailView&return_id=' . $id; |
|
| 289 | + } else { |
|
| 290 | + $returnset = '&return_module=' . $this_module . '&return_action=CallRelatedList&return_id=' . $id; |
|
| 291 | + } |
|
| 291 | 292 | |
| 292 | 293 | $button = ''; |
| 293 | 294 | |
| 294 | 295 | if ($actions && getFieldVisibilityPermission($related_module, $current_user->id, 'parent_id', 'readwrite') == '0') { |
| 295 | - if (is_string($actions)) |
|
| 296 | - $actions = explode(',', strtoupper($actions)); |
|
| 296 | + if (is_string($actions)) { |
|
| 297 | + $actions = explode(',', strtoupper($actions)); |
|
| 298 | + } |
|
| 297 | 299 | if (in_array('SELECT', $actions) && isPermitted($related_module, 4, '') == 'yes') { |
| 298 | 300 | $button .= "<input title='" . \includes\Language::translate('LBL_SELECT') . " " . \includes\Language::translate($related_module) . "' class='crmbutton small edit' type='button' onclick=\"return window.open('index.php?module=$related_module&return_module=$currentModule&action=Popup&popuptype=detailview&select=enable&form=EditView&form_submit=false&recordid=$id','test','width=640,height=602,resizable=0,scrollbars=0');\" value='" . \includes\Language::translate('LBL_SELECT') . " " . \includes\Language::translate($related_module) . "'> "; |
| 299 | 301 | } |
@@ -316,8 +318,9 @@ discard block |
||
| 316 | 318 | WHERE vtiger_crmentity.deleted = 0 && vtiger_crmentity.`smownerid`= " . $userId; |
| 317 | 319 | |
| 318 | 320 | $return_value = GetRelatedList($this_module, $related_module, $other, $query, $button, $returnset); |
| 319 | - if ($return_value === null) |
|
| 320 | - $return_value = Array(); |
|
| 321 | + if ($return_value === null) { |
|
| 322 | + $return_value = Array(); |
|
| 323 | + } |
|
| 321 | 324 | $return_value['CUSTOM_BUTTON'] = $button; |
| 322 | 325 | $log->debug("Exiting get_osstimecontrol method ..."); |
| 323 | 326 | return $return_value; |
@@ -336,8 +339,9 @@ discard block |
||
| 336 | 339 | $modcommentsModuleInstance = vtlib\Module::getInstance('ModComments'); |
| 337 | 340 | if ($modcommentsModuleInstance && file_exists('modules/ModComments/ModComments.php')) { |
| 338 | 341 | include_once 'modules/ModComments/ModComments.php'; |
| 339 | - if (class_exists('ModComments')) |
|
| 340 | - ModComments::addWidgetTo(array('OSSEmployees')); |
|
| 342 | + if (class_exists('ModComments')) { |
|
| 343 | + ModComments::addWidgetTo(array('OSSEmployees')); |
|
| 344 | + } |
|
| 341 | 345 | } |
| 342 | 346 | } else if ($event_type == 'module.disabled') { |
| 343 | 347 | |
@@ -50,6 +50,9 @@ discard block |
||
| 50 | 50 | return $xml; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | + /** |
|
| 54 | + * @param integer $level |
|
| 55 | + */ |
|
| 53 | 56 | protected function createXML($key, $value, $level) |
| 54 | 57 | { |
| 55 | 58 | $indent = ''; |
@@ -69,6 +72,9 @@ discard block |
||
| 69 | 72 | return $xml; |
| 70 | 73 | } |
| 71 | 74 | |
| 75 | + /** |
|
| 76 | + * @param string $line |
|
| 77 | + */ |
|
| 72 | 78 | protected function parseLine($line) |
| 73 | 79 | { |
| 74 | 80 | $tag = substr($line, 1, strpos($line, ':', 1) - 1); |
@@ -114,6 +120,9 @@ discard block |
||
| 114 | 120 | $this->_lastTag = $tag; |
| 115 | 121 | } |
| 116 | 122 | |
| 123 | + /** |
|
| 124 | + * @param string $value |
|
| 125 | + */ |
|
| 117 | 126 | protected function parseOperation($value) |
| 118 | 127 | { |
| 119 | 128 | $this->operations[] = array( |
@@ -124,6 +133,9 @@ discard block |
||
| 124 | 133 | ); |
| 125 | 134 | } |
| 126 | 135 | |
| 136 | + /** |
|
| 137 | + * @param string $value |
|
| 138 | + */ |
|
| 127 | 139 | protected function parseBalance($value) |
| 128 | 140 | { |
| 129 | 141 | return array( |
@@ -134,6 +146,9 @@ discard block |
||
| 134 | 146 | ); |
| 135 | 147 | } |
| 136 | 148 | |
| 149 | + /** |
|
| 150 | + * @param string $value |
|
| 151 | + */ |
|
| 137 | 152 | protected function parseTransaction($value) |
| 138 | 153 | { |
| 139 | 154 | $transaction = array( |
@@ -34,8 +34,9 @@ discard block |
||
| 34 | 34 | public function parse() |
| 35 | 35 | { |
| 36 | 36 | $tab = $this->prepareFile(); |
| 37 | - foreach ($tab as $line) |
|
| 38 | - $this->parseLine($line); |
|
| 37 | + foreach ($tab as $line) { |
|
| 38 | + $this->parseLine($line); |
|
| 39 | + } |
|
| 39 | 40 | } |
| 40 | 41 | |
| 41 | 42 | public function getXML() |
@@ -53,13 +54,15 @@ discard block |
||
| 53 | 54 | protected function createXML($key, $value, $level) |
| 54 | 55 | { |
| 55 | 56 | $indent = ''; |
| 56 | - for ($i = 0; $i <= $level; $i++) |
|
| 57 | - $indent .= "\t"; |
|
| 57 | + for ($i = 0; $i <= $level; $i++) { |
|
| 58 | + $indent .= "\t"; |
|
| 59 | + } |
|
| 58 | 60 | if (is_array($value)) { |
| 59 | 61 | $xml = "$indent<$key>\n"; |
| 60 | 62 | foreach ($value as $subKey => $subVal) { |
| 61 | - if (is_numeric($subKey)) |
|
| 62 | - $subKey = substr($key, 0, -1); |
|
| 63 | + if (is_numeric($subKey)) { |
|
| 64 | + $subKey = substr($key, 0, -1); |
|
| 65 | + } |
|
| 63 | 66 | $xml .= $this->createXML($subKey, $subVal, $level + 1); |
| 64 | 67 | } |
| 65 | 68 | $xml .= "$indent</$key>\n"; |
@@ -85,10 +88,11 @@ discard block |
||
| 85 | 88 | break; |
| 86 | 89 | case 'NS': |
| 87 | 90 | $code = substr($value, 0, 2); |
| 88 | - if ($code == '22') |
|
| 89 | - $this->ownerName = substr($value, 2); |
|
| 90 | - else if ($code == '23') |
|
| 91 | - $this->accountName = substr($value, 2); |
|
| 91 | + if ($code == '22') { |
|
| 92 | + $this->ownerName = substr($value, 2); |
|
| 93 | + } else if ($code == '23') { |
|
| 94 | + $this->accountName = substr($value, 2); |
|
| 95 | + } |
|
| 92 | 96 | break; |
| 93 | 97 | case '60F': |
| 94 | 98 | $this->openBalance = $this->parseBalance($value); |
@@ -103,10 +107,11 @@ discard block |
||
| 103 | 107 | self::parseOperation($value); |
| 104 | 108 | break; |
| 105 | 109 | case '86': |
| 106 | - if ($this->_lastTag == '61') |
|
| 107 | - $this->parseTransaction($value); |
|
| 108 | - else |
|
| 109 | - $this->info .= $value; |
|
| 110 | + if ($this->_lastTag == '61') { |
|
| 111 | + $this->parseTransaction($value); |
|
| 112 | + } else { |
|
| 113 | + $this->info .= $value; |
|
| 114 | + } |
|
| 110 | 115 | break; |
| 111 | 116 | default: |
| 112 | 117 | break; |
@@ -20,6 +20,9 @@ discard block |
||
| 20 | 20 | $this->parseLine($line); |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | + /** |
|
| 24 | + * @param string $line |
|
| 25 | + */ |
|
| 23 | 26 | protected function parseLine($line) |
| 24 | 27 | { |
| 25 | 28 | $tag = substr($line, 1, strpos($line, ':', 1) - 1); |
@@ -65,6 +68,9 @@ discard block |
||
| 65 | 68 | $this->_lastTag = $tag; |
| 66 | 69 | } |
| 67 | 70 | |
| 71 | + /** |
|
| 72 | + * @param string $value |
|
| 73 | + */ |
|
| 68 | 74 | protected function parseOperation($value) |
| 69 | 75 | { |
| 70 | 76 | $this->operations[] = array( |
@@ -16,8 +16,9 @@ discard block |
||
| 16 | 16 | public function parse() |
| 17 | 17 | { |
| 18 | 18 | $tab = $this->prepareFile(); |
| 19 | - foreach ($tab as $line) |
|
| 20 | - $this->parseLine($line); |
|
| 19 | + foreach ($tab as $line) { |
|
| 20 | + $this->parseLine($line); |
|
| 21 | + } |
|
| 21 | 22 | } |
| 22 | 23 | |
| 23 | 24 | protected function parseLine($line) |
@@ -36,10 +37,11 @@ discard block |
||
| 36 | 37 | break; |
| 37 | 38 | case 'NS': |
| 38 | 39 | $code = substr($value, 0, 2); |
| 39 | - if ($code == '22') |
|
| 40 | - $this->ownerName = substr($value, 2); |
|
| 41 | - else if ($code == '23') |
|
| 42 | - $this->accountName = substr($value, 2); |
|
| 40 | + if ($code == '22') { |
|
| 41 | + $this->ownerName = substr($value, 2); |
|
| 42 | + } else if ($code == '23') { |
|
| 43 | + $this->accountName = substr($value, 2); |
|
| 44 | + } |
|
| 43 | 45 | break; |
| 44 | 46 | case '60F': |
| 45 | 47 | $this->openBalance = $this->parseBalance($value); |
@@ -54,10 +56,11 @@ discard block |
||
| 54 | 56 | self::parseOperation($value); |
| 55 | 57 | break; |
| 56 | 58 | case '86': |
| 57 | - if ($this->_lastTag == '61') |
|
| 58 | - $this->parseTransaction($value); |
|
| 59 | - else |
|
| 60 | - $this->info .= $value; |
|
| 59 | + if ($this->_lastTag == '61') { |
|
| 60 | + $this->parseTransaction($value); |
|
| 61 | + } else { |
|
| 62 | + $this->info .= $value; |
|
| 63 | + } |
|
| 61 | 64 | break; |
| 62 | 65 | default: |
| 63 | 66 | break; |
@@ -20,6 +20,9 @@ discard block |
||
| 20 | 20 | $this->parseLine($line); |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | + /** |
|
| 24 | + * @param string $line |
|
| 25 | + */ |
|
| 23 | 26 | protected function parseLine($line) |
| 24 | 27 | { |
| 25 | 28 | $tag = substr($line, 1, strpos($line, ':', 1) - 1); |
@@ -65,6 +68,9 @@ discard block |
||
| 65 | 68 | $this->_lastTag = $tag; |
| 66 | 69 | } |
| 67 | 70 | |
| 71 | + /** |
|
| 72 | + * @param string $value |
|
| 73 | + */ |
|
| 68 | 74 | protected function parseTransaction($value) |
| 69 | 75 | { |
| 70 | 76 | $transaction = array( |
@@ -109,6 +115,9 @@ discard block |
||
| 109 | 115 | $this->operations[count($this->operations) - 1]['details'] = $transaction; |
| 110 | 116 | } |
| 111 | 117 | |
| 118 | + /** |
|
| 119 | + * @param string $value |
|
| 120 | + */ |
|
| 112 | 121 | protected function parseOperation($value) |
| 113 | 122 | { |
| 114 | 123 | $this->operations[] = array( |
@@ -16,8 +16,9 @@ discard block |
||
| 16 | 16 | public function parse() |
| 17 | 17 | { |
| 18 | 18 | $tab = $this->prepareFile(); |
| 19 | - foreach ($tab as $line) |
|
| 20 | - $this->parseLine($line); |
|
| 19 | + foreach ($tab as $line) { |
|
| 20 | + $this->parseLine($line); |
|
| 21 | + } |
|
| 21 | 22 | } |
| 22 | 23 | |
| 23 | 24 | protected function parseLine($line) |
@@ -36,10 +37,11 @@ discard block |
||
| 36 | 37 | break; |
| 37 | 38 | case 'NS': |
| 38 | 39 | $code = substr($value, 0, 2); |
| 39 | - if ($code == '22') |
|
| 40 | - $this->ownerName = substr($value, 2); |
|
| 41 | - else if ($code == '23') |
|
| 42 | - $this->accountName = substr($value, 2); |
|
| 40 | + if ($code == '22') { |
|
| 41 | + $this->ownerName = substr($value, 2); |
|
| 42 | + } else if ($code == '23') { |
|
| 43 | + $this->accountName = substr($value, 2); |
|
| 44 | + } |
|
| 43 | 45 | break; |
| 44 | 46 | case '60F': |
| 45 | 47 | $this->openBalance = $this->parseBalance($value); |
@@ -54,10 +56,11 @@ discard block |
||
| 54 | 56 | self::parseOperation($value); |
| 55 | 57 | break; |
| 56 | 58 | case '86': |
| 57 | - if ($this->_lastTag == '61') |
|
| 58 | - $this->parseTransaction($value); |
|
| 59 | - else |
|
| 60 | - $this->info .= $value; |
|
| 59 | + if ($this->_lastTag == '61') { |
|
| 60 | + $this->parseTransaction($value); |
|
| 61 | + } else { |
|
| 62 | + $this->info .= $value; |
|
| 63 | + } |
|
| 61 | 64 | break; |
| 62 | 65 | default: |
| 63 | 66 | break; |
@@ -54,6 +54,9 @@ discard block |
||
| 54 | 54 | return $this->webappurl; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | + /** |
|
| 58 | + * @return string |
|
| 59 | + */ |
|
| 57 | 60 | public function getOutboundContext() |
| 58 | 61 | { |
| 59 | 62 | return $this->outboundcontext; |
@@ -82,6 +85,7 @@ discard block |
||
| 82 | 85 | /** |
| 83 | 86 | * Function to set server parameters |
| 84 | 87 | * @param <array> authdetails |
| 88 | + * @param PBXManager_Server_Model $serverModel |
|
| 85 | 89 | */ |
| 86 | 90 | public function setServerParameters($serverModel) |
| 87 | 91 | { |
@@ -100,6 +104,9 @@ discard block |
||
| 100 | 104 | return self::$SETTINGS_REQUIRED_PARAMETERS; |
| 101 | 105 | } |
| 102 | 106 | |
| 107 | + /** |
|
| 108 | + * @param string $type |
|
| 109 | + */ |
|
| 103 | 110 | protected function prepareParameters($details, $type) |
| 104 | 111 | { |
| 105 | 112 | switch ($type) { |
@@ -294,7 +301,6 @@ discard block |
||
| 294 | 301 | |
| 295 | 302 | /** |
| 296 | 303 | * Function to respond for outgoing calls |
| 297 | - * @param <Vtiger_Request> $details |
|
| 298 | 304 | */ |
| 299 | 305 | public function respondToOutgoingCall($to) |
| 300 | 306 | { |
@@ -324,7 +330,7 @@ discard block |
||
| 324 | 330 | /** |
| 325 | 331 | * Function to make outbound call |
| 326 | 332 | * @param <string> $number (Customer) |
| 327 | - * @param <string> $recordid |
|
| 333 | + * @param <string> $record |
|
| 328 | 334 | */ |
| 329 | 335 | public function call($number, $record) |
| 330 | 336 | { |
@@ -239,10 +239,11 @@ discard block |
||
| 239 | 239 | $recordModel = PBXManager_Record_Model::getCleanInstance(); |
| 240 | 240 | $recordModel->saveRecordWithArrray($params); |
| 241 | 241 | |
| 242 | - if ($direction == self::INCOMING_TYPE) |
|
| 243 | - $this->respondToIncomingCall($details); |
|
| 244 | - else |
|
| 245 | - $this->respondToOutgoingCall($params['CustomerNumber']); |
|
| 242 | + if ($direction == self::INCOMING_TYPE) { |
|
| 243 | + $this->respondToIncomingCall($details); |
|
| 244 | + } else { |
|
| 245 | + $this->respondToOutgoingCall($params['CustomerNumber']); |
|
| 246 | + } |
|
| 246 | 247 | } |
| 247 | 248 | |
| 248 | 249 | /** |
@@ -312,8 +313,9 @@ discard block |
||
| 312 | 313 | } else { |
| 313 | 314 | $response .= '<Number>SIP/'; |
| 314 | 315 | $response .= $to; |
| 315 | - if ($numberLength > 5) |
|
| 316 | - $response .= '@' . $this->getOutboundTrunk(); |
|
| 316 | + if ($numberLength > 5) { |
|
| 317 | + $response .= '@' . $this->getOutboundTrunk(); |
|
| 318 | + } |
|
| 317 | 319 | $response .= '</Number>'; |
| 318 | 320 | } |
| 319 | 321 | |
@@ -197,7 +197,7 @@ |
||
| 197 | 197 | |
| 198 | 198 | /** function used to get whether the pricebook has related with a product or not |
| 199 | 199 | * @param int $id - product id |
| 200 | - * @return true or false - if there are no pricebooks available or associated pricebooks for the product is equal to total number of pricebooks then return false, else return true |
|
| 200 | + * @return boolean|null or false - if there are no pricebooks available or associated pricebooks for the product is equal to total number of pricebooks then return false, else return true |
|
| 201 | 201 | */ |
| 202 | 202 | public function get_pricebook_noproduct($id) |
| 203 | 203 | { |
@@ -283,19 +283,19 @@ |
||
| 283 | 283 | $query = $this->getRelationQuery($module, $secmodule, "vtiger_pricebook", "pricebookid", $queryplanner); |
| 284 | 284 | // TODO Support query planner |
| 285 | 285 | if ($queryplanner->requireTable("vtiger_crmentityPriceBooks", $matrix)) { |
| 286 | - $query .=" left join vtiger_crmentity as vtiger_crmentityPriceBooks on vtiger_crmentityPriceBooks.crmid=vtiger_pricebook.pricebookid and vtiger_crmentityPriceBooks.deleted=0"; |
|
| 286 | + $query .= " left join vtiger_crmentity as vtiger_crmentityPriceBooks on vtiger_crmentityPriceBooks.crmid=vtiger_pricebook.pricebookid and vtiger_crmentityPriceBooks.deleted=0"; |
|
| 287 | 287 | } |
| 288 | 288 | if ($queryplanner->requireTable("vtiger_currency_infoPriceBooks")) { |
| 289 | - $query .=" left join vtiger_currency_info as vtiger_currency_infoPriceBooks on vtiger_currency_infoPriceBooks.id = vtiger_pricebook.currency_id"; |
|
| 289 | + $query .= " left join vtiger_currency_info as vtiger_currency_infoPriceBooks on vtiger_currency_infoPriceBooks.id = vtiger_pricebook.currency_id"; |
|
| 290 | 290 | } |
| 291 | 291 | if ($queryplanner->requireTable("vtiger_usersPriceBooks")) { |
| 292 | - $query .=" left join vtiger_users as vtiger_usersPriceBooks on vtiger_usersPriceBooks.id = vtiger_crmentityPriceBooks.smownerid"; |
|
| 292 | + $query .= " left join vtiger_users as vtiger_usersPriceBooks on vtiger_usersPriceBooks.id = vtiger_crmentityPriceBooks.smownerid"; |
|
| 293 | 293 | } |
| 294 | 294 | if ($queryplanner->requireTable("vtiger_groupsPriceBooks")) { |
| 295 | - $query .=" left join vtiger_groups as vtiger_groupsPriceBooks on vtiger_groupsPriceBooks.groupid = vtiger_crmentityPriceBooks.smownerid"; |
|
| 295 | + $query .= " left join vtiger_groups as vtiger_groupsPriceBooks on vtiger_groupsPriceBooks.groupid = vtiger_crmentityPriceBooks.smownerid"; |
|
| 296 | 296 | } |
| 297 | 297 | if ($queryplanner->requireTable("vtiger_lastModifiedByPriceBooks")) { |
| 298 | - $query .=" left join vtiger_users as vtiger_lastModifiedByPriceBooks on vtiger_lastModifiedByPriceBooks.id = vtiger_crmentityPriceBooks.smownerid"; |
|
| 298 | + $query .= " left join vtiger_users as vtiger_lastModifiedByPriceBooks on vtiger_lastModifiedByPriceBooks.id = vtiger_crmentityPriceBooks.smownerid"; |
|
| 299 | 299 | } |
| 300 | 300 | if ($queryplanner->requireTable("vtiger_createdbyPriceBooks")) { |
| 301 | 301 | $query .= " left join vtiger_users as vtiger_createdbyPriceBooks on vtiger_createdbyPriceBooks.id = vtiger_crmentityPriceBooks.smcreatorid "; |
@@ -102,16 +102,18 @@ discard block |
||
| 102 | 102 | vtlib_setup_modulevars($related_module, $other); |
| 103 | 103 | $singular_modname = vtlib_toSingular($related_module); |
| 104 | 104 | |
| 105 | - if ($singlepane_view == 'true') |
|
| 106 | - $returnset = '&return_module=' . $this_module . '&return_action=DetailView&return_id=' . $id; |
|
| 107 | - else |
|
| 108 | - $returnset = '&return_module=' . $this_module . '&return_action=CallRelatedList&return_id=' . $id; |
|
| 105 | + if ($singlepane_view == 'true') { |
|
| 106 | + $returnset = '&return_module=' . $this_module . '&return_action=DetailView&return_id=' . $id; |
|
| 107 | + } else { |
|
| 108 | + $returnset = '&return_module=' . $this_module . '&return_action=CallRelatedList&return_id=' . $id; |
|
| 109 | + } |
|
| 109 | 110 | |
| 110 | 111 | $button = ''; |
| 111 | 112 | |
| 112 | 113 | if ($actions) { |
| 113 | - if (is_string($actions)) |
|
| 114 | - $actions = explode(',', strtoupper($actions)); |
|
| 114 | + if (is_string($actions)) { |
|
| 115 | + $actions = explode(',', strtoupper($actions)); |
|
| 116 | + } |
|
| 115 | 117 | if (in_array('SELECT', $actions) && isPermitted($related_module, 4, '') == 'yes') { |
| 116 | 118 | $button .= "<input title='" . \includes\Language::translate('LBL_SELECT') . " " . \includes\Language::translate($related_module) . "' class='crmbutton small edit' type='submit' name='button' onclick=\"this.form.action.value='AddProductsToPriceBook';this.form.module.value='$related_module';this.form.return_module.value='$currentModule';this.form.return_action.value='PriceBookDetailView'\" value='" . \includes\Language::translate('LBL_SELECT') . " " . \includes\Language::translate($related_module) . "'> "; |
| 117 | 119 | } |
@@ -131,8 +133,9 @@ discard block |
||
| 131 | 133 | $this->retrieve_entity_info($id, $this_module); |
| 132 | 134 | $return_value = getPriceBookRelatedProducts($query, $this, $returnset); |
| 133 | 135 | |
| 134 | - if ($return_value === null) |
|
| 135 | - $return_value = Array(); |
|
| 136 | + if ($return_value === null) { |
|
| 137 | + $return_value = Array(); |
|
| 138 | + } |
|
| 136 | 139 | $return_value['CUSTOM_BUTTON'] = $button; |
| 137 | 140 | |
| 138 | 141 | $log->debug("Exiting get_pricebook_products method ..."); |
@@ -158,16 +161,18 @@ discard block |
||
| 158 | 161 | vtlib_setup_modulevars($related_module, $other); |
| 159 | 162 | $singular_modname = vtlib_toSingular($related_module); |
| 160 | 163 | |
| 161 | - if ($singlepane_view == 'true') |
|
| 162 | - $returnset = '&return_module=' . $this_module . '&return_action=DetailView&return_id=' . $id; |
|
| 163 | - else |
|
| 164 | - $returnset = '&return_module=' . $this_module . '&return_action=CallRelatedList&return_id=' . $id; |
|
| 164 | + if ($singlepane_view == 'true') { |
|
| 165 | + $returnset = '&return_module=' . $this_module . '&return_action=DetailView&return_id=' . $id; |
|
| 166 | + } else { |
|
| 167 | + $returnset = '&return_module=' . $this_module . '&return_action=CallRelatedList&return_id=' . $id; |
|
| 168 | + } |
|
| 165 | 169 | |
| 166 | 170 | $button = ''; |
| 167 | 171 | |
| 168 | 172 | if ($actions) { |
| 169 | - if (is_string($actions)) |
|
| 170 | - $actions = explode(',', strtoupper($actions)); |
|
| 173 | + if (is_string($actions)) { |
|
| 174 | + $actions = explode(',', strtoupper($actions)); |
|
| 175 | + } |
|
| 171 | 176 | if (in_array('SELECT', $actions) && isPermitted($related_module, 4, '') == 'yes') { |
| 172 | 177 | $button .= "<input title='" . \includes\Language::translate('LBL_SELECT') . " " . \includes\Language::translate($related_module) . "' class='crmbutton small edit' type='submit' name='button' onclick=\"this.form.action.value='AddServicesToPriceBook';this.form.module.value='$related_module';this.form.return_module.value='$currentModule';this.form.return_action.value='PriceBookDetailView'\" value='" . \includes\Language::translate('LBL_SELECT') . " " . \includes\Language::translate($related_module) . "'> "; |
| 173 | 178 | } |
@@ -187,8 +192,9 @@ discard block |
||
| 187 | 192 | $this->retrieve_entity_info($id, $this_module); |
| 188 | 193 | $return_value = $other->getPriceBookRelatedServices($query, $this, $returnset); |
| 189 | 194 | |
| 190 | - if ($return_value === null) |
|
| 191 | - $return_value = Array(); |
|
| 195 | + if ($return_value === null) { |
|
| 196 | + $return_value = Array(); |
|
| 197 | + } |
|
| 192 | 198 | $return_value['CUSTOM_BUTTON'] = $button; |
| 193 | 199 | |
| 194 | 200 | $log->debug("Exiting get_pricebook_services method ..."); |
@@ -192,6 +192,9 @@ discard block |
||
| 192 | 192 | $this->db->pquery($query, $params); |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | + /** |
|
| 196 | + * @param string $module |
|
| 197 | + */ |
|
| 195 | 198 | public function insertIntoAttachment($id, $module) |
| 196 | 199 | { |
| 197 | 200 | $adb = PearDatabase::getInstance(); |
@@ -556,8 +559,6 @@ discard block |
||
| 556 | 559 | } |
| 557 | 560 | |
| 558 | 561 | /** function used to get the number of vendors which are related to the product |
| 559 | - * @param int $id - product id |
|
| 560 | - * @return int number of rows - return the number of products which do not have relationship with vendor |
|
| 561 | 562 | */ |
| 562 | 563 | public function product_novendor() |
| 563 | 564 | { |
@@ -202,10 +202,11 @@ discard block |
||
| 202 | 202 | foreach ($_FILES as $fileindex => $files) { |
| 203 | 203 | $fileInstance = \includes\fields\File::loadFromRequest($files); |
| 204 | 204 | if ($fileInstance->validate('image')) { |
| 205 | - if (AppRequest::get($fileindex . '_hidden') != '') |
|
| 206 | - $files['original_name'] = AppRequest::get($fileindex . '_hidden'); |
|
| 207 | - else |
|
| 208 | - $files['original_name'] = stripslashes($files['name']); |
|
| 205 | + if (AppRequest::get($fileindex . '_hidden') != '') { |
|
| 206 | + $files['original_name'] = AppRequest::get($fileindex . '_hidden'); |
|
| 207 | + } else { |
|
| 208 | + $files['original_name'] = stripslashes($files['name']); |
|
| 209 | + } |
|
| 209 | 210 | $files['original_name'] = str_replace('"', '', $files['original_name']); |
| 210 | 211 | $file_saved = $this->uploadAndSaveFile($id, $module, $files); |
| 211 | 212 | } |
@@ -261,16 +262,18 @@ discard block |
||
| 261 | 262 | vtlib_setup_modulevars($related_module, $other); |
| 262 | 263 | $singular_modname = vtlib_toSingular($related_module); |
| 263 | 264 | |
| 264 | - if ($singlepane_view == 'true') |
|
| 265 | - $returnset = '&return_module=' . $this_module . '&return_action=DetailView&return_id=' . $id; |
|
| 266 | - else |
|
| 267 | - $returnset = '&return_module=' . $this_module . '&return_action=CallRelatedList&return_id=' . $id; |
|
| 265 | + if ($singlepane_view == 'true') { |
|
| 266 | + $returnset = '&return_module=' . $this_module . '&return_action=DetailView&return_id=' . $id; |
|
| 267 | + } else { |
|
| 268 | + $returnset = '&return_module=' . $this_module . '&return_action=CallRelatedList&return_id=' . $id; |
|
| 269 | + } |
|
| 268 | 270 | |
| 269 | 271 | $button = ''; |
| 270 | 272 | |
| 271 | 273 | if ($actions) { |
| 272 | - if (is_string($actions)) |
|
| 273 | - $actions = explode(',', strtoupper($actions)); |
|
| 274 | + if (is_string($actions)) { |
|
| 275 | + $actions = explode(',', strtoupper($actions)); |
|
| 276 | + } |
|
| 274 | 277 | if (in_array('SELECT', $actions) && isPermitted($related_module, 4, '') == 'yes') { |
| 275 | 278 | $button .= "<input title='" . \includes\Language::translate('LBL_SELECT') . " " . \includes\Language::translate($related_module) . "' class='crmbutton small edit' type='button' onclick=\"return window.open('index.php?module=$related_module&return_module=$currentModule&action=Popup&popuptype=detailview&select=enable&form=EditView&form_submit=false&recordid=$id','test','width=640,height=602,resizable=0,scrollbars=0');\" value='" . \includes\Language::translate('LBL_SELECT') . " " . \includes\Language::translate($related_module) . "'> "; |
| 276 | 279 | } |
@@ -295,8 +298,9 @@ discard block |
||
| 295 | 298 | |
| 296 | 299 | $return_value = GetRelatedList($this_module, $related_module, $other, $query, $button, $returnset); |
| 297 | 300 | |
| 298 | - if ($return_value === null) |
|
| 299 | - $return_value = Array(); |
|
| 301 | + if ($return_value === null) { |
|
| 302 | + $return_value = Array(); |
|
| 303 | + } |
|
| 300 | 304 | $return_value['CUSTOM_BUTTON'] = $button; |
| 301 | 305 | |
| 302 | 306 | $log->debug("Exiting get_leads method ..."); |
@@ -322,16 +326,18 @@ discard block |
||
| 322 | 326 | vtlib_setup_modulevars($related_module, $other); |
| 323 | 327 | $singular_modname = vtlib_toSingular($related_module); |
| 324 | 328 | |
| 325 | - if ($singlepane_view == 'true') |
|
| 326 | - $returnset = '&return_module=' . $this_module . '&return_action=DetailView&return_id=' . $id; |
|
| 327 | - else |
|
| 328 | - $returnset = '&return_module=' . $this_module . '&return_action=CallRelatedList&return_id=' . $id; |
|
| 329 | + if ($singlepane_view == 'true') { |
|
| 330 | + $returnset = '&return_module=' . $this_module . '&return_action=DetailView&return_id=' . $id; |
|
| 331 | + } else { |
|
| 332 | + $returnset = '&return_module=' . $this_module . '&return_action=CallRelatedList&return_id=' . $id; |
|
| 333 | + } |
|
| 329 | 334 | |
| 330 | 335 | $button = ''; |
| 331 | 336 | |
| 332 | 337 | if ($actions) { |
| 333 | - if (is_string($actions)) |
|
| 334 | - $actions = explode(',', strtoupper($actions)); |
|
| 338 | + if (is_string($actions)) { |
|
| 339 | + $actions = explode(',', strtoupper($actions)); |
|
| 340 | + } |
|
| 335 | 341 | if (in_array('SELECT', $actions) && isPermitted($related_module, 4, '') == 'yes') { |
| 336 | 342 | $button .= "<input title='" . \includes\Language::translate('LBL_SELECT') . " " . \includes\Language::translate($related_module) . "' class='crmbutton small edit' type='button' onclick=\"return window.open('index.php?module=$related_module&return_module=$currentModule&action=Popup&popuptype=detailview&select=enable&form=EditView&form_submit=false&recordid=$id','test','width=640,height=602,resizable=0,scrollbars=0');\" value='" . \includes\Language::translate('LBL_SELECT') . " " . \includes\Language::translate($related_module) . "'> "; |
| 337 | 343 | } |
@@ -355,8 +361,9 @@ discard block |
||
| 355 | 361 | |
| 356 | 362 | $return_value = GetRelatedList($this_module, $related_module, $other, $query, $button, $returnset); |
| 357 | 363 | |
| 358 | - if ($return_value === null) |
|
| 359 | - $return_value = Array(); |
|
| 364 | + if ($return_value === null) { |
|
| 365 | + $return_value = Array(); |
|
| 366 | + } |
|
| 360 | 367 | $return_value['CUSTOM_BUTTON'] = $button; |
| 361 | 368 | |
| 362 | 369 | $log->debug("Exiting get_accounts method ..."); |
@@ -382,16 +389,18 @@ discard block |
||
| 382 | 389 | vtlib_setup_modulevars($related_module, $other); |
| 383 | 390 | $singular_modname = vtlib_toSingular($related_module); |
| 384 | 391 | |
| 385 | - if ($singlepane_view == 'true') |
|
| 386 | - $returnset = '&return_module=' . $this_module . '&return_action=DetailView&return_id=' . $id; |
|
| 387 | - else |
|
| 388 | - $returnset = '&return_module=' . $this_module . '&return_action=CallRelatedList&return_id=' . $id; |
|
| 392 | + if ($singlepane_view == 'true') { |
|
| 393 | + $returnset = '&return_module=' . $this_module . '&return_action=DetailView&return_id=' . $id; |
|
| 394 | + } else { |
|
| 395 | + $returnset = '&return_module=' . $this_module . '&return_action=CallRelatedList&return_id=' . $id; |
|
| 396 | + } |
|
| 389 | 397 | |
| 390 | 398 | $button = ''; |
| 391 | 399 | |
| 392 | 400 | if ($actions) { |
| 393 | - if (is_string($actions)) |
|
| 394 | - $actions = explode(',', strtoupper($actions)); |
|
| 401 | + if (is_string($actions)) { |
|
| 402 | + $actions = explode(',', strtoupper($actions)); |
|
| 403 | + } |
|
| 395 | 404 | if (in_array('SELECT', $actions) && isPermitted($related_module, 4, '') == 'yes') { |
| 396 | 405 | $button .= "<input title='" . \includes\Language::translate('LBL_SELECT') . " " . \includes\Language::translate($related_module) . "' class='crmbutton small edit' type='button' onclick=\"return window.open('index.php?module=$related_module&return_module=$currentModule&action=Popup&popuptype=detailview&select=enable&form=EditView&form_submit=false&recordid=$id','test','width=640,height=602,resizable=0,scrollbars=0');\" value='" . \includes\Language::translate('LBL_SELECT') . " " . \includes\Language::translate($related_module) . "'> "; |
| 397 | 406 | } |
@@ -418,8 +427,9 @@ discard block |
||
| 418 | 427 | |
| 419 | 428 | $return_value = GetRelatedList($this_module, $related_module, $other, $query, $button, $returnset); |
| 420 | 429 | |
| 421 | - if ($return_value === null) |
|
| 422 | - $return_value = Array(); |
|
| 430 | + if ($return_value === null) { |
|
| 431 | + $return_value = Array(); |
|
| 432 | + } |
|
| 423 | 433 | $return_value['CUSTOM_BUTTON'] = $button; |
| 424 | 434 | |
| 425 | 435 | $log->debug("Exiting get_contacts method ..."); |
@@ -445,16 +455,18 @@ discard block |
||
| 445 | 455 | vtlib_setup_modulevars($related_module, $other); |
| 446 | 456 | $singular_modname = vtlib_toSingular($related_module); |
| 447 | 457 | |
| 448 | - if ($singlepane_view == 'true') |
|
| 449 | - $returnset = '&return_module=' . $this_module . '&return_action=DetailView&return_id=' . $id; |
|
| 450 | - else |
|
| 451 | - $returnset = '&return_module=' . $this_module . '&return_action=CallRelatedList&return_id=' . $id; |
|
| 458 | + if ($singlepane_view == 'true') { |
|
| 459 | + $returnset = '&return_module=' . $this_module . '&return_action=DetailView&return_id=' . $id; |
|
| 460 | + } else { |
|
| 461 | + $returnset = '&return_module=' . $this_module . '&return_action=CallRelatedList&return_id=' . $id; |
|
| 462 | + } |
|
| 452 | 463 | |
| 453 | 464 | $button = ''; |
| 454 | 465 | |
| 455 | 466 | if ($actions && getFieldVisibilityPermission($related_module, $current_user->id, 'product_id', 'readwrite') == '0') { |
| 456 | - if (is_string($actions)) |
|
| 457 | - $actions = explode(',', strtoupper($actions)); |
|
| 467 | + if (is_string($actions)) { |
|
| 468 | + $actions = explode(',', strtoupper($actions)); |
|
| 469 | + } |
|
| 458 | 470 | if (in_array('SELECT', $actions) && isPermitted($related_module, 4, '') == 'yes') { |
| 459 | 471 | $button .= "<input title='" . \includes\Language::translate('LBL_SELECT') . " " . \includes\Language::translate($related_module) . "' class='crmbutton small edit' type='button' onclick=\"return window.open('index.php?module=$related_module&return_module=$currentModule&action=Popup&popuptype=detailview&select=enable&form=EditView&form_submit=false&recordid=$id','test','width=640,height=602,resizable=0,scrollbars=0');\" value='" . \includes\Language::translate('LBL_SELECT') . " " . \includes\Language::translate($related_module) . "'> "; |
| 460 | 472 | } |
@@ -491,8 +503,9 @@ discard block |
||
| 491 | 503 | |
| 492 | 504 | $return_value = GetRelatedList($this_module, $related_module, $other, $query, $button, $returnset); |
| 493 | 505 | |
| 494 | - if ($return_value === null) |
|
| 495 | - $return_value = Array(); |
|
| 506 | + if ($return_value === null) { |
|
| 507 | + $return_value = Array(); |
|
| 508 | + } |
|
| 496 | 509 | $return_value['CUSTOM_BUTTON'] = $button; |
| 497 | 510 | |
| 498 | 511 | $log->debug("Exiting get_tickets method ..."); |
@@ -517,8 +530,9 @@ discard block |
||
| 517 | 530 | |
| 518 | 531 | $button = ''; |
| 519 | 532 | if ($actions) { |
| 520 | - if (is_string($actions)) |
|
| 521 | - $actions = explode(',', strtoupper($actions)); |
|
| 533 | + if (is_string($actions)) { |
|
| 534 | + $actions = explode(',', strtoupper($actions)); |
|
| 535 | + } |
|
| 522 | 536 | if (in_array('ADD', $actions) && isPermitted($related_module, 1, '') == 'yes' && isPermitted($currentModule, 'EditView', $id) == 'yes') { |
| 523 | 537 | $button .= "<input title='" . \includes\Language::translate('LBL_ADD_TO') . " " . \includes\Language::translate($related_module) . "' class='crmbutton small create'" . |
| 524 | 538 | " onclick='this.form.action.value=\"AddProductToPriceBooks\";this.form.module.value=\"$currentModule\"' type='submit' name='button'" . |
@@ -526,10 +540,11 @@ discard block |
||
| 526 | 540 | } |
| 527 | 541 | } |
| 528 | 542 | |
| 529 | - if ($singlepane_view == 'true') |
|
| 530 | - $returnset = '&return_module=Products&return_action=DetailView&return_id=' . $id; |
|
| 531 | - else |
|
| 532 | - $returnset = '&return_module=Products&return_action=CallRelatedList&return_id=' . $id; |
|
| 543 | + if ($singlepane_view == 'true') { |
|
| 544 | + $returnset = '&return_module=Products&return_action=DetailView&return_id=' . $id; |
|
| 545 | + } else { |
|
| 546 | + $returnset = '&return_module=Products&return_action=CallRelatedList&return_id=' . $id; |
|
| 547 | + } |
|
| 533 | 548 | |
| 534 | 549 | |
| 535 | 550 | $query = sprintf('SELECT vtiger_crmentity.crmid, |
@@ -548,8 +563,9 @@ discard block |
||
| 548 | 563 | |
| 549 | 564 | $return_value = GetRelatedList($currentModule, $related_module, $focus, $query, $button, $returnset); |
| 550 | 565 | |
| 551 | - if ($return_value === null) |
|
| 552 | - $return_value = Array(); |
|
| 566 | + if ($return_value === null) { |
|
| 567 | + $return_value = Array(); |
|
| 568 | + } |
|
| 553 | 569 | $return_value['CUSTOM_BUTTON'] = $button; |
| 554 | 570 | |
| 555 | 571 | return $return_value; |
@@ -594,16 +610,18 @@ discard block |
||
| 594 | 610 | vtlib_setup_modulevars($related_module, $other); |
| 595 | 611 | $singular_modname = vtlib_toSingular($related_module); |
| 596 | 612 | |
| 597 | - if ($singlepane_view == 'true') |
|
| 598 | - $returnset = '&return_module=' . $this_module . '&return_action=DetailView&return_id=' . $id; |
|
| 599 | - else |
|
| 600 | - $returnset = '&return_module=' . $this_module . '&return_action=CallRelatedList&return_id=' . $id; |
|
| 613 | + if ($singlepane_view == 'true') { |
|
| 614 | + $returnset = '&return_module=' . $this_module . '&return_action=DetailView&return_id=' . $id; |
|
| 615 | + } else { |
|
| 616 | + $returnset = '&return_module=' . $this_module . '&return_action=CallRelatedList&return_id=' . $id; |
|
| 617 | + } |
|
| 601 | 618 | |
| 602 | 619 | $button = ''; |
| 603 | 620 | |
| 604 | 621 | if ($actions && $this->ismember_check() === 0) { |
| 605 | - if (is_string($actions)) |
|
| 606 | - $actions = explode(',', strtoupper($actions)); |
|
| 622 | + if (is_string($actions)) { |
|
| 623 | + $actions = explode(',', strtoupper($actions)); |
|
| 624 | + } |
|
| 607 | 625 | if (in_array('SELECT', $actions) && isPermitted($related_module, 4, '') == 'yes') { |
| 608 | 626 | $button .= "<input title='" . \includes\Language::translate('LBL_SELECT') . " " . \includes\Language::translate($related_module) . "' class='crmbutton small edit' type='button' onclick=\"return window.open('index.php?module=$related_module&return_module=$currentModule&action=Popup&popuptype=detailview&select=enable&form=EditView&form_submit=false&recordid=$id','test','width=640,height=602,resizable=0,scrollbars=0');\" value='" . \includes\Language::translate('LBL_SELECT') . " " . \includes\Language::translate($related_module) . "'> "; |
| 609 | 627 | } |
@@ -632,8 +650,9 @@ discard block |
||
| 632 | 650 | |
| 633 | 651 | $return_value = GetRelatedList($this_module, $related_module, $other, $query, $button, $returnset); |
| 634 | 652 | |
| 635 | - if ($return_value === null) |
|
| 636 | - $return_value = Array(); |
|
| 653 | + if ($return_value === null) { |
|
| 654 | + $return_value = Array(); |
|
| 655 | + } |
|
| 637 | 656 | $return_value['CUSTOM_BUTTON'] = $button; |
| 638 | 657 | |
| 639 | 658 | $log->debug("Exiting get_products method ..."); |
@@ -658,10 +677,11 @@ discard block |
||
| 658 | 677 | if (isPermitted("Products", 1, "") == 'yes') { |
| 659 | 678 | $button .= '<input title="' . \includes\Language::translate('LBL_NEW_PRODUCT') . '" accessyKey="F" class="button" onclick="this.form.action.value=\'EditView\';this.form.module.value=\'Products\';this.form.return_module.value=\'Products\';this.form.return_action.value=\'DetailView\'" type="submit" name="button" value="' . \includes\Language::translate('LBL_NEW_PRODUCT') . '"> '; |
| 660 | 679 | } |
| 661 | - if ($singlepane_view == 'true') |
|
| 662 | - $returnset = '&return_module=Products&return_action=DetailView&is_parent=1&return_id=' . $id; |
|
| 663 | - else |
|
| 664 | - $returnset = '&return_module=Products&return_action=CallRelatedList&is_parent=1&return_id=' . $id; |
|
| 680 | + if ($singlepane_view == 'true') { |
|
| 681 | + $returnset = '&return_module=Products&return_action=DetailView&is_parent=1&return_id=' . $id; |
|
| 682 | + } else { |
|
| 683 | + $returnset = '&return_module=Products&return_action=CallRelatedList&is_parent=1&return_id=' . $id; |
|
| 684 | + } |
|
| 665 | 685 | |
| 666 | 686 | $query = "SELECT vtiger_products.productid, vtiger_products.productname, |
| 667 | 687 | vtiger_products.productcode, vtiger_products.commissionrate, |
@@ -707,10 +727,11 @@ discard block |
||
| 707 | 727 | $query .= $this->getNonAdminAccessControlQuery('Products', $current_user); |
| 708 | 728 | $where_auto = " vtiger_crmentity.deleted=0"; |
| 709 | 729 | |
| 710 | - if ($where != '') |
|
| 711 | - $query .= " WHERE ($where) && $where_auto"; |
|
| 712 | - else |
|
| 713 | - $query .= " WHERE $where_auto"; |
|
| 730 | + if ($where != '') { |
|
| 731 | + $query .= " WHERE ($where) && $where_auto"; |
|
| 732 | + } else { |
|
| 733 | + $query .= " WHERE $where_auto"; |
|
| 734 | + } |
|
| 714 | 735 | |
| 715 | 736 | $log->debug("Exiting create_export_query method ..."); |
| 716 | 737 | return $query; |
@@ -895,8 +916,9 @@ discard block |
||
| 895 | 916 | public function unlinkRelationship($id, $return_module, $return_id, $relatedName = false) |
| 896 | 917 | { |
| 897 | 918 | $log = vglobal('log'); |
| 898 | - if (empty($return_module) || empty($return_id)) |
|
| 899 | - return; |
|
| 919 | + if (empty($return_module) || empty($return_id)) { |
|
| 920 | + return; |
|
| 921 | + } |
|
| 900 | 922 | |
| 901 | 923 | if ($return_module == 'Leads' || $return_module == 'Contacts') { |
| 902 | 924 | $sql = 'DELETE FROM vtiger_seproductsrel WHERE productid = ? && crmid = ?'; |
@@ -918,8 +940,9 @@ discard block |
||
| 918 | 940 | $db = PearDatabase::getInstance(); |
| 919 | 941 | $currentUser = Users_Record_Model::getCurrentUserModel(); |
| 920 | 942 | |
| 921 | - if (!is_array($with_crmids)) |
|
| 922 | - $with_crmids = Array($with_crmids); |
|
| 943 | + if (!is_array($with_crmids)) { |
|
| 944 | + $with_crmids = Array($with_crmids); |
|
| 945 | + } |
|
| 923 | 946 | foreach ($with_crmids as $with_crmid) { |
| 924 | 947 | if ($with_module == 'Leads' || $with_module == 'Accounts' || |
| 925 | 948 | $with_module == 'Contacts' || $with_module == 'Products') { |
@@ -103,6 +103,9 @@ discard block |
||
| 103 | 103 | $this->customTables[] = $table; |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | + /** |
|
| 107 | + * @param ReportRunQueryDependencyMatrix $dependencies |
|
| 108 | + */ |
|
| 106 | 109 | public function requireTable($table, $dependencies = null) |
| 107 | 110 | { |
| 108 | 111 | |
@@ -782,6 +785,7 @@ discard block |
||
| 782 | 785 | /** Function to get field that is to be compared in query form for the given Comparator and field |
| 783 | 786 | * @ param $field : field |
| 784 | 787 | * returns the value for the comparator |
| 788 | + * @param string $field |
|
| 785 | 789 | */ |
| 786 | 790 | public function getFilterComparedField($field) |
| 787 | 791 | { |
@@ -2308,6 +2312,11 @@ discard block |
||
| 2308 | 2312 | * HTML strings for |
| 2309 | 2313 | */ |
| 2310 | 2314 | // Performance Optimization: Added parameter directOutput to avoid building big-string! |
| 2315 | + |
|
| 2316 | + /** |
|
| 2317 | + * @param string $outputformat |
|
| 2318 | + * @param string $filtersql |
|
| 2319 | + */ |
|
| 2311 | 2320 | public function GenerateReport($outputformat, $filtersql, $directOutput = false, $startLimit = false, $endLimit = false) |
| 2312 | 2321 | { |
| 2313 | 2322 | $adb = PearDatabase::getInstance(); |
@@ -863,7 +863,7 @@ discard block |
||
| 863 | 863 | inner join vtiger_relcriteria on vtiger_relcriteria.queryid = vtiger_report.queryid |
| 864 | 864 | left join vtiger_relcriteria_grouping on vtiger_relcriteria.queryid = vtiger_relcriteria_grouping.queryid |
| 865 | 865 | and vtiger_relcriteria.groupid = vtiger_relcriteria_grouping.groupid'; |
| 866 | - $ssql.= " where vtiger_report.reportid = ? && vtiger_relcriteria.groupid = ? order by vtiger_relcriteria.columnindex"; |
|
| 866 | + $ssql .= " where vtiger_report.reportid = ? && vtiger_relcriteria.groupid = ? order by vtiger_relcriteria.columnindex"; |
|
| 867 | 867 | |
| 868 | 868 | $result = $adb->pquery($ssql, array($reportid, $groupId)); |
| 869 | 869 | $noOfColumns = $adb->num_rows($result); |
@@ -1007,7 +1007,7 @@ discard block |
||
| 1007 | 1007 | $advfiltergroupsql .= "$tableColumnSql BETWEEN $start AND $end"; |
| 1008 | 1008 | else |
| 1009 | 1009 | $advfiltergroupsql .= "$tableColumnSql NOT BETWEEN $start AND $end"; |
| 1010 | - }else if ($comparator == 'bw') { |
|
| 1010 | + } else if ($comparator == 'bw') { |
|
| 1011 | 1011 | $values = explode(',', $value); |
| 1012 | 1012 | $startDateTime = explode(' ', $values[0]); |
| 1013 | 1013 | $endDateTime = explode(' ', $values[1]); |
@@ -1437,7 +1437,7 @@ discard block |
||
| 1437 | 1437 | } |
| 1438 | 1438 | |
| 1439 | 1439 | $temp_val = explode(",", $adv_filter_value); |
| 1440 | - if (($column_info[4] == 'D' || ($column_info[4] == 'T' && $column_info[1] != 'time_start' && $column_info[1] != 'time_end') || ($column_info[4] == 'DT')) && ($column_info[4] != '' && $adv_filter_value != '' )) { |
|
| 1440 | + if (($column_info[4] == 'D' || ($column_info[4] == 'T' && $column_info[1] != 'time_start' && $column_info[1] != 'time_end') || ($column_info[4] == 'DT')) && ($column_info[4] != '' && $adv_filter_value != '')) { |
|
| 1441 | 1441 | $val = Array(); |
| 1442 | 1442 | for ($x = 0; $x < count($temp_val); $x++) { |
| 1443 | 1443 | if ($column_info[4] == 'D') { |
@@ -1800,7 +1800,7 @@ discard block |
||
| 1800 | 1800 | $current_user = vglobal('current_user'); |
| 1801 | 1801 | $secondary_module = "'"; |
| 1802 | 1802 | $secondary_module .= str_replace(":", "','", $this->secondarymodule); |
| 1803 | - $secondary_module .="'"; |
|
| 1803 | + $secondary_module .= "'"; |
|
| 1804 | 1804 | |
| 1805 | 1805 | if ($module == "Leads") { |
| 1806 | 1806 | $query = "from vtiger_leaddetails |
@@ -1864,7 +1864,7 @@ discard block |
||
| 1864 | 1864 | left join vtiger_users on vtiger_users.id = vtiger_crmentity.smownerid"; |
| 1865 | 1865 | |
| 1866 | 1866 | if ($this->queryPlanner->requireTable('vtiger_lastModifiedByAccounts')) { |
| 1867 | - $query.= " left join vtiger_users as vtiger_lastModifiedByAccounts on vtiger_lastModifiedByAccounts.id = vtiger_crmentity.modifiedby"; |
|
| 1867 | + $query .= " left join vtiger_users as vtiger_lastModifiedByAccounts on vtiger_lastModifiedByAccounts.id = vtiger_crmentity.modifiedby"; |
|
| 1868 | 1868 | } |
| 1869 | 1869 | if ($this->queryPlanner->requireTable('vtiger_createdbyAccounts')) { |
| 1870 | 1870 | $query .= " left join vtiger_users as vtiger_createdbyAccounts on vtiger_createdbyAccounts.id = vtiger_crmentity.smcreatorid"; |
@@ -2658,7 +2658,7 @@ discard block |
||
| 2658 | 2658 | else |
| 2659 | 2659 | $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
| 2660 | 2660 | $totalpdf[$rowcount][$arraykey] = $conv_value; |
| 2661 | - }else { |
|
| 2661 | + } else { |
|
| 2662 | 2662 | $totalpdf[$rowcount][$arraykey] = ''; |
| 2663 | 2663 | } |
| 2664 | 2664 | |
@@ -2669,7 +2669,7 @@ discard block |
||
| 2669 | 2669 | else |
| 2670 | 2670 | $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
| 2671 | 2671 | $totalpdf[$rowcount][$arraykey] = $conv_value; |
| 2672 | - }else { |
|
| 2672 | + } else { |
|
| 2673 | 2673 | $totalpdf[$rowcount][$arraykey] = ''; |
| 2674 | 2674 | } |
| 2675 | 2675 | |
@@ -2680,7 +2680,7 @@ discard block |
||
| 2680 | 2680 | else |
| 2681 | 2681 | $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
| 2682 | 2682 | $totalpdf[$rowcount][$arraykey] = $conv_value; |
| 2683 | - }else { |
|
| 2683 | + } else { |
|
| 2684 | 2684 | $totalpdf[$rowcount][$arraykey] = ''; |
| 2685 | 2685 | } |
| 2686 | 2686 | |
@@ -2691,7 +2691,7 @@ discard block |
||
| 2691 | 2691 | else |
| 2692 | 2692 | $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
| 2693 | 2693 | $totalpdf[$rowcount][$arraykey] = $conv_value; |
| 2694 | - }else { |
|
| 2694 | + } else { |
|
| 2695 | 2695 | $totalpdf[$rowcount][$arraykey] = ''; |
| 2696 | 2696 | } |
| 2697 | 2697 | $rowcount++; |
@@ -2770,7 +2770,7 @@ discard block |
||
| 2770 | 2770 | else |
| 2771 | 2771 | $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
| 2772 | 2772 | $coltotalhtml .= '<td class="rptTotal">' . $conv_value . '</td>'; |
| 2773 | - }else { |
|
| 2773 | + } else { |
|
| 2774 | 2774 | $coltotalhtml .= '<td class="rptTotal"> </td>'; |
| 2775 | 2775 | } |
| 2776 | 2776 | |
@@ -2781,7 +2781,7 @@ discard block |
||
| 2781 | 2781 | else |
| 2782 | 2782 | $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
| 2783 | 2783 | $coltotalhtml .= '<td class="rptTotal">' . $conv_value . '</td>'; |
| 2784 | - }else { |
|
| 2784 | + } else { |
|
| 2785 | 2785 | $coltotalhtml .= '<td class="rptTotal"> </td>'; |
| 2786 | 2786 | } |
| 2787 | 2787 | |
@@ -2792,7 +2792,7 @@ discard block |
||
| 2792 | 2792 | else |
| 2793 | 2793 | $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
| 2794 | 2794 | $coltotalhtml .= '<td class="rptTotal">' . $conv_value . '</td>'; |
| 2795 | - }else { |
|
| 2795 | + } else { |
|
| 2796 | 2796 | $coltotalhtml .= '<td class="rptTotal"> </td>'; |
| 2797 | 2797 | } |
| 2798 | 2798 | |
@@ -2803,7 +2803,7 @@ discard block |
||
| 2803 | 2803 | else |
| 2804 | 2804 | $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
| 2805 | 2805 | $coltotalhtml .= '<td class="rptTotal">' . $conv_value . '</td>'; |
| 2806 | - }else { |
|
| 2806 | + } else { |
|
| 2807 | 2807 | $coltotalhtml .= '<td class="rptTotal"> </td>'; |
| 2808 | 2808 | } |
| 2809 | 2809 | |
@@ -2975,7 +2975,7 @@ discard block |
||
| 2975 | 2975 | else |
| 2976 | 2976 | $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
| 2977 | 2977 | $coltotalhtml .= "<td class='rptTotal'>" . $conv_value . '</td>'; |
| 2978 | - }else { |
|
| 2978 | + } else { |
|
| 2979 | 2979 | $coltotalhtml .= "<td class='rptTotal'> </td>"; |
| 2980 | 2980 | } |
| 2981 | 2981 | |
@@ -2986,7 +2986,7 @@ discard block |
||
| 2986 | 2986 | else |
| 2987 | 2987 | $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
| 2988 | 2988 | $coltotalhtml .= "<td class='rptTotal'>" . $conv_value . '</td>'; |
| 2989 | - }else { |
|
| 2989 | + } else { |
|
| 2990 | 2990 | $coltotalhtml .= "<td class='rptTotal'> </td>"; |
| 2991 | 2991 | } |
| 2992 | 2992 | |
@@ -2997,7 +2997,7 @@ discard block |
||
| 2997 | 2997 | else |
| 2998 | 2998 | $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
| 2999 | 2999 | $coltotalhtml .= "<td class='rptTotal'>" . $conv_value . '</td>'; |
| 3000 | - }else { |
|
| 3000 | + } else { |
|
| 3001 | 3001 | $coltotalhtml .= "<td class='rptTotal'> </td>"; |
| 3002 | 3002 | } |
| 3003 | 3003 | |
@@ -3008,7 +3008,7 @@ discard block |
||
| 3008 | 3008 | else |
| 3009 | 3009 | $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
| 3010 | 3010 | $coltotalhtml .= "<td class='rptTotal'>" . $conv_value . '</td>'; |
| 3011 | - }else { |
|
| 3011 | + } else { |
|
| 3012 | 3012 | $coltotalhtml .= "<td class='rptTotal'> </td>"; |
| 3013 | 3013 | } |
| 3014 | 3014 | |
@@ -3250,7 +3250,7 @@ discard block |
||
| 3250 | 3250 | if ($fieldInfo['uitype'] == '71') { |
| 3251 | 3251 | $curr_symb = " (" . \includes\Language::translate('LBL_IN') . " " . $current_user->currency_symbol . ")"; |
| 3252 | 3252 | } |
| 3253 | - $rep_header .=$curr_symb; |
|
| 3253 | + $rep_header .= $curr_symb; |
|
| 3254 | 3254 | |
| 3255 | 3255 | return $rep_header; |
| 3256 | 3256 | } |
@@ -3367,7 +3367,7 @@ discard block |
||
| 3367 | 3367 | $rowcount = 1; |
| 3368 | 3368 | //copy the first value details |
| 3369 | 3369 | $arrayFirstRowValues = $arr_val[0]; |
| 3370 | - array_pop($arrayFirstRowValues); // removed action link in details |
|
| 3370 | + array_pop($arrayFirstRowValues); // removed action link in details |
|
| 3371 | 3371 | foreach ($arrayFirstRowValues as $key => $value) { |
| 3372 | 3372 | $worksheet->setCellValueExplicitByColumnAndRow($count, $rowcount, $key, true); |
| 3373 | 3373 | $worksheet->getStyleByColumnAndRow($count, $rowcount)->applyFromArray($header_styles); |
@@ -3434,7 +3434,7 @@ discard block |
||
| 3434 | 3434 | if (isset($arr_val)) { |
| 3435 | 3435 | // Header |
| 3436 | 3436 | $csv_values = array_keys($arr_val[0]); |
| 3437 | - array_pop($csv_values); //removed header in csv file |
|
| 3437 | + array_pop($csv_values); //removed header in csv file |
|
| 3438 | 3438 | fputcsv($fp, $csv_values); |
| 3439 | 3439 | foreach ($arr_val as $key => $array_value) { |
| 3440 | 3440 | array_pop($array_value); //removed action link |
@@ -54,8 +54,9 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | protected function computeDependencies() |
| 56 | 56 | { |
| 57 | - if ($this->computedMatrix !== null) |
|
| 58 | - return; |
|
| 57 | + if ($this->computedMatrix !== null) { |
|
| 58 | + return; |
|
| 59 | + } |
|
| 59 | 60 | |
| 60 | 61 | $this->computedMatrix = array(); |
| 61 | 62 | foreach ($this->matrix as $key => $values) { |
@@ -94,8 +95,9 @@ discard block |
||
| 94 | 95 | |
| 95 | 96 | public function addTable($table) |
| 96 | 97 | { |
| 97 | - if (!empty($table)) |
|
| 98 | - $this->tables[$table] = $table; |
|
| 98 | + if (!empty($table)) { |
|
| 99 | + $this->tables[$table] = $table; |
|
| 100 | + } |
|
| 99 | 101 | } |
| 100 | 102 | |
| 101 | 103 | public function addCustomTable($table) |
@@ -599,8 +601,9 @@ discard block |
||
| 599 | 601 | $access_fields[] = $collistrow["fieldname"]; |
| 600 | 602 | } |
| 601 | 603 | //added to include ticketid for Reports module in select columnlist for all users |
| 602 | - if ($module == "HelpDesk") |
|
| 603 | - $access_fields[] = "ticketid"; |
|
| 604 | + if ($module == "HelpDesk") { |
|
| 605 | + $access_fields[] = "ticketid"; |
|
| 606 | + } |
|
| 604 | 607 | return $access_fields; |
| 605 | 608 | } |
| 606 | 609 | |
@@ -675,8 +678,9 @@ discard block |
||
| 675 | 678 | } |
| 676 | 679 | if ($ordercolumnsequal) { |
| 677 | 680 | $selectedfields = explode(":", $fieldcolname); |
| 678 | - if ($selectedfields[0] == "vtiger_crmentity" . $this->primarymodule) |
|
| 679 | - $selectedfields[0] = "vtiger_crmentity"; |
|
| 681 | + if ($selectedfields[0] == "vtiger_crmentity" . $this->primarymodule) { |
|
| 682 | + $selectedfields[0] = "vtiger_crmentity"; |
|
| 683 | + } |
|
| 680 | 684 | $sSQLList[] = $selectedfields[0] . "." . $selectedfields[1] . " '" . $selectedfields[2] . "'"; |
| 681 | 685 | } |
| 682 | 686 | } |
@@ -728,11 +732,12 @@ discard block |
||
| 728 | 732 | if (trim($value) == "NULL") { |
| 729 | 733 | $rtvalue = " is NOT NULL"; |
| 730 | 734 | } elseif (trim($value) != "") { |
| 731 | - if ($columnName) |
|
| 732 | - $rtvalue = " <> " . $adb->quote($value) . " || " . $columnName . " IS NULL "; |
|
| 733 | - else |
|
| 734 | - $rtvalue = " <> " . $adb->quote($value); |
|
| 735 | - }elseif (trim($value) == "" && $datatype == "V") { |
|
| 735 | + if ($columnName) { |
|
| 736 | + $rtvalue = " <> " . $adb->quote($value) . " || " . $columnName . " IS NULL "; |
|
| 737 | + } else { |
|
| 738 | + $rtvalue = " <> " . $adb->quote($value); |
|
| 739 | + } |
|
| 740 | + } elseif (trim($value) == "" && $datatype == "V") { |
|
| 736 | 741 | $rtvalue = " <> " . $adb->quote($value); |
| 737 | 742 | } else { |
| 738 | 743 | $rtvalue = " is NOT NULL"; |
@@ -864,8 +869,9 @@ discard block |
||
| 864 | 869 | |
| 865 | 870 | $result = $adb->pquery($ssql, array($reportid, $groupId)); |
| 866 | 871 | $noOfColumns = $adb->num_rows($result); |
| 867 | - if ($noOfColumns <= 0) |
|
| 868 | - continue; |
|
| 872 | + if ($noOfColumns <= 0) { |
|
| 873 | + continue; |
|
| 874 | + } |
|
| 869 | 875 | |
| 870 | 876 | while ($relcriteriarow = $adb->fetch_array($result)) { |
| 871 | 877 | $columnIndex = $relcriteriarow["columnindex"]; |
@@ -889,8 +895,9 @@ discard block |
||
| 889 | 895 | $i++; |
| 890 | 896 | } |
| 891 | 897 | // Clear the condition (and/or) for last group, if any. |
| 892 | - if (!empty($advft_criteria[$i - 1]['condition'])) |
|
| 893 | - $advft_criteria[$i - 1]['condition'] = ''; |
|
| 898 | + if (!empty($advft_criteria[$i - 1]['condition'])) { |
|
| 899 | + $advft_criteria[$i - 1]['condition'] = ''; |
|
| 900 | + } |
|
| 894 | 901 | return $advft_criteria; |
| 895 | 902 | } |
| 896 | 903 | |
@@ -1000,11 +1007,12 @@ discard block |
||
| 1000 | 1007 | $end = getValidDBInsertDateTimeValue($date2); |
| 1001 | 1008 | $start = "'$start'"; |
| 1002 | 1009 | $end = "'$end'"; |
| 1003 | - if ($comparator == 'e') |
|
| 1004 | - $advfiltergroupsql .= "$tableColumnSql BETWEEN $start AND $end"; |
|
| 1005 | - else |
|
| 1006 | - $advfiltergroupsql .= "$tableColumnSql NOT BETWEEN $start AND $end"; |
|
| 1007 | - }else if ($comparator == 'bw') { |
|
| 1010 | + if ($comparator == 'e') { |
|
| 1011 | + $advfiltergroupsql .= "$tableColumnSql BETWEEN $start AND $end"; |
|
| 1012 | + } else { |
|
| 1013 | + $advfiltergroupsql .= "$tableColumnSql NOT BETWEEN $start AND $end"; |
|
| 1014 | + } |
|
| 1015 | + } else if ($comparator == 'bw') { |
|
| 1008 | 1016 | $values = explode(',', $value); |
| 1009 | 1017 | $startDateTime = explode(' ', $values[0]); |
| 1010 | 1018 | $endDateTime = explode(' ', $values[1]); |
@@ -1056,10 +1064,12 @@ discard block |
||
| 1056 | 1064 | } |
| 1057 | 1065 | //Added to handle yes or no for checkbox field in reports advance filters. -shahul |
| 1058 | 1066 | if ($selectedfields[4] == 'C') { |
| 1059 | - if (strcasecmp(trim($value), "yes") == 0) |
|
| 1060 | - $value = "1"; |
|
| 1061 | - if (strcasecmp(trim($value), "no") == 0) |
|
| 1062 | - $value = "0"; |
|
| 1067 | + if (strcasecmp(trim($value), "yes") == 0) { |
|
| 1068 | + $value = "1"; |
|
| 1069 | + } |
|
| 1070 | + if (strcasecmp(trim($value), "no") == 0) { |
|
| 1071 | + $value = "0"; |
|
| 1072 | + } |
|
| 1063 | 1073 | } |
| 1064 | 1074 | if (in_array($comparator, $dateSpecificConditions)) { |
| 1065 | 1075 | $customView = new CustomView($moduleName); |
@@ -1100,13 +1110,15 @@ discard block |
||
| 1100 | 1110 | $advcolsql[] = "vtiger_troubletickets.status" . $this->getAdvComparator($comparator, trim($valuearray[$n]), $datatype); |
| 1101 | 1111 | } else if ($selectedfields[2] == 'Faq_Status') { |
| 1102 | 1112 | $advcolsql[] = "vtiger_faq.status" . $this->getAdvComparator($comparator, trim($valuearray[$n]), $datatype); |
| 1103 | - } else |
|
| 1104 | - $advcolsql[] = $selectedfields[0] . "." . $selectedfields[1] . $this->getAdvComparator($comparator, trim($valuearray[$n]), $datatype); |
|
| 1113 | + } else { |
|
| 1114 | + $advcolsql[] = $selectedfields[0] . "." . $selectedfields[1] . $this->getAdvComparator($comparator, trim($valuearray[$n]), $datatype); |
|
| 1115 | + } |
|
| 1105 | 1116 | } elseif ($selectedfields[1] == 'description') {//when you use comma seperated values. |
| 1106 | - if ($selectedfields[0] == 'vtiger_crmentity' . $this->primarymodule) |
|
| 1107 | - $advcolsql[] = "vtiger_crmentity.description" . $this->getAdvComparator($comparator, trim($valuearray[$n]), $datatype); |
|
| 1108 | - else |
|
| 1109 | - $advcolsql[] = $selectedfields[0] . "." . $selectedfields[1] . $this->getAdvComparator($comparator, trim($valuearray[$n]), $datatype); |
|
| 1117 | + if ($selectedfields[0] == 'vtiger_crmentity' . $this->primarymodule) { |
|
| 1118 | + $advcolsql[] = "vtiger_crmentity.description" . $this->getAdvComparator($comparator, trim($valuearray[$n]), $datatype); |
|
| 1119 | + } else { |
|
| 1120 | + $advcolsql[] = $selectedfields[0] . "." . $selectedfields[1] . $this->getAdvComparator($comparator, trim($valuearray[$n]), $datatype); |
|
| 1121 | + } |
|
| 1110 | 1122 | } elseif ($selectedfields[2] == 'Quotes_Inventory_Manager') { |
| 1111 | 1123 | $advcolsql[] = ("trim($concatSql)" . $this->getAdvComparator($comparator, trim($valuearray[$n]), $datatype)); |
| 1112 | 1124 | } elseif ($selectedfields[1] == 'modifiedby') { |
@@ -1123,10 +1135,11 @@ discard block |
||
| 1123 | 1135 | } |
| 1124 | 1136 | } |
| 1125 | 1137 | //If negative logic filter ('not equal to', 'does not contain') is used, 'and' condition should be applied instead of 'or' |
| 1126 | - if ($comparator == 'n' || $comparator == 'k') |
|
| 1127 | - $advcolumnsql = implode(" and ", $advcolsql); |
|
| 1128 | - else |
|
| 1129 | - $advcolumnsql = implode(" or ", $advcolsql); |
|
| 1138 | + if ($comparator == 'n' || $comparator == 'k') { |
|
| 1139 | + $advcolumnsql = implode(" and ", $advcolsql); |
|
| 1140 | + } else { |
|
| 1141 | + $advcolumnsql = implode(" or ", $advcolsql); |
|
| 1142 | + } |
|
| 1130 | 1143 | $fieldvalue = " (" . $advcolumnsql . ") "; |
| 1131 | 1144 | } elseif ($selectedfields[1] == 'user_name') { |
| 1132 | 1145 | if ($selectedfields[0] == "vtiger_users" . $this->primarymodule) { |
@@ -1186,18 +1199,20 @@ discard block |
||
| 1186 | 1199 | $fieldvalue = "vtiger_activity.status" . $this->getAdvComparator($comparator, trim($value), $datatype); |
| 1187 | 1200 | } |
| 1188 | 1201 | } else if ($comparator == 'ny') { |
| 1189 | - if ($fieldInfo['uitype'] == '10' || isReferenceUIType($fieldInfo['uitype'])) |
|
| 1190 | - $fieldvalue = "(" . $selectedfields[0] . "." . $selectedfields[1] . " IS NOT NULL && " . $selectedfields[0] . "." . $selectedfields[1] . " != '' && " . $selectedfields[0] . "." . $selectedfields[1] . " != '0')"; |
|
| 1191 | - else |
|
| 1192 | - $fieldvalue = "(" . $selectedfields[0] . "." . $selectedfields[1] . " IS NOT NULL && " . $selectedfields[0] . "." . $selectedfields[1] . " != '')"; |
|
| 1193 | - }elseif ($comparator == 'y' || ($comparator == 'e' && (trim($value) == "NULL" || trim($value) == ''))) { |
|
| 1202 | + if ($fieldInfo['uitype'] == '10' || isReferenceUIType($fieldInfo['uitype'])) { |
|
| 1203 | + $fieldvalue = "(" . $selectedfields[0] . "." . $selectedfields[1] . " IS NOT NULL && " . $selectedfields[0] . "." . $selectedfields[1] . " != '' && " . $selectedfields[0] . "." . $selectedfields[1] . " != '0')"; |
|
| 1204 | + } else { |
|
| 1205 | + $fieldvalue = "(" . $selectedfields[0] . "." . $selectedfields[1] . " IS NOT NULL && " . $selectedfields[0] . "." . $selectedfields[1] . " != '')"; |
|
| 1206 | + } |
|
| 1207 | + } elseif ($comparator == 'y' || ($comparator == 'e' && (trim($value) == "NULL" || trim($value) == ''))) { |
|
| 1194 | 1208 | if ($selectedfields[0] == 'vtiger_inventoryproductrel') { |
| 1195 | 1209 | $selectedfields[0] = 'vtiger_inventoryproductrel' . $moduleName; |
| 1196 | 1210 | } |
| 1197 | - if ($fieldInfo['uitype'] == '10' || isReferenceUIType($fieldInfo['uitype'])) |
|
| 1198 | - $fieldvalue = "(" . $selectedfields[0] . "." . $selectedfields[1] . " IS NULL || " . $selectedfields[0] . "." . $selectedfields[1] . " = '' || " . $selectedfields[0] . "." . $selectedfields[1] . " = '0')"; |
|
| 1199 | - else |
|
| 1200 | - $fieldvalue = "(" . $selectedfields[0] . "." . $selectedfields[1] . " IS NULL || " . $selectedfields[0] . "." . $selectedfields[1] . " = '')"; |
|
| 1211 | + if ($fieldInfo['uitype'] == '10' || isReferenceUIType($fieldInfo['uitype'])) { |
|
| 1212 | + $fieldvalue = "(" . $selectedfields[0] . "." . $selectedfields[1] . " IS NULL || " . $selectedfields[0] . "." . $selectedfields[1] . " = '' || " . $selectedfields[0] . "." . $selectedfields[1] . " = '0')"; |
|
| 1213 | + } else { |
|
| 1214 | + $fieldvalue = "(" . $selectedfields[0] . "." . $selectedfields[1] . " IS NULL || " . $selectedfields[0] . "." . $selectedfields[1] . " = '')"; |
|
| 1215 | + } |
|
| 1201 | 1216 | } elseif ($selectedfields[0] == 'vtiger_inventoryproductrel') { |
| 1202 | 1217 | if ($selectedfields[1] == 'productid') { |
| 1203 | 1218 | $fieldvalue = "vtiger_products$moduleName.productname " . $this->getAdvComparator($comparator, trim($value), $datatype); |
@@ -1243,8 +1258,9 @@ discard block |
||
| 1243 | 1258 | } |
| 1244 | 1259 | } |
| 1245 | 1260 | } |
| 1246 | - if (trim($advfiltersql) != "") |
|
| 1247 | - $advfiltersql = '(' . $advfiltersql . ')'; |
|
| 1261 | + if (trim($advfiltersql) != "") { |
|
| 1262 | + $advfiltersql = '(' . $advfiltersql . ')'; |
|
| 1263 | + } |
|
| 1248 | 1264 | |
| 1249 | 1265 | return $advfiltersql; |
| 1250 | 1266 | } |
@@ -1299,8 +1315,9 @@ discard block |
||
| 1299 | 1315 | |
| 1300 | 1316 | if ($fieldcolname != "none") { |
| 1301 | 1317 | $selectedfields = explode(":", $fieldcolname); |
| 1302 | - if ($selectedfields[0] == "vtiger_crmentity" . $this->primarymodule) |
|
| 1303 | - $selectedfields[0] = "vtiger_crmentity"; |
|
| 1318 | + if ($selectedfields[0] == "vtiger_crmentity" . $this->primarymodule) { |
|
| 1319 | + $selectedfields[0] = "vtiger_crmentity"; |
|
| 1320 | + } |
|
| 1304 | 1321 | |
| 1305 | 1322 | $moduleFieldLabel = $selectedfields[3]; |
| 1306 | 1323 | list($moduleName, $fieldLabel) = explode('__', $moduleFieldLabel, 2); |
@@ -1369,8 +1386,9 @@ discard block |
||
| 1369 | 1386 | { |
| 1370 | 1387 | if ($filtercolumn != "none") { |
| 1371 | 1388 | $selectedfields = explode(":", $filtercolumn); |
| 1372 | - if ($selectedfields[0] == "vtiger_crmentity" . $this->primarymodule) |
|
| 1373 | - $selectedfields[0] = "vtiger_crmentity"; |
|
| 1389 | + if ($selectedfields[0] == "vtiger_crmentity" . $this->primarymodule) { |
|
| 1390 | + $selectedfields[0] = "vtiger_crmentity"; |
|
| 1391 | + } |
|
| 1374 | 1392 | if ($filter == "custom") { |
| 1375 | 1393 | if ($startdate != "0000-00-00" && $enddate != "0000-00-00" && $startdate != "" && |
| 1376 | 1394 | $enddate != "" && $selectedfields[0] != "" && $selectedfields[1] != "") { |
@@ -1403,8 +1421,9 @@ discard block |
||
| 1403 | 1421 | if (!empty($advft_criteria)) { |
| 1404 | 1422 | foreach ($advft_criteria as $column_index => $column_condition) { |
| 1405 | 1423 | |
| 1406 | - if (empty($column_condition)) |
|
| 1407 | - continue; |
|
| 1424 | + if (empty($column_condition)) { |
|
| 1425 | + continue; |
|
| 1426 | + } |
|
| 1408 | 1427 | |
| 1409 | 1428 | $adv_filter_column = $column_condition["columnname"]; |
| 1410 | 1429 | $adv_filter_comparator = $column_condition["comparator"]; |
@@ -1460,10 +1479,12 @@ discard block |
||
| 1460 | 1479 | } |
| 1461 | 1480 | |
| 1462 | 1481 | foreach ($advft_criteria_groups as $group_index => $group_condition_info) { |
| 1463 | - if (empty($group_condition_info)) |
|
| 1464 | - continue; |
|
| 1465 | - if (empty($advfilterlist[$group_index])) |
|
| 1466 | - continue; |
|
| 1482 | + if (empty($group_condition_info)) { |
|
| 1483 | + continue; |
|
| 1484 | + } |
|
| 1485 | + if (empty($advfilterlist[$group_index])) { |
|
| 1486 | + continue; |
|
| 1487 | + } |
|
| 1467 | 1488 | $advfilterlist[$group_index]['condition'] = $group_condition_info["groupcondition"]; |
| 1468 | 1489 | $noOfGroupColumns = count($advfilterlist[$group_index]['columns']); |
| 1469 | 1490 | if (!empty($advfilterlist[$group_index]['columns'][$noOfGroupColumns - 1]['column_condition'])) { |
@@ -1505,8 +1526,9 @@ discard block |
||
| 1505 | 1526 | |
| 1506 | 1527 | if ($fieldcolname != "none") { |
| 1507 | 1528 | $selectedfields = explode(":", $fieldcolname); |
| 1508 | - if ($selectedfields[0] == "vtiger_crmentity" . $this->primarymodule) |
|
| 1509 | - $selectedfields[0] = "vtiger_crmentity"; |
|
| 1529 | + if ($selectedfields[0] == "vtiger_crmentity" . $this->primarymodule) { |
|
| 1530 | + $selectedfields[0] = "vtiger_crmentity"; |
|
| 1531 | + } |
|
| 1510 | 1532 | if ($datefilter == "custom") { |
| 1511 | 1533 | |
| 1512 | 1534 | if ($startdate != "0000-00-00" && $enddate != "0000-00-00" && $selectedfields[0] != "" && $selectedfields[1] != "" && $startdate != '' && $enddate != '') { |
@@ -1595,8 +1617,9 @@ discard block |
||
| 1595 | 1617 | |
| 1596 | 1618 | if ($fieldcolname != "none") { |
| 1597 | 1619 | $selectedfields = explode(":", $fieldcolname); |
| 1598 | - if ($selectedfields[0] == "vtiger_crmentity" . $this->primarymodule) |
|
| 1599 | - $selectedfields[0] = "vtiger_crmentity"; |
|
| 1620 | + if ($selectedfields[0] == "vtiger_crmentity" . $this->primarymodule) { |
|
| 1621 | + $selectedfields[0] = "vtiger_crmentity"; |
|
| 1622 | + } |
|
| 1600 | 1623 | if (stripos($selectedfields[1], 'cf_') == 0 && stristr($selectedfields[1], 'cf_') === true) { |
| 1601 | 1624 | //In sql queries forward slash(/) is treated as query terminator,so to avoid this problem |
| 1602 | 1625 | //the column names are enclosed within ('[]'),which will treat this as part of column name |
@@ -1689,8 +1712,9 @@ discard block |
||
| 1689 | 1712 | $sSQL .= ", "; |
| 1690 | 1713 | $this->orderbylistsql .= ", "; |
| 1691 | 1714 | } |
| 1692 | - if ($selectedfields[0] == "vtiger_crmentity" . $this->primarymodule) |
|
| 1693 | - $selectedfields[0] = "vtiger_crmentity"; |
|
| 1715 | + if ($selectedfields[0] == "vtiger_crmentity" . $this->primarymodule) { |
|
| 1716 | + $selectedfields[0] = "vtiger_crmentity"; |
|
| 1717 | + } |
|
| 1694 | 1718 | $sSQL .= $selectedfields[0] . "." . $selectedfields[1] . " " . $sortorder; |
| 1695 | 1719 | $this->orderbylistsql .= $selectedfields[0] . "." . $selectedfields[1] . " " . $selectedfields[2]; |
| 1696 | 1720 | } |
@@ -2275,8 +2299,9 @@ discard block |
||
| 2275 | 2299 | } |
| 2276 | 2300 | /* STRING TRANSLATION starts */ |
| 2277 | 2301 | $moduleLabel = ''; |
| 2278 | - if (in_array($module, $modules_selected)) |
|
| 2279 | - $moduleLabel = \includes\Language::translate($module, $module); |
|
| 2302 | + if (in_array($module, $modules_selected)) { |
|
| 2303 | + $moduleLabel = \includes\Language::translate($module, $module); |
|
| 2304 | + } |
|
| 2280 | 2305 | |
| 2281 | 2306 | if (empty($translatedLabel)) { |
| 2282 | 2307 | $translatedLabel = \includes\Language::translate(str_replace('__', " ", $fld->name), $module); |
@@ -2355,8 +2380,9 @@ discard block |
||
| 2355 | 2380 | } |
| 2356 | 2381 | // END |
| 2357 | 2382 | |
| 2358 | - if ($is_admin === false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1) |
|
| 2359 | - $picklistarray = $this->getAccessPickListValues(); |
|
| 2383 | + if ($is_admin === false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1) { |
|
| 2384 | + $picklistarray = $this->getAccessPickListValues(); |
|
| 2385 | + } |
|
| 2360 | 2386 | if ($result) { |
| 2361 | 2387 | $y = $adb->getFieldsCount($result); |
| 2362 | 2388 | $arrayHeaders = Array(); |
@@ -2390,10 +2416,11 @@ discard block |
||
| 2390 | 2416 | $headerLabel_tmp = \includes\Language::translate($mod_name[0] . " " . $mod_name[1]); |
| 2391 | 2417 | } |
| 2392 | 2418 | } |
| 2393 | - if ($headerLabel == $headerLabel_tmp) |
|
| 2394 | - $headerLabel = \includes\Language::translate($headerLabel_tmp); |
|
| 2395 | - else |
|
| 2396 | - $headerLabel = $headerLabel_tmp; |
|
| 2419 | + if ($headerLabel == $headerLabel_tmp) { |
|
| 2420 | + $headerLabel = \includes\Language::translate($headerLabel_tmp); |
|
| 2421 | + } else { |
|
| 2422 | + $headerLabel = $headerLabel_tmp; |
|
| 2423 | + } |
|
| 2397 | 2424 | /* STRING TRANSLATION ends */ |
| 2398 | 2425 | $header .= "<td class='rptCellLabel'>" . $headerLabel . "</td>"; |
| 2399 | 2426 | |
@@ -2429,14 +2456,17 @@ discard block |
||
| 2429 | 2456 | $snewvalue = $custom_field_values[1]; |
| 2430 | 2457 | $tnewvalue = $custom_field_values[2]; |
| 2431 | 2458 | } |
| 2432 | - if ($newvalue == "") |
|
| 2433 | - $newvalue = "-"; |
|
| 2459 | + if ($newvalue == "") { |
|
| 2460 | + $newvalue = "-"; |
|
| 2461 | + } |
|
| 2434 | 2462 | |
| 2435 | - if ($snewvalue == "") |
|
| 2436 | - $snewvalue = "-"; |
|
| 2463 | + if ($snewvalue == "") { |
|
| 2464 | + $snewvalue = "-"; |
|
| 2465 | + } |
|
| 2437 | 2466 | |
| 2438 | - if ($tnewvalue == "") |
|
| 2439 | - $tnewvalue = "-"; |
|
| 2467 | + if ($tnewvalue == "") { |
|
| 2468 | + $tnewvalue = "-"; |
|
| 2469 | + } |
|
| 2440 | 2470 | |
| 2441 | 2471 | $valtemplate .= "<tr>"; |
| 2442 | 2472 | |
@@ -2562,8 +2592,9 @@ discard block |
||
| 2562 | 2592 | } elseif ($outputformat == "PDF") { |
| 2563 | 2593 | $sSQL = $this->sGetSQLforReport($this->reportid, $filtersql, $outputformat, false, $startLimit, $endLimit); |
| 2564 | 2594 | $result = $adb->pquery($sSQL, array()); |
| 2565 | - if ($is_admin === false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1) |
|
| 2566 | - $picklistarray = $this->getAccessPickListValues(); |
|
| 2595 | + if ($is_admin === false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1) { |
|
| 2596 | + $picklistarray = $this->getAccessPickListValues(); |
|
| 2597 | + } |
|
| 2567 | 2598 | |
| 2568 | 2599 | if ($result) { |
| 2569 | 2600 | $y = $adb->getFieldsCount($result); |
@@ -2646,45 +2677,49 @@ discard block |
||
| 2646 | 2677 | $value = trim($key); |
| 2647 | 2678 | $arraykey = $value . '__SUM'; |
| 2648 | 2679 | if (isset($keyhdr[$arraykey])) { |
| 2649 | - if ($convert_price) |
|
| 2650 | - $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey]); |
|
| 2651 | - else |
|
| 2652 | - $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
|
| 2680 | + if ($convert_price) { |
|
| 2681 | + $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey]); |
|
| 2682 | + } else { |
|
| 2683 | + $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
|
| 2684 | + } |
|
| 2653 | 2685 | $totalpdf[$rowcount][$arraykey] = $conv_value; |
| 2654 | - }else { |
|
| 2686 | + } else { |
|
| 2655 | 2687 | $totalpdf[$rowcount][$arraykey] = ''; |
| 2656 | 2688 | } |
| 2657 | 2689 | |
| 2658 | 2690 | $arraykey = $value . '__AVG'; |
| 2659 | 2691 | if (isset($keyhdr[$arraykey])) { |
| 2660 | - if ($convert_price) |
|
| 2661 | - $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey]); |
|
| 2662 | - else |
|
| 2663 | - $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
|
| 2692 | + if ($convert_price) { |
|
| 2693 | + $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey]); |
|
| 2694 | + } else { |
|
| 2695 | + $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
|
| 2696 | + } |
|
| 2664 | 2697 | $totalpdf[$rowcount][$arraykey] = $conv_value; |
| 2665 | - }else { |
|
| 2698 | + } else { |
|
| 2666 | 2699 | $totalpdf[$rowcount][$arraykey] = ''; |
| 2667 | 2700 | } |
| 2668 | 2701 | |
| 2669 | 2702 | $arraykey = $value . '__MIN'; |
| 2670 | 2703 | if (isset($keyhdr[$arraykey])) { |
| 2671 | - if ($convert_price) |
|
| 2672 | - $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey]); |
|
| 2673 | - else |
|
| 2674 | - $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
|
| 2704 | + if ($convert_price) { |
|
| 2705 | + $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey]); |
|
| 2706 | + } else { |
|
| 2707 | + $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
|
| 2708 | + } |
|
| 2675 | 2709 | $totalpdf[$rowcount][$arraykey] = $conv_value; |
| 2676 | - }else { |
|
| 2710 | + } else { |
|
| 2677 | 2711 | $totalpdf[$rowcount][$arraykey] = ''; |
| 2678 | 2712 | } |
| 2679 | 2713 | |
| 2680 | 2714 | $arraykey = $value . '__MAX'; |
| 2681 | 2715 | if (isset($keyhdr[$arraykey])) { |
| 2682 | - if ($convert_price) |
|
| 2683 | - $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey]); |
|
| 2684 | - else |
|
| 2685 | - $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
|
| 2716 | + if ($convert_price) { |
|
| 2717 | + $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey]); |
|
| 2718 | + } else { |
|
| 2719 | + $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
|
| 2720 | + } |
|
| 2686 | 2721 | $totalpdf[$rowcount][$arraykey] = $conv_value; |
| 2687 | - }else { |
|
| 2722 | + } else { |
|
| 2688 | 2723 | $totalpdf[$rowcount][$arraykey] = ''; |
| 2689 | 2724 | } |
| 2690 | 2725 | $rowcount++; |
@@ -2758,45 +2793,49 @@ discard block |
||
| 2758 | 2793 | $value = trim($key); |
| 2759 | 2794 | $arraykey = $value . '__SUM'; |
| 2760 | 2795 | if (isset($keyhdr[$arraykey])) { |
| 2761 | - if ($convert_price) |
|
| 2762 | - $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey]); |
|
| 2763 | - else |
|
| 2764 | - $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
|
| 2796 | + if ($convert_price) { |
|
| 2797 | + $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey]); |
|
| 2798 | + } else { |
|
| 2799 | + $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
|
| 2800 | + } |
|
| 2765 | 2801 | $coltotalhtml .= '<td class="rptTotal">' . $conv_value . '</td>'; |
| 2766 | - }else { |
|
| 2802 | + } else { |
|
| 2767 | 2803 | $coltotalhtml .= '<td class="rptTotal"> </td>'; |
| 2768 | 2804 | } |
| 2769 | 2805 | |
| 2770 | 2806 | $arraykey = $value . '__AVG'; |
| 2771 | 2807 | if (isset($keyhdr[$arraykey])) { |
| 2772 | - if ($convert_price) |
|
| 2773 | - $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey]); |
|
| 2774 | - else |
|
| 2775 | - $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
|
| 2808 | + if ($convert_price) { |
|
| 2809 | + $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey]); |
|
| 2810 | + } else { |
|
| 2811 | + $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
|
| 2812 | + } |
|
| 2776 | 2813 | $coltotalhtml .= '<td class="rptTotal">' . $conv_value . '</td>'; |
| 2777 | - }else { |
|
| 2814 | + } else { |
|
| 2778 | 2815 | $coltotalhtml .= '<td class="rptTotal"> </td>'; |
| 2779 | 2816 | } |
| 2780 | 2817 | |
| 2781 | 2818 | $arraykey = $value . '__MIN'; |
| 2782 | 2819 | if (isset($keyhdr[$arraykey])) { |
| 2783 | - if ($convert_price) |
|
| 2784 | - $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey]); |
|
| 2785 | - else |
|
| 2786 | - $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
|
| 2820 | + if ($convert_price) { |
|
| 2821 | + $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey]); |
|
| 2822 | + } else { |
|
| 2823 | + $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
|
| 2824 | + } |
|
| 2787 | 2825 | $coltotalhtml .= '<td class="rptTotal">' . $conv_value . '</td>'; |
| 2788 | - }else { |
|
| 2826 | + } else { |
|
| 2789 | 2827 | $coltotalhtml .= '<td class="rptTotal"> </td>'; |
| 2790 | 2828 | } |
| 2791 | 2829 | |
| 2792 | 2830 | $arraykey = $value . '__MAX'; |
| 2793 | 2831 | if (isset($keyhdr[$arraykey])) { |
| 2794 | - if ($convert_price) |
|
| 2795 | - $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey]); |
|
| 2796 | - else |
|
| 2797 | - $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
|
| 2832 | + if ($convert_price) { |
|
| 2833 | + $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey]); |
|
| 2834 | + } else { |
|
| 2835 | + $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
|
| 2836 | + } |
|
| 2798 | 2837 | $coltotalhtml .= '<td class="rptTotal">' . $conv_value . '</td>'; |
| 2799 | - }else { |
|
| 2838 | + } else { |
|
| 2800 | 2839 | $coltotalhtml .= '<td class="rptTotal"> </td>'; |
| 2801 | 2840 | } |
| 2802 | 2841 | |
@@ -2824,8 +2863,9 @@ discard block |
||
| 2824 | 2863 | } elseif ($outputformat == "PRINT") { |
| 2825 | 2864 | $sSQL = $this->sGetSQLforReport($this->reportid, $filtersql, $outputformat); |
| 2826 | 2865 | $result = $adb->query($sSQL); |
| 2827 | - if ($is_admin === false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1) |
|
| 2828 | - $picklistarray = $this->getAccessPickListValues(); |
|
| 2866 | + if ($is_admin === false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1) { |
|
| 2867 | + $picklistarray = $this->getAccessPickListValues(); |
|
| 2868 | + } |
|
| 2829 | 2869 | |
| 2830 | 2870 | if ($result) { |
| 2831 | 2871 | $y = $adb->getFieldsCount($result); |
@@ -2854,14 +2894,17 @@ discard block |
||
| 2854 | 2894 | $tnewvalue = $custom_field_values[2]; |
| 2855 | 2895 | } |
| 2856 | 2896 | |
| 2857 | - if ($newvalue == "") |
|
| 2858 | - $newvalue = "-"; |
|
| 2897 | + if ($newvalue == "") { |
|
| 2898 | + $newvalue = "-"; |
|
| 2899 | + } |
|
| 2859 | 2900 | |
| 2860 | - if ($snewvalue == "") |
|
| 2861 | - $snewvalue = "-"; |
|
| 2901 | + if ($snewvalue == "") { |
|
| 2902 | + $snewvalue = "-"; |
|
| 2903 | + } |
|
| 2862 | 2904 | |
| 2863 | - if ($tnewvalue == "") |
|
| 2864 | - $tnewvalue = "-"; |
|
| 2905 | + if ($tnewvalue == "") { |
|
| 2906 | + $tnewvalue = "-"; |
|
| 2907 | + } |
|
| 2865 | 2908 | |
| 2866 | 2909 | $valtemplate .= "<tr>"; |
| 2867 | 2910 | |
@@ -2963,45 +3006,49 @@ discard block |
||
| 2963 | 3006 | $value = trim($key); |
| 2964 | 3007 | $arraykey = $value . '__SUM'; |
| 2965 | 3008 | if (isset($keyhdr[$arraykey])) { |
| 2966 | - if ($convert_price) |
|
| 2967 | - $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey]); |
|
| 2968 | - else |
|
| 2969 | - $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
|
| 3009 | + if ($convert_price) { |
|
| 3010 | + $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey]); |
|
| 3011 | + } else { |
|
| 3012 | + $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
|
| 3013 | + } |
|
| 2970 | 3014 | $coltotalhtml .= "<td class='rptTotal'>" . $conv_value . '</td>'; |
| 2971 | - }else { |
|
| 3015 | + } else { |
|
| 2972 | 3016 | $coltotalhtml .= "<td class='rptTotal'> </td>"; |
| 2973 | 3017 | } |
| 2974 | 3018 | |
| 2975 | 3019 | $arraykey = $value . '__AVG'; |
| 2976 | 3020 | if (isset($keyhdr[$arraykey])) { |
| 2977 | - if ($convert_price) |
|
| 2978 | - $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey]); |
|
| 2979 | - else |
|
| 2980 | - $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
|
| 3021 | + if ($convert_price) { |
|
| 3022 | + $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey]); |
|
| 3023 | + } else { |
|
| 3024 | + $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
|
| 3025 | + } |
|
| 2981 | 3026 | $coltotalhtml .= "<td class='rptTotal'>" . $conv_value . '</td>'; |
| 2982 | - }else { |
|
| 3027 | + } else { |
|
| 2983 | 3028 | $coltotalhtml .= "<td class='rptTotal'> </td>"; |
| 2984 | 3029 | } |
| 2985 | 3030 | |
| 2986 | 3031 | $arraykey = $value . '__MIN'; |
| 2987 | 3032 | if (isset($keyhdr[$arraykey])) { |
| 2988 | - if ($convert_price) |
|
| 2989 | - $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey]); |
|
| 2990 | - else |
|
| 2991 | - $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
|
| 3033 | + if ($convert_price) { |
|
| 3034 | + $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey]); |
|
| 3035 | + } else { |
|
| 3036 | + $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
|
| 3037 | + } |
|
| 2992 | 3038 | $coltotalhtml .= "<td class='rptTotal'>" . $conv_value . '</td>'; |
| 2993 | - }else { |
|
| 3039 | + } else { |
|
| 2994 | 3040 | $coltotalhtml .= "<td class='rptTotal'> </td>"; |
| 2995 | 3041 | } |
| 2996 | 3042 | |
| 2997 | 3043 | $arraykey = $value . '__MAX'; |
| 2998 | 3044 | if (isset($keyhdr[$arraykey])) { |
| 2999 | - if ($convert_price) |
|
| 3000 | - $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey]); |
|
| 3001 | - else |
|
| 3002 | - $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
|
| 3045 | + if ($convert_price) { |
|
| 3046 | + $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey]); |
|
| 3047 | + } else { |
|
| 3048 | + $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
|
| 3049 | + } |
|
| 3003 | 3050 | $coltotalhtml .= "<td class='rptTotal'>" . $conv_value . '</td>'; |
| 3004 | - }else { |
|
| 3051 | + } else { |
|
| 3005 | 3052 | $coltotalhtml .= "<td class='rptTotal'> </td>"; |
| 3006 | 3053 | } |
| 3007 | 3054 | |
@@ -3256,8 +3303,9 @@ discard block |
||
| 3256 | 3303 | $adb = PearDatabase::getInstance(); |
| 3257 | 3304 | $current_user = vglobal('current_user'); |
| 3258 | 3305 | $id = array(\includes\Modules::getModuleId($this->primarymodule)); |
| 3259 | - if ($this->secondarymodule != '') |
|
| 3260 | - array_push($id, \includes\Modules::getModuleId($this->secondarymodule)); |
|
| 3306 | + if ($this->secondarymodule != '') { |
|
| 3307 | + array_push($id, \includes\Modules::getModuleId($this->secondarymodule)); |
|
| 3308 | + } |
|
| 3261 | 3309 | |
| 3262 | 3310 | $query = sprintf('select fieldname,columnname,fieldid,fieldlabel,tabid,uitype from vtiger_field where tabid in(%s) and uitype in (15,33,55)', generateQuestionMarks($id)); //and columnname in (?)'; |
| 3263 | 3311 | $result = $adb->pquery($query, $id); //,$select_column)); |
@@ -3285,12 +3333,14 @@ discard block |
||
| 3285 | 3333 | } else { |
| 3286 | 3334 | $mulsel = "select distinct $fieldname from vtiger_$fieldname inner join vtiger_role2picklist on vtiger_role2picklist.picklistvalueid = vtiger_$fieldname.picklist_valueid where roleid ='" . $roleid . "' and picklistid in (select picklistid from vtiger_$fieldname)"; // order by sortid asc - not requried |
| 3287 | 3335 | } |
| 3288 | - if ($fieldname != 'firstname') |
|
| 3289 | - $mulselresult = $adb->query($mulsel); |
|
| 3336 | + if ($fieldname != 'firstname') { |
|
| 3337 | + $mulselresult = $adb->query($mulsel); |
|
| 3338 | + } |
|
| 3290 | 3339 | for ($j = 0; $j < $adb->num_rows($mulselresult); $j++) { |
| 3291 | 3340 | $fldvalue = $adb->query_result($mulselresult, $j, $fieldname); |
| 3292 | - if (in_array($fldvalue, $fieldvalues)) |
|
| 3293 | - continue; |
|
| 3341 | + if (in_array($fldvalue, $fieldvalues)) { |
|
| 3342 | + continue; |
|
| 3343 | + } |
|
| 3294 | 3344 | $fieldvalues[] = $fldvalue; |
| 3295 | 3345 | } |
| 3296 | 3346 | $field_count = count($fieldvalues); |
@@ -3301,16 +3351,18 @@ discard block |
||
| 3301 | 3351 | $temp_status[$keyvalue][($temp_count + $t)] = $fieldvalues[$t]; |
| 3302 | 3352 | } |
| 3303 | 3353 | $fieldvalues = $temp_status[$keyvalue]; |
| 3304 | - } else |
|
| 3305 | - $temp_status[$keyvalue] = $fieldvalues; |
|
| 3354 | + } else { |
|
| 3355 | + $temp_status[$keyvalue] = $fieldvalues; |
|
| 3356 | + } |
|
| 3306 | 3357 | } |
| 3307 | 3358 | |
| 3308 | - if ($uitype == 33) |
|
| 3309 | - $fieldlists[1][$keyvalue] = $fieldvalues; |
|
| 3310 | - else if ($uitype == 55 && $fieldname == 'salutationtype') |
|
| 3311 | - $fieldlists[$keyvalue] = $fieldvalues; |
|
| 3312 | - else if ($uitype == 15) |
|
| 3313 | - $fieldlists[$keyvalue] = $fieldvalues; |
|
| 3359 | + if ($uitype == 33) { |
|
| 3360 | + $fieldlists[1][$keyvalue] = $fieldvalues; |
|
| 3361 | + } else if ($uitype == 55 && $fieldname == 'salutationtype') { |
|
| 3362 | + $fieldlists[$keyvalue] = $fieldvalues; |
|
| 3363 | + } else if ($uitype == 15) { |
|
| 3364 | + $fieldlists[$keyvalue] = $fieldvalues; |
|
| 3365 | + } |
|
| 3314 | 3366 | } |
| 3315 | 3367 | return $fieldlists; |
| 3316 | 3368 | } |
@@ -387,6 +387,7 @@ |
||
| 387 | 387 | * This function accepts the folderid |
| 388 | 388 | * This Generates the Reports under each Reports module |
| 389 | 389 | * This Returns a HTML sring |
| 390 | + * @param boolean $rpt_fldr_id |
|
| 390 | 391 | */ |
| 391 | 392 | public function sgetRptsforFldr($rpt_fldr_id, $paramsList = false) |
| 392 | 393 | { |
@@ -190,9 +190,9 @@ discard block |
||
| 190 | 190 | if ($modulerows) { |
| 191 | 191 | foreach ($modulerows as $resultrow) { |
| 192 | 192 | if ($resultrow['presence'] == '1') |
| 193 | - continue; // skip disabled modules |
|
| 193 | + continue; // skip disabled modules |
|
| 194 | 194 | if ($resultrow['isentitytype'] != '1') |
| 195 | - continue; // skip extension modules |
|
| 195 | + continue; // skip extension modules |
|
| 196 | 196 | if (in_array($resultrow['name'], $restricted_modules)) { // skip restricted modules |
| 197 | 197 | continue; |
| 198 | 198 | } |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | $details = []; |
| 310 | 310 | $details['state'] = $reportfldrow["state"]; |
| 311 | 311 | $details['id'] = $reportfldrow["folderid"]; |
| 312 | - $details['name'] = ($mod_strings[$reportfldrow["foldername"]] == '' ) ? $reportfldrow["foldername"] : $mod_strings[$reportfldrow["foldername"]]; |
|
| 312 | + $details['name'] = ($mod_strings[$reportfldrow["foldername"]] == '') ? $reportfldrow["foldername"] : $mod_strings[$reportfldrow["foldername"]]; |
|
| 313 | 313 | $details['description'] = $reportfldrow["description"]; |
| 314 | 314 | $details['fname'] = popup_decode_html($details['name']); |
| 315 | 315 | $details['fdescription'] = popup_decode_html($reportfldrow["description"]); |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | $details = []; |
| 323 | 323 | $details['state'] = $reportfldrow["state"]; |
| 324 | 324 | $details['id'] = $reportfldrow["folderid"]; |
| 325 | - $details['name'] = ($mod_strings[$reportfldrow["foldername"]] == '' ) ? $reportfldrow["foldername"] : $mod_strings[$reportfldrow["foldername"]]; |
|
| 325 | + $details['name'] = ($mod_strings[$reportfldrow["foldername"]] == '') ? $reportfldrow["foldername"] : $mod_strings[$reportfldrow["foldername"]]; |
|
| 326 | 326 | $details['description'] = $reportfldrow["description"]; |
| 327 | 327 | $details['fname'] = popup_decode_html($details['name']); |
| 328 | 328 | $details['fdescription'] = popup_decode_html($reportfldrow["description"]); |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | $log = LoggerManager::getInstance(); |
| 346 | 346 | $returndata = []; |
| 347 | 347 | $sql = "select vtiger_report.*, vtiger_reportmodules.*, vtiger_reportfolder.folderid from vtiger_report inner join vtiger_reportfolder on vtiger_reportfolder.folderid = vtiger_report.folderid"; |
| 348 | - $sql.=" inner join vtiger_reportmodules on vtiger_reportmodules.reportmodulesid = vtiger_report.reportid"; |
|
| 348 | + $sql .= " inner join vtiger_reportmodules on vtiger_reportmodules.reportmodulesid = vtiger_report.reportid"; |
|
| 349 | 349 | if ($paramsList) { |
| 350 | 350 | $startIndex = $paramsList['startIndex']; |
| 351 | 351 | $pageLimit = $paramsList['pageLimit']; |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | |
| 378 | 378 | if (isPermitted($report["primarymodule"], 'index') == "yes") |
| 379 | 379 | $returndata[] = $report_details; |
| 380 | - }while ($report = $adb->fetch_array($result)); |
|
| 380 | + } while ($report = $adb->fetch_array($result)); |
|
| 381 | 381 | } |
| 382 | 382 | $log->info("Reports :: ListView->Successfully returned vtiger_report details HTML"); |
| 383 | 383 | return $returndata; |
@@ -464,7 +464,7 @@ discard block |
||
| 464 | 464 | |
| 465 | 465 | if (isPermitted($report["primarymodule"], 'index') == "yes") |
| 466 | 466 | $returndata [$report["folderid"]][] = $report_details; |
| 467 | - }while ($report = $adb->fetch_array($result)); |
|
| 467 | + } while ($report = $adb->fetch_array($result)); |
|
| 468 | 468 | } |
| 469 | 469 | |
| 470 | 470 | if ($rpt_fldr_id !== false) { |
@@ -613,9 +613,9 @@ discard block |
||
| 613 | 613 | |
| 614 | 614 | //fix for Ticket #4016 |
| 615 | 615 | if ($module == "Calendar") |
| 616 | - $sql.=" group by vtiger_field.fieldlabel order by sequence"; |
|
| 616 | + $sql .= " group by vtiger_field.fieldlabel order by sequence"; |
|
| 617 | 617 | else |
| 618 | - $sql.=" order by sequence"; |
|
| 618 | + $sql .= " order by sequence"; |
|
| 619 | 619 | } |
| 620 | 620 | else { |
| 621 | 621 | |
@@ -629,9 +629,9 @@ discard block |
||
| 629 | 629 | |
| 630 | 630 | //fix for Ticket #4016 |
| 631 | 631 | if ($module == "Calendar") |
| 632 | - $sql.=" group by vtiger_field.fieldlabel order by sequence"; |
|
| 632 | + $sql .= " group by vtiger_field.fieldlabel order by sequence"; |
|
| 633 | 633 | else |
| 634 | - $sql.=" group by vtiger_field.fieldid order by sequence"; |
|
| 634 | + $sql .= " group by vtiger_field.fieldid order by sequence"; |
|
| 635 | 635 | } |
| 636 | 636 | array_push($params, $skipTalbes); |
| 637 | 637 | |
@@ -967,7 +967,7 @@ discard block |
||
| 967 | 967 | inner join vtiger_relcriteria on vtiger_relcriteria.queryid = vtiger_report.queryid |
| 968 | 968 | left join vtiger_relcriteria_grouping on vtiger_relcriteria.queryid = vtiger_relcriteria_grouping.queryid |
| 969 | 969 | and vtiger_relcriteria.groupid = vtiger_relcriteria_grouping.groupid'; |
| 970 | - $ssql.= " where vtiger_report.reportid = ? && vtiger_relcriteria.groupid = ? order by vtiger_relcriteria.columnindex"; |
|
| 970 | + $ssql .= " where vtiger_report.reportid = ? && vtiger_relcriteria.groupid = ? order by vtiger_relcriteria.columnindex"; |
|
| 971 | 971 | |
| 972 | 972 | $result = $adb->pquery($ssql, array($reportid, $groupId)); |
| 973 | 973 | $noOfColumns = $adb->num_rows($result); |
@@ -1141,29 +1141,29 @@ discard block |
||
| 1141 | 1141 | //Added to avoid display the Related fields (Account name,Vandor name,product name, etc) in Report Calculations(SUM,AVG..) |
| 1142 | 1142 | switch ($tabid) { |
| 1143 | 1143 | case 4://Contacts |
| 1144 | - $ssql.= " and vtiger_field.fieldname not in ('account_id')"; |
|
| 1144 | + $ssql .= " and vtiger_field.fieldname not in ('account_id')"; |
|
| 1145 | 1145 | break; |
| 1146 | 1146 | case 6://Accounts |
| 1147 | - $ssql.= " and vtiger_field.fieldname not in ('account_id')"; |
|
| 1147 | + $ssql .= " and vtiger_field.fieldname not in ('account_id')"; |
|
| 1148 | 1148 | break; |
| 1149 | 1149 | case 9://Calandar |
| 1150 | - $ssql.= " and vtiger_field.fieldname not in ('parent_id','contact_id')"; |
|
| 1150 | + $ssql .= " and vtiger_field.fieldname not in ('parent_id','contact_id')"; |
|
| 1151 | 1151 | break; |
| 1152 | 1152 | case 13://Trouble tickets(HelpDesk) |
| 1153 | - $ssql.= " and vtiger_field.fieldname not in ('parent_id','product_id')"; |
|
| 1153 | + $ssql .= " and vtiger_field.fieldname not in ('parent_id','product_id')"; |
|
| 1154 | 1154 | break; |
| 1155 | 1155 | case 14://Products |
| 1156 | - $ssql.= " and vtiger_field.fieldname not in ('vendor_id','product_id')"; |
|
| 1156 | + $ssql .= " and vtiger_field.fieldname not in ('vendor_id','product_id')"; |
|
| 1157 | 1157 | break; |
| 1158 | 1158 | case 21://Purchase Order |
| 1159 | - $ssql.= " and vtiger_field.fieldname not in ('contact_id','vendor_id','currency_id')"; |
|
| 1159 | + $ssql .= " and vtiger_field.fieldname not in ('contact_id','vendor_id','currency_id')"; |
|
| 1160 | 1160 | break; |
| 1161 | 1161 | case 26://Campaigns |
| 1162 | - $ssql.= " and vtiger_field.fieldname not in ('product_id')"; |
|
| 1162 | + $ssql .= " and vtiger_field.fieldname not in ('product_id')"; |
|
| 1163 | 1163 | break; |
| 1164 | 1164 | } |
| 1165 | 1165 | |
| 1166 | - $ssql.= " order by sequence"; |
|
| 1166 | + $ssql .= " order by sequence"; |
|
| 1167 | 1167 | |
| 1168 | 1168 | $result = $adb->pquery($ssql, $sparams); |
| 1169 | 1169 | $columntototalrow = $adb->fetch_array($result); |
@@ -1324,7 +1324,7 @@ discard block |
||
| 1324 | 1324 | } |
| 1325 | 1325 | |
| 1326 | 1326 | $temp_val = explode(",", $adv_filter_value); |
| 1327 | - if (($column_info[4] == 'D' || ($column_info[4] == 'T' && $column_info[1] != 'time_start' && $column_info[1] != 'time_end') || ($column_info[4] == 'DT')) && ($column_info[4] != '' && $adv_filter_value != '' )) { |
|
| 1327 | + if (($column_info[4] == 'D' || ($column_info[4] == 'T' && $column_info[1] != 'time_start' && $column_info[1] != 'time_end') || ($column_info[4] == 'DT')) && ($column_info[4] != '' && $adv_filter_value != '')) { |
|
| 1328 | 1328 | $val = []; |
| 1329 | 1329 | for ($x = 0; $x < count($temp_val); $x++) { |
| 1330 | 1330 | if (trim($temp_val[$x]) != '') { |
@@ -129,10 +129,11 @@ discard block |
||
| 129 | 129 | $this->reportname = decode_html($cachedInfo["reportname"]); |
| 130 | 130 | $this->reportdescription = decode_html($cachedInfo["description"]); |
| 131 | 131 | $this->folderid = $cachedInfo["folderid"]; |
| 132 | - if ($is_admin === true || in_array($cachedInfo["owner"], $subordinate_users) || $cachedInfo["owner"] == $current_user->id) |
|
| 133 | - $this->is_editable = 'true'; |
|
| 134 | - else |
|
| 135 | - $this->is_editable = 'false'; |
|
| 132 | + if ($is_admin === true || in_array($cachedInfo["owner"], $subordinate_users) || $cachedInfo["owner"] == $current_user->id) { |
|
| 133 | + $this->is_editable = 'true'; |
|
| 134 | + } else { |
|
| 135 | + $this->is_editable = 'false'; |
|
| 136 | + } |
|
| 136 | 137 | } else { |
| 137 | 138 | throw new \Exception\NoPermitted('LBL_PERMISSION_DENIED'); |
| 138 | 139 | } |
@@ -143,8 +144,9 @@ discard block |
||
| 143 | 144 | public function updateModuleList($module) |
| 144 | 145 | { |
| 145 | 146 | $adb = PearDatabase::getInstance(); |
| 146 | - if (!isset($module)) |
|
| 147 | - return; |
|
| 147 | + if (!isset($module)) { |
|
| 148 | + return; |
|
| 149 | + } |
|
| 148 | 150 | require_once('include/utils/utils.php'); |
| 149 | 151 | $tabid = \includes\Modules::getModuleId($module); |
| 150 | 152 | if ($module == 'Calendar') { |
@@ -153,12 +155,14 @@ discard block |
||
| 153 | 155 | $sql = sprintf('SELECT blockid, blocklabel FROM vtiger_blocks WHERE tabid IN (%s)', generateQuestionMarks($tabid)); |
| 154 | 156 | $res = $adb->pquery($sql, [$tabid]); |
| 155 | 157 | $noOfRows = $adb->num_rows($res); |
| 156 | - if ($noOfRows <= 0) |
|
| 157 | - return; |
|
| 158 | + if ($noOfRows <= 0) { |
|
| 159 | + return; |
|
| 160 | + } |
|
| 158 | 161 | for ($index = 0; $index < $noOfRows; ++$index) { |
| 159 | 162 | $blockid = $adb->query_result($res, $index, 'blockid'); |
| 160 | - if (in_array($blockid, $this->module_list[$module])) |
|
| 161 | - continue; |
|
| 163 | + if (in_array($blockid, $this->module_list[$module])) { |
|
| 164 | + continue; |
|
| 165 | + } |
|
| 162 | 166 | $blockid_list[] = $blockid; |
| 163 | 167 | $blocklabel = $adb->query_result($res, $index, 'blocklabel'); |
| 164 | 168 | $this->module_list[$module][$blocklabel] = $blockid; |
@@ -189,10 +193,14 @@ discard block |
||
| 189 | 193 | |
| 190 | 194 | if ($modulerows) { |
| 191 | 195 | foreach ($modulerows as $resultrow) { |
| 192 | - if ($resultrow['presence'] == '1') |
|
| 193 | - continue; // skip disabled modules |
|
| 194 | - if ($resultrow['isentitytype'] != '1') |
|
| 195 | - continue; // skip extension modules |
|
| 196 | + if ($resultrow['presence'] == '1') { |
|
| 197 | + continue; |
|
| 198 | + } |
|
| 199 | + // skip disabled modules |
|
| 200 | + if ($resultrow['isentitytype'] != '1') { |
|
| 201 | + continue; |
|
| 202 | + } |
|
| 203 | + // skip extension modules |
|
| 196 | 204 | if (in_array($resultrow['name'], $restricted_modules)) { // skip restricted modules |
| 197 | 205 | continue; |
| 198 | 206 | } |
@@ -223,10 +231,11 @@ discard block |
||
| 223 | 231 | } |
| 224 | 232 | |
| 225 | 233 | if (!empty($blocklabel)) { |
| 226 | - if ($module == 'Calendar' && $blocklabel == 'LBL_CUSTOM_INFORMATION') |
|
| 227 | - $this->module_list[$module][$blockid] = \includes\Language::translate($blocklabel, $module); |
|
| 228 | - else |
|
| 229 | - $this->module_list[$module][$blockid] = \includes\Language::translate($blocklabel, $module); |
|
| 234 | + if ($module == 'Calendar' && $blocklabel == 'LBL_CUSTOM_INFORMATION') { |
|
| 235 | + $this->module_list[$module][$blockid] = \includes\Language::translate($blocklabel, $module); |
|
| 236 | + } else { |
|
| 237 | + $this->module_list[$module][$blockid] = \includes\Language::translate($blocklabel, $module); |
|
| 238 | + } |
|
| 230 | 239 | $prev_block_label = $blocklabel; |
| 231 | 240 | } else { |
| 232 | 241 | $this->module_list[$module][$blockid] = \includes\Language::translate($prev_block_label, $module); |
@@ -370,13 +379,15 @@ discard block |
||
| 370 | 379 | $report_details ['reportname'] = $report["reportname"]; |
| 371 | 380 | $report_details ['sharingtype'] = $report["sharingtype"]; |
| 372 | 381 | $report_details['folderid'] = $report["folderid"]; |
| 373 | - if ($is_admin === true) |
|
| 374 | - $report_details ['editable'] = 'true'; |
|
| 375 | - else |
|
| 376 | - $report_details['editable'] = 'false'; |
|
| 382 | + if ($is_admin === true) { |
|
| 383 | + $report_details ['editable'] = 'true'; |
|
| 384 | + } else { |
|
| 385 | + $report_details['editable'] = 'false'; |
|
| 386 | + } |
|
| 377 | 387 | |
| 378 | - if (isPermitted($report["primarymodule"], 'index') == "yes") |
|
| 379 | - $returndata[] = $report_details; |
|
| 388 | + if (isPermitted($report["primarymodule"], 'index') == "yes") { |
|
| 389 | + $returndata[] = $report_details; |
|
| 390 | + } |
|
| 380 | 391 | }while ($report = $adb->fetch_array($result)); |
| 381 | 392 | } |
| 382 | 393 | $log->info("Reports :: ListView->Successfully returned vtiger_report details HTML"); |
@@ -457,13 +468,15 @@ discard block |
||
| 457 | 468 | $report_details['reportname'] = $report["reportname"]; |
| 458 | 469 | $report_details['reporttype'] = $report["reporttype"]; |
| 459 | 470 | $report_details['sharingtype'] = $report["sharingtype"]; |
| 460 | - if ($is_admin === true || in_array($report["owner"], $subordinate_users) || $report["owner"] == $currentUser->getId()) |
|
| 461 | - $report_details['editable'] = 'true'; |
|
| 462 | - else |
|
| 463 | - $report_details['editable'] = 'false'; |
|
| 471 | + if ($is_admin === true || in_array($report["owner"], $subordinate_users) || $report["owner"] == $currentUser->getId()) { |
|
| 472 | + $report_details['editable'] = 'true'; |
|
| 473 | + } else { |
|
| 474 | + $report_details['editable'] = 'false'; |
|
| 475 | + } |
|
| 464 | 476 | |
| 465 | - if (isPermitted($report["primarymodule"], 'index') == "yes") |
|
| 466 | - $returndata [$report["folderid"]][] = $report_details; |
|
| 477 | + if (isPermitted($report["primarymodule"], 'index') == "yes") { |
|
| 478 | + $returndata [$report["folderid"]][] = $report_details; |
|
| 479 | + } |
|
| 467 | 480 | }while ($report = $adb->fetch_array($result)); |
| 468 | 481 | } |
| 469 | 482 | |
@@ -596,8 +609,9 @@ discard block |
||
| 596 | 609 | $log = vglobal('log'); |
| 597 | 610 | $current_user = vglobal('current_user'); |
| 598 | 611 | |
| 599 | - if (is_string($block)) |
|
| 600 | - $block = explode(",", $block); |
|
| 612 | + if (is_string($block)) { |
|
| 613 | + $block = explode(",", $block); |
|
| 614 | + } |
|
| 601 | 615 | $skipTalbes = array('vtiger_emaildetails', 'vtiger_attachments'); |
| 602 | 616 | |
| 603 | 617 | $tabid = \includes\Modules::getModuleId($module); |
@@ -612,12 +626,12 @@ discard block |
||
| 612 | 626 | $sql = sprintf("select * from vtiger_field where vtiger_field.tabid in (%s) and vtiger_field.block in (%s) and vtiger_field.displaytype in (1,2,3,10) and vtiger_field.presence in (0,2) && tablename NOT IN (%s) ", generateQuestionMarks($tabid), generateQuestionMarks($block), generateQuestionMarks($skipTalbes)); |
| 613 | 627 | |
| 614 | 628 | //fix for Ticket #4016 |
| 615 | - if ($module == "Calendar") |
|
| 616 | - $sql.=" group by vtiger_field.fieldlabel order by sequence"; |
|
| 617 | - else |
|
| 618 | - $sql.=" order by sequence"; |
|
| 619 | - } |
|
| 620 | - else { |
|
| 629 | + if ($module == "Calendar") { |
|
| 630 | + $sql.=" group by vtiger_field.fieldlabel order by sequence"; |
|
| 631 | + } else { |
|
| 632 | + $sql.=" order by sequence"; |
|
| 633 | + } |
|
| 634 | + } else { |
|
| 621 | 635 | |
| 622 | 636 | $profileList = getCurrentUserProfileList(); |
| 623 | 637 | $sql = sprintf("select * from vtiger_field inner join vtiger_profile2field on vtiger_profile2field.fieldid=vtiger_field.fieldid inner join vtiger_def_org_field on vtiger_def_org_field.fieldid=vtiger_field.fieldid where vtiger_field.tabid in (%s) and vtiger_field.block in (%s) and vtiger_field.displaytype in (1,2,3,10) and vtiger_profile2field.visible=0 and vtiger_def_org_field.visible=0 and vtiger_field.presence in (0,2)", generateQuestionMarks($tabid), generateQuestionMarks($block)); |
@@ -628,10 +642,11 @@ discard block |
||
| 628 | 642 | $sql .= ' and tablename NOT IN (' . generateQuestionMarks($skipTalbes) . ') '; |
| 629 | 643 | |
| 630 | 644 | //fix for Ticket #4016 |
| 631 | - if ($module == "Calendar") |
|
| 632 | - $sql.=" group by vtiger_field.fieldlabel order by sequence"; |
|
| 633 | - else |
|
| 634 | - $sql.=" group by vtiger_field.fieldid order by sequence"; |
|
| 645 | + if ($module == "Calendar") { |
|
| 646 | + $sql.=" group by vtiger_field.fieldlabel order by sequence"; |
|
| 647 | + } else { |
|
| 648 | + $sql.=" group by vtiger_field.fieldid order by sequence"; |
|
| 649 | + } |
|
| 635 | 650 | } |
| 636 | 651 | array_push($params, $skipTalbes); |
| 637 | 652 | |
@@ -679,8 +694,9 @@ discard block |
||
| 679 | 694 | $this->adv_rel_fields[$fieldtypeofdata][] = $adv_rel_field_tod_value; |
| 680 | 695 | } |
| 681 | 696 | //added to escape attachments fields in Reports as we have multiple attachments |
| 682 | - if ($module == 'HelpDesk' && $fieldname == 'filename') |
|
| 683 | - continue; |
|
| 697 | + if ($module == 'HelpDesk' && $fieldname == 'filename') { |
|
| 698 | + continue; |
|
| 699 | + } |
|
| 684 | 700 | |
| 685 | 701 | if (is_string($block) || $group_res_by_block === false) { |
| 686 | 702 | $module_columnlist[$optionvalue] = $fieldlabel; |
@@ -971,8 +987,9 @@ discard block |
||
| 971 | 987 | |
| 972 | 988 | $result = $adb->pquery($ssql, array($reportid, $groupId)); |
| 973 | 989 | $noOfColumns = $adb->num_rows($result); |
| 974 | - if ($noOfColumns <= 0) |
|
| 975 | - continue; |
|
| 990 | + if ($noOfColumns <= 0) { |
|
| 991 | + continue; |
|
| 992 | + } |
|
| 976 | 993 | |
| 977 | 994 | while ($relcriteriarow = $adb->fetch_array($result)) { |
| 978 | 995 | $columnIndex = $relcriteriarow["columnindex"]; |
@@ -1029,8 +1046,9 @@ discard block |
||
| 1029 | 1046 | $i++; |
| 1030 | 1047 | } |
| 1031 | 1048 | // Clear the condition (and/or) for last group, if any. |
| 1032 | - if (!empty($advft_criteria[$i - 1]['condition'])) |
|
| 1033 | - $advft_criteria[$i - 1]['condition'] = ''; |
|
| 1049 | + if (!empty($advft_criteria[$i - 1]['condition'])) { |
|
| 1050 | + $advft_criteria[$i - 1]['condition'] = ''; |
|
| 1051 | + } |
|
| 1034 | 1052 | $this->advft_criteria = $advft_criteria; |
| 1035 | 1053 | $log->info("Reports :: Successfully returned getAdvancedFilterList"); |
| 1036 | 1054 | return true; |
@@ -1289,13 +1307,15 @@ discard block |
||
| 1289 | 1307 | $idelrelcriteriagroupsql = "delete from vtiger_relcriteria_grouping where queryid=?"; |
| 1290 | 1308 | $idelrelcriteriagroupsqlresult = $adb->pquery($idelrelcriteriagroupsql, array($reportid)); |
| 1291 | 1309 | |
| 1292 | - if (empty($advft_criteria)) |
|
| 1293 | - return; |
|
| 1310 | + if (empty($advft_criteria)) { |
|
| 1311 | + return; |
|
| 1312 | + } |
|
| 1294 | 1313 | |
| 1295 | 1314 | foreach ($advft_criteria as $column_index => $column_condition) { |
| 1296 | 1315 | |
| 1297 | - if (empty($column_condition)) |
|
| 1298 | - continue; |
|
| 1316 | + if (empty($column_condition)) { |
|
| 1317 | + continue; |
|
| 1318 | + } |
|
| 1299 | 1319 | |
| 1300 | 1320 | $adv_filter_column = $column_condition["columnname"]; |
| 1301 | 1321 | $adv_filter_comparator = $column_condition["comparator"]; |
@@ -1356,10 +1376,13 @@ discard block |
||
| 1356 | 1376 | |
| 1357 | 1377 | foreach ($advft_criteria_groups as $group_index => $group_condition_info) { |
| 1358 | 1378 | |
| 1359 | - if (empty($group_condition_info)) |
|
| 1360 | - continue; |
|
| 1361 | - if (empty($group_condition_info["conditionexpression"])) |
|
| 1362 | - continue; // Case when the group doesn't have any column criteria |
|
| 1379 | + if (empty($group_condition_info)) { |
|
| 1380 | + continue; |
|
| 1381 | + } |
|
| 1382 | + if (empty($group_condition_info["conditionexpression"])) { |
|
| 1383 | + continue; |
|
| 1384 | + } |
|
| 1385 | + // Case when the group doesn't have any column criteria |
|
| 1363 | 1386 | |
| 1364 | 1387 | $irelcriteriagroupsql = "insert into vtiger_relcriteria_grouping(GROUPID,QUERYID,GROUP_CONDITION,CONDITION_EXPRESSION) values (?,?,?,?)"; |
| 1365 | 1388 | $irelcriteriagroupresult = $adb->pquery($irelcriteriagroupsql, array($group_index, $reportid, $group_condition_info["groupcondition"], $group_condition_info["conditionexpression"])); |