src/bbn/appui/tasks.php
public function stop_track($id_task, $message = false, $id_user = false){
    $ok = false;
    $now = time();
    if (
      ($active_track = $this->get_active_track($id_user)) &&
      ($active_track['id_task'] === $id_task)
    ){
      $ok = true;
      if (
        !empty($message) &&
        !($id_note = $this->comment($id_task, [
          'title' => _('Report tracker').' '.date('d M Y H:i', strtotime($active_track['start'])).' - '.date('d M Y H:i', $now),
          'text' => $message
        ]))
      ){
        $ok = false;
      }
      if ( $ok ){
        $ok = $this->db->update('bbn_tasks_sessions', [
          'length' => $now - strtotime($active_track['start']),
          'id_note' => $id_note ?: NULL
        ], [
          'id' => $active_track['id']
        ]);
      }
    }
    return (bool)$ok;
  }
public function stop_track($id_task, $message = false, $id_user = false){
    $ok = false;
    $now = time();
    if (
      ($active_track = $this->get_active_track($id_user)) &&
      ($active_track['id_task'] === $id_task)
    ){
      $ok = true;
      if (
        !empty($message) &&
        !($id_note = $this->comment($id_task, [
          'title' => _('Report tracker').' '.date('d M Y H:i', strtotime($active_track['start'])).' - '.date('d M Y H:i', $now),
          'text' => $message
        ]))
      ){
        $ok = false;
      }
      if ( $ok ){
        $ok = $this->db->update('bbn_tasks_sessions', [
          'length' => $now - strtotime($active_track['start']),
          'id_note' => $id_note ?: NULL
        ], [
          'id' => $active_track['id']
        ]);
      }
    }
    return (bool)$ok;
  }
public function stop_track ( $ id_task , $ message = false , $ id_user = false ) { $ ok = false ; $ now = time ( ) ; if ( ( $ active_track = $ this -> get_active_track ( $ id_user ) ) && ( $ active_track [ 'id_task' ] === $ id_task ) ) { $ ok = true ; if ( ! empty ( $ message ) && ! ( $ id_note = $ this -> comment ( $ id_task , [ 'title' => _ ( 'Report tracker' ) . ' ' . date ( 'd M Y H:i' , strtotime ( $ active_track [ 'start' ] ) ) . ' - ' . date ( 'd M Y H:i' , $ now ) , 'text' => $ message ] ) ) ) { $ ok = false ; } if ( $ ok ) { $ ok = $ this -> db -> update ( 'bbn_tasks_sessions' , [ 'length' => $ now - strtotime ( $ active_track [ 'start' ] ) , 'id_note' => $ id_note ? : NULL ] , [ 'id' => $ active_track [ 'id' ] ] ) ; } } return ( bool ) $ ok ; }
Stops a track.

@param  string  $id_task The task's ID
@param  boolean|string $message The message to attach to track (optional)
@param  boolean|string $id_user The track's user. If you give 'false', it will use the current user
@return boolean
Stops a track .