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

(-)a/installer/data/mysql/atomicupdate/bug_23420_add_OPACSuggestionUnwantedFields_syspref.perl (+8 lines)
Line 0 Link Here
1
$DBversion = 'XXX'; # will be replaced by the RM
2
 if ( CheckVersion($DBversion) ) {
3
    $dbh->do(q{
4
         INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`, `type`) VALUES ('OPACSuggestionUnwantedFields','', NULL,'Define the hidden fields for a patron purchase suggestions made via OPAC.','multiple');
5
    });
6
7
    NewVersion($DBversion, 23420, "Allow configuration of hidden fields on the suggestion form in OPAC");
8
}
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 446-451 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
446
('OPACShowUnusedAuthorities','1','','Show authorities that are not being used in the OPAC.','YesNo'),
446
('OPACShowUnusedAuthorities','1','','Show authorities that are not being used in the OPAC.','YesNo'),
447
('OpacStarRatings','all','disable|all|details',NULL,'Choice'),
447
('OpacStarRatings','all','disable|all|details',NULL,'Choice'),
448
('OpacSuggestionManagedBy',1,'','Show the name of the staff member who managed a suggestion in OPAC','YesNo'),
448
('OpacSuggestionManagedBy',1,'','Show the name of the staff member who managed a suggestion in OPAC','YesNo'),
449
('OPACSuggestionUnwantedFields', '', NULL , 'Define the hidden fields for a patron purchase suggestions made via OPAC.' , 'multiple'),
449
('OpacSuppression','0','','Turn ON the OPAC Suppression feature, requires further setup, ask your system administrator for details','YesNo'),
450
('OpacSuppression','0','','Turn ON the OPAC Suppression feature, requires further setup, ask your system administrator for details','YesNo'),
450
('OpacSuppressionByIPRange','','','Restrict the suppression to IP adresses outside of the IP range','free'),
451
('OpacSuppressionByIPRange','','','Restrict the suppression to IP adresses outside of the IP range','free'),
451
('OpacSuppressionMessage','','Display this message on the redirect page for suppressed biblios','70|10','Textarea'),
452
('OpacSuppressionMessage','','Display this message on the redirect page for suppressed biblios','70|10','Textarea'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (+16 lines)
Lines 641-646 OPAC: Link Here
641
                note: Note
641
                note: Note
642
            - "<br />Note: if none of the above options are selected, 'Title' field would be mandatory anyway, by default."
642
            - "<br />Note: if none of the above options are selected, 'Title' field would be mandatory anyway, by default."
643
        -
643
        -
644
            - "Fields that should be hidden for patron purchase suggestions:"
645
            - pref: OPACSuggestionUnwantedFields
646
              multiple:
647
                title: Title
648
                author: Author
649
                copyrightdate: Copyright or publication date
650
                isbn: ISBN, ISSN or other standard number
651
                publishercode: Publisher name
652
                collectiontitle: Collection title
653
                place: Publication place
654
                itemtype: Item type
655
                quantity: Quantity
656
                branch: Library or branch
657
                patronreason: Patron reason
658
                note: Note
659
        -
644
            - pref: OpacHiddenItems
660
            - pref: OpacHiddenItems
645
              type: textarea
661
              type: textarea
646
              syntax: text/x-yaml
662
              syntax: text/x-yaml
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt (-89 / +112 lines)
Lines 13-19 Link Here
13
</head>
13
</head>
14
[% IF ( loggedinusername ) %][% INCLUDE 'bodytag.inc' bodyid='opac-usersuggestions' bodyclass='scrollto' %][% ELSE %][% INCLUDE 'bodytag.inc' bodyid='opac-suggestions' bodyclass='scrollto' %][% END %]
14
[% IF ( loggedinusername ) %][% INCLUDE 'bodytag.inc' bodyid='opac-usersuggestions' bodyclass='scrollto' %][% ELSE %][% INCLUDE 'bodytag.inc' bodyid='opac-suggestions' bodyclass='scrollto' %][% END %]
15
[% INCLUDE 'masthead.inc' %]
15
[% INCLUDE 'masthead.inc' %]
16
17
    <div class="main">
16
    <div class="main">
18
        <ul class="breadcrumb">
17
        <ul class="breadcrumb">
19
            <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
18
            <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
Lines 57-144 Link Here
57
                            <form action="/cgi-bin/koha/opac-suggestions.pl" method="post" id="add_suggestion_form">
56
                            <form action="/cgi-bin/koha/opac-suggestions.pl" method="post" id="add_suggestion_form">
58
                                <fieldset class="rows">
57
                                <fieldset class="rows">
59
                                    <ol>
58
                                    <ol>
60
                                        <li>
59
                                        [% UNLESS ( title_hidden ) %]
61
                                            [% IF ( title_required ) %]
60
                                            <li>
62
                                                <label for="title" class="required">Title:</label>
61
                                                [% IF ( title_required ) %]
63
                                                <input type="text" id="title" name="title" class="span6" maxlength="255" value="[% title | html %]" required="required" />
62
                                                    <label for="title" class="required">Title:</label>
64
                                                <span class="required">Required</span>
63
                                                    <input type="text" id="title" name="title" class="span6" maxlength="255" value="[% title | html %]" required="required" />
65
                                            [% ELSE %]
64
                                                    <span class="required">Required</span>
66
                                                <label for="title">Title:</label>
67
                                                <input type="text" id="title" name="title" class="span6" maxlength="255" value="[% title | html %]" />
68
                                            [% END %]
69
                                        </li>
70
                                        <li>
71
                                            [% IF ( author_required ) %]
72
                                                <label for="author" class="required">Author:</label>
73
                                                <input type="text" id="author" name="author" class="span6" maxlength="80" value="[% author | html %]" required="required" />
74
                                                <span class="required">Required</span>
75
                                            [% ELSE %]
76
                                                <label for="author">Author:</label>
77
                                                <input type="text" id="author" name="author" class="span6" maxlength="80" value="[% author | html %]" />
78
                                            [% END %]
79
                                        </li>
80
                                        <li>
81
                                            <div title="Copyright or publication year, for example: 2016">
82
                                                [% IF ( copyrightdate_required ) %]
83
                                                    <label for="copyrightdate" class="required">Copyright date:</label>
84
                                                    <input type="text" id="copyrightdate" name="copyrightdate" pattern="[12]\d{3}" size="4" maxlength="4" value="[% copyrightdate | html %]" required="required" />
85
                                                <span class="required">Required</span>
86
                                                [% ELSE %]
65
                                                [% ELSE %]
87
                                                    <label for="copyrightdate">Copyright date:</label>
66
                                                    <label for="title">Title:</label>
88
                                                    <input type="text" id="copyrightdate" name="copyrightdate" pattern="[12]\d{3}" size="4" maxlength="4" value="[% copyrightdate | html %]" />
67
                                                    <input type="text" id="title" name="title" class="span6" maxlength="255" value="[% title | html %]" />
89
                                                [% END %]
68
                                                [% END %]
90
                                            </div>
69
                                            </li>
91
                                        </li>
70
                                        [% END %]
92
                                        <li>
93
                                            [% IF ( isbn_required ) %]
94
                                                <label for="isbn" class="required">Standard number (ISBN, ISSN or other):</label>
95
                                                <input type="text" id="isbn" name="isbn"  maxlength="80" value="[% isbn | html %]" required="required" />
96
                                                <span class="required">Required</span>
97
                                            [% ELSE %]
98
                                                <label for="isbn">Standard number (ISBN, ISSN or other):</label>
99
                                                <input type="text" id="isbn" name="isbn"  maxlength="80" value="[% isbn | html %]" />
100
                                            [% END %]
101
                                        </li>
102
                                        <li>
103
                                            [% IF ( publishercode_required ) %]
104
                                                <label for="publishercode" class="required">Publisher:</label>
105
                                                <input type="text" id="publishercode" name="publishercode" class="span6" maxlength="80" value="[% publishercode | html %]" required="required" />
106
                                                <span class="required">Required</span>
107
                                            [% ELSE %]
108
                                                <label for="publishercode">Publisher:</label>
109
                                                <input type="text" id="publishercode" name="publishercode" class="span6" maxlength="80" value="[% publishercode | html %]" />
110
                                            [% END %]
111
                                        </li>
112
                                        <li>
113
                                            [% IF ( collectiontitle_required ) %]
114
                                                <label for="collectiontitle" class="required">Collection title:</label>
115
                                                <input type="text" id="collectiontitle" name="collectiontitle" class="span6" maxlength="80" value="[% collectiontitle | html %]" required="required" />
116
                                                <span class="required">Required</span>
117
                                            [% ELSE %]
118
                                                <label for="collectiontitle">Collection title:</label>
119
                                                <input type="text" id="collectiontitle" name="collectiontitle" class="span6" maxlength="80" value="[% collectiontitle | html %]" />
120
                                            [% END %]
121
                                        </li>
122
                                        <li>
71
                                        <li>
123
                                            [% IF ( place_required ) %]
72
                                        [% UNLESS ( author_hidden ) %]
124
                                                <label for="place" class="required">Publication place:</label>
73
                                                [% IF ( author_required ) %]
125
                                                <input type="text" id="place" name="place" required="required" maxlength="80" value="[% place | html %]" />
74
                                                    <label for="author" class="required">Author:</label>
126
                                                <span class="required">Required</span>
75
                                                    <input type="text" id="author" name="author" class="span6" maxlength="80" value="[% author | html %]" required="required" />
127
                                            [% ELSE %]
76
                                                    <span class="required">Required</span>
128
                                                <label for="place">Publication place:</label>
77
                                                [% ELSE %]
129
                                                <input type="text" id="place" name="place"  maxlength="80" value="[% place | html %]" />
78
                                                    <label for="author">Author:</label>
130
                                            [% END %]
79
                                                    <input type="text" id="author" name="author" class="span6" maxlength="80" value="[% author | html %]" />
131
                                        </li>
80
                                                [% END %]
132
                                        <li id="opac-suggestion-quantity">
133
                                            [% IF ( quantity_required ) %]
134
                                                <label for="quantity" class="required">Quantity:</label>
135
                                                <input type="text" id="quantity" name="quantity" required="required" maxlength="4" size="4" />
136
                                                <span class="required">Required</span>
137
                                            [% ELSE %]
138
                                                <label for="quantity">Quantity:</label>
139
                                                <input type="text" id="quantity" name="quantity"  maxlength="4" size="4" />
140
                                            [% END %]
141
                                        </li>
81
                                        </li>
82
                                        [% END %]
83
                                        [% UNLESS ( copyrightdate_hidden )%]
84
                                            <li>
85
                                                <div title="Copyright or publication year, for example: 2016">
86
                                                    [% IF ( copyrightdate_required ) %]
87
                                                        <label for="copyrightdate" class="required">Copyright date:</label>
88
                                                        <input type="text" id="copyrightdate" name="copyrightdate" pattern="[12]\d{3}" size="4" maxlength="4" value="[% copyrightdate | html %]" required="required" />
89
                                                    <span class="required">Required</span>
90
                                                    [% ELSE %]
91
                                                        <label for="copyrightdate">Copyright date:</label>
92
                                                        <input type="text" id="copyrightdate" name="copyrightdate" pattern="[12]\d{3}" size="4" maxlength="4" value="[% copyrightdate | html %]" />
93
                                                    [% END %]
94
                                                </div>
95
                                            </li>
96
                                        [% END %]
97
                                        [% UNLESS ( isbn_hidden ) %]
98
                                            <li>
99
                                                [% IF ( isbn_required ) %]
100
                                                    <label for="isbn" class="required">Standard number (ISBN, ISSN or other):</label>
101
                                                    <input type="text" id="isbn" name="isbn"  maxlength="80" value="[% isbn | html %]" required="required" />
102
                                                    <span class="required">Required</span>
103
                                                [% ELSE %]
104
                                                    <label for="isbn">Standard number (ISBN, ISSN or other):</label>
105
                                                    <input type="text" id="isbn" name="isbn"  maxlength="80" value="[% isbn | html %]" />
106
                                                [% END %]
107
                                            </li>
108
                                        [% END %]
109
                                        [% UNLESS ( publishercode_hidden ) %]
110
                                            <li>
111
                                                [% IF ( publishercode_required ) %]
112
                                                    <label for="publishercode" class="required">Publisher:</label>
113
                                                    <input type="text" id="publishercode" name="publishercode" class="span6" maxlength="80" value="[% publishercode | html %]" required="required" />
114
                                                    <span class="required">Required</span>
115
                                                [% ELSE %]
116
                                                    <label for="publishercode">Publisher:</label>
117
                                                    <input type="text" id="publishercode" name="publishercode" class="span6" maxlength="80" value="[% publishercode | html %]" />
118
                                                [% END %]
119
                                            </li>
120
                                        [% END %]
121
                                        [% UNLESS ( collectiontitle_hidden ) %]
122
                                            <li>
123
                                                [% IF ( collectiontitle_required ) %]
124
                                                    <label for="collectiontitle" class="required">Collection title:</label>
125
                                                    <input type="text" id="collectiontitle" name="collectiontitle" class="span6" maxlength="80" value="[% collectiontitle | html %]" required="required" />
126
                                                    <span class="required">Required</span>
127
                                                [% ELSE %]
128
                                                    <label for="collectiontitle">Collection title:</label>
129
                                                    <input type="text" id="collectiontitle" name="collectiontitle" class="span6" maxlength="80" value="[% collectiontitle | html %]" />
130
                                                [% END %]
131
                                            </li>
132
                                        [% END %]
133
                                        [% UNLESS ( place_hidden )%]
134
                                            <li>
135
                                                [% IF ( place_required ) %]
136
                                                    <label for="place" class="required">Publication place:</label>
137
                                                    <input type="text" id="place" name="place" required="required" maxlength="80" value="[% place | html %]" />
138
                                                    <span class="required">Required</span>
139
                                                [% ELSE %]
140
                                                    <label for="place">Publication place:</label>
141
                                                    <input type="text" id="place" name="place"  maxlength="80" value="[% place | html %]" />
142
                                                [% END %]
143
                                            </li>
144
                                        [% END %]
145
                                        [% UNLESS ( quantity_hidden )%]
146
                                            <li id="opac-suggestion-quantity">
147
                                                [% IF ( quantity_required ) %]
148
                                                    <label for="quantity" class="required">Quantity:</label>
149
                                                    <input type="text" id="quantity" name="quantity" required="required" maxlength="4" size="4" />
150
                                                    <span class="required">Required</span>
151
                                                [% ELSE %]
152
                                                    <label for="quantity">Quantity:</label>
153
                                                    <input type="text" id="quantity" name="quantity"  maxlength="4" size="4" />
154
                                                [% END %]
155
                                            </li>
156
                                        [% END %]
157
                                        [% UNLESS (itemtype_hidden) %]
142
                                        <li>
158
                                        <li>
143
                                            [% IF ( itemtype_required ) %]
159
                                            [% IF ( itemtype_required ) %]
144
                                                <label for="itemtype" class="required">Item type:</label>
160
                                                <label for="itemtype" class="required">Item type:</label>
Lines 149-155 Link Here
149
                                                [% PROCESS 'av-build-dropbox.inc' name="itemtype", category="SUGGEST_FORMAT", size = 20 %]
165
                                                [% PROCESS 'av-build-dropbox.inc' name="itemtype", category="SUGGEST_FORMAT", size = 20 %]
150
                                            [% END %]
166
                                            [% END %]
151
                                        </li>
167
                                        </li>
168
                                        [% END %]
152
                                        [% IF branchcode %]
169
                                        [% IF branchcode %]
170
                                        [% UNLESS ( branchcode_hidden )%]
153
                                            <li>
171
                                            <li>
154
                                                [% IF ( branchcode_required ) %]
172
                                                [% IF ( branchcode_required ) %]
155
                                                    <label for="branch" class="required">Library:</label>
173
                                                    <label for="branch" class="required">Library:</label>
Lines 165-171 Link Here
165
                                                [% END %]
183
                                                [% END %]
166
                                            </li>
184
                                            </li>
167
                                        [% END %]
185
                                        [% END %]
186
                                        [% END %]
168
                                        [% IF ( patron_reason_loop ) %]
187
                                        [% IF ( patron_reason_loop ) %]
188
                                        [% UNLESS ( patronreason_hidden ) %]
169
                                            <li>
189
                                            <li>
170
                                                [% IF ( patronreason_required ) %]
190
                                                [% IF ( patronreason_required ) %]
171
                                                    <label for="patronreason" class="required">Reason for suggestion: </label>
191
                                                    <label for="patronreason" class="required">Reason for suggestion: </label>
Lines 187-202 Link Here
187
                                                [% END %]
207
                                                [% END %]
188
                                            </li>
208
                                            </li>
189
                                        [% END %]
209
                                        [% END %]
190
                                        <li>
210
                                        [% END %]
191
                                            [% IF ( note_required ) %]
211
                                        [% UNLESS ( note_hidden ) %]
192
                                                <label for="note" class="required">Notes:</label>
212
                                            <li>
193
                                                <textarea name="note" id="note" rows="5" cols="40" required="required">[% note | html %]</textarea>
213
                                                [% IF ( note_required ) %]
194
                                                <span class="required">Required</span>
214
                                                    <label for="note" class="required">Notes:</label>
195
                                            [% ELSE %]
215
                                                    <textarea name="note" id="note" rows="5" cols="40" required="required">[% note | html %]</textarea>
196
                                                <label for="note">Notes:</label>
216
                                                    <span class="required">Required</span>
197
                                                <textarea name="note" id="note" rows="5" cols="40">[% note | html %]</textarea>
217
                                                [% ELSE %]
198
                                            [% END %]
218
                                                    <label for="note">Notes:</label>
199
                                        </li>
219
                                                    <textarea name="note" id="note" rows="5" cols="40">[% note | html %]</textarea>
220
                                                [% END %]
221
                                            </li>
222
                                        [% END %]
200
223
201
                                        <!--  Add a hidden 'negcap' field -->
224
                                        <!--  Add a hidden 'negcap' field -->
202
                                        <li id="negcap" style="position: absolute; left: -2000px;">
225
                                        <li id="negcap" style="position: absolute; left: -2000px;">
(-)a/opac/opac-suggestions.pl (-1 / +10 lines)
Lines 257-262 my @mandatoryfields; Link Here
257
    }
257
    }
258
}
258
}
259
259
260
my @unwantedfields;
261
{
262
    last unless ($op eq 'add');
263
    my $fldsreq_sp = C4::Context->preference("OPACSuggestionUnwantedFields");
264
    @unwantedfields = sort split(/\s*\,\s*/, $fldsreq_sp);
265
    foreach (@unwantedfields) {
266
        $template->param( $_."_hidden" => 1);
267
    }
268
}
269
260
$template->param(
270
$template->param(
261
    %$suggestion,
271
    %$suggestion,
262
    suggestions_loop      => $suggestions_loop,
272
    suggestions_loop      => $suggestions_loop,
263
- 

Return to bug 23420