$result = db_query($sql, "could not get tag type");
$row = db_fetch_row($result);
- return $row[0];
+ return is_array($row) ? $row[0] : false;
}
//--------------------------------------------------------------------------------------
$result = db_query($sql, "could not get tag description");
$row = db_fetch_row($result);
- return $row[0];
+ return is_array($row) ? $row[0] : false;
}
//--------------------------------------------------------------------------------------
$row = db_fetch_row($result);
- return $row[0];
+ return is_array($row) ? $row[0] : false;
}
function update_fixed_asset_class($fa_class_id, $parent_id, $description, $long_description, $depreciation_rate)
change_tpl_flag($id);
-if (isset($_POST['Reconcile'])) {
+if (isset($_POST['last']) && isset($_POST['Reconcile'])) {
set_focus('bank_date');
foreach($_POST['last'] as $id => $value)
if ($value != check_value('rec_'.$id))
$Ajax->activate('_page_body');
}
-if (isset($_POST['ReconcileAll'])) {
+if (isset($_POST['last']) && isset($_POST['ReconcileAll'])) {
set_focus('bank_date');
foreach($_POST['last'] as $id => $value)
set_tpl_flag($id);
$result = db_query($sql, "could not get account type");
$row = db_fetch_row($result);
- return $row[0];
+ return is_array($row) ? $row[0] : false;
}
function delete_account_type($id)
if(db_num_rows($result) == 0)
return 0;
$row = db_fetch($result);
- return $row[0];
+ return $row[0];
}
/*
hidden('PersonDetailID');
}
$trans = get_customer_habit($_POST['person_id']); // take care of customers on hold
- if ($trans['dissallow_invoices'] != 0)
+ if (is_array($trans) && $trans['dissallow_invoices'] != 0)
{
if ($payment)
{
if ($_POST['PayType'] == PT_CUSTOMER)
{
$acc = get_branch_accounts($_POST['PersonDetailID']);
- $_POST['code_id'] = $acc['receivables_account'];
+ $_POST['code_id'] = is_array($acc) ? $acc['receivables_account'] : '';
}
elseif ($_POST['PayType'] == PT_SUPPLIER)
{
$acc = get_supplier_accounts($_POST['person_id']);
- $_POST['code_id'] = $acc['payable_account'];
- $_POST['dimension_id'] = $acc['dimension_id'];
- $_POST['dimension2_id'] = $acc['dimension2_id'];
+ $_POST['code_id'] = is_array($acc) ? $acc['payable_account'] : '';
+ $_POST['dimension_id'] = is_array($acc) ? $acc['dimension_id'] : '';
+ $_POST['dimension2_id'] = is_array($acc) ? $acc['dimension2_id'] : '';
}
else {
$_POST['code_id'] =
$result = db_query($sql, "could not do check empty query");
$myrow = db_fetch_row($result);
- return $myrow[0] > 0;
+ return is_array($myrow) ? $myrow[0] > 0 : false;
}
//
// Integer input check
$result = db_query($sql, "could not get sales type");
$row = db_fetch_row($result);
- return $row[0];
+ return is_array($row) ? $row[0] : false;
}
//----------------------------------------------------------------------------------------
$result = db_query($sql, "The standard cost cannot be retrieved");
$row = db_fetch($result);
- if ($row['decimals'] == -1)
+ if (is_array($row) && $row['decimals'] == -1)
$row['decimals'] = user_qty_dec();
return $row;
}
$myrow = db_fetch_row($result);
- return $myrow[0];
+ return is_array($myrow) ? $myrow[0] : false;
}
//--------------------------------------------------------------------------------------
$myrow = db_fetch_row($result);
- return $myrow[0];
+ return is_array($myrow) ? $myrow[0] : false;
}
//--------------------------------------------------------------------------------------
AND type=".ST_CUSTDELIVERY." AND trans_no=".db_escape($trans_no);
$result = db_query($sql, "Could not get stock moves");
$row = db_fetch_row($result);
- return $row[0];
+ return is_array($row) ? $row[0] : false;
}
/*
Returns start move_id in latest negative status period for $stock_id
$result = db_query($sql,"retreive stock purchase price");
$row = db_fetch_row($result);
- return $row[0];
+ return is_array($row) ? $row[0] : false;
}
function update_purchase_value($stock_id, $price)
if ($result == false)
return false;
$row = db_fetch_row($result);
- $this->rec_count = $row[0];
+ $this->rec_count = is_array($row) ? $row[0] : 0;
+;
$this->max_page = $this->page_len ?
ceil($this->rec_count/$this->page_len) : 0;
$result = db_query($sql, "could not get sales type");
$row = db_fetch_row($result);
- return $row[0];
+ return is_array($row) ? $row[0] : false;
}
$result = db_query($sql, "could not retrieve unit description");
$row = db_fetch_row($result);
- return $row[0];
+ return is_array($row) ? $row[0] : false;
}
function item_unit_used($unit) {
$result = db_query($sql, "could not get unit decimals");
$row = db_fetch_row($result);
- return $row[0];
+ return is_array($row) ? $row[0] : false;
}
if (get_post('item_code') == '') { // new kit/alias
if ($Mode!='ADD_ITEM' && $Mode!='UPDATE_ITEM') {
- $_POST['description'] = $props['description'];
- $_POST['category'] = $props['category_id'];
+ $_POST['description'] = is_array($props) ? $props['description'] : '';
+ $_POST['category'] = is_array($props) ? $props['category_id'] : '';
}
text_row(_("Description:"), 'description', null, 50, 200);
stock_categories_list_row(_("Category:"), 'category', null);
$row = db_fetch_row($result);
- return $row[0];
+ return is_array($row) ? $row[0] : false;
}
function get_supplier_accounts($supplier_id)
AND trans.tran_date=".db_escape($date);
$result = db_query($sql,"No transactions were returned");
$row = db_fetch_row($result);
- if (isset($row[0]))
- return $row[0];
- else
- return '';
+ return is_array($row) ? $row[0] : '';
}
//----------------------------------------------------------------------------------------------------
return db_query($sql,"No transactions were returned");
}
-function trans_qty($stock_id, $location=null, $from_date, $to_date, $inward = true)
+function trans_qty($stock_id, $location, $from_date, $to_date, $inward = true)
{
if ($from_date == null)
$from_date = Today();
return db_query($sql,"No transactions were returned");
}
-function trans_qty($stock_id, $location=null, $from_date, $to_date, $inward = true)
+function trans_qty($stock_id, $location, $from_date, $to_date, $inward = true)
{
if ($from_date == null)
$from_date = Today();
}
-function avg_unit_cost($stock_id, $location=null, $to_date)
+function avg_unit_cost($stock_id, $location, $to_date)
{
if ($to_date == null)
$to_date = Today();
//----------------------------------------------------------------------------------------------------
-function trans_qty_unit_cost($stock_id, $location=null, $from_date, $to_date, $inward = true)
+function trans_qty_unit_cost($stock_id, $location, $from_date, $to_date, $inward = true)
{
if ($from_date == null)
$from_date = Today();
AND trans.tran_date=".db_escape($date);
$result = db_query($sql,"No transactions were returned");
$row = db_fetch_row($result);
- if (isset($row[0]))
- return $row[0];
- else
- return '';
+ return is_array($row) ? $row[0] : '';
}
//----------------------------------------------------------------------------------------------------
tran_date <= '$end_date' ORDER BY tran_date DESC LIMIT 1";
$res = db_query($sql,"No stock moves were returned");
$row = db_fetch_row($res);
- return $row[0];
+ return is_array($row) ? $row[0] : false;
}
//----------------------------------------------------------------------------------------------------
$row = db_fetch_row($result);
- return $row[0];
+ return is_array($row) ? $row[0] : false;
}
//----------------------------------------------------------------------------------------
$row = db_fetch_row($result);
- return $row[0];
+ return is_array($row) ? $row[0] : false;
}
function get_customer_habit($customer_id)
{
$custdet = get_customer_details($customer_id);
+ if (!is_array($custdet))
+ return 0;
return $custdet['credit_limit']-$custdet['Balance'];
}
$sql = "SELECT sum(ov_freight) as freight FROM ".TB_PREF."debtor_trans WHERE order_ = $trans_no AND type = " . ST_CUSTDELIVERY . " AND debtor_no = " . $delivery->customer_id;
$result = db_query($sql, "Can not find delivery notes");
$row = db_fetch_row($result);
- if (!$row[0]) $freight = 0;
+ if (!is_array($row)) $freight = 0;
else $freight = $row[0];
if ($freight < $delivery->freight_cost) $delivery->freight_cost = $delivery->freight_cost - $freight;
else $delivery->freight_cost = 0;
$sql = "SELECT description FROM ".TB_PREF."groups WHERE id = ".db_escape($group_no);
$result = db_query($sql, "could not get group");
$row = db_fetch($result);
- return $row[0];
+ return is_array($row) ? $row[0] : false;
}
function add_sales_area($description)
$result = db_query($sql, "could not get sales type");
$row = db_fetch_row($result);
- return $row[0];
+ return is_array($row) ? $row[0] : false;
}
function add_salesman($salesman_name, $salesman_phone, $salesman_fax,
$result = db_query($sql, "could not get sales type");
$row = db_fetch_row($result);
- return $row[0];
+ return is_array($row) ? $row[0] : false;
}
LEFT JOIN ".TB_PREF."sales_orders so ON so.trans_type=".ST_SALESORDER." AND so.order_no=dt.order_
WHERE dt.type=".ST_SALESINVOICE." AND trans_no=".db_escape($trans_no);
$row = db_fetch(db_query($sql, 'cannot retrieve prepaid invoice factor'));
- return $row[0];
+ return is_array($row) ? $row[0] : false;
}
/*
$result = db_query($sql, "could not get POS name");
$row = db_fetch_row($result);
- return $row[0];
+ return is_array($row) ? $row[0] : false;
}
function delete_sales_point($id)
$result = db_query($sql, "could not get sales type");
$row = db_fetch_row($result);
- return $row[0];
+ return is_array($row) ? $row[0] : false;
}
function delete_sales_type($id)
$result = db_query($sql, "could not get tax type rate");
$row = db_fetch_row($result);
- return $row[0];
+ return is_array($row) ? $row[0] : false;
}
function delete_tax_type($type_id)