dolibarr 24.0.0-beta
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 * Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
26// Load Dolibarr environment
27require '../main.inc.php';
35require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
36require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
37require_once DOL_DOCUMENT_ROOT.'/core/lib/contact.lib.php';
38
39$langs->loadLangs(array("contacts", "companies", "projects"));
40
41$action = GETPOST('action', 'aZ09');
42
43// Security check
44$id = GETPOSTINT('id');
45
46// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
47$hookmanager->initHooks(array('projectcontact'));
48
49$object = new Project($db);
50
51restrictedArea($user, 'contact', $id, 'socpeople&societe');
52
53
54/*
55 * Actions
56 */
57
58$parameters = array('id' => $id);
59$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
60if ($reshook < 0) {
61 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
62}
63
64
65/*
66 * View
67 */
68
69$form = new Form($db);
70
71if ($id) {
72 $object = new Contact($db);
73
74 $result = $object->fetch($id);
75 if (empty($object->thirdparty)) {
76 $object->fetch_thirdparty();
77 }
78 $socid = !empty($object->thirdparty->id) ? $object->thirdparty->id : null;
79 $title = $langs->trans("Projects");
80 if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->name) {
81 $title = $object->name." - ".$title;
82 }
83 $help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
84
85 llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-societe page-contact-card_project');
86
87 if (isModEnabled('notification')) {
88 $langs->load("mails");
89 }
90 $head = contact_prepare_head($object);
91
92 print dol_get_fiche_head($head, 'project', $langs->trans("Contact"), -1, 'contact');
93
94 $linkback = '<a href="'.DOL_URL_ROOT.'/contact/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
95
96 $morehtmlref = '<a href="'.DOL_URL_ROOT.'/contact/vcard.php?id='.$object->id.'" class="refid">';
97 $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard', 'class="valignmiddle marginleftonly paddingrightonly"');
98 $morehtmlref .= '</a>';
99
100 $morehtmlref .= '<div class="refidno">';
101 if (!getDolGlobalString('SOCIETE_DISABLE_CONTACTS')) {
102 $objsoc = new Societe($db);
103 $objsoc->fetch($object->socid);
104 // Thirdparty
105 if ($objsoc->id > 0) {
106 $morehtmlref .= $objsoc->getNomUrl(1, 'contact');
107 } else {
108 $morehtmlref .= '<span class="opacitymedium">'.$langs->trans("ContactNotLinkedToCompany").'</span>';
109 }
110 }
111 $morehtmlref .= '</div>';
112
113 dol_banner_tab($object, 'id', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom', $morehtmlref);
114
115 print '<div class="fichecenter">';
116
117 print '<div class="underbanner clearboth"></div>';
118 print '<table class="border centpercent tableforfield">';
119
120 // Civility
121 print '<tr><td class="titlefield">'.$langs->trans("UserTitle").'</td><td>';
122 print $object->getCivilityLabel();
123 print '</td></tr>';
124
125 print '</table>';
126
127 print '</div>';
128
129 print dol_get_fiche_end();
130 print '<br>';
131
132 // Projects list
133 $result = show_contacts_projects($conf, $langs, $db, $object, $_SERVER["PHP_SELF"].'?id='.$object->id, 1);
134}
135
136// End of page
137llxFooter();
138$db->close();
$id
Support class for third parties, contacts, members, users or resources.
Definition account.php:47
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
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:73
Class to manage contact/addresses.
Class to manage generation of HTML components Only common components must be here.
Class to manage projects.
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.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
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, $allowothertags=array())
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, $morecssdiv='')
Show tabs of a record.
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.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
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.