Modify

Opened 14 years ago

Closed 14 years ago

#7142 closed enhancement (fixed)

Remove Internal checkbox if ticket_policy is disabled

Reported by: josh@… Owned by: Russ Tyndall
Priority: normal Component: TimingAndEstimationPlugin
Severity: normal Keywords: patch
Cc: Trac Release: 0.11

Description

If the timingandestimationplugin.ticket_policy component is disabled (which I am assuming is what deals with the Internal? checkbox), then could that checkbox be automatically removed? Or at the very least, not automatically add itself back in to the trac.ini file?

Attachments (1)

timingandestimation.diff (4.1 KB) - added by josh@… 14 years ago.
Patch

Download all attachments as: .zip

Change History (5)

comment:1 Changed 14 years ago by josh@…

Any chance of this happening? Or failing that, a point in the right direction so we can create a patch for it ourselves?

comment:2 Changed 14 years ago by Russ Tyndall

Resolution: fixed
Status: newclosed

I dont use this branch regularly (though I maintain and test it), and so have had not real pressing urge to do this. Is there a problem with simply setting its default to false and then hiding it with the permissions system from everyone?

UNDEBBUGED: something like this in trac.ini

[field settings]
fields = internal ...
interal.permissions = ALWAYS:hide

[ticket-custom]
internal.value = 0

If this somehow doesnt meet your need, please feel free to reopen this ticket.


If you actually want it gone, you will have to comment out the following lines in api.py then remove the config for the field from your trac.ini (and then hope that I didnt miss anyplace in this list)

# ln:164 ticket_fields_need_upgrade
                         self.config.get( ticket_custom, "internal") and \

# ln:195 - 207? do_ticket_field_upgrade
        if not self.config.get( ticket_custom, "internal"):
            self.config.set(ticket_custom, "internal", "checkbox")
            self.config.set(ticket_custom, "internal.value", "0")
            self.config.set(ticket_custom, "internal.label", "Internal?")
            self.config.set(ticket_custom,"internal.order", "5")

        if "InternalTicketsPolicy" not in self.config.getlist("trac", "permission_policies"):
            perms = ["InternalTicketsPolicy"]
            other_policies = self.config.getlist("trac", "permission_policies")
            if "DefaultPermissionPolicy" not in other_policies:
                perms.append("DefaultPermissionPolicy")
            perms.extend( other_policies )
            self.config.set("trac", "permission_policies", ', '.join(perms))

I hope this meets your needs, Russ Tyndall

Changed 14 years ago by josh@…

Attachment: timingandestimation.diff added

Patch

comment:3 Changed 14 years ago by josh@…

Resolution: fixed
Status: closedreopened

I've added a patch for the things I changed to achieve this - it's a little neater that your solution. Basically, I moved all the stuff to do with 'Internal' out into ticket_policy.py, so that disabling that gets rid of the field.

I may have missed a couple of bits in api.py, but I'm sure those won't be hard to fix up if you decide to use the patch.

(Feel free to reclose, just making sure you get the notification about it).

comment:4 Changed 14 years ago by Russ Tyndall

Keywords: patch added
Resolution: fixed
Status: reopenedclosed

Thanks for your patch, I will make note of it on the TimingAndEstimationPlugin page so it can be easily found by myself and others in the future.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Russ Tyndall.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.