Author: jacopoc
Date: Sat May 19 00:34:04 2007 New Revision: 539708 URL: http://svn.apache.org/viewvc?view=rev&rev=539708 Log: Fixed bug reported by Krzysztof Podejma, with a different patch from the one provided in OFBIZ-989 Modified: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/visit/showvisits.bsh ofbiz/trunk/applications/party/webapp/partymgr/visit/showvisits.ftl Modified: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/visit/showvisits.bsh URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/visit/showvisits.bsh?view=diff&rev=539708&r1=539707&r2=539708 ============================================================================== --- ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/visit/showvisits.bsh (original) +++ ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/visit/showvisits.bsh Sat May 19 00:34:04 2007 @@ -52,12 +52,12 @@ visitListIt = delegator.findListIteratorByCondition("Visit", new EntityExpr("thruDate", EntityOperator.EQUALS, null), null, null, sortList, new EntityFindOptions(true, EntityFindOptions.TYPE_SCROLL_INSENSITIVE, EntityFindOptions.CONCUR_READ_ONLY, true)); } - viewIndex = 0; + viewIndex = 1; viewSize = 20; try { viewIndex = Integer.valueOf((String) parameters.get("VIEW_INDEX")).intValue(); } catch (Exception e) { - viewIndex = 0; + viewIndex = 1; } context.put("viewIndex", viewIndex); @@ -67,20 +67,24 @@ viewSize = 20; } context.put("viewSize", viewSize); - - lowIndex = viewIndex * viewSize; - highIndex = (viewIndex + 1) * viewSize; - + + // get the indexes for the partial list + lowIndex = (((viewIndex - 1) * viewSize) + 1); + highIndex = viewIndex * viewSize; + + // get the partial list for this page + visitList = visitListIt.getPartialList(lowIndex, viewSize); + if (visitList == null) { + visitList = new ArrayList(); + } + // attempt to get the full size visitListIt.last(); - visitSize = visitListIt.currentIndex(); - context.put("visitSize", visitSize); - visitListIt.first(); - - visitList = new ArrayList(); - if (visitSize > 0) { - visitList = visitListIt.getPartialList(lowIndex + 1, viewSize + 1); + visitListSize = visitListIt.currentIndex(); + if (highIndex > visitListSize) { + highIndex = visitListSize; } + context.put("visitSize", visitListSize); visitListIt.close(); } catch (GenericEntityException e) { Modified: ofbiz/trunk/applications/party/webapp/partymgr/visit/showvisits.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/visit/showvisits.ftl?view=diff&rev=539708&r1=539707&r2=539708 ============================================================================== --- ofbiz/trunk/applications/party/webapp/partymgr/visit/showvisits.ftl (original) +++ ofbiz/trunk/applications/party/webapp/partymgr/visit/showvisits.ftl Sat May 19 00:34:04 2007 @@ -29,22 +29,20 @@ <a href="<@ofbizUrl>showvisits?showAll=true</@ofbizUrl>" class="smallSubmit">[${uiLabelMap.PartyShowAll}]</a> </#if> <br/> - <#if visitList?has_content> <div class="align-float"> <b> - <#if 0 < viewIndex> - <a href="<@ofbizUrl>showvisits?VIEW_SIZE=${viewSize}&VIEW_INDEX=${viewIndex-1}<#if sort?has_content>&sort=${sort}</#if><#if partyId?has_content>&partyId=${partyId}</#if>&showAll=${showAll}</@ofbizUrl>" class="smallSubmit">${uiLabelMap.CommonPrevious}</a> | - </#if> - <#if 0 < listSize> - ${lowIndex+1} - ${highIndex} ${uiLabelMap.CommonOf} ${visitSize} - </#if> - <#if highIndex < listSize> - | <a href="<@ofbizUrl>showvisits?VIEW_SIZE=${viewSize}&VIEW_INDEX=${viewIndex+1}<#if sort?has_content>&sort=${sort}</#if><#if partyId?has_content>&partyId=${partyId}</#if>&showAll=${showAll}</@ofbizUrl>" class="smallSubmit">${uiLabelMap.CommonNext}</a> + <#if (visitSize > 0)> + <#if (viewIndex > 1)> + <a href="<@ofbizUrl>showvisits?VIEW_SIZE=${viewSize}&VIEW_INDEX=${viewIndex-1}<#if sort?has_content>&sort=${sort}</#if><#if partyId?has_content>&partyId=${partyId}</#if>&showAll=${showAll}</@ofbizUrl>" class="smallSubmit">${uiLabelMap.CommonPrevious}</a> | + </#if> + ${lowIndex} - ${highIndex} ${uiLabelMap.CommonOf} ${visitSize} + <#if highIndex < visitSize> + | <a href="<@ofbizUrl>showvisits?VIEW_SIZE=${viewSize}&VIEW_INDEX=${viewIndex+1}<#if sort?has_content>&sort=${sort}</#if><#if partyId?has_content>&partyId=${partyId}</#if>&showAll=${showAll}</@ofbizUrl>" class="smallSubmit">${uiLabelMap.CommonNext}</a> + </#if> </#if> </b> </div> <br class="clear" /> - </#if> <br/> <table class="basic-table" cellspacing="0"> @@ -82,20 +80,18 @@ </#list> </table> - <#if visitList?has_content> <br /> <div class="align-float"> <b> - <#if 0 < viewIndex> - <a href="<@ofbizUrl>showvisits?VIEW_SIZE=${viewSize}&VIEW_INDEX=${viewIndex-1}<#if sort?has_content>&sort=${sort}</#if><#if partyId?has_content>&partyId=${partyId}</#if>&showAll=${showAll}</@ofbizUrl>" class="smallSubmit">${uiLabelMap.CommonPrevious}</a> | - </#if> - <#if 0 < listSize> - ${lowIndex+1} - ${highIndex} ${uiLabelMap.CommonOf} ${visitSize} - </#if> - <#if highIndex < listSize> - | <a href="<@ofbizUrl>showvisits?VIEW_SIZE=${viewSize}&VIEW_INDEX=${viewIndex+1}<#if sort?has_content>&sort=${sort}</#if><#if partyId?has_content>&partyId=${partyId}</#if>&showAll=${showAll}</@ofbizUrl>" class="smallSubmit">${uiLabelMap.CommonNext}</a> + <#if (visitSize > 0)> + <#if (viewIndex > 1)> + <a href="<@ofbizUrl>showvisits?VIEW_SIZE=${viewSize}&VIEW_INDEX=${viewIndex-1}<#if sort?has_content>&sort=${sort}</#if><#if partyId?has_content>&partyId=${partyId}</#if>&showAll=${showAll}</@ofbizUrl>" class="smallSubmit">${uiLabelMap.CommonPrevious}</a> | + </#if> + ${lowIndex} - ${highIndex} ${uiLabelMap.CommonOf} ${visitSize} + <#if highIndex < visitSize> + | <a href="<@ofbizUrl>showvisits?VIEW_SIZE=${viewSize}&VIEW_INDEX=${viewIndex+1}<#if sort?has_content>&sort=${sort}</#if><#if partyId?has_content>&partyId=${partyId}</#if>&showAll=${showAll}</@ofbizUrl>" class="smallSubmit">${uiLabelMap.CommonNext}</a> + </#if> </#if> </b> </div> <br class="clear" /> - </#if> |
Free forum by Nabble | Edit this page |