Debug establishment
This commit is contained in:
parent
5b64a517ea
commit
95a7e13e3a
@ -3528,17 +3528,17 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
'accountancy', 'account', 'accountline', 'action', 'add', 'address', 'angle-double-down', 'angle-double-up', 'asset',
|
||||
'bank_account', 'barcode', 'bank', 'bill', 'billa', 'billr', 'billd', 'bookmark', 'bom', 'building',
|
||||
'cash-register', 'category', 'chart', 'check', 'clock', 'close_title', 'cog', 'collab', 'company', 'contact', 'country', 'contract', 'cron', 'cubes',
|
||||
'delete', 'dolly', 'dollyrevert', 'donation', 'download', 'edit', 'ellipsis-h', 'email', 'eraser', 'external-link-alt', 'external-link-square-alt',
|
||||
'delete', 'dolly', 'dollyrevert', 'donation', 'download', 'edit', 'ellipsis-h', 'email', 'eraser', 'establishment', 'external-link-alt', 'external-link-square-alt',
|
||||
'filter', 'file-code', 'file-export', 'file-import', 'file-upload', 'folder', 'folder-open', 'globe', 'globe-americas', 'grip', 'grip_title', 'group',
|
||||
'help', 'holiday',
|
||||
'info', 'intervention', 'inventory', 'intracommreport',
|
||||
'label', 'language', 'link', 'list', 'listlight', 'loan', 'lot', 'long-arrow-alt-right',
|
||||
'margin', 'map-marker-alt', 'member', 'meeting', 'money-bill-alt', 'movement', 'mrp', 'note', 'next',
|
||||
'object_accounting', 'object_account', 'object_accountline', 'object_action', 'object_asset', 'object_barcode', 'object_bill', 'object_billr', 'object_billa', 'object_billd', 'object_bom',
|
||||
'object_category', 'conferenceorbooth', 'object_conversation', 'object_bookmark', 'object_bug', 'object_clock', 'object_collab', 'object_dolly', 'object_dollyrevert',
|
||||
'object_category', 'conferenceorbooth', 'object_conversation', 'object_bookmark', 'object_bug', 'object_building', 'object_clock', 'object_collab', 'object_dolly', 'object_dollyrevert',
|
||||
'object_folder', 'object_folder-open','object_generic',
|
||||
'object_list-alt', 'object_calendar', 'object_calendarweek', 'object_calendarmonth', 'object_calendarday', 'object_calendarperuser',
|
||||
'object_cash-register', 'object_company', 'object_contact', 'object_contract', 'object_cron', 'object_donation', 'object_dynamicprice',
|
||||
'object_cash-register', 'object_company', 'object_contact', 'object_contract', 'object_cron', 'object_donation', 'object_dynamicprice', 'object_establishment',
|
||||
'object_globe', 'object_holiday', 'object_hrm', 'object_invoice', 'object_intervention', 'object_inventory', 'object_intracommreport', 'object_label',
|
||||
'object_margin', 'object_members', 'object_money-bill-alt', 'object_multicurrency', 'object_order', 'object_payment',
|
||||
'object_lot', 'object_mrp', 'object_other',
|
||||
@ -3568,7 +3568,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
$facolor = '';
|
||||
$fasize = '';
|
||||
$fa = 'fas';
|
||||
if (in_array($pictowithouttext, array('clock', 'generic', 'minus-square', 'object_generic', 'pdf', 'plus-square', 'timespent', 'note', 'off', 'on', 'object_bookmark', 'bookmark', 'vcard'))) {
|
||||
if (in_array($pictowithouttext, array('clock', 'establishment', 'generic', 'minus-square', 'object_generic', 'pdf', 'plus-square', 'timespent', 'note', 'off', 'on', 'object_bookmark', 'bookmark', 'vcard'))) {
|
||||
$fa = 'far';
|
||||
}
|
||||
if (in_array($pictowithouttext, array('black-tie', 'github', 'skype', 'twitter', 'facebook', 'linkedin', 'instagram', 'snapchat', 'stripe', 'stripe-s', 'youtube', 'google-plus-g', 'whatsapp'))) {
|
||||
@ -3584,7 +3584,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
'setup'=>'cog', 'companies'=>'building', 'products'=>'cube', 'commercial'=>'suitcase', 'invoicing'=>'coins',
|
||||
'accounting'=>'chart-line', 'category'=>'tag', 'dollyrevert'=>'dolly',
|
||||
'hrm'=>'user-tie', 'margin'=>'calculator', 'members'=>'user-friends', 'ticket'=>'ticket-alt', 'globe'=>'external-link-alt', 'lot'=>'barcode',
|
||||
'email'=>'at',
|
||||
'email'=>'at', 'establishment'=>'building',
|
||||
'edit'=>'pencil-alt', 'grip_title'=>'arrows-alt', 'grip'=>'arrows-alt', 'help'=>'question-circle',
|
||||
'generic'=>'file', 'holiday'=>'umbrella-beach',
|
||||
'info'=>'info-circle', 'inventory'=>'boxes', 'intracommreport'=>'globe-europe', 'label'=>'layer-group', 'loan'=>'money-bill-alt',
|
||||
|
||||
@ -27,6 +27,8 @@ require_once DOL_DOCUMENT_ROOT.'/hrm/class/establishment.class.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('admin', 'hrm'));
|
||||
|
||||
$permissiontoadd = $user->admin;
|
||||
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
@ -73,11 +75,13 @@ $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("HRMSetup"), $linkback);
|
||||
|
||||
$newcardbutton = dolGetButtonTitle($langs->trans('NewEstablishment'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/hrm/establishment/card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd);
|
||||
|
||||
// Configuration header
|
||||
$head = hrm_admin_prepare_head();
|
||||
print dol_get_fiche_head($head, 'establishments', $langs->trans("HRM"), -1, "user");
|
||||
print dol_get_fiche_head($head, 'establishments', $langs->trans("HRM"), -1, "user", 0, $newcardbutton);
|
||||
|
||||
$sql = "SELECT e.rowid, e.label, e.address, e.zip, e.town, e.status";
|
||||
$sql = "SELECT e.rowid, e.rowid as ref, e.label, e.address, e.zip, e.town, e.status";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."establishment as e";
|
||||
$sql .= " WHERE e.entity IN (".getEntity('establishment').')';
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
@ -135,11 +139,6 @@ if ($result) {
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
// Buttons
|
||||
print '<div class="tabsAction">';
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/hrm/establishment/card.php?action=create">'.$langs->trans("NewEstablishment").'</a>';
|
||||
print '</div>';
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
|
||||
@ -27,10 +27,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('admin', 'hrm'));
|
||||
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
// Other parameters HRM_*
|
||||
@ -38,9 +34,15 @@ $list = array(
|
||||
// 'HRM_EMAIL_EXTERNAL_SERVICE' // To prevent your public accountant for example
|
||||
);
|
||||
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'update') {
|
||||
$error = 0;
|
||||
|
||||
|
||||
@ -58,7 +58,7 @@ class Establishment extends CommonObject
|
||||
/**
|
||||
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
|
||||
*/
|
||||
public $picto = 'building';
|
||||
public $picto = 'establishment';
|
||||
|
||||
/**
|
||||
* @var int ID
|
||||
@ -428,34 +428,92 @@ class Establishment extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Return clicable name (with picto eventually)
|
||||
* Return a link to the object card (with optionaly the picto)
|
||||
*
|
||||
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
|
||||
* @return string String with URL
|
||||
* @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto)
|
||||
* @param string $option On what the link point to ('nolink', ...)
|
||||
* @param int $notooltip 1=Disable tooltip
|
||||
* @param string $morecss Add more css on link
|
||||
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
||||
* @return string String with URL
|
||||
*/
|
||||
public function getNomUrl($withpicto = 0)
|
||||
public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
|
||||
{
|
||||
global $langs;
|
||||
global $conf, $langs, $hookmanager;
|
||||
|
||||
if (!empty($conf->dol_no_mouse_hover)) {
|
||||
$notooltip = 1; // Force disable tooltips
|
||||
}
|
||||
|
||||
$result = '';
|
||||
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/hrm/establishment/card.php?id='.$this->id.'">';
|
||||
$linkend = '</a>';
|
||||
$label = img_picto('', $this->picto).' <u>'.$langs->trans("Establishment").'</u>';
|
||||
if (isset($this->status)) {
|
||||
$label .= ' '.$this->getLibStatut(5);
|
||||
}
|
||||
$label .= '<br>';
|
||||
$label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref;
|
||||
|
||||
$picto = 'building';
|
||||
$url = DOL_URL_ROOT.'/hrm/establishment/card.php?id='.$this->id;
|
||||
|
||||
$label = '<u>'.$langs->trans("Establishment").'</u>';
|
||||
$label .= '<br>'.$langs->trans("Label").': '.$this->label;
|
||||
if ($option != 'nolink') {
|
||||
// Add param to save lastsearch_values or not
|
||||
$add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
|
||||
if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
|
||||
$add_save_lastsearch_values = 1;
|
||||
}
|
||||
if ($add_save_lastsearch_values) {
|
||||
$url .= '&save_lastsearch_values=1';
|
||||
}
|
||||
}
|
||||
|
||||
$linkclose = '';
|
||||
if (empty($notooltip)) {
|
||||
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
|
||||
$label = $langs->trans("Establishment");
|
||||
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||
}
|
||||
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
|
||||
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
|
||||
} else {
|
||||
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
|
||||
}
|
||||
|
||||
if ($option == 'nolink') {
|
||||
$linkstart = '<span';
|
||||
} else {
|
||||
$linkstart = '<a href="'.$url.'"';
|
||||
}
|
||||
$linkstart .= $linkclose.'>';
|
||||
if ($option == 'nolink') {
|
||||
$linkend = '</span>';
|
||||
} else {
|
||||
$linkend = '</a>';
|
||||
}
|
||||
|
||||
$result .= $linkstart;
|
||||
|
||||
if ($withpicto) {
|
||||
$result .= ($link.img_object($label, $picto).$linkend);
|
||||
}
|
||||
if ($withpicto && $withpicto != 2) {
|
||||
$result .= ' ';
|
||||
$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
|
||||
}
|
||||
|
||||
if ($withpicto != 2) {
|
||||
$result .= $link.$this->label.$linkend;
|
||||
$result .= $this->ref;
|
||||
}
|
||||
|
||||
$result .= $linkend;
|
||||
//if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
|
||||
|
||||
global $action, $hookmanager;
|
||||
$hookmanager->initHooks(array('establishmentdao'));
|
||||
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
|
||||
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook > 0) {
|
||||
$result = $hookmanager->resPrint;
|
||||
} else {
|
||||
$result .= $hookmanager->resPrint;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
* \file htdocs/hrm/establishment/card.php
|
||||
* \brief Page to show an establishment
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/hrm.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/hrm/class/establishment.class.php';
|
||||
@ -28,11 +29,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('admin', 'hrm'));
|
||||
|
||||
// Security check
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
$error = 0;
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
@ -55,6 +51,22 @@ $object = new Establishment($db);
|
||||
// Load object
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
|
||||
|
||||
$permissiontoadd = $user->rights->hrm->write; // Used by the include of actions_addupdatedelete.inc.php
|
||||
$upload_dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->entity : 1];
|
||||
|
||||
// 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 (empty($conf->mymodule->enabled)) accessforbidden();
|
||||
//if (empty($permissiontoread)) accessforbidden();
|
||||
|
||||
// Security check
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -165,7 +177,7 @@ if ($action == 'create') {
|
||||
// Name
|
||||
print '<tr>';
|
||||
print '<td>'.$form->editfieldkey('Label', 'label', '', $object, 0, 'string', '', 1).'</td>';
|
||||
print '<td><input name="label" id="label" value="'.GETPOST("label", "alphanohtml").'"></td>';
|
||||
print '<td><input name="label" id="label" value="'.GETPOST("label", "alphanohtml").'" autofocus></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Entity
|
||||
@ -252,7 +264,7 @@ if (($id || $ref) && $action == 'edit') {
|
||||
$head = establishment_prepare_head($object);
|
||||
|
||||
if ($action == 'edit') {
|
||||
print dol_get_fiche_head($head, 'card', $langs->trans("Establishment"), 0, 'building');
|
||||
print dol_get_fiche_head($head, 'card', $langs->trans("Establishment"), 0, $object->picto);
|
||||
|
||||
print '<form name="update" action="'.$_SERVER["PHP_SELF"].'" method="POST">'."\n";
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
@ -335,7 +347,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
$res = $object->fetch_optionals();
|
||||
|
||||
$head = establishment_prepare_head($object);
|
||||
print dol_get_fiche_head($head, 'card', $langs->trans("Establishment"), -1, 'building');
|
||||
print dol_get_fiche_head($head, 'card', $langs->trans("Establishment"), -1, $object->picto);
|
||||
|
||||
// Confirmation to delete
|
||||
if ($action == 'delete') {
|
||||
|
||||
@ -76,12 +76,18 @@ if ($id > 0 || !empty($ref)) {
|
||||
$upload_dir = $conf->hrm->multidir_output[$object->entity]."/".$object->id;
|
||||
}
|
||||
|
||||
$permissiontoadd = $user->rights->hrm->write; // Used by the include of actions_addupdatedelete.inc.php
|
||||
$upload_dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->entity : 1];
|
||||
|
||||
// Security check - Protection if external user
|
||||
//if ($user->socid > 0) accessforbidden();
|
||||
//if ($user->socid > 0) $socid = $user->socid;
|
||||
//$result = restrictedArea($user, 'mymodule', $object->id);
|
||||
|
||||
$permissiontoadd = $user->rights->hrm->write; // Used by the include of actions_addupdatedelete.inc.php
|
||||
// Security check
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@ -128,7 +134,7 @@ if ($object->id > 0) {
|
||||
$head = establishment_prepare_head($object);
|
||||
|
||||
|
||||
print dol_get_fiche_head($head, 'info', $langs->trans("Establishment"), -1, 'building');
|
||||
print dol_get_fiche_head($head, 'info', $langs->trans("Establishment"), -1, $object->picto);
|
||||
|
||||
// Object card
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@ -132,7 +132,7 @@ $upload_dir = $conf->mymodule->multidir_output[isset($object->entity) ? $object-
|
||||
// Security check - Protection if external user
|
||||
//if ($user->socid > 0) accessforbidden();
|
||||
//if ($user->socid > 0) $socid = $user->socid;
|
||||
//$isdraft = (($object->statut == $object::STATUS_DRAFT) ? 1 : 0);
|
||||
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
|
||||
//restrictedArea($user, $object->element, $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
|
||||
//if (empty($conf->mymodule->enabled)) accessforbidden();
|
||||
//if (empty($permissiontoread)) accessforbidden();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user