@@ -, +, @@ -Apply patch -Check OPACSuggestionUnwantedFields -Check some fields as unwanted -Go to the OPAC suggestion page and make sure these correct fields are hidden -Go through each option and make sure it hides properly --- ...0_add_OPACSuggestionUnwantedFields_syspref.perl | 8 + installer/data/mysql/sysprefs.sql | 1 + .../prog/en/modules/admin/preferences/opac.pref | 16 ++ .../bootstrap/en/modules/opac-suggestions.tt | 186 ++++++++++++--------- opac/opac-suggestions.pl | 10 ++ 5 files changed, 139 insertions(+), 82 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_23420_add_OPACSuggestionUnwantedFields_syspref.perl --- a/installer/data/mysql/atomicupdate/bug_23420_add_OPACSuggestionUnwantedFields_syspref.perl +++ a/installer/data/mysql/atomicupdate/bug_23420_add_OPACSuggestionUnwantedFields_syspref.perl @@ -0,0 +1,8 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + $dbh->do(q{ + INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`, `type`) VALUES ('OPACSuggestionUnwantedFields','', NULL,'Define the hidden fields for a patron purchase suggestions made via OPAC.','multiple'); + }); + NewVersion($DBversion, 23420, "Allow configuration of hidden fields on the suggestion form in OPAC"); +} + --- a/installer/data/mysql/sysprefs.sql +++ a/installer/data/mysql/sysprefs.sql @@ -451,6 +451,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('OPACShowUnusedAuthorities','1','','Show authorities that are not being used in the OPAC.','YesNo'), ('OpacStarRatings','all','disable|all|details',NULL,'Choice'), ('OpacSuggestionManagedBy',1,'','Show the name of the staff member who managed a suggestion in OPAC','YesNo'), +('OPACSuggestionUnwantedFields',NULL,'','Define the hidden fields for a patron purchase suggestions made via OPAC.','multiple'), ('OpacSuppression','0','','Turn ON the OPAC Suppression feature, requires further setup, ask your system administrator for details','YesNo'), ('OpacSuppressionByIPRange','','','Restrict the suppression to IP adresses outside of the IP range','free'), ('OpacSuppressionMessage','','Display this message on the redirect page for suppressed biblios','70|10','Textarea'), --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref @@ -630,6 +630,22 @@ OPAC: note: Note - "
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 + - "
Note: Do not make OPACSuggestionMandatoryFields unwanted fields " + - - pref: OpacHiddenItems type: textarea syntax: text/x-yaml --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt +++ a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt @@ -76,79 +76,94 @@ [% END %] -
  • - [% IF ( author_required ) %] - - - Required - [% ELSE %] - - - [% END %] -
  • -
  • -
    - [% IF ( copyrightdate_required ) %] - - - Required + [% UNLESS ( author_hidden ) %] +
  • + [% IF ( author_required ) %] + + + Required + [% ELSE %] + + + [% END %] +
  • + [% END %] + [% UNLESS ( copyrightdate_hidden )%] +
  • +
    + [% IF ( copyrightdate_required ) %] + + + Required + [% ELSE %] + + + [% END %] +
    +
  • + [% END %] + [% UNLESS ( isbn_hidden )%] +
  • + [% IF ( isbn_required ) %] + + + Required [% ELSE %] - - + + [% END %] - -
  • -
  • - [% IF ( isbn_required ) %] - - - Required - [% ELSE %] - - - [% END %] -
  • -
  • - [% IF ( publishercode_required ) %] - - - Required - [% ELSE %] - - - [% END %] -
  • -
  • - [% IF ( collectiontitle_required ) %] - - - Required - [% ELSE %] - - - [% END %] -
  • -
  • - [% IF ( place_required ) %] - - - Required - [% ELSE %] - - - [% END %] -
  • -
  • - [% IF ( quantity_required ) %] - - - Required - [% ELSE %] - - - [% END %] -
  • -
  • +
  • + [% END %] + [% UNLESS ( publishercode_hidden ) %] +
  • + [% IF ( publishercode_required ) %] + + + Required + [% ELSE %] + + + [% END %] +
  • + [% END %] + [% UNLESS ( collectiontitle_hidden ) %] +
  • + [% IF ( collectiontitle_required ) %] + + + Required + [% ELSE %] + + + [% END %] +
  • + [% END %] + [% UNLESS ( place_hidden ) %] +
  • + [% IF ( place_required ) %] + + + Required + [% ELSE %] + + + [% END %] +
  • + [% END %] + [% UNLESS ( quantity_hidden ) %] +
  • + [% IF ( quantity_required ) %] + + + Required + [% ELSE %] + + + [% END %] +
  • + [% END %] + [% UNLESS ( itemtype_hidden )%] +
  • [% IF ( itemtype_required ) %] [% PROCESS 'av-build-dropbox.inc' name="itemtype", category="SUGGEST_FORMAT", size = 20 %] @@ -157,8 +172,10 @@ [% PROCESS 'av-build-dropbox.inc' name="itemtype", category="SUGGEST_FORMAT", size = 20 %] [% END %] -
  • + + [% END %] [% IF branchcode %] + [% UNLESS ( branchcode_hidden )%]
  • [% IF ( branchcode_required ) %] @@ -174,7 +191,9 @@ [% END %]
  • [% END %] + [% END %] [% IF ( patron_reason_loop ) %] + [% UNLESS ( patronreason_hidden )%]
  • [% IF ( patronreason_required ) %] @@ -196,16 +215,19 @@ [% END %]
  • [% END %] -
  • - [% IF ( note_required ) %] - - - Required - [% ELSE %] - - - [% END %] -
  • + [% END %] + [% UNLESS ( note_hidden ) %] +
  • + [% IF ( note_required ) %] + + + Required + [% ELSE %] + + + [% END %] +
  • + [% END %]
  • --- a/opac/opac-suggestions.pl +++ a/opac/opac-suggestions.pl @@ -256,6 +256,16 @@ my @mandatoryfields; } } +my @unwantedfields; +{ + last unless ($op eq 'add'); + my $fldsreq_sp = C4::Context->preference("OPACSuggestionUnwantedFields"); + @unwantedfields = sort split(/\s*\,\s*/, $fldsreq_sp); + foreach (@unwantedfields) { + $template->param( $_."_hidden" => 1); + } +} + $template->param( %$suggestion, suggestions_loop => $suggestions_loop, --