Пример #1
0
 private function checkConstraints() {
     try{
         $this->check();
     } catch (Gpf_DbEngine_Row_CheckException $e) {
         $exceptions = array();
         foreach ($e as $constraintExeption) {
             if($constraintExeption instanceof Gpf_DbEngine_Row_PasswordConstraintException && $this->accountUser->getRoleId() == Pap_Application::DEFAULT_ROLE_MERCHANT) {
                 continue;
             }
             $exceptions[] = $constraintExeption;
         }
         if(count($exceptions) > 0) {
             throw new Gpf_DbEngine_Row_CheckException($exceptions);
         }
     }
 }
	private function createNotificationsForSale($saleRow) {
		$notificationRegistrationRow = new Gpf_Db_NotificationRegistration();
		$rowCollection = $notificationRegistrationRow->loadCollection();
		foreach ($rowCollection as $notificationRegistrationRow) {
			$accountUserId = $notificationRegistrationRow->getAccountUserId();
			$notificationId = $notificationRegistrationRow->getNotificationId();
			$clientType = $notificationRegistrationRow->getClientType();

			$user = new Gpf_Db_User();
			$user->setId($accountUserId);
			$user->load();
			$isMerchant = $user->getRoleId() == 'pap_merc';

			if ($isMerchant || $accountUserId == $saleRow->get('accountuserid')) {
				$this->addnotification($clientType, $notificationId, $isMerchant, $saleRow);
			}
		}
	}