Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Updated code that generates parking URLs so that if no URL is defined…

… in the config settings, then no URL is generated at all. I believe this was intended behaviour (as there is one location where the code checks whether the URL is blank and only adds an option if it isn't) but in all cases the config value had a query string appended, and therefore it would never be blank.

As well as ensuring that the contact's getReserveParkingSpaceUrl() function works properly, I have updated the code on the list_contacts view so that it only outputs the 'reserve parking space' option when a URL is available.  This was the only other place where the function is currently used.
  • Loading branch information...
commit 05e8c8d05d457ffc0eebe7498ddc33d0173bf588 1 parent fbd062f
@MarkMaldaba MarkMaldaba authored
View
6 application/models/contacts/Contact.class.php
@@ -607,7 +607,11 @@ function getToggleFavoriteUrl($redirect_to = null) {
* @return null
*/
function getReserveParkingSpaceUrl() {
- return config_option('parking space reservation url', '').'?license_plate='.$this->getLicensePlate();
+ $url = trim(config_option('parking space reservation url', ''));
+ if ($url != '') {
+ $url .= '?license_plate=' . $this->getLicensePlate();
+ }
+ return $url;
} // getReserveParkingSpaceUrl
/**
View
5 application/views/administration/list_contacts.php
@@ -26,7 +26,10 @@
<?php
$options = array();
if (logged_user()->isMemberOfOwnerCompany()) {
- $options[] = '<a href="' . $contact->getReserveParkingSpaceUrl() . '">' . lang('reserve parking space') . '</a>';
+ $parkingurl = trim($contact->getReserveParkingSpaceUrl());
+ if ($parkingurl != '') {
+ $options[] = '<a href="' . $parkingurl . '">' . lang('reserve parking space') . '</a>';
+ }
$options[] = '<a href="' . $contact->getShowMapUrl() . '">' . lang('show map') . '</a>';
$options[] = '<a href="' . logged_user()->getContact()->getShowRouteUrl($contact) . '">' . lang('show route') . '</a>';
}
Please sign in to comment.
Something went wrong with that request. Please try again.