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

(-)a/admin/preferences.pl (-6 / +16 lines)
Lines 29-34 use C4::Log; Link Here
29
use C4::Output;
29
use C4::Output;
30
use C4::Templates;
30
use C4::Templates;
31
use Koha::Acquisition::Currencies;
31
use Koha::Acquisition::Currencies;
32
use Koha::Patron::Categories;
32
use File::Spec;
33
use File::Spec;
33
use IO::File;
34
use IO::File;
34
use YAML::Syck qw();
35
use YAML::Syck qw();
Lines 92-97 sub _get_chunk { Link Here
92
                $options{'choices'} = { map { $_ => $_ } getallthemes( 'opac' ) }
93
                $options{'choices'} = { map { $_ => $_ } getallthemes( 'opac' ) }
93
            } elsif ( $options{'choices'} eq 'staff-templates' ) {
94
            } elsif ( $options{'choices'} eq 'staff-templates' ) {
94
                $options{'choices'} = { map { $_ => $_ } getallthemes( 'intranet' ) }
95
                $options{'choices'} = { map { $_ => $_ } getallthemes( 'intranet' ) }
96
            } elsif ( $options{'choices'} eq 'patron-categories' ) {
97
                $options{'choices'} = { map { $_ => $_->categorycode } Koha::Patron::Categories->search({}, { columns => 'categorycode' }) }
95
            } else {
98
            } else {
96
                die 'Unrecognized source of preference values: ' . $options{'choices'};
99
                die 'Unrecognized source of preference values: ' . $options{'choices'};
97
            }
100
            }
Lines 100-110 sub _get_chunk { Link Here
100
        $value ||= 0;
103
        $value ||= 0;
101
104
102
        $chunk->{'type'} = 'select';
105
        $chunk->{'type'} = 'select';
103
        $chunk->{'CHOICES'} = [
106
        if ( $name eq 'PatronSelfRegistrationDefaultCategory' ) {
104
            sort { $a->{'text'} cmp $b->{'text'} }
107
            $chunk->{'CHOICES'} = [
105
            map { { text => $options{'choices'}->{$_}, value => $_, selected => ( $_ eq $value || ( $_ eq '' && ( $value eq '0' || !$value ) ) ) } }
108
                sort { $a->{'text'} cmp $b->{'text'} }
106
            keys %{ $options{'choices'} }
109
                map { { text => $options{'choices'}->{$_}, value => $options{'choices'}->{$_}, selected => ( $_ eq $value || ( $_ eq '' && ( $value eq '0' || !$value ) ) ) } }
107
        ];
110
                keys %{ $options{'choices'} }
111
            ];
112
        } else {
113
            $chunk->{'CHOICES'} = [
114
                sort { $a->{'text'} cmp $b->{'text'} }
115
                map { { text => $options{'choices'}->{$_}, value => $_, selected => ( $_ eq $value || ( $_ eq '' && ( $value eq '0' || !$value ) ) ) } }
116
                keys %{ $options{'choices'} }
117
            ];
118
        }
108
    } elsif ( $options{'multiple'} ) {
119
    } elsif ( $options{'multiple'} ) {
109
        my @values;
120
        my @values;
110
        @values = split /,/, $value if defined($value);
121
        @values = split /,/, $value if defined($value);
Lines 295-301 my ( $template, $borrowernumber, $cookie ) = get_template_and_user( Link Here
295
        debug           => 1,
306
        debug           => 1,
296
    }
307
    }
297
);
308
);
298
299
$lang = $template->param( 'lang' );
309
$lang = $template->param( 'lang' );
300
my $op = $input->param( 'op' ) || '';
310
my $op = $input->param( 'op' ) || '';
301
my $tab = $input->param( 'tab' );
311
my $tab = $input->param( 'tab' );
(-)a/installer/data/mysql/atomicupdate/bug-17987-changing-PatronSelfRegistrationDefaultCategory-syspref.sql (+1 lines)
Line 0 Link Here
1
UPDATE systempreferences SET `type` = 'PatronCategories',`options` = NULL WHERE `variable` = 'PatronSelfRegistrationDefaultCategory';
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (-2 / +1 lines)
Lines 720-726 OPAC: Link Here
720
        -
720
        -
721
            - "Use the patron category code"
721
            - "Use the patron category code"
722
            - pref: PatronSelfRegistrationDefaultCategory
722
            - pref: PatronSelfRegistrationDefaultCategory
723
              class: short
723
              choices: patron-categories
724
            - "as the default patron category for patrons registered via the OPAC."
724
            - "as the default patron category for patrons registered via the OPAC."
725
        -
725
        -
726
            - "Delete patrons registered via the OPAC, but not yet verified after"
726
            - "Delete patrons registered via the OPAC, but not yet verified after"
727
- 

Return to bug 17987