Hi,
I have created a new class to manage RFID tokens. It's parent is "PhysicalDevices". For the PhysicalDevices class a unique rule is configured taking care of unique asset numbers.
In the new class for RFID tokens the asset number attribute is not needed/defined, so i tried to remove that class from the uniqueness rule using a filter like this:
<filter><![CDATA[finalclass NOT IN ('NM_RFIDdongle')]]></filter>
But without success: If i create a new RFID token I get an error that asset number has to be filled.
Where am I going wrong?
Thanks in advance,
best regards,
Nico
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
<classid="PhysicalDevice"_delta="if_exists"><properties><uniqueness_rules><ruleid="serialnumber"_delta="define"><attributes><attributeid="serialnumber"/></attributes></rule><ruleid="assetnumber"_delta="define"><attributes><attributeid="asset_number"/></attributes><filter><![CDATA[finalclass NOT IN ('NM_RFIDdongle')]]></filter></rule></uniqueness_rules>
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Did you add a dependency in the extension to the iTop module where PhysicalDevice is defined?
It seems like it is totally ignoring your (re)definition.
Which leads me to the next point: I'd expect a value of "redefine" for the rule ID. But you can also move it o the filter-node instead.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hmm, as you can see I configured the delta for the class "PhysicalDevice" as "if_exists" and added 2 rules (delta="define").
That in fact is working, the uniqueness is checkes and shows errors if values already exist in the database. But the filter is not working, so I get warnings on the RFID dongle class, too.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The use of finalclass attribute in uniqueness rule is not supported
You can try to disable the rule in the child class : this should work !
In the XML, in the NM_RFIDdongle class properties, only override the disable attribute for the uniqueness rule.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I have created a new class to manage RFID tokens. It's parent is "PhysicalDevices". For the PhysicalDevices class a unique rule is configured taking care of unique asset numbers.
In the new class for RFID tokens the asset number attribute is not needed/defined, so i tried to remove that class from the uniqueness rule using a filter like this:
But without success: If i create a new RFID token I get an error that asset number has to be filled.
Where am I going wrong?
Thanks in advance,
best regards,
Nico
Can you show the entire XML modification for this class to see how the filter is applied?
Last edit: Jeffrey Bostoen 2021-08-30
Sure:
Did you add a dependency in the extension to the iTop module where PhysicalDevice is defined?
It seems like it is totally ignoring your (re)definition.
Which leads me to the next point: I'd expect a value of "redefine" for the rule ID. But you can also move it o the filter-node instead.
Hmm, as you can see I configured the delta for the class "PhysicalDevice" as "if_exists" and added 2 rules (delta="define").
That in fact is working, the uniqueness is checkes and shows errors if values already exist in the database. But the filter is not working, so I get warnings on the RFID dongle class, too.
Can you attach the module's PHP file and the datamodel XML please?
I created a complete Extension just for this test. It should add the new class und define the uniqueness rules. In Class PC the rules are functinonal.
Try in the module PHP file:
See if it helps
I configured the dependency but with same results, the filter is still not recognized :-(
Have you find something other?
Did you succesfully configured some kind of this filters?
Thanks.
Hello,
Sorry this is an old thread...
See the uniqueness rules documentation, you will see :
You can try to disable the rule in the child class : this should work !
In the XML, in the NM_RFIDdongle class properties, only override the disable attribute for the uniqueness rule.