Using KohaILS ? Better update it from time to time or be left behind!

Earlier in the day, young Sandeep pinged me with a question:

Can I add additional, separate columns of information to this table on the screen?

The screen he referred to was this one:

18685478_1887705531470539_114367369_n

As regular readers of this blog are know well by now, for any question about Koha, the very first piece of useful information is what is the version of Koha in this case?. Sandeep replied back saying it was “3.20.02”! I was like “Hmmmm! That’s a bit old…”

With two major versions of Koha coming out every May and November respectively, every major Koha version usually have a supported life cycle of about 18 months. The 3.20 series was launched in May 2015. Thus Sandeep’s Koha instance at nearly 24 months old, was already out of support lifecycle for nearly 6 months.

I pointed Sandeep to bug number 10855“Custom fields for subscriptions”. This feature to add custom fields to serial subscriptions became a part of Koha with the release of version 3.22 on Nov 26, 2015 (See https://koha-community.org/koha-3-22-released/ and look for “Custom fields for subscriptions (bug 10855)” under Serials).

Had his Koha been updated at anytime during the last 1 year, he would have found that the featured he wanted already built-in.

Harnessing Koha’s ExtendedPatronAttributes (aka patron custom fields)

Custom fields that make it possible to fit KohaILS to any type of library user category.

During from my frequent interactions with Indian Koha users over the last several years, one thing stands out rather starkly. There is surprisingly little understanding or use of the capabilities offered via Extended Patron Attributes. Since Koha ILS was written originally for public libraries (in fact public library consortia), its default patron data structures too are somewhat aligned with public libraries’ patron information capture.

When put to use in academic libraries e.g. K12 schools or colleges, the default patron information schema does not address the obvious need to capture data points like – programme enrolled, registration / roll numbers / class / sections details and in case of K12 schools – parent / guardian name and contact information etc. Many Koha users from the Indian sub-continent either (a) work their way around these issues without fully addressing their needs OR (b) often resort to direct editing of the koha.borrowers table schema, adding new custom fields and modifying the template files (.tmpl or .tt files) along with the Perl scripts that drive these templates.

The second approach is particularly problematic, as it means the modifications are usually hardcoded into scripts and templates. This is problematic is because doing so prevents the user from the benefit of seamless upgrades to their Koha. It means they have to do the whole “rinse-and-repeat” cycle everytime they upgrade their Koha, if they want their changes to persist. This makes Koha upgrades a costly, laborious, time-consuming process and error prone process.

Enter ExtendedPatronAttributes

According to the Koha manual –

“Patron attributes can be used to define custom fields to associate with your patron records. In order to enable the use of custom fields you need to set the ExtendedPatronAttributes system preference.”

About 10 years back, as Koha was finally moving out of version 2.x and moving into Koha 3.x, several new and exciting features were coming on to their own in Koha. One of this was the ability to easily handle custom fields for our patron records aka patron attributes. Around May 2008, my friend Galen Charlton, then with LibLime, wrote a (rather) large chunk of the code that brought in the support for custom fields to patron records. The ExtendedPatronAttributes system preference was the outcome and custom fields were here to stay.

Flash forward to present day

Recently we have been working with the Senior section library of Don Bosco School in Calcutta. Being a school library they needed to additionally support the following fields in their patron record (a) Class (b) Section (c) Roll No. (d) Parent / Guardian information i.e. name, contact info, relationship with student. Of course, we used defined these custom fields as patron attributes that were applicable only for their student patron category. In this blogpost, I will try to share just how easy and painless this is.

Step #1 : Enable ExtendedPatronAttributes syspref

This *is* the very first step and unless you enable this syspref, no matter what you do to define your custom fields (aka patron attributes), nothing would be visible.

Step #2 : Defining the Patron Attributes

In our case, we had two sets of information to be handled i.e. the student’s (a) academic details and (b) parent / guardian information. So we defined ST_CLASS, ST_SECTION and ST_ROLLNO patron attributes for the first part and ST_PNAME, ST_PRELATN and ST_PCONT as attributes for the second part.

2017-05-16_03-44-10

To make things easier for the library personnel (and reduce human error in the process), we pre-defined the values available to ST_CLASS, ST_SECTION and ST_PRELATN as authorised values.

2017-05-15_19-34-06

We also defined the PA_CLASS authorised value with the following two values : (a) ADETAILS (for academic details) and (b) GDETAILS (for guardian information).

2017-05-16_03-50-36

Step #3 : PA_CLASS – the secret sauce!

The Koha manual barely touches on this little nugget otherwise known as the PA_CLASS authorised value category. Before we proceed, just remember that in Koha Authorised value and Authority value mean two completely different things. Here we are talking about the former. If you have ever done any programming or done anything online, you must have used a drop-down / picklist to select a value. Well in Koha, authorised values are simply another name for picklists. These are defined as a category with the options added it. To the end-user, authorised values are presented as select drop-down HTML form element.

Now coming to PA_CLASS (or Patron Attribute Class), the first thing to remember is that by default Koha does not even define the PA_CLASS authorised value category. Rather it is left to the user to define it. There is a reason why it is not defined by default, not every library is going to used ExtendedPatronAttribute and unless you use it, PA_CLASS has no use. In our case, we have defined it and allotted it two values – ADETAILS and GDETAILS for now.

By allotting our custom fields (patron attributes) to either of these two PA_CLASS values allows us to logically group our two sets of information. By default, once done it looks like this:

2017-05-16_01-49-10

Order! Order! Order!

While chaos defines us, in life it is order that we look for, especially when we are attempting to present or capture information. So while the “Additional attributes and identifiers” grouping at the end of the page is adequate it is not ordered in the most logic flow with respect to the overall patron information form. Lucky for us, Koha has supported JQuery for donkey’s years. And JQuery provides us with a very nifty method .detach(). As the documentation says:

The .detach() method is the same as .remove(), except that .detach() keeps all jQuery data associated with the removed elements. This method is useful when removed elements are to be reinserted into the DOM at a later time.

blog-epa

By detaching the PA_CLASS grouped fieldsets from the DOM and by storing these into variables one at a time, we are now ready to insert them exactly where we want these fieldsets to be placed in the overall form. And that is exactly what we did.

epa-full

Conclusion

This way we did not touch the templates or the underlying business logic of KohaILS. All our definitions are stored in the database. As a result, we can now perform IN-SITU upgrades of Koha without worrying if we will break our forms if we upgraded.

Koha and the “magic” of XSLT : displaying new MARC fields on the OPAC.

A short tutorial on using XSLT to make MARC fields in your data visible on the OPAC.

Earlier today, Suresh Kumar Tejomurtula, a member of the venerable LIS-Forum mailing list being run out of IISc Bangalore, posted a question on that list:

Under language codes of 008/35-37 and also under 041$a I added language code. for eg: tel for Telugu language. But I do not see any difference to the view of the record, except that the marc tags contains that values. Adding these fields data will enable library team to understand the language of the material. My question is, How will the users of the OPAC, who do not know about marc language codes will understand the item language [from just the 3-letter code sequence].

Short answer : Using XSLT

Much of Koha’s superpowers on the OPAC (as also on the staff client) side comes from its judicious use of XSLT. When we search for documents in Koha, the result that is returned from the database by way of the various perl modules that perform much of Koha’s internal plumbing, comes in as an XML (eXtensible Markup Language) document. More precisely it is returned as a MARCXML record. Readers of this blog who are familiar with the MarcEdit software may have often encountered a MARCXML record. Those who are not so familiar may well like to read up a bit from here before proceeding with this post.

So what is XSLT?

Wikipedia gives the definition of XSLT as –

“XSLT (Extensible Stylesheet Language Transformations) is a language for transforming XML documents into other XML documents, or other formats such as HTML for web pages, plain text or XSL Formatting Objects, which may subsequently be converted to other formats, such as PDF, PostScript and PNG.”

Where to start?

At the OPAC level, the XSLT magic is primarily driven by two files i.e. (a) MARC21slim2OPACResults.xsl and (b) MARC21slim2OPACDetail.xsl. Koha’s default settings of how we see the search results on the OPAC and the document specific details in the Normal view, are defined in these two files.

N.B. Directly editing these two files is strictly not advised unless you are a XSLT guru.

Lucky for us that Koha’s system preferences provide options to override the defaults by creating new XSLT files and telling Koha to use the new ones instead. The screenshot below shows the default setting.

2017-05-04_03-05-15

The two files are available inside a folder named xslt under the locale of the selected theme you are using e.g. /usr/share/koha/opac/htdocs/opac-tmpl/bootstrap/en/xslt/ on a package-based installation. By default most of us in India would be using the English locale i.e. “en”. The default Koha theme is “bootstrap”. Thus if you are using a custom theme and/or different locale look for the files under that.

Step #1 : Copying the XSLT files

We will be fetching the 3-letter language code from MARC 008/35-37 of each marc record. Since our Koha instance here is named as “demo”, we’ll make a copy of the file MARC21slim2OPACResults.xsl as MARC21slim2OPACResults-demo.xsl and the MARC21slim2OPACDetail.xsl as MARC21slim2OPACDetail-demo.xsl.

N.B. You can give any name to the copies you make, but it is suggested that the less adventurous you are with the names, easier it will be for you to trace your steps back if you make a mistake while editing them. And trust me you will make mistakes, at least initially.

Step #2 : Editing MARC21slim2OPACResults-demo.xsl

The MARC21slim2OPACResults.xsl is what drives the display of results of a search on the Koha OPAC. And it does not show the value of 008/35-37 i.e. MARC language code, while displaying the search result. To add this facility, we need to do the following to our copy i.e. MARC21slim2OPACResults-demo.xsl. Around line no. 70 or there about, there will be this line <xsl:variable name="controlField008-30-31" select="substring($controlField008,31,2)"/>. Add the following line after it – <xsl:variable name="controlField008_35-37" select="substring($controlField008,36,3)"/>.

Explanation: we’re defining a new variable named controlField008_35-37 and in it we are storing the 3-digit value found at 008/35-37 from another variable – controlField008.

The second step in editing this file is to add the code to check if (a) 008/35-37 actually exists (e.g. if you have a blank 008 field, 008/35-37 won’t exist) and (b) it is set as something other than “und(i.e. undefined). The following code does that first and proceeds to match the value found in 008/35-37 against 23 different languages. These languages are English and the 22 official languages of India as per the Eighth Schedule of the Indian Constitution. You can add or remove any language from this list as you require. However, when you do, please make sure that the codes you setup in this list here are coming from the Code Sequence document of the MARC Code list for languages as published by the US Library of Congress.

This means that you must also be using these same exact codes in your MARC records in Koha.

2017-05-04_05-40-55

Where we place this code will depend on where we want this language to listed in the results. In our case, we decided to add it between Material type and Format. And thus in our case, the code was added at line no 637. If you too want language to be displayed between the Material Type and Format, then look out for this line <xsl:if test="string-length(normalize-space($physicalDescription))"> and add this block before.

Saved the file and moved on to the next section.

Step #3 : Editing MARC21slim2OPACDetail-demo.xsl

The process is similar to what we just did above. Open the file MARC21slim2OPACDetail-demo.xsl for editing and go to line no. 51 (or there about) and look for this line <xsl:variable name="controlField008" select="marc:controlfield[@tag=008]"/>. Add the following line immediately after that: <xsl:variable name="controlField008_35-37" select="substring($controlField008,36,3)"/>.

2017-05-04_06-02-17

Since we wanted the “Language of document” to come after Material type, we added the code immediate after the node <xsl:if test="$DisplayOPACiconsXSLT!='0'"> is closed but before <!--Series: Alternate Graphic Representation (MARC 880) -->; in our case, this worked out to be around line no. 195. Finally, we saved and closed the file.

Getting Koha to use the new XSLT files

The Koha system preference OPACXSLTResultsDisplay was changed from its original setting (i.e. “default”) and set to the path of our new file MARC21slim2OPACResults-demo.xsl i.e. /usr/share/koha/opac/htdocs/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults-demo.xsl. Likewise the other system preference OPACXSLTDetailsDisplay was changed to /usr/share/koha/opac/htdocs/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail-demo.xsl. It was time to test our XSLT modifications.

And it works!

Since pictures are said to be worth a 1000 words, we will let before and after screen grabs do the talking here. Also if anyone wants to see directly how it actually looks after applying the changed XSLT, visit the URL http://demo-opac.l2c2academy.co.in/cgi-bin/koha/opac-detail.pl?biblionumber=18

Before : Using the default MARC21slim2OPACResults.xsl

chrome_2017-05-04_07-05-24

After : Using the new MARC21slim2OPACResults-demo.xsl

chrome_2017-05-04_07-17-09

Before : Using the default MARC21slim2OPACDetail.xsl

chrome_2017-05-04_07-48-28

After : Using the new MARC21slim2OPACDetail-demo.xsl

chrome_2017-05-04_07-49-09

The 5-Minute Series : Downloading your Koha SQL Report

Presenting a fast and flexible option to download your report.

One of the best things about Koha is the complete freedom it provides its users to create a custom SQL report of any level or degree of complexity as long as the query is compliant to MySQL SQL syntax – reports like e.g. accession registers, detailed circulation statistics etc.

Of course, once you have your report, if you are anything like *us*, you would want to grab the data and the do further analysis or use it to make that fancy-schmancy report or use a part of it in a presentation. Of course to do any of that, the data has to be downloaded locally. Koha provides you with three (03) options:

  1. As comma separated value (.CSV) file
  2. As a tab separated (.txt) file
  3. As OpenDocument Spreadsheet (.ODS) file

Now, if you are an OpenOffice.org / LibreOffice user, you may be tempted to go for the third option i.e. download the data as an .ods file. While this may look like the best option. It is *not* always so. The biggest problem is that if your report returns a lot of records, then generating the .ODS file is going to take a bit of time. Also, if your system is low on RAM, this can get *really* slow.

On the other hand, the files in .CSV and the .TXT formats are generated and downloaded almost instantly OR at least faster in comparison by several order of magnitude! Given that, which one among the two are your best bet? Well, in our considered opinion, the tab-separated .TXT file is the best. Here is why: if the single quotes in your data are not properly escaped, then your CSV data may be misinterpreted due to the un-escaped single-quote. leading it to split the data that should have been together into separate columns during an import. In contrast, a “tab separated” file will usually work without any issue unlike the CSV file.

So, if you want the data download to be fast and easy to split into columns correctly, the tab-separated .TXT file provides us the best overall option.

FMIRO CCU’s public z39.50 server running on Koha ILS achieves 100% reliability on IRSpy.

Hosted by L2C2 Technologies, FMIRO becomes the 5th Indian entry into IRSpy’s global z39.50 directory.

We are happy to announce the z39.50 service of FMIRO CCU (FOSMA Maritime Institute & Research Organisation, Kolkata branch) has achieved 100% reliability as an open access z39.50 search target for bibliographic materials related to maritime and ship operations. With this, FMIRO CCU becomes the fifth publicly announced z39.50 server from India which is listed on IRSpy service provided by Index Data.

FMIRO CCU’s nascent library is hosted on L2C2 Technologies‘s cloud platform using Koha ILS. The FMIRO OPAC is available at : http://fosma-opac.l2c2.co.in/. The collection at FMIRO is a specialized collection focused solely on topics related to maritime, marine engineering, ship building, ship operations and nautical sciences. It is still a very small collection that is quite literally growing by the day.

Host connection reliability

Host connection reliability measures the reliability of the target only in its ability to respond to connections: the display indicates the number of successful connections in the last two months, the total number of attempted connections in that time, and the percentage of successful connections. For example, reliability of 9/15 = 60% indicates that fifteen attempts have been made to connect to the server in the last two months, of which nine (60%) have been successful. [1]

About IRSpy

IRSpy maintains a global registry of information retrieval targets, about 1295 as per recent count (http://irspy.indexdata.com/stats.html), supporting protocols like ANSI/NISO Z39.50 (ISO 23950) and SRU/SRW web services.

About Index Data

Short answer: The guys who publish the Zebra indexing engine and YAZ toolkit and software libraries.

Long answer: Since 1994, Index Data has offered software development, consulting and integration with a focus on search. Our pioneering involvement in open source and open standards dates back to the first release of the YAZ toolkit for Z39.50 in 1995. [2]

References

[1] IRSpy help: info/reliability

[1] About Index Data

The 5-Minute Series: Setting default messaging preferences for SMS alerts.

Presenting an use-case requiring setting the default messaging preference for SMS alerts sent by Koha.

The problem

Earlier in the day, my professional colleague and friend Joydeep Chanda asked a question. His Koha v3.22.10 installation (at Gurudas College Library) had turned on SMS alert service for its users. The library being a long time Koha user, presented a challenge. He had ~ 6000+ users, so now he and his staff had the unenviable task of having to update the smsalertnumber field in the borrowers table for these 6000+ users. I pointed him to a recent Facebook post by another friend Vimal Kumar Vazaphally. That solved part of his problem, but he still had to choose the default types of SMS messages to be delivered.

Messaging-preferences

So, I pointed him to another post by Vimal – “Use of borrowers-force-messaging-defaults script“. But after a while he complained that while the borrowers-force-messaging-defaults script did set the SMS options, it also enabled *all* of them, he wanted SMS send option to be set only for CHECK-IN and CHECK-OUT.

Description of borrowers-force-messaging-defaults as included in its source:

If the EnhancedMessagingPreferences syspref is enabled after borrowers have been created in the DB, those borrowers won’t have messaging transport preferences default values as defined for their borrower category. So you would have to modify each borrower one by one if you would like to send them ‘Hold Filled’ notice for example.

This script create transport preferences for all existing borrowers and set them to default values defined for the category they belong to.

The solution

The answer lies in correctly assigning advanced messaging preferences by default to a patron category *and then* running the borrowers-force-messaging-defaults script. In order for the patron category edit page display the “Default messaging preferences for this patron category” sub-form, the system preference EnhancedMessagingPreferences needs to be enabled.

The Steps

  1. Check if the EnhancedMessagingPreferences is enabled. If not, then enable it.
  2. Go to Home -> Administration -> Patron categories and select the category to edit.
  3. Scroll down the Modify category form to the “Default messaging preferences for this patron category” section.
  4. Select the checkboxes against the SMSes you want to be sent by default for that category.
  5. Save the changes
  6. Go to a command line terminal and run the borrowers-force-messaging-defaults script. This will ensure that only the defaults are set.

Enjoy!

See also:

[1] “Koha and key lessons of using transactional SMS in India” by L2C2 Technologies

[2] Press release about setting up of SMS alert service at Gurudas College Library.

[3] SMS-Send-IN-Unicel-0.01 at CPAN

Koha quick tip : Duplicating a bibliographic record for a multi-volume book

Yesterday a young colleague called up with a query. She wanted to know how she could create separate bib records for a multiple volume book (e.g. “The Complete Works of Swami Vivekananda” which comes in 8 volumes) by editing the following volume specific info:

  1. ISBN;
  2. page count and physical description;
  3. price;
  4. date of copyright / publication;

while keeping other common information same across the records.

I told her that do this, she would first need to catalog at least *one* volume (preferably the first volume) of the book and then simply duplicating the record and changing the fields she needed to change in each case. This feature is well-documented in the Koha Manual under “Duplicating Records” inside the chapter on Cataloging. Continue reading “Koha quick tip : Duplicating a bibliographic record for a multi-volume book”

FMIRO Kolkata partners with L2C2 Technologies to automate their new library.

FOSMA Maritime Institute & Research Organisation (FMIRO) selects L2C2 Technologies’ Koha support

We are pleased to extend a warm welcome to the newest member of our growing client-partner family in Eastern India – FOSMA Maritime Institute & Research Organisation (FMIRO), Kolkata, a maritime training institute. FMIRO Kolkata has gone live on Koha ILS 16.11 series on L2C2 Technologies‘s cloud hosting platform.

About FOSMA

The Foreign Ship-owners Representatives and Ship Managers Association (FOSMA) was established in India in 1989 to represent foreign owners and ship managers operating in India. Taking in to account that the education, training and competence standards of seafarers is of primary concern and priority of all ship managers in India, the Association established a special purpose vehicle – “FOSMA MARITIME INSTITUTE AND RESEARCH ORGANISATION” (FMIRO), as a non-profit organization under section 25 of the Companies Act, 1958 (now Section 8 of the Companies Act, 2013).

Source: http://www.fosma.in

DCB & BI Library, University of Kerala chooses L2C2 Technologies’ Koha hosting service

DCB & BI Library, University of Kerala goes online with Koha Integrated Library System.

We are pleased to welcome the Department of Computational Biology & Bioinformatics, University of Kerala as our newest client-partner from “God’s own country” aka Kerala – the southern most state of India. Earlier the library was running Koha 3.22 on an in-house (on campus) server. With this move, they are now fully hosted on the cloud and are running on the latest major stable version of Koha i.e. on 16.11.x series.

About DCB & BI

The Centre for Bioinformatics, established in 2005 and upgraded as the Department of Computational Biology and Bioinformatics in 2011, is a new generation inter-disciplinary as well as multidisciplinary teaching & research Department of University of Kerala, India. The centre offers a two-year innovative MSc (Computational Biology) programme and also 2 one-year MPhil programmes in (i) Bioinformatics (ii) Computer Aided Drug Design. The Department has researchers with vivid backgrounds (Electrical Engineers, Mathematicians, Physicists, Biotechnologists, Botanists, Bio-chemists, Computer scientists are some of them). The Department has its own premises with state of the art informatics laboratory and also a molecular biology and bio-electronics laboratory which provide a balanced training to multidisciplinary talents that the centre attracts. The Department library having a stock of over 2425 specialized books.

The Director is Dr. Achuthsankar S. Nair, who has lead the department since its inception and presently has 6 lecturers, an Emeritus Professor (Dr. Oommen V. Oommen), one Post Doctoral Fellow, half a dozen Project Fellows, 19 full-time research scholars and at any time, 30-40 masters students. The Department also has 2 adjunct Professors, in addition to visiting faculty and Erudite visitors [Prof. Dr. Johann Deisenhofer (Nobel Laureate – 1988) visited the Department on Dec 1-3, 2010, Prof. Martin Chalfie (Nobel Laureate-2008) visited on Jan 5-7, 2011, followed by Prof. Anders Liljas (Nobel Prize Committee Member) on Jan 20-26, 2011.

The Department is situated in the beautiful and green Kariavattom Campus made greener by the department’s “Trees for 2100 AD” initiative.

Source : DCB & BI website

Accessing the OPAC

While the online public access catalogue (OPAC) is presently available at https://dcb-opac.l2c2.co.in/, this will change in a few days once the dedicated domain procurement process is completed.

Don Bosco School, Park Circus partners with L2C2 Technologies to take their library catalogue online

The first K12 school in eastern India to adopt cloud hosted Koha ILS for their library.

It is our pleasure to welcome Don Bosco School, Park Circus, Kolkata as the newest member of our client-partner family in the eastern India. To the best of our knowledge, Don Bosco School is the first K12 school in entire eastern India to move to a cloud based Koha ILS installation. We thank Fr. Bikash Mondal, the principal, Fr. Anil Toppo (Asst Principal) and other officials at DBPC as well as Sri Anup Choudhury the young, enterprising librarian of the senior section, for their forward thinking.

About Don Bosco School (Park Circus)

Located at 23, Darga Road, Kolkata, India, is an all-boys English medium school imparting education from first through twelfth grade. Established in 1958, it is run by the Salesians of Don Bosco, which is a minority institution within the Catholic Church. The school operates under the Indian Certificate of Secondary Education board. The school officially opened on 15 January 1958 with an intake of 460 boys. The school now has an enrollment of 3000 students. It celebrated its golden jubilee in 2008. [1]

References

[1] Source: https://en.wikipedia.org/wiki/Don_Bosco_School,_Park_Circus