Hi, I succeed in enabling duplicate check in any custom entity, if it refers to one condition, for example, I have a number field for every record and that should use the same number only once (in fact it is a textfield, because the number has other characters than numbers, too).
How would the duplicate check class.php look like, if I want two fields in combination checked? Both fields would have to be unique together.
Example:
I have an invoice entity, where every invoive has an unique number.
I have an invoice item entity, where every item has a simple count number (position 1, position 2 and so on).
The entities are related.
I want for every single invoice, that the items could be seperatly - depending on the invoice number - be numbered from 1 to n, but prevent from using unvoluntarily in the same invoice duplicates for the items. Means, that if there already is an item 3, you will be warned, when using 3 again for another item of that invoice. But I want to be able to use 3 in another invoice as item number.
In the result it should look like:
Invoice number IN-004 has items 1,2,3 ....
Invoice number IN-005 has also items 1,2,3 ...
In the moment this does not work, because all items, independent from invoice are in the same entity, so if I have an item number in invoice 004 with 3, in invoice 005 not, the warning will be thrown anyway, when I try to give invoice 005 the number 3.
How would the duplicate check look for both numbers invoice and item together? Is it possible at all?
How would the duplicate check class.php look like, if I want two fields in combination checked? Both fields would have to be unique together.
Example:
I have an invoice entity, where every invoive has an unique number.
I have an invoice item entity, where every item has a simple count number (position 1, position 2 and so on).
The entities are related.
I want for every single invoice, that the items could be seperatly - depending on the invoice number - be numbered from 1 to n, but prevent from using unvoluntarily in the same invoice duplicates for the items. Means, that if there already is an item 3, you will be warned, when using 3 again for another item of that invoice. But I want to be able to use 3 in another invoice as item number.
In the result it should look like:
Invoice number IN-004 has items 1,2,3 ....
Invoice number IN-005 has also items 1,2,3 ...
In the moment this does not work, because all items, independent from invoice are in the same entity, so if I have an item number in invoice 004 with 3, in invoice 005 not, the warning will be thrown anyway, when I try to give invoice 005 the number 3.
How would the duplicate check look for both numbers invoice and item together? Is it possible at all?
Comment