original_string: public function uniqueForTrackId($trackId, $respTrackId, $previousAppIds)
      {
          if ($previousAppIds) {
              // When unique for all tracks of this type the current track
              // appointment id's should also be excluded.
              $this->uniqueInTrackInstance($previousAppIds);
          }
  
          $sql = "gap_id_appointment NOT IN
                      (SELECT gr2t2a_id_appointment FROM gems__respondent2track2appointment
                          INNER JOIN gems__respondent2track
                              ON gr2t2a_id_respondent_track = gr2t_id_respondent_track
                          WHERE gr2t2a_id_appointment IS NOT NULL AND
                              gr2t_id_track = $trackId";
  
          if ($respTrackId) {
              // Exclude all fields of the current respondent track as it is being recalculated
              // and therefore they may have changed.
              //
              // Instead we filter here on $previousAppIds
              $sql .= " AND NOT (gr2t2a_id_respondent_track = $respTrackId)";
          }
  
          $sql .= ")";
  
          $this->_select->where($sql);
      }
code: public function uniqueForTrackId($trackId, $respTrackId, $previousAppIds)
      {
          if ($previousAppIds) {
              // When unique for all tracks of this type the current track
              // appointment id's should also be excluded.
              $this->uniqueInTrackInstance($previousAppIds);
          }
  
          $sql = "gap_id_appointment NOT IN
                      (SELECT gr2t2a_id_appointment FROM gems__respondent2track2appointment
                          INNER JOIN gems__respondent2track
                              ON gr2t2a_id_respondent_track = gr2t_id_respondent_track
                          WHERE gr2t2a_id_appointment IS NOT NULL AND
                              gr2t_id_track = $trackId";
  
          if ($respTrackId) {
              // Exclude all fields of the current respondent track as it is being recalculated
              // and therefore they may have changed.
              //
              // Instead we filter here on $previousAppIds
              $sql .= " AND NOT (gr2t2a_id_respondent_track = $respTrackId)";
          }
  
          $sql .= ")";
  
          $this->_select->where($sql);
      }
code_tokens: public function uniqueForTrackId ( $ trackId , $ respTrackId , $ previousAppIds ) { if ( $ previousAppIds ) { // When unique for all tracks of this type the current track // appointment id's should also be excluded. $ this -> uniqueInTrackInstance ( $ previousAppIds ) ; } $ sql = "gap_id_appointment NOT IN
                      (SELECT gr2t2a_id_appointment FROM gems__respondent2track2appointment
                          INNER JOIN gems__respondent2track
                              ON gr2t2a_id_respondent_track = gr2t_id_respondent_track
                          WHERE gr2t2a_id_appointment IS NOT NULL AND
                              gr2t_id_track = $trackId" ; if ( $ respTrackId ) { // Exclude all fields of the current respondent track as it is being recalculated // and therefore they may have changed. // // Instead we filter here on $previousAppIds $ sql .= " AND NOT (gr2t2a_id_respondent_track = $respTrackId)" ; } $ sql .= ")" ; $ this -> _select -> where ( $ sql ) ; }
docstring: Add a filter for the appointment id's currently used in tracks with this track id
  
  @param int $trackId The current trrack id
  @param int $respTrackId The current respondent track id or null for new tracks
  @param array $previousAppIds array of gap_id_appointment
docstring_tokens: Add a filter for the appointment id s currently used in tracks with this track id