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 348-353 Link Here
348
                                                    <option value="dateadded" data-direction="asc">Date added (oldest to newest)</option>
348
                                                    <option value="dateadded" data-direction="asc">Date added (oldest to newest)</option>
349
                                                [% END %]
349
                                                [% END %]
350
                                            </optgroup>
350
                                            </optgroup>
351
                                            <optgroup label="Date acquired">
352
                                                [% IF sortfield == "dateaccessioned" && direction == 'asc' %]
353
                                                    <option value="dateaccessioned" data-direction="desc" selected="selected">Date acquired (newest to oldest)</option>
354
                                                [% ELSE %]
355
                                                    <option value="dateaccessioned" data-direction="desc">Date acquired (newest to oldest)</option>
356
                                                [% END %]
357
                                                [% IF sortfield == "dateaccessioned" && direction == 'desc' %]
358
                                                    <option value="dateaccessioned" data-direction="asc" selected="selected">Date acquired (oldest to newest)</option>
359
360
                                                [% ELSE %]
361
                                                    <option value="dateaccessioned" data-direction="asc">Date acquired (oldest to newest)</option>
362
                                                [% END %]
363
                                            </optgroup>
351
                                        </select>
364
                                        </select>
352
365
353
                                        <input type="submit" class="btn btn-primary btn-sm" id="sort-submit" value="Resort list" />
366
                                        <input type="submit" class="btn btn-primary btn-sm" id="sort-submit" value="Resort list" />
Lines 606-611 Link Here
606
                                            [% ELSE %]
619
                                            [% ELSE %]
607
                                                <option value="dateadded">Date added</option>
620
                                                <option value="dateadded">Date added</option>
608
                                            [% END %]
621
                                            [% END %]
622
                                            [% IF shelf.sortfield == "dateaccessioned" %]
623
                                                <option value="dateaccessioned" selected="selected">Date acquired</option>
624
                                            [% ELSE %]
625
                                                <option value="dateaccessioned">Date acquired</option>
626
                                            [% END %]
609
                                        </select>
627
                                        </select>
610
                                    </li>
628
                                    </li>
611
                                    [% IF Koha.Preference('OpacAllowPublicListCreation') OR public == 1 %]
629
                                    [% IF Koha.Preference('OpacAllowPublicListCreation') OR public == 1 %]
(-)a/opac/opac-shelves.pl (-4 / +9 lines)
Lines 148-154 if ( $op eq 'add_form' ) { Link Here
148
    if ( $shelf ) {
148
    if ( $shelf ) {
149
        $op = $referer;
149
        $op = $referer;
150
        my $sortfield = $query->param('sortfield');
150
        my $sortfield = $query->param('sortfield');
151
        $sortfield = 'title' unless grep { $_ eq $sortfield } qw( title author copyrightdate itemcallnumber dateadded );
151
        $sortfield = 'title' unless grep { $_ eq $sortfield } qw( title author copyrightdate itemcallnumber dateadded dateaccessioned );
152
        if ( $shelf->can_be_managed( $loggedinuser ) ) {
152
        if ( $shelf->can_be_managed( $loggedinuser ) ) {
153
            $shelf->shelfname( scalar $query->param('shelfname') );
153
            $shelf->shelfname( scalar $query->param('shelfname') );
154
            $shelf->sortfield( $sortfield );
154
            $shelf->sortfield( $sortfield );
Lines 312-320 if ( $op eq 'view' ) { Link Here
312
                $sortfield = $shelf->sortfield;
312
                $sortfield = $shelf->sortfield;
313
                $direction = 'asc';
313
                $direction = 'asc';
314
            }
314
            }
315
            $direction = $query->param('direction') if $query->param('direction');
315
316
            # By default order descending if sorting by dateaccessioned
317
            if ( $query->param('direction') ) {
318
               $direction = $query->param('direction');
319
            } elsif ( $sortfield eq 'dateaccessioned' and !$query->param('direction') ) {
320
               $direction = 'desc';
321
            }
316
            $direction = 'asc' if !$direction or ( $direction ne 'asc' and $direction ne 'desc' );
322
            $direction = 'asc' if !$direction or ( $direction ne 'asc' and $direction ne 'desc' );
317
            $sortfield = 'title' if !$sortfield or !grep { $_ eq $sortfield } qw( title author copyrightdate itemcallnumber dateadded );
323
            $sortfield = 'title' if !$sortfield or !grep { $_ eq $sortfield } qw( title author copyrightdate itemcallnumber dateadded dateaccessioned );
318
324
319
            my $rows;
325
            my $rows;
320
            unless ( $query->param('print') or $query->param('rss') ) {
326
            unless ( $query->param('print') or $query->param('rss') ) {
321
- 

Return to bug 36188