[open-ils-commits] r14189 - in trunk/Open-ILS/src: perlmods/OpenILS/Application/Circ sql/Pg sql/Pg/upgrade (phasefx)

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Sep 29 00:03:44 EDT 2009


Author: phasefx
Date: 2009-09-29 00:03:41 -0400 (Tue, 29 Sep 2009)
New Revision: 14189

Added:
   trunk/Open-ILS/src/sql/Pg/upgrade/0027.data.edit_billing_note_perm.sql
Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Money.pm
   trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
   trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql
Log:
Middle layer method and related permission for editing the note column for one or more rows in money.billing

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Money.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Money.pm	2009-09-29 03:53:14 UTC (rev 14188)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Money.pm	2009-09-29 04:03:41 UTC (rev 14189)
@@ -408,7 +408,46 @@
 	return 1;
 }
 
+__PACKAGE__->register_method(
+	method		=>	'edit_bill_note',
+	api_name		=> 'open-ils.circ.money.billing.note.edit',
+	signature	=> q/
+		Voids a bill
+		@param authtoken Login session key
+        @param note The replacement note for the bills we're editing
+		@param billids Array of bill id's for the bills whose notes we want to edit.
+		@return 1 on success, Event on error
+	/
+);
 
+
+sub edit_bill_note {
+	my( $s, $c, $authtoken, $note, @billids ) = @_;
+
+	my $e = new_editor( authtoken => $authtoken, xact => 1 );
+	return $e->die_event unless $e->checkauth;
+	return $e->die_event unless $e->allowed('UPDATE_BILL_NOTE');
+
+    my %users;
+    for my $billid (@billids) {
+
+	    my $bill = $e->retrieve_money_billing($billid)
+		    or return $e->die_event;
+
+        my $xact = $e->retrieve_money_billable_transaction($bill->xact)
+            or return $e->die_event;
+
+	    $bill->note($note);
+        # FIXME: Does this get audited?  Need some way so that the original creator of the bill does not get credit/blame for the new note.
+    
+	    $e->update_money_billing($bill) or return $e->die_event;
+    }
+
+	$e->commit;
+	return 1;
+}
+
+
 sub _check_open_xact {
 	my( $editor, $xactid, $xact ) = @_;
 

Modified: trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/002.schema.config.sql	2009-09-29 03:53:14 UTC (rev 14188)
+++ trunk/Open-ILS/src/sql/Pg/002.schema.config.sql	2009-09-29 04:03:41 UTC (rev 14189)
@@ -51,7 +51,7 @@
     install_date    TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
 );
 
-INSERT INTO config.upgrade_log (version) VALUES ('0026'); -- phasefx
+INSERT INTO config.upgrade_log (version) VALUES ('0027'); -- phasefx
 
 CREATE TABLE config.bib_source (
 	id		SERIAL	PRIMARY KEY,

Modified: trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql	2009-09-29 03:53:14 UTC (rev 14188)
+++ trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql	2009-09-29 04:03:41 UTC (rev 14189)
@@ -1220,8 +1220,10 @@
 
 -- perm to override max claims returned
     (344,'SET_CIRC_CLAIMS_RETURNED.override', oils_i18n_gettext(344,'Allows staff to override the max claims returned value for a patron', 'ppl', 'description')),
-    (345,'UPDATE_PATRON_CLAIM_RETURN_COUNT', oils_i18n_gettext(345,'Allows staff to manually change a patron''s claims returned count', 'ppl', 'description'));
+    (345,'UPDATE_PATRON_CLAIM_RETURN_COUNT', oils_i18n_gettext(345,'Allows staff to manually change a patron''s claims returned count', 'ppl', 'description')),
 
+    (346,'UPDATE_BILL_NOTE', oils_i18n_gettext(346,'Allows staff to edit the note for a bill on a transaction', 'ppl', 'description'));
+
 SELECT SETVAL('permission.perm_list_id_seq'::TEXT, 1000);
 
 INSERT INTO permission.grp_tree (id, name, parent, description, perm_interval, usergroup, application_perm) VALUES

Added: trunk/Open-ILS/src/sql/Pg/upgrade/0027.data.edit_billing_note_perm.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/upgrade/0027.data.edit_billing_note_perm.sql	                        (rev 0)
+++ trunk/Open-ILS/src/sql/Pg/upgrade/0027.data.edit_billing_note_perm.sql	2009-09-29 04:03:41 UTC (rev 14189)
@@ -0,0 +1,9 @@
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0027');
+
+INSERT INTO permission.perm_list VALUES
+    (346,'UPDATE_BILL_NOTE', oils_i18n_gettext(346,'Allows staff to edit the note for a bill on a transaction', 'ppl', 'description'));
+
+COMMIT;
+



More information about the open-ils-commits mailing list