#--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<#macro renderSurveyQuestionText surveyQuestionAndAppl>
Unsupported question type : ${surveyQuestionAndAppl.surveyQuestionTypeId}
#if>
#macro>
<#if additionalFields?has_content>
<#list additionalFields.keySet() as field>
#list>
#if>
<#-- update response -->
<#if surveyResponseId?has_content>
#if>
<#-- party ID -->
<#if partyId?has_content>
#if>
<#-- survey ID -->
${survey.description?if_exists}
<#if survey.comments?has_content>
${survey.comments}
#if>
<#assign lastSurveyMultiRespId = ""/>
<#assign haveOpenMultiRespHeader = false/>
<#list surveyQuestionAndAppls as surveyQuestionAndAppl>
<#if !alreadyShownSqaaPkWithColId.contains(surveyQuestionAndAppl.getPrimaryKey())>
<#-- Get and setup MultiResp info for this question -->
<#assign openMultiRespHeader = false/>
<#assign closeMultiRespHeader = false/>
<#assign surveyMultiResp = surveyQuestionAndAppl.getRelatedOneCache("SurveyMultiResp")?if_exists/>
<#if surveyMultiResp?has_content>
<#assign surveyMultiRespColumnList = surveyMultiResp.getRelatedCache("SurveyMultiRespColumn", Static["org.ofbiz.base.util.UtilMisc"].toList("sequenceNum"))/>
<#if lastSurveyMultiRespId == "">
<#assign openMultiRespHeader = true/>
<#elseif lastSurveyMultiRespId != surveyMultiResp.surveyMultiRespId>
<#assign openMultiRespHeader = true/>
<#assign closeMultiRespHeader = true/>
#if>
<#assign lastSurveyMultiRespId = surveyMultiResp.surveyMultiRespId/>
<#else/>
<#if lastSurveyMultiRespId?has_content><#assign closeMultiRespHeader = true/>#if>
<#assign lastSurveyMultiRespId = ""/>
#if>
<#-- this is before the rest because it will be done if the current row is not a MultiResp (or is different MultiResp) but the last row was... -->
<#if closeMultiRespHeader>
<#assign haveOpenMultiRespHeader = false/>
<#list surveyMultiRespColumnList as surveyMultiRespColumn>
<#--
if there is a surveyMultiRespColId on the surveyQuestionAndAppl use the corresponding surveyQuestionId;
these should be in the same order as the surveyQuestionAndAppls List, so just see if it matches the first in the list
-->
<#if sqaaWithColIdList?has_content><#assign nextSqaaWithColId = sqaaWithColIdList?first/><#else/><#assign nextSqaaWithColId = []>#if>
<#if surveyQuestionAndAppl.surveyMultiRespColId?has_content &&
nextSqaaWithColId?has_content &&
nextSqaaWithColId.surveyMultiRespColId = surveyMultiRespColumn.surveyMultiRespColId>
<#assign dummySqaaWithColId = Static["org.ofbiz.base.util.UtilMisc"].removeFirst(sqaaWithColIdList)/>
<#assign changed = alreadyShownSqaaPkWithColId.add(nextSqaaWithColId.getPrimaryKey())/>
<#assign questionFieldName = "answers_" + nextSqaaWithColId.surveyQuestionId + "_" + surveyMultiRespColumn.surveyMultiRespColId/>
<#else/>
<#assign questionFieldName = "answers_" + surveyQuestionAndAppl.surveyQuestionId + "_" + surveyMultiRespColumn.surveyMultiRespColId/>
#if>
<@renderSurveyQuestionInput surveyQuestionAndAppl=surveyQuestionAndAppl questionFieldName=questionFieldName/>
#if>
#if>
#list>
<#-- one last check for a multi-resp table left open before moving on, will happen if last question was in a multi-resp -->
<#if haveOpenMultiRespHeader>