Merge branch '5.0' into 5.0
This commit is contained in:
commit
4c28e1598b
19
ChangeLog
19
ChangeLog
@ -155,6 +155,25 @@ Dolibarr 5.0 was frozen before PHP 7.1 was released. Unit tests are successful o
|
|||||||
feedback to confirm all application is compatible. Current officiel supported PHP versions are PHP 5.3 to 7.0.
|
feedback to confirm all application is compatible. Current officiel supported PHP versions are PHP 5.3 to 7.0.
|
||||||
|
|
||||||
|
|
||||||
|
***** ChangeLog for 4.0.4 to 4.0.3 *****
|
||||||
|
FIX: #6227 Document models table header "Unit" is shown in 2 lines in Spanish
|
||||||
|
FIX: #6230
|
||||||
|
FIX: #6237
|
||||||
|
FIX: #6245 Thirdparty link in supplier invoices list, links to "comm/card" instead of "fourn/card" page
|
||||||
|
FIX: #6253 Supplier invoice list filter does not respect "thirdparty" filter
|
||||||
|
FIX: #6277
|
||||||
|
FIX: project list and ajax completion return wrong list.
|
||||||
|
FIX: bug margin calculation by user with multicompany
|
||||||
|
FIX: Can make a stock transfert on product not on sale/purchase.
|
||||||
|
FIX: extrafield input for varchar was not working with special char within (ie double quotes)
|
||||||
|
FIX: javascript error
|
||||||
|
FIX: link for not found photo when using gravatar. Must use external url.
|
||||||
|
FIX: Protection so even if link is output for external user, links is disabled.
|
||||||
|
FIX: repair tool was ko to restore extrafields with type select.
|
||||||
|
FIX: Security access problem with external users on projects/tasks
|
||||||
|
FIX: We must not drop extrafield column if there is still record on other entities.
|
||||||
|
FIX: regression with sedning email when introducing security options to restrict nb of email sending.
|
||||||
|
t
|
||||||
***** ChangeLog for 4.0.3 to 4.0.2 *****
|
***** ChangeLog for 4.0.3 to 4.0.2 *****
|
||||||
FIX: #5853 $conf->global->$calc==0 || $conf->global->$calc==1
|
FIX: #5853 $conf->global->$calc==0 || $conf->global->$calc==1
|
||||||
FIX: #5958 no discount on supplier command made by replenishment
|
FIX: #5958 no discount on supplier command made by replenishment
|
||||||
|
|||||||
@ -983,7 +983,7 @@ if ($action == 'create')
|
|||||||
$projectid = GETPOST('projectid')?GETPOST('projectid'):$object->fk_project;
|
$projectid = GETPOST('projectid')?GETPOST('projectid'):$object->fk_project;
|
||||||
$langs->load('projects');
|
$langs->load('projects');
|
||||||
print '<tr><td>' . $langs->trans('Project') . '</td><td>';
|
print '<tr><td>' . $langs->trans('Project') . '</td><td>';
|
||||||
$numprojet = $formproject->select_projects($socid, $projectid, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, $forceaddid=0, $morecss='');
|
$numprojet = $formproject->select_projects($object->thirdparty->id, $projectid, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0, '');
|
||||||
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid=' . $object->thirdparty->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$object->thirdparty->id.(!empty($id)?'&id='.$id:'')).'">' . $langs->trans("AddProject") . '</a>';
|
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid=' . $object->thirdparty->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$object->thirdparty->id.(!empty($id)?'&id='.$id:'')).'">' . $langs->trans("AddProject") . '</a>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -272,7 +272,7 @@ $sql.= " state.code_departement, state.nom";
|
|||||||
// Add where from extra fields
|
// Add where from extra fields
|
||||||
foreach ($extrafields->attribute_label as $key => $val)
|
foreach ($extrafields->attribute_label as $key => $val)
|
||||||
{
|
{
|
||||||
$sql .= ', ef.'.$val;
|
$sql .= ', ef.'.$key;
|
||||||
}
|
}
|
||||||
// Add where from hooks
|
// Add where from hooks
|
||||||
$parameters=array();
|
$parameters=array();
|
||||||
|
|||||||
@ -1372,7 +1372,7 @@ class Form
|
|||||||
* @param int $show_empty 0=list with no empty value, 1=add also an empty value into list
|
* @param int $show_empty 0=list with no empty value, 1=add also an empty value into list
|
||||||
* @param array $exclude Array list of users id to exclude
|
* @param array $exclude Array list of users id to exclude
|
||||||
* @param int $disabled If select list must be disabled
|
* @param int $disabled If select list must be disabled
|
||||||
* @param array $include Array list of users id to include or 'hierarchy' to have only supervised users
|
* @param array|string $include Array list of users id to include or 'hierarchy' to have only supervised users or 'hierarchyme' to have supervised + me
|
||||||
* @param array $enableonly Array list of users id to be enabled. All other must be disabled
|
* @param array $enableonly Array list of users id to be enabled. All other must be disabled
|
||||||
* @param int $force_entity 0 or Id of environment to force
|
* @param int $force_entity 0 or Id of environment to force
|
||||||
* @param int $maxlength Maximum length of string into list (0=no limit)
|
* @param int $maxlength Maximum length of string into list (0=no limit)
|
||||||
@ -1396,22 +1396,18 @@ class Form
|
|||||||
$includeUsers=null;
|
$includeUsers=null;
|
||||||
|
|
||||||
// Permettre l'exclusion d'utilisateurs
|
// Permettre l'exclusion d'utilisateurs
|
||||||
if (is_array($exclude)) $excludeUsers = implode("','",$exclude);
|
if (is_array($exclude)) $excludeUsers = implode(",",$exclude);
|
||||||
// Permettre l'inclusion d'utilisateurs
|
// Permettre l'inclusion d'utilisateurs
|
||||||
if (is_array($include)) $includeUsers = implode("','",$include);
|
if (is_array($include)) $includeUsers = implode(",",$include);
|
||||||
else if ($include == 'hierarchy')
|
else if ($include == 'hierarchy')
|
||||||
{
|
{
|
||||||
// Build list includeUsers to have only hierarchy
|
// Build list includeUsers to have only hierarchy
|
||||||
$userid=$user->id;
|
$includeUsers = implode(",",$user->getAllChildIds(0));
|
||||||
$include=array();
|
|
||||||
if (empty($user->users) || ! is_array($user->users)) $user->get_full_tree();
|
|
||||||
foreach($user->users as $key => $val)
|
|
||||||
{
|
|
||||||
if (preg_match('/_'.$userid.'/',$val['fullpath'])) $include[]=$val['id'];
|
|
||||||
}
|
}
|
||||||
$includeUsers = implode("','",$include);
|
else if ($include == 'hierarchyme')
|
||||||
//var_dump($includeUsers);exit;
|
{
|
||||||
//var_dump($user->users);exit;
|
// Build list includeUsers to have only hierarchy and current user
|
||||||
|
$includeUsers = implode(",",$user->getAllChildIds(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
$out='';
|
$out='';
|
||||||
@ -1443,8 +1439,8 @@ class Form
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (! empty($user->societe_id)) $sql.= " AND u.fk_soc = ".$user->societe_id;
|
if (! empty($user->societe_id)) $sql.= " AND u.fk_soc = ".$user->societe_id;
|
||||||
if (is_array($exclude) && $excludeUsers) $sql.= " AND u.rowid NOT IN ('".$excludeUsers."')";
|
if (is_array($exclude) && $excludeUsers) $sql.= " AND u.rowid NOT IN (".$excludeUsers.")";
|
||||||
if (is_array($include) && $includeUsers) $sql.= " AND u.rowid IN ('".$includeUsers."')";
|
if ($includeUsers) $sql.= " AND u.rowid IN (".$includeUsers.")";
|
||||||
if (! empty($conf->global->USER_HIDE_INACTIVE_IN_COMBOBOX) || $noactive) $sql.= " AND u.statut <> 0";
|
if (! empty($conf->global->USER_HIDE_INACTIVE_IN_COMBOBOX) || $noactive) $sql.= " AND u.statut <> 0";
|
||||||
if (! empty($morefilter)) $sql.=" ".$morefilter;
|
if (! empty($morefilter)) $sql.=" ".$morefilter;
|
||||||
$sql.= " ORDER BY u.lastname ASC";
|
$sql.= " ORDER BY u.lastname ASC";
|
||||||
|
|||||||
@ -155,8 +155,10 @@ class FormProjets
|
|||||||
if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)";
|
if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)";
|
||||||
if ($socid > 0 && empty($conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY)) $sql.= " AND (p.fk_soc=".$socid." OR p.fk_soc IS NULL)";
|
if ($socid > 0 && empty($conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY)) $sql.= " AND (p.fk_soc=".$socid." OR p.fk_soc IS NULL)";
|
||||||
if (!empty($filterkey)) {
|
if (!empty($filterkey)) {
|
||||||
$sql .= " AND p.title LIKE '%".$this->db->escape($filterkey)."%'";
|
$sql .= ' AND (';
|
||||||
$sql .= " OR p.ref LIKE '%".$this->db->escape($filterkey)."%'";
|
$sql .= ' p.title LIKE "%'.$this->db->escape($filterkey).'%"';
|
||||||
|
$sql .= ' OR p.ref LIKE "%'.$this->db->escape($filterkey).'%"';
|
||||||
|
$sql .= ')';
|
||||||
}
|
}
|
||||||
$sql.= " ORDER BY p.ref ASC";
|
$sql.= " ORDER BY p.ref ASC";
|
||||||
|
|
||||||
|
|||||||
@ -111,53 +111,61 @@ class modExpenseReport extends DolibarrModules
|
|||||||
$this->rights = array(); // Permission array used by this module
|
$this->rights = array(); // Permission array used by this module
|
||||||
$this->rights_class = 'expensereport';
|
$this->rights_class = 'expensereport';
|
||||||
|
|
||||||
$this->rights[1][0] = 771;
|
$this->rights[$r][0] = 771;
|
||||||
$this->rights[1][1] = 'Read expense reports (yours and your subordinates)';
|
$this->rights[$r][1] = 'Read expense reports (yours and your subordinates)';
|
||||||
$this->rights[1][2] = 'r';
|
$this->rights[$r][2] = 'r';
|
||||||
$this->rights[1][3] = 0;
|
$this->rights[$r][3] = 0;
|
||||||
$this->rights[1][4] = 'lire';
|
$this->rights[$r][4] = 'lire';
|
||||||
|
$r++;
|
||||||
|
|
||||||
$this->rights[3][0] = 772;
|
$this->rights[$r][0] = 772;
|
||||||
$this->rights[3][1] = 'Create/modify expense reports';
|
$this->rights[$r][1] = 'Create/modify expense reports';
|
||||||
$this->rights[3][2] = 'w';
|
$this->rights[$r][2] = 'w';
|
||||||
$this->rights[3][3] = 0;
|
$this->rights[$r][3] = 0;
|
||||||
$this->rights[3][4] = 'creer';
|
$this->rights[$r][4] = 'creer';
|
||||||
|
$r++;
|
||||||
|
|
||||||
$this->rights[4][0] = 773;
|
$this->rights[$r][0] = 773;
|
||||||
$this->rights[4][1] = 'Delete expense reports';
|
$this->rights[$r][1] = 'Delete expense reports';
|
||||||
$this->rights[4][2] = 'd';
|
$this->rights[$r][2] = 'd';
|
||||||
$this->rights[4][3] = 0;
|
$this->rights[$r][3] = 0;
|
||||||
$this->rights[4][4] = 'supprimer';
|
$this->rights[$r][4] = 'supprimer';
|
||||||
|
$r++;
|
||||||
|
|
||||||
$this->rights[6][0] = 775;
|
$this->rights[$r][0] = 775;
|
||||||
$this->rights[6][1] = 'Approve expense reports';
|
$this->rights[$r][1] = 'Approve expense reports';
|
||||||
$this->rights[6][2] = 'w';
|
$this->rights[$r][2] = 'w';
|
||||||
$this->rights[6][3] = 0;
|
$this->rights[$r][3] = 0;
|
||||||
$this->rights[6][4] = 'approve';
|
$this->rights[$r][4] = 'approve';
|
||||||
|
$r++;
|
||||||
|
|
||||||
$this->rights[7][0] = 776;
|
$this->rights[$r][0] = 776;
|
||||||
$this->rights[7][1] = 'Pay expense reports';
|
$this->rights[$r][1] = 'Pay expense reports';
|
||||||
$this->rights[7][2] = 'w';
|
$this->rights[$r][2] = 'w';
|
||||||
$this->rights[7][3] = 0;
|
$this->rights[$r][3] = 0;
|
||||||
$this->rights[7][4] = 'to_paid';
|
$this->rights[$r][4] = 'to_paid';
|
||||||
|
$r++;
|
||||||
|
|
||||||
$this->rights[2][0] = 777;
|
$this->rights[$r][0] = 777;
|
||||||
$this->rights[2][1] = 'Read expense reports of everybody';
|
$this->rights[$r][1] = 'Read expense reports of everybody';
|
||||||
$this->rights[2][2] = 'r';
|
$this->rights[$r][2] = 'r';
|
||||||
$this->rights[2][3] = 1;
|
$this->rights[$r][3] = 1;
|
||||||
$this->rights[2][4] = 'readall';
|
$this->rights[$r][4] = 'readall';
|
||||||
|
$r++;
|
||||||
|
|
||||||
$this->rights[2][0] = 778;
|
$this->rights[$r][0] = 778;
|
||||||
$this->rights[2][1] = 'Create expense reports for everybody';
|
$this->rights[$r][1] = 'Create expense reports for everybody';
|
||||||
$this->rights[2][2] = 'w';
|
$this->rights[$r][2] = 'w';
|
||||||
$this->rights[2][3] = 0;
|
$this->rights[$r][3] = 0;
|
||||||
$this->rights[2][4] = 'writeall_advance';
|
$this->rights[$r][4] = 'writeall_advance';
|
||||||
|
$r++;
|
||||||
|
|
||||||
$this->rights[5][0] = 779;
|
$this->rights[$r][0] = 779;
|
||||||
$this->rights[5][1] = 'Export expense reports';
|
$this->rights[$r][1] = 'Export expense reports';
|
||||||
$this->rights[5][2] = 'r';
|
$this->rights[$r][2] = 'r';
|
||||||
$this->rights[5][3] = 0;
|
$this->rights[$r][3] = 0;
|
||||||
$this->rights[5][4] = 'export';
|
$this->rights[$r][4] = 'export';
|
||||||
|
$r++;
|
||||||
|
|
||||||
// Menus
|
// Menus
|
||||||
//-------
|
//-------
|
||||||
|
|||||||
@ -219,22 +219,28 @@ class modProjet extends DolibarrModules
|
|||||||
|
|
||||||
$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','s.fk_pays'=>'List:c_country:label',
|
$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','s.fk_pays'=>'List:c_country:label',
|
||||||
's.phone'=>'Text','s.email'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text',
|
's.phone'=>'Text','s.email'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text',
|
||||||
'p.rowid'=>"List:projet:ref",'p.ref'=>"Text",'p.title'=>"Text",'p.datec'=>"Date",'p.dateo'=>"Date",'p.datee'=>"Date",'p.fk_statut'=>'Status','cls.code'=>"Text",'p.opp_percent'=>'Numeric','p.description'=>"Text", 'p.entity'=>'Numeric',
|
'p.rowid'=>"List:projet:ref",'p.ref'=>"Text",'p.title'=>"Text",'p.datec'=>"Date",'p.dateo'=>"Date",'p.datee'=>"Date",'p.fk_statut'=>'Status','cls.code'=>"Text",'p.opp_percent'=>'Numeric','p.opp_amount'=>'Numeric','p.description'=>"Text",'p.entity'=>'Numeric',
|
||||||
'pt.rowid'=>'Text','pt.label'=>'Text','pt.dateo'=>"Date",'pt.datee'=>"Date",'pt.duration_effective'=>"Duree",'pt.planned_workload'=>"Numeric",'pt.progress'=>"Numeric",'pt.description'=>"Text",
|
'pt.rowid'=>'Text','pt.label'=>'Text','pt.dateo'=>"Date",'pt.datee'=>"Date",'pt.duration_effective'=>"Duree",'pt.planned_workload'=>"Numeric",'pt.progress'=>"Numeric",'pt.description'=>"Text",
|
||||||
'ptt.rowid'=>'Numeric','ptt.task_date'=>'Date','ptt.task_duration'=>"Duree",'ptt.fk_user'=>"List:user:CONCAT(lastname,' ',firstname)",'ptt.note'=>"Text");
|
'ptt.rowid'=>'Numeric','ptt.task_date'=>'Date','ptt.task_duration'=>"Duree",'ptt.fk_user'=>"List:user:CONCAT(lastname,' ',firstname)",'ptt.note'=>"Text");
|
||||||
|
|
||||||
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','s.fk_pays'=>'company',
|
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','s.fk_pays'=>'company',
|
||||||
's.phone'=>'company','s.email'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company');
|
's.phone'=>'company','s.email'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company');
|
||||||
|
|
||||||
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','s.fk_pays'=>'Country',
|
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','s.fk_pays'=>'Country',
|
||||||
's.phone'=>'Phone','s.email'=>'Email','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode',
|
's.phone'=>'Phone','s.email'=>'Email','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode',
|
||||||
'p.rowid'=>"ProjectId",'p.ref'=>"RefProject",'p.title'=>'ProjectLabel', 'p.datec'=>"DateCreation",'p.dateo'=>"DateStart",'p.datee'=>"DateEnd",'p.fk_statut'=>'ProjectStatus','cls.code'=>'OpportunityStatus','p.opp_percent'=>'OpportunityProbability','p.description'=>"Description");
|
'p.rowid'=>"ProjectId",'p.ref'=>"RefProject",'p.title'=>'ProjectLabel', 'p.datec'=>"DateCreation",'p.dateo'=>"DateStart",'p.datee'=>"DateEnd",'p.fk_statut'=>'ProjectStatus','cls.code'=>'OpportunityStatus','p.opp_percent'=>'OpportunityProbability','p.opp_amount'=>'OpportunityAmount','p.description'=>"Description");
|
||||||
// Add multicompany field
|
// Add multicompany field
|
||||||
if (! empty($conf->global->MULTICOMPANY_ENTITY_IN_EXPORT_IF_SHARED))
|
if (! empty($conf->global->MULTICOMPANY_ENTITY_IN_EXPORT_IF_SHARED))
|
||||||
{
|
{
|
||||||
$nbofallowedentities=count(explode(',',getEntity('project',1))); // If project are shared, nb will be > 1
|
$nbofallowedentities=count(explode(',',getEntity('project',1))); // If project are shared, nb will be > 1
|
||||||
if (! empty($conf->multicompany->enabled) && $nbofallowedentities > 1) $this->export_fields_array[$r]+=array('p.entity'=>'Entity');
|
if (! empty($conf->multicompany->enabled) && $nbofallowedentities > 1) $this->export_fields_array[$r]+=array('p.entity'=>'Entity');
|
||||||
}
|
}
|
||||||
|
if (empty($conf->global->PROJECT_USE_OPPORTUNITIES))
|
||||||
|
{
|
||||||
|
unset($this->export_fields_array[$r]['p.opp_percent']);
|
||||||
|
unset($this->export_fields_array[$r]['p.opp_amount']);
|
||||||
|
unset($this->export_fields_array[$r]['cls.code']);
|
||||||
|
}
|
||||||
|
|
||||||
// Add fields for project
|
// Add fields for project
|
||||||
$this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array());
|
$this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array());
|
||||||
$keyforselect='projet'; $keyforelement='project'; $keyforaliasextra='extra';
|
$keyforselect='projet'; $keyforelement='project'; $keyforaliasextra='extra';
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||||
* Copyright (C) 2015-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
* Copyright (C) 2015-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||||
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
|
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
|
||||||
@ -1229,8 +1229,8 @@ if ($action == 'create')
|
|||||||
print '<td>';
|
print '<td>';
|
||||||
$defaultselectuser=$user->id;
|
$defaultselectuser=$user->id;
|
||||||
if (GETPOST('fk_user_author') > 0) $defaultselectuser=GETPOST('fk_user_author');
|
if (GETPOST('fk_user_author') > 0) $defaultselectuser=GETPOST('fk_user_author');
|
||||||
$include_users = array($user->id);
|
$include_users = 'hierarchyme';
|
||||||
if (! empty($user->rights->expensereport->writeall_advance)) $include_users=array();
|
if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->expensereport->writeall_advance)) $include_users=array();
|
||||||
$s=$form->select_dolusers($defaultselectuser, "fk_user_author", 0, "", 0, $include_users);
|
$s=$form->select_dolusers($defaultselectuser, "fk_user_author", 0, "", 0, $include_users);
|
||||||
print $s;
|
print $s;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
@ -1314,10 +1314,10 @@ else
|
|||||||
|
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
if ($object->fk_user_author != $user->id)
|
if (! in_array($object->fk_user_author, $user->getAllChildIds(1)))
|
||||||
{
|
{
|
||||||
if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous)
|
if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous)
|
||||||
&& empty($user->rights->expensereport->writeall_advance))
|
&& (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || empty($user->rights->expensereport->writeall_advance)))
|
||||||
{
|
{
|
||||||
print load_fiche_titre($langs->trans('TripCard'));
|
print load_fiche_titre($langs->trans('TripCard'));
|
||||||
|
|
||||||
@ -2091,7 +2091,7 @@ if ($action != 'create' && $action != 'edit')
|
|||||||
*/
|
*/
|
||||||
if ($user->rights->expensereport->creer && $object->fk_statut==0)
|
if ($user->rights->expensereport->creer && $object->fk_statut==0)
|
||||||
{
|
{
|
||||||
if ($object->fk_user_author == $user->id)
|
if (in_array($object->fk_user_author, $user->getAllChildIds(1)))
|
||||||
{
|
{
|
||||||
// Modify
|
// Modify
|
||||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id='.$object->id.'">'.$langs->trans('Modify').'</a></div>';
|
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id='.$object->id.'">'.$langs->trans('Modify').'</a></div>';
|
||||||
@ -2139,7 +2139,7 @@ if ($action != 'create' && $action != 'edit')
|
|||||||
*/
|
*/
|
||||||
if ($object->fk_statut == 2)
|
if ($object->fk_statut == 2)
|
||||||
{
|
{
|
||||||
if ($object->fk_user_author == $user->id)
|
if (in_array($object->fk_user_author, $user->getAllChildIds(1)))
|
||||||
{
|
{
|
||||||
// Brouillonner
|
// Brouillonner
|
||||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=brouillonner&id='.$object->id.'">'.$langs->trans('SetToDraft').'</a></div>';
|
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=brouillonner&id='.$object->id.'">'.$langs->trans('SetToDraft').'</a></div>';
|
||||||
|
|||||||
@ -1674,11 +1674,14 @@ class ExpenseReport extends CommonObject
|
|||||||
|
|
||||||
$now=dol_now();
|
$now=dol_now();
|
||||||
|
|
||||||
|
$userchildids = $user->getAllChildIds(1);
|
||||||
|
|
||||||
$sql = "SELECT ex.rowid, ex.date_valid";
|
$sql = "SELECT ex.rowid, ex.date_valid";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as ex";
|
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as ex";
|
||||||
if ($option == 'toapprove') $sql.= " WHERE ex.fk_statut = 2";
|
if ($option == 'toapprove') $sql.= " WHERE ex.fk_statut = 2";
|
||||||
else $sql.= " WHERE ex.fk_statut = 5";
|
else $sql.= " WHERE ex.fk_statut = 5";
|
||||||
$sql.= " AND ex.entity IN (".getEntity('expensereport', 1).")";
|
$sql.= " AND ex.entity IN (".getEntity('expensereport', 1).")";
|
||||||
|
$sql.= " AND ex.fk_user_author IN (".join(',',$userchildids).")";
|
||||||
|
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
|
|||||||
@ -240,7 +240,7 @@ if ($search_status != '' && $search_status >= 0)
|
|||||||
}
|
}
|
||||||
// RESTRICT RIGHTS
|
// RESTRICT RIGHTS
|
||||||
if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous)
|
if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous)
|
||||||
&& empty($user->rights->expensereport->writeall_advance))
|
&& (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || empty($user->rights->expensereport->writeall_advance)))
|
||||||
{
|
{
|
||||||
$childids = $user->getAllChildIds();
|
$childids = $user->getAllChildIds();
|
||||||
$childids[]=$user->id;
|
$childids[]=$user->id;
|
||||||
|
|||||||
@ -178,8 +178,8 @@ if (empty($user->societe_id))
|
|||||||
! empty($conf->supplier_order->enabled) && $user->rights->fournisseur->commande->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_ORDERS_STATS),
|
! empty($conf->supplier_order->enabled) && $user->rights->fournisseur->commande->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_ORDERS_STATS),
|
||||||
! empty($conf->supplier_invoice->enabled) && $user->rights->fournisseur->facture->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_INVOICES_STATS),
|
! empty($conf->supplier_invoice->enabled) && $user->rights->fournisseur->facture->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_INVOICES_STATS),
|
||||||
! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_PROPOSAL_STATS),
|
! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_PROPOSAL_STATS),
|
||||||
! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire,
|
! empty($conf->projet->enabled) && $user->rights->projet->lire,
|
||||||
! empty($conf->projet->enabled) && $user->rights->projet->lire
|
! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire
|
||||||
);
|
);
|
||||||
// Class file containing the method load_state_board for each line
|
// Class file containing the method load_state_board for each line
|
||||||
$includes=array(
|
$includes=array(
|
||||||
@ -199,8 +199,8 @@ if (empty($user->societe_id))
|
|||||||
DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.commande.class.php",
|
DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.commande.class.php",
|
||||||
DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.facture.class.php",
|
DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.facture.class.php",
|
||||||
DOL_DOCUMENT_ROOT."/supplier_proposal/class/supplier_proposal.class.php",
|
DOL_DOCUMENT_ROOT."/supplier_proposal/class/supplier_proposal.class.php",
|
||||||
DOL_DOCUMENT_ROOT."/expensereport/class/expensereport.class.php",
|
DOL_DOCUMENT_ROOT."/projet/class/project.class.php",
|
||||||
DOL_DOCUMENT_ROOT."/projet/class/project.class.php"
|
DOL_DOCUMENT_ROOT."/expensereport/class/expensereport.class.php"
|
||||||
);
|
);
|
||||||
// Name class containing the method load_state_board for each line
|
// Name class containing the method load_state_board for each line
|
||||||
$classes=array('User',
|
$classes=array('User',
|
||||||
@ -219,8 +219,8 @@ if (empty($user->societe_id))
|
|||||||
'CommandeFournisseur',
|
'CommandeFournisseur',
|
||||||
'FactureFournisseur',
|
'FactureFournisseur',
|
||||||
'SupplierProposal',
|
'SupplierProposal',
|
||||||
'ExpenseReport',
|
'Project',
|
||||||
'Project'
|
'ExpenseReport'
|
||||||
);
|
);
|
||||||
// Cle array returned by the method load_state_board for each line
|
// Cle array returned by the method load_state_board for each line
|
||||||
$keys=array('users',
|
$keys=array('users',
|
||||||
@ -239,8 +239,8 @@ if (empty($user->societe_id))
|
|||||||
'supplier_orders',
|
'supplier_orders',
|
||||||
'supplier_invoices',
|
'supplier_invoices',
|
||||||
'askprice',
|
'askprice',
|
||||||
'expensereports',
|
'projects',
|
||||||
'projects'
|
'expensereports'
|
||||||
);
|
);
|
||||||
// Dashboard Icon lines
|
// Dashboard Icon lines
|
||||||
$icons=array('user',
|
$icons=array('user',
|
||||||
@ -259,8 +259,8 @@ if (empty($user->societe_id))
|
|||||||
'order',
|
'order',
|
||||||
'bill',
|
'bill',
|
||||||
'propal',
|
'propal',
|
||||||
'trip',
|
'project',
|
||||||
'project'
|
'trip'
|
||||||
);
|
);
|
||||||
// Translation keyword
|
// Translation keyword
|
||||||
$titres=array("Users",
|
$titres=array("Users",
|
||||||
@ -279,8 +279,8 @@ if (empty($user->societe_id))
|
|||||||
"SuppliersOrders",
|
"SuppliersOrders",
|
||||||
"SuppliersInvoices",
|
"SuppliersInvoices",
|
||||||
"SupplierProposalShort",
|
"SupplierProposalShort",
|
||||||
"ExpenseReports",
|
"Projects",
|
||||||
"Projects"
|
"ExpenseReports"
|
||||||
);
|
);
|
||||||
// Dashboard Link lines
|
// Dashboard Link lines
|
||||||
$links=array(
|
$links=array(
|
||||||
@ -300,8 +300,8 @@ if (empty($user->societe_id))
|
|||||||
DOL_URL_ROOT.'/fourn/commande/list.php',
|
DOL_URL_ROOT.'/fourn/commande/list.php',
|
||||||
DOL_URL_ROOT.'/fourn/facture/list.php',
|
DOL_URL_ROOT.'/fourn/facture/list.php',
|
||||||
DOL_URL_ROOT.'/supplier_proposal/list.php',
|
DOL_URL_ROOT.'/supplier_proposal/list.php',
|
||||||
DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm',
|
DOL_URL_ROOT.'/projet/list.php?mainmenu=project',
|
||||||
DOL_URL_ROOT.'/projet/list.php?mainmenu=project'
|
DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm'
|
||||||
);
|
);
|
||||||
// Translation lang files
|
// Translation lang files
|
||||||
$langfile=array("users",
|
$langfile=array("users",
|
||||||
@ -318,8 +318,8 @@ if (empty($user->societe_id))
|
|||||||
"supplier_proposal",
|
"supplier_proposal",
|
||||||
"contracts",
|
"contracts",
|
||||||
"interventions",
|
"interventions",
|
||||||
"trips",
|
"projects",
|
||||||
"projects"
|
"trips"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -689,7 +689,7 @@ PermissionAdvanced253=Create/modify internal/external users and permissions
|
|||||||
Permission254=Create/modify external users only
|
Permission254=Create/modify external users only
|
||||||
Permission255=Modify other users password
|
Permission255=Modify other users password
|
||||||
Permission256=Delete or disable other users
|
Permission256=Delete or disable other users
|
||||||
Permission262=Extend access to all third parties (not only third parties that user is a sale representative). Not effective for external users (always limited to themselves for proposals, orders, invoices, contracts, etc). Not effective for projects (only rules on project permissions, visibility and assignement matters).
|
Permission262=Extend access to all third parties (not only third parties that user is a sale representative).<br>Not effective for external users (always limited to themselves for proposals, orders, invoices, contracts, etc).<br>Not effective for projects (only rules on project permissions, visibility and assignement matters).
|
||||||
Permission271=Read CA
|
Permission271=Read CA
|
||||||
Permission272=Read invoices
|
Permission272=Read invoices
|
||||||
Permission273=Issue invoices
|
Permission273=Issue invoices
|
||||||
|
|||||||
@ -460,7 +460,7 @@ class Dolresource extends CommonObject
|
|||||||
$extrafields=new ExtraFields($this->db);
|
$extrafields=new ExtraFields($this->db);
|
||||||
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
|
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
|
||||||
if (is_array($extralabels) && count($extralabels)>0) {
|
if (is_array($extralabels) && count($extralabels)>0) {
|
||||||
foreach($extralabels as $label=>$code) {
|
foreach($extralabels as $code=>$label) {
|
||||||
$sql.= " ef.".$code." as extra_".$code.",";
|
$sql.= " ef.".$code." as extra_".$code.",";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -119,6 +119,8 @@ $arrayfields = array(
|
|||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) {
|
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) {
|
||||||
foreach ( $extrafields->attribute_label as $key => $val ) {
|
foreach ( $extrafields->attribute_label as $key => $val ) {
|
||||||
|
$typeofextrafield=$extrafields->attribute_type[$key];
|
||||||
|
if ($typeofextrafield!='separate') {
|
||||||
$arrayfields["ef." . $key] = array(
|
$arrayfields["ef." . $key] = array(
|
||||||
'label' => $extrafields->attribute_label[$key],
|
'label' => $extrafields->attribute_label[$key],
|
||||||
'checked' => $extrafields->attribute_list[$key],
|
'checked' => $extrafields->attribute_list[$key],
|
||||||
@ -127,6 +129,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||||
|
|
||||||
|
|||||||
@ -752,9 +752,10 @@ if (($action == 'create') || ($action == 'adduserldap'))
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Employee
|
// Employee
|
||||||
|
$defaultemployee=1;
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>'.fieldLabel('Employee','employee',0).'</td><td>';
|
print '<td>'.$langs->trans('Employee').'</td><td>';
|
||||||
print $form->selectyesno("employee",(GETPOST('employee')?GETPOST('employee'):0),1);
|
print $form->selectyesno("employee",(GETPOST('employee')!=''?GETPOST('employee'):$defaultemployee),1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Position/Job
|
// Position/Job
|
||||||
|
|||||||
@ -127,6 +127,9 @@ class User extends CommonObject
|
|||||||
|
|
||||||
public $dateemployment; // Define date of employment by company
|
public $dateemployment; // Define date of employment by company
|
||||||
|
|
||||||
|
private $cache_childids;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor de la classe
|
* Constructor de la classe
|
||||||
*
|
*
|
||||||
@ -2600,18 +2603,26 @@ class User extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return list of all child users id in herarchy (all sublevels).
|
* Return list of all child users id in herarchy of current user (all sublevels).
|
||||||
*
|
*
|
||||||
|
* @param int $addcurrentuser 1=Add also current user id to the list.
|
||||||
* @return array Array of user id lower than user. This overwrite this->users.
|
* @return array Array of user id lower than user. This overwrite this->users.
|
||||||
* @see get_children
|
* @see get_children
|
||||||
*/
|
*/
|
||||||
function getAllChildIds()
|
function getAllChildIds($addcurrentuser=0)
|
||||||
|
{
|
||||||
|
$childids=array();
|
||||||
|
|
||||||
|
if (isset($this->cache_childids[$this->id]))
|
||||||
|
{
|
||||||
|
$childids = $this->cache_childids[$this->id];
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
// Init this->users
|
// Init this->users
|
||||||
$this->get_full_tree();
|
$this->get_full_tree();
|
||||||
|
|
||||||
$idtoscan=$this->id;
|
$idtoscan=$this->id;
|
||||||
$childids=array();
|
|
||||||
|
|
||||||
dol_syslog("Build childid for id = ".$idtoscan);
|
dol_syslog("Build childid for id = ".$idtoscan);
|
||||||
foreach($this->users as $id => $val)
|
foreach($this->users as $id => $val)
|
||||||
@ -2619,6 +2630,10 @@ class User extends CommonObject
|
|||||||
//var_dump($val['fullpath']);
|
//var_dump($val['fullpath']);
|
||||||
if (preg_match('/_'.$idtoscan.'_/', $val['fullpath'])) $childids[$val['id']]=$val['id'];
|
if (preg_match('/_'.$idtoscan.'_/', $val['fullpath'])) $childids[$val['id']]=$val['id'];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
$this->cache_childids[$this->id] = $childids;
|
||||||
|
|
||||||
|
if ($addcurrentuser) $childids[$this->id]=$this->id;
|
||||||
|
|
||||||
return $childids;
|
return $childids;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user