protected function addRow(Gpf_Rpc_Form $form, Gpf_DbEngine_RowBase $row) {
     $newCampaign = new Pap_Db_Campaign();
     $newCampaign->setAccountId($row->get(Pap_Db_Table_Campaigns::ACCOUNTID));
     $newCampaign->setIsDefault();
     try {
         $newCampaign->loadFromData(array(Pap_Db_Table_Campaigns::ACCOUNTID,Pap_Db_Table_Campaigns::IS_DEFAULT));
     } catch (Gpf_DbEngine_NoRowException $e){
         $row->set(Pap_Db_Table_Campaigns::IS_DEFAULT,Gpf::YES);
     }
     $row->insert();
 }
    /**
     * @param $params
     * @param $row
     * @param $primaryKeyName
     * @param $baseAttributes
     */
    private function getResponse(Gpf_Rpc_Params $params, Gpf_DbEngine_RowBase $row, $primaryKeyName, array $baseAttributes = null) {
    	$this->visitorId = $params->get('visitorId');

        $response = new Gpf_Rpc_Data();
        if ($this->visitorId == '') {
            return $response;
        }
        $this->setAccountId($params->get('accountId'));
        
        $this->processAllVisitorVisits();
        if (($visitorAffiliate = $this->getCurrentVisitorAffiliate()) == null) {
            return $response;
        }  
              
    	if (is_null($baseAttributes)) {
    		$baseAttributes = array($primaryKeyName);
    	}
    	$row->set($primaryKeyName, $visitorAffiliate->get($primaryKeyName));
        try {
            $row->load();
        } catch (Gpf_Exception $e) {
            return $response;
        }
        if (Gpf_Session::getAuthUser()->hasPrivilege('click', 'write')) {
            foreach ($row->getAttributes() as $name => $value) {
                $response->setValue($name, $value);
            }
        } else {
        	foreach ($baseAttributes as $attribute) {
            	$response->setValue($attribute, $row->get($attribute));
        	}
        }
        return $response;
    }
 protected function getAndSetRType(Gpf_Rpc_Form $form, Gpf_DbEngine_RowBase $dbRow) {
     if ($form->existsField(Pap_Db_Table_Transactions::R_TYPE)) {
         $rtype = $form->getFieldValue(Pap_Db_Table_Transactions::R_TYPE);
         $form->setField(Pap_Db_Table_Transactions::R_TYPE, $rtype);
         $dbRow->set(Pap_Db_Table_Transactions::R_TYPE, $rtype);
         return;
     }
     try {
         $commType = $form->getFieldValue(Pap_Db_Table_Transactions::COMMISSIONTYPEID);
         $commTypeObj = $this->getCommType($commType);
         $rtype = $commTypeObj->getType();
     } catch (Gpf_Data_RecordSetNoRowException $e) {
         if ($form->existsField(Pap_Db_Table_Transactions::COMMISSIONTYPEID)) {
             $rtype = $form->getFieldValue(Pap_Db_Table_Transactions::COMMISSIONTYPEID);
         }
     } catch (Gpf_DbEngine_NoRowException $e) {
         if ($form->existsField(Pap_Db_Table_Transactions::COMMISSIONTYPEID)) {
             $rtype = $form->getFieldValue(Pap_Db_Table_Transactions::COMMISSIONTYPEID);
         }
     }
     $form->setField(Pap_Db_Table_Transactions::R_TYPE, $rtype);
     $dbRow->set(Pap_Db_Table_Transactions::R_TYPE, $rtype);
 }