Merge branch '15.0' of git@github.com:Dolibarr/dolibarr.git into 16.0
This commit is contained in:
commit
8a599ec610
@ -2034,14 +2034,21 @@ class ExtraFields
|
||||
|
||||
$visibility = 1;
|
||||
if (isset($this->attributes[$object->table_element]['list'][$key])) { // 'list' is option for visibility
|
||||
$visibility = dol_eval($this->attributes[$object->table_element]['list'][$key], 1, 1, '1');
|
||||
$visibility = intval(dol_eval($this->attributes[$object->table_element]['list'][$key], 1, 1, '1'));
|
||||
}
|
||||
|
||||
$perms = 1;
|
||||
if (isset($this->attributes[$object->table_element]['perms'][$key])) {
|
||||
$perms = dol_eval($this->attributes[$object->table_element]['perms'][$key], 1, 1, '1');
|
||||
}
|
||||
if (empty($enabled)) {
|
||||
if (empty($enabled)
|
||||
|| (
|
||||
$onlykey === '@GETPOSTISSET'
|
||||
&& in_array($this->attributes[$object->table_element]['type'][$key], array('boolean', 'chkbxlst'))
|
||||
&& in_array(abs($enabled), array(2, 5))
|
||||
&& ! GETPOSTISSET('options_' . $key) // Update hidden checkboxes and multiselect only if they are provided
|
||||
)
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
if (empty($visibility)) {
|
||||
|
||||
@ -29,6 +29,9 @@ $module = $object->element;
|
||||
$note_public = 'note_public';
|
||||
$note_private = 'note_private';
|
||||
|
||||
if ($module == "product") {
|
||||
$module = ($object->type == Product::TYPE_SERVICE ? 'service' : 'product');
|
||||
}
|
||||
$colwidth = (isset($colwidth) ? $colwidth : (empty($cssclass) ? '25' : ''));
|
||||
// Set $permission from the $permissionnote var defined on calling page
|
||||
$permission = (isset($permissionnote) ? $permissionnote : (isset($permission) ? $permission : (isset($user->rights->$module->create) ? $user->rights->$module->create : (isset($user->rights->$module->creer) ? $user->rights->$module->creer : 0))));
|
||||
@ -60,37 +63,39 @@ if (!empty($conf->global->MAIN_AUTO_TIMESTAMP_IN_PRIVATE_NOTES)) {
|
||||
|
||||
// Special cases
|
||||
if ($module == 'propal') {
|
||||
$permission = $user->rights->propale->creer;
|
||||
$permission = $user->hasRight("propale", "creer");
|
||||
} elseif ($module == 'supplier_proposal') {
|
||||
$permission = $user->rights->supplier_proposal->creer;
|
||||
$permission = $user->hasRight("supplier_proposal", "creer");
|
||||
} elseif ($module == 'fichinter') {
|
||||
$permission = $user->rights->ficheinter->creer;
|
||||
$permission = $user->hasRight("ficheinter", "creer");
|
||||
} elseif ($module == 'project') {
|
||||
$permission = $user->rights->projet->creer;
|
||||
$permission = $user->hasRight("projet", "creer");
|
||||
} elseif ($module == 'project_task') {
|
||||
$permission = $user->rights->projet->creer;
|
||||
$permission = $user->hasRight("projet", "creer");
|
||||
} elseif ($module == 'invoice_supplier') {
|
||||
if (empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) {
|
||||
$permission = $user->rights->fournisseur->facture->creer;
|
||||
$permission = $user->hasRight("fournisseur", "facture", "creer");
|
||||
} else {
|
||||
$permission = $user->rights->supplier_invoice->creer;
|
||||
$permission = $user->hasRight("supplier_invoice", "creer");
|
||||
}
|
||||
} elseif ($module == 'order_supplier') {
|
||||
if (empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) {
|
||||
$permission = $user->rights->fournisseur->commande->creer;
|
||||
$permission = $user->hasRight("fournisseur", "commande", "creer");
|
||||
} else {
|
||||
$permission = $user->rights->supplier_order->creer;
|
||||
$permission = $user->hasRight("supplier_order", "creer");
|
||||
}
|
||||
} elseif ($module == 'societe') {
|
||||
$permission = $user->rights->societe->creer;
|
||||
$permission = $user->hasRight("societe", "creer");
|
||||
} elseif ($module == 'contact') {
|
||||
$permission = $user->rights->societe->creer;
|
||||
$permission = $user->hasRight("societe", "creer");
|
||||
} elseif ($module == 'shipping') {
|
||||
$permission = $user->rights->expedition->creer;
|
||||
$permission = $user->hasRight("expedition", "creer");
|
||||
} elseif ($module == 'product') {
|
||||
$permission = $user->rights->produit->creer;
|
||||
$permission = $user->hasRight("produit", "creer");
|
||||
} elseif ($module == 'service') {
|
||||
$permission = $user->hasRight("service", "creer");
|
||||
} elseif ($module == 'ecmfiles') {
|
||||
$permission = $user->rights->ecm->setup;
|
||||
$permission = $user->hasRight("ecm", "setup");
|
||||
}
|
||||
//else dol_print_error('','Bad value '.$module.' for param module');
|
||||
|
||||
|
||||
@ -250,7 +250,9 @@ CountryMF=Saint Martin
|
||||
|
||||
##### Civilities #####
|
||||
CivilityMME=Mrs.
|
||||
CivilityMMEShort=Mrs.
|
||||
CivilityMR=Mr.
|
||||
CivilityMRShort=Mr.
|
||||
CivilityMLE=Ms.
|
||||
CivilityMTRE=Master
|
||||
CivilityDR=Doctor
|
||||
|
||||
@ -894,7 +894,7 @@ class Project extends CommonObject
|
||||
}
|
||||
|
||||
// Fetch tasks
|
||||
$this->getLinesArray($user);
|
||||
$this->getLinesArray($user, 0);
|
||||
|
||||
// Delete tasks
|
||||
$ret = $this->deleteTasks($user);
|
||||
@ -2266,14 +2266,15 @@ class Project extends CommonObject
|
||||
/**
|
||||
* Create an array of tasks of current project
|
||||
*
|
||||
* @param User $user Object user we want project allowed to
|
||||
* @return int >0 if OK, <0 if KO
|
||||
* @param User $user Object user we want project allowed to
|
||||
* @param int $loadRoleMode 1= will test Roles on task; 0 used in delete project action
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
public function getLinesArray($user)
|
||||
public function getLinesArray($user, $loadRoleMode = 1)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
|
||||
$taskstatic = new Task($this->db);
|
||||
|
||||
$this->lines = $taskstatic->getTasksArray(0, $user, $this->id, 0, 0);
|
||||
$this->lines = $taskstatic->getTasksArray(0, $user, $this->id, 0, 0, '', '-1', '', 0, 0, array(), 0, array(), 0, $loadRoleMode);
|
||||
}
|
||||
}
|
||||
|
||||
@ -810,9 +810,10 @@ class Task extends CommonObjectLine
|
||||
* @param int $includebilltime Calculate also the time to bill and billed
|
||||
* @param array $search_array_options Array of search
|
||||
* @param int $loadextras Fetch all Extrafields on each task
|
||||
* @param int $loadRoleMode 1= will test Roles on task; 0 used in delete project action
|
||||
* @return array Array of tasks
|
||||
*/
|
||||
public function getTasksArray($usert = null, $userp = null, $projectid = 0, $socid = 0, $mode = 0, $filteronproj = '', $filteronprojstatus = '-1', $morewherefilter = '', $filteronprojuser = 0, $filterontaskuser = 0, $extrafields = array(), $includebilltime = 0, $search_array_options = array(), $loadextras = 0)
|
||||
public function getTasksArray($usert = null, $userp = null, $projectid = 0, $socid = 0, $mode = 0, $filteronproj = '', $filteronprojstatus = '-1', $morewherefilter = '', $filteronprojuser = 0, $filterontaskuser = 0, $extrafields = array(), $includebilltime = 0, $search_array_options = array(), $loadextras = 0, $loadRoleMode = 1)
|
||||
{
|
||||
global $conf, $hookmanager;
|
||||
|
||||
@ -967,14 +968,16 @@ class Task extends CommonObjectLine
|
||||
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
if ((!$obj->public) && (is_object($userp))) { // If not public project and we ask a filter on project owned by a user
|
||||
if (!$this->getUserRolesForProjectsOrTasks($userp, 0, $obj->projectid, 0)) {
|
||||
$error++;
|
||||
if ($loadRoleMode) {
|
||||
if ((!$obj->public) && (is_object($userp))) { // If not public project and we ask a filter on project owned by a user
|
||||
if (!$this->getUserRolesForProjectsOrTasks($userp, 0, $obj->projectid, 0)) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (is_object($usert)) { // If we ask a filter on a user affected to a task
|
||||
if (!$this->getUserRolesForProjectsOrTasks(0, $usert, $obj->projectid, $obj->taskid)) {
|
||||
$error++;
|
||||
if (is_object($usert)) { // If we ask a filter on a user affected to a task
|
||||
if (!$this->getUserRolesForProjectsOrTasks(0, $usert, $obj->projectid, $obj->taskid)) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user