From 2b2c7483881d019b77ed2e3183eda9999ebf5497 Mon Sep 17 00:00:00 2001 From: snapterzmax Date: Wed, 20 Mar 2019 11:04:46 +0700 Subject: [PATCH 1/2] Multiple leave request approval bug When we approve a single leave request multiple time, the employee used leave is increased as well. Thus, if the request has already been approved, no need to update employee used leave --- .../default/controllers/LeaverequestController.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/application/modules/default/controllers/LeaverequestController.php b/application/modules/default/controllers/LeaverequestController.php index f1827403f..5743d163e 100644 --- a/application/modules/default/controllers/LeaverequestController.php +++ b/application/modules/default/controllers/LeaverequestController.php @@ -1066,10 +1066,12 @@ public function updateleavedetailsAction() $message = '
Hi,
The below leave(s) has been cancelled.
'; }elseif(sapp_Global::_decrypt($status)=='Approved'){ $leavestatus =2; - if(!empty($leavetypeArr)) { - if($leavetypeArr[0]['leavepredeductable'] == 1) { - $updateemployeeleave = $leaverequestmodel->updateemployeeleaves($leave_details['appliedleavescount'],$leave_details['user_id']); - } + if($leave_details['leavestatus']!='Approved') { + if(!empty($leavetypeArr)) { + if($leavetypeArr[0]['leavepredeductable'] == 1) { + $updateemployeeleave = $leaverequestmodel->updateemployeeleaves($leave_details['appliedleavescount'],$leave_details['user_id']); + } + } } $successmsg ='Leave request approved succesfully.'; $subject = 'Leave request approved'; From 541cce3087428e956a7c318ee9336fd741b38579 Mon Sep 17 00:00:00 2001 From: snapterzmax Date: Tue, 3 Sep 2019 10:17:19 +0700 Subject: [PATCH 2/2] Add or Deduct Employee Leave with decimal place When add or deduct employee leave directly by HR, we should allow half day (+/- 0.5 ) add or deduct --- application/modules/default/forms/empleaves.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/application/modules/default/forms/empleaves.php b/application/modules/default/forms/empleaves.php index 57ff4ee1d..55b92e5a2 100644 --- a/application/modules/default/forms/empleaves.php +++ b/application/modules/default/forms/empleaves.php @@ -34,14 +34,14 @@ public function init() $emp_leave_limit = new Zend_Form_Element_Text('leave_limit'); - $emp_leave_limit->setAttrib('maxLength', 3); + $emp_leave_limit->setAttrib('maxLength', 4); $emp_leave_limit->addFilter(new Zend_Filter_StringTrim()); $emp_leave_limit->setRequired(true); $emp_leave_limit->addValidator('NotEmpty', false, array('messages' => 'Please enter leave limit for current year.')); $emp_leave_limit->addValidator("regex",true,array( - 'pattern'=>'/^(\-?[1-9]|\-?[1-9][0-9])$/', + 'pattern'=>'/^((\-?[0-9]|\-?[1-9][0-9])\.?[5]?)$/', 'messages'=>array( 'regexNotMatch'=>'Leave limit must be in the range of 0 to 100.' @@ -71,4 +71,4 @@ public function init() $this->setElementDecorators(array('ViewHelper')); } -} \ No newline at end of file +}