[open-ils-commits] ***SPAM*** [GIT] Evergreen ILS branch master updated. 6cce3cd5e59eb2a247302467500c4b190a442586

Evergreen Git git at git.evergreen-ils.org
Mon Jul 14 08:38:18 EDT 2014


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  6cce3cd5e59eb2a247302467500c4b190a442586 (commit)
       via  64d321c68b2dde3b4e83fdca36c8ccf7acec8aba (commit)
      from  76686de7a0acd689466122a209b38d6db27e86fa (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 6cce3cd5e59eb2a247302467500c4b190a442586
Author: Jason Stephenson <jstephenson at mvlc.org>
Date:   Mon Jul 14 08:37:30 2014 -0400

    LP#1198475: Wrapping upgrade script for lost and paid copy status.
    
    Signed-off-by: Jason Stephenson <jason at sigio.com>

diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql
index 69e0e7f..7de740b 100644
--- a/Open-ILS/src/sql/Pg/002.schema.config.sql
+++ b/Open-ILS/src/sql/Pg/002.schema.config.sql
@@ -91,7 +91,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 ('0885', :eg_version); -- depesz/dyrcona/miker/kmlussier/bshum
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0886', :eg_version); -- dyrcona/kmlussier/rogan
 
 CREATE TABLE config.bib_source (
 	id		SERIAL	PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.lost-and-paid-status.sql b/Open-ILS/src/sql/Pg/upgrade/0886.data.lost-and-paid-status.sql
similarity index 87%
rename from Open-ILS/src/sql/Pg/upgrade/XXXX.data.lost-and-paid-status.sql
rename to Open-ILS/src/sql/Pg/upgrade/0886.data.lost-and-paid-status.sql
index 9454de5..176090f 100644
--- a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.lost-and-paid-status.sql
+++ b/Open-ILS/src/sql/Pg/upgrade/0886.data.lost-and-paid-status.sql
@@ -1,3 +1,7 @@
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('0886', :eg_version);
+
 INSERT INTO config.copy_status
 (id, name, holdable, opac_visible, copy_active, restrict_copy_delete)
 VALUES (17, 'Lost and Paid', FALSE, FALSE, FALSE, TRUE);
@@ -15,3 +19,4 @@ VALUES
      'coust', 'description'),
  'bool');
 
+COMMIT;

commit 64d321c68b2dde3b4e83fdca36c8ccf7acec8aba
Author: Jason Stephenson <jason at sigio.com>
Date:   Thu Jun 5 20:49:41 2014 -0400

    LP1198475: Add a new, optional, Lost and Paid copy status.
    
    Add the Lost and Paid status to config.copy_status.
    
    Add org_unit_settig to control if the copy status is used.
    
    Add checks to O::A::Circ::Money::make_payments to check for LOST
    status and org_unit setting and change the copy status to
    Lost and Paid as appropriate.
    
    Also add checks for Lost and Paid copy status wherever LOST copy
    status is used.
    
    Add the COPY_STATUS_LOST_AND_PAID event.
    
    Add the event to ils_events.xml with id 7026.
    
    Check for the event in circ/util.js in the staff client.
    
    Add pgTAP tests for the existence of the Lost and Paid copy status
    and the new org_unit setting to control if it isused.
    
    Signed-off-by: Jason Stephenson <jason at sigio.com>
    Signed-off-by: Kathy Lussier <klussier at masslnc.org>
    Signed-off-by: Rogan Hamby <rogan.hamby at gmail.com>

diff --git a/Open-ILS/src/extras/ils_events.xml b/Open-ILS/src/extras/ils_events.xml
index 21d59a7..80892ad 100644
--- a/Open-ILS/src/extras/ils_events.xml
+++ b/Open-ILS/src/extras/ils_events.xml
@@ -918,6 +918,9 @@
 	<event code='7025' textcode='COPY_STATUS_LONG_OVERDUE'>
 		<desc xml:lang="en-US">Copy is marked as long-overdue</desc>
 	</event>
+	<event code='7026' textcode='COPY_STATUS_LOST_AND_PAID'>
+	        <desc xml:lang="en-US">Copy is marked as lost and paid</desc>
+	</event>
 
 
 	<!-- ================================================================ -->
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm
index 9c9efc4..7580733 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm
@@ -2106,7 +2106,7 @@ sub checked_in_with_fines {
 
     my( @lost, @cr, @lo );
     for my $c (@$open) {
-        push( @lost, $c->id ) if $c->stop_fines eq 'LOST';
+        push( @lost, $c->id ) if ($c->stop_fines eq 'LOST');
         push( @cr, $c->id ) if $c->stop_fines eq 'CLAIMSRETURNED';
         push( @lo, $c->id ) if $c->stop_fines eq 'LONGOVERDUE';
     }
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm
index df5f2d4..896102d 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm
@@ -3420,7 +3420,7 @@ sub checkin_handle_circ {
         $self->copy->circ_lib->id : $self->copy->circ_lib;
     my $stat = $U->copy_status($self->copy->status)->id;
 
-    if ($stat == OILS_COPY_STATUS_LOST) {
+    if ($stat == OILS_COPY_STATUS_LOST || $stat == OILS_COPY_STATUS_LOST_AND_PAID) {
         # we will now handle lost fines, but the copy will retain its 'lost'
         # status if it needs to transit home unless lost_immediately_available
         # is true
@@ -3668,6 +3668,9 @@ sub check_checkin_copy_status {
    return OpenILS::Event->new('COPY_STATUS_LOST', payload => $copy )
       if( $status == OILS_COPY_STATUS_LOST );
 
+    return OpenILS::Event->new('COPY_STATUS_LOST_AND_PAID', payload => $copy)
+        if ($status == OILS_COPY_STATUS_LOST_AND_PAID);
+
    return OpenILS::Event->new('COPY_STATUS_LONG_OVERDUE', payload => $copy )
       if( $status == OILS_COPY_STATUS_LONG_OVERDUE );
 
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Money.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Money.pm
index 0c1493a..0401876 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Money.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Money.pm
@@ -29,6 +29,7 @@ use OpenILS::Utils::CStoreEditor qw/:funcs/;
 use OpenILS::Utils::Penalty;
 use Business::Stripe;
 $Data::Dumper::Indent = 0;
+use OpenILS::Const qw/:const/;
 
 sub get_processor_settings {
     my $e = shift;
@@ -466,10 +467,19 @@ sub make_payments {
             # credit
             $cred = -$cred;
             $credit += $cred;
-            my $circ = $e->retrieve_action_circulation($transid);
+            my $circ = $e->retrieve_action_circulation(
+                [
+                    $transid,
+                    {
+                        flesh => 1,
+                        flesh_fields => {circ => ['target_copy','billings']}
+                    }
+                ]
+            ); # Flesh the copy, so we can monkey with the status if
+               # necessary.
 
             # Whether or not we close the transaction. We definitely
-            # close is no circulation transaction is present,
+            # close if no circulation transaction is present,
             # otherwise we check if the circulation is in a state that
             # allows itself to be closed.
             if (!$circ || OpenILS::Application::Circ::CircCommon->can_close_circ($e, $circ)) {
@@ -481,6 +491,31 @@ sub make_payments {
                         $payment, $cc_payload
                     )
                 }
+
+                # If we have a circ, we need to check if the copy
+                # status is lost or long overdue.  If it is then we
+                # check org_unit_settings for the copy owning library
+                # and adjust and possibly adjust copy status to lost
+                # and paid.
+                if ($circ) {
+                    # We need the copy to check settings and to possibly
+                    # change its status.
+                    my $copy = $circ->target_copy();
+                    # Library where we'll check settings.
+                    my $check_lib = $copy->circ_lib();
+
+                    # check the copy status
+                    if (($copy->status() == OILS_COPY_STATUS_LOST || $copy->status() == OILS_COPY_STATUS_LONG_OVERDUE)
+                            && $U->is_true($U->ou_ancestor_setting_value($check_lib, 'circ.use_lost_paid_copy_status', $e))) {
+                        $copy->status(OILS_COPY_STATUS_LOST_AND_PAID);
+                        if (!$e->update_asset_copy($copy)) {
+                            return _recording_failure(
+                                $e, "update_asset_copy_failed()",
+                                $payment, $cc_payload
+                            )
+                        }
+                    }
+                }
             }
         }
 
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Transit.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Transit.pm
index e4e021b..bd687c4 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Transit.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Transit.pm
@@ -226,7 +226,8 @@ sub __abort_transit {
     my $evt;
     my $hold;
 
-    if( ($transit->copy_status == OILS_COPY_STATUS_LOST and !$e->allowed('ABORT_TRANSIT_ON_LOST')) or
+    if( (($transit->copy_status == OILS_COPY_STATUS_LOST || $transit->copy_status == OILS_COPY_STATUS_LOST_AND_PAID)
+             and !$e->allowed('ABORT_TRANSIT_ON_LOST')) or
         ($transit->copy_status == OILS_COPY_STATUS_MISSING and !$e->allowed('ABORT_TRANSIT_ON_MISSING')) ) {
         $e->rollback;
         return OpenILS::Event->new('TRANSIT_ABORT_NOT_ALLOWED', copy_status => $transit->copy_status);
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Const.pm b/Open-ILS/src/perlmods/lib/OpenILS/Const.pm
index 4f9e5c2..cd82e83 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Const.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Const.pm
@@ -43,6 +43,7 @@ econst OILS_COPY_STATUS_DISCARD       => 13;
 econst OILS_COPY_STATUS_DAMAGED       => 14;
 econst OILS_COPY_STATUS_ON_RESV_SHELF => 15;
 econst OILS_COPY_STATUS_LONG_OVERDUE  => 16;
+econst OILS_COPY_STATUS_LOST_AND_PAID => 17;
 
 
 # ---------------------------------------------------------------------
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/SIP/Item.pm b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Item.pm
index a2523e1..eb40e97 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/SIP/Item.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Item.pm
@@ -356,7 +356,7 @@ sub sip_circulation_status {
     return '08' if $stat == OILS_COPY_STATUS_ON_HOLDS_SHELF;
     return '09' if $stat == OILS_COPY_STATUS_RESHELVING;
     return '10' if $stat == OILS_COPY_STATUS_IN_TRANSIT;
-    return '12' if $stat == OILS_COPY_STATUS_LOST;
+    return '12' if ($stat == OILS_COPY_STATUS_LOST || $stat == OILS_COPY_STATUS_LOST_AND_PAID);
     return '13' if $stat == OILS_COPY_STATUS_MISSING;
         
     return '01';
diff --git a/Open-ILS/src/sql/Pg/950.data.seed-values.sql b/Open-ILS/src/sql/Pg/950.data.seed-values.sql
index 7801cd5..eb9ef56 100644
--- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql
+++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql
@@ -324,6 +324,9 @@ INSERT INTO config.copy_status (id,name,copy_active) VALUES (15,oils_i18n_gettex
 INSERT INTO config.copy_status
     (id, name, holdable, opac_visible, copy_active, restrict_copy_delete)
     VALUES (16, oils_i18n_gettext(16, 'Long Overdue', 'ccs', 'name'), 'f', 'f', 'f', 't');
+INSERT INTO config.copy_status
+(id, name, holdable, opac_visible, copy_active, restrict_copy_delete)
+VALUES (17, 'Lost and Paid', FALSE, FALSE, FALSE, TRUE);
 
 
 SELECT SETVAL('config.copy_status_id_seq'::TEXT, 100);
@@ -5004,6 +5007,15 @@ INSERT into config.org_unit_setting_type
         'coust',
         'description'),
     'integer', null)
+,('circ.use_lost_paid_copy_status',
+ 'circ',
+ oils_i18n_gettext('circ.use_lost_paid_copy_status',
+     'Use Lost and Paid copy status',
+     'coust', 'label'),
+ oils_i18n_gettext('circ.use_lost_paid_copy_status',
+     'Use Lost and Paid copy status when lost or long overdue billing is paid',
+     'coust', 'description'),
+ 'bool')
 ;
 
 UPDATE config.org_unit_setting_type
diff --git a/Open-ILS/src/sql/Pg/t/lp1198475-lost-and-paid-status.pg b/Open-ILS/src/sql/Pg/t/lp1198475-lost-and-paid-status.pg
new file mode 100644
index 0000000..9c5e664
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/t/lp1198475-lost-and-paid-status.pg
@@ -0,0 +1,36 @@
+\set ECHO
+\set QUIET 1
+-- Turn off echo and keep things quiet.
+
+-- Format the output for nice TAP.
+\pset format unaligned
+\pset tuples_only true
+\pset pager
+
+-- Revert all changes on failure.
+\set ON_ERROR_ROLLBACK 1
+\set ON_ERROR_STOP true
+\set QUIET 1
+
+-- Load the TAP functions.
+BEGIN;
+
+-- Plan the tests.
+SELECT plan(2);
+
+-- Run the tests.
+-- Check for Lost and Paid copy status.
+SELECT isnt_empty(
+    'SELECT * FROM config.copy_status WHERE id = 17',
+    'Lost and Paid copy status exists'
+);
+
+--Check for the org_unit setting.
+SELECT isnt_empty(
+    'SELECT * FROM config.org_unit_setting_type WHERE name = $$circ.use_lost_paid_copy_status$$',
+    'circ.use_lost_paid_copy_status exists'
+);
+
+-- Finish the tests and clean up.
+SELECT * FROM finish();
+ROLLBACK;
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.lost-and-paid-status.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.lost-and-paid-status.sql
new file mode 100644
index 0000000..9454de5
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.lost-and-paid-status.sql
@@ -0,0 +1,17 @@
+INSERT INTO config.copy_status
+(id, name, holdable, opac_visible, copy_active, restrict_copy_delete)
+VALUES (17, 'Lost and Paid', FALSE, FALSE, FALSE, TRUE);
+
+INSERT INTO config.org_unit_setting_type
+(name, grp, label, description, datatype)
+VALUES
+('circ.use_lost_paid_copy_status',
+ 'circ',
+ oils_i18n_gettext('circ.use_lost_paid_copy_status',
+     'Use Lost and Paid copy status',
+     'coust', 'label'),
+ oils_i18n_gettext('circ.use_lost_paid_copy_status',
+     'Use Lost and Paid copy status when lost or long overdue billing is paid',
+     'coust', 'description'),
+ 'bool');
+
diff --git a/Open-ILS/xul/staff_client/server/circ/util.js b/Open-ILS/xul/staff_client/server/circ/util.js
index 67472c4..058eb92 100644
--- a/Open-ILS/xul/staff_client/server/circ/util.js
+++ b/Open-ILS/xul/staff_client/server/circ/util.js
@@ -2756,6 +2756,7 @@ circ.util.checkin_via_barcode = function(session,params,backdate,auto_print,asyn
                     7010 /* COPY_ALERT_MESSAGE */,
                     7011 /* COPY_STATUS_LOST */,
                     7025 /* COPY_STATUS_LONG_OVERDUE */, 
+                    7026 /* COPY_STATUS_LOST_AND_PAID */,
                     7012 /* COPY_STATUS_MISSING */,
                     7013 /* PATRON_EXCEEDS_FINES */
                 ] : [],
@@ -2770,6 +2771,7 @@ circ.util.checkin_via_barcode = function(session,params,backdate,auto_print,asyn
                     7010 /* COPY_ALERT_MESSAGE */,
                     7011 /* COPY_STATUS_LOST */,
                     7025 /* COPY_STATUS_LONG_OVERDUE */, 
+                    7026 /* COPY_STATUS_LOST_AND_PAID */,
                     7012 /* COPY_STATUS_MISSING */,
                     7013 /* PATRON_EXCEEDS_FINES */,
                     11103 /* TRANSIT_CHECKIN_INTERVAL_BLOCK */ 

-----------------------------------------------------------------------

Summary of changes:
 Open-ILS/src/extras/ils_events.xml                 |    3 ++
 .../src/perlmods/lib/OpenILS/Application/Actor.pm  |    2 +-
 .../lib/OpenILS/Application/Circ/Circulate.pm      |    5 ++-
 .../perlmods/lib/OpenILS/Application/Circ/Money.pm |   39 +++++++++++++++++++-
 .../lib/OpenILS/Application/Circ/Transit.pm        |    3 +-
 Open-ILS/src/perlmods/lib/OpenILS/Const.pm         |    1 +
 Open-ILS/src/perlmods/lib/OpenILS/SIP/Item.pm      |    2 +-
 Open-ILS/src/sql/Pg/002.schema.config.sql          |    2 +-
 Open-ILS/src/sql/Pg/950.data.seed-values.sql       |   12 ++++++
 ...rsions.pg => lp1198475-lost-and-paid-status.pg} |   15 ++++----
 .../Pg/upgrade/0886.data.lost-and-paid-status.sql  |   22 +++++++++++
 Open-ILS/xul/staff_client/server/circ/util.js      |    2 +
 12 files changed, 94 insertions(+), 14 deletions(-)
 copy Open-ILS/src/sql/Pg/t/{versions.pg => lp1198475-lost-and-paid-status.pg} (56%)
 create mode 100644 Open-ILS/src/sql/Pg/upgrade/0886.data.lost-and-paid-status.sql


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list