Untitled

mail@pastecode.io avatar
unknown
php
2 months ago
2.2 kB
5
Indexable
Never
<?php

$es_nuevo_rol_dental_y_ayuda = in_array($workflow_instance->workflow_definition->custom_dynamic_form_reference, [CustomDynamicFormFactory::COPEC_DENTAL_BUDGET_HELP, CustomDynamicFormFactory::COPEC_DENTAL_EXPENSE_HELP, CustomDynamicFormFactory::COPEC_SPECIAL_HELP]);
        if($es_nuevo_rol_dental_y_ayuda){
            $es_rol_dental = in_array($workflow_instance->workflow_definition->custom_dynamic_form_reference, [CustomDynamicFormFactory::COPEC_DENTAL_BUDGET_HELP, CustomDynamicFormFactory::COPEC_DENTAL_EXPENSE_HELP]);
            $relation_name = __('Supervisor de Ayuda {0}', [$es_rol_dental ? 'Dental' : 'Especial']);
            if(!empty($workflow_instance_supervisor_ids = TableRegistry::get('IntranetRoles')->getUserIdsWithRole([IntranetRoleType::DENTAL_SUPERVISOR, IntranetRoleType::SPECIAL_HELP_SUPERVISOR ]))){
                $find_options = $list_array;
                $find_options['conditions'] = ['UserCreators.id IN' => $workflow_instance_supervisor_ids, 'UserCreators.active' => true];
                $find_options['ignore_any_filter_perfilation'] = true;
                $names_list = $this->UserCreators->find('list', $find_options)->toArray();
                foreach ($names_list as $user_name) {
                    $step_data[] = [
                        'user_name' => $user_name,
                        'relationship' => $relation_name,
                    ];
                }
            }
        }else{
            if (!empty($workflow_instance_supervisor_ids = TableRegistry::get('IntranetRoles')->getUserIdsWithRole(IntranetRoleType::WORKFLOW_INSTANCES_SUPERVISOR))) {
                $find_options = $list_array;
                $find_options['conditions'] = ['UserCreators.id IN' => $workflow_instance_supervisor_ids, 'UserCreators.active' => true];
                $find_options['ignore_any_filter_perfilation'] = true;
                $names_list = $this->UserCreators->find('list', $find_options)->toArray();
                foreach ($names_list as $user_name) {
                    $step_data[] = [
                        'user_name' => $user_name,
                        'relationship' => $relation_name,
                    ];
                }
            }
        }
Leave a Comment