Redirect ticket form back to customer update path if applicable
This commit is contained in:
parent
dd5fbf7cd6
commit
5d05043034
2 changed files with 17 additions and 3 deletions
|
|
@ -12,6 +12,7 @@ use Doctrine\ORM\Query;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||||
|
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||||
|
|
||||||
use DateTime;
|
use DateTime;
|
||||||
|
|
||||||
|
|
@ -246,7 +247,7 @@ class TicketController extends BaseController
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updateForm($id)
|
public function updateForm(Request $req, $id)
|
||||||
{
|
{
|
||||||
$this->denyAccessUnlessGranted('ticket.update', null, 'No access.');
|
$this->denyAccessUnlessGranted('ticket.update', null, 'No access.');
|
||||||
|
|
||||||
|
|
@ -263,11 +264,24 @@ class TicketController extends BaseController
|
||||||
|
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
|
||||||
|
$customer = $obj->getCustomer();
|
||||||
|
|
||||||
// get parent associations
|
// get parent associations
|
||||||
$params['customer'] = $obj->getCustomer();
|
$params['customer'] = $customer;
|
||||||
$params['ticket_types'] = TicketType::getCollection();
|
$params['ticket_types'] = TicketType::getCollection();
|
||||||
$params['statuses'] = TicketStatus::getCollection();
|
$params['statuses'] = TicketStatus::getCollection();
|
||||||
$params['other_ticket_type'] = TicketType::OTHER;
|
$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;
|
||||||
|
}
|
||||||
|
|
||||||
$params['obj'] = $obj;
|
$params['obj'] = $obj;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,7 @@
|
||||||
text: 'Your changes have been saved!',
|
text: 'Your changes have been saved!',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
onClose: function() {
|
onClose: function() {
|
||||||
window.location.href = "{{ url('ticket_list') }}";
|
window.location.href = "{{ redirect_url }}";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}).fail(function(response) {
|
}).fail(function(response) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue