Commit cd24fb39 authored by Jérome Perrin's avatar Jérome Perrin

Revert "credential: stop using deprecated property for email"

This reverts commit 149fdd1d.

This did not support the case of updating old emails for which
url_string was set, it was setting coordinate_text and causing
emails to have two properties ( url_string to the old value
and coordinate_text to the new value ).

See discussion on nexedi/erp5@149fdd1d (comment 180744)
parent d5c0a0c1
......@@ -30,7 +30,7 @@ person_mapping = (
('gender', 'gender'),
('default_telephone_text', 'default_telephone_text'),
('default_mobile_telephone_text', 'default_mobile_telephone_text'),
('default_email_coordinate_text', 'default_email_coordinate_text'),
('default_email_text', 'default_email_text'),
('date_of_birth', 'start_date'),
('nationality', 'nationality'),
('skill_list', 'default_career_skill_list'),
......
......@@ -5,7 +5,7 @@ organisation = context.getDestinationDecisionValue(portal_type="Organisation")
#Mapping
organisation_mapping = (
# (subscription, organisation)
('default_email_coordinate_text', 'default_email_coordinate_text'),
('default_email_text', 'default_email_text'),
('default_telephone_text', 'default_telephone_text'),
('default_fax_text', 'default_fax_text'),
('default_address_street_address', 'default_address_street_address'),
......
......@@ -13,7 +13,7 @@ person_mapping = (
('date_of_birth', 'birthday'),
('nationality', 'nationality'),
('language', 'language'),
('default_email_coordinate_text', 'default_email_coordinate_text'),
('default_email_text', 'default_email_text'),
('default_telephone_telephone_country', 'default_telephone_telephone_country'),
('default_telephone_text', 'default_telephone_text'),
('default_fax_text', 'default_fax_text'),
......
......@@ -33,7 +33,7 @@ if default_email_text is not None:
message = "We have sent you an email containing your username(s). Please check your inbox and your junk/spam mail for this email."
if web_site:
document_reference = web_site.getCredentialUsernameRecoveryMessageReference()
createCredentialRecovery(default_email_coordinate_text=default_email_text,
createCredentialRecovery(default_email_text=default_email_text,
destination_decision_value_list=person_list,
document_reference=document_reference,
language=portal.Localizer.get_selected_language())
......
......@@ -23,7 +23,7 @@ credential_request = module.newContent(
default_credential_question_question=default_credential_question_question,
default_credential_question_question_free_text=default_credential_question_question_free_text,
default_credential_question_answer=default_credential_question_answer,
default_email_coordinate_text=default_email_text,
default_email_text=default_email_text,
default_telephone_text=default_telephone_text,
default_mobile_telephone_text=default_mobile_telephone_text,
default_fax_text=default_fax_text,
......
......@@ -403,8 +403,6 @@ class TestERP5Credential(ERP5TypeTestCase):
person = person_result[0].getObject()
self.assertEqual(person.getTitle(), 'Homer Simpson')
self.assertEqual(person.getDefaultEmailText(), 'homer.simpson@fox.com')
# the obsolete email property is not used
self.assertFalse(person.hasDefaultEmailUrlString())
# check homie can log in the system
self._assertUserExists('homie', 'secret')
......@@ -431,7 +429,7 @@ class TestERP5Credential(ERP5TypeTestCase):
last_name='Simpsons', # add a 's' to the end of the last_name
reference='homie',
password='new_password',
default_email_coordinate_text='homie.simpsons@fox.com',
default_email_text='homie.simpsons@fox.com',
destination_decision=homie.getRelativeUrl())
credential_update.submit()
......@@ -458,7 +456,6 @@ class TestERP5Credential(ERP5TypeTestCase):
self.assertEqual(related_person.getLastName(), 'Simpsons')
self.assertEqual(related_person.getDefaultEmailText(),
'homie.simpsons@fox.com')
self.assertFalse(related_person.hasDefaultEmailUrlString())
def stepCreateSubscriptionRequestWithSecurityQuestionCategory(self, sequence=None,
sequence_list=None, **kw):
......@@ -547,7 +544,7 @@ class TestERP5Credential(ERP5TypeTestCase):
person = person_module.newContent(title='Barney',
reference='barney',
start_date=DateTime('1970/01/01'),
default_email_coordinate_text='barney@duff.com')
default_email_text='barney@duff.com')
# create an assignment
assignment = person.newContent(portal_type='Assignment',
function='member')
......@@ -865,7 +862,6 @@ class TestERP5Credential(ERP5TypeTestCase):
self.assertEqual("Homer", person.getFirstName())
self.assertEqual("Simpson", person.getLastName())
self.assertEqual("homer.simpson@fox.com", person.getDefaultEmailText())
self.assertFalse(person.hasDefaultEmailUrlString())
self.assertEqual(DateTime('1970/01/01'), person.getStartDate())
self.logout()
......@@ -882,7 +878,6 @@ class TestERP5Credential(ERP5TypeTestCase):
self.assertEqual("tom", person.getFirstName())
self.assertEqual("Simpson", person.getLastName())
self.assertEqual("tom@host.com", person.getDefaultEmailText())
self.assertFalse(person.hasDefaultEmailUrlString())
self.assertEqual(DateTime('1970/01/01'), person.getStartDate())
def stepCheckPersonWhenCredentialUpdateFail(self, sequence=None,
......@@ -1143,7 +1138,6 @@ class TestERP5Credential(ERP5TypeTestCase):
self.assertEqual(credential_request.getFirstName(), "Barney")
self.assertEqual(credential_request.getDefaultEmailText(),
"barney@duff.com")
self.assertFalse(credential_request.hasDefaultEmailUrlString())
self.assertEqual(credential_request.getRole(), "internal")
self.assertEqual(credential_request.getFunction(), "member")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment