31require
'../main.inc.php';
32require_once DOL_DOCUMENT_ROOT.
'/resource/class/dolresource.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/lib/resource.lib.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
38$langs->loadLangs(array(
'companies',
'resource',
'sendings'));
42$action =
GETPOST(
'action',
'aZ09');
47include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
51 $socid = $user->socid;
53$result =
restrictedArea($user,
'resource', $object->id,
'resource');
56if (!$user->hasRight(
'resource',
'read')) {
67if ($action ==
'addcontact' && $user->hasRight(
'resource',
'write')) {
68 if ($result > 0 && $id > 0) {
71 $result = $object->add_contact($contactid, $typeid,
GETPOST(
"source",
'aZ09'));
75 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
78 if ($object->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
79 $langs->load(
"errors");
80 $mesg = $langs->trans(
"ErrorThisContactIsAlreadyDefinedAsThisType");
82 $mesg = $object->error;
87} elseif ($action ==
'swapstatut' && $user->hasRight(
'resource',
'write')) {
89 $result = $object->swapContactStatus(
GETPOST(
'ligne',
'int'));
90} elseif ($action ==
'deletecontact' && $user->hasRight(
'resource',
'write')) {
92 $result = $object->delete_contact(
GETPOST(
'lineid',
'int'));
95 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
107$form =
new Form($db);
109$contactstatic =
new Contact($db);
110$userstatic =
new User($db);
116if ($id > 0 || !empty($ref)) {
118 print
dol_get_fiche_head($head,
'contact', $langs->trans(
"ResourceSingular"), -1,
'resource');
121 $linkback =
'<a href="'.DOL_URL_ROOT.
'/resource/list.php'.(!empty($socid) ?
'?id='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
124 $morehtmlref =
'<div class="refidno">';
125 $morehtmlref .=
'</div>';
128 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
131 print
'<div class="fichecenter">';
132 print
'<div class="underbanner clearboth"></div>';
137 print
'<table class="border tableforfield centpercent">';
141 print
'<td class="titlefield">'.$langs->trans(
"ResourceType").
'</td>';
143 print $object->type_label;
155 $hideaddcontactforuser = 1;
158 $hideaddcontactforthirdparty = 1;
163 include DOL_DOCUMENT_ROOT.
'/core/tpl/contacts.tpl.php';
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage Dolibarr users.
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
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...
dol_get_fiche_end($notab=0)
Return tab footer of a card.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
resource_prepare_head($object)
Prepare head for tabs.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.