diff --git a/core/trunk/core/class/resources_controler.php b/core/trunk/core/class/resources_controler.php index a70b2b6c696fae30ab50b641053e48220158c6cc..33dd613b3ec691ed0d20dddbd4e581be54148c77 100755 --- a/core/trunk/core/class/resources_controler.php +++ b/core/trunk/core/class/resources_controler.php @@ -57,14 +57,25 @@ class resources_controler ##################################### ## Web Service de versement de données issue du gros scanner ##################################### - public function storeResource($encodedFile, $data, $collId, $table, $fileFormat, $status) + public function storeResource($encodedFile, $dataObject, $collId, $table, $fileFormat, $status) { try { $func = new functions(); - $data = $func->object2array($data); - for ($i=0; $i < count($data);$i++) { + $theData = $func->object2array($dataObject); + if (count($theData) == 1) { + $data = array(); + if (is_array($theData['datas'])) { + array_push($data, $theData['datas']); + } else { + array_push($data, $theData); + } + } else { + $data = $theData; + } + for ($i=0;$i< count($data);$i++) { $data[$i]['column'] = strtolower($data[$i]['column']); } + $returnCode = 0; $db = new dbquery(); $db->connect(); @@ -167,7 +178,7 @@ class resources_controler $db = new dbquery(); $db->connect(); //copy sended file on tmp - /*$fileContent = file_get_contents($fileURI); + $fileContent = file_get_contents($fileURI); $random = rand(); $fileName = 'tmp_file_' . $random . '.' . $fileFormat; $Fnm = $_SESSION['config']['tmppath'] . $fileName; @@ -181,15 +192,7 @@ class resources_controler 'size' => filesize($Fnm), 'format' => $fileFormat, 'tmpFileName' => $fileName, - );*/ - $docserverControler = new docservers_controler(); - $fileInfos = array( - 'tmpDir' => dirname($fileURI) . DIRECTORY_SEPARATOR, - 'size' => filesize($fileURI), - 'format' => $fileFormat, - 'tmpFileName' => basename($fileURI), ); - //print_r($fileInfos); $storeResult = array(); $storeResult = $docserverControler->storeResourceOnDocserver( @@ -213,7 +216,7 @@ class resources_controler $status, $fileFormat ); - //unlink($Fnm); + unlink($Fnm); //var_dump($data);exit; $resId = $resource->load_into_db( $table, @@ -253,9 +256,6 @@ class resources_controler private function prepareStorage($data, $docserverId, $status, $fileFormat) { - require_once 'core/class/class_db.php'; - $dbQuery = new dbquery(); - $dbQuery->connect(); $statusFound = false; $typistFound = false; $typeIdFound = false; @@ -266,11 +266,6 @@ class resources_controler $data[$i]['value'] = '0'; } } - if (strtoupper($data[$i]['type']) == 'STRING') { - $data[$i]['value'] = $dbQuery->protect_string_db($data[$i]['value']); - $data[$i]['value'] = str_replace(";", "", $data[$i]['value']); - $data[$i]['value'] = str_replace("--", "", $data[$i]['value']); - } if (strtoupper($data[$i]['column']) == strtoupper('status')) { $statusFound = true; } @@ -281,6 +276,9 @@ class resources_controler $typeIdFound = true; } if (strtoupper($data[$i]['column']) == strtoupper('custom_t10')) { + require_once 'core/class/class_db.php'; + $dbQuery = new dbquery(); + $dbQuery->connect(); $mail = array(); $theString = str_replace(">", "", $data[$i]['value']); $mail = explode("<", $theString);