CommonITILObject::updateDateMod PHP Метод

updateDateMod() публичный Метод

Update date mod of the ITIL object
public updateDateMod ( $ID, $no_stat_computation = false, $users_id_lastupdater )
$ID integer ID of the ITIL object
$no_stat_computation boolean do not cumpute take into account stat (false by default)
$users_id_lastupdater integer to force last_update id (default 0 = not used)
    function updateDateMod($ID, $no_stat_computation = false, $users_id_lastupdater = 0)
    {
        global $DB;
        if ($this->getFromDB($ID)) {
            // Force date mod and lastupdater
            $query = "UPDATE `" . $this->getTable() . "`\n                   SET `date_mod` = '" . $_SESSION["glpi_currenttime"] . "'";
            // set last updater if interactive user
            if (!Session::isCron()) {
                $query .= ", `users_id_lastupdater` = '" . Session::getLoginUserID() . "' ";
            } else {
                if ($users_id_lastupdater > 0) {
                    $query .= ", `users_id_lastupdater` = '{$users_id_lastupdater}' ";
                }
            }
            $query .= "WHERE `id` = '{$ID}'";
            $DB->query($query);
        }
    }

Usage Example

Пример #1
0
 /**
  * Update date mod of the ticket
  *
  * @since version 0.83.3 new proto
  *
  * @param $ID                           ID of the ticket
  * @param $no_stat_computation  boolean do not cumpute take into account stat (false by default)
  * @param $users_id_lastupdater integer to force last_update id (default 0 = not used)
  **/
 function updateDateMod($ID, $no_stat_computation = false, $users_id_lastupdater = 0)
 {
     global $DB;
     if ($this->getFromDB($ID)) {
         if (!$no_stat_computation && (Session::haveRight('task', CommonITILTask::ADDALLITEM) || Session::haveRightsOr('followup', array(TicketFollowup::ADDALLTICKET, TicketFollowup::ADDMYTICKET, TicketFollowup::ADDGROUPTICKET)) || $this->isUser(CommonITILActor::ASSIGN, Session::getLoginUserID()) || isset($_SESSION["glpigroups"]) && $this->haveAGroup(CommonITILActor::ASSIGN, $_SESSION['glpigroups']) || isCommandLine())) {
             if ($this->fields['takeintoaccount_delay_stat'] == 0) {
                 return $this->update(array('id' => $ID, 'takeintoaccount_delay_stat' => $this->computeTakeIntoAccountDelayStat(), '_disablenotif' => true));
             }
         }
         parent::updateDateMod($ID, $no_stat_computation, $users_id_lastupdater);
     }
 }
All Usage Examples Of CommonITILObject::updateDateMod
CommonITILObject