diff --git a/application/controllers/jobs/LehrauftragJob.php b/application/controllers/jobs/LehrauftragJob.php index 2f6b928c7..4ba327a2f 100644 --- a/application/controllers/jobs/LehrauftragJob.php +++ b/application/controllers/jobs/LehrauftragJob.php @@ -20,31 +20,31 @@ class LehrauftragJob extends JOB_Controller { const BERECHTIGUNG_LEHRAUFTRAG_ERTEILEN = 'lehre/lehrauftrag_erteilen'; const BERECHTIGUNG_LEHRAUFTRAG_AKZEPTIEREN = 'lehre/lehrauftrag_akzeptieren'; - + const LEHRAUFTRAG_ERTEILEN_URI = 'lehre/lehrauftrag/LehrauftragErteilen'; const LEHRAUFTRAG_AKZEPTIEREN_URI = '/lehre/lehrauftrag/LehrauftragAkzeptieren'; - + /** * Constructor */ public function __construct() { parent::__construct(); - + // Load models $this->load->model('accounting/Vertrag_model', 'VertragModel'); $this->load->model('accounting/Vertragvertragsstatus_model', 'VertragvertragsstatusModel'); $this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel'); $this->load->model('person/Benutzerfunktion_model', 'BenutzerfunktionModel'); $this->load->model('system/Benutzerrolle_model', 'BenutzerrolleModel'); - + // Load libraries $this->load->library('PermissionLib'); - + // Load helpers $this->load->helper('hlp_sancho_helper'); } - + /** * This daily job sends information about all lehr-/projektauftraege ordered (and not approved) the day bofore. * Receivers: Department-/Kompetenzfeldleiter @@ -62,7 +62,7 @@ class LehrauftragJob extends JOB_Controller foreach ($vertrag_arr as $vertrag) { $result = $this->VertragModel->getLehreinheitData($vertrag->vertrag_id, 'lehrveranstaltung_id, studiensemester_kurzbz'); - + if (hasData($result)) { $obj = new StdClass(); @@ -72,7 +72,7 @@ class LehrauftragJob extends JOB_Controller } } } - + /** * Build the data array to be used in the email. Data array is clustered as follows: * Array @@ -90,7 +90,7 @@ class LehrauftragJob extends JOB_Controller foreach ($lehreinheit_data_arr as $lehreinheit_data) { $result = $this->_getLVData($lehreinheit_data->lehrveranstaltung_id); - + if (hasData($result)) { // Search if studiensemester exists in data_arr @@ -102,12 +102,12 @@ class LehrauftragJob extends JOB_Controller $data = array( 'studiensemester_kurzbz' => $lehreinheit_data->studiensemester_kurzbz ); - + $data []= array( 'oe_kurzbz' => $result->retval[0]->oe_kurzbz, 'oe_bezeichnung' => $result->retval[0]->lv_oe_bezeichnung ); - + // Add stg data to oe, start amount with 1 $data[0][] = array( 'stg_kz' => $result->retval[0]->studiengang_kz, @@ -115,7 +115,7 @@ class LehrauftragJob extends JOB_Controller 'stg_bezeichnung' => $result->retval[0]->lv_stg_bezeichnung, 'amount' => 1 ); - + // Push to final data_arr $data_arr []= $data; } @@ -124,7 +124,7 @@ class LehrauftragJob extends JOB_Controller { // Search if oe exists inside existing studiensemester of data_arr $oe_index = array_search($result->retval[0]->oe_kurzbz, array_column($data_arr[$ss_index], 'oe_kurzbz')); - + // If oe is new, add oe and stg to studiensemester if ($oe_index === false) { @@ -132,7 +132,7 @@ class LehrauftragJob extends JOB_Controller $data_arr[$ss_index][] = array( 'oe_kurzbz' => $result->retval[0]->oe_kurzbz, 'oe_bezeichnung' => $result->retval[0]->lv_oe_bezeichnung, - + // Add stg data to oe, start amount with 1 array( 'stg_kz' => $result->retval[0]->studiengang_kz, @@ -147,7 +147,7 @@ class LehrauftragJob extends JOB_Controller { // Search if stg exists inside existing oe of data_arr $stg_index = array_search($result->retval[0]->studiengang_kz, array_column($data_arr[$ss_index][$oe_index], 'stg_kz')); - + // If stg is new, add stg to oe, start amount with 1 if ($stg_index === false) { @@ -168,7 +168,7 @@ class LehrauftragJob extends JOB_Controller } } } - + /** * Cluster data by uid of entitled mail receivers. * Returning array is clustered as follows: @@ -186,7 +186,7 @@ class LehrauftragJob extends JOB_Controller * [amount] // amount of new ordered lehrauftraege of that stg */ $data_arr = $this->_clusterData_byReceiver($data_arr); - + // Send email if(!$this->_sendMail_toApprove($data_arr)) { @@ -197,7 +197,7 @@ class LehrauftragJob extends JOB_Controller $this->logError('Error when sending emails in job MailLehrauftragToApprove'); } } - + /** * This daily job sends information about all lehr-/projektauftraege approved the day bofore. * Receivers: lectors @@ -208,7 +208,7 @@ class LehrauftragJob extends JOB_Controller $this->VertragvertragsstatusModel->addSelect('vertrag_id, uid'); $this->VertragvertragsstatusModel->addOrder('uid'); $result = $this->VertragvertragsstatusModel->getApproved_fromDate('YESTERDAY'); - + /** * Build the data array to be used in the email. Data array is clustered as follows: * Array @@ -228,10 +228,10 @@ class LehrauftragJob extends JOB_Controller { $studiensemester = $studiensemester[0]->vertragsstunden_studiensemester_kurzbz; } - + // Search if uid exists in data_arr $uid_index = array_search($vertrag->uid, array_column($data_arr, 'uid')); - + // If uid is new, add uid, studiensemester and start amount with 1 if ($uid_index === false) { @@ -249,7 +249,7 @@ class LehrauftragJob extends JOB_Controller { $data_arr[$uid_index]['studiensemester'] .= ' und '. $studiensemester; } - + // Increase amount +1 $data_arr[$uid_index]['amount']++; } @@ -266,11 +266,11 @@ class LehrauftragJob extends JOB_Controller $this->logError('Error when sending emails in job MailLehrauftragToAccept'); } } - + //****************************************************************************************************************** // PRIVATE FUNCTIONS //****************************************************************************************************************** - + /** * Get data of given lehrveranstaltung. * @param $lehrveranstaltung_id @@ -286,7 +286,7 @@ class LehrauftragJob extends JOB_Controller stg.typ AS "stg_typ", stg.kurzbz AS "stg_kurzbz" '); - + $this->LehrveranstaltungModel->addJoin('lehre.tbl_studienplan_lehrveranstaltung stpllv', 'lehrveranstaltung_id'); $this->LehrveranstaltungModel->addJoin('lehre.tbl_studienplan stpl', 'studienplan_id'); $this->LehrveranstaltungModel->addJoin('lehre.tbl_studienordnung sto', 'studienordnung_id'); @@ -294,10 +294,10 @@ class LehrauftragJob extends JOB_Controller $this->LehrveranstaltungModel->addJoin('public.tbl_organisationseinheit oe', 'ON oe.oe_kurzbz = tbl_lehrveranstaltung.oe_kurzbz'); $this->LehrveranstaltungModel->addOrder('stpllv.insertamum', 'DESC'); $this->LehrveranstaltungModel->addLimit(1); - + return $this->LehrveranstaltungModel->load($lehrveranstaltung_id); } - + /** * Send Sancho eMail about ordered Lehrauftraege. * @param $data_arr @@ -310,12 +310,12 @@ class LehrauftragJob extends JOB_Controller // Set mail recipients (department assistance/leader) $to = $data['uid']. '@'. DOMAIN; $html_table = $this->_renderData_LehrauftraegeToApprove($data); - + // Prepare mail content $content_data_arr = array( 'table' => $html_table ); - + sendSanchoMail( 'LehrauftragNeueBestellungen', $content_data_arr, @@ -326,7 +326,7 @@ class LehrauftragJob extends JOB_Controller ); } } - + /** * Cluster the data array by entitled mail receiver. * Returning array is clustered as follows: @@ -409,7 +409,7 @@ class LehrauftragJob extends JOB_Controller return $mail_data_arr; } - + /** * Render the data array for the mail template returing a HTML table. * @param $data_arr Data to be used in HTML table @@ -425,11 +425,11 @@ class LehrauftragJob extends JOB_Controller if (isset($studiensemester_container['studiensemester_kurzbz'])) { $studiensemester = $studiensemester_container['studiensemester_kurzbz']; - + // Link to LehrauftragErteilen $url = site_url(self::LEHRAUFTRAG_ERTEILEN_URI).'?studiensemester='. $studiensemester; } - + // HTML table header $html .= '
@@ -446,7 +446,7 @@ class LehrauftragJob extends JOB_Controller ' ; - + // HTML table body foreach ($studiensemester_container as $oe_container) { @@ -456,7 +456,7 @@ class LehrauftragJob extends JOB_Controller { $oe_bezeichnung = $oe_container['oe_bezeichnung']; } - + foreach ($oe_container as $stg_data) { if (is_array($stg_data)) // is_array 'trims' the outer associative keys [oe_kurzbz] and [oe_bezeichnung] @@ -473,7 +473,7 @@ class LehrauftragJob extends JOB_Controller } } } - + // HTML table body end and link $html .= ' @@ -484,10 +484,10 @@ class LehrauftragJob extends JOB_Controller '; } } - + return $html; } - + /** * Send Sancho eMail about ordered Lehrauftraege. * @param $data_arr @@ -499,24 +499,24 @@ class LehrauftragJob extends JOB_Controller { // Set mail recipient (lector) $to = $data['uid']. '@'. DOMAIN; - + // Link to LehrauftragAkzeptieren $url = CIS_ROOT. 'cis/index.php?menu='. CIS_ROOT. 'cis/menu.php?content_id=&content='. CIS_ROOT. index_page(). self::LEHRAUFTRAG_AKZEPTIEREN_URI; - + // Get first name $first_name = ''; $this->load->model('person/Benutzer_model', 'BenutzerModel'); $this->BenutzerModel->addSelect('vorname'); $this->BenutzerModel->addJoin('public.tbl_person', 'person_id'); $result = $this->BenutzerModel->loadWhere(array('uid' => $data['uid'])); - + if (hasData($result)) { $first_name = $result->retval[0]->vorname; } - + // Prepare mail content $content_data_arr = array( 'vorname' => $first_name, @@ -524,7 +524,7 @@ class LehrauftragJob extends JOB_Controller 'anzahl' => $data['amount'], 'link' => anchor($url, 'Lehraufträge Übersicht') ); - + sendSanchoMail( 'LehrauftragNeueErteilte', $content_data_arr, @@ -532,5 +532,6 @@ class LehrauftragJob extends JOB_Controller 'Neu erteilte Lehraufträge zum Annehmen bereit' ); } + return true; } } diff --git a/application/core/CLI_Controller.php b/application/core/CLI_Controller.php index 79e2a1283..7e1e2a1ab 100644 --- a/application/core/CLI_Controller.php +++ b/application/core/CLI_Controller.php @@ -3,7 +3,8 @@ if (!defined('BASEPATH')) exit('No direct script access allowed'); /** - * + * This is the super class for all those controllers that can only be called from command line + * It provides also an helper to display the possible calls */ abstract class CLI_Controller extends FHC_Controller { @@ -15,9 +16,9 @@ abstract class CLI_Controller extends FHC_Controller /** * Constructor */ - public function __construct() + public function __construct() { - parent::__construct(); + parent::__construct(); // Checks if the controller is called from command line $this->_isAllowed(); @@ -103,3 +104,4 @@ abstract class CLI_Controller extends FHC_Controller } } } + diff --git a/application/core/JOB_Controller.php b/application/core/JOB_Controller.php index ea779b169..2d3d3873e 100644 --- a/application/core/JOB_Controller.php +++ b/application/core/JOB_Controller.php @@ -3,26 +3,34 @@ if (!defined('BASEPATH')) exit('No direct script access allowed'); /** - * + * This is the super class for a job. + * All the controllers that extends this class can only be called from command line. + * Provides utility methods to log into database */ abstract class JOB_Controller extends CLI_Controller { /** * Constructor */ - public function __construct() + public function __construct() { - parent::__construct(); + parent::__construct(); // Loads LogLib with different debug trace levels to get data of the job that extends this class // It also specify parameters to set database fields - $this->load->library('LogLib', array( - 'classIndex' => 5, - 'functionIndex' => 5, - 'lineIndex' => 4, - 'dbLogType' => 'job', // required - 'dbExecuteUser' => 'Cronjob system' - )); + $this->load->library('LogLib', + array( + 'classIndex' => 5, + 'functionIndex' => 5, + 'lineIndex' => 4, + 'dbLogType' => 'job', // required + 'dbExecuteUser' => 'Cronjob system', + 'requestId' => 'JOB', + 'requestDataFormatter' => function($data) { + return json_encode($data); + } + ) + ); } //------------------------------------------------------------------------------------------------------------------ @@ -33,7 +41,7 @@ abstract class JOB_Controller extends CLI_Controller */ protected function logInfo($response, $parameters = null) { - $this->_log(LogLib::INFO, 'Cronjob info', $response, $parameters); + $this->_log(LogLib::INFO, $response, $parameters); } /** @@ -41,7 +49,7 @@ abstract class JOB_Controller extends CLI_Controller */ protected function logDebug($response, $parameters = null) { - $this->_log(LogLib::DEBUG, 'Cronjob debug', $response, $parameters); + $this->_log(LogLib::DEBUG, $response, $parameters); } /** @@ -49,7 +57,7 @@ abstract class JOB_Controller extends CLI_Controller */ protected function logWarning($response, $parameters = null) { - $this->_log(LogLib::WARNING, 'Cronjob warning', $response, $parameters); + $this->_log(LogLib::WARNING, $response, $parameters); } /** @@ -57,7 +65,7 @@ abstract class JOB_Controller extends CLI_Controller */ protected function logError($response, $parameters = null) { - $this->_log(LogLib::ERROR, 'Cronjob error', $response, $parameters); + $this->_log(LogLib::ERROR, $response, $parameters); } //------------------------------------------------------------------------------------------------------------------ @@ -66,7 +74,7 @@ abstract class JOB_Controller extends CLI_Controller /** * Writes a log to database */ - private function _log($level, $requestId, $response, $parameters) + private function _log($level, $response, $parameters) { $data = new stdClass(); @@ -76,17 +84,18 @@ abstract class JOB_Controller extends CLI_Controller switch($level) { case LogLib::INFO: - $this->loglib->logInfoDB($requestId, json_encode(success($data, LogLib::INFO))); + $this->loglib->logInfoDB($data); break; case LogLib::DEBUG: - $this->loglib->logDebugDB($requestId, json_encode(success($data, LogLib::DEBUG))); + $this->loglib->logDebugDB($data); break; case LogLib::WARNING: - $this->loglib->logWarningDB($requestId, json_encode(error($data, LogLib::WARNING))); + $this->loglib->logWarningDB($data); break; case LogLib::ERROR: - $this->loglib->logErrorDB($requestId, json_encode(error($data, LogLib::ERROR))); + $this->loglib->logErrorDB($data); break; } } } + diff --git a/application/core/JQW_Controller.php b/application/core/JQW_Controller.php index ab63e7ffd..cec2f7943 100644 --- a/application/core/JQW_Controller.php +++ b/application/core/JQW_Controller.php @@ -5,9 +5,10 @@ if (!defined("BASEPATH")) exit("No direct script access allowed"); /** * Job Queue Worker * - * This controller acts as interface of the JobsQueueLib that contains all the needed functionalities to operate with - * the Jobs Queue System - * This is an abstract class that provide basic functionalities, it has to be extended to broaden its logic + * This controller acts as interface of the JobsQueueLib that contains + * all the needed functionalities to operate with the Jobs Queue System + * This is an abstract class that provide basic functionalities, + * it has to be extended to broaden its logic */ abstract class JQW_Controller extends JOB_Controller { @@ -18,14 +19,13 @@ abstract class JQW_Controller extends JOB_Controller { parent::__construct(); - // Loads LogLib with different parameters - $this->load->library('LogLib', array( - 'classIndex' => 5, - 'functionIndex' => 5, - 'lineIndex' => 4, - 'dbLogType' => 'job', // required - 'dbExecuteUser' => 'Jobs queue system' - )); + // Changes the needed configs for LogLib + $this->loglib->setConfigs( + array( + 'dbExecuteUser' => 'Jobs queue system', + 'requestId' => 'JQW' + ) + ); // Loads JobsQueueLib library $this->load->library('JobsQueueLib'); diff --git a/application/libraries/FilterWidgetLib.php b/application/libraries/FilterWidgetLib.php index f909c7083..0a4526680 100644 --- a/application/libraries/FilterWidgetLib.php +++ b/application/libraries/FilterWidgetLib.php @@ -93,6 +93,7 @@ class FilterWidgetLib const OP_NOT_SET = 'nset'; // Filter options values + const OPT_MINUTES = 'minutes'; const OPT_HOURS = 'hours'; const OPT_DAYS = 'days'; const OPT_MONTHS = 'months'; @@ -887,7 +888,8 @@ class FilterWidgetLib && isset($filterDefinition->option) && ($filterDefinition->option == self::OPT_HOURS || $filterDefinition->option == self::OPT_DAYS - || $filterDefinition->option == self::OPT_MONTHS)) + || $filterDefinition->option == self::OPT_MONTHS + || $filterDefinition->option == self::OPT_MINUTES)) { $condition = '< (NOW() - \''.$filterDefinition->condition.' '.$filterDefinition->option.'\'::interval)'; } @@ -903,7 +905,8 @@ class FilterWidgetLib && isset($filterDefinition->option) && ($filterDefinition->option == self::OPT_HOURS || $filterDefinition->option == self::OPT_DAYS - || $filterDefinition->option == self::OPT_MONTHS)) + || $filterDefinition->option == self::OPT_MONTHS + || $filterDefinition->option == self::OPT_MINUTES)) { $condition = '> (NOW() - \''.$filterDefinition->condition.' '.$filterDefinition->option.'\'::interval)'; } diff --git a/application/libraries/LogLib.php b/application/libraries/LogLib.php index b98575150..ffdec5f03 100644 --- a/application/libraries/LogLib.php +++ b/application/libraries/LogLib.php @@ -42,6 +42,8 @@ class LogLib const P_NAME_LINE_INDEX = 'lineIndex'; const P_NAME_DB_LOG_TYPE = 'dbLogType'; const P_NAME_DB_EXECUTE_USER = 'dbExecuteUser'; + const P_NAME_REQUEST_ID = 'requestId'; + const P_NAME_REQUEST_DATA_FORMATTER = 'requestDataFormatter'; // Properties used to retrieve caller data private $_classIndex; @@ -52,6 +54,9 @@ class LogLib private $_dbLogType; private $_dbExecuteUser; + private $_requestId; // is it possible to specify a request id when loading this library + private $_requestDataFormatter; // is possible to provide a function to format request data + /** * Set properties to a default value or overwrites them with the given parameters */ @@ -63,7 +68,18 @@ class LogLib $this->_lineIndex = self::LINE_INDEX; $this->_dbLogType = null; $this->_dbExecuteUser = self::DB_EXECUTE_USER; + $this->_requestId = null; + $this->_requestDataFormatter = null; + // If parameters are given then overwrite the default values + if (!isEmptyArray($params)) $this->setConfigs($params); + } + + /** + * Store configuration parameters for this lib + */ + public function setConfigs($params) + { // If parameters are given then overwrite the default values if (!isEmptyArray($params)) { @@ -72,6 +88,8 @@ class LogLib if (isset($params[self::P_NAME_LINE_INDEX])) $this->_lineIndex = $params[self::P_NAME_LINE_INDEX]; if (isset($params[self::P_NAME_DB_LOG_TYPE])) $this->_dbLogType = $params[self::P_NAME_DB_LOG_TYPE]; if (isset($params[self::P_NAME_DB_EXECUTE_USER])) $this->_dbExecuteUser = $params[self::P_NAME_DB_EXECUTE_USER]; + if (isset($params[self::P_NAME_REQUEST_ID])) $this->_requestId = $params[self::P_NAME_REQUEST_ID]; + if (isset($params[self::P_NAME_REQUEST_DATA_FORMATTER])) $this->_requestDataFormatter = $params[self::P_NAME_REQUEST_DATA_FORMATTER]; } } @@ -108,33 +126,33 @@ class LogLib /** * Writes an info log to database */ - public function logInfoDB($requestId, $data) + public function logInfoDB($data, $requestId = null) { - $this->_logDB(self::INFO, $requestId, $data); + $this->_logDB(self::INFO, $data, $requestId); } /** * Writes a debug log to database */ - public function logDebugDB($requestId, $data) + public function logDebugDB($data, $requestId = null) { - $this->_logDB(self::DEBUG, $requestId, $data); + $this->_logDB(self::DEBUG, $data, $requestId); } /** * Writes an warning log to database */ - public function logWarningDB($requestId, $data) + public function logWarningDB($data, $requestId = null) { - $this->_logDB(self::WARNING, $requestId, $data); + $this->_logDB(self::WARNING, $data, $requestId); } /** * Writes an error log to database */ - public function logErrorDB($requestId, $data) + public function logErrorDB($data, $requestId = null) { - $this->_logDB(self::ERROR, $requestId, $data); + $this->_logDB(self::ERROR, $data, $requestId); } // -------------------------------------------------------------------------------------------------------------- @@ -151,8 +169,15 @@ class LogLib /** * Writes logs to database */ - private function _logDB($level, $requestId, $data) + private function _logDB($level, $data, $requestId, $executionTime = null) { + // If there isn't a valid request id provided during the loading of this library or when any log to db method is called + // NOTE: this message will be displayed only to the developer AND stops the execution + if (isEmptyString($this->_requestId) && isEmptyString($requestId)) + { + show_error('To log to database you need to specify or give the "'.self::P_NAME_REQUEST_ID.'" parameter when the LogLib is loaded or when log'.ucfirst($level).'DB is called'); + } + // If the _dbLogType parameter was not given when this library was loaded // NOTE: this message will be displayed only to the developer AND stops the execution if ($this->_dbLogType == null) @@ -175,14 +200,21 @@ class LogLib // Get caller data $callerData = $this->_getCaller(); + // If a request data formatter was defined then use it + $request_data = $data; + if ($this->_requestDataFormatter != null && is_callable($this->_requestDataFormatter)) + { + $request_data = call_user_func_array($this->_requestDataFormatter, array($data)); + } + // Writes a log to database $ci->WebservicelogModel->insert(array( 'webservicetyp_kurzbz' => $this->_dbLogType, - 'request_id' => $requestId, + 'request_id' => (!isEmptyString($requestId) ? $requestId : $this->_requestId).' - '.$level, 'beschreibung' => $this->_getDatabaseDescription($callerData), - 'request_data' => $data, + 'request_data' => $request_data, 'execute_user' => $this->_dbExecuteUser, - 'execute_time' => 'NOW()' // current time + 'execute_time' => $executionTime == null ? 'NOW()' : $executionTime // default current time, if not otherwise specified )); } } @@ -251,3 +283,4 @@ class LogLib return $formatted; } } + diff --git a/application/models/ressource/Mitarbeiter_model.php b/application/models/ressource/Mitarbeiter_model.php index abf71e1b9..90c30927f 100644 --- a/application/models/ressource/Mitarbeiter_model.php +++ b/application/models/ressource/Mitarbeiter_model.php @@ -50,7 +50,7 @@ class Mitarbeiter_model extends DB_Model * @param $personaccount wenn true werden alle geladen die personalnr >= 0 haben, also "echte" Personaccounts * @return array */ - public function getPersonal($aktiv, $fix, $verwendung, $personaccount = null) + public function getPersonal($aktiv, $fix, $verwendung, $personaccount = null, $uids = null) { $qry = "SELECT DISTINCT ON(mitarbeiter_uid) staatsbuergerschaft, geburtsnation, sprache, anrede, titelpost, titelpre, nachname, vorname, vornamen, gebdatum, gebort, gebzeit, tbl_person.anmerkung AS person_anmerkung, homepage, svnr, ersatzkennzeichen, familienstand, @@ -88,7 +88,14 @@ class Mitarbeiter_model extends DB_Model elseif ($personaccount === false) $qry .= " AND tbl_mitarbeiter.personalnummer < 0"; - return $this->execQuery($qry); + $params = array(); + if (!isEmptyArray($uids)) + { + $qry .= " AND tbl_mitarbeiter.mitarbeiter_uid IN ?"; + $params[] = $uids; + } + + return $this->execQuery($qry, $params); } /** diff --git a/application/views/system/logs/logsViewerData.php b/application/views/system/logs/logsViewerData.php index 13a4207ab..f8476df6a 100644 --- a/application/views/system/logs/logsViewerData.php +++ b/application/views/system/logs/logsViewerData.php @@ -25,7 +25,7 @@ ), 'formatRow' => function($datasetRaw) { - $datasetRaw->ExecutionTime = date_format(date_create($datasetRaw->ExecutionTime), 'd.m.Y H:i:s'); + $datasetRaw->ExecutionTime = date_format(date_create($datasetRaw->ExecutionTime), 'd.m.Y H:i:s:u'); return $datasetRaw; }, @@ -33,22 +33,22 @@ $mark = ''; - if ($datasetRaw->RequestId == 'Cronjob error') + if (strpos($datasetRaw->RequestId, 'error') != false) { $mark = 'text-red'; } - if ($datasetRaw->RequestId == 'Cronjob info') + if (strpos($datasetRaw->RequestId, 'info') != false) { $mark = 'text-green'; } - if ($datasetRaw->RequestId == 'Cronjob warning') + if (strpos($datasetRaw->RequestId, 'warning') != false) { $mark = 'text-orange'; } - if ($datasetRaw->RequestId == 'Cronjob debug') + if (strpos($datasetRaw->RequestId, 'debug') != false) { $mark = 'text-info'; } @@ -63,3 +63,4 @@ echo $this->widgetlib->widget('FilterWidget', $filterWidgetArray); ?> + diff --git a/content/student/studentDBDML.php b/content/student/studentDBDML.php index 097bc5134..886e938a8 100644 --- a/content/student/studentDBDML.php +++ b/content/student/studentDBDML.php @@ -2555,7 +2555,7 @@ if(!$error) $_POST['nummer']=$bm->transform_kartennummer($_POST['nummer']); //Das speichern von Zutrittskarten ohne Nummern verhindern - if($_POST['betriebsmitteltyp']=='Zutrittskarte' && $_POST['nummer']=='') + if($_POST['betriebsmitteltyp']=='Zutrittskarte' && ($_POST['nummer']=='' && $_POST['nummer2']=='')) { $error = true; $return = false; @@ -2563,14 +2563,23 @@ if(!$error) } else { + if ($_POST['betriebsmitteltyp']=='Zutrittskarte' && $_POST['nummer'] == '') + { + $resultBM = $bm->getBetriebsmittel($_POST['betriebsmitteltyp'],null, $_POST['nummer2']); + } + else + { + $resultBM = $bm->getBetriebsmittel($_POST['betriebsmitteltyp'],$_POST['nummer']); + } + //Nachschauen ob dieses Betriebsmittel schon existiert - if($bm->getBetriebsmittel($_POST['betriebsmitteltyp'],$_POST['nummer'])) + if($resultBM) { if(count($bm->result)>0) { //Wenn die Nummer gleich bleibt dann die alte ID verwenden da es //unterschiedliche Schluessel gibt die die gleiche nummer haben ?!? - if($_POST['nummer']==$_POST['nummerold']) + if($_POST['nummer'] != '' && $_POST['nummer'] == $_POST['nummerold']) { $betriebsmittel_id = $_POST['betriebsmittel_id']; } diff --git a/include/betriebsmittel.class.php b/include/betriebsmittel.class.php index efd275827..d3e208076 100644 --- a/include/betriebsmittel.class.php +++ b/include/betriebsmittel.class.php @@ -407,7 +407,7 @@ class betriebsmittel extends basis_db * @param $nummer * @return boolean */ - public function getBetriebsmittel($betriebsmitteltyp, $nummer) + public function getBetriebsmittel($betriebsmitteltyp, $nummer, $nummer2 = null) { // Initialisieren $this->result=array(); @@ -415,7 +415,16 @@ class betriebsmittel extends basis_db $qry= 'SELECT * '; $qry.= ' FROM wawi.tbl_betriebsmittel '; - $qry.= " WHERE betriebsmitteltyp=".$this->db_add_param($betriebsmitteltyp)." AND nummer=".$this->db_add_param($nummer); + $qry.= " WHERE betriebsmitteltyp=".$this->db_add_param($betriebsmitteltyp); + if (is_null($nummer2)) + { + $qry.= " AND nummer=".$this->db_add_param($nummer); + } + else + { + $qry.= " AND nummer2=".$this->db_add_param($nummer2); + } + $qry.= ' ORDER BY updateamum DESC'; if($this->db_query($qry)) @@ -1222,7 +1231,7 @@ class betriebsmittel extends basis_db { $this->result=''; $this->errormsg = ''; - + $qry ="SELECT * FROM wawi.tbl_betriebsmittelperson WHERE uid =".$this->db_add_param($uid, FHC_STRING)." AND betriebsmittel_id IN( SELECT betriebsmittel_id @@ -1252,7 +1261,7 @@ class betriebsmittel extends basis_db { $this->errormsg = 'Fehler beim Laden der Daten'; return false; - } + } } /** diff --git a/include/betriebsmittelperson.class.php b/include/betriebsmittelperson.class.php index 90be34eb7..c105cc6da 100644 --- a/include/betriebsmittelperson.class.php +++ b/include/betriebsmittelperson.class.php @@ -595,7 +595,7 @@ class betriebsmittelperson extends basis_db FROM wawi.tbl_betriebsmittel JOIN wawi.tbl_betriebsmittelperson USING(betriebsmittel_id) - WHERE tbl_betriebsmittel.nummer='.$this->db_add_param($nummer).' + WHERE tbl_betriebsmittel.nummer2='.$this->db_add_param($nummer).' AND tbl_betriebsmittel.betriebsmitteltyp=\'Zutrittskarte\' AND tbl_betriebsmittelperson.person_id='.$this->db_add_param($person_id); diff --git a/public/js/FilterWidget.js b/public/js/FilterWidget.js index a85969865..f63c41013 100644 --- a/public/js/FilterWidget.js +++ b/public/js/FilterWidget.js @@ -824,6 +824,8 @@ var FHC_FilterWidget = { html += ""; html += ""; html += " "; diff --git a/system/dbupdate_3.3.php b/system/dbupdate_3.3.php index 33499621d..b102d6c8c 100644 --- a/system/dbupdate_3.3.php +++ b/system/dbupdate_3.3.php @@ -4401,6 +4401,20 @@ if(!$result = @$db->db_query("SELECT iso3166_1_a3 FROM bis.tbl_nation LIMIT 1")) echo '
bis.tbl_nation: Spalte iso3166_1_a3 hinzugefuegt'; } +// OE_KURZBZ in system.tbl_filters auf 32 Zeichen verlängert +if($result = $db->db_query("SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA='wawi' AND TABLE_NAME='tbl_betriebsmitteltyp' AND COLUMN_NAME = 'typ_code' AND character_maximum_length=2")) +{ + if($db->db_num_rows($result)>0) + { + $qry = " ALTER TABLE wawi.tbl_betriebsmitteltyp ALTER COLUMN typ_code TYPE varchar(6)"; + + if(!$db->db_query($qry)) + echo 'wawi.tbl_betriebsmitteltyp '.$db->db_last_error().'
'; + else + echo '
Spalte typ_code in wawi.tbl_betriebsmitteltyp von character(2) auf varchar(6) geändert
'; + } +} + // *** Pruefung und hinzufuegen der neuen Attribute und Tabellen echo '

Pruefe Tabellen und Attribute!

'; diff --git a/system/filtersupdate.php b/system/filtersupdate.php index d6bb88976..9fbaf936f 100644 --- a/system/filtersupdate.php +++ b/system/filtersupdate.php @@ -438,13 +438,13 @@ $filters = array( array( 'app' => 'core', 'dataset_name' => 'logs', - 'filter_kurzbz' => 'last7days', - 'description' => '{Last 7 days logs}', + 'filter_kurzbz' => 'last1min', + 'description' => '{Last minute logs}', 'sort' => 1, 'default_filter' => true, 'filter' => ' { - "name": "All logs from the last 7 days", + "name": "All logs from the last minute", "columns": [ {"name": "RequestId"}, {"name": "ExecutionTime"}, @@ -456,8 +456,8 @@ $filters = array( { "name": "ExecutionTime", "operation": "lt", - "condition": "7", - "option": "days" + "condition": "1", + "option": "minutes" } ] } @@ -467,13 +467,13 @@ $filters = array( array( 'app' => 'core', 'dataset_name' => 'logs', - 'filter_kurzbz' => 'jobs14days', - 'description' => '{Last 14 days jobs logs}', + 'filter_kurzbz' => 'jobs24hours', + 'description' => '{Last 24 hours jobs logs}', 'sort' => 2, 'default_filter' => false, 'filter' => ' { - "name": "All jobs logs from the last 14 days", + "name": "All jobs logs from the last 24 hours", "columns": [ {"name": "RequestId"}, {"name": "ExecutionTime"}, @@ -487,11 +487,133 @@ $filters = array( "operation": "contains", "condition": "job" }, + { + "name": "RequestId", + "operation": "contains", + "condition": "JOB" + }, { "name": "ExecutionTime", "operation": "lt", - "condition": "14", - "option": "days" + "condition": "24", + "option": "hours" + } + ] + } + ', + 'oe_kurzbz' => null, + ), + array( + 'app' => 'core', + 'dataset_name' => 'logs', + 'filter_kurzbz' => 'jobs48hours', + 'description' => '{Last 48 hours jobs logs}', + 'sort' => 2, + 'default_filter' => false, + 'filter' => ' + { + "name": "All jobs 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": "JOB" + }, + { + "name": "ExecutionTime", + "operation": "lt", + "condition": "48", + "option": "hours" + } + ] + } + ', + 'oe_kurzbz' => null, + ), + array( + 'app' => 'core', + 'dataset_name' => 'logs', + 'filter_kurzbz' => 'jqws24hours', + 'description' => '{Last 24 hours JQWs logs}', + 'sort' => 2, + 'default_filter' => false, + 'filter' => ' + { + "name": "All Job Queue Workers 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": "JQW" + }, + { + "name": "ExecutionTime", + "operation": "lt", + "condition": "24", + "option": "hours" + } + ] + } + ', + 'oe_kurzbz' => null, + ), + array( + 'app' => 'core', + 'dataset_name' => 'logs', + 'filter_kurzbz' => 'jqws48hours', + 'description' => '{Last 48 hours JQWs logs}', + 'sort' => 2, + 'default_filter' => false, + 'filter' => ' + { + "name": "All Job Queue Workers 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": "JQW" + }, + { + "name": "ExecutionTime", + "operation": "lt", + "condition": "48", + "option": "hours" } ] } @@ -535,13 +657,13 @@ $filters = array( array( 'app' => 'core', 'dataset_name' => 'logs', - 'filter_kurzbz' => 'content3days', - 'description' => '{Last 3 days content logs}', + 'filter_kurzbz' => 'content3minutes', + 'description' => '{Last 3 minutes content logs}', 'sort' => 4, 'default_filter' => false, 'filter' => ' { - "name": "All content logs from the last 3 days", + "name": "All content logs from the last 3 minutes", "columns": [ {"name": "RequestId"}, {"name": "ExecutionTime"}, @@ -559,7 +681,7 @@ $filters = array( "name": "ExecutionTime", "operation": "lt", "condition": "3", - "option": "days" + "option": "minutes" } ] } @@ -569,13 +691,13 @@ $filters = array( array( 'app' => 'core', 'dataset_name' => 'logs', - 'filter_kurzbz' => 'wienerlinien7days', - 'description' => '{Last 7 days wiener linien logs}', + 'filter_kurzbz' => 'wienerlinien24hours', + 'description' => '{Last 24 hours Wiener Linien logs}', 'sort' => 5, 'default_filter' => false, 'filter' => ' { - "name": "All wiener linien logs from the last 7 days", + "name": "All Wiener Linien logs from the last 24 hours", "columns": [ {"name": "RequestId"}, {"name": "ExecutionTime"}, @@ -592,8 +714,8 @@ $filters = array( { "name": "ExecutionTime", "operation": "lt", - "condition": "7", - "option": "days" + "condition": "24", + "option": "hours" } ] } diff --git a/vilesci/fhausweis/kartenausgabe.php b/vilesci/fhausweis/kartenausgabe.php index 58ce7ec6d..aae80f2b0 100644 --- a/vilesci/fhausweis/kartenausgabe.php +++ b/vilesci/fhausweis/kartenausgabe.php @@ -139,7 +139,7 @@ if ($action == 'kartenausgabe') } echo ' -Ziehen Sie die neue Karte über den Hitag Kartenleser um die Karte zu aktivieren: +Ziehen Sie die neue Karte über den Mifare Kartenleser um die Karte zu aktivieren: