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

(-)a/Koha/Suggestion.pm (+15 lines)
Lines 170-175 sub manager { Link Here
170
    return Koha::Patron->_new_from_dbic($manager_rs);
170
    return Koha::Patron->_new_from_dbic($manager_rs);
171
}
171
}
172
172
173
=head3 accepter
174
175
my $accepter = $suggestion->accepter;
176
177
Returns the accepter of the suggestion (Koha::Patron for acceptedby field)
178
179
=cut
180
181
sub accepter {
182
    my ($self) = @_;
183
    my $manager_rs = $self->_result->acceptedby;
184
    return unless $manager_rs;
185
    return Koha::Patron->_new_from_dbic($manager_rs);
186
}
187
173
=head3 rejecter
188
=head3 rejecter
174
189
175
my $rejecter = $suggestion->rejecter;
190
my $rejecter = $suggestion->rejecter;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt (-121 / +126 lines)
Lines 13-19 Link Here
13
<title
13
<title
14
    >[% FILTER collapse %]
14
    >[% FILTER collapse %]
15
        [% IF op == 'save' %]
15
        [% IF op == 'save' %]
16
            [% IF ( suggestionid ) %]
16
            [% IF ( suggestion.suggestionid ) %]
17
                [% tx("Edit suggestion #{suggestion_number}", { suggestion_number = suggestionid }) | html %]
17
                [% tx("Edit suggestion #{suggestion_number}", { suggestion_number = suggestionid }) | html %]
18
                &rsaquo;
18
                &rsaquo;
19
            [% ELSE %]
19
            [% ELSE %]
Lines 74-82 Link Here
74
            [% END %]
74
            [% END %]
75
        [% END %]
75
        [% END %]
76
        [% IF op == 'save' %]
76
        [% IF op == 'save' %]
77
            [% IF ( suggestionid ) %]
77
            [% IF ( suggestion.suggestionid ) %]
78
                [% WRAPPER breadcrumb_item bc_active= 1 %]
78
                [% WRAPPER breadcrumb_item bc_active= 1 %]
79
                    <span>Edit suggestion #[% suggestionid | html %]</span>
79
                    <span>Edit suggestion #[% suggestion.suggestionid | html %]</span>
80
                [% END %]
80
                [% END %]
81
            [% ELSE %]
81
            [% ELSE %]
82
                [% WRAPPER breadcrumb_item bc_active= 1 %]
82
                [% WRAPPER breadcrumb_item bc_active= 1 %]
Lines 85-91 Link Here
85
            [% END %]
85
            [% END %]
86
        [% ELSIF ( op == 'show' ) %]
86
        [% ELSIF ( op == 'show' ) %]
87
            [% WRAPPER breadcrumb_item bc_active= 1 %]
87
            [% WRAPPER breadcrumb_item bc_active= 1 %]
88
                <span>Show suggestion #[% suggestionid | html %]</span>
88
                <span>Show suggestion #[% suggestion.suggestionid | html %]</span>
89
            [% END %]
89
            [% END %]
90
        [% ELSE %]
90
        [% ELSE %]
91
            [% WRAPPER breadcrumb_item bc_active= 1 %]
91
            [% WRAPPER breadcrumb_item bc_active= 1 %]
Lines 103-115 Link Here
103
103
104
                <div id="toolbar" class="btn-toolbar">
104
                <div id="toolbar" class="btn-toolbar">
105
                    [% IF CAN_user_suggestions_suggestions_manage %]
105
                    [% IF CAN_user_suggestions_suggestions_manage %]
106
                        <a class="btn btn-default" id="editsuggestion" href="suggestion.pl?op=edit_form&amp;suggestionid=[% suggestionid | html %]"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a>
106
                        <a class="btn btn-default" id="editsuggestion" href="suggestion.pl?op=edit_form&amp;suggestionid=[% suggestion.suggestionid | html %]"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a>
107
                    [% END %]
107
                    [% END %]
108
                    [% IF CAN_user_suggestions_suggestions_delete %]
108
                    [% IF CAN_user_suggestions_suggestions_delete %]
109
                        <form class="delete_form" method="post" action="/cgi-bin/koha/suggestion/suggestion.pl">
109
                        <form class="delete_form" method="post" action="/cgi-bin/koha/suggestion/suggestion.pl">
110
                            [% INCLUDE 'csrf-token.inc' %]
110
                            [% INCLUDE 'csrf-token.inc' %]
111
                            <input type="hidden" name="op" value="cud-delete" />
111
                            <input type="hidden" name="op" value="cud-delete" />
112
                            <input type="hidden" name="suggestionid" value="[% suggestionid | html %]" />
112
                            <input type="hidden" name="suggestionid" value="[% suggestion.suggestionid | html %]" />
113
                            <button type="submit" class="btn btn-default deletesuggestion"><i class="fa fa-trash-can"></i> Delete</button>
113
                            <button type="submit" class="btn btn-default deletesuggestion"><i class="fa fa-trash-can"></i> Delete</button>
114
                        </form>
114
                        </form>
115
                    [% END %]
115
                    [% END %]
Lines 118-195 Link Here
118
                <fieldset class="rows">
118
                <fieldset class="rows">
119
                    <legend>Bibliographic information</legend>
119
                    <legend>Bibliographic information</legend>
120
                    <ol>
120
                    <ol>
121
                        [% IF ( title ) %]
121
                        [% IF ( suggestion.title ) %]
122
                            <li>
122
                            <li>
123
                                <span class="label">Title:</span>
123
                                <span class="label">Title:</span>
124
                                [% IF suggestion.biblionumber %]
124
                                [% IF suggestion.biblionumber %]
125
                                    <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% suggestion.biblionumber | uri %]">[% suggestion.title | html %]</a>
125
                                    <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% suggestion.biblionumber | uri %]">[% suggestion.title | html %]</a>
126
                                [% ELSE %]
126
                                [% ELSE %]
127
                                    [% title | html %]
127
                                    [% suggestion.title | html %]
128
                                [% END %]
128
                                [% END %]
129
                            </li>
129
                            </li>
130
                        [% END %]
130
                        [% END %]
131
                        [% IF ( author ) %]
131
                        [% IF ( suggestion.author ) %]
132
                            <li>
132
                            <li>
133
                                <span class="label">Author:</span>
133
                                <span class="label">Author:</span>
134
                                [% author | html %]
134
                                [% suggestion.author | html %]
135
                            </li>
135
                            </li>
136
                        [% END %]
136
                        [% END %]
137
                        [% IF ( copyrightdate ) %]
137
                        [% IF ( suggestion.copyrightdate ) %]
138
                            <li>
138
                            <li>
139
                                <span class="label">Copyright date:</span>
139
                                <span class="label">Copyright date:</span>
140
                                [% copyrightdate | html %]
140
                                [% suggestion.copyrightdate | html %]
141
                            </li>
141
                            </li>
142
                        [% END %]
142
                        [% END %]
143
                        [% IF ( isbn ) %]
143
                        [% IF ( suggestion.isbn ) %]
144
                            <li>
144
                            <li>
145
                                <span class="label">ISBN or ISSN or other standard number:</span>
145
                                <span class="label">ISBN or ISSN or other standard number:</span>
146
                                [% isbn | html %]
146
                                [% suggestion.isbn | html %]
147
                            </li>
147
                            </li>
148
                        [% END %]
148
                        [% END %]
149
                        [% IF ( publishercode ) %]
149
                        [% IF ( suggestion.publishercode ) %]
150
                            <li>
150
                            <li>
151
                                <span class="label">Publisher:</span>
151
                                <span class="label">Publisher:</span>
152
                                [% publishercode | html %]
152
                                [% suggestion.publishercode | html %]
153
                            </li>
153
                            </li>
154
                        [% END %]
154
                        [% END %]
155
                        [% IF ( place ) %]
155
                        [% IF ( suggestion.place ) %]
156
                            <li>
156
                            <li>
157
                                <span class="label">Publication place:</span>
157
                                <span class="label">Publication place:</span>
158
                                [% place | html %]
158
                                [% suggestion.place | html %]
159
                            </li>
159
                            </li>
160
                        [% END %]
160
                        [% END %]
161
                        [% IF ( collectiontitle ) %]
161
                        [% IF ( suggestion.collectiontitle ) %]
162
                            <li>
162
                            <li>
163
                                <span class="label">Collection title:</span>
163
                                <span class="label">Collection title:</span>
164
                                [% collectiontitle | html %]
164
                                [% suggestion.collectiontitle | html %]
165
                            </li>
165
                            </li>
166
                        [% END %]
166
                        [% END %]
167
                        [% IF ( itemtype ) %]
167
                        [% IF ( suggestion.itemtype ) %]
168
                            <li>
168
                            <li>
169
                                <span class="label">Document type:</span>
169
                                <span class="label">Document type:</span>
170
                                [% AuthorisedValues.GetByCode( 'SUGGEST_FORMAT', itemtype, 0 ) | html %]
170
                                [% AuthorisedValues.GetByCode( 'SUGGEST_FORMAT', suggestion.itemtype, 0 ) | html %]
171
                            </li>
171
                            </li>
172
                        [% END %]
172
                        [% END %]
173
                        [% IF ( patron_reason_loop ) %]
173
                        [% IF ( patron_reason_loop ) %]
174
                            <li>
174
                            <li>
175
                                <span class="label">Reason for suggestion: </span>
175
                                <span class="label">Reason for suggestion: </span>
176
                                [% FOREACH patron_reason_loo IN patron_reason_loop %]
176
                                [% FOREACH patron_reason_loo IN patron_reason_loop %]
177
                                    [% IF patron_reason_loo.authorised_value == patronreason %]
177
                                    [% IF patron_reason_loo.authorised_value == suggestion.patronreason %]
178
                                        [% patron_reason_loo.lib | html %]
178
                                        [% patron_reason_loo.lib | html %]
179
                                    [% END %]
179
                                    [% END %]
180
                                [% END %]
180
                                [% END %]
181
                            </li>
181
                            </li>
182
                        [% END %]
182
                        [% END %]
183
                        [% IF ( note ) %]
183
                        [% IF ( suggestion.note ) %]
184
                            <li>
184
                            <li>
185
                                <span class="label">Notes:</span>
185
                                <span class="label">Notes:</span>
186
                                [% note | html %]
186
                                [% suggestion.note | html %]
187
                            </li>
187
                            </li>
188
                        [% END %]
188
                        [% END %]
189
                        [% IF ( staff_note ) %]
189
                        [% IF ( suggestion.staff_note ) %]
190
                            <li>
190
                            <li>
191
                                <span class="label">Notes:</span>
191
                                <span class="label">Notes:</span>
192
                                [% staff_note | html %]
192
                                [% suggestion.staff_note | html %]
193
                            </li>
193
                            </li>
194
                        [% END %]
194
                        [% END %]
195
                    </ol>
195
                    </ol>
Lines 201-227 Link Here
201
                        <li>
201
                        <li>
202
                            <span class="label">Status:</span>
202
                            <span class="label">Status:</span>
203
                            [% SET status_found = 0 %]
203
                            [% SET status_found = 0 %]
204
                            [% IF ( STATUS == 'ASKED' ) %]
204
                            [% IF ( suggestion.STATUS == 'ASKED' ) %]
205
                                <span>Pending</span>
205
                                <span>Pending</span>
206
                                [% SET status_found = 1 %]
206
                                [% SET status_found = 1 %]
207
                            [% ELSIF ( STATUS == 'ACCEPTED' ) %]
207
                            [% ELSIF ( suggestion.STATUS == 'ACCEPTED' ) %]
208
                                <span>Accepted</span>
208
                                <span>Accepted</span>
209
                                [% SET status_found = 1 %]
209
                                [% SET status_found = 1 %]
210
                            [% ELSIF ( STATUS == 'CHECKED' ) %]
210
                            [% ELSIF ( suggestion.STATUS == 'CHECKED' ) %]
211
                                <span>Checked</span>
211
                                <span>Checked</span>
212
                                [% SET status_found = 1 %]
212
                                [% SET status_found = 1 %]
213
                            [% ELSIF ( STATUS == 'REJECTED' ) %]
213
                            [% ELSIF ( suggestion.STATUS == 'REJECTED' ) %]
214
                                <span>Rejected</span>
214
                                <span>Rejected</span>
215
                                [% SET status_found = 1 %]
215
                                [% SET status_found = 1 %]
216
                            [% ELSIF ( STATUS == 'ORDERED' ) %]
216
                            [% ELSIF ( suggestion.STATUS == 'ORDERED' ) %]
217
                                <span>Ordered</span>
217
                                <span>Ordered</span>
218
                                [% SET status_found = 1 %]
218
                                [% SET status_found = 1 %]
219
                            [% ELSIF ( STATUS == 'AVAILABLE' ) %]
219
                            [% ELSIF ( suggestion.STATUS == 'AVAILABLE' ) %]
220
                                <span>Available</span>
220
                                <span>Available</span>
221
                                [% SET status_found = 1 %]
221
                                [% SET status_found = 1 %]
222
                            [% ELSE %]
222
                            [% ELSE %]
223
                                [% FOREACH s IN SuggestionStatuses %]
223
                                [% FOREACH s IN SuggestionStatuses %]
224
                                    [% IF STATUS == s.authorised_value %]
224
                                    [% IF suggestion.STATUS == s.authorised_value %]
225
                                        [% s.lib | html %]
225
                                        [% s.lib | html %]
226
                                        [% SET status_found = 1 %]
226
                                        [% SET status_found = 1 %]
227
                                    [% END %]
227
                                    [% END %]
Lines 247-295 Link Here
247
                        <tbody>
247
                        <tbody>
248
                            <tr>
248
                            <tr>
249
                                <th>[% tp('purchase suggestion created by', 'Created by:') | html %]</th>
249
                                <th>[% tp('purchase suggestion created by', 'Created by:') | html %]</th>
250
                                <td>[% suggesteddate | $KohaDates %]</td>
250
                                <td>[% suggestion.suggesteddate | $KohaDates %]</td>
251
                                <td>
251
                                <td>
252
                                    [% IF ( suggestedby_patron.borrowernumber ) %]
252
                                    [% IF ( suggestion.suggester.borrowernumber ) %]
253
                                        <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestedby_patron.borrowernumber | uri %]"
253
                                        <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestion.suggester.borrowernumber | uri %]"
254
                                            >[% suggestedby_patron.surname | html %], [% suggestedby_patron.firstname | html %] ([% suggestedby_patron.cardnumber | html %])</a
254
                                            >[% suggestion.suggester.surname | html %], [% suggestion.suggester.firstname | html %] ([% suggestion.suggester.cardnumber | html %])</a
255
                                        >
255
                                        >
256
                                        [% Branches.GetName( suggestedby_patron.branchcode ) | html %] ([% suggestedby_patron.category.description | html %])
256
                                        [% Branches.GetName( suggestion.suggester.branchcode ) | html %] ([% suggestion.suggester.category.description | html %])
257
                                    [% END %]
257
                                    [% END %]
258
                                </td>
258
                                </td>
259
                            </tr>
259
                            </tr>
260
                            <tr>
260
                            <tr>
261
                                <th>Managed by:</th>
261
                                <th>Managed by:</th>
262
                                <td>[% manageddate | $KohaDates %]</td>
262
                                <td>[% suggestion.manageddate | $KohaDates %]</td>
263
                                <td>
263
                                <td>
264
                                    [% IF ( managedby_patron.borrowernumber ) %]
264
                                    [% IF ( suggestion.manager.borrowernumber ) %]
265
                                        <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% managedby_patron.borrowernumber | uri %]"
265
                                        <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestion.manager.borrowernumber | uri %]"
266
                                            >[% managedby_patron.surname | html %], [% managedby_patron.firstname | html %] ([% managedby_patron.cardnumber | html %])</a
266
                                            >[% suggestion.manager.surname | html %], [% suggestion.manager.firstname | html %] ([% suggestion.manager.cardnumber | html %])</a
267
                                        >
267
                                        >
268
                                        [% Branches.GetName( managedby_patron.branchcode ) | html %] ([% managedby_patron.category.description | html %])
268
                                        [% Branches.GetName( suggestion.manager.branchcode ) | html %] ([% suggestion.manager.category.description | html %])
269
                                    [% END %]
269
                                    [% END %]
270
                                </td>
270
                                </td>
271
                            </tr>
271
                            </tr>
272
                            <tr>
272
                            <tr>
273
                                <th>Accepted on:</th>
273
                                <th>Accepted on:</th>
274
                                <td>[% accepteddate | $KohaDates %]</td>
274
                                <td>[% suggestion.accepteddate | $KohaDates %]</td>
275
                                <td>
275
                                <td>
276
                                    [% IF ( acceptedby_patron.borrowernumber ) %]
276
                                    [% IF ( suggestion.accepter.borrowernumber ) %]
277
                                        <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% acceptedby_patron.borrowernumber | uri %]"
277
                                        <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestion.accepter.borrowernumber | uri %]"
278
                                            >[% acceptedby_patron.surname | html %], [% acceptedby_patron.firstname | html %] ([% acceptedby_patron.cardnumber | html %])</a
278
                                            >[% suggestion.accepter.surname | html %], [% suggestion.accepter.firstname | html %] ([% suggestion.accepter.cardnumber | html %])</a
279
                                        >
279
                                        >
280
                                        [% Branches.GetName( acceptedby_patron.branchcode ) | html %] ([% acceptedby_patron.category.description | html %])
280
                                        [% Branches.GetName( suggestion.accepter.branchcode ) | html %] ([% suggestion.accepter.category.description | html %])
281
                                    [% END %]
281
                                    [% END %]
282
                                </td>
282
                                </td>
283
                            </tr>
283
                            </tr>
284
                            <tr>
284
                            <tr>
285
                                <th>Last modification on:</th>
285
                                <th>Last modification on:</th>
286
                                <td>[% lastmodificationdate | $KohaDates %]</td>
286
                                <td>[% suggestion.lastmodificationdate | $KohaDates %]</td>
287
                                <td>
287
                                <td>
288
                                    [% IF ( lastmodificationby_patron.borrowernumber ) %]
288
                                    [% IF ( suggestion.last_modifier.borrowernumber ) %]
289
                                        <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% lastmodificationby_patron.borrowernumber | uri %]"
289
                                        <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestion.last_modifier.borrowernumber | uri %]"
290
                                            >[% lastmodificationby_patron.surname | html %], [% lastmodificationby_patron.firstname | html %] ([% lastmodificationby_patron.cardnumber | html %])</a
290
                                            >[% suggestion.last_modifier.surname | html %], [% suggestion.last_modifier.firstname | html %] ([% suggestion.last_modifier.cardnumber | html %])</a
291
                                        >
291
                                        >
292
                                        [% Branches.GetName( lastmodificationby_patron.branchcode ) | html %] ([% lastmodificationby_patron.category.description | html %])
292
                                        [% Branches.GetName( suggestion.last_modifier.branchcode ) | html %] ([% suggestion.last_modifier.category.description | html %])
293
                                    [% END %]
293
                                    [% END %]
294
                                </td>
294
                                </td>
295
                            </tr>
295
                            </tr>
Lines 302-328 Link Here
302
                    <ol>
302
                    <ol>
303
                        <li>
303
                        <li>
304
                            <span class="label">Library:</span>
304
                            <span class="label">Library:</span>
305
                            [% Branches.GetName( branchcode ) | html %]
305
                            [% Branches.GetName( suggestion.branchcode ) | html %]
306
                        </li>
306
                        </li>
307
                        <li>
307
                        <li>
308
                            <span class="label">Fund:</span>
308
                            <span class="label">Fund:</span>
309
                            [% budgetname | html %]
309
                            [% suggestion.fund.budget_name | html %]
310
                        </li>
310
                        </li>
311
                        <li>
311
                        <li>
312
                            <span class="label">Copies:</span>
312
                            <span class="label">Copies:</span>
313
                            [% quantity | html %]
313
                            [% suggestion.quantity | html %]
314
                        </li>
314
                        </li>
315
                        <li>
315
                        <li>
316
                            <span class="label">Currency:</span>
316
                            <span class="label">Currency:</span>
317
                            [% currency | html %]
317
                            [% suggestion.currency | html %]
318
                        </li>
318
                        </li>
319
                        <li>
319
                        <li>
320
                            <span class="label">Price:</span>
320
                            <span class="label">Price:</span>
321
                            [% price | $Price %]
321
                            [% suggestion.price | $Price %]
322
                        </li>
322
                        </li>
323
                        <li>
323
                        <li>
324
                            <span class="label">Total</span>
324
                            <span class="label">Total</span>
325
                            [% total | $Price %]
325
                            [% suggestion.total | $Price %]
326
                        </li>
326
                        </li>
327
                    </ol>
327
                    </ol>
328
                </fieldset>
328
                </fieldset>
Lines 373-381 Link Here
373
                        [% INCLUDE 'csrf-token.inc' %]
373
                        [% INCLUDE 'csrf-token.inc' %]
374
                        <input type="hidden" name="redirect" id="redirect" value="[% redirect | html %]" />
374
                        <input type="hidden" name="redirect" id="redirect" value="[% redirect | html %]" />
375
                        <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrowernumber | html %]" />
375
                        <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrowernumber | html %]" />
376
                        [% IF ( suggestionid ) %]
376
                        [% IF ( suggestion.suggestionid ) %]
377
                            <h1>Edit purchase suggestion #[% suggestionid | html %]</h1>
377
                            <h1>Edit purchase suggestion #[% suggestion.suggestionid | html %]</h1>
378
                            <input type="hidden" name="suggestionid" value="[% suggestionid | html %]" />
378
                            <input type="hidden" name="suggestionid" value="[% suggestion.suggestionid | html %]" />
379
                        [% ELSE %]
379
                        [% ELSE %]
380
                            <h1>Enter a new purchase suggestion</h1>
380
                            <h1>Enter a new purchase suggestion</h1>
381
                        [% END %]
381
                        [% END %]
Lines 385-420 Link Here
385
                            <ol>
385
                            <ol>
386
                                <li>
386
                                <li>
387
                                    <label for="title" class="required">Title:</label>
387
                                    <label for="title" class="required">Title:</label>
388
                                    <input type="text" id="title" name="title" size="80" maxlength="255" value="[% title | html %]" required="required" class="required" />
388
                                    <input type="text" id="title" name="title" size="80" maxlength="255" value="[% suggestion.title | html %]" required="required" class="required" />
389
                                    <span class="required">Required</span>
389
                                    <span class="required">Required</span>
390
                                </li>
390
                                </li>
391
                                <li>
391
                                <li>
392
                                    <label for="author">Author:</label>
392
                                    <label for="author">Author:</label>
393
                                    <input type="text" id="author" name="author" size="50" maxlength="80" value="[% author | html %]" />
393
                                    <input type="text" id="author" name="author" size="50" maxlength="80" value="[% suggestion.author | html %]" />
394
                                </li>
394
                                </li>
395
                                <li>
395
                                <li>
396
                                    <label for="copyrightdate">Copyright date:</label>
396
                                    <label for="copyrightdate">Copyright date:</label>
397
                                    <input type="text" id="copyrightdate" name="copyrightdate" size="4" maxlength="4" value="[% copyrightdate | html %]" />
397
                                    <input type="text" id="copyrightdate" name="copyrightdate" size="4" maxlength="4" value="[% suggestion.copyrightdate | html %]" />
398
                                </li>
398
                                </li>
399
                                <li>
399
                                <li>
400
                                    <label for="isbn">ISBN or ISSN or other standard number:</label>
400
                                    <label for="isbn">ISBN or ISSN or other standard number:</label>
401
                                    <input type="text" id="isbn" name="isbn" size="50" maxlength="80" value="[% isbn | html %]" />
401
                                    <input type="text" id="isbn" name="isbn" size="50" maxlength="80" value="[% suggestion.isbn | html %]" />
402
                                </li>
402
                                </li>
403
                                <li>
403
                                <li>
404
                                    <label for="publishercode">Publisher:</label>
404
                                    <label for="publishercode">Publisher:</label>
405
                                    <input type="text" id="publishercode" name="publishercode" size="50" maxlength="80" value="[% publishercode | html %]" />
405
                                    <input type="text" id="publishercode" name="publishercode" size="50" maxlength="80" value="[% suggestion.publishercode | html %]" />
406
                                </li>
406
                                </li>
407
                                <li>
407
                                <li>
408
                                    <label for="place">Publication place:</label>
408
                                    <label for="place">Publication place:</label>
409
                                    <input type="text" id="place" name="place" size="50" maxlength="80" value="[% place | html %]" />
409
                                    <input type="text" id="place" name="place" size="50" maxlength="80" value="[% suggestion.place | html %]" />
410
                                </li>
410
                                </li>
411
                                <li>
411
                                <li>
412
                                    <label for="collectiontitle">Collection title:</label>
412
                                    <label for="collectiontitle">Collection title:</label>
413
                                    <input type="text" id="collectiontitle" name="collectiontitle" size="50" maxlength="80" value="[% collectiontitle | html %]" />
413
                                    <input type="text" id="collectiontitle" name="collectiontitle" size="50" maxlength="80" value="[% suggestion.collectiontitle | html %]" />
414
                                </li>
414
                                </li>
415
                                <li>
415
                                <li>
416
                                    <label for="itemtype">Document type:</label>
416
                                    <label for="itemtype">Document type:</label>
417
                                    [% PROCESS 'av-build-dropbox.inc' name="itemtype", category="SUGGEST_FORMAT", size=20, default=itemtype, empty=1 %]
417
                                    [% PROCESS 'av-build-dropbox.inc' name="itemtype", category="SUGGEST_FORMAT", size=20, default=suggestion.itemtype, empty=1 %]
418
                                </li>
418
                                </li>
419
                                [% IF patron_reason_loop %]
419
                                [% IF patron_reason_loop %]
420
                                    <li>
420
                                    <li>
Lines 422-428 Link Here
422
                                        <select name="patronreason" id="patronreason">
422
                                        <select name="patronreason" id="patronreason">
423
                                            <option value=""> -- Choose -- </option>
423
                                            <option value=""> -- Choose -- </option>
424
                                            [% FOREACH patron_reason_loo IN patron_reason_loop %]
424
                                            [% FOREACH patron_reason_loo IN patron_reason_loop %]
425
                                                [% IF patron_reason_loo.authorised_value == patronreason %]
425
                                                [% IF patron_reason_loo.authorised_value == suggestion.patronreason %]
426
                                                    <option value="[% patron_reason_loo.authorised_value | html %]" selected="selected">[% patron_reason_loo.lib | html %]</option>
426
                                                    <option value="[% patron_reason_loo.authorised_value | html %]" selected="selected">[% patron_reason_loo.lib | html %]</option>
427
                                                [% ELSE %]
427
                                                [% ELSE %]
428
                                                    <option value="[% patron_reason_loo.authorised_value | html %]">[% patron_reason_loo.lib | html %]</option>
428
                                                    <option value="[% patron_reason_loo.authorised_value | html %]">[% patron_reason_loo.lib | html %]</option>
Lines 433-443 Link Here
433
                                [% END # /IF patron_reason_loop %]
433
                                [% END # /IF patron_reason_loop %]
434
                                <li>
434
                                <li>
435
                                    <label for="note">Notes:</label>
435
                                    <label for="note">Notes:</label>
436
                                    <textarea name="note" id="note" rows="5" cols="40">[% note | html %]</textarea>
436
                                    <textarea name="note" id="note" rows="5" cols="40">[% suggestion.note | html %]</textarea>
437
                                </li>
437
                                </li>
438
                                <li>
438
                                <li>
439
                                    <label for="note">Non-public notes:</label>
439
                                    <label for="note">Non-public notes:</label>
440
                                    <textarea name="staff_note" id="staff_note" rows="5" cols="40">[% staff_note | html %]</textarea>
440
                                    <textarea name="staff_note" id="staff_note" rows="5" cols="40">[% suggestion.staff_note | html %]</textarea>
441
                                </li>
441
                                </li>
442
                            </ol>
442
                            </ol>
443
                        </fieldset>
443
                        </fieldset>
Lines 445-451 Link Here
445
                        <fieldset class="rows">
445
                        <fieldset class="rows">
446
                            <legend>Suggestion management</legend>
446
                            <legend>Suggestion management</legend>
447
                            <ol>
447
                            <ol>
448
                                [% IF ( suggestionid ) %]
448
                                [% IF ( suggestion.suggestionid ) %]
449
                                    <li>
449
                                    <li>
450
                                        <label for="STATUS">Status:</label>
450
                                        <label for="STATUS">Status:</label>
451
                                        <select id="STATUS" name="STATUS">
451
                                        <select id="STATUS" name="STATUS">
Lines 500-506 Link Here
500
                                        <label for="reason">Reason:</label>
500
                                        <label for="reason">Reason:</label>
501
                                        <select class="select-reason" id="reason" name="reason">
501
                                        <select class="select-reason" id="reason" name="reason">
502
                                            <option value=""> -- Choose a reason -- </option>
502
                                            <option value=""> -- Choose a reason -- </option>
503
                                            [% FOREACH reasonsloo IN suggestion.reasonsloop %]
503
                                            [% FOREACH reasonsloo IN reasonsloop %]
504
                                                [% IF (reasonsloo.lib == suggestion.reason) %]
504
                                                [% IF (reasonsloo.lib == suggestion.reason) %]
505
                                                    <option value="[% reasonsloo.lib | html %]" selected="selected">[% reasonsloo.lib | html %]</option>
505
                                                    <option value="[% reasonsloo.lib | html %]" selected="selected">[% reasonsloo.lib | html %]</option>
506
                                                [% ELSE %]
506
                                                [% ELSE %]
Lines 535-548 Link Here
535
                                                <th>
535
                                                <th>
536
                                                    <label for="suggesteddate">[% tp('purchase suggestion created by', 'Created by:') | html %]</label>
536
                                                    <label for="suggesteddate">[% tp('purchase suggestion created by', 'Created by:') | html %]</label>
537
                                                </th>
537
                                                </th>
538
                                                <td> <input type="text" id="suggesteddate" name="suggesteddate" class="flatpickr" size="10" maxlength="10" value="[% suggesteddate | html %]" /> [% INCLUDE 'date-format.inc' %] </td>
538
                                                <td> <input type="text" id="suggesteddate" name="suggesteddate" class="flatpickr" size="10" maxlength="10" value="[% default_suggesteddate ? default_suggesteddate : suggestion.suggesteddate | html %]" /> [% INCLUDE 'date-format.inc' %] </td>
539
                                                <td id="tdsuggestedby">
539
                                                <td id="tdsuggestedby">
540
                                                    <input type="hidden" id="suggestedby" name="suggestedby" value="[% suggestedby | html %]" />
540
                                                    <input type="hidden" id="suggestedby" name="suggestedby" value="[% suggestion.suggestedby | html %]" />
541
                                                    [% IF ( suggestedby_patron.borrowernumber ) %]
541
                                                    [% IF ( suggestion.suggester.borrowernumber ) %]
542
                                                        <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestedby_patron.borrowernumber | uri %]"
542
                                                        <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestion.suggester.borrowernumber | uri %]"
543
                                                            >[% suggestedby_patron.surname | html %], [% suggestedby_patron.firstname | html %] ([% suggestedby_patron.cardnumber | html %])</a
543
                                                            >[% suggestion.suggester.surname | html %], [% suggestion.suggester.firstname | html %] ([% suggestion.suggester.cardnumber | html %])</a
544
                                                        >
544
                                                        >
545
                                                        [% Branches.GetName( suggestedby_patron.branchcode ) | html %] ([% suggestedby_patron.category.description | html %])
545
                                                        [% Branches.GetName( suggestion.suggester.branchcode ) | html %] ([% suggestion.suggester.category.description | html %])
546
                                                    [% ELSIF ( default_suggester ) %]
547
                                                        <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% default_suggester.borrowernumber | uri %]"
548
                                                            >[% default_suggester.surname | html %], [% default_suggester.firstname | html %] ([% default_suggester.cardnumber | html %])</a
549
                                                        >
550
                                                        [% Branches.GetName( default_suggester.branchcode ) | html %] ([% default_suggester.category.description | html %])
546
                                                    [% END %]
551
                                                    [% END %]
547
                                                </td>
552
                                                </td>
548
                                                <td>
553
                                                <td>
Lines 553-566 Link Here
553
                                                <th>
558
                                                <th>
554
                                                    <label for="accepteddate">Accepted on:</label>
559
                                                    <label for="accepteddate">Accepted on:</label>
555
                                                </th>
560
                                                </th>
556
                                                <td> <input type="text" id="accepteddate" name="accepteddate" class="flatpickr" size="10" maxlength="10" value="[% accepteddate | html %]" />[% INCLUDE 'date-format.inc' %] </td>
561
                                                <td> <input type="text" id="accepteddate" name="accepteddate" class="flatpickr" size="10" maxlength="10" value="[% suggestion.accepteddate | html %]" />[% INCLUDE 'date-format.inc' %] </td>
557
                                                <td>
562
                                                <td>
558
                                                    <input type="hidden" id="acceptedby" name="acceptedby" value="[% acceptedby | html %]" />
563
                                                    <input type="hidden" id="acceptedby" name="acceptedby" value="[% suggestion.acceptedby | html %]" />
559
                                                    [% IF ( acceptedby_patron.borrowernumber ) %]
564
                                                    [% IF ( suggestion.accepter.borrowernumber ) %]
560
                                                        <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% acceptedby_patron.borrowernumber | uri %]"
565
                                                        <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestion.accepter.borrowernumber | uri %]"
561
                                                            >[% acceptedby_patron.surname | html %], [% acceptedby_patron.firstname | html %] ([% acceptedby_patron.cardnumber | html %])</a
566
                                                            >[% suggestion.accepter.surname | html %], [% suggestion.accepter.firstname | html %] ([% suggestion.accepter.cardnumber | html %])</a
562
                                                        >
567
                                                        >
563
                                                        [% Branches.GetName( acceptedby_patron.branchcode ) | html %] ([% acceptedby_patron.category.description | html %])
568
                                                        [% Branches.GetName( suggestion.accepter.branchcode ) | html %] ([% suggestion.accepter.category.description | html %])
564
                                                    [% END %]
569
                                                    [% END %]
565
                                                </td>
570
                                                </td>
566
                                                <td></td>
571
                                                <td></td>
Lines 569-580 Link Here
569
                                                <th>
574
                                                <th>
570
                                                    <label for="lastmodificationdate">Last modification on:</label>
575
                                                    <label for="lastmodificationdate">Last modification on:</label>
571
                                                </th>
576
                                                </th>
572
                                                <td> [% lastmodificationdate | $KohaDates %] </td>
577
                                                <td> [% suggestion.lastmodificationdate | $KohaDates %] </td>
573
                                                <td>
578
                                                <td>
574
                                                    [% IF lastmodificationby_patron %]
579
                                                    [% IF suggestion.last_modifier %]
575
                                                        [% INCLUDE 'patron-title.inc' patron=lastmodificationby_patron hide_patron_infos_if_needed=1 %]
580
                                                        [% INCLUDE 'patron-title.inc' patron=suggestion.last_modifier hide_patron_infos_if_needed=1 %]
576
                                                        [% Branches.GetName( lastmodificationby_patron.branchcode ) | html %]
581
                                                        [% Branches.GetName( suggestion.last_modifier.branchcode ) | html %]
577
                                                        ([% lastmodificationby_patron.category.description | html %])
582
                                                        ([% suggestion.last_modifier.category.description | html %])
578
                                                    [% END %]
583
                                                    [% END %]
579
                                                </td>
584
                                                </td>
580
                                                <td></td>
585
                                                <td></td>
Lines 584-590 Link Here
584
                                </li>
589
                                </li>
585
                                <li>
590
                                <li>
586
                                    <label for="managedon">Managed on:</label>
591
                                    <label for="managedon">Managed on:</label>
587
                                    <input type="text" id="managedon" name="manageddate" class="flatpickr" size="10" maxlength="10" value="[% manageddate | html %]" />[% INCLUDE 'date-format.inc' %]
592
                                    <input type="text" id="managedon" name="manageddate" class="flatpickr" size="10" maxlength="10" value="[% default_manageddate | html %]" />[% INCLUDE 'date-format.inc' %]
588
                                </li>
593
                                </li>
589
                                <li>
594
                                <li>
590
                                    <label for="managedby_name">by:</label>
595
                                    <label for="managedby_name">by:</label>
Lines 596-608 Link Here
596
                                                Nobody
601
                                                Nobody
597
                                            [% END %]
602
                                            [% END %]
598
                                        </span>
603
                                        </span>
599
                                        [% IF managedby_patron.borrowernumber && logged_in_user.borrowernumber != managedby_patron.borrowernumber %]
604
                                        [% IF suggestion.manager.borrowernumber && logged_in_user.borrowernumber != suggestion.manager.borrowernumber %]
600
                                            | Previously was [% INCLUDE 'patron-title.inc' patron=managedby_patron hide_patron_infos_if_needed=1 %] [% Branches.GetName( managedby_patron.branchcode ) | html %]
605
                                            | Previously was [% INCLUDE 'patron-title.inc' patron=suggestion.manager hide_patron_infos_if_needed=1 %] [% Branches.GetName( suggestion.manager.branchcode ) | html %]
601
                                            ([% managedby_patron.category.description | html %])
606
                                            ([% suggestion.manager.category.description | html %])
602
                                        [% END %]
607
                                        [% END %]
603
                                        <br />
608
                                        <br />
604
                                        <a href="#patron_search_modal_manager" id="edit_manager" data-bs-toggle="modal"><i class="fa fa-search"></i> Select manager</a>
609
                                        <a href="#patron_search_modal_manager" id="edit_manager" data-bs-toggle="modal"><i class="fa fa-search"></i> Select manager</a>
605
                                        [% IF managedby_patron.borrowernumber && logged_in_user.borrowernumber != managedby_patron.borrowernumber %]
610
                                        [% IF suggestion.manager.borrowernumber && logged_in_user.borrowernumber != suggestion.manager.borrowernumber %]
606
                                            <a id="restore_previous_manager" href="#"><i class="fa fa-trash-can"></i> Keep existing manager</a>
611
                                            <a id="restore_previous_manager" href="#"><i class="fa fa-trash-can"></i> Keep existing manager</a>
607
                                        [% END %]
612
                                        [% END %]
608
                                        [% IF CAN_user_suggestions_suggestions_manage %]
613
                                        [% IF CAN_user_suggestions_suggestions_manage %]
Lines 632-644 Link Here
632
                                    <label for="branchcode">Library:</label>
637
                                    <label for="branchcode">Library:</label>
633
                                    <select name="branchcode" id="branchcode">
638
                                    <select name="branchcode" id="branchcode">
634
                                        <option value="">Any</option>
639
                                        <option value="">Any</option>
635
                                        [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
640
                                        [% PROCESS options_for_libraries libraries => Branches.all( selected => suggestion.branchcode ) %]
636
                                    </select>
641
                                    </select>
637
                                </li>
642
                                </li>
638
                                <li> [% PROCESS funds_dropdown %] </li>
643
                                <li> [% PROCESS funds_dropdown %] </li>
639
                                <li>
644
                                <li>
640
                                    <label for="quantity">Copies:</label>
645
                                    <label for="quantity">Copies:</label>
641
                                    <input type="text" size="10" id="quantity" name="quantity" value="[% quantity | html %]" />
646
                                    <input type="text" size="10" id="quantity" name="quantity" value="[% suggestion.quantity | html %]" />
642
                                </li>
647
                                </li>
643
                                <li>
648
                                <li>
644
                                    <label for="currency">Currency:</label>
649
                                    <label for="currency">Currency:</label>
Lines 648-654 Link Here
648
                                    [% END %]
653
                                    [% END %]
649
                                    <select name="currency" id="currency">
654
                                    <select name="currency" id="currency">
650
                                        [% FOREACH c IN currencies %]
655
                                        [% FOREACH c IN currencies %]
651
                                            [% IF suggestionid and suggestion.currency == c.currency or not suggestionid and c.active %]
656
                                            [% IF suggestion.suggestionid and suggestion.currency == c.currency or not suggestion.suggestionid and c.active %]
652
                                                <option value="[% c.currency | html %]" selected="selected">[% c.currency | html %]</option>
657
                                                <option value="[% c.currency | html %]" selected="selected">[% c.currency | html %]</option>
653
                                            [% ELSIF not c.archived %]
658
                                            [% ELSIF not c.archived %]
654
                                                <option value="[% c.currency | html %]">[% c.currency | html %]</option>
659
                                                <option value="[% c.currency | html %]">[% c.currency | html %]</option>
Lines 658-668 Link Here
658
                                </li>
663
                                </li>
659
                                <li>
664
                                <li>
660
                                    <label for="price">Price:</label>
665
                                    <label for="price">Price:</label>
661
                                    <input class="decimal" type="text" size="20" name="price" id="price" value="[% price | $Price on_editing => 1 %]" />
666
                                    <input class="decimal" type="text" size="20" name="price" id="price" value="[% suggestion.price | $Price on_editing => 1 %]" />
662
                                </li>
667
                                </li>
663
                                <li>
668
                                <li>
664
                                    <label for="total">Total: </label>
669
                                    <label for="total">Total: </label>
665
                                    <input type="text" readonly="readonly" id="total" name="total" size="10" value="[% total | html %]" />
670
                                    <input type="text" readonly="readonly" id="total" name="total" size="10" value="[% suggestion.total | html %]" />
666
                                </li>
671
                                </li>
667
                            </ol>
672
                            </ol>
668
                        </fieldset>
673
                        </fieldset>
Lines 670-676 Link Here
670
675
671
                        <fieldset class="action">
676
                        <fieldset class="action">
672
                            <input type="hidden" id="returnsuggested" name="returnsuggested" value="[% IF ( returnsuggestedby ) %][% returnsuggestedby | html %][% ELSE %]no_one[% END %]" />
677
                            <input type="hidden" id="returnsuggested" name="returnsuggested" value="[% IF ( returnsuggestedby ) %][% returnsuggestedby | html %][% ELSE %]no_one[% END %]" />
673
                            [% IF ( suggestionid ) %]
678
                            [% IF ( suggestion.suggestionid ) %]
674
                                <input type="hidden" name="op" value="cud-save" />
679
                                <input type="hidden" name="op" value="cud-save" />
675
                                [% IF ( need_confirm ) %]
680
                                [% IF ( need_confirm ) %]
676
                                    <input type="hidden" name="save_confirmed" value="1" />
681
                                    <input type="hidden" name="save_confirmed" value="1" />
Lines 698-704 Link Here
698
                [% IF op == 'else' %]
703
                [% IF op == 'else' %]
699
                    <div id="toolbar" class="btn-toolbar">
704
                    <div id="toolbar" class="btn-toolbar">
700
                        [% IF CAN_user_suggestions_suggestions_create %]
705
                        [% IF CAN_user_suggestions_suggestions_create %]
701
                            <a class="btn btn-default" id="newsuggestion" href="suggestion.pl?op=add_form&branchcode=[% branchcode | uri %]"><i class="fa fa-plus"></i> New purchase suggestion</a>
706
                            <a class="btn btn-default" id="newsuggestion" href="suggestion.pl?op=add_form&branchcode=[% suggestion.branchcode | uri %]"><i class="fa fa-plus"></i> New purchase suggestion</a>
702
                        [% END %]
707
                        [% END %]
703
                    </div>
708
                    </div>
704
709
Lines 862-868 Link Here
862
                                                                <label for="choosereason-[% suggestion.suggestiontype | html %]">with this reason:</label>
867
                                                                <label for="choosereason-[% suggestion.suggestiontype | html %]">with this reason:</label>
863
                                                                <select name="reason" id="choosereason-[% suggestion.suggestiontype | html %]">
868
                                                                <select name="reason" id="choosereason-[% suggestion.suggestiontype | html %]">
864
                                                                    <option value=""> -- Choose a reason -- </option>
869
                                                                    <option value=""> -- Choose a reason -- </option>
865
                                                                    [% FOREACH reasonsloo IN suggestion.reasonsloop %]
870
                                                                    [% FOREACH reasonsloo IN reasonsloop %]
866
                                                                        <option value="[% reasonsloo.lib | html %]">[% reasonsloo.lib | html %]</option>
871
                                                                        <option value="[% reasonsloo.lib | html %]">[% reasonsloo.lib | html %]</option>
867
                                                                    [% END %]
872
                                                                    [% END %]
868
                                                                    <option value="other">Others...</option>
873
                                                                    <option value="other">Others...</option>
Lines 972-978 Link Here
972
                                        <li>
977
                                        <li>
973
                                            <label for="displayby" class="sr-only">Organize by: </label>
978
                                            <label for="displayby" class="sr-only">Organize by: </label>
974
                                            <select name="displayby" id="displayby">
979
                                            <select name="displayby" id="displayby">
975
                                                [% IF ( displayby == "STATUS" ) %]
980
                                                [% IF ( displayby == "suggestion.STATUS" ) %]
976
                                                    <option value="STATUS" selected="selected">Status</option>
981
                                                    <option value="STATUS" selected="selected">Status</option>
977
                                                [% ELSE %]
982
                                                [% ELSE %]
978
                                                    <option value="STATUS">Status</option>
983
                                                    <option value="STATUS">Status</option>
Lines 1015-1041 Link Here
1015
                                            <ol>
1020
                                            <ol>
1016
                                                <li>
1021
                                                <li>
1017
                                                    <label for="title"> Title:</label>
1022
                                                    <label for="title"> Title:</label>
1018
                                                    <input type="text" id="title" name="title" value="[% title | html %]" />
1023
                                                    <input type="text" id="title" name="title" value="[% suggestion.title | html %]" />
1019
                                                </li>
1024
                                                </li>
1020
                                                <li>
1025
                                                <li>
1021
                                                    <label for="author"> Author:</label>
1026
                                                    <label for="author"> Author:</label>
1022
                                                    <input type="text" id="author" name="author" value="[% author | html %]" />
1027
                                                    <input type="text" id="author" name="author" value="[% suggestion.author | html %]" />
1023
                                                </li>
1028
                                                </li>
1024
                                                <li>
1029
                                                <li>
1025
                                                    <label for="isbn"> ISBN:</label>
1030
                                                    <label for="isbn"> ISBN:</label>
1026
                                                    <input type="text" id="isbn" name="isbn" value="[% isbn | html %]" />
1031
                                                    <input type="text" id="isbn" name="isbn" value="[% suggestion.isbn | html %]" />
1027
                                                </li>
1032
                                                </li>
1028
                                                <li>
1033
                                                <li>
1029
                                                    <label for="publishercode"> Publisher:</label>
1034
                                                    <label for="publishercode"> Publisher:</label>
1030
                                                    <input type="text" id="publishercode" name="publishercode" value="[% publishercode | html %]" />
1035
                                                    <input type="text" id="publishercode" name="publishercode" value="[% suggestion.publishercode | html %]" />
1031
                                                </li>
1036
                                                </li>
1032
                                                <li>
1037
                                                <li>
1033
                                                    <label for="copyrightdate_filter"> Copyright date:</label>
1038
                                                    <label for="copyrightdate_filter"> Copyright date:</label>
1034
                                                    <input type="text" id="copyrightdate_filter" name="copyrightdate" value="[% copyrightdate | html %]" />
1039
                                                    <input type="text" id="copyrightdate_filter" name="copyrightdate" value="[% suggestion.copyrightdate | html %]" />
1035
                                                </li>
1040
                                                </li>
1036
                                                <li>
1041
                                                <li>
1037
                                                    <label for="collectiontitle"> Collection title:</label>
1042
                                                    <label for="collectiontitle"> Collection title:</label>
1038
                                                    <input type="text" id="collectiontitle" name="collectiontitle" value="[% collectiontitle | html %]" />
1043
                                                    <input type="text" id="collectiontitle" name="collectiontitle" value="[% suggestion.collectiontitle | html %]" />
1039
                                                </li>
1044
                                                </li>
1040
                                            </ol>
1045
                                            </ol>
1041
                                        </fieldset>
1046
                                        </fieldset>
Lines 1106-1116 Link Here
1106
                                                </li>
1111
                                                </li>
1107
                                                <li>
1112
                                                <li>
1108
                                                    <label for="suggesteddate_from">Suggested date from:</label>
1113
                                                    <label for="suggesteddate_from">Suggested date from:</label>
1109
                                                    <input type="text" id="suggesteddate_from" size="10" name="suggesteddate_from" value="[% suggesteddate_from | html %]" data-date_to="suggesteddate_to" class="flatpickr" />
1114
                                                    <input type="text" id="suggesteddate_from" size="10" name="suggesteddate_from" value="[% suggestion.suggesteddate_from | html %]" data-date_to="suggesteddate_to" class="flatpickr" />
1110
                                                </li>
1115
                                                </li>
1111
                                                <li>
1116
                                                <li>
1112
                                                    <label for="suggesteddate_to">To:</label>
1117
                                                    <label for="suggesteddate_to">To:</label>
1113
                                                    <input type="text" id="suggesteddate_to" size="10" name="suggesteddate_to" value="[% suggesteddate_to | html %]" class="flatpickr" />
1118
                                                    <input type="text" id="suggesteddate_to" size="10" name="suggesteddate_to" value="[% suggestion.suggesteddate_to | html %]" class="flatpickr" />
1114
                                                </li>
1119
                                                </li>
1115
                                                <li>
1120
                                                <li>
1116
                                                    <label for="managedby"> Managed by:</label>
1121
                                                    <label for="managedby"> Managed by:</label>
Lines 1213-1219 Link Here
1213
        [% UNLESS op == 'save' %]
1218
        [% UNLESS op == 'save' %]
1214
            <option value="">Any</option>
1219
            <option value="">Any</option>
1215
        [% END %]
1220
        [% END %]
1216
        [% IF budgetid == '__NONE__' %]
1221
        [% IF suggestion.budgetid == '__NONE__' %]
1217
            <option value="__NONE__" selected="selected">None</option>
1222
            <option value="__NONE__" selected="selected">None</option>
1218
        [% ELSE %]
1223
        [% ELSE %]
1219
            <option value="__NONE__">None</option>
1224
            <option value="__NONE__">None</option>
Lines 1259-1266 Link Here
1259
            [% IF op == "save" %]
1264
            [% IF op == "save" %]
1260
                var notify = $('#notify');
1265
                var notify = $('#notify');
1261
                if ( notify.length ) {
1266
                if ( notify.length ) {
1262
                    [% IF managedby_patron %]
1267
                    [% IF suggestion.manager %]
1263
                        if ( borrowernumber == [% logged_in_user.borrowernumber | html %] || borrowernumber == [% managedby_patron.borrowernumber | html %] ) {
1268
                        if ( borrowernumber == [% logged_in_user.borrowernumber | html %] || borrowernumber == [% suggestion.manager.borrowernumber | html %] ) {
1264
                    [% ELSE %]
1269
                    [% ELSE %]
1265
                        if ( borrowernumber == [% logged_in_user.borrowernumber | html %] ) {
1270
                        if ( borrowernumber == [% logged_in_user.borrowernumber | html %] ) {
1266
                    [% END %]
1271
                    [% END %]
Lines 1666-1677 Link Here
1666
1671
1667
                    $("#managedby_name").empty();
1672
                    $("#managedby_name").empty();
1668
                    $("#managedby").val('');
1673
                    $("#managedby").val('');
1669
                    var borrowername = "[% managedby_patron.firstname | html %] [% managedby_patron.surname | html %]";
1674
                    var borrowername = "[% suggestion.manager.firstname | html %] [% suggestion.manager.surname | html %]";
1670
                    var managerlink = '<a href="/cgi-bin/koha/members/moremember.pl'
1675
                    var managerlink = '<a href="/cgi-bin/koha/members/moremember.pl'
1671
                        + '?borrowernumber=[% managedby_patron.borrowernumber | html %]">'
1676
                        + '?borrowernumber=[% suggestion.manager.borrowernumber | html %]">'
1672
                        + borrowername + '</a>';
1677
                        + borrowername + '</a>';
1673
                    $('#managedby_name').html(managerlink);
1678
                    $('#managedby_name').html(managerlink);
1674
                    $('#managedby').val([% managedby_patron.borrowernumber | html %]);
1679
                    $('#managedby').val([% suggestion.manager.borrowernumber | html %]);
1675
                    $('#notify').prop('checked', false).prop('disabled', true);
1680
                    $('#notify').prop('checked', false).prop('disabled', true);
1676
                });
1681
                });
1677
1682
(-)a/suggestion/suggestion.pl (-52 / +19 lines)
Lines 37-60 use Koha::Token; Link Here
37
37
38
use URI::Escape qw( uri_escape );
38
use URI::Escape qw( uri_escape );
39
39
40
sub Init {
41
    my $suggestion = shift @_;
42
43
    # "Managed by" is used only when a suggestion is being edited (not when created)
44
    if ( $suggestion->{'suggesteddate'} eq "" ) {
45
46
        # new suggestion
47
        $suggestion->{suggesteddate} = dt_from_string;
48
        $suggestion->{'suggestedby'} = C4::Context->userenv->{"number"} unless ( $suggestion->{'suggestedby'} );
49
    } else {
50
51
        # editing of an existing suggestion
52
        $suggestion->{manageddate} = dt_from_string;
53
        $suggestion->{'managedby'} = C4::Context->userenv->{"number"} unless ( $suggestion->{'managedby'} );
54
    }
55
    $suggestion->{'branchcode'} = C4::Context->userenv->{"branch"} unless ( $suggestion->{'branchcode'} );
56
}
57
58
sub GetCriteriumDesc {
40
sub GetCriteriumDesc {
59
    my ( $criteriumvalue, $displayby ) = @_;
41
    my ( $criteriumvalue, $displayby ) = @_;
60
    if ( $displayby =~ /status/i ) {
42
    if ( $displayby =~ /status/i ) {
Lines 106-111 my $sugg_managedby = $input->param('suggestion_managedby'); Link Here
106
my $reasonsloop = GetAuthorisedValues("SUGGEST");
88
my $reasonsloop = GetAuthorisedValues("SUGGEST");
107
89
108
my $suggestion_ref = { $input->Vars };
90
my $suggestion_ref = { $input->Vars };
91
my $stored_suggestion;
92
$stored_suggestion = Koha::Suggestions->find( $input->param('suggestionid') ) if $input->param('suggestionid');
93
109
delete $suggestion_ref->{$_} for qw(csrf_token suggestion_itemtype suggestion_managedby table_1_length);
94
delete $suggestion_ref->{$_} for qw(csrf_token suggestion_itemtype suggestion_managedby table_1_length);
110
95
111
# get only the columns of Suggestion
96
# get only the columns of Suggestion
Lines 114-127 my $columns = ' ' . join( ' ', $schema->source('Suggestion')->columns ) Link Here
114
my $suggestion_only = { map { $columns =~ / $_ / ? ( $_ => $suggestion_ref->{$_} ) : () } keys %$suggestion_ref };
99
my $suggestion_only = { map { $columns =~ / $_ / ? ( $_ => $suggestion_ref->{$_} ) : () } keys %$suggestion_ref };
115
$suggestion_only->{STATUS} = $suggestion_ref->{STATUS};
100
$suggestion_only->{STATUS} = $suggestion_ref->{STATUS};
116
101
117
delete $$suggestion_ref{$_}
118
    foreach
119
    qw( suggestedbyme op displayby tabcode notify filter_archived koha_login_context auth_forwarded_hash password userid );
102
    qw( suggestedbyme op displayby tabcode notify filter_archived koha_login_context auth_forwarded_hash password userid );
120
103
121
foreach my $key ( keys %$suggestion_ref ) {
122
    delete $suggestion_ref->{$key} if ( !$suggestion_ref->{$key} && ( $op eq 'else' ) );
123
    delete $suggestion_ref->{$key} if $key =~ m{^DataTables_acqui_suggestions_suggestions};
124
}
125
delete $suggestion_only->{branchcode} if $suggestion_only->{branchcode} eq '__ANY__';
104
delete $suggestion_only->{branchcode} if $suggestion_only->{branchcode} eq '__ANY__';
126
delete $suggestion_only->{budgetid}   if $suggestion_only->{budgetid} eq '__ANY__';
105
delete $suggestion_only->{budgetid}   if $suggestion_only->{budgetid} eq '__ANY__';
127
106
Lines 171-180 if ( $op =~ /cud-save/ ) { Link Here
171
        $template->param(
150
        $template->param(
172
            messages => \@messages,
151
            messages => \@messages,
173
        );
152
        );
174
        delete $suggestion_ref->{suggesteddate};
175
        delete $suggestion_ref->{manageddate};
176
        delete $suggestion_ref->{managedby};
177
        Init($suggestion_ref);
178
    } elsif ( !$suggestion_only->{suggestionid}
153
    } elsif ( !$suggestion_only->{suggestionid}
179
        && ( my ( $duplicatebiblionumber, $duplicatetitle ) = FindDuplicate($biblio) )
154
        && ( my ( $duplicatebiblionumber, $duplicatetitle ) = FindDuplicate($biblio) )
180
        && !$save_confirmed )
155
        && !$save_confirmed )
Lines 185-193 if ( $op =~ /cud-save/ ) { Link Here
185
            messages     => \@messages,
160
            messages     => \@messages,
186
            need_confirm => 1
161
            need_confirm => 1
187
        );
162
        );
188
        delete $suggestion_ref->{suggesteddate};
189
        delete $suggestion_ref->{manageddate};
190
        Init($suggestion_ref);
191
        $op = 'save';
163
        $op = 'save';
192
    } else {
164
    } else {
193
165
Lines 275-281 if ( $op =~ /cud-save/ ) { Link Here
275
247
276
            # empty fields, to avoid filter in "SearchSuggestion"
248
            # empty fields, to avoid filter in "SearchSuggestion"
277
        }
249
        }
278
        map { delete $$suggestion_ref{$_} unless $_ eq 'branchcode' } keys %$suggestion_ref;
279
        $op = 'else';
250
        $op = 'else';
280
251
281
        if ( $redirect eq 'purchase_suggestions' ) {
252
        if ( $redirect eq 'purchase_suggestions' ) {
Lines 284-306 if ( $op =~ /cud-save/ ) { Link Here
284
    }
255
    }
285
} elsif ( $op eq 'add_form' ) {
256
} elsif ( $op eq 'add_form' ) {
286
257
287
    #Adds suggestion
258
    $template->param(
288
    Init($suggestion_ref);
259
            default_suggester => $librarian,
260
            default_suggesteddate      => dt_from_string,
261
            default_branch    => C4::Context->userenv->{"branch"},
262
    );
289
    $op = 'save';
263
    $op = 'save';
290
} elsif ( $op eq 'edit_form' ) {
264
} elsif ( $op eq 'edit_form' ) {
291
265
292
    #Edit suggestion
266
    #Edit suggestion
293
    $suggestion_ref = Koha::Suggestions->find( $suggestion_ref->{suggestionid} )->unblessed();
294
    $suggestion_ref->{reasonsloop} = $reasonsloop;
295
    my $other_reason = 1;
267
    my $other_reason = 1;
296
    foreach my $reason ( @{$reasonsloop} ) {
268
    foreach my $reason ( @{$reasonsloop} ) {
297
        if ( $suggestion_ref->{reason} eq $reason->{lib} ) {
269
        if ( $stored_suggestion->reason eq $reason->{lib} ) {
298
            $other_reason = 0;
270
            $other_reason = 0;
299
        }
271
        }
300
    }
272
    }
301
    $other_reason = 0 unless $suggestion_ref->{reason};
273
    $other_reason = 0 unless $stored_suggestion->reason;
302
    $template->param( other_reason => $other_reason );
274
    $template->param(
303
    Init($suggestion_ref);
275
        other_reason         => $other_reason,
276
        default_manageddate  => dt_from_string,
277
        default_branch       => C4::Context->userenv->{"branch"},
278
    );
304
    $op = 'save';
279
    $op = 'save';
305
} elsif ( $op eq "cud-update_status" ) {
280
} elsif ( $op eq "cud-update_status" ) {
306
    my $suggestion;
281
    my $suggestion;
Lines 382-392 if ( $op =~ /cud-save/ ) { Link Here
382
        push @messages, { type => 'error', code => 'no_manage_permission' };
357
        push @messages, { type => 'error', code => 'no_manage_permission' };
383
        $template->param( messages => \@messages, );
358
        $template->param( messages => \@messages, );
384
    }
359
    }
385
} elsif ( $op eq 'show' ) {
386
    $suggestion_ref = Koha::Suggestions->find( $suggestion_ref->{suggestionid} )->unblessed();
387
    my $budget = GetBudget $$suggestion_ref{budgetid};
388
    $$suggestion_ref{budgetname} = $$budget{budget_name};
389
    Init($suggestion_ref);
390
}
360
}
391
361
392
if ( $op eq 'else' ) {
362
if ( $op eq 'else' ) {
Lines 506-512 if ( $op eq 'else' ) { Link Here
506
            {
476
            {
507
            "suggestiontype"      => $criteriumvalue                                 || "suggest",
477
            "suggestiontype"      => $criteriumvalue                                 || "suggest",
508
            "suggestiontypelabel" => GetCriteriumDesc( $criteriumvalue, $displayby ) || "",
478
            "suggestiontypelabel" => GetCriteriumDesc( $criteriumvalue, $displayby ) || "",
509
            'reasonsloop'         => $reasonsloop,
510
            'search_params'       => $criterium_search_params,
479
            'search_params'       => $criterium_search_params,
511
            'tab_count'           => $tab_counts->{$criteriumvalue},
480
            'tab_count'           => $tab_counts->{$criteriumvalue},
512
            }
481
            }
Lines 522-536 if ( $op eq 'else' ) { Link Here
522
    );
491
    );
523
}
492
}
524
493
525
$template->param( "${_}_patron" => scalar Koha::Patrons->find( $suggestion_ref->{$_} ) )
526
    for qw(managedby suggestedby acceptedby lastmodificationby);
527
528
$template->param(
494
$template->param(
529
    %$suggestion_ref,
495
    suggestion      => $stored_suggestion,
530
    filter_archived => $filter_archived,
496
    filter_archived => $filter_archived,
531
    "op"            => $op,
497
    "op"            => $op,
498
    reasonsloop     => $reasonsloop,
532
);
499
);
533
500
501
534
if ( defined($returnsuggested) and $returnsuggested ne "no_one" ) {
502
if ( defined($returnsuggested) and $returnsuggested ne "no_one" ) {
535
    print $input->redirect( "/cgi-bin/koha/members/moremember.pl?borrowernumber=" . $returnsuggested . "#suggestions" );
503
    print $input->redirect( "/cgi-bin/koha/members/moremember.pl?borrowernumber=" . $returnsuggested . "#suggestions" );
536
}
504
}
Lines 572-578 if ( $suggestion_ref->{STATUS} ) { Link Here
572
my $currencies = Koha::Acquisition::Currencies->search;
540
my $currencies = Koha::Acquisition::Currencies->search;
573
$template->param(
541
$template->param(
574
    currencies => $currencies,
542
    currencies => $currencies,
575
    suggestion => $suggestion_ref,
543
    suggestion => $stored_suggestion,
576
    price      => sprintf( "%.2f", $$suggestion_ref{'price'} || 0 ),
544
    price      => sprintf( "%.2f", $$suggestion_ref{'price'} || 0 ),
577
    total      => sprintf( "%.2f", $$suggestion_ref{'total'} || 0 ),
545
    total      => sprintf( "%.2f", $$suggestion_ref{'total'} || 0 ),
578
);
546
);
579
- 

Return to bug 39721