Bug 33133: Add fast cataloging to 'Cataloging' page
authorNick Clemens <nick@bywatersolutions.com>
Fri, 3 Mar 2023 20:23:31 +0000 (20:23 +0000)
committerTomas Cohen Arazi <tomascohen@theke.io>
Mon, 27 Mar 2023 10:50:07 +0000 (12:50 +0200)
This patch adds a check for the existence of the Fast Add framework to
the Koha mainpage and the cataloging home page

If it exists, and the user has fast cataloging permission then there
will be a link to Cataloging on the home page, and to Fast add on the
cataloging page

To test:
1 - Have two patrons, one with superlibrarian and one with only
  catalogue + fast_cataloging
2 - Make sure you have a fast add framework (code:FA)
3 - Have two windows/tabs one with each patron (one private/incognito or
  use two browsers)
4 - View mainpage.pl for both
5 - Superlibrarian has Catalogue link, other does not
6 - Browse to http://localhost:8081/cgi-bin/koha/cataloguing/cataloging-home.pl
7 - Superlibrarian sees stuff, other can access page, but has no buttons
8 - Apply patch
9 - Repeat 4 - both have a link
10 - Repeat 7 - both have a link to fast add
11 - Confirm fast add link works

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
cataloguing/cataloging-home.pl
koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/cataloging-home.tt
koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt
mainpage.pl

index 7832740..28c5293 100755 (executable)
@@ -43,6 +43,7 @@ my $servers = Koha::Z3950Servers->search(
 );
 
 my $frameworks = Koha::BiblioFrameworks->search({}, { order_by => ['frameworktext'] });
+$template->param( fast_cataloging => 1 ) if $frameworks->find({ frameworkcode => 'FA' });
 
 $template->param(
     servers           => $servers,
index 0418628..1c68165 100644 (file)
 
                     <div class="col-sm-4 col-md-4">
 
-                        [% IF ( CAN_user_tools_label_creator || CAN_user_tools_upload_local_cover_images ) %]
+                        [% IF ( CAN_user_tools_label_creator || CAN_user_tools_upload_local_cover_images || ( fast_cataloging && CAN_user_editcatalogue_fast_cataloging  ) ) %]
                         <h3>Tools</h3>
                         <ul class="buttons-list">
                             [% IF ( CAN_user_tools_label_creator ) %]
                             </li>
                             [% END %]
 
+                            [% IF ( CAN_user_editcatalogue_fast_cataloging ) %]
+                            <li>
+                                <a class="circ-button" href="/cgi-bin/koha/cataloguing/addbiblio.pl?frameworkcode=FA"><i class="fa fa-plus"></i> Fast cataloging</a>
+                            </li>
+                            [% END %]
+
                         </ul>
                         [% END %]
 
index 63e4995..8f956fd 100644 (file)
                             </li>
                             [% END %]
 
-                            [% IF ( CAN_user_editcatalogue_edit_catalogue || CAN_user_editcatalogue_edit_items ) %]
+                            [% IF ( CAN_user_editcatalogue_edit_catalogue || CAN_user_editcatalogue_edit_items || ( fast_cataloging && CAN_user_editcatalogue_fast_cataloging ) ) %]
                             <li>
                                 <a class="icon_general icon_cataloging" href="/cgi-bin/koha/cataloguing/cataloging-home.pl"><i class="fa fa-fw fa-tag"></i>Cataloging</a>
                             </li>
index 53f6335..855913a 100755 (executable)
@@ -30,6 +30,7 @@ use Koha::Patron::Modifications;
 use Koha::Patron::Discharge;
 use Koha::Reviews;
 use Koha::ArticleRequests;
+use Koha::BiblioFrameworks;
 use Koha::ProblemReports;
 use Koha::Quotes;
 use Koha::Suggestions;
@@ -50,6 +51,9 @@ my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user(
 
 my $logged_in_user = Koha::Patrons->find($loggedinuser);
 
+# Checking if there is a Fast Cataloging Framework
+$template->param( fast_cataloging => 1 ) if Koha::BiblioFrameworks->find( 'FA' );
+
 my $homebranch;
 if (C4::Context->userenv) {
     $homebranch = C4::Context->userenv->{'branch'};