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

pods_ui - "relationship" field type ( simple custom defined list) - orderby issue #1201

Closed
paoloimpelluso opened this issue Apr 4, 2013 · 23 comments
Assignees
Milestone

Comments

@paoloimpelluso
Copy link

I've got a problem with "relationship" field type (simple custom defined list) in pods_ui; i can correctly define this kind of field in the "manage_fields_array", and it shows up in the manage page (i've followed this tutorial http://lowgravity.pl/blog/introduction-to-podscms-2-0-part-2-pods_ui-parameters/), but:

  • when i click on the column title (to reorder the list) a sql error shows up: Unknown column 't.field_name' in 'order clause'. It only happens for this kind of field, others are working properly (text_field, date_fields, other kind of relationship fields etc etc)
  • in the simple custom defined list (value|label), if I use 0 (zero) for the value, i can't see the traslation in the manage view (only the code) ... it's like the "0" code can't be used ...
@sc0ttkclark
Copy link
Member

Please post the related pods_ui code you are using.

@ghost ghost assigned sc0ttkclark Apr 4, 2013
@paoloimpelluso
Copy link
Author

    $manage_fields_array = array(
                    'post_title'        => 'Title',
                    'booking_status'    => 'Booking Status',
                    'wu_client'         => 'Client',
                    'wu_room'           => 'Actual Rooms',
                    'id_channel'        => 'Channel',
                    'date_arrival'      => 'Date Arrival',
                    'date_departure'    => 'Date Departure',
                    'date_received'     => 'Date Received'
                    );

    $filters_array      = array('booking_status','id_channel');

    //defining pods object
    $object = pods('wu_booking');

    //altering pods object
    $object->ui = array(

            //singular item label
            'item'      => 'Booking',

            //plural items label
            'items'     => 'Bookings',

            //field definitions
            'fields'    => array(
                            'manage'    => $manage_fields_array
                    ),

            //default sort
            'orderby'   => 'date_received DESC', // like 't.column_name DESC'

            //those fields will be independently searchable
            'filters'   => $filters_array,

            //action button labels
            'label'     => array(
                    'add'       => 'Add Booking',
                    'edit'      => 'Edit Booking'
                    ),

            );

    pods_ui($object);

@paoloimpelluso
Copy link
Author

ordering by "booking_status" or "id_channel" (that are simple relationship fields) is cusing the issue.
these are my custom defined lists:

booking status

1|Confirmed
2|Waiting for approval
3|Refused
4|Accepted
5|Deleted
6|Deleted with penalty

id_channel (the zero value is causing the 2nd issue)

0|Wubook
1|Expedia
2|Booking.com
3|Hotel.de
4|Itwg
5|InItalia
6|Hotels.com (Expedia)
7|Reserver.it
8|Accomodationz.com
9|HotelBeds
10|Venere.com

@sc0ttkclark
Copy link
Member

Can you also export the pod in question, using Pods Admin > Components > Migrate Packages

@paoloimpelluso
Copy link
Author

The POD in question is a CPT with custom fields stored with Storage Type Table.
If I use the migrate tool to export package, the only output i obtain is: {"meta":{"version":"2.3-rc-1","build":1365112157},"pods":{"86":"Bookings"}}

am i doing something wrong?

@sc0ttkclark
Copy link
Member

Try 2.3 again, I just patched the issue you came across with the export package.

@paoloimpelluso
Copy link
Author

ok it worked! .. how can i send you the export? email?

@sc0ttkclark
Copy link
Member

Try creating a gist and pasting it into it, then send the URL. http://gists.github.com

@sc0ttkclark
Copy link
Member

Oops, http://gist.github.com

@paoloimpelluso
Copy link
Author

@sc0ttkclark
Copy link
Member

To be sure I understand you correctly, you said when you click on a column title, for which field do you get the error on?

@sc0ttkclark
Copy link
Member

Oops, sorry. Misread, I haven't had my morning energy drink yet ;)

@paoloimpelluso
Copy link
Author

don't worry: id_channel and booking_status ... a little help from italy. here i'm having my after lunch coffee.

@sc0ttkclark
Copy link
Member

I've been fixing a few issue with package import, and pod/field saving for table definitions, once done I'll be able to get back to this specific issue.

@sc0ttkclark
Copy link
Member

All good now! Thanks for your help here :)

@paoloimpelluso
Copy link
Author

Thank you! I've just downloaded the last commit and the orderby issue has gone!
What about the 2nd issue? it's a minor issue and i can manage it (not using "0" in custom list) ... but anyway it's still there ... it's a strange behaviour: in manage list i see "0" (not traslated), in edit screen i see "Wubook" selected in drop down list.

@sc0ttkclark
Copy link
Member

You mean in the manage list where the field value would output, not the filter for that field, right?

@sc0ttkclark sc0ttkclark reopened this Apr 6, 2013
@paoloimpelluso
Copy link
Author

yes in the manage list! ... thanks

@sc0ttkclark
Copy link
Member

I'm looking into that now

@sc0ttkclark
Copy link
Member

Fixed!

@paoloimpelluso
Copy link
Author

thanks!

@paoloimpelluso
Copy link
Author

Hi Scott,
something went wrong when updating to 2.3 :(

Now, in the manage screen, i can see simple relationship fields, they are correctly translated e i can order by them; but:

  • other relationship fields (related to others pods) are not visible anymore in the manage screen.
  • they are still visible and associated correctly in edit screen (so relation is correctly defined, but not shown in manage).

thanks for your time and effort
Paolo

@sc0ttkclark
Copy link
Member

Try the latest again, just fixed that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants