MT 2269, Follow-up : Granular permissions for items batch modification and deletion
authorMatthias Meusburger <matthias.meusburger@biblibre.com>
Wed, 24 Mar 2010 08:24:18 +0000 (09:24 +0100)
committerGalen Charlton <gmcharlt@gmail.com>
Fri, 30 Apr 2010 01:55:39 +0000 (21:55 -0400)
Change of permissions names
Change of branch title in guided reports
Add a "Select All / Clean All" on items selection
Add a link to item when a given item cannot be deleted

Signed-off-by: Galen Charlton <gmcharlt@gmail.com>

installer/data/mysql/en/mandatory/userpermissions.sql
installer/data/mysql/updatedatabase.pl
koha-tmpl/intranet-tmpl/prog/en/columns.def
koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc
koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-del.tmpl
koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tmpl
koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod.tmpl
koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tmpl
kohaversion.pl
tools/batchMod.pl

index d737ae6..a392c14 100644 (file)
@@ -30,8 +30,8 @@ INSERT INTO permissions (module_bit, code, description) VALUES
    (13, 'delete_anonymize_patrons', 'Delete old borrowers and anonymize circulation history (deletes borrower reading history)'),
    (13, 'batch_upload_patron_images', 'Upload patron images in batch or one at a time'),
    (13, 'schedule_tasks', 'Schedule tasks to run'),
-   (13, 'batchmod', 'Perform batch modification of items'),
-   (13, 'batchdel', 'Perform batch deletion of items'),
+   (13, 'items_batchmod', 'Perform batch modification of items'),
+   (13, 'items_batchdel', 'Perform batch deletion of items'),
    (13, 'manage_csv_profiles', 'Manage CSV export profiles'),
    (13, 'moderate_tags', 'Moderate patron tags'),
    (13, 'rotating_collections', 'Manage rotating collections'),
index eb364d3..908bb7c 100755 (executable)
@@ -3555,6 +3555,16 @@ if (C4::Context->preference('Version') < TransformToNum($DBversion)){
     SetVersion ($DBversion);
 }
 
+$DBversion = "3.02.00.129";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+       $dbh->do("UPDATE `permissions` SET `code` = 'items_batchdel' WHERE `permissions`.`module_bit` =13 AND `permissions`.`code` = 'batchdel' LIMIT 1 ;");
+       $dbh->do("UPDATE `permissions` SET `code` = 'items_batchmod' WHERE `permissions`.`module_bit` =13 AND `permissions`.`code` = 'batchmod' LIMIT 1 ;");
+       print "Upgrade done (Change permissions names for item batch modification / deletion)\n";
+
+    SetVersion ($DBversion);
+}
+
+
 =item DropAllForeignKeys($table)
 
   Drop all foreign keys of the table $table
index 6493288..4aa6637 100644 (file)
@@ -56,7 +56,7 @@ items.biblioitemnumber        Biblioitem Number (koha internal)
 items.barcode  Barcode
 items.dateaccessioned  Accession Date
 items.booksellerid     Supplier ID
-items.homebranch       Permanent Branch Code
+items.homebranch       Home Branch
 items.price    Price
 items.replacementprice Replacement Price
 items.replacementpricedate     Date Replacement Price was set
@@ -75,7 +75,7 @@ items.reserves        Reserves Count
 items.restricted       Item Restricted
 items.binding  Item needs binding
 items.itemnotes        Item Notes
-items.holdingbranch    Current Branch
+items.holdingbranch    Holding Branch
 items.paidfor  Has Item been lost and then paid for
 items.timestamp        Timestamp
 items.location Location
index c5b81c6..a9e4450 100644 (file)
 </ul>
 <h5>Catalog</h5>
 <ul>
-    <!-- TMPL_IF NAME="CAN_user_tools_batchdel" -->
+    <!-- TMPL_IF NAME="CAN_user_tools_items_batchdel" -->
        <li><a href="/cgi-bin/koha/tools/batchMod.pl?del=1">Batch deletion of items</a></li>
     <!--/TMPL_IF-->
-    <!-- TMPL_IF NAME="CAN_user_tools_batchmod" -->
+    <!-- TMPL_IF NAME="CAN_user_tools_items_batchmod" -->
        <li><a href="/cgi-bin/koha/tools/batchMod.pl">Batch modification of items</a></li>
     <!--/TMPL_IF-->
     <!-- TMPL_IF NAME="CAN_user_tools_export_catalog" -->
index 1ba9b24..bf9b348 100644 (file)
@@ -6,6 +6,17 @@
 //<![CDATA[
          $(document).ready(function() {
            $("#itemst").tablesorter();
+           $("#selectallbutton").click(function() {
+               $("#itemst").find("input:checkbox").each(function() {
+                   $(this).attr("checked", true);
+               });
+           });
+           $("#clearallbutton").click(function() {
+               $("#itemst").find("input:checkbox").each(function() {
+                   $(this).attr("checked", false);
+               });
+           });
+
         });
 //]]>
 </script>
@@ -56,6 +67,7 @@
 <!-- TMPL_IF name="item_loop" -->
        <div id="cataloguing_additem_itemlist">
                <div style="overflow:auto">
+               <div id="toolbar"><a id="selectallbutton" href="#">Select All</a> | <a id="clearallbutton" href="#">Clear All</a></div>
                <table id="itemst">
                    <thead>
                        <tr>
                    <!-- TMPL_LOOP name="not_deleted_loop" -->
                        <tr>
                            <td><!-- TMPL_VAR name="itemnumber" --></td>
-                           <td><!-- TMPL_VAR name="barcode" --></td>
+                           <td><a href="/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->&itemnumber=<!-- TMPL_VAR NAME="itemnumber" -->"><!-- TMPL_VAR name="barcode" --></a></td>
                            <td><!-- TMPL_IF name="book_on_loan" -->Item is checked out<!-- TMPL_ELSIF name="book_reserved" -->Item has a waiting hold<!-- /TMPL_IF --></td>
                        </tr>
                    <!-- /TMPL_LOOP -->
index acc9e12..c93eec5 100644 (file)
@@ -6,6 +6,17 @@
 //<![CDATA[
          $(document).ready(function() {
            $("#itemst").tablesorter();
+           $("#selectallbutton").click(function() {
+               $("#itemst").find("input:checkbox").each(function() {
+                   $(this).attr("checked", true);
+               });
+           });
+           $("#clearallbutton").click(function() {
+               $("#itemst").find("input:checkbox").each(function() {
+                   $(this).attr("checked", false);
+               });
+           });
+
         });
 //]]>
 </script>
@@ -17,7 +28,7 @@
 <div id="breadcrumbs">
        <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
        <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo;
-       <a href="/cgi-bin/koha/tools/batchMod.pl">Modify batches of notices</a>
+       <a href="/cgi-bin/koha/tools/batchMod.pl">Modify batches of items</a>
 </div>
 
 <div id="doc3" class="yui-t2">
@@ -53,6 +64,7 @@
 <!-- TMPL_IF name="item_loop" -->
 <div id="cataloguing_additem_itemlist">
         <div style="overflow:auto">
+       <div id="toolbar"><a id="selectallbutton" href="#">Select All</a> | <a id="clearallbutton" href="#">Clear All</a></div>
         <table id="itemst">
            <thead>
                <tr>
index 2a0135f..140237c 100644 (file)
@@ -6,6 +6,7 @@
 //<![CDATA[
          $(document).ready(function() {
            $("#itemst").tablesorter();
+
         });
 //]]>
 </script>
index 4490c78..a33f597 100644 (file)
     <dt><a href="/cgi-bin/koha/tools/scheduler.pl">Task scheduler</a></dt>
     <dd>Schedule tasks to run</dd>
     <!-- /TMPL_IF -->
+       
 
 </dl>
 </div>
 <div class="yui-u">
 <h3>Catalog</h3>
 <dl>
-    <!-- TMPL_IF NAME="CAN_user_tools_batchdel" -->
-    <dt><a href="/cgi-bin/koha/tools/batchMod.pl?del=1">Batch item deletion</a></dt>
-    <dd>Perform batch deletion of items</dd>
+    <!-- TMPL_IF NAME="CAN_user_tools_items_batchmod" -->
+    <dt><a href="/cgi-bin/koha/tools/batchMod.pl">Modify a queryset of items</a></dt>
+    <dd>Perform batch modification of items</dd>
     <!-- /TMPL_IF -->
 
-    <!-- TMPL_IF NAME="CAN_user_tools_batchmod" -->
-    <dt><a href="/cgi-bin/koha/tools/batchMod.pl">Batch item modification</a></dt>
-    <dd>Perform batch modification of items</dd>
+    <!-- TMPL_IF NAME="CAN_user_tools_items_batchdel" -->
+    <dt><a href="/cgi-bin/koha/tools/batchMod.pl?del=1">Delete a queryset of items</a></dt>
+    <dd>Perform batch deletion of items</dd>
     <!-- /TMPL_IF -->
     
     <!-- TMPL_IF NAME="CAN_user_tools_export_catalog" -->
index 52efaa0..884c0e2 100644 (file)
@@ -10,7 +10,7 @@
 use strict;
 
 sub kohaversion {
-    our $VERSION = '3.01.00.128';
+    our $VERSION = '3.01.00.129';
     # version needs to be set this way
     # so that it can be picked up by Makefile.PL
     # during install
index 4962607..11960fc 100755 (executable)
@@ -49,7 +49,7 @@ if (!defined $op) {
     $template_flag = { tools => '*' };
 } else {
     $template_name = ($del) ? "tools/batchMod-del.tmpl" : "tools/batchMod-edit.tmpl";
-    $template_flag = ($del) ? { tools => 'batchdel' }   : { tools => 'batchmod' };
+    $template_flag = ($del) ? { tools => 'items_batchdel' }   : { tools => 'items_batchmod' };
 }
 
 
@@ -99,7 +99,7 @@ if ($op eq "action") {
                        $deleted_items++;
                    } else {
                        $not_deleted_items++;
-                       push @not_deleted, { itemnumber => $itemdata->{'itemnumber'}, barcode => $itemdata->{'barcode'}, title => $itemdata->{'title'}, $return => 1 };
+                       push @not_deleted, { biblionumber => $itemdata->{'biblionumber'}, itemnumber => $itemdata->{'itemnumber'}, barcode => $itemdata->{'barcode'}, title => $itemdata->{'title'}, $return => 1 };
                    }
            } else {
                if ($something_to_modify) {