NEW Can sort joined files on thirdparty and user card.

This commit is contained in:
Laurent Destailleur 2017-11-10 18:14:29 +01:00
parent beacf4225f
commit cb03b2f307
7 changed files with 37 additions and 18 deletions

View File

@ -63,9 +63,9 @@ if ((isset($_POST['roworder']) && ! empty($_POST['roworder'])) && (isset($_POST[
$row->table_element_line = $table_element_line;
$row->fk_element = $fk_element;
$row->id = $element_id;
$row->line_ajaxorder($newrowordertab);
$row->line_ajaxorder($newrowordertab); // This update field rank or position in table table_element_line
// Reorder line to have position of chilren lines sharing same counter than parent lines
// Reorder line to have position of children lines sharing same counter than parent lines
// This should be useless because there is no need to have children sharing same counter than parent, but well, it's cleaner into database.
if (in_array($fk_element,array('fk_facture','fk_propal','fk_commande')))
{

View File

@ -1042,10 +1042,10 @@ class FormFile
{
completeFileArrayWithDatabaseInfo($filearray, $relativedir);
/*var_dump($sortfield);
var_dump($sortorder);*/
if ($sortfield && $sortorder)
//var_dump($sortfield.' - '.$sortorder);
if ($sortfield && $sortorder) // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name)
{
//var_dump($sortfield);
$filearray=dol_sort_array($filearray, $sortfield, $sortorder);
}
//var_dump($filearray);
@ -1139,7 +1139,7 @@ class FormFile
if (in_array($modulepart, array('product','produit','service'))) $newmodulepart='produit|service';
$disablecrop=1;
if (in_array($modulepart, array('product','produit','service','expensereport','holiday','project','user'))) $disablecrop=0;
if (in_array($modulepart, array('societe','product','produit','service','expensereport','holiday','project','user'))) $disablecrop=0;
if (! $disablecrop && image_format_supported($file['name']) > 0)
{

View File

@ -67,9 +67,15 @@ elseif ($modulepart == 'expensereport')
}
elseif ($modulepart == 'user')
{
$result=restrictedArea($user,'user',$id,'user');
if (! $user->rights->user->user->lire) accessforbidden();
$accessallowed=1;
$result=restrictedArea($user,'user',$id,'user');
if (! $user->rights->user->user->lire) accessforbidden();
$accessallowed=1;
}
elseif ($modulepart == 'societe')
{
$result=restrictedArea($user,'societe',$id,'societe');
if (! $user->rights->societe->lire) accessforbidden();
$accessallowed=1;
}
// Security:
@ -115,6 +121,17 @@ elseif ($modulepart == 'holiday')
$dir=$conf->holiday->dir_output; // By default
}
}
elseif ($modulepart == 'societe')
{
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
$object = new Societe($db);
if ($id > 0)
{
$result = $object->fetch($id);
if ($result <= 0) dol_print_error($db,'Failed to load object');
$dir=$conf->societe->dir_output;
}
}
elseif ($modulepart == 'user')
{
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
@ -145,6 +162,7 @@ if (empty($backtourl))
else if (in_array($modulepart, array('holiday'))) $backtourl=DOL_URL_ROOT."/holiday/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
else if (in_array($modulepart, array('project'))) $backtourl=DOL_URL_ROOT."/projet/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
else if (in_array($modulepart, array('user'))) $backtourl=DOL_URL_ROOT."/user/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
else if (in_array($modulepart, array('societe'))) $backtourl=DOL_URL_ROOT."/societe/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
}

View File

@ -79,7 +79,7 @@ $formfile->form_attach_new_file(
);
$disablemove=1;
if ($modulepart == 'product' || $modulepart == 'produit') $disablemove=0; // Drag and drop for up and down allowed on product
if (in_array($modulepart, array('product', 'produit', 'societe', 'user'))) $disablemove=0; // Drag and drop for up and down allowed on product
// List of document
$formfile->list_of_documents(

View File

@ -58,7 +58,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 Societe($db);
if ($id > 0 || ! empty($ref))

View File

@ -40,6 +40,7 @@ class User extends CommonObject
{
public $element='user';
public $table_element='user';
public $fk_element='fk_user';
public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
public $id=0;
@ -53,17 +54,17 @@ class User extends CommonObject
public $job;
public $signature;
public $address;
public $zip;
public $town;
public $state_id;
public $state_code;
public $state;
public $zip;
public $town;
public $state_id;
public $state_code;
public $state;
public $office_phone;
public $office_fax;
public $user_mobile;
public $admin;
public $login;
public $api_key;
public $api_key;
public $entity;
//! Clear password in memory

View File

@ -81,7 +81,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 User($db);
if ($id > 0 || ! empty($ref))