@@ -, +, @@ Make sure to have subscriptions starting with "The An A" or similar Add the words "The An A" or the ones you used in your subscriptions --- .../BugUndef-SerialSortIgnoreWords.sql | 1 + installer/data/mysql/sysprefs.sql | 1 + .../prog/en/modules/admin/preferences/serials.pref | 5 ++++ .../prog/en/modules/serials/serials-search.tt | 7 +++++- serials/serials-search.pl | 27 +++++++++++++++++++--- 5 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/BugUndef-SerialSortIgnoreWords.sql --- a/installer/data/mysql/atomicupdate/BugUndef-SerialSortIgnoreWords.sql +++ a/installer/data/mysql/atomicupdate/BugUndef-SerialSortIgnoreWords.sql @@ -0,0 +1, @@ +INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES ('SerialSortIgnoreWords','',NULL,'Words to ignore in serial search','Free'); --- a/installer/data/mysql/sysprefs.sql +++ a/installer/data/mysql/sysprefs.sql @@ -475,6 +475,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('SelfCheckTimeout','120','','Define the number of seconds before the Web-based Self Checkout times out a patron','Integer'), ('SeparateHoldings','0',NULL,'Separate current branch holdings from other holdings','YesNo'), ('SeparateHoldingsBranch','homebranch','homebranch|holdingbranch','Branch used to separate holdings','Choice'), +('SerialSortIgnoreWords','des du de la le les leur d l an a the',NULL,'Words to ignore in serial search','Free'), ('SessionRestrictionByIP','1','Check for change in remote IP address for session security. Disable only when remote IP address changes frequently.','','YesNo'), ('SessionStorage','mysql','mysql|Pg|tmp','Use database or a temporary file for storing session data','Choice'), ('ShelfBrowserUsesCcode','1','0','Use the item collection code when finding items for the shelf browser.','YesNo'), --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/serials.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/serials.pref @@ -56,3 +56,8 @@ Serials: yes: Make no: Do not make - previous serial automatically available when receiving a new serial issue. The previous issue can also be set to another item type when receiving a new one. Please note that the item-level_itypes syspref must be set to specific item. + - + - 'Ignore the following words when sorting the serial search result table (separate words with spaces) :' + - pref: SerialSortIgnoreWords + class: free + - --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-search.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-search.tt @@ -13,6 +13,8 @@ var osrlt = $("#osrlt").dataTable($.extend(true, {}, dataTablesDefaults, { "sPaginationType": "four_button", "aoColumnDefs": [ + { 'visible' : false, "targets" : 0}, + { "iDataSort" : 0, 'aTargets' : [ 2 ] }, { 'bSortable': false, "bSearchable": false, 'aTargets': [ 'NoSort' ] }, { "sType": "title-string", "aTargets" : [ "title-string" ] }, { 'sType': "anti-the", 'aTargets' : [ 'anti-the'] } @@ -36,6 +38,7 @@ return confirm(_("Are you sure you want to reopen this subscription?")); }); }); + $ //]]> @@ -142,6 +145,7 @@ + @@ -167,13 +171,14 @@ [% FOR field IN additional_fields_for_subscription %] [% END %] - + [% FOREACH subscription IN openedsubscriptions %] [% UNLESS subscription.cannotdisplay %] +
Sort ISSN Title Notes
[% IF ( subscription.titlesort ) %][% subscription.titlesort %][% END %] [% IF ( subscription.issn ) %][% subscription.issn %] [% END %] --- a/serials/serials-search.pl +++ a/serials/serials-search.pl @@ -37,6 +37,9 @@ use C4::Output; use C4::Serials; use Koha::AdditionalField; +use Encode; +use Unicode::Normalize; + use Koha::DateUtils; my $query = new CGI; @@ -119,11 +122,29 @@ if ($routing) { } } +#sort stopword by string length +my @sortedstopword = sort{ length $b <=> length $a } split ( / / ,C4::Context->preference("SerialSortIgnoreWords")); +my $subsctitle; my (@openedsubscriptions, @closedsubscriptions); for my $sub ( @subscriptions ) { - unless ( $sub->{closed} ) { - push @openedsubscriptions, $sub - unless $sub->{cannotdisplay}; + $subsctitle = $sub->{title} ? ucfirst($sub->{title}): '' ; + if ($subsctitle){ + $subsctitle = NFKD($subsctitle); + $subsctitle =~ s/\p{NonspacingMark}//g; + foreach my $stop (@sortedstopword){ + my $ucfirststop = ucfirst($stop); + $subsctitle =~ s/$ucfirststop'//; + $subsctitle =~ s/$ucfirststop //; + } + } + $subsctitle =~ s/^\s+//; + $sub->{titlesort} = ucfirst($subsctitle); + + warn $subsctitle; + + unless ( $sub->{closed} ) { + push @openedsubscriptions, $sub + unless $sub->{cannotdisplay}; } else { push @closedsubscriptions, $sub unless $sub->{cannotdisplay}; --