Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid criteria for contract notices links #17432

Closed
2 tasks done
Kuba-Pawlak opened this issue Jul 4, 2024 · 0 comments
Closed
2 tasks done

Invalid criteria for contract notices links #17432

Kuba-Pawlak opened this issue Jul 4, 2024 · 0 comments
Assignees
Labels
Milestone

Comments

@Kuba-Pawlak
Copy link

Kuba-Pawlak commented Jul 4, 2024

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues

Version

10.0.16

Bug description

There is similar bug to 13453 related to contracts where notice begins in less 7 and 30 days. Both of them are the same.
I think the problem is in src/Contracts.php starting in row 1019
Code:

   $options['criteria'][0]['field'] = 13;
    $options['criteria'][0]['value'] = '>0';
    $options['criteria'][1]['field'] = 13;
    $options['criteria'][1]['value'] = '<7';
    $twig_params['items'][] = [
        'link'   => $CFG_GLPI["root_doc"] . "/front/contract.php?" . Toolbox::append_params($options),
        'text'   => __('Contracts where notice begins in less than 7 days'),
        'count'  => $contractpre7
    ];

    $options['criteria'][0]['value'] = '>6';
    $options['criteria'][1]['value'] = '<30';
    $twig_params['items'][] = [
        'link'   => $CFG_GLPI["root_doc"] . "/front/contract.php?" . Toolbox::append_params($options),
        'text'   => __('Contracts where notice begins in less than 30 days'),
        'count'  => $contractpre30
    ];

should be replaced by

    $options['criteria'][0]['field'] = 13;
    $options['criteria'][0]['searchtype'] = 'morethan';
    $options['criteria'][0]['value']      = '0DAY';
    $options['criteria'][1]['field'] = 13;
    $options['criteria'][1]['searchtype'] = 'lessthan';
    $options['criteria'][1]['value']      = '7DAY';
    $twig_params['items'][] = [
        'link'   => $CFG_GLPI["root_doc"] . "/front/contract.php?" . Toolbox::append_params($options),
        'text'   => __('Contracts where notice begins in less than 7 days'),
        'count'  => $contractpre7
    ];

    $options['criteria'][0]['field'] = 13;
    $options['criteria'][0]['searchtype'] = 'morethan';
    $options['criteria'][0]['value']      = '6DAY';
    $options['criteria'][1]['field'] = 13;
    $options['criteria'][1]['searchtype'] = 'lessthan';
    $options['criteria'][1]['value']      = '1MONTH';
    $twig_params['items'][] = [
        'link'   => $CFG_GLPI["root_doc"] . "/front/contract.php?" . Toolbox::append_params($options),
        'text'   => __('Contracts where notice begins in less than 30 days'),
        'count'  => $contractpre30
    ];

Relevant log output

No response

Page URL

No response

Steps To reproduce

No response

Your GLPI setup information

No response

Anything else?

No response

@cconard96 cconard96 self-assigned this Jul 18, 2024
@cconard96 cconard96 added the bug label Jul 18, 2024
@cedric-anne cedric-anne added this to the 10.0.17 milestone Jul 22, 2024
@cedric-anne cedric-anne changed the title 10.0.16 similar bug to 13453 Invalid criteria for contract notices links Jul 22, 2024
btry pushed a commit to btry/glpi that referenced this issue Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants