dolibarr  13.0.2
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  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program. If not, see <https://www.gnu.org/licenses/>.
22  */
23 
30 require '../main.inc.php';
31 require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
32 require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
33 
34 $langs->loadLangs(array("companies", "projects"));
35 
36 // Security check
37 $socid = GETPOST('socid', 'int');
38 if ($user->socid) $socid = $user->socid;
39 $result = restrictedArea($user, 'societe', $socid, '&societe');
40 
41 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
42 $hookmanager->initHooks(array('projectthirdparty'));
43 
44 
45 /*
46  * Actions
47  */
48 
49 $parameters = array('id'=>$socid);
50 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
51 if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
52 
53 
54 
55 /*
56  * View
57  */
58 
59 $contactstatic = new Contact($db);
60 
61 $form = new Form($db);
62 
63 if ($socid)
64 {
65  require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
66  require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
67 
68  $langs->load("companies");
69 
70 
71  $object = new Societe($db);
72  $result = $object->fetch($socid);
73 
74  $title = $langs->trans("Projects");
75  if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) $title = $object->name." - ".$title;
76  llxHeader('', $title);
77 
78  if (!empty($conf->notification->enabled)) $langs->load("mails");
79  $head = societe_prepare_head($object);
80 
81  print dol_get_fiche_head($head, 'project', $langs->trans("ThirdParty"), -1, 'company');
82 
83  $linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
84 
85  dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom');
86 
87  print '<div class="fichecenter">';
88 
89  print '<div class="underbanner clearboth"></div>';
90  print '<table class="border centpercent tableforfield">';
91 
92  if (!empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
93  {
94  print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>';
95  }
96 
97  if ($object->client)
98  {
99  print '<tr><td class="titlefield">';
100  print $langs->trans('CustomerCode').'</td><td colspan="3">';
101  print $object->code_client;
102  $tmpcheck = $object->check_codeclient();
103  if ($tmpcheck != 0 && $tmpcheck != -5) {
104  print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
105  }
106  print '</td></tr>';
107  }
108 
109  if ($object->fournisseur)
110  {
111  print '<tr><td class="titlefield">';
112  print $langs->trans('SupplierCode').'</td><td colspan="3">';
113  print $object->code_fournisseur;
114  $tmpcheck = $object->check_codefournisseur();
115  if ($tmpcheck != 0 && $tmpcheck != -5) {
116  print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
117  }
118  print '</td></tr>';
119  }
120 
121  print '</table>';
122 
123  print '</div>';
124 
126 
127  $params = '';
128 
129  $newcardbutton .= dolGetButtonTitle($langs->trans("NewProject"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/projet/card.php?action=create&socid='.$object->id.'&amp;backtopage='.urlencode($backtopage), '', 1, $params);
130 
131  print '<br>';
132 
133 
134  // Projects list
135  $result = show_projects($conf, $langs, $db, $object, $_SERVER["PHP_SELF"].'?socid='.$object->id, 1, $newcardbutton);
136 }
137 
138 // End of page
139 llxFooter();
140 $db->close();
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 contact/addresses.
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.
llxHeader()
Empty header.
Definition: wrapper.php:45
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
Class to manage generation of HTML components Only common components must be here.
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.
societe_prepare_head(Societe $object)
Return array of tabs to used on pages for third parties cards.
Definition: company.lib.php:42
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.
Definition: index.php:89
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.
show_projects($conf, $langs, $db, $object, $backtopage= '', $nocreatelink=0, $morehtmlright= '')
Show html area for list of projects.
llxFooter()
Empty footer.
Definition: wrapper.php:59