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

only 10 lens with expand_dropdowns=True #17600

Closed
2 tasks
antoinemvp opened this issue Jul 26, 2024 · 1 comment
Closed
2 tasks

only 10 lens with expand_dropdowns=True #17600

antoinemvp opened this issue Jul 26, 2024 · 1 comment
Labels

Comments

@antoinemvp
Copy link

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.10

Bug description

For managing my stock, I am setting up an application and an API. A web page must be dedicated to scanning lost objects. Let me explain, if I find a mouse that is no longer on a desk, the QR code that will be scanned returns its ID (itemID). With that, I aim to retrieve to which user it is attached.

I tried with expand_dropdowns but it seems that it does not work.

Not being an expert in coding and despite my research, I am turning to you to see if you have a solution to this problem.

Code Python
glpi_screenshot (2).docx
:

@app.route('/gestion_equipement', methods=['GET', 'POST'])
def gestion_equipement():
    user_info = None
    if request.method == 'POST':
        qr_code = request.form.get('qrCode')
        category = request.form.get('category')

        try:
            # Rechercher l'item par QR code et catégorie
            criteria = [
                {'field': '1', 'searchtype': 'equals', 'value': qr_code}
            ]
            items = glpi.search(category, criteria=criteria, expand_dropdowns=True)

            # Vérifier si l'item est trouvé et s'il est rattaché à un utilisateur
            if items and len(items) > 0:
                item = items[0]
                user_id = item.get('users_id')
                if  user_id & user_id != '0':
                    user = glpi.get_item('User', user_id)
                    
                    user_info = f"Rattaché à l'utilisateur : {user['name']}"
                else:
                    user_info = 'Item non rattaché à un utilisateur'
            else:
                user_info = 'Item non trouvé'
        except Exception as e:
            user_info = str(e)

    return render_template('gestion_equipement.html', user_info=user_info)
    

The image shows that it only returns 10 values, and I can't get it to return more.

Thank you for your help.

Relevant log output

No response

Page URL

No response

Steps To reproduce

No response

Your GLPI setup information

No response

Anything else?

No response

@antoinemvp antoinemvp changed the title only 10 lens with expand_ropdowns=True only 10 lens with expand_dropdowns=True Jul 26, 2024
Copy link
Contributor

This issue has been closed as we only track bugs here.

You can get community support on forums or you can consider taking a subscription to get professional support.
You can also contact GLPI editor team directly.

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

2 participants