Go to the documentation of this file.
23 require
'../../main.inc.php';
24 require_once DOL_DOCUMENT_ROOT.
'/hrm/lib/hrm.lib.php';
25 require_once DOL_DOCUMENT_ROOT.
'/hrm/class/establishment.class.php';
28 $langs->loadLangs(array(
'admin',
'hrm'));
32 $permissiontoread = $user->admin;
33 $permissiontoadd = $user->admin;
43 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
44 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
49 $sortfield =
"e.rowid";
52 if (empty($page) || $page == -1) {
56 $offset = $limit * $page;
57 $pageprev = $page - 1;
58 $pagenext = $page + 1;
59 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
76 $title = $langs->trans(
'Establishments');
82 $linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
88 print
dol_get_fiche_head($head,
'establishments', $langs->trans(
"HRM"), -1,
"hrm", 0,
'');
92 $sql =
"SELECT e.rowid, e.rowid as ref, e.label, e.address, e.zip, e.town, e.status";
93 $sql .=
" FROM ".MAIN_DB_PREFIX.
"establishment as e";
94 $sql .=
" WHERE e.entity IN (".getEntity(
'establishment').
')';
97 $nbtotalofrecords =
'';
98 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
100 $nbtotalofrecords = $db->num_rows(
$resql);
102 if (($page * $limit) > $nbtotalofrecords) {
109 $sql .= $db->order($sortfield, $sortorder);
110 $sql .= $db->plimit($limit + 1, $offset);
113 $newcardbutton =
dolGetButtonTitle($langs->trans(
'NewEstablishment'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/hrm/establishment/card.php?action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF']),
'', $permissiontoadd);
115 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', 0, $nbtotalofrecords,
'', 0, $newcardbutton,
'', $limit, 0, 0, 1);
118 $result = $db->query($sql);
120 $num = $db->num_rows($result);
123 print
'<div class="div-table-responsive">';
124 print
'<table class="noborder centpercent">';
125 print
'<tr class="liste_titre">';
131 print_liste_field_titre(
"Status", $_SERVER[
"PHP_SELF"],
"e.status",
"",
"",
'', $sortfield, $sortorder,
'right ');
137 while ($i < min($num, $limit)) {
138 $obj = $db->fetch_object($result);
140 $establishmentstatic->id = $obj->rowid;
141 $establishmentstatic->ref = $obj->ref;
142 $establishmentstatic->label = $obj->label;
143 $establishmentstatic->status = $obj->status;
146 print
'<tr class="oddeven">';
147 print
'<td>'.$establishmentstatic->getNomUrl(1).
'</td>';
148 print
'<td>'.$obj->label.
'</td>';
149 print
'<td class="left">'.$obj->address.
'</td>';
150 print
'<td class="left">'.$obj->zip.
'</td>';
151 print
'<td class="left">'.$obj->town.
'</td>';
152 print
'<td class="right">';
153 print $establishmentstatic->getLibStatut(5);
160 print
'<tr class="oddeven"><td colspan="7" class="opacitymedium">'.$langs->trans(
"None").
'</td></tr>';
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
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='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
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.
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.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire)||(isModEnabled('supplier_invoice') && $user->rights->supplier_invoice->lire)) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
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 Calling this function terminate execution ...
Class to manage establishments.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.