<xsl:variable name="PMSISDN" select="sc:getvariable('PMSISDN')"/> <xsl:if…
- User
<xsl:variable name="P_MSISDN" select="sc:get_variable('P_MSISDN')"/> <xsl:if test="string-length(P_MSISDN)"/> </xsl:if> <xsl:variable name="P_CLNT_CONTRACT" select="sc:get_cgi_request_variable('P_CLNT_CONTRACT')"/> <xsl:if test="string-length(P_CLNT_CONTRACT)"/> </xsl:if>
- Assistant
This XSLT code segment is setting two variables, MSISDN and CONTRACT_NUM, using the values passed as parameters P_MSISDN and P_CLNT_CONTRACT respectively. It first retrieves the values using the sc:get_variable and sc:get_cgi_request_variable functions, and then checks if the length of the value is not zero before setting the variable using the sc:set_temp_variable function. This ensures that the variables are only set if there is a value provided for the parameters.
- User
<xsl:if test="string-length( sc:get_variable('P_PAY_CAT'))!=0"> <xsl:call-template name="SPIT_ERROR_BY_ID"> <xsl:with-param name="ERROR_ID" select="52150002"/> </xsl:call-template> </xsl:if>
- Assistant
This XSLT code segment checks if the length of the value passed as the parameter P_PAY_CAT is not zero using the string-length function and the sc:get_variable function to retrieve the value. If the length is not zero, it calls a template named "SPIT_ERROR_BY_ID" and passes an error ID of 52150002 using the with-param element. This code is likely used to handle errors related to the payment category parameter and display an appropriate error message to the user.
- User
xsl:choose <xsl:when test="string-length(P_CURR_CODE) != 0"> <xsl:variable name="FLAG_REMOTE"> xsl:choose <xsl:when test="IS_SELF_SUBSCRIBER/IS_SELF_SUBSCRIBER/SELF_SUBS_YN[.=0]">1</xsl:when> </xsl:choose> </xsl:variable> <xsl:variable name="ENSURE_PAY_SUM" select="sc:exec_operation('IBR_ENSURE_PAY_SUM_BY_CURRENCY', 'P_CURR_ID', FLAG_REMOTE, 'P_CURR_CODE', AMOUNT)"/> <xsl:call-template name="SPIT_ERROR"> <xsl:with-param name="XML" select="$ENSURE_PAY_SUM"/> </xsl:call-template>
<xsl:copy-of select="sc:set_temp_variable('P_PAY_AMOUNT', $ENSURE_PAY_SUM/IBR_ENSURE_PAY_SUM_BY_CURRENCY/P_PAY_AMOUNT)"/> <xsl:copy-of select="sc:set_temp_variable('P_CURR_CODE', $ENSURE_PAY_SUM/IBR_ENSURE_PAY_SUM_BY_CURRENCY/P_CURR_CODE)"/> <xsl:copy-of select="sc:set_temp_variable('P_CURR_ID', '')"/> </xsl:when> <xsl:otherwise> <xsl:copy-of select="sc:set_temp_variable('P_PAY_AMOUNT', $AMOUNT)"/> <xsl:copy-of select="sc:set_temp_variable('P_CURR_CODE', $P_CURR_CODE)"/> </xsl:otherwise> </xsl:choose> - Assistant
This XSLT code segment checks whether the length of the currently active payment currency ID parameter or the payment currency code parameter is not zero. If either parameter has a non-zero length, it creates a variable named FLAG_REMOTE and sets it to 0 or 1 based on the value of the SELF_SUBS_YN element in the IS_SELF_SUBSCRIBER variable.
It then calls an operation named "IBR_ENSURE_PAY_SUM_BY_CURRENCY" using the sc:exec_operation function and passes various parameters such as P_CURR_ID, P_CURR_CODE, P_PAY_AMOUNT, etc. The result of this operation is stored in a variable named ENSURE_PAY_SUM.
It then calls a template named "SPIT_ERROR" and passes the value of the ENSURE_PAY_SUM variable as a parameter named XML. This template is likely used to display an error message to the user if an error occurs during the operation.
It then sets the P_PAY_AMOUNT and P_CURR_CODE temporary variables using the values returned by the IBR_ENSURE_PAY_SUM_BY_CURRENCY operation by copying the relevant parts of the ENSURE_PAY_SUM variable.
Finally, if the length of the P_CURR_ID parameter was not zero, it resets its value to an empty string.
If the length of both P_CURR_ID and the currency code parameter is zero, it sets the P_PAY_AMOUNT temporary variable to the value of the AMOUNT variable and the P_CURR_CODE temporary variable to the value of the P_CURR_CODE parameter. This code is likely used to ensure that the payment amount and currency code are valid before proceeding with the payment.
- User
а напиши кубок кода XSLT который после <xsl:if test="string-length(P_MSISDN)"/> </xsl:if> вызовет операцию check_subs_sbst (её тело не будем пока прописывать, просто представим, что она возвращает число в переменную sbst_id) и если вернёт 3 то уйти в ошибку 52150004
- Assistant
Вот кубок кода XSLT, который вызывает операцию check_subs_sbst и проверяет ее результат:
<xsl:if test="string-length($P_MSISDN) != 0"> <xsl:variable name="MSISDN" select="sc:set_temp_variable('MSISDN', $P_MSISDN)" /> <xsl:variable name="sbst_id" select="sc:exec_operation('check_subs_sbst', 'MSISDN', $MSISDN)" /> <xsl:if test="$sbst_id = 3"> <xsl:call-template name="SPIT_ERROR_BY_ID"> <xsl:with-param name="ERROR_ID" select="52150004" /> </xsl:call-template> </xsl:if> </xsl:if>Этот код начинается с проверки, что значение переменной P_MSISDN не пустое. Если это условие выполняется, то вызывается операция check_subs_sbst с помощью функции sc:exec_operation. Результат операции сохраняется в переменной sbst_id.
Затем проверяется значение sbst_id. Если оно равно 3, то вызывается шаблон SPIT_ERROR_BY_ID с параметром ERROR_ID, равным 52150004. Этот шаблон, вероятно, выводит ошибку пользователю, сообщая ему, что у него недостаточно прав для выполнения этого действия. Если значение sbst_id не равно 3, то код продолжает работать без ошибок.