Mercurial > lada > lada-client
changeset 992:77ea9a5c5f1d
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
author | Dustin Demuth <dustin@intevation.de> |
---|---|
date | Thu, 07 Jan 2016 10:59:46 +0100 |
parents | 19b78162e128 |
children | f9449df5f9fb 092e245b13a4 |
files | app/controller/grid/Status.js |
diffstat | 1 files changed, 12 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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