(a) Whenever a complaint for damages for personal injuries is filed against a physician and surgeon, dentist, registered nurse, dispensing optician, optometrist, pharmacist, registered physical therapist, podiatrist, licensed psychologist, osteopathic physician and surgeon, chiropractor, clinical laboratory bioanalyst, clinical laboratory technologist, or veterinarian, duly licensed as such under the laws of this state, or a licensed hospital as the employer of any such person, in an action for error, omission, or negligence in the performance of professional services, or performance of professional services without consent, any such defendant may, within six months after service of summons, move the court for an order, upon notice to plaintiff and all defendants having appeared in the action, and hearing, requiring the plaintiff to file an undertaking in a sum not to exceed five hundred dollars ($500) as security for the costs of defense as provided in subdivision (d), which may be awarded against the plaintiff. The motion shall be supported by affidavit showing that the claim against the defendant is frivolous. Any defendant having appeared in the action and within 30 days after receipt of notice may join with the moving party requesting an order under this section as to the additional defendant. The failure of any defendant to join with the moving party shall preclude that defendant from subsequently requesting an order under this section. At the hearing upon the motion, the court shall order the plaintiff to file the undertaking if the defendant shows to the satisfaction of the court that:
(i) the plaintiff would not suffer undue economic hardship in filing the undertaking and (ii) there is no reasonable possibility that the plaintiff has a cause of action against each named defendant with respect to whom the plaintiff would otherwise be required to file the undertaking.A determination by the court that an undertaking either shall or shall not be filed or shall be filed as to one or more defendants and not as to others, shall not be deemed a determination of any one or more issues in the action or of the merits thereof. If the court, upon any such motion, makes a determination that an undertaking be filed by the plaintiff as to any one or more defendants, the action shall be dismissed as to that defendant or defendants, unless the undertaking required by the court shall have been filed within the reasonable time as may be fixed by the court.