add create and send functions

master
Marek Isalski 4 years ago
parent a154a1236d
commit 49e4c63cea

@ -58,3 +58,28 @@ function fulcrm_mailshot_theme( $existing, $type, $theme, $path ) {
), ),
); );
} }
function fulcrm_mailshot_create_mailshot( $person, $recipient, $campaign_id, $d, $is_system = false, $content_object = null, $to_header = null ) {
if ( is_null( $to_header ) )
$to_header = $recipient;
$data = array( 'person' => $person,
'recipient' => $recipient,
'campaign' => '/api/v2/campaign/' . $campaign_id . '/',
'to_header' => $to_header,
'is_system' => ( $is_system ? true : false ),
'd' => $d,
);
if ( !is_null( $content_object ) )
$data[ 'content_object' ] = $content_object;
$api_data = fulcrm_apiv2_POST( 'mailshot/',
$data = $data,
$query = array( 'expand' => 'd' ),
);
if ( $api_data[ 'success' ] )
return $api_data[ 'headers' ][ 'Location' ];
}
function fulcrm_mailshot_send_mailshot( $mailshot ) {
$api_data = fulcrm_apiv2_POST( $mailshot . 'send/' );
return $api_data[ 'success' ];
}

Loading…
Cancel
Save