';
print '| ';
- $id='';$ref='';
- if ($modulepart == 'invoice')
- {
- preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg);
- $ref=$reg[1];
- $object_static->fetch('',$ref);
- //print $relativefile.'rr'.$id;
- print $object_static->getNomUrl(1,'document');
- }
- if ($modulepart == 'invoice_supplier')
- {
- preg_match('/(\d+)\/[^\/]+$/',$relativefile,$reg);
- $id=$reg[1];
- $object_static->fetch($id);
- //print $relativefile.'rr'.$id;
- print $object_static->getNomUrl(1,'document');
- }
+ if ($object_instance->id) print $object_instance->getNomUrl(1,'document');
+ else print $langs->trans("ObjectDeleted",($id?$id:$ref));
print ' | ';
print '';
//print "XX".$file['name']; //$file['name'] must be utf8
diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php
index 0decdf402f7..68aa7d898b3 100644
--- a/htdocs/core/lib/files.lib.php
+++ b/htdocs/core/lib/files.lib.php
@@ -44,7 +44,7 @@ function dol_getwebuser($mode)
* @param int $recursive Determines whether subdirectories are searched
* @param string $filter Regex for include filter
* @param string $excludefilter Array of Regex for exclude filter (example: array('\.meta$','^\.')
- * @param string $sortcriteria Sort criteria ("","name","date","size")
+ * @param string $sortcriteria Sort criteria ("","fullname","name","date","size")
* @param string $sortorder Sort order (SORT_ASC, SORT_DESC)
* @param int $mode 0=Return array minimum keys loaded (faster), 1=Force all keys like date and size to be loaded (slower), 2=Force load of date only, 3=Force load of size only
* @return array Array of array('name'=>'xxx','fullname'=>'/abc/xxx','date'=>'yyy','size'=>99,'type'=>'dir|file')
diff --git a/htdocs/document.php b/htdocs/document.php
index ecac2268886..9c59f1da051 100644
--- a/htdocs/document.php
+++ b/htdocs/document.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2004-2010 Laurent Destailleur
+ * Copyright (C) 2004-2012 Laurent Destailleur
* Copyright (C) 2005 Simon Tosser
* Copyright (C) 2005-2011 Regis Houssin
* Copyright (C) 2010 Pierre Morin
@@ -135,7 +135,7 @@ if ($modulepart)
}
// Wrapping for invoices
- else if ($modulepart == 'facture')
+ else if ($modulepart == 'facture' || $modulepart == 'invoice')
{
if ($user->rights->facture->lire || preg_match('/^specimen/i',$original_file))
{
@@ -188,7 +188,7 @@ if ($modulepart)
}
// Wrapping pour les commandes
- else if ($modulepart == 'commande')
+ else if ($modulepart == 'commande' || $modulepart == 'order')
{
if ($user->rights->commande->lire || preg_match('/^specimen/i',$original_file))
{
@@ -210,7 +210,7 @@ if ($modulepart)
}
// Wrapping pour les commandes fournisseurs
- else if ($modulepart == 'commande_fournisseur')
+ else if ($modulepart == 'commande_fournisseur' || $modulepart == 'order_supplier')
{
if ($user->rights->fournisseur->commande->lire || preg_match('/^specimen/i',$original_file))
{
diff --git a/htdocs/ecm/index.php b/htdocs/ecm/index.php
index 4ab066e0dc8..03a53610767 100644
--- a/htdocs/ecm/index.php
+++ b/htdocs/ecm/index.php
@@ -1,5 +1,5 @@
+/* Copyright (C) 2008-2012 Laurent Destailleur
* Copyright (C) 2008-2010 Regis Houssin
*
* This program is free software; you can redistribute it and/or modify
@@ -66,7 +66,7 @@ $offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortorder) $sortorder="ASC";
-if (! $sortfield) $sortfield="label";
+if (! $sortfield) $sortfield="fullname";
$ecmdir = new EcmDirectory($db);
if (GETPOST("section"))
@@ -352,9 +352,10 @@ if ($conf->societe->enabled) { $rowspan++; $sectionauto[]=array('level'=>1,
if ($conf->propal->enabled) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'propal', 'test'=>$conf->propal->enabled, 'label'=>$langs->trans("Prop"), 'desc'=>$langs->trans("ECMDocsByProposals")); }
if ($conf->contrat->enabled) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'contract','test'=>$conf->contrat->enabled, 'label'=>$langs->trans("Contracts"), 'desc'=>$langs->trans("ECMDocsByContracts")); }
if ($conf->commande->enabled) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'order', 'test'=>$conf->commande->enabled,'label'=>$langs->trans("CustomersOrders"), 'desc'=>$langs->trans("ECMDocsByOrders")); }
-if ($conf->fournisseur->enabled) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'order_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersOrders"), 'desc'=>$langs->trans("ECMDocsByOrders")); }
if ($conf->facture->enabled) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'invoice', 'test'=>$conf->facture->enabled, 'label'=>$langs->trans("CustomersInvoices"), 'desc'=>$langs->trans("ECMDocsByInvoices")); }
-if ($conf->fournisseur->enabled) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'invoice_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersInvoices"), 'desc'=>$langs->trans("ECMDocsByInvoices")); }
+if ($conf->fournisseur->enabled) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'order_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersOrders"), 'desc'=>$langs->trans("ECMDocsByOrders")); }
+if ($conf->fournisseur->enabled) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'invoice_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersInvoices"), 'desc'=>$langs->trans("ECMDocsByInvoices")); }
+if ($conf->tax->enabled) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'tax', 'test'=>$conf->tax->enabled, 'label'=>$langs->trans("SocialContributions"), 'desc'=>$langs->trans("ECMDocsBySocialContributions")); }
//***********************
@@ -802,39 +803,101 @@ else
$formfile=new FormFile($db);
$param=($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:'');
+$maxlengthname=40;
// Right area
-if ($module == 'invoice_supplier') // Auto area for suppliers invoices
+if ($module == 'company') // Auto area for suppliers invoices
{
- $relativepath='facture';
- $upload_dir = $conf->fournisseur->dir_output.'/'.$relativepath;
- $filearray=dol_dir_list($upload_dir,"files",1,'',array('^SPECIMEN\.pdf$','^\.','\.meta$','^temp$','^CVS$'),$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
+ $upload_dir = $conf->societe->dir_output;
+ $filearray=dol_dir_list($upload_dir,"files",1,'',array('^SPECIMEN\.pdf$','^\.','\.meta$','^temp$','^payments$','^CVS$','^thumbs$'),$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
$param.='&module='.$module;
$textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("ECMSelectASection")));
- $formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,40);
+ $formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname);
}
else if ($module == 'invoice') // Auto area for suppliers invoices
{
$upload_dir = $conf->facture->dir_output;
- $filearray=dol_dir_list($upload_dir,"files",1,'',array('^SPECIMEN\.pdf$','^\.','\.meta$','^temp$','^payments$','^CVS$'),$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
+ $filearray=dol_dir_list($upload_dir,"files",1,'',array('^SPECIMEN\.pdf$','^\.','\.meta$','^temp$','^payments$','^CVS$','^thumbs$'),$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
$param.='&module='.$module;
$textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("ECMSelectASection")));
- $formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,40);
+ $formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname);
+}
+else if ($module == 'invoice_supplier') // Auto area for suppliers invoices
+{
+ $relativepath='facture';
+ $upload_dir = $conf->fournisseur->dir_output.'/'.$relativepath;
+ $filearray=dol_dir_list($upload_dir,"files",1,'',array('^SPECIMEN\.pdf$','^\.','\.meta$','^temp$','^CVS$','^thumbs$'),$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
+
+ $param.='&module='.$module;
+ $textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("ECMSelectASection")));
+
+ $formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname);
+}
+else if ($module == 'propal') // Auto area for customers orders
+{
+ $upload_dir = $conf->propale->dir_output;
+ $filearray=dol_dir_list($upload_dir,"files",1,'',array('^SPECIMEN\.pdf$','^\.','\.meta$','^temp$','^payments$','^CVS$','^thumbs$'),$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
+
+ $param.='&module='.$module;
+ $textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("ECMSelectASection")));
+
+ $formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname);
+}
+else if ($module == 'order') // Auto area for customers orders
+{
+ $upload_dir = $conf->commande->dir_output;
+ $filearray=dol_dir_list($upload_dir,"files",1,'',array('^SPECIMEN\.pdf$','^\.','\.meta$','^temp$','^payments$','^CVS$','^thumbs$'),$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
+
+ $param.='&module='.$module;
+ $textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("ECMSelectASection")));
+
+ $formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname);
+}
+else if ($module == 'order_supplier') // Auto area for suppliers orders
+{
+ $relativepath='commande';
+ $upload_dir = $conf->fournisseur->dir_output.'/'.$relativepath;
+ $filearray=dol_dir_list($upload_dir,"files",1,'',array('^SPECIMEN\.pdf$','^\.','\.meta$','^temp$','^payments$','^CVS$','^thumbs$'),$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
+
+ $param.='&module='.$module;
+ $textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("ECMSelectASection")));
+
+ $formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname);
+}
+else if ($module == 'contract') // Auto area for suppliers invoices
+{
+ $upload_dir = $conf->contrat->dir_output;
+ $filearray=dol_dir_list($upload_dir,"files",1,'',array('^SPECIMEN\.pdf$','^\.','\.meta$','^temp$','^CVS$','^thumbs$'),$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
+
+ $param.='&module='.$module;
+ $textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("ECMSelectASection")));
+
+ $formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname);
+}
+else if ($module == 'tax') // Auto area for suppliers invoices
+{
+ $upload_dir = $conf->tax->dir_output;
+ $filearray=dol_dir_list($upload_dir,"files",1,'',array('^SPECIMEN\.pdf$','^\.','\.meta$','^temp$','^CVS$','^thumbs$'),$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
+
+ $param.='&module='.$module;
+ $textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("ECMSelectASection")));
+
+ $formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname);
}
else // Manual area
{
$relativepath=$ecmdir->getRelativePath();
$upload_dir = $conf->ecm->dir_output.'/'.$relativepath;
- $filearray=dol_dir_list($upload_dir,"files",0,'',array('^\.','\.meta$'),$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
+ $filearray=dol_dir_list($upload_dir,"files",0,'',array('^\.','\.meta$','^temp$','^CVS$'),$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
$param.='§ion='.$section;
$textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("ECMSelectASection")));
- $formfile->list_of_documents($filearray,'','ecm',$param,1,$relativepath,$user->rights->ecm->upload,1,$textifempty,40);
+ $formfile->list_of_documents($filearray,'','ecm',$param,1,$relativepath,$user->rights->ecm->upload,1,$textifempty,$maxlengthname);
}
// print '';
diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang
index 167dae2d2be..960e5ee8519 100644
--- a/htdocs/langs/en_US/main.lang
+++ b/htdocs/langs/en_US/main.lang
@@ -605,6 +605,7 @@ URLPhoto=Url of photo/logo
SetLinkToThirdParty=Link to another third party
CreateDraft=Create draft
ClickToEdit=Click to edit
+ObjectDeleted=Object %s deleted
# Week day
Monday=Monday
diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang
index a21a5d1867f..8c1af9231d6 100644
--- a/htdocs/langs/fr_FR/main.lang
+++ b/htdocs/langs/fr_FR/main.lang
@@ -607,6 +607,7 @@ URLPhoto=Url vers photo/logo
SetLinkToThirdParty=Lier vers un autre tiers
CreateDraft=Créer brouillon
ClickToEdit=Cliquer ici pour éditer
+ObjectDeleted=Objet %s supprimé
# Week day
Monday=Lundi
|