| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- <?php
- $res = 0;
- // Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
- if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
- $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"] . "/main.inc.php";
- }
- // Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
- $tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME'];
- $tmp2 = realpath(__FILE__);
- $i = strlen($tmp) - 1;
- $j = strlen($tmp2) - 1;
- while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
- $i--;
- $j--;
- }
- if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)) . "/main.inc.php")) {
- $res = @include substr($tmp, 0, ($i + 1)) . "/main.inc.php";
- }
- if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php")) {
- $res = @include dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php";
- }
- // Try main.inc.php using relative path
- if (!$res && file_exists("../main.inc.php")) {
- $res = @include "../main.inc.php";
- }
- if (!$res && file_exists("../../main.inc.php")) {
- $res = @include "../../main.inc.php";
- }
- if (!$res && file_exists("../../../main.inc.php")) {
- $res = @include "../../../main.inc.php";
- }
- if (!$res) {
- die("Include of main fails");
- }
- require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php';
- require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
- require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
- require_once DOL_DOCUMENT_ROOT . '/custom/settlements/class/helper.class.php';
- // load financialreport libraries
- require_once __DIR__ . '/../bbus/class/userloginnaplo.class.php';
- // for other modules
- //dol_include_once('/othermodule/class/otherobject.class.php');
- // Load translation files required by the page
- $langs->loadLangs(array("settlements@settlements", "other"));
- $id = GETPOST('id', 'int');
- $ref = GETPOST('ref', 'alpha');
- $user_id = GETPOST('user_id', 'int');
- $idmenu = GETPOST('idmenu', 'int');
- $action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
- $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
- $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
- $confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
- $cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
- $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
- $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)) . basename(__FILE__, '.php')); // To manage different context of search
- $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
- $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
- $mode = GETPOST('mode', 'aZ');
- // Initialize technical objects
- $object = new UserLoginNaplo($db);
- $extrafields = new ExtraFields($db);
- $enablepermissioncheck = 0;
- if ($enablepermissioncheck) {
- $permissiontoread = $user->rights->financialreport->userinvoice->read;
- $permissiontoadd = $user->rights->financialreport->userinvoice->write;
- $permissiontodelete = $user->rights->financialreport->userinvoice->delete;
- } else {
- $permissiontoread = 1;
- $permissiontoadd = 1;
- $permissiontodelete = 1;
- }
- // Security check (enable the most restrictive one)
- if ($user->socid > 0)
- accessforbidden();
- //if ($user->socid > 0) accessforbidden();
- //$socid = 0; if ($user->socid > 0) $socid = $user->socid;
- //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
- //restrictedArea($user, $object->element, 0, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
- if (empty($conf->financialreport->enabled))
- accessforbidden('Module not enabled');
- if (!$permissiontoread)
- accessforbidden();
- $form = new Form($db);
- $helper = new Helper($db);
- $now = dol_now();
- //$help_url = "EN:Module_UserInvoice|FR:Module_UserInvoice_FR|ES:Módulo_UserInvoice";
- $help_url = '';
- $title = $langs->trans('userLogoutHandler');
- $morejs = array();
- $morecss = array();
- llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist');
- $linkback = '<a href="' . dol_buildpath("/settlements/userloginnaplo_list.php", 1) . '?user_id=' . $user_id . '&idmenu=' . $idmenu . '&mainmenu=settlements&leftmenu=">' . '<b><span class="fa fa-arrow-left"></span> ' . $langs->trans("BackToList") . '</b></a>';
- print $linkback;
- print '<form method="POST" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">' . "\n";
- print '<input type="hidden" name="token" value="' . newToken() . '">';
- print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
- print '<input type="hidden" name="action" value="list">';
- print '<input type="hidden" name="user_id" value="' . $user_id . '">';
- print '<input type="hidden" name="id" value="' . $id . '">';
- $newcardbutton = '';
- print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_' . $object->picto, 0, $newcardbutton, '', 0, 0, 0, 1);
- print $id;
- print '</form>' . "\n";
- // End of page
- llxFooter();
- $db->close();
|