Bugzilla – Attachment 117429 Details for
Bug 27316
In mappings use yes/no for sortable
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27316: Convert 'undef' for sort to Yes and use Yes/No instead of 0/1
Bug-27316-Convert-undef-for-sort-to-Yes-and-use-Ye.patch (text/plain), 4.86 KB, created by
Martin Renvoize (ashimema)
on 2021-03-01 10:00:06 UTC
(
hide
)
Description:
Bug 27316: Convert 'undef' for sort to Yes and use Yes/No instead of 0/1
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2021-03-01 10:00:06 UTC
Size:
4.86 KB
patch
obsolete
>From 662d33c4d2c0c1c7d2e55be8128e3863d7b86bb3 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 7 Jan 2021 20:14:33 +0000 >Subject: [PATCH] Bug 27316: Convert 'undef' for sort to Yes and use Yes/No > instead of 0/1 > >This patch changes the interface to remove the undef option >We also update existing mappings and set default of 1 > >Comment previously indicated undef was treated differently, but in the code we treat undef as 1 >That code is untoched to avoid creating problems for older mappings that may be reloaded > >To test: >1 - View the ES mappings, note you can set columns to Undef, 0, 1 >2 - Set some to undef >3 - Apply patches >4 - Update database >5 - Undef now show as 'Yes' >6 - Confirm you can set columns as Yes/no >7 - Confirm that mandatory columns display correct value when readonly (see issues field) > >Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > .../bug_23716_update_sort_mappings.perl | 6 +++++ > .../searchengine/elasticsearch/mappings.tt | 22 ++++++++----------- > 2 files changed, 15 insertions(+), 13 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_23716_update_sort_mappings.perl > >diff --git a/installer/data/mysql/atomicupdate/bug_23716_update_sort_mappings.perl b/installer/data/mysql/atomicupdate/bug_23716_update_sort_mappings.perl >new file mode 100644 >index 0000000000..b1c41bc065 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_23716_update_sort_mappings.perl >@@ -0,0 +1,6 @@ >+$DBversion = 'XXX'; >+if( CheckVersion( $DBversion ) ) { >+ $dbh->do( "UPDATE search_marc_to_field SET sort = 1 WHERE sort IS NULL" ); >+ $dbh->do( "ALTER TABLE search_marc_to_field MODIFY COLUMN sort tinyint(1) DEFAULT 1 NOT NULL COMMENT 'Sort defaults to 1 (Yes) and creates sort fields in the index, 0 (no) will prevent this'" ); >+ NewVersion( $DBversion, 27316, "In Elastisearch mappings convert NULL (Undef) for sort to 1 (Yes)"); >+} >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/searchengine/elasticsearch/mappings.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/searchengine/elasticsearch/mappings.tt >index 81beb1d311..202bb0bc11 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/searchengine/elasticsearch/mappings.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/searchengine/elasticsearch/mappings.tt >@@ -253,7 +253,11 @@ a.add, a.delete { > [% mapping.search_field_label | html %] > </td> > <td> >- <input type="hidden" name="mapping_sort" value="[% mapping.sort | html %]" readonly />[% IF mapping.sort == 'undef' %]Undef[% ELSE %][% mapping.sort | html %][% END %] >+ [% IF mapping.sort == 0 %] >+ <input type="hidden" name="mapping_sort" value="0" readonly />No >+ [% ELSE %] >+ <input type="hidden" name="mapping_sort" value="1" readonly />Yes >+ [% END %] > </td> > <td> > <input type="hidden" name="mapping_facet" value="[% mapping.facet | html %]" readonly />[% IF mapping.facet == 1 %]Yes[% ELSE %]No[% END %] >@@ -277,20 +281,12 @@ a.add, a.delete { > </td> > <td> > <select name="mapping_sort"> >- [% IF mapping.sort == 'undef' %] >- <option value="undef" selected="selected">Undef</option> >- [% ELSE %] >- <option value="undef">Undef</option> >- [% END %] > [% IF mapping.sort == 0 %] >- <option value="0" selected="selected">0</option> >- [% ELSE %] >- <option value="0">0</option> >- [% END %] >- [% IF mapping.sort == 1 %] >- <option value="1" selected="selected">1</option> >+ <option value="0" selected="selected">No</option> >+ <option value="1">Yes</option> > [% ELSE %] >- <option value="1">1</option> >+ <option value="0">No</option> >+ <option value="1" selected="selected">Yes</option> > [% END %] > </select> > </td> >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 27316
:
114743
|
114752
|
114943
|
114955
|
115938
|
115939
| 117429 |
117430