Fix: Message show when dir is out of sync with database cache was wrong.

This commit is contained in:
Laurent Destailleur 2014-09-03 16:09:14 +02:00
parent 1eaf615426
commit 7021f4fb01
5 changed files with 15 additions and 11 deletions

View File

@ -207,7 +207,6 @@ if ($type == 'directory')
if ($section === '0') if ($section === '0')
{ {
$filearray=array(); $filearray=array();
$textifempty='<br><div align="center"><font class="warning">'.$langs->trans("DirNotSynchronizedSyncFirst").'</font></div><br>';
} }
else $filearray=dol_dir_list($upload_dir,"files",0,'',array('^\.','(\.meta|_preview\.png)$','^temp$','^CVS$'),$sortfield, $sorting,1); else $filearray=dol_dir_list($upload_dir,"files",0,'',array('^\.','(\.meta|_preview\.png)$','^temp$','^CVS$'),$sortfield, $sorting,1);
@ -216,6 +215,7 @@ if ($type == 'directory')
$param.='&section='.$section; $param.='&section='.$section;
$textifempty = $langs->trans('NoFileFound'); $textifempty = $langs->trans('NoFileFound');
} }
else if ($section === '0') $textifempty='<br><div align="center"><font class="warning">'.$langs->trans("DirNotSynchronizedSyncFirst").'</font></div><br>';
else $textifempty=($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("ECMSelectASection")); else $textifempty=($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("ECMSelectASection"));
$formfile->list_of_documents($filearray,'','ecm',$param,1,$relativepath,$user->rights->ecm->upload,1,$textifempty,$maxlengthname,'',$url); $formfile->list_of_documents($filearray,'','ecm',$param,1,$relativepath,$user->rights->ecm->upload,1,$textifempty,$maxlengthname,'',$url);

View File

@ -145,7 +145,8 @@ if (file_exists($fullpathselecteddir))
{ {
if (empty($val['fullrelativename'])) // If we did not find entry into database, but found a directory (dol_is_dir was ok at previous test) if (empty($val['fullrelativename'])) // If we did not find entry into database, but found a directory (dol_is_dir was ok at previous test)
{ {
$val['fullrelativename']=$file; $val['id']=0; $val['fullrelativename']=$file;
$val['id']=0;
$val['label']=$file; $val['label']=$file;
$val['description']=''; $val['description']='';
$nboffilesinsubdir=$langs->trans("Unknown"); $nboffilesinsubdir=$langs->trans("Unknown");

View File

@ -759,7 +759,7 @@ class FormFile
if ($nboffiles > 0) include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; if ($nboffiles > 0) include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
$var=true; $var=false;
foreach($filearray as $key => $file) // filearray must be only files here foreach($filearray as $key => $file) // filearray must be only files here
{ {
if ($file['name'] != '.' if ($file['name'] != '.'

View File

@ -154,7 +154,7 @@ class EcmDirectory // extends CommonObject
// Call trigger // Call trigger
$result=$this->call_trigger('MYECMDIR_CREATE',$user); $result=$this->call_trigger('MYECMDIR_CREATE',$user);
if ($result < 0) { $error++; } if ($result < 0) { $error++; }
// End call triggers // End call triggers
if (! $error) if (! $error)
@ -219,7 +219,7 @@ class EcmDirectory // extends CommonObject
{ {
// Call trigger // Call trigger
$result=$this->call_trigger('MYECMDIR_MODIFY',$user); $result=$this->call_trigger('MYECMDIR_MODIFY',$user);
if ($result < 0) { $error++; } if ($result < 0) { $error++; }
// End call triggers // End call triggers
} }
@ -356,10 +356,10 @@ class EcmDirectory // extends CommonObject
{ {
$this->db->rollback(); $this->db->rollback();
return -2; return -2;
} }
// End call triggers // End call triggers
} }
if ($mode != 'databaseonly') if ($mode != 'databaseonly')
{ {
$file = $conf->ecm->dir_output . "/" . $relativepath; $file = $conf->ecm->dir_output . "/" . $relativepath;
@ -511,7 +511,7 @@ class EcmDirectory // extends CommonObject
/** /**
* Reconstruit l'arborescence des categories sous la forme d'un tableau * Reconstruit l'arborescence des categories sous la forme d'un tableau à partir de la base de donnée
* Renvoi un tableau de tableau('id','id_mere',...) trie selon arbre et avec: * Renvoi un tableau de tableau('id','id_mere',...) trie selon arbre et avec:
* id Id de la categorie * id Id de la categorie
* id_mere Id de la categorie mere * id_mere Id de la categorie mere
@ -693,7 +693,7 @@ class EcmDirectory // extends CommonObject
return -1; return -1;
} }
} }
/** /**
* Call trigger based on this instance * Call trigger based on this instance
* *
@ -725,6 +725,6 @@ class EcmDirectory // extends CommonObject
return $result; return $result;
} }
} }

View File

@ -42,7 +42,7 @@ $(document).ready(function() {
}, },
// Called if we click on a dir (not a file) // Called if we click on a dir (not a file)
function(elem) { function(elem) {
id=elem.attr('id').substr(12); id=elem.attr('id').substr(12); // We get id that is 'fmdirlia_id_xxx' (id we want is xxx)
jQuery("#formuserfile_section_dir").val(elem.attr('rel')); jQuery("#formuserfile_section_dir").val(elem.attr('rel'));
jQuery("#formuserfile_section_id").val(id); jQuery("#formuserfile_section_id").val(id);
jQuery('#formuserfile').show(); jQuery('#formuserfile').show();
@ -65,6 +65,9 @@ $(document).ready(function() {
function loadandshowpreview(filedirname,section) function loadandshowpreview(filedirname,section)
{ {
//alert('filedirname='+filedirname); //alert('filedirname='+filedirname);
//console.log(filedirname);
//console.log(section);
$('#ecmfileview').empty(); $('#ecmfileview').empty();
var url = '<?php echo dol_buildpath('/core/ajax/ajaxdirpreview.php',1); ?>?action=preview&module=ecm&section='+section+'&file='+urlencode(filedirname); var url = '<?php echo dol_buildpath('/core/ajax/ajaxdirpreview.php',1); ?>?action=preview&module=ecm&section='+section+'&file='+urlencode(filedirname);