Upgrade to v26 (#172)

* A bunch of new updates from icehrm pro

* Push changes to frontend
This commit is contained in:
Thilina Hasantha
2019-02-03 14:00:34 +01:00
committed by GitHub
parent a75325fb52
commit 16014bb38e
734 changed files with 131230 additions and 17430 deletions

View File

@@ -1,5 +1,12 @@
<?php
$migrationList = [];
$migrationList[] = 'v20190125_260003_attendance_with_map';
$migrationList[] = 'v20181106_260002_add_arabic_lang';
$migrationList[] = 'v20181025_260001_dept_based_leave_periods';
$migrationList[] = 'v20180912_250006_remove_null_users';
$migrationList[] = 'v20180810_250005_performance_review';
$migrationList[] = 'v20180808_250004_add_languages';
$migrationList[] = 'v20180801_240003_asset_management';
$migrationList[] = 'v20180623_240002_update_employee_report';
$migrationList[] = 'v20180622_240001_set_valid_until_null';
$migrationList[] = 'v20180615_230402_remove_eh_manager';
@@ -18,5 +25,6 @@ $migrationList[] = 'v20171001_200201_update_attendance_out';
$migrationList[] = 'v20170918_200000_add_attendance_image_out';
$migrationList[] = 'v20170908_200000_payroll_group';
$migrationList[] = 'v20170702_190500_add_attendance_image';
$migrationList[] = 'v20170621_190401_report_modifications';
$migrationList[] = 'v20170310_190401_add_timesheet_changes';
$migrationList[] = 'v20161116_190001_unique_index_cron_name';

View File

@@ -0,0 +1,24 @@
<?php
namespace Classes\Migration;
class v20170621_190401_report_modifications extends AbstractMigration{
public function up(){
$sql = <<<'SQL'
REPLACE INTO `Reports` (`name`, `details`, `parameters`, `query`, `paramOrder`, `type`,`report_group`,`output`) VALUES
('Employee Leave Entitlement', 'This report list employees leave entitlement for current leave period by department or by employee ',
'[[ "department", {"label":"Department","type":"select2","remote-source":["CompanyStructure","id","title"],"allow-null":true, "null-label":"All Departments","validation":"none"}],\r\n[ "employee", {"label":"Employee","type":"select2","allow-null":true, "null-label":"All Employees", "validation":"none","remote-source":["Employee","id","first_name+last_name"]}]]',
'EmployeeLeaveEntitlementReport',
'["department","employee"]', 'Class','Leave Management','CSV');
SQL;
return $this->executeQuery($sql);
}
public function down(){
}
}

View File

@@ -0,0 +1,63 @@
<?php
namespace Classes\Migration;
use Model\Report;
class v20180801_240003_asset_management extends AbstractMigration{
public function up(){
$sql = <<<'SQL'
create table `AssetTypes` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(35) NOT NULL,
`description` TEXT NULL,
`attachment` varchar(100) NULL,
`created` DATETIME default '0000-00-00 00:00:00',
`updated` DATETIME default '0000-00-00 00:00:00',
primary key (`id`)
) engine=innodb default charset=utf8;
SQL;
$this->executeQuery($sql);
$sql = <<<'SQL'
create table `CompanyAssets` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`code` VARCHAR(30) NOT NULL,
`type` bigint(20) NULL,
`attachment` varchar(100) NULL,
`employee` bigint(20) NULL,
`department` bigint(20) NULL,
`description` TEXT NULL,
`created` DATETIME default '0000-00-00 00:00:00',
`updated` DATETIME default '0000-00-00 00:00:00',
primary key (`id`),
CONSTRAINT `Fk_CompanyAssets_AssetTypes` FOREIGN KEY (`type`) REFERENCES `AssetTypes` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `Fk_CompanyAssets_Employees` FOREIGN KEY (`employee`) REFERENCES `Employees` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `Fk_CompanyAssets_CompanyStructures` FOREIGN KEY (`department`) REFERENCES `CompanyStructures` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
) engine=innodb default charset=utf8;
SQL;
$this->executeQuery($sql);
$report = new Report();
$report->name = 'Company Asset Report';
$report->parameters = '[["department", {"label":"Department","type":"select2","remote-source":["CompanyStructure","id","title"],"allow-null":true}],["type", {"label":"Asset Type","type":"select2","remote-source":["AssetType","id","name"],"allow-null":true}]]';
$report->query = 'AssetUsageReport';
$report->type = 'Class';
$report->paramOrder = '["department","type"]';
$report->report_group = 'Resources';
$report->output = 'CSV';
$report->details = 'List company assets assigned to employees and departments';
$ok = $report->Save();
return true;
}
public function down(){
return true;
}
}

View File

@@ -0,0 +1,39 @@
<?php
namespace Classes\Migration;
class v20180808_250004_add_languages extends AbstractMigration{
public function up(){
$sql = <<<'SQL'
INSERT INTO `SupportedLanguages` (`name`, `description`) VALUES ('sr', 'Serbian');
SQL;
$this->executeQuery($sql);
$sql = <<<'SQL'
INSERT INTO `SupportedLanguages` (`name`, `description`) VALUES ('sv', 'Swedish');
SQL;
$this->executeQuery($sql);
$sql = <<<'SQL'
INSERT INTO `SupportedLanguages` (`name`, `description`) VALUES ('no', 'Norwegian');
SQL;
$this->executeQuery($sql);
$sql = <<<'SQL'
INSERT INTO `SupportedLanguages` (`name`, `description`) VALUES ('pt', 'Portuguese');
SQL;
$this->executeQuery($sql);
$sql = <<<'SQL'
INSERT INTO `SupportedLanguages` (`name`, `description`) VALUES ('nl', 'Dutch');
SQL;
return $this->executeQuery($sql);
}
public function down(){
return true;
}
}

View File

@@ -0,0 +1,72 @@
<?php
namespace Classes\Migration;
class v20180810_250005_performance_review extends AbstractMigration{
public function up(){
$sql = <<<'SQL'
create table `ReviewTemplates` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(50) not null,
`description` varchar(500) null,
`items` text null,
`created` DATETIME default '0000-00-00 00:00:00',
`updated` DATETIME default '0000-00-00 00:00:00',
primary key (`id`)
) engine=innodb default charset=utf8;
SQL;
$this->executeQuery($sql);
$sql = <<<'SQL'
create table `PerformanceReviews` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(150) NOT NULL,
`employee` bigint(20) NULL,
`coordinator` bigint(20) NULL,
`attendees` VARCHAR(50) NOT NULL,
`form` bigint(20) NULL,
`status` varchar(20) NOT NULL,
`review_date` DATETIME default '0000-00-00 00:00:00',
`review_period_start` DATETIME default '0000-00-00 00:00:00',
`review_period_end` DATETIME default '0000-00-00 00:00:00',
`self_assessment_due` DATETIME default '0000-00-00 00:00:00',
`notes` TEXT NULL,
`created` DATETIME default '0000-00-00 00:00:00',
`updated` DATETIME default '0000-00-00 00:00:00',
primary key (`id`),
CONSTRAINT `Fk_PerformanceReviews_ReviewTemplates` FOREIGN KEY (`form`) REFERENCES ReviewTemplates (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `Fk_PerformanceReviews_Employees1` FOREIGN KEY (`employee`) REFERENCES `Employees` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `Fk_PerformanceReviews_Employees2` FOREIGN KEY (`coordinator`) REFERENCES `Employees` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
) engine=innodb default charset=utf8;
SQL;
$this->executeQuery($sql);
$sql = <<<'SQL'
create table `ReviewFeedbacks` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`employee` bigint(20) NULL,
`review` bigint(20) NULL,
`subject` bigint(20) NULL,
`form` bigint(20) NULL,
`status` varchar(20) NOT NULL,
`dueon` DATETIME default '0000-00-00 00:00:00',
`created` DATETIME default '0000-00-00 00:00:00',
`updated` DATETIME default '0000-00-00 00:00:00',
primary key (`id`),
CONSTRAINT `Fk_ReviewFeedbacks_ReviewTemplates` FOREIGN KEY (`form`) REFERENCES ReviewTemplates (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `Fk_ReviewFeedbacks_PerformanceReviews` FOREIGN KEY (`review`) REFERENCES PerformanceReviews (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `Fk_ReviewFeedbacks_Employees1` FOREIGN KEY (`employee`) REFERENCES `Employees` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `Fk_ReviewFeedbacks_Employees2` FOREIGN KEY (`subject`) REFERENCES `Employees` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
) engine=innodb default charset=utf8;
SQL;
return $this->executeQuery($sql);
}
public function down(){
return true;
}
}

View File

@@ -0,0 +1,20 @@
<?php
namespace Classes\Migration;
class v20180912_250006_remove_null_users extends AbstractMigration{
public function up(){
$sql = <<<'SQL'
delete from Users where username is NULL;
SQL;
return $this->executeQuery($sql);
}
public function down(){
return true;
}
}

View File

@@ -0,0 +1,26 @@
<?php
namespace Classes\Migration;
class v20181025_260001_dept_based_leave_periods extends AbstractMigration {
public function up(){
$sql = <<<'SQL'
REPLACE INTO `Settings` (`name`, `value`, `description`, `meta`) VALUES
('Leave: Select Leave Period from Employee Department Country', '0', 'The leave period for the employee should be decided based on the country of the department which the employee is attached to','["value", {"label":"Value","type":"select","source":[["1","Yes"],["0","No"]]}]');
SQL;
$this->executeQuery($sql);
$sql = <<<'SQL'
Alter table LeavePeriods ADD COLUMN `country` bigint(20) DEFAULT NULL;
SQL;
return $this->executeQuery($sql);
}
public function down(){
return true;
}
}

View File

@@ -0,0 +1,19 @@
<?php
namespace Classes\Migration;
class v20181106_260002_add_arabic_lang extends AbstractMigration{
public function up(){
$sql = <<<'SQL'
INSERT INTO `SupportedLanguages` (`name`, `description`) VALUES ('ar', 'Arabic');
SQL;
return $this->executeQuery($sql);
}
public function down(){
return true;
}
}

View File

@@ -0,0 +1,40 @@
<?php
namespace Classes\Migration;
class v20190125_260003_attendance_with_map extends AbstractMigration{
public function up(){
$sql = <<<'SQL'
Alter table Attendance add column `map_lat` DECIMAL(10, 8) NULL;
SQL;
$this->executeQuery($sql);
$sql = <<<'SQL'
Alter table Attendance add column `map_lng` DECIMAL(10, 8) NULL;
SQL;
$this->executeQuery($sql);
$sql = <<<'SQL'
Alter table Attendance add column `map_snapshot` longtext default null;
SQL;
return $this->executeQuery($sql);
}
public function down(){
$sql = <<<'SQL'
Alter table Attendance drop column `map_lat`;
SQL;
$this->executeQuery($sql);
$sql = <<<'SQL'
Alter table Attendance drop column `map_lng`;
SQL;
$this->executeQuery($sql);
$sql = <<<'SQL'
Alter table Attendance drop column `map_snapshot`;
SQL;
return $this->executeQuery($sql);
}
}