In the past I asked you about this... but then the answer was nooooo way :)
Daniel is going crazy again, I know....
I told you that I want to make custom fields that would store the user's password for backend access, ftp access etc. Right now when I need this information, I change the status of the ticket to private and I ask the user to enter the information in the ticket. Now when I'm ready, I edit the user's ticket and change the passwords with XXX.
It works, but I often forget to delete the passwords, or the user doesn't tell me that the problem is resolved etc. So I end up with private information in those tickets & I don't want something like this to land in the hands of bad people. Another issue is as you can imagine that people don't block those accounts or leave them active for very long time.
Since you didn't wanted to make such a field in the past I decided that I'll code this myself.
I have a very easy plan for this. Build a plugin. In the plugin one would be able to enter the custom field slugs and the user group that should see the entered information in them.
1. All users get to see the custom fields in the form.
2. Only an administrator (or a specified group) will see the stored information in the fields.
3. When a ticket is closed, I want to remove the value stored in those fields.
Point 1 is easy - ATS already works like this.
Point 2 -> I could create a template override here and remove the fields I don't want to show to the public. But do you actually have a plugin event here? I don't want to mess with template overrides that much. I saw that you do this:
$customFields = F0FModel::getTmpInstance('Tickets', 'AtsModel') ->setId($item->ats_ticket_id) ->loadCustomFields();
But in the ticketsModel I didn't see an event for onLoadedData or something of that sort? I see that you have some model behaviors, but I'm not sure how to use those? It seems that I can't use them in Plugins? I saw that the build query is triggering
// Call the behaviors
$this->modelDispatcher->trigger('onBeforeBuildQuery', array(&$this, &$query));
But can I use it in a plugin to actually load only the fields I want? ( I could modify the query to exclude fields with slug 'xyz')
3. I see that you are triggering OnContentChangeState in your models, but when I close the ticket using the ajax function, then nothing happens - this event is not triggered. When I change the state from public to private, then the event is triggered. Any ideas on this one?
Regards,
Daniel