Bug 39795

Summary: Data loss when editing vendor.addressX
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: AcquisitionsAssignee: Bugs List <koha-bugs>
Status: NEW --- QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low    
Version: 24.11   
Hardware: All   
OS: All   
GIT URL: Change sponsored?: ---
Patch complexity: --- Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 38010    
Bug Blocks:    

Description Jonathan Druart 2025-04-30 19:36:30 UTC
It's related to this code from vue/components/Vendors/VendorFormAdd.vue

+                    let physical = "";
+                    vendor.address1 && (physical += vendor.address1 + "\n");
+                    vendor.address2 && (physical += vendor.address2 + "\n");
+                    vendor.address3 && (physical += vendor.address3 + "\n");
+                    vendor.address4 && (physical += vendor.address4 + "\n");
+                    this.vendor.physical = physical;


+            if (vendor.physical) {
+                const addressLines = vendor.physical.split("\n");
+                if (addressLines.length > 4) {
+                    addressLines.length = 4;
+                }
+                addressLines.forEach((line, i) => {
+                    vendor[`address${i + 1}`] = line;
+                });
+            }


The existing bug has been ported when writing bug 38010 but it should be fixed.

If you enter physical address on more than 4 lines, save
=> Only the first 4 lines are kept.