@@ -19,33 +19,26 @@ |
||
| 19 | 19 | if($service == "customerportal") |
| 20 | 20 | { |
| 21 | 21 | include("api/customerportal.php"); |
| 22 | - } |
|
| 23 | - elseif($service == "mobile") |
|
| 22 | + } elseif($service == "mobile") |
|
| 24 | 23 | { |
| 25 | 24 | include("api/mobile.php"); |
| 26 | - } |
|
| 27 | - elseif($service == "yetiportal") |
|
| 25 | + } elseif($service == "yetiportal") |
|
| 28 | 26 | { |
| 29 | 27 | include("api/yetiportal.php"); |
| 30 | - } |
|
| 31 | - elseif($service == "firefox") |
|
| 28 | + } elseif($service == "firefox") |
|
| 32 | 29 | { |
| 33 | 30 | include("api/firefoxtoolbar.php"); |
| 34 | - } |
|
| 35 | - elseif($service == "wordplugin") |
|
| 31 | + } elseif($service == "wordplugin") |
|
| 36 | 32 | { |
| 37 | 33 | include("api/wordplugin.php"); |
| 38 | - } |
|
| 39 | - elseif($service == "thunderbird") |
|
| 34 | + } elseif($service == "thunderbird") |
|
| 40 | 35 | { |
| 41 | 36 | include("api/thunderbirdplugin.php"); |
| 42 | - } |
|
| 43 | - else |
|
| 37 | + } else |
|
| 44 | 38 | { |
| 45 | 39 | echo "No Service Configured for ". strip_tags($service); |
| 46 | 40 | } |
| 47 | -} |
|
| 48 | -else |
|
| 41 | +} else |
|
| 49 | 42 | { |
| 50 | 43 | echo "<h1>YetiForceCRM API Services</h1>"; |
| 51 | 44 | echo "<li>YetiForceCRM Yeti Portal EndPoint URL -- Click <a href='api.php?service=yetiportal'>here</a></li>"; |
@@ -87,8 +87,9 @@ |
||
| 87 | 87 | public function process(Vtiger_Request $request) |
| 88 | 88 | { |
| 89 | 89 | $default_charset = AppConfig::main('default_charset'); |
| 90 | - if (empty($default_charset)) |
|
| 91 | - $default_charset = 'UTF-8'; |
|
| 90 | + if (empty($default_charset)) { |
|
| 91 | + $default_charset = 'UTF-8'; |
|
| 92 | + } |
|
| 92 | 93 | $mode = $request->getMode(); |
| 93 | 94 | if (!empty($mode) && $this->isMethodExposed($mode)) { |
| 94 | 95 | return $this->$mode($request); |
@@ -47,8 +47,9 @@ discard block |
||
| 47 | 47 | function _recaptcha_qsencode($data) |
| 48 | 48 | { |
| 49 | 49 | $req = ""; |
| 50 | - foreach ($data as $key => $value) |
|
| 51 | - $req .= $key . '=' . urlencode(stripslashes($value)) . '&'; |
|
| 50 | + foreach ($data as $key => $value) { |
|
| 51 | + $req .= $key . '=' . urlencode(stripslashes($value)) . '&'; |
|
| 52 | + } |
|
| 52 | 53 | |
| 53 | 54 | // Cut the last '&' |
| 54 | 55 | $req = substr($req, 0, strlen($req) - 1); |
@@ -83,8 +84,10 @@ discard block |
||
| 83 | 84 | |
| 84 | 85 | fwrite($fs, $http_request); |
| 85 | 86 | |
| 86 | - while (!feof($fs)) |
|
| 87 | - $response .= fgets($fs, 1160); // One TCP-IP packet |
|
| 87 | + while (!feof($fs)) { |
|
| 88 | + $response .= fgets($fs, 1160); |
|
| 89 | + } |
|
| 90 | + // One TCP-IP packet |
|
| 88 | 91 | fclose($fs); |
| 89 | 92 | $response = explode("\r\n\r\n", $response, 2); |
| 90 | 93 | |
@@ -83,8 +83,9 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | public function Output($filename, $type) |
| 85 | 85 | { |
| 86 | - if (is_null($this->focus)) |
|
| 87 | - return; |
|
| 86 | + if (is_null($this->focus)) { |
|
| 87 | + return; |
|
| 88 | + } |
|
| 88 | 89 | |
| 89 | 90 | $pdfgenerator = $this->getPDFGenerator(); |
| 90 | 91 | |
@@ -256,24 +257,32 @@ discard block |
||
| 256 | 257 | |
| 257 | 258 | $addressValues = []; |
| 258 | 259 | $addressValues[] = $resultrow['address']; |
| 259 | - if (!empty($resultrow['city'])) |
|
| 260 | - $addressValues[] = "\n" . $resultrow['city']; |
|
| 261 | - if (!empty($resultrow['state'])) |
|
| 262 | - $addressValues[] = "," . $resultrow['state']; |
|
| 263 | - if (!empty($resultrow['code'])) |
|
| 264 | - $addressValues[] = $resultrow['code']; |
|
| 265 | - if (!empty($resultrow['country'])) |
|
| 266 | - $addressValues[] = "\n" . $resultrow['country']; |
|
| 260 | + if (!empty($resultrow['city'])) { |
|
| 261 | + $addressValues[] = "\n" . $resultrow['city']; |
|
| 262 | + } |
|
| 263 | + if (!empty($resultrow['state'])) { |
|
| 264 | + $addressValues[] = "," . $resultrow['state']; |
|
| 265 | + } |
|
| 266 | + if (!empty($resultrow['code'])) { |
|
| 267 | + $addressValues[] = $resultrow['code']; |
|
| 268 | + } |
|
| 269 | + if (!empty($resultrow['country'])) { |
|
| 270 | + $addressValues[] = "\n" . $resultrow['country']; |
|
| 271 | + } |
|
| 267 | 272 | |
| 268 | 273 | $additionalCompanyInfo = []; |
| 269 | - if (!empty($resultrow['phone'])) |
|
| 270 | - $additionalCompanyInfo[] = "\n" . \includes\Language::translate("Phone: ", $this->moduleName) . $resultrow['phone']; |
|
| 271 | - if (!empty($resultrow['fax'])) |
|
| 272 | - $additionalCompanyInfo[] = "\n" . \includes\Language::translate("Fax: ", $this->moduleName) . $resultrow['fax']; |
|
| 273 | - if (!empty($resultrow['website'])) |
|
| 274 | - $additionalCompanyInfo[] = "\n" . \includes\Language::translate("Website: ", $this->moduleName) . $resultrow['website']; |
|
| 275 | - if (!empty($resultrow['vatid'])) |
|
| 276 | - $additionalCompanyInfo[] = "\n" . \includes\Language::translate("VAT ID: ", $this->moduleName) . $resultrow['vatid']; |
|
| 274 | + if (!empty($resultrow['phone'])) { |
|
| 275 | + $additionalCompanyInfo[] = "\n" . \includes\Language::translate("Phone: ", $this->moduleName) . $resultrow['phone']; |
|
| 276 | + } |
|
| 277 | + if (!empty($resultrow['fax'])) { |
|
| 278 | + $additionalCompanyInfo[] = "\n" . \includes\Language::translate("Fax: ", $this->moduleName) . $resultrow['fax']; |
|
| 279 | + } |
|
| 280 | + if (!empty($resultrow['website'])) { |
|
| 281 | + $additionalCompanyInfo[] = "\n" . \includes\Language::translate("Website: ", $this->moduleName) . $resultrow['website']; |
|
| 282 | + } |
|
| 283 | + if (!empty($resultrow['vatid'])) { |
|
| 284 | + $additionalCompanyInfo[] = "\n" . \includes\Language::translate("VAT ID: ", $this->moduleName) . $resultrow['vatid']; |
|
| 285 | + } |
|
| 277 | 286 | |
| 278 | 287 | $modelColumnLeft = array( |
| 279 | 288 | 'logo' => "storage/Logo/" . $resultrow['logoname'], |
@@ -430,8 +439,9 @@ discard block |
||
| 430 | 439 | { |
| 431 | 440 | $valueString = ''; |
| 432 | 441 | foreach ($values as $value) { |
| 433 | - if (empty($value)) |
|
| 434 | - continue; |
|
| 442 | + if (empty($value)) { |
|
| 443 | + continue; |
|
| 444 | + } |
|
| 435 | 445 | $valueString .= $value . $delimeter; |
| 436 | 446 | } |
| 437 | 447 | return rtrim($valueString, $delimeter); |
@@ -16,10 +16,11 @@ discard block |
||
| 16 | 16 | { |
| 17 | 17 | $entity = false; |
| 18 | 18 | if ($mixed) { |
| 19 | - if (is_numeric($mixed)) |
|
| 20 | - $entity = isset(self::$moduleEntityCacheById[$mixed]) ? self::$moduleEntityCacheById[$mixed] : false; |
|
| 21 | - else |
|
| 22 | - $entity = isset(self::$moduleEntityCacheByName[$mixed]) ? self::$moduleEntityCacheByName[$mixed] : false; |
|
| 19 | + if (is_numeric($mixed)) { |
|
| 20 | + $entity = isset(self::$moduleEntityCacheById[$mixed]) ? self::$moduleEntityCacheById[$mixed] : false; |
|
| 21 | + } else { |
|
| 22 | + $entity = isset(self::$moduleEntityCacheByName[$mixed]) ? self::$moduleEntityCacheByName[$mixed] : false; |
|
| 23 | + } |
|
| 23 | 24 | } |
| 24 | 25 | if (!$entity) { |
| 25 | 26 | $adb = \PearDatabase::getInstance(); |
@@ -31,10 +32,11 @@ discard block |
||
| 31 | 32 | self::$moduleEntityCacheById[$row['tabid']] = $row; |
| 32 | 33 | } |
| 33 | 34 | if ($mixed) { |
| 34 | - if (is_numeric($mixed)) |
|
| 35 | - return self::$moduleEntityCacheById[$mixed]; |
|
| 36 | - else |
|
| 37 | - return self::$moduleEntityCacheByName[$mixed]; |
|
| 35 | + if (is_numeric($mixed)) { |
|
| 36 | + return self::$moduleEntityCacheById[$mixed]; |
|
| 37 | + } else { |
|
| 38 | + return self::$moduleEntityCacheByName[$mixed]; |
|
| 39 | + } |
|
| 38 | 40 | } |
| 39 | 41 | } |
| 40 | 42 | return $entity; |
@@ -80,8 +80,9 @@ |
||
| 80 | 80 | $fieldlists = explode(',', $fieldsname); |
| 81 | 81 | $fl = []; |
| 82 | 82 | foreach ($fieldlists as $w => $c) { |
| 83 | - if (count($fl)) |
|
| 84 | - $fl[] = "' '"; |
|
| 83 | + if (count($fl)) { |
|
| 84 | + $fl[] = "' '"; |
|
| 85 | + } |
|
| 85 | 86 | $fl[] = $c; |
| 86 | 87 | } |
| 87 | 88 | $fieldsname = $adb->concat($fl); |
@@ -464,8 +464,9 @@ discard block |
||
| 464 | 464 | $this->checkError('Missing table name'); |
| 465 | 465 | return false; |
| 466 | 466 | } |
| 467 | - if ($where != '') |
|
| 468 | - $where = sprintf('WHERE %s', $where); |
|
| 467 | + if ($where != '') { |
|
| 468 | + $where = sprintf('WHERE %s', $where); |
|
| 469 | + } |
|
| 469 | 470 | if (count($params) === 0) { |
| 470 | 471 | $this->query(sprintf('DELETE FROM %s %s', $table, $where)); |
| 471 | 472 | } else { |
@@ -558,10 +559,12 @@ discard block |
||
| 558 | 559 | //TODO DEPRECATED |
| 559 | 560 | public function flatten_array($input, $output = null) |
| 560 | 561 | { |
| 561 | - if ($input == null) |
|
| 562 | - return null; |
|
| 563 | - if ($output == null) |
|
| 564 | - $output = []; |
|
| 562 | + if ($input == null) { |
|
| 563 | + return null; |
|
| 564 | + } |
|
| 565 | + if ($output == null) { |
|
| 566 | + $output = []; |
|
| 567 | + } |
|
| 565 | 568 | foreach ($input as $value) { |
| 566 | 569 | if (is_array($value)) { |
| 567 | 570 | $output = $this->flatten_array($value, $output); |
@@ -634,15 +637,17 @@ discard block |
||
| 634 | 637 | { |
| 635 | 638 | if (isset($result) && $rowNum < 0) { |
| 636 | 639 | $row = $this->getRow($result); |
| 637 | - if ($encode && is_array($row)) |
|
| 638 | - return array_map('to_html', $row); |
|
| 640 | + if ($encode && is_array($row)) { |
|
| 641 | + return array_map('to_html', $row); |
|
| 642 | + } |
|
| 639 | 643 | return $row; |
| 640 | 644 | } |
| 641 | 645 | if ($this->getRowCount($result) > $rowNum) { |
| 642 | 646 | $row = $this->raw_query_result_rowdata($result, $rowNum); |
| 643 | 647 | } |
| 644 | - if ($encode && is_array($row)) |
|
| 645 | - return array_map('to_html', $row); |
|
| 648 | + if ($encode && is_array($row)) { |
|
| 649 | + return array_map('to_html', $row); |
|
| 650 | + } |
|
| 646 | 651 | return $row; |
| 647 | 652 | } |
| 648 | 653 | |
@@ -787,8 +792,9 @@ discard block |
||
| 787 | 792 | $this->log('sqlExprDatalist: empty arrays not allowed', 'error'); |
| 788 | 793 | $this->checkError('sqlExprDatalist: empty arrays not allowed'); |
| 789 | 794 | } |
| 790 | - foreach ($array as $key => $val) |
|
| 791 | - $l .= ($l ? ',' : '') . $this->quote($val); |
|
| 795 | + foreach ($array as $key => $val) { |
|
| 796 | + $l .= ($l ? ',' : '') . $this->quote($val); |
|
| 797 | + } |
|
| 792 | 798 | return ' ( ' . $l . ' ) '; |
| 793 | 799 | } |
| 794 | 800 | |
@@ -803,8 +809,9 @@ discard block |
||
| 803 | 809 | { |
| 804 | 810 | $result = $this->query($sql, $dieOnError, $msg); |
| 805 | 811 | |
| 806 | - if ($this->getRowCount($result) == 1) |
|
| 807 | - return $result; |
|
| 812 | + if ($this->getRowCount($result) == 1) { |
|
| 813 | + return $result; |
|
| 814 | + } |
|
| 808 | 815 | $this->log('Rows Returned:' . $this->getRowCount($result) . ' More than 1 row returned for ' . $sql, 'error'); |
| 809 | 816 | $this->checkError('Rows Returned:' . $this->getRowCount($result) . ' More than 1 row returned for ' . $sql, $dieOnError); |
| 810 | 817 | return ''; |
@@ -816,8 +823,9 @@ discard block |
||
| 816 | 823 | { |
| 817 | 824 | $result = $this->pquery($sql, $params, $dieOnError, $msg); |
| 818 | 825 | |
| 819 | - if ($this->getRowCount($result) == 1) |
|
| 820 | - return $result; |
|
| 826 | + if ($this->getRowCount($result) == 1) { |
|
| 827 | + return $result; |
|
| 828 | + } |
|
| 821 | 829 | $this->log('Rows Returned:' . $this->getRowCount($result) . ' More than 1 row returned for ' . $sql, 'error'); |
| 822 | 830 | $this->checkError('Rows Returned:' . $this->getRowCount($result) . ' More than 1 row returned for ' . $sql, $dieOnError); |
| 823 | 831 | return ''; |
@@ -881,8 +889,9 @@ discard block |
||
| 881 | 889 | if (isset($_SERVER['REQUEST_METHOD'])) { |
| 882 | 890 | $uri = $_SERVER['REQUEST_URI']; |
| 883 | 891 | $qmarkIndex = strpos($_SERVER['REQUEST_URI'], '?'); |
| 884 | - if ($qmarkIndex !== false) |
|
| 885 | - $uri = substr($uri, 0, $qmarkIndex); |
|
| 892 | + if ($qmarkIndex !== false) { |
|
| 893 | + $uri = substr($uri, 0, $qmarkIndex); |
|
| 894 | + } |
|
| 886 | 895 | $data = $uri . '?' . http_build_query($_SERVER['REQUEST_METHOD'] == 'GET' ? $_GET : $_POST); |
| 887 | 896 | } |
| 888 | 897 | $stmt = $db->database->prepare($logQuery); |
@@ -917,10 +926,12 @@ discard block |
||
| 917 | 926 | } |
| 918 | 927 | $args = rtrim($args, ','); |
| 919 | 928 | } |
| 920 | - if (!empty($callerfunc)) |
|
| 921 | - $callerfunc = " ($callerfunc)"; |
|
| 922 | - if (!empty($args)) |
|
| 923 | - $callerfunc .= "[$args] "; |
|
| 929 | + if (!empty($callerfunc)) { |
|
| 930 | + $callerfunc = " ($callerfunc)"; |
|
| 931 | + } |
|
| 932 | + if (!empty($args)) { |
|
| 933 | + $callerfunc .= "[$args] "; |
|
| 934 | + } |
|
| 924 | 935 | } |
| 925 | 936 | $data[] = 'CALLER: (' . $callers[$calleridx]['line'] . ') ' . $callers[$calleridx]['file'] . $callerfunc; |
| 926 | 937 | } |
@@ -115,22 +115,26 @@ discard block |
||
| 115 | 115 | |
| 116 | 116 | $limit_start_rec = ($start - 1) * $listMaxEntriesPerPage; |
| 117 | 117 | |
| 118 | - if ($adb->isPostgres()) |
|
| 119 | - $list_result = $adb->pquery($query . |
|
| 118 | + if ($adb->isPostgres()) { |
|
| 119 | + $list_result = $adb->pquery($query . |
|
| 120 | 120 | " OFFSET $limit_start_rec LIMIT $listMaxEntriesPerPage ", []); |
| 121 | - else |
|
| 122 | - $list_result = $adb->pquery($query . |
|
| 121 | + } else { |
|
| 122 | + $list_result = $adb->pquery($query . |
|
| 123 | 123 | " LIMIT $limit_start_rec, $listMaxEntriesPerPage ", []); |
| 124 | + } |
|
| 124 | 125 | |
| 125 | 126 | $header = []; |
| 126 | 127 | $header[] = $mod_strings['LBL_LIST_PRODUCT_NAME']; |
| 127 | - if (getFieldVisibilityPermission('Products', $current_user->id, 'productcode') == '0') |
|
| 128 | - $header[] = $mod_strings['LBL_PRODUCT_CODE']; |
|
| 129 | - if (getFieldVisibilityPermission('Products', $current_user->id, 'unit_price') == '0') |
|
| 130 | - $header[] = $mod_strings['LBL_PRODUCT_UNIT_PRICE']; |
|
| 128 | + if (getFieldVisibilityPermission('Products', $current_user->id, 'productcode') == '0') { |
|
| 129 | + $header[] = $mod_strings['LBL_PRODUCT_CODE']; |
|
| 130 | + } |
|
| 131 | + if (getFieldVisibilityPermission('Products', $current_user->id, 'unit_price') == '0') { |
|
| 132 | + $header[] = $mod_strings['LBL_PRODUCT_UNIT_PRICE']; |
|
| 133 | + } |
|
| 131 | 134 | $header[] = $mod_strings['LBL_PB_LIST_PRICE']; |
| 132 | - if (isPermitted("PriceBooks", "EditView", "") == 'yes' || isPermitted("PriceBooks", "Delete", "") == 'yes') |
|
| 133 | - $header[] = $mod_strings['LBL_ACTION']; |
|
| 135 | + if (isPermitted("PriceBooks", "EditView", "") == 'yes' || isPermitted("PriceBooks", "Delete", "") == 'yes') { |
|
| 136 | + $header[] = $mod_strings['LBL_ACTION']; |
|
| 137 | + } |
|
| 134 | 138 | |
| 135 | 139 | $currency_id = $focus->column_fields['currency_id']; |
| 136 | 140 | $numRows = $adb->num_rows($list_result); |
@@ -146,10 +150,12 @@ discard block |
||
| 146 | 150 | |
| 147 | 151 | $entries = []; |
| 148 | 152 | $entries[] = textlength_check($adb->query_result($list_result, $i, "productname")); |
| 149 | - if (getFieldVisibilityPermission('Products', $current_user->id, 'productcode') == '0') |
|
| 150 | - $entries[] = $adb->query_result($list_result, $i, "productcode"); |
|
| 151 | - if (getFieldVisibilityPermission('Products', $current_user->id, 'unit_price') == '0') |
|
| 152 | - $entries[] = CurrencyField::convertToUserFormat($unit_price, null, true); |
|
| 153 | + if (getFieldVisibilityPermission('Products', $current_user->id, 'productcode') == '0') { |
|
| 154 | + $entries[] = $adb->query_result($list_result, $i, "productcode"); |
|
| 155 | + } |
|
| 156 | + if (getFieldVisibilityPermission('Products', $current_user->id, 'unit_price') == '0') { |
|
| 157 | + $entries[] = CurrencyField::convertToUserFormat($unit_price, null, true); |
|
| 158 | + } |
|
| 153 | 159 | |
| 154 | 160 | $entries[] = CurrencyField::convertToUserFormat($listprice, null, true); |
| 155 | 161 | $action = ""; |
@@ -159,12 +165,14 @@ discard block |
||
| 159 | 165 | $action .= '<img src="' . vtiger_imageurl('blank.gif', $theme) . '" border="0" />'; |
| 160 | 166 | } |
| 161 | 167 | if (isPermitted("PriceBooks", "Delete", "") == 'yes' && isPermitted('Products', 'Delete', $entity_id) == 'yes') { |
| 162 | - if ($action != "") |
|
| 163 | - $action .= ' | '; |
|
| 168 | + if ($action != "") { |
|
| 169 | + $action .= ' | '; |
|
| 170 | + } |
|
| 164 | 171 | $action .= '<img src="' . vtiger_imageurl('delete.gif', $theme) . '" 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">'; |
| 165 | 172 | } |
| 166 | - if ($action != "") |
|
| 167 | - $entries[] = $action; |
|
| 173 | + if ($action != "") { |
|
| 174 | + $entries[] = $action; |
|
| 175 | + } |
|
| 168 | 176 | $entries_list[] = $entries; |
| 169 | 177 | } |
| 170 | 178 | $navigationOutput[] = getRecordRangeMessage($list_result, $limit_start_rec, $noofrows); |
@@ -124,8 +124,9 @@ |
||
| 124 | 124 | $secondFallBackModuleDir = $secondFallBackModuleClassPath = $actualModule; |
| 125 | 125 | if ($actualModule != 'Users') { |
| 126 | 126 | $baseModule = $moduleHierarchyParts[0]; |
| 127 | - if ($baseModule == 'Settings') |
|
| 128 | - $baseModule = 'Settings:Vtiger'; |
|
| 127 | + if ($baseModule == 'Settings') { |
|
| 128 | + $baseModule = 'Settings:Vtiger'; |
|
| 129 | + } |
|
| 129 | 130 | $firstFallBackDir = str_replace(':', '.', $baseModule); |
| 130 | 131 | $firstFallBackClassPath = str_replace(':', '_', $baseModule); |
| 131 | 132 | } |