
How to make attachments required like full name and email fields
Moderator: mkoch227
How to make attachments required like full name and email fields
I need to make upload attachments required when submitting tickets on my help desk. I can't find the code to make it required 

Re: How to make attachments required like full name and email fields
Haven't tested it, but try adding just above in submit_ticket.php
You will also want to add the red asterix on the submit a ticket form in index.php change to
If you want the same for admin panel, similar code changes will go to admin/new_ticket.php and admin/admin_submit_ticket.php
Code: Select all
if (empty($attachments) && ! isset($hesk_error_buffer['attachments']))
{
$hesk_error_buffer['attachments'] = 'Please attach a file to your ticket.';
}
Code: Select all
if (count($hesk_error_buffer))
You will also want to add the red asterix on the submit a ticket form in index.php change
Code: Select all
<?php echo $hesklang['attachments']; ?>:
Code: Select all
<?php echo $hesklang['attachments']; ?>: <font class="important">*</font>
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here 
You should follow me on Twitter here
Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools


Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Re: How to make attachments required like full name and email fields
thanks for your response, It kinda works, but there is only one thing that it's not working right now, i still able to open a new ticket with no attachments added. 

Re: How to make attachments required like full name and email fields
Anyone has figure out how to make attachments required?
Re: How to make attachments required like full name and email fields
The code modifications I posted above work for me in Hesk 3.2.5 when submitting tickets from the customer web interface.
Have you tried them?
Have you tried them?
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here 
You should follow me on Twitter here
Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools


Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Re: How to make attachments required like full name and email fields
Thank you very much for the reply!
Unfortunately no, I can't get it to work. When I don't attach, I get the notice, but attaching I still get the required notice. The notice always appears now, attached or not.
my site is https://activo.sanlo.gov.py in case you can try and create a ticket to see how it behaves please
Unfortunately no, I can't get it to work. When I don't attach, I get the notice, but attaching I still get the required notice. The notice always appears now, attached or not.
my site is https://activo.sanlo.gov.py in case you can try and create a ticket to see how it behaves please
Re: How to make attachments required like full name and email fields
I submitted a test ticket with no attachment, so I presume you don't have the modification in place anymore.
Did you try the submit_ticket.php file I emailed you?
Did you try the submit_ticket.php file I emailed you?
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here 
You should follow me on Twitter here
Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools


Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Re: How to make attachments required like full name and email fields
I'm sorry. Considering that it is in production, I removed the modification for a moment. now I put the modification back if you want to try
Re: How to make attachments required like full name and email fields
Found the issue - it showed the same error message, even if the error was a different one (like a file type not allowed).
This part:
Should be:
Will fix it in above example too.
This part:
Code: Select all
if (empty($attachments))
Code: Select all
if (empty($attachments) && ! isset($hesk_error_buffer['attachments']))
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here 
You should follow me on Twitter here
Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools


Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Re: How to make attachments required like full name and email fields
you're right! now it works perfect!!
You saved me! Thank you!! you're very kind!
You saved me! Thank you!! you're very kind!