Notice: ABPro's Stripe payment processor uses the Legacy Checkout and is not SCA compatible. read more..


Admin notification on Timeout

This code modification will send an email to Admin when bookings timeout.



Every time a booking screen is opened, ABPro checks to see if any bookings are pending and need to being set to Timeout.
This is done with a single line of SQL and has no effect on the time it takes to open a booking screen.

The modification below will additionally send an email to admin if any bookings are being timed out, as such the time to load the booking screen will increase if an email needs to be sent. The email is only sent if bookings are being timed out, so the delay on opening the booking screen will only happen occasionally.


Edit file: \components\com_rsappt_pro3\functions2.php

Around line 988 look for the function purgeStalePayPalBookings($minutes_to_stale)

The function starts like this..


New code to insert at location shown above..

    $database = JFactory::getDBO();

// HOW-TO code STARTS here
$sql = "SELECT id_requests FROM #__sv_apptpro3_requests ".
    " WHERE request_status = 'pending' ".
    " AND DATE_ADD(created, INTERVAL ".$minutes_to_stale." MINUTE) < NOW()";
    $purge_ids = $database->loadColumn();
} catch (RuntimeException $e) {
    logIt($e->getMessage(), "functions2", "", "");
    echo JText::_('RS1_SQL_ERROR');

if(count($purge_ids) > 0 ){
    $str_ids = implode(",", $purge_ids);
    echo $str_ids;
    $sql = 'SELECT * FROM #__sv_apptpro3_config';
        $apptpro_config = NULL;
        $apptpro_config = $database -> loadObject();
    } catch (RuntimeException $e) {
        logIt($e->getMessage(), "purgeStalePayPalBookings", "", "");
        echo JText::_('RS1_SQL_ERROR');
    $mailer = JFactory::getMailer();
    catch (Exception $e){
        logIt("Error on setting email FROM address: ".$e->getMessage(), "purgeStalePayPalBookings", "", "");
        return false;
    $mailer->setSubject('Booking(s) timed out');
    $mailer->setBody("Booking(s) set to status Timeout: ". $str_ids);
    $send = $mailer->Send();
    if ( $send !== true ) {
        logIt('Error sending email: '.$e->getMessage(), "purgeStalePayPalBookings", "", "");
// HOW-TO code ENDS here

    $sql = "UPDATE #__sv_apptpro3_requests SET request_status = 'timeout' ".


 The email sent to Admin will contain the booking ids that were set to Timeout..