public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         Repair::create([]);
     }
 }
예제 #2
0
 public function actionUpdateAjax($id)
 {
     $modelRepair = Repair::model()->find('order_id=:order_id', array(':order_id' => $id));
     if (empty($modelRepair)) {
         $modelRepair = new Repair();
         $modelRepair->order_id = $id;
     }
     if (isset($_POST['RepairWork'])) {
         $modelRepairWork = RepairWork::model()->find('repair_id=:repair_id AND work_id=:work_id', array(':repair_id' => $modelRepair->id, ':work_id' => $_POST['RepairWork']['work_id']));
         if (empty($modelRepairWork)) {
             $modelRepairWork = new RepairWork();
             $modelRepairWork->repair_id = $modelRepair->id;
             $modelRepairWork->user_id = Yii::app()->user->id;
             $modelRepairWork->date_hour = date('Y-m-d H:i:s');
             $modelRepairWork->work_id = $_POST['RepairWork']['work_id'];
             $modelRepairWork->validate();
             $modelRepairWork->save(false);
         }
     }
     if (isset($_POST['Repair'])) {
         $modelRepair->attributes = $_POST['Repair'];
         $modelRepair->save();
         if ($modelRepair->finished == 1) {
             $this->redirect(array('view', 'id' => $modelRepair->id));
         }
     }
 }
예제 #3
0
 public function actionGetRepairEnd()
 {
     $this->checkLogin();
     if (!empty($_POST)) {
         $repair_id = Util::input($_POST['repair_id']);
         $repair = Repair::model()->findByPk((int) $repair_id);
         $repair->user_id = (int) Util::input($_POST['user_id']);
         $repair->branch_id = (int) Util::input($_POST['hidden_branch_id']);
         $repair->product_code = Util::input($_POST['product_code']);
         $repair->repair_date = Util::thaiToMySQLDate(Util::input($_POST['repair_date']));
         $repair->repair_problem = Util::input($_POST['repair_problem']);
         $repair->repair_price = Util::input($_POST['repair_price']);
         $repair->repair_type = Util::input($_POST['repair_type']);
         $repair->repair_original = Util::input($_POST['repair_original']);
         $repair->repair_detail = Util::input($_POST['repair_detail']);
         $repair->repair_created_date = Util::thaiToMySQLDate(Util::input($_POST['repair_created_date']));
         $repair->repair_status = Util::input($_POST['repair_status']);
         $repair->repair_group = 'external';
         $repair->repair_tel = Util::input($_POST['repair_tel']);
         $repair->repair_name = Util::input($_POST['repair_name']);
         $repair->repair_product_name = Util::input($_POST['repair_product_name']);
         $repair->repair_end_date = new CDbExpression('NOW()');
         if ($repair->save()) {
             echo 'success';
         }
     }
 }
 public function actionPrintBillPayGetRepair($repair_id)
 {
     $repair = Repair::model()->findByPk((int) $repair_id);
     $org = Organization::model()->find();
     $repair->repair_date = Util::mysqlToThaiDate($repair->repair_date);
     $repair->repair_created_date = Util::mysqlToThaiDate($repair->repair_created_date);
     $repair->repair_price = number_format($repair->repair_price, 2);
     $this->renderPartial('//Report/PrintBillPayGetRepair', array('repair' => $repair, 'org' => $org));
 }
 /**
  * Remove the specified repair from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     if (!Sentry::getUser()) {
         return Redirect::route('sessions.create');
     }
     Repair::destroy($id);
     return Redirect::route('repairs.index');
 }
예제 #6
0
 public function loadModel($id)
 {
     $model = Repair::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
예제 #7
0
 public static function run()
 {
     $datas = self::datas();
     $parameters = $datas['parameters'];
     $page = $datas['page'];
     $isFile = $datas['isFile'];
     $function = $datas['function'];
     // TAMPONLAMA BAŞLATILIYOR...
     if (Config::get('Cache', 'obGzhandler') && substr_count(server('acceptEncoding'), 'gzip')) {
         ob_start('ob_gzhandler');
     } else {
         ob_start();
     }
     // ----------------------------------------------------------------------
     // BAŞLIK BİLGİLERİ DÜZENLENİYOR...
     headers(Config::get('Headers', 'settings'));
     // ----------------------------------------------------------------------
     // SAYFA KONTROLÜ YAPILIYOR...
     // -------------------------------------------------------------------------------
     //  Sayfa bilgisine erişilmişse sayfa dahil edilir.
     // -------------------------------------------------------------------------------
     if (file_exists($isFile)) {
         // -------------------------------------------------------------------------------
         //  Tadilat modu açıksa bu ayarlar geçerli olacaktır.
         // -------------------------------------------------------------------------------
         if (Config::get('Repair', 'mode') === true) {
             Repair::mode();
         }
         // -------------------------------------------------------------------------------
         //  Sayfa dahil ediliyor.
         // -------------------------------------------------------------------------------
         require_once $isFile;
         // -------------------------------------------------------------------------------
         // Sayfaya ait controller nesnesi oluşturuluyor.
         // -------------------------------------------------------------------------------
         if (class_exists($page, false)) {
             $var = new $page();
             // -------------------------------------------------------------------------------
             // Sınıf ve yöntem bilgileri geçerli ise sayfayı çalıştır.
             // -------------------------------------------------------------------------------
             if (is_callable(array($var, $function))) {
                 if (APP_TYPE === 'local') {
                     set_error_handler('Exceptions::table');
                 }
                 call_user_func_array(array($var, $function), $parameters);
                 if (APP_TYPE === 'local') {
                     restore_error_handler();
                 }
             } else {
                 // Sayfa bilgisine erişilemezse hata bildir.
                 if (!Config::get('Route', 'show404')) {
                     // Hatayı ekrana yazdır.
                     echo Error::message('Error', 'callUserFuncArrayError', $function);
                     // Hatayı rapor et.
                     report('Error', getMessage('Error', 'callUserFuncArrayError'), 'SystemCallUserFuncArrayError');
                     // Çalışmayı durdur.
                     return false;
                 } else {
                     redirect(Config::get('Route', 'show404'));
                 }
             }
         }
     } else {
         // Sayfa bilgisine erişilemezse hata bildir.
         if (Config::get('Route', 'show404')) {
             redirect(Config::get('Route', 'show404'));
         } else {
             // Hatayı ekrana yazdır.
             echo Error::message('Error', 'notIsFileError', $isFile);
             // Hatayı rapor et.
             report('Error', getMessage('Error', 'notIsFileError'), 'SystemNotIsFileError');
             // Çalışmayı durdur.
             return false;
         }
     }
     // ----------------------------------------------------------------------
     // TAMPONLAMA KAPATILIYOR...
     ob_end_flush();
     // ----------------------------------------------------------------------
 }
예제 #8
0
 public static function run()
 {
     /* Page Değişkeni
      *
      * Controller/page.php bilgisini
      * tutması çin oluşturulmuştur.
      */
     $page = '';
     /* Function Değişkeni
      *
      * Page/Function bilgisini
      * tutaması için oluşturulmuştur.
      */
     $function = 'index';
     /* Parameters Dizi Değişkeni
      *
      * Url adresindeki parametre bilgilerini
      * tutması için oluşturulmuştur.
      */
     $parameters = array();
     /* Segments Değişkeni
      *
      * Url adresinin parametre bölümlerini
      * tutması için oluşturulmuştur.
      */
     $segments = '';
     /* Is Fıle Değişkeni
      *
      * Girilen Url adresinin geçerli bir.
      * sayfa olma durumun kontrol etmesi için oluşturulmuştur.
      */
     $isFile = '';
     /* Request Uri Değişkeni
      *
      * Ziyaretçi URL adresini
      * tutması için oluşturulmuştur.
      */
     $requestUri = requestUri();
     // -------------------------------------------------------------------------------
     //  $_GET kontrolü yapılarak temel URL bilgisi elde ediliyor.
     // -------------------------------------------------------------------------------
     $url = explode('?', $requestUri);
     // -------------------------------------------------------------------------------
     //  Temel URL adresi / karakteri ile bölümlere ayrılıyor.
     // -------------------------------------------------------------------------------
     $segments = explode('/', $url[0]);
     // -------------------------------------------------------------------------------
     //  Controller/Sayfa: Controller/ dizini içinde çalıştırılacak dosya adı.
     // -------------------------------------------------------------------------------
     if (isset($segments[0])) {
         $page = $segments[0];
         $isFile = CONTROLLERS_DIR . suffix($page, '.php');
         unset($segments[0]);
         // Bir Controller/ dosyası index kelimesi ile isimlendirilemez!
         if (strtolower($page) === 'index') {
             // Hatayı ekrana yazdır.
             echo Error::message('Error', 'controllerNameError', $page);
             // Hatayı rapor et.
             report('Error', getMessage('Error', 'controllerNameError'), 'ControllerNameError');
             // Çalışmayı durdur.
             return false;
         }
     }
     // -------------------------------------------------------------------------------
     //  Fonksiyon: Çalıştırılacak dosyaya ait yöntem adı.
     // -------------------------------------------------------------------------------
     if (isset($segments[1])) {
         $function = $segments[1];
         unset($segments[1]);
     }
     // -------------------------------------------------------------------------------
     //  Parametreler: Çalıştırılacak yönteme gönderilecek parametreler.
     // -------------------------------------------------------------------------------
     if (isset($segments[2])) {
         $parameters = $segments;
     }
     // ----------------------------------------------------------------------
     // TAMPONLAMA BAŞLATILIYOR...
     if (Config::get('Cache', 'obGzhandler') && substr_count(server('acceptEncoding'), 'gzip')) {
         ob_start('ob_gzhandler');
     } else {
         ob_start();
     }
     // ----------------------------------------------------------------------
     // BAŞLIK BİLGİLERİ DÜZENLENİYOR...
     headers(Config::get('Headers', 'settings'));
     // ----------------------------------------------------------------------
     // SAYFA KONTROLÜ YAPILIYOR...
     // -------------------------------------------------------------------------------
     //  Sayfa bilgisine erişilmişse sayfa dahil edilir.
     // -------------------------------------------------------------------------------
     if (file_exists($isFile)) {
         // -------------------------------------------------------------------------------
         //  Tadilat modu açıksa bu ayarlar geçerli olacaktır.
         // -------------------------------------------------------------------------------
         if (Config::get('Repair', 'mode')) {
             Repair::mode();
         }
         // -------------------------------------------------------------------------------
         //  Sayfa dahil ediliyor.
         // -------------------------------------------------------------------------------
         require_once $isFile;
         // -------------------------------------------------------------------------------
         // Sayfaya ait controller nesnesi oluşturuluyor.
         // -------------------------------------------------------------------------------
         $var = new $page();
         // -------------------------------------------------------------------------------
         // Sınıf ve yöntem bilgileri geçerli ise sayfayı çalıştır.
         // -------------------------------------------------------------------------------
         if (is_callable(array($var, $function))) {
             if (APP_TYPE === 'local') {
                 set_error_handler('Exceptions::table');
             }
             call_user_func_array(array($var, $function), $parameters);
             if (APP_TYPE === 'local') {
                 restore_error_handler();
             }
         } else {
             // Sayfa bilgisine erişilemezse hata bildir.
             if (!Config::get('Route', 'show404')) {
                 // Hatayı ekrana yazdır.
                 echo Error::message('Error', 'callUserFuncArrayError', $function);
                 // Hatayı rapor et.
                 report('Error', getMessage('Error', 'callUserFuncArrayError'), 'SystemCallUserFuncArrayError');
                 // Çalışmayı durdur.
                 return false;
             } else {
                 redirect(Config::get('Route', 'show404'));
             }
         }
     } else {
         // Sayfa bilgisine erişilemezse hata bildir.
         if (Config::get('Route', 'show404')) {
             redirect(Config::get('Route', 'show404'));
         } else {
             // Hatayı ekrana yazdır.
             echo Error::message('Error', 'notIsFileError', $isFile);
             // Hatayı rapor et.
             report('Error', getMessage('Error', 'notIsFileError'), 'SystemNotIsFileError');
             // Çalışmayı durdur.
             return false;
         }
     }
     // ----------------------------------------------------------------------
     // TAMPONLAMA KAPATILIYOR...
     ob_end_flush();
     // ----------------------------------------------------------------------
 }
예제 #9
0
 public function actionCreateAccesoryOrder()
 {
     $modelRepair = Repair::model()->find('order_id=:order_id', array(':order_id' => $id));
     if (empty($modelRepair)) {
         $modelRepair = new Repair();
         $modelRepair->order_id = $id;
         $modelRepair->description = $_POST['Repair']['description'];
         $modelRepair->finished = $_POST['Repair']['finished'];
         $modelRepair->save();
     }
     if (isset($_POST['RepairWork'])) {
         $modelRepairWork = RepairWork::model()->find('repair_id=:repair_id AND work_id=:work_id', array(':repair_id' => $modelRepair->id, ':work_id' => $_POST['RepairWork']['work_id']));
         if (empty($modelRepairWork)) {
             $modelRepairWork = new RepairWork();
             $modelRepairWork->repair_id = $modelRepair->id;
             $modelRepairWork->user_id = Yii::app()->user->id;
             $modelRepairWork->date_hour = date('Y-m-d H:i:s');
             $modelRepairWork->work_id = $_POST['RepairWork']['work_id'];
             $modelRepairWork->validate();
             $modelRepairWork->save(false);
         }
     }
 }
예제 #10
0
 public function getDeleteRepairHistory($id)
 {
     $repair = Repair::find($id);
     $audit = AuditTrail::create(['user_id' => Auth::id(), 'role' => 'Property Management Admin', 'action' => 'printed the list of assigned properties.']);
     if (!$repair) {
         App::abort(404);
     }
     $repair->delete();
     // $audit = AuditTrail::create([
     // 'user_id'	=>	Auth::id(),
     // 'role'		=>  'Employee Management Admin',
     // 'action'	=>	'deleted USER "'.$user->firstname.' '.$user->lastname.'".'
     // ]);
     return Redirect::route('repair-history', $repair->property->id)->with('alert', 'success|Repair entry has been deleted');
 }
예제 #11
0
 /**
  * Remove the specified repair from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     Repair::destroy($id);
     return Redirect::route('repairs.index');
 }