public function resubmit_request() : data_request {
        if ($this->is_active()) {
            $this->set('status', api::DATAREQUEST_STATUS_REJECTED)->save();
        }

        if (!$this->is_resettable()) {
            throw new \moodle_exception('cannotreset', 'tool_dataprivacy');
        }

        $currentdata = $this->to_record();
        unset($currentdata->id);

        // Clone the original request, but do not notify.
        $clone = api::create_data_request(
                $this->get('userid'),
                $this->get('type'),
                $this->get('comments'),
                $this->get('creationmethod'),
                false
            );
        $clone->set('comments', $this->get('comments'));
        $clone->set('dpo', $this->get('dpo'));
        $clone->set('requestedby', $this->get('requestedby'));
        $clone->save();

        return $clone;
    }
public function resubmit_request() : data_request {
        if ($this->is_active()) {
            $this->set('status', api::DATAREQUEST_STATUS_REJECTED)->save();
        }

        if (!$this->is_resettable()) {
            throw new \moodle_exception('cannotreset', 'tool_dataprivacy');
        }

        $currentdata = $this->to_record();
        unset($currentdata->id);

        // Clone the original request, but do not notify.
        $clone = api::create_data_request(
                $this->get('userid'),
                $this->get('type'),
                $this->get('comments'),
                $this->get('creationmethod'),
                false
            );
        $clone->set('comments', $this->get('comments'));
        $clone->set('dpo', $this->get('dpo'));
        $clone->set('requestedby', $this->get('requestedby'));
        $clone->save();

        return $clone;
    }
public function resubmit_request ( ) : data_request { if ( $ this -> is_active ( ) ) { $ this -> set ( 'status' , api :: DATAREQUEST_STATUS_REJECTED ) -> save ( ) ; } if ( ! $ this -> is_resettable ( ) ) { throw new \ moodle_exception ( 'cannotreset' , 'tool_dataprivacy' ) ; } $ currentdata = $ this -> to_record ( ) ; unset ( $ currentdata -> id ) ; // Clone the original request, but do not notify. $ clone = api :: create_data_request ( $ this -> get ( 'userid' ) , $ this -> get ( 'type' ) , $ this -> get ( 'comments' ) , $ this -> get ( 'creationmethod' ) , false ) ; $ clone -> set ( 'comments' , $ this -> get ( 'comments' ) ) ; $ clone -> set ( 'dpo' , $ this -> get ( 'dpo' ) ) ; $ clone -> set ( 'requestedby' , $ this -> get ( 'requestedby' ) ) ; $ clone -> save ( ) ; return $ clone ; }
Reject this request and resubmit it as a fresh request.

Note: This does not check whether any other completed requests exist for this user.

@return  self
Reject this request and resubmit it as a fresh request .