You are not logged in.
Pages: 1
I'd like to announce a release of another plugin that we put to use developed by Ryan F. called "CLONE". Our users needed the ability to clone a device that acutally had data associated with it. The templates worked for new "types" - but not when you were wanting to replace a device with a new device - and keep all the other history. I guess it all came down to our asset management policy..
So - we created this little plugin tool. Just copy to your plugins directory, logout and back in, and it will be activated automatically. It can be found under the plugins tab of a device.
You can see some other plugins we are working on at: http://www.opensourcegov.net/projects - I hope that we can see these moved to core soon!
Again you can download at : http://www.opensourcegov.net/projects/glpi-clone/files
Your feedback and comments are appreciated. Thanks!
Matt
matt@opensourcegov.net
Matt Hoover
Open Source for Government
http://www.opensourcegov.net
Offline
Don't you think this plugin implement a duplicate feature of something already in the core : template ?
+
Dév. Fedora 29 - PHP 5.6/7.0/7.1/7.2/7.3/7.4 - MariaDB 10.3 - GLPI master
Certifié ITILv3 - RPM pour Fedora, RHEL et CentOS sur https://blog.remirepo.net/
Offline
Good question. From what i have seen template is good for things that have a set of common attributes. And we have used it...
The current version of CLONE takes the basics and clones the fields. The problem with template - why would you want to create templates you are going to only use 1 time? We have a lot of these 1 off situations - and our policy does not allow re-using records.
In the near future - CLONE will be able to copy more than just the basics - documents, contracts, relations, custom fields, etc....
Does any of this make sense? I may be way off on this... But we have not seen an easy way to copy things in these situations using template.
Matt
Matt Hoover
Open Source for Government
http://www.opensourcegov.net
Offline
Does any of this make sense?
yes it makes sense
I was thinking of something like this to deal with standard replacement (sorry I don't know the exact word in english. when a manufacturer replace for example a broken pc by a new one).
Offline
> Does any of this make sense?
Yes.
Looking at the code.
Why do you create an object as you could use the existing commonitem one.
$new_device = new plugin_clone($_POST['device_type']);
$newid = $new_device->add($data);
switch ($_POST['device_type']){
case COMPUTER_TYPE : $fn = 'computer'; break;
case NETWORKING_TYPE : $fn = 'networking'; break;
case PRINTER_TYPE : $fn = 'printer'; break;
case MONITOR_TYPE : $fn = 'monitor'; break;
case PERIPHERAL_TYPE : $fn = 'peripheral'; break;
case SOFTWARE_TYPE : $fn = 'software'; break;
case PHONE_TYPE : $fn = 'phone'; break;
}
Could be simpler :
$newid = $ci->obj->add($data);
$fn = $ci->getType();
Hope this help to improve your code and your knowledge of GLPI internals.
+
Dév. Fedora 29 - PHP 5.6/7.0/7.1/7.2/7.3/7.4 - MariaDB 10.3 - GLPI master
Certifié ITILv3 - RPM pour Fedora, RHEL et CentOS sur https://blog.remirepo.net/
Offline
Pages: 1