You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2009-04-07 07:48:34

matthoov
Member
From: Oregon, USA
Registered: 2009-02-09
Posts: 9
Website

Clone Device plugin

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.. smile

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

#2 2009-04-07 08:07:00

remi
GLPI-DEV
From: Champagne
Registered: 2007-04-28
Posts: 7,127
Website

Re: Clone Device plugin

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

#3 2009-04-07 08:57:58

matthoov
Member
From: Oregon, USA
Registered: 2009-02-09
Posts: 9
Website

Re: Clone Device plugin

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

#4 2009-04-08 09:26:32

wawa
GLPI-DEV
From: Montpellier / France
Registered: 2006-07-03
Posts: 6,019
Website

Re: Clone Device plugin

matthoov wrote:

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

#5 2009-04-08 10:33:50

remi
GLPI-DEV
From: Champagne
Registered: 2007-04-28
Posts: 7,127
Website

Re: Clone Device plugin

> 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

Board footer

Powered by FluxBB