You are not logged in.
Our use of GLPI consists of adding items then going back through and adding financial information. This takes quite a bit of time when large orders come in that need to be inventoried as we have to add all our items then go back through and find the newly created items in order to add the financial information.
I've been looking through the source and hacked together some of the parts of the feature but realized it would probably be better done by you guys. Basically:
./ajax/dropdownMassiveAction.php
Modified to add a "clone" option to the dropdown after searching for an item.
./inc/dropdown.function.php
Modified to allow the user to enter the number of copies of the item they'd wish to create from the item they've selected.
./front/massiveaction.php
Case "clone" added that outputs 'n' form(s) filled with the previously selected item's information. The problem here is that the views are all very linear. Solution to this problem was to redo all the views with redundant code that sends data for each form as a 2d array to PHP using a 4th argument specify which iteration needed to be specified.
e.g.
for ($i = 0; $i < $_POST["quantity"]; $i++)
$peripheral->showForm($_SERVER["PHP_SELF"], $ci->id_device, 1337, $i);
1337 tells the function to ignore GLPIs normal form output and use the form outputs I've written. $i is my quantity iterator which is used in creating the forms.
Last edited by Zipp (2011-02-01 19:03:03)
Offline
Meh, no responses. I'm just going to output the queries, see what a normal one looks like, rewrite the other forms to have 2d array-like post data, and just pass a formatted array to the add function
Offline
Coming along alright so far, but I really feel as though this is a "hack and slash" effort -- GLPI seems to be fighting me every step of the way in terms of working out similar solutions for computers, networks, software, etc.
Edit: Currently working out how to slipstream adding financial information to my forms. I believe it's a separate query, but I'll get to that as soon as I reverse the page that contains it
The forms create $_POST["postData"][$iterator]["ELEMENT"] - I just have to pass the post data to the add method and BOOM
for ($i = 0; $i < $_POST["quantity"]; $i++) {
// Sanity checking code goes HERE (makes sure all the elements needed by the add method are in the array being passed)
$whatever->add($_POST["postData"][$i]);
}
Last edited by Zipp (2011-02-01 18:55:44)
Offline
Status: Complete. Sort of. I can now clone items completely and add their financial information all on the same page, which is kinda cool and saves me time. The problem now? Because everything is split up, it's only been done for peripherals -- I need to figure out a more.. uhh.. pragmatic way to add this feature to every inventory type.
If anyone is paying attention to this thread, how does one go about contributing code to the project? Mailing list? The 'contribute' page is vague.
Offline
Hi,
Thank you for your interest in glpi-project.
You could send your patch to the dev mailing list.
JMD / Jean-Mathieu Doléans - Glpi-project.org - Association Indepnet
Apportez votre pierre au projet GLPI : Soutenir
Offline
Wicked. Once I get the feature working for any inventory type I'll submit it to you guys
Offline
Update for the fans I don't have:
Got the forms showing up for every standard object type (computer, peripheral, software, etc) but there's no way my code knows if someone's trying to clone a custom type (added via the generic object plugin or something) .. in order for this to be better done, I'm probably going to need to rewrite part of the add() methods to accept single or multi-dimensional arrays.. this would mean I wouldn't need two sets of forms. Then again, having two sets of forms means I can tweak things specifically for my needs, albeit I don't really need it -- I feel as though a templating engine could work wonders in a situation like this (instead of having html and php mixed, it would keep things more separate.. I guess more MVC-like. But that's not really within the scope of the GLPI project.)
Anyway, status is that I believe all I've left to do on the clone feature is rewrite the showForm() method for the standard object types to output forms that act as 2d arrays when 1337 is specified as the third argument and $iterator for the fourth.
Edit: turns out showForm() doesn't have a set argument list.. looks like I'll need a switch statement to call specific showForm functions based on their types >.> Kind of a pain, imo
Last edited by Zipp (2011-02-07 15:50:44)
Offline
Fan here...
I miss such a feature, as we do some things very special and that means a lot of manual work. Could you post your latest patchset or host it somewhere, so I might test it?
Offline
I'm a fan too - please continue and share!
Offline
Big fan of a "Clone" feature, too. Currently, we're re-entering all tickets which affect multiple computers so that we have a relationship to all computers. Ideally, I'd love both features
a) cloning tickets
and
b) linking multiple assets to a ticket
Offline
Greetings, When I'm on the display followed and I will add a new track the date and time are wrong, write me a day later and time is not just another system and I have not let me modificarla.Que misconfigured.
I use GLPI GLPI 0.83.7.
Thank you.
Emilio Perera.
Offline