NEW Can sort order of files in attach tab for leave and expensereport

This commit is contained in:
Laurent Destailleur 2018-04-16 19:25:27 +02:00
parent faea6861c3
commit 106fb87d0a
7 changed files with 26 additions and 23 deletions

View File

@ -992,6 +992,9 @@ class FormFile
global $dolibarr_main_url_root;
global $form;
$disablecrop=1;
if (in_array($modulepart, array('societe','product','produit','service','expensereport','holiday','member','project','ticketsup','user'))) $disablecrop=0;
// Define relative path used to store the file
if (empty($relativepath))
{
@ -1253,9 +1256,6 @@ class FormFile
$newmodulepart=$modulepart;
if (in_array($modulepart, array('product','produit','service'))) $newmodulepart='produit|service';
$disablecrop=1;
if (in_array($modulepart, array('societe','product','produit','service','expensereport','holiday','member','project','ticketsup','user'))) $disablecrop=0;
if (! $disablecrop && image_format_supported($file['name']) > 0)
{
if ($permtoeditline)

View File

@ -19,10 +19,10 @@
*/
// Following var can be set
// $permission = permission or not to add a file
// $permtoedit = permission or not to edit file name, crop file
// $modulepart = for download
// $param = param to add to download links
// $permission = permission or not to add a file
// $permtoedit = permission or not to edit file name, crop file
// $modulepart = for download
// $param = param to add to download links
// Protection to avoid direct call of template
if (empty($langs) || ! is_object($langs))
@ -36,6 +36,15 @@ $langs->load("link");
if (empty($relativepathwithnofile)) $relativepathwithnofile='';
if (empty($permtoedit)) $permtoedit=-1;
// Drag and drop for up and down allowed on product, thirdparty, ...
// The drag and drop call the page core/ajax/row.php
// If you enable the move up/down of files here, check that page that include template set its sortorder on 'position_name' instead of 'name'
// Also the object->fk_element must be defined.
$disablemove=1;
if (in_array($modulepart, array('product', 'produit', 'societe', 'user', 'ticketsup', 'holiday', 'expensereport'))) $disablemove=0;
/*
* Confirm form to delete
*/
@ -86,11 +95,6 @@ $formfile->form_attach_new_file(
$savingdocmask
);
// Drag and drop for up and down allowed on product, thirdparty, ...
// The drag and drop call the page core/ajax/row.php
$disablemove=1;
if (in_array($modulepart, array('product', 'produit', 'societe', 'user', 'ticketsup'))) $disablemove=0;
// List of document
$formfile->list_of_documents(
$filearray,

View File

@ -44,9 +44,7 @@ if (! empty($conf->accounting->enabled)) {
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
}
$langs->load("trips");
$langs->load("bills");
$langs->load("mails");
$langs->loadLangs(array("trips","bills","mails"));
$action=GETPOST('action','aZ09');
$cancel=GETPOST('cancel','alpha');

View File

@ -34,10 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/expensereport.lib.php';
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
$langs->load("other");
$langs->load("trips");
$langs->load("companies");
$langs->load("interventions");
$langs->loadLangs(array("other","trips","companies","interventions"));
$id = GETPOST('id','int');
$ref = GETPOST('ref', 'alpha');
@ -58,7 +55,7 @@ $offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="name";
if (! $sortfield) $sortfield="position_name";
$object = new ExpenseReport($db);
@ -67,6 +64,9 @@ $object->fetch($id, $ref);
$upload_dir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($object->ref);
$modulepart='trip';
// 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
/*
* Actions

View File

@ -35,6 +35,7 @@ class Holiday extends CommonObject
public $element='holiday';
public $table_element='holiday';
public $ismultientitymanaged = 0; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $fk_element = 'fk_holiday';
public $picto = 'holiday';
/**

View File

@ -59,7 +59,7 @@ $offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="name";
if (! $sortfield) $sortfield="position_name";
$object = new Holiday($db);

View File

@ -81,8 +81,8 @@ $extralabels = $extrafields->fetch_name_optionals_label('myobject');
// 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
//if ($id > 0 || ! empty($ref)) $upload_dir = $conf->sellyoursaas->multidir_output[$object->entity] . "/packages/" . dol_sanitizeFileName($object->id);
if ($id > 0 || ! empty($ref)) $upload_dir = $conf->sellyoursaas->multidir_output[$object->entity] . "/packages/" . dol_sanitizeFileName($object->ref);
//if ($id > 0 || ! empty($ref)) $upload_dir = $conf->sellyoursaas->multidir_output[$object->entity] . "/myobject/" . dol_sanitizeFileName($object->id);
if ($id > 0 || ! empty($ref)) $upload_dir = $conf->sellyoursaas->multidir_output[$object->entity] . "/myobject/" . dol_sanitizeFileName($object->ref);
/*