/** * Move a customer box to the selected box * @param integer $from the ID of the box to move a customer box from * @param integer $to the ID of the box to move a customer box to * @param integer $cust the ID of the customer to move, if not specified a random customer will be chosen */ public function actionMoveBox($from, $to, $cust = null) { if ($cust) { $CustBoxFrom = UserBox::model()->findByPk($cust); } else { $CustBoxFrom = UserBox::random($from); } $CustBoxFrom->box_id = $to; $CustBoxFrom->save(); $this->redirect(array('boxItem/create', 'date' => $CustBoxFrom->Box->delivery_date_id)); }