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

APIv4 pseudoconstant improvements #21184

Merged
merged 3 commits into from
Aug 21, 2021
Merged

Conversation

colemanw
Copy link
Member

@colemanw colemanw commented Aug 19, 2021

Overview

Makes SearchKit handle large option lists more efficiently, and adds APIv4 field metadata about available suffixes.

Before

After

  • "prefetch: false" pseduconstant flag causes APIv4 to never load those options, and report options: false in getFields.
  • The list of available suffixes (:label, :abbr, etc) is discoverable via the new "suffixes" field property.
  • SearchKit no longer loads every campaign into the UI due to options: false in getFields.

Technical Details

This breaks apart the concept of a field having 'options' vs a field supporting suffixes like campaign_id:label.
It is now possible for a field to not have options (prefetch = false) but still support suffixes.

@civibot
Copy link

civibot bot commented Aug 19, 2021

(Standard links)

@civibot civibot bot added the master label Aug 19, 2021
@colemanw colemanw changed the title Pseudoconstant fixes APIv4 pseudoconstant improvements Aug 19, 2021
@colemanw colemanw force-pushed the pseudoconstantFixes branch 2 times, most recently from 8694693 to 5762539 Compare August 19, 2021 20:21
@eileenmcnaughton
Copy link
Contributor

OK - I just tested updating this

This is the part as it related to campaign - @colemanw I see it loaded 2 options when I loaded the updated form

{"name":"campaign_id","description":"The campaign for which this contribution has been triggered.","data_type":"Integer","serialize":null,"fk_entity":"Campaign","options":[{"id":2,"label":"big one","description":"","name":"big_one"},{"id":1,"label":"campaign","description":"","name":"campaign"}],"label":"Campaign","input_type":"EntityRef"},

{"values":[{"name":"contact_id","description":"FK to Contact ID","data_type":"Integer","serialize":null,"fk_entity":"Contact","options":false,"label":"Contact","input_type":"EntityRef"},{"name":"financial_type_id","description":"FK to Financial Type for (total_amount - non_deductible_amount).","data_type":"Integer","serialize":null,"fk_entity":"FinancialType","options":[{"id":3,"label":"Campaign Contribution","description":"","name":"Campaign Contribution"},{"id":1,"label":"Donation","description":"","name":"Donation"},{"id":4,"label":"Event Fee","description":"","name":"Event Fee"},{"id":2,"label":"Member Dues","description":"","name":"Member Dues"}],"label":"Financial Type","input_type":"Select"},{"name":"contribution_page_id","description":"The Contribution Page which triggered this contribution","data_type":"Integer","serialize":null,"fk_entity":"ContributionPage","options":[{"id":1,"label":"Help Support CiviCRM!","name":"Help Support CiviCRM!"},{"id":2,"label":"Member Signup and Renewal","name":"Member Signup and Renewal"},{"id":3,"label":"Pledge for CiviCRM!","name":"Pledge for CiviCRM!"}],"label":"Contribution Page","input_type":"Select"},{"name":"payment_instrument_id","description":"FK to Payment Instrument","data_type":"Integer","serialize":null,"fk_entity":null,"options":[{"id":1,"label":"Credit Card","description":null,"color":null,"icon":null,"name":"Credit Card"},{"id":2,"label":"Debit Card","description":null,"color":null,"icon":null,"name":"Debit Card"},{"id":3,"label":"Cash","description":null,"color":null,"icon":null,"name":"Cash"},{"id":4,"label":"Check","description":null,"color":null,"icon":null,"name":"Check"},{"id":5,"label":"EFT","description":null,"color":null,"icon":null,"name":"EFT"}],"label":"Payment Method","input_type":"Select"},{"name":"receive_date","description":"Date contribution was received - not necessarily the creation date of the record","data_type":"Timestamp","serialize":null,"fk_entity":null,"options":false,"label":"Date Received","input_type":"Date"},{"name":"non_deductible_amount","description":"Portion of total amount which is NOT tax deductible. Equal to total_amount for non-deductible financial types.","data_type":"Money","serialize":null,"fk_entity":null,"options":false,"label":"Non-deductible Amount","input_type":"Text"},{"name":"total_amount","description":"Total amount of this contribution. Use market value for non-monetary gifts.","data_type":"Money","serialize":null,"fk_entity":null,"options":false,"label":"Total Amount","input_type":"Text"},{"name":"fee_amount","description":"actual processor fee if known - may be 0.","data_type":"Money","serialize":null,"fk_entity":null,"options":false,"label":"Fee Amount","input_type":"Text"},{"name":"net_amount","description":"actual funds transfer amount. total less fees. if processor does not report actual fee during transaction, this is set to total_amount.","data_type":"Money","serialize":null,"fk_entity":null,"options":false,"label":"Net Amount","input_type":"Text"},{"name":"invoice_number","description":"Human readable invoice number","data_type":"String","serialize":null,"fk_entity":null,"options":false,"label":"Invoice Number","input_type":"Text"},{"name":"currency","description":"3 character string, value from config setting or input via user.","data_type":"String","serialize":null,"fk_entity":null,"options":[{"id":"AFN","label":"Afghani","name":"AFN"},{"id":"ALL","label":"Albanian Lek","name":"ALL"},{"id":"DZD","label":"Algerian Dinar","name":"DZD"},{"id":"AOA","label":"Angola Kwanza","name":"AOA"},{"id":"ARS","label":"Argentine Peso","name":"ARS"},{"id":"AMD","label":"Armenian Dram","name":"AMD"},{"id":"AWG","label":"Aruban Guilder","name":"AWG"},{"id":"AUD","label":"Australian Dollar","name":"AUD"},{"id":"AZN","label":"Azerbaijanian Manat","name":"AZN"},{"id":"BSD","label":"Bahamian Dollar","name":"BSD"},{"id":"BHD","label":"Bahraini Dinar","name":"BHD"},{"id":"BDT","label":"Bangladeshi Taka","name":"BDT"},{"id":"BBD","label":"Barbados Dollar","name":"BBD"},{"id":"BYR","label":"Belarussian Rouble","name":"BYR"},{"id":"BZD","label":"Belize Dollar","name":"BZD"},{"id":"BMD","label":"Bermudian Dollar","name":"BMD"},{"id":"BTN","label":"Bhutan Ngultrum","name":"BTN"},{"id":"BOV","label":"Bolivian Mvdol","name":"BOV"},{"id":"BOB","label":"Boliviano","name":"BOB"},{"id":"XBA","label":"Bond Markets Units European Composite Unit (EURCO)","name":"XBA"},{"id":"BWP","label":"Botswana Pula","name":"BWP"},{"id":"BRL","label":"Brazilian Real","name":"BRL"},{"id":"BND","label":"Brunei Dollar","name":"BND"},{"id":"BGN","label":"Bulgarian Lev","name":"BGN"},{"id":"BIF","label":"Burundi Franc","name":"BIF"},{"id":"KHR","label":"Cambodian Riel","name":"KHR"},{"id":"CAD","label":"Canadian Dollar","name":"CAD"},{"id":"CVE","label":"Cape Verde Escudo","name":"CVE"},{"id":"KYD","label":"Cayman Islands Dollar","name":"KYD"},{"id":"XOF","label":"CFA Franc BCEAO","name":"XOF"},{"id":"XAF","label":"CFA Franc BEAC","name":"XAF"},{"id":"XPF","label":"CFP Franc","name":"XPF"},{"id":"CLP","label":"Chilean Peso","name":"CLP"},{"id":"CNY","label":"Chinese Yuan Renminbi","name":"CNY"},{"id":"XTS","label":"Code for testing purposes","name":"XTS"},{"id":"COP","label":"Colombian Peso","name":"COP"},{"id":"KMF","label":"Comoro Franc","name":"KMF"},{"id":"BAM","label":"Convertible Marks","name":"BAM"},{"id":"CRC","label":"Costa Rican Colon","name":"CRC"},{"id":"HRK","label":"Croatian Kuna","name":"HRK"},{"id":"CUP","label":"Cuban Peso","name":"CUP"},{"id":"CYP","label":"Cyprus Pound","name":"CYP"},{"id":"CZK","label":"Czech Koruna","name":"CZK"},{"id":"DKK","label":"Danish Krone","name":"DKK"},{"id":"DJF","label":"Djibouti Franc","name":"DJF"},{"id":"DOP","label":"Dominican Peso","name":"DOP"},{"id":"XCD","label":"East Caribbean Dollar","name":"XCD"},{"id":"EGP","label":"Egyptian Pound","name":"EGP"},{"id":"SVC","label":"El Salvador Colon","name":"SVC"},{"id":"ERN","label":"Eritrean Nakfa","name":"ERN"},{"id":"SZL","label":"Eswatini Lilangeni","name":"SZL"},{"id":"ETB","label":"Ethiopian Birr","name":"ETB"},{"id":"EUR","label":"Euro","name":"EUR"},{"id":"XBB","label":"European Monetary Unit (E.M.U.-6)","name":"XBB"},{"id":"XBD","label":"European Unit of Account 17 (E.U.A.-17)","name":"XBD"},{"id":"XBC","label":"European Unit of Account 9 (E.U.A.-9)","name":"XBC"},{"id":"FKP","label":"Falkland Islands Pound","name":"FKP"},{"id":"FJD","label":"Fiji Dollar","name":"FJD"},{"id":"CDF","label":"Franc Congolais","name":"CDF"},{"id":"GMD","label":"Gambian Dalasi","name":"GMD"},{"id":"GEL","label":"Georgian Lari","name":"GEL"},{"id":"GHC","label":"Ghanaian Cedi","name":"GHC"},{"id":"GIP","label":"Gibraltar Pound","name":"GIP"},{"id":"XAU","label":"Gold","name":"XAU"},{"id":"XFO","label":"Gold-Franc","name":"XFO"},{"id":"GTQ","label":"Guatemalan Quetzal","name":"GTQ"},{"id":"GNF","label":"Guinea Franc","name":"GNF"},{"id":"GWP","label":"Guinea-Bissau Peso","name":"GWP"},{"id":"GYD","label":"Guyana Dollar","name":"GYD"},{"id":"HTG","label":"Haitian Gourde","name":"HTG"},{"id":"HNL","label":"Honduran Lempira","name":"HNL"},{"id":"HKD","label":"Hong Kong Dollar","name":"HKD"},{"id":"HUF","label":"Hungarian Forint","name":"HUF"},{"id":"ISK","label":"Iceland Krona","name":"ISK"},{"id":"INR","label":"Indian Rupee","name":"INR"},{"id":"IDR","label":"Indonesian Rupiah","name":"IDR"},{"id":"IRR","label":"Iranian Rial","name":"IRR"},{"id":"IQD","label":"Iraqi Dinar","name":"IQD"},{"id":"JMD","label":"Jamaican Dollar","name":"JMD"},{"id":"JPY","label":"Japanese Yen","name":"JPY"},{"id":"JOD","label":"Jordanian Dinar","name":"JOD"},{"id":"KZT","label":"Kazakhstan Tenge","name":"KZT"},{"id":"KES","label":"Kenyan Shilling","name":"KES"},{"id":"KWD","label":"Kuwaiti Dinar","name":"KWD"},{"id":"KGS","label":"Kyrgyzstan Som","name":"KGS"},{"id":"LAK","label":"Lao Kip","name":"LAK"},{"id":"LVL","label":"Latvian Lats","name":"LVL"},{"id":"LBP","label":"Lebanese Pound","name":"LBP"},{"id":"SLL","label":"Leone","name":"SLL"},{"id":"LSL","label":"Lesotho Loti","name":"LSL"},{"id":"LRD","label":"Liberian Dollar","name":"LRD"},{"id":"LYD","label":"Libyan Dinar","name":"LYD"},{"id":"LTL","label":"Lithuanian Litas","name":"LTL"},{"id":"MOP","label":"Macao Pataca","name":"MOP"},{"id":"MKD","label":"Macedonian Denar","name":"MKD"},{"id":"MGA","label":"Malagascy Ariary","name":"MGA"},{"id":"MWK","label":"Malawi Kwacha","name":"MWK"},{"id":"MYR","label":"Malaysian Ringgit","name":"MYR"},{"id":"MVR","label":"Maldive Rufiyaa","name":"MVR"},{"id":"MTL","label":"Maltese Lira","name":"MTL"},{"id":"MRO","label":"Mauritanian Ouguiya","name":"MRO"},{"id":"MUR","label":"Mauritius Rupee","name":"MUR"},{"id":"MXN","label":"Mexican Peso","name":"MXN"},{"id":"MXV","label":"Mexican Unidad de Inversion (UID)","name":"MXV"},{"id":"MDL","label":"Moldovan Leu","name":"MDL"},{"id":"MNT","label":"Mongolian Tugrik","name":"MNT"},{"id":"MAD","label":"Moroccan Dirham","name":"MAD"},{"id":"MZN","label":"Mozambique Metical","name":"MZN"},{"id":"MMK","label":"Myanmar Kyat","name":"MMK"},{"id":"NAD","label":"Namibian Dollar","name":"NAD"},{"id":"NPR","label":"Nepalese Rupee","name":"NPR"},{"id":"ANG","label":"Netherlands Antillian Guilder","name":"ANG"},{"id":"ILS","label":"New Israeli Shekel","name":"ILS"},{"id":"TWD","label":"New Taiwan Dollar","name":"TWD"},{"id":"TRY","label":"New Turkish Lira","name":"TRY"},{"id":"NZD","label":"New Zealand Dollar","name":"NZD"},{"id":"NIO","label":"Nicaraguan Cordoba Oro","name":"NIO"},{"id":"NGN","label":"Nigerian Naira","name":"NGN"},{"id":"XXX","label":"No currency involved","name":"XXX"},{"id":"KPW","label":"North Korean Won","name":"KPW"},{"id":"NOK","label":"Norwegian Krone","name":"NOK"},{"id":"PKR","label":"Pakistan Rupee","name":"PKR"},{"id":"XPD","label":"Palladium","name":"XPD"},{"id":"PAB","label":"Panamanian Balboa","name":"PAB"},{"id":"PGK","label":"Papua New Guinea Kina","name":"PGK"},{"id":"PYG","label":"Paraguay Guarani","name":"PYG"},{"id":"PEN","label":"Peruvian Nuevo Sol","name":"PEN"},{"id":"UYU","label":"Peso Uruguayo","name":"UYU"},{"id":"PHP","label":"Philippine Peso","name":"PHP"},{"id":"XPT","label":"Platinum","name":"XPT"},{"id":"PLN","label":"Polish Z\u0142oty","name":"PLN"},{"id":"GBP","label":"Pound Sterling","name":"GBP"},{"id":"QAR","label":"Qatari Rial","name":"QAR"},{"id":"OMR","label":"Rial Omani","name":"OMR"},{"id":"RON","label":"Romanian New Leu","name":"RON"},{"id":"ROL","label":"Romanian Old Leu","name":"ROL"},{"id":"RUB","label":"Russian Rouble","name":"RUB"},{"id":"RWF","label":"Rwanda Franc","name":"RWF"},{"id":"SHP","label":"Saint Helena Pound","name":"SHP"},{"id":"WST","label":"Samoan Tala","name":"WST"},{"id":"STD","label":"S\u00e3o Tome and Principe Dobra","name":"STD"},{"id":"SAR","label":"Saudi Riyal","name":"SAR"},{"id":"RSD","label":"Serbian Dinar","name":"RSD"},{"id":"SCR","label":"Seychelles Rupee","name":"SCR"},{"id":"XAG","label":"Silver","name":"XAG"},{"id":"SGD","label":"Singapore Dollar","name":"SGD"},{"id":"SKK","label":"Slovak Koruna","name":"SKK"},{"id":"SIT","label":"Slovenian Tolar","name":"SIT"},{"id":"SBD","label":"Solomon Islands Dollar","name":"SBD"},{"id":"SOS","label":"Somali Shilling","name":"SOS"},{"id":"ZAR","label":"South African Rand","name":"ZAR"},{"id":"KRW","label":"South Korean Won","name":"KRW"},{"id":"XDR","label":"Special Drawing Right","name":"XDR"},{"id":"LKR","label":"Sri Lanka Rupee","name":"LKR"},{"id":"SDD","label":"Sudanese Dinar","name":"SDD"},{"id":"SRD","label":"Surinam Dollar","name":"SRD"},{"id":"SEK","label":"Swedish Krona","name":"SEK"},{"id":"CHF","label":"Swiss Franc","name":"CHF"},{"id":"SYP","label":"Syrian Pound","name":"SYP"},{"id":"TJS","label":"Tajik Somoni","name":"TJS"},{"id":"TZS","label":"Tanzanian Shilling","name":"TZS"},{"id":"THB","label":"Thai Baht","name":"THB"},{"id":"TOP","label":"Tongan Pa'anga","name":"TOP"},{"id":"TTD","label":"Trinidad and Tobago Dollar","name":"TTD"},{"id":"TND","label":"Tunisian Dinar","name":"TND"},{"id":"TMM","label":"Turkmenistan Manat","name":"TMM"},{"id":"AED","label":"UAE Dirham","name":"AED"},{"id":"UGX","label":"Ugandan Shilling","name":"UGX"},{"id":"XFU","label":"UIC-Franc","name":"XFU"},{"id":"UAH","label":"Ukrainian Hryvnia","name":"UAH"},{"id":"COU","label":"Unidad de Valor Real","name":"COU"},{"id":"CLF","label":"Unidades de fomento","name":"CLF"},{"id":"USD","label":"US Dollar","name":"USD"},{"id":"USN","label":"US Dollar (Next day)","name":"USN"},{"id":"USS","label":"US Dollar (Same day)","name":"USS"},{"id":"UZS","label":"Uzbekistan Sum","name":"UZS"},{"id":"VUV","label":"Vanuatu Vatu","name":"VUV"},{"id":"VEF","label":"Venezuela Bolivar","name":"VEF"},{"id":"VND","label":"Viet Nam Dong","name":"VND"},{"id":"CHE","label":"WIR Euro","name":"CHE"},{"id":"CHW","label":"WIR Franc","name":"CHW"},{"id":"YER","label":"Yemeni Rial","name":"YER"},{"id":"ZMK","label":"Zambian Kwacha","name":"ZMK"},{"id":"ZWD","label":"Zimbabwe Dollar","name":"ZWD"}],"label":"Currency","input_type":"Select"},{"name":"cancel_date","description":"when was gift cancelled","data_type":"Timestamp","serialize":null,"fk_entity":null,"options":false,"label":"Cancelled \/ Refunded Date","input_type":"Date"},{"name":"cancel_reason","description":null,"data_type":"Text","serialize":null,"fk_entity":null,"options":false,"label":"Cancellation \/ Refund Reason","input_type":"Text"},{"name":"receipt_date","description":"when (if) receipt was sent. populated automatically for online donations w\/ automatic receipting","data_type":"Timestamp","serialize":null,"fk_entity":null,"options":false,"label":"Receipt Date","input_type":"Date"},{"name":"thankyou_date","description":"when (if) was donor thanked","data_type":"Timestamp","serialize":null,"fk_entity":null,"options":false,"label":"Thank-you Date","input_type":"Date"},{"name":"source","description":"Origin of this Contribution.","data_type":"String","serialize":null,"fk_entity":null,"options":false,"label":"Contribution Source","input_type":"Text"},{"name":"amount_level","description":null,"data_type":"Text","serialize":null,"fk_entity":null,"options":false,"label":"Amount Label","input_type":"Text"},{"name":"is_test","description":null,"data_type":"Boolean","serialize":null,"fk_entity":null,"options":false,"label":"Test","input_type":"CheckBox"},{"name":"is_pay_later","description":null,"data_type":"Boolean","serialize":null,"fk_entity":null,"options":false,"label":"Is Pay Later","input_type":"CheckBox"},{"name":"contribution_status_id","description":null,"data_type":"Integer","serialize":null,"fk_entity":null,"options":[{"id":1,"label":"Completed","description":null,"color":null,"icon":null,"name":"Completed"},{"id":2,"label":"Pending","description":null,"color":null,"icon":null,"name":"Pending"},{"id":3,"label":"Cancelled","description":null,"color":null,"icon":null,"name":"Cancelled"},{"id":4,"label":"Failed","description":null,"color":null,"icon":null,"name":"Failed"},{"id":5,"label":"In Progress","description":null,"color":null,"icon":null,"name":"In Progress"},{"id":6,"label":"Overdue","description":null,"color":null,"icon":null,"name":"Overdue"},{"id":7,"label":"Refunded","description":null,"color":null,"icon":null,"name":"Refunded"},{"id":8,"label":"Partially paid","description":null,"color":null,"icon":null,"name":"Partially paid"},{"id":9,"label":"Pending refund","description":null,"color":null,"icon":null,"name":"Pending refund"},{"id":10,"label":"Chargeback","description":null,"color":null,"icon":null,"name":"Chargeback"}],"label":"Contribution Status","input_type":"Select"},{"name":"address_id","description":"Conditional foreign key to civicrm_address.id. We insert an address record for each contribution when we have associated billing name and address data.","data_type":"Integer","serialize":null,"fk_entity":"Address","options":false,"label":"Address","input_type":null},{"name":"check_number","description":null,"data_type":"String","serialize":null,"fk_entity":null,"options":false,"label":"Check Number","input_type":"Text"},{"name":"campaign_id","description":"The campaign for which this contribution has been triggered.","data_type":"Integer","serialize":null,"fk_entity":"Campaign","options":[{"id":2,"label":"big one","description":"","name":"big_one"},{"id":1,"label":"campaign","description":"","name":"campaign"}],"label":"Campaign","input_type":"EntityRef"},{"name":"creditnote_id","description":"unique credit note id, system generated or passed in","data_type":"String","serialize":null,"fk_entity":null,"options":false,"label":"Credit Note ID","input_type":"Text"},{"name":"tax_amount","description":"Total tax amount of this contribution.","data_type":"Money","serialize":null,"fk_entity":null,"options":false,"label":"Tax Amount","input_type":"Text"},{"name":"revenue_recognition_date","description":"Stores the date when revenue should be recognized.","data_type":"Timestamp","serialize":null,"fk_entity":null,"options":false,"label":"Revenue Recognition Date","input_type":"Date"},{"name":"Donor_Information.Known_areas_of_interest","description":null,"data_type":"Text","serialize":0,"fk_entity":null,"options":false,"label":"Donor Information: Known areas of interest","input_type":"TextArea"},{"name":"Donor_Information.How_long_have_you_been_a_donor_","description":null,"data_type":"String","serialize":0,"fk_entity":null,"options":[{"id":1,"label":"Less than 1 year","description":null,"color":null,"icon":null,"name":"Less_than_1_year"},{"id":2,"label":"1-3 years","description":null,"color":null,"icon":null,"name":"1_3_years"},{"id":3,"label":"4-6 years","description":null,"color":null,"icon":null,"name":"4_6_years"},{"id":4,"label":"7-9 years","description":null,"color":null,"icon":null,"name":"7_9_years"},{"id":5,"label":"More than 9 years","description":null,"color":null,"icon":null,"name":"More_than_9_years"}],"label":"Donor Information: How long have you been a donor?","input_type":"Radio"}],"entity":"Contribution","action":"getFields","debug":null,"version":4,"count":28}

@colemanw
Copy link
Member Author

@eileenmcnaughton in the unit test with this PR, campaign_id does not return options. And when I try it in search kit it does not either:
image

Stop the overly-clever guesswork of abbrColumn so that
it can always be know if a pseudoconstant has an abbreviation.
This breaks apart the concept of a field having 'options' vs
a field supporting suffixes like campaign_id:label.

It is now possible for a field to not have options but still support suffixes.

This also makes the available suffixes for each field discoverable,
e.g. fields like state_province_id support an :abbr suffix.
@colemanw
Copy link
Member Author

@eileenmcnaughton that is quite puzzling. I get the same result on the demo site, and also http://core-21184-754mg.test-3.civicrm.org:8001/civicrm/api4#/explorer/Contribution/getFields?where=%5B%5B%22name%22,%22%3D%22,%22campaign_id%22%5D%5D&loadOptions=true returns options for the field when it should say options: false.

And yet,

  1. There is a unit test in this PR ensuring that same field does NOT return options, and it passes on Jenkins and locally.
  2. Locally, it works as expected both in search kit and the explorer.
  3. I tried as both the admin user and the regular user on the demo site and got the same incorrect result.

I've done a rebase and force-push of this PR to update it to the tip of master. Let's see if the new demo site behaves better.

@colemanw
Copy link
Member Author

@eileenmcnaughton it looks like it was a caching thing. Clearing caches on the demo site fixed it and options are now correctly false.
APIv4 metadata caching strikes again! I'm starting to rethink the benefits...

@eileenmcnaughton
Copy link
Contributor

@colemanw I'm really confused about how caching would be an issue on the demo site since each version should be a new build off the code.

I replicated the issue AGAIN on the demo sidte just now.

I'm open to merging this & keeping testing since it doesn't regress anything & some of the changes are still needed - as long as you'll keep working on it if I keep replicating the options loading

@colemanw
Copy link
Member Author

@eileenmcnaughton I really don't understand it either. But I made the issue go away by logging out of demo, logging in as admin then logging out and back in again. Somewhere in there some cache got cleared I guess and then it started behaving 🤷‍♂️

@eileenmcnaughton
Copy link
Contributor

@colemanw shall we merge and then re-test on dmaster.demo on Monday - my experience is that it's consistent with different behaviour for different users but getting it merged & waiting a day will rule out caching

@colemanw colemanw merged commit c1d2ae8 into civicrm:master Aug 21, 2021
@colemanw colemanw deleted the pseudoconstantFixes branch August 21, 2021 01:14
@eileenmcnaughton
Copy link
Contributor

eileenmcnaughton commented Aug 27, 2021

@colemanw I just re-tested on demo.master and the load all IS still happening.

I specifically logged on as demo because my suspicion is that it loads differently permission dependent (& once it caches it sticks with it)

https://dmaster.demo.civicrm.org/civicrm/admin/search#/create/Contribution?params=%7B%22version%22:4,%22select%22:%5B%22id%22%5D,%22orderBy%22:%7B%7D,%22where%22:%5B%5D,%22groupBy%22:%5B%5D,%22join%22:%5B%5D,%22having%22:%5B%5D%7D

@colemanw
Copy link
Member Author

colemanw commented Aug 27, 2021

I can't figure out how to pretty print link you did

FYI @eileenmcnaughton it's the "Preview" tab. The "Response" tab you're on gives the raw output.

@eileenmcnaughton
Copy link
Contributor

OK - here is the preview tab - I think I see the bug too....

image

eileenmcnaughton added a commit to eileenmcnaughton/civicrm-core that referenced this pull request Aug 28, 2021
Fixes a bug in
civicrm#21184
which was masked in the test by the lack of campaigns to load.

The ?? operator handles FALSE differently to the ?: operator
so this was casting FALSE to TRUE
@colemanw
Copy link
Member Author

Well spotted @eileenmcnaughton !!

eileenmcnaughton added a commit to eileenmcnaughton/civicrm-core that referenced this pull request Aug 28, 2021
Fixes a bug in
civicrm#21184
which was masked in the test by the lack of campaigns to load.

The ?? operator handles FALSE differently to the ?: operator
so this was casting FALSE to TRUE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants