Bugzilla – Attachment 128132 Details for
Bug 26296
Use new table column selection modal for OPAC suggestion fields
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26296: Use new table column selection modal for OPAC suggestion fields
Bug-26296-Use-new-table-column-selection-modal-for.patch (text/plain), 7.56 KB, created by
Owen Leonard
on 2021-12-01 15:22:08 UTC
(
hide
)
Description:
Bug 26296: Use new table column selection modal for OPAC suggestion fields
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2021-12-01 15:22:08 UTC
Size:
7.56 KB
patch
obsolete
>From d6ae33d0767e0af23ebd56156319aa113bf6e81c Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Fri, 8 Jan 2021 20:06:45 +0000 >Subject: [PATCH] Bug 26296: Use new table column selection modal for OPAC > suggestion fields > >This patch builds on the change introduced by Bug 22844, changing the >selection mode for the OPACSuggestionMandatoryFields and >OPACSuggestionUnwantedFields preferences to a modal. > >This patch includes a database update for converting the format of the >saved values in these preferences. Previously the suggestions table >fields would be separated by a comma. Now they should be separated by a >pipe. > >To test, apply the patch run the database update. > > - Go to Administration -> System preferences. > - Search for 'OPACSuggestion.' > - The input fields for OPACSuggestionUnwantedFields and > OPACSuggestionMandatoryFields should appear as "locked" (read-only) > inputs. > - Clicking either input field should trigger a modal window with > checkboxes for each available column in the suggestions table. > - Test that the "select all" and "clear all" links work correctly. > - Test that the "cancel" link closes the modal without saving your > selections. > - Test that the "Save" button closes the modal, copies your > selections to the form field, and triggers the preference-saving > function. > - Test that changes to both preferences are correctly reflected in the > OPAC suggestion form. >--- > ...th-pipe-in-OPACSuggestion-preferences.perl | 15 ++++++++++ > .../en/modules/admin/preferences/opac.pref | 28 +++---------------- > .../admin/preferences/suggestions.json | 13 +++++++++ > .../bootstrap/en/modules/opac-suggestions.tt | 2 +- > opac/opac-suggestions.pl | 4 +-- > 5 files changed, 35 insertions(+), 27 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_26296-Replace-comma-with-pipe-in-OPACSuggestion-preferences.perl > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/suggestions.json > >diff --git a/installer/data/mysql/atomicupdate/bug_26296-Replace-comma-with-pipe-in-OPACSuggestion-preferences.perl b/installer/data/mysql/atomicupdate/bug_26296-Replace-comma-with-pipe-in-OPACSuggestion-preferences.perl >new file mode 100644 >index 0000000000..d1448086f7 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_26296-Replace-comma-with-pipe-in-OPACSuggestion-preferences.perl >@@ -0,0 +1,15 @@ >+$DBversion = 'XXX'; # will be replaced by the RM >+if( CheckVersion( $DBversion ) ) { >+ # you can use $dbh here like: >+ # $dbh->do( "ALTER TABLE biblio ADD COLUMN badtaste int" ); >+ >+ # or perform some test and warn >+ # if( !column_exists( 'biblio', 'biblionumber' ) ) { >+ # warn "There is something wrong"; >+ # } >+ >+ $dbh->do("UPDATE systempreferences SET value = REPLACE(value, ',', '|') WHERE variable IN ('OPACSuggestionMandatoryFields','OPACSuggestionUnwantedFields')"); >+ >+ # Always end with this (adjust the bug info) >+ NewVersion( $DBversion, 26296, "Replace comma with pipe in OPACSuggestion field preferences"); >+} >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >index 00a1cf96a3..30855701f2 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >@@ -607,34 +607,14 @@ OPAC: > - > - "Fields that should be mandatory for patron purchase suggestions:" > - pref: OPACSuggestionMandatoryFields >- multiple: >- title: Title >- author: Author >- copyrightdate: Copyright or publication date >- isbn: ISBN, ISSN or other standard number >- publishercode: Publisher name >- collectiontitle: Collection title >- place: Publication place >- itemtype: Item type >- branch: Library or branch >- patronreason: Patron reason >- note: Note >+ type: modalselect >+ source: suggestions > - "<br />Note: if none of the above options are selected, 'Title' field would be mandatory anyway, by default." > - > - "Fields that should be hidden for patron purchase suggestions:" > - pref: OPACSuggestionUnwantedFields >- multiple: >- author: Author >- copyrightdate: Copyright or publication date >- isbn: ISBN, ISSN or other standard number >- publishercode: Publisher name >- collectiontitle: Collection title >- place: Publication place >- itemtype: Item type >- quantity: Quantity >- branch: Library or branch >- patronreason: Patron reason >- note: Note >+ type: modalselect >+ source: suggestions > - '<br />Note: Do not make <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OPACSuggestionMandatoryFields">OPACSuggestionMandatoryFields</a> unwanted fields ' > - > - pref: OpacHiddenItems >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/suggestions.json b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/suggestions.json >new file mode 100644 >index 0000000000..e351df2155 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/suggestions.json >@@ -0,0 +1,13 @@ >+{ >+ "author": "author", >+ "copyrightdate": "copyrightdate", >+ "isbn": "isbn", >+ "publishercode": "publishercode", >+ "collectiontitle": "collectiontitle", >+ "place": "place", >+ "quantity": "quantity", >+ "itemtype": "itemtype", >+ "branchcode": "branchcode", >+ "patronreason": "patronreason", >+ "note": "note" >+} >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt >index 043441d8ce..6510f492c6 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt >@@ -183,7 +183,7 @@ > [% END %] > </li> > [% END %] >- [% UNLESS ( branch_hidden )%] >+ [% UNLESS ( branchcode_hidden )%] > <li> > [% IF ( branchcode_required ) %] > <label for="branch" class="required">Library:</label> >diff --git a/opac/opac-suggestions.pl b/opac/opac-suggestions.pl >index 7c3dae9777..683c8fdcaa 100755 >--- a/opac/opac-suggestions.pl >+++ b/opac/opac-suggestions.pl >@@ -247,7 +247,7 @@ my $patron_reason_loop = GetAuthorisedValues("OPAC_SUG", "opac"); > my @mandatoryfields; > if ( $op eq 'add' ) { > my $fldsreq_sp = C4::Context->preference("OPACSuggestionMandatoryFields") || 'title'; >- @mandatoryfields = sort split(/\s*\,\s*/, $fldsreq_sp); >+ @mandatoryfields = sort split(/\s*\|\s*/, $fldsreq_sp); > foreach (@mandatoryfields) { > $template->param( $_."_required" => 1); > } >@@ -270,7 +270,7 @@ my @unwantedfields; > { > last unless ($op eq 'add'); > my $fldsreq_sp = C4::Context->preference("OPACSuggestionUnwantedFields"); >- @unwantedfields = sort split(/\s*\,\s*/, $fldsreq_sp); >+ @unwantedfields = sort split(/\s*\|\s*/, $fldsreq_sp); > foreach (@unwantedfields) { > $template->param( $_."_hidden" => 1); > } >-- >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 26296
:
114979
|
127457
|
128132
|
128133
|
128141
|
128142
|
128143
|
128538
|
128539