/** * Test for copyLeaveBroughtForward() */ public function testCopyLeaveBroughtForward() { $broughtForward = new LeaveQuota(); $res = $broughtForward->copyLeaveBroughtForward(2009, 2010); $this->assertTrue($res); $query = "SELECT * FROM hs_hr_employee_leave_quota WHERE year = '2010' AND leave_type_id = 'LTY012' AND employee_id = '16'"; $result = mysql_query($query); $row = mysql_fetch_array($result); $this->assertEquals(10, $row['leave_brought_forward'], $row['leave_brought_forward']); }
public function copyLeaveBroughtForwardFromLastYear($currYear) { if ($_SESSION['isAdmin'] !== 'Yes') { trigger_error("Unauthorized access", E_USER_NOTICE); } $leaveQuotaObj = new LeaveQuota(); $result = $leaveQuotaObj->copyLeaveBroughtForward($currYear - 1, $currYear); $redirectionPrefix = "?leavecode=Leave&action=Leave_Summary&year={$currYear}&id=0&message="; if ($result) { $this->redirect(null, array($redirectionPrefix . "LEAVE_BROUGHT_FORWARD_COPY_SUCCESS")); } else { $this->redirect(null, array($redirectionPrefix . "LEAVE_BROUGHT_FORWARD_COPY_FAILURE")); } }