Issues (2811)

public/htdocs/commande/note.php (1 issue)

Labels
Severity
1
<?php
2
3
/* Copyright (C) 2004       Rodolphe Quiedeville        <[email protected]>
4
 * Copyright (C) 2004-2016  Laurent Destailleur         <[email protected]>
5
 * Copyright (C) 2005-2012  Regis Houssin               <[email protected]>
6
 * Copyright (C) 2013       Florian Henry		        <[email protected]>
7
 * Copyright (C) 2017       Ferran Marcet       	    <[email protected]>
8
 * Copyright (C) 2024       Rafael San José             <[email protected]>
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
24
use Dolibarr\Code\Commande\Classes\Commande;
25
use Dolibarr\Code\Core\Classes\Form;
26
use Dolibarr\Code\Projet\Classes\Project;
27
use Dolibarr\Lib\ViewMain;
28
29
/**
30
 *  \file       htdocs/commande/note.php
31
 *  \ingroup    order
32
 *  \brief      Fiche de notes sur une commande
33
 */
34
35
// Load Dolibarr environment
36
require constant('DOL_DOCUMENT_ROOT') . '/main.inc.php';
37
require_once constant('DOL_DOCUMENT_ROOT') . '/core/lib/order.lib.php';
38
39
// Load translation files required by the page
40
$langs->loadLangs(array('companies', 'bills', 'orders'));
41
42
$id = GETPOSTINT('id');
43
$ref = GETPOST('ref', 'alpha');
44
$socid = GETPOSTINT('socid');
45
$action = GETPOST('action', 'aZ09');
46
47
// Security check
48
$socid = 0;
49
if ($user->socid) {
50
    $socid = $user->socid;
51
}
52
53
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
54
$hookmanager->initHooks(array('ordernote'));
55
56
$result = restrictedArea($user, 'commande', $id, '');
57
58
$usercancreate = $user->hasRight("commande", "creer");
59
60
$permissionnote = $user->hasRight('commande', 'creer'); // Used by the include of actions_setnotes.inc.php
61
62
$object = new Commande($db);
63
if (!$object->fetch($id, $ref) > 0) {
64
    dol_print_error($db);
65
    exit;
66
}
67
68
/*
69
 * Actions
70
 */
71
72
$parameters = array();
73
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
74
if ($reshook < 0) {
75
    setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
76
}
77
if (empty($reshook)) {
78
    include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php'; // Must be include, not include_once
79
}
80
81
82
/*
83
 * View
84
 */
85
$title = $object->ref . " - " . $langs->trans('Notes');
86
$help_url = 'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes|DE:Modul_Kundenaufträge';
87
ViewMain::llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-order page-card_notes');
88
89
$form = new Form($db);
90
91
if ($id > 0 || !empty($ref)) {
92
    $object->fetch_thirdparty();
93
94
    $head = commande_prepare_head($object);
95
96
    print dol_get_fiche_head($head, 'note', $langs->trans("CustomerOrder"), -1, 'order');
97
98
    // Order card
99
100
    $linkback = '<a href="' . constant('BASE_URL') . 'commande/list.php?restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
101
102
103
    $morehtmlref = '<div class="refidno">';
104
    // Ref customer
105
    $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
106
    $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
107
    // Thirdparty
108
    $morehtmlref .= '<br>' . $object->thirdparty->getNomUrl(1);
0 ignored issues
show
The method getNomUrl() does not exist on null. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

108
    $morehtmlref .= '<br>' . $object->thirdparty->/** @scrutinizer ignore-call */ getNomUrl(1);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
109
    // Project
110
    if (isModEnabled('project')) {
111
        $langs->load("projects");
112
        $morehtmlref .= '<br>';
113
        if (0) {
114
            $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"');
115
            if ($action != 'classify') {
116
                $morehtmlref .= '<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&token=' . newToken() . '&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> ';
117
            }
118
            $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
119
        } else {
120
            if (!empty($object->fk_project)) {
121
                $proj = new Project($db);
122
                $proj->fetch($object->fk_project);
123
                $morehtmlref .= $proj->getNomUrl(1);
124
                if ($proj->title) {
125
                    $morehtmlref .= '<span class="opacitymedium"> - ' . dol_escape_htmltag($proj->title) . '</span>';
126
                }
127
            }
128
        }
129
    }
130
    $morehtmlref .= '</div>';
131
132
133
    dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
134
135
136
    print '<div class="fichecenter">';
137
    print '<div class="underbanner clearboth"></div>';
138
139
140
    $cssclass = "titlefield";
141
    include DOL_DOCUMENT_ROOT . '/core/tpl/notes.tpl.php';
142
143
    print '</div>';
144
145
    print dol_get_fiche_end();
146
}
147
148
149
// End of page
150
ViewMain::llxFooter();
151
$db->close();
152