Skip to content
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]
## [unreleased] -

### Fixed

- Fix injection to the `date_expiration` of certificates
- Fix the `Task completed` message during plugin update

## [2.14.3] - 2025-09-16
Expand Down
5 changes: 5 additions & 0 deletions inc/applianceinjection.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ public function connectedTo()
return [];
}

public function isNullable($field)
{
return true; // By default, all fields can be null
}

/**
* @see plugins/datainjection/inc/PluginDatainjectionInjectionInterface::getOptions()
**/
Expand Down
5 changes: 5 additions & 0 deletions inc/autoupdatesysteminjection.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ public function connectedTo()
return [];
}

public function isNullable($field)
{
return true; // By default, all fields can be null
}


public function getOptions($primary_type = '')
{
Expand Down
5 changes: 5 additions & 0 deletions inc/budgetinjection.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ public function connectedTo()
return [];
}

public function isNullable($field)
{
return true; // By default, all fields can be null
}


/**
* @see plugins/datainjection/inc/PluginDatainjectionInjectionInterface::getOptions()
Expand Down
5 changes: 5 additions & 0 deletions inc/cartridgeiteminjection.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ public function connectedTo()
return [];
}

public function isNullable($field)
{
return true; // By default, all fields can be null
}


/**
* @see plugins/datainjection/inc/PluginDatainjectionInjectionInterface::getOptions()
Expand Down
8 changes: 8 additions & 0 deletions inc/certificateinjection.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ public function connectedTo()
return [];
}

public function isNullable($field)
{
return true; // By default, all fields can be null
}

/**
* @see plugins/datainjection/inc/PluginDatainjectionInjectionInterface::getOptions()
**/
Expand All @@ -70,6 +75,9 @@ public function getOptions($primary_type = '')
"bool" => [9, 86]
];

// Add date check type to Expiration date Search Option
$tab[10]['checktype'] = 'date';

return PluginDatainjectionCommonInjectionLib::addToSearchOptions($tab, $options, $this);
}

Expand Down
5 changes: 2 additions & 3 deletions inc/commoninjectionlib.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -930,10 +930,10 @@ private function setValueForItemtype($itemtype, $field, $value, $fromdb = false)
if ($itemtype === User::class && $field === "pdffont" && $fromdb) {
return;
}
$injectionClass = self::getInjectionClassInstance($itemtype);
// TODO awfull hack, text ftom CSV set more than once, so check if "another" value
if (isset($this->values[$itemtype][$field]) && $this->values[$itemtype][$field] != $value) {
// Data set twice (probably CSV + Additional info)
$injectionClass = self::getInjectionClassInstance($itemtype);
$option = self::findSearchOption($injectionClass->getOptions($itemtype), $field);

if (isset($option['displaytype']) && $option['displaytype'] == 'multiline_text') {
Expand All @@ -955,7 +955,7 @@ private function setValueForItemtype($itemtype, $field, $value, $fromdb = false)
}
} else { // First value
if (empty($value)) {
if (isForeignKeyField($field) || (strpos($field, 'is_') !== false)) {
if (isForeignKeyField($field) || (strpos($field, 'is_') !== false) || (method_exists($injectionClass, 'isNullable') && !$injectionClass->isNullable($field))) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than testing if the function exists, it should be added to the PluginDataInjectionInjectionInterface. This way, it can benefit all other injection classes that might need it at some point in the future.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In PluginDataInjectionInjectionInterface, you need to add:

public function isNullable($field);
Suggested change
if (isForeignKeyField($field) || (strpos($field, 'is_') !== false) || (method_exists($injectionClass, 'isNullable') && !$injectionClass->isNullable($field))) {
if (isForeignKeyField($field) || (strpos($field, 'is_') !== false) || !$injectionClass->isNullable($field)) {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UP @Lainow

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding isNullable to the interface causes an error for injection files created by field.

// If the field is an id, we set it to 0
$this->values[$itemtype][$field] = self::DROPDOWN_EMPTY_VALUE;
} else {
Expand Down Expand Up @@ -1596,7 +1596,6 @@ public function processAddOrUpdate()

foreach ($this->values as $itemtype => $data) {
//Do not process primary_type

if ($itemtype != get_class($item)) {
$injectionClass = self::getInjectionClassInstance($itemtype);
$item = new $itemtype();
Expand Down
5 changes: 5 additions & 0 deletions inc/computer_iteminjection.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ public function connectedTo()
return $CFG_GLPI["directconnect_types"];
}

public function isNullable($field)
{
return true; // By default, all fields can be null
}


/**
* @see plugins/datainjection/inc/PluginDatainjectionInjectionInterface::getOptions()
Expand Down
5 changes: 5 additions & 0 deletions inc/computerinjection.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ public function connectedTo()
return [];
}

public function isNullable($field)
{
return true; // By default, all fields can be null
}


/**
* @see plugins/datainjection/inc/PluginDatainjectionInjectionInterface::getOptions()
Expand Down
5 changes: 5 additions & 0 deletions inc/computermodelinjection.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ public function connectedTo()
return [];
}

public function isNullable($field)
{
return true; // By default, all fields can be null
}


/**
* @see plugins/datainjection/inc/PluginDatainjectionInjectionInterface::getOptions()
Expand Down
5 changes: 5 additions & 0 deletions inc/computertypeinjection.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ public static function getTable($classname = null)
return $parenttype::getTable();
}

public function isNullable($field)
{
return true; // By default, all fields can be null
}


/**
* @see plugins/datainjection/inc/PluginDatainjectionInjectionInterface::getOptions()
Expand Down
5 changes: 5 additions & 0 deletions inc/consumableiteminjection.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ public function connectedTo()
return [];
}

public function isNullable($field)
{
return true; // By default, all fields can be null
}


/**
* @see plugins/datainjection/inc/PluginDatainjectionInjectionInterface::getOptions()
Expand Down
5 changes: 5 additions & 0 deletions inc/contact_supplierinjection.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ public function connectedTo()
return ['Contact', 'Supplier'];
}

public function isNullable($field)
{
return true; // By default, all fields can be null
}


/**
* @see plugins/datainjection/inc/PluginDatainjectionInjectionInterface::getOptions()
Expand Down
5 changes: 5 additions & 0 deletions inc/contactinjection.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ public function connectedTo()
return ['Supplier'];
}

public function isNullable($field)
{
return true; // By default, all fields can be null
}


/**
* @see plugins/datainjection/inc/PluginDatainjectionInjectionInterface::getOptions()
Expand Down
5 changes: 5 additions & 0 deletions inc/contacttypeinjection.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ public function connectedTo()
return [];
}

public function isNullable($field)
{
return true; // By default, all fields can be null
}


/**
* @see plugins/datainjection/inc/PluginDatainjectionInjectionInterface::getOptions()
Expand Down
5 changes: 5 additions & 0 deletions inc/contract_iteminjection.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ public function connectedTo()
return $CFG_GLPI["contract_types"];
}

public function isNullable($field)
{
return true; // By default, all fields can be null
}


/**
* @see plugins/datainjection/inc/PluginDatainjectionInjectionInterface::getOptions()
Expand Down
5 changes: 5 additions & 0 deletions inc/contract_supplierinjection.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ public function connectedTo()
return [];
}

public function isNullable($field)
{
return true; // By default, all fields can be null
}


/**
* @see plugins/datainjection/inc/PluginDatainjectionInjectionInterface::getOptions()
Expand Down
5 changes: 5 additions & 0 deletions inc/contractinjection.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ public function connectedTo()
return [];
}

public function isNullable($field)
{
return true; // By default, all fields can be null
}


/**
* @see plugins/datainjection/inc/PluginDatainjectionInjectionInterface::getOptions()
Expand Down
5 changes: 5 additions & 0 deletions inc/contracttypeinjection.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ public function connectedTo()
return [];
}

public function isNullable($field)
{
return true; // By default, all fields can be null
}


/**
* @see plugins/datainjection/inc/PluginDatainjectionInjectionInterface::getOptions()
Expand Down
5 changes: 5 additions & 0 deletions inc/databaseinjection.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ public function connectedTo()
return [];
}

public function isNullable($field)
{
return true; // By default, all fields can be null
}


/**
* @see plugins/datainjection/inc/PluginDatainjectionInjectionInterface::getOptions()
Expand Down
5 changes: 5 additions & 0 deletions inc/databaseinstanceinjection.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ public function connectedTo()
return $CFG_GLPI["databaseinstance_types"];
}

public function isNullable($field)
{
return true; // By default, all fields can be null
}


/**
* @see plugins/datainjection/inc/PluginDatainjectionInjectionInterface::getOptions()
Expand Down
5 changes: 5 additions & 0 deletions inc/devicecaseinjection.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ public function connectedTo()
return ["Computer"];
}

public function isNullable($field)
{
return true; // By default, all fields can be null
}


/**
* @see plugins/datainjection/inc/PluginDatainjectionInjectionInterface::getOptions()
Expand Down
5 changes: 5 additions & 0 deletions inc/devicecasetypeinjection.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ public function connectedTo()
return [];
}

public function isNullable($field)
{
return true; // By default, all fields can be null
}


/**
* @see plugins/datainjection/inc/PluginDatainjectionInjectionInterface::getOptions()
Expand Down
5 changes: 5 additions & 0 deletions inc/devicecontrolinjection.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ public function connectedTo()
return ["Computer"];
}

public function isNullable($field)
{
return true; // By default, all fields can be null
}


/**
* @see plugins/datainjection/inc/PluginDatainjectionInjectionInterface::getOptions()
Expand Down
5 changes: 5 additions & 0 deletions inc/devicedriveinjection.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ public function connectedTo()
return ["Computer"];
}

public function isNullable($field)
{
return true; // By default, all fields can be null
}


/**
* @see plugins/datainjection/inc/PluginDatainjectionInjectionInterface::getOptions()
Expand Down
5 changes: 5 additions & 0 deletions inc/deviceecasetypeinjection.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ public function connectedTo()
return [];
}

public function isNullable($field)
{
return true; // By default, all fields can be null
}


/**
* @see plugins/datainjection/inc/PluginDatainjectionInjectionInterface::getOptions()
Expand Down
5 changes: 5 additions & 0 deletions inc/deviceharddriveinjection.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ public function connectedTo()
return $CFG_GLPI['itemdeviceharddrive_types'];
}

public function isNullable($field)
{
return true; // By default, all fields can be null
}


/**
* @see plugins/datainjection/inc/PluginDatainjectionInjectionInterface::getOptions()
Expand Down
5 changes: 5 additions & 0 deletions inc/devicememoryinjection.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ public function connectedTo()
return $CFG_GLPI['itemdevicememory_types'];
}

public function isNullable($field)
{
return true; // By default, all fields can be null
}


/**
* @see plugins/datainjection/inc/PluginDatainjectionInjectionInterface::getOptions()
Expand Down
5 changes: 5 additions & 0 deletions inc/devicememorytypeinjection.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ public function connectedTo()
return [];
}

public function isNullable($field)
{
return true; // By default, all fields can be null
}


/**
* @see plugins/datainjection/inc/PluginDatainjectionInjectionInterface::getOptions()
Expand Down
5 changes: 5 additions & 0 deletions inc/devicemotherboardinjection.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ public function connectedTo()
return $CFG_GLPI['itemdevicemotherboard_types'];
}

public function isNullable($field)
{
return true; // By default, all fields can be null
}


/**
* @see plugins/datainjection/inc/PluginDatainjectionInjectionInterface::getOptions()
Expand Down
5 changes: 5 additions & 0 deletions inc/devicenetworkcardinjection.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ public function connectedTo()
return ["Computer"];
}

public function isNullable($field)
{
return true; // By default, all fields can be null
}


/**
* @see plugins/datainjection/inc/PluginDatainjectionInjectionInterface::getOptions()
Expand Down
Loading