debug query: $query
\n"; + $GLOBALS['egw_setup']->db->query($query,__LINE__,__FILE__); + + */ + + #updating the current version + $GLOBALS['setup_info']['workflow']['currentver'] = '1.2.01.000'; + return $GLOBALS['setup_info']['workflow']['currentver']; + } + + $test[] = '1.2.01.000'; + function workflow_upgrade1_2_01_000() + { + #updating the current version + $GLOBALS['setup_info']['workflow']['currentver'] = '1.2.01.001'; + return $GLOBALS['setup_info']['workflow']['currentver']; + } + + $test[] = '1.2.01.001'; + function workflow_upgrade1_2_01_001() + { + #updating the current version + $GLOBALS['setup_info']['workflow']['currentver'] = '1.2.01.002'; + return $GLOBALS['setup_info']['workflow']['currentver']; + } + + $test[] = '1.2.01.002'; + function workflow_upgrade1_2_01_002() + { + #updating the current version + $GLOBALS['setup_info']['workflow']['currentver'] = '1.2.01.003'; + return $GLOBALS['setup_info']['workflow']['currentver']; + } + + $test[] = '1.2.01.003'; + function workflow_upgrade1_2_01_003() + { + #updating the current version + $GLOBALS['setup_info']['workflow']['currentver'] = '1.2.01.004'; + return $GLOBALS['setup_info']['workflow']['currentver']; + } + + $test[] = '1.2.01.004'; + function workflow_upgrade1_2_01_004() + { + #updating the current version + $GLOBALS['setup_info']['workflow']['currentver'] = '1.2.01.005'; + return $GLOBALS['setup_info']['workflow']['currentver']; + } + + $test[] = '1.2.01.005'; + function workflow_upgrade1_2_01_005() + { + if (!$GLOBALS['phpgw_setup']->oProc->m_bDeltaOnly) + { + $workflowHostInfo = extractDatabaseParameters(); + + /* create the workflow database */ + $GLOBALS['phpgw']->ADOdb->query("CREATE DATABASE workflow WITH OWNER = postgres TEMPLATE = template0 ENCODING = 'LATIN1'"); + $GLOBALS['phpgw']->ADOdb->query("CREATE USER admin_workflow WITH PASSWORD 'admin_workflow' NOCREATEDB NOCREATEUSER VALID UNTIL 'infinity'"); + $GLOBALS['phpgw']->ADOdb->query("CREATE GROUP workflow"); + $GLOBALS['phpgw']->ADOdb->query("ALTER GROUP workflow ADD USER admin_workflow"); + $GLOBALS['phpgw']->ADOdb->query("GRANT workflow TO admin_workflow"); + + /* connect to the new database */ + $workflowDB = $GLOBALS['phpgw']->ADOdb; + if ($workflowDB->connect($workflowHostInfo['host'], $workflowHostInfo['user'], $workflowHostInfo['password'], 'workflow')) + { + /* create a sample application (Music CD Loan) */ + $workflowDB->query("CREATE USER admin_cds WITH PASSWORD 'admin_cds' NOCREATEDB NOCREATEUSER VALID UNTIL 'infinity'"); + $workflowDB->query("ALTER GROUP workflow ADD USER admin_cds"); + $workflowDB->query("CREATE SCHEMA cds AUTHORIZATION admin_cds"); + $workflowDB->query("GRANT ALL ON SCHEMA cds TO admin_cds"); + $workflowDB->query("GRANT ALL ON SCHEMA cds TO postgres"); + $workflowDB->query("CREATE TABLE cds.cdcollection(cdid int4 NOT NULL, title varchar(200), status varchar(40), usuario varchar(200), CONSTRAINT cdcollection_pkey PRIMARY KEY (cdid))"); + $workflowDB->query("ALTER TABLE cds.cdcollection OWNER TO admin_cds"); + $workflowDB->query("GRANT ALL ON TABLE cds.cdcollection TO postgres WITH GRANT OPTION"); + $workflowDB->query("GRANT ALL ON TABLE cds.cdcollection TO admin_cds"); + $workflowDB->query("COMMENT ON TABLE cds.cdcollection IS 'Exemplo de Empréstimo de CDs'"); + $workflowDB->query("INSERT INTO cdcollection VALUES (1, 'Iron Maiden - Powerslave', 'disponivel', '')"); + $workflowDB->query("INSERT INTO cdcollection VALUES (2, 'Pink Floyd - The Wall', 'disponivel', '')"); + $workflowDB->query("INSERT INTO cdcollection VALUES (3, 'Deep Purple - Fireball', 'disponivel', '')"); + + /* create the new tables */ + $workflowDB->query('CREATE TABLE organizacao (organizacao_id serial NOT NULL, nome character varying(20) NOT NULL, descricao character varying(100) NOT NULL)'); + $workflowDB->query('CREATE TABLE area_status (area_status_id serial NOT NULL, organizacao_id integer NOT NULL, descricao character varying(50) NOT NULL, nivel integer NOT NULL)'); + $workflowDB->query('CREATE TABLE centro_custo (organizacao_id integer NOT NULL, centro_custo_id serial NOT NULL, nm_centro_custo integer NOT NULL, grupo character varying(30), descricao character varying(100) NOT NULL)'); + $workflowDB->query('CREATE TABLE localidade (organizacao_id integer NOT NULL, localidade_id serial NOT NULL, centro_custo_id integer, descricao character varying(50) NOT NULL)'); + $workflowDB->query('CREATE TABLE funcionario (funcionario_id character varying NOT NULL, area_id integer NOT NULL, localidade_id integer NOT NULL, centro_custo_id integer NOT NULL, organizacao_id integer NOT NULL, funcionario_status_id integer NOT NULL)'); + $workflowDB->query('CREATE TABLE area (organizacao_id integer NOT NULL, area_id serial NOT NULL, area_status_id integer NOT NULL, areasup_organizacao_id integer, superior_area_id integer, centro_custo_id integer, titular_funcionario_id character varying, substituto_funcionario_id character varying, sigla character varying(20) NOT NULL, descricao character varying(100) NOT NULL, ativa character varying(1) NOT NULL)'); + $workflowDB->query('CREATE TABLE funcionario_status (funcionario_status_id serial NOT NULL, descricao character varying(50) NOT NULL)'); + $workflowDB->query('CREATE TABLE admin_access (admin_access_id integer NOT NULL, tipo character(3) NOT NULL, numvalue smallint NOT NULL, nivel integer DEFAULT 0)'); + $workflowDB->query('CREATE TABLE aplicacao_externa (apl_in_id serial NOT NULL, apl_st_nome character varying(50) NOT NULL, apl_st_descricao text, apl_st_imagem character varying(100), apl_st_endereco character varying(120) NOT NULL, apl_bt_autentica bit(1), apl_st_post text, apl_in_responsavel integer NOT NULL, apl_in_area integer NOT NULL)'); + $workflowDB->query('CREATE TABLE aplicacao_externa_acl (apl_in_id integer NOT NULL, apl_in_uid integer NOT NULL)'); + + /* add the constraints */ + $workflowDB->query('ALTER TABLE ONLY organizacao ADD CONSTRAINT organizacao_pkey PRIMARY KEY (organizacao_id)'); + $workflowDB->query('ALTER TABLE ONLY area_status ADD CONSTRAINT areastatus_pkey PRIMARY KEY (area_status_id, organizacao_id)'); + $workflowDB->query('ALTER TABLE ONLY centro_custo ADD CONSTRAINT centrocusto_pkey PRIMARY KEY (organizacao_id, centro_custo_id)'); + $workflowDB->query('ALTER TABLE ONLY localidade ADD CONSTRAINT localidade_pkey PRIMARY KEY (organizacao_id, localidade_id)'); + $workflowDB->query('ALTER TABLE ONLY funcionario ADD CONSTRAINT funcionario_pkey PRIMARY KEY (funcionario_id)'); + $workflowDB->query('ALTER TABLE ONLY area ADD CONSTRAINT area_pkey PRIMARY KEY (organizacao_id, area_id)'); + $workflowDB->query('ALTER TABLE ONLY funcionario_status ADD CONSTRAINT funcionario_status_pkey PRIMARY KEY (funcionario_status_id)'); + $workflowDB->query('ALTER TABLE ONLY area_status ADD CONSTRAINT "$1" FOREIGN KEY (organizacao_id) REFERENCES organizacao(organizacao_id)'); + $workflowDB->query('ALTER TABLE ONLY centro_custo ADD CONSTRAINT "$1" FOREIGN KEY (organizacao_id) REFERENCES organizacao(organizacao_id)'); + $workflowDB->query('ALTER TABLE ONLY localidade ADD CONSTRAINT "$1" FOREIGN KEY (centro_custo_id, organizacao_id) REFERENCES centro_custo(centro_custo_id, organizacao_id)'); + $workflowDB->query('ALTER TABLE ONLY localidade ADD CONSTRAINT "$2" FOREIGN KEY (organizacao_id) REFERENCES organizacao(organizacao_id)'); + $workflowDB->query('ALTER TABLE ONLY funcionario ADD CONSTRAINT "$1" FOREIGN KEY (organizacao_id, centro_custo_id) REFERENCES centro_custo(organizacao_id, centro_custo_id)'); + $workflowDB->query('ALTER TABLE ONLY funcionario ADD CONSTRAINT "$2" FOREIGN KEY (organizacao_id, localidade_id) REFERENCES localidade(organizacao_id, localidade_id)'); + $workflowDB->query('ALTER TABLE ONLY area ADD CONSTRAINT "$1" FOREIGN KEY (superior_area_id, areasup_organizacao_id) REFERENCES area(area_id, organizacao_id)'); + $workflowDB->query('ALTER TABLE ONLY area ADD CONSTRAINT "$2" FOREIGN KEY (centro_custo_id, organizacao_id) REFERENCES centro_custo(centro_custo_id, organizacao_id)'); + $workflowDB->query('ALTER TABLE ONLY area ADD CONSTRAINT "$5" FOREIGN KEY (organizacao_id) REFERENCES organizacao(organizacao_id)'); + $workflowDB->query('ALTER TABLE ONLY area ADD CONSTRAINT "$6" FOREIGN KEY (area_status_id, organizacao_id) REFERENCES area_status(area_status_id, organizacao_id)'); + $workflowDB->query('ALTER TABLE ONLY funcionario ADD CONSTRAINT "$3" FOREIGN KEY (organizacao_id, area_id) REFERENCES area(organizacao_id, area_id)'); + $workflowDB->query('ALTER TABLE ONLY funcionario ADD CONSTRAINT "$4" FOREIGN KEY (funcionario_status_id) REFERENCES funcionario_status(funcionario_status_id)'); + $workflowDB->query('ALTER TABLE ONLY area ADD CONSTRAINT "$3" FOREIGN KEY (titular_funcionario_id) REFERENCES funcionario(funcionario_id)'); + $workflowDB->query('ALTER TABLE ONLY area ADD CONSTRAINT "$4" FOREIGN KEY (substituto_funcionario_id) REFERENCES funcionario(funcionario_id)'); + $workflowDB->query('ALTER TABLE ONLY admin_access ADD CONSTRAINT admin_access_pkey PRIMARY KEY (admin_access_id, tipo, numvalue)'); + $workflowDB->query('ALTER TABLE ONLY aplicacao_externa ADD CONSTRAINT seq_aplicacao_externa PRIMARY KEY (apl_in_id)'); + $workflowDB->query('ALTER TABLE ONLY aplicacao_externa_acl ADD CONSTRAINT pk_aplicacao_externa_acl PRIMARY KEY (apl_in_id, apl_in_uid)'); + $workflowDB->query('ALTER TABLE ONLY aplicacao_externa_acl ADD CONSTRAINT fk01_aplicacao_externa_acl FOREIGN KEY (apl_in_id) REFERENCES aplicacao_externa(apl_in_id) ON UPDATE CASCADE ON DELETE CASCADE'); + + /* set the permissions to the database objects */ + $dbObjects = array('organizacao', 'area_status', 'centro_custo', 'localidade', 'funcionario', 'area', 'funcionario_status', 'organizacao_organizacao_id_seq', 'area_status_area_status_id_seq', 'centro_custo_centro_custo_id_seq', 'localidade_localidade_id_seq', 'area_area_id_seq', 'funcionario_status_funcionario_status_id_seq', 'admin_access', 'aplicacao_externa', 'aplicacao_externa_apl_in_id_seq', 'aplicacao_externa_acl'); + foreach ($dbObjects as $dbObject) + { + $workflowDB->query("GRANT ALL ON TABLE $dbObject TO admin_workflow"); + $workflowDB->query("GRANT ALL ON TABLE $dbObject TO postgres"); + $workflowDB->query("GRANT SELECT ON TABLE $dbObject TO public"); + } + } + + /* reconnect to the previous database */ + $GLOBALS['phpgw']->ADOdb->connect($workflowHostInfo['host'], $workflowHostInfo['user'], $workflowHostInfo['password'], $workflowHostInfo['dbname']); + } + + #updating the current version + $GLOBALS['setup_info']['workflow']['currentver'] = '1.3.00.000'; + return $GLOBALS['setup_info']['workflow']['currentver']; + } + + $test[] = '1.3.00.000'; + function workflow_upgrade1_3_00_000() + { + $GLOBALS['phpgw_setup']->oProc->createTable('egw_wf_interinstance_relations', + array( + 'fd' => array( + 'wf_parent_instance_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False), + 'wf_parent_activity_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False), + 'wf_child_instance_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False), + 'wf_parent_lock' => array('type' => 'int', 'precision' => '2', 'nullable' => True) + ), + 'pk' => array('wf_parent_instance_id', 'wf_parent_activity_id', 'wf_child_instance_id'), + 'fk' => array(), + 'ix' => array(), + 'uc' => array() + ) + ); + + if (!$GLOBALS['phpgw_setup']->oProc->m_bDeltaOnly) + { + $workflowHostInfo = extractDatabaseParameters(); + + /* connect to the workflow database */ + $workflowDB = $GLOBALS['phpgw']->ADOdb; + if ($workflowDB->connect($workflowHostInfo['host'], $workflowHostInfo['user'], $workflowHostInfo['password'], 'workflow')) + { + /* change the type of the employee ID (funcionario_id field) */ + $workflowDB->query('ALTER TABLE funcionario ALTER COLUMN centro_custo_id DROP NOT NULL'); + $workflowDB->query('ALTER TABLE area DROP CONSTRAINT "$3"'); + $workflowDB->query('ALTER TABLE area DROP CONSTRAINT "$4"'); + $workflowDB->query('ALTER TABLE funcionario ADD COLUMN funcionario_id2 int4'); + $workflowDB->query('UPDATE funcionario SET funcionario_id2 = int4(funcionario_id)'); + $workflowDB->query('ALTER TABLE funcionario DROP COLUMN funcionario_id'); + $workflowDB->query('ALTER TABLE funcionario RENAME COLUMN funcionario_id2 TO funcionario_id'); + $workflowDB->query('ALTER TABLE funcionario ALTER funcionario_id SET NOT NULL'); + $workflowDB->query('ALTER TABLE funcionario ADD CONSTRAINT funcionario_pkey PRIMARY KEY (funcionario_id)'); + $workflowDB->query('ALTER TABLE area ADD titular_funcionario_id2 int4'); + $workflowDB->query('ALTER TABLE area ADD substituto_funcionario_id2 int4'); + $workflowDB->query('UPDATE area SET titular_funcionario_id2 = int4(titular_funcionario_id), substituto_funcionario_id2 = int4(substituto_funcionario_id)'); + $workflowDB->query('ALTER TABLE area DROP COLUMN titular_funcionario_id'); + $workflowDB->query('ALTER TABLE area DROP COLUMN substituto_funcionario_id'); + $workflowDB->query('ALTER TABLE area RENAME COLUMN titular_funcionario_id2 TO titular_funcionario_id'); + $workflowDB->query('ALTER TABLE area RENAME COLUMN substituto_funcionario_id2 TO substituto_funcionario_id'); + $workflowDB->query('ALTER TABLE area ADD CONSTRAINT "$3" FOREIGN KEY (titular_funcionario_id) REFERENCES funcionario (funcionario_id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION'); + $workflowDB->query('ALTER TABLE AREA ADD CONSTRAINT "$4" FOREIGN KEY (substituto_funcionario_id) REFERENCES funcionario (funcionario_id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION'); + } + + /* reconnect to the previous database */ + $GLOBALS['phpgw']->ADOdb->connect($workflowHostInfo['host'], $workflowHostInfo['user'], $workflowHostInfo['password'], $workflowHostInfo['dbname']); + } + + #updating the current version + $GLOBALS['setup_info']['workflow']['currentver'] = '1.4.00.000'; + return $GLOBALS['setup_info']['workflow']['currentver']; + } + + $test[] = '1.4.00.000'; + function workflow_upgrade1_4_00_000() + { + #updating the current version + $GLOBALS['setup_info']['workflow']['currentver'] = '1.4.00.001'; + return $GLOBALS['setup_info']['workflow']['currentver']; + } + + $test[] = '1.4.00.001'; + function workflow_upgrade1_4_00_001() + { + $GLOBALS['phpgw_setup']->oProc->AddColumn('egw_wf_activities' ,'wf_menu_path', array('type' => 'varchar', 'precision' => 200, 'nullable' => True)); + + #updating the current version + $GLOBALS['setup_info']['workflow']['currentver'] = '1.4.01.000'; + return $GLOBALS['setup_info']['workflow']['currentver']; + } + + $test[] = '1.4.01.000'; + function workflow_upgrade1_4_01_000() + { + if (!$GLOBALS['phpgw_setup']->oProc->m_bDeltaOnly) + { + $workflowHostInfo = extractDatabaseParameters(); + + /* connect to the new database */ + $workflowDB = $GLOBALS['phpgw']->ADOdb; + if ($workflowDB->connect($workflowHostInfo['host'], $workflowHostInfo['user'], $workflowHostInfo['password'], 'workflow')) + { + /* add a new column to the area table (orgchart) */ + $workflowDB->query('ALTER TABLE area ADD COLUMN auxiliar_funcionario_id int4'); + $workflowDB->query('ALTER TABLE ONLY area ADD CONSTRAINT "$7" FOREIGN KEY (auxiliar_funcionario_id) REFERENCES funcionario(funcionario_id)'); + } + + /* reconnect to the previous database */ + $GLOBALS['phpgw']->ADOdb->connect($workflowHostInfo['host'], $workflowHostInfo['user'], $workflowHostInfo['password'], $workflowHostInfo['dbname']); + } + + + + #updating the current version + $GLOBALS['setup_info']['workflow']['currentver'] = '1.4.02.000'; + return $GLOBALS['setup_info']['workflow']['currentver']; + } + + $test[] = '1.4.02.000'; + function workflow_upgrade1_4_02_000() + { + $GLOBALS['phpgw_setup']->oProc->createTable('egw_wf_admin_access', + array( + 'fd' => array( + 'admin_access_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False), + 'tipo' => array('type' => 'char', 'precision' => '3', 'nullable' => False), + 'numvalue' => array('type' => 'int', 'precision' => '2', 'nullable' => False), + 'nivel' => array('type' => 'int', 'precision' => '4', 'nullable' => True, 'default' => 0) + ), + 'pk' => array('admin_access_id', 'tipo', 'numvalue'), + 'fk' => array(), + 'ix' => array(), + 'uc' => array() + ) + ); + + $GLOBALS['phpgw_setup']->oProc->createTable('egw_wf_external_application', + array( + 'fd' => array( + 'external_application_id' => array('type' => 'auto', 'precision' => '4', 'nullable' => False), + 'name' => array('type' => 'varchar', 'precision' => '50', 'nullable' => False), + 'description' => array('type' => 'text', 'nullable' => True), + 'image' => array('type' => 'varchar', 'precision' => '100', 'nullable' => True), + 'address' => array('type' => 'varchar', 'precision' => '120', 'nullable' => False), + 'authentication' => array('type' => 'bit', 'precision' => '1', 'nullable' => True), + 'post' => array('type' => 'text', 'nullable' => True) + ), + 'pk' => array('external_application_id'), + 'fk' => array(), + 'ix' => array(), + 'uc' => array() + ) + ); + + if (!$GLOBALS['phpgw_setup']->oProc->m_bDeltaOnly) + { + $adminAccessData = array(); + $externalApplicationData = array(); + $externalApplicationSequence = 1; + $externalApplicationACLData = array(); + $workflowHostInfo = extractDatabaseParameters(); + $GLOBALS['phpgw']->ADOdb->SetFetchMode(ADODB_FETCH_ASSOC); + + /* connect to the Workflow database */ + $workflowDB = $GLOBALS['phpgw']->ADOdb; + if ($workflowDB->connect($workflowHostInfo['host'], $workflowHostInfo['user'], $workflowHostInfo['password'], 'workflow')) + { + $result = $GLOBALS['phpgw']->ADOdb->query('SELECT admin_access_id, tipo, numvalue, nivel FROM admin_access'); + if ($result) + while ($row = $result->fetchRow()) + $adminAccessData[] = array($row['admin_access_id'], $row['tipo'], $row['numvalue'], $row['nivel']); + + $result = $GLOBALS['phpgw']->ADOdb->query('SELECT apl_in_id, apl_st_nome, apl_st_descricao, apl_st_imagem, apl_st_endereco, apl_bt_autentica, apl_st_post FROM aplicacao_externa'); + if ($result) + while ($row = $result->fetchRow()) + $externalApplicationData[] = array($row['apl_in_id'], $row['apl_st_nome'], $row['apl_st_descricao'], $row['apl_st_imagem'], $row['apl_st_endereco'], $row['apl_bt_autentica'], $row['apl_st_post']); + $result = $GLOBALS['phpgw']->ADOdb->query('SELECT last_value FROM aplicacao_externa_apl_in_id_seq'); + if ($result) + if ($row = $result->fetchRow()) + $externalApplicationSequence = $row['last_value']; + + $result = $GLOBALS['phpgw']->ADOdb->query('SELECT apl_in_uid, apl_in_id FROM aplicacao_externa_acl'); + if ($result) + while ($row = $result->fetchRow()) + $externalApplicationACLData[] = array($row['apl_in_uid'], $row['apl_in_id']); + + /* remove the unused tables */ + $GLOBALS['phpgw']->ADOdb->query('DROP TABLE admin_access'); + $GLOBALS['phpgw']->ADOdb->query('DROP SEQUENCE aplicacao_externa_apl_in_id_seq'); + $GLOBALS['phpgw']->ADOdb->query('DROP CONSTRAINT fk01_aplicacao_externa_acl'); + $GLOBALS['phpgw']->ADOdb->query('DROP TABLE aplicacao_externa_acl'); + $GLOBALS['phpgw']->ADOdb->query('DROP TABLE aplicacao_externa'); + } + + /* reconnect to the previous database */ + $GLOBALS['phpgw']->ADOdb->connect($workflowHostInfo['host'], $workflowHostInfo['user'], $workflowHostInfo['password'], $workflowHostInfo['dbname']); + foreach ($adminAccessData as $newRow) + $result = $GLOBALS['phpgw']->ADOdb->query("INSERT INTO egw_wf_admin_access(admin_access_id, tipo, numvalue, nivel) VALUES (?, ?, ?, ?)", $newRow); + + foreach ($externalApplicationData as $newRow) + $result = $GLOBALS['phpgw']->ADOdb->query("INSERT INTO egw_wf_external_application(external_application_id, name, description, image, address, authentication, post) VALUES(?, ?, ?, ?, ?, ?, ?)", $newRow); + $GLOBALS['phpgw']->ADOdb->query("SELECT pg_catalog.setval('seq_egw_wf_external_application', ?, true)", array($externalApplicationSequence)); + + foreach ($externalApplicationACLData as $newRow) + $result = $GLOBALS['phpgw']->ADOdb->query("INSERT INTO egw_wf_admin_access(admin_access_id, tipo, numvalue, nivel) VALUES (?, 'APX', ?, 0)", $newRow); + } + + #updating the current version + $GLOBALS['setup_info']['workflow']['currentver'] = '1.4.03.000'; + return $GLOBALS['setup_info']['workflow']['currentver']; + } + + $test[] = '1.4.03.000'; + function workflow_upgrade1_4_03_000() + { + if (!$GLOBALS['phpgw_setup']->oProc->m_bDeltaOnly) + { + $workflowHostInfo = extractDatabaseParameters(); + + /* connect to the new database */ + $workflowDB = $GLOBALS['phpgw']->ADOdb; + if ($workflowDB->connect($workflowHostInfo['host'], $workflowHostInfo['user'], $workflowHostInfo['password'], 'workflow')) + { + /* add a new column to the funcionario_status table (orgchart) */ + $workflowDB->query('ALTER TABLE funcionario_status ADD COLUMN exibir character varying(1)'); + $workflowDB->query('UPDATE funcionario_status SET exibir = ?', array('S')); + $workflowDB->query('ALTER TABLE funcionario_status ALTER COLUMN exibir SET NOT NULL'); + } + + /* reconnect to the previous database */ + $GLOBALS['phpgw']->ADOdb->connect($workflowHostInfo['host'], $workflowHostInfo['user'], $workflowHostInfo['password'], $workflowHostInfo['dbname']); + } + + #updating the current version + $GLOBALS['setup_info']['workflow']['currentver'] = '1.4.04.000'; + return $GLOBALS['setup_info']['workflow']['currentver']; + } + + $test[] = '1.4.04.000'; + function workflow_upgrade1_4_04_000() + { + /* remove unused table */ + $GLOBALS['phpgw_setup']->oProc->DropTable('egw_wf_instance_supplements'); + + if (!$GLOBALS['phpgw_setup']->oProc->m_bDeltaOnly) + { + $GLOBALS['phpgw']->ADOdb->query('ALTER TABLE egw_wf_instances ALTER COLUMN wf_next_user TYPE text'); + $GLOBALS['phpgw']->ADOdb->SetFetchMode(ADODB_FETCH_ASSOC); + $result = $GLOBALS['phpgw']->ADOdb->query('SELECT i.wf_instance_id, ia.wf_activity_id, i.wf_next_user FROM egw_wf_instances i, egw_wf_instance_activities ia WHERE (i.wf_instance_id = ia.wf_instance_id) AND (i.wf_next_user IS NOT NULL)'); + if (!empty($result)) + { + while ($res = $result->fetchRow()) + { + $newNextUser = base64_encode(serialize(array('*' . $res['wf_activity_id'] => $res['wf_next_user']))); + $ok = $GLOBALS['phpgw']->ADOdb->query( + 'UPDATE egw_wf_instances SET wf_next_user = ? WHERE (wf_instance_id = ?)', + array($newNextUser, (int)$res['wf_instance_id']) + ); + } + } + + $workflowHostInfo = extractDatabaseParameters(); + + /* connect to the new database */ + $workflowDB = $GLOBALS['phpgw']->ADOdb; + if ($workflowDB->connect($workflowHostInfo['host'], $workflowHostInfo['user'], $workflowHostInfo['password'], 'workflow')) + { + /* add a new column to the organizacao table (orgchart) */ + $workflowDB->query('ALTER TABLE organizacao ADD COLUMN url_imagem character varying(200)'); + } + + /* reconnect to the previous database */ + $GLOBALS['phpgw']->ADOdb->connect($workflowHostInfo['host'], $workflowHostInfo['user'], $workflowHostInfo['password'], $workflowHostInfo['dbname']); + } + + #updating the current version + $GLOBALS['setup_info']['workflow']['currentver'] = '1.4.05.000'; + return $GLOBALS['setup_info']['workflow']['currentver']; + } + + $test[] = '1.4.05.000'; + function workflow_upgrade1_4_05_000() + { + $GLOBALS['phpgw_setup']->oProc->AddColumn('egw_wf_external_application' ,'intranet_only', array('type' => 'bit', 'precision' => '1', 'nullable' => True)); + + #updating the current version + $GLOBALS['setup_info']['workflow']['currentver'] = '1.4.06.000'; + return $GLOBALS['setup_info']['workflow']['currentver']; + } + + $test[] = '1.4.06.000'; + function workflow_upgrade1_4_06_000() + { + #updating the current version + $GLOBALS['setup_info']['workflow']['currentver'] = '1.6.00.000'; + return $GLOBALS['setup_info']['workflow']['currentver']; + } + + $test[] = '1.6.00.000'; + function workflow_upgrade1_6_00_000() + { + if (!$GLOBALS['phpgw_setup']->oProc->m_bDeltaOnly) + { + $workflowHostInfo = extractDatabaseParameters(); + + /* connect to the new database */ + $workflowDB = $GLOBALS['phpgw']->ADOdb; + if ($workflowDB->connect($workflowHostInfo['host'], $workflowHostInfo['user'], $workflowHostInfo['password'], 'workflow')) + { + /* create the new tables and add the referencial constraints */ + $workflowDB->query('CREATE TABLE cargo (cargo_id serial NOT NULL, descricao character varying(150), organizacao_id int4)'); + $workflowDB->query('ALTER TABLE ONLY cargo ADD CONSTRAINT cargo_pkey PRIMARY KEY (cargo_id)'); + $workflowDB->query('ALTER TABLE ONLY cargo ADD CONSTRAINT "$1" FOREIGN KEY (organizacao_id) REFERENCES organizacao (organizacao_id)'); + $workflowDB->query('CREATE TABLE funcionario_categoria (funcionario_categoria_id serial NOT NULL, descricao character varying(150), organizacao_id int4)'); + $workflowDB->query('ALTER TABLE ONLY funcionario_categoria ADD CONSTRAINT funcionario_categoria_pkey PRIMARY KEY (funcionario_categoria_id)'); + $workflowDB->query('ALTER TABLE ONLY funcionario_categoria ADD CONSTRAINT "$1" FOREIGN KEY (organizacao_id) REFERENCES organizacao (organizacao_id)'); + + /* add a new column to the organizacao table (orgchart) */ + $workflowDB->query('ALTER TABLE funcionario ADD COLUMN cargo_id int4'); + $workflowDB->query('ALTER TABLE funcionario ADD COLUMN nivel int2'); + $workflowDB->query('ALTER TABLE funcionario ADD COLUMN funcionario_categoria_id int4'); + $workflowDB->query('ALTER TABLE ONLY funcionario ADD CONSTRAINT "$5" FOREIGN KEY (cargo_id) REFERENCES cargo (cargo_id)'); + $workflowDB->query('ALTER TABLE ONLY funcionario ADD CONSTRAINT "$6" FOREIGN KEY (funcionario_categoria_id) REFERENCES funcionario_categoria (funcionario_categoria_id)'); + + /* set the permissions to the database objects */ + $dbObjects = array('cargo', 'cargo_cargo_id_seq', 'funcionario_categoria', 'funcionario_categoria_funcionario_categoria_id_seq'); + foreach ($dbObjects as $dbObject) + { + $workflowDB->query("GRANT ALL ON TABLE $dbObject TO admin_workflow"); + $workflowDB->query("GRANT ALL ON TABLE $dbObject TO postgres"); + $workflowDB->query("GRANT SELECT ON TABLE $dbObject TO public"); + } + } + + /* reconnect to the previous database */ + $GLOBALS['phpgw']->ADOdb->connect($workflowHostInfo['host'], $workflowHostInfo['user'], $workflowHostInfo['password'], $workflowHostInfo['dbname']); + } + + #updating the current version + $GLOBALS['setup_info']['workflow']['currentver'] = '1.6.01.000'; + return $GLOBALS['setup_info']['workflow']['currentver']; + } + + $test[] = '1.6.01.000'; + function workflow_upgrade1_6_01_000() + { + if (!$GLOBALS['phpgw_setup']->oProc->m_bDeltaOnly) + { + /* tries to load the 'files_dir' value (usually '/home/expressolivre') */ + $GLOBALS['phpgw']->ADOdb->SetFetchMode(ADODB_FETCH_ASSOC); + $result = $GLOBALS['phpgw']->ADOdb->query('SELECT config_value FROM phpgw_config WHERE config_app = ? AND config_name = ?', array('phpgwapi', 'files_dir')); + if (!(empty($result))) + { + $res = $result->fetchRow(); + + /* initialize some variables */ + $resourcesBase = $res['config_value']; + $oldResourcesDir = PHPGW_SERVER_ROOT . '/workflow/resources'; + $success = true; + + /* if the resources dir exists, move it's subdirectories */ + if (is_dir($oldResourcesDir)) + { + $success = false; + $handle = opendir($oldResourcesDir); + if ($handle) + { + $success = true; + $OKToDeleteDir = true; + + /* move all subdirectories (except the '.' and '..' for oubvious reasons) to their new place */ + while (false !== ($processDir = readdir($handle))) + { + if (($processDir == '.') || ($processDir == '..')) + continue; + + /* check if we are dealing with a directory */ + if (!is_dir($oldResourcesDir . '/' . $processDir)) + { + $OKToDeleteDir = false; + continue; + } + + /* special treatment for the workflow directory */ + if ($processDir == 'workflow') + { + $success = $success && @rename($oldResourcesDir . '/' . $processDir, $resourcesBase . '/workflow/workflow'); + continue; + } + + /* if the destination directory exists, move it */ + $newProcessDir = $resourcesBase . '/workflow/' . $processDir; + if (is_dir($newProcessDir)) + $success = $success && @rename($oldResourcesDir . '/' . $processDir, $newProcessDir . '/resources'); + else + $OKToDeleteDir = false; + } + + /* close the handler */ + closedir($handle); + + /* if the directory is empty, remove it */ + if ($OKToDeleteDir && $success) + if (!@rmdir($oldResourcesDir)) + echo 'Não foi possível remover o diretório: ' . $oldResourcesDir . '";print_r($_REQUEST);echo ""; + //[__leave_activity] is setted if needed in the xxx_pre code or by the user in his code + // HERE the user code is 'executed'. Note that we do not use include_once or require_once because + //it could the same code several times with automatic activities looping in the graph and it still + //need to be executed + $_engineProcessCodeDirectory = GALAXIA_PROCESSES . SEP . $this->process->getNormalizedName(). SEP . 'code'; + $_engineCompilerDirectory = GALAXIA_LIBRARY . SEP . 'compiler'; + $_engineFiles = array(); + + /* generate the list of needed files */ + $_engineFiles[] = "{$_engineProcessCodeDirectory}/shared.php"; + $_engineFiles[] = "{$_engineCompilerDirectory}/_shared_pre.php"; + $_engineFiles[] = "{$_engineCompilerDirectory}/{$activity->getType()}_pre.php"; + if ($activity->getAgents() !== false) + $_engineFiles[] = "{$_engineCompilerDirectory}/agents_pre.php"; + $_engineFiles[] = "{$_engineProcessCodeDirectory}/activities/{$activity->getNormalizedName()}.php"; + $_engineFiles[] = "{$_engineCompilerDirectory}/{$activity->getType()}_pos.php"; + if ($activity->getAgents() !== false) + $_engineFiles[] = "{$_engineCompilerDirectory}/agents_pos.php"; + $_engineFiles[] = "{$_engineCompilerDirectory}/_shared_pos.php"; + + /* check if the required files exists */ + foreach ($_engineFiles as $_engineFile) + if (!file_exists($_engineFile)) + return array('failure' => $this->runtime->fail(lang('the following file could not be found: %1', $_engineFile), true, _DEBUG)); + + /* activate the security policy */ + $GLOBALS['workflow']['factory']->getInstance('WorkflowSecurity')->enableSecurityPolicy(); + + /* include the files */ + foreach ($_engineFiles as $_engineFile) + require $_engineFile; + + unset($GLOBALS['workflow_env']); + + /* check if the developer wants to user the download mode */ + if (isset($GLOBALS['workflow']['downloadMode']) && ($GLOBALS['workflow']['downloadMode'] == true)) + $this->download_mode = true; + + if ($auto && (!$this->isChildInstance) && $activity->isInteractive() && (!empty($actualUser))) + { + $_SESSION['phpgw_info']['workflow']['user_groups'] = $actualUserGroups; + $_SESSION['phpgw_info']['workflow']['account_id'] = $actualUser; + $GLOBALS['phpgw_info']['user']['account_id'] = $actualUser; + $GLOBALS['workflow']['wf_user_id'] = $actualUser; + $GLOBALS['user'] = $actualUser; + } + + //Now that the instance is ready and that user code has maybe change some things + // we can catch some others usefull vars + $this->instance_id = $instance->getInstanceId(); + $this->instance_name = $instance->getName(); + $this->instance_owner = $instance->getOwner(); + $this->owner_name = $GLOBALS['phpgw']->accounts->id2name($this->instance_owner); + if ($this->owner_name == '') + { + $this->owner_name = lang('Nobody'); + } + $GLOBALS['workflow']['wf_instance_id'] =& $this->instance_id; + $GLOBALS['workflow']['wf_instance_name']=& $this->instance_name; + $GLOBALS['workflow']['wf_instance_owner']=& $this->instance_owner; + $GLOBALS['workflow']['wf_owner_name']=& $this->owner_name; + + //was template changed? + if ($_template_name) + { + $this->_template_name = $_template_name; + } + else + { + $this->_template_name = $this->activity->getNormalizedName().'.tpl'; + } + + // TODO: process instance comments + + $instructions = $this->runtime->handle_postUserCode(_DEBUG); + switch($instructions['action']) + { + //interactive activity completed + case 'completed': + // re-retrieve instance data which could have been modified by an automatic activity + $this->instance_id = $instance->getInstanceId(); + $this->instance_name = $instance->getName(); + $this->activityCompleteMessage = $instance->getActivityCompleteMessage(); + + if (!$auto) + { + $this->assignCommonVariables(); + // and display completed template + if ($GLOBALS['phpgw_info']['user']['preferences']['workflow']['show_activity_complete_page'] === '0') + header('Location: workflow/index.php'); + else + $this->showCompletedPage(); + } + break; + //interactive activity still in interactive mode + case 'loop': + if (!$auto) + { + $this->assignCommonVariables(); + $this->showForm(); + } + break; + //nothing more + case 'leaving': + if (!$auto) + { + $this->assignCommonVariables(); + $this->showCancelledPage(); + } + break; + //non-interactive activities, auto-mode + case 'return': + $result=Array(); + $this->message[] = $this->GUI->get_error(false, _DEBUG); + $this->message[] = $this->runtime->get_error(false, _DEBUG); + //$this->message[] = $this->process->get_error(false, _DEBUG); + $result =& $instructions['engine_info']; + $this->message[] = $result['debug']; + $result['debug'] = implode('
Debug: ' . $name . ' | |||
---|---|---|---|
Backtrace | '; + $output .= '';
+
+ $i = 1;
+ $output .= '
| ||
$_REQUEST | '; + $output .= ''; + $output .= ' | ||
Banco de Dados | ' . (($env['dao']->Link_ID === 0) ? 'não conectado' : 'conectado') . ' |
";print_r($items);echo ""; + $this->show_list_processes($items['data'], $items['cant']); + + if ($this->wf_p_id) + { + // check process validity and show errors if necessary + if ($checkvalidity) $proc_info['wf_is_valid'] = $this->show_errors($this->activity_manager, $error_str); + } + + //collect some messages from used objects + $this->message[] = $this->activity_manager->get_error(false, _DEBUG); + $this->message[] = $this->process_manager->get_error(false, _DEBUG); + + // show current process + $this->t->set_var(array( + 'errors' => $error_str, + 'txt_Process_Name' => lang('Process Name'), + 'link_new' => $GLOBALS['phpgw']->link('/index.php', array_merge( array( + 'menuaction' => $this->form_action, + 'p_id' => 0,), $this->link_data) + ), + 'p_id' => $proc_info['wf_p_id'], + 'name' => $proc_info['wf_name'], + 'version' => $proc_info['wf_version'], + 'description' => $proc_info['wf_description'], + 'is_active' => ($proc_info['wf_is_active'] == 'y')? 'checked="checked"' : '', + 'btn_update_create' => ($this->wf_p_id)? lang('update') : lang('create'), + 'list_processes' => lang('List of processes'), + )); + // show process config values + $this->show_process_config($known_config_items); + + $this->fill_form_variables(); + $this->finish(); + } + /** + * Delete processes + * @param array $process_ids + * @access public + * @return void + */ + function delete_processes($process_ids) + { + foreach ($process_ids as $process_id) + { + $this->process_manager->remove_process($process_id); + } + } + + /** + * Show the list of process configuration options + * Use the process_config array member which should be already setted. Show a table with a line for each config + * value containing [Yes-No/value/select | default] choices. + * @param array $known_config_itemns The parameter is an array containing all known config items and is used to show all config items, as only + * the ones changed for this process are stored in process_config.You should give this function all config_names avaible at process level associated with type which + * is 'yesno' or 'text' or an associative array with key 'select' containing an array of the select values + * to show (array: key => value) ==> (select: name => value) + * You can add titles by giving the title in the config_name and 'title' as type. + * + * @return void + * @access public + */ + function show_process_config(&$known_config_items) + { + + $siteconfiglink = ''.lang('Workflow Site Configuration').''; + $this->t->set_var(array( + 'txt_consult_site_config_with_link' => lang ('Consult %1 to get the default values:',$siteconfiglink), + )); + + $this->t->set_block('admin_processes', 'block_config_table_empty', 'config_table_empty'); + $this->t->set_block('admin_processes', 'block_config_table_title', 'config_table_title'); + $this->t->set_block('admin_processes', 'block_config_table_yesno', 'config_table_yesno'); + $this->t->set_block('admin_processes', 'block_config_table_text', 'config_table_text'); + $this->t->set_block('admin_processes', 'block_config_table_password', 'config_table_password'); + $this->t->set_block('admin_processes', 'block_config_table_select_option', 'config_table_select_option'); + $this->t->set_block('admin_processes', 'block_config_table_select', 'config_table_select'); + $this->translate_template('block_config_table_title'); + $this->translate_template('block_config_table_yesno'); + $this->translate_template('block_config_table_text'); + $this->translate_template('block_config_table_password'); + $this->translate_template('block_config_table_empty'); + $this->translate_template('block_config_table_select'); + + if (!(is_array($known_config_items)) || !count($known_config_items)) + { + $this->t->set_var(array( + 'config_empty' => lang('There are no config value defined'), + 'config_table_title' => '', + 'config_table_yesno' => '', + 'config_table_text' => '', + 'config_table_password' => '', + 'config_table_select' => '', + )); + + $this->t->parse('config_table_empty', 'block_config_table_empty', true); + } + else + { + //we wont need the 'empty config' row + $this->t->set_var(array('config_table_empty'=> '')); + //we prepare the global table rows + $this->t->set_block('admin_processes', 'block_config_table', 'config_table'); + $this->translate_template('block_config_table'); + // we parse the config items we knows + while(list($config_name, $config_type) = each($known_config_items)) + { + // now rows can be of different types + if (is_array($config_type)) + {//we have a select + unset($row_value); + $row_value = $this->process_config[$config_name]; + + reset($config_type); + for($i = 0; ($current =& each($config_type) != null); $i++){ + $this->t->set_var(array( + 'config_option_name' => $current['value'], + 'config_option_value' => $current['key'], + 'config_option_selected' => ($current['key'] == $row_value)? 'selected' : '', + ));//DEBUG TODO selected value? + $this->t->parse('config_table_select_option', 'block_config_table_select_option', (($i == 0) ? false : true )); + } + + $this->t->set_var(array( + 'config_name' => $config_name, + 'config_name_trad' => lang(str_replace('_',' ',$config_name)), + 'color_line' => $this->nextmatchs->alternate_row_color($tr_color), + 'config_table_title' => '', + 'config_table_text' => '', + 'config_table_password' => '', + 'config_table_yesno' => '', + )); + + $this->t->parse('config_table_select', 'block_config_table_select', false); + } + elseif ($config_type=='title') + { + $this->t->set_var(array( + 'config_name_trad' => lang(str_replace('_',' ',$config_name)), + 'color_line' => '#D3DCE3', + 'config_table_text' => '', + 'config_table_password' => '', + 'config_table_yesno' => '', + 'config_table_select' => '' + )); + $this->t->parse('config_table_title', 'block_config_table_title', false); + } + + else + { + // if not title or select our row can be a text value or a Yes/No/Default value + $this->t->set_var(array( + 'config_name' => $config_name, + 'config_name_trad' => lang(str_replace('_',' ',$config_name)), + 'color_line' => $this->nextmatchs->alternate_row_color($tr_color), + 'config_table_title' => '', + 'config_table_select' => '', + )); + unset($row_value); + $row_value = $this->process_config[$config_name]; + if ($config_type=='text') + { + if (isset($row_value)) + { + $this->t->set_var(array( + 'config_value' => $row_value, + 'config_use_default_checked' => '', + 'txt_Use_Default' => lang('Use Default'), + 'config_table_password' => '', + 'config_table_yesno' => '', + )); + } + else + { + $this->t->set_var(array( + 'config_value' => '', + 'config_use_default_checked' => 'checked', + 'txt_Use_Default' => lang('Use Default'), + 'config_table_password' => '', + 'config_table_yesno' => '', + )); + } + $this->t->parse('config_table_text', 'block_config_table_text', false); + } + elseif ($config_type=='password') + { + $config = array( + 'config_table_text' => '', + 'config_value' => '', + 'config_use_default_checked' => 'checked', + 'txt_Use_Default' => lang('Use Default'), + 'config_table_yesno' => '' + ); + if (isset($row_value)) + { + $config['config_value'] =$row_value; + $config['config_use_default_checked'] = ''; + } + $this->t->set_var($config); + $this->t->parse('config_table_password', 'block_config_table_password', false); + } + elseif ($config_type=='yesno') + { + if (isset($row_value)) + { + $this->t->set_var(array( + 'config_table_text' => '', + 'config_table_password' => '', + 'config_default_selected' => '', + 'config_yes_selected' => ($row_value==1)? 'selected':'', + 'config_no_selected' => ($row_value==1)? '':'selected', + )); + } + else + { + $this->t->set_var(array( + 'config_table_text' => '', + 'config_table_password' => '', + 'config_default_selected' => 'selected', + 'config_yes_selected' => '', + 'config_no_selected' => '', + )); + } + $this->t->parse('config_table_yesno', 'block_config_table_yesno', false); + } + } + $this->t->parse('config_table','block_config_table',true); + } + } + } + /** + * Show list of processes + * @param $items + * @param int $total_number + * @access public + * @return void + */ + function show_list_processes(&$items, $total_number) + { + $header_array = array( + 'wf_name' => lang('Process'), + 'wf_version' => lang('Version'), + 'wf_is_active' => lang('Active'), + 'wf_is_valid' => lang('Valid'), + ); + $this->fill_nextmatchs($header_array,$total_number); + + // filter_active, "", y or n + $this->t->set_var(array( + 'filter_active_selected_all' => ($this->filter_active=='')? 'selected':'', + 'filter_active_selected_y' => ($this->filter_active=='y')? 'selected':'', + 'filter_active_selected_n' => ($this->filter_active=='n')? 'selected':'', + )); + $get_link = array( + 'menuaction' => 'workflow.ui_'. $this->class_name .'.form', + 'search_str' => $this->search_str, + 'start' => $this->start, + 'sort' => $this->sort, + 'order' => $this->order, + ); + $get_link = array_merge($get_link, $this->link_data); + foreach ($items as $item) + { + if ($item['wf_is_valid'] == 'y') + { + $dot = 'green'; + $alt = lang('Valid Process'); + } + else + { + $dot = 'red'; + $alt = lang('Invalid Process'); + } + + $myp_id = $item['wf_p_id']; + $templateServer = &$GLOBALS['workflow']['factory']->getInstance('TemplateServer'); + $this->t->set_var(array( + 'item_wf_p_id' => $myp_id, + 'href_item_name' => $GLOBALS['phpgw']->link('/index.php', array_merge($get_link,array('p_id' => $myp_id))), + 'item_name' => $item['wf_name'], + 'item_version' => $item['wf_version'], + 'img_active' => ($item['wf_is_active'] == 'y')? '' : '', + 'img_valid' => '', + 'href_item_minor' => $GLOBALS['phpgw']->link('/index.php', array_merge($get_link,array('newminor' => $myp_id))), + 'img_new' => $GLOBALS['phpgw']->common->image('workflow', 'new'), + 'href_item_major' => $GLOBALS['phpgw']->link('/index.php', array_merge($get_link,array('newmajor' => $myp_id))), + 'href_item_activities' => $GLOBALS['phpgw']->link('/index.php', array( + 'menuaction' => 'workflow.ui_adminactivities.form', + 'p_id' => $myp_id)), + 'img_activities' => $templateServer->generateImageLink('Activity.gif'), + 'href_item_code' => $GLOBALS['phpgw']->link('/index.php', array( + 'menuaction' => 'workflow.ui_adminsource.form', + 'p_id' => $myp_id)), + 'img_code' => $templateServer->generateImageLink('code.png'), + 'href_item_export' => $GLOBALS['phpgw']->link('/index.php', array( + 'menuaction' => 'workflow.WorkflowUtils.export', + 'p_id' => $myp_id)), + 'img_export' => $templateServer->generateImageLink('save.png'), + 'href_item_roles' => $GLOBALS['phpgw']->link('/index.php', array( + 'menuaction' => 'workflow.ui_adminroles.form', + 'p_id' => $myp_id)), + 'img_roles' => $templateServer->generateImageLink('roles.png'), + 'href_item_jobs' => $GLOBALS['phpgw']->link('/index.php', array( + 'menuaction' => 'workflow.ui_adminjobs.form', + 'p_id' => $myp_id)), + 'img_jobs' => $templateServer->generateImageLink('clock.png'), + 'color_line' => $this->nextmatchs->alternate_row_color($tr_color), + )); + $this->t->parse('items', 'block_items', True); + } + if (!count($items)) $this->t->set_var('items', '