Bug 42312: Clear vendor address before saving new address lines
This patch clears the vendor address fields before processing the new input
and also adds a space between lines when joining the display
To test:
1 - Create or edit a vendor and enter 'Physical address' as
Line 1
Line 2
Line 3
Line 4
2 - Edit the vendor, clear physical address and enter:
New Line 1
3 - Save, search for vendor, and note the address shows as
New Line 1Line2Line3Line4
4 - Apply patch, yanr build, reload the page and clear cache
5 - Clear physicall address and enter
Newnew line 1
6 - Search for vendor and confirm display is:
Newnew line 1 Line 2 Line 3 Line 4
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
2a1ccd9c4f
commit
42b042b4a4
|
|
@ -701,6 +701,10 @@ export default {
|
|||
delete vendor.id;
|
||||
|
||||
if (vendor.physical) {
|
||||
vendor[`address1`] = "";
|
||||
vendor[`address2`] = "";
|
||||
vendor[`address3`] = "";
|
||||
vendor[`address4`] = "";
|
||||
const addressLines = vendor.physical.split("\n");
|
||||
if (addressLines.length > 4) {
|
||||
addressLines.length = 4;
|
||||
|
|
@ -792,7 +796,7 @@ export default {
|
|||
let physicalAddress = "";
|
||||
[1, 2, 3, 4].forEach(i => {
|
||||
if (resource[`address${i}`]) {
|
||||
physicalAddress += `${resource[`address${i}`]}`;
|
||||
physicalAddress += `${resource[`address${i}`]} `;
|
||||
}
|
||||
});
|
||||
resource.physical = physicalAddress;
|
||||
|
|
|
|||
Loading…
Reference in New Issue