evolvewh Posted May 1, 2017 Report Posted May 1, 2017 How do I reorder the support ticket departments on the clients page? Can I do it through the database or through the files? Quote
0 evolvewh Posted May 1, 2017 Author Report Posted May 1, 2017 I edited the id in the support_departments table and that appears to work. If there's a better way, please let me know. Quote
0 evolvewh Posted May 1, 2017 Author Report Posted May 1, 2017 This wasn't the best idea because it changed the department for all support tickets as well. I don't recommend doing this! Quote
0 Adam Posted May 1, 2017 Report Posted May 1, 2017 14 hours ago, evolvewh said: How do I reorder the support ticket departments on the clients page? Can I do it through the database or through the files? What ordering do you want? Blesta clients can click on a column and change the order they see. If you want to change the default, take a look at the following settings in support_manager/controllers/client_tickets.php 62 public function index() 63 { 64 $status = (isset($this->get[0]) ? $this->get[0] : 'not_closed'); 65 $page = (isset($this->get[1]) ? (int)$this->get[1] : 1); 66 $sort = (isset($this->get['sort']) ? $this->get['sort'] : 'last_reply_date'); 67 $order = (isset($this->get['order']) ? $this->get['order'] : 'desc'); Lines 66 and 67 is most likely what you are after. The 'last_reply_date' and 'desc' are the default values when a Blesta client does not do manual sorting by clicking on a column header. -Adam Quote
0 evolvewh Posted May 1, 2017 Author Report Posted May 1, 2017 Adam, Thanks for the help. I think you're trying to show me how to order the existing tickets (open, awaiting reply, closed, etc) but I was trying to re order the actual list of departments that a client sees before they open a ticket. My way of editing the database works enough and I can deal with the departments that got changed in the support tickets. Thanks! Quote
0 Adam Posted May 1, 2017 Report Posted May 1, 2017 23 minutes ago, evolvewh said: Adam, Thanks for the help. I think you're trying to show me how to order the existing tickets (open, awaiting reply, closed, etc) but I was trying to re order the actual list of departments that a client sees before they open a ticket. My way of editing the database works enough and I can deal with the departments that got changed in the support tickets. Thanks! Er ya, I totally missed that part in your original post. My bad. That is a bit more complicated and would require more changes to get done right -- modify the Blesta Admin GUI to allow admins reorder departments, which would require controller code changes as well as add an extra column to the database schema. No simple one line fix. I would highly recommend and avoid changing the id column in the database. That id is the primary key and used in multiple tables as you noted earlier. The hackiest solution I can think of would be to modify views/default/client_tickets_departments.pdt and hard code the order there. I have not tested this code but something like this should work: 20 $departmentsSorted = array(); 21 foreach ($this->Html->ifSet($departments, []) as $department) { 22 if($department->name == 'Test 2') 23 $departmentedSorted = array_unshift($departmentsSorted,$department); 24 else if($department->name == 'Test 3') 25 $departmentedSorted = array_unshift($departmentsSorted,$department); 26 // All other departments get pushed to the end 27 else 28 $departmentedSorted = array_push($departmentsSorted,$department); 29 } 30 foreach ($this->Html->ifSet($departmentsSorted, []) as $department) { Test 3 is the name of the department and it will be shown first. array_unshift inserts to the front of the list while push inserts to the end. You could also use $department->id which would allow you to change the department name without having to re-do this file. If you are looking for something more complex, then you need to get some custom work done. -Adam Michael 1 Quote
0 evolvewh Posted May 1, 2017 Author Report Posted May 1, 2017 It's too late now because I already jumped the gun and edited the ID's yesterday. What I should have done (as you mentioned in your last post): I should have edited each existing department and changed the name and description so that the ID was not altered anywhere. I only changed 2 departments so it doesn't look like it was a huge deal but it could make a real mess if more were changed. Thanks! Quote
0 Blesta Addons Posted May 1, 2017 Report Posted May 1, 2017 14 hours ago, evolvewh said: I edited the id in the support_departments table and that appears to work. If there's a better way, please let me know. you shouldn't do this , it will impact the whole tickets you have in the system . a simple way without changing a lot of file is rename the department with a leading number as you want the order something like 04- Support 01- Sales 03- Billing 02- Domaines then in the client_tickets.php in departments() function add the sort array before you set in in the view. ksort($departements); i hope this will work for you . activa and evolvewh 2 Quote
0 evolvewh Posted May 1, 2017 Author Report Posted May 1, 2017 1 hour ago, Blesta Addons said: you shouldn't do this , it will impact the whole tickets you have in the system . a simple way without changing a lot of file is rename the department with a leading number as you want the order something like 04- Support 01- Sales 03- Billing 02- Domaines then in the client_tickets.php in departments() function add the sort array before you set in in the view. ksort($departements); i hope this will work for you . That's a lot smarter idea. Thanks! Blesta Addons 1 Quote
Question
evolvewh
How do I reorder the support ticket departments on the clients page? Can I do it through the database or through the files?
8 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.