Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Duplicate Check for any field
#1
This code is compatible for coreBOS ?

https://github.com/preexo/vtiger-checkdu...-extension
Reply
#2
No it isn't. It is for VT6, the validation code is very lacking and coreBOS has it's own system for validating records.

This is really easy to do in coreBOS, even to do it generically for all modules, I haven't had time to document the validation system but if you look at the modules/Accounts/AccountsValidation.php script you will see this exact example against the accountname. You can copy that script to any module, change the module name and adapt the query.

Once I document it I will share the link here.
Joe
TSolucio
Reply
#3
I need the following

Create a custom field with an ID (unique number for payment of taxes of Brazilian companies)

If the account name (default) or this number already exists, give the standard treatment, or display duplicate the lead conversion, or add the contact to existing account.

Only I need, is, add a CF, in the standard treatment today is already coreBOS.

In script is only a treatment for default system fields, right?
Reply
#4
Sorry, but I am not quite following you. These validation (currently) are only for form/field editing, not for actions (like lead conversion).
You can check for "anything" in the validation scripts, you could even go out to other systems if you needed to.

Please try to explain again if you can.
Joe
TSolucio
Reply
#5
Ok, I got it.

What I need is right on lead conversion, add a custom field validation.

That is, if the account name or this field already exist the error "Account already exists ...
Reply
#6
Understood now.

Thats code is for button save right?

There is two situations

One for lead convertion and another for save account.

And for second case, button save, how I can change SQL command to get a custom field, too ?
Reply
#7
The easiest way to do that is using QueryGenerator:

PHP Code:
$queryGenerator = new QueryGenerator('Accounts'$current_user);
$queryGenerator->setFields(array('id','cf_999'));
$queryGenerator->addCondition('id','22','e');
$query $queryGenerator->getQuery();
$rs $adb->query($query);
$cf_999 $adb->query_result($rs,0,'cf_999'); 

Look at our unit tests for a lot of examples:


https://github.com/tsolucio/coreBOSTests...orTest.php
Joe
TSolucio
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)