--- /dev/null
+$DBversion = 'XXX'; # will be replaced by the RM
+if( CheckVersion( $DBversion ) ) {
+
+ $dbh->do( q{
+ INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES
+ ('PatronDuplicateMatchingAddFields','surname|firstname|dateofbirth', NULL,'A list of fields separated by "|" to deduplicate patrons when created','Free')
+ });
+
+ # Always end with this (adjust the bug info)
+ NewVersion( $DBversion, 6725, "Adds PatronDuplicateMatchingAddFields system preference");
+}
('OverduesBlockRenewing','allow','allow|blockitem|block','If any of patron checked out documents is late, should renewal be allowed, blocked only on overdue items or blocked on whatever checked out document','Choice'),
('PatronAnonymizeDelay','',NULL,'Delay for anonymizing patrons', 'Integer'),
('PatronAutoComplete','1','Try|Don\'t try','to guess the patron being entered while typing a patron search for circulation or patron search. Only returns the first 10 results at a time.','YesNo'),
+('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 Client','YesNo'),
('PatronRemovalDelay','',NULL,'Delay for removing anonymized patrons', 'Integer'),
('PatronSelfModificationBorrowerUnwantedField','',NULL,'Name the fields you don\'t want to display when a patron is editing their information via the OPAC.','free'),
housebound: "Housebound roles"
additional: "Additional attributes and identifiers"
messaging: "Patron messaging preferences"
+ -
+ - "The following <a href='http://schema.koha-community.org/__VERSION__/tables/borrowers.html' target='blank'>database columns</a>:"
+ - pref: PatronDuplicateMatchingAddFields
+ type: modalselect
+ source: borrowers
+ - "will be used deduplicate patrons."
Patron relationships:
-
- "Guarantors can be the following of those they guarantee:"
# Test uniqueness of surname, firstname and dateofbirth
if ( ( $op eq 'insert' ) and !$nodouble ) {
+ my @dup_fields = split '\|', C4::Context->preference('PatronDuplicateMatchingAddFields');
my $conditions;
- $conditions->{surname} = $newdata{surname} if $newdata{surname};
- if ( $category_type ne 'I' ) {
- $conditions->{firstname} = $newdata{firstname} if $newdata{firstname};
- $conditions->{dateofbirth} = $newdata{dateofbirth} if $newdata{dateofbirth};
+ for my $f ( @dup_fields ) {
+ $conditions->{$f} = $newdata{$f} if $newdata{$f};
}
$nodouble = 1;
my $patrons = Koha::Patrons->search($conditions); # FIXME Should be search_limited?