Bug 6092 - default sort field and order when syspref are NULL
Summary: default sort field and order when syspref are NULL
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: System Administration (show other bugs)
Version: master
Hardware: All All
: PATCH-Sent (DO NOT USE) normal (vote)
Assignee: Fridolin Somers
QA Contact: Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-06 14:42 UTC by Fridolin Somers
Modified: 2013-12-05 20:04 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Text to go in the release notes:
Version(s) released in:


Attachments
Proposed patch (4.79 KB, patch)
2011-04-06 14:45 UTC, Fridolin Somers
Details | Diff | Splinter Review
BUG6092 default sort field and order when syspref are NULL (4.84 KB, patch)
2011-05-17 08:04 UTC, Chris Cormack
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Fridolin Somers 2011-04-06 14:42:09 UTC
Database installer "en" and others, initialize sysprefs (OPAC)defaultSortField and (OPAC)defaultSortOrder with NULL.

I added "relevance" and "dsc" as default values in .pref file and in perl pages.
Because it is the natural sort order of search results.

I think it's the best way to avoid bugs.

Regards,
Comment 1 Fridolin Somers 2011-04-06 14:45:17 UTC Comment hidden (obsolete)
Comment 2 Chris Cormack 2011-05-17 08:04:46 UTC
Created attachment 4139 [details] [review]
BUG6092 default sort field and order when syspref are NULL

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Comment 3 Fridolin Somers 2011-05-17 09:14:21 UTC
(In reply to comment #2)
> Created attachment 4139 [details] [review]
> BUG6092 default sort field and order when syspref are NULL
> 
> Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>

Hie,

Is the first patch obsolete ?
I bet yes.
Comment 4 Paul Poulain 2011-08-10 09:39:29 UTC
QA comment

This patch does not apply anymore. I think it must be completly rewritten. The conflict says :
<<<<<<< HEAD
    if (   C4::Context->preference('OPACdefaultSortField')
        && C4::Context->preference('OPACdefaultSortOrder') ) {
        my $default_sort_by =
            C4::Context->preference('defaultSortField') . '_'
          . C4::Context->preference('defaultSortOrder');
        $template->param( $default_sort_by => 1 );
    }
=======
    $template->param($default_sort_by => 1);
>>>>>>> BUG6092 default sort field and order when syspref are NULL

=> the default sort order is set only if the syspref have been set, so the 
my $default_sort_field = C4::Context->preference('defaultSortField') || 'relevance'; # relevance field by default
my $default_sort_order = C4::Context->preference('defaultSortOrder') || 'dsc'; # decreasing order by default
my $default_sort_by = $default_sort_field.'_'.$default_sort_order;

will do nothing.
Comment 5 Katrin Fischer 2012-06-11 15:36:50 UTC
I think this still needs a fix:

 157 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('defaultSortField',NULL,'Specify the default field used for sorting','relevance|popularity|call_number|pubdate|acqdate|title|author','Choice');
 158 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('defaultSortOrder',NULL,'Specify the default sort order','asc|dsc|az|za','Choice');
Comment 6 Katrin Fischer 2012-06-11 15:49:32 UTC
Fridolyn, could you perhaps resubmit this patch with changes to the syspref.sql file?
Comment 7 Chris Cormack 2013-01-01 23:46:35 UTC
Fixed by another patch