Specify the 'name' when creating a new PriceFieldValue
Created by: mlutfy
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.