Koha/koha-tmpl/intranet-tmpl/prog/en/modules/tools
Marcel de Rooy ff5996d65e Bug 10480: Use the framework plugin object in cataloguing
This patch implements the use of Koha::FrameworkPlugin in Cataloguing,
Authorities, Acquisition, Serials and Tools.

The main change is architectural: see the commit message of the previous
patch. No changes in behavior are expected, but the support of new events
may provide additional functionality in the future. Some small bugs are
resolved along the way.

The change primarily focuses on the MARC and items editor in Cataloguing.
But the MARC editor for Authorities and the item editor in Acquisition,
Serials and Tools are touched too. This commit message gives some comments
per module.

NOTE FOR CATALOGUING:
A new plugin without popup (or other click event code) now shows the title
No popup when hovering over the tag editor image. The image alerts the
user on a plugin, the title tells about its status. The noclick property
allows for further style modifications in the template. Note that a
follow-up patch will clean up the old style plugins too with the same
effect.

Some additional code in cataloging.js makes it possible to clone subfields
with plugins (although only theoretically useful). The clones use the
same javascript functions but event.data contains an updated id.
This effectively resolves bug 13306. Note that if old plugins do not use
the javascript parameter for the id but the perl variable, cloning does
still operate on the wrong field (with and without this patch set).

In the absence of report 12176 in master, it is not yet necessary to modify
additem.tt. When it gets pushed, it should be an easy rebase.
New style item plugins will no longer need an extra parameter. (The code in
the FrameworkPlugin object actually takes care of that.)

NOTE FOR AUTHORITIES:
This patch also adds class name tag_editor to the buttonDot anchors. This
effectively makes the same tag editor image appear as in Cataloguing.
Futhermore it removes the button from the tab sequence if there is no click
event (really effective after conversion to the new style, since the old
style plugins contain empty onclicks and launchers).
Both small adjustments increase consistency between auth and bib edits.

NOTE FOR ACQUISITION:
In Acquisition two scripts use an item editor, but in a different way.
The scripts addorderiso2709 and neworderempty both rely on the routine
PrepareItemrecordDisplay in C4::Items, but neworderempty creates item
blocks dynamically via an ajax call to services/itemrecorddisplay.pl.

In order to make the dynamic item blocks work with plugins, some code
changes were needed in additem.js. (Normally the event binding is done
at document ready time; now it must be done later.)

At this moment the routine in Items.pm contains the html tags, and this
makes changes to the following templates not necessary for now:
* acqui/addorderiso2709.tt
* services/itemrecorddisplay.tt
Report 13397 has been opened to address moving the html to the templates.

NOTE FOR SERIALS:
Script serial-edit relies also on C4::Items (just as in Acquisition).
This makes changes to serials/serials-edit.tt not necessary for now.

NOTE FOR TOOLS:
The current code in tools/batchMod.pl allows the use of plugins for batch
modification of items. This patch just converts that code to use the new
object. Most item plugins however may not be very useful for operating on
multiple items at once.

PERFORMANCE:
I have benchmarked build_tabs in addbiblio to see how especially the
additional processing of the javascript in the FrameworkPlugin object
would impact performance. Testing default MARC21 framework with 8 plugins
gave the following figures:
- Old situation: 851 ms
- New situation: 942 ms (+10,7%)
- New situation after plugin cleanup: 881 ms (+3,4%)
Note also that adding lines for event binding is compensated by removing
lines for unused events. Page load should essentially be the same.

TEST PLAN:
Suggestion: If you also apply the next patch with the EXAMPLE plugin, you
can test with a rather harmless plugin (with popup) on various places :)
But your test should also include old style plugins, with[out] popups.

If you want to test a new plugin without popup, rename/remove Click$id
in the javascript code of the $builder definition (temporarily).

[1] Test Cataloguing:
    - Add/Edit biblio. Try plugins with and without popup.
    - Add/Edit items. (EXAMPLE can be used as an item plugin with popup.)
    - Clone a subfield with plugin (use EXAMPLE): Verify that the plugin
      works on both original and clone with the respective field values.
      Is the value put back in the right field too?
[2] Test Authorities:
    Edit an authority record. Try plugins with an without popup.
[3] Test Acquisition:
    Set system preference AcqCreateItem to "placing an order".
    Check the item editor in the following two places:
    a- addorderiso2709: Open a basket, add an order from a staged file.
       Select a file, click Add orders, and go to tab Item information.
    b- neworderempty: Open a basket, add an order from a new empty record.
[4] Test Serials:
    Check the item editor on serials-edit. Go to subscription detail.
    Click Receive. Choose "Click to add item". (Note that this subscription
    should create an item record when receiving this serial.)
[5] Test Tools:
    Check the item editor for batch item modification. Enter a few valid
    barcodes and press Continue to reach the item editor.

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-04-16 14:48:36 -03:00
..
batch_delete_records.tt Bug 12403 [Follow-up] Batch record deletion 2014-11-07 15:26:02 -03:00
batch_record_modification.tt Bug 11395: prevent processing no record 2015-03-05 15:27:15 +01:00
batchMod-del.tt Bug 8246: Allow deleting record if no more items 2015-04-08 11:10:28 -03:00
batchMod-edit.tt Bug 10480: Use the framework plugin object in cataloguing 2015-04-16 14:48:36 -03:00
batchMod.tt Bug 10887: Batch item deletion -- doesn't need Use default values section 2015-04-08 11:09:08 -03:00
cleanborrowers.tt Bug 11975: improve the batch patron deletion code 2014-05-09 14:32:21 +00:00
csv-profiles.tt Bug 11812 - Add missing "required" indicator to fields which are required 2014-10-22 14:04:43 -03:00
export.tt Bug 13040 - multiple branch selections in exporter 2015-01-26 16:22:07 -03:00
holidays.tt Bug 13289: document.write breaks DataTables 2014-11-19 21:33:01 -03:00
import_borrowers.tt Bug 12543 - Add userid as matchpoint for "Import patrons" tool 2015-02-09 13:45:06 -03:00
inventory.tt Bug 12909 - item withdrawn is missing in inventory results 2014-11-21 15:27:15 -03:00
koha-news.tt Bug 13858: Datatables paging on Koha news tool page slightly broken 2015-03-18 20:17:37 -03:00
letter.tt Bug 12648: Add the new 'Acquisition' entry in the letter module list 2015-03-11 11:47:43 -03:00
manage-marc-import.tt Bug 11876 - Add a diff view for staged MARC records. 2014-10-31 14:24:58 -03:00
marc_modification_templates.tt Bug 11395: A control field is a field with tag < 10 2015-03-05 15:27:26 +01:00
modborrowers.tt Bug 13638 - Batch patron modification tool missing option to switch language 2015-02-09 10:22:51 -03:00
overduerules.tt Bug 11742: A letter code should be unique. 2014-06-23 15:19:55 -03:00
picture-upload.tt
quotes-upload.tt Bug 12138 - Use placeholders in translatable Javascript strings 2014-04-27 21:24:04 +00:00
quotes.tt Bug 13768: Correction of double quotes escaped into double quotes 2015-03-19 14:14:20 -03:00
scheduler.tt
showdiffmarc.tt Bug 11876 [Follow-up] Add a diff view to staged MARC Records 2014-10-31 14:25:11 -03:00
stage-marc-import.tt Bug 8015: Add MARC Modifications Templates 2013-10-31 22:47:08 +00:00
tools-home.tt Bug 11395: Add links to the new tool page 2015-03-05 15:27:01 +01:00
upload-images.tt Bug 11785 - Use validation plugin when uploading local cover images 2014-02-20 16:56:21 +00:00
viewlog.tt Bug 6911: Remember search terms in the log viewer tool 2015-04-13 14:13:38 -03:00