Customize sort1 and sort2 patrons fields through authorized values

Patron sort1 and sort2 fields are used to store the patron's information which is not pre-assigned in the patron's form. Koha allows creating a dropdown list for these fields by adding authorized value. You need to add the sort fields (sort1 and sort2) to the Authorized Value bsort1 and bsort2. Further, you can change the wording of these fields e.g. Course Name, Session, Semester, Designation, Blood Group, etc. 

Let's know how to connect authorized values to the sort1 & sort2 fields. In this article, I used the sort1 field for the "Course Name" and the sort2 field for the "Semester".

Create authorized values for sort1 (For Course Name)

Go to Koha Administration ➤ Authorized Values  Click on Bsort1

Bsort1

Next, Click on "New authorized value for the Bsort1" 

Authorized value for Bsort1

Enter the values for the Course Name and save



Create the Authorized value for all courses



Now the same way create Authorized values for sort2 (For Semesters)


Go to Koha  Administration ➤ Authorized Values and Select Bsort2


Likewise, add all  Semesters 



In order to change the wording sort1 and sort2 to Course and Semester, add the following JavaScript to the IntranetUserJS in Global system preferences.


Home ➤ Administration ➤ System preferences  ➤ IntranetUserJS

/* change sort1 label on member details page */
if ( $('#pat_moremember').length ) {
    $('#patron-sort1 .label').text('Course:');
}
/* change sort1 label on member entry form page */
if ( $('#pat_memberentrygen').length ) {
    $('label[for="sort1"]').text('Course:');
}

/* change sort2 label on member details page */
if ( $('#pat_moremember').length ) {
    $('#patron-sort2 .label').text('Semester:');
}
/* change sort2 label on member entry form page */
if ( $('#pat_memberentrygen').length ) {
    $('label[for="sort2"]').text('Semester:');
}

You will see the Course name and Semester in the patrons form while adding new patrons instead of sort1 and sort2. And you can easily choose the Course Name and Semester from the drop-down list.

Create a report based on Course (sort1) and Semester (sort2)

SELECT  borrowers.cardnumber,borrowers.firstname,borrowers.surname,address,borrowers.categorycode,dateenrolled, dateexpiry,borrowers.sort1,borrowers.sort2
FROM borrowers 
WHERE branchcode=<<Patron Library|branches>> 
AND categorycode LIKE << Patron Category|categorycode>> 
AND sort1 LIKE <<Course|Bsort1>> 
AND sort2 LIKE <<Semester|Bsort2>>
ORDER BY borrowers.cardnumber ASC

Select the parameters e.g. Patron Library, Patron Category, Course, and Semester, and Run the report. 


Reference:- https://wiki.koha-community.org/wiki/JQuery_Library#Relabel_Sort1_on_Patron_Record

Post a Comment

0 Comments