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

(-)a/C4/Items.pm (-1 / +2 lines)
Lines 1251-1256 sub GetItemsInfo { Link Here
1251
    my ( $biblionumber ) = @_;
1251
    my ( $biblionumber ) = @_;
1252
    my $dbh   = C4::Context->dbh;
1252
    my $dbh   = C4::Context->dbh;
1253
    # note biblioitems.* must be avoided to prevent large marc and marcxml fields from killing performance.
1253
    # note biblioitems.* must be avoided to prevent large marc and marcxml fields from killing performance.
1254
    my $branch = C4::Context->preference("DefaultItemSortOrder") || 'home';
1254
    my $query = "
1255
    my $query = "
1255
    SELECT items.*,
1256
    SELECT items.*,
1256
           biblio.*,
1257
           biblio.*,
Lines 1278-1284 sub GetItemsInfo { Link Here
1278
     LEFT JOIN biblioitems ON biblioitems.biblioitemnumber = items.biblioitemnumber
1279
     LEFT JOIN biblioitems ON biblioitems.biblioitemnumber = items.biblioitemnumber
1279
     LEFT JOIN itemtypes   ON   itemtypes.itemtype         = "
1280
     LEFT JOIN itemtypes   ON   itemtypes.itemtype         = "
1280
     . (C4::Context->preference('item-level_itypes') ? 'items.itype' : 'biblioitems.itemtype');
1281
     . (C4::Context->preference('item-level_itypes') ? 'items.itype' : 'biblioitems.itemtype');
1281
    $query .= " WHERE items.biblionumber = ? ORDER BY home.branchname, items.enumchron, LPAD( items.copynumber, 8, '0' ), items.dateaccessioned DESC" ;
1282
    $query .= " WHERE items.biblionumber = ? ORDER BY $branch.branchname, items.enumchron, LPAD( items.copynumber, 8, '0' ), items.dateaccessioned DESC" ;
1282
    my $sth = $dbh->prepare($query);
1283
    my $sth = $dbh->prepare($query);
1283
    $sth->execute($biblionumber);
1284
    $sth->execute($biblionumber);
1284
    my $i = 0;
1285
    my $i = 0;
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 89-94 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
89
('decreaseLoanHighHoldsDuration',NULL,'','Specifies a number of days that a loan is reduced to when used in conjunction with decreaseLoanHighHolds','Integer'),
89
('decreaseLoanHighHoldsDuration',NULL,'','Specifies a number of days that a loan is reduced to when used in conjunction with decreaseLoanHighHolds','Integer'),
90
('decreaseLoanHighHoldsValue',NULL,'','Specifies a threshold for the minimum number of holds needed to trigger a reduction in loan duration (used with decreaseLoanHighHolds)','Integer'),
90
('decreaseLoanHighHoldsValue',NULL,'','Specifies a threshold for the minimum number of holds needed to trigger a reduction in loan duration (used with decreaseLoanHighHolds)','Integer'),
91
('DefaultClassificationSource','ddc',NULL,'Default classification scheme used by the collection. E.g., Dewey, LCC, etc.','ClassSources'),
91
('DefaultClassificationSource','ddc',NULL,'Default classification scheme used by the collection. E.g., Dewey, LCC, etc.','ClassSources'),
92
('DefaultItemSortOrder', 'home', 'home|holding', 'Define the default sort order for items.', 'Choice' ),
92
('DefaultLanguageField008','','','Fill in the default language for field 008 Range 35-37 of MARC21 records (e.g. eng, nor, ger, see <a href=\"http://www.loc.gov/marc/languages/language_code.html\">MARC Code List for Languages</a>)','Free'),
93
('DefaultLanguageField008','','','Fill in the default language for field 008 Range 35-37 of MARC21 records (e.g. eng, nor, ger, see <a href=\"http://www.loc.gov/marc/languages/language_code.html\">MARC Code List for Languages</a>)','Free'),
93
('defaultSortField','relevance','relevance|popularity|call_number|pubdate|acqdate|title|author','Specify the default field used for sorting','Choice'),
94
('defaultSortField','relevance','relevance|popularity|call_number|pubdate|acqdate|title|author','Specify the default field used for sorting','Choice'),
94
('defaultSortOrder','dsc','asc|dsc|az|za','Specify the default sort order','Choice'),
95
('defaultSortOrder','dsc','asc|dsc|az|za','Specify the default sort order','Choice'),
(-)a/installer/data/mysql/updatedatabase.pl (+10 lines)
Lines 8120-8125 if ( CheckVersion($DBversion) ) { Link Here
8120
    SetVersion($DBversion);
8120
    SetVersion($DBversion);
8121
}
8121
}
8122
8122
8123
$DBversion = "3.15.00.XXX";
8124
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
8125
    $dbh->do(q{
8126
        INSERT INTO systempreferences ( variable, value, options, explanation, type ) VALUES ( 'DefaultItemSortOrder', 'home', 'home|holding', 'Define the default sort order for items.', 'Choice' );
8127
    });
8128
    print "Upgrade to $DBversion done (Bug 9264 - Make getitems default sort to set by a preference instead of hard coded to homebranch.)\n";
8129
    SetVersion ($DBversion);
8130
}
8131
8132
8123
=head1 FUNCTIONS
8133
=head1 FUNCTIONS
8124
8134
8125
=head2 TableExists($table)
8135
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref (-1 / +8 lines)
Lines 187-189 Searching: Link Here
187
            - Use the following text as separator for UNIMARC authors facets
187
            - Use the following text as separator for UNIMARC authors facets
188
            - pref: UNIMARCAuthorsFacetsSeparator
188
            - pref: UNIMARCAuthorsFacetsSeparator
189
              class: short
189
              class: short
190
- 
190
        -
191
            - The default sort order for items should be by the item's
192
            - pref: DefaultItemSortOrder
193
              type: choice
194
              default: home
195
              choices:
196
                  home: "home library"
197
                  holding: "holding library"

Return to bug 9264