[Rt-commit] rt branch, 5.0/admin-cfv-bulk-delete, created. rt-5.0.1-544-gc5d83fd2cb

? sunnavy sunnavy at bestpractical.com
Wed Jun 23 09:23:23 EDT 2021


The branch, 5.0/admin-cfv-bulk-delete has been created
        at  c5d83fd2cb77c71e6f0ab41535558526123c67a7 (commit)

- Log -----------------------------------------------------------------
commit c5d83fd2cb77c71e6f0ab41535558526123c67a7
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Jun 23 14:46:32 2021 +0800

    Support to delete custom field values on form submit
    
    It was dropped when we migrated to ajaxified custom field values
    modification in 4.4/ajax-admin-custom-field-values. Later we added
    related checkboxes back(useful to bulk delete values), but the process
    code was missed.

diff --git a/share/html/Admin/CustomFields/Modify.html b/share/html/Admin/CustomFields/Modify.html
index 90828c2f8f..324630a7ab 100644
--- a/share/html/Admin/CustomFields/Modify.html
+++ b/share/html/Admin/CustomFields/Modify.html
@@ -443,8 +443,17 @@ if ( $ARGS{'Update'} && $id ne 'new' ) {
         push @results, $msg;
     }
 
-    # Update any existing values
     my $paramtag = "CustomField-". $CustomFieldObj->Id ."-Value";
+    # Delete any fields that want to be deleted
+    foreach my $key ( keys %ARGS ) {
+        next unless $key =~ /^Delete-$paramtag-(\d+)$/;
+        my ($val, $msg) = $CustomFieldObj->DeleteValue( $1 );
+        my $cf_delete = $ARGS{ $paramtag . "-$1-Name" };
+        $msg = loc("Custom field value [_1] deleted", $cf_delete) if $val;
+        push (@results, $msg);
+    }
+
+    # Update any existing values
     my $values = $CustomFieldObj->ValuesObj;
     while ( my $value = $values->Next ) {
         foreach my $attr (qw(Name Description SortOrder Category)) {

-----------------------------------------------------------------------


More information about the rt-commit mailing list