From b98b9c63558d8d556f296dd89654801e8aba56d4 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Tue, 13 Jan 2026 14:16:41 +0800 Subject: [PATCH] * [refac bug #62582] Sync parent when change children. --- .../src/PhpWord/Element/PreserveText.php | 2 +- .../phpword/src/PhpWord/Shared/XMLWriter.php | 1 + module/task/js/batchedit.ui.js | 20 +++++++++++++++++++ module/task/ui/batchedit.html.php | 1 + 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/lib/vendor/phpoffice/phpword/src/PhpWord/Element/PreserveText.php b/lib/vendor/phpoffice/phpword/src/PhpWord/Element/PreserveText.php index c0e64268ba..803ee4f395 100644 --- a/lib/vendor/phpoffice/phpword/src/PhpWord/Element/PreserveText.php +++ b/lib/vendor/phpoffice/phpword/src/PhpWord/Element/PreserveText.php @@ -60,7 +60,7 @@ class PreserveText extends AbstractElement $this->paragraphStyle = $this->setNewStyle(new Paragraph(), $paragraphStyle); $this->text = SharedText::toUTF8($text); - $matches = preg_split('/({.*?})/', $this->text, null, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); + $matches = preg_split('/({.*?})/', $this->text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); if (isset($matches[0])) { $this->text = $matches; } diff --git a/lib/vendor/phpoffice/phpword/src/PhpWord/Shared/XMLWriter.php b/lib/vendor/phpoffice/phpword/src/PhpWord/Shared/XMLWriter.php index 930ad62ee1..882492e00f 100644 --- a/lib/vendor/phpoffice/phpword/src/PhpWord/Shared/XMLWriter.php +++ b/lib/vendor/phpoffice/phpword/src/PhpWord/Shared/XMLWriter.php @@ -171,6 +171,7 @@ class XMLWriter extends \XMLWriter * @param mixed $value * @return bool */ + #[\ReturnTypeWillChange] public function writeAttribute($name, $value) { if (is_float($value)) { diff --git a/module/task/js/batchedit.ui.js b/module/task/js/batchedit.ui.js index 7d9f8b03d5..f07ab794b7 100644 --- a/module/task/js/batchedit.ui.js +++ b/module/task/js/batchedit.ui.js @@ -333,3 +333,23 @@ function setStoryRelated(event) if(!$row.find('td[data-name="story"][data-ditto="on"]').length) break; } } + +window.computeForParent = function(e) +{ + const $this = $(e.target); + const field = $this.attr('data-name'); + const parentID = $this.closest('tr').attr('data-parent'); + if(parentID == '0') return; + + const $parent = $('input[name="id[' + parentID + ']"]'); + if($parent.length == 0) return; + + const oldParentHour = parseFloat($parent.closest('tr').find('input[data-name="' + field + '"]').val()); + + let parentHour = 0; + $('tr[data-parent="' + parentID + '"]').each(function() + { + parentHour += parseFloat($(this).find('input[data-name="' + field + '"]').val()); + }); + if(oldParentHour < parentHour) $parent.closest('tr').find('input[data-name="' + field + '"]').val(parentHour.toFixed(2)); +} \ No newline at end of file diff --git a/module/task/ui/batchedit.html.php b/module/task/ui/batchedit.html.php index 973069b132..cd04a74153 100644 --- a/module/task/ui/batchedit.html.php +++ b/module/task/ui/batchedit.html.php @@ -56,6 +56,7 @@ formBatchPanel on::change('[data-name="estStarted"], [data-name="deadline"]', 'checkBatchEstStartedAndDeadline'), on::change('[data-name="module"]', 'setStories'), on::change('input[name^=story]', 'setStoryRelated'), + on::change('[data-name="estimate"],[data-name="consumed"]', 'computeForParent'), on::click('[data-name=story] [data-type=ditto]', 'setStoryRelated'), set::formID('taskBatchEditForm' . $executionID), formBatchItem