Skip to content

Commit

Permalink
fixes #680 add disableEditMyParents option
Browse files Browse the repository at this point in the history
  • Loading branch information
brianbolt committed Apr 21, 2020
1 parent 1309e2c commit 3d39ace
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions modules/CmpdReg/src/client/custom/configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"disableAliasEdit": false,
"showLotInventory": false,
"disableEditMyLots": false,
"disableEditMyParents": true,
"requireLotNumber": false,
"allowManualLotNumber": false,
"autoPopulateNextLotNumber": false
Expand Down
15 changes: 12 additions & 3 deletions modules/CmpdReg/src/client/src/MetaLot.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
});
});

0 comments on commit 3d39ace

Please sign in to comment.