Bug 39858 - Cannot save vendor if it has invoices
Summary: Cannot save vendor if it has invoices
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: Main
Hardware: All All
: P5 - low major
Assignee: Tomás Cohen Arazi (tcohen)
QA Contact: Martin Renvoize (ashimema)
URL:
Keywords:
Depends on: 38010
Blocks:
  Show dependency treegraph
 
Reported: 2025-05-07 18:13 UTC by Tomás Cohen Arazi (tcohen)
Modified: 2025-05-09 07:14 UTC (History)
2 users (show)

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


Attachments
Bug 39858: Fix saving vendors with invoices (1.49 KB, patch)
2025-05-07 18:19 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 39858: Fix saving vendors with invoices (1.54 KB, patch)
2025-05-07 18:54 UTC, Roman Dolny
Details | Diff | Splinter Review
Bug 39858: Fix saving vendors with invoices (1.60 KB, patch)
2025-05-08 12:16 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Tomás Cohen Arazi (tcohen) 2025-05-07 18:13:56 UTC
I found while trying to add a contact to a vendor. Not sure if the invoices themselves are relevant.

To reproduce:
1. Have a vendor with some invoice
2. Try adding a contact (I added a name and an email)
3. Hit 'Submit'
=> FAIL: You get a yellow error message about a problem saving.
=> FAIL: The logs say something like:
```
[2025/05/07 18:08:18] [ERROR] PUT /api/v1/acquisitions/vendors/2: unhandled exception (Koha::Exceptions::Object::PropertyNotFound)<<No property invoices_count for Koha::Acquisition::Bookseller>>
```
Comment 1 Tomás Cohen Arazi (tcohen) 2025-05-07 18:19:03 UTC
Created attachment 182038 [details] [review]
Bug 39858: Fix saving vendors with invoices

This patch makes the form remove the `invoices_count` attribute from the
object before sending it to the API.

To test:
1. Have a vendor with some invoice
2. Edit the vendor to add a contact (for example)
3. Click 'Submit'
=> FAIL: Error, cannot be saved
4. Apply this patch
5. Rebuild the Vue assets:
   $ ktd --shell
  k$ yarn js:build
6. Restart:
  k$ restart_all
7. Reload the browser page and edit the vendor
8. Click 'Submit'
=> SUCCESS: It saved
9. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 2 Roman Dolny 2025-05-07 18:54:44 UTC
Created attachment 182039 [details] [review]
Bug 39858: Fix saving vendors with invoices

This patch makes the form remove the `invoices_count` attribute from the
object before sending it to the API.

To test:
1. Have a vendor with some invoice
2. Edit the vendor to add a contact (for example)
3. Click 'Submit'
=> FAIL: Error, cannot be saved
4. Apply this patch
5. Rebuild the Vue assets:
   $ ktd --shell
  k$ yarn js:build
6. Restart:
  k$ restart_all
7. Reload the browser page and edit the vendor
8. Click 'Submit'
=> SUCCESS: It saved
9. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Comment 3 Martin Renvoize (ashimema) 2025-05-08 12:16:27 UTC
Created attachment 182073 [details] [review]
Bug 39858: Fix saving vendors with invoices

This patch makes the form remove the `invoices_count` attribute from the
object before sending it to the API.

To test:
1. Have a vendor with some invoice
2. Edit the vendor to add a contact (for example)
3. Click 'Submit'
=> FAIL: Error, cannot be saved
4. Apply this patch
5. Rebuild the Vue assets:
   $ ktd --shell
  k$ yarn js:build
6. Restart:
  k$ restart_all
7. Reload the browser page and edit the vendor
8. Click 'Submit'
=> SUCCESS: It saved
9. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Comment 4 Katrin Fischer 2025-05-09 07:14:58 UTC
Pushed for 25.05!

Well done everyone, thank you!