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 350-355 Link Here
350
                                                    <option value="dateadded" data-direction="asc">Date added (oldest to newest)</option>
350
                                                    <option value="dateadded" data-direction="asc">Date added (oldest to newest)</option>
351
                                                [% END %]
351
                                                [% END %]
352
                                            </optgroup>
352
                                            </optgroup>
353
                                            <optgroup label="Date acquired">
354
                                                [% IF sortfield == "dateaccessioned" && direction == 'asc' %]
355
                                                    <option value="dateaccessioned" data-direction="desc" selected="selected">Date acquired (newest to oldest)</option>
356
                                                [% ELSE %]
357
                                                    <option value="dateaccessioned" data-direction="desc">Date acquired (newest to oldest)</option>
358
                                                [% END %]
359
                                                [% IF sortfield == "dateaccessioned" && direction == 'desc' %]
360
                                                    <option value="dateaccessioned" data-direction="asc" selected="selected">Date acquired (oldest to newest)</option>
361
362
                                                [% ELSE %]
363
                                                    <option value="dateaccessioned" data-direction="asc">Date acquired (oldest to newest)</option>
364
                                                [% END %]
365
                                            </optgroup>
353
                                        </select>
366
                                        </select>
354
367
355
                                        <input type="submit" class="btn btn-primary btn-sm" id="sort-submit" value="Resort list" />
368
                                        <input type="submit" class="btn btn-primary btn-sm" id="sort-submit" value="Resort list" />
Lines 608-613 Link Here
608
                                            [% ELSE %]
621
                                            [% ELSE %]
609
                                                <option value="dateadded">Date added</option>
622
                                                <option value="dateadded">Date added</option>
610
                                            [% END %]
623
                                            [% END %]
624
                                            [% IF shelf.sortfield == "dateaccessioned" %]
625
                                                <option value="dateaccessioned" selected="selected">Date acquired</option>
626
                                            [% ELSE %]
627
                                                <option value="dateaccessioned">Date acquired</option>
628
                                            [% END %]
611
                                        </select>
629
                                        </select>
612
                                    </li>
630
                                    </li>
613
                                    [% IF Koha.Preference('OpacAllowPublicListCreation') OR public == 1 %]
631
                                    [% 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
            if ( $query->param('print') or $query->param('rss') ) {
326
            if ( $query->param('print') or $query->param('rss') ) {
321
- 

Return to bug 36188