New features for modules

This commit is contained in:
Thilina Hasantha
2015-12-13 15:21:23 +05:30
parent ca3492e30e
commit ea106119ab
25 changed files with 457 additions and 305 deletions

View File

@@ -11,7 +11,7 @@ define('APP_DB', '_APP_DB_');
define('APP_USERNAME', '_APP_USERNAME_');
define('APP_PASSWORD', '_APP_PASSWORD_');
define('APP_HOST', '_APP_HOST_');
define('APP_CON_STR', 'mysql://'.APP_USERNAME.':'.APP_PASSWORD.'@'.APP_HOST.'/'.APP_DB);
define('APP_CON_STR', 'mysqli://'.APP_USERNAME.':'.APP_PASSWORD.'@'.APP_HOST.'/'.APP_DB);
//file upload
define('FILE_TYPES', 'jpg,png,jpeg');

View File

@@ -1,8 +1,8 @@
<?php
error_reporting(E_ALL);
error_reporting(E_ERROR);
ini_set("error_log", "/tmp/icehrm_install.log");
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");

View File

@@ -7,7 +7,7 @@ class NotificationManager{
$this->baseService = $baseService;
}
public function addNotification($toEmployee, $message, $action, $type, $toUserId = null, $fromSystem = false){
public function addNotification($toEmployee, $message, $action, $type, $toUserId = null, $fromSystem = false, $sendEmail = false){
$userEmp = new User();
@@ -63,7 +63,12 @@ class NotificationManager{
$ok = $noti->Save();
if(!$ok){
error_log("Error adding notification: ".$noti->ErrorMsg());
}
}else if($sendEmail){
$emailSender = BaseService::getInstance()->getEmailSender();
if(!empty($emailSender)){
$emailSender->sendEmailFromNotification($noti);
}
}
}
public function clearNotifications($userId){
@@ -127,4 +132,4 @@ class NotificationManager{
}
}
}

View File

@@ -1,117 +1 @@
<?php
class DocumentExpiryNotificationTask extends EmailIceTask{
var $documentCache = array();
var $notificationList = array();
var $employeeDocList = array();
var $employeeEmails = array();
public function execute($cron){
if(SettingsManager::getInstance()->getSetting('Notifications: Send Document Expiry Emails') != '1'){
LogManager::getInstance()->info("Notifications: Send Document Expiry Emails is set to No. Do not send emails");
return;
}
//Get documents
$dayList = array();
$dayList[30] = 'expire_notification_month';
$dayList[7] = 'expire_notification_week';
$dayList[1] = 'expire_notification_day';
$dayList[0] = 'expire_notification';
foreach($dayList as $k => $v){
$this->expiryDayNotification($k, $v);
}
$this->getExpireDocumentHTMLByEmployee();
$this->sendEmployeeEmails($this->employeeEmails, "IceHrm Employee Document Expiry Reminder");
}
private function expiryDayNotification($day, $param){
$date = date('Y-m-d', strtotime("+".$day." days"));
$employeeDocument = new EmployeeDocument();
$employeeDocuments = $employeeDocument->Find("valid_until IS NOT NULL and valid_until = ? and (expire_notification_last > ? or expire_notification_last = -1) and status = ?",
array($date, $day, 'Active'));
if(!$employeeDocuments){
LogManager::getInstance()->error("Error :".$employeeDocument->ErrorMsg());
return;
}
$query = "valid_until IS NOT NULL and valid_until = $date and
(expire_notification_last > $day or expire_notification_last == -1)
and status = 'Active';";
LogManager::getInstance()->debug($query);
foreach($employeeDocuments as $doc){
LogManager::getInstance()->debug("Employee Doc :".print_r($doc, true));
if(empty($doc->document)){
continue;
}
$document = null;
if(isset($this->documentCache[$doc->id])){
$document = $this->documentCache[$doc->id];
}else{
$document = new Document();
$document->Load("id = ?",array($doc->document));
$this->documentCache[$document->id] = $document;
}
if($document->$param == "Yes"){
if(!isset($this->notificationList[$doc->employee])){
$this->notificationList[$doc->employee] = array();
}
$this->notificationList[$doc->employee][] = array($doc, $document, $day);
}
$doc->expire_notification_last = $day;
$doc->Save();
}
}
private function getExpireDocumentHTMLByEmployee(){
$row = '<p style="background-color: #EEE;padding: 5px;font-size: 0.9em;font-weight: bold;"><span style="font-size: 1em;font-weight: bold;">#_name_#</span> - Expire in #_days_# day(s)</p><br/><span style="font-size: 0.8em;font-weight: bold;">#_description_#</span><hr/>';
foreach($this->notificationList as $key => $val){
$employeeEmail = "";
foreach($val as $list){
$trow = $row;
$doc = $list[0];
$document = $list[1];
$days = $list[2];
$trow = str_replace("#_name_#",$document->name,$trow);
$trow = str_replace("#_days_#",$days,$trow);
$trow = str_replace("#_description_#",$doc->details,$trow);
$employeeEmail.=$trow;
}
$employee = new Employee();
$employee->Load("id = ?",array($key));
if(empty($employee->id) || $employee->id != $key){
LogManager::getInstance()->error("Could not load employee with id");
return;
}
$emailBody = file_get_contents(APP_BASE_PATH.'/admin/documents/emailTemplates/documentExpireEmailTemplate.html');
$emailBody = str_replace("#_employee_#",$employee->first_name,$emailBody);
$emailBody = str_replace("#_documents_#",$employeeEmail,$emailBody);
$this->employeeEmails[$employee->id] = $emailBody;
}
}
}

View File

@@ -74,29 +74,30 @@ if(!file_exists($logoFileName)){
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<style type="text/css">
/* Override some defaults */
html, body {
background-color: #829AA8;
}
body {
padding-top: 40px;
}
.container {
width: 300px;
}
<style type="text/css">
/* Override some defaults */
html, body {
background-color: #829AA8;
}
body {
padding-top: 40px;
}
.container {
width: 300px;
}
/* The white background content wrapper */
.container > .content {
min-height: 0px !important;
background-color: #fff;
padding: 20px;
margin: 0 -20px;
-webkit-border-radius: 10px 10px 10px 10px;
-moz-border-radius: 10px 10px 10px 10px;
border-radius: 10px 10px 10px 10px;
margin: 0 -20px;
-webkit-border-radius:0px;
-moz-border-radius:0px;
border-radius: 0px;
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,.15);
-moz-box-shadow: 0 1px 2px rgba(0,0,0,.15);
box-shadow: 0 1px 2px rgba(0,0,0,.15);
@@ -112,10 +113,22 @@ if(!file_exists($logoFileName)){
color: #404040;
}
.add-on{
-webkit-border-radius:0px;
-moz-border-radius:0px;
border-radius: 0px;
}
input{
-webkit-border-radius:0px;
-moz-border-radius:0px;
border-radius: 0px;
}
</style>
</head>
</head>
<body>
<div itemscope itemtype="http://schema.org/WebApplication" style="display: none;">

View File

@@ -52,6 +52,41 @@
</div>
<!-- Plain Message Modal -->
<!-- Data Message Modal -->
<div class="modal fade" id="dataMessageModel" tabindex="-1" role="dialog" aria-labelledby="dataMessageModelLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header" style="border-bottom:none;/*background-color: #3c8dbc;*/">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true" style="margin-top:-10px;"><li class="fa fa-times"/></button>
</div>
<div class="modal-body">
<p id="dataMessageModelBody"></p>
</div>
</div>
</div>
</div>
<!-- Data Message Modal -->
<!-- Yes No Modal -->
<div class="modal fade" id="yesnoModel" tabindex="-1" role="dialog" aria-labelledby="yesnoModelLabel" 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 id="yesnoModelLabel" style="font-size: 17px;"></h3>
</div>
<div class="modal-body">
<p id="yesnoModelBody"></p>
</div>
<div class="modal-footer">
<button id="yesnoModelNoBtn" class="btn" onclick="modJs.cancelYesno();">No</button>
<button id="yesnoModelYesBtn" class="btn btn-primary">Yes</button>
</div>
</div>
</div>
</div>
<!-- Yes No Modal -->
<!-- Upload Modal -->
<div class="modal fade" id="uploadModel" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog">
@@ -148,4 +183,4 @@
</div>
</div>
<!-- Modal -->
<?php }?>
<?php }?>

View File

@@ -1,3 +1,119 @@
INSERT INTO `Timezones`(`id`, `name`, `details`) VALUES
(1, 'Pacific/Midway', '(GMT-11:00) Midway Island'),
(2, 'US/Samoa', '(GMT-11:00) Samoa'),
(3, 'US/Hawaii', '(GMT-10:00) Hawaii'),
(4, 'US/Alaska', '(GMT-09:00) Alaska'),
(5, 'US/Pacific', '(GMT-08:00) Pacific Time (US, Canada)'),
(6, 'America/Tijuana', '(GMT-08:00) Tijuana'),
(7, 'US/Arizona', '(GMT-07:00) Arizona'),
(8, 'US/Mountain', '(GMT-07:00) Mountain Time (US, Canada)'),
(9, 'America/Chihuahua', '(GMT-07:00) Chihuahua'),
(10, 'America/Mazatlan', '(GMT-07:00) Mazatlan'),
(11, 'America/Mexico_City', '(GMT-06:00) Mexico City'),
(12, 'America/Monterrey', '(GMT-06:00) Monterrey'),
(13, 'Canada/Saskatchewan', '(GMT-06:00) Saskatchewan'),
(14, 'US/Central', '(GMT-06:00) Central Time (US , Canada)'),
(15, 'US/Eastern', '(GMT-05:00) Eastern Time (US , Canada)'),
(16, 'US/East-Indiana', '(GMT-05:00) Indiana (East)'),
(17, 'America/Bogota', '(GMT-05:00) Bogota'),
(18, 'America/Lima', '(GMT-05:00) Lima'),
(19, 'America/Caracas', '(GMT-04:30) Caracas'),
(20, 'Canada/Atlantic', '(GMT-04:00) Atlantic Time (Canada)'),
(21, 'America/La_Paz', '(GMT-04:00) La Paz'),
(22, 'America/Santiago', '(GMT-04:00) Santiago'),
(23, 'Canada/Newfoundland', '(GMT-03:30) Newfoundland'),
(24, 'America/Buenos_Aires', '(GMT-03:00) Buenos Aires'),
(25, 'Greenland', '(GMT-03:00) Greenland'),
(26, 'Atlantic/Stanley', '(GMT-02:00) Stanley'),
(27, 'Atlantic/Azores', '(GMT-01:00) Azores'),
(28, 'Atlantic/Cape_Verde', '(GMT-01:00) Cape Verde Is.'),
(29, 'Africa/Casablanca', '(GMT) Casablanca'),
(30, 'Europe/Dublin', '(GMT) Dublin'),
(31, 'Europe/Lisbon', '(GMT) Lisbon'),
(32, 'Europe/London', '(GMT) London'),
(33, 'Africa/Monrovia', '(GMT) Monrovia'),
(34, 'Europe/Amsterdam', '(GMT+01:00) Amsterdam'),
(35, 'Europe/Belgrade', '(GMT+01:00) Belgrade'),
(36, 'Europe/Berlin', '(GMT+01:00) Berlin'),
(37, 'Europe/Bratislava', '(GMT+01:00) Bratislava'),
(38, 'Europe/Brussels', '(GMT+01:00) Brussels'),
(39, 'Europe/Budapest', '(GMT+01:00) Budapest'),
(40, 'Europe/Copenhagen', '(GMT+01:00) Copenhagen'),
(41, 'Europe/Ljubljana', '(GMT+01:00) Ljubljana'),
(42, 'Europe/Madrid', '(GMT+01:00) Madrid'),
(43, 'Europe/Paris', '(GMT+01:00) Paris'),
(44, 'Europe/Prague', '(GMT+01:00) Prague'),
(45, 'Europe/Rome', '(GMT+01:00) Rome'),
(46, 'Europe/Sarajevo', '(GMT+01:00) Sarajevo'),
(47, 'Europe/Skopje', '(GMT+01:00) Skopje'),
(48, 'Europe/Stockholm', '(GMT+01:00) Stockholm'),
(49, 'Europe/Vienna', '(GMT+01:00) Vienna'),
(50, 'Europe/Warsaw', '(GMT+01:00) Warsaw'),
(51, 'Europe/Zagreb', '(GMT+01:00) Zagreb'),
(52, 'Europe/Athens', '(GMT+02:00) Athens'),
(53, 'Europe/Bucharest', '(GMT+02:00) Bucharest'),
(54, 'Africa/Cairo', '(GMT+02:00) Cairo'),
(55, 'Africa/Harare', '(GMT+02:00) Harare'),
(56, 'Europe/Helsinki', '(GMT+02:00) Helsinki'),
(57, 'Europe/Istanbul', '(GMT+02:00) Istanbul'),
(58, 'Asia/Jerusalem', '(GMT+02:00) Jerusalem'),
(59, 'Europe/Kiev', '(GMT+02:00) Kyiv'),
(60, 'Europe/Minsk', '(GMT+02:00) Minsk'),
(61, 'Europe/Riga', '(GMT+02:00) Riga'),
(62, 'Europe/Sofia', '(GMT+02:00) Sofia'),
(63, 'Europe/Tallinn', '(GMT+02:00) Tallinn'),
(64, 'Europe/Vilnius', '(GMT+02:00) Vilnius'),
(65, 'Asia/Baghdad', '(GMT+03:00) Baghdad'),
(66, 'Asia/Kuwait', '(GMT+03:00) Kuwait'),
(67, 'Africa/Nairobi', '(GMT+03:00) Nairobi'),
(68, 'Asia/Riyadh', '(GMT+03:00) Riyadh'),
(69, 'Europe/Moscow', '(GMT+03:00) Moscow'),
(70, 'Asia/Tehran', '(GMT+03:30) Tehran'),
(71, 'Asia/Baku', '(GMT+04:00) Baku'),
(72, 'Europe/Volgograd', '(GMT+04:00) Volgograd'),
(73, 'Asia/Muscat', '(GMT+04:00) Muscat'),
(74, 'Asia/Tbilisi', '(GMT+04:00) Tbilisi'),
(75, 'Asia/Yerevan', '(GMT+04:00) Yerevan'),
(76, 'Asia/Kabul', '(GMT+04:30) Kabul'),
(77, 'Asia/Karachi', '(GMT+05:00) Karachi'),
(78, 'Asia/Tashkent', '(GMT+05:00) Tashkent'),
(79, 'Asia/Kolkata', '(GMT+05:30) Kolkata'),
(80, 'Asia/Kathmandu', '(GMT+05:45) Kathmandu'),
(81, 'Asia/Yekaterinburg', '(GMT+06:00) Ekaterinburg'),
(82, 'Asia/Almaty', '(GMT+06:00) Almaty'),
(83, 'Asia/Dhaka', '(GMT+06:00) Dhaka'),
(84, 'Asia/Novosibirsk', '(GMT+07:00) Novosibirsk'),
(85, 'Asia/Bangkok', '(GMT+07:00) Bangkok'),
(86, 'Asia/Jakarta', '(GMT+07:00) Jakarta'),
(87, 'Asia/Krasnoyarsk', '(GMT+08:00) Krasnoyarsk'),
(88, 'Asia/Chongqing', '(GMT+08:00) Chongqing'),
(89, 'Asia/Hong_Kong', '(GMT+08:00) Hong Kong'),
(90, 'Asia/Kuala_Lumpur', '(GMT+08:00) Kuala Lumpur'),
(91, 'Australia/Perth', '(GMT+08:00) Perth'),
(92, 'Asia/Singapore', '(GMT+08:00) Singapore'),
(93, 'Asia/Taipei', '(GMT+08:00) Taipei'),
(94, 'Asia/Ulaanbaatar', '(GMT+08:00) Ulaan Bataar'),
(95, 'Asia/Urumqi', '(GMT+08:00) Urumqi'),
(96, 'Asia/Irkutsk', '(GMT+09:00) Irkutsk'),
(97, 'Asia/Seoul', '(GMT+09:00) Seoul'),
(98, 'Asia/Tokyo', '(GMT+09:00) Tokyo'),
(99, 'Australia/Adelaide', '(GMT+09:30) Adelaide'),
(100, 'Australia/Darwin', '(GMT+09:30) Darwin'),
(101, 'Asia/Yakutsk', '(GMT+10:00) Yakutsk'),
(102, 'Australia/Brisbane', '(GMT+10:00) Brisbane'),
(103, 'Australia/Canberra', '(GMT+10:00) Canberra'),
(104, 'Pacific/Guam', '(GMT+10:00) Guam'),
(105, 'Australia/Hobart', '(GMT+10:00) Hobart'),
(106, 'Australia/Melbourne', '(GMT+10:00) Melbourne'),
(107, 'Pacific/Port_Moresby', '(GMT+10:00) Port Moresby'),
(108, 'Australia/Sydney', '(GMT+10:00) Sydney'),
(109, 'Asia/Vladivostok', '(GMT+11:00) Vladivostok'),
(110, 'Asia/Magadan', '(GMT+12:00) Magadan'),
(111, 'Pacific/Auckland', '(GMT+12:00) Auckland'),
(112, 'Pacific/Fiji', '(GMT+12:00) Fiji');
INSERT INTO `CurrencyTypes`(`id`, `code`, `name`) VALUES
(3, 'AED', 'Utd. Arab Emir. Dirham'),
(4, 'AFN', 'Afghanistan Afghani'),
@@ -400,8 +516,8 @@ INSERT INTO `Country`(`code`, `namecap`, `name`, `iso3`, `numcode`) VALUES
('YE', 'YEMEN', 'Yemen', 'YEM', 887),
('ZM', 'ZAMBIA', 'Zambia', 'ZMB', 894),
('ZW', 'ZIMBABWE', 'Zimbabwe', 'ZWE', 716);
INSERT INTO `Province`(`id`, `name`, `code`, `country`) VALUES
INSERT INTO `Province`(`id`, `name`, `code`, `country`) VALUES
(1, 'Alaska', 'AK', 'US'),
(2, 'Alabama', 'AL', 'US'),
(3, 'American Samoa', 'AS', 'US'),
@@ -467,9 +583,9 @@ INSERT INTO `Province`(`id`, `name`, `code`, `country`) VALUES
(63, 'Armed Forces Europe', 'AE', 'US'),
(64, 'Armed Forces Middle East', 'AE', 'US'),
(65, 'Armed Forces Pacific', 'AP', 'US');
INSERT INTO `Nationality` (`id`, `name`) VALUES
(1, 'Afghan'),
(2, 'Albanian'),
@@ -673,10 +789,17 @@ INSERT INTO `Reports` (`id`, `name`, `details`, `parameters`, `query`, `paramOrd
(4, 'Employee Attendance Report', 'This report list all employee attendance entries by employee and date range', '[\r\n[ "employee", {"label":"Employee","type":"select2multi","allow-null":true,"null-label":"All Employees","remote-source":["Employee","id","first_name+last_name"]}],\r\n[ "date_start", {"label":"Start Date","type":"date"}],\r\n[ "date_end", {"label":"End Date","type":"date"}]\r\n]', 'EmployeeAttendanceReport', '["employee","date_start","date_end"]', 'Class'),
(5, 'Employee Time Tracking Report', 'This report list employee working hours and attendance details for each day for a given period ', '[\r\n[ "employee", {"label":"Employee","type":"select2","allow-null":false,"remote-source":["Employee","id","first_name+last_name"]}],\r\n[ "date_start", {"label":"Start Date","type":"date"}],\r\n[ "date_end", {"label":"End Date","type":"date"}]\r\n]', 'EmployeeTimeTrackReport', '["employee","date_start","date_end"]', 'Class');
REPLACE INTO `Reports` (`name`, `details`, `parameters`, `query`, `paramOrder`, `type`) VALUES
('Expense Report', 'This report list employees expenses for a specified period',
'[\r\n[ "employee", {"label":"Employee","type":"select2multi","allow-null":true,"null-label":"All Employees","remote-source":["Employee","id","first_name+last_name"]}],\r\n[ "date_start", {"label":"Start Date","type":"date"}],\r\n[ "date_end", {"label":"End Date","type":"date"}],\r\n[ "status", {"label":"Status","type":"select","source":[["NULL","All Statuses"],["Approved","Approved"],["Pending","Pending"],["Rejected","Rejected"],["Cancellation Requested","Cancellation Requested"],["Cancelled","Cancelled"]]}]\r\n]',
'ExpenseReport',
'["employee","date_start","date_end","status"]', 'Class');
INSERT INTO `Settings` (`name`, `value`, `description`, `meta`) VALUES
('Company: Logo', '', '','[ "value", {"label":"Logo","type":"fileupload","validation":"none"}]'),
('Company: Name', 'Sample Company Pvt Ltd', 'Update your company name - For updating company logo copy a file named logo.png to /app/data/ folder', ''),
('Company: Description', 'This is a company using icehrm.com', '',''),
('Email: Enable', '1', '0 will disable all outgoing emails from modules. Value 1 will enable outgoing emails','["value", {"label":"Value","type":"select","source":[["1","Yes"],["0","No"]]}]'),
('Email: Mode', 'SMTP', 'SMTP, PHP Mailer or Amazon SES. SMTP = send emails using local or a remote smtp server. PHP Mailer = send emails using mail function provided by php. Amazon SES = send emails trough amazon Simple Email Service.','["value", {"label":"Value","type":"select","source":[["SMTP","SMTP"],["PHP Mailer","PHP Mailer"],["SES","Amazon SES"]]}]'),
('Email: SMTP Host', 'localhost', 'SMTP host IP',''),
@@ -696,6 +819,17 @@ INSERT INTO `Settings` (`name`, `value`, `description`, `meta`) VALUES
('Api: REST Api Enabled', '0', '','["value", {"label":"Value","type":"select","source":[["0","No"],["1","Yes"]]}]');
INSERT INTO `Settings` (`name`, `value`, `description`, `meta`) VALUES
('Notifications: Send Document Expiry Emails', '1', '','["value", {"label":"Value","type":"select","source":[["1","Yes"],["0","No"]]}]'),
('Notifications: Copy Document Expiry Emails to Manager', '1', '','["value", {"label":"Value","type":"select","source":[["1","Yes"],["0","No"]]}]'),
('Expense: Pre-Approve Expenses', '0', '','["value", {"label":"Value","type":"select","source":[["1","Yes"],["0","No"]]}]'),
('Travel: Pre-Approve Travel Request', '0', '','["value", {"label":"Value","type":"select","source":[["1","Yes"],["0","No"]]}]');
INSERT INTO `Settings` (`name`, `value`, `description`, `meta`) VALUES
('Attendance: Use Department Time Zone', '0', '','["value", {"label":"Value","type":"select","source":[["1","Yes"],["0","No"]]}]');
INSERT INTO `Certifications` (`id`, `name`, `description`) VALUES
(1, 'Red Hat Certified Architect (RHCA)', 'Red Hat Certified Architect (RHCA)'),
(2, 'GIAC Secure Software Programmer -Java', 'GIAC Secure Software Programmer -Java'),
@@ -738,11 +872,6 @@ INSERT INTO `CompanyStructures` (`id`, `title`, `description`, `address`, `type`
(3, 'Marketing Department', 'Marketing Department', 'PO Box 001002\nSample Road, Sample Town', 'Department', 'US', 2);
INSERT INTO `Documents` (`id`, `name`, `details`) VALUES
(1, 'ID Copy', 'Your ID copy'),
(2, 'Degree Ceritficate', 'Degree Ceritficate'),
(3, 'Driving License', 'Driving License');
INSERT INTO `Educations` (`id`, `name`, `description`) VALUES
(1, 'Bachelors Degree', 'Bachelors Degree'),
@@ -876,6 +1005,33 @@ INSERT INTO `SalaryComponentType` (`id`,`code`, `name`) VALUES
(2,'B002', 'Allowance');
INSERT INTO `SalaryComponent` VALUES
(1,'Basic Salary', 1,''),(2,'Fixed Allowance', 1,''),(3,'Car Allowance', 2,''),(4,'Telephone Allowance', 2,'');
INSERT INTO `SalaryComponent` (`id`,`name`, `componentType`) VALUES
(1,'Basic Salary', 1),
(2,'Fixed Allowance', 1),
(3,'Car Allowance', 2),
(4,'Telephone Allowance', 2);
INSERT INTO `ExpensesPaymentMethods` (`name`) VALUES
('Cash'),
('Check'),
('Credit Card'),
('Debit Card');
INSERT INTO `ExpensesCategories` (`name`) VALUES
('Auto - Gas'),
('Auto - Insurance'),
('Auto - Maintenance'),
('Auto - Payment'),
('Transportation'),
('Bank Fees'),
('Dining Out'),
('Entertainment'),
('Hotel / Motel'),
('Insurance'),
('Interest Charges'),
('Loan Payment'),
('Medical'),
('Mileage'),
('Rent'),
('Rental Car'),
('Utility');

View File

@@ -36,8 +36,7 @@ INSERT INTO `EmployeeDependents` (`id`, `employee`, `name`, `relationship`, `dob
(2, 1, 'Mica Singroo', 'Other', '2000-06-13', '');
INSERT INTO `EmployeeDocuments` (`id`, `employee`, `document`, `date_added`, `valid_until`, `status`, `details`) VALUES
(1, 2, 2, '2013-01-08', '0000-00-00', 'Active', 'zxczx');
INSERT INTO `EmployeeEducations` (`id`, `education_id`, `employee`, `institute`, `date_start`, `date_end`) VALUES
@@ -59,9 +58,9 @@ INSERT INTO `EmployeeProjects` (`id`, `employee`, `project`, `date_start`, `date
INSERT INTO `EmployeeSalary` (`id`, `employee`, `component`, `pay_frequency`, `currency`, `amount`, `details`) VALUES
(1, 1, 'Basic', 'Monthly', 131, '2700.00', ''),
(2, 2, 'Basic Salary', 'Monthly', 151, '12000.00', ''),
(3, 2, 'Travelling Allowance', 'Monthly', 131, '5000.00', '');
(1, 1, 1, 'Monthly', 131, '2700.00', ''),
(2, 2, 2, 'Monthly', 151, '12000.00', ''),
(3, 2, 3, 'Monthly', 131, '5000.00', '');
INSERT INTO `EmployeeSkills` (`id`, `skill_id`, `employee`, `details`) VALUES

View File

@@ -6,6 +6,7 @@ create table `CompanyStructures` (
`type` enum('Company','Head Office','Regional Office','Department','Unit','Sub Unit','Other') default NULL,
`country` varchar(2) not null default '0',
`parent` bigint(20) NULL,
`timezone` varchar(100) not null default 'Europe/London',
CONSTRAINT `Fk_CompanyStructures_Own` FOREIGN KEY (`parent`) REFERENCES `CompanyStructures` (`id`),
primary key (`id`)
) engine=innodb default charset=utf8;
@@ -157,7 +158,7 @@ create table `Employees` (
CONSTRAINT `Fk_Employee_PayGrades` FOREIGN KEY (`pay_grade`) REFERENCES `PayGrades` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
primary key (`id`),
unique key `employee_id` (`employee_id`)
) engine=innodb default charset=utf8;
create table `ArchivedEmployees` (
@@ -179,7 +180,7 @@ create table `ArchivedEmployees` (
`notes` text default null,
`data` longtext default null,
primary key (`id`)
) engine=innodb default charset=utf8;
create table `UserRoles` (
@@ -364,26 +365,7 @@ create table `EmployeeTimeEntry` (
primary key (`id`)
) engine=innodb default charset=utf8;
create table `Documents` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL,
`details` text default null,
primary key (`id`)
) engine=innodb default charset=utf8;
create table `EmployeeDocuments` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`employee` bigint(20) NOT NULL,
`document` bigint(20) NULL,
`date_added` date NOT NULL,
`valid_until` date NOT NULL,
`status` enum('Active','Inactive','Draft') default 'Active',
`details` text default null,
`attachment` varchar(100) NULL,
CONSTRAINT `Fk_EmployeeDocuments_Documents` FOREIGN KEY (`document`) REFERENCES `Documents` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `Fk_EmployeeDocuments_Employee` FOREIGN KEY (`employee`) REFERENCES `Employees` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
primary key (`id`)
) engine=innodb default charset=utf8;
create table `CompanyLoans` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
@@ -513,54 +495,6 @@ create table `Notifications` (
KEY `toUser_status_time` (`toUser`,`status`,`time`)
) engine=innodb default charset=utf8;
create table `Courses` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`code` varchar(300) NOT NULL,
`name` varchar(300) NOT NULL,
`description` text default null,
`coordinator` bigint(20) NULL,
`trainer` varchar(300) NULL,
`trainer_info` text default null,
`paymentType` enum('Company Sponsored','Paid by Employee') default 'Company Sponsored',
`currency` varchar(3) not null,
`cost` decimal(12,2) DEFAULT 0.00,
`status` enum('Active','Inactive') default 'Active',
`created` datetime default '0000-00-00 00:00:00',
`updated` datetime default '0000-00-00 00:00:00',
CONSTRAINT `Fk_Courses_Employees` FOREIGN KEY (`coordinator`) REFERENCES `Employees` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
primary key (`id`)
) engine=innodb default charset=utf8;
create table `TrainingSessions` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(300) NOT NULL,
`course` bigint(20) NOT NULL,
`description` text default null,
`scheduled` datetime default '0000-00-00 00:00:00',
`dueDate` datetime default '0000-00-00 00:00:00',
`deliveryMethod` enum('Classroom','Self Study','Online') default 'Classroom',
`deliveryLocation` varchar(500) NULL,
`status` enum('Pending','Approved','Completed','Cancelled') default 'Pending',
`attendanceType` enum('Sign Up','Assign') default 'Sign Up',
`attachment` varchar(300) NULL,
`created` datetime default '0000-00-00 00:00:00',
`updated` datetime default '0000-00-00 00:00:00',
CONSTRAINT `Fk_TrainingSessions_Courses` FOREIGN KEY (`course`) REFERENCES `Courses` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
primary key (`id`)
) engine=innodb default charset=utf8;
create table `EmployeeTrainingSessions` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`employee` bigint(20) NOT NULL,
`trainingSession` bigint(20) NULL,
`feedBack` varchar(1500) NULL,
`status` enum('Scheduled','Attended','Not-Attended') default 'Scheduled',
CONSTRAINT `Fk_EmployeeTrainingSessions_TrainingSessions` FOREIGN KEY (`trainingSession`) REFERENCES `TrainingSessions` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `Fk_EmployeeTrainingSessions_Employee` FOREIGN KEY (`employee`) REFERENCES `Employees` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
primary key (`id`)
) engine=innodb default charset=utf8;
create table `ImmigrationDocuments` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
@@ -604,11 +538,14 @@ create table `EmployeeTravelRecords` (
`travel_date` datetime NULL default '0000-00-00 00:00:00',
`return_date` datetime NULL default '0000-00-00 00:00:00',
`details` varchar(500) default null,
`funding` decimal(10,3) NULL,
`currency` bigint(20) NULL,
`attachment1` varchar(100) NULL,
`attachment2` varchar(100) NULL,
`attachment3` varchar(100) NULL,
`created` timestamp NULL default '0000-00-00 00:00:00',
`updated` timestamp NULL default '0000-00-00 00:00:00',
`status` enum('Approved','Pending','Rejected','Cancellation Requested','Cancelled') default 'Pending',
CONSTRAINT `Fk_EmployeeTravelRecords_Employee` FOREIGN KEY (`employee`) REFERENCES `Employees` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
primary key (`id`)
) engine=innodb default charset=utf8;
@@ -773,3 +710,69 @@ create table `DeductionRules` (
create table `Emails` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`subject` varchar(300) NOT NULL,
`toEmail` varchar(300) NOT NULL,
`template` text NULL,
`params` text NULL,
`cclist` varchar(500) NULL,
`bcclist` varchar(500) NULL,
`error` varchar(500) NULL,
`created` DATETIME default '0000-00-00 00:00:00',
`updated` DATETIME default '0000-00-00 00:00:00',
`status` enum('Pending','Sent','Error') default 'Pending',
primary key (`id`),
key `KEY_Emails_status` (`status`),
key `KEY_Emails_created` (`created`)
) engine=innodb default charset=utf8;
create table `ExpensesCategories` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(500) NOT NULL,
`created` timestamp NULL default '0000-00-00 00:00:00',
`updated` timestamp NULL default '0000-00-00 00:00:00',
`pre_approve` enum('Yes','No') default 'Yes',
primary key (`id`)
) engine=innodb default charset=utf8;
create table `ExpensesPaymentMethods` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(500) NOT NULL,
`created` timestamp NULL default '0000-00-00 00:00:00',
`updated` timestamp NULL default '0000-00-00 00:00:00',
primary key (`id`)
) engine=innodb default charset=utf8;
create table `EmployeeExpenses` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`employee` bigint(20) NOT NULL,
`expense_date` date NULL default '0000-00-00',
`payment_method` bigint(20) NOT NULL,
`transaction_no` varchar(300) NOT NULL,
`payee` varchar(500) NOT NULL,
`category` bigint(20) NOT NULL,
`notes` text,
`amount` decimal(10,3) NULL,
`currency` bigint(20) NULL,
`attachment1` varchar(100) NULL,
`attachment2` varchar(100) NULL,
`attachment3` varchar(100) NULL,
`created` timestamp NULL default '0000-00-00 00:00:00',
`updated` timestamp NULL default '0000-00-00 00:00:00',
`status` enum('Approved','Pending','Rejected','Cancellation Requested','Cancelled') default 'Pending',
CONSTRAINT `Fk_EmployeeExpenses_Employee` FOREIGN KEY (`employee`) REFERENCES `Employees` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `Fk_EmployeeExpenses_pm` FOREIGN KEY (`payment_method`) REFERENCES `ExpensesPaymentMethods` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `Fk_EmployeeExpenses_category` FOREIGN KEY (`category`) REFERENCES `ExpensesCategories` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
primary key (`id`)
) engine=innodb default charset=utf8;
create table `Timezones` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(100) not null default '',
`details` varchar(255) not null default '',
primary key (`id`)
) engine=innodb default charset=utf8;

View File

@@ -1,50 +1,50 @@
<?php
if (!class_exists('AttendanceAdminManager')) {
class AttendanceAdminManager extends AbstractModuleManager{
public function initializeUserClasses(){
}
public function initializeFieldMappings(){
}
public function initializeDatabaseErrorMappings(){
}
public function setupModuleClassDefinitions(){
$this->addModelClass('Attendance');
}
}
class AttendanceAdminManager extends AbstractModuleManager{
public function initializeUserClasses(){
}
public function initializeFieldMappings(){
}
public function initializeDatabaseErrorMappings(){
}
public function setupModuleClassDefinitions(){
$this->addModelClass('Attendance');
}
}
}
//Model Classes
if (!class_exists('Attendance')) {
class Attendance extends ICEHRM_Record {
var $_table = 'Attendance';
class Attendance extends ICEHRM_Record {
var $_table = 'Attendance';
public function getAdminAccess(){
return array("get","element","save","delete");
}
public function getAdminAccess(){
return array("get","element","save","delete");
}
public function getManagerAccess(){
return array("get","element","save","delete");
}
public function getManagerAccess(){
return array("get","element","save","delete");
}
public function getUserAccess(){
return array("get");
}
public function getUserAccess(){
return array("get");
}
public function getUserOnlyMeAccess(){
return array("element","save","delete");
}
}
public function getUserOnlyMeAccess(){
return array("element","save","delete");
}
}
}

View File

@@ -158,6 +158,13 @@ AttendanceAdapter.method('saveFailCallback', function(callBackData) {
this.showMessage("Error saving attendance entry", callBackData);
});
AttendanceAdapter.method('isSubProfileTable', function() {
if(this.user.user_level == "Admin"){
return false;
}else{
return true;
}
});
/*
@@ -215,4 +222,13 @@ AttendanceStatusAdapter.method('getActionButtonsHtml', function(id,data) {
html = html.replace(/_COLOR_/g,'green');
}
return html;
});
AttendanceStatusAdapter.method('isSubProfileTable', function() {
if(this.user.user_level == "Admin"){
return false;
}else{
return true;
}
});

View File

@@ -3,7 +3,7 @@
"menu":"Employees",
"order":"8",
"icon":"fa-clock-o",
"user_levels":["Admin"],
"user_levels":["Admin","Manager"],
"permissions":
{}

View File

@@ -49,4 +49,24 @@ if (!class_exists('CompanyStructure')) {
return new IceResponse(IceResponse::SUCCESS,"");
}
}
}
if (!class_exists('Timezone')) {
class Timezone extends ICEHRM_Record {
var $_table = 'Timezones';
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

@@ -17,6 +17,7 @@ CompanyStructureAdapter.method('getDataMapping', function() {
"address",
"type",
"country",
"timezone",
"parent"
];
});
@@ -28,6 +29,7 @@ CompanyStructureAdapter.method('getHeaders', function() {
{ "sTitle": "Address","bSortable":false},
{ "sTitle": "Type"},
{ "sTitle": "Country", "sClass": "center" },
{ "sTitle": "Time Zone"},
{ "sTitle": "Parent Structure"}
];
});
@@ -40,6 +42,7 @@ CompanyStructureAdapter.method('getFormFields', function() {
[ "address", {"label":"Address","type":"textarea","validation":"none"}],
[ "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":"select","remote-source":["Country","code","name"]}],
[ "timezone", {"label":"Time Zone","type":"select","allow-null":false,"remote-source":["Timezone","name","details"]}],
[ "parent", {"label":"Parent Structure","type":"select","allow-null":true,"remote-source":["CompanyStructure","id","title"]}]
];
});
@@ -298,7 +301,7 @@ CompanyGraphAdapter.method('fixCyclicParent', function(sourceData) {
});
CompanyGraphAdapter.method('getHelpLink', function () {
return 'http://blog.icehrm.com/?page_id=61';
return 'http://blog.icehrm.com/docs/companystructure/';
});

View File

@@ -42,7 +42,7 @@ JobTitleAdapter.method('getFormFields', function() {
});
JobTitleAdapter.method('getHelpLink', function () {
return 'http://blog.icehrm.com/?page_id=80';
return 'http://blog.icehrm.com/docs/jobdetails/';
});

View File

@@ -1,7 +1,7 @@
{
"label":"Company Loans",
"menu":"Admin",
"order":"7",
"order":"81",
"icon":"fa-shield",
"user_levels":["Admin"],

View File

@@ -63,7 +63,7 @@ ClientAdapter.method('getFormFields', function() {
});
ClientAdapter.method('getHelpLink', function () {
return 'http://blog.icehrm.com/?page_id=85';
return 'http://blog.icehrm.com/docs/projects/';
});
/**
@@ -116,7 +116,7 @@ ProjectAdapter.method('getFormFields', function() {
});
ProjectAdapter.method('getHelpLink', function () {
return 'http://blog.icehrm.com/?page_id=85';
return 'http://blog.icehrm.com/docs/projects/';
});
@@ -172,6 +172,6 @@ EmployeeProjectAdapter.method('getFilters', function() {
});
EmployeeProjectAdapter.method('getHelpLink', function () {
return 'http://blog.icehrm.com/?page_id=85';
return 'http://blog.icehrm.com/docs/projects/';
});

View File

@@ -40,7 +40,7 @@ SkillAdapter.method('getFormFields', function() {
});
SkillAdapter.method('getHelpLink', function () {
return 'http://blog.icehrm.com/?page_id=83';
return 'http://blog.icehrm.com/docs/qualifications/';
});

View File

@@ -162,6 +162,3 @@ ReportAdapter.method('fillForm', function(object) {
}
});
ReportAdapter.method('getHelpLink', function () {
return 'http://blog.icehrm.com/?page_id=118';
});

View File

@@ -63,5 +63,5 @@ SettingAdapter.method('fillForm', function(object) {
SettingAdapter.method('getHelpLink', function () {
return 'http://blog.icehrm.com/?page_id=126';
});
return 'http://blog.icehrm.com/docs/settings/';
});

View File

@@ -46,15 +46,22 @@ class AttendanceActionManager extends SubActionManager{
public function savePunch($req){
$useServerTime = SettingsManager::getInstance()->getSetting('Attendance: Use Department Time Zone');
$currentEmployeeTimeZone = BaseService::getInstance()->getCurrentEmployeeTimeZone();
if($useServerTime == '1' && !empty($currentEmployeeTimeZone)){
date_default_timezone_set('Asia/Colombo');
$date = new DateTime("now", new DateTimeZone('Asia/Colombo'));
$date->setTimezone(new DateTimeZone($currentEmployeeTimeZone));
$req->time = $date->format('Y-m-d H:i:s');
}
$req->date = $req->time;
/*
if(strtotime($req->date) > strtotime($req->cdate)){
return new IceResponse(IceResponse::ERROR,"You are not allowed to punch a future time");
}
*/
//check if there is an open punch
//check if there is an open punch
$openPunch = $this->getPunch($req)->getData();
if(empty($openPunch)){
@@ -65,13 +72,7 @@ class AttendanceActionManager extends SubActionManager{
$arr = explode(" ",$dateTime);
$date = $arr[0];
$currentDateTime = $req->cdate;
$arr = explode(" ",$currentDateTime);
$currentDate = $arr[0];
if($currentDate != $date){
return new IceResponse(IceResponse::ERROR,"You are not allowed to punch time for a previous date");
}
$employee = $this->baseService->getElement('Employee',$this->getCurrentProfileId(),null,true);
@@ -98,18 +99,18 @@ class AttendanceActionManager extends SubActionManager{
}
if(strtotime($attendance->out_time) >= strtotime($dateTime) && strtotime($attendance->in_time) <= strtotime($dateTime)){
//-1---0---1---0 || ---0--1---1---0
return new IceResponse(IceResponse::ERROR,"Time entry is overlapping with an existing one 1");
return new IceResponse(IceResponse::ERROR,"Time entry is overlapping with an existing one");
}else if(strtotime($attendance->out_time) >= strtotime($openPunch->in_time) && strtotime($attendance->in_time) <= strtotime($openPunch->in_time)){
//---0---1---0---1 || ---0--1---1---0
return new IceResponse(IceResponse::ERROR,"Time entry is overlapping with an existing one 2");
return new IceResponse(IceResponse::ERROR,"Time entry is overlapping with an existing one");
}else if(strtotime($attendance->out_time) <= strtotime($dateTime) && strtotime($attendance->in_time) >= strtotime($openPunch->in_time)){
//--1--0---0--1--
return new IceResponse(IceResponse::ERROR,"Time entry is overlapping with an existing one 3 ".$attendance->id);
return new IceResponse(IceResponse::ERROR,"Time entry is overlapping with an existing one ".$attendance->id);
}
}else{
if(strtotime($attendance->out_time) >= strtotime($dateTime) && strtotime($attendance->in_time) <= strtotime($dateTime)){
//---0---1---0
return new IceResponse(IceResponse::ERROR,"Time entry is overlapping with an existing one 4");
return new IceResponse(IceResponse::ERROR,"Time entry is overlapping with an existing one");
}
}
}

View File

@@ -25,6 +25,11 @@ $moduleName = 'attendance';
define('MODULE_PATH',dirname(__FILE__));
include APP_BASE_PATH.'header.php';
include APP_BASE_PATH.'modulejslibs.inc.php';
$useServerTime = SettingsManager::getInstance()->getSetting('Attendance: Use Department Time Zone');
$currentEmployeeTimeZone = BaseService::getInstance()->getCurrentEmployeeTimeZone();
if(empty($currentEmployeeTimeZone)){
$useServerTime = 0;
}
?><div class="span9">
<ul class="nav nav-tabs" id="modTab" style="margin-bottom:0px;margin-left:5px;border-bottom: none;">
@@ -48,9 +53,11 @@ include APP_BASE_PATH.'modulejslibs.inc.php';
<script>
var modJsList = new Array();
modJsList['tabAttendance'] = new AttendanceAdapter('Attendance','Attendance','','in_time desc');
modJsList['tabAttendance'].setUseServerTime(<?=$useServerTime?>);
modJsList['tabAttendance'].setRemoteTable(true);
modJsList['tabAttendance'].updatePunchButton(true);
var modJs = modJsList['tabAttendance'];
</script>

View File

@@ -23,6 +23,7 @@ Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilin
function AttendanceAdapter(endPoint,tab,filter,orderBy) {
this.initAdapter(endPoint,tab,filter,orderBy);
this.punch = null;
this.useServerTime = 0;
}
AttendanceAdapter.inherits(AdapterBase);
@@ -31,6 +32,10 @@ AttendanceAdapter.method('updatePunchButton', function() {
this.getPunch('changePunchButtonSuccessCallBack');
});
AttendanceAdapter.method('setUseServerTime', function(val) {
this.useServerTime = val;
});
AttendanceAdapter.method('getDataMapping', function() {
return [
@@ -51,11 +56,19 @@ AttendanceAdapter.method('getHeaders', function() {
});
AttendanceAdapter.method('getFormFields', function() {
return [
[ "id", {"label":"ID","type":"hidden"}],
[ "time", {"label":"Time","type":"datetime"}],
[ "note", {"label":"Note","type":"textarea","validation":"none"}]
];
if(this.useServerTime == 0){
return [
[ "id", {"label":"ID","type":"hidden"}],
[ "time", {"label":"Time","type":"datetime"}],
[ "note", {"label":"Note","type":"textarea","validation":"none"}]
];
}else{
return [
[ "id", {"label":"ID","type":"hidden"}],
[ "note", {"label":"Note","type":"textarea","validation":"none"}]
];
}
});

View File

@@ -1,7 +1,7 @@
{
"label":"Loans",
"menu":"Loans",
"order":"1",
"menu":"Finance",
"order":"3",
"icon":"fa-shield",
"user_levels":["Admin","Manager","Employee"],

View File

@@ -2,6 +2,6 @@
"Personal Information":"fa-male",
"Subordinates":"fa-user",
"Time Management":"fa-clock-o",
"Training":"fa-briefcase",
"Loans":"fa-list-alt"
"Travel Management":"fa-plane",
"Finance":"fa-money"
}