C4::ItemCirculationAlertPreference - manage preferences for sending alerts
Basics:
use C4::ItemCirculationAlertPreference; # a short-cut to reduce typing the long package name over and over again my $preferences = 'C4::ItemCirculationAlertPreference';
Creating Rules:
my $pref = $preferences->create({ branchcode => 'CPL', categorycode => 'YA', item_type => 'BK', });
Deleting Rules:
$preferences->delete({ branchcode => 'CPL', categorycode => 'YA', item_type => 'BK', });
This class is used to manage the preferences for when an alert may be sent. By default, item circulation alerts are enabled for every branch, patron category and item type.
However, if you would like to prevent item circulation alerts from being sent for any combination of these 3 variables, a preference can be inserted into the item_circulation_alert_preferences
table to make that a policy.
This is a constructor for an in-memory C4::ItemCirculationAlertPreference object. The database is not affected by this method.
This will find or create an item circulation alert preference. You must pass it a branchcode, categorycode, and item_type.
Delete an item circulation alert preference. You can delete by either passing in an id or passing in a branchcode, categorycode, item_type triplet.
Based on the existing preferences in the item_circulation_alert_preferences
table, can an alert be sent for the given branchcode, categorycode, and itemtype?
Example:
my $alert = 'C4::ItemCirculationAlertPreference'; my $conditions = { branchcode => 'CPL', categorycode => 'IL', item_type => 'MU', }; if ($alert->is_enabled_for($conditions)) { # ... }
This method returns all the item circulation alert preferences for a given branch.
Example:
my @branch_prefs = C4::ItemCirculationAlertPreference->find({ branchcode => 'CPL', });
These are read-only accessors for the various attributes of a preference.
C4::Circulation, admin/item_circulation_alerts.pl
John Beppu <john.beppu@liblime.com>