(g) Except as otherwise provided in this subdivision, an assessment of civil penalties for a class "A" or class "B" violation shall be trebled and collected for a second and subsequent violation for which a citation of the same class was issued within any 12-month period. Trebling shall occur only if the first citation issued within the 12-month period was issued in the same class, a civil penalty was assessed, and a plan of correction was submitted for the previous same-class violation occurring within the period, without regard to whether the action to enforce the previous citation has become final. However, the increment to the civil penalty required by this subdivision shall not be due and payable unless and until the previous action has terminated in favor of the department. If the class "B" citation is issued for a patient's rights violation, as defined in subdivision (e) of Section 1424, it shall not be trebled unless the department determines the violation has a direct or immediate relationship to the health, safety, security, or welfare of long-term health care facility residents.