printInit() protected method

Initialise print action.
protected printInit ( integer $id )
$id integer event id
示例#1
0
 /**
  * marks the prescription as printed. So this is the 3rd place this can happen, but not sure
  * if this is every called.
  *
  * @param int $id
  *
  * @throws Exception
  */
 public function printInit($id)
 {
     parent::printInit($id);
     if (!($prescription = Element_OphDrPrescription_Details::model()->find('event_id=?', array($id)))) {
         throw new Exception('Prescription not found: ' . $id);
     }
     $prescription->printed = 1;
     if (!$prescription->save()) {
         throw new Exception('Unable to save prescription: ' . print_r($prescription->getErrors(), true));
     }
     $this->event->info = $prescription->infotext;
     if (!$this->event->save()) {
         throw new Exception('Unable to save event: ' . print_r($this->event->getErrors(), true));
     }
 }