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