@@ -111,10 +111,12 @@ discard block |
||
| 111 | 111 | $product_Detail[$i]['entityType' . $i] = $entitytype; |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - if ($listprice == '') |
|
| 115 | - $listprice = $unitprice; |
|
| 116 | - if ($qty == '') |
|
| 117 | - $qty = 1; |
|
| 114 | + if ($listprice == '') { |
|
| 115 | + $listprice = $unitprice; |
|
| 116 | + } |
|
| 117 | + if ($qty == '') { |
|
| 118 | + $qty = 1; |
|
| 119 | + } |
|
| 118 | 120 | |
| 119 | 121 | //calculate productTotal |
| 120 | 122 | $productTotal = $qty * $listprice; |
@@ -136,8 +138,9 @@ discard block |
||
| 136 | 138 | $sprod_id = $adb->query_result($sub_prod_query, $j, 'prod_id'); |
| 137 | 139 | $sprod_name = $subProductArray[] = \vtlib\Functions::getCRMRecordLabel($sprod_id); |
| 138 | 140 | $str_sep = ""; |
| 139 | - if ($j > 0) |
|
| 140 | - $str_sep = ":"; |
|
| 141 | + if ($j > 0) { |
|
| 142 | + $str_sep = ":"; |
|
| 143 | + } |
|
| 141 | 144 | $subprodid_str .= $str_sep . $sprod_id; |
| 142 | 145 | if (isset($sprod_name)) { |
| 143 | 146 | $subprodname_str .= $str_sep . " - " . $sprod_name; |
@@ -219,12 +222,17 @@ discard block |
||
| 219 | 222 | |
| 220 | 223 | //condition to avoid this function call when create new PO/Invoice from Product module |
| 221 | 224 | if ($focus->id != '') { |
| 222 | - if ($taxtype == 'individual')//if individual then show the entered tax percentage |
|
| 225 | + if ($taxtype == 'individual') { |
|
| 226 | + //if individual then show the entered tax percentage |
|
| 223 | 227 | $tax_value = getInventoryProductTaxValue($focus->id, $hdnProductId, $tax_name); |
| 224 | - else//if group tax then we have to show the default value when change to individual tax |
|
| 228 | + } else { |
|
| 229 | + //if group tax then we have to show the default value when change to individual tax |
|
| 225 | 230 | $tax_value = $tax_details[$tax_count]['percentage']; |
| 226 | - } else//if the above function not called then assign the default associated value of the product |
|
| 231 | + } |
|
| 232 | + } else { |
|
| 233 | + //if the above function not called then assign the default associated value of the product |
|
| 227 | 234 | $tax_value = $tax_details[$tax_count]['percentage']; |
| 235 | + } |
|
| 228 | 236 | |
| 229 | 237 | |
| 230 | 238 | $product_Detail[$i]['taxes'][$tax_count]['taxname'] = $tax_name; |
@@ -310,13 +318,15 @@ discard block |
||
| 310 | 318 | |
| 311 | 319 | //if taxtype is individual and want to change to group during edit time then we have to show the all available taxes and their default values |
| 312 | 320 | //Also taxtype is group and want to change to individual during edit time then we have to provide the asspciated taxes and their default tax values for individual products |
| 313 | - if ($taxtype == 'group') |
|
| 314 | - $tax_percent = $adb->query_result($result, 0, $tax_name); |
|
| 315 | - else |
|
| 316 | - $tax_percent = $allTaxes[$tax_count]['percentage']; |
|
| 321 | + if ($taxtype == 'group') { |
|
| 322 | + $tax_percent = $adb->query_result($result, 0, $tax_name); |
|
| 323 | + } else { |
|
| 324 | + $tax_percent = $allTaxes[$tax_count]['percentage']; |
|
| 325 | + } |
|
| 317 | 326 | |
| 318 | - if ($tax_percent == '' || $tax_percent == 'NULL') |
|
| 319 | - $tax_percent = '0'; |
|
| 327 | + if ($tax_percent == '' || $tax_percent == 'NULL') { |
|
| 328 | + $tax_percent = '0'; |
|
| 329 | + } |
|
| 320 | 330 | $taxamount = ($subTotal - $finalDiscount) * $tax_percent / 100; |
| 321 | 331 | $taxamount = number_format($taxamount, $no_of_decimal_places, '.', ''); |
| 322 | 332 | $product_Detail[1]['final_details']['taxes'][$tax_count]['taxname'] = $tax_name; |
@@ -69,8 +69,9 @@ discard block |
||
| 69 | 69 | } |
| 70 | 70 | $this->dayofweek_to_rpt = $repeat_arr['dayofweek_to_repeat']; |
| 71 | 71 | $this->repeat_monthby = $repeat_arr['repeatmonth_type']; |
| 72 | - if (isset($repeat_arr['repeatmonth_date'])) |
|
| 73 | - $this->rptmonth_datevalue = $repeat_arr['repeatmonth_date']; |
|
| 72 | + if (isset($repeat_arr['repeatmonth_date'])) { |
|
| 73 | + $this->rptmonth_datevalue = $repeat_arr['repeatmonth_date']; |
|
| 74 | + } |
|
| 74 | 75 | $this->rptmonth_daytype = $repeat_arr['repeatmonth_daytype']; |
| 75 | 76 | |
| 76 | 77 | $this->recurringdates = $this->_getRecurringDates(); |
@@ -409,13 +410,13 @@ discard block |
||
| 409 | 410 | if ($this->rptmonth_datevalue <= $date) { |
| 410 | 411 | $index = $this->rptmonth_datevalue - 1; |
| 411 | 412 | $day = $this->rptmonth_datevalue; |
| 412 | - if (isset($this->recur_freq)) |
|
| 413 | - $month = $month + $this->recur_freq; |
|
| 414 | - else |
|
| 415 | - $month = $month + 1; |
|
| 413 | + if (isset($this->recur_freq)) { |
|
| 414 | + $month = $month + $this->recur_freq; |
|
| 415 | + } else { |
|
| 416 | + $month = $month + 1; |
|
| 417 | + } |
|
| 416 | 418 | $tempdateObj = $tempdateObj->getThismonthDaysbyIndex($index, $day, $month, $year); |
| 417 | - } |
|
| 418 | - else { |
|
| 419 | + } else { |
|
| 419 | 420 | $index = $this->rptmonth_datevalue - 1; |
| 420 | 421 | $day = $this->rptmonth_datevalue; |
| 421 | 422 | $tempdateObj = $tempdateObj->getThismonthDaysbyIndex($index, $day, $month, $year); |
@@ -430,10 +431,11 @@ discard block |
||
| 430 | 431 | $tempdateObj = new vt_DateTime($date_arr, true); |
| 431 | 432 | $firstdayofmonthObj = $this->getFistdayofmonth($this->dayofweek_to_rpt[0], $tempdateObj); |
| 432 | 433 | if ($firstdayofmonthObj->get_DB_formatted_date() <= $tempdate) { |
| 433 | - if (isset($this->recur_freq)) |
|
| 434 | - $month = $firstdayofmonthObj->getMonth() + $this->recur_freq; |
|
| 435 | - else |
|
| 436 | - $month = $firstdayofmonthObj->getMonth() + 1; |
|
| 434 | + if (isset($this->recur_freq)) { |
|
| 435 | + $month = $firstdayofmonthObj->getMonth() + $this->recur_freq; |
|
| 436 | + } else { |
|
| 437 | + $month = $firstdayofmonthObj->getMonth() + 1; |
|
| 438 | + } |
|
| 437 | 439 | $dateObj = $firstdayofmonthObj->getThismonthDaysbyIndex(0, 1, $month, $firstdayofmonthObj->getYear()); |
| 438 | 440 | $nextmonthObj = $this->getFistdayofmonth($this->dayofweek_to_rpt[0], $dateObj); |
| 439 | 441 | $tempdateObj = $nextmonthObj; |
@@ -449,16 +451,16 @@ discard block |
||
| 449 | 451 | $tempdateObj = new vt_DateTime($date_arr, true); |
| 450 | 452 | $lastdayofmonthObj = $this->getLastdayofmonth($this->dayofweek_to_rpt[0], $tempdateObj); |
| 451 | 453 | if ($lastdayofmonthObj->get_DB_formatted_date() <= $tempdate) { |
| 452 | - if (isset($this->recur_freq)) |
|
| 453 | - $month = $lastdayofmonthObj->getMonth() + $this->recur_freq; |
|
| 454 | - else |
|
| 455 | - $month = $lastdayofmonthObj->getMonth() + 1; |
|
| 454 | + if (isset($this->recur_freq)) { |
|
| 455 | + $month = $lastdayofmonthObj->getMonth() + $this->recur_freq; |
|
| 456 | + } else { |
|
| 457 | + $month = $lastdayofmonthObj->getMonth() + 1; |
|
| 458 | + } |
|
| 456 | 459 | $dateObj = $lastdayofmonthObj->getThismonthDaysbyIndex(0, 1, $month, $lastdayofmonthObj->getYear()); |
| 457 | 460 | $dateObj = $dateObj->getThismonthDaysbyIndex($dateObj->getDaysInMonth() - 1, $dateObj->getDaysInMonth(), $month, $lastdayofmonthObj->getYear()); |
| 458 | 461 | $nextmonthObj = $this->getLastdayofmonth($this->dayofweek_to_rpt[0], $dateObj); |
| 459 | 462 | $tempdateObj = $nextmonthObj; |
| 460 | - } |
|
| 461 | - else { |
|
| 463 | + } else { |
|
| 462 | 464 | $tempdateObj = $lastdayofmonthObj; |
| 463 | 465 | } |
| 464 | 466 | } |
@@ -476,10 +478,11 @@ discard block |
||
| 476 | 478 | } |
| 477 | 479 | } elseif ($this->recur_type == 'Yearly') { |
| 478 | 480 | |
| 479 | - if (isset($this->recur_freq)) |
|
| 480 | - $index = $year + $this->recur_freq; |
|
| 481 | - else |
|
| 482 | - $index = $year + 1; |
|
| 481 | + if (isset($this->recur_freq)) { |
|
| 482 | + $index = $year + $this->recur_freq; |
|
| 483 | + } else { |
|
| 484 | + $index = $year + 1; |
|
| 485 | + } |
|
| 483 | 486 | if ($index > 2037 || $index < 1970) { |
| 484 | 487 | print("<font color='red'>" . \includes\Language::translate('LBL_CAL_LIMIT_MSG') . "</font>"); |
| 485 | 488 | exit; |
@@ -534,10 +537,11 @@ discard block |
||
| 534 | 537 | if ($dayofweek == $dateObj->dayofweek) { |
| 535 | 538 | return $dateObj; |
| 536 | 539 | } else { |
| 537 | - if ($dayofweek > $dateObj->dayofweek) |
|
| 538 | - $day = $dateObj->day - 7 + ($dayofweek - $dateObj->dayofweek); |
|
| 539 | - else |
|
| 540 | - $day = $dateObj->day - ($dateObj->dayofweek - $dayofweek); |
|
| 540 | + if ($dayofweek > $dateObj->dayofweek) { |
|
| 541 | + $day = $dateObj->day - 7 + ($dayofweek - $dateObj->dayofweek); |
|
| 542 | + } else { |
|
| 543 | + $day = $dateObj->day - ($dateObj->dayofweek - $dayofweek); |
|
| 544 | + } |
|
| 541 | 545 | $index = $day - 1; |
| 542 | 546 | $month = $dateObj->month; |
| 543 | 547 | $year = $dateObj->year; |
@@ -46,12 +46,15 @@ |
||
| 46 | 46 | public static function getIconByFileType($exntension) |
| 47 | 47 | { |
| 48 | 48 | $explodeExtension = reset(explode("/", $exntension)); |
| 49 | - if (isset(self::$extensionIcon[$explodeExtension])) |
|
| 50 | - $fileIcon = self::$extensionIcon[$explodeExtension]; |
|
| 51 | - if (isset(self::$extensionIcon[$exntension])) |
|
| 52 | - $fileIcon = self::$extensionIcon[$exntension]; |
|
| 53 | - if (!$fileIcon) |
|
| 54 | - $fileIcon = 'userIcon-Documents'; |
|
| 49 | + if (isset(self::$extensionIcon[$explodeExtension])) { |
|
| 50 | + $fileIcon = self::$extensionIcon[$explodeExtension]; |
|
| 51 | + } |
|
| 52 | + if (isset(self::$extensionIcon[$exntension])) { |
|
| 53 | + $fileIcon = self::$extensionIcon[$exntension]; |
|
| 54 | + } |
|
| 55 | + if (!$fileIcon) { |
|
| 56 | + $fileIcon = 'userIcon-Documents'; |
|
| 57 | + } |
|
| 55 | 58 | return $fileIcon; |
| 56 | 59 | } |
| 57 | 60 | } |
@@ -1401,7 +1401,7 @@ |
||
| 1401 | 1401 | function isRecordExists($recordId, $cache = true) |
| 1402 | 1402 | { |
| 1403 | 1403 | $recordMetaData = vtlib\Functions::getCRMRecordMetadata($recordId); |
| 1404 | - return (isset($recordMetaData) && $recordMetaData['deleted'] == 0 ) ? true : false; |
|
| 1404 | + return (isset($recordMetaData) && $recordMetaData['deleted'] == 0) ? true : false; |
|
| 1405 | 1405 | } |
| 1406 | 1406 | |
| 1407 | 1407 | /** Function to set date values compatible to database (YY_MM_DD) |
@@ -201,8 +201,9 @@ discard block |
||
| 201 | 201 | $inUTF8 = (strtoupper($default_charset) == 'UTF-8'); |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | - if (AppRequest::has('module') && AppRequest::has('file') && AppRequest::get('module') != 'Settings' && AppRequest::get('file') != 'ListView' && AppRequest::get('module') != 'Portal' && AppRequest::get('module') != 'Reports') |
|
| 205 | - $ajaxAction = AppRequest::get('module') . 'Ajax'; |
|
| 204 | + if (AppRequest::has('module') && AppRequest::has('file') && AppRequest::get('module') != 'Settings' && AppRequest::get('file') != 'ListView' && AppRequest::get('module') != 'Portal' && AppRequest::get('module') != 'Reports') { |
|
| 205 | + $ajaxAction = AppRequest::get('module') . 'Ajax'; |
|
| 206 | + } |
|
| 206 | 207 | |
| 207 | 208 | if (is_string($string)) { |
| 208 | 209 | if ($action != 'CustomView' && $action != 'Export' && $action != $ajaxAction && $action != 'LeadConvertToEntities' && $action != 'CreatePDF' && $action != 'ConvertAsFAQ' && AppRequest::get('module') != 'Dashboard' && $action != 'CreateSOPDF' && $action != 'SendPDFMail' && (!AppRequest::has('submode'))) { |
@@ -214,10 +215,11 @@ discard block |
||
| 214 | 215 | |
| 215 | 216 | // In vtiger5 ajax request are treated specially and the data is encoded |
| 216 | 217 | if ($doconvert == true) { |
| 217 | - if ($inUTF8) |
|
| 218 | - $string = htmlentities($string, ENT_QUOTES, $default_charset); |
|
| 219 | - else |
|
| 220 | - $string = preg_replace(['/</', '/>/', '/"/'], ['<', '>', '"'], $string); |
|
| 218 | + if ($inUTF8) { |
|
| 219 | + $string = htmlentities($string, ENT_QUOTES, $default_charset); |
|
| 220 | + } else { |
|
| 221 | + $string = preg_replace(['/</', '/>/', '/"/'], ['<', '>', '"'], $string); |
|
| 222 | + } |
|
| 221 | 223 | } |
| 222 | 224 | } |
| 223 | 225 | Vtiger_Cache::set('to_html', $oginalString, $string); |
@@ -273,10 +275,11 @@ discard block |
||
| 273 | 275 | if ($module == 'Calendar') { |
| 274 | 276 | $cachedEventsFields = VTCacheUtils::lookupFieldInfo_Module('Events'); |
| 275 | 277 | if ($cachedEventsFields) { |
| 276 | - if (empty($cachedModuleFields)) |
|
| 277 | - $cachedModuleFields = $cachedEventsFields; |
|
| 278 | - else |
|
| 279 | - $cachedModuleFields = array_merge($cachedModuleFields, $cachedEventsFields); |
|
| 278 | + if (empty($cachedModuleFields)) { |
|
| 279 | + $cachedModuleFields = $cachedEventsFields; |
|
| 280 | + } else { |
|
| 281 | + $cachedModuleFields = array_merge($cachedModuleFields, $cachedEventsFields); |
|
| 282 | + } |
|
| 280 | 283 | } |
| 281 | 284 | } |
| 282 | 285 | |
@@ -704,10 +707,11 @@ discard block |
||
| 704 | 707 | $pos++; |
| 705 | 708 | } |
| 706 | 709 | } |
| 707 | - if (strtolower($default_charset) == 'utf-8') |
|
| 708 | - return html_to_utf8($decodedStr); |
|
| 709 | - else |
|
| 710 | - return $decodedStr; |
|
| 710 | + if (strtolower($default_charset) == 'utf-8') { |
|
| 711 | + return html_to_utf8($decodedStr); |
|
| 712 | + } else { |
|
| 713 | + return $decodedStr; |
|
| 714 | + } |
|
| 711 | 715 | //return html_to_utf8($decodedStr); |
| 712 | 716 | } |
| 713 | 717 | |
@@ -726,13 +730,15 @@ discard block |
||
| 726 | 730 | while (($i--) > 0) { |
| 727 | 731 | if ($data != ($a = $data % ($p = pow(64, $i)))) { |
| 728 | 732 | $ret = chr(base_convert(str_pad(str_repeat(1, $i + 1), 8, "0"), 2, 10) + (($data - $a) / $p)); |
| 729 | - for ($i; $i > 0; $i--) |
|
| 730 | - $ret .= chr(128 + ((($data % pow(64, $i)) - ($data % ($p = pow(64, $i - 1)))) / $p)); |
|
| 733 | + for ($i; $i > 0; $i--) { |
|
| 734 | + $ret .= chr(128 + ((($data % pow(64, $i)) - ($data % ($p = pow(64, $i - 1)))) / $p)); |
|
| 735 | + } |
|
| 731 | 736 | break; |
| 732 | 737 | } |
| 733 | 738 | } |
| 734 | - } else |
|
| 735 | - $ret = "&#$data;"; |
|
| 739 | + } else { |
|
| 740 | + $ret = "&#$data;"; |
|
| 741 | + } |
|
| 736 | 742 | return $ret; |
| 737 | 743 | } |
| 738 | 744 | |
@@ -781,8 +787,9 @@ discard block |
||
| 781 | 787 | */ |
| 782 | 788 | function escape_single_quotes($value) |
| 783 | 789 | { |
| 784 | - if (isset($value)) |
|
| 785 | - $value = str_replace("'", "\'", $value); |
|
| 790 | + if (isset($value)) { |
|
| 791 | + $value = str_replace("'", "\'", $value); |
|
| 792 | + } |
|
| 786 | 793 | return $value; |
| 787 | 794 | } |
| 788 | 795 | |
@@ -803,10 +810,11 @@ discard block |
||
| 803 | 810 | $str = str_replace('_', '\_', $str); |
| 804 | 811 | if ($flag == 0) { |
| 805 | 812 | // If value what to search is null then we should not add % which will fail |
| 806 | - if (empty($str)) |
|
| 807 | - $str = '' . $str . ''; |
|
| 808 | - else |
|
| 809 | - $str = '%' . $str . '%'; |
|
| 813 | + if (empty($str)) { |
|
| 814 | + $str = '' . $str . ''; |
|
| 815 | + } else { |
|
| 816 | + $str = '%' . $str . '%'; |
|
| 817 | + } |
|
| 810 | 818 | } elseif ($flag == 1) { |
| 811 | 819 | $str = '%' . $str; |
| 812 | 820 | } elseif ($flag == 2) { |
@@ -865,8 +873,9 @@ discard block |
||
| 865 | 873 | } else { |
| 866 | 874 | $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"; |
| 867 | 875 | } |
| 868 | - if ($fieldname != 'firstname') |
|
| 869 | - $mulselresult = $adb->query($mulsel); |
|
| 876 | + if ($fieldname != 'firstname') { |
|
| 877 | + $mulselresult = $adb->query($mulsel); |
|
| 878 | + } |
|
| 870 | 879 | for ($j = 0; $j < $adb->num_rows($mulselresult); $j++) { |
| 871 | 880 | $fieldvalues[] = $adb->query_result($mulselresult, $j, $fieldname); |
| 872 | 881 | } |
@@ -878,15 +887,17 @@ discard block |
||
| 878 | 887 | $temp_status[$keyvalue][($temp_count + $t)] = $fieldvalues[$t]; |
| 879 | 888 | } |
| 880 | 889 | $fieldvalues = $temp_status[$keyvalue]; |
| 881 | - } else |
|
| 882 | - $temp_status[$keyvalue] = $fieldvalues; |
|
| 890 | + } else { |
|
| 891 | + $temp_status[$keyvalue] = $fieldvalues; |
|
| 892 | + } |
|
| 893 | + } |
|
| 894 | + if ($uitype == 33) { |
|
| 895 | + $fieldlists[1][$keyvalue] = $fieldvalues; |
|
| 896 | + } else if ($uitype == 55 && $fieldname == 'salutationtype') { |
|
| 897 | + $fieldlists[$keyvalue] = $fieldvalues; |
|
| 898 | + } else if ($uitype == 15) { |
|
| 899 | + $fieldlists[$keyvalue] = $fieldvalues; |
|
| 883 | 900 | } |
| 884 | - if ($uitype == 33) |
|
| 885 | - $fieldlists[1][$keyvalue] = $fieldvalues; |
|
| 886 | - else if ($uitype == 55 && $fieldname == 'salutationtype') |
|
| 887 | - $fieldlists[$keyvalue] = $fieldvalues; |
|
| 888 | - else if ($uitype == 15) |
|
| 889 | - $fieldlists[$keyvalue] = $fieldvalues; |
|
| 890 | 901 | } |
| 891 | 902 | $log->debug("Exit from function getAccessPickListValues($module)"); |
| 892 | 903 | |
@@ -907,8 +918,9 @@ discard block |
||
| 907 | 918 | |
| 908 | 919 | $ret_str .= " ifnull($tbl_name.$col_name,'null') = ifnull(temp.$col_name,'null')"; |
| 909 | 920 | |
| 910 | - if (count($field_array) != $i) |
|
| 911 | - $ret_str .= " and "; |
|
| 921 | + if (count($field_array) != $i) { |
|
| 922 | + $ret_str .= " and "; |
|
| 923 | + } |
|
| 912 | 924 | $i++; |
| 913 | 925 | } |
| 914 | 926 | return $ret_str; |
@@ -1021,8 +1033,9 @@ discard block |
||
| 1021 | 1033 | foreach ($name as $module) { |
| 1022 | 1034 | $focus = CRMEntity::getInstance($module); |
| 1023 | 1035 | $query = $focus->buildSearchQueryForFieldTypes(11, $number); |
| 1024 | - if (empty($query)) |
|
| 1025 | - return; |
|
| 1036 | + if (empty($query)) { |
|
| 1037 | + return; |
|
| 1038 | + } |
|
| 1026 | 1039 | |
| 1027 | 1040 | $result = $adb->pquery($query, []); |
| 1028 | 1041 | if ($adb->num_rows($result) > 0) { |
@@ -1229,8 +1242,9 @@ discard block |
||
| 1229 | 1242 | //require_once('modules/com_vtiger_workflow/VTEntityCache.inc'); |
| 1230 | 1243 | $em = new VTEventsManager($adb); |
| 1231 | 1244 | $em->initTriggerCache(); |
| 1232 | - if (!is_array($destinationRecordIds)) |
|
| 1233 | - $destinationRecordIds = [$destinationRecordIds]; |
|
| 1245 | + if (!is_array($destinationRecordIds)) { |
|
| 1246 | + $destinationRecordIds = [$destinationRecordIds]; |
|
| 1247 | + } |
|
| 1234 | 1248 | |
| 1235 | 1249 | $data = []; |
| 1236 | 1250 | $data['CRMEntity'] = $focus; |
@@ -1277,11 +1291,13 @@ discard block |
||
| 1277 | 1291 | { |
| 1278 | 1292 | global $Vtiger_Utils_Log, $_installOrUpdateVtlibModule; |
| 1279 | 1293 | $log = LoggerManager::getInstance(); |
| 1280 | - if (!file_exists($packagepath)) |
|
| 1281 | - return; |
|
| 1294 | + if (!file_exists($packagepath)) { |
|
| 1295 | + return; |
|
| 1296 | + } |
|
| 1282 | 1297 | |
| 1283 | - if (isset($_installOrUpdateVtlibModule[$packagename . $packagepath])) |
|
| 1284 | - return; |
|
| 1298 | + if (isset($_installOrUpdateVtlibModule[$packagename . $packagepath])) { |
|
| 1299 | + return; |
|
| 1300 | + } |
|
| 1285 | 1301 | $_installOrUpdateVtlibModule[$packagename . $packagepath] = 'install'; |
| 1286 | 1302 | |
| 1287 | 1303 | $Vtiger_Utils_Log = defined('INSTALLATION_MODE_DEBUG') ? INSTALLATION_MODE_DEBUG : true; |
@@ -1328,11 +1344,13 @@ discard block |
||
| 1328 | 1344 | { |
| 1329 | 1345 | global $_installOrUpdateVtlibModule; |
| 1330 | 1346 | $log = LoggerManager::getInstance(); |
| 1331 | - if (!file_exists($packagepath)) |
|
| 1332 | - return; |
|
| 1347 | + if (!file_exists($packagepath)) { |
|
| 1348 | + return; |
|
| 1349 | + } |
|
| 1333 | 1350 | |
| 1334 | - if (isset($_installOrUpdateVtlibModule[$module . $packagepath])) |
|
| 1335 | - return; |
|
| 1351 | + if (isset($_installOrUpdateVtlibModule[$module . $packagepath])) { |
|
| 1352 | + return; |
|
| 1353 | + } |
|
| 1336 | 1354 | $_installOrUpdateVtlibModule[$module . $packagepath] = 'update'; |
| 1337 | 1355 | |
| 1338 | 1356 | $Vtiger_Utils_Log = defined('INSTALLATION_MODE_DEBUG') ? INSTALLATION_MODE_DEBUG : true; |
@@ -1416,20 +1434,23 @@ discard block |
||
| 1416 | 1434 | $delim = array('/', '.'); |
| 1417 | 1435 | foreach ($delim as $delimiter) { |
| 1418 | 1436 | $x = strpos($value, $delimiter); |
| 1419 | - if ($x === false) |
|
| 1420 | - continue; |
|
| 1421 | - else { |
|
| 1437 | + if ($x === false) { |
|
| 1438 | + continue; |
|
| 1439 | + } else { |
|
| 1422 | 1440 | $value = str_replace($delimiter, '-', $value); |
| 1423 | 1441 | break; |
| 1424 | 1442 | } |
| 1425 | 1443 | } |
| 1426 | 1444 | list($y, $m, $d) = explode('-', $value); |
| 1427 | - if (strlen($y) == 1) |
|
| 1428 | - $y = '0' . $y; |
|
| 1429 | - if (strlen($m) == 1) |
|
| 1430 | - $m = '0' . $m; |
|
| 1431 | - if (strlen($d) == 1) |
|
| 1432 | - $d = '0' . $d; |
|
| 1445 | + if (strlen($y) == 1) { |
|
| 1446 | + $y = '0' . $y; |
|
| 1447 | + } |
|
| 1448 | + if (strlen($m) == 1) { |
|
| 1449 | + $m = '0' . $m; |
|
| 1450 | + } |
|
| 1451 | + if (strlen($d) == 1) { |
|
| 1452 | + $d = '0' . $d; |
|
| 1453 | + } |
|
| 1433 | 1454 | $value = implode('-', array($y, $m, $d)); |
| 1434 | 1455 | |
| 1435 | 1456 | if (strlen($y) < 4) { |
@@ -1821,8 +1842,9 @@ discard block |
||
| 1821 | 1842 | $query = $queryGenerator->getQuery(); |
| 1822 | 1843 | $current_page = ListViewSession::getCurrentPage($moduleName, $viewid); |
| 1823 | 1844 | $limit_start_rec = ($current_page - 1) * $list_max_entries_per_page; |
| 1824 | - if ($limit_start_rec < 0) |
|
| 1825 | - $limit_start_rec = 0; |
|
| 1845 | + if ($limit_start_rec < 0) { |
|
| 1846 | + $limit_start_rec = 0; |
|
| 1847 | + } |
|
| 1826 | 1848 | $query .= sprintf(' LIMIT %s,%s', $limit_start_rec, $list_max_entries_per_page); |
| 1827 | 1849 | |
| 1828 | 1850 | $result = $adb->pquery($query, []); |
@@ -56,8 +56,8 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | /** Function to return a full name |
| 58 | 58 | * @param $row -- row:: Type integer |
| 59 | - * @param $first_column -- first column:: Type string |
|
| 60 | - * @param $last_column -- last column:: Type string |
|
| 59 | + * @param string $first_column -- first column:: Type string |
|
| 60 | + * @param string $last_column -- last column:: Type string |
|
| 61 | 61 | * @returns $fullname -- fullname:: Type string |
| 62 | 62 | * |
| 63 | 63 | */ |
@@ -713,6 +713,7 @@ discard block |
||
| 713 | 713 | |
| 714 | 714 | /** |
| 715 | 715 | * simple HTML to UTF-8 conversion: |
| 716 | + * @param string $data |
|
| 716 | 717 | */ |
| 717 | 718 | function html_to_utf8($data) |
| 718 | 719 | { |
@@ -757,6 +758,7 @@ discard block |
||
| 757 | 758 | |
| 758 | 759 | /** |
| 759 | 760 | * Function to find the UI type of a field based on the uitype id |
| 761 | + * @param string $reqtype |
|
| 760 | 762 | */ |
| 761 | 763 | function is_uitype($uitype, $reqtype) |
| 762 | 764 | { |
@@ -1539,6 +1541,8 @@ discard block |
||
| 1539 | 1541 | |
| 1540 | 1542 | /** |
| 1541 | 1543 | * Function to get the approximate difference between two date time values as string |
| 1544 | + * @param integer $d1 |
|
| 1545 | + * @param integer $d2 |
|
| 1542 | 1546 | */ |
| 1543 | 1547 | function dateDiffAsString($d1, $d2) |
| 1544 | 1548 | { |
@@ -69,10 +69,12 @@ discard block |
||
| 69 | 69 | $log = vglobal('log'); |
| 70 | 70 | $log->debug("Entering color_generator(" . $count . "," . $start . "," . $step . ") method ..."); |
| 71 | 71 | // explode color strings to RGB array |
| 72 | - if ($start{0} == "#") |
|
| 73 | - $start = substr($start, 1); |
|
| 74 | - if ($step{0} == "#") |
|
| 75 | - $step = substr($step, 1); |
|
| 72 | + if ($start{0} == "#") { |
|
| 73 | + $start = substr($start, 1); |
|
| 74 | + } |
|
| 75 | + if ($step{0} == "#") { |
|
| 76 | + $step = substr($step, 1); |
|
| 77 | + } |
|
| 76 | 78 | // pad shorter strings with 0 |
| 77 | 79 | $start = substr($start . "000000", 0, 6); |
| 78 | 80 | $step = substr($step . "000000", 0, 6); |
@@ -84,8 +86,9 @@ discard block |
||
| 84 | 86 | array_push($result, "#" . dechex($colors[0]) . dechex($colors[1]) . dechex($colors[2])); |
| 85 | 87 | for ($j = 0; $j < 3; $j++) { |
| 86 | 88 | $colors[$j] += $steps[$j]; |
| 87 | - if ($colors[$j] > 0xFF) |
|
| 88 | - $colors[$j] -= 0xFF; |
|
| 89 | + if ($colors[$j] > 0xFF) { |
|
| 90 | + $colors[$j] -= 0xFF; |
|
| 91 | + } |
|
| 89 | 92 | } |
| 90 | 93 | } |
| 91 | 94 | $log->debug("Exiting color_generator method ..."); |
@@ -61,8 +61,9 @@ |
||
| 61 | 61 | self::$modules[$module] = $CONFIG; |
| 62 | 62 | switch ($argsLength) { |
| 63 | 63 | case 2: |
| 64 | - if (!isset($CONFIG[$key])) |
|
| 65 | - return false; |
|
| 64 | + if (!isset($CONFIG[$key])) { |
|
| 65 | + return false; |
|
| 66 | + } |
|
| 66 | 67 | return $CONFIG[$key]; |
| 67 | 68 | break; |
| 68 | 69 | default: |
@@ -16,11 +16,17 @@ discard block |
||
| 16 | 16 | protected static $sounds = []; |
| 17 | 17 | protected static $search = []; |
| 18 | 18 | |
| 19 | + /** |
|
| 20 | + * @param string $key |
|
| 21 | + */ |
|
| 19 | 22 | public static function load($key, $config) |
| 20 | 23 | { |
| 21 | 24 | self::$$key = $config; |
| 22 | 25 | } |
| 23 | 26 | |
| 27 | + /** |
|
| 28 | + * @param string $key |
|
| 29 | + */ |
|
| 24 | 30 | public static function main($key, $value = false) |
| 25 | 31 | { |
| 26 | 32 | if (isset(self::$main[$key])) { |
@@ -71,11 +77,17 @@ discard block |
||
| 71 | 77 | } |
| 72 | 78 | } |
| 73 | 79 | |
| 80 | + /** |
|
| 81 | + * @param string $key |
|
| 82 | + */ |
|
| 74 | 83 | public static function api($key, $defvalue = false) |
| 75 | 84 | { |
| 76 | 85 | return self::$api[$key]; |
| 77 | 86 | } |
| 78 | 87 | |
| 88 | + /** |
|
| 89 | + * @param string $key |
|
| 90 | + */ |
|
| 79 | 91 | public static function debug($key, $defvalue = false) |
| 80 | 92 | { |
| 81 | 93 | if (empty(self::$debug)) { |
@@ -85,6 +97,9 @@ discard block |
||
| 85 | 97 | return self::$debug[$key]; |
| 86 | 98 | } |
| 87 | 99 | |
| 100 | + /** |
|
| 101 | + * @param string $key |
|
| 102 | + */ |
|
| 88 | 103 | public static function developer($key, $defvalue = false) |
| 89 | 104 | { |
| 90 | 105 | if (empty(self::$developer)) { |
@@ -94,6 +109,9 @@ discard block |
||
| 94 | 109 | return self::$developer[$key]; |
| 95 | 110 | } |
| 96 | 111 | |
| 112 | + /** |
|
| 113 | + * @param string $key |
|
| 114 | + */ |
|
| 97 | 115 | public static function security($key, $defvalue = false) |
| 98 | 116 | { |
| 99 | 117 | if (empty(self::$security)) { |
@@ -103,6 +121,9 @@ discard block |
||
| 103 | 121 | return self::$security[$key]; |
| 104 | 122 | } |
| 105 | 123 | |
| 124 | + /** |
|
| 125 | + * @param string $key |
|
| 126 | + */ |
|
| 106 | 127 | public static function securityKeys($key, $defvalue = false) |
| 107 | 128 | { |
| 108 | 129 | if (empty(self::$securityKeys)) { |
@@ -112,6 +133,9 @@ discard block |
||
| 112 | 133 | return self::$securityKeys[$key]; |
| 113 | 134 | } |
| 114 | 135 | |
| 136 | + /** |
|
| 137 | + * @param string $key |
|
| 138 | + */ |
|
| 115 | 139 | public static function performance($key, $defvalue = false) |
| 116 | 140 | { |
| 117 | 141 | if (empty(self::$performance)) { |
@@ -121,6 +145,11 @@ discard block |
||
| 121 | 145 | return self::$performance[$key]; |
| 122 | 146 | } |
| 123 | 147 | |
| 148 | + /** |
|
| 149 | + * @param string $key |
|
| 150 | + * |
|
| 151 | + * @return boolean |
|
| 152 | + */ |
|
| 124 | 153 | public static function relation($key, $defvalue = false) |
| 125 | 154 | { |
| 126 | 155 | if (empty(self::$relation)) { |
@@ -143,6 +172,9 @@ discard block |
||
| 143 | 172 | return self::$sounds[$key]; |
| 144 | 173 | } |
| 145 | 174 | |
| 175 | + /** |
|
| 176 | + * @param string $key |
|
| 177 | + */ |
|
| 146 | 178 | public static function search($key, $defvalue = false) |
| 147 | 179 | { |
| 148 | 180 | if (empty(self::$search)) { |
@@ -152,6 +184,10 @@ discard block |
||
| 152 | 184 | return self::$search[$key]; |
| 153 | 185 | } |
| 154 | 186 | |
| 187 | + /** |
|
| 188 | + * @param string $key |
|
| 189 | + * @param integer $value |
|
| 190 | + */ |
|
| 155 | 191 | public static function iniSet($key, $value) |
| 156 | 192 | { |
| 157 | 193 | @ini_set($key, $value); |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | $labelSearch[] = $row[$columnName]; |
| 185 | 185 | } |
| 186 | 186 | $entityDisplay[$row['id']] = ['name' => implode(' ', $labelName), 'search' => implode(' ', $labelSearch)]; |
| 187 | - }else { |
|
| 187 | + } else { |
|
| 188 | 188 | $entityDisplay[$row['id']] = trim(implode(' ', $labelName)); |
| 189 | 189 | } |
| 190 | 190 | } |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | public static function isExists($recordId) |
| 238 | 238 | { |
| 239 | 239 | $recordMetaData = Functions::getCRMRecordMetadata($recordId); |
| 240 | - return (isset($recordMetaData) && $recordMetaData['deleted'] == 0 ) ? true : false; |
|
| 240 | + return (isset($recordMetaData) && $recordMetaData['deleted'] == 0) ? true : false; |
|
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | public static function getType($recordId) |
@@ -104,8 +104,9 @@ discard block |
||
| 104 | 104 | public static function computeLabels($moduleName, $ids, $search = false) |
| 105 | 105 | { |
| 106 | 106 | $adb = \PearDatabase::getInstance(); |
| 107 | - if (!is_array($ids)) |
|
| 108 | - $ids = [$ids]; |
|
| 107 | + if (!is_array($ids)) { |
|
| 108 | + $ids = [$ids]; |
|
| 109 | + } |
|
| 109 | 110 | if ($moduleName == 'Events') { |
| 110 | 111 | $moduleName = 'Calendar'; |
| 111 | 112 | } |
@@ -171,20 +172,22 @@ discard block |
||
| 171 | 172 | while ($row = $adb->getRow($result)) { |
| 172 | 173 | $labelSearch = $labelName = []; |
| 173 | 174 | foreach ($columnsName as $columnName) { |
| 174 | - if ($moduleInfoExtend && in_array($moduleInfoExtend[$columnName]['uitype'], [10, 51, 75, 81])) |
|
| 175 | - $labelName[] = self::getLabel($row[$columnName]); |
|
| 176 | - else |
|
| 177 | - $labelName[] = $row[$columnName]; |
|
| 175 | + if ($moduleInfoExtend && in_array($moduleInfoExtend[$columnName]['uitype'], [10, 51, 75, 81])) { |
|
| 176 | + $labelName[] = self::getLabel($row[$columnName]); |
|
| 177 | + } else { |
|
| 178 | + $labelName[] = $row[$columnName]; |
|
| 179 | + } |
|
| 178 | 180 | } |
| 179 | 181 | if ($search) { |
| 180 | 182 | foreach ($columnsSearch as $columnName) { |
| 181 | - if ($moduleInfoExtend && in_array($moduleInfoExtend[$columnName]['uitype'], [10, 51, 75, 81])) |
|
| 182 | - $labelSearch[] = self::getLabel($row[$columnName]); |
|
| 183 | - else |
|
| 184 | - $labelSearch[] = $row[$columnName]; |
|
| 183 | + if ($moduleInfoExtend && in_array($moduleInfoExtend[$columnName]['uitype'], [10, 51, 75, 81])) { |
|
| 184 | + $labelSearch[] = self::getLabel($row[$columnName]); |
|
| 185 | + } else { |
|
| 186 | + $labelSearch[] = $row[$columnName]; |
|
| 187 | + } |
|
| 185 | 188 | } |
| 186 | 189 | $entityDisplay[$row['id']] = ['name' => implode(' ', $labelName), 'search' => implode(' ', $labelSearch)]; |
| 187 | - }else { |
|
| 190 | + } else { |
|
| 188 | 191 | $entityDisplay[$row['id']] = trim(implode(' ', $labelName)); |
| 189 | 192 | } |
| 190 | 193 | } |
@@ -306,8 +306,9 @@ discard block |
||
| 306 | 306 | |
| 307 | 307 | public function parseAdvFilterList($advFilterList, $glue = '') |
| 308 | 308 | { |
| 309 | - if (!empty($glue)) |
|
| 310 | - $this->addConditionGlue($glue); |
|
| 309 | + if (!empty($glue)) { |
|
| 310 | + $this->addConditionGlue($glue); |
|
| 311 | + } |
|
| 311 | 312 | |
| 312 | 313 | $customView = new CustomView($this->module); |
| 313 | 314 | $dateSpecificConditions = $customView->getStdFilterConditions(); |
@@ -318,8 +319,9 @@ discard block |
||
| 318 | 319 | foreach ($filtercolumns as $index => $filter) { |
| 319 | 320 | $nameComponents = explode(':', $filter['columnname']); |
| 320 | 321 | // For Events "End Date & Time" field datatype should be DT. But, db will give D for due_date field |
| 321 | - if ($nameComponents[2] == 'due_date' && $nameComponents[3] == 'Events_End_Date_&_Time') |
|
| 322 | - $nameComponents[4] = 'DT'; |
|
| 322 | + if ($nameComponents[2] == 'due_date' && $nameComponents[3] == 'Events_End_Date_&_Time') { |
|
| 323 | + $nameComponents[4] = 'DT'; |
|
| 324 | + } |
|
| 323 | 325 | if (empty($nameComponents[2]) && $nameComponents[1] == 'crmid' && $nameComponents[0] == 'vtiger_crmentity') { |
| 324 | 326 | $name = $this->getSQLColumn('id'); |
| 325 | 327 | } else { |
@@ -343,13 +345,15 @@ discard block |
||
| 343 | 345 | // If datatype is DT then we should append time also |
| 344 | 346 | if ($nameComponents[4] == 'DT') { |
| 345 | 347 | $startdate = explode(' ', $dateFilterResolvedList['startdate']); |
| 346 | - if ($startdate[1] == '') |
|
| 347 | - $startdate[1] = '00:00:00'; |
|
| 348 | + if ($startdate[1] == '') { |
|
| 349 | + $startdate[1] = '00:00:00'; |
|
| 350 | + } |
|
| 348 | 351 | $dateFilterResolvedList['startdate'] = $startdate[0] . ' ' . $startdate[1]; |
| 349 | 352 | |
| 350 | 353 | $enddate = explode(' ', $dateFilterResolvedList['enddate']); |
| 351 | - if ($enddate[1] == '') |
|
| 352 | - $enddate[1] = '23:59:59'; |
|
| 354 | + if ($enddate[1] == '') { |
|
| 355 | + $enddate[1] = '23:59:59'; |
|
| 356 | + } |
|
| 353 | 357 | $dateFilterResolvedList['enddate'] = $enddate[0] . ' ' . $enddate[1]; |
| 354 | 358 | } |
| 355 | 359 | $value = []; |
@@ -367,12 +371,14 @@ discard block |
||
| 367 | 371 | |
| 368 | 372 | $value = []; |
| 369 | 373 | $start = explode(' ', $startDate); |
| 370 | - if ($start[1] == "") |
|
| 371 | - $startDate = $start[0] . ' ' . '00:00:00'; |
|
| 374 | + if ($start[1] == "") { |
|
| 375 | + $startDate = $start[0] . ' ' . '00:00:00'; |
|
| 376 | + } |
|
| 372 | 377 | |
| 373 | 378 | $end = explode(' ', $endDate); |
| 374 | - if ($end[1] == "") |
|
| 375 | - $endDate = $end[0] . ' ' . '23:59:59'; |
|
| 379 | + if ($end[1] == "") { |
|
| 380 | + $endDate = $end[0] . ' ' . '23:59:59'; |
|
| 381 | + } |
|
| 376 | 382 | |
| 377 | 383 | $value[] = $startDate; |
| 378 | 384 | $value[] = $endDate; |
@@ -405,8 +411,9 @@ discard block |
||
| 405 | 411 | } |
| 406 | 412 | $this->endGroup(); |
| 407 | 413 | $groupConditionGlue = $groupcolumns['condition']; |
| 408 | - if (!empty($groupConditionGlue)) |
|
| 409 | - $this->addConditionGlue($groupConditionGlue); |
|
| 414 | + if (!empty($groupConditionGlue)) { |
|
| 415 | + $this->addConditionGlue($groupConditionGlue); |
|
| 416 | + } |
|
| 410 | 417 | } |
| 411 | 418 | } |
| 412 | 419 | } |
@@ -698,8 +705,9 @@ discard block |
||
| 698 | 705 | $fields = $meta->getModuleFields(); |
| 699 | 706 | $fieldObject = $fields[$fieldName]; |
| 700 | 707 | |
| 701 | - if (empty($fieldObject)) |
|
| 702 | - continue; |
|
| 708 | + if (empty($fieldObject)) { |
|
| 709 | + continue; |
|
| 710 | + } |
|
| 703 | 711 | |
| 704 | 712 | $tableName = $fieldObject->getTableName(); |
| 705 | 713 | if (!in_array($tableName, $referenceFieldTableList)) { |
@@ -758,8 +766,9 @@ discard block |
||
| 758 | 766 | $operator = strtolower($conditionInfo['operator']); |
| 759 | 767 | if ($operator == 'between' && $this->isDateType($field->getFieldDataType())) { |
| 760 | 768 | $start = explode(' ', $conditionInfo['value'][0]); |
| 761 | - if (count($start) == 2) |
|
| 762 | - $conditionInfo['value'][0] = getValidDBInsertDateTimeValue($start[0] . ' ' . $start[1]); |
|
| 769 | + if (count($start) == 2) { |
|
| 770 | + $conditionInfo['value'][0] = getValidDBInsertDateTimeValue($start[0] . ' ' . $start[1]); |
|
| 771 | + } |
|
| 763 | 772 | |
| 764 | 773 | $end = explode(' ', $conditionInfo['values'][1]); |
| 765 | 774 | // Dates will be equal for Today, Tomorrow, Yesterday. |
@@ -920,8 +929,9 @@ discard block |
||
| 920 | 929 | $conditionGlue = ' && '; |
| 921 | 930 | if ($conditionInfo['operator'] == 'n') { |
| 922 | 931 | $specialCondition = ' || ' . $field->getTableName() . '.' . $field->getColumnName() . ' IS NULL '; |
| 923 | - if (!empty($otherField)) |
|
| 924 | - $specialConditionForOtherField = ' || ' . $otherField->getTableName() . '.' . $otherField->getColumnName() . ' IS NULL '; |
|
| 932 | + if (!empty($otherField)) { |
|
| 933 | + $specialConditionForOtherField = ' || ' . $otherField->getTableName() . '.' . $otherField->getColumnName() . ' IS NULL '; |
|
| 934 | + } |
|
| 925 | 935 | } |
| 926 | 936 | } |
| 927 | 937 | |
@@ -931,10 +941,11 @@ discard block |
||
| 931 | 941 | } |
| 932 | 942 | |
| 933 | 943 | $fieldSql .= "$fieldGlue ((" . $field->getTableName() . '.' . $field->getColumnName() . ' ' . $valueSql . " $specialCondition) "; |
| 934 | - if (!empty($otherField)) |
|
| 935 | - $fieldSql .= $conditionGlue . '(' . $otherField->getTableName() . '.' . $otherField->getColumnName() . ' ' . $otherFieldValueSql . ' ' . $specialConditionForOtherField . '))'; |
|
| 936 | - else |
|
| 937 | - $fieldSql .= ')'; |
|
| 944 | + if (!empty($otherField)) { |
|
| 945 | + $fieldSql .= $conditionGlue . '(' . $otherField->getTableName() . '.' . $otherField->getColumnName() . ' ' . $otherFieldValueSql . ' ' . $specialConditionForOtherField . '))'; |
|
| 946 | + } else { |
|
| 947 | + $fieldSql .= ')'; |
|
| 948 | + } |
|
| 938 | 949 | } elseif ($conditionInfo['custom']) { |
| 939 | 950 | $fieldSql .= $fieldGlue . 'vtiger_crmentity.crmid ' . $valueSql; |
| 940 | 951 | } else { |
@@ -1306,8 +1317,9 @@ discard block |
||
| 1306 | 1317 | public function addCondition($fieldname, $value, $operator, $glue = null, $custom = false, $newGroupType = null, $ignoreComma = false) |
| 1307 | 1318 | { |
| 1308 | 1319 | $conditionNumber = $this->conditionInstanceCount++; |
| 1309 | - if ($glue != null && $conditionNumber > 0) |
|
| 1310 | - $this->addConditionGlue($glue); |
|
| 1320 | + if ($glue != null && $conditionNumber > 0) { |
|
| 1321 | + $this->addConditionGlue($glue); |
|
| 1322 | + } |
|
| 1311 | 1323 | |
| 1312 | 1324 | $this->groupInfo .= "$conditionNumber "; |
| 1313 | 1325 | $this->whereFields[] = $fieldname; |
@@ -1328,8 +1340,9 @@ discard block |
||
| 1328 | 1340 | public function addReferenceModuleFieldCondition($relatedModule, $referenceField, $fieldName, $value, $SQLOperator, $glue = null) |
| 1329 | 1341 | { |
| 1330 | 1342 | $conditionNumber = $this->conditionInstanceCount++; |
| 1331 | - if ($glue != null && $conditionNumber > 0) |
|
| 1332 | - $this->addConditionGlue($glue); |
|
| 1343 | + if ($glue != null && $conditionNumber > 0) { |
|
| 1344 | + $this->addConditionGlue($glue); |
|
| 1345 | + } |
|
| 1333 | 1346 | |
| 1334 | 1347 | $this->groupInfo .= "$conditionNumber "; |
| 1335 | 1348 | $this->referenceModuleField[$conditionNumber] = array('relatedModule' => $relatedModule, 'referenceField' => $referenceField, 'fieldName' => $fieldName, 'value' => $value, |
@@ -1403,8 +1416,9 @@ discard block |
||
| 1403 | 1416 | } |
| 1404 | 1417 | $this->endGroup(); |
| 1405 | 1418 | $groupConditionGlue = $groupcolumns['condition']; |
| 1406 | - if (!empty($groupConditionGlue)) |
|
| 1407 | - $this->addConditionGlue($groupConditionGlue); |
|
| 1419 | + if (!empty($groupConditionGlue)) { |
|
| 1420 | + $this->addConditionGlue($groupConditionGlue); |
|
| 1421 | + } |
|
| 1408 | 1422 | } |
| 1409 | 1423 | } |
| 1410 | 1424 | $this->endGroup(); |
@@ -153,6 +153,9 @@ discard block |
||
| 153 | 153 | return $this->whereFields; |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | + /** |
|
| 157 | + * @param string $columns |
|
| 158 | + */ |
|
| 156 | 159 | public function setCustomColumn($columns) |
| 157 | 160 | { |
| 158 | 161 | $this->columnsCustom[] = $columns; |
@@ -193,6 +196,9 @@ discard block |
||
| 193 | 196 | return $this->ownerFields; |
| 194 | 197 | } |
| 195 | 198 | |
| 199 | + /** |
|
| 200 | + * @return string |
|
| 201 | + */ |
|
| 196 | 202 | public function getModuleNameFields($module) |
| 197 | 203 | { |
| 198 | 204 | return $this->moduleNameFields[$module]; |
@@ -1249,6 +1255,9 @@ discard block |
||
| 1249 | 1255 | return $sql; |
| 1250 | 1256 | } |
| 1251 | 1257 | |
| 1258 | + /** |
|
| 1259 | + * @param string $groupSql |
|
| 1260 | + */ |
|
| 1252 | 1261 | private function makeGroupSqlReplacements($fieldSqlList, $groupSql) |
| 1253 | 1262 | { |
| 1254 | 1263 | $pos = 0; |
@@ -1286,6 +1295,9 @@ discard block |
||
| 1286 | 1295 | return ($type == 'date' || $type == 'datetime'); |
| 1287 | 1296 | } |
| 1288 | 1297 | |
| 1298 | + /** |
|
| 1299 | + * @return string |
|
| 1300 | + */ |
|
| 1289 | 1301 | public function fixDateTimeValue($name, $value, $first = true) |
| 1290 | 1302 | { |
| 1291 | 1303 | $moduleFields = $this->getModuleFields(); |
@@ -1303,6 +1315,10 @@ discard block |
||
| 1303 | 1315 | return $value; |
| 1304 | 1316 | } |
| 1305 | 1317 | |
| 1318 | + /** |
|
| 1319 | + * @param string $glue |
|
| 1320 | + * @param string $newGroupType |
|
| 1321 | + */ |
|
| 1306 | 1322 | public function addCondition($fieldname, $value, $operator, $glue = null, $custom = false, $newGroupType = null, $ignoreComma = false) |
| 1307 | 1323 | { |
| 1308 | 1324 | $conditionNumber = $this->conditionInstanceCount++; |
@@ -1346,6 +1362,9 @@ discard block |
||
| 1346 | 1362 | return array('name' => $fieldname, 'value' => $value, 'operator' => $operator, 'custom' => $custom); |
| 1347 | 1363 | } |
| 1348 | 1364 | |
| 1365 | + /** |
|
| 1366 | + * @param string $groupType |
|
| 1367 | + */ |
|
| 1349 | 1368 | public function startGroup($groupType) |
| 1350 | 1369 | { |
| 1351 | 1370 | $this->groupInfo .= " $groupType ("; |
@@ -270,8 +270,7 @@ |
||
| 270 | 270 | foreach ($moduleFields as $fieldName => $webserviceField) { |
| 271 | 271 | array_push($fields, $this->getDescribeFieldArray($webserviceField)); |
| 272 | 272 | } |
| 273 | - $label = ($app_strings[$this->meta->getObectIndexColumn()]) ? $app_strings[$this->meta->getObectIndexColumn()] : |
|
| 274 | - $this->meta->getObectIndexColumn(); |
|
| 273 | + $label = ($app_strings[$this->meta->getObectIndexColumn()]) ? $app_strings[$this->meta->getObectIndexColumn()] : $this->meta->getObectIndexColumn(); |
|
| 275 | 274 | $this->moduleFields = $fields; |
| 276 | 275 | } |
| 277 | 276 | return $this->moduleFields; |