Example #1
0
function set_entry_status($lead, $form)
{
    //$location_change=$_POST['entry_info_location_change'];
    //$flags_change=$_POST['entry_info_flags_change'];
    $location_comment_change = $_POST['entry_location_comment'];
    $acceptance_status_change = $_POST['entry_info_status_change'];
    $entry_info_entry_id = $_POST['entry_info_entry_id'];
    $acceptance_current_status = $lead['303'];
    $is_acceptance_status_changed = strcmp($acceptance_current_status, $acceptance_status_change) != 0;
    if (!empty($entry_info_entry_id)) {
        if (!empty($acceptance_status_change)) {
            //Update Field for Acceptance Status
            $entry_info_entry['303'] = $acceptance_status_change;
            mf_update_entry_field($entry_info_entry_id, '303', $acceptance_status_change);
            //Reload entry to get any changes in status
            $lead['303'] = $acceptance_status_change;
            //Handle acceptance status changes
            if ($is_acceptance_status_changed) {
                //Create a note of the status change.
                $results = mf_add_note($entry_info_entry_id, 'EntryID:' . $entry_info_entry_id . ' status changed to ' . $acceptance_status_change);
                //Handle notifications for acceptance
                $notifications_to_send = GFCommon::get_notifications_to_send('mf_acceptance_status_changed', $form, $lead);
                foreach ($notifications_to_send as $notification) {
                    if ($notification['isActive']) {
                        GFCommon::send_notification($notification, $form, $lead);
                    }
                }
                GFJDBHELPER::gravityforms_sync_status_jdb($entry_info_entry_id, $acceptance_status_change);
            }
        }
    }
}
Example #2
0
function makerCancelEntry()
{
    $entryID = isset($_POST['cancel_entry_id']) ? $_POST['cancel_entry_id'] : 0;
    $reason = isset($_POST['cancel_reason']) ? $_POST['cancel_reason'] : '';
    if ($entryID != 0) {
        //get entry data and form data
        $lead = GFAPI::get_entry(esc_attr($entryID));
        $form = GFAPI::get_form($lead['form_id']);
        //Update Status to Cancelled
        mf_update_entry_field($entryID, '303', 'Cancelled');
        //Make a note of the cancellation
        $cancelText = "The Exhibit has been cancelled by the maker.  Reason given is: " . stripslashes($reason);
        mf_add_note($entryID, $cancelText);
        //Handle notifications for acceptance
        $notifications_to_send = GFCommon::get_notifications_to_send('maker_cancel_exhibit', $form, $lead);
        foreach ($notifications_to_send as $notification) {
            if ($notification['isActive']) {
                GFCommon::send_notification($notification, $form, $lead);
            }
        }
        //GFJDBHELPER::gravityforms_sync_status_jdb($entry_info_entry_id,$acceptance_status_change);
        echo $lead['151'] . ', Exhibit ID ' . $entryID . ' has been cancelled';
    } else {
        echo 'Error in cancelling this exhibit.';
    }
    exit;
}