dolibarr  7.0.0-beta
info.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
3  * Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
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 <http://www.gnu.org/licenses/>.
17  */
18 
25 require ("../main.inc.php");
26 require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
27 require_once DOL_DOCUMENT_ROOT.'/core/lib/contract.lib.php';
28 require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
29 if (! empty($conf->projet->enabled)) {
30  require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
31 }
32 
33 $langs->load("contracts");
34 
35 $action = GETPOST('action','alpha');
36 $confirm = GETPOST('confirm','alpha');
37 $id = GETPOST('id','int');
38 $ref = GETPOST('ref','alpha');
39 
40 // Security check
41 if ($user->societe_id) $socid=$user->societe_id;
42 $result = restrictedArea($user, 'contrat', $id, '');
43 
44 
45 /*
46  * View
47  */
48 
49 $form = new Form($db);
50 
51 llxHeader('',$langs->trans("Contract"),"");
52 
53 $object = new Contrat($db);
54 $object->fetch($id, $ref);
55 if ($object->id > 0)
56 {
57  $object->fetch_thirdparty();
58 }
59 
60 $object->info($object->id);
61 
62 $head = contract_prepare_head($object);
63 
64 dol_fiche_head($head, 'info', $langs->trans("Contract"), -1, 'contract');
65 
66 
67 // Contract card
68 
69 $linkback = '<a href="'.DOL_URL_ROOT.'/contrat/list.php?restore_lastsearch_values=1'.(! empty($socid)?'&socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
70 
71 
72 $morehtmlref='';
73 //if (! empty($modCodeContract->code_auto)) {
74 $morehtmlref.=$object->ref;
75 /*} else {
76  $morehtmlref.=$form->editfieldkey("",'ref',$object->ref,0,'string','',0,3);
77 $morehtmlref.=$form->editfieldval("",'ref',$object->ref,0,'string','',0,2);
78 }*/
79 
80 $morehtmlref.='<div class="refidno">';
81 // Ref customer
82 $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, 0, 'string', '', 0, 1);
83 $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, 0, 'string', '', null, null, '', 1);
84 // Ref supplier
85 $morehtmlref.='<br>';
86 $morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1);
87 $morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1);
88 // Thirdparty
89 $morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
90 // Project
91 if (! empty($conf->projet->enabled))
92 {
93  $langs->load("projects");
94  $morehtmlref.='<br>'.$langs->trans('Project') . ' ';
95  if ($user->rights->contrat->creer)
96  {
97  if ($action != 'classify')
98  //$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
99  $morehtmlref.=' : ';
100  if ($action == 'classify') {
101  //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
102  $morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
103  $morehtmlref.='<input type="hidden" name="action" value="classin">';
104  $morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
105  $morehtmlref.=$formproject->select_projects($object->thirdparty->id, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
106  $morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
107  $morehtmlref.='</form>';
108  } else {
109  $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1);
110  }
111  } else {
112  if (! empty($object->fk_project)) {
113  $proj = new Project($db);
114  $proj->fetch($object->fk_project);
115  $morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
116  $morehtmlref.=$proj->ref;
117  $morehtmlref.='</a>';
118  } else {
119  $morehtmlref.='';
120  }
121  }
122 }
123 $morehtmlref.='</div>';
124 
125 
126 dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'none', $morehtmlref);
127 
128 
129 print '<div class="fichecenter">';
130 print '<div class="underbanner clearboth"></div>';
131 
132 print '<br>';
133 
134 print '<table width="100%"><tr><td>';
135 dol_print_object_info($object);
136 print '</td></tr></table>';
137 
138 print '</div>';
139 
140 dol_fiche_end();
141 
142 
143 llxFooter();
144 $db->close();
llxFooter()
Empty footer.
Definition: wrapper.php:58
dol_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='')
Show tab header 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.
dol_print_object_info($object, $usetable=0)
Show informations on an object TODO Move this into html.formother.
Class to manage contracts.
contract_prepare_head(Contrat $object)
Prepare array with list of tabs.
if(empty($reshook)) $form
View.
Definition: perms.php:103
GETPOST($paramname, $check='none', $method=0, $filter=NULL, $options=NULL, $noreplace=0)
Return value of a param into GET or POST supervariable.
Class to manage generation of HTML components Only common components must be here.
Class to manage projects.
dol_fiche_end($notab=0)
Show tab footer of a card.
llxHeader()
Empty header.
Definition: wrapper.php:46
print
Draft customers invoices.
Definition: index.php:91
restrictedArea($user, $features, $objectid=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $objcanvas=null)
Check permissions of a user to show a page and an object.