Can't get out of New Customer > Email Contact screen

A while ago I found this discussion regarding having Email Contact appear by default in a New Customer window.  As this was a feature requested by the Canadian group I'm working with, I followed the jira link, now here, and modified PartyRules.java as suggested.  The email contact now appears by default, but I've noticed that unlike Location Contact and Phone Contact, once selected, it is not possible to unselect Email Contact.  Clicking on Location or Phone Contact does not go to those screens. 

I understand that this is not really a supported feature yet, but just wanted to point out that the code change as suggested has some undesirable results.  Once the Email Contact window is selected, it must either be completed or the entire New Customer Edit screen cancelled.

/**
     * Returns a set of default contacts containing an
     * <em>contact.phoneNumber</em> and <em>contact.location</em>.
     *
     * @return a new set of default contacts
     * @throws ArchetypeServiceException for any archetype service error
     *
     * Added by SL -
     * Code added to allow default email contact on new customer screen  
     */
    public Set<Contact> getDefaultContacts() {
        Set<Contact> contacts = new HashSet<Contact>();
        Contact phone = (Contact) service.create(ContactArchetypes.PHONE);
        Contact email = (Contact) service.create(ContactArchetypes.EMAIL);
        Contact location = (Contact) service.create(ContactArchetypes.LOCATION);
        service.deriveValues(phone);
        service.deriveValues(email);
        service.deriveValues(location);
        contacts.add(phone);
        contacts.add(email);
        contacts.add(location);
        return contacts;

        }

With the code changed as above, to duplicate the error in 1.7.1, go to Customers, New, Contacts and click a couple times between Location Contact and Phone Contact to see those screens toggle back and forth.  Then click on Email Contact.  At that point, one is trapped in the Email Contact screen and the Location and Phone Contact screens cannot be retrieved.

Thanks,

Sam Longiaru

Kamloops, BC   

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Re: Can't get out of New Customer > Email Contact screen

The email contact is a bit different to other contacts in that it requires the emailAddress node to be populated before it is considered valid.

Collection editors such as that used for contacts won't let you switch contacts until the current one is valid, hence the reason you are stuck.

Re: Can't get out of New Customer > Email Contact screen

Thanks Tim,

I was going to suggesst to the users that if they accidentally click on the Email Contact but have no valid email address to enter, that they enter something, then go back and edit it out... but I see that doesn't work as it throws a validation error for the reasons you describe.

Yes, once you click on the Email Contact, you truly are stuck.  I'm not sure what to suggest to them other than Cancel and start over.
 

Re: Can't get out of New Customer > Email Contact screen

Just click Delete to remove the contact. A new one can be added later.

(Normally you could press Alt-D, but for https://openvpms.atlassian.net/browse/OVPMS-1518 )

Re: Can't get out of New Customer > Email Contact screen

Perfect.  Thanks.

Syndicate content