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.'modulejslibs.inc.php';
$billingActionManager = new \Billing\Admin\Api\BillingActionManager();
$invoices = $billingActionManager->getInvoices(null)->getData();
if(!empty($invoices)){
$invoices = json_decode(json_encode($invoices));
}
$invoices = [];
$numOfUnpaidInvoices = 0;
foreach($invoices as $inv){
if (class_exists('\\Billing\\Admin\\Api\\BillingActionManager')) {
$billingActionManager = new \Billing\Admin\Api\BillingActionManager();
$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="row">
<?php if($numOfUnpaidInvoices == 1){?>
@@ -116,26 +121,5 @@ modJsList['tabDashboard'] = new DashboardAdapter('Dashboard','Dashboard');
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>
<?php include APP_BASE_PATH.'footer.php';?>

View File

@@ -1003,6 +1003,7 @@ IceHRMBase.method('save', function(callGetFunction, successCallback) {
if(id != null && id != undefined && id != ""){
$(params).attr('id',id);
}
params = this.makeEmptyDateFieldsNull(params);
this.add(params,[],callGetFunction, successCallback);
}else{
$("#"+this.getTableName()+'Form .label').html(msg);
@@ -1012,6 +1013,18 @@ IceHRMBase.method('save', function(callGetFunction, successCallback) {
}
});
IceHRMBase.method('makeEmptyDateFieldsNull', function(params) {
var fields = this.getFormFields();
fields.forEach(function(field) {
if((field[1].type == 'date' || field[1].type == 'datetime')
&& (params[field[0]] === '' || params[field[0]] === '0000-00-00' || params[field[0]] === '0000-00-00 00:00:00')){
delete params[field[0]];
}
});
return params;
});
/**
* Override this method to inject attitional parameters or modify existing parameters retrived from add/edit form before sending to the server
* @method forceInjectValuesBeforeSave

View File

@@ -3,10 +3,10 @@ ini_set('display_errors', false);
error_reporting(E_ERROR);
require dirname(__FILE__).'/lib/composer/vendor/autoload.php';
$whoops = new \Whoops\Run;
$whoops->pushHandler(new \Whoops\Handler\PlainTextHandler);
$whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler());
$whoops->register();
//$whoops = new \Whoops\Run;
//$whoops->pushHandler(new \Whoops\Handler\PlainTextHandler);
//$whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler());
//$whoops->register();
function t($text)
{

View File

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