BY-227 No se comparten los archivos .doc en Google Drive

- Add upload document for type .doc
This commit is contained in:
Marco A. Nina Mena
2016-03-15 17:05:12 -04:00
parent 7e978e5d64
commit c675deec44

View File

@@ -289,7 +289,7 @@ class AppDocumentDrive
$criteria->addAscendingOrderByColumn('APP_DOC_CREATE_DATE');
$criteria->addAscendingOrderByColumn('APP_UID');
$rs = AppDocumentPeer::doSelectRS($criteria);
$rs->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$rs->setFetchMode(ResultSet::FETCHMODE_ASSOC);
while ($rs->next()) {
$row = $rs->getRow();
@@ -307,13 +307,13 @@ class AppDocumentDrive
$sw_file_exists_doc = false;
$sw_file_exists_pdf = false;
$sw_file_exists = false;
$realPath = '';
if ($appDoc->getAppDocType() == 'OUTPUT') {
//$name = substr($name, 1, -1);
$realPathDoc = PATH_DOCUMENT . $appUid . '/outdocs/' . $appDocUid . '_' . $docVersion . '.' . 'doc';
$realPathDoc1 = PATH_DOCUMENT . $appUid . '/outdocs/' . $name . '_' . $docVersion . '.' . 'doc';
$realPathDoc2 = PATH_DOCUMENT . $appUid . '/outdocs/' . $name . '.' . 'doc';
$sw_file_exists = false;
if (file_exists($realPathDoc)) {
$sw_file_exists = true;
$sw_file_exists_doc = true;
@@ -346,7 +346,6 @@ class AppDocumentDrive
} else {
$realPath = PATH_DOCUMENT . $appUid . '/' . $file[0] . $file[1] . '_' . $docVersion . '.' . $ext;
$realPath1 = PATH_DOCUMENT . $appUid . '/' . $file[0] . $file[1] . '.' . $ext;
$sw_file_exists = false;
if (file_exists($realPath)) {
$sw_file_exists = true;
} elseif (file_exists($realPath1)) {
@@ -370,26 +369,25 @@ class AppDocumentDrive
eprintln('upload file:' . $name, 'green');
}
$this->drive->setDriveUser($email);
$info = finfo_open(FILEINFO_MIME_TYPE);
$mime = finfo_file($info, $realPath);
$type = $appDoc->getAppDocType();
if ($appDoc->getAppDocType() == 'OUTPUT') {
if ($sw_file_exists_doc) {
$realPath = $realPathDoc;
$name = array_pop(explode('/', $realPathDoc));
$mime = 'application/msword';
$type = 'OUTPUT_DOC';
$result = $this->upload($fields, 'OUTPUT_DOC', 'application/msword', $realPathDoc,
array_pop(explode('/', $realPathDoc)));
}
if ($sw_file_exists_pdf) {
$realPath = $realPathPdf;
$name = array_pop(explode('/', $realPathPdf));
$mime = finfo_file($info, $realPathPdf);
$type = 'OUTPUT_PDF';
}
$info = finfo_open(FILEINFO_MIME_TYPE);
$result = $this->upload($fields, 'OUTPUT_PDF', finfo_file($info, $realPathPdf),
$realPathPdf, array_pop(explode('/', $realPathPdf)));
}
} else {
$info = finfo_open(FILEINFO_MIME_TYPE);
$mime = finfo_file($info, $realPath);
$type = $appDoc->getAppDocType();
$result = $this->upload($fields, $type, $mime, $realPath, $name);
}
} else {
$this->drive->setDriveUser($this->user->getUsrEmail());
}