更新 'installer/Migration/V5_4_1/Migration.php'

This commit is contained in:
zhongjin 2023-05-06 08:38:43 +08:00
parent c76feab267
commit d19fc07944

View File

@ -54,7 +54,7 @@ class Migration extends AbstractMigration
*/
public function getVersion(): string
{
return '5.4.2';
return '5.4.1';
}
private function updateLangStringVersion(string $version): void
@ -159,73 +159,5 @@ class Migration extends AbstractMigration
->fetchOne();
}
public function checkClaimExists(): bool
{
return $this->getConnection()->createQueryBuilder()
->select('id')
->from('ohrm_menu_item')
->where('menu_title = :menu_title')
->setParameter('menu_title', 'Claim')
->executeQuery()
->fetchOne();
}
private function cleanClaimScreens(): void
{
$screenNames = [
'Events',
'Expense Types',
'Employee Claim List',
'Assign Claim',
'Submit Claim',
'My Claims List',
'View Claim Module',
'View Create Event',
'View Create Expense'
];
$qb = $this->createQueryBuilder()
->delete('ohrm_screen');
$qb->andWhere($qb->expr()->in('ohrm_screen.name', ':screenName'))
->setParameter('screenName', $screenNames, Connection::PARAM_STR_ARRAY)
->executeQuery();
}
private function insertWorkflowState(
string $state,
string $role,
int $action,
string $resultingState,
int $priority
): void {
$this->createQueryBuilder()
->insert('ohrm_workflow_state_machine')
->values(
[
'workflow' => ':workflow',
'state' => ':state',
'role' => ':role',
'action' => ':action',
'resulting_state' => ':resultingState',
'roles_to_notify' => ':rolesToNotify',
'priority' => ':priority',
]
)
->setParameter('workflow', WorkflowStateMachine::FLOW_CLAIM)
->setParameter('state', $state)
->setParameter('role', $role)
->setParameter('action', $action)
->setParameter('resultingState', $resultingState)
->setParameter('rolesToNotify', '')
->setParameter('priority', $priority)
->executeQuery();
}
private function deleteClaimWorkflowStates(): void
{
$this->createQueryBuilder()
->delete('ohrm_workflow_state_machine')
->where('workflow = :workflow')
->setParameter('workflow', 'CLAIM')
->executeQuery();
}
}