dolibarr 21.0.0-alpha
project.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2021 VIAL-GOUTEYRON Quentin <quentin.vial-gouteyron@atm-consulting.fr>
3 * Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 */
18
25// Load Dolibarr environment
26require '../main.inc.php';
27require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
28
29$langs->loadLangs(array("contacts", "companies", "projects"));
30
31// Security check
32$id = GETPOSTINT('id');
33
34// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
35$hookmanager->initHooks(array('projectcontact'));
36
37$result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
38
39/*
40 * Actions
41 */
42
43$parameters = array('id' => $id);
44$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
45if ($reshook < 0) {
46 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
47}
48
49/*
50 * View
51 */
52
53$form = new Form($db);
54
55if ($id) {
56 require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
57 require_once DOL_DOCUMENT_ROOT.'/core/lib/contact.lib.php';
58
59 $object = new Contact($db);
60
61 $result = $object->fetch($id);
62 if (empty($object->thirdparty)) {
63 $object->fetch_thirdparty();
64 }
65 $socid = !empty($object->thirdparty->id) ? $object->thirdparty->id : null;
66 $title = $langs->trans("Projects");
67 if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->name) {
68 $title = $object->name." - ".$title;
69 }
70 $help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
71
72 llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-societe page-contact-card_project');
73
74 if (isModEnabled('notification')) {
75 $langs->load("mails");
76 }
78
79 print dol_get_fiche_head($head, 'project', $langs->trans("Contact"), -1, 'contact');
80
81 $linkback = '<a href="'.DOL_URL_ROOT.'/contact/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
82
83 $morehtmlref = '<a href="'.DOL_URL_ROOT.'/contact/vcard.php?id='.$object->id.'" class="refid">';
84 $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
85 $morehtmlref .= '</a>';
86
87 $morehtmlref .= '<div class="refidno">';
88 if (!getDolGlobalString('SOCIETE_DISABLE_CONTACTS')) {
89 $objsoc = new Societe($db);
90 $objsoc->fetch($object->socid);
91 // Thirdparty
92 if ($objsoc->id > 0) {
93 $morehtmlref .= $objsoc->getNomUrl(1, 'contact');
94 } else {
95 $morehtmlref .= '<span class="opacitymedium">'.$langs->trans("ContactNotLinkedToCompany").'</span>';
96 }
97 }
98 $morehtmlref .= '</div>';
99
100 dol_banner_tab($object, 'id', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom', $morehtmlref);
101
102 print '<div class="fichecenter">';
103
104 print '<div class="underbanner clearboth"></div>';
105 print '<table class="border centpercent tableforfield">';
106
107 // Civility
108 print '<tr><td class="titlefield">'.$langs->trans("UserTitle").'</td><td>';
109 print $object->getCivilityLabel();
110 print '</td></tr>';
111
112 print '</table>';
113
114 print '</div>';
115
116 print dol_get_fiche_end();
117 print '<br>';
118
119 // Projects list
120 $result = show_contacts_projects($conf, $langs, $db, $object, $_SERVER["PHP_SELF"].'?id='.$object->id, 1);
121}
122
123// End of page
124llxFooter();
125$db->close();
$id
Definition account.php:39
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:58
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.
Definition wrapper.php:70
Class to manage contact/addresses.
Class to manage generation of HTML components Only common components must be here.
Class to manage third parties objects (customers, suppliers, prospects...)
contact_prepare_head(Contact $object)
Prepare array with list of tabs.
show_contacts_projects($conf, $langs, $db, $object, $backtopage='', $nocreatelink=0, $morehtmlright='')
Show html area for list of projects.
llxFooter()
Footer empty.
Definition document.php:107
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
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.