From: Joe Date: Sat, 4 Jun 2022 22:34:23 +0000 (+0200) Subject: php 8.1 deprecated null parameters fixed. X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=commitdiff_plain;h=017f59aff3a7c74d7eb32cb93d343d5d6eb7cd20;p=fa-stable.git php 8.1 deprecated null parameters fixed. --- diff --git a/includes/JsHttpRequest.php b/includes/JsHttpRequest.php index 7eb712dd..59d5b86e 100644 --- a/includes/JsHttpRequest.php +++ b/includes/JsHttpRequest.php @@ -266,12 +266,14 @@ class JsHttpRequest '_POST'=> $rawPost, ); foreach ($source as $dst=>$src) { - // First correct all 2-byte entities. - $s = preg_replace('/%(?!5B)(?!5D)([0-9a-f]{2})/si', '%u00\\1', $src); - // Now we can use standard parse_str() with no worry! - $data = null; - parse_str($s, $data); - $GLOBALS[$dst] = $this->_ucs2EntitiesDecode($data); + if ($src != NULL) { + // First correct all 2-byte entities. + $s = preg_replace('/%(?!5B)(?!5D)([0-9a-f]{2})/si', '%u00\\1', $src); + // Now we can use standard parse_str() with no worry! + $data = null; + parse_str($s, $data); + $GLOBALS[$dst] = $this->_ucs2EntitiesDecode($data); + } } $GLOBALS['HTTP_GET_VARS'] = $_GET; // deprecated vars $GLOBALS['HTTP_POST_VARS'] = $_POST; diff --git a/includes/ui/ui_lists.inc b/includes/ui/ui_lists.inc index c83150d6..a15d4573 100644 --- a/includes/ui/ui_lists.inc +++ b/includes/ui/ui_lists.inc @@ -302,55 +302,57 @@ $opts = array( // default options $link = ""; $id = $name; if ($SysPrefs->use_popup_windows) { - switch (strtolower($type)) { - case "stock": - $link = $path_to_root . "/inventory/inquiry/stock_list.php?popup=1&type=all&client_id=" . $id; - $img_title = _("Search items"); - break; - case "stock_manufactured": - $link = $path_to_root . "/inventory/inquiry/stock_list.php?popup=1&type=manufactured&client_id=" . $id; - $img_title = _("Search items"); - break; - case "stock_purchased": - $link = $path_to_root . "/inventory/inquiry/stock_list.php?popup=1&type=purchasable&client_id=" . $id; - $img_title = _("Search items"); - break; - case "stock_sales": - $link = $path_to_root . "/inventory/inquiry/stock_list.php?popup=1&type=sales&client_id=" . $id; - $img_title = _("Search items"); - break; - case "stock_costable": - $link = $path_to_root . "/inventory/inquiry/stock_list.php?popup=1&type=costable&client_id=" . $id; - $img_title = _("Search items"); - break; - case "component": - $parent = $opts['parent']; - $link = $path_to_root . "/inventory/inquiry/stock_list.php?popup=1&type=component&parent=".$parent."&client_id=" . $id; - $img_title = _("Search items"); - break; - case "kits": - $link = $path_to_root . "/inventory/inquiry/stock_list.php?popup=1&type=kits&client_id=" . $id; - $img_title = _("Search items"); - break; - case "customer": - $link = $path_to_root . "/sales/inquiry/customers_list.php?popup=1&client_id=" . $id; - $img_title = _("Search customers"); - break; - case "branch": - $link = $path_to_root . "/sales/inquiry/customer_branches_list.php?popup=1&client_id=" . $id . "#customer_id"; - $img_title = _("Search branches"); - break; - case "supplier": - $link = $path_to_root . "/purchasing/inquiry/suppliers_list.php?popup=1&client_id=" . $id; - $img_title = _("Search suppliers"); - break; - case "account": - case "account2": - $skip = strtolower($type) == "account" ? false : true; - $link = $path_to_root . "/gl/inquiry/accounts_list.php?popup=1&skip=".$skip."&client_id=" . $id; - $img_title = _("Search GL accounts"); - break; - } + if ($type != NULL) { + switch (strtolower($type)) { + case "stock": + $link = $path_to_root . "/inventory/inquiry/stock_list.php?popup=1&type=all&client_id=" . $id; + $img_title = _("Search items"); + break; + case "stock_manufactured": + $link = $path_to_root . "/inventory/inquiry/stock_list.php?popup=1&type=manufactured&client_id=" . $id; + $img_title = _("Search items"); + break; + case "stock_purchased": + $link = $path_to_root . "/inventory/inquiry/stock_list.php?popup=1&type=purchasable&client_id=" . $id; + $img_title = _("Search items"); + break; + case "stock_sales": + $link = $path_to_root . "/inventory/inquiry/stock_list.php?popup=1&type=sales&client_id=" . $id; + $img_title = _("Search items"); + break; + case "stock_costable": + $link = $path_to_root . "/inventory/inquiry/stock_list.php?popup=1&type=costable&client_id=" . $id; + $img_title = _("Search items"); + break; + case "component": + $parent = $opts['parent']; + $link = $path_to_root . "/inventory/inquiry/stock_list.php?popup=1&type=component&parent=".$parent."&client_id=" . $id; + $img_title = _("Search items"); + break; + case "kits": + $link = $path_to_root . "/inventory/inquiry/stock_list.php?popup=1&type=kits&client_id=" . $id; + $img_title = _("Search items"); + break; + case "customer": + $link = $path_to_root . "/sales/inquiry/customers_list.php?popup=1&client_id=" . $id; + $img_title = _("Search customers"); + break; + case "branch": + $link = $path_to_root . "/sales/inquiry/customer_branches_list.php?popup=1&client_id=" . $id . "#customer_id"; + $img_title = _("Search branches"); + break; + case "supplier": + $link = $path_to_root . "/purchasing/inquiry/suppliers_list.php?popup=1&client_id=" . $id; + $img_title = _("Search suppliers"); + break; + case "account": + case "account2": + $skip = strtolower($type) == "account" ? false : true; + $link = $path_to_root . "/gl/inquiry/accounts_list.php?popup=1&skip=".$skip."&client_id=" . $id; + $img_title = _("Search GL accounts"); + break; + } + } } if ($link !=="") { diff --git a/reporting/includes/pdf_report.inc b/reporting/includes/pdf_report.inc index 0d699731..ecb31b0e 100644 --- a/reporting/includes/pdf_report.inc +++ b/reporting/includes/pdf_report.inc @@ -743,7 +743,7 @@ class FrontReport extends Cpdf function TextWrap($xpos, $ypos, $len, $str, $align = 'left', $border = 0, $fill = 0, $link = NULL, $stretch = 1, $spacebreak=false) { - $str = strtr($str, array("\r"=>'')); + $str = ($str != NULL ? strtr($str, array("\r"=>'')) : ""); if ($this->fontSize != $this->oldFontSize) { @@ -799,7 +799,7 @@ class FrontReport extends Cpdf function TextWrapLines($c, $width, $txt, $align='left', $border=0, $fill=0, $link=NULL, $stretch=0, $spacebreak=true) { - $str = explode("\n", $txt); + $str = ($txt != NULL ? explode("\n", $txt) : array()); for ($i = 0; $i < count($str); $i++) { diff --git a/reporting/rep101.php b/reporting/rep101.php index 667604c8..0ea49173 100644 --- a/reporting/rep101.php +++ b/reporting/rep101.php @@ -172,16 +172,16 @@ function print_customer_balances() $bal = get_open_balance($myrow['debtor_no'], $from); $init = array(); - $init[0] = round2(abs($bal['charges']*$rate), $dec); - $init[1] = round2(abs($bal['credits']*$rate), $dec); - $init[2] = round2($bal['Allocated']*$rate, $dec); + $init[0] = round2(($bal != false ? abs($bal['charges']) : 0)*$rate, $dec); + $init[1] = round2(($bal != false ? abs($bal['credits']) : 0)*$rate, $dec); + $init[2] = round2(($bal != false ? $bal['Allocated'] : 0)*$rate, $dec); if ($show_balance) { $init[3] = $init[0] - $init[1]; $accumulate += $init[3]; } else - $init[3] = round2($bal['OutStanding']*$rate, $dec); + $init[3] = round2(($bal != false ? $bal['OutStanding'] : 0)*$rate, $dec); $res = get_transactions($myrow['debtor_no'], $from, $to); if ($no_zeros && db_num_rows($res) == 0) continue; diff --git a/reporting/rep103.php b/reporting/rep103.php index 271d6818..9c694bec 100644 --- a/reporting/rep103.php +++ b/reporting/rep103.php @@ -215,7 +215,7 @@ function print_customer_details_listing() $rep->TextCol(1, 2, _('Price List') . ": " . $myrow['sales_type']); $rep->TextCol(2, 3, $myrow['br_name']); $rep->NewLine(); - $adr = Explode("\n", $myrow['address']); + $adr = $myrow['address'] != NULL ? Explode("\n", $myrow['address']) : array(); if ($myrow['br_post_address'] == '') $adr2 = Explode("\n", $myrow['br_address']); else diff --git a/reporting/rep201.php b/reporting/rep201.php index 88db421d..8fddfa95 100644 --- a/reporting/rep201.php +++ b/reporting/rep201.php @@ -150,20 +150,20 @@ function print_supplier_balances() $rate = $convert ? get_exchange_rate_from_home_currency($myrow['curr_code'], Today()) : 1; $bal = get_open_balance($myrow['supplier_id'], $from); $init = array(); - $bal['charges'] = isset($bal['charges']) ? $bal['charges'] : 0; - $bal['credits'] = isset($bal['credits']) ? $bal['credits'] : 0; - $bal['Allocated'] = isset($bal['Allocated']) ? $bal['Allocated'] : 0; - $bal['OutStanding'] = isset($bal['OutStanding']) ? $bal['OutStanding'] : 0; - $init[0] = round2(abs($bal['charges']*$rate), $dec); - $init[1] = round2(Abs($bal['credits']*$rate), $dec); - $init[2] = round2($bal['Allocated']*$rate, $dec); + //$bal['charges'] = $bal != false ? $bal['charges'] : 0; + //$bal['credits'] = $bal != false ? $bal['credits'] : 0; + //$bal['Allocated'] = $bal != false ? $bal['Allocated'] : 0; + //$bal['OutStanding'] = $bal != false ? $bal['OutStanding'] : 0; + $init[0] = round2(($bal != false ? abs($bal['charges']) : 0)*$rate, $dec); + $init[1] = round2(($bal != false ? abs($bal['credits']) : 0)*$rate, $dec); + $init[2] = round2(($bal != false ? $bal['Allocated'] : 0)*$rate, $dec); if ($show_balance) { $init[3] = $init[0] - $init[1]; $accumulate += $init[3]; } else - $init[3] = round2($bal['OutStanding']*$rate, $dec); + $init[3] = round2(($bal != false ? $bal['OutStanding'] : 0)*$rate, $dec); $res = getTransactions($myrow['supplier_id'], $from, $to); if ($no_zeros && db_num_rows($res) == 0) continue; diff --git a/reporting/rep206.php b/reporting/rep206.php index 79f4f1f3..9d184556 100644 --- a/reporting/rep206.php +++ b/reporting/rep206.php @@ -149,13 +149,9 @@ function print_supplier_balances() $rate = $convert ? get_exchange_rate_from_home_currency($myrow['curr_code'], Today()) : 1; $bal = get_open_balance($myrow['supplier_id'], $from); $init = array(); - $bal['charges'] = isset($bal['charges']) ? $bal['charges'] : 0; - $bal['credits'] = isset($bal['credits']) ? $bal['credits'] : 0; - $bal['Allocated'] = isset($bal['Allocated']) ? $bal['Allocated'] : 0; - $bal['OutStanding'] = isset($bal['OutStanding']) ? $bal['OutStanding'] : 0; - $init[0] = round2(abs($bal['charges']*$rate), $dec); - $init[1] = round2(Abs($bal['credits']*$rate), $dec); - $init[2] = round2($bal['Allocated']*$rate, $dec); + $init[0] = round2(($bal != false ? abs($bal['charges']) : 0)*$rate, $dec); + $init[1] = round2(($bal != false ? abs($bal['credits']) : 0)*$rate, $dec); + $init[2] = round2(($bal != false ? $bal['Allocated'] : 0)*$rate, $dec); $init[3] = $init[1] - $init[0]; $accumulate += $init[3]; diff --git a/reporting/rep302.php b/reporting/rep302.php index cdfd0e9a..1c821689 100644 --- a/reporting/rep302.php +++ b/reporting/rep302.php @@ -113,11 +113,11 @@ function print_inventory_planning() $cols = array(0, 50, 150, 180, 210, 240, 270, 300, 330, 390, 435, 480, 525); - $per0 = strftime('%b',mktime(0,0,0,date('m'),1,date('Y'))); - $per1 = strftime('%b',mktime(0,0,0,date('m')-1,1,date('Y'))); - $per2 = strftime('%b',mktime(0,0,0,date('m')-2,1,date('Y'))); - $per3 = strftime('%b',mktime(0,0,0,date('m')-3,1,date('Y'))); - $per4 = strftime('%b',mktime(0,0,0,date('m')-4,1,date('Y'))); + $per0 = substr(date('F',mktime(0,0,0,date('m'),1,date('Y'))), 0, 3); + $per1 = substr(date('F',mktime(0,0,0,date('m')-1,1,date('Y'))), 0, 3); + $per2 = substr(date('F',mktime(0,0,0,date('m')-2,1,date('Y'))), 0, 3); + $per3 = substr(date('F',mktime(0,0,0,date('m')-3,1,date('Y'))), 0, 3); + $per4 = substr(date('F',mktime(0,0,0,date('m')-4,1,date('Y'))), 0, 3); $headers = array(_('Category'), '', $per4, $per3, $per2, $per1, $per0, '3*M', _('QOH'), _('Cust Ord'), _('Supp Ord'), _('Sugg Ord')); diff --git a/reporting/rep705.php b/reporting/rep705.php index 452eaa71..3ac9d66d 100644 --- a/reporting/rep705.php +++ b/reporting/rep705.php @@ -239,18 +239,18 @@ function print_annual_expense_breakdown() list($yr, $mo, $da) = jalali_to_gregorian($yr, $mo, $da); elseif ($SysPrefs->date_system == 2) list($yr, $mo, $da) = islamic_to_gregorian($yr, $mo, $da); - $per12 = strftime('%b',mktime(0,0,0,$mo,$da,$yr)); - $per11 = strftime('%b',mktime(0,0,0,$mo-1,$da,$yr)); - $per10 = strftime('%b',mktime(0,0,0,$mo-2,$da,$yr)); - $per09 = strftime('%b',mktime(0,0,0,$mo-3,$da,$yr)); - $per08 = strftime('%b',mktime(0,0,0,$mo-4,$da,$yr)); - $per07 = strftime('%b',mktime(0,0,0,$mo-5,$da,$yr)); - $per06 = strftime('%b',mktime(0,0,0,$mo-6,$da,$yr)); - $per05 = strftime('%b',mktime(0,0,0,$mo-7,$da,$yr)); - $per04 = strftime('%b',mktime(0,0,0,$mo-8,$da,$yr)); - $per03 = strftime('%b',mktime(0,0,0,$mo-9,$da,$yr)); - $per02 = strftime('%b',mktime(0,0,0,$mo-10,$da,$yr)); - $per01 = strftime('%b',mktime(0,0,0,$mo-11,$da,$yr)); + $per12 = substr(date('F',mktime(0,0,0,$mo,$da,$yr)), 0, 3); + $per11 = substr(date('F',mktime(0,0,0,$mo-1,$da,$yr)), 0, 3); + $per10 = substr(date('F',mktime(0,0,0,$mo-2,$da,$yr)), 0, 3); + $per09 = substr(date('F',mktime(0,0,0,$mo-3,$da,$yr)), 0, 3); + $per08 = substr(date('F',mktime(0,0,0,$mo-4,$da,$yr)), 0, 3); + $per07 = substr(date('F',mktime(0,0,0,$mo-5,$da,$yr)), 0, 3); + $per06 = substr(date('F',mktime(0,0,0,$mo-6,$da,$yr)), 0, 3); + $per05 = substr(date('F',mktime(0,0,0,$mo-7,$da,$yr)), 0, 3); + $per04 = substr(date('F',mktime(0,0,0,$mo-8,$da,$yr)), 0, 3); + $per03 = substr(date('F',mktime(0,0,0,$mo-9,$da,$yr)), 0, 3); + $per02 = substr(date('F',mktime(0,0,0,$mo-10,$da,$yr)), 0, 3); + $per01 = substr(date('F',mktime(0,0,0,$mo-11,$da,$yr)), 0, 3); $headers = array(_('Account'), _('Account Name'), $per01, $per02, $per03, $per04, $per05, $per06, $per07, $per08, $per09, $per10, $per11, $per12, _('Total'));