Fix for mysql 5.7 strict date issue

This commit is contained in:
gamonoid
2017-09-04 05:50:37 +02:00
parent 385747dea4
commit 737b392d0a
5 changed files with 277 additions and 280 deletions

View File

@@ -26,19 +26,24 @@ define('MODULE_PATH',dirname(__FILE__));
include APP_BASE_PATH.'header.php'; include APP_BASE_PATH.'header.php';
include APP_BASE_PATH.'modulejslibs.inc.php'; include APP_BASE_PATH.'modulejslibs.inc.php';
$billingActionManager = new \Billing\Admin\Api\BillingActionManager(); $invoices = [];
$invoices = $billingActionManager->getInvoices(null)->getData();
if(!empty($invoices)){
$invoices = json_decode(json_encode($invoices));
}
$numOfUnpaidInvoices = 0; $numOfUnpaidInvoices = 0;
foreach($invoices as $inv){ if (class_exists('\\Billing\\Admin\\Api\\BillingActionManager')) {
if($inv->status == "Sent"){ $billingActionManager = new \Billing\Admin\Api\BillingActionManager();
$numOfUnpaidInvoices++;
$invoices = $billingActionManager->getInvoices(null)->getData();
if(!empty($invoices)){
$invoices = json_decode(json_encode($invoices));
}
foreach($invoices as $inv){
if($inv->status == "Sent"){
$numOfUnpaidInvoices++;
}
} }
} }
?><div class="span9"> ?><div class="span9">
<div class="row"> <div class="row">
<?php if($numOfUnpaidInvoices == 1){?> <?php if($numOfUnpaidInvoices == 1){?>
@@ -116,26 +121,5 @@ modJsList['tabDashboard'] = new DashboardAdapter('Dashboard','Dashboard');
var modJs = modJsList['tabDashboard']; var modJs = modJsList['tabDashboard'];
/*
$("#employeeLink").attr("href",modJs.getCustomUrl('?g=admin&n=employees&m=admin_Admin'));
$("#companyLink").attr("href",modJs.getCustomUrl('?g=admin&n=company_structure&m=admin_Admin'));
$("#usersLink").attr("href",modJs.getCustomUrl('?g=admin&n=users&m=admin_System'));
$("#projectsLink").attr("href",modJs.getCustomUrl('?g=admin&n=projects&m=admin_Admin'));
$("#attendanceLink").attr("href",modJs.getCustomUrl('?g=admin&n=attendance&m=admin_Admin'));
$("#leaveLink").attr("href",modJs.getCustomUrl('?g=admin&n=leaves&m=admin_Admin'));
$("#reportsLink").attr("href",modJs.getCustomUrl('?g=admin&n=reports&m=admin_Reports'));
$("#settingsLink").attr("href",modJs.getCustomUrl('?g=admin&n=settings&m=admin_System'));
$("#jobsLink").attr("href",modJs.getCustomUrl('?g=admin&n=jobpositions&m=admin_Recruitment'));
$("#candidatesLink").attr("href",modJs.getCustomUrl('?g=admin&n=candidates&m=admin_Recruitment'));
$("#trainingLink").attr("href",modJs.getCustomUrl('?g=admin&n=training&m=admin_Admin'));
$("#travelLink").attr("href",modJs.getCustomUrl('?g=admin&n=travel&m=admin_Employees'));
$("#documentLink").attr("href",modJs.getCustomUrl('?g=admin&n=documents&m=admin_Employees'));
$("#expenseLink").attr("href",modJs.getCustomUrl('?g=admin&n=expenses&m=admin_Employees'));
$("#permissionLink").attr("href",modJs.getCustomUrl('?g=admin&n=permissions&m=admin_System'));
$("#upgradeLink").attr("href",modJs.getCustomUrl('?g=admin&n=billing&m=admin_System'));
modJs.getInitData();
*/
</script> </script>
<?php include APP_BASE_PATH.'footer.php';?> <?php include APP_BASE_PATH.'footer.php';?>

File diff suppressed because it is too large Load Diff

View File

@@ -3,10 +3,10 @@ ini_set('display_errors', false);
error_reporting(E_ERROR); error_reporting(E_ERROR);
require dirname(__FILE__).'/lib/composer/vendor/autoload.php'; require dirname(__FILE__).'/lib/composer/vendor/autoload.php';
$whoops = new \Whoops\Run; //$whoops = new \Whoops\Run;
$whoops->pushHandler(new \Whoops\Handler\PlainTextHandler); //$whoops->pushHandler(new \Whoops\Handler\PlainTextHandler);
$whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler()); //$whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler());
$whoops->register(); //$whoops->register();
function t($text) function t($text)
{ {
@@ -18,9 +18,9 @@ $jsVersion = defined('CACHE_VALUE')?CACHE_VALUE:"v".VERSION;
$cssVersion = defined('CACHE_VALUE')?CACHE_VALUE:"v".VERSION; $cssVersion = defined('CACHE_VALUE')?CACHE_VALUE:"v".VERSION;
if(!isset($_REQUEST['content']) || $_REQUEST['content'] != 'HTML'){ if(!isset($_REQUEST['content']) || $_REQUEST['content'] != 'HTML'){
$_REQUEST = \Utils\InputCleaner::cleanParameters($_REQUEST); $_REQUEST = \Utils\InputCleaner::cleanParameters($_REQUEST);
$_GET = \Utils\InputCleaner::cleanParameters($_GET); $_GET = \Utils\InputCleaner::cleanParameters($_GET);
$_POST = \Utils\InputCleaner::cleanParameters($_POST); $_POST = \Utils\InputCleaner::cleanParameters($_POST);
} }
date_default_timezone_set('Asia/Colombo'); date_default_timezone_set('Asia/Colombo');

View File

@@ -98,7 +98,7 @@ class Employee extends BaseModel
continue; continue;
} }
if (empty($obj->$k) && ($oldObjOrig->$k = '0000-00-00' || empty($oldObjOrig->$k))) { if (empty($obj->$k) && $oldObjOrig->$k == '0000-00-00') {
continue; continue;
} }

View File

@@ -8,7 +8,7 @@ use Utils\LogManager;
class ActiveEmployeeReport extends CSVReportBuilder implements CSVReportBuilderInterface class ActiveEmployeeReport extends CSVReportBuilder implements CSVReportBuilderInterface
{ {
public function getMainQuery() public function getMainQuery()
{ {
$query = "Select id, employee_id as 'Employee ID', $query = "Select id, employee_id as 'Employee ID',
@@ -41,15 +41,15 @@ confirmation_date as 'Confirmation Date',
(SELECT title from CompanyStructures where id = department) as 'Department', (SELECT title from CompanyStructures where id = department) as 'Department',
(SELECT concat(`first_name`,' ',`middle_name`,' ', `last_name`,' [Employee ID:',`employee_id`,']') from Employees e1 where e1.id = e.supervisor) as 'Supervisor', notes as 'Notes' (SELECT concat(`first_name`,' ',`middle_name`,' ', `last_name`,' [Employee ID:',`employee_id`,']') from Employees e1 where e1.id = e.supervisor) as 'Supervisor', notes as 'Notes'
FROM Employees e"; FROM Employees e";
return $query; return $query;
} }
public function getWhereQuery($request) public function getWhereQuery($request)
{ {
$query = ""; $query = "";
$params = array(); $params = array();
if (empty($request['department']) || $request['department'] == "NULL") { if (empty($request['department']) || $request['department'] == "NULL") {
$params = array(); $params = array();
$query = "where ((termination_date is NULL or termination_date = '0001-01-01 00:00:00' or termination_date = '0000-00-00 00:00:00') and joined_date < NOW()) or (termination_date > NOW() and joined_date < NOW())"; $query = "where ((termination_date is NULL or termination_date = '0001-01-01 00:00:00' or termination_date = '0000-00-00 00:00:00') and joined_date < NOW()) or (termination_date > NOW() and joined_date < NOW())";
@@ -57,11 +57,11 @@ FROM Employees e";
$depts = $this->getChildCompanyStuctures($request['department']); $depts = $this->getChildCompanyStuctures($request['department']);
$query = "where department in (".implode(",", $depts).") and (((termination_date is NULL or termination_date = '0001-01-01 00:00:00' or termination_date = '0000-00-00 00:00:00') and joined_date < NOW()) or (termination_date > NOW() and joined_date < NOW()))"; $query = "where department in (".implode(",", $depts).") and (((termination_date is NULL or termination_date = '0001-01-01 00:00:00' or termination_date = '0000-00-00 00:00:00') and joined_date < NOW()) or (termination_date > NOW() and joined_date < NOW()))";
} }
return array($query, $params); return array($query, $params);
} }
public function getChildCompanyStuctures($companyStructId) public function getChildCompanyStuctures($companyStructId)
{ {
$childIds = array(); $childIds = array();
@@ -86,7 +86,7 @@ FROM Employees e";
$nodeIdsAtLastLevel[] = $item->id; $nodeIdsAtLastLevel[] = $item->id;
} }
} while (count($list) > 0 && $count < 10); } while (count($list) > 0 && $count < 10);
return $childIds; return $childIds;
} }
} }