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;
46$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
47$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
52 $sortfield =
"e.rowid";
55if (empty($page) || $page == -1) {
59$limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
60$offset = $limit * $page;
79$title = $langs->trans(
'Establishments');
85$linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
91print
dol_get_fiche_head($head,
'establishments', $langs->trans(
"HRM"), -1,
"hrm", 0,
'');
95$sql =
"SELECT e.rowid, e.rowid as ref, e.label, e.address, e.zip, e.town, e.status";
96$sql .=
" FROM ".MAIN_DB_PREFIX.
"establishment as e";
97$sql .=
" WHERE e.entity IN (".getEntity(
'establishment').
')';
100$nbtotalofrecords =
'';
102 $resql = $db->query($sql);
103 $nbtotalofrecords = $db->num_rows($resql);
105 if (($page * $limit) > $nbtotalofrecords) {
112$sql .= $db->order($sortfield, $sortorder);
113$sql .= $db->plimit($limit + 1, $offset);
116$newcardbutton =
dolGetButtonTitle($langs->trans(
'NewEstablishment'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/hrm/establishment/card.php?action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF']),
'', $permissiontoadd);
118print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', 0, $nbtotalofrecords,
'', 0, $newcardbutton,
'', $limit, 0, 0, 1);
121$result = $db->query($sql);
123 $num = $db->num_rows($result);
126 print
'<div class="div-table-responsive">';
127 print
'<table class="noborder centpercent">';
128 print
'<tr class="liste_titre">';
134 print_liste_field_titre(
"Status", $_SERVER[
"PHP_SELF"],
"e.status",
"",
"",
'', $sortfield, $sortorder,
'right ');
140 while ($i < min($num, $limit)) {
141 $obj = $db->fetch_object($result);
143 $establishmentstatic->id = $obj->rowid;
144 $establishmentstatic->ref = $obj->ref;
145 $establishmentstatic->label = $obj->label;
146 $establishmentstatic->status = $obj->status;
148 print
'<tr class="oddeven">';
149 print
'<td>'.$establishmentstatic->getNomUrl(1).
'</td>';
150 print
'<td>'.dol_escape_htmltag($obj->label).
'</td>';
151 print
'<td>'.dol_escape_htmltag($obj->address).
'</td>';
152 print
'<td>'.dol_escape_htmltag($obj->zip).
'</td>';
153 print
'<td>'.dol_escape_htmltag($obj->town).
'</td>';
154 print
'<td class="right">';
155 print $establishmentstatic->getLibStatut(5);
162 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()
Empty header.
Class to manage establishments.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
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.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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 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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
print_barre_liste($titre, $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.
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.