Skip to content
This repository has been archived by the owner on Jul 7, 2021. It is now read-only.

Specify the 'name' when creating a new PriceFieldValue #44

Closed
mlutfy opened this issue Aug 1, 2019 · 3 comments
Closed

Specify the 'name' when creating a new PriceFieldValue #44

mlutfy opened this issue Aug 1, 2019 · 3 comments

Comments

@mlutfy
Copy link
Contributor

mlutfy commented Aug 1, 2019

I will send a PR eventually, I just wanted to recommend that in the function CRM_Lineitemedit_Util::generatePriceField(), to specify the 'name' property, since the title uses ts, so it can give unexpected results.

i.e.

    $newPriceFieldValue = civicrm_api3('PriceFieldValue', 'create', [
      'label' => ts('Additional Lineitem ' . $totalPF),
      'name' => 'additional_lineitem_' . $totalPF, // <------------ add
      'price_field_id' => $newPriceField['id'],
      'amount' => 1.00,
      // 'financial_type_id' => civicrm_api3('PriceFieldValue', 'getvalue', ['id' => $previousLineItem['price_field_value_id'], 'return' => 'financial_type_id']),
      'financial_type_id' => $previousLineItem['financial_type_id'],
    ]);

side-note: the financial type handling can also cause the PFV creation to fail if the Financial Type for the PriceSetID=1 has been disabled.

@monishdeb
Copy link
Member

@mlutfy thanks for reporting this issue. I have submitted a PR #45. Can you please check now?

Thanks!

seamuslee001 added a commit that referenced this issue Jan 13, 2020
seamuslee001 added a commit that referenced this issue Jan 13, 2020
@monishdeb
Copy link
Member

@mlutfy did you get a chance to review #45 ?

@monishdeb
Copy link
Member

The Line Item Editor is moved to https://lab.civicrm.org/extensions/lineitemedit. The new issue link for this ticket is https://lab.civicrm.org/extensions/lineitemedit/-/issues/44

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

No branches or pull requests

2 participants