entity = trim($this->entity);
}
if (isset($this->filename)) {
- $this->filename = trim($this->filename);
+ $this->filename = preg_replace('/\.noexe$/', '', trim($this->filename));
}
if (isset($this->filepath)) {
$this->filepath = trim($this->filepath);
@@ -341,12 +341,13 @@ class EcmFiles extends CommonObject
$sql .= " t.src_object_id";
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
$sql .= ' WHERE 1 = 1';
- /* Fetching this table depends on filepath+filename, it must not depends on entity
+ /* Fetching this table depends on filepath+filename, it must not depends on entity because filesystem on disk does not know what is Dolibarr entities
if (! empty($conf->multicompany->enabled)) {
$sql .= " AND entity IN (" . getEntity('ecmfiles') . ")";
}*/
if ($relativepath) {
- $sql .= " AND t.filepath = '".$this->db->escape(dirname($relativepath))."' AND t.filename = '".$this->db->escape(basename($relativepath))."'";
+ $relativepathwithnoexe = preg_replace('/\.noexe$/', '', $relativepath); // We must never have the .noexe into the database
+ $sql .= " AND t.filepath = '".$this->db->escape(dirname($relativepath))."' AND t.filename = '".$this->db->escape(basename($relativepathwithnoexe))."'";
$sql .= " AND t.entity = ".$conf->entity; // unique key include the entity so each company has its own index
} elseif (!empty($ref)) { // hash of file path
$sql .= " AND t.ref = '".$this->db->escape($ref)."'";
@@ -542,46 +543,47 @@ class EcmFiles extends CommonObject
// Clean parameters
if (isset($this->ref)) {
- $this->ref = trim($this->ref);
+ $this->ref = trim($this->ref);
}
if (isset($this->label)) {
- $this->label = trim($this->label);
+ $this->label = trim($this->label);
}
if (isset($this->share)) {
- $this->share = trim($this->share);
+ $this->share = trim($this->share);
}
if (isset($this->entity)) {
- $this->entity = trim($this->entity);
+ $this->entity = trim($this->entity);
}
if (isset($this->filename)) {
- $this->filename = trim($this->filename);
+ $this->filename = preg_replace('/\.noexe$/', '', trim($this->filename));
}
if (isset($this->filepath)) {
- $this->filepath = trim($this->filepath);
+ $this->filepath = trim($this->filepath);
+ $this->filepath = preg_replace('/[\\/]+$/', '', $this->filepath); // Remove last /
}
if (isset($this->fullpath_orig)) {
- $this->fullpath_orig = trim($this->fullpath_orig);
+ $this->fullpath_orig = trim($this->fullpath_orig);
}
if (isset($this->description)) {
- $this->description = trim($this->description);
+ $this->description = trim($this->description);
}
if (isset($this->keywords)) {
- $this->keywords = trim($this->keywords);
+ $this->keywords = trim($this->keywords);
}
if (isset($this->cover)) {
- $this->cover = trim($this->cover);
+ $this->cover = trim($this->cover);
}
if (isset($this->gen_or_uploaded)) {
- $this->gen_or_uploaded = trim($this->gen_or_uploaded);
+ $this->gen_or_uploaded = trim($this->gen_or_uploaded);
}
if (isset($this->extraparams)) {
- $this->extraparams = trim($this->extraparams);
+ $this->extraparams = trim($this->extraparams);
}
if (isset($this->fk_user_m)) {
- $this->fk_user_m = trim($this->fk_user_m);
+ $this->fk_user_m = trim($this->fk_user_m);
}
if (isset($this->acl)) {
- $this->acl = trim($this->acl);
+ $this->acl = trim($this->acl);
}
if (isset($this->src_object_type)) {
$this->src_object_type = trim($this->src_object_type);
diff --git a/htdocs/ecm/file_card.php b/htdocs/ecm/file_card.php
index 9a4c86aba02..a67dcad4965 100644
--- a/htdocs/ecm/file_card.php
+++ b/htdocs/ecm/file_card.php
@@ -138,6 +138,12 @@ if ($action == 'update')
$oldfile = $olddir.$oldlabel;
$newfile = $newdir.$newlabel;
+ $newfileformove = $newfile;
+ // If old file end with .noexe, new file must also end with .noexe
+ if (preg_match('/\.noexe$/', $oldfile) && ! preg_match('/\.noexe$/', $newfileformove)) {
+ $newfileformove .= '.noexe';
+ }
+ //var_dump($oldfile);var_dump($newfile);exit;
// Now we update index of file
$db->begin();
@@ -145,7 +151,7 @@ if ($action == 'update')
//print $oldfile.' - '.$newfile;
if ($newlabel != $oldlabel)
{
- $result = dol_move($oldfile, $newfile); // This include update of database
+ $result = dol_move($oldfile, $newfileformove); // This include update of database
if (!$result)
{
$langs->load('errors');
@@ -185,7 +191,7 @@ if ($action == 'update')
$object->entity = $conf->entity;
$object->filepath = preg_replace('/[\\/]+$/', '', $newdirrelativetodocument);
$object->filename = $newlabel;
- $object->label = md5_file(dol_osencode($newfile)); // hash of file content
+ $object->label = md5_file(dol_osencode($newfileformove)); // hash of file content
$object->fullpath_orig = '';
$object->gen_or_uploaded = 'unknown';
$object->description = ''; // indexed content
@@ -203,6 +209,11 @@ if ($action == 'update')
$db->commit();
$urlfile = $newlabel;
+ // If old file end with .noexe, new file must also end with .noexe
+ if (preg_match('/\.noexe$/', $newfileformove)) {
+ $urlfile .= '.noexe';
+ }
+
header('Location: '.$_SERVER["PHP_SELF"].'?urlfile='.urlencode($urlfile).'§ion='.urlencode($section));
exit;
} else {
@@ -255,9 +266,13 @@ while ($tmpecmdir && $result > 0)
$i++;
}
+$urlfiletoshow = preg_replace('/\.noexe$/', '', $urlfile);
+
$s = img_picto('', 'object_dir').' '.$langs->trans("ECMRoot").' -> '.$s.' -> ';
-if ($action == 'edit') $s .= '';
-else $s .= $urlfile;
+if ($action == 'edit') $s .= '';
+else $s .= $urlfiletoshow;
+
+$morehtml = '';
$object->ref = ''; // Force to hide ref
dol_banner_tab($object, '', $morehtml, 0, '', '', $s);
@@ -280,10 +295,9 @@ print dol_print_size($totalsize);
print '
';
*/
+// Hash of file content
print '
'.$langs->trans("HashOfFileContent").'
';
$object = new EcmFiles($db);
-//$filenametosearch=basename($filepath);
-//$filedirtosearch=basedir($filepath);
$object->fetch(0, '', $filepathtodocument);
if (!empty($object->label))
{
diff --git a/htdocs/ecm/index.php b/htdocs/ecm/index.php
index adb1df99ab5..a0a11382d66 100644
--- a/htdocs/ecm/index.php
+++ b/htdocs/ecm/index.php
@@ -124,7 +124,6 @@ if ($action == 'confirm_deletefile')
if (GETPOST('confirm') == 'yes')
{
// GETPOST('urlfile','alpha') is full relative URL from ecm root dir. Contains path of all sections.
- //var_dump(GETPOST('urlfile'));exit;
$upload_dir = $conf->ecm->dir_output.($relativepath ? '/'.$relativepath : '');
$file = $upload_dir."/".GETPOST('urlfile', 'alpha');
@@ -132,7 +131,9 @@ if ($action == 'confirm_deletefile')
$ret = dol_delete_file($file); // This include also the delete from file index in database.
if ($ret)
{
- setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile', 'alpha')), null, 'mesgs');
+ $urlfiletoshow = GETPOST('urlfile', 'alpha');
+ $urlfiletoshow = preg_replace('/\.noexe$/', '', $urlfiletoshow);
+ setEventMessages($langs->trans("FileWasRemoved", $urlfiletoshow), null, 'mesgs');
$result = $ecmdir->changeNbOfFiles('-');
} else {
setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile', 'alpha')), null, 'errors');
diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang
index 739ecb88591..6dbb616f2fc 100644
--- a/htdocs/langs/en_US/errors.lang
+++ b/htdocs/langs/en_US/errors.lang
@@ -263,3 +263,4 @@ WarningNumberOfRecipientIsRestrictedInMassAction=Warning, number of different re
WarningDateOfLineMustBeInExpenseReportRange=Warning, the date of line is not in the range of the expense report
WarningProjectClosed=Project is closed. You must re-open it first.
WarningSomeBankTransactionByChequeWereRemovedAfter=Some bank transaction were removed after that the receipt including them were generated. So nb of cheques and total of receipt may differ from number and total in list.
+WarningFailedToAddFileIntoDatabaseIndex=Warnin, failed to add file entry into ECM database index table
\ No newline at end of file
diff --git a/htdocs/opensurvey/card.php b/htdocs/opensurvey/card.php
index 7322c70780c..9645dc41e0e 100644
--- a/htdocs/opensurvey/card.php
+++ b/htdocs/opensurvey/card.php
@@ -214,7 +214,7 @@ print '';
$head = opensurvey_prepare_head($object);
-dol_fiche_head($head, 'general', $langs->trans("Survey"), -1, DOL_URL_ROOT.'/opensurvey/img/object_opensurvey.png', 1);
+dol_fiche_head($head, 'general', $langs->trans("Survey"), -1, 'poll');
$morehtmlref = '';
diff --git a/htdocs/opensurvey/css/style.css b/htdocs/opensurvey/css/style.css
index e6b84f5fde5..d9cf48c72ee 100644
--- a/htdocs/opensurvey/css/style.css
+++ b/htdocs/opensurvey/css/style.css
@@ -367,8 +367,8 @@ div.cadre td.vide {
/*Case de tableau contenant les noms dans affichage de sondage*/
div.cadre td.nom {
background-color: #DDDDDD;
- font-size:12px;
text-align:center;
+ padding: 8px;
}
div.cadre td.casevide {
background-color: white;
diff --git a/htdocs/opensurvey/results.php b/htdocs/opensurvey/results.php
index 59f605daf31..0acde0eb314 100644
--- a/htdocs/opensurvey/results.php
+++ b/htdocs/opensurvey/results.php
@@ -413,10 +413,11 @@ $toutsujet = str_replace("°", "'", $toutsujet);
print '