<?php
	function fo3_migrate_job_custom_recipients( $db , $job_id , $oldid ) {
		$query = sprintf( "select * from fo_offer_custom where offerid=%d and userid in (select id from fo_user)" , $oldid );
		$data = FNTH_db_get_resultset( $query , $db );
		if (empty( $data )) return;
		$member = new MemberModel();
		foreach ($data as $row) {
			$member_id = $member->getMemberIdFromOldid( $row["userid"] );
			if (!$member_id) continue;
			$ins = array();
			$ins["job_id"]=$job_id;
			$ins["member_id"]=sprintf( "sp_get_member_id_from_oldid( %d )" , $row["userid"] );
			FNTH_db_free_result( FNTH_db_query( FNTH_db_generate_insert_query( "job_custom_recipients" , $ins ) ) );
		}
	}

?>
