New: Auto ecm for third parties
This commit is contained in:
parent
e734a3cdca
commit
0a75367a74
@ -31,7 +31,8 @@ if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
|
|||||||
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
|
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
|
||||||
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','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("../../main.inc.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php');
|
require_once(DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php');
|
||||||
@ -54,7 +55,7 @@ if (! isset($mode) || $mode != 'noajax')
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else // For no ajax call
|
||||||
{
|
{
|
||||||
$ecmdir = new EcmDirectory($db);
|
$ecmdir = new EcmDirectory($db);
|
||||||
$relativepath='';
|
$relativepath='';
|
||||||
@ -124,11 +125,11 @@ if (! dol_is_dir($upload_dir))
|
|||||||
}
|
}
|
||||||
|
|
||||||
print '<!-- TYPE='.$type.' -->'."\n";
|
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='';
|
$param='';
|
||||||
|
|
||||||
// Dir
|
// Dir scan
|
||||||
if ($type == 'directory')
|
if ($type == 'directory')
|
||||||
{
|
{
|
||||||
$formfile=new FormFile($db);
|
$formfile=new FormFile($db);
|
||||||
@ -136,7 +137,7 @@ if ($type == 'directory')
|
|||||||
$param.=($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:'');
|
$param.=($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:'');
|
||||||
$maxlengthname=40;
|
$maxlengthname=40;
|
||||||
|
|
||||||
// Right area
|
// Right area. If module is defined, we are in automatic ecm.
|
||||||
if ($module == 'company') // Auto area for suppliers invoices
|
if ($module == 'company') // Auto area for suppliers invoices
|
||||||
{
|
{
|
||||||
$upload_dir = $conf->societe->dir_output; // TODO change for multicompany sharing
|
$upload_dir = $conf->societe->dir_output; // TODO change for multicompany sharing
|
||||||
|
|||||||
@ -650,6 +650,8 @@ class FormFile
|
|||||||
global $bc;
|
global $bc;
|
||||||
global $sortfield, $sortorder;
|
global $sortfield, $sortorder;
|
||||||
|
|
||||||
|
dol_syslog(get_class($this).'::list_of_autoecmfiles upload_dir='.$upload_dir.' modulepart='.$modulepart);
|
||||||
|
|
||||||
// Affiche liste des documents existant
|
// Affiche liste des documents existant
|
||||||
if (empty($useinecm)) print_titre($langs->trans("AttachedFiles"));
|
if (empty($useinecm)) print_titre($langs->trans("AttachedFiles"));
|
||||||
//else { $bc[true]=''; $bc[false]=''; };
|
//else { $bc[true]=''; $bc[false]=''; };
|
||||||
@ -666,7 +668,12 @@ class FormFile
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// To show ref or specific information according to view to show (defined by $module)
|
// 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');
|
include_once(DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php');
|
||||||
$object_instance=new Facture($this->db);
|
$object_instance=new Facture($this->db);
|
||||||
@ -718,6 +725,7 @@ class FormFile
|
|||||||
$id=0; $ref=''; $label='';
|
$id=0; $ref=''; $label='';
|
||||||
|
|
||||||
// To show ref or specific information according to view to show (defined by $module)
|
// 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') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=$reg[1]; }
|
||||||
if ($modulepart == 'invoice_supplier') { preg_match('/(\d+)\/[^\/]+$/',$relativefile,$reg); $id=$reg[1]; }
|
if ($modulepart == 'invoice_supplier') { preg_match('/(\d+)\/[^\/]+$/',$relativefile,$reg); $id=$reg[1]; }
|
||||||
if ($modulepart == 'propal') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=$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;
|
$upload_max_filesize = $mul_upload_max_filesize * (int) $upload_max_filesize;
|
||||||
// Max file size
|
// Max file size
|
||||||
$max_file_size = (($post_max_size < $upload_max_filesize) ? $post_max_size : $upload_max_filesize);
|
$max_file_size = (($post_max_size < $upload_max_filesize) ? $post_max_size : $upload_max_filesize);
|
||||||
|
|
||||||
// Include main
|
// Include main
|
||||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/ajax/fileupload_main.tpl.php');
|
include(DOL_DOCUMENT_ROOT.'/core/tpl/ajax/fileupload_main.tpl.php');
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user