|
|
@ -46,6 +46,20 @@ function fulcrm_webhook_get_pk_for_entity_type( $entity_type, $entity_id, $fulcr
|
|
|
|
return $result->fetchField();
|
|
|
|
return $result->fetchField();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function fulcrm_webhook_load_entity_for_url( $url ) {
|
|
|
|
|
|
|
|
$fulcrm_type = fulcrm_apiv2_url_to_type( $url );
|
|
|
|
|
|
|
|
$fulcrm_pk = fulcrm_apiv2_url_to_pk( $url );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$query = db_select( 'fulcrm_webhook_entity_mapping', 'fwem' )
|
|
|
|
|
|
|
|
->fields( 'fwem', array( 'entity_type', 'entity_id' ) )
|
|
|
|
|
|
|
|
->condition( 'fulcrm_type', $fulcrm_type )
|
|
|
|
|
|
|
|
->condition( 'fulcrm_pk', $fulcrm_pk );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$result = $query->execute();
|
|
|
|
|
|
|
|
foreach ( $result as $row )
|
|
|
|
|
|
|
|
return entity_load( $row->entity_type, array( $row->entity_id ) )[ $row->entity_id ];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function fulcrm_webhook_createupdate_entity( $data ) {
|
|
|
|
function fulcrm_webhook_createupdate_entity( $data ) {
|
|
|
|
$return = array( 'data' => $data );
|
|
|
|
$return = array( 'data' => $data );
|
|
|
|
|
|
|
|
|
|
|
|