From 413f7d48c38a7c44ea6a0ae3a6ac244f60b7b8ee Mon Sep 17 00:00:00 2001
From: estellbright <1457749147@qq.com>
Date: Fri, 13 Jul 2018 09:36:30 +0800
Subject: [PATCH] Fix Bug Delete the Last.
---
module/productplan/view/browse.html.php | 3 ++-
module/project/view/build.html.php | 3 ++-
module/release/view/browse.html.php | 3 ++-
www/js/my.full.js | 1 +
4 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/module/productplan/view/browse.html.php b/module/productplan/view/browse.html.php
index 7a6a80df67..2ad8f26266 100644
--- a/module/productplan/view/browse.html.php
+++ b/module/productplan/view/browse.html.php
@@ -98,7 +98,8 @@
if(common::hasPriv('productplan', 'delete', $plan))
{
- common::printIcon('productplan', 'delete', "planID=$plan->id", $plan, '', '', 'hiddenwin');
+ $deleteURL = $this->createLink('productplan', 'delete', "planID=$plan->id&confirm=yes");
+ echo html::a("javascript:ajaxDelete(\"$deleteURL\",\"productplanList\",confirmDelete)", '', '', "class='btn btn-icon' title='{$lang->productplan->delete}'");
}
?>
diff --git a/module/project/view/build.html.php b/module/project/view/build.html.php
index ea59456c24..2b95cc8255 100644
--- a/module/project/view/build.html.php
+++ b/module/project/view/build.html.php
@@ -87,7 +87,8 @@
common::printIcon('build', 'edit', "buildID=$build->id", $build, 'list');
if(common::hasPriv('build', 'delete', $build))
{
- common::printIcon('build', 'delete', "buildID=$build->id", $build, '', '', 'hiddenwin');
+ $deleteURL = $this->createLink('build', 'delete', "buildID=$build->id&confirm=yes");
+ echo html::a("javascript:ajaxDelete(\"$deleteURL\",\"buildList\",confirmDelete)", '', '', "class='btn' title='{$lang->build->delete}'");
}
?>
diff --git a/module/release/view/browse.html.php b/module/release/view/browse.html.php
index cc2d4b5443..10caf0919e 100644
--- a/module/release/view/browse.html.php
+++ b/module/release/view/browse.html.php
@@ -77,7 +77,8 @@
common::printIcon('release', 'edit', "release=$release->id", $release, 'list');
if(common::hasPriv('release', 'delete', $release))
{
- common::printIcon('release', 'delete', "releaseID=$release->id", $release, '', '', 'hiddenwin');
+ $deleteURL = $this->createLink('release', 'delete', "releaseID=$release->id&confirm=yes");
+ echo html::a("javascript:ajaxDelete(\"$deleteURL\",\"releaseList\",confirmDelete)", '', '', "class='btn' title='{$lang->release->delete}'");
}
?>
diff --git a/www/js/my.full.js b/www/js/my.full.js
index 435b572771..5d0b192869 100644
--- a/www/js/my.full.js
+++ b/www/js/my.full.js
@@ -334,6 +334,7 @@ function ajaxDelete(url, replaceID, notice)
{
$.get(document.location.href, function(data)
{
+ if(!($(data).find('#' + replaceID).length))location.reload();
$('#' + replaceID).html($(data).find('#' + replaceID).html());
if(typeof sortTable == 'function') sortTable();
$('#' + replaceID).find('[data-toggle=modal], a.iframe').modalTrigger();