28 require
'../main.inc.php';
29 require_once DOL_DOCUMENT_ROOT.
'/resource/class/dolresource.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/lib/resource.lib.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
35 $langs->loadLangs(array(
'resource',
'sendings',
'companies'));
39 $action =
GETPOST(
'action',
'aZ09');
42 if ($user->socid) $socid = $user->socid;
45 $object =
new DolResource($db);
46 $result = $object->fetch($id, $ref);
53 if ($action ==
'addcontact' && $user->rights->resource->write)
55 if ($result > 0 && $id > 0)
59 $result = $object->add_contact($contactid, $typeid,
GETPOST(
"source",
'aZ09'));
64 header(
"Location: ".
$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
67 if ($object->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
68 $langs->load(
"errors");
69 $mesg = $langs->trans(
"ErrorThisContactIsAlreadyDefinedAsThisType");
71 $mesg = $object->error;
79 elseif ($action ==
'swapstatut' && $user->rights->resource->write)
81 $result = $object->swapContactStatus(
GETPOST(
'ligne',
'int'));
85 elseif ($action ==
'deletecontact' && $user->rights->resource->write)
87 $result = $object->delete_contact(
GETPOST(
'lineid',
'int'));
91 header(
"Location: ".
$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
103 $form =
new Form($db);
105 $contactstatic =
new Contact($db);
106 $userstatic =
new User($db);
108 llxHeader(
'', $langs->trans(
"Resource"));
112 if ($id > 0 || !empty($ref))
115 $soc->fetch($object->socid);
122 $linkback =
'<a href="'.DOL_URL_ROOT.
'/resource/list.php'.(!empty($socid) ?
'?id='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
125 $morehtmlref =
'<div class="refidno">';
126 $morehtmlref .=
'</div>';
129 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
132 print '<div class="fichecenter">';
133 print '<div class="underbanner clearboth"></div>';
138 print '<table class="border tableforfield centpercent">';
142 print '<td class="titlefield">'.$langs->trans(
"ResourceType").
'</td>';
144 print $object->type_label;
155 if (!empty($conf->global->RESOURCE_HIDE_ADD_CONTACT_USER)) $hideaddcontactforuser = 1;
156 if (!empty($conf->global->RESOURCE_HIDE_ADD_CONTACT_THIPARTY)) $hideaddcontactforthirdparty = 1;
160 include DOL_DOCUMENT_ROOT.
'/core/tpl/contacts.tpl.php';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Class to manage Dolibarr users.
resource_prepare_head($object)
Prepare head for tabs.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
Class to manage third parties objects (customers, suppliers, prospects...)
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0)
Check permissions of a user to show a page and an object.
print $_SERVER["PHP_SELF"]
Edit parameters.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
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.
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.