Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.
Forum Replies Created
-
AuthorReplies
-
Hello,
It is a custom datagrid and it is about a custom mass action.
In select i had a NOT IN where clause, which gets an array with many ids to filter the datagrid rows. And when i call the mass action, the url get all the datagrid parameters, and also these ids and i get this error.I changed my code to get the datagrid rows through a repository method call and skip passing those ids in the url.
Thank you!
Sorry for late reply.
No that’s not what i meant. I create an attachment relation through migration. Later i need to drop that relation. How can i do that?
Today i noticed a stranged behavior! When clicking the export -> csv button, sometimes works, sometimes not. No php/js or log errors found.
Any ideea why is this happening?
November 22, 2016 at 4:35 am in reply to: Datagrid: select ids that are not part of another select from the same table #36372My bad here, i was sending a datetime value, instead of a date.
Tnank you!
November 22, 2016 at 12:51 am in reply to: Datagrid: select ids that are not part of another select from the same table #36371Thanks 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?
November 17, 2016 at 8:20 am in reply to: Datagrid: select ids that are not part of another select from the same table #36369This is my workflow config:
YAML123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146workflows:offer:label: 'Create new offer'entity: CB\Bundle\NewAgeBundle\Entity\Offerentity_attribute: offerattributes:offer_name:property_path: offer.nameoffer_start:property_path: offer.startoffer_end:property_path: offer.endoffer_campaign:property_path: offer.campaignoffer_panel_views:label: 'Panel Views'property_path: offer.panelViewssteps:started:label: 'Initiated'order: 10allowed_transitions:- create- filtersfiltered:label: 'Panel Views selected'order: 20allowed_transitions:- filters- closeclosed:label: 'Finished'order: 30allowed_transitions:transitions:create:label: 'Create offer'step_to: startedis_start: trueis_hidden: falseis_unavailable_hidden: falseacl_resource: cb_newage_offer_createdisplay_type: pagefrontend_options:icon: 'icon-edit'class: 'btn-primary'page:parent_route: 'cb_newage_offer_index'parent_label: cb.newage.offer.entity_plural_labelform_options:attribute_fields:offer_name:form_type: textoptions:required: trueconstraints:- NotBlank: ~offer_start:options:required: trueconstraints:- NotBlank: ~offer_end:options:required: trueconstraints:- NotBlank: ~offer_campaign:form_type: entityoptions:required: trueclass: CB\Bundle\NewAgeBundle\Entity\Campaignconstraints:- NotBlank: ~init_actions:- @create_date:attribute: $offer_start- @create_date:attribute: $offer_endtransition_definition: create_definitionfilters:label: 'Select panel views'step_to: filteredis_unavailable_hidden: falseacl_resource: cb_newage_offer_updatedisplay_type: pagefrontend_options:icon: 'icon-filter'class: 'btn-success'page:parent_route: 'cb_newage_offer_index'parent_label: cb.newage.offer.entity_plural_labelform_options:attribute_fields:offer_panel_views:form_type: cb_panel_view_multiple_entityoptions:required: trueclass: 'CBNewAgeBundle:PanelView'add_acl_resource: 'cb_newage_panel_view_view'selector_window_title: 'cb.newage.offer.form.select_panel_views'selection_route: 'cb_offer_widget_panel_views_info'constraints:- NotBlank: ~transition_definition: filters_definitionclose:label: 'Close'step_to: closedis_unavailable_hidden: falsefrontend_options:icon: 'icon-ok'transition_definition: closed_definitiontransition_definitions:create_definition:post_actions:- @create_related_entity: # create Offer if it not exist yetconditions:@empty: [$offer.id]parameters: ~- @redirect: # redirect to Offer view pageroute: 'cb_newage_offer_view'route_parameters:id: $offer.idworkflow: truefilters_definition:post_actions:- @tree:- actions:- @call_method:object: $offermethod: setPanelViewsmethod_parameters: $offer.panelViews- @redirect: # redirect to Offer view pageroute: 'cb_newage_offer_view'route_parameters:id: $offer.idclosed_definition: ~This is my type config:
PHP1234567891011121314151617181920212223<?phpnamespace CB\Bundle\NewAgeBundle\Form\Type;use Symfony\Component\Form\AbstractType;use Symfony\Component\OptionsResolver\OptionsResolverInterface;class PanelViewMultipleEntityType extends AbstractType{/*** {@inheritdoc}*/public function getParent(){return 'oro_multiple_entity';}/*** {@inheritdoc}*/public function getName(){return 'cb_panel_view_multiple_entity';}}First step in workflow is to create a new entity (offer). This is where i give a name and the time interval (start/end):
After that it redirects to the 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):
As you see in the picture there are no records added.Then i press <+Add> to add records:
Here i select the first two records and add them to the form.
And finally i save them, redirect to the entity view page and can be seen in the datagrid:
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.
Also if i press the <+Add> button to open the grid, they do not appear as selected in the grid:
I’d appreciate if you could help me with this issue.
Thanks!November 17, 2016 at 4:14 am in reply to: Datagrid: select ids that are not part of another select from the same table #36367Back :(
Can you help me setting initial_elements of the oro_multiple_entity in a workflow step? I cannot figure it out!!!
November 17, 2016 at 1:07 am in reply to: Datagrid: select ids that are not part of another select from the same table #36366I’ve found the missing code:
YAML12345678options:routerEnabled: falserowSelection:dataField: idcolumnName: hasContactselectors:included: '#appendPanelViews'excluded: '#removePanelViews'Thanks!
November 16, 2016 at 11:49 pm in reply to: Datagrid: select ids that are not part of another select from the same table #36365Thanks 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:
MySQL12345678SELECT res.id FROM resources resWHERE res.id NOT IN (SELECT ev.resource_id FROM events evWHERE (ev.start >= :start AND ev.start <= :end) OR(ev.end >= :start AND ev.end <= :end) OR(ev.start >= :start AND ev.end <= :end) OR(ev.start <= :start AND ev.end >= :end))I did it this way:
YAML1234567891011121314151617query:select:- res.id...join:left:-join: res.eventsalias: evconditionType: WITHcondition: '(ev.start >= :start AND ev.start <= :end) OR (ev.end >= :start AND ev.end <= :end) OR (ev.start >= :start AND ev.end <= :end) OR (ev.start <= :start AND ev.end >= :end)'where:and:- ev.resource IS NULLbind_parameters:- start- endSo 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!
Hi,
I enabled attachments via “System -> Entities -> Entity Management -> Your Entity -> Edit -> Enable Attachments” and by migrations, on custom and system entity but same result. After i run that command, attachments disapear and i have to re-enabled them. I use:
oro/platform dev-master MIT
oro/crm dev-master OSL-3.0Thanks!
Thank you Mike! Indeed is a good base to start. Your code works like charm!
To understand better i added a print screen:
Looking at this picture, i need to be able to filter calendar events when i change a filter from the grid filters.
Thanks!
No! I have developed my own calendar bundle with my custom evenst entity. The calendar view is working good. What i need now is to add some filters for the calendar view to filter the events. I was thinking to use the filters that shows with a datagrid in a index template, but instead of filtering datagrid collection, they must filter the calenndar events collection.
Hi
It’s not about the oro default calendar events. I’ve created my custom event entity and it has some properties which i need to filter. For example if we refer to orocalendar events i need to filter events by description containing some “text”!
Thanks
property: fullName
-
AuthorReplies