/** * Create a manual-entry submission * * @param SrcResponseSet $rec * @param Project $prj * @param string $dsc * @param string $txt * @return Doctrine_Record $rec */ private function _create_manual_submission($prj, $typ, $dsc, $txt) { $src_id = $this->parent_rec->src_id; $rec = new SrcResponseSet(); $rec->srs_src_id = $src_id; // just-in-time inquiry (does NOT require the usual WRITE authz) $inq = $prj->get_manual_entry_inquiry(); // debug help //$remote_user = air2_get_remote_user(); //Carper::carp(sprintf("create manual submission for inquiry %s by user %s", $inq->inq_uuid, $remote_user->user_username)); $rec->srs_inq_id = $inq->inq_id; $rec->srs_type = SrcResponseSet::$TYPE_MANUAL_ENTRY; // entry type (the answer to the first question) $def = Inquiry::$MANUAL_TYPES[$typ]; $rec->SrcResponse[0]->sr_src_id = $src_id; $rec->SrcResponse[0]->sr_ques_id = $inq->Question[0]->ques_id; $rec->SrcResponse[0]->sr_orig_value = $def['label']; // entry description and text (the next 2 questions) $rec->SrcResponse[1]->sr_src_id = $src_id; $rec->SrcResponse[1]->sr_ques_id = $inq->Question[1]->ques_id; $rec->SrcResponse[1]->sr_orig_value = $dsc; $rec->SrcResponse[2]->sr_src_id = $src_id; $rec->SrcResponse[2]->sr_ques_id = $inq->Question[2]->ques_id; $rec->SrcResponse[2]->sr_orig_value = $txt; // setup to log a src_activity post-insert SrcResponseSet::$LOG_MANUAL_ENTRY = true; return $rec; }