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

Michael Hafen michael.hafen at washk12.org
Tue Sep 26 18:27:32 CEST 2023


I have in the past also made many customizations to Koha, but I was working
in 3.2 then.  After trying to port forward my customizations when there was
a Koha release, I decided I needed to learn code revision control to make
it easier to manage my changes.

The Koha Community Wiki has a nice page on using Git for tracking code
changes and making patch files:
https://wiki.koha-community.org/wiki/Version_Control_Using_Git

There is also a Bug Reporting Guidelines page:
https://wiki.koha-community.org/wiki/Bug_Reporting_Guidelines

And a Coding Guidelines page:
https://wiki.koha-community.org/wiki/Coding_Guidelines

That should be of interest as you continue working on Koha.

To use the Bugzilla you need to have an account first, so you'll have to
make one if you haven't already.  Then pick the Koha project.  In
components there is a 'label / patron card printing' component that I think
this change would fall under.  The rest of the options should be fine with
the defaults, just need to enter a summary and a description.  Once you
have the enhancement bug, you can take the bug number, as explained in the
wiki page, and use that in the patch title when adding the patch to the
bug.  We are expected to have a test plan, which in this case is as easy as:

  create patron card layout with <categorycode> in one of the text fields.
  run a batch with that layout and see the categorycode.
  apply patch
  run a batch with that layout and see that the category description now
appears

Let us know if you have any more questions.


On Mon, Sep 25, 2023 at 11:52 PM Zahid Iqbal <zahidiqbal.isb at gmail.com>
wrote:

> Michael i really appreciate the suggestion and your time to communicate.
>  but thing is that i have not use koha bugzilla.
> 2. how to create an enhancement request?
> 3. how can i set my code revision tracking?
> 4. the PATCH how to create patch (currently using Koha 22.11.07 version)
> sorry i have no experience in creating patch
>
> i want to learn new technologies and tools.
> can you guide me the steps 2 3 4 that i have no experience.
>
> Currently our library is using Koha 22.11.07 version. The older version
> which was version 2.2.9 and recently (4 months ago) i
> have transfer data(books,patrons,circulation) from Koha 2.2.9 to Koha
> 22.11.07
> i have done customization, report generation, create new modules in PHP if
> not present in koha according to library needs.
>
> thanks and regards,
>
> On Mon, Sep 25, 2023 at 9:51 PM Michael Hafen <michael.hafen at washk12.org>
> wrote:
>
>> I'm glad you got that figured out.
>> Be aware that you will have to make that change again if that file is
>> ever updated in a Koha release.  I would say it's not likely, but certainly
>> it can happen.
>> I suggest at this point either getting that into a patch and create an
>> enhancement request on the Koha Bugzilla, or set up your own code revision
>> tracking to make it easier to watch that file for changes.  I've done both
>> for the variety of changes I've made to the code, and I recommend trying
>> the enhancement request for this change.
>>
>>
>> On Sat, Sep 23, 2023 at 1:33 AM Zahid Iqbal <zahidiqbal.isb at gmail.com>
>> wrote:
>>
>>> 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*
>>>
>>>
>>
>> --
>> Michael Hafen
>> Washington County School District Technology Department
>> Systems Analyst
>>
>>
>
> --
> *Zahid Iqbal*
>


-- 
Michael Hafen
Washington County School District Technology Department
Systems Analyst
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.koha-community.org/pipermail/koha-devel/attachments/20230926/39f54e1b/attachment.htm>


More information about the Koha-devel mailing list