View | Details | Raw Unified | Return to bug 13757
Collapse All | Expand All

(-)a/opac/opac-memberentry.pl (-6 / +12 lines)
Lines 89-95 $template->param( Link Here
89
    OPACPatronDetails => C4::Context->preference('OPACPatronDetails'),
89
    OPACPatronDetails => C4::Context->preference('OPACPatronDetails'),
90
);
90
);
91
91
92
my $attributes = ParsePatronAttributes($cgi);
92
my $attributes = ParsePatronAttributes($borrowernumber,$cgi);
93
my $conflicting_attribute = 0;
93
my $conflicting_attribute = 0;
94
94
95
foreach my $attr (@$attributes) {
95
foreach my $attr (@$attributes) {
Lines 560-576 sub GeneratePatronAttributesForm { Link Here
560
}
560
}
561
561
562
sub ParsePatronAttributes {
562
sub ParsePatronAttributes {
563
    my ( $cgi ) = @_;
563
    my ($borrowernumber,$cgi) = @_;
564
564
565
    my @codes = $cgi->multi_param('patron_attribute_code');
565
    my @codes  = $cgi->multi_param('patron_attribute_code');
566
    my @values = $cgi->multi_param('patron_attribute_value');
566
    my @values = $cgi->multi_param('patron_attribute_value');
567
567
568
    my $ea = each_array( @codes, @values );
568
    my $ea = each_array( @codes, @values );
569
    my @attributes;
569
    my @attributes;
570
    my %dups = ();
570
    my %dups = ();
571
571
572
    while ( my ( $code, $value, $password ) = $ea->() ) {
572
    while ( my ( $code, $value ) = $ea->() ) {
573
        next unless defined($value) and $value ne '';
573
        # Don't skip if the patron already has attributes with $code, because
574
        # it means we are being requested to remove the attributes.
575
        next
576
            unless defined($value) and $value ne ''
577
            or Koha::Patron::Attributes->search(
578
            { borrowernumber => $borrowernumber, code => $code } )->count > 0;
574
        next if exists $dups{$code}->{$value};
579
        next if exists $dups{$code}->{$value};
575
        $dups{$code}->{$value} = 1;
580
        $dups{$code}->{$value} = 1;
576
581
Lines 579-581 sub ParsePatronAttributes { Link Here
579
584
580
    return \@attributes;
585
    return \@attributes;
581
}
586
}
582
- 
587
588
1;

Return to bug 13757