Bug 39858

Summary: Cannot save vendor if it has invoices
Product: Koha Reporter: Tomás Cohen Arazi (tcohen) <tomascohen>
Component: AcquisitionsAssignee: Tomás Cohen Arazi (tcohen) <tomascohen>
Status: Pushed to main --- QA Contact: Martin Renvoize (ashimema) <martin.renvoize>
Severity: major    
Priority: P5 - low CC: martin.renvoize, tomascohen
Version: Main   
Hardware: All   
OS: All   
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:
Bug Depends on: 38010    
Bug Blocks:    
Attachments: Bug 39858: Fix saving vendors with invoices
Bug 39858: Fix saving vendors with invoices
Bug 39858: Fix saving vendors with invoices

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!