
    637 P.2d 1088
    SUN WORLD CORPORATION, dba Sun Publishing Co., a Texas corporation, Plaintiff-Appellant, v. PENNYSAVER, INC., an Arizona corporation, Defendant-Appellee.
    No. 1 CA-CIV 4695.
    Court of Appeals of Arizona, Division 1, Department A.
    Nov. 27, 1981.
    
      Debus & Busby, Ltd. by A. Jerry Busby, Phoenix, for plaintiff-appellant.
    Jack E. Evans, Ltd. by Jack E. Evans, Phoenix, for defendant-appellee.
   OPINION

OGG, Judge.

In this opinion we must determine if the non-assignability clause in the contract between the parties justified a dismissal of plaintiff’s two claims for collection on an open account and for breach of contract. We must further consider the validity of the dismissal order that was granted with prejudice. It is this court’s opinion that the trial court erred in the dismissal of the complaint and that the dismissal with prejudice constituted further error.

The appellant, Sun World Corporation, d/b/a Sun Publishing Co., a Texas corporation, filed a complaint in the Maricopa County Superior Court against the appellee, Pennysaver, Inc., an Arizona corporation, for an unpaid open printing account and for breach of contract. Count I of Sun World’s complaint alleged that Pennysaver breached the contract by its refusal to pay the sum of $145,943.58 on an open account owed for certain printing delivered under the terms of the contract. In Count II, Sun World seeks damages from Pennysaver in a sum not less than $42,156.24 for the premature wrongful termination of the contract. Sun World also seeks reasonable attorney fees under the terms of the contract.

Pennysaver moved to dismiss Sun World’s complaint because the contract entered into between Central Arizona Broadcasting, Inc., Sun World’s predecessor, and Penny-saver on August 3, 1973 was nonassignable without consent of the other party. Penny-saver’s theory was that Sun World, which was not a party to the original contract, did not have Pennysaver’» consent to an assignment and therefore could not bring an action to enforce the contract.

The court granted Pennysaver’s motion to dismiss, and a formal judgment dismissing the complaint with prejudice was entered on October 23, 1978. The final paragraph of the judgment reads:

It is Therefore Ordered, Adjudged and Decreed that the defendant’s Motion to Dismiss the plaintiff’s Complaint is hereby granted with prejudice and judgment is hereby entered against the plaintiff and in favor of the defendant.

Sun World first objected to the dismissal and form of judgment, then moved to amend or alter the judgment. The court denied the motions and this appeal followed.

In our review of a motion to dismiss, we must accept all material facts as alleged by the non-moving party as true. Lakin Cattle Co. v. Engelthaler, 101 Ariz. 282, 419 P.2d 66 (1960). A court should not grant a motion to dismiss for failure to state a claim upon which relief can - be granted unless it apjrears certain that the plaintiff would not be entitled to relief under any state of facts susceptible of proof under the claim stated. Folk v. City of Phoenix, 27 Ariz.App. 146, 551 P.2d 595 (1976).

Pennysaver argues that when Sun World submitted the affidavit of Marvin K. House, Jr., its assistant general manager, in response to the motion to dismiss, it thereby converted the motion to dismiss into a motion for summary judgment. The substance of the affidavit was that the two corporate name changes did not “alter the status or operation of Sun Publishing Company as a wholly owned subsidiary of the parent corporation, which was called Central Arizona Broadcasting, Inc., at the time the contract between Sun Publishing and Pennysaver was entered upon, and which parent corporation is now known as Sun World Corporation.” Rule 12(b), Arizona Rules of Civil Procedure, states in pertinent part that:

If, on a motion asserting the defense numbered 6 to dismiss for failure of the pleading to state a claim upon which relief can be granted, matters outside the pleading are presented to and not excluded by the court, the motion shall be treated as one for summary judgment and disposed of as provided in Rule 56 ....

The record in this case is somewhat confusing. The motion to dismiss was the only motion presented, and the judgment specifically grants the motion to dismiss. On the other hand, the motion, as argued to the trial court and as presented in the briefs and arguments before this court was a combination of both a motion to dismiss and a motion for summary judgment.

We find it makes no difference in our final disposition whether we treat the motion as one to dismiss or as a motion for summary judgment. In either case, the trial court based its decision upon its conclusion that there was an invalid assignment of the contract. It is our opinion that if the appeal is from a motion to dismiss, such judgment must be reversed since Sun World’s complaint states facts which are susceptible of proof and the factual allegations do state a claim. If the appeal is from a motion for summary judgment, such judgment must also be reversed since the record presently before us indicates there are material fact disputes with regard to the assignment and its enforceability. Lundy v. Prescott Valley, Inc., 110 Ariz. 362, 519 P.2d 61 (1974).

We will now proceed to consider the issues as presented by the parties in this appeal. Pennysaver argues that the trial court correctly dismissed the complaint for the failure of Sun World to state a claim upon which relief can be granted. Rule 12(b)6, Arizona Rules of Civil Procedure. To develop such argument, Pennysaver states that both Counts I and II of plaintiff Sun World’s complaint are based upon an agreement dated August 31, 1973, between Central Arizona Broadcasting, Inc., an Arizona corporation, doing business as Sun Publishing Co., and Gerald A. Story, doing business as Pennysaver Publishers. Paragraph 19 of the agreement provides as follows: “19. Assignment: This agreement cannot be assigned by either party without the express written consent of the other.” Pennysaver reasons that the complaint is filed in the name of Sun World Corporation, a Texas corporation, and not Central Arizona Broadcasting, Inc., an Arizona corporation, and it is therefore apparent from the face of the complaint that there has been an assignment of the contract. It further reasons that since Sun World’s complaint is premised on the contract which contains language expressly prohibiting an assignment without the written consent of the other party, and since Sun World has failed to plead or allege such consent, the complaint fails to state a claim and was therefore properly dismissed.

Sun World argues that, as the present corporate owner of Sun Publishing Co., it was the proper party .to bring this action since the provisions of Rule 17(a), Arizona Rules of Civil Procedure, require that “[ejvery action shall be prosecuted in the name of the real party in interest.”

Sun World further contends that there was no assignment of the contract as contemplated by paragraph 19 and the contract remained in full force and effect. It argues that under the terms of the contract, Pen-nysaver Publishers was entitled to have its printing done by Sun Publishing at a specified price, and there was no assignment of those rights simply because Sun Publishing’s corporate ownership went through changes in name and legal domicile. On or about October 31, 1974, Central Arizona Broadcasting, the original corporate owner of Sun Publishing, merged and changed its name to Automated Data Processing of El Paso, Inc., a Texas corporation. Thereafter, on October 31, 1976, Automated Data Processing of El Paso, Inc., merged and changed its name to Sun World Corporation, a Texas corporation. Throughout this time period of the two changes in the corporate ownership, the business known as Sun Publishing continued to supply printing under the contract terms until Pennysaver terminated the contract in May of 1978, at which time its account with Sun Publishing had a stated balance of almost $146,000. Sun Publishing argues that it is the identity of the parties, rather than the name under which they choose to do business, which is the controlling factor in determining whether there was a breach of contract under the non-assignability provision of paragraph 19.

Sun World relies upon the California Supreme Court case of Trubowitch v. Riverbank Canning Co., 30 Cal.2d 335, 182 P.2d 182 (1947). In Trubowitch, the court held that where a corporate buyer named in a sales contract, which contained a prohibition against assignment, dissolved and assigned its assets to stockholders who later formed a partnership, such partnership could enforce the contract. The Trubo-witch court reasoned that a provision against assignment in a contract does not preclude a transfer of rights thereunder by operation of law. If such an assignment results merely from a change in the legal form of ownership of a business, the applicability of a non-assignability clause depends upon whether it affects the interests of the parties intended to be protected by the non-as-signability of the contract.

Sun World argues that the purported assignment in this case was not the type of assignment contemplated by the parties in paragraph 19 of the contract. The purpose of such a non-assignment provision is to prevent one party from forcing the other to deal with a third party. Here, it appears from the present state of the record that Pennysaver was dealing with the same printer and personnel until it unilaterally terminated the contract. To allow Penny-saver to escape from payment for printing work accepted and used without complaint simply because Sun Publishing’s parent corporation had changed its name and corporate structure would seem irrational and patently unjust.

Pennysaver argues that the duties and responsibilities called for in this specialized printing contract cannot be assigned in the face of a contract provision that expressly prohibits such assignment. Pennysaver distinguishes Trubowitch on grounds that the case deals with a contract for the sale of standard goods (tomato paste), while the case under consideration involves a printing contract requiring special skills, capacity and taste. Pennysaver relies upon the case of Rother-Gallagher v. Montana Power Company, 164 Mont. 360, 522 P.2d 1226 (1974). In Rother-Gallagher, two corporations entered into a logging contract with the power company that contained a clause precluding an assignment without the power company’s consent. Later the corporations were dissolved for tax purposes and the three former shareholders formed a partnership which assumed all the obligations and benefits of the corporations. When the partnership! attempted to sue for breach of contract, the court ruled that the failure of the partnership to secure consent to the assignment destroyed the privity and the partnership lacked standing to sue under the non-assignability clause in the contract.

It is our opinion that Trubowitch is a better reasoned disposition of this issue. See Ruberoid v. Glassman Construction Co., 248 Md. 97, 234 A.2d 875 (1967). The applicability of the non-ass;ignability provision to the present situation can only be determined by a hearing on the merits to determine if the changes in the corporate structure of Sun Publishing’s parent corporation adversely affected the rights of Pennysaver under the printing contract.

Sun World further argues that even if it was determined that the non-assignability clause is applicable to these facts, there still remains the issue of waiver. Sun World contends that any right Pennysaver may have had to object to the corporate changes has been waived by Pennysaver’s acceptance of the printing and failure to raise any timely objection.

A non-assignability clause in a contract can be waived by the conduct of the parties. Trubowitch v. Riverbank Canning Co., supra. We therefore find it was error for the trial court to dismiss Sun World’s complaint without a hearing on the merits to determine if there had been a waiver of the non-assignability provision in the contract.

The final issue to be determined is whether the court erred in dismissing the complaint with prejudice, thereby foreclosing any opportunity of Sun World to amend the complaint to seek payment for the unpaid $145,943.58 printing bill on a quantum me-ruit theory. Sun World argues that if there is, in fact, no valid contract between the parties, then Sun World should be allowed to sue for services rendered that have unjustly enriched Pennysaver.

It is our opinion that even if the trial court had correctly determined that Sun World could not prevail under the contract terms, it was error to dismiss with prejudice. Sun World should have been permitted to amend its complaint to allege unjust enrichment. Motions to dismiss for failure to state a claim are not favored, Folk v. City of Phoenix, supra, and the non-moving party should be given an opportunity to amend its complaint if such an amendment will cure its defects. In re Cassidy’s Estate, 77 Ariz. 288, 270 P.2d 1079 (1954).

The case is reversed and remanded for a disposition consistent with this opinion.

CONTRERAS, P. J., and CORCORAN, J., concur. 
      
      . From the meager record available from this summary judgment disposition, we are unable to determine with certainty the complete details of the corporate; ownership changes of Sun Publishing Co.
     