Force Default messaging preferences on Patron Categories #Koha

By abhisheknagar

Oh, I was sending Notifications to Patrons on Item Issue, but suddenly the management have instructed to send notifications on Item Return, Renewal etc as well or they have asked to send Notifications as SMS/WhatsApp in addition to Email, and now i realise that this will ge a pain to implement as i will need to implement this for each patron.

NO NO

This can be done automatically here is the solution

Step 1 ) Modify Messaging Preference for each  Patron Categories

For Each Patron Category set the Default Message Templates from the link  http://<your-library-staff-panel>/cgi-bin/koha/admin/categories.pl

 

Step 2) Use the following commands on the Koha Server Terminal

sudo su

export PERL5LIB="/usr/share/koha/lib"

export KOHA_CONF="/etc/koha/sites/library/koha-conf.xml"

cd /usr/share/koha/bin/maintenance

perl borrowers-force-messaging-defaults.pl --doit

 

You are Done !!!

The Script borrowers-force-messaging-defaults.pl  will force update messaging preference of all Patrons

Ensure that the koha-conf.xml PATH is correctly set in Step 2 in case your library name is other than library.


This will be useful if you have just implemented my New Module to send Notifications via WhatsApp Business API

 

Koha SMS Driver for WhatsApp Business API (GupShup)

By abhisheknagar

Screemshot

Koha already have a feature to Push Notices via SMS

Koha uses SMS Drivers to push these Notices to a Service Provider

SMS Driver can be written which can Push Notices using an External API (Gupshup WhatsApp API) in this case which can inturn send the Notice as WhatsApp Messages.

Requirements

  1. Facebook Business Account
  2. GupShup Account with WhatsApp Business API
  3. GupShup API Key
  4. Approved Templates for CHECKOUT, CHECKIN, DUE
  5. GupShup Endpoint URL for API
  6. SOURCE Number as Registered in Facebook Business Account and Mapped in Gupshup

How to Install

  1. Download the Package File (.KPZ) from this github Repository
  2. Upload the Package File in the Koha Plugins
  3. Configure the Plugin by entering the Information already stated in Requirements
  4. Modify the SMSSendDriver Value to SMS::Send::Gs in the System Preferences in Koha
  5. Enable Notices via SMS in Koha for desired category of Patrons
  6. Configure the messages cron if not already configured on Koha Server

Configuration

Step 1

Step 2

Step 3


Assumptions of this Driver

Template for CHECKOUT, CHECKIN, DUE is already approved by Facebook and contains 2 Variables/Parameters

eg Template

==================================================

Screemshot

Dear {{1}},

The following books have been issued to you as per your request in Library

{{2}}

Thank you for visiting The Institute Library.

==================================================

The Driver will replace {{1}} with the Patron First Name & {{2}} will be replaced with the SMS Template Data as recieved from KOHA eg {{2}} can contain Barcode of Books issued which will convert the Template to the following and send

==================================================

Dear Abhishek,

The following books have been issued to you as per your request in Library

6754, 5754

Thank you for visiting The Institute Library.

Github Repository : https://github.com/abhisheknagar/gupshup-wa-koha-driver

 

Need Help in Configuration

Koha Notices via Custom Self Hosted End Point

By abhisheknagar

#Idea

Use the SMS Service present in Koha to send Notices to Patrons

SMS Plugin which send Notices as JSON Data to an Endpoint using POST, Endpoint can be yours own endpoint or a service provided by a service provider. Handle the JSON data in Endpoint and send the Notice using your Custom Code or Service Provider to WhatsApp / Telegram / Whatever

GIT Repository : https://github.com/abhisheknagar/wa

 

JSON POST made by this Koha Plugin to Endpoint will look as follows : 

{
           "api_key"        => $api_key,
           "customerFirstName" => $patron->firstname,
           "customerLastName"  => $patron->surname,
           "phone"             => $patron->smsalertnumber || $patron->phone,
           "code"              => $m->letter_code,
           "messageBody"       => $m->content,
    }

 

What is Koha ?

Community Driven world's first free and open source library system, Koha https://koha-community.org/ powers major libararies around the world. 

Upgrading / Migrating Koha from Koha 20+ to Koha 24.+

By abhisheknagar

We have already seen Koha LIS Installation in our last Post which is available @ https://abhishek.nagar.me/koha/install the same steps can be used to install the Latest Version of Koha i.e 24.11 which was released in November 2024

I am very well sure that you might be also a lazy chap like me and would be not upgraded your Koha Installation at a regular basis still i presume that you must be using at least Koha 20.05 if yes use the following procedure to upgrade/migrate your current Koha Instance to Koha 24.11

Assumption : Koha Instance Name is library, Database Name is koha_library

Step 1 ) Install Koha 24.11 using the Procedure mentioned in our earlier blog post. and yes i recommend new Installation over Upgrade as by new installation you get a easy and safe opportunity to upgrade your Base OS to Debian 12 

Step 2) Take Backup of Database from Old System

  • Open Terminal on the Old System and execute the following to take backup
  • sudo mysqldump --single-transaction -u root -p koha_library > koha.sql

Step 3 ) Move the Backup file koha.sql generated in Step 2 to new/upgraded system using scp or any backup device whatever you are comfertable with.

Step 4 ) Restore mysql Backup to the New System

  • Open Terminal on the New System and remove the Existing Database which is currently already empty
    • sudo mysql -uroot -p
    • drop database koha_library;
    • create database koha_library;
    • exit;
  • On Terminal  execute the following to restore backup (this will take time depending on the backup size)
    • mysql -uroot -p koha_library < koha.sql 
    • exit
  • On Terminal Upgrade Database Schema
    • sudo koha-upgrade-schema library
  • On Terminal rebuild the Zebra Index
    • sudo koha-rebuild-zebra -v -f library

Wohla !!! you have upgraded Koha to 24.11 :) Enjoy Open the Staff Interface with your Old Credentials as they are now migrated :)
 

 

Koha Initial Setup/Installation, Configuration on Ubuntu 20.04

By abhisheknagar

Koha is an open source integrated library system (ILS), used world-wide by public, school and special libraries. The name comes from a Māori term for a gift or donation. ~ Wikipedia

In this blog post we will discuss how to Install the Latest Version of Koha (21.05.XX)

System Requirements

  • Ubuntu 18.04 + or Debian 9+
  • Maria DB 10.1 +
  • Perl 5.24 +

Installation of Koha is quite easy and simple you can install Koha on your Local Machine or a Virtual Machine / Cloud / Compute Engine, I recommend using a minimum of 4 Gb RAM based machine / virtual setup.

Pre-requisite

The System must have Ubuntu 18.04 + Operating System Installed.

Koha Installation Process

  • Update Operating System
    • sudo apt-get update
    • sudo apt-get upgrade
  • Add Koha Repositories
  • Install Database Server
    • sudo apt-get install -y mariadb-server
    • sudo mysqladmin -u root password <yourpassword>
  • Install Koha
    • sudo apt install -y koha-common

Configuration Considerations

Koha Provides 2 Services namely

  • Staff Portal : Portal Used by Staff for Library Services
  • Web OPAC : Portal Used by Patrons for OPAC Services

Both of these services are installed on a single system/server there are multiple ways to access these

  • Named Services
  • IP Port Based Services
    • Where you want to access both the Portals using Same IP but different Ports eg XX.XX.XX.XX (Web Opac), XX.XX.XX.XX:8080 (Staff Portal)

Generally the Staff Portal is restricted to your Local Network while Web OPAC is Publically available, in this tutorial we will be using IP Port Based Setup, Lets Start Configuring Koha

Basic Web Based Installation & Configuration

Change the Port No of Staff Portal to 8080

sudo vim /etc/koha/koha-sites.conf

Find the following line and edit

INTRAPORT="8080"

Create a Koha Instance

sudo koha-create --create-db library (you can change <library> to whatever name you want to give)

Add a Port to Apache

sudo vim /etc/apache2/ports.conf

Listen 8080

Enable Module & Sites

sudo a2dissite 000-default

sudo a2enmod deflate

sudo a2ensite library

sudo service apache2 restart

sudo service memcached restart

Web Installation

Detailed Guide available @ https://koha-community.org/manual/21.05/en/html/installation.html

Once you are done with the above you can Open the Koha Web Installer to Install & Configure Koha to start the Web Installer open the following URL on your Favourite Web Browser

http://127.0.0.1:8080 (Replace 127.0.0.1 with Actual IP of VM/External Machine if being used)

The Web Installer will require a username & password to continue your can get the same from the file /etc/koha/sites/library/koha-conf.xml

sudo vim /etc/koha/sites/library/koha-conf.xml

Find the Following to know the User & Password

<config>
 <db_scheme>mysql</db_scheme>
 <database>koha_library</database>
 <hostname>localhost</hostname>
 <port>3306</port>
 <user>koha_library</user>
 <pass>CoPKrCzmoh0G7bQ@</pass>

 

The Web Installer will ask for various inputs like branch, itemtype, super user info, defaults, MARC Flavor and much more select/enter as per your preference and enjoy Koha.

Once Installation is Complete you can access

If your System is Connected to Network and proper firewall rules are in place then both the Staff Portal & Web OPAC will be available in your Local Network instantly. If you configured the above on a Cloud VM/Compute replace 127.0.0.1 with the Public IP as available with you.

 

For Professional Koha Support do contact abhishek [a t] nagar [d o t] me