|
|
@@ -6,6 +6,8 @@ $location = Location::get($id);
|
|
|
if(!$location) throw new Exception("Location not found.");
|
|
|
if(!Core::$user->hasPermission($location)) throw new Exception("You do not have have permission to access this page.");
|
|
|
|
|
|
+$original_data = $location->getModelData();
|
|
|
+
|
|
|
$customer = $location->getCustomer();
|
|
|
|
|
|
$submit = http::value("submit");
|
|
|
@@ -39,7 +41,7 @@ if($submit) {
|
|
|
$location->area_manager = http::value("area_manager", "trim");
|
|
|
$location->area_manager_email = http::value("area_manager_email", "email");
|
|
|
|
|
|
- $location->closed = http::value("closed", "int");
|
|
|
+ $location->closed = http::value("closed", "int") ? 1 : 0;
|
|
|
|
|
|
if(empty($location->name)) $form_exception->addError("Name is required.");
|
|
|
if(empty($location->address_1)) $form_exception->addError("Location line 1 is required.");
|
|
|
@@ -99,10 +101,14 @@ if($submit) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ $modified_fields = $location->getModifiedFields();
|
|
|
+
|
|
|
if($form_exception->hasErrors()) throw $form_exception;
|
|
|
$success = $location->commit();
|
|
|
if(!$success) throw new Exception("Failed to edit location at this time. Please try again later.");
|
|
|
|
|
|
+ $location->logUpdate($original_data, $modified_fields);
|
|
|
+
|
|
|
// Venue types
|
|
|
$venue_type_ids = http::value("venue_type_ids", "int");
|
|
|
$venue_types = VenueType::query(["id" => $venue_type_ids]);
|