Commit Graph

29 Commits

Author SHA1 Message Date
Tomas Cohen Arazi 1873d97c07
Bug 40163: Fix several http addresses in the code docs
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-09-23 16:21:29 -06:00
Lucas Gass da3d4b72dd
Bug 39620: Fallback to GetMarcPrice if nessesary
To test:
1. Have a MRC file with price populated in the 020$c
2. Have nothing the MarcFieldsToOrder or  MarcItemFieldsToOrder sys prefs
3. Create a new basket and import from a new file
4. The price is not imported.
5. APPLY PATCH and restart_all
6. Try again, this time the price should be populated correctly.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-05-15 08:34:03 +02:00
Matt Blenkinsop 37538b22a0
Bug 39752: Check for biblio existence when matches are found
Currently when adding to a basket from a new/staged file, we don't check whether a matched record still exists when importing. This patch changes the conditional check to be based on the existence of the biblio record rather than just on the biblionumber from the match

Test plan:
1) Stage and import a record into Koha
2) Stage the same record again, this time matching on ISBN
3) Check that the match has been found in the batch details
4) Delete the original record that you imported in step 1
5) Find a basket, and add to it from a staged file
6) Choose the file/record you imported in stage 2
7) Select the record and save to add the orders
8) You will get a 500 error
9) Apply patch and restart_all
10) Refresh the page to re-submit the form
11) The form should submit correctly

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-04-29 17:19:31 +02:00
Matt Blenkinsop e9ef1a0c85
Bug 39518: Update object methods and unit tests
Test plan:
Test plan:

This test plan involves running a cronjob, not sure how easy this is in the sandboxes

1) In system preferences, click Search and then select the Acquisitions option from the left hand menu
2) Enable MarcOrderingAutomation
3) Paste the following into MarcFieldsToOrder
price: 975$p
quantity: 975$q
budget_code: 975$h
4) Paste the following into MarcItemFieldsToOrder
homebranch: 949$a
holdingbranch: 949$b
itype: 949$y
nonpublic_note: 949$x
public_note: 949$z
loc: 949$c
ccode: 949$8
notforloan: 949$7
uri: 949$u
copyno: 949$t
price: 949$g
replacementprice: 949$v
itemcallnumber: 949$o
quantity: 949$k
budget_code: 949$l
Now save the sysprefs
5) In the administration homepage, under Acquisition parameters there should now be a link called "MARC order accounts"
6) Click on this and click the New account button
7) Choose a vendor and a budget
8) Enter a description and make sure you don't set a value in the 'Basket name field' input
9) Enter the following in download directory - "/var/lib/koha/kohadev/tmp/koha_kohadev_upload"
10) Select any record matching settings you want (not important for the test plan, this uses the same code as the marc file staging that already exists in Koha)
11) Check Yes under Check for embedded item record data
12) Click submit
13) We now need to upload a MARC file into the directory that we put in the account. The easiest way to do this is through the marc staging tool
14) Navigate to Cataloging > Stage MARC records for import
15) Upload the file attached to this bug using the Choose file button
16) Click Upload file.
17) Leave the page without completing the new form that appears, we don't want to stage this file. The file we uploaded is now in the directory ready for the cronjob to process as if it had been transferred via SFTP.
18) In the CLI run, perl misc/cronjobs/marc_ordering_process.pl -v -c
19) The logging should show that the file has been processed for that account
20) Navigate to Acquisitions
21) Search for the Vendor that you put in the MARC ordering account
22) There should now be a basket titled: '{random_hash}_orderstest.marcxml'
23) In the ordering account, set the 'Basket name field' to be 975$a
24) Repeat steps 14 -22, the basket should now be called "This is the basket name" which has been pulled from the file

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Thomas Klausner <domm@plix.at>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-04-25 08:46:50 +02:00
Matt Blenkinsop 2186bf7fa8
Bug 39530: Make MARC order cronjob dependent on AcqCreateitems
Test plan:
1) View the patch diff and confirm that the hardcoded value of 'ordering' has been replaced with undef
2) In C4/Acquisition.pm, look at the method description for ModBasketHeader and observe the descritpion for 'create_items'
3) Note that if the value is set to undef as per step 1, the AcqCreateItem syspref takes precedence

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-04-25 08:46:45 +02:00
Nick Clemens 3f6d482410
Bug 39282: Use generated MARC record to create item and return itemnumber
When creating items from the form we need to use the MARC record we build from the HTML->XML->MARC

This patch simply uses the variable we create and ensures we pass the itemnumbers back

To test:
1 - prove -v t/db_dependent/Koha/MarcOrders.t
2 - Still failing
3 - Apply this patch
4 - Success!

Phew! We did it.

Signed-off-by: John Vinke <jvinke@austinseminary.edu>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-03-17 08:21:21 +01:00
Nick Clemens fd609d9bb3
Bug 39282: Clarify use of budget codes and ids
When getting items from the form on addorderiso2709.pl we are getting actual budget id's,
we only deal with codes when fetching the values from the MARC.
The code here assigns an id into a variable called code - this patch clarifies that and
ensures that we fallback to using the id if one has been passed from the interface form

To test:
0 - Apply first two patches
1 - prove -v t/db_dependent/Koha/MarcOrders.t
2 - It fails
3 - Apply this patch
4 - It fails?

Signed-off-by: John Vinke <jvinke@austinseminary.edu>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-03-17 08:21:20 +01:00
Nick Clemens 5034c27628
Bug 39282: Ensure items are created using Item Information values if not using MarcItemFieldsToOrder
When using MarcFieldsToOrder and not MarcItemFieldsToOrder it is expected that all of the item
information will come from the second tab 'Item information' on addorderiso2709.pl

Currently we are not and blank items are beign created

To test:
 1 - Apply unit tests
 2 - prove -v t/db_dependent/Koha/MarcOrder.t
 3 - It fails
 4 - Set MarcItemFields to Order:
     price: 949$p
     quantity: 947$c
     budget_code: 947$f
 5 - Ensure MarcItemFieldsToOrder is blank
 6 - Find a basket in acquisitions
 7 - Add to basket from a file
 8 - Fill item information, set 'Matching' at top of form to 'Do not look for matchign records' and save
 9 - Orders are added
10 - Click on a title
11 - Items do not load and an error is generated, this is because items don't have any values
12 - Check the DB:
     SELECT * FROM items WHERE homebranch IS NULL\G
13 - Note items from order are listed
14 - Apply the rest of the patches
15 - Repeat 6-10
16 - This time the items load successfully

NOTE: This patch alone doesn't address all errors, but subsequent will, keeping separate to address
each issue individually, but test plan can be executed as a whole against all

Signed-off-by: John Vinke <jvinke@austinseminary.edu>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-03-17 08:21:20 +01:00
Tomas Cohen Arazi f50978c256
Bug 38726: (follow-up) Some more {Mm}arc ordering cases
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-12-23 12:20:36 +01:00
Matt Blenkinsop 7cf80c0b6d
Bug 38326: (QA follow-up) Tidy
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-19 16:35:13 +01:00
Lucas Gass 9d3d165207
Bug 38326: Don't convert to copynumber
To test:
1. Set copynumber in MarcItemFieldsToOrder: copyno: 965$z
2. Have a mrc file that includes this marc field
3. Stage a mrc file for import
4. Notice the copynumber isn't correctly copied over
5. APPLY PATCH, restart_all
6. Try again, this time it should work.

Signed-off-by: Sam Sowanick <sam.sowanick@corvallisoregon.gov>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-19 16:35:12 +01:00
Nick Clemens d8c02117a3
Bug 34355: (QA follow-up) Tidy
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-11 17:43:21 +01:00
Matt Blenkinsop 3ee7c3ccbf
Bug 34355: (QA follow-up) Respect AcqCreateItem syspref
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-11 17:43:19 +01:00
Matt Blenkinsop 3bec59e965
Bug 34355: (QA follow-up) Restore MarcFieldsToOrder prices and budgets
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-11 17:43:19 +01:00
Matt Blenkinsop af22e7fad7
Bug 34355: (QA follow-up) Make record staging code DRY
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-11 17:43:18 +01:00
Matt Blenkinsop 739300fde7
Bug 34355: (QA follow-up) Fix template errors
This patch addresses the following issues:
- Fixes a duplication of the SerialsDefaultReplyTo syspref
- Re-introduces include files for overlay rules

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-11 17:43:17 +01:00
Matt Blenkinsop d3da352b9f
Bug 34355: Add a plugin hook - before_orderline_create
Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-11 17:43:14 +01:00
Matt Blenkinsop 6b85d06c19
Bug 34355: Add match_field and match_value to allow multiple accounts in the same file directory
Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-11 17:43:14 +01:00
Matt Blenkinsop e616b9b56c
Bug 34355: Fix form rendering issue
This patch also fixes the referencing of import_record_id_selected

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-11 17:43:13 +01:00
Matt Blenkinsop 42ab7761f4
Bug 34355: Add cronjob and required methods
This patch adds a cronjob to take a marc file from the Koha file directory system and import it before creating order lines

Test plan:

This test plan involves running a cronjob, not sure how easy this is in the sandboxes

1) In system preferences, click Search and then select the Acquisitions option from the left hand menu
2) Enable MarcOrderingAutomation
3) Paste the following into MarcFieldsToOrder
price: 975$p
quantity: 975$q
budget_code: 975$h
4) Paste the following into MarcItemFieldsToOrder
homebranch: 949$a
holdingbranch: 949$b
itype: 949$y
nonpublic_note: 949$x
public_note: 949$z
loc: 949$c
ccode: 949$8
notforloan: 949$7
uri: 949$u
copyno: 949$t
price: 949$g
replacementprice: 949$v
itemcallnumber: 949$o
quantity: 949$k
budget_code: 949$l
Now save the sysprefs
5) In the administration homepage, under Acquisition parameters there should now be a link called "MARC order accounts"
6) Click on this and click the New account button
7) Choose a vendor and a budget
8) Enter a description
9) Enter the following in download directory - "/var/lib/koha/kohadev/tmp/koha_kohadev_upload"
10) Select any record matching settings you want (not important for the test plan, this uses the same code as the marc file staging that already exists in Koha)
11) Check Yes under Check for embedded item record data
12) Click submit
13) We now need to upload a MARC file into the directory that we put in the account. The easiest way to do this is through the marc staging tool
14) Navigate to Cataloging > Stage MARC records for import
15) Upload the file attached to this bug using the Choose file button
16) Click Upload file.
17) Leave the page without completing the new form that appears, we don't want to stage this file. The file we uploaded is now in the directory ready for the cronjob to process as if it had been transferred via SFTP.
18) In the CLI run, perl misc/cronjobs/marc_ordering_process.pl -v -c
19) The logging should show that the file has been processed for that account
20) Navigate to Acquisitions
21) Search for the Vendor that you put in the MARC ordering account
22) There should be a basket created on the vendor with the name of the file you uploaded (there will also be a reference at the start e.g. ea2323966faef2c59a6056dbd1f7d658_filename.marcxml. This is because we used the marc staging tool to upload the file and that adds a reference to filenames. This will not appear when using files from an SFTP location).
23) Click in the basket
24) There should be three orderlines, complete with accounting details that have been mapped from the file.
One line should have a fund of Fund 1_2, quantity of 4 and a replacement price of 6.75, one should have Secondary fund, 2, 6.40 and one should have Main fund,2, 6.30

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-11 17:43:12 +01:00
Matt Blenkinsop 91095d93ef
Bug 35026: (QA follow-up): Fix QA tests
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-19 18:59:48 +02:00
Matt Blenkinsop 16d4ccd87a
Bug 35026: (QA follow-up): Restore order grouping
This patch restores the grouping of orderlines by fund rather than one line per item. It also re-enables the reading of the barcoe, enumchron and coded_location_qualifier fields as well as passing the sort1 and sort2 values to the orderline.

It also reintroduces some missed functionality for when MarcItemFieldsToOrder is not passed through and can now create order lines and records for an imported file when this is the case

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-19 18:59:48 +02:00
Matt Blenkinsop f8936a124e
Bug 35026: Refactor syspref mapping
This patch refactors the way we read MarcFieldsToOrder and MarcItemFieldsToOrder to only use one method

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-19 18:59:47 +02:00
Matt Blenkinsop a91206b893
Bug 35026: Fix unit tests
This patch fixes the unit tests that were failing and also removes some tests that should not be introduced until bug 34355

Test plan:
prove t/db_dependent/Koha/MarcOrder.t

Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-19 18:59:47 +02:00
Matt Blenkinsop 216dbeeb75
Bug 35026: Adjust price field to match UI
Following bug 36036 the price field has been renamed in the UI- this patch removes the logic that was renaming that field in the backend to match this

Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-19 18:59:46 +02:00
Matt Blenkinsop 505d259cce
Bug 35026: Allow multiple records from one marc file
This patch addresses a bug where only one record would be read from a marc file and other records would be lost. All records are now read from the file and displayed in the UI.

Test plan as above

Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-19 18:59:46 +02:00
Matt Blenkinsop 7608566440
Bug 35026: Make add_items_from_import_record DRY
This patch improves the code in add_items_from_import_record to make sure that the code is not repeating itself

It also fixes a minor error in the template file and rebases in changes from bugs 35254 and 33170

Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-19 18:59:44 +02:00
Matt Blenkinsop e5c44980ee
Bug 35026: Refactor addorderiso2709.pl to use the MarcOrder class
This script uses the newly created MarcOrder class to refactor the script into a cleaner controller function. This MarcOrder class will also be used in bug 34355 to automate the creation of order lines from marc records.

Test plan:
1) In system preferences, click Search and then select the Acquisitions option from the left hand menu
2) Paste the following into MarcFieldsToOrder
price: 975$p
quantity: 975$q
budget_code: 975$h
3) Paste the following into MarcItemFieldsToOrder
homebranch: 949$a
holdingbranch: 949$b
itype: 949$y
nonpublic_note: 949$x
public_note: 949$z
loc: 949$c
ccode: 949$8
notforloan: 949$7
uri: 949$u
copyno: 949$t
price: 949$g
replacementprice: 949$v
itemcallnumber: 949$o
quantity: 949$k
budget_code: 949$l
Now save the sysprefs
4) Navigate to acquisitions and go into a basket
5) Click Add to basket and select “From a new file”
6) Download the file attached to this bug
7) Import the file and when the job is complete click “Add staged files to basket”
8) Click the checkbox next to the record to display the items and confirm that the data matches the mappings from the file that you imported - there should be 8 items, grouped in 4 pairs of identical items
9) Fill in the required fields and click “Save”
10) That basket should be correctly populated with an order matching the file that you imported

Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-19 18:59:43 +02:00
Matt Blenkinsop 1606d8562a
Bug 35026: Add a MarcOrder object class
This patch adds a MarcOrder object class. This will primarily be used for the functionality in bug 34355 to automate order creation from a Marc file. The automation functionality is similar in principle to the functionality in the addorderis02709.pl script so it makes sense to refactor this script to use the same code.

Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-19 18:59:43 +02:00