Commit 66f0e5c4e0e679bfc866d88f9d1f9650d5faf51f

Authored by Kevin Fourie
1 parent fad1cb52

KTS-1349

"Bulk Import problem with áéíóúÑ or other special characters of Spanish language."
In Progress. Applied some utf8 encoding changes and busy doing some testing.

Committed By: Kevin
Reviewed By: Conrad

git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@6869 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 10 additions and 10 deletions
lib/import/bulkimport.inc.php
... ... @@ -80,8 +80,8 @@ class KTBulkImportManager {
80 80 return $aFolderPaths;
81 81 }
82 82 foreach ($aFolderPaths as $sFolderPath) {
83   - if (Folder::folderExistsName(basename($sFolderPath), KTUtil::getId($oFolder))) {
84   - $_SESSION['KTErrorMessage'][] = sprintf(_kt("The folder %s is already present in %s. Adding files into pre-existing folder."), $sFolderPath, $oFolder->getName());
  83 + if (Folder::folderExistsName(utf8_encode(basename($sFolderPath)), KTUtil::getId($oFolder))) {
  84 + $_SESSION['KTErrorMessage'][] = sprintf(_kt("The folder %s is already present in %s. Adding files into pre-existing folder."), utf8_encode($sFolderPath), $oFolder->getName());
85 85 $aOptions = Folder::getList("parent_id = " . KTUtil::getId($oFolder) . ' AND name = "' . DBUtil::escapeSimple($sFolderPath) . '"');
86 86 if (PEAR::isError($aOptions)) {
87 87 return $aOptions;
... ... @@ -92,7 +92,7 @@ class KTBulkImportManager {
92 92 $oThisFolder = $aOptions[0];
93 93 }
94 94 } else {
95   - $oThisFolder = KTFolderUtil::add($oFolder, basename($sFolderPath), $this->oUser);
  95 + $oThisFolder = KTFolderUtil::add($oFolder, utf8_encode(basename($sFolderPath)), $this->oUser);
96 96 }
97 97 if (PEAR::isError($oThisFolder)) {
98 98 return $oThisFolder;
... ... @@ -110,13 +110,13 @@ class KTBulkImportManager {
110 110 return $aInfo;
111 111 }
112 112 // need to check both of these.
113   - if (KTDocumentUtil::nameExists($oFolder, basename($sPath))) {
114   - $_SESSION['KTErrorMessage'][] = sprintf(_kt("The document %s is already present in %s. Ignoring."), basename($sPath), $oFolder->getName());
115   - $oDocument =& Document::getByNameAndFolder(basename($sPath), KTUtil::getId($oFolder));
  113 + if (KTDocumentUtil::nameExists($oFolder, utf8_encode(basename($sPath)))) {
  114 + $_SESSION['KTErrorMessage'][] = sprintf(_kt("The document %s is already present in %s. Ignoring."), utf8_encode(basename($sPath)), $oFolder->getName());
  115 + $oDocument =& Document::getByNameAndFolder(utf8_encode(basename($sPath)), KTUtil::getId($oFolder));
116 116 return $oDocument;
117   - } else if (KTDocumentUtil::fileExists($oFolder, basename($sPath))) {
118   - $_SESSION['KTErrorMessage'][] = sprintf(_kt("The document %s is already present in %s. Ignoring."), basename($sPath), $oFolder->getName());
119   - $oDocument =& Document::getByFilenameAndFolder(basename($sPath), KTUtil::getId($oFolder));
  117 + } else if (KTDocumentUtil::fileExists($oFolder, utf8_encode(basename($sPath)))) {
  118 + $_SESSION['KTErrorMessage'][] = sprintf(_kt("The document %s is already present in %s. Ignoring."), utf8_encode(basename($sPath)), $oFolder->getName());
  119 + $oDocument =& Document::getByFilenameAndFolder(utf8_encode(basename($sPath)), KTUtil::getId($oFolder));
120 120 return $oDocument;
121 121 }
122 122 // else
... ... @@ -126,7 +126,7 @@ class KTBulkImportManager {
126 126 'metadata' => $this->aMetadata,
127 127 'documenttype' => $this->oDocumentType,
128 128 );
129   - $oDocument =& KTDocumentUtil::add($oFolder, basename($sPath), $this->oUser, $aOptions);
  129 + $oDocument =& KTDocumentUtil::add($oFolder, utf8_encode(basename($sPath)), $this->oUser, $aOptions);
130 130 return $oDocument;
131 131 }
132 132 }
... ...