Fix must use the constant, not hard coded value.
This commit is contained in:
parent
09a868af3f
commit
d23a8a56ea
@ -43,13 +43,13 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
class Categorie extends CommonObject
|
||||
{
|
||||
// Categories types
|
||||
const TYPE_PRODUCT = 0;
|
||||
const TYPE_SUPPLIER = 1;
|
||||
const TYPE_CUSTOMER = 2;
|
||||
const TYPE_MEMBER = 3;
|
||||
const TYPE_CONTACT = 4;
|
||||
const TYPE_USER = 4; // categorie contact and user are same !
|
||||
const TYPE_ACCOUNT = 5; // bank account
|
||||
const TYPE_PRODUCT = 0; // TODO Replace with value 'product'
|
||||
const TYPE_SUPPLIER = 1; // TODO Replace this value with 'supplier'
|
||||
const TYPE_CUSTOMER = 2; // TODO Replace this value with 'customer'
|
||||
const TYPE_MEMBER = 3; // TODO Replace this value with 'member'
|
||||
const TYPE_CONTACT = 4; // TODO Replace this value with 'contact'
|
||||
const TYPE_USER = 4; // categorie contact and user are same ! TODO Replace this value with 'user'
|
||||
const TYPE_ACCOUNT = 5; // for bank account TODO Replace this value with 'account'
|
||||
|
||||
/**
|
||||
* @var array ID mapping from type string
|
||||
@ -63,7 +63,7 @@ class Categorie extends CommonObject
|
||||
'member' => 3,
|
||||
'contact' => 4,
|
||||
'user' => 4,
|
||||
'account' => 5,
|
||||
'account' => 5,
|
||||
);
|
||||
/**
|
||||
* @var array Foreign keys mapping from type string
|
||||
|
||||
@ -2224,7 +2224,7 @@ else
|
||||
print '<td>';
|
||||
$cate_arbo = $form->select_all_categories( Categorie::TYPE_CONTACT, null, null, null, null, 1 );
|
||||
$c = new Categorie( $db );
|
||||
$cats = $c->containing( $object->id, 'user' );
|
||||
$cats = $c->containing($object->id, Categorie::TYPE_USER);
|
||||
foreach ($cats as $cat) {
|
||||
$arrayselected[] = $cat->id;
|
||||
}
|
||||
|
||||
@ -200,7 +200,7 @@ class CategorieTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
// Get list of categories for product
|
||||
$localcateg=new Categorie($this->savdb);
|
||||
$listofcateg=$localcateg->containing($localobject2->id, 'product', 'label');
|
||||
$listofcateg=$localcateg->containing($localobject2->id, Categorie::TYPE_PRODUCT, 'label');
|
||||
$this->assertTrue(in_array('Specimen Category for product',$listofcateg), 'Categ not found linked to product when it should');
|
||||
|
||||
return $id;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user