本文整理汇总了PHP中Planning::checkAlreadyPlanned方法的典型用法代码示例。如果您正苦于以下问题:PHP Planning::checkAlreadyPlanned方法的具体用法?PHP Planning::checkAlreadyPlanned怎么用?PHP Planning::checkAlreadyPlanned使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Planning
的用法示例。
在下文中一共展示了Planning::checkAlreadyPlanned方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: post_updateItem
/**
* @see CommonDBTM::post_updateItem()
**/
function post_updateItem($history = 1)
{
if (isset($this->fields["begin"]) && !empty($this->fields["begin"])) {
Planning::checkAlreadyPlanned($this->fields["users_id"], $this->fields["begin"], $this->fields["end"], array('Reminder' => array($this->fields['id'])));
}
if (in_array("begin", $this->updates)) {
PlanningRecall::managePlanningUpdates($this->getType(), $this->getID(), $this->fields["begin"]);
}
}
示例2: post_addItem
function post_addItem()
{
global $CFG_GLPI;
if (isset($this->input['_planningrecall'])) {
$this->input['_planningrecall']['items_id'] = $this->fields['id'];
PlanningRecall::manageDatas($this->input['_planningrecall']);
}
$donotif = $CFG_GLPI["use_mailing"];
if (isset($this->fields["begin"]) && !empty($this->fields["begin"])) {
Planning::checkAlreadyPlanned($this->fields["users_id_tech"], $this->fields["begin"], $this->fields["end"], array($this->getType() => array($this->fields["id"])));
$calendars_id = Entity::getUsedConfig('calendars_id', $this->input["_job"]->fields['entities_id']);
$calendar = new Calendar();
// Using calendar
if ($calendars_id > 0 && $calendar->getFromDB($calendars_id)) {
if (!$calendar->isAWorkingHour(strtotime($this->fields["begin"]))) {
Session::addMessageAfterRedirect(__('Start of the selected timeframe is not a working hour.'), false, ERROR);
}
if (!$calendar->isAWorkingHour(strtotime($this->fields["end"]))) {
Session::addMessageAfterRedirect(__('End of the selected timeframe is not a working hour.'), false, ERROR);
}
}
}
$this->input["_job"]->updateDateMod($this->input[$this->input["_job"]->getForeignKeyField()]);
if (isset($this->input["actiontime"]) && $this->input["actiontime"] > 0) {
$this->input["_job"]->updateActionTime($this->input[$this->input["_job"]->getForeignKeyField()]);
}
//change status only if input change
if (isset($this->input['_status']) && $this->input['_status'] != $this->input['_job']->fields['status']) {
$update['status'] = $this->input['_status'];
$update['id'] = $this->input['_job']->fields['id'];
$update['_disablenotif'] = true;
$this->input['_job']->update($update);
}
if (!empty($this->fields['begin']) && $this->input["_job"]->isStatusExists(CommonITILObject::PLANNED) && ($this->input["_job"]->fields["status"] == CommonITILObject::INCOMING || $this->input["_job"]->fields["status"] == CommonITILObject::ASSIGNED)) {
$input2['id'] = $this->input["_job"]->getID();
$input2['status'] = CommonITILObject::PLANNED;
$input2['_disablenotif'] = true;
$this->input["_job"]->update($input2);
}
if ($donotif) {
$options = array('task_id' => $this->fields["id"], 'is_private' => $this->isPrivate());
NotificationEvent::raiseEvent('add_task', $this->input["_job"], $options);
}
// Add log entry in the ITIL object
$changes[0] = 0;
$changes[1] = '';
$changes[2] = $this->fields['id'];
Log::history($this->getField($this->input["_job"]->getForeignKeyField()), $this->input["_job"]->getTYpe(), $changes, $this->getType(), Log::HISTORY_ADD_SUBITEM);
}
示例3: post_addItem
function post_addItem()
{
global $CFG_GLPI;
if (isset($this->input['_planningrecall'])) {
$this->input['_planningrecall']['items_id'] = $this->fields['id'];
PlanningRecall::manageDatas($this->input['_planningrecall']);
}
$donotif = $CFG_GLPI["use_mailing"];
if (isset($this->fields["begin"]) && !empty($this->fields["begin"])) {
Planning::checkAlreadyPlanned($this->fields["users_id_tech"], $this->fields["begin"], $this->fields["end"], array($this->getType() => array($this->fields["id"])));
}
if (isset($this->input["_no_notif"]) && $this->input["_no_notif"]) {
$donotif = false;
}
$this->input["_job"]->updateDateMod($this->input[$this->input["_job"]->getForeignKeyField()]);
if (isset($this->input["actiontime"]) && $this->input["actiontime"] > 0) {
$this->input["_job"]->updateActionTime($this->input[$this->input["_job"]->getForeignKeyField()]);
}
if (!empty($this->fields['begin']) && ($this->input["_job"]->fields["status"] == CommonITILObject::INCOMING || $this->input["_job"]->fields["status"] == CommonITILObject::ASSIGNED)) {
$input2['id'] = $this->input["_job"]->getID();
$input2['status'] = CommonITILObject::PLANNED;
$input2['_disablenotif'] = true;
$this->input["_job"]->update($input2);
}
if ($donotif) {
$options = array('task_id' => $this->fields["id"], 'is_private' => $this->isPrivate());
NotificationEvent::raiseEvent('add_task', $this->input["_job"], $options);
}
// Add log entry in the ITIL object
$changes[0] = 0;
$changes[1] = '';
$changes[2] = $this->fields['id'];
Log::history($this->getField($this->input["_job"]->getForeignKeyField()), $this->input["_job"]->getTYpe(), $changes, $this->getType(), Log::HISTORY_ADD_SUBITEM);
}
示例4: prepareInputForUpdate
function prepareInputForUpdate($input)
{
global $CFG_GLPI;
$this->getFromDB($input["id"]);
// Save fields
$oldfields = $this->fields;
$this->fields["begin"] = $input["begin"];
$this->fields["end"] = $input["end"];
if (!$this->test_valid_date()) {
$this->displayError("date");
return false;
}
if (isset($fup->fields["users_id"])) {
Planning::checkAlreadyPlanned($fup->fields["users_id"], $input["begin"], $input["end"], array('PluginProjetTask' => array($input["id"])));
}
// Restore fields
$this->fields = $oldfields;
return $input;
}
示例5: post_updateItem
function post_updateItem($history = 1)
{
if ($this->fields["is_private"]) {
Planning::checkAlreadyPlanned($this->fields["users_id"], $this->fields["begin"], $this->fields["end"], array('Reminder' => array($this->fields['id'])));
}
}
示例6: prepareInputForAdd
function prepareInputForAdd($input)
{
if (!isset($input["begin"]) || !isset($input["end"])) {
return false;
}
// Needed for test already planned
$this->fields["users_id"] = $input["users_id"];
$this->fields["begin"] = $input["begin"];
$this->fields["end"] = $input["end"];
if (!$this->test_valid_date()) {
$this->displayError("date");
return false;
}
Planning::checkAlreadyPlanned($input["users_id"], $input["begin"], $input["end"]);
return $input;
}