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

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt (-36 / +126 lines)
Lines 43-84 Link Here
43
                            <form action="/cgi-bin/koha/opac-suggestions.pl" method="post" id="add_suggestion_form">
43
                            <form action="/cgi-bin/koha/opac-suggestions.pl" method="post" id="add_suggestion_form">
44
                                <fieldset class="rows">
44
                                <fieldset class="rows">
45
                                    <ol>
45
                                    <ol>
46
                                        <li><label for="title">Title:</label><input type="text" id="title" name="title" class="span6" maxlength="255" /></li>
46
                                        <li>
47
                                        <li><label for="author">Author:</label><input type="text" id="author" name="author" class="span6" maxlength="80" /></li>
47
                                            [% IF ( title_required ) %]
48
                                                <label for="title" class="required">Title:</label>
49
                                                <input type="text" id="title" name="title" class="span6" maxlength="255" required="required" />
50
                                                <span class="required">Required</span>
51
                                            [% ELSE %]
52
                                                <label for="title">Title:</label>
53
                                                <input type="text" id="title" name="title" class="span6" maxlength="255" />
54
                                            [% END %]
55
                                        </li>
56
                                        <li>
57
                                            [% IF ( author_required ) %]
58
                                                <label for="author" class="required">Author:</label>
59
                                                <input type="text" id="author" name="author" class="span6" maxlength="80" required="required" />
60
                                                <span class="required">Required</span>
61
                                            [% ELSE %]
62
                                                <label for="author">Author:</label>
63
                                                <input type="text" id="author" name="author" class="span6" maxlength="80" />
64
                                            [% END %]
65
                                        </li>
48
                                        <li>
66
                                        <li>
49
                                            <div title="Copyright or publication year, for example: 2016">
67
                                            <div title="Copyright or publication year, for example: 2016">
50
                                            <label for="copyrightdate">Copyright date:</label><input type="text" id="copyrightdate" name="copyrightdate" pattern="[12]\d{3}" size="4" maxlength="4" />
68
                                                [% IF ( copyrightdate_required ) %]
69
                                                    <label for="copyrightdate" class="required">Copyright date:</label>
70
                                                    <input type="text" id="copyrightdate" name="copyrightdate" pattern="[12]\d{3}" size="4" maxlength="4" required="required" />
71
                                                <span class="required">Required</span>
72
                                                [% ELSE %]
73
                                                    <label for="copyrightdate">Copyright date:</label>
74
                                                    <input type="text" id="copyrightdate" name="copyrightdate" pattern="[12]\d{3}" size="4" maxlength="4" />
75
                                                [% END %]
51
                                            </div>
76
                                            </div>
52
                                        </li>
77
                                        </li>
53
                                        <li><label for="isbn">Standard number (ISBN, ISSN or other):</label><input type="text" id="isbn" name="isbn"  maxlength="80" /></li>
78
                                        <li>
54
                                        <li><label for="publishercode">Publisher:</label><input type="text" id="publishercode" name="publishercode" class="span6" maxlength="80" /></li>
79
                                            [% IF ( isbn_required ) %]
55
                                        <li><label for="collectiontitle">Collection title:</label><input type="text" id="collectiontitle" name="collectiontitle" class="span6" maxlength="80" /></li>
80
                                                <label for="isbn" class="required">Standard number (ISBN, ISSN or other):</label>
56
                                        <li><label for="place">Publication place:</label><input type="text" id="place" name="place"  maxlength="80" /></li>
81
                                                <input type="text" id="isbn" name="isbn"  maxlength="80" required="required" />
57
                                        <li id="opac-suggestion-quantity"><label for="quantity">Quantity:</label><input type="text" id="quantity" name="quantity"  maxlength="4" size="4" /></li>
82
                                                <span class="required">Required</span>
58
                                        <li><label for="itemtype">Item type:</label>
83
                                            [% ELSE %]
59
                                            [% PROCESS 'av-build-dropbox.inc' name="itemtype", category="SUGGEST_FORMAT", size = 20 %]
84
                                                <label for="isbn">Standard number (ISBN, ISSN or other):</label>
85
                                                <input type="text" id="isbn" name="isbn"  maxlength="80" />
86
                                            [% END %]
87
                                        </li>
88
                                        <li>
89
                                            [% IF ( publishercode_required ) %]
90
                                                <label for="publishercode" class="required">Publisher:</label>
91
                                                <input type="text" id="publishercode" name="publishercode" class="span6" maxlength="80" required="required" />
92
                                                <span class="required">Required</span>
93
                                            [% ELSE %]
94
                                                <label for="publishercode">Publisher:</label>
95
                                                <input type="text" id="publishercode" name="publishercode" class="span6" maxlength="80" />
96
                                            [% END %]
97
                                        </li>
98
                                        <li>
99
                                            [% IF ( collectiontitle_required ) %]
100
                                                <label for="collectiontitle" class="required">Collection title:</label>
101
                                                <input type="text" id="collectiontitle" name="collectiontitle" class="span6" maxlength="80" required="required" />
102
                                                <span class="required">Required</span>
103
                                            [% ELSE %]
104
                                                <label for="collectiontitle">Collection title:</label>
105
                                                <input type="text" id="collectiontitle" name="collectiontitle" class="span6" maxlength="80" />
106
                                            [% END %]
107
                                        </li>
108
                                        <li>
109
                                            [% IF ( place_required ) %]
110
                                                <label for="place" class="required">Publication place:</label>
111
                                                <input type="text" id="place" name="place" required="required" maxlength="80" />
112
                                                <span class="required">Required</span>
113
                                            [% ELSE %]
114
                                                <label for="place">Publication place:</label>
115
                                                <input type="text" id="place" name="place"  maxlength="80" />
116
                                            [% END %]
117
                                        </li>
118
                                        <li id="opac-suggestion-quantity">
119
                                            [% IF ( quantity_required ) %]
120
                                                <label for="quantity" class="required">Quantity:</label>
121
                                                <input type="text" id="quantity" name="quantity" required="required" maxlength="4" size="4" />
122
                                                <span class="required">Required</span>
123
                                            [% ELSE %]
124
                                                <label for="quantity">Quantity:</label>
125
                                                <input type="text" id="quantity" name="quantity"  maxlength="4" size="4" />
126
                                            [% END %]
127
                                        </li>
128
                                        <li>
129
                                            [% IF ( itemtype_required ) %]
130
                                                <label for="itemtype" class="required">Item type:</label>
131
                                                [% PROCESS 'av-build-dropbox.inc' name="itemtype", category="SUGGEST_FORMAT", size = 20 %]
132
                                                <span class="required">Required</span>
133
                                            [% ELSE %]
134
                                                <label for="itemtype">Item type:</label>
135
                                                [% PROCESS 'av-build-dropbox.inc' name="itemtype", category="SUGGEST_FORMAT", size = 20 %]
136
                                            [% END %]
60
                                        </li>
137
                                        </li>
61
                                        [% IF branchcode %]
138
                                        [% IF branchcode %]
62
                                            <li><label for="branch">Library:</label>
139
                                            <li>
63
                                                <select name="branchcode" id="branch">
140
                                                [% IF ( branchcode_required ) %]
64
                                                    [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
141
                                                    <label for="branch" class="required">Library:</label>
65
                                                </select>
142
                                                    <select name="branchcode" id="branch" required="required">
143
                                                        [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
144
                                                    </select>
145
                                                    <span class="required">Required</span>
146
                                                [% ELSE %]
147
                                                    <label for="branch">Library:</label>
148
                                                    <select name="branchcode" id="branch">
149
                                                        [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
150
                                                    </select>
151
                                                [% END %]
66
                                            </li>
152
                                            </li>
67
                                        [% END %]
153
                                        [% END %]
68
                                        [% IF ( patron_reason_loop ) %]
154
                                        [% IF ( patron_reason_loop ) %]
69
                                            <li>
155
                                            <li>
70
                                                <label for="patronreason">Reason for suggestion: </label>
156
                                                [% IF ( patronreason_required ) %]
71
                                                <select name="patronreason" id="patronreason">
157
                                                    <label for="patronreason" class="required">Reason for suggestion: </label>
72
                                                    <option value="">-- Choose --</option>
158
                                                    <select name="patronreason" id="patronreason" required="required">
73
                                                    [% FOREACH patron_reason_loo IN patron_reason_loop %]
159
                                                        <option value="">-- Choose --</option>
74
                                                        <option value="[% patron_reason_loo.authorised_value | html %]">[% patron_reason_loo.lib | html %]</option>
160
                                                        [% FOREACH patron_reason_loo IN patron_reason_loop %]
75
                                                    [% END %]
161
                                                            <option value="[% patron_reason_loo.authorised_value | html %]">[% patron_reason_loo.lib | html %]</option>
76
                                                </select>
162
                                                        [% END %]
163
                                                    </select>
164
                                                    <span class="required">Required</span>
165
                                                [% ELSE %]
166
                                                    <label for="patronreason">Reason for suggestion: </label>
167
                                                    <select name="patronreason" id="patronreason">
168
                                                        <option value="">-- Choose --</option>
169
                                                        [% FOREACH patron_reason_loo IN patron_reason_loop %]
170
                                                            <option value="[% patron_reason_loo.authorised_value | html %]">[% patron_reason_loo.lib | html %]</option>
171
                                                        [% END %]
172
                                                    </select>
173
                                                [% END %]
77
                                            </li>
174
                                            </li>
78
                                        [% END %]
175
                                        [% END %]
79
                                        <li>
176
                                        <li>
80
                                            <label for="note">Notes:</label>
177
                                            [% IF ( note_required ) %]
81
                                            <textarea name="note" id="note" rows="5" cols="40"></textarea>
178
                                                <label for="note" class="required">Notes:</label>
179
                                                <textarea name="note" id="note" rows="5" cols="40" required="required"></textarea>
180
                                                <span class="required">Required</span>
181
                                            [% ELSE %]
182
                                                <label for="note">Notes:</label>
183
                                                <textarea name="note" id="note" rows="5" cols="40"></textarea>
184
                                            [% END %]
82
                                        </li>
185
                                        </li>
83
186
84
                                        <!--  Add a hidden 'negcap' field -->
187
                                        <!--  Add a hidden 'negcap' field -->
Lines 339-357 Link Here
339
          return true;
442
          return true;
340
        });
443
        });
341
        [% END %]
444
        [% END %]
342
        [% IF ( op_add && mandatoryfields ) %]
343
        {
344
            var FldsRequired = [[% mandatoryfields | $raw %]];
345
            for (var i = 0; i < FldsRequired.length; i++) {
346
                var rq_input = $('#' + FldsRequired[i]);
347
                if (rq_input.length != 1) continue;
348
                $(rq_input).attr("required", "required");
349
                var rq_label = $("label[for=" + rq_input.attr("id") + "]");
350
                if (rq_label.length != 1) continue;
351
                $(rq_label).addClass('required');
352
            }
353
        }
354
        [% END %]
355
    });
445
    });
356
//]]>
446
//]]>
357
</script>
447
</script>
(-)a/opac/opac-suggestions.pl (-4 / +8 lines)
Lines 208-220 if ( C4::Context->preference("AllowPurchaseSuggestionBranchChoice") ) { Link Here
208
    $template->param( branchcode => $branchcode );
208
    $template->param( branchcode => $branchcode );
209
}
209
}
210
210
211
my $mandatoryfields = '';
211
my @mandatoryfields;
212
212
{
213
{
213
    last unless ($op eq 'add');
214
    last unless ($op eq 'add');
214
    my $fldsreq_sp = C4::Context->preference("OPACSuggestionMandatoryFields") || 'title';
215
    my $fldsreq_sp = C4::Context->preference("OPACSuggestionMandatoryFields") || 'title';
215
    $mandatoryfields = join(', ', (map { '"'.$_.'"'; } sort split(/\s*\,\s*/, $fldsreq_sp)));
216
    @mandatoryfields = split( ",", $fldsreq_sp );
217
    foreach (@mandatoryfields) {
218
        $template->param( $_."_required" => 1);
219
    }
216
}
220
}
217
221
222
223
218
$template->param(
224
$template->param(
219
    %$suggestion,
225
    %$suggestion,
220
    suggestions_loop      => $suggestions_loop,
226
    suggestions_loop      => $suggestions_loop,
Lines 224-230 $template->param( Link Here
224
    messages              => \@messages,
230
    messages              => \@messages,
225
    suggestionsview       => 1,
231
    suggestionsview       => 1,
226
    suggested_by_anyone   => $suggested_by_anyone,
232
    suggested_by_anyone   => $suggested_by_anyone,
227
    mandatoryfields       => $mandatoryfields,
228
    patrons_pending_suggestions_count => $patrons_pending_suggestions_count,
233
    patrons_pending_suggestions_count => $patrons_pending_suggestions_count,
229
);
234
);
230
235
231
- 

Return to bug 22657