Repository navigation
Attach to a note only a file uploaded for its record - #1093
Merged
Merged
Conversation
…for it The note forms post the id of the file they uploaded, and the panels saved any id they were given. A note could point at a file uploaded for another record, even one of another store, and the customer could then download it from the note; deleting the note deleted that file. Shipment and merchandise return notes now take only a file uploaded for that shipment or return, as order notes already do, and deleting a note removes only such a file. The panels show a message when the file is refused.
…ck every note kind one way Customer notes saved any file id the request gave and deleted that file with the note, the gap shipment and merchandise return notes had. They now take only a file uploaded for that customer, and deleting a note removes only such a file. The order, shipment and merchandise return notes each had their own copy of the check; the four note kinds now share one Download extension.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The note forms post the id of the file they uploaded, and the panels saved whatever id they were given. A shipment, merchandise return or customer note could point at a file uploaded for another record, even one of another store, and the customer could then download it from the note. Deleting the note also deleted that file. Order notes already checked this.
Changes
DownloadExtensions.IsAttachmentOf(downloadType, referenceId)(Grand.Web.AdminShared/Extensions): the one check for every note kind; the private copy inOrderNoteViewModelServiceis replaced by it.ShipmentViewModelService.InsertShipmentNote,MerchandiseReturnViewModelService.InsertMerchandiseReturnNoteandCustomerNoteViewModelService.InsertCustomerNote: accept a download only when its type isShipment/MerchandiseReturn/Customerand its reference is that record. They returnfalseotherwise (InsertCustomerNotereturned the note before).BaseShipmentController,BaseMerchandiseReturnControllerand the adminCustomerNoteControlleranswerResult = falsewith a message, and the note views show it instead of reloading the grid silently.DefaultLanguage.xmlandUpgrade/en_250.xml):Admin.Orders.Shipments.ShipmentNotes.DownloadNotOfShipment,Admin.Orders.MerchandiseReturns.MerchandiseReturnNotes.DownloadNotOfMerchandiseReturn,Admin.Customers.Customers.CustomerNotes.DownloadNotOfCustomer.Tests
ShipmentViewModelServiceTests: own file saved, file of another shipment or type refused, delete keeps a foreign file.MerchandiseReturnViewModelServiceTests: only a file uploaded for the return is saved.CustomerNoteViewModelServiceTests: own file saved, file of another type or customer refused, delete keeps a foreign file.Grand.Web.Admin.Tests(2109),Grand.Web.Store.Tests(245),Grand.Web.Vendor.Tests(53) pass.