AntonLV 10 лет назад
Родитель
Сommit
fcf2bfc14f

+ 13 - 7
modules/boonex/invites/classes/BxInvModule.php

@@ -196,17 +196,19 @@ class BxInvModule extends BxDolModule
 
     /**
      * Perform neccessary checking on join form
-     * @return empty string - if join is allowed and shoulb be processed as usual, non-empty string - if join form need to be replaced with this code
+     * @return empty string - if join is allowed and should be processed as usual, non-empty string - if join form need to be replaced with this code
      */
 	public function serviceAccountAddFormCheck()
 	{
+	    $sReturn = '';
     	if (!$this->_oConfig->isRegistrationByInvitation())
-    		return '';
+    		return $sReturn;
 
     	$oSession = BxDolSession::getInstance();
-
 		$sKeyCode = $this->_oConfig->getKeyCode();
-		if (bx_get($sKeyCode) !== false) {
+
+		$bKey = bx_get($sKeyCode) !== false;
+		if($bKey) {
 			$sKey = bx_process_input(bx_get($sKeyCode));
 
         	$oKeys = BxDolKey::getInstance();
@@ -215,10 +217,14 @@ class BxInvModule extends BxDolModule
 		}
 
 		$sKey = $oSession->getValue($sKeyCode);
-		if ($sKey === false)
-			return $this->_oTemplate->getBlockRequest();
+		if($sKey !== false)
+		    return $sReturn;
+
+        if($bKey)
+            $sReturn .= MsgBox(_t('_bx_invites_err_used'));
+        $sReturn .= $this->_oTemplate->getBlockRequest();
 
-		return '';
+        return $sReturn;
 	}
 
 	public function invite($sType, $sEmails, $sText, $mixedLimit = false, $oForm = null)

+ 2 - 2
modules/boonex/invites/classes/BxInvResponse.php

@@ -39,8 +39,8 @@ class BxInvResponse extends BxDolAlertsResponse
     protected function _processAccountAddForm($oAlert)
     {
         $sCode = $this->_oModule->serviceAccountAddFormCheck();
-        if ($sCode)
-            $oAlert->aExtras['form_code'] = $this->_oModule->_oTemplate->getBlockRequest();
+        if($sCode)
+            $oAlert->aExtras['form_code'] = $sCode;
     }
 
     protected function _processAccountAdded($oAlert)

+ 1 - 0
modules/boonex/invites/install/langs/en.xml

@@ -124,4 +124,5 @@
 	<string name="_bx_invites_err_not_available"><![CDATA[The feature is not available now. Please, try again later.]]></string>
 	<string name="_bx_invites_err_invite"><![CDATA[Cannot send an invitation on request.]]></string>
 	<string name="_bx_invites_err_delete_request"><![CDATA[Cannot delete the request.]]></string>
+	<string name="_bx_invites_err_used"><![CDATA[The invitation link isn't available or already used.]]></string>
 </resources>

+ 1 - 0
modules/boonex/russian/data/langs/bx_invites/ru.xml

@@ -124,4 +124,5 @@
 	<string name="_bx_invites_err_not_available"><![CDATA[Эта функция сейчас недоступна. Пожалуйста, попытайтесь ещё раз позднее.]]></string>
 	<string name="_bx_invites_err_invite"><![CDATA[Невозможно послать приглашение по запросу.]]></string>
 	<string name="_bx_invites_err_delete_request"><![CDATA[Невозможно удалить запрос.]]></string>
+	<string name="_bx_invites_err_used"><![CDATA[Приглашение не доступно или уже использовано.]]></string>
 </resources>