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

(-)a/installer/data/mysql/en/mandatory/suggest_status.sql (+6 lines)
Line 0 Link Here
1
INSERT INTO authorised_values ( category, authorised_value, lib, lib_opac) VALUES
2
('SUGGEST_STATUS', 'ACCEPTED', 'Accepted', 'Accepted'),
3
('SUGGEST_STATUS', 'CHECKED', 'Checked', 'Checked'),
4
('SUGGEST_STATUS', 'REJECTED', 'Rejected', 'Rejected'),
5
('SUGGEST_STATUS', 'ORDERED', 'Ordered', 'Ordered'),
6
('SUGGEST_STATUS', 'ASKED', 'Pending', 'Requested');
(-)a/installer/data/mysql/en/mandatory/suggest_status.txt (+1 lines)
Line 0 Link Here
1
Default Koha system suggestion statuses
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt (-70 / +93 lines)
Lines 1-3 Link Here
1
[% USE KohaAuthorisedValues %]
2
[% USE KohaBranchName %]
1
[% INCLUDE 'doc-head-open.inc' %]
3
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Acquisitions  &rsaquo;
4
<title>Koha &rsaquo; Acquisitions  &rsaquo;
3
    [% IF ( op_save ) %]
5
    [% IF ( op_save ) %]
Lines 194-205 $(document).ready(function() { calcNewsuggTotal(); }); Link Here
194
      <ol>
196
      <ol>
195
        <li>
197
        <li>
196
          <span class="label">Status:</span>
198
          <span class="label">Status:</span>
197
          [% IF ( STATUS == 'ASKED' ) %]Pending
199
          [% SET status_found = 0 %]
198
          [% ELSIF ( STATUS == 'ACCEPTED' ) %]Accepted
200
          [% FOREACH s IN SuggestionStatuses %]
199
          [% ELSIF ( STATUS == 'CHECKED' ) %]Checked
201
             [% IF STATUS == s.authorised_value %]
200
          [% ELSIF ( STATUS == 'REJECTED' ) %]Rejected
202
                 [% s.lib %]
201
          [% ELSE %]No Status
203
                 [% SET status_found = 1 %]
204
             [% END %]
202
          [% END %]
205
          [% END %]
206
          [% UNLESS status_found %]No Status[% END %]
203
        </li>
207
        </li>
204
        <li>
208
        <li>
205
          <table>
209
          <table>
Lines 208-225 $(document).ready(function() { calcNewsuggTotal(); }); Link Here
208
            <tr>
212
            <tr>
209
                <th><span class="label">Suggestion creation</span> </th>
213
                <th><span class="label">Suggestion creation</span> </th>
210
                <td>[% suggesteddate %]</td>
214
                <td>[% suggesteddate %]</td>
211
                <td>[% IF ( suggestedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestedby_borrowernumber %]">[% suggestedby_surname %], [% suggestedby_firstname %]</a>  [% suggestedby_branchcode %] ([% suggestedby_description %])[% END %]
215
                <td>[% IF ( suggestedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestedby_borrowernumber %]">[% suggestedby_surname %], [% suggestedby_firstname %]</a>  [% suggestedby_branchcode | $KohaBranchName %] ([% suggestedby_description %])[% END %]
212
                </td>
216
                </td>
213
            </tr>
217
            </tr>
214
            <tr>
218
            <tr>
215
                <th><span class="label">Suggestion management</span> </th>
219
                <th><span class="label">Suggestion management</span> </th>
216
                <td>[% manageddate %]</td>
220
                <td>[% manageddate %]</td>
217
                <td>[% IF ( managedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% managedby_borrowernumber %]">[% managedby_surname %], [% managedby_firstname %]</a> [% managedby_branchcode %] ([% managedby_description %])[% END %]</td>
221
                <td>[% IF ( managedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% managedby_borrowernumber %]">[% managedby_surname %], [% managedby_firstname %]</a> [% managedby_branchcode | $KohaBranchName %] ([% managedby_description %])[% END %]</td>
218
            </tr>
222
            </tr>
219
            <tr>
223
            <tr>
220
                <th><span class="label">Suggestion accepted</span> </th>
224
                <th><span class="label">Suggestion accepted</span> </th>
221
                <td>[% accepteddate %]</td>
225
                <td>[% accepteddate %]</td>
222
                <td>[% IF ( acceptedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% acceptedby_borrowernumber %]">[% acceptedby_surname %], [% acceptedby_firstname %]</a> [% acceptedby_branchcode %] ([% acceptedby_description %])[% END %]</td>
226
                <td>[% IF ( acceptedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% acceptedby_borrowernumber %]">[% acceptedby_surname %], [% acceptedby_firstname %]</a> [% acceptedby_branchcode | $KohaBranchName %] ([% acceptedby_description %])[% END %]</td>
223
            </tr>
227
            </tr>
224
            </tbody>
228
            </tbody>
225
        </table></li></ol>
229
        </table></li></ol>
Lines 290-323 $(document).ready(function() { calcNewsuggTotal(); }); Link Here
290
    </fieldset>
294
    </fieldset>
291
    <fieldset class="rows"> <legend>Suggestion management</legend>
295
    <fieldset class="rows"> <legend>Suggestion management</legend>
292
       <ol>
296
       <ol>
293
            [% IF ( suggestionid ) %]<li><label for="status">Status:</label><select id="STATUS" name="STATUS"><option value="">No Status</option>
297
            [% IF ( suggestionid ) %]
294
                [% IF (statusselected_ASKED ) %]<option value="ASKED" selected="selected">Pending</option> 
298
               <li>
295
                [% ELSE %]<option value="ASKED">Pending</option>[% END %]
299
                   <label for="status">Status:</label>
296
                [% IF (statusselected_ACCEPTED ) %]<option value="ACCEPTED" selected="selected">Accepted</option>
300
                   <select id="STATUS" name="STATUS">
297
                [% ELSE %]<option value="ACCEPTED">Accepted</option>[% END %]
301
                       <option value="">No Status</option>
298
                [% IF (statusselected_CHECKED ) %]<option value="CHECKED" selected="selected">Checked</option>
302
                       [% FOREACH s IN SuggestionStatuses %]
299
                [% ELSE %]<option value="CHECKED">Checked</option>[% END %]
303
                           [% IF s.authorised_value == selected_status %]
300
                [% IF ( statusselected_REJECTED ) %]<option value="REJECTED" selected="selected">Rejected</option>
304
                               <option value="[% s.authorised_value %]" selected="selected">[% s.lib %]</option>
301
                [% ELSE %]<option value="REJECTED">Rejected</option>[% END %]
305
                           [% ELSE %]
302
            </select></li>[% END %]
306
                               <option value="[% s.authorised_value %]">[% s.lib %]</option>
307
                           [% END %]
308
                       [% END %]
309
                   </select>
310
               </li>
311
            [% END %]
303
        <li><table>
312
        <li><table>
304
            <thead><tr><th>&nbsp;</th><th>Date</th><th>By</th></tr></thead>
313
            <thead><tr><th>&nbsp;</th><th>Date</th><th>By</th></tr></thead>
305
            <tbody>
314
            <tbody>
306
            <tr>
315
            <tr>
307
                <th><label for="suggesteddate">Suggestion creation</label> </th>
316
                <th><label for="suggesteddate">Suggestion creation</label> </th>
308
                <td><input type="text" id="suggesteddate" name="suggesteddate" size="10" maxlength="10" value="[% suggesteddate %]"/></td>
317
                <td><input type="text" id="suggesteddate" name="suggesteddate" size="10" maxlength="10" value="[% suggesteddate %]"/></td>
309
                <td><input type="hidden" id="suggestedby" name="suggestedby" value="[% suggestedby %]"/>[% IF ( suggestedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestedby_borrowernumber %]">[% suggestedby_surname %], [% suggestedby_firstname %]</a>  [% suggestedby_branchcode %] ([% suggestedby_description %])[% END %]
318
                <td><input type="hidden" id="suggestedby" name="suggestedby" value="[% suggestedby %]"/>[% IF ( suggestedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestedby_borrowernumber %]">[% suggestedby_surname %], [% suggestedby_firstname %]</a>  [% suggestedby_branchcode | $KohaBranchName %] ([% suggestedby_description %])[% END %]
310
                </td>
319
                </td>
311
            </tr>
320
            </tr>
312
            <tr>
321
            <tr>
313
                <th><label for="managedon">Suggestion management</label> </th>
322
                <th><label for="managedon">Suggestion management</label> </th>
314
                <td><input type="text" id="managedon" name="manageddate" size="10" maxlength="10" value="[% manageddate %]" /></td>
323
                <td><input type="text" id="managedon" name="manageddate" size="10" maxlength="10" value="[% manageddate %]" /></td>
315
                <td><input type="hidden" id="managedby" name="managedby" value="[% managedby %]"/>[% IF ( managedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% managedby_borrowernumber %]">[% managedby_surname %], [% managedby_firstname %]</a> [% managedby_branchcode %] ([% managedby_description %])[% END %]</td>
324
                <td><input type="hidden" id="managedby" name="managedby" value="[% managedby %]"/>[% IF ( managedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% managedby_borrowernumber %]">[% managedby_surname %], [% managedby_firstname %]</a> [% managedby_branchcode | $KohaBranchName %] ([% managedby_description %])[% END %]</td>
316
            </tr>
325
            </tr>
317
            <tr>
326
            <tr>
318
                <th><label for="accepteddate">Suggestion accepted</label> </th>
327
                <th><label for="accepteddate">Suggestion accepted</label> </th>
319
                <td><input type="text" id="accepteddate" name="accepteddate" size="10" maxlength="10" value="[% accepteddate %]" /></td>
328
                <td><input type="text" id="accepteddate" name="accepteddate" size="10" maxlength="10" value="[% accepteddate %]" /></td>
320
                <td><input type="hidden" id="acceptedby" name="acceptedby" value="[% acceptedby %]"/>[% IF ( acceptedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% acceptedby_borrowernumber %]">[% acceptedby_surname %], [% acceptedby_firstname %]</a> [% acceptedby_branchcode %] ([% acceptedby_description %])[% END %]</td>
329
                <td><input type="hidden" id="acceptedby" name="acceptedby" value="[% acceptedby %]"/>[% IF ( acceptedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% acceptedby_borrowernumber %]">[% acceptedby_surname %], [% acceptedby_firstname %]</a> [% acceptedby_branchcode | $KohaBranchName %] ([% acceptedby_description %])[% END %]</td>
321
            </tr>
330
            </tr>
322
            </tbody>
331
            </tbody>
323
        </table></li></ol>
332
        </table></li></ol>
Lines 364-384 $(document).ready(function() { calcNewsuggTotal(); }); Link Here
364
<h1>Suggestions management</h1>
373
<h1>Suggestions management</h1>
365
374
366
[% UNLESS ( notabs ) %]
375
[% UNLESS ( notabs ) %]
367
<div id="sorting" class="overlay">Sorting...</div>
376
    <div id="sorting" class="overlay">Sorting...</div>
368
<div id="loadingtab" class="overlay">Loading tab...</div>
377
    <div id="loadingtab" class="overlay">Loading tab...</div>
369
<div id="suggestiontabs" class="toptabs">
378
    <div id="suggestiontabs" class="toptabs">
370
<ul class="ui-tabs-nav">
379
    <ul class="ui-tabs-nav">
371
[% FOREACH suggestion IN suggestions %]
380
        [% FOREACH suggestion IN suggestions %]
372
[% IF ( suggestion.first ) %]<li class="ui-tabs-selected">[% ELSE %]<li>[% END %]<a href="#[% suggestion.suggestiontype %]">[% IF ( suggestion.suggestiontypelabel ) %]
381
            [% IF ( suggestion.first ) %]
373
    [% IF (suggestion.suggestiontypelabel == "Pending") %]Pending
382
                <li class="ui-tabs-selected">
374
    [% ELSIF (suggestion.suggestiontypelabel == "Accepted") %]Accepted
383
            [% ELSE %]
375
    [% ELSIF (suggestion.suggestiontypelabel == "Checked") %]Checked
384
                <li>
376
    [% ELSIF (suggestion.suggestiontypelabel == "Rejected") %]Rejected
385
            [% END %]
377
    [% ELSIF (suggestion.suggestiontypelabel == "Available") %]Available
386
378
    [% ELSIF (suggestion.suggestiontypelabel == "Ordered") %]Ordered[% ELSE %]
387
            <a href="#[% suggestion.suggestiontype %]">
379
    [% suggestion.suggestiontypelabel %][% END %]
388
            [% IF ( suggestion.suggestiontype ) %]
380
    [% ELSE %]No name[% END %] ([% suggestion.suggestionscount %])</a></li>
389
                [% KohaAuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestion.suggestiontype ) %]
381
[% END %]
390
            [% ELSE %]
391
                No name
392
            [% END %] 
393
            ([% suggestion.suggestions_loop.size %])</a></li>
394
        [% END %]
382
    </ul>
395
    </ul>
383
[% END %]
396
[% END %]
384
397
Lines 422-463 $(document).ready(function() { calcNewsuggTotal(); }); Link Here
422
                    [% IF ( suggestions_loo.manageddate ) %] - [% suggestions_loo.manageddate %][% END %]
435
                    [% IF ( suggestions_loo.manageddate ) %] - [% suggestions_loo.manageddate %][% END %]
423
                </td>
436
                </td>
424
                <td>
437
                <td>
425
                    [% suggestions_loo.branchcode %]
438
                    [% suggestions_loo.branchcode | $KohaBranchName %]
426
                </td>
439
                </td>
427
                <td>
440
                <td>
428
                    [% suggestions_loo.budget_name %]
441
                    [% suggestions_loo.budget_name %]
429
                </td>
442
                </td>
430
                <td>
443
                <td>
431
                    [% IF ( suggestions_loo.ASKED ) %]Pending[% END %] [% IF ( suggestions_loo.ACCEPTED ) %]Accepted[% END %] [% IF ( suggestions_loo.ORDERED ) %]Ordered[% END %] [% IF ( suggestions_loo.REJECTED ) %]Rejected[% END %] [% IF ( suggestions_loo.CHECKED ) %]Checked[% END %] [% IF ( suggestions_loo.reason ) %]<br />([% suggestions_loo.reason %])[% END %]
444
                    [% KohaAuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestions_loo.STATUS ) %]
445
                    [% IF ( suggestions_loo.reason ) %]<br />([% suggestions_loo.reason %])[% END %]
432
                </td>
446
                </td>
433
        </tr>
447
        </tr>
434
        [% END %]</tbody>
448
        [% END %]</tbody>
435
        </table>  <fieldset>
449
        </table>  <fieldset>
450
436
    <div id="select-reason[% suggestion.suggestiontype %]">
451
    <div id="select-reason[% suggestion.suggestiontype %]">
437
        <div id="status[% suggestion.suggestiontype %]">
452
        <div id="status[% suggestion.suggestiontype %]">
438
	<label for="STATUS[% suggestion.suggestiontype %]">Mark selected as: </label><select name="STATUS" id="STATUS[% suggestion.suggestiontype %]">
439
	<option value=""> -- Choose a status --</option>
440
    [% IF (statusselected_ASKED ) %]<option value="ASKED" selected="selected">Pending</option> 
441
    [% ELSE %]<option value="ASKED">Pending</option>[% END %]
442
    [% IF (statusselected_ACCEPTED ) %]<option value="ACCEPTED" selected="selected">Accepted</option>
443
    [% ELSE %]<option value="ACCEPTED">Accepted</option>[% END %]
444
    [% IF (statusselected_CHECKED ) %]<option value="CHECKED" selected="selected">Checked</option>
445
    [% ELSE %]<option value="CHECKED">Checked</option>[% END %]
446
    [% IF ( statusselected_REJECTED ) %]<option value="REJECTED" selected="selected">Rejected</option>
447
    [% ELSE %]<option value="REJECTED">Rejected</option>[% END %]
448
	</select>
449
    <label for="reason[% suggestion.suggestiontype %]">with this reason:</label>                 <select id="reason[% suggestion.suggestiontype %]" name="reason[% suggestion.suggestiontype %]">
450
                    <option value=""> -- Choose a reason -- </option>
451
                        [% FOREACH reasonsloo IN suggestion.reasonsloop %]
452
                        <option value="[% reasonsloo.lib %]">[% reasonsloo.lib %]</option>
453
                        [% END %]
454
                    <option value="other">Others...</option>
455
                    </select>   <span id="other_reason[% suggestion.suggestiontype %]">
456
            <input type="text" size="31" id="select-other_reason[% suggestion.suggestiontype %]" name="other_reason[% suggestion.suggestiontype %]" value="please note your reason here..." /> <a href="#back[% suggestion.suggestiontype %]">Cancel</a>
457
        </span> <strong style="padding: 0 1em;">OR:</strong> <label for="[% suggestion.suggestiontype %]delete">Delete selected</label> <input type="checkbox" name="op" id="[% suggestion.suggestiontype %]delete" />
458
        </div>
459
        </div>
460
453
454
	    <label for="STATUS[% suggestion.suggestiontype %]">Mark selected as: </label>
455
            <select name="STATUS" id="STATUS[% suggestion.suggestiontype %]">
456
	        <option value=""> -- Choose a status --</option>
457
                [% FOREACH s IN SuggestionStatuses %]
458
                    <option value="[% s.authorised_value %]">[% s.lib %]</option>
459
                [% END %]
460
            </select>
461
462
            <label for="reason[% suggestion.suggestiontype %]">with this reason:</label>
463
            <select id="reason[% suggestion.suggestiontype %]" name="reason[% suggestion.suggestiontype %]">
464
                <option value=""> -- Choose a reason -- </option>
465
                [% FOREACH reasonsloo IN suggestion.reasonsloop %]
466
                    <option value="[% reasonsloo.lib %]">[% reasonsloo.lib %]</option>
467
                [% END %]
468
                <option value="other">Others...</option>
469
            </select>
470
471
            <span id="other_reason[% suggestion.suggestiontype %]">
472
                <input type="text" size="31" id="select-other_reason[% suggestion.suggestiontype %]" name="other_reason[% suggestion.suggestiontype %]" value="please note your reason here..." />
473
                <a href="#back[% suggestion.suggestiontype %]">Cancel</a>
474
            </span>
475
476
            <strong style="padding: 0 1em;">OR:</strong>
477
            <label for="[% suggestion.suggestiontype %]delete">Delete selected</label>
478
            <input type="checkbox" name="op" id="[% suggestion.suggestiontype %]delete" />
479
        </div>
480
    </div>
461
481
462
    <input type="hidden" name="tabcode" value="[% suggestion.suggestiontype %]" />
482
    <input type="hidden" name="tabcode" value="[% suggestion.suggestiontype %]" />
463
    <input type="hidden" name="op" value="change" />
483
    <input type="hidden" name="op" value="change" />
Lines 498-513 $(document).ready(function() { calcNewsuggTotal(); }); Link Here
498
                </fieldset>
518
                </fieldset>
499
				 <fieldset class="brief"><h4 class="collapse"><a href="#">Suggestion information</a></h4>
519
				 <fieldset class="brief"><h4 class="collapse"><a href="#">Suggestion information</a></h4>
500
                    <ol>
520
                    <ol>
501
                      <li><label for="STATUS"> Status:</label><select name="STATUS" id="STATUS"><option value="">Any</option>
521
                      <li>
502
                        [% IF (statusselected_ASKED ) %]<option value="ASKED" selected="selected">Pending</option> 
522
                          <label for="STATUS"> Status:</label>
503
                        [% ELSE %]<option value="ASKED">Pending</option>[% END %]
523
                          <select name="STATUS" id="STATUS">
504
                        [% IF (statusselected_ACCEPTED ) %]<option value="ACCEPTED" selected="selected">Accepted</option>
524
                              <option value="">Any</option>
505
                        [% ELSE %]<option value="ACCEPTED">Accepted</option>[% END %]
525
                              [% FOREACH s IN SuggestionStatuses %]
506
                        [% IF (statusselected_CHECKED ) %]<option value="CHECKED" selected="selected">Checked</option>
526
                                  [% IF s.authorised_value == selected_status %]
507
                        [% ELSE %]<option value="CHECKED">Checked</option>[% END %]
527
                                      <option value="[% s.authorised_value %]" selected="selected">[% s.lib %]</option>
508
                        [% IF ( statusselected_REJECTED ) %]<option value="REJECTED" selected="selected">Rejected</option>
528
                                  [% ELSE %]
509
                        [% ELSE %]<option value="REJECTED">Rejected</option>[% END %]
529
                                      <option value="[% s.authorised_value %]">[% s.lib %]</option>
510
                      </select></li>
530
                                  [% END %]
531
                              [% END %]
532
                          </select>
533
                      </li>
511
                    <li><label for="suggestedby"> Suggested by:</label><select id="suggestedby" name="suggestedby"><option value="">Any</option>
534
                    <li><label for="suggestedby"> Suggested by:</label><select id="suggestedby" name="suggestedby"><option value="">Any</option>
512
[% FOREACH suggestedby_loo IN suggestedby_loop %][% IF ( suggestedby_loo.selected ) %]<option value="[% suggestedby_loo.code %]" selected="selected">[% suggestedby_loo.desc %]</option>[% ELSE %]<option value="[% suggestedby_loo.code %]">[% suggestedby_loo.desc %]</option>[% END %][% END %]
535
[% FOREACH suggestedby_loo IN suggestedby_loop %][% IF ( suggestedby_loo.selected ) %]<option value="[% suggestedby_loo.code %]" selected="selected">[% suggestedby_loo.desc %]</option>[% ELSE %]<option value="[% suggestedby_loo.code %]">[% suggestedby_loo.desc %]</option>[% END %][% END %]
513
                                                                     </select></li>
536
                                                                     </select></li>
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-suggestions.tt (-5 / +2 lines)
Lines 1-3 Link Here
1
[% USE KohaAuthorisedValues %]
1
[% INCLUDE 'doc-head-open.inc' %][% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog &rsaquo;
2
[% INCLUDE 'doc-head-open.inc' %][% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog &rsaquo;
2
[% IF ( op_add ) %]Enter a new purchase suggestion[% END %]
3
[% IF ( op_add ) %]Enter a new purchase suggestion[% END %]
3
[% IF ( op_else ) %]Purchase Suggestions[% END %]
4
[% IF ( op_else ) %]Purchase Suggestions[% END %]
Lines 216-227 $.tablesorter.addParser({ Link Here
216
					[% IF ( suggestions_loo.surnamemanagedby ) %][% suggestions_loo.surnamemanagedby %][% IF ( suggestions_loo.firstnamemanagedby ) %],[% END %] [% suggestions_loo.firstnamemanagedby %][% ELSE %]&nbsp;[% END %]
217
					[% IF ( suggestions_loo.surnamemanagedby ) %][% suggestions_loo.surnamemanagedby %][% IF ( suggestions_loo.firstnamemanagedby ) %],[% END %] [% suggestions_loo.firstnamemanagedby %][% ELSE %]&nbsp;[% END %]
217
                </td>
218
                </td>
218
                <td>
219
                <td>
219
                    [% IF ( suggestions_loo.ASKED ) %]Requested[% END %]
220
                    [% IF ( suggestions_loo.CHECKED ) %]Checked by the library[% END %]
221
                    [% IF ( suggestions_loo.ACCEPTED ) %]Accepted by the library[% END %]
222
                    [% IF ( suggestions_loo.ORDERED ) %]Ordered by the library[% END %]
223
                    [% IF ( suggestions_loo.REJECTED ) %]Suggestion declined [% END %]
224
                    [% IF ( suggestions_loo.AVAILABLE ) %]Available in the library[% END %]
220
                    [% IF ( suggestions_loo.AVAILABLE ) %]Available in the library[% END %]
221
                    [% KohaAuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestions_loo.STATUS, 1 ) %]
225
                    [% IF ( suggestions_loo.reason ) %]([% suggestions_loo.reason %])[% END %]
222
                    [% IF ( suggestions_loo.reason ) %]([% suggestions_loo.reason %])[% END %]
226
                </td>
223
                </td>
227
            </tr>
224
            </tr>
(-)a/suggestion/suggestion.pl (-76 / +75 lines)
Lines 51-56 sub Init { Link Here
51
        # suggesteddate, when coming from the DB, needs to be formated
51
        # suggesteddate, when coming from the DB, needs to be formated
52
        $suggestion->{'suggesteddate'} = format_date( $suggestion->{'suggesteddate'} );
52
        $suggestion->{'suggesteddate'} = format_date( $suggestion->{'suggesteddate'} );
53
    }
53
    }
54
54
    foreach my $date (qw(rejecteddate accepteddate)) {
55
    foreach my $date (qw(rejecteddate accepteddate)) {
55
        $suggestion->{$date} = (
56
        $suggestion->{$date} = (
56
            ( $suggestion->{$date} eq "0000-00-00" || $suggestion->{$date} eq "" )
57
            ( $suggestion->{$date} eq "0000-00-00" || $suggestion->{$date} eq "" )
Lines 58-70 sub Init { Link Here
58
            : format_date( $suggestion->{$date} )
59
            : format_date( $suggestion->{$date} )
59
        );
60
        );
60
    }
61
    }
62
61
    $suggestion->{'branchcode'} = C4::Context->userenv->{"branch"} unless ( $suggestion->{'branchcode'} );
63
    $suggestion->{'branchcode'} = C4::Context->userenv->{"branch"} unless ( $suggestion->{'branchcode'} );
62
}
64
}
63
65
64
sub GetCriteriumDesc {
66
sub GetCriteriumDesc {
65
    my ( $criteriumvalue, $displayby ) = @_;
67
    my ( $criteriumvalue, $displayby ) = @_;
66
    return ( $criteriumvalue eq 'ASKED' ? "Pending" : ucfirst( lc($criteriumvalue) ) ) if ( $displayby =~ /status/i );
67
    return ( GetBranchName($criteriumvalue) )  if ( $displayby =~ /branchcode/ );
68
    return ( GetSupportName($criteriumvalue) ) if ( $displayby =~ /itemtype/ );
68
    return ( GetSupportName($criteriumvalue) ) if ( $displayby =~ /itemtype/ );
69
    if ( $displayby =~ /suggestedby/ || $displayby =~ /managedby/ || $displayby =~ /acceptedby/ ) {
69
    if ( $displayby =~ /suggestedby/ || $displayby =~ /managedby/ || $displayby =~ /acceptedby/ ) {
70
        my $borr = C4::Members::GetMember( borrowernumber => $criteriumvalue );
70
        my $borr = C4::Members::GetMember( borrowernumber => $criteriumvalue );
Lines 91-101 my $branchfilter = ( $displayby ne "branchcode" ) ? $input->param('branchco Link Here
91
my $tabcode           = $input->param('tabcode');
91
my $tabcode           = $input->param('tabcode');
92
92
93
# filter informations which are not suggestion related.
93
# filter informations which are not suggestion related.
94
my $suggestion_ref = $input->Vars;
94
my $input_vars = $input->Vars;
95
95
96
delete $$suggestion_ref{$_} foreach qw( suggestedbyme op displayby tabcode edit_field );
96
delete $$input_vars{$_} foreach qw( suggestedbyme op displayby tabcode edit_field );
97
foreach ( keys %$suggestion_ref ) {
97
foreach ( keys %$input_vars ) {
98
    delete $$suggestion_ref{$_} if ( !$$suggestion_ref{$_} && ( $op eq 'else' || $op eq 'change' ) );
98
    delete $$input_vars{$_} if ( !$$input_vars{$_} && ( $op eq 'else' || $op eq 'change' ) );
99
}
99
}
100
my ( $template, $borrowernumber, $cookie, $userflags ) = get_template_and_user(
100
my ( $template, $borrowernumber, $cookie, $userflags ) = get_template_and_user(
101
    {   template_name => "suggestion/suggestion.tmpl",
101
    {   template_name => "suggestion/suggestion.tmpl",
Lines 109-179 my ( $template, $borrowernumber, $cookie, $userflags ) = get_template_and_user( Link Here
109
##  Operations
109
##  Operations
110
##
110
##
111
if ( $op =~ /save/i ) {
111
if ( $op =~ /save/i ) {
112
    if ( $$suggestion_ref{"STATUS"} ) {
112
    if ( $$input_vars{"STATUS"} ) {
113
        if ( my $tmpstatus = lc( $$suggestion_ref{"STATUS"} ) =~ /ACCEPTED|REJECTED/i ) {
113
        if ( my $tmpstatus = lc( $$input_vars{"STATUS"} ) =~ /ACCEPTED|REJECTED/i ) {
114
            $$suggestion_ref{ lc( $$suggestion_ref{"STATUS"} ) . "date" } = C4::Dates->today;
114
            $$input_vars{ lc( $$input_vars{"STATUS"} ) . "date" } = C4::Dates->today;
115
            $$suggestion_ref{ lc( $$suggestion_ref{"STATUS"} ) . "by" }   = C4::Context->userenv->{number};
115
            $$input_vars{ lc( $$input_vars{"STATUS"} ) . "by" }   = C4::Context->userenv->{number};
116
        }
116
        }
117
        $$suggestion_ref{"manageddate"} = C4::Dates->today;
117
        $$input_vars{"manageddate"} = C4::Dates->today;
118
        $$suggestion_ref{"managedby"}   = C4::Context->userenv->{number};
118
        $$input_vars{"managedby"}   = C4::Context->userenv->{number};
119
    }
119
    }
120
    if ( $$suggestion_ref{'suggestionid'} > 0 ) {
120
    if ( $$input_vars{'suggestionid'} > 0 ) {
121
        &ModSuggestion($suggestion_ref);
121
        &ModSuggestion($input_vars);
122
    } else {
122
    } else {
123
        ###FIXME:Search here if suggestion already exists.
123
        ###FIXME:Search here if suggestion already exists.
124
        my $suggestions_loop = SearchSuggestion($suggestion_ref);
124
        my $suggestions_loop = SearchSuggestion($input_vars);
125
        if ( @$suggestions_loop >= 1 ) {
125
        if ( @$suggestions_loop >= 1 ) {
126
126
127
            #some suggestion are answering the request Donot Add
127
            #some suggestion are answering the request Donot Add
128
        } else {
128
        } else {
129
            ## Adding some informations related to suggestion
129
            ## Adding some informations related to suggestion
130
            &NewSuggestion($suggestion_ref);
130
            &NewSuggestion($input_vars);
131
        }
131
        }
132
132
133
        # empty fields, to avoid filter in "SearchSuggestion"
133
        # empty fields, to avoid filter in "SearchSuggestion"
134
    }
134
    }
135
    map { delete $$suggestion_ref{$_} } keys %$suggestion_ref;
135
    map { delete $$input_vars{$_} } keys %$input_vars;
136
    $op = 'else';
136
    $op = 'else';
137
} elsif ( $op =~ /add/ ) {
137
} elsif ( $op =~ /add/ ) {
138
138
139
    #Adds suggestion
139
    #Adds suggestion
140
    Init($suggestion_ref);
140
    Init($input_vars);
141
    $op = 'save';
141
    $op = 'save';
142
} elsif ( $op =~ /edit/ ) {
142
} elsif ( $op =~ /edit/ ) {
143
143
144
    #Edit suggestion
144
    #Edit suggestion
145
    $suggestion_ref = &GetSuggestion( $$suggestion_ref{'suggestionid'} );
145
    $input_vars = &GetSuggestion( $$input_vars{'suggestionid'} );
146
    Init($suggestion_ref);
146
    Init($input_vars);
147
    $op = 'save';
147
    $op = 'save';
148
} elsif ( $op eq "change" ) {
148
} elsif ( $op eq "change" ) {
149
149
150
    # set accepted/rejected/managed informations if applicable
150
    # set accepted/rejected/managed informations if applicable
151
    # ie= if the librarian has choosen some action on the suggestions
151
    # ie= if the librarian has choosen some action on the suggestions
152
    if ( $$suggestion_ref{"STATUS"} eq "ACCEPTED" ) {
152
    if ( $$input_vars{"STATUS"} eq "ACCEPTED" ) {
153
        $$suggestion_ref{"accepteddate"} = C4::Dates->today;
153
        $$input_vars{"accepteddate"} = C4::Dates->today;
154
        $$suggestion_ref{"acceptedby"}   = C4::Context->userenv->{number};
154
        $$input_vars{"acceptedby"}   = C4::Context->userenv->{number};
155
    } elsif ( $$suggestion_ref{"STATUS"} eq "REJECTED" ) {
155
    } elsif ( $$input_vars{"STATUS"} eq "REJECTED" ) {
156
        $$suggestion_ref{"rejecteddate"} = C4::Dates->today;
156
        $$input_vars{"rejecteddate"} = C4::Dates->today;
157
        $$suggestion_ref{"rejectedby"}   = C4::Context->userenv->{number};
157
        $$input_vars{"rejectedby"}   = C4::Context->userenv->{number};
158
    }
158
    }
159
    if ( $$suggestion_ref{"STATUS"} ) {
159
    if ( $$input_vars{"STATUS"} ) {
160
        $$suggestion_ref{"manageddate"} = C4::Dates->today;
160
        $$input_vars{"manageddate"} = C4::Dates->today;
161
        $$suggestion_ref{"managedby"}   = C4::Context->userenv->{number};
161
        $$input_vars{"managedby"}   = C4::Context->userenv->{number};
162
    }
162
    }
163
    if ( my $reason = $$suggestion_ref{"reason$tabcode"} ) {
163
    if ( my $reason = $$input_vars{"reason$tabcode"} ) {
164
        if ( $reason eq "other" ) {
164
        if ( $reason eq "other" ) {
165
            $reason = $$suggestion_ref{"other_reason$tabcode"};
165
            $reason = $$input_vars{"other_reason$tabcode"};
166
        }
166
        }
167
        $$suggestion_ref{'reason'} = $reason;
167
        $$input_vars{'reason'} = $reason;
168
    }
168
    }
169
    delete $$suggestion_ref{$_} foreach ( "reason$tabcode", "other_reason$tabcode" );
169
    delete $$input_vars{$_} foreach ( "reason$tabcode", "other_reason$tabcode" );
170
    foreach ( keys %$suggestion_ref ) {
170
    foreach ( keys %$input_vars ) {
171
        delete $$suggestion_ref{$_} unless ( $$suggestion_ref{$_} );
171
        delete $$input_vars{$_} unless ( $$input_vars{$_} );
172
    }
172
    }
173
    foreach my $suggestionid (@editsuggestions) {
173
    foreach my $suggestionid (@editsuggestions) {
174
        next unless $suggestionid;
174
        next unless $suggestionid;
175
        $$suggestion_ref{'suggestionid'} = $suggestionid;
175
        $$input_vars{'suggestionid'} = $suggestionid;
176
        &ModSuggestion($suggestion_ref);
176
        &ModSuggestion($input_vars);
177
    }
177
    }
178
    $op = 'else';
178
    $op = 'else';
179
} elsif ( $op eq "delete" ) {
179
} elsif ( $op eq "delete" ) {
Lines 182-198 if ( $op =~ /save/i ) { Link Here
182
    }
182
    }
183
    $op = 'else';
183
    $op = 'else';
184
} elsif ( $op eq 'show' ) {
184
} elsif ( $op eq 'show' ) {
185
    $suggestion_ref = &GetSuggestion( $$suggestion_ref{'suggestionid'} );
185
    $input_vars = &GetSuggestion( $$input_vars{'suggestionid'} );
186
    $$suggestion_ref{branchname} = GetBranchName $$suggestion_ref{branchcode};
186
    $$input_vars{branchname} = GetBranchName $$input_vars{branchcode};
187
    my $budget = GetBudget $$suggestion_ref{budgetid};
187
    my $budget = GetBudget $$input_vars{budgetid};
188
    $$suggestion_ref{budgetname} = $$budget{budget_name};
188
    $$input_vars{budgetname} = $$budget{budget_name};
189
    Init($suggestion_ref);
189
    Init($input_vars);
190
}
190
}
191
if ( $op =~ /else/ ) {
191
if ( $op =~ /else/ ) {
192
    $op = 'else';
192
    $op = 'else';
193
193
194
    $displayby ||= "STATUS";
194
    $displayby ||= "STATUS";
195
    delete $$suggestion_ref{'branchcode'} if ( $displayby eq "branchcode" );
195
    delete $$input_vars{'branchcode'} if ( $displayby eq "branchcode" );
196
    my $criteria_list = GetDistinctValues( "suggestions." . $displayby );
196
    my $criteria_list = GetDistinctValues( "suggestions." . $displayby );
197
    my @allsuggestions;
197
    my @allsuggestions;
198
    my $reasonsloop = GetAuthorisedValues("SUGGEST");
198
    my $reasonsloop = GetAuthorisedValues("SUGGEST");
Lines 200-213 if ( $op =~ /else/ ) { Link Here
200
200
201
        # By default, display suggestions from current working branch
201
        # By default, display suggestions from current working branch
202
        if ( not defined $branchfilter ) {
202
        if ( not defined $branchfilter ) {
203
            $$suggestion_ref{'branchcode'} = C4::Context->userenv->{'branch'};
203
            $$input_vars{'branchcode'} = C4::Context->userenv->{'branch'};
204
        }
204
        }
205
        my $definedvalue = defined $$suggestion_ref{$displayby} && $$suggestion_ref{$displayby} ne "";
205
        my $definedvalue = defined $$input_vars{$displayby} && $$input_vars{$displayby} ne "";
206
206
207
        next if ( $definedvalue && $$suggestion_ref{$displayby} ne $criteriumvalue );
207
        next if ( $definedvalue && $$input_vars{$displayby} ne $criteriumvalue );
208
        $$suggestion_ref{$displayby} = $criteriumvalue;
208
        $$input_vars{$displayby} = $criteriumvalue;
209
209
210
        my $suggestions = &SearchSuggestion($suggestion_ref);
210
        my $suggestions = &SearchSuggestion($input_vars);
211
        foreach my $suggestion (@$suggestions) {
211
        foreach my $suggestion (@$suggestions) {
212
            if ( $suggestion->{budgetid} ) {
212
            if ( $suggestion->{budgetid} ) {
213
                my $bud = GetBudget( $suggestion->{budgetid} );
213
                my $bud = GetBudget( $suggestion->{budgetid} );
Lines 223-235 if ( $op =~ /else/ ) { Link Here
223
        }
223
        }
224
        push @allsuggestions,
224
        push @allsuggestions,
225
          { "suggestiontype" => $criteriumvalue || "suggest",
225
          { "suggestiontype" => $criteriumvalue || "suggest",
226
            "suggestiontypelabel" => GetCriteriumDesc( $criteriumvalue, $displayby ) || "",
226
            'suggestions_loop' => $suggestions,
227
            "suggestionscount"    => scalar(@$suggestions),
227
            'reasonsloop'      => $reasonsloop,
228
            'suggestions_loop'    => $suggestions,
229
            'reasonsloop'         => $reasonsloop,
230
          };
228
          };
231
229
232
        delete $$suggestion_ref{$displayby} unless $definedvalue;
230
        delete $$input_vars{$displayby} unless $definedvalue;
233
    }
231
    }
234
232
235
    $template->param(
233
    $template->param(
Lines 241-249 if ( $op =~ /else/ ) { Link Here
241
239
242
foreach my $element (qw(managedby suggestedby acceptedby)) {
240
foreach my $element (qw(managedby suggestedby acceptedby)) {
243
241
244
    #    $debug || warn $$suggestion_ref{$element};
242
    #    $debug || warn $$input_vars{$element};
245
    if ( $$suggestion_ref{$element} ) {
243
    if ( $$input_vars{$element} ) {
246
        my $member = GetMember( borrowernumber => $$suggestion_ref{$element} );
244
        my $member = GetMember( borrowernumber => $$input_vars{$element} );
247
        $template->param(
245
        $template->param(
248
            $element . "_borrowernumber" => $$member{borrowernumber},
246
            $element . "_borrowernumber" => $$member{borrowernumber},
249
            $element . "_firstname"      => $$member{firstname},
247
            $element . "_firstname"      => $$member{firstname},
Lines 255-261 foreach my $element (qw(managedby suggestedby acceptedby)) { Link Here
255
    }
253
    }
256
}
254
}
257
$template->param(
255
$template->param(
258
    %$suggestion_ref,
256
    %$input_vars,
259
    "op_$op"   => 1,
257
    "op_$op"   => 1,
260
    dateformat => C4::Context->preference("dateformat"),
258
    dateformat => C4::Context->preference("dateformat"),
261
    "op"       => $op,
259
    "op"       => $op,
Lines 282-288 foreach my $thisbranch ( sort { $branches->{$a}->{'branchname'} cmp $branches->{ Link Here
282
        value      => $thisbranch,
280
        value      => $thisbranch,
283
        branchname => $branches->{$thisbranch}->{'branchname'},
281
        branchname => $branches->{$thisbranch}->{'branchname'},
284
        selected   => ( $branchfilter and $branches->{$thisbranch}->{'branchcode'} eq $branchfilter )
282
        selected   => ( $branchfilter and $branches->{$thisbranch}->{'branchcode'} eq $branchfilter )
285
          || ( $$suggestion_ref{'branchcode'} and $branches->{$thisbranch}->{'branchcode'} eq $$suggestion_ref{'branchcode'} )
283
          || ( $$input_vars{'branchcode'} and $branches->{$thisbranch}->{'branchcode'} eq $$input_vars{'branchcode'} )
286
    );
284
    );
287
    push @branchloop, \%row;
285
    push @branchloop, \%row;
288
}
286
}
Lines 298-305 my $supportlist = GetSupportList(); Link Here
298
296
299
foreach my $support (@$supportlist) {
297
foreach my $support (@$supportlist) {
300
    $$support{'selected'} =
298
    $$support{'selected'} =
301
      ( defined $$suggestion_ref{'itemtype'} )
299
      ( defined $$input_vars{'itemtype'} )
302
      ? $$support{'itemtype'} eq $$suggestion_ref{'itemtype'}
300
      ? $$support{'itemtype'} eq $$input_vars{'itemtype'}
303
      : 0;
301
      : 0;
304
    if ( $$support{'imageurl'} ) {
302
    if ( $$support{'imageurl'} ) {
305
        $$support{'imageurl'} = getitemtypeimagelocation( 'intranet', $$support{'imageurl'} );
303
        $$support{'imageurl'} = getitemtypeimagelocation( 'intranet', $$support{'imageurl'} );
Lines 310-316 foreach my $support (@$supportlist) { Link Here
310
$template->param( itemtypeloop      => $supportlist );
308
$template->param( itemtypeloop      => $supportlist );
311
$template->param( returnsuggestedby => $returnsuggestedby );
309
$template->param( returnsuggestedby => $returnsuggestedby );
312
310
313
my $patron_reason_loop = GetAuthorisedValues( "OPAC_SUG", $$suggestion_ref{'patronreason'} );
311
my $patron_reason_loop = GetAuthorisedValues( "OPAC_SUG", $$input_vars{'patronreason'} );
314
$template->param( patron_reason_loop => $patron_reason_loop );
312
$template->param( patron_reason_loop => $patron_reason_loop );
315
313
316
#Budgets management
314
#Budgets management
Lines 328-349 foreach my $budget ( @{$budgets} ) { Link Here
328
326
329
    ## Please see file perltidy.ERR
327
    ## Please see file perltidy.ERR
330
    $budget->{'selected'} = 1
328
    $budget->{'selected'} = 1
331
      if ( $$suggestion_ref{'budgetid'}
329
      if ( $$input_vars{'budgetid'}
332
        && $budget->{'budget_id'} eq $$suggestion_ref{'budgetid'} );
330
        && $budget->{'budget_id'} eq $$input_vars{'budgetid'} );
333
331
334
    push @budgets_loop, $budget;
332
    push @budgets_loop, $budget;
335
}
333
}
336
334
337
$template->param( budgetsloop => \@budgets_loop );
335
$template->param( budgetsloop => \@budgets_loop );
338
$template->param( "statusselected_$$suggestion_ref{'STATUS'}" => 1 ) if ( $$suggestion_ref{'STATUS'} );
336
$template->param( "selected_status" => $$input_vars{'STATUS'} ) if ( $$input_vars{'STATUS'} );
339
337
340
# get currencies and rates
338
# get currencies and rates
341
my @rates           = GetCurrencies();
339
my @rates           = GetCurrencies();
342
my $count           = scalar @rates;
340
my $count           = scalar @rates;
343
my $active_currency = GetCurrency();
341
my $active_currency = GetCurrency();
344
my $selected_currency;
342
my $selected_currency;
345
if ( $$suggestion_ref{'currency'} ) {
343
if ( $$input_vars{'currency'} ) {
346
    $selected_currency = $$suggestion_ref{'currency'};
344
    $selected_currency = $$input_vars{'currency'};
347
} else {
345
} else {
348
    $selected_currency = $active_currency->{currency};
346
    $selected_currency = $active_currency->{currency};
349
}
347
}
Lines 360-381 for ( my $i = 0 ; $i < $count ; $i++ ) { Link Here
360
$template->param( loop_currency => \@loop_currency );
358
$template->param( loop_currency => \@loop_currency );
361
359
362
$template->param(
360
$template->param(
363
    price => sprintf( "%.2f", $$suggestion_ref{'price'} || 0 ),
361
    price => sprintf( "%.2f", $$input_vars{'price'} || 0 ),
364
    total => sprintf( "%.2f", $$suggestion_ref{'total'} || 0 ),
362
    total => sprintf( "%.2f", $$input_vars{'total'} || 0 ),
365
);
363
);
366
364
367
my %hashlists;
365
my %hashlists;
368
foreach my $field (qw(managedby acceptedby suggestedby budgetid)) {
366
foreach my $field (qw(managedby acceptedby suggestedby budgetid)) {
369
    my $values_list;
367
    my $values_list;
370
    $values_list = GetDistinctValues( "suggestions." . $field );
368
    $values_list = GetDistinctValues( "suggestions." . $field );
371
    my @codes_list = map {
369
    my @codes_list =
372
        {   'code'     => $$_{'value'},
370
      map { { 'code' => $$_{'value'}, 'desc' => GetCriteriumDesc( $$_{'value'}, $field ), 'selected' => ( $$input_vars{$field} ) ? $$_{'value'} eq $$input_vars{$field} : 0, } }
373
            'desc'     => GetCriteriumDesc( $$_{'value'}, $field ),
371
      @$values_list;
374
            'selected' => ( $$suggestion_ref{$field} ) ? $$_{'value'} eq $$suggestion_ref{$field} : 0,
375
        }
376
    } @$values_list;
377
    $hashlists{ lc($field) . "_loop" } = \@codes_list;
372
    $hashlists{ lc($field) . "_loop" } = \@codes_list;
378
}
373
}
379
$template->param(%hashlists);
374
$template->param(%hashlists);
380
$template->param( DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(), );
375
376
$template->param(
377
    DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
378
    SuggestionStatuses       => GetAuthorisedValues('SUGGEST_STATUS'),
379
);
380
381
output_html_with_http_headers $input, $cookie, $template->output;
381
output_html_with_http_headers $input, $cookie, $template->output;
382
- 

Return to bug 9307