[open-ils-commits] [GIT] Evergreen ILS branch master updated. a88a3194335448e10f0883cd181f92902ce1eaed
Evergreen Git
git at git.evergreen-ils.org
Mon Mar 11 09:22:36 EDT 2013
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".
The branch, master has been updated
via a88a3194335448e10f0883cd181f92902ce1eaed (commit)
via c8f1aec1de9115106dffaff9c88d41821ff5695e (commit)
via b6425d785d603adb587affd7437f9289fb8cbc20 (commit)
from cd28d0a15d63626e09e1577b1cc9db239bb0ffa8 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit a88a3194335448e10f0883cd181f92902ce1eaed
Author: Bill Erickson <berick at esilibrary.com>
Date: Mon Mar 11 09:12:43 2013 -0400
lp1110538: DB upgrade; default provider copies
Signed-off-by: Bill Erickson <berick at esilibrary.com>
diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql
index d773eb1..f749501 100644
--- a/Open-ILS/src/sql/Pg/002.schema.config.sql
+++ b/Open-ILS/src/sql/Pg/002.schema.config.sql
@@ -90,7 +90,7 @@ CREATE TRIGGER no_overlapping_deps
BEFORE INSERT OR UPDATE ON config.db_patch_dependencies
FOR EACH ROW EXECUTE PROCEDURE evergreen.array_overlap_check ('deprecates');
-INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0764', :eg_version); -- gmcharlt/berick/bshum
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0765', :eg_version); -- berick/kmlussier
CREATE TABLE config.bib_source (
id SERIAL PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/0765.schema.provider_copy_count.sql b/Open-ILS/src/sql/Pg/upgrade/0765.schema.provider_copy_count.sql
new file mode 100644
index 0000000..f3553ac
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/upgrade/0765.schema.provider_copy_count.sql
@@ -0,0 +1,8 @@
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('0765', :eg_version);
+
+ALTER TABLE acq.provider
+ ADD COLUMN default_copy_count INTEGER NOT NULL DEFAULT 0;
+
+COMMIT;
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.provider_copy_count.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.provider_copy_count.sql
deleted file mode 100644
index 9422a8e..0000000
--- a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.provider_copy_count.sql
+++ /dev/null
@@ -1,7 +0,0 @@
-
-BEGIN;
-
-ALTER TABLE acq.provider
- ADD COLUMN default_copy_count INTEGER NOT NULL DEFAULT 0;
-
-COMMIT;
commit c8f1aec1de9115106dffaff9c88d41821ff5695e
Author: Bill Erickson <berick at esilibrary.com>
Date: Mon Feb 4 15:46:20 2013 -0500
Default ACQ copies use workstation org as owning lib
When creating default copies for new lineitems or lineitems added to
POs, use the workstation org unit as the owning lib for each copy. With
this, it's possible to order items for "here" without having to edit any
single copies. This also resolves a confusing issue where opening the
copies in the copies grid made it appear that each copy had an
owning_lib applied (via the autofieldwidget) when none was yet set.
Signed-off-by: Bill Erickson <berick at esilibrary.com>
Signed-off-by: Kathy Lussier <klussier at masslnc.org>
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Lineitem.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Lineitem.pm
index e41690e..9fe3ae6 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Lineitem.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Lineitem.pm
@@ -69,6 +69,7 @@ sub create_lineitem {
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);
$e->create_acq_lineitem_detail($lid) or return $e->die_event;
}
}
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm
index 4f899b7..8ec6538 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm
@@ -1842,7 +1842,10 @@ sub apply_default_copies {
next if @$lid_ids;
for (1 .. $copy_count) {
- create_lineitem_detail($mgr, lineitem => $li_id) or return 0;
+ create_lineitem_detail($mgr,
+ lineitem => $li_id,
+ owning_lib => $e->requestor->ws_ou
+ ) or return 0;
}
}
commit b6425d785d603adb587affd7437f9289fb8cbc20
Author: Bill Erickson <berick at esilibrary.com>
Date: Wed Jan 30 09:36:17 2013 -0500
Default number of ACQ copies per provider
Acquisitions providers have a new "Default # Copies" field. When the value
is set, this number of copies will be automatically added to each lineitem
added to a purchase order for the provider. This takes place during PO
creation from a selection list or existing bib record and when a lineitem is
added to an existing purchase order. If a lineitem already has copies
attached, no default copies are added.
Signed-off-by: Bill Erickson <berick at esilibrary.com>
Signed-off-by: Kathy Lussier <klussier at masslnc.org>
diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml
index f656573..ce82dea 100644
--- a/Open-ILS/examples/fm_IDL.xml
+++ b/Open-ILS/examples/fm_IDL.xml
@@ -6834,6 +6834,7 @@ SELECT usr,
<field reporter:label="Phone" name="phone" reporter:datatype="text" />
<field reporter:label="Fax Phone" name="fax_phone" reporter:datatype="text" />
<field reporter:label="Default Claim Policy" name="default_claim_policy" reporter:datatype="link" />
+ <field reporter:label="Default # Copies" name="default_copy_count" reporter:datatype="int" />
</fields>
<links>
<link field="currency_type" reltype="has_a" key="code" map="" class="acqct"/>
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Lineitem.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Lineitem.pm
index 47687f8..e41690e 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Lineitem.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Lineitem.pm
@@ -49,9 +49,12 @@ sub create_lineitem {
$e->update_acq_picklist($picklist) or return $e->die_event;
}
+ my $po;
if($li->purchase_order) {
- my $po = $e->retrieve_acq_purchase_order($li->purchase_order)
- or return $e->die_event;
+ $po = $e->retrieve_acq_purchase_order([
+ $li->purchase_order,
+ {flesh => 1, flesh_fields => {acqpo => ['provider']}}
+ ]) or return $e->die_event;
return $e->die_event unless
$e->allowed('MANAGE_PROVIDER', $po->ordering_agency, $po);
@@ -59,7 +62,16 @@ sub create_lineitem {
}
$li->selector($e->requestor->id);
- $e->create_acq_lineitem($li) or return $e->die_event;
+ $li = $e->create_acq_lineitem($li) or return $e->die_event;
+
+ if ($po) {
+ # apply the default number of copies for this provider
+ for (1 .. $po->provider->default_copy_count) {
+ my $lid = Fieldmapper::acq::lineitem_detail->new;
+ $lid->lineitem($li->id);
+ $e->create_acq_lineitem_detail($lid) or return $e->die_event;
+ }
+ }
$e->commit;
return $li->id;
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm
index a297b74..4f899b7 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm
@@ -1792,13 +1792,63 @@ sub create_purchase_order_api {
# commit before starting the asset creation
$e->xact_commit;
- if($li_ids and $vandelay) {
- create_lineitem_list_assets($mgr, $li_ids, $vandelay, !$$args{create_assets}) or return $e->die_event;
+ if($li_ids) {
+
+ if ($vandelay) {
+ create_lineitem_list_assets(
+ $mgr, $li_ids, $vandelay, !$$args{create_assets})
+ or return $e->die_event;
+ }
+
+ $e->xact_begin;
+ apply_default_copies($mgr, $po) or return $e->die_event;
+ $e->xact_commit;
}
return $mgr->respond_complete;
}
+# !transaction must be managed by the caller
+# creates the default number of copies for each lineitem on the PO.
+# when a LI already has copies attached, no default copies are added.
+# without li_id, all lineitems are checked/applied
+# returns 1 on success, 0 on error
+sub apply_default_copies {
+ my ($mgr, $po, $li_id) = @_;
+
+ my $e = $mgr->editor;
+
+ my $provider = ref($po->provider) ? $po->provider :
+ $e->retrieve_acq_provider($po->provider);
+
+ my $copy_count = $provider->default_copy_count || return 1;
+
+ $logger->info("Applying $copy_count default copies for PO ".$po->id);
+
+ my $li_ids = $li_id ? [$li_id] :
+ $e->search_acq_lineitem({
+ purchase_order => $po->id,
+ cancel_reason => undef
+ },
+ {idlist => 1}
+ );
+
+ for my $li_id (@$li_ids) {
+
+ my $lid_ids = $e->search_acq_lineitem_detail(
+ {lineitem => $li_id}, {idlist => 1});
+
+ # do not apply default copies when copies already exist
+ next if @$lid_ids;
+
+ for (1 .. $copy_count) {
+ create_lineitem_detail($mgr, lineitem => $li_id) or return 0;
+ }
+ }
+
+ return 1;
+}
+
__PACKAGE__->register_method(
diff --git a/Open-ILS/src/sql/Pg/200.schema.acq.sql b/Open-ILS/src/sql/Pg/200.schema.acq.sql
index aad60a4..89c573a 100644
--- a/Open-ILS/src/sql/Pg/200.schema.acq.sql
+++ b/Open-ILS/src/sql/Pg/200.schema.acq.sql
@@ -89,6 +89,7 @@ CREATE TABLE acq.provider (
email TEXT,
phone TEXT,
fax_phone TEXT,
+ default_copy_count INT NOT NULL DEFAULT 0,
default_claim_policy INT REFERENCES acq.claim_policy
DEFERRABLE INITIALLY DEFERRED,
CONSTRAINT provider_name_once_per_owner UNIQUE (name,owner),
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.provider_copy_count.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.provider_copy_count.sql
new file mode 100644
index 0000000..9422a8e
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.provider_copy_count.sql
@@ -0,0 +1,7 @@
+
+BEGIN;
+
+ALTER TABLE acq.provider
+ ADD COLUMN default_copy_count INTEGER NOT NULL DEFAULT 0;
+
+COMMIT;
diff --git a/docs/RELEASE_NOTES_NEXT/acq_default_copy_count.txt b/docs/RELEASE_NOTES_NEXT/acq_default_copy_count.txt
new file mode 100644
index 0000000..4ff5cc4
--- /dev/null
+++ b/docs/RELEASE_NOTES_NEXT/acq_default_copy_count.txt
@@ -0,0 +1,8 @@
+New Feature: Default Number of Acquisistions Copies to Order
+============================================================
+Acquisitions providers have a new "Default # Copies" field. When the value
+is set, this number of copies will be automatically added to each lineitem
+added to a purchase order for the provider. This takes place during PO
+creation from a selection list or existing bib record and when a lineitem is
+added to an existing purchase order. If a lineitem already has copies
+attached, no default copies are added.
-----------------------------------------------------------------------
Summary of changes:
Open-ILS/examples/fm_IDL.xml | 1 +
.../lib/OpenILS/Application/Acq/Lineitem.pm | 19 ++++++-
.../perlmods/lib/OpenILS/Application/Acq/Order.pm | 57 +++++++++++++++++++-
Open-ILS/src/sql/Pg/002.schema.config.sql | 2 +-
Open-ILS/src/sql/Pg/200.schema.acq.sql | 1 +
.../Pg/upgrade/0765.schema.provider_copy_count.sql | 8 +++
docs/RELEASE_NOTES_NEXT/acq_default_copy_count.txt | 8 +++
7 files changed, 90 insertions(+), 6 deletions(-)
create mode 100644 Open-ILS/src/sql/Pg/upgrade/0765.schema.provider_copy_count.sql
create mode 100644 docs/RELEASE_NOTES_NEXT/acq_default_copy_count.txt
hooks/post-receive
--
Evergreen ILS
More information about the open-ils-commits
mailing list