From: phasefx Date: Tue, 29 Sep 2009 04:03:41 +0000 (+0000) Subject: Middle layer method and related permission for editing the note column for one or... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=158fbdc356a20c78761eec2648fc67b148b8ca35;p=evergreen%2Fmasslnc.git Middle layer method and related permission for editing the note column for one or more rows in money.billing git-svn-id: svn://svn.open-ils.org/ILS/trunk@14189 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Money.pm b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Money.pm index ad8da67695..6113960c12 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Money.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Money.pm @@ -408,6 +408,45 @@ sub void_bill { 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 ) = @_; diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index e0293801ff..3fcc9f1234 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -51,7 +51,7 @@ CREATE TABLE config.upgrade_log ( 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, 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 c4b5a3572c..32f740f699 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -1220,7 +1220,9 @@ INSERT INTO permission.perm_list VALUES -- 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); diff --git a/Open-ILS/src/sql/Pg/upgrade/0027.data.edit_billing_note_perm.sql b/Open-ILS/src/sql/Pg/upgrade/0027.data.edit_billing_note_perm.sql new file mode 100644 index 0000000000..a89fb7f457 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/0027.data.edit_billing_note_perm.sql @@ -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; +