dolibarr 18.0.6
project.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2005 Brice Davoleau <brice.davoleau@gmail.com>
4 * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
5 * Copyright (C) 2006-2015 Laurent Destailleur <eldy@users.sourceforge.net>
6 * Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
7 * Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
8 * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
9 * Copyright (C) 2021 Frédéric France <frederic.france@netlogic.fr>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 3 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program. If not, see <https://www.gnu.org/licenses/>.
23 */
24
32// Load Dolibarr environment
33require '../main.inc.php';
34require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
35require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
36
37// Load translation files required by the page
38$langs->loadLangs(array('companies', 'projects'));
39
40$action = GETPOST('action', 'aZ09');
41
42// Security check
43$socid = GETPOST('socid', 'int');
44if ($user->socid) {
45 $socid = $user->socid;
46}
47$result = restrictedArea($user, 'societe', $socid, '&societe');
48
49// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
50$hookmanager->initHooks(array('projectthirdparty'));
51
52$object = new Societe($db);
53
54
55/*
56 * Actions
57 */
58
59$parameters = array('id'=>$socid);
60$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
61if ($reshook < 0) {
62 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
63}
64
65
66
67/*
68 * View
69 */
70
71unset($_SESSION['pageforbacktolist']['project']);
72
73if ($socid) {
74 require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
75 require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
76
77 $langs->load("companies");
78
79 $result = $object->fetch($socid);
80
81 $title = $langs->trans("Projects");
82 if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) {
83 $title = $object->name." - ".$title;
84 }
85 llxHeader('', $title);
86
87 if (isModEnabled('notification')) {
88 $langs->load("mails");
89 }
90 $head = societe_prepare_head($object);
91
92 print dol_get_fiche_head($head, 'project', $langs->trans("ThirdParty"), -1, 'company');
93
94 $linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
95
96 dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom');
97
98 print '<div class="fichecenter">';
99
100 print '<div class="underbanner clearboth"></div>';
101 print '<table class="border centpercent tableforfield">';
102
103 // Type Prospect/Customer/Supplier
104 print '<tr><td class="titlefield">'.$langs->trans('NatureOfThirdParty').'</td><td>';
105 print $object->getTypeUrl(1);
106 print '</td></tr>';
107
108 if (!empty($conf->global->SOCIETE_USEPREFIX)) { // Old not used prefix field
109 print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>';
110 }
111
112 if ($object->client) {
113 print '<tr><td class="titlefield">';
114 print $langs->trans('CustomerCode').'</td><td colspan="3">';
115 print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_client));
116 $tmpcheck = $object->check_codeclient();
117 if ($tmpcheck != 0 && $tmpcheck != -5) {
118 print ' <span class="error">('.$langs->trans("WrongCustomerCode").')</span>';
119 }
120 print '</td></tr>';
121 }
122
123 if ($object->fournisseur) {
124 print '<tr><td class="titlefield">';
125 print $langs->trans('SupplierCode').'</td><td colspan="3">';
126 print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_fournisseur));
127 $tmpcheck = $object->check_codefournisseur();
128 if ($tmpcheck != 0 && $tmpcheck != -5) {
129 print ' <span class="error">('.$langs->trans("WrongSupplierCode").')</span>';
130 }
131 print '</td></tr>';
132 }
133
134 print '</table>';
135
136 print '</div>';
137
138 print dol_get_fiche_end();
139
140 $params = '';
141 $backtopage = $_SERVER['PHP_SELF'].'?socid='.$object->id;
142 $newcardbutton = dolGetButtonTitle($langs->trans("NewProject"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/projet/card.php?action=create&socid='.$object->id.'&backtopageforcancel='.urlencode($backtopage), '', 1, $params);
143
144 print '<br>';
145
146
147 // Projects list
148 $result = show_projects($conf, $langs, $db, $object, $_SERVER["PHP_SELF"].'?socid='.$object->id, 1, $newcardbutton);
149}
150
151// End of page
152llxFooter();
153$db->close();
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Definition wrapper.php:56
llxFooter()
Empty footer.
Definition wrapper.php:70
Class to manage third parties objects (customers, suppliers, prospects...)
show_projects($conf, $langs, $db, $object, $backtopage='', $nocreatelink=0, $morehtmlright='')
Show html area for list of projects.
societe_prepare_head(Societe $object)
Return array of tabs to used on pages for third parties cards.
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.
showValueWithClipboardCPButton($valuetocopy, $showonlyonhover=1, $texttoshow='')
Create a button to copy $valuetocopy in the clipboard (for copy and paste feature).
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.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
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.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
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.