Bug 34355 - Automated MARC record ordering process
Summary: Automated MARC record ordering process
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: Main
Hardware: All All
: P5 - low new feature
Assignee: Matt Blenkinsop
QA Contact: Nick Clemens (kidclamp)
URL:
Keywords:
Depends on: 33170 35026
Blocks:
  Show dependency treegraph
 
Reported: 2023-07-24 13:48 UTC by Matt Blenkinsop
Modified: 2024-11-14 09:03 UTC (History)
15 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
A parallel to EDI Ordering for MARC-file based ordering systems. **Sponsored by** *ByWater Solutions*
Version(s) released in:
24.11.00
Circulation function:


Attachments
Bug 34355: DB schema and atomic update file (13.01 KB, patch)
2023-08-23 08:34 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: Update menus (4.05 KB, patch)
2023-08-23 08:34 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: Add account creation (22.28 KB, patch)
2023-08-23 08:34 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: Add cronjob, MarcOrder object and refactored addorderiso2709 script (51.98 KB, patch)
2023-08-23 08:34 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: Make item addition dependent on MarcItemFieldsToOrder mappings and introduce MarcFieldsToOrder to cronjob (11.59 KB, patch)
2023-08-23 08:34 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: Fix form rendering issue (16.22 KB, patch)
2023-08-23 08:34 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: DB schema and atomic update file (13.01 KB, patch)
2023-10-13 13:51 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: Update menus (4.04 KB, patch)
2023-10-13 13:51 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: Add account creation (22.28 KB, patch)
2023-10-13 13:51 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: Add cronjob, MarcOrder object and refactored addorderiso2709 script (42.78 KB, patch)
2023-10-13 13:51 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: Make item addition dependent on MarcItemFieldsToOrder mappings and introduce MarcFieldsToOrder to cronjob (10.86 KB, patch)
2023-10-13 13:51 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: Fix form rendering issue (16.22 KB, patch)
2023-10-13 13:51 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: Add match_field and match_value to allow multiple accounts in the same file directory (11.09 KB, patch)
2023-10-13 13:51 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: Add a plugin hook - before_orderline_create (1.17 KB, patch)
2023-10-13 13:51 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: Rebase changes made in bug 33170 (10.49 KB, patch)
2023-10-13 13:51 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: DB schema and atomic update file (13.01 KB, patch)
2024-01-11 14:52 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: Update menus (4.20 KB, patch)
2024-01-11 14:52 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: Add account creation (22.28 KB, patch)
2024-01-11 14:52 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: Add cronjob, MarcOrder object and refactored addorderiso2709 script (21.60 KB, patch)
2024-01-11 14:52 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: Make item addition dependent on MarcItemFieldsToOrder mappings and introduce MarcFieldsToOrder to cronjob (11.07 KB, patch)
2024-01-11 14:52 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: Fix form rendering issue (15.87 KB, patch)
2024-01-11 14:52 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: Add match_field and match_value to allow multiple accounts in the same file directory (11.10 KB, patch)
2024-01-11 14:52 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: Add a plugin hook - before_orderline_create (651 bytes, patch)
2024-01-11 14:53 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: Rebase changes made in bug 33170 (1.06 KB, patch)
2024-01-11 14:53 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: DB schema and atomic update file (13.01 KB, patch)
2024-01-11 15:06 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: Update menus (4.20 KB, patch)
2024-01-11 15:06 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: Add account creation (22.28 KB, patch)
2024-01-11 15:06 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: Add cronjob, MarcOrder object and refactored addorderiso2709 script (35.66 KB, patch)
2024-01-11 15:06 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: Make item addition dependent on MarcItemFieldsToOrder mappings and introduce MarcFieldsToOrder to cronjob (11.07 KB, patch)
2024-01-11 15:06 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: Fix form rendering issue (15.87 KB, patch)
2024-01-11 15:06 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: Add match_field and match_value to allow multiple accounts in the same file directory (11.10 KB, patch)
2024-01-11 15:06 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: Add a plugin hook - before_orderline_create (651 bytes, patch)
2024-01-11 15:06 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: Rebase changes made in bug 33170 (1.06 KB, patch)
2024-01-11 15:06 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: DB schemas and atomicupdate (13.10 KB, patch)
2024-07-31 15:10 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: Update menus (4.73 KB, patch)
2024-07-31 15:10 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: Add account creation (22.27 KB, patch)
2024-07-31 15:10 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: Add cronjob and required methods (29.12 KB, patch)
2024-07-31 15:10 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: Make item addition dependent on MarcItemFieldsToOrder mappings and introduce MarcFieldsToOrder to cronjob (3.51 KB, patch)
2024-07-31 15:10 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: Fix form rendering issue (15.88 KB, patch)
2024-07-31 15:10 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: Add match_field and match_value to allow multiple accounts in the same file directory (11.09 KB, patch)
2024-07-31 15:10 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: Add a plugin hook - before_orderline_create (651 bytes, patch)
2024-07-31 15:10 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: Add unit tests (4.45 KB, patch)
2024-07-31 15:10 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Test file (13.43 KB, text/plain)
2024-08-15 15:43 UTC, Matt Blenkinsop
Details
Bug 34355: DB schemas and atomicupdate (13.13 KB, patch)
2024-08-15 16:27 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 34355: Update menus (4.76 KB, patch)
2024-08-15 16:27 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 34355: Add account creation (22.31 KB, patch)
2024-08-15 16:27 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 34355: Add cronjob and required methods (29.16 KB, patch)
2024-08-15 16:27 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 34355: Make item addition dependent on MarcItemFieldsToOrder mappings and introduce MarcFieldsToOrder to cronjob (3.55 KB, patch)
2024-08-15 16:27 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 34355: Fix form rendering issue (15.92 KB, patch)
2024-08-15 16:27 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 34355: Add match_field and match_value to allow multiple accounts in the same file directory (11.12 KB, patch)
2024-08-15 16:27 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 34355: Add a plugin hook - before_orderline_create (693 bytes, patch)
2024-08-15 16:27 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 34355: Add unit tests (4.49 KB, patch)
2024-08-15 16:27 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 34355: DB schemas and atomicupdate (13.16 KB, patch)
2024-10-21 14:40 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: Update menus (4.79 KB, patch)
2024-10-21 14:40 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: Add account creation (22.33 KB, patch)
2024-10-21 14:40 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: Add cronjob and required methods (29.00 KB, patch)
2024-10-21 14:40 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: Fix form rendering issue (15.94 KB, patch)
2024-10-21 14:40 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: Add match_field and match_value to allow multiple accounts in the same file directory (11.56 KB, patch)
2024-10-21 14:40 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: Add a plugin hook - before_orderline_create (1.96 KB, patch)
2024-10-21 14:40 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: Add unit tests (4.66 KB, patch)
2024-10-21 14:40 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: (QA follow-up) Add permission marc_order_manage to govern control of account creation (8.46 KB, patch)
2024-10-21 14:40 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: (QA follow-up) Migrate vendor dropdown to a kohaSelect (9.73 KB, patch)
2024-10-21 14:40 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: (QA follow-up) Add a delete flag to the cronjob (2.32 KB, patch)
2024-10-21 14:40 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: (QA follow-up) Fix template errors (24.66 KB, patch)
2024-10-21 14:40 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: (QA follow-up) Make record staging code DRY (15.13 KB, patch)
2024-10-21 14:40 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: (QA follow-up) Permissions fixes (3.60 KB, patch)
2024-10-30 11:39 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: (QA follow-up) Restore MarcFieldsToOrder prices (2.70 KB, patch)
2024-10-31 14:51 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: (QA follow-up) Restore MarcFieldsToOrder prices (1.90 KB, patch)
2024-10-31 14:51 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: (QA follow-up) Restore MarcFieldsToOrder prices (2.29 KB, patch)
2024-10-31 15:00 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: (QA follow-up) Restore MarcFieldsToOrder prices and budgets (4.43 KB, patch)
2024-10-31 16:59 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: (QA follow-up) Respect AcqCreateItem syspref (7.70 KB, patch)
2024-10-31 16:59 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: DB schemas and atomicupdate (13.20 KB, patch)
2024-11-05 16:37 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 34355: Update menus (4.83 KB, patch)
2024-11-05 16:37 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 34355: Add account creation (22.37 KB, patch)
2024-11-05 16:37 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 34355: Add cronjob and required methods (29.04 KB, patch)
2024-11-05 16:38 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 34355: Fix form rendering issue (15.97 KB, patch)
2024-11-05 16:38 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 34355: Add match_field and match_value to allow multiple accounts in the same file directory (11.59 KB, patch)
2024-11-05 16:38 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 34355: Add a plugin hook - before_orderline_create (1.99 KB, patch)
2024-11-05 16:38 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 34355: Add unit tests (4.70 KB, patch)
2024-11-05 16:38 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 34355: (QA follow-up) Add permission marc_order_manage to govern control of account creation (8.50 KB, patch)
2024-11-05 16:38 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 34355: (QA follow-up) Migrate vendor dropdown to a kohaSelect (9.77 KB, patch)
2024-11-05 16:38 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 34355: (QA follow-up) Add a delete flag to the cronjob (2.36 KB, patch)
2024-11-05 16:38 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 34355: (QA follow-up) Fix template errors (24.70 KB, patch)
2024-11-05 16:38 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 34355: (QA follow-up) Make record staging code DRY (15.17 KB, patch)
2024-11-05 16:38 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 34355: (QA follow-up) Permissions fixes (3.64 KB, patch)
2024-11-05 16:38 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 34355: (QA follow-up) Restore MarcFieldsToOrder prices and budgets (4.47 KB, patch)
2024-11-05 16:38 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 34355: (QA follow-up) Respect AcqCreateItem syspref (7.74 KB, patch)
2024-11-05 16:38 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 34355: (QA follow-up) Remove debugging comment from archiving command (1.13 KB, patch)
2024-11-05 16:38 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 34355: (QA follow-up) Tidy (2.27 KB, patch)
2024-11-05 16:38 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 34355: DB schemas and atomicupdate (6.85 KB, patch)
2024-11-11 15:23 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: DBIC files (6.75 KB, patch)
2024-11-11 15:23 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: Update menus (4.84 KB, patch)
2024-11-11 15:23 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: Add account creation (22.38 KB, patch)
2024-11-11 15:24 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: Add cronjob and required methods (29.06 KB, patch)
2024-11-11 15:24 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: Fix form rendering issue (15.99 KB, patch)
2024-11-11 15:24 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: Add match_field and match_value to allow multiple accounts in the same file directory (11.61 KB, patch)
2024-11-11 15:24 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: Add a plugin hook - before_orderline_create (2.01 KB, patch)
2024-11-11 15:24 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: Add unit tests (4.72 KB, patch)
2024-11-11 15:24 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: (QA follow-up) Add permission marc_order_manage to govern control of account creation (8.51 KB, patch)
2024-11-11 15:24 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: (QA follow-up) Migrate vendor dropdown to a kohaSelect (9.79 KB, patch)
2024-11-11 15:24 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: (QA follow-up) Add a delete flag to the cronjob (2.38 KB, patch)
2024-11-11 15:24 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: (QA follow-up) Fix template errors (24.71 KB, patch)
2024-11-11 15:24 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: (QA follow-up) Make record staging code DRY (15.18 KB, patch)
2024-11-11 15:24 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: (QA follow-up) Permissions fixes (3.66 KB, patch)
2024-11-11 15:24 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: (QA follow-up) Restore MarcFieldsToOrder prices and budgets (4.48 KB, patch)
2024-11-11 15:24 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: (QA follow-up) Respect AcqCreateItem syspref (7.76 KB, patch)
2024-11-11 15:24 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: (QA follow-up) Remove debugging comment from archiving command (1.15 KB, patch)
2024-11-11 15:24 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: (QA follow-up) Tidy (2.29 KB, patch)
2024-11-11 15:24 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34355: DBIC schema update (7.04 KB, patch)
2024-11-11 16:28 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 34355: (QA follow-up) Terminology and capitalization (7.21 KB, patch)
2024-11-11 16:28 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Blenkinsop 2023-07-24 13:48:41 UTC
This is a bug to create a process for automatically creating order lines from a MARC record. Users can nominate a directory for a particular vendor and then set a cronjob to periodically check that directory for new files. The cronjob will then stage the file, import biblios/items as required and then create order lines
Comment 1 Laurence Rault 2023-07-24 15:18:21 UTC
Koha has already EDI functionnality, that can do what you describe.
See https://koha-community.org/manual/23.05/en/html/acquisitions.html#edi-process
Comment 2 Jessie Zairo 2023-07-27 17:53:38 UTC
This enhancement would be for non-edi vendors and libraries who receive marc files.
Comment 3 Matt Blenkinsop 2023-08-23 08:34:24 UTC
Created attachment 154705 [details] [review]
Bug 34355: DB schema and atomic update file
Comment 4 Matt Blenkinsop 2023-08-23 08:34:26 UTC
Created attachment 154706 [details] [review]
Bug 34355: Update menus
Comment 5 Matt Blenkinsop 2023-08-23 08:34:29 UTC
Created attachment 154707 [details] [review]
Bug 34355: Add account creation
Comment 6 Matt Blenkinsop 2023-08-23 08:34:31 UTC
Created attachment 154708 [details] [review]
Bug 34355: Add cronjob, MarcOrder object and refactored addorderiso2709 script
Comment 7 Matt Blenkinsop 2023-08-23 08:34:33 UTC
Created attachment 154709 [details] [review]
Bug 34355: Make item addition dependent on MarcItemFieldsToOrder mappings and introduce MarcFieldsToOrder to cronjob
Comment 8 Matt Blenkinsop 2023-08-23 08:34:36 UTC
Created attachment 154710 [details] [review]
Bug 34355: Fix form rendering issue

This patch also fixes the referencing of import_record_id_selected
Comment 9 Katrin Fischer 2023-08-24 08:28:16 UTC
I feel like we will need a nice and concise test plan here as there already was some confusion about the functionality!
Comment 10 Matt Blenkinsop 2023-08-30 16:23:08 UTC
There is a nice, detailed (ish) test plan that I've written but I'm trying to write unit tests before submitting everything and marking as needing signoff.

I'm also weighing up Nick's point from Kohacon about splitting this into multiple bugs as there's some refactoring of the addorderiso2709.pl script at the heart of the enhancement
Comment 11 Katrin Fischer 2023-09-04 13:36:46 UTC
(In reply to Matt Blenkinsop from comment #10)
> There is a nice, detailed (ish) test plan that I've written but I'm trying
> to write unit tests before submitting everything and marking as needing
> signoff.
> 
> I'm also weighing up Nick's point from Kohacon about splitting this into
> multiple bugs as there's some refactoring of the addorderiso2709.pl script
> at the heart of the enhancement

+1 :)
Comment 12 Matt Blenkinsop 2023-10-13 13:51:14 UTC
Created attachment 157092 [details] [review]
Bug 34355: DB schema and atomic update file
Comment 13 Matt Blenkinsop 2023-10-13 13:51:16 UTC
Created attachment 157093 [details] [review]
Bug 34355: Update menus
Comment 14 Matt Blenkinsop 2023-10-13 13:51:19 UTC
Created attachment 157094 [details] [review]
Bug 34355: Add account creation
Comment 15 Matt Blenkinsop 2023-10-13 13:51:22 UTC
Created attachment 157095 [details] [review]
Bug 34355: Add cronjob, MarcOrder object and refactored addorderiso2709 script
Comment 16 Matt Blenkinsop 2023-10-13 13:51:25 UTC
Created attachment 157096 [details] [review]
Bug 34355: Make item addition dependent on MarcItemFieldsToOrder mappings and introduce MarcFieldsToOrder to cronjob
Comment 17 Matt Blenkinsop 2023-10-13 13:51:28 UTC
Created attachment 157097 [details] [review]
Bug 34355: Fix form rendering issue

This patch also fixes the referencing of import_record_id_selected
Comment 18 Matt Blenkinsop 2023-10-13 13:51:30 UTC
Created attachment 157098 [details] [review]
Bug 34355: Add match_field and match_value to allow multiple accounts in the same file directory
Comment 19 Matt Blenkinsop 2023-10-13 13:51:33 UTC
Created attachment 157099 [details] [review]
Bug 34355: Add a plugin hook - before_orderline_create
Comment 20 Matt Blenkinsop 2023-10-13 13:51:35 UTC
Created attachment 157100 [details] [review]
Bug 34355: Rebase changes made in bug 33170
Comment 21 Katrin Fischer 2023-10-13 18:02:03 UTC
We need a test plan please.
Comment 22 Katrin Fischer 2023-10-13 18:03:16 UTC
(In reply to Katrin Fischer from comment #21)
> We need a test plan please.

... and in general please more commit messages  ;)
Comment 23 Matt Blenkinsop 2024-01-11 14:52:40 UTC
Created attachment 160858 [details] [review]
Bug 34355: DB schema and atomic update file
Comment 24 Matt Blenkinsop 2024-01-11 14:52:43 UTC
Created attachment 160859 [details] [review]
Bug 34355: Update menus
Comment 25 Matt Blenkinsop 2024-01-11 14:52:46 UTC
Created attachment 160860 [details] [review]
Bug 34355: Add account creation
Comment 26 Matt Blenkinsop 2024-01-11 14:52:49 UTC
Created attachment 160861 [details] [review]
Bug 34355: Add cronjob, MarcOrder object and refactored addorderiso2709 script
Comment 27 Matt Blenkinsop 2024-01-11 14:52:52 UTC
Created attachment 160862 [details] [review]
Bug 34355: Make item addition dependent on MarcItemFieldsToOrder mappings and introduce MarcFieldsToOrder to cronjob
Comment 28 Matt Blenkinsop 2024-01-11 14:52:55 UTC
Created attachment 160863 [details] [review]
Bug 34355: Fix form rendering issue

This patch also fixes the referencing of import_record_id_selected
Comment 29 Matt Blenkinsop 2024-01-11 14:52:57 UTC
Created attachment 160864 [details] [review]
Bug 34355: Add match_field and match_value to allow multiple accounts in the same file directory
Comment 30 Matt Blenkinsop 2024-01-11 14:53:00 UTC
Created attachment 160865 [details] [review]
Bug 34355: Add a plugin hook - before_orderline_create
Comment 31 Matt Blenkinsop 2024-01-11 14:53:03 UTC
Created attachment 160866 [details] [review]
Bug 34355: Rebase changes made in bug 33170
Comment 32 Matt Blenkinsop 2024-01-11 15:06:21 UTC
Created attachment 160867 [details] [review]
Bug 34355: DB schema and atomic update file
Comment 33 Matt Blenkinsop 2024-01-11 15:06:25 UTC
Created attachment 160868 [details] [review]
Bug 34355: Update menus
Comment 34 Matt Blenkinsop 2024-01-11 15:06:27 UTC
Created attachment 160869 [details] [review]
Bug 34355: Add account creation
Comment 35 Matt Blenkinsop 2024-01-11 15:06:30 UTC
Created attachment 160870 [details] [review]
Bug 34355: Add cronjob, MarcOrder object and refactored addorderiso2709 script
Comment 36 Matt Blenkinsop 2024-01-11 15:06:33 UTC
Created attachment 160871 [details] [review]
Bug 34355: Make item addition dependent on MarcItemFieldsToOrder mappings and introduce MarcFieldsToOrder to cronjob
Comment 37 Matt Blenkinsop 2024-01-11 15:06:36 UTC
Created attachment 160872 [details] [review]
Bug 34355: Fix form rendering issue

This patch also fixes the referencing of import_record_id_selected
Comment 38 Matt Blenkinsop 2024-01-11 15:06:39 UTC
Created attachment 160873 [details] [review]
Bug 34355: Add match_field and match_value to allow multiple accounts in the same file directory
Comment 39 Matt Blenkinsop 2024-01-11 15:06:42 UTC
Created attachment 160874 [details] [review]
Bug 34355: Add a plugin hook - before_orderline_create
Comment 40 Matt Blenkinsop 2024-01-11 15:06:45 UTC
Created attachment 160875 [details] [review]
Bug 34355: Rebase changes made in bug 33170
Comment 41 Jessie Zairo 2024-01-19 12:52:28 UTC
Test Plan
1) Create an sFTP server (1 set up for each unique vendor) and share the credentials with the vendor who will be sending the test data
2)apply patch
3) navigate to Administration -> Acquisition parameters -> MARC order accounts
4) click New Account
5)Enter the following details
 a) Vendor:
 b) Budget:This budget will be used as the fallback value if the MARC records do not contain a mapped value for a budget code.
 c)Description:
 d)Download directory:The download directory specifies the directory in your koha installation that should be searched for new files.
 e)Match field:(Optional): If you have files from multiple vendors in the same file directory, the match field is the field in the marc record that will be checked to see if the file should be processed by this account.
 f)Match value: (Optional): This is the value that will be checked against the match field to see if the file matches this account. If it does it will be processed by this account, if not it will be skipped.
6) enter File import settings
7) enter Record matching settings
8) select if it should check for embedded item record data
9) click submit
10) drop test file in sFTP server (run manually or have a cron run to pick up the file)
11) file should load in basket for said vendor and create orders.
Comment 42 Katrin Fischer 2024-01-22 21:06:50 UTC
Is the setup of the mentioned SFTP server something done in Koha or something done outside? 
Are you expected to set it up on the Koha server itself? 
Maybe this works similar like picking up files for EDI?
Comment 43 Matt Blenkinsop 2024-07-31 15:10:27 UTC
Created attachment 169896 [details] [review]
Bug 34355: DB schemas and atomicupdate
Comment 44 Matt Blenkinsop 2024-07-31 15:10:30 UTC
Created attachment 169897 [details] [review]
Bug 34355: Update menus
Comment 45 Matt Blenkinsop 2024-07-31 15:10:33 UTC
Created attachment 169898 [details] [review]
Bug 34355: Add account creation
Comment 46 Matt Blenkinsop 2024-07-31 15:10:37 UTC
Created attachment 169899 [details] [review]
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
Comment 47 Matt Blenkinsop 2024-07-31 15:10:40 UTC
Created attachment 169900 [details] [review]
Bug 34355: Make item addition dependent on MarcItemFieldsToOrder mappings and introduce MarcFieldsToOrder to cronjob
Comment 48 Matt Blenkinsop 2024-07-31 15:10:43 UTC
Created attachment 169901 [details] [review]
Bug 34355: Fix form rendering issue

This patch also fixes the referencing of import_record_id_selected
Comment 49 Matt Blenkinsop 2024-07-31 15:10:46 UTC
Created attachment 169902 [details] [review]
Bug 34355: Add match_field and match_value to allow multiple accounts in the same file directory
Comment 50 Matt Blenkinsop 2024-07-31 15:10:49 UTC
Created attachment 169903 [details] [review]
Bug 34355: Add a plugin hook - before_orderline_create
Comment 51 Matt Blenkinsop 2024-07-31 15:10:53 UTC
Created attachment 169904 [details] [review]
Bug 34355: Add unit tests
Comment 52 Matt Blenkinsop 2024-07-31 15:11:49 UTC
Background:
This bug is intended for non-EDI vendors who wish to receive MARC files and automatically create order lines from these using the mappings in MarcFieldsToOrder and MarcItemFieldsToOrder. A vendor can supply MARC files to an SFTP location in the Koha installation and a cronjob can pick up those files and process them into order lines in a new basket for each file.

A file has been attached to test with, but you can use your own files. You just need to ensure that there is a mapping in the file consistent with what you put into the system preferences as per the test plan below.


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
Comment 53 Matt Blenkinsop 2024-08-15 15:43:56 UTC
Created attachment 170395 [details]
Test file
Comment 54 Andrew Fuerste-Henry 2024-08-15 16:27:21 UTC
Created attachment 170401 [details] [review]
Bug 34355: DB schemas and atomicupdate

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Comment 55 Andrew Fuerste-Henry 2024-08-15 16:27:24 UTC
Created attachment 170402 [details] [review]
Bug 34355: Update menus

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Comment 56 Andrew Fuerste-Henry 2024-08-15 16:27:27 UTC
Created attachment 170403 [details] [review]
Bug 34355: Add account creation

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Comment 57 Andrew Fuerste-Henry 2024-08-15 16:27:30 UTC
Created attachment 170404 [details] [review]
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>
Comment 58 Andrew Fuerste-Henry 2024-08-15 16:27:33 UTC
Created attachment 170405 [details] [review]
Bug 34355: Make item addition dependent on MarcItemFieldsToOrder mappings and introduce MarcFieldsToOrder to cronjob

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Comment 59 Andrew Fuerste-Henry 2024-08-15 16:27:36 UTC
Created attachment 170406 [details] [review]
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>
Comment 60 Andrew Fuerste-Henry 2024-08-15 16:27:39 UTC
Created attachment 170407 [details] [review]
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>
Comment 61 Andrew Fuerste-Henry 2024-08-15 16:27:42 UTC
Created attachment 170408 [details] [review]
Bug 34355: Add a plugin hook - before_orderline_create

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Comment 62 Andrew Fuerste-Henry 2024-08-15 16:27:45 UTC
Created attachment 170409 [details] [review]
Bug 34355: Add unit tests

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Comment 63 Nick Clemens (kidclamp) 2024-10-01 13:13:24 UTC
Doubled pref in patches:
pref: SerialsDefaultReplyTo
looks like rebase issues

A user can CRUD Marc Order Accounts with only catalogue permissions - I think it needs to be a new subpermission of acquisitions

A full search of vendors is used on the marc order accounts page - this should be a select2 and not load all into template (we have partners with thousands of vendors)

create_items is not set for basket - I think 'ordering' is required? maybe this setting is just ignored for this process?

you mention _stage_file is a clone from the background job. it should be moved into a place that can be shared with the background job to dry the code

match_file_to_account - POD should indicate only the first record is checked
on the account page it should specify the format, dollar sign for subfields, i.e. 245$a

Commit titles below don't match the patches, can you explain?
 Bug 34355: Make item addition dependent on MarcItemFieldsToOrder mappings and introduce MarcFieldsToOrder to cronjob
 Bug 34355: Add a plugin hook - before_orderline_create 
 
koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc_order_accounts.tt
 The selected option choices are split by the conditionals, include the full option selected or not
 You remove the use of tools-overlay-action.inc / tools-nomatch-action / tools-item-action - I think we should keep this to not repeat - the selection variables lok unsused so can be updated to work with
 the data here (e.g. git grep overlay_action_replace )
 
Warning when processing test file:
 Use of uninitialized value in concatenation (.) or string at /usr/share/perl5/MARC/File/XML.pm line 399, <__ANONIO__> chunk 5.
 Maybe a data problem with the file?

The cronjob deletes the file - I think we want an option to rename/move the file, rather than full deletion - if something is wrong, we want the file for reference

It looks like a few fields were not included in _create_item_fields_from_syspref:
coded_location_qualifier, barcode, and enumchron - special field quantity
Comment 64 Matt Blenkinsop 2024-10-21 14:40:00 UTC
Created attachment 173054 [details] [review]
Bug 34355: DB schemas and atomicupdate

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Comment 65 Matt Blenkinsop 2024-10-21 14:40:03 UTC
Created attachment 173055 [details] [review]
Bug 34355: Update menus

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Comment 66 Matt Blenkinsop 2024-10-21 14:40:06 UTC
Created attachment 173056 [details] [review]
Bug 34355: Add account creation

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Comment 67 Matt Blenkinsop 2024-10-21 14:40:10 UTC
Created attachment 173057 [details] [review]
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>
Comment 68 Matt Blenkinsop 2024-10-21 14:40:13 UTC
Created attachment 173058 [details] [review]
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>
Comment 69 Matt Blenkinsop 2024-10-21 14:40:16 UTC
Created attachment 173059 [details] [review]
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>
Comment 70 Matt Blenkinsop 2024-10-21 14:40:19 UTC
Created attachment 173060 [details] [review]
Bug 34355: Add a plugin hook - before_orderline_create

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Comment 71 Matt Blenkinsop 2024-10-21 14:40:23 UTC
Created attachment 173061 [details] [review]
Bug 34355: Add unit tests

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Comment 72 Matt Blenkinsop 2024-10-21 14:40:26 UTC
Created attachment 173062 [details] [review]
Bug 34355: (QA follow-up) Add permission marc_order_manage to govern control of account creation
Comment 73 Matt Blenkinsop 2024-10-21 14:40:30 UTC
Created attachment 173063 [details] [review]
Bug 34355: (QA follow-up) Migrate vendor dropdown to a kohaSelect
Comment 74 Matt Blenkinsop 2024-10-21 14:40:33 UTC
Created attachment 173064 [details] [review]
Bug 34355: (QA follow-up) Add a delete flag to the cronjob

This patch adds a 'delete' flag to the cronjob to select whether a file should be deleted or archived once processed
Comment 75 Matt Blenkinsop 2024-10-21 14:40:36 UTC
Created attachment 173065 [details] [review]
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
Comment 76 Matt Blenkinsop 2024-10-21 14:40:40 UTC
Created attachment 173066 [details] [review]
Bug 34355: (QA follow-up) Make record staging code DRY
Comment 77 Matt Blenkinsop 2024-10-21 14:45:23 UTC
(In reply to Nick Clemens (kidclamp) from comment #63)
> Doubled pref in patches:
> pref: SerialsDefaultReplyTo
> looks like rebase issues

Corrected

> A user can CRUD Marc Order Accounts with only catalogue permissions - I
> think it needs to be a new subpermission of acquisitions

Added a new permission marc_order_manage

> A full search of vendors is used on the marc order accounts page - this
> should be a select2 and not load all into template (we have partners with
> thousands of vendors)

Migrated to kohaSelect

> create_items is not set for basket - I think 'ordering' is required? maybe
> this setting is just ignored for this process?

I think we should set it - I've amended it to be set

> you mention _stage_file is a clone from the background job. it should be
> moved into a place that can be shared with the background job to dry the code

Done - moved to Koha::ImportBatch

> match_file_to_account - POD should indicate only the first record is checked
> on the account page it should specify the format, dollar sign for subfields,
> i.e. 245$a

Done

> Commit titles below don't match the patches, can you explain?
>  Bug 34355: Make item addition dependent on MarcItemFieldsToOrder mappings
> and introduce MarcFieldsToOrder to cronjob
>  Bug 34355: Add a plugin hook - before_orderline_create 

I think this is the result of rebases - the plugin hook had been lost and is now restored. The other commit I have squashed as it is no longer necessary as a separate commit as the history has been broken by other squashes/rebases

> koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc_order_accounts.tt
>  The selected option choices are split by the conditionals, include the full
> option selected or not
>  You remove the use of tools-overlay-action.inc / tools-nomatch-action /
> tools-item-action - I think we should keep this to not repeat - the
> selection variables lok unsused so can be updated to work with
>  the data here (e.g. git grep overlay_action_replace )

Amended the templates to reflect this

> Warning when processing test file:
>  Use of uninitialized value in concatenation (.) or string at
> /usr/share/perl5/MARC/File/XML.pm line 399, <__ANONIO__> chunk 5.
>  Maybe a data problem with the file?

This comes from the MARC library we import from CPAN and happens with the file when running a normal staged import

> The cronjob deletes the file - I think we want an option to rename/move the
> file, rather than full deletion - if something is wrong, we want the file
> for reference

I've added a delete flag - if this isn't set the cronjob now moves processed files to an 'archived' folder

> It looks like a few fields were not included in
> _create_item_fields_from_syspref:
> coded_location_qualifier, barcode, and enumchron - special field quantity

Updated
Comment 78 Matt Blenkinsop 2024-10-30 11:39:33 UTC
Created attachment 173709 [details] [review]
Bug 34355: (QA follow-up) Permissions fixes

This patch addresses some permissions errors and updates the breadcrumbs to reflect this
Comment 79 Matt Blenkinsop 2024-10-31 14:51:07 UTC
Created attachment 173805 [details] [review]
Bug 34355: (QA follow-up) Restore MarcFieldsToOrder prices
Comment 80 Matt Blenkinsop 2024-10-31 14:51:43 UTC
Created attachment 173806 [details] [review]
Bug 34355: (QA follow-up) Restore MarcFieldsToOrder prices
Comment 81 Matt Blenkinsop 2024-10-31 15:00:28 UTC
Created attachment 173809 [details] [review]
Bug 34355: (QA follow-up) Restore MarcFieldsToOrder prices
Comment 82 Matt Blenkinsop 2024-10-31 16:59:41 UTC
Created attachment 173824 [details] [review]
Bug 34355: (QA follow-up) Restore MarcFieldsToOrder prices and budgets
Comment 83 Matt Blenkinsop 2024-10-31 16:59:44 UTC
Created attachment 173825 [details] [review]
Bug 34355: (QA follow-up) Respect AcqCreateItem syspref
Comment 84 Nick Clemens (kidclamp) 2024-11-05 16:37:52 UTC
Created attachment 173993 [details] [review]
Bug 34355: DB schemas and atomicupdate

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 85 Nick Clemens (kidclamp) 2024-11-05 16:37:55 UTC
Created attachment 173994 [details] [review]
Bug 34355: Update menus

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 86 Nick Clemens (kidclamp) 2024-11-05 16:37:58 UTC
Created attachment 173995 [details] [review]
Bug 34355: Add account creation

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 87 Nick Clemens (kidclamp) 2024-11-05 16:38:01 UTC
Created attachment 173996 [details] [review]
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>
Comment 88 Nick Clemens (kidclamp) 2024-11-05 16:38:04 UTC
Created attachment 173997 [details] [review]
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>
Comment 89 Nick Clemens (kidclamp) 2024-11-05 16:38:08 UTC
Created attachment 173998 [details] [review]
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>
Comment 90 Nick Clemens (kidclamp) 2024-11-05 16:38:11 UTC
Created attachment 173999 [details] [review]
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>
Comment 91 Nick Clemens (kidclamp) 2024-11-05 16:38:14 UTC
Created attachment 174000 [details] [review]
Bug 34355: Add unit tests

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 92 Nick Clemens (kidclamp) 2024-11-05 16:38:16 UTC
Created attachment 174001 [details] [review]
Bug 34355: (QA follow-up) Add permission marc_order_manage to govern control of account creation

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 93 Nick Clemens (kidclamp) 2024-11-05 16:38:19 UTC
Created attachment 174002 [details] [review]
Bug 34355: (QA follow-up) Migrate vendor dropdown to a kohaSelect

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 94 Nick Clemens (kidclamp) 2024-11-05 16:38:22 UTC
Created attachment 174003 [details] [review]
Bug 34355: (QA follow-up) Add a delete flag to the cronjob

This patch adds a 'delete' flag to the cronjob to select whether a file should be deleted or archived once processed

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 95 Nick Clemens (kidclamp) 2024-11-05 16:38:25 UTC
Created attachment 174004 [details] [review]
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>
Comment 96 Nick Clemens (kidclamp) 2024-11-05 16:38:28 UTC
Created attachment 174005 [details] [review]
Bug 34355: (QA follow-up) Make record staging code DRY

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 97 Nick Clemens (kidclamp) 2024-11-05 16:38:31 UTC
Created attachment 174006 [details] [review]
Bug 34355: (QA follow-up) Permissions fixes

This patch addresses some permissions errors and updates the breadcrumbs to reflect this

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 98 Nick Clemens (kidclamp) 2024-11-05 16:38:34 UTC
Created attachment 174007 [details] [review]
Bug 34355: (QA follow-up) Restore MarcFieldsToOrder prices and budgets

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 99 Nick Clemens (kidclamp) 2024-11-05 16:38:37 UTC
Created attachment 174008 [details] [review]
Bug 34355: (QA follow-up) Respect AcqCreateItem syspref

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 100 Nick Clemens (kidclamp) 2024-11-05 16:38:40 UTC
Created attachment 174009 [details] [review]
Bug 34355: (QA follow-up) Remove debugging comment from archiving command

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 101 Nick Clemens (kidclamp) 2024-11-05 16:38:43 UTC
Created attachment 174010 [details] [review]
Bug 34355: (QA follow-up) Tidy

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 102 Nick Clemens (kidclamp) 2024-11-05 16:39:58 UTC
I think we can do more in the future to improve readability, but this one moves more ordering code into modules to make it easier for testing and gets my vote.

I tested all combinations I could think of, and orders are generated correctly from Marc. PQA
Comment 103 Katrin Fischer 2024-11-11 15:16:08 UTC
Please don't combine database update and schema update. We have a conflict now in the first patch:

Bug 34355: DB schemas and atomicupdate
Comment 104 Katrin Fischer 2024-11-11 15:23:01 UTC
I am trying to remove the schema files from the patches, so they apply...
Comment 105 Matt Blenkinsop 2024-11-11 15:23:52 UTC
Created attachment 174362 [details] [review]
Bug 34355: DB schemas and atomicupdate

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 106 Matt Blenkinsop 2024-11-11 15:23:55 UTC
Created attachment 174363 [details] [review]
Bug 34355: DBIC files

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 107 Matt Blenkinsop 2024-11-11 15:23:59 UTC
Created attachment 174364 [details] [review]
Bug 34355: Update menus

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 108 Matt Blenkinsop 2024-11-11 15:24:02 UTC
Created attachment 174365 [details] [review]
Bug 34355: Add account creation

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 109 Matt Blenkinsop 2024-11-11 15:24:06 UTC
Created attachment 174366 [details] [review]
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>
Comment 110 Matt Blenkinsop 2024-11-11 15:24:10 UTC
Created attachment 174367 [details] [review]
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>
Comment 111 Matt Blenkinsop 2024-11-11 15:24:13 UTC
Created attachment 174368 [details] [review]
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>
Comment 112 Matt Blenkinsop 2024-11-11 15:24:17 UTC
Created attachment 174369 [details] [review]
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>
Comment 113 Matt Blenkinsop 2024-11-11 15:24:21 UTC
Created attachment 174370 [details] [review]
Bug 34355: Add unit tests

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 114 Matt Blenkinsop 2024-11-11 15:24:25 UTC
Created attachment 174371 [details] [review]
Bug 34355: (QA follow-up) Add permission marc_order_manage to govern control of account creation

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 115 Matt Blenkinsop 2024-11-11 15:24:28 UTC
Created attachment 174372 [details] [review]
Bug 34355: (QA follow-up) Migrate vendor dropdown to a kohaSelect

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 116 Matt Blenkinsop 2024-11-11 15:24:32 UTC
Created attachment 174373 [details] [review]
Bug 34355: (QA follow-up) Add a delete flag to the cronjob

This patch adds a 'delete' flag to the cronjob to select whether a file should be deleted or archived once processed

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 117 Matt Blenkinsop 2024-11-11 15:24:35 UTC
Created attachment 174374 [details] [review]
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>
Comment 118 Matt Blenkinsop 2024-11-11 15:24:39 UTC
Created attachment 174375 [details] [review]
Bug 34355: (QA follow-up) Make record staging code DRY

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 119 Matt Blenkinsop 2024-11-11 15:24:43 UTC
Created attachment 174376 [details] [review]
Bug 34355: (QA follow-up) Permissions fixes

This patch addresses some permissions errors and updates the breadcrumbs to reflect this

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 120 Matt Blenkinsop 2024-11-11 15:24:46 UTC
Created attachment 174377 [details] [review]
Bug 34355: (QA follow-up) Restore MarcFieldsToOrder prices and budgets

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 121 Matt Blenkinsop 2024-11-11 15:24:50 UTC
Created attachment 174378 [details] [review]
Bug 34355: (QA follow-up) Respect AcqCreateItem syspref

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 122 Matt Blenkinsop 2024-11-11 15:24:53 UTC
Created attachment 174379 [details] [review]
Bug 34355: (QA follow-up) Remove debugging comment from archiving command

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 123 Matt Blenkinsop 2024-11-11 15:24:57 UTC
Created attachment 174380 [details] [review]
Bug 34355: (QA follow-up) Tidy

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 124 Matt Blenkinsop 2024-11-11 15:25:58 UTC
Rebased, although the conflict must be coming from something you've applied locally and not yet pushed as it applies cleanly for me - if there is still conflict then let me know when you've pushed all your local patches
Comment 125 Katrin Fischer 2024-11-11 16:28:22 UTC
Created attachment 174382 [details] [review]
Bug 34355: DBIC schema update
Comment 126 Katrin Fischer 2024-11-11 16:28:25 UTC
Created attachment 174383 [details] [review]
Bug 34355: (QA follow-up) Terminology and capitalization
Comment 127 Katrin Fischer 2024-11-11 16:43:55 UTC
Pushed for 24.11!

Well done everyone, thank you!
Comment 128 Katrin Fischer 2024-11-11 16:46:05 UTC
Might need some follow-ups for style (Bootstrap 5).
Comment 129 Katrin Fischer 2024-11-12 08:24:28 UTC
Should we treat this as "new feature"?
Comment 130 Jonathan Druart 2024-11-14 09:03:22 UTC
There are so many things to say here, but I don't have time right now for a full QA review...

Just let say the main points that shall have been raised by QA:

1. Missing tests!

2. Useless lines

+     my @messages;

+use Net::FTP;

3. Plugin hook added without being advertised (wiki, kitchenzink?)

+                    'before_orderline_create',

4. Code for acq not in Koha::Acquisition?

5. controller poorly written and not following standard
admin/marc_order_accounts.pl
* useless use statements
* 51 my $crypt = Koha::Encryption->new; wtf?
* values for '$op' not following "standard"
* no error handling, no user messages/alerts


Everybody wants their stuffs pushed, but we really need more eyes and spend more time on QA IMO.

I have been fighting for years to clean the code, but what's the point if we don't enforce the quality and prevent new legacy code to be pushed?