--- /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 '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table + // Load attribute_label @@ -133,2 +99 @@ - print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "e.ref", "", "", "", $sortfield, $sortorder); - print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "e.label", "", "", "", $sortfield, $sortorder); + print_liste_field_titre("Name", $_SERVER["PHP_SELF"], "e.name", "", "", "", $sortfield, $sortorder); @@ -136 +101 @@ - print_liste_field_titre("Zip", $_SERVER["PHP_SELF"], "e.zip", "", "", "", $sortfield, $sortorder); + print_liste_field_titre("Zipcode", $_SERVER["PHP_SELF"], "e.zip", "", "", "", $sortfield, $sortorder); @@ -141,2 +106,3 @@ - if ($num > 0) { - $establishmentstatic = new Establishment($db); + if ($num > 0) + { + $establishmentstatic = new Establishment($db); @@ -144,2 +110,3 @@ - while ($i < min($num, $limit)) { - $obj = $db->fetch_object($result); + while ($i < min($num, $limit)) + { + $obj = $db->fetch_object($result); @@ -148,2 +115 @@ - $establishmentstatic->ref = $obj->ref; - $establishmentstatic->label = $obj->label; + $establishmentstatic->name = $obj->name; @@ -150,0 +117 @@ + @@ -154,5 +121,5 @@ - print ''.dol_escape_htmltag($obj->label).''; - print ''.dol_escape_htmltag($obj->address).''; - print ''.dol_escape_htmltag($obj->zip).''; - print ''.dol_escape_htmltag($obj->town).''; - print ''; + print ''.$obj->address.''; + print ''.$obj->zip.''; + print ''.$obj->town.''; + + print ''; @@ -161 +128 @@ - print "\n"; + print "\n"; @@ -163,5 +130,7 @@ - $i++; - } - } else { - print ''.$langs->trans("None").''; - } + $i++; + } + } + else + { + print ''.$langs->trans("None").''; + } @@ -170,2 +139,3 @@ - print '
'; -} else { +} +else +{ @@ -175 +145,6 @@ -print dol_get_fiche_end(); +dol_fiche_end(); + +// Buttons +print '
'; +print ''.$langs->trans("NewEstablishment").''; +print '
'; --- /tmp/dsg/dolibarr/htdocs/hrm/admin/github_19.0.3_admin_hrm.php +++ /tmp/dsg/dolibarr/htdocs/hrm/admin/client_admin_hrm.php @@ -19,3 +19,3 @@ - * \file htdocs/hrm/admin/admin_hrm.php - * \ingroup HRM - * \brief HRM module setup page + * \file htdocs/hrm/admin/admin_hrm.php + * \ingroup HRM + * \brief HRM module setup page @@ -23,2 +22,0 @@ - -// Load Dolibarr environment @@ -32,2 +30,4 @@ -// Get Parameters -$action = GETPOST('action', 'aZ09'); +if (!$user->admin) + accessforbidden(); + +$action = GETPOST('action', 'alpha'); @@ -37 +37 @@ -// 'HRM_EMAIL_EXTERNAL_SERVICE' // To prevent your public accountant for example + 'HRM_EMAIL_EXTERNAL_SERVICE' // To prevent your public accountant for example @@ -39,17 +38,0 @@ - -// 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(); -} - @@ -60 +42,0 @@ - @@ -79 +60,0 @@ - @@ -83,5 +64 @@ - - -$title = $langs->trans('Parameters'); - -llxHeader('', $title, ''); +llxHeader('', $langs->trans('Parameters')); @@ -104 +81 @@ -print dol_get_fiche_head($head, 'parameters', $langs->trans("HRM"), -1, "user"); +dol_fiche_head($head, 'parameters', $langs->trans("HRM"), -1, "user"); @@ -108 +85 @@ -print ''.$langs->trans('Parameters').''; +print ''.$langs->trans('Journaux').''; @@ -112 +89,3 @@ - print ''; + $var = !$var; + + print ''; @@ -120 +99 @@ - print ''; + print ''; @@ -126 +105 @@ -print dol_get_fiche_end(); +dol_fiche_end(); @@ -128 +107 @@ -print '
'; +print '
';