Send Email to User When The Limit Ticket is Reached in osTicket v1.6 RC5

There was a new request that being asked to myself regarding the modification on osTicket System I made through this article: Limiting Tickets Sent by Same Email Within The Last N Days in osTicket. That request was about send email to user when the limit ticket is reached and the last ticket is rejected. So I made the modification by modifying the code based on that modification above.

Open \include\class.ticket.php file, and find this code:

1151
1152
1153
1154
1155
1156
1157
1158
  $sqllimit='SELECT email FROM '.TICKET_TABLE.'
             WHERE 30 >= TIMESTAMPDIFF(DAY,created,NOW()) 
             AND email='.db_input($var['email']).'';
  $reslimit=db_query($sqllimit);
  // Limit only 3 tickets sent within the last 30 days
  if (db_num_rows($reslimit) >= 3) {
      $errors['err'] = 'You are not allowed to send the ticket because you have already sent 3 tickets within the last 30 days!';
  }

then repalace with this following code:

1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
  $sqllimit='SELECT email FROM '.TICKET_TABLE.'
             WHERE 30 >= TIMESTAMPDIFF(DAY,created,NOW()) 
             AND email='.db_input($var['email']).'';
  $reslimit=db_query($sqllimit);
  // Limit only 3 tickets in the last 30 days
  if (db_num_rows($reslimit) >= 3) {
    $email=$cfg->getDefaultEmail();
    if($email){
      $email->send($var['email'], 'Creating Ticket Denied', 'You are not allowed to send the ticket because you have already sent 3 ticket in the last 30 days!');
    }
    $errors['err'] = 'You are not allowed to send the ticket because you have already sent 3 ticket in the last 30 days!';
  }

Hopefully this will be helpful.

Share

216 viewsPrint This Post Print This Post

Comments

  1. Sebastian says:

    Thanks again for this. It helped us out big time.

    Good luck with everything!

Speak Your Mind

*


*