}
// update per company files
- $cnt = max(1, count($db_connections));
+ $cnt = max(1, count_array($db_connections));
for($i = 0; $i < $cnt; $i++)
{
$newexts = $extensions;
$dec = $decimals;
}
- $num = number_format($number, $dec, $dsep, $tsep);
+ $num = number_format($number, intval($dec), $dsep, $tsep);
return $decimals==='max' ? rtrim($num, '0') : $num;
return $_SESSION['wa_global_curr_code'];
}
-
+function count_array($array)
+{
+ return (is_array($array)) ? count($array) : 0;
+}
//--------------------------------------------------------------------------------------
* close all files opened by parsers
*/
function _closeParsers() {
- if ($this->state > 2 && count($this->parsers) > 0) {
+ if ($this->state > 2 && is_array($this->parsers) && count($this->parsers) > 0) {
foreach ($this->parsers as $k => $_){
$this->parsers[$k]->closeFile();
$this->parsers[$k] = null;
function addReportClass($class_name, $class_id=null)
{
if (!$class_id)
- $class_id = is_array($this->ar_classes) ? count($this->ar_classes) : 0;
+ $class_id = count_array($this->ar_classes);
$this->ar_classes[$class_id] = $class_name;
return $class_id;
// FIXME - credit notes retrieved here should be those linked to invoices containing
// at least one line from related invoice
- if (!count($trans_no))
+ if (!count_array($trans_no))
return false;
$childs = get_sales_child_numbers($trans_type, $trans_no, false);
if (!count($childs))