7

There's an extension that does precisely this: https://github.com/cividesk/com.cividesk.normalize It used to be in the extensions directory, but it's gone now for some reason. It uses libphonenumber, and it formats international numbers appropriately based upon the country in the address.


4

FYI Civi already does one pass at normalization behind the scenes - whenever a phone number is entered or updated, a numeric-only version of it (stripped of all punctuation and spaces) is stored in the phone_numeric field in the database. This is the field that is used for search. It doesn't enforce a certain number of digits, but thought you'd want to know ...


4

Yes, CiviCRM can do all of these things. It is also a very flexible system with a number of extensions that provide additional functionality that you may need in future. To get a better idea of what CiviCRM can do I would suggest that you read the user guide and try the one of the demo sites.


4

I'm not sure where exactly phone input fields are built (is it always Phone.php?). But if building phone inputs can be patched to add type="tel", you could then put JS in the footer of all Civi pages to scan for that input type and run your required logic against it.


3

The client-side validation in CiviCRM will flag any invisible or space characters which get pasted in along with an email address or URL. The non-printing characters are the trickiest to find, including things like carriage returns and line feeds that seem to get swept up in some copy-paste operations. I encounter this problem relatively frequently, but it ...


3

Rather than trying to solve it at the form level, you could use hook_civicrm_post() to look for a 'Phone' object. From there, doing a phone number reformat by talking to libphonenumber is pretty straightforward. I've built a little Node app that exposes it as a service; if that helps I could chuck it onto GitHub. There is also a PHP port of that library. I ...


2

Agree with William, and on top of that you might also check some of the YouTube videos here: https://www.youtube.com/playlist?list=PLjSU7YfE0E03DWaWNTLemvtQR30PzcB_o


2

It should be something like below function mymodule_civicrm_validateForm($formName, &$fields, &$files, &$form, &$errors) { if ('CRM_Event_Form_ManageEvent_EventInfo' == $formName) { if ( validation condition fails ) $errors['custom_element'] = ts('Validation message'); } } } HTH


2

Your question is rather complex, so this answer only addresses the registration issue. It might be better to start a new question for the other issues you face. You can use BuddyPress for user registration - in conjunction with BP XProfile WordPress User Sync and CiviCRM WordPress Profile Sync. The registration form will have "First Name" and "Last Name" ...


1

Thanks to the comments above, I have edited the packages/HTML/QuickForm/Rule/Email.php file to remove INTL_IDNA_VARIANT_UTS46. Forms with emails on them now work again. Change: $part = idn_to_ascii($part, 0, INTL_IDNA_VARIANT_UTS46); to $part = idn_to_ascii($part); This is how it was in the CiviCRM 15.9.2.


1

More straight-forward way is to write a simple validateForm hook - https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_validateForm/ into an extension. If you are new to creating an extension, this might be a good place to start - https://docs.civicrm.org/dev/en/latest/extensions/civix/


1

Did you know that in your buildform hook - you can add a $form->addRule: two real-life examples: $form->addRule('bank_account_number', ts('%1 must contain only digits.', array(1 => ts('Bank Account Number'))), 'numeric'); $form->addRule('encrypted_credit_card_number', ts('%1 is a required field.', array(1 => ts('Encrypted'))), 'required');


1

YES! - Having read your clarifying response to my previous comments, CiviCRM can absolutely do what you require. To restrict who can access which other users (i.e. when they search etc) you would need to do a (small amount) of custom work. Drupal might be a better platform for you that WordPress or Joomla! Future First is an example of a charity that has a ...


1

Monish, I think the problem is that if you use the api to change the total amount & don't pass in other amount values the BAO should assume that net_amount has now changed similarly. I thought we had done something in the BAO - but maybe only on new contributions. I think at the BAO level adding this logic makes sense if (...


Only top voted, non community-wiki answers of a minimum length are eligible