Opened 7 years ago

Closed 7 years ago

# Remove Internal checkbox if ticket_policy is disabled

Reported by: Owned by: josh@… Russ Tyndall normal TimingAndEstimationPlugin normal patch 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?

### comment:1 Changed 7 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 7 years ago by Russ Tyndall

Resolution: → fixed new → closed

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 \

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

Patch

### comment:3 Changed 7 years ago by josh@…

Resolution: fixed closed → reopened

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 7 years ago by Russ Tyndall

Keywords: patch added → fixed reopened → closed

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

Action
as closed The owner will remain Russ Tyndall.
The resolution will be deleted. Next status will be 'reopened'.