Documentation

GetList

Description and parameters

CDBResult
CSaleUserTransact::GetList(
 array arOrder = array(),
 array arFilter = array(),
 array arGroupBy = false,
 array arNavStartParams = false,
 array arSelectFields = array()
);

Method returns transaction entries according to its parameters. Non-static method.

Call parameters

ParameterDescription
arOrder Array, according to which resulting parameters are sorted. Array looks as follows:
array(
"field_name1" => "sort_direction1",
"field_name2" => "sort_direction2",
. . .
)
Any field can be inserted as the "field_nameN" for payment system handlers. And "sort_directionX" can have values "ASC" (by ascension) and "DESC" (by descension).

In case the sort array have several elements, the resulting set is sorted by each element (i. e. first sorts by the first element and then result is sorted by the second element, etc.). 

Default value - empty array(), in indicating that result won't be sorted.
arFilter Array, according to which the payment system entries are filtered. Array looks as follows:
array(
"[modifier1][operator1]field_name1" => "value1",
"[modifier2][operator2]field_name2" => "value2",
. . .
)
Entries that satisfy the filter are returned in the result and entries that do not satisfy the filter conditions are ignored.

The following modifiers are permissible:
  • ! - negation;
  • + - null, 0 and empty string values also satisfy the filter conditions.
The following operators are permitted:
  • >= - field value is higher or equal to value passed to filter;
  • > - field value is strict higher that value passed to filter;
  • <= - field value is lesser or equal to value passed to filter;
  • < - field value is strictly less than value passed to filter;
  • @ - field value is located in the comma-separated list with values passed to filter;
  • ~ - field value is checked for match to the value passed to template filter;
  • % - field value is checked for match to string passed to filter according to query language.
"field_name" can have any field for orders.

Filter example:
array("!PERSON_TYPE_ID" => 5)
This filter indicates "select all entries with PERSON_TYPE_ID values (payer type code) is not equal to 5".

Default value - empty array() - indicates that result won't be filtered.
arGroupBy Array with fields used to group entries of payment system handlers. Looks as follows:
array("field_name1",
      "group_function1" => " field_name2", ...)
"field_nameN" can contain any field for payment system handlers. Group function can have:
  • COUNT - count;
  • AVG - calculation of average value;
  • MIN - calculation of minimum value;
  • MAX - calculation of maximum value;
  • SUM - calculation of total.
This filter indicates "select all records with the field value LID (system site) is not en".

Default value - false - no grouping of results.
arNavStartParams Array with selection parameters. Can contain the following keys:
  • "nTopCount" - limits the number of entries/records, returned by the method;
  • any key, received by the method CDBResult::NavQuery as the third parameter.
Default value - false - indicates empty selection parameters.
arSelectFields Array with fields to be returned by the method. Can contain only the required fields. In case the array has the value for "*", returns all available fields.

Default value - array is empty array() - returns all fields of query main table.

Returned values

Returns CDBResult class object, containing associative arrays with payment system handler parameters with the following keys:

  • ID - transaction code;
  • USER_ID - user code;
  • AMOUNT - total;
  • CURRENCY - amount currency;
  • DEBIT - "Y", in case of debit; if "N" - in case of crediting the account;
  • DESCRIPTION - description;
  • ORDER_ID - order code, if transaction is order-related;
  • EMPLOYEE_ID - user code who performed transaction;
  • TIMESTAMP_X - timestamp;
  • TRANSACT_DATE - transaction date.
  • USER_LOGIN - user login;
  • USER_ACTIVE - user activity flag;
  • USER_NAME - user name;
  • USER_LAST_NAME - user last name;
  • USER_EMAIL - user e-mail.

In case arGroupBy parameter passes an empty array, the method returns a number of entries, satisfying the filter.

Example

//Example of generating a report on customer personal account transactions 
<table cellpadding="0" cellspacing="0" border="0" class="data-table">
    <thead>
        <tr>
            <td>№</td>
            <td>Transaction date</td>
            <td>Total</td>
            <td>Description</td>
        </tr>
    </thead>
    <tbody>
    <?
    CModule::IncludeModule("sale");
    $res = CSaleUserTransact::GetList(Array("ID" => "DESC"), array("USER_ID" => $USER->GetID()));
    while ($arFields = $res->Fetch())
    {?>
        <tr>
            <td><?=$arFields["ID"]?></td>
            <td><?=$arFields["TRANSACT_DATE"]?></td>
            <td><?=($arFields["DEBIT"]=="Y")?"+":"-"?><?=SaleFormatCurrency($arFields["AMOUNT"], $arFields["CURRENCY"])?><br /><small>(<?=($arFields["DEBIT"]=="Y")?"to account":"со счета"?>)</small></td>
            <td><?=$arFields["NOTES"]?></td>
        </tr>
    <?}?>
    <tbody>
</table>

© «Bitrix24», 2001-2024
Up