@@ -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(); |
@@ -53,8 +53,9 @@ discard block |
||
53 | 53 | |
54 | 54 | protected function computeDependencies() |
55 | 55 | { |
56 | - if ($this->computedMatrix !== null) |
|
57 | - return; |
|
56 | + if ($this->computedMatrix !== null) { |
|
57 | + return; |
|
58 | + } |
|
58 | 59 | |
59 | 60 | $this->computedMatrix = array(); |
60 | 61 | foreach ($this->matrix as $key => $values) { |
@@ -93,8 +94,9 @@ discard block |
||
93 | 94 | |
94 | 95 | public function addTable($table) |
95 | 96 | { |
96 | - if (!empty($table)) |
|
97 | - $this->tables[$table] = $table; |
|
97 | + if (!empty($table)) { |
|
98 | + $this->tables[$table] = $table; |
|
99 | + } |
|
98 | 100 | } |
99 | 101 | |
100 | 102 | public function addCustomTable($table) |
@@ -594,8 +596,9 @@ discard block |
||
594 | 596 | $access_fields[] = $collistrow["fieldname"]; |
595 | 597 | } |
596 | 598 | //added to include ticketid for Reports module in select columnlist for all users |
597 | - if ($module == "HelpDesk") |
|
598 | - $access_fields[] = "ticketid"; |
|
599 | + if ($module == "HelpDesk") { |
|
600 | + $access_fields[] = "ticketid"; |
|
601 | + } |
|
599 | 602 | return $access_fields; |
600 | 603 | } |
601 | 604 | |
@@ -671,8 +674,9 @@ discard block |
||
671 | 674 | } |
672 | 675 | if ($ordercolumnsequal) { |
673 | 676 | $selectedfields = explode(":", $fieldcolname); |
674 | - if ($selectedfields[0] == "vtiger_crmentity" . $this->primarymodule) |
|
675 | - $selectedfields[0] = "vtiger_crmentity"; |
|
677 | + if ($selectedfields[0] == "vtiger_crmentity" . $this->primarymodule) { |
|
678 | + $selectedfields[0] = "vtiger_crmentity"; |
|
679 | + } |
|
676 | 680 | $sSQLList[] = $selectedfields[0] . "." . $selectedfields[1] . " '" . $selectedfields[2] . "'"; |
677 | 681 | } |
678 | 682 | } |
@@ -724,11 +728,12 @@ discard block |
||
724 | 728 | if (trim($value) == 'NULL') { |
725 | 729 | $rtvalue = ' is NOT NULL'; |
726 | 730 | } elseif (trim($value) != '') { |
727 | - if ($columnName) |
|
728 | - $rtvalue = ' <> ' . $adb->quote($value) . ' || ' . $columnName . " IS NULL "; |
|
729 | - else |
|
730 | - $rtvalue = ' <> ' . $adb->quote($value); |
|
731 | - }elseif (trim($value) == '' && $datatype == 'V') { |
|
731 | + if ($columnName) { |
|
732 | + $rtvalue = ' <> ' . $adb->quote($value) . ' || ' . $columnName . " IS NULL "; |
|
733 | + } else { |
|
734 | + $rtvalue = ' <> ' . $adb->quote($value); |
|
735 | + } |
|
736 | + } elseif (trim($value) == '' && $datatype == 'V') { |
|
732 | 737 | $rtvalue = ' <> ' . $adb->quote($value); |
733 | 738 | } else { |
734 | 739 | $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); |
@@ -1105,13 +1115,15 @@ discard block |
||
1105 | 1115 | $advcolsql[] = "vtiger_troubletickets.status" . $this->getAdvComparator($comparator, trim($valuearray[$n]), $datatype); |
1106 | 1116 | } else if ($selectedfields[2] == 'Faq_Status') { |
1107 | 1117 | $advcolsql[] = "vtiger_faq.status" . $this->getAdvComparator($comparator, trim($valuearray[$n]), $datatype); |
1108 | - } else |
|
1109 | - $advcolsql[] = $selectedfields[0] . "." . $selectedfields[1] . $this->getAdvComparator($comparator, trim($valuearray[$n]), $datatype); |
|
1118 | + } else { |
|
1119 | + $advcolsql[] = $selectedfields[0] . "." . $selectedfields[1] . $this->getAdvComparator($comparator, trim($valuearray[$n]), $datatype); |
|
1120 | + } |
|
1110 | 1121 | } elseif ($selectedfields[1] == 'description') {//when you use comma seperated values. |
1111 | - if ($selectedfields[0] == 'vtiger_crmentity' . $this->primarymodule) |
|
1112 | - $advcolsql[] = "vtiger_crmentity.description" . $this->getAdvComparator($comparator, trim($valuearray[$n]), $datatype); |
|
1113 | - else |
|
1114 | - $advcolsql[] = $selectedfields[0] . "." . $selectedfields[1] . $this->getAdvComparator($comparator, trim($valuearray[$n]), $datatype); |
|
1122 | + if ($selectedfields[0] == 'vtiger_crmentity' . $this->primarymodule) { |
|
1123 | + $advcolsql[] = "vtiger_crmentity.description" . $this->getAdvComparator($comparator, trim($valuearray[$n]), $datatype); |
|
1124 | + } else { |
|
1125 | + $advcolsql[] = $selectedfields[0] . "." . $selectedfields[1] . $this->getAdvComparator($comparator, trim($valuearray[$n]), $datatype); |
|
1126 | + } |
|
1115 | 1127 | } elseif ($selectedfields[2] == 'Quotes_Inventory_Manager') { |
1116 | 1128 | $advcolsql[] = ("trim($concatSql)" . $this->getAdvComparator($comparator, trim($valuearray[$n]), $datatype)); |
1117 | 1129 | } elseif ($selectedfields[1] == 'modifiedby') { |
@@ -1128,10 +1140,11 @@ discard block |
||
1128 | 1140 | } |
1129 | 1141 | } |
1130 | 1142 | //If negative logic filter ('not equal to', 'does not contain') is used, 'and' condition should be applied instead of 'or' |
1131 | - if ($comparator == 'n' || $comparator == 'k') |
|
1132 | - $advcolumnsql = implode(" and ", $advcolsql); |
|
1133 | - else |
|
1134 | - $advcolumnsql = implode(" or ", $advcolsql); |
|
1143 | + if ($comparator == 'n' || $comparator == 'k') { |
|
1144 | + $advcolumnsql = implode(" and ", $advcolsql); |
|
1145 | + } else { |
|
1146 | + $advcolumnsql = implode(" or ", $advcolsql); |
|
1147 | + } |
|
1135 | 1148 | $fieldvalue = " (" . $advcolumnsql . ") "; |
1136 | 1149 | } elseif ($selectedfields[1] == 'user_name') { |
1137 | 1150 | if ($selectedfields[0] == "vtiger_users" . $this->primarymodule) { |
@@ -1199,18 +1212,20 @@ discard block |
||
1199 | 1212 | $fieldvalue = "vtiger_activity.status" . $this->getAdvComparator($comparator, trim($value), $datatype); |
1200 | 1213 | } |
1201 | 1214 | } else if ($comparator == 'ny') { |
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 | - }elseif ($comparator == 'y' || ($comparator == 'e' && (trim($value) == "NULL" || trim($value) == ''))) { |
|
1215 | + if ($fieldInfo['uitype'] == '10' || isReferenceUIType($fieldInfo['uitype'])) { |
|
1216 | + $fieldvalue = "(" . $selectedfields[0] . "." . $selectedfields[1] . " IS NOT NULL && " . $selectedfields[0] . "." . $selectedfields[1] . " != '' && " . $selectedfields[0] . "." . $selectedfields[1] . " != '0')"; |
|
1217 | + } else { |
|
1218 | + $fieldvalue = "(" . $selectedfields[0] . "." . $selectedfields[1] . " IS NOT NULL && " . $selectedfields[0] . "." . $selectedfields[1] . " != '')"; |
|
1219 | + } |
|
1220 | + } elseif ($comparator == 'y' || ($comparator == 'e' && (trim($value) == "NULL" || trim($value) == ''))) { |
|
1207 | 1221 | if ($selectedfields[0] == 'vtiger_inventoryproductrel') { |
1208 | 1222 | $selectedfields[0] = 'vtiger_inventoryproductrel' . $moduleName; |
1209 | 1223 | } |
1210 | - if ($fieldInfo['uitype'] == '10' || isReferenceUIType($fieldInfo['uitype'])) |
|
1211 | - $fieldvalue = "(" . $selectedfields[0] . "." . $selectedfields[1] . " IS NULL || " . $selectedfields[0] . "." . $selectedfields[1] . " = '' || " . $selectedfields[0] . "." . $selectedfields[1] . " = '0')"; |
|
1212 | - else |
|
1213 | - $fieldvalue = "(" . $selectedfields[0] . "." . $selectedfields[1] . " IS NULL || " . $selectedfields[0] . "." . $selectedfields[1] . " = '')"; |
|
1224 | + if ($fieldInfo['uitype'] == '10' || isReferenceUIType($fieldInfo['uitype'])) { |
|
1225 | + $fieldvalue = "(" . $selectedfields[0] . "." . $selectedfields[1] . " IS NULL || " . $selectedfields[0] . "." . $selectedfields[1] . " = '' || " . $selectedfields[0] . "." . $selectedfields[1] . " = '0')"; |
|
1226 | + } else { |
|
1227 | + $fieldvalue = "(" . $selectedfields[0] . "." . $selectedfields[1] . " IS NULL || " . $selectedfields[0] . "." . $selectedfields[1] . " = '')"; |
|
1228 | + } |
|
1214 | 1229 | } elseif ($selectedfields[0] == 'vtiger_inventoryproductrel') { |
1215 | 1230 | if ($selectedfields[1] == 'productid') { |
1216 | 1231 | $fieldvalue = "vtiger_products$moduleName.productname " . $this->getAdvComparator($comparator, trim($value), $datatype); |
@@ -1256,8 +1271,9 @@ discard block |
||
1256 | 1271 | } |
1257 | 1272 | } |
1258 | 1273 | } |
1259 | - if (trim($advfiltersql) != "") |
|
1260 | - $advfiltersql = '(' . $advfiltersql . ')'; |
|
1274 | + if (trim($advfiltersql) != "") { |
|
1275 | + $advfiltersql = '(' . $advfiltersql . ')'; |
|
1276 | + } |
|
1261 | 1277 | |
1262 | 1278 | return $advfiltersql; |
1263 | 1279 | } |
@@ -1312,8 +1328,9 @@ discard block |
||
1312 | 1328 | |
1313 | 1329 | if ($fieldcolname != "none") { |
1314 | 1330 | $selectedfields = explode(":", $fieldcolname); |
1315 | - if ($selectedfields[0] == "vtiger_crmentity" . $this->primarymodule) |
|
1316 | - $selectedfields[0] = "vtiger_crmentity"; |
|
1331 | + if ($selectedfields[0] == "vtiger_crmentity" . $this->primarymodule) { |
|
1332 | + $selectedfields[0] = "vtiger_crmentity"; |
|
1333 | + } |
|
1317 | 1334 | |
1318 | 1335 | $moduleFieldLabel = $selectedfields[3]; |
1319 | 1336 | list($moduleName, $fieldLabel) = explode('__', $moduleFieldLabel, 2); |
@@ -1382,8 +1399,9 @@ discard block |
||
1382 | 1399 | { |
1383 | 1400 | if ($filtercolumn != "none") { |
1384 | 1401 | $selectedfields = explode(":", $filtercolumn); |
1385 | - if ($selectedfields[0] == "vtiger_crmentity" . $this->primarymodule) |
|
1386 | - $selectedfields[0] = "vtiger_crmentity"; |
|
1402 | + if ($selectedfields[0] == "vtiger_crmentity" . $this->primarymodule) { |
|
1403 | + $selectedfields[0] = "vtiger_crmentity"; |
|
1404 | + } |
|
1387 | 1405 | if ($filter == "custom") { |
1388 | 1406 | if ($startdate != "0000-00-00" && $enddate != "0000-00-00" && $startdate != "" && |
1389 | 1407 | $enddate != "" && $selectedfields[0] != "" && $selectedfields[1] != "") { |
@@ -1416,8 +1434,9 @@ discard block |
||
1416 | 1434 | if (!empty($advft_criteria)) { |
1417 | 1435 | foreach ($advft_criteria as $column_index => $column_condition) { |
1418 | 1436 | |
1419 | - if (empty($column_condition)) |
|
1420 | - continue; |
|
1437 | + if (empty($column_condition)) { |
|
1438 | + continue; |
|
1439 | + } |
|
1421 | 1440 | |
1422 | 1441 | $adv_filter_column = $column_condition["columnname"]; |
1423 | 1442 | $adv_filter_comparator = $column_condition["comparator"]; |
@@ -1474,10 +1493,12 @@ discard block |
||
1474 | 1493 | } |
1475 | 1494 | |
1476 | 1495 | foreach ($advft_criteria_groups as $group_index => $group_condition_info) { |
1477 | - if (empty($group_condition_info)) |
|
1478 | - continue; |
|
1479 | - if (empty($advfilterlist[$group_index])) |
|
1480 | - continue; |
|
1496 | + if (empty($group_condition_info)) { |
|
1497 | + continue; |
|
1498 | + } |
|
1499 | + if (empty($advfilterlist[$group_index])) { |
|
1500 | + continue; |
|
1501 | + } |
|
1481 | 1502 | $advfilterlist[$group_index]['condition'] = $group_condition_info["groupcondition"]; |
1482 | 1503 | $noOfGroupColumns = count($advfilterlist[$group_index]['columns']); |
1483 | 1504 | if (!empty($advfilterlist[$group_index]['columns'][$noOfGroupColumns - 1]['column_condition'])) { |
@@ -1519,8 +1540,9 @@ discard block |
||
1519 | 1540 | |
1520 | 1541 | if ($fieldcolname != "none") { |
1521 | 1542 | $selectedfields = explode(":", $fieldcolname); |
1522 | - if ($selectedfields[0] == "vtiger_crmentity" . $this->primarymodule) |
|
1523 | - $selectedfields[0] = "vtiger_crmentity"; |
|
1543 | + if ($selectedfields[0] == "vtiger_crmentity" . $this->primarymodule) { |
|
1544 | + $selectedfields[0] = "vtiger_crmentity"; |
|
1545 | + } |
|
1524 | 1546 | if ($datefilter == "custom") { |
1525 | 1547 | |
1526 | 1548 | if ($startdate != "0000-00-00" && $enddate != "0000-00-00" && $selectedfields[0] != "" && $selectedfields[1] != "" && $startdate != '' && $enddate != '') { |
@@ -1609,8 +1631,9 @@ discard block |
||
1609 | 1631 | |
1610 | 1632 | if ($fieldcolname != "none") { |
1611 | 1633 | $selectedfields = explode(":", $fieldcolname); |
1612 | - if ($selectedfields[0] == "vtiger_crmentity" . $this->primarymodule) |
|
1613 | - $selectedfields[0] = "vtiger_crmentity"; |
|
1634 | + if ($selectedfields[0] == "vtiger_crmentity" . $this->primarymodule) { |
|
1635 | + $selectedfields[0] = "vtiger_crmentity"; |
|
1636 | + } |
|
1614 | 1637 | if (stripos($selectedfields[1], 'cf_') == 0 && stristr($selectedfields[1], 'cf_') === true) { |
1615 | 1638 | //In sql queries forward slash(/) is treated as query terminator,so to avoid this problem |
1616 | 1639 | //the column names are enclosed within ('[]'),which will treat this as part of column name |
@@ -1703,8 +1726,9 @@ discard block |
||
1703 | 1726 | $sSQL .= ", "; |
1704 | 1727 | $this->orderbylistsql .= ", "; |
1705 | 1728 | } |
1706 | - if ($selectedfields[0] == "vtiger_crmentity" . $this->primarymodule) |
|
1707 | - $selectedfields[0] = "vtiger_crmentity"; |
|
1729 | + if ($selectedfields[0] == "vtiger_crmentity" . $this->primarymodule) { |
|
1730 | + $selectedfields[0] = "vtiger_crmentity"; |
|
1731 | + } |
|
1708 | 1732 | $sSQL .= $selectedfields[0] . "." . $selectedfields[1] . " " . $sortorder; |
1709 | 1733 | $this->orderbylistsql .= $selectedfields[0] . "." . $selectedfields[1] . " " . $selectedfields[2]; |
1710 | 1734 | } |
@@ -2289,8 +2313,9 @@ discard block |
||
2289 | 2313 | } |
2290 | 2314 | /* STRING TRANSLATION starts */ |
2291 | 2315 | $moduleLabel = ''; |
2292 | - if (in_array($module, $modules_selected)) |
|
2293 | - $moduleLabel = \App\Language::translate($module, $module); |
|
2316 | + if (in_array($module, $modules_selected)) { |
|
2317 | + $moduleLabel = \App\Language::translate($module, $module); |
|
2318 | + } |
|
2294 | 2319 | |
2295 | 2320 | if (empty($translatedLabel)) { |
2296 | 2321 | $translatedLabel = \App\Language::translate(str_replace('__', " ", $fld->name), $module); |
@@ -2370,8 +2395,9 @@ discard block |
||
2370 | 2395 | } |
2371 | 2396 | // END |
2372 | 2397 | |
2373 | - if ($is_admin === false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1) |
|
2374 | - $picklistarray = $this->getAccessPickListValues(); |
|
2398 | + if ($is_admin === false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1) { |
|
2399 | + $picklistarray = $this->getAccessPickListValues(); |
|
2400 | + } |
|
2375 | 2401 | if ($result) { |
2376 | 2402 | $y = $adb->getFieldsCount($result); |
2377 | 2403 | $arrayHeaders = Array(); |
@@ -2405,10 +2431,11 @@ discard block |
||
2405 | 2431 | $headerLabel_tmp = \App\Language::translate($mod_name[0] . " " . $mod_name[1]); |
2406 | 2432 | } |
2407 | 2433 | } |
2408 | - if ($headerLabel == $headerLabel_tmp) |
|
2409 | - $headerLabel = \App\Language::translate($headerLabel_tmp); |
|
2410 | - else |
|
2411 | - $headerLabel = $headerLabel_tmp; |
|
2434 | + if ($headerLabel == $headerLabel_tmp) { |
|
2435 | + $headerLabel = \App\Language::translate($headerLabel_tmp); |
|
2436 | + } else { |
|
2437 | + $headerLabel = $headerLabel_tmp; |
|
2438 | + } |
|
2412 | 2439 | /* STRING TRANSLATION ends */ |
2413 | 2440 | $header .= "<td class='rptCellLabel'>" . $headerLabel . "</td>"; |
2414 | 2441 | |
@@ -2444,14 +2471,17 @@ discard block |
||
2444 | 2471 | $snewvalue = $custom_field_values[1]; |
2445 | 2472 | $tnewvalue = $custom_field_values[2]; |
2446 | 2473 | } |
2447 | - if ($newvalue == "") |
|
2448 | - $newvalue = "-"; |
|
2474 | + if ($newvalue == "") { |
|
2475 | + $newvalue = "-"; |
|
2476 | + } |
|
2449 | 2477 | |
2450 | - if ($snewvalue == "") |
|
2451 | - $snewvalue = "-"; |
|
2478 | + if ($snewvalue == "") { |
|
2479 | + $snewvalue = "-"; |
|
2480 | + } |
|
2452 | 2481 | |
2453 | - if ($tnewvalue == "") |
|
2454 | - $tnewvalue = "-"; |
|
2482 | + if ($tnewvalue == "") { |
|
2483 | + $tnewvalue = "-"; |
|
2484 | + } |
|
2455 | 2485 | |
2456 | 2486 | $valtemplate .= "<tr>"; |
2457 | 2487 | |
@@ -2577,8 +2607,9 @@ discard block |
||
2577 | 2607 | } elseif ($outputformat == "PDF") { |
2578 | 2608 | $sSQL = $this->sGetSQLforReport($this->reportid, $filtersql, $outputformat, false, $startLimit, $endLimit); |
2579 | 2609 | $result = $adb->pquery($sSQL, array()); |
2580 | - if ($is_admin === false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1) |
|
2581 | - $picklistarray = $this->getAccessPickListValues(); |
|
2610 | + if ($is_admin === false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1) { |
|
2611 | + $picklistarray = $this->getAccessPickListValues(); |
|
2612 | + } |
|
2582 | 2613 | |
2583 | 2614 | if ($result) { |
2584 | 2615 | $y = $adb->getFieldsCount($result); |
@@ -2661,45 +2692,49 @@ discard block |
||
2661 | 2692 | $value = trim($key); |
2662 | 2693 | $arraykey = $value . '__SUM'; |
2663 | 2694 | if (isset($keyhdr[$arraykey])) { |
2664 | - if ($convert_price) |
|
2665 | - $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey]); |
|
2666 | - else |
|
2667 | - $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
|
2695 | + if ($convert_price) { |
|
2696 | + $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey]); |
|
2697 | + } else { |
|
2698 | + $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
|
2699 | + } |
|
2668 | 2700 | $totalpdf[$rowcount][$arraykey] = $conv_value; |
2669 | - }else { |
|
2701 | + } else { |
|
2670 | 2702 | $totalpdf[$rowcount][$arraykey] = ''; |
2671 | 2703 | } |
2672 | 2704 | |
2673 | 2705 | $arraykey = $value . '__AVG'; |
2674 | 2706 | if (isset($keyhdr[$arraykey])) { |
2675 | - if ($convert_price) |
|
2676 | - $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey]); |
|
2677 | - else |
|
2678 | - $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
|
2707 | + if ($convert_price) { |
|
2708 | + $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey]); |
|
2709 | + } else { |
|
2710 | + $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
|
2711 | + } |
|
2679 | 2712 | $totalpdf[$rowcount][$arraykey] = $conv_value; |
2680 | - }else { |
|
2713 | + } else { |
|
2681 | 2714 | $totalpdf[$rowcount][$arraykey] = ''; |
2682 | 2715 | } |
2683 | 2716 | |
2684 | 2717 | $arraykey = $value . '__MIN'; |
2685 | 2718 | if (isset($keyhdr[$arraykey])) { |
2686 | - if ($convert_price) |
|
2687 | - $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey]); |
|
2688 | - else |
|
2689 | - $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
|
2719 | + if ($convert_price) { |
|
2720 | + $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey]); |
|
2721 | + } else { |
|
2722 | + $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
|
2723 | + } |
|
2690 | 2724 | $totalpdf[$rowcount][$arraykey] = $conv_value; |
2691 | - }else { |
|
2725 | + } else { |
|
2692 | 2726 | $totalpdf[$rowcount][$arraykey] = ''; |
2693 | 2727 | } |
2694 | 2728 | |
2695 | 2729 | $arraykey = $value . '__MAX'; |
2696 | 2730 | if (isset($keyhdr[$arraykey])) { |
2697 | - if ($convert_price) |
|
2698 | - $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey]); |
|
2699 | - else |
|
2700 | - $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
|
2731 | + if ($convert_price) { |
|
2732 | + $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey]); |
|
2733 | + } else { |
|
2734 | + $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
|
2735 | + } |
|
2701 | 2736 | $totalpdf[$rowcount][$arraykey] = $conv_value; |
2702 | - }else { |
|
2737 | + } else { |
|
2703 | 2738 | $totalpdf[$rowcount][$arraykey] = ''; |
2704 | 2739 | } |
2705 | 2740 | $rowcount++; |
@@ -2773,45 +2808,49 @@ discard block |
||
2773 | 2808 | $value = trim($key); |
2774 | 2809 | $arraykey = $value . '__SUM'; |
2775 | 2810 | if (isset($keyhdr[$arraykey])) { |
2776 | - if ($convert_price) |
|
2777 | - $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey]); |
|
2778 | - else |
|
2779 | - $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
|
2811 | + if ($convert_price) { |
|
2812 | + $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey]); |
|
2813 | + } else { |
|
2814 | + $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
|
2815 | + } |
|
2780 | 2816 | $coltotalhtml .= '<td class="rptTotal">' . $conv_value . '</td>'; |
2781 | - }else { |
|
2817 | + } else { |
|
2782 | 2818 | $coltotalhtml .= '<td class="rptTotal"> </td>'; |
2783 | 2819 | } |
2784 | 2820 | |
2785 | 2821 | $arraykey = $value . '__AVG'; |
2786 | 2822 | if (isset($keyhdr[$arraykey])) { |
2787 | - if ($convert_price) |
|
2788 | - $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey]); |
|
2789 | - else |
|
2790 | - $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
|
2823 | + if ($convert_price) { |
|
2824 | + $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey]); |
|
2825 | + } else { |
|
2826 | + $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
|
2827 | + } |
|
2791 | 2828 | $coltotalhtml .= '<td class="rptTotal">' . $conv_value . '</td>'; |
2792 | - }else { |
|
2829 | + } else { |
|
2793 | 2830 | $coltotalhtml .= '<td class="rptTotal"> </td>'; |
2794 | 2831 | } |
2795 | 2832 | |
2796 | 2833 | $arraykey = $value . '__MIN'; |
2797 | 2834 | if (isset($keyhdr[$arraykey])) { |
2798 | - if ($convert_price) |
|
2799 | - $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey]); |
|
2800 | - else |
|
2801 | - $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
|
2835 | + if ($convert_price) { |
|
2836 | + $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey]); |
|
2837 | + } else { |
|
2838 | + $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
|
2839 | + } |
|
2802 | 2840 | $coltotalhtml .= '<td class="rptTotal">' . $conv_value . '</td>'; |
2803 | - }else { |
|
2841 | + } else { |
|
2804 | 2842 | $coltotalhtml .= '<td class="rptTotal"> </td>'; |
2805 | 2843 | } |
2806 | 2844 | |
2807 | 2845 | $arraykey = $value . '__MAX'; |
2808 | 2846 | if (isset($keyhdr[$arraykey])) { |
2809 | - if ($convert_price) |
|
2810 | - $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey]); |
|
2811 | - else |
|
2812 | - $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
|
2847 | + if ($convert_price) { |
|
2848 | + $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey]); |
|
2849 | + } else { |
|
2850 | + $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
|
2851 | + } |
|
2813 | 2852 | $coltotalhtml .= '<td class="rptTotal">' . $conv_value . '</td>'; |
2814 | - }else { |
|
2853 | + } else { |
|
2815 | 2854 | $coltotalhtml .= '<td class="rptTotal"> </td>'; |
2816 | 2855 | } |
2817 | 2856 | |
@@ -2839,8 +2878,9 @@ discard block |
||
2839 | 2878 | } elseif ($outputformat == "PRINT") { |
2840 | 2879 | $sSQL = $this->sGetSQLforReport($this->reportid, $filtersql, $outputformat); |
2841 | 2880 | $result = $adb->query($sSQL); |
2842 | - if ($is_admin === false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1) |
|
2843 | - $picklistarray = $this->getAccessPickListValues(); |
|
2881 | + if ($is_admin === false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1) { |
|
2882 | + $picklistarray = $this->getAccessPickListValues(); |
|
2883 | + } |
|
2844 | 2884 | |
2845 | 2885 | if ($result) { |
2846 | 2886 | $y = $adb->getFieldsCount($result); |
@@ -2869,14 +2909,17 @@ discard block |
||
2869 | 2909 | $tnewvalue = $custom_field_values[2]; |
2870 | 2910 | } |
2871 | 2911 | |
2872 | - if ($newvalue == "") |
|
2873 | - $newvalue = "-"; |
|
2912 | + if ($newvalue == "") { |
|
2913 | + $newvalue = "-"; |
|
2914 | + } |
|
2874 | 2915 | |
2875 | - if ($snewvalue == "") |
|
2876 | - $snewvalue = "-"; |
|
2916 | + if ($snewvalue == "") { |
|
2917 | + $snewvalue = "-"; |
|
2918 | + } |
|
2877 | 2919 | |
2878 | - if ($tnewvalue == "") |
|
2879 | - $tnewvalue = "-"; |
|
2920 | + if ($tnewvalue == "") { |
|
2921 | + $tnewvalue = "-"; |
|
2922 | + } |
|
2880 | 2923 | |
2881 | 2924 | $valtemplate .= "<tr>"; |
2882 | 2925 | |
@@ -2978,45 +3021,49 @@ discard block |
||
2978 | 3021 | $value = trim($key); |
2979 | 3022 | $arraykey = $value . '__SUM'; |
2980 | 3023 | if (isset($keyhdr[$arraykey])) { |
2981 | - if ($convert_price) |
|
2982 | - $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey]); |
|
2983 | - else |
|
2984 | - $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
|
3024 | + if ($convert_price) { |
|
3025 | + $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey]); |
|
3026 | + } else { |
|
3027 | + $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
|
3028 | + } |
|
2985 | 3029 | $coltotalhtml .= "<td class='rptTotal'>" . $conv_value . '</td>'; |
2986 | - }else { |
|
3030 | + } else { |
|
2987 | 3031 | $coltotalhtml .= "<td class='rptTotal'> </td>"; |
2988 | 3032 | } |
2989 | 3033 | |
2990 | 3034 | $arraykey = $value . '__AVG'; |
2991 | 3035 | if (isset($keyhdr[$arraykey])) { |
2992 | - if ($convert_price) |
|
2993 | - $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey]); |
|
2994 | - else |
|
2995 | - $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
|
3036 | + if ($convert_price) { |
|
3037 | + $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey]); |
|
3038 | + } else { |
|
3039 | + $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
|
3040 | + } |
|
2996 | 3041 | $coltotalhtml .= "<td class='rptTotal'>" . $conv_value . '</td>'; |
2997 | - }else { |
|
3042 | + } else { |
|
2998 | 3043 | $coltotalhtml .= "<td class='rptTotal'> </td>"; |
2999 | 3044 | } |
3000 | 3045 | |
3001 | 3046 | $arraykey = $value . '__MIN'; |
3002 | 3047 | if (isset($keyhdr[$arraykey])) { |
3003 | - if ($convert_price) |
|
3004 | - $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey]); |
|
3005 | - else |
|
3006 | - $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
|
3048 | + if ($convert_price) { |
|
3049 | + $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey]); |
|
3050 | + } else { |
|
3051 | + $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
|
3052 | + } |
|
3007 | 3053 | $coltotalhtml .= "<td class='rptTotal'>" . $conv_value . '</td>'; |
3008 | - }else { |
|
3054 | + } else { |
|
3009 | 3055 | $coltotalhtml .= "<td class='rptTotal'> </td>"; |
3010 | 3056 | } |
3011 | 3057 | |
3012 | 3058 | $arraykey = $value . '__MAX'; |
3013 | 3059 | if (isset($keyhdr[$arraykey])) { |
3014 | - if ($convert_price) |
|
3015 | - $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey]); |
|
3016 | - else |
|
3017 | - $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
|
3060 | + if ($convert_price) { |
|
3061 | + $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey]); |
|
3062 | + } else { |
|
3063 | + $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
|
3064 | + } |
|
3018 | 3065 | $coltotalhtml .= "<td class='rptTotal'>" . $conv_value . '</td>'; |
3019 | - }else { |
|
3066 | + } else { |
|
3020 | 3067 | $coltotalhtml .= "<td class='rptTotal'> </td>"; |
3021 | 3068 | } |
3022 | 3069 | |
@@ -3271,8 +3318,9 @@ discard block |
||
3271 | 3318 | $adb = PearDatabase::getInstance(); |
3272 | 3319 | $current_user = vglobal('current_user'); |
3273 | 3320 | $id = array(\App\Module::getModuleId($this->primarymodule)); |
3274 | - if ($this->secondarymodule != '') |
|
3275 | - array_push($id, \App\Module::getModuleId($this->secondarymodule)); |
|
3321 | + if ($this->secondarymodule != '') { |
|
3322 | + array_push($id, \App\Module::getModuleId($this->secondarymodule)); |
|
3323 | + } |
|
3276 | 3324 | |
3277 | 3325 | $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 (?)'; |
3278 | 3326 | $result = $adb->pquery($query, $id); //,$select_column)); |
@@ -3301,13 +3349,15 @@ discard block |
||
3301 | 3349 | } else { |
3302 | 3350 | $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 |
3303 | 3351 | } |
3304 | - if ($fieldname != 'firstname') |
|
3305 | - $mulselresult = $adb->query($mulsel); |
|
3352 | + if ($fieldname != 'firstname') { |
|
3353 | + $mulselresult = $adb->query($mulsel); |
|
3354 | + } |
|
3306 | 3355 | $countMulSelResult = $adb->num_rows($mulselresult); |
3307 | 3356 | for ($j = 0; $j < $countMulSelResult; $j++) { |
3308 | 3357 | $fldvalue = $adb->query_result($mulselresult, $j, $fieldname); |
3309 | - if (in_array($fldvalue, $fieldvalues)) |
|
3310 | - continue; |
|
3358 | + if (in_array($fldvalue, $fieldvalues)) { |
|
3359 | + continue; |
|
3360 | + } |
|
3311 | 3361 | $fieldvalues[] = $fldvalue; |
3312 | 3362 | } |
3313 | 3363 | $field_count = count($fieldvalues); |
@@ -3318,16 +3368,18 @@ discard block |
||
3318 | 3368 | $temp_status[$keyvalue][($temp_count + $t)] = $fieldvalues[$t]; |
3319 | 3369 | } |
3320 | 3370 | $fieldvalues = $temp_status[$keyvalue]; |
3321 | - } else |
|
3322 | - $temp_status[$keyvalue] = $fieldvalues; |
|
3371 | + } else { |
|
3372 | + $temp_status[$keyvalue] = $fieldvalues; |
|
3373 | + } |
|
3323 | 3374 | } |
3324 | 3375 | |
3325 | - if ($uitype == 33) |
|
3326 | - $fieldlists[1][$keyvalue] = $fieldvalues; |
|
3327 | - else if ($uitype == 55 && $fieldname == 'salutationtype') |
|
3328 | - $fieldlists[$keyvalue] = $fieldvalues; |
|
3329 | - else if ($uitype == 15) |
|
3330 | - $fieldlists[$keyvalue] = $fieldvalues; |
|
3376 | + if ($uitype == 33) { |
|
3377 | + $fieldlists[1][$keyvalue] = $fieldvalues; |
|
3378 | + } else if ($uitype == 55 && $fieldname == 'salutationtype') { |
|
3379 | + $fieldlists[$keyvalue] = $fieldvalues; |
|
3380 | + } else if ($uitype == 15) { |
|
3381 | + $fieldlists[$keyvalue] = $fieldvalues; |
|
3382 | + } |
|
3331 | 3383 | } |
3332 | 3384 | return $fieldlists; |
3333 | 3385 | } |
@@ -1004,7 +1004,7 @@ discard block |
||
1004 | 1004 | $advfiltergroupsql .= "$tableColumnSql BETWEEN $start AND $end"; |
1005 | 1005 | else |
1006 | 1006 | $advfiltergroupsql .= "$tableColumnSql NOT BETWEEN $start AND $end"; |
1007 | - }else if ($comparator == 'bw') { |
|
1007 | + } else if ($comparator == 'bw') { |
|
1008 | 1008 | $values = explode(',', $value); |
1009 | 1009 | $startDateTime = explode(' ', $values[0]); |
1010 | 1010 | $endDateTime = explode(' ', $values[1]); |
@@ -1447,7 +1447,7 @@ discard block |
||
1447 | 1447 | } |
1448 | 1448 | |
1449 | 1449 | $temp_val = explode(",", $adv_filter_value); |
1450 | - 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 != '' )) { |
|
1450 | + 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 != '')) { |
|
1451 | 1451 | $val = Array(); |
1452 | 1452 | $countTempVal = count($temp_val); |
1453 | 1453 | for ($x = 0; $x < $countTempVal; $x++) { |
@@ -2666,7 +2666,7 @@ discard block |
||
2666 | 2666 | else |
2667 | 2667 | $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
2668 | 2668 | $totalpdf[$rowcount][$arraykey] = $conv_value; |
2669 | - }else { |
|
2669 | + } else { |
|
2670 | 2670 | $totalpdf[$rowcount][$arraykey] = ''; |
2671 | 2671 | } |
2672 | 2672 | |
@@ -2677,7 +2677,7 @@ discard block |
||
2677 | 2677 | else |
2678 | 2678 | $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
2679 | 2679 | $totalpdf[$rowcount][$arraykey] = $conv_value; |
2680 | - }else { |
|
2680 | + } else { |
|
2681 | 2681 | $totalpdf[$rowcount][$arraykey] = ''; |
2682 | 2682 | } |
2683 | 2683 | |
@@ -2688,7 +2688,7 @@ discard block |
||
2688 | 2688 | else |
2689 | 2689 | $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
2690 | 2690 | $totalpdf[$rowcount][$arraykey] = $conv_value; |
2691 | - }else { |
|
2691 | + } else { |
|
2692 | 2692 | $totalpdf[$rowcount][$arraykey] = ''; |
2693 | 2693 | } |
2694 | 2694 | |
@@ -2699,7 +2699,7 @@ discard block |
||
2699 | 2699 | else |
2700 | 2700 | $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
2701 | 2701 | $totalpdf[$rowcount][$arraykey] = $conv_value; |
2702 | - }else { |
|
2702 | + } else { |
|
2703 | 2703 | $totalpdf[$rowcount][$arraykey] = ''; |
2704 | 2704 | } |
2705 | 2705 | $rowcount++; |
@@ -2778,7 +2778,7 @@ discard block |
||
2778 | 2778 | else |
2779 | 2779 | $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
2780 | 2780 | $coltotalhtml .= '<td class="rptTotal">' . $conv_value . '</td>'; |
2781 | - }else { |
|
2781 | + } else { |
|
2782 | 2782 | $coltotalhtml .= '<td class="rptTotal"> </td>'; |
2783 | 2783 | } |
2784 | 2784 | |
@@ -2789,7 +2789,7 @@ discard block |
||
2789 | 2789 | else |
2790 | 2790 | $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
2791 | 2791 | $coltotalhtml .= '<td class="rptTotal">' . $conv_value . '</td>'; |
2792 | - }else { |
|
2792 | + } else { |
|
2793 | 2793 | $coltotalhtml .= '<td class="rptTotal"> </td>'; |
2794 | 2794 | } |
2795 | 2795 | |
@@ -2800,7 +2800,7 @@ discard block |
||
2800 | 2800 | else |
2801 | 2801 | $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
2802 | 2802 | $coltotalhtml .= '<td class="rptTotal">' . $conv_value . '</td>'; |
2803 | - }else { |
|
2803 | + } else { |
|
2804 | 2804 | $coltotalhtml .= '<td class="rptTotal"> </td>'; |
2805 | 2805 | } |
2806 | 2806 | |
@@ -2811,7 +2811,7 @@ discard block |
||
2811 | 2811 | else |
2812 | 2812 | $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
2813 | 2813 | $coltotalhtml .= '<td class="rptTotal">' . $conv_value . '</td>'; |
2814 | - }else { |
|
2814 | + } else { |
|
2815 | 2815 | $coltotalhtml .= '<td class="rptTotal"> </td>'; |
2816 | 2816 | } |
2817 | 2817 | |
@@ -2983,7 +2983,7 @@ discard block |
||
2983 | 2983 | else |
2984 | 2984 | $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
2985 | 2985 | $coltotalhtml .= "<td class='rptTotal'>" . $conv_value . '</td>'; |
2986 | - }else { |
|
2986 | + } else { |
|
2987 | 2987 | $coltotalhtml .= "<td class='rptTotal'> </td>"; |
2988 | 2988 | } |
2989 | 2989 | |
@@ -2994,7 +2994,7 @@ discard block |
||
2994 | 2994 | else |
2995 | 2995 | $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
2996 | 2996 | $coltotalhtml .= "<td class='rptTotal'>" . $conv_value . '</td>'; |
2997 | - }else { |
|
2997 | + } else { |
|
2998 | 2998 | $coltotalhtml .= "<td class='rptTotal'> </td>"; |
2999 | 2999 | } |
3000 | 3000 | |
@@ -3005,7 +3005,7 @@ discard block |
||
3005 | 3005 | else |
3006 | 3006 | $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
3007 | 3007 | $coltotalhtml .= "<td class='rptTotal'>" . $conv_value . '</td>'; |
3008 | - }else { |
|
3008 | + } else { |
|
3009 | 3009 | $coltotalhtml .= "<td class='rptTotal'> </td>"; |
3010 | 3010 | } |
3011 | 3011 | |
@@ -3016,7 +3016,7 @@ discard block |
||
3016 | 3016 | else |
3017 | 3017 | $conv_value = CurrencyField::convertToUserFormat($keyhdr[$arraykey], null, true); |
3018 | 3018 | $coltotalhtml .= "<td class='rptTotal'>" . $conv_value . '</td>'; |
3019 | - }else { |
|
3019 | + } else { |
|
3020 | 3020 | $coltotalhtml .= "<td class='rptTotal'> </td>"; |
3021 | 3021 | } |
3022 | 3022 | |
@@ -3377,7 +3377,7 @@ discard block |
||
3377 | 3377 | $rowcount = 1; |
3378 | 3378 | //copy the first value details |
3379 | 3379 | $arrayFirstRowValues = $arr_val[0]; |
3380 | - array_pop($arrayFirstRowValues); // removed action link in details |
|
3380 | + array_pop($arrayFirstRowValues); // removed action link in details |
|
3381 | 3381 | foreach ($arrayFirstRowValues as $key => $value) { |
3382 | 3382 | $worksheet->setCellValueExplicitByColumnAndRow($count, $rowcount, $key, true); |
3383 | 3383 | $worksheet->getStyleByColumnAndRow($count, $rowcount)->applyFromArray($header_styles); |
@@ -3442,7 +3442,7 @@ discard block |
||
3442 | 3442 | if (isset($arr_val)) { |
3443 | 3443 | // Header |
3444 | 3444 | $csv_values = array_keys($arr_val[0]); |
3445 | - array_pop($csv_values); //removed header in csv file |
|
3445 | + array_pop($csv_values); //removed header in csv file |
|
3446 | 3446 | fputcsv($fp, $csv_values); |
3447 | 3447 | foreach ($arr_val as $key => $array_value) { |
3448 | 3448 | array_pop($array_value); //removed action link |
@@ -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 | { |
@@ -188,9 +188,9 @@ discard block |
||
188 | 188 | if ($modulerows) { |
189 | 189 | foreach ($modulerows as $resultrow) { |
190 | 190 | if ($resultrow['presence'] == '1') |
191 | - continue; // skip disabled modules |
|
191 | + continue; // skip disabled modules |
|
192 | 192 | if ($resultrow['isentitytype'] != '1') |
193 | - continue; // skip extension modules |
|
193 | + continue; // skip extension modules |
|
194 | 194 | if (in_array($resultrow['name'], $restricted_modules)) { // skip restricted modules |
195 | 195 | continue; |
196 | 196 | } |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | $details = []; |
308 | 308 | $details['state'] = $reportfldrow["state"]; |
309 | 309 | $details['id'] = $reportfldrow["folderid"]; |
310 | - $details['name'] = ($mod_strings[$reportfldrow["foldername"]] == '' ) ? $reportfldrow["foldername"] : $mod_strings[$reportfldrow["foldername"]]; |
|
310 | + $details['name'] = ($mod_strings[$reportfldrow["foldername"]] == '') ? $reportfldrow["foldername"] : $mod_strings[$reportfldrow["foldername"]]; |
|
311 | 311 | $details['description'] = $reportfldrow["description"]; |
312 | 312 | $details['fname'] = popup_decode_html($details['name']); |
313 | 313 | $details['fdescription'] = popup_decode_html($reportfldrow["description"]); |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | $details = []; |
321 | 321 | $details['state'] = $reportfldrow["state"]; |
322 | 322 | $details['id'] = $reportfldrow["folderid"]; |
323 | - $details['name'] = ($mod_strings[$reportfldrow["foldername"]] == '' ) ? $reportfldrow["foldername"] : $mod_strings[$reportfldrow["foldername"]]; |
|
323 | + $details['name'] = ($mod_strings[$reportfldrow["foldername"]] == '') ? $reportfldrow["foldername"] : $mod_strings[$reportfldrow["foldername"]]; |
|
324 | 324 | $details['description'] = $reportfldrow["description"]; |
325 | 325 | $details['fname'] = popup_decode_html($details['name']); |
326 | 326 | $details['fdescription'] = popup_decode_html($reportfldrow["description"]); |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | |
376 | 376 | if (isPermitted($report["primarymodule"], 'index') == "yes") |
377 | 377 | $returndata[] = $report_details; |
378 | - }while ($report = $adb->fetch_array($result)); |
|
378 | + } while ($report = $adb->fetch_array($result)); |
|
379 | 379 | } |
380 | 380 | \App\Log::trace("Reports :: ListView->Successfully returned vtiger_report details HTML"); |
381 | 381 | return $returndata; |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | |
463 | 463 | if (isPermitted($report["primarymodule"], 'index') == "yes") |
464 | 464 | $returndata [$report["folderid"]][] = $report_details; |
465 | - }while ($report = $adb->fetch_array($result)); |
|
465 | + } while ($report = $adb->fetch_array($result)); |
|
466 | 466 | } |
467 | 467 | |
468 | 468 | if ($rpt_fldr_id !== false) { |
@@ -1264,7 +1264,7 @@ discard block |
||
1264 | 1264 | } |
1265 | 1265 | |
1266 | 1266 | $temp_val = explode(",", $adv_filter_value); |
1267 | - 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 != '' )) { |
|
1267 | + 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 != '')) { |
|
1268 | 1268 | $val = []; |
1269 | 1269 | $countTempVal = count($temp_val); |
1270 | 1270 | for ($x = 0; $x < $countTempVal; $x++) { |
@@ -127,10 +127,11 @@ discard block |
||
127 | 127 | $this->reportname = decode_html($cachedInfo["reportname"]); |
128 | 128 | $this->reportdescription = decode_html($cachedInfo["description"]); |
129 | 129 | $this->folderid = $cachedInfo["folderid"]; |
130 | - if ($is_admin === true || in_array($cachedInfo["owner"], $subordinate_users) || $cachedInfo["owner"] == $current_user->id) |
|
131 | - $this->is_editable = 'true'; |
|
132 | - else |
|
133 | - $this->is_editable = 'false'; |
|
130 | + if ($is_admin === true || in_array($cachedInfo["owner"], $subordinate_users) || $cachedInfo["owner"] == $current_user->id) { |
|
131 | + $this->is_editable = 'true'; |
|
132 | + } else { |
|
133 | + $this->is_editable = 'false'; |
|
134 | + } |
|
134 | 135 | } else { |
135 | 136 | throw new \Exception\NoPermitted('LBL_PERMISSION_DENIED'); |
136 | 137 | } |
@@ -141,8 +142,9 @@ discard block |
||
141 | 142 | public function updateModuleList($module) |
142 | 143 | { |
143 | 144 | $adb = PearDatabase::getInstance(); |
144 | - if (!isset($module)) |
|
145 | - return; |
|
145 | + if (!isset($module)) { |
|
146 | + return; |
|
147 | + } |
|
146 | 148 | require_once('include/utils/utils.php'); |
147 | 149 | $tabid = \App\Module::getModuleId($module); |
148 | 150 | if ($module == 'Calendar') { |
@@ -151,12 +153,14 @@ discard block |
||
151 | 153 | $sql = sprintf('SELECT blockid, blocklabel FROM vtiger_blocks WHERE tabid IN (%s)', generateQuestionMarks($tabid)); |
152 | 154 | $res = $adb->pquery($sql, [$tabid]); |
153 | 155 | $noOfRows = $adb->num_rows($res); |
154 | - if ($noOfRows <= 0) |
|
155 | - return; |
|
156 | + if ($noOfRows <= 0) { |
|
157 | + return; |
|
158 | + } |
|
156 | 159 | for ($index = 0; $index < $noOfRows; ++$index) { |
157 | 160 | $blockid = $adb->query_result($res, $index, 'blockid'); |
158 | - if (in_array($blockid, $this->module_list[$module])) |
|
159 | - continue; |
|
161 | + if (in_array($blockid, $this->module_list[$module])) { |
|
162 | + continue; |
|
163 | + } |
|
160 | 164 | $blockid_list[] = $blockid; |
161 | 165 | $blocklabel = $adb->query_result($res, $index, 'blocklabel'); |
162 | 166 | $this->module_list[$module][$blocklabel] = $blockid; |
@@ -187,10 +191,14 @@ discard block |
||
187 | 191 | |
188 | 192 | if ($modulerows) { |
189 | 193 | foreach ($modulerows as $resultrow) { |
190 | - if ($resultrow['presence'] == '1') |
|
191 | - continue; // skip disabled modules |
|
192 | - if ($resultrow['isentitytype'] != '1') |
|
193 | - continue; // skip extension modules |
|
194 | + if ($resultrow['presence'] == '1') { |
|
195 | + continue; |
|
196 | + } |
|
197 | + // skip disabled modules |
|
198 | + if ($resultrow['isentitytype'] != '1') { |
|
199 | + continue; |
|
200 | + } |
|
201 | + // skip extension modules |
|
194 | 202 | if (in_array($resultrow['name'], $restricted_modules)) { // skip restricted modules |
195 | 203 | continue; |
196 | 204 | } |
@@ -221,10 +229,11 @@ discard block |
||
221 | 229 | } |
222 | 230 | |
223 | 231 | if (!empty($blocklabel)) { |
224 | - if ($module == 'Calendar' && $blocklabel == 'LBL_CUSTOM_INFORMATION') |
|
225 | - $this->module_list[$module][$blockid] = \App\Language::translate($blocklabel, $module); |
|
226 | - else |
|
227 | - $this->module_list[$module][$blockid] = \App\Language::translate($blocklabel, $module); |
|
232 | + if ($module == 'Calendar' && $blocklabel == 'LBL_CUSTOM_INFORMATION') { |
|
233 | + $this->module_list[$module][$blockid] = \App\Language::translate($blocklabel, $module); |
|
234 | + } else { |
|
235 | + $this->module_list[$module][$blockid] = \App\Language::translate($blocklabel, $module); |
|
236 | + } |
|
228 | 237 | $prev_block_label = $blocklabel; |
229 | 238 | } else { |
230 | 239 | $this->module_list[$module][$blockid] = \App\Language::translate($prev_block_label, $module); |
@@ -368,13 +377,15 @@ discard block |
||
368 | 377 | $report_details ['reportname'] = $report["reportname"]; |
369 | 378 | $report_details ['sharingtype'] = $report["sharingtype"]; |
370 | 379 | $report_details['folderid'] = $report["folderid"]; |
371 | - if ($is_admin === true) |
|
372 | - $report_details ['editable'] = 'true'; |
|
373 | - else |
|
374 | - $report_details['editable'] = 'false'; |
|
380 | + if ($is_admin === true) { |
|
381 | + $report_details ['editable'] = 'true'; |
|
382 | + } else { |
|
383 | + $report_details['editable'] = 'false'; |
|
384 | + } |
|
375 | 385 | |
376 | - if (isPermitted($report["primarymodule"], 'index') == "yes") |
|
377 | - $returndata[] = $report_details; |
|
386 | + if (isPermitted($report["primarymodule"], 'index') == "yes") { |
|
387 | + $returndata[] = $report_details; |
|
388 | + } |
|
378 | 389 | }while ($report = $adb->fetch_array($result)); |
379 | 390 | } |
380 | 391 | \App\Log::trace("Reports :: ListView->Successfully returned vtiger_report details HTML"); |
@@ -455,13 +466,15 @@ discard block |
||
455 | 466 | $report_details['reportname'] = $report["reportname"]; |
456 | 467 | $report_details['reporttype'] = $report["reporttype"]; |
457 | 468 | $report_details['sharingtype'] = $report["sharingtype"]; |
458 | - if ($is_admin === true || in_array($report["owner"], $subordinate_users) || $report["owner"] == $currentUser->getId()) |
|
459 | - $report_details['editable'] = 'true'; |
|
460 | - else |
|
461 | - $report_details['editable'] = 'false'; |
|
469 | + if ($is_admin === true || in_array($report["owner"], $subordinate_users) || $report["owner"] == $currentUser->getId()) { |
|
470 | + $report_details['editable'] = 'true'; |
|
471 | + } else { |
|
472 | + $report_details['editable'] = 'false'; |
|
473 | + } |
|
462 | 474 | |
463 | - if (isPermitted($report["primarymodule"], 'index') == "yes") |
|
464 | - $returndata [$report["folderid"]][] = $report_details; |
|
475 | + if (isPermitted($report["primarymodule"], 'index') == "yes") { |
|
476 | + $returndata [$report["folderid"]][] = $report_details; |
|
477 | + } |
|
465 | 478 | }while ($report = $adb->fetch_array($result)); |
466 | 479 | } |
467 | 480 | |
@@ -594,8 +607,9 @@ discard block |
||
594 | 607 | $adb = PearDatabase::getInstance(); |
595 | 608 | $currentUser = Users_Privileges_Model::getCurrentUserPrivilegesModel(); |
596 | 609 | |
597 | - if (is_string($block)) |
|
598 | - $block = explode(",", $block); |
|
610 | + if (is_string($block)) { |
|
611 | + $block = explode(",", $block); |
|
612 | + } |
|
599 | 613 | $skipTalbes = array('vtiger_emaildetails', 'vtiger_attachments'); |
600 | 614 | |
601 | 615 | $tabid = \App\Module::getModuleId($module); |
@@ -609,10 +623,11 @@ discard block |
||
609 | 623 | $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)); |
610 | 624 | |
611 | 625 | //fix for Ticket #4016 |
612 | - if ($module == "Calendar") |
|
613 | - $sql .= " group by vtiger_field.fieldlabel order by sequence"; |
|
614 | - else |
|
615 | - $sql .= " order by sequence"; |
|
626 | + if ($module == "Calendar") { |
|
627 | + $sql .= " group by vtiger_field.fieldlabel order by sequence"; |
|
628 | + } else { |
|
629 | + $sql .= " order by sequence"; |
|
630 | + } |
|
616 | 631 | } else { |
617 | 632 | $profileList = $currentUser->getProfiles(); |
618 | 633 | $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)); |
@@ -623,10 +638,11 @@ discard block |
||
623 | 638 | $sql .= ' and tablename NOT IN (' . generateQuestionMarks($skipTalbes) . ') '; |
624 | 639 | |
625 | 640 | //fix for Ticket #4016 |
626 | - if ($module == "Calendar") |
|
627 | - $sql .= " group by vtiger_field.fieldlabel order by sequence"; |
|
628 | - else |
|
629 | - $sql .= " group by vtiger_field.fieldid order by sequence"; |
|
641 | + if ($module == "Calendar") { |
|
642 | + $sql .= " group by vtiger_field.fieldlabel order by sequence"; |
|
643 | + } else { |
|
644 | + $sql .= " group by vtiger_field.fieldid order by sequence"; |
|
645 | + } |
|
630 | 646 | } |
631 | 647 | array_push($params, $skipTalbes); |
632 | 648 | |
@@ -674,8 +690,9 @@ discard block |
||
674 | 690 | $this->adv_rel_fields[$fieldtypeofdata][] = $adv_rel_field_tod_value; |
675 | 691 | } |
676 | 692 | //added to escape attachments fields in Reports as we have multiple attachments |
677 | - if ($module == 'HelpDesk' && $fieldname == 'filename') |
|
678 | - continue; |
|
693 | + if ($module == 'HelpDesk' && $fieldname == 'filename') { |
|
694 | + continue; |
|
695 | + } |
|
679 | 696 | |
680 | 697 | if (is_string($block) || $group_res_by_block === false) { |
681 | 698 | $module_columnlist[$optionvalue] = $fieldlabel; |
@@ -916,8 +933,9 @@ discard block |
||
916 | 933 | |
917 | 934 | $result = $adb->pquery($ssql, array($reportid, $groupId)); |
918 | 935 | $noOfColumns = $adb->num_rows($result); |
919 | - if ($noOfColumns <= 0) |
|
920 | - continue; |
|
936 | + if ($noOfColumns <= 0) { |
|
937 | + continue; |
|
938 | + } |
|
921 | 939 | |
922 | 940 | while ($relcriteriarow = $adb->fetch_array($result)) { |
923 | 941 | $columnIndex = $relcriteriarow["columnindex"]; |
@@ -975,8 +993,9 @@ discard block |
||
975 | 993 | $i++; |
976 | 994 | } |
977 | 995 | // Clear the condition (and/or) for last group, if any. |
978 | - if (!empty($advft_criteria[$i - 1]['condition'])) |
|
979 | - $advft_criteria[$i - 1]['condition'] = ''; |
|
996 | + if (!empty($advft_criteria[$i - 1]['condition'])) { |
|
997 | + $advft_criteria[$i - 1]['condition'] = ''; |
|
998 | + } |
|
980 | 999 | $this->advft_criteria = $advft_criteria; |
981 | 1000 | \App\Log::trace("Reports :: Successfully returned getAdvancedFilterList"); |
982 | 1001 | return true; |
@@ -1229,13 +1248,15 @@ discard block |
||
1229 | 1248 | $idelrelcriteriagroupsql = "delete from vtiger_relcriteria_grouping where queryid=?"; |
1230 | 1249 | $idelrelcriteriagroupsqlresult = $adb->pquery($idelrelcriteriagroupsql, array($reportid)); |
1231 | 1250 | |
1232 | - if (empty($advft_criteria)) |
|
1233 | - return; |
|
1251 | + if (empty($advft_criteria)) { |
|
1252 | + return; |
|
1253 | + } |
|
1234 | 1254 | |
1235 | 1255 | foreach ($advft_criteria as $column_index => $column_condition) { |
1236 | 1256 | |
1237 | - if (empty($column_condition)) |
|
1238 | - continue; |
|
1257 | + if (empty($column_condition)) { |
|
1258 | + continue; |
|
1259 | + } |
|
1239 | 1260 | |
1240 | 1261 | $adv_filter_column = $column_condition["columnname"]; |
1241 | 1262 | $adv_filter_comparator = $column_condition["comparator"]; |
@@ -1297,10 +1318,13 @@ discard block |
||
1297 | 1318 | |
1298 | 1319 | foreach ($advft_criteria_groups as $group_index => $group_condition_info) { |
1299 | 1320 | |
1300 | - if (empty($group_condition_info)) |
|
1301 | - continue; |
|
1302 | - if (empty($group_condition_info["conditionexpression"])) |
|
1303 | - continue; // Case when the group doesn't have any column criteria |
|
1321 | + if (empty($group_condition_info)) { |
|
1322 | + continue; |
|
1323 | + } |
|
1324 | + if (empty($group_condition_info["conditionexpression"])) { |
|
1325 | + continue; |
|
1326 | + } |
|
1327 | + // Case when the group doesn't have any column criteria |
|
1304 | 1328 | |
1305 | 1329 | $irelcriteriagroupsql = "insert into vtiger_relcriteria_grouping(GROUPID,QUERYID,GROUP_CONDITION,CONDITION_EXPRESSION) values (?,?,?,?)"; |
1306 | 1330 | $irelcriteriagroupresult = $adb->pquery($irelcriteriagroupsql, array($group_index, $reportid, $group_condition_info["groupcondition"], $group_condition_info["conditionexpression"])); |
@@ -340,6 +340,9 @@ |
||
340 | 340 | return $rolesAndSubHTML; |
341 | 341 | } |
342 | 342 | |
343 | + /** |
|
344 | + * @param Users $user |
|
345 | + */ |
|
343 | 346 | public static function getScheduledReports($adb, $user) |
344 | 347 | { |
345 | 348 |
@@ -258,8 +258,9 @@ discard block |
||
258 | 258 | public static function generateRecipientOption($type, $value, $name = '') |
259 | 259 | { |
260 | 260 | switch ($type) { |
261 | - case 'users' : if (empty($name)) |
|
262 | - $name = \includes\fields\Owner::getUserLabel($value); |
|
261 | + case 'users' : if (empty($name)) { |
|
262 | + $name = \includes\fields\Owner::getUserLabel($value); |
|
263 | + } |
|
263 | 264 | $optionName = 'User::' . addslashes(decode_html($name)); |
264 | 265 | $optionValue = 'users::' . $value; |
265 | 266 | break; |
@@ -269,13 +270,15 @@ discard block |
||
269 | 270 | $optionName = 'Group::' . addslashes(decode_html($name)); |
270 | 271 | $optionValue = 'groups::' . $value; |
271 | 272 | break; |
272 | - case 'roles' : if (empty($name)) |
|
273 | - $name = \App\PrivilegeUtil::getRoleName($value); |
|
273 | + case 'roles' : if (empty($name)) { |
|
274 | + $name = \App\PrivilegeUtil::getRoleName($value); |
|
275 | + } |
|
274 | 276 | $optionName = 'Roles::' . addslashes(decode_html($name)); |
275 | 277 | $optionValue = 'roles::' . $value; |
276 | 278 | break; |
277 | - case 'rs' : if (empty($name)) |
|
278 | - $name = \App\PrivilegeUtil::getRoleName($value); |
|
279 | + case 'rs' : if (empty($name)) { |
|
280 | + $name = \App\PrivilegeUtil::getRoleName($value); |
|
281 | + } |
|
279 | 282 | $optionName = 'RoleAndSubordinates::' . addslashes(decode_html($name)); |
280 | 283 | $optionValue = 'rs::' . $value; |
281 | 284 | break; |
@@ -375,10 +378,12 @@ discard block |
||
375 | 378 | |
376 | 379 | $currentModule = vglobal('currentModule'); |
377 | 380 | $current_language = vglobal('current_language'); |
378 | - if (empty($currentModule)) |
|
379 | - $currentModule = 'Reports'; |
|
380 | - if (empty($current_language)) |
|
381 | - vglobal('current_language', 'en_us'); |
|
381 | + if (empty($currentModule)) { |
|
382 | + $currentModule = 'Reports'; |
|
383 | + } |
|
384 | + if (empty($current_language)) { |
|
385 | + vglobal('current_language', 'en_us'); |
|
386 | + } |
|
382 | 387 | |
383 | 388 | $scheduledReports = self::getScheduledReports($adb, $adminUser); |
384 | 389 | foreach ($scheduledReports as $scheduledReport) { |