diff --git a/installer/data/mysql/atomicupdate/bug_13188_add_PatronSelfModificationMandatoryField_syspref.perl b/installer/data/mysql/atomicupdate/bug_13188_add_PatronSelfModificationMandatoryField_syspref.perl
new file mode 100644
index 0000000000..9462d3b3ea
--- /dev/null
+++ b/installer/data/mysql/atomicupdate/bug_13188_add_PatronSelfModificationMandatoryField_syspref.perl
@@ -0,0 +1,7 @@
+$DBversion = 'XXX'; # will be replaced by the RM
+if( CheckVersion( $DBversion ) ) {
+ $dbh->do(q{
+ INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`, `type`) VALUES ('PatronSelfModificationMandatoryField','', NULL,'Define the required fields when a patron is editing their information via the OPAC.','multiple');
+ });
+ NewVersion($DBversion, 13188, "Allow configuration of required fields when a patron is editing their information via the OPAC");
+}
diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql
index 68877bbbce..b25a180a97 100644
--- a/installer/data/mysql/mandatory/sysprefs.sql
+++ b/installer/data/mysql/mandatory/sysprefs.sql
@@ -514,6 +514,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
('PatronDuplicateMatchingAddFields','surname|firstname|dateofbirth', NULL,'A list of fields separated by "|" to deduplicate patrons when created','Free'),
('patronimages','0',NULL,'Enable patron images for the staff interface','YesNo'),
('PatronRemovalDelay','',NULL,'Delay for removing anonymized patrons', 'Integer'),
+('PatronSelfModificationMandatoryField','',NULL,'Name the fields you don\'t want to be required when a patron is editing their information via the OPAC.','free'),
('PatronSelfModificationBorrowerUnwantedField','',NULL,'Name the fields you don\'t want to display when a patron is editing their information via the OPAC.','free'),
('PatronSelfRegistration','0',NULL,'If enabled, patrons will be able to register themselves via the OPAC.','YesNo'),
('PatronSelfRegistrationAdditionalInstructions','','','A free text field to display additional instructions to newly self registered patrons.','free'),
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
index 00a1cf96a3..b34fb9d98e 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
@@ -817,6 +817,12 @@ OPAC:
class: integer
- "days after account creation."
- "
NOTE: This system preference requires the misc/cronjobs/cleanup_database.pl
cronjob. Ask your system administrator to schedule it."
+ -
+ - "The following database columns must be filled in on the patron modification screen:"
+ - pref: PatronSelfModificationMandatoryField
+ type: modalselect
+ source: borrowers
+ exclusions: password|cardnumber|dateexpiry|categorycode
-
- "The following database columns must be filled in on the patron entry screen:"
- pref: PatronSelfRegistrationBorrowerMandatoryField
diff --git a/opac/opac-memberentry.pl b/opac/opac-memberentry.pl
index 5fab449a3c..03c25fd290 100755
--- a/opac/opac-memberentry.pl
+++ b/opac/opac-memberentry.pl
@@ -391,7 +391,8 @@ sub GetMandatoryFields {
my %mandatory_fields;
- my $BorrowerMandatoryField =
+ my $BorrowerMandatoryField = $action eq 'edit' || $action eq 'update' ?
+ C4::Context->preference("PatronSelfModificationMandatoryField") :
C4::Context->preference("PatronSelfRegistrationBorrowerMandatoryField");
my @fields = split( /\|/, $BorrowerMandatoryField );