In India, Koha has been used by numerous libraries. One of the most important requirements they have in Koha is that the course name and year of the batch be included in the Koha registration form. For a non-programmer, adding a new field might be challenging, and it might also cause issues with upgrades in the future. Koha's patron attributes can be used to accomplish the same task, but I found that we are unable to include patron attribute code when batch importing patron details.
So, in order to append those fields, we can use Koha's built-in fields, such as sort1 and sort2 for course name and year of batch respectively. Let's look at how we can do that.
Prior to anything else, we need to decide which field will be used for the batch year and the course name. For this, I'll be using sort1 for the course name and sort2 for the batch year.
Create authorized values for sort1 & sort2
Go to Koha > Administration > Authorized Values and select Bsort1
Select New authorized value for Bsort1 button.
Add a new Value Code
1. Enter a shortcode for the new value. Preferably in capital letter.
2. Enter the description
3. Enter the description for OPAC
4. Select the library branch code.
5. Save the new collection
Same way create other values for Bsort2 (I used for year)
Go to the patron registration form now, where you can find a dropdown list for sort1 & sort2 under library management.
To change sort1 and sort2 from the patron form to Department and Year of Batch, add this JavaScript to the IntranetUserJS under global system preferences.
Home --> Administration --> System preferences --> IntranetUserJS
/* change sort1 label on member details page */
if ( $('#pat_moremember').length ) {
$('#patron-sort1 .label').text('Department:');
}
/* change sort1 label on member entry form page */
if ( $('#pat_memberentrygen').length ) {
$('label[for="sort1"]').text('Department:');
}
/* change sort2 label on member details page */
if ( $('#pat_moremember').length ) {
$('#patron-sort2 .label').text('Year of batch:');
}
/* change sort2 label on member entry form page */
if ( $('#pat_memberentrygen').length ) {
$('label[for="sort2"]').text('Year of batch:');
}
Use the following SQL syntax to create a report based on sorts 1 and 2 to export patron details.
SELECT borrowers.cardnumber,borrowers.surname,borrowers.categorycode,borrowers.sort1,borrowers.sort2,borrowers.dateenrolled,borrowers.dateexpiry
FROM borrowers
WHERE branchcode=<<Patron Library|branches>>
AND categorycode LIKE << Patron Category|categorycode>>
AND sort1 LIKE <<Department|Bsort1>>
AND sort2 LIKE <<Year of batch|Bsort2>>
ORDER BY borrowers.cardnumber ASC
Report Result
Reference: