Skip to content

Commit

Permalink
Fix for strict mode with location parent
Browse files Browse the repository at this point in the history
  • Loading branch information
snipe committed May 4, 2015
1 parent 71febc1 commit aab52d0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ public/uploads/logo.gif
public/uploads/logo.png
.siteflow
public/assets/.siteflow
.settings/settings.json
4 changes: 2 additions & 2 deletions app/config/version.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
return array (
'app_version' => 'v1.2.7-8',
'hash_version' => 'v1.2.7-8-g0d23332',
'app_version' => 'v1.2.7-9',
'hash_version' => 'v1.2.7-9-g68d8b10',
);
17 changes: 13 additions & 4 deletions app/controllers/admin/LocationsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function getIndex()
public function getCreate()
{
// Show the page
$location_options = array('' => '') + Location::lists('name', 'id');
$location_options = array('' => 'Top Level') + Location::lists('name', 'id');
return View::make('backend/locations/edit')->with('location_options',$location_options)->with('location',new Location);
}

Expand All @@ -62,7 +62,11 @@ public function postCreate()

// Save the location data
$location->name = e(Input::get('name'));
$location->parent_id = e(Input::get('parent_id'));
if (Input::get('parent_id')=='') {
$location->parent_id = null;
} else {
$location->parent_id = e(Input::get('parent_id',''));
}
$location->address = e(Input::get('address'));
$location->address2 = e(Input::get('address2'));
$location->city = e(Input::get('city'));
Expand Down Expand Up @@ -105,7 +109,7 @@ public function getEdit($locationId = null)
// Show the page
//$location_options = array('' => 'Top Level') + Location::lists('name', 'id');

$location_options = array('' => '') + DB::table('locations')->where('id', '!=', $locationId)->lists('name', 'id');
$location_options = array('' => 'Top Level') + DB::table('locations')->where('id', '!=', $locationId)->lists('name', 'id');
return View::make('backend/locations/edit', compact('location'))->with('location_options',$location_options);
}

Expand Down Expand Up @@ -137,7 +141,12 @@ public function postEdit($locationId = null)

// Update the location data
$location->name = e(Input::get('name'));
$location->parent_id = e(Input::get('parent_id'));
if (Input::get('parent_id')=='') {
$location->parent_id = null;
} else {
$location->parent_id = e(Input::get('parent_id',''));
}

$location->address = e(Input::get('address'));
$location->address2 = e(Input::get('address2'));
$location->city = e(Input::get('city'));
Expand Down

0 comments on commit aab52d0

Please sign in to comment.