Private GIT

Skip to content
Snippets Groups Projects
Unverified Commit 8841cc18 authored by Miha Petkovsek's avatar Miha Petkovsek Committed by GitHub
Browse files

Merge pull request #1612 from thomseddon/fix/filter-custom-fields

fix custom field filtering for fields with spaces
parents 60953ee4 4f742a95
No related branches found
No related tags found
No related merge requests found
...@@ -12,6 +12,7 @@ require( dirname(__FILE__) . '/../../../functions/functions.php'); ...@@ -12,6 +12,7 @@ require( dirname(__FILE__) . '/../../../functions/functions.php');
$Database = new Database_PDO; $Database = new Database_PDO;
$User = new User ($Database); $User = new User ($Database);
$Admin = new Admin ($Database); $Admin = new Admin ($Database);
$Tools = new Tools ($Database);
$Result = new Result (); $Result = new Result ();
# verify that user is logged in # verify that user is logged in
...@@ -23,10 +24,14 @@ $User->check_maintaneance_mode (); ...@@ -23,10 +24,14 @@ $User->check_maintaneance_mode ();
$table = $_POST['table']; $table = $_POST['table'];
unset($_POST['table']); unset($_POST['table']);
# fetch custom fields
$fields = $Tools->fetch_custom_fields($table);
/* enthing to write? */ /* enthing to write? */
if(sizeof($_POST)>0) { if(sizeof($_POST)>0) {
foreach($_POST as $k=>$v) { foreach($_POST as $k=>$v) {
$filtered_fields[] = $k; $kTest = str_replace("___", " ", $k);
$filtered_fields[] = array_key_exists($kTest, $fields) ? $kTest : $k;
} }
} }
else { else {
......
...@@ -63,11 +63,12 @@ $(".input-switch").bootstrapSwitch(switch_options); ...@@ -63,11 +63,12 @@ $(".input-switch").bootstrapSwitch(switch_options);
<?php <?php
foreach($custom as $k=>$c) { foreach($custom as $k=>$c) {
$kNew = str_replace(" ", "___", $k);
print "<tr>"; print "<tr>";
# select # select
print " <td style='width:20px;'>"; print " <td style='width:20px;'>";
if(in_array($k, $filters[$_POST['table']])) { print "<input type='checkbox' class='input-switch' name='$k' checked>"; } if(in_array($k, $filters[$_POST['table']])) { print "<input type='checkbox' class='input-switch' name='$kNew' checked>"; }
else { print "<input type='checkbox' class='input-switch' name='$k'>"; } else { print "<input type='checkbox' class='input-switch' name='$kNew'>"; }
print " </td>"; print " </td>";
# remove custom_ # remove custom_
$k1 = $Tools->print_custom_field_name ($k); $k1 = $Tools->print_custom_field_name ($k);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment