function testNullDate()
 {
     $emp = new Employe(array('firstname' => 'Steve', 'lastname' => 'Austin'));
     $emp->save();
     $emp = SActiveStore::findFirst('Employe');
     $this->assertNull($emp->date_of_birth);
 }
 function testAssignmentBeforeEitherSaved()
 {
     $employe = new Employe(array('lastname' => 'Max', 'firstname' => 'Payne'));
     $profile = new Profile(array('cv' => 'Lone private'));
     $profile->employe = $employe;
     $this->assertTrue($profile->isNewRecord());
     $this->assertTrue($employe->isNewRecord());
     $profile->save();
     $this->assertFalse($profile->isNewRecord());
     $this->assertFalse($employe->isNewRecord());
     $this->assertEqual($employe, $profile->employe);
     $this->assertEqual($employe, $profile->employe(True));
 }
Esempio n. 3
0
    public function update(Employe $employe)
    {
        $query = $this->_db->prepare(' UPDATE t_employe SET 
		nom=:nom, adresse=:adresse, nomArabe=:nomArabe, adresseArabe=:adresseArabe, cin=:cin, telephone=:telephone, updated=:updated, updatedBy=:updatedBy
		WHERE id=:id') or die(print_r($this->_db->errorInfo()));
        $query->bindValue(':id', $employe->id());
        $query->bindValue(':nom', $employe->nom());
        $query->bindValue(':adresse', $employe->adresse());
        $query->bindValue(':nomArabe', $employe->nomArabe());
        $query->bindValue(':adresseArabe', $employe->adresseArabe());
        $query->bindValue(':cin', $employe->cin());
        $query->bindValue(':telephone', $employe->telephone());
        $query->bindValue(':updated', $employe->updated());
        $query->bindValue(':updatedBy', $employe->updatedBy());
        $query->execute();
        $query->closeCursor();
    }
 public function actionUploadSignatureFile()
 {
     $model = new FileManage();
     if ($model->load(Yii::$app->request->post())) {
         //if($model->validate()){
         $model->USER_ID = Yii::$app->user->identity->username;
         $model->FILE_PATH = 'signature';
         $exportFile = $model->uploadFile();
         //$base64File = \yii\web\UploadedFile::getInstance($model, 'uploadDataFile');
         // $dateFile=\yii\web\UploadedFile::getInstanceByName($fileName);
         $exportFile64 = $this->saveimage(file_get_contents($exportFile->tempName));
         $exportFile64Image = 'data:image/jpg;charset=utf-8;base64,' . $exportFile64;
         $model->FILE_NM64 = $exportFile64Image;
         //print_r($exportFile64);
         //die();
         if ($model->save()) {
             //upload only if valid uploaded file instance found
             if ($exportFile !== false) {
                 $path = $model->getImageFile();
                 $exportFile->saveAs($path);
                 $employeUpdate = Employe::find()->where(['EMP_ID' => Yii::$app->user->identity->EMP_ID])->one();
                 $employeUpdate->SIGSVGBASE64 = $exportFile64Image;
                 $employeUpdate->save();
                 return $this->redirect(['index']);
             }
         }
         //}
     }
 }
 public function cari($params)
 {
     $empId = Yii::$app->user->identity->EMP_ID;
     $dt = Employe::find()->where(['EMP_ID' => $empId])->all();
     $crp = $dt[0]['EMP_CORP_ID'];
     if ($dt[0]['JAB_ID'] == 'MGR') {
         $query = Requesttermheader::find()->where("t0001header.STATUS <> 3 and t0001header.STATUS <> 0 and t0001header.KD_CORP = '{$crp}' ");
     } else {
         $query = Requesttermheader::find()->where("t0001header.STATUS <> 3 and t0001header.STATUS <> 0 and t0001header.KD_CORP = '{$crp}' and t0001header.ID_USER = '******' ");
     }
     $query->joinWith(['employe' => function ($q) {
         $q->where('a0001.EMP_NM LIKE "%' . $this->nmemp . '%"');
     }]);
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $dataProvider->setSort(['attributes' => ['KD_RIB', 'KD_CORP', 'nmemp' => ['asc' => ['a0001.EMP_NM' => SORT_ASC], 'desc' => ['a0001.EMP_NM' => SORT_DESC], 'label' => 'Pembuat']]]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['like', 'a0001.EMP_NM', $this->EMP_NM])->andFilterWhere(['like', 'KD_RIB', $this->KD_RIB])->andFilterWhere(['like', 'KD_CORP', $this->KD_CORP]);
     return $dataProvider;
 }
Esempio n. 6
0
 protected function findModel1($id)
 {
     if (($model = Employe::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Esempio n. 7
0
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      Employe $value A Employe object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(Employe $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }
Esempio n. 8
0
 /**
  * Declares an association between this object and a Employe object.
  *
  * @param      Employe $v
  * @return     Intervention The current object (for fluent API support)
  * @throws     PropelException
  */
 public function setEmploye(Employe $v = null)
 {
     if ($v === null) {
         $this->setEmployeId(NULL);
     } else {
         $this->setEmployeId($v->getId());
     }
     $this->aEmploye = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the Employe object, it will not be re-added.
     if ($v !== null) {
         $v->addIntervention($this);
     }
     return $this;
 }