Patch for adding LOCKED flag to database

This is a patch for adding the LOCKED flag to database when new unit is
added by a lecturer. There was an error with brackets in previous
commit.