本文整理汇总了PHP中CommonDBChild::prepareInputForUpdate方法的典型用法代码示例。如果您正苦于以下问题:PHP CommonDBChild::prepareInputForUpdate方法的具体用法?PHP CommonDBChild::prepareInputForUpdate怎么用?PHP CommonDBChild::prepareInputForUpdate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CommonDBChild
的用法示例。
在下文中一共展示了CommonDBChild::prepareInputForUpdate方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepareInputForUpdate
/**
* @see CommonDBTM::prepareInputForUpdate()
**/
function prepareInputForUpdate($input)
{
if (empty($input['end_date']) || $input['end_date'] == 'NULL' || $input['end_date'] < $input['begin_date']) {
$input['end_date'] = $input['begin_date'];
}
return parent::prepareInputForUpdate($input);
}
示例2: prepareInputForUpdate
/**
* @see CommonDBChild::prepareInputForUpdate()
**/
function prepareInputForUpdate($input)
{
// TODO: Check because I replaced creation of a cloned infocom by $this
if (isset($input['warranty_duration'])) {
$input['_warranty_duration'] = $this->fields['warranty_duration'];
}
//Check if one or more dates needs to be updated
foreach (self::getAutoManagemendDatesFields() as $key => $field) {
$result = Entity::getUsedConfig($key, $this->fields['entities_id']);
//Only update date if it's empty in DB. Otherwise do nothing
if ($result > 0 && !isset($this->fields[$field])) {
self::autofillDates($input, $field, $result);
}
}
return parent::prepareInputForUpdate($input);
}
示例3: prepareInputForUpdate
function prepareInputForUpdate($input)
{
$job = new Ticket();
$forbid_fields = array();
if ($this->fields["users_id_validate"] == Session::getLoginUserID()) {
if ($input["status"] == "rejected" && (!isset($input["comment_validation"]) || $input["comment_validation"] == '')) {
Session::addMessageAfterRedirect(__('If approval is denied, specify a reason.'), false, ERROR);
return false;
}
if ($input["status"] == "waiting") {
// $input["comment_validation"] = '';
$input["validation_date"] = 'NULL';
} else {
$input["validation_date"] = $_SESSION["glpi_currenttime"];
}
$forbid_fields = array('entities_id', 'users_id', 'tickets_id', 'users_id_validate', 'comment_submission', 'submission_date');
} else {
if (Session::haveRight('create_incident_validation', 1) || Session::haveRight('create_request_validation', 1)) {
// Update validation request
$forbid_fields = array('entities_id', 'tickets_id', 'status', 'comment_validation', 'validation_date');
}
}
if (count($forbid_fields)) {
foreach ($forbid_fields as $key => $val) {
if (isset($input[$key])) {
unset($input[$key]);
}
}
}
return parent::prepareInputForUpdate($input);
}
示例4: prepareInputForUpdate
/**
* @see CommonDBChild::prepareInputForUpdate()
**/
function prepareInputForUpdate($input)
{
return parent::prepareInputForUpdate($this->prepareInput($input));
}
示例5: prepareInputForUpdate
function prepareInputForUpdate($input)
{
return parent::prepareInputForUpdate(self::cleanContentHtml($input));
}
示例6: prepareInputForUpdate
/**
* @see CommonDBChild::prepareInputForUpdate()
**/
function prepareInputForUpdate($input)
{
$item = 0;
if (isset($input['_item'])) {
$item = $_POST['_item'];
}
// Save fields
$oldfields = $this->fields;
// Needed for test already planned
if (isset($input["begin"])) {
$this->fields["begin"] = $input["begin"];
}
if (isset($input["end"])) {
$this->fields["end"] = $input["end"];
}
if (!$this->test_valid_date()) {
$this->displayError("date", $item);
return false;
}
if ($this->is_reserved()) {
$this->displayError("is_res", $item);
return false;
}
// Restore fields
$this->fields = $oldfields;
return parent::prepareInputForUpdate($input);
}
示例7: prepareInputForUpdate
/**
* @see CommonDBChild::prepareInputForUpdate()
**/
function prepareInputForUpdate($input)
{
//Check if one or more dates needs to be updated
foreach (self::getAutoManagemendDatesFields() as $key => $field) {
$result = Entity::getUsedConfig($key, $this->fields['entities_id']);
//Only update date if it's empty in DB. Otherwise do nothing
if ($result > 0 && !isset($this->fields[$field])) {
self::autofillDates($input, $field, $result);
}
}
return parent::prepareInputForUpdate($input);
}
示例8: prepareInputForUpdate
function prepareInputForUpdate($input)
{
$forbid_fields = array();
if ($this->fields["users_id_validate"] == Session::getLoginUserID()) {
if ($input["status"] == self::REFUSED && (!isset($input["comment_validation"]) || $input["comment_validation"] == '')) {
Session::addMessageAfterRedirect(__('If approval is denied, specify a reason.'), false, ERROR);
return false;
}
if ($input["status"] == self::WAITING) {
// $input["comment_validation"] = '';
$input["validation_date"] = 'NULL';
} else {
$input["validation_date"] = $_SESSION["glpi_currenttime"];
}
$forbid_fields = array('entities_id', 'users_id', static::$items_id, 'users_id_validate', 'comment_submission', 'submission_date', 'is_recursive');
} else {
if (Session::haveRightsOr(static::$rightname, $this->getCreateRights())) {
// Update validation request
$forbid_fields = array('entities_id', static::$items_id, 'status', 'comment_validation', 'validation_date', 'is_recursive');
}
}
if (count($forbid_fields)) {
foreach ($forbid_fields as $key => $val) {
if (isset($input[$key])) {
unset($input[$key]);
}
}
}
return parent::prepareInputForUpdate($input);
}