Function __global->points_refund

Definitions

sources/points2.php

  • Refund points from one member to another. This uses gift points where possible and if enabled.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: int

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$sending_member MEMBER No No required parameter N/A N/A The ID of the member refunding the points (e.g. the receiving_member in the original transaction)
$receiving_member MEMBER No No required parameter N/A N/A The ID of the member receiving the refunded points (e.g. the sending_member in the original transaction)
$reason SHORT_TEXT No No required parameter N/A N/A The reason for this refund in the logs
$total_points integer No No required parameter N/A N/A The total number of points to refund (includes gift points when applicable)
$amount_gift_points integer No No 0 N/A N/A The number of $total_points which should be refunded as gift points (subtracted from gift_points_sent)
$anonymous BINARY No No 0 N/A N/A Whether the sender should be hidden from those without the privilege to trace anonymous transactions
$linked_ledger ?array No No Null N/A N/A The database row of the points_ledger transaction being refunded by this (null: this refund is not related to any past ledger)
$send_notifications ?boolean No No True N/A N/A Whether to send notifications for this transaction (false: only the staff get it) (true: both the member and staff get it) (null: neither the member nor staff get it)
$t_type ID_TEXT No No Blank (empty string) N/A N/A An identifier to relate this transaction with other transactions of the same $type (e.g. content type)
$t_subtype ID_TEXT No No Blank (empty string) N/A N/A An identifier to relate this transaction with other transactions of the same $type and $subtype (e.g. an action performed on the $type)
$t_type_id ID_TEXT No No Blank (empty string) N/A N/A Some content or row ID of the specified $type
$time ?TIME No No Null N/A N/A The time this transaction occurred (null: now)
$status integer No No 3 N/A N/A The status to use for the record (see LEDGER_STATUS_*)

Returns

  • The ID of the transaction (null: a transaction was not created)
  • Type: ?AUTO_LINK
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Refund points from one member to another. This uses gift points where possible and if enabled.
 *
 * @param  MEMBER $sending_member The ID of the member refunding the points (e.g. the receiving_member in the original transaction)
 * @param  MEMBER $receiving_member The ID of the member receiving the refunded points (e.g. the sending_member in the original transaction)
 * @param  SHORT_TEXT $reason The reason for this refund in the logs
 * @param  integer $total_points The total number of points to refund (includes gift points when applicable)
 * @param  integer $amount_gift_points The number of $total_points which should be refunded as gift points (subtracted from gift_points_sent)
 * @param  BINARY $anonymous Whether the sender should be hidden from those without the privilege to trace anonymous transactions
 * @param  ?array $linked_ledger The database row of the points_ledger transaction being refunded by this (null: this refund is not related to any past ledger)
 * @param  ?boolean $send_notifications Whether to send notifications for this transaction (false: only the staff get it) (true: both the member and staff get it) (null: neither the member nor staff get it)
 * @param  ID_TEXT $t_type An identifier to relate this transaction with other transactions of the same $type (e.g. content type)
 * @param  ID_TEXT $t_subtype An identifier to relate this transaction with other transactions of the same $type and $subtype (e.g. an action performed on the $type)
 * @param  ID_TEXT $t_type_id Some content or row ID of the specified $type
 * @param  ?TIME $time The time this transaction occurred (null: now)
 * @param  integer $status The status to use for the record (see LEDGER_STATUS_*)
 * @return ?AUTO_LINK The ID of the transaction (null: a transaction was not created)
 */

function points_refund(int $sending_member, int $receiving_member, string $reason, int $total_points, int $amount_gift_points = 0, int $anonymous = 0, ?array $linked_ledger = null, ?bool $send_notifications = true, string $t_type = '', string $t_subtype = '', string $t_type_id = '', ?int $time = null, int $status = 3) : ?int