From 1b7876094bbffd57a1875a5595a379d48aba17d6 Mon Sep 17 00:00:00 2001 From: Rui Alves Date: Mon, 9 Dec 2024 15:19:13 +0000 Subject: [PATCH 1/5] Issue #3939: Fix bug and view time accounting for deleted articles --- Kernel/System/Ticket.pm | 1 + Kernel/System/Ticket/Article.pm | 26 +++++++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/Kernel/System/Ticket.pm b/Kernel/System/Ticket.pm index fcccd54d7..d37492c0e 100644 --- a/Kernel/System/Ticket.pm +++ b/Kernel/System/Ticket.pm @@ -6362,6 +6362,7 @@ sub TicketAccountTime { Data => { TicketID => $Param{TicketID}, ArticleID => $Param{ArticleID}, + TimeUnits => $Param{TimeUnit} }, UserID => $Param{UserID}, ); diff --git a/Kernel/System/Ticket/Article.pm b/Kernel/System/Ticket/Article.pm index 734277cc7..0c1859f39 100644 --- a/Kernel/System/Ticket/Article.pm +++ b/Kernel/System/Ticket/Article.pm @@ -644,7 +644,31 @@ sub ArticleAccountedTimeGet { $AccountedTime += $TimeUnit; } - return $AccountedTime; + return $AccountedTime if $AccountedTime; + + # article not found in time_accounting table, check if it is deleted and sum former times + return if !$DBObject->Prepare( + SQL => 'SELECT id FROM article_version WHERE source_article_id = ? AND article_delete = 1 ORDER BY id DESC', + Bind => [ \$Param{ArticleID} ], + Limit => 1, + ); + + if ( my ($DeletedArticleID) = $DBObject->FetchrowArray ) { + + # db query + return if !$DBObject->Prepare( + SQL => 'SELECT time_unit FROM time_accounting_version WHERE article_id = ?', + Bind => [ \$DeletedArticleID ], + ); + + # Sum the result rows, even if usually there is only one row. + while ( my ($TimeUnit) = $DBObject->FetchrowArray ) { + $TimeUnit =~ s/,/./g; + $AccountedTime += $TimeUnit; + } + + return $AccountedTime; + } } =head2 ArticleAccountedTimeDelete() From 7d8e8942ace18165ac006e48d8a22d3acc03dd2d Mon Sep 17 00:00:00 2001 From: Rui Alves Date: Mon, 9 Dec 2024 16:13:50 +0000 Subject: [PATCH 2/5] Issue #3939: Minor adjustment in return statement --- Kernel/System/Ticket/Article.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Kernel/System/Ticket/Article.pm b/Kernel/System/Ticket/Article.pm index 0c1859f39..9d0f41190 100644 --- a/Kernel/System/Ticket/Article.pm +++ b/Kernel/System/Ticket/Article.pm @@ -666,9 +666,9 @@ sub ArticleAccountedTimeGet { $TimeUnit =~ s/,/./g; $AccountedTime += $TimeUnit; } - - return $AccountedTime; } + + return $AccountedTime; } =head2 ArticleAccountedTimeDelete() From 100958b98d22cb6b51d280f4924dad3ea4c16b86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20H=C3=A4rter?= Date: Wed, 11 Dec 2024 11:10:35 +0100 Subject: [PATCH 3/5] Issue #3978: Updated POD to match code functionality. --- Kernel/System/Ticket/ArticleFeatures.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Kernel/System/Ticket/ArticleFeatures.pm b/Kernel/System/Ticket/ArticleFeatures.pm index dd38176f2..b9ffc7574 100644 --- a/Kernel/System/Ticket/ArticleFeatures.pm +++ b/Kernel/System/Ticket/ArticleFeatures.pm @@ -538,10 +538,10 @@ sub ArticleRestore { =head2 DeleteVersionData() -Delete all version data for an article. +Delete all version data for all articles in a ticket. my $Success = $ArticleFeaturesObject->DeleteVersionData( - ArticleID => 123, # required + TicketID => 123, # required ); Returns: From e9ada1c6532f65469fcd4e22b07b8b148e1fb723 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20H=C3=A4rter?= Date: Fri, 6 Dec 2024 09:03:58 +0100 Subject: [PATCH 4/5] Issue #3730: Automatically set PossibleNone to enabled when using an AutoComplete reference field to prevent interferences when validating an empty AutoComplete field. --- Kernel/Modules/AdminDynamicFieldReference.pm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Kernel/Modules/AdminDynamicFieldReference.pm b/Kernel/Modules/AdminDynamicFieldReference.pm index 62ca08db3..72b497a23 100644 --- a/Kernel/Modules/AdminDynamicFieldReference.pm +++ b/Kernel/Modules/AdminDynamicFieldReference.pm @@ -400,6 +400,7 @@ sub _AddAction { # differentiate only between autocomplete and dropdown $FieldConfig{EditFieldMode} = $FieldConfig{EditFieldMode} eq 'AutoComplete' ? 'AutoComplete' : 'Dropdown'; + $FieldConfig{PossibleNone} = $FieldConfig{EditFieldMode} eq 'AutoComplete' ? 1 : $FieldConfig{PossibleNone}; # multiselect excludes multivalue $FieldConfig{MultiValue} = $FieldConfig{Multiselect} ? 0 : $FieldConfig{MultiValue}; @@ -721,6 +722,7 @@ sub _ChangeAction { # differentiate only between autocomplete and dropdown $FieldConfig{EditFieldMode} = $FieldConfig{EditFieldMode} eq 'AutoComplete' ? 'AutoComplete' : 'Dropdown'; + $FieldConfig{PossibleNone} = $FieldConfig{EditFieldMode} eq 'AutoComplete' ? 1 : $FieldConfig{PossibleNone}; # multiselect excludes multivalue $FieldConfig{MultiValue} = $FieldConfig{Multiselect} ? 0 : $FieldConfig{MultiValue}; From e604197bd1f2fcd6865fc1b9114b72a5165c2237 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20H=C3=A4rter?= Date: Fri, 13 Dec 2024 10:16:49 +0100 Subject: [PATCH 5/5] Issue #3931: Fixed translation for MB in ar_SA. --- Kernel/Language/ar_SA.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kernel/Language/ar_SA.pm b/Kernel/Language/ar_SA.pm index 53f9386db..a0b418c8f 100644 --- a/Kernel/Language/ar_SA.pm +++ b/Kernel/Language/ar_SA.pm @@ -5303,7 +5303,7 @@ sub Data { 'Check to activate this date' => 'حدد لتمكين هذا التاريخ', '%s TB' => '‎%s تيرابايت (TB)', '%s GB' => '‎%s غيغابايت (GB)', - '%s MB' => 's% ميغاباي ‎(MB)', + '%s MB' => '‎%s ميغابايت (MB)', '%s KB' => '‎%s كيلوبايت (KB)', '%s B' => '‎%s بايت (B)', 'No Permission!' => 'لا توجد صلاحيات!',