Bug 12759

Summary: Add ability to pass list contents to batch record modification/deletion tools
Product: Koha Reporter: Jeremy Evans <Jeremy.evans>
Component: ListsAssignee: Aleisha Amohia <aleisha>
Status: CLOSED FIXED QA Contact: Martin Renvoize <martin.renvoize>
Severity: enhancement    
Priority: P5 - low CC: 1joynelson, aleisha, bibliwho, dcook, jonathan.druart, katrin.fischer, liz, m.de.rooy, marjorie.barry-vila, martin.renvoize, mtompset, nick, oleonard, patrick.robitaille, sandboxes, veron
Version: unspecified   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17273
Change sponsored?: Sponsored Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
This enhancement add batch modification/deletion options to user created lists of records
Version(s) released in:
Bug Depends on:    
Bug Blocks: 18127, 24124    
Attachments: Bug 12759: Use a list (shelf) for batch record modification and deletion
Bug 12759: Use a list (shelf) for batch record modification and deletion
Bug 12759: Use a list (shelf) for batch record modification and deletion
Bug 12759: Use a list (shelf) for batch record modification and deletion
Bug 12759: Use a list (shelf) for batch record modification and deletion
Bug 12759: Use a list (shelf) for batch record modification and deletion
Bug 12759: Use a list (shelf) for batch record modification and deletion
Bug 12759: [FOLLOW-UP] Using tabs for diff ways of adding records
Bug 12759: [FOLLOW-UP] Using tabs for diff ways of adding records
Bug 12759: Use a list (shelf) for batch record modification and deletion
Bug 12759: (follow-up) Using tabs for diff ways of adding records
Bug 12759: Pass records from selected tab
Bug 12759: Use a list (shelf) for batch record modification and deletion
Bug 12759: (follow-up) Using tabs for diff ways of adding records
Bug 12759: Pass records from selected tab
bug 12759: Add missing html filters
Bug 12759: Add missing html filters
Bug 12759: Use a list (shelf) for batch record modification and deletion
Bug 12759: (follow-up) Using tabs for diff ways of adding records
Bug 12759: Pass records from selected tab
Bug 12759: Add missing html filters

Description Jeremy Evans 2014-08-14 11:10:35 UTC
It would be a great timesaver if the records associated with a particular list can be passed into the Batch item modification and batch item deletion tools.

At the moment I have to run a report to extract the item barcode numbers from the list then open the resulting spreadsheet and copy & paste these into the batch modification tool. 

Ideally the batch modification/deletion tools need another input option to choose a particular list (that you can access),  or alternatively have a new option in the list view screen to pass selected records to batch modification/deletion.
Comment 1 Joy Nelson 2014-11-18 17:57:43 UTC
Along these same lines, it would be great to be able to use the batch modification (or other method) to add a batch of bib/items to a list.
Comment 2 Aleisha Amohia 2017-02-15 22:57:43 UTC Comment hidden (obsolete)
Comment 3 Aleisha Amohia 2017-02-16 02:20:06 UTC
(In reply to Joy Nelson from comment #1)
> Along these same lines, it would be great to be able to use the batch
> modification (or other method) to add a batch of bib/items to a list.

I have added a patch for this suggestion to Bug 18127
Comment 4 Marcel de Rooy 2017-02-16 07:45:59 UTC
Aleisha
Looks good.
But please note that a list only contains biblio records. So you should not offer the option when the user selects Authorities.
Comment 5 Aleisha Amohia 2017-02-16 20:02:07 UTC Comment hidden (obsolete)
Comment 6 Aleisha Amohia 2017-02-16 21:15:17 UTC Comment hidden (obsolete)
Comment 7 Marc Véron 2017-02-21 09:05:55 UTC Comment hidden (obsolete)
Comment 8 Jonathan Druart 2017-02-22 12:47:13 UTC
Aleisha,
2 small things here:
1. Go on Home › Tools › Batch record modification
   Select a list
   Select "authorities"
   Fill the textarea with authid
   Next
=> Id from list is picked

2. I think we should raise a warning (JS side) if 2 sources of ids are filled:
* For biblios: file and list or file and ids or list and ids 
* For authorities: file and ids (list should not be taken into account even if filled)
Comment 9 Aleisha Amohia 2017-02-27 19:56:23 UTC
(In reply to Jonathan Druart from comment #8)
> Aleisha,
> 2 small things here:
> 1. Go on Home › Tools › Batch record modification
>    Select a list
>    Select "authorities"
>    Fill the textarea with authid
>    Next
> => Id from list is picked

I don't understand this... if you select authorities, the option to add biblios from a shelf is hidden by JS. 

> 2. I think we should raise a warning (JS side) if 2 sources of ids are
> filled:
> * For biblios: file and list or file and ids or list and ids 
> * For authorities: file and ids (list should not be taken into account even
> if filled)

That seems slightly out of the scope of this bug. I am happy to make a new patch for this on a separate bug, but it doesn't stop this patch from working.
Comment 10 Jonathan Druart 2017-02-28 08:06:52 UTC
(In reply to Aleisha Amohia from comment #9)
> (In reply to Jonathan Druart from comment #8)
> > Aleisha,
> > 2 small things here:
> > 1. Go on Home › Tools › Batch record modification
> >    Select a list
> >    Select "authorities"
> >    Fill the textarea with authid
> >    Next
> > => Id from list is picked
> 
> I don't understand this... if you select authorities, the option to add
> biblios from a shelf is hidden by JS. 

Yes it's hidden but it's taken into account.

> > 2. I think we should raise a warning (JS side) if 2 sources of ids are
> > filled:
> > * For biblios: file and list or file and ids or list and ids 
> > * For authorities: file and ids (list should not be taken into account even
> > if filled)
> 
> That seems slightly out of the scope of this bug. I am happy to make a new
> patch for this on a separate bug, but it doesn't stop this patch from
> working.

I would not pass QA it without that change, but maybe something else will...
Comment 11 Biblibre Sandboxes 2017-03-20 17:26:12 UTC
Patch tested with a sandbox, by EricGosselin <eric.gosselin@inLibro.com>
Comment 12 Biblibre Sandboxes 2017-03-20 17:26:34 UTC
Created attachment 61337 [details] [review]
Bug 12759: Use a list (shelf) for batch record modification and deletion

To test:
1) Create a list, add a record to it by its barcode that you don't mind
deleting
2) Go to Tools -> Batch record modification
3) Select the record type 'Authorities'. Confirm the dropdown to select
a list disappears. Confirm selecting 'Biblios' makes the dropdown show
again.
4) Select the list from the dropdown, select a modification template,
Continue
5) Confirm all of the records in that list show on the page. Click
Modify selected records. Confirm this is successful.
6) Go to Batch record deletion
7) Select the record type 'Authorities'. Confirm the dropdown to select
a list disappears. Confirm selecting 'Biblios' makes the dropdown
show again.
8) Select the list from the dropdown and click Continue
9) Confirm all of the records in that list show on the page. Click
Delete selected records. Confirm this is successful.
10) Go back to your lists. The list should still exist but it will now be
empty.

Sponsored-by: Catalyst IT

Followed test plan, works as expected.
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: EricGosselin <eric.gosselin@inLibro.com>
Comment 13 Jonathan Druart 2017-03-20 19:34:02 UTC
As I said previously I am not willing to PQA this one as it (because of the lack of JS checks).

However the patch looks wrong, all lists are listed (even the private ones) and the "Or select a list of records" block is display even if there are no list defined.
Comment 14 Owen Leonard 2018-04-17 15:51:57 UTC
Would it make sense to completely reset the form if someone selects a different input method (file/list/numbers) ?

http://zivotdesign.com/p/#1/15239764835671
Comment 15 Jonathan Druart 2018-04-17 17:26:00 UTC
(In reply to Owen Leonard from comment #14)
> Would it make sense to completely reset the form if someone selects a
> different input method (file/list/numbers) ?
> 
> http://zivotdesign.com/p/#1/15239764835671

why not tabs then?
Comment 16 Owen Leonard 2018-04-17 18:02:15 UTC
(In reply to Jonathan Druart from comment #15)
> why not tabs then?

Tabs work too. But is it going to make someone mad if they paste a list of barcodes, switch tabs, switch back, and find their input gone?
Comment 17 Katrin Fischer 2018-04-17 19:55:02 UTC
I think tabs. Could we keep the content or is that not possible?
Comment 18 Marjorie Barry-Vila 2018-04-19 14:46:41 UTC
(In reply to Katrin Fischer from comment #17)
> I think tabs. Could we keep the content or is that not possible?

Hi Katrin,
When I read Jeremy's first comment, he talks about Batch items modification/deletion.
I understand that patch proposed by Aleisha concerns only thr tool for batch record modification/deletion.
Do I need to open a new bug for tool "batch items modification"?

Regards,
Marjorie
Comment 19 Katrin Fischer 2018-04-21 10:59:50 UTC
Hi Marjorie, thx for updating! I think then instead of displaying an option to send to the batch item edit or download option for a list of itemnumbers could also work.
Comment 20 Marjorie Barry-Vila 2018-05-02 13:07:18 UTC
(In reply to Katrin Fischer from comment #19)
> Hi Marjorie, thx for updating! I think then instead of displaying an option
> to send to the batch item edit or download option for a list of itemnumbers
> could also work.

Hi Katrin,
Yes your idea is great. I guess it's better then to open a new bug report?
Marjorie
Comment 21 Katrin Fischer 2018-05-02 14:56:50 UTC
Yes, I think separate bug is best, clean start and this is about the record level, so both can be worked on independently.
Comment 22 Mark Tompsett 2018-05-24 18:26:15 UTC
Created attachment 75548 [details] [review]
Bug 12759: Use a list (shelf) for batch record modification and deletion

To test:
1) Create a list, add a record to it by its barcode that you don't mind
deleting
2) Go to Tools -> Batch record modification
3) Select the record type 'Authorities'. Confirm the dropdown to select
a list disappears. Confirm selecting 'Biblios' makes the dropdown show
again.
4) Select the list from the dropdown, select a modification template,
Continue
5) Confirm all of the records in that list show on the page. Click
Modify selected records. Confirm this is successful.
6) Go to Batch record deletion
7) Select the record type 'Authorities'. Confirm the dropdown to select
a list disappears. Confirm selecting 'Biblios' makes the dropdown
show again.
8) Select the list from the dropdown and click Continue
9) Confirm all of the records in that list show on the page. Click
Delete selected records. Confirm this is successful.
10) Go back to your lists. The list should still exist but it will now be
empty.

Sponsored-by: Catalyst IT

NOTE: Rebased to work -- Mark Tompsett
Comment 23 Charles Farmer 2018-05-25 21:12:31 UTC
Created attachment 75572 [details] [review]
Bug 12759: Use a list (shelf) for batch record modification and deletion

To test:
1) Create a list, add a record to it by its barcode that you don't mind
deleting
2) Go to Tools -> Batch record modification
3) Select the record type 'Authorities'. Confirm the dropdown to select
a list disappears. Confirm selecting 'Biblios' makes the dropdown show
again.
4) Select the list from the dropdown, select a modification template,
Continue
5) Confirm all of the records in that list show on the page. Click
Modify selected records. Confirm this is successful.
6) Go to Batch record deletion
7) Select the record type 'Authorities'. Confirm the dropdown to select
a list disappears. Confirm selecting 'Biblios' makes the dropdown
show again.
8) Select the list from the dropdown and click Continue
9) Confirm all of the records in that list show on the page. Click
Delete selected records. Confirm this is successful.
10) Go back to your lists. The list should still exist but it will now be
empty.

Sponsored-by: Catalyst IT

NOTE: Rebased to work -- Mark Tompsett

Signed-off-by: Charles Farmer <charles.farmer@inLibro.com>
Comment 24 Jonathan Druart 2018-05-30 17:00:54 UTC
Comment 10 and comment 13 are still valid...


Moreover, prefer to pass an iterator to the template:
-my @lists = Koha::Virtualshelves->search({});
-$template->param( lists => \@lists );
+$template->param( virtual_shelves => scalar Koha::Virtualshelves->search );


You will need to adapt the template accordingly ([% IF virtual_shelves.count %], etc.)
Comment 25 Marcel de Rooy 2018-07-02 11:46:49 UTC
*** Bug 17273 has been marked as a duplicate of this bug. ***
Comment 26 Aleisha Amohia 2018-07-10 04:38:15 UTC
Created attachment 76802 [details] [review]
Bug 12759: [FOLLOW-UP] Using tabs for diff ways of adding records

This patch includes the changes for both batch record modification and
deletion.
Checks that all public lists are included and only private lists created
by the logged in user.
Hides the virtualshelves option if authorities are selected.
Comment 27 Aleisha Amohia 2018-07-10 04:40:39 UTC
Created attachment 76803 [details] [review]
Bug 12759: [FOLLOW-UP] Using tabs for diff ways of adding records

This patch includes the changes for both batch record modification and
deletion.
Checks that all public lists are included and only private lists created
by the logged in user.
Hides the virtualshelves option if authorities are selected.
Doesn't show shelf option at all if none exist
Comment 28 Cab Vinton 2018-08-09 14:22:01 UTC
Tested in Biblibre Sandbox no. 2.

Unable to select Authorities radio button under either Batch Record Modification or Deletion tool.

No problems deleting records, or modifying/ adding content to a MARC field appearing in the editor, using a list as a source of records.

Perhaps unrelated, but was unable to add content to a field that was not visible in the MARC editor (e.g., 945, 970).
Comment 29 Katrin Fischer 2018-08-09 23:21:33 UTC
Took a look at this one too. I think the intended behaviour is that when you check the authorities checkbox, the list option is not offered as the lists can only contain bibliographic records. That does work ok when you start at the top, but when you've already switched to the list tab and then switch from bibliographic to authority, your conf remains visible. Maybe needs a little tweaking.
Comment 30 Jonathan Druart 2018-08-10 13:34:26 UTC
(second patch contains .nfs* files that should not have been committed)
Comment 31 Aleisha Amohia 2018-11-08 01:08:02 UTC
(In reply to Katrin Fischer from comment #29)
> Took a look at this one too. I think the intended behaviour is that when you
> check the authorities checkbox, the list option is not offered as the lists
> can only contain bibliographic records. That does work ok when you start at
> the top, but when you've already switched to the list tab and then switch
> from bibliographic to authority, your conf remains visible. Maybe needs a
> little tweaking.

Hi Katrin, I've spent a lot of time playing with different methods as specified here: https://api.jqueryui.com/tabs/

but haven't had any success in fixing this toggle issue. Do you have any tips or ideas?
Comment 32 Jonathan Druart 2018-11-12 17:52:05 UTC
Created attachment 82228 [details] [review]
Bug 12759: Use a list (shelf) for batch record modification and deletion

To test:
1) Create a list, add a record to it by its barcode that you don't mind
deleting
2) Go to Tools -> Batch record modification
3) Select the record type 'Authorities'. Confirm the dropdown to select
a list disappears. Confirm selecting 'Biblios' makes the dropdown show
again.
4) Select the list from the dropdown, select a modification template,
Continue
5) Confirm all of the records in that list show on the page. Click
Modify selected records. Confirm this is successful.
6) Go to Batch record deletion
7) Select the record type 'Authorities'. Confirm the dropdown to select
a list disappears. Confirm selecting 'Biblios' makes the dropdown
show again.
8) Select the list from the dropdown and click Continue
9) Confirm all of the records in that list show on the page. Click
Delete selected records. Confirm this is successful.
10) Go back to your lists. The list should still exist but it will now be
empty.

Sponsored-by: Catalyst IT

NOTE: Rebased to work -- Mark Tompsett

Signed-off-by: Charles Farmer <charles.farmer@inLibro.com>
Comment 33 Jonathan Druart 2018-11-12 17:52:10 UTC
Created attachment 82229 [details] [review]
Bug 12759: (follow-up) Using tabs for diff ways of adding records

This patch includes the changes for both batch record modification and
deletion.
Checks that all public lists are included and only private lists created
by the logged in user.
Hides the virtualshelves option if authorities are selected.
Doesn't show shelf option at all if none exist
Comment 34 Jonathan Druart 2018-11-12 17:52:15 UTC
Created attachment 82230 [details] [review]
Bug 12759: Pass records from selected tab

To remove ambiguity we should not process the records from other tabs.
Comment 35 Aleisha Amohia 2018-11-28 22:49:31 UTC
Hi Jonathan

The patch works but we are still having the issue that Katrin pointed out in Comment 29. The tab hides when you change to Authorities, but if you are on that tab when you change, the content underneath it stays visible. 

I couldn't work out a way to change to a different tab when changing from Biblios to Authorities and I think that would be the best fix.
Comment 36 Jonathan Druart 2018-12-10 19:23:06 UTC
Aleisha, With the last patch I do not think it is longer a problem. On the contrary it may be better to not empty the inputs when tabs change (it is the same behavior we have in the header).

Switching back to NSO to get other opinions.
Comment 37 Katrin Fischer 2018-12-20 20:45:27 UTC
Created attachment 83421 [details] [review]
Bug 12759: Use a list (shelf) for batch record modification and deletion

To test:
1) Create a list, add a record to it by its barcode that you don't mind
deleting
2) Go to Tools -> Batch record modification
3) Select the record type 'Authorities'. Confirm the dropdown to select
a list disappears. Confirm selecting 'Biblios' makes the dropdown show
again.
4) Select the list from the dropdown, select a modification template,
Continue
5) Confirm all of the records in that list show on the page. Click
Modify selected records. Confirm this is successful.
6) Go to Batch record deletion
7) Select the record type 'Authorities'. Confirm the dropdown to select
a list disappears. Confirm selecting 'Biblios' makes the dropdown
show again.
8) Select the list from the dropdown and click Continue
9) Confirm all of the records in that list show on the page. Click
Delete selected records. Confirm this is successful.
10) Go back to your lists. The list should still exist but it will now be
empty.

Sponsored-by: Catalyst IT

NOTE: Rebased to work -- Mark Tompsett

Signed-off-by: Charles Farmer <charles.farmer@inLibro.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 38 Katrin Fischer 2018-12-20 20:45:32 UTC
Created attachment 83422 [details] [review]
Bug 12759: (follow-up) Using tabs for diff ways of adding records

This patch includes the changes for both batch record modification and
deletion.
Checks that all public lists are included and only private lists created
by the logged in user.
Hides the virtualshelves option if authorities are selected.
Doesn't show shelf option at all if none exist

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 39 Katrin Fischer 2018-12-20 20:45:38 UTC
Created attachment 83423 [details] [review]
Bug 12759: Pass records from selected tab

To remove ambiguity we should not process the records from other tabs.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 40 Katrin Fischer 2018-12-20 20:45:43 UTC
Created attachment 83424 [details] [review]
bug 12759: Add missing html filters

Add some missing html filters to fix QA script
complaints.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 41 Katrin Fischer 2018-12-20 20:46:12 UTC
Hi Aleisha, 

please make sure you run the latest version of the QA tools on your patches. There are some missing filters:

 FAIL	koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_delete_records.tt
   FAIL	  filters
		missing_filter at line 98 (                          <option value="[% list.shelfnumber %]">[% list.shelfname %]</option>)
   OK	  forbidden patterns
   OK	  git manipulation
   OK	  js_in_body
   OK	  spelling
   OK	  tt_valid
   OK	  valid_template

 FAIL	koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_record_modification.tt
   FAIL	  filters
		missing_filter at line 102 (                          <option value="[% list.shelfnumber %]">[% list.shelfname %]</option>)

Bug 21576 can be helpful to fix those.

Fixed them in a follow-up :)
Comment 42 Katrin Fischer 2019-02-02 20:42:10 UTC
Created attachment 84672 [details] [review]
Bug 12759: Add missing html filters

Add some missing html filters to fix QA script
complaints.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 43 Katrin Fischer 2019-02-02 20:43:04 UTC
Just fixed my own typo on the follow-up patch's commit message.

Can't QA as I signed off.
Comment 44 Martin Renvoize 2019-02-08 15:14:47 UTC
Created attachment 84875 [details] [review]
Bug 12759: Use a list (shelf) for batch record modification and deletion

To test:
1) Create a list, add a record to it by its barcode that you don't mind
deleting
2) Go to Tools -> Batch record modification
3) Select the record type 'Authorities'. Confirm the dropdown to select
a list disappears. Confirm selecting 'Biblios' makes the dropdown show
again.
4) Select the list from the dropdown, select a modification template,
Continue
5) Confirm all of the records in that list show on the page. Click
Modify selected records. Confirm this is successful.
6) Go to Batch record deletion
7) Select the record type 'Authorities'. Confirm the dropdown to select
a list disappears. Confirm selecting 'Biblios' makes the dropdown
show again.
8) Select the list from the dropdown and click Continue
9) Confirm all of the records in that list show on the page. Click
Delete selected records. Confirm this is successful.
10) Go back to your lists. The list should still exist but it will now be
empty.

Sponsored-by: Catalyst IT
NOTE: Rebased to work -- Mark Tompsett
Signed-off-by: Charles Farmer <charles.farmer@inLibro.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 45 Martin Renvoize 2019-02-08 15:14:52 UTC
Created attachment 84876 [details] [review]
Bug 12759: (follow-up) Using tabs for diff ways of adding records

This patch includes the changes for both batch record modification and
deletion.
Checks that all public lists are included and only private lists created
by the logged in user.
Hides the virtualshelves option if authorities are selected.
Doesn't show shelf option at all if none exist

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 46 Martin Renvoize 2019-02-08 15:14:57 UTC
Created attachment 84877 [details] [review]
Bug 12759: Pass records from selected tab

To remove ambiguity we should not process the records from other tabs.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 47 Martin Renvoize 2019-02-08 15:15:03 UTC
Created attachment 84878 [details] [review]
Bug 12759: Add missing html filters

Add some missing html filters to fix QA script
complaints.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 48 Martin Renvoize 2019-02-08 15:16:06 UTC
No regressions found and the QA scripts all pass. Seems to work well and is a nice little enhancment.

Passing QA
Comment 49 Nick Clemens 2019-02-19 13:54:40 UTC
Awesome work all!

Pushed to master for 19.05
Comment 50 Martin Renvoize 2019-02-26 09:02:02 UTC
Enhancement, will not be backported to 18.11.x series.