Redirect add ticket to edit customer page if applicable
This commit is contained in:
parent
5d05043034
commit
5c306c1723
1 changed files with 13 additions and 1 deletions
|
|
@ -122,7 +122,7 @@ class TicketController extends BaseController
|
|||
]);
|
||||
}
|
||||
|
||||
public function addForm($customer_id)
|
||||
public function addForm(Request $req, $customer_id)
|
||||
{
|
||||
$this->denyAccessUnlessGranted('ticket.add', null, 'No access.');
|
||||
|
||||
|
|
@ -130,6 +130,7 @@ class TicketController extends BaseController
|
|||
$params['obj'] = new Ticket();
|
||||
$params['mode'] = 'create';
|
||||
$params['customer'] = false;
|
||||
$customer = false;
|
||||
|
||||
// get customer data
|
||||
if ($customer_id) {
|
||||
|
|
@ -148,6 +149,17 @@ class TicketController extends BaseController
|
|||
$params['ticket_types'] = TicketType::getCollection();
|
||||
$params['statuses'] = TicketStatus::getCollection();
|
||||
$params['other_ticket_type'] = TicketType::OTHER;
|
||||
$params['redirect_url'] = $this->generateUrl('ticket_list');
|
||||
|
||||
// set redirect url
|
||||
if ($customer)
|
||||
{
|
||||
$referer = $req->headers->get('referer');
|
||||
$cust_update_url = $this->generateUrl('customer_update', ['id' => $customer->getID()], UrlGeneratorInterface::ABSOLUTE_URL);
|
||||
|
||||
if ($referer == $cust_update_url)
|
||||
$params['redirect_url'] = $cust_update_url;
|
||||
}
|
||||
|
||||
// response
|
||||
return $this->render('ticket/form.html.twig', $params);
|
||||
|
|
|
|||
Loading…
Reference in a new issue