예제 #1
0
 /**
  * Seta o diretorio de destino das imagem no sistema eletronico
  *
  * @param ArtefatoEntity $entArtefato
  * @return \Migracao\Service\MigrationImage
  */
 private function _setImagePathIn(ArtefatoEntity $entArtefato)
 {
     $etiquetaNupSiorgEntity = $entArtefato->getNuDigital();
     $loteFolder = (string) $etiquetaNupSiorgEntity->getSqLoteEtiqueta()->getSqLoteEtiqueta();
     $digitalFolder = (string) $etiquetaNupSiorgEntity->getNuEtiqueta();
     $this->_imagePathIn = sprintf('upload%1$simagem%1$s%2$s%1$s%3$s%1$s', DIRECTORY_SEPARATOR, $loteFolder, $digitalFolder);
     return $this;
 }
예제 #2
0
 private function _processaAnexoSIC(\Sgdoce\Model\Entity\Artefato $entity, $dto)
 {
     $i = 0;
     $nuDigital = $entity->getNuDigital()->getNuEtiqueta();
     while ($i < $dto->getUploader_count()) {
         $methodTmpName = "getUploader_{$i}_tmpname";
         $methodName = "getUploader_{$i}_name";
         $methodStatus = "getUploader_{$i}_status";
         if ('done' === $dto->{$methodStatus}()) {
             $tmpFileName = $dto->{$methodTmpName}();
             $realFileName = $dto->{$methodName}();
             $mufService = $this->getServiceLocator()->getService('MoveFileUpload');
             $moved = $mufService->setDestinationPath("upload/sic/{$nuDigital}")->move($tmpFileName);
             if ($moved) {
                 $mufService->unlinkOrigemFile($tmpFileName);
             }
         }
         $fileExtension = pathinfo($realFileName, PATHINFO_EXTENSION);
         $entityCheck = $this->_getRepository('app:AnexoSic')->findOneBy(array('noArquivoReal' => $realFileName, 'sqArtefato' => $entity->getSqArtefato()));
         if (!is_null($entityCheck)) {
             throw new \Core_Exception_ServiceLayer_Verification("Este SIC já possui um anexo com o nome '{$realFileName}'");
         }
         $entityAnexoSic = $this->_newEntity('app:AnexoSic');
         $entityAnexoSic->setSqArtefato($entity)->setTxCaminhoArquivo($mufService->getDestinationPath($tmpFileName))->setNoArquivoReal($realFileName)->setDtCadastro(\Zend_Date::now())->setTxExtensaoArquivo($fileExtension);
         $this->getEntityManager()->persist($entityAnexoSic);
         $this->getEntityManager()->flush($entityAnexoSic);
         $i++;
     }
     return $this;
 }
예제 #3
0
 private function _formatDigitalNumber(\Sgdoce\Model\Entity\Artefato $entityArtefato)
 {
     $nuDigital = $entityArtefato->getNuDigital()->getNuEtiqueta();
     if (strlen($nuDigital) < 7) {
         $nuDigital = str_pad($nuDigital, 7, '0', STR_PAD_LEFT);
     }
     return $nuDigital;
 }