$copy->price(0) if $copy->price and $copy->price < 0;
- return $copy->price if $copy->price and $copy->price > 0;
-
my $owner;
if(ref $volume) {
}
}
- my $default_price = $self->ou_ancestor_setting_value(
- $owner, OILS_SETTING_DEF_ITEM_PRICE, $e) || 0;
+ my $min_price = $self->ou_ancestor_setting_value($owner, OILS_SETTING_MIN_ITEM_PRICE);
+ my $max_price = $self->ou_ancestor_setting_value($owner, OILS_SETTING_MAX_ITEM_PRICE);
+ my $charge_on_0 = $self->ou_ancestor_setting_value($owner, OILS_SETTING_CHARGE_LOST_ON_ZERO, $e);
- return $default_price unless defined $copy->price;
+ my $price = $copy->price;
- # price is 0. Use the default?
- my $charge_on_0 = $self->ou_ancestor_setting_value(
- $owner, OILS_SETTING_CHARGE_LOST_ON_ZERO, $e) || 0;
+ # set the default price if needed
+ if (!defined $price or ($price == 0 and $charge_on_0)) {
+ # set to default price
+ $price = $self->ou_ancestor_setting_value(
+ $owner, OILS_SETTING_DEF_ITEM_PRICE, $e) || 0;
+ }
- return $default_price if $charge_on_0;
- return 0;
+ # adjust to min/max range if needed
+ if (defined $max_price and $price > $max_price) {
+ $price = $max_price;
+ } elsif (defined $min_price and $price < $min_price
+ and ($price != 0 or $charge_on_0 or !defined $charge_on_0)) {
+ # default to raising the price to the minimum,
+ # but let 0 fall through if $charge_on_0 is set and is false
+ $price = $min_price;
+ }
+
+ return $price;
}
# given a transaction ID, this returns the context org_unit for the transaction
# ---------------------------------------------------------------------
econst OILS_SETTING_LOST_PROCESSING_FEE => 'circ.lost_materials_processing_fee';
econst OILS_SETTING_DEF_ITEM_PRICE => 'cat.default_item_price';
+econst OILS_SETTING_MIN_ITEM_PRICE => 'circ.min_item_price';
+econst OILS_SETTING_MAX_ITEM_PRICE => 'circ.max_item_price';
econst OILS_SETTING_ORG_BOUNCED_EMAIL => 'org.bounced_emails';
econst OILS_SETTING_CHARGE_LOST_ON_ZERO => 'circ.charge_lost_on_zero';
econst OILS_SETTING_VOID_OVERDUE_ON_LOST => 'circ.void_overdue_on_lost';
( 551, 'ADMIN_SERVER_ADDON_FOR_WORKSTATION', oils_i18n_gettext( 551,
'Allows a user to specify which Server Add-ons get invoked at the current workstation', 'ppl', 'description')),
( 552, 'ADMIN_FLOAT_GROUPS', oils_i18n_gettext( 552,
- 'Allows administration of floating groups', 'ppl', 'description' ))
+ 'Allows administration of floating groups', 'ppl', 'description' )),
+ ( 552, 'UPDATE_ORG_UNIT_SETTING.circ.min_item_price', oils_i18n_gettext( 552,
+ 'UPDATE_ORG_UNIT_SETTING.circ.min_item_price', 'ppl', 'description' )),
+ ( 553, 'UPDATE_ORG_UNIT_SETTING.circ.max_item_price', oils_i18n_gettext( 553,
+ 'UPDATE_ORG_UNIT_SETTING.circ.max_item_price', 'ppl', 'description' ))
;
SELECT SETVAL('permission.perm_list_id_seq'::TEXT, 1000);
'coust', 'description'),
'currency', null)
+,( 'circ.min_item_price', 'finance',
+ oils_i18n_gettext('circ.min_item_price',
+ 'Minimum Item Price',
+ 'coust', 'label'),
+ oils_i18n_gettext('circ.min_item_price',
+ 'When charging for lost items, charge this amount as a minimum.',
+ 'coust', 'description'),
+ 'currency', null)
+
+,( 'circ.max_item_price', 'finance',
+ oils_i18n_gettext('circ.max_item_price',
+ 'Maximum Item Price',
+ 'coust', 'label'),
+ oils_i18n_gettext('circ.max_item_price',
+ 'When charging for lost items, limit the charge to this as a maximum.',
+ 'coust', 'description'),
+ 'currency', null)
+
,( 'cat.label.font.family', 'cat',
oils_i18n_gettext('cat.label.font.family',
'Spine and pocket label font family',
--- /dev/null
+BEGIN;
+
+-- SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+INSERT INTO permission.perm_list ( id, code, description ) VALUES (
+ 551, -- VERIFY
+ 'UPDATE_ORG_UNIT_SETTING.circ.min_item_price',
+ oils_i18n_gettext(
+ 551, -- VERIFY
+ 'UPDATE_ORG_UNIT_SETTING.circ.min_item_price',
+ 'ppl',
+ 'description'
+ )
+), (
+ 552, -- VERIFY
+ 'UPDATE_ORG_UNIT_SETTING.circ.max_item_price',
+ oils_i18n_gettext(
+ 552, -- VERIFY
+ 'UPDATE_ORG_UNIT_SETTING.circ.max_item_price',
+ 'ppl',
+ 'description'
+ )
+);
+
+INSERT into config.org_unit_setting_type
+ ( name, grp, label, description, datatype, fm_class )
+VALUES (
+ 'circ.min_item_price',
+ 'finance',
+ oils_i18n_gettext(
+ 'circ.min_item_price',
+ 'Minimum Item Price',
+ 'coust', 'label'),
+ oils_i18n_gettext(
+ 'circ.min_item_price',
+ 'When charging for lost items, charge this amount as a minimum.',
+ 'coust', 'description'),
+ 'currency',
+ NULL
+), (
+ 'circ.max_item_price',
+ 'finance',
+ oils_i18n_gettext(
+ 'circ.max_item_price',
+ 'Maximum Item Price',
+ 'coust', 'label'),
+ oils_i18n_gettext(
+ 'circ.max_item_price',
+ 'When charging for lost items, limit the charge to this as a maximum.',
+ 'coust', 'description'),
+ 'currency',
+ NULL
+);
+
+COMMIT;