366function restrictedArea(
User $user, $features, $object = 0, $tableandshare =
'', $feature2 =
'', $dbt_keyfield =
'fk_soc', $dbt_select =
'rowid', $isdraft = 0, $mode = 0)
372 if (is_object($object)) {
373 $objectid = $object->id;
377 if ($objectid ==
"-1") {
381 $objectid = preg_replace(
'/[^0-9\.\,]/',
'', $objectid);
390 $parentfortableentity =
'';
393 $originalfeatures = $features;
394 if ($features ==
'agenda') {
395 $tableandshare =
'actioncomm&societe';
396 $feature2 =
'myactions|allactions';
399 if ($features ==
'bank') {
400 $features =
'banque';
402 if ($features ==
'facturerec') {
403 $features =
'facture';
405 if ($features ==
'supplier_invoicerec') {
406 $features =
'fournisseur';
407 $feature2 =
'facture';
409 if ($features ==
'mo') {
412 if ($features ==
'member') {
413 $features =
'adherent';
415 if ($features ==
'subscription') {
416 $features =
'adherent';
417 $feature2 =
'cotisation';
419 if ($features ==
'website' && is_object($object) && $object->element ==
'websitepage') {
420 $parentfortableentity =
'fk_website@website';
422 if ($features ==
'project') {
423 $features =
'projet';
425 if ($features ==
'product') {
426 $features =
'produit';
428 if ($features ==
'productbatch') {
429 $features =
'produit';
431 if ($features ==
'tax') {
432 $feature2 =
'charges';
434 if ($features ==
'workstation') {
435 $feature2 =
'workstation';
437 if ($features ==
'fournisseur') {
438 $features =
'fournisseur';
439 if (is_object($object) && $object->element ==
'invoice_supplier') {
440 $feature2 =
'facture';
441 } elseif (is_object($object) && $object->element ==
'order_supplier') {
442 $feature2 =
'commande';
445 if ($features ==
'payment_sc') {
446 $tableandshare =
'paiementcharge';
447 $parentfortableentity =
'fk_charge@chargesociales';
449 if ($features ==
'evaluation') {
451 $feature2 =
'evaluation';
457 $parameters = array(
'features'=>$features,
'originalfeatures'=>$originalfeatures,
'objectid'=>$objectid,
'dbt_select'=>$dbt_select,
'idtype'=>$dbt_select,
'isdraft'=>$isdraft);
458 $reshook = $hookmanager->executeHooks(
'restrictedArea', $parameters);
460 if (isset($hookmanager->resArray[
'result'])) {
461 if ($hookmanager->resArray[
'result'] == 0) {
474 $featuresarray = array($features);
475 if (preg_match(
'/&/', $features)) {
476 $featuresarray = explode(
"&", $features);
477 } elseif (preg_match(
'/\|/', $features)) {
478 $featuresarray = explode(
"|", $features);
482 if (!empty($feature2)) {
483 $feature2 = explode(
"|", $feature2);
486 $listofmodules = explode(
',', $conf->global->MAIN_MODULES_FOR_EXTERNAL);
491 foreach ($featuresarray as $feature) {
492 $featureforlistofmodule = $feature;
493 if ($featureforlistofmodule ==
'produit') {
494 $featureforlistofmodule =
'product';
496 if ($featureforlistofmodule ==
'supplier_proposal') {
497 $featureforlistofmodule =
'supplierproposal';
499 if (!empty($user->socid) && !empty($conf->global->MAIN_MODULES_FOR_EXTERNAL) && !in_array($featureforlistofmodule, $listofmodules)) {
505 if ($feature ==
'societe' && (empty($feature2) || !in_array(
'contact', $feature2))) {
506 if (!$user->hasRight(
'societe',
'lire') && !$user->hasRight(
'fournisseur',
'lire')) {
510 } elseif (($feature ==
'societe' && (!empty($feature2) && in_array(
'contact', $feature2))) || $feature ==
'contact') {
511 if (empty($user->rights->societe->contact->lire)) {
515 } elseif ($feature ==
'produit|service') {
516 if (empty($user->rights->produit->lire) && empty($user->rights->service->lire)) {
520 } elseif ($feature ==
'prelevement') {
521 if (empty($user->rights->prelevement->bons->lire)) {
525 } elseif ($feature ==
'cheque') {
526 if (empty($user->rights->banque->cheque)) {
530 } elseif ($feature ==
'projet') {
531 if (empty($user->rights->projet->lire) && empty($user->rights->projet->all->lire)) {
535 } elseif ($feature ==
'payment') {
536 if (!$user->hasRight(
'facture',
'lire')) {
540 } elseif ($feature ==
'payment_supplier') {
541 if (empty($user->rights->fournisseur->facture->lire)) {
545 } elseif ($feature ==
'payment_sc') {
546 if (empty($user->rights->tax->charges->lire)) {
550 } elseif (!empty($feature2)) {
552 foreach ($feature2 as $subfeature) {
553 if ($subfeature ==
'user' && $user->id == $objectid) {
556 if ($subfeature ==
'fiscalyear' && $user->hasRight(
'accounting',
'fiscalyear',
'write')) {
561 if (!empty($subfeature) && empty($user->rights->$feature->$subfeature->lire) && empty($user->rights->$feature->$subfeature->read)) {
563 } elseif (empty($subfeature) && empty($user->rights->$feature->lire) && empty($user->rights->$feature->read)) {
574 } elseif (!empty($feature) && ($feature !=
'user' && $feature !=
'usergroup')) {
575 if (empty($user->rights->$feature->lire)
576 && empty($user->rights->$feature->read)
577 && empty($user->rights->$feature->run)) {
585 if (preg_match(
'/\|/', $features) && $nbko < count($featuresarray)) {
601 $wemustcheckpermissionforcreate = (
GETPOST(
'sendit',
'alpha') ||
GETPOST(
'linkit',
'alpha') || in_array(
GETPOST(
'action',
'aZ09'), array(
'create',
'update',
'set',
'upload',
'add_element_resource',
'confirm_deletebank',
'confirm_delete_linked_resource')) ||
GETPOST(
'roworder',
'alpha', 2));
602 $wemustcheckpermissionfordeletedraft = ((
GETPOST(
"action",
"aZ09") ==
'confirm_delete' &&
GETPOST(
"confirm",
"aZ09") ==
'yes') ||
GETPOST(
"action",
"aZ09") ==
'delete');
604 if ($wemustcheckpermissionforcreate || $wemustcheckpermissionfordeletedraft) {
605 foreach ($featuresarray as $feature) {
606 if ($feature ==
'contact') {
607 if (empty($user->rights->societe->contact->creer)) {
611 } elseif ($feature ==
'produit|service') {
612 if (empty($user->rights->produit->creer) && empty($user->rights->service->creer)) {
616 } elseif ($feature ==
'prelevement') {
617 if (!$user->rights->prelevement->bons->creer) {
621 } elseif ($feature ==
'commande_fournisseur') {
622 if (empty($user->rights->fournisseur->commande->creer) || empty($user->rights->supplier_order->creer)) {
626 } elseif ($feature ==
'banque') {
627 if (!$user->hasRight(
'banque',
'modifier')) {
631 } elseif ($feature ==
'cheque') {
632 if (empty($user->rights->banque->cheque)) {
636 } elseif ($feature ==
'import') {
637 if (empty($user->rights->import->run)) {
641 } elseif ($feature ==
'ecm') {
642 if (!$user->rights->ecm->upload) {
646 } elseif (!empty($feature2)) {
647 foreach ($feature2 as $subfeature) {
648 if ($subfeature ==
'user' && $user->id == $objectid && $user->hasRight(
'user',
'self',
'creer')) {
651 if ($subfeature ==
'user' && $user->id == $objectid && $user->hasRight(
'user',
'self',
'password')) {
654 if ($subfeature ==
'user' && $user->id != $objectid && $user->hasRight(
'user',
'user',
'password')) {
658 if (empty($user->rights->$feature->$subfeature->creer)
659 && empty($user->rights->$feature->$subfeature->write)
660 && empty($user->rights->$feature->$subfeature->create)) {
669 } elseif (!empty($feature)) {
671 if (empty($user->rights->$feature->creer)
672 && empty($user->rights->$feature->write)
673 && empty($user->rights->$feature->create)) {
681 if (preg_match(
'/\|/', $features) && $nbko < count($featuresarray)) {
685 if ($wemustcheckpermissionforcreate && !$createok) {
697 if (
GETPOST(
'action',
'aZ09') ==
'confirm_create_user' &&
GETPOST(
"confirm",
'aZ09') ==
'yes') {
698 if (!$user->hasRight(
'user',
'user',
'creer')) {
702 if (!$createuserok) {
715 if ((
GETPOST(
"action",
"aZ09") ==
'confirm_delete' &&
GETPOST(
"confirm",
"aZ09") ==
'yes') ||
GETPOST(
"action",
"aZ09") ==
'delete') {
716 foreach ($featuresarray as $feature) {
717 if ($feature ==
'bookmark') {
718 if (!$user->rights->bookmark->supprimer) {
719 if ($user->id != $object->fk_user || empty($user->rights->bookmark->creer)) {
723 } elseif ($feature ==
'contact') {
724 if (!$user->rights->societe->contact->supprimer) {
727 } elseif ($feature ==
'produit|service') {
728 if (!$user->hasRight(
'produit',
'supprimer') && !$user->hasRight(
'service',
'supprimer')) {
731 } elseif ($feature ==
'commande_fournisseur') {
732 if (!$user->rights->fournisseur->commande->supprimer) {
735 } elseif ($feature ==
'payment_supplier') {
736 if (!$user->rights->fournisseur->facture->creer) {
739 } elseif ($feature ==
'payment') {
740 if (!$user->rights->facture->paiement) {
743 } elseif ($feature ==
'payment_sc') {
744 if (!$user->rights->tax->charges->creer) {
747 } elseif ($feature ==
'banque') {
748 if (!$user->hasRight(
'banque',
'modifier')) {
751 } elseif ($feature ==
'cheque') {
752 if (empty($user->rights->banque->cheque)) {
755 } elseif ($feature ==
'ecm') {
756 if (!$user->rights->ecm->upload) {
759 } elseif ($feature ==
'ftp') {
760 if (!$user->rights->ftp->write) {
763 } elseif ($feature ==
'salaries') {
764 if (!$user->rights->salaries->delete) {
767 } elseif ($feature ==
'adherent') {
768 if (empty($user->rights->adherent->supprimer)) {
771 } elseif ($feature ==
'paymentbybanktransfer') {
772 if (empty($user->rights->paymentbybanktransfer->create)) {
775 } elseif ($feature ==
'prelevement') {
776 if (empty($user->rights->prelevement->bons->creer)) {
779 } elseif (!empty($feature2)) {
780 foreach ($feature2 as $subfeature) {
781 if (empty($user->rights->$feature->$subfeature->supprimer) && empty($user->rights->$feature->$subfeature->delete)) {
788 } elseif (!empty($feature)) {
790 if (empty($user->rights->$feature->supprimer)
791 && empty($user->rights->$feature->delete)
792 && empty($user->rights->$feature->run)) {
799 if (preg_match(
'/\|/', $features) && $nbko < count($featuresarray)) {
803 if (!$deleteok && !($isdraft && $createok)) {
815 if (!empty($objectid) && $objectid > 0) {
816 $ok =
checkUserAccessToObject($user, $featuresarray, $object, $tableandshare, $feature2, $dbt_keyfield, $dbt_select, $parentfortableentity);
817 $params = array(
'objectid' => $objectid,
'features' => join(
',', $featuresarray),
'features2' => $feature2);
848function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tableandshare =
'', $feature2 =
'', $dbt_keyfield =
'', $dbt_select =
'rowid', $parenttableforentity =
'')
852 if (is_object($object)) {
853 $objectid = $object->id;
857 $objectid = preg_replace(
'/[^0-9\.\,]/',
'', $objectid);
864 $params = explode(
'&', $tableandshare);
865 $dbtablename = (!empty($params[0]) ? $params[0] :
'');
866 $sharedelement = (!empty($params[1]) ? $params[1] : $dbtablename);
868 foreach ($featuresarray as $feature) {
874 if ($feature ==
'societe' && !empty($feature2) && is_array($feature2) && in_array(
'contact', $feature2)) {
875 $feature =
'contact';
878 if ($feature ==
'member') {
879 $feature =
'adherent';
881 if ($feature ==
'project') {
884 if ($feature ==
'projet' && !empty($feature2) && is_array($feature2) && !empty(array_intersect(array(
'project_task',
'projet_task'), $feature2))) {
885 $feature =
'project_task';
887 if ($feature ==
'task' || $feature ==
'projet_task') {
888 $feature =
'project_task';
890 if ($feature ==
'eventorganization') {
892 $dbtablename =
'actioncomm';
894 if ($feature ==
'payment_sc' && empty($parenttableforentity)) {
896 $parenttableforentity =
'';
897 $dbtablename =
"chargesociales";
898 $feature =
"chargesociales";
899 $objectid = $object->fk_charge;
902 $checkonentitydone = 0;
905 $check = array(
'adherent',
'banque',
'bom',
'don',
'mrp',
'user',
'usergroup',
'payment',
'payment_supplier',
'payment_sc',
'product',
'produit',
'service',
'produit|service',
'categorie',
'resource',
'expensereport',
'holiday',
'salaries',
'website',
'recruitment',
'chargesociales',
'knowledgemanagement');
906 $checksoc = array(
'societe');
907 $checkparentsoc = array(
'agenda',
'contact',
'contrat');
908 $checkproject = array(
'projet',
'project');
909 $checktask = array(
'projet_task',
'project_task');
910 $checkhierarchy = array(
'expensereport',
'holiday',
'hrm');
911 $checkuser = array(
'bookmark');
912 $nocheck = array(
'barcode',
'stock');
917 if (empty($dbtablename)) {
918 $dbtablename = $feature;
919 $sharedelement = (!empty($params[1]) ? $params[1] : $dbtablename);
923 if ($dbt_select !=
'rowid' && $dbt_select !=
'id') {
924 $objectid =
"'".$objectid.
"'";
927 if (in_array($feature, $check) && $objectid > 0) {
928 $sql =
"SELECT COUNT(dbt.".$dbt_select.
") as nb";
929 $sql .=
" FROM ".MAIN_DB_PREFIX.$dbtablename.
" as dbt";
930 if (($feature ==
'user' || $feature ==
'usergroup') && isModEnabled(
'multicompany')) {
931 if (!empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
932 if ($conf->entity == 1 && $user->admin && !$user->entity) {
933 $sql .=
" WHERE dbt.".$dbt_select.
" IN (".$db->sanitize($objectid, 1).
")";
934 $sql .=
" AND dbt.entity IS NOT NULL";
936 $sql .=
",".MAIN_DB_PREFIX.
"usergroup_user as ug";
937 $sql .=
" WHERE dbt.".$dbt_select.
" IN (".$db->sanitize($objectid, 1).
")";
938 $sql .=
" AND ((ug.fk_user = dbt.rowid";
939 $sql .=
" AND ug.entity IN (".getEntity(
'usergroup').
"))";
940 $sql .=
" OR dbt.entity = 0)";
943 $sql .=
" WHERE dbt.".$dbt_select.
" IN (".$db->sanitize($objectid, 1).
")";
944 $sql .=
" AND dbt.entity IN (".getEntity($sharedelement, 1).
")";
948 if ($parenttableforentity && preg_match(
'/(.*)@(.*)/', $parenttableforentity, $reg)) {
949 $sql .=
", ".MAIN_DB_PREFIX.$reg[2].
" as dbtp";
950 $sql .=
" WHERE dbt.".$reg[1].
" = dbtp.rowid AND dbt.".$dbt_select.
" IN (".$db->sanitize($objectid, 1).
")";
951 $sql .=
" AND dbtp.entity IN (".getEntity($sharedelement, 1).
")";
953 $sql .=
" WHERE dbt.".$dbt_select.
" IN (".$db->sanitize($objectid, 1).
")";
954 $sql .=
" AND dbt.entity IN (".getEntity($sharedelement, 1).
")";
957 $checkonentitydone = 1;
959 if (in_array($feature, $checksoc) && $objectid > 0) {
961 if ($user->socid > 0) {
962 if ($user->socid != $objectid) {
965 } elseif (isModEnabled(
"societe") && ($user->hasRight(
'societe',
'lire') && empty($user->rights->societe->client->voir))) {
967 $sql =
"SELECT COUNT(sc.fk_soc) as nb";
968 $sql .=
" FROM (".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
969 $sql .=
", ".MAIN_DB_PREFIX.
"societe as s)";
970 $sql .=
" WHERE sc.fk_soc IN (".$db->sanitize($objectid, 1).
")";
971 $sql .=
" AND sc.fk_user = ".((int) $user->id);
972 $sql .=
" AND sc.fk_soc = s.rowid";
973 $sql .=
" AND s.entity IN (".getEntity($sharedelement, 1).
")";
974 } elseif (isModEnabled(
'multicompany')) {
976 $sql =
"SELECT COUNT(s.rowid) as nb";
977 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
978 $sql .=
" WHERE s.rowid IN (".$db->sanitize($objectid, 1).
")";
979 $sql .=
" AND s.entity IN (".getEntity($sharedelement, 1).
")";
982 $checkonentitydone = 1;
984 if (in_array($feature, $checkparentsoc) && $objectid > 0) {
986 if ($user->socid > 0) {
987 $sql =
"SELECT COUNT(dbt.".$dbt_select.
") as nb";
988 $sql .=
" FROM ".MAIN_DB_PREFIX.$dbtablename.
" as dbt";
989 $sql .=
" WHERE dbt.".$dbt_select.
" IN (".$db->sanitize($objectid, 1).
")";
990 $sql .=
" AND dbt.fk_soc = ".((int) $user->socid);
991 } elseif (isModEnabled(
"societe") && ($user->hasRight(
'societe',
'lire') && empty($user->rights->societe->client->voir))) {
993 $sql =
"SELECT COUNT(dbt.".$dbt_select.
") as nb";
994 $sql .=
" FROM ".MAIN_DB_PREFIX.$dbtablename.
" as dbt";
995 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe_commerciaux as sc ON dbt.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
996 $sql .=
" WHERE dbt.".$dbt_select.
" IN (".$db->sanitize($objectid, 1).
")";
997 $sql .=
" AND (dbt.fk_soc IS NULL OR sc.fk_soc IS NOT NULL)";
998 $sql .=
" AND dbt.entity IN (".getEntity($sharedelement, 1).
")";
999 } elseif (isModEnabled(
'multicompany')) {
1001 $sql =
"SELECT COUNT(dbt.".$dbt_select.
") as nb";
1002 $sql .=
" FROM ".MAIN_DB_PREFIX.$dbtablename.
" as dbt";
1003 $sql .=
" WHERE dbt.".$dbt_select.
" IN (".$db->sanitize($objectid, 1).
")";
1004 $sql .=
" AND dbt.entity IN (".getEntity($sharedelement, 1).
")";
1007 $checkonentitydone = 1;
1009 if (in_array($feature, $checkproject) && $objectid > 0) {
1010 if (isModEnabled(
'project') && empty($user->rights->projet->all->lire)) {
1011 $projectid = $objectid;
1013 include_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
1014 $projectstatic =
new Project($db);
1015 $tmps = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1, 0);
1017 $tmparray = explode(
',', $tmps);
1018 if (!in_array($projectid, $tmparray)) {
1022 $sql =
"SELECT COUNT(dbt.".$dbt_select.
") as nb";
1023 $sql .=
" FROM ".MAIN_DB_PREFIX.$dbtablename.
" as dbt";
1024 $sql .=
" WHERE dbt.".$dbt_select.
" IN (".$db->sanitize($objectid, 1).
")";
1025 $sql .=
" AND dbt.entity IN (".getEntity($sharedelement, 1).
")";
1027 $checkonentitydone = 1;
1029 if (in_array($feature, $checktask) && $objectid > 0) {
1030 if (isModEnabled(
'project') && empty($user->rights->projet->all->lire)) {
1031 $task =
new Task($db);
1032 $task->fetch($objectid);
1033 $projectid = $task->fk_project;
1035 include_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
1036 $projectstatic =
new Project($db);
1037 $tmps = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1, 0);
1039 $tmparray = explode(
',', $tmps);
1040 if (!in_array($projectid, $tmparray)) {
1044 $sharedelement =
'project';
1045 $sql =
"SELECT COUNT(dbt.".$dbt_select.
") as nb";
1046 $sql .=
" FROM ".MAIN_DB_PREFIX.$dbtablename.
" as dbt";
1047 $sql .=
" WHERE dbt.".$dbt_select.
" IN (".$db->sanitize($objectid, 1).
")";
1048 $sql .=
" AND dbt.entity IN (".getEntity($sharedelement, 1).
")";
1051 $checkonentitydone = 1;
1055 if (!$checkonentitydone && !in_array($feature, $nocheck) && $objectid > 0) {
1057 if ($user->socid > 0) {
1058 if (empty($dbt_keyfield)) {
1059 dol_print_error(
'',
'Param dbt_keyfield is required but not defined');
1061 $sql =
"SELECT COUNT(dbt.".$dbt_keyfield.
") as nb";
1062 $sql .=
" FROM ".MAIN_DB_PREFIX.$dbtablename.
" as dbt";
1063 $sql .=
" WHERE dbt.rowid IN (".$db->sanitize($objectid, 1).
")";
1064 $sql .=
" AND dbt.".$dbt_keyfield.
" = ".((int) $user->socid);
1065 } elseif (isModEnabled(
"societe") && empty($user->rights->societe->client->voir)) {
1067 if ($feature !=
'ticket') {
1068 if (empty($dbt_keyfield)) {
1069 dol_print_error(
'',
'Param dbt_keyfield is required but not defined');
1071 $sql =
"SELECT COUNT(sc.fk_soc) as nb";
1072 $sql .=
" FROM ".MAIN_DB_PREFIX.$dbtablename.
" as dbt";
1073 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
1074 $sql .=
" WHERE dbt.".$dbt_select.
" IN (".$db->sanitize($objectid, 1).
")";
1075 $sql .=
" AND dbt.entity IN (".getEntity($sharedelement, 1).
")";
1076 $sql .=
" AND sc.fk_soc = dbt.".$dbt_keyfield;
1077 $sql .=
" AND sc.fk_user = ".((int) $user->id);
1080 $sql =
"SELECT COUNT(dbt.".$dbt_select.
") as nb";
1081 $sql .=
" FROM ".MAIN_DB_PREFIX.$dbtablename.
" as dbt";
1082 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe_commerciaux as sc ON sc.fk_soc = dbt.".$dbt_keyfield.
" AND sc.fk_user = ".((int) $user->id);
1083 $sql .=
" WHERE dbt.".$dbt_select.
" IN (".$db->sanitize($objectid, 1).
")";
1084 $sql .=
" AND dbt.entity IN (".getEntity($sharedelement, 1).
")";
1085 $sql .=
" AND (sc.fk_user = ".((int) $user->id).
" OR sc.fk_user IS NULL)";
1087 } elseif (isModEnabled(
'multicompany')) {
1089 $sql =
"SELECT COUNT(dbt.".$dbt_select.
") as nb";
1090 $sql .=
" FROM ".MAIN_DB_PREFIX.$dbtablename.
" as dbt";
1091 $sql .=
" WHERE dbt.".$dbt_select.
" IN (".$db->sanitize($objectid, 1).
")";
1092 $sql .=
" AND dbt.entity IN (".getEntity($sharedelement, 1).
")";
1097 if ($feature ===
'agenda' && $objectid > 0) {
1099 if ($objectid > 0 && empty($user->rights->agenda->allactions->read)) {
1100 require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/actioncomm.class.php';
1102 $action->fetch($objectid);
1103 if ($action->authorid != $user->id && $action->userownerid != $user->id && !(array_key_exists($user->id, $action->userassigned))) {
1111 if (in_array($feature, $checkhierarchy) && is_object($object) && $objectid > 0) {
1112 $childids = $user->getAllChildIds(1);
1114 if ($feature ==
'holiday') {
1115 $useridtocheck = $object->fk_user;
1116 if (!$user->hasRight(
'holiday',
'readall') && !in_array($useridtocheck, $childids) && !in_array($object->fk_validator, $childids)) {
1120 if ($feature ==
'expensereport') {
1121 $useridtocheck = $object->fk_user_author;
1122 if (!$user->hasRight(
'expensereport',
'readall') && !in_array($useridtocheck, $childids)) {
1126 if ($feature ==
'hrm' && in_array(
'evaluation', $feature2)) {
1127 $useridtocheck = $object->fk_user;
1129 if ($user->hasRight(
'hrm',
'evaluation',
'readall')) {
1133 if (!$user->hasRight(
'hrm',
'evaluation',
'read')) {
1138 return in_array($useridtocheck, $childids);
1144 if (in_array($feature, $checkuser) && is_object($object) && $objectid > 0) {
1145 $useridtocheck = $object->fk_user;
1146 if (!empty($useridtocheck) && $useridtocheck > 0 && $useridtocheck != $user->id && empty($user->admin)) {
1152 $resql = $db->query($sql);
1154 $obj = $db->fetch_object($resql);
1155 if (!$obj || $obj->nb < count(explode(
',', $objectid))) {
1159 dol_syslog(
"Bad forged sql in checkUserAccessToObject", LOG_WARNING);
if(!defined( 'NOREQUIREMENU')) if(!empty(GETPOST('seteventmessages', 'alpha'))) if(!function_exists("llxHeader")) top_httphead($contenttype='text/html', $forcenocache=0)
Show HTTP header.