Bug 28650

Summary: Assumed branchcode variable appears to be empty
Product: Koha Reporter: Marcel de Rooy <m.de.rooy>
Component: TemplatesAssignee: Owen Leonard <oleonard>
Status: RESOLVED DUPLICATE QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: jonathan.druart
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27948
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28597
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 22880    
Bug Blocks:    

Description Marcel de Rooy 2021-07-02 07:00:39 UTC
Found on bug 27948, but it occurs more often.
We expect the variable branchcode in the template just like e.g. the lang variable. And we use it in a call to KohaNews.get.
Example from opac-suggestions template:

[% SET opacsuggestion = KohaNews.get( location => "OpacSuggestioninstructions", lang => lang, library => branchcode ) %]

But unfortunately we do not have a general branchcode variable.
So what we get is the All branches output, not the branch one.

Should we fill branchcode in Auth.pm? Or call Branches.GetLoggedInBranchcode in the template?
Comment 1 Marcel de Rooy 2021-07-02 07:01:07 UTC
Some spots to consider:

git grep "KohaNews.get"
Koha/Template/Plugin/KohaNews.pm:[% KohaNews.get() %]
Koha/Template/Plugin/KohaNews.pm:the following TT code: [% KohaNews.get() %]
koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead-sci.inc:[% SET OpacHeader = KohaNews.get( location => "opacheader", lang => lang, library => branchcode, blocktitle => 0 ) %]
koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead-sco.inc:[% SET OpacHeader = KohaNews.get( location => "opacheader", lang => lang, library => branchcode, blocktitle => 0 ) %]
koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc:[% SET OpacHeader = KohaNews.get( location => "opacheader", lang => lang, library => branchcode, blocktitle => 0 ) %]
koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc:[% SET OpacCustomSearch = KohaNews.get( location => "OpacCustomSearch", lang => lang, library => branchcode, blocktitle => 0 ) %]
koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc:[% SET OpacLoginInstructions = KohaNews.get( location => "OpacLoginInstructions", lang => lang, library => branchcode ) %]
koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc:[% SET opaccredits = KohaNews.get( location => "opaccredits", lang => lang, library => branchcode ) %]
koha-tmpl/opac-tmpl/bootstrap/en/modules/maintenance.tt:[% SET OpacHeader = KohaNews.get( location => "opacheader", lang => lang, library => branchcode, blocktitle => 0 ) %]
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth.tt:[% SET OpacLoginInstructions = KohaNews.get( location => "OpacLoginInstructions", lang => lang, library => branchcode ) %]
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt:[% SET OpacNavRight = KohaNews.get( location => "OpacNavRight", lang => lang, library => branchcode ) %]
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt:[% SET OpacMainUserBlock = KohaNews.get( location => "OpacMainUserBlock", lang => lang, library => branchcode ) %]
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt:[% SET OpacLoginInstructions = KohaNews.get( location => "OpacLoginInstructions", lang => lang, library => branchcode ) %]
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-registration-confirmation.tt:[% SET OpacNavRight = KohaNews.get( location => "OpacNavRight", lang => news_lang, library => branchcode ) %]
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-request-article.tt:[% SET disclaimer = KohaNews.get( location => "ArticleRequestsDisclaimerText", lang => lang, library => branchcode ) %]
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt:[% SET opacsuggestion = KohaNews.get( location => "OpacSuggestioninstructions", lang => lang, library => branchcode ) %]
koha-tmpl/opac-tmpl/bootstrap/en/modules/sci/sci-main.tt:[% SET OpacHeader = KohaNews.get( location => "opacheader", lang => lang, library => branchcode, blocktitle => 0 ) %]
Comment 2 Marcel de Rooy 2021-07-02 07:09:05 UTC
Decided to fix the call in koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-request-article.tt (bug 27948) by calling GetBranches.
Comment 3 Jonathan Druart 2021-07-06 13:45:10 UTC
Owen, can you have a look at this please?
Comment 4 Owen Leonard 2021-10-11 15:44:02 UTC
I believe this issue is fixed by Bug 24223.

*** This bug has been marked as a duplicate of bug 24223 ***