1 | <?php |
||||
2 | |||||
3 | /* Copyright (C) 2004 Rodolphe Quiedeville <[email protected]> |
||||
4 | * Copyright (C) 2004-2008 Laurent Destailleur <[email protected]> |
||||
5 | * Copyright (C) 2005-2012 Regis Houssin <[email protected]> |
||||
6 | * Copyright (C) 2013 Florian Henry <[email protected]> |
||||
7 | * Copyright (C) 2024 Rafael San José <[email protected]> |
||||
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 | |||||
23 | use Dolibarr\Code\Comm\Classes\Propal; |
||||
24 | use Dolibarr\Code\Commande\Classes\Commande; |
||||
25 | use Dolibarr\Code\Core\Classes\Form; |
||||
26 | use Dolibarr\Code\Expedition\Classes\Expedition; |
||||
27 | use Dolibarr\Code\Projet\Classes\Project; |
||||
28 | use Dolibarr\Lib\ViewMain; |
||||
29 | |||||
30 | /** |
||||
31 | * \file htdocs/expedition/note.php |
||||
32 | * \ingroup expedition |
||||
33 | * \brief Note card expedition |
||||
34 | */ |
||||
35 | |||||
36 | // Load Dolibarr environment |
||||
37 | require constant('DOL_DOCUMENT_ROOT') . '/main.inc.php'; |
||||
38 | require_once constant('DOL_DOCUMENT_ROOT') . '/core/lib/sendings.lib.php'; |
||||
39 | |||||
40 | // Load translation files required by the page |
||||
41 | $langs->loadLangs(array('sendings', 'companies', 'bills', 'deliveries', 'orders', 'stocks', 'other', 'propal')); |
||||
42 | |||||
43 | $id = (GETPOSTINT('id') ? GETPOSTINT('id') : GETPOSTINT('facid')); // For backward compatibility |
||||
44 | $ref = GETPOST('ref', 'alpha'); |
||||
45 | $action = GETPOST('action', 'aZ09'); |
||||
46 | |||||
47 | $object = new Expedition($db); |
||||
48 | if ($id > 0 || !empty($ref)) { |
||||
49 | $object->fetch($id, $ref); |
||||
50 | $object->fetch_thirdparty(); |
||||
51 | |||||
52 | if (!empty($object->origin)) { |
||||
0 ignored issues
–
show
|
|||||
53 | $typeobject = $object->origin; |
||||
0 ignored issues
–
show
The property
Dolibarr\Core\Base\CommonObject::$origin has been deprecated: Use $origin_type and $origin_id instead.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This property has been deprecated. The supplier of the class has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead. ![]() |
|||||
54 | $origin = $object->origin; |
||||
0 ignored issues
–
show
The property
Dolibarr\Core\Base\CommonObject::$origin has been deprecated: Use $origin_type and $origin_id instead.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This property has been deprecated. The supplier of the class has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead. ![]() |
|||||
55 | $object->fetch_origin(); |
||||
56 | } |
||||
57 | |||||
58 | // Linked documents |
||||
59 | if ($typeobject == 'commande' && $object->origin_object->id && isModEnabled('order')) { |
||||
60 | $objectsrc = new Commande($db); |
||||
61 | $objectsrc->fetch($object->origin_object->id); |
||||
62 | } |
||||
63 | if ($typeobject == 'propal' && $object->origin_object->id && isModEnabled("propal")) { |
||||
64 | $objectsrc = new Propal($db); |
||||
65 | $objectsrc->fetch($object->origin_object->id); |
||||
66 | } |
||||
67 | |||||
68 | $upload_dir = $conf->expedition->dir_output . "/sending/" . dol_sanitizeFileName($object->ref); |
||||
69 | } |
||||
70 | |||||
71 | $permissionnote = $user->hasRight('expedition', 'creer'); // Used by the include of actions_setnotes.inc.php |
||||
72 | |||||
73 | // Security check |
||||
74 | if ($user->socid) { |
||||
75 | $socid = $user->socid; |
||||
76 | } |
||||
77 | |||||
78 | $hookmanager->initHooks(array('expeditionnote')); |
||||
79 | $result = restrictedArea($user, 'expedition', $object->id, ''); |
||||
80 | |||||
81 | |||||
82 | /* |
||||
83 | * Actions |
||||
84 | */ |
||||
85 | |||||
86 | $reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks |
||||
87 | if ($reshook < 0) { |
||||
88 | setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
||||
89 | } |
||||
90 | if (empty($reshook)) { |
||||
91 | include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php'; // Must be include, not include_once |
||||
92 | } |
||||
93 | |||||
94 | |||||
95 | /* |
||||
96 | * View |
||||
97 | */ |
||||
98 | |||||
99 | ViewMain::llxHeader(); |
||||
100 | |||||
101 | $form = new Form($db); |
||||
102 | |||||
103 | if ($id > 0 || !empty($ref)) { |
||||
104 | $head = shipping_prepare_head($object); |
||||
105 | print dol_get_fiche_head($head, 'note', $langs->trans("Shipment"), -1, $object->picto); |
||||
106 | |||||
107 | |||||
108 | // Shipment card |
||||
109 | $linkback = '<a href="' . constant('BASE_URL') . 'expedition/list.php?restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>'; |
||||
110 | |||||
111 | $morehtmlref = '<div class="refidno">'; |
||||
112 | // Ref customer shipment |
||||
113 | $morehtmlref .= $form->editfieldkey("RefCustomer", '', $object->ref_customer, $object, $user->hasRight('expedition', 'creer'), 'string', '', 0, 1); |
||||
114 | $morehtmlref .= $form->editfieldval("RefCustomer", '', $object->ref_customer, $object, $user->hasRight('expedition', 'creer'), 'string', '', null, null, '', 1); |
||||
115 | // Thirdparty |
||||
116 | $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
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. ![]() |
|||||
117 | // Project |
||||
118 | if (isModEnabled('project')) { |
||||
119 | $langs->load("projects"); |
||||
120 | $morehtmlref .= '<br>'; |
||||
121 | if (0) { // Do not change on shipment |
||||
122 | $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); |
||||
123 | if ($action != 'classify') { |
||||
124 | $morehtmlref .= '<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&token=' . newToken() . '&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> '; |
||||
125 | } |
||||
126 | $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $objectsrc->socid, $objectsrc->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); |
||||
127 | } else { |
||||
128 | if (!empty($objectsrc) && !empty($objectsrc->fk_project)) { |
||||
129 | $proj = new Project($db); |
||||
130 | $proj->fetch($objectsrc->fk_project); |
||||
131 | $morehtmlref .= $proj->getNomUrl(1); |
||||
132 | if ($proj->title) { |
||||
133 | $morehtmlref .= '<span class="opacitymedium"> - ' . dol_escape_htmltag($proj->title) . '</span>'; |
||||
134 | } |
||||
135 | } |
||||
136 | } |
||||
137 | } |
||||
138 | $morehtmlref .= '</div>'; |
||||
139 | |||||
140 | |||||
141 | dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); |
||||
142 | |||||
143 | |||||
144 | print '<div class="underbanner clearboth"></div>'; |
||||
145 | |||||
146 | $cssclass = 'titlefield'; |
||||
147 | include DOL_DOCUMENT_ROOT . '/core/tpl/notes.tpl.php'; |
||||
148 | |||||
149 | print dol_get_fiche_end(); |
||||
150 | } |
||||
151 | |||||
152 | // End of page |
||||
153 | ViewMain::llxFooter(); |
||||
154 | $db->close(); |
||||
155 |
This property has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.