dolibarr 20.0.0
note.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
5 * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
6 * Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
28// Load Dolibarr environment
29require '../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php';
31require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
32if (isModEnabled('project')) {
33 require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
34}
35
36// Load translation files required by the page
37$langs->loadLangs(array('companies', 'bills', 'orders'));
38
39$id = GETPOSTINT('id');
40$ref = GETPOST('ref', 'alpha');
41$socid = GETPOSTINT('socid');
42$action = GETPOST('action', 'aZ09');
43
44// Security check
45$socid = 0;
46if ($user->socid) {
47 $socid = $user->socid;
48}
49
50// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
51$hookmanager->initHooks(array('ordernote'));
52
53$result = restrictedArea($user, 'commande', $id, '');
54
55$usercancreate = $user->hasRight("commande", "creer");
56
57$permissionnote = $user->hasRight('commande', 'creer'); // Used by the include of actions_setnotes.inc.php
58
59
60$object = new Commande($db);
61if (!$object->fetch($id, $ref) > 0) {
62 dol_print_error($db);
63 exit;
64}
65
66
67/*
68 * Actions
69 */
70
71$parameters = array();
72$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
73if ($reshook < 0) {
74 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
75}
76if (empty($reshook)) {
77 include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
78}
79
80
81/*
82 * View
83 */
84$title = $object->ref." - ".$langs->trans('Notes');
85$help_url = 'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes|DE:Modul_Kundenaufträge';
86llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-order page-card_notes');
87
88$form = new Form($db);
89
90if ($id > 0 || !empty($ref)) {
91 $object->fetch_thirdparty();
92
93 $head = commande_prepare_head($object);
94
95 print dol_get_fiche_head($head, 'note', $langs->trans("CustomerOrder"), -1, 'order');
96
97 // Order card
98
99 $linkback = '<a href="'.DOL_URL_ROOT.'/commande/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
100
101
102 $morehtmlref = '<div class="refidno">';
103 // Ref customer
104 $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
105 $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
106 // Thirdparty
107 $morehtmlref .= '<br>'.$object->thirdparty->getNomUrl(1);
108 // Project
109 if (isModEnabled('project')) {
110 $langs->load("projects");
111 $morehtmlref .= '<br>';
112 if (0) {
113 $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"');
114 if ($action != 'classify') {
115 $morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> ';
116 }
117 $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
118 } else {
119 if (!empty($object->fk_project)) {
120 $proj = new Project($db);
121 $proj->fetch($object->fk_project);
122 $morehtmlref .= $proj->getNomUrl(1);
123 if ($proj->title) {
124 $morehtmlref .= '<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).'</span>';
125 }
126 }
127 }
128 }
129 $morehtmlref .= '</div>';
130
131
132 dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
133
134
135 print '<div class="fichecenter">';
136 print '<div class="underbanner clearboth"></div>';
137
138
139 $cssclass = "titlefield";
140 include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
141
142 print '</div>';
143
144 print dol_get_fiche_end();
145}
146
147
148// End of page
149llxFooter();
150$db->close();
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:58
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Definition wrapper.php:55
llxFooter()
Empty footer.
Definition wrapper.php:69
Class to manage customers orders.
Class to manage generation of HTML components Only common components must be here.
Class to manage projects.
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.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
commande_prepare_head(Commande $object)
Prepare array with list of tabs.
Definition order.lib.php:34
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.