You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Mods-for-HESK-Netsyms/api/DataAccess/Attachments/AttachmentGateway.php

30 lines
976 B
PHP

<?php
namespace DataAccess\Attachments;
use BusinessLogic\Attachments\TicketAttachment;
use DataAccess\CommonDao;
class AttachmentGateway extends CommonDao {
/**
* @param $attachment TicketAttachment
* @param $heskSettings array
* @return int The inserted attachment ID
*/
function createAttachmentForTicket($attachment, $heskSettings) {
$this->init();
hesk_dbQuery("INSERT INTO `" . hesk_dbEscape($heskSettings['db_pfix']) . "attachments`
(`ticket_id`, `note_id`, `saved_name`, `real_name`, `size`, `type`, `download_count`)
VALUES ('" . hesk_dbEscape($attachment->ticketTrackingId) . "', NULL, '" . hesk_dbEscape($attachment->savedName) . "',
'" . hesk_dbEscape($attachment->displayName) . "', " . intval($attachment->fileSize) . ", '" . intval($attachment->type) . "', 0)");
$attachmentId = hesk_dbInsertID();
$this->close();
return $attachmentId;
}
}