Update myobject_document.php
This commit is contained in:
parent
80d4bb4284
commit
241a738a29
@ -79,12 +79,18 @@ $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
|||||||
$sortfield = GETPOST("sortfield", 'alpha');
|
$sortfield = GETPOST("sortfield", 'alpha');
|
||||||
$sortorder = GETPOST("sortorder", 'alpha');
|
$sortorder = GETPOST("sortorder", 'alpha');
|
||||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
if (empty($page) || $page == -1) {
|
||||||
|
$page = 0;
|
||||||
|
} // If $page is not defined, or '' or -1
|
||||||
$offset = $liste_limit * $page;
|
$offset = $liste_limit * $page;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
if (!$sortorder) $sortorder = "ASC";
|
if (!$sortorder) {
|
||||||
if (!$sortfield) $sortfield = "name";
|
$sortorder = "ASC";
|
||||||
|
}
|
||||||
|
if (!$sortfield) {
|
||||||
|
$sortfield = "name";
|
||||||
|
}
|
||||||
//if (! $sortfield) $sortfield="position_name";
|
//if (! $sortfield) $sortfield="position_name";
|
||||||
|
|
||||||
// Initialize technical objects
|
// Initialize technical objects
|
||||||
@ -98,7 +104,9 @@ $extrafields->fetch_name_optionals_label($object->table_element);
|
|||||||
// Load object
|
// Load object
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
|
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
|
||||||
|
|
||||||
if ($id > 0 || !empty($ref)) $upload_dir = $conf->mymodule->multidir_output[$object->entity ? $object->entity : $conf->entity]."/myobject/".get_exdir(0, 0, 0, 1, $object);
|
if ($id > 0 || !empty($ref)) {
|
||||||
|
$upload_dir = $conf->mymodule->multidir_output[$object->entity ? $object->entity : $conf->entity]."/myobject/".get_exdir(0, 0, 0, 1, $object);
|
||||||
|
}
|
||||||
|
|
||||||
// Security check - Protection if external user
|
// Security check - Protection if external user
|
||||||
//if ($user->socid > 0) accessforbidden();
|
//if ($user->socid > 0) accessforbidden();
|
||||||
@ -127,8 +135,7 @@ $help_url = '';
|
|||||||
//$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
|
//$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
|
||||||
llxHeader('', $title, $help_url);
|
llxHeader('', $title, $help_url);
|
||||||
|
|
||||||
if ($object->id)
|
if ($object->id) {
|
||||||
{
|
|
||||||
/*
|
/*
|
||||||
* Show tabs
|
* Show tabs
|
||||||
*/
|
*/
|
||||||
@ -140,8 +147,7 @@ if ($object->id)
|
|||||||
// Build file list
|
// Build file list
|
||||||
$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
|
$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
|
||||||
$totalsize = 0;
|
$totalsize = 0;
|
||||||
foreach ($filearray as $key => $file)
|
foreach ($filearray as $key => $file) {
|
||||||
{
|
|
||||||
$totalsize += $file['size'];
|
$totalsize += $file['size'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user