Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
GLPI
glpi
Commits
5a6b0707
Commit
5a6b0707
authored
Nov 25, 2021
by
Cédric Anne
Committed by
Johan Cwiklinski
Nov 26, 2021
Browse files
Fix computer model pictures saving
parent
71c932cc
Changes
1
Hide whitespace changes
Inline
Side-by-side
inc/commondcmodeldropdown.class.php
View file @
5a6b0707
...
...
@@ -34,8 +34,11 @@ if (!defined('GLPI_ROOT')) {
die
(
"Sorry. You can't access this file directly"
);
}
use
Glpi\Features\AssetImage
;
/// CommonDCModelDropdown class - dropdown for datacenter items models
abstract
class
CommonDCModelDropdown
extends
CommonDropdown
{
use
AssetImage
;
public
$additional_fields_for_dictionnary
=
[
'manufacturer'
];
...
...
@@ -218,46 +221,6 @@ abstract class CommonDCModelDropdown extends CommonDropdown {
Toolbox
::
deletePicture
(
$this
->
fields
[
'picture_rear'
]);
}
/**
* Add/remove front and rear pictures for models
* @param array $input the form input
* @return array the altered input
*/
function
managePictures
(
$input
)
{
foreach
([
'picture_front'
,
'picture_rear'
]
as
$name
)
{
if
(
isset
(
$input
[
"_blank_
$name
"
])
&&
$input
[
"_blank_
$name
"
])
{
$input
[
$name
]
=
''
;
if
(
array_key_exists
(
$name
,
$this
->
fields
))
{
Toolbox
::
deletePicture
(
$this
->
fields
[
$name
]);
}
}
if
(
isset
(
$input
[
"_
$name
"
]))
{
$filename
=
array_shift
(
$input
[
"_
$name
"
]);
$src
=
GLPI_TMP_DIR
.
'/'
.
$filename
;
$prefix
=
''
;
if
(
isset
(
$input
[
"_prefix_
$name
"
]))
{
$prefix
=
array_shift
(
$input
[
"_prefix_
$name
"
]);
}
if
(
$dest
=
Toolbox
::
savePicture
(
$src
,
$prefix
))
{
$input
[
$name
]
=
$dest
;
}
else
{
Session
::
addMessageAfterRedirect
(
__
(
'Unable to save picture file.'
),
true
,
ERROR
);
}
if
(
array_key_exists
(
$name
,
$this
->
fields
))
{
Toolbox
::
deletePicture
(
$this
->
fields
[
$name
]);
}
}
}
return
$input
;
}
function
displaySpecificTypeField
(
$ID
,
$field
=
[],
array
$options
=
[])
{
switch
(
$field
[
'type'
])
{
case
'depth'
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment