@@ -233,8 +233,9 @@ discard block |
||
| 233 | 233 | $query = "SELECT vtiger_crmentity.*, $this->table_name.*"; |
| 234 | 234 | |
| 235 | 235 | // Select Custom Field Table Columns if present |
| 236 | - if (!empty($this->customFieldTable)) |
|
| 237 | - $query .= ", " . $this->customFieldTable[0] . ".* "; |
|
| 236 | + if (!empty($this->customFieldTable)) { |
|
| 237 | + $query .= ", " . $this->customFieldTable[0] . ".* "; |
|
| 238 | + } |
|
| 238 | 239 | |
| 239 | 240 | $query .= " FROM $this->table_name"; |
| 240 | 241 | |
@@ -327,10 +328,11 @@ discard block |
||
| 327 | 328 | $query .= $this->getNonAdminAccessControlQuery('Services', $current_user); |
| 328 | 329 | $where_auto = " vtiger_crmentity.deleted=0"; |
| 329 | 330 | |
| 330 | - if ($where != '') |
|
| 331 | - $query .= " WHERE ($where) && $where_auto"; |
|
| 332 | - else |
|
| 333 | - $query .= " WHERE $where_auto"; |
|
| 331 | + if ($where != '') { |
|
| 332 | + $query .= " WHERE ($where) && $where_auto"; |
|
| 333 | + } else { |
|
| 334 | + $query .= " WHERE $where_auto"; |
|
| 335 | + } |
|
| 334 | 336 | |
| 335 | 337 | return $query; |
| 336 | 338 | } |
@@ -351,8 +353,9 @@ discard block |
||
| 351 | 353 | $select_clause = sprintf("SELECT %s.%s AS recordid, vtiger_users_last_import.deleted,%s", $this->table_name, $this->table_index, $table_cols); |
| 352 | 354 | |
| 353 | 355 | // Select Custom Field Table Columns if present |
| 354 | - if (isset($this->customFieldTable)) |
|
| 355 | - $query .= ", " . $this->customFieldTable[0] . ".* "; |
|
| 356 | + if (isset($this->customFieldTable)) { |
|
| 357 | + $query .= ", " . $this->customFieldTable[0] . ".* "; |
|
| 358 | + } |
|
| 356 | 359 | |
| 357 | 360 | $from_clause = " FROM $this->table_name"; |
| 358 | 361 | |
@@ -426,15 +429,17 @@ discard block |
||
| 426 | 429 | $focus = new $related_module(); |
| 427 | 430 | $singular_modname = vtlib_toSingular($related_module); |
| 428 | 431 | |
| 429 | - if ($singlepane_view == 'true') |
|
| 430 | - $returnset = "&return_module=$currentModule&return_action=DetailView&return_id=$id"; |
|
| 431 | - else |
|
| 432 | - $returnset = "&return_module=$currentModule&return_action=CallRelatedList&return_id=$id"; |
|
| 432 | + if ($singlepane_view == 'true') { |
|
| 433 | + $returnset = "&return_module=$currentModule&return_action=DetailView&return_id=$id"; |
|
| 434 | + } else { |
|
| 435 | + $returnset = "&return_module=$currentModule&return_action=CallRelatedList&return_id=$id"; |
|
| 436 | + } |
|
| 433 | 437 | |
| 434 | 438 | $button = ''; |
| 435 | 439 | if ($actions) { |
| 436 | - if (is_string($actions)) |
|
| 437 | - $actions = explode(',', strtoupper($actions)); |
|
| 440 | + if (is_string($actions)) { |
|
| 441 | + $actions = explode(',', strtoupper($actions)); |
|
| 442 | + } |
|
| 438 | 443 | if (in_array('SELECT', $actions) && isPermitted($related_module, 1, '') == 'yes' && isPermitted($currentModule, 'EditView', $id) == 'yes') { |
| 439 | 444 | $button .= "<input title='" . \includes\Language::translate('LBL_ADD_TO') . " " . \includes\Language::translate($related_module) . "' class='crmbutton small create'" . |
| 440 | 445 | " onclick='this.form.action.value=\"AddServiceToPriceBooks\";this.form.module.value=\"$currentModule\"' type='submit' name='button'" . |
@@ -458,8 +463,9 @@ discard block |
||
| 458 | 463 | |
| 459 | 464 | $return_value = GetRelatedList($currentModule, $related_module, $focus, $query, $button, $returnset); |
| 460 | 465 | |
| 461 | - if ($return_value === null) |
|
| 462 | - $return_value = Array(); |
|
| 466 | + if ($return_value === null) { |
|
| 467 | + $return_value = Array(); |
|
| 468 | + } |
|
| 463 | 469 | $return_value['CUSTOM_BUTTON'] = $button; |
| 464 | 470 | |
| 465 | 471 | $log->debug("Exiting get_service_pricebooks method ..."); |
@@ -517,20 +523,23 @@ discard block |
||
| 517 | 523 | |
| 518 | 524 | $limit_start_rec = ($start - 1) * $listMaxEntriesPerPage; |
| 519 | 525 | |
| 520 | - if ($adb->isPostgres()) |
|
| 521 | - $list_result = $adb->pquery($query . |
|
| 526 | + if ($adb->isPostgres()) { |
|
| 527 | + $list_result = $adb->pquery($query . |
|
| 522 | 528 | " OFFSET $limit_start_rec LIMIT $listMaxEntriesPerPage", array()); |
| 523 | - else |
|
| 524 | - $list_result = $adb->pquery($query . |
|
| 529 | + } else { |
|
| 530 | + $list_result = $adb->pquery($query . |
|
| 525 | 531 | " LIMIT $limit_start_rec, $listMaxEntriesPerPage", array()); |
| 532 | + } |
|
| 526 | 533 | |
| 527 | 534 | $header = array(); |
| 528 | 535 | $header[] = $current_module_strings['LBL_LIST_SERVICE_NAME']; |
| 529 | - if (getFieldVisibilityPermission('Services', $current_user->id, 'unit_price') == '0') |
|
| 530 | - $header[] = $current_module_strings['LBL_SERVICE_UNIT_PRICE']; |
|
| 536 | + if (getFieldVisibilityPermission('Services', $current_user->id, 'unit_price') == '0') { |
|
| 537 | + $header[] = $current_module_strings['LBL_SERVICE_UNIT_PRICE']; |
|
| 538 | + } |
|
| 531 | 539 | $header[] = $current_module_strings['LBL_PB_LIST_PRICE']; |
| 532 | - if (isPermitted("PriceBooks", "EditView", "") == 'yes' || isPermitted("PriceBooks", "Delete", "") == 'yes') |
|
| 533 | - $header[] = \includes\Language::translate('LBL_ACTION'); |
|
| 540 | + if (isPermitted("PriceBooks", "EditView", "") == 'yes' || isPermitted("PriceBooks", "Delete", "") == 'yes') { |
|
| 541 | + $header[] = \includes\Language::translate('LBL_ACTION'); |
|
| 542 | + } |
|
| 534 | 543 | |
| 535 | 544 | $currency_id = $focus->column_fields['currency_id']; |
| 536 | 545 | $numRows = $adb->num_rows($list_result); |
@@ -546,8 +555,9 @@ discard block |
||
| 546 | 555 | |
| 547 | 556 | $entries = Array(); |
| 548 | 557 | $entries[] = textlength_check($adb->query_result($list_result, $i, "servicename")); |
| 549 | - if (getFieldVisibilityPermission('Services', $current_user->id, 'unit_price') == '0') |
|
| 550 | - $entries[] = CurrencyField::convertToUserFormat($unit_price, null, true); |
|
| 558 | + if (getFieldVisibilityPermission('Services', $current_user->id, 'unit_price') == '0') { |
|
| 559 | + $entries[] = CurrencyField::convertToUserFormat($unit_price, null, true); |
|
| 560 | + } |
|
| 551 | 561 | |
| 552 | 562 | $entries[] = CurrencyField::convertToUserFormat($listprice, null, true); |
| 553 | 563 | $action = ""; |
@@ -557,12 +567,14 @@ discard block |
||
| 557 | 567 | $action .= '<img src="' . vtiger_imageurl('blank.gif', $theme) . '" border="0" />'; |
| 558 | 568 | } |
| 559 | 569 | if (isPermitted("PriceBooks", "Delete", "") == 'yes' && isPermitted('Services', 'Delete', $entity_id) == 'yes') { |
| 560 | - if ($action != "") |
|
| 561 | - $action .= ' | '; |
|
| 570 | + if ($action != "") { |
|
| 571 | + $action .= ' | '; |
|
| 572 | + } |
|
| 562 | 573 | $action .= '<img src="themes/images/delete.gif" onclick="if(confirm(\'' . \includes\Language::translate('ARE_YOU_SURE') . '\')) deletePriceBookProductRel(' . $entity_id . ',' . $pricebook_id . ');" alt="' . \includes\Language::translate('LBL_DELETE') . '" title="' . \includes\Language::translate('LBL_DELETE') . '" style="cursor:pointer;" border="0">'; |
| 563 | 574 | } |
| 564 | - if ($action != "") |
|
| 565 | - $entries[] = $action; |
|
| 575 | + if ($action != "") { |
|
| 576 | + $entries[] = $action; |
|
| 577 | + } |
|
| 566 | 578 | $entries_list[] = $entries; |
| 567 | 579 | } |
| 568 | 580 | $navigationOutput[] = getRecordRangeMessage($list_result, $limit_start_rec, $noofrows); |
@@ -834,16 +846,18 @@ discard block |
||
| 834 | 846 | vtlib_setup_modulevars($related_module, $other); |
| 835 | 847 | $singular_modname = vtlib_toSingular($related_module); |
| 836 | 848 | |
| 837 | - if ($singlepane_view == 'true') |
|
| 838 | - $returnset = '&return_module=' . $this_module . '&return_action=DetailView&return_id=' . $id; |
|
| 839 | - else |
|
| 840 | - $returnset = '&return_module=' . $this_module . '&return_action=CallRelatedList&return_id=' . $id; |
|
| 849 | + if ($singlepane_view == 'true') { |
|
| 850 | + $returnset = '&return_module=' . $this_module . '&return_action=DetailView&return_id=' . $id; |
|
| 851 | + } else { |
|
| 852 | + $returnset = '&return_module=' . $this_module . '&return_action=CallRelatedList&return_id=' . $id; |
|
| 853 | + } |
|
| 841 | 854 | |
| 842 | 855 | $button = ''; |
| 843 | 856 | |
| 844 | 857 | if ($actions && $this->ismember_check() === 0) { |
| 845 | - if (is_string($actions)) |
|
| 846 | - $actions = explode(',', strtoupper($actions)); |
|
| 858 | + if (is_string($actions)) { |
|
| 859 | + $actions = explode(',', strtoupper($actions)); |
|
| 860 | + } |
|
| 847 | 861 | if (in_array('SELECT', $actions) && isPermitted($related_module, 4, '') == 'yes') { |
| 848 | 862 | $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) . "'> "; |
| 849 | 863 | } |
@@ -872,8 +886,9 @@ discard block |
||
| 872 | 886 | |
| 873 | 887 | $return_value = GetRelatedList($this_module, $related_module, $other, $query, $button, $returnset); |
| 874 | 888 | |
| 875 | - if ($return_value === null) |
|
| 876 | - $return_value = Array(); |
|
| 889 | + if ($return_value === null) { |
|
| 890 | + $return_value = Array(); |
|
| 891 | + } |
|
| 877 | 892 | $return_value['CUSTOM_BUTTON'] = $button; |
| 878 | 893 | |
| 879 | 894 | $log->debug("Exiting get_products method ..."); |
@@ -67,8 +67,9 @@ discard block |
||
| 67 | 67 | $log = LoggerManager::getInstance(); |
| 68 | 68 | $adb = PearDatabase::getInstance(); |
| 69 | 69 | $insertion_mode = $this->mode; |
| 70 | - if (isset($this->parentid) && $this->parentid != '') |
|
| 71 | - $relid = $this->parentid; |
|
| 70 | + if (isset($this->parentid) && $this->parentid != '') { |
|
| 71 | + $relid = $this->parentid; |
|
| 72 | + } |
|
| 72 | 73 | //inserting into vtiger_senotesrel |
| 73 | 74 | if (isset($relid) && $relid != '') { |
| 74 | 75 | $this->insertintonotesrel($relid, $this->id); |
@@ -172,10 +173,11 @@ discard block |
||
| 172 | 173 | { |
| 173 | 174 | $log = LoggerManager::getInstance(); |
| 174 | 175 | $log->debug('Entering getSortOrder() method ...'); |
| 175 | - if (AppRequest::has('sorder')) |
|
| 176 | - $sorder = $this->db->sql_escape_string(AppRequest::get('sorder')); |
|
| 177 | - else |
|
| 178 | - $sorder = (($_SESSION['NOTES_SORT_ORDER'] != '') ? ($_SESSION['NOTES_SORT_ORDER']) : ($this->default_sort_order)); |
|
| 176 | + if (AppRequest::has('sorder')) { |
|
| 177 | + $sorder = $this->db->sql_escape_string(AppRequest::get('sorder')); |
|
| 178 | + } else { |
|
| 179 | + $sorder = (($_SESSION['NOTES_SORT_ORDER'] != '') ? ($_SESSION['NOTES_SORT_ORDER']) : ($this->default_sort_order)); |
|
| 180 | + } |
|
| 179 | 181 | $log->debug('Exiting getSortOrder() method ...'); |
| 180 | 182 | return $sorder; |
| 181 | 183 | } |
@@ -193,10 +195,11 @@ discard block |
||
| 193 | 195 | $use_default_order_by = $this->default_order_by; |
| 194 | 196 | } |
| 195 | 197 | |
| 196 | - if (AppRequest::has('order_by')) |
|
| 197 | - $order_by = $this->db->sql_escape_string(AppRequest::get('order_by')); |
|
| 198 | - else |
|
| 199 | - $order_by = (($_SESSION['NOTES_ORDER_BY'] != '') ? ($_SESSION['NOTES_ORDER_BY']) : ($use_default_order_by)); |
|
| 198 | + if (AppRequest::has('order_by')) { |
|
| 199 | + $order_by = $this->db->sql_escape_string(AppRequest::get('order_by')); |
|
| 200 | + } else { |
|
| 201 | + $order_by = (($_SESSION['NOTES_ORDER_BY'] != '') ? ($_SESSION['NOTES_ORDER_BY']) : ($use_default_order_by)); |
|
| 202 | + } |
|
| 200 | 203 | $log->debug('Exiting getOrderBy method ...'); |
| 201 | 204 | return $order_by; |
| 202 | 205 | } |
@@ -266,10 +269,11 @@ discard block |
||
| 266 | 269 | ; |
| 267 | 270 | $query .= getNonAdminAccessControlQuery('Documents', $current_user); |
| 268 | 271 | $where_auto = " vtiger_crmentity.deleted=0"; |
| 269 | - if ($where != "") |
|
| 270 | - $query .= " WHERE ($where) && " . $where_auto; |
|
| 271 | - else |
|
| 272 | - $query .= ' WHERE %s'; |
|
| 272 | + if ($where != "") { |
|
| 273 | + $query .= " WHERE ($where) && " . $where_auto; |
|
| 274 | + } else { |
|
| 275 | + $query .= ' WHERE %s'; |
|
| 276 | + } |
|
| 273 | 277 | |
| 274 | 278 | $query = sprintf($query, $where_auto); |
| 275 | 279 | $log->debug("Exiting create_export_query method ..."); |
@@ -395,8 +399,9 @@ discard block |
||
| 395 | 399 | public function unlinkRelationship($id, $returnModule, $returnId, $relatedName = false) |
| 396 | 400 | { |
| 397 | 401 | $log = LoggerManager::getInstance(); |
| 398 | - if (empty($returnModule) || empty($returnId)) |
|
| 399 | - return; |
|
| 402 | + if (empty($returnModule) || empty($returnId)) { |
|
| 403 | + return; |
|
| 404 | + } |
|
| 400 | 405 | |
| 401 | 406 | if ($returnModule == 'Accounts') { |
| 402 | 407 | $sql = 'DELETE FROM vtiger_senotesrel WHERE notesid = ? && (crmid = ? || crmid IN (SELECT contactid FROM vtiger_contactdetails WHERE parentid=?))'; |
@@ -458,8 +463,9 @@ discard block |
||
| 458 | 463 | { |
| 459 | 464 | $adb = PearDatabase::getInstance(); |
| 460 | 465 | $result = $adb->pquery("SELECT tree FROM `vtiger_trees_templates_data` WHERE tree = ?", array($folderid)); |
| 461 | - if (!empty($result) && $adb->num_rows($result) > 0) |
|
| 462 | - return true; |
|
| 466 | + if (!empty($result) && $adb->num_rows($result) > 0) { |
|
| 467 | + return true; |
|
| 468 | + } |
|
| 463 | 469 | return false; |
| 464 | 470 | } |
| 465 | 471 | |
@@ -510,10 +516,11 @@ discard block |
||
| 510 | 516 | vtlib_setup_modulevars($relatedModule, $other); |
| 511 | 517 | |
| 512 | 518 | // To make the edit or del link actions to return back to same view. |
| 513 | - if ($singlepane_view == 'true') |
|
| 514 | - $returnset = "&return_module=$thisModule&return_action=DetailView&return_id=$id"; |
|
| 515 | - else |
|
| 516 | - $returnset = "&return_module=$thisModule&return_action=CallRelatedList&return_id=$id"; |
|
| 519 | + if ($singlepane_view == 'true') { |
|
| 520 | + $returnset = "&return_module=$thisModule&return_action=DetailView&return_id=$id"; |
|
| 521 | + } else { |
|
| 522 | + $returnset = "&return_module=$thisModule&return_action=CallRelatedList&return_id=$id"; |
|
| 523 | + } |
|
| 517 | 524 | |
| 518 | 525 | $joinTables = []; |
| 519 | 526 | $join = ''; |
@@ -533,10 +540,12 @@ discard block |
||
| 533 | 540 | continue; |
| 534 | 541 | } |
| 535 | 542 | // Setup the default JOIN conditions if not specified |
| 536 | - if (empty($relmap[1])) |
|
| 537 | - $relmap[1] = $other->table_name; |
|
| 538 | - if (empty($relmap[2])) |
|
| 539 | - $relmap[2] = $relmap[0]; |
|
| 543 | + if (empty($relmap[1])) { |
|
| 544 | + $relmap[1] = $other->table_name; |
|
| 545 | + } |
|
| 546 | + if (empty($relmap[2])) { |
|
| 547 | + $relmap[2] = $relmap[0]; |
|
| 548 | + } |
|
| 540 | 549 | $join .= " LEFT JOIN $tname ON $tname.$relmap[0] = $relmap[1].$relmap[2]"; |
| 541 | 550 | } |
| 542 | 551 | } |
@@ -554,8 +563,9 @@ discard block |
||
| 554 | 563 | |
| 555 | 564 | $query = sprintf($query, $other->table_name); |
| 556 | 565 | $returnValue = GetRelatedList($thisModule, $relatedModule, $other, $query, $button, $returnset); |
| 557 | - if ($returnValue === null) |
|
| 558 | - $returnValue = []; |
|
| 566 | + if ($returnValue === null) { |
|
| 567 | + $returnValue = []; |
|
| 568 | + } |
|
| 559 | 569 | $returnValue['CUSTOM_BUTTON'] = $button; |
| 560 | 570 | return $returnValue; |
| 561 | 571 | } |
@@ -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') { |
@@ -89,16 +89,18 @@ discard block |
||
| 89 | 89 | vtlib_setup_modulevars($related_module, $other); |
| 90 | 90 | $singular_modname = vtlib_toSingular($related_module); |
| 91 | 91 | |
| 92 | - if ($singlepane_view == 'true') |
|
| 93 | - $returnset = '&return_module=' . $this_module . '&return_action=DetailView&return_id=' . $id; |
|
| 94 | - else |
|
| 95 | - $returnset = '&return_module=' . $this_module . '&return_action=CallRelatedList&return_id=' . $id; |
|
| 92 | + if ($singlepane_view == 'true') { |
|
| 93 | + $returnset = '&return_module=' . $this_module . '&return_action=DetailView&return_id=' . $id; |
|
| 94 | + } else { |
|
| 95 | + $returnset = '&return_module=' . $this_module . '&return_action=CallRelatedList&return_id=' . $id; |
|
| 96 | + } |
|
| 96 | 97 | |
| 97 | 98 | $button = ''; |
| 98 | 99 | |
| 99 | 100 | if ($actions) { |
| 100 | - if (is_string($actions)) |
|
| 101 | - $actions = explode(',', strtoupper($actions)); |
|
| 101 | + if (is_string($actions)) { |
|
| 102 | + $actions = explode(',', strtoupper($actions)); |
|
| 103 | + } |
|
| 102 | 104 | if (in_array('SELECT', $actions) && isPermitted($related_module, 4, '') == 'yes') { |
| 103 | 105 | $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) . "'> "; |
| 104 | 106 | } |
@@ -124,8 +126,9 @@ discard block |
||
| 124 | 126 | |
| 125 | 127 | $return_value = GetRelatedList($this_module, $related_module, $other, $query, $button, $returnset); |
| 126 | 128 | |
| 127 | - if ($return_value === null) |
|
| 128 | - $return_value = Array(); |
|
| 129 | + if ($return_value === null) { |
|
| 130 | + $return_value = Array(); |
|
| 131 | + } |
|
| 129 | 132 | $return_value['CUSTOM_BUTTON'] = $button; |
| 130 | 133 | |
| 131 | 134 | $log->debug("Exiting get_products method ..."); |
@@ -163,10 +166,11 @@ discard block |
||
| 163 | 166 | "; |
| 164 | 167 | $where_auto = " vtiger_crmentity.deleted = 0 "; |
| 165 | 168 | |
| 166 | - if ($where != "") |
|
| 167 | - $query .= sprintf(" WHERE (%s) && %s", $where, $where_auto); |
|
| 168 | - else |
|
| 169 | - $query .= sprintf(" WHERE %s", $where_auto); |
|
| 169 | + if ($where != "") { |
|
| 170 | + $query .= sprintf(" WHERE (%s) && %s", $where, $where_auto); |
|
| 171 | + } else { |
|
| 172 | + $query .= sprintf(" WHERE %s", $where_auto); |
|
| 173 | + } |
|
| 170 | 174 | |
| 171 | 175 | $log->debug("Exiting create_export_query method ..."); |
| 172 | 176 | return $query; |
@@ -192,16 +196,18 @@ discard block |
||
| 192 | 196 | vtlib_setup_modulevars($related_module, $other); |
| 193 | 197 | $singular_modname = vtlib_toSingular($related_module); |
| 194 | 198 | |
| 195 | - if ($singlepane_view == 'true') |
|
| 196 | - $returnset = '&return_module=' . $this_module . '&return_action=DetailView&return_id=' . $id; |
|
| 197 | - else |
|
| 198 | - $returnset = '&return_module=' . $this_module . '&return_action=CallRelatedList&return_id=' . $id; |
|
| 199 | + if ($singlepane_view == 'true') { |
|
| 200 | + $returnset = '&return_module=' . $this_module . '&return_action=DetailView&return_id=' . $id; |
|
| 201 | + } else { |
|
| 202 | + $returnset = '&return_module=' . $this_module . '&return_action=CallRelatedList&return_id=' . $id; |
|
| 203 | + } |
|
| 199 | 204 | |
| 200 | 205 | $button = ''; |
| 201 | 206 | |
| 202 | 207 | if ($actions) { |
| 203 | - if (is_string($actions)) |
|
| 204 | - $actions = explode(',', strtoupper($actions)); |
|
| 208 | + if (is_string($actions)) { |
|
| 209 | + $actions = explode(',', strtoupper($actions)); |
|
| 210 | + } |
|
| 205 | 211 | if (in_array('SELECT', $actions) && isPermitted($related_module, 4, '') == 'yes') { |
| 206 | 212 | $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) . "'> "; |
| 207 | 213 | } |
@@ -228,8 +234,9 @@ discard block |
||
| 228 | 234 | |
| 229 | 235 | $return_value = GetRelatedList($this_module, $related_module, $other, $query, $button, $returnset); |
| 230 | 236 | |
| 231 | - if ($return_value === null) |
|
| 232 | - $return_value = Array(); |
|
| 237 | + if ($return_value === null) { |
|
| 238 | + $return_value = Array(); |
|
| 239 | + } |
|
| 233 | 240 | $return_value['CUSTOM_BUTTON'] = $button; |
| 234 | 241 | |
| 235 | 242 | $log->debug("Exiting get_contacts method ..."); |
@@ -255,18 +262,20 @@ discard block |
||
| 255 | 262 | vtlib_setup_modulevars($related_module, $other); |
| 256 | 263 | $singular_modname = vtlib_toSingular($related_module); |
| 257 | 264 | |
| 258 | - if ($singlepane_view == 'true') |
|
| 259 | - $returnset = '&return_module=' . $this_module . '&return_action=DetailView&return_id=' . $id; |
|
| 260 | - else |
|
| 261 | - $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 | + } |
|
| 262 | 270 | |
| 263 | 271 | $button = ''; |
| 264 | 272 | |
| 265 | 273 | $button .= '<input type="hidden" name="email_directing_module"><input type="hidden" name="record">'; |
| 266 | 274 | |
| 267 | 275 | if ($actions) { |
| 268 | - if (is_string($actions)) |
|
| 269 | - $actions = explode(',', strtoupper($actions)); |
|
| 276 | + if (is_string($actions)) { |
|
| 277 | + $actions = explode(',', strtoupper($actions)); |
|
| 278 | + } |
|
| 270 | 279 | if (in_array('SELECT', $actions) && isPermitted($related_module, 4, '') == 'yes') { |
| 271 | 280 | $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) . "'> "; |
| 272 | 281 | } |
@@ -287,8 +296,9 @@ discard block |
||
| 287 | 296 | |
| 288 | 297 | $return_value = GetRelatedList($this_module, $related_module, $other, $query, $button, $returnset); |
| 289 | 298 | |
| 290 | - if ($return_value === null) |
|
| 291 | - $return_value = Array(); |
|
| 299 | + if ($return_value === null) { |
|
| 300 | + $return_value = Array(); |
|
| 301 | + } |
|
| 292 | 302 | $return_value['CUSTOM_BUTTON'] = $button; |
| 293 | 303 | |
| 294 | 304 | $log->debug("Exiting get_campaigns method ..."); |
@@ -451,8 +461,9 @@ discard block |
||
| 451 | 461 | public function save_related_module($module, $crmid, $with_module, $with_crmids, $relatedName = false) |
| 452 | 462 | { |
| 453 | 463 | $adb = PearDatabase::getInstance(); |
| 454 | - if (!is_array($with_crmids)) |
|
| 455 | - $with_crmids = [$with_crmids]; |
|
| 464 | + if (!is_array($with_crmids)) { |
|
| 465 | + $with_crmids = [$with_crmids]; |
|
| 466 | + } |
|
| 456 | 467 | if (!in_array($with_module, ['Contacts', 'Products', 'Campaigns'])) { |
| 457 | 468 | parent::save_related_module($module, $crmid, $with_module, $with_crmids, $relatedName); |
| 458 | 469 | } else { |
@@ -476,8 +487,9 @@ discard block |
||
| 476 | 487 | public function unlinkRelationship($id, $return_module, $return_id, $relatedName = false) |
| 477 | 488 | { |
| 478 | 489 | $log = vglobal('log'); |
| 479 | - if (empty($return_module) || empty($return_id)) |
|
| 480 | - return; |
|
| 490 | + if (empty($return_module) || empty($return_id)) { |
|
| 491 | + return; |
|
| 492 | + } |
|
| 481 | 493 | if ($return_module == 'Campaigns') { |
| 482 | 494 | $this->db->delete('vtiger_campaign_records', 'crmid=? && campaignid=?', [$id, $return_id]); |
| 483 | 495 | } elseif ($return_module == 'Contacts') { |
@@ -99,10 +99,11 @@ discard block |
||
| 99 | 99 | vtlib_setup_modulevars($related_module, $other); |
| 100 | 100 | $singular_modname = vtlib_toSingular($related_module); |
| 101 | 101 | |
| 102 | - if ($singlepane_view == 'true') |
|
| 103 | - $returnset = '&return_module=' . $this_module . '&return_action=DetailView&return_id=' . $id; |
|
| 104 | - else |
|
| 105 | - $returnset = '&return_module=' . $this_module . '&return_action=CallRelatedList&return_id=' . $id; |
|
| 102 | + if ($singlepane_view == 'true') { |
|
| 103 | + $returnset = '&return_module=' . $this_module . '&return_action=DetailView&return_id=' . $id; |
|
| 104 | + } else { |
|
| 105 | + $returnset = '&return_module=' . $this_module . '&return_action=CallRelatedList&return_id=' . $id; |
|
| 106 | + } |
|
| 106 | 107 | |
| 107 | 108 | $button = ''; |
| 108 | 109 | |
@@ -124,8 +125,9 @@ discard block |
||
| 124 | 125 | $button .= '  '; |
| 125 | 126 | |
| 126 | 127 | if ($actions) { |
| 127 | - if (is_string($actions)) |
|
| 128 | - $actions = explode(',', strtoupper($actions)); |
|
| 128 | + if (is_string($actions)) { |
|
| 129 | + $actions = explode(',', strtoupper($actions)); |
|
| 130 | + } |
|
| 129 | 131 | if (in_array('SELECT', $actions) && isPermitted($related_module, 4, '') == 'yes') { |
| 130 | 132 | $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) . "'> "; |
| 131 | 133 | } |
@@ -148,10 +150,12 @@ discard block |
||
| 148 | 150 | foreach ($other->related_tables as $tname => $relmap) { |
| 149 | 151 | $query .= ", $tname.*"; |
| 150 | 152 | // Setup the default JOIN conditions if not specified |
| 151 | - if (empty($relmap[1])) |
|
| 152 | - $relmap[1] = $other->table_name; |
|
| 153 | - if (empty($relmap[2])) |
|
| 154 | - $relmap[2] = $relmap[0]; |
|
| 153 | + if (empty($relmap[1])) { |
|
| 154 | + $relmap[1] = $other->table_name; |
|
| 155 | + } |
|
| 156 | + if (empty($relmap[2])) { |
|
| 157 | + $relmap[2] = $relmap[0]; |
|
| 158 | + } |
|
| 155 | 159 | $moreRelation .= " LEFT JOIN $tname ON $tname.$relmap[0] = $relmap[1].$relmap[2]"; |
| 156 | 160 | } |
| 157 | 161 | } |
@@ -168,9 +172,9 @@ discard block |
||
| 168 | 172 | $query = sprintf($query, $id); |
| 169 | 173 | $return_value = GetRelatedList($this_module, $related_module, $other, $query, $button, $returnset); |
| 170 | 174 | |
| 171 | - if ($return_value === null) |
|
| 172 | - $return_value = Array(); |
|
| 173 | - else if ($is_CampaignStatusAllowed) { |
|
| 175 | + if ($return_value === null) { |
|
| 176 | + $return_value = Array(); |
|
| 177 | + } else if ($is_CampaignStatusAllowed) { |
|
| 174 | 178 | $statusPos = count($return_value['header']) - 2; // Last column is for Actions, exclude that. Also the index starts from 0, so reduce one more count. |
| 175 | 179 | $return_value = $this->add_status_popup($return_value, $statusPos, $related_module); |
| 176 | 180 | } |
@@ -279,8 +283,9 @@ discard block |
||
| 279 | 283 | public function unlinkRelationship($id, $returnModule, $returnId, $relatedName = false) |
| 280 | 284 | { |
| 281 | 285 | $log = vglobal('log'); |
| 282 | - if (empty($returnModule) || empty($returnId)) |
|
| 283 | - return; |
|
| 286 | + if (empty($returnModule) || empty($returnId)) { |
|
| 287 | + return; |
|
| 288 | + } |
|
| 284 | 289 | |
| 285 | 290 | if (in_array($returnModule, ['Leads', 'Vendors', 'Contacts', 'Partners', 'Competition'])) { |
| 286 | 291 | $this->db->delete('vtiger_campaign_records', 'campaignid=? && crmid=?', [$id, $returnId]); |
@@ -297,8 +302,9 @@ discard block |
||
| 297 | 302 | { |
| 298 | 303 | $adb = PearDatabase::getInstance(); |
| 299 | 304 | |
| 300 | - if (!is_array($withCrmids)) |
|
| 301 | - $withCrmids = [$withCrmids]; |
|
| 305 | + if (!is_array($withCrmids)) { |
|
| 306 | + $withCrmids = [$withCrmids]; |
|
| 307 | + } |
|
| 302 | 308 | if (!in_array($withModule, ['Accounts', 'Leads', 'Vendors', 'Contacts', 'Partners', 'Competition'])) { |
| 303 | 309 | parent::save_related_module($module, $crmid, $withModule, $withCrmids, $relatedName); |
| 304 | 310 | } else { |
@@ -179,16 +179,18 @@ discard block |
||
| 179 | 179 | $filepart = $file_details['part']; |
| 180 | 180 | $transfer = $file_details['transfer']; |
| 181 | 181 | $file = imap_fetchbody($mail, $_REQUEST['mailid'], $filepart); |
| 182 | - if ($transfer == 'BASE64') |
|
| 183 | - $file = imap_base64($file); |
|
| 184 | - elseif ($transfer == 'QUOTED-PRINTABLE') |
|
| 185 | - $file = imap_qprint($file); |
|
| 182 | + if ($transfer == 'BASE64') { |
|
| 183 | + $file = imap_base64($file); |
|
| 184 | + } elseif ($transfer == 'QUOTED-PRINTABLE') { |
|
| 185 | + $file = imap_qprint($file); |
|
| 186 | + } |
|
| 186 | 187 | $current_id = $adb->getUniqueID("vtiger_crmentity"); |
| 187 | 188 | $date_var = date('Y-m-d H:i:s'); |
| 188 | 189 | //to get the owner id |
| 189 | 190 | $ownerid = $this->column_fields['assigned_user_id']; |
| 190 | - if (!isset($ownerid) || $ownerid == '') |
|
| 191 | - $ownerid = $current_user->id; |
|
| 191 | + if (!isset($ownerid) || $ownerid == '') { |
|
| 192 | + $ownerid = $current_user->id; |
|
| 193 | + } |
|
| 192 | 194 | $upload_file_path = \vtlib\Functions::initStorageFileDirectory(); |
| 193 | 195 | file_put_contents($upload_file_path . $current_id . "_" . $filename, $file); |
| 194 | 196 | |
@@ -238,8 +240,9 @@ discard block |
||
| 238 | 240 | $button = ''; |
| 239 | 241 | |
| 240 | 242 | if ($actions) { |
| 241 | - if (is_string($actions)) |
|
| 242 | - $actions = explode(',', strtoupper($actions)); |
|
| 243 | + if (is_string($actions)) { |
|
| 244 | + $actions = explode(',', strtoupper($actions)); |
|
| 245 | + } |
|
| 243 | 246 | if (in_array('SELECT', $actions) && isPermitted($related_module, 4, '') == 'yes') { |
| 244 | 247 | $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) . "'> "; |
| 245 | 248 | } |
@@ -276,8 +279,9 @@ discard block |
||
| 276 | 279 | |
| 277 | 280 | $return_value = GetRelatedList($this_module, $related_module, $other, $query, $button, $returnset); |
| 278 | 281 | |
| 279 | - if ($return_value === null) |
|
| 280 | - $return_value = Array(); |
|
| 282 | + if ($return_value === null) { |
|
| 283 | + $return_value = Array(); |
|
| 284 | + } |
|
| 281 | 285 | $return_value['CUSTOM_BUTTON'] = $button; |
| 282 | 286 | |
| 283 | 287 | $log->debug("Exiting get_contacts method ..."); |
@@ -293,10 +297,11 @@ discard block |
||
| 293 | 297 | { |
| 294 | 298 | $log = vglobal('log'); |
| 295 | 299 | $log->debug("Entering getSortOrder() method ..."); |
| 296 | - if (isset($_REQUEST['sorder'])) |
|
| 297 | - $sorder = $this->db->sql_escape_string($_REQUEST['sorder']); |
|
| 298 | - else |
|
| 299 | - $sorder = (($_SESSION['EMAILS_SORT_ORDER'] != '') ? ($_SESSION['EMAILS_SORT_ORDER']) : ($this->default_sort_order)); |
|
| 300 | + if (isset($_REQUEST['sorder'])) { |
|
| 301 | + $sorder = $this->db->sql_escape_string($_REQUEST['sorder']); |
|
| 302 | + } else { |
|
| 303 | + $sorder = (($_SESSION['EMAILS_SORT_ORDER'] != '') ? ($_SESSION['EMAILS_SORT_ORDER']) : ($this->default_sort_order)); |
|
| 304 | + } |
|
| 300 | 305 | |
| 301 | 306 | $log->debug("Exiting getSortOrder method ..."); |
| 302 | 307 | return $sorder; |
@@ -317,10 +322,11 @@ discard block |
||
| 317 | 322 | $use_default_order_by = $this->default_order_by; |
| 318 | 323 | } |
| 319 | 324 | |
| 320 | - if (isset($_REQUEST['order_by'])) |
|
| 321 | - $order_by = $this->db->sql_escape_string($_REQUEST['order_by']); |
|
| 322 | - else |
|
| 323 | - $order_by = (($_SESSION['EMAILS_ORDER_BY'] != '') ? ($_SESSION['EMAILS_ORDER_BY']) : ($use_default_order_by)); |
|
| 325 | + if (isset($_REQUEST['order_by'])) { |
|
| 326 | + $order_by = $this->db->sql_escape_string($_REQUEST['order_by']); |
|
| 327 | + } else { |
|
| 328 | + $order_by = (($_SESSION['EMAILS_ORDER_BY'] != '') ? ($_SESSION['EMAILS_ORDER_BY']) : ($use_default_order_by)); |
|
| 329 | + } |
|
| 324 | 330 | |
| 325 | 331 | $log->debug("Exiting getOrderBy method ..."); |
| 326 | 332 | return $order_by; |
@@ -375,25 +381,31 @@ discard block |
||
| 375 | 381 | $entries[] = $row['user_name']; |
| 376 | 382 | $entries[] = $row['email1']; |
| 377 | 383 | $entries[] = $row['phone_home']; |
| 378 | - if ($phone == '') |
|
| 379 | - $phone = $row['phone_work']; |
|
| 380 | - if ($phone == '') |
|
| 381 | - $phone = $row['phone_mobile']; |
|
| 382 | - if ($phone == '') |
|
| 383 | - $phone = $row['phone_other']; |
|
| 384 | - if ($phone == '') |
|
| 385 | - $phone = $row['phone_fax']; |
|
| 384 | + if ($phone == '') { |
|
| 385 | + $phone = $row['phone_work']; |
|
| 386 | + } |
|
| 387 | + if ($phone == '') { |
|
| 388 | + $phone = $row['phone_mobile']; |
|
| 389 | + } |
|
| 390 | + if ($phone == '') { |
|
| 391 | + $phone = $row['phone_other']; |
|
| 392 | + } |
|
| 393 | + if ($phone == '') { |
|
| 394 | + $phone = $row['phone_fax']; |
|
| 395 | + } |
|
| 386 | 396 | |
| 387 | 397 | //Adding Security Check for User |
| 388 | 398 | |
| 389 | 399 | $entries_list[] = $entries; |
| 390 | 400 | } |
| 391 | 401 | |
| 392 | - if ($entries_list != '') |
|
| 393 | - $return_data = array("header" => $header, "entries" => $entries); |
|
| 402 | + if ($entries_list != '') { |
|
| 403 | + $return_data = array("header" => $header, "entries" => $entries); |
|
| 404 | + } |
|
| 394 | 405 | |
| 395 | - if ($return_data === null) |
|
| 396 | - $return_data = Array(); |
|
| 406 | + if ($return_data === null) { |
|
| 407 | + $return_data = Array(); |
|
| 408 | + } |
|
| 397 | 409 | $return_data['CUSTOM_BUTTON'] = $button; |
| 398 | 410 | |
| 399 | 411 | $log->debug("Exiting get_users method ..."); |
@@ -629,8 +641,9 @@ discard block |
||
| 629 | 641 | $date_var = date('Y-m-d H:i:s'); |
| 630 | 642 | |
| 631 | 643 | $ownerid = $obj->column_fields['assigned_user_id']; |
| 632 | - if (!isset($ownerid) || $ownerid == '') |
|
| 633 | - $ownerid = $current_user->id; |
|
| 644 | + if (!isset($ownerid) || $ownerid == '') { |
|
| 645 | + $ownerid = $current_user->id; |
|
| 646 | + } |
|
| 634 | 647 | |
| 635 | 648 | $current_id = $adb->getUniqueID("vtiger_crmentity"); |
| 636 | 649 | |
@@ -111,8 +111,9 @@ discard block |
||
| 111 | 111 | if (isset($this->column_fields['recurringtype']) && $this->column_fields['recurringtype'] != '' && $this->column_fields['recurringtype'] != '--None--') { |
| 112 | 112 | $recur_type = trim($this->column_fields['recurringtype']); |
| 113 | 113 | $recur_data = \vtlib\Functions::getRecurringObjValue(); |
| 114 | - if (is_object($recur_data)) |
|
| 115 | - $this->insertIntoRecurringTable($recur_data); |
|
| 114 | + if (is_object($recur_data)) { |
|
| 115 | + $this->insertIntoRecurringTable($recur_data); |
|
| 116 | + } |
|
| 116 | 117 | } |
| 117 | 118 | |
| 118 | 119 | //Insert into vtiger_activity_remainder table |
@@ -248,10 +249,10 @@ discard block |
||
| 248 | 249 | $sql = 'delete from vtiger_activity_reminder where activity_id=?'; |
| 249 | 250 | $adb->pquery($sql, array($activity_id)); |
| 250 | 251 | $flag = "false"; |
| 251 | - } else |
|
| 252 | - $flag = "false"; |
|
| 253 | - } |
|
| 254 | - else { |
|
| 252 | + } else { |
|
| 253 | + $flag = "false"; |
|
| 254 | + } |
|
| 255 | + } else { |
|
| 255 | 256 | $sql = 'delete from vtiger_activity_reminder where activity_id=?'; |
| 256 | 257 | $adb->pquery($sql, array($activity_id)); |
| 257 | 258 | $sql = 'delete from vtiger_recurringevents where activityid=?'; |
@@ -360,8 +361,9 @@ discard block |
||
| 360 | 361 | */ |
| 361 | 362 | public function getJoinClause($tableName) |
| 362 | 363 | { |
| 363 | - if ($tableName == "vtiger_activity_reminder") |
|
| 364 | - return 'LEFT JOIN'; |
|
| 364 | + if ($tableName == "vtiger_activity_reminder") { |
|
| 365 | + return 'LEFT JOIN'; |
|
| 366 | + } |
|
| 365 | 367 | return parent::getJoinClause($tableName); |
| 366 | 368 | } |
| 367 | 369 | |
@@ -374,10 +376,11 @@ discard block |
||
| 374 | 376 | { |
| 375 | 377 | $log = LoggerManager::getInstance(); |
| 376 | 378 | $log->debug('Entering getSortOrder() method ...'); |
| 377 | - if (AppRequest::has('sorder')) |
|
| 378 | - $sorder = $this->db->sql_escape_string(AppRequest::get('sorder')); |
|
| 379 | - else |
|
| 380 | - $sorder = (($_SESSION['ACTIVITIES_SORT_ORDER'] != '') ? ($_SESSION['ACTIVITIES_SORT_ORDER']) : ($this->default_sort_order)); |
|
| 379 | + if (AppRequest::has('sorder')) { |
|
| 380 | + $sorder = $this->db->sql_escape_string(AppRequest::get('sorder')); |
|
| 381 | + } else { |
|
| 382 | + $sorder = (($_SESSION['ACTIVITIES_SORT_ORDER'] != '') ? ($_SESSION['ACTIVITIES_SORT_ORDER']) : ($this->default_sort_order)); |
|
| 383 | + } |
|
| 381 | 384 | $log->debug('Exiting getSortOrder method ...'); |
| 382 | 385 | return $sorder; |
| 383 | 386 | } |
@@ -396,10 +399,11 @@ discard block |
||
| 396 | 399 | $use_default_order_by = $this->default_order_by; |
| 397 | 400 | } |
| 398 | 401 | |
| 399 | - if (AppRequest::has('order_by')) |
|
| 400 | - $order_by = $this->db->sql_escape_string(AppRequest::get('order_by')); |
|
| 401 | - else |
|
| 402 | - $order_by = (($_SESSION['ACTIVITIES_ORDER_BY'] != '') ? ($_SESSION['ACTIVITIES_ORDER_BY']) : ($use_default_order_by)); |
|
| 402 | + if (AppRequest::has('order_by')) { |
|
| 403 | + $order_by = $this->db->sql_escape_string(AppRequest::get('order_by')); |
|
| 404 | + } else { |
|
| 405 | + $order_by = (($_SESSION['ACTIVITIES_ORDER_BY'] != '') ? ($_SESSION['ACTIVITIES_ORDER_BY']) : ($use_default_order_by)); |
|
| 406 | + } |
|
| 403 | 407 | $log->debug("Exiting getOrderBy method ..."); |
| 404 | 408 | return $order_by; |
| 405 | 409 | } |
@@ -430,8 +434,9 @@ discard block |
||
| 430 | 434 | $button = ''; |
| 431 | 435 | |
| 432 | 436 | if ($actions) { |
| 433 | - if (is_string($actions)) |
|
| 434 | - $actions = explode(',', strtoupper($actions)); |
|
| 437 | + if (is_string($actions)) { |
|
| 438 | + $actions = explode(',', strtoupper($actions)); |
|
| 439 | + } |
|
| 435 | 440 | if (in_array('SELECT', $actions) && isPermitted($related_module, 4, '') == 'yes') { |
| 436 | 441 | $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) . "'> "; |
| 437 | 442 | } |
@@ -447,8 +452,9 @@ discard block |
||
| 447 | 452 | |
| 448 | 453 | $return_value = GetRelatedList($this_module, $related_module, $other, $query, $button, $returnset); |
| 449 | 454 | |
| 450 | - if ($return_value === null) |
|
| 451 | - $return_value = []; |
|
| 455 | + if ($return_value === null) { |
|
| 456 | + $return_value = []; |
|
| 457 | + } |
|
| 452 | 458 | $return_value['CUSTOM_BUTTON'] = $button; |
| 453 | 459 | |
| 454 | 460 | $log->debug("Exiting get_contacts method ..."); |
@@ -477,8 +483,9 @@ discard block |
||
| 477 | 483 | $query = sprintf($query, $id); |
| 478 | 484 | $return_data = GetRelatedList('Calendar', 'Users', $focus, $query, $button, $returnset); |
| 479 | 485 | |
| 480 | - if ($return_data === null) |
|
| 481 | - $return_data = []; |
|
| 486 | + if ($return_data === null) { |
|
| 487 | + $return_data = []; |
|
| 488 | + } |
|
| 482 | 489 | $return_data['CUSTOM_BUTTON'] = $button; |
| 483 | 490 | |
| 484 | 491 | $log->debug("Exiting get_users method ..."); |
@@ -573,15 +573,17 @@ discard block |
||
| 573 | 573 | $db->pquery('DELETE FROM vtiger_relcriteria_grouping WHERE queryid = ?', array($reportId)); |
| 574 | 574 | |
| 575 | 575 | foreach ($advancedFilter as $groupIndex => $groupInfo) { |
| 576 | - if (empty($groupInfo)) |
|
| 577 | - continue; |
|
| 576 | + if (empty($groupInfo)) { |
|
| 577 | + continue; |
|
| 578 | + } |
|
| 578 | 579 | |
| 579 | 580 | $groupColumns = $groupInfo['columns']; |
| 580 | 581 | $groupCondition = $groupInfo['condition']; |
| 581 | 582 | |
| 582 | 583 | foreach ($groupColumns as $columnIndex => $columnCondition) { |
| 583 | - if (empty($columnCondition)) |
|
| 584 | - continue; |
|
| 584 | + if (empty($columnCondition)) { |
|
| 585 | + continue; |
|
| 586 | + } |
|
| 585 | 587 | |
| 586 | 588 | $advFilterColumn = $columnCondition["columnname"]; |
| 587 | 589 | $advFilterComparator = $columnCondition["comparator"]; |
@@ -649,8 +651,10 @@ discard block |
||
| 649 | 651 | } |
| 650 | 652 | |
| 651 | 653 | $groupConditionExpression = $advancedFilter[$groupIndex]["conditionexpression"]; |
| 652 | - if (empty($groupConditionExpression)) |
|
| 653 | - continue; // Case when the group doesn't have any column criteria |
|
| 654 | + if (empty($groupConditionExpression)) { |
|
| 655 | + continue; |
|
| 656 | + } |
|
| 657 | + // Case when the group doesn't have any column criteria |
|
| 654 | 658 | |
| 655 | 659 | $db->pquery("INSERT INTO vtiger_relcriteria_grouping(groupid, queryid, group_condition, condition_expression) VALUES (?,?,?,?)", array($groupIndex, $reportId, $groupCondition, $groupConditionExpression)); |
| 656 | 660 | } |
@@ -723,8 +727,9 @@ discard block |
||
| 723 | 727 | |
| 724 | 728 | public function getReportsCount($query = null) |
| 725 | 729 | { |
| 726 | - if ($query === null) |
|
| 727 | - $query = $this->get('recordCountQuery'); |
|
| 730 | + if ($query === null) { |
|
| 731 | + $query = $this->get('recordCountQuery'); |
|
| 732 | + } |
|
| 728 | 733 | $adb = PearDatabase::getInstance(); |
| 729 | 734 | $count = 0; |
| 730 | 735 | $result = $adb->query($query, array()); |
@@ -844,8 +849,9 @@ discard block |
||
| 844 | 849 | if (!empty($blocks)) { |
| 845 | 850 | foreach ($blocks as $fieldType => $fieldName) { |
| 846 | 851 | $fieldDetails = explode(':', $fieldType); |
| 847 | - if ($fieldName == 'Send Reminder' && $primaryModule == 'Calendar') |
|
| 848 | - continue; |
|
| 852 | + if ($fieldName == 'Send Reminder' && $primaryModule == 'Calendar') { |
|
| 853 | + continue; |
|
| 854 | + } |
|
| 849 | 855 | if ($fieldDetails[4] === "I" || $fieldDetails[4] === "N" || $fieldDetails[4] === "NN") { |
| 850 | 856 | $calculationFields[$fieldType] = $fieldName; |
| 851 | 857 | } |
@@ -877,8 +883,9 @@ discard block |
||
| 877 | 883 | if (!empty($blocks)) { |
| 878 | 884 | foreach ($blocks as $fieldType => $fieldName) { |
| 879 | 885 | $fieldDetails = explode(':', $fieldType); |
| 880 | - if ($fieldName == 'Send Reminder' && $secondaryModule == 'Calendar') |
|
| 881 | - continue; |
|
| 886 | + if ($fieldName == 'Send Reminder' && $secondaryModule == 'Calendar') { |
|
| 887 | + continue; |
|
| 888 | + } |
|
| 882 | 889 | if ($fieldDetails[4] === "I" || $fieldDetails[4] === "N" || $fieldDetails[4] === "NN") { |
| 883 | 890 | $calculationFields[$fieldType] = $fieldName; |
| 884 | 891 | } |
@@ -1065,13 +1072,15 @@ discard block |
||
| 1065 | 1072 | */ |
| 1066 | 1073 | public function showLineItemFieldsInFilter($calculationFields = false) |
| 1067 | 1074 | { |
| 1068 | - if ($calculationFields === false) |
|
| 1069 | - $calculationFields = $this->getSelectedCalculationFields(); |
|
| 1075 | + if ($calculationFields === false) { |
|
| 1076 | + $calculationFields = $this->getSelectedCalculationFields(); |
|
| 1077 | + } |
|
| 1070 | 1078 | |
| 1071 | 1079 | $primaryModule = $this->getPrimaryModule(); |
| 1072 | 1080 | $inventoryModules = []; |
| 1073 | - if (!in_array($primaryModule, $inventoryModules)) |
|
| 1074 | - return false; |
|
| 1081 | + if (!in_array($primaryModule, $inventoryModules)) { |
|
| 1082 | + return false; |
|
| 1083 | + } |
|
| 1075 | 1084 | if (!empty($calculationFields)) { |
| 1076 | 1085 | foreach ($calculationFields as $field) { |
| 1077 | 1086 | if (stripos($field, 'cb:vtiger_inventoryproductrel') !== false) { |
@@ -1175,13 +1184,14 @@ discard block |
||
| 1175 | 1184 | $primaryModuleModel = Vtiger_Module_Model::getInstance($primaryModule); |
| 1176 | 1185 | $primaryModuleFieldInstances = $primaryModuleModel->getFields(); |
| 1177 | 1186 | |
| 1178 | - if (is_array($fields)) |
|
| 1179 | - foreach ($fields as $module => $blocks) { |
|
| 1187 | + if (is_array($fields)) { |
|
| 1188 | + foreach ($fields as $module => $blocks) { |
|
| 1180 | 1189 | if (is_array($blocks)) |
| 1181 | 1190 | foreach ($blocks as $blockLabel => $blockFields) { |
| 1182 | 1191 | if (is_array($blockFields)) |
| 1183 | 1192 | foreach ($blockFields as $reportFieldInfo => $fieldLabel) { |
| 1184 | 1193 | $fieldInfo = explode(':', $reportFieldInfo); |
| 1194 | + } |
|
| 1185 | 1195 | |
| 1186 | 1196 | $fieldInstance = $primaryModuleFieldInstances[$fieldInfo[3]]; |
| 1187 | 1197 | if (empty($fieldInstance) || $fieldInfo[0] == 'vtiger_inventoryproductrel' || $fieldInstance->getFieldDataType() == 'email' || $fieldInstance->getFieldDataType() == 'phone' || $fieldInstance->getFieldDataType() == 'image' || $fieldInstance->get('uitype') == '4') { |
@@ -1213,13 +1223,14 @@ discard block |
||
| 1213 | 1223 | } |
| 1214 | 1224 | } |
| 1215 | 1225 | } |
| 1216 | - if (is_array($fields)) |
|
| 1217 | - foreach ($fields as $module => $blocks) { |
|
| 1226 | + if (is_array($fields)) { |
|
| 1227 | + foreach ($fields as $module => $blocks) { |
|
| 1218 | 1228 | if (is_array($blocks)) |
| 1219 | 1229 | foreach ($blocks as $blockLabel => $blockFields) { |
| 1220 | 1230 | if (is_array($blockFields)) |
| 1221 | 1231 | foreach ($blockFields as $reportFieldInfo => $fieldLabel) { |
| 1222 | 1232 | $fieldInfo = explode(':', $reportFieldInfo); |
| 1233 | + } |
|
| 1223 | 1234 | $fieldInstance = $secondaryModuleFieldInstances[$module][$fieldInfo[3]]; |
| 1224 | 1235 | if (empty($fieldInstance) || $fieldInfo[0] == 'vtiger_inventoryproductrel' || $fieldInstance->getFieldDataType() == 'email' || $fieldInstance->getFieldDataType() == 'phone' || $fieldInstance->getFieldDataType() == 'image' || $fieldInstance->get('uitype') == '4') { |
| 1225 | 1236 | unset($fields[$module][$blockLabel][$reportFieldInfo]); |
@@ -27,8 +27,9 @@ |
||
| 27 | 27 | */ |
| 28 | 28 | public function getDisplayValue($values, $record = false, $recordInstance = false, $rawText = false) |
| 29 | 29 | { |
| 30 | - if ($values === null && !is_array($values)) |
|
| 31 | - return; |
|
| 30 | + if ($values === null && !is_array($values)) { |
|
| 31 | + return; |
|
| 32 | + } |
|
| 32 | 33 | foreach ($values as $value) { |
| 33 | 34 | if (self::getOwnerType($value) === 'User') { |
| 34 | 35 | $userModel = Users_Record_Model::getCleanInstance('Users'); |