diff --git a/application/controllers/system/infocenter/InfoCenter.php b/application/controllers/system/infocenter/InfoCenter.php index cbb9e9b8c..23b4972c2 100644 --- a/application/controllers/system/infocenter/InfoCenter.php +++ b/application/controllers/system/infocenter/InfoCenter.php @@ -559,11 +559,6 @@ class InfoCenter extends VileSci_Controller { $toPrint = "%s=%s"; - if ($this->router->method != 'index') - { - - } - $tofill['children'][] = array( 'link' => sprintf($toPrint, base_url('index.ci.php/system/infocenter/InfoCenter?filter_id'), $filterId), 'description' => $description, diff --git a/application/models/accounting/Kostenstelle_model.php b/application/models/accounting/Kostenstelle_model.php index 489286306..fd064125c 100644 --- a/application/models/accounting/Kostenstelle_model.php +++ b/application/models/accounting/Kostenstelle_model.php @@ -11,4 +11,52 @@ class Kostenstelle_model extends DB_Model $this->dbTable = 'wawi.tbl_kostenstelle'; $this->pk = 'kostenstelle_id'; } + + /** + * Gets all active Kostenstellen for a geschaeftsjahr, as determined by the geschaeftsjahrvon and bis fields + * @param $geschaeftsjahr + * @return array|null + */ + public function getActiveKostenstellenForGeschaeftsjahr($geschaeftsjahr = null) + { + $this->load->model('organisation/geschaeftsjahr_model', 'GeschaeftsjahrModel'); + + if ($geschaeftsjahr === null) + { + $lgj = $this->GeschaeftsjahrModel->getLastGeschaeftsjahr(); + + if ($lgj->error) + return error($lgj->retval); + + if (count($lgj->retval) < 1) + return success(array()); + + $geschaeftsjahr = $lgj->retval[0]->geschaeftsjahr_kurzbz; + } + + $this->GeschaeftsjahrModel->addSelect('start, ende'); + $gj = $this->GeschaeftsjahrModel->load($geschaeftsjahr); + + if ($gj->error) + return error($gj->retval); + + if (count($gj->retval) < 1) + return success(array()); + + $gjstart = $gj->retval[0]->start; + + $query = 'SELECT kostenstelle_id, kostenstelle_nr, kurzbz, wawi.tbl_kostenstelle.bezeichnung, kgjvon.start, kgjbis.ende + FROM wawi.tbl_kostenstelle + LEFT JOIN public.tbl_geschaeftsjahr kgjvon on wawi.tbl_kostenstelle.geschaeftsjahrvon = kgjvon.geschaeftsjahr_kurzbz + LEFT JOIN public.tbl_geschaeftsjahr kgjbis on wawi.tbl_kostenstelle.geschaeftsjahrbis = kgjbis.geschaeftsjahr_kurzbz + WHERE + (wawi.tbl_kostenstelle.geschaeftsjahrbis IS NULL AND wawi.tbl_kostenstelle.geschaeftsjahrvon IS NULL) + OR + (DATE ? >= kgjvon.start AND (DATE ? < kgjbis.ende OR wawi.tbl_kostenstelle.geschaeftsjahrbis IS NULL)) + OR + (DATE ? < kgjbis.ende AND (DATE ? >= kgjvon.start OR wawi.tbl_kostenstelle.geschaeftsjahrvon IS NULL)) + ORDER BY wawi.tbl_kostenstelle.bezeichnung'; + + return $this->execQuery($query, array($gjstart, $gjstart, $gjstart, $gjstart)); + } } diff --git a/application/models/organisation/Geschaeftsjahr_model.php b/application/models/organisation/Geschaeftsjahr_model.php index e3c0e9fb2..d475b8142 100644 --- a/application/models/organisation/Geschaeftsjahr_model.php +++ b/application/models/organisation/Geschaeftsjahr_model.php @@ -11,4 +11,20 @@ class Geschaeftsjahr_model extends DB_Model $this->dbTable = 'public.tbl_geschaeftsjahr'; $this->pk = 'geschaeftsjahr_kurzbz'; } + + /** + * Gets latest Geschaeftsjahr, as determined by its start date + * @return array|null + */ + public function getLastGeschaeftsjahr() + { + $query = 'SELECT * + FROM public.tbl_geschaeftsjahr + WHERE start = ( + SELECT max(start) + FROM public.tbl_geschaeftsjahr + )'; + + return $this->execQuery($query); + } } diff --git a/application/views/templates/FHC-Header.php b/application/views/templates/FHC-Header.php index b309f4a22..cbf20b0ec 100755 --- a/application/views/templates/FHC-Header.php +++ b/application/views/templates/FHC-Header.php @@ -2,6 +2,10 @@ if (! defined('BASEPATH')) exit('No direct script access allowed'); +// Retrives the URL path of the called controller + controller method +// NOTE: placed here because it doesn't work inside functions +$calledFrom = $this->router->directory.$this->router->class.'/'.$this->router->method; + // By default set the parameters to null $title = isset($title) ? $title : null; $customCSSs = isset($customCSSs) ? $customCSSs : null; @@ -55,6 +59,26 @@ function _generateCSSsInclude($CSSs) } } +/** + * Generates global JS-Object to pass parms to other javascripts + */ +function _generateJSDataStorageObject($calledFrom) +{ + $toPrint = "\n"; + $toPrint .= ''; + $toPrint .= "\n\n"; + + echo $toPrint; +} + /** * Generates tags for the javascripts you want to include, the parameter could by a string or an array of strings */ @@ -78,13 +102,25 @@ function _generateJSsInclude($JSs) } /** - * Generates global JS-Object to pass parms to addon-js-functions + * Generates all the includes needed by the Addons */ -function _generateAddonDataStorageObject() +function _generateAddonsJSsInclude($calledFrom) { - echo '\n"; + $aktive_addons = array_filter(explode(";", ACTIVE_ADDONS)); + + foreach ($aktive_addons as $addon) + { + $hookfile = DOC_ROOT.'addons/'.$addon.'/hooks.config.inc.php'; + if (file_exists($hookfile)) + { + include($hookfile); + if (key_exists($calledFrom, $js_hooks)) + { + foreach ($js_hooks[$calledFrom] as $js_file) + _generateJSsInclude('addons/'.$addon.'/'.$js_file); + } + } + } } ?> @@ -102,16 +138,20 @@ function _generateAddonDataStorageObject() // jQuery UI CSS if ($jqueryui === true) _generateCSSsInclude('vendor/components/jqueryui/themes/base/jquery-ui.min.css'); + // bootstrap CSS if ($bootstrap === true) _generateCSSsInclude('vendor/twbs/bootstrap/dist/css/bootstrap.min.css'); + // font awesome CSS if ($fontawesome === true) _generateCSSsInclude('vendor/components/font-awesome/css/font-awesome.min.css'); + // Table sorter CSS if ($tablesorter === true) { _generateCSSsInclude('vendor/mottie/tablesorter/dist/css/theme.default.min.css'); _generateCSSsInclude('vendor/mottie/tablesorter/dist/css/jquery.tablesorter.pager.min.css'); } + // sb admin template CSS if ($sbadmintemplate === true) { @@ -125,8 +165,13 @@ function _generateAddonDataStorageObject() // -------------------------------------------------------------------------------------------------------- // Javascripts + // Generates the global object to pass useful parms to the other javascripts + // NOTE: must be called before any other JS include + _generateJSDataStorageObject($calledFrom); + // JQuery V3 if ($jquery === true) _generateJSsInclude('vendor/components/jquery/jquery.min.js'); + // JQuery UI if ($jqueryui === true) { @@ -134,8 +179,10 @@ function _generateAddonDataStorageObject() //datepicker german language file _generateJSsInclude('vendor/components/jqueryui/ui/i18n/datepicker-de.js'); } + // bootstrap JS if ($bootstrap === true) _generateJSsInclude('vendor/twbs/bootstrap/dist/js/bootstrap.min.js'); + // Table sorter JS if ($tablesorter === true) { @@ -143,6 +190,7 @@ function _generateAddonDataStorageObject() _generateJSsInclude('vendor/mottie/tablesorter/dist/js/jquery.tablesorter.widgets.min.js'); _generateJSsInclude('vendor/mottie/tablesorter/dist/js/extras/jquery.tablesorter.pager.min.js'); } + //tinymce JS if($tinymce === true) _generateJSsInclude('vendor/tinymce/tinymce/tinymce.min.js') ; @@ -153,27 +201,8 @@ function _generateAddonDataStorageObject() _generateJSsInclude('vendor/BlackrockDigital/startbootstrap-sb-admin-2/dist/js/sb-admin-2.min.js'); } - // load addon hooks JS - if ($addons === true) - { - _generateAddonDataStorageObject(); - - $aktive_addons = array_filter(explode(";", ACTIVE_ADDONS)); - $called_from = $this->router->directory.$this->router->class.'/'.$this->router->method; - foreach ($aktive_addons as $addon) - { - $hookfile = DOC_ROOT.'addons/'.$addon.'/hooks.config.inc.php'; - if (file_exists($hookfile)) - { - include($hookfile); - if (key_exists($called_from, $js_hooks)) - { - foreach ($js_hooks[$called_from] as $js_file) - _generateJSsInclude('addons/'.$addon.'/'.$js_file); - } - } - } - } + // Load addon hooks JS + if ($addons === true) _generateAddonsJSsInclude($calledFrom); // Eventually required JS _generateJSsInclude($customJSs); diff --git a/application/views/widgets/filter/filter.php b/application/views/widgets/filter/filter.php index d895b0687..669fb914d 100644 --- a/application/views/widgets/filter/filter.php +++ b/application/views/widgets/filter/filter.php @@ -83,10 +83,6 @@ width: 535px; } - #addFilter { - margin-right: 12px; - } - #selectedFilters { margin-bottom: 20px; } @@ -95,6 +91,10 @@ font-weight: bold; } + #applyFilter, #saveCustomFilterButton { + width: 100px; + } + .remove-selected-filter { padding-bottom: 3px; } diff --git a/application/views/widgets/filter/selectFilters.php b/application/views/widgets/filter/selectFilters.php index 71232b20a..9f775a826 100644 --- a/application/views/widgets/filter/selectFilters.php +++ b/application/views/widgets/filter/selectFilters.php @@ -286,6 +286,6 @@ - +