# HG changeset patch # User Dustin Demuth # Date 1452160786 -3600 # Node ID 77ea9a5c5f1dafec53b7240a4a47842e03ae233a # Parent 19b78162e12869f4c69653f92ba675a3ebca94cb Do not clone the Status if the Recent UserID differs from the Recent Status Erzeuger. In addition: Use a Method to determine the recent status which does not require correct ordering of status diff -r 19b78162e128 -r 77ea9a5c5f1d app/controller/grid/Status.js --- a/app/controller/grid/Status.js Mon Dec 28 12:01:47 2015 +0100 +++ b/app/controller/grid/Status.js Thu Jan 07 10:59:46 2016 +0100 @@ -87,13 +87,21 @@ add: function(button) { var lastrow = button.up('statusgrid').store.count() + // retrive current status from the messung. + var s = button.up('window').down('messungform').getRecord().get('status'); + var recentStatus = button.up('statusgrid').store.getById(s); //If possible copy the previous record into the new one. //this assumes the store is ordered correctly, most recent status last. - if (lastrow > 0) { - //clone the old one - var recentStatus = button.up('statusgrid').store.getAt(lastrow-1); - var record = recentStatus.copy() + // Do not copy, if current userid differs from the id of the current status + if (lastrow > 0 && + Ext.Array.contains(Lada.mst, recentStatus.get('erzeuger'))) { + + if (recentStatus) { + // clone the status + var record = recentStatus.copy() + } + record.set('id', null); } else { //create a new one