25require
'../../main.inc.php';
26require_once DOL_DOCUMENT_ROOT.
'/hrm/lib/hrm.lib.php';
27require_once DOL_DOCUMENT_ROOT.
'/hrm/class/establishment.class.php';
30$langs->loadLangs(array(
'admin',
'hrm'));
35$permissiontoread = $user->admin;
36$permissiontoadd = $user->admin;
43if (!isModEnabled(
'hrm')) {
46if (empty($permissiontoread)) {
50$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
51$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
56 $sortfield =
"e.rowid";
59if (empty($page) || $page == -1) {
64$offset = $limit * $page;
83$title = $langs->trans(
'Establishments');
89$linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
95print
dol_get_fiche_head($head,
'establishments', $langs->trans(
"HRM"), -1,
"hrm", 0,
'');
99$sql =
"SELECT e.rowid, e.rowid as ref, e.label, e.address, e.zip, e.town, e.status";
100$sql .=
" FROM ".MAIN_DB_PREFIX.
"establishment as e";
101$sql .=
" WHERE e.entity IN (".getEntity(
'establishment').
')';
104$nbtotalofrecords =
'';
106 $resql = $db->query($sql);
107 $nbtotalofrecords = $db->num_rows($resql);
109 if (($page * $limit) > $nbtotalofrecords) {
116$sql .= $db->order($sortfield, $sortorder);
117$sql .= $db->plimit($limit + 1, $offset);
120$newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewEstablishment'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/hrm/establishment/card.php?action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF']),
'', $permissiontoadd);
122print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', 0, $nbtotalofrecords,
'', 0, $newcardbutton,
'', $limit, 0, 0, 1);
125$result = $db->query($sql);
127 $num = $db->num_rows($result);
130 print
'<div class="div-table-responsive">';
131 print
'<table class="noborder centpercent">';
132 print
'<tr class="liste_titre">';
138 print_liste_field_titre(
"Status", $_SERVER[
"PHP_SELF"],
"e.status",
"",
"",
'', $sortfield, $sortorder,
'right ');
144 while ($i < min($num, $limit)) {
145 $obj = $db->fetch_object($result);
147 $establishmentstatic->id = $obj->rowid;
148 $establishmentstatic->ref = $obj->ref;
149 $establishmentstatic->label = $obj->label;
150 $establishmentstatic->status = $obj->status;
152 print
'<tr class="oddeven">';
153 print
'<td>'.$establishmentstatic->getNomUrl(1).
'</td>';
154 print
'<td>'.dol_escape_htmltag($obj->label).
'</td>';
155 print
'<td>'.dol_escape_htmltag($obj->address).
'</td>';
156 print
'<td>'.dol_escape_htmltag($obj->zip).
'</td>';
157 print
'<td>'.dol_escape_htmltag($obj->town).
'</td>';
158 print
'<td class="right">';
159 print $establishmentstatic->getLibStatut(5);
166 print
'<tr class="oddeven"><td colspan="7"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage establishments.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
hrmAdminPrepareHead()
Prepare admin pages header.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.