<<

NAME

Koha::Patron - Koha Patron Object class

API

Class Methods

search_limited

my $patrons = Koha::Patrons->search_limit( $params, $attributes );

Returns all the patrons the logged in user is allowed to see

search_housebound_choosers

Returns all Patrons which are Housebound choosers.

search_housebound_deliverers

Returns all Patrons which are Housebound deliverers.

search_upcoming_membership_expires

my $patrons = Koha::Patrons->search_upcoming_membership_expires();

The 'before' and 'after' represent the number of days before/after the date that is set by the preference MembershipExpiryDaysNotice. If the pref is 14, before 2 and after 3 then you will get all expires from 12 to 17 days.

search_patrons_to_anonymise

    my $patrons = Koha::Patrons->search_patrons_to_anonymise( { before => $older_than_date, [ library => $library ] } );

This method returns all patrons who has an issue history older than a given date.

delete

    Koha::Patrons->search({ some filters here })->delete({ move => 1 });

    Delete passed set of patron objects.
    Wrapper for Koha::Patron->delete. (We do not want to bypass Koha::Patron
    and let DBIx do the job without further housekeeping.)
    Includes a move to deletedborrowers if move flag set.

    Just like DBIx, the delete will only succeed when all entries could be
    deleted. Returns true or throws an exception.

filter_by_expiration_date

    Koha::Patrons->filter_by_expiration_date{{ days => $x });

    Returns set of Koha patron objects expired $x days.

search_unsubscribed

    Koha::Patrons->search_unsubscribed;

    Returns a set of Koha patron objects for patrons that recently
    unsubscribed and are not locked (candidates for locking).
    Depends on UnsubscribeReflectionDelay.

search_anonymize_candidates

    Koha::Patrons->search_anonymize_candidates({ locked => 1 });

    Returns a set of Koha patron objects for patrons whose account is expired
    and locked (if parameter set). These are candidates for anonymizing.
    Depends on PatronAnonymizeDelay.

search_anonymized

    Koha::Patrons->search_anonymized;

    Returns a set of Koha patron objects for patron accounts that have been
    anonymized before and could be removed.
    Depends on PatronRemovalDelay.

lock

    Koha::Patrons->search({ some filters })->lock({ expire => 1, remove => 1 })

    Lock the passed set of patron objects. Optionally expire and remove holds.
    Wrapper around Koha::Patron->lock.

anonymize

    Koha::Patrons->search({ some filters })->anonymize();

    Anonymize passed set of patron objects.
    Wrapper around Koha::Patron->anonymize.

search_patrons_to_update_category

    my $patrons = Koha::Patrons->search_patrons_to_update_category( {
                      from          => $from_category,
                      fine_max      => $fine_max,
                      fine_min      => $fin_min,
                      too_young     => $too_young,
                      too_old      => $too_old,
                  });

This method returns all patron who should be updated from one category to another meeting criteria:

from - borrower categorycode fine_min - with fines totaling at least this amount fine_max - with fines above this amount too_young - if passed, select patrons who are under the age limit for the current category too_old - if passed, select patrons who are over the age limit for the current category

update_category_to

    Koha::Patrons->search->update_category_to( {
            category   => $to_category,
        });

Update supplied patrons from current category to another and take care of guarantor info. To make sure all the conditions are met, the caller has the responsibility to call search_patrons_to_update to filter the Koha::Patrons set

filter_by_attribute_type

my $patrons = Koha::Patrons->filter_by_attribute_type($attribute_type_code);

Return a Koha::Patrons set with patrons having the attribute defined.

filter_by_attribute_value

my $patrons = Koha::Patrons->filter_by_attribute_value($attribute_value);

Return a Koha::Patrons set with patrong having the attribute value passed in parameter.

filter_by_amount_owed

    Koha::Patrons->filter_by_amount_owed(
        {
            less_than  => '2.00',
            more_than  => '0.50',
            debit_type => $debit_type_code,
            library    => $branchcode
        }
    );

Returns patrons filtered by how much money they owe, between passed limits.

Optionally limit to debts of a particular debit_type or/and owed to a particular library.

arguments hashref

less_than (optional) - filter out patrons who owe less than Amount
more_than (optional) - filter out patrons who owe more than Amount
debit_type (optional) - filter the amount owed by debit type
library (optional) - filter the amount owed to a particular branch

filter_by_have_permission

    my $patrons = Koha::Patrons->search->filter_by_have_permission('suggestions.suggestions_manage');

    my $patrons = Koha::Patrons->search->filter_by_have_permission('suggestions');

Filter patrons who have a given subpermission or the whole permission.

filter_by_expired_opac_registrations

    my $expired_registrations = $patrons->filter_by_expired_opac_registrations;

Return patrons that have not upgraded from the 'temporary' category

filter_by_safe_to_delete

    my $safe_to_delete_patrons = $patrons->filter_by_safe_to_delete;

Return the patrons that are safe to delete

extended_attributes_config

_type

object_class

AUTHOR

Kyle M Hall <kyle@bywatersolutions.com>

<<