En Plugin078to080 » History » Version 2

Version 1 (ddurieux, 07/15/2011 10:12 AM) → Version 2/3 (Protux, 07/15/2011 01:47 PM)

h1. En Plugin078to080

*plugin_init_xxx*
Plugin::registerClass
'doc_types' => 'document_types'
'helpdesk_types' => 'ticket_types'
'netport_types' => 'networkport_types'
'planning_itemtype' => 'planning_types'

*LANG string deleted from core*
$LANG['help'][11]
$LANG['login'][16]
$LANG['login'][28]
$LANG['rulesengine'][42]
$LANG['rulesengine'][43]

Check lang string still exist in core

*Core's function countElementsInTable*
countElementsInTable("table1,table2","condition") => countElementsInTable(array("table1","table2"),"condition")

*Function getSearchOptions*
- Delete linkfields after controle
- if linkfield = '' => massiveaction = false
- for places use function Location::getSearchOptionsToAdd();

Field *realtime* replaced by *actiontime* (timestamp)

*fonction getID*
- function getId() from commonTreeDropdown is renamed into findID (for dropdowns).
- Creation of a new function getID() within commonDBTM to get the object's identifier

*Core's notification*
glpi_notificationtemplates's table now owns a new field
-> To add when there is a INSERT SQL

*New class for the migration usable in the plugins : Migration.class*
This class allows to simply the migration's procedure and to save times by regrouping the actions by table

<pre>
$migration = new Migration("n° version of the plugin");
$migration->displayMessage(Initilisation of the message displayed during the migration);
...
Somes actions of the migration
...
$migration->executeMigration();
</pre>

if you want to use the function addField followed by an complex UPDATE (the simple update can be handle by the addField), it must be done a $migration->migrationOneTable($table); between addField and the UPDATE.

*Edit of the redirection's hook(multiple redirections)*
//redirect
// Simple redirect : http://localhost/glpi/index.php?redirect=plugin_example_2 (ID 2 form)
// $PLUGIN_HOOKS['redirect_page']['example'] = 'example.form.php';
// Multiple redirect : http://localhost/glpi/index.php?redirect=plugin_example_one_2 (ID 2 of the form)
// Multiple redirect : http://localhost/glpi/index.php?redirect=plugin_example_two_2 (ID 2 of the form)
$PLUGIN_HOOKS['redirect_page']['example']['one'] = 'example.form.php';
$PLUGIN_HOOKS['redirect_page']['example']['two'] = 'example2.form.php';

*New hooks*
plugin_example_addDefaultJoin
plugin_example_addDefaultSelect
plugin_example_addDefaultWhere
plugin_example_addLeftJoin