Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix for #2692 #1

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
firstName: DynamicInputModel;
lastName: DynamicInputModel;
email: DynamicInputModel;
phone: DynamicInputModel;
// booleans
canLogIn: DynamicCheckboxModel;
requireCertificate: DynamicCheckboxModel;
Expand Down Expand Up @@ -146,6 +147,11 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
host: 'row',
},
},
phone: {
grid: {
host: 'row',
},
},
canLogIn: {
grid: {
host: 'col col-sm-6 d-inline-block',
Expand Down Expand Up @@ -316,6 +322,12 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
},
hint: this.translateService.instant(`${this.messagePrefix}.emailHint`),
});
this.phone = new DynamicInputModel({
id: 'phone',
label: this.translateService.instant(`${this.messagePrefix}.phone`),
name: 'phone',
required: false,
});
this.canLogIn = new DynamicCheckboxModel(
{
id: 'canLogIn',
Expand All @@ -334,6 +346,7 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
this.firstName,
this.lastName,
this.email,
this.phone,
this.canLogIn,
this.requireCertificate,
];
Expand All @@ -349,6 +362,7 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
firstName: eperson != null ? eperson.firstMetadataValue('eperson.firstname') : '',
lastName: eperson != null ? eperson.firstMetadataValue('eperson.lastname') : '',
email: eperson != null ? eperson.email : '',
phone: eperson != null ? eperson.firstMetadataValue('eperson.phone') : '',
canLogIn: eperson != null ? eperson.canLogIn : true,
requireCertificate: eperson != null ? eperson.requireCertificate : false,
});
Expand Down Expand Up @@ -425,6 +439,11 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
value: this.lastName.value,
},
],
'eperson.phone': [
{
value: this.phone.value,
},
],
},
email: this.email.value,
canLogIn: this.canLogIn.value,
Expand Down Expand Up @@ -482,6 +501,11 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
value: (this.lastName.value ? this.lastName.value : ePerson.firstMetadataValue('eperson.lastname')),
},
],
'eperson.phone': [
{
value: this.phone.value,
},
],
},
email: (hasValue(values.email) ? values.email : ePerson.email),
canLogIn: (hasValue(values.canLogIn) ? values.canLogIn : ePerson.canLogIn),
Expand Down
2 changes: 1 addition & 1 deletion src/app/core/eperson/eperson-data.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ export class EPersonDataService extends IdentifiableDataService<EPerson> impleme
* @param newEPerson
*/
private generateOperations(oldEPerson: EPerson, newEPerson: EPerson): Operation[] {
let operations = this.comparator.diff(oldEPerson, newEPerson).filter((operation: Operation) => operation.op === 'replace');
let operations = this.comparator.diff(oldEPerson, newEPerson).filter((operation: Operation) => operation.op === 'replace' || operation.op === 'add');
if (hasValue(oldEPerson.email) && oldEPerson.email !== newEPerson.email) {
operations = [...operations, {
op: 'replace', path: '/email', value: newEPerson.email,
Expand Down
2 changes: 2 additions & 0 deletions src/assets/i18n/en.json5
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,8 @@

"admin.access-control.epeople.form.email": "Email",

"admin.access-control.epeople.form.phone" : "Phone",

Check failure on line 319 in src/assets/i18n/en.json5

View workflow job for this annotation

GitHub Actions / tests (18.x)

Extra space after key 'admin.access-control.epeople.form.phone'

Check failure on line 319 in src/assets/i18n/en.json5

View workflow job for this annotation

GitHub Actions / tests (20.x)

Extra space after key 'admin.access-control.epeople.form.phone'

Check failure on line 319 in src/assets/i18n/en.json5

View workflow job for this annotation

GitHub Actions / tests (18.x)

Extra space after key 'admin.access-control.epeople.form.phone'

Check failure on line 319 in src/assets/i18n/en.json5

View workflow job for this annotation

GitHub Actions / tests (20.x)

Extra space after key 'admin.access-control.epeople.form.phone'

"admin.access-control.epeople.form.emailHint": "Must be a valid email address",

"admin.access-control.epeople.form.canLogIn": "Can log in",
Expand Down
Loading