Start harmonization with GLPI framework
changed version to 3.3.0
This commit is contained in:
401
hook.php
401
hook.php
@@ -102,404 +102,19 @@ function plugin_processmaker_MassiveActionsProcess($data) {
|
||||
function plugin_processmaker_install() {
|
||||
global $DB;
|
||||
|
||||
if (arTableExists("glpi_plugin_processmaker_config")) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_config`
|
||||
ADD COLUMN `date_mod` DATETIME NULL DEFAULT NULL AFTER `pm_theme`,
|
||||
ADD COLUMN `comment` TEXT NULL AFTER `date_mod`;
|
||||
RENAME TABLE `glpi_plugin_processmaker_config` TO `glpi_plugin_processmaker_configs`;";
|
||||
$DB->query($query) or die("error creating glpi_plugin_processmaker_configs" . $DB->error());
|
||||
} else if (!arTableExists("glpi_plugin_processmaker_configs")) {
|
||||
$query = " CREATE TABLE `glpi_plugin_processmaker_configs` (
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`name` VARCHAR(50) NOT NULL DEFAULT 'ProcessMaker',
|
||||
`pm_server_URL` VARCHAR(250) NOT NULL DEFAULT 'http://localhost/',
|
||||
`pm_workspace` VARCHAR(50) NOT NULL DEFAULT 'workflow',
|
||||
`pm_admin_user` VARCHAR(255) NULL DEFAULT NULL,
|
||||
`pm_admin_passwd` VARCHAR(255) NULL DEFAULT NULL,
|
||||
`pm_theme` VARCHAR(50) NOT NULL DEFAULT 'glpi_classic',
|
||||
`date_mod` DATETIME NULL DEFAULT NULL,
|
||||
`taskcategories_id` INT(11) NULL ,
|
||||
`users_id` INT(11) NULL DEFAULT NULL,
|
||||
`pm_group_guid` VARCHAR(32) NULL DEFAULT NULL,
|
||||
`comment` TEXT NULL,
|
||||
`pm_dbserver_name` VARCHAR(255) NULL DEFAULT 'localhost',
|
||||
`pm_dbname` VARCHAR(50) NULL DEFAULT 'wf_workflow',
|
||||
`pm_dbserver_user` VARCHAR(255) NULL DEFAULT NULL,
|
||||
`pm_dbserver_passwd` VARCHAR(255) NULL DEFAULT NULL,
|
||||
`domain` VARCHAR(50) NULL DEFAULT '',
|
||||
`maintenance` TINYINT(1) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`id`)
|
||||
)
|
||||
COLLATE='utf8_general_ci'
|
||||
ENGINE=InnoDB;
|
||||
";
|
||||
|
||||
$DB->query($query) or die("error creating glpi_plugin_processmaker_configs" . $DB->error());
|
||||
|
||||
//add a default configuration
|
||||
$query = "
|
||||
INSERT INTO `glpi_plugin_processmaker_configs` (`id`) VALUES (1);
|
||||
";
|
||||
$DB->query( $query ) or die("error creating default record in glpi_plugin_processmaker_configs" . $DB->error());
|
||||
}
|
||||
|
||||
if (!arFieldExists("glpi_plugin_processmaker_configs", "pm_dbserver_name" )) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_configs`
|
||||
ADD COLUMN `pm_dbserver_name` VARCHAR(255) NULL DEFAULT NULL AFTER `pm_group_guid`,
|
||||
ADD COLUMN `pm_dbserver_user` VARCHAR(255) NULL DEFAULT NULL AFTER `pm_dbserver_name`,
|
||||
ADD COLUMN `pm_dbserver_passwd` VARCHAR(255) NULL DEFAULT NULL AFTER `pm_dbserver_user`;";
|
||||
$DB->query($query) or die("error adding fields pm_dbserver_name, pm_dbserver_user, pm_dbserver_passwd to glpi_plugin_processmaker_configs" . $DB->error());
|
||||
}
|
||||
|
||||
if (!arFieldExists("glpi_plugin_processmaker_configs", "domain" )) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_configs`
|
||||
ADD COLUMN `domain` VARCHAR(50) NULL DEFAULT '' AFTER `pm_dbserver_passwd`;
|
||||
";
|
||||
$DB->query($query) or die("error adding field domain to glpi_plugin_processmaker_configs" . $DB->error());
|
||||
}
|
||||
|
||||
if (!arFieldExists("glpi_plugin_processmaker_configs", "maintenance" )) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_configs`
|
||||
ADD COLUMN `maintenance` TINYINT(1) NOT NULL DEFAULT '0' AFTER `domain`;
|
||||
;";
|
||||
$DB->query($query) or die("error adding fields maintenance to glpi_plugin_processmaker_configs" . $DB->error());
|
||||
}
|
||||
|
||||
if (!arFieldExists("glpi_plugin_processmaker_configs", "pm_dbname" )) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_configs`
|
||||
ADD COLUMN `pm_dbname` VARCHAR(50) NULL DEFAULT 'wf_workflow' AFTER `pm_dbserver_name`;
|
||||
;";
|
||||
$DB->query($query) or die("error adding field pm_dbname to glpi_plugin_processmaker_configs" . $DB->error());
|
||||
}
|
||||
|
||||
if (arTableExists("glpi_plugin_processmaker_profiles")) {
|
||||
$query = "DROP TABLE `glpi_plugin_processmaker_profiles` ;";
|
||||
$DB->query($query) or die("error dropping glpi_plugin_processmaker_profiles" . $DB->error());
|
||||
}
|
||||
|
||||
if (!arTableExists("glpi_plugin_processmaker_cases")) {
|
||||
$query = "CREATE TABLE `glpi_plugin_processmaker_cases` (
|
||||
`id` VARCHAR(32) NOT NULL,
|
||||
`items_id` INT(11) NOT NULL,
|
||||
`itemtype` VARCHAR(10) NOT NULL DEFAULT 'Ticket',
|
||||
`case_num` INT(11) NOT NULL,
|
||||
`case_status` VARCHAR(20) NOT NULL DEFAULT 'DRAFT',
|
||||
`processes_id` INT(11) NULL DEFAULT NULL,
|
||||
UNIQUE INDEX `items` (`itemtype`, `items_id`),
|
||||
INDEX `case_status` (`case_status`)
|
||||
)
|
||||
COLLATE='utf8_general_ci'
|
||||
ENGINE=InnoDB;
|
||||
";
|
||||
// new installation
|
||||
include_once(GLPI_ROOT."/plugins/processmaker/install/install.php");
|
||||
processmaker_install();
|
||||
|
||||
$DB->query($query) or die("error creating glpi_plugin_processmaker_cases" . $DB->error());
|
||||
}
|
||||
|
||||
if (!arFieldExists("glpi_plugin_processmaker_cases", "processes_id")) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_cases`
|
||||
ADD COLUMN `processes_id` INT(11) NULL DEFAULT NULL;
|
||||
";
|
||||
$DB->query($query) or die("error adding column processes_id into glpi_plugin_processmaker_cases" . $DB->error());
|
||||
} else {
|
||||
$flds = $DB->list_fields('glpi_plugin_processmaker_cases');
|
||||
if (strcasecmp( $flds['processes_id']['Type'], 'varchar(32)' ) == 0) {
|
||||
// required because autoload doesn't work for unactive plugin'
|
||||
include_once(GLPI_ROOT."/plugins/processmaker/inc/process.class.php");
|
||||
include_once(GLPI_ROOT."/plugins/processmaker/inc/case.class.php");
|
||||
$proc = new PluginProcessmakerProcess;
|
||||
$case = new PluginProcessmakerCase;
|
||||
foreach ($DB->request("SELECT * FROM glpi_plugin_processmaker_cases WHERE LENGTH( processes_id ) = 32") as $row) {
|
||||
$proc->getFromDBbyExternalID( $row['processes_id'] );
|
||||
$case->update(array( 'id' => $row['id'], 'processes_id' => $proc->getID() ) );
|
||||
}
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_cases`
|
||||
CHANGE COLUMN `processes_id` `processes_id` INT(11) NULL DEFAULT NULL AFTER `case_status`;
|
||||
";
|
||||
$DB->query($query) or die("error converting column processes_id into INT(11) in glpi_plugin_processmaker_cases" . $DB->error());
|
||||
}
|
||||
// upgrade installation
|
||||
include_once(GLPI_ROOT."/plugins/processmaker/install/update.php");
|
||||
processmaker_update();
|
||||
}
|
||||
|
||||
if (!arTableExists("glpi_plugin_processmaker_tasks")) {
|
||||
$query = "CREATE TABLE `glpi_plugin_processmaker_tasks` (
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`items_id` INT(11) NOT NULL,
|
||||
`itemtype` VARCHAR(32) NOT NULL,
|
||||
`case_id` VARCHAR(32) NOT NULL,
|
||||
`del_index` INT(11) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE INDEX `case_id` (`case_id`, `del_index`),
|
||||
UNIQUE INDEX `items` (`itemtype`, `items_id`)
|
||||
)
|
||||
COLLATE='utf8_general_ci'
|
||||
ENGINE=InnoDB;
|
||||
";
|
||||
|
||||
$DB->query($query) or die("error creating glpi_plugin_processmaker_tasks" . $DB->error());
|
||||
}
|
||||
|
||||
if (!arTableExists("glpi_plugin_processmaker_users")) {
|
||||
$query = "CREATE TABLE `glpi_plugin_processmaker_users` (
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`pm_users_id` VARCHAR(32) NOT NULL ,
|
||||
`password` VARCHAR(32) NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE INDEX `pm_users_id` (`pm_users_id`)
|
||||
)
|
||||
COLLATE='utf8_general_ci'
|
||||
ENGINE=InnoDB;
|
||||
";
|
||||
|
||||
$DB->query($query) or die("error creating glpi_plugin_processmaker_users" . $DB->error());
|
||||
}
|
||||
|
||||
if (!arFieldExists('glpi_plugin_processmaker_users', 'password')) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_users`
|
||||
ADD COLUMN `id` INT NOT NULL AUTO_INCREMENT FIRST,
|
||||
ADD COLUMN `password` VARCHAR(32) NULL DEFAULT NULL AFTER `pm_users_id`,
|
||||
ADD PRIMARY KEY (`id`);
|
||||
";
|
||||
$DB->query($query) or die("error adding column 'password' to glpi_plugin_processmaker_users" . $DB->error());
|
||||
|
||||
// also need to change text of tasks for tasks linked to cases
|
||||
$query = "UPDATE glpi_tickettasks SET content=REPLACE(content,'##_PluginProcessmakerCases\$processmakercases','##_PluginProcessmakerCase\$processmakercases')
|
||||
WHERE glpi_tickettasks.id IN (SELECT items_id FROM glpi_plugin_processmaker_tasks WHERE itemtype='TicketTask') AND content LIKE '%_PluginProcessmakerCases\$processmakercases%'";
|
||||
$DB->query($query) or die("error updating TicketTask" . $DB->error());
|
||||
}
|
||||
|
||||
if (arFieldExists('glpi_plugin_processmaker_users', 'glpi_users_id')) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_users`
|
||||
ALTER `glpi_users_id` DROP DEFAULT,
|
||||
DROP PRIMARY KEY,
|
||||
DROP COLUMN `id`,
|
||||
DROP INDEX `glpi_users_id`;
|
||||
";
|
||||
$DB->query($query) or die("error droping 'defaults' from 'glpi_users_id' to glpi_plugin_processmaker_users" . $DB->error());
|
||||
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_users`
|
||||
CHANGE COLUMN `glpi_users_id` `id` INT(11) NOT NULL AUTO_INCREMENT FIRST,
|
||||
ADD PRIMARY KEY (`id`);
|
||||
";
|
||||
$DB->query($query) or die("error renaming 'glpi_users_id' into 'id' to glpi_plugin_processmaker_users" . $DB->error());
|
||||
}
|
||||
|
||||
if (!arTableExists("glpi_plugin_processmaker_processes")) {
|
||||
$query = "CREATE TABLE `glpi_plugin_processmaker_processes` (
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`process_guid` VARCHAR(32) NOT NULL,
|
||||
`name` VARCHAR(255) NOT NULL,
|
||||
`is_active` TINYINT(1) NOT NULL DEFAULT '0',
|
||||
`hide_case_num_title` TINYINT(1) NOT NULL DEFAULT '0',
|
||||
`insert_task_comment` TINYINT(1) NOT NULL DEFAULT '0',
|
||||
`comment` TEXT NULL,
|
||||
`taskcategories_id` INT(11) NULL ,
|
||||
`itilcategories_id` INT(11) NOT NULL DEFAULT '0',
|
||||
`type` INT(11) NOT NULL DEFAULT '1' COMMENT 'Only used for Tickets',
|
||||
`date_mod` DATETIME NULL DEFAULT NULL,
|
||||
`project_type` VARCHAR(50) NOT NULL DEFAULT 'classic',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE INDEX `process_guid` (`process_guid`)
|
||||
)
|
||||
COLLATE='utf8_general_ci'
|
||||
ENGINE=InnoDB;
|
||||
";
|
||||
|
||||
$DB->query($query) or die("error creating glpi_plugin_processmaker_processes" . $DB->error());
|
||||
}
|
||||
|
||||
if (arFieldExists( 'glpi_plugin_processmaker_processes', 'is_helpdeskvisible')) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_processes`
|
||||
CHANGE COLUMN `is_helpdeskvisible` `is_helpdeskvisible_notusedanymore` TINYINT(1) NOT NULL DEFAULT '0' COMMENT 'Not used any more since version 2.2' AFTER `name`;";
|
||||
$DB->query($query);
|
||||
}
|
||||
|
||||
if (!arFieldExists( 'glpi_plugin_processmaker_processes', 'itilcategories_id')) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_processes`
|
||||
ADD COLUMN `itilcategories_id` INT(11) NOT NULL DEFAULT '0',
|
||||
ADD COLUMN `type` INT(11) NOT NULL DEFAULT '1' COMMENT 'Only used for Tickets';";
|
||||
|
||||
$DB->query($query) or die("error adding columns 'itilcategories_id' and 'type' to glpi_plugin_processmaker_processes" . $DB->error());
|
||||
}
|
||||
|
||||
if (!arFieldExists( 'glpi_plugin_processmaker_processes', 'project_type')) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_processes`
|
||||
ADD COLUMN `project_type` VARCHAR(50) NOT NULL DEFAULT 'classic';";
|
||||
|
||||
$DB->query($query) or die("error adding columns 'project_type' to glpi_plugin_processmaker_processes" . $DB->error());
|
||||
}
|
||||
|
||||
if (!arTableExists("glpi_plugin_processmaker_processes_profiles")) { // since version 2.2
|
||||
$query = "CREATE TABLE `glpi_plugin_processmaker_processes_profiles` (
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`processes_id` INT(11) NOT NULL DEFAULT '0',
|
||||
`profiles_id` INT(11) NOT NULL DEFAULT '0',
|
||||
`entities_id` INT(11) NOT NULL DEFAULT '0',
|
||||
`is_recursive` TINYINT(1) NOT NULL DEFAULT '1',
|
||||
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `entities_id` (`entities_id`),
|
||||
INDEX `profiles_id` (`profiles_id`),
|
||||
INDEX `processes_id` (`processes_id`),
|
||||
INDEX `is_recursive` (`is_recursive`)
|
||||
)
|
||||
COLLATE='utf8_unicode_ci'
|
||||
ENGINE=InnoDB;";
|
||||
$DB->query($query) or die("error creating glpi_plugin_processmaker_processes_profiles" . $DB->error());
|
||||
|
||||
}
|
||||
|
||||
if (!arTableExists("glpi_plugin_processmaker_taskcategories")) {
|
||||
$query = "CREATE TABLE `glpi_plugin_processmaker_taskcategories` (
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`processes_id` INT(11) NOT NULL,
|
||||
`pm_task_guid` VARCHAR(32) NOT NULL,
|
||||
`taskcategories_id` INT(11) NOT NULL,
|
||||
`start` BIT(1) NOT NULL DEFAULT b'0',
|
||||
`is_active` TINYINT(1) NOT NULL DEFAULT '1',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE INDEX `pm_task_guid` (`pm_task_guid`),
|
||||
UNIQUE INDEX `items` (`taskcategories_id`),
|
||||
INDEX `processes_id` (`processes_id`)
|
||||
)
|
||||
COLLATE='utf8_general_ci'
|
||||
ENGINE=InnoDB
|
||||
;
|
||||
";
|
||||
|
||||
$DB->query($query) or die("error creating glpi_plugin_processmaker_taskcategories" . $DB->error());
|
||||
}
|
||||
|
||||
if (!arFieldExists('glpi_plugin_processmaker_taskcategories', 'is_active')) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_taskcategories`
|
||||
ADD COLUMN `is_active` TINYINT(1) NOT NULL DEFAULT '1' AFTER `start`;" ;
|
||||
$DB->query($query) or die("error adding field is_active to glpi_plugin_processmaker_taskcategories table" . $DB->error());
|
||||
}
|
||||
|
||||
|
||||
if (!arTableExists("glpi_plugin_processmaker_crontaskactions")) {
|
||||
$query = "CREATE TABLE `glpi_plugin_processmaker_crontaskactions` (
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`plugin_processmaker_caselinks_id` INT(11) NULL DEFAULT NULL,
|
||||
`itemtype` VARCHAR(100) NOT NULL,
|
||||
`items_id` INT(11) NOT NULL DEFAULT '0',
|
||||
`users_id` INT(11) NOT NULL DEFAULT '0',
|
||||
`is_targettoclaim` TINYINT(1) NOT NULL DEFAULT '0',
|
||||
`postdata` MEDIUMTEXT NULL DEFAULT NULL,
|
||||
`logs_out` MEDIUMTEXT NULL,
|
||||
`state` INT(11) NOT NULL ,
|
||||
`date_mod` DATETIME NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
)
|
||||
COLLATE='utf8_general_ci'
|
||||
ENGINE=InnoDB;";
|
||||
$DB->query($query) or die("error creating glpi_plugin_processmaker_crontaskactions" . $DB->error());
|
||||
}
|
||||
|
||||
if (arFieldExists('glpi_plugin_processmaker_crontaskactions', 'postdatas')) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_crontaskactions`
|
||||
CHANGE COLUMN `postdatas` `postdata` MEDIUMTEXT NULL DEFAULT NULL AFTER `toclaim`;";
|
||||
$DB->query($query) or die("error changing 'postdatas' from glpi_plugin_processmaker_crontaskactions table" . $DB->error());
|
||||
}
|
||||
|
||||
if (!arFieldExists('glpi_plugin_processmaker_crontaskactions', 'logs_out')) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_crontaskactions`
|
||||
ADD COLUMN `logs_out` MEDIUMTEXT NULL AFTER `postdata`;";
|
||||
$DB->query($query) or die("error adding 'logs_out' field into glpi_plugin_processmaker_crontaskactions table" . $DB->error());
|
||||
}
|
||||
|
||||
if (!arFieldExists("glpi_plugin_processmaker_crontaskactions", "is_targettoclaim")) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_crontaskactions`
|
||||
CHANGE COLUMN `toclaim` `is_targettoclaim` TINYINT(1) NOT NULL DEFAULT '0' AFTER `users_id`;";
|
||||
$DB->query($query) or die("error renaming toclaim in glpi_plugin_processmaker_crontaskactions" . $DB->error());
|
||||
}
|
||||
|
||||
|
||||
if (!arTableExists("glpi_plugin_processmaker_caselinks")) {
|
||||
$query = "CREATE TABLE `glpi_plugin_processmaker_caselinks` (
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`name` VARCHAR(255) NOT NULL,
|
||||
`is_active` TINYINT(1) NOT NULL DEFAULT '0',
|
||||
`is_externaldata` TINYINT(1) NOT NULL DEFAULT '0' COMMENT '0:insert data from case,1:wait for external application to set datas',
|
||||
`is_self` TINYINT(1) NOT NULL DEFAULT '0' COMMENT '0:use linked tickets, 1:use self',
|
||||
`sourcetask_guid` VARCHAR(32) NULL DEFAULT NULL,
|
||||
`targettask_guid` VARCHAR(32) NULL DEFAULT NULL,
|
||||
`targetprocess_guid` VARCHAR(32) NULL DEFAULT NULL,
|
||||
`targetdynaform_guid` VARCHAR(32) NULL DEFAULT NULL,
|
||||
`sourcecondition` TEXT NULL,
|
||||
`is_targettoclaim` TINYINT(1) NOT NULL DEFAULT '0',
|
||||
`externalapplication` TEXT NULL,
|
||||
`date_mod` DATETIME NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `is_active` (`is_active`),
|
||||
INDEX `is_externaldata` (`is_externaldata`),
|
||||
INDEX `is_self` (`is_self`)
|
||||
)
|
||||
COLLATE='utf8_general_ci'
|
||||
ENGINE=InnoDB;";
|
||||
$DB->query($query) or die("error creating glpi_plugin_processmaker_caselinks" . $DB->error());
|
||||
}
|
||||
|
||||
//if (!arFieldExists("glpi_plugin_processmaker_caselinks", "plugin_processmaker_taskcategories_id_source")) {
|
||||
// $query = "ALTER TABLE `glpi_plugin_processmaker_caselinks`
|
||||
// ADD COLUMN `plugin_processmaker_taskcategories_id_source` INT(11) NULL DEFAULT NULL AFTER `sourcetask_guid`,
|
||||
// ADD COLUMN `plugin_processmaker_taskcategories_id_target` INT(11) NULL DEFAULT NULL AFTER `targettask_guid`,
|
||||
// ADD COLUMN `plugin_processmaker_processes_id` INT(11) NULL DEFAULT NULL AFTER `targetprocess_guid`;";
|
||||
// $DB->query($query) or die("error adding col plugin_processmaker_taskcategories_id_source to glpi_plugin_processmaker_caselinks" . $DB->error());
|
||||
|
||||
// $query = "UPDATE glpi_plugin_processmaker_caselinks AS pm_cl
|
||||
// LEFT JOIN glpi_plugin_processmaker_taskcategories AS pm_tcsource ON pm_tcsource.pm_task_guid=pm_cl.sourcetask_guid
|
||||
// LEFT JOIN glpi_plugin_processmaker_taskcategories AS pm_tctarget ON pm_tctarget.pm_task_guid=pm_cl.targettask_guid
|
||||
// LEFT JOIN glpi_plugin_processmaker_processes AS pm_pr ON pm_pr.process_guid=pm_cl.targetprocess_guid
|
||||
// SET pm_cl.plugin_processmaker_taskcategories_id_source = pm_tcsource.id,
|
||||
// pm_cl.plugin_processmaker_taskcategories_id_target = pm_tctarget.id,
|
||||
// pm_cl.plugin_processmaker_processes_id = pm_pr.id;";
|
||||
// $DB->query($query) or die("error migrating data into col plugin_processmaker_taskcategories_id_source in glpi_plugin_processmaker_caselinks" . $DB->error());
|
||||
|
||||
// $query = "ALTER TABLE `glpi_plugin_processmaker_caselinks`
|
||||
// DROP COLUMN `sourcetask_guid`,
|
||||
// DROP COLUMN `targettask_guid`,
|
||||
// DROP COLUMN `targetprocess_guid`;";
|
||||
// $DB->query($query) or die("error dropping col plugin_processmaker_taskcategories_id_source from glpi_plugin_processmaker_caselinks" . $DB->error());
|
||||
//}
|
||||
|
||||
if (!arFieldExists("glpi_plugin_processmaker_caselinks", "is_targettoclaim")) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_caselinks`
|
||||
CHANGE COLUMN `targettoclaim` `is_targettoclaim` TINYINT(1) NOT NULL DEFAULT '0' AFTER `sourcecondition`;" ;
|
||||
$DB->query($query) or die("error renaming targettoclaim in glpi_plugin_processmaker_caselinks" . $DB->error());
|
||||
}
|
||||
|
||||
|
||||
if (!arTableExists("glpi_plugin_processmaker_caselinkactions")) {
|
||||
$query = "CREATE TABLE `glpi_plugin_processmaker_caselinkactions` (
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`plugin_processmaker_caselinks_id` INT(11) NULL DEFAULT NULL,
|
||||
`name` VARCHAR(255) NOT NULL,
|
||||
`value` TEXT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE INDEX `caselinks_id_name` (`plugin_processmaker_caselinks_id`, `name`)
|
||||
)
|
||||
COLLATE='utf8_general_ci'
|
||||
ENGINE=InnoDB
|
||||
;";
|
||||
$DB->query($query) or die("error creating glpi_plugin_processmaker_caselinkactions" . $DB->error());
|
||||
}
|
||||
|
||||
//if( !arTableExists('glpi_plugin_processmaker_selfservicedrafts')){
|
||||
// $query = "CREATE TABLE `glpi_plugin_processmaker_selfservicedrafts` (
|
||||
// `id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
// `users_id` INT(11) NOT NULL,
|
||||
// `plugin_processmaker_processes_id` INT(11) NOT NULL,
|
||||
// `url` TEXT NOT NULL,
|
||||
// PRIMARY KEY (`id`),
|
||||
// INDEX `users_id` (`users_id`)
|
||||
// )
|
||||
// COLLATE='utf8_general_ci'
|
||||
// ENGINE=InnoDB
|
||||
// ;" ;
|
||||
// $DB->query($query) or die("error creating glpi_plugin_processmaker_selfservicedrafts" . $DB->error());
|
||||
//}
|
||||
|
||||
// To be called for each task managed by the plugin
|
||||
// task in class
|
||||
// To be called for each task managed by the plugin
|
||||
// task in class
|
||||
CronTask::Register('PluginProcessmakerProcessmaker', 'pmusers', DAY_TIMESTAMP, array( 'state' => CronTask::STATE_DISABLE, 'mode' => CronTask::MODE_EXTERNAL));
|
||||
CronTask::Register('PluginProcessmakerProcessmaker', 'pmorphancases', DAY_TIMESTAMP, array('param' => 10, 'state' => CronTask::STATE_DISABLE, 'mode' => CronTask::MODE_EXTERNAL));
|
||||
CronTask::Register('PluginProcessmakerProcessmaker', 'pmtaskactions', MINUTE_TIMESTAMP, array('state' => CronTask::STATE_DISABLE, 'mode' => CronTask::MODE_EXTERNAL));
|
||||
|
||||
21
install/install.php
Normal file
21
install/install.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
function processmaker_install(){
|
||||
global $DB;
|
||||
|
||||
// installation from scratch
|
||||
include_once(GLPI_ROOT."/plugins/processmaker/setup.php");
|
||||
$info = plugin_version_processmaker();
|
||||
switch($info['version']){
|
||||
//case '3.3.0' :
|
||||
// $version = '3.2.9';
|
||||
// break;
|
||||
default :
|
||||
$version = $info['version'];
|
||||
}
|
||||
$DB->runFile(GLPI_ROOT . "/plugins/processmaker/install/mysql/$version-empty.sql");
|
||||
|
||||
// add configuration singleton
|
||||
$query = "INSERT INTO `glpi_plugin_processmaker_configs` (`id`) VALUES (1);";
|
||||
$DB->query( $query ) or die("error creating default record in glpi_plugin_processmaker_configs" . $DB->error());
|
||||
}
|
||||
167
install/mysql/3.2.8-empty.sql
Normal file
167
install/mysql/3.2.8-empty.sql
Normal file
@@ -0,0 +1,167 @@
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET NAMES utf8 */;
|
||||
/*!50503 SET NAMES utf8mb4 */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||
|
||||
-- Dumping structure for table glpi.glpi_plugin_processmaker_caselinkactions
|
||||
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_caselinkactions` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`plugin_processmaker_caselinks_id` int(11) DEFAULT NULL,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`value` text,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `caselinks_id_name` (`plugin_processmaker_caselinks_id`,`name`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
-- Dumping structure for table glpi.glpi_plugin_processmaker_caselinks
|
||||
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_caselinks` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`is_active` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`is_externaldata` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0:insert data from case,1:wait for external application to set datas',
|
||||
`is_self` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0:use linked tickets, 1:use self',
|
||||
`sourcetask_guid` varchar(32) DEFAULT NULL,
|
||||
`targettask_guid` varchar(32) DEFAULT NULL,
|
||||
`targetprocess_guid` varchar(32) DEFAULT NULL,
|
||||
`targetdynaform_guid` varchar(32) DEFAULT NULL,
|
||||
`sourcecondition` text,
|
||||
`is_targettoclaim` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`externalapplication` text,
|
||||
`date_mod` timestamp NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `is_active` (`is_active`),
|
||||
KEY `is_externaldata` (`is_externaldata`),
|
||||
KEY `is_self` (`is_self`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
-- Dumping structure for table glpi.glpi_plugin_processmaker_cases
|
||||
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_cases` (
|
||||
`id` varchar(32) NOT NULL,
|
||||
`items_id` int(11) NOT NULL,
|
||||
`itemtype` varchar(10) NOT NULL DEFAULT 'Ticket',
|
||||
`case_num` int(11) NOT NULL,
|
||||
`case_status` varchar(20) NOT NULL DEFAULT 'DRAFT',
|
||||
`processes_id` int(11) DEFAULT NULL,
|
||||
UNIQUE KEY `items` (`itemtype`,`items_id`),
|
||||
KEY `case_status` (`case_status`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
-- Dumping structure for table glpi.glpi_plugin_processmaker_configs
|
||||
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_configs` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(50) NOT NULL DEFAULT 'ProcessMaker',
|
||||
`pm_server_URL` varchar(250) NOT NULL DEFAULT 'http://localhost/',
|
||||
`pm_workspace` varchar(50) NOT NULL DEFAULT 'workflow',
|
||||
`pm_admin_user` varchar(255) DEFAULT NULL,
|
||||
`pm_admin_passwd` varchar(255) DEFAULT NULL,
|
||||
`pm_theme` varchar(50) NOT NULL DEFAULT 'glpi_classic',
|
||||
`date_mod` timestamp NULL DEFAULT NULL,
|
||||
`taskcategories_id` int(11) DEFAULT NULL,
|
||||
`users_id` int(11) DEFAULT NULL,
|
||||
`pm_group_guid` varchar(32) DEFAULT NULL,
|
||||
`comment` text,
|
||||
`pm_dbserver_name` varchar(255) DEFAULT 'localhost',
|
||||
`pm_dbname` varchar(50) DEFAULT 'wf_workflow',
|
||||
`pm_dbserver_user` varchar(255) DEFAULT NULL,
|
||||
`pm_dbserver_passwd` varchar(255) DEFAULT NULL,
|
||||
`domain` varchar(50) DEFAULT '',
|
||||
`maintenance` tinyint(1) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
-- Dumping structure for table glpi.glpi_plugin_processmaker_crontaskactions
|
||||
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_crontaskactions` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`plugin_processmaker_caselinks_id` int(11) DEFAULT NULL,
|
||||
`itemtype` varchar(100) NOT NULL,
|
||||
`items_id` int(11) NOT NULL DEFAULT '0',
|
||||
`users_id` int(11) NOT NULL DEFAULT '0',
|
||||
`is_targettoclaim` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`postdata` mediumtext,
|
||||
`logs_out` mediumtext,
|
||||
`state` int(11) NOT NULL,
|
||||
`date_mod` timestamp NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=164 DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
-- Dumping structure for table glpi.glpi_plugin_processmaker_processes
|
||||
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_processes` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`process_guid` varchar(32) NOT NULL,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`is_active` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`hide_case_num_title` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`insert_task_comment` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`comment` text,
|
||||
`taskcategories_id` int(11) DEFAULT NULL,
|
||||
`itilcategories_id` int(11) NOT NULL DEFAULT '0',
|
||||
`type` int(11) NOT NULL DEFAULT '1' COMMENT 'Only used for Tickets',
|
||||
`date_mod` timestamp NULL DEFAULT NULL,
|
||||
`project_type` varchar(50) NOT NULL DEFAULT 'classic',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `process_guid` (`process_guid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=41 DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
-- Dumping structure for table glpi.glpi_plugin_processmaker_processes_profiles
|
||||
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_processes_profiles` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`processes_id` int(11) NOT NULL DEFAULT '0',
|
||||
`profiles_id` int(11) NOT NULL DEFAULT '0',
|
||||
`entities_id` int(11) NOT NULL DEFAULT '0',
|
||||
`is_recursive` tinyint(1) NOT NULL DEFAULT '1',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `entities_id` (`entities_id`),
|
||||
KEY `profiles_id` (`profiles_id`),
|
||||
KEY `processes_id` (`processes_id`),
|
||||
KEY `is_recursive` (`is_recursive`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
|
||||
|
||||
-- Dumping structure for table glpi.glpi_plugin_processmaker_taskcategories
|
||||
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_taskcategories` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`processes_id` int(11) NOT NULL,
|
||||
`pm_task_guid` varchar(32) NOT NULL,
|
||||
`taskcategories_id` int(11) NOT NULL,
|
||||
`start` bit(1) NOT NULL DEFAULT b'0',
|
||||
`is_active` tinyint(1) NOT NULL DEFAULT '1',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `pm_task_guid` (`pm_task_guid`),
|
||||
UNIQUE KEY `items` (`taskcategories_id`),
|
||||
KEY `processes_id` (`processes_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=62 DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
-- Dumping structure for table glpi.glpi_plugin_processmaker_tasks
|
||||
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_tasks` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`items_id` int(11) NOT NULL,
|
||||
`itemtype` varchar(32) NOT NULL,
|
||||
`case_id` varchar(32) NOT NULL,
|
||||
`del_index` int(11) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `case_id` (`case_id`,`del_index`),
|
||||
UNIQUE KEY `items` (`itemtype`,`items_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=473 DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
-- Dumping structure for table glpi.glpi_plugin_processmaker_users
|
||||
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_users` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`pm_users_id` varchar(32) NOT NULL,
|
||||
`password` varchar(32) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `pm_users_id` (`pm_users_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=12918 DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */;
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
168
install/mysql/3.2.9-empty.sql
Normal file
168
install/mysql/3.2.9-empty.sql
Normal file
@@ -0,0 +1,168 @@
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET NAMES utf8 */;
|
||||
/*!50503 SET NAMES utf8mb4 */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||
|
||||
-- Dumping structure for table glpi.glpi_plugin_processmaker_caselinkactions
|
||||
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_caselinkactions` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`plugin_processmaker_caselinks_id` int(11) DEFAULT NULL,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`value` text,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `caselinks_id_name` (`plugin_processmaker_caselinks_id`,`name`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
-- Dumping structure for table glpi.glpi_plugin_processmaker_caselinks
|
||||
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_caselinks` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`is_active` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`is_externaldata` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0:insert data from case,1:wait for external application to set datas',
|
||||
`is_self` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0:use linked tickets, 1:use self',
|
||||
`sourcetask_guid` varchar(32) DEFAULT NULL,
|
||||
`targettask_guid` varchar(32) DEFAULT NULL,
|
||||
`targetprocess_guid` varchar(32) DEFAULT NULL,
|
||||
`targetdynaform_guid` varchar(32) DEFAULT NULL,
|
||||
`sourcecondition` text,
|
||||
`is_targettoclaim` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`externalapplication` text,
|
||||
`date_mod` timestamp NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `is_active` (`is_active`),
|
||||
KEY `is_externaldata` (`is_externaldata`),
|
||||
KEY `is_self` (`is_self`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
-- Dumping structure for table glpi.glpi_plugin_processmaker_cases
|
||||
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_cases` (
|
||||
`id` varchar(32) NOT NULL,
|
||||
`items_id` int(11) NOT NULL,
|
||||
`itemtype` varchar(10) NOT NULL DEFAULT 'Ticket',
|
||||
`case_num` int(11) NOT NULL,
|
||||
`case_status` varchar(20) NOT NULL DEFAULT 'DRAFT',
|
||||
`processes_id` int(11) DEFAULT NULL,
|
||||
UNIQUE KEY `items` (`itemtype`,`items_id`),
|
||||
KEY `case_status` (`case_status`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
-- Dumping structure for table glpi.glpi_plugin_processmaker_configs
|
||||
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_configs` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(50) NOT NULL DEFAULT 'ProcessMaker',
|
||||
`pm_server_URL` varchar(250) NOT NULL DEFAULT 'http://localhost/',
|
||||
`pm_workspace` varchar(50) NOT NULL DEFAULT 'workflow',
|
||||
`pm_admin_user` varchar(255) DEFAULT NULL,
|
||||
`pm_admin_passwd` varchar(255) DEFAULT NULL,
|
||||
`pm_theme` varchar(50) NOT NULL DEFAULT 'glpi_classic',
|
||||
`date_mod` timestamp NULL DEFAULT NULL,
|
||||
`taskcategories_id` int(11) DEFAULT NULL,
|
||||
`users_id` int(11) DEFAULT NULL,
|
||||
`pm_group_guid` varchar(32) DEFAULT NULL,
|
||||
`comment` text,
|
||||
`pm_dbserver_name` varchar(255) DEFAULT 'localhost',
|
||||
`pm_dbname` varchar(50) DEFAULT 'wf_workflow',
|
||||
`pm_dbserver_user` varchar(255) DEFAULT NULL,
|
||||
`pm_dbserver_passwd` varchar(255) DEFAULT NULL,
|
||||
`domain` varchar(50) DEFAULT '',
|
||||
`maintenance` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`db_version` varchar(10) NOT NULL DEFAULT '3.2.9',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
-- Dumping structure for table glpi.glpi_plugin_processmaker_crontaskactions
|
||||
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_crontaskactions` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`plugin_processmaker_caselinks_id` int(11) DEFAULT NULL,
|
||||
`itemtype` varchar(100) NOT NULL,
|
||||
`items_id` int(11) NOT NULL DEFAULT '0',
|
||||
`users_id` int(11) NOT NULL DEFAULT '0',
|
||||
`is_targettoclaim` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`postdata` mediumtext,
|
||||
`logs_out` mediumtext,
|
||||
`state` int(11) NOT NULL,
|
||||
`date_mod` timestamp NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=164 DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
-- Dumping structure for table glpi.glpi_plugin_processmaker_processes
|
||||
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_processes` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`process_guid` varchar(32) NOT NULL,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`is_active` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`hide_case_num_title` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`insert_task_comment` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`comment` text,
|
||||
`taskcategories_id` int(11) DEFAULT NULL,
|
||||
`itilcategories_id` int(11) NOT NULL DEFAULT '0',
|
||||
`type` int(11) NOT NULL DEFAULT '1' COMMENT 'Only used for Tickets',
|
||||
`date_mod` timestamp NULL DEFAULT NULL,
|
||||
`project_type` varchar(50) NOT NULL DEFAULT 'classic',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `process_guid` (`process_guid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=41 DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
-- Dumping structure for table glpi.glpi_plugin_processmaker_processes_profiles
|
||||
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_processes_profiles` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`processes_id` int(11) NOT NULL DEFAULT '0',
|
||||
`profiles_id` int(11) NOT NULL DEFAULT '0',
|
||||
`entities_id` int(11) NOT NULL DEFAULT '0',
|
||||
`is_recursive` tinyint(1) NOT NULL DEFAULT '1',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `entities_id` (`entities_id`),
|
||||
KEY `profiles_id` (`profiles_id`),
|
||||
KEY `processes_id` (`processes_id`),
|
||||
KEY `is_recursive` (`is_recursive`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
|
||||
|
||||
-- Dumping structure for table glpi.glpi_plugin_processmaker_taskcategories
|
||||
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_taskcategories` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`processes_id` int(11) NOT NULL,
|
||||
`pm_task_guid` varchar(32) NOT NULL,
|
||||
`taskcategories_id` int(11) NOT NULL,
|
||||
`start` bit(1) NOT NULL DEFAULT b'0',
|
||||
`is_active` tinyint(1) NOT NULL DEFAULT '1',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `pm_task_guid` (`pm_task_guid`),
|
||||
UNIQUE KEY `items` (`taskcategories_id`),
|
||||
KEY `processes_id` (`processes_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=62 DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
-- Dumping structure for table glpi.glpi_plugin_processmaker_tasks
|
||||
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_tasks` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`items_id` int(11) NOT NULL,
|
||||
`itemtype` varchar(32) NOT NULL,
|
||||
`case_id` varchar(32) NOT NULL,
|
||||
`del_index` int(11) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `case_id` (`case_id`,`del_index`),
|
||||
UNIQUE KEY `items` (`itemtype`,`items_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=473 DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
-- Dumping structure for table glpi.glpi_plugin_processmaker_users
|
||||
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_users` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`pm_users_id` varchar(32) NOT NULL,
|
||||
`password` varchar(32) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `pm_users_id` (`pm_users_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=12918 DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */;
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
173
install/mysql/3.3.0-empty.sql
Normal file
173
install/mysql/3.3.0-empty.sql
Normal file
@@ -0,0 +1,173 @@
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET NAMES utf8 */;
|
||||
/*!50503 SET NAMES utf8mb4 */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||
|
||||
-- Dumping structure for table glpi.glpi_plugin_processmaker_caselinkactions
|
||||
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_caselinkactions` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`plugin_processmaker_caselinks_id` int(11) DEFAULT NULL,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`value` text,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `caselinks_id_name` (`plugin_processmaker_caselinks_id`,`name`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
-- Dumping structure for table glpi.glpi_plugin_processmaker_caselinks
|
||||
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_caselinks` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`is_active` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`is_externaldata` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0:insert data from case,1:wait for external application to set datas',
|
||||
`is_self` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0:use linked tickets, 1:use self',
|
||||
`sourcetask_guid` varchar(32) DEFAULT NULL,
|
||||
`targettask_guid` varchar(32) DEFAULT NULL,
|
||||
`targetprocess_guid` varchar(32) DEFAULT NULL,
|
||||
`targetdynaform_guid` varchar(32) DEFAULT NULL,
|
||||
`sourcecondition` text,
|
||||
`is_targettoclaim` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`externalapplication` text,
|
||||
`date_mod` timestamp NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `is_active` (`is_active`),
|
||||
KEY `is_externaldata` (`is_externaldata`),
|
||||
KEY `is_self` (`is_self`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
-- Dumping structure for table glpi.glpi_plugin_processmaker_cases
|
||||
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_cases` (
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`itemtype` VARCHAR(10) NOT NULL DEFAULT 'Ticket',
|
||||
`items_id` INT(11) NOT NULL,
|
||||
`case_guid` VARCHAR(32) NOT NULL,
|
||||
`case_num` INT(11) NOT NULL,
|
||||
`case_status` VARCHAR(20) NOT NULL DEFAULT 'DRAFT',
|
||||
`plugin_processmaker_processes_id` INT(11) NULL DEFAULT NULL,
|
||||
INDEX `items` (`itemtype`, `items_id`),
|
||||
INDEX `case_status` (`case_status`),
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE INDEX `case_guid` (`case_guid`),
|
||||
UNIQUE INDEX `case_num` (`case_num`),
|
||||
INDEX `plugin_processmaker_processes_id` (`plugin_processmaker_processes_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
-- Dumping structure for table glpi.glpi_plugin_processmaker_configs
|
||||
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_configs` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(50) NOT NULL DEFAULT 'ProcessMaker',
|
||||
`pm_server_URL` varchar(250) NOT NULL DEFAULT 'http://localhost/',
|
||||
`pm_workspace` varchar(50) NOT NULL DEFAULT 'workflow',
|
||||
`pm_admin_user` varchar(255) DEFAULT NULL,
|
||||
`pm_admin_passwd` varchar(255) DEFAULT NULL,
|
||||
`pm_theme` varchar(50) NOT NULL DEFAULT 'glpi_classic',
|
||||
`date_mod` timestamp NULL DEFAULT NULL,
|
||||
`taskcategories_id` int(11) DEFAULT NULL,
|
||||
`users_id` int(11) DEFAULT NULL,
|
||||
`pm_group_guid` varchar(32) DEFAULT NULL,
|
||||
`comment` text,
|
||||
`pm_dbserver_name` varchar(255) DEFAULT 'localhost',
|
||||
`pm_dbname` varchar(50) DEFAULT 'wf_workflow',
|
||||
`pm_dbserver_user` varchar(255) DEFAULT NULL,
|
||||
`pm_dbserver_passwd` varchar(255) DEFAULT NULL,
|
||||
`domain` varchar(50) DEFAULT '',
|
||||
`maintenance` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`db_version` varchar(10) NOT NULL DEFAULT '3.3.0',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
-- Dumping structure for table glpi.glpi_plugin_processmaker_crontaskactions
|
||||
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_crontaskactions` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`plugin_processmaker_caselinks_id` int(11) DEFAULT NULL,
|
||||
`itemtype` varchar(100) NOT NULL,
|
||||
`items_id` int(11) NOT NULL DEFAULT '0',
|
||||
`users_id` int(11) NOT NULL DEFAULT '0',
|
||||
`is_targettoclaim` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`postdata` mediumtext,
|
||||
`logs_out` mediumtext,
|
||||
`state` int(11) NOT NULL,
|
||||
`date_mod` timestamp NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=164 DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
-- Dumping structure for table glpi.glpi_plugin_processmaker_processes
|
||||
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_processes` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`process_guid` varchar(32) NOT NULL,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`is_active` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`hide_case_num_title` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`insert_task_comment` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`comment` text,
|
||||
`taskcategories_id` int(11) DEFAULT NULL,
|
||||
`itilcategories_id` int(11) NOT NULL DEFAULT '0',
|
||||
`type` int(11) NOT NULL DEFAULT '1' COMMENT 'Only used for Tickets',
|
||||
`date_mod` timestamp NULL DEFAULT NULL,
|
||||
`project_type` varchar(50) NOT NULL DEFAULT 'classic',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `process_guid` (`process_guid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=41 DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
-- Dumping structure for table glpi.glpi_plugin_processmaker_processes_profiles
|
||||
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_profiles` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`processes_id` int(11) NOT NULL DEFAULT '0',
|
||||
`plugin_processmaker_processes_id` int(11) NOT NULL DEFAULT '0',
|
||||
`entities_id` int(11) NOT NULL DEFAULT '0',
|
||||
`is_recursive` tinyint(1) NOT NULL DEFAULT '1',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `entities_id` (`entities_id`),
|
||||
KEY `profiles_id` (`profiles_id`),
|
||||
KEY `processes_id` (`processes_id`),
|
||||
KEY `is_recursive` (`is_recursive`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
|
||||
|
||||
-- Dumping structure for table glpi.glpi_plugin_processmaker_taskcategories
|
||||
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_taskcategories` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`processes_id` int(11) NOT NULL,
|
||||
`pm_task_guid` varchar(32) NOT NULL,
|
||||
`taskcategories_id` int(11) NOT NULL,
|
||||
`start` bit(1) NOT NULL DEFAULT b'0',
|
||||
`is_active` tinyint(1) NOT NULL DEFAULT '1',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `pm_task_guid` (`pm_task_guid`),
|
||||
UNIQUE KEY `items` (`taskcategories_id`),
|
||||
KEY `processes_id` (`processes_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=62 DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
-- Dumping structure for table glpi.glpi_plugin_processmaker_tasks
|
||||
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_tasks` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`items_id` int(11) NOT NULL,
|
||||
`itemtype` varchar(32) NOT NULL,
|
||||
`case_id` varchar(32) NOT NULL,
|
||||
`del_index` int(11) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `case_id` (`case_id`,`del_index`),
|
||||
UNIQUE KEY `items` (`itemtype`,`items_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=473 DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
-- Dumping structure for table glpi.glpi_plugin_processmaker_users
|
||||
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_users` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`pm_users_id` varchar(32) NOT NULL,
|
||||
`password` varchar(32) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `pm_users_id` (`pm_users_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=12918 DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */;
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
39
install/update.php
Normal file
39
install/update.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
function processmaker_update(){
|
||||
global $DB;
|
||||
|
||||
// update from older versions
|
||||
// load config to get current version
|
||||
if (!arFieldExists("glpi_plugin_processmaker_configs", "db_version" )) {
|
||||
$current_version = '2.4.1';
|
||||
} else {
|
||||
include_once(GLPI_ROOT."/plugins/processmaker/inc/config.class.php");
|
||||
$config = PluginProcessmakerConfig::getInstance();
|
||||
$current_version = $config->fields['db_version'];
|
||||
}
|
||||
|
||||
switch($current_version){
|
||||
case '2.4.1' :
|
||||
// will upgrade any old versions (< 3.2.8) to 3.2.8
|
||||
include_once(GLPI_ROOT."/plugins/processmaker/install/update_to_3_2_8.php");
|
||||
update_to_3_2_8();
|
||||
|
||||
case '3.2.8' :
|
||||
// will upgrade 3.2.8 to 3.2.9
|
||||
include_once(GLPI_ROOT."/plugins/processmaker/install/update_3_2_8_to_3_2_9.php");
|
||||
update_3_2_8_to_3_2_9();
|
||||
|
||||
case '3.3.0' :
|
||||
// will upgrade 3.2.9 to 3.3.0
|
||||
include_once(GLPI_ROOT."/plugins/processmaker/install/update_3_2_9_to_3_3_0.php");
|
||||
update_3_2_9_to_3_3_0();
|
||||
|
||||
}
|
||||
|
||||
// end update by updating the db version number
|
||||
$query = "UPDATE `glpi_plugin_processmaker_configs` SET `db_version` = '$current_version' WHERE `id` = 1;";
|
||||
|
||||
$DB->query($query) or die("error when updating db_version field in glpi_plugin_processmaker_configs" . $DB->error());
|
||||
|
||||
}
|
||||
10
install/update_3_2_8_to_3_2_9.php
Normal file
10
install/update_3_2_8_to_3_2_9.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
function update_3_2_8_to_3_2_9(){
|
||||
global $DB;
|
||||
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_configs`
|
||||
ADD COLUMN `db_version` VARCHAR(10) NULL;";
|
||||
$DB->query($query) or die("error adding db_version field to glpi_plugin_processmaker_configs" . $DB->error());
|
||||
|
||||
}
|
||||
54
install/update_3_2_9_to_3_3_0.php
Normal file
54
install/update_3_2_9_to_3_3_0.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
function update_3_2_9_to_3_3_0(){
|
||||
global $DB;
|
||||
|
||||
|
||||
// Alter table plugin_processmaker_cases
|
||||
if (!arFieldExists("glpi_plugin_processmaker_cases", "plugin_processmaker_processes_id" )) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_cases`
|
||||
ALTER `id` DROP DEFAULT;
|
||||
ALTER TABLE `glpi_plugin_processmaker_cases`
|
||||
ADD COLUMN `id` INT(11) NOT NULL AUTO_INCREMENT FIRST,
|
||||
CHANGE COLUMN `itemtype` `itemtype` VARCHAR(10) NOT NULL DEFAULT 'Ticket' AFTER `id`,
|
||||
CHANGE COLUMN `id` `case_guid` VARCHAR(32) NOT NULL AFTER `items_id`,
|
||||
CHANGE COLUMN `processes_id` `plugin_processmaker_processes_id` INT(11) NULL DEFAULT NULL AFTER `case_status`,
|
||||
DROP INDEX `items`,
|
||||
ADD INDEX `items` (`itemtype`, `items_id`),
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD UNIQUE INDEX `case_guid` (`case_guid`),
|
||||
ADD UNIQUE INDEX `case_num` (`case_num`),
|
||||
ADD INDEX `plugin_processmaker_processes_id` (`plugin_processmaker_processes_id`);";
|
||||
|
||||
$DB->query($query) or die("error normalizing glpi_plugin_processmaker_cases table" . $DB->error());
|
||||
}
|
||||
|
||||
if (!arTableExists("glpi_plugin_processmaker_profiles")) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_processes_profiles`
|
||||
CHANGE COLUMN `processes_id` `plugin_processmaker_processes_id` INT(11) NOT NULL DEFAULT '0' AFTER `id`;
|
||||
RENAME TABLE `glpi_plugin_processmaker_processes_profiles` TO `glpi_plugin_processmaker_profiles`;";
|
||||
$DB->query($query) or die("error normalizing glpi_plugin_processmaker_processes_profiles table" . $DB->error());
|
||||
}
|
||||
|
||||
if (!arFieldExists("glpi_plugin_processmaker_tasks", "plugin_processmaker_cases_id" )) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_tasks`
|
||||
ALTER `itemtype` DROP DEFAULT;
|
||||
ALTER TABLE `glpi_plugin_processmaker_tasks`
|
||||
CHANGE COLUMN `itemtype` `itemtype` VARCHAR(32) NOT NULL AFTER `id`,
|
||||
ADD COLUMN `plugin_processmaker_cases_id` INT(11) NULL AFTER `case_id`,
|
||||
DROP INDEX `case_id`,
|
||||
ADD INDEX `plugin_processmaker_cases_id` (`plugin_processmaker_cases_id`, `del_index`);";
|
||||
$DB->query($query) or die("error normalizing glpi_plugin_processmaker_tasks table" . $DB->error());
|
||||
|
||||
// transform case_id (=GUID) into plugin_processmaker_cases_id
|
||||
$query = "UPDATE `glpi_plugin_processmaker_tasks`
|
||||
LEFT JOIN `glpi_plugin_processmaker_cases` ON `glpi_plugin_processmaker_cases`.`case_guid` = `glpi_plugin_processmaker_tasks`.`case_id`
|
||||
SET `glpi_plugin_processmaker_tasks`.`plugin_processmaker_cases_id` = `glpi_plugin_processmaker_cases`.`id`;";
|
||||
$DB->query($query) or die("error transforming case_id into plugin_processmaker_cases_id in glpi_plugin_processmaker_tasks table" . $DB->error());
|
||||
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_tasks`
|
||||
DROP COLUMN `case_id`;";
|
||||
$DB->query($query) or die("error deleting case_id column in glpi_plugin_processmaker_tasks table" . $DB->error());
|
||||
}
|
||||
|
||||
}
|
||||
196
install/update_to_3_2_8.php
Normal file
196
install/update_to_3_2_8.php
Normal file
@@ -0,0 +1,196 @@
|
||||
<?php
|
||||
|
||||
function update_to_3_2_8(){
|
||||
global $DB;
|
||||
|
||||
if (arTableExists("glpi_plugin_processmaker_config")) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_config`
|
||||
ADD COLUMN `date_mod` DATETIME NULL DEFAULT NULL AFTER `pm_theme`,
|
||||
ADD COLUMN `comment` TEXT NULL AFTER `date_mod`;
|
||||
RENAME TABLE `glpi_plugin_processmaker_config` TO `glpi_plugin_processmaker_configs`;";
|
||||
$DB->query($query) or die("error creating glpi_plugin_processmaker_configs" . $DB->error());
|
||||
}
|
||||
|
||||
if (!arFieldExists("glpi_plugin_processmaker_configs", "pm_dbserver_name" )) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_configs`
|
||||
ADD COLUMN `pm_dbserver_name` VARCHAR(255) NULL DEFAULT NULL AFTER `pm_group_guid`,
|
||||
ADD COLUMN `pm_dbserver_user` VARCHAR(255) NULL DEFAULT NULL AFTER `pm_dbserver_name`,
|
||||
ADD COLUMN `pm_dbserver_passwd` VARCHAR(255) NULL DEFAULT NULL AFTER `pm_dbserver_user`;";
|
||||
$DB->query($query) or die("error adding fields pm_dbserver_name, pm_dbserver_user, pm_dbserver_passwd to glpi_plugin_processmaker_configs" . $DB->error());
|
||||
}
|
||||
|
||||
if (!arFieldExists("glpi_plugin_processmaker_configs", "domain" )) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_configs`
|
||||
ADD COLUMN `domain` VARCHAR(50) NULL DEFAULT '' AFTER `pm_dbserver_passwd`;
|
||||
";
|
||||
$DB->query($query) or die("error adding field domain to glpi_plugin_processmaker_configs" . $DB->error());
|
||||
}
|
||||
|
||||
if (!arFieldExists("glpi_plugin_processmaker_configs", "maintenance" )) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_configs`
|
||||
ADD COLUMN `maintenance` TINYINT(1) NOT NULL DEFAULT '0' AFTER `domain`;
|
||||
;";
|
||||
$DB->query($query) or die("error adding fields maintenance to glpi_plugin_processmaker_configs" . $DB->error());
|
||||
}
|
||||
|
||||
if (!arFieldExists("glpi_plugin_processmaker_configs", "pm_dbname" )) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_configs`
|
||||
ADD COLUMN `pm_dbname` VARCHAR(50) NULL DEFAULT 'wf_workflow' AFTER `pm_dbserver_name`;
|
||||
;";
|
||||
$DB->query($query) or die("error adding field pm_dbname to glpi_plugin_processmaker_configs" . $DB->error());
|
||||
}
|
||||
|
||||
if (arTableExists("glpi_plugin_processmaker_profiles")) {
|
||||
$query = "DROP TABLE `glpi_plugin_processmaker_profiles` ;";
|
||||
$DB->query($query) or die("error dropping glpi_plugin_processmaker_profiles" . $DB->error());
|
||||
}
|
||||
|
||||
if (!arFieldExists("glpi_plugin_processmaker_cases", "processes_id")) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_cases`
|
||||
ADD COLUMN `processes_id` INT(11) NULL DEFAULT NULL;
|
||||
";
|
||||
$DB->query($query) or die("error adding column processes_id into glpi_plugin_processmaker_cases" . $DB->error());
|
||||
} else {
|
||||
$flds = $DB->list_fields('glpi_plugin_processmaker_cases');
|
||||
if (strcasecmp( $flds['processes_id']['Type'], 'varchar(32)' ) == 0) {
|
||||
// required because autoload doesn't work for unactive plugin'
|
||||
include_once(GLPI_ROOT."/plugins/processmaker/inc/process.class.php");
|
||||
include_once(GLPI_ROOT."/plugins/processmaker/inc/case.class.php");
|
||||
$proc = new PluginProcessmakerProcess;
|
||||
$case = new PluginProcessmakerCase;
|
||||
foreach ($DB->request("SELECT * FROM glpi_plugin_processmaker_cases WHERE LENGTH( processes_id ) = 32") as $row) {
|
||||
$proc->getFromDBbyExternalID( $row['processes_id'] );
|
||||
$case->update(array( 'id' => $row['id'], 'processes_id' => $proc->getID() ) );
|
||||
}
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_cases`
|
||||
CHANGE COLUMN `processes_id` `processes_id` INT(11) NULL DEFAULT NULL AFTER `case_status`;
|
||||
";
|
||||
$DB->query($query) or die("error converting column processes_id into INT(11) in glpi_plugin_processmaker_cases" . $DB->error());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!arFieldExists('glpi_plugin_processmaker_users', 'password')) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_users`
|
||||
ADD COLUMN `id` INT NOT NULL AUTO_INCREMENT FIRST,
|
||||
ADD COLUMN `password` VARCHAR(32) NULL DEFAULT NULL AFTER `pm_users_id`,
|
||||
ADD PRIMARY KEY (`id`);
|
||||
";
|
||||
$DB->query($query) or die("error adding column 'password' to glpi_plugin_processmaker_users" . $DB->error());
|
||||
|
||||
// also need to change text of tasks for tasks linked to cases
|
||||
$query = "UPDATE glpi_tickettasks SET content=REPLACE(content,'##_PluginProcessmakerCases\$processmakercases','##_PluginProcessmakerCase\$processmakercases')
|
||||
WHERE glpi_tickettasks.id IN (SELECT items_id FROM glpi_plugin_processmaker_tasks WHERE itemtype='TicketTask') AND content LIKE '%_PluginProcessmakerCases\$processmakercases%'";
|
||||
$DB->query($query) or die("error updating TicketTask" . $DB->error());
|
||||
}
|
||||
|
||||
if (arFieldExists('glpi_plugin_processmaker_users', 'glpi_users_id')) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_users`
|
||||
ALTER `glpi_users_id` DROP DEFAULT,
|
||||
DROP PRIMARY KEY,
|
||||
DROP COLUMN `id`,
|
||||
DROP INDEX `glpi_users_id`;
|
||||
";
|
||||
$DB->query($query) or die("error droping 'defaults' from 'glpi_users_id' to glpi_plugin_processmaker_users" . $DB->error());
|
||||
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_users`
|
||||
CHANGE COLUMN `glpi_users_id` `id` INT(11) NOT NULL AUTO_INCREMENT FIRST,
|
||||
ADD PRIMARY KEY (`id`);
|
||||
";
|
||||
$DB->query($query) or die("error renaming 'glpi_users_id' into 'id' to glpi_plugin_processmaker_users" . $DB->error());
|
||||
}
|
||||
|
||||
|
||||
if (arFieldExists( 'glpi_plugin_processmaker_processes', 'is_helpdeskvisible')) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_processes`
|
||||
CHANGE COLUMN `is_helpdeskvisible` `is_helpdeskvisible_notusedanymore` TINYINT(1) NOT NULL DEFAULT '0' COMMENT 'Not used any more since version 2.2' AFTER `name`;";
|
||||
$DB->query($query);
|
||||
}
|
||||
|
||||
if (!arFieldExists( 'glpi_plugin_processmaker_processes', 'itilcategories_id')) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_processes`
|
||||
ADD COLUMN `itilcategories_id` INT(11) NOT NULL DEFAULT '0',
|
||||
ADD COLUMN `type` INT(11) NOT NULL DEFAULT '1' COMMENT 'Only used for Tickets';";
|
||||
|
||||
$DB->query($query) or die("error adding columns 'itilcategories_id' and 'type' to glpi_plugin_processmaker_processes" . $DB->error());
|
||||
}
|
||||
|
||||
if (!arFieldExists( 'glpi_plugin_processmaker_processes', 'project_type')) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_processes`
|
||||
ADD COLUMN `project_type` VARCHAR(50) NOT NULL DEFAULT 'classic';";
|
||||
|
||||
$DB->query($query) or die("error adding columns 'project_type' to glpi_plugin_processmaker_processes" . $DB->error());
|
||||
}
|
||||
|
||||
if (!arFieldExists('glpi_plugin_processmaker_taskcategories', 'is_active')) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_taskcategories`
|
||||
ADD COLUMN `is_active` TINYINT(1) NOT NULL DEFAULT '1' AFTER `start`;" ;
|
||||
$DB->query($query) or die("error adding field is_active to glpi_plugin_processmaker_taskcategories table" . $DB->error());
|
||||
}
|
||||
|
||||
|
||||
if (arFieldExists('glpi_plugin_processmaker_crontaskactions', 'postdatas')) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_crontaskactions`
|
||||
CHANGE COLUMN `postdatas` `postdata` MEDIUMTEXT NULL DEFAULT NULL AFTER `toclaim`;";
|
||||
$DB->query($query) or die("error changing 'postdatas' from glpi_plugin_processmaker_crontaskactions table" . $DB->error());
|
||||
}
|
||||
|
||||
if (!arFieldExists('glpi_plugin_processmaker_crontaskactions', 'logs_out')) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_crontaskactions`
|
||||
ADD COLUMN `logs_out` MEDIUMTEXT NULL AFTER `postdata`;";
|
||||
$DB->query($query) or die("error adding 'logs_out' field into glpi_plugin_processmaker_crontaskactions table" . $DB->error());
|
||||
}
|
||||
|
||||
if (!arFieldExists("glpi_plugin_processmaker_crontaskactions", "is_targettoclaim")) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_crontaskactions`
|
||||
CHANGE COLUMN `toclaim` `is_targettoclaim` TINYINT(1) NOT NULL DEFAULT '0' AFTER `users_id`;";
|
||||
$DB->query($query) or die("error renaming toclaim in glpi_plugin_processmaker_crontaskactions" . $DB->error());
|
||||
}
|
||||
|
||||
|
||||
//if (!arFieldExists("glpi_plugin_processmaker_caselinks", "plugin_processmaker_taskcategories_id_source")) {
|
||||
// $query = "ALTER TABLE `glpi_plugin_processmaker_caselinks`
|
||||
// ADD COLUMN `plugin_processmaker_taskcategories_id_source` INT(11) NULL DEFAULT NULL AFTER `sourcetask_guid`,
|
||||
// ADD COLUMN `plugin_processmaker_taskcategories_id_target` INT(11) NULL DEFAULT NULL AFTER `targettask_guid`,
|
||||
// ADD COLUMN `plugin_processmaker_processes_id` INT(11) NULL DEFAULT NULL AFTER `targetprocess_guid`;";
|
||||
// $DB->query($query) or die("error adding col plugin_processmaker_taskcategories_id_source to glpi_plugin_processmaker_caselinks" . $DB->error());
|
||||
|
||||
// $query = "UPDATE glpi_plugin_processmaker_caselinks AS pm_cl
|
||||
// LEFT JOIN glpi_plugin_processmaker_taskcategories AS pm_tcsource ON pm_tcsource.pm_task_guid=pm_cl.sourcetask_guid
|
||||
// LEFT JOIN glpi_plugin_processmaker_taskcategories AS pm_tctarget ON pm_tctarget.pm_task_guid=pm_cl.targettask_guid
|
||||
// LEFT JOIN glpi_plugin_processmaker_processes AS pm_pr ON pm_pr.process_guid=pm_cl.targetprocess_guid
|
||||
// SET pm_cl.plugin_processmaker_taskcategories_id_source = pm_tcsource.id,
|
||||
// pm_cl.plugin_processmaker_taskcategories_id_target = pm_tctarget.id,
|
||||
// pm_cl.plugin_processmaker_processes_id = pm_pr.id;";
|
||||
// $DB->query($query) or die("error migrating data into col plugin_processmaker_taskcategories_id_source in glpi_plugin_processmaker_caselinks" . $DB->error());
|
||||
|
||||
// $query = "ALTER TABLE `glpi_plugin_processmaker_caselinks`
|
||||
// DROP COLUMN `sourcetask_guid`,
|
||||
// DROP COLUMN `targettask_guid`,
|
||||
// DROP COLUMN `targetprocess_guid`;";
|
||||
// $DB->query($query) or die("error dropping col plugin_processmaker_taskcategories_id_source from glpi_plugin_processmaker_caselinks" . $DB->error());
|
||||
//}
|
||||
|
||||
if (!arFieldExists("glpi_plugin_processmaker_caselinks", "is_targettoclaim")) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_caselinks`
|
||||
CHANGE COLUMN `targettoclaim` `is_targettoclaim` TINYINT(1) NOT NULL DEFAULT '0' AFTER `sourcecondition`;" ;
|
||||
$DB->query($query) or die("error renaming targettoclaim in glpi_plugin_processmaker_caselinks" . $DB->error());
|
||||
}
|
||||
|
||||
//if( !arTableExists('glpi_plugin_processmaker_selfservicedrafts')){
|
||||
// $query = "CREATE TABLE `glpi_plugin_processmaker_selfservicedrafts` (
|
||||
// `id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
// `users_id` INT(11) NOT NULL,
|
||||
// `plugin_processmaker_processes_id` INT(11) NOT NULL,
|
||||
// `url` TEXT NOT NULL,
|
||||
// PRIMARY KEY (`id`),
|
||||
// INDEX `users_id` (`users_id`)
|
||||
// )
|
||||
// COLLATE='utf8_general_ci'
|
||||
// ENGINE=InnoDB
|
||||
// ;" ;
|
||||
// $DB->query($query) or die("error creating glpi_plugin_processmaker_selfservicedrafts" . $DB->error());
|
||||
//}
|
||||
|
||||
|
||||
}
|
||||
@@ -23,11 +23,11 @@
|
||||
</authors>
|
||||
<versions>
|
||||
<version>
|
||||
<num>3.2.8</num>
|
||||
<num>3.2.9</num>
|
||||
<compatibility>9.2</compatibility>
|
||||
</version>
|
||||
<version>
|
||||
<num>3.2.8</num>
|
||||
<num>3.2.9</num>
|
||||
<compatibility>9.1</compatibility>
|
||||
</version>
|
||||
</versions>
|
||||
|
||||
Reference in New Issue
Block a user