In RSTicket, you have the option to add or edit a ticket. But it does not allow you to add personalized files (images or pdf), i.e. files such as invoices, receipts, photos, etc.
I have created this small and simple script that allows me to save the files in the following structure: folder > ticket id > file type ( invoice ) > file.
define('JPATH_BASE', '../');
jimport('joomla.filesystem.file');
$input = JFactory::getApplication()->input;
// Image
if ($file = $input->files->get('images')) {
$filename = JFile::makeSafe(date("Y-m-d").$file['name']);
$src = $file['tmp_name'];
// If it does not exist, create the folder
if (!JFolder::create($idTicket.'/images/'))
{
//
}
$dest = JPATH_BASE .'/RSTickets_files/'.$idTicket.'/images/' . $filename;
}
// Invoices
if ($file = $input->files->get('invoices')) {
$filename = JFile::makeSafe(date("Y-m-d").$file['name']);
$src = $file['tmp_name'];
// If it does not exist, create the folder
if (!JFolder::create($idTicket.'/invoices/'))
{
//
}
$dest = JPATH_BASE .'/RSTickets_files/'.$idTicket.'/invoices/' . $filename;
}
and the html code:
<input type="file" name="images" />
<input type="file" name="invoices" />
This script works, but I would like to know if any of you have done something similar with RSTicket.
Or if someone has an idea of how they could save it in the database and relate it to the ticket id.
I have some idea that I've seen in joomla.stackexchange.com
I thank you in advance for your help and suggestion.
Once I get it, I'll publish the final code, maybe it'll help others.