if (!$id) { $new = TRUE; $id = $result = Proposal::insertProposal($properties, $project_id); } else { $new = FALSE; if (!Groups::isOwner(_PROPOSAL_OBJ, $id)) { drupal_set_message(t('You are not the owner of this proposal'), 'error'); $result = null; } else { //If there was no supervisor chosen, at least maintain the orginal one, rather than leave it orphaned if ($properties['supervisor_id'] == 0) { if ($original_supervisor = altSubValue($_POST, 'original_supervisor_id', '')) { $properties['supervisor_id'] = $original_supervisor; } } $result = Proposal::updateProposal($properties, $id); } } if ($result) { // Send out emails to mentor/supervisor once new proposal published // get either the existing proposal key // or the newly inserted proposal key if (is_bool($result)) { //already existed $existed = true; $key = $id; } else { /// newly inserted $existed = false; $key = $result; }