@@ -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); |
@@ -22,8 +22,9 @@ discard block |
||
| 22 | 22 | $groupClause = ""; |
| 23 | 23 | $orderClause = ""; |
| 24 | 24 | |
| 25 | - if ($debug) |
|
| 26 | - $log->info("fixPostgresQuery: " . $query); |
|
| 25 | + if ($debug) { |
|
| 26 | + $log->info("fixPostgresQuery: " . $query); |
|
| 27 | + } |
|
| 27 | 28 | |
| 28 | 29 | // If we already have an order or group cluase separate ist for later use |
| 29 | 30 | if (stripos($queryRecord, 'GROUP BY') > 0) { |
@@ -45,32 +46,36 @@ discard block |
||
| 45 | 46 | $privateGroupList = []; |
| 46 | 47 | $token = strtok($queryFields, ", () "); |
| 47 | 48 | while ($token !== false) { |
| 48 | - if (strpos($token, ".") !== false) |
|
| 49 | - array_push($privateGroupList, $token); |
|
| 49 | + if (strpos($token, ".") !== false) { |
|
| 50 | + array_push($privateGroupList, $token); |
|
| 51 | + } |
|
| 50 | 52 | $token = strtok(", () "); |
| 51 | 53 | } |
| 52 | 54 | sort($privateGroupList); |
| 53 | 55 | $groupFields = ""; |
| 54 | 56 | $last = ""; |
| 55 | 57 | for ($i = 0; $i < count($privateGroupList); $i++) { |
| 56 | - if ($last != $privateGroupList[$i]) |
|
| 57 | - if ($groupFields == "") |
|
| 58 | + if ($last != $privateGroupList[$i]) { |
|
| 59 | + if ($groupFields == "") |
|
| 58 | 60 | $groupFields = $privateGroupList[$i]; |
| 59 | - else |
|
| 60 | - $groupFields .= "," . $privateGroupList[$i]; |
|
| 61 | + } else { |
|
| 62 | + $groupFields .= "," . $privateGroupList[$i]; |
|
| 63 | + } |
|
| 61 | 64 | $last = $privateGroupList[$i]; |
| 62 | 65 | } |
| 63 | 66 | |
| 64 | 67 | // Rebuild the query |
| 65 | 68 | $query = sprintf("SELECT %s%s", $queryFields, $queryRecord); |
| 66 | - if ($groupClause != "") |
|
| 67 | - $groupClause = $groupClause . "," . $groupFields; |
|
| 68 | - else |
|
| 69 | - $groupClause = $groupFields; |
|
| 69 | + if ($groupClause != "") { |
|
| 70 | + $groupClause = $groupClause . "," . $groupFields; |
|
| 71 | + } else { |
|
| 72 | + $groupClause = $groupFields; |
|
| 73 | + } |
|
| 70 | 74 | $query .= expandStar($groupClause, $log) . " " . $orderClause; |
| 71 | 75 | |
| 72 | - if ($debug) |
|
| 73 | - $log->info("fixPostgresQuery result: " . $query); |
|
| 76 | + if ($debug) { |
|
| 77 | + $log->info("fixPostgresQuery result: " . $query); |
|
| 78 | + } |
|
| 74 | 79 | |
| 75 | 80 | return( $query); |
| 76 | 81 | } |
@@ -94,22 +99,25 @@ discard block |
||
| 94 | 99 | $subfield = substr($field, $pos + 1, strlen($field) - $pos); |
| 95 | 100 | |
| 96 | 101 | //do we need to expand? |
| 97 | - if ($subfield == "*") |
|
| 98 | - $field = expandRecord($table, $log); |
|
| 102 | + if ($subfield == "*") { |
|
| 103 | + $field = expandRecord($table, $log); |
|
| 104 | + } |
|
| 99 | 105 | } |
| 100 | 106 | |
| 101 | 107 | //add the propably expanded field to the querylist |
| 102 | - if ($expanded == "") |
|
| 103 | - $expanded = $field; |
|
| 104 | - else |
|
| 105 | - $expanded .= "," . $field; |
|
| 108 | + if ($expanded == "") { |
|
| 109 | + $expanded = $field; |
|
| 110 | + } else { |
|
| 111 | + $expanded .= "," . $field; |
|
| 112 | + } |
|
| 106 | 113 | } |
| 107 | 114 | |
| 108 | 115 | //next field |
| 109 | 116 | $field = strtok(","); |
| 110 | 117 | } |
| 111 | - if ($expanded != '') |
|
| 112 | - $expanded = " GROUP BY " . trim($expanded, ","); |
|
| 118 | + if ($expanded != '') { |
|
| 119 | + $expanded = " GROUP BY " . trim($expanded, ","); |
|
| 120 | + } |
|
| 113 | 121 | //return the expanded fieldlist |
| 114 | 122 | return( $expanded); |
| 115 | 123 | } |
@@ -122,68 +130,84 @@ discard block |
||
| 122 | 130 | $subfields = []; |
| 123 | 131 | |
| 124 | 132 | //vtiger_products table |
| 125 | - if ($table == "vtiger_products") |
|
| 126 | - $subfields = array("productid", "productname", "productcode", "productcategory", "manufacturer", "qty_per_unit", "unit_price", "weight", "pack_size", "sales_start_date", "sales_end_date", "start_date", "expiry_date", "cost_factor", "commissionrate", "commissionmethod", "discontinued", "usageunit", "currency", "reorderlevel", "website", "taxclass", "mfr_part_no", "vendor_part_no", "serialno", "qtyinstock", "productsheet", "qtyindemand", "glacct", "vendor_id", "imagename"); |
|
| 133 | + if ($table == "vtiger_products") { |
|
| 134 | + $subfields = array("productid", "productname", "productcode", "productcategory", "manufacturer", "qty_per_unit", "unit_price", "weight", "pack_size", "sales_start_date", "sales_end_date", "start_date", "expiry_date", "cost_factor", "commissionrate", "commissionmethod", "discontinued", "usageunit", "currency", "reorderlevel", "website", "taxclass", "mfr_part_no", "vendor_part_no", "serialno", "qtyinstock", "productsheet", "qtyindemand", "glacct", "vendor_id", "imagename"); |
|
| 135 | + } |
|
| 127 | 136 | |
| 128 | 137 | //vtiger_activity table |
| 129 | - elseif ($table == "vtiger_activity") |
|
| 130 | - $subfields = array("activityid", "subject", "semodule", "activitytype", "date_start", "due_date", "time_start", "time_end", "sendnotification", "duration_hours", "duration_minutes", "status", "eventstatus", "priority", "location", "notime", "visibility", "recurringtype"); |
|
| 138 | + elseif ($table == "vtiger_activity") { |
|
| 139 | + $subfields = array("activityid", "subject", "semodule", "activitytype", "date_start", "due_date", "time_start", "time_end", "sendnotification", "duration_hours", "duration_minutes", "status", "eventstatus", "priority", "location", "notime", "visibility", "recurringtype"); |
|
| 140 | + } |
|
| 131 | 141 | |
| 132 | 142 | //vtiger_notes table |
| 133 | - elseif ($table == "vtiger_notes") |
|
| 134 | - $subfields = array("notesid", "contact_id", "title", "filename", "notecontent"); |
|
| 143 | + elseif ($table == "vtiger_notes") { |
|
| 144 | + $subfields = array("notesid", "contact_id", "title", "filename", "notecontent"); |
|
| 145 | + } |
|
| 135 | 146 | |
| 136 | 147 | //vtiger_faq table |
| 137 | - elseif ($table == "vtiger_faq") |
|
| 138 | - $subfields = array("id", "product_id", "question", "answer", "category", "status"); |
|
| 148 | + elseif ($table == "vtiger_faq") { |
|
| 149 | + $subfields = array("id", "product_id", "question", "answer", "category", "status"); |
|
| 150 | + } |
|
| 139 | 151 | |
| 140 | 152 | //vtiger_profile2field |
| 141 | - elseif ($table == "vtiger_profile2field") |
|
| 142 | - $subfields = array("profileid", "tabid", "fieldid", "visible", "readonly"); |
|
| 153 | + elseif ($table == "vtiger_profile2field") { |
|
| 154 | + $subfields = array("profileid", "tabid", "fieldid", "visible", "readonly"); |
|
| 155 | + } |
|
| 143 | 156 | |
| 144 | 157 | //vtiger_field |
| 145 | - elseif ($table == "vtiger_field") |
|
| 146 | - $subfields = array("tabid", "fieldid", "columnname", "tablename", "generatedtype", "uitype", "fieldname", "fieldlabel", "readonly", "presence", "selected", "maximumlength", "sequence", "block", "displaytype", "typeofdata", "quickcreate", "quickcreatesequence", "info_type"); |
|
| 158 | + elseif ($table == "vtiger_field") { |
|
| 159 | + $subfields = array("tabid", "fieldid", "columnname", "tablename", "generatedtype", "uitype", "fieldname", "fieldlabel", "readonly", "presence", "selected", "maximumlength", "sequence", "block", "displaytype", "typeofdata", "quickcreate", "quickcreatesequence", "info_type"); |
|
| 160 | + } |
|
| 147 | 161 | |
| 148 | 162 | //vtiger_producttaxrel |
| 149 | - elseif ($table == "vtiger_producttaxrel") |
|
| 150 | - $subfields = array("productid", "taxid", "taxpercentage"); |
|
| 163 | + elseif ($table == "vtiger_producttaxrel") { |
|
| 164 | + $subfields = array("productid", "taxid", "taxpercentage"); |
|
| 165 | + } |
|
| 151 | 166 | |
| 152 | 167 | //vtiger_inventorytaxinfo |
| 153 | - elseif ($table == "vtiger_inventorytaxinfo") |
|
| 154 | - $subfields = array("taxid", "taxname", "taxlabel", "percentage", "deleted"); |
|
| 168 | + elseif ($table == "vtiger_inventorytaxinfo") { |
|
| 169 | + $subfields = array("taxid", "taxname", "taxlabel", "percentage", "deleted"); |
|
| 170 | + } |
|
| 155 | 171 | |
| 156 | 172 | //vtiger_role2picklist |
| 157 | - elseif ($table == "vtiger_role2picklist") |
|
| 158 | - $subfields = array("roleid", "picklistid", "sortid"); |
|
| 173 | + elseif ($table == "vtiger_role2picklist") { |
|
| 174 | + $subfields = array("roleid", "picklistid", "sortid"); |
|
| 175 | + } |
|
| 159 | 176 | |
| 160 | 177 | //vtiger_contactdetails |
| 161 | - elseif ($table == "vtiger_contactdetails") |
|
| 162 | - $subfields = array("lastname", "contactid", "accountid", "salutation", "firstname", "email", "phone", "mobile", "title", "department", "fax", "reportsto", "training", "usertype", "contacttype", "otheremail", "yahooid", "donotcall", "emailoptout", "imagename", "reference", "notify_owner"); |
|
| 178 | + elseif ($table == "vtiger_contactdetails") { |
|
| 179 | + $subfields = array("lastname", "contactid", "accountid", "salutation", "firstname", "email", "phone", "mobile", "title", "department", "fax", "reportsto", "training", "usertype", "contacttype", "otheremail", "yahooid", "donotcall", "emailoptout", "imagename", "reference", "notify_owner"); |
|
| 180 | + } |
|
| 163 | 181 | |
| 164 | 182 | //vtiger_crmentity |
| 165 | - elseif ($table == "vtiger_crmentity") |
|
| 166 | - $subfields = array("crmid", "smcreatorid", "smownerid", "modifiedby", "setype", "description", "createdtime", "modifiedtime", "viewedtime", "status", "version", "presence", "deleted"); |
|
| 183 | + elseif ($table == "vtiger_crmentity") { |
|
| 184 | + $subfields = array("crmid", "smcreatorid", "smownerid", "modifiedby", "setype", "description", "createdtime", "modifiedtime", "viewedtime", "status", "version", "presence", "deleted"); |
|
| 185 | + } |
|
| 167 | 186 | |
| 168 | 187 | //vtiger_seactivityrel |
| 169 | - elseif ($table == "vtiger_seactivityrel") |
|
| 170 | - $subfields = array("crmid", "activityid"); |
|
| 188 | + elseif ($table == "vtiger_seactivityrel") { |
|
| 189 | + $subfields = array("crmid", "activityid"); |
|
| 190 | + } |
|
| 171 | 191 | |
| 172 | 192 | //vtiger_cntactivityrel |
| 173 | - elseif ($table == "vtiger_cntactivityrel") |
|
| 174 | - $subfields = array("contactid", "activityid"); |
|
| 193 | + elseif ($table == "vtiger_cntactivityrel") { |
|
| 194 | + $subfields = array("contactid", "activityid"); |
|
| 195 | + } |
|
| 175 | 196 | |
| 176 | 197 | //vtiger_leaddetails |
| 177 | - elseif ($table == "vtiger_leaddetails") |
|
| 178 | - $subfields = array("leadid", "email", "interest", "firstname", "salutation", "lastname", "company", "annualrevenue", "industry", "campaign", "rating", "leadstatus", "leadsource", "converted", "designation", "space", "comments", "priority", "demorequest", "partnercontact", "productversion", "product", "maildate", "nextstepdate", "fundingsituation", "purpose", "evaluationstatus", "transferdate", "revenuetype", "noofemployees", "yahooid", "assignleadchk"); |
|
| 198 | + elseif ($table == "vtiger_leaddetails") { |
|
| 199 | + $subfields = array("leadid", "email", "interest", "firstname", "salutation", "lastname", "company", "annualrevenue", "industry", "campaign", "rating", "leadstatus", "leadsource", "converted", "designation", "space", "comments", "priority", "demorequest", "partnercontact", "productversion", "product", "maildate", "nextstepdate", "fundingsituation", "purpose", "evaluationstatus", "transferdate", "revenuetype", "noofemployees", "yahooid", "assignleadchk"); |
|
| 200 | + } |
|
| 179 | 201 | |
| 180 | 202 | //vtiger_pricebook |
| 181 | - elseif ($table == "vtiger_pricebook") |
|
| 182 | - $subfields = array("pricebookid", "bookname", "active", "description"); |
|
| 203 | + elseif ($table == "vtiger_pricebook") { |
|
| 204 | + $subfields = array("pricebookid", "bookname", "active", "description"); |
|
| 205 | + } |
|
| 183 | 206 | |
| 184 | 207 | //fields of the requested array still undefined |
| 185 | - else |
|
| 186 | - $log->info("function expandRecord: please add structural information for table '" . $table . "'"); |
|
| 208 | + else { |
|
| 209 | + $log->info("function expandRecord: please add structural information for table '" . $table . "'"); |
|
| 210 | + } |
|
| 187 | 211 | |
| 188 | 212 | //construct an entity string |
| 189 | 213 | for ($i = 0; $i < count($subfields); $i++) { |
@@ -191,8 +215,9 @@ discard block |
||
| 191 | 215 | } |
| 192 | 216 | |
| 193 | 217 | //remove the trailiung , |
| 194 | - if (strlen($result) > 0) |
|
| 195 | - $result = substr($result, 0, strlen($result) - 1); |
|
| 218 | + if (strlen($result) > 0) { |
|
| 219 | + $result = substr($result, 0, strlen($result) - 1); |
|
| 220 | + } |
|
| 196 | 221 | |
| 197 | 222 | //return out new string |
| 198 | 223 | return( $result); |
@@ -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); |