bug in looping thru portal-lines

There is a bug when you are looping thru portal-lines

You can reproduce it in the CRm too:

goto Orderdetails and add about 30 extra lines to the order-portal
now place (in designer mode) an extra field in de orderportal: company_id.
Otherwise you won’t see what happens.

Before you go any further you have to quit Servoy and start Servoy again. Now go the same Orderdetail and click on the little red-button: change companyid. Now you see, that not all of the portal-lines are updated! If you try for the second time, than it works right!

bug confirmed.

This is a solution bug NOT a Servoy issue, getMaxRecordIndex() should never be done outside the the loop.

Example: (correct JavaScript code for crm method)
for ( var i = 1 ; i <= forms.orderDetails.elements.portalLineItems.getMaxRecordIndex() ; i++ )
{
forms.orderDetails.elements.portalLineItems.recordIndex = i;
forms.orderDetails.orders_to_line_items.company_id = companiesid;
}