';
$show_cancelled_meta_boxes = false;
$show_feedback_meta_boxes = false;
$show_customise_confirmation_meta_boxes = false;
$show_customise_cancellation_notification_meta_boxes = false;
$actions = array();
if ( $status == 'pending' )
{
$property_id = get_post_meta( $post_id, '_property_id', TRUE );
$applicant_contact_ids = get_post_meta( $post_id, '_applicant_contact_id' );
$applicant_email_addresses = array();
foreach ($applicant_contact_ids as $applicant_contact_id)
{
$applicant_email_addresses[] = get_post_meta( $applicant_contact_id, '_email_address', TRUE );
}
if ( in_array((int)$property_id, array(0, '')) || !is_array($applicant_contact_ids) || count($applicant_contact_ids) == 0 || count($applicant_email_addresses) == 0 )
{
}
else
{
$applicant_booking_confirmation_sent_at = get_post_meta( $post_id, '_applicant_booking_confirmation_sent_at', TRUE );
$owner_booking_confirmation_sent_at = get_post_meta( $post_id, '_owner_booking_confirmation_sent_at', TRUE );
$attending_negotiator_booking_confirmation_sent_at = get_post_meta( $post_id, '_attending_negotiator_booking_confirmation_sent_at', TRUE );
// Applicant
if ( apply_filters( 'propertyhive_show_viewing_email_applicant_booking_confirmation', true ) === true )
{
if ( get_option( 'propertyhive_customise_confirmation_emails', '' ) == 'yes' )
{
$actions[] = '
' . ( ( $applicant_booking_confirmation_sent_at == '' ) ? __('Email Applicant Booking Confirmation', 'propertyhive') : __('Re-Email Applicant Booking Confirmation', 'propertyhive') ) . '';
$show_customise_confirmation_meta_boxes = true;
}
else
{
$actions[] = '
' . ( ( $applicant_booking_confirmation_sent_at == '' ) ? __('Email Applicant Booking Confirmation', 'propertyhive') : __('Re-Email Applicant Booking Confirmation', 'propertyhive') ) . '';
}
$actions[] = '
' . ( ( $applicant_booking_confirmation_sent_at != '' ) ? 'Previously sent to applicant on ' . date("jS F", strtotime($applicant_booking_confirmation_sent_at)) : '' ) . '
';
}
// Owner/Landlord
if ( apply_filters( 'propertyhive_show_viewing_email_owner_booking_confirmation', true ) === true )
{
$property_department = get_post_meta( $property_id, '_department', TRUE );
$owner_contact_ids = get_post_meta( $property_id, '_owner_contact_id', TRUE );
$owner_or_landlord = ( $property_department == 'residential-lettings' ? 'Landlord' : 'Owner' );
if ( is_array($owner_contact_ids) && count($owner_contact_ids) > 0) {
if ( get_option( 'propertyhive_customise_confirmation_emails', '' ) == 'yes' )
{
$actions[] = '
' . ( ( $owner_booking_confirmation_sent_at == '' ) ? __('Email ' . $owner_or_landlord . ' Booking Confirmation', 'propertyhive') : __('Re-Email ' . $owner_or_landlord . ' Booking Confirmation', 'propertyhive') ) . '';
$show_customise_confirmation_meta_boxes = true;
}
else
{
$actions[] = '
' . ( ( $owner_booking_confirmation_sent_at == '' ) ? __('Email ' . $owner_or_landlord . ' Booking Confirmation', 'propertyhive') : __('Re-Email ' . $owner_or_landlord . ' Booking Confirmation', 'propertyhive') ) . '';
}
$actions[] = '
' . ( ( $owner_booking_confirmation_sent_at != '' ) ? 'Previously sent to ' . strtolower($owner_or_landlord) . ' on ' . date("jS F", strtotime($owner_booking_confirmation_sent_at)) : '' ) . '
';
}
}
// Attending Negotiators
if ( apply_filters( 'propertyhive_show_viewing_email_attending_negotiator_booking_confirmation', true ) === true )
{
$attending_negotiators = get_post_meta( $property_id, '_negotiator_id' );
if ( !empty($attending_negotiators) )
{
if ( get_option( 'propertyhive_customise_confirmation_emails', '' ) == 'yes' )
{
$actions[] = '
' . ( ( $attending_negotiator_booking_confirmation_sent_at == '' ) ? __('Email Negotiator Booking Confirmation', 'propertyhive') : __('Re-Email Negotiator Booking Confirmation', 'propertyhive') ) . '';
$show_customise_confirmation_meta_boxes = true;
}
else
{
$actions[] = '
' . ( ( $attending_negotiator_booking_confirmation_sent_at == '' ) ? __('Email Negotiator Booking Confirmation', 'propertyhive') : __('Re-Email Negotiator Booking Confirmation', 'propertyhive') ) . '';
}
$actions[] = '
' . ( ( $attending_negotiator_booking_confirmation_sent_at != '' ) ? 'Previously sent to attending negotiators on ' . date("jS F", strtotime($attending_negotiator_booking_confirmation_sent_at)) : '' ) . '
';
}
}
$actions[] = '
';
}
$actions[] = '
' . __('Viewing Carried Out', 'propertyhive') . '';
$actions[] = '
' . __('Viewing Cancelled', 'propertyhive') . '';
$actions[] = '
' . __('Applicant No Show', 'propertyhive') . '';
$show_cancelled_meta_boxes = true;
}
if ( $status == 'carried_out' )
{
if ( $feedback_status == '' )
{
$actions[] = '
' . wp_kses_post( __('Applicant Interested', 'propertyhive') ) . '';
$actions[] = '
' . wp_kses_post( __('Applicant Not Interested', 'propertyhive') ) . '';
$actions[] = '
' . wp_kses_post( __('Feedback Not Required', 'propertyhive') ) . '';
$show_feedback_meta_boxes = true;
}
if ( $feedback_status == 'interested' )
{
$actions[] = '
' . wp_kses_post( __('Book Second Viewing', 'propertyhive') ) . '';
if ( get_option('propertyhive_module_disabled_offers_sales', '') != 'yes' )
{
$property_id = get_post_meta( $post_id, '_property_id', TRUE );
if ( get_post_meta( $property_id, '_department', TRUE ) == 'residential-sales' )
{
// See if an offer has this viewing id associated with it
$offer_id = get_post_meta( $post_id, '_offer_id', TRUE );
if ( $offer_id != '' && get_post_status($offer_id) != 'publish' )
{
$offer_id = '';
}
if ( $offer_id != '' )
{
$actions[] = '
' . wp_kses_post( __('View Offer', 'propertyhive') ) . '';
}
else
{
$actions[] = '
' . wp_kses_post( __('Record Offer', 'propertyhive') ) . '';
}
}
}
}
if ( get_post_meta( $post_id, '_feedback_passed_on', TRUE ) != 'yes' && ( $feedback_status == 'interested' || $feedback_status == 'not_interested' ) )
{
$actions[] = '
' . wp_kses_post( __('Feedback Passed On To Owner', 'propertyhive') ) . '';
}
if ( $feedback_status == 'interested' || $feedback_status == 'not_interested' || $feedback_status == 'not_required' )
{
$actions[] = '
' . wp_kses_post( __('Revert To Feedback Pending', 'propertyhive') ) . '';
}
}
if ( $status == 'offer_made' )
{
if ( get_option('propertyhive_module_disabled_offers_sales', '') != 'yes' )
{
$offer_id = get_post_meta( $post_id, '_offer_id', TRUE );
if ( $offer_id != '' && get_post_status($offer_id) != 'publish' )
{
$offer_id = '';
}
if ( $offer_id != '' )
{
$actions[] = '
' . wp_kses_post( __('View Offer', 'propertyhive') ) . '';
}
}
}
if ( $status == 'cancelled' )
{
$property_id = get_post_meta( $post_id, '_property_id', TRUE );
$applicant_contact_ids = get_post_meta( $post_id, '_applicant_contact_id' );
$applicant_email_addresses = array();
foreach ($applicant_contact_ids as $applicant_contact_id)
{
$applicant_email_addresses[] = get_post_meta( $applicant_contact_id, '_email_address', TRUE );
}
if ( in_array((int)$property_id, array(0, '')) || !is_array($applicant_contact_ids) || count($applicant_contact_ids) == 0 || count($applicant_email_addresses) == 0 )
{
}
else
{
$applicant_cancellation_notification_sent_at = get_post_meta( $post_id, '_applicant_cancellation_notification_sent_at', TRUE );
$owner_cancellation_notification_sent_at = get_post_meta( $post_id, '_owner_cancellation_notification_sent_at', TRUE );
$attending_negotiator_cancellation_notification_sent_at = get_post_meta( $post_id, '_attending_negotiator_cancellation_notification_sent_at', TRUE );
// Applicant
if ( apply_filters( 'propertyhive_show_viewing_email_applicant_cancellation_notification', true ) === true )
{
if ( get_option( 'propertyhive_customise_confirmation_emails', '' ) == 'yes' )
{
$actions[] = '
' . ( ( $applicant_cancellation_notification_sent_at == '' ) ? __('Email Applicant Cancellation Notification', 'propertyhive') : __('Re-Email Applicant Cancellation Notification', 'propertyhive') ) . '';
$show_customise_cancellation_notification_meta_boxes = true;
}
else
{
$actions[] = '
' . ( ( $applicant_cancellation_notification_sent_at == '' ) ? __('Email Applicant Cancellation Notification', 'propertyhive') : __('Re-Email Applicant Cancellation Notification', 'propertyhive') ) . '';
}
$actions[] = '
' . ( ( $applicant_cancellation_notification_sent_at != '' ) ? 'Previously sent to applicant on ' . date("jS F", strtotime($applicant_cancellation_notification_sent_at)) : '' ) . '
';
}
// Owner/Landlord
if ( apply_filters( 'propertyhive_show_viewing_email_owner_cancellation_notification', true ) === true )
{
$property_department = get_post_meta( $property_id, '_department', TRUE );
$owner_contact_ids = get_post_meta( $property_id, '_owner_contact_id', TRUE );
$owner_or_landlord = ( $property_department == 'residential-lettings' ? 'Landlord' : 'Owner' );
if ( is_array($owner_contact_ids) && count($owner_contact_ids) > 0) {
if ( get_option( 'propertyhive_customise_confirmation_emails', '' ) == 'yes' )
{
$actions[] = '
' . ( ( $owner_cancellation_notification_sent_at == '' ) ? __('Email ' . $owner_or_landlord . ' Cancellation Notification', 'propertyhive') : __('Re-Email ' . $owner_or_landlord . ' Cancellation Notification', 'propertyhive') ) . '';
$show_customise_cancellation_notification_meta_boxes = true;
}
else
{
$actions[] = '
' . ( ( $owner_cancellation_notification_sent_at == '' ) ? __('Email ' . $owner_or_landlord . ' Cancellation Notification', 'propertyhive') : __('Re-Email ' . $owner_or_landlord . ' Cancellation Notification', 'propertyhive') ) . '';
}
$actions[] = '
' . ( ( $owner_cancellation_notification_sent_at != '' ) ? 'Previously sent to ' . strtolower($owner_or_landlord) . ' on ' . date("jS F", strtotime($owner_cancellation_notification_sent_at)) : '' ) . '
';
}
}
// Attending Negotiators
if ( apply_filters( 'propertyhive_show_viewing_email_attending_negotiator_cancellation_notification', true ) === true )
{
$attending_negotiators = get_post_meta( $property_id, '_negotiator_id' );
if ( !empty($attending_negotiators) )
{
if ( get_option( 'propertyhive_customise_confirmation_emails', '' ) == 'yes' )
{
$actions[] = '
' . ( ( $attending_negotiator_cancellation_notification_sent_at == '' ) ? __('Email Negotiator Cancellation Notification', 'propertyhive') : __('Re-Email Negotiator Cancellation Notification', 'propertyhive') ) . '';
$show_customise_cancellation_notification_meta_boxes = true;
}
else
{
$actions[] = '
' . ( ( $attending_negotiator_cancellation_notification_sent_at == '' ) ? __('Email Negotiator Cancellation Notification', 'propertyhive') : __('Re-Email Negotiator Cancellation Notification', 'propertyhive') ) . '';
}
$actions[] = '
' . ( ( $attending_negotiator_cancellation_notification_sent_at != '' ) ? 'Previously sent to attending negotiators on ' . date("jS F", strtotime($attending_negotiator_cancellation_notification_sent_at)) : '' ) . '
';
}
}
$actions[] = '
';
}
}
if ( ( $status == 'carried_out' && $feedback_status == '' ) || in_array( $status, array('cancelled', 'no_show') ) )
{
$actions[] = '
' . wp_kses_post( __('Revert To Pending', 'propertyhive') ) . '';
}
$actions = apply_filters( 'propertyhive_admin_viewing_actions', $actions, $post_id );
$actions = apply_filters( 'propertyhive_admin_post_actions', $actions, $post_id );
if ( !empty($actions) )
{
echo implode("", $actions);
}
else
{
echo '
' . wp_kses_post( __( 'No actions to display', 'propertyhive' ) ) . '
';
}
echo '
';
// Success action panel
echo '