Bug 28650 - Assumed branchcode variable appears to be empty
Summary: Assumed branchcode variable appears to be empty
Status: RESOLVED DUPLICATE of bug 24223
Alias: None
Product: Koha
Classification: Unclassified
Component: Templates (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Owen Leonard
QA Contact: Testopia
URL:
Keywords:
Depends on: 22880
Blocks:
  Show dependency treegraph
 
Reported: 2021-07-02 07:00 UTC by Marcel de Rooy
Modified: 2021-10-11 15:44 UTC (History)
1 user (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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 ***