Added show_logo_name field to data object to avoid deleting current logo when none is being uploaded
This commit is contained in:
parent
1cf3a5ca3a
commit
096556fa74
|
@ -199,10 +199,13 @@ class Application_Service_ShowService
|
|||
|
||||
if ($this->isUpdate) {
|
||||
|
||||
// Delete previous show images
|
||||
$showId = $this->ccShow->getDbId();
|
||||
if (!Rest_ShowController::deleteFilesFromStor($showId)) {
|
||||
throw new Exception("Error deleting show images");
|
||||
|
||||
// Only delete the previous logo if a new one is being uploaded
|
||||
if ($showData["show_logo"] && $showData["show_logo_name"] !== "") {
|
||||
if (!Rest_ShowController::deleteShowImagesFromStor($showId)) {
|
||||
throw new Exception("Error deleting show images");
|
||||
}
|
||||
}
|
||||
|
||||
if (!$this->ccShow->getCcShowDayss()->isEmpty()) {
|
||||
|
@ -754,7 +757,7 @@ SQL;
|
|||
|
||||
// Delete show images
|
||||
$showId = $ccShowInstance->getDbShowId();
|
||||
if (!Rest_ShowController::deleteFilesFromStor($showId)) {
|
||||
if (!Rest_ShowController::deleteShowImagesFromStor($showId)) {
|
||||
throw new Exception("Error deleting show images");
|
||||
}
|
||||
|
||||
|
|
|
@ -236,12 +236,14 @@ function setAddShowEvents(form) {
|
|||
|
||||
// If we're adding a new show, hide the "Current Logo" element/label
|
||||
if ($(".button-bar.bottom").find(".ui-button-text").text() === "Update show") {
|
||||
$("#show_logo_current-element").show();
|
||||
$("#show_logo_current-label").show();
|
||||
// Display the current show logo if it exists
|
||||
if ($("#show_logo_current").attr("src") !== "") {
|
||||
$("#show_logo_current-element").show();
|
||||
$("#show_logo_current-label").show();
|
||||
$("#show_logo_current").show();
|
||||
} else {
|
||||
$("#show_logo_current-element").hide();
|
||||
$("#show_logo_current-label").hide();
|
||||
$("#show_logo_current").hide();
|
||||
}
|
||||
} else {
|
||||
|
@ -668,6 +670,7 @@ function setAddShowEvents(form) {
|
|||
&& $('#upload')[0].files[0]) {
|
||||
image = new FormData();
|
||||
image.append('file', $('#upload')[0].files[0]);
|
||||
data['show_logo_name'] = $('#upload')[0].files[0].name;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
|
|
Loading…
Reference in New Issue