Bug 26246 - Create a display area to show pending requests
Summary: Create a display area to show pending requests
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Staff interface (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-08-19 03:05 UTC by Alvaro Cornejo
Modified: 2020-08-25 13:46 UTC (History)
2 users (show)

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


Attachments
display location example (29.87 KB, image/png)
2020-08-19 03:05 UTC, Alvaro Cornejo
Details
Example pendings on last-borrower (10.09 KB, image/png)
2020-08-23 16:51 UTC, Alvaro Cornejo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alvaro Cornejo 2020-08-19 03:05:18 UTC
Created attachment 108566 [details]
display location example

The idea is to have a display area that can be seen from any part of the staff client that will show pending requests (Articles, suggestions, reserves, etc) and will provide links to the page that will allow staff to acction them.

Currently some requests are not shown unless staff goes to specific area and some, like article requests or suggestions are only shown on the mainpage below the buttons. This location does not work well for low resolution screens since staff need to scroll down to check if there are any.

I´ve twinkled with header.inc and was able to have something shown, however, the pending counts are shown only in the main page. Cheking code I saw that either header.inc or the page calling header.inc will need to call corresponding functions.

An option like the "lastPatron" feature would be great.

I´m attaching other display location options.

Thanks!
Comment 1 Alvaro Cornejo 2020-08-20 03:42:35 UTC
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...
Comment 2 Alvaro Cornejo 2020-08-23 16:43:09 UTC
Hi still jiggling with this.

I didn´t found how to get a window for pendings similar to last-borrower so, for testing purposes, I´ve added pending codes to last-borrower.inc as:

 <div id="lastborrower-window">
     <div id="lastborrower-ref" class="lastborrower"><a id="lastborrowerlink" href="" title="">Last Patron</a>
         <a href="/cgi-bin/koha/circ/article-requests.pl">&nbsp Article Resquests</a>:<font color=004daf> [% pending_article_requests %] </font>
	 <a href="/cgi-bin/koha/suggestion/suggestion.pl#ASKED">Suggestions pending approval</a>:<font color=004daf>  [% pendingsuggestions | html %] </font>
	 <a href="/cgi-bin/koha/reviews/reviewswaiting.pl">Comments pending approval</a>:<font color=004daf> [% pendingcomments | html %]  </font>
	 <a href="/cgi-bin/koha/tags/review.pl">Tags pending approval</a>:<font color=004daf>  [% pendingtags | html %]</font>
      </div>
 <!--    <div id="lastborrower-remove" class="lastborrower"><i class="fa fa-remove"></i></div> -->
 </div>

You can see the result on the attached capture.

For now, those are fixed; however, an if(PendingVar) can be added to display each pending if there are any.

This still require to add, to each page where we want to display the pending, the correspoding code to get the pendings qty.

I´m still unable to know/understand how to handle user permissions.

BTW, does a feature like this might be accepted? Haven´t receive any comment yet
Comment 3 Alvaro Cornejo 2020-08-23 16:51:47 UTC
Created attachment 108960 [details]
Example pendings on last-borrower

As per comment #2
Comment 4 Owen Leonard 2020-08-25 13:45:02 UTC
It might be interesting to move the "Help" link to the header links "More" menu, and use that space for a "messages" icon. Clicking it would reveal a menu of various notifications. This would be consistent with macOS and Windows 10 interfaces where there is an icon in the corner of the screen to reveal messages.
Comment 5 Owen Leonard 2020-08-25 13:46:03 UTC
I should have added: It would probably be necessary to add an API for accessing these messages so that we don't have to load the information on every page.