Commit graph

6841 commits

Author SHA1 Message Date
53e719a001
Bug 31631: Unit tests
Test plan:
Run amended Budgets.t test and all existing unchanged Acquisition tests in koha-shell
- sudo koha-shell <instance>
- prove t/db_dependent/Budgets.t
- prove t/db_dependent/Acquisition
- prove t/db_dependent/Acquisition.t
- prove t/db_dependent/Budgets

Sponsored-by: Waikato Institute of Technology, New Zealand

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Bug 31631: (follow-up) Fixes for failing unit test t/db_dependent/Budgets.t

Test plan:
1. Set CalculateFundValuesIncludingTax = 'Include'

2. Run Budgets.t unit test
sudo koha-shell kohadev
prove t/db_dependent/Budgets.t

3. Set CalculateFundValuesIncludingTax = 'Exclude'

4. Run Budgets.t unit test
sudo koha-shell kohadev
prove t/db_dependent/Budgets.t

Sponsored-By: Waikato Institute of Technology, New Zealand

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-18 15:41:36 -03:00
f08fc01867
Bug 35042: Remove set datelastseen to null on table in Members.t
Non-trivial was adding the category_type <> S.

Test plan:
Run t/db_dependent/Members.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-18 10:25:57 -03:00
531bbbcaa5
Bug 35041: Fix Patron.t for a filter_by_last_update test
Since filter with from now tests stricter, we should be a bit
more accurate with setting our test datetime.

Test plan:
Run t/db_dependent/Koha/Patron.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-18 10:25:51 -03:00
Julian Maurice
1a2288052d
Bug 27249: Replace DateTime->now by dt_from_string
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-17 14:45:34 -03:00
Julian Maurice
2b58f4d89c
Bug 27249: Prevent infinite loop when searching for an open day
Calendars can be configured in a way that all days are closed.
The simplest way to do that is to configure a repeatable holiday for
every day of the week.
With such calendars, searching for an open day will literally take
forever.

This patch sets a hard limit on how many iterations are allowed before
giving up. This limit is set to the arbitrary value of 5000, which
should be large enough to be able to consider there is no open days if
we haven't found any with that many iterations, and small enough to
allow the loop to end quickly

Test plan:
1. Set system preference 'useDaysMode' to 'Use the calendar to push the
   due date to the next open day' ('Datedue'). Make sure the existing
   circulation rules do not conflict with that setting.
2. Browse to Tools » Calendar
3. Set every day of the week to "Holiday repeated every same day of the
   week"
4. Issue an item to a patron
5. Check the box and select 'Renew selected items'
6. The renewal should fail pretty quickly

Signed-off-by: Sam Lau <samalau@gmail.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-17 14:45:31 -03:00
56419590cb
Bug 30719: Rename batch for ill_batch in Koha::Illrequest
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-17 14:45:25 -03:00
e6de47e9ec
Bug 30719: Remove unused Koha::Illbatch->requests_count method
This patch removes this stray method from the original implementation.

To test:
1. Apply this patch
2. Run:
   $ git grep requests_count
=> SUCCESS: Notice the only ILL-related mantions are API related, which
is returned by using the 'requests+count' embed, which is unrelated to
this particular method
3. Run:
   $ prove t/db_dependent/api/v1/ill_batches.t \
     t/db_dependent/Illbatches.t
=> SUCCESS: Tests pass!
4. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-17 14:45:24 -03:00
e21c19e170
Bug 30719: (QA follow-up) Updating remaining naming
Update statuscode -> status_code on the js files
Update remaining batch_id -> ill_batch_id
Update batch object in Illrequest.pm strings_map

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-17 14:45:23 -03:00
a71140fe60
Bug 30719: (QA follow-up) Pick better column names and cleanup
This patch takes on normalizing the attribute names, embeds, and also
makes the whole API more kosher, in terms of using accessors for related
objects, using the standard structure for strings_map, etc.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-17 14:45:23 -03:00
2102e948a8
Bug 30719: (QA follow-up) Rename illbatchstatuses
illbatchstatuses endpoint is now ill/batchstatuses

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-17 14:45:22 -03:00
833a808cdf
Bug 30719: (QA follow-up) Rewrite remaining ill batches endpoints
get, add and update rewrite

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-17 14:45:21 -03:00
3801c65bee
Bug 30719: (QA follow-up) Rewrite Illbatches list endpoint
Update accessors
Add +strings embed
Add x-koha-embed to batches list andpoint
Add embed to API call from the front-end
Update table to get data from _strings
Add x-koha-embed to tests
Add strings_map to Illbatch
Add to_api_mapping to Illbatch

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-17 14:45:21 -03:00
edb048de78
Bug 30719: (QA follow-up) Rename illbatches endpoint to ill/batches
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-17 14:45:20 -03:00
fc83fb3ebb
Bug 30719: (QA follow-up) Squash:
This is a squash of 25 QA patches located at:
    https://github.com/PTFS-Europe/koha/commits/new_30719

Bug 30719: (QA follow-up) Batch column should be hidden by default
Bug 30719: (QA follow-up) Fix wrong tt filter type
Bug 30719: (QA follow-up) Make atomicupdate idempotent
Bug 30719: (QA follow-up) Use COMMENT syntax in database files
Bug 30719: (QA follow-up) Fix tiny boolean is_system
Bug 30719: (QA follow-up) Add missing CONSTRAINT entries from kohastructure.sql to the atomicupdate file
Bug 30719: (QA follow-up) Add missing koha_object_class and
koha_objects_class methods
Bug 30719: (QA follow-up) Swap search to find
Bug 30719: (QA follow-up) Fix tests
Bug 30719: (QA follow-up) API terminology - id -> batch_id
Bug 30719: (QA follow-up) API terminology - borrowernumber -> patron_id
Bug 30719: (QA follow-up) API terminology - branchcode -> library_id
Bug 30719: (QA follow-up) Make mandatory illbatch_statuses translatable
Bug 30719: (QA follow-up) Improve translatability
Bug 30719: (QA follow-up) Fix capitalization of Interlibrary Loan
Bug 30719: (QA follow-up) Change Branch to Library in ILL batches table
Bug 30719: (QA follow-up) Add template WRAPPER to batch statuses breadrcrumbs
Bug 30719: (QA follow-up) Utilize patron_to_html function to display patron info in batches table
Bug 30719: (QA follow-up) Add mandatory batch statuses to the atomicupdate
Bug 30719: (QA follow-up) Add page-section to the batch statuses list page
Bug 30719: (QA follow-up) Style Save button on batch status edit page
Bug 30719: (QA follow-up) Add question mark to label string, rephrase new ILL batch button
Bug 30719: (QA follow-up) Add noExport class to action columns in batch list table and batch modal table
Bug 30719: (QA follow-up) Add page-section and headers to ILL batch table
Bug 30719: (QA follow-up) Perltidy

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-17 14:45:18 -03:00
4a694c4fb5
Bug 30719: Tests
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:16 -03:00
1cabc0ed67
Bug 26314: (QA follow-up) Improve POD and fix links for UseControlNumber off
When UseControlNumber is off, we previously did a search on the title index,
but this was not actually correct. It might work when we have a dependent
title and the title also appears on 245$p, but there is a better way:

The title of the set record will be found in:
* 773$3 for a dependent title
* 800/810/811/830 for an independent title

The search indices to use are host-item and title-series.

As we are not only looking for 773, POD was adjusted to reflect that.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-17 14:45:14 -03:00
f14f56a8f4
Bug 26314: Update for changes to bug 11175 methodology
This moves the show_volumes calculation back out of C4::XSLT into the
controller scripts and refined the search query builder slightly based
on the XSLT equivilent.

Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-17 14:45:13 -03:00
cd0a374b93
Bug 26314: Only display volumes link when required
This patch makes C4::XSLT query for volumes the same way it would do
with the generated link (i.e. based on UseControlNumber) and passes
a flag to the XSLT so it displays (or not) the 'Show volumes' link.

To test:
1. Apply the first patch
2. Have a known record without volumes
3. Open the record in the OPAC
=> FAIL: It shows the 'Show volumes' link
4. Have a record known to have volumes
5. Open the record in the OPAC
=> SUCCESS: It shows the 'Show volumes' link
6. Apply this patch and restart_all
7. Reload the above records
=> SUCCESS: It shows the link where it has to, and hides it where it
   shouldn't be displayed.
8. Repeat for Intranet
9. Sign off :-D

Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-17 14:45:11 -03:00
d4da5419dc
Bug 16223: Tidy
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-11 12:13:12 -03:00
cba9824e6d
Bug 16223: (QA follow-up) Remove GetDebarments
We remove the GetDebarments routine in 31095.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-11 12:13:07 -03:00
Emmi Takkinen
335f68eb51
Bug 16223: Add ability to define liftable restrictions
Some libraries debar Patrons at the end of the year for having unpaid fines,
like in Bug 15157. Currently librarians have to manually remove this type of
debarments after Patron has paid his/her fines.

This patch adds ability to create restrictions which are lifted after
patron pays ceratain amount of fines.

To test:
1. Apply this patch.
2. Restart your services if needed.
3. Navigate to page restrictions.pl.
=> Note that table has two new colums in it, "Lift after payment?" and "Fee limit".
4. Add new restriction which has "Lift after payment?" set
as Yes and fee limit as 5.
5. Create fees for a patron so they exceed fee limit e.g. 10
6. Add restriction made in step 2. for the patron
7. Pay patrons fees partially so that they go under fee limit
=> Note that patrons restriction should now be lifted.

Also prove t/db_dependent/Patron/Borrower_Debarments.t.

Sponsored-by: Koha-Suomi Oy
Signed-off-by: Anneli Österman <anneli.osterman@koha-suomi.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-11 12:13:06 -03:00
9e4b0c4c72
Bug 33837: Remove datetime parameter
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] Perltidied one line in cleanup_database.pl.

Bug 33837: Perl tidy block in Objects.t

WARN   t/db_dependent/Koha/Objects.t
   WARN   tidiness
                The file is less tidy than before (bad/messy lines before: 319, now: 320)

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-11 10:31:45 -03:00
ef0868a21b
Bug 33837: Replace days_inclusive by min_days
Instead of passing days and days_inclusive, this patch adds
min_days as replacement. Since days_inclusive is not widely
used, this can be done easily. It removes the confusion
whether days_inclusive impacted other parameters or not.

Test plan:
Run t/db_dependent/Koha/Objects.t
Run t/db_dependent/Koha/Old/Checkouts.t
Run t/db_dependent/Koha/Patrons.t (verifying the change in the
Koha::Patrons module for filtering by expiration date).

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-11 10:31:44 -03:00
587bcae366
Bug 33837: filter_by_last_update: Add older_than and younger_than
Test plan:
Run t/db_dependent/Koha/Objects.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-11 10:31:43 -03:00
d3e286b204
Bug 33837: Add unit test
Test plan:
Run t/db_dependent/Koha/Objects.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-11 10:31:43 -03:00
fe21bbad2a
Bug 28130: (QA follow-up) Tidy
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-11 10:31:39 -03:00
Aleisha Amohia
84e5c570db
Bug 28130: Manage a patron's subscription alerts
This enhancement adds an 'Alert subscriptions' page to a patron account to easily view or cancel email alerts the patron has subscribed to.

To test:

1. Go to Cataloging. Create a biblio.
2. Go to Tools -> Notices & slips. Create a notice under the "Serials (new issue)" module, if you don't already have one.
3. Go to Serials. Create a subscription. Link the biblio you just created. Add info like the callnumber, location, library. Choose your notice under Patron notification. Fill out the remaining details and save your subscription.
4. Open this record in the OPAC. Under the Subscriptions tab, click the button to "Subscribe to email notification on new issues"
5. Go back to the staff interface. Go to your patron account.
6. Notice there is a new "Alert subscriptions" tab in the left sidebar menu. The number in brackets should say 1, for the subscription you just enabled email alerts.
7. Click into the page. Confirm your subscription shows in the table.
8. Click the button to unsubscribe. A confirmation should pop up. Confirm you can cancel the unsubscribe action. Then confirm you can unsubscribe using this button.
9. Confirm tests pass t/db_dependent/Koha/Patron.t

Sponsored-by: Bibliotheksservice-Zentrum Baden-Wuerttemberg
Signed-off-by: Christian Stelzenmüller <christian.stelzenmueller@bsz-bw.de>
Signed-off-by: Sam Lau <samalau@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-11 10:31:37 -03:00
538e55afef
Bug 29033: Add C4::Context->multivalue_preference
I've seen several places in which a syspref is retrieved and then
splitted using split and the fact they are pipe-separated strings.

It seems it would be simple (and handy) to add a method to do that.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/Context.t
=> SUCCESS: Tests pass, a pipe-separated syspref is correctly retrieved
as an arrayref.
3. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-10 10:53:59 -03:00
9705aaec77
Bug 25560: Unit tests
Test plan:
1. Run tests
sudo koha-shell <instancename>
prove t/db_dependent/Circulation/issue.t

Sponsored-By: Waikato Institute of Technology, NZ

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-10 10:53:58 -03:00
a45e79c1f4
Bug 31692: Tidy and rebase fix
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-10 09:58:59 -03:00
Lari Taskula
889853bc9d
Bug 31692: (follow-up) Adjust reserves.item_level_hold
Original patch missed handling reserves.item_level_hold column.

To test:
1. prove t/db_dependent/Koha/Hold.t

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-10 09:58:58 -03:00
Lari Taskula
26afea24f8
Bug 31692: Add Koha::Hold::change_type and unit tests
To test:
1. prove t/db_dependent/Koha/Hold.t

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

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-10 09:58:57 -03:00
b703d97816
Bug 26053: Add unit test for Koha::Patron::Restriction
Run:
prove t/db_dependent/Koha/Patron/Restriction.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-10 09:58:56 -03:00
9dc1852d8f
Bug 12532: (follow-up) Catch more cases in tests
This patch added lots more cases to the unit tests to try and catch all
the new functionality.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-10 09:58:54 -03:00
b9325a9177
Bug 12532: Fix test
The mock was working. The problem was that the to_address of the notice
was set from the previous send.

A fix would be to update the message, but it seems better to simply
re-enqueue it.

This patch also use Koha::Notice::Messages.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-10 09:58:53 -03:00
91a5d20e24
Bug 12532: (QA follow-up) Add tests for SendQueuedMessages
This patch adds unit tests for the changes made to
_send_message_by_email for Guarantor CC

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-10 09:58:50 -03:00
5c5c335e6b
Bug 12532: (QA follow-up) Remove defunkt test
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-10 09:58:49 -03:00
0a35ec19e1
Bug 12532: (QA follow-up) More cleanup
Minor QA cleanup, perltidy, remove Data::Dumper and clarify warn

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-10 09:58:49 -03:00
Hammat Wele
dc629ea7b5
Bug 12532: Send email to guarantee and guarantor
This patch allows guarantors to receive emails sended to their
guarentees. This patch is a rebase of the previous patches.
I took all the content of previous commit and put it in one commit.

TO TEST:

Before applying:
1) Search, or create, a patron with guarantor.
2) For both guarantors and guarantees:
   - Add an email address
   - Update the 'Patron messaging preferences' section so that an email is sent for item checkouts
3) Checkout an item. An email should be sent only to the guarantee.
4) Apply the patch.
5) Run updatedatabase.pl
6) Run prove t/db_dependent/Members.t and prove t/db_dependent/Letters.t
7) Enable 'RedirectGuaranteeEmail'
8) Run misc/cronjobs/process_message_queue.pl
9) Notice that the email should be sended to both the guarantee AND the
guarantor.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-10 09:58:46 -03:00
b4f928003e
Bug 34883: Add unit test
prove -v t/db_dependent/Koha/Patrons/Import.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-10 09:22:34 -03:00
5ee20cba58
Bug 34828: Make normalized_oclc use Koha::Biblio::Metadata::Extractor
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-09 16:41:32 -03:00
d5d2f319df
Bug 34828: Add Koha::Biblio::Metadata::Extractor::MARC
and inherit from it

The new usage is now:

1. With a Koha::Biblio object
my $extractor = Koha::Biblio::Metadata::Extractor->new({biblio => $biblio});
$extractor->get_normalized_upc;

or

2. With a MARC::Record
my $extractor = Koha::Biblio::Metadata::Extractor->new({metadata=> $biblio->metadata->record});
$extractor->get_normalized_upc;

Note that there are "Inconsistent hierarchy during C3 merge of class"
warnings raised by the QA script. We could remove them by replacing the
'use' by 'require' in Koha::Biblio::Metadata::Extractor::MARC (in ->new)
but that's suboptimal.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-09 16:41:31 -03:00
7efeeda29d
Bug 34828: Move to Koha::Biblio::Metadata::Extractor
We are not directly linked with the other Koha::Metadata* packages.
Better to isolate this under Koha::Biblio::Metadata (at least for now).

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-09 16:41:30 -03:00
0161eeba13
Bug 34828: Introduce Koha::MetadataExtractor and ->get_normalized_upc
This patch introduces a new pattern for the different ->get_<thing>
methods we've been adding. The aim is that code will look more like:

my $metadata_extractor = Koha::MetadataExtractor->new;

while ( my $biblio = $biblios->next ) {
    my $record = $biblio->record;
    my $schema = $biblio->record_schema;

    $data->{$biblio->id}->{normalized_upc} =
$metadata_extractor->get_normalized_upc( { record => $record, schema =>
$schema } );
    $data->{$biblio->id}->{normalized_ean} =
$metadata_extractor->get_normalized_ean( { record => $record, schema =>
$schema } );
}

The key is that we are actually reusing the MARC::Record, and code for
each schema is organized cleanly so easier to maintain.

For the class names, I chose to add the 'MARC' name in the path, so we
don't need to refactor anything if we want to add support for another
serialization formats.

To test:
1. Apply this patch
2. Run:
   $ ktd --shell
  k$ qa -c 1
=> SUCCESS: Tests pass!
3. Sign off :-D

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-09 16:41:30 -03:00
d163bf0b86
Bug 34336: Remove the dependency for Test::DBIx::Class
The module is removed from t.
We only have 01-test_dbic.t and we do not need it any longer.

Test plan:
git grep for Test::DBIx::Class. You should only see release notes.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-09 11:41:40 -03:00
3e1d32f9ca
Bug 34549: Strip non-XML chars during TransformHtmlToMarc
This patch strips non-XML characters from inputs during
TransformHtmlToMarc.

To test:
0. Apply patch
1. koha-plack --restart kohadev
2. Go to http://localhost:8081/cgi-bin/koha/cataloguing/addbiblio.pl
3. Fill out record and use the text from "Text file containing control characters"
as the title
4. Click Save
5. Note that your record displays without any warnings like the following:
Error: invalid data, cannot decode metadata object
parser error : PCDATA invalid Char value 27

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] Squashed the tidy patch. Still needed a few spaces to satisfy qa tools.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-09 11:41:32 -03:00
643e38e835
Bug 34153: (QA follow-up) Tidy code
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Rebased-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-04 16:40:19 -04:00
7bb4d94930
Bug 34153: Add tests
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-04 16:40:17 -04:00
Aleisha Amohia
be375ed01c
Bug 34722: Prevent other items from displaying to fill item-level recalls
This patch prevents other items attached to a record from being displayed as 'recalled' by item-level recalls.

To test:
1. Ensure UseRecalls system preference is enabled and circulation rules relevant to recalls are configured. Set 'on shelf recalls allowed' circulation rule 'if any unavailable' for ease of testing.
2. Search for a record that has multiple items, or create one with multiple items. Check out two of the items (Item A and Item B) to a patron, Patron A.
3. Log into the OPAC as another patron, Patron B. Search for the record and place a recall. Choose to recall a specific item and select Item A.
4. Go back to the staff interface and view the catalogue detail page for the record. Notice that every item has a 'recalled by...' message, even though Item A was specifically recalled.
5. Log into the OPAC as another patron, Patron C. Search for the record and place a recall. Choose to recall a specific item, notice every item has a 'recalled by...' message. Select Item B and Confirm.
6. In your terminal, the 'Other items are not returned for item-level recalls' test should fail when running
prove t/db_dependent/Koha/Item.t

7. Apply the patch and restart services

8. Confirm tests at t/db_dependent/Koha/Item.t now pass
9. Refresh the staff interface, confirm only Items A and B have the recalled message and the recall patron information for each item is accurate
10. Log into the OPAC as another patron, Patron D. Search for the record and place a recall. Choose to recall a specific item. Confirm only Items A and B have the recalled message.

Sponsored-by: Toi Ohomai Institute of Technology
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Perltidied new code.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-04 16:40:17 -04:00
151298709a
Bug 9525: (QA follow-up) Tidy
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-04 16:40:12 -04:00