}
/**
- * Retrieve the information about the batch.
+ * Retrieve DB object and copy to defaults array.
*
* @param array $params
- * (reference ) an assoc array of name/value pairs.
- * @param array $defaults
- * (reference ) an assoc array to hold the flattened values.
+ * Array of criteria values.
+ * @param array|null $defaults
+ * Array to be populated with found values.
*
- * @return array
- * CRM_Batch_BAO_Batch object on success, null otherwise
+ * @return self|null
+ * The DAO object, if found.
+ *
+ * @deprecated
*/
- public static function retrieve(&$params, &$defaults) {
- $batch = new CRM_Batch_DAO_Batch();
- $batch->copyValues($params);
- if ($batch->find(TRUE)) {
- CRM_Core_DAO::storeValues($batch, $defaults);
- return $batch;
- }
- return NULL;
+ public static function retrieve(array $params, ?array &$defaults = NULL) {
+ $defaults = $defaults ?? [];
+ return self::commonRetrieve(self::class, $params, $defaults);
}
/**
$values['id']
);
// CRM-21205
- $values['currency'] = CRM_Core_DAO::singleValueQuery("
- SELECT GROUP_CONCAT(DISTINCT ft.currency)
- FROM civicrm_batch batch
- JOIN civicrm_entity_batch eb
- ON batch.id = eb.batch_id
- JOIN civicrm_financial_trxn ft
- ON eb.entity_id = ft.id
- WHERE batch.id = %1
- GROUP BY batch.id
- ", [1 => [$values['id'], 'Positive']]);
+ $values['currency'] = CRM_Batch_BAO_EntityBatch::getBatchCurrency($values['id']);
$results[$values['id']] = $values;
}
* @param array $params
* Associated array for params.
*
- * @return string
+ * @return string[]
*/
public static function whereClause($params) {
$clauses = [];
* calculated total
* @param $expected
* user-entered total
- * @return array
+ * @return string
*/
public static function displayTotals($actual, $expected) {
$class = 'actual-value';