From c563622f6cac17781bf2ae97984da381db2cf4f8 Mon Sep 17 00:00:00 2001 From: wangyuting Date: Mon, 20 May 2024 13:51:41 +0800 Subject: [PATCH] * Fix import story to story lib error. bug #48877. --- module/product/js/browse.ui.js | 11 +++++++++ module/product/ui/browse.html.php | 37 ++++++++++++++++++++++++++++++- 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/module/product/js/browse.ui.js b/module/product/js/browse.ui.js index b21a019315..fb421b679a 100644 --- a/module/product/js/browse.ui.js +++ b/module/product/js/browse.ui.js @@ -124,3 +124,14 @@ window.setStatistics = function(element, checkedIdList, pageSummary) return {html: checkedSummary.replace('%total%', total).replace('%estimate%', estimate).replace('%rate%', rate).replace('%SRTotal%', SRTotal)}; }; + +window.importToLib = function() +{ + const dtable = zui.DTable.query($('#stories')); + const checkedList = dtable.$.getChecks(); + if(!checkedList.length) return; + + let storyIdList = ''; + checkedList.forEach((id) => storyIdList += id + ','); + $('#storyIdList').val(storyIdList); +} diff --git a/module/product/ui/browse.html.php b/module/product/ui/browse.html.php index 48504a8a1b..7537563613 100644 --- a/module/product/ui/browse.html.php +++ b/module/product/ui/browse.html.php @@ -288,7 +288,7 @@ $fnGenerateFootToolbar = function() use ($lang, $product, $productID, $project, /* AssignedTo button. */ array('caret' => 'up', 'text' => $lang->story->assignedTo, 'className' => ($canBatchAssignTo ? 'secondary batchAssignToBtn' : 'hidden'), 'items' => $assignItems, 'type' => 'dropdown', 'data-placement' => 'top-start', 'data-menu' => array('searchBox' => true)), /* Batch import to lib button .*/ - !$canBatchImportToLib ? null : array('text' => $lang->story->importToLib, 'className' => 'btn secondary batchImportToLibBtn', 'id' => 'importToLib', 'data-toggle' => 'modal', 'url' => '#batchImportToLib') + !$canBatchImportToLib ? null : array('text' => $lang->story->importToLib, 'className' => 'btn secondary batchImportToLibBtn', 'id' => 'importToLib', 'data-toggle' => 'modal', 'url' => '#batchImportToLib', 'data-on' => 'click', 'data-call' => 'importToLib') ); return array @@ -394,4 +394,39 @@ modal ) ); +if(isset($libs)) +{ + modal + ( + setID('batchImportToLib'), + set::title($lang->story->importToLib), + form + ( + set::action($this->createLink('story', 'batchImportToLib')), + formGroup + ( + set::label($lang->story->lib), + picker + ( + set::name('lib'), + set::items($libs), + set::required(true) + ), + input(set::className('hidden'), set::name('storyIdList'), set::id('storyIdList')) + ), + (!hasPriv('assetlib', 'approveStory') && !hasPriv('assetlib', 'batchApproveStory')) ? formGroup + ( + set::label($lang->story->approver), + picker + ( + set::name('assignedTo'), + set::items($approvers) + ) + ) : null, + set::submitBtnText($lang->import), + set::actions(array('submit')) + ) + ); +} + render();