mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-25 16:44:28 +00:00
Compare commits
31
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5d024b3a71 | ||
|
|
507b47e9ea | ||
|
|
a83fe561b9 | ||
|
|
c84146fcbd | ||
|
|
35decf476c | ||
|
|
6cfc4b0973 | ||
|
|
6296b87ea5 | ||
|
|
576a44838f | ||
|
|
c00e7a182c | ||
|
|
fd1b5daf9c | ||
|
|
c0b5f2f748 | ||
|
|
b217681ee5 | ||
|
|
7841a73fc0 | ||
|
|
2064008f9e | ||
|
|
19b9906c86 | ||
|
|
2c3913a763 | ||
|
|
9111edf442 | ||
|
|
b1c47da3c3 | ||
|
|
67eb238876 | ||
|
|
a139cc8d2e | ||
|
|
35ecbdefa8 | ||
|
|
5f0b1ace51 | ||
|
|
b891d8baa5 | ||
|
|
5dbcf9ce70 | ||
|
|
c26db6cc40 | ||
|
|
8548b93ddc | ||
|
|
bdc4782e9d | ||
|
|
0583990870 | ||
|
|
335753be8c | ||
|
|
8862f050e8 | ||
|
|
29f9b226ab |
@@ -1,20 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Configs for the Long Run Tasks
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
|
||||||
|
|
||||||
// Maximum LRTs for a single user in parallel
|
|
||||||
$config['lrt_max_number_single_user'] = 10;
|
|
||||||
|
|
||||||
// Maximum LRTs for the whole system in parallel
|
|
||||||
$config['lrt_max_number_system'] = 100;
|
|
||||||
|
|
||||||
// Maximum running time in hours for a single LRT before killing it
|
|
||||||
$config['lrt_max_run_timeout'] = 24;
|
|
||||||
|
|
||||||
// List of existing LRT types
|
|
||||||
$config['lrt_types'] = array('LRTDummy');
|
|
||||||
|
|
||||||
@@ -259,7 +259,7 @@ class BetriebsmittelP extends FHCAPI_Controller
|
|||||||
$kaution = $this->input->post('kaution');
|
$kaution = $this->input->post('kaution');
|
||||||
if($kaution) $kaution = str_replace(',', '.', $kaution);
|
if($kaution) $kaution = str_replace(',', '.', $kaution);
|
||||||
$ausgegebenam = $this->input->post('ausgegebenam');
|
$ausgegebenam = $this->input->post('ausgegebenam');
|
||||||
$retouram = $this->input->post('retouram');
|
$retouram = $this->input->post('retouram') == "" ? null : $this->input->post('retouram');
|
||||||
|
|
||||||
// NOTE(chris): transform_kartennummer
|
// NOTE(chris): transform_kartennummer
|
||||||
if ($betriebsmitteltyp == 'Zutrittskarte' && $nummer)
|
if ($betriebsmitteltyp == 'Zutrittskarte' && $nummer)
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ class Detailheader extends FHCAPI_Controller
|
|||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct([
|
parent::__construct([
|
||||||
'getHeader' => ['vertrag/mitarbeiter:r'],
|
'getHeader' => ['vertrag/mitarbeiter:r', 'basis/mitarbeiter:r'],
|
||||||
'getPersonAbteilung' => ['vertrag/mitarbeiter:r'],
|
'getPersonAbteilung' => ['vertrag/mitarbeiter:r', 'basis/mitarbeiter:r'],
|
||||||
'getLeitungOrg' => ['vertrag/mitarbeiter:r'],
|
'getLeitungOrg' => ['vertrag/mitarbeiter:r', 'basis/mitarbeiter:r'],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -294,6 +294,10 @@ class Funktionen extends FHCAPI_Controller
|
|||||||
{
|
{
|
||||||
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||||
}
|
}
|
||||||
|
if($datum_von == '')
|
||||||
|
$datum_von = null;
|
||||||
|
if($datum_bis == '')
|
||||||
|
$datum_bis = null;
|
||||||
|
|
||||||
$result = $this->BenutzerfunktionModel->update(
|
$result = $this->BenutzerfunktionModel->update(
|
||||||
[
|
[
|
||||||
|
|||||||
@@ -371,6 +371,9 @@ class Abschlusspruefung extends FHCAPI_Controller
|
|||||||
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$datum = $formData['datum'] == '' ? null : $formData['datum'];
|
||||||
|
$sponsion = $formData['sponsion'] == '' ? null : $formData['sponsion'];
|
||||||
|
|
||||||
$result = $this->AbschlusspruefungModel->update(
|
$result = $this->AbschlusspruefungModel->update(
|
||||||
[
|
[
|
||||||
'abschlusspruefung_id' => $abschlusspruefung_id
|
'abschlusspruefung_id' => $abschlusspruefung_id
|
||||||
@@ -382,8 +385,8 @@ class Abschlusspruefung extends FHCAPI_Controller
|
|||||||
'vorsitz' => $vorsitz,
|
'vorsitz' => $vorsitz,
|
||||||
'pruefungsantritt_kurzbz' => $formData['pruefungsantritt_kurzbz'],
|
'pruefungsantritt_kurzbz' => $formData['pruefungsantritt_kurzbz'],
|
||||||
'abschlussbeurteilung_kurzbz' => $formData['abschlussbeurteilung_kurzbz'],
|
'abschlussbeurteilung_kurzbz' => $formData['abschlussbeurteilung_kurzbz'],
|
||||||
'datum' => $formData['datum'],
|
'datum' => $datum,
|
||||||
'sponsion' => $formData['sponsion'],
|
'sponsion' => $sponsion,
|
||||||
'pruefer1' => $pruefer1,
|
'pruefer1' => $pruefer1,
|
||||||
'pruefer2' => $pruefer2,
|
'pruefer2' => $pruefer2,
|
||||||
'pruefer3' => $pruefer3,
|
'pruefer3' => $pruefer3,
|
||||||
|
|||||||
@@ -170,6 +170,8 @@ class Dokumente extends FHCAPI_Controller
|
|||||||
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$nachgereicht_am = $this->input->post('nachgereicht_am') == '' ? null : $this->input->post('nachgereicht_am');
|
||||||
|
|
||||||
$uid = getAuthUID();
|
$uid = getAuthUID();
|
||||||
|
|
||||||
$result = $this->AkteModel->update(
|
$result = $this->AkteModel->update(
|
||||||
@@ -180,7 +182,7 @@ class Dokumente extends FHCAPI_Controller
|
|||||||
'dokument_kurzbz' => $this->input->post('dokument_kurzbz'),
|
'dokument_kurzbz' => $this->input->post('dokument_kurzbz'),
|
||||||
'anmerkung_intern' => $this->input->post('anmerkung_intern'),
|
'anmerkung_intern' => $this->input->post('anmerkung_intern'),
|
||||||
'titel_intern' => $this->input->post('titel_intern'),
|
'titel_intern' => $this->input->post('titel_intern'),
|
||||||
'nachgereicht_am' => $this->input->post('nachgereicht_am'),
|
'nachgereicht_am' => $nachgereicht_am,
|
||||||
'updateamum' => date('c'),
|
'updateamum' => date('c'),
|
||||||
'updatevon' => $uid,
|
'updatevon' => $uid,
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -429,9 +429,12 @@ class Konto extends FHCAPI_Controller
|
|||||||
'updateamum' => date('c'),
|
'updateamum' => date('c'),
|
||||||
'updatevon' => getAuthUID()
|
'updatevon' => getAuthUID()
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($allowed as $field)
|
foreach ($allowed as $field)
|
||||||
if ($this->input->post($field) !== null)
|
if ($this->input->post($field) !== null)
|
||||||
$data[$field] = $this->input->post($field);
|
$data[$field] = $this->input->post($field);
|
||||||
|
if($data['buchungsdatum'] == '')
|
||||||
|
$data['buchungsdatum'] = null;
|
||||||
|
|
||||||
$result = $this->KontoModel->update($id, $data);
|
$result = $this->KontoModel->update($id, $data);
|
||||||
|
|
||||||
|
|||||||
@@ -237,8 +237,8 @@ class Mobility extends FHCAPI_Controller
|
|||||||
}
|
}
|
||||||
$formData = $this->input->post('formData');
|
$formData = $this->input->post('formData');
|
||||||
|
|
||||||
$von = $formData['von'] ?? null;
|
$von = ($formData['von'] ?? '') ?: null;
|
||||||
$bis = $formData['bis'] ?? null;
|
$bis = ($formData['bis'] ?? '') ?: null;
|
||||||
$nation_code = $formData['nation_code'] ?? null;
|
$nation_code = $formData['nation_code'] ?? null;
|
||||||
$mobilitaetsprogramm_code = $formData['mobilitaetsprogramm_code'] ?? null;
|
$mobilitaetsprogramm_code = $formData['mobilitaetsprogramm_code'] ?? null;
|
||||||
$herkunftsland_code = $formData['herkunftsland_code'] ?? null;
|
$herkunftsland_code = $formData['herkunftsland_code'] ?? null;
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ class Prestudent extends FHCAPI_Controller
|
|||||||
}
|
}
|
||||||
elseif (
|
elseif (
|
||||||
$val === ''
|
$val === ''
|
||||||
&& in_array($prop, ['zgvnation', 'zgvmanation', 'zgvdoktornation', 'berufstaetigkeit_code', 'ausbildungcode'])
|
&& in_array($prop, ['zgvnation', 'zgvmanation', 'zgvdoktornation', 'berufstaetigkeit_code', 'ausbildungcode', 'zgvdatum', 'zgvmadatum'])
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
$val = null;
|
$val = null;
|
||||||
|
|||||||
@@ -448,8 +448,10 @@ class Pruefung extends FHCAPI_Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$datum = $this->input->post('datum') == '' ? null : $this->input->post('datum');
|
||||||
if(intval($pruefung_id) > 0)
|
if(intval($pruefung_id) > 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
$result = $this->PruefungModel->update(
|
$result = $this->PruefungModel->update(
|
||||||
[
|
[
|
||||||
'pruefung_id' => $pruefung_id
|
'pruefung_id' => $pruefung_id
|
||||||
@@ -459,7 +461,7 @@ class Pruefung extends FHCAPI_Controller
|
|||||||
'mitarbeiter_uid' => $this->input->post('mitarbeiter_uid'),
|
'mitarbeiter_uid' => $this->input->post('mitarbeiter_uid'),
|
||||||
'note' => $this->input->post('note'),
|
'note' => $this->input->post('note'),
|
||||||
'pruefungstyp_kurzbz' => $this->input->post('pruefungstyp_kurzbz'),
|
'pruefungstyp_kurzbz' => $this->input->post('pruefungstyp_kurzbz'),
|
||||||
'datum' => $this->input->post('datum'),
|
'datum' => $datum,
|
||||||
'anmerkung' => $this->input->post('anmerkung'),
|
'anmerkung' => $this->input->post('anmerkung'),
|
||||||
'updatevon' => $authUID,
|
'updatevon' => $authUID,
|
||||||
'updateamum' => date('c'),
|
'updateamum' => date('c'),
|
||||||
@@ -472,7 +474,7 @@ class Pruefung extends FHCAPI_Controller
|
|||||||
'lehreinheit_id' => $this->input->post('lehreinheit_id'),
|
'lehreinheit_id' => $this->input->post('lehreinheit_id'),
|
||||||
'student_uid' => $this->input->post('student_uid'),
|
'student_uid' => $this->input->post('student_uid'),
|
||||||
'mitarbeiter_uid' => $this->input->post('mitarbeiter_uid'),
|
'mitarbeiter_uid' => $this->input->post('mitarbeiter_uid'),
|
||||||
'datum' => $this->input->post('datum'),
|
'datum' => $datum,
|
||||||
'pruefungstyp_kurzbz' => $this->input->post('pruefungstyp_kurzbz'),
|
'pruefungstyp_kurzbz' => $this->input->post('pruefungstyp_kurzbz'),
|
||||||
'note' => $this->input->post('note'),
|
'note' => $this->input->post('note'),
|
||||||
'anmerkung' => $this->input->post('anmerkung'),
|
'anmerkung' => $this->input->post('anmerkung'),
|
||||||
@@ -520,7 +522,7 @@ class Pruefung extends FHCAPI_Controller
|
|||||||
'studiensemester_kurzbz' => $studiensemester_kurzbz,
|
'studiensemester_kurzbz' => $studiensemester_kurzbz,
|
||||||
'note' => $this->input->post('note'),
|
'note' => $this->input->post('note'),
|
||||||
'uebernahmedatum' => date('c'),
|
'uebernahmedatum' => date('c'),
|
||||||
'benotungsdatum' => $this->input->post('datum'),
|
'benotungsdatum' => $datum,
|
||||||
'insertamum' => date('c'),
|
'insertamum' => date('c'),
|
||||||
'insertvon' => $authUID,
|
'insertvon' => $authUID,
|
||||||
'punkte' => $this->input->post('punkte') ? str_replace(',', '.', $this->input->post('punkte')) : null
|
'punkte' => $this->input->post('punkte') ? str_replace(',', '.', $this->input->post('punkte')) : null
|
||||||
@@ -555,7 +557,7 @@ class Pruefung extends FHCAPI_Controller
|
|||||||
], [
|
], [
|
||||||
'note' => $this->input->post('note'),
|
'note' => $this->input->post('note'),
|
||||||
'uebernahmedatum' => date('c'),
|
'uebernahmedatum' => date('c'),
|
||||||
'benotungsdatum' => $this->input->post('datum'),
|
'benotungsdatum' => $datum,
|
||||||
'updateamum' => date('c'),
|
'updateamum' => date('c'),
|
||||||
'updatevon' => $authUID,
|
'updatevon' => $authUID,
|
||||||
'punkte' => $this->input->post('punkte') ? str_replace(',', '.', $this->input->post('punkte')) : null
|
'punkte' => $this->input->post('punkte') ? str_replace(',', '.', $this->input->post('punkte')) : null
|
||||||
|
|||||||
@@ -296,6 +296,10 @@ class Student extends FHCAPI_Controller
|
|||||||
$fotoval = ($val == '') ? null : str_replace('data:image/jpeg;base64,', '', $val);
|
$fotoval = ($val == '') ? null : str_replace('data:image/jpeg;base64,', '', $val);
|
||||||
$update_person[$prop] = $fotoval;
|
$update_person[$prop] = $fotoval;
|
||||||
}
|
}
|
||||||
|
else if ($prop == 'gebdatum')
|
||||||
|
{
|
||||||
|
$update_person[$prop] = ($val == '') ? null : $val;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$update_person[$prop] = $val;
|
$update_person[$prop] = $val;
|
||||||
|
|||||||
@@ -1,112 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
if (!defined("BASEPATH")) exit("No direct script access allowed");
|
|
||||||
|
|
||||||
/**
|
|
||||||
* - This controller acts as interface of the LongRunTaskLib that contains
|
|
||||||
* all the needed functionalities to operate with the Long Run Task system
|
|
||||||
* that is built on top of the Jobs Queue System
|
|
||||||
* - This is a Job Queue Worker that gets scheduled LRTs from the queue and executes them
|
|
||||||
* - Once all the LRTs have been started checks if there are LRTs that are running for too long and kills them
|
|
||||||
*/
|
|
||||||
class LongRunTaskExecJob extends JOB_Controller
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
*/
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
parent::__construct();
|
|
||||||
|
|
||||||
// Changes the needed configs for LogLib
|
|
||||||
$this->LogLibJob->setConfigs(
|
|
||||||
array(
|
|
||||||
'dbExecuteUser' => get_class($this),
|
|
||||||
'requestId' => 'LRT'
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Loads LongRunTaskLib library
|
|
||||||
$this->load->library('LongRunTaskLib');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Executes all the new LRTs
|
|
||||||
*/
|
|
||||||
public function execEmAll()
|
|
||||||
{
|
|
||||||
$this->logInfo('Execute long run tasks started');
|
|
||||||
|
|
||||||
// Get all the LRTs that is possible to execute now
|
|
||||||
$lrtsResult = $this->longruntasklib->getNewLRTs();
|
|
||||||
// If an error occurred then return it
|
|
||||||
if (isError($lrtsResult)) return $lrtsResult;
|
|
||||||
|
|
||||||
if (hasData($lrtsResult))
|
|
||||||
{
|
|
||||||
// For each LRT
|
|
||||||
foreach (getData($lrtsResult) as $lrt)
|
|
||||||
{
|
|
||||||
// Execute the task
|
|
||||||
$executeLrtResult = $this->longruntasklib->executeLrt($lrt);
|
|
||||||
if (isError($executeLrtResult)) $this->logError($executeLrtResult);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->logInfo('Execute long run tasks ended');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Kills all the hanging LRTs
|
|
||||||
*/
|
|
||||||
public function killHangingLRTs()
|
|
||||||
{
|
|
||||||
$this->logInfo('Kill hanging LRTs started');
|
|
||||||
|
|
||||||
// Get all the LRTs that is possible to execute now
|
|
||||||
$lrtsResult = $this->longruntasklib->getHangingLRTs();
|
|
||||||
// If an error occurred then return it
|
|
||||||
if (isError($lrtsResult)) return $lrtsResult;
|
|
||||||
|
|
||||||
if (hasData($lrtsResult))
|
|
||||||
{
|
|
||||||
// For each LRT
|
|
||||||
foreach (getData($lrtsResult) as $lrt)
|
|
||||||
{
|
|
||||||
// Kill the task
|
|
||||||
$killLrtResult = $this->longruntasklib->killLrt($lrt);
|
|
||||||
if (isError($killLrtResult)) $this->logError($killLrtResult);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->logInfo('Kill hanging LRTs ended');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function checkExecution()
|
|
||||||
{
|
|
||||||
$this->logInfo('Check execution long run tasks started');
|
|
||||||
|
|
||||||
// Get the related LRT data from the queue
|
|
||||||
$lrtsResult = $this->longruntasklib->getRunningLRTs();
|
|
||||||
// If an error occurred then return it
|
|
||||||
if (isError($lrtsResult)) return $lrtsResult;
|
|
||||||
|
|
||||||
// If there are running LRTs
|
|
||||||
if (hasData($lrtsResult))
|
|
||||||
{
|
|
||||||
// For each LRT
|
|
||||||
foreach (getData($lrtsResult) as $lrt)
|
|
||||||
{
|
|
||||||
// Check the LRT execution
|
|
||||||
$checkExecutionResult = $this->longruntasklib->checkExecution($lrt);
|
|
||||||
if (isError($checkExecutionResult)) $this->logError($checkExecutionResult);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->logInfo('Check execution long run tasks ended');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,82 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
if (!defined("BASEPATH")) exit("No direct script access allowed");
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Testing LRT to check if the LRT system is working properly
|
|
||||||
* This will be called by the LongRunTaskExecJob
|
|
||||||
*/
|
|
||||||
class LRTDummy extends LRT_Controller
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* This method must be implemented!
|
|
||||||
*/
|
|
||||||
public function run($jobid)
|
|
||||||
{
|
|
||||||
$this->logInfo('Long run tasks '.get_class($this).' started');
|
|
||||||
|
|
||||||
$this->_doIt($jobid);
|
|
||||||
|
|
||||||
$this->logInfo('Long run tasks '.get_class($this).' ended');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Loops on the number of seconds provided by the LRT input
|
|
||||||
* Sleeps every time 1 sec
|
|
||||||
* Writes the progress
|
|
||||||
* Writes the output
|
|
||||||
*/
|
|
||||||
private function _doIt($jobid)
|
|
||||||
{
|
|
||||||
// Get the LRT record related to the provided jobid
|
|
||||||
$lrtResult = $this->getLrt($jobid);
|
|
||||||
|
|
||||||
// If an error occurred or the record has not been found
|
|
||||||
if (isError($lrtResult))
|
|
||||||
{
|
|
||||||
$this->logError($lrtResult);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!hasData($lrtResult))
|
|
||||||
{
|
|
||||||
$this->logError('LRT not found in database');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the record
|
|
||||||
$lrt = getData($lrtResult)[0];
|
|
||||||
|
|
||||||
// Get and check the input
|
|
||||||
$input = json_decode($lrt->{LongRunTaskLib::PROPERTY_INPUT});
|
|
||||||
if ($input == null)
|
|
||||||
{
|
|
||||||
$this->logError('LRT input is not a valid json');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Operation
|
|
||||||
for ($i = 0; $i < (int)$input->sleep; $i++)
|
|
||||||
{
|
|
||||||
sleep(1);
|
|
||||||
// Set the progress
|
|
||||||
$setProgressResult = $this->setProgress($jobid, (($i + 1) / (int)$input->sleep) * 100);
|
|
||||||
if (isError($setProgressResult))
|
|
||||||
{
|
|
||||||
$this->logError($setProgressResult);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$sleepMsg = 'The user '.$lrt->{LongRunTaskLib::PROPERTY_UID}.' slept for '.$input->sleep.' seconds';
|
|
||||||
|
|
||||||
$this->logInfo($sleepMsg);
|
|
||||||
|
|
||||||
// Set the output
|
|
||||||
$setOutputResult = $this->setOutput($jobid, $sleepMsg);
|
|
||||||
if (isError($setOutputResult))
|
|
||||||
{
|
|
||||||
$this->logError($setOutputResult);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
|
||||||
|
|
||||||
use \stdClass as stdClass;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
class LRTTest extends Auth_Controller
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
parent::__construct(
|
|
||||||
array(
|
|
||||||
'index' => 'system/developer:r',
|
|
||||||
'lrt1min' => 'system/developer:r',
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Loads LongRunTaskLib library
|
|
||||||
$this->load->library('LongRunTaskLib');
|
|
||||||
}
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------------------
|
|
||||||
// Public methods
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Everything has a beginning
|
|
||||||
*/
|
|
||||||
public function index()
|
|
||||||
{
|
|
||||||
$this->load->view('system/lrtTest.php');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function lrt1min()
|
|
||||||
{
|
|
||||||
$lrtInput = new stdClass();
|
|
||||||
$lrtInput->sleep = 1; // Sleep for 1 min
|
|
||||||
|
|
||||||
$this->outputJsonSuccess(
|
|
||||||
$this->longruntasklib->addNewLrtToQueue(
|
|
||||||
'LRTDummy', // LRT type
|
|
||||||
getAuthUID(), // UID executer
|
|
||||||
$lrtInput // LRT input
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,69 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
if (!defined("BASEPATH")) exit("No direct script access allowed");
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Long Run Task
|
|
||||||
*
|
|
||||||
* - This controller acts as interface of the LongRunTaskLib that contains
|
|
||||||
* all the needed functionalities to operate with the Long Run Task system
|
|
||||||
* that is built on top of the Jobs Queue System
|
|
||||||
* - This is an abstract class that provide basic functionalities,
|
|
||||||
* it has to be extended to broaden its logic
|
|
||||||
* - Any implementation of a Long Run Task should extends this class to
|
|
||||||
* properly operate with the LRT system
|
|
||||||
*/
|
|
||||||
abstract class LRT_Controller extends JOB_Controller
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
*/
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
parent::__construct();
|
|
||||||
|
|
||||||
// Changes the needed configs for LogLib
|
|
||||||
$this->LogLibJob->setConfigs(
|
|
||||||
array(
|
|
||||||
'dbExecuteUser' => get_class($this),
|
|
||||||
'requestId' => 'LRT'
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Loads LongRunTaskLib library
|
|
||||||
$this->load->library('LongRunTaskLib');
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------------------------
|
|
||||||
// Public methods
|
|
||||||
|
|
||||||
abstract public function run($jobid);
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------------------------
|
|
||||||
// Protected methods
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
protected function getLrt($jobid)
|
|
||||||
{
|
|
||||||
return $this->longruntasklib->getLrt($jobid);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
protected function setProgress($jobid, $progress)
|
|
||||||
{
|
|
||||||
return $this->longruntasklib->setProgress($jobid, $progress);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
protected function setOutput($jobid, $output)
|
|
||||||
{
|
|
||||||
return $this->longruntasklib->setOutuput($jobid, $output);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
use \stdClass as stdClass;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Library that contains all the needed functionalities to operate with the Jobs Queue System
|
* Library that contains all the needed functionalities to operate with the Jobs Queue System
|
||||||
*/
|
*/
|
||||||
@@ -26,12 +24,12 @@ class JobsQueueLib
|
|||||||
const PROPERTY_END_TIME = 'endtime';
|
const PROPERTY_END_TIME = 'endtime';
|
||||||
const PROPERTY_ERROR = 'error';
|
const PROPERTY_ERROR = 'error';
|
||||||
|
|
||||||
protected $_ci; // CI instance
|
private $_ci; // CI instance
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct($authenticate = true)
|
||||||
{
|
{
|
||||||
// Gets CI instance
|
// Gets CI instance
|
||||||
$this->_ci =& get_instance();
|
$this->_ci =& get_instance();
|
||||||
@@ -64,29 +62,14 @@ class JobsQueueLib
|
|||||||
*/
|
*/
|
||||||
public function getOldestJobs($type, $maxAmount = null)
|
public function getOldestJobs($type, $maxAmount = null)
|
||||||
{
|
{
|
||||||
$types = $type; // default is array
|
$this->_ci->JobsQueueModel->resetQuery();
|
||||||
$limit = 0; // default query limit
|
|
||||||
|
$this->_ci->JobsQueueModel->addOrder('creationtime', 'ASC');
|
||||||
|
|
||||||
// If the maximum amount of jobs to retrieve have been specified
|
// If the maximum amount of jobs to retrieve have been specified
|
||||||
if (is_numeric($maxAmount)) $limit = $maxAmount;
|
if (is_numeric($maxAmount)) $this->_ci->JobsQueueModel->addLimit($maxAmount);
|
||||||
|
|
||||||
// If it is a string then include it into an array
|
return $this->_ci->JobsQueueModel->loadWhere(array('status' => self::STATUS_NEW, 'type' => $type));
|
||||||
if (!isEmptyString($type) && is_string($type)) $types = array($type);
|
|
||||||
|
|
||||||
// Return the result of the query
|
|
||||||
return $this->_ci->JobsQueueModel->execReadOnlyQuery('
|
|
||||||
SELECT jq.*
|
|
||||||
FROM system.tbl_jobsqueue jq
|
|
||||||
WHERE jq.type IN ?
|
|
||||||
AND jq.status = ?
|
|
||||||
ORDER BY jq.creationtime DESC
|
|
||||||
LIMIT ?',
|
|
||||||
array(
|
|
||||||
$types,
|
|
||||||
self::STATUS_NEW,
|
|
||||||
$limit
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -94,23 +77,11 @@ class JobsQueueLib
|
|||||||
*/
|
*/
|
||||||
public function getJobsByTypeStatus($type, $status)
|
public function getJobsByTypeStatus($type, $status)
|
||||||
{
|
{
|
||||||
$types = $type; // default is array
|
$this->_ci->JobsQueueModel->resetQuery();
|
||||||
|
|
||||||
// If it is a string then include it into an array
|
$this->_ci->JobsQueueModel->addOrder('creationtime', 'DESC');
|
||||||
if (!isEmptyString($type) && is_string($type)) $types = array($type);
|
|
||||||
|
|
||||||
// Return the result of the query
|
return $this->_ci->JobsQueueModel->loadWhere(array('status' => $status, 'type' => $type));
|
||||||
return $this->_ci->JobsQueueModel->execReadOnlyQuery('
|
|
||||||
SELECT jq.*
|
|
||||||
FROM system.tbl_jobsqueue jq
|
|
||||||
WHERE jq.type IN ?
|
|
||||||
AND jq.status = ?
|
|
||||||
ORDER BY jq.creationtime DESC',
|
|
||||||
array(
|
|
||||||
$types,
|
|
||||||
$status
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -282,31 +253,9 @@ class JobsQueueLib
|
|||||||
return array($job);
|
return array($job);
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------------------------
|
|
||||||
// Protected methods
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if the given job contains a valid type
|
|
||||||
*/
|
|
||||||
protected function _checkJobType($type, $types)
|
|
||||||
{
|
|
||||||
return $this->_inArray($type, $types, self::PROPERTY_TYPE);
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------
|
||||||
// Private methods
|
// Private methods
|
||||||
|
|
||||||
/**
|
|
||||||
* Drop not allowed properties from the given job
|
|
||||||
*/
|
|
||||||
private function _dropNotAllowedPropertiesNewJob(&$job)
|
|
||||||
{
|
|
||||||
unset($job->{self::PROPERTY_JOBID});
|
|
||||||
unset($job->{self::PROPERTY_CREATIONTIME});
|
|
||||||
unset($job->{self::PROPERTY_TYPE});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks the job object structure when needed for insert
|
* Checks the job object structure when needed for insert
|
||||||
*/
|
*/
|
||||||
@@ -332,6 +281,34 @@ class JobsQueueLib
|
|||||||
return false; // better sorry than wrong
|
return false; // better sorry than wrong
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks the job object structure when needed for update
|
||||||
|
*/
|
||||||
|
private function _checkUpdateJobStructure(&$job)
|
||||||
|
{
|
||||||
|
// If job is a valid object
|
||||||
|
if (is_object($job) && property_exists($job, self::PROPERTY_JOBID)) return true; // it is valid!
|
||||||
|
|
||||||
|
// If not object then object it!
|
||||||
|
if (!is_object($job)) $job = new stdClass();
|
||||||
|
|
||||||
|
// If an error property was not already previously stored then store an error message in job object
|
||||||
|
if (!property_exists($job, self::PROPERTY_ERROR))
|
||||||
|
{
|
||||||
|
$job->{self::PROPERTY_ERROR} = 'The structure of the provided job is not valid';
|
||||||
|
}
|
||||||
|
|
||||||
|
return false; // better sorry than wrong
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the given job contains a valid type
|
||||||
|
*/
|
||||||
|
private function _checkJobType($type, $types)
|
||||||
|
{
|
||||||
|
return $this->_inArray($type, $types, self::PROPERTY_TYPE);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the given job contains a valid status
|
* Checks if the given job contains a valid status
|
||||||
*/
|
*/
|
||||||
@@ -356,26 +333,6 @@ class JobsQueueLib
|
|||||||
return $found;
|
return $found;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks the job object structure when needed for update
|
|
||||||
*/
|
|
||||||
private function _checkUpdateJobStructure(&$job)
|
|
||||||
{
|
|
||||||
// If job is a valid object
|
|
||||||
if (is_object($job) && property_exists($job, self::PROPERTY_JOBID)) return true; // it is valid!
|
|
||||||
|
|
||||||
// If not object then object it!
|
|
||||||
if (!is_object($job)) $job = new stdClass();
|
|
||||||
|
|
||||||
// If an error property was not already previously stored then store an error message in job object
|
|
||||||
if (!property_exists($job, self::PROPERTY_ERROR))
|
|
||||||
{
|
|
||||||
$job->{self::PROPERTY_ERROR} = 'The structure of the provided job is not valid';
|
|
||||||
}
|
|
||||||
|
|
||||||
return false; // better sorry than wrong
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Search in an array the given value
|
* Search in an array the given value
|
||||||
* The elements of the given array are objects
|
* The elements of the given array are objects
|
||||||
@@ -397,6 +354,16 @@ class JobsQueueLib
|
|||||||
return $found;
|
return $found;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Drop not allowed properties from the given job
|
||||||
|
*/
|
||||||
|
private function _dropNotAllowedPropertiesNewJob(&$job)
|
||||||
|
{
|
||||||
|
unset($job->{self::PROPERTY_JOBID});
|
||||||
|
unset($job->{self::PROPERTY_CREATIONTIME});
|
||||||
|
unset($job->{self::PROPERTY_TYPE});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Drop not allowed properties from the given job
|
* Drop not allowed properties from the given job
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,333 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
|
||||||
|
|
||||||
require_once 'JobsQueueLib.php';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Library that contains all the needed functionalities to operate with the Long Run Tasks
|
|
||||||
*/
|
|
||||||
class LongRunTaskLib extends JobsQueueLib
|
|
||||||
{
|
|
||||||
// Config names
|
|
||||||
const CFG_LRT_MAX_NUMBER_SYSTEM = 'lrt_max_number_system';
|
|
||||||
const CFG_LRT_TYPES = 'lrt_types';
|
|
||||||
const CFG_LRT_MAX_RUN = 'lrt_max_run_timeout';
|
|
||||||
const CFG_LRT_MAX_NUMBER_USER = 'lrt_max_number_single_user';
|
|
||||||
|
|
||||||
// LRT object properties
|
|
||||||
const PROPERTY_UID = 'uid';
|
|
||||||
const PROPERTY_PID = 'pid';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
*/
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
parent::__construct();
|
|
||||||
|
|
||||||
// Loads the Long Run Tasks configs
|
|
||||||
$this->_ci->config->load('lrt');
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------------------------
|
|
||||||
// Public methods used by the LongRunTaskExecJob
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the oldest added LRTs to the queue having status = new
|
|
||||||
* The maximum number of returned queued LRTs is limited by:
|
|
||||||
* number of currently running LRTs - maximum allowed number of LRTs for the system
|
|
||||||
*/
|
|
||||||
public function getNewLRTs()
|
|
||||||
{
|
|
||||||
// Get all the running LRTs
|
|
||||||
$runningLrtsResult = $this->getJobsByTypeStatus($this->_ci->config->item(self::CFG_LRT_TYPES), JobsQueueLib::STATUS_RUNNING);
|
|
||||||
|
|
||||||
if (isError($runningLrtsResult)) return $runningLrtsResult;
|
|
||||||
|
|
||||||
// The number of the currently running LRTs - the maximum LRTs for the system
|
|
||||||
$max_number_of_lrts = $this->_ci->config->item(self::CFG_LRT_MAX_NUMBER_SYSTEM) - count(getData($runningLrtsResult));
|
|
||||||
|
|
||||||
// Get the oldest LRTs added to the queue
|
|
||||||
return $this->getOldestJobs($this->_ci->config->item(self::CFG_LRT_TYPES), $max_number_of_lrts);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get all the LRT that are running more then CFG_LRT_MAX_RUN hours
|
|
||||||
*/
|
|
||||||
public function getHangingLRTs()
|
|
||||||
{
|
|
||||||
// Return the result of the query
|
|
||||||
return $this->_ci->JobsQueueModel->execReadOnlyQuery('
|
|
||||||
SELECT jq.*
|
|
||||||
FROM system.tbl_jobsqueue jq
|
|
||||||
WHERE jq.type IN ?
|
|
||||||
AND jq.status = ?
|
|
||||||
AND jq.starttime < NOW() - INTERVAL \''.$this->_ci->config->item(self::CFG_LRT_MAX_RUN).' hours\'
|
|
||||||
ORDER BY jq.creationtime DESC',
|
|
||||||
array(
|
|
||||||
$this->_ci->config->item(self::CFG_LRT_TYPES),
|
|
||||||
JobsQueueLib::STATUS_RUNNING
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get all the LRT that are currently running
|
|
||||||
*/
|
|
||||||
public function getRunningLRTs()
|
|
||||||
{
|
|
||||||
// Return the result of the query
|
|
||||||
return $this->_ci->JobsQueueModel->execReadOnlyQuery('
|
|
||||||
SELECT jq.*
|
|
||||||
FROM system.tbl_jobsqueue jq
|
|
||||||
WHERE jq.type IN ?
|
|
||||||
AND jq.status = ?
|
|
||||||
ORDER BY jq.creationtime DESC',
|
|
||||||
array(
|
|
||||||
$this->_ci->config->item(self::CFG_LRT_TYPES),
|
|
||||||
JobsQueueLib::STATUS_RUNNING
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Execute a LRT in background
|
|
||||||
* - Checks if the wanted LRT exists in the applcation/controllers/lrts directory
|
|
||||||
* - Then executes it in background via CI CLI
|
|
||||||
* - Stores the LRT pid into the database
|
|
||||||
*/
|
|
||||||
public function executeLrt($lrt)
|
|
||||||
{
|
|
||||||
$output = array();
|
|
||||||
|
|
||||||
// If does _not_ exist a LRT implementation for this LRT type, then return an error
|
|
||||||
if (!file_exists(APPPATH.'controllers/lrts/'.$lrt->{self::PROPERTY_TYPE}.'.php'))
|
|
||||||
{
|
|
||||||
return error('The required LRT implementation has not been found');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Execute the LRT implementation (a CI controller from CLI) providing as parameter the jobid
|
|
||||||
exec(
|
|
||||||
// Command
|
|
||||||
sprintf(
|
|
||||||
'/usr/bin/php %s/../index.ci.php lrts/%s/run %s > /dev/null 2>&1 & echo $!',
|
|
||||||
APPPATH,
|
|
||||||
$lrt->{self::PROPERTY_TYPE},
|
|
||||||
$lrt->{self::PROPERTY_JOBID}
|
|
||||||
),
|
|
||||||
$output // Here goes the output from the standard output and error
|
|
||||||
);
|
|
||||||
|
|
||||||
// If a pid has not been returned
|
|
||||||
if (isEmptyArray($output) || !is_numeric($output[0])) return error('Not a valid pid has been returned');
|
|
||||||
|
|
||||||
// Set the pid, status and starttime of this LRT into the database
|
|
||||||
$updateLrtResult = $this->_ci->JobsQueueModel->update(
|
|
||||||
$lrt->{self::PROPERTY_JOBID},
|
|
||||||
array(
|
|
||||||
'pid' => $output[0],
|
|
||||||
'starttime' => 'NOW()',
|
|
||||||
'status' => self::STATUS_RUNNING
|
|
||||||
)
|
|
||||||
);
|
|
||||||
if (isError($updateLrtResult)) return $updateLrtResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Kill the provided LRT
|
|
||||||
* To avoid to kill a process that is not this LRT,
|
|
||||||
* since the same PID can be assigned to another process once this ended
|
|
||||||
*/
|
|
||||||
public function killLrt($lrt)
|
|
||||||
{
|
|
||||||
// Try to get the pid of this LRT from the system
|
|
||||||
$pid = exec(
|
|
||||||
sprintf(
|
|
||||||
'ps -eo pid,cmd | grep "index.ci.php lrts/%s/run %s" | grep -v grep | awk \'{print $1}\'',
|
|
||||||
$lrt->{self::PROPERTY_TYPE},
|
|
||||||
$lrt->{self::PROPERTY_JOBID}
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
// If the pid is the same then kill the process with a SIGKILL
|
|
||||||
if ($pid == $lrt->{self::PROPERTY_PID}) exec('kill -9 '.$lrt->{self::PROPERTY_PID}.' > /dev/null 2>&1');
|
|
||||||
|
|
||||||
// Set the LRT as failed in any case
|
|
||||||
$lrtExecFailedResult = $this->_ci->JobsQueueModel->update(
|
|
||||||
$lrt->{self::PROPERTY_JOBID},
|
|
||||||
array(
|
|
||||||
'endtime' => 'NOW()',
|
|
||||||
'status' => self::STATUS_FAILED
|
|
||||||
)
|
|
||||||
);
|
|
||||||
// If an error occurred then return it
|
|
||||||
if (isError($lrtExecFailedResult)) return $lrtExecFailedResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function checkExecution($lrt)
|
|
||||||
{
|
|
||||||
// If the LRT stopped running
|
|
||||||
if (!$this->_isRunning($lrt))
|
|
||||||
{
|
|
||||||
// Loads MessageLib library
|
|
||||||
$this->_ci->load->library('MessageLib');
|
|
||||||
// Load the BenutzerModel
|
|
||||||
$this->_ci->load->model('person/Benutzer_model', 'BenutzerModel');
|
|
||||||
|
|
||||||
// Get the benutzer for this uid
|
|
||||||
$benutzerResult = $this->_ci->BenutzerModel->loadWhere(array('uid' => $lrt->{LongRunTaskLib::PROPERTY_UID}));
|
|
||||||
// If an error occurred then return it
|
|
||||||
if (isError($benutzerResult)) return $benutzerResult;
|
|
||||||
// If no benutzer has been found
|
|
||||||
if (!hasData($benutzerResult)) return error('No benutzer found, uid: '.$lrt->{LongRunTaskLib::PROPERTY_UID});
|
|
||||||
|
|
||||||
$benutzer = getData($benutzerResult)[0];
|
|
||||||
|
|
||||||
// Sends a message to the user
|
|
||||||
$messageResult = $this->_ci->messagelib->sendMessageUser(
|
|
||||||
$benutzer->person_id,
|
|
||||||
'Long run task ended',
|
|
||||||
'The long run task '.$lrt->{self::PROPERTY_TYPE}.' ended, output: '.$lrt->{self::PROPERTY_OUTPUT}
|
|
||||||
);
|
|
||||||
// If an error occurred then return it
|
|
||||||
if (isError($messageResult)) return $messageResult;
|
|
||||||
|
|
||||||
// Set the LRT as done
|
|
||||||
$lrtExecOverResult = $this->_ci->JobsQueueModel->update(
|
|
||||||
$lrt->{self::PROPERTY_JOBID},
|
|
||||||
array(
|
|
||||||
'endtime' => 'NOW()',
|
|
||||||
'status' => self::STATUS_DONE
|
|
||||||
)
|
|
||||||
);
|
|
||||||
// If an error occurred then return it
|
|
||||||
if (isError($lrtExecOverResult)) return $lrtExecOverResult;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------------------------
|
|
||||||
// Public methods used by the front end applications (standard controllers/end points, ex. controllers/system/LRTTest.php)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a single LRT to the queue
|
|
||||||
*/
|
|
||||||
public function addNewLrtToQueue($type, $uid, $lrtInput)
|
|
||||||
{
|
|
||||||
// Checks parameters
|
|
||||||
if (isEmptyString($type)) return error('The provided type parameter is not a valid string');
|
|
||||||
if (isEmptyString($uid)) return error('The provided uid parameter is not a valid string');
|
|
||||||
|
|
||||||
// Get all the running task for this uid
|
|
||||||
// Return the result of the query
|
|
||||||
$runningLRTbyUIDResult = $this->_ci->JobsQueueModel->execReadOnlyQuery('
|
|
||||||
SELECT jq.*
|
|
||||||
FROM system.tbl_jobsqueue jq
|
|
||||||
WHERE jq.status IN ?
|
|
||||||
AND jq.uid = ?
|
|
||||||
',
|
|
||||||
array(
|
|
||||||
array(
|
|
||||||
self::STATUS_NEW,
|
|
||||||
self::STATUS_RUNNING
|
|
||||||
),
|
|
||||||
$uid
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
// If an error occurred then return it
|
|
||||||
if (isError($runningLRTbyUIDResult)) return $runningLRTbyUIDResult;
|
|
||||||
|
|
||||||
// If the running tasks for this user are too many
|
|
||||||
if (count(getData($runningLRTbyUIDResult)) >= $this->_ci->config->item(self::CFG_LRT_MAX_NUMBER_USER))
|
|
||||||
{
|
|
||||||
return error('Too many running tasks for this user');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convert input to JSON and check it
|
|
||||||
$jsonLrtInput = json_encode($lrtInput);
|
|
||||||
if ($jsonLrtInput == null) return error('The provided LRT input is not valid');
|
|
||||||
|
|
||||||
// Get all the job types
|
|
||||||
$dbResult = $this->_ci->JobTypesModel->load();
|
|
||||||
if (isError($dbResult)) return $dbResult;
|
|
||||||
$types = getData($dbResult);
|
|
||||||
|
|
||||||
// If the given type is not present in database
|
|
||||||
if (!$this->_checkJobType($type, $types)) return error('The provided type parameter is not valid');
|
|
||||||
|
|
||||||
// Get all the job statuses
|
|
||||||
$dbResult = $this->_ci->JobStatusesModel->load();
|
|
||||||
if (isError($dbResult)) return $dbResult;
|
|
||||||
$statuses = getData($dbResult);
|
|
||||||
|
|
||||||
// Create an object that represent the new tbl_jobsqueue record with the provided input
|
|
||||||
$lrt = $this->generateJobs(self::STATUS_NEW, $jsonLrtInput)[0];
|
|
||||||
|
|
||||||
// What you asked is what you get!
|
|
||||||
$lrt->{self::PROPERTY_TYPE} = $type;
|
|
||||||
$lrt->{self::PROPERTY_UID} = $uid;
|
|
||||||
|
|
||||||
// Try to insert the single lrt into database
|
|
||||||
$dbNewLrtResult = $this->_ci->JobsQueueModel->insert($lrt);
|
|
||||||
|
|
||||||
// If an error occurred during while inserting in database
|
|
||||||
if (isError($dbNewLrtResult)) return $dbNewLrtResult;
|
|
||||||
|
|
||||||
return success('LRT added to the queue');
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------------------------
|
|
||||||
// Public methods used by the LRT implementation (controllers/ltrs/*, ex. controllers/ltrs/LRTDummy)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a single record from the
|
|
||||||
*/
|
|
||||||
public function getLrt($jobid)
|
|
||||||
{
|
|
||||||
$this->_ci->JobsQueueModel->resetQuery();
|
|
||||||
|
|
||||||
return $this->_ci->JobsQueueModel->loadWhere(array('jobid' => $jobid));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function setProgress($jobid, $progress)
|
|
||||||
{
|
|
||||||
return $this->_ci->JobsQueueModel->update($jobid, array('progress' => $progress));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function setOutuput($jobid, $output)
|
|
||||||
{
|
|
||||||
return $this->_ci->JobsQueueModel->update($jobid, array('output' => json_encode($output)));
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------------------------
|
|
||||||
// Private methods
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return true if the LRT is still running
|
|
||||||
*/
|
|
||||||
private function _isRunning($lrt)
|
|
||||||
{
|
|
||||||
// Try to get the pid of this LRT from the system
|
|
||||||
$pid = exec(
|
|
||||||
sprintf(
|
|
||||||
'ps -eo pid,cmd | grep "index.ci.php lrts/%s/run %s" | grep -v grep | awk \'{print $1}\'',
|
|
||||||
$lrt->{self::PROPERTY_TYPE},
|
|
||||||
$lrt->{self::PROPERTY_JOBID}
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
// If the pid is the same then the LRT is still running
|
|
||||||
return $pid == $lrt->{self::PROPERTY_PID};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -122,6 +122,47 @@ class Studiensemester_model extends DB_Model
|
|||||||
return $this->execQuery($query, array($studiensemester_kurzbz, $limit));
|
return $this->execQuery($query, array($studiensemester_kurzbz, $limit));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the current study semester and the previous semesters of the same type (SS/WS).
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* - SS2026, limit 3: SS2026, SS2025, SS2024
|
||||||
|
* - WS2025, limit 2: WS2025, WS2024
|
||||||
|
*
|
||||||
|
* @param $studiensemester_kurzbz
|
||||||
|
* @param $limit
|
||||||
|
*/
|
||||||
|
public function getPreviousSameSemesterFrom($studiensemester_kurzbz, $limit = 1)
|
||||||
|
{
|
||||||
|
$qry = '
|
||||||
|
SELECT
|
||||||
|
studiensemester_kurzbz,
|
||||||
|
start,
|
||||||
|
ende
|
||||||
|
FROM
|
||||||
|
public.tbl_studiensemester
|
||||||
|
WHERE
|
||||||
|
SUBSTRING(studiensemester_kurzbz FROM 1 FOR 2) = SUBSTRING(? FROM 1 FOR 2)
|
||||||
|
AND start <= (
|
||||||
|
SELECT start
|
||||||
|
FROM public.tbl_studiensemester
|
||||||
|
WHERE studiensemester_kurzbz = ?
|
||||||
|
)
|
||||||
|
ORDER BY
|
||||||
|
start DESC
|
||||||
|
LIMIT ?
|
||||||
|
';
|
||||||
|
|
||||||
|
return $this->execQuery($qry,
|
||||||
|
[
|
||||||
|
$studiensemester_kurzbz,
|
||||||
|
$studiensemester_kurzbz,
|
||||||
|
$limit
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* getNearest
|
* getNearest
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -260,7 +260,6 @@ class Benutzerfunktion_model extends DB_Model
|
|||||||
return $this->execQuery($query, $parameters_array);
|
return $this->execQuery($query, $parameters_array);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get active Kompetenzfeldleitung bei UID.
|
* Get active Kompetenzfeldleitung bei UID.
|
||||||
*
|
*
|
||||||
@@ -296,7 +295,6 @@ class Benutzerfunktion_model extends DB_Model
|
|||||||
return $this->execQuery($query, $parameters_array);
|
return $this->execQuery($query, $parameters_array);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function insertBenutzerfunktion($Json)
|
public function insertBenutzerfunktion($Json)
|
||||||
{
|
{
|
||||||
unset($Json['benutzerfunktion_id']);
|
unset($Json['benutzerfunktion_id']);
|
||||||
|
|||||||
@@ -1,28 +0,0 @@
|
|||||||
<?php
|
|
||||||
$includesArray = array(
|
|
||||||
'title' => 'LRT Test Page',
|
|
||||||
'axios027' => true,
|
|
||||||
'bootstrap5' => true,
|
|
||||||
'fontawesome6' => true,
|
|
||||||
'vue3' => true,
|
|
||||||
'navigationcomponent' => true,
|
|
||||||
'phrases' => array(
|
|
||||||
'global',
|
|
||||||
'ui'
|
|
||||||
),
|
|
||||||
'customJSModules' => array('public/js/apps/LRTTest.js'),
|
|
||||||
);
|
|
||||||
|
|
||||||
$this->load->view('templates/FHC-Header', $includesArray);
|
|
||||||
?>
|
|
||||||
|
|
||||||
<div id="main">
|
|
||||||
|
|
||||||
<!-- Navigation component -->
|
|
||||||
<core-navigation-cmpt></core-navigation-cmpt>
|
|
||||||
|
|
||||||
<div id="content"></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php $this->load->view('templates/FHC-Footer', $includesArray); ?>
|
|
||||||
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
export default {
|
|
||||||
addNew1MinLrt()
|
|
||||||
{
|
|
||||||
return {
|
|
||||||
method: 'post',
|
|
||||||
url: '/system/LRTTest/lrt1min'
|
|
||||||
};
|
|
||||||
},
|
|
||||||
}
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (C) 2022 fhcomplete.org
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import PluginsPhrasen from '../plugins/Phrasen.js';
|
|
||||||
import {CoreNavigationCmpt} from '../components/navigation/Navigation.js'
|
|
||||||
|
|
||||||
import ApiLrt from "../api/LRTTEst.js";
|
|
||||||
|
|
||||||
const lrtTestApp = Vue.createApp({
|
|
||||||
data: function() {
|
|
||||||
return {
|
|
||||||
};
|
|
||||||
},
|
|
||||||
components: {
|
|
||||||
CoreNavigationCmpt,
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
addNew1MinLrt() {
|
|
||||||
this.$api.call(ApiLrt.addNew1MinLrt())
|
|
||||||
.then(result => {
|
|
||||||
this.dropdowns.studiensemester_array = result.data;
|
|
||||||
})
|
|
||||||
.catch(this.$fhcAlert.handleSystemError);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
template: `
|
|
||||||
<button type="button" class="btn btn-primary" @click="addNew1MinLrt()">Add a 1 min LRT</button>
|
|
||||||
`
|
|
||||||
});
|
|
||||||
|
|
||||||
FhcApps.makeExtendable(lrtTestApp);
|
|
||||||
|
|
||||||
lrtTestApp.use(PluginsPhrasen).mount('#main');
|
|
||||||
|
|
||||||
@@ -433,6 +433,7 @@ export default {
|
|||||||
:label="$p.t('wawi/ausgegebenam')"
|
:label="$p.t('wawi/ausgegebenam')"
|
||||||
name="ausgegebenam"
|
name="ausgegebenam"
|
||||||
v-model="formData.ausgegebenam"
|
v-model="formData.ausgegebenam"
|
||||||
|
model-type="yyyy-MM-dd"
|
||||||
auto-apply
|
auto-apply
|
||||||
:enable-time-picker="false"
|
:enable-time-picker="false"
|
||||||
text-input
|
text-input
|
||||||
@@ -449,6 +450,7 @@ export default {
|
|||||||
:label="$p.t('wawi/retouram')"
|
:label="$p.t('wawi/retouram')"
|
||||||
name="retouram"
|
name="retouram"
|
||||||
v-model="formData.retouram"
|
v-model="formData.retouram"
|
||||||
|
model-type="yyyy-MM-dd"
|
||||||
auto-apply
|
auto-apply
|
||||||
:enable-time-picker="false"
|
:enable-time-picker="false"
|
||||||
text-input
|
text-input
|
||||||
|
|||||||
@@ -551,6 +551,7 @@ export default {
|
|||||||
container-class="mb-3 col-3"
|
container-class="mb-3 col-3"
|
||||||
type="DatePicker"
|
type="DatePicker"
|
||||||
v-model="formData.datum_von"
|
v-model="formData.datum_von"
|
||||||
|
model-type="yyyy-MM-dd"
|
||||||
name="datum_von"
|
name="datum_von"
|
||||||
:label="$p.t('ui/from') + ' *'"
|
:label="$p.t('ui/from') + ' *'"
|
||||||
auto-apply
|
auto-apply
|
||||||
@@ -566,6 +567,7 @@ export default {
|
|||||||
container-class="mb-3 col-3"
|
container-class="mb-3 col-3"
|
||||||
type="DatePicker"
|
type="DatePicker"
|
||||||
v-model="formData.datum_bis"
|
v-model="formData.datum_bis"
|
||||||
|
model-type="yyyy-MM-dd"
|
||||||
name="datum_bis"
|
name="datum_bis"
|
||||||
:label="$p.t('global/bis')"
|
:label="$p.t('global/bis')"
|
||||||
auto-apply
|
auto-apply
|
||||||
|
|||||||
+1
@@ -470,6 +470,7 @@ export default {
|
|||||||
:label="$p.t('admission', 'anmeldundRtAm')"
|
:label="$p.t('admission', 'anmeldundRtAm')"
|
||||||
type="DatePicker"
|
type="DatePicker"
|
||||||
v-model="formData.anmeldedatum"
|
v-model="formData.anmeldedatum"
|
||||||
|
model-type="yyyy-MM-dd"
|
||||||
auto-apply
|
auto-apply
|
||||||
:enable-time-picker="false"
|
:enable-time-picker="false"
|
||||||
text-input
|
text-input
|
||||||
|
|||||||
@@ -293,6 +293,7 @@ export default {
|
|||||||
:label="$p.t('person', 'geburtsdatum')"
|
:label="$p.t('person', 'geburtsdatum')"
|
||||||
type="DatePicker"
|
type="DatePicker"
|
||||||
v-model="data.gebdatum"
|
v-model="data.gebdatum"
|
||||||
|
model-type="yyyy-MM-dd"
|
||||||
name="gebdatum"
|
name="gebdatum"
|
||||||
:clearable="false"
|
:clearable="false"
|
||||||
no-today
|
no-today
|
||||||
|
|||||||
@@ -103,6 +103,7 @@ export default {
|
|||||||
<form-input
|
<form-input
|
||||||
type="DatePicker"
|
type="DatePicker"
|
||||||
v-model="formData.nachgereicht_am"
|
v-model="formData.nachgereicht_am"
|
||||||
|
model-type="yyyy-MM-dd"
|
||||||
name="nachgereicht_am"
|
name="nachgereicht_am"
|
||||||
:label="$p.t('dokumente/nachreichungAm')"
|
:label="$p.t('dokumente/nachreichungAm')"
|
||||||
auto-apply
|
auto-apply
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ export default {
|
|||||||
return {
|
return {
|
||||||
filter: false,
|
filter: false,
|
||||||
studiengang_kz: false,
|
studiengang_kz: false,
|
||||||
counterdate: new Date()
|
counterdate: luxon.DateTime.now().setZone(FHC_JS_DATA_STORAGE_OBJECT.timezone).toISODate()
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -259,6 +259,7 @@ export default {
|
|||||||
<form-input
|
<form-input
|
||||||
type="DatePicker"
|
type="DatePicker"
|
||||||
v-model="counterdate"
|
v-model="counterdate"
|
||||||
|
model-type="yyyy-MM-dd"
|
||||||
input-group
|
input-group
|
||||||
:enable-time-picker="false"
|
:enable-time-picker="false"
|
||||||
text-input
|
text-input
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ export default {
|
|||||||
<form-input
|
<form-input
|
||||||
type="DatePicker"
|
type="DatePicker"
|
||||||
v-model="data.buchungsdatum"
|
v-model="data.buchungsdatum"
|
||||||
|
model-type="yyyy-MM-dd"
|
||||||
name="buchungsdatum"
|
name="buchungsdatum"
|
||||||
:label="$p.t('konto/buchungsdatum')"
|
:label="$p.t('konto/buchungsdatum')"
|
||||||
:enable-time-picker="false"
|
:enable-time-picker="false"
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ export default {
|
|||||||
this.data = {
|
this.data = {
|
||||||
buchungstyp_kurzbz: '',
|
buchungstyp_kurzbz: '',
|
||||||
betrag: '-0.00',
|
betrag: '-0.00',
|
||||||
buchungsdatum: new Date(),
|
buchungsdatum: luxon.DateTime.now().setZone(FHC_JS_DATA_STORAGE_OBJECT.timezone).toISODate(),
|
||||||
buchungstext: '',
|
buchungstext: '',
|
||||||
mahnspanne: 30,
|
mahnspanne: 30,
|
||||||
studiensemester_kurzbz: this.currentSemester,
|
studiensemester_kurzbz: this.currentSemester,
|
||||||
@@ -154,6 +154,7 @@ export default {
|
|||||||
<form-input
|
<form-input
|
||||||
type="DatePicker"
|
type="DatePicker"
|
||||||
v-model="data.buchungsdatum"
|
v-model="data.buchungsdatum"
|
||||||
|
model-type="yyyy-MM-dd"
|
||||||
name="buchungsdatum"
|
name="buchungsdatum"
|
||||||
:label="$p.t('konto/buchungsdatum')"
|
:label="$p.t('konto/buchungsdatum')"
|
||||||
:enable-time-picker="false"
|
:enable-time-picker="false"
|
||||||
|
|||||||
@@ -467,6 +467,7 @@ export default {
|
|||||||
:label="$p.t('ui', 'von')"
|
:label="$p.t('ui', 'von')"
|
||||||
type="DatePicker"
|
type="DatePicker"
|
||||||
v-model="formData.von"
|
v-model="formData.von"
|
||||||
|
model-type="yyyy-MM-dd"
|
||||||
auto-apply
|
auto-apply
|
||||||
:enable-time-picker="false"
|
:enable-time-picker="false"
|
||||||
text-input
|
text-input
|
||||||
@@ -501,6 +502,7 @@ export default {
|
|||||||
:label="$p.t('global', 'bis')"
|
:label="$p.t('global', 'bis')"
|
||||||
type="DatePicker"
|
type="DatePicker"
|
||||||
v-model="formData.bis"
|
v-model="formData.bis"
|
||||||
|
model-type="yyyy-MM-dd"
|
||||||
auto-apply
|
auto-apply
|
||||||
:enable-time-picker="false"
|
:enable-time-picker="false"
|
||||||
text-input
|
text-input
|
||||||
|
|||||||
@@ -325,6 +325,7 @@ export default {
|
|||||||
:label="$p.t('infocenter', 'zgvDatum')"
|
:label="$p.t('infocenter', 'zgvDatum')"
|
||||||
type="DatePicker"
|
type="DatePicker"
|
||||||
v-model="data.zgvdatum"
|
v-model="data.zgvdatum"
|
||||||
|
model-type="yyyy-MM-dd"
|
||||||
name="zgvdatum"
|
name="zgvdatum"
|
||||||
no-today
|
no-today
|
||||||
auto-apply
|
auto-apply
|
||||||
@@ -389,6 +390,7 @@ export default {
|
|||||||
:label="$p.t('lehre', 'zgvMasterDatum')"
|
:label="$p.t('lehre', 'zgvMasterDatum')"
|
||||||
type="DatePicker"
|
type="DatePicker"
|
||||||
v-model="data.zgvmadatum"
|
v-model="data.zgvmadatum"
|
||||||
|
model-type="yyyy-MM-dd"
|
||||||
name="zgvmadatum"
|
name="zgvmadatum"
|
||||||
no-today
|
no-today
|
||||||
auto-apply
|
auto-apply
|
||||||
@@ -454,6 +456,7 @@ export default {
|
|||||||
:label="$p.t('lehre', 'zgvDoktorDatum')"
|
:label="$p.t('lehre', 'zgvDoktorDatum')"
|
||||||
type="DatePicker"
|
type="DatePicker"
|
||||||
v-model="data.zgvdoktordatum"
|
v-model="data.zgvdoktordatum"
|
||||||
|
model-type="yyyy-MM-dd"
|
||||||
name="zgvdoktordatum"
|
name="zgvdoktordatum"
|
||||||
no-today
|
no-today
|
||||||
auto-apply
|
auto-apply
|
||||||
|
|||||||
@@ -276,6 +276,7 @@ export default{
|
|||||||
container-class="mb-3"
|
container-class="mb-3"
|
||||||
type="DatePicker"
|
type="DatePicker"
|
||||||
v-model="formData.datum"
|
v-model="formData.datum"
|
||||||
|
model-type="yyyy-MM-dd"
|
||||||
name="datum"
|
name="datum"
|
||||||
:label="$p.t('global/datum')"
|
:label="$p.t('global/datum')"
|
||||||
auto-apply
|
auto-apply
|
||||||
@@ -291,6 +292,7 @@ export default{
|
|||||||
container-class="mb-3"
|
container-class="mb-3"
|
||||||
type="DatePicker"
|
type="DatePicker"
|
||||||
v-model="formData.bestaetigtam"
|
v-model="formData.bestaetigtam"
|
||||||
|
model-type="yyyy-MM-dd"
|
||||||
name="bestaetigtam"
|
name="bestaetigtam"
|
||||||
:label="$p.t('lehre/bestaetigt_am')"
|
:label="$p.t('lehre/bestaetigt_am')"
|
||||||
auto-apply
|
auto-apply
|
||||||
@@ -306,13 +308,14 @@ export default{
|
|||||||
container-class="mb-3"
|
container-class="mb-3"
|
||||||
type="DatePicker"
|
type="DatePicker"
|
||||||
v-model="formData.bewerbung_abgeschicktamum"
|
v-model="formData.bewerbung_abgeschicktamum"
|
||||||
|
model-type="yyyy-MM-dd HH:mm:ss"
|
||||||
name="bewerbung_abgeschicktamum"
|
name="bewerbung_abgeschicktamum"
|
||||||
:label="$p.t('lehre/bewerbung_abgeschickt_am')"
|
:label="$p.t('lehre/bewerbung_abgeschickt_am')"
|
||||||
auto-apply
|
auto-apply
|
||||||
:enable-time-picker="false"
|
:enable-time-picker="true"
|
||||||
format="dd.MM.yyyy"
|
format="dd.MM.yyyy HH:mm:ss"
|
||||||
text-input
|
text-input
|
||||||
preview-format="dd.MM.yyyy"
|
preview-format="dd.MM.yyyy HH:mm:ss"
|
||||||
:teleport="true"
|
:teleport="true"
|
||||||
:disabled="bisLocked || !hasPrestudentstatusPermission"
|
:disabled="bisLocked || !hasPrestudentstatusPermission"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -285,6 +285,7 @@ export default {
|
|||||||
uid="stv-list-new-gebdatum"
|
uid="stv-list-new-gebdatum"
|
||||||
name="gebdatum"
|
name="gebdatum"
|
||||||
v-model="formDataPerson['gebdatum']"
|
v-model="formDataPerson['gebdatum']"
|
||||||
|
model-type="yyyy-MM-dd"
|
||||||
:disabled="!!person"
|
:disabled="!!person"
|
||||||
@update:model-value="loadSuggestions"
|
@update:model-value="loadSuggestions"
|
||||||
text-input
|
text-input
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import FormInput from '../Form/Input.js';
|
|||||||
import ApiUdf from '../../api/udf.js';
|
import ApiUdf from '../../api/udf.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
name: 'CoreUdfCmpt',
|
||||||
components: {
|
components: {
|
||||||
CoreFetchCmpt,
|
CoreFetchCmpt,
|
||||||
FormInput
|
FormInput
|
||||||
@@ -26,7 +27,8 @@ export default {
|
|||||||
// The values as associative array
|
// The values as associative array
|
||||||
modelValue: Object,
|
modelValue: Object,
|
||||||
// Show only fields with a name that exists in the filter
|
// Show only fields with a name that exists in the filter
|
||||||
filter: [String, Array]
|
filter: [String, Array],
|
||||||
|
readonly: true
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -35,6 +37,13 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
isPkValid() {
|
||||||
|
// If the provided pk is _not_ valid
|
||||||
|
return !Object.keys(this.pk).every(key => !this.pk[key]);
|
||||||
|
},
|
||||||
|
getReadonly() {
|
||||||
|
return this.readonly;
|
||||||
|
},
|
||||||
filterArray() {
|
filterArray() {
|
||||||
if (!this.filter || Array.isArray(this.filter))
|
if (!this.filter || Array.isArray(this.filter))
|
||||||
return this.filter;
|
return this.filter;
|
||||||
@@ -61,6 +70,10 @@ export default {
|
|||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
pk(n, o) {
|
pk(n, o) {
|
||||||
|
|
||||||
|
// If the provided pk is _not_ valid
|
||||||
|
if (Object.keys(n).every(key => !n[key])) return;
|
||||||
|
|
||||||
if (!this.$refs.fetch)
|
if (!this.$refs.fetch)
|
||||||
return; // NOTE(chris): no initial load yet
|
return; // NOTE(chris): no initial load yet
|
||||||
|
|
||||||
@@ -124,6 +137,7 @@ export default {
|
|||||||
template: `
|
template: `
|
||||||
<div class="core-udf row">
|
<div class="core-udf row">
|
||||||
<core-fetch-cmpt
|
<core-fetch-cmpt
|
||||||
|
v-if="isPkValid"
|
||||||
ref="fetch"
|
ref="fetch"
|
||||||
:api-function="loadF"
|
:api-function="loadF"
|
||||||
:api-function-parameters="{ ciModel, pk }"
|
:api-function-parameters="{ ciModel, pk }"
|
||||||
@@ -138,7 +152,7 @@ export default {
|
|||||||
:type="field.type"
|
:type="field.type"
|
||||||
:multiple="field.multiple"
|
:multiple="field.multiple"
|
||||||
:title="field.description"
|
:title="field.description"
|
||||||
:disabled="field.disabled"
|
:disabled="field.disabled || getReadonly"
|
||||||
:clearable="field.clearable"
|
:clearable="field.clearable"
|
||||||
:auto-apply="field.autoApply"
|
:auto-apply="field.autoApply"
|
||||||
:enable-time-picker="field.enableTimePicker"
|
:enable-time-picker="field.enableTimePicker"
|
||||||
|
|||||||
@@ -218,15 +218,23 @@ export const CoreFilterCmpt = {
|
|||||||
},
|
},
|
||||||
columnsForFilter() {
|
columnsForFilter() {
|
||||||
if (!this.filteredColumns || !this.datasetMetadata) return [];
|
if (!this.filteredColumns || !this.datasetMetadata) return [];
|
||||||
const localizedColumnTitles = this.tabulator.getLang().columns;
|
|
||||||
const isTabulatorLocalized = !!this.$props.tabulatorOptions.locale;
|
const isTabulatorLocalized = !!this.$props.tabulatorOptions.locale;
|
||||||
const filterTitles = this.filteredColumns.reduce((a, c) => {
|
|
||||||
a[c.field] =
|
let filterTitles;
|
||||||
isTabulatorLocalized && localizedColumnTitles[c.field]
|
if (isTabulatorLocalized) {
|
||||||
? localizedColumnTitles[c.field]
|
const localizedColumnTitles = this.tabulator.getLang().columns;
|
||||||
: c.title;
|
filterTitles = this.filteredColumns.reduce((a, c) => {
|
||||||
|
a[c.field] = localizedColumnTitles[c.field];
|
||||||
return a;
|
return a;
|
||||||
}, {});
|
}, {});
|
||||||
|
} else {
|
||||||
|
filterTitles = this.filteredColumns.reduce((a, c) => {
|
||||||
|
a[c.field] = c.title;
|
||||||
|
return a;
|
||||||
|
}, {});
|
||||||
|
}
|
||||||
|
|
||||||
return this.datasetMetadata.map((el) => ({
|
return this.datasetMetadata.map((el) => ({
|
||||||
...el,
|
...el,
|
||||||
...{ title: filterTitles[el.name] },
|
...{ title: filterTitles[el.name] },
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 48 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 79 KiB |
@@ -94,7 +94,6 @@ require_once('dbupdate_3.4/71399_dashboard_update_widget_paths.php');
|
|||||||
require_once('dbupdate_3.4/71645_studvw_messagetab_ladezeit.php');
|
require_once('dbupdate_3.4/71645_studvw_messagetab_ladezeit.php');
|
||||||
require_once('dbupdate_3.4/71566_studienordnungsdokument_neuer_organisationseinheitstyp_programm.php');
|
require_once('dbupdate_3.4/71566_studienordnungsdokument_neuer_organisationseinheitstyp_programm.php');
|
||||||
require_once('dbupdate_3.4/70376_lohnguide.php');
|
require_once('dbupdate_3.4/70376_lohnguide.php');
|
||||||
require_once('dbupdate_3.4/76203_Asynchrone_Tasks.php');
|
|
||||||
require_once('dbupdate_3.4/75888_reihungstest_mehrfachdurchfuehrung.php');
|
require_once('dbupdate_3.4/75888_reihungstest_mehrfachdurchfuehrung.php');
|
||||||
require_once('dbupdate_3.4/76150_perm_other_lv_plan.php');
|
require_once('dbupdate_3.4/76150_perm_other_lv_plan.php');
|
||||||
require_once('dbupdate_3.4/68957_dashboard_bookmark_neue_Spalte_sort.php');
|
require_once('dbupdate_3.4/68957_dashboard_bookmark_neue_Spalte_sort.php');
|
||||||
@@ -434,7 +433,7 @@ $tabellen=array(
|
|||||||
"system.tbl_log" => array("log_id","person_id","zeitpunkt","app","oe_kurzbz","logtype_kurzbz","logdata","insertvon","taetigkeit_kurzbz"),
|
"system.tbl_log" => array("log_id","person_id","zeitpunkt","app","oe_kurzbz","logtype_kurzbz","logdata","insertvon","taetigkeit_kurzbz"),
|
||||||
"system.tbl_logtype" => array("logtype_kurzbz", "data_schema"),
|
"system.tbl_logtype" => array("logtype_kurzbz", "data_schema"),
|
||||||
"system.tbl_filters" => array("filter_id","app","dataset_name","filter_kurzbz","person_id","description","sort","default_filter","filter","oe_kurzbz","statistik_kurzbz"),
|
"system.tbl_filters" => array("filter_id","app","dataset_name","filter_kurzbz","person_id","description","sort","default_filter","filter","oe_kurzbz","statistik_kurzbz"),
|
||||||
"system.tbl_jobsqueue" => array("jobid", "type", "creationtime", "status", "input", "output", "starttime", "endtime", "insertvon", "insertamum", "pid", "uid", "progress"),
|
"system.tbl_jobsqueue" => array("jobid", "type", "creationtime", "status", "input", "output", "starttime", "endtime", "insertvon", "insertamum"),
|
||||||
"system.tbl_jobstatuses" => array("status"),
|
"system.tbl_jobstatuses" => array("status"),
|
||||||
"system.tbl_jobtriggers" => array("type", "status", "following_type"),
|
"system.tbl_jobtriggers" => array("type", "status", "following_type"),
|
||||||
"system.tbl_jobtypes" => array("type", "description"),
|
"system.tbl_jobtypes" => array("type", "description"),
|
||||||
|
|||||||
@@ -1,59 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
// Add column pid to system.tbl_jobsqueue
|
|
||||||
if (!$result = @$db->db_query('SELECT "pid" FROM "system"."tbl_jobsqueue" LIMIT 1'))
|
|
||||||
{
|
|
||||||
$qry = 'ALTER TABLE "system"."tbl_jobsqueue" ADD "pid" INT NULL DEFAULT NULL;';
|
|
||||||
if (!$db->db_query($qry))
|
|
||||||
echo '<strong>system.tbl_jobsqueue: '.$db->db_last_error().'</strong><br>';
|
|
||||||
else
|
|
||||||
echo '<br>Added column pid to table system.tbl_jobsqueue';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add column uid to system.tbl_jobsqueue
|
|
||||||
if (!$result = @$db->db_query('SELECT "uid" FROM "system"."tbl_jobsqueue" LIMIT 1'))
|
|
||||||
{
|
|
||||||
$qry = 'ALTER TABLE "system"."tbl_jobsqueue" ADD "uid" VARCHAR(32) NULL DEFAULT NULL;';
|
|
||||||
if (!$db->db_query($qry))
|
|
||||||
echo '<strong>system.tbl_jobsqueue: '.$db->db_last_error().'</strong><br>';
|
|
||||||
else
|
|
||||||
echo '<br>Added column uid to table system.tbl_jobsqueue';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add column progress to system.tbl_jobsqueue
|
|
||||||
if (!$result = @$db->db_query('SELECT "progress" FROM "system"."tbl_jobsqueue" LIMIT 1'))
|
|
||||||
{
|
|
||||||
$qry = 'ALTER TABLE "system"."tbl_jobsqueue" ADD "progress" NUMERIC(2,1) NULL DEFAULT 0;';
|
|
||||||
if (!$db->db_query($qry))
|
|
||||||
echo '<strong>system.tbl_jobsqueue: '.$db->db_last_error().'</strong><br>';
|
|
||||||
else
|
|
||||||
echo '<br>Added column progress to table system.tbl_jobsqueue';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add foreign key fk_jobsqueue_benutzer_uid on system.tbl_jobsqueue.uid with public.tbl_benutzer.uid
|
|
||||||
if ($result = $db->db_query("SELECT conname FROM pg_constraint WHERE conname = 'fk_jobsqueue_benutzer_uid'"))
|
|
||||||
{
|
|
||||||
if ($db->db_num_rows($result) == 0)
|
|
||||||
{
|
|
||||||
$qry = 'ALTER TABLE "system"."tbl_jobsqueue" ADD CONSTRAINT "fk_jobsqueue_benutzer_uid" FOREIGN KEY ("uid") REFERENCES "public"."tbl_benutzer" ("uid") ON DELETE RESTRICT ON UPDATE CASCADE;';
|
|
||||||
if (!$db->db_query($qry))
|
|
||||||
echo '<strong>system.tbl_jobsqueue: '.$db->db_last_error().'</strong><br>';
|
|
||||||
else
|
|
||||||
echo '<br>Created foreign key fk_jobsqueue_benutzer_uid';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add new webservice type in system.tbl_webservicetyp
|
|
||||||
if ($result = @$db->db_query("SELECT 1 FROM system.tbl_webservicetyp WHERE webservicetyp_kurzbz = 'lrt';"))
|
|
||||||
{
|
|
||||||
if ($db->db_num_rows($result) == 0)
|
|
||||||
{
|
|
||||||
$qry = "INSERT INTO system.tbl_webservicetyp(webservicetyp_kurzbz, beschreibung) VALUES('lrt', 'Long Run Task');";
|
|
||||||
|
|
||||||
if (!$db->db_query($qry))
|
|
||||||
echo '<strong>system.tbl_webservicetyp '.$db->db_last_error().'</strong><br>';
|
|
||||||
else
|
|
||||||
echo ' system.tbl_webservicetyp: Added webservice type "lrt"<br>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1638,84 +1638,6 @@ $filters = array(
|
|||||||
}',
|
}',
|
||||||
'oe_kurzbz' => null,
|
'oe_kurzbz' => null,
|
||||||
),
|
),
|
||||||
array(
|
|
||||||
'app' => 'core',
|
|
||||||
'dataset_name' => 'logs',
|
|
||||||
'filter_kurzbz' => 'lrts24hours',
|
|
||||||
'description' => '{Last 24 hours LRTs logs}',
|
|
||||||
'sort' => 2,
|
|
||||||
'default_filter' => false,
|
|
||||||
'filter' => '
|
|
||||||
{
|
|
||||||
"name": "All Long Run Tasks logs from the last 24 hours",
|
|
||||||
"columns": [
|
|
||||||
{"name": "RequestId"},
|
|
||||||
{"name": "ExecutionTime"},
|
|
||||||
{"name": "ExecutedBy"},
|
|
||||||
{"name": "Description"},
|
|
||||||
{"name": "Data"}
|
|
||||||
],
|
|
||||||
"filters": [
|
|
||||||
{
|
|
||||||
"name": "WebserviceType",
|
|
||||||
"operation": "contains",
|
|
||||||
"condition": "job"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "RequestId",
|
|
||||||
"operation": "contains",
|
|
||||||
"condition": "LRT"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "ExecutionTime",
|
|
||||||
"operation": "lt",
|
|
||||||
"condition": "24",
|
|
||||||
"option": "hours"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
',
|
|
||||||
'oe_kurzbz' => null,
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'app' => 'core',
|
|
||||||
'dataset_name' => 'logs',
|
|
||||||
'filter_kurzbz' => 'lrts48hours',
|
|
||||||
'description' => '{Last 48 hours LRTs logs}',
|
|
||||||
'sort' => 2,
|
|
||||||
'default_filter' => false,
|
|
||||||
'filter' => '
|
|
||||||
{
|
|
||||||
"name": "All Long Run Tasks logs from the last 48 hours",
|
|
||||||
"columns": [
|
|
||||||
{"name": "RequestId"},
|
|
||||||
{"name": "ExecutionTime"},
|
|
||||||
{"name": "ExecutedBy"},
|
|
||||||
{"name": "Description"},
|
|
||||||
{"name": "Data"}
|
|
||||||
],
|
|
||||||
"filters": [
|
|
||||||
{
|
|
||||||
"name": "WebserviceType",
|
|
||||||
"operation": "contains",
|
|
||||||
"condition": "job"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "RequestId",
|
|
||||||
"operation": "contains",
|
|
||||||
"condition": "LRT"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "ExecutionTime",
|
|
||||||
"operation": "lt",
|
|
||||||
"condition": "48",
|
|
||||||
"option": "hours"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
',
|
|
||||||
'oe_kurzbz' => null,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// Loop through the filters array
|
// Loop through the filters array
|
||||||
|
|||||||
Reference in New Issue
Block a user