--- /tmp/dsg/dolibarr/htdocs/hrm/admin/github_19.0.3_admin_establishment.php +++ /tmp/dsg/dolibarr/htdocs/hrm/admin/client_admin_establishment.php @@ -19,3 +19,3 @@ - * \file htdocs/hrm/admin/admin_establishment.php - * \ingroup HRM - * \brief HRM Establishment module setup page + * \file htdocs/hrm/admin/admin_establishment.php + * \ingroup HRM + * \brief HRM Establishment module setup page @@ -23,2 +22,0 @@ - -// Load Dolibarr environment @@ -26 +24 @@ -require_once DOL_DOCUMENT_ROOT.'/hrm/lib/hrm.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/hrm.lib.php'; @@ -31,0 +30,3 @@ +if (!$user->admin) + accessforbidden(); + @@ -34,34 +35,7 @@ -// Permissions -$permissiontoread = $user->admin; -$permissiontoadd = $user->admin; - -// Security check - Protection if external user -//if ($user->socid > 0) accessforbidden(); -//if ($user->socid > 0) $socid = $user->socid; -//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); -//restrictedArea($user, $object->element, $object->id, '', '', 'fk_soc', 'rowid', 0); -if (!isModEnabled('hrm')) { - accessforbidden(); -} -if (empty($permissiontoread)) { - accessforbidden(); -} - -$sortorder = GETPOST('sortorder', 'aZ09comma'); -$sortfield = GETPOST('sortfield', 'aZ09comma'); -if (!$sortorder) { - $sortorder = "DESC"; -} -if (!$sortfield) { - $sortfield = "e.rowid"; -} - -if (empty($page) || $page == -1) { - $page = 0; -} - -$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; -$offset = $limit * $page; -$pageprev = $page - 1; -$pagenext = $page + 1; - +// List of statut +static $tmpstatus2label = array( + '0'=>'OpenEtablishment', + '1'=>'CloseEtablishment' +); +$status2label = array(''); +foreach ($tmpstatus2label as $key => $val) $status2label[$key] = $langs->trans($val); @@ -79,0 +54,17 @@ +llxHeader('', $langs->trans("Establishments")); + +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; +$sortorder = GETPOST("sortorder"); +$sortfield = GETPOST("sortfield"); +if (!$sortorder) $sortorder = "DESC"; +if (!$sortfield) $sortfield = "e.rowid"; + +if (empty($page) || $page == -1) { + $page = 0; +} + +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; + @@ -83,4 +74 @@ -$title = $langs->trans('Establishments'); - -llxHeader('', $title, ''); - +dol_htmloutput_mesg($mesg); @@ -90,2 +78 @@ -print load_fiche_titre($langs->trans("HRMSetup"), $linkback, 'title_setup'); - +print load_fiche_titre($langs->trans("HRMSetup"), $linkback); @@ -94,2 +81,2 @@ -$head = hrmAdminPrepareHead(); -print dol_get_fiche_head($head, 'establishments', $langs->trans("HRM"), -1, "hrm", 0, ''); +$head = hrm_admin_prepare_head(); +dol_fiche_head($head, 'establishments', $langs->trans("HRM"), -1, "user"); @@ -97,3 +84 @@ -$param = ''; - -$sql = "SELECT e.rowid, e.rowid as ref, e.label, e.address, e.zip, e.town, e.status"; +$sql = "SELECT e.rowid, e.name, e.address, e.zip, e.town, e.status"; @@ -102,14 +86,0 @@ - -// Count total nb of records -$nbtotalofrecords = ''; -if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) { - $resql = $db->query($sql); - $nbtotalofrecords = $db->num_rows($resql); - - if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0 - $page = 0; - $offset = 0; - } - $db->free($resql); -} - @@ -119,6 +89,0 @@ -$newcardbutton = ''; -$newcardbutton .= dolGetButtonTitle($langs->trans('NewEstablishment'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/hrm/establishment/card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd); - -print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', 0, $nbtotalofrecords, '', 0, $newcardbutton, '', $limit, 0, 0, 1); - - @@ -126 +91,2 @@ -if ($result) { +if ($result) +{ @@ -130 +96 @@ - print '