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

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt (+18 lines)
Lines 340-345 Link Here
340
                                                    <option value="dateadded" data-direction="asc">Date added (oldest to newest)</option>
340
                                                    <option value="dateadded" data-direction="asc">Date added (oldest to newest)</option>
341
                                                [% END %]
341
                                                [% END %]
342
                                            </optgroup>
342
                                            </optgroup>
343
                                            <optgroup label="Date acquired">
344
                                                [% IF sortfield == "dateaccessioned" && direction == 'asc' %]
345
                                                    <option value="dateaccessioned" data-direction="desc" selected="selected">Date acquired (newest to oldest)</option>
346
                                                [% ELSE %]
347
                                                    <option value="dateaccessioned" data-direction="desc">Date acquired (newest to oldest)</option>
348
                                                [% END %]
349
                                                [% IF sortfield == "dateaccessioned" && direction == 'desc' %]
350
                                                    <option value="dateaccessioned" data-direction="asc" selected="selected">Date acquired (oldest to newest)</option>
351
352
                                                [% ELSE %]
353
                                                    <option value="dateaccessioned" data-direction="asc">Date acquired (oldest to newest)</option>
354
                                                [% END %]
355
                                            </optgroup>
343
                                        </select>
356
                                        </select>
344
357
345
                                        <input type="submit" class="btn btn-primary btn-sm" id="sort-submit" value="Resort list" />
358
                                        <input type="submit" class="btn btn-primary btn-sm" id="sort-submit" value="Resort list" />
Lines 627-632 Link Here
627
                                            [% ELSE %]
640
                                            [% ELSE %]
628
                                                <option value="dateadded">Date added</option>
641
                                                <option value="dateadded">Date added</option>
629
                                            [% END %]
642
                                            [% END %]
643
                                            [% IF shelf.sortfield == "dateaccessioned" %]
644
                                                <option value="dateaccessioned" selected="selected">Date acquired</option>
645
                                            [% ELSE %]
646
                                                <option value="dateaccessioned">Date acquired</option>
647
                                            [% END %]
630
                                        </select>
648
                                        </select>
631
                                    </li>
649
                                    </li>
632
                                    [% IF Koha.Preference('OpacAllowPublicListCreation') OR public == 1 %]
650
                                    [% IF Koha.Preference('OpacAllowPublicListCreation') OR public == 1 %]
(-)a/opac/opac-shelves.pl (-4 / +9 lines)
Lines 147-153 if ( $op eq 'add_form' ) { Link Here
147
    if ( $shelf ) {
147
    if ( $shelf ) {
148
        $op = $referer;
148
        $op = $referer;
149
        my $sortfield = $query->param('sortfield');
149
        my $sortfield = $query->param('sortfield');
150
        $sortfield = 'title' unless grep { $_ eq $sortfield } qw( title author copyrightdate itemcallnumber dateadded );
150
        $sortfield = 'title' unless grep { $_ eq $sortfield } qw( title author copyrightdate itemcallnumber dateadded dateaccessioned );
151
        if ( $shelf->can_be_managed( $loggedinuser ) ) {
151
        if ( $shelf->can_be_managed( $loggedinuser ) ) {
152
            $shelf->shelfname( scalar $query->param('shelfname') );
152
            $shelf->shelfname( scalar $query->param('shelfname') );
153
            $shelf->sortfield( $sortfield );
153
            $shelf->sortfield( $sortfield );
Lines 311-319 if ( $op eq 'view' ) { Link Here
311
                $sortfield = $shelf->sortfield;
311
                $sortfield = $shelf->sortfield;
312
                $direction = 'asc';
312
                $direction = 'asc';
313
            }
313
            }
314
            $direction = $query->param('direction') if $query->param('direction');
314
315
            # By default order descending if sorting by dateaccessioned
316
            if ( $query->param('direction') ) {
317
               $direction = $query->param('direction');
318
            } elsif ( $sortfield eq 'dateaccessioned' and !$query->param('direction') ) {
319
               $direction = 'desc';
320
            }
315
            $direction = 'asc' if !$direction or ( $direction ne 'asc' and $direction ne 'desc' );
321
            $direction = 'asc' if !$direction or ( $direction ne 'asc' and $direction ne 'desc' );
316
            $sortfield = 'title' if !$sortfield or !grep { $_ eq $sortfield } qw( title author copyrightdate itemcallnumber dateadded );
322
            $sortfield = 'title' if !$sortfield or !grep { $_ eq $sortfield } qw( title author copyrightdate itemcallnumber dateadded dateaccessioned );
317
323
318
            my ( $page, $rows );
324
            my ( $page, $rows );
319
            unless ( $query->param('print') or $query->param('rss') ) {
325
            unless ( $query->param('print') or $query->param('rss') ) {
320
- 

Return to bug 36188