Skip to content

Commit

Permalink
Added a couple of fields to the PreviousConTracks table. Added fix fo…
Browse files Browse the repository at this point in the history
…r issue #134.
  • Loading branch information
LVerhulst4321 committed Aug 28, 2021
1 parent e001968 commit a4237d6
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
13 changes: 13 additions & 0 deletions Install/Upgrade_dbase/74CAP_update_previouscontracks.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## This script adds a missing field to the PreviousConTracks table.
##
## Created by Leane Verhulst on August 27, 2021
## Copyright (c) 2021 by Peter Olszowka. All rights reserved. See copyright document for more details.
##

## Add missing field
ALTER TABLE `PreviousConTracks` ADD COLUMN `display_order` int(11) NOT NULL AFTER `trackname`;
ALTER TABLE `PreviousConTracks` ADD COLUMN `selfselect` tinyint(1) NOT NULL AFTER `display_order`;



INSERT INTO PatchLog (patchname) VALUES ('74CAP_update_previouscontracks.sql');
7 changes: 4 additions & 3 deletions webpages/SubmitEditConfigTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,15 @@ function update_table($tablename) {
foreach($schema as $col) {
if ($col['EXTRA'] != 'auto_increment') {
$name = $col['COLUMN_NAME'];
$paramarray[] = $row->$name;
// If uploaded data has column property, and it's not an empty string, add to paramarray. Otherwise add a null (null is needed to prevent error inserting non-char fields).
$paramarray[] = (property_exists($row, $name) && trim($row->$name) !== '' ? trim($row->$name) : null);
}
}

//error_log("\n\nInsert of '$id' with datatype of '$datatype'");
//error_log($sql);
//var_error_log($paramarray);
$inserted = $inserted + mysql_cmd_with_prepare($sql, $datatype, $paramarray);
$inserted += mysql_cmd_with_prepare($sql, $datatype, $paramarray);
}
}
}
Expand Down Expand Up @@ -165,7 +166,7 @@ function update_table($tablename) {
$paramarray[] = $id;
//error_log("\n\nupdate of '$id' with '$datatype'\n" . $sql);
//var_error_log($paramarray);
$updated = $updated + mysql_cmd_with_prepare($sql, $datatype, $paramarray);
$updated += mysql_cmd_with_prepare($sql, $datatype, $paramarray);
}
}

Expand Down
15 changes: 8 additions & 7 deletions webpages/js/EditConfigTables.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,18 +223,19 @@ function opentable(tabledata) {
columns.push({ title: "Order", field: "display_order", visible: false });
display_order = true;
} else if (fetch_json.hasOwnProperty(column.COLUMN_NAME + "_select")) {
selectlistname = column.COLUMN_NAME + "_select";
editor_type = 'select';
selectlist = new Array();
fetch_json[column.COLUMN_NAME + "_select"].forEach(function (entry) { selectlist[entry.id] = entry.name; });
editor_params = { values: selectlist };
formatlist = new Array();
fetch_json[column.COLUMN_NAME + "_select"].forEach(function (entry) {
selectlist.push({ label: entry.name, value: entry.id });
formatlist[entry.id] = entry.name;
});
columns.push({
title: column.COLUMN_NAME, field: column.COLUMN_NAME,
visible: true,
editor: editor_type,
editorParams: editor_params,
editor: 'select',
editorParams: { values: selectlist },
formatter: "lookup",
formatterParams: selectlist,
formatterParams: formatlist,
minWidth: 200,
cellClick: tceEditorBlur
});
Expand Down

0 comments on commit a4237d6

Please sign in to comment.