diff --git a/api/BusinessLogic/Tickets/ReplyCreator.php b/api/BusinessLogic/Tickets/ReplyCreator.php index 225cf83d..241cf6bb 100644 --- a/api/BusinessLogic/Tickets/ReplyCreator.php +++ b/api/BusinessLogic/Tickets/ReplyCreator.php @@ -61,10 +61,21 @@ class ReplyCreator extends \BaseClass { } $validationModel = new ValidationModel(); + if ($ticket->id !== $replyRequest->ticketId) { + $validationModel->errorKeys[] = 'TICKET_ID_TRACKING_NUMBER_MISMATCH'; + } if ($replyRequest->replyMessage === null || trim($replyRequest->replyMessage) === '') { $validationModel->errorKeys[] = 'MESSAGE_REQUIRED'; } + if ($replyRequest->ipAddress === null || trim($replyRequest->ipAddress) === '') { + $validationModel->errorKeys[] = 'IP_REQUIRED'; + } + + if ($replyRequest->hasHtml === null) { + $validationModel->errorKeys[] = 'HAS_HTML_REQUIRED'; + } + if ($heskSettings['email_view_ticket']) { if ($replyRequest->emailAddress === null || trim($replyRequest->emailAddress) === '') { $validationModel->errorKeys[] = 'EMAIL_REQUIRED'; @@ -77,7 +88,7 @@ class ReplyCreator extends \BaseClass { throw new ValidationException($validationModel); } - if ($modsForHeskSettings['rich_text_for_tickets_for_customers']) { + if ($replyRequest->hasHtml) { $replyRequest->replyMessage = Helpers::heskMakeUrl($replyRequest->replyMessage); $replyRequest->replyMessage = nl2br($replyRequest->replyMessage); } diff --git a/api/Controllers/Tickets/CustomerReplyController.php b/api/Controllers/Tickets/CustomerReplyController.php index a52d1866..897195bd 100644 --- a/api/Controllers/Tickets/CustomerReplyController.php +++ b/api/Controllers/Tickets/CustomerReplyController.php @@ -16,17 +16,14 @@ class CustomerReplyController extends \BaseClass { $jsonRequest = JsonRetriever::getJsonData(); $createReplyByCustomerModel = new CreateReplyRequest(); - $createReplyByCustomerModel->id = $ticketId; + $createReplyByCustomerModel->ticketId = intval($ticketId); $createReplyByCustomerModel->emailAddress = Helpers::safeArrayGet($jsonRequest, 'email'); $createReplyByCustomerModel->trackingId = Helpers::safeArrayGet($jsonRequest, 'trackingId'); $createReplyByCustomerModel->replyMessage = Helpers::safeArrayGet($jsonRequest, 'message'); - $createReplyByCustomerModel->hasHtml = Helpers::safeArrayGet($jsonRequest, 'html'); + $html = Helpers::safeArrayGet($jsonRequest, 'html'); + $createReplyByCustomerModel->hasHtml = $html === null ? null : $html === true; $createReplyByCustomerModel->ipAddress = Helpers::safeArrayGet($jsonRequest, 'ip'); - if ($createReplyByCustomerModel->ipAddress === null) { - $createReplyByCustomerModel->ipAddress = hesk_getClientIP(); - } - /* @var $modsForHeskSettingsGateway ModsForHeskSettingsGateway */ $modsForHeskSettingsGateway = $applicationContext->get(ModsForHeskSettingsGateway::clazz()); $modsForHesk_settings = $modsForHeskSettingsGateway->getAllSettings($hesk_settings); diff --git a/install/install_functions.inc.php b/install/install_functions.inc.php index 894bb47e..bdf76f78 100644 --- a/install/install_functions.inc.php +++ b/install/install_functions.inc.php @@ -15,8 +15,8 @@ if (!defined('IN_SCRIPT')) {die('Invalid attempt');} // We will be installing this HESK version: -define('HESK_NEW_VERSION','2.7.6'); -define('MODS_FOR_HESK_NEW_VERSION','3.3.0'); +define('HESK_NEW_VERSION','2.8.1'); +define('MODS_FOR_HESK_NEW_VERSION','2018.1.0'); define('REQUIRE_PHP_VERSION','5.3.0'); define('REQUIRE_MYSQL_VERSION','5.0.7');