dolibarr 21.0.0-beta
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-2024 Frédéric France <frederic.france@free.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';
36require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
37require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
38
47$form = new Form($db);
48
49// Load translation files required by the page
50$langs->loadLangs(array('companies', 'projects'));
51
52$action = GETPOST('action', 'aZ09');
53$massaction = GETPOST('massaction', 'alpha');
54$confirm = GETPOST('confirm', 'alpha');
55
56$toselect = GETPOST('toselect', 'array');
57
58
59// Security check
60$socid = GETPOSTINT('socid');
61if ($user->socid) {
62 $socid = $user->socid;
63}
64
65// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
66$hookmanager->initHooks(array('projectthirdparty'));
67
68$result = restrictedArea($user, 'societe', $socid, '&societe');
69
70$object = new Societe($db);
71$permissiontodelete = $user->hasRight('societe', 'supprimer');
72
73
74
75/*
76 * Actions
77 */
78
79
80if (GETPOST('cancel', 'alpha')) {
81 $massaction = '';
82}
83if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
84 $massaction = '';
85 $massactionbutton = '';
86}
87
88
89$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
90if ($reshook < 0) {
91 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
92}
93
94$parameters = array('id'=>$socid);
95
96// List of mass actions available
97$arrayofmassactions = array();
98if (!empty($permissiontodelete)) {
99 $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
100}
101if (in_array($massaction, array('presend', 'predelete','preaffecttag'))) {
102 $arrayofmassactions = array();
103}
104
105if (GETPOSTINT('nomassaction') || in_array($massaction, array('presend', 'predelete', 'preaffecttag', 'preenable', 'preclose'))) {
106 $arrayofmassactions = array();
107}
108
109// Mass actions
110$objectclass = 'Project';
111$objectlabel = 'Project';
112$uploaddir = $conf->societe->dir_output;
113include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
114
115$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
116
117
118/*
119 * View
120 */
121
122unset($_SESSION['pageforbacktolist']['project']);
123if ($socid) {
124 require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
125 require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
126
127 $langs->load("companies");
128
129 $result = $object->fetch($socid);
130
131 $title = $langs->trans("Projects");
132 if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->name) {
133 $title = $object->name." - ".$title;
134 }
135 llxHeader('', $title);
136
138
139 print dol_get_fiche_head($head, 'project', $langs->trans("ThirdParty"), -1, 'company');
140
141 $linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
142
143 dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom');
144
145 print '<div class="fichecenter">';
146
147 print '<div class="underbanner clearboth"></div>';
148 print '<table class="border centpercent tableforfield">';
149
150
151 // Type Prospect/Customer/Supplier
152 print '<tr><td class="titlefield">'.$langs->trans('NatureOfThirdParty').'</td><td>';
153 print $object->getTypeUrl(1);
154 print '</td></tr>';
155
156 if (getDolGlobalString('SOCIETE_USEPREFIX')) { // Old not used prefix field
157 print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>';
158 }
159
160 if ($object->client) {
161 print '<tr><td class="titlefield">';
162 print $langs->trans('CustomerCode').'</td><td colspan="3">';
164 $tmpcheck = $object->check_codeclient();
165 if ($tmpcheck != 0 && $tmpcheck != -5) {
166 print ' <span class="error">('.$langs->trans("WrongCustomerCode").')</span>';
167 }
168 print '</td></tr>';
169 }
170
171 if ($object->fournisseur) {
172 print '<tr><td class="titlefield">';
173 print $langs->trans('SupplierCode').'</td><td colspan="3">';
175 $tmpcheck = $object->check_codefournisseur();
176 if ($tmpcheck != 0 && $tmpcheck != -5) {
177 print ' <span class="error">('.$langs->trans("WrongSupplierCode").')</span>';
178 }
179 print '</td></tr>';
180 }
181
182 print '</table>';
183 print '</div>';
184
185 print dol_get_fiche_end();
186
187 print '<br>';
188 $params = array();
189 $backtopage = $_SERVER['PHP_SELF'].'?socid='.$object->id;
190 $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);
191
192 if (empty($conf->dol_optimize_smallscreen)) {
193 print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'">';
194 print '<input type="hidden" name="token" value="'.newToken().'">';
195 print '<div class="nobordernopadding center valignmiddle col-center">'.$massactionbutton.'</div>';
196 }
197
198
199 // Projects list
200 include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
201 $arrayofselected = is_array($toselect) ? $toselect : array();
202 $result = show_projects($conf, $langs, $db, $object, $_SERVER["PHP_SELF"].'?socid='.$object->id, 1, $newcardbutton);
203
204 if (empty($conf->dol_optimize_smallscreen)) {
205 print '</form>';
206 }
207}
208
209// End of page
210llxFooter();
211$db->close();
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:66
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:71
Class to manage generation of HTML components Only common components must be here.
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.
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.
showValueWithClipboardCPButton($valuetocopy, $showonlyonhover=1, $texttoshow='')
Create a button to copy $valuetocopy in the clipboard (for copy and paste feature).
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.
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.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
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...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
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.