Bug 22910: Do not copy unique patron attributes to duplicated patron
When creating a new patron by duplicating another, all of the patron attributes are also copied into the form. Some of those value may be unique, so don't copy those. 1) Create patron attribute types, one with "unique identifier", one without. 2) Create or a patron so it has values in both of those attributes. 3) Duplicate the patron 4) The edit form should retain the values from the "original" patron. 5) Apply patch. 6) Duplicate the patron - this time the attributes with unique values are cleared. Signed-off-by: Pasi Kallinen <pasi.kallinen@koha-suomi.fi> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
parent
65de22a6ef
commit
f3358e97c8
1 changed files with 3 additions and 1 deletions
|
@ -747,7 +747,7 @@ foreach (qw(dateenrolled dateexpiry dateofbirth)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (C4::Context->preference('ExtendedPatronAttributes')) {
|
if (C4::Context->preference('ExtendedPatronAttributes')) {
|
||||||
patron_attributes_form($template, $borrowernumber);
|
patron_attributes_form($template, $borrowernumber, $op);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (C4::Context->preference('EnhancedMessagingPreferences')) {
|
if (C4::Context->preference('EnhancedMessagingPreferences')) {
|
||||||
|
@ -846,6 +846,7 @@ sub parse_extended_patron_attributes {
|
||||||
sub patron_attributes_form {
|
sub patron_attributes_form {
|
||||||
my $template = shift;
|
my $template = shift;
|
||||||
my $borrowernumber = shift;
|
my $borrowernumber = shift;
|
||||||
|
my $op = shift;
|
||||||
|
|
||||||
my @types = C4::Members::AttributeTypes::GetAttributeTypes();
|
my @types = C4::Members::AttributeTypes::GetAttributeTypes();
|
||||||
if (scalar(@types) == 0) {
|
if (scalar(@types) == 0) {
|
||||||
|
@ -885,6 +886,7 @@ sub patron_attributes_form {
|
||||||
$newentry->{auth_val_loop} = GetAuthorisedValues($attr_type->authorised_value_category(), $attr->{value});
|
$newentry->{auth_val_loop} = GetAuthorisedValues($attr_type->authorised_value_category(), $attr->{value});
|
||||||
}
|
}
|
||||||
$i++;
|
$i++;
|
||||||
|
undef $newentry->{value} if ($attr_type->unique_id() && $op eq 'duplicate');
|
||||||
$newentry->{form_id} = "patron_attr_$i";
|
$newentry->{form_id} = "patron_attr_$i";
|
||||||
push @{$items_by_class{$attr_type->class()}}, $newentry;
|
push @{$items_by_class{$attr_type->class()}}, $newentry;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue