Commit graph

65 commits

Author SHA1 Message Date
631a80aaee
Bug 35106: CSRF fix
The removal of 'cud-' from op needs to happen sooner
because ill-requests.tt expects 'edit_action' op,
not 'cud-edit_action'.

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-04-29 18:53:09 +02:00
c304eabc19
Bug 35106: Validate entered borrowernumber and biblio_id
Following up from the test plan of the previous patch:
1) Edit the request again, input gibberish in the Patron ID e.g. 'asdasd'
2) Hit 'Submit'
3) Notice you get a 'The Patron ID you entered is invalid.' message.
4) Edit again, try to empty the input on the Patron ID, hit 'Submit'.
5) Notice it saves the patron as null, as expected

Repeat the test plan, but now for the Bibliographic record ID, notice
the message 'The Bibliographic record ID you entered is invalid.' is
shown if a no biblio was found.

Signed-off-by: David Nind <david@davidnind.com>

squash this

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-04-29 18:53:09 +02:00
7eb9807334
Bug 36416: Fix cud-check_out
1) Install FreeForm and enable ILLModule, run:
bash <(curl -s https://raw.githubusercontent.com/ammopt/koha-ill-dev/master/start-ill-dev.sh)
2) Checkout to branch b_36243
cd /kohadevbox/koha/Koha/Illbackends/FreeForm
git checkout b_36243
3) Enable CirculateILL sys pref
4) Create a new ILL request, visit:
<staff_url>/cgi-bin/koha/ill/ill-requests.pl?method=create&backend=FreeForm
5) Set "type" = Book and enter '42' on the cardnumber input, click "Create"
6) On the top toolbar, click "Confirm" and confirm the following screen.
7) You now have a new option "Check out" on the toolbar. Click on it. Notice it explodes.
8) Apply patch. Repeat.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-04-26 08:52:49 +02:00
ac157b7a75
Bug 35581: Koha::Illrequest -> Koha::ILL::Request
Koha/Illrequests.pm -> Koha/ILL/Requests.pm

Merged:
t/db_dependent/Koha/Illrequests.t
t/db_dependent/Illrequests.t

Into:
t/db_dependent/Koha/ILL/Requests.t

ILL classes file structure is, for the most part, around 7 years old and doesn't follow a strict logic. It's so confusing that some test files exist redundantly.

This housekeeping should help future work in regards to ISO18626 to add Koha as a supplying agency instead of just requesting agency, as is now.
It should also help future housekeeping of moving backend related logic out of the Illrequest.pm into Illbackend.pm (now ILL/Request.pm and ILL/Backend.pm as of this patchset).
It should also help in structuring the addition of a master generic form (see bug 35570)

This patchset will require existing backends to be updated to match the new class names and structure, if they invoke them.

Test plan, k-t-d, run tests:
prove t/db_dependent/api/v1/ill_*
prove t/db_dependent/Koha/ILL/*

Test plan, k-t-d, manual:
1) Install FreeForm, enable ILL module, run:
bash <(curl -s https://raw.githubusercontent.com/ammopt/koha-ill-dev/master/start-ill-dev.sh)
2) You'll have to switch the FreeForm repo to the one compatible with this work, like:
cd /kohadevbox/koha/Koha/Illbackends/FreeForm
git checkout reorganize_ILL
3) Do some generic ILL testing:
3.1) Create a request
3.2) Add a comment to a request
3.3) Edit a request
3.4) Edit a request's item metadata
3.5) Confirm a request
3.6) List requests
3.7) Filter requests list using left side filters
4) Install a metadata enrichment plugin:
https://github.com/PTFS-Europe/koha-plugin-api-pubmed
4.1) Create an ILL batch and insert a pubmedid like 123
4.2) Add the request and finish batch
5) Verify all of the above works as expected

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-04-22 08:57:45 +02:00
bcc0f17317
Bug 35581: Koha::Illrequest::Config -> Koha::ILL::Request::Config
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-04-22 08:57:44 +02:00
fb2d14901b
Bug 35581: Koha::Illrequest::Workflow* -> Koha::ILL::Request::Workflow*
Koha/Illrequest/Workflow.pm -> Koha/ILL/Request/Workflow.pm
Koha/Illrequest/Workflow/Availability.pm -> Koha/ILL/Request/Workflow/Availability.pm
Koha/Illrequest/Workflow/TypeDisclaimer.pm -> Koha/ILL/Request/Workflow/TypeDisclaimer.pm

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-04-22 08:57:43 +02:00
c766172d50
Bug 35581: Koha::Illcomment* -> Koha::ILL::Comment*
Koha/Illcomment.pm -> Koha/ILL/Comment.pm
Koha/Illcomments.pm -> Koha/ILL/Comments.pm

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-04-22 08:57:42 +02:00
daf37b85d7
Bug 35581: Koha::*Illbatch* -> Koha::*ILL::*Batch*
Koha/Illbatch.pm -> Koha/ILL/Batch.pm
Koha/Illbatches.pm -> Koha/ILL/Batches.pm
Koha/REST/V1/Illbatches.pm -> Koha/REST/V1/ILL/Batches.pm
t/db_dependent/Koha/Illbatch.t -> t/db_dependent/Koha/ILL/Batch.t
t/db_dependent/Illbatches.t -> t/db_dependent/Koha/ILL/Batches.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-04-22 08:57:41 +02:00
d337541353
Bug 35331: Add table actions hook to ILL table
Test plan, k-t-d, apply patches:
1) Install FreeForm backend, enable ILLModule sys pref, run:
   bash <(curl -s https://raw.githubusercontent.com/ammopt/koha-ill-dev/master/start-ill-dev.sh)
2) Navigate to ILL requests, visit:
   /cgi-bin/koha/ill/ill-requests.pl
3) Click '+New ILL request', select a type, enter an existing cardnumber (e.g. '42') and pick a library. Click 'Create'.
4) Visit ILL requests again, repeat 2)
5) Notice the row for the created request has the already existing action button 'Manage request'
6) Install the ILL actions plugin, located at:
   https://github.com/PTFS-Europe/koha-plugin-ill-actions/releases/tag/v1.0.0
7) Restart plack, run:
   koha-plack --restart kohadev
8) Repeat 4) and 5). Notice the row for the created request now has a new custom action in addition to the already existing core one.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-03-18 11:03:33 +01:00
e701926442
Bug 36190: Fix problems found by test
opac-shelves           - forms were stateless - changed to GET
sco-main               - forms stateless - changed to GET
                         ** untested because sco + auth is broken
smart-rules.tt         - JS form template - added placeholder 'cud-' op
ill-requests           - added cud- tp ops
                         ** tested comments, but not checkout, simple changes
boraccount             - removed repeated op - updated script
patroncards/edit-batch - add placeholder 'cud-' op
patroncards/manage     - add placheholder 'cud-' op
elasticsearch/mappings - separate forms - this could use a style follow-up, but makes more sense separate I think
reports/dictionary      - stateless - changed to GET
guided_reports_start    - stateless - changed to GET
suggestion/suggestion   - add placeholder 'cud-' op
inventory               - filed bug 36305, needs more handling

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-03-15 09:38:54 +01:00
90cd0e4ccf
Bug 36245: Remove cud- from op
1) Install FreeForm, enable ILL module, run:
bash <(curl -s https://raw.githubusercontent.com/ammopt/koha-ill-dev/master/start-ill-dev.sh)
2) You'll have to switch the FreeForm branch to the one compatible with this work, i.e.:
cd /kohadevbox/koha/Koha/Illbackends/FreeForm
git checkout b_36243
3) Restart plack:
koha-plack --restart kohadev
4) Create a new FreeForm request, visit:
<staff_url>/cgi-bin/koha/ill/ill-requests.pl?method=create&backend=FreeForm
5) Set 'type' enter '42' in cardnumber and pick a library. Click 'Create'.
6) Edit that request, click "manage request" or if #1 visit:
<staff_url>/cgi-bin/koha/ill/ill-requests.pl?op=illview&illrequest_id=1
7) Click "Edit item metadata". Click "Submit". Notice it explodes.
9) Apply patch. Restart plack.
10) Repeat 7)

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-03-07 16:36:36 +01:00
4214e5415d
Bug 36249: Fix generic_confirm op
Test plan, k-t-d:

1) Install FreeForm, enable ILL module, run:
bash <(curl -s https://raw.githubusercontent.com/ammopt/koha-ill-dev/master/start-ill-dev.sh)
2) You'll have to switch the FreeForm branch to the one compatible with this work, i.e.:
cd /kohadevbox/koha/Koha/Illbackends/FreeForm
git checkout b_36243
3) Restart plack:
koha-plack --restart kohadev
4) Start by adding an e-mail address to the patron of category "Inter-library Loan", visit:
<staff_url>/cgi-bin/koha/members/memberentry.pl?op=edit_form&destination=circ&borrowernumber=16
5) Add an e-mail address to "Primary e-mail"
6) Create a new FreeForm request, visit:
<staff_url>/cgi-bin/koha/ill/ill-requests.pl?method=create&backend=FreeForm
7) Set 'type' enter '42' in cardnumber and pick a library. Click 'Create'.
8) Click "Place request with partners"
9) Pick a partner library (will be the same patron from step 4)
10) Click "Send email". Notice the CSRF error.
11) Apply patch and restart plack
koha-plack --restart kohadev
12) Repeat 8-10. Notice error no longer shows.
13) Notice the request's status is now 'Requested from partners'

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-03-07 16:36:35 +01:00
2e633b7f9d
Bug 36243: Update edit_action to cud-edit_action
1) Install FreeForm, enable ILL module, run:
bash <(curl -s https://raw.githubusercontent.com/ammopt/koha-ill-dev/master/start-ill-dev.sh)
2) You'll have to switch the FreeForm branch to the one compatible with this work, i.e.:
cd /kohadevbox/koha/Koha/Illbackends/FreeForm
git checkout b_36243
3) Restart plack:
koha-plack --restart kohadev
4) Create a new FreeForm request, visit:
<staff_url>/cgi-bin/koha/ill/ill-requests.pl?method=create&backend=FreeForm
5) Set 'type' enter '42' in cardnumber and pick a library. Click 'Create'.
6) Edit that request, click "manage request" or if #1 visit:
<staff_url>/cgi-bin/koha/ill/ill-requests.pl?op=illview&illrequest_id=1
7) Click "Edit request". Click "Submit". Notice it errors "No CSRF token passed for POST"
9) Apply patches. Restart plack.
10) Repeat 7)

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-03-07 16:36:34 +01:00
0cefd8c112
Bug 36243: Remove cud- from op
'cud-' needs to be removed here because it's showing the form, not handling its POST submission

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-03-07 16:36:34 +01:00
8f7535856b
Bug 36241: Fix wrong cud-search
This line is supposed to searhc for plugins with the method 'provides_api' which returns a {type => 'search'} entry among others.
This has nothing to do with search vs cud-search from  in forms

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-03-07 16:36:32 +01:00
93e3fed043
Bug 34478: Move compatibility code
All ILL backend retrocompatibility code has been moved to Illrequest.pm:get_op_param_deprecation for isolation and clarity

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 10:58:06 +01:00
a9adee54b8
Bug 34478: ILL INTRA: query_type => op
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 10:58:05 +01:00
38b21ff3b8
Bug 34478: ILL INTRA: delete to cud-delete
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 10:58:04 +01:00
40a1ab9db1
Bug 34478: ILL INTRA: cancel to cud-cancel
cancel -> cud-cancel

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 10:58:04 +01:00
8818055c82
Bug 34478: ILL INTRA: create -> cud-create
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 10:58:03 +01:00
a24596709a
Bug 34478: ILL INTRA: deprecation check
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 10:58:02 +01:00
78c8ab3744
Bug 34478: ILL INTRA: method -> op
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 10:58:01 +01:00
18e808240f
Bug 34478: op =~ ^cud- in pl/pm
This is the result of
  bash op_must_start_with_cud-perl.sh

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 10:56:11 +01:00
314fe71ff8
Bug 34478: Remove check_csrf from pl files
We should no longer need to check CSRF token from pl files

TODO - there is a change for some files where we returned 403

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 10:56:01 +01:00
7e7159bf58
Bug 34478: Remove generate_csrf from pl
We do not longer need to generate_csrf from pl files

TODO - members/boraccount.tt and sco/sco-main.tt needs to be adjusted

Bug 34478: [TO SQUASH] Remove generate_csrf from pl

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 10:55:56 +01:00
Andreas Jonsson
fee4368cd8
Bug 35930: Add guards for plugins_enabled
The 'new' method in Koha::Plugins returns undefined if
plugins are disabled.  Therefore, calls to this method
must be guarded by a check that plugins actually are enabled.

Test plan:

* Code inspection of patch, alternatively
* Activate the ill system by installing a backend such as
  koha-illbackend-libris:
  https://github.com/Libriotech/koha-illbackend-libris
* Make sure plugins are disabled in koha-conf.xml
* In the staff interface, go to ILL requests.
* The page should load without getting an error 500.

PA amended commit message: This is not related to ILL backends being plugins or not
This is about ILL batches, where checking for metadata enrichment plugins was missing 'enable_plugins' guard
Additionally, unrelated to batches, it's also about ILLAvailability, where checking for ILL availabililty plugins was missing enable_plugins guard

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Hans Pålsson <hans.palsson@hkr.se>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2024-02-14 13:28:30 +00:00
fb02affd57
Bug 34282: Fix availability check in ILL batches
Staging modal area had issues listing availability checks for each request in the batch creation process

To test:
1) Run bash <(curl -s https://raw.githubusercontent.com/ammopt/koha-ill-dev/master/start-ill-dev-plus.sh)
2) Install a metadata enrichment plugin, e.g. https://github.com/PTFS-Europe/koha-plugin-api-pubmed/releases
3) Install and configure an availability plugin, e.g. eds https://github.com/PTFS-Europe/koha-plugin-ill-avail-eds/releases
4) Enable ILLCheckAvailability sys pref
5) Create a new ILL batch and input some pubmedids, i.e. 34898594, 31452466
6) Verify that the availability results show and are working, for each request in the batch

Signed-off-by: Edith Speller <Edith.Speller@ukhsa.gov.uk>

Sponsored-by: UKHSA (UK Health Security Agency)
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-01-31 14:44:39 +01:00
a5dbafec5b
Bug 30719: ILL Batches
- Add batch column to requests table
- Establish if there are any availability or metadata enrichment plugins and pass that to the template
- Verify if we have any backend that can support batches, if not, don't show the option
- Updates to the ILL toolbar
- New ILL batch modal
- New Koha classes
- API specs

Co-authored-by: Andrew Isherwood <andrew.isherwood@ptfs-europe.com>
Signed-off-by: Edith Speller <Edith.Speller@ukhsa.gov.uk>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-17 14:45:15 -03:00
db37dbf8b8
Bug 33716: (QA follow-up) Fix submission when cardnumber is invalid
Issue that this patch fixes:
1) Enable ILLmodule and install FreeForm, run:
bash <(curl -s https://raw.githubusercontent.com/ammopt/koha-ill-dev/master/start-ill-dev.sh)
2) Copy the example YAML text into the system preference input box
3) Create a new FreeForm request and enter a duff borrowernumber e.g. '11111111111111'
4) Click 'Create'. Submit the type disclaimer stage.
5) Notice there's an error
6) Apply this patch.
7) Repeat steps 3 and 4. Verify that the correct 'The borrower details you entered are invalid' error message is displayed instead of the error in 5).

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-09-19 16:34:37 -03:00
a1e6468181
Bug 33716: (QA follow-up) Update z39.50 availability search in 'Request from partners' screen
Test plan:
- Enable ILLCheckAvailability;
- Enable ILLModule and install FreeForm
- Update partner_code in koha-conf.xml to match the patron category being used ('IL' if on k-t-d)
- Install and configure z39.50 availability plugin, link it to the patron ID ('16' if on k-t-d)
- Add a valid e-mail address to the patron of 'IL' category
- Create a new ILL request and go to 'Manage request' screen
- Click 'Place request with partners' notice the label 'Partners available for searching: none'
- Apply patch and refresh, notice a 'Search selected partners' button now shows up after you select the partner from the list

This is a fix for a regression caused by the rest of the code in this bug. I'm submitting this here since this has not yet been pushed and the fix is quite self-explanatory

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-09-19 16:34:36 -03:00
0d45394827
Bug 33716: ILL Type Disclaimer - Staff
Update the way Availability is handled
Add the new type disclaimer workflow operation
after Availability

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-09-19 16:34:30 -03:00
298043edb7
Bug 34598: Improve handling of not found ILL request
1) Enable ILLmodule and install FreeForm, run:
   bash <(curl -s https://raw.githubusercontent.com/ammopt/koha-ill-dev/master/start-ill-dev.sh)
2) Visit a request that doesn't exist (assuming empty illrequests table):
   INTRA/cgi-bin/koha/ill/ill-requests.pl?method=illview&illrequest_id=1
3) Verify an error 500 is returned with message "Can't call method
   "backend_illview""
4) Apply patch
5) Repeat steps 1-3. Verify that a "ILL request not found." message is
   now displayed

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-08-30 09:02:39 -03:00
Andrew Isherwood
80e179edd7
Bug 28909: Allow illview to use backend template
This commit allows illview to use an intranet template supplied by the backend, as
per other stages. The template must be named illview.inc

Test plan:
- Apply the patch
- Install FreeForm backend (https://github.com/PTFS-Europe/koha-ill-freeform)
- Create a request
- On the resulting "Manage ILL request" note the display is normal
- Create a new file in the FreeForm backend directory: /intra-includes/illview.inc
  with the following content:

  [% BLOCK backend_jsinclude %]
  <script>(function() { alert("Working!"); })()</script>
  [% END %]

- Restart Plack if enabled
- Reload the page
=> TEST: Observe that the alert specified in the template is displayed

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-08-09 13:21:39 -03:00
e53667105d Bug 29844: Fix ->search occurrences
and some more...

There are lot of inconsistencies in our ->search calls. We could
simplify some of them, but not in this patch. Here we want to prevent
regressions as much as possible and so don't add unecessary changes.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2022-02-09 15:36:23 -10:00
Andrew Isherwood
3fc80c35aa Bug 22614: Migrate original request
This patch changes an active request's backend and initiates the
migration on that request, rather than creating another and migrating
that.

The majority of the work to accomplish this bug is being carried out in
the backends, since Koha delegates migrations to them.

Signed-off-by: Barry Cannon <bc@interleaf.ie>
Signed-off-by: Assumpta Byrne <abyrne@ait.ie>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-09-21 20:22:57 +02:00
9d6d641d1f Bug 17600: Standardize our EXPORT_OK
On bug 17591 we discovered that there was something weird going on with
the way we export and use subroutines/modules.
This patch tries to standardize our EXPORT to use EXPORT_OK only.

That way we will need to explicitely define the subroutine we want to
use from a module.

This patch is a squashed version of:
Bug 17600: After export.pl
Bug 17600: After perlimport
Bug 17600: Manual changes
Bug 17600: Other manual changes after second perlimports run
Bug 17600: Fix tests

And a lot of other manual changes.

export.pl is a dirty script that can be found on bug 17600.

"perlimport" is:
git clone https://github.com/oalders/App-perlimports.git
cd App-perlimports/
cpanm --installdeps .
export PERL5LIB="$PERL5LIB:/kohadevbox/koha/App-perlimports/lib"
find . \( -name "*.pl" -o -name "*.pm" \) -exec perl App-perlimports/script/perlimports --inplace-edit --no-preserve-unused --filename {} \;

The ideas of this patch are to:
* use EXPORT_OK instead of EXPORT
* perltidy the EXPORT_OK list
* remove '&' before the subroutine names
* remove some uneeded use statements
* explicitely import the subroutines we need within the controllers or
modules

Note that the private subroutines (starting with _) should not be
exported (and not used from outside of the module except from tests).

EXPORT vs EXPORT_OK (from
https://www.thegeekstuff.com/2010/06/perl-exporter-examples/)
"""
Export allows to export the functions and variables of modules to user’s namespace using the standard import method. This way, we don’t need to create the objects for the modules to access it’s members.

@EXPORT and @EXPORT_OK are the two main variables used during export operation.

@EXPORT contains list of symbols (subroutines and variables) of the module to be exported into the caller namespace.

@EXPORT_OK does export of symbols on demand basis.
"""

If this patch caused a conflict with a patch you wrote prior to its
push:
* Make sure you are not reintroducing a "use" statement that has been
removed
* "$subroutine" is not exported by the C4::$MODULE module
means that you need to add the subroutine to the @EXPORT_OK list
* Bareword "$subroutine" not allowed while "strict subs"
means that you didn't imported the subroutine from the module:
  - use $MODULE qw( $subroutine list );
You can also use the fully qualified namespace: C4::$MODULE::$subroutine

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-07-16 08:58:47 +02:00
Andrew Isherwood
1a7f09709a Bug 22818: Add generation and sending of notices
This patch adds the ability for ILL to send notices, both triggered by
staff and triggered by events.

Staff can trigger notices to patrons from the "Manage ILL request" screen:
- ILL request ready for pickup
- ILL request unavailable
- Place request with partners

The following notices to staff are triggered automatically:
- Request has been modified by patron
- Request has been cancelled by patron

Branches can now specify an "ILL email" address to which notices
intended to inform staff of changes to requests by patrons can be sent.

The sending of notices is controlled by a few new sysprefs:
- "ILLDefaultStaffEmail" - Fallback email address for staff ILL notices
to be sent to in the absence of a branch address
- "ILLSendStaffNotices" - To specify which staff notices should be sent
automatically when requests are manipulated by patrons

Patron notices are also controlled by the patron's messaging
preferences

Sponsored-by: PTFS Europe
Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@it-tallaght.ie>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-11-11 08:35:10 +01:00
910815a49c
Bug 23173: (follow-up) Small improvements in efficiency
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-04-06 11:05:09 +01:00
Andrew Isherwood
f5edd39e61
Bug 23173: Provide core infrastructure
This patch adds the required infrastructure to enable ILL availability
plugins to intercept the request creation process and, using the
supplied metadata, search for and display possible relevant items from
whichever availability plugins are installed.

Currently three availability plugins exist:

z39.50 - Searches any number of the Koha instance's configured Z targets
https://github.com/PTFS-Europe/koha-plugin-ill-avail-z3950

EDS - Searches the EBSCO Discovery Service
https://github.com/PTFS-Europe/koha-plugin-ill-avail-eds

Unpaywall - Searches the Unpaywall API for possible open access versions
of the requested item
https://github.com/PTFS-Europe/koha-plugin-ill-avail-unpaywall

The Unpaywall plugin is intended to serve as a "reference" plugin as the
API it deals with is extremely simple

Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@tudublin.ie>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-04-06 11:04:19 +01:00
Andrew Isherwood
47895a1a23
Bug 23112: Add circulation to ILL requests
This patch adds the ability to circulate ILL requests. Once a request has a suitable status, a "Check out" button is displayed on the "Manage request" toolbar. Clicking this will enable the user to check out the item either to the user who made the request or an in-house statistical  user. A due date can be specified, but if not circ rules are used.

Prior to the check out, an item is created which is attached to the biblio record that was created when the request was added

This development has been carried out according to the originally stated requirements of the customer that sponsored it, detailed here: https://wiki.koha-community.org/wiki/ILL_Circulation_RFC

Test plan:

1. Ensure the FreeForm ILL backend is available
2. Enable the "CirculateILL" syspref
3. Ensure you have a statistical patron category defined (patron category type "Statistical")
4. Ensure you have at least one patron in your statistical patron category
5. Create a new FreeForm request (make a note of the library you select when creating it)
6. Mark the new request as confirmed by clicking the "Confirm request" button on the "Manage ILL request" page
7. TEST: Observe that a "Check out" button is now displayed in the request toolbar
8. Click the "Check out" button in the "Manage ILL request" page
9. In the "Issue requested item to..." screen:
  a. Do not select a statistical patron at this time
  b. You can at this point choose an item type, this will determine the type of the item that will be created for this request
  c. TEST: Observe that the default selected "Library" matches that that was defined when creating the request
  d. Do not select a due date at this time
10. Click "Submit"
11. TEST: Observe that the "Item checked out" screen displays, issued to the requesting patron with a due date corresponding to appropriate circ rules
12. Click "Return to request"
13. TEST: Observe that the request's status is now "Checked out"
14. Click the "Bibliographic record ID" link
15. TEST: Observe that the bibliographic record now has one item attached to it which is checked out
16. TEST: Observe that the item barcode is "ILL-" + the ILL request ID
17. Return to step 5., however, this time select a statistical patron and test that the item use is recorded and the item is not issued
18. Return to step 5., however, this time manually select a due date and test that the item's due date is set correctly on check out
19. Check in the item
20. TEST: Observe that the request's status is updated to "Returned to library"
21. Now implement a restriction on the patron (perhaps a fine) which would prevent them from checking out an item
22. Return to step 5. follow the instructions to step 10.
23. TEST: Observe that a banner is displayed at the top of the screen informing you that there was a problem checking the item out, containing a link to the patron's account page
24. Resolve the problem with the patron's account
25. Return to step 8.
26. TEST: Observe that the item is now successfully checked out
27. Disable the "CirculateILL" syspref
28. Return to step 5. at step 7. Observe that the "Check out" button is NOT displayed

Sponsored-by: Loughborough University
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-03-10 10:58:58 +00:00
7d8b96803f
Bug 24545: Fix license statements
Bug 9978 should have fixed them all, but some were missing.
We want all the license statements part of Koha to be identical, and
using the GPLv3 statement.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-02-24 13:31:26 +00:00
Andrew Isherwood
4b97a67ae4 Bug 21460: (follow-up) Fix bugs found in QA
Fix silly bugs mentioned in comment #29

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

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2019-04-25 10:46:56 +00:00
Andrew Isherwood
951b857a97 Bug 21460: (follow-up) Filter params in .pl
This patch filters the passed parameters in the .pl, rather than doing
it in the template. As per comment 16
(https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21460#c16)

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

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2019-04-25 10:46:56 +00:00
Andrew Isherwood
daac852c04 Bug 18589: Show ILLs as part of patron profile
This patch moves the display of a patron's ILL requests to be inline in
the Patron Profile page, as per all other patron information.

It includes a substantial refactor of
koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt in that it
moves the display of the illlist table (which is populated by an API
request) into it's own separate include file. It also moves the
datatable related Javascript for this table into it's own JS file. Doing
this allows us to reuse both in both the new members/ill-requests.tt
template and the pre-existing ill/ill-requests.tt template.

To test:
1) Ensure ILL is enabled and your user has sufficient permissions
2) Ensure your user has some ILL requests
3) Navigate to the user's patron profile page
4) Click on the "Interlibrary loans" tab
5) Observe that the requests table is displayed inline
6) Observe that only your user's requests are displayed

Signed-off-by: Niamh.Walker-Headon@it-tallaght.ie

This is essentially a reimplementation of attachment 84796 to take into
account all changes that had happened beneath this bug and also to
ensure JS strings are translatable.

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

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2019-03-22 20:21:46 +00:00
Andrew Isherwood
a8435679d4 Bug 20563: (follow-up) Fix rebasing bug
Fix erroneous curly brackets

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

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2019-03-15 19:33:37 +00:00
Andrew Isherwood
7c14483010 Bug 20581: (follow-up) Passed value to status_alias
Now we have overloaded status_alias, we can no longer pass it undef (as
it uses that to determine if it's being used as a getter or setter). So
we now pass it -1 to indicate it should actually be setting undef (a
hack, I know, but what are you going to do...)

This patch makes sure ill-request.pl conforms to that. It also fixes the
testing of the passed parameter, which was wrong.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2019-02-22 14:31:31 +00:00
Andrew Isherwood
39471ea912 Bug 20581: (follow-up) Do not use PK for AV FK
As per:
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20581#c133

We switch from using authorised_values.id when creating the foreign key
illrequests.status_alias, we now use authorised_values.authorised_value

I have added a migration from using id -> authorised_value, so when
existing users of this bug get this version, their DB migrates nicely
instead of just breaking.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2019-02-22 14:31:31 +00:00
Andrew Isherwood
5e0e8246be Bug 20581: (follow-up) Fix AV population
As per:
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20581#c72

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2019-02-22 14:31:31 +00:00
Andrew Isherwood
85c9b7fb3a Bug 20581: Add display of status_alias to staff vw
- This patch adds display of the new status_alias value, when set, in
favour of the request's status value.
- It also allows the user to set a status_alias for an existing request.
When set, this value will be displayed in preference to the status.

Signed-off-by: Niamh.Walker-Headon@it-tallaght.ie

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2019-02-22 14:31:31 +00:00
85432a1f4c Bug 20640: (follow-up) Make error message translatable
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2019-01-28 13:06:31 +00:00