From 31bb455d6ff93da6fd80fe4e3a4edd3c7ba33c49 Mon Sep 17 00:00:00 2001 From: Thilina Hasantha Date: Fri, 15 Apr 2016 20:24:39 +0530 Subject: [PATCH] Release note v16.0 ------------------ ### Features * Advanced Employee Management Module is now included in IceHrm Open Source Edition * LDAP Module which was only available in IceHrm Enterprise is now included in open source also * Initial implementation of icehrm REST Api for reading employee details * Improvements to data filtering * Multiple tabs for settings module * Overtime reports - now its possible to calculate overtime for employees.compatible with US overtime rules * Logout the user if tried accessing an unauthorized module * Setting for updating module names ### Fixes * Fix issue: classes should be loaded even the module is disabled * Deleting the only Admin user is not allowed * Fixes for handling non UTF-8 * Fix for non-mandatory select boxes are shown as mandatory --- core-ext/app/install/config.php | 2 +- core-ext/classes/LDAPManager.php | 82 + core-ext/common.cron.tasks.ext.php | 2 +- core-ext/config.base.php | 6 +- .../upgrade_v15.2.OS_to_v16.0.OS.sql | 187 ++ core-ext/doc/ldap-config.txt | 27 + core-ext/login.com.inc.php | 2 + core-ext/login.php | 500 +++-- core-ext/model/models.base.php | 30 +- core-ext/popups.php | 244 +-- core-ext/scripts/icehrm_master_data.sql | 1920 +++++++++-------- core-ext/scripts/icehrm_sample_data.sql | 198 +- core-ext/scripts/icehrmdb.sql | 1433 +++++++----- .../attendance/api/AttendanceAdminManager.php | 51 + ext/admin/{payroll => charts}/LICENSE.txt | 0 ext/admin/{payroll => charts}/README.txt | 0 ext/admin/charts/api/ChartsActionManager.php | 156 ++ .../charts/api/ChartsAdminManager.php} | 22 +- ext/admin/charts/index.php | 56 + ext/admin/charts/lib.js | 284 +++ ext/admin/charts/meta.json | 11 + .../api/Company_structureAdminManager.php | 31 + ext/admin/employees/LICENSE.txt | 44 + ext/admin/employees/README.txt | 7 + .../employees/api/EmployeesActionManager.php | 164 ++ .../employees/api/EmployeesAdminManager.php | 273 ++- .../employees/customTemplates/myDetails.html | 248 +++ ext/admin/employees/db_update.sql | 108 + ext/admin/employees/index.php | 182 +- ext/admin/employees/lib.js | 1793 ++++++++++++++- .../fieldnames/api/FieldnamesAdminManager.php | 57 + ext/admin/fieldnames/index.php | 62 + ext/admin/fieldnames/lib.js | 86 + ext/admin/fieldnames/meta.json | 11 + ext/admin/meta.json | 2 +- .../metadata/api/MetadataAdminManager.php | 71 + ext/admin/metadata/index.php | 1 - ext/admin/modules/index.php | 6 +- ext/admin/modules/lib.js | 7 +- ext/admin/payroll/meta.json | 11 - .../reportClasses/EmployeeLeavesReport.php | 30 +- ext/admin/salary/LICENSE.txt | 44 + ext/admin/salary/README.txt | 7 + .../api/SalaryAdminManager.php} | 32 +- ext/admin/{payroll => salary}/index.php | 9 +- ext/admin/{payroll => salary}/lib.js | 176 +- ext/admin/salary/meta.json | 11 + ext/admin/settings/api/SettingsInitialize.php | 4 +- ext/admin/settings/index.php | 37 +- ext/admin/settings/lib.js | 44 +- ext/admin/travel/api/TravelActionManager.php | 19 - ext/admin/travel/api/TravelAdminManager.php | 128 -- ext/admin/travel/dashboard.html | 19 - ext/admin/travel/index.php | 78 - ext/admin/travel/lib.js | 182 -- ext/admin/travel/meta.json | 12 - ext/admin/users/api/UsersActionManager.php | 12 +- ext/admin/users/api/UsersAdminManager.php | 29 + .../employees/api/EmployeesActionManager.php | 29 +- .../employees/customTemplates/myDetails.html | 112 +- .../{travel => employees}/dashboard.html | 12 +- ext/modules/employees/index.php | 40 +- ext/modules/employees/lib.js | 357 ++- ext/modules/employees/meta.json | 1 + ext/modules/meta.json | 9 +- ext/modules/salary/lib.js | 6 - .../travel/api/TravelActionManager.php | 59 - ext/modules/travel/index.php | 66 - ext/modules/travel/lib.js | 158 -- ext/modules/travel/meta.json | 23 - readme.md | 13 +- 71 files changed, 7322 insertions(+), 2813 deletions(-) create mode 100644 core-ext/classes/LDAPManager.php create mode 100644 core-ext/db_upgrade/upgrade_v15.2.OS_to_v16.0.OS.sql create mode 100644 core-ext/doc/ldap-config.txt create mode 100644 core-ext/login.com.inc.php rename ext/admin/{payroll => charts}/LICENSE.txt (100%) rename ext/admin/{payroll => charts}/README.txt (100%) create mode 100644 ext/admin/charts/api/ChartsActionManager.php rename ext/{modules/travel/api/TravelModulesManager.php => admin/charts/api/ChartsAdminManager.php} (65%) create mode 100644 ext/admin/charts/index.php create mode 100644 ext/admin/charts/lib.js create mode 100644 ext/admin/charts/meta.json create mode 100644 ext/admin/employees/LICENSE.txt create mode 100644 ext/admin/employees/README.txt create mode 100644 ext/admin/employees/api/EmployeesActionManager.php create mode 100644 ext/admin/employees/customTemplates/myDetails.html create mode 100644 ext/admin/employees/db_update.sql create mode 100644 ext/admin/fieldnames/api/FieldnamesAdminManager.php create mode 100644 ext/admin/fieldnames/index.php create mode 100644 ext/admin/fieldnames/lib.js create mode 100644 ext/admin/fieldnames/meta.json delete mode 100644 ext/admin/payroll/meta.json create mode 100644 ext/admin/salary/LICENSE.txt create mode 100644 ext/admin/salary/README.txt rename ext/admin/{payroll/api/PayrollAdminManager.php => salary/api/SalaryAdminManager.php} (64%) rename ext/admin/{payroll => salary}/index.php (56%) rename ext/admin/{payroll => salary}/lib.js (62%) create mode 100644 ext/admin/salary/meta.json delete mode 100644 ext/admin/travel/api/TravelActionManager.php delete mode 100644 ext/admin/travel/api/TravelAdminManager.php delete mode 100644 ext/admin/travel/dashboard.html delete mode 100644 ext/admin/travel/index.php delete mode 100644 ext/admin/travel/lib.js delete mode 100644 ext/admin/travel/meta.json rename ext/modules/{travel => employees}/dashboard.html (54%) delete mode 100644 ext/modules/travel/api/TravelActionManager.php delete mode 100644 ext/modules/travel/index.php delete mode 100644 ext/modules/travel/lib.js delete mode 100644 ext/modules/travel/meta.json diff --git a/core-ext/app/install/config.php b/core-ext/app/install/config.php index 588c5d87..2d397e4a 100644 --- a/core-ext/app/install/config.php +++ b/core-ext/app/install/config.php @@ -5,4 +5,4 @@ define('CURRENT_PATH',dirname(__FILE__)); define('CLIENT_APP_PATH',realpath(dirname(__FILE__)."/..")."/"); define('APP_PATH',realpath(dirname(__FILE__)."/../..")."/"); define('APP_NAME',"ICE Hrm"); -define('APP_ID',"icehrm"); +define('APP_ID',"icehrm"); \ No newline at end of file diff --git a/core-ext/classes/LDAPManager.php b/core-ext/classes/LDAPManager.php new file mode 100644 index 00000000..5ffc2ac0 --- /dev/null +++ b/core-ext/classes/LDAPManager.php @@ -0,0 +1,82 @@ +getSetting("LDAP: Server"); + $ldap_port = SettingsManager::getInstance()->getSetting("LDAP: Port"); + $ldap_dn = SettingsManager::getInstance()->getSetting("LDAP: Root DN"); + + $managerDN = SettingsManager::getInstance()->getSetting("LDAP: Manager DN"); + $managerPassword = SettingsManager::getInstance()->getSetting("LDAP: Manager Password"); + + // connect to active directory + if(empty($ldap_port)){ + $ldap_port = 389; + } + + $ldap = ldap_connect($ldap_host, intval($ldap_port)); + + if(!$ldap){ + return new IceResponse(IceResponse::ERROR,"Could not connect to LDAP Server"); + } + + LogManager::getInstance()->debug("LDAP Connect Result:".print_r($ldap,true)); + + if(SettingsManager::getInstance()->getSetting("LDAP: Version 3") == "1"){ + ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3); + } + ldap_set_option($ldap, LDAP_OPT_REFERRALS, 0); + + // verify user and password + $bind = @ldap_bind($ldap, $managerDN, $managerPassword); + + LogManager::getInstance()->debug("LDAP Manager Bind:".print_r($bind,true)); + + if($bind) { + + $userFilterStr = SettingsManager::getInstance()->getSetting("LDAP: User Filter"); + + $filter = str_replace("{}", $user, $userFilterStr); //"(uid=" . $user . ")"; + $result = ldap_search($ldap, $ldap_dn, $filter); + LogManager::getInstance()->debug("LDAP Search Result:".print_r($result,true)); + if(!$result){ + exit("Unable to search LDAP server"); + } + $entries = ldap_get_entries($ldap, $result); + LogManager::getInstance()->debug("LDAP Search Entries:".print_r($entries,true)); + + if(empty($entries) || !isset($entries[0]) || !isset($entries[0]['dn'])){ + return new IceResponse(IceResponse::ERROR,"Invalid user"); + } + + $bind = @ldap_bind($ldap,$entries[0]['dn'], $password); + ldap_unbind($ldap); + + if($bind){ + return new IceResponse(IceResponse::SUCCESS, $entries[0]); + }else{ + return new IceResponse(IceResponse::ERROR,"Invalid user"); + } + + + } else { + return new IceResponse(IceResponse::ERROR,"Invalid manager user"); + } + } +} \ No newline at end of file diff --git a/core-ext/common.cron.tasks.ext.php b/core-ext/common.cron.tasks.ext.php index b3d9bbc7..a8143662 100644 --- a/core-ext/common.cron.tasks.ext.php +++ b/core-ext/common.cron.tasks.ext.php @@ -1 +1 @@ -Settings + +LDAP: Enabled = Yes +LDAP: Server = ldap.forumsys.com +LDAP: Port = 389 +LDAP: Root DN = dc=example,dc=com +LDAP: Manager DN = cn=read-only-admin,dc=example,dc=com +LDAP: Manager Password = password +LDAP: Version 3 = Yes +LDAP: User Filter = uid={} + +Then create a user with username "riemann" under System->Users + +Logout and try login with riemann/password + diff --git a/core-ext/login.com.inc.php b/core-ext/login.com.inc.php new file mode 100644 index 00000000..1828ae43 --- /dev/null +++ b/core-ext/login.com.inc.php @@ -0,0 +1,2 @@ +Load("login_hash = ?",array($_COOKIE['icehrmLF'])); + + if(!empty($tempUser->id) && + sha1($tempUser->email."_".$tempUser->password) == $_COOKIE['icehrmLF']){ + + $_REQUEST['username'] = $tempUser->username; + $_REQUEST['password'] = $tempUser->password; + $_REQUEST['hashedPwd'] = $tempUser->password; + } + } + if(!empty($_REQUEST['username']) && !empty($_REQUEST['password'])){ + $suser = null; $ssoUserLoaded = false; - if(empty($suser)){ - $suser = new User(); - $suser->Load("(username = ? or email = ?) and password = ?",array($_REQUEST['username'],$_REQUEST['username'],md5($_REQUEST['password']))); + if($_REQUEST['username'] != "admin") { + LogManager::getInstance()->debug("LDAP: Enabled :" . SettingsManager::getInstance()->getSetting("LDAP: Enabled")); + if (SettingsManager::getInstance()->getSetting("LDAP: Enabled") == "1") { + $ldapResp = LDAPManager::getInstance()->checkLDAPLogin($_REQUEST['username'], $_REQUEST['password']); + LogManager::getInstance()->debug("LDAP Response :" . json_encode($ldapResp)); + if ($ldapResp->getStatus() == IceResponse::ERROR) { + header("Location:" . CLIENT_BASE_URL . "login.php?f=1"); + exit(); + } else { + $suser = new User(); + $suser->Load("username = ?", array($_REQUEST['username'])); + + if (empty($suser)) { + header("Location:" . CLIENT_BASE_URL . "login.php?f=1"); + exit(); + } + + $ssoUserLoaded = true; + } + } } - if($suser->password == md5($_REQUEST['password']) || $ssoUserLoaded){ + + if(!isset($_REQUEST['hashedPwd'])){ + $_REQUEST['hashedPwd'] = md5($_REQUEST['password']); + } + $suser = null; + $ssoUserLoaded = false; + + include 'login.com.inc.php'; + + if(empty($suser)){ + $suser = new User(); + $suser->Load("(username = ? or email = ?) and password = ?",array($_REQUEST['username'],$_REQUEST['username'],$_REQUEST['hashedPwd'])); + } + + if($suser->password == $_REQUEST['hashedPwd'] || $ssoUserLoaded){ $user = $suser; SessionUtils::saveSessionObject('user', $user); $suser->last_login = date("Y-m-d H:i:s"); @@ -24,12 +73,29 @@ if(empty($user)){ BaseService::getInstance()->audit(IceConstants::AUDIT_AUTHENTICATION, "User Login"); } + if(!$ssoUserLoaded && isset($_REQUEST['remember'])){ + //Add cookie + $suser->login_hash = sha1($suser->email."_".$suser->password); + $suser->Save(); + + setcookie('icehrmLF',$suser->login_hash); + } + + if(!isset($_REQUEST['remember'])){ + setcookie('icehrmLF'); + } + $redirectUrl = SessionUtils::getSessionObject('loginRedirect'); if(!empty($redirectUrl)){ header("Location:".$redirectUrl); }else{ if($user->user_level == "Admin"){ - header("Location:".HOME_LINK_ADMIN); + if(SessionUtils::getSessionObject('account_locked') == "1"){ + header("Location:".CLIENT_BASE_URL."?g=admin&n=billing&m=admin_System"); + }else{ + header("Location:".HOME_LINK_ADMIN); + } + }else{ if(empty($user->default_module)){ header("Location:".HOME_LINK_OTHERS); @@ -39,12 +105,13 @@ if(empty($user)){ if($defaultModule->mod_group == "user"){ $defaultModule->mod_group = "modules"; } - $homeLink = CLIENT_BASE_URL."?g=".$defaultModule->mod_group."&n=".$defaultModule->name. + $homeLink = CLIENT_BASE_URL."?g=".$defaultModule->mod_group."&&n=".$defaultModule->name. "&m=".$defaultModule->mod_group."_".str_replace(" ","_",$defaultModule->menu); header("Location:".$homeLink); } } } + }else{ header("Location:".CLIENT_BASE_URL."login.php?f=1"); } @@ -70,27 +137,25 @@ if(empty($user)){ } $tuser = SessionUtils::getSessionObject('user'); -//check user - $logoFileUrl = UIManager::getInstance()->getCompanyLogoUrl(); ?> - + - <?=APP_NAME?> Login v<?=VERSION?> © http://icehrm.com + <?=APP_NAME?> Login - - + + - - + + - - - + + + @@ -98,7 +163,7 @@ $logoFileUrl = UIManager::getInstance()->getCompanyLogoUrl(); - -
- IceHrm Pro - + - REQUIRES Windows, OSX, Linux - + - ga('create', 'getGAKey()?>', 'gamonoid.com'); - ga('send', 'pageview'); + - - -
- -
+
+ +
- -
    -
  • Admin: (Username = admin/ Password = admin)
  • -
  • Manager: (Username = manager/ Password = demouserpwd)
  • -
  • User: (Username = user1/ Password = demouserpwd)
  • -
  • User: (Username = user2/ Password = demouserpwd)
  • -
-
- -
-
- + +
+
+ -
-
-
+ + + +
+
+
+
+ + +
+
+ + +
+
+ +
+
+
+
diff --git a/core-ext/model/models.base.php b/core-ext/model/models.base.php index 789ab786..d5bf88fd 100644 --- a/core-ext/model/models.base.php +++ b/core-ext/model/models.base.php @@ -5,9 +5,9 @@ class ICEHRM_Record extends ADOdb_Active_Record{ return array("get","element","save","delete"); } - public function getOtherAccess(){ - return array("get","element","save","delete"); - } + public function getOtherAccess(){ + return array("get","element","save","delete"); + } public function getManagerAccess(){ return array("get","element"); @@ -16,7 +16,7 @@ class ICEHRM_Record extends ADOdb_Active_Record{ public function getUserAccess(){ return array("get","element"); } - + public function getEmployeeAccess(){ return $this->getUserAccess(); } @@ -57,9 +57,9 @@ class ICEHRM_Record extends ADOdb_Active_Record{ } - public function postProcessGetData($obj){ - return $obj; - } + public function postProcessGetData($obj){ + return $obj; + } public function postProcessGetElement($obj){ return $obj; @@ -69,12 +69,12 @@ class ICEHRM_Record extends ADOdb_Active_Record{ return array("get","element","save","delete"); } - public function getVirtualFields(){ - return array( - ); - } + public function getVirtualFields(){ + return array( + ); + } - public function allowIndirectMapping(){ - return false; - } -} + public function allowIndirectMapping(){ + return false; + } +} \ No newline at end of file diff --git a/core-ext/popups.php b/core-ext/popups.php index 929dd35d..7a6d2fc7 100644 --- a/core-ext/popups.php +++ b/core-ext/popups.php @@ -1,54 +1,54 @@ @@ -89,98 +89,98 @@
user_level == 'Admin'){?> - - - + + + + + + \ No newline at end of file diff --git a/ext/admin/employees/lib.js b/ext/admin/employees/lib.js index 133bf7f7..42c729c7 100644 --- a/ext/admin/employees/lib.js +++ b/ext/admin/employees/lib.js @@ -2,95 +2,1752 @@ * Author: Thilina Hasantha */ -function EmployeeAdapter(endPoint) { - this.initAdapter(endPoint); +function SubProfileEnabledAdapterBase(endPoint,tab,filter,orderBy) { + this.initAdapter(endPoint,tab,filter,orderBy); } -EmployeeAdapter.inherits(AdapterBase); +SubProfileEnabledAdapterBase.inherits(AdapterBase); + +SubProfileEnabledAdapterBase.method('isSubProfileTable', function() { + if(this.user.user_level == "Admin"){ + return false; + }else{ + return true; + } + +}); + +function EmployeeAdapter(endPoint,tab,filter,orderBy) { + this.initAdapter(endPoint,tab,filter,orderBy); + this.fieldNameMap = {}; + this.hiddenFields = {}; + this.tableFields = {}; + this.formOnlyFields = {}; + this.customFields = []; +} + +EmployeeAdapter.inherits(SubProfileEnabledAdapterBase); + +EmployeeAdapter.method('setFieldNameMap', function(fields) { + var field; + for(var i=0;i
'; +}); +EmployeeAdapter.method('setCustomFields', function(fields) { + var field, parsed; + for(var i=0;i
#_delete_##_edit_#Date: #_date_#
#_note_#
', + "validation":"none", + "sort-function":function (a,b){ + var t1 = Date.parse(a.date).getTime(); + var t2 = Date.parse(b.date).getTime(); + + return (t1
#_delete_##_edit_#Date: #_date_#
#_note_#
', + "validation":"none", + "sort-function":function (a,b){ + var t1 = Date.parse(a.date).getTime(); + var t2 = Date.parse(b.date).getTime(); + + return (t1'; + return addBtn + "Skills"; +}); + +EmployeeSubSkillsAdapter.method('getSubItemHtml', function(item, itemDelete, itemEdit) { + var itemHtml = $('
'+item[2]+itemDelete+itemEdit+'

'+nl2br(item[3])+'

'); + return itemHtml; +}); + + + + +/** + * @class EmployeeSubEducationAdapter + * @param endPoint + * @param tab + * @param filter + * @param orderBy + * @returns + */ + + +function EmployeeSubEducationAdapter(endPoint,tab,filter,orderBy) { + this.initAdapter(endPoint,tab,filter,orderBy); +} + +EmployeeSubEducationAdapter.inherits(SubAdapterBase); + + + +EmployeeSubEducationAdapter.method('getDataMapping', function() { + return [ + "id", + "employee", + "education_id", + "institute", + "date_start", + "date_end" + ]; +}); + +EmployeeSubEducationAdapter.method('getHeaders', function() { + return [ + { "sTitle": "ID", "bVisible":false}, + { "sTitle": "Employee" }, + { "sTitle": "Qualification" }, + { "sTitle": "Institute"}, + { "sTitle": "Start Date"}, + { "sTitle": "Completed On"}, + ]; +}); + +EmployeeSubEducationAdapter.method('getFormFields', function() { + return [ + [ "id", {"label":"ID","type":"hidden"}], + [ "employee", {"label":"Employee","type":"hidden"}], + [ "education_id", {"label":"Qualification","type":"select2","allow-null":false,"remote-source":["Education","id","name"]}], + [ "institute", {"label":"Institute","type":"text","validation":""}], + [ "date_start", {"label":"Start Date","type":"date","validation":"none"}], + [ "date_end", {"label":"Completed On","type":"date","validation":"none"}] + ]; +}); + + +EmployeeSubEducationAdapter.method('forceInjectValuesBeforeSave', function(params) { + params['employee'] = this.parent.currentId; + return params; +}); + +EmployeeSubEducationAdapter.method('getSubHeaderTitle', function() { + var addBtn = ''; + return addBtn + "Education"; +}); + +EmployeeSubEducationAdapter.method('getSubItemHtml', function(item, itemDelete, itemEdit) { + var start = ""; + try{ + stat = Date.parse(item[4]).toString('MMM d, yyyy'); + }catch(e){} + + var end = ""; + try{ + end = Date.parse(item[5]).toString('MMM d, yyyy'); + }catch(e){} + //var itemHtml = $('
'+item[2]+itemDelete+itemEdit+'

'+nl2br(item[3])+'

'); + var itemHtml = $('
'+item[2]+itemDelete+itemEdit+'

Start: '+start+'

'+' Completed: '+end+'

'+' Institute: '+item[3]+'

'); + return itemHtml; +}); + + +/** + * @class EmployeeSubCertificationAdapter + * @param endPoint + * @param tab + * @param filter + * @param orderBy + * @returns + */ + +function EmployeeSubCertificationAdapter(endPoint,tab,filter,orderBy) { + this.initAdapter(endPoint,tab,filter,orderBy); +} + +EmployeeSubCertificationAdapter.inherits(SubAdapterBase); + + + +EmployeeSubCertificationAdapter.method('getDataMapping', function() { + return [ + "id", + "employee", + "certification_id", + "institute", + "date_start", + "date_end" + ]; +}); + + +EmployeeSubCertificationAdapter.method('getHeaders', function() { + return [ + { "sTitle": "ID","bVisible":false}, + { "sTitle": "Employee" }, + { "sTitle": "Certification" }, + { "sTitle": "Institute"}, + { "sTitle": "Granted On"}, + { "sTitle": "Valid Thru"} + ]; +}); + +EmployeeSubCertificationAdapter.method('getFormFields', function() { + return [ + [ "id", {"label":"ID","type":"hidden"}], + [ "employee", {"label":"Employee","type":"hidden"}], + [ "certification_id", {"label":"Certification","type":"select2","allow-null":false,"remote-source":["Certification","id","name"]}], + [ "institute", {"label":"Institute","type":"text","validation":""}], + [ "date_start", {"label":"Granted On","type":"date","validation":"none"}], + [ "date_end", {"label":"Valid Thru","type":"date","validation":"none"}] + ]; +}); + + +EmployeeSubCertificationAdapter.method('forceInjectValuesBeforeSave', function(params) { + params['employee'] = this.parent.currentId; + return params; +}); + +EmployeeSubCertificationAdapter.method('getSubHeaderTitle', function() { + var addBtn = ''; + return addBtn + "Certifications"; +}); + +EmployeeSubCertificationAdapter.method('getSubItemHtml', function(item, itemDelete, itemEdit) { + var start = ""; + try{ + start = Date.parse(item[4]).toString('MMM d, yyyy'); + }catch(e){} + + var end = ""; + try{ + end = Date.parse(item[5]).toString('MMM d, yyyy'); + }catch(e){} + var itemHtml = $('
'+item[2]+itemDelete+itemEdit+'

Granted On: '+start+'

'+' Valid Thru: '+end+'

'+' Institute: '+item[3]+'

'); + return itemHtml; +}); + + + + +/** + * @class EmployeeSubLanguageAdapter + * @param endPoint + * @param tab + * @param filter + * @param orderBy + * @returns + */ + +function EmployeeSubLanguageAdapter(endPoint,tab,filter,orderBy) { + this.initAdapter(endPoint,tab,filter,orderBy); +} + +EmployeeSubLanguageAdapter.inherits(SubAdapterBase); + + + +EmployeeSubLanguageAdapter.method('getDataMapping', function() { + return [ + "id", + "employee", + "language_id", + "reading", + "speaking", + "writing", + "understanding" + ]; +}); + +EmployeeSubLanguageAdapter.method('getHeaders', function() { + return [ + { "sTitle": "ID", "bVisible":false }, + { "sTitle": "Employee" }, + { "sTitle": "Language" }, + { "sTitle": "Reading"}, + { "sTitle": "Speaking"}, + { "sTitle": "Writing"}, + { "sTitle": "Understanding"} + ]; +}); + +EmployeeSubLanguageAdapter.method('getFormFields', function() { + var compArray = [["Elementary Proficiency","Elementary Proficiency"], + ["Limited Working Proficiency","Limited Working Proficiency"], + ["Professional Working Proficiency","Professional Working Proficiency"], + ["Full Professional Proficiency","Full Professional Proficiency"], + ["Native or Bilingual Proficiency","Native or Bilingual Proficiency"]]; + + return [ + [ "id", {"label":"ID","type":"hidden"}], + [ "employee", {"label":"Employee","type":"hidden"}], + [ "language_id", {"label":"Language","type":"select2","allow-null":false,"remote-source":["Language","id","name"]}], + [ "reading", {"label":"Reading","type":"select","source":compArray}], + [ "speaking", {"label":"Speaking","type":"select","source":compArray}], + [ "writing", {"label":"Writing","type":"select","source":compArray}], + [ "understanding", {"label":"Understanding","type":"select","source":compArray}] + ]; +}); + + +EmployeeSubLanguageAdapter.method('forceInjectValuesBeforeSave', function(params) { + params['employee'] = this.parent.currentId; + return params; +}); + +EmployeeSubLanguageAdapter.method('getSubHeaderTitle', function() { + var addBtn = ''; + return addBtn + "Languages"; +}); + +EmployeeSubLanguageAdapter.method('getSubItemHtml', function(item, itemDelete, itemEdit) { + var itemHtml = $('
'+item[2]+itemDelete+itemEdit+'

Reading: '+item[3]+'

'+' Speaking: '+ item[4] +'

'+' Writing: '+item[5]+'

'+' Understanding: '+item[6]+'

'); + return itemHtml; +}); + +EmployeeSubLanguageAdapter.method('isSubProfileTable', function() { + if(this.user.user_level == "Admin"){ + return false; + }else{ + return true; + } +}); + + +/** + * @class EmployeeSubDocumentAdapter + * @param endPoint + * @param tab + * @param filter + * @param orderBy + * @returns + */ + +function EmployeeSubDocumentAdapter(endPoint,tab,filter,orderBy) { + this.initAdapter(endPoint,tab,filter,orderBy); +} + +EmployeeSubDocumentAdapter.inherits(SubAdapterBase); + + + +EmployeeSubDocumentAdapter.method('getDataMapping', function() { + return [ + "id", + "employee", + "document", + "details", + "date_added", + "valid_until", + "status", + "attachment" + ]; +}); + +EmployeeSubDocumentAdapter.method('getHeaders', function() { + return [ + { "sTitle": "ID" ,"bVisible":false}, + { "sTitle": "Employee" }, + { "sTitle": "Document" }, + { "sTitle": "Details" }, + { "sTitle": "Date Added"}, + { "sTitle": "Status"}, + { "sTitle": "Attachment","bVisible":false} + ]; +}); + +EmployeeSubDocumentAdapter.method('getFormFields', function() { + + return [ + [ "id", {"label":"ID","type":"hidden"}], + [ "employee", {"label":"Employee","type":"hidden"}], + [ "document", {"label":"Document","type":"select2","remote-source":["Document","id","name"]}], + [ "date_added", {"label":"Date Added","type":"date","validation":""}], + [ "valid_until", {"label":"Valid Until","type":"date","validation":"none"}], + [ "status", {"label":"Status","type":"select","source":[["Active","Active"],["Inactive","Inactive"],["Draft","Draft"]]}], + [ "details", {"label":"Details","type":"textarea","validation":"none"}], + [ "attachment", {"label":"Attachment","type":"fileupload","validation":"none"}] + ]; +}); + + +EmployeeSubDocumentAdapter.method('forceInjectValuesBeforeSave', function(params) { + params['employee'] = this.parent.currentId; + return params; +}); + +EmployeeSubDocumentAdapter.method('getSubHeaderTitle', function() { + var addBtn = ''; + return addBtn + "Documents"; +}); + +EmployeeSubDocumentAdapter.method('getSubItemHtml', function(item, itemDelete, itemEdit) { + var expire = ""; + try{ + expire = Date.parse(item[5]).toString('MMM d, yyyy'); + }catch(e){} + var itemHtml = $('
'+item[2]+itemDelete+itemEdit+'

'+nl2br(item[3])+'

'+' Expire On: '+expire+'

'); + return itemHtml; +}); + +EmployeeSubDocumentAdapter.method('isSubProfileTable', function() { + if(this.user.user_level == "Admin"){ + return false; + }else{ + return true; + } +}); + + + +/** + * EmployeeDocumentAdapter + */ + + + +function EmployeeDocumentAdapter(endPoint) { + this.initAdapter(endPoint); +} + +EmployeeDocumentAdapter.inherits(AdapterBase); + + + +EmployeeDocumentAdapter.method('getDataMapping', function() { + return [ + "id", + "employee", + "document", + "details", + "date_added", + "status", + "attachment" + ]; +}); + +EmployeeDocumentAdapter.method('getHeaders', function() { + return [ + { "sTitle": "ID" ,"bVisible":false}, + { "sTitle": "Employee" }, + { "sTitle": "Document" }, + { "sTitle": "Details" }, + { "sTitle": "Date Added"}, + { "sTitle": "Status"}, + { "sTitle": "Attachment","bVisible":false} + ]; +}); + +EmployeeDocumentAdapter.method('getFormFields', function() { + return [ + [ "id", {"label":"ID","type":"hidden"}], + ["employee", { + "label": "Employee", + "type": "select2", + "sort": "none", + "allow-null": false, + "remote-source": ["Employee", "id", "first_name+last_name", "getActiveSubordinateEmployees"] + }], + [ "document", {"label":"Document","type":"select2","remote-source":["Document","id","name"]}], + [ "date_added", {"label":"Date Added","type":"date","validation":""}], + [ "valid_until", {"label":"Valid Until","type":"date","validation":"none"}], + [ "status", {"label":"Status","type":"select","source":[["Active","Active"],["Inactive","Inactive"],["Draft","Draft"]]}], + [ "details", {"label":"Details","type":"textarea","validation":"none"}], + [ "attachment", {"label":"Attachment","type":"fileupload","validation":"none"}] + ]; +}); + + +EmployeeDocumentAdapter.method('getFilters', function() { + return [ + [ "employee", {"label":"Employee","type":"select2","remote-source":["Employee","id","first_name+last_name"]}] + + ]; +}); + + +EmployeeDocumentAdapter.method('getActionButtonsHtml', function(id,data) { + var html = '
'; + html = html.replace(/_id_/g,id); + html = html.replace(/_attachment_/g,data[6]); + html = html.replace(/_BASE_/g,this.baseUrl); + return html; +}); + +EmployeeDocumentAdapter.method('isSubProfileTable', function() { + if(this.user.user_level == "Admin"){ + return false; + }else{ + return true; + } +}); + diff --git a/ext/admin/fieldnames/api/FieldnamesAdminManager.php b/ext/admin/fieldnames/api/FieldnamesAdminManager.php new file mode 100644 index 00000000..26273e7c --- /dev/null +++ b/ext/admin/fieldnames/api/FieldnamesAdminManager.php @@ -0,0 +1,57 @@ +addModelClass('FieldNameMapping'); + $this->addModelClass('CustomField'); + } + } +} + +if (!class_exists('FieldNameMapping')) { + class FieldNameMapping extends ICEHRM_Record { + var $_table = 'FieldNameMappings'; + + public function getAdminAccess(){ + return array("get","element","save","delete"); + } + + public function getUserAccess(){ + return array(); + } + + public function getAnonymousAccess(){ + return array("get","element"); + } + } +} + +if (!class_exists('CustomField')) { + class CustomField extends ICEHRM_Record { + var $_table = 'CustomFields'; + + public function getAdminAccess(){ + return array("get","element","save","delete"); + } + + public function getUserAccess(){ + return array(); + } + + public function getAnonymousAccess(){ + return array("get","element"); + } + } +} \ No newline at end of file diff --git a/ext/admin/fieldnames/index.php b/ext/admin/fieldnames/index.php new file mode 100644 index 00000000..ecd856e5 --- /dev/null +++ b/ext/admin/fieldnames/index.php @@ -0,0 +1,62 @@ +
+ + + +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
+ + \ No newline at end of file diff --git a/ext/admin/fieldnames/lib.js b/ext/admin/fieldnames/lib.js new file mode 100644 index 00000000..1549897e --- /dev/null +++ b/ext/admin/fieldnames/lib.js @@ -0,0 +1,86 @@ +/** + * Author: Thilina Hasantha + */ + + +/** + * FieldNameAdapter + */ + +function FieldNameAdapter(endPoint,tab,filter,orderBy) { + this.initAdapter(endPoint,tab,filter,orderBy); +} + +FieldNameAdapter.inherits(AdapterBase); + + + +FieldNameAdapter.method('getDataMapping', function() { + return [ + "id", + "name", + "textOrig", + "textMapped", + "display" + ]; +}); + +FieldNameAdapter.method('getHeaders', function() { + return [ + { "sTitle": "ID" ,"bVisible":false}, + { "sTitle": "Name" }, + { "sTitle": "Original Text"}, + { "sTitle": "Mapped Text"}, + { "sTitle": "Display Status"} + ]; +}); + +FieldNameAdapter.method('getFormFields', function() { + return [ + [ "id", {"label":"ID","type":"hidden"}], + [ "type", {"label":"Type","type":"placeholder","validation":""}], + [ "name", {"label":"Name","type":"placeholder","validation":""}], + [ "textOrig", {"label":"Original Text","type":"placeholder","validation":""}], + [ "textMapped", {"label":"Mapped Text","type":"text","validation":""}], + [ "display", {"label":"Display Status","type":"select","source":[["Form","Form"],["Table and Form","Table and Form"],["Hidden","Hidden"]]}] + ]; +}); + +/* + * + */ + +function CustomFieldAdapter(endPoint,tab,filter,orderBy) { + this.initAdapter(endPoint,tab,filter,orderBy); +} + +CustomFieldAdapter.inherits(AdapterBase); + + + +CustomFieldAdapter.method('getDataMapping', function() { + return [ + "id", + "name", + "display" + ]; +}); + +CustomFieldAdapter.method('getHeaders', function() { + return [ + { "sTitle": "ID" ,"bVisible":false}, + { "sTitle": "Name" }, + { "sTitle": "Display Status"} + ]; +}); + +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"]]}] + ]; +}); + diff --git a/ext/admin/fieldnames/meta.json b/ext/admin/fieldnames/meta.json new file mode 100644 index 00000000..a5aa1d0b --- /dev/null +++ b/ext/admin/fieldnames/meta.json @@ -0,0 +1,11 @@ +{ +"label":"Field Names Setup", +"menu":"System", +"order":"7", +"icon":"fa-sort-alpha-asc", +"user_levels":["Admin"], + +"permissions": + { + } +} \ No newline at end of file diff --git a/ext/admin/meta.json b/ext/admin/meta.json index 97a79006..193fc20e 100644 --- a/ext/admin/meta.json +++ b/ext/admin/meta.json @@ -3,5 +3,5 @@ "Employees":"fa-users", "Reports":"fa-file-text", "System":"fa-cogs", -"Salary Details":"fa-money" +"Payroll":"fa-money" } diff --git a/ext/admin/metadata/api/MetadataAdminManager.php b/ext/admin/metadata/api/MetadataAdminManager.php index de42a1b5..a0d6f400 100644 --- a/ext/admin/metadata/api/MetadataAdminManager.php +++ b/ext/admin/metadata/api/MetadataAdminManager.php @@ -22,6 +22,7 @@ if (!class_exists('MetadataAdminManager')) { $this->addModelClass('Nationality'); $this->addModelClass('ImmigrationStatus'); $this->addModelClass('Ethnicity'); + $this->addModelClass('CalculationHook'); } } @@ -42,6 +43,20 @@ if (!class_exists('Country')) { public function getAnonymousAccess(){ return array("get","element"); } + + function Find($whereOrderBy,$bindarr=false,$pkeysArr=false,$extra=array()){ + $allowedCountriesStr = SettingsManager::getInstance()->getSetting('System: Allowed Countries'); + $allowedCountries = array(); + if(!empty($allowedCountriesStr)){ + $allowedCountries = json_decode($allowedCountriesStr,true); + } + + if(!empty($allowedCountries)){ + return parent::Find("id in (".implode(",",$allowedCountries).")" , array()); + } + + return parent::Find($whereOrderBy, $bindarr, $pkeysArr, $extra); + } } } @@ -79,6 +94,20 @@ if (!class_exists('CurrencyType')) { public function getAnonymousAccess(){ return array("get","element"); } + + function Find($whereOrderBy,$bindarr=false,$pkeysArr=false,$extra=array()){ + $allowedCountriesStr = SettingsManager::getInstance()->getSetting('System: Allowed Currencies'); + $allowedCountries = array(); + if(!empty($allowedCountriesStr)){ + $allowedCountries = json_decode($allowedCountriesStr,true); + } + + if(!empty($allowedCountries)){ + return parent::Find("id in (".implode(",",$allowedCountries).")" , array()); + } + + return parent::Find($whereOrderBy, $bindarr, $pkeysArr, $extra); + } } } @@ -98,6 +127,22 @@ if (!class_exists('Nationality')) { public function getAnonymousAccess(){ return array("get","element"); } + + function Find($whereOrderBy,$bindarr=false,$pkeysArr=false,$extra=array()){ + $allowedCountriesStr = SettingsManager::getInstance()->getSetting('System: Allowed Nationality'); + $allowedCountries = array(); + if(!empty($allowedCountriesStr)){ + $allowedCountries = json_decode($allowedCountriesStr,true); + } + + if(!empty($allowedCountries)){ + return parent::Find("id in (".implode(",",$allowedCountries).")" , array()); + } + + return parent::Find($whereOrderBy, $bindarr, $pkeysArr, $extra); + } + + } } @@ -139,6 +184,32 @@ if (!class_exists('Ethnicity')) { } } +if (!class_exists('CalculationHook')) { + class CalculationHook extends ICEHRM_Record { + var $_table = 'CalculationHooks'; + + public function getAdminAccess(){ + return array("get","element","save","delete"); + } + + public function getUserAccess(){ + return array(); + } + + public function getAnonymousAccess(){ + return array("get","element"); + } + + function Find($whereOrderBy,$bindarr=false,$pkeysArr=false,$extra=array()){ + return BaseService::getInstance()->getCalculationHooks(); + } + + function Load($where=null,$bindarr=false){ + return BaseService::getInstance()->getCalculationHook($bindarr[0]); + } + } +} + diff --git a/ext/admin/metadata/index.php b/ext/admin/metadata/index.php index 8001d10c..160619ff 100644 --- a/ext/admin/metadata/index.php +++ b/ext/admin/metadata/index.php @@ -32,7 +32,6 @@ $moduleBuilder->addModuleOrGroup(new ModuleTab('Country','Country','Countries',' $moduleBuilder->addModuleOrGroup(new ModuleTab('Province','Province','Provinces','ProvinceAdapter','','')); $moduleBuilder->addModuleOrGroup(new ModuleTab('CurrencyType','CurrencyType','Currency Types','CurrencyTypeAdapter','','')); $moduleBuilder->addModuleOrGroup(new ModuleTab('Nationality','Nationality','Nationality','NationalityAdapter','','')); -$moduleBuilder->addModuleOrGroup(new ModuleTab('Nationality','Nationality','Nationality','NationalityAdapter','','')); $moduleBuilder->addModuleOrGroup(new ModuleTab('Ethnicity','Ethnicity','Ethnicity','EthnicityAdapter','','')); $moduleBuilder->addModuleOrGroup(new ModuleTab('ImmigrationStatus','ImmigrationStatus','Immigration Status','ImmigrationStatusAdapter','','')); diff --git a/ext/admin/modules/index.php b/ext/admin/modules/index.php index 51aa4602..9c50258c 100644 --- a/ext/admin/modules/index.php +++ b/ext/admin/modules/index.php @@ -46,9 +46,9 @@ include APP_BASE_PATH.'modulejslibs.inc.php'; \ No newline at end of file diff --git a/ext/admin/modules/lib.js b/ext/admin/modules/lib.js index a94db521..89bdf5d5 100644 --- a/ext/admin/modules/lib.js +++ b/ext/admin/modules/lib.js @@ -58,7 +58,7 @@ ModuleAdapter.method('getActionButtonsHtml', function(id,data) { var nonEditableFields = {}; nonEditableFields["admin_Company Structure"] = 1; nonEditableFields["admin_Employees"] = 1; - nonEditableFields["admin_Jobs"] = 1; + nonEditableFields["admin_Job Details Setup"] = 1; nonEditableFields["admin_Leaves"] = 1; nonEditableFields["admin_Manage Modules"] = 1; nonEditableFields["admin_Projects"] = 1; @@ -66,10 +66,11 @@ ModuleAdapter.method('getActionButtonsHtml', function(id,data) { nonEditableFields["admin_Settings"] = 1; nonEditableFields["admin_Users"] = 1; nonEditableFields["admin_Upgrade"] = 1; - nonEditableFields["admin_Upgrade"] = 1; + nonEditableFields["admin_Dashboard"] = 1; nonEditableFields["user_Basic Information"] = 1; - + nonEditableFields["user_Dashboard"] = 1; + if(nonEditableFields[data[3]+"_"+data[1]] == 1){ return ""; } diff --git a/ext/admin/payroll/meta.json b/ext/admin/payroll/meta.json deleted file mode 100644 index e3babd0f..00000000 --- a/ext/admin/payroll/meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ -"label":"Setup", -"menu":"Salary Details", -"order":"6", -"icon":"fa-cogs", -"user_levels":["Admin"], - -"permissions": - { - } -} \ No newline at end of file diff --git a/ext/admin/reports/reportClasses/EmployeeLeavesReport.php b/ext/admin/reports/reportClasses/EmployeeLeavesReport.php index f9eb185e..c8f5e9e8 100644 --- a/ext/admin/reports/reportClasses/EmployeeLeavesReport.php +++ b/ext/admin/reports/reportClasses/EmployeeLeavesReport.php @@ -32,33 +32,49 @@ from EmployeeLeaves lv"; if(in_array("NULL", $employeeList) ){ $employeeList = array(); } + + if($request['department'] != "NULL" && empty($employeeList)){ + $empTmp = new Employee(); + $empTemps = $empTmp->Find("department = ? and status = Active",array($request['department'])); + foreach($empTemps as $empTmp){ + $employeeList[] = $empTmp->id; + } + } if(!empty($employeeList) && ($request['status'] != "NULL" && !empty($request['status']))){ - $query = "where employee in (".implode(",", $employeeList).") and date_start >= ? and date_end <= ? and status = ?;"; + $query = "where employee in (".implode(",", $employeeList).") and ((date_start >= ? and date_start <= ?) or (date_end >= ? and date_end <= ?)) and status = ?;"; $params = array( $request['date_start'], - $request['date_end'], + $request['date_end'], + $request['date_start'], + $request['date_end'], $request['status'] ); }else if(!empty($employeeList)){ - $query = "where employee in (".implode(",", $employeeList).") and date_start >= ? and date_end <= ?;"; + $query = "where employee in (".implode(",", $employeeList).") and ((date_start >= ? and date_start <= ?) or (date_end >= ? and date_end <= ?));"; $params = array( + $request['date_start'], + $request['date_end'], $request['date_start'], $request['date_end'] ); }else if(($request['status'] != "NULL" && !empty($request['status']))){ - $query = "where status = ? and date_start >= ? and date_end <= ?;"; + $query = "where status = ? and ((date_start >= ? and date_start <= ?) or (date_end >= ? and date_end <= ?));"; $params = array( $request['status'], $request['date_start'], - $request['date_end'] + $request['date_end'], + $request['date_start'], + $request['date_end'] ); }else{ - $query = "where date_start >= ? and date_end <= ?;"; + $query = "where ((date_start >= ? and date_start <= ?) or (date_end >= ? and date_end <= ?));"; $params = array( $request['date_start'], - $request['date_end'] + $request['date_end'], + $request['date_start'], + $request['date_end'] ); } diff --git a/ext/admin/salary/LICENSE.txt b/ext/admin/salary/LICENSE.txt new file mode 100644 index 00000000..5fb38ea8 --- /dev/null +++ b/ext/admin/salary/LICENSE.txt @@ -0,0 +1,44 @@ +ICEHRM END USER LICENSE AGREEMENT +NOTICE TO ALL USERS: BY PURCHASING THE MODULE, YOU (EITHER AN INDIVIDUAL OR A SINGLE ENTITY) CONSENT TO BE BOUND BY AND BECOME A PARTY TO THIS AGREEMENT. + +All references to "Software" herein shall be deemed to include the software license with which you will be provided by Gamonoid Media Pvt Ltd, as part of the Software. + +1. LICENSE GRANT. Subject to the payment of the applicable licence fees, and subject to the terms and conditions of this Agreement, ICEHRM hereby grants to you a non-exclusive, non-transferable right to use one copy of the specified version of the Software and the accompanying documentation (the "Documentation") for the term of this Agreement solely for your own internal business purposes. You may install one copy of the Software for production use. +. +2. USE. The Software is licensed as a single product; it may not be used on more than one ICEHRM Server at a time. The Software is "in use" on a Server when its installed on a Server. You shall not, nor permit any third party to copy (other than as expressly permitted herein). You shall not rent, lease or lend the Software to any other person, nor transfer or sub-licence your licence rights to any other person. + +3. TERM. This Agreement is effective until terminated as set forth herein. This Agreement will terminate automatically if you fail to comply with any of the conditions, limitations or other requirements described herein. Upon any termination of this Agreement, you must immediately destroy all copies of the Software and the Documentation. You may terminate this Agreement at any point by destroying all copies of the Software and the Documentation. + +4. SUPPORT. Gamonoid Media Pvt Ltd will provide you support according to the support agreement subscribed by the company. + +5. OWNERSHIP RIGHTS. The Software is protected by copyright laws. ICEHRM and Gamonoid Media Pvt Ltd own and retain all right, title and interest in and to the Software, including all copyrights, patents, trademarks and other intellectual property rights therein. Your possession, installation, or use of the Software does not transfer to you any title to the intellectual property in the Software, and you will not acquire any rights to the Software except as expressly set forth in this Agreement. + +6. LIMITED WARRANTY. You may not rent, lease, loan or resell the Software. You may not permit third parties to benefit from the use or functionality of the Software via a timesharing, service bureau or other arrangement, except to the extent such use is specified in the applicable list price or product packaging for the Software. You may not transfer any of the rights granted to you under this Agreement. You may not modify, or create derivative works based upon, the Software in whole or in part. You may not copy the Software or Documentation except as expressly permitted in Section 1 above. You may not remove any proprietary notices or labels on the Software. All rights not expressly set forth hereunder are reserved by ICEHRM. ICEHRM reserves the right to periodically conduct audits upon advance written notice to verify compliance with the terms of this Agreement. + +7. WARRANTY and DISCLAIMER. + +(i) Gamonoid Media Pvt Ltd. warrants that for 30 days from first download or installation the Software will perform substantially in accordance with the functionality described in the Documentation (http://blog.icehrm.com) when operated properly and in the manner specified in the Documentation. + +(ii) You accept all responsibility for the selection of this Software to meet your requirements. + +(iii) Gamonoid Media Pvt Ltd. does not warrant that the Software and/or the Documentation will be suitable for such requirements nor that any use will be uninterrupted and error free. + +(iv) The warranty in (i) shall not apply if you (a) make or cause to be made any modifications to this Software, (b) use the Software in a manner for which it was not intended or (c) use the Software other than as permitted under this Agreement. + +(vii) The warranties and conditions stated in this Agreement are in lieu of all other conditions, warranties or other terms concerning the supply or purported supply of, failure to supply or delay in supplying the Software or the Documentation which might but for this paragraph (vii) have effect between the ICEHRM and you or would otherwise be implied into or incorporated into this Agreement or any collateral contract, whether by statute, common law or otherwise, all of which are hereby excluded (including, without limitation, the implied conditions, warranties or other terms as to satisfactory quality, fitness for purpose or as to the use of reasonable skill and care). + +8. LIMITATION of LIABILITY. Gamonoid Media Pvt Ltd. shall have no liability (whether in contract, tort, restitution or otherwise) for any of the following losses or damage (whether such losses or damage were foreseen, foreseeable, known or otherwise): +- Loss of revenue; +- Loss of actual or anticipated profits (including for loss of profits on contracts); +- Loss of the use of money; +- Loss of anticipated savings; +- Loss of business; +- Loss of opportunity; +- Loss of goodwill; +- Loss of reputation; +- Loss of, damage to or corruption of data; +or +Any indirect or consequential loss or damage howsoever caused (including, for the avoidance of doubt, where such loss or damage is of the type specified in paragraph (ii), (a) to (ii), (i). +The ICEHRM liability (whether in contract, tort, restitution or otherwise) arising out of or in connection with the supply of the Software shall in no circumstances exceed a sum equal to the amount equally paid by you for the Software. +The construction and interpretation of this Agreement shall be governed in accordance with the laws of Sri Lanka. The parties hereby submit to the jurisdiction of the courts of Sri Lanka save that ICEHRM as claimant shall be entitled to initiate proceedings in any court of competent jurisdiction. +This Agreement contains the entire understanding of the parties with respect to the subject matter hereof and supersedes all and any prior understandings, undertakings and promises between you and ICEHRM, whether oral or in writing, which have been given or may be implied from anything written or said in negotiations between us or our representatives prior to this Agreement and all prior agreements between the parties relating to the matters aforesaid shall cease to have effect as from the Effective Date. \ No newline at end of file diff --git a/ext/admin/salary/README.txt b/ext/admin/salary/README.txt new file mode 100644 index 00000000..0bd0cec8 --- /dev/null +++ b/ext/admin/salary/README.txt @@ -0,0 +1,7 @@ +This module is licensed under IceHrm Commercial License, which can be found in LICENSE.txt. +You are allowed to make any modification required to these module, but only allowed to use +the module in one production server (even with modifications). + +Installation +------------ +Copy this module into /admin/ directory \ No newline at end of file diff --git a/ext/admin/payroll/api/PayrollAdminManager.php b/ext/admin/salary/api/SalaryAdminManager.php similarity index 64% rename from ext/admin/payroll/api/PayrollAdminManager.php rename to ext/admin/salary/api/SalaryAdminManager.php index 17e6b951..2afc90f7 100644 --- a/ext/admin/payroll/api/PayrollAdminManager.php +++ b/ext/admin/salary/api/SalaryAdminManager.php @@ -1,6 +1,6 @@ addModelClass('SalaryComponentType'); $this->addModelClass('SalaryComponent'); $this->addModelClass('Deduction'); - } } @@ -66,4 +65,31 @@ if (!class_exists('Deduction')) { } } +if (!class_exists('DeductionGroup')) { + class DeductionGroup extends ICEHRM_Record { + var $_table = 'DeductionGroup'; + + public function getAdminAccess(){ + return array("get","element","save","delete"); + } + + public function getUserAccess(){ + return array("get","element"); + } + } +} + +if (!class_exists('PayrollEmployee')) { + class PayrollEmployee extends ICEHRM_Record { + var $_table = 'PayrollEmployees'; + + public function getAdminAccess(){ + return array("get","element","save","delete"); + } + + public function getUserAccess(){ + return array("get","element"); + } + } +} diff --git a/ext/admin/payroll/index.php b/ext/admin/salary/index.php similarity index 56% rename from ext/admin/payroll/index.php rename to ext/admin/salary/index.php index f342a7af..576d126b 100644 --- a/ext/admin/payroll/index.php +++ b/ext/admin/salary/index.php @@ -1,15 +1,18 @@ addModuleOrGroup(new ModuleTab('SalaryComponentType','SalaryComponentType','Salary Component Types','SalaryComponentTypeAdapter','','',true)); $moduleBuilder->addModuleOrGroup(new ModuleTab('SalaryComponent','SalaryComponent','Salary Components','SalaryComponentAdapter','','')); -$moduleBuilder->addModuleOrGroup(new ModuleTab('EmployeeSalary','EmployeeSalary','Employee Salary','EmployeeSalaryAdapter','','',false,array("setRemoteTable"=>"true"))); +$moduleBuilder->addModuleOrGroup(new ModuleTab('DeductionGroup','DeductionGroup','Calculation Groups','DeductionGroupAdapter','','')); +$moduleBuilder->addModuleOrGroup(new ModuleTab('Deduction','Deduction','Calculation Methods','DeductionAdapter','','')); + +$moduleBuilder->addModuleOrGroup(new ModuleTab('EmployeeSalary','EmployeeSalary','Employee Salary Components','EmployeeSalaryAdapter','','',false,array("setRemoteTable"=>"true"))); echo UIManager::getInstance()->renderModule($moduleBuilder); diff --git a/ext/admin/payroll/lib.js b/ext/admin/salary/lib.js similarity index 62% rename from ext/admin/payroll/lib.js rename to ext/admin/salary/lib.js index 97a5eb85..84ef3adc 100644 --- a/ext/admin/payroll/lib.js +++ b/ext/admin/salary/lib.js @@ -2,7 +2,6 @@ * Author: Thilina Hasantha */ - /** * SalaryComponentTypeAdapter */ @@ -16,27 +15,27 @@ SalaryComponentTypeAdapter.inherits(AdapterBase); SalaryComponentTypeAdapter.method('getDataMapping', function() { - return [ - "id", - "code", - "name" - ]; + return [ + "id", + "code", + "name" + ]; }); SalaryComponentTypeAdapter.method('getHeaders', function() { - return [ - { "sTitle": "ID" ,"bVisible":false}, - { "sTitle": "Code" }, - { "sTitle": "Name"} - ]; + return [ + { "sTitle": "ID" ,"bVisible":false}, + { "sTitle": "Code" }, + { "sTitle": "Name"} + ]; }); SalaryComponentTypeAdapter.method('getFormFields', function() { - return [ - [ "id", {"label":"ID","type":"hidden"}], - [ "code", {"label":"Code","type":"text","validation":""}], - [ "name", {"label":"Name","type":"text","validation":""}] - ]; + return [ + [ "id", {"label":"ID","type":"hidden"}], + [ "code", {"label":"Code","type":"text","validation":""}], + [ "name", {"label":"Name","type":"text","validation":""}] + ]; }); @@ -53,30 +52,30 @@ SalaryComponentAdapter.inherits(AdapterBase); SalaryComponentAdapter.method('getDataMapping', function() { - return [ - "id", - "name", - "componentType", - "details" - ]; + return [ + "id", + "name", + "componentType", + "details" + ]; }); SalaryComponentAdapter.method('getHeaders', function() { - return [ - { "sTitle": "ID" ,"bVisible":false}, - { "sTitle": "Name" }, - { "sTitle": "Salary Component Type" }, - { "sTitle": "Details"} - ]; + return [ + { "sTitle": "ID" ,"bVisible":false}, + { "sTitle": "Name" }, + { "sTitle": "Salary Component Type" }, + { "sTitle": "Details"} + ]; }); SalaryComponentAdapter.method('getFormFields', function() { - return [ - [ "id", {"label":"ID","type":"hidden"}], - [ "name", {"label":"Name","type":"text","validation":""}], - [ "componentType", {"label":"Salary Component Type","type":"select2","remote-source":["SalaryComponentType","id","name"]}], - [ "details", {"label":"Details","type":"textarea","validation":"none"}] - ]; + return [ + [ "id", {"label":"ID","type":"hidden"}], + [ "name", {"label":"Name","type":"text","validation":""}], + [ "componentType", {"label":"Salary Component Type","type":"select2","remote-source":["SalaryComponentType","id","name"]}], + [ "details", {"label":"Details","type":"textarea","validation":"none"}] + ]; }); @@ -96,8 +95,7 @@ DeductionAdapter.method('getDataMapping', function() { return [ "id", "name", - "contributor", - "type", + "deduction_group" ]; }); @@ -105,32 +103,52 @@ DeductionAdapter.method('getHeaders', function() { return [ { "sTitle": "ID" ,"bVisible":false}, { "sTitle": "Name" }, - { "sTitle": "Contributor"}, - { "sTitle": "Deduction Type"} + { "sTitle": "Calculation Group"} ]; }); DeductionAdapter.method('getFormFields', function() { - var rangeAmounts = [ "rangeAmounts", {"label":"Deduction Amounts","type":"datagroup", + var rangeAmounts = [ "rangeAmounts", {"label":"Calculation Process","type":"datagroup", "form":[ - [ "lowerCondition", {"label":"Lower Limit Condition","type":"select","source":[["No Lower Limit","No Lower Limit"],[">","Greater than"],[">=","Greater than or Equal"]]}], - [ "lowerLimit", {"label":"Lower Limit","type":"text","validation":"none"}], - [ "upperCondition", {"label":"Upper Limit Condition","type":"select","source":[["No Upper Limit","No Upper Limit"],["<","Less than"],["<=","Less than or Equal"]]}], - [ "upperLimit", {"label":"Upper Limit","type":"text","validation":"none"}], - [ "amount", {"label":"Value","type":"text","validation":"float"}] + [ "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":'
#_delete_##_edit_#
#_renderFunction_#
', "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 + " " + item.lowerCondition + " "; - output += " and "; + output += item.lowerLimit + " " + getSymbol(item.lowerCondition) + " "; } if(item.upperCondition != "No Upper Limit"){ - output += item.upperCondition + " " + item.upperLimit + " "; + output += " and "; + output += getSymbol(item.upperCondition) + " " + item.upperLimit + " "; } if(output == ""){ return "Deduction is "+item.amount + " for all ranges"; @@ -148,17 +166,16 @@ DeductionAdapter.method('getFormFields', function() { return [ [ "id", {"label":"ID","type":"hidden"}], [ "name", {"label":"Name","type":"text","validation":""}], - [ "contributor", {"label":"Contributor","type":"select","source":[["Employee","Employee"],["Employer","Employer"]]}], - [ "type", {"label":"Deduction Type","type":"select","source":[["Fixed","Fixed"],["Percentage","Percentage"]]}], - [ "percentage_type", {"label":"Percentage Type","type":"select","source":[["On Component","On Component"],["On Component Type","On Component Type"]]}], - [ "componentType", {"label":"Salary Component Type","type":"select2","allow-null":true,"null-label":"N/A","remote-source":["SalaryComponentType","id","name"]}], - [ "component", {"label":"Salary Component","type":"select2","allow-null":true,"null-label":"N/A","remote-source":["SalaryComponent","id","name"]}], + [ "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, - [ "country", {"label":"Country","type":"select2","remote-source":["Country","id","name"]}] + [ "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; @@ -177,7 +194,8 @@ DeductionAdapter.method('doCustomValidation', function(params) { return null; }); - +*/ +/* DeductionAdapter.method('postRenderForm', function(object, $tempDomObj) { $tempDomObj.find("#field_componentType").hide(); @@ -213,6 +231,10 @@ DeductionAdapter.method('postRenderForm', function(object, $tempDomObj) { } }); }); +*/ + + + /* @@ -232,8 +254,6 @@ EmployeeSalaryAdapter.method('getDataMapping', function() { "id", "employee", "component", - "pay_frequency", - "currency", "amount", "details" ]; @@ -244,8 +264,6 @@ EmployeeSalaryAdapter.method('getHeaders', function() { { "sTitle": "ID" ,"bVisible":false}, { "sTitle": "Employee" }, { "sTitle": "Salary Component" }, - { "sTitle": "Pay Frequency"}, - { "sTitle": "Currency"}, { "sTitle": "Amount"}, { "sTitle": "Details"} ]; @@ -256,8 +274,6 @@ EmployeeSalaryAdapter.method('getFormFields', function() { [ "id", {"label":"ID","type":"hidden"}], [ "employee", {"label":"Employee","type":"select2","remote-source":["Employee","id","first_name+last_name"]}], [ "component", {"label":"Salary Component","type":"select2","remote-source":["SalaryComponent","id","name"]}], - [ "pay_frequency", {"label":"Pay Frequency","type":"select","source":[["Hourly","Hourly"],["Daily","Daily"],["Bi Weekly","Bi Weekly"],["Weekly","Weekly"],["Semi Monthly","Semi Monthly"],["Monthly","Monthly"]]}], - [ "currency", {"label":"Currency","type":"select2","remote-source":["CurrencyType","id","name"]}], [ "amount", {"label":"Amount","type":"text","validation":"float"}], [ "details", {"label":"Details","type":"textarea","validation":"none"}] ]; @@ -272,3 +288,43 @@ 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"}] + ]; +}); + + + + + diff --git a/ext/admin/salary/meta.json b/ext/admin/salary/meta.json new file mode 100644 index 00000000..f9713caa --- /dev/null +++ b/ext/admin/salary/meta.json @@ -0,0 +1,11 @@ +{ +"label":"Salary", +"menu":"Payroll", +"order":"1", +"icon":"fa-money", +"user_levels":["Admin"], + +"permissions": + { + } +} \ No newline at end of file diff --git a/ext/admin/settings/api/SettingsInitialize.php b/ext/admin/settings/api/SettingsInitialize.php index bffb4e40..1c2e1950 100644 --- a/ext/admin/settings/api/SettingsInitialize.php +++ b/ext/admin/settings/api/SettingsInitialize.php @@ -22,7 +22,7 @@ Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilin */ class SettingsInitialize extends AbstractInitialize{ - + public function init(){ if(SettingsManager::getInstance()->getSetting("Api: REST Api Enabled") == "1"){ $user = BaseService::getInstance()->getCurrentUser(); @@ -30,7 +30,7 @@ class SettingsInitialize extends AbstractInitialize{ $dbUser->Load("id = ?",array($user->id)); $resp = RestApiManager::getInstance()->getAccessTokenForUser($dbUser); if($resp->getStatus() != IceResponse::SUCCESS){ - LogManager::getInstance()->error("Error occured while creating REST Api acces token for ".$user->username); + LogManager::getInstance()->error("Error occurred while creating REST Api access token for ".$user->username); } } diff --git a/ext/admin/settings/index.php b/ext/admin/settings/index.php index b1e42f0a..0342e746 100644 --- a/ext/admin/settings/index.php +++ b/ext/admin/settings/index.php @@ -25,37 +25,26 @@ $moduleName = 'settings'; define('MODULE_PATH',dirname(__FILE__)); include APP_BASE_PATH.'header.php'; include APP_BASE_PATH.'modulejslibs.inc.php'; -?>
- - - -
-
-
- -
- -
-
+$moduleBuilder = new ModuleBuilder(); + +$options1 = array(); +$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)); +echo UIManager::getInstance()->renderModule($moduleBuilder); +?>
\ No newline at end of file diff --git a/ext/admin/settings/lib.js b/ext/admin/settings/lib.js index dc649c24..32d7de77 100644 --- a/ext/admin/settings/lib.js +++ b/ext/admin/settings/lib.js @@ -62,24 +62,46 @@ SettingAdapter.method('edit', function(id) { SettingAdapter.method('fillForm', function(object) { - this.uber('fillForm',object); + + var metaField = this.getMetaFieldForRendering('value'); + var metaVal = object[metaField]; + var formFields = null; + + if(metaVal != "" && metaVal != undefined){ + var formFields = [ + [ "id", {"label":"ID","type":"hidden"}], + JSON.parse(metaVal) + ]; + } + + + this.uber('fillForm',object, null, formFields); $("#helptext").html(object.description); }); SettingAdapter.method('loadRemoteDataForSettings', function () { - var field = ["country", {"label": "Country", "type": "select2", "remote-source": ["Country", "code", "name"]}]; - if (field[1]['remote-source'] != undefined && field[1]['remote-source'] != null) { - var key = field[1]['remote-source'][0] + "_" + field[1]['remote-source'][1] + "_" + field[1]['remote-source'][2]; - this.fieldMasterDataKeys[key] = false; - this.sourceMapping[field[0]] = field[1]['remote-source']; + var fields = []; + var field = null; + 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"]}]); - var callBackData = {}; - callBackData['callBack'] = 'initFieldMasterDataResponse'; - callBackData['callBackData'] = [key]; + for(index in fields){ + field = fields[index]; + if (field[1]['remote-source'] != undefined && field[1]['remote-source'] != null) { + var key = field[1]['remote-source'][0] + "_" + field[1]['remote-source'][1] + "_" + field[1]['remote-source'][2]; + this.fieldMasterDataKeys[key] = false; + this.sourceMapping[field[0]] = field[1]['remote-source']; + + var callBackData = {}; + callBackData['callBack'] = 'initFieldMasterDataResponse'; + callBackData['callBackData'] = [key]; + + this.getFieldValues(field[1]['remote-source'], callBackData); + } + } - this.getFieldValues(field[1]['remote-source'], callBackData); - } }); diff --git a/ext/admin/travel/api/TravelActionManager.php b/ext/admin/travel/api/TravelActionManager.php deleted file mode 100644 index 40d3a10e..00000000 --- a/ext/admin/travel/api/TravelActionManager.php +++ /dev/null @@ -1,19 +0,0 @@ -addUserClass("EmployeeImmigration"); - $this->addUserClass("EmployeeTravelRecord"); - } - } - - public function initializeFieldMappings(){ - $this->addFileFieldMapping('EmployeeImmigration', 'attachment1', 'name'); - $this->addFileFieldMapping('EmployeeImmigration', 'attachment2', 'name'); - $this->addFileFieldMapping('EmployeeImmigration', 'attachment3', 'name'); - - $this->addFileFieldMapping('EmployeeTravelRecord', 'attachment1', 'name'); - $this->addFileFieldMapping('EmployeeTravelRecord', 'attachment2', 'name'); - $this->addFileFieldMapping('EmployeeTravelRecord', 'attachment3', 'name'); - } - - public function initializeDatabaseErrorMappings(){ - - } - - public function setupModuleClassDefinitions(){ - - $this->addModelClass('ImmigrationDocument'); - $this->addModelClass('EmployeeImmigration'); - $this->addModelClass('EmployeeTravelRecord'); - - } - - } -} - - -if (!class_exists('ImmigrationDocument')) { - class ImmigrationDocument extends ICEHRM_Record { - var $_table = 'ImmigrationDocuments'; - - public function getAdminAccess(){ - return array("get","element","save","delete"); - } - - public function getManagerAccess(){ - return array("get","element","save","delete"); - } - - public function getUserAccess(){ - return array("get"); - } - - public function getUserOnlyMeAccess(){ - return array("get","element"); - } - } -} - -if (!class_exists('EmployeeImmigration')) { - class EmployeeImmigration extends ICEHRM_Record { - var $_table = 'EmployeeImmigrations'; - - public function getAdminAccess(){ - return array("get","element","save","delete"); - } - - public function getManagerAccess(){ - return array("get","element","save","delete"); - } - - public function getUserAccess(){ - return array("get"); - } - - public function getUserOnlyMeAccess(){ - return array("element","save","delete"); - } - } -} - - -if (!class_exists('EmployeeTravelRecord')) { - class EmployeeTravelRecord extends ApproveModel - { - var $_table = 'EmployeeTravelRecords'; - - var $notificationModuleName = "Travel Management"; - var $notificationUnitName = "TravelRequest"; - var $notificationUnitPrefix = "A"; - var $notificationUnitAdminUrl = "g=admin&n=travel&m=admin_Employees"; - var $preApproveSettingName = "Travel: Pre-Approve Travel Request"; - - public function getAdminAccess() - { - return array("get", "element", "save", "delete"); - } - - public function getManagerAccess() - { - return array("get", "element", "save", "delete"); - } - - public function getUserAccess() - { - return array("get"); - } - - public function getUserOnlyMeAccess() - { - return array("element", "save", "delete"); - } - - public function fieldsNeedToBeApproved() - { - return array( - "travel_from", - "travel_to", - "travel_date", - "return_date", - "funding", - "currency" - ); - } - - } -} \ No newline at end of file diff --git a/ext/admin/travel/dashboard.html b/ext/admin/travel/dashboard.html deleted file mode 100644 index 1c14dc56..00000000 --- a/ext/admin/travel/dashboard.html +++ /dev/null @@ -1,19 +0,0 @@ -
- -
-
-

- Travel -

-

- Requests -

-
-
- -
- - Manage Travel - -
-
\ No newline at end of file diff --git a/ext/admin/travel/index.php b/ext/admin/travel/index.php deleted file mode 100644 index 62a033a8..00000000 --- a/ext/admin/travel/index.php +++ /dev/null @@ -1,78 +0,0 @@ -. - ------------------------------------------------------------------- - -Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd] -Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilinah) - */ - -$moduleName = 'travel'; -define('MODULE_PATH',dirname(__FILE__)); -include APP_BASE_PATH.'header.php'; -include APP_BASE_PATH.'modulejslibs.inc.php'; - -$options = array(); -$options['setRemoteTable'] = 'true'; - -$moduleBuilder = new ModuleBuilder(); -$moduleBuilder->addModuleOrGroup(new ModuleTab('EmployeeTravelRecord','EmployeeTravelRecord','Travel Requests','EmployeeTravelRecordAdapter','','',true,$options)); -echo UIManager::getInstance()->renderModule($moduleBuilder); - - -$itemName = 'TravelRequest'; -$moduleName = 'Travel Management'; -$itemNameLower = strtolower($itemName); - -$statuses = array("Approved","Pending","Rejected","Cancelled"); - -?> -user->user_level == 'Admin' || $this->user->id == $req->id){ - $user = $this->baseService->getElement('User',$req->id); + if(defined('DEMO_MODE')){ + return new IceResponse(IceResponse::ERROR,"You are not allowed to change the password in demo mode"); + } + + $user = new User(); + $user->Load("id = ?",array($req->id)); + LogManager::getInstance()->debug("Current User:".print_r($this->user,true)); + LogManager::getInstance()->debug("Edit User:".print_r($user,true)); + if($this->user->user_level == 'Admin' || $this->user->id == $user->id){ + if(empty($user->id)){ return new IceResponse(IceResponse::ERROR,"Please save the user first"); } diff --git a/ext/admin/users/api/UsersAdminManager.php b/ext/admin/users/api/UsersAdminManager.php index 1b9a0aec..9e448c58 100644 --- a/ext/admin/users/api/UsersAdminManager.php +++ b/ext/admin/users/api/UsersAdminManager.php @@ -54,10 +54,39 @@ if (!class_exists('User')) { if(count($users) > 0){ return new IceResponse(IceResponse::ERROR,"A user with same authentication email already exist"); } + + //Check if you are trying to change user level + $oldUser = new User(); + $oldUser->Load("id = ?",array($obj->id)); + if($oldUser->user_level != $obj->user_level && $oldUser->user_level == 'Admin'){ + $adminUsers = $userTemp->Find("user_level = ?",array("Admin")); + if(count($adminUsers) == 1 && $adminUsers[0]->id == $obj->id){ + return new IceResponse(IceResponse::ERROR,"You are the only admin user for the application. You are not allowed to revoke your admin rights"); + } + } + + } + + //Check if the user have rights to the default module + if(!empty($obj->default_module)){ + $module = new Module(); + $module->Load("id = ?",array($obj->default_module)); + if($module->mod_group == "user"){ + $module->mod_group = "modules"; + } + $moduleManager = BaseService::getInstance()->getModuleManager($module->mod_group, $module->name); + if(!BaseService::getInstance()->isModuleAllowedForGivenUser($moduleManager, $obj)){ + return new IceResponse(IceResponse::ERROR,"This module can not be set as the default module for the user since the user do not have access to this module"); + } + + } + + return new IceResponse(IceResponse::SUCCESS,""); } + var $_table = 'Users'; } diff --git a/ext/modules/employees/api/EmployeesActionManager.php b/ext/modules/employees/api/EmployeesActionManager.php index b1ef0129..4908083b 100644 --- a/ext/modules/employees/api/EmployeesActionManager.php +++ b/ext/modules/employees/api/EmployeesActionManager.php @@ -23,8 +23,20 @@ Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilin class EmployeesActionManager extends SubActionManager{ public function get($req){ + $profileId = $this->getCurrentProfileId(); + $subordinate = new Employee(); + $subordinatesCount = $subordinate->Count("supervisor = ? and id = ?",array($profileId, $req->id)); + + + if($this->user->user_level == 'Admin' || $subordinatesCount > 0){ + $id = $req->id; + } - $employee = $this->baseService->getElement('Employee',$this->getCurrentProfileId(),$req->map,true); + if(empty($id)){ + $id = $profileId; + } + + $employee = $this->baseService->getElement('Employee',$id,$req->map,true); $subordinate = new Employee(); $subordinates = $subordinate->Find("supervisor = ?",array($employee->id)); @@ -53,11 +65,19 @@ class EmployeesActionManager extends SubActionManager{ } public function deleteProfileImage($req){ - if($this->user->user_level == 'Admin' || $this->user->employee == $req->id){ + + $profileId = $this->getCurrentProfileId(); + $subordinate = new Employee(); + $subordinatesCount = $subordinate->Count("supervisor = ? and id = ?",array($profileId, $req->id)); + + + if($this->user->user_level == 'Admin' || $this->user->employee == $req->id || $subordinatesCount == 1){ $fs = FileService::getInstance(); $res = $fs->deleteProfileImage($req->id); return new IceResponse(IceResponse::SUCCESS,$res); } + + return new IceResponse(IceResponse::ERROR,"Not allowed to delete profile image"); } public function changePassword($req){ @@ -65,8 +85,9 @@ class EmployeesActionManager extends SubActionManager{ if($this->getCurrentProfileId() != $this->user->employee || empty($this->user->employee)){ return new IceResponse(IceResponse::ERROR,"You are not allowed to change passwords of other employees"); } - - $user = $this->baseService->getElement('User',$this->user->id); + + $user = new User(); + $user->Load("id = ?",array($this->user->id)); if(empty($user->id)){ return new IceResponse(IceResponse::ERROR,"Error occured while changing password"); } diff --git a/ext/modules/employees/customTemplates/myDetails.html b/ext/modules/employees/customTemplates/myDetails.html index 8bbcfec9..d3575508 100644 --- a/ext/modules/employees/customTemplates/myDetails.html +++ b/ext/modules/employees/customTemplates/myDetails.html @@ -1,59 +1,69 @@ -
-
+
+
- +
-
+
+
+

+
+
+
+

+    + +

+
+
-
- - - - + + + +
- +
- +
- +
-
-
-
- Personal Information

+
+
+

Personal Information

+
- +
- +
- +
- +
@@ -61,87 +71,78 @@
- +
- +
- +
+
-
-
-
- Contact Information

+
+
+

Contact Information

+
- +
- +
- +
- +

- +
- +
- - -
-
- +
-
-
-
- - -
-
- +
-
+
+
-
-
-
- Job Details

+
+
+

Job Details

+
- +
- +
@@ -149,17 +150,18 @@
- +

- +
+
diff --git a/ext/modules/travel/dashboard.html b/ext/modules/employees/dashboard.html similarity index 54% rename from ext/modules/travel/dashboard.html rename to ext/modules/employees/dashboard.html index 1bd1d87f..277f42b3 100644 --- a/ext/modules/travel/dashboard.html +++ b/ext/modules/employees/dashboard.html @@ -1,17 +1,17 @@
-
+
-

My Travel

+

My Profile

- Management + Edit Details

- +
- - Travel Management + + Manage Profile
\ No newline at end of file diff --git a/ext/modules/employees/index.php b/ext/modules/employees/index.php index 061ebdbf..55dd3743 100644 --- a/ext/modules/employees/index.php +++ b/ext/modules/employees/index.php @@ -25,9 +25,32 @@ $moduleName = 'employees'; define('MODULE_PATH',dirname(__FILE__)); include APP_BASE_PATH.'header.php'; include APP_BASE_PATH.'modulejslibs.inc.php'; +$fieldNameMap = BaseService::getInstance()->getFieldNameMappings("Employee"); +$customFields = BaseService::getInstance()->getCustomFields("Employee"); ?> - - + + +