Anybody knows what do I need to modify in order to set a attribute as non-duplicate attribute between objects of the same class? Now I can add objects with the same name and serial number for example. I would like prevent that someone adds a object that already exists.
Did you get this fixed, i have the same issue!
I had a similar problem. My solution is quite inconvenient...
In my self-developed module with the class "DNS" each domain name has to be unique.
Therefore I use the method "DoCheckToWrite" (based on userrights.class.inc.php). The function ensures that you cannot add a domain that already exists.
Maybe a starting point for you...
XML Code snippet (example code from userrights.class.inc.php):
<code><![CDATA[ public function DoCheckToWrite()
// Note: This MUST be factorized later: declare unique keys (set of columns) in the data model
$aChanges = $this->ListChanges();
if (array_key_exists('login', $aChanges))
$sNewLogin = $aChanges['login'];
$oSearch = DBObjectSearch::FromOQL_AllData("SELECT User WHERE login = :newlogin");
$oSet = new DBObjectSet($oSearch, array(), array('newlogin' => $sNewLogin));
if ($oSet->Count() > 0)
$this->m_aCheckIssues = Dict::Format('Class:User/Error:LoginMustBeUnique', $sNewLogin);
Thank you for your response.
Would you mind sharing the code for your DNS class please, as i want to see how you have implemented the above code.
Never mind, i managed to configure it - and it works a charm!
Thank you once again Alexander
I'm glad I was able to help :)
Maybe for others: I wrote a small SAMPLE extension "alx-conf-module-infra":
- Server Class: define Server name as unique
- Server Class: additional field "local_disk"
- IPinterface Class: allow interface speed up to 10.000 MBit/s (7 digits)
- Language Files DE/EN