commit 84ff2a7af52e92157456c94b74c99d256d067ebd
parent c3c789da5f3706a4d1d7ccfbe184b09fc7c70d3f
Author: Felicitus <felicitus@felicitus.org>
Date: Thu, 5 Jul 2012 00:48:00 +0200
Added support for copying part attachments from one entity to another. Creates a physical new file.
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/src/backend/PartKeepr/Part/PartAttachment.php b/src/backend/PartKeepr/Part/PartAttachment.php
@@ -89,6 +89,11 @@ class PartAttachment extends UploadedFile implements Serializable, Deserializabl
if (array_key_exists("id", $parameters)) {
if (substr($parameters["id"], 0, 4) === "TMP:") {
$this->replaceFromTemporaryFile($parameters["id"]);
+ } else {
+ /* Attachment already exists, but seems to belong to another part. Copy the data. */
+ $otherAttachment = PartAttachment::loadById($parameters["id"]);
+ $this->replace($otherAttachment->getFilename());
+ $this->setOriginalFilename($otherAttachment->getOriginalFilename());
}
}