Skip to content

Commit

Permalink
Fix For DSpace#2692, Adding Phone metadata field on EPerson Add/Edit …
Browse files Browse the repository at this point in the history
…Page
  • Loading branch information
Bhoma38 committed Aug 12, 2024
1 parent aa486a0 commit d773aae
Show file tree
Hide file tree
Showing 28 changed files with 93 additions and 2 deletions.
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 @@ -279,10 +285,11 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
this.translateService.get(`${this.messagePrefix}.firstName`),
this.translateService.get(`${this.messagePrefix}.lastName`),
this.translateService.get(`${this.messagePrefix}.email`),
this.translateService.get(`${this.messagePrefix}.phone`),
this.translateService.get(`${this.messagePrefix}.canLogIn`),
this.translateService.get(`${this.messagePrefix}.requireCertificate`),
this.translateService.get(`${this.messagePrefix}.emailHint`),
]).subscribe(([firstName, lastName, email, canLogIn, requireCertificate, emailHint]) => {
]).subscribe(([firstName, lastName, email, phone, canLogIn, requireCertificate, emailHint]) => {
this.firstName = new DynamicInputModel({
id: 'firstName',
label: firstName,
Expand Down Expand Up @@ -316,6 +323,12 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
},
hint: emailHint,
});
this.phone = new DynamicInputModel({
id: 'phone',
label: phone,
name: 'phone',
required: false,
});
this.canLogIn = new DynamicCheckboxModel(
{
id: 'canLogIn',
Expand All @@ -334,6 +347,7 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
this.firstName,
this.lastName,
this.email,
this.phone,
this.canLogIn,
this.requireCertificate,
];
Expand All @@ -349,6 +363,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 @@ -428,6 +443,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 @@ -485,6 +505,11 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
value: (this.lastName.value ? this.lastName.value : ePerson.firstMetadataValue('eperson.lastname')),
},
],
'eperson.phone': [
{
value: (this.phone.value ? this.phone.value : ePerson.firstMetadataValue('eperson.phone')),
},
],
},
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
1 change: 1 addition & 0 deletions src/assets/i18n/ar.json5
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@
"admin.access-control.epeople.form.email": "البريد الإلكتروني",
"admin.access-control.epeople.form.emailHint": "يجب أن يكون عنوان بريد الإلكتروني صالح",
"admin.access-control.epeople.form.canLogIn": "يمكننا تسجيل الدخول",
"admin.access-control.epeople.form.phone" : "هاتف",
"admin.access-control.epeople.form.requireCertificate": "أنا",
"admin.access-control.epeople.form.return": "رجوع",
"admin.access-control.epeople.form.notification.created.success": "تم إنشاء الشخص الإلكتروني \"{{name}}\"",
Expand Down
3 changes: 3 additions & 0 deletions src/assets/i18n/bn.json5
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,9 @@
// "admin.access-control.epeople.form.canLogIn": "Can log in",
"admin.access-control.epeople.form.canLogIn": "লগ ইন করতে পারেন",

// "admin.access-control.epeople.form.phone" : "Phone",
"admin.access-control.epeople.form.phone" : "ফোন",

// "admin.access-control.epeople.form.requireCertificate": "Requires certificate",
"admin.access-control.epeople.form.requireCertificate": "সার্টিফিকেট প্রয়োজন",

Expand Down
3 changes: 3 additions & 0 deletions src/assets/i18n/ca.json5
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,9 @@
// "admin.access-control.epeople.form.canLogIn": "Can log in",
"admin.access-control.epeople.form.canLogIn": "Pot iniciar sessió",

// "admin.access-control.epeople.form.phone" : "Phone",
"admin.access-control.epeople.form.phone" : "telèfon",

// "admin.access-control.epeople.form.requireCertificate": "Requires certificate",
"admin.access-control.epeople.form.requireCertificate": "Requereix certificat",

Expand Down
3 changes: 3 additions & 0 deletions src/assets/i18n/cs.json5
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,9 @@
// "admin.access-control.epeople.form.canLogIn": "Can log in",
"admin.access-control.epeople.form.canLogIn": "Lze se přihlásit",

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

// "admin.access-control.epeople.form.requireCertificate": "Requires certificate",
"admin.access-control.epeople.form.requireCertificate": "Vyžaduje certifikát",

Expand Down
3 changes: 3 additions & 0 deletions src/assets/i18n/de.json5
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,9 @@
// "admin.access-control.epeople.form.canLogIn": "Can log in",
"admin.access-control.epeople.form.canLogIn": "Darf sich anmelden",

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

// "admin.access-control.epeople.form.requireCertificate": "Requires certificate",
"admin.access-control.epeople.form.requireCertificate": "Es wird ein Zertifikat benötigt.",

Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/el.json5
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"admin.access-control.epeople.button.add": "Προσθήκη Eperson",
"admin.access-control.epeople.button.see-all": "Περιήγηση σε όλα",
"admin.access-control.epeople.form.canLogIn": "Δυνατότητα σύνδεσης",
"admin.access-control.epeople.form.phone" : "Τηλέφωνο",
"admin.access-control.epeople.form.create": "Δημιουργία EPerson",
"admin.access-control.epeople.form.edit": "Επεξεργασία EPerson",
"admin.access-control.epeople.form.email": "Ηλεκτρονική Διεύθυνση",
Expand Down
3 changes: 3 additions & 0 deletions src/assets/i18n/en.json5
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,9 @@

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

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

"admin.access-control.epeople.form.requireCertificate": "Requires certificate",

"admin.access-control.epeople.form.return": "Back",
Expand Down
3 changes: 3 additions & 0 deletions src/assets/i18n/es.json5
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,9 @@
// "admin.access-control.epeople.form.canLogIn": "Can log in",
"admin.access-control.epeople.form.canLogIn": "Puede iniciar sesión",

// "admin.access-control.epeople.form.phone" : "Phone",
"admin.access-control.epeople.form.phone" : "Teléfono",

// "admin.access-control.epeople.form.requireCertificate": "Requires certificate",
"admin.access-control.epeople.form.requireCertificate": "Requiere certificado",

Expand Down
3 changes: 3 additions & 0 deletions src/assets/i18n/fi.json5
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,9 @@
// "admin.access-control.epeople.form.canLogIn": "Can log in",
"admin.access-control.epeople.form.canLogIn": "Voi kirjautua",

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

// "admin.access-control.epeople.form.requireCertificate": "Requires certificate",
"admin.access-control.epeople.form.requireCertificate": "Vaatii sertifikaatin",

Expand Down
3 changes: 3 additions & 0 deletions src/assets/i18n/fr.json5
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,9 @@
// "admin.access-control.epeople.form.canLogIn": "Can log in",
"admin.access-control.epeople.form.canLogIn": "Peut se connecter",

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

// "admin.access-control.epeople.form.requireCertificate": "Requires certificate",
"admin.access-control.epeople.form.requireCertificate": "Doit avoir recours à un certificat",

Expand Down
3 changes: 3 additions & 0 deletions src/assets/i18n/gd.json5
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,9 @@
// "admin.access-control.epeople.form.canLogIn": "Can log in",
"admin.access-control.epeople.form.canLogIn": "Faodar logadh a-steach",

// "admin.access-control.epeople.form.phone" : "Phone",
"admin.access-control.epeople.form.phone" : "Fòn",

// "admin.access-control.epeople.form.requireCertificate": "Requires certificate",
"admin.access-control.epeople.form.requireCertificate": "Teisteanas a dhìth",

Expand Down
2 changes: 2 additions & 0 deletions src/assets/i18n/hi.json5
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@

"admin.access-control.epeople.form.lastName": "उपनाम",

"admin.access-control.epeople.form.phone" : "फ़ोन",

"admin.access-control.epeople.form.memberOfNoGroups": "यह ई-व्यक्ति किसी भी समूह का सदस्य नहीं है",

"admin.access-control.epeople.form.notification.created.failure": "\"{{name}}\" ई-व्यक्ति बनाने में विफल",
Expand Down
3 changes: 3 additions & 0 deletions src/assets/i18n/hu.json5
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,9 @@
// "admin.access-control.epeople.form.canLogIn": "Can log in",
"admin.access-control.epeople.form.canLogIn": "Bejelentkezhet",

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

// "admin.access-control.epeople.form.requireCertificate": "Requires certificate",
"admin.access-control.epeople.form.requireCertificate": "Tanúsítvány szükséges",

Expand Down
3 changes: 3 additions & 0 deletions src/assets/i18n/it.json5
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,9 @@
// "admin.access-control.epeople.form.canLogIn": "Can log in",
"admin.access-control.epeople.form.canLogIn": "Può accedere",

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

// "admin.access-control.epeople.form.requireCertificate": "Requires certificate",
"admin.access-control.epeople.form.requireCertificate": "Richiede certificato",

Expand Down
3 changes: 3 additions & 0 deletions src/assets/i18n/kk.json5
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,9 @@
// "admin.access-control.epeople.form.canLogIn": "Can log in",
"admin.access-control.epeople.form.canLogIn": "Мен кіре аламын",

// "admin.access-control.epeople.form.phone" : "Phone",
"admin.access-control.epeople.form.phone" : "Телефон",

// "admin.access-control.epeople.form.requireCertificate": "Requires certificate",
"admin.access-control.epeople.form.requireCertificate": "Сертификат қажет",

Expand Down
3 changes: 3 additions & 0 deletions src/assets/i18n/lv.json5
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,9 @@
// "admin.access-control.epeople.form.canLogIn": "Can log in",
"admin.access-control.epeople.form.canLogIn": "Var pierakstīties",

// "admin.access-control.epeople.form.phone" : "Phone",
"admin.access-control.epeople.form.phone" : "Tālrunis",

// "admin.access-control.epeople.form.requireCertificate": "Requires certificate",
"admin.access-control.epeople.form.requireCertificate": "Nepieciešams sertifikāts",

Expand Down
4 changes: 4 additions & 0 deletions src/assets/i18n/nl.json5
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,10 @@
// TODO New key - Add a translation
"admin.access-control.epeople.form.canLogIn": "Can log in",

// "admin.access-control.epeople.form.phone" : "Phone",
// TODO New key - Add a translation
"admin.access-control.epeople.form.phone" : "Phone",

// "admin.access-control.epeople.form.requireCertificate": "Requires certificate",
// TODO New key - Add a translation
"admin.access-control.epeople.form.requireCertificate": "Requires certificate",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/pl.json5
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
"admin.access-control.epeople.form.email": "E-mail",
"admin.access-control.epeople.form.emailHint": "Adres e-mail musi być poprawny",
"admin.access-control.epeople.form.canLogIn": "Możliwość zalogowania",
"admin.access-control.epeople.form.phone" : "Telefon",
"admin.access-control.epeople.form.requireCertificate": "Wymagany certyfikat",
"admin.access-control.epeople.form.return": "Powrót",
"admin.access-control.epeople.form.notification.created.success": "Udało się utworzyć użytkownika \"{{name}}\"",
Expand Down
3 changes: 3 additions & 0 deletions src/assets/i18n/pt-BR.json5
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,9 @@
// "admin.access-control.epeople.form.canLogIn": "Can log in",
"admin.access-control.epeople.form.canLogIn": "Pode entrar",

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

// "admin.access-control.epeople.form.requireCertificate": "Requires certificate",
"admin.access-control.epeople.form.requireCertificate": "Requer certificado",

Expand Down
3 changes: 3 additions & 0 deletions src/assets/i18n/pt-PT.json5
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,9 @@
// "admin.access-control.epeople.form.canLogIn": "Can log in",
"admin.access-control.epeople.form.canLogIn": "Pode iniciar sessão",

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

// "admin.access-control.epeople.form.requireCertificate": "Requires certificate",
"admin.access-control.epeople.form.requireCertificate": "Requer certificado",

Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/sr-cyr.json5
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@
"admin.access-control.epeople.form.email": "Е-мејл",
"admin.access-control.epeople.form.emailHint": "Мора бити важећа Е-мејл адреса",
"admin.access-control.epeople.form.canLogIn": "Може се пријавити",
"admin.access-control.epeople.form.phone" : "Телефон",
"admin.access-control.epeople.form.requireCertificate": "Потребан је сертификат",
"admin.access-control.epeople.form.return": "Назад",
"admin.access-control.epeople.form.notification.created.success": "Успешно креиран EPerson \"{{name}}\"",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/sr-lat.json5
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@
"admin.access-control.epeople.form.email": "E-mail",
"admin.access-control.epeople.form.emailHint": "Mora biti važeća e-mail adresa",
"admin.access-control.epeople.form.canLogIn": "Može se prijaviti",
"admin.access-control.epeople.form.phone" : "Telefon",
"admin.access-control.epeople.form.requireCertificate": "Potreban je sertifikat",
"admin.access-control.epeople.form.return": "Nazad",
"admin.access-control.epeople.form.notification.created.success": "Uspešno kreiran EPerson \"{{name}}\"",
Expand Down
3 changes: 3 additions & 0 deletions src/assets/i18n/sv.json5
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,9 @@
// "admin.access-control.epeople.form.canLogIn": "Can log in",
"admin.access-control.epeople.form.canLogIn": "Kan logga in",

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

// "admin.access-control.epeople.form.requireCertificate": "Requires certificate",
"admin.access-control.epeople.form.requireCertificate": "Kräver certificate",

Expand Down
3 changes: 3 additions & 0 deletions src/assets/i18n/tr.json5
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,9 @@
// "admin.access-control.epeople.form.canLogIn": "Can log in",
"admin.access-control.epeople.form.canLogIn": "Giriş yapabilir",

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

// "admin.access-control.epeople.form.requireCertificate": "Requires certificate",
"admin.access-control.epeople.form.requireCertificate": "Sertifika gerektirir",

Expand Down
3 changes: 3 additions & 0 deletions src/assets/i18n/uk.json5
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,9 @@
// "admin.access-control.epeople.form.canLogIn": "Can log in",
"admin.access-control.epeople.form.canLogIn": "Може увійти",

// "admin.access-control.epeople.form.phone" : "Phone",
"admin.access-control.epeople.form.phone" : "Телефон",

// "admin.access-control.epeople.form.requireCertificate": "Requires certificate",
"admin.access-control.epeople.form.requireCertificate": "Вимагати сертифікат",

Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/vi.json5
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
"admin.access-control.epeople.button.add": "Thêm người dùng",
"admin.access-control.epeople.button.see-all": "Duyệt toàn bộ",
"admin.access-control.epeople.form.canLogIn": "Có thể đăng nhập",
"admin.access-control.epeople.form.phone" : "Điện thoại",
"admin.access-control.epeople.form.create": "Tạo người dùng",
"admin.access-control.epeople.form.edit": "Chỉnh sửa người dùng",
"admin.access-control.epeople.form.email": "E-mail",
Expand Down

0 comments on commit d773aae

Please sign in to comment.