<?php

///////////////////////////////////////////////////////////////////////////////////////////////////
// GETS SUPPLIER SERVICES DETAILS - AND STORES THE INFOS IN MEMORY ////////////////////////////////
// returns: productName, serviceCode, /////////////////////////////////////////////////////////////
// deleted: '0' (not deleted), 1 (deleted), 2 (all) ///////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
function getSupplierProductDetails($idSupplierProduct){

	global $VALUES, $db, $DBTSuppliersProducts;

	// if no customer id
	if (!$idSupplierProduct) return;

	// if values already extracted - get them from memory
	if ($VALUES['suppliersServicesDetails'][$idSupplierProduct])
		return $VALUES['suppliersServicesDetails'][$idSupplierProduct];

	// get supplier service details
	$getSupplierProductSQL="SELECT productName, category, serviceCode, destinationCountryCode, destinationCityId FROM `$DBTSuppliersProducts` WHERE id='".$idSupplierProduct."'";
	$getSupplierProductArr=$db->GetRow($getSupplierProductSQL);

	// test sql
	if (!is_array($getSupplierProductArr)) {
		writeLog("Supplier service details could not be retrieved. SQL: ".$getSupplierProductSQL, 'events', 10);
		return;
	}

	// associate fields
	$VALUES['suppliersServicesDetails'][$idSupplierProduct]['productName']=$getSupplierProductArr['productName'];
	$VALUES['suppliersServicesDetails'][$idSupplierProduct]['serviceCode']=$getSupplierProductArr['serviceCode'];
	$VALUES['suppliersServicesDetails'][$idSupplierProduct]['destinationCountryCode']=$getSupplierProductArr['destinationCountryCode'];
	$VALUES['suppliersServicesDetails'][$idSupplierProduct]['destinationCityId']=$getSupplierProductArr['destinationCityId'];
	$VALUES['suppliersServicesDetails'][$idSupplierProduct]['category']=$getSupplierProductArr['category'];

	return $VALUES['suppliersServicesDetails'][$idSupplierProduct];

}

