Bugfixes importvorlage

This commit is contained in:
Xenomporio 2022-06-01 17:15:59 +02:00
parent 526506575a
commit 7e9503e1b6
6 changed files with 9086 additions and 9068 deletions

View File

@ -42,7 +42,7 @@ include_once(dirname(__DIR__) . '/www/lib/class.httpclient.php');
if(!class_exists('AES')){ if(!class_exists('AES')){
$aes = ''; $aes = '';
$phpversion = phpversion(); $phpversion = phpversion();
if($phpversion{0} == '7' && (int)$phpversion{2} > 0) $aes = '2'; if($phpversion[0] == '7' && (int)$phpversion[2] > 0) $aes = '2';
if($aes == 2 && is_file(dirname(__DIR__) . '/www/lib/class.aes' . $aes . '.php')){ if($aes == 2 && is_file(dirname(__DIR__) . '/www/lib/class.aes' . $aes . '.php')){
include_once(dirname(__DIR__) . '/www/lib/class.aes' . $aes . '.php'); include_once(dirname(__DIR__) . '/www/lib/class.aes' . $aes . '.php');
}else{ }else{

View File

@ -21,7 +21,7 @@ if(is_file(dirname(__DIR__).'/www/lib/class.erpapi_custom.php')){
include_once dirname(__DIR__).'/www/lib/class.httpclient.php'; include_once dirname(__DIR__).'/www/lib/class.httpclient.php';
$aes = ''; $aes = '';
$phpversion = PHP_VERSION; $phpversion = PHP_VERSION;
if(strpos($phpversion,'7') === 0 && (int)$phpversion{2} > 0) if(strpos($phpversion,'7') === 0 && (int)$phpversion[2] > 0)
{ {
$aes = '2'; $aes = '2';
} }

View File

@ -527,7 +527,7 @@ class User
} }
$this->loadUserRowInCacheProperty(); $this->loadUserRowInCacheProperty();
return $this->cache[$cacheKey]['adresse']; // return $this->cache[$cacheKey]['adresse'];
} }
/** /**

View File

@ -217,6 +217,7 @@ class Importvorlage extends GenImportvorlage {
public function doCronjob() public function doCronjob()
{ {
$jobs = $this->app->DB->SelectArr( $jobs = $this->app->DB->SelectArr(
sprintf( sprintf(
"SELECT * FROM `importmasterdata` WHERE `status` = 'in_queue' ORDER BY `created_at` LIMIT 1" "SELECT * FROM `importmasterdata` WHERE `status` = 'in_queue' ORDER BY `created_at` LIMIT 1"
@ -4283,6 +4284,10 @@ class Importvorlage extends GenImportvorlage {
$uhrzeit = $tmp['uhrzeit'][$i]; $uhrzeit = $tmp['uhrzeit'][$i];
} }
if (is_null($mitarbeiteradresse)) {
$mitarbeiteradresse = '';
}
if($mitarbeiteradresse>0){ if($mitarbeiteradresse>0){
$bearbeiter = $this->app->DB->Select("SELECT CONCAT(mitarbeiternummer,' ',name) FROM adresse WHERE id='$mitarbeiteradresse' LIMIT 1"); $bearbeiter = $this->app->DB->Select("SELECT CONCAT(mitarbeiternummer,' ',name) FROM adresse WHERE id='$mitarbeiteradresse' LIMIT 1");
} }
@ -4290,8 +4295,10 @@ class Importvorlage extends GenImportvorlage {
$bearbeiter='Import'; $bearbeiter='Import';
} }
$this->app->DB->Insert("INSERT INTO dokumente (id,adresse_to,adresse_from,typ,betreff,content,datum,uhrzeit,bearbeiter) $query = "INSERT INTO dokumente (id,adresse_to,adresse_from,typ,betreff,content,datum,uhrzeit,bearbeiter)
VALUES ('',$adresse,$mitarbeiteradresse,'notiz','$betreff','$text','$datum','$uhrzeit','$bearbeiter')"); VALUES ('','$adresse','$mitarbeiteradresse','notiz','$betreff','$text','$datum','$uhrzeit','$bearbeiter')";
$this->app->DB->Insert($query);
} }
} }
break; break;

View File

@ -728,6 +728,7 @@ class Prozessstarter extends GenProzessstarter {
*/ */
public function setCronjobStatus($status, $prozessstarter = null) public function setCronjobStatus($status, $prozessstarter = null)
{ {
if($prozessstarter !== null) { if($prozessstarter !== null) {
$this->currentCronjobId = $prozessstarter; $this->currentCronjobId = $prozessstarter;
if(emptY($this->currentCronjobId)) { if(emptY($this->currentCronjobId)) {
@ -1180,6 +1181,7 @@ class Prozessstarter extends GenProzessstarter {
$task['bezeichnung'], $uid, $task['id'], $runningTask['id'] $task['bezeichnung'], $uid, $task['id'], $runningTask['id']
) )
); );
$this->setCronjobStatus('error', $task['id']); $this->setCronjobStatus('error', $task['id']);
$this->setCronjobRunning($uid, $task['id'], false); $this->setCronjobRunning($uid, $task['id'], false);
} }
@ -1190,6 +1192,9 @@ class Prozessstarter extends GenProzessstarter {
*/ */
public function closeAndLogCronjob($uid, $fromStarter2 = false) public function closeAndLogCronjob($uid, $fromStarter2 = false)
{ {
// REMARK: this never gets called -> Check
$cronjob = $this->getCronjobByUid($uid); $cronjob = $this->getCronjobByUid($uid);
if(empty($cronjob)) { if(empty($cronjob)) {
return; return;
@ -1205,6 +1210,7 @@ class Prozessstarter extends GenProzessstarter {
} }
$this->app->erp->LogFile('Cronjob with uid: '.$uid.' was killed by module: '.$cronjob['cronjob_name']); $this->app->erp->LogFile('Cronjob with uid: '.$uid.' was killed by module: '.$cronjob['cronjob_name']);
if(!empty($cronjob['task_id'])) { if(!empty($cronjob['task_id'])) {
$this->setCronjobStatus('error', $cronjob['task_id']); $this->setCronjobStatus('error', $cronjob['task_id']);
try { try {
/** @var Systemhealth $systemhealth */ /** @var Systemhealth $systemhealth */
@ -1419,11 +1425,13 @@ class Prozessstarter extends GenProzessstarter {
* @param bool $active * @param bool $active
*/ */
public function setCronjobRunning($uid, $task = null, $active = true) { public function setCronjobRunning($uid, $task = null, $active = true) {
if($active === false) { if($active === false) {
if(!empty($task)) { if(!empty($task)) {
$this->app->DB->Update( $this->app->DB->Update(
sprintf( sprintf(
'UPDATE cronjob_starter_running SET `task_id` = 0, last_time = NOW() WHERE uid = \'%s\' AND `active` = 1', // 'UPDATE cronjob_starter_running SET `task_id` = 0, last_time = NOW() WHERE uid = \'%s\' AND `active` = 1',
'UPDATE cronjob_starter_running SET `active` = 0, last_time = NOW() WHERE uid = \'%s\' AND `active` = 1',
$this->app->DB->real_escape_string($uid) $this->app->DB->real_escape_string($uid)
) )
); );
@ -1435,11 +1443,13 @@ class Prozessstarter extends GenProzessstarter {
$this->app->DB->real_escape_string($uid) $this->app->DB->real_escape_string($uid)
) )
); );
if(is_numeric($uid)){ if(is_numeric($uid)){
$this->changeUid($uid); $this->changeUid($uid);
} }
return; return;
} }
$check = $this->app->DB->SelectRow( $check = $this->app->DB->SelectRow(
sprintf( sprintf(
'SELECT * FROM cronjob_starter_running WHERE uid = \'%s\' LIMIT 1', 'SELECT * FROM cronjob_starter_running WHERE uid = \'%s\' LIMIT 1',
@ -1456,6 +1466,7 @@ class Prozessstarter extends GenProzessstarter {
); );
return; return;
} }
if(!empty($check['task_id']) && ($uid != $check['uid'] || $check['task_id'] != $task['id'])) { if(!empty($check['task_id']) && ($uid != $check['uid'] || $check['task_id'] != $task['id'])) {
$this->app->erp->LogFile( $this->app->erp->LogFile(
$this->app->DB->real_escape_string( $this->app->DB->real_escape_string(