<?php require_once '../lib/init.php'; if (!$session->isLoggedIn()) { redirect_to('../index.php'); } if (isset($_GET['tid']) && !empty($_GET['tid'])) { $tenant_id = (int) $_GET['tid']; if (!is_int($tenant_id)) { $mesg = "Rent arrears of this tenant could not be shown. An invalid value was sent through the URL"; $session->message($mesg); redirect_to("tenant.php?tid={$tenant_id}"); } else { $tenant = Tenant::findById($tenant_id); $arrears = Arrears::findByTenantId($tenant_id); } } include_layout_template('admin_header.php'); ?> <div id="container"> <h3>Actions</h3> <div id="side-bar"> <?php $actions = array("tenants" => "Tenants", "tenant_search" => "Search Tenant", "tenants_old" => "Previous Tenants"); echo create_action_links($actions); ?> </div> <div id="main-content"> <a class="new-item" href="record_arrears.php?tid=<?php
/** * Check to see if tenant has any outstanding rent arrears * @return boolean */ public function hasArrears() { $arrears = Arrears::findByTenantId($this->id); return !empty($arrears) ? true : false; }