26require
'../../main.inc.php';
27require_once DOL_DOCUMENT_ROOT.
'/hrm/lib/hrm.lib.php';
28require_once DOL_DOCUMENT_ROOT.
'/hrm/class/establishment.class.php';
39$langs->loadLangs(array(
'admin',
'hrm'));
44$permissiontoread = $user->admin;
45$permissiontoadd = $user->admin;
52if (!isModEnabled(
'hrm')) {
55if (empty($permissiontoread)) {
59$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
60$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
65 $sortfield =
"e.rowid";
68if (empty($page) || $page == -1) {
73$offset = $limit * $page;
92$title = $langs->trans(
'Establishments');
98$linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
104print
dol_get_fiche_head($head,
'establishments', $langs->trans(
"HRM"), -1,
"hrm", 0,
'');
108$sql =
"SELECT e.rowid, e.rowid as ref, e.label, e.address, e.zip, e.town, e.status";
109$sql .=
" FROM ".MAIN_DB_PREFIX.
"establishment as e";
110$sql .=
" WHERE e.entity IN (".getEntity(
'establishment').
')';
113$nbtotalofrecords =
'';
115 $resql = $db->query($sql);
116 $nbtotalofrecords = $db->num_rows($resql);
118 if (($page * $limit) > $nbtotalofrecords) {
125$sql .= $db->order($sortfield, $sortorder);
126$sql .= $db->plimit($limit + 1, $offset);
129$newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewEstablishment'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/hrm/establishment/card.php?action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF']),
'', $permissiontoadd);
131print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', 0, $nbtotalofrecords,
'', 0, $newcardbutton,
'', $limit, 0, 0, 1);
134$result = $db->query($sql);
136 $num = $db->num_rows($result);
139 print
'<div class="div-table-responsive">';
140 print
'<table class="noborder centpercent">';
141 print
'<tr class="liste_titre">';
147 print_liste_field_titre(
"Status", $_SERVER[
"PHP_SELF"],
"e.status",
"",
"",
'', $sortfield, $sortorder,
'right ');
153 while ($i < min($num, $limit)) {
154 $obj = $db->fetch_object($result);
156 $establishmentstatic->id = $obj->rowid;
157 $establishmentstatic->ref = $obj->ref;
158 $establishmentstatic->label = $obj->label;
159 $establishmentstatic->status = $obj->status;
161 print
'<tr class="oddeven">';
162 print
'<td>'.$establishmentstatic->getNomUrl(1).
'</td>';
163 print
'<td>'.dol_escape_htmltag($obj->label).
'</td>';
164 print
'<td>'.dol_escape_htmltag($obj->address).
'</td>';
165 print
'<td>'.dol_escape_htmltag($obj->zip).
'</td>';
166 print
'<td>'.dol_escape_htmltag($obj->town).
'</td>';
167 print
'<td class="right">';
168 print $establishmentstatic->getLibStatut(5);
175 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.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
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.
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.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.