public function update($data)
 {
     global $wpdb;
     $entity = new Entity();
     $option = new Option();
     $dataEntity = ['id' => $data['id'], 'name' => $data['name'], 'activate' => $data['activate'], 'sm_entity_id' => $data['sm_entity_id']];
     $entity->update($dataEntity);
     $optionsEntity = ['idSource' => $data['id'], 'category' => $data['category'], 'publish_type' => $data['publish_type'], 'display_type' => $data['display_type'], 'link_canonical' => $data['link_canonical'], 'image' => $data['image'], 'noIndex' => $data['noIndex'], 'noFollow' => $data['noFollow'], 'readmore' => $data['readmore'], 'morebalise' => $data['morebalise']];
     $option->update($optionsEntity);
 }
Ejemplo n.º 2
0
 public function update($where_conditions, $set_parameters)
 {
     if (Settings::getOperativeMode() == 'debug') {
         echo '<br />method update EntityImage ';
         var_dump($set_parameters);
     }
     if (isset($set_parameters['file'])) {
         $set_parameters['filename'] = 'upload/' . $set_parameters['file']['name'];
         $set_parameters['filetype'] = $set_parameters['file']['type'];
         $set_parameters['size'] = $set_parameters['file']['size'];
     }
     return parent::update($where_conditions, $set_parameters);
 }
Ejemplo n.º 3
0
 /**
  * Cron for ticketsatisfaction's automatic generated
  *
  * @param $task : crontask object
  *
  * @return integer (0 : nothing done - 1 : done)
  **/
 static function cronCreateInquest($task)
 {
     global $DB;
     $conf = new Entity();
     $inquest = new TicketSatisfaction();
     $tot = 0;
     $maxentity = array();
     $tabentities = array();
     $rate = Entity::getUsedConfig('inquest_config', 0, 'inquest_rate');
     if ($rate > 0) {
         $tabentities[0] = $rate;
     }
     foreach ($DB->request('glpi_entities') as $entity) {
         $rate = Entity::getUsedConfig('inquest_config', $entity['id'], 'inquest_rate');
         $parent = Entity::getUsedConfig('inquest_config', $entity['id'], 'entities_id');
         if ($rate > 0) {
             $tabentities[$entity['id']] = $rate;
         }
     }
     foreach ($tabentities as $entity => $rate) {
         $parent = Entity::getUsedConfig('inquest_config', $entity, 'entities_id');
         $delay = Entity::getUsedConfig('inquest_config', $entity, 'inquest_delay');
         $duration = Entity::getUsedConfig('inquest_config', $entity, 'inquest_duration');
         $type = Entity::getUsedConfig('inquest_config', $entity);
         $max_closedate = Entity::getUsedConfig('inquest_config', $entity, 'max_closedate');
         $query = "SELECT `glpi_tickets`.`id`,\n                          `glpi_tickets`.`closedate`,\n                          `glpi_tickets`.`entities_id`\n                   FROM `glpi_tickets`\n                   LEFT JOIN `glpi_ticketsatisfactions`\n                       ON `glpi_ticketsatisfactions`.`tickets_id` = `glpi_tickets`.`id`\n                   LEFT JOIN `glpi_entities`\n                       ON `glpi_tickets`.`entities_id` = `glpi_entities`.`id`\n                   WHERE `glpi_tickets`.`entities_id` = '{$entity}'\n                         AND `glpi_tickets`.`is_deleted` = 0\n                         AND `glpi_tickets`.`status` = '" . self::CLOSED . "'\n                         AND `glpi_tickets`.`closedate` > '{$max_closedate}'\n                         AND ADDDATE(`glpi_tickets`.`closedate`, INTERVAL {$delay} DAY)<=NOW()\n                         AND ADDDATE(`glpi_entities`.`max_closedate`, INTERVAL {$duration} DAY)<=NOW()\n                         AND `glpi_ticketsatisfactions`.`id` IS NULL\n                   ORDER BY `closedate` ASC";
         $nb = 0;
         $max_closedate = '';
         foreach ($DB->request($query) as $tick) {
             $max_closedate = $tick['closedate'];
             if (mt_rand(1, 100) <= $rate) {
                 if ($inquest->add(array('tickets_id' => $tick['id'], 'date_begin' => $_SESSION["glpi_currenttime"], 'entities_id' => $tick['entities_id'], 'type' => $type))) {
                     $nb++;
                 }
             }
         }
         // conservation de toutes les max_closedate des entites filles
         if (!empty($max_closedate) && (!isset($maxentity[$parent]) || $max_closedate > $maxentity[$parent])) {
             $maxentity[$parent] = $max_closedate;
         }
         if ($nb) {
             $tot += $nb;
             $task->addVolume($nb);
             $task->log(sprintf(__('%1$s: %2$s'), Dropdown::getDropdownName('glpi_entities', $entity), $nb));
         }
     }
     // Sauvegarde du max_closedate pour ne pas tester les même tickets 2 fois
     foreach ($maxentity as $parent => $maxdate) {
         $conf->getFromDB($parent);
         $conf->update(array('id' => $conf->fields['id'], 'max_closedate' => $maxdate));
     }
     return $tot > 0;
 }
Ejemplo n.º 4
0
 public function update($where_conditions, $set_parameters)
 {
     $set_parameters["lastmod"] = date("d/m/y");
     $set_parameters["lastmod_time"] = date("H:i:s");
     return parent::update($where_conditions, $set_parameters);
 }