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/
|
||||
/.vagrant
|
||||
/app/config.php
|
||||
/app/data/*.log
|
||||
/app/data/*
|
||||
|
||||
@@ -3,11 +3,14 @@ services:
|
||||
before_script:
|
||||
- echo "USE mysql;\nUPDATE user SET password=PASSWORD('dev') WHERE user='root';\nFLUSH PRIVILEGES;\n" | mysql -u root
|
||||
install:
|
||||
- rm $TRAVIS_BUILD_DIR/tools/phpunit
|
||||
- composer require --dev phpunit/phpunit ^5.7
|
||||
- $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
|
||||
php:
|
||||
- '5.6'
|
||||
- '7.0'
|
||||
- '7.1'
|
||||
after_failure: "cat /tmp/icehrm.test.log"
|
||||
|
||||
15
build.xml
15
build.xml
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="icehrm-opensource" default="build">
|
||||
<!-- 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="testdir" value="${basedir}/build/test"/>
|
||||
<property name="origin" value="${basedir}"/>
|
||||
@@ -10,13 +10,16 @@
|
||||
<property name="env.Version" value="dev"/>
|
||||
<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"
|
||||
depends="prepare,lint,copyapp,release,install"
|
||||
depends="prepare,lint,phpcs,copyapp,release,install"
|
||||
description=""/>
|
||||
|
||||
<target name="buildlocal"
|
||||
depends="prepare,lint,copyapp,phpunit"
|
||||
depends="prepare,lint,phpcs,copyapp,phpunit"
|
||||
description=""/>
|
||||
|
||||
<target name="releaseapp"
|
||||
@@ -51,7 +54,6 @@
|
||||
<mkdir dir="${basedir}/build/app"/>
|
||||
<mkdir dir="${basedir}/build/release/data"/>
|
||||
<mkdir dir="${basedir}/build/release/data/${env.appname}_${env.Version}"/>
|
||||
<mkdir dir="${basedir}/src/lib"/>
|
||||
|
||||
|
||||
<property name="prepare.done" value="true"/>
|
||||
@@ -136,7 +138,8 @@
|
||||
<arg value="--extensions=php" />
|
||||
<arg value="--ignore=autoload.php" />
|
||||
<arg path="${basedir}/src" />
|
||||
<arg path="${basedir}/tests" />
|
||||
<arg path="${basedir}/test/unit" />
|
||||
<arg path="${basedir}/test/integration" />
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
@@ -206,7 +209,9 @@
|
||||
<include name=".idea/**"/>
|
||||
<include name="Vagrantfile"/>
|
||||
<include name="test/**"/>
|
||||
<include name="tools/**"/>
|
||||
<include name="robo/**"/>
|
||||
<include name="deployment/**"/>
|
||||
<include name="build/**"/>
|
||||
<include name="build.xml"/>
|
||||
<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
|
||||
define('VERSION', '20.0.0.OS');
|
||||
define('CACHE_VALUE', '20.0.0.OS');
|
||||
define('VERSION_NUMBER', '2000');
|
||||
define('VERSION_DATE', '03/09/2017');
|
||||
define('VERSION', '20.2.0.OS');
|
||||
define('CACHE_VALUE', '20.2.0.OS');
|
||||
define('VERSION_NUMBER', '2020');
|
||||
define('VERSION_DATE', '28/09/2017');
|
||||
|
||||
if(!defined('CONTACT_EMAIL')){define('CONTACT_EMAIL','icehrm@gamonoid.com');}
|
||||
if(!defined('KEY_PREFIX')){define('KEY_PREFIX','IceHrm');}
|
||||
|
||||
@@ -35,7 +35,7 @@ if(empty($user->default_module)){
|
||||
$homeLink = HOME_LINK_OTHERS;
|
||||
}
|
||||
}else{
|
||||
$defaultModule = new Module();
|
||||
$defaultModule = new \Modules\Common\Model\Module();
|
||||
$defaultModule->Load("id = ?",array($user->default_module));
|
||||
if($defaultModule->mod_group == "user"){
|
||||
$defaultModule->mod_group = "modules";
|
||||
|
||||
@@ -130,7 +130,8 @@ class ADODB_Active_Record {
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
$this->foreignName = strtolower(get_class($this)); // CFR: default foreign name
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
$migrationList = [];
|
||||
$migrationList[] = 'v20170918_200000_add_attendance_image_out';
|
||||
$migrationList[] = 'v20170908_200000_payroll_group';
|
||||
$migrationList[] = 'v20170702_190500_add_attendance_image';
|
||||
$migrationList[] = 'v20170310_190401_add_timesheet_changes';
|
||||
|
||||
@@ -23,13 +23,6 @@ class v20170702_190500_add_attendance_image extends AbstractMigration{
|
||||
SQL;
|
||||
|
||||
|
||||
return $this->executeQuery($sql);
|
||||
|
||||
$sql = <<<'SQL'
|
||||
Alter table Attendance add column `image_out` longtext default null;
|
||||
SQL;
|
||||
|
||||
|
||||
return $this->executeQuery($sql);
|
||||
}
|
||||
|
||||
@@ -40,12 +33,6 @@ SQL;
|
||||
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
|
||||
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");
|
||||
foreach ($permissions as $permTemp) {
|
||||
$permTemp->Delete();
|
||||
}
|
||||
|
||||
$moduleTemp = new Module();
|
||||
$moduleTemp = new \Modules\Common\Model\Module();
|
||||
$modulesTemp = $moduleTemp->Find("1=1");
|
||||
foreach ($modulesTemp as $moduleTemp) {
|
||||
$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
|
||||
------------------
|
||||
### Features
|
||||
|
||||
@@ -26,6 +26,7 @@ class RoboFile extends \Robo\Tasks
|
||||
$this->includeCientConfig($client);
|
||||
$this->say("DB Migrating " . $action . " for ". $client);
|
||||
$migrationManager = new \Classes\Migration\MigrationManager();
|
||||
$migrationManager->setMigrationPath(APP_BASE_PATH .'/migrations/');
|
||||
$res = $migrationManager->runMigration($action);
|
||||
$this->say("DB Migrating Result : " . print_r($res, true));
|
||||
}
|
||||
@@ -34,6 +35,7 @@ class RoboFile extends \Robo\Tasks
|
||||
$this->includeCientConfig($client);
|
||||
$this->say("Run all pending migrations " . " for ". $client);
|
||||
$migrationManager = new \Classes\Migration\MigrationManager();
|
||||
$migrationManager->setMigrationPath(APP_BASE_PATH .'/migrations/');
|
||||
$migrationManager->queueMigrations();
|
||||
$migrations = $migrationManager->getPendingMigrations();
|
||||
foreach ($migrations as $migration) {
|
||||
|
||||
@@ -48,7 +48,9 @@ $notificationManager = new \Classes\NotificationManager();
|
||||
\Classes\BaseService::getInstance()->setNotificationManager($notificationManager);
|
||||
\Classes\BaseService::getInstance()->setSettingsManager($settingsManager);
|
||||
\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);
|
||||
|
||||
|
||||
@@ -180,7 +180,7 @@ if($action == 'get'){
|
||||
exit;
|
||||
|
||||
}else if($action == 'rsp'){ // linked clicked from password change email
|
||||
$user = new User();
|
||||
$user = new \Users\Common\Model\User();
|
||||
if(!empty($_REQUEST['key'])){
|
||||
$arr = explode("-", $_REQUEST['key']);
|
||||
$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") {
|
||||
return new IceResponse(
|
||||
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)) {
|
||||
if (strtotime($attendance->out_time) >= strtotime($outDateTime)
|
||||
|
||||
@@ -12,7 +12,7 @@ use Model\BaseModel;
|
||||
|
||||
class Attendance extends BaseModel
|
||||
{
|
||||
var $_table = 'Attendance';
|
||||
public $table = 'Attendance';
|
||||
|
||||
public function getAdminAccess()
|
||||
{
|
||||
|
||||
@@ -14,7 +14,7 @@ use Model\BaseModel;
|
||||
|
||||
class AttendanceStatus extends BaseModel
|
||||
{
|
||||
var $_table = 'Attendance';
|
||||
public $table = 'Attendance';
|
||||
|
||||
public function getRecentAttendanceEntries($limit)
|
||||
{
|
||||
@@ -59,9 +59,10 @@ class AttendanceStatus extends BaseModel
|
||||
|
||||
return array_values($employees);
|
||||
}
|
||||
|
||||
// @codingStandardsIgnoreStart
|
||||
public function Find($whereOrderBy, $bindarr = false, $pkeysArr = false, $extra = array())
|
||||
{
|
||||
// @codingStandardsIgnoreEnd
|
||||
$shift = intval(SettingsManager::getInstance()->getSetting("Attendance: Shift (Minutes)"));
|
||||
$employee = new Employee();
|
||||
$data = array();
|
||||
|
||||
@@ -32,7 +32,8 @@ class AttendanceActionManager extends SubActionManager
|
||||
//Find any open punch
|
||||
$attendance = new Attendance();
|
||||
$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)
|
||||
);
|
||||
|
||||
@@ -134,7 +135,7 @@ class AttendanceActionManager extends SubActionManager
|
||||
$this->baseService->audit(IceConstants::AUDIT_ACTION, "Punch Out \ time:".$openPunch->out_time);
|
||||
} else {
|
||||
$openPunch->in_time = $dateTime;
|
||||
$openPunch->out_time = null;
|
||||
$openPunch->out_time = '0000-00-00 00:00:00';
|
||||
$openPunch->note = $req->note;
|
||||
$openPunch->image_in = $req->image;
|
||||
$openPunch->employee = $employee->id;
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Classes;
|
||||
abstract class AbstractInitialize
|
||||
{
|
||||
/* @var \Classes\BaseService $baseService */
|
||||
var $baseService = null;
|
||||
public $baseService = null;
|
||||
public function setBaseService($baseService)
|
||||
{
|
||||
$this->baseService = $baseService;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?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
|
||||
*@class AbstractModuleManager
|
||||
*/
|
||||
@@ -23,9 +24,12 @@ abstract class AbstractModuleManager
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* 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 currently logged in users profile id will be released.
|
||||
* 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.
|
||||
* 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
|
||||
* @example
|
||||
public function initializeUserClasses(){
|
||||
@@ -36,7 +40,8 @@ abstract class AbstractModuleManager
|
||||
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.
|
||||
* @method initializeFieldMappings
|
||||
* @example
|
||||
@@ -47,19 +52,22 @@ abstract class AbstractModuleManager
|
||||
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
|
||||
* @method initializeDatabaseErrorMappings
|
||||
* @example
|
||||
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");
|
||||
}
|
||||
*/
|
||||
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
|
||||
* @example
|
||||
public function setupModuleClassDefinitions(){
|
||||
@@ -133,7 +141,8 @@ abstract class AbstractModuleManager
|
||||
return $this->modulePath;
|
||||
}
|
||||
|
||||
public function setModulePath($modulePath) {
|
||||
public function setModulePath($modulePath)
|
||||
{
|
||||
$this->modulePath = $modulePath;
|
||||
}
|
||||
|
||||
|
||||
@@ -111,9 +111,7 @@ class ApprovalStatus
|
||||
|
||||
public function updateApprovalStatus($type, $id, $currentEmployee, $status)
|
||||
{
|
||||
LogManager::getInstance()->error('updateApprovalStatus 1');
|
||||
if (!$this->approvalChainExists($type, $id)) {
|
||||
LogManager::getInstance()->error('updateApprovalStatus 2');
|
||||
return new IceResponse(IceResponse::SUCCESS, array(null, null));
|
||||
}
|
||||
|
||||
@@ -136,8 +134,6 @@ class ApprovalStatus
|
||||
}
|
||||
}
|
||||
|
||||
LogManager::getInstance()->error('level '.$level);
|
||||
|
||||
$currentAL = null;
|
||||
if ($level > 0) {
|
||||
$currentAL = new EmployeeApproval();
|
||||
@@ -149,7 +145,6 @@ class ApprovalStatus
|
||||
$nextAL = new EmployeeApproval();
|
||||
$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)) {
|
||||
$nextAL = null;
|
||||
}
|
||||
@@ -188,7 +183,7 @@ class ApprovalStatus
|
||||
return new IceResponse(IceResponse::SUCCESS, array($currentAL, $nextAL));
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param $level
|
||||
* @param $employeeId
|
||||
* @return int $approverId
|
||||
|
||||
@@ -24,7 +24,7 @@ abstract class ApproveAdminActionManager extends ApproveCommonActionManager
|
||||
|
||||
$class = $this->getModelClass();
|
||||
$itemName = $this->getItemName();
|
||||
/* @var BaseModel $obj */
|
||||
/* @var BaseModel $obj */
|
||||
$nsClass = BaseService::getInstance()->getFullQualifiedModelClassName($class);
|
||||
$obj = new $nsClass();
|
||||
$obj->Load("id = ?", array($req->id));
|
||||
|
||||
@@ -51,27 +51,27 @@ use Utils\SessionUtils;
|
||||
class BaseService
|
||||
{
|
||||
|
||||
var $nonDeletables = array();
|
||||
var $errros = array();
|
||||
public $nonDeletables = array();
|
||||
public $errros = array();
|
||||
public $userTables = array();
|
||||
/* @var User $currentUser */
|
||||
var $currentUser = null;
|
||||
var $db = null;
|
||||
var $auditManager = null;
|
||||
public $currentUser = null;
|
||||
public $db = null;
|
||||
public $auditManager = null;
|
||||
/* @var NotificationManager $notificationManager */
|
||||
var $notificationManager = null;
|
||||
public $notificationManager = null;
|
||||
/* @var SettingsManager $settingsManager*/
|
||||
var $settingsManager = null;
|
||||
var $fileFields = null;
|
||||
var $moduleManagers = null;
|
||||
public $settingsManager = null;
|
||||
public $fileFields = null;
|
||||
public $moduleManagers = null;
|
||||
/* @var EmailSender $emailSender */
|
||||
var $emailSender = null;
|
||||
var $user = null;
|
||||
var $historyManagers = array();
|
||||
var $calculationHooks = array();
|
||||
var $customFieldManager = null;
|
||||
var $migrationManager = null;
|
||||
var $modelClassMap = array();
|
||||
public $emailSender = null;
|
||||
public $user = null;
|
||||
public $historyManagers = array();
|
||||
public $calculationHooks = array();
|
||||
public $customFieldManager = null;
|
||||
public $migrationManager = null;
|
||||
public $modelClassMap = array();
|
||||
|
||||
private static $me = null;
|
||||
|
||||
@@ -97,9 +97,16 @@ class BaseService
|
||||
/**
|
||||
* Get an array of objects from database
|
||||
* @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 $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 $table {String} model class name of the table to retive data
|
||||
* (e.g for Users table model class name is User)
|
||||
* @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 string $limit {String} a string to specify the limit (e.g limit 2)
|
||||
* @return {Array} an array of objects of type $table
|
||||
@@ -110,7 +117,7 @@ class BaseService
|
||||
if (!empty($mappingStr)) {
|
||||
$map = json_decode($mappingStr);
|
||||
}
|
||||
$nsTable = $this->getFullQualifiedModelClassName($table);
|
||||
$nsTable = $this->getFullQualifiedModelClassName($table);
|
||||
$obj = new $nsTable();
|
||||
|
||||
$this->checkSecureAccess("get", $obj);
|
||||
@@ -238,24 +245,46 @@ class BaseService
|
||||
/**
|
||||
* An extention of get method for the use of data tables with ability to search
|
||||
* @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 $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 $table {String} model class name of the table to retive data
|
||||
* (e.g for Users table model class name is User)
|
||||
* @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 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 $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
|
||||
* @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)) {
|
||||
$map = json_decode($mappingStr);
|
||||
}
|
||||
$nsTable = $this->getFullQualifiedModelClassName($table);
|
||||
$obj = new $nsTable();
|
||||
$nsTable = $this->getFullQualifiedModelClassName($table);
|
||||
$obj = new $nsTable();
|
||||
$this->checkSecureAccess("get", $obj);
|
||||
$query = "";
|
||||
$queryData = array();
|
||||
@@ -317,7 +346,9 @@ class BaseService
|
||||
array_unshift($queryData, $cemp);
|
||||
//$signInMappingField = SIGN_IN_ELEMENT_MAPPING_FIELD_NAME;
|
||||
$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));
|
||||
$list = $obj->Find($signInMappingField." = ?".$query.$orderBy.$limit, $queryData);
|
||||
} else {
|
||||
@@ -335,7 +366,10 @@ class BaseService
|
||||
}
|
||||
|
||||
$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);
|
||||
$childCompanies = $childCompaniesResp->getObject();
|
||||
|
||||
@@ -347,7 +381,10 @@ class BaseService
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -361,7 +398,10 @@ class BaseService
|
||||
}
|
||||
|
||||
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) {
|
||||
$indirectSupervisors = json_decode($ie->indirect_supervisors, true);
|
||||
if (in_array($cemp, $indirectSupervisors)) {
|
||||
@@ -374,10 +414,16 @@ class BaseService
|
||||
}
|
||||
|
||||
$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));
|
||||
if (!empty($subordinatesIds)) {
|
||||
$list = $obj->Find($signInMappingField . " in (" . $subordinatesIds . ") " . $query . $orderBy . $limit, $queryData);
|
||||
$list = $obj->Find(
|
||||
$signInMappingField . " in (" . $subordinatesIds . ") " . $query . $orderBy . $limit,
|
||||
$queryData
|
||||
);
|
||||
} else {
|
||||
$list = array();
|
||||
}
|
||||
@@ -401,7 +447,10 @@ class BaseService
|
||||
}
|
||||
|
||||
$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);
|
||||
$childCompanies = $childCompaniesResp->getObject();
|
||||
|
||||
@@ -413,7 +462,10 @@ class BaseService
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -427,7 +479,10 @@ class BaseService
|
||||
}
|
||||
|
||||
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) {
|
||||
$indirectSupervisors = json_decode($ie->indirect_supervisors, true);
|
||||
if (in_array($cemp, $indirectSupervisors)) {
|
||||
@@ -440,8 +495,13 @@ class BaseService
|
||||
}
|
||||
|
||||
$signInMappingField = $obj->getUserOnlyMeAccessField();
|
||||
LogManager::getInstance()->debug("Data Load Query (a1):".$signInMappingField." in (".$subordinatesIds.") ".$query.$orderBy.$limit);
|
||||
$list = $obj->Find($signInMappingField." in (".$subordinatesIds.") ".$query.$orderBy.$limit, $queryData);
|
||||
LogManager::getInstance()->debug(
|
||||
"Data Load Query (a1):".$signInMappingField." in (".$subordinatesIds.") ".$query.$orderBy.$limit
|
||||
);
|
||||
$list = $obj->Find(
|
||||
$signInMappingField." in (".$subordinatesIds.") ".$query.$orderBy.$limit,
|
||||
$queryData
|
||||
);
|
||||
} else {
|
||||
$list = $obj->Find("1=1".$query.$orderBy.$limit, $queryData);
|
||||
}
|
||||
@@ -527,15 +587,18 @@ class BaseService
|
||||
* @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 {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
|
||||
* @return {Object} an object of type $table
|
||||
*/
|
||||
|
||||
public function getElement($table, $id, $mappingStr = null, $skipSecurityCheck = false)
|
||||
{
|
||||
$nsTable = $this->getFullQualifiedModelClassName($table);
|
||||
$obj = new $nsTable();
|
||||
$nsTable = $this->getFullQualifiedModelClassName($table);
|
||||
$obj = new $nsTable();
|
||||
|
||||
if (in_array($table, $this->userTables)) {
|
||||
$cemp = $this->getCurrentProfileId();
|
||||
@@ -595,7 +658,8 @@ class BaseService
|
||||
* Add an element to a given table
|
||||
* @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 $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
|
||||
*/
|
||||
|
||||
@@ -603,8 +667,8 @@ class BaseService
|
||||
{
|
||||
$customFields = array();
|
||||
$isAdd = true;
|
||||
$nsTable = $this->getFullQualifiedModelClassName($table);
|
||||
$ele = new $nsTable();
|
||||
$nsTable = $this->getFullQualifiedModelClassName($table);
|
||||
$ele = new $nsTable();
|
||||
//LogManager::getInstance()->error("Obj:".json_encode($obj));
|
||||
|
||||
if (class_exists("\\Classes\\ProVersion")) {
|
||||
@@ -680,13 +744,13 @@ class BaseService
|
||||
|
||||
if ($isAdd) {
|
||||
$this->audit(
|
||||
IceConstants::AUDIT_ERROR,
|
||||
"Error occured while adding an object to ".$table." \ Error: ".$error
|
||||
IceConstants::AUDIT_ERROR,
|
||||
"Error occured while adding an object to ".$table." \ Error: ".$error
|
||||
);
|
||||
} else {
|
||||
$this->audit(
|
||||
IceConstants::AUDIT_ERROR,
|
||||
"Error occured while editing an object in ".$table." [id:".$ele->id."] \ Error: ".$error
|
||||
IceConstants::AUDIT_ERROR,
|
||||
"Error occured while editing an object in ".$table." [id:".$ele->id."] \ Error: ".$error
|
||||
);
|
||||
}
|
||||
return new IceResponse(IceResponse::ERROR, $this->findError($error));
|
||||
@@ -716,15 +780,16 @@ class BaseService
|
||||
/**
|
||||
* Delete an element if not the $table and $id is defined as a non deletable
|
||||
* @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
|
||||
* @return NULL
|
||||
*/
|
||||
public function deleteElement($table, $id)
|
||||
{
|
||||
$fileFields = $this->fileFields;
|
||||
$nsTable = $this->getFullQualifiedModelClassName($table);
|
||||
$ele = new $nsTable();
|
||||
$nsTable = $this->getFullQualifiedModelClassName($table);
|
||||
$ele = new $nsTable();
|
||||
|
||||
$ele->Load('id = ?', array($id));
|
||||
|
||||
@@ -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
|
||||
* @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 $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
|
||||
*/
|
||||
|
||||
@@ -799,8 +868,8 @@ class BaseService
|
||||
$values = explode("+", $value);
|
||||
|
||||
$ret = array();
|
||||
$nsTable = $this->getFullQualifiedModelClassName($table);
|
||||
$ele = new $nsTable();
|
||||
$nsTable = $this->getFullQualifiedModelClassName($table);
|
||||
$ele = new $nsTable();
|
||||
if (!empty($method)) {
|
||||
LogManager::getInstance()->debug("Call method for getFieldValues:".$method);
|
||||
LogManager::getInstance()->debug("Call method params for getFieldValues:".json_decode($methodParams));
|
||||
@@ -851,7 +920,7 @@ class BaseService
|
||||
|
||||
public function setUserTables($userTables)
|
||||
{
|
||||
$this->userTables = $userTables;
|
||||
$this->userTables = $userTables;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -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
|
||||
* @return {Integer}
|
||||
*/
|
||||
@@ -1003,7 +1073,8 @@ class BaseService
|
||||
} else {
|
||||
$accessMatrix = $object->getUserOnlyMeAccess();
|
||||
$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;
|
||||
}
|
||||
|
||||
@@ -1022,7 +1093,8 @@ class BaseService
|
||||
} else {
|
||||
$accessMatrix = $object->getUserOnlyMeAccess();
|
||||
$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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
* @param $type {String} Action type
|
||||
* @param $object {Object} object to test access
|
||||
@@ -1077,8 +1150,10 @@ class BaseService
|
||||
$userOnlyMeAccessRequestField = $object->getUserOnlyMeAccessRequestField();
|
||||
|
||||
//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 (in_array($type, $accessMatrix) && $_REQUEST[$object->getUserOnlyMeAccessField()] == $this->currentUser->$userOnlyMeAccessRequestField) {
|
||||
if (isset($_REQUEST[$object->getUserOnlyMeAccessField()])
|
||||
&& isset($this->currentUser->$userOnlyMeAccessRequestField)) {
|
||||
if (in_array($type, $accessMatrix) && $_REQUEST[$object->getUserOnlyMeAccessField()]
|
||||
== $this->currentUser->$userOnlyMeAccessRequestField) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1188,7 +1263,11 @@ class BaseService
|
||||
|
||||
//Check if user has permissions to this module
|
||||
//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 (!empty(BaseService::getInstance()->getCurrentUser()->user_roles)) {
|
||||
@@ -1216,7 +1295,11 @@ class BaseService
|
||||
|
||||
//Check if user has permissions to this module
|
||||
//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 (!empty($user->user_roles)) {
|
||||
@@ -1396,7 +1479,7 @@ class BaseService
|
||||
|
||||
public function getItemFromCache($class, $id)
|
||||
{
|
||||
$class = $this->getFullQualifiedModelClassName($class);
|
||||
$class = $this->getFullQualifiedModelClassName($class);
|
||||
$data = MemcacheService::getInstance()->get($class."-".$id);
|
||||
if ($data !== false) {
|
||||
return unserialize($data);
|
||||
@@ -1478,10 +1561,11 @@ END;
|
||||
return $this->customFieldManager;
|
||||
}
|
||||
|
||||
public function getFullQualifiedModelClassName($class) {
|
||||
if ($this->modelClassMap[$class]) {
|
||||
return $this->modelClassMap[$class];
|
||||
}
|
||||
return '\\Model\\'.$class;
|
||||
}
|
||||
public function getFullQualifiedModelClassName($class)
|
||||
{
|
||||
if ($this->modelClassMap[$class]) {
|
||||
return $this->modelClassMap[$class];
|
||||
}
|
||||
return '\\Model\\'.$class;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@ namespace Classes\Cron;
|
||||
|
||||
class CronUtils
|
||||
{
|
||||
var $clientBasePath;
|
||||
var $cronFile;
|
||||
public $clientBasePath;
|
||||
public $cronFile;
|
||||
|
||||
private static $me = null;
|
||||
|
||||
|
||||
@@ -24,7 +24,8 @@ abstract class EmailIceTask implements IceTask
|
||||
foreach ($emailList as $employeeId => $emailData) {
|
||||
$ccList = array();
|
||||
if (SettingsManager::getInstance()->getSetting(
|
||||
'Notifications: Copy Document Expiry Emails to Manager') == '1'
|
||||
'Notifications: Copy Document Expiry Emails to Manager'
|
||||
) == '1'
|
||||
) {
|
||||
$employee = new Employee();
|
||||
$employee->Load("id = ?", array($employeeId));
|
||||
|
||||
@@ -16,7 +16,7 @@ use Users\Common\Model\User;
|
||||
abstract class EmailSender
|
||||
{
|
||||
/* @var \Classes\SettingsManager $settings */
|
||||
var $settings = null;
|
||||
public $settings = null;
|
||||
public function __construct($settings)
|
||||
{
|
||||
$this->settings = $settings;
|
||||
|
||||
@@ -19,7 +19,13 @@ class PHPMailer extends EmailSender
|
||||
}
|
||||
|
||||
protected function sendMail(
|
||||
$subject, $body, $toEmail, $fromEmail, $replyToEmail = null, $ccList = array(), $bccList = array()
|
||||
$subject,
|
||||
$body,
|
||||
$toEmail,
|
||||
$fromEmail,
|
||||
$replyToEmail = null,
|
||||
$ccList = array(),
|
||||
$bccList = array()
|
||||
) {
|
||||
|
||||
try {
|
||||
|
||||
@@ -19,7 +19,13 @@ class SMTPEmailSender extends EmailSender
|
||||
}
|
||||
|
||||
protected function sendMail(
|
||||
$subject, $body, $toEmail, $fromEmail, $replyToEmail = null, $ccList = array(), $bccList = array()
|
||||
$subject,
|
||||
$body,
|
||||
$toEmail,
|
||||
$fromEmail,
|
||||
$replyToEmail = null,
|
||||
$ccList = array(),
|
||||
$bccList = array()
|
||||
) {
|
||||
|
||||
try {
|
||||
|
||||
@@ -12,7 +12,7 @@ use Utils\LogManager;
|
||||
|
||||
class SNSEmailSender extends EmailSender
|
||||
{
|
||||
var $ses = null;
|
||||
private $ses = null;
|
||||
public function __construct($settings)
|
||||
{
|
||||
parent::__construct($settings);
|
||||
@@ -25,7 +25,13 @@ class SNSEmailSender extends EmailSender
|
||||
}
|
||||
|
||||
protected function sendMail(
|
||||
$subject, $body, $toEmail, $fromEmail, $replyToEmail = null, $ccList = array(), $bccList = array()
|
||||
$subject,
|
||||
$body,
|
||||
$toEmail,
|
||||
$fromEmail,
|
||||
$replyToEmail = null,
|
||||
$ccList = array(),
|
||||
$bccList = array()
|
||||
) {
|
||||
|
||||
try {
|
||||
|
||||
@@ -97,7 +97,7 @@ class FileService
|
||||
//Resize image to 100
|
||||
|
||||
$img = new \Classes\SimpleImage("/tmp/".$file->filename."_orig");
|
||||
$img->fit_to_width(100);
|
||||
$img->fitToWidth(100);
|
||||
$img->save("/tmp/".$file->filename);
|
||||
|
||||
$uploadFilesToS3Key = SettingsManager::getInstance()->getSetting(
|
||||
|
||||
@@ -14,9 +14,9 @@ class IceResponse
|
||||
const SUCCESS = "SUCCESS";
|
||||
const ERROR = "ERROR";
|
||||
|
||||
var $status;
|
||||
var $data;
|
||||
var $code;
|
||||
public $status;
|
||||
public $data;
|
||||
public $code;
|
||||
|
||||
public function __construct($status, $data = null, $code = null)
|
||||
{
|
||||
|
||||
@@ -14,18 +14,13 @@ use Utils\LogManager;
|
||||
class MigrationManager
|
||||
{
|
||||
|
||||
private $migration_path;
|
||||
private $migrationPath;
|
||||
|
||||
protected $db = null;
|
||||
|
||||
public function __construct()
|
||||
public function setMigrationPath($migrationPath)
|
||||
{
|
||||
$this->migration_path = APP_BASE_PATH .'/migrations/';
|
||||
}
|
||||
|
||||
public function setMigrationPath($migration_path)
|
||||
{
|
||||
$this->migration_path = $migration_path;
|
||||
$this->migrationPath = $migrationPath;
|
||||
}
|
||||
|
||||
public function getMigrationById($id)
|
||||
@@ -63,10 +58,10 @@ class MigrationManager
|
||||
{
|
||||
|
||||
$migrations = array();
|
||||
$ams = scandir($this->migration_path);
|
||||
$ams = scandir($this->migrationPath);
|
||||
foreach ($ams as $am) {
|
||||
if (is_file($this->migration_path . $am)) {
|
||||
$migrations[$am] = $this->migration_path . $am;
|
||||
if (is_file($this->migrationPath . $am) && $am !== '.' && $am !== '..' && !empty($am)) {
|
||||
$migrations[$am] = $this->migrationPath . $am;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,19 +79,28 @@ class MigrationManager
|
||||
if ($file == 'list.php') {
|
||||
continue;
|
||||
}
|
||||
$migration = new Migration();
|
||||
$migration->file = $file;
|
||||
$parts = explode("_", $file);
|
||||
$migration->version = intval($parts[1]);
|
||||
$migration->created = date("Y-m-d H:i:s");
|
||||
$migration->updated = date("Y-m-d H:i:s");
|
||||
$migration->status = 'Pending';
|
||||
$migration->Save();
|
||||
$this->createMigration($file);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function createMigration($file)
|
||||
{
|
||||
if (file_exists($this->migrationPath . $file)) {
|
||||
$migration = new Migration();
|
||||
$migration->file = $file;
|
||||
$parts = explode("_", $file);
|
||||
$migration->version = intval($parts[1]);
|
||||
$migration->created = date("Y-m-d H:i:s");
|
||||
$migration->updated = date("Y-m-d H:i:s");
|
||||
$migration->status = 'Pending';
|
||||
$migration->Save();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function runPendingMigrations()
|
||||
{
|
||||
$migrations = $this->getPendingMigrations();
|
||||
@@ -134,6 +138,27 @@ class MigrationManager
|
||||
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
|
||||
* @return bool
|
||||
@@ -144,20 +169,14 @@ class MigrationManager
|
||||
return false;
|
||||
}
|
||||
|
||||
$path = $this->migration_path . $migration->file;
|
||||
if (!file_exists($path)) {
|
||||
/* @var AbstractMigration $migObject */
|
||||
$migObject = $this->getMigrationObject($migration->file);
|
||||
if (!$migObject) {
|
||||
return false;
|
||||
}
|
||||
$migrationName = str_replace('.php', '', $migration->file);
|
||||
if (!class_exists('\\Classes\\Migration\\'.$migrationName)) {
|
||||
include $path;
|
||||
}
|
||||
/* @var AbstractMigration $migClass */
|
||||
$migrationName = '\\Classes\\Migration\\'.$migrationName;
|
||||
$migClass = new $migrationName($migration->file);
|
||||
$res = $migClass->up();
|
||||
$res = $migObject->up();
|
||||
if (!$res) {
|
||||
$migration->last_error = $migClass->getLastError();
|
||||
$migration->last_error = $migObject->getLastError();
|
||||
$migration->status = "UpError";
|
||||
$migration->updated = date("Y-m-d H:i:s");
|
||||
$migration->Save();
|
||||
@@ -179,21 +198,14 @@ class MigrationManager
|
||||
return false;
|
||||
}
|
||||
|
||||
$path = $this->migration_path . $migration->file;
|
||||
if (!file_exists($path)) {
|
||||
/* @var AbstractMigration $migObject */
|
||||
$migObject = $this->getMigrationObject($migration->file);
|
||||
if (!$migObject) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$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();
|
||||
$res = $migObject->down();
|
||||
if (!$res) {
|
||||
$migration->last_error = $migClass->getLastError();
|
||||
$migration->last_error = $migObject->getLastError();
|
||||
$migration->status = "DownError";
|
||||
$migration->updated = date("Y-m-d H:i:s");
|
||||
$migration->Save();
|
||||
@@ -211,7 +223,7 @@ class MigrationManager
|
||||
$migration = new Migration();
|
||||
$migration->Load("1 = 1 order by id desc limit 1");
|
||||
|
||||
include $this->migration_path . "list.php";
|
||||
include $this->migrationPath . "list.php";
|
||||
/* @var array $migrationList */
|
||||
if (count($migrationList) > 0 && (empty($migration->id) || $migrationList[0].".php" != $migration->file)) {
|
||||
LogManager::getInstance()->info("ensureMigrations - execute migrations");
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Classes\ModuleBuilder;
|
||||
|
||||
class ModuleBuilder
|
||||
{
|
||||
var $modules = array();
|
||||
public $modules = array();
|
||||
|
||||
/**
|
||||
* @param ModuleTab $module
|
||||
|
||||
@@ -11,17 +11,24 @@ namespace Classes\ModuleBuilder;
|
||||
class ModuleTab
|
||||
{
|
||||
public $name;
|
||||
var $class;
|
||||
var $label;
|
||||
var $adapterName;
|
||||
var $filter;
|
||||
var $orderBy;
|
||||
public $class;
|
||||
public $label;
|
||||
public $adapterName;
|
||||
public $filter;
|
||||
public $orderBy;
|
||||
public $isActive = false;
|
||||
public $isInsideGroup = false;
|
||||
var $options = array();
|
||||
public $options = array();
|
||||
|
||||
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->class = $class;
|
||||
@@ -50,7 +57,8 @@ class ModuleTab
|
||||
$active = ($this->isActive)?" active":"";
|
||||
$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.'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>';
|
||||
|
||||
return $html;
|
||||
@@ -60,9 +68,12 @@ class ModuleTab
|
||||
{
|
||||
$js = '';
|
||||
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 {
|
||||
$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) {
|
||||
|
||||
@@ -10,9 +10,9 @@ namespace Classes\ModuleBuilder;
|
||||
|
||||
class ModuleTabGroup
|
||||
{
|
||||
var $name;
|
||||
var $label;
|
||||
var $isActive = false;
|
||||
public $name;
|
||||
public $label;
|
||||
public $isActive = false;
|
||||
public $modules = array();
|
||||
|
||||
public function __construct($name, $label)
|
||||
@@ -37,7 +37,9 @@ class ModuleTabGroup
|
||||
$active = ($this->isActive)?" active":"";
|
||||
|
||||
$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">';
|
||||
|
||||
foreach ($this->modules as $module) {
|
||||
|
||||
@@ -7,7 +7,7 @@ use Users\Common\Model\User;
|
||||
class NotificationManager
|
||||
{
|
||||
/* @var \Classes\BaseService $baseService */
|
||||
var $baseService;
|
||||
public $baseService;
|
||||
|
||||
public function setBaseService($baseService)
|
||||
{
|
||||
@@ -15,11 +15,18 @@ class NotificationManager
|
||||
}
|
||||
|
||||
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();
|
||||
$toUser = null;
|
||||
$toUser = null;
|
||||
if (!empty($toEmployee)) {
|
||||
$userEmp->Load("employee = ?", array($toEmployee));
|
||||
|
||||
@@ -91,7 +98,7 @@ class NotificationManager
|
||||
$notification = new Notification();
|
||||
|
||||
$listUnread = $notification->Find("toUser = ? and status = ?", array($userId,'Unread'));
|
||||
/* @var Notification $not */
|
||||
/* @var Notification $not */
|
||||
foreach ($listUnread as $not) {
|
||||
$not->status = "Read";
|
||||
$not->Save();
|
||||
|
||||
@@ -75,12 +75,12 @@ class ReportHandler
|
||||
return $this->generateReport($reportBuilder, $report, $reportData);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ReportBuilder $reportBuilder
|
||||
* @param $report
|
||||
* @param $data
|
||||
* @return array
|
||||
*/
|
||||
/**
|
||||
* @param ReportBuilder $reportBuilder
|
||||
* @param $report
|
||||
* @param $data
|
||||
* @return array
|
||||
*/
|
||||
protected function generateReport($reportBuilder, $report, $data)
|
||||
{
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ class RestApiManager
|
||||
|
||||
private static $me = null;
|
||||
|
||||
var $endPoints = array();
|
||||
protected $endPoints = array();
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
|
||||
@@ -98,10 +98,14 @@ class RestEndPoint
|
||||
$headers = trim($_SERVER["HTTP_AUTHORIZATION"]);
|
||||
} elseif (function_exists('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(
|
||||
array_map('ucwords',
|
||||
array_keys($requestHeaders)),
|
||||
array_map(
|
||||
'ucwords',
|
||||
array_keys($requestHeaders)
|
||||
),
|
||||
array_values($requestHeaders)
|
||||
);
|
||||
//print_r($requestHeaders);
|
||||
|
||||
@@ -7,9 +7,9 @@ use Utils\LogManager;
|
||||
class S3FileSystem
|
||||
{
|
||||
|
||||
var $s3;
|
||||
var $key;
|
||||
var $secret;
|
||||
protected $s3;
|
||||
protected $key;
|
||||
protected $secret;
|
||||
|
||||
public function __construct($key, $secret)
|
||||
{
|
||||
@@ -89,7 +89,7 @@ class S3FileSystem
|
||||
$signsz = implode("\n", $pieces = array('GET', null, null, $expiresTimestamp, $signpath));
|
||||
|
||||
// Calculate the hash
|
||||
$signature = $this->el_crypto_hmacSHA1($this->secret, $signsz);
|
||||
$signature = $this->elCryptoHmacSHA1($this->secret, $signsz);
|
||||
// ... to the query string ...
|
||||
$qs = http_build_query($pieces = array(
|
||||
'AWSAccessKeyId' => $this->key,
|
||||
@@ -100,7 +100,7 @@ class S3FileSystem
|
||||
return $url.'?'.$qs;
|
||||
}
|
||||
|
||||
private function el_crypto_hmacSHA1($key, $data, $blocksize = 64)
|
||||
private function elCryptoHmacSHA1($key, $data, $blocksize = 64)
|
||||
{
|
||||
if (strlen($key) > $blocksize) {
|
||||
$key = pack('H*', sha1($key));
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
* @package SimpleImage class
|
||||
* @version 2.5.5
|
||||
* @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
|
||||
* @copyright A Beautiful Site, LLC
|
||||
*
|
||||
@@ -28,7 +27,12 @@ class SimpleImage
|
||||
*/
|
||||
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
|
||||
@@ -44,7 +48,7 @@ class SimpleImage
|
||||
* @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) {
|
||||
$this->load($filename);
|
||||
@@ -58,7 +62,7 @@ class SimpleImage
|
||||
* Destroy image resource
|
||||
*
|
||||
*/
|
||||
function __destruct()
|
||||
public function __destruct()
|
||||
{
|
||||
if (get_resource_type($this->image) === 'gd') {
|
||||
imagedestroy($this->image);
|
||||
@@ -78,7 +82,7 @@ class SimpleImage
|
||||
* @return SimpleImage
|
||||
*
|
||||
*/
|
||||
function adaptive_resize($width, $height = null)
|
||||
public function adaptiveResize($width, $height = null)
|
||||
{
|
||||
|
||||
return $this->thumbnail($width, $height);
|
||||
@@ -90,7 +94,7 @@ class SimpleImage
|
||||
* @return SimpleImage
|
||||
*
|
||||
*/
|
||||
function auto_orient()
|
||||
public function autoOrient()
|
||||
{
|
||||
|
||||
switch ($this->original_info['exif']['Orientation']) {
|
||||
@@ -143,7 +147,7 @@ class 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
|
||||
@@ -181,7 +185,7 @@ class SimpleImage
|
||||
* @return SimpleImage
|
||||
*
|
||||
*/
|
||||
function blur($type = 'selective', $passes = 1)
|
||||
public function blur($type = 'selective', $passes = 1)
|
||||
{
|
||||
switch (strtolower($type)) {
|
||||
case 'gaussian':
|
||||
@@ -205,9 +209,9 @@ class 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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -236,11 +240,18 @@ class SimpleImage
|
||||
* @return SimpleImage
|
||||
*
|
||||
*/
|
||||
function colorize($color, $opacity)
|
||||
public function colorize($color, $opacity)
|
||||
{
|
||||
$rgba = $this->normalize_color($color);
|
||||
$alpha = $this->keep_within(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);
|
||||
$rgba = $this->normalizeColor($color);
|
||||
$alpha = $this->keepWithin(127 - (127 * $opacity), 0, 127);
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -255,7 +266,7 @@ class SimpleImage
|
||||
* @return SimpleImage
|
||||
*
|
||||
*/
|
||||
function create($width, $height = null, $color = null)
|
||||
public function create($width, $height = null, $color = null)
|
||||
{
|
||||
|
||||
$height = $height ?: $width;
|
||||
@@ -265,7 +276,7 @@ class SimpleImage
|
||||
$this->original_info = array(
|
||||
'width' => $width,
|
||||
'height' => $height,
|
||||
'orientation' => $this->get_orientation(),
|
||||
'orientation' => $this->getOrientation(),
|
||||
'exif' => null,
|
||||
'format' => 'png',
|
||||
'mime' => 'image/png'
|
||||
@@ -289,7 +300,7 @@ class SimpleImage
|
||||
* @return SimpleImage
|
||||
*
|
||||
*/
|
||||
function crop($x1, $y1, $x2, $y2)
|
||||
public function crop($x1, $y1, $x2, $y2)
|
||||
{
|
||||
|
||||
// Determine crop size
|
||||
@@ -324,11 +335,11 @@ class SimpleImage
|
||||
* @return SimpleImage
|
||||
*
|
||||
*/
|
||||
function desaturate($percentage = 100)
|
||||
public function desaturate($percentage = 100)
|
||||
{
|
||||
|
||||
// Determine percentage
|
||||
$percentage = $this->keep_within($percentage, 0, 100);
|
||||
$percentage = $this->keepWithin($percentage, 0, 100);
|
||||
|
||||
if ($percentage === 100) {
|
||||
imagefilter($this->image, IMG_FILTER_GRAYSCALE);
|
||||
@@ -341,7 +352,7 @@ class SimpleImage
|
||||
imagefilter($new, IMG_FILTER_GRAYSCALE);
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
@@ -354,7 +365,7 @@ class SimpleImage
|
||||
* @return SimpleImage
|
||||
*
|
||||
*/
|
||||
function edges()
|
||||
public function edges()
|
||||
{
|
||||
imagefilter($this->image, IMG_FILTER_EDGEDETECT);
|
||||
return $this;
|
||||
@@ -366,7 +377,7 @@ class SimpleImage
|
||||
* @return SimpleImage
|
||||
*
|
||||
*/
|
||||
function emboss()
|
||||
public function emboss()
|
||||
{
|
||||
imagefilter($this->image, IMG_FILTER_EMBOSS);
|
||||
return $this;
|
||||
@@ -381,10 +392,10 @@ class 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']);
|
||||
imagealphablending($this->image, false);
|
||||
imagesavealpha($this->image, true);
|
||||
@@ -401,7 +412,7 @@ class SimpleImage
|
||||
* @return SimpleImage
|
||||
*
|
||||
*/
|
||||
function fit_to_height($height)
|
||||
public function fitToHeight($height)
|
||||
{
|
||||
|
||||
$aspect_ratio = $this->height / $this->width;
|
||||
@@ -418,7 +429,7 @@ class SimpleImage
|
||||
* @return SimpleImage
|
||||
*
|
||||
*/
|
||||
function fit_to_width($width)
|
||||
public function fitToWidth($width)
|
||||
{
|
||||
|
||||
$aspect_ratio = $this->height / $this->width;
|
||||
@@ -435,7 +446,7 @@ class SimpleImage
|
||||
* @return SimpleImage
|
||||
*
|
||||
*/
|
||||
function flip($direction)
|
||||
public function flip($direction)
|
||||
{
|
||||
|
||||
$new = imagecreatetruecolor($this->width, $this->height);
|
||||
@@ -466,7 +477,7 @@ class SimpleImage
|
||||
* @return int
|
||||
*
|
||||
*/
|
||||
function get_height()
|
||||
public function getHeight()
|
||||
{
|
||||
return $this->height;
|
||||
}
|
||||
@@ -477,7 +488,7 @@ class SimpleImage
|
||||
* @return string portrait|landscape|square
|
||||
*
|
||||
*/
|
||||
function get_orientation()
|
||||
public function getOrientation()
|
||||
{
|
||||
|
||||
if (imagesx($this->image) > imagesy($this->image)) {
|
||||
@@ -504,7 +515,7 @@ class SimpleImage
|
||||
* )</pre>
|
||||
*
|
||||
*/
|
||||
function get_original_info()
|
||||
public function getOriginalInfo()
|
||||
{
|
||||
return $this->original_info;
|
||||
}
|
||||
@@ -515,7 +526,7 @@ class SimpleImage
|
||||
* @return int
|
||||
*
|
||||
*/
|
||||
function get_width()
|
||||
public function getWidth()
|
||||
{
|
||||
return $this->width;
|
||||
}
|
||||
@@ -526,7 +537,7 @@ class SimpleImage
|
||||
* @return SimpleImage
|
||||
*
|
||||
*/
|
||||
function invert()
|
||||
public function invert()
|
||||
{
|
||||
imagefilter($this->image, IMG_FILTER_NEGATE);
|
||||
return $this;
|
||||
@@ -541,7 +552,7 @@ class SimpleImage
|
||||
* @throws Exception
|
||||
*
|
||||
*/
|
||||
function load($filename)
|
||||
public function load($filename)
|
||||
{
|
||||
|
||||
// Require GD library
|
||||
@@ -549,7 +560,7 @@ class SimpleImage
|
||||
throw new Exception('Required extension GD is not loaded.');
|
||||
}
|
||||
$this->filename = $filename;
|
||||
return $this->get_meta_data();
|
||||
return $this->getMetaData();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -560,15 +571,17 @@ class SimpleImage
|
||||
* @return SimpleImage
|
||||
*
|
||||
*/
|
||||
function load_base64($base64string)
|
||||
public function loadBase64($base64string)
|
||||
{
|
||||
if (!extension_loaded('gd')) {
|
||||
throw new Exception('Required extension GD is not loaded.');
|
||||
}
|
||||
//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);
|
||||
return $this->get_meta_data();
|
||||
return $this->getMetaData();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -577,7 +590,7 @@ class SimpleImage
|
||||
* @return SimpleImage
|
||||
*
|
||||
*/
|
||||
function mean_remove()
|
||||
public function meanRemove()
|
||||
{
|
||||
imagefilter($this->image, IMG_FILTER_MEAN_REMOVAL);
|
||||
return $this;
|
||||
@@ -591,11 +604,11 @@ class SimpleImage
|
||||
* @throws Exception
|
||||
*
|
||||
*/
|
||||
function opacity($opacity)
|
||||
public function opacity($opacity)
|
||||
{
|
||||
|
||||
// Determine opacity
|
||||
$opacity = $this->keep_within($opacity, 0, 1) * 100;
|
||||
$opacity = $this->keepWithin($opacity, 0, 1) * 100;
|
||||
|
||||
// Make a copy of the image
|
||||
$copy = imagecreatetruecolor($this->width, $this->height);
|
||||
@@ -607,7 +620,7 @@ class SimpleImage
|
||||
$this->create($this->width, $this->height, array(0, 0, 0, 127));
|
||||
|
||||
// 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);
|
||||
|
||||
return $this;
|
||||
@@ -622,7 +635,7 @@ class SimpleImage
|
||||
* @throws Exception
|
||||
*
|
||||
*/
|
||||
function output($format = null, $quality = null)
|
||||
public function output($format = null, $quality = null)
|
||||
{
|
||||
|
||||
// Determine quality
|
||||
@@ -642,7 +655,8 @@ class SimpleImage
|
||||
$mimetype = 'image/png';
|
||||
break;
|
||||
default:
|
||||
$info = (empty($this->imagestring)) ? getimagesize($this->filename) : getimagesizefromstring($this->imagestring);
|
||||
$info = (empty($this->imagestring))
|
||||
? getimagesize($this->filename) : getimagesizefromstring($this->imagestring);
|
||||
$mimetype = $info['mime'];
|
||||
unset($info);
|
||||
break;
|
||||
@@ -676,7 +690,7 @@ class SimpleImage
|
||||
* @throws Exception
|
||||
*
|
||||
*/
|
||||
function output_base64($format = null, $quality = null)
|
||||
public function outputBase64($format = null, $quality = null)
|
||||
{
|
||||
|
||||
// Determine quality
|
||||
@@ -739,7 +753,7 @@ class 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
|
||||
@@ -792,7 +806,17 @@ class SimpleImage
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
@@ -805,7 +829,7 @@ class SimpleImage
|
||||
* @return SimpleImage
|
||||
*
|
||||
*/
|
||||
function pixelate($block_size = 10)
|
||||
public function pixelate($block_size = 10)
|
||||
{
|
||||
imagefilter($this->image, IMG_FILTER_PIXELATE, $block_size, true);
|
||||
return $this;
|
||||
@@ -820,7 +844,7 @@ class SimpleImage
|
||||
* @return SimpleImage
|
||||
*
|
||||
*/
|
||||
function resize($width, $height)
|
||||
public function resize($width, $height)
|
||||
{
|
||||
|
||||
// Generate new GD image
|
||||
@@ -832,7 +856,12 @@ class SimpleImage
|
||||
$palletsize = imagecolorstotal($this->image);
|
||||
if ($transparent_index >= 0 && $transparent_index < $palletsize) {
|
||||
$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);
|
||||
imagecolortransparent($new, $transparent_index);
|
||||
}
|
||||
@@ -863,13 +892,13 @@ class SimpleImage
|
||||
* @return SimpleImage
|
||||
*
|
||||
*/
|
||||
function rotate($angle, $bg_color = '#000000')
|
||||
public function rotate($angle, $bg_color = '#000000')
|
||||
{
|
||||
|
||||
// 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']);
|
||||
$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);
|
||||
imagealphablending($new, true);
|
||||
|
||||
@@ -894,14 +923,14 @@ class SimpleImage
|
||||
* @throws Exception
|
||||
*
|
||||
*/
|
||||
function save($filename = null, $quality = null, $format = null)
|
||||
public function save($filename = null, $quality = null, $format = null)
|
||||
{
|
||||
|
||||
// Determine quality, filename, and format
|
||||
$quality = $quality ?: $this->quality;
|
||||
$filename = $filename ?: $this->filename;
|
||||
if (!$format) {
|
||||
$format = $this->file_ext($filename) ?: $this->original_info['format'];
|
||||
$format = $this->fileExt($filename) ?: $this->original_info['format'];
|
||||
}
|
||||
|
||||
// Create the image
|
||||
@@ -934,7 +963,7 @@ class SimpleImage
|
||||
* @return SimpleImage
|
||||
*
|
||||
*/
|
||||
function sepia()
|
||||
public function sepia()
|
||||
{
|
||||
imagefilter($this->image, IMG_FILTER_GRAYSCALE);
|
||||
imagefilter($this->image, IMG_FILTER_COLORIZE, 100, 50, 0);
|
||||
@@ -947,7 +976,7 @@ class SimpleImage
|
||||
* @return SimpleImage
|
||||
*
|
||||
*/
|
||||
function sketch()
|
||||
public function sketch()
|
||||
{
|
||||
imagefilter($this->image, IMG_FILTER_MEAN_REMOVAL);
|
||||
return $this;
|
||||
@@ -961,9 +990,9 @@ class 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;
|
||||
}
|
||||
|
||||
@@ -982,14 +1011,21 @@ class SimpleImage
|
||||
* @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
|
||||
$angle = 0;
|
||||
|
||||
// Determine text color
|
||||
$rgba = $this->normalize_color($color);
|
||||
$rgba = $this->normalizeColor($color);
|
||||
$color = imagecolorallocatealpha($this->image, $rgba['r'], $rgba['g'], $rgba['b'], $rgba['a']);
|
||||
|
||||
// Determine textbox size
|
||||
@@ -1030,7 +1066,7 @@ class SimpleImage
|
||||
$x = 0 + $x_offset;
|
||||
$y = ($this->height / 2) - (($box_height / 2) - $box_height) + $y_offset;
|
||||
break;
|
||||
case 'right';
|
||||
case 'right':
|
||||
$x = $this->width - $box_width + $x_offset;
|
||||
$y = ($this->height / 2) - (($box_height / 2) - $box_height) + $y_offset;
|
||||
break;
|
||||
@@ -1061,7 +1097,7 @@ class SimpleImage
|
||||
* @return SimpleImage
|
||||
*
|
||||
*/
|
||||
function thumbnail($width, $height = null)
|
||||
public function thumbnail($width, $height = null)
|
||||
{
|
||||
|
||||
// Determine height
|
||||
@@ -1073,9 +1109,9 @@ class SimpleImage
|
||||
|
||||
// Fit to height/width
|
||||
if ($new_aspect_ratio > $current_aspect_ratio) {
|
||||
$this->fit_to_height($height);
|
||||
$this->fitToHeight($height);
|
||||
} else {
|
||||
$this->fit_to_width($width);
|
||||
$this->fitToWidth($width);
|
||||
}
|
||||
$left = floor(($this->width / 2) - ($width / 2));
|
||||
$top = floor(($this->height / 2) - ($height / 2));
|
||||
@@ -1092,7 +1128,7 @@ class SimpleImage
|
||||
* @return string
|
||||
*
|
||||
*/
|
||||
protected function file_ext($filename)
|
||||
protected function fileExt($filename)
|
||||
{
|
||||
|
||||
if (!preg_match('/\./', $filename)) {
|
||||
@@ -1111,7 +1147,7 @@ class SimpleImage
|
||||
* @throws Exception
|
||||
*
|
||||
*/
|
||||
protected function get_meta_data()
|
||||
protected function getMetaData()
|
||||
{
|
||||
//gather meta data
|
||||
if (empty($this->imagestring)) {
|
||||
@@ -1140,8 +1176,10 @@ class SimpleImage
|
||||
$this->original_info = array(
|
||||
'width' => $info[0],
|
||||
'height' => $info[1],
|
||||
'orientation' => $this->get_orientation(),
|
||||
'exif' => function_exists('exif_read_data') && $info['mime'] === 'image/jpeg' && $this->imagestring === null ? $this->exif = @exif_read_data($this->filename) : null,
|
||||
'orientation' => $this->getOrientation(),
|
||||
'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']),
|
||||
'mime' => $info['mime']
|
||||
);
|
||||
@@ -1170,7 +1208,7 @@ class SimpleImage
|
||||
* @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
|
||||
@@ -1205,7 +1243,13 @@ class SimpleImage
|
||||
$alpha += 127 * $pct;
|
||||
}
|
||||
// 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
|
||||
if (!imagesetpixel($src_im, $x, $y, $alphacolorxy)) {
|
||||
return;
|
||||
@@ -1233,7 +1277,7 @@ class SimpleImage
|
||||
* @return int|float
|
||||
*
|
||||
*/
|
||||
protected function keep_within($value, $min, $max)
|
||||
protected function keepWithin($value, $min, $max)
|
||||
{
|
||||
|
||||
if ($value < $min) {
|
||||
@@ -1256,7 +1300,7 @@ class SimpleImage
|
||||
* @return array|bool
|
||||
*
|
||||
*/
|
||||
protected function normalize_color($color)
|
||||
protected function normalizeColor($color)
|
||||
{
|
||||
|
||||
if (is_string($color)) {
|
||||
@@ -1286,17 +1330,17 @@ class SimpleImage
|
||||
} elseif (is_array($color) && (count($color) == 3 || count($color) == 4)) {
|
||||
if (isset($color['r'], $color['g'], $color['b'])) {
|
||||
return array(
|
||||
'r' => $this->keep_within($color['r'], 0, 255),
|
||||
'g' => $this->keep_within($color['g'], 0, 255),
|
||||
'b' => $this->keep_within($color['b'], 0, 255),
|
||||
'a' => $this->keep_within(isset($color['a']) ? $color['a'] : 0, 0, 127)
|
||||
'r' => $this->keepWithin($color['r'], 0, 255),
|
||||
'g' => $this->keepWithin($color['g'], 0, 255),
|
||||
'b' => $this->keepWithin($color['b'], 0, 255),
|
||||
'a' => $this->keepWithin(isset($color['a']) ? $color['a'] : 0, 0, 127)
|
||||
);
|
||||
} elseif (isset($color[0], $color[1], $color[2])) {
|
||||
return array(
|
||||
'r' => $this->keep_within($color[0], 0, 255),
|
||||
'g' => $this->keep_within($color[1], 0, 255),
|
||||
'b' => $this->keep_within($color[2], 0, 255),
|
||||
'a' => $this->keep_within(isset($color[3]) ? $color[3] : 0, 0, 127)
|
||||
'r' => $this->keepWithin($color[0], 0, 255),
|
||||
'g' => $this->keepWithin($color[1], 0, 255),
|
||||
'b' => $this->keepWithin($color[2], 0, 255),
|
||||
'a' => $this->keepWithin(isset($color[3]) ? $color[3] : 0, 0, 127)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,11 +24,11 @@ namespace Classes;
|
||||
|
||||
abstract class SubActionManager
|
||||
{
|
||||
var $user = null;
|
||||
public $user = null;
|
||||
/* @var \Classes\BaseService $baseService*/
|
||||
protected $baseService = null;
|
||||
var $emailTemplates = null;
|
||||
var $emailSender = null;
|
||||
public $emailTemplates = null;
|
||||
protected $emailSender = null;
|
||||
|
||||
public function setUser($user)
|
||||
{
|
||||
|
||||
@@ -8,16 +8,16 @@ class UIManager
|
||||
|
||||
private static $me = null;
|
||||
|
||||
var $user;
|
||||
var $currentProfile;
|
||||
var $switchedProfile;
|
||||
protected $user;
|
||||
protected $currentProfile;
|
||||
protected $switchedProfile;
|
||||
|
||||
var $currentProfileBlock = null;
|
||||
var $switchedProfileBlock = null;
|
||||
protected $currentProfileBlock = null;
|
||||
protected $switchedProfileBlock = null;
|
||||
|
||||
var $tempates = array();
|
||||
protected $templates = array();
|
||||
|
||||
var $quickAccessMenuItems = array();
|
||||
protected $quickAccessMenuItems = array();
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
@@ -35,13 +35,13 @@ class UIManager
|
||||
private function getTemplate($name, $type)
|
||||
{
|
||||
|
||||
if (isset($this->tempates[$name])) {
|
||||
return $this->tempates[$name];
|
||||
if (isset($this->templates[$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)
|
||||
@@ -210,7 +210,9 @@ class UIManager
|
||||
*/
|
||||
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("__tabPages__", $moduleBuilder->getTabPagesHTML(), $str);
|
||||
$str = str_replace("__tabJs__", $moduleBuilder->getModJsHTML(), $str);
|
||||
|
||||
@@ -24,8 +24,15 @@ class CompanyAdminManager extends AbstractModuleManager
|
||||
|
||||
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("CONSTRAINT `Fk_CompanyStructures_Own` FOREIGN KEY (`parent`) REFERENCES ", "Can not delete a parent structure");
|
||||
$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(
|
||||
"CONSTRAINT `Fk_CompanyStructures_Own` FOREIGN KEY (`parent`) REFERENCES ",
|
||||
"Can not delete a parent structure"
|
||||
);
|
||||
}
|
||||
|
||||
public function setupModuleClassDefinitions()
|
||||
|
||||
@@ -6,7 +6,7 @@ use Model\BaseModel;
|
||||
|
||||
class CompanyStructure extends BaseModel
|
||||
{
|
||||
var $_table = 'CompanyStructures';
|
||||
public $table = 'CompanyStructures';
|
||||
|
||||
public function getAdminAccess()
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@ use Model\BaseModel;
|
||||
|
||||
class Timezone extends BaseModel
|
||||
{
|
||||
var $_table = 'Timezones';
|
||||
public $table = 'Timezones';
|
||||
|
||||
public function getAdminAccess()
|
||||
{
|
||||
|
||||
@@ -45,7 +45,7 @@ class DashboardActionManager extends SubActionManager
|
||||
|
||||
$timeEntry = new EmployeeTimeEntry();
|
||||
$data['numberOfAttendanceLastWeek'] = $timeEntry->Count(
|
||||
"in_time > '".date("Y-m-d H:i:s", strtotime("-1 week"))."'"
|
||||
"in_time > '".date("Y-m-d H:i:s", strtotime("-1 week"))."'"
|
||||
);
|
||||
|
||||
$candidate = new Candidate();
|
||||
|
||||
@@ -10,17 +10,17 @@ use Utils\LogManager;
|
||||
abstract class AbstractDataImporter
|
||||
{
|
||||
|
||||
var $dataImport = null;
|
||||
protected $dataImport = null;
|
||||
|
||||
var $headerMapping = array();
|
||||
var $primaryKeyColumn = 0;
|
||||
protected $headerMapping = array();
|
||||
protected $primaryKeyColumn = 0;
|
||||
|
||||
var $rowObjects = array();
|
||||
var $attachedObjects = array();
|
||||
var $objectKeys;
|
||||
var $customFields;
|
||||
var $columnsCompeted = array();
|
||||
var $relatedColumns = array();
|
||||
protected $rowObjects = array();
|
||||
protected $attachedObjects = array();
|
||||
protected $objectKeys;
|
||||
protected $customFields;
|
||||
protected $columnsCompeted = array();
|
||||
protected $relatedColumns = array();
|
||||
|
||||
public function getRowObjects()
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@ use Data\Admin\Api\AbstractDataImporter;
|
||||
class AttendanceDataImporter extends AbstractDataImporter
|
||||
{
|
||||
|
||||
var $processed = array();
|
||||
protected $processed = array();
|
||||
|
||||
public function getModelObject()
|
||||
{
|
||||
|
||||
@@ -6,7 +6,7 @@ use Data\Admin\Api\AbstractDataImporter;
|
||||
class EmployeeDataImporter extends AbstractDataImporter
|
||||
{
|
||||
|
||||
var $processed = array();
|
||||
protected $processed = array();
|
||||
|
||||
public function getModelObject()
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@ use Model\BaseModel;
|
||||
|
||||
class DataImport extends BaseModel
|
||||
{
|
||||
var $_table = 'DataImport';
|
||||
public $table = 'DataImport';
|
||||
|
||||
public function getAdminAccess()
|
||||
{
|
||||
|
||||
@@ -6,7 +6,7 @@ use Model\BaseModel;
|
||||
|
||||
class DataImportFile extends BaseModel
|
||||
{
|
||||
var $_table = 'DataImportFiles';
|
||||
public $table = 'DataImportFiles';
|
||||
|
||||
public function getAdminAccess()
|
||||
{
|
||||
|
||||
@@ -6,7 +6,7 @@ use Model\BaseModel;
|
||||
|
||||
class EmployeeDependent extends BaseModel
|
||||
{
|
||||
var $_table = 'EmployeeDependents';
|
||||
public $table = 'EmployeeDependents';
|
||||
|
||||
public function getAdminAccess()
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@ use Model\BaseModel;
|
||||
|
||||
class EmergencyContact extends BaseModel
|
||||
{
|
||||
var $_table = 'EmergencyContacts';
|
||||
public $table = 'EmergencyContacts';
|
||||
|
||||
public function getAdminAccess()
|
||||
{
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
namespace Employees\Admin\Api;
|
||||
|
||||
|
||||
use Attendance\Common\Model\Attendance;
|
||||
use Classes\BaseService;
|
||||
use Classes\IceResponse;
|
||||
@@ -28,160 +27,171 @@ use TimeSheets\Common\Model\EmployeeTimeEntry;
|
||||
use TimeSheets\Common\Model\EmployeeTimeSheet;
|
||||
use Travel\Common\Model\EmployeeTravelRecord;
|
||||
|
||||
class EmployeesActionManager extends SubActionManager{
|
||||
class EmployeesActionManager extends SubActionManager
|
||||
{
|
||||
|
||||
public function terminateEmployee($req){
|
||||
$employee = new Employee();
|
||||
$employee->Load("id = ?",array($req->id));
|
||||
public function terminateEmployee($req)
|
||||
{
|
||||
$employee = new Employee();
|
||||
$employee->Load("id = ?", array($req->id));
|
||||
|
||||
if(empty($employee->id)){
|
||||
return new IceResponse(IceResponse::ERROR, "Employee Not Found");
|
||||
}
|
||||
if (empty($employee->id)) {
|
||||
return new IceResponse(IceResponse::ERROR, "Employee Not Found");
|
||||
}
|
||||
|
||||
$employee->termination_date = date('Y-m-d H:i:s');
|
||||
$employee->status = 'Terminated';
|
||||
$employee->termination_date = date('Y-m-d H:i:s');
|
||||
$employee->status = 'Terminated';
|
||||
|
||||
$ok = $employee->Save();
|
||||
if(!$ok){
|
||||
return new IceResponse(IceResponse::ERROR, "Error occurred while terminating employee");
|
||||
}
|
||||
$ok = $employee->Save();
|
||||
if (!$ok) {
|
||||
return new IceResponse(IceResponse::ERROR, "Error occurred while terminating employee");
|
||||
}
|
||||
|
||||
return new IceResponse(IceResponse::SUCCESS, $employee);
|
||||
return new IceResponse(IceResponse::SUCCESS, $employee);
|
||||
|
||||
//$user = BaseService::getInstance()->getUserFromProfileId($employee->id);
|
||||
}
|
||||
//$user = BaseService::getInstance()->getUserFromProfileId($employee->id);
|
||||
}
|
||||
|
||||
public function activateEmployee($req){
|
||||
$employee = new Employee();
|
||||
$employee->Load("id = ?",array($req->id));
|
||||
public function activateEmployee($req)
|
||||
{
|
||||
$employee = new Employee();
|
||||
$employee->Load("id = ?", array($req->id));
|
||||
|
||||
if(empty($employee->id)){
|
||||
return new IceResponse(IceResponse::ERROR, "Employee Not Found");
|
||||
}
|
||||
if (empty($employee->id)) {
|
||||
return new IceResponse(IceResponse::ERROR, "Employee Not Found");
|
||||
}
|
||||
|
||||
$employee->termination_date = NULL;
|
||||
$employee->status = 'Active';
|
||||
$employee->termination_date = null;
|
||||
$employee->status = 'Active';
|
||||
|
||||
$ok = $employee->Save();
|
||||
if(!$ok){
|
||||
return new IceResponse(IceResponse::ERROR, "Error occurred while activating employee");
|
||||
}
|
||||
$ok = $employee->Save();
|
||||
if (!$ok) {
|
||||
return new IceResponse(IceResponse::ERROR, "Error occurred while activating employee");
|
||||
}
|
||||
|
||||
return new IceResponse(IceResponse::SUCCESS, $employee);
|
||||
return new IceResponse(IceResponse::SUCCESS, $employee);
|
||||
|
||||
//$user = BaseService::getInstance()->getUserFromProfileId($employee->id);
|
||||
}
|
||||
//$user = BaseService::getInstance()->getUserFromProfileId($employee->id);
|
||||
}
|
||||
|
||||
public function deleteEmployee($req){
|
||||
public function deleteEmployee($req)
|
||||
{
|
||||
|
||||
$employee = new Employee();
|
||||
$employee->Load("id = ?",array($req->id));
|
||||
$employee = new Employee();
|
||||
$employee->Load("id = ?", array($req->id));
|
||||
|
||||
if(empty($employee->id)){
|
||||
return new IceResponse(IceResponse::ERROR, "Employee Not Found");
|
||||
}
|
||||
if (empty($employee->id)) {
|
||||
return new IceResponse(IceResponse::ERROR, "Employee Not Found");
|
||||
}
|
||||
|
||||
$archived = new ArchivedEmployee();
|
||||
$archived->ref_id = $employee->id;
|
||||
$archived->employee_id = $employee->employee_id;
|
||||
$archived->first_name = $employee->first_name;
|
||||
$archived->last_name = $employee->last_name;
|
||||
$archived->gender = $employee->gender;
|
||||
$archived->ssn_num = $employee->ssn_num;
|
||||
$archived->nic_num = $employee->nic_num;
|
||||
$archived->other_id = $employee->other_id;
|
||||
$archived->work_email = $employee->work_email;
|
||||
$archived->joined_date = $employee->joined_date;
|
||||
$archived->confirmation_date = $employee->confirmation_date;
|
||||
$archived->supervisor = $employee->supervisor;
|
||||
$archived->department = $employee->department;
|
||||
$archived->termination_date = $employee->termination_date;
|
||||
$archived->notes = $employee->notes;
|
||||
$archived = new ArchivedEmployee();
|
||||
$archived->ref_id = $employee->id;
|
||||
$archived->employee_id = $employee->employee_id;
|
||||
$archived->first_name = $employee->first_name;
|
||||
$archived->last_name = $employee->last_name;
|
||||
$archived->gender = $employee->gender;
|
||||
$archived->ssn_num = $employee->ssn_num;
|
||||
$archived->nic_num = $employee->nic_num;
|
||||
$archived->other_id = $employee->other_id;
|
||||
$archived->work_email = $employee->work_email;
|
||||
$archived->joined_date = $employee->joined_date;
|
||||
$archived->confirmation_date = $employee->confirmation_date;
|
||||
$archived->supervisor = $employee->supervisor;
|
||||
$archived->department = $employee->department;
|
||||
$archived->termination_date = $employee->termination_date;
|
||||
$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()->cleanUpAdoDB($employeeEnriched);
|
||||
$employeeEnriched = BaseService::getInstance()->getElement('Employee', $employee->id, $mapping, true);
|
||||
$employeeEnriched = BaseService::getInstance()->cleanUpAdoDB($employeeEnriched);
|
||||
|
||||
$data = new \stdClass();
|
||||
$data->enrichedEmployee = $employeeEnriched;
|
||||
$data = new \stdClass();
|
||||
$data->enrichedEmployee = $employeeEnriched;
|
||||
|
||||
$data->timesheets = $this->getEmployeeData($employee->id, new EmployeeTimeSheet());
|
||||
$data->timesheetEntries = $this->getEmployeeData($employee->id, new EmployeeTimeEntry());
|
||||
$data->attendance = $this->getEmployeeData($employee->id, new Attendance());
|
||||
$data->documents = $this->getEmployeeData($employee->id, new EmployeeDocument());
|
||||
$data->travelRecords = $this->getEmployeeData($employee->id, new EmployeeTravelRecord());
|
||||
$data->qualificationSkills = $this->getEmployeeData($employee->id, new EmployeeSkill());
|
||||
$data->qualificationEducation = $this->getEmployeeData($employee->id, new EmployeeEducation());
|
||||
$data->qualificationCertifications = $this->getEmployeeData($employee->id, new EmployeeCertification());
|
||||
$data->qualificationLanguages = $this->getEmployeeData($employee->id, new EmployeeLanguage());
|
||||
$data->salary = $this->getEmployeeData($employee->id, new EmployeeSalary());
|
||||
$data->dependants = $this->getEmployeeData($employee->id, new EmployeeDependent());
|
||||
$data->emergencyContacts = $this->getEmployeeData($employee->id, new EmergencyContact());
|
||||
$data->projects = $this->getEmployeeData($employee->id, new EmployeeProject());
|
||||
$data->timesheets = $this->getEmployeeData($employee->id, new EmployeeTimeSheet());
|
||||
$data->timesheetEntries = $this->getEmployeeData($employee->id, new EmployeeTimeEntry());
|
||||
$data->attendance = $this->getEmployeeData($employee->id, new Attendance());
|
||||
$data->documents = $this->getEmployeeData($employee->id, new EmployeeDocument());
|
||||
$data->travelRecords = $this->getEmployeeData($employee->id, new EmployeeTravelRecord());
|
||||
$data->qualificationSkills = $this->getEmployeeData($employee->id, new EmployeeSkill());
|
||||
$data->qualificationEducation = $this->getEmployeeData($employee->id, new EmployeeEducation());
|
||||
$data->qualificationCertifications = $this->getEmployeeData($employee->id, new EmployeeCertification());
|
||||
$data->qualificationLanguages = $this->getEmployeeData($employee->id, new EmployeeLanguage());
|
||||
$data->salary = $this->getEmployeeData($employee->id, new EmployeeSalary());
|
||||
$data->dependants = $this->getEmployeeData($employee->id, new EmployeeDependent());
|
||||
$data->emergencyContacts = $this->getEmployeeData($employee->id, new EmergencyContact());
|
||||
$data->projects = $this->getEmployeeData($employee->id, new EmployeeProject());
|
||||
|
||||
$archived->data = json_encode($data, JSON_PRETTY_PRINT);
|
||||
$archived->data = json_encode($data, JSON_PRETTY_PRINT);
|
||||
|
||||
$ok = $archived->Save();
|
||||
if(!$ok){
|
||||
return new IceResponse(IceResponse::ERROR, "Error occurred while archiving employee");
|
||||
}
|
||||
$ok = $archived->Save();
|
||||
if (!$ok) {
|
||||
return new IceResponse(IceResponse::ERROR, "Error occurred while archiving employee");
|
||||
}
|
||||
|
||||
|
||||
$ok = $employee->Delete();
|
||||
if(!$ok){
|
||||
return new IceResponse(IceResponse::ERROR, "Error occurred while deleting employee");
|
||||
}
|
||||
$ok = $employee->Delete();
|
||||
if (!$ok) {
|
||||
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'){
|
||||
echo "Error: Permission denied";
|
||||
exit();
|
||||
}
|
||||
if ($this->baseService->currentUser->user_level != 'Admin') {
|
||||
echo "Error: Permission denied";
|
||||
exit();
|
||||
}
|
||||
|
||||
$employee = new ArchivedEmployee();
|
||||
$employee->Load("id = ?",array($req->id));
|
||||
$employee = new ArchivedEmployee();
|
||||
$employee->Load("id = ?", array($req->id));
|
||||
|
||||
if(empty($employee->id)){
|
||||
return new IceResponse(IceResponse::ERROR, "Employee Not Found");
|
||||
}
|
||||
if (empty($employee->id)) {
|
||||
return new IceResponse(IceResponse::ERROR, "Employee Not Found");
|
||||
}
|
||||
|
||||
$employee->data = json_decode($employee->data);
|
||||
$employee = $this->baseService->cleanUpAdoDB($employee);
|
||||
$employee->data = json_decode($employee->data);
|
||||
$employee = $this->baseService->cleanUpAdoDB($employee);
|
||||
|
||||
$str = json_encode($employee, JSON_PRETTY_PRINT);
|
||||
$str = json_encode($employee, JSON_PRETTY_PRINT);
|
||||
|
||||
$filename = uniqid();
|
||||
$file = fopen("/tmp/".$filename,"w");
|
||||
fwrite($file,$str);
|
||||
fclose($file);
|
||||
$filename = uniqid();
|
||||
$file = fopen("/tmp/".$filename, "w");
|
||||
fwrite($file, $str);
|
||||
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("Expires: 0");
|
||||
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
|
||||
header("Content-Description: File Transfer");
|
||||
header("Content-Type: image/jpg");
|
||||
header('Content-Disposition: attachment; filename="'.$downloadFileName.'"');
|
||||
header("Content-Transfer-Encoding: binary");
|
||||
header("Content-Length: ".filesize("/tmp/".$filename));
|
||||
readfile("/tmp/".$filename);
|
||||
exit();
|
||||
header("Pragma: public"); // required
|
||||
header("Expires: 0");
|
||||
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
|
||||
header("Content-Description: File Transfer");
|
||||
header("Content-Type: image/jpg");
|
||||
header('Content-Disposition: attachment; filename="'.$downloadFileName.'"');
|
||||
header("Content-Transfer-Encoding: binary");
|
||||
header("Content-Length: ".filesize("/tmp/".$filename));
|
||||
readfile("/tmp/".$filename);
|
||||
exit();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function getEmployeeData($id, $obj){
|
||||
$data = array();
|
||||
$objs = $obj->Find("employee = ?",array($id));
|
||||
foreach($objs as $entry){
|
||||
$data[] = BaseService::getInstance()->cleanUpAdoDB($entry);
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
private function getEmployeeData($id, $obj)
|
||||
{
|
||||
$data = array();
|
||||
$objs = $obj->Find("employee = ?", array($id));
|
||||
foreach ($objs as $entry) {
|
||||
$data[] = BaseService::getInstance()->cleanUpAdoDB($entry);
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,10 @@ class EmployeesAdminManager extends AbstractModuleManager
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
|
||||
@@ -31,5 +31,5 @@ class ArchivedEmployee extends BaseModel
|
||||
return "id";
|
||||
}
|
||||
|
||||
var $_table = 'ArchivedEmployees';
|
||||
public $table = 'ArchivedEmployees';
|
||||
}
|
||||
|
||||
@@ -9,10 +9,10 @@ use Model\BaseModel;
|
||||
class Employee extends BaseModel
|
||||
{
|
||||
|
||||
var $oldObj = null;
|
||||
var $oldObjOrig = null;
|
||||
var $historyUpdateList = array();
|
||||
var $historyFieldsToTrack = array(
|
||||
public $oldObj = null;
|
||||
public $oldObjOrig = null;
|
||||
public $historyUpdateList = array();
|
||||
public $historyFieldsToTrack = array(
|
||||
"employee_id"=>"employee_id",
|
||||
"first_name"=>"first_name",
|
||||
"middle_name"=>"middle_name",
|
||||
@@ -78,7 +78,11 @@ class Employee extends BaseModel
|
||||
$oldObjOrig->Load("id = ?", array($obj->id));
|
||||
$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);
|
||||
}
|
||||
@@ -89,7 +93,11 @@ class Employee extends BaseModel
|
||||
$oldObj = $this->oldObj;
|
||||
$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);
|
||||
|
||||
@@ -205,5 +213,5 @@ class Employee extends BaseModel
|
||||
return $obj;
|
||||
}
|
||||
|
||||
var $_table = 'Employees';
|
||||
public $table = 'Employees';
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ use Model\BaseModel;
|
||||
class EmployeeApproval extends BaseModel
|
||||
{
|
||||
|
||||
var $_table = 'EmployeeApprovals';
|
||||
public $table = 'EmployeeApprovals';
|
||||
|
||||
public function getAdminAccess()
|
||||
{
|
||||
|
||||
@@ -13,7 +13,7 @@ use Model\BaseModel;
|
||||
class EmploymentStatus extends BaseModel
|
||||
{
|
||||
|
||||
var $_table = 'EmploymentStatus';
|
||||
public $table = 'EmploymentStatus';
|
||||
|
||||
public function getAdminAccess()
|
||||
{
|
||||
|
||||
@@ -33,7 +33,13 @@ class EmployeeRestEndPoint extends RestEndPoint
|
||||
}
|
||||
return new IceResponse(IceResponse::SUCCESS, $newEmps);
|
||||
} 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);
|
||||
if (!empty($emp)) {
|
||||
$emp = Employee::cleanEmployeeData($emp);
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
namespace Employees\User\Api;
|
||||
|
||||
|
||||
use Classes\BaseService;
|
||||
use Classes\FileService;
|
||||
use Classes\IceResponse;
|
||||
@@ -50,7 +49,11 @@ class EmployeesActionManager extends SubActionManager
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,13 +13,13 @@ use Model\ApproveModel;
|
||||
|
||||
class EmployeeExpense extends ApproveModel
|
||||
{
|
||||
var $_table = 'EmployeeExpenses';
|
||||
public $table = 'EmployeeExpenses';
|
||||
|
||||
var $notificationModuleName = "Expense Management";
|
||||
var $notificationUnitName = "Expense";
|
||||
var $notificationUnitPrefix = "An";
|
||||
var $notificationUnitAdminUrl = "g=modules&n=expenses&m=module_Finance#tabSubordinateEmployeeExpense";
|
||||
var $preApproveSettingName = "Expense: Pre-Approve Expenses";
|
||||
public $notificationModuleName = "Expense Management";
|
||||
public $notificationUnitName = "Expense";
|
||||
public $notificationUnitPrefix = "An";
|
||||
public $notificationUnitAdminUrl = "g=modules&n=expenses&m=module_Finance#tabSubordinateEmployeeExpense";
|
||||
public $preApproveSettingName = "Expense: Pre-Approve Expenses";
|
||||
|
||||
public function isMultiLevelApprovalsEnabled()
|
||||
{
|
||||
|
||||
@@ -10,9 +10,10 @@ namespace Expenses\Common\Model;
|
||||
|
||||
class EmployeeExpenseApproval extends EmployeeExpense
|
||||
{
|
||||
|
||||
// @codingStandardsIgnoreStart
|
||||
public function Find($whereOrderBy, $bindarr = false, $pkeysArr = false, $extra = array())
|
||||
{
|
||||
// @codingStandardsIgnoreEnd
|
||||
return $this->findApprovals(new EmployeeExpense(), $whereOrderBy, $bindarr, $pkeysArr, $extra);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ use Model\BaseModel;
|
||||
|
||||
class ExpensesCategory extends BaseModel
|
||||
{
|
||||
var $_table = 'ExpensesCategories';
|
||||
public $table = 'ExpensesCategories';
|
||||
|
||||
public function getAdminAccess()
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@ use Model\BaseModel;
|
||||
|
||||
class ExpensesPaymentMethod extends BaseModel
|
||||
{
|
||||
var $_table = 'ExpensesPaymentMethods';
|
||||
public $table = 'ExpensesPaymentMethods';
|
||||
|
||||
public function getAdminAccess()
|
||||
{
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
namespace Expenses\User\Api;
|
||||
|
||||
|
||||
use Classes\Approval\ApproveModuleActionManager;
|
||||
|
||||
class ExpensesActionManager extends ApproveModuleActionManager
|
||||
|
||||
@@ -14,7 +14,7 @@ use Model\BaseModel;
|
||||
|
||||
class CustomField extends BaseModel
|
||||
{
|
||||
var $_table = 'CustomFields';
|
||||
public $table = 'CustomFields';
|
||||
|
||||
public function getAdminAccess()
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@ use Model\BaseModel;
|
||||
|
||||
class FieldNameMapping extends BaseModel
|
||||
{
|
||||
var $_table = 'FieldNameMappings';
|
||||
public $table = 'FieldNameMappings';
|
||||
|
||||
public function getAdminAccess()
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@ use Model\BaseModel;
|
||||
|
||||
class JobTitle extends BaseModel
|
||||
{
|
||||
var $_table = 'JobTitles';
|
||||
public $table = 'JobTitles';
|
||||
|
||||
public function getAdminAccess()
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@ use Model\BaseModel;
|
||||
|
||||
class PayGrade extends BaseModel
|
||||
{
|
||||
var $_table = 'PayGrades';
|
||||
public $table = 'PayGrades';
|
||||
|
||||
public function getAdminAccess()
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@ use Model\BaseModel;
|
||||
|
||||
class CompanyLoan extends BaseModel
|
||||
{
|
||||
var $_table = 'CompanyLoans';
|
||||
public $table = 'CompanyLoans';
|
||||
|
||||
public function getAdminAccess()
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@ use Model\BaseModel;
|
||||
|
||||
class EmployeeCompanyLoan extends BaseModel
|
||||
{
|
||||
var $_table = 'EmployeeCompanyLoans';
|
||||
public $table = 'EmployeeCompanyLoans';
|
||||
|
||||
public function getAdminAccess()
|
||||
{
|
||||
|
||||
@@ -13,7 +13,7 @@ use Model\BaseModel;
|
||||
|
||||
class CalculationHook extends BaseModel
|
||||
{
|
||||
var $_table = 'CalculationHooks';
|
||||
public $table = 'CalculationHooks';
|
||||
|
||||
public function getAdminAccess()
|
||||
{
|
||||
@@ -29,7 +29,7 @@ class CalculationHook extends BaseModel
|
||||
{
|
||||
return array("get","element");
|
||||
}
|
||||
|
||||
// @codingStandardsIgnoreStart
|
||||
function Find($whereOrderBy, $bindarr = false, $pkeysArr = false, $extra = array())
|
||||
{
|
||||
return BaseService::getInstance()->getCalculationHooks();
|
||||
@@ -39,4 +39,5 @@ class CalculationHook extends BaseModel
|
||||
{
|
||||
return BaseService::getInstance()->getCalculationHook($bindarr[0]);
|
||||
}
|
||||
// @codingStandardsIgnoreEnd
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ use Model\BaseModel;
|
||||
|
||||
class Country extends BaseModel
|
||||
{
|
||||
var $_table = 'Country';
|
||||
public $table = 'Country';
|
||||
|
||||
public function getAdminAccess()
|
||||
{
|
||||
@@ -30,6 +30,7 @@ class Country extends BaseModel
|
||||
return array("get","element");
|
||||
}
|
||||
|
||||
// @codingStandardsIgnoreStart
|
||||
function Find($whereOrderBy, $bindarr = false, $pkeysArr = false, $extra = array())
|
||||
{
|
||||
$allowedCountriesStr = SettingsManager::getInstance()->getSetting('System: Allowed Countries');
|
||||
@@ -49,4 +50,5 @@ class Country extends BaseModel
|
||||
|
||||
return parent::Find($whereOrderBy, $bindarr, $pkeysArr, $extra);
|
||||
}
|
||||
// @codingStandardsIgnoreEnd
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ use Model\BaseModel;
|
||||
|
||||
class CurrencyType extends BaseModel
|
||||
{
|
||||
var $_table = 'CurrencyTypes';
|
||||
public $table = 'CurrencyTypes';
|
||||
|
||||
public function getAdminAccess()
|
||||
{
|
||||
@@ -30,6 +30,7 @@ class CurrencyType extends BaseModel
|
||||
return array("get","element");
|
||||
}
|
||||
|
||||
// @codingStandardsIgnoreStart
|
||||
function Find($whereOrderBy, $bindarr = false, $pkeysArr = false, $extra = array())
|
||||
{
|
||||
$allowedCountriesStr = SettingsManager::getInstance()->getSetting('System: Allowed Currencies');
|
||||
@@ -49,4 +50,5 @@ class CurrencyType extends BaseModel
|
||||
|
||||
return parent::Find($whereOrderBy, $bindarr, $pkeysArr, $extra);
|
||||
}
|
||||
// @codingStandardsIgnoreEnd
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ use Model\BaseModel;
|
||||
|
||||
class CustomFieldValue extends BaseModel
|
||||
{
|
||||
var $_table = 'CustomFieldValues';
|
||||
public $table = 'CustomFieldValues';
|
||||
|
||||
public function getAdminAccess()
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@ use Model\BaseModel;
|
||||
|
||||
class Ethnicity extends BaseModel
|
||||
{
|
||||
var $_table = 'Ethnicity';
|
||||
public $table = 'Ethnicity';
|
||||
|
||||
public function getAdminAccess()
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@ use Model\BaseModel;
|
||||
|
||||
class ImmigrationStatus extends BaseModel
|
||||
{
|
||||
var $_table = 'ImmigrationStatus';
|
||||
public $table = 'ImmigrationStatus';
|
||||
|
||||
public function getAdminAccess()
|
||||
{
|
||||
|
||||
@@ -13,7 +13,7 @@ use Model\BaseModel;
|
||||
|
||||
class Nationality extends BaseModel
|
||||
{
|
||||
var $_table = 'Nationality';
|
||||
public $table = 'Nationality';
|
||||
|
||||
public function getAdminAccess()
|
||||
{
|
||||
@@ -29,7 +29,7 @@ class Nationality extends BaseModel
|
||||
{
|
||||
return array("get","element");
|
||||
}
|
||||
|
||||
// @codingStandardsIgnoreStart
|
||||
function Find($whereOrderBy, $bindarr = false, $pkeysArr = false, $extra = array())
|
||||
{
|
||||
$allowedCountriesStr = SettingsManager::getInstance()->getSetting('System: Allowed Nationality');
|
||||
@@ -49,4 +49,5 @@ class Nationality extends BaseModel
|
||||
|
||||
return parent::Find($whereOrderBy, $bindarr, $pkeysArr, $extra);
|
||||
}
|
||||
// @codingStandardsIgnoreEnd
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ use Model\BaseModel;
|
||||
|
||||
class Province extends BaseModel
|
||||
{
|
||||
var $_table = 'Province';
|
||||
public $table = 'Province';
|
||||
|
||||
public function getAdminAccess()
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@ use Model\BaseModel;
|
||||
|
||||
class SupportedLanguage extends BaseModel
|
||||
{
|
||||
var $_table = 'SupportedLanguages';
|
||||
public $table = 'SupportedLanguages';
|
||||
|
||||
public function getAdminAccess()
|
||||
{
|
||||
|
||||
@@ -41,23 +41,55 @@ abstract class ApproveModel extends BaseModel
|
||||
$employee = BaseService::getInstance()->getElement('Employee', $currentEmpId);
|
||||
|
||||
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 {
|
||||
$user = BaseService::getInstance()->getCurrentUser();
|
||||
|
||||
if ($user->user_level == "Admin") {
|
||||
//Auto approve
|
||||
$obj->status = "Approved";
|
||||
$notificationMsg = "Your ".$this->notificationUnitName." 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);
|
||||
$notificationMsg = "Your ".$this->notificationUnitName
|
||||
." 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 {
|
||||
//If the user do not have a supervisor, notify all admins
|
||||
$admins = BaseService::getInstance()->getAllAdmins();
|
||||
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.";
|
||||
BaseService::getInstance()->notificationManager->addNotification(null, $notificationMsg, '{"type":"url","url":"'.$this->notificationUnitAdminUrl.'"}', $this->notificationModuleName, $admin->id, false, $sendNotificationEmail);
|
||||
$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.";
|
||||
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);
|
||||
|
||||
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 {
|
||||
$user = BaseService::getInstance()->getCurrentUser();
|
||||
|
||||
@@ -113,8 +156,21 @@ abstract class ApproveModel extends BaseModel
|
||||
//If the user do not have a supervisor, notify all admins
|
||||
$admins = BaseService::getInstance()->getAllAdmins();
|
||||
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.";
|
||||
BaseService::getInstance()->notificationManager->addNotification(null, $notificationMsg, '{"type":"url","url":"g=admin&n=travel&m=admin_Employees"}', "Travel Module", $admin->id, false, $sendNotificationEmail);
|
||||
$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.";
|
||||
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();
|
||||
$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();
|
||||
foreach ($approveals as $appr) {
|
||||
$ids[] = $appr->element;
|
||||
|
||||
@@ -10,5 +10,5 @@ namespace Model;
|
||||
|
||||
class Audit extends BaseModel
|
||||
{
|
||||
var $_table = 'AuditLog';
|
||||
public $table = 'AuditLog';
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ use Classes\IceResponse;
|
||||
class BaseModel extends \ADOdb_Active_Record
|
||||
{
|
||||
|
||||
var $keysToIgnore = array(
|
||||
public $keysToIgnore = array(
|
||||
"_table",
|
||||
"_dbat",
|
||||
"_tableat",
|
||||
|
||||
@@ -10,5 +10,5 @@ namespace Model;
|
||||
|
||||
class Cron extends BaseModel
|
||||
{
|
||||
var $_table = 'Crons';
|
||||
public $table = 'Crons';
|
||||
}
|
||||
|
||||
@@ -10,5 +10,5 @@ namespace Model;
|
||||
|
||||
class DataEntryBackup extends BaseModel
|
||||
{
|
||||
var $_table = 'DataEntryBackups';
|
||||
public $table = 'DataEntryBackups';
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Model;
|
||||
|
||||
class File extends BaseModel
|
||||
{
|
||||
var $_table = 'Files';
|
||||
public $table = 'Files';
|
||||
public function getAdminAccess()
|
||||
{
|
||||
return array("get","element","save","delete");
|
||||
|
||||
@@ -10,5 +10,5 @@ namespace Model;
|
||||
|
||||
class IceEmail extends BaseModel
|
||||
{
|
||||
var $_table = 'Emails';
|
||||
public $table = 'Emails';
|
||||
}
|
||||
|
||||
@@ -10,5 +10,5 @@ namespace Model;
|
||||
|
||||
class Migration extends BaseModel
|
||||
{
|
||||
var $_table = 'Migrations';
|
||||
public $table = 'Migrations';
|
||||
}
|
||||
|
||||
@@ -10,5 +10,5 @@ namespace Model;
|
||||
|
||||
class Notification extends BaseModel
|
||||
{
|
||||
var $_table = 'Notifications';
|
||||
public $table = 'Notifications';
|
||||
}
|
||||
|
||||
@@ -31,5 +31,5 @@ class Report extends BaseModel
|
||||
return $entry;
|
||||
}
|
||||
|
||||
var $_table = 'Reports';
|
||||
public $table = 'Reports';
|
||||
}
|
||||
|
||||
@@ -37,5 +37,5 @@ class ReportFile extends BaseModel
|
||||
return $entry;
|
||||
}
|
||||
|
||||
var $_table = 'ReportFiles';
|
||||
public $table = 'ReportFiles';
|
||||
}
|
||||
|
||||
@@ -10,5 +10,5 @@ namespace Model;
|
||||
|
||||
class RestAccessToken extends BaseModel
|
||||
{
|
||||
var $_table = 'RestAccessTokens';
|
||||
public $table = 'RestAccessTokens';
|
||||
}
|
||||
|
||||
@@ -36,5 +36,5 @@ class Setting extends BaseModel
|
||||
return $obj;
|
||||
}
|
||||
|
||||
var $_table = 'Settings';
|
||||
public $table = 'Settings';
|
||||
}
|
||||
|
||||
@@ -10,5 +10,5 @@ namespace Model;
|
||||
|
||||
class StatusChangeLog extends BaseModel
|
||||
{
|
||||
var $_table = 'StatusChangeLogs';
|
||||
public $table = 'StatusChangeLogs';
|
||||
}
|
||||
|
||||
@@ -31,5 +31,5 @@ class UserReport extends BaseModel
|
||||
return $entry;
|
||||
}
|
||||
|
||||
var $_table = 'UserReports';
|
||||
public $table = 'UserReports';
|
||||
}
|
||||
|
||||
@@ -36,5 +36,5 @@ class Module extends BaseModel
|
||||
{
|
||||
return array();
|
||||
}
|
||||
var $_table = 'Modules';
|
||||
public $table = 'Modules';
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
namespace Overtime\Admin\Api;
|
||||
|
||||
|
||||
use Classes\Approval\ApproveAdminActionManager;
|
||||
|
||||
class OvertimeActionManager extends ApproveAdminActionManager
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user