Edgewall Software
Modify

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#12585 closed defect (fixed)

Batch-Modify fails on keywords and cc fields

Reported by: helge.wiethoff@… Owned by: Jun Omae
Priority: normal Milestone: 1.0.14
Component: ticket system Version: 1.0.12
Severity: normal Keywords: batch-modify, cc, keywords
Cc: Branch:
Release Notes:

Fixed batch-modify not working to list fields and naming conflicts in the form with existing custom fields.

API Changes:
Internal Changes:

Description

Hi all,

i am not able to use TracBatchModify for keywords or cc fields in Trac 1.0.12. There is no error message. Other fields (no list fields) are handled well.

The Debug Log is not very revealing:

2016-09-13 12:35:02,140 Trac[main] DEBUG: Dispatching <RequestWithSession "POST '/batchmodify'">
2016-09-13 12:35:02,141 Trac[session] DEBUG: Retrieving session for ID u'xxx'
2016-09-13 12:35:02,145 Trac[main] DEBUG: Negotiated locale: None -> de
2016-09-13 12:35:05,046 Trac[main] DEBUG: Dispatching <RequestWithSession "GET '/query?status=assigned&status=closed&status=new&status=reopened&col=id&col=summary&col=status&col=type&col=priority&col=milestone&col=component&order=priority'">

Cheers, Helge

Attachments (0)

Change History (14)

comment:1 by Jun Omae, 8 years ago

Keywords: batch-modify cc keywords added; BatchModify Keywords removed
Milestone: 1.0.14
Priority: lownormal
Severity: trivialnormal

Good catch. Reproduced on demo-1.0. That's bad.

Adding blah@localhost to cc and #12585 to keywords of #4000,#4002 doesn't work.

Last edited 8 years ago by Ryan J Ollos (previous) (diff)

comment:2 by Jun Omae, 8 years ago

Owner: set to Jun Omae
Status: newassigned

Ah, my bad. It seems this issue is introduced in [14724] (#12364).

Could you please try the following patch?

  • trac/ticket/batch.py

    diff --git a/trac/ticket/batch.py b/trac/ticket/batch.py
    index 1b2c6b7c5..98e41762a 100644
    a b class BatchModifyModule(Component):  
    167167                t = Ticket(self.env, int(id))
    168168                _values = new_values.copy()
    169169                for field in list_fields:
    170                     if field in new_values:
     170                    mode = req.args.get('batchmod_value_' + field + '_mode')
     171                    if mode:
    171172                        old = t.values[field] if field in t.values else ''
    172                         new = new_values[field]
    173                         mode = req.args.get('batchmod_value_' + field +
    174                                             '_mode')
     173                        new = req.args.get('batchmod_value_' + field +
     174                                           '_primary')
    175175                        new2 = req.args.get('batchmod_value_' + field +
    176176                                            '_secondary', '')
    177177                        _values[field] = self._change_list(old, new, new2,

comment:3 by Jun Omae, 8 years ago

I noticed another issue in batch-modify feature with list format of custom fields.

  1. Custom fields have the following:
    [ticket-custom]
    foo = text
    foo.format = list
    foo_secondary = text
    
  2. Visit query view and select some tickets.
  3. Select foo field in Add Field drop down in batch-modify form.
  4. Select add / remove in drop down and enter blahblah to remove text field.
  5. Submit, foo_secondary field is wrongly updated with blahblah.

Confirmed with Trac 1.0.10 (prior to [14724]) and 1.0.13.

Last edited 8 years ago by Jun Omae (previous) (diff)

comment:4 by anonymous, 8 years ago

Hi Jun!

The patch works like a charm :) Thank you very much. But there is a minor problem with the email-notifaction: When email notification is enabled, the batch modification is not recognized:

MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: base64
From: Trac <trac@example.com>
X-Mailer: Trac 1.0.13, by Edgewall Software
X-Trac-Project: Trac
Date: Wed, 14 Sep 2016 08:25:51 +0000
Reply-To: <trac@example.com>
Subject: [Trac] Batch modify: #2471


Batch modification to #2471 by wiethoff:


--
Tickets URL: <https://trac.example.com/it/query?id=2471>
Trac <https://trac.example.com/it>
Trac

Again, thanks for your fast reply.

comment:5 by Jun Omae, 8 years ago

Thanks for the testing!

The issue in notification by batch-modify to list fields might be related to #11271 #12174. I try to fix both this issue and #11271.

Last edited 8 years ago by Jun Omae (previous) (diff)

comment:6 by Jun Omae, 8 years ago

Proposed changes for this issue and naming conflicts in [374808e87/jomae.git] (jomae.git@t12585).

batchmod_secondary_<name> would be used instead of batchmod_value_<name>_secondary to avoid the naming conflicts.

comment:7 by Ryan J Ollos, 8 years ago

The changes work well for me.

comment:8 by Jun Omae, 8 years ago

Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Thanks for the reviewing! Committed in [15157] and merged in [15158-15159].

comment:9 by helge.wiethoff@…, 8 years ago

in my case the generated mail is still empty :-(

in reply to:  9 comment:10 by Jun Omae, 8 years ago

Replying to helge.wiethoff@…:

in my case the generated mail is still empty :-(

That issue has been reported in #11271, not fixed yet.

comment:11 by helge.wiethoff@…, 8 years ago

Isnt #11271 about "a better representation"? I see no output at all. Just:

Batch modification to #2541 by wiethoff:

And i thought this was fixed in [15157] but i had no luck with this patch.

comment:12 by Jun Omae, 8 years ago

#12174 and #11271 are the same issue.

And i thought this was fixed in [15157] but i had no luck with this patch.

I know.

in reply to:  12 comment:13 by Jun Omae, 8 years ago

Replying to Jun Omae:

#12174 and #11271 are the same issue.

And i thought this was fixed in [15157] but i had no luck with this patch.

I know.

The type of #11271 is changed to defect.

comment:14 by helge.wiethoff@…, 8 years ago

thanks for the clarification.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jun Omae.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jun Omae to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.