Except as otherwise provided by rule adopted by the Judicial Council, when a demurrer to a complaint or to a cross-complaint is overruled and there is no answer filed, the court shall allow an answer to be filed upon such terms as may be just. If a demurrer to the answer is overruled, the action shall proceed as if no demurrer had been interposed, and the facts alleged in the answer shall be considered as denied to the extent mentioned in Section 431.20.
(c) When a demurrer is sustained, the court may grant leave to amend the pleading upon any terms as may be just and shall fix the time within which the amendment or amended pleading shall be filed. When a demurrer is stricken pursuant to Section 436 and there is no answer filed, the court shall allow an answer to be filed on terms that are just.
(d) When a motion to strike is granted pursuant to Section 436, the court may order that an amendment or amended pleading be filed upon terms it deems proper. When a motion to strike a complaint or cross-complaint, or portion thereof, is denied, the court shall allow the party filing the motion to strike to file an answer.
(e) When a motion to dismiss an action pursuant to Article 2 (commencing with Section 583.210) of Chapter 1.5 of Title 8 is denied, the court shall allow a pleading to be filed.
472b. When a demurrer to any pleading is sustained or overruled, and time to amend or answer is given, the time so given runs from the service of notice of the decision or order, unless the notice is waived in open court, and the waiver entered in the minutes. When an order sustaining a demurrer without leave to amend is reversed or otherwise remanded by any order issued by a reviewing court, any amended complaint shall be filed within 30 days after the clerk of the reviewing court mails notice of the issuance of the remittitur.
472c. (a) When any court makes an order sustaining a demurrer without leave to amend the question as to whether or not such court abused its discretion in making such an order is open on appeal even though no request to amend such pleading was made.
(b) The following orders shall be deemed open on appeal where an amended pleading is filed after the court's order:
(1) An order sustaining a demurrer to a cause of action within a complaint or cross-complaint where the order did not sustain the demurrer as to the entire complaint or cross-complaint.
(2) An order sustaining a demurrer to an affirmative defense within an answer where the order sustaining the demurrer did not sustain the demurrer as to the entire answer.
(3) An order granting a motion to strike a portion of a pleading where the order granting the motion to strike did not strike the entire pleading.
(c) As used in this section, "open on appeal" means that a party aggrieved by an order listed in subdivision (b) may claim the order as error in an appeal from the final judgment in the action.
472d. Whenever a demurrer in any action or proceeding is sustained, the court shall include in its decision or order a statement of the specific ground or grounds upon which the decision or order is based which may be by reference to appropriate pages and paragraphs of the demurrer.
The party against whom a demurrer has been sustained may waive these requirements.
473. (a) (1) The court may, in furtherance of justice, and on any terms as may be proper, allow a party to amend any pleading or proceeding by adding or striking out the name of any party, or by correcting a mistake in the name of a party, or a mistake in any other respect; and may, upon like terms, enlarge the time for answer or demurrer. The court may likewise, in its discretion, after notice to the adverse party, allow, upon any terms as may be just, an amendment to any pleading or proceeding in other particulars; and may upon like terms allow an answer to be made after the time limited by this code.
(2) When it appears to the satisfaction of the court that the amendment renders it necessary, the court may postpone the trial, and may, when the postponement will by the amendment be rendered necessary, require, as a condition to the amendment, the payment to the adverse party of any costs as may be just.
(b) The court may, upon any terms as may be just, relieve a party or his or her legal representative from a judgment, dismissal, order, or other proceeding taken against him or her through his or her mistake, inadvertence, surprise, or excusable neglect. Application for this relief shall be accompanied by a copy of the answer or other pleading proposed to be filed therein, otherwise the application shall not be granted, and shall be made within a reasonable time, in no case exceeding six months, after the judgment, dismissal, order, or proceeding was taken. However, in the case of a judgment, dismissal, order, or other proceeding determining the ownership or right to possession of real or personal property, without extending the six-month period, when a notice in writing is personally served within the State of California both upon the party against whom the judgment, dismissal, order, or other proceeding has been taken, and upon his or her attorney of record, if any, notifying that party and his or her attorney of record, if any, that the order, judgment, dismissal, or other proceeding was taken against him or her and that any rights the party has to apply for relief under the provisions of Section 473 of the Code of Civil Procedure shall expire 90 days after service of the notice, then the application shall be made within 90 days after service of the notice upon the defaulting party or his or her attorney of record, if any, whichever service shall be later. No affidavit or declaration of merits shall be required of the moving party. Notwithstanding any other requirements of this section, the court shall, whenever an application for relief is made no more than six months after entry of judgment, is in proper form, and is accompanied by an attorney's sworn affidavit attesting to his or her mistake, inadvertence, surprise, or neglect, vacate any (1) resulting default entered by the clerk against his or her client, and which will result in entry of a default judgment, or (2) resulting default judgment or dismissal entered against his or her client, unless the court finds that the default or dismissal was not in fact caused by the attorney's mistake, inadvertence, surprise, or neglect. The court shall, whenever relief is granted based on an attorney's affidavit of fault, direct the attorney to pay reasonable compensatory legal fees and costs to opposing counsel or parties. However, this section shall not lengthen the time within which an action shall be brought to trial pursuant to Section 583.310.
(c) (1) Whenever the court grants relief from a default, default judgment, or dismissal based on any of the provisions of this section, the court may do any of the following:
(A) Impose a penalty of no greater than one thousand dollars ($1,000) upon an offending attorney or party.
(B) Direct that an offending attorney pay an amount no greater than one thousand dollars ($1,000) to the State Bar Client Security Fund.
(C) Grant other relief as is appropriate.
(2) However, where the court grants relief from a default or default judgment pursuant to this section based upon the affidavit of the defaulting party's attorney attesting to the attorney's mistake, inadvertence, surprise, or neglect, the relief shall not be made conditional upon the attorney's payment of compensatory legal fees or costs or monetary penalties imposed by the court or upon compliance with other sanctions ordered by the court.
(d) The court may, upon motion of the injured party, or its own motion, correct clerical mistakes in its judgment or orders as entered, so as to conform to the judgment or order directed, and may, on motion of either party after notice to the other party, set aside any void judgment or order.
473.1. The court may, upon such terms as may be just, relieve a party from a judgment, order, or other proceeding taken against him or her, including dismissal of an action pursuant to Section 581 or Chapter 1.5 (commencing with Section 583.110) of Title 8, where a court of this state has assumed jurisdiction, pursuant to Section 6180 or 6190 of the Business and Professions Code, over the law practice of the attorney for the party and the judgment, order or other proceeding was taken against the party after the application for the court to assume jurisdiction over the practice was filed. Application for this relief shall be made within a reasonable period of time, in no case exceeding six months, after the court takes jurisdiction over the practice. However, in the case of a judgment, order, or other proceeding determining the ownership or right to possession of real or personal property, without extending the six-month period, when a notice in writing is personally served within the state both