[Koha-devel] Where should I put this?

Mark Tompsett mtompset at hotmail.com
Wed Jun 3 18:07:45 CEST 2015


Greetings,

One of the bugs I was working on needs a function which is duplicated in a a couple places, so I was thinking it would be best to place it somewhere. The question is where?

sub getUserBranchAndCategorycode {
    my $borrowernumber = 0;
    my $homebranch = q{};
    my $categorycode = q{};
    if (C4::Context->userenv) {
        $borrowernumber = C4::Context->userenv->{'number'} || 0;
        $homebranch = C4::Context->userenv->{'branch'} || q{};
    }
    if ($borrowernumber) {
        $categorycode = C4::Members::GetBorrowerCategorycode($borrowernumber);
    }
    return { ‘branch’ => $homebranch, ‘categorycode’ => $categorycode };
}

GPML,
Mark Tompsett
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.koha-community.org/pipermail/koha-devel/attachments/20150603/38383d2c/attachment.html>


More information about the Koha-devel mailing list