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

(-)a/installer/data/mysql/atomicupdate/bug_11815-convert-borrowertitle-to-authval.perl (+23 lines)
Line 0 Link Here
1
$DBversion = 'XXX'; # will be replaced by the RM
2
if( CheckVersion( $DBversion ) ) {
3
    my ( $BorrowersTitles ) = $dbh->selectrow_array( q|
4
        SELECT value FROM systempreferences WHERE variable='BorrowersTitles';
5
    |);
6
    if( $BorrowersTitles ){
7
        $dbh->do("
8
            INSERT INTO authorised_value_categories( category_name ) VALUES ('PATRON_TITLE')
9
        ");
10
        my @titles;
11
        push @titles, split ('\|', $BorrowersTitles);
12
        my $sth = $dbh->prepare("
13
            INSERT INTO authorised_values(category, authorised_value, lib, lib_opac) VALUES ('PATRON_TITLE', ?, ?, ?)
14
        ");
15
        foreach my $patron_title ( @titles ) {
16
            $sth->execute( $patron_title, $patron_title, $patron_title );
17
        }
18
    }
19
    # Remove the BorrowersTitles system preference
20
    $dbh->do("DELETE FROM systempreferences WHERE variable='BorrowersTitles'");
21
    SetVersion ($DBversion);
22
    print "Upgrade to $DBversion done (Bug 11815: convert BorrowersTitles to an authorised value)\n";
23
}
(-)a/installer/data/mysql/sysprefs.sql (-1 lines)
Lines 101-107 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
101
('borrowerRelationship','father|mother','','Define valid relationships between a guarantor & a guarantee (separated by | or ,)','free'),
101
('borrowerRelationship','father|mother','','Define valid relationships between a guarantor & a guarantee (separated by | or ,)','free'),
102
('BorrowerRenewalPeriodBase','now','dateexpiry|now|combination','Set whether the borrower renewal date should be counted from the dateexpiry, from the current date or by combination: if the dateexpiry is in future use dateexpiry, else use current date ','Choice'),
102
('BorrowerRenewalPeriodBase','now','dateexpiry|now|combination','Set whether the borrower renewal date should be counted from the dateexpiry, from the current date or by combination: if the dateexpiry is in future use dateexpiry, else use current date ','Choice'),
103
('BorrowersLog','1',NULL,'If ON, log edit/create/delete actions on patron data','YesNo'),
103
('BorrowersLog','1',NULL,'If ON, log edit/create/delete actions on patron data','YesNo'),
104
('BorrowersTitles','Mr|Mrs|Miss|Ms',NULL,'Define appropriate Titles for patrons','free'),
105
('BorrowerUnwantedField','',NULL,'Name the fields you don\'t need to store for a patron\'s account','free'),
104
('BorrowerUnwantedField','',NULL,'Name the fields you don\'t need to store for a patron\'s account','free'),
106
('BranchTransferLimitsType','ccode','itemtype|ccode','When using branch transfer limits, choose whether to limit by itemtype or collection code.','Choice'),
105
('BranchTransferLimitsType','ccode','itemtype|ccode','When using branch transfer limits, choose whether to limit by itemtype or collection code.','Choice'),
107
('BrowseResultSelection','0',NULL,'Enable/Disable browsing search results fromt the bibliographic record detail page in staff client','YesNo'),
106
('BrowseResultSelection','0',NULL,'Enable/Disable browsing search results fromt the bibliographic record detail page in staff client','YesNo'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt (+2 lines)
Lines 420-425 Link Here
420
            <p>A list of reasons displayed in the suggestion form on the OPAC.</p>
420
            <p>A list of reasons displayed in the suggestion form on the OPAC.</p>
421
        [% CASE 'ORDER_CANCELLATION_REASON' %]
421
        [% CASE 'ORDER_CANCELLATION_REASON' %]
422
            <p>Reasons why an order might have been cancelled</p>
422
            <p>Reasons why an order might have been cancelled</p>
423
        [% CASE 'PATRON_TITLE' %]
424
            <p>Titles or honorifics which can be added to a patron record</p>
423
        [% CASE 'PAYMENT_TYPE' %]
425
        [% CASE 'PAYMENT_TYPE' %]
424
            <p>Populates a dropdown list of custom payment types when paying fines</p>
426
            <p>Populates a dropdown list of custom payment types when paying fines</p>
425
        [% CASE 'qualif' %]
427
        [% CASE 'qualif' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref (-5 lines)
Lines 53-63 Patrons: Link Here
53
           class: multi
53
           class: multi
54
         - (input multiple choices separated by |). Leave empty to deactivate
54
         - (input multiple choices separated by |). Leave empty to deactivate
55
     -
55
     -
56
         - "Borrowers can have the following titles:"
57
         - pref: BorrowersTitles
58
           class: multi
59
         - (separate multiple choices with |)
60
     -
61
         - pref: CheckPrevCheckout
56
         - pref: CheckPrevCheckout
62
           default: no
57
           default: no
63
           choices:
58
           choices:
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt (-6 / +6 lines)
Lines 240-246 Link Here
240
                                        <ol>
240
                                        <ol>
241
                                            [% UNLESS ( I ) %]
241
                                            [% UNLESS ( I ) %]
242
                                                [% UNLESS notitle %]
242
                                                [% UNLESS notitle %]
243
                                                    [% IF Koha.Preference('BorrowersTitles') %]
243
                                                    [% IF ( patron_titles ) %]
244
                                                        <li>
244
                                                        <li>
245
                                                            [% IF ( mandatorytitle ) %]
245
                                                            [% IF ( mandatorytitle ) %]
246
                                                                <label for="btitle" class="required">
246
                                                                <label for="btitle" class="required">
Lines 250-260 Link Here
250
                                                            Salutation: </label>
250
                                                            Salutation: </label>
251
                                                            <select id="btitle" name="title">
251
                                                            <select id="btitle" name="title">
252
                                                                <option value=""></option>
252
                                                                <option value=""></option>
253
                                                                [% FOREACH t IN Koha.Preference('BorrowersTitles').split('\|') %]
253
                                                                [% FOREACH ptitle IN patron_titles %]
254
                                                                    [% IF btitle == t %]
254
                                                                    [% IF btitle == ptitle.lib %]
255
                                                                        <option value="[% t | html %]" selected="selected">[% t | html %]</option>
255
                                                                        <option value="[% ptitle.lib | html %]" selected="selected">[% ptitle.lib | html %]</option>
256
                                                                    [% ELSE %]
256
                                                                    [% ELSE %]
257
                                                                        <option value="[% t | html %]">[% t | html %]</option>
257
                                                                        <option value="[% ptitle.lib | html %]">[% ptitle.lib | html %]</option>
258
                                                                    [% END %]
258
                                                                    [% END %]
259
                                                                [% END %]
259
                                                                [% END %]
260
                                                            </select>
260
                                                            </select>
Lines 262-268 Link Here
262
                                                                <span class="required">Required</span>
262
                                                                <span class="required">Required</span>
263
                                                            [% END %]
263
                                                            [% END %]
264
                                                        </li>
264
                                                        </li>
265
                                                    [% END # /IF Koha.Preference('BorrowersTitles') %]
265
                                                    [% END # /IF ( patron_titles ) %]
266
                                                [% END # /UNLESS notitle %]
266
                                                [% END # /UNLESS notitle %]
267
                                            [% END # /UNLESS ( I ) %]
267
                                            [% END # /UNLESS ( I ) %]
268
268
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt (-5 / +5 lines)
Lines 274-280 Link Here
274
                                <legend id="identity_legend">Identity</legend>
274
                                <legend id="identity_legend">Identity</legend>
275
275
276
                                <ol>
276
                                <ol>
277
                                    [% UNLESS hidden.defined('title') || !Koha.Preference('BorrowersTitles') %]
277
                                    [% UNLESS hidden.defined('title') || !patron_titles %]
278
                                        <li>
278
                                        <li>
279
                                            [% IF mandatory.defined('title') %]
279
                                            [% IF mandatory.defined('title') %]
280
                                                <label for="borrower_title" class="required">Salutation:</label>
280
                                                <label for="borrower_title" class="required">Salutation:</label>
Lines 284-294 Link Here
284
284
285
                                            <select id="borrower_title" name="borrower_title">
285
                                            <select id="borrower_title" name="borrower_title">
286
                                                <option value=""></option>
286
                                                <option value=""></option>
287
                                                [% FOREACH mt IN Koha.Preference('BorrowersTitles').split('\|') %]
287
                                                [% FOREACH ptitle IN patron_titles %]
288
                                                    [% IF mt == borrower.title %]
288
                                                    [% IF borrower.title == ptitle.lib %]
289
                                                        <option value="[% mt | html %]" selected="selected">[% mt | html %]</option>
289
                                                        <option value="[% ptitle.lib | html %]" selected="selected">[% ptitle.lib | html %]</option>
290
                                                    [% ELSE %]
290
                                                    [% ELSE %]
291
                                                        <option value="[% mt | html %]">[% mt | html %]</option>
291
                                                        <option value="[% ptitle.lib | html %]">[% ptitle.lib | html %]</option>
292
                                                    [% END %]
292
                                                    [% END %]
293
                                                [% END %]
293
                                                [% END %]
294
                                            </select>
294
                                            </select>
(-)a/members/memberentry.pl (+3 lines)
Lines 654-662 $template->param( Link Here
654
654
655
my $cities = Koha::Cities->search( {}, { order_by => 'city_name' } );
655
my $cities = Koha::Cities->search( {}, { order_by => 'city_name' } );
656
my $roadtypes = C4::Koha::GetAuthorisedValues( 'ROADTYPE' );
656
my $roadtypes = C4::Koha::GetAuthorisedValues( 'ROADTYPE' );
657
my $patron_titles = C4::Koha::GetAuthorisedValues( 'PATRON_TITLE' );
658
657
$template->param(
659
$template->param(
658
    roadtypes => $roadtypes,
660
    roadtypes => $roadtypes,
659
    cities    => $cities,
661
    cities    => $cities,
662
    patron_titles    => $patron_titles,
660
);
663
);
661
664
662
my $default_borrowertitle = '';
665
my $default_borrowertitle = '';
(-)a/opac/opac-memberentry.pl (-1 / +3 lines)
Lines 28-33 use C4::Output; Link Here
28
use C4::Members;
28
use C4::Members;
29
use C4::Members::Attributes qw( GetBorrowerAttributes );
29
use C4::Members::Attributes qw( GetBorrowerAttributes );
30
use C4::Form::MessagingPreferences;
30
use C4::Form::MessagingPreferences;
31
use Koha::AuthorisedValues;
31
use Koha::AuthUtils;
32
use Koha::AuthUtils;
32
use Koha::Patrons;
33
use Koha::Patrons;
33
use Koha::Patron::Consent;
34
use Koha::Patron::Consent;
Lines 74-79 if ( $action eq q{} ) { Link Here
74
}
75
}
75
76
76
my $mandatory = GetMandatoryFields($action);
77
my $mandatory = GetMandatoryFields($action);
78
my $patron_titles = C4::Koha::GetAuthorisedValues( 'PATRON_TITLE' );
77
79
78
my @libraries = Koha::Libraries->search;
80
my @libraries = Koha::Libraries->search;
79
if ( my @libraries_to_display = split '\|', C4::Context->preference('PatronSelfRegistrationLibraryList') ) {
81
if ( my @libraries_to_display = split '\|', C4::Context->preference('PatronSelfRegistrationLibraryList') ) {
Lines 93-98 $template->param( Link Here
93
    mandatory         => $mandatory,
95
    mandatory         => $mandatory,
94
    libraries         => \@libraries,
96
    libraries         => \@libraries,
95
    OPACPatronDetails => C4::Context->preference('OPACPatronDetails'),
97
    OPACPatronDetails => C4::Context->preference('OPACPatronDetails'),
98
    patron_titles     => $patron_titles,
96
);
99
);
97
100
98
my $attributes = ParsePatronAttributes($borrowernumber,$cgi);
101
my $attributes = ParsePatronAttributes($borrowernumber,$cgi);
99
- 

Return to bug 11815