1
0

location_delete_note.php 575 B

12345678910111213141516171819202122
  1. <?php
  2. /**
  3. * @var int $id
  4. * @var int $note_id
  5. */
  6. $user = Core::$user;
  7. $location = Location::get($id);
  8. if(!$location) throw new Exception("Location not found.");
  9. if(!Core::$user->hasPermission($location)) throw new Exception("You do not have have permission to access this page.");
  10. $note = LocationNote::get($note_id);
  11. if(!$note || $note->location_id != $location->id) throw new Exception("Note not found.");
  12. $note->dts_deleted = DB::dts();
  13. $note->commit();
  14. Core::addAlert("success", "Note deleted successfully.");
  15. HTTP::redirect("/account/locations/$location->id");