New: Auto ecm for third parties

This commit is contained in:
Laurent Destailleur 2012-06-24 17:49:52 +02:00
parent e734a3cdca
commit 0a75367a74
2 changed files with 16 additions and 7 deletions

View File

@ -31,7 +31,8 @@ if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
if (! isset($mode) || $mode != 'noajax')
if (! isset($mode) || $mode != 'noajax') // For ajax call
{
require_once("../../main.inc.php");
require_once(DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php');
@ -54,7 +55,7 @@ if (! isset($mode) || $mode != 'noajax')
exit;
}
}
else
else // For no ajax call
{
$ecmdir = new EcmDirectory($db);
$relativepath='';
@ -124,11 +125,11 @@ if (! dol_is_dir($upload_dir))
}
print '<!-- TYPE='.$type.' -->'."\n";
print '<!-- Ajax page called with url '.$_SERVER["PHP_SELF"].'?'.$_SERVER["QUERY_STRING"].' -->'."\n";
print '<!-- Page called with mode='.$mode.' url='.$_SERVER["PHP_SELF"].'?'.$_SERVER["QUERY_STRING"].' -->'."\n";
$param='';
// Dir
// Dir scan
if ($type == 'directory')
{
$formfile=new FormFile($db);
@ -136,7 +137,7 @@ if ($type == 'directory')
$param.=($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:'');
$maxlengthname=40;
// Right area
// Right area. If module is defined, we are in automatic ecm.
if ($module == 'company') // Auto area for suppliers invoices
{
$upload_dir = $conf->societe->dir_output; // TODO change for multicompany sharing

View File

@ -650,6 +650,8 @@ class FormFile
global $bc;
global $sortfield, $sortorder;
dol_syslog(get_class($this).'::list_of_autoecmfiles upload_dir='.$upload_dir.' modulepart='.$modulepart);
// Affiche liste des documents existant
if (empty($useinecm)) print_titre($langs->trans("AttachedFiles"));
//else { $bc[true]=''; $bc[false]=''; };
@ -666,7 +668,12 @@ class FormFile
print '</tr>';
// To show ref or specific information according to view to show (defined by $module)
if ($modulepart == 'invoice')
if ($modulepart == 'company')
{
include_once(DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php');
$object_instance=new Societe($this->db);
}
else if ($modulepart == 'invoice')
{
include_once(DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php');
$object_instance=new Facture($this->db);
@ -718,6 +725,7 @@ class FormFile
$id=0; $ref=''; $label='';
// To show ref or specific information according to view to show (defined by $module)
if ($modulepart == 'company') { preg_match('/(\d+)\/[^\/]+$/',$relativefile,$reg); $id=$reg[1]; }
if ($modulepart == 'invoice') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=$reg[1]; }
if ($modulepart == 'invoice_supplier') { preg_match('/(\d+)\/[^\/]+$/',$relativefile,$reg); $id=$reg[1]; }
if ($modulepart == 'propal') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=$reg[1]; }
@ -804,7 +812,7 @@ class FormFile
$upload_max_filesize = $mul_upload_max_filesize * (int) $upload_max_filesize;
// Max file size
$max_file_size = (($post_max_size < $upload_max_filesize) ? $post_max_size : $upload_max_filesize);
// Include main
include(DOL_DOCUMENT_ROOT.'/core/tpl/ajax/fileupload_main.tpl.php');