/**
     * Load affiliate detail for affiliate manager
     *
     * @service affiliate read
     * @param $fields
     */
    public function affiliateDetails(Gpf_Rpc_Params $params) {
        $data = new Gpf_Rpc_Data($params);
        $search = $data->getFilters()->getFilter("id");
        if (sizeof($search) == 1) {
            $id = $search[0]->getValue();
        }
        

        $user = new Pap_Affiliates_User();
        $user->setId($id);
        try {
            $user->load();
        } catch (Gpf_DbEngine_NoRowException $e) {
            return $data;
        }
        $data->setValue("id", $user->getId());
        $data->setValue("name", $user->getFirstName()." ".$user->getLastName());
        $data->setValue("username", $user->getUserName());

        $formFields = $this->getUserFormFields();
        foreach($formFields as $record) {
            $code = $record->get('code');
            $data->setValue($code, $user->get($code));
        }

        return $data;
    }