/**
* Delete a list of softwares
*
* @param $soft_ids array containing replay software need to be dustbined
**/
function putOldSoftsInTrash(array $soft_ids)
{
global $DB;
if (count($soft_ids) > 0) {
$ids = implode("','", $soft_ids);
//Try to delete all the software that are not used anymore
// (which means that don't have version associated anymore)
$res_countsoftinstall = $DB->query("SELECT `glpi_softwares`.`id`,\n COUNT(`glpi_softwareversions`.`softwares_id`) AS `cpt`\n FROM `glpi_softwares`\n LEFT JOIN `glpi_softwareversions`\n ON `glpi_softwareversions`.`softwares_id` = `glpi_softwares`.`id`\n WHERE `glpi_softwares`.`id` IN ('{$ids}')\n AND `is_deleted` = '0'\n GROUP BY `glpi_softwares`.`id`\n HAVING `cpt` = '0'\n ORDER BY `cpt`");
$software = new Software();
while ($soft = $DB->fetch_assoc($res_countsoftinstall)) {
$software->putInTrash($soft["id"], __('Software deleted by GLPI dictionary rules'));
}
}
}