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

CRM-12252 Add in help_pre and help_post fields for price field options #8521

Merged
merged 11 commits into from
Jun 29, 2016

Conversation

seamuslee001
Copy link
Contributor

@seamuslee001 seamuslee001 commented Jun 6, 2016

$pre_help = isset($opt['help_pre']) ?
'<span class="crm-price-amount-help-pre">' . $opt['help_pre'] . '</span>: ' : '';
$post_help = isset($opt['help_post']) ?
': <span class="crm-price-amount-help-post">' . $opt['help_post'] . '</span>' : '';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to also add description class to make the span look similar to other help texts(custom fields, etc).

@jitendrapurohit
Copy link
Contributor

jitendrapurohit commented Jun 10, 2016

Can you please update this PR as it has gone stale due to generated data changes.

@JoeMurray
Copy link
Contributor

Heh Seamus, as Release Manager this month, I'm trying to recruit people to help pare down the backlog of almost 100 PRs, some going back to last summer. I'm wondering if you would be able to help QA another PR if I got someone to QA this PR and your other ones like #7499 #8503 #8273 #8424 ?

@seamuslee001 seamuslee001 force-pushed the CRM-12252 branch 2 times, most recently from 3b3e1bc to 46bcd21 Compare June 20, 2016 06:26
$pre_help = isset($opt['help_pre']) ?
'<span class="crm-price-amount-help-pre">' . $opt['help_pre'] . '</span>: ' : '';
$post_help = isset($opt['help_post']) ?
': <span class="crm-price-amount-help-post">' . $opt['help_post'] . '</span>' : '';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seamuslee001 shouldn't description class be added here too ?

@jitendrapurohit
Copy link
Contributor

@seamuslee001 I get an error on upgrade after the updated code.

ALTER TABLE civicrm_price_field_value_en_US ADD COLUMN help_pre_en_US text COLLATE utf8_unicode_ci COMMENT "Price field option pre help text." [nativecode=1347 ** 'test_drupal_civi.civicrm_price_field_value_en_US' is not BASE TABLE]

Screenshot - http://goo.gl/Zds5N5

@JoeMurray
Copy link
Contributor

@mlutfy could you review where the i18n / l10n is going wrong in patch?

@eileenmcnaughton
Copy link
Contributor

I think you need to look at how you are calling executeQuery - here is the call sig

  public static function &executeQuery(
    $query,
    $params = array(),
    $abort = TRUE,
    $daoName = NULL,
    $freeDAO = FALSE,
    $i18nRewrite = TRUE,
    $trapException = FALSE

@seamuslee001
Copy link
Contributor Author

thanks Eileen :) @eileenmcnaughton

@jitendrapurohit
Copy link
Contributor

@seamuslee001 After multilingual upgrade to 4.7.9 with this patch included, fields added here(pre help and post help) do appear on the form, but they are not saved when the form is submitted.

Can you please check if this is replicated by you as well ?

Thanks!

@seamuslee001
Copy link
Contributor Author

@jitendrapurohit I don't have access to a multilingual DB so bit difficult for me but I have just pushed something to try and make it like we're adding label. I don't know what is causing the problem

@@ -216,6 +216,8 @@ public function buildQuickForm() {
$this->addRule('amount', ts('Please enter a monetary value for this field.'), 'money');

$this->add('textarea', 'description', ts('Description'));
$this->add('textarea', 'help_pre', ts('Pre Option Help'), NULL, TRUE);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing the problem is in the postProcess on this file? You shouldn't need to do anything re multilingual - esp if you use the api

@jitendrapurohit
Copy link
Contributor

jitendrapurohit commented Jun 23, 2016

Nope, it still occurs for me :-(. I see that altering civicrm_price_field_value in upgrade doesn't add these columns to civicrm_price_field_value_{locale} view (is this because of executeQuery() call?).

The PriceFieldValue takes the BAO object which doesn't have pre_help and post_help and copy the values from $params which fails to save these two fields.

@seamuslee001
Copy link
Contributor Author

@jitendrapurohit Can you test it again please, I have tried again with the upgrade but not sure what else I can do

@jitendrapurohit
Copy link
Contributor

Confirmed that this works fine now. I'll create a new PR for some minor fixes on display and optimization.

Thanks @seamuslee001 :-)

@monishdeb monishdeb merged commit a5ac49f into civicrm:master Jun 29, 2016
@jitendrapurohit
Copy link
Contributor

Additional PR at #8642

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

Successfully merging this pull request may close these issues.

6 participants