Update categorie.class.php

This commit is contained in:
Laurent Destailleur 2020-08-08 02:24:01 +02:00 committed by GitHub
parent fc58d92db4
commit 8f8f7ecf5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2011,27 +2011,24 @@ class Categorie extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Count all categories
*
* @return int Number of categories, -1 on error
*/
public function count_all_categories()
public function countNbOfCategories()
{
dol_syslog(get_class($this)."::count_all_categories", LOG_DEBUG);
$sql = "SELECT COUNT(rowid) FROM ".MAIN_DB_PREFIX."categorie";
$sql .= " WHERE entity IN (".getEntity('category').")";
$sql = "SELECT COUNT(rowid) FROM ".MAIN_DB_PREFIX."categorie";
$sql .= " WHERE entity IN (".getEntity('category').")";
$res = $this->db->query($sql);
if ($res)
{
$res = $this->db->query($sql);
if ($res) {
$obj = $this->db->fetch_object($res);
return $obj->count;
}
else {
dol_print_error($this->db);
return -1;
return $obj->count;
} else {
dol_print_error($this->db);
return -1;
}
}
}