@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | ignore_user_abort(true); |
| 60 | 60 | //Set Visit as upload processing status |
| 61 | 61 | $visitObject->changeUploadStatus(Visit::UPLOAD_PROCESSING); |
| 62 | - $start_time=microtime(true); |
|
| 62 | + $start_time=microtime(true); |
|
| 63 | 63 | /** |
| 64 | 64 | * Try block as each interruption of the proccess must make visit return as upload not done |
| 65 | 65 | * To allow new upload |
@@ -165,11 +165,11 @@ discard block |
||
| 165 | 165 | continue; |
| 166 | 166 | } |
| 167 | 167 | $files[]=$file->getPathname(); |
| 168 | - } |
|
| 168 | + } |
|
| 169 | 169 | |
| 170 | - if(sizeof($files) != $nbOfInstances){ |
|
| 171 | - throw new Exception("Number Of Uploaded Files dosen't match expected instance number"); |
|
| 172 | - } |
|
| 170 | + if(sizeof($files) != $nbOfInstances){ |
|
| 171 | + throw new Exception("Number Of Uploaded Files dosen't match expected instance number"); |
|
| 172 | + } |
|
| 173 | 173 | |
| 174 | 174 | $importedMap=null; |
| 175 | 175 | $importedInstances=0; |
@@ -271,31 +271,31 @@ discard block |
||
| 271 | 271 | |
| 272 | 272 | function get_tus_file($fileName) { |
| 273 | 273 | |
| 274 | - $client = new Client([ |
|
| 275 | - // Base URI is used with relative requests |
|
| 274 | + $client = new Client([ |
|
| 275 | + // Base URI is used with relative requests |
|
| 276 | 276 | 'base_uri' => TUS_SERVER.'/tus/', |
| 277 | 277 | 'headers' => ['Tus-Resumable' => '1.0.0'] |
| 278 | - ]); |
|
| 278 | + ]); |
|
| 279 | 279 | $downloadedFileName = tempnam(sys_get_temp_dir(), 'dicom'); |
| 280 | 280 | |
| 281 | 281 | $resource = fopen( $downloadedFileName, 'r+'); |
| 282 | 282 | |
| 283 | 283 | $client->request('GET', $fileName, ['sink' => $resource]); |
| 284 | 284 | |
| 285 | - return $downloadedFileName; |
|
| 285 | + return $downloadedFileName; |
|
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | function delete_tus_file($fileName){ |
| 289 | 289 | |
| 290 | - $client = new Client([ |
|
| 291 | - // Base URI is used with relative requests |
|
| 290 | + $client = new Client([ |
|
| 291 | + // Base URI is used with relative requests |
|
| 292 | 292 | 'base_uri' => TUS_SERVER.'/tus/', |
| 293 | 293 | 'headers' => ['Tus-Resumable' => '1.0.0'] |
| 294 | - ]); |
|
| 294 | + ]); |
|
| 295 | 295 | |
| 296 | 296 | $client->request('DELETE', $fileName); |
| 297 | 297 | |
| 298 | - //$code = $response->getStatusCode(); // 200 |
|
| 298 | + //$code = $response->getStatusCode(); // 200 |
|
| 299 | 299 | //$reason = $response->getReasonPhrase(); // OK |
| 300 | 300 | |
| 301 | 301 | } |
@@ -37,16 +37,16 @@ discard block |
||
| 37 | 37 | Session::checkSession(); |
| 38 | 38 | $linkpdo=Session::getLinkpdo(); |
| 39 | 39 | |
| 40 | -$timeStamp = time(); |
|
| 41 | -$id_visit = $_POST['id_visit']; |
|
| 42 | -$nbOfInstances = $_POST['totalDicomFiles']; |
|
| 40 | +$timeStamp=time(); |
|
| 41 | +$id_visit=$_POST['id_visit']; |
|
| 42 | +$nbOfInstances=$_POST['totalDicomFiles']; |
|
| 43 | 43 | $anonFromOrthancId=$_POST['originalOrthancStudyID']; |
| 44 | 44 | $username=$_SESSION['username']; |
| 45 | 45 | $study=$_SESSION['study']; |
| 46 | 46 | $role=$_SESSION['role']; |
| 47 | -$tusFilesID = $_POST['sucessIDsUploaded']; |
|
| 47 | +$tusFilesID=$_POST['sucessIDsUploaded']; |
|
| 48 | 48 | |
| 49 | -$unzipedPath = $_SERVER['DOCUMENT_ROOT'].'/data/upload/temp/'.$timeStamp.'_'.$id_visit; |
|
| 49 | +$unzipedPath=$_SERVER['DOCUMENT_ROOT'].'/data/upload/temp/'.$timeStamp.'_'.$id_visit; |
|
| 50 | 50 | |
| 51 | 51 | $visitObject=new Visit($id_visit, $linkpdo); |
| 52 | 52 | $userObject=new User($username, $linkpdo); |
@@ -71,8 +71,8 @@ discard block |
||
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | //Unzip each uploaded file and remove them from tus |
| 74 | - foreach($tusFilesID as $fileName){ |
|
| 75 | - $tempZipPath = get_tus_file($fileName); |
|
| 74 | + foreach ($tusFilesID as $fileName) { |
|
| 75 | + $tempZipPath=get_tus_file($fileName); |
|
| 76 | 76 | |
| 77 | 77 | $zipSize=filesize($tempZipPath); |
| 78 | 78 | $uncompressedzipSize=get_zip_originalsize($tempZipPath); |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | $files[]=$file->getPathname(); |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | - if(sizeof($files) != $nbOfInstances){ |
|
| 171 | + if (sizeof($files) != $nbOfInstances) { |
|
| 172 | 172 | throw new Exception("Number Of Uploaded Files dosen't match expected instance number"); |
| 173 | 173 | } |
| 174 | 174 | |
@@ -271,23 +271,23 @@ discard block |
||
| 271 | 271 | |
| 272 | 272 | function get_tus_file($fileName) { |
| 273 | 273 | |
| 274 | - $client = new Client([ |
|
| 274 | + $client=new Client([ |
|
| 275 | 275 | // Base URI is used with relative requests |
| 276 | 276 | 'base_uri' => TUS_SERVER.'/tus/', |
| 277 | 277 | 'headers' => ['Tus-Resumable' => '1.0.0'] |
| 278 | 278 | ]); |
| 279 | - $downloadedFileName = tempnam(sys_get_temp_dir(), 'dicom'); |
|
| 279 | + $downloadedFileName=tempnam(sys_get_temp_dir(), 'dicom'); |
|
| 280 | 280 | |
| 281 | - $resource = fopen( $downloadedFileName, 'r+'); |
|
| 281 | + $resource=fopen($downloadedFileName, 'r+'); |
|
| 282 | 282 | |
| 283 | 283 | $client->request('GET', $fileName, ['sink' => $resource]); |
| 284 | 284 | |
| 285 | 285 | return $downloadedFileName; |
| 286 | 286 | } |
| 287 | 287 | |
| 288 | -function delete_tus_file($fileName){ |
|
| 288 | +function delete_tus_file($fileName) { |
|
| 289 | 289 | |
| 290 | - $client = new Client([ |
|
| 290 | + $client=new Client([ |
|
| 291 | 291 | // Base URI is used with relative requests |
| 292 | 292 | 'base_uri' => TUS_SERVER.'/tus/', |
| 293 | 293 | 'headers' => ['Tus-Resumable' => '1.0.0'] |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | //Log import |
| 134 | 134 | Tracker::logActivity($username, $role, $study, $visitObject->id_visit, "Upload Series", $logDetails); |
| 135 | 135 | |
| 136 | - }catch (Throwable $e1) { |
|
| 136 | + } catch (Throwable $e1) { |
|
| 137 | 137 | $logDetails['patientNumber']=$visitObject->patientCode; |
| 138 | 138 | $logDetails['visitType']=$visitObject->visitType; |
| 139 | 139 | $logDetails['modality_visit']=$visitObject->visitGroupObject->groupModality; |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | |
| 148 | -}else { |
|
| 148 | +} else { |
|
| 149 | 149 | header('HTTP/1.0 403 Forbidden'); |
| 150 | 150 | die('You are not allowed to access this file.'); |
| 151 | 151 | } |
@@ -200,11 +200,11 @@ discard block |
||
| 200 | 200 | |
| 201 | 201 | if (count($importedMap) == 1 && $importedInstances == $nbOfInstances) { |
| 202 | 202 | return $importedMap; |
| 203 | - }else { |
|
| 203 | + } else { |
|
| 204 | 204 | //These error shall never occur |
| 205 | 205 | if (count($importedMap) > 1) { |
| 206 | 206 | throw new Exception("More than one study in Zip"); |
| 207 | - }else if ($importedInstances != $nbOfInstances) { |
|
| 207 | + } else if ($importedInstances != $nbOfInstances) { |
|
| 208 | 208 | throw new Exception("Imported DICOM not matching announced number of Instances"); |
| 209 | 209 | |
| 210 | 210 | } |
@@ -220,8 +220,11 @@ discard block |
||
| 220 | 220 | $it=new RecursiveDirectoryIterator($directory, FilesystemIterator::SKIP_DOTS); |
| 221 | 221 | $it=new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST); |
| 222 | 222 | foreach ($it as $file) { |
| 223 | - if ($file->isDir()) rmdir($file->getPathname()); |
|
| 224 | - else unlink($file->getPathname()); |
|
| 223 | + if ($file->isDir()) { |
|
| 224 | + rmdir($file->getPathname()); |
|
| 225 | + } else { |
|
| 226 | + unlink($file->getPathname()); |
|
| 227 | + } |
|
| 225 | 228 | } |
| 226 | 229 | rmdir($directory); |
| 227 | 230 | } |
@@ -38,20 +38,20 @@ discard block |
||
| 38 | 38 | //Set Time Limit at 3H as operation could be really long |
| 39 | 39 | set_time_limit(10800); |
| 40 | 40 | |
| 41 | - $this->client = new Client(); |
|
| 41 | + $this->client=new Client(); |
|
| 42 | 42 | //Set address of Orthanc server |
| 43 | 43 | if ($exposed) { |
| 44 | 44 | $this->url=GAELO_ORTHANC_EXPOSED_INTERNAL_ADDRESS.':'.GAELO_ORTHANC_EXPOSED_INTERNAL_PORT; |
| 45 | - $this->login = GAELO_ORTHANC_EXPOSED_INTERNAL_LOGIN; |
|
| 46 | - $this->password = GAELO_ORTHANC_EXPOSED_INTERNAL_PASSWORD; |
|
| 45 | + $this->login=GAELO_ORTHANC_EXPOSED_INTERNAL_LOGIN; |
|
| 46 | + $this->password=GAELO_ORTHANC_EXPOSED_INTERNAL_PASSWORD; |
|
| 47 | 47 | $this->context=array( |
| 48 | 48 | 'http' => array( |
| 49 | 49 | 'header' => "Authorization: Basic ".base64_encode(GAELO_ORTHANC_EXPOSED_INTERNAL_LOGIN.':'.GAELO_ORTHANC_EXPOSED_INTERNAL_PASSWORD) |
| 50 | 50 | )); |
| 51 | 51 | }else { |
| 52 | 52 | $this->url=GAELO_ORTHANC_PACS_ADDRESS.':'.GAELO_ORTHANC_PACS_PORT; |
| 53 | - $this->login = GAELO_ORTHANC_PACS_LOGIN; |
|
| 54 | - $this->password = GAELO_ORTHANC_PACS_PASSWORD; |
|
| 53 | + $this->login=GAELO_ORTHANC_PACS_LOGIN; |
|
| 54 | + $this->password=GAELO_ORTHANC_PACS_PASSWORD; |
|
| 55 | 55 | $this->context=array( |
| 56 | 56 | 'http' => array( |
| 57 | 57 | 'header' => "Authorization: Basic ".base64_encode(GAELO_ORTHANC_PACS_LOGIN.':'.GAELO_ORTHANC_PACS_PASSWORD) |
@@ -138,8 +138,8 @@ discard block |
||
| 138 | 138 | |
| 139 | 139 | $context=stream_context_create($opts); |
| 140 | 140 | |
| 141 | - $tempFile = tmpfile(); |
|
| 142 | - stream_copy_to_stream ( fopen($this->url.'/tools/create-archive', 'rb', false, $context) , $tempFile); |
|
| 141 | + $tempFile=tmpfile(); |
|
| 142 | + stream_copy_to_stream(fopen($this->url.'/tools/create-archive', 'rb', false, $context), $tempFile); |
|
| 143 | 143 | |
| 144 | 144 | return $tempFile; |
| 145 | 145 | } |
@@ -359,18 +359,18 @@ discard block |
||
| 359 | 359 | /** |
| 360 | 360 | * This method has the advantage to stream the content and avoid running out memory |
| 361 | 361 | */ |
| 362 | - public function importFileGuzzle(string $file){ |
|
| 363 | - try{ |
|
| 364 | - $body = fopen($file, 'r'); |
|
| 362 | + public function importFileGuzzle(string $file) { |
|
| 363 | + try { |
|
| 364 | + $body=fopen($file, 'r'); |
|
| 365 | 365 | |
| 366 | - $options = ['auth' => [$this->login, $this->password], |
|
| 366 | + $options=['auth' => [$this->login, $this->password], |
|
| 367 | 367 | 'headers' => ['content-type' => 'application/dicom', 'Accept' => 'application/json'], |
| 368 | 368 | 'body' => $body]; |
| 369 | 369 | |
| 370 | - $response = $this->client->request('POST', $this->url.'/instances' , $options); |
|
| 370 | + $response=$this->client->request('POST', $this->url.'/instances', $options); |
|
| 371 | 371 | |
| 372 | - return (string) $response->getBody(); |
|
| 373 | - } catch (Exception $e1) { |
|
| 372 | + return (string)$response->getBody(); |
|
| 373 | + }catch (Exception $e1) { |
|
| 374 | 374 | error_log("Error during import Dcm ".$e1->getMessage()); |
| 375 | 375 | } |
| 376 | 376 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | 'http' => array( |
| 49 | 49 | 'header' => "Authorization: Basic ".base64_encode(GAELO_ORTHANC_EXPOSED_INTERNAL_LOGIN.':'.GAELO_ORTHANC_EXPOSED_INTERNAL_PASSWORD) |
| 50 | 50 | )); |
| 51 | - }else { |
|
| 51 | + } else { |
|
| 52 | 52 | $this->url=GAELO_ORTHANC_PACS_ADDRESS.':'.GAELO_ORTHANC_PACS_PORT; |
| 53 | 53 | $this->login = GAELO_ORTHANC_PACS_LOGIN; |
| 54 | 54 | $this->password = GAELO_ORTHANC_PACS_PASSWORD; |
@@ -304,7 +304,11 @@ discard block |
||
| 304 | 304 | return $answer; |
| 305 | 305 | } |
| 306 | 306 | |
| 307 | - if (!$gzip) $data['Compression']="none"; else $data['Compression']="gzip"; |
|
| 307 | + if (!$gzip) { |
|
| 308 | + $data['Compression']="none"; |
|
| 309 | + } else { |
|
| 310 | + $data['Compression']="gzip"; |
|
| 311 | + } |
|
| 308 | 312 | |
| 309 | 313 | $data['Peer']=$peer; |
| 310 | 314 | |
@@ -349,7 +353,7 @@ discard block |
||
| 349 | 353 | $context=stream_context_create($opts); |
| 350 | 354 | $result=file_get_contents($this->url.'/instances', false, $context); |
| 351 | 355 | |
| 352 | - }catch (Exception $e1) { |
|
| 356 | + } catch (Exception $e1) { |
|
| 353 | 357 | error_log("Error during import Dcm ".$e1->getMessage()); |
| 354 | 358 | } |
| 355 | 359 | return $result; |
@@ -433,7 +437,7 @@ discard block |
||
| 433 | 437 | $tagsObjects[]=new TagAnon("0008,103E", TagAnon::KEEP); //series Description |
| 434 | 438 | |
| 435 | 439 | |
| 436 | - }else if ($profile == "Full") { |
|
| 440 | + } else if ($profile == "Full") { |
|
| 437 | 441 | $date=TagAnon::CLEAR; |
| 438 | 442 | $body=TagAnon::CLEAR; |
| 439 | 443 | |
@@ -497,7 +501,7 @@ discard block |
||
| 497 | 501 | |
| 498 | 502 | if ($tag->choice == TagAnon::REPLACE) { |
| 499 | 503 | $jsonArrayAnon['Replace'][$tag->tag]=$tag->newValue; |
| 500 | - }else if ($tag->choice == TagAnon::KEEP) { |
|
| 504 | + } else if ($tag->choice == TagAnon::KEEP) { |
|
| 501 | 505 | $jsonArrayAnon['Keep'][]=$tag->tag; |
| 502 | 506 | } |
| 503 | 507 | |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | -} else { |
|
| 53 | +}else { |
|
| 54 | 54 | $availableVisits=[]; |
| 55 | 55 | } |
| 56 | 56 | |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | //Output results |
| 35 | 35 | echo(json_encode($answer)); |
| 36 | 36 | |
| 37 | -} else { |
|
| 37 | +}else { |
|
| 38 | 38 | header('HTTP/1.0 403 Forbidden'); |
| 39 | 39 | die('You are not allowed to access this data.'); |
| 40 | 40 | } |
| 41 | 41 | \ No newline at end of file |
@@ -70,11 +70,13 @@ |
||
| 70 | 70 | <tr> |
| 71 | 71 | <td><?=$investigatorEvent['date']?></td> |
| 72 | 72 | <td><?=htmlspecialchars($investigatorEvent['username'])?></td> |
| 73 | - <td><?php if ($investigatorEvent['action_type'] == "Create Visit") echo('<pre><code>'.json_encode($eventDetails, JSON_PRETTY_PRINT|JSON_HEX_QUOT|JSON_HEX_TAG|JSON_HEX_AMP|JSON_HEX_APOS).'</code></pre>')?></td> |
|
| 73 | + <td><?php if ($investigatorEvent['action_type'] == "Create Visit") { |
|
| 74 | + echo('<pre><code>'.json_encode($eventDetails, JSON_PRETTY_PRINT|JSON_HEX_QUOT|JSON_HEX_TAG|JSON_HEX_AMP|JSON_HEX_APOS).'</code></pre>')?></td> |
|
| 74 | 75 | <td><?php if ($investigatorEvent['action_type'] == "Upload Series") echo('<pre><code>'.json_encode($eventDetails, JSON_PRETTY_PRINT|JSON_HEX_QUOT|JSON_HEX_TAG|JSON_HEX_AMP|JSON_HEX_APOS).'</code></pre>')?></td> |
| 75 | 76 | <td><?php if ($investigatorEvent['action_type'] == "Upload Failure") echo('<pre><code>'.json_encode($eventDetails, JSON_PRETTY_PRINT|JSON_HEX_QUOT|JSON_HEX_TAG|JSON_HEX_AMP|JSON_HEX_APOS).'</code></pre>')?></td> |
| 76 | 77 | <td><?php if ($investigatorEvent['action_type'] == "Save Form") { |
| 77 | 78 | $specificForm=$eventDetails['raw_data']; |
| 79 | +} |
|
| 78 | 80 | unset($eventDetails['raw_data']); |
| 79 | 81 | echo('<pre><code>'.json_encode($eventDetails, JSON_PRETTY_PRINT|JSON_HEX_QUOT|JSON_HEX_TAG|JSON_HEX_AMP|JSON_HEX_APOS).'</code></pre>'); |
| 80 | 82 | ?> |
@@ -120,7 +120,7 @@ |
||
| 120 | 120 | </SELECT> |
| 121 | 121 | <input type="text" class="form-control" id="reason" placeholder="Reason" name="reason" maxlength="255" style="display:none"> |
| 122 | 122 | <?php |
| 123 | - }else{ |
|
| 123 | + }else { |
|
| 124 | 124 | ?> |
| 125 | 125 | <input type="text" class="form-control" id="reason" placeholder="Reason" name="reason" maxlength="255"> |
| 126 | 126 | <?php |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | ?> |
| 97 | 97 | <label class="control-label">Declare patient withdrawal from the study</label> |
| 98 | 98 | <?php |
| 99 | - }else { |
|
| 99 | + } else { |
|
| 100 | 100 | ?> |
| 101 | 101 | <label class="control-label">Cancel Withdrawal (re-inclusion)</label> |
| 102 | 102 | <?php |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | </SELECT> |
| 121 | 121 | <input type="text" class="form-control" id="reason" placeholder="Reason" name="reason" maxlength="255" style="display:none"> |
| 122 | 122 | <?php |
| 123 | - }else{ |
|
| 123 | + } else{ |
|
| 124 | 124 | ?> |
| 125 | 125 | <input type="text" class="form-control" id="reason" placeholder="Reason" name="reason" maxlength="255"> |
| 126 | 126 | <?php |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | if (GAELO_DATE_FORMAT == 'm.d.Y') { |
| 62 | 62 | $birthDay=intval($birthDateArray[1]); |
| 63 | 63 | $birthMonth=intval($birthDateArray[0]); |
| 64 | - }else if (GAELO_DATE_FORMAT == 'd.m.Y') { |
|
| 64 | + } else if (GAELO_DATE_FORMAT == 'd.m.Y') { |
|
| 65 | 65 | $birthDay=intval($birthDateArray[0]); |
| 66 | 66 | $birthMonth=intval($birthDateArray[1]); |
| 67 | 67 | } |
@@ -73,41 +73,41 @@ discard block |
||
| 73 | 73 | //Store the patient result import process in this object |
| 74 | 74 | if ($insertddb) { |
| 75 | 75 | $this->sucessList[]=$patientNumber; |
| 76 | - }else { |
|
| 76 | + } else { |
|
| 77 | 77 | $patientFailed['PatientNumber']=$patientNumber; |
| 78 | 78 | $patientFailed['Reason']="Can't write to DB, wrong date or other wrong input"; |
| 79 | 79 | $this->failList[]=$patientFailed; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | //If conditions not met, add to the fail list with the respective error reason |
| 83 | - }else { |
|
| 83 | + } else { |
|
| 84 | 84 | |
| 85 | 85 | if (!$isExistingCenter) { |
| 86 | 86 | if (empty($patientInvestigatorNumCenter)) { |
| 87 | 87 | $this->failList['Missing Num Center'][]=$patientNumber; |
| 88 | - }else { |
|
| 88 | + } else { |
|
| 89 | 89 | $this->failList['Unknown Center'][]=$patientNumber; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - }else if (!$isCorrectPatientNumberLenght) { |
|
| 92 | + } else if (!$isCorrectPatientNumberLenght) { |
|
| 93 | 93 | $this->failList['Wrong PatientNumber length'][]=$patientNumber; |
| 94 | 94 | |
| 95 | - }else if (!$isNewPatient) { |
|
| 95 | + } else if (!$isNewPatient) { |
|
| 96 | 96 | if( !empty($patientRegistrationDate) ){ |
| 97 | 97 | $updated = $this->tryUpdateRegistrationDate($patientNumber, $patientRegistrationDate->format('Y-m-d')); |
| 98 | 98 | if($updated){ |
| 99 | 99 | $this->sucessList[]=$patientNumber.' - Updated Registration Date'; |
| 100 | - }else{ |
|
| 100 | + } else{ |
|
| 101 | 101 | $this->failList['Patient already in Database'][]=$patientNumber; |
| 102 | 102 | } |
| 103 | - }else{ |
|
| 103 | + } else{ |
|
| 104 | 104 | $this->failList['Patient already in Database'][]=$patientNumber; |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | |
| 108 | - }else if (empty($patientRegistrationDate)) { |
|
| 108 | + } else if (empty($patientRegistrationDate)) { |
|
| 109 | 109 | $this->failList['Empty Registration Date'][]=$patientNumber; |
| 110 | - }else if (!$isPrefixCorrect) { |
|
| 110 | + } else if (!$isPrefixCorrect) { |
|
| 111 | 111 | $this->failList['Wrong Patient Code Prefix'][]=$patientNumber; |
| 112 | 112 | } |
| 113 | 113 | |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | if (GAELO_DATE_FORMAT == 'm.d.Y') { |
| 142 | 142 | $registrationDay=intval($dateNbArray[1]); |
| 143 | 143 | $registrationMonth=intval($dateNbArray[0]); |
| 144 | - }else if (GAELO_DATE_FORMAT == 'd.m.Y') { |
|
| 144 | + } else if (GAELO_DATE_FORMAT == 'd.m.Y') { |
|
| 145 | 145 | $registrationDay=intval($dateNbArray[0]); |
| 146 | 146 | $registrationMonth=intval($dateNbArray[1]); |
| 147 | 147 | } |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | |
| 155 | 155 | try { |
| 156 | 156 | $dateResult=new DateTime($registrationYear.'-'.$registrationMonth.'-'.$registrationDay); |
| 157 | - }catch (Exception $e) { |
|
| 157 | + } catch (Exception $e) { |
|
| 158 | 158 | return null; |
| 159 | 159 | } |
| 160 | 160 | return $dateResult; |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | private function isNewPatient($patientCode) { |
| 171 | 171 | try { |
| 172 | 172 | new Patient($patientCode, $this->linkpdo); |
| 173 | - }catch (Exception $e1) { |
|
| 173 | + } catch (Exception $e1) { |
|
| 174 | 174 | return true; |
| 175 | 175 | } |
| 176 | 176 | |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | |
| 188 | 188 | if ($lenghtImport == GAELO_PATIENT_CODE_LENGHT) { |
| 189 | 189 | return true; |
| 190 | - }else { |
|
| 190 | + } else { |
|
| 191 | 191 | return false; |
| 192 | 192 | } |
| 193 | 193 | } |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | |
| 222 | 222 | try { |
| 223 | 223 | new Center($this->linkpdo, $patientNumCenter); |
| 224 | - }catch (Exception $e1) { |
|
| 224 | + } catch (Exception $e1) { |
|
| 225 | 225 | return false; |
| 226 | 226 | } |
| 227 | 227 | |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | 'center' => $patientInvestigatorNumCenter, |
| 261 | 261 | 'study' => $this->study)); |
| 262 | 262 | $success=true; |
| 263 | - }catch (Exception $e) { |
|
| 263 | + } catch (Exception $e) { |
|
| 264 | 264 | $success=false; |
| 265 | 265 | } |
| 266 | 266 | |
@@ -292,12 +292,12 @@ discard block |
||
| 292 | 292 | $failReport=$failReport.$key.':<br>'; |
| 293 | 293 | if (is_array($value)) { |
| 294 | 294 | $failReport=$failReport.implode('<br>', $value).'<br>'; |
| 295 | - }else { |
|
| 295 | + } else { |
|
| 296 | 296 | $failReport=$failReport.$value.'<br>'; |
| 297 | 297 | } |
| 298 | 298 | } |
| 299 | 299 | } |
| 300 | - }else { |
|
| 300 | + } else { |
|
| 301 | 301 | $failReport=$failReport.' None <br>'; |
| 302 | 302 | } |
| 303 | 303 | |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | $success=$value; |
| 317 | 317 | $successReport=$successReport.$success.'<br>'; |
| 318 | 318 | } |
| 319 | - }else { |
|
| 319 | + } else { |
|
| 320 | 320 | $successReport=$successReport.' None <br>'; |
| 321 | 321 | } |
| 322 | 322 | |
@@ -93,14 +93,14 @@ discard block |
||
| 93 | 93 | $this->failList['Wrong PatientNumber length'][]=$patientNumber; |
| 94 | 94 | |
| 95 | 95 | }else if (!$isNewPatient) { |
| 96 | - if( !empty($patientRegistrationDate) ){ |
|
| 97 | - $updated = $this->tryUpdateRegistrationDate($patientNumber, $patientRegistrationDate->format('Y-m-d')); |
|
| 98 | - if($updated){ |
|
| 96 | + if (!empty($patientRegistrationDate)) { |
|
| 97 | + $updated=$this->tryUpdateRegistrationDate($patientNumber, $patientRegistrationDate->format('Y-m-d')); |
|
| 98 | + if ($updated) { |
|
| 99 | 99 | $this->sucessList[]=$patientNumber.' - Updated Registration Date'; |
| 100 | - }else{ |
|
| 100 | + }else { |
|
| 101 | 101 | $this->failList['Patient already in Database'][]=$patientNumber; |
| 102 | 102 | } |
| 103 | - }else{ |
|
| 103 | + }else { |
|
| 104 | 104 | $this->failList['Patient already in Database'][]=$patientNumber; |
| 105 | 105 | } |
| 106 | 106 | |
@@ -118,10 +118,10 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - private function tryUpdateRegistrationDate($patientNumber, $patientRegistrationDate){ |
|
| 122 | - $patientObject = new Patient($patientNumber, $this->linkpdo); |
|
| 121 | + private function tryUpdateRegistrationDate($patientNumber, $patientRegistrationDate) { |
|
| 122 | + $patientObject=new Patient($patientNumber, $this->linkpdo); |
|
| 123 | 123 | //If patient with default registration date, update to the new one |
| 124 | - if($patientObject->patientRegistrationDate == '1900-01-01' && $patientRegistrationDate !== $patientObject->patientRegistrationDate ) { |
|
| 124 | + if ($patientObject->patientRegistrationDate == '1900-01-01' && $patientRegistrationDate !== $patientObject->patientRegistrationDate) { |
|
| 125 | 125 | $patientObject->editPatientRegistrationDate($patientRegistrationDate); |
| 126 | 126 | return true; |
| 127 | 127 | } |
@@ -77,10 +77,10 @@ discard block |
||
| 77 | 77 | $isAvailable=$this->isSearchedFileAvailable($fileArray); |
| 78 | 78 | if ($isAvailable) { |
| 79 | 79 | return array($this->ftpFileName); |
| 80 | - }else { |
|
| 80 | + } else { |
|
| 81 | 81 | throw new Exception('Target File Not Found'); |
| 82 | 82 | } |
| 83 | - }else { |
|
| 83 | + } else { |
|
| 84 | 84 | return $fileArray; |
| 85 | 85 | } |
| 86 | 86 | } |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | if ($this->ftpIsSftp) { |
| 113 | 113 | |
| 114 | 114 | $filesArray=$this->getSftp(); |
| 115 | - }else { |
|
| 115 | + } else { |
|
| 116 | 116 | $filesArray=$this->getFtp(); |
| 117 | 117 | //$ftpConnect = ftp_ssl_connect ($this->ftpHost, $this->ftpPort) or die("Can't Connect to Server ".$this->ftpHost); |
| 118 | 118 | |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | |
| 137 | 137 | return $sftp; |
| 138 | 138 | |
| 139 | - }else { |
|
| 139 | + } else { |
|
| 140 | 140 | |
| 141 | 141 | if (!$ftpConnect=ftp_connect($this->ftpHost, $this->ftpPort)) { |
| 142 | 142 | throw new Exception('Cant Connect to Server'.$this->ftpHost); |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | |
| 170 | 170 | return $result; |
| 171 | 171 | |
| 172 | - }else { |
|
| 172 | + } else { |
|
| 173 | 173 | |
| 174 | 174 | $ftp=$this->connectAndGoToFolder(); |
| 175 | 175 | |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | $fileArray=array_filter($fileArray, function($file) { |
| 192 | 192 | if ($file == '.' || $file == '..') { |
| 193 | 193 | return false; |
| 194 | - }else { |
|
| 194 | + } else { |
|
| 195 | 195 | return true; |
| 196 | 196 | } |
| 197 | 197 | }); |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | $fileArray=array_filter($fileArray, function($file) { |
| 231 | 231 | if ($file == '.' || $file == '..') { |
| 232 | 232 | return false; |
| 233 | - }else { |
|
| 233 | + } else { |
|
| 234 | 234 | return true; |
| 235 | 235 | } |
| 236 | 236 | }); |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | if ($i == 0) { |
| 275 | 275 | //First line is column definition |
| 276 | 276 | $titles=$columns; |
| 277 | - }else { |
|
| 277 | + } else { |
|
| 278 | 278 | $patient=[]; |
| 279 | 279 | //For each column associate data into an associative array |
| 280 | 280 | for ($j=0; $j < sizeof($columns); $j++) { |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | $email->setSubject('FTP Process Failed'); |
| 296 | 296 | $email->addAminEmails(); |
| 297 | 297 | $email->sendEmail(); |
| 298 | - }catch (Exception $e) { |
|
| 298 | + } catch (Exception $e) { |
|
| 299 | 299 | echo('sendEmailException'); |
| 300 | 300 | echo($e->getMessage()); |
| 301 | 301 | } |