original_string: public static function update_request_status($requestid, $status, $dpoid = 0, $comment = '') {
          // Update the request.
          $datarequest = new data_request($requestid);
          $datarequest->set('status', $status);
          if ($dpoid) {
              $datarequest->set('dpo', $dpoid);
          }
          // Update the comment if necessary.
          if (!empty(trim($comment))) {
              $params = [
                  'date' => userdate(time()),
                  'comment' => $comment
              ];
              $commenttosave = get_string('datecomment', 'tool_dataprivacy', $params);
              // Check if there's an existing DPO comment.
              $currentcomment = trim($datarequest->get('dpocomment'));
              if ($currentcomment) {
                  // Append the new comment to the current comment and give them 1 line space in between.
                  $commenttosave = $currentcomment . PHP_EOL . PHP_EOL . $commenttosave;
              }
              $datarequest->set('dpocomment', $commenttosave);
          }
  
          return $datarequest->update();
      }
code: public static function update_request_status($requestid, $status, $dpoid = 0, $comment = '') {
          // Update the request.
          $datarequest = new data_request($requestid);
          $datarequest->set('status', $status);
          if ($dpoid) {
              $datarequest->set('dpo', $dpoid);
          }
          // Update the comment if necessary.
          if (!empty(trim($comment))) {
              $params = [
                  'date' => userdate(time()),
                  'comment' => $comment
              ];
              $commenttosave = get_string('datecomment', 'tool_dataprivacy', $params);
              // Check if there's an existing DPO comment.
              $currentcomment = trim($datarequest->get('dpocomment'));
              if ($currentcomment) {
                  // Append the new comment to the current comment and give them 1 line space in between.
                  $commenttosave = $currentcomment . PHP_EOL . PHP_EOL . $commenttosave;
              }
              $datarequest->set('dpocomment', $commenttosave);
          }
  
          return $datarequest->update();
      }
code_tokens: public static function update_request_status ( $ requestid , $ status , $ dpoid = 0 , $ comment = '' ) { // Update the request. $ datarequest = new data_request ( $ requestid ) ; $ datarequest -> set ( 'status' , $ status ) ; if ( $ dpoid ) { $ datarequest -> set ( 'dpo' , $ dpoid ) ; } // Update the comment if necessary. if ( ! empty ( trim ( $ comment ) ) ) { $ params = [ 'date' => userdate ( time ( ) ) , 'comment' => $ comment ] ; $ commenttosave = get_string ( 'datecomment' , 'tool_dataprivacy' , $ params ) ; // Check if there's an existing DPO comment. $ currentcomment = trim ( $ datarequest -> get ( 'dpocomment' ) ) ; if ( $ currentcomment ) { // Append the new comment to the current comment and give them 1 line space in between. $ commenttosave = $ currentcomment . PHP_EOL . PHP_EOL . $ commenttosave ; } $ datarequest -> set ( 'dpocomment' , $ commenttosave ) ; } return $ datarequest -> update ( ) ; }
docstring: Cancels the data request for a given request ID.
  
  @param int $requestid The request identifier.
  @param int $status The request status.
  @param int $dpoid The user ID of the Data Protection Officer
  @param string $comment The comment about the status update.
  @return bool
  @throws invalid_persistent_exception
  @throws coding_exception
docstring_tokens: Cancels the data request for a given request ID .