function moveItems($items, $to, $options)
{
global $CFG_GLPI;
// unset mailing
$CFG_GLPI["use_mailing"] = 0;
$this->options = array('keep_ticket' => 0, 'keep_networklink' => 0, 'keep_reservation' => 0, 'keep_history' => 0, 'keep_device' => 0, 'keep_infocom' => 0, 'keep_dc_monitor' => 0, 'clean_dc_monitor' => 0, 'keep_dc_phone' => 0, 'clean_dc_phone' => 0, 'keep_dc_peripheral' => 0, 'clean_dc_peripheral' => 0, 'keep_dc_printer' => 0, 'clean_dc_printer' => 0, 'keep_supplier' => 0, 'clean_supplier' => 0, 'keep_contact' => 0, 'clean_contact' => 0, 'keep_contract' => 0, 'clean_contract' => 0, 'keep_disk' => 0, 'keep_software' => 0, 'clean_software' => 0, 'keep_document' => 0, 'clean_document' => 0, 'keep_cartridgeitem' => 0, 'clean_cartridgeitem' => 0, 'keep_cartridge' => 0, 'keep_consumable' => 0);
if ($to >= 0) {
// Store to
$this->to = $to;
// Store options
if (is_array($options) && count($options)) {
foreach ($options as $key => $val) {
$this->options[$key] = $val;
}
}
// Simulate transfers To know which items need to be transfer
$this->simulateTransfer($items);
//Html::printCleanArray($this->needtobe_transfer);
// Software first (to avoid copy during computer transfer)
$this->inittype = 'Software';
if (isset($items['Software']) && count($items['Software'])) {
foreach ($items['Software'] as $ID) {
$this->transferItem('Software', $ID, $ID);
}
}
// Computer before all other items
$this->inittype = 'Computer';
if (isset($items['Computer']) && count($items['Computer'])) {
foreach ($items['Computer'] as $ID) {
$this->transferItem('Computer', $ID, $ID);
}
}
// Inventory Items : MONITOR....
$INVENTORY_TYPES = array('CartridgeItem', 'ConsumableItem', 'Monitor', 'NetworkEquipment', 'Peripheral', 'Phone', 'Printer', 'SoftwareLicense');
foreach ($INVENTORY_TYPES as $itemtype) {
$this->inittype = $itemtype;
if (isset($items[$itemtype]) && count($items[$itemtype])) {
foreach ($items[$itemtype] as $ID) {
$this->transferItem($itemtype, $ID, $ID);
}
}
}
// Clean unused
$this->cleanSoftwareVersions();
// Management Items
$MANAGEMENT_TYPES = array('Contact', 'Contract', 'Document', 'Supplier');
foreach ($MANAGEMENT_TYPES as $itemtype) {
$this->inittype = $itemtype;
if (isset($items[$itemtype]) && count($items[$itemtype])) {
foreach ($items[$itemtype] as $ID) {
$this->transferItem($itemtype, $ID, $ID);
}
}
}
// Tickets
$OTHER_TYPES = array('Group', 'Link', 'Ticket', 'Problem', 'Change');
foreach ($OTHER_TYPES as $itemtype) {
$this->inittype = $itemtype;
if (isset($items[$itemtype]) && count($items[$itemtype])) {
foreach ($items[$itemtype] as $ID) {
$this->transferItem($itemtype, $ID, $ID);
}
}
}
}
// $to >= 0
}