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,
Created attachment 3750 [details] [review] Proposed patch
Created attachment 4139 [details] [review] BUG6092 default sort field and order when syspref are NULL Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
(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.
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.
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');
Fridolyn, could you perhaps resubmit this patch with changes to the syspref.sql file?
Fixed by another patch