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

(-)a/installer/data/mysql/atomicupdate/bug_23420_add_OPACSuggestionUnwantedFields_syspref.perl (+7 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
    NewVersion($DBversion, 23420, "Allow configuration of hidden fields on the suggestion form in OPAC");
7
}
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 451-456 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
451
('OPACShowUnusedAuthorities','1','','Show authorities that are not being used in the OPAC.','YesNo'),
451
('OPACShowUnusedAuthorities','1','','Show authorities that are not being used in the OPAC.','YesNo'),
452
('OpacStarRatings','all','disable|all|details',NULL,'Choice'),
452
('OpacStarRatings','all','disable|all|details',NULL,'Choice'),
453
('OpacSuggestionManagedBy',1,'','Show the name of the staff member who managed a suggestion in OPAC','YesNo'),
453
('OpacSuggestionManagedBy',1,'','Show the name of the staff member who managed a suggestion in OPAC','YesNo'),
454
('OPACSuggestionUnwantedFields',NULL,'','Define the hidden fields for a patron purchase suggestions made via OPAC.','multiple'),
454
('OpacSuppression','0','','Turn ON the OPAC Suppression feature, requires further setup, ask your system administrator for details','YesNo'),
455
('OpacSuppression','0','','Turn ON the OPAC Suppression feature, requires further setup, ask your system administrator for details','YesNo'),
455
('OpacSuppressionByIPRange','','','Restrict the suppression to IP adresses outside of the IP range','free'),
456
('OpacSuppressionByIPRange','','','Restrict the suppression to IP adresses outside of the IP range','free'),
456
('OpacSuppressionMessage','','Display this message on the redirect page for suppressed biblios','70|10','Textarea'),
457
('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 630-635 OPAC: Link Here
630
                note: Note
630
                note: Note
631
            - "<br />Note: if none of the above options are selected, 'Title' field would be mandatory anyway, by default."
631
            - "<br />Note: if none of the above options are selected, 'Title' field would be mandatory anyway, by default."
632
        -
632
        -
633
            - "Fields that should be hidden for patron purchase suggestions:"
634
            - pref: OPACSuggestionUnwantedFields
635
              multiple:
636
                author: Author
637
                copyrightdate: Copyright or publication date
638
                isbn: ISBN, ISSN or other standard number
639
                publishercode: Publisher name
640
                collectiontitle: Collection title
641
                place: Publication place
642
                itemtype: Item type
643
                quantity: Quantity
644
                branch: Library or branch
645
                patronreason: Patron reason
646
                note: Note
647
            - "<br />Note: Do not make OPACSuggestionMandatoryFields unwanted fields "
648
        -
633
            - pref: OpacHiddenItems
649
            - pref: OpacHiddenItems
634
              type: textarea
650
              type: textarea
635
              syntax: text/x-yaml
651
              syntax: text/x-yaml
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt (-82 / +104 lines)
Lines 76-154 Link Here
76
                                                <input type="text" id="title" name="title" class="span6" maxlength="255" value="[% title | html %]" />
76
                                                <input type="text" id="title" name="title" class="span6" maxlength="255" value="[% title | html %]" />
77
                                            [% END %]
77
                                            [% END %]
78
                                        </li>
78
                                        </li>
79
                                        <li>
79
                                        [% UNLESS ( author_hidden ) %]
80
                                            [% IF ( author_required ) %]
80
                                            <li>
81
                                                <label for="author" class="required">Author:</label>
81
                                                    [% IF ( author_required ) %]
82
                                                <input type="text" id="author" name="author" class="span6" maxlength="80" value="[% author | html %]" required="required" />
82
                                                        <label for="author" class="required">Author:</label>
83
                                                <span class="required">Required</span>
83
                                                        <input type="text" id="author" name="author" class="span6" maxlength="80" value="[% author | html %]" required="required" />
84
                                            [% ELSE %]
84
                                                        <span class="required">Required</span>
85
                                                <label for="author">Author:</label>
85
                                                    [% ELSE %]
86
                                                <input type="text" id="author" name="author" class="span6" maxlength="80" value="[% author | html %]" />
86
                                                        <label for="author">Author:</label>
87
                                            [% END %]
87
                                                        <input type="text" id="author" name="author" class="span6" maxlength="80" value="[% author | html %]" />
88
                                        </li>
88
                                                    [% END %]
89
                                        <li>
89
                                            </li>
90
                                            <div title="Copyright or publication year, for example: 2016">
90
                                        [% END %]
91
                                                [% IF ( copyrightdate_required ) %]
91
                                        [% UNLESS ( copyrightdate_hidden )%]
92
                                                    <label for="copyrightdate" class="required">Copyright date:</label>
92
                                            <li>
93
                                                    <input type="text" id="copyrightdate" name="copyrightdate" pattern="[12]\d{3}" size="4" maxlength="4" value="[% copyrightdate | html %]" required="required" />
93
                                                <div title="Copyright or publication year, for example: 2016">
94
                                                <span class="required">Required</span>
94
                                                    [% IF ( copyrightdate_required ) %]
95
                                                        <label for="copyrightdate" class="required">Copyright date:</label>
96
                                                        <input type="text" id="copyrightdate" name="copyrightdate" pattern="[12]\d{3}" size="4" maxlength="4" value="[% copyrightdate | html %]" required="required" />
97
                                                    <span class="required">Required</span>
98
                                                    [% ELSE %]
99
                                                        <label for="copyrightdate">Copyright date:</label>
100
                                                        <input type="text" id="copyrightdate" name="copyrightdate" pattern="[12]\d{3}" size="4" maxlength="4" value="[% copyrightdate | html %]" />
101
                                                    [% END %]
102
                                                </div>
103
                                            </li>
104
                                        [% END %]
105
                                        [% UNLESS ( isbn_hidden )%]
106
                                            <li>
107
                                                [% IF ( isbn_required ) %]
108
                                                    <label for="isbn" class="required">Standard number (ISBN, ISSN or other):</label>
109
                                                    <input type="text" id="isbn" name="isbn"  maxlength="80" value="[% isbn | html %]" required="required" />
110
                                                    <span class="required">Required</span>
95
                                                [% ELSE %]
111
                                                [% ELSE %]
96
                                                    <label for="copyrightdate">Copyright date:</label>
112
                                                    <label for="isbn">Standard number (ISBN, ISSN or other):</label>
97
                                                    <input type="text" id="copyrightdate" name="copyrightdate" pattern="[12]\d{3}" size="4" maxlength="4" value="[% copyrightdate | html %]" />
113
                                                    <input type="text" id="isbn" name="isbn"  maxlength="80" value="[% isbn | html %]" />
98
                                                [% END %]
114
                                                [% END %]
99
                                            </div>
115
                                            </li>
100
                                        </li>
116
                                        [% END %]
101
                                        <li>
117
                                        [% UNLESS ( publishercode_hidden ) %]
102
                                            [% IF ( isbn_required ) %]
118
                                            <li>
103
                                                <label for="isbn" class="required">Standard number (ISBN, ISSN or other):</label>
119
                                                [% IF ( publishercode_required ) %]
104
                                                <input type="text" id="isbn" name="isbn"  maxlength="80" value="[% isbn | html %]" required="required" />
120
                                                    <label for="publishercode" class="required">Publisher:</label>
105
                                                <span class="required">Required</span>
121
                                                    <input type="text" id="publishercode" name="publishercode" class="span6" maxlength="80" value="[% publishercode | html %]" required="required" />
106
                                            [% ELSE %]
122
                                                    <span class="required">Required</span>
107
                                                <label for="isbn">Standard number (ISBN, ISSN or other):</label>
123
                                                [% ELSE %]
108
                                                <input type="text" id="isbn" name="isbn"  maxlength="80" value="[% isbn | html %]" />
124
                                                    <label for="publishercode">Publisher:</label>
109
                                            [% END %]
125
                                                    <input type="text" id="publishercode" name="publishercode" class="span6" maxlength="80" value="[% publishercode | html %]" />
110
                                        </li>
126
                                                [% END %]
111
                                        <li>
127
                                            </li>
112
                                            [% IF ( publishercode_required ) %]
128
                                        [% END %]
113
                                                <label for="publishercode" class="required">Publisher:</label>
129
                                        [% UNLESS ( collectiontitle_hidden ) %]
114
                                                <input type="text" id="publishercode" name="publishercode" class="span6" maxlength="80" value="[% publishercode | html %]" required="required" />
130
                                            <li>
115
                                                <span class="required">Required</span>
131
                                                [% IF ( collectiontitle_required ) %]
116
                                            [% ELSE %]
132
                                                    <label for="collectiontitle" class="required">Collection title:</label>
117
                                                <label for="publishercode">Publisher:</label>
133
                                                    <input type="text" id="collectiontitle" name="collectiontitle" class="span6" maxlength="80" value="[% collectiontitle | html %]" required="required" />
118
                                                <input type="text" id="publishercode" name="publishercode" class="span6" maxlength="80" value="[% publishercode | html %]" />
134
                                                    <span class="required">Required</span>
119
                                            [% END %]
135
                                                [% ELSE %]
120
                                        </li>
136
                                                    <label for="collectiontitle">Collection title:</label>
121
                                        <li>
137
                                                    <input type="text" id="collectiontitle" name="collectiontitle" class="span6" maxlength="80" value="[% collectiontitle | html %]" />
122
                                            [% IF ( collectiontitle_required ) %]
138
                                                [% END %]
123
                                                <label for="collectiontitle" class="required">Collection title:</label>
139
                                            </li>
124
                                                <input type="text" id="collectiontitle" name="collectiontitle" class="span6" maxlength="80" value="[% collectiontitle | html %]" required="required" />
140
                                        [% END %]
125
                                                <span class="required">Required</span>
141
                                        [% UNLESS ( place_hidden ) %]
126
                                            [% ELSE %]
142
                                            <li>
127
                                                <label for="collectiontitle">Collection title:</label>
143
                                                [% IF ( place_required ) %]
128
                                                <input type="text" id="collectiontitle" name="collectiontitle" class="span6" maxlength="80" value="[% collectiontitle | html %]" />
144
                                                    <label for="place" class="required">Publication place:</label>
129
                                            [% END %]
145
                                                    <input type="text" id="place" name="place" required="required" maxlength="80" value="[% place | html %]" />
130
                                        </li>
146
                                                    <span class="required">Required</span>
131
                                        <li>
147
                                                [% ELSE %]
132
                                            [% IF ( place_required ) %]
148
                                                    <label for="place">Publication place:</label>
133
                                                <label for="place" class="required">Publication place:</label>
149
                                                    <input type="text" id="place" name="place"  maxlength="80" value="[% place | html %]" />
134
                                                <input type="text" id="place" name="place" required="required" maxlength="80" value="[% place | html %]" />
150
                                                [% END %]
135
                                                <span class="required">Required</span>
151
                                            </li>
136
                                            [% ELSE %]
152
                                        [% END %]
137
                                                <label for="place">Publication place:</label>
153
                                        [% UNLESS ( quantity_hidden ) %]
138
                                                <input type="text" id="place" name="place"  maxlength="80" value="[% place | html %]" />
154
                                            <li id="opac-suggestion-quantity">
139
                                            [% END %]
155
                                                [% IF ( quantity_required ) %]
140
                                        </li>
156
                                                    <label for="quantity" class="required">Quantity:</label>
141
                                        <li id="opac-suggestion-quantity">
157
                                                    <input type="text" id="quantity" name="quantity" required="required" maxlength="4" size="4" />
142
                                            [% IF ( quantity_required ) %]
158
                                                    <span class="required">Required</span>
143
                                                <label for="quantity" class="required">Quantity:</label>
159
                                                [% ELSE %]
144
                                                <input type="text" id="quantity" name="quantity" required="required" maxlength="4" size="4" />
160
                                                    <label for="quantity">Quantity:</label>
145
                                                <span class="required">Required</span>
161
                                                    <input type="text" id="quantity" name="quantity"  maxlength="4" size="4" />
146
                                            [% ELSE %]
162
                                                [% END %]
147
                                                <label for="quantity">Quantity:</label>
163
                                            </li>
148
                                                <input type="text" id="quantity" name="quantity"  maxlength="4" size="4" />
164
                                        [% END %]
149
                                            [% END %]
165
                                        [% UNLESS ( itemtype_hidden )%]
150
                                        </li>
166
                                            <li>
151
                                        <li>
152
                                            [% IF ( itemtype_required ) %]
167
                                            [% IF ( itemtype_required ) %]
153
                                                <label for="itemtype" class="required">Item type:</label>
168
                                                <label for="itemtype" class="required">Item type:</label>
154
                                                [% PROCESS 'av-build-dropbox.inc' name="itemtype", category="SUGGEST_FORMAT", size = 20 %]
169
                                                [% PROCESS 'av-build-dropbox.inc' name="itemtype", category="SUGGEST_FORMAT", size = 20 %]
Lines 157-164 Link Here
157
                                                <label for="itemtype">Item type:</label>
172
                                                <label for="itemtype">Item type:</label>
158
                                                [% PROCESS 'av-build-dropbox.inc' name="itemtype", category="SUGGEST_FORMAT", size = 20 %]
173
                                                [% PROCESS 'av-build-dropbox.inc' name="itemtype", category="SUGGEST_FORMAT", size = 20 %]
159
                                            [% END %]
174
                                            [% END %]
160
                                        </li>
175
                                            </li>
176
                                        [% END %]
161
                                        [% IF branchcode %]
177
                                        [% IF branchcode %]
178
                                        [% UNLESS ( branch_hidden )%]
162
                                            <li>
179
                                            <li>
163
                                                [% IF ( branchcode_required ) %]
180
                                                [% IF ( branchcode_required ) %]
164
                                                    <label for="branch" class="required">Library:</label>
181
                                                    <label for="branch" class="required">Library:</label>
Lines 174-180 Link Here
174
                                                [% END %]
191
                                                [% END %]
175
                                            </li>
192
                                            </li>
176
                                        [% END %]
193
                                        [% END %]
194
                                        [% END %]
177
                                        [% IF ( patron_reason_loop ) %]
195
                                        [% IF ( patron_reason_loop ) %]
196
                                        [% UNLESS ( patronreason_hidden )%]
178
                                            <li>
197
                                            <li>
179
                                                [% IF ( patronreason_required ) %]
198
                                                [% IF ( patronreason_required ) %]
180
                                                    <label for="patronreason" class="required">Reason for suggestion: </label>
199
                                                    <label for="patronreason" class="required">Reason for suggestion: </label>
Lines 196-211 Link Here
196
                                                [% END %]
215
                                                [% END %]
197
                                            </li>
216
                                            </li>
198
                                        [% END %]
217
                                        [% END %]
199
                                        <li>
218
                                        [% END %]
200
                                            [% IF ( note_required ) %]
219
                                        [% UNLESS ( note_hidden ) %]
201
                                                <label for="note" class="required">Notes:</label>
220
                                            <li>
202
                                                <textarea name="note" id="note" rows="5" cols="40" required="required">[% note | html %]</textarea>
221
                                                [% IF ( note_required ) %]
203
                                                <span class="required">Required</span>
222
                                                    <label for="note" class="required">Notes:</label>
204
                                            [% ELSE %]
223
                                                    <textarea name="note" id="note" rows="5" cols="40" required="required">[% note | html %]</textarea>
205
                                                <label for="note">Notes:</label>
224
                                                    <span class="required">Required</span>
206
                                                <textarea name="note" id="note" rows="5" cols="40">[% note | html %]</textarea>
225
                                                [% ELSE %]
207
                                            [% END %]
226
                                                    <label for="note">Notes:</label>
208
                                        </li>
227
                                                    <textarea name="note" id="note" rows="5" cols="40">[% note | html %]</textarea>
228
                                                [% END %]
229
                                            </li>
230
                                        [% END %]
209
231
210
                                        <!--  Add a hidden 'negcap' field -->
232
                                        <!--  Add a hidden 'negcap' field -->
211
                                        <li id="negcap" style="position: absolute; left: -2000px;">
233
                                        <li id="negcap" style="position: absolute; left: -2000px;">
(-)a/opac/opac-suggestions.pl (-1 / +10 lines)
Lines 256-261 my @mandatoryfields; Link Here
256
    }
256
    }
257
}
257
}
258
258
259
my @unwantedfields;
260
{
261
    last unless ($op eq 'add');
262
    my $fldsreq_sp = C4::Context->preference("OPACSuggestionUnwantedFields");
263
    @unwantedfields = sort split(/\s*\,\s*/, $fldsreq_sp);
264
    foreach (@unwantedfields) {
265
        $template->param( $_."_hidden" => 1);
266
    }
267
}
268
259
$template->param(
269
$template->param(
260
    %$suggestion,
270
    %$suggestion,
261
    suggestions_loop      => $suggestions_loop,
271
    suggestions_loop      => $suggestions_loop,
262
- 

Return to bug 23420