Commit graph

189 commits

Author SHA1 Message Date
aafe73eefb Bug 14828: Use Koha::ItemType[s] everywhere C4::ItemType was used
This patch mainly replaces C4::ItemType->all with
Koha::ItemTypes->search.

Test plan:
At the places where the C4::ItemType module was used, confirm there is
no regression:
- acqui/neworderempty.pl
- catalogue/itemsearch.pl
- admin/item_circulation_alerts.pl
and the 2 cataloguing plugins:
- marc21_linking_section.pl
- unimarc_field_4XX.pl

QA step:
prove t/db_dependent/HoldsQueue.t should return green
Note that the tests were buggy.

Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com
2016-01-27 20:46:58 +00:00
7283069a9d Bug 15381: Remove getauthtypes and getauthtype
These 2 subroutines are now not necessary anymore, we can use
Koha::Authority::Types to retrieve the authority types.

This patch won't be easy to test. Indeed, a lot of file are updated.
To test it I would suggest to focus on the merge authority

You should also confirm that the authtypecode and the authtypetext
values are correctly displayed when navigating in the authority module.

Signed-off-by: Frédéric Demians <f.demians@tamil.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com
2015-12-31 18:59:02 +00:00
ff1579de6d Bug 15258: Fix Perl scripts declaring unused variables
Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

All affected files tested with `perl -c`.
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
2015-12-30 17:24:45 -07:00
3410608b66 Bug 15193 - Perl scripts missing exec permission
Some perl scripts have 644 permissions instead of 755.

I think some are special like install-CPAN.pl.

This patch corrects some common perl scripts.

Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2015-12-11 16:36:08 +00:00
57d7425549 Bug 14202: Unexpected parameter for window.open in marc21_linking_section.pl
The builder of this plugin includes a window.open call with the name
parameter: \"marc21_field_7\"+ event.data.id +\"\"
Note that this is not the name of the new window.
This trivial patch adjusts this unusual name by tag_editor like other
plugins.

Test plan:
Attach marc21_linking_section to 773$9.
Click on the Tag editor button.
If it opens, it still works :)
Note that the name of the popup is still:
    Koha > Cataloguing > plugin for links

Signed-off-by: Fredreic Demians <f.demians@tamil.fr>
  Plugin still working, with a valid pop-pup window id.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-11-06 15:11:19 -03:00
c57fb17f07 Bug 14201: Yes, goodbye to the third plugin marc21_leader_video too
A closer look at this plugin revealed the same things as earlier:
[1] Since the click redirects to leader, the launcher is not used.
    In this case no template file existed.
[2] Leader_video does not use Focus while leader does.

This patch removes 'all' traces of leader_video.
It includes a tiny db revision for those brave people using it. The only
behavior change for them is the focus change.

Test plan:
[1] Run the db revision.
[2] Check if the leader plugin still works as expected.
[3] Git grep on marc21_leader_video. Ignore atomicupdate. No PO files :)

Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-09-28 12:19:53 -03:00
1203a93c87 Bug 14201: We can do without plugin marc21_leader_computerfile
A closer look at this plugin revealed the same things as the previous
patch for leader_book.
[1] Template leader_computerfile is not used.
[2] The unused template is not up-to-date either.
[3] Leader_computerfile does not use Focus while leader does.

This patch removes all traces of leader_computerfile.
It includes a tiny db revision for those brave people using it. The only
behavior change for them is the focus change.

Test plan:
[1] Run the db revision.
[2] Check if the leader plugin still works as expected.
[3] Git grep on marc21_leader_computerfile. Ignore PO files.

Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-09-28 12:19:52 -03:00
4c2e4cd0ab Bug 14201: Plugin marc21_leader_book is useless
A closer look at this plugin revealed the following:
[1] The leader_book builder redirects to leader.pl; the launcher code with
    leader_book.tt is dead.
[2] A diff of the two templates showed that most changes are minimal and
    irrelevant. Some updates to leader have not been incorporated into
    the unused leader_book.
[3] Leader_book does not use Focus while leader does.

This patch removes all traces of leader_book :)
It includes a tiny db revision for those brave people using it. The only
behavior change for them is the focus change.
Another small change: we do not need Search.pm in marc21_leader.

Test plan:
[1] Run the db revision. If you had some field attached to leader_book,
    it should be gone.
[2] Check if the leader plugin still works as expected.
[3] Run the FrameworkPlugin unit test. Ignore warnings from field_007.
[4] Git grep on marc21_leader_book. You will only find references to
    PO files in misc/translator.

Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-09-28 12:19:52 -03:00
83ea49a009 Bug 14321: Integrate Upload.pm into Koha
This patch makes the following changes to achieve that:
[1] Use Upload.pm in stage-marc-import.pl, upload-cover-image.pl,
    offline_circ/process_koc.pl and enqueue_koc.pl.
[2] A new file-upload.js replaces file-upload.inc in the associated template.
    We now use ajax to get progress figures instead of launching perl script
    upload-file-progress.
    The js changes now also allow for aborting a file upload.
[3] Adds a tools/upload script and template. It allows to upload multiple
    files at once.
[4] Makes upload-file return error messages in JSON. For a multiple upload,
    we could have some files with errors and others without errors.
    The upload is now marked as Failed only if there was no upload at all.
[5] The upload plugin is converted to use tools/upload with plugin param.
    Deleting an upload is now presented via the search results form.

NOTE: In editing the process_koc.tt I noticed that the form enqueuefile was
hidden and no longer used (with associated code in process_koc.pl). When a
file has been uploaded, I display the form again (with the Apply directly
button). The code still works.

NOTE: We fix an error in upload-file from one of the patches of bug 6874.
The userid of the Koha admin user is passed to haspermission, but we
should pick the userid from the session.

NOTE: Bug 14686 will add a specific permission for tools/upload.pl, and
will add the tools/upload script to the Tools menu.
For now, you need edit_catalogue to start upload.pl and you will
additionally need a permission like upload_local_cover_images
to successfully upload a new file.

Test plan:
[1] Upload a marc file in stage-marc-import. (This is temp storage.)
[2] Check new entry in table uploaded_files. Look for the file in your
    temporary directory (/tmp ?), subfolder koha_upload.
    Bonus: Remove permissions on this subfolder. Retry, check error and
    restore permissions again.
[3] Upload another (larger) file and abort the upload. Check table and
    directory again. You should have a partial file, but no record.
[4] Verify that Stage for import still works as expected.
[5] Test Upload local cover image. (Enable OPACLocalCoverImages.) You can
    test an individual image or a zip file including images and a file
    called datalink.txt (with lines biblionumber,filename).
[6] Test uploading a offline circulation file:
    Enable AllowOfflineCirculation, and create a koc file (plain text):
    Line1: Version=1.0\tA=1\tB=2
    Line2: 2015-08-06 08:00:00 345\treturn\t[barcode]
    Note: Replace tabs and barcode. The number of tabs is essential!
    Checkout the item with your barcode.
    Go to Offline circulation file upload. Upload and click Apply directly.
    Checkout again. Upload again, click Add to offline circulation queue.
[7] Upload three files via tools/upload.pl with a category and marked as
    public. Check the results in the table.
    Verify that you can download the file in OPAC without being logged in.
[8] Pick one new file and one of the files of step 7. Upload them in the
    same category. One upload should succeed. Check for reported error.
[9] Connect upload.pl to field 856$u.
    Goto Cataloguing editor.
    In an empty 856$u, click the tag editor. Upload a file and click Choose.
    Save the record. Open the record in the OPAC and click the link.
    Copy this link to your clipboard for next step.
[A] Go back to editor. Click the tag editor on the same 856 field.
    Choose for Delete.
    Open the link in your clipboard again. Error message?
[B] Check the process of upload, search, download and delete of an upload
    with some diacritical characters in the filename. (Bonus points for
    adding special chars in the category code.)
    Note: You can add categories via authorized values, UPLOAD key.

Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>

Bug 14321: [QA Follow-up] Perltidy upload.pl

Run perltidy -pro=xt/perltidyrc on tools/upload.pl.
No other changes.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-09-25 12:02:52 -03:00
Marc Véron
5dceb851dd Bug 13813: Remove deprecated module C4::Dates from system
Test plan: See Bugzilla.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-09-18 12:40:55 -03:00
Paul Poulain
503dd60369 Bug 14766: Complete cataloguing plugin unimarc_field_4XX
Add subfields l, n and o for better UNIMARC compliance

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>

Note: I just did a code audit here, as I don't know enough about
UNIMARC to know if the 4XX fields should have these subfields.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-09-07 11:14:48 -03:00
b348c07f96 Bug 14737: wrong permissions required for cn_browser.pl plugin
The cn_browser.pl cataloguing plugin only searches for used callnumbers
on the bibliographic database. There is no need for this plugin to
require special permissions besides access to the catalog.

To test:
- Link the cb_browser.pl cataloguing plugin to 952$o in your favourite cataloguing framework
- Login with a superlibrarian user
- Try the plugin
=> SUCCESS: you can use it
- Login with a user that has the full 'tools' permission
- Try the plugin
=> SUCCSES: you can use it
- Login with a user that doesn't have full 'tools' permission
  but has the normal catalogue and cataloguing permissions.
- Try the plugin
=> FAIL: you are requested to login with a different user
- Apply the patch
- Retry
=> SUCCESS: you can use it
- Sign off :-D

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-08-28 09:38:46 -03:00
1dc947b18c Bug 14660: Fix 3 other cataloguing plugins
These 3 should use C4::Output not to explode.

Test plan:
Link the plugins with the correct fields
They should not log an error when calling them

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-08-20 13:40:56 -03:00
Katrin Fischer
85d27f6d9f Bug 14660: Fix stocknumberam123.pl cataloguing plugin
The cataloguing plugin stocknumberam123.pl is broken and no
longer generating numbers - this patch fixes it.

To test:
 - Link a subfield to the plugin - usually it's 952$i or the UNIMARC
   equivalent in your MARC frameworks
 - Create a new item, set the inventory number to: A 0000000002
 - Start to catalog another item, enter A into inventory and
 - Enter A as stocknumber and activate the plugin by clicking on
   ... at the end of the field
 - The number will not get added - Firebug shows an error:
   Undefined subroutine CGI::output_html_with_http_headers
 - Apply patch
 - Verify numbers are now generated and no errors are shown

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-08-20 13:40:56 -03:00
Katrin Fischer
5f227b42c1 Bug 14660: Fix stocknumberAV.pl cataloguing plugin
The cataloguing plugin stocknumberAV.pl is broken and no
longer generating numbers - this patch fixes it.

To test:
- Link a subfield to the plugin - usually it's 952$i or the UNIMARC
  equivalent in your MARC frameworks
- Set up a new authorised value INVENTORY, the code is an uppercase
  prefix - "B"
- The Descriptions is your starting number - 1
- The OPAC description remains empty
- Catalalog an item
- Enter B as stocknumber and activate the plugin by clicking on
  ... at the end of the field
- The number will not get added - Firebug shows an error:
  Undefined subroutine CGI::output_html_with_http_headers
- Apply patch
- Verify numbers are now generated and no errors are shown

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-08-20 13:40:56 -03:00
7f797b3244 Bug 6874: [QA Follow-up] Last adjustments for future developments
This patch does:

[1] Some trivial template changes. Modified some comments (POD lines).
[2] Converted plugin to new style.
[3] Table updates: renames id to hashvalue, adds a autoincrement id,
    adds filesize, timestamp, owner and category.
    RM: This db rev is in a separate sql file in atomicupdate.
[4] Code references to computed hash renamed to hashvalue instead of id.
[5] Removed some code pertaining to exposing upload dir structure. The user
    now may choose a category; the uploader takes care of storage.
    The list of upload categories is now taken from authorised values; this
    might become a separate table in the future. (If there are none,
    the upload process creates one default fallback.)
    We can add e.g. permissions later, subdir structure, etc. (So dir will
    not necessarily be category anymore.)

Test plan:
[1] Run the db revision.
[2] Upload new file. Check the record in the table. Delete it again; check.
[3] Run t/db../UploadedFiles.t.
[4] Run t/db../FrameworkPlugins.t -incl cataloguing/value_builder/upload.pl

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-08-07 15:23:36 -03:00
Mark Tompsett
a6408148ba Bug 6874: Clean up file URL generation
This adds a dependency on bug 5010, in that the protocol is
assumed in the OpacBaseURL system preference. It also adds
improved error handling.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-08-07 15:23:19 -03:00
Mark Tompsett
98ccd548ee Bug 6874: License Text Update
This updates the license text for
- C4/UploadedFiles.pm
- cataloguing/value_builder/upload.pl
- opac/opac-retrieve-file.pl
to GPL v3 as per the
http://wiki.koha-community.org/wiki/Coding_Guidelines#Licence
text.

TEST PLAN
---------
1) Don't apply this patch as part of 6874.
2) Run the koha qa test tool.
   -- It will FAIL for those three file.
3) Apply this patch
4) Run the koha qa test tool.
   -- License problem is corrected, no FAILs.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-08-07 15:23:05 -03:00
Mark Tompsett
64079ccaa3 Bug 6874: kohastructure.sql, jquery.js, refocus, and more
Two problems were discovered while doing a fresh install
of Koha. These problems in the kohastructure.sql file are
addressed with this patch.

Clicking the plug-in icon should cause the popup window
to refocus.  This adds the refocus code to the upload.pl file.

The path to the jquery.js script was wrong in the
upload_delete_file.tt file. Changed [% themelang %] to
[% interface %].

If a user clones 856$u after uploading a file, deletes the file,
and then clicks the plugin icon on the first 856$u, this will go
immediately to the upload screen with an informative error
message.

After some validation was added, it was extended to include
other cases. This serves to patch 6874 to a state where sign
off should be possible.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-08-07 15:22:45 -03:00
Julian Maurice
79168c011b Bug 6874: Force user to select a directory
This patch adds a javascript and a server-side checks

Test plan:
1/ Choose a file, leave the radios not selected and submit
2/ You have a javascript alert which prevents form to be submitted
3/ Disable javascript and repeat step 1
4/ Form is submitted but form is redisplayed with an error message
telling you to choose a directory.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-08-07 15:22:44 -03:00
094092b111 Bug 6874: (QA followup) Attach files to bibliographic records
* Renames uploadPath to upload_path to follow the standard naming
  conventions in koha-conf which use underscores rather than camel case
* Remove reference to intranet-tmpl and replace with [% interface %]
  required to pass qa

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-08-07 15:22:13 -03:00
Julian Maurice
9f0546f003 Bug 6874: Move uploadPath syspref to koha-conf.xml
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-08-07 15:22:06 -03:00
Julian Maurice
209faec183 Bug 6874: Add unit tests for C4::UploadedFiles
Add unit tests for C4::UploadedFiles and move a variable
declaration at subroutine level instead of file level.
Add dependency to Test::CGI::Multipart

Still works, and the newly-provided unit tests have good test
coverage:
C4/UploadedFiles.pm 90.7    65.0    66.7    100.0   100.0    0.2    86.4

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-08-07 15:22:06 -03:00
Paul Poulain
bfe5680186 Bug 6874: QA follow-up
Squash of the following commits:
  return with explicit undef removed
  Follow-up for PBP fixes
  follow-up fix POD syntax
  follow-up jquery has moved

Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Amended: removed POD changes in Biblio.pm while rebasing.
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-08-07 15:22:06 -03:00
Julian Maurice
2def11d678 Bug 6874: Attach files to bibliographic records
New cataloging plugin upload.pl and new system preference 'uploadPath'.

upload.pl provide a way to upload files on the server and store a link
(url) to it in MARC
uploadPath is the absolute path on the server where the files will be
stored. It's possible to have a hierarchy of directories under this path
and the plugin will allow to choose in which directory to store the
file.
Stored value in MARC subfield looks like this:
<OPACBaseURL>/cgi-bin/koha/opac-retrieve-file.pl?id=<SHA-1 of the file>
So both 'uploadPath' and 'OPACBaseURL' sysprefs have to be set for this
plugin to work correctly

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Slightly amended/simplified the patch during QA: The changes to
GetMarcUrls are not really needed, and would have needed some
attention. Another link text can be supplied by the plugin too.

This also reduces the need for changes in basket.pl,
MARCdetail.pl, detail.pl, opac-basket.pl and opac-detail.pl.
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>

Edit: more meaninfull commit subject
2015-08-07 15:21:31 -03:00
c76b6a148b Bug 13904: Make unimarc_field_4XX displays usefull 200 subfield data
When searching for multivolumes titles, UNIMARC 4xx field plugin
displays the title of the biblios (200$a), without giving info about
volumes (200 $h $i). It neither doesn't display $e (subtitle) info which
could greatly help to disambiguate search result.

The displayed title is supposed to link to a biblio record view (MARC /
normal). It doesn't work.

TO TEST:

- On a UNIMARC Koha, add a new biblio record
- Call the 4XX plugin from 461/463 field
- Search for a biblio record which contains 200$e, and/or 200$h and/or
  200$i subfields.
- You get a result list, with two issues:
  1. $a, $h & $i aren't displayed
  2. Biblio title is not a link
- Apply the patch, and repeat previous steps.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
I got a link on fulltitle, but in 'ahie' order (not aehi)
Fixed some tabs.

Signed-off-by: Jonathan Druart <jonathan.druart@koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-06-19 11:35:57 -03:00
39a598c987 Bug 13437: Replace javascript function parameter in builder
The builder contains js functions with a parameter like subfield_managed
or i or something similar. This parameter contains the html id of the
field corresponding with the plugin.
With the functionality of Koha::FrameworkPlugin in place, we can eliminate
one js function call and get the same id via the event passed in. Note
that this actually makes the function a 'real' event handler.

Also note that in many cases this parameter was not used but the id
was borrowed from a perl variable like $params->{id}. If the field is not
cloned, this is not a problem. But some fields can be cloned and should
not use the static perl value but should get it from the event.

Test plan:
Look for js errors when loading the marc editor.
Since the Focus or Click event code has been touched for most marc21
plugins, move your cursor into the field or click on the tag editor
button. Verify that the focus event updates the correct field or the
click event correctly launches the plugin AND the value comes back into
the right field.
Bonus: Attach a plugin with popup (like leader) to 040$d. Clone this field.
Verify that the two launch buttons operate on the correct value.
(This resolves a current bug.)

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Checked all 15 plugins.
Plugin marc21_linking_section seems to work, but I could not get it to pass
back something useful into my field. (Same without this patch.)
Tested the clone button with leader on 040d.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
All seems to work, no errors

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-06-10 12:51:28 -03:00
964fae60ee Bug 13437: Conversion of marc21 cataloguing plugins to new style
This patch converts marc21 plugins to new style by making the following
modifications:

[1] Replace use strict with use Modern::Perl. This implies that we now
re-enabled warnings. There are no redefine warnings anymore, but note that
we need to silence some warnings from individual plugins that were covered
by disabling the warnings pragma until now. Silencing these individual
warnings is outside the scope of this report.
[2] Sub plugin_javascript is replaced by an anonymous subroutine $builder.
[3] The parameters of $builder are combined in a params hashref. In most
cases we only need $params->{id} for the function name.
[4] Javascript function Clicxxx is renamed to Clickxxx.
[5] The builder does no longer return function_name.
[6] Sub plugin is replaced by subroutine $launcher.
[7] The parameters of $launcher are combined in a params hashref. We only
use $params->{cgi}. Mostly we save that to $input. One exception: $query.
[8] The plugins returns a hash with $builder and/or $launcher.

Test plan:
[1] Run t/db_dependent/FrameworkPlugin.t -incl cataloguing/value_builder/
marc21*.pl. This should catch compile errors and general problems when
building or launching these plugins.
NOTE: You will see several initialize warnings from individual plugins that
were hidden until now by disabling warnings. This is fine; we will be
able to address these warnings now on new reports.
[2] Check behavior of several plugins in the marc editor.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Checked all marc21 plugins. Attached unused plugins to some field.
Some plugins (unused by default) may need some further attention, but
also outside the scope of this report.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
New warnigs, but all seems to work.
No errors.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-06-10 12:51:27 -03:00
51197e9f18 Bug 13437: Trivial edits on marc21 plugins before conversion
marc21_field_003.pl: copy-pasta comment about date removed
marc21_field_005.pl: commented use removed
marc21_field_006.pl: old/irrelevant pod lines
marc21_field_007.pl: old/irrelevant pod lines
marc21_field_008.pl: old/irrelevant pod lines, move sub par line twice
marc21_field_008_authorities.pl: whitespace, old/irrelevant pod lines
marc21_field_040c.pl: two commented lines removed
marc21_field_040d.pl: whitespace, commented lines, old/irrelevant pod
marc21_field_245h.pl: whitespace

marc21_linking_section.pl: relocated some comment lines, and replaced a new
CGI object by the one passed in via the plugin launcher (agreed, this may
not be so trivial as the other changes)

Test plan:
These (trivial) changes are hard to test.
Pick a few plugins and verify that behavior is not changed in the marc
editor.
For the brave: Try marc21_linking_section.pl.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Tried marc21_linking_section.pl :)
(ling plugin to 773$9, create new record, search for parent and check values inserted)
No errors

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-06-10 12:51:27 -03:00
efe5266625 Bug 13437: Preliminary changes for marc21 plugins field 008
Preliminary work on marc21_field_008.pl and 008_authorities.pl.
Moving $dateentered en $defaultval to lower scope level.
date_entered is a new sub (in a module); sub Field008 has been reduced to
one line.
Added a trivial unit test for date_entered.
Note: the format used in date_entered could be added in DateUtils, moving
this logic to a better place.

Test plan:
Use both plugins in the marc21 editor (biblios/authorities).
Run the adjusted unit test.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Both plugins works, no errors

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-06-10 12:51:26 -03:00
db4dcb2c72 Bug 13437: Perltidy some plugin files before conversion
Preliminary work before converting to new plugin style. Several files still
contained tabs or had strange indentation.

Perltidied: marc21_linking_section.pl
Perltidied: marc21_field_007.pl
Perltidied: marc21_leader_authorities.pl
Perltidied: marc21_leader.pl
Perltidied: marc21_leader_book.pl
Perltidied: marc21_leader_computerfile.pl
Perltidied: marc21_leader_video.pl

Test plan:
Run perltidy -pro=xt/perltidyrc on marc21_linking_section and compare.
Try another one too :)

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Minor differences on comparison :)
No errors

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-06-10 12:51:26 -03:00
Jonathan Druart
eaaf290073 Bug 13364: Use SQL placeholder 2015-05-06 11:17:02 -03:00
Jonathan Druart
d922f36ef5 Bug 13364: Remove unused JS functions 2015-05-06 11:17:02 -03:00
Jonathan Druart
d8b1f7c4ca Bug 13364: Fix table id + software error
change table id in css file
+ C4::Output is used (Undefined subroutine
CGI::output_html_with_http_headers)

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
2015-05-06 11:17:02 -03:00
simith
4aa4d41ce5 Bug 13364: Add a call number browser in item edition page
When editing an item, the call number browser search for existing call number. If it shows a line is green between two calli numbers, the call numbers searched is available. If the call number is highlighted in red, it means that it already exists. This can be used to avoid repeated  call numbers in your collection.

The call number browser also shows its position relative to the rest of the collection.

Sponsored-by: CCSR

To test :

                   1) Go to MARC bibliographic framework
                   Home › Administration › MARC frameworks
                   2) Click in MARC structure (Default framework)
                   3) Search field 952 and click in subfields
                   4) Edit subfield o (Full call number)
                   5) Click Display more constraints
                   6) In Others Options, Plugin, Choose cn_browser.pl and save changes
                   7) Search a record and edit its items
                   Validate : three points (…) beside Full call number input
                   8)  Click in …
                   Validate : if it can not find the given call number, a green line is shown. Otherwise,  the given call number is highlighted in red.

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

Signed-off-by: Magnus <magnus@enger.priv.no>
Works as advertised. QA scripts pass.

Tested together with other patches. Works as expected.
Signed-off-by: Marc Véron <veron@veron.ch>

Bug 13364 - fix datatables.inc

http://bugs.koha-community.org/show_bug.cgi?id=13364
Signed-off-by: Magnus <magnus@enger.priv.no>
Works as advertised. QA scripts pass.

Tested together with other patches, works as expected.
Signed-off-by: Marc Véron <veron@veron.ch>

Bug 13364 - Add a call number browser in item edition page - QA fixed

Tested together with other patches.
Signed-off-by: Marc Véron <veron@veron.ch>

Bug 13364 - Add a call number browser in item edition page - QA fixed II

Tested together with oter patches.
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-05-06 11:16:46 -03:00
Jonathan Druart
ba0f84b46c Bug 9978: (followup) Replace license header with the correct license (GPLv3+)
There was another form of the v2.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-04-20 09:59:43 -03:00
Jonathan Druart
a6c9bd0eb5 Bug 9978: Replace license header with the correct license (GPLv3+)
Signed-off-by: Chris Nighswonger <cnighswonger@foundations.edu>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>

http://bugs.koha-community.org/show_bug.cgi?id=9987

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-04-20 09:59:38 -03:00
7db33499b1 Bug 10480: Follow-up for unimarc_field_686a/_700-4.pl
This patch fixes the pod errors on those two files by removing the pod
section that actually does not add anything useful.

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:43 -03:00
0d177c9546 Bug 10480: Remove useless routines and irrelevant pod lines
This patch makes the following cleanup actions for all plugins:

1- Remove sub plugin_parameters. This function is not used.
2- Remove empty plugin or empty plugin_javascript subs.
3- Remove empty Blur, Clic or Focus routines from javascript.
4- Remove pod lines (copy-pasta) only referring to the 3 plugin subs.
5- Remove the last 1; line. It is no longer needed.

Test plan:
Run the unit test t/db_dependent/FrameworkPlugins.t
Test some cataloguing plugins in addbiblio.
Test some item plugins in additem and neworderempty.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
I also checked the syntax of all plugins with perl -c.
And checked the pod (if any) with podchecker: Two files still produce a
warning; the follow-up deals with them: unimarc_field_686a/_700-4.pl.

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:40 -03:00
331cbeb1df Bug 10480: EXAMPLE plugin with associated template
The EXAMPLE plugin helps you to create a new style framework plugin by
providing a simple working example and additional documentation for
developers.

Test plan:
[1] Connect the EXAMPLE plugin to one or more fields.
[2] Try the following events:
    a- Focus: If the field is empty, it should put EXAMPLE: into it.
    b- MouseOver: If the field is empty and you move your mouse over it,
       it should have the same effect as Focus.
    c- Change: Edit the field in the editor and tab out of it, the color
       of the text should toggle (randomly) between red, green and blue.
    d- KeyPress: If you edit the field and you type @, it should give AT.
    e- Click: Click on the tag editor. Change the value in the popup.
       If you press OK, the field should be changed.
[3] Would the documentation in the perl script help you to create a plugin?

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:38 -03:00
706e7a953e Bug 13204: Plugin housekeeping: Remove labs_theses.pl plugin
As it seems, this plugin has been created for UNIMARC field 328
(Dissertation note). It refers to authval category LABTHE.

The plugin seems however not to be used: it contains several critical errors.
I tried a quick fix but it was not good enough. Since the code can be
recovered from git (if needed), a real fix can always follow this patch.

What are some problems:
[1] The path to the template is wrong. Should be cataloguing/value_builder
[2] The plugin parameter $input is not used. A new CGI object is created.
[3] Resolving errors 1 and 2 still results in premature end of script
    headers.
[4] Not sure whether the plugin can effectively handle missing LABTHE values.

Instead of keeping this in Koha, I opt for removing it for now. As additional
argument I would mention that labs_theses does not have Focus or Blur actions,
only the Click action that does not work.

Test plan:
Git grep on labs_theses.

Signed-off-by: Frederic Demians <f.demians@tamil.fr>

This antique plugin deserves to live forever in Git Historical Museum.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Small fix so the patch applies.
2015-01-14 21:26:42 -03:00
Jonathan Druart
e20270fec4 Bug 11944: use CGI( -utf8 ) everywhere
Signed-off-by: Paola Rossi <paola.rossi@cineca.it>
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Dobrica Pavlinusic <dpavlin@rot13.org>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-01-13 13:07:21 -03:00
Jonathan Druart
55107741a2 Bug 11944: replace use of utf8 with Encode
See the wiki page for the explanation.

Signed-off-by: Paola Rossi <paola.rossi@cineca.it>
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Dobrica Pavlinusic <dpavlin@rot13.org>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-01-13 13:06:45 -03:00
c4a8e5fb3e Bug 13223: Plugin housekeeping: do not redefine wrapper
This report is connected to bug 10480 which will change the general
mechanism of loading plugins, but can be tested independently and ahead
of that proposed change.

Several unimarc plugins use a wrapper sub. The code of this subroutine
is not exactly the same for all plugins: in some cases the routine is
extended for double character strings (dblspace and dblpipe). It would
not hurt to use the extended code for all plugins.

By moving the code to a module, we prevent redefinition
when two or more plugins are loading wrapper in a do-statement.

NOTE: You will not see wrapper redefine errors in your log, since the
plugins do not use the warnings pragma (yet). Since this patch touches
seventeen unimarc plugins, a unimarc signoff is preferred :)

Test plan:
Use some plugins changed in this patch (if not in use already).
Load the MARC editor.
Click on some tag editor-buttons to check unchanged behavior.

Signed-off-by: Frederic Demians <f.demians@tamil.fr>
               Unimarc plugins work as usual. No regression. Simple code
               factorization.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-19 13:28:08 -03:00
7cbbbb04df Bug 13203: Plugin housekeeping: UNIMARC field 123i, 123j, 210c
In working on bug 10480, I noticed that these plugins needed some attention:

[2] unimarc_field_123i.pl: added missing template
[3] unimarc_field_123j.pl: resolved missing template with same file
[4] unimarc_field_210c_bis.pl: removed a warn, corrected some POD lines

Note about UNIMARC field 123i and 123j: Subfields $i and $j are each 8
characters long and contain the same components as subfields $f and $g
except that character position 0 contains a plus sign (for the northern
celestial hemisphere) or a minus sign (for the southern celestial hemisphere).

Test plan:
Connect unimarc_field_123i and 123j to some field.
Look especially at changing + or - for the hemisphere in the popup.
Check left-padding with zeroes for the other positions.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes tests and QA script.
Checked plugin in a UNIMARC installation.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-11 14:10:34 -03:00
Jonathan Druart
8dfc399a2d Bug 12884: Get rid of redefined subroutine warnings in dateaccessioned.pl
Instead of removing all warnings, we should remove warnings about the
redefined subroutines.

Test plan:
- link the dateaccessioned plugin with one of your biblio field
- edit an item
- verify they are no warnings in the Koha log file.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-10-22 14:18:40 -03:00
Bernardo Gonzalez Kriegel
2f7fa17557 Bug 12694: Remove CGI::scrolling_list from unimarc_field_4XX.pl
There are two instances on this file, but they are not used.
I suppose is old code that was left dangling.

Both scrolling_list, CGIPublisher and CGIitemtype, are not
used on unimarc_field_4XX.tt nor any other file.

Just removed from file two useless db queries.

To test:
1. Apply the patch
2. If you have unimarc config, just go to one of the
fields that use this plugin.
If you don't, can edit you framework and change the plugin
for a tag, e.g. 007. Then save fw, search and edit a record,
clic to open plugin on 007 tag, check that works but don't
save the original record, finally revert your changes.

There must be no functional changes, is unused code.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Verified plugin still seems to work:
- item type pull down shows up correctly
- search works and choosing a record will fill subfields
Passes tests and QA script.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-08-19 12:44:27 -03:00
Bernardo Gonzalez Kriegel
deb22f01bb Bug 12704: Remove CGI::scrolling_list from unimarc_field_225a.pl
This patch removes the only instance in this file

To test:
1. Apply the patch
2. If you have UNIMARC, search for a record, edit it,
and go to tag 225
If you don't, edit your framework and connect this
pluging to some tag/subtag
3. Clic on the plugin link. If you don't have any record
that correspond to the search, can remove the commented
line to have something to play
4. The collection pulldown was replaced, check that works,
select a value and press Ok

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes tests and QA script, tested according to test plan.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-08-19 12:44:03 -03:00
Bernardo Gonzalez Kriegel
ec2921b83b Bug 12695: Remove CGI::scrolling_list from marc21_linking_section.pl
Same situation as Bug 12694.

There are two instances on this file, but they are not used.
I suppose is old code that was left dangling.

Both scrolling_list, CGIPublisher and CGIitemtype, are not
used on marc21_linking_section.tt nor any other file.

Just removed from file two useless db queries.

To test:
1. Apply the patch
2. Can't remember how to trigger this plugin.
You can edit you framework and change the plugin
for a tag, e.g. 007. Then save fw, search and edit a record,
clic to open plugin on 007 tag, check that works but don't
save the original record, finally revert your changes.

There must be no functional changes, is unused code.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Followed test plan successfully. The behavior of the plugin window
appears to be unchanged after applying the patch.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Amending the test plan a bit: The plugin was added by bug 8185
- not dead code at all :)

In order to test:
- Edit one of your frameworks, make 773 atwxz9 visible.
- Link 773 $9 to the marc21-linking-section plugin
- Create a new record in cataloguing
- Search for a your host item record (parent)
- Link it
- Observe that the subfields have been filled with information
  from the other record
  $w = 001 from the parent
  $9 = biblionumber from the parent
  $t = Title
  $x = ISSN
  ...

Still works with the patch applied.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-08-19 09:41:37 -03:00
Jonathan Druart
2f052756e3 Bug 11349: (qa follow-up) Fix pod
FAIL   cataloguing/value_builder/unimarc_field_125.pl
   FAIL   pod
    *** ERROR: empty =head1  in file cataloguing/value_builder/unimarc_field_125.pl
    *** ERROR: Spurious text after =cut  in file cataloguing/value_builder/unimarc_field_125.pl

 FAIL   cataloguing/value_builder/unimarc_field_126b.pl
   FAIL   pod
    *** ERROR: empty =head1  in file cataloguing/value_builder/unimarc_field_126b.pl
    *** ERROR: Spurious text after =cut  in file cataloguing/value_builder/unimarc_field_126b.pl

 FAIL   cataloguing/value_builder/unimarc_field_225a.pl
   FAIL   pod
    *** ERROR: =over on line 40 without closing =back (at head1)  in file cataloguing/value_builder/unimarc_field_225a.pl
    *** ERROR: empty =head1  in file cataloguing/value_builder/unimarc_field_225a.pl

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-07-17 11:06:15 -03:00