Merge pull request #18846 from hregis/fix_avoid_warning_if_not_an_array
FIX avoid warning if $categories is an id
This commit is contained in:
commit
4fe9a4fd30
@ -9135,6 +9135,11 @@ abstract class CommonObject
|
|||||||
*/
|
*/
|
||||||
public function setCategoriesCommon($categories, $type_categ = '', $remove_existing = true)
|
public function setCategoriesCommon($categories, $type_categ = '', $remove_existing = true)
|
||||||
{
|
{
|
||||||
|
// Handle single category
|
||||||
|
if (!is_array($categories)) {
|
||||||
|
$categories = array($categories);
|
||||||
|
}
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::setCategoriesCommon Oject Id:".$this->id.' type_categ:'.$type_categ.' nb tag add:'.count($categories), LOG_DEBUG);
|
dol_syslog(get_class($this)."::setCategoriesCommon Oject Id:".$this->id.' type_categ:'.$type_categ.' nb tag add:'.count($categories), LOG_DEBUG);
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||||
@ -9144,11 +9149,6 @@ abstract class CommonObject
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle single category
|
|
||||||
if (!is_array($categories)) {
|
|
||||||
$categories = array($categories);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get current categories
|
// Get current categories
|
||||||
$c = new Categorie($this->db);
|
$c = new Categorie($this->db);
|
||||||
$existing = $c->containing($this->id, $type_categ, 'id');
|
$existing = $c->containing($this->id, $type_categ, 'id');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user