@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | $moduleName = $entity->getModuleName(); |
314 | 314 | |
315 | 315 | $statusChanged = false; |
316 | - $vtEntityDelta = new VTEntityDelta (); |
|
316 | + $vtEntityDelta = new VTEntityDelta(); |
|
317 | 317 | $oldEntity = $vtEntityDelta->getOldValue($moduleName, $entity_id, $statusFieldName); |
318 | 318 | $recordDetails = $entity->getData(); |
319 | 319 | $statusChanged = $vtEntityDelta->hasChanged($moduleName, $entity_id, $statusFieldName); |
@@ -941,19 +941,19 @@ discard block |
||
941 | 941 | for ($i = 0; $i < $noOfRows; ++$i) { |
942 | 942 | $status = $adb->query_result($result, $i, 'temp_status'); |
943 | 943 | if ($obj->getImportRecordStatus('none') == $status) { |
944 | - $statusCount['PENDING'] ++; |
|
944 | + $statusCount['PENDING']++; |
|
945 | 945 | } elseif ($obj->getImportRecordStatus('failed') == $status) { |
946 | - $statusCount['FAILED'] ++; |
|
946 | + $statusCount['FAILED']++; |
|
947 | 947 | } else { |
948 | - $statusCount['IMPORTED'] ++; |
|
948 | + $statusCount['IMPORTED']++; |
|
949 | 949 | switch ($status) { |
950 | - case $obj->getImportRecordStatus('created') : $statusCount['CREATED'] ++; |
|
950 | + case $obj->getImportRecordStatus('created') : $statusCount['CREATED']++; |
|
951 | 951 | break; |
952 | - case $obj->getImportRecordStatus('skipped') : $statusCount['SKIPPED'] ++; |
|
952 | + case $obj->getImportRecordStatus('skipped') : $statusCount['SKIPPED']++; |
|
953 | 953 | break; |
954 | - case $obj->getImportRecordStatus('updated') : $statusCount['UPDATED'] ++; |
|
954 | + case $obj->getImportRecordStatus('updated') : $statusCount['UPDATED']++; |
|
955 | 955 | break; |
956 | - case $obj->getImportRecordStatus('merged') : $statusCount['MERGED'] ++; |
|
956 | + case $obj->getImportRecordStatus('merged') : $statusCount['MERGED']++; |
|
957 | 957 | break; |
958 | 958 | } |
959 | 959 | } |
@@ -17,6 +17,7 @@ discard block |
||
17 | 17 | * Param $ext_prod_arr - existing vtiger_products |
18 | 18 | * Param $module - module name |
19 | 19 | * return type void |
20 | + * @param string $mode |
|
20 | 21 | */ |
21 | 22 | function updateStk($product_id, $qty, $mode, $ext_prod_arr, $module) |
22 | 23 | { |
@@ -250,9 +251,6 @@ discard block |
||
250 | 251 | } |
251 | 252 | |
252 | 253 | /** Function used to delete the Inventory product details for the passed entity |
253 | - * @param int $objectid - entity id to which we want to delete the product details from REQUEST values where as the entity will be Purchase Order or Invoice |
|
254 | - * @param string $return_old_values - string which contains the string return_old_values or may be empty, if the string is return_old_values then before delete old values will be retrieved |
|
255 | - * @return array $ext_prod_arr - if the second input parameter is 'return_old_values' then the array which contains the productid and quantity which will be retrieved before delete the product details will be returned otherwise return empty |
|
256 | 254 | */ |
257 | 255 | function deleteInventoryProductDetails($focus) |
258 | 256 | { |
@@ -128,16 +128,18 @@ discard block |
||
128 | 128 | $taxpercentage = $adb->query_result($res, 0, 'taxpercentage'); |
129 | 129 | |
130 | 130 | //This is to retrive the default configured value if the taxpercentage related to product is empty |
131 | - if ($taxpercentage == '' && $default == 'default') |
|
132 | - $taxpercentage = getTaxPercentage($type); |
|
131 | + if ($taxpercentage == '' && $default == 'default') { |
|
132 | + $taxpercentage = getTaxPercentage($type); |
|
133 | + } |
|
133 | 134 | |
134 | 135 | |
135 | 136 | $log->debug("Exiting from getProductTaxPercentage($productid,$type) function. return value=$taxpercentage"); |
136 | - if ($current_user->truncate_trailing_zeros === true) |
|
137 | - return \vtlib\Functions::formatDecimal($taxpercentage); |
|
138 | - else |
|
139 | - return $taxpercentage; |
|
140 | -} |
|
137 | + if ($current_user->truncate_trailing_zeros === true) { |
|
138 | + return \vtlib\Functions::formatDecimal($taxpercentage); |
|
139 | + } else { |
|
140 | + return $taxpercentage; |
|
141 | + } |
|
142 | + } |
|
141 | 143 | |
142 | 144 | /** Function used to get the list of Tax types as a array |
143 | 145 | * @param string $available - available or empty where as default is all, if available then the taxes which are available now will be returned otherwise all taxes will be returned |
@@ -229,8 +231,9 @@ discard block |
||
229 | 231 | $params = array($productid); |
230 | 232 | |
231 | 233 | //Postgres 8 fixes |
232 | - if ($adb->isPostgres()) |
|
233 | - $query = fixPostgresQuery($query, $log, 0); |
|
234 | + if ($adb->isPostgres()) { |
|
235 | + $query = fixPostgresQuery($query, $log, 0); |
|
236 | + } |
|
234 | 237 | |
235 | 238 | $res = $adb->pquery($query, $params); |
236 | 239 | for ($i = 0; $i < $adb->num_rows($res); $i++) { |
@@ -372,8 +375,9 @@ discard block |
||
372 | 375 | |
373 | 376 | $inv_table_array = []; |
374 | 377 | $inv_id_array = []; |
375 | - if (!array_key_exists($module, $inv_table_array)) |
|
376 | - return ''; |
|
378 | + if (!array_key_exists($module, $inv_table_array)) { |
|
379 | + return ''; |
|
380 | + } |
|
377 | 381 | |
378 | 382 | $res = $adb->pquery("select taxtype from $inv_table_array[$module] where $inv_id_array[$module]=?", array($id)); |
379 | 383 | |
@@ -428,8 +432,9 @@ discard block |
||
428 | 432 | $res = $adb->pquery("select $taxname from vtiger_inventoryproductrel where id = ? and productid = ?", array($id, $productid)); |
429 | 433 | $taxvalue = $adb->query_result($res, 0, $taxname); |
430 | 434 | |
431 | - if ($taxvalue == '') |
|
432 | - $taxvalue = '0'; |
|
435 | + if ($taxvalue == '') { |
|
436 | + $taxvalue = '0'; |
|
437 | + } |
|
433 | 438 | |
434 | 439 | $log->debug("Exit from function getInventoryProductTaxValue($id, $productid, $taxname)."); |
435 | 440 | |
@@ -477,8 +482,9 @@ discard block |
||
477 | 482 | } |
478 | 483 | |
479 | 484 | //Postgres 8 fixes |
480 | - if ($adb->isPostgres()) |
|
481 | - $query = fixPostgresQuery($query, $log, 0); |
|
485 | + if ($adb->isPostgres()) { |
|
486 | + $query = fixPostgresQuery($query, $log, 0); |
|
487 | + } |
|
482 | 488 | |
483 | 489 | $res = $adb->pquery($query, $params); |
484 | 490 | for ($i = 0; $i < $adb->num_rows($res); $i++) { |
@@ -775,8 +781,9 @@ discard block |
||
775 | 781 | $subject = $row['subject']; |
776 | 782 | $sql = 'SELECT * FROM %s WHERE temp_status = %s'; |
777 | 783 | $sql = sprintf($sql, $tableName, Import_Data_Action::$IMPORT_RECORD_NONE); |
778 | - if (!empty($subject)) |
|
779 | - $sql .= ' && subject = "' . str_replace("\"", "\\\"", $subject) . '"'; |
|
784 | + if (!empty($subject)) { |
|
785 | + $sql .= ' && subject = "' . str_replace("\"", "\\\"", $subject) . '"'; |
|
786 | + } |
|
780 | 787 | $subjectResult = $adb->query($sql); |
781 | 788 | $count = $adb->num_rows($subjectResult); |
782 | 789 | $subjectRowIDs = []; |
@@ -893,8 +900,9 @@ discard block |
||
893 | 900 | foreach ($fieldMapping as $fieldName => $index) { |
894 | 901 | if ($moduleFields[$fieldName]->getTableName() == 'vtiger_inventoryproductrel') { |
895 | 902 | $lineItemData[$fieldName] = $lineItemFieldData[$fieldName]; |
896 | - if ($fieldName != 'productid') |
|
897 | - $inventoryFieldData[$fieldName] = ''; |
|
903 | + if ($fieldName != 'productid') { |
|
904 | + $inventoryFieldData[$fieldName] = ''; |
|
905 | + } |
|
898 | 906 | } |
899 | 907 | } |
900 | 908 | array_push($lineItems, $lineItemData); |
@@ -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 ("; |