From a702d157cd145ee07850ea080ad9bf74e7beea7e Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Thu, 2 Feb 2017 20:21:25 -0500 Subject: [PATCH] Delete unused DAOs, fix some replace errors --- api/BusinessLogic/Tickets/TicketCreator.php | 4 +- api/Core/Exceptions/SQLException.php | 2 +- api/DataAccess/canned_dao.php | 28 ---------- api/DataAccess/status_dao.php | 52 ------------------ api/DataAccess/ticket_dao.php | 59 --------------------- api/DataAccess/ticket_template_dao.php | 26 --------- api/DataAccess/user_dao.php | 56 ------------------- api/index.php | 10 ++-- 8 files changed, 7 insertions(+), 230 deletions(-) delete mode 100644 api/DataAccess/canned_dao.php delete mode 100644 api/DataAccess/status_dao.php delete mode 100644 api/DataAccess/ticket_dao.php delete mode 100644 api/DataAccess/ticket_template_dao.php delete mode 100644 api/DataAccess/user_dao.php diff --git a/api/BusinessLogic/Tickets/TicketCreator.php b/api/BusinessLogic/Tickets/TicketCreator.php index 74d7786d..f34ae95f 100644 --- a/api/BusinessLogic/Tickets/TicketCreator.php +++ b/api/BusinessLogic/Tickets/TicketCreator.php @@ -22,7 +22,7 @@ class TicketCreator { throw new ValidationException($validationModel); } - // Create the Tickets + // Create the ticket } /** @@ -30,7 +30,7 @@ class TicketCreator { * @param $staff bool * @param $heskSettings array HESK settings * @param $modsForHeskSettings array Mods for HESK settings - * @return ValidationModel If errorKeys is empty, validation successful. Otherwise invalid Tickets + * @return ValidationModel If errorKeys is empty, validation successful. Otherwise invalid ticket */ function validate($ticketRequest, $staff, $heskSettings, $modsForHeskSettings) { $TICKET_PRIORITY_CRITICAL = 0; diff --git a/api/Core/Exceptions/SQLException.php b/api/Core/Exceptions/SQLException.php index db3f412b..e9530a5b 100644 --- a/api/Core/Exceptions/SQLException.php +++ b/api/Core/Exceptions/SQLException.php @@ -13,6 +13,6 @@ class SQLException extends Exception { function __construct($failingQuery) { $this->failingQuery = $failingQuery; - parent::__construct('A SQL Exceptions occurred. Check the logs for more information.'); + parent::__construct('A SQL exception occurred. Check the logs for more information.'); } } \ No newline at end of file diff --git a/api/DataAccess/canned_dao.php b/api/DataAccess/canned_dao.php deleted file mode 100644 index e4700491..00000000 --- a/api/DataAccess/canned_dao.php +++ /dev/null @@ -1,28 +0,0 @@ - $value) { - if ($key != 'id') { - $lowercase_key = lcfirst($key); - $row[$lowercase_key] = $row[$key]; - unset($row[$key]); - } - if ($key == 'id' || $lowercase_key == 'closable' - || $lowercase_key == 'key' || $lowercase_key == 'sort' - || $lowercase_key == 'textColor') { - continue; - } - $row[$lowercase_key] = $row[$lowercase_key] == true; - } - - $language_sql = "SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "text_to_status_xref` " - . "WHERE `status_id` = ".intval($row['id']); - - $language_rs = hesk_dbQuery($language_sql); - if (hesk_dbNumRows($language_rs) > 0) { - $row['key'] = NULL; - $row['keys'] = array(); - } - while ($language_row = hesk_dbFetchAssoc($language_rs)) { - unset($language_row['id']); - unset($language_row['status_id']); - $row['keys'][] = $language_row; - } - - $results[] = $row; - } - - return $id == NULL ? $results : $results[0]; -} \ No newline at end of file diff --git a/api/DataAccess/ticket_dao.php b/api/DataAccess/ticket_dao.php deleted file mode 100644 index f7805323..00000000 --- a/api/DataAccess/ticket_dao.php +++ /dev/null @@ -1,59 +0,0 @@ - " . intval($user['id']) . "))"; - } - - $response = hesk_dbQuery($sql); - - if (hesk_dbNumRows($response) == 0) { - return NULL; - } - - $results = build_results($response); - - return $id == NULL ? $results : $results[0]; -} - -function build_results($response) { - $results = array(); - while ($row = hesk_dbFetchAssoc($response)) { - $row['id'] = intval($row['id']); - $row['Categories'] = intval($row['Categories']); - $row['priority'] = intval($row['priority']); - $row['status'] = intval($row['status']); - $row['replierid'] = intval($row['replierid']); - $row['archive'] = $row['archive'] == true; - $row['locked'] = $row['locked'] == true; - $row['html'] = $row['html'] == true; - $row['screen_resolution_height'] = convert_to_int($row['screen_resolution_height']); - $row['screen_resolution_width'] = convert_to_int($row['screen_resolution_width']); - $row['owner'] = convert_to_int($row['owner']); - $row['parent'] = convert_to_int($row['parent']); - $row['overdue_email_sent'] = $row['overdue_email_sent'] == true; - - - $results[] = $row; - } - - return $results; -} - -function convert_to_int($item) { - return $item != NULL ? intval($item) : NULL; -} \ No newline at end of file diff --git a/api/DataAccess/ticket_template_dao.php b/api/DataAccess/ticket_template_dao.php deleted file mode 100644 index 118ba218..00000000 --- a/api/DataAccess/ticket_template_dao.php +++ /dev/null @@ -1,26 +0,0 @@ -failingQuery, $exception->getTraceAsString())); + print_error("Fought an uncaught exception", sprintf("%s\n\n%s", $castedException->failingQuery, $exception->getTraceAsString())); } else { - print_error("Fought an uncaught Exceptions", sprintf("%s\n\n%s", $exception->getMessage(), $exception->getTraceAsString())); + print_error("Fought an uncaught exception", sprintf("%s\n\n%s", $exception->getMessage(), $exception->getTraceAsString())); } } @@ -63,8 +61,8 @@ function exceptionHandler($exception) { } /** - * @param $exception Exception thrown Exceptions - * @param $class string The name of the expected Exceptions type + * @param $exception Exception thrown exception + * @param $class string The name of the expected exception type * @return bool */ function exceptionIsOfType($exception, $class) {