return $counts->[0]->{id};
}
+# returns the owning library to use when auto-creating
+# line item details in the case where the provider's default
+# copy count is greater than zero
+sub get_default_lid_owning_library {
+ my ($class, $e) = @_;
+ my $strategy = $U->ou_ancestor_setting_value($e->requestor->ws_ou, 'acq.default_owning_lib_for_auto_lids_strategy');
+ if (defined $strategy) {
+ if ($strategy eq 'workstation') {
+ return $e->requestor->ws_ou;
+ } elsif ($strategy eq 'blank') {
+ return undef;
+ } elsif ($strategy eq 'use_setting') {
+ return $U->ou_ancestor_setting_value($e->requestor->ws_ou, 'acq.default_owning_lib_for_auto_lids');
+ } else {
+ return $e->requestor->ws_ou;
+ }
+ } else {
+ return $e->requestor->ws_ou;
+ }
+}
+1;
if ($po) {
# apply the default number of copies for this provider
+ my $owning_lib = $AC->get_default_lid_owning_library($e);
+ $logger->warn("GMC: owning_lib => $owning_lib");
for (1 .. $po->provider->default_copy_count) {
my $lid = Fieldmapper::acq::lineitem_detail->new;
$lid->lineitem($li->id);
- $lid->owning_lib($e->requestor->ws_ou);
+ $lid->owning_lib($owning_lib);
$e->create_acq_lineitem_detail($lid) or return $e->die_event;
}
}
},
{idlist => 1}
);
-
+
+ my $owning_lib = $AC->get_default_lid_owning_library($e);
for my $li_id (@$li_ids) {
my $lid_ids = $e->search_acq_lineitem_detail(
for (1 .. $copy_count) {
create_lineitem_detail($mgr,
lineitem => $li_id,
- owning_lib => $e->requestor->ws_ou
+ owning_lib => $owning_lib
) or return 0;
}
}
INSERT into config.org_unit_setting_type
( name, grp, label, description, datatype, fm_class ) VALUES
-( 'acq.copy_creator_uses_receiver', 'acq',
+( 'acq.default_owning_lib_for_auto_lids_strategy', 'acq',
+ oils_i18n_gettext('acq.default_owning_lib_for_auto_lids_strategy',
+ 'How to set default owning library for auto-created line item items',
+ 'coust', 'label'),
+ oils_i18n_gettext('acq.default_owning_lib_for_auto_lids_strategy',
+ 'Stategy to use to set default owning library to set when line item items are auto-created because the provider''s default copy count has been set. Valid values are "workstation" to use the workstation library, "blank" to leave it blank, and "use_setting" to use the "Default owning library for auto-created line item items" setting. If not set, the workstation library will be used.',
+ 'coust', 'description'),
+ 'string', null)
+,( 'acq.default_owning_lib_for_auto_lids', 'acq',
+ oils_i18n_gettext('acq.default_owning_lib_for_auto_lids',
+ 'Default owning library for auto-created line item items',
+ 'coust', 'label'),
+ oils_i18n_gettext('acq.default_owning_lib_for_auto_lids',
+ 'The default owning library to set when line item items are auto-created because the provider''s default copy count has been set. This applies if the "How to set default owning library for auto-created line item items" setting is set to "use_setting".',
+ 'coust', 'description'),
+ 'link', 'aou')
+,( 'acq.copy_creator_uses_receiver', 'acq',
oils_i18n_gettext('acq.copy_creator_uses_receiver',
'Set copy creator as receiver',
'coust', 'label'),
--- /dev/null
+BEGIN;
+
+--SELECT evergreen.upgrade_deps_block_check('TODO', :eg_version);
+
+INSERT into config.org_unit_setting_type
+( name, grp, label, description, datatype, fm_class ) VALUES
+
+( 'acq.default_owning_lib_for_auto_lids_strategy', 'acq',
+ oils_i18n_gettext('acq.default_owning_lib_for_auto_lids_strategy',
+ 'How to set default owning library for auto-created line item items',
+ 'coust', 'label'),
+ oils_i18n_gettext('acq.default_owning_lib_for_auto_lids_strategy',
+ 'Stategy to use to set default owning library to set when line item items are auto-created because the provider''s default copy count has been set. Valid values are "workstation" to use the workstation library, "blank" to leave it blank, and "use_setting" to use the "Default owning library for auto-created line item items" setting. If not set, the workstation library will be used.',
+ 'coust', 'description'),
+ 'string', null)
+,( 'acq.default_owning_lib_for_auto_lids', 'acq',
+ oils_i18n_gettext('acq.default_owning_lib_for_auto_lids',
+ 'Default owning library for auto-created line item items',
+ 'coust', 'label'),
+ oils_i18n_gettext('acq.default_owning_lib_for_auto_lids',
+ 'The default owning library to set when line item items are auto-created because the provider''s default copy count has been set. This applies if the "How to set default owning library for auto-created line item items" setting is set to "use_setting".',
+ 'coust', 'description'),
+ 'link', 'aou')
+;
+
+COMMIT;