dolibarr  13.0.2
note.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
5  * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <https://www.gnu.org/licenses/>.
19  */
20 
27 require '../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.'/reception/class/reception.class.php';
29 require_once DOL_DOCUMENT_ROOT.'/core/lib/reception.lib.php';
30 dol_include_once('/fourn/class/fournisseur.commande.class.php');
31 if (!empty($conf->projet->enabled)) {
32  require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
33  require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
34 }
35 
36 $langs->load("receptions");
37 $langs->load("companies");
38 $langs->load("bills");
39 $langs->load('deliveries');
40 $langs->load('orders');
41 $langs->load('stocks');
42 $langs->load('other');
43 $langs->load('propal');
44 
45 $id = (GETPOST('id', 'int') ?GETPOST('id', 'int') : GETPOST('facid', 'int')); // For backward compatibility
46 $ref = GETPOST('ref', 'alpha');
47 $action = GETPOST('action', 'aZ09');
48 
49 // Security check
50 $socid = '';
51 if ($user->socid) $socid = $user->socid;
52 $result = restrictedArea($user, $origin, $origin_id);
53 
54 $object = new Reception($db);
55 if ($id > 0 || !empty($ref))
56 {
57  $object->fetch($id, $ref);
58  $object->fetch_thirdparty();
59 
60  if (!empty($object->origin))
61  {
62  $typeobject = $object->origin;
63  $origin = $object->origin;
64  $object->fetch_origin();
65  }
66 
67  // Linked documents
68  if ($typeobject == 'commande' && $object->$typeobject->id && !empty($conf->commande->enabled))
69  {
70  $objectsrc = new Commande($db);
71  $objectsrc->fetch($object->$typeobject->id);
72  }
73  if ($typeobject == 'propal' && $object->$typeobject->id && !empty($conf->propal->enabled))
74  {
75  $objectsrc = new Propal($db);
76  $objectsrc->fetch($object->$typeobject->id);
77  }
78 }
79 
80 $permissionnote = $user->rights->reception->creer; // Used by the include of actions_setnotes.inc.php
81 
82 
83 /*
84  * Actions
85  */
86 
87 include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once
88 
89 
90 /*
91  * View
92  */
93 
94 llxHeader('', 'Reception');
95 
96 $form = new Form($db);
97 
98 if ($id > 0 || !empty($ref))
99 {
100  $head = reception_prepare_head($object);
101  print dol_get_fiche_head($head, 'note', $langs->trans("Reception"), -1, 'dollyrevert');
102 
103 
104  // Reception card
105  $linkback = '<a href="'.DOL_URL_ROOT.'/reception/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
106 
107  $morehtmlref = '<div class="refidno">';
108  // Ref customer reception
109  $morehtmlref .= $form->editfieldkey("RefSupplier", '', $object->ref_supplier, $object, $user->rights->reception->creer, 'string', '', 0, 1);
110  $morehtmlref .= $form->editfieldval("RefSupplier", '', $object->ref_supplier, $object, $user->rights->reception->creer, 'string', '', null, null, '', 1);
111  // Thirdparty
112  $morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1);
113  // Project
114  if (!empty($conf->projet->enabled)) {
115  $langs->load("projects");
116  $morehtmlref .= '<br>'.$langs->trans('Project').' ';
117  if (0) { // Do not change on reception
118  if ($action != 'classify') {
119  $morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : ';
120  }
121  if ($action == 'classify') {
122  // $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
123  $morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
124  $morehtmlref .= '<input type="hidden" name="action" value="classin">';
125  $morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
126  $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
127  $morehtmlref .= '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
128  $morehtmlref .= '</form>';
129  } else {
130  $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
131  }
132  } else {
133  // We don't have project on reception, so we will use the project or source object instead
134  // TODO Add project on reception
135  $morehtmlref .= ' : ';
136  if (!empty($objectsrc->fk_project)) {
137  $proj = new Project($db);
138  $proj->fetch($objectsrc->fk_project);
139  $morehtmlref .= '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$objectsrc->fk_project.'" title="'.$langs->trans('ShowProject').'">';
140  $morehtmlref .= $proj->ref;
141  $morehtmlref .= '</a>';
142  } else {
143  $morehtmlref .= '';
144  }
145  }
146  }
147  $morehtmlref .= '</div>';
148 
149  $object->picto = 'sending';
150  dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
151 
152 
153  print '<div class="underbanner clearboth"></div>';
154 
155  $cssclass = 'titlefield';
156  include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
157 
159 }
160 
161 
162 llxFooter();
163 
164 $db->close();
if(!function_exists('dol_getprefix')) dol_include_once($relpath, $classname= '')
Make an include_once using default root and alternate root if it fails.
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
img_edit($titlealt= 'default', $float=0, $other= '')
Show logo editer/modifier fiche.
llxHeader()
Empty header.
Definition: wrapper.php:45
Class to manage generation of HTML components Only common components must be here.
Class to manage projects.
Class to manage receptions.
Class to manage customers orders.
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.
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.
reception_prepare_head(Reception $object)
Prepare array with list of tabs.
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.
llxFooter()
Empty footer.
Definition: wrapper.php:59
Class to manage proposals.