Skip to content
This repository has been archived by the owner on Oct 14, 2021. It is now read-only.

bywatersolutions/koha-plugin-support

Repository files navigation

Introduction

Koha's Plugin System (available in Koha 3.12+) allows for you to add additional tools and reports to Koha that are specific to your library. Plugins are installed by uploading KPZ ( Koha Plugin Zip ) packages. A KPZ file is just a zip file containing the perl files, template files, and any other files necessary to make the plugin work. Learn more about the Koha Plugin System in the Koha 3.22 Manual or watch Kyle's tutorial video.

Description

This plugin provide an easy way of reporting support issues in Koha. Once installed, it is accessible via a button in the lower right hand corner of the screen. Clicking button opens a panel which allows the user to compose a message to a system librarian or ticketing system.

Future development for this plugin will achieve the following objectives:

  • The plugin will context-sensitive, and will pull support category information based on the URL of the page the it is opened on.
  • The Support Plugin sends a YAML file with all the message's details. This allows for integration with other open source resources, such as ticketing systems and customer relations managements systems.
  • The Support Plugin runs off of "Cards". There is a "Basic" Support Request Card which is the template for the fancier cards to come. This Basic Card is static and can be used by anyone downloading and installing the plugin.
  • The Support Plugin will offer suggestions to the Koha end user based on the URL of the page, module selected, or the keywords of the support inquiry. Adding options that highlight resources like the Koha Manual, Newly Created Bugs to the end user in their time of need, as well as facilitating the easiest submission of a problem or request with relevant metadata is the goal of the plugin.

Downloading

From the release page you can download the relevant *.kpz file

Installing and Setup

Ensure the plugins directory exists For git installs: /home/koha/koha-dev/var/lib/plugins

Ensure the plugins directory is writable by Apache

sudo chgrp www-data /path/to/plugins
sudo chmod g+w /path/to/plugins

Edit the koha-conf.xml file Add or edit the pluginsdir stanza ( in the section )

<pluginsdir>/path/to/plugins</pluginsdir>

Add or edit the enable_plugins stanza ( also in the section )

<enable_plugins>1</enable_plugins>

Add the following lines to your apache2 configuration under the Intranet section file, which can be found at at /etc/apache2/sites-enabled/koha-SITE (SITE matching your koha instance name):

<Directory "/var/lib/koha/SITE/plugins">
Require all granted
</Directory>
Alias /plugin "/var/lib/koha/SITE/plugins/"

The plugin will construct this stanza for you. If Plugins are already enabled just install the plugin and it will construct the stanza for you to copy paste into your apache2 configuration file.

With these changes complete Restart or Reload Apache:

sudo service apache2 reload

If running, Restart Memcache:

sudo service memcached restart

Ensure the system preference UseKohaPlugins is enabled.

Download the latest release of the plugin to your computer (the file will have a .kpz extension). Browse to Home › Administrations › Manage Plugins to upload and install the plugin.

Configuration

With the Support Plugin installed it is time to configure it! As stated previously the plugin will construct the apache stanza for you and that will be the first thing you see on the Configure page. Bellow that you need to tell the plugin who to email when a support request is created. This can be a person, group email alias, or the email address of a ticketing system that creates tickets via email.

Next there are radio buttons for different Cards, but as of v 2.1.40 only one type of card is in production.

Finally, it will automatically updated the IntranetUserJS system preference with the JS needed to run the plugin after you hit "Save".

As a general note: this plugin will run faster on Koha sites running Plack.

EXPERIMENTAL - Restricting the use of the plugin to Superlibrarian

To restrict the support plugin to superlibrarians only, Create a report using the following query

SELECT userid
FROM borrowers
WHERE flags%2=1
ORDER BY borrowernumber ASC

Note report's ID number -- we'll call that XX.

Change the standard JS generated by the plugin from:

/* JS for Koha Support Plugin
This JS was added automatically by installing the Support plugin
Please do not modify */$.getScript('/plugin/Koha/Plugin/Com/ByWaterSolutions/MySupport/my_support.js')/* End of JS for Koha Support Plugin */

to

$(document).ready(function(){
    var is_superlibrarian = 0;

    $.getJSON(
        "/cgi-bin/koha/svc/report?id=XX&annotated=1", function(data) {
        $.each( data, function( index, value ) {
            if( value.userid === $(".loggedinusername").html() ) {
                is_superlibrarian = 1;
            }
        } )

        if( is_superlibrarian === 1 ) {

/* JS for Koha Support Plugin
This JS was added automatically by installing the Support plugin
Please do not modify */$.getScript('/plugin/Koha/Plugin/Com/ByWaterSolutions/MySupport/my_support.js')/* End of JS for Koha Support Plugin */

        }
    });

});

Unfortunately, this call is relatively slow. In 19.05 or higher, the html class is_superlibrarian is added on each page in the intranet if the logged in user is a superlibrarian, which allows us to simplify the code above to

if( $("is_superlibrarian") !== NULL ) {

/* JS for Koha Support Plugin
This JS was added automatically by installing the Support plugin
Please do not modify */$.getScript('/plugin/Koha/Plugin/Com/ByWaterSolutions/MySupport/my_support.js')/* End of JS for Koha Support Plugin */

}

This will not cause any perceivable delay.