IceHrm v18.0

This commit is contained in:
Thilina Hasantha
2016-08-04 14:27:59 +05:30
parent 9e243073df
commit a10fbba14a
882 changed files with 90619 additions and 2546 deletions

View File

@@ -41,7 +41,7 @@ class AttendanceActionManager extends SubActionManager{
//check if dates are differnet
if(!empty($outDate) && $inDate != $outDate){
return new IceResponse(IceResponse::ERROR,"Attendance entry should be within a single day");
return new IceResponse(IceResponse::ERROR,LanguageManager::tran("Attendance entry should be within a single day"));
}
//compare dates
@@ -102,4 +102,4 @@ class AttendanceActionManager extends SubActionManager{
}
}
}

View File

@@ -38,6 +38,8 @@ if (!class_exists('AttendanceAdminManager')) {
$this->addCalculationHook('AttendanceUtil_getTimeWorkedHours','Total Hours from Attendance','AttendanceUtil','getTimeWorkedHours');
$this->addCalculationHook('AttendanceUtil_getRegularWorkedHours','Total Regular Hours from Attendance','AttendanceUtil','getRegularWorkedHours');
$this->addCalculationHook('AttendanceUtil_getOverTimeWorkedHours','Total Overtime Hours from Attendance','AttendanceUtil','getOverTimeWorkedHours');
$this->addCalculationHook('AttendanceUtil_getWeeklyRegularWorkedHours','Total Weekly Regular Hours from Attendance','AttendanceUtil','getWeeklyBasedRegularHours');
$this->addCalculationHook('AttendanceUtil_getWeeklyOverTimeWorkedHours','Total Weekly Overtime Hours from Attendance','AttendanceUtil','getWeeklyBasedOvertimeHours');
}
}
@@ -249,6 +251,80 @@ if (!class_exists('AttendanceUtil')) {
$atSum = $this->getAttendanceSummary($employeeId, $startDate, $endDate);
return round(($atSum['o']/60)/60,2);
}
public function getWeeklyBasedRegularHours($employeeId, $startDate, $endDate){
$atSum = $this->getWeeklyBasedOvertimeSummary($employeeId, $startDate, $endDate);
return round(($atSum['r']/60)/60,2);
}
public function getWeeklyBasedOvertimeHours($employeeId, $startDate, $endDate){
$atSum = $this->getWeeklyBasedOvertimeSummary($employeeId, $startDate, $endDate);
return round(($atSum['o']/60)/60,2);
}
public function getWeeklyBasedOvertimeSummary($employeeId, $startDate, $endDate){
$attendance = new Attendance();
$atTimeByWeek = array();
//Find weeks starting from sunday and ending from saturday in day period
$weeks = $this->getWeeklyDays($startDate,$endDate);
foreach($weeks as $k=>$week){
$startTime = $week[0]." 00:00:00";
$endTime = $week[count($week) - 1]." 23:59:59";
$atts = $attendance->Find("employee = ? and in_time >= ? and out_time <= ?",array($employeeId, $startTime, $endTime));
foreach($atts as $atEntry){
if($atEntry->out_time == "0000-00-00 00:00:00" || empty($atEntry->out_time)){
continue;
}
if(!isset($atTimeByWeek[$k])){
$atTimeByWeek[$k] = 0;
}
$diff = strtotime($atEntry->out_time) - strtotime($atEntry->in_time);
if($diff < 0){
$diff = 0;
}
$atTimeByWeek[$k] += $diff;
}
}
$overtimeStarts = SettingsManager::getInstance()->getSetting('Attendance: Overtime Start Hour');
$overtimeStarts = (is_numeric($overtimeStarts))?floatval($overtimeStarts)*60*60*5:0;
$regTime = 0;
$overTime = 0;
foreach($atTimeByWeek as $value){
if($value > $overtimeStarts){
$regTime += $overtimeStarts;
$overTime = $value - $overtimeStarts;
}else{
$regTime += $value;
}
}
return array('r'=>$regTime,'o'=>$overTime);
}
private function getWeeklyDays($startDate,$endDate){
$start = new DateTime($startDate);
$end = new DateTime($endDate.' 23:59');
$interval = new DateInterval('P1D');
$dateRange = new DatePeriod($start, $interval, $end);
$weekNumber = 1;
$weeks = array();
foreach ($dateRange as $date) {
$weeks[$weekNumber][] = $date->format('Y-m-d');
if ($date->format('w') == 6) {
$weekNumber++;
}
}
return $weeks;
}
}
}

View File

@@ -2,17 +2,17 @@
<div class="small-box bg-yellow">
<div class="inner">
<h3>
Attendance
<t>Attendance</t>
</h3>
<p id="numberOfAttendanceLastWeek">
#_numberOfAttendanceLastWeek_# Entries Last Week
#_numberOfAttendanceLastWeek_# <t>Entries Last Week</t>
</p>
</div>
<div class="icon">
<i class="ion ion-clock"></i>
</div>
<a href="#_moduleLink_#" class="small-box-footer" id="attendanceLink">
Monitor Attendance <i class="fa fa-arrow-circle-right"></i>
<t>Monitor Attendance</t> <i class="fa fa-arrow-circle-right"></i>
</a>
</div>
</div>
</div>

View File

@@ -28,11 +28,8 @@ include APP_BASE_PATH.'modulejslibs.inc.php';
?><div class="span9">
<ul class="nav nav-tabs" id="modTab" style="margin-bottom:0px;margin-left:5px;border-bottom: none;">
<li class="active"><a id="tabAttendance" href="#tabPageAttendance">Monitor Attendance</a></li>
<li class=""><a id="tabAttendanceStatus" href="#tabPageAttendanceStatus">Current Clocked In Status</a></li>
<!--
<li class=""><a id="tabAttendanceData" href="#tabPageAttendanceData">Attendance Data Update</a></li>
-->
<li class="active"><a id="tabAttendance" href="#tabPageAttendance"><?=LanguageManager::tran('Monitor Attendance')?></a></li>
<li class=""><a id="tabAttendanceStatus" href="#tabPageAttendanceStatus"><?=LanguageManager::tran('Current Clocked In Status')?></a></li>
</ul>
<div class="tab-content">
@@ -52,20 +49,6 @@ include APP_BASE_PATH.'modulejslibs.inc.php';
</div>
</div>
<!--
<div class="tab-pane" id="tabPageAttendanceData">
<div class="control-group" id="field__id_">
<div class="controls">
<textarea class="input-xxlarge" placeholder="Insert CSV data to submit" type="textarea" width="96%" rows="100" id="attendanceData" name="attendanceData"></textarea>
</div>
</div>
<div class="control-group">
<div class="controls">
<button onclick="return false;" class="btn">Update Attendance Data</button>
</div>
</div>
</div>
-->
</div>
@@ -79,4 +62,4 @@ modJsList['tabAttendanceStatus'].setShowAddNew(false);
var modJs = modJsList['tabAttendance'];
</script>
<?php include APP_BASE_PATH.'footer.php';?>
<?php include APP_BASE_PATH.'footer.php';?>

View File

@@ -87,6 +87,20 @@ if (!class_exists('CompanyStructure')) {
}
}
}
public static function isHeadOfCompanyStructure($companyStructureId, $profileId){
$companyStructure = new CompanyStructure();
$companyStructure->Load("id = ?",array($companyStructureId));
if(isset($companyStructure->heads) && !empty($companyStructure->heads)){
$heads = json_decode($companyStructure->heads);
if(is_array($heads) && !empty($heads) && in_array($profileId, $heads)){
return true;
}
}
return false;
}
}
}
@@ -108,4 +122,4 @@ if (!class_exists('Timezone')) {
}
}
}
}

View File

@@ -2,16 +2,16 @@
<div class="small-box bg-green">
<div class="inner">
<h3>Company</h3>
<h3><t>Company</t></h3>
<p id="numberOfCompanyStuctures">
#_numberOfCompanyStuctures_# Departments
#_numberOfCompanyStuctures_# <t>Departments</t>
</p>
</div>
<div class="icon">
<i class="ion ion-shuffle"></i>
</div>
<a href="#_moduleLink_#" class="small-box-footer" id="companyLink">
Manage Company <i class="fa fa-arrow-circle-right"></i>
<t>Manage</t> <t>Company</t> <i class="fa fa-arrow-circle-right"></i>
</a>
</div>
</div>
</div>

View File

@@ -54,8 +54,8 @@ path.link {
<div class="span9">
<ul class="nav nav-tabs" id="modTab" style="margin-bottom:0px;margin-left:5px;border-bottom: none;">
<li class="active"><a id="tabCompanyStructure" href="#tabPageCompanyStructure">Company Structure</a></li>
<li><a id="tabCompanyGraph" href="#tabPageCompanyGraph">Company Graph</a></li>
<li class="active"><a id="tabCompanyStructure" href="#tabPageCompanyStructure"><?=LanguageManager::tran('Company Structure')?></a></li>
<li><a id="tabCompanyGraph" href="#tabPageCompanyGraph"><?=LanguageManager::tran('Company Graph')?></a></li>
</ul>
<div class="tab-content">
@@ -93,4 +93,4 @@ modJsList['tabCompanyGraph'] = new CompanyGraphAdapter('CompanyStructure');
var modJs = modJsList['tabCompanyStructure'];
</script>
<?php include APP_BASE_PATH.'footer.php';?>
<?php include APP_BASE_PATH.'footer.php';?>

View File

@@ -43,7 +43,8 @@ CompanyStructureAdapter.method('getFormFields', function() {
[ "type", {"label":"Type","type":"select","source":[["Company","Company"],["Head Office","Head Office"],["Regional Office","Regional Office"],["Department","Department"],["Unit","Unit"],["Sub Unit","Sub Unit"],["Other","Other"]]}],
[ "country", {"label":"Country","type":"select2","remote-source":["Country","code","name"]}],
[ "timezone", {"label":"Time Zone","type":"select2","allow-null":false,"remote-source":["Timezone","name","details"]}],
[ "parent", {"label":"Parent Structure","type":"select","allow-null":true,"remote-source":["CompanyStructure","id","title"]}]
[ "parent", {"label":"Parent Structure","type":"select","allow-null":true,"remote-source":["CompanyStructure","id","title"]}],
[ "heads", {"label":"Heads","type":"select2multi","allow-null":true,"remote-source":["Employee","id","first_name+last_name"]}]
];
});

View File

@@ -35,7 +35,7 @@ class EmployeesActionManager extends SubActionManager{
$ok = $employee->Save();
if(!$ok){
return new IceResponse(IceResponse::ERROR, "Error occured while activating employee");
return new IceResponse(IceResponse::ERROR, "Error occurred while activating employee");
}
return new IceResponse(IceResponse::SUCCESS, $employee);
@@ -161,4 +161,4 @@ class EmployeesActionManager extends SubActionManager{
}
return $data;
}
}
}

View File

@@ -30,6 +30,7 @@ if (!class_exists('EmployeesAdminManager')) {
public function setupModuleClassDefinitions(){
$this->addModelClass('Employee');
$this->addModelClass('EmploymentStatus');
$this->addModelClass('EmployeeApproval');
}
public function getDashboardItemData(){
@@ -288,6 +289,25 @@ if (!class_exists('EmploymentStatus')) {
}
}
if (!class_exists('EmployeeApproval')) {
class EmployeeApproval extends ICEHRM_Record {
var $_table = 'EmployeeApprovals';
public function getAdminAccess(){
return array("get","element","save","delete");
}
public function getManagerAccess(){
return array("get","element","save");
}
public function getUserAccess(){
return array();
}
}
}
if (!class_exists('EmployeeRestEndPoint')) {
class EmployeeRestEndPoint extends RestEndPoint{

View File

@@ -56,8 +56,7 @@
<div class="row" style="margin-left:10px;margin-top:20px;">
<div class="panel panel-default" style="width:97.5%;">
<div class="panel-heading"><h4>Personal Information</h4></div>
<div class="panel-body">
<div class="row-fluid">
<div class="panel-body" id="cont_personal_information">
<div class="col-xs-6 col-md-3" style="font-size:16px;">
<label class="control-label col-xs-12" style="font-size:13px;">#_label_driving_license_#</label>
<label class="control-label col-xs-12 iceLabel" style="font-size:13px;font-weight: bold;" id="driving_license"></label>
@@ -74,10 +73,7 @@
<label class="control-label col-xs-12" style="font-size:13px;">#_label_gender_#</label>
<label class="control-label col-xs-12 iceLabel" style="font-size:13px;font-weight: bold;" id="gender"></label>
</div>
</div>
<hr/>
<div class="row-fluid">
<div class="col-xs-6 col-md-3" style="font-size:16px;">
<label class="control-label col-xs-12" style="font-size:13px;">#_label_nationality_#</label>
<label class="control-label col-xs-12 iceLabel" style="font-size:13px;font-weight: bold;" id="nationality_Name"></label>
@@ -90,16 +86,14 @@
<label class="control-label col-xs-12" style="font-size:13px;">#_label_joined_date_#</label>
<label class="control-label col-xs-12 iceLabel" style="font-size:13px;font-weight: bold;" id="joined_date"></label>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row" style="margin-left:10px;margin-top:20px;">
<div class="panel panel-default" style="width:97.5%;">
<div class="panel-heading"><h4>Contact Information</h4></div>
<div class="panel-body">
<div class="row-fluid">
<div class="panel-heading"><h4>Contact Information</h4></div>
<div class="panel-body" id="cont_contact_information">
<div class="col-xs-6 col-md-3" style="font-size:16px;">
<label class="control-label col-xs-12" style="font-size:13px;">#_label_address1_#</label>
<label class="control-label col-xs-12 iceLabel" style="font-size:13px;font-weight: bold;" id="address1"></label>
@@ -116,9 +110,6 @@
<label class="control-label col-xs-12" style="font-size:13px;">#_label_country_#</label>
<label class="control-label col-xs-12 iceLabel" style="font-size:13px;font-weight: bold;" id="country_Name"></label>
</div>
</div>
<hr/>
<div class="row-fluid">
<div class="col-xs-6 col-md-3" style="font-size:16px;">
<label class="control-label col-xs-12" style="font-size:13px;">#_label_postal_code_#</label>
<label class="control-label col-xs-12 iceLabel" style="font-size:13px;font-weight: bold;" id="postal_code"></label>
@@ -135,16 +126,14 @@
<label class="control-label col-xs-12" style="font-size:13px;">#_label_private_email_#</label>
<label class="control-label col-xs-12 iceLabel" style="font-size:13px;font-weight: bold;" id="private_email"></label>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row" style="margin-left:10px;margin-top:20px;">
<div class="panel panel-default" style="width:97.5%;">
<div class="panel-heading"><h4>Job Details</h4></div>
<div class="panel-body">
<div class="row-fluid">
<div class="panel-heading"><h4>Job Details</h4></div>
<div class="panel-body" id="cont_job_details">
<div class="col-xs-6 col-md-3" style="font-size:16px;">
<label class="control-label col-xs-12" style="font-size:13px;">#_label_job_title_#</label>
<label class="control-label col-xs-12 iceLabel" style="font-size:13px;font-weight: bold;" id="job_title_Name"></label>
@@ -161,56 +150,57 @@
<label class="control-label col-xs-12" style="font-size:13px;">Direct Reports</label>
<label class="control-label col-xs-12 iceLabel" style="font-size:13px;font-weight: bold;" id="subordinates"></label>
</div>
</div>
<hr/>
<div class="row-fluid">
<div class="col-xs-6 col-md-3" style="font-size:16px;">
<label class="control-label col-xs-12" style="font-size:13px;">#_label_department_#</label>
<label class="control-label col-xs-12 iceLabel" style="font-size:13px;font-weight: bold;" id="department_Name"></label>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="customFieldsCont">
</div>
<div class="modal" id="adminUsersModel" tabindex="-1" role="dialog" aria-labelledby="messageModelLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"><li class="fa fa-times"/></button>
<h3 style="font-size: 17px;">Change User Password</h3>
</div>
<div class="modal-body">
<form id="adminUsersChangePwd">
<div class="control-group">
<div class="controls">
<span class="label label-warning" id="adminUsersChangePwd_error" style="display:none;"></span>
</div>
</div>
<div class="control-group" id="field_newpwd">
<label class="control-label" for="newpwd">New Password</label>
<div class="controls">
<input class="" type="password" id="newpwd" name="newpwd" value="" class="form-control"/>
<span class="help-inline" id="help_newpwd"></span>
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"><li class="fa fa-times"/></button>
<h3 style="font-size: 17px;">Change User Password</h3>
</div>
<div class="modal-body">
<form id="adminUsersChangePwd">
<div class="control-group">
<div class="controls">
<span class="label label-warning" id="adminUsersChangePwd_error" style="display:none;"></span>
</div>
</div>
<div class="control-group" id="field_newpwd">
<label class="control-label" for="newpwd">New Password</label>
<div class="controls">
<input class="" type="password" id="newpwd" name="newpwd" value="" class="form-control"/>
<span class="help-inline" id="help_newpwd"></span>
</div>
</div>
<div class="control-group" id="field_conpwd">
<label class="control-label" for="conpwd">Confirm Password</label>
<div class="controls">
<input class="" type="password" id="conpwd" name="conpwd" value="" class="form-control"/>
<span class="help-inline" id="help_conpwd"></span>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button class="btn btn-primary" onclick="modJs.changePasswordConfirm();">Change Password</button>
<button class="btn" onclick="modJs.closeChangePassword();">Not Now</button>
</div>
</div>
<div class="control-group" id="field_conpwd">
<label class="control-label" for="conpwd">Confirm Password</label>
<div class="controls">
<input class="" type="password" id="conpwd" name="conpwd" value="" class="form-control"/>
<span class="help-inline" id="help_conpwd"></span>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button class="btn btn-primary" onclick="modJs.changePasswordConfirm();">Change Password</button>
<button class="btn" onclick="modJs.closeChangePassword();">Not Now</button>
</div>
</div>
</div>
</div>
</div><!-- End tabPageBasic -->
<div class="tab-pane" id="tabPageQualifications" style="border:1px solid #DDD;">
<div class="row" style="margin-top:20px;">
@@ -245,4 +235,4 @@
</div>
</div><!-- End tabPageQualifications -->
</div>
</div><!-- End tab-content -->
</div><!-- End tab-content -->

View File

@@ -3,17 +3,17 @@
<div class="small-box bg-aqua">
<div class="inner">
<h3>
People
<t>People</t>
</h3>
<p id="numberOfEmployees">
#_numberOfEmployees_# Employees
#_numberOfEmployees_# <t>Employees</t>
</p>
</div>
<div class="icon">
<i class="ion ion-person-stalker"></i>
</div>
<a href="#_moduleLink_#" class="small-box-footer" id="employeeLink">
Manage Employees <i class="fa fa-arrow-circle-right"></i>
<t>Manage</t> <t>Employees</t> <i class="fa fa-arrow-circle-right"></i>
</a>
</div>
</div>
</div>

View File

@@ -11,30 +11,30 @@ $customFields = BaseService::getInstance()->getCustomFields("Employee");
<ul class="nav nav-tabs" id="modTab" style="margin-bottom:0px;margin-left:5px;border-bottom: none;">
<?php if($user->user_level != "Admin"){
?>
<li class="active"><a id="tabEmployee" href="#tabPageEmployee">Employees (Direct Reports)</a></li>
<li class="active"><a id="tabEmployee" href="#tabPageEmployee"><?=LanguageManager::tran('Employees (Direct Reports)')?></a></li>
<?php }else{ ?>
<li class="active"><a id="tabEmployee" href="#tabPageEmployee">Employees</a></li>
<li class="active"><a id="tabEmployee" href="#tabPageEmployee"><?=LanguageManager::tran('Employees')?></a></li>
<?php }?>
<?php if($user->user_level == "Admin"){
?>
<li><a id="tabEmployeeSkill" href="#tabPageEmployeeSkill">Skills</a></li>
<li><a id="tabEmployeeEducation" href="#tabPageEmployeeEducation">Education</a></li>
<li><a id="tabEmployeeCertification" href="#tabPageEmployeeCertification">Certifications</a></li>
<li><a id="tabEmployeeLanguage" href="#tabPageEmployeeLanguage">Languages</a></li>
<li><a id="tabEmployeeDependent" href="#tabPageEmployeeDependent">Dependents</a></li>
<li><a id="tabEmergencyContact" href="#tabPageEmergencyContact">Emergency Contacts</a></li>
<li><a id="tabEmployeeSkill" href="#tabPageEmployeeSkill"><?=LanguageManager::tran('Skills')?></a></li>
<li><a id="tabEmployeeEducation" href="#tabPageEmployeeEducation"><?=LanguageManager::tran('Education')?></a></li>
<li><a id="tabEmployeeCertification" href="#tabPageEmployeeCertification"><?=LanguageManager::tran('Certifications')?></a></li>
<li><a id="tabEmployeeLanguage" href="#tabPageEmployeeLanguage"><?=LanguageManager::tran('Languages')?></a></li>
<li><a id="tabEmployeeDependent" href="#tabPageEmployeeDependent"><?=LanguageManager::tran('Dependents')?></a></li>
<li><a id="tabEmergencyContact" href="#tabPageEmergencyContact"><?=LanguageManager::tran('Emergency Contacts')?></a></li>
<?php if (!class_exists('DocumentsAdminManager')) {?>
<li><a id="tabEmployeeDocument" href="#tabPageEmployeeDocument">Documents</a></li>
<li><a id="tabEmployeeDocument" href="#tabPageEmployeeDocument"><?=LanguageManager::tran('Documents')?></a></li>
<?php } ?>
<?php }?>
<?php if($user->user_level == "Admin"){
?>
<li class="dropdown">
<a href="#" id="terminatedEmployeeMenu" class="dropdown-toggle" data-toggle="dropdown" aria-controls="terminatedEmployeeMenu-contents">Suspended Employees <span class="caret"></span></a>
<a href="#" id="terminatedEmployeeMenu" class="dropdown-toggle" data-toggle="dropdown" aria-controls="terminatedEmployeeMenu-contents"><?=LanguageManager::tran('Deactivated Employees')?> <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu" aria-labelledby="terminatedEmployeeMenu" id="terminatedEmployeeMenu-contents">
<li><a id="tabTerminatedEmployee" href="#tabPageTerminatedEmployee">Temporarily Suspended Employees</a></li>
<li><a id="tabArchivedEmployee" href="#tabPageArchivedEmployee">Terminated Employee Data</a></li>
<li><a id="tabTerminatedEmployee" href="#tabPageTerminatedEmployee"><?=LanguageManager::tran('Temporarily Deactivated Employees')?></a></li>
<li><a id="tabArchivedEmployee" href="#tabPageArchivedEmployee"><?=LanguageManager::tran('Terminated Employee Data')?></a></li>
</ul>
</li>
<?php }?>
@@ -133,7 +133,7 @@ $customFields = BaseService::getInstance()->getCustomFields("Employee");
var modJsList = new Array();
<?php if($user->user_level != "Admin"){
?>
modJsList['tabEmployee'] = new EmployeeAdapter('Employee','Employee',{"status":"Active", "supervisor":"__myid__"});
modJsList['tabEmployee'] = new EmployeeAdapter('Employee','Employee',{"status":"Active"});
modJsList['tabEmployee'].setShowAddNew(false);
<?php
}else{
@@ -193,10 +193,10 @@ var modJs = modJsList['tabEmployee'];
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"><li class="fa fa-times"/></button>
<h3 style="font-size: 17px;">Employee Saved Successfully</h3>
<h3 style="font-size: 17px;"><?=LanguageManager::tran('Employee Saved Successfully')?></h3>
</div>
<div class="modal-body">
Employee needs a User to login to IceHrm. Do you want to create a user for this employee now? <br/><br/>You can do this later through Users module if required.
<?=LanguageManager::tran('Employee needs a User to login to IceHrm. Do you want to create a user for this employee now?')?> <br/><br/><?=LanguageManager::tran('You can do this later through Users module if required.')?>
</div>
<div class="modal-footer">
<button class="btn btn-primary" onclick="modJs.createUser();">Yes</button>
@@ -207,4 +207,4 @@ var modJs = modJsList['tabEmployee'];
</div>
<?php include APP_BASE_PATH.'footer.php';?>
<?php include APP_BASE_PATH.'footer.php';?>

View File

@@ -36,7 +36,7 @@ EmployeeAdapter.method('setFieldNameMap', function(fields) {
if(field.display == "Hidden"){
this.hiddenFields[field.name] = field;
}else{
if(field.display == "Table and Form"){
if(field.display == "Table and Form" || field.display == "Form"){
this.tableFields[field.name] = field;
}else{
this.formOnlyFields[field.name] = field;

View File

@@ -53,5 +53,30 @@ if (!class_exists('CustomField')) {
public function getAnonymousAccess(){
return array("get","element");
}
public function validateSave($obj){
$type = $obj->type;
$baseObject = new $type();
$fields = $baseObject->getObjectKeys();
if(isset($fields[$obj->name])){
return new IceResponse(IceResponse::ERROR,"Column name already exists by default");
}
$cf = new CustomField();
if(empty($obj->id)){
$cf->Load("type = ? and name = ?",array($obj->type, $obj->name));
if($cf->name == $obj->name){
return new IceResponse(IceResponse::ERROR,"Another custom field with same name has already been added");
}
}else{
$cf->Load("type = ? and name = ? and id <> ?",array($obj->type, $obj->name, $obj->id));
if($cf->name == $obj->name){
return new IceResponse(IceResponse::ERROR,"Another custom field with same name has already been added");
}
}
return new IceResponse(IceResponse::SUCCESS,"");
}
}
}
}

View File

@@ -15,13 +15,8 @@ include APP_BASE_PATH.'modulejslibs.inc.php';
?><div class="span9">
<ul class="nav nav-tabs" id="modTab" style="margin-bottom:0px;margin-left:5px;border-bottom: none;">
<li class="dropdown">
<a href="#" id="settingsEmployeeMenu" class="dropdown-toggle" data-toggle="dropdown" aria-controls="settingsEmployeeMenu-contents">Employee Fields <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu" aria-labelledby="settingsEmployeeMenu" id="settingsEmployeeMenu-contents">
<li><a id="tabEmployeeFieldName" href="#tabPageEmployeeFieldName">Employee Field Name Mapping</a></li>
<li><a id="tabEmployeeCustomField" href="#tabPageEmployeeCustomField">Employee Custom Fields</a></li>
</ul>
</li>
<li class="active"><a id="tabEmployeeFieldName" href="#tabPageEmployeeFieldName"><?=LanguageManager::tran('Employee Field Names')?></a></li>
<li><a id="tabEmployeeCustomField" href="#tabPageEmployeeCustomField"><?=LanguageManager::tran('Employee Custom Fields')?></a></li>
</ul>
<div class="tab-content">
@@ -51,12 +46,12 @@ modJsList['tabEmployeeFieldName'] = new FieldNameAdapter('FieldNameMapping','Emp
modJsList['tabEmployeeFieldName'].setRemoteTable(true);
modJsList['tabEmployeeFieldName'].setShowAddNew(false);
modJsList['tabEmployeeCustomField'] = new CustomFieldAdapter('CustomField','EmployeeCustomField',{"type":"Employee"});
modJsList['tabEmployeeCustomField'] = new CustomFieldAdapter('CustomField','EmployeeCustomField',{"type":"Employee"},"display_order desc");
modJsList['tabEmployeeCustomField'].setRemoteTable(true);
modJsList['tabEmployeeCustomField'].setShowAddNew(false);
modJsList['tabEmployeeCustomField'].setTableType("Employee");
var modJs = modJsList['tabEmployeeFieldName'];
</script>
<?php include APP_BASE_PATH.'footer.php';?>
<?php include APP_BASE_PATH.'footer.php';?>

View File

@@ -52,6 +52,7 @@ FieldNameAdapter.method('getFormFields', function() {
function CustomFieldAdapter(endPoint,tab,filter,orderBy) {
this.initAdapter(endPoint,tab,filter,orderBy);
this.tableType = "";
}
CustomFieldAdapter.inherits(AdapterBase);
@@ -62,7 +63,8 @@ CustomFieldAdapter.method('getDataMapping', function() {
return [
"id",
"name",
"display"
"display",
"display_order"
];
});
@@ -70,17 +72,74 @@ CustomFieldAdapter.method('getHeaders', function() {
return [
{ "sTitle": "ID" ,"bVisible":false},
{ "sTitle": "Name" },
{ "sTitle": "Display Status"}
{ "sTitle": "Display Status"},
{ "sTitle": "Priority"}
];
});
CustomFieldAdapter.method('getFormFields', function() {
return [
[ "id", {"label":"ID","type":"hidden"}],
[ "type", {"label":"Type","type":"placeholder","validation":""}],
[ "name", {"label":"Name","type":"placeholder","validation":""}],
[ "data", {"label":"Data","type":"textarea","validation":""}],
[ "display", {"label":"Display Status","type":"select","source":[["Form","Form"],["Table and Form","Table and Form"],["Hidden","Hidden"]]}]
//[ "type", {"label":"Type","type":"placeholder","validation":""}],
[ "name", {"label":"Name","type":"text","validation":""}],
[ "display", {"label":"Display Status","type":"select","source":[["Form","Show"],["Hidden","Hidden"]]}],
[ "field_type", {"label":"Field Type","type":"select","source":[["text","Text Field"],["textarea","Text Area"],["select","Select"],["select2","Select2"],["select2multi","Multi Select"],["fileupload","File Upload"],["date","Date"],["datetime","Date Time"],["time","Time"]]}],
[ "field_label", {"label":"Field Label","type":"text","validation":""}],
[ "field_validation", {"label":"Validation","type":"select","validation":"none","sort":"none","source":[["","Required"],["none","None"],["number","Number"],["numberOrEmpty","Number or Empty"],["float","Decimal"],["email","Email"],["emailOrEmpty","Email or Empty"]]}],
[ "field_options", {"label":"Field Options","type":"datagroup",
"form":[
[ "label", {"label":"Label","type":"text","validation":""}],
[ "value", {"label":"Value","type":"text","validation":"none"}]
],
"html":'<div id="#_id_#" class="panel panel-default"><div class="panel-body">#_delete_##_edit_#<span style="color:#999;font-size:13px;font-weight:bold">#_label_#</span>:#_value_#</div></div>',
"validation":"none"
}],
[ "display_order", {"label":"Priority","type":"text","validation":"number"}],
[ "display_section", {"label":"Display Section","type":"text","validation":""}]
];
});
CustomFieldAdapter.method('setTableType', function(type) {
this.tableType = type;
});
CustomFieldAdapter.method('doCustomValidation', function(params) {
var validateName= function (str) {
var name = /^[a-z][a-z0-9\._]+$/;
return str != null && name.test(str);
};
if(!validateName(params.name)){
return "Invalid name for custom field";
}
return null;
});
CustomFieldAdapter.method('forceInjectValuesBeforeSave', function(params) {
//Build data field
var data = [params.name], options = [], optionsData;
data.push({});
data[1]['label'] = params.field_label;
data[1]['type'] = params.field_type;
data[1]['validation'] = params.field_validation;
if(["select","select2","select2multi"].indexOf(params.field_type) >= 0){
optionsData = JSON.parse(params.field_options);
for(index in optionsData){
options.push([optionsData[index].value, optionsData[index].label]);
}
data[1]['source'] = options;
}
if(params.field_validation == null || params.field_validation == undefined){
params.field_validation = "";
}
params.data = JSON.stringify(data);
params.type = this.tableType;
return params;
});

View File

@@ -20,7 +20,6 @@ along with iCE Hrm. If not, see <http://www.gnu.org/licenses/>.
Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]
Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilinah)
*/
$moduleName = 'jobs';
define('MODULE_PATH',dirname(__FILE__));
include APP_BASE_PATH.'header.php';
@@ -28,9 +27,9 @@ include APP_BASE_PATH.'modulejslibs.inc.php';
?><div class="span9">
<ul class="nav nav-tabs" id="modTab" style="margin-bottom:0px;margin-left:5px;border-bottom: none;">
<li class="active"><a id="tabJobTitles" href="#tabPageJobTitles">Job Titles</a></li>
<li><a id="tabPayGrades" href="#tabPagePayGrades">Pay Grades</a></li>
<li><a id="tabEmploymentStatus" href="#tabPageEmploymentStatus">Employment Status</a></li>
<li class="active"><a id="tabJobTitles" href="#tabPageJobTitles"><?=LanguageManager::tran('Job Titles')?></a></li>
<li><a id="tabPayGrades" href="#tabPagePayGrades"><?=LanguageManager::tran('Pay Grades')?></a></li>
<li><a id="tabEmploymentStatus" href="#tabPageEmploymentStatus"><?=LanguageManager::tran('Employment Status')?></a></li>
</ul>
<div class="tab-content">
@@ -71,4 +70,4 @@ modJsList['tabEmploymentStatus'] = new EmploymentStatusAdapter('EmploymentStatus
var modJs = modJsList['tabJobTitles'];
</script>
<?php include APP_BASE_PATH.'footer.php';?>
<?php include APP_BASE_PATH.'footer.php';?>

View File

@@ -28,8 +28,8 @@ include APP_BASE_PATH.'modulejslibs.inc.php';
?><div class="span9">
<ul class="nav nav-tabs" id="modTab" style="margin-bottom:0px;margin-left:5px;border-bottom: none;">
<li class="active"><a id="tabCompanyLoan" href="#tabPageCompanyLoan">Loan Types</a></li>
<li><a id="tabEmployeeCompanyLoan" href="#tabPageEmployeeCompanyLoan">Employee Loans</a></li>
<li class="active"><a id="tabCompanyLoan" href="#tabPageCompanyLoan"><?=LanguageManager::tran('Loan Types')?></a></li>
<li><a id="tabEmployeeCompanyLoan" href="#tabPageEmployeeCompanyLoan"><?=LanguageManager::tran('Employee Loans')?></a></li>
</ul>
<div class="tab-content">
@@ -61,4 +61,4 @@ modJsList['tabEmployeeCompanyLoan'] = new EmployeeCompanyLoanAdapter('EmployeeCo
var modJs = modJsList['tabCompanyLoan'];
</script>
<?php include APP_BASE_PATH.'footer.php';?>
<?php include APP_BASE_PATH.'footer.php';?>

View File

@@ -1,7 +1,7 @@
{
"Admin":"fa-cubes",
"Employees":"fa-users",
"Reports":"fa-file-text",
"Admin Reports":"fa-file-text",
"System":"fa-cogs",
"Payroll":"fa-money"
}

View File

@@ -52,7 +52,12 @@ if (!class_exists('Country')) {
}
if(!empty($allowedCountries)){
return parent::Find("id in (".implode(",",$allowedCountries).")" , array());
$res = parent::Find("id in (".implode(",",$allowedCountries).")" , array());
if(empty($res)){
SettingsManager::getInstance()->setSetting('System: Allowed Countries','');
}else{
return $res;
}
}
return parent::Find($whereOrderBy, $bindarr, $pkeysArr, $extra);
@@ -103,7 +108,12 @@ if (!class_exists('CurrencyType')) {
}
if(!empty($allowedCountries)){
return parent::Find("id in (".implode(",",$allowedCountries).")" , array());
$res = parent::Find("id in (".implode(",",$allowedCountries).")" , array());
if(empty($res)){
SettingsManager::getInstance()->setSetting('System: Allowed Currencies','');
}else{
return $res;
}
}
return parent::Find($whereOrderBy, $bindarr, $pkeysArr, $extra);
@@ -136,7 +146,12 @@ if (!class_exists('Nationality')) {
}
if(!empty($allowedCountries)){
return parent::Find("id in (".implode(",",$allowedCountries).")" , array());
$res = parent::Find("id in (".implode(",",$allowedCountries).")" , array());
if(empty($res)){
SettingsManager::getInstance()->setSetting('System: Allowed Currencies','');
}else{
return $res;
}
}
return parent::Find($whereOrderBy, $bindarr, $pkeysArr, $extra);
@@ -210,6 +225,42 @@ if (!class_exists('CalculationHook')) {
}
}
if (!class_exists('CustomFieldValue')) {
class CustomFieldValue extends ICEHRM_Record {
var $_table = 'CustomFieldValues';
public function getAdminAccess(){
return array("get","element","save","delete");
}
public function getUserAccess(){
return array("get","element","save","delete");
}
public function getAnonymousAccess(){
return array();
}
}
}
if (!class_exists('SupportedLanguage')) {
class SupportedLanguage extends ICEHRM_Record {
var $_table = 'SupportedLanguages';
public function getAdminAccess(){
return array("get","element","save","delete");
}
public function getUserAccess(){
return array();
}
public function getAnonymousAccess(){
return array("get","element");
}
}
}

View File

@@ -28,7 +28,7 @@ include APP_BASE_PATH.'modulejslibs.inc.php';
?><div class="span9">
<ul class="nav nav-tabs" id="modTab" style="margin-bottom:0px;margin-left:5px;border-bottom: none;">
<li class="active"><a id="tabModule" href="#tabPageModule">Modules</a></li>
<li class="active"><a id="tabModule" href="#tabPageModule"><?=LanguageManager::tran('Modules')?></a></li>
</ul>
<div class="tab-content">
@@ -51,4 +51,4 @@ modJsList['tabModule'].setShowAddNew(false);
var modJs = modJsList['tabModule'];
</script>
<?php include APP_BASE_PATH.'footer.php';?>
<?php include APP_BASE_PATH.'footer.php';?>

View File

@@ -3,17 +3,17 @@
<div class="small-box bg-aqua">
<div class="inner">
<h3>
Permission
<t>Permission</t>
</h3>
<p>
Management
<t>Management</t>
</p>
</div>
<div class="icon">
<i class="ion ion-locked"></i>
</div>
<a href="#_moduleLink_#" class="small-box-footer" id="permissionLink">
Manage Permissions <i class="fa fa-arrow-circle-right"></i>
<t>Manage</t> <t>Permissions</t> <i class="fa fa-arrow-circle-right"></i>
</a>
</div>
</div>
</div>

View File

@@ -28,7 +28,7 @@ include APP_BASE_PATH.'modulejslibs.inc.php';
?><div class="span9">
<ul class="nav nav-tabs" id="modTab" style="margin-bottom:0px;margin-left:5px;border-bottom: none;">
<li class="active"><a id="tabPermission" href="#tabPagePermission">Permissions</a></li>
<li class="active"><a id="tabPermission" href="#tabPagePermission"><?=LanguageManager::tran('Permissions')?></a></li>
</ul>
<div class="tab-content">
@@ -51,4 +51,4 @@ modJsList['tabPermission'].setShowAddNew(false);
var modJs = modJsList['tabPermission'];
</script>
<?php include APP_BASE_PATH.'footer.php';?>
<?php include APP_BASE_PATH.'footer.php';?>

View File

@@ -69,5 +69,52 @@ if (!class_exists('Project')) {
public function getUserAccess(){
return array("get","element");
}
public function getAllProjects(){
$project = new Project();
$projects = $project->Find("status = ?",'Active');
foreach($projects as $project){
$client = new Client();
$client->Load("id = ?",array($project->client));
$project->name = $project->name." (".$client->name.")";
$employeeProjects[] = $project;
}
return $employeeProjects;
}
public function getEmployeeProjects(){
$allowAllProjects = SettingsManager::getInstance()->getSetting("Projects: Make All Projects Available to Employees");
$employeeProjects = array();
if($allowAllProjects == 0){
$employeeProjectsTemp = new EmployeeProject();
$employeeProjectsTemp = $employeeProjectsTemp->Find("employee = ?",array(BaseService::getInstance()->getCurrentProfileId()));
foreach($employeeProjectsTemp as $p){
$project = new Project();
$project->Load("id = ?",array($p->project));
if($project->status == 'Active'){
$client = new Client();
$client->Load("id = ?",array($project->client));
$project->name = $project->name." (".$client->name.")";
$employeeProjects[] = $project;
}
}
}else{
$project = new Project();
$projects = $project->Find("status = ?",array('Active'));
foreach($projects as $project){
$client = new Client();
$client->Load("id = ?",array($project->client));
$project->name = $project->name." (".$client->name.")";
$employeeProjects[] = $project;
}
}
return $employeeProjects;
}
}
}
}

View File

@@ -2,16 +2,16 @@
<div class="small-box bg-red">
<div class="inner">
<h3>Projects</h3>
<h3><t>Projects</t></h3>
<p id="numberOfProjects">
#_numberOfProjects_# Active Projects
#_numberOfProjects_# <t>Active Projects</t>
</p>
</div>
<div class="icon">
<i class="ion ion-pie-graph"></i>
</div>
<a href="#_moduleLink_#" class="small-box-footer" id="projectsLink">
Update Clients/Projects <i class="fa fa-arrow-circle-right"></i>
<t>Update Clients/Projects</t> <i class="fa fa-arrow-circle-right"></i>
</a>
</div>
</div>
</div>

View File

@@ -28,9 +28,9 @@ include APP_BASE_PATH.'modulejslibs.inc.php';
?><div class="span9">
<ul class="nav nav-tabs" id="modTab" style="margin-bottom:0px;margin-left:5px;border-bottom: none;">
<li class="active"><a id="tabClient" href="#tabPageClient">Clients</a></li>
<li><a id="tabProject" href="#tabPageProject">Projects</a></li>
<li><a id="tabEmployeeProject" href="#tabPageEmployeeProject">Employee Projects</a></li>
<li class="active"><a id="tabClient" href="#tabPageClient"><?=LanguageManager::tran('Clients')?></a></li>
<li><a id="tabProject" href="#tabPageProject"><?=LanguageManager::tran('Projects')?></a></li>
<li><a id="tabEmployeeProject" href="#tabPageEmployeeProject"><?=LanguageManager::tran('Employee Projects')?></a></li>
</ul>
<div class="tab-content">
@@ -110,4 +110,4 @@ modJsList['tabEmployeeProject'].setShowEdit(false);
var modJs = modJsList['tabClient'];
</script>
<?php include APP_BASE_PATH.'footer.php';?>
<?php include APP_BASE_PATH.'footer.php';?>

View File

@@ -95,13 +95,14 @@ ProjectAdapter.method('getHeaders', function() {
});
ProjectAdapter.method('getFormFields', function() {
if(this.showSave){
return [
[ "id", {"label":"ID","type":"hidden"}],
[ "name", {"label":"Name","type":"text"}],
[ "client", {"label":"Client","type":"select2","allow-null":true,"remote-source":["Client","id","name"]}],
[ "details", {"label":"Details","type":"textarea","validation":"none"}],
[ "status", {"label":"Status","type":"select","source":[["Active","Active"],["Inactive","Inactive"]]}]
[ "status", {"label":"Status","type":"select","source":[["Active","Active"],["On Hold","On Hold"],["Completed","Completed"],["Dropped","Dropped"]]}]
];
}else{
return [
@@ -109,7 +110,7 @@ ProjectAdapter.method('getFormFields', function() {
[ "name", {"label":"Name","type":"placeholder"}],
[ "client", {"label":"Client","type":"placeholder","allow-null":true,"remote-source":["Client","id","name"]}],
[ "details", {"label":"Details","type":"placeholder","validation":"none"}],
[ "status", {"label":"Status","type":"placeholder","source":[["Active","Active"],["Inactive","Inactive"]]}]
[ "status", {"label":"Status","type":"select","source":[["Active","Active"],["On Hold","On Hold"],["Completed","Completed"],["Dropped","Dropped"]]}]
];
}
@@ -137,8 +138,7 @@ EmployeeProjectAdapter.method('getDataMapping', function() {
return [
"id",
"employee",
"project",
"status"
"project"
];
});
@@ -146,9 +146,7 @@ EmployeeProjectAdapter.method('getHeaders', function() {
return [
{ "sTitle": "ID" ,"bVisible":false},
{ "sTitle": "Employee" },
{ "sTitle": "Project" },
/*{ "sTitle": "Start Date"},*/
{ "sTitle": "Status"}
{ "sTitle": "Project" }
];
});
@@ -157,9 +155,6 @@ EmployeeProjectAdapter.method('getFormFields', function() {
[ "id", {"label":"ID","type":"hidden"}],
[ "employee", {"label":"Employee","type":"select2","remote-source":["Employee","id","first_name+last_name"]}],
[ "project", {"label":"Project","type":"select2","remote-source":["Project","id","name"]}],
/*[ "date_start", {"label":"Start Date","type":"date","validation":""}],
[ "date_end", {"label":"End Date","type":"date","validation":"none"}],*/
[ "status", {"label":"Status","type":"select","source":[["Current","Current"],["Inactive","Inactive"],["Completed","Completed"]]}],
[ "details", {"label":"Details","type":"textarea","validation":"none"}]
];
});

View File

@@ -28,10 +28,10 @@ include APP_BASE_PATH.'modulejslibs.inc.php';
?><div class="span9">
<ul class="nav nav-tabs" id="modTab" style="margin-bottom:0px;margin-left:5px;border-bottom: none;">
<li class="active"><a id="tabSkill" href="#tabPageSkill">Skills</a></li>
<li><a id="tabEducation" href="#tabPageEducation">Education</a></li>
<li><a id="tabCertification" href="#tabPageCertification">Certifications</a></li>
<li><a id="tabLanguage" href="#tabPageLanguage">Languages</a></li>
<li class="active"><a id="tabSkill" href="#tabPageSkill"><?=LanguageManager::tran('Skills')?></a></li>
<li><a id="tabEducation" href="#tabPageEducation"><?=LanguageManager::tran('Education')?></a></li>
<li><a id="tabCertification" href="#tabPageCertification"><?=LanguageManager::tran('Certifications')?></a></li>
<li><a id="tabLanguage" href="#tabPageLanguage"><?=LanguageManager::tran('Languages')?></a></li>
</ul>
<div class="tab-content">
@@ -61,10 +61,10 @@ include APP_BASE_PATH.'modulejslibs.inc.php';
</div>
<div class="tab-pane" id="tabPageLanguage">
<div id="Language" class="reviewBlock" data-content="List" style="padding-left:5px;">
</div>
<div id="LanguageForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
</div>
</div>
</div>
@@ -124,4 +124,4 @@ modJsList['tabLanguage'].setShowEdit(false);
var modJs = modJsList['tabSkill'];
</script>
<?php include APP_BASE_PATH.'footer.php';?>
<?php include APP_BASE_PATH.'footer.php';?>

View File

@@ -2,16 +2,16 @@
<div class="small-box bg-teal">
<div class="inner">
<h3>Reports</h3>
<h3><t>Reports</t></h3>
<p>
View / Download Reports
<t>View / Download Reports</t>
</p>
</div>
<div class="icon">
<i class="ion ion-document-text"></i>
</div>
<a href="#_moduleLink_#" class="small-box-footer" id="reportsLink">
Create a Report <i class="fa fa-arrow-circle-right"></i>
<t>Generate a Report</t> <i class="fa fa-arrow-circle-right"></i>
</a>
</div>
</div>
</div>

View File

@@ -7,7 +7,7 @@ include APP_BASE_PATH.'modulejslibs.inc.php';
?><div class="span9">
<ul class="nav nav-tabs" id="modTab" style="margin-bottom:0px;margin-left:5px;border-bottom: none;">
<li class="active"><a id="tabReport" href="#tabPageReport">Reports</a></li>
<li class="active"><a id="tabReport" href="#tabPageReport"><?=LanguageManager::tran('Reports')?></a></li>
</ul>
<div class="tab-content">
@@ -30,12 +30,9 @@ modJsList['tabReport'] = new ReportAdapter('Report','Report','','report_group');
modJsList['tabReport'].setShowAddNew(false);
modJsList['tabReport'].setRemoteTable(true);
/*
modJsList['tabReport'] = new ReportGenAdapter('File','File','{"file_group":"Report"}','group');
modJsList['tabReport'].setShowAddNew(false);
*/
var modJs = modJsList['tabReport'];
</script>
<?php include APP_BASE_PATH.'footer.php';?>
<?php include APP_BASE_PATH.'footer.php';?>

View File

@@ -10,15 +10,20 @@
function ReportAdapter(endPoint,tab,filter,orderBy) {
this.initAdapter(endPoint,tab,filter,orderBy);
this._formFileds = [
[ "id", {"label":"ID","type":"hidden"}],
[ "name", {"label":"Name","type":"label","validation":""}],
[ "parameters", {"label":"Parameters","type":"fieldset","validation":"none"}]
];
this._construct();
}
ReportAdapter.inherits(AdapterBase);
ReportAdapter.method('_construct', function() {
this._formFileds = [
[ "id", {"label":"ID","type":"hidden"}],
[ "name", {"label":"Name","type":"label","validation":""}],
[ "parameters", {"label":"Parameters","type":"fieldset","validation":"none"}]
];
this.remoteFieldsExists = false;
});
ReportAdapter.method('_initLocalFormFields', function() {
this._formFileds = [
[ "id", {"label":"ID","type":"hidden"}],
@@ -27,9 +32,14 @@ ReportAdapter.method('_initLocalFormFields', function() {
];
});
ReportAdapter.method('setRemoteFieldExists', function(val) {
this.remoteFieldsExists = val;
});
ReportAdapter.method('getDataMapping', function() {
return [
"id",
"icon",
"name",
"details",
"parameters"
@@ -39,12 +49,14 @@ ReportAdapter.method('getDataMapping', function() {
ReportAdapter.method('getHeaders', function() {
return [
{ "sTitle": "ID" ,"bVisible":false},
{ "sTitle": "Name" },
{ "sTitle": "","bSortable":false,"sWidth":"22px"},
{ "sTitle": "Name","sWidth":"30%"},
{ "sTitle": "Details"},
{ "sTitle": "Parameters","bVisible":false},
];
});
ReportAdapter.method('getFormFields', function() {
return this._formFileds;
});
@@ -55,12 +67,16 @@ ReportAdapter.method('processFormFieldsWithObject', function(object) {
var len = this._formFileds.length;
var fieldIDsToDelete = [];
var fieldsToDelete = [];
this.remoteFieldsExists = false;
for(var i=0;i<len;i++){
if(this._formFileds[i][1]['type']=="fieldset"){
var newFields = JSON.parse(object[this._formFileds[i][0]]);
fieldsToDelete.push(this._formFileds[i][0]);
newFields.forEach(function(entry) {
that._formFileds.push(entry);
if(entry[1]['remote-source'] != undefined && entry[1]['remote-source'] != null){
that.remoteFieldsExists = true;
}
});
}
@@ -76,14 +92,179 @@ ReportAdapter.method('processFormFieldsWithObject', function(object) {
that._formFileds = tempArray;
});
ReportAdapter.method('renderForm', function(object) {
var that = this;
this.processFormFieldsWithObject(object);
var cb = function(){
that.uber('renderForm',object);
};
this.initFieldMasterData(cb);
if(this.remoteFieldsExists){
var cb = function(){
that.renderFormNew(object);
};
this.initFieldMasterData(cb);
}else{
this.initFieldMasterData();
that.renderFormNew(object);
}
this.currentReport = object;
});
ReportAdapter.method('renderFormNew', function(object) {
var that = this;
var signatureIds = [];
if(object == null || object == undefined){
this.currentId = null;
}
this.preRenderForm(object);
var formHtml = this.templates['formTemplate'];
var html = "";
var fields = this.getFormFields();
for(var i=0;i<fields.length;i++){
var metaField = this.getMetaFieldForRendering(fields[i][0]);
if(metaField == "" || metaField == undefined){
html += this.renderFormField(fields[i]);
}else{
var metaVal = object[metaField];
if(metaVal != '' && metaVal != null && metaVal != undefined && metaVal.trim() != ''){
html += this.renderFormField(JSON.parse(metaVal));
}else{
html += this.renderFormField(fields[i]);
}
}
}
formHtml = formHtml.replace(/_id_/g,this.getTableName()+"_submit");
formHtml = formHtml.replace(/_fields_/g,html);
var $tempDomObj;
var randomFormId = this.generateRandom(14);
if(!this.showFormOnPopup){
$tempDomObj = $("#"+this.getTableName()+'Form');
}else{
$tempDomObj = $('<div class="reviewBlock popupForm" data-content="Form"></div>');
$tempDomObj.attr('id',randomFormId);
}
$tempDomObj.html(formHtml);
$tempDomObj.find('.datefield').datepicker({'viewMode':2});
$tempDomObj.find('.timefield').datetimepicker({
language: 'en',
pickDate: false
});
$tempDomObj.find('.datetimefield').datetimepicker({
language: 'en'
});
$tempDomObj.find('.colorpick').colorpicker();
//$tempDomObj.find('.select2Field').select2();
$tempDomObj.find('.select2Field').each(function() {
$(this).select2().select2('val', $(this).find("option:eq(0)").val());
});
$tempDomObj.find('.select2Multi').each(function() {
$(this).select2().on("change",function(e){
var parentRow = $(this).parents(".row");
var height = parentRow.find(".select2-choices").height();
parentRow.height(parseInt(height));
});
});
$tempDomObj.find('.signatureField').each(function() {
//$(this).data('signaturePad',new SignaturePad($(this)));
signatureIds.push($(this).attr('id'));
});
for(var i=0;i<fields.length;i++){
if(fields[i][1].type == "datagroup"){
$tempDomObj.find("#"+fields[i][0]).data('field',fields[i]);
}
}
if(this.showSave == false){
$tempDomObj.find('.saveBtn').remove();
}else{
$tempDomObj.find('.saveBtn').off();
$tempDomObj.find('.saveBtn').data("modJs",this);
$tempDomObj.find('.saveBtn').on( "click", function() {
if($(this ).data('modJs').saveSuccessItemCallback != null && $(this ).data('modJs').saveSuccessItemCallback!= undefined){
$(this ).data('modJs').save($(this ).data('modJs').retriveItemsAfterSave(), $(this ).data('modJs').saveSuccessItemCallback);
}else{
$(this ).data('modJs').save();
}
return false;
});
}
if(this.showCancel== false){
$tempDomObj.find('.cancelBtn').remove();
}else{
$tempDomObj.find('.cancelBtn').off();
$tempDomObj.find('.cancelBtn').data("modJs",this);
$tempDomObj.find('.cancelBtn').on( "click", function() {
$(this ).data('modJs').cancel();
return false;
});
}
if(!this.showFormOnPopup){
$("#"+this.getTableName()+'Form').show();
$("#"+this.getTableName()).hide();
for(var i=0;i<signatureIds.length;i++){
$("#"+signatureIds[i])
.data('signaturePad',
new SignaturePad(document.getElementById(signatureIds[i])));
}
if(object != undefined && object != null){
this.fillForm(object);
}
}else{
//var tHtml = $tempDomObj.wrap('<div>').parent().html();
//this.showMessage("Edit",tHtml,null,null,true);
this.showMessage("Edit","",null,null,true);
$("#plainMessageModel .modal-body").html("");
$("#plainMessageModel .modal-body").append($tempDomObj);
for(var i=0;i<signatureIds.length;i++){
$("#"+signatureIds[i])
.data('signaturePad',
new SignaturePad(document.getElementById(signatureIds[i])));
}
if(object != undefined && object != null){
this.fillForm(object,"#"+randomFormId);
}
}
this.postRenderForm(object,$tempDomObj);
});
ReportAdapter.method('getActionButtonsHtml', function(id,data) {
@@ -94,40 +275,48 @@ ReportAdapter.method('getActionButtonsHtml', function(id,data) {
});
ReportAdapter.method('addSuccessCallBack', function(callBackData,serverData) {
//var link = '<a href="'+this.getCustomActionUrl("download",{'file':serverData})+'" target="_blank">Download Report <i class="icon-download-alt"></i> </a>';
//this.showMessage("Download Report",link);
var fileName = serverData[0];
var link;
if(fileName.indexOf("https:") == 0){
link = '<a href="'+fileName+'" target="_blank" style="font-size:14px;font-weight:bold;">Download Report <img src="_BASE_images/download.png"></img> </a>';
link = '<a href="'+fileName+'" target="_blank" style="font-size:14px;font-weight:bold;">Download Report <img src="_BASE_images/download.png"></img> </a>';
}else{
link = '<a href="'+modJs.getCustomActionUrl("download",{'file':fileName})+'" target="_blank" style="font-size:14px;font-weight:bold;">Download Report <img src="_BASE_images/download.png"></img> </a>';
}
link = link.replace(/_BASE_/g,this.baseUrl);
var tableHtml = link+'<br/><br/><div class="box-body table-responsive" style="overflow-x:scroll;padding: 5px;border: solid 1px #DDD;"><table id="tempReportTable" cellpadding="0" cellspacing="0" border="0" class="table table-bordered table-striped"></table></div>';
//Delete existing temp report table
$("#tempReportTable").remove();
//this.showMessage("Report",tableHtml);
$("#Report").html(tableHtml);
$("#Report").show();
$("#ReportForm").hide();
//Prepare headers
var headers = [];
for(title in serverData[1]){
headers.push({ "sTitle": serverData[1][title]});
}
var data = serverData[2];
var dataTableParams = {
if(this.currentReport.output == "PDF"){
this.showMessage("Download Report",link);
}else{
if(serverData[1].length == 0){
this.showMessage("Empty Report","There were no data for selected filters");
return;
}
var tableHtml = link+'<br/><br/><div class="box-body table-responsive" style="overflow-x:scroll;padding: 5px;border: solid 1px #DDD;"><table id="tempReportTable" cellpadding="0" cellspacing="0" border="0" class="table table-bordered table-striped"></table></div>';
//Delete existing temp report table
$("#tempReportTable").remove();
//this.showMessage("Report",tableHtml);
$("#"+this.table).html(tableHtml);
$("#"+this.table).show();
$("#"+this.table+"Form").hide();
//Prepare headers
var headers = [];
for(title in serverData[1]){
headers.push({ "sTitle": serverData[1][title]});
}
var data = serverData[2];
var dataTableParams = {
"oLanguage": {
"sLengthMenu": "_MENU_ records per page"
},
@@ -137,17 +326,21 @@ ReportAdapter.method('addSuccessCallBack', function(callBackData,serverData) {
"iDisplayLength": 15,
"iDisplayStart": 0
};
$("#tempReportTable").dataTable( dataTableParams );
$(".dataTables_paginate ul").addClass("pagination");
$(".dataTables_length").hide();
$(".dataTables_filter input").addClass("form-control");
$(".dataTables_filter input").attr("placeholder","Search");
$(".dataTables_filter label").contents().filter(function(){
return (this.nodeType == 3);
}).remove();
$('.tableActionButton').tooltip();
$("#tempReportTable").dataTable( dataTableParams );
$(".dataTables_paginate ul").addClass("pagination");
$(".dataTables_length").hide();
$(".dataTables_filter input").addClass("form-control");
$(".dataTables_filter input").attr("placeholder","Search");
$(".dataTables_filter label").contents().filter(function(){
return (this.nodeType == 3);
}).remove();
$('.tableActionButton').tooltip();
}
});
@@ -201,4 +394,3 @@ ReportGenAdapter.method('getActionButtonsHtml', function(id,data) {
html = html.replace(/_BASE_/g,this.baseUrl);
return html;
});

View File

@@ -1,6 +1,6 @@
{
"label":"Reports",
"menu":"Reports",
"menu":"Admin Reports",
"order":"1",
"icon":"fa-file-o",
"user_levels":["Admin","Manager"],

View File

@@ -2,7 +2,7 @@
if(!class_exists('ReportBuilder')){
include_once APP_BASE_PATH.'admin/reports/reportClasses/ReportBuilder.php';
}
class ActiveEmployeeReport extends ReportBuilder{
class ActiveEmployeeReport extends CSVReportBuilder implements CSVReportBuilderInterface{
public function getMainQuery(){
$query = "Select id, employee_id as 'Employee ID',

View File

@@ -2,7 +2,7 @@
if(!class_exists('ReportBuilder')){
include_once APP_BASE_PATH.'admin/reports/reportClasses/ReportBuilder.php';
}
class EmployeeAttendanceReport extends ReportBuilder{
class EmployeeAttendanceReport extends CSVReportBuilder implements CSVReportBuilderInterface{
public function getMainQuery(){
$query = "SELECT

View File

@@ -1,4 +1,7 @@
<?php
if(!class_exists('ReportBuilder')){
include_once APP_BASE_PATH.'admin/reports/reportClasses/ReportBuilder.php';
}
if(!interface_exists('ReportBuilderInterface')){
include_once APP_BASE_PATH.'admin/reports/reportClasses/ReportBuilderInterface.php';
}
@@ -6,7 +9,7 @@ if(!interface_exists('ReportBuilderInterface')){
if(!class_exists('LeavesActionManager')){
include_once APP_BASE_PATH.'modules/leaves/api/LeavesActionManager.php';
}
class EmployeeLeaveEntitlementReport implements ReportBuilderInterface{
class EmployeeLeaveEntitlementReport extends ClassBasedReportBuilder implements ReportBuilderInterface{
public function getData($report,$req){
$leaveActionManager = new LeavesActionManager();

View File

@@ -2,7 +2,7 @@
if(!class_exists('ReportBuilder')){
include_once APP_BASE_PATH.'admin/reports/reportClasses/ReportBuilder.php';
}
class EmployeeLeavesReport extends ReportBuilder{
class EmployeeLeavesReport extends CSVReportBuilder implements CSVReportBuilderInterface{
public function getMainQuery(){
$query = "SELECT

View File

@@ -1,10 +1,12 @@
<?php
if(!class_exists('ReportBuilder')){
include_once APP_BASE_PATH.'admin/reports/reportClasses/ReportBuilder.php';
}
if(!interface_exists('ReportBuilderInterface')){
include_once APP_BASE_PATH.'admin/reports/reportClasses/ReportBuilderInterface.php';
}
class EmployeeTimeSheetData implements ReportBuilderInterface{
class EmployeeTimeSheetData extends ClassBasedReportBuilder implements ReportBuilderInterface{
public function getData($report,$request){
$employeeCache = array();

View File

@@ -1,8 +1,11 @@
<?php
if(!class_exists('ReportBuilder')){
include_once APP_BASE_PATH.'admin/reports/reportClasses/ReportBuilder.php';
}
if(!interface_exists('ReportBuilderInterface')){
include_once APP_BASE_PATH.'admin/reports/reportClasses/ReportBuilderInterface.php';
}
class EmployeeTimeTrackReport implements ReportBuilderInterface{
class EmployeeTimeTrackReport extends ClassBasedReportBuilder implements ReportBuilderInterface{
public function getData($report,$req){
LogManager::getInstance()->info(json_encode($report));

View File

@@ -2,7 +2,7 @@
if(!class_exists('ReportBuilder')){
include_once APP_BASE_PATH.'admin/reports/reportClasses/ReportBuilder.php';
}
class EmployeeTimesheetReport extends ReportBuilder{
class EmployeeTimesheetReport extends CSVReportBuilder implements CSVReportBuilderInterface{
public function getMainQuery(){
$query = "SELECT
@@ -28,34 +28,58 @@ FROM EmployeeTimeEntry te";
if(in_array("NULL", $employeeList) ){
$employeeList = array();
}
if(!empty($employeeList) && ($request['project'] != "NULL" && !empty($request['project']))){
$query = "where employee in (".implode(",", $employeeList).") and date_start >= ? and date_end <= ? and project = ?;";
$params = array(
$request['date_start'],
$request['date_end'],
$request['project']
);
}else if(!empty($employeeList)){
$query = "where employee in (".implode(",", $employeeList).") and date_start >= ? and date_end <= ?;";
$params = array(
if(($request['client'] != "NULL" && !empty($request['client']))) {
$project = new Project();
$projects = $project->Find("client = ?",array($request['client']));
$projectIds = array();
foreach($projects as $project){
$projectIds[] = $project->id;
}
if (!empty($employeeList) && ($request['project'] != "NULL" && !empty($request['project']))) {
$query = "where employee in (" . implode(",", $employeeList) . ") and date_start >= ? and date_end <= ? and project in (".implode(",",$projectIds).");";
$params = array(
$request['date_start'],
$request['date_end']
);
}else if(($request['project'] != "NULL" && !empty($request['project']))){
$query = "where project = ? and date_start >= ? and date_end <= ?;";
$params = array(
);
} else {
$query = "where date_start >= ? and date_end <= ? and project in (".implode(",",$projectIds).");";
$params = array(
$request['date_start'],
$request['date_end']
);
}
}else{
if (!empty($employeeList) && ($request['project'] != "NULL" && !empty($request['project']))) {
$query = "where employee in (" . implode(",", $employeeList) . ") and date_start >= ? and date_end <= ? and project = ?;";
$params = array(
$request['date_start'],
$request['date_end'],
$request['project']
);
} else if (!empty($employeeList)) {
$query = "where employee in (" . implode(",", $employeeList) . ") and date_start >= ? and date_end <= ?;";
$params = array(
$request['date_start'],
$request['date_end']
);
} else if (($request['project'] != "NULL" && !empty($request['project']))) {
$query = "where project = ? and date_start >= ? and date_end <= ?;";
$params = array(
$request['project'],
$request['date_start'],
$request['date_end']
);
}else{
$query = "where date_start >= ? and date_end <= ?;";
$params = array(
);
} else {
$query = "where date_start >= ? and date_end <= ?;";
$params = array(
$request['date_start'],
$request['date_end']
);
);
}
}
LogManager::getInstance()->info("Query:".$query);

View File

@@ -2,7 +2,10 @@
if(!class_exists('ReportBuilder')){
include_once APP_BASE_PATH.'admin/reports/reportClasses/ReportBuilder.php';
}
class ExpenseReport extends ReportBuilder{
if(!class_exists('ReportBuilder')){
include_once APP_BASE_PATH.'admin/reports/reportClasses/ReportBuilder.php';
}
class ExpenseReport extends CSVReportBuilder implements CSVReportBuilderInterface{
public function getMainQuery(){
$query = "SELECT

View File

@@ -1,4 +1,7 @@
<?php
if(!class_exists('ReportBuilder')){
include_once APP_BASE_PATH.'admin/reports/reportClasses/ReportBuilder.php';
}
if(!interface_exists('ReportBuilderInterface')){
include_once APP_BASE_PATH.'admin/reports/reportClasses/ReportBuilderInterface.php';
}
@@ -6,7 +9,7 @@ if(!interface_exists('ReportBuilderInterface')){
if(!class_exists('AttendanceAdminManager')){
include_once APP_BASE_PATH.'admin/attendance/api/AttendanceAdminManager.php';
}
class OvertimeReport implements ReportBuilderInterface{
class OvertimeReport extends ClassBasedReportBuilder implements ReportBuilderInterface{
public function getData($report,$request){
$employeeList = array();

View File

@@ -2,15 +2,8 @@
if(!interface_exists('ReportBuilderInterface')){
include_once APP_BASE_PATH.'admin/reports/reportClasses/ReportBuilderInterface.php';
}
abstract class ReportBuilder implements ReportBuilderInterface{
public function getData($report,$request){
$query = $this->getMainQuery();
$where = $this->getWhereQuery($request);
$query.=" ".$where[0];
return $this->execute($report, $query, $where[1]);
}
abstract class ReportBuilder{
protected function execute($report, $query, $parameters){
$report->DB()->SetFetchMode(ADODB_FETCH_ASSOC);
LogManager::getInstance()->debug("Query: ".$query);
@@ -46,12 +39,170 @@ abstract class ReportBuilder implements ReportBuilderInterface{
return $reportData;
}
abstract public function getWhereQuery($request);
abstract public function getMainQuery();
public function transformData($name, $value){
return $value;
}
}
public function createReportFile($report, $data){
$fileFirstPart = "Report_".str_replace(" ", "_", $report->name)."-".date("Y-m-d_H-i-s");
$fileName = $fileFirstPart.".csv";
$fileFullName = CLIENT_BASE_PATH.'data/'.$fileName;
$fp = fopen($fileFullName, 'w');
foreach ($data as $fields) {
fputcsv($fp, $fields);
}
fclose($fp);
return array($fileFirstPart, $fileName, $fileFullName);
}
public function saveFile($fileFirstPart, $file, $fileFullName){
$uploadedToS3 = false;
$uploadFilesToS3 = SettingsManager::getInstance()->getSetting("Files: Upload Files to S3");
$uploadFilesToS3Key = SettingsManager::getInstance()->getSetting("Files: Amazon S3 Key for File Upload");
$uploadFilesToS3Secret = SettingsManager::getInstance()->getSetting("Files: Amazone S3 Secret for File Upload");
$s3Bucket = SettingsManager::getInstance()->getSetting("Files: S3 Bucket");
$s3WebUrl = SettingsManager::getInstance()->getSetting("Files: S3 Web Url");
if($uploadFilesToS3.'' == '1' && !empty($uploadFilesToS3Key)
&& !empty($uploadFilesToS3Secret) && !empty($s3Bucket) && !empty($s3WebUrl)){
$uploadname = CLIENT_NAME."/".$file;
$s3FileSys = new S3FileSystem($uploadFilesToS3Key, $uploadFilesToS3Secret);
$res = $s3FileSys->putObject($s3Bucket, $uploadname, $fileFullName, 'authenticated-read');
if(empty($res)){
return array("ERROR",$file);
}
unlink($fileFullName);
$file_url = $s3WebUrl.$uploadname;
$file_url = $s3FileSys->generateExpiringURL($file_url);
$uploadedToS3 = true;
}
$fileObj = new File();
$fileObj->name = $fileFirstPart;
$fileObj->filename = $file;
$fileObj->file_group = "Report";
$ok = $fileObj->Save();
if(!$ok){
LogManager::getInstance()->info($fileObj->ErrorMsg());
return array("ERROR","Error generating report");
}
$reportFile = new ReportFile();
$reportFile->name = $fileObj->filename;
$reportFile->attachment = $fileObj->name;
$reportFile->created = date("Y-m-d H:i:s");
$reportFile->employee = BaseService::getInstance()->getCurrentProfileId();
$ok = $reportFile->Save();
if(!$ok){
LogManager::getInstance()->info($reportFile->ErrorMsg());
return array("ERROR","Error generating report");
}
if($uploadedToS3){
return array("SUCCESS",$file_url);
}else{
return array("SUCCESS",$file);
}
}
}
class CSVReportBuilder extends ReportBuilder{
public function getData($report,$request){
$query = $this->getMainQuery();
$where = $this->getWhereQuery($request);
if($query == null || $where == null){
return null;
}
$query.=" ".$where[0];
return $this->execute($report, $query, $where[1]);
}
}
class ClassBasedReportBuilder extends ReportBuilder{
}
class PDFReportBuilder extends ReportBuilder{
var $twig;
protected function getDefaultData(){
$defaultData = array();
$defaultData['BASE_URL'] = BASE_URL;
$defaultData['LOGO'] = UIManager::getInstance()->getCompanyLogoUrl();
$defaultData['LOGO'] = str_replace("https:","http:",$defaultData['LOGO']);
$defaultData['companyName'] = SettingsManager::getInstance()->getSetting("Company: Name");
LogManager::getInstance()->debug("Logo Url:".$defaultData['LOGO']);
return $defaultData;
}
protected function initTemplateEngine($report){
if($report->_table = "UserReports"){
$path = APP_BASE_PATH."modules/reports/customTemplates/";
}else{
$path = APP_BASE_PATH."admin/reports/customTemplates/";
}
$loader = new Twig_Loader_Filesystem($path);
$twigOptions = array();
//false
if(defined('CACHE_THEME') && CACHE_THEME){
$twigOptions = array(
);
}else{
$twigOptions = array(
"cache"=>false
);
}
$this->twig = new Twig_Environment($loader, $twigOptions);
}
public function createReportFile($report, $data){
$fileFirstPart = "Report_".str_replace(" ", "_", $report->name)."-".date("Y-m-d_H-i-s");
$fileName = $fileFirstPart.".html";
$fileFullName = CLIENT_BASE_PATH.'data/'.$fileName;
$this->initTemplateEngine($report);
$template = $this->twig->loadTemplate($this->getTemplate());
$result = $template->render($data);
$fp = fopen($fileFullName, 'w');
fwrite($fp,$result);
fclose($fp);
try{
$fileFullNamePdf = CLIENT_BASE_PATH.'data/'.$fileFirstPart.".pdf";
//Try generating the pdf
exec(WK_HTML_PATH." ".$fileFullName." ".$fileFullNamePdf, $output, $ret);
LogManager::getInstance()->debug("wkhtmltopdf:".print_r($output,true));
LogManager::getInstance()->debug("wkhtmltopdf:".print_r($ret,true));
if(file_exists($fileFullNamePdf)){
$fileName = $fileFirstPart.".pdf";
$fileFullName = $fileFullNamePdf;
}
}catch(Exception $exp){
}
return array($fileFirstPart, $fileName, $fileFullName);
}
}

View File

@@ -1,4 +1,18 @@
<?php
interface ReportBuilderInterface{
public function getData($report,$request);
public function createReportFile($report, $data);
}
interface CSVReportBuilderInterface{
public function getData($report,$request);
public function createReportFile($report, $data);
public function getMainQuery();
public function getWhereQuery($request);
}
interface PDFReportBuilderInterface{
public function getData($report,$request);
public function createReportFile($report, $data);
public function getTemplate();
}

View File

@@ -2,7 +2,7 @@
if(!class_exists('ReportBuilder')){
include_once APP_BASE_PATH.'admin/reports/reportClasses/ReportBuilder.php';
}
class TravelRequestReport extends ReportBuilder{
class TravelRequestReport extends CSVReportBuilder implements CSVReportBuilderInterface{
public function getMainQuery(){
$query = "SELECT

View File

@@ -7,8 +7,8 @@
_fields_
<div class="control-group">
<div class="controls">
<button onclick="try{modJs.save()}catch(e){};return false;" class="btn">Download</button>
<button onclick="modJs.cancel();return false;" class="btn">Cancel</button>
<button onclick="try{modJs.save()}catch(e){};return false;" class="btn"><t>Download</t></button>
<button onclick="modJs.cancel();return false;" class="btn"><t>Cancel</t></button>
</div>
</div>
</form>
</form>

View File

@@ -1,26 +1,26 @@
<?php
if (!class_exists('SalaryAdminManager')) {
class SalaryAdminManager extends AbstractModuleManager{
class SalaryAdminManager extends AbstractModuleManager{
public function initializeUserClasses(){
}
public function initializeFieldMappings(){
}
public function initializeDatabaseErrorMappings(){
public function initializeUserClasses(){
}
public function initializeFieldMappings(){
}
public function initializeDatabaseErrorMappings(){
}
public function setupModuleClassDefinitions(){
}
public function setupModuleClassDefinitions(){
$this->addModelClass('SalaryComponentType');
$this->addModelClass('SalaryComponent');
$this->addModelClass('PayrollEmployee');
}
}
}
}
}
if (!class_exists('SalaryComponentType')) {
@@ -66,3 +66,20 @@ if (!class_exists('PayrollEmployee')) {
}
}
if (!class_exists('PayFrequency')) {
class PayFrequency extends ICEHRM_Record {
var $_table = 'PayFrequency';
public function getAdminAccess(){
return array("get","element","save","delete");
}
public function getManagerAccess(){
return array("get","element","save","delete");
}
public function getUserAccess(){
return array("get","element");
}
}
}

View File

@@ -3,7 +3,7 @@
$moduleName = 'salary';
define('MODULE_PATH',dirname(__FILE__));
include APP_BASE_PATH.'header.php';
include APP_BASE_PATH.'mod-houlejslibs.inc.php';
include APP_BASE_PATH.'modulejslibs.inc.php';
$moduleBuilder = new ModuleBuilder();

View File

@@ -79,162 +79,6 @@ SalaryComponentAdapter.method('getFormFields', function() {
});
/**
* DeductionAdapter
*/
function DeductionAdapter(endPoint,tab,filter,orderBy) {
this.initAdapter(endPoint,tab,filter,orderBy);
}
DeductionAdapter.inherits(AdapterBase);
DeductionAdapter.method('getDataMapping', function() {
return [
"id",
"name",
"deduction_group"
];
});
DeductionAdapter.method('getHeaders', function() {
return [
{ "sTitle": "ID" ,"bVisible":false},
{ "sTitle": "Name" },
{ "sTitle": "Calculation Group"}
];
});
DeductionAdapter.method('getFormFields', function() {
var rangeAmounts = [ "rangeAmounts", {"label":"Calculation Process","type":"datagroup",
"form":[
[ "lowerCondition", {"label":"Lower Limit Condition","type":"select","source":[["No Lower Limit","No Lower Limit"],["gt","Greater than"],["gte","Greater than or Equal"]]}],
[ "lowerLimit", {"label":"Lower Limit","type":"text","validation":"float"}],
[ "upperCondition", {"label":"Upper Limit Condition","type":"select","source":[["No Upper Limit","No Upper Limit"],["lt","Less than"],["lte","Less than or Equal"]]}],
[ "upperLimit", {"label":"Upper Limit","type":"text","validation":"float"}],
[ "amount", {"label":"Value","type":"text","validation":""}]
],
"html":'<div id="#_id_#" class="panel panel-default">#_delete_##_edit_#<div class="panel-body">#_renderFunction_#</div></div>',
"validation":"none",
"custom-validate-function":function (data){
var res = {};
res['valid'] = true;
if(lowerCondition != 'No Lower Limit'){
data.lowerLimit = 0;
}
if(upperCondition != 'No Upper Limit'){
data.upperLimit = 0;
}
res['params'] = data;
return res;
},
"render":function(item){
var output = "";
var getSymbol = function(text){
var map = {};
map['gt'] = '>';
map['gte'] = '>=';
map['lt'] = '<';
map['lte'] = '<=';
return map[text];
}
if(item.lowerCondition != "No Lower Limit"){
output += item.lowerLimit + " " + getSymbol(item.lowerCondition) + " ";
}
if(item.upperCondition != "No Upper Limit"){
output += " and ";
output += getSymbol(item.upperCondition) + " " + item.upperLimit + " ";
}
if(output == ""){
return "Deduction is "+item.amount + " for all ranges";
}else{
return "If salary component "+output+ " deduction is "+item.amount;
}
return output;
}
}];
return [
[ "id", {"label":"ID","type":"hidden"}],
[ "name", {"label":"Name","type":"text","validation":""}],
[ "componentType", {"label":"Salary Component Type","type":"select2multi","allow-null":true,"remote-source":["SalaryComponentType","id","name"]}],
[ "component", {"label":"Salary Component","type":"select2multi","allow-null":true,"remote-source":["SalaryComponent","id","name"]}],
[ "payrollColumn", {"label":"Payroll Report Column","type":"select2","allow-null":true,"remote-source":["PayrollColumn","id","name"]}],
rangeAmounts,
[ "deduction_group", {"label":"Calculation Group","type":"select2","allow-null":true,"null-label":"None","remote-source":["DeductionGroup","id","name"]}]
];
});
/*
DeductionAdapter.method('doCustomValidation', function(params) {
if(params.type == "Fixed"){
return null;
}
if(params.percentage_type == "On Component Type"){
params.component = "NULL";
if(params.componentType == "NULL"){
return "Salary component type should be selected";
}
}else if(params.percentage_type == "On Component"){
params.componentType = "NULL";
if(params.component == "NULL"){
return "Salary component should be selected";
}
}
return null;
});
*/
/*
DeductionAdapter.method('postRenderForm', function(object, $tempDomObj) {
$tempDomObj.find("#field_componentType").hide();
$tempDomObj.find("#field_percentage_type").hide();
$tempDomObj.find("#field_component").hide();
$tempDomObj.find("#percentage_type").off().on('change',function(e){
if(e.val == "On Component"){
$("#componentType").hide();
$("#component").show();
}else{
$("#componentType").show();
$("#component").hide();
}
});
$tempDomObj.find("#type").off().on('change',function(e){
if(e.val == "Fixed"){
$("#componentType").hide();
$("#percentage_type").hide();
$("#component").hide();
}else{
$("#percentage_type").show();
if($("#percentage_type").select2('data').id == 'On Component'){
$("#field_componentType").hide();
$("#field_component").show();
}else{
$("#field_componentType").show();
$("#field_component").hide();
}
}
});
});
*/
/*
@@ -288,43 +132,3 @@ EmployeeSalaryAdapter.method('getFilters', function() {
/*
* DeductionGroupAdapter
*/
function DeductionGroupAdapter(endPoint,tab,filter,orderBy) {
this.initAdapter(endPoint,tab,filter,orderBy);
}
DeductionGroupAdapter.inherits(AdapterBase);
DeductionGroupAdapter.method('getDataMapping', function() {
return [
"id",
"name",
"description"
];
});
DeductionGroupAdapter.method('getHeaders', function() {
return [
{ "sTitle": "ID" ,"bVisible":false},
{ "sTitle": "Name" },
{ "sTitle": "Details" }
];
});
DeductionGroupAdapter.method('getFormFields', function() {
return [
[ "id", {"label":"ID","type":"hidden"}],
[ "name", {"label":"Name","type":"text","validation":""}],
[ "description", {"label":"Details","type":"textarea","validation":"none"}]
];
});

View File

@@ -2,16 +2,16 @@
<div class="small-box bg-green">
<div class="inner">
<h3>Settings</h3>
<h3><t>Settings</t></h3>
<p>
Configure IceHrm
<t>Configure</t> IceHrm
</p>
</div>
<div class="icon">
<i class="ion ion-settings"></i>
</div>
<a href="#_moduleLink_#" class="small-box-footer" id="settingsLink">
Update Settings <i class="fa fa-arrow-circle-right"></i>
<t>Update</t> <t>Settings</t> <i class="fa fa-arrow-circle-right"></i>
</a>
</div>
</div>
</div>

View File

@@ -34,9 +34,9 @@ $options1['setShowAddNew'] = 'false';
$moduleBuilder->addModuleOrGroup(new ModuleTab('CompanySetting','Setting','Company','SettingAdapter','{"name":["Company:"]}','name',true,$options1));
$moduleBuilder->addModuleOrGroup(new ModuleTab('SystemSetting','Setting','System','SettingAdapter','{"name":["System:"]}','name',false,$options1));
$moduleBuilder->addModuleOrGroup(new ModuleTab('EmailSetting','Setting','Email','SettingAdapter','{"name":["Email:"]}','name',false,$options1));
//$moduleBuilder->addModuleOrGroup(new ModuleTab('LeaveSetting','Setting','Leave / PTO','SettingAdapter','{"name":["Leave:"]}','name',false,$options1));
$moduleBuilder->addModuleOrGroup(new ModuleTab('LDAPSetting','Setting','LDAP','SettingAdapter','{"name":["LDAP:"]}','name',false,$options1));
$moduleBuilder->addModuleOrGroup(new ModuleTab('OtherSetting','Setting','Other','SettingAdapter','{"name":["Projects:","Attendance:","Recruitment:","Notifications:","Expense:","Travel:","Api:"]}','name',false,$options1));
$moduleBuilder->addModuleOrGroup(new ModuleTab('AttendanceSetting','Setting','Attendance','SettingAdapter','{"name":["Attendance:"]}','name',false,$options1));
$moduleBuilder->addModuleOrGroup(new ModuleTab('OtherSetting','Setting','Other','SettingAdapter','{"name":["Projects:","Recruitment:","Notifications:","Expense:","Travel:","Api:","Overtime:"]}','name',false,$options1));
echo UIManager::getInstance()->renderModule($moduleBuilder);
?>
</div>
@@ -47,4 +47,4 @@ $(window).load(function() {
});
</script>
<?php include APP_BASE_PATH.'footer.php';?>
<?php include APP_BASE_PATH.'footer.php';?>

View File

@@ -86,6 +86,7 @@ SettingAdapter.method('loadRemoteDataForSettings', function () {
fields.push(["country", {"label": "Country", "type": "select2multi", "remote-source": ["Country", "id", "name"]}]);
fields.push(["currency", {"label": "Currency", "type": "select2multi", "remote-source": ["CurrencyType","id","code+name"]}]);
fields.push(["nationality", {"label": "Nationality", "type": "select2multi", "remote-source": ["Nationality","id","name"]}]);
fields.push(["supportedLanguage", {"label":"Value","type":"select2","allow-null":false,"remote-source":["SupportedLanguage","name","description"]}]);
for(index in fields){
field = fields[index];
@@ -107,4 +108,4 @@ SettingAdapter.method('loadRemoteDataForSettings', function () {
SettingAdapter.method('getHelpLink', function () {
return 'http://blog.icehrm.com/docs/settings/';
});
});

View File

@@ -9,8 +9,8 @@
</div>
<div class="control-group">
<div class="controls">
<button onclick="try{modJs.save()}catch(e){};return false;" class="btn">Save</button>
<button onclick="modJs.cancel();return false;" class="btn">Cancel</button>
<button onclick="try{modJs.save()}catch(e){};return false;" class="btn"><t>Save</t></button>
<button onclick="modJs.cancel();return false;" class="btn"><t>Cancel</t></button>
</div>
</div>
</form>
</form>

View File

@@ -14,6 +14,14 @@ class TravelActionManager extends ApproveAdminActionManager{
}
public function getModuleTabUrl(){
return "g=modules&n=travel&m=module_Travel_Management";
return "g=modules&n=travel&m=module_Travel_Management#tabEmployeeTravelRecord";
}
public function getModuleSubordinateTabUrl(){
return "g=modules&n=travel&m=module_Travel_Management#tabSubordinateEmployeeTravelRecord";
}
public function getModuleApprovalTabUrl(){
return "g=modules&n=travel&m=module_Travel_Management#tabEmployeeTravelRecordApproval";
}
}

View File

@@ -89,9 +89,13 @@ if (!class_exists('EmployeeTravelRecord')) {
var $notificationModuleName = "Travel Management";
var $notificationUnitName = "TravelRequest";
var $notificationUnitPrefix = "A";
var $notificationUnitAdminUrl = "g=admin&n=travel&m=admin_Employees";
var $notificationUnitAdminUrl = "g=modules&n=travel&m=module_Travel_Management#tabSubordinateEmployeeTravelRecord";
var $preApproveSettingName = "Travel: Pre-Approve Travel Request";
public function isMultiLevelApprovalsEnabled(){
return (SettingsManager::getInstance()->getSetting('Travel: Enable Multi Level Approvals') == '1');
}
public function getAdminAccess()
{
return array("get", "element", "save", "delete");
@@ -124,5 +128,28 @@ if (!class_exists('EmployeeTravelRecord')) {
);
}
public function getType(){
return 'EmployeeTravelRecord';
}
public function allowIndirectMapping(){
if(SettingsManager::getInstance()->getSetting('Travel: Allow Indirect Admins to Approve') == '1'){
return true;
}
return false;
}
}
}
}
if (!class_exists('EmployeeTravelRecordApproval')) {
class EmployeeTravelRecordApproval extends EmployeeTravelRecord
{
public function Find($whereOrderBy,$bindarr=false,$pkeysArr=false,$extra=array()){
return $this->findApprovals(new EmployeeTravelRecord(), $whereOrderBy,$bindarr,$pkeysArr,$extra);
}
}
}

View File

@@ -3,17 +3,17 @@
<div class="small-box bg-red">
<div class="inner">
<h3>
Travel
<t>Travel</t>
</h3>
<p id="numberOfTravel">
Requests
<t>Requests</t>
</p>
</div>
<div class="icon">
<i class="ion ion-plane"></i>
</div>
<a href="#_moduleLink_#" class="small-box-footer" id="travelLink">
Manage Travel <i class="fa fa-arrow-circle-right"></i>
<t>Manage</t> <t>Travel</t> <i class="fa fa-arrow-circle-right"></i>
</a>
</div>
</div>
</div>

View File

@@ -30,7 +30,7 @@ $options = array();
$options['setRemoteTable'] = 'true';
$moduleBuilder = new ModuleBuilder();
$moduleBuilder->addModuleOrGroup(new ModuleTab('EmployeeTravelRecord','EmployeeTravelRecord','Travel Requests','EmployeeTravelRecordAdapter','','',true,$options));
$moduleBuilder->addModuleOrGroup(new ModuleTab('EmployeeTravelRecord','EmployeeTravelRecord','Travel Requests','EmployeeTravelRecordAdminAdapter','','',true,$options));
echo UIManager::getInstance()->renderModule($moduleBuilder);
@@ -38,41 +38,4 @@ $itemName = 'TravelRequest';
$moduleName = 'Travel Management';
$itemNameLower = strtolower($itemName);
$statuses = array("Approved","Pending","Rejected","Cancelled");
?><div class="modal" id="<?=$itemNameLower?>StatusModel" tabindex="-1" role="dialog" aria-labelledby="messageModelLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"><li class="fa fa-times"/></button>
<h3 style="font-size: 17px;">Change <?=$itemName?> Status</h3>
</div>
<div class="modal-body">
<form id="expenseStatusForm">
<div class="control-group">
<label class="control-label" for="expense_status"><?=$itemName?> Status</label>
<div class="controls">
<select type="text" id="<?=$itemNameLower?>_status" class="form-control" name="<?=$itemNameLower?>_status" value="">
<?php foreach($statuses as $status){?>
<option value="<?=$status?>"><?=$status?></option>
<?php }?>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="expense_status">Status Change Note</label>
<div class="controls">
<textarea id="<?=$itemNameLower?>_reason" class="form-control" name="<?=$itemNameLower?>_reason" maxlength="500"></textarea>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button class="btn btn-primary" onclick="modJs.changeStatus();">Change <?=$itemName?> Status</button>
<button class="btn" onclick="modJs.closeDialog();">Not Now</button>
</div>
</div>
</div>
</div>
<?php
include APP_BASE_PATH.'footer.php';
include APP_BASE_PATH.'footer.php';

View File

@@ -110,22 +110,22 @@ EmployeeImmigrationAdapter.method('getFilters', function() {
/**
* EmployeeTravelRecordAdapter
* EmployeeTravelRecordAdminAdapter
*/
function EmployeeTravelRecordAdapter(endPoint,tab,filter,orderBy) {
function EmployeeTravelRecordAdminAdapter(endPoint,tab,filter,orderBy) {
this.initAdapter(endPoint,tab,filter,orderBy);
this.itemName = 'TravelRequest';
this.itemNameLower = 'travelrequest';
this.modulePathName = 'travel';
}
EmployeeTravelRecordAdapter.inherits(ApproveAdminAdapter);
EmployeeTravelRecordAdminAdapter.inherits(ApproveAdminAdapter);
EmployeeTravelRecordAdapter.method('getDataMapping', function() {
EmployeeTravelRecordAdminAdapter.method('getDataMapping', function() {
return [
"id",
"employee",
@@ -138,7 +138,7 @@ EmployeeTravelRecordAdapter.method('getDataMapping', function() {
];
});
EmployeeTravelRecordAdapter.method('getHeaders', function() {
EmployeeTravelRecordAdminAdapter.method('getHeaders', function() {
return [
{ "sTitle": "ID" ,"bVisible":false},
{ "sTitle": "Employee" },
@@ -151,7 +151,7 @@ EmployeeTravelRecordAdapter.method('getHeaders', function() {
];
});
EmployeeTravelRecordAdapter.method('getFormFields', function() {
EmployeeTravelRecordAdminAdapter.method('getFormFields', function() {
return [
["id", {"label": "ID", "type": "hidden"}],
["employee", {

View File

@@ -2,16 +2,16 @@
<div class="small-box bg-yellow">
<div class="inner">
<h3>Users</h3>
<h3><t>Users</t></h3>
<p id="numberOfUsers">
#_numberOfUsers_# Users
#_numberOfUsers_# <t>Users</t>
</p>
</div>
<div class="icon">
<i class="ion ion-person-add"></i>
</div>
<a href="#_moduleLink_#" class="small-box-footer" id="usersLink">
Manage Users <i class="fa fa-arrow-circle-right"></i>
<t>Manage</t> <t>Users</t> <i class="fa fa-arrow-circle-right"></i>
</a>
</div>
</div>
</div>

View File

@@ -29,8 +29,8 @@ include APP_BASE_PATH.'modulejslibs.inc.php';
?><div class="span9">
<ul class="nav nav-tabs" id="modTab" style="margin-bottom:0px;margin-left:5px;border-bottom: none;">
<li class="active"><a id="tabUser" href="#tabPageUser">Users</a></li>
<li class=""><a id="tabUserRole" href="#tabPageUserRole">User Roles</a></li>
<li class="active"><a id="tabUser" href="#tabPageUser"><?=LanguageManager::tran('Users')?></a></li>
<li class=""><a id="tabUserRole" href="#tabPageUserRole"><?=LanguageManager::tran('User Roles')?></a></li>
</ul>
<div class="tab-content">
@@ -63,4 +63,4 @@ modJsList['tabUserRole'] = new UserRoleAdapter('UserRole');
var modJs = modJsList['tabUser'];
</script>
<?php include APP_BASE_PATH.'footer.php';?>
<?php include APP_BASE_PATH.'footer.php';?>

View File

@@ -36,8 +36,9 @@ UserAdapter.method('getFormFields', function() {
[ "email", {"label":"Email","type":"text","validation":"email"}],
[ "employee", {"label":"Employee","type":"select2","allow-null":true,"remote-source":["Employee","id","first_name+last_name"]}],
[ "user_level", {"label":"User Level","type":"select","source":[["Admin","Admin"],["Manager","Manager"],["Employee","Employee"],["Other","Other"]]}],
[ "user_roles", {"label":"User Roles","type":"select2multi","remote-source":["UserRole","id","name"]}],
[ "default_module", {"label":"Default Module","type":"select2","null-label":"No Default Module","allow-null":true,"remote-source":["Module","id","menu+label"]}]
[ "user_roles", {"label":"User Roles","type":"select2multi","remote-source":["UserRole","id","name"]}],
[ "lang", {"label":"Language","type":"select2","allow-null":true,"remote-source":["SupportedLanguage","name","description"]}],
[ "default_module", {"label":"Default Module","type":"select2","null-label":"No Default Module","allow-null":true,"remote-source":["Module","id","menu+label"]}]
];
});
@@ -186,6 +187,11 @@ UserRoleAdapter.method('getHeaders', function() {
];
});
UserRoleAdapter.method('postRenderForm', function(object, $tempDomObj) {
$tempDomObj.find("#changePasswordBtn").remove();
});
UserRoleAdapter.method('getFormFields', function() {
return [
[ "id", {"label":"ID","type":"hidden"}],