本文整理汇总了PHP中TicketValidation::alreadyExists方法的典型用法代码示例。如果您正苦于以下问题:PHP TicketValidation::alreadyExists方法的具体用法?PHP TicketValidation::alreadyExists怎么用?PHP TicketValidation::alreadyExists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TicketValidation
的用法示例。
在下文中一共展示了TicketValidation::alreadyExists方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: manageValidationAdd
//.........这里部分代码省略.........
$users = Group_User::getGroupUsers($input['_groups_id_requester'], "is_manager='1'");
foreach ($users as $data) {
$validations_to_send[] = $data['id'];
}
}
// Add to already set groups
foreach ($this->getGroups(CommonITILActor::REQUESTER) as $d) {
$users = Group_User::getGroupUsers($d['groups_id'], "is_manager='1'");
foreach ($users as $data) {
$validations_to_send[] = $data['id'];
}
}
break;
case 'assign_supervisor':
if (isset($input['_groups_id_assign']) && $input['_groups_id_assign']) {
$users = Group_User::getGroupUsers($input['_groups_id_assign'], "is_manager='1'");
foreach ($users as $data) {
$validations_to_send[] = $data['id'];
}
}
foreach ($this->getGroups(CommonITILActor::ASSIGN) as $d) {
$users = Group_User::getGroupUsers($d['groups_id'], "is_manager='1'");
foreach ($users as $data) {
$validations_to_send[] = $data['id'];
}
}
break;
default:
// Group case from rules
if ($key === 'group') {
foreach ($validation as $groups_id) {
$validation_right = 'validate_incident';
if (isset($input['type']) && $input['type'] == Ticket::DEMAND_TYPE) {
$validation_right = 'validate_request';
}
$opt = array('groups_id' => $groups_id, 'right' => $validation_right, 'entity' => $entid);
$data_users = TicketValidation::getGroupUserHaveRights($opt);
foreach ($data_users as $user) {
$validations_to_send[] = $user['id'];
}
}
} else {
$validations_to_send[] = $validation;
}
}
}
// Validation user added on ticket form
if (isset($input['users_id_validate'])) {
if (array_key_exists('groups_id', $input['users_id_validate'])) {
foreach ($input['users_id_validate'] as $key => $validation_to_add) {
if (is_numeric($key)) {
$validations_to_send[] = $validation_to_add;
}
}
} else {
foreach ($input['users_id_validate'] as $key => $validation_to_add) {
if (is_numeric($key)) {
$validations_to_send[] = $validation_to_add;
}
}
}
}
// Keep only one
$validations_to_send = array_unique($validations_to_send);
$validation = new TicketValidation();
if (count($validations_to_send)) {
$values = array();
$values['tickets_id'] = $this->fields['id'];
if (isset($input['id']) && $input['id'] != $this->fields['id']) {
$values['_ticket_add'] = true;
}
// to know update by rules
if (isset($input["_rule_process"])) {
$values['_rule_process'] = $input["_rule_process"];
}
// if auto_import, tranfert it for validation
if (isset($input['_auto_import'])) {
$values['_auto_import'] = $input['_auto_import'];
}
// Cron or rule process of hability to do
if (Session::isCron() || isset($input["_auto_import"]) || isset($input["_rule_process"]) || $validation->can(-1, CREATE, $values)) {
// cron or allowed user
$add_done = false;
foreach ($validations_to_send as $user) {
// Do not auto add twice same validation
if (!TicketValidation::alreadyExists($values['tickets_id'], $user)) {
$values["users_id_validate"] = $user;
if ($validation->add($values)) {
$add_done = true;
}
}
}
if ($add_done) {
Event::log($this->fields['id'], "ticket", 4, "tracking", sprintf(__('%1$s updates the item %2$s'), $_SESSION["glpiname"], $this->fields['id']));
}
}
}
}
return true;
}