OEModule\OphCoCvi\components\OphCoCvi_Manager::issueCvi PHP Метод

issueCvi() публичный Метод

Issue the CVI for the given event (recording it as an action performed by the given user id).
public issueCvi ( Event $event, $user_id ) : boolean
$event Event
$user_id
Результат boolean
    public function issueCvi(\Event $event, $user_id)
    {
        // begin transaction
        $transaction = $this->startTransaction();
        try {
            $event->lock();
            $cvi_certificate = $this->generateCviCertificate($event);
            // set the status of the event to complete and assign the PDF to the event
            $info_element = $this->getEventInfoElementForEvent($event);
            $info_element->is_draft = false;
            $info_element->generated_document_id = $cvi_certificate->id;
            $info_element->save();
            $event->info = $this->getStatusText(self::$ISSUED);
            $event->save();
            $event->audit('event', 'cvi-issued', null, 'CVI Issued', array('user_id' => $user_id));
            $transaction->commit();
            $event->unlock();
            return true;
        } catch (\Exception $e) {
            \OELog::log($e->getMessage());
            $transaction->rollback();
        }
        return false;
    }