Bug 12403 [Follow-up] Batch record deletion
authorOwen Leonard <oleonard@myacpl.org>
Tue, 28 Oct 2014 14:07:22 +0000 (10:07 -0400)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Fri, 7 Nov 2014 18:26:02 +0000 (15:26 -0300)
This follow-up makes several changes to language and markup with one
change in behavior:

- Updated permission description to avoid the use of the term "biblio"
- Updated batch delete template to avoid the use of the term
  "biblio" and to improve clarity.
- Replaced instances of terms "issue" and "reserve" with "checkout" and
  "hold" respectively.
- On bibliographic record batch delete, wrap biblionumber in <label>.
- On bibliographic record batch delete, show subtitle via Keywords to
  MARC mapping.
- On bibliographic record batch delete, respect BiblioDefaultView system
  preference.
- In the staff client cart, move batch delete link from "Action" menu
  to text link below (alongside "add to list" and "place hold"). The
  buttons are actions which affect the whole Cart. The links are actions
  which can be applied to selected items. I think this change makes it
  more consistent with the kind of operation being performed.

To test:

- Submit a batch of bibliographic records and confirm that the
  list of titles shows subtitle data as defined in Keywords to MARC
  mapping. Confirm also that the title links respect your
  BiblioDefaultView system preference.

- Perform a catalog search, select several titles, and add them to the
  Cart. Open the Cart and test the "Batch delete" link with and without
  titles selected. Test as a user who lacks batch biblio delete
  permission and confirm that the link does not appear.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Work as described, no koha-qa errors

I love the rewording, we always translated 'biblio' as 'bibliographic record',
it makes a lot of sense.

Tested using direct input of biblionumber or cart, subtitle display shows
correctly, link respect preference, user without permission cant acces the
tool or links.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
14 files changed:
installer/data/mysql/de-DE/mandatory/userpermissions.sql
installer/data/mysql/en/mandatory/userpermissions.sql
installer/data/mysql/es-ES/mandatory/userpermissions.sql
installer/data/mysql/fr-FR/1-Obligatoire/userpermissions.sql
installer/data/mysql/it-IT/necessari/userpermissions.sql
installer/data/mysql/nb-NO/1-Obligatorisk/userpermissions.sql
installer/data/mysql/pl-PL/mandatory/userpermissions.sql
installer/data/mysql/ru-RU/mandatory/permissions_and_user_flags.sql
installer/data/mysql/uk-UA/mandatory/permissions_and_user_flags.sql
installer/data/mysql/updatedatabase.pl
koha-tmpl/intranet-tmpl/prog/en/modules/basket/basket.tt
koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_delete_records.tt
koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt
tools/batch_delete_records.pl

index 534fbdf..59e6bab 100644 (file)
@@ -50,7 +50,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES
    (13, 'upload_local_cover_images', 'Eigene Coverbilder hochladen'),
    (13, 'manage_patron_lists', 'Benutzerlisten anlegen, bearbeiten und löschen'),
    (13, 'marc_modification_templates', 'Templates für MARC-Modifikationen verwalten'),
-   (13, 'records_batchdel', 'Perform batch deletion of records (biblios or authorities)'),
+   (13, 'records_batchdel', 'Perform batch deletion of records (bibliographic or authority)'),
    (15, 'check_expiration', 'Ablauf eines Abonnements prüfen'),
    (15, 'claim_serials', 'Fehlende Hefte reklamieren'),
    (15, 'create_subscription', 'Neue Abonnements anlegen'),
index 5817499..f8e3e9d 100644 (file)
@@ -50,7 +50,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES
    (13, 'upload_local_cover_images', 'Upload local cover images'),
    (13, 'manage_patron_lists', 'Add, edit and delete patron lists and their contents'),
    (13, 'marc_modification_templates', 'Manage marc modification templates'),
-   (13, 'records_batchdel', 'Perform batch deletion of records (biblios or authorities)'),
+   (13, 'records_batchdel', 'Perform batch deletion of records (bibliographic or authority)'),
    (15, 'check_expiration', 'Check the expiration of a serial'),
    (15, 'claim_serials', 'Claim missing serials'),
    (15, 'create_subscription', 'Create a new subscription'),
index efc1d68..8b7cc26 100644 (file)
@@ -50,7 +50,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES
    (13, 'upload_local_cover_images', 'Upload local cover images'),
    (13, 'manage_patron_lists', 'Add, edit and delete patron lists and their contents'),
    (13, 'marc_modification_templates', 'Manage marc modification templates'),
-   (13, 'records_batchdel', 'Perform batch deletion of records (biblios or authorities)'),
+   (13, 'records_batchdel', 'Perform batch deletion of records (bibliographic or authority)'),
    (15, 'check_expiration', 'Check the expiration of a serial'),
    (15, 'claim_serials', 'Claim missing serials'),
    (15, 'create_subscription', 'Create a new subscription'),
index 5aa224b..b70438a 100644 (file)
@@ -50,7 +50,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES
    (13, 'items_batchdel', 'Supprimer les exemplaires par lot'),
    (13, 'upload_local_cover_images', 'Téléchargement des images de couverture'),
    (13, 'manage_patron_lists', 'Add, edit and delete patron lists and their contents'),
-   (13, 'records_batchdel', 'Perform batch deletion of records (biblios or authorities)'),
+   (13, 'records_batchdel', 'Perform batch deletion of records (bibliographic or authority)'),
    (15, 'check_expiration', 'Contrôler l''expiration d''un périodique'),
    (15, 'claim_serials', 'Réclamer les périodiques manquants'),
    (15, 'create_subscription', 'Créer de nouveaux abonnements'),
index cb745e7..3ad8ff7 100644 (file)
@@ -50,7 +50,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES
    (13, 'upload_local_cover_images', 'Carica copertine in locale'),
    (13, 'manage_patron_lists', 'Aggiungi, modifica e cancella le liste utenti e i loro contenuti'),
    (13, 'marc_modification_templates', 'Gestisci le modifiche sulle griglie di catalogazione MARC'),
-   (13, 'records_batchdel', 'Perform batch deletion of records (biblios or authorities)'),
+   (13, 'records_batchdel', 'Perform batch deletion of records (bibliographic or authority)'),
    (15, 'check_expiration', 'Controlla la scadenza di una risora in continuazione'),
    (15, 'claim_serials', 'Richiedi i fascicoli non arrivati'),
    (15, 'create_subscription', 'Crea un nuovo abbonamento'),
index 1b49fee..bcc1175 100644 (file)
@@ -70,7 +70,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES
    (13, 'upload_local_cover_images', 'Laste opp lokale omslagsbilder'),
    (13, 'manage_patron_lists', 'Add, edit and delete patron lists and their contents'),
    (13, 'marc_modification_templates', 'Manage marc modification templates'),
-   (13, 'records_batchdel', 'Perform batch deletion of records (biblios or authorities)'),
+   (13, 'records_batchdel', 'Perform batch deletion of records (bibliographic or authority)'),
    (15, 'check_expiration', 'Sjekke utløpsdato for et periodikum'),
    (15, 'claim_serials', 'Purre manglende tidsskrifthefter'),
    (15, 'create_subscription', 'Opprette abonnementer'),
index aed4822..caf1db8 100644 (file)
@@ -51,7 +51,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES
    (13, 'rotating_collections', 'Manage rotating collections'),
    (13, 'upload_local_cover_images', 'Upload local cover images'),
    (13, 'manage_patron_lists', 'Add, edit and delete patron lists and their contents'),
-   (13, 'records_batchdel', 'Perform batch deletion of records (biblios or authorities)'),
+   (13, 'records_batchdel', 'Perform batch deletion of records (bibliographic or authority)'),
    (15, 'check_expiration', 'Check the expiration of a serial'),
    (15, 'claim_serials', 'Claim missing serials'),
    (15, 'create_subscription', 'Create a new subscription'),
index 8286e98..9b9839d 100644 (file)
@@ -76,7 +76,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES
    (13, 'upload_local_cover_images', 'Upload local cover images'),
    (13, 'manage_patron_lists', 'Add, edit and delete patron lists and their contents'),
    (13, 'marc_modification_templates', 'Manage marc modification templates'),
-   (13, 'records_batchdel', 'Perform batch deletion of records (biblios or authorities)'),
+   (13, 'records_batchdel', 'Perform batch deletion of records (bibliographic or authority)'),
    (15, 'check_expiration',            'Check the expiration of a serial'),
    (15, 'claim_serials',               'Claim missing serials'),
    (15, 'create_subscription',         'Create a new subscription'),
index 19d6d17..40d741f 100644 (file)
@@ -76,7 +76,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES
    (13, 'upload_local_cover_images', 'Upload local cover images'),
    (13, 'manage_patron_lists', 'Add, edit and delete patron lists and their contents'),
    (13, 'marc_modification_templates', 'Manage marc modification templates'),
-   (13, 'records_batchdel', 'Perform batch deletion of records (biblios or authorities)'),
+   (13, 'records_batchdel', 'Perform batch deletion of records (bibliographic or authority)'),
    (15, 'check_expiration',            'Check the expiration of a serial'),
    (15, 'claim_serials',               'Claim missing serials'),
    (15, 'create_subscription',         'Create a new subscription'),
index 33c936e..5f527dd 100755 (executable)
@@ -9413,9 +9413,9 @@ $DBversion = "3.15.00.XXX";
 if ( CheckVersion($DBversion) ) {
     $dbh->do(q|
         INSERT INTO permissions (module_bit, code, description) VALUES
-          (13, 'records_batchdel', 'Perform batch deletion of records (biblios or authorities)')
+          (13, 'records_batchdel', 'Perform batch deletion of records (bibliographic or authority)')
     |);
-    print "Upgrade to $DBversion done (Bug 12403: Add permission tools_records_batchdel)\n";
+    print "Upgrade to $DBversion done (Bug 12403: Add permission tools_records_batchdelitem)\n";
     SetVersion($DBversion);
 }
 
index 60fd2e4..39a2a07 100644 (file)
@@ -40,7 +40,27 @@ function placeHold () {
     window.opener.location = newloc;
     window.close();
 }
+[% IF CAN_user_tools_records_batchdel %]
+function batchDelete(){
+    var checkedItems = $("input:checkbox:checked");
+    if ($(checkedItems).size() == 0) {
+        alert(MSG_NO_RECORD_SELECTED);
+        return false;
+    }
+    var newloc;
+
+    var bibs = "";
+    $(checkedItems).each(function() {
+        var bib = $(this).val();
+        bibs += bib + "/";
+    });
+
+    newloc = "/cgi-bin/koha/tools/batch_delete_records.pl?op=list&type=biblio&bib_list=" + bibs;
 
+    window.opener.location = newloc;
+    window.close();
+}
+[% END %]
        $(document).ready(function(){
                 $("#items-popover").popover();
                $("#CheckAll").click(function(){
@@ -101,12 +121,6 @@ function placeHold () {
         [% END %]
         </ul>
     </div>
-    <div class="btn-group">
-        <a class="btn btn-small dropdown-toggle" data-toggle="dropdown" href="#" id="actioncart"><i class="icon-play"></i> Actions <span class="caret"></span> </a>
-        <ul class="dropdown-menu">
-            <li><a href="/cgi-bin/koha/tools/batch_delete_records.pl?op=list&amp;bib_list=[% bib_list %]&amp;type=biblio">Delete</a></li>
-        </ul>
-    </div>
     <a class="btn btn-small" href="basket.pl" onclick="printBasket(); return false;"><i class="icon-print"></i> Print</a>
     <a class="btn btn-small" href="basket.pl" onclick="delBasket('popup'); return false;"><i class="icon-trash"></i> Empty and close</a>
     <a class="btn btn-small close" href="basket.pl"><i class="icon-remove-sign"></i> Hide window</a>
@@ -126,6 +140,10 @@ function placeHold () {
      | <a href="#" onclick="placeHold(); return false;">Place hold</a>
 [% END %]
 
+[% IF CAN_user_tools_records_batchdel %]
+    | <a href="#" onclick="batchDelete(); return false;">Batch delete</a>
+[% END %]
+
 </p>[% END %]
             <form action="basket.pl" method="get" name="bookbag_form" id="bookbag_form">
     [% FOREACH BIBLIO_RESULT IN BIBLIO_RESULTS %]
@@ -294,6 +312,10 @@ function placeHold () {
      | <a href="#" onclick="placeHold(); return false;">Place hold</a>
 [% END %]
 
+[% IF CAN_user_tools_records_batchdel %]
+    | <a href="#" onclick="batchDelete(); return false;">Batch delete</a>
+[% END %]
+
 [% END %]
 
 </p>
index 6afc7bf..182cc8b 100644 (file)
@@ -37,7 +37,7 @@ $(document).ready(function() {
       $(this).attr('title', MSG_CANNOT_BE_DELETED)
       $(this).attr('disabled', true);
       $(this).attr('checked', false);
-      $(this).parents('tr').find('td').css('background-color', 'red');
+      $(this).parents('tr').find('td').css('background-color', '#ffff99');
     });
   [% END %]
 
@@ -92,22 +92,22 @@ $(document).ready(function() {
     [% ELSIF message.code == 'authority_not_exists' %]
       The authority id [% message.authid %] does not exist in the database.
     [% ELSIF message.code == 'item_issued' %]
-      At least one item issued for the biblio [% message.biblionumber %].
+      At least one item is checked out on bibliographic record [% message.biblionumber %].
     [% ELSIF message.code == 'reserve_not_cancelled' %]
-      The biblio [% message.biblionumber %] has not been deleted. A reserve (reserve_id [% message.reserve_id %]) caused an error on cancel.
+      Bibliographic record [% message.biblionumber %] was not deleted. A hold could not be canceled (reserve_id [% message.reserve_id %]).
     [% ELSIF message.code == 'item_not_deleted' %]
-      The biblio [% message.biblionumber %] has not been deleted. An item (itemnumber [% message.itemnumber %]) caused an error on delete.
+      The bibliographic record [% message.biblionumber %] was not deleted. An error was encountered when deleting an item (itemnumber [% message.itemnumber %]).
     [% ELSIF message.code == 'biblio_not_deleted' %]
-      The biblio [% message.biblionumber %] has not been deleted. An error occurred on deleting it.
+      Bibliographic record [% message.biblionumber %] was not deleted. An error occurred.
     [% ELSIF message.code == 'authority_not_deleted' %]
-      The authority [% message.authid %] has not been deleted. An error occurred on deleting it.
+      Authority record [% message.authid %] was not deleted. An error occurred.
     [% ELSIF message.code == 'biblio_deleted' %]
-      The biblio [% message.biblionumber %] has successfully been deleted.
+      Bibliographic record [% message.biblionumber %] has been deleted successfully.
     [% ELSIF message.code == 'authority_deleted' %]
-      The authority [% message.authid %] has successfully been deleted.
+      Authority [% message.authid %] has been deleted successfully.
     [% END %]
     [% IF message.error %]
-      (The error was: [% message.error%], see the Koha logfile for more information).
+      (The error was: [% message.error%], see the Koha log file for more information).
     [% END %]
     </div>
   [% END %]
@@ -116,7 +116,7 @@ $(document).ready(function() {
       <fieldset class="rows">
         <legend>Record type</legend>
         <ol>
-          <li><label for="biblio_type">Biblios: </label><input type="radio" name="recordtype" value="biblio" id="biblio_type" checked="checked" /></li>
+          <li><label for="biblio_type">Bibliographic: </label><input type="radio" name="recordtype" value="biblio" id="biblio_type" checked="checked" /></li>
           <li><label for="authority_type">Authorities: </label><input type="radio" name="recordtype" value="authority" id="authority_type" /></li>
         </ol>
       </fieldset>
@@ -159,15 +159,15 @@ $(document).ready(function() {
                 <th>Title</th>
                 <th>Items</th>
                 <th>Holds</th>
-                <th>Issues</th>
+                <th>Checkouts</th>
               </tr>
             </thead>
             <tbody>
               [% FOR biblio IN records %]
                 <tr>
-                  <td><input type="checkbox" name="record_id" value="[% biblio.biblionumber %]" data-items="[% biblio.itemnumbers.size %]" data-issues="[% biblio.issues_count %]" data-reserves="[% biblio.reserves.size %]" /></td>
-                  <td>[% biblio.biblionumber %]</td>
-                  <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblio.biblionumber %]">[% biblio.title %]</a></td>
+                  <td><input type="checkbox" name="record_id" id="record_id_[% biblio.biblionumber %]" value="[% biblio.biblionumber %]" data-items="[% biblio.itemnumbers.size %]" data-issues="[% biblio.issues_count %]" data-reserves="[% biblio.reserves.size %]" /></td>
+                  <td><label for="record_id_[% biblio.biblionumber %]">[% biblio.biblionumber %]</label></td>
+                  <td>[% INCLUDE 'biblio-default-view.inc' biblionumber=biblio.biblionumber %][% biblio.title %][% IF ( biblio.subtitle ) %][% FOREACH subtitle IN biblio.subtitle %] [% subtitle.subfield |html %][% END %][% END %]</a></td>
                   <td><a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% biblio.biblionumber %]">[% biblio.itemnumbers.size %]</a></td>
                   <td><a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% biblio.biblionumber %]">[% biblio.reserves.size %]</a></td>
                   <td><a href="/cgi-bin/koha/catalogue/issuehistory.pl?biblionumber=[% biblio.biblionumber %]">[% biblio.issues_count %]</a></td>
@@ -175,7 +175,7 @@ $(document).ready(function() {
               [% END %]
             </tbody>
           </table>
-          <div class="note">Reminder: this action will delete all selected biblios, attached subscriptions, existing holds and items!</div>
+          <div class="note">Reminder: this action will delete all selected bibliographic records, attached subscriptions, existing holds, and attached items!</div>
       [% ELSE %]
         <div id="toolbar">
           <a id="selectall" href="#">Select all</a>
@@ -198,7 +198,7 @@ $(document).ready(function() {
                   <td><input type="checkbox" name="record_id" value="[% authority.authid %]" data-usage="[% authority.count_usage %]" /></td>
                   <td><a href="/cgi-bin/koha/authorities/detail.pl?authid=[% authority.authid %]">[% authority.authid %]</a></td>
                   <td>[% PROCESS authresult summary=authority.summary %]</td>
-                  <td><a href="/cgi-bin/koha/catalogue/search.pl?type=intranet&op=do_search&idx=an,phr&q=[% authority.authid %]">[% authority.count_usage %] biblio(s)</a></td>
+                  <td><a href="/cgi-bin/koha/catalogue/search.pl?type=intranet&amp;op=do_search&amp;idx=an,phr&amp;q=[% authority.authid %]">[% authority.count_usage %] record(s)</a></td>
                 </tr>
               [% END %]
             </tbody>
@@ -213,15 +213,15 @@ $(document).ready(function() {
         </fieldset>
       </form>
     [% ELSE %]
-      There is no record ids defined.
+      There are no record ids defined.
     [% END %]
   [% ELSIF op == 'report' %]
     [% IF report.total_records == report.total_success %]
-      All records have successfully been deleted!
+      All records have been deleted successfully!
     [% ELSIF report.total_success == 0 %]
-      No record has been deleted, some errors occurred.
+      No record has been deleted. An error occurred.
     [% ELSE %]
-      [% report.total_success %] / [% report.total_records %] records have successfully been deleted but some errors occurred.
+      [% report.total_success %] / [% report.total_records %] records have been deleted successfully but some errors occurred.
     [% END %]
     <p><a href="/cgi-bin/koha/tools/batch_delete_records.pl" title="New batch record deletion">New batch record deletion</a></p>
   [% ELSE %]
index 82dffca..a87857c 100644 (file)
 
     [% IF CAN_user_tools_records_batchdel %]
       <dt><a href="/cgi-bin/koha/tools/batch_delete_records.pl">Batch record deletion</a></dt>
-      <dd>Delete a batch of records (biblios or authorities)</dd>
+      <dd>Delete a batch of records (bibliographic or authority)</dd>
     [% END %]
 
     [% IF ( CAN_user_tools_export_catalog ) %]
index 8376d60..b0523d5 100755 (executable)
@@ -77,6 +77,8 @@ if ( $op eq 'form' ) {
                 };
                 next;
             }
+            my $record = &GetMarcBiblio( $record_id );
+            $biblio->{subtitle} = GetRecordValue( 'subtitle', $record, GetFrameworkCode( $record_id ) );
             $biblio->{itemnumbers} = C4::Items::GetItemnumbersForBiblio( $record_id );
             $biblio->{reserves} = C4::Reserves::GetReservesFromBiblionumber({ biblionumber => $record_id });
             $biblio->{issues_count} = C4::Biblio::CountItemsIssued( $record_id );