Skip to content

Commit

Permalink
some bugfixes and complements without filters
Browse files Browse the repository at this point in the history
  • Loading branch information
codecivil committed Aug 23, 2024
1 parent 8404d9f commit 1518eb6
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 7 deletions.
11 changes: 11 additions & 0 deletions nightly/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
#v1.8.7
======
23.08.2024

* Fix in create_structure.php: Allow SELECT on recent fields defaultvalue and extras
* Fix in sidebar_functions.php: empty conditions now work for 'in ()' constructs
* Fix in changeConfig: 0 == '' resolved by checking with '==='
* Fix in table hierarchy update (costs one query more per 'anwenden')
* Complement returns symbols (with ids) in case no filter is selected for the complement
table

#v1.8.6
======
10.05.2024
Expand Down
6 changes: 6 additions & 0 deletions nightly/changelog_user
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#v1.8.7
======

* Komplemente zeigen Ergebnisse, auch wenn keine Filter ausgewählt sind
* einige Bugfixes

#v1.8.6
======

Expand Down
4 changes: 2 additions & 2 deletions nightly/core/data/info.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
$author = "codecivil Dr. Marco Kühnel ICT Services";
$license = "GPLv3";
$versiondate = "10.05.2024";
$versionnumber = "1.8.6";
$versiondate = "23.08.2024";
$versionnumber = "1.8.7";
$contact = "[email protected]";
?>
4 changes: 2 additions & 2 deletions nightly/core/functions/config_functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,11 @@ function changeConfig(array $newconf, mysqli $conn, string $configname = 'Defaul
if ( is_array($value) ) {
foreach ( $value as $key2=>$value2 )
{
if ( ! isset($value2) OR $value2 == '' ) { unset($conf[$key][$key2]); };
if ( ! isset($value2) OR $value2 === '' ) { unset($conf[$key][$key2]); };
if ( is_array($value2) ) {
foreach ( $value2 as $key3=>$value3 )
{
if ( ! isset($value3) OR $value3 == '' ) { unset($conf[$key][$key2][$key3]); };
if ( ! isset($value3) OR $value3 === '' ) { unset($conf[$key][$key2][$key3]); };
if ( is_array($value3) ) {
foreach ( $value3 as $key4=>$value4 )
{
Expand Down
2 changes: 1 addition & 1 deletion nightly/core/functions/frontend_functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
function html_echo($string = '') { if ( isset($string) ) { echo(htmlentities($string)); }; } //use ENT_QUOTES | ENT_IGNORE ?
function link_echo($string = '') {
echo(preg_replace('/Video:([^#]*)#/','</pre><a href="$1">Video</a><pre>',$string));
echo(preg_replace('/Video:([^#]*)#/','</pre><a href="$1" target="_blank">Video</a><pre>',$string));
}
?>
8 changes: 8 additions & 0 deletions nightly/core/functions/sidebar_functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ class="subtableOf<?php echo($_tablemachine); ?>"
}
}
}

//save computed hierarchy, otherwise the computed hierarchy and the one used in applyFilters differ (is read freshly from config)
///(...with unpredictable results...)
ksort($_config_hierarchy);
changeConfig(array("table_hierarchy" => array_values($_config_hierarchy)),$conn);
?>
<div id="config" class="section">
<form id="formChooseConfig" class="noform" method="post" action="" onsubmit="callFunction(this,'copyConfig').then(()=>callFunction('_','updateSidebarCustom','sidebar')).then(()=>{ toggleHelpTexts(); return false; }); return false;" >
Expand Down Expand Up @@ -936,6 +941,7 @@ function applyFilters(array $parameter, mysqli $conn, bool $_complement = false,
$_SESSION['filterlog'] = json_encode($filterlog);
//
$_WHERE .= $bracket;
$_WHERE = preg_replace('/IN \(\)/i',"NOT IN (-1)",$_WHERE);
$_WHERE = preg_replace('/\(\)/',"(0=0)",$_WHERE);
$_main_stmt_array = array();
$_main_stmt_array['stmt'] = 'SELECT '.$_SELECT.$_FROM.$_WHERE.$_ORDER_BY; //do not order by id!
Expand Down Expand Up @@ -972,6 +978,8 @@ function applyFilters(array $parameter, mysqli $conn, bool $_complement = false,
}
//remove trailing komma of $_SELECT if no paramater of complementtable was selected
if ( substr($_SELECT,-1) == ',' ) { $_SELECT = substr($_SELECT, 0, -1); }
//order by id if no filter was selected for complment table
if ( $_ORDER_BY == ' ORDER BY ' ) { $_ORDER_BY .= $complementtable.'__id_'.$complementtable; }
$_main_stmt_array['stmt'] = $_SELECT.$_FROM.$_WHERE.$_main_stmt_array['stmt'].$bracket.$_ORDER_BY;
}
if ( isset($display) AND !$display ) { return $_main_stmt_array; }
Expand Down
2 changes: 1 addition & 1 deletion nightly/core/html/create_structure.php
Original file line number Diff line number Diff line change
Expand Up @@ -970,7 +970,7 @@ function _adminActionAfter(array $PARAMETER, mysqli $conn) {
$_stmt_array['stmt'] = "ALTER TABLE `".$_table."_permissions` ADD COLUMN `restrictrole_".$_result_id."` VARCHAR(40) DEFAULT NULL;";
_execute_stmt($_stmt_array,$conn);
unset($_stmt_array); $_stmt_array = array();
$_stmt_array['stmt'] = "GRANT SELECT (keymachine,keyreadable,subtablemachine,typelist,edittype,realid,referencetag,role_".$_result_id.",restrictrole_".$_result_id.") ON ".$_table."_permissions TO ".$_ROLES_ARRAY[$_result_id].";";
$_stmt_array['stmt'] = "GRANT SELECT (keymachine,keyreadable,subtablemachine,defaultvalue,extras,typelist,edittype,realid,referencetag,role_".$_result_id.",restrictrole_".$_result_id.") ON ".$_table."_permissions TO ".$_ROLES_ARRAY[$_result_id].";";
_execute_stmt($_stmt_array,$conn);
unset($_stmt_array); $_stmt_array = array();
$_stmt_array['stmt'] = "GRANT SELECT (role_".$_result_parentid.",restrictrole_".$_result_parentid.") ON ".$_table."_permissions TO ".$_ROLES_ARRAY[$_result_id].";";
Expand Down
2 changes: 1 addition & 1 deletion nightly/public/js/os.js
Original file line number Diff line number Diff line change
Expand Up @@ -1439,7 +1439,7 @@ function showEmptyFields(_form,_arg,resp) {
if ( ! _filled ) {
editwrapper.style.background = "var(--background-warning)";
console.log(editwrapper.querySelectorAll('label'));
_notFilledFields.push({_id: _inputid, _label: editwrapper.querySelector('label.onlyone,label.files').innerText});
_notFilledFields.push({_id: _inputid, _label: editwrapper.querySelector('label.onlyone,label.files')?editwrapper.querySelector('label.onlyone,label.files').innerText:''});
}
});
//create the message
Expand Down

0 comments on commit 1518eb6

Please sign in to comment.