Skip to content

Commit

Permalink
Fix direct query
Browse files Browse the repository at this point in the history
  • Loading branch information
trasher committed Oct 27, 2023
1 parent 883f59d commit eb441c7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
12 changes: 8 additions & 4 deletions inc/deploypackage_profile.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,15 @@ public static function getProfiles($deploypackages_id)
global $DB;

$prof = [];
$query = "SELECT `glpi_plugin_glpiinventory_deploypackages_profiles`.*
FROM `glpi_plugin_glpiinventory_deploypackages_profiles`
WHERE `plugin_glpiinventory_deploypackages_id` = '$deploypackages_id'";

foreach ($DB->request($query) as $data) {
$iterator = $DB->request([
'FROM' => 'glpi_plugin_glpiinventory_deploypackages_profiles',
'WHERE' => [
'plugin_glpiinventory_deploypackages_id' => $deploypackages_id
]
]);

foreach ($iterator as $data) {
$prof[$data['profiles_id']][] = $data;
}
return $prof;
Expand Down
10 changes: 6 additions & 4 deletions tests/Integration/Tasks/CronTaskTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -705,10 +705,12 @@ public function cleanTasksAndJobs()
//Prepare the task
PluginGlpiinventoryTask::cronTaskscheduler();

//Set the first job as successfull
$query = "SELECT DISTINCT `plugin_glpiinventory_taskjobstates_id`
FROM glpi_plugin_glpiinventory_taskjoblogs LIMIT 1";
foreach ($DB->request($query) as $data) {
//Set the first job as successfull
$iterator = $DB->request([
'FROM' => 'glpi_plugin_glpiinventory_taskjoblogs',
'LIMIT' => 1
]);
foreach ($iterator as $data) {
$pfTaskJobstate->changeStatusFinish($data['plugin_glpiinventory_taskjobstates_id'], 0, '');
}

Expand Down

0 comments on commit eb441c7

Please sign in to comment.