[Koha-bugs] [Bug 26246] Create a display area to show pending requests

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Aug 20 05:42:35 CEST 2020


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26246

--- Comment #1 from Alvaro Cornejo <cornejo.alvaro at gmail.com> ---
Have done some testings for article requests adding this code to header.inc 

     [%# ALVARO ADDED FOR SHOW PENDINGS %]
     [% IF ( pending_article_requests ) %]
         <li>
           <a href="/cgi-bin/koha/circ/article-requests.pl">Article requests:
[% pending_article_requests | html %]</a>
         </li>
     [% END %]

With this modiification pending articles appear only in main menu since others
do not have access to pending info "pending_article_requests".

For other pages to include pending info (tested only with article request), we
need to include these libraries:

  use C4::Context;
  use Koha::ArticleRequests;
  use Koha::BiblioFrameworks;

We also need to include variable $flags in the definition of
get_template_and_user even if original script does not use it so it will be
something like

 my ($template, $loggedinuser, $cookie, $flags) = get_template_and_user(

Note that it seems the content of the array? does not matter...

and finaly add the code to get the values for the pendings:

  # ALVARO TEST
    my $branch =
      (      C4::Context->preference("IndependentBranchesPatronModifications")
          || C4::Context->preference("IndependentBranches") )
      && !$flags->{'superlibrarian'}
      ? C4::Context->userenv()->{'branch'}
      : undef;

    my $pending_article_requests = Koha::ArticleRequests->search_limited(
        {
            status => Koha::ArticleRequest::Status::Pending,
            $branch ? ( 'me.branchcode' => $branch ) : (),
        }
    )->count;
    $template->param(   pending_article_requests       =>
$pending_article_requests,  );
  ## END ALVARO

Before sending the html output to template

  output_html_with_http_headers $query, $cookie, $template->output;


So far I tried with search.pl, ciculation-home.pl, detail.pl, addbiblio.pl
tool-home.pl and members-home.pl and worked fine in all cases

I guess it can be possible to add the others pending notices in the same way

I apologise if the code/terms used are not the correct ones but I´m by no means
a programmer but just have some basic understanding of it. Have no idea if what
I´ve done have any impact somewhere else... specially with user permits...

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.


More information about the Koha-bugs mailing list