Fork me on GitHub

Résultats CPD

Le document suivant contient les résultats de l'inspection CPD CPD 6.13.0.

Duplicatas

Fichier Ligne
fr/paris/lutece/plugins/workflow/modules/ticketing/web/task/ModifyDraftCategoryTaskComponent.java 78
fr/paris/lutece/plugins/workflow/modules/ticketing/web/task/ModifyTicketCategoryTaskComponent.java 78
    private static final String TEMPLATE_TASK_MODIFY_TICKET_CATEGORY_CONFIG = "admin/plugins/workflow/modules/ticketing/task_modify_ticket_category_config.html";

    // MARKS
    private static final String MARK_CONFIG = "config";
    private static final String MARK_CONFIG_ALL_ENTRY = "form_entries";
    private static final String MARK_CONFIG_SELECTED_ENTRY = "selected_form_entry";
    private static final String MARK_ID_TASK = "id_task";

    // Message reply
    private static final String MESSAGE_MODIFY_TICKET_ATTRIBUTE_ERROR = "module.workflow.ticketing.task_modify_ticket_attribute.error";

    @Inject
    private TicketFormService _ticketFormService;

    private static final String PROPERTY_ACCOUNT_NUMBER_REGEXP = "module.workflow.ticketingfacilfamilles.workflow.automatic_assignment.accountNumberRegexp";
    private static final String PROPERTY_FF_CODE = "module.workflow.ticketingfacilfamilles.workflow.automatic_assignment.accountNumberFieldCode";
    private static final String MESSAGE_ERROR_FACIL_EMPTY_VALIDATION = "ticketing.validation.ticket.TicketFacilNumber.size";
    private static final String MESSAGE_ERROR_FACIL_REGEX_VALIDATION = "ticketing.validation.ticket.TicketFacilNumber.regex";

    /**
     * {@inheritDoc}
     */
    @Override
    public String getDisplayConfigForm( HttpServletRequest request, Locale locale, ITask task )
    {
        TaskModifyTicketCategoryConfig config = getTaskConfigService( ).findByPrimaryKey( task.getId( ) );

        EntryFilter entryFilter = new EntryFilter( );
        entryFilter.setResourceType( TicketingConstants.RESOURCE_TYPE_INPUT );
        entryFilter.setEntryParentNull( EntryFilter.FILTER_TRUE );
        entryFilter.setFieldDependNull( EntryFilter.FILTER_TRUE );
        entryFilter.setIdIsComment( EntryFilter.FILTER_FALSE );

        List<Entry> lReferenceEntry = EntryHome.getEntryList( entryFilter );

        Map<String, Object> model = new HashMap<>( );
        model.put( MARK_CONFIG, config );
        model.put( MARK_CONFIG_ALL_ENTRY, mergeConfigAndReference( config, lReferenceEntry ) );

        HtmlTemplate template = AppTemplateService.getTemplate( TEMPLATE_TASK_MODIFY_TICKET_CATEGORY_CONFIG, locale, model );

        return template.getHtml( );
    }

    private ReferenceList mergeConfigAndReference( TaskModifyTicketCategoryConfig config, List<Entry> lReferenceEntry )
    {
        ReferenceList refList = new ReferenceList( );

        for ( Entry refEntry : lReferenceEntry )
        {
            ReferenceItem refItem = new ReferenceItem( );
            refItem.setCode( Integer.toString( refEntry.getIdEntry( ) ) );

            refItem.setName( refEntry.getTitle( ) + " (" + refEntry.getEntryType( ).getTitle( ) + ")" );
            refItem.setChecked( config.getSelectedEntries( ).contains( refEntry.getIdEntry( ) ) );

            refList.add( refItem );
        }

        return refList;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String doSaveConfig( HttpServletRequest request, Locale locale, ITask task )
    {
        TaskModifyTicketCategoryConfig config = getTaskConfigService( ).findByPrimaryKey( task.getId( ) );
        String [ ] tSelectedEntries = new String [ ] { };
        config.clearSelectedEntries( );

        if ( request.getParameterValues( MARK_CONFIG_SELECTED_ENTRY ) != null )
        {
            tSelectedEntries = request.getParameterValues( MARK_CONFIG_SELECTED_ENTRY );
        }

        for ( String strSelectedEntry : tSelectedEntries )
        {
            config.addSelectedEntry( Integer.parseInt( strSelectedEntry ) );
        }

        getTaskConfigService( ).update( config );

        return null;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String getDisplayTaskForm( int nIdResource, String strResourceType, HttpServletRequest request, Locale locale, ITask task )
    {
        Ticket ticket = getTicket( nIdResource, strResourceType );
        _ticketFormService.saveTicketInSession( request.getSession( ), ticket );

        Map<String, Object> model = getModel( ticket );

        model.put( TicketingConstants.MARK_TICKET_CATEGORIES_TREE, TicketCategoryService.getInstance( true ).getCategoriesTree( ).getTreeJSONObject( ) );
        model.put( TicketingConstants.MARK_TICKET_CATEGORIES_DEPTHS, TicketCategoryService.getInstance( true ).getCategoriesTree( ).getDepths( ) );
        model.put( MARK_ID_TASK, task.getId( ) );

        HtmlTemplate template = AppTemplateService.getTemplate( TEMPLATE_TASK_MODIFY_TICKET_CATEGORY_FORM, locale, model );

        return template.getHtml( );
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String doValidateTask( int nIdResource, String strResourceType, HttpServletRequest request, Locale locale, ITask task )
    {
        Ticket ticket = getTicket( nIdResource, strResourceType );
        StringBuilder strError = new StringBuilder( StringUtils.EMPTY );
        List<String> listErrors = new ArrayList<>( );

        TicketCategoryValidatorResult categoryValidatorResult = new TicketCategoryValidator( request, locale ).validateTicketCategory( );

        // Check if a category have been selected
        if ( !categoryValidatorResult.isTicketCategoryValid( ) )
        {
            categoryValidatorResult.getListValidationErrors( ).stream( ).forEach( listErrors::add );
        }

        // Validate the selection of items
        if ( categoryValidatorResult.isTicketCategoryValid( ) )
        {
            List<GenericAttributeError> listFormErrors = new ArrayList<>( );
            TaskModifyTicketCategoryConfig config = getTaskConfigService( ).findByPrimaryKey( task.getId( ) );
            List<Entry> listEntry = TicketFormService.getFilterInputs( ticket.getTicketCategory( ).getId( ), config.getSelectedEntries( ) );

            boolean hasFFError = false;
            for ( Entry entry : listEntry )
            {
                listFormErrors.addAll( _ticketFormService.getResponseEntry( request, entry.getIdEntry( ), request.getLocale( ), ticket ) );

                // O2T 79251: contrôle facil'famille
                if ( !hasFFError && isDomainFacilFamille( categoryValidatorResult.getTicketCategory( ) ) )
                {
                    for ( GenericAttributeError error : listFormErrors )
                    {
                        if ( error.getErrorMessage( ).contains( "Facil'Famille" ) || error.getErrorMessage( ).contains( UtilConstants.CATEGORY_LABEL_PARIS_FAMILLE ) )
                        {
                            hasFFError = true;
                            break;
                        }
                    }
                    if ( !hasFFError && entry.getCode( ).equals( AppPropertiesService.getProperty( PROPERTY_FF_CODE ) ) )
                    {
                        String strFacilFamilleNumber = request.getParameter( "attribute" + entry.getIdEntry( ) );
                        if ( strFacilFamilleNumber != null )
                        {
                            if ( strFacilFamilleNumber.trim( ).isEmpty( ) )
                            {
                                GenericAttributeError formError = new GenericAttributeError( );
                                formError.setErrorMessage( I18nService.getLocalizedString( MESSAGE_ERROR_FACIL_EMPTY_VALIDATION, request.getLocale( ) ) );
                                listFormErrors.add( formError );
                                hasFFError = true;
                            }
                            else
                                if ( !strFacilFamilleNumber.matches( AppPropertiesService.getProperty( PROPERTY_ACCOUNT_NUMBER_REGEXP ) ) )
                                {
                                    GenericAttributeError formError = new GenericAttributeError( );
                                    formError.setErrorMessage( I18nService.getLocalizedString( MESSAGE_ERROR_FACIL_REGEX_VALIDATION, request.getLocale( ) ) );
                                    listFormErrors.add( formError );
                                    hasFFError = true;
                                }
                        }
                    }
                }
            }

            // O2T 79251: contrôle facil'famille
            if ( listEntry.isEmpty( ) && isDomainFacilFamille( categoryValidatorResult.getTicketCategory( ) ) )
            {
                GenericAttributeError facilFamilleError = getFacilFamilleError( request );
                if ( facilFamilleError != null )
                {
                    listFormErrors.add( facilFamilleError );
                }
            }

            if ( !listFormErrors.isEmpty( ) )
            {
                for ( GenericAttributeError formError : listFormErrors )
                {
                    strError.append( formError.getErrorMessage( ) ).append( "<br/>" );
                }

                listErrors.add( strError.toString( ) );
            }
        }

        if ( !listErrors.isEmpty( ) )
        {
            return AdminMessageService.getMessageUrl( request, MESSAGE_MODIFY_TICKET_ATTRIBUTE_ERROR, listErrors.toArray( ), AdminMessage.TYPE_STOP );
        }

        return null;
    }

    private GenericAttributeError getFacilFamilleError( HttpServletRequest request )
    {
        String strFacilFamilleNumber = request.getParameter( "attribute202" );

        if ( strFacilFamilleNumber != null )
        {
            if ( strFacilFamilleNumber.trim( ).isEmpty( ) )
            {
                GenericAttributeError formError = new GenericAttributeError( );
                formError.setErrorMessage( I18nService.getLocalizedString( MESSAGE_ERROR_FACIL_EMPTY_VALIDATION, request.getLocale( ) ) );
                return formError;
            }
            else
                if ( !strFacilFamilleNumber.matches( AppPropertiesService.getProperty( PROPERTY_ACCOUNT_NUMBER_REGEXP ) ) )
                {
                    GenericAttributeError formError = new GenericAttributeError( );
                    formError.setErrorMessage( I18nService.getLocalizedString( MESSAGE_ERROR_FACIL_REGEX_VALIDATION, request.getLocale( ) ) );
                    return formError;
                }
        }

        return null;
    }

    private boolean isDomainFacilFamille( TicketCategory category )
    {
        if ( category != null )
        {
            if ( category.getDepth( ).getDepthNumber( ) > 1 )
            {
                return isDomainFacilFamille( category.getParent( ) );
            }
            else
                if ( category.getDepth( ).getDepthNumber( ) == 1 )
                {
                    return category.getLabel( ).equals( UtilConstants.CATEGORY_LABEL_PARIS_FAMILLE );
                }
                else
                {
                    // ne devrait pas se produire (0 ou négatif)
                    return false;
                }
        }
        return false;
    }

}
Fichier Ligne
fr/paris/lutece/plugins/workflow/modules/ticketing/service/task/TaskModifyDraftCategory.java 74
fr/paris/lutece/plugins/workflow/modules/ticketing/service/task/TaskModifyTicketCategory.java 74
    private static final String MESSAGE_MODIFY_TICKET_CATEGORY_INFORMATION = "module.workflow.ticketing.task_modify_ticket_category.information";
    private static final String MESSAGE_MODIFY_TICKET_ATTRIBUTE_INFORMATION = "module.workflow.ticketing.task_modify_ticket_attribute.information";
    private static final String MESSAGE_NO_VALUE = "module.workflow.ticketing.task_modify_ticket_category.noValue";

    // PARAMETERS
    public static final String PARAMETER_TICKET_CATEGORY_ID = "id_ticket_category";
    public static final String PARAMETER_TICKET_DOMAIN_ID = "id_ticket_domain";
    public static final String PARAMETER_TICKET_TYPE_ID = "id_ticket_type";
    public static final String SEPARATOR = " - ";

    // Beans
    private static final String BEAN_MODIFY_TICKET_CATEGORY_CONFIG_SERVICE = "workflow-ticketing.taskModifyTicketCategoryConfigService";
    @Inject
    private TicketFormService _ticketFormService;
    @Inject
    @Named( BEAN_MODIFY_TICKET_CATEGORY_CONFIG_SERVICE )
    private ITaskConfigService _taskModifyTicketCategoryConfigService;

    @Override
    public String processTicketingTask( int nIdResourceHistory, HttpServletRequest request, Locale locale )
    {
        String strTaskInformation = StringUtils.EMPTY;

        Ticket ticket = getTicket( nIdResourceHistory );

        String [ ] listPreviousTicketCategoryLabel = new String [ TicketCategoryService.getInstance( ).getCategoriesTree( ).getMaxDepthNumber( )];
        Arrays.fill( listPreviousTicketCategoryLabel, "" );

        if ( ticket != null )
        {
            for ( TicketCategory ticketCategory : ticket.getBranch( ) )
            {
                listPreviousTicketCategoryLabel [ticketCategory.getCategoryType( ).getDepthNumber( ) - 1] = ticketCategory.getLabel( );
            }

            // Validate the TicketCategory
            TicketCategoryValidatorResult categoryValidatorResult = new TicketCategoryValidator( request, locale ).validateTicketCategory( );
            ticket.setTicketCategory( categoryValidatorResult.getTicketCategory( ) );

            TicketHome.update( ticket );

            for ( TicketCategory ticketCategory : ticket.getBranch( ) )
            {
                String strPreviousCategoryLabel = listPreviousTicketCategoryLabel [ticketCategory.getCategoryType( ).getDepthNumber( ) - 1];

                if ( !strPreviousCategoryLabel.equals( ticketCategory.getLabel( ) ) )
                {
                    strTaskInformation += MessageFormat.format( I18nService.getLocalizedString( MESSAGE_MODIFY_TICKET_CATEGORY_INFORMATION, locale ),
                            ticketCategory.getCategoryType( ).getLabel( ),
                            StringUtils.isNotEmpty( strPreviousCategoryLabel ) ? strPreviousCategoryLabel
                                    : I18nService.getLocalizedString( MESSAGE_NO_VALUE, locale ),
                                    StringUtils.isNotEmpty( ticketCategory.getLabel( ) ) ? ticketCategory.getLabel( )
                                            : I18nService.getLocalizedString( MESSAGE_NO_VALUE, locale ) );
                }
            }

            if ( ticket.getTicketCategory( ).getId( ) > 0 )
            {
                TaskModifyTicketCategoryConfig config = _taskModifyTicketCategoryConfigService.findByPrimaryKey( getId( ) );
                List<Entry> listEntry = TicketFormService.getFilterInputs( ticket.getTicketCategory( ).getId( ), config.getSelectedEntries( ) );
                // save current values, clear ticket
                List<Response> listCurrentResponse = ticket.getListResponse( );
                ticket.setListResponse( new ArrayList<>( ) );
                List<Response> listResponseToAdd = new ArrayList<>( );
                List<Integer> listResponseIdToDelete = new ArrayList<>( );

                // loop on filtered entry
                for ( Entry entry : listEntry )
                {
                    String strPreviousAttributeValue = StringUtils.EMPTY;
                    String strNewAttributeValue = StringUtils.EMPTY;
                    int nIdCurrentResponse = -1;

                    // current value
                    Iterator<Response> iterator = listCurrentResponse.iterator( );
                    while ( iterator.hasNext( ) )
                    {
                        Response response = iterator.next( );

                        if ( response.getEntry( ).getIdEntry( ) == entry.getIdEntry( ) )
                        {
                            if ( response.getResponseValue( ) != null )
                            {
                                strPreviousAttributeValue += ( " " + response.getResponseValue( ) );
                            }
                            else
                                if ( ( response.getFile( ) != null ) && ( response.getFile( ).getTitle( ) != null ) )
                                {
                                    strPreviousAttributeValue += ( " " + response.getFile( ).getTitle( ) );
                                }
                            // clear the response
                            nIdCurrentResponse = response.getIdResponse( );
                            iterator.remove( );
                            break;
                        }
                    }

                    // new value
                    _ticketFormService.getResponseEntry( request, entry.getIdEntry( ), locale, ticket );
                    Response responseNew = null;
                    for ( Response response : ticket.getListResponse( ) )
                    {
                        if ( response.getEntry( ).getIdEntry( ) == entry.getIdEntry( ) )
                        {
                            if ( response.getResponseValue( ) != null )
                            {
                                strNewAttributeValue += ( " " + response.getResponseValue( ) );
                            }
                            else
                                if ( ( response.getFile( ) != null ) && ( response.getFile( ).getTitle( ) != null ) )
                                {
                                    strNewAttributeValue += ( " " + response.getFile( ).getTitle( ) );
                                }
                            responseNew = response;
                            break;
                        }
                    }

                    // compare
                    if ( !strPreviousAttributeValue.equals( strNewAttributeValue ) )
                    {
                        strTaskInformation += MessageFormat.format(
                                I18nService.getLocalizedString( MESSAGE_MODIFY_TICKET_ATTRIBUTE_INFORMATION, Locale.FRENCH ), entry.getTitle( ),
                                strPreviousAttributeValue, strNewAttributeValue );
                        if ( nIdCurrentResponse != -1 )
                        {
                            listResponseIdToDelete.add( nIdCurrentResponse );
                        }
                        if ( responseNew != null )
                        {
                            listResponseToAdd.add( responseNew );
                        }
                    }
                }

                // remove generic attributes responses updated
                for ( int nIdResponse : listResponseIdToDelete )
                {
                    TicketHome.removeTicketResponse( ticket.getId( ), nIdResponse );
                }

                // add new responses
                for ( Response response : listResponseToAdd )
                {
                    response = ResponseUtil.createResponse( response );
                    if ( response.getFile( ) != null )
                    {
                        // retrait archivage
                    }
                    TicketHome.insertTicketResponse( ticket.getId( ), response.getIdResponse( ) );
                }
            }

            if ( !TicketUtils.isAuthorized( ticket, TicketCategory.PERMISSION_VIEW_DETAIL, AdminUserService.getAdminUser( request ) ) )
            {
                request.setAttribute( TicketingConstants.ATTRIBUTE_REDIRECT_AFTER_WORKFLOW_ACTION, REDIRECT_TO_LIST );
            }
        }

        if ( !strTaskInformation.equals( StringUtils.EMPTY ) )
        {
            strTaskInformation = strTaskInformation.substring( 0, strTaskInformation.length( ) - 5 );
        }

        return strTaskInformation;
    }

    @Override
    public String getTitle( Locale locale )
    {
        return I18nService.getLocalizedString( MESSAGE_MODIFY_DRAFT_CATEGORY, locale );
Fichier Ligne
fr/paris/lutece/plugins/workflow/modules/ticketing/service/task/TaskModifyDraft.java 140
fr/paris/lutece/plugins/workflow/modules/ticketing/service/task/TaskModifyTicket.java 134
                response = ResponseUtil.createResponse( response );
                TicketHome.insertTicketResponse( ticket.getId( ), response.getIdResponse( ) );
            } );

            // Delete old responses
            mapEntry.getValue( ).forEach( response ->
            {
                TicketPj pj = TicketPjHome.findIdPjFromIdResponse( response.getIdResponse( ) );
                if ( ( null != pj ) && ( pj.getStockageTicketing( ) != 0 ) )
                {
                    deletePj( pj );
                }
                TicketHome.removeTicketResponse( ticket.getId( ), response.getIdResponse( ) );
            } );

            strTaskInformation += I18nService.getLocalizedString( MESSAGE_MODIFY_TICKET_ATTACHMENT, locale );
        }
        TicketAsynchronousUploadHandler.getHandler( ).removeSessionFiles( request.getSession( ).getId( ) );
        _ticketFormService.removeTicketFromSession( request.getSession( ) );

        // Populate the Ticket
        Ticket ticketWithNewData = new Ticket( );
        ticketWithNewData.setTicketCategory( new TicketCategory( ) ); // -- to not generate validation error on this field
        BeanUtil.populate( ticketWithNewData, request );

        int idArrondissement = Integer.parseInt( request.getParameter( "id_arrondissement" ) );
        Arrondissement arr = ArrondissementHome.findByPrimaryKey( idArrondissement );

        ticketWithNewData.setArrondissement( arr );

        // Update the ticket adress
        TicketAddress ticketAdressToValidate = new TicketAddress( );
        BeanUtil.populate( ticketAdressToValidate, request );


        if ( ticket != null )
        {
            // Update the user title
            int nNewUserTitleId = ticketWithNewData.getIdUserTitle( );
            if ( nNewUserTitleId != ticket.getIdUserTitle( ) )
            {
                String strCurrentUserTitle = ticket.getUserTitle( );
                String strNewUserTitle = UserTitleHome.findByPrimaryKey( nNewUserTitleId ).getLabel( );
                ticket.setIdUserTitle( nNewUserTitleId );
                ticket.setUserTitle( strNewUserTitle );
                strTaskInformation += formatInfoMessage( MESSAGE_MODIFY_TICKET_USER_TITLE_INFORMATION, strCurrentUserTitle, strNewUserTitle, locale );
            }

            // Update the lastname
            String strNewLatsname = ticketWithNewData.getLastname( );
            String strCurrentLastname = ticket.getLastname( );
            if ( !strCurrentLastname.equals( strNewLatsname ) )
            {
                ticket.setLastname( strNewLatsname );
                strTaskInformation += formatInfoMessage( MESSAGE_MODIFY_TICKET_LASTNAME_INFORMATION, strCurrentLastname, strNewLatsname, locale );
            }

            // Update the firstname
            String strNewFirstname = ticketWithNewData.getFirstname( );
            String strCurrentFirstname = ticket.getFirstname( );
            if ( !strCurrentFirstname.equals( strNewFirstname ) )
            {
                ticket.setFirstname( strNewFirstname );
                strTaskInformation += formatInfoMessage( MESSAGE_MODIFY_TICKET_FIRSTNAME_INFORMATION, strCurrentFirstname, strNewFirstname, locale );
            }

            // Update the email
            String strNewEmail = ticketWithNewData.getEmail( );
            String strCurrentEmail = ticket.getEmail( );
            if ( ( strNewEmail != null ) && !strNewEmail.equals( strCurrentEmail ) )
            {
                ticket.setEmail( strNewEmail );
                strTaskInformation += formatInfoMessage( MESSAGE_MODIFY_TICKET_EMAIL_INFORMATION, strCurrentEmail, strNewEmail, locale );
            }

            // Update the fixed phone number
            String strNewFixedPhoneNumer = ticketWithNewData.getFixedPhoneNumber( );
            String strCurrentFixedPhoneNumber = ticket.getFixedPhoneNumber( );
            if ( ( strNewFixedPhoneNumer != null ) && !strNewFixedPhoneNumer.equals( strCurrentFixedPhoneNumber ) )
            {
                ticket.setFixedPhoneNumber( strNewFixedPhoneNumer );
                strTaskInformation += formatInfoMessage( MESSAGE_MODIFY_TICKET_FIXED_PHONE_NUMBER_INFORMATION, strCurrentFixedPhoneNumber, strNewFixedPhoneNumer, locale );
            }

            // Update the mobile phone number
            String strNewMobilePhoneNumber = ticketWithNewData.getMobilePhoneNumber( );
            String strCurrentMobilePhoneNumber = ticket.getMobilePhoneNumber( );
            if ( ( strNewMobilePhoneNumber != null ) && !strNewMobilePhoneNumber.equals( strCurrentMobilePhoneNumber ) )
            {
                ticket.setMobilePhoneNumber( strNewMobilePhoneNumber );
                strTaskInformation += formatInfoMessage( MESSAGE_MODIFY_TICKET_MOBILE_PHONE_NUMBER_INFORMATION, strCurrentMobilePhoneNumber, strNewMobilePhoneNumber, locale );
            }

            // Update the Address
            String strNewAdress = ticketAdressToValidate.getAddress( );
            String strNewAdressDetail = ticketAdressToValidate.getAddressDetail( );
            String strNewPostalCode = ticketAdressToValidate.getPostalCode( );
            String strNewCity = ticketAdressToValidate.getCity( );
Fichier Ligne
fr/paris/lutece/plugins/workflow/modules/ticketing/service/task/TaskModifyDraft.java 281
fr/paris/lutece/plugins/workflow/modules/ticketing/service/task/TaskModifyTicket.java 265
                    strTaskInformation += formatInfoMessage( MESSAGE_MODIFY_TICKET_QUARTIER_INFORMATION, strCurrentQuartier, newQuartier.getLabel( ), locale );
                }
                ticket.setTicketAddress( currentTicketAddress );
            } else
            {
                if ( StringUtils.isNotBlank( strNewAdress ) || StringUtils.isNotBlank( strNewAdressDetail ) || StringUtils.isNotBlank( strNewPostalCode ) || StringUtils.isNotBlank( strNewCity ) )
                {
                    TicketAddress newTicketAddress = new TicketAddress( );

                    // Update the address
                    newTicketAddress.setAddress( strNewAdress );
                    if ( StringUtils.isNotBlank( strNewAdress ) )
                    {
                        strTaskInformation += formatInfoMessage( MESSAGE_MODIFY_TICKET_ADDRESS_INFORMATION, StringUtils.EMPTY, strNewAdress, locale );
                    }

                    // Update the address detail
                    newTicketAddress.setAddressDetail( strNewAdressDetail );
                    if ( StringUtils.isNotBlank( strNewAdressDetail ) )
                    {
                        strTaskInformation += formatInfoMessage( MESSAGE_MODIFY_TICKET_ADDRESS_DETAIL_INFORMATION, StringUtils.EMPTY, strNewAdressDetail, locale );
                    }

                    // Update the city
                    newTicketAddress.setCity( strNewCity );
                    if ( StringUtils.isNotBlank( strNewCity ) )
                    {
                        strTaskInformation += formatInfoMessage( MESSAGE_MODIFY_TICKET_CITY_INFORMATION, StringUtils.EMPTY, strNewCity, locale );
                    }

                    // Update the postal code
                    newTicketAddress.setPostalCode( strNewPostalCode );
                    if ( StringUtils.isNotBlank( strNewPostalCode ) )
                    {
                        strTaskInformation += formatInfoMessage( MESSAGE_MODIFY_TICKET_POSTAL_CODE_INFORMATION, StringUtils.EMPTY, strNewPostalCode, locale );
                    }

                    ticket.setTicketAddress( newTicketAddress );
                }
            }

            // Update the arrondissement
            Arrondissement newArrondissement = ticketWithNewData.getArrondissement( );
            Arrondissement currentArrondissement = ticket.getArrondissement( );
            if ( ( newArrondissement != null ) && ( newArrondissement.getId( ) != currentArrondissement.getId( ) ) )
            {
                ticket.setArrondissement( newArrondissement );
                String strNewArrondissement = newArrondissement.getId( ) < 5 ? "Paris Centre" : String.valueOf( newArrondissement.getId( ) );
                strTaskInformation += formatInfoMessage( MESSAGE_MODIFY_TICKET_ARRONDISSEMNT_INFORMATION, String.valueOf( currentArrondissement.getId( ) ), strNewArrondissement, locale );
            }

            // Update the contact mode
            int nNewContactModeId = ticketWithNewData.getIdContactMode( );
            if ( ticket.getIdContactMode( ) != nNewContactModeId )
            {
                String strCurrentContactMode = ticket.getContactMode( );
                String strNewContactMode = ContactModeHome.findByPrimaryKey( nNewContactModeId ).getCode( );
                ticket.setIdContactMode( nNewContactModeId );
                ticket.setContactMode( strNewContactMode );
                strTaskInformation += formatInfoMessage( MESSAGE_MODIFY_TICKET_CONTACT_MODE_INFORMATION, strCurrentContactMode, strNewContactMode, locale );
            }

            // Update the comment
            String strNewComment = ticketWithNewData.getTicketComment( );
            String strCurrentTicketComment = ticket.getTicketComment( );
            if ( ( strNewComment != null ) && !strNewComment.equals( strCurrentTicketComment ) )
            {
                ticket.setTicketComment( strNewComment );
                strTaskInformation += formatInfoMessage( MESSAGE_MODIFY_TICKET_COMMENT_INFORMATION, strCurrentTicketComment, strNewComment, locale );
            }
Fichier Ligne
fr/paris/lutece/plugins/workflow/modules/ticketing/web/task/ModifyDraftTaskComponent.java 147
fr/paris/lutece/plugins/workflow/modules/ticketing/web/task/ModifyTicketTaskComponent.java 133
        model.put( MARK_QUARTIER_LIST, QuartierHome.getQuartiersReferenceList( ) );

        HtmlTemplate template = AppTemplateService.getTemplate( TEMPLATE_TASK_MODIFY_TICKET_FORM, locale, model );

        return template.getHtml( );
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String doValidateTask( int nIdResource, String strResourceType, HttpServletRequest request, Locale locale, ITask task )
    {
        // Validate the selection of items
        List<ErrorMessage> listErrors = valideTicket( request );

        if ( !listErrors.isEmpty( ) )
        {
            UrlItem urlReturnFromErros = new UrlItem( JSP_VIEW_TICKET );
            urlReturnFromErros.addParameter( TicketingConstants.PARAMETER_ID_TICKET, nIdResource );

            return AdminMessageService.getMessageUrl( request, MESSAGE_MODIFY_TICKET_ERROR,
                    WorkflowTicketingUtils.formatValidationErrors( request, listErrors ), urlReturnFromErros.getUrl( ), AdminMessage.TYPE_ERROR );
        }

        return null;
    }

    /**
     * Method used to validate informations for the new ticket modification
     */
    private List<ErrorMessage> valideTicket( HttpServletRequest request )
    {
        List<ErrorMessage> listErrors = new ArrayList<>( );

        // Populate the Ticket
        Ticket ticketToValidate = new Ticket( );
        ticketToValidate.setTicketCategory( new TicketCategory( ) ); // -- to not generate validation error on this field
        BeanUtil.populate( ticketToValidate, request );

        // Update the ticket adress
        TicketAddress ticketAdressToValidate = new TicketAddress( );
        BeanUtil.populate( ticketAdressToValidate, request );
        ticketToValidate.setTicketAddress( ticketAdressToValidate );

        // Validate the ticket
        listErrors.addAll( validateBean( ticketToValidate, request.getLocale( ) ) );

        // Validate the contact mode
        String strContactModeFilled = new FormValidator( request ).isContactModeFilled( );
        if ( strContactModeFilled != null )
        {
            listErrors.add( new MVCMessage( strContactModeFilled ) );
        }

        // The validation for the ticket comment size
        String strNewComment = ticketToValidate.getTicketComment( );
        if ( FormValidator.countCharTicketComment( strNewComment ) > 5000 )
        {
            listErrors.add( new MVCMessage( I18nService.getLocalizedString( MESSAGE_ERROR_COMMENT_VALIDATION, request.getLocale( ) ) ) );
        }

        return listErrors;
    }

    /**
     * Validate a bean. his method convert the String result of the validateBean method of the TicketValidator to MVCMessage
     *
     * @param request
     * @param bean
     * @param strPrefix
     * @return listErrors : the list of all validations errors
     */
    private List<ErrorMessage> validateBean( Ticket ticket, Locale locale )
    {
        List<ErrorMessage> listErrors = new ArrayList<>( );
        List<String> listTicketValidationErrors = new TicketValidator( locale ).validateBean( ticket );

        if ( listTicketValidationErrors.isEmpty( ) )
        {
            return listErrors;
        }
        else
        {
            for ( String errorValidation : listTicketValidationErrors )
            {
                listErrors.add( new MVCMessage( errorValidation ) );
            }
        }
        return listErrors;
    }

}
Fichier Ligne
fr/paris/lutece/plugins/workflow/modules/ticketing/web/task/AssignTicketToUnitTaskComponent.java 86
fr/paris/lutece/plugins/workflow/modules/ticketing/web/task/AssignUpTicketTaskComponent.java 84
    @Override
    public String getDisplayConfigForm( HttpServletRequest request, Locale locale, ITask task )
    {
        Map<String, Object> model = new HashMap<>( );
        TaskAssignTicketToUnitConfig config = getTaskConfigService( ).findByPrimaryKey( task.getId( ) );

        model.put( MARK_CONFIG_TITLE, I18nService.getLocalizedString( CONFIG_TITLE_KEY, request.getLocale( ) ) );

        if ( config != null )
        {
            model.put( MARK_LEVEL_1, config.isLevel1( ) );
            model.put( MARK_LEVEL_2, config.isLevel2( ) );
            model.put( MARK_LEVEL_3, config.isLevel3( ) );
        }
        else
        {
            model.put( MARK_LEVEL_1, false );
            model.put( MARK_LEVEL_2, false );
            model.put( MARK_LEVEL_3, false );
        }

        HtmlTemplate template = AppTemplateService.getTemplate( TEMPLATE_TASK_ASSIGN_TICKET_TO_UNIT_CONFIG, locale, model );

        return template.getHtml( );
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String doSaveConfig( HttpServletRequest request, Locale locale, ITask task )
    {
        TaskAssignTicketToUnitConfig config = getTaskConfigService( ).findByPrimaryKey( task.getId( ) );

        boolean level1 = StringUtils.isNotEmpty( request.getParameter( MARK_LEVEL_1 ) );
        boolean level2 = StringUtils.isNotEmpty( request.getParameter( MARK_LEVEL_2 ) );
        boolean level3 = StringUtils.isNotEmpty( request.getParameter( MARK_LEVEL_3 ) );

        if ( config == null )
        {
            config = new TaskAssignTicketToUnitConfig( );
            config.setIdTask( task.getId( ) );
            config.setLevel1( level1 );
            config.setLevel2( level2 );
            config.setLevel3( level3 );
            getTaskConfigService( ).create( config );
        }
        else
        {
            config.setLevel1( level1 );
            config.setLevel2( level2 );
            config.setLevel3( level3 );
            getTaskConfigService( ).update( config );
        }

        return null;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String getDisplayTaskForm( int nIdResource, String strResourceType, HttpServletRequest request, Locale locale, ITask task )
    {
Fichier Ligne
fr/paris/lutece/plugins/workflow/modules/ticketing/service/task/TaskModifyDraft.java 239
fr/paris/lutece/plugins/workflow/modules/ticketing/service/task/TaskModifyTicket.java 230
            Quartier newQuartier = QuartierHome.getQuartierByCode( String.valueOf( idQuartier ) );
            TicketAddress currentTicketAddress = ticket.getTicketAddress( );

            if ( currentTicketAddress != null )
            {
                // Update the address
                if ( ( ( null != currentTicketAddress.getAddress( ) ) && ( !currentTicketAddress.getAddress( ).equals( strNewAdress ) ) )
                        || ( ( null == currentTicketAddress.getAddress( ) ) && ( null != strNewAdress ) ) )
                {
                    String strCurrentAddress = currentTicketAddress.getAddress( );
                    currentTicketAddress.setAddress( strNewAdress );
                    strTaskInformation += formatInfoMessage( MESSAGE_MODIFY_TICKET_ADDRESS_INFORMATION, strCurrentAddress, strNewAdress, locale );
                }
                // Update the address detail
                if ( ( ( null != currentTicketAddress.getAddressDetail( ) ) && ( !currentTicketAddress.getAddressDetail( ).equals( strNewAdressDetail ) ) )
                        || ( ( null == currentTicketAddress.getAddressDetail( ) ) && ( null != strNewAdressDetail ) ) )
                {
                    String strCurrentAddressDetail = currentTicketAddress.getAddressDetail( );
                    currentTicketAddress.setAddressDetail( strNewAdressDetail );
                    strTaskInformation += formatInfoMessage( MESSAGE_MODIFY_TICKET_ADDRESS_DETAIL_INFORMATION, strCurrentAddressDetail, strNewAdressDetail, locale );
                }
                // Update the city
                if ( ( ( null != currentTicketAddress.getCity( ) ) && ( !currentTicketAddress.getCity( ).equals( strNewCity ) ) )
                        || ( ( null == currentTicketAddress.getCity( ) ) && ( null != strNewCity ) ) )
                {
                    String strCurrentCity = currentTicketAddress.getCity( );
                    currentTicketAddress.setCity( strNewCity );
                    strTaskInformation += formatInfoMessage( MESSAGE_MODIFY_TICKET_CITY_INFORMATION, strCurrentCity, strNewCity, locale );
                }
                // Update the postal code
                if ( ( ( null != currentTicketAddress.getPostalCode( ) ) && ( !currentTicketAddress.getPostalCode( ).equals( strNewPostalCode ) ) )
                        || ( ( null == currentTicketAddress.getPostalCode( ) ) && ( null != strNewPostalCode ) ) )
                {
                    String strCurrentPostalCode = currentTicketAddress.getPostalCode( );
                    currentTicketAddress.setPostalCode( strNewPostalCode );
                    strTaskInformation += formatInfoMessage( MESSAGE_MODIFY_TICKET_POSTAL_CODE_INFORMATION, strCurrentPostalCode, strNewPostalCode, locale );
                }
Fichier Ligne
fr/paris/lutece/plugins/workflow/modules/ticketing/web/task/NotifyWaitingTicketTaskComponent.java 139
fr/paris/lutece/plugins/workflow/modules/ticketing/web/task/TicketEmailExternalUserTaskComponent.java 415
                MessageDirectionExternalUser.RE_AGENT_TO_EXTERNAL_USER.getLocalizedMessage( locale ) );

        model.put( MARK_MESSAGE_DIRECTIONS_LIST, listMessageDirections );
        model.put( MARK_CONFIG_FOLLOW_ACTION_ID, StringUtils.EMPTY );
        model.put( MARK_CONFIG_CONTACT_ATTRIBUTE, StringUtils.EMPTY );
        model.put( MARK_CONFIG_DEFAULT_SUBJECT, StringUtils.EMPTY );

        if ( config != null )
        {
            model.put( MARK_MESSAGE_DIRECTION, config.getMessageDirectionExternalUser( ).ordinal( ) );

            if ( config.getIdFollowingAction( ) != null )
            {
                model.put( MARK_CONFIG_FOLLOW_ACTION_ID, config.getIdFollowingAction( ) );
            }

            if ( config.getIdContactAttribute( ) != null )
            {
                model.put( MARK_CONFIG_CONTACT_ATTRIBUTE, config.getIdContactAttribute( ) );
            }

            if ( config.getDefaultSubject( ) != null )
            {
                model.put( MARK_CONFIG_DEFAULT_SUBJECT, config.getDefaultSubject( ) );
            }

        }
        else
        {
            model.put( MARK_MESSAGE_DIRECTION, MessageDirectionExternalUser.AGENT_TO_EXTERNAL_USER );
        }

        model.put( MARK_CONFIG, config );

        HtmlTemplate template = AppTemplateService.getTemplate( TEMPLATE_TASK_TICKET_CONFIG, locale, model );

        return template.getHtml( );
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String doSaveConfig( HttpServletRequest request, Locale locale, ITask task )
    {

        Integer nMessageDirectionId = getParameterAsInteger( request.getParameter( PARAMETER_MESSAGE_DIRECTION ) );
        Integer nIdFollowingAction = getParameterAsInteger( request.getParameter( PARAMETER_FOLLOW_ACTION_ID ) );
        Integer nIdContactAttribute = getParameterAsInteger( request.getParameter( PARAMETER_CONTACT_ATTRIBUTE ) );
        String strDefaultSubject = request.getParameter( PARAMETER_DEFAULT_SUBJECT );
Fichier Ligne
fr/paris/lutece/plugins/workflow/modules/ticketing/service/task/TaskModifyDraft.java 112
fr/paris/lutece/plugins/workflow/modules/ticketing/service/task/TaskModifyTicket.java 105
        return I18nService.getLocalizedString( MESSAGE_TASK_MODIFY_DRAFT, locale );
    }

    @Override
    protected String processTicketingTask( int nIdResourceHistory, HttpServletRequest request, Locale locale )
    {
        String strTaskInformation = StringUtils.EMPTY;
        Ticket ticket = getTicket( nIdResourceHistory );

        // save current values, clear ticket
        List<Response> listCurrentResponse = ticket.getListResponse( );


        // Gets Map of Response by idEntry
        Map<Integer, List<Response>> currentResponsesByIdEntry = listCurrentResponse.stream( )
                .filter( r -> StringUtils.equals( r.getEntry( ).getEntryType( ).getBeanName( ), EntryTypeFile.BEAN_NAME ) ).collect( Collectors.groupingBy( r -> r.getEntry( ).getIdEntry( ) ) );

        for ( Map.Entry<Integer, List<Response>> mapEntry : currentResponsesByIdEntry.entrySet( ) )
        {

            Entry entry = EntryHome.findByPrimaryKey( mapEntry.getKey( ) );
            _ticketFormService.getResponseEntry( request, entry.getIdEntry( ), locale, ticket );
            List<Response> newResponsesForEntry = ticket.getListResponse( ).stream( ).filter( r -> ( r.getEntry( ).getIdEntry( ) == entry.getIdEntry( ) ) && ( r.getIdResponse( ) == 0 ) )
                    .collect( Collectors.toList( ) );

            // Create new responses
            newResponsesForEntry.forEach( response ->
            {
Fichier Ligne
fr/paris/lutece/plugins/workflow/modules/ticketing/service/daemon/TicketPjMigrationDaemon.java 419
fr/paris/lutece/plugins/workflow/modules/ticketing/service/task/TaskAutomaticCentralizeAttachments.java 381
            }
        }
    }

    /**
     * find historic data From task info table
     *
     * @param ticket
     *            the ticket to anonymizes
     */
    private List<Integer> ticketTaskInfoService( int idHistory )
    {
        String valueInfo = _daoTaskInfo.getInfoHistoryValueByIdHistory( idHistory, _plugin );
        List<Integer> idResponseTotal = new ArrayList<>( );
        if ( !valueInfo.isEmpty( ) )
        {
            String valueInfoUpdated = _daoTaskInfo.getInfoHistoryValueByIdHistory( idHistory, _plugin );
            if ( valueInfoUpdated.contains( "a href=" ) )
            {
                List<Integer> idResponseListForAgent = TicketTransfertPjService.extractIdResponse( valueInfoUpdated );
                idResponseTotal.addAll( idResponseListForAgent );
            }
        }
        return idResponseTotal;
    }

    /**
     * find historic data From task info table
     *
     * @param ticket
     *            the ticket to anonymizes
     */
    private List<Integer> ticketNotifyHsitoryService( int idHistory )
    {
        Map<String, String> valueNotifyMessages = _daoAnonymisation.loadMessageNotifyHIstoryTotal( idHistory, _plugin );
        List<Integer> idResponseTotal = new ArrayList<>( );
        if ( ( null != valueNotifyMessages ) && !valueNotifyMessages.isEmpty( ) )
        {
            for ( Map.Entry<String, String> mapEntry : valueNotifyMessages.entrySet( ) )
            {
                if ( ( null != mapEntry.getValue( ) ) && mapEntry.getValue( ).contains( "a href=" ) )
                {
                    List<Integer> idResponseListForAgent = TicketTransfertPjService.extractIdResponse( mapEntry.getValue( ) );
                    idResponseTotal.addAll( idResponseListForAgent );
                }
            }
        }
        return idResponseTotal;
    }
Fichier Ligne
fr/paris/lutece/plugins/workflow/modules/ticketing/web/task/ModifyDraftTaskComponent.java 103
fr/paris/lutece/plugins/workflow/modules/ticketing/web/task/ModifyTicketTaskComponent.java 99
    private static final String MESSAGE_MODIFY_TICKET_ERROR = "module.workflow.ticketing.task_modify_ticket.error";
    private static final String MESSAGE_ERROR_COMMENT_VALIDATION = "ticketing.validation.ticket.TicketComment.size";

    @Inject
    private TicketFormService _ticketFormService;

    /**
     * {@inheritDoc}
     */
    @Override
    public String getDisplayTaskForm( int nIdResource, String strResourceType, HttpServletRequest request, Locale locale, ITask task )
    {
        Ticket ticket = getTicket( nIdResource, strResourceType );

        Map<String, Object> model = getModel( ticket );

        model.put( MARK_HANDLER, TicketAsynchronousUploadHandler.getHandler( ) );
        List<Entry> listEntries = new ArrayList<>( );

        List<Response> responseList = ticket.getListResponse( );
        // Get the list of file type entry with distinct idEntry
        listEntries = responseList.stream( ).map( Response::getEntry )
                .filter( e -> StringUtils.equals( e.getEntryType( ).getBeanName( ), EntryTypeFile.BEAN_NAME ) )
                .collect( Collectors.groupingBy( Entry::getIdEntry ) ).values( ).stream( ).flatMap( group -> group.stream( ).limit( 1 ) )
                .collect( Collectors.toList( ) );

        _ticketFormService.saveTicketInSession( request.getSession( ), ticket );
        String htmlForm = _ticketFormService.getHtmlForm( listEntries, request.getLocale( ), false, request );
Fichier Ligne
fr/paris/lutece/plugins/workflow/modules/ticketing/service/daemon/NotifyDaemon.java 256
fr/paris/lutece/plugins/workflow/modules/ticketing/service/daemon/NotifyLevel3Daemon.java 234
                || ( nIdActionRetourFromTerrainNiv3 <= 0 ) || ( nIdActionRetourFromContribNiv2 <= 0 ) || ( nIdActionRetourFromContribNiv3 <= 0 ) )
        {
            sbLog.append( "Paramétrage des id de workflow GRU incorrect, vérifier fichiers properties" );
            AppLogService.error( "Paramétrage des id de workflow GRU incorrect, vérifier fichiers properties" );
            return false;
        }

        if ( nbRelanceMax < 1 )
        {
            // relance desactivée
            sbLog.append( "Paramétrage relance_auto.nb_relance_max inf. à 1, relance desactivée" );
            AppLogService.error( "Paramétrage relance_auto.nb_relance_max inférieur à 1, relance desactivée" );
            return false;
        }

        return true;
    }

    /**
     * Relance si pas de date de dernière relance
     *
     * @param ticket
     *            ticket
     * @param dateExecution
     *            date d'exécution
     */
    private void processRelanceNoDate( Ticket ticket, Date dateExecution )
    {
        ticket.setDateDerniereRelance( new Timestamp( dateExecution.getTime( ) ) );
        ticket.setNbRelance( 1 );

        // mise à jour du ticket (sans màj de la date d'update)
        // update date true si retour de sollicitation, false si relance auto
        TicketHome.update( ticket, false );

        // Relance automatique
        _workflowService.doProcessAction( ticket.getId( ), Ticket.TICKET_RESOURCE_TYPE, nIdActionRelance, null, null, null, true );
    }

    /**
     * Relance avec contrôle de la date de dernière relance
     *
     * @param ticket
     *            ticket
     * @param dateDerniereRelance
     *            date de dernière relance
     * @param dateExecution
     *            date d'exécution
     * @return nombre de tickets relancé (0 ou 1)
     */
    private int processRelance( Ticket ticket, Timestamp dateDerniereRelance, Date dateExecution )
    {
        Date dateLimiteRelance = getDatelimiteRelance( dateDerniereRelance );

        if ( dateLimiteRelance.before( dateExecution ) )
        {
            ticket.setDateDerniereRelance( new Timestamp( dateExecution.getTime( ) ) );
            ticket.setNbRelance( ticket.getNbRelance( ) + 1 );

            // mise à jour du ticket (sans màj de la date d'update)
            // update date true si retour de sollicitation, false si relance auto
            TicketHome.update( ticket, false );

            // Relance automatique
            _workflowService.doProcessAction( ticket.getId( ), Ticket.TICKET_RESOURCE_TYPE, nIdActionRelance, null, null, null, true );

            return 1;
        }

        return 0;
    }

    /**
     * Gère le retour en fonction de la dernière action manuelle
     *
     * @param ticket
     *            ticket
     * @param dateExecution
     *            date d'exécution
     * @return nombre de tickets en retour (0 ou 1)
     */
    private int processRetour( Ticket ticket, Timestamp dateDerniereRelance, Date dateExecution )
Fichier Ligne
fr/paris/lutece/plugins/workflow/modules/ticketing/service/daemon/NotifyDaemon.java 175
fr/paris/lutece/plugins/workflow/modules/ticketing/service/daemon/NotifyLevel3Daemon.java 155
fr/paris/lutece/plugins/workflow/modules/ticketing/service/daemon/NotifyUsagerDaemon.java 155
                                    || ( resourceHistory.getAction( ).getId( ) == nIdActionSolliciterFromContribNiv3 ) )
                            {
                                int nRelance = processRelance( ticket, resourceHistory.getCreationDate( ), dateExecution );
                                nNbTicketRelance = nNbTicketRelance + nRelance;
                                isTicketUpdated = ( nRelance == 1 );
                                break;
                            }
                        }
                    }
                    else
                        if ( nNbRelance < nbRelanceMax )
                        {
                            int nRelance = processRelance( ticket, dateDerniereRelance, dateExecution );
                            nNbTicketRelance = nNbTicketRelance + nRelance;
                            isTicketUpdated = ( nRelance == 1 );
                        }
                        else
                        {
                            int nRelance = processRetour( ticket, dateDerniereRelance, dateExecution );
                            nNbTicketRetour = nNbTicketRetour + nRelance;
                            isTicketUpdated = ( nRelance == 1 );
                        }
                }
            }
            catch( Exception e )
            {
                AppLogService.error( "Erreur du traitement du ticket " + nIdResource, e );

                if ( ( ticket != null ) && ( ticket.getNbRelance( ) != nNbRelance ) )
                {
                    // si le ticket a été mis à jour mais a eu une erreur
                    ticket.setNbRelance( nNbRelance );
                    ticket.setDateDerniereRelance( dateDerniereRelance );
                    TicketHome.update( ticket, false );
                    isTicketUpdated = true;
                }
            }
            finally
            {
                if ( isTicketUpdated )
                {
                    // Index: store the Ticket in the table for the daemon
                    IndexerActionHome.create( TicketIndexerActionUtil.createIndexerActionFromTicket( ticket ) );
                }
            }
        }

        sbLog.append( "Nombre de tickets au statut " )
        .append( _workflowService.getState( nIdStateWaiting, Ticket.TICKET_RESOURCE_TYPE, nIdWorkflow, null ).getName( ) ).append( " dont :" );
Fichier Ligne
fr/paris/lutece/plugins/workflow/modules/ticketing/service/daemon/TicketPjMigrationDaemon.java 165
fr/paris/lutece/plugins/workflow/modules/ticketing/service/task/TaskAutomaticCentralizeAttachments.java 123
    }

    /**
     * Search ditinct id_core from workflow_task_upload_files
     *
     * @param idHistory
     *            the id history
     * @param idCoreUploadFinal
     *            the list of id file to complete
     * @return the list of distinct id_file
     */
    private List<Integer> searchPjFromTaskUploadFiles( int idHistory, List<Integer> idCoreUploadFinal )
    {
        List<Integer> idCoreUploadList = findIsFileFromTaskUploadFiles( idHistory, idCoreUploadFinal );
        if ( !idCoreUploadList.isEmpty( ) )
        {
            idCoreUploadFinal.addAll( idCoreUploadList );
        }
        return idCoreUploadFinal.stream( ).distinct( ).collect( Collectors.toList( ) );
    }

    /**
     * Search list of distinct id_response
     *
     * @param idHistory
     *            the id history
     * @param idResponseTotal
     *            the list of id response to complete
     * @return the list of distinct id_response
     */
    private List<Integer> searchPjFromTaskInfoAndNotifyHistory( int idHistory, List<Integer> idResponseTotal )
    {
        List<Integer> idResponseTaskInfoList = findIdResponseFromTaskInfo( idHistory, idResponseTotal );
        List<Integer> idResponseNotifyHistoryList = findIdResponseFromNotifyHistory( idHistory, idResponseTotal );

        if ( !idResponseTaskInfoList.isEmpty( ) )
        {
            idResponseTotal.addAll( idResponseTaskInfoList );
        }
        if ( !idResponseNotifyHistoryList.isEmpty( ) )
        {
            idResponseTotal.addAll( idResponseNotifyHistoryList );
        }
        return idResponseTotal.stream( ).distinct( ).collect( Collectors.toList( ) );
    }

    /**
     * Manage pj for usager
     *
     * @param ticket
     *            the ticket
     */
    private void managePjforS3ForUsager( Ticket ticket )
    {
        List<Integer> usagerAttachment = TicketTransfertPjService.findUsagerAttachment( ticket );
Fichier Ligne
fr/paris/lutece/plugins/workflow/modules/ticketing/service/daemon/NotifyDaemon.java 399
fr/paris/lutece/plugins/workflow/modules/ticketing/service/daemon/NotifyUsagerDaemon.java 314
                            _workflowService.doProcessAction( ticket.getId( ), Ticket.TICKET_RESOURCE_TYPE, nIdActionRetourFromContribNiv3, null, null, null,
                                    true );

                            return 1;
                        }
                        else
                        {
                            AppLogService.error( "Dernière action manuelle non trouvée pour le ticket " + ticket.getId( ) );
                        }
        }
        return 0;
    }

    /**
     * Renvoie la date de prochaine relance
     *
     * @param dateDerniereRelance
     *            date de dernière relance
     * @return date limite de relance
     */
    private Date getDatelimiteRelance( Timestamp dateDerniereRelance )
    {
        Calendar calendarLimiteRelance = Calendar.getInstance( );
        calendarLimiteRelance.setTime( dateDerniereRelance );

        if ( isMinuteMode == 1 )
        {
            calendarLimiteRelance.add( Calendar.MINUTE, nFrequence );
            // date dernière relance + n minutes
        }
        else
        {
            // date à 00h 00mn 00s
            calendarLimiteRelance.set( Calendar.HOUR_OF_DAY, 0 );
            calendarLimiteRelance.set( Calendar.MINUTE, 0 );
            calendarLimiteRelance.set( Calendar.SECOND, 0 );
            calendarLimiteRelance.set( Calendar.MILLISECOND, 0 );
            calendarLimiteRelance.add( Calendar.DAY_OF_YEAR, nFrequence );
            // date dernière relance + n jours
        }
        return calendarLimiteRelance.getTime( );
    }

    /**
     *
     * @param nIdResource
     *            identifiant de la ressource
     * @param nIdWorkflow
     *            identifiant du workflow
     * @return identifiant de la dernière action si dans la liste des actions de sollicitation
     */
    private int getLastManualActionSollicitation( int nIdResource, int nIdWorkflow )
    {
        List<ResourceHistory> listAllHistoryByResource = _resourceHistoryService.getAllHistoryByResource( nIdResource, Ticket.TICKET_RESOURCE_TYPE,
                nIdWorkflow );

        if ( ( listAllHistoryByResource != null ) && !listAllHistoryByResource.isEmpty( ) )
        {
            // récupération de la dernière action manuelle de sollicitation
            for ( int i = 0; i < listAllHistoryByResource.size( ); i++ )
Fichier Ligne
fr/paris/lutece/plugins/workflow/modules/ticketing/web/task/TicketingTaskComponent.java 239
fr/paris/lutece/plugins/workflow/modules/ticketing/web/task/TicketingTaskComponent.java 277
    protected static ReferenceList getUnitsList( AdminUser user, List<Integer> levelList )
    {

        List<AssigneeUnit> listUnitByLevel = new ArrayList<>( );

        for ( Integer level : levelList )
        {
            listUnitByLevel
                    .addAll( SupportEntityHome.getSupportEntityListByLevel( level ).stream( ).map( SupportEntity::getUnit ).collect( Collectors.toList( ) ) );
        }
        ReferenceList lstRef = new ReferenceList( listUnitByLevel.size( ) );
        ReferenceItem emptyReferenceItem = new ReferenceItem( );
        emptyReferenceItem.setCode( StringUtils.EMPTY );
        emptyReferenceItem.setName( I18nService.getLocalizedString( MESSAGE_DEFAULT_LABEL_ENTITY_TASK_FORM, Locale.FRANCE ) );
        emptyReferenceItem.setChecked( true );
        lstRef.add( emptyReferenceItem );

        for ( AssigneeUnit unit : listUnitByLevel )
        {

            if ( RBACService.isAuthorized( unit, AssigneeUnit.PERMISSION_ASSIGN, (User) user ) )
            {
                lstRef.addItem( unit.getUnitId( ), unit.getName( ) );
            }
        }

        return lstRef;
    }
Fichier Ligne
fr/paris/lutece/plugins/workflow/modules/ticketing/business/config/TaskNotifyWaitingTicketConfigDAO.java 97
fr/paris/lutece/plugins/workflow/modules/ticketing/business/email/config/TaskTicketEmailExternalUserConfigDAO.java 100
    public void store( TaskNotifyWaitingTicketConfig config )
    {
        try ( DAOUtil daoUtil = new DAOUtil( SQL_QUERY_UPDATE, WorkflowTicketingPlugin.getPlugin( ) ) )
        {
            int nIndex = 1;

            daoUtil.setInt( nIndex++, config.getMessageDirectionExternalUser( ).ordinal( ) );

            if ( config.getIdFollowingAction( ) == null )
            {
                daoUtil.setIntNull( nIndex++ );
            }
            else
            {
                daoUtil.setInt( nIndex++, config.getIdFollowingAction( ) );
            }

            if ( config.getIdContactAttribute( ) == null )
            {
                daoUtil.setIntNull( nIndex++ );
            }
            else
            {
                daoUtil.setInt( nIndex++, config.getIdContactAttribute( ) );
            }

            if ( config.getDefaultSubject( ) == null )
            {
                daoUtil.setString( nIndex++, StringUtils.EMPTY );
            }
            else
            {
                daoUtil.setString( nIndex++, config.getDefaultSubject( ) );
            }
            daoUtil.setInt( nIndex, config.getIdTask( ) );
Fichier Ligne
fr/paris/lutece/plugins/workflow/modules/ticketing/service/task/TaskModifyDraft.java 355
fr/paris/lutece/plugins/workflow/modules/ticketing/service/task/TaskModifyTicket.java 333
                ticket.setIdAdminBOInit( user.getUserId( ) );
            }

            // Update the ticket
            TicketHome.update( ticket );
        }

        // In the case when there are no modifications
        if ( strTaskInformation.equals( StringUtils.EMPTY ) )
        {
            strTaskInformation = I18nService.getLocalizedString( MESSAGE_MODIFY_TICKET_NO_MODIFICATIONS_INFORMATION, locale );
        }

        return strTaskInformation;
    }

    /**
     * Return the message formated for the modification of informations of the ticket
     *
     * @param strKey
     *            : the key of the message
     * @param strOldValue
     *            : the value which has been replaced
     * @param strNewValue
     *            : the new value
     * @param locale
     * @return the message formated
     */
    private String formatInfoMessage( String strKey, String strOldValue, String strNewValue, Locale locale )
    {
        return MessageFormat.format( I18nService.getLocalizedString( strKey, locale ), evaluateValue( strOldValue, locale ), evaluateValue( strNewValue, locale ) );
    }

    /**
     * Return the value if it's not empty otherwise return a default message
     *
     * @param strValue
     *            : the value to evaluate
     * @param locale
     * @return the value or the default message
     */
    private String evaluateValue( String strValue, Locale locale )
    {
        return ( StringUtils.isBlank( strValue ) ? I18nService.getLocalizedString( NOT_FILLED_INFORMATION, locale ) : strValue );
    }

    private void deletePj( TicketPj pj )
    {
        String profil = STroisService.findTheProfilAndServerS3( pj.getStockageTicketing( ), SERVEUR_SIDE );
        StockageService stockageService = new StockageService( profil );
        stockageService.deleteFileOnS3Serveur( pj.getUrlTicketing( ) );
    }
}
Fichier Ligne
fr/paris/lutece/plugins/workflow/modules/ticketing/business/email/message/TicketEmailExternalUserMessageDAO.java 227
fr/paris/lutece/plugins/workflow/modules/ticketing/business/email/message/TicketEmailExternalUserMessageDAO.java 258
        try ( DAOUtil daoUtil = new DAOUtil( SQL_QUERY_FIRST_MESSAGE, WorkflowTicketingPlugin.getPlugin( ) ) )
        {
            daoUtil.setInt( 1, nIdTicket );

            daoUtil.executeQuery( );

            int nIndex = 1;

            if ( daoUtil.next( ) )
            {
                emailExternalUserMessage = new TicketEmailExternalUserMessage( );
                emailExternalUserMessage.setIdMessageExternalUser( daoUtil.getInt( nIndex++ ) );
                emailExternalUserMessage.setIdTicket( daoUtil.getInt( nIndex++ ) );
                emailExternalUserMessage.setEmailRecipients( daoUtil.getString( nIndex++ ) );
                emailExternalUserMessage.setEmailRecipientsCc( daoUtil.getString( nIndex++ ) );
                emailExternalUserMessage.setMessageQuestion( daoUtil.getString( nIndex++ ) );
                emailExternalUserMessage.setMessageResponse( daoUtil.getString( nIndex++ ) );
                emailExternalUserMessage.setIsAnswered( daoUtil.getBoolean( nIndex++ ) );
                emailExternalUserMessage.setEmailSubject( daoUtil.getString( nIndex++ ) );
            }
        }
        return emailExternalUserMessage;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public TicketEmailExternalUserMessage loadLastByIdTicket( int nIdTicket )
Fichier Ligne
fr/paris/lutece/plugins/workflow/modules/ticketing/service/daemon/NotifyDaemon.java 293
fr/paris/lutece/plugins/workflow/modules/ticketing/service/daemon/NotifyUsagerDaemon.java 251
    }

    /**
     * Relance avec contrôle de la date de dernière relance
     *
     * @param ticket
     *            ticket
     * @param dateDerniereRelance
     *            date de dernière relance
     * @param dateExecution
     *            date d'exécution
     * @return nombre de tickets relancé (0 ou 1)
     */
    private int processRelance( Ticket ticket, Timestamp dateDerniereRelance, Date dateExecution )
    {
        Date dateLimiteRelance = getDatelimiteRelance( dateDerniereRelance );

        if ( dateLimiteRelance.before( dateExecution ) )
        {
            ticket.setDateDerniereRelance( new Timestamp( dateExecution.getTime( ) ) );
            ticket.setNbRelance( ticket.getNbRelance( ) + 1 );

            // mise à jour du ticket (sans màj de la date d'update)
            // update date true si retour de sollicitation, false si relance auto
            TicketHome.update( ticket, false );

            // Relance automatique
            _workflowService.doProcessAction( ticket.getId( ), Ticket.TICKET_RESOURCE_TYPE, nIdActionRelance, null, null, null, true );

            return 1;
        }

        return 0;
    }

    /**
     * Gère le retour en fonction de la dernière action manuelle
     *
     * @param ticket
     *            ticket
     * @param dateExecution
     *            date d'exécution
     * @return nombre de tickets en retour (0 ou 1)
     */
    private int processRetour( Ticket ticket, Timestamp dateDerniereRelance, Date dateExecution )
    {
        Date dateLimiteRelance = getDatelimiteRelance( dateDerniereRelance );

        if ( dateLimiteRelance.before( dateExecution ) )
        {
            // retour sollicitation
            int nIdDerniereActionManuelle = getLastManualActionSollicitation( ticket.getId( ), nIdWorkflow );

            if ( nIdDerniereActionManuelle == nIdActionSolliciterFromTerrainNiv2 )
Fichier Ligne
fr/paris/lutece/plugins/workflow/modules/ticketing/business/config/TaskNotifyWaitingTicketConfigDAO.java 56
fr/paris/lutece/plugins/workflow/modules/ticketing/business/email/config/TaskTicketEmailExternalUserConfigDAO.java 56
    public void insert( TaskNotifyWaitingTicketConfig config )
    {
        try ( DAOUtil daoUtil = new DAOUtil( SQL_QUERY_INSERT, WorkflowTicketingPlugin.getPlugin( ) ) )
        {
            int nIndex = 1;

            daoUtil.setInt( nIndex++, config.getIdTask( ) );
            daoUtil.setInt( nIndex++, config.getMessageDirectionExternalUser( ).ordinal( ) );

            if ( config.getIdFollowingAction( ) == null )
            {
                daoUtil.setIntNull( nIndex++ );
            }
            else
            {
                daoUtil.setInt( nIndex++, config.getIdFollowingAction( ) );
            }

            if ( config.getIdContactAttribute( ) == null )
            {
                daoUtil.setIntNull( nIndex++ );
            }
            else
            {
                daoUtil.setInt( nIndex++, config.getIdContactAttribute( ) );
            }

            if ( config.getDefaultSubject( ) == null )
            {
                daoUtil.setString( nIndex, StringUtils.EMPTY );
Fichier Ligne
fr/paris/lutece/plugins/workflow/modules/ticketing/service/daemon/NotifyDaemon.java 144
fr/paris/lutece/plugins/workflow/modules/ticketing/service/daemon/NotifyUsagerDaemon.java 127
            sbLog.append( "Aucun ticket au statut en attente d'une réponse" );
            return sbLog.toString( );
        }

        // boucle sur les tickets
        for ( int nIdResource : listResourceWaitingId )
        {
            int nNbRelance = 0;
            Timestamp dateDerniereRelance = null;
            Ticket ticket = null;
            boolean isTicketUpdated = false;
            try
            {
                ticket = TicketHome.findByPrimaryKey( nIdResource );

                if ( ticket != null )
                {
                    nNbRelance = ticket.getNbRelance( );
                    dateDerniereRelance = ticket.getDateDerniereRelance( );

                    if ( ( dateDerniereRelance == null ) || ( nNbRelance == 0 ) )
                    {
                        List<ResourceHistory> allHistory = _resourceHistoryService.getAllHistoryByResource( ticket.getId( ), Ticket.TICKET_RESOURCE_TYPE,
                                nIdWorkflow );
                        allHistory.sort( Comparator.comparing( ResourceHistory::getCreationDate ).reversed( ) ); // tri du plus récent au plus ancien
                        for ( ResourceHistory resourceHistory : allHistory )
                        {
                            // pas de dernière relance, récupération de la date de dernière sollicitation
                            if ( ( resourceHistory.getAction( ).getId( ) == nIdActionSolliciterFromTerrainNiv2 )
Fichier Ligne
fr/paris/lutece/plugins/workflow/modules/ticketing/service/task/TaskNotifyWaitingTicket.java 198
fr/paris/lutece/plugins/workflow/modules/ticketing/service/task/TaskTicketEmailExternalUser.java 191
                AdminUser user = AdminUserHome.findUserByLogin( AdminUserHome.findUserByEmail( emailRecipient ) );

                TicketEmailExternalUserRecipient infosEmailExternalUser = new TicketEmailExternalUserRecipient( );
                infosEmailExternalUser.setIdResourceHistory( nIdResourceHistory );
                infosEmailExternalUser.setIdTask( getId( ) );
                infosEmailExternalUser.setEmail( user.getEmail( ) );

                List<ExternalUser> listUsers = _externalUserDAO.findExternalUser( user.getLastName( ), user.getEmail( ),
                        String.valueOf( config.getIdContactAttribute( ) ), null, null );

                if ( ( listUsers != null ) && !listUsers.isEmpty( ) )
                {
                    infosEmailExternalUser.setField( listUsers.iterator( ).next( ).getAdditionalAttribute( ) );
                }

                infosEmailExternalUser.setName( user.getLastName( ) );
                infosEmailExternalUser.setFirstName( user.getFirstName( ) );
                _ticketEmailExternalUserRecipientDAO.insert( infosEmailExternalUser );
            }
        }

        String [ ] emailRecipientsCc;
Fichier Ligne
fr/paris/lutece/plugins/workflow/modules/ticketing/service/daemon/NotifyDaemon.java 223
fr/paris/lutece/plugins/workflow/modules/ticketing/service/daemon/NotifyLevel3Daemon.java 203
fr/paris/lutece/plugins/workflow/modules/ticketing/service/daemon/NotifyUsagerDaemon.java 203
        .append( _workflowService.getState( nIdStateWaiting, Ticket.TICKET_RESOURCE_TYPE, nIdWorkflow, null ).getName( ) ).append( " dont :" );
        sbLog.append( "\n   " ).append( nNbTicketRelance ).append( " tickets relancés" );
        sbLog.append( "\n   " ).append( nNbTicketRetour ).append( " tickets en retour de sollicitation" );

        AppLogService.info( sbLog.toString( ) );

        return sbLog.toString( );
    }

    /**
     * Vérifie les paramètres configurés
     *
     * @param sbLog
     *            logs
     * @return true si conf OK, false sinon
     */
    private boolean isConfParamOK( StringBuilder sbLog )
    {
        if ( _workflowService == null )
        {
            _workflowService = WorkflowService.getInstance( );
        }

        if ( ( nIdWorkflow <= 0 ) || !_workflowService.isAvailable( ) )
        {
            // pas de workflow trouvé
            sbLog.append( "Workflow GRU non trouvé" );
            AppLogService.error( "Workflow GRU non trouvé" );
            return false;
        }

        if ( ( nIdActionRelance <= 0 ) || ( nIdStateWaiting <= 0 ) || ( nIdActionSolliciterFromTerrainNiv2 <= 0 ) || ( nIdActionSolliciterFromTerrainNiv3 <= 0 )
Fichier Ligne
fr/paris/lutece/plugins/workflow/modules/ticketing/business/email/message/TicketEmailExternalUserMessageDAO.java 198
fr/paris/lutece/plugins/workflow/modules/ticketing/business/email/message/TicketEmailExternalUserMessageDAO.java 229
            daoUtil.setInt( 1, nIdMessageExternalUser );

            daoUtil.executeQuery( );

            int nIndex = 1;

            if ( daoUtil.next( ) )
            {
                emailExternalUserMessage = new TicketEmailExternalUserMessage( );
                emailExternalUserMessage.setIdMessageExternalUser( daoUtil.getInt( nIndex++ ) );
                emailExternalUserMessage.setIdTicket( daoUtil.getInt( nIndex++ ) );
                emailExternalUserMessage.setEmailRecipients( daoUtil.getString( nIndex++ ) );
                emailExternalUserMessage.setEmailRecipientsCc( daoUtil.getString( nIndex++ ) );
                emailExternalUserMessage.setMessageQuestion( daoUtil.getString( nIndex++ ) );
                emailExternalUserMessage.setMessageResponse( daoUtil.getString( nIndex++ ) );
                emailExternalUserMessage.setIsAnswered( daoUtil.getBoolean( nIndex++ ) );
                emailExternalUserMessage.setEmailSubject( daoUtil.getString( nIndex++ ) );
            }
        }
        return emailExternalUserMessage;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public TicketEmailExternalUserMessage loadFirstByIdTicket( int nIdTicket )
Fichier Ligne
fr/paris/lutece/plugins/workflow/modules/ticketing/business/email/message/TicketEmailExternalUserMessageDAO.java 198
fr/paris/lutece/plugins/workflow/modules/ticketing/business/email/message/TicketEmailExternalUserMessageDAO.java 260
            daoUtil.setInt( 1, nIdMessageExternalUser );

            daoUtil.executeQuery( );

            int nIndex = 1;

            if ( daoUtil.next( ) )
            {
                emailExternalUserMessage = new TicketEmailExternalUserMessage( );
                emailExternalUserMessage.setIdMessageExternalUser( daoUtil.getInt( nIndex++ ) );
                emailExternalUserMessage.setIdTicket( daoUtil.getInt( nIndex++ ) );
                emailExternalUserMessage.setEmailRecipients( daoUtil.getString( nIndex++ ) );
                emailExternalUserMessage.setEmailRecipientsCc( daoUtil.getString( nIndex++ ) );
                emailExternalUserMessage.setMessageQuestion( daoUtil.getString( nIndex++ ) );
                emailExternalUserMessage.setMessageResponse( daoUtil.getString( nIndex++ ) );
                emailExternalUserMessage.setIsAnswered( daoUtil.getBoolean( nIndex++ ) );
                emailExternalUserMessage.setEmailSubject( daoUtil.getString( nIndex++ ) );
            }
        }
        return emailExternalUserMessage;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public TicketEmailExternalUserMessage loadFirstByIdTicket( int nIdTicket )
Fichier Ligne
fr/paris/lutece/plugins/workflow/modules/ticketing/business/config/TaskNotifyWaitingTicketConfigDAO.java 103
fr/paris/lutece/plugins/workflow/modules/ticketing/business/email/config/TaskTicketEmailExternalUserConfigDAO.java 63
fr/paris/lutece/plugins/workflow/modules/ticketing/business/email/config/TaskTicketEmailExternalUserConfigDAO.java 106
            daoUtil.setInt( nIndex++, config.getMessageDirectionExternalUser( ).ordinal( ) );

            if ( config.getIdFollowingAction( ) == null )
            {
                daoUtil.setIntNull( nIndex++ );
            }
            else
            {
                daoUtil.setInt( nIndex++, config.getIdFollowingAction( ) );
            }

            if ( config.getIdContactAttribute( ) == null )
            {
                daoUtil.setIntNull( nIndex++ );
            }
            else
            {
                daoUtil.setInt( nIndex++, config.getIdContactAttribute( ) );
            }

            if ( config.getDefaultSubject( ) == null )
            {
                daoUtil.setString( nIndex++, StringUtils.EMPTY );
            }
            else
            {
                daoUtil.setString( nIndex++, config.getDefaultSubject( ) );
            }
            daoUtil.setInt( nIndex, config.getIdTask( ) );
Fichier Ligne
fr/paris/lutece/plugins/workflow/modules/ticketing/service/task/TaskNotifyWaitingTicket.java 260
fr/paris/lutece/plugins/workflow/modules/ticketing/service/task/TaskTicketEmailExternalUser.java 247
        String strEmailRecipients = firstEmailsAgentDemand.getEmailRecipients( );
        String strEmailRecipientsCc = firstEmailsAgentDemand.getEmailRecipientsCc( );
        String strSubject = firstEmailsAgentDemand.getEmailSubject( );

        // Create message item
        TicketEmailExternalUserMessage emailExternalUser = new TicketEmailExternalUserMessage( );
        emailExternalUser.setIdTicket( ticket.getId( ) );
        emailExternalUser.setMessageQuestion( strAgentMessage );
        emailExternalUser.setEmailRecipients( strEmailRecipients );
        emailExternalUser.setEmailRecipientsCc( strEmailRecipientsCc );
        emailExternalUser.setEmailSubject( strSubject );
        _ticketEmailExternalUserDemandDAO.createQuestion( emailExternalUser );

        // Create resource item
        TicketEmailExternalUserHistory emailExternalUserHistory = new TicketEmailExternalUserHistory( );
        emailExternalUserHistory.setIdResourceHistory( nIdResourceHistory );
        emailExternalUserHistory.setIdTask( getId( ) );
        emailExternalUserHistory.setIdMessageExternalUser( emailExternalUser.getIdMessageExternalUser( ) );
        _ticketEmailExternalUserHistoryDAO.insert( emailExternalUserHistory );
    }

    /**
     * Process external user to agent task (response)
     *
     * @param nIdResourceHistory
     *            resourceHistory ID
     * @param ticket
     *            the current ticket
     * @param request
     *            HttpRequest from doAction
     */
    private void processExternalUserTask( int nIdResourceHistory, Ticket ticket, HttpServletRequest request )
Fichier Ligne
fr/paris/lutece/plugins/workflow/modules/ticketing/service/daemon/TicketPjMigrationDaemon.java 292
fr/paris/lutece/plugins/workflow/modules/ticketing/service/task/TaskAutomaticCentralizeAttachments.java 248
            insertTicketPjFromMap( coreIdFileAgentFromIdResponseListClean, ticket, false );
        }
    }

    /**
     * Find the final list of id core from workflow_task_upload_files
     *
     * @param idHistory
     *            the id history
     * @param idCoreUploadFinal
     *            the list of id file to complete
     * @return the final list of id core from workflow_task_upload_files
     */
    private List<Integer> findIsFileFromTaskUploadFiles( int idHistory, List<Integer> idCoreUploadFinal )
    {
        List<Integer> idCoreUploadFound = TicketTransfertPjService.findUploadFiles( idHistory );
        idCoreUploadFinal.addAll( idCoreUploadFound );
        return idCoreUploadFinal;
    }

    /**
     * Find the final list of id core from workflow_task_ticketing_information
     *
     * @param idHistory
     *            the id history
     * @param idResponseTotal
     *            the list of id response to complete
     * @return the final list of id core from workflow_task_ticketing_information
     */
    private List<Integer> findIdResponseFromTaskInfo( int idHistory, List<Integer> idResponseTotal )
    {
        List<Integer> idResponseFromTaskInfo = ticketTaskInfoService( idHistory );
        idResponseTotal.addAll( idResponseFromTaskInfo );
        return idResponseTotal;
    }

    /**
     * Find the final list of id core from workflow_task_notify_gru_history
     *
     * @param idHistory
     *            the id history
     * @param idResponseTotal
     *            the list of id response to complete
     * @return the final list of id core from workflow_task_notify_gru_history
     */
    private List<Integer> findIdResponseFromNotifyHistory( int idHistory, List<Integer> idResponseTotal )
    {
        List<Integer> idResponseFromNotifyHistory = ticketNotifyHsitoryService( idHistory );
        idResponseTotal.addAll( idResponseFromNotifyHistory );
        return idResponseTotal;
    }

    /**
     * Insert pj in ticketing_ticket_pj and update file name in core_file with a id File list
     *
     * @param idFileList
     *            the id pj list
     * @param ticket
     *            the ticket
     * @param isUsagerPj
     *            true if the pj is from usager otherwise false
     */
    private void insertTicketPjAndCleanIdCoreList( List<Integer> idFileList, Ticket ticket, boolean isUsagerPj )
Fichier Ligne
fr/paris/lutece/plugins/workflow/modules/ticketing/business/config/TaskNotifyWaitingTicketConfig.java 41
fr/paris/lutece/plugins/workflow/modules/ticketing/business/email/config/TaskTicketEmailExternalUserConfig.java 43
public class TaskNotifyWaitingTicketConfig extends TaskConfig
{
    @NotNull
    private MessageDirectionExternalUser _messageDirectionExternalUser;

    private Integer _nIdFollowingAction;

    private Integer _nIdContactAttribute;

    private String _strDefaultSubject;

    /**
     * Gives the message direction
     *
     * @return the message direction
     */
    public MessageDirectionExternalUser getMessageDirectionExternalUser( )
    {
        return _messageDirectionExternalUser;
    }

    /**
     * Sets the message direction
     *
     * @param messageDirectionExternalUser
     *            the message direction to set
     */
    public void setMessageDirectionExternalUser( MessageDirectionExternalUser messageDirectionExternalUser )
    {
        _messageDirectionExternalUser = messageDirectionExternalUser;
    }

    /**
     * @return the idFollowingAction
     */
    public Integer getIdFollowingAction( )
    {
        return _nIdFollowingAction;
    }

    /**
     * @param nIdFollowingAction
     *            the idFollowingAction to set
     */
    public void setIdFollowingAction( Integer nIdFollowingAction )
    {
        _nIdFollowingAction = nIdFollowingAction;
    }

    /**
     * @return true if the direction is agent to external user
     */
    public boolean isMessageToExternalUser( )
    {
        return MessageDirectionExternalUser.AGENT_TO_EXTERNAL_USER.equals( _messageDirectionExternalUser );
    }

    /**
     * @return the idContactAttribute
     */
    public Integer getIdContactAttribute( )
    {
        return _nIdContactAttribute;
    }

    /**
     * @param nIdContactAttribute
     *            Id Contact Attribute
     */
    public void setIdContactAttribute( Integer nIdContactAttribute )
    {
        _nIdContactAttribute = nIdContactAttribute;
    }

    public String getDefaultSubject( )
    {
        return _strDefaultSubject;
    }

    public void setDefaultSubject( String defaultSubject )
    {
        _strDefaultSubject = defaultSubject;
    }
}
Fichier Ligne
fr/paris/lutece/plugins/workflow/modules/ticketing/service/daemon/TicketPjMigrationDaemon.java 117
fr/paris/lutece/plugins/workflow/modules/ticketing/service/task/TaskAutomaticCentralizeAttachments.java 84
                    try
                    {
                        TransactionManager.beginTransaction( _plugin );

                        // recuperation des PJ usager
                        managePjforS3ForUsager( ticket );

                        // recuperation des PJ agent par id_history
                        List<Integer> idResponseTotal = new ArrayList<>( );
                        List<Integer> idCoreUploadFinal = new ArrayList<>( );

                        List<Integer> idHistoryList = _daoResourceHist.getIdHistoryListByResource( ticket.getId( ), _plugin );
                        for ( int idHistory : idHistoryList )
                        {
                            // tables workflow_task_ticketing_information et workflow_task_notify_gru_history
                            idResponseTotal = searchPjFromTaskInfoAndNotifyHistory( idHistory, idResponseTotal );

                            // table workflow_task_upload_files
                            idCoreUploadFinal = searchPjFromTaskUploadFiles( idHistory, idCoreUploadFinal );
                        }

                        if ( !idResponseTotal.isEmpty( ) )
                        {
                            managePjforS3WithIdResponse( idResponseTotal, ticket );
                        }
                        if ( !idCoreUploadFinal.isEmpty( ) )
                        {
                            // usager false
                            managePjforS3ForAgent( idCoreUploadFinal, ticket, false );
                        }
Fichier Ligne
fr/paris/lutece/plugins/workflow/modules/ticketing/business/email/message/TicketEmailExternalUserMessageDAO.java 298
fr/paris/lutece/plugins/workflow/modules/ticketing/business/email/message/TicketEmailExternalUserMessageDAO.java 334
            while ( daoUtil.next( ) )
            {
                nIndex = 1;
                emailExternalUserMessage = new TicketEmailExternalUserMessage( );
                emailExternalUserMessage.setIdMessageExternalUser( daoUtil.getInt( nIndex++ ) );
                emailExternalUserMessage.setIdTicket( daoUtil.getInt( nIndex++ ) );
                emailExternalUserMessage.setEmailRecipients( daoUtil.getString( nIndex++ ) );
                emailExternalUserMessage.setEmailRecipientsCc( daoUtil.getString( nIndex++ ) );
                emailExternalUserMessage.setMessageQuestion( daoUtil.getString( nIndex++ ) );
                emailExternalUserMessage.setMessageResponse( daoUtil.getString( nIndex++ ) );
                emailExternalUserMessage.setIsAnswered( daoUtil.getBoolean( nIndex++ ) );
                emailExternalUserMessage.setEmailSubject( daoUtil.getString( nIndex++ ) );
Fichier Ligne
fr/paris/lutece/plugins/workflow/modules/ticketing/service/daemon/NotifyDaemon.java 408
fr/paris/lutece/plugins/workflow/modules/ticketing/service/daemon/NotifyLevel3Daemon.java 301
fr/paris/lutece/plugins/workflow/modules/ticketing/service/daemon/NotifyUsagerDaemon.java 323
        }
        return 0;
    }

    /**
     * Renvoie la date de prochaine relance
     *
     * @param dateDerniereRelance
     *            date de dernière relance
     * @return date limite de relance
     */
    private Date getDatelimiteRelance( Timestamp dateDerniereRelance )
    {
        Calendar calendarLimiteRelance = Calendar.getInstance( );
        calendarLimiteRelance.setTime( dateDerniereRelance );

        if ( isMinuteMode == 1 )
        {
            calendarLimiteRelance.add( Calendar.MINUTE, nFrequence );
            // date dernière relance + n minutes
        }
        else
        {
            // date à 00h 00mn 00s
            calendarLimiteRelance.set( Calendar.HOUR_OF_DAY, 0 );
            calendarLimiteRelance.set( Calendar.MINUTE, 0 );
            calendarLimiteRelance.set( Calendar.SECOND, 0 );
            calendarLimiteRelance.set( Calendar.MILLISECOND, 0 );
            calendarLimiteRelance.add( Calendar.DAY_OF_YEAR, nFrequence );
            // date dernière relance + n jours
        }
        return calendarLimiteRelance.getTime( );
    }

    /**
     *
     * @param nIdResource
     *            identifiant de la ressource
     * @param nIdWorkflow
     *            identifiant du workflow
     * @return identifiant de la dernière action si dans la liste des actions de sollicitation
     */
    private int getLastManualActionSollicitation( int nIdResource, int nIdWorkflow )
Fichier Ligne
fr/paris/lutece/plugins/workflow/modules/ticketing/web/task/TicketingTaskComponent.java 211
fr/paris/lutece/plugins/workflow/modules/ticketing/web/task/TicketingTaskComponent.java 249
        ReferenceList lstRef = new ReferenceList( listUnitByLevel.size( ) );
        ReferenceItem emptyReferenceItem = new ReferenceItem( );
        emptyReferenceItem.setCode( StringUtils.EMPTY );
        emptyReferenceItem.setName( I18nService.getLocalizedString( MESSAGE_DEFAULT_LABEL_ENTITY_TASK_FORM, Locale.FRANCE ) );
        emptyReferenceItem.setChecked( true );
        lstRef.add( emptyReferenceItem );

        for ( AssigneeUnit unit : listUnitByLevel )
        {

            if ( RBACService.isAuthorized( unit, AssigneeUnit.PERMISSION_ASSIGN, (User) user ) )
            {
                lstRef.addItem( unit.getUnitId( ), unit.getName( ) );
            }
        }

        return lstRef;
    }

    /**
     * Load the data of all the unit objects allowed for assignment and returns them in form of a collection
     *
     * @param user
     *            connected admin user
     * @param levelList
     *            the level list
     * @return the list which contains the data of all the unit objects
     */
    protected static ReferenceList getUnitsList( AdminUser user, List<Integer> levelList )
Fichier Ligne
fr/paris/lutece/plugins/workflow/modules/ticketing/business/config/TaskNotifyWaitingTicketConfigDAO.java 150
fr/paris/lutece/plugins/workflow/modules/ticketing/business/email/config/TaskTicketEmailExternalUserConfigDAO.java 156
                config = new TaskNotifyWaitingTicketConfig( );
                config.setIdTask( daoUtil.getInt( nIndex++ ) );
                config.setMessageDirectionExternalUser( MessageDirectionExternalUser.valueOf( daoUtil.getInt( nIndex++ ) ) );

                String strIdFollowingAction = daoUtil.getString( nIndex++ );

                if ( StringUtils.isNotEmpty( strIdFollowingAction ) )
                {
                    config.setIdFollowingAction( Integer.parseInt( strIdFollowingAction ) );
                }

                String strIdContactAttribute = daoUtil.getString( nIndex++ );

                if ( StringUtils.isNotEmpty( strIdContactAttribute ) )
                {
                    config.setIdContactAttribute( Integer.parseInt( strIdContactAttribute ) );
                }

                config.setDefaultSubject( daoUtil.getString( nIndex ) );
Fichier Ligne
fr/paris/lutece/plugins/workflow/modules/ticketing/business/config/TaskNotifyWaitingTicketConfigDAO.java 63
fr/paris/lutece/plugins/workflow/modules/ticketing/business/config/TaskNotifyWaitingTicketConfigDAO.java 103
fr/paris/lutece/plugins/workflow/modules/ticketing/business/email/config/TaskTicketEmailExternalUserConfigDAO.java 106
            daoUtil.setInt( nIndex++, config.getMessageDirectionExternalUser( ).ordinal( ) );

            if ( config.getIdFollowingAction( ) == null )
            {
                daoUtil.setIntNull( nIndex++ );
            }
            else
            {
                daoUtil.setInt( nIndex++, config.getIdFollowingAction( ) );
            }

            if ( config.getIdContactAttribute( ) == null )
            {
                daoUtil.setIntNull( nIndex++ );
            }
            else
            {
                daoUtil.setInt( nIndex++, config.getIdContactAttribute( ) );
            }

            if ( config.getDefaultSubject( ) == null )
            {
                daoUtil.setString( nIndex, StringUtils.EMPTY );
Fichier Ligne
fr/paris/lutece/plugins/workflow/modules/ticketing/business/email/message/TicketEmailExternalUserMessageDAO.java 206
fr/paris/lutece/plugins/workflow/modules/ticketing/business/email/message/TicketEmailExternalUserMessageDAO.java 237
fr/paris/lutece/plugins/workflow/modules/ticketing/business/email/message/TicketEmailExternalUserMessageDAO.java 268
fr/paris/lutece/plugins/workflow/modules/ticketing/business/email/message/TicketEmailExternalUserMessageDAO.java 301
                emailExternalUserMessage = new TicketEmailExternalUserMessage( );
                emailExternalUserMessage.setIdMessageExternalUser( daoUtil.getInt( nIndex++ ) );
                emailExternalUserMessage.setIdTicket( daoUtil.getInt( nIndex++ ) );
                emailExternalUserMessage.setEmailRecipients( daoUtil.getString( nIndex++ ) );
                emailExternalUserMessage.setEmailRecipientsCc( daoUtil.getString( nIndex++ ) );
                emailExternalUserMessage.setMessageQuestion( daoUtil.getString( nIndex++ ) );
                emailExternalUserMessage.setMessageResponse( daoUtil.getString( nIndex++ ) );
                emailExternalUserMessage.setIsAnswered( daoUtil.getBoolean( nIndex++ ) );
                emailExternalUserMessage.setEmailSubject( daoUtil.getString( nIndex++ ) );
Fichier Ligne
fr/paris/lutece/plugins/workflow/modules/ticketing/web/task/TicketingTaskComponent.java 211
fr/paris/lutece/plugins/workflow/modules/ticketing/web/task/TicketingTaskComponent.java 287
        ReferenceList lstRef = new ReferenceList( listUnitByLevel.size( ) );
        ReferenceItem emptyReferenceItem = new ReferenceItem( );
        emptyReferenceItem.setCode( StringUtils.EMPTY );
        emptyReferenceItem.setName( I18nService.getLocalizedString( MESSAGE_DEFAULT_LABEL_ENTITY_TASK_FORM, Locale.FRANCE ) );
        emptyReferenceItem.setChecked( true );
        lstRef.add( emptyReferenceItem );

        for ( AssigneeUnit unit : listUnitByLevel )
        {

            if ( RBACService.isAuthorized( unit, AssigneeUnit.PERMISSION_ASSIGN, (User) user ) )
            {
                lstRef.addItem( unit.getUnitId( ), unit.getName( ) );
            }
        }

        return lstRef;
    }
Fichier Ligne
fr/paris/lutece/plugins/workflow/modules/ticketing/service/daemon/NotifyDaemon.java 107
fr/paris/lutece/plugins/workflow/modules/ticketing/service/daemon/NotifyLevel3Daemon.java 90
    private int nIdActionRetourFromContribNiv3 = AppPropertiesService.getPropertyInt( "workflow-ticketing.actions.id.return.sollicite.contrib_un",
            TicketingConstants.PROPERTY_UNSET_INT );

    // nombre de relances maximum avant retour de la sollicitation
    private int nbRelanceMax = PluginConfigurationService.getInt( PluginConfigurationService.PROPERTY_RELANCE_NB_MAX, 3 );
    // durée en jours entre chaque relance
    private int nFrequence = PluginConfigurationService.getInt( PluginConfigurationService.PROPERTY_RELANCE_FREQUENCE, 10 );

    @Override
    public void run( )
    {
        setLastRunLogs( processNotification( ) );
    }

    private String processNotification( )
    {
        StringBuilder sbLog = new StringBuilder( );

        boolean isParamOK = isConfParamOK( sbLog );
        if ( !isParamOK )
        {
            return sbLog.toString( );
        }

        // Date execution
        Date dateExecution = new Date( );

        int nNbTicketRelance = 0;
        int nNbTicketRetour = 0;

        // step 0: récupération des ressources au statut "En attente d'une reponse"

        List<Integer> listResourceWaitingId = _workflowService.getResourceIdListByIdState( nIdStateWaiting, Ticket.TICKET_RESOURCE_TYPE );