static function queryBadgesWhichExpire()
 {
     $config = new PluginBadgesConfig();
     $notif = new PluginBadgesNotificationState();
     $config->getFromDB('1');
     $delay = $config->fields["delay_whichexpire"];
     $query = "SELECT *\n         FROM `glpi_plugin_badges_badges`\n         WHERE `date_expiration` IS NOT NULL\n         AND `is_deleted` = '0'\n         AND DATEDIFF(CURDATE(),`date_expiration`) > -{$delay} \n         AND DATEDIFF(CURDATE(),`date_expiration`) < 0 ";
     $query .= "AND `states_id` NOT IN (999999";
     $query .= $notif->findStates();
     $query .= ") ";
     return $query;
 }
Пример #2
0
 static function queryBadgesReturnExpire()
 {
     $config = new PluginBadgesConfig();
     $notif = new PluginBadgesNotificationState();
     $config->getFromDB('1');
     $delay = $config->fields["delay_returnexpire"];
     $query = null;
     if (!empty($delay)) {
         $query = "SELECT *\n            FROM `glpi_plugin_badges_requests`\n            LEFT JOIN `glpi_plugin_badges_badges`\n               ON (`glpi_plugin_badges_requests`.`badges_id` = `glpi_plugin_badges_badges`.`id`)\n            WHERE `glpi_plugin_badges_requests`.`affectation_date` IS NOT NULL\n            AND `glpi_plugin_badges_requests`.`is_affected` = '1'\n            AND TIME_TO_SEC(TIMEDIFF(NOW(),`glpi_plugin_badges_requests`.`affectation_date`)) > {$delay} ";
         $query .= "AND `glpi_plugin_badges_badges`.`states_id` NOT IN (999999";
         $query .= $notif->findStates();
         $query .= ") ";
     }
     return $query;
 }