@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | DB::table('uploads') |
| 101 | 101 | ->where('id', $id) |
| 102 | 102 | ->update(['is_processed' => 0]); |
| 103 | - }elseif ($action == 200) { |
|
| 103 | + } elseif ($action == 200) { |
|
| 104 | 104 | DB::table('uploads') |
| 105 | 105 | ->where('id', $id) |
| 106 | 106 | ->update(['is_processed' => 4]); |
@@ -117,8 +117,7 @@ discard block |
||
| 117 | 117 | return Response::download($file_path, Auth::user()->openemis_no.'_'.$filename.$version, [ |
| 118 | 118 | 'Content-Length: '. filesize($file_path) |
| 119 | 119 | ]); |
| 120 | - } |
|
| 121 | - else |
|
| 120 | + } else |
|
| 122 | 121 | { |
| 123 | 122 | return View::make('errors.404'); |
| 124 | 123 | } |
@@ -137,8 +136,7 @@ discard block |
||
| 137 | 136 | return Response::download($file_path, $filename, [ |
| 138 | 137 | 'Content-Length: '. filesize($file_path) |
| 139 | 138 | ]); |
| 140 | - } |
|
| 141 | - else |
|
| 139 | + } else |
|
| 142 | 140 | { |
| 143 | 141 | abort(404, 'We did not found an error file.'); |
| 144 | 142 | } |
@@ -152,8 +150,7 @@ discard block |
||
| 152 | 150 | return Response::download($file_path, $filename, [ |
| 153 | 151 | 'Content-Length: '. filesize($file_path) |
| 154 | 152 | ]); |
| 155 | - } |
|
| 156 | - else |
|
| 153 | + } else |
|
| 157 | 154 | { |
| 158 | 155 | |
| 159 | 156 | abort(404, 'We did not found an error file.'); |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | } |
| 151 | 151 | } |
| 152 | 152 | return $row; |
| 153 | - }catch (Exception $e){ |
|
| 153 | + } catch (Exception $e){ |
|
| 154 | 154 | $error = \Illuminate\Validation\ValidationException::withMessages([]); |
| 155 | 155 | $failure = new Failure(3, 'remark', [0 => 'Template is not valid for upload, use the template given in the system'], [null]); |
| 156 | 156 | $failures = [0 => $failure]; |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | protected function checkKeys($key,$count,$row){ |
| 197 | 197 | if(array_key_exists($key,$row)){ |
| 198 | 198 | return true; |
| 199 | - }else{ |
|
| 199 | + } else{ |
|
| 200 | 200 | $error = \Illuminate\Validation\ValidationException::withMessages([]); |
| 201 | 201 | $failure = new Failure($count, 'remark', [0 => 'Template is not valid for upload, use the template given in the system'. $key ,' Is missing form the template'], [null]); |
| 202 | 202 | $failures = [0 => $failure]; |
@@ -423,8 +423,9 @@ |
||
| 423 | 423 | } |
| 424 | 424 | |
| 425 | 425 | protected function insertSubject($subject){ |
| 426 | - if(!Institution_subject_student::isDuplicated($subject)) |
|
| 427 | - Institution_subject_student::updateOrInsert($subject); |
|
| 426 | + if(!Institution_subject_student::isDuplicated($subject)) { |
|
| 427 | + Institution_subject_student::updateOrInsert($subject); |
|
| 428 | + } |
|
| 428 | 429 | } |
| 429 | 430 | |
| 430 | 431 | |
@@ -87,12 +87,12 @@ discard block |
||
| 87 | 87 | } |
| 88 | 88 | return true; |
| 89 | 89 | } |
| 90 | - }else{ |
|
| 90 | + } else{ |
|
| 91 | 91 | $this->_custom_messages['bmi'] = $attribute.' is required for '. $educationGrade->name; |
| 92 | 92 | $this->_set_custom_stuff(); |
| 93 | 93 | return false; |
| 94 | 94 | } |
| 95 | - }else{ |
|
| 95 | + } else{ |
|
| 96 | 96 | return true; |
| 97 | 97 | } |
| 98 | 98 | } |
@@ -125,10 +125,10 @@ discard block |
||
| 125 | 125 | $check = Institution_class_student::where('student_id', '=', $student['id'])->where('institution_class_id','=',$perameters[0])->count(); |
| 126 | 126 | if($check == 1){ |
| 127 | 127 | return true; |
| 128 | - }else{ |
|
| 128 | + } else{ |
|
| 129 | 129 | return false; |
| 130 | 130 | } |
| 131 | - }else{ |
|
| 131 | + } else{ |
|
| 132 | 132 | return false; |
| 133 | 133 | } |
| 134 | 134 | |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | $this->_custom_messages['nic'] = $attribute. ' is not valid, Please check the NIC number'; |
| 140 | 140 | $this->_set_custom_stuff(); |
| 141 | 141 | return false; |
| 142 | - }else{ |
|
| 142 | + } else{ |
|
| 143 | 143 | return true; |
| 144 | 144 | } |
| 145 | 145 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | if (!empty($isAvailableforPromotion)) { |
| 82 | 82 | $this->process($institutionGrade,$nextGrade,$year,1); |
| 83 | - }else{ |
|
| 83 | + } else{ |
|
| 84 | 84 | $this->process($institutionGrade,$nextGrade,$year,3); |
| 85 | 85 | } |
| 86 | 86 | } |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | array_walk($studentListToPromote,array($this,'assingeToClasses'),$params); |
| 128 | 128 | array_walk($parallelClasses,array($this,'updateStudentCount')); |
| 129 | 129 | } |
| 130 | - }catch (\Exception $e){ |
|
| 130 | + } catch (\Exception $e){ |
|
| 131 | 131 | dd($e); |
| 132 | 132 | Log::error($e->getMessage()); |
| 133 | 133 | } |
@@ -166,20 +166,20 @@ discard block |
||
| 166 | 166 | // promote parallel classes |
| 167 | 167 | $this->promotion($institutionGrade,$nextGrade,$academicPeriod,$nextAcademicPeriod,$nextGradeObj->toArray(),1); |
| 168 | 168 | return 1; |
| 169 | - }elseif (($nextGradeObj->count() > 1) && ($nextGradeObj->count() !== $currentGradeObj->count())){ |
|
| 169 | + } elseif (($nextGradeObj->count() > 1) && ($nextGradeObj->count() !== $currentGradeObj->count())){ |
|
| 170 | 170 | // promote pool promotion |
| 171 | 171 | $this->promotion($institutionGrade,$nextGrade,$academicPeriod,$nextAcademicPeriod,[],1); |
| 172 | 172 | return 2; |
| 173 | - }elseif(($nextGradeObj->count() > 1) && $currentGradeObj->count() == $nextGradeObj->count()){ |
|
| 173 | + } elseif(($nextGradeObj->count() > 1) && $currentGradeObj->count() == $nextGradeObj->count()){ |
|
| 174 | 174 | // Promote matching class name with previous class |
| 175 | 175 | $this->promotion($institutionGrade,$nextGrade,$academicPeriod,$nextAcademicPeriod,$nextGradeObj->toArray(),1); |
| 176 | 176 | return 1; |
| 177 | - }else{ |
|
| 177 | + } else{ |
|
| 178 | 178 | // default pool promotion |
| 179 | 179 | $this->promotion($institutionGrade,$nextGrade,$academicPeriod,$nextAcademicPeriod,[],1); |
| 180 | 180 | return 2; |
| 181 | 181 | } |
| 182 | - }else{ |
|
| 182 | + } else{ |
|
| 183 | 183 | // default pool promotion |
| 184 | 184 | $this->promotion($institutionGrade,$nextGrade,$academicPeriod,$nextAcademicPeriod,[],3); |
| 185 | 185 | return 2; |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | $output = new \Symfony\Component\Console\Output\ConsoleOutput(); |
| 217 | 217 | $output->writeln('----------------- '. $student['admission_id'] . ' to ' . $studentData['education_grade_id']); |
| 218 | 218 | |
| 219 | - }catch (\Exception $e){ |
|
| 219 | + } catch (\Exception $e){ |
|
| 220 | 220 | dd($e); |
| 221 | 221 | Log::error($e->getMessage()); |
| 222 | 222 | } |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | $studentClass = $this->institution_class_students->getStudentNewClass($student); |
| 237 | 237 | if(!is_null($studentClass)){ |
| 238 | 238 | return array_search(str_replace($educationGrade['name'],$nextGrade->name,$studentClass->name),array_column($classes,'name')); |
| 239 | - }else{ |
|
| 239 | + } else{ |
|
| 240 | 240 | return false; |
| 241 | 241 | } |
| 242 | 242 | |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | $this->institution_class_students->create($studentObj); |
| 281 | 281 | $output = new \Symfony\Component\Console\Output\ConsoleOutput(); |
| 282 | 282 | $output->writeln('----------------- '. $student['student_id']. 'to ' . $class['name']); |
| 283 | - }else{ |
|
| 283 | + } else{ |
|
| 284 | 284 | $this->institution_class_students->where('id',(string)$student['id'])->update($studentObj); |
| 285 | 285 | $output = new \Symfony\Component\Console\Output\ConsoleOutput(); |
| 286 | 286 | $output->writeln('----------------- '. $student['student_id']. 'to ' . $class['name']); |
@@ -50,14 +50,14 @@ |
||
| 50 | 50 | unset($files); |
| 51 | 51 | exit(); |
| 52 | 52 | |
| 53 | - }else{ |
|
| 53 | + } else{ |
|
| 54 | 54 | $output = new \Symfony\Component\Console\Output\ConsoleOutput(); |
| 55 | 55 | $output->writeln('No files found,Waiting for files'); |
| 56 | 56 | exit(); |
| 57 | 57 | |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - }catch (Exception $e){ |
|
| 60 | + } catch (Exception $e){ |
|
| 61 | 61 | $output = new \Symfony\Component\Console\Output\ConsoleOutput(); |
| 62 | 62 | $output->writeln($e); |
| 63 | 63 | sleep(300); |
@@ -109,7 +109,7 @@ |
||
| 109 | 109 | # # |
| 110 | 110 | ####################################################' ); |
| 111 | 111 | // $output->writeln(); |
| 112 | - }catch (\Exception $e){ |
|
| 112 | + } catch (\Exception $e){ |
|
| 113 | 113 | // echo $e->getMessage(); |
| 114 | 114 | $output->writeln( $e->getMessage()); |
| 115 | 115 | } |
@@ -112,12 +112,12 @@ discard block |
||
| 112 | 112 | $this->output->writeln('##########################################################################################################################'); |
| 113 | 113 | $this->output->writeln('updating from '. $shiftId); |
| 114 | 114 | |
| 115 | - }catch (\Exception $e){ |
|
| 115 | + } catch (\Exception $e){ |
|
| 116 | 116 | Log::error($e->getMessage(),[$e]); |
| 117 | 117 | } |
| 118 | 118 | } |
| 119 | 119 | // DB::commit(); |
| 120 | - }catch (\Exception $e){ |
|
| 120 | + } catch (\Exception $e){ |
|
| 121 | 121 | // DB::rollBack(); |
| 122 | 122 | Log::error($e->getMessage(),[$e]); |
| 123 | 123 | } |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | unset($subjects['total_female_students']); |
| 138 | 138 | unset($subjects['id']); |
| 139 | 139 | $classSubject = Institution_subject::create($subjects); |
| 140 | - }catch (\Exception $e){ |
|
| 140 | + } catch (\Exception $e){ |
|
| 141 | 141 | Log::error($e->getMessage(),[$e]); |
| 142 | 142 | } |
| 143 | 143 | } |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | $params['class'] = $class; |
| 181 | 181 | $this->insertInstitutionClassSubjects($institutionSubjects,$class); |
| 182 | 182 | // array_walk($classSubjects,array($this,'insertInstitutionClassSubjects'),$params); |
| 183 | - }catch (\Exception $e){ |
|
| 183 | + } catch (\Exception $e){ |
|
| 184 | 184 | Log::error($e->getMessage(),[$e]); |
| 185 | 185 | } |
| 186 | 186 | } |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | try{ |
| 191 | 191 | array_walk($subjects,array($this,'insertClassSubjects'),$class); |
| 192 | 192 | $this->output->writeln('updating subjects '. $class->name); |
| 193 | - }catch (\Exception $e){ |
|
| 193 | + } catch (\Exception $e){ |
|
| 194 | 194 | Log::error($e->getMessage(),[$e]); |
| 195 | 195 | } |
| 196 | 196 | }; |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | if(!$this->institution_class_subjects->isDuplicated($subjectobj)){ |
| 209 | 209 | $this->institution_class_subjects->create($subjectobj); |
| 210 | 210 | } |
| 211 | - }catch (\Exception $e){ |
|
| 211 | + } catch (\Exception $e){ |
|
| 212 | 212 | Log::error($e->getMessage(),[$e]); |
| 213 | 213 | } |
| 214 | 214 | } |
@@ -70,21 +70,21 @@ discard block |
||
| 70 | 70 | unset($files); |
| 71 | 71 | exit(); |
| 72 | 72 | |
| 73 | - }else{ |
|
| 73 | + } else{ |
|
| 74 | 74 | $output = new \Symfony\Component\Console\Output\ConsoleOutput(); |
| 75 | 75 | $this->output->writeln('No files found,Waiting for files'); |
| 76 | 76 | exit(); |
| 77 | 77 | |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - }catch (Exception $e){ |
|
| 80 | + } catch (Exception $e){ |
|
| 81 | 81 | $output = new \Symfony\Component\Console\Output\ConsoleOutput(); |
| 82 | 82 | $this->output->writeln($e); |
| 83 | 83 | sleep(300); |
| 84 | 84 | $this->handle(); |
| 85 | 85 | |
| 86 | 86 | } |
| 87 | - }else{ |
|
| 87 | + } else{ |
|
| 88 | 88 | exit(); |
| 89 | 89 | } |
| 90 | 90 | } |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | $output = new \Symfony\Component\Console\Output\ConsoleOutput(); |
| 206 | 206 | $this->output->writeln('Processing from:' . $node); |
| 207 | 207 | return true; |
| 208 | - }else{ |
|
| 208 | + } else{ |
|
| 209 | 209 | exit; |
| 210 | 210 | return false; |
| 211 | 211 | } |
@@ -321,11 +321,11 @@ discard block |
||
| 321 | 321 | ->update(['insert' => 3,'updated_at' => now()]); |
| 322 | 322 | $this->processFailedEmail($file,$user,'Fresh Student Data Upload:Partial Success '); |
| 323 | 323 | $this->stdOut('Insert Students',$this->higestRow); |
| 324 | - }else{ |
|
| 324 | + } else{ |
|
| 325 | 325 | $this->processSuccessEmail($file,$user,'Fresh Student Data Upload:Success '); |
| 326 | 326 | $this->stdOut('Insert Students',$this->higestRow); |
| 327 | 327 | } |
| 328 | - }else if(($this->getSheetName($file,'Insert Students')) && $this->higestRow > 0) { |
|
| 328 | + } else if(($this->getSheetName($file,'Insert Students')) && $this->higestRow > 0) { |
|
| 329 | 329 | DB::table('uploads') |
| 330 | 330 | ->where('id', $file['id']) |
| 331 | 331 | ->update(['is_processed' => 2]); |
@@ -347,11 +347,11 @@ discard block |
||
| 347 | 347 | ->update(['update' => 3,'is_processed' => 1,'updated_at' => now()]); |
| 348 | 348 | $this->processFailedEmail($file,$user,'Existing Student Data Update:Partial Success '); |
| 349 | 349 | $this->stdOut('Update Students',$this->higestRow); |
| 350 | - }else{ |
|
| 350 | + } else{ |
|
| 351 | 351 | $this->processSuccessEmail($file,$user, 'Existing Student Data Update:Success '); |
| 352 | 352 | $this->stdOut('Update Students',$this->higestRow); |
| 353 | 353 | } |
| 354 | - }else if(($this->getSheetName($file,'Update Students')) && $this->higestRow == 0) { |
|
| 354 | + } else if(($this->getSheetName($file,'Update Students')) && $this->higestRow == 0) { |
|
| 355 | 355 | DB::table('uploads') |
| 356 | 356 | ->where('id', $file['id']) |
| 357 | 357 | ->update(['is_processed' => 2,'updated_at' => now()]); |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | } |
| 360 | 360 | break; |
| 361 | 361 | } |
| 362 | - }catch (\Maatwebsite\Excel\Validators\ValidationException $e) { |
|
| 362 | + } catch (\Maatwebsite\Excel\Validators\ValidationException $e) { |
|
| 363 | 363 | $this->output->writeln( $e->getMessage()); |
| 364 | 364 | if($sheet == 1){ |
| 365 | 365 | self::writeErrors($e,$file,'Insert Students'); |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | ->where('id', $file['id']) |
| 368 | 368 | ->update(['insert' => 2,'updated_at' => now()]); |
| 369 | 369 | $this->processFailedEmail($file,$user,'Fresh Student Data Upload:Failed'); |
| 370 | - }else if($sheet == 2){ |
|
| 370 | + } else if($sheet == 2){ |
|
| 371 | 371 | self::writeErrors($e,$file,'Update Students'); |
| 372 | 372 | DB::table('uploads') |
| 373 | 373 | ->where('id', $file['id']) |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | $user = User::find($file['security_user_id']); |
| 400 | 400 | if( $size > 0){ |
| 401 | 401 | return true; |
| 402 | - }else{ |
|
| 402 | + } else{ |
|
| 403 | 403 | DB::table('uploads') |
| 404 | 404 | ->where('id', $file['id']) |
| 405 | 405 | ->update(['is_processed' =>2 , 'updated_at' => now()]); |
@@ -420,7 +420,7 @@ discard block |
||
| 420 | 420 | $reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($this->getType($file['filename'])); |
| 421 | 421 | $objPHPExcel = $reader->load($excelFile); |
| 422 | 422 | return $objPHPExcel; |
| 423 | - }catch (Exception $e){ |
|
| 423 | + } catch (Exception $e){ |
|
| 424 | 424 | $this->output->writeln( $e->getMessage()); |
| 425 | 425 | $user = User::find($file['security_user_id']); |
| 426 | 426 | DB::table('uploads') |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | try{; |
| 436 | 436 | $objPHPExcel = $this->setReader($file); |
| 437 | 437 | return $objPHPExcel->getSheetByName($sheet) !== null; |
| 438 | - }catch (Exception $e){ |
|
| 438 | + } catch (Exception $e){ |
|
| 439 | 439 | $this->output->writeln( $e->getMessage()); |
| 440 | 440 | $user = User::find($file['security_user_id']); |
| 441 | 441 | DB::table('uploads') |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | } |
| 462 | 462 | } |
| 463 | 463 | return $higestRow; |
| 464 | - }catch(\Exception $e){ |
|
| 464 | + } catch(\Exception $e){ |
|
| 465 | 465 | $this->output->writeln( $e->getMessage()); |
| 466 | 466 | $user = User::find($file['security_user_id']); |
| 467 | 467 | DB::beginTransaction(); |
@@ -534,7 +534,7 @@ discard block |
||
| 534 | 534 | unset($failures); |
| 535 | 535 | } |
| 536 | 536 | |
| 537 | - }catch (Eception $e){ |
|
| 537 | + } catch (Eception $e){ |
|
| 538 | 538 | $this->output->writeln( $e->getMessage()); |
| 539 | 539 | $user = User::find($file['security_user_id']); |
| 540 | 540 | DB::beginTransaction(); |