philbertphotos / osticket-multildap-auth-plugin

Plugin for OS Ticket that allows for authentication with multiple domains.
GNU General Public License v3.0
28 stars 16 forks source link

DB Error #1146 #35

Closed ScottishSamurai closed 3 years ago

ScottishSamurai commented 3 years ago

Greetings,

I just added and enabled your plugin. I previously was using the OSTicket plugin for LDAP but just switched to yours in hopes to get better use with "clients", however I am getting email reports with, DB Error #1146. The emails are saying that a table doesn't exist and column is missing.

Table '(our database)_ldap_sync' doesn't exist Unknown column 'staff.username' in 'field list'

Was the plugin suppose to add the add the table? and I show the column exsists but not showing our database reference. Any ideas?

ScottishSamurai commented 3 years ago

Small update. I see that line 371 does not show TABLE_PREFIX for the staff.name

$qry_ostagents = "SELECT staff.username, " . TABLE_PREFIX . "staff.email, "

philbertphotos commented 3 years ago

I will update the fix... let me know if all else works. It is supposed to create the tables. The code is there ... I have to test it on a clean setup.

philbertphotos commented 3 years ago
function createDBTables() {
    //db_query("DROP TABLE IF EXISTS " . TABLE_PREFIX . "ldap_sync");
    $sqlsync = ("CREATE TABLE " . TABLE_PREFIX . "ldap_sync (
              `id` bigint(20) unsigned NOT NULL,
              `guid` varchar(40) NOT NULL,
              `updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
              PRIMARY KEY (`id`)
            ) ENGINE=InnoDB DEFAULT CHARSET=utf8;");
    //$this->logger('warning', 'createDBTables', $sqlsync);
    $result = db_query($sqlsync);
    if ($result) {
        return true;
    }
    return false;
}
philbertphotos commented 3 years ago

Code errors fixed.