|
|
@ -46,7 +46,7 @@ function fulcrm_webhook_get_pk_for_entity_type( $entity_type, $entity_id, $fulcr
|
|
|
|
return $result->fetchField();
|
|
|
|
return $result->fetchField();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function fulcrm_webhook_set_mapping( $entity_type, $bundle, $entity_id, $fulcrm_type, $fulcrm_pk ) {
|
|
|
|
function fulcrm_webhook_set_entity_mapping( $entity_type, $bundle, $entity_id, $fulcrm_type, $fulcrm_pk ) {
|
|
|
|
db_merge( 'fulcrm_webhook_entity_mapping' )
|
|
|
|
db_merge( 'fulcrm_webhook_entity_mapping' )
|
|
|
|
->key( array( 'entity_type' => $entity_type,
|
|
|
|
->key( array( 'entity_type' => $entity_type,
|
|
|
|
'bundle' => $bundle,
|
|
|
|
'bundle' => $bundle,
|
|
|
@ -110,12 +110,12 @@ function fulcrm_webhook_createupdate_entity( $data ) {
|
|
|
|
$function( $return );
|
|
|
|
$function( $return );
|
|
|
|
|
|
|
|
|
|
|
|
if ( array_key_exists( 'entity', $return ) ) {
|
|
|
|
if ( array_key_exists( 'entity', $return ) ) {
|
|
|
|
db_insert( 'fulcrm_webhook_entity_mapping' )->fields( array( 'fulcrm_type' => $fulcrm_type,
|
|
|
|
fulcrm_webhook_set_entity_mapping( $fulcrm_type = $fulcrm_type,
|
|
|
|
'fulcrm_pk' => $fulcrm_pk,
|
|
|
|
$fulcrm_pk = $fulcrm_pk,
|
|
|
|
'entity_type' => $return[ 'entity_type' ],
|
|
|
|
$entity_type = $return[ 'entity_type' ],
|
|
|
|
'bundle' => array_key_exists( 'bundle', $return ) ? $return[ 'bundle' ] : $return[ 'entity_type' ],
|
|
|
|
$bundle = array_key_exists( 'bundle', $return ) ? $return[ 'bundle' ] : $return[ 'entity_type' ],
|
|
|
|
'entity_id' => $return[ 'entity_id' ],
|
|
|
|
$entity_id = $return[ 'entity_id' ],
|
|
|
|
) )->execute();
|
|
|
|
);
|
|
|
|
return $return;
|
|
|
|
return $return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|