Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

osTicket v1.10 (stable) and Maintenance Release v1.9.15 are now available! Go get it now

Restrict the Users/Customer Portal to a fixed number of Closed Tickets

I have searched the web and the forum.  I have seen number of people discussing why and why not to restrict the number of closed ticket that a user/customer can see, but I had not seen any solution.  This has been a business decision made by our management for many business reasons. I just have the task to find a way to do it.

Currently using v1.10rc

I have poked my head around the \include\client\tickets.inc.php, but did not see where I or how I could put limit on closed tickets returned.

They would like to limit the user/customer's closed tickets to the last month or last XX number of closed tickets. 

Anyone tried to do this?  Or can anyone tell me how to do this?

Please, I am not wanting to argue the rights or wrong of dong this, I just need a solution.

David

Comments

  • I can think of two ways to do this.

    1. delete old tickets.

    2. locate where in the code the query to display tickets is created and run... and alter it to only ever pull the 5 most recent ones.
  • Thank you for the response. I laugh a bit as your 1st option or answer was may answer, but they want to keep the tickets.  Am I in the right place for the sql code...\include\client\tickets.inc.php.

    I did poke around and did not see anywhere , that I could limit it like you suggest in your option 2.

    David

  • edited March 2016
    alter the SQL query to limit to 5 and order by date IF the status selected is closed. 

    There's a block of code that looks like:

    if($status && isset($states[$status])){
        $qwhere.=' AND status.id='.db_input($states[$status]);
    }

    You can add the condition to the if statement here that

    if (the selected status is closed)
    {
    $qwhere.='AND status.id='.db_input($states[$status]).' ORDER BY created DESC LIMIT 5'
    }
  • Thank you for the help, but I do not see anything block of code like that in the file \include\client\tickets.inc.php of v1.10rc 

    David
  • Correct.  The 1.10 branch divorces much of the hard coded SQL in the product from the code in favor of ORM.  This means that you would have to learn ORM to modify the SQL queries.

    The purpose of this change is to eventually support other databases (such as Oracle, MS SQL, Postgres, etc)
  • Ok that is understandable.

    So any suggestions or can you show me how to implement this limit? 

    David
  • Sorry that's not something that I have really done.
  • Anyone else have any coding ideas for fixing this issue in v1.10rc2....

    I need to at least set to restrict the number of closed ticket that a user/customer can see to last 5 or 10 tickets.

    I have poked my head around the \include\client\tickets.inc.php, but did not see where I or how I could put limit on closed tickets returned. The code is too large to list here but I put the folder info for where the page is stored.


    Thank you
    David
Sign In or Register to comment.