Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
45ea7e0f0d | ||
|
|
07d33ef7e6 | ||
|
|
a084d5a4cd | ||
|
|
6f975e5791 | ||
|
|
ae7db3d989 | ||
|
|
5b1b087f01 | ||
|
|
7424471a60 | ||
|
|
c46ded6a37 | ||
|
|
6c61577583 | ||
|
|
05b57e0236 | ||
|
|
638e909d46 | ||
|
|
d440aa8fc9 | ||
|
|
60ea533fbf | ||
|
|
119e042b3a | ||
|
|
e506c1d7a1 | ||
|
|
69d40ec2da | ||
|
|
6cba87dd05 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -7,4 +7,4 @@
|
|||||||
/deployment/clients/test/data/
|
/deployment/clients/test/data/
|
||||||
/.vagrant
|
/.vagrant
|
||||||
/app/config.php
|
/app/config.php
|
||||||
/app/data/*.log
|
/app/data/*
|
||||||
|
|||||||
@@ -3,11 +3,14 @@ services:
|
|||||||
before_script:
|
before_script:
|
||||||
- echo "USE mysql;\nUPDATE user SET password=PASSWORD('dev') WHERE user='root';\nFLUSH PRIVILEGES;\n" | mysql -u root
|
- echo "USE mysql;\nUPDATE user SET password=PASSWORD('dev') WHERE user='root';\nFLUSH PRIVILEGES;\n" | mysql -u root
|
||||||
install:
|
install:
|
||||||
|
- rm $TRAVIS_BUILD_DIR/tools/phpunit
|
||||||
- composer require --dev phpunit/phpunit ^5.7
|
- composer require --dev phpunit/phpunit ^5.7
|
||||||
- $TRAVIS_BUILD_DIR/vendor/bin/phpunit --version
|
- $TRAVIS_BUILD_DIR/vendor/bin/phpunit --version
|
||||||
script: $TRAVIS_BUILD_DIR/vendor/bin/phpunit
|
- cp $TRAVIS_BUILD_DIR/vendor/bin/phpunit $TRAVIS_BUILD_DIR/tools
|
||||||
|
script: ant build-ci
|
||||||
language: php
|
language: php
|
||||||
php:
|
php:
|
||||||
- '5.6'
|
- '5.6'
|
||||||
- '7.0'
|
- '7.0'
|
||||||
|
- '7.1'
|
||||||
after_failure: "cat /tmp/icehrm.test.log"
|
after_failure: "cat /tmp/icehrm.test.log"
|
||||||
|
|||||||
15
build.xml
15
build.xml
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project name="icehrm-opensource" default="build">
|
<project name="icehrm-opensource" default="build">
|
||||||
<!-- By default, we assume all tools to be on the $PATH -->
|
<!-- By default, we assume all tools to be on the $PATH -->
|
||||||
<property name="toolsdir" value=""/>
|
<property name="toolsdir" value="${basedir}/tools/"/>
|
||||||
<property name="destination" value="${basedir}/build/app"/>
|
<property name="destination" value="${basedir}/build/app"/>
|
||||||
<property name="testdir" value="${basedir}/build/test"/>
|
<property name="testdir" value="${basedir}/build/test"/>
|
||||||
<property name="origin" value="${basedir}"/>
|
<property name="origin" value="${basedir}"/>
|
||||||
@@ -10,13 +10,16 @@
|
|||||||
<property name="env.Version" value="dev"/>
|
<property name="env.Version" value="dev"/>
|
||||||
<property name="installpath" value="/var/www/apps.gamonoid.com/icehrm-open-core"/>
|
<property name="installpath" value="/var/www/apps.gamonoid.com/icehrm-open-core"/>
|
||||||
|
|
||||||
|
<target name="build-ci"
|
||||||
|
depends="prepare,lint,phpcs,copyapp,phpunit"
|
||||||
|
description=""/>
|
||||||
|
|
||||||
<target name="build"
|
<target name="build"
|
||||||
depends="prepare,lint,copyapp,release,install"
|
depends="prepare,lint,phpcs,copyapp,release,install"
|
||||||
description=""/>
|
description=""/>
|
||||||
|
|
||||||
<target name="buildlocal"
|
<target name="buildlocal"
|
||||||
depends="prepare,lint,copyapp,phpunit"
|
depends="prepare,lint,phpcs,copyapp,phpunit"
|
||||||
description=""/>
|
description=""/>
|
||||||
|
|
||||||
<target name="releaseapp"
|
<target name="releaseapp"
|
||||||
@@ -51,7 +54,6 @@
|
|||||||
<mkdir dir="${basedir}/build/app"/>
|
<mkdir dir="${basedir}/build/app"/>
|
||||||
<mkdir dir="${basedir}/build/release/data"/>
|
<mkdir dir="${basedir}/build/release/data"/>
|
||||||
<mkdir dir="${basedir}/build/release/data/${env.appname}_${env.Version}"/>
|
<mkdir dir="${basedir}/build/release/data/${env.appname}_${env.Version}"/>
|
||||||
<mkdir dir="${basedir}/src/lib"/>
|
|
||||||
|
|
||||||
|
|
||||||
<property name="prepare.done" value="true"/>
|
<property name="prepare.done" value="true"/>
|
||||||
@@ -136,7 +138,8 @@
|
|||||||
<arg value="--extensions=php" />
|
<arg value="--extensions=php" />
|
||||||
<arg value="--ignore=autoload.php" />
|
<arg value="--ignore=autoload.php" />
|
||||||
<arg path="${basedir}/src" />
|
<arg path="${basedir}/src" />
|
||||||
<arg path="${basedir}/tests" />
|
<arg path="${basedir}/test/unit" />
|
||||||
|
<arg path="${basedir}/test/integration" />
|
||||||
</exec>
|
</exec>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
@@ -206,7 +209,9 @@
|
|||||||
<include name=".idea/**"/>
|
<include name=".idea/**"/>
|
||||||
<include name="Vagrantfile"/>
|
<include name="Vagrantfile"/>
|
||||||
<include name="test/**"/>
|
<include name="test/**"/>
|
||||||
|
<include name="tools/**"/>
|
||||||
<include name="robo/**"/>
|
<include name="robo/**"/>
|
||||||
|
<include name="deployment/**"/>
|
||||||
<include name="build/**"/>
|
<include name="build/**"/>
|
||||||
<include name="build.xml"/>
|
<include name="build.xml"/>
|
||||||
<include name="lib/composer/composer.phar"/>
|
<include name="lib/composer/composer.phar"/>
|
||||||
|
|||||||
BIN
composer.phar
BIN
composer.phar
Binary file not shown.
@@ -13,10 +13,10 @@ if(!defined('HOME_LINK_OTHERS')){
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Version
|
//Version
|
||||||
define('VERSION', '20.0.0.OS');
|
define('VERSION', '20.2.0.OS');
|
||||||
define('CACHE_VALUE', '20.0.0.OS');
|
define('CACHE_VALUE', '20.2.0.OS');
|
||||||
define('VERSION_NUMBER', '2000');
|
define('VERSION_NUMBER', '2020');
|
||||||
define('VERSION_DATE', '03/09/2017');
|
define('VERSION_DATE', '28/09/2017');
|
||||||
|
|
||||||
if(!defined('CONTACT_EMAIL')){define('CONTACT_EMAIL','icehrm@gamonoid.com');}
|
if(!defined('CONTACT_EMAIL')){define('CONTACT_EMAIL','icehrm@gamonoid.com');}
|
||||||
if(!defined('KEY_PREFIX')){define('KEY_PREFIX','IceHrm');}
|
if(!defined('KEY_PREFIX')){define('KEY_PREFIX','IceHrm');}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ if(empty($user->default_module)){
|
|||||||
$homeLink = HOME_LINK_OTHERS;
|
$homeLink = HOME_LINK_OTHERS;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
$defaultModule = new Module();
|
$defaultModule = new \Modules\Common\Model\Module();
|
||||||
$defaultModule->Load("id = ?",array($user->default_module));
|
$defaultModule->Load("id = ?",array($user->default_module));
|
||||||
if($defaultModule->mod_group == "user"){
|
if($defaultModule->mod_group == "user"){
|
||||||
$defaultModule->mod_group = "modules";
|
$defaultModule->mod_group = "modules";
|
||||||
|
|||||||
@@ -130,7 +130,8 @@ class ADODB_Active_Record {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!$table) {
|
if (!$table) {
|
||||||
if (!empty($this->_table)) $table = $this->_table;
|
if (!empty($this->table)) $table = $this->table;
|
||||||
|
else if (!empty($this->_table)) $table = $this->_table;
|
||||||
else $table = $this->_pluralize(get_class($this));
|
else $table = $this->_pluralize(get_class($this));
|
||||||
}
|
}
|
||||||
$this->foreignName = strtolower(get_class($this)); // CFR: default foreign name
|
$this->foreignName = strtolower(get_class($this)); // CFR: default foreign name
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
$migrationList = [];
|
$migrationList = [];
|
||||||
|
$migrationList[] = 'v20170918_200000_add_attendance_image_out';
|
||||||
$migrationList[] = 'v20170908_200000_payroll_group';
|
$migrationList[] = 'v20170908_200000_payroll_group';
|
||||||
$migrationList[] = 'v20170702_190500_add_attendance_image';
|
$migrationList[] = 'v20170702_190500_add_attendance_image';
|
||||||
$migrationList[] = 'v20170310_190401_add_timesheet_changes';
|
$migrationList[] = 'v20170310_190401_add_timesheet_changes';
|
||||||
|
|||||||
@@ -23,13 +23,6 @@ class v20170702_190500_add_attendance_image extends AbstractMigration{
|
|||||||
SQL;
|
SQL;
|
||||||
|
|
||||||
|
|
||||||
return $this->executeQuery($sql);
|
|
||||||
|
|
||||||
$sql = <<<'SQL'
|
|
||||||
Alter table Attendance add column `image_out` longtext default null;
|
|
||||||
SQL;
|
|
||||||
|
|
||||||
|
|
||||||
return $this->executeQuery($sql);
|
return $this->executeQuery($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,12 +33,6 @@ SQL;
|
|||||||
SQL;
|
SQL;
|
||||||
|
|
||||||
return $this->executeQuery($sql);
|
return $this->executeQuery($sql);
|
||||||
|
|
||||||
$sql = <<<'SQL'
|
|
||||||
Alter table Attendance drop column `image_out`;
|
|
||||||
SQL;
|
|
||||||
|
|
||||||
return $this->executeQuery($sql);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
22
migrations/v20170918_200000_add_attendance_image_out.php
Normal file
22
migrations/v20170918_200000_add_attendance_image_out.php
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
namespace Classes\Migration;
|
||||||
|
|
||||||
|
class v20170918_200000_add_attendance_image_out extends AbstractMigration{
|
||||||
|
|
||||||
|
public function up(){
|
||||||
|
|
||||||
|
$sql = <<<'SQL'
|
||||||
|
Alter table Attendance add column `image_out` longtext default null;
|
||||||
|
SQL;
|
||||||
|
return $this->executeQuery($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(){
|
||||||
|
$sql = <<<'SQL'
|
||||||
|
Alter table Attendance drop column `image_out`;
|
||||||
|
SQL;
|
||||||
|
|
||||||
|
return $this->executeQuery($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -2,13 +2,13 @@
|
|||||||
|
|
||||||
//Reset modules if required
|
//Reset modules if required
|
||||||
if (\Classes\SettingsManager::getInstance()->getSetting("System: Reset Modules and Permissions") == "1") {
|
if (\Classes\SettingsManager::getInstance()->getSetting("System: Reset Modules and Permissions") == "1") {
|
||||||
$permissionTemp = new Permission();
|
$permissionTemp = new \Permissions\Common\Model\Permission();
|
||||||
$permissions = $permissionTemp->Find("1=1");
|
$permissions = $permissionTemp->Find("1=1");
|
||||||
foreach ($permissions as $permTemp) {
|
foreach ($permissions as $permTemp) {
|
||||||
$permTemp->Delete();
|
$permTemp->Delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
$moduleTemp = new Module();
|
$moduleTemp = new \Modules\Common\Model\Module();
|
||||||
$modulesTemp = $moduleTemp->Find("1=1");
|
$modulesTemp = $moduleTemp->Find("1=1");
|
||||||
foreach ($modulesTemp as $moduleTemp) {
|
foreach ($modulesTemp as $moduleTemp) {
|
||||||
$moduleTemp->Delete();
|
$moduleTemp->Delete();
|
||||||
|
|||||||
18
release.md
18
release.md
@@ -1,3 +1,21 @@
|
|||||||
|
Release note v20.2
|
||||||
|
------------------
|
||||||
|
### Fixes
|
||||||
|
* Fix for resetting modules
|
||||||
|
|
||||||
|
Release note v20.1
|
||||||
|
------------------
|
||||||
|
### Features
|
||||||
|
* Compatible with MySQL 5.7 Strict Mode
|
||||||
|
* PSR-2 compatible code
|
||||||
|
* Employee History Module
|
||||||
|
* Staff Directory
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
* Fix: password reset not working
|
||||||
|
* Fix: limiting selectable countries via Settings
|
||||||
|
* Fix for resetting modules
|
||||||
|
|
||||||
Release note v20.0
|
Release note v20.0
|
||||||
------------------
|
------------------
|
||||||
### Features
|
### Features
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ class RoboFile extends \Robo\Tasks
|
|||||||
$this->includeCientConfig($client);
|
$this->includeCientConfig($client);
|
||||||
$this->say("DB Migrating " . $action . " for ". $client);
|
$this->say("DB Migrating " . $action . " for ". $client);
|
||||||
$migrationManager = new \Classes\Migration\MigrationManager();
|
$migrationManager = new \Classes\Migration\MigrationManager();
|
||||||
|
$migrationManager->setMigrationPath(APP_BASE_PATH .'/migrations/');
|
||||||
$res = $migrationManager->runMigration($action);
|
$res = $migrationManager->runMigration($action);
|
||||||
$this->say("DB Migrating Result : " . print_r($res, true));
|
$this->say("DB Migrating Result : " . print_r($res, true));
|
||||||
}
|
}
|
||||||
@@ -34,6 +35,7 @@ class RoboFile extends \Robo\Tasks
|
|||||||
$this->includeCientConfig($client);
|
$this->includeCientConfig($client);
|
||||||
$this->say("Run all pending migrations " . " for ". $client);
|
$this->say("Run all pending migrations " . " for ". $client);
|
||||||
$migrationManager = new \Classes\Migration\MigrationManager();
|
$migrationManager = new \Classes\Migration\MigrationManager();
|
||||||
|
$migrationManager->setMigrationPath(APP_BASE_PATH .'/migrations/');
|
||||||
$migrationManager->queueMigrations();
|
$migrationManager->queueMigrations();
|
||||||
$migrations = $migrationManager->getPendingMigrations();
|
$migrations = $migrationManager->getPendingMigrations();
|
||||||
foreach ($migrations as $migration) {
|
foreach ($migrations as $migration) {
|
||||||
|
|||||||
@@ -48,7 +48,9 @@ $notificationManager = new \Classes\NotificationManager();
|
|||||||
\Classes\BaseService::getInstance()->setNotificationManager($notificationManager);
|
\Classes\BaseService::getInstance()->setNotificationManager($notificationManager);
|
||||||
\Classes\BaseService::getInstance()->setSettingsManager($settingsManager);
|
\Classes\BaseService::getInstance()->setSettingsManager($settingsManager);
|
||||||
\Classes\BaseService::getInstance()->setCustomFieldManager(new \Classes\CustomFieldManager());
|
\Classes\BaseService::getInstance()->setCustomFieldManager(new \Classes\CustomFieldManager());
|
||||||
\Classes\BaseService::getInstance()->setMigrationManager(new \Classes\Migration\MigrationManager());
|
$migrationManager = new \Classes\Migration\MigrationManager();
|
||||||
|
$migrationManager->setMigrationPath(APP_BASE_PATH .'/migrations/');
|
||||||
|
\Classes\BaseService::getInstance()->setMigrationManager($migrationManager);
|
||||||
|
|
||||||
$notificationManager->setBaseService($baseService);
|
$notificationManager->setBaseService($baseService);
|
||||||
|
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ if($action == 'get'){
|
|||||||
exit;
|
exit;
|
||||||
|
|
||||||
}else if($action == 'rsp'){ // linked clicked from password change email
|
}else if($action == 'rsp'){ // linked clicked from password change email
|
||||||
$user = new User();
|
$user = new \Users\Common\Model\User();
|
||||||
if(!empty($_REQUEST['key'])){
|
if(!empty($_REQUEST['key'])){
|
||||||
$arr = explode("-", $_REQUEST['key']);
|
$arr = explode("-", $_REQUEST['key']);
|
||||||
$userId = $arr[0];
|
$userId = $arr[0];
|
||||||
|
|||||||
@@ -75,7 +75,8 @@ class AttendanceActionManager extends SubActionManager
|
|||||||
if (empty($attendance->out_time) || $attendance->out_time == "0000-00-00 00:00:00") {
|
if (empty($attendance->out_time) || $attendance->out_time == "0000-00-00 00:00:00") {
|
||||||
return new IceResponse(
|
return new IceResponse(
|
||||||
IceResponse::ERROR,
|
IceResponse::ERROR,
|
||||||
"There is a non closed attendance entry for today. Please mark punch-out time of the open entry before adding a new one"
|
"There is a non closed attendance entry for today.
|
||||||
|
Please mark punch-out time of the open entry before adding a new one"
|
||||||
);
|
);
|
||||||
} elseif (!empty($outDateTime)) {
|
} elseif (!empty($outDateTime)) {
|
||||||
if (strtotime($attendance->out_time) >= strtotime($outDateTime)
|
if (strtotime($attendance->out_time) >= strtotime($outDateTime)
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ use Model\BaseModel;
|
|||||||
|
|
||||||
class Attendance extends BaseModel
|
class Attendance extends BaseModel
|
||||||
{
|
{
|
||||||
var $_table = 'Attendance';
|
public $table = 'Attendance';
|
||||||
|
|
||||||
public function getAdminAccess()
|
public function getAdminAccess()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ use Model\BaseModel;
|
|||||||
|
|
||||||
class AttendanceStatus extends BaseModel
|
class AttendanceStatus extends BaseModel
|
||||||
{
|
{
|
||||||
var $_table = 'Attendance';
|
public $table = 'Attendance';
|
||||||
|
|
||||||
public function getRecentAttendanceEntries($limit)
|
public function getRecentAttendanceEntries($limit)
|
||||||
{
|
{
|
||||||
@@ -59,9 +59,10 @@ class AttendanceStatus extends BaseModel
|
|||||||
|
|
||||||
return array_values($employees);
|
return array_values($employees);
|
||||||
}
|
}
|
||||||
|
// @codingStandardsIgnoreStart
|
||||||
public function Find($whereOrderBy, $bindarr = false, $pkeysArr = false, $extra = array())
|
public function Find($whereOrderBy, $bindarr = false, $pkeysArr = false, $extra = array())
|
||||||
{
|
{
|
||||||
|
// @codingStandardsIgnoreEnd
|
||||||
$shift = intval(SettingsManager::getInstance()->getSetting("Attendance: Shift (Minutes)"));
|
$shift = intval(SettingsManager::getInstance()->getSetting("Attendance: Shift (Minutes)"));
|
||||||
$employee = new Employee();
|
$employee = new Employee();
|
||||||
$data = array();
|
$data = array();
|
||||||
|
|||||||
@@ -32,7 +32,8 @@ class AttendanceActionManager extends SubActionManager
|
|||||||
//Find any open punch
|
//Find any open punch
|
||||||
$attendance = new Attendance();
|
$attendance = new Attendance();
|
||||||
$attendance->Load(
|
$attendance->Load(
|
||||||
"employee = ? and DATE_FORMAT( in_time, '%Y-%m-%d' ) = ? and (out_time is NULL or out_time = '0000-00-00 00:00:00')",
|
"employee = ? and DATE_FORMAT( in_time, '%Y-%m-%d' ) = ?
|
||||||
|
and (out_time is NULL or out_time = '0000-00-00 00:00:00')",
|
||||||
array($employee->id,$date)
|
array($employee->id,$date)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -134,7 +135,7 @@ class AttendanceActionManager extends SubActionManager
|
|||||||
$this->baseService->audit(IceConstants::AUDIT_ACTION, "Punch Out \ time:".$openPunch->out_time);
|
$this->baseService->audit(IceConstants::AUDIT_ACTION, "Punch Out \ time:".$openPunch->out_time);
|
||||||
} else {
|
} else {
|
||||||
$openPunch->in_time = $dateTime;
|
$openPunch->in_time = $dateTime;
|
||||||
$openPunch->out_time = null;
|
$openPunch->out_time = '0000-00-00 00:00:00';
|
||||||
$openPunch->note = $req->note;
|
$openPunch->note = $req->note;
|
||||||
$openPunch->image_in = $req->image;
|
$openPunch->image_in = $req->image;
|
||||||
$openPunch->employee = $employee->id;
|
$openPunch->employee = $employee->id;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace Classes;
|
|||||||
abstract class AbstractInitialize
|
abstract class AbstractInitialize
|
||||||
{
|
{
|
||||||
/* @var \Classes\BaseService $baseService */
|
/* @var \Classes\BaseService $baseService */
|
||||||
var $baseService = null;
|
public $baseService = null;
|
||||||
public function setBaseService($baseService)
|
public function setBaseService($baseService)
|
||||||
{
|
{
|
||||||
$this->baseService = $baseService;
|
$this->baseService = $baseService;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
*The base class for module manager classes. ModuleManager classes which extend this class provide core backend functionality
|
*The base class for module manager classes. ModuleManager classes which extend this
|
||||||
|
* class provide core backend functionality
|
||||||
*to each module such as defining models, error handliing and other configuration details
|
*to each module such as defining models, error handliing and other configuration details
|
||||||
*@class AbstractModuleManager
|
*@class AbstractModuleManager
|
||||||
*/
|
*/
|
||||||
@@ -23,9 +24,12 @@ abstract class AbstractModuleManager
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Override this method in module manager class to define user classes.
|
* Override this method in module manager class to define user classes.
|
||||||
* A user class is a class that is mapped to a table having a field named profile. The profile field is mapped to the id of a Profile element.
|
* A user class is a class that is mapped to a table having a field named profile.
|
||||||
* When a user is saving this type of an object in db, profile field will be set to the id of the Profile of currently logged in or switched user.
|
* The profile field is mapped to the id of a Profile element.
|
||||||
* When a user is retriving this type of records, only the records having profile field set to currently logged in users profile id will be released.
|
* When a user is saving this type of an object in db, profile field will be set to the id of the
|
||||||
|
* Profile of currently logged in or switched user.
|
||||||
|
* When a user is retriving this type of records, only the records having profile field set to c
|
||||||
|
* urrently logged in users profile id will be released.
|
||||||
* @method initializeUserClasses
|
* @method initializeUserClasses
|
||||||
* @example
|
* @example
|
||||||
public function initializeUserClasses(){
|
public function initializeUserClasses(){
|
||||||
@@ -36,7 +40,8 @@ abstract class AbstractModuleManager
|
|||||||
abstract public function initializeUserClasses();
|
abstract public function initializeUserClasses();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Override this method in module manager class to define file field mappings. If you have a table field that stores a name of a file which need to be
|
* Override this method in module manager class to define file field mappings.
|
||||||
|
* If you have a table field that stores a name of a file which need to be
|
||||||
* deleted from the disk when the record is deleted a file field mapping should be added.
|
* deleted from the disk when the record is deleted a file field mapping should be added.
|
||||||
* @method initializeFieldMappings
|
* @method initializeFieldMappings
|
||||||
* @example
|
* @example
|
||||||
@@ -47,19 +52,22 @@ abstract class AbstractModuleManager
|
|||||||
abstract public function initializeFieldMappings();
|
abstract public function initializeFieldMappings();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Override this method in module manager class to define DB error mappings. Some actions to your model classes trigger database errors.
|
* Override this method in module manager class to define DB error mappings. Some actions to your
|
||||||
|
* model classes trigger database errors.
|
||||||
* These errors need to be translated to user friendly texts using DB error mappings
|
* These errors need to be translated to user friendly texts using DB error mappings
|
||||||
* @method initializeDatabaseErrorMappings
|
* @method initializeDatabaseErrorMappings
|
||||||
* @example
|
* @example
|
||||||
public function initializeDatabaseErrorMappings(){
|
public function initializeDatabaseErrorMappings(){
|
||||||
$this->addDatabaseErrorMapping('CONSTRAINT `Fk_User_Employee` FOREIGN KEY',"Can not delete Employee, please delete the User for this employee first.");
|
$this->addDatabaseErrorMapping('CONSTRAINT `Fk_User_Employee` FOREIGN KEY',"Can not delete Employee,
|
||||||
|
* please delete the User for this employee first.");
|
||||||
$this->addDatabaseErrorMapping("Duplicate entry|for key 'employee'","A duplicate entry found");
|
$this->addDatabaseErrorMapping("Duplicate entry|for key 'employee'","A duplicate entry found");
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
abstract public function initializeDatabaseErrorMappings();
|
abstract public function initializeDatabaseErrorMappings();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Override this method in module manager class to add model classes to this module. All the model classes defind for the module should be added here
|
* Override this method in module manager class to add model classes to this module.
|
||||||
|
* All the model classes defind for the module should be added here
|
||||||
* @method setupModuleClassDefinitions
|
* @method setupModuleClassDefinitions
|
||||||
* @example
|
* @example
|
||||||
public function setupModuleClassDefinitions(){
|
public function setupModuleClassDefinitions(){
|
||||||
@@ -133,7 +141,8 @@ abstract class AbstractModuleManager
|
|||||||
return $this->modulePath;
|
return $this->modulePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setModulePath($modulePath) {
|
public function setModulePath($modulePath)
|
||||||
|
{
|
||||||
$this->modulePath = $modulePath;
|
$this->modulePath = $modulePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -111,9 +111,7 @@ class ApprovalStatus
|
|||||||
|
|
||||||
public function updateApprovalStatus($type, $id, $currentEmployee, $status)
|
public function updateApprovalStatus($type, $id, $currentEmployee, $status)
|
||||||
{
|
{
|
||||||
LogManager::getInstance()->error('updateApprovalStatus 1');
|
|
||||||
if (!$this->approvalChainExists($type, $id)) {
|
if (!$this->approvalChainExists($type, $id)) {
|
||||||
LogManager::getInstance()->error('updateApprovalStatus 2');
|
|
||||||
return new IceResponse(IceResponse::SUCCESS, array(null, null));
|
return new IceResponse(IceResponse::SUCCESS, array(null, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,8 +134,6 @@ class ApprovalStatus
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LogManager::getInstance()->error('level '.$level);
|
|
||||||
|
|
||||||
$currentAL = null;
|
$currentAL = null;
|
||||||
if ($level > 0) {
|
if ($level > 0) {
|
||||||
$currentAL = new EmployeeApproval();
|
$currentAL = new EmployeeApproval();
|
||||||
@@ -149,7 +145,6 @@ class ApprovalStatus
|
|||||||
$nextAL = new EmployeeApproval();
|
$nextAL = new EmployeeApproval();
|
||||||
$nextAL->Load("type = ? and element = ? and level = ?", array($type, $id, intval($level)+1));
|
$nextAL->Load("type = ? and element = ? and level = ?", array($type, $id, intval($level)+1));
|
||||||
|
|
||||||
LogManager::getInstance()->error('next AL '.print_r($nextAL, true));
|
|
||||||
if (empty($nextAL->id)) {
|
if (empty($nextAL->id)) {
|
||||||
$nextAL = null;
|
$nextAL = null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,27 +51,27 @@ use Utils\SessionUtils;
|
|||||||
class BaseService
|
class BaseService
|
||||||
{
|
{
|
||||||
|
|
||||||
var $nonDeletables = array();
|
public $nonDeletables = array();
|
||||||
var $errros = array();
|
public $errros = array();
|
||||||
public $userTables = array();
|
public $userTables = array();
|
||||||
/* @var User $currentUser */
|
/* @var User $currentUser */
|
||||||
var $currentUser = null;
|
public $currentUser = null;
|
||||||
var $db = null;
|
public $db = null;
|
||||||
var $auditManager = null;
|
public $auditManager = null;
|
||||||
/* @var NotificationManager $notificationManager */
|
/* @var NotificationManager $notificationManager */
|
||||||
var $notificationManager = null;
|
public $notificationManager = null;
|
||||||
/* @var SettingsManager $settingsManager*/
|
/* @var SettingsManager $settingsManager*/
|
||||||
var $settingsManager = null;
|
public $settingsManager = null;
|
||||||
var $fileFields = null;
|
public $fileFields = null;
|
||||||
var $moduleManagers = null;
|
public $moduleManagers = null;
|
||||||
/* @var EmailSender $emailSender */
|
/* @var EmailSender $emailSender */
|
||||||
var $emailSender = null;
|
public $emailSender = null;
|
||||||
var $user = null;
|
public $user = null;
|
||||||
var $historyManagers = array();
|
public $historyManagers = array();
|
||||||
var $calculationHooks = array();
|
public $calculationHooks = array();
|
||||||
var $customFieldManager = null;
|
public $customFieldManager = null;
|
||||||
var $migrationManager = null;
|
public $migrationManager = null;
|
||||||
var $modelClassMap = array();
|
public $modelClassMap = array();
|
||||||
|
|
||||||
private static $me = null;
|
private static $me = null;
|
||||||
|
|
||||||
@@ -97,9 +97,16 @@ class BaseService
|
|||||||
/**
|
/**
|
||||||
* Get an array of objects from database
|
* Get an array of objects from database
|
||||||
* @method get
|
* @method get
|
||||||
* @param $table {String} model class name of the table to retive data (e.g for Users table model class name is User)
|
* @param $table {String} model class name of the table to retive data
|
||||||
* @param $mappingStr {String} a JSON string to specify fields of the $table should be mapped to other tables (e.g {"profile":["Profile","id","first_name+last_name"]} : this is how the profile field in Users table is mapped to Profile table. In this case users profile field will get filled by Profile first name and last name. The original value in User->profile field will get moved to User->profile_id)
|
* (e.g for Users table model class name is User)
|
||||||
* @param $filterStr {String} a JSON string to specify the ordering of the items (e.g {"job_title":"2","department":"2"} - this will select only items having job_title = 2 and department = 2)
|
* @param $mappingStr {String} a JSON string to specify fields of the $table should be mapped
|
||||||
|
* to other tables (e.g {"profile":["Profile","id","first_name+last_name"]} : this is how the
|
||||||
|
* profile field in Users table is mapped to Profile table. In this case users profile field
|
||||||
|
* will get filled by Profile first name and last name. The original value in User->profile
|
||||||
|
* field will get moved to User->profile_id)
|
||||||
|
* @param $filterStr {String} a JSON string to specify the ordering of the items
|
||||||
|
* (e.g {"job_title":"2","department":"2"} - this will select only items having
|
||||||
|
* job_title = 2 and department = 2)
|
||||||
* @param $orderBy {String} a string to specify the ordering (e.g in_time desc)
|
* @param $orderBy {String} a string to specify the ordering (e.g in_time desc)
|
||||||
* @param string $limit {String} a string to specify the limit (e.g limit 2)
|
* @param string $limit {String} a string to specify the limit (e.g limit 2)
|
||||||
* @return {Array} an array of objects of type $table
|
* @return {Array} an array of objects of type $table
|
||||||
@@ -238,19 +245,41 @@ class BaseService
|
|||||||
/**
|
/**
|
||||||
* An extention of get method for the use of data tables with ability to search
|
* An extention of get method for the use of data tables with ability to search
|
||||||
* @method getData
|
* @method getData
|
||||||
* @param $table {String} model class name of the table to retive data (e.g for Users table model class name is User)
|
* @param $table {String} model class name of the table to retive data
|
||||||
* @param $mappingStr {String} a JSON string to specify fields of the $table should be mapped to other tables (e.g {"profile":["Profile","id","first_name+last_name"]} : this is how the profile field in Users table is mapped to Profile table. In this case users profile field will get filled by Profile first name and last name. The original value in User->profile field will get moved to User->profile_id)
|
* (e.g for Users table model class name is User)
|
||||||
* @param $filterStr {String} a JSON string to specify the ordering of the items (e.g {"job_title":"2","department":"2"} - this will select only items having job_title = 2 and department = 2)
|
* @param $mappingStr {String} a JSON string to specify fields of the $table should
|
||||||
|
* be mapped to other tables (e.g {"profile":["Profile","id","first_name+last_name"]}
|
||||||
|
* : this is how the profile field in Users table is mapped to Profile table.
|
||||||
|
* In this case users profile field will get filled by Profile first name and last name.
|
||||||
|
* The original value in User->profile field will get moved to User->profile_id)
|
||||||
|
* @param $filterStr {String} a JSON string to specify the ordering of the items
|
||||||
|
* (e.g {"job_title":"2","department":"2"} - this will select only items having
|
||||||
|
* job_title = 2 and department = 2)
|
||||||
* @param $orderBy {String} a string to specify the ordering (e.g in_time desc)
|
* @param $orderBy {String} a string to specify the ordering (e.g in_time desc)
|
||||||
* @param string $limit {String} a string to specify the limit (e.g limit 2)
|
* @param string $limit {String} a string to specify the limit (e.g limit 2)
|
||||||
* @param string $searchColumns {String} a JSON string to specify names of searchable fields (e.g ["id","employee_id","first_name","last_name","mobile_phone","department","gender","supervisor"])
|
* @param string $searchColumns {String} a JSON string to specify names of searchable
|
||||||
|
* fields (e.g ["id","employee_id","first_name","last_name","mobile_phone","department","gender","supervisor"])
|
||||||
* @param string $searchTerm {String} a string to specify term to search
|
* @param string $searchTerm {String} a string to specify term to search
|
||||||
* @param string $isSubOrdinates {Boolean} a Boolean to specify if we only need to retive subordinates. Any item is a subordinate item if the item has "profile" field defined and the value of "profile" field is equal to id of one of the subordinates of currenly logged in profile id. (Any Profile is a subordinate of curently logged in Profile if the supervisor field of a Profile is set to the id of currently logged in Profile)
|
* @param string $isSubOrdinates {Boolean} a Boolean to specify if we only need to retive
|
||||||
|
* subordinates. Any item is a subordinate item if the item has "profile" field defined
|
||||||
|
* and the value of "profile" field is equal to id of one of the subordinates of currenly
|
||||||
|
* logged in profile id. (Any Profile is a subordinate of curently logged in Profile if the
|
||||||
|
* supervisor field of a Profile is set to the id of currently logged in Profile)
|
||||||
* @param string $skipProfileRestriction {Boolean} default if false - TODO - I'll explain this later
|
* @param string $skipProfileRestriction {Boolean} default if false - TODO - I'll explain this later
|
||||||
* @return {Array} an array of objects of type $table
|
* @return {Array} an array of objects of type $table
|
||||||
*/
|
*/
|
||||||
public function getData($table, $mappingStr = null, $filterStr = null, $orderBy = null, $limit = null, $searchColumns = null, $searchTerm = null, $isSubOrdinates = false, $skipProfileRestriction = false, $sortData = array())
|
public function getData(
|
||||||
{
|
$table,
|
||||||
|
$mappingStr = null,
|
||||||
|
$filterStr = null,
|
||||||
|
$orderBy = null,
|
||||||
|
$limit = null,
|
||||||
|
$searchColumns = null,
|
||||||
|
$searchTerm = null,
|
||||||
|
$isSubOrdinates = false,
|
||||||
|
$skipProfileRestriction = false,
|
||||||
|
$sortData = array()
|
||||||
|
) {
|
||||||
if (!empty($mappingStr)) {
|
if (!empty($mappingStr)) {
|
||||||
$map = json_decode($mappingStr);
|
$map = json_decode($mappingStr);
|
||||||
}
|
}
|
||||||
@@ -317,7 +346,9 @@ class BaseService
|
|||||||
array_unshift($queryData, $cemp);
|
array_unshift($queryData, $cemp);
|
||||||
//$signInMappingField = SIGN_IN_ELEMENT_MAPPING_FIELD_NAME;
|
//$signInMappingField = SIGN_IN_ELEMENT_MAPPING_FIELD_NAME;
|
||||||
$signInMappingField = $obj->getUserOnlyMeAccessField();
|
$signInMappingField = $obj->getUserOnlyMeAccessField();
|
||||||
LogManager::getInstance()->debug("Data Load Query (x1):"."1=1".$signInMappingField." = ?".$query.$orderBy.$limit);
|
LogManager::getInstance()->debug(
|
||||||
|
"Data Load Query (x1):"."1=1".$signInMappingField." = ?".$query.$orderBy.$limit
|
||||||
|
);
|
||||||
LogManager::getInstance()->debug("Data Load Query Data (x1):".json_encode($queryData));
|
LogManager::getInstance()->debug("Data Load Query Data (x1):".json_encode($queryData));
|
||||||
$list = $obj->Find($signInMappingField." = ?".$query.$orderBy.$limit, $queryData);
|
$list = $obj->Find($signInMappingField." = ?".$query.$orderBy.$limit, $queryData);
|
||||||
} else {
|
} else {
|
||||||
@@ -335,7 +366,10 @@ class BaseService
|
|||||||
}
|
}
|
||||||
|
|
||||||
$childCompaniesIds = array();
|
$childCompaniesIds = array();
|
||||||
if (SettingsManager::getInstance()->getSetting('System: Child Company Structure Managers Enabled') == '1') {
|
if (SettingsManager::getInstance()->getSetting(
|
||||||
|
'System: Child Company Structure Managers Enabled'
|
||||||
|
) == '1'
|
||||||
|
) {
|
||||||
$childCompaniesResp = CompanyStructure::getAllChildCompanyStructures($cempObj->department);
|
$childCompaniesResp = CompanyStructure::getAllChildCompanyStructures($cempObj->department);
|
||||||
$childCompanies = $childCompaniesResp->getObject();
|
$childCompanies = $childCompaniesResp->getObject();
|
||||||
|
|
||||||
@@ -347,7 +381,10 @@ class BaseService
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($childCompaniesIds)) {
|
if (!empty($childCompaniesIds)) {
|
||||||
$childStructureSubordinates = $subordinate->Find("department in (" . implode(',', $childCompaniesIds) . ") and id != ?", array($cemp));
|
$childStructureSubordinates = $subordinate->Find(
|
||||||
|
"department in (" . implode(',', $childCompaniesIds) . ") and id != ?",
|
||||||
|
array($cemp)
|
||||||
|
);
|
||||||
$subordinates = array_merge($subordinates, $childStructureSubordinates);
|
$subordinates = array_merge($subordinates, $childStructureSubordinates);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -361,7 +398,10 @@ class BaseService
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($obj->allowIndirectMapping()) {
|
if ($obj->allowIndirectMapping()) {
|
||||||
$indeirectEmployees = $subordinate->Find("indirect_supervisors IS NOT NULL and indirect_supervisors <> '' and status = 'Active'", array());
|
$indeirectEmployees = $subordinate->Find(
|
||||||
|
"indirect_supervisors IS NOT NULL and indirect_supervisors <> '' and status = 'Active'",
|
||||||
|
array()
|
||||||
|
);
|
||||||
foreach ($indeirectEmployees as $ie) {
|
foreach ($indeirectEmployees as $ie) {
|
||||||
$indirectSupervisors = json_decode($ie->indirect_supervisors, true);
|
$indirectSupervisors = json_decode($ie->indirect_supervisors, true);
|
||||||
if (in_array($cemp, $indirectSupervisors)) {
|
if (in_array($cemp, $indirectSupervisors)) {
|
||||||
@@ -374,10 +414,16 @@ class BaseService
|
|||||||
}
|
}
|
||||||
|
|
||||||
$signInMappingField = $obj->getUserOnlyMeAccessField();
|
$signInMappingField = $obj->getUserOnlyMeAccessField();
|
||||||
LogManager::getInstance()->debug("Data Load Query (x2):"."1=1".$signInMappingField." in (".$subordinatesIds.") ".$query.$orderBy.$limit);
|
LogManager::getInstance()->debug(
|
||||||
|
"Data Load Query (x2):"."1=1".$signInMappingField." in (".$subordinatesIds.") "
|
||||||
|
.$query.$orderBy.$limit
|
||||||
|
);
|
||||||
LogManager::getInstance()->debug("Data Load Query Data (x2):".json_encode($queryData));
|
LogManager::getInstance()->debug("Data Load Query Data (x2):".json_encode($queryData));
|
||||||
if (!empty($subordinatesIds)) {
|
if (!empty($subordinatesIds)) {
|
||||||
$list = $obj->Find($signInMappingField . " in (" . $subordinatesIds . ") " . $query . $orderBy . $limit, $queryData);
|
$list = $obj->Find(
|
||||||
|
$signInMappingField . " in (" . $subordinatesIds . ") " . $query . $orderBy . $limit,
|
||||||
|
$queryData
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$list = array();
|
$list = array();
|
||||||
}
|
}
|
||||||
@@ -401,7 +447,10 @@ class BaseService
|
|||||||
}
|
}
|
||||||
|
|
||||||
$childCompaniesIds = array();
|
$childCompaniesIds = array();
|
||||||
if (SettingsManager::getInstance()->getSetting('System: Child Company Structure Managers Enabled') == '1') {
|
if (SettingsManager::getInstance()->getSetting(
|
||||||
|
'System: Child Company Structure Managers Enabled'
|
||||||
|
) == '1'
|
||||||
|
) {
|
||||||
$childCompaniesResp = CompanyStructure::getAllChildCompanyStructures($cempObj->department);
|
$childCompaniesResp = CompanyStructure::getAllChildCompanyStructures($cempObj->department);
|
||||||
$childCompanies = $childCompaniesResp->getObject();
|
$childCompanies = $childCompaniesResp->getObject();
|
||||||
|
|
||||||
@@ -413,7 +462,10 @@ class BaseService
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($childCompaniesIds)) {
|
if (!empty($childCompaniesIds)) {
|
||||||
$childStructureSubordinates = $subordinate->Find("department in (" . implode(',', $childCompaniesIds) . ") and id != ?", array($cemp));
|
$childStructureSubordinates = $subordinate->Find(
|
||||||
|
"department in (" . implode(',', $childCompaniesIds) . ") and id != ?",
|
||||||
|
array($cemp)
|
||||||
|
);
|
||||||
$subordinates = array_merge($subordinates, $childStructureSubordinates);
|
$subordinates = array_merge($subordinates, $childStructureSubordinates);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -427,7 +479,10 @@ class BaseService
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($obj->allowIndirectMapping()) {
|
if ($obj->allowIndirectMapping()) {
|
||||||
$indeirectEmployees = $subordinate->Find("indirect_supervisors IS NOT NULL and indirect_supervisors <> '' and status = 'Active'", array());
|
$indeirectEmployees = $subordinate->Find(
|
||||||
|
"indirect_supervisors IS NOT NULL and indirect_supervisors <> '' and status = 'Active'",
|
||||||
|
array()
|
||||||
|
);
|
||||||
foreach ($indeirectEmployees as $ie) {
|
foreach ($indeirectEmployees as $ie) {
|
||||||
$indirectSupervisors = json_decode($ie->indirect_supervisors, true);
|
$indirectSupervisors = json_decode($ie->indirect_supervisors, true);
|
||||||
if (in_array($cemp, $indirectSupervisors)) {
|
if (in_array($cemp, $indirectSupervisors)) {
|
||||||
@@ -440,8 +495,13 @@ class BaseService
|
|||||||
}
|
}
|
||||||
|
|
||||||
$signInMappingField = $obj->getUserOnlyMeAccessField();
|
$signInMappingField = $obj->getUserOnlyMeAccessField();
|
||||||
LogManager::getInstance()->debug("Data Load Query (a1):".$signInMappingField." in (".$subordinatesIds.") ".$query.$orderBy.$limit);
|
LogManager::getInstance()->debug(
|
||||||
$list = $obj->Find($signInMappingField." in (".$subordinatesIds.") ".$query.$orderBy.$limit, $queryData);
|
"Data Load Query (a1):".$signInMappingField." in (".$subordinatesIds.") ".$query.$orderBy.$limit
|
||||||
|
);
|
||||||
|
$list = $obj->Find(
|
||||||
|
$signInMappingField." in (".$subordinatesIds.") ".$query.$orderBy.$limit,
|
||||||
|
$queryData
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$list = $obj->Find("1=1".$query.$orderBy.$limit, $queryData);
|
$list = $obj->Find("1=1".$query.$orderBy.$limit, $queryData);
|
||||||
}
|
}
|
||||||
@@ -527,7 +587,10 @@ class BaseService
|
|||||||
* @method getElement
|
* @method getElement
|
||||||
* @param $table {String} model class name of the table to get data (e.g for Users table model class name is User)
|
* @param $table {String} model class name of the table to get data (e.g for Users table model class name is User)
|
||||||
* @param $table {Integer} id of the item to get from $table
|
* @param $table {Integer} id of the item to get from $table
|
||||||
* @param $mappingStr {String} a JSON string to specify fields of the $table should be mapped to other tables (e.g {"profile":["Profile","id","first_name+last_name"]} : this is how the profile field in Users table is mapped to Profile table. In this case users profile field will get filled by Profile first name and last name. The original value in User->profile field will get moved to User->profile_id)
|
* @param $mappingStr {String} a JSON string to specify fields of the $table should be mapped to other
|
||||||
|
* tables (e.g {"profile":["Profile","id","first_name+last_name"]} : this is how the profile field in
|
||||||
|
* Users table is mapped to Profile table. In this case users profile field will get filled by Profile
|
||||||
|
* first name and last name. The original value in User->profile field will get moved to User->profile_id)
|
||||||
* @param $skipSecurityCheck {Boolean} if true won't check whether the user has access to that object
|
* @param $skipSecurityCheck {Boolean} if true won't check whether the user has access to that object
|
||||||
* @return {Object} an object of type $table
|
* @return {Object} an object of type $table
|
||||||
*/
|
*/
|
||||||
@@ -595,7 +658,8 @@ class BaseService
|
|||||||
* Add an element to a given table
|
* Add an element to a given table
|
||||||
* @method addElement
|
* @method addElement
|
||||||
* @param $table {String} model class name of the table to add data (e.g for Users table model class name is User)
|
* @param $table {String} model class name of the table to add data (e.g for Users table model class name is User)
|
||||||
* @param $obj {Array} an associative array with field names and values for the new object. If the object id is not empty an existing object will be updated
|
* @param $obj {Array} an associative array with field names and values for the new object.
|
||||||
|
* If the object id is not empty an existing object will be updated
|
||||||
* @return {Object} newly added or updated element of type $table
|
* @return {Object} newly added or updated element of type $table
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -716,7 +780,8 @@ class BaseService
|
|||||||
/**
|
/**
|
||||||
* Delete an element if not the $table and $id is defined as a non deletable
|
* Delete an element if not the $table and $id is defined as a non deletable
|
||||||
* @method deleteElement
|
* @method deleteElement
|
||||||
* @param $table {String} model class name of the table to delete data (e.g for Users table model class name is User)
|
* @param $table {String} model class name of the table to delete data
|
||||||
|
* (e.g for Users table model class name is User)
|
||||||
* @param $id {Integer} id of the item to delete
|
* @param $id {Integer} id of the item to delete
|
||||||
* @return NULL
|
* @return NULL
|
||||||
*/
|
*/
|
||||||
@@ -784,12 +849,16 @@ class BaseService
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get associative array of by retriving data from $table using $key field ans key and $value field as value. Mainly used for getting data for populating option lists of select boxes when adding and editing items
|
* Get associative array of by retriving data from $table using $key field ans key and
|
||||||
|
* $value field as value. Mainly used for getting data for populating option lists of select
|
||||||
|
* boxes when adding and editing items
|
||||||
* @method getFieldValues
|
* @method getFieldValues
|
||||||
* @param $table {String} model class name of the table to get data (e.g for Users table model class name is User)
|
* @param $table {String} model class name of the table to get data (e.g for Users table model class name is User)
|
||||||
* @param $key {String} key field name
|
* @param $key {String} key field name
|
||||||
* @param $value {String} value field name (multiple fileds cam be concatinated using +) - e.g first_name+last_name
|
* @param $value {String} value field name (multiple fileds cam be concatinated using +) - e.g first_name+last_name
|
||||||
* @param $method {String} if not empty, use this menthod to get only a selected set of objects from db instead of retriving all objects. This method should be defined in class $table and should return an array of objects of type $table
|
* @param $method {String} if not empty, use this menthod to get only a selected set of objects
|
||||||
|
* from db instead of retriving all objects. This method should be defined in class $table
|
||||||
|
* and should return an array of objects of type $table
|
||||||
* @return {Array} associative array
|
* @return {Array} associative array
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -898,7 +967,8 @@ class BaseService
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the Profile id attached to currently logged in user. if the user is switched, this will return the id of switched Profile instead of currently logged in users Prifile id
|
* Get the Profile id attached to currently logged in user. if the user is switched,
|
||||||
|
* this will return the id of switched Profile instead of currently logged in users Prifile id
|
||||||
* @method getCurrentProfileId
|
* @method getCurrentProfileId
|
||||||
* @return {Integer}
|
* @return {Integer}
|
||||||
*/
|
*/
|
||||||
@@ -1003,7 +1073,8 @@ class BaseService
|
|||||||
} else {
|
} else {
|
||||||
$accessMatrix = $object->getUserOnlyMeAccess();
|
$accessMatrix = $object->getUserOnlyMeAccess();
|
||||||
$signInMappingField = SIGN_IN_ELEMENT_MAPPING_FIELD_NAME;
|
$signInMappingField = SIGN_IN_ELEMENT_MAPPING_FIELD_NAME;
|
||||||
if (in_array($type, $accessMatrix) && $_REQUEST[$object->getUserOnlyMeAccessField()] == $this->currentUser->$signInMappingField) {
|
if (in_array($type, $accessMatrix) && $_REQUEST[$object->getUserOnlyMeAccessField()]
|
||||||
|
== $this->currentUser->$signInMappingField) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1022,7 +1093,8 @@ class BaseService
|
|||||||
} else {
|
} else {
|
||||||
$accessMatrix = $object->getUserOnlyMeAccess();
|
$accessMatrix = $object->getUserOnlyMeAccess();
|
||||||
$signInMappingField = SIGN_IN_ELEMENT_MAPPING_FIELD_NAME;
|
$signInMappingField = SIGN_IN_ELEMENT_MAPPING_FIELD_NAME;
|
||||||
if (in_array($type, $accessMatrix) && $_REQUEST[$object->getUserOnlyMeAccessField()] == $this->currentUser->$signInMappingField) {
|
if (in_array($type, $accessMatrix) && $_REQUEST[$object->getUserOnlyMeAccessField()]
|
||||||
|
== $this->currentUser->$signInMappingField) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1043,7 +1115,8 @@ class BaseService
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use user level security functions defined in model classes to check whether a given action type is allowed to be executed by the current user on a given object
|
* Use user level security functions defined in model classes to check whether a given action
|
||||||
|
* type is allowed to be executed by the current user on a given object
|
||||||
* @method checkSecureAccess
|
* @method checkSecureAccess
|
||||||
* @param $type {String} Action type
|
* @param $type {String} Action type
|
||||||
* @param $object {Object} object to test access
|
* @param $object {Object} object to test access
|
||||||
@@ -1077,8 +1150,10 @@ class BaseService
|
|||||||
$userOnlyMeAccessRequestField = $object->getUserOnlyMeAccessRequestField();
|
$userOnlyMeAccessRequestField = $object->getUserOnlyMeAccessRequestField();
|
||||||
|
|
||||||
//This will check whether user can access his own records using a value in request
|
//This will check whether user can access his own records using a value in request
|
||||||
if (isset($_REQUEST[$object->getUserOnlyMeAccessField()]) && isset($this->currentUser->$userOnlyMeAccessRequestField)) {
|
if (isset($_REQUEST[$object->getUserOnlyMeAccessField()])
|
||||||
if (in_array($type, $accessMatrix) && $_REQUEST[$object->getUserOnlyMeAccessField()] == $this->currentUser->$userOnlyMeAccessRequestField) {
|
&& isset($this->currentUser->$userOnlyMeAccessRequestField)) {
|
||||||
|
if (in_array($type, $accessMatrix) && $_REQUEST[$object->getUserOnlyMeAccessField()]
|
||||||
|
== $this->currentUser->$userOnlyMeAccessRequestField) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1188,7 +1263,11 @@ class BaseService
|
|||||||
|
|
||||||
//Check if user has permissions to this module
|
//Check if user has permissions to this module
|
||||||
//Check Module Permissions
|
//Check Module Permissions
|
||||||
$modulePermissions = BaseService::getInstance()->loadModulePermissions($moduleManagerObj->getModuleType(), $moduleObject['name'], BaseService::getInstance()->getCurrentUser()->user_level);
|
$modulePermissions = BaseService::getInstance()->loadModulePermissions(
|
||||||
|
$moduleManagerObj->getModuleType(),
|
||||||
|
$moduleObject['name'],
|
||||||
|
BaseService::getInstance()->getCurrentUser()->user_level
|
||||||
|
);
|
||||||
|
|
||||||
if (!in_array(BaseService::getInstance()->getCurrentUser()->user_level, $modulePermissions['user'])) {
|
if (!in_array(BaseService::getInstance()->getCurrentUser()->user_level, $modulePermissions['user'])) {
|
||||||
if (!empty(BaseService::getInstance()->getCurrentUser()->user_roles)) {
|
if (!empty(BaseService::getInstance()->getCurrentUser()->user_roles)) {
|
||||||
@@ -1216,7 +1295,11 @@ class BaseService
|
|||||||
|
|
||||||
//Check if user has permissions to this module
|
//Check if user has permissions to this module
|
||||||
//Check Module Permissions
|
//Check Module Permissions
|
||||||
$modulePermissions = BaseService::getInstance()->loadModulePermissions($moduleManagerObj->getModuleType(), $moduleObject['name'], $user->user_level);
|
$modulePermissions = BaseService::getInstance()->loadModulePermissions(
|
||||||
|
$moduleManagerObj->getModuleType(),
|
||||||
|
$moduleObject['name'],
|
||||||
|
$user->user_level
|
||||||
|
);
|
||||||
|
|
||||||
if (!in_array($user->user_level, $modulePermissions['user'])) {
|
if (!in_array($user->user_level, $modulePermissions['user'])) {
|
||||||
if (!empty($user->user_roles)) {
|
if (!empty($user->user_roles)) {
|
||||||
@@ -1478,7 +1561,8 @@ END;
|
|||||||
return $this->customFieldManager;
|
return $this->customFieldManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFullQualifiedModelClassName($class) {
|
public function getFullQualifiedModelClassName($class)
|
||||||
|
{
|
||||||
if ($this->modelClassMap[$class]) {
|
if ($this->modelClassMap[$class]) {
|
||||||
return $this->modelClassMap[$class];
|
return $this->modelClassMap[$class];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ namespace Classes\Cron;
|
|||||||
|
|
||||||
class CronUtils
|
class CronUtils
|
||||||
{
|
{
|
||||||
var $clientBasePath;
|
public $clientBasePath;
|
||||||
var $cronFile;
|
public $cronFile;
|
||||||
|
|
||||||
private static $me = null;
|
private static $me = null;
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,8 @@ abstract class EmailIceTask implements IceTask
|
|||||||
foreach ($emailList as $employeeId => $emailData) {
|
foreach ($emailList as $employeeId => $emailData) {
|
||||||
$ccList = array();
|
$ccList = array();
|
||||||
if (SettingsManager::getInstance()->getSetting(
|
if (SettingsManager::getInstance()->getSetting(
|
||||||
'Notifications: Copy Document Expiry Emails to Manager') == '1'
|
'Notifications: Copy Document Expiry Emails to Manager'
|
||||||
|
) == '1'
|
||||||
) {
|
) {
|
||||||
$employee = new Employee();
|
$employee = new Employee();
|
||||||
$employee->Load("id = ?", array($employeeId));
|
$employee->Load("id = ?", array($employeeId));
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ use Users\Common\Model\User;
|
|||||||
abstract class EmailSender
|
abstract class EmailSender
|
||||||
{
|
{
|
||||||
/* @var \Classes\SettingsManager $settings */
|
/* @var \Classes\SettingsManager $settings */
|
||||||
var $settings = null;
|
public $settings = null;
|
||||||
public function __construct($settings)
|
public function __construct($settings)
|
||||||
{
|
{
|
||||||
$this->settings = $settings;
|
$this->settings = $settings;
|
||||||
|
|||||||
@@ -19,7 +19,13 @@ class PHPMailer extends EmailSender
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected function sendMail(
|
protected function sendMail(
|
||||||
$subject, $body, $toEmail, $fromEmail, $replyToEmail = null, $ccList = array(), $bccList = array()
|
$subject,
|
||||||
|
$body,
|
||||||
|
$toEmail,
|
||||||
|
$fromEmail,
|
||||||
|
$replyToEmail = null,
|
||||||
|
$ccList = array(),
|
||||||
|
$bccList = array()
|
||||||
) {
|
) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -19,7 +19,13 @@ class SMTPEmailSender extends EmailSender
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected function sendMail(
|
protected function sendMail(
|
||||||
$subject, $body, $toEmail, $fromEmail, $replyToEmail = null, $ccList = array(), $bccList = array()
|
$subject,
|
||||||
|
$body,
|
||||||
|
$toEmail,
|
||||||
|
$fromEmail,
|
||||||
|
$replyToEmail = null,
|
||||||
|
$ccList = array(),
|
||||||
|
$bccList = array()
|
||||||
) {
|
) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ use Utils\LogManager;
|
|||||||
|
|
||||||
class SNSEmailSender extends EmailSender
|
class SNSEmailSender extends EmailSender
|
||||||
{
|
{
|
||||||
var $ses = null;
|
private $ses = null;
|
||||||
public function __construct($settings)
|
public function __construct($settings)
|
||||||
{
|
{
|
||||||
parent::__construct($settings);
|
parent::__construct($settings);
|
||||||
@@ -25,7 +25,13 @@ class SNSEmailSender extends EmailSender
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected function sendMail(
|
protected function sendMail(
|
||||||
$subject, $body, $toEmail, $fromEmail, $replyToEmail = null, $ccList = array(), $bccList = array()
|
$subject,
|
||||||
|
$body,
|
||||||
|
$toEmail,
|
||||||
|
$fromEmail,
|
||||||
|
$replyToEmail = null,
|
||||||
|
$ccList = array(),
|
||||||
|
$bccList = array()
|
||||||
) {
|
) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ class FileService
|
|||||||
//Resize image to 100
|
//Resize image to 100
|
||||||
|
|
||||||
$img = new \Classes\SimpleImage("/tmp/".$file->filename."_orig");
|
$img = new \Classes\SimpleImage("/tmp/".$file->filename."_orig");
|
||||||
$img->fit_to_width(100);
|
$img->fitToWidth(100);
|
||||||
$img->save("/tmp/".$file->filename);
|
$img->save("/tmp/".$file->filename);
|
||||||
|
|
||||||
$uploadFilesToS3Key = SettingsManager::getInstance()->getSetting(
|
$uploadFilesToS3Key = SettingsManager::getInstance()->getSetting(
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ class IceResponse
|
|||||||
const SUCCESS = "SUCCESS";
|
const SUCCESS = "SUCCESS";
|
||||||
const ERROR = "ERROR";
|
const ERROR = "ERROR";
|
||||||
|
|
||||||
var $status;
|
public $status;
|
||||||
var $data;
|
public $data;
|
||||||
var $code;
|
public $code;
|
||||||
|
|
||||||
public function __construct($status, $data = null, $code = null)
|
public function __construct($status, $data = null, $code = null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,18 +14,13 @@ use Utils\LogManager;
|
|||||||
class MigrationManager
|
class MigrationManager
|
||||||
{
|
{
|
||||||
|
|
||||||
private $migration_path;
|
private $migrationPath;
|
||||||
|
|
||||||
protected $db = null;
|
protected $db = null;
|
||||||
|
|
||||||
public function __construct()
|
public function setMigrationPath($migrationPath)
|
||||||
{
|
{
|
||||||
$this->migration_path = APP_BASE_PATH .'/migrations/';
|
$this->migrationPath = $migrationPath;
|
||||||
}
|
|
||||||
|
|
||||||
public function setMigrationPath($migration_path)
|
|
||||||
{
|
|
||||||
$this->migration_path = $migration_path;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getMigrationById($id)
|
public function getMigrationById($id)
|
||||||
@@ -63,10 +58,10 @@ class MigrationManager
|
|||||||
{
|
{
|
||||||
|
|
||||||
$migrations = array();
|
$migrations = array();
|
||||||
$ams = scandir($this->migration_path);
|
$ams = scandir($this->migrationPath);
|
||||||
foreach ($ams as $am) {
|
foreach ($ams as $am) {
|
||||||
if (is_file($this->migration_path . $am)) {
|
if (is_file($this->migrationPath . $am) && $am !== '.' && $am !== '..' && !empty($am)) {
|
||||||
$migrations[$am] = $this->migration_path . $am;
|
$migrations[$am] = $this->migrationPath . $am;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,6 +79,15 @@ class MigrationManager
|
|||||||
if ($file == 'list.php') {
|
if ($file == 'list.php') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
$this->createMigration($file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function createMigration($file)
|
||||||
|
{
|
||||||
|
if (file_exists($this->migrationPath . $file)) {
|
||||||
$migration = new Migration();
|
$migration = new Migration();
|
||||||
$migration->file = $file;
|
$migration->file = $file;
|
||||||
$parts = explode("_", $file);
|
$parts = explode("_", $file);
|
||||||
@@ -92,9 +96,9 @@ class MigrationManager
|
|||||||
$migration->updated = date("Y-m-d H:i:s");
|
$migration->updated = date("Y-m-d H:i:s");
|
||||||
$migration->status = 'Pending';
|
$migration->status = 'Pending';
|
||||||
$migration->Save();
|
$migration->Save();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
return false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function runPendingMigrations()
|
public function runPendingMigrations()
|
||||||
@@ -134,6 +138,27 @@ class MigrationManager
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $migrationFileName
|
||||||
|
* @return AbstractMigration
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function getMigrationObject($migrationFileName)
|
||||||
|
{
|
||||||
|
$path = $this->migrationPath . $migrationFileName;
|
||||||
|
$migrationName = str_replace('.php', '', $migrationFileName);
|
||||||
|
$migrationName = '\\Classes\\Migration\\'.$migrationName;
|
||||||
|
|
||||||
|
if (!class_exists($migrationName)) {
|
||||||
|
include $path;
|
||||||
|
}
|
||||||
|
if (!class_exists($migrationName)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
/* @var AbstractMigration $migClass */
|
||||||
|
return new $migrationName($migrationFileName);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Migration $migration
|
* @param Migration $migration
|
||||||
* @return bool
|
* @return bool
|
||||||
@@ -144,20 +169,14 @@ class MigrationManager
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$path = $this->migration_path . $migration->file;
|
/* @var AbstractMigration $migObject */
|
||||||
if (!file_exists($path)) {
|
$migObject = $this->getMigrationObject($migration->file);
|
||||||
|
if (!$migObject) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$migrationName = str_replace('.php', '', $migration->file);
|
$res = $migObject->up();
|
||||||
if (!class_exists('\\Classes\\Migration\\'.$migrationName)) {
|
|
||||||
include $path;
|
|
||||||
}
|
|
||||||
/* @var AbstractMigration $migClass */
|
|
||||||
$migrationName = '\\Classes\\Migration\\'.$migrationName;
|
|
||||||
$migClass = new $migrationName($migration->file);
|
|
||||||
$res = $migClass->up();
|
|
||||||
if (!$res) {
|
if (!$res) {
|
||||||
$migration->last_error = $migClass->getLastError();
|
$migration->last_error = $migObject->getLastError();
|
||||||
$migration->status = "UpError";
|
$migration->status = "UpError";
|
||||||
$migration->updated = date("Y-m-d H:i:s");
|
$migration->updated = date("Y-m-d H:i:s");
|
||||||
$migration->Save();
|
$migration->Save();
|
||||||
@@ -179,21 +198,14 @@ class MigrationManager
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$path = $this->migration_path . $migration->file;
|
/* @var AbstractMigration $migObject */
|
||||||
if (!file_exists($path)) {
|
$migObject = $this->getMigrationObject($migration->file);
|
||||||
|
if (!$migObject) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
$res = $migObject->down();
|
||||||
$migrationName = str_replace('.php', '', $migration->file);
|
|
||||||
if (!class_exists($migrationName)) {
|
|
||||||
include $path;
|
|
||||||
}
|
|
||||||
/* @var AbstractMigration $migClass */
|
|
||||||
$migrationName = '\\Classes\\Migration\\'.$migrationName;
|
|
||||||
$migClass = new $migrationName($migration->file);
|
|
||||||
$res = $migClass->down();
|
|
||||||
if (!$res) {
|
if (!$res) {
|
||||||
$migration->last_error = $migClass->getLastError();
|
$migration->last_error = $migObject->getLastError();
|
||||||
$migration->status = "DownError";
|
$migration->status = "DownError";
|
||||||
$migration->updated = date("Y-m-d H:i:s");
|
$migration->updated = date("Y-m-d H:i:s");
|
||||||
$migration->Save();
|
$migration->Save();
|
||||||
@@ -211,7 +223,7 @@ class MigrationManager
|
|||||||
$migration = new Migration();
|
$migration = new Migration();
|
||||||
$migration->Load("1 = 1 order by id desc limit 1");
|
$migration->Load("1 = 1 order by id desc limit 1");
|
||||||
|
|
||||||
include $this->migration_path . "list.php";
|
include $this->migrationPath . "list.php";
|
||||||
/* @var array $migrationList */
|
/* @var array $migrationList */
|
||||||
if (count($migrationList) > 0 && (empty($migration->id) || $migrationList[0].".php" != $migration->file)) {
|
if (count($migrationList) > 0 && (empty($migration->id) || $migrationList[0].".php" != $migration->file)) {
|
||||||
LogManager::getInstance()->info("ensureMigrations - execute migrations");
|
LogManager::getInstance()->info("ensureMigrations - execute migrations");
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ namespace Classes\ModuleBuilder;
|
|||||||
|
|
||||||
class ModuleBuilder
|
class ModuleBuilder
|
||||||
{
|
{
|
||||||
var $modules = array();
|
public $modules = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ModuleTab $module
|
* @param ModuleTab $module
|
||||||
|
|||||||
@@ -11,17 +11,24 @@ namespace Classes\ModuleBuilder;
|
|||||||
class ModuleTab
|
class ModuleTab
|
||||||
{
|
{
|
||||||
public $name;
|
public $name;
|
||||||
var $class;
|
public $class;
|
||||||
var $label;
|
public $label;
|
||||||
var $adapterName;
|
public $adapterName;
|
||||||
var $filter;
|
public $filter;
|
||||||
var $orderBy;
|
public $orderBy;
|
||||||
public $isActive = false;
|
public $isActive = false;
|
||||||
public $isInsideGroup = false;
|
public $isInsideGroup = false;
|
||||||
var $options = array();
|
public $options = array();
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
$name, $class, $label, $adapterName, $filter, $orderBy, $isActive = false, $options = array()
|
$name,
|
||||||
|
$class,
|
||||||
|
$label,
|
||||||
|
$adapterName,
|
||||||
|
$filter,
|
||||||
|
$orderBy,
|
||||||
|
$isActive = false,
|
||||||
|
$options = array()
|
||||||
) {
|
) {
|
||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
$this->class = $class;
|
$this->class = $class;
|
||||||
@@ -50,7 +57,8 @@ class ModuleTab
|
|||||||
$active = ($this->isActive)?" active":"";
|
$active = ($this->isActive)?" active":"";
|
||||||
$html = '<div class="tab-pane'.$active.'" id="tabPage'.$this->name.'">'.
|
$html = '<div class="tab-pane'.$active.'" id="tabPage'.$this->name.'">'.
|
||||||
'<div id="'.$this->name.'" class="reviewBlock" data-content="List" style="padding-left:5px;"></div>'.
|
'<div id="'.$this->name.'" class="reviewBlock" data-content="List" style="padding-left:5px;"></div>'.
|
||||||
'<div id="'.$this->name.'Form" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;"></div>'.
|
'<div id="'.$this->name.
|
||||||
|
'Form" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;"></div>'.
|
||||||
'</div>';
|
'</div>';
|
||||||
|
|
||||||
return $html;
|
return $html;
|
||||||
@@ -60,9 +68,12 @@ class ModuleTab
|
|||||||
{
|
{
|
||||||
$js = '';
|
$js = '';
|
||||||
if (empty($this->filter)) {
|
if (empty($this->filter)) {
|
||||||
$js.= "modJsList['tab" . $this->name . "'] = new " . $this->adapterName . "('" . $this->class . "','" . $this->name . "','','".$this->orderBy."');";
|
$js.= "modJsList['tab" . $this->name . "'] = new " .
|
||||||
|
$this->adapterName . "('" . $this->class . "','" . $this->name . "','','".$this->orderBy."');";
|
||||||
} else {
|
} else {
|
||||||
$js.= "modJsList['tab" . $this->name . "'] = new " . $this->adapterName . "('" . $this->class . "','" . $this->name . "'," . $this->filter . ",'".$this->orderBy."');";
|
$js.= "modJsList['tab" . $this->name . "'] = new " .
|
||||||
|
$this->adapterName . "('" . $this->class . "','" . $this->name . "'," .
|
||||||
|
$this->filter . ",'".$this->orderBy."');";
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($this->options as $key => $val) {
|
foreach ($this->options as $key => $val) {
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ namespace Classes\ModuleBuilder;
|
|||||||
|
|
||||||
class ModuleTabGroup
|
class ModuleTabGroup
|
||||||
{
|
{
|
||||||
var $name;
|
public $name;
|
||||||
var $label;
|
public $label;
|
||||||
var $isActive = false;
|
public $isActive = false;
|
||||||
public $modules = array();
|
public $modules = array();
|
||||||
|
|
||||||
public function __construct($name, $label)
|
public function __construct($name, $label)
|
||||||
@@ -37,7 +37,9 @@ class ModuleTabGroup
|
|||||||
$active = ($this->isActive)?" active":"";
|
$active = ($this->isActive)?" active":"";
|
||||||
|
|
||||||
$html.= '<li class="dropdown'.$active.'">'."\r\n".
|
$html.= '<li class="dropdown'.$active.'">'."\r\n".
|
||||||
'<a href="#" id="'.$this->name.'" class="dropdown-toggle" data-toggle="dropdown" aria-controls="'.$this->name.'-contents">'.$this->label.' <span class="caret"></span></a>'."\r\n".
|
'<a href="#" id="'.$this->name.
|
||||||
|
'" class="dropdown-toggle" data-toggle="dropdown" aria-controls="'.$this->name.
|
||||||
|
'-contents">'.$this->label.' <span class="caret"></span></a>'."\r\n".
|
||||||
'<ul class="dropdown-menu" role="menu" aria-labelledby="'.$this->name.'" id="'.$this->name.'-contents">';
|
'<ul class="dropdown-menu" role="menu" aria-labelledby="'.$this->name.'" id="'.$this->name.'-contents">';
|
||||||
|
|
||||||
foreach ($this->modules as $module) {
|
foreach ($this->modules as $module) {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ use Users\Common\Model\User;
|
|||||||
class NotificationManager
|
class NotificationManager
|
||||||
{
|
{
|
||||||
/* @var \Classes\BaseService $baseService */
|
/* @var \Classes\BaseService $baseService */
|
||||||
var $baseService;
|
public $baseService;
|
||||||
|
|
||||||
public function setBaseService($baseService)
|
public function setBaseService($baseService)
|
||||||
{
|
{
|
||||||
@@ -15,8 +15,15 @@ class NotificationManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function addNotification(
|
public function addNotification(
|
||||||
$toEmployee, $message, $action, $type, $toUserId = null, $fromSystem = false, $sendEmail = false)
|
$toEmployee,
|
||||||
{
|
$message,
|
||||||
|
$action,
|
||||||
|
$type,
|
||||||
|
$toUserId = null,
|
||||||
|
$fromSystem = false,
|
||||||
|
$sendEmail = false
|
||||||
|
) {
|
||||||
|
|
||||||
|
|
||||||
$userEmp = new User();
|
$userEmp = new User();
|
||||||
$toUser = null;
|
$toUser = null;
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class RestApiManager
|
|||||||
|
|
||||||
private static $me = null;
|
private static $me = null;
|
||||||
|
|
||||||
var $endPoints = array();
|
protected $endPoints = array();
|
||||||
|
|
||||||
private function __construct()
|
private function __construct()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -98,10 +98,14 @@ class RestEndPoint
|
|||||||
$headers = trim($_SERVER["HTTP_AUTHORIZATION"]);
|
$headers = trim($_SERVER["HTTP_AUTHORIZATION"]);
|
||||||
} elseif (function_exists('apache_request_headers')) {
|
} elseif (function_exists('apache_request_headers')) {
|
||||||
$requestHeaders = apache_request_headers();
|
$requestHeaders = apache_request_headers();
|
||||||
// Server-side fix for bug in old Android versions (a nice side-effect of this fix means we don't care about capitalization for Authorization)
|
// Server-side fix for bug in old Android versions
|
||||||
|
// (a nice side-effect of this fix means we don't care about capitalization
|
||||||
|
// for Authorization)
|
||||||
$requestHeaders = array_combine(
|
$requestHeaders = array_combine(
|
||||||
array_map('ucwords',
|
array_map(
|
||||||
array_keys($requestHeaders)),
|
'ucwords',
|
||||||
|
array_keys($requestHeaders)
|
||||||
|
),
|
||||||
array_values($requestHeaders)
|
array_values($requestHeaders)
|
||||||
);
|
);
|
||||||
//print_r($requestHeaders);
|
//print_r($requestHeaders);
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ use Utils\LogManager;
|
|||||||
class S3FileSystem
|
class S3FileSystem
|
||||||
{
|
{
|
||||||
|
|
||||||
var $s3;
|
protected $s3;
|
||||||
var $key;
|
protected $key;
|
||||||
var $secret;
|
protected $secret;
|
||||||
|
|
||||||
public function __construct($key, $secret)
|
public function __construct($key, $secret)
|
||||||
{
|
{
|
||||||
@@ -89,7 +89,7 @@ class S3FileSystem
|
|||||||
$signsz = implode("\n", $pieces = array('GET', null, null, $expiresTimestamp, $signpath));
|
$signsz = implode("\n", $pieces = array('GET', null, null, $expiresTimestamp, $signpath));
|
||||||
|
|
||||||
// Calculate the hash
|
// Calculate the hash
|
||||||
$signature = $this->el_crypto_hmacSHA1($this->secret, $signsz);
|
$signature = $this->elCryptoHmacSHA1($this->secret, $signsz);
|
||||||
// ... to the query string ...
|
// ... to the query string ...
|
||||||
$qs = http_build_query($pieces = array(
|
$qs = http_build_query($pieces = array(
|
||||||
'AWSAccessKeyId' => $this->key,
|
'AWSAccessKeyId' => $this->key,
|
||||||
@@ -100,7 +100,7 @@ class S3FileSystem
|
|||||||
return $url.'?'.$qs;
|
return $url.'?'.$qs;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function el_crypto_hmacSHA1($key, $data, $blocksize = 64)
|
private function elCryptoHmacSHA1($key, $data, $blocksize = 64)
|
||||||
{
|
{
|
||||||
if (strlen($key) > $blocksize) {
|
if (strlen($key) > $blocksize) {
|
||||||
$key = pack('H*', sha1($key));
|
$key = pack('H*', sha1($key));
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
* @package SimpleImage class
|
* @package SimpleImage class
|
||||||
* @version 2.5.5
|
* @version 2.5.5
|
||||||
* @author Cory LaViska for A Beautiful Site, LLC (http://www.abeautifulsite.net/)
|
* @author Cory LaViska for A Beautiful Site, LLC (http://www.abeautifulsite.net/)
|
||||||
* @author Nazar Mokrynskyi <nazar@mokrynskyi.com> - merging of forks, namespace support, PhpDoc editing, adaptive_resize() method, other fixes
|
|
||||||
* @license This software is licensed under the MIT license: http://opensource.org/licenses/MIT
|
* @license This software is licensed under the MIT license: http://opensource.org/licenses/MIT
|
||||||
* @copyright A Beautiful Site, LLC
|
* @copyright A Beautiful Site, LLC
|
||||||
*
|
*
|
||||||
@@ -28,7 +27,12 @@ class SimpleImage
|
|||||||
*/
|
*/
|
||||||
public $quality = 80;
|
public $quality = 80;
|
||||||
|
|
||||||
protected $image, $filename, $original_info, $width, $height, $imagestring;
|
protected $image;
|
||||||
|
protected $filename;
|
||||||
|
protected $original_info;
|
||||||
|
protected $width;
|
||||||
|
protected $height;
|
||||||
|
protected $imagestring;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create instance and load an image, or create an image from scratch
|
* Create instance and load an image, or create an image from scratch
|
||||||
@@ -44,7 +48,7 @@ class SimpleImage
|
|||||||
* @throws Exception
|
* @throws Exception
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function __construct($filename = null, $width = null, $height = null, $color = null)
|
public function __construct($filename = null, $width = null, $height = null, $color = null)
|
||||||
{
|
{
|
||||||
if ($filename) {
|
if ($filename) {
|
||||||
$this->load($filename);
|
$this->load($filename);
|
||||||
@@ -58,7 +62,7 @@ class SimpleImage
|
|||||||
* Destroy image resource
|
* Destroy image resource
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function __destruct()
|
public function __destruct()
|
||||||
{
|
{
|
||||||
if (get_resource_type($this->image) === 'gd') {
|
if (get_resource_type($this->image) === 'gd') {
|
||||||
imagedestroy($this->image);
|
imagedestroy($this->image);
|
||||||
@@ -78,7 +82,7 @@ class SimpleImage
|
|||||||
* @return SimpleImage
|
* @return SimpleImage
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function adaptive_resize($width, $height = null)
|
public function adaptiveResize($width, $height = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
return $this->thumbnail($width, $height);
|
return $this->thumbnail($width, $height);
|
||||||
@@ -90,7 +94,7 @@ class SimpleImage
|
|||||||
* @return SimpleImage
|
* @return SimpleImage
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function auto_orient()
|
public function autoOrient()
|
||||||
{
|
{
|
||||||
|
|
||||||
switch ($this->original_info['exif']['Orientation']) {
|
switch ($this->original_info['exif']['Orientation']) {
|
||||||
@@ -143,7 +147,7 @@ class SimpleImage
|
|||||||
* @return SimpleImage
|
* @return SimpleImage
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function best_fit($max_width, $max_height)
|
public function bestFit($max_width, $max_height)
|
||||||
{
|
{
|
||||||
|
|
||||||
// If it already fits, there's nothing to do
|
// If it already fits, there's nothing to do
|
||||||
@@ -181,7 +185,7 @@ class SimpleImage
|
|||||||
* @return SimpleImage
|
* @return SimpleImage
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function blur($type = 'selective', $passes = 1)
|
public function blur($type = 'selective', $passes = 1)
|
||||||
{
|
{
|
||||||
switch (strtolower($type)) {
|
switch (strtolower($type)) {
|
||||||
case 'gaussian':
|
case 'gaussian':
|
||||||
@@ -205,9 +209,9 @@ class SimpleImage
|
|||||||
* @return SimpleImage
|
* @return SimpleImage
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function brightness($level)
|
public function brightness($level)
|
||||||
{
|
{
|
||||||
imagefilter($this->image, IMG_FILTER_BRIGHTNESS, $this->keep_within($level, -255, 255));
|
imagefilter($this->image, IMG_FILTER_BRIGHTNESS, $this->keepWithin($level, -255, 255));
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -220,9 +224,9 @@ class SimpleImage
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function contrast($level)
|
public function contrast($level)
|
||||||
{
|
{
|
||||||
imagefilter($this->image, IMG_FILTER_CONTRAST, $this->keep_within($level, -100, 100));
|
imagefilter($this->image, IMG_FILTER_CONTRAST, $this->keepWithin($level, -100, 100));
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -236,11 +240,18 @@ class SimpleImage
|
|||||||
* @return SimpleImage
|
* @return SimpleImage
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function colorize($color, $opacity)
|
public function colorize($color, $opacity)
|
||||||
{
|
{
|
||||||
$rgba = $this->normalize_color($color);
|
$rgba = $this->normalizeColor($color);
|
||||||
$alpha = $this->keep_within(127 - (127 * $opacity), 0, 127);
|
$alpha = $this->keepWithin(127 - (127 * $opacity), 0, 127);
|
||||||
imagefilter($this->image, IMG_FILTER_COLORIZE, $this->keep_within($rgba['r'], 0, 255), $this->keep_within($rgba['g'], 0, 255), $this->keep_within($rgba['b'], 0, 255), $alpha);
|
imagefilter(
|
||||||
|
$this->image,
|
||||||
|
IMG_FILTER_COLORIZE,
|
||||||
|
$this->keepWithin($rgba['r'], 0, 255),
|
||||||
|
$this->keepWithin($rgba['g'], 0, 255),
|
||||||
|
$this->keepWithin($rgba['b'], 0, 255),
|
||||||
|
$alpha
|
||||||
|
);
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -255,7 +266,7 @@ class SimpleImage
|
|||||||
* @return SimpleImage
|
* @return SimpleImage
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function create($width, $height = null, $color = null)
|
public function create($width, $height = null, $color = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
$height = $height ?: $width;
|
$height = $height ?: $width;
|
||||||
@@ -265,7 +276,7 @@ class SimpleImage
|
|||||||
$this->original_info = array(
|
$this->original_info = array(
|
||||||
'width' => $width,
|
'width' => $width,
|
||||||
'height' => $height,
|
'height' => $height,
|
||||||
'orientation' => $this->get_orientation(),
|
'orientation' => $this->getOrientation(),
|
||||||
'exif' => null,
|
'exif' => null,
|
||||||
'format' => 'png',
|
'format' => 'png',
|
||||||
'mime' => 'image/png'
|
'mime' => 'image/png'
|
||||||
@@ -289,7 +300,7 @@ class SimpleImage
|
|||||||
* @return SimpleImage
|
* @return SimpleImage
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function crop($x1, $y1, $x2, $y2)
|
public function crop($x1, $y1, $x2, $y2)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Determine crop size
|
// Determine crop size
|
||||||
@@ -324,11 +335,11 @@ class SimpleImage
|
|||||||
* @return SimpleImage
|
* @return SimpleImage
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function desaturate($percentage = 100)
|
public function desaturate($percentage = 100)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Determine percentage
|
// Determine percentage
|
||||||
$percentage = $this->keep_within($percentage, 0, 100);
|
$percentage = $this->keepWithin($percentage, 0, 100);
|
||||||
|
|
||||||
if ($percentage === 100) {
|
if ($percentage === 100) {
|
||||||
imagefilter($this->image, IMG_FILTER_GRAYSCALE);
|
imagefilter($this->image, IMG_FILTER_GRAYSCALE);
|
||||||
@@ -341,7 +352,7 @@ class SimpleImage
|
|||||||
imagefilter($new, IMG_FILTER_GRAYSCALE);
|
imagefilter($new, IMG_FILTER_GRAYSCALE);
|
||||||
|
|
||||||
// Merge with specified percentage
|
// Merge with specified percentage
|
||||||
$this->imagecopymerge_alpha($this->image, $new, 0, 0, 0, 0, $this->width, $this->height, $percentage);
|
$this->imagecopymergeAlpha($this->image, $new, 0, 0, 0, 0, $this->width, $this->height, $percentage);
|
||||||
imagedestroy($new);
|
imagedestroy($new);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -354,7 +365,7 @@ class SimpleImage
|
|||||||
* @return SimpleImage
|
* @return SimpleImage
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function edges()
|
public function edges()
|
||||||
{
|
{
|
||||||
imagefilter($this->image, IMG_FILTER_EDGEDETECT);
|
imagefilter($this->image, IMG_FILTER_EDGEDETECT);
|
||||||
return $this;
|
return $this;
|
||||||
@@ -366,7 +377,7 @@ class SimpleImage
|
|||||||
* @return SimpleImage
|
* @return SimpleImage
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function emboss()
|
public function emboss()
|
||||||
{
|
{
|
||||||
imagefilter($this->image, IMG_FILTER_EMBOSS);
|
imagefilter($this->image, IMG_FILTER_EMBOSS);
|
||||||
return $this;
|
return $this;
|
||||||
@@ -381,10 +392,10 @@ class SimpleImage
|
|||||||
* @return SimpleImage
|
* @return SimpleImage
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function fill($color = '#000000')
|
public function fill($color = '#000000')
|
||||||
{
|
{
|
||||||
|
|
||||||
$rgba = $this->normalize_color($color);
|
$rgba = $this->normalizeColor($color);
|
||||||
$fill_color = imagecolorallocatealpha($this->image, $rgba['r'], $rgba['g'], $rgba['b'], $rgba['a']);
|
$fill_color = imagecolorallocatealpha($this->image, $rgba['r'], $rgba['g'], $rgba['b'], $rgba['a']);
|
||||||
imagealphablending($this->image, false);
|
imagealphablending($this->image, false);
|
||||||
imagesavealpha($this->image, true);
|
imagesavealpha($this->image, true);
|
||||||
@@ -401,7 +412,7 @@ class SimpleImage
|
|||||||
* @return SimpleImage
|
* @return SimpleImage
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function fit_to_height($height)
|
public function fitToHeight($height)
|
||||||
{
|
{
|
||||||
|
|
||||||
$aspect_ratio = $this->height / $this->width;
|
$aspect_ratio = $this->height / $this->width;
|
||||||
@@ -418,7 +429,7 @@ class SimpleImage
|
|||||||
* @return SimpleImage
|
* @return SimpleImage
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function fit_to_width($width)
|
public function fitToWidth($width)
|
||||||
{
|
{
|
||||||
|
|
||||||
$aspect_ratio = $this->height / $this->width;
|
$aspect_ratio = $this->height / $this->width;
|
||||||
@@ -435,7 +446,7 @@ class SimpleImage
|
|||||||
* @return SimpleImage
|
* @return SimpleImage
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function flip($direction)
|
public function flip($direction)
|
||||||
{
|
{
|
||||||
|
|
||||||
$new = imagecreatetruecolor($this->width, $this->height);
|
$new = imagecreatetruecolor($this->width, $this->height);
|
||||||
@@ -466,7 +477,7 @@ class SimpleImage
|
|||||||
* @return int
|
* @return int
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function get_height()
|
public function getHeight()
|
||||||
{
|
{
|
||||||
return $this->height;
|
return $this->height;
|
||||||
}
|
}
|
||||||
@@ -477,7 +488,7 @@ class SimpleImage
|
|||||||
* @return string portrait|landscape|square
|
* @return string portrait|landscape|square
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function get_orientation()
|
public function getOrientation()
|
||||||
{
|
{
|
||||||
|
|
||||||
if (imagesx($this->image) > imagesy($this->image)) {
|
if (imagesx($this->image) > imagesy($this->image)) {
|
||||||
@@ -504,7 +515,7 @@ class SimpleImage
|
|||||||
* )</pre>
|
* )</pre>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function get_original_info()
|
public function getOriginalInfo()
|
||||||
{
|
{
|
||||||
return $this->original_info;
|
return $this->original_info;
|
||||||
}
|
}
|
||||||
@@ -515,7 +526,7 @@ class SimpleImage
|
|||||||
* @return int
|
* @return int
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function get_width()
|
public function getWidth()
|
||||||
{
|
{
|
||||||
return $this->width;
|
return $this->width;
|
||||||
}
|
}
|
||||||
@@ -526,7 +537,7 @@ class SimpleImage
|
|||||||
* @return SimpleImage
|
* @return SimpleImage
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function invert()
|
public function invert()
|
||||||
{
|
{
|
||||||
imagefilter($this->image, IMG_FILTER_NEGATE);
|
imagefilter($this->image, IMG_FILTER_NEGATE);
|
||||||
return $this;
|
return $this;
|
||||||
@@ -541,7 +552,7 @@ class SimpleImage
|
|||||||
* @throws Exception
|
* @throws Exception
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function load($filename)
|
public function load($filename)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Require GD library
|
// Require GD library
|
||||||
@@ -549,7 +560,7 @@ class SimpleImage
|
|||||||
throw new Exception('Required extension GD is not loaded.');
|
throw new Exception('Required extension GD is not loaded.');
|
||||||
}
|
}
|
||||||
$this->filename = $filename;
|
$this->filename = $filename;
|
||||||
return $this->get_meta_data();
|
return $this->getMetaData();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -560,15 +571,17 @@ class SimpleImage
|
|||||||
* @return SimpleImage
|
* @return SimpleImage
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function load_base64($base64string)
|
public function loadBase64($base64string)
|
||||||
{
|
{
|
||||||
if (!extension_loaded('gd')) {
|
if (!extension_loaded('gd')) {
|
||||||
throw new Exception('Required extension GD is not loaded.');
|
throw new Exception('Required extension GD is not loaded.');
|
||||||
}
|
}
|
||||||
//remove data URI scheme and spaces from base64 string then decode it
|
//remove data URI scheme and spaces from base64 string then decode it
|
||||||
$this->imagestring = base64_decode(str_replace(' ', '+', preg_replace('#^data:image/[^;]+;base64,#', '', $base64string)));
|
$this->imagestring = base64_decode(
|
||||||
|
str_replace(' ', '+', preg_replace('#^data:image/[^;]+;base64,#', '', $base64string))
|
||||||
|
);
|
||||||
$this->image = imagecreatefromstring($this->imagestring);
|
$this->image = imagecreatefromstring($this->imagestring);
|
||||||
return $this->get_meta_data();
|
return $this->getMetaData();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -577,7 +590,7 @@ class SimpleImage
|
|||||||
* @return SimpleImage
|
* @return SimpleImage
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function mean_remove()
|
public function meanRemove()
|
||||||
{
|
{
|
||||||
imagefilter($this->image, IMG_FILTER_MEAN_REMOVAL);
|
imagefilter($this->image, IMG_FILTER_MEAN_REMOVAL);
|
||||||
return $this;
|
return $this;
|
||||||
@@ -591,11 +604,11 @@ class SimpleImage
|
|||||||
* @throws Exception
|
* @throws Exception
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function opacity($opacity)
|
public function opacity($opacity)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Determine opacity
|
// Determine opacity
|
||||||
$opacity = $this->keep_within($opacity, 0, 1) * 100;
|
$opacity = $this->keepWithin($opacity, 0, 1) * 100;
|
||||||
|
|
||||||
// Make a copy of the image
|
// Make a copy of the image
|
||||||
$copy = imagecreatetruecolor($this->width, $this->height);
|
$copy = imagecreatetruecolor($this->width, $this->height);
|
||||||
@@ -607,7 +620,7 @@ class SimpleImage
|
|||||||
$this->create($this->width, $this->height, array(0, 0, 0, 127));
|
$this->create($this->width, $this->height, array(0, 0, 0, 127));
|
||||||
|
|
||||||
// Merge with specified opacity
|
// Merge with specified opacity
|
||||||
$this->imagecopymerge_alpha($this->image, $copy, 0, 0, 0, 0, $this->width, $this->height, $opacity);
|
$this->imagecopymergeAlpha($this->image, $copy, 0, 0, 0, 0, $this->width, $this->height, $opacity);
|
||||||
imagedestroy($copy);
|
imagedestroy($copy);
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
@@ -622,7 +635,7 @@ class SimpleImage
|
|||||||
* @throws Exception
|
* @throws Exception
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function output($format = null, $quality = null)
|
public function output($format = null, $quality = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Determine quality
|
// Determine quality
|
||||||
@@ -642,7 +655,8 @@ class SimpleImage
|
|||||||
$mimetype = 'image/png';
|
$mimetype = 'image/png';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$info = (empty($this->imagestring)) ? getimagesize($this->filename) : getimagesizefromstring($this->imagestring);
|
$info = (empty($this->imagestring))
|
||||||
|
? getimagesize($this->filename) : getimagesizefromstring($this->imagestring);
|
||||||
$mimetype = $info['mime'];
|
$mimetype = $info['mime'];
|
||||||
unset($info);
|
unset($info);
|
||||||
break;
|
break;
|
||||||
@@ -676,7 +690,7 @@ class SimpleImage
|
|||||||
* @throws Exception
|
* @throws Exception
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function output_base64($format = null, $quality = null)
|
public function outputBase64($format = null, $quality = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Determine quality
|
// Determine quality
|
||||||
@@ -739,7 +753,7 @@ class SimpleImage
|
|||||||
* @return SimpleImage
|
* @return SimpleImage
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function overlay($overlay, $position = 'center', $opacity = 1, $x_offset = 0, $y_offset = 0)
|
public function overlay($overlay, $position = 'center', $opacity = 1, $x_offset = 0, $y_offset = 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Load overlay image
|
// Load overlay image
|
||||||
@@ -792,7 +806,17 @@ class SimpleImage
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Perform the overlay
|
// Perform the overlay
|
||||||
$this->imagecopymerge_alpha($this->image, $overlay->image, $x, $y, 0, 0, $overlay->width, $overlay->height, $opacity);
|
$this->imagecopymergeAlpha(
|
||||||
|
$this->image,
|
||||||
|
$overlay->image,
|
||||||
|
$x,
|
||||||
|
$y,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
$overlay->width,
|
||||||
|
$overlay->height,
|
||||||
|
$opacity
|
||||||
|
);
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@@ -805,7 +829,7 @@ class SimpleImage
|
|||||||
* @return SimpleImage
|
* @return SimpleImage
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function pixelate($block_size = 10)
|
public function pixelate($block_size = 10)
|
||||||
{
|
{
|
||||||
imagefilter($this->image, IMG_FILTER_PIXELATE, $block_size, true);
|
imagefilter($this->image, IMG_FILTER_PIXELATE, $block_size, true);
|
||||||
return $this;
|
return $this;
|
||||||
@@ -820,7 +844,7 @@ class SimpleImage
|
|||||||
* @return SimpleImage
|
* @return SimpleImage
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function resize($width, $height)
|
public function resize($width, $height)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Generate new GD image
|
// Generate new GD image
|
||||||
@@ -832,7 +856,12 @@ class SimpleImage
|
|||||||
$palletsize = imagecolorstotal($this->image);
|
$palletsize = imagecolorstotal($this->image);
|
||||||
if ($transparent_index >= 0 && $transparent_index < $palletsize) {
|
if ($transparent_index >= 0 && $transparent_index < $palletsize) {
|
||||||
$transparent_color = imagecolorsforindex($this->image, $transparent_index);
|
$transparent_color = imagecolorsforindex($this->image, $transparent_index);
|
||||||
$transparent_index = imagecolorallocate($new, $transparent_color['red'], $transparent_color['green'], $transparent_color['blue']);
|
$transparent_index = imagecolorallocate(
|
||||||
|
$new,
|
||||||
|
$transparent_color['red'],
|
||||||
|
$transparent_color['green'],
|
||||||
|
$transparent_color['blue']
|
||||||
|
);
|
||||||
imagefill($new, 0, 0, $transparent_index);
|
imagefill($new, 0, 0, $transparent_index);
|
||||||
imagecolortransparent($new, $transparent_index);
|
imagecolortransparent($new, $transparent_index);
|
||||||
}
|
}
|
||||||
@@ -863,13 +892,13 @@ class SimpleImage
|
|||||||
* @return SimpleImage
|
* @return SimpleImage
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function rotate($angle, $bg_color = '#000000')
|
public function rotate($angle, $bg_color = '#000000')
|
||||||
{
|
{
|
||||||
|
|
||||||
// Perform the rotation
|
// Perform the rotation
|
||||||
$rgba = $this->normalize_color($bg_color);
|
$rgba = $this->normalizeColor($bg_color);
|
||||||
$bg_color = imagecolorallocatealpha($this->image, $rgba['r'], $rgba['g'], $rgba['b'], $rgba['a']);
|
$bg_color = imagecolorallocatealpha($this->image, $rgba['r'], $rgba['g'], $rgba['b'], $rgba['a']);
|
||||||
$new = imagerotate($this->image, -($this->keep_within($angle, -360, 360)), $bg_color);
|
$new = imagerotate($this->image, -($this->keepWithin($angle, -360, 360)), $bg_color);
|
||||||
imagesavealpha($new, true);
|
imagesavealpha($new, true);
|
||||||
imagealphablending($new, true);
|
imagealphablending($new, true);
|
||||||
|
|
||||||
@@ -894,14 +923,14 @@ class SimpleImage
|
|||||||
* @throws Exception
|
* @throws Exception
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function save($filename = null, $quality = null, $format = null)
|
public function save($filename = null, $quality = null, $format = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Determine quality, filename, and format
|
// Determine quality, filename, and format
|
||||||
$quality = $quality ?: $this->quality;
|
$quality = $quality ?: $this->quality;
|
||||||
$filename = $filename ?: $this->filename;
|
$filename = $filename ?: $this->filename;
|
||||||
if (!$format) {
|
if (!$format) {
|
||||||
$format = $this->file_ext($filename) ?: $this->original_info['format'];
|
$format = $this->fileExt($filename) ?: $this->original_info['format'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the image
|
// Create the image
|
||||||
@@ -934,7 +963,7 @@ class SimpleImage
|
|||||||
* @return SimpleImage
|
* @return SimpleImage
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function sepia()
|
public function sepia()
|
||||||
{
|
{
|
||||||
imagefilter($this->image, IMG_FILTER_GRAYSCALE);
|
imagefilter($this->image, IMG_FILTER_GRAYSCALE);
|
||||||
imagefilter($this->image, IMG_FILTER_COLORIZE, 100, 50, 0);
|
imagefilter($this->image, IMG_FILTER_COLORIZE, 100, 50, 0);
|
||||||
@@ -947,7 +976,7 @@ class SimpleImage
|
|||||||
* @return SimpleImage
|
* @return SimpleImage
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function sketch()
|
public function sketch()
|
||||||
{
|
{
|
||||||
imagefilter($this->image, IMG_FILTER_MEAN_REMOVAL);
|
imagefilter($this->image, IMG_FILTER_MEAN_REMOVAL);
|
||||||
return $this;
|
return $this;
|
||||||
@@ -961,9 +990,9 @@ class SimpleImage
|
|||||||
* @return SimpleImage
|
* @return SimpleImage
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function smooth($level)
|
public function smooth($level)
|
||||||
{
|
{
|
||||||
imagefilter($this->image, IMG_FILTER_SMOOTH, $this->keep_within($level, -10, 10));
|
imagefilter($this->image, IMG_FILTER_SMOOTH, $this->keepWithin($level, -10, 10));
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -982,14 +1011,21 @@ class SimpleImage
|
|||||||
* @throws Exception
|
* @throws Exception
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function text($text, $font_file, $font_size = 12, $color = '#000000', $position = 'center', $x_offset = 0, $y_offset = 0)
|
public function text(
|
||||||
{
|
$text,
|
||||||
|
$font_file,
|
||||||
|
$font_size = 12,
|
||||||
|
$color = '#000000',
|
||||||
|
$position = 'center',
|
||||||
|
$x_offset = 0,
|
||||||
|
$y_offset = 0
|
||||||
|
) {
|
||||||
|
|
||||||
// todo - this method could be improved to support the text angle
|
// todo - this method could be improved to support the text angle
|
||||||
$angle = 0;
|
$angle = 0;
|
||||||
|
|
||||||
// Determine text color
|
// Determine text color
|
||||||
$rgba = $this->normalize_color($color);
|
$rgba = $this->normalizeColor($color);
|
||||||
$color = imagecolorallocatealpha($this->image, $rgba['r'], $rgba['g'], $rgba['b'], $rgba['a']);
|
$color = imagecolorallocatealpha($this->image, $rgba['r'], $rgba['g'], $rgba['b'], $rgba['a']);
|
||||||
|
|
||||||
// Determine textbox size
|
// Determine textbox size
|
||||||
@@ -1030,7 +1066,7 @@ class SimpleImage
|
|||||||
$x = 0 + $x_offset;
|
$x = 0 + $x_offset;
|
||||||
$y = ($this->height / 2) - (($box_height / 2) - $box_height) + $y_offset;
|
$y = ($this->height / 2) - (($box_height / 2) - $box_height) + $y_offset;
|
||||||
break;
|
break;
|
||||||
case 'right';
|
case 'right':
|
||||||
$x = $this->width - $box_width + $x_offset;
|
$x = $this->width - $box_width + $x_offset;
|
||||||
$y = ($this->height / 2) - (($box_height / 2) - $box_height) + $y_offset;
|
$y = ($this->height / 2) - (($box_height / 2) - $box_height) + $y_offset;
|
||||||
break;
|
break;
|
||||||
@@ -1061,7 +1097,7 @@ class SimpleImage
|
|||||||
* @return SimpleImage
|
* @return SimpleImage
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function thumbnail($width, $height = null)
|
public function thumbnail($width, $height = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Determine height
|
// Determine height
|
||||||
@@ -1073,9 +1109,9 @@ class SimpleImage
|
|||||||
|
|
||||||
// Fit to height/width
|
// Fit to height/width
|
||||||
if ($new_aspect_ratio > $current_aspect_ratio) {
|
if ($new_aspect_ratio > $current_aspect_ratio) {
|
||||||
$this->fit_to_height($height);
|
$this->fitToHeight($height);
|
||||||
} else {
|
} else {
|
||||||
$this->fit_to_width($width);
|
$this->fitToWidth($width);
|
||||||
}
|
}
|
||||||
$left = floor(($this->width / 2) - ($width / 2));
|
$left = floor(($this->width / 2) - ($width / 2));
|
||||||
$top = floor(($this->height / 2) - ($height / 2));
|
$top = floor(($this->height / 2) - ($height / 2));
|
||||||
@@ -1092,7 +1128,7 @@ class SimpleImage
|
|||||||
* @return string
|
* @return string
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
protected function file_ext($filename)
|
protected function fileExt($filename)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!preg_match('/\./', $filename)) {
|
if (!preg_match('/\./', $filename)) {
|
||||||
@@ -1111,7 +1147,7 @@ class SimpleImage
|
|||||||
* @throws Exception
|
* @throws Exception
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
protected function get_meta_data()
|
protected function getMetaData()
|
||||||
{
|
{
|
||||||
//gather meta data
|
//gather meta data
|
||||||
if (empty($this->imagestring)) {
|
if (empty($this->imagestring)) {
|
||||||
@@ -1140,8 +1176,10 @@ class SimpleImage
|
|||||||
$this->original_info = array(
|
$this->original_info = array(
|
||||||
'width' => $info[0],
|
'width' => $info[0],
|
||||||
'height' => $info[1],
|
'height' => $info[1],
|
||||||
'orientation' => $this->get_orientation(),
|
'orientation' => $this->getOrientation(),
|
||||||
'exif' => function_exists('exif_read_data') && $info['mime'] === 'image/jpeg' && $this->imagestring === null ? $this->exif = @exif_read_data($this->filename) : null,
|
'exif' => function_exists('exif_read_data')
|
||||||
|
&& $info['mime'] === 'image/jpeg'
|
||||||
|
&& $this->imagestring === null ? $this->exif = @exif_read_data($this->filename) : null,
|
||||||
'format' => preg_replace('/^image\//', '', $info['mime']),
|
'format' => preg_replace('/^image\//', '', $info['mime']),
|
||||||
'mime' => $info['mime']
|
'mime' => $info['mime']
|
||||||
);
|
);
|
||||||
@@ -1170,7 +1208,7 @@ class SimpleImage
|
|||||||
* @link http://www.php.net/manual/en/function.imagecopymerge.php#88456
|
* @link http://www.php.net/manual/en/function.imagecopymerge.php#88456
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
protected function imagecopymerge_alpha($dst_im, $src_im, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h, $pct)
|
protected function imagecopymergeAlpha($dst_im, $src_im, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h, $pct)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Get image width and height and percentage
|
// Get image width and height and percentage
|
||||||
@@ -1205,7 +1243,13 @@ class SimpleImage
|
|||||||
$alpha += 127 * $pct;
|
$alpha += 127 * $pct;
|
||||||
}
|
}
|
||||||
// Get the color index with new alpha
|
// Get the color index with new alpha
|
||||||
$alphacolorxy = imagecolorallocatealpha($src_im, ($colorxy >> 16) & 0xFF, ($colorxy >> 8) & 0xFF, $colorxy & 0xFF, $alpha);
|
$alphacolorxy = imagecolorallocatealpha(
|
||||||
|
$src_im,
|
||||||
|
($colorxy >> 16) & 0xFF,
|
||||||
|
($colorxy >> 8) & 0xFF,
|
||||||
|
$colorxy & 0xFF,
|
||||||
|
$alpha
|
||||||
|
);
|
||||||
// Set pixel with the new color + opacity
|
// Set pixel with the new color + opacity
|
||||||
if (!imagesetpixel($src_im, $x, $y, $alphacolorxy)) {
|
if (!imagesetpixel($src_im, $x, $y, $alphacolorxy)) {
|
||||||
return;
|
return;
|
||||||
@@ -1233,7 +1277,7 @@ class SimpleImage
|
|||||||
* @return int|float
|
* @return int|float
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
protected function keep_within($value, $min, $max)
|
protected function keepWithin($value, $min, $max)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ($value < $min) {
|
if ($value < $min) {
|
||||||
@@ -1256,7 +1300,7 @@ class SimpleImage
|
|||||||
* @return array|bool
|
* @return array|bool
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
protected function normalize_color($color)
|
protected function normalizeColor($color)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (is_string($color)) {
|
if (is_string($color)) {
|
||||||
@@ -1286,17 +1330,17 @@ class SimpleImage
|
|||||||
} elseif (is_array($color) && (count($color) == 3 || count($color) == 4)) {
|
} elseif (is_array($color) && (count($color) == 3 || count($color) == 4)) {
|
||||||
if (isset($color['r'], $color['g'], $color['b'])) {
|
if (isset($color['r'], $color['g'], $color['b'])) {
|
||||||
return array(
|
return array(
|
||||||
'r' => $this->keep_within($color['r'], 0, 255),
|
'r' => $this->keepWithin($color['r'], 0, 255),
|
||||||
'g' => $this->keep_within($color['g'], 0, 255),
|
'g' => $this->keepWithin($color['g'], 0, 255),
|
||||||
'b' => $this->keep_within($color['b'], 0, 255),
|
'b' => $this->keepWithin($color['b'], 0, 255),
|
||||||
'a' => $this->keep_within(isset($color['a']) ? $color['a'] : 0, 0, 127)
|
'a' => $this->keepWithin(isset($color['a']) ? $color['a'] : 0, 0, 127)
|
||||||
);
|
);
|
||||||
} elseif (isset($color[0], $color[1], $color[2])) {
|
} elseif (isset($color[0], $color[1], $color[2])) {
|
||||||
return array(
|
return array(
|
||||||
'r' => $this->keep_within($color[0], 0, 255),
|
'r' => $this->keepWithin($color[0], 0, 255),
|
||||||
'g' => $this->keep_within($color[1], 0, 255),
|
'g' => $this->keepWithin($color[1], 0, 255),
|
||||||
'b' => $this->keep_within($color[2], 0, 255),
|
'b' => $this->keepWithin($color[2], 0, 255),
|
||||||
'a' => $this->keep_within(isset($color[3]) ? $color[3] : 0, 0, 127)
|
'a' => $this->keepWithin(isset($color[3]) ? $color[3] : 0, 0, 127)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,11 +24,11 @@ namespace Classes;
|
|||||||
|
|
||||||
abstract class SubActionManager
|
abstract class SubActionManager
|
||||||
{
|
{
|
||||||
var $user = null;
|
public $user = null;
|
||||||
/* @var \Classes\BaseService $baseService*/
|
/* @var \Classes\BaseService $baseService*/
|
||||||
protected $baseService = null;
|
protected $baseService = null;
|
||||||
var $emailTemplates = null;
|
public $emailTemplates = null;
|
||||||
var $emailSender = null;
|
protected $emailSender = null;
|
||||||
|
|
||||||
public function setUser($user)
|
public function setUser($user)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,16 +8,16 @@ class UIManager
|
|||||||
|
|
||||||
private static $me = null;
|
private static $me = null;
|
||||||
|
|
||||||
var $user;
|
protected $user;
|
||||||
var $currentProfile;
|
protected $currentProfile;
|
||||||
var $switchedProfile;
|
protected $switchedProfile;
|
||||||
|
|
||||||
var $currentProfileBlock = null;
|
protected $currentProfileBlock = null;
|
||||||
var $switchedProfileBlock = null;
|
protected $switchedProfileBlock = null;
|
||||||
|
|
||||||
var $tempates = array();
|
protected $templates = array();
|
||||||
|
|
||||||
var $quickAccessMenuItems = array();
|
protected $quickAccessMenuItems = array();
|
||||||
|
|
||||||
private function __construct()
|
private function __construct()
|
||||||
{
|
{
|
||||||
@@ -35,13 +35,13 @@ class UIManager
|
|||||||
private function getTemplate($name, $type)
|
private function getTemplate($name, $type)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (isset($this->tempates[$name])) {
|
if (isset($this->templates[$name])) {
|
||||||
return $this->tempates[$name];
|
return $this->templates[$name];
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->tempates[$name] = file_get_contents(APP_BASE_PATH."templates/".$type."/".$name.".html");
|
$this->templates[$name] = file_get_contents(APP_BASE_PATH."templates/".$type."/".$name.".html");
|
||||||
|
|
||||||
return $this->tempates[$name];
|
return $this->templates[$name];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function populateTemplate($name, $type, $params)
|
public function populateTemplate($name, $type, $params)
|
||||||
@@ -210,7 +210,9 @@ class UIManager
|
|||||||
*/
|
*/
|
||||||
public function renderModule($moduleBuilder)
|
public function renderModule($moduleBuilder)
|
||||||
{
|
{
|
||||||
$str = '<div class="span9"><ul class="nav nav-tabs" id="modTab" style="margin-bottom:0px;margin-left:5px;border-bottom: none;">__tabHeaders__</ul><div class="tab-content">__tabPages__</div></div><script>__tabJs__</script>';
|
$str = '<div class="span9">'
|
||||||
|
.'<ul class="nav nav-tabs" id="modTab" style="margin-bottom:0px;margin-left:5px;border-bottom: none;">'
|
||||||
|
.'__tabHeaders__</ul><div class="tab-content">__tabPages__</div></div><script>__tabJs__</script>';
|
||||||
$str = str_replace("__tabHeaders__", $moduleBuilder->getTabHeadersHTML(), $str);
|
$str = str_replace("__tabHeaders__", $moduleBuilder->getTabHeadersHTML(), $str);
|
||||||
$str = str_replace("__tabPages__", $moduleBuilder->getTabPagesHTML(), $str);
|
$str = str_replace("__tabPages__", $moduleBuilder->getTabPagesHTML(), $str);
|
||||||
$str = str_replace("__tabJs__", $moduleBuilder->getModJsHTML(), $str);
|
$str = str_replace("__tabJs__", $moduleBuilder->getModJsHTML(), $str);
|
||||||
|
|||||||
@@ -24,8 +24,15 @@ class CompanyAdminManager extends AbstractModuleManager
|
|||||||
|
|
||||||
public function initializeDatabaseErrorMappings()
|
public function initializeDatabaseErrorMappings()
|
||||||
{
|
{
|
||||||
$this->addDatabaseErrorMapping("CONSTRAINT `Fk_Employee_CompanyStructures` FOREIGN KEY (`department`) REFERENCES `CompanyStructures` (`id`)", "Can not delete a company structure while employees are assigned to it");
|
$this->addDatabaseErrorMapping(
|
||||||
$this->addDatabaseErrorMapping("CONSTRAINT `Fk_CompanyStructures_Own` FOREIGN KEY (`parent`) REFERENCES ", "Can not delete a parent structure");
|
"CONSTRAINT `Fk_Employee_CompanyStructures` FOREIGN KEY (`department`)
|
||||||
|
REFERENCES `CompanyStructures` (`id`)",
|
||||||
|
"Can not delete a company structure while employees are assigned to it"
|
||||||
|
);
|
||||||
|
$this->addDatabaseErrorMapping(
|
||||||
|
"CONSTRAINT `Fk_CompanyStructures_Own` FOREIGN KEY (`parent`) REFERENCES ",
|
||||||
|
"Can not delete a parent structure"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setupModuleClassDefinitions()
|
public function setupModuleClassDefinitions()
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ use Model\BaseModel;
|
|||||||
|
|
||||||
class CompanyStructure extends BaseModel
|
class CompanyStructure extends BaseModel
|
||||||
{
|
{
|
||||||
var $_table = 'CompanyStructures';
|
public $table = 'CompanyStructures';
|
||||||
|
|
||||||
public function getAdminAccess()
|
public function getAdminAccess()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ use Model\BaseModel;
|
|||||||
|
|
||||||
class Timezone extends BaseModel
|
class Timezone extends BaseModel
|
||||||
{
|
{
|
||||||
var $_table = 'Timezones';
|
public $table = 'Timezones';
|
||||||
|
|
||||||
public function getAdminAccess()
|
public function getAdminAccess()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,17 +10,17 @@ use Utils\LogManager;
|
|||||||
abstract class AbstractDataImporter
|
abstract class AbstractDataImporter
|
||||||
{
|
{
|
||||||
|
|
||||||
var $dataImport = null;
|
protected $dataImport = null;
|
||||||
|
|
||||||
var $headerMapping = array();
|
protected $headerMapping = array();
|
||||||
var $primaryKeyColumn = 0;
|
protected $primaryKeyColumn = 0;
|
||||||
|
|
||||||
var $rowObjects = array();
|
protected $rowObjects = array();
|
||||||
var $attachedObjects = array();
|
protected $attachedObjects = array();
|
||||||
var $objectKeys;
|
protected $objectKeys;
|
||||||
var $customFields;
|
protected $customFields;
|
||||||
var $columnsCompeted = array();
|
protected $columnsCompeted = array();
|
||||||
var $relatedColumns = array();
|
protected $relatedColumns = array();
|
||||||
|
|
||||||
public function getRowObjects()
|
public function getRowObjects()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ use Data\Admin\Api\AbstractDataImporter;
|
|||||||
class AttendanceDataImporter extends AbstractDataImporter
|
class AttendanceDataImporter extends AbstractDataImporter
|
||||||
{
|
{
|
||||||
|
|
||||||
var $processed = array();
|
protected $processed = array();
|
||||||
|
|
||||||
public function getModelObject()
|
public function getModelObject()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ use Data\Admin\Api\AbstractDataImporter;
|
|||||||
class EmployeeDataImporter extends AbstractDataImporter
|
class EmployeeDataImporter extends AbstractDataImporter
|
||||||
{
|
{
|
||||||
|
|
||||||
var $processed = array();
|
protected $processed = array();
|
||||||
|
|
||||||
public function getModelObject()
|
public function getModelObject()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ use Model\BaseModel;
|
|||||||
|
|
||||||
class DataImport extends BaseModel
|
class DataImport extends BaseModel
|
||||||
{
|
{
|
||||||
var $_table = 'DataImport';
|
public $table = 'DataImport';
|
||||||
|
|
||||||
public function getAdminAccess()
|
public function getAdminAccess()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ use Model\BaseModel;
|
|||||||
|
|
||||||
class DataImportFile extends BaseModel
|
class DataImportFile extends BaseModel
|
||||||
{
|
{
|
||||||
var $_table = 'DataImportFiles';
|
public $table = 'DataImportFiles';
|
||||||
|
|
||||||
public function getAdminAccess()
|
public function getAdminAccess()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ use Model\BaseModel;
|
|||||||
|
|
||||||
class EmployeeDependent extends BaseModel
|
class EmployeeDependent extends BaseModel
|
||||||
{
|
{
|
||||||
var $_table = 'EmployeeDependents';
|
public $table = 'EmployeeDependents';
|
||||||
|
|
||||||
public function getAdminAccess()
|
public function getAdminAccess()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ use Model\BaseModel;
|
|||||||
|
|
||||||
class EmergencyContact extends BaseModel
|
class EmergencyContact extends BaseModel
|
||||||
{
|
{
|
||||||
var $_table = 'EmergencyContacts';
|
public $table = 'EmergencyContacts';
|
||||||
|
|
||||||
public function getAdminAccess()
|
public function getAdminAccess()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
namespace Employees\Admin\Api;
|
namespace Employees\Admin\Api;
|
||||||
|
|
||||||
|
|
||||||
use Attendance\Common\Model\Attendance;
|
use Attendance\Common\Model\Attendance;
|
||||||
use Classes\BaseService;
|
use Classes\BaseService;
|
||||||
use Classes\IceResponse;
|
use Classes\IceResponse;
|
||||||
@@ -28,13 +27,15 @@ use TimeSheets\Common\Model\EmployeeTimeEntry;
|
|||||||
use TimeSheets\Common\Model\EmployeeTimeSheet;
|
use TimeSheets\Common\Model\EmployeeTimeSheet;
|
||||||
use Travel\Common\Model\EmployeeTravelRecord;
|
use Travel\Common\Model\EmployeeTravelRecord;
|
||||||
|
|
||||||
class EmployeesActionManager extends SubActionManager{
|
class EmployeesActionManager extends SubActionManager
|
||||||
|
{
|
||||||
|
|
||||||
public function terminateEmployee($req){
|
public function terminateEmployee($req)
|
||||||
|
{
|
||||||
$employee = new Employee();
|
$employee = new Employee();
|
||||||
$employee->Load("id = ?",array($req->id));
|
$employee->Load("id = ?", array($req->id));
|
||||||
|
|
||||||
if(empty($employee->id)){
|
if (empty($employee->id)) {
|
||||||
return new IceResponse(IceResponse::ERROR, "Employee Not Found");
|
return new IceResponse(IceResponse::ERROR, "Employee Not Found");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,7 +43,7 @@ class EmployeesActionManager extends SubActionManager{
|
|||||||
$employee->status = 'Terminated';
|
$employee->status = 'Terminated';
|
||||||
|
|
||||||
$ok = $employee->Save();
|
$ok = $employee->Save();
|
||||||
if(!$ok){
|
if (!$ok) {
|
||||||
return new IceResponse(IceResponse::ERROR, "Error occurred while terminating employee");
|
return new IceResponse(IceResponse::ERROR, "Error occurred while terminating employee");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,19 +52,20 @@ class EmployeesActionManager extends SubActionManager{
|
|||||||
//$user = BaseService::getInstance()->getUserFromProfileId($employee->id);
|
//$user = BaseService::getInstance()->getUserFromProfileId($employee->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function activateEmployee($req){
|
public function activateEmployee($req)
|
||||||
|
{
|
||||||
$employee = new Employee();
|
$employee = new Employee();
|
||||||
$employee->Load("id = ?",array($req->id));
|
$employee->Load("id = ?", array($req->id));
|
||||||
|
|
||||||
if(empty($employee->id)){
|
if (empty($employee->id)) {
|
||||||
return new IceResponse(IceResponse::ERROR, "Employee Not Found");
|
return new IceResponse(IceResponse::ERROR, "Employee Not Found");
|
||||||
}
|
}
|
||||||
|
|
||||||
$employee->termination_date = NULL;
|
$employee->termination_date = null;
|
||||||
$employee->status = 'Active';
|
$employee->status = 'Active';
|
||||||
|
|
||||||
$ok = $employee->Save();
|
$ok = $employee->Save();
|
||||||
if(!$ok){
|
if (!$ok) {
|
||||||
return new IceResponse(IceResponse::ERROR, "Error occurred while activating employee");
|
return new IceResponse(IceResponse::ERROR, "Error occurred while activating employee");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,12 +74,13 @@ class EmployeesActionManager extends SubActionManager{
|
|||||||
//$user = BaseService::getInstance()->getUserFromProfileId($employee->id);
|
//$user = BaseService::getInstance()->getUserFromProfileId($employee->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function deleteEmployee($req){
|
public function deleteEmployee($req)
|
||||||
|
{
|
||||||
|
|
||||||
$employee = new Employee();
|
$employee = new Employee();
|
||||||
$employee->Load("id = ?",array($req->id));
|
$employee->Load("id = ?", array($req->id));
|
||||||
|
|
||||||
if(empty($employee->id)){
|
if (empty($employee->id)) {
|
||||||
return new IceResponse(IceResponse::ERROR, "Employee Not Found");
|
return new IceResponse(IceResponse::ERROR, "Employee Not Found");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,9 +101,13 @@ class EmployeesActionManager extends SubActionManager{
|
|||||||
$archived->termination_date = $employee->termination_date;
|
$archived->termination_date = $employee->termination_date;
|
||||||
$archived->notes = $employee->notes;
|
$archived->notes = $employee->notes;
|
||||||
|
|
||||||
$mapping = '{"nationality":["Nationality","id","name"],"employment_status":["EmploymentStatus","id","name"],"job_title":["JobTitle","id","name"],"pay_grade":["PayGrade","id","name"],"country":["Country","code","name"],"province":["Province","id","name"],"department":["CompanyStructure","id","title"],"supervisor":["Employee","id","first_name+last_name"]}';
|
$mapping = '{"nationality":["Nationality","id","name"],'
|
||||||
|
.'"employment_status":["EmploymentStatus","id","name"],"job_title":["JobTitle","id","name"],'
|
||||||
|
.'"pay_grade":["PayGrade","id","name"],"country":["Country","code","name"],'
|
||||||
|
.'"province":["Province","id","name"],"department":["CompanyStructure","id","title"],'
|
||||||
|
.'"supervisor":["Employee","id","first_name+last_name"]}';
|
||||||
|
|
||||||
$employeeEnriched = BaseService::getInstance()->getElement('Employee',$employee->id,$mapping,true);
|
$employeeEnriched = BaseService::getInstance()->getElement('Employee', $employee->id, $mapping, true);
|
||||||
$employeeEnriched = BaseService::getInstance()->cleanUpAdoDB($employeeEnriched);
|
$employeeEnriched = BaseService::getInstance()->cleanUpAdoDB($employeeEnriched);
|
||||||
|
|
||||||
$data = new \stdClass();
|
$data = new \stdClass();
|
||||||
@@ -123,31 +130,32 @@ class EmployeesActionManager extends SubActionManager{
|
|||||||
$archived->data = json_encode($data, JSON_PRETTY_PRINT);
|
$archived->data = json_encode($data, JSON_PRETTY_PRINT);
|
||||||
|
|
||||||
$ok = $archived->Save();
|
$ok = $archived->Save();
|
||||||
if(!$ok){
|
if (!$ok) {
|
||||||
return new IceResponse(IceResponse::ERROR, "Error occurred while archiving employee");
|
return new IceResponse(IceResponse::ERROR, "Error occurred while archiving employee");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$ok = $employee->Delete();
|
$ok = $employee->Delete();
|
||||||
if(!$ok){
|
if (!$ok) {
|
||||||
return new IceResponse(IceResponse::ERROR, "Error occurred while deleting employee");
|
return new IceResponse(IceResponse::ERROR, "Error occurred while deleting employee");
|
||||||
}
|
}
|
||||||
|
|
||||||
return new IceResponse(IceResponse::SUCCESS, $archived);
|
return new IceResponse(IceResponse::SUCCESS, $archived);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function downloadArchivedEmployee($req){
|
public function downloadArchivedEmployee($req)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
if($this->baseService->currentUser->user_level != 'Admin'){
|
if ($this->baseService->currentUser->user_level != 'Admin') {
|
||||||
echo "Error: Permission denied";
|
echo "Error: Permission denied";
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$employee = new ArchivedEmployee();
|
$employee = new ArchivedEmployee();
|
||||||
$employee->Load("id = ?",array($req->id));
|
$employee->Load("id = ?", array($req->id));
|
||||||
|
|
||||||
if(empty($employee->id)){
|
if (empty($employee->id)) {
|
||||||
return new IceResponse(IceResponse::ERROR, "Employee Not Found");
|
return new IceResponse(IceResponse::ERROR, "Employee Not Found");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,11 +165,13 @@ class EmployeesActionManager extends SubActionManager{
|
|||||||
$str = json_encode($employee, JSON_PRETTY_PRINT);
|
$str = json_encode($employee, JSON_PRETTY_PRINT);
|
||||||
|
|
||||||
$filename = uniqid();
|
$filename = uniqid();
|
||||||
$file = fopen("/tmp/".$filename,"w");
|
$file = fopen("/tmp/".$filename, "w");
|
||||||
fwrite($file,$str);
|
fwrite($file, $str);
|
||||||
fclose($file);
|
fclose($file);
|
||||||
|
|
||||||
$downloadFileName = "employee_".$employee->id."_".str_replace(" ", "_", $employee->first_name)."_".str_replace(" ", "_", $employee->last_name).".txt";
|
$downloadFileName = "employee_".$employee->id."_"
|
||||||
|
.str_replace(" ", "_", $employee->first_name)."_"
|
||||||
|
.str_replace(" ", "_", $employee->last_name).".txt";
|
||||||
|
|
||||||
header("Pragma: public"); // required
|
header("Pragma: public"); // required
|
||||||
header("Expires: 0");
|
header("Expires: 0");
|
||||||
@@ -173,13 +183,13 @@ class EmployeesActionManager extends SubActionManager{
|
|||||||
header("Content-Length: ".filesize("/tmp/".$filename));
|
header("Content-Length: ".filesize("/tmp/".$filename));
|
||||||
readfile("/tmp/".$filename);
|
readfile("/tmp/".$filename);
|
||||||
exit();
|
exit();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getEmployeeData($id, $obj){
|
private function getEmployeeData($id, $obj)
|
||||||
|
{
|
||||||
$data = array();
|
$data = array();
|
||||||
$objs = $obj->Find("employee = ?",array($id));
|
$objs = $obj->Find("employee = ?", array($id));
|
||||||
foreach($objs as $entry){
|
foreach ($objs as $entry) {
|
||||||
$data[] = BaseService::getInstance()->cleanUpAdoDB($entry);
|
$data[] = BaseService::getInstance()->cleanUpAdoDB($entry);
|
||||||
}
|
}
|
||||||
return $data;
|
return $data;
|
||||||
|
|||||||
@@ -34,7 +34,10 @@ class EmployeesAdminManager extends AbstractModuleManager
|
|||||||
|
|
||||||
public function initializeDatabaseErrorMappings()
|
public function initializeDatabaseErrorMappings()
|
||||||
{
|
{
|
||||||
$this->addDatabaseErrorMapping('CONSTRAINT `Fk_User_Employee` FOREIGN KEY', "Can not delete Employee, please delete the User for this employee first.");
|
$this->addDatabaseErrorMapping(
|
||||||
|
'CONSTRAINT `Fk_User_Employee` FOREIGN KEY',
|
||||||
|
"Can not delete Employee, please delete the User for this employee first."
|
||||||
|
);
|
||||||
$this->addDatabaseErrorMapping("Duplicate entry|for key 'employee'", "A duplicate entry found");
|
$this->addDatabaseErrorMapping("Duplicate entry|for key 'employee'", "A duplicate entry found");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,5 +31,5 @@ class ArchivedEmployee extends BaseModel
|
|||||||
return "id";
|
return "id";
|
||||||
}
|
}
|
||||||
|
|
||||||
var $_table = 'ArchivedEmployees';
|
public $table = 'ArchivedEmployees';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,10 +9,10 @@ use Model\BaseModel;
|
|||||||
class Employee extends BaseModel
|
class Employee extends BaseModel
|
||||||
{
|
{
|
||||||
|
|
||||||
var $oldObj = null;
|
public $oldObj = null;
|
||||||
var $oldObjOrig = null;
|
public $oldObjOrig = null;
|
||||||
var $historyUpdateList = array();
|
public $historyUpdateList = array();
|
||||||
var $historyFieldsToTrack = array(
|
public $historyFieldsToTrack = array(
|
||||||
"employee_id"=>"employee_id",
|
"employee_id"=>"employee_id",
|
||||||
"first_name"=>"first_name",
|
"first_name"=>"first_name",
|
||||||
"middle_name"=>"middle_name",
|
"middle_name"=>"middle_name",
|
||||||
@@ -78,7 +78,11 @@ class Employee extends BaseModel
|
|||||||
$oldObjOrig->Load("id = ?", array($obj->id));
|
$oldObjOrig->Load("id = ?", array($obj->id));
|
||||||
$this->oldObjOrig = $oldObjOrig;
|
$this->oldObjOrig = $oldObjOrig;
|
||||||
|
|
||||||
$mapping = '{"nationality":["Nationality","id","name"],"employment_status":["EmploymentStatus","id","name"],"job_title":["JobTitle","id","name"],"pay_grade":["PayGrade","id","name"],"country":["Country","code","name"],"province":["Province","id","name"],"department":["CompanyStructure","id","title"],"supervisor":["Employee","id","first_name+last_name"]}';
|
$mapping = '{"nationality":["Nationality","id","name"],'
|
||||||
|
.'"employment_status":["EmploymentStatus","id","name"],"job_title":["JobTitle","id","name"],'
|
||||||
|
.'"pay_grade":["PayGrade","id","name"],"country":["Country","code","name"],'
|
||||||
|
.'"province":["Province","id","name"],"department":["CompanyStructure","id","title"],'
|
||||||
|
.'"supervisor":["Employee","id","first_name+last_name"]}';
|
||||||
|
|
||||||
$this->oldObj = BaseService::getInstance()->getElement('Employee', $obj->id, $mapping, true);
|
$this->oldObj = BaseService::getInstance()->getElement('Employee', $obj->id, $mapping, true);
|
||||||
}
|
}
|
||||||
@@ -89,7 +93,11 @@ class Employee extends BaseModel
|
|||||||
$oldObj = $this->oldObj;
|
$oldObj = $this->oldObj;
|
||||||
$oldObjOrig = $this->oldObjOrig;
|
$oldObjOrig = $this->oldObjOrig;
|
||||||
|
|
||||||
$mapping = '{"nationality":["Nationality","id","name"],"employment_status":["EmploymentStatus","id","name"],"job_title":["JobTitle","id","name"],"pay_grade":["PayGrade","id","name"],"country":["Country","code","name"],"province":["Province","id","name"],"department":["CompanyStructure","id","title"],"supervisor":["Employee","id","first_name+last_name"]}';
|
$mapping = '{"nationality":["Nationality","id","name"],'
|
||||||
|
.'"employment_status":["EmploymentStatus","id","name"],"job_title":["JobTitle","id","name"],'
|
||||||
|
.'"pay_grade":["PayGrade","id","name"],"country":["Country","code","name"],'
|
||||||
|
.'"province":["Province","id","name"],"department":["CompanyStructure","id","title"],'
|
||||||
|
.'"supervisor":["Employee","id","first_name+last_name"]}';
|
||||||
|
|
||||||
$objEnriched = BaseService::getInstance()->getElement('Employee', $obj->id, $mapping, true);
|
$objEnriched = BaseService::getInstance()->getElement('Employee', $obj->id, $mapping, true);
|
||||||
|
|
||||||
@@ -205,5 +213,5 @@ class Employee extends BaseModel
|
|||||||
return $obj;
|
return $obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
var $_table = 'Employees';
|
public $table = 'Employees';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ use Model\BaseModel;
|
|||||||
class EmployeeApproval extends BaseModel
|
class EmployeeApproval extends BaseModel
|
||||||
{
|
{
|
||||||
|
|
||||||
var $_table = 'EmployeeApprovals';
|
public $table = 'EmployeeApprovals';
|
||||||
|
|
||||||
public function getAdminAccess()
|
public function getAdminAccess()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ use Model\BaseModel;
|
|||||||
class EmploymentStatus extends BaseModel
|
class EmploymentStatus extends BaseModel
|
||||||
{
|
{
|
||||||
|
|
||||||
var $_table = 'EmploymentStatus';
|
public $table = 'EmploymentStatus';
|
||||||
|
|
||||||
public function getAdminAccess()
|
public function getAdminAccess()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -33,7 +33,13 @@ class EmployeeRestEndPoint extends RestEndPoint
|
|||||||
}
|
}
|
||||||
return new IceResponse(IceResponse::SUCCESS, $newEmps);
|
return new IceResponse(IceResponse::SUCCESS, $newEmps);
|
||||||
} else {
|
} else {
|
||||||
$mapping = '{"nationality":["Nationality","id","name"],"ethnicity":["Ethnicity","id","name"],"immigration_status":["ImmigrationStatus","id","name"],"employment_status":["EmploymentStatus","id","name"],"job_title":["JobTitle","id","name"],"pay_grade":["PayGrade","id","name"],"country":["Country","code","name"],"province":["Province","id","name"],"department":["CompanyStructure","id","title"],"supervisor":["Employee","id","first_name+last_name"]}';
|
$mapping = '{"nationality":["Nationality","id","name"],"ethnicity":["Ethnicity","id","name"],'
|
||||||
|
.'"immigration_status":["ImmigrationStatus","id","name"],'
|
||||||
|
.'"employment_status":["EmploymentStatus","id","name"],'
|
||||||
|
.'"job_title":["JobTitle","id","name"],"pay_grade":["PayGrade","id","name"],'
|
||||||
|
.'"country":["Country","code","name"],"province":["Province","id","name"],'
|
||||||
|
.'"department":["CompanyStructure","id","title"],'
|
||||||
|
.'"supervisor":["Employee","id","first_name+last_name"]}';
|
||||||
$emp = BaseService::getInstance()->getElement('Employee', $parameter, $mapping, true);
|
$emp = BaseService::getInstance()->getElement('Employee', $parameter, $mapping, true);
|
||||||
if (!empty($emp)) {
|
if (!empty($emp)) {
|
||||||
$emp = Employee::cleanEmployeeData($emp);
|
$emp = Employee::cleanEmployeeData($emp);
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
namespace Employees\User\Api;
|
namespace Employees\User\Api;
|
||||||
|
|
||||||
|
|
||||||
use Classes\BaseService;
|
use Classes\BaseService;
|
||||||
use Classes\FileService;
|
use Classes\FileService;
|
||||||
use Classes\IceResponse;
|
use Classes\IceResponse;
|
||||||
@@ -50,7 +49,11 @@ class EmployeesActionManager extends SubActionManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($childCompaniesIds)) {
|
if (!empty($childCompaniesIds)) {
|
||||||
$childStructureSubordinates = $obj->Find("department in (" . implode(',', $childCompaniesIds) . ") and id != ?", array($cemp));
|
$childStructureSubordinates
|
||||||
|
= $obj->Find(
|
||||||
|
"department in (" . implode(',', $childCompaniesIds) . ") and id != ?",
|
||||||
|
array($cemp)
|
||||||
|
);
|
||||||
$subordinates = array_merge($subordinates, $childStructureSubordinates);
|
$subordinates = array_merge($subordinates, $childStructureSubordinates);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,13 +13,13 @@ use Model\ApproveModel;
|
|||||||
|
|
||||||
class EmployeeExpense extends ApproveModel
|
class EmployeeExpense extends ApproveModel
|
||||||
{
|
{
|
||||||
var $_table = 'EmployeeExpenses';
|
public $table = 'EmployeeExpenses';
|
||||||
|
|
||||||
var $notificationModuleName = "Expense Management";
|
public $notificationModuleName = "Expense Management";
|
||||||
var $notificationUnitName = "Expense";
|
public $notificationUnitName = "Expense";
|
||||||
var $notificationUnitPrefix = "An";
|
public $notificationUnitPrefix = "An";
|
||||||
var $notificationUnitAdminUrl = "g=modules&n=expenses&m=module_Finance#tabSubordinateEmployeeExpense";
|
public $notificationUnitAdminUrl = "g=modules&n=expenses&m=module_Finance#tabSubordinateEmployeeExpense";
|
||||||
var $preApproveSettingName = "Expense: Pre-Approve Expenses";
|
public $preApproveSettingName = "Expense: Pre-Approve Expenses";
|
||||||
|
|
||||||
public function isMultiLevelApprovalsEnabled()
|
public function isMultiLevelApprovalsEnabled()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,9 +10,10 @@ namespace Expenses\Common\Model;
|
|||||||
|
|
||||||
class EmployeeExpenseApproval extends EmployeeExpense
|
class EmployeeExpenseApproval extends EmployeeExpense
|
||||||
{
|
{
|
||||||
|
// @codingStandardsIgnoreStart
|
||||||
public function Find($whereOrderBy, $bindarr = false, $pkeysArr = false, $extra = array())
|
public function Find($whereOrderBy, $bindarr = false, $pkeysArr = false, $extra = array())
|
||||||
{
|
{
|
||||||
|
// @codingStandardsIgnoreEnd
|
||||||
return $this->findApprovals(new EmployeeExpense(), $whereOrderBy, $bindarr, $pkeysArr, $extra);
|
return $this->findApprovals(new EmployeeExpense(), $whereOrderBy, $bindarr, $pkeysArr, $extra);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ use Model\BaseModel;
|
|||||||
|
|
||||||
class ExpensesCategory extends BaseModel
|
class ExpensesCategory extends BaseModel
|
||||||
{
|
{
|
||||||
var $_table = 'ExpensesCategories';
|
public $table = 'ExpensesCategories';
|
||||||
|
|
||||||
public function getAdminAccess()
|
public function getAdminAccess()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ use Model\BaseModel;
|
|||||||
|
|
||||||
class ExpensesPaymentMethod extends BaseModel
|
class ExpensesPaymentMethod extends BaseModel
|
||||||
{
|
{
|
||||||
var $_table = 'ExpensesPaymentMethods';
|
public $table = 'ExpensesPaymentMethods';
|
||||||
|
|
||||||
public function getAdminAccess()
|
public function getAdminAccess()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
namespace Expenses\User\Api;
|
namespace Expenses\User\Api;
|
||||||
|
|
||||||
|
|
||||||
use Classes\Approval\ApproveModuleActionManager;
|
use Classes\Approval\ApproveModuleActionManager;
|
||||||
|
|
||||||
class ExpensesActionManager extends ApproveModuleActionManager
|
class ExpensesActionManager extends ApproveModuleActionManager
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ use Model\BaseModel;
|
|||||||
|
|
||||||
class CustomField extends BaseModel
|
class CustomField extends BaseModel
|
||||||
{
|
{
|
||||||
var $_table = 'CustomFields';
|
public $table = 'CustomFields';
|
||||||
|
|
||||||
public function getAdminAccess()
|
public function getAdminAccess()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ use Model\BaseModel;
|
|||||||
|
|
||||||
class FieldNameMapping extends BaseModel
|
class FieldNameMapping extends BaseModel
|
||||||
{
|
{
|
||||||
var $_table = 'FieldNameMappings';
|
public $table = 'FieldNameMappings';
|
||||||
|
|
||||||
public function getAdminAccess()
|
public function getAdminAccess()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ use Model\BaseModel;
|
|||||||
|
|
||||||
class JobTitle extends BaseModel
|
class JobTitle extends BaseModel
|
||||||
{
|
{
|
||||||
var $_table = 'JobTitles';
|
public $table = 'JobTitles';
|
||||||
|
|
||||||
public function getAdminAccess()
|
public function getAdminAccess()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ use Model\BaseModel;
|
|||||||
|
|
||||||
class PayGrade extends BaseModel
|
class PayGrade extends BaseModel
|
||||||
{
|
{
|
||||||
var $_table = 'PayGrades';
|
public $table = 'PayGrades';
|
||||||
|
|
||||||
public function getAdminAccess()
|
public function getAdminAccess()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ use Model\BaseModel;
|
|||||||
|
|
||||||
class CompanyLoan extends BaseModel
|
class CompanyLoan extends BaseModel
|
||||||
{
|
{
|
||||||
var $_table = 'CompanyLoans';
|
public $table = 'CompanyLoans';
|
||||||
|
|
||||||
public function getAdminAccess()
|
public function getAdminAccess()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ use Model\BaseModel;
|
|||||||
|
|
||||||
class EmployeeCompanyLoan extends BaseModel
|
class EmployeeCompanyLoan extends BaseModel
|
||||||
{
|
{
|
||||||
var $_table = 'EmployeeCompanyLoans';
|
public $table = 'EmployeeCompanyLoans';
|
||||||
|
|
||||||
public function getAdminAccess()
|
public function getAdminAccess()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ use Model\BaseModel;
|
|||||||
|
|
||||||
class CalculationHook extends BaseModel
|
class CalculationHook extends BaseModel
|
||||||
{
|
{
|
||||||
var $_table = 'CalculationHooks';
|
public $table = 'CalculationHooks';
|
||||||
|
|
||||||
public function getAdminAccess()
|
public function getAdminAccess()
|
||||||
{
|
{
|
||||||
@@ -29,7 +29,7 @@ class CalculationHook extends BaseModel
|
|||||||
{
|
{
|
||||||
return array("get","element");
|
return array("get","element");
|
||||||
}
|
}
|
||||||
|
// @codingStandardsIgnoreStart
|
||||||
function Find($whereOrderBy, $bindarr = false, $pkeysArr = false, $extra = array())
|
function Find($whereOrderBy, $bindarr = false, $pkeysArr = false, $extra = array())
|
||||||
{
|
{
|
||||||
return BaseService::getInstance()->getCalculationHooks();
|
return BaseService::getInstance()->getCalculationHooks();
|
||||||
@@ -39,4 +39,5 @@ class CalculationHook extends BaseModel
|
|||||||
{
|
{
|
||||||
return BaseService::getInstance()->getCalculationHook($bindarr[0]);
|
return BaseService::getInstance()->getCalculationHook($bindarr[0]);
|
||||||
}
|
}
|
||||||
|
// @codingStandardsIgnoreEnd
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ use Model\BaseModel;
|
|||||||
|
|
||||||
class Country extends BaseModel
|
class Country extends BaseModel
|
||||||
{
|
{
|
||||||
var $_table = 'Country';
|
public $table = 'Country';
|
||||||
|
|
||||||
public function getAdminAccess()
|
public function getAdminAccess()
|
||||||
{
|
{
|
||||||
@@ -30,6 +30,7 @@ class Country extends BaseModel
|
|||||||
return array("get","element");
|
return array("get","element");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @codingStandardsIgnoreStart
|
||||||
function Find($whereOrderBy, $bindarr = false, $pkeysArr = false, $extra = array())
|
function Find($whereOrderBy, $bindarr = false, $pkeysArr = false, $extra = array())
|
||||||
{
|
{
|
||||||
$allowedCountriesStr = SettingsManager::getInstance()->getSetting('System: Allowed Countries');
|
$allowedCountriesStr = SettingsManager::getInstance()->getSetting('System: Allowed Countries');
|
||||||
@@ -49,4 +50,5 @@ class Country extends BaseModel
|
|||||||
|
|
||||||
return parent::Find($whereOrderBy, $bindarr, $pkeysArr, $extra);
|
return parent::Find($whereOrderBy, $bindarr, $pkeysArr, $extra);
|
||||||
}
|
}
|
||||||
|
// @codingStandardsIgnoreEnd
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ use Model\BaseModel;
|
|||||||
|
|
||||||
class CurrencyType extends BaseModel
|
class CurrencyType extends BaseModel
|
||||||
{
|
{
|
||||||
var $_table = 'CurrencyTypes';
|
public $table = 'CurrencyTypes';
|
||||||
|
|
||||||
public function getAdminAccess()
|
public function getAdminAccess()
|
||||||
{
|
{
|
||||||
@@ -30,6 +30,7 @@ class CurrencyType extends BaseModel
|
|||||||
return array("get","element");
|
return array("get","element");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @codingStandardsIgnoreStart
|
||||||
function Find($whereOrderBy, $bindarr = false, $pkeysArr = false, $extra = array())
|
function Find($whereOrderBy, $bindarr = false, $pkeysArr = false, $extra = array())
|
||||||
{
|
{
|
||||||
$allowedCountriesStr = SettingsManager::getInstance()->getSetting('System: Allowed Currencies');
|
$allowedCountriesStr = SettingsManager::getInstance()->getSetting('System: Allowed Currencies');
|
||||||
@@ -49,4 +50,5 @@ class CurrencyType extends BaseModel
|
|||||||
|
|
||||||
return parent::Find($whereOrderBy, $bindarr, $pkeysArr, $extra);
|
return parent::Find($whereOrderBy, $bindarr, $pkeysArr, $extra);
|
||||||
}
|
}
|
||||||
|
// @codingStandardsIgnoreEnd
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ use Model\BaseModel;
|
|||||||
|
|
||||||
class CustomFieldValue extends BaseModel
|
class CustomFieldValue extends BaseModel
|
||||||
{
|
{
|
||||||
var $_table = 'CustomFieldValues';
|
public $table = 'CustomFieldValues';
|
||||||
|
|
||||||
public function getAdminAccess()
|
public function getAdminAccess()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ use Model\BaseModel;
|
|||||||
|
|
||||||
class Ethnicity extends BaseModel
|
class Ethnicity extends BaseModel
|
||||||
{
|
{
|
||||||
var $_table = 'Ethnicity';
|
public $table = 'Ethnicity';
|
||||||
|
|
||||||
public function getAdminAccess()
|
public function getAdminAccess()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ use Model\BaseModel;
|
|||||||
|
|
||||||
class ImmigrationStatus extends BaseModel
|
class ImmigrationStatus extends BaseModel
|
||||||
{
|
{
|
||||||
var $_table = 'ImmigrationStatus';
|
public $table = 'ImmigrationStatus';
|
||||||
|
|
||||||
public function getAdminAccess()
|
public function getAdminAccess()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ use Model\BaseModel;
|
|||||||
|
|
||||||
class Nationality extends BaseModel
|
class Nationality extends BaseModel
|
||||||
{
|
{
|
||||||
var $_table = 'Nationality';
|
public $table = 'Nationality';
|
||||||
|
|
||||||
public function getAdminAccess()
|
public function getAdminAccess()
|
||||||
{
|
{
|
||||||
@@ -29,7 +29,7 @@ class Nationality extends BaseModel
|
|||||||
{
|
{
|
||||||
return array("get","element");
|
return array("get","element");
|
||||||
}
|
}
|
||||||
|
// @codingStandardsIgnoreStart
|
||||||
function Find($whereOrderBy, $bindarr = false, $pkeysArr = false, $extra = array())
|
function Find($whereOrderBy, $bindarr = false, $pkeysArr = false, $extra = array())
|
||||||
{
|
{
|
||||||
$allowedCountriesStr = SettingsManager::getInstance()->getSetting('System: Allowed Nationality');
|
$allowedCountriesStr = SettingsManager::getInstance()->getSetting('System: Allowed Nationality');
|
||||||
@@ -49,4 +49,5 @@ class Nationality extends BaseModel
|
|||||||
|
|
||||||
return parent::Find($whereOrderBy, $bindarr, $pkeysArr, $extra);
|
return parent::Find($whereOrderBy, $bindarr, $pkeysArr, $extra);
|
||||||
}
|
}
|
||||||
|
// @codingStandardsIgnoreEnd
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ use Model\BaseModel;
|
|||||||
|
|
||||||
class Province extends BaseModel
|
class Province extends BaseModel
|
||||||
{
|
{
|
||||||
var $_table = 'Province';
|
public $table = 'Province';
|
||||||
|
|
||||||
public function getAdminAccess()
|
public function getAdminAccess()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ use Model\BaseModel;
|
|||||||
|
|
||||||
class SupportedLanguage extends BaseModel
|
class SupportedLanguage extends BaseModel
|
||||||
{
|
{
|
||||||
var $_table = 'SupportedLanguages';
|
public $table = 'SupportedLanguages';
|
||||||
|
|
||||||
public function getAdminAccess()
|
public function getAdminAccess()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -41,23 +41,55 @@ abstract class ApproveModel extends BaseModel
|
|||||||
$employee = BaseService::getInstance()->getElement('Employee', $currentEmpId);
|
$employee = BaseService::getInstance()->getElement('Employee', $currentEmpId);
|
||||||
|
|
||||||
if (!empty($employee->supervisor)) {
|
if (!empty($employee->supervisor)) {
|
||||||
$notificationMsg = "A new ".$this->notificationUnitName." has been added by " . $employee->first_name . " " . $employee->last_name . ". Please visit ".$this->notificationModuleName." module to review it";
|
$notificationMsg = "A new "
|
||||||
|
.$this->notificationUnitName." has been added by "
|
||||||
|
. $employee->first_name . " " . $employee->last_name
|
||||||
|
. ". Please visit ".$this->notificationModuleName." module to review it";
|
||||||
|
|
||||||
BaseService::getInstance()->notificationManager->addNotification($employee->supervisor, $notificationMsg, '{"type":"url","url":"'.$this->notificationUnitAdminUrl.'"}', $this->notificationModuleName, null, false, $sendNotificationEmail);
|
BaseService::getInstance()->notificationManager->addNotification(
|
||||||
|
$employee->supervisor,
|
||||||
|
$notificationMsg,
|
||||||
|
'{"type":"url","url":"'.$this->notificationUnitAdminUrl.'"}',
|
||||||
|
$this->notificationModuleName,
|
||||||
|
null,
|
||||||
|
false,
|
||||||
|
$sendNotificationEmail
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$user = BaseService::getInstance()->getCurrentUser();
|
$user = BaseService::getInstance()->getCurrentUser();
|
||||||
|
|
||||||
if ($user->user_level == "Admin") {
|
if ($user->user_level == "Admin") {
|
||||||
//Auto approve
|
//Auto approve
|
||||||
$obj->status = "Approved";
|
$obj->status = "Approved";
|
||||||
$notificationMsg = "Your ".$this->notificationUnitName." is auto approved since you are an administrator and do not have any supervisor assigned";
|
$notificationMsg = "Your ".$this->notificationUnitName
|
||||||
BaseService::getInstance()->notificationManager->addNotification(null, $notificationMsg, '{"type":"url","url":"'.$this->notificationUnitAdminUrl.'"}', $this->notificationModuleName, $user->id, false, $sendNotificationEmail);
|
." is auto approved since you are an administrator and do not have any supervisor assigned";
|
||||||
|
BaseService::getInstance()->notificationManager->addNotification(
|
||||||
|
null,
|
||||||
|
$notificationMsg,
|
||||||
|
'{"type":"url","url":"'.$this->notificationUnitAdminUrl.'"}',
|
||||||
|
$this->notificationModuleName,
|
||||||
|
$user->id,
|
||||||
|
false,
|
||||||
|
$sendNotificationEmail
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
//If the user do not have a supervisor, notify all admins
|
//If the user do not have a supervisor, notify all admins
|
||||||
$admins = BaseService::getInstance()->getAllAdmins();
|
$admins = BaseService::getInstance()->getAllAdmins();
|
||||||
foreach ($admins as $admin) {
|
foreach ($admins as $admin) {
|
||||||
$notificationMsg = "A new ".$this->notificationUnitName." has been added by " . $employee->first_name . " " . $employee->last_name . ". Please visit ".$this->notificationModuleName." module to review it. You are getting this notification since you are an administrator and the user do not have any supervisor assigned.";
|
$notificationMsg = "A new ".$this->notificationUnitName." has been added by "
|
||||||
BaseService::getInstance()->notificationManager->addNotification(null, $notificationMsg, '{"type":"url","url":"'.$this->notificationUnitAdminUrl.'"}', $this->notificationModuleName, $admin->id, false, $sendNotificationEmail);
|
.$employee->first_name . " " . $employee->last_name . ". Please visit "
|
||||||
|
.$this->notificationModuleName
|
||||||
|
." module to review it. You are getting this notification since you are an "
|
||||||
|
."administrator and the user do not have any supervisor assigned.";
|
||||||
|
BaseService::getInstance()->notificationManager->addNotification(
|
||||||
|
null,
|
||||||
|
$notificationMsg,
|
||||||
|
'{"type":"url","url":"'.$this->notificationUnitAdminUrl.'"}',
|
||||||
|
$this->notificationModuleName,
|
||||||
|
$admin->id,
|
||||||
|
false,
|
||||||
|
$sendNotificationEmail
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -102,9 +134,20 @@ abstract class ApproveModel extends BaseModel
|
|||||||
$employee = BaseService::getInstance()->getElement('Employee', $currentEmpId);
|
$employee = BaseService::getInstance()->getElement('Employee', $currentEmpId);
|
||||||
|
|
||||||
if (!empty($employee->supervisor)) {
|
if (!empty($employee->supervisor)) {
|
||||||
$notificationMsg = $this->notificationUnitPrefix." ".$this->notificationUnitName." has been updated by " . $employee->first_name . " " . $employee->last_name . ". Please visit ".$this->notificationModuleName." module to review it";
|
$notificationMsg = $this->notificationUnitPrefix." "
|
||||||
|
.$this->notificationUnitName." has been updated by "
|
||||||
|
.$employee->first_name . " " . $employee->last_name
|
||||||
|
.". Please visit ".$this->notificationModuleName." module to review it";
|
||||||
|
|
||||||
BaseService::getInstance()->notificationManager->addNotification($employee->supervisor, $notificationMsg, '{"type":"url","url":"'.$this->notificationUnitAdminUrl.'"}', $this->notificationModuleName, null, false, $sendNotificationEmail);
|
BaseService::getInstance()->notificationManager->addNotification(
|
||||||
|
$employee->supervisor,
|
||||||
|
$notificationMsg,
|
||||||
|
'{"type":"url","url":"'.$this->notificationUnitAdminUrl.'"}',
|
||||||
|
$this->notificationModuleName,
|
||||||
|
null,
|
||||||
|
false,
|
||||||
|
$sendNotificationEmail
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$user = BaseService::getInstance()->getCurrentUser();
|
$user = BaseService::getInstance()->getCurrentUser();
|
||||||
|
|
||||||
@@ -113,8 +156,21 @@ abstract class ApproveModel extends BaseModel
|
|||||||
//If the user do not have a supervisor, notify all admins
|
//If the user do not have a supervisor, notify all admins
|
||||||
$admins = BaseService::getInstance()->getAllAdmins();
|
$admins = BaseService::getInstance()->getAllAdmins();
|
||||||
foreach ($admins as $admin) {
|
foreach ($admins as $admin) {
|
||||||
$notificationMsg = $this->notificationUnitPrefix." ".$this->notificationUnitName." request has been updated by " . $employee->first_name . " " . $employee->last_name . ". Please visit ".$this->notificationModuleName." module to review it. You are getting this notification since you are an administrator and the user do not have any supervisor assigned.";
|
$notificationMsg = $this->notificationUnitPrefix." "
|
||||||
BaseService::getInstance()->notificationManager->addNotification(null, $notificationMsg, '{"type":"url","url":"g=admin&n=travel&m=admin_Employees"}', "Travel Module", $admin->id, false, $sendNotificationEmail);
|
.$this->notificationUnitName." request has been updated by "
|
||||||
|
.$employee->first_name . " " . $employee->last_name
|
||||||
|
.". Please visit ".$this->notificationModuleName
|
||||||
|
." module to review it. You are getting this notification since you are "
|
||||||
|
."an administrator and the user do not have any supervisor assigned.";
|
||||||
|
BaseService::getInstance()->notificationManager->addNotification(
|
||||||
|
null,
|
||||||
|
$notificationMsg,
|
||||||
|
'{"type":"url","url":"g=admin&n=travel&m=admin_Employees"}',
|
||||||
|
"Travel Module",
|
||||||
|
$admin->id,
|
||||||
|
false,
|
||||||
|
$sendNotificationEmail
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -140,7 +196,10 @@ abstract class ApproveModel extends BaseModel
|
|||||||
{
|
{
|
||||||
$currentEmployee = BaseService::getInstance()->getCurrentProfileId();
|
$currentEmployee = BaseService::getInstance()->getCurrentProfileId();
|
||||||
$approveal = new EmployeeApproval();
|
$approveal = new EmployeeApproval();
|
||||||
$approveals = $approveal->Find("type = ? and approver = ? and status = -1 and active = 1", array($this->getType(), $currentEmployee));
|
$approveals = $approveal->Find(
|
||||||
|
"type = ? and approver = ? and status = -1 and active = 1",
|
||||||
|
array($this->getType(), $currentEmployee)
|
||||||
|
);
|
||||||
$ids = array();
|
$ids = array();
|
||||||
foreach ($approveals as $appr) {
|
foreach ($approveals as $appr) {
|
||||||
$ids[] = $appr->element;
|
$ids[] = $appr->element;
|
||||||
|
|||||||
@@ -10,5 +10,5 @@ namespace Model;
|
|||||||
|
|
||||||
class Audit extends BaseModel
|
class Audit extends BaseModel
|
||||||
{
|
{
|
||||||
var $_table = 'AuditLog';
|
public $table = 'AuditLog';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ use Classes\IceResponse;
|
|||||||
class BaseModel extends \ADOdb_Active_Record
|
class BaseModel extends \ADOdb_Active_Record
|
||||||
{
|
{
|
||||||
|
|
||||||
var $keysToIgnore = array(
|
public $keysToIgnore = array(
|
||||||
"_table",
|
"_table",
|
||||||
"_dbat",
|
"_dbat",
|
||||||
"_tableat",
|
"_tableat",
|
||||||
|
|||||||
@@ -10,5 +10,5 @@ namespace Model;
|
|||||||
|
|
||||||
class Cron extends BaseModel
|
class Cron extends BaseModel
|
||||||
{
|
{
|
||||||
var $_table = 'Crons';
|
public $table = 'Crons';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,5 +10,5 @@ namespace Model;
|
|||||||
|
|
||||||
class DataEntryBackup extends BaseModel
|
class DataEntryBackup extends BaseModel
|
||||||
{
|
{
|
||||||
var $_table = 'DataEntryBackups';
|
public $table = 'DataEntryBackups';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ namespace Model;
|
|||||||
|
|
||||||
class File extends BaseModel
|
class File extends BaseModel
|
||||||
{
|
{
|
||||||
var $_table = 'Files';
|
public $table = 'Files';
|
||||||
public function getAdminAccess()
|
public function getAdminAccess()
|
||||||
{
|
{
|
||||||
return array("get","element","save","delete");
|
return array("get","element","save","delete");
|
||||||
|
|||||||
@@ -10,5 +10,5 @@ namespace Model;
|
|||||||
|
|
||||||
class IceEmail extends BaseModel
|
class IceEmail extends BaseModel
|
||||||
{
|
{
|
||||||
var $_table = 'Emails';
|
public $table = 'Emails';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,5 +10,5 @@ namespace Model;
|
|||||||
|
|
||||||
class Migration extends BaseModel
|
class Migration extends BaseModel
|
||||||
{
|
{
|
||||||
var $_table = 'Migrations';
|
public $table = 'Migrations';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,5 +10,5 @@ namespace Model;
|
|||||||
|
|
||||||
class Notification extends BaseModel
|
class Notification extends BaseModel
|
||||||
{
|
{
|
||||||
var $_table = 'Notifications';
|
public $table = 'Notifications';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,5 +31,5 @@ class Report extends BaseModel
|
|||||||
return $entry;
|
return $entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
var $_table = 'Reports';
|
public $table = 'Reports';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,5 +37,5 @@ class ReportFile extends BaseModel
|
|||||||
return $entry;
|
return $entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
var $_table = 'ReportFiles';
|
public $table = 'ReportFiles';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,5 +10,5 @@ namespace Model;
|
|||||||
|
|
||||||
class RestAccessToken extends BaseModel
|
class RestAccessToken extends BaseModel
|
||||||
{
|
{
|
||||||
var $_table = 'RestAccessTokens';
|
public $table = 'RestAccessTokens';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,5 +36,5 @@ class Setting extends BaseModel
|
|||||||
return $obj;
|
return $obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
var $_table = 'Settings';
|
public $table = 'Settings';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,5 +10,5 @@ namespace Model;
|
|||||||
|
|
||||||
class StatusChangeLog extends BaseModel
|
class StatusChangeLog extends BaseModel
|
||||||
{
|
{
|
||||||
var $_table = 'StatusChangeLogs';
|
public $table = 'StatusChangeLogs';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,5 +31,5 @@ class UserReport extends BaseModel
|
|||||||
return $entry;
|
return $entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
var $_table = 'UserReports';
|
public $table = 'UserReports';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,5 +36,5 @@ class Module extends BaseModel
|
|||||||
{
|
{
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
var $_table = 'Modules';
|
public $table = 'Modules';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
namespace Overtime\Admin\Api;
|
namespace Overtime\Admin\Api;
|
||||||
|
|
||||||
|
|
||||||
use Classes\Approval\ApproveAdminActionManager;
|
use Classes\Approval\ApproveAdminActionManager;
|
||||||
|
|
||||||
class OvertimeActionManager extends ApproveAdminActionManager
|
class OvertimeActionManager extends ApproveAdminActionManager
|
||||||
|
|||||||
@@ -13,13 +13,13 @@ use Model\ApproveModel;
|
|||||||
|
|
||||||
class EmployeeOvertime extends ApproveModel
|
class EmployeeOvertime extends ApproveModel
|
||||||
{
|
{
|
||||||
var $_table = 'EmployeeOvertime';
|
public $table = 'EmployeeOvertime';
|
||||||
|
|
||||||
var $notificationModuleName = "Overtime Management";
|
public $notificationModuleName = "Overtime Management";
|
||||||
var $notificationUnitName = "OvertimeRequest";
|
public $notificationUnitName = "OvertimeRequest";
|
||||||
var $notificationUnitPrefix = "An";
|
public $notificationUnitPrefix = "An";
|
||||||
var $notificationUnitAdminUrl = "g=modules&n=overtime&m=module_Time_Management#tabSubordinateEmployeeOvertime";
|
public $notificationUnitAdminUrl = "g=modules&n=overtime&m=module_Time_Management#tabSubordinateEmployeeOvertime";
|
||||||
var $preApproveSettingName = "Attendance: Pre-Approve Overtime Request";
|
public $preApproveSettingName = "Attendance: Pre-Approve Overtime Request";
|
||||||
|
|
||||||
public function isMultiLevelApprovalsEnabled()
|
public function isMultiLevelApprovalsEnabled()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,8 +11,10 @@ namespace Overtime\Common\Model;
|
|||||||
class EmployeeOvertimeApproval extends EmployeeOvertime
|
class EmployeeOvertimeApproval extends EmployeeOvertime
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// @codingStandardsIgnoreStart
|
||||||
public function Find($whereOrderBy, $bindarr = false, $pkeysArr = false, $extra = array())
|
public function Find($whereOrderBy, $bindarr = false, $pkeysArr = false, $extra = array())
|
||||||
{
|
{
|
||||||
|
// @codingStandardsIgnoreEnd
|
||||||
return $this->findApprovals(new EmployeeOvertime(), $whereOrderBy, $bindarr, $pkeysArr, $extra);
|
return $this->findApprovals(new EmployeeOvertime(), $whereOrderBy, $bindarr, $pkeysArr, $extra);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ use Model\BaseModel;
|
|||||||
|
|
||||||
class OvertimeCategory extends BaseModel
|
class OvertimeCategory extends BaseModel
|
||||||
{
|
{
|
||||||
var $_table = 'OvertimeCategories';
|
public $table = 'OvertimeCategories';
|
||||||
|
|
||||||
public function getAdminAccess()
|
public function getAdminAccess()
|
||||||
{
|
{
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user