コード例 #1
0
ファイル: ContractDeals.php プロジェクト: jaccos/wrkmtspr_prd
 public static function newContractDeal($eventMdl, $city = '', $location = '', $aanvangstijd = '')
 {
     $modelCd = new ContractDeals();
     $modelCd->event_id = $eventMdl->id;
     $modelCd->user_id = $eventMdl->user_id;
     $modelCd->code_title_current = $eventMdl->code_title;
     $modelCd->code_title_prev = $modelCd->getPrevCodeTitle($eventMdl->code_title);
     $modelCd->approximated_by = Yii::$app->user->id;
     $modelCd->description = $modelCd->getEventDescription($eventMdl->code_title);
     $modelCd->location = $location;
     $modelCd->city = $city;
     $modelCd->aanvangstijd = $aanvangstijd;
     $modelCd->save(false);
 }
コード例 #2
0
 /**
  * Als een contract wordt geaccepteerd d.m.v. de acceptdialoog dan wordt een nieuwe contractdeal aangemaakt  
  *
  **/
 public function actionUpdateContractAcceptedFromDialog()
 {
     if (isset($_POST['ContractDeals']) && isset($_POST['CalendarEvents'])) {
         if (ArrayHelper::getValue($_POST['ContractDeals'], 'contractAccepting') == 1) {
             $prev_codetitle = ArrayHelper::getValue($_POST['CalendarEvents'], 'code_title');
             $calendereventId = ArrayHelper::getValue($_POST['CalendarEvents'], 'id');
             $newCodeTitleMdl = $this->getNextCodeTitles($prev_codetitle);
             $modelEvent = CalendarEvents::findOne($calendereventId);
             $contractOntvanger = Gebruikers::findOne(['id' => $modelEvent->user_id]);
             if ($modelEvent) {
                 $modelEvent->title = $newCodeTitleMdl->title;
                 $modelEvent->color = $newCodeTitleMdl->color;
                 $modelEvent->code_title = $newCodeTitleMdl->code_title;
                 $modelEvent->save(false);
             }
             $prev_ContractDeal = ContractDeals::findOne(['event_id' => $calendereventId]);
             $new_contractdeal = new ContractDeals();
             $new_contractdeal->attributes = $prev_ContractDeal->attributes;
             $companyname = Company::findOne(['user_id' => $prev_ContractDeal->approximated_by])->name;
             $new_contractdeal->code_title_prev = $prev_ContractDeal->code_title_current;
             $new_contractdeal->code_title_current = $newCodeTitleMdl->code_title;
             $new_contractdeal->description = ContractDeals::getEventDescriptionWhenAccepted($newCodeTitleMdl->code_title, $companyname, $modelEvent->start, $new_contractdeal->city, $new_contractdeal->location, $contractOntvanger->email);
             $new_contractdeal->id = null;
             $new_contractdeal->save(false);
         }
     }
     $this->redirect(array('mijnkalender', '_id' => $contractOntvanger->id));
 }