A
alpha2zee
Guest
I have got 'multiple select menu' and 'multiple checkboxes' working in DaDaBik 3.2 beta.
Following are the dozen or so steps to enable these options. I will soon post a good text file with these instructions, in case they appear with errors on this forum, on the Sourceforge tracker - http://sourceforge.net/tracker/?group_id=39649&atid=425835. If you find bugs, please report them (and any fixes) here or on the tracker.
---------------------
0. Use phpmyadmin or any other MySQL editing program to make sure (editing if needed) that the 'type_field' field of each of the 'dadabik_' table in your database has 'select_multiple_menu' and 'select_multiple_checkbox' in it. It should look like this:
ENUM ('text','textarea','rich_editor','password','insert_date','update_date','date','select_single','select_multiple_menu','select_multiple_checkbox','generic_file','image_file','ID_user','unique_ID')
1. Edit include/internal_table.php to ensure it has select_multiple_menu and select_multiple_checkbox. Find this line:
$int_fields_ar[2][3] = "text/textarea/rich_editor/password/insert_date/update_date/date/select_single/generic_file/image_file/ID_user/unique_ID";
Edit to insert after /select_single:
/select_multiple_menu/select_multiple_checkbox
2. Edit include/config.php and uncomment (remove the '//' in front):
//$size_multiple_select = 3;
3. Edit include/business_logic.php
A. Go to function create_internal_table($table_internal_name) and look for:
ENUM('text','textarea','rich_editor','password','insert_date','update_date','date','select_single','generic_file','image_file','ID_user','unique_ID')
After 'select_single,' insert:
'select_multiple_menu','select_multiple_checkbox'
B. Go to function check_required_fields($_POST, $_FILES, $fields_labels_ar)
Look for 'break;' under 'case "select_single":'
After, add:
case "select_multiple_menu":
case "select_multiple_checkbox":
$stringed = implode ("",$_POST[$field_name_temp]);
if (strlen($stringed)<1){$check = 0;}
break;
break;
C. Go to function get_field_correct_displaying and look for:
case "select_multiple_menu":
case "select_multiple_checkbox":
(If they are not there, you can add them after the first or second 'break' in the function)
Below, replace everything till and including the first 'break' statement with:
$field_value = htmlspecialchars($field_value);
// in case field was select_single type before
$separator_first_check = stripos($field_value, $field_separator);
$separator_last_check = strripos($field_value, $field_separator);
if ($separator_first_check == "0" and $separator_last_check == (strlen($field_value)-1))
{$field_value = substr($field_value, 1, -1);} // delete the first and the last separator
$select_values_ar = explode($field_separator,$field_value);
$count_temp = count($select_values_ar);
for ($i=0; $i<$count_temp; $i++){
if ( $display_mode == "results_table") {
$field_to_display .= nl2br(wordwrap($select_values_ar[$i], $word_wrap_col))."<br />";
}
else{
$field_to_display .= nl2br($select_values_ar[$i])."<br />";
}
} // end for
break;
case "select_single": // in case field was select_multiple type before
$field_value = htmlspecialchars($field_value);
$separator_first_check = stripos($field_value, $field_separator);
$separator_last_check = strripos($field_value, $field_separator);
if ($separator_first_check == "0" and $separator_last_check == (strlen($field_value)-1))
{$field_value = substr($field_value, 1, -1);} // delete the first and the last separator
$field_to_display = $field_value;
break;
D. Go to function get_field_correct_csv_displaying and look for:
case "select_multiple_menu":
case "select_multiple_checkbox":
$field_value = substr($field_value, 1, -1);
Replace the third line with:
// in case field was select_single type before
$separator_first_check = stripos($field_value, $field_separator);
$separator_last_check = strripos($field_value, $field_separator);
if ($separator_first_check == "0" and $separator_last_check == (strlen($field_value)-1))
{$field_value = substr($field_value, 1, -1);}
And, after the first following 'break,' add:
case "select_single": // in case field was select_multiple type before
$separator_first_check = stripos($field_value, $field_separator);
$separator_last_check = strripos($field_value, $field_separator);
if ($separator_first_check == "0" and $separator_last_check == (strlen($field_value)-1))
{$field_value = substr($field_value, 1, -1);}
$field_to_display = $field_value;
break;
E. Go to function insert_record and look for:
case "select_multiple_menu":
case "select_multiple_checkbox":
Below, look for:
for ($j=0; $j<$count_temp_2; $j++){
$sql .= $fields_labels_ar[$i]["separator_field"].$_POST[$field_name_temp][$j];// add the field value to the sql statement
} // end for
Replace with:
for ($j=0; $j<$count_temp_2; $j++){
if ($_POST[$field_name_temp][$j] != ""){
$sql .= $fields_labels_ar[$i]["separator_field"].$_POST[$field_name_temp][$j];// add the field value to the sql statement
} // end if
} // end for
F. Go to function build_details_table and look for the while loop:
***************************
while ($details_row = fetch_row_db($res_details)){ // should be just one
$count_temp = count($fields_labels_ar);
for ($i=0; $i<$count_temp; $i++){
if ($fields_labels_ar[$i]["present_details_form_field"] == "1"){
$field_name_temp = $fields_labels_ar[$i]["name_field"];
$field_values_ar = array(); // reset the array containing values to display, otherwise for each loop if I don't call build_linked_field_values_ar I have the previous values
$primary_key_field_field = $fields_labels_ar[$i]["primary_key_field_field"];
if ($primary_key_field_field != ""){
$primary_key_field_field = $fields_labels_ar[$i]["primary_key_field_field"];
$primary_key_table_field = $fields_labels_ar[$i]["primary_key_table_field"];
$primary_key_db_field = $fields_labels_ar[$i]["primary_key_db_field"];
$linked_fields_field = $fields_labels_ar[$i]["linked_fields_field"];
$linked_fields_ar = explode($fields_labels_ar[$i]["separator_field"], $linked_fields_field);
$alias_suffix_field = $fields_labels_ar[$i]["alias_suffix_field"];
for ($j=0;$j<count($linked_fields_ar);$j++) {
$field_values_ar[$j] = $details_row[$linked_fields_ar[$j].$alias_prefix.$alias_suffix_field];
} // end for
}
else{
$field_values_ar[0] = $details_row[$field_name_temp];
}
$count_temp_2 = count($field_values_ar);
$details_table .= "<tr><td class=\"td_label_details\"><b>".$fields_labels_ar[$i]["label_field"]."</b></td><td class=\"td_value_details\">";
for ($j=0; $j<$count_temp_2; $j++) {
$field_to_display = get_field_correct_displaying($field_values_ar[$j], $fields_labels_ar[$i]["type_field"], $fields_labels_ar[$i]["content_field"], $fields_labels_ar[$i]["separator_field"], "details_table"); // get the correct display mode for the field
$details_table .= $field_to_display." "; // at the field value to the table
}
$details_table = substr($details_table, 0, -6); // delete the last
$details_table .= "</td></tr>";
} // end if
} // end for
} // end while
***************************
And replace it with:
***************************
while ($details_row = fetch_row_db($res_details)){ // should be just one
$count_temp = count($fields_labels_ar);
for ($i=0; $i<$count_temp; $i++){
if ($fields_labels_ar[$i]["present_details_form_field"] == "1"){
$field_name_temp = $fields_labels_ar[$i]["name_field"];
$field_value = $details_row[$field_name_temp];
$details_table .= "<tr><td class=\"td_label_details\"><b>".$fields_labels_ar[$i]["label_field"]."</b></td><td class=\"td_value_details\">";
$field_to_display = get_field_correct_displaying($field_value, $fields_labels_ar[$i]["type_field"], $fields_labels_ar[$i]["content_field"], $fields_labels_ar[$i]["separator_field"], "details_table"); // get the correct display mode for the field
$details_table .= $field_to_display." ";
$details_table = substr($details_table, 0, -6); // delete the last
$details_table .= "</td></tr>";
} // end if
} // end for
} // end while
***************************
G. Go to function build_results_table and look for:
***************************
$results_table .= "<td class=\"".$td_results_class."\">"; // start the cell
$field_name_temp = $fields_labels_ar[$i]["name_field"];
$field_type = $fields_labels_ar[$i]["type_field"];
$field_content = $fields_labels_ar[$i]["content_field"];
$field_separator = $fields_labels_ar[$i]["separator_field"];
$field_values_ar = array(); // reset the array containing values to display,
$primary_key_field_field = $fields_labels_ar[$i]["primary_key_field_field"];
if ($primary_key_field_field != "")
{$primary_key_field_field = $fields_labels_ar[$i]["primary_key_field_field"];
$primary_key_table_field = $fields_labels_ar[$i]["primary_key_table_field"];
$primary_key_db_field = $fields_labels_ar[$i]["primary_key_db_field"];
$linked_fields_field = $fields_labels_ar[$i]["linked_fields_field"];
$alias_suffix_field = $fields_labels_ar[$i]["alias_suffix_field"];
$linked_fields_ar = explode($fields_labels_ar[$i]["separator_field"], $linked_fields_field);
for ($j=0;$j<count($linked_fields_ar);$j++)
{
$field_values_ar[$j] = $records_row[$linked_fields_ar[$j].$alias_prefix.$alias_suffix_field];
} // end for
}
else
{
$field_values_ar[0] = $records_row[$field_name_temp];
}
$count_temp_2 = count($field_values_ar);
for ($j=0; $j<$count_temp_2; $j++)
{
$field_to_display = get_field_correct_displaying($field_values_ar[$j], $field_type, $field_content, $field_separator, "results_table");
if ( $field_to_display == "")
{$field_to_display .= " ";}
$results_table .= $field_to_display." ";
}
$results_table = substr($results_table, 0, -6); // delete the last
$results_table .= "</td>"; // end the cell
***************************
Replace it with:
***************************
$results_table .= "<td class=\"".$td_results_class."\">"; // start the cell
$field_name_temp = $fields_labels_ar[$i]["name_field"];
$field_type = $fields_labels_ar[$i]["type_field"];
$field_content = $fields_labels_ar[$i]["content_field"];
$field_separator = $fields_labels_ar[$i]["separator_field"];
$field_value = $records_row[$field_name_temp];
$field_to_display = get_field_correct_displaying($field_value, $field_type, $field_content, $field_separator, "results_table");
if ( $field_to_display == "")
{$field_to_display .= " ";}
$results_table .= $field_to_display." ";
$results_table = substr($results_table, 0, -6); // delete the last
$results_table .= "</td>"; // end the cell
***************************
H. Go to function build_select_part and look for this 'foreach' loop:
***************************
foreach($fields_labels_ar as $field){
if ($field['present_results_search_field'] === '1' || $field['present_details_form_field'] === '1' || $field['name_field'] === $unique_field_name) { // include in the select stataments just the fields present in results or the primary key (useful to pass to the edit form)
// if the field has linked fields, include each linked fields in the select statement and the corresponding table (wiht join) in the from part. Use alias for all in order to mantain name unicity, each field has is own alias_suffix_field so it is easy
if ($field['primary_key_field_field'] !== '') {
$linked_fields_ar = explode($field['separator_field'], $field['linked_fields_field']);
foreach ($linked_fields_ar as $linked_field){
$sql_fields_part .= $quote.$field['primary_key_table_field'].$alias_prefix.$field['alias_suffix_field'].$quote.'.'.$quote.$linked_field.$quote.' AS '.$quote.$linked_field.$alias_prefix.$field['alias_suffix_field'].$quote.', ';
} //end foreach
$sql_from_part .= ' LEFT JOIN '.$quote.$field['primary_key_table_field'].$quote.' AS '.$quote.$field['primary_key_table_field'].$alias_prefix.$field['alias_suffix_field'].$quote;
$sql_from_part .= ' ON ';
$sql_from_part .= $quote.$table_name.$quote.'.'.$quote.$field['name_field'].$quote.' = '.$quote.$field['primary_key_table_field'].$alias_prefix.$field['alias_suffix_field'].$quote.'.'.$quote.$field['primary_key_field_field'].$quote;
} // end if
// if the field has not linked fiel, include just the field in the select statement
else {
$sql_fields_part .= $quote.$table_name.$quote.'.'.$quote.$field['name_field'].$quote.', ';
} // end else
} // end if
} // end foreach
***************************
Replace it with:
***************************
foreach($fields_labels_ar as $field){
if ($field['present_results_search_field'] === '1' || $field['present_details_form_field'] === '1' || $field['name_field'] === $unique_field_name) { // include in the select stataments just the fields present in results or the primary key (useful to pass to the edit form)
$sql_fields_part .= $quote.$table_name.$quote.'.'.$quote.$field['name_field'].$quote.', ';
} // end if
} // end foreach
***************************
5. Edit index.php by looking for this:
***************************
if ($fields_labels_ar[$field_index]["primary_key_field_field"] !== ''){
$linked_fields_ar = explode($fields_labels_ar[$field_index]['separator_field'], $fields_labels_ar[$field_index]['linked_fields_field']);
$is_first = 1;
foreach ($linked_fields_ar as $linked_field){
$sql .= $quote.$linked_field.$alias_prefix.$fields_labels_ar[$field_index]['alias_suffix_field'].$quote;
if ($is_first === 1){ // add the order type just to the first field e.g. order by field_1 DESC, field_2, field_3
$sql .= ' '.$order_type;
$is_first = 0;
} // end if
$sql .= ', ';
} //end foreach
$sql = substr($sql, 0, -2); // deleter the last ', '
} // end if
else{
$sql .= $quote.$table_name.$quote.'.'.$fields_labels_ar[$field_index]["name_field"];
$sql .= ' '.$order_type;
} // end else
**************************
And replace with:
**************************
$sql .= $quote.$table_name.$quote.'.'.$fields_labels_ar[$field_index]["name_field"];
$sql .= ' '.$order_type;
**************************
Following are the dozen or so steps to enable these options. I will soon post a good text file with these instructions, in case they appear with errors on this forum, on the Sourceforge tracker - http://sourceforge.net/tracker/?group_id=39649&atid=425835. If you find bugs, please report them (and any fixes) here or on the tracker.
---------------------
0. Use phpmyadmin or any other MySQL editing program to make sure (editing if needed) that the 'type_field' field of each of the 'dadabik_' table in your database has 'select_multiple_menu' and 'select_multiple_checkbox' in it. It should look like this:
ENUM ('text','textarea','rich_editor','password','insert_date','update_date','date','select_single','select_multiple_menu','select_multiple_checkbox','generic_file','image_file','ID_user','unique_ID')
1. Edit include/internal_table.php to ensure it has select_multiple_menu and select_multiple_checkbox. Find this line:
$int_fields_ar[2][3] = "text/textarea/rich_editor/password/insert_date/update_date/date/select_single/generic_file/image_file/ID_user/unique_ID";
Edit to insert after /select_single:
/select_multiple_menu/select_multiple_checkbox
2. Edit include/config.php and uncomment (remove the '//' in front):
//$size_multiple_select = 3;
3. Edit include/business_logic.php
A. Go to function create_internal_table($table_internal_name) and look for:
ENUM('text','textarea','rich_editor','password','insert_date','update_date','date','select_single','generic_file','image_file','ID_user','unique_ID')
After 'select_single,' insert:
'select_multiple_menu','select_multiple_checkbox'
B. Go to function check_required_fields($_POST, $_FILES, $fields_labels_ar)
Look for 'break;' under 'case "select_single":'
After, add:
case "select_multiple_menu":
case "select_multiple_checkbox":
$stringed = implode ("",$_POST[$field_name_temp]);
if (strlen($stringed)<1){$check = 0;}
break;
break;
C. Go to function get_field_correct_displaying and look for:
case "select_multiple_menu":
case "select_multiple_checkbox":
(If they are not there, you can add them after the first or second 'break' in the function)
Below, replace everything till and including the first 'break' statement with:
$field_value = htmlspecialchars($field_value);
// in case field was select_single type before
$separator_first_check = stripos($field_value, $field_separator);
$separator_last_check = strripos($field_value, $field_separator);
if ($separator_first_check == "0" and $separator_last_check == (strlen($field_value)-1))
{$field_value = substr($field_value, 1, -1);} // delete the first and the last separator
$select_values_ar = explode($field_separator,$field_value);
$count_temp = count($select_values_ar);
for ($i=0; $i<$count_temp; $i++){
if ( $display_mode == "results_table") {
$field_to_display .= nl2br(wordwrap($select_values_ar[$i], $word_wrap_col))."<br />";
}
else{
$field_to_display .= nl2br($select_values_ar[$i])."<br />";
}
} // end for
break;
case "select_single": // in case field was select_multiple type before
$field_value = htmlspecialchars($field_value);
$separator_first_check = stripos($field_value, $field_separator);
$separator_last_check = strripos($field_value, $field_separator);
if ($separator_first_check == "0" and $separator_last_check == (strlen($field_value)-1))
{$field_value = substr($field_value, 1, -1);} // delete the first and the last separator
$field_to_display = $field_value;
break;
D. Go to function get_field_correct_csv_displaying and look for:
case "select_multiple_menu":
case "select_multiple_checkbox":
$field_value = substr($field_value, 1, -1);
Replace the third line with:
// in case field was select_single type before
$separator_first_check = stripos($field_value, $field_separator);
$separator_last_check = strripos($field_value, $field_separator);
if ($separator_first_check == "0" and $separator_last_check == (strlen($field_value)-1))
{$field_value = substr($field_value, 1, -1);}
And, after the first following 'break,' add:
case "select_single": // in case field was select_multiple type before
$separator_first_check = stripos($field_value, $field_separator);
$separator_last_check = strripos($field_value, $field_separator);
if ($separator_first_check == "0" and $separator_last_check == (strlen($field_value)-1))
{$field_value = substr($field_value, 1, -1);}
$field_to_display = $field_value;
break;
E. Go to function insert_record and look for:
case "select_multiple_menu":
case "select_multiple_checkbox":
Below, look for:
for ($j=0; $j<$count_temp_2; $j++){
$sql .= $fields_labels_ar[$i]["separator_field"].$_POST[$field_name_temp][$j];// add the field value to the sql statement
} // end for
Replace with:
for ($j=0; $j<$count_temp_2; $j++){
if ($_POST[$field_name_temp][$j] != ""){
$sql .= $fields_labels_ar[$i]["separator_field"].$_POST[$field_name_temp][$j];// add the field value to the sql statement
} // end if
} // end for
F. Go to function build_details_table and look for the while loop:
***************************
while ($details_row = fetch_row_db($res_details)){ // should be just one
$count_temp = count($fields_labels_ar);
for ($i=0; $i<$count_temp; $i++){
if ($fields_labels_ar[$i]["present_details_form_field"] == "1"){
$field_name_temp = $fields_labels_ar[$i]["name_field"];
$field_values_ar = array(); // reset the array containing values to display, otherwise for each loop if I don't call build_linked_field_values_ar I have the previous values
$primary_key_field_field = $fields_labels_ar[$i]["primary_key_field_field"];
if ($primary_key_field_field != ""){
$primary_key_field_field = $fields_labels_ar[$i]["primary_key_field_field"];
$primary_key_table_field = $fields_labels_ar[$i]["primary_key_table_field"];
$primary_key_db_field = $fields_labels_ar[$i]["primary_key_db_field"];
$linked_fields_field = $fields_labels_ar[$i]["linked_fields_field"];
$linked_fields_ar = explode($fields_labels_ar[$i]["separator_field"], $linked_fields_field);
$alias_suffix_field = $fields_labels_ar[$i]["alias_suffix_field"];
for ($j=0;$j<count($linked_fields_ar);$j++) {
$field_values_ar[$j] = $details_row[$linked_fields_ar[$j].$alias_prefix.$alias_suffix_field];
} // end for
}
else{
$field_values_ar[0] = $details_row[$field_name_temp];
}
$count_temp_2 = count($field_values_ar);
$details_table .= "<tr><td class=\"td_label_details\"><b>".$fields_labels_ar[$i]["label_field"]."</b></td><td class=\"td_value_details\">";
for ($j=0; $j<$count_temp_2; $j++) {
$field_to_display = get_field_correct_displaying($field_values_ar[$j], $fields_labels_ar[$i]["type_field"], $fields_labels_ar[$i]["content_field"], $fields_labels_ar[$i]["separator_field"], "details_table"); // get the correct display mode for the field
$details_table .= $field_to_display." "; // at the field value to the table
}
$details_table = substr($details_table, 0, -6); // delete the last
$details_table .= "</td></tr>";
} // end if
} // end for
} // end while
***************************
And replace it with:
***************************
while ($details_row = fetch_row_db($res_details)){ // should be just one
$count_temp = count($fields_labels_ar);
for ($i=0; $i<$count_temp; $i++){
if ($fields_labels_ar[$i]["present_details_form_field"] == "1"){
$field_name_temp = $fields_labels_ar[$i]["name_field"];
$field_value = $details_row[$field_name_temp];
$details_table .= "<tr><td class=\"td_label_details\"><b>".$fields_labels_ar[$i]["label_field"]."</b></td><td class=\"td_value_details\">";
$field_to_display = get_field_correct_displaying($field_value, $fields_labels_ar[$i]["type_field"], $fields_labels_ar[$i]["content_field"], $fields_labels_ar[$i]["separator_field"], "details_table"); // get the correct display mode for the field
$details_table .= $field_to_display." ";
$details_table = substr($details_table, 0, -6); // delete the last
$details_table .= "</td></tr>";
} // end if
} // end for
} // end while
***************************
G. Go to function build_results_table and look for:
***************************
$results_table .= "<td class=\"".$td_results_class."\">"; // start the cell
$field_name_temp = $fields_labels_ar[$i]["name_field"];
$field_type = $fields_labels_ar[$i]["type_field"];
$field_content = $fields_labels_ar[$i]["content_field"];
$field_separator = $fields_labels_ar[$i]["separator_field"];
$field_values_ar = array(); // reset the array containing values to display,
$primary_key_field_field = $fields_labels_ar[$i]["primary_key_field_field"];
if ($primary_key_field_field != "")
{$primary_key_field_field = $fields_labels_ar[$i]["primary_key_field_field"];
$primary_key_table_field = $fields_labels_ar[$i]["primary_key_table_field"];
$primary_key_db_field = $fields_labels_ar[$i]["primary_key_db_field"];
$linked_fields_field = $fields_labels_ar[$i]["linked_fields_field"];
$alias_suffix_field = $fields_labels_ar[$i]["alias_suffix_field"];
$linked_fields_ar = explode($fields_labels_ar[$i]["separator_field"], $linked_fields_field);
for ($j=0;$j<count($linked_fields_ar);$j++)
{
$field_values_ar[$j] = $records_row[$linked_fields_ar[$j].$alias_prefix.$alias_suffix_field];
} // end for
}
else
{
$field_values_ar[0] = $records_row[$field_name_temp];
}
$count_temp_2 = count($field_values_ar);
for ($j=0; $j<$count_temp_2; $j++)
{
$field_to_display = get_field_correct_displaying($field_values_ar[$j], $field_type, $field_content, $field_separator, "results_table");
if ( $field_to_display == "")
{$field_to_display .= " ";}
$results_table .= $field_to_display." ";
}
$results_table = substr($results_table, 0, -6); // delete the last
$results_table .= "</td>"; // end the cell
***************************
Replace it with:
***************************
$results_table .= "<td class=\"".$td_results_class."\">"; // start the cell
$field_name_temp = $fields_labels_ar[$i]["name_field"];
$field_type = $fields_labels_ar[$i]["type_field"];
$field_content = $fields_labels_ar[$i]["content_field"];
$field_separator = $fields_labels_ar[$i]["separator_field"];
$field_value = $records_row[$field_name_temp];
$field_to_display = get_field_correct_displaying($field_value, $field_type, $field_content, $field_separator, "results_table");
if ( $field_to_display == "")
{$field_to_display .= " ";}
$results_table .= $field_to_display." ";
$results_table = substr($results_table, 0, -6); // delete the last
$results_table .= "</td>"; // end the cell
***************************
H. Go to function build_select_part and look for this 'foreach' loop:
***************************
foreach($fields_labels_ar as $field){
if ($field['present_results_search_field'] === '1' || $field['present_details_form_field'] === '1' || $field['name_field'] === $unique_field_name) { // include in the select stataments just the fields present in results or the primary key (useful to pass to the edit form)
// if the field has linked fields, include each linked fields in the select statement and the corresponding table (wiht join) in the from part. Use alias for all in order to mantain name unicity, each field has is own alias_suffix_field so it is easy
if ($field['primary_key_field_field'] !== '') {
$linked_fields_ar = explode($field['separator_field'], $field['linked_fields_field']);
foreach ($linked_fields_ar as $linked_field){
$sql_fields_part .= $quote.$field['primary_key_table_field'].$alias_prefix.$field['alias_suffix_field'].$quote.'.'.$quote.$linked_field.$quote.' AS '.$quote.$linked_field.$alias_prefix.$field['alias_suffix_field'].$quote.', ';
} //end foreach
$sql_from_part .= ' LEFT JOIN '.$quote.$field['primary_key_table_field'].$quote.' AS '.$quote.$field['primary_key_table_field'].$alias_prefix.$field['alias_suffix_field'].$quote;
$sql_from_part .= ' ON ';
$sql_from_part .= $quote.$table_name.$quote.'.'.$quote.$field['name_field'].$quote.' = '.$quote.$field['primary_key_table_field'].$alias_prefix.$field['alias_suffix_field'].$quote.'.'.$quote.$field['primary_key_field_field'].$quote;
} // end if
// if the field has not linked fiel, include just the field in the select statement
else {
$sql_fields_part .= $quote.$table_name.$quote.'.'.$quote.$field['name_field'].$quote.', ';
} // end else
} // end if
} // end foreach
***************************
Replace it with:
***************************
foreach($fields_labels_ar as $field){
if ($field['present_results_search_field'] === '1' || $field['present_details_form_field'] === '1' || $field['name_field'] === $unique_field_name) { // include in the select stataments just the fields present in results or the primary key (useful to pass to the edit form)
$sql_fields_part .= $quote.$table_name.$quote.'.'.$quote.$field['name_field'].$quote.', ';
} // end if
} // end foreach
***************************
5. Edit index.php by looking for this:
***************************
if ($fields_labels_ar[$field_index]["primary_key_field_field"] !== ''){
$linked_fields_ar = explode($fields_labels_ar[$field_index]['separator_field'], $fields_labels_ar[$field_index]['linked_fields_field']);
$is_first = 1;
foreach ($linked_fields_ar as $linked_field){
$sql .= $quote.$linked_field.$alias_prefix.$fields_labels_ar[$field_index]['alias_suffix_field'].$quote;
if ($is_first === 1){ // add the order type just to the first field e.g. order by field_1 DESC, field_2, field_3
$sql .= ' '.$order_type;
$is_first = 0;
} // end if
$sql .= ', ';
} //end foreach
$sql = substr($sql, 0, -2); // deleter the last ', '
} // end if
else{
$sql .= $quote.$table_name.$quote.'.'.$fields_labels_ar[$field_index]["name_field"];
$sql .= ' '.$order_type;
} // end else
**************************
And replace with:
**************************
$sql .= $quote.$table_name.$quote.'.'.$fields_labels_ar[$field_index]["name_field"];
$sql .= ' '.$order_type;
**************************