Ejemplo n.º 1
1
 private static function makePolzovatel($fiz_lico_id)
 {
     $fiz_lico = FizLico::find()->where(['id' => $fiz_lico_id])->one();
     //  (new FizLicoRepo)->select(['id' => $fiz_lico_id]);
     if (!$fiz_lico) {
         throw new UserException("Физ.лицо с id={$fiz_lico_id} не найдено");
     }
     //$fiz_lico = $fiz_lica[0];
     $login = self::makeLogin($fiz_lico->familiya, $fiz_lico->imya, $fiz_lico->otchestvo);
     $parol = strtolower(\Yii::$app->security->generateRandomString(4));
     $klyuch_autentifikacii = \Yii::$app->security->generateRandomString(255);
     $roli = [Rol::RUKOVODITEL_KURSOV];
     $polzovatel_config = ['fizLico' => $fiz_lico, 'login' => $login, 'parol' => $parol, 'klyuchAutentifikacii' => $klyuch_autentifikacii, 'roli' => $roli, 'aktiven' => true];
     $polzovatel = new Polzovatel();
     // new PolzovatelEntity($polzovatel_config);
     $polzovatel->fizLico = $fiz_lico_id;
     $polzovatel->login = $login;
     $polzovatel->parol = $parol;
     $polzovatel->klyuchAutentifikacii = $klyuch_autentifikacii;
     $polzovatel->roli = $roli;
     $polzovatel->aktiven = true;
     if (!$polzovatel->save()) {
         throw new UserException("Ошибка сохранения пользователя {$polzovatel->login}.");
     }
     return [$fiz_lico->familiya, $fiz_lico->imya, $fiz_lico->otchestvo, $login, $parol];
 }
Ejemplo n.º 2
0
 public function actionSlushateli($kurs)
 {
     $kurs = Hashids::decodeOne($kurs);
     if (!$kurs) {
         throw new NotFoundHttpException();
     }
     $model = Kurs::findOne($kurs);
     if (!$model) {
         throw new NotFoundHttpException();
     }
     //todo with()
     $query = FizLico::findSlushateliKursa($kurs)->andWhere(['kurs_fiz_lica.status' => StatusKursaFizLica::ZAPISAN])->orderBy('id');
     $data = new ActiveDataProvider(['query' => $query, 'key' => 'hashids', 'pagination' => false, 'sort' => false]);
     return $this->render('slushateli', compact('data', 'model'));
 }
Ejemplo n.º 3
0
 private function registerImpl()
 {
     if (!$this->validate()) {
         return false;
     }
     $fiz_lico = new FizLico(['familiya' => $this->familiya, 'imya' => $this->imya, 'otchestvo' => $this->otchestvo, 'email' => $this->email, 'formattedTelefon' => $this->telefon]);
     $polzovatel = new Polzovatel(['login' => $this->login, 'parol' => $this->parol, 'aktiven' => true, 'roliAsArray' => $this->roli]);
     $polzovatel->generateKlyuchAutentifikacii();
     $polzovatel->generateKodPodtverzhdeniyaEmail();
     list($organizaciya, $organizaciya_to_delete) = DirectoryHelper::getFromCombo(Organizaciya::className(), $this->rabotaOrgId, $this->rabotaOrgNazvanie, ['vedomstvo' => $this->rabotaOrgVedomstvo, 'adres_adresnyj_objekt' => $this->rabotaOrgAdres]);
     $rabota_fiz_lica = new RabotaFizLica(['formattedTelefon' => $this->rabotaTelefon]);
     list($dolzhnost, $dolzhnost_to_delete) = DirectoryHelper::getFromCombo(Dolzhnost::className(), $this->rabotaDolzhnostId, $this->rabotaDolzhnostNazvanie, null);
     $dolzhnost_fiz_lica_na_rabote = new DolzhnostFizLicaNaRabote(['etapObrazovaniyaAsEnum' => $this->rabotaEtapObrazovaniya]);
     $message = Yii::$app->mailer->compose('kadry/registraciya.php', ['model' => $this, 'polzovatel' => $polzovatel])->setTo($fiz_lico->email);
     if (!$message->send()) {
         $this->addError('email', 'Не удалось отправить E-Mail.');
         return false;
     }
     $transaction = Yii::$app->db->beginTransaction();
     try {
         $fiz_lico->save(false);
         $polzovatel->link('fizLicoRel', $fiz_lico);
         $polzovatel->save(false);
         if ($organizaciya) {
             $organizaciya->save(false);
         }
         $rabota_fiz_lica->fizLico = $fiz_lico->id;
         $rabota_fiz_lica->link('organizaciyaRel', $organizaciya);
         $rabota_fiz_lica->save(false);
         if ($dolzhnost) {
             $dolzhnost->save(false);
         }
         $dolzhnost_fiz_lica_na_rabote->dolzhnost = $dolzhnost->id;
         $dolzhnost_fiz_lica_na_rabote->link('rabotaFizLicaRel', $rabota_fiz_lica);
         $dolzhnost_fiz_lica_na_rabote->save(false);
         if ($organizaciya_to_delete) {
             $organizaciya_to_delete->delete();
         }
         if ($dolzhnost_to_delete) {
             $dolzhnost_to_delete->delete();
         }
         $transaction->commit();
     } catch (\Exception $e) {
         $transaction->rollBack();
         throw $e;
     }
     return true;
 }
Ejemplo n.º 4
0
 public function getFizLicoRel()
 {
     return $this->hasOne(FizLico::className(), ['id' => 'fiz_lico'])->inverseOf('kursyFizLica');
 }
Ejemplo n.º 5
0
 public function getFizLicoRel()
 {
     return $this->hasOne(FizLico::className(), ['id' => 'fiz_lico'])->inverseOf('obrazovaniyaFizLicaRel');
 }
Ejemplo n.º 6
0
            <?php 
echo $form->field($filterModel, 'planProspektGod')->dropDownList(SpisokKursovFilterForm::planProspektGodItems());
?>

            <?php 
echo $form->field($filterModel, 'kategoriiSlushatelej')->widget(Select2::className(), ['data' => KategoriyaSlushatelya::find()->formattedAll(EntityQuery::CHECKBOX_LIST, 'nazvanie'), 'options' => ['placeholder' => '', 'multiple' => true], 'pluginOptions' => ['allowClear' => true]]);
?>
        </div>

        <div class="col-md-8">
            <?php 
echo $form->field($filterModel, 'nazvanie');
?>

            <?php 
echo $form->field($filterModel, 'rukovoditel')->widget(Select2::className(), ['data' => FizLico::findRukovoditeliKursov()->formattedAll(EntityQuery::DROP_DOWN, 'familiyaInicialy'), 'options' => ['placeholder' => ''], 'pluginOptions' => ['allowClear' => true]]);
?>

            <?php 
echo $form->field($filterModel, 'chasy')->widget(TouchSpin::className());
?>
            <div class="row">
                <div class="col-md-6">
                    <?php 
echo $form->field($filterModel, 'nachalo')->widget(DeprecatedDatePicker::className());
?>
                </div>
                <div class="col-md-6">
                    <?php 
echo $form->field($filterModel, 'konec')->widget(DeprecatedDatePicker::className());
?>
Ejemplo n.º 7
0
 public function actionChangeVremyaProvedeniya()
 {
     Yii::$app->response->format = Response::FORMAT_JSON;
     $response = new JsResponse();
     $id = Yii::$app->request->post('id');
     $vremyaId = Yii::$app->request->post('vremya_id');
     /**
      * @var ZayavlenieNaAttestaciyu $zayavlenie
      */
     $zayavlenie = ZayavlenieNaAttestaciyu::findOne(['id' => $id]);
     $zayavlenie->vremya_provedeniya = $vremyaId;
     $zayavlenie->status = StatusZayavleniyaNaAttestaciyu::PODPISANO_OTDELOM_ATTESTACII;
     $period = VremyaProvedeniyaAttestacii::findOne($vremyaId);
     if (!$zayavlenie->save()) {
         $response->type = JsResponse::ERROR;
         $response->msg = JsResponse::MSG_OPERATION_ERROR;
     } else {
         $email = FizLico::getEmailById($zayavlenie->fiz_lico);
         \Yii::$app->mailer->compose('/attestaciya/vremya-izmeneno.php', compact('period'))->setTo($email)->send();
     }
     return $response;
 }
Ejemplo n.º 8
0
 public function getSlushateliRel()
 {
     return $this->hasMany(FizLico::className(), ['id' => 'fiz_lico'])->via('kursyFizLicaRel', function ($q) {
         $q->onCondition(['{{kurs_fiz_lica}}.[[status]]' => StatusKursaFizLica::ZAPISAN]);
     });
 }
Ejemplo n.º 9
0
 public static function getEmailById($fizLicoId)
 {
     $fizLico = FizLico::find()->select(['email'])->where(['id' => $fizLicoId])->one();
     if ($fizLico) {
         return $fizLico->email;
     } else {
         return false;
     }
 }
Ejemplo n.º 10
0
 public static function tableName()
 {
     return FizLico::tableName();
 }
Ejemplo n.º 11
0
 public function getFizLicoRel()
 {
     return $this->hasOne(FizLico::className(), ['id' => 'fiz_lico'])->inverseOf('zayavlenieNaAttestaciyuRel');
 }
Ejemplo n.º 12
0
 private function populateByudzhetImpl()
 {
     $fiz_lico = FizLico::findOne($this->fizLico);
     if ($fiz_lico) {
         $this->pedStazh = $fiz_lico->pedStazh;
     }
     $rabota_fiz_lica = RabotaFizLica::find()->where(['fiz_lico' => $this->fizLico])->orderBy('id')->one();
     $dolzhnost_fiz_lica_na_rabote = $rabota_fiz_lica ? DolzhnostFizLicaNaRabote::find()->where(['rabota_fiz_lica' => $rabota_fiz_lica->id])->orderBy('id')->one() : null;
     if ($dolzhnost_fiz_lica_na_rabote) {
         list($this->dolzhnostId, $this->dolzhnostNazvanie) = DirectoryHelper::getForCombo(Dolzhnost::findOne($dolzhnost_fiz_lica_na_rabote->dolzhnost));
     }
     if ($dolzhnost_fiz_lica_na_rabote && ($stazh_v_dolzhnosti = StazhFizLica::findOne(['fiz_lico' => $this->fizLico, 'dolzhnost' => Val::of($dolzhnost_fiz_lica_na_rabote, 'dolzhnost')]))) {
         $this->stazhVDolzhnosti = $stazh_v_dolzhnosti->stazh;
     }
     if ($attestaciya_fiz_lica = $fiz_lico->attestaciyaFizLicaRel) {
         $this->kategoriya = $attestaciya_fiz_lica->kategoriya;
     }
     if ($obrazovanie_fiz_lica = ObrazovanieFizLica::find()->where(['fiz_lico' => $this->fizLico])->orderBy('id')->one()) {
         list($this->obrOrgId, $this->obrOrgNazvanie) = DirectoryHelper::getForCombo(Organizaciya::findOne($obrazovanie_fiz_lica->organizaciya));
         list($this->obrKvalifikaciyaId, $this->obrKvalifikaciyaNazvanie) = DirectoryHelper::getForCombo(Kvalifikaciya::findOne($obrazovanie_fiz_lica->kvalifikaciya));
         $this->obrDocTip = $obrazovanie_fiz_lica->dokumentObObrazovaniiTip;
         $this->obrDocSeriya = $obrazovanie_fiz_lica->dokumentObObrazovaniiSeriya;
         $this->obrDocNomer = $obrazovanie_fiz_lica->dokumentObObrazovaniiNomer;
         $this->obrDocData = DeprecatedDatePicker::fromDatetime($obrazovanie_fiz_lica->dokumentObObrazovaniiDataAsDate);
     }
     return $fiz_lico;
 }
Ejemplo n.º 13
0
 public function save()
 {
     $fizLicoFio = FizLico::getFioById($this->fizLicoId);
     $rabota = RabotaFizLica::find()->joinWith('dolzhnostiFizLicaNaRaboteRel')->where(['rabota_fiz_lica.id' => $this->dolzhnost])->one();
     $zayavlenie = ZayavlenieNaAttestaciyu::findOne($this->id ? $this->id : 0);
     $attestaciyaDates = $this->parseAttestaciyaDate();
     if (!$zayavlenie) {
         $zayavlenie = new ZayavlenieNaAttestaciyu();
     }
     $zayavlenie->fiz_lico = $this->fizLicoId;
     $zayavlenie->familiya = $fizLicoFio['familiya'];
     $zayavlenie->imya = $fizLicoFio['imya'];
     $zayavlenie->otchestvo = $fizLicoFio['otchestvo'];
     $zayavlenie->ped_stazh = $this->pedStazh;
     $zayavlenie->stazh_v_dolzhnosti = $this->pedStazhVDolzhnosti;
     $zayavlenie->rabota_organizaciya = $rabota->organizaciya;
     $zayavlenie->rabota_dolzhnost = $rabota->dolzhnostiFizLicaNaRaboteRel[0]->dolzhnost;
     $zayavlenie->rabota_stazh_v_dolzhnosti = $this->rabotaPedStazhVDolzhnosti;
     $zayavlenie->rabota_kopiya_trudovoj_knizhki = $this->trudovajya;
     $zayavlenie->attestaciya_kategoriya = $this->attestacionnyListKategoriya;
     $zayavlenie->attestaciya_kopiya_attestacionnogo_lista = $this->attestacionnyListPeriodFajl;
     $zayavlenie->attestaciya_data_prisvoeniya = date('Y-m-d', strtotime($attestaciyaDates['data_prisvoeniya']));
     $zayavlenie->attestaciya_data_okonchaniya_dejstviya = date('Y-m-d', strtotime($attestaciyaDates['data_okonchaniya_dejstviya']));
     $zayavlenie->na_kategoriyu = $this->kategoriya;
     $zayavlenie->attestaciya_data_okonchaniya_dejstviya = date('Y-m-d', strtotime($this->attestaciyaDataOkonchaniyaDejstviya));
     $zayavlenie->rabota_data_naznacheniya = date('Y-m-d', strtotime($this->rabotaDataNaznacheniya));
     $zayavlenie->rabota_data_naznacheniya_v_uchrezhdenii = date('Y-m-d', strtotime($this->rabotaDataNaznacheniyaVUchrezhdenii));
     $zayavlenie->data_rozhdeniya = date('Y-m-d', strtotime($this->dataRozhdeniya));
     if ($this->kategoriya == KategoriyaPedRabotnika::VYSSHAYA_KATEGORIYA) {
         $zayavlenie->svedeniya_o_sebe = $this->svedeniysOSebe ? $this->svedeniysOSebe : null;
         $zayavlenie->svedeniya_o_sebe_fajl = $this->svedeniysOSebeFajl;
     } else {
         $zayavlenie->svedeniya_o_sebe = null;
         $zayavlenie->svedeniya_o_sebe_fajl = null;
     }
     if ($this->kategoriya == KategoriyaPedRabotnika::BEZ_KATEGORII) {
         $zayavlenie->var_ispytanie_2 = null;
         $zayavlenie->var_ispytanie_3 = null;
     } else {
         $zayavlenie->var_ispytanie_2 = $this->kategoriya == KategoriyaPedRabotnika::VYSSHAYA_KATEGORIYA ? $this->varIspytanie2 : null;
         $zayavlenie->var_ispytanie_3 = $this->kategoriya == KategoriyaPedRabotnika::VYSSHAYA_KATEGORIYA ? $this->varIspytanie3 : null;
         if (count($this->otraslevoeSoglashenie) > 0) {
             $zayavlenie->var_ispytanie_3 = null;
         }
     }
     $zayavlenie->vremya_provedeniya = $this->vremyaProvedeniya;
     $this->status = $this->status ? $this->status : StatusZayavleniyaNaAttestaciyu::REDAKTIRUETSYA_PED_RABOTNIKOM;
     $zayavlenie->status = $this->status ? $this->status : StatusZayavleniyaNaAttestaciyu::REDAKTIRUETSYA_PED_RABOTNIKOM;
     $zayavlenie->vremya_smeny_statusa = date("Y-m-d H:i:s");
     $zayavlenie->domashnijTelefon = substr($this->domashnijTelefon, 1);
     $zayavlenie->provestiZasedanieBezPrisutstviya = $this->provestiZasedanieBezPrisutstviya;
     $zayavlenie->prilozhenie1 = $this->prilozhenie1;
     $zayavlenie->ld_olimpiady = $this->ldOlimpiady ? $this->ldOlimpiady : null;
     $zayavlenie->ld_posobiya = $this->ldPosobiya ? $this->ldPosobiya : null;
     $zayavlenie->ld_publikacii = $this->ldPublikacii ? $this->ldPublikacii : null;
     $zayavlenie->ld_prof_konkursy = $this->ldProfKonkursy ? $this->ldProfKonkursy : null;
     $zayavlenie->ld_obshestvennaya_aktivnost = $this->ldObshestvennayaAktivnost ? $this->ldObshestvennayaAktivnost : null;
     $zayavlenie->ld_elektronnye_resursy = $this->ldElektronnyeResursy ? $this->ldElektronnyeResursy : null;
     $zayavlenie->ld_otkrytoe_meropriyatie = $this->ldOtkrytoeMeropriyatie ? $this->ldOtkrytoeMeropriyatie : null;
     $zayavlenie->ld_nastavnik = $this->ldNastavnik ? $this->ldNastavnik : null;
     $zayavlenie->ld_deti_sns = $this->ldDetiSns ? $this->ldDetiSns : null;
     if (!$zayavlenie->validate()) {
         return false;
     }
     //создаем массив с высшими образованиями
     $Obrazovaniya = [];
     if ($this->visshieObrazovaniya) {
         foreach ($this->visshieObrazovaniya as $k => $v) {
             $object = ['tip' => 'vo', 'index' => $k];
             if ($v->udalit) {
                 $object['udalit'] = 1;
             } else {
                 $object['udalit'] = 0;
             }
             $dataVidachi = date('Y-m-d', strtotime($v->dataVidachi));
             $obrazovanieFizLica = ObrazovanieFizLica::findOne($v->obrazovanieFizLicaId ? $v->obrazovanieFizLicaId : 0);
             if (!$obrazovanieFizLica) {
                 $obrazovanieFizLica = new ObrazovanieFizLica();
             }
             $obrazovanieFizLica->fiz_lico = $this->fizLicoId;
             $obrazovanieFizLica->dokument_ob_obrazovanii_tip = $v->tipDokumenta;
             $obrazovanieFizLica->dokument_ob_obrazovanii_seriya = $v->seriya;
             $obrazovanieFizLica->dokument_ob_obrazovanii_nomer = $v->nomer;
             $obrazovanieFizLica->dokument_ob_obrazovanii_data = $dataVidachi;
             $obrazovanieFizLica->kvalifikaciya = $v->kvalifikaciyaId;
             $obrazovanieFizLica->organizaciya = $v->organizaciyaId;
             if (!$v->kvalifikaciyaId and $v->kvalifikaciyaNazvanie) {
                 $object['novayaKvalifikaciya'] = $v->kvalifikaciyaNazvanie;
             } else {
                 $object['novayaKvalifikaciya'] = '';
             }
             if (!$v->organizaciyaId and $v->organizaciyaNazvanie) {
                 $object['novayaOrganizaciya'] = $v->organizaciyaNazvanie;
             } else {
                 $object['novayaOrganizaciya'] = '';
             }
             $obrazovanieFizLica->dokument_ob_obrazovanii_kopiya = $v->documentKopiya;
             if (!$obrazovanieFizLica->validate()) {
                 return false;
             }
             $object['obrazovanieFizLica'] = $obrazovanieFizLica;
             $obrazovanieDlyaZayavleniya = ObrazovanieDlyaZayavleniyaNaAttestaciyu::findOne($v->obrazovanieDlyaZayavleniyaId ? $v->obrazovanieDlyaZayavleniyaId : 0);
             if (!$obrazovanieDlyaZayavleniya) {
                 $obrazovanieDlyaZayavleniya = new ObrazovanieDlyaZayavleniyaNaAttestaciyu();
             }
             $obrazovanieDlyaZayavleniya->zayavlenie_na_attestaciyu = $this->id;
             $obrazovanieDlyaZayavleniya->obrazovanie_istochnik = $v->obrazovanieFizLicaId;
             $obrazovanieDlyaZayavleniya->dokument_ob_obrazovanii_tip = $v->tipDokumenta;
             $obrazovanieDlyaZayavleniya->dokument_ob_obrazovanii_seriya = $v->seriya;
             $obrazovanieDlyaZayavleniya->dokument_ob_obrazovanii_nomer = $v->nomer;
             $obrazovanieDlyaZayavleniya->dokument_ob_obrazovanii_data = $dataVidachi;
             $obrazovanieDlyaZayavleniya->dokument_ob_obrazovanii_kopiya = $v->documentKopiya;
             $obrazovanieDlyaZayavleniya->kvalifikaciya = $v->kvalifikaciyaId;
             $obrazovanieDlyaZayavleniya->organizaciya = $v->organizaciyaId;
             $object['obrazovanieDlyaZayavlaniya'] = $obrazovanieDlyaZayavleniya;
             $Obrazovaniya[] = $object;
         }
     }
     if ($this->kursy) {
         foreach ($this->kursy as $k => $v) {
             $object = ['tip' => 'kurs', 'index' => $k];
             if ($v->udalit) {
                 $object['udalit'] = 1;
             } else {
                 $object['udalit'] = 0;
             }
             $dataVidachi = date('Y-m-d', strtotime($v->dataVidachi));
             $obrazovanieFizLica = ObrazovanieFizLica::findOne($v->obrazovanieFizLicaId ? $v->obrazovanieFizLicaId : 0);
             if (!$obrazovanieFizLica) {
                 $obrazovanieFizLica = new ObrazovanieFizLica();
             }
             $obrazovanieFizLica->fiz_lico = $this->fizLicoId;
             $obrazovanieFizLica->dokument_ob_obrazovanii_tip = $v->tipDokumenta;
             $obrazovanieFizLica->dokument_ob_obrazovanii_data = $dataVidachi;
             $obrazovanieFizLica->organizaciya = $v->organizaciyaId;
             $obrazovanieFizLica->kurs_nazvanie = $v->kursNazvanie;
             $obrazovanieFizLica->kurs_chasy = $v->kursChasy;
             $obrazovanieFizLica->kurs_tip = $v->kursTip;
             $obrazovanieFizLica->dokument_ob_obrazovanii_kopiya = $v->documentKopiya;
             $obrazovanieFizLica->dokument_ob_obrazovanii_seriya = null;
             $obrazovanieFizLica->dokument_ob_obrazovanii_nomer = null;
             if (!$v->organizaciyaId and $v->organizaciyaNazvanie) {
                 $object['novayaOrganizaciya'] = $v->organizaciyaNazvanie;
             } else {
                 $object['novayaOrganizaciya'] = '';
             }
             $object['novayaKvalifikaciya'] = '';
             if (!$obrazovanieFizLica->validate()) {
                 return false;
             }
             $object['obrazovanieFizLica'] = $obrazovanieFizLica;
             $obrazovanieDlyaZayavleniya = ObrazovanieDlyaZayavleniyaNaAttestaciyu::findOne($v->obrazovanieDlyaZayavleniyaId ? $v->obrazovanieDlyaZayavleniyaId : 0);
             if (!$obrazovanieDlyaZayavleniya) {
                 $obrazovanieDlyaZayavleniya = new ObrazovanieDlyaZayavleniyaNaAttestaciyu();
             }
             $obrazovanieDlyaZayavleniya->zayavlenie_na_attestaciyu = $this->id;
             $obrazovanieDlyaZayavleniya->obrazovanie_istochnik = $v->obrazovanieFizLicaId;
             $obrazovanieDlyaZayavleniya->dokument_ob_obrazovanii_tip = $v->tipDokumenta;
             $obrazovanieDlyaZayavleniya->dokument_ob_obrazovanii_data = $dataVidachi;
             $obrazovanieDlyaZayavleniya->dokument_ob_obrazovanii_kopiya = $v->documentKopiya;
             $obrazovanieDlyaZayavleniya->organizaciya = $v->organizaciyaId;
             $obrazovanieDlyaZayavleniya->kurs_nazvanie = $v->kursNazvanie;
             $obrazovanieDlyaZayavleniya->kurs_chasy = $v->kursChasy;
             $obrazovanieDlyaZayavleniya->kurs_tip = $v->kursTip;
             $obrazovanieDlyaZayavleniya->dokument_ob_obrazovanii_nomer = null;
             $obrazovanieDlyaZayavleniya->dokument_ob_obrazovanii_seriya = null;
             $object['obrazovanieDlyaZayavlaniya'] = $obrazovanieDlyaZayavleniya;
             $Obrazovaniya[] = $object;
         }
     }
     $saveTransaction = RabotaFizLica::getDb()->transaction(function () use($zayavlenie, $Obrazovaniya) {
         //var_dump($zayavlenie->save(false));
         if (!$zayavlenie->save(false)) {
             var_dump('zayavl_error');
             return false;
         }
         $this->id = $zayavlenie->id;
         foreach ($Obrazovaniya as $k => $v) {
             if ($v['udalit']) {
                 if (!$v['obrazovanieDlyaZayavlaniya']->delete()) {
                     return false;
                 }
                 if ($v['tip'] == 'kurs') {
                     if (!$v['obrazovanieFizLica']->delete()) {
                         return false;
                     }
                 }
                 if ($v['tip'] == 'vo') {
                     unset($this->visshieObrazovaniya[$v['index']]);
                 } else {
                     unset($this->kursy[$v['index']]);
                 }
             } else {
                 if ($v['novayaKvalifikaciya']) {
                     $kvalifikaciya = new Kvalifikaciya(['nazvanie' => $v['novayaKvalifikaciya'], 'obschij' => false]);
                     if (!$kvalifikaciya->save(false)) {
                         var_dump('kvalifik_error');
                         return false;
                     }
                     $v['obrazovanieFizLica']->kvalifikaciya = $kvalifikaciya->id;
                     $v['obrazovanieDlyaZayavlaniya']->kvalifikaciya = $kvalifikaciya->id;
                 }
                 if ($v['novayaOrganizaciya']) {
                     $organizaciya = new Organizaciya(['nazvanie' => $v['novayaOrganizaciya'], 'obschij' => false, 'etapy_obrazovaniya' => '{' . \app\enums\EtapObrazovaniya::VYSSHEE_PROFESSIONALNOE_OBRAZOVANIE . '}']);
                     if (!$organizaciya->save(false)) {
                         var_dump('orghanizac_error');
                         return false;
                     }
                     $v['obrazovanieFizLica']->organizaciya = $organizaciya->id;
                     $v['obrazovanieDlyaZayavlaniya']->organizaciya = $organizaciya->id;
                 }
                 if (!$v['obrazovanieFizLica']->validate()) {
                     return false;
                 }
                 if (!$v['obrazovanieFizLica']->save(false)) {
                     var_dump('obrfl_error');
                     return false;
                 }
                 if ($v['tip'] == 'vo') {
                     $this->visshieObrazovaniya[$v['index']]->obrazovanieFizLicaId = $v['obrazovanieFizLica']->id;
                 } else {
                     $this->kursy[$v['index']]->obrazovanieFizLicaId = $v['obrazovanieFizLica']->id;
                 }
                 $v['obrazovanieDlyaZayavlaniya']->obrazovanie_istochnik = $v['obrazovanieFizLica']->id;
                 $v['obrazovanieDlyaZayavlaniya']->zayavlenie_na_attestaciyu = $zayavlenie->id;
                 if (!$v['obrazovanieDlyaZayavlaniya']->validate()) {
                     return false;
                 }
                 if (!$v['obrazovanieDlyaZayavlaniya']->save(false)) {
                     var_dump('obrzZayavl_error');
                     return false;
                 }
                 if ($v['tip'] == 'vo') {
                     $this->visshieObrazovaniya[$v['index']]->obrazovanieDlyaZayavleniyaId = $v['obrazovanieDlyaZayavlaniya']->id;
                 } else {
                     $this->kursy[$v['index']]->obrazovanieDlyaZayavleniyaId = $v['obrazovanieDlyaZayavlaniya']->id;
                 }
             }
         }
         foreach ($this->otraslevoeSoglashenie as $key => $item) {
             /**
              * @var OtraslevoeSoglashenie $item
              */
             $item->zayavlenieNaAttestaciyu = $this->id;
             if ($savedItem = $item->save()) {
                 if ($item->udalit) {
                     unset($this->otraslevoeSoglashenie[$key]);
                 } else {
                     $item->id = $savedItem->id;
                 }
             } else {
                 var_dump('os_error');
                 return false;
             }
         }
         return true;
     });
     if (!$saveTransaction) {
         return false;
     }
     return true;
 }