Bug 24589 - Add plugin hook addbiblio_check_record
Summary: Add plugin hook addbiblio_check_record
Status: Failed QA
Alias: None
Product: Koha
Classification: Unclassified
Component: Plugin architecture (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: paxed
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-02-05 08:19 UTC by paxed
Modified: 2024-02-19 09:02 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Add plugin hook addbiblio_check_record (3.33 KB, patch)
2020-02-05 08:21 UTC, paxed
Details | Diff | Splinter Review
Plugin to test Bug 24589 (1.16 KB, application/zip)
2020-02-05 11:06 UTC, paxed
Details
Bug 24589: Add plugin hook addbiblio_check_record (3.34 KB, patch)
2020-03-03 08:13 UTC, paxed
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description paxed 2020-02-05 08:19:35 UTC
Adds a new plugin hook, addbiblio_check_record, to addbiblio.pl.
When saving a record, the hook is called with the MARC record as
a parameter. If the hook returns anything, the return values are
shown to the user, and saving the record is prevented.
    
This can be used to create plugins that eg. check or modify the record.
Comment 1 paxed 2020-02-05 08:21:32 UTC
Created attachment 98429 [details] [review]
Add plugin hook addbiblio_check_record

Adds a new plugin hook, addbiblio_check_record, to addbiblio.pl.
When saving a record, the hook is called with the MARC record as
a parameter. If the hook returns anything, the return values are
shown to the user, and saving the record is prevented.

This can be used to create plugins that eg. check or modify the record.

Advanced editor has not been changed.
Comment 2 paxed 2020-02-05 11:06:14 UTC
Created attachment 98447 [details]
Plugin to test Bug 24589

This is a Koha plugin used to test Bug 24589 functionality.

Test plan:
1) Go to cataloging > New record
2) Edit the record, and save it.
3) Enable plugins, upload this plugin, and enable it.
4) Go to cataloging > New record
5) Edit the record, fill the required fields.
   Make sure 245$a does not contain "FOOBAR".
6) Try to save the record, you'll get a complaint: "ERROR: 245$a was not FOOBAR. Try saving again."
6) Check field 245$a, it should now contain "FOOBAR"
7) Try saving the record, it should now work normally.
8) Disable this plugin, and repeat 1 & 2
Comment 3 Bernardo Gonzalez Kriegel 2020-02-29 22:10:49 UTC
Hi,
works Ok, just fix the following QA error:

 FAIL   koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt
   FAIL   filters
                missing_filter at line 694 (                      <li>[% MARC_ERR %]</li>)

For example: [% MARC_ERR | html %]
Comment 4 paxed 2020-03-03 08:13:31 UTC
Created attachment 99976 [details] [review]
Bug 24589: Add plugin hook addbiblio_check_record

Adds a new plugin hook, addbiblio_check_record, to addbiblio.pl.
When saving a record, the hook is called with the MARC record as
a parameter. If the hook returns anything, the return values are
shown to the user, and saving the record is prevented.

This can be used to create plugins that eg. check or modify the record.

Advanced editor has not been changed.
Comment 5 Fridolin Somers 2020-12-30 16:12:16 UTC Comment hidden (obsolete)
Comment 6 Fridolin Somers 2020-12-30 16:13:20 UTC
Bug 20415 removed preference 'UseKohaPlugins', please remove it from your patch.
Comment 7 David Cook 2021-01-04 01:19:57 UTC
Ohhh I like the sound of this. This could be an interesting way to add checks for authority linking...
Comment 8 David Cook 2021-06-03 06:56:14 UTC
Actually, it might be nicer just to have a plugin hook that is fired when a bib is created, modified, or deleted.
Comment 9 David Cook 2021-06-03 06:56:49 UTC
(In reply to David Cook from comment #8)
> Actually, it might be nicer just to have a plugin hook that is fired when a
> bib is created, modified, or deleted.

Oh never mind me. That is Bug 22709. I'll see myself out.
Comment 10 Arthur Suzuki 2024-02-19 09:02:45 UTC
Oh, to bad this hook is only linked to "add" operation,
it would be very useful to check a record upon modification as well!