dolibarr 24.0.0-beta
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 * Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
7 * Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
29// Load Dolibarr environment
30require '../main.inc.php';
31require_once DOL_DOCUMENT_ROOT.'/reception/class/reception.class.php';
32require_once DOL_DOCUMENT_ROOT.'/core/lib/reception.lib.php';
33if (isModEnabled('project')) {
34 require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
35 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
36}
37require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
38require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.dispatch.class.php';
39
48$langs->loadLangs(array("receptions", "companies", "bills", 'orders', 'stocks', 'other', 'propal'));
49
50$id = (GETPOSTINT('id') ? GETPOSTINT('id') : GETPOSTINT('facid')); // For backward compatibility
51$ref = GETPOST('ref', 'alpha');
52$action = GETPOST('action', 'aZ09');
53
54$morejs = '';
55
56$origin = '';
57$object = new Reception($db);
58if ($id > 0 || !empty($ref)) {
59 $object->fetch($id, $ref);
60 $object->fetch_thirdparty();
61
62 if (!empty($object->origin)) {
63 $origin = (string) $object->origin;
64 $typeobject = $object->origin;
65
66 $object->fetch_origin();
67 }
68
69 // Linked documents
70 if ($origin == 'order_supplier' && $object->origin_object->id && isModEnabled("supplier_order")) {
71 $objectsrc = new CommandeFournisseur($db);
72 $objectsrc->fetch($object->origin_object->id);
73 }
74}
75
76// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
77$hookmanager->initHooks(array('receptionnote'));
78
79// Security check
80if ($user->socid > 0) {
81 $socid = $user->socid;
82}
83
84if (isModEnabled("reception")) {
85 $permissiontoread = $user->hasRight('reception', 'lire');
86 $permissiontoadd = $user->hasRight('reception', 'creer');
87 $permissiondellink = $user->hasRight('reception', 'creer'); // Used by the include of actions_dellink.inc.php
88 $permissiontovalidate = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('reception', 'creer')) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('reception', 'reception_advance', 'validate')));
89 $permissiontodelete = $user->hasRight('reception', 'supprimer');
90} else {
91 $permissiontoread = $user->hasRight('fournisseur', 'commande', 'receptionner');
92 $permissiontoadd = $user->hasRight('fournisseur', 'commande', 'receptionner');
93 $permissiondellink = $user->hasRight('fournisseur', 'commande', 'receptionner'); // Used by the include of actions_dellink.inc.php
94 $permissiontovalidate = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('fournisseur', 'commande', 'receptionner')) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('fournisseur', 'commande_advance', 'check')));
95 $permissiontodelete = $user->hasRight('fournisseur', 'commande', 'receptionner');
96}
97$permissionnote = $user->hasRight('reception', 'creer'); // Used by the include of actions_setnotes.inc.php
98
99// TODO Test on reception module on only
100if (isModEnabled("reception") || $origin == 'reception' || empty($origin)) {
101 $result = restrictedArea($user, 'reception', $object->id);
102} else {
103 if ($origin == 'supplierorder' || $origin == 'order_supplier') {
104 $result = restrictedArea($user, 'fournisseur', $object->origin_id, 'commande_fournisseur', 'commande');
105 } elseif (!$user->hasRight($origin, 'lire') && !$user->hasRight($origin, 'read')) {
107 }
108}
109
110
111/*
112 * Actions
113 */
114
115$parameters = array();
116$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
117if ($reshook < 0) {
118 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
119}
120if (empty($reshook)) {
121 include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be 'include', not 'include_once'
122}
123
124
125/*
126 * View
127 */
128
129llxHeader('', $langs->trans('Reception'), '', '', 0, 0, $morejs, '', '', 'mod-reception page-card_notes');
130
131$form = new Form($db);
132
133if ($id > 0 || !empty($ref)) {
134 $head = reception_prepare_head($object);
135 print dol_get_fiche_head($head, 'note', $langs->trans("Reception"), -1, 'dollyrevert');
136
137
138 // Reception card
139 $linkback = '<a href="'.DOL_URL_ROOT.'/reception/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
140
141 $morehtmlref = '<div class="refidno">';
142 // Ref customer reception
143 $morehtmlref .= $form->editfieldkey("RefSupplier", '', $object->ref_supplier, $object, $user->hasRight('reception', 'creer'), 'string', '', 0, 1);
144 $morehtmlref .= $form->editfieldval("RefSupplier", '', $object->ref_supplier, $object, $user->hasRight('reception', 'creer'), 'string', '', null, null, '', 1);
145 // Thirdparty
146 $morehtmlref .= '<br>'.$object->thirdparty->getNomUrl(1);
147 // Project
148 if (isModEnabled('project')) {
149 $langs->load("projects");
150 $morehtmlref .= '<br>';
151 if (0) { // @phpstan-ignore-line Do not change on reception
152 $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"');
153 if ($action != 'classify' && $permissiontoadd) {
154 $morehtmlref .= '<a class="editfielda" href="'.dolBuildUrl($_SERVER['PHP_SELF'], ['action' => 'classify', 'id' => $object->id], true).'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> ';
155 }
156 $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (!getDolGlobalString('PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS') ? $object->socid : -1), (string) $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
157 } else {
158 if (!empty($objectsrc) && !empty($objectsrc->fk_project)) {
159 $proj = new Project($db);
160 $proj->fetch($objectsrc->fk_project);
161 $morehtmlref .= $proj->getNomUrl(1);
162 if ($proj->title) {
163 $morehtmlref .= '<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).'</span>';
164 }
165 }
166 }
167 }
168 $morehtmlref .= '</div>';
169
170 dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
171
172
173 print '<div class="underbanner clearboth"></div>';
174
175 $cssclass = 'titlefield';
176 include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
177
178 print dol_get_fiche_end();
179}
180
181
182llxFooter();
183
184$db->close();
$id
Support class for third parties, contacts, members, users or resources.
Definition account.php:47
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
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:73
Class to manage predefined suppliers products.
Class to manage generation of HTML components Only common components must be here.
Class to manage projects.
Class to manage receptions.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
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, $morecssdiv='')
Show tabs of a record.
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.
isModEnabled($module)
Is Dolibarr module enabled.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
buildzip.php
reception_prepare_head(Reception $object)
Prepare array with list of tabs.
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.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.