Bug 15311 - Let libraries set text to display when OpacMaintenance = on
Summary: Let libraries set text to display when OpacMaintenance = on
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Barry Cannon
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 25756
  Show dependency treegraph
 
Reported: 2015-12-04 18:26 UTC by Magnus Enger
Modified: 2020-06-24 12:51 UTC (History)
8 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Text to go in the release notes:
Version(s) released in:


Attachments
Patch to enable OpacMaintenanceNotice systempreference (6.69 KB, patch)
2015-12-15 17:01 UTC, Barry Cannon
Details | Diff | Splinter Review
Bug 15311 - Let libraries set text to display when OpacMaintenance = on (6.64 KB, patch)
2015-12-15 22:02 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Patch to enable OpacMaintenanceNotice systempreference (6.08 KB, patch)
2015-12-16 10:42 UTC, Barry Cannon
Details | Diff | Splinter Review
0001-Bug-15311-Let-libraries-set-text-to-display-when-Opa.patch (6.75 KB, patch)
2016-02-03 23:17 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 15311 - Let libraries set text to display when OpacMaintenance = on (6.73 KB, patch)
2016-02-08 20:10 UTC, Aleisha Amohia
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 15311 - Let libraries set text to display when OpacMaintenance = on (6.95 KB, patch)
2016-02-08 23:47 UTC, Mark Tompsett
Details | Diff | Splinter Review
Bug 15311 - Let libraries set text to display when OpacMaintenance = on (7.01 KB, patch)
2016-02-09 10:45 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 15311 [QA Followup] - Remove use of .raw method as it's use was reverted (1.34 KB, patch)
2016-02-26 14:21 UTC, Kyle M Hall
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Magnus Enger 2015-12-04 18:26:57 UTC
Setting OpacMaintenance = on displays a standard message in the OPAC. It would be easy to add another syspref that could take arbitrary text to be displayed as well.
Comment 1 Barry Cannon 2015-12-15 17:01:32 UTC Comment hidden (obsolete)
Comment 2 Barry Cannon 2015-12-15 17:02:07 UTC
Added new systempreference OpacMaintenanceNotice.
When OpacMaintenance is ON the HTML contents of OpacMaintenanceNotice will
be displayed.
Enabling OpacMaintenance is all that is required to enable this preference.
If OpacMaintenanceNotice is undefined, the default (original) notice will
appear when OpacMaintenance is enabled.

To test:
- Enable OpacMaintenance systempreference
- Observe the default maintenance message when OPAC is viewed
- Edit OpacMaintenanceNotice systempreference, adding custom HTML
- Observe the custom HTML appear on the opac
- Remove OpacMaintenanceNotice (mindful of orphaned spaces etc.)
- Observe the default opac notice appears in the opac
- Disable OpacMaintenance
- Observce opac is back online
Comment 3 Aleisha Amohia 2015-12-15 22:02:10 UTC Comment hidden (obsolete)
Comment 4 Jonathan Druart 2015-12-16 09:41:43 UTC
Comment on attachment 45712 [details] [review]
Bug 15311 - Let libraries set text to display when OpacMaintenance = on

Review of attachment 45712 [details] [review]:
-----------------------------------------------------------------

It would have been great to use the new table localization and create a new area in the admin module to let libraries define several values for this text, depending on the language used.

::: installer/data/mysql/updatedatabase.pl
@@ +11393,5 @@
> +$DBversion = "3.23.00.XXX";
> +if(CheckVersion($DBversion)) {
> +    $dbh->do(q{
> +        INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type)
> +        VALUES ('OpacMaintenanceNotice','','70|10','A user-defined block of HTML to appear on screen when OpacMaintenace is enabled','Textarea')

what is 70|10?
explanation and options don't seem in the correct order.

::: opac/maintenance.pl
@@ +33,5 @@
>  $koha_db_version =~ s/\.//g if defined $koha_db_version;
> +my $maintenance_notice = C4::Context->preference('OpacMaintenanceNotice');
> +
> +$template->param(
> +    maintenance_notice => $maintenance_notice

Don't pass it to the template, use the Koha template plugin to access syspref values (Koha.Preference)
Comment 5 Barry Cannon 2015-12-16 10:42:11 UTC Comment hidden (obsolete)
Comment 6 Magnus Enger 2015-12-16 11:26:44 UTC
Should this be set back to Needs signoff or Signed off? 

Thanks to everyone contributing to realising my little idea! :-)
Comment 7 Aleisha Amohia 2016-01-12 23:52:08 UTC
CONFLICT (content): Merge conflict in installer/data/mysql/updatedatabase.pl
Comment 8 Marc Véron 2016-01-25 19:29:57 UTC
(In reply to Aleisha Amohia from comment #7)
> CONFLICT (content): Merge conflict in installer/data/mysql/updatedatabase.pl

I think that the part in /installer/data/mysql/updatedatabase.pl should go to an atomic update, see:
http://wiki.koha-community.org/wiki/Database_updates#updatedatabase.pl
Comment 9 Aleisha Amohia 2016-01-25 21:59:16 UTC
Will set to Failed QA until the move to an atomic update is made. Set back to Needs Signoff when that's done so I can come test it again :)
Comment 10 Aleisha Amohia 2016-02-03 23:17:49 UTC Comment hidden (obsolete)
Comment 11 Mirko Tietgen 2016-02-05 06:24:12 UTC
(In reply to Aleisha Amohia from comment #10)

> Sponsored-by: Catalyst IT

Was that on purpose? Claiming a patch somebody else wrote to be sponsored by Catalyst because you fixed a conflict does not seem like a nice move. In fact support companies do not really put that line in for their own stuff, just for things sponsored by third parties.
Comment 12 Aleisha Amohia 2016-02-05 06:37:21 UTC
(In reply to Mirko Tietgen from comment #11)
> (In reply to Aleisha Amohia from comment #10)
> 
> > Sponsored-by: Catalyst IT
> 
> Was that on purpose? Claiming a patch somebody else wrote to be sponsored by
> Catalyst because you fixed a conflict does not seem like a nice move. In
> fact support companies do not really put that line in for their own stuff,
> just for things sponsored by third parties.

No I'm sorry that was a complete accident! I was trying to get in to the habit of adding it and did it without thinking! Sorry it looks so bad I did not mean to claim the patch :( I'll remove it when I get in to work on Tuesday
Comment 13 Katrin Fischer 2016-02-08 20:03:23 UTC
Aleisha, don't worry about it. If you don't get around to it, we can fix it too later on. - Or the person fixing the database update can.
Comment 14 Aleisha Amohia 2016-02-08 20:10:25 UTC Comment hidden (obsolete)
Comment 15 Mark Tompsett 2016-02-08 23:47:21 UTC Comment hidden (obsolete)
Comment 16 Magnus Enger 2016-02-09 05:32:54 UTC
Looks like Mark forgot to change the status. :-)
Comment 17 Jonathan Druart 2016-02-09 10:45:10 UTC
Created attachment 47788 [details] [review]
Bug 15311 - Let libraries set text to display when OpacMaintenance = on

Added new systempreference OpacMaintenanceNotice.
When OpacMaintenance is ON the HTML contents of OpacMaintenanceNotice will
be displayed.
Enabling OpacMaintenance is all that is required to enable this preference.
If OpacMaintenanceNotice is undefined, the default (original) notice will
appear when OpacMaintenance is enabled.

To test:
- Enable OpacMaintenance systempreference
- Observe the default maintenance message when OPAC is viewed
- Edit OpacMaintenanceNotice systempreference, adding custom HTML
- Observe the custom HTML appear on the opac
- Remove OpacMaintenanceNotice (mindful of orphaned spaces etc.)
- Observe the default opac notice appears in the opac
- Disable OpacMaintenance
- Observce opac is back online

Moving code to atomic update and fixing merge conflict

NOTE: Accounted for an SQL typo and autoescaping of the template.
      If someone else could test this, then I would be fine with
      marking it signed off.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 18 Mark Tompsett 2016-02-09 14:19:18 UTC
(In reply to Magnus Enger from comment #16)
> Looks like Mark forgot to change the status. :-)

No, I figured since I squashed my changes in, that a secondary sign would be a good idea.
Comment 19 Kyle M Hall 2016-02-26 14:21:59 UTC
Created attachment 48400 [details] [review]
Bug 15311 [QA Followup] - Remove use of .raw method as it's use was reverted
Comment 20 Kyle M Hall 2016-02-26 14:24:47 UTC
Pushed to master! Should be in Koha 3.24, thanks Barry!