<?php
function Contacts_AsignarCuenta($entity) {
	global $adb, $current_user, $request;

	$data = $entity->data;
    if(!empty($_REQUEST) && !$_REQUEST['relationOperation'])
    {
        $accountId = explode("x",$data['account_id'])[1];
        $contactId = explode("x",$data['id'])[1];

        $adb->pquery("INSERT INTO vtiger_crmentityrel values (?,?,?,?)",[$accountId,'Accounts',$contactId,'Contacts']);
    }
}