diff --git a/ChangeLog b/ChangeLog index de1482ea183..ddda40a0e31 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14,7 +14,7 @@ Following changes may create regressions for some external modules, but were nec * Update hook 'printOriginObjectLine', removed check on product type and special code. Need now reshook. * Old deprecated module "SimplePOS" has been completely removed. Use module "TakePOS" is you need a Point Of Sale. * The method static ActionComm::getActions($db, ...) is no more static. Use $actioncomm->getActions(...) instead (without $db param). - +* The 'action=delete&file=...' has been replaced with 'action=deletefile&file=...' to avoid confusion with deletion of object lines. ***** ChangeLog for 14.0.2 compared to 14.0.1 ***** diff --git a/htdocs/admin/security_file.php b/htdocs/admin/security_file.php index 1368fe48488..0a0e0b5973a 100644 --- a/htdocs/admin/security_file.php +++ b/htdocs/admin/security_file.php @@ -63,7 +63,7 @@ if ($action == 'updateform') { if ($res3 && $res4 && $res5 && $res6) { setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); } -} elseif ($action == 'delete') { +} elseif ($action == 'deletefile') { // Delete file $langs->load("other"); $file = $conf->admin->dir_temp.'/'.GETPOST('urlfile', 'alpha'); diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php index ec363ad112d..77200404a03 100644 --- a/htdocs/admin/tools/dolibarr_export.php +++ b/htdocs/admin/tools/dolibarr_export.php @@ -55,7 +55,7 @@ if (!$user->admin) { * Actions */ -if ($action == 'delete') { +if ($action == 'deletefile') { if (preg_match('/^backup\//', GETPOST('urlfile', 'alpha'))) { $file = $conf->admin->dir_output.'/backup/'.basename(GETPOST('urlfile', 'alpha')); $ret = dol_delete_file($file, 1); diff --git a/htdocs/comm/action/rapport/index.php b/htdocs/comm/action/rapport/index.php index 9b6238ca0de..b75c93df799 100644 --- a/htdocs/comm/action/rapport/index.php +++ b/htdocs/comm/action/rapport/index.php @@ -163,7 +163,7 @@ if ($resql) { // Button to build doc print ''; - print 'month.'&year='.$obj->year.'">'.img_picto($langs->trans('BuildDoc'), 'filenew').''; + print ''.img_picto($langs->trans('BuildDoc'), 'filenew').''; print ''; $name = "actions-".$obj->month."-".$obj->year.".pdf"; diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php index a3da2812067..2a42d4a3d00 100644 --- a/htdocs/core/ajax/ajaxdirpreview.php +++ b/htdocs/core/ajax/ajaxdirpreview.php @@ -396,9 +396,9 @@ if (!empty($conf->global->MAIN_ECM_DISABLE_JS)) { //$param.=($param?'?':'').(preg_replace('/^&/','',$param)); -if ($useajax || $action == 'delete') { +if ($useajax || $action == 'deletefile') { $urlfile = ''; - if ($action == 'delete') { + if ($action == 'deletefile') { $urlfile = GETPOST('urlfile', 'alpha'); } diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 03faffb941b..6e3c72dd827 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1338,11 +1338,11 @@ class FormFile print ''; // File name - print ''; + print ''; // Show file name with link to download //print "XX".$file['name']; //$file['name'] must be utf8 - print ''; - print img_mime($file['name'], $file['name'].' ('.dol_print_size($file['size'], 0, 0).')', 'inline-block valignbottom paddingright'); + print img_mime($file['name'], $file['name'].' ('.dol_print_size($file['size'], 0, 0).')', 'inline-block valignmiddle paddingright'); if ($showrelpart == 1) { print $relativepath; } @@ -1503,7 +1503,7 @@ class FormFile if (!empty($conf->global->MAIN_ECM_DISABLE_JS)) { $useajax = 0; } - print ''.img_delete().''; + print ''.img_delete().''; } print ""; @@ -1511,10 +1511,10 @@ class FormFile if ($nboffiles > 1 && $conf->browser->layout != 'phone') { print ''; if ($i > 0) { - print 'id.'">'.img_up('default', 0, 'imgupforline').''; + print 'id.'">'.img_up('default', 0, 'imgupforline').''; } if ($i < $nboffiles - 1) { - print 'id.'">'.img_down('default', 0, 'imgdownforline').''; + print 'id.'">'.img_down('default', 0, 'imgdownforline').''; } print ''; } else { diff --git a/htdocs/core/tpl/document_actions_post_headers.tpl.php b/htdocs/core/tpl/document_actions_post_headers.tpl.php index 4ec69efbac8..42276c24234 100644 --- a/htdocs/core/tpl/document_actions_post_headers.tpl.php +++ b/htdocs/core/tpl/document_actions_post_headers.tpl.php @@ -63,10 +63,10 @@ if (in_array($modulepart, array('product', 'produit', 'societe', 'user', 'ticket /* - * Confirm form to delete + * Confirm form to delete a file */ -if ($action == 'delete') { +if ($action == 'deletefile') { $langs->load("companies"); // Need for string DeleteFile+ConfirmDeleteFiles print $form->formconfirm( $_SERVER["PHP_SELF"].'?id='.$object->id.'&urlfile='.urlencode(GETPOST("urlfile")).'&linkid='.GETPOST('linkid', 'int').(empty($param) ? '' : $param), diff --git a/htdocs/ecm/ajax/ecmdatabase.php b/htdocs/ecm/ajax/ecmdatabase.php index 4d782a3caeb..2ce35973483 100644 --- a/htdocs/ecm/ajax/ecmdatabase.php +++ b/htdocs/ecm/ajax/ecmdatabase.php @@ -17,7 +17,7 @@ /** * \file htdocs/ecm/ajax/ecmdatabase.php - * \brief File to build ecm database + * \brief File to build/refresh the ecm database for directories */ if (!defined('NOTOKENRENEWAL')) { @@ -39,6 +39,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $action = GETPOST('action', 'aZ09'); $element = GETPOST('element', 'alpha'); + /* * View */ @@ -86,7 +87,7 @@ if (isset($action) && !empty($action)) { } if (!$dirisindatabase) { - $txt = "Directory found on disk ".$dirdesc['fullname'].", not found into database so we add it"; + $txt = "Directory found on disk ".$dirdesc['fullname'].", not found into table ecm_directories, so we add it"; dol_syslog($txt); // We must first find the fk_parent of directory to create $dirdesc['fullname'] @@ -155,15 +156,16 @@ if (isset($action) && !empty($action)) { foreach ($sqltree as $dirdesc) { // Loop on each sqltree to check dir is on disk $dirtotest = $conf->$element->dir_output.'/'.$dirdesc['fullrelativename']; if (!dol_is_dir($dirtotest)) { - $mesg .= $dirtotest." not found onto disk. We delete from database dir with id=".$dirdesc['id']."
\n"; + dol_syslog($dirtotest." not found onto disk. We delete from database dir with id=".$dirdesc['id']); $ecmdirtmp->id = $dirdesc['id']; $ecmdirtmp->delete($user, 'databaseonly'); //exit; } } - $sql = "UPDATE ".MAIN_DB_PREFIX."ecm_directories set cachenbofdoc = -1 WHERE cachenbofdoc < 0"; // If pb into cahce counting, we set to value -1 = "unknown" - dol_syslog("sql = ".$sql); + dol_syslog("Nb of directories added into database = ".$adirwascreated); + + $sql = "UPDATE ".MAIN_DB_PREFIX."ecm_directories set cachenbofdoc = -1 WHERE cachenbofdoc < 0"; // If pb into cache counting, we set to value -1 = "unknown" $db->query($sql); } } diff --git a/htdocs/ecm/dir_card.php b/htdocs/ecm/dir_card.php index 0b42fc17a02..793e199f180 100644 --- a/htdocs/ecm/dir_card.php +++ b/htdocs/ecm/dir_card.php @@ -450,7 +450,7 @@ print dol_get_fiche_end(); // Actions buttons -if ($action != 'edit' && $action != 'delete') { +if ($action != 'edit' && $action != 'delete' && $action != 'deletefile') { print '
'; if ($permtoadd) { @@ -482,8 +482,8 @@ if ($action != 'edit' && $action != 'delete') { } // Confirm remove file -if ($action == 'delete') { - print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.GETPOST("section", 'alpha').'&urlfile='.urlencode($_GET["urlfile"]).($backtopage ? '&backtopage='.urlencode($backtopage) : ''), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile'); +if ($action == 'deletefile') { + print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.urlencode(GETPOST("section", 'alpha')).'&urlfile='.urlencode(GETPOST("urlfile")).($backtopage ? '&backtopage='.urlencode($backtopage) : ''), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile'); } // Confirm remove file @@ -498,7 +498,7 @@ if ($action == 'delete_dir') { ); } - print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.GETPOST('section', 'alpha').($module ? '&module='.$module : '').($backtopage ? '&backtopage='.urlencode($backtopage) : ''), $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection', $relativepathwithoutslash), 'confirm_deletedir', $formquestion, 1, 1); + print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.urlencode(GETPOST('section', 'alpha')).($module ? '&module='.$module : '').($backtopage ? '&backtopage='.urlencode($backtopage) : ''), $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection', $relativepathwithoutslash), 'confirm_deletedir', $formquestion, 1, 1); } diff --git a/htdocs/ecm/file_card.php b/htdocs/ecm/file_card.php index 44bc91e387e..e38c3caf3f3 100644 --- a/htdocs/ecm/file_card.php +++ b/htdocs/ecm/file_card.php @@ -411,8 +411,8 @@ if ($action == 'edit') { } -// Confirmation de la suppression d'une ligne categorie -if ($action == 'delete_file') { +// Confirm deletion of a file +if ($action == 'deletefile') { print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.urlencode($section), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile', $urlfile), 'confirm_deletefile', '', 1, 1); } @@ -426,7 +426,7 @@ if ($action != 'edit') { /* if ($user->rights->ecm->setup) { - print ''.$langs->trans('Delete').''; + print ''.$langs->trans('Delete').''; } else { diff --git a/htdocs/ecm/index_auto.php b/htdocs/ecm/index_auto.php index d54dcf14d1e..f4df5a954a8 100644 --- a/htdocs/ecm/index_auto.php +++ b/htdocs/ecm/index_auto.php @@ -376,7 +376,7 @@ print dol_get_fiche_head($head, 'index_auto', '', -1, ''); // Confirm remove file (for non javascript users) -if ($action == 'delete' && empty($conf->use_javascript_ajax)) { +if ($action == 'deletefile' && empty($conf->use_javascript_ajax)) { print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.$section.'&urlfile='.urlencode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', '', 1); } @@ -413,7 +413,7 @@ if ($action == 'delete_section') { // End confirm -if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i', $action) || $action == 'delete') { +if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i', $action) || $action == 'deletefile') { print ''."\n"; print ''."\n"; diff --git a/htdocs/ecm/search.php b/htdocs/ecm/search.php index aa792e0c9d7..9a6c20392a9 100644 --- a/htdocs/ecm/search.php +++ b/htdocs/ecm/search.php @@ -239,7 +239,7 @@ $upload_dir = $conf->ecm->dir_output.'/'.$relativepath; $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1); $formfile = new FormFile($db); -$param = '&section='.$section; +$param = '§ion='.urlencode($section); $textifempty = ($section ? $langs->trans("NoFileFound") : $langs->trans("ECMSelectASection")); $formfile->list_of_documents($filearray, '', 'ecm', $param, 1, $relativepath, $user->rights->ecm->upload, 1, $textifempty); diff --git a/htdocs/ecm/tpl/enablefiletreeajax.tpl.php b/htdocs/ecm/tpl/enablefiletreeajax.tpl.php index 197d995a808..6397a333fb0 100644 --- a/htdocs/ecm/tpl/enablefiletreeajax.tpl.php +++ b/htdocs/ecm/tpl/enablefiletreeajax.tpl.php @@ -78,13 +78,14 @@ $(document).ready(function() { $('#refreshbutton').click( function() { console.log("Click on refreshbutton"); $.pleaseBePatient("trans('PleaseBePatient'); ?>"); - $.get( "", { - action: "build", - element: "ecm" + $.get("", { + action: 'build', + token: '', + element: 'ecm' }, function(response) { $.unblockUI(); - location.href=""; + location.href=''; }); }); }); diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 4e21887ff04..9139141c283 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -1231,7 +1231,7 @@ if ($action == 'confirm_deletesite' && $confirm == 'yes' && $permissiontodelete) } // Delete page (from website page menu) -if (GETPOSTISSET('pageid') && $action == 'delete' && $permissiontodelete) { +if (GETPOSTISSET('pageid') && $action == 'delete' && $permissiontodelete && !GETPOST('file_manager')) { $error = 0; $db->begin();