diff --git a/modules/CmpdReg/src/client/custom/configuration.json b/modules/CmpdReg/src/client/custom/configuration.json index d653af3bf..012bfeb9d 100755 --- a/modules/CmpdReg/src/client/custom/configuration.json +++ b/modules/CmpdReg/src/client/custom/configuration.json @@ -40,6 +40,7 @@ "disableAliasEdit": false, "showLotInventory": false, "disableEditMyLots": false, + "disableEditMyParents": true, "requireLotNumber": false, "allowManualLotNumber": false, "autoPopulateNextLotNumber": false diff --git a/modules/CmpdReg/src/client/src/MetaLot.js b/modules/CmpdReg/src/client/src/MetaLot.js index 2ae999091..006cdd6c6 100755 --- a/modules/CmpdReg/src/client/src/MetaLot.js +++ b/modules/CmpdReg/src/client/src/MetaLot.js @@ -440,13 +440,22 @@ $(function() { }, parentAllowedToUpdate: function () { - if (!this.allowedToUpdate()) return false; + // Check if disableEditMyParents is defined and true. If its true and the user is not an admin, then we disable the allowed to update feature + if(typeof(window.configuration.metaLot.disableEditMyParents) != "undefined" && window.configuration.metaLot.disableEditMyParents != null && window.configuration.metaLot.disableEditMyParents) { + if (!this.user.get('isAdmin')) return false; + } + // Further check to see if the parent is editable by checking the metalot allowedToUpdate function + if (!this.allowedToUpdate()) return false; - if (this.model.get('lot').isNew() ) { + // If we get here, then just check if the lot is new or not + if (this.model.get('lot').isNew()) { return false; } else { return true; - } + } + + // We shouldn't get here but lets disable edit parent by default to be safe + return false } }); });