Bug 39711 - Migrate C4::Contract to object classes
Summary: Migrate C4::Contract to object classes
Status: Needs Signoff
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Matt Blenkinsop
QA Contact: Testopia
URL:
Keywords:
Depends on: 38010
Blocks:
  Show dependency treegraph
 
Reported: 2025-04-23 15:23 UTC by Matt Blenkinsop
Modified: 2025-04-28 10:53 UTC (History)
2 users (show)

See Also:
GIT URL:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 39711: Add koha objects for the aqcontract table (3.87 KB, patch)
2025-04-24 14:40 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 39711: Update all calls to GetContracts (4.47 KB, patch)
2025-04-24 14:40 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 39711: Update all calls to GetContract (10.01 KB, patch)
2025-04-24 14:41 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 39711: Update call to AddContract (1.54 KB, patch)
2025-04-24 14:41 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 39711: Update call to ModContract and improve error handling (1.95 KB, patch)
2025-04-24 14:41 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 39711: Update call to DelContract (2.04 KB, patch)
2025-04-24 14:41 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 39711: Add unit tests (3.88 KB, patch)
2025-04-24 14:41 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 39711: Delete old C4::Contract code and tests (12.26 KB, patch)
2025-04-24 14:41 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 39711: Delete old C4::Contract code and tests (12.55 KB, patch)
2025-04-24 14:47 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 39711: Delete old C4::Contract code and tests (12.78 KB, patch)
2025-04-28 09:47 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 39711: Fix 500 when viewing a basket without contract (5.68 KB, patch)
2025-04-28 09:48 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 39711: Remove ->store (927 bytes, patch)
2025-04-28 09:50 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 39711: Fix 500 when creating a new order for a basket without contract (1.92 KB, patch)
2025-04-28 10:24 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 39711: Use ->contract for basketheader (15.53 KB, patch)
2025-04-28 10:24 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 39711: (bugfix) Show contract of the basket if inactive (1.58 KB, patch)
2025-04-28 10:41 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 39711: Order by contract name (761 bytes, patch)
2025-04-28 10:41 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 39711: (bugfix) Allow to clear basket's contract (2.20 KB, patch)
2025-04-28 10:51 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Blenkinsop 2025-04-23 15:23:01 UTC
We should migrate this ahead of the new acquisitions work and because it is a relatively small module to migrate
Comment 1 Matt Blenkinsop 2025-04-24 14:40:56 UTC
Created attachment 181453 [details] [review]
Bug 39711: Add koha objects for the aqcontract table
Comment 2 Matt Blenkinsop 2025-04-24 14:40:58 UTC
Created attachment 181454 [details] [review]
Bug 39711: Update all calls to GetContracts
Comment 3 Matt Blenkinsop 2025-04-24 14:41:01 UTC
Created attachment 181455 [details] [review]
Bug 39711: Update all calls to GetContract
Comment 4 Matt Blenkinsop 2025-04-24 14:41:03 UTC
Created attachment 181456 [details] [review]
Bug 39711: Update call to AddContract
Comment 5 Matt Blenkinsop 2025-04-24 14:41:05 UTC
Created attachment 181457 [details] [review]
Bug 39711: Update call to ModContract and improve error handling
Comment 6 Matt Blenkinsop 2025-04-24 14:41:08 UTC
Created attachment 181458 [details] [review]
Bug 39711: Update call to DelContract
Comment 7 Matt Blenkinsop 2025-04-24 14:41:10 UTC
Created attachment 181459 [details] [review]
Bug 39711: Add unit tests
Comment 8 Matt Blenkinsop 2025-04-24 14:41:12 UTC
Created attachment 181460 [details] [review]
Bug 39711: Delete old C4::Contract code and tests
Comment 9 Matt Blenkinsop 2025-04-24 14:47:23 UTC
Created attachment 181461 [details] [review]
Bug 39711: Delete old C4::Contract code and tests

Test plan:
1) prove t/db_dependent/Koha/Acquisition/*
2) Navigate to a vendor record and access the contracts area
3) Test all CRUD elements for the contracts section
4) Navigate to the baskets for the vendor
5) Test the available CRUD options for a basket
6) All pages should work as expected
Comment 10 Jonathan Druart 2025-04-28 09:47:05 UTC
Created attachment 181580 [details] [review]
Bug 39711: Delete old C4::Contract code and tests

Test plan:
1) prove t/db_dependent/Koha/Acquisition/*
2) Navigate to a vendor record and access the contracts area
3) Test all CRUD elements for the contracts section
4) Navigate to the baskets for the vendor
5) Test the available CRUD options for a basket
6) All pages should work as expected
Comment 11 Jonathan Druart 2025-04-28 09:47:19 UTC
(In reply to Jonathan Druart from comment #10)
> Created attachment 181580 [details] [review] [review]
> Bug 39711: Delete old C4::Contract code and tests

Simple rebase.
Comment 12 Jonathan Druart 2025-04-28 09:48:49 UTC
Created attachment 181581 [details] [review]
Bug 39711: Fix 500 when viewing a basket without contract

Can't call method "contractname" on an undefined value at /kohadevbox/koha/acqui/basket.pl line 462.

Use Koha::Acq::Basket->contract
Comment 13 Jonathan Druart 2025-04-28 09:50:39 UTC
Created attachment 181582 [details] [review]
Bug 39711: Remove ->store

It's NOT NULL at the DB level, we don't need to deal with that
constraint here.
Comment 14 Jonathan Druart 2025-04-28 10:24:14 UTC
Created attachment 181583 [details] [review]
Bug 39711: Fix 500 when creating a new order for a basket without contract
Comment 15 Jonathan Druart 2025-04-28 10:24:17 UTC
Created attachment 181584 [details] [review]
Bug 39711: Use ->contract for basketheader
Comment 16 Jonathan Druart 2025-04-28 10:25:06 UTC
Found a bug, that is in main already. You cannot empty a contact when editing a basket.
TODO later.
Comment 17 Jonathan Druart 2025-04-28 10:31:56 UTC
Found another bug, in main as well: if you edit a basket that has an inactive contract, it does not appear in the dropdown list.
Comment 18 Jonathan Druart 2025-04-28 10:41:15 UTC
Created attachment 181586 [details] [review]
Bug 39711: (bugfix) Show contract of the basket if inactive

If the contract is inactive it should be displayed on the basket edit
view.
Comment 19 Jonathan Druart 2025-04-28 10:41:18 UTC
Created attachment 181587 [details] [review]
Bug 39711: Order by contract name
Comment 20 Jonathan Druart 2025-04-28 10:51:28 UTC
Created attachment 181588 [details] [review]
Bug 39711: (bugfix) Allow to clear basket's contract
Comment 21 Jonathan Druart 2025-04-28 10:53:58 UTC
(In reply to Jonathan Druart from comment #20)
> Created attachment 181588 [details] [review] [review]
> Bug 39711: (bugfix) Allow to clear basket's contract

Opened bug 39758 for stable releases.

(In reply to Jonathan Druart from comment #18)
> Created attachment 181586 [details] [review] [review]
> Bug 39711: (bugfix) Show contract of the basket if inactive
> 
> If the contract is inactive it should be displayed on the basket edit
> view.

And bug 39759 for this one.