Bug 20699

Summary: Implement functionality for junior cataloguing staff to practise cataloguing/saving their records to reservoir (import_records, import_biblios DB tables) as drafts which are administered from the Cataloging interface
Product: Koha Reporter: Alex Buckley <alexbuckley>
Component: CatalogingAssignee: Alex Buckley <alexbuckley>
Status: RESOLVED DUPLICATE QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: katrin.fischer, m.de.rooy, nick, pasi.kallinen
Version: 17.11   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20678
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18823
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 20699 -
Bug 20699 - Implemented a save marc as draft feature
Bug 20699 - Implemented a save marc as draft feature

Description Alex Buckley 2018-05-02 21:14:29 UTC

    
Comment 1 Alex Buckley 2018-05-02 21:18:37 UTC
Created attachment 74990 [details] [review]
Bug 20699 -
Comment 2 Katrin Fischer 2018-05-03 05:54:40 UTC
Hi Alex, did something go wrong on the bug here?
Comment 3 Alex Buckley 2018-05-08 00:35:59 UTC
Created attachment 75151 [details] [review]
Bug 20699 - Implemented a save marc as draft feature

This patch implements the ability to save marc records to the reservior
(in a similar way to how imported staged records are stored in the
 reservior).

The purpose of this feature is to be able to train junior library staff
and catalogers by letting them practise cataloging biblio records and saving them as drafts
(stored in the reservoir). Because these draft records are stored in the
reservoir they are not returned as OPAC search results.

This patch implements a new 'editcatalogue' subpermission called 'commit_MARC_records_to_catalog'. A staff member must have this subpermission
enabled to commit a record to the catalog.

In the addbiblio.pl interface users with all editcatalogue
subpermissions (which should be staff experienced with cataloging) will see 4 'Save' options:

* Save and review record
* Save and edit items
* Save and continue editing
* Save without cataloging

Junior staff should have all editcatalog subpermissions except for
'commit_MARC_records_to_catalog' and they will see one save option 'Save
without cataloging' and this saves the record as a draft.

To view and administer all draft records you can click on the 'View
draft records' button in the toolbar on the addbooks.pl page.

Here draft records are listed newest to oldest and individual draft records can be edited/deleted or all draft records
can be deleted in one go.

Test plan:

Test plan:
1. Go to addbooks.pl and notice there is no 'View draft reocrds' button
in the toolbar alongside 'New record'

2. Apply patch

3. Restart plack, memcached

4. Update your database, this can be achieved by runnning
installer/data/mysql/updatedatabase.pl or in Koha staff client going to
Adminstration->Global system preferences->Local use and amending the
Version syspref value

5. Create two user accounts one with superlibrarian permissions and the
other with all editcatalogue subpermissions except for
'commit_MARC_records_to_catalog' and also enable the catalogue
permission so this user can access the staff client.

6. Log in as user 1 (superlibrarian) go to Cataloging->New record and
select the 'Save' dropdown box and notice you have 4 options. Select
'Save and view record' and notice you have created a biblio in the
catalog.

7. Log out and log in as user 2 go to Cataloging->New record and
click the 'Save' button and notice that there is only one option 'Save
without cataloging'. Meaning you are restricted to only creating a draft
record.

8. Select 'Save without cataloging' and you are re-directed to the
Cataloging main page. Now select the 'View draft records' button and
view your draft record in the table of draft records.

9. Select the 'Edit' link and notice the addbiblio.pl page for the draft
record is loaded

10. Return to the View draft records interface and delete the draft
record and notice that after the page reloads the record is no longer
displayed in the table.

11. Create 2 more draft records and return to the View draft records
interface and select 'Delete all drafts from reservoir' and notice the
drafts table is emptied

12. Create 1 more draft record and then log out

13. Log in as user 1 (superlibrarian) and go to the View draft records
interface.

14. Select the 'Edit' link

15. Select any save option except for 'Save without cataloguing' and
notice the record is now committed to the catalog.

16. Return to the 'View draft records' interface and notice the record
you just committed to the catalog has been removed as a draft record in
the reservoir.

17. Run the unit test t/db_dependent/ImportBatch.t in koha-shell

18. Notice that unit test 12 passes: 'ok 12 - No biblio expected since
we deleted the biblio from the batch'

Sponsored-By: Toi Ohomai Institute of Technology, New Zealand
Comment 4 Katrin Fischer 2018-05-08 05:45:40 UTC
Hi Alex, can you please make the bug title more descriptive?
Comment 5 Alex Buckley 2018-05-08 21:11:27 UTC
Created attachment 75191 [details] [review]
Bug 20699 - Implemented a save marc as draft feature

This patch implements the ability to save marc records to the reservior
(in a similar way to how imported staged records are stored in the
 reservior).

The purpose of this feature is to be able to train junior library staff
and catalogers by letting them practise cataloging biblio records and saving them as drafts
(stored in the reservoir). Because these draft records are stored in the
reservoir they are not returned as OPAC search results.

This patch implements a new 'editcatalogue' subpermission called 'commit_MARC_records_to_catalog'. A staff member must have this subpermission
enabled to commit a record to the catalog.

In the addbiblio.pl interface users with all editcatalogue
subpermissions (which should be staff experienced with cataloging) will see 4 'Save' options:

* Save and review record
* Save and edit items
* Save and continue editing
* Save without cataloging

Junior staff should have all editcatalog subpermissions except for
'commit_MARC_records_to_catalog' and they will see one save option 'Save
without cataloging' and this saves the record as a draft.

To view and administer all draft records you can click on the 'View
draft records' button in the toolbar on the addbooks.pl page.

Here draft records are listed newest to oldest and individual draft records can be edited/deleted or all draft records
can be deleted in one go.

Test plan:

Test plan:
1. Go to addbooks.pl and notice there is no 'View draft reocrds' button
in the toolbar alongside 'New record'

2. Apply patch

3. Restart plack, memcached

4. Update your database, this can be achieved by runnning
installer/data/mysql/updatedatabase.pl or in Koha staff client going to
Adminstration->Global system preferences->Local use and amending the
Version syspref value

5. Create two user accounts one with superlibrarian permissions and the
other with all editcatalogue subpermissions except for
'commit_MARC_records_to_catalog' and also enable the catalogue
permission so this user can access the staff client.

6. Log in as user 1 (superlibrarian) go to Cataloging->New record and
select the 'Save' dropdown box and notice you have 4 options. Select
'Save and view record' and notice you have created a biblio in the
catalog.

7. Log out and log in as user 2 go to Cataloging->New record and
click the 'Save' button and notice that there is only one option 'Save
without cataloging'. Meaning you are restricted to only creating a draft
record.

8. Select 'Save without cataloging' and you are re-directed to the
Cataloging main page. Now select the 'View draft records' button and
view your draft record in the table of draft records.

9. Select the 'Edit' link and notice the addbiblio.pl page for the draft
record is loaded

10. Return to the View draft records interface and delete the draft
record and notice that after the page reloads the record is no longer
displayed in the table.

11. Create 2 more draft records and return to the View draft records
interface and select 'Delete all drafts from reservoir' and notice the
drafts table is emptied

12. Create 1 more draft record and then log out

13. Log in as user 1 (superlibrarian) and go to the View draft records
interface.

14. Select the 'Edit' link

15. Select any save option except for 'Save without cataloguing' and
notice the record is now committed to the catalog.

16. Return to the 'View draft records' interface and notice the record
you just committed to the catalog has been removed as a draft record in
the reservoir.

17. Run the unit test t/db_dependent/ImportBatch.t in koha-shell

18. Notice that unit test 12 passes: 'ok 12 - No biblio expected since
we deleted the biblio from the batch'

19. Log out and back in as the second user and search for a biblio
record which is in the catalog (i.e. not a draft record) and notice both
in the staff client search results and the biblio detail page the links
to edit the record and items associated with the biblio record are not
displayed. This is because the user you are logged in as has all
edit_catalogue permissions except
CAN_user_editcatalogue_commit_MARC_records_to_catalog which is
neccessary to add/edit/delete biblios or items in the catalog.

Sponsored-By: Toi Ohomai Institute of Technology, New Zealand
Comment 6 Katrin Fischer 2018-05-08 21:13:14 UTC
Always be careful what you ask for... quite a bug title now. :) 
Allow adding draft records to the reservoir and managing them?
Comment 7 Alex Buckley 2018-05-08 21:53:18 UTC
Hi Katrin

Thanks, sorry about that I got carried away :)

This patch is for a client running Koha 17.11 at present and so it has been developed to work on Koha 17.11.

I also want to upstream it to master however 17.11 and master have diverged sufficiently (in particular the moving of the JavaScript from the top of /koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt file to the bottom that to prevent merge conflicts when applying this patch I have had to create two patches; this one for 17.11 and bug 20678 for master. 

Cheers,
Alex
Comment 8 paxed 2018-05-14 07:42:26 UTC
Untranslatable "Edit" and "Delete":

+                      '<a href="' + aData['catalog_link'] + '">' + "Edit" + '</a>'
+                      '<a href="' + aData['delete_link'] + '">' + "Delete" + '</a>'
Comment 9 Katrin Fischer 2018-05-15 10:43:14 UTC
Hi Alex, as this is a completely new feature it won't go into 17.11 (no backports for new features). So QA will only happen on the master patches. You can use this for communication with the customer, but maybe we should mark it somehow.
Comment 10 Alex Buckley 2018-05-17 03:43:32 UTC
Thanks Katrin

Perhaps it is best for me to close this bug report and just keep bug 20678 open which provides the same functionality but applicable to master. How does that sound?

Cheers,
Alex
Comment 11 Alex Buckley 2018-09-16 00:22:00 UTC

*** This bug has been marked as a duplicate of bug 20678 ***