ssossossosso

Forums

Covering OroCRM topics, including community updates and company announcements.  Subscribe

This topic contains 10 replies, has 2 voices, and was last updated by Mike Kudelya Mike Kudelya 12 months ago.

  • Creator
    Topic
  • #24262

    bosumflici
    Participant

    Hi,

    I want to build a datagrid that selects all users who have not been updated in a date interval. Something like this:

    SELECT u1.id, u1.username FROM oro_user u1 WHERE u1.id NOT IN (SELECT u2.id FROM oro_user u2 WHERE u2.updatedAt BETWEEN ‘2016-07-01’ AND ‘2016-11-30’)

    Can i write a datagrid.yml to do this? I do not figure out how to write the condition!!!

    Thanks!

Viewing 10 replies - 1 through 10 (of 10 total)
  • Author
    Replies
  • #24283
    Mike Kudelya
    Mike Kudelya
    Oro Core

    Hi

    I think subselect is not necessary.

    datagrid.yml:

    #24289

    bosumflici
    Participant

    Thanks Mike! Above i did not choose the best example to describe my problem.

    I have a table with resources and a table with events related to those resources. What i need is a datagrid filled with all resources that do not have events that do not overlap with a time interval.

    So, with standard select i would write:

    I did it this way:

    So this is DONE.

    Next i implemented a workflow to select start and end dates in the first step, and in the second step i extended oro_multiple_entity to use with the above grid in the 2nd workflow transition. The problem appears after i choose the rows from datagrid widget, which have to be added to the form field after pressing the <select> button. They render fine on the view, but when i submit the form it says “This value should not be blank.”
    After digging a while i figured out that it does not sets the ids to the hidden form element to be saved (oro_workflow_transition_offer_resources_added)!!!
    If i press on “x” it removes those coresponding ids from the view and also sets the ids to the hidden form element to be removed after submit. (oro_workflow_transition_offer_resources_removed)

    Do you have any idea why is this happening and how to fix it?!

    Thanks!

    #24291

    bosumflici
    Participant

    I’ve found the missing code:

    Thanks!

    #24295

    bosumflici
    Participant

    Back 🙁

    Can you help me setting initial_elements of the oro_multiple_entity in a workflow step? I cannot figure it out!!!

    #24297
    Mike Kudelya
    Mike Kudelya
    Oro Core

    Hi

    Can you give me workflow config, templates so that i can emulate you case. Screenshots would be very useful. Can you give me more information, what do you want to achieve? What is wrong ?

    #24302

    bosumflici
    Participant

    This is my workflow config:

    This is my type config:

    First step in workflow is to create a new entity (offer). This is where i give a name and the time interval (start/end):
    workflow create transition
    After that it redirects to the entity view:
    entity view

    Second step in the workflow is to select related entity records using a custom oro_multiselect_entity, with datagrid filtered by previous start and end date (datagrid config can be seen in above posts):
    oro_multiselect_entity
    As you see in the picture there are no records added.

    Then i press <+Add> to add records:
    datagrid selection
    Here i select the first two records and add them to the form.
    added to form
    And finally i save them, redirect to the entity view page and can be seen in the datagrid:
    final view

    The problem appears when i go back one step, where i have to select new records/deselect currently selected. Previously selected records does not appear on the form so i can remove them.
    oro_multiselect_entity
    Also if i press the <+Add> button to open the grid, they do not appear as selected in the grid:
    oro_multiselect_entity

    I’d appreciate if you could help me with this issue.
    Thanks!

    #24311
    Mike Kudelya
    Mike Kudelya
    Oro Core

    Hi

    I found the way how to resolve the problem. I want to show here code which you probably wrote and new, which fixed the problem. Here is example how i added contacts to my opportunity entity.

    I modified filters transition, main idea – give opportunity id to controller (custom_oro_contact_grid):

    Here is action (it returns list of contact ids which will be selected on grid):

    Action template:

    Here is my contact grid:

    and last thing, custom multiple entity type (it is printing saved contacts on page):

    #24351

    bosumflici
    Participant

    Thanks Mike!

    Giving id to the controller fixed the problem. What i’ve encountered next is that when i apply a filter to the datagrid, in a workflow step, i get:

    Catchable Fatal Error: Argument 1 passed to Doctrine\DBAL\Connection::resolveParams() must be of the type array, null given, called in /var/www/html/crm-application/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php on line 836 and defined in /var/www/html/crm-application/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php on line 1524

    Outside of the workflow datagrid filters works fine. Any idea what could cause this?

    #24373

    bosumflici
    Participant

    My bad here, i was sending a datetime value, instead of a date.

    Tnank you!

    #24376
    Mike Kudelya
    Mike Kudelya
    Oro Core

    Hi

    It is strange, i have modified contacts-grid and all works fine. Maybe you forgot set value (or column type) to binded parameter.. Try to make grid as easy as possible, to understand what is wrong. Here is my filters:

Viewing 10 replies - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.