[Koha] [Koha-devel] cannot display branchname and patron category description in card layout

Zahid Iqbal zahidiqbal.isb at gmail.com
Sat Sep 23 19:33:18 NZST 2023


I have completed the patron category description and it is correctly
showing in pdf file from patron card creator.
anyone that needs help for patron category description is not showing in
pdf please do the following.
In  *C4/Patroncards/Lib.pm *file.

search for line "*$get_branch = 1 if grep{$_ eq 'branchcode'} @fields;*"
after, add following lines

my $get_patroncategory = 0;
$get_patroncategory = 1 if grep{$_ eq 'categorycode'} @fields;

search for line "*return $borrower_attributes;*"  before this line, add
following lines

    if ($get_patroncategory) {
        $query = "SELECT description FROM categories WHERE categorycode =
?";
        $sth = C4::Context->dbh->prepare($query);
        $sth->execute($borrower_attributes->{'categorycode'});
        if ($sth->err) {
            warn sprintf('Database returned the following error: %s',
$sth->errstr);
            return 1;
        }
        $borrower_attributes->{'categorycode'} =
$sth->fetchrow_hashref()->{'description'};
    }


Thanks for the help Michael, it really helps me. At least I do not have to
track this file.



On Fri, Sep 22, 2023 at 10:31 AM Zahid Iqbal <zahidiqbal.isb at gmail.com>
wrote:

> Thanks Michael that will be very helpful. I will look into the code
> and get back to you. For now i am working on picture uploading (restrict
> image not more than 4KB and not more then 150 Height Width dimension) so
> the database does not get heavy.
>
> On Thu, Sep 21, 2023 at 9:38 PM Michael Hafen <michael.hafen at washk12.org>
> wrote:
>
>> If you are looking at the code, look at C4/Patroncards/Lib.pm in the
>> get_borrower_attributes() function.  That's where the branchcode to
>> branchname conversion is handled, I figure that would be the place to do a
>> categorycode to category description conversion.
>>
>> On Thu, Sep 21, 2023 at 12:17 AM Zahid Iqbal <zahidiqbal.isb at gmail.com>
>> wrote:
>>
>>> thanks for the response.
>>> i have checked the branchcode, it is displaying correctly in patron card
>>> as you told. 👍
>>> but i cannot find any solution for categorycode. I will still look into
>>> code. Maybe I will find a solution for that.
>>>
>>> On Wed, Sep 20, 2023 at 9:08 PM Michael Hafen <michael.hafen at washk12.org>
>>> wrote:
>>>
>>>> I have a layout using "<sort2>" in the text box for field 2.  Looks
>>>> like the code will change "<branchcode>" into the library name.  No such
>>>> luck in current code for patron category though.
>>>>
>>>> On Tue, Sep 19, 2023 at 11:17 PM Zahid Iqbal <zahidiqbal.isb at gmail.com>
>>>> wrote:
>>>>
>>>>> Hi, In koha 22.11 can someone guide to print branchname and patron
>>>>> category description on pdf file for patron card creator
>>>>>
>>>>>    1. print branchname not branchcode
>>>>>    2. print patron-category-description not categorycode
>>>>>
>>>>>
>>>>> what are the values i have to type in text box for field1 and field2
>>>>> in patron card layout  for printing branchname and
>>>>> patron-category-description?
>>>>>
>>>>> i am stuck with this problem and cannot find any other solution
>>>>> Can anyone suggest that i have to change the code or is there any
>>>>> other way that it can be solved?
>>>>> I am not an expert in coding, any help will be appreciated.
>>>>>
>>>>> Best Regards
>>>>> --
>>>>> *Zahid Iqbal*
>>>>> _______________________________________________
>>>>> Koha-devel mailing list
>>>>> Koha-devel at lists.koha-community.org
>>>>> https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
>>>>> website : https://www.koha-community.org/
>>>>> git : https://git.koha-community.org/
>>>>> bugs : https://bugs.koha-community.org/
>>>>>
>>>>
>>>>
>>>> --
>>>> Michael Hafen
>>>> Washington County School District Technology Department
>>>> Systems Analyst
>>>>
>>>>
>>>
>>> --
>>> *Zahid*
>>>
>>
>>
>> --
>> Michael Hafen
>> Washington County School District Technology Department
>> Systems Analyst
>>
>>
>
> --
> *Zahid*
>


-- 
*Zahid Iqbal*


More information about the Koha mailing list