Created
July 7, 2010 20:23
-
-
Save raulriera/467219 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--- Verify that the treatmentplan creates successfully ---> | |
<cfif treatmentplan.save()> | |
<!--- Loop through all the patient's teeth ---> | |
<cfloop collection="#params.as_values_treatmentplandetail.treatment#" item="tooth"> | |
<!--- Loop through all the treatment plans selected ---> | |
<cfloop list="#params.as_values_treatmentplandetail.treatment[tooth]#" index="treatmentId"> | |
<!--- Find the selected treatment (HUGE DB IMPACT) ---> | |
<cfset treatment = model("Treatment").findByKey(treatmentId)> | |
<!--- Insert a new treatment detail in the plan ---> | |
<cfset treatmentplan.createTreatmentPlanDetail(toothId=tooth, treatment=treatment.name, price=treatment.price)> | |
</cfloop> | |
</cfloop> | |
<cfset flashInsert(success="The treatment plan was created successfully.")> | |
<cfset redirectTo(route="treatmentPlan", patientId=params.patientId, key=treatmentplan.id)> | |
<!--- Otherwise ---> | |
<cfelse> | |
<cfset flashInsert(error="There was an error creating the treatment plan.")> | |
<cfset renderPage(action="new")> | |
</cfif> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment