30. (1) Subject to this section, where an order for periodic detention is in force in respect of a detainee, the court that made the order may, on application by the detainee or the Director, cancel the order if it appears to the court that there are good grounds for doing so.
(2) Without limiting the generality of subsection (1), the court may, on the application of the Director, cancel the order if satisfied that the person is not serving his or her sentence in accordance with the order.
(3) Without limiting the generality of subsection (1), the court shall, on the application of the Director, cancel the order if satisfied that—
(a) the person has, for 3 or more detention periods, whether consecutive or not, failed to report, as required by or under this Act; and
(b) the failures to report occurred otherwise than on leave of absence under section 24.
(4) Before hearing an application to cancel an order under this section the court shall—
(a) in the case of an application by the Director—
(i) cause the detainee to be served with a summons for his or her appearance together with a copy of the application; or
(ii) where the court considers it necessary to secure the appearance of the detainee other than by way of summons—instead of issuing a summons, issue a warrant for the apprehension of the detainee; and
(b) in the case of an application by a detainee—cause the Director to be served with a copy of the application.
(5) Notwithstanding the issue of a summons under subparagraph (4) (a) (i), the court may issue a warrant at any time before or after the time mentioned in the summons for the appearance of the detainee.
(6) The court may refuse to cancel the order under subsection (3) if satisfied that—
(a) leave of absence should have been granted under section 24 with respect to 1 or more detention periods; and
(b) the total number of detention periods for which the person has failed to report as referred to in subsection (3) would, had the leave of absence been granted with respect to those detention periods, be less than 3;
in which case it shall make a determination to that effect.
(7) Where the court makes a determination under subsection (6), leave of absence under section 24 shall be taken to have been granted in accordance with the terms of the determination.
(8) In proceedings on an application under this section, a certificate purporting to be signed by the Director and certifying any of the following:
(a) that a person is a detainee;
(b) particulars of a periodic detention order;
(c) particulars of any failure by a detainee to serve his or her sentence in accordance with the order;
is evidence of the matters certified.
(9) In proceedings on an application under this section, where a detainee is taken to have failed to report for periodic detention by virtue of the operation of subsection 22 (4) or (6) , evidence of any matters relevant to—
(a) a test that a detainee was required to undertake but which the detainee refused or failed to undertake, as required;
(b) a test undertaken by a detainee; or
(c) the analysis of the results of a test undertaken by a detainee;
may be provided by way of a certificate as provided for in accordance with the regulations.
(10) A certificate referred to in subsections (8) and (9) shall not be admitted in evidence, unless the court is satisfied that reasonable efforts have been made to serve a copy of the relevant certificate on the detainee concerned.
(11) The court shall not cancel an order under this section if satisfied that the grounds for cancellation of the order would constitute a sufficient reason for an order for variation of the sentence to be made under section 26, in which case the court shall vary the sentence by cancelling the remaining detention periods that were to be served by the detainee.