Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-11802

LineItem.label was erroneously set to required - breaks tests

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Trivial
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.3.0
    • Fix Version/s: 4.3.0
    • Component/s: None
    • Labels:
      None

      Description

      civicrm_line_item.label was erroneously changed (back) to required due to a bad merge from accounts branch to trunk.

      Also discovered the civicrm_line_item.price_field_id still had an FK constraint with ON DELETE CASCADE. This is wrong because we NEVER want to have line_item rows deleted due to deletion of a price_field row. I've changed price_field_id to NOT REQUIRED and ON DELETE SET NULL. Also added code in 4.3.alpha1.mysql.tpl to drop and re-add that FK for existing sites.

      Removed the api.required for price_field_id from api/v3/LineItem.php.

      Ran api_v3_LineItemTest and it completes successful.

      — original post —
      'label' used to be an optional field for lineitem api - now it is compulsory due to it being 'Not Null' in the DB & having no default. Ditto qty

      I have made qty required & set a pretty dumb default on label - ideally the BAO layer would be clever enough to put in the correct label since it has the price_field_id & price_field_value. I also made line_total required. Obviously it should be able to calculated itself. Hopefully someone will provide a patch @ the BAO layer.

      I think the lineitem api is new enough that adding new required fields is OK.

        Attachments

          Activity

            People

            • Assignee:
              eileen Eileen McNaughton
              Reporter:
              eileen Eileen McNaughton
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: