<?php

	function fo3_migrate_job_servicetypes( $db , $job_id , $oldid ) {
		$query = sprintf( "select * from fo_offer_servicetypes where offerid=%d" , $oldid );
		$data = FNTH_db_get_resultset( $query , $db );
		if (empty( $data )) {
			$ins = array();
			$ins["job_id"]=$job_id;
			$ins["servicetype_id"]=1;
			$ins["servicetype_unit_id"]=1;
			$ins["quantity"]=1;
			FNTH_db_free_result( FNTH_db_query( FNTH_db_generate_insert_query( "job_servicetypes" , $ins ) ) );
			return;
		}

		foreach ($data as $row) {
			$ins = array();
			$ins["job_id"]=$job_id;
			$ins["servicetype_id"]=$row["servicetype_id"];
			FNTH_db_free_result( FNTH_db_query( FNTH_db_generate_insert_query( "job_servicetypes" , $ins ) ) );
		}
	}
?>
