/** * @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 fillSave(Gpf_Rpc_Form $form, Gpf_DbEngine_RowBase $dbRow) { if ($form->existsField(Gpf_Db_Table_Users::ACCOUNTID) && $form->getFieldValue(Gpf_Db_Table_Users::ACCOUNTID) == '') { $form->setField(Gpf_Db_Table_Users::ACCOUNTID, $dbRow->get(Gpf_Db_Table_Users::ACCOUNTID)); } if ($form->existsField(Gpf_Db_Table_Users::ROLEID) && $form->getFieldValue(Gpf_Db_Table_Users::ROLEID) == '') { $form->setField(Gpf_Db_Table_Users::ROLEID, $dbRow->get(Gpf_Db_Table_Users::ROLEID)); } $oldPassword = $dbRow->getPassword(); $oldUsername = $dbRow->getUsername(); parent::fillSave($form, $dbRow); if (Gpf_Application::isDemo() && $oldUsername == Pap_Branding::DEMO_MERCHANT_USERNAME) { $dbRow->setPassword($oldPassword); $dbRow->setUsername($oldUsername); } }
protected function deleteRow(Gpf_DbEngine_RowBase $row) { $row->delete(); }
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(); }
protected function fillAdd(Gpf_Rpc_Form $form, Gpf_DbEngine_RowBase $dbRow) { if ($form->existsField("dontSendEmail")) { $dbRow->setSendNotification('N' == $form->getFieldValue('dontSendEmail')); } parent::fillAdd($form, $dbRow); }
protected function checkBeforeSave(Gpf_DbEngine_RowBase $row, Gpf_Rpc_Form $form, $operationType = self::EDIT) { $template = new Gpf_Templates_Template($row->getExportRowTemplate(), '', Gpf_Templates_Template::FETCH_TEXT); if (!$template->isValid()) { $form->setErrorMessage($this->_('Invalid Smarty syntax. More information: ') . Gpf_Application::getKnowledgeHelpUrl(Pap_Common_Constants::SMARTY_SYNTAX_URL)); return false; } return true; }
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); }
protected function deleteRow(Gpf_DbEngine_RowBase $row) { $banner = $this->bannerFactory->getBanner($row->getId()); $this->clearRotatorsWithBanner($banner); $banner->delete(); }