lp1846354 additional tweaks and fixes
authorJason Etheridge <jason@EquinoxInitiative.org>
Tue, 9 Mar 2021 23:02:30 +0000 (18:02 -0500)
committerChris Sharp <csharp@georgialibraries.org>
Mon, 20 Sep 2021 19:45:31 +0000 (15:45 -0400)
* fixes for SIP
* patron merge & purge
* also tweak some storage code, which probably isn't being used for this anywhere
* remove some legacy note code
* don't filter out penalties with deleted messages for Notes count in patron staff display

Signed-off-by: Jason Etheridge <jason@EquinoxInitiative.org>
Signed-off-by: Chris Sharp <csharp@georgialibraries.org>
15 files changed:
Open-ILS/src/extras/ils_events.xml
Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Collections.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/actor.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/dbi.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm
Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm
Open-ILS/src/sql/Pg/999.functions.global.sql
Open-ILS/src/support-scripts/test-scripts/notes.pl [deleted file]
Open-ILS/src/templates/staff/circ/patron/t_new_note_dialog.tt2 [deleted file]
Open-ILS/src/templates/staff/circ/patron/t_notes.tt2 [deleted file]
Open-ILS/src/templates/staff/share/print_templates/t_patron_note.tt2 [deleted file]
Open-ILS/web/js/ui/default/staff/circ/patron/app.js
Open-ILS/web/opac/common/js/config.js

index 0a5507f..070ad72 100644 (file)
        <event code='1532' textcode='MONEY_BILLABLE_TRANSACTION_SUMMARY_NOT_FOUND'>
                <desc xml:lang='en-US'>The requested money_billable_transaction_summary was not found</desc>
        </event>
-       <event code='1533' textcode='ACTOR_USR_NOTE_NOT_FOUND'>
-               <desc xml:lang='en-US'>The requested actor_usr_note was not found</desc>
-       </event>
        <event code='1534' textcode='ACTOR_USER_SETTING_NOT_FOUND'>
                <desc xml:lang='en-US'>The requested actor_user_setting was not found</desc>
        </event>
index bda62ef..faf723b 100644 (file)
@@ -2792,126 +2792,6 @@ sub workstation_list {
     return \%results;
 }
 
-
-__PACKAGE__->register_method(
-    method        => 'fetch_patron_note',
-    api_name      => 'open-ils.actor.note.retrieve.all',
-    authoritative => 1,
-    signature     => q/
-        Returns a list of notes for a given user
-        Requestor must have VIEW_USER permission if pub==false and
-        @param authtoken The login session key
-        @param args Hash of params including
-            patronid : the patron's id
-            pub : true if retrieving only public notes
-    /
-);
-
-sub fetch_patron_note {
-    my( $self, $conn, $authtoken, $args ) = @_;
-    my $patronid = $$args{patronid};
-
-    my($reqr, $evt) = $U->checkses($authtoken);
-    return $evt if $evt;
-
-    my $patron;
-    ($patron, $evt) = $U->fetch_user($patronid);
-    return $evt if $evt;
-
-    if($$args{pub}) {
-        if( $patronid ne $reqr->id ) {
-            $evt = $U->check_perms($reqr->id, $patron->home_ou, 'VIEW_USER');
-            return $evt if $evt;
-        }
-        return $U->cstorereq(
-            'open-ils.cstore.direct.actor.usr_note.search.atomic',
-            { usr => $patronid, pub => 't' } );
-    }
-
-    $evt = $U->check_perms($reqr->id, $patron->home_ou, 'VIEW_USER');
-    return $evt if $evt;
-
-    return $U->cstorereq(
-        'open-ils.cstore.direct.actor.usr_note.search.atomic', { usr => $patronid } );
-}
-
-__PACKAGE__->register_method(
-    method    => 'create_user_note',
-    api_name  => 'open-ils.actor.note.create',
-    signature => q/
-        Creates a new note for the given user
-        @param authtoken The login session key
-        @param note The note object
-    /
-);
-sub create_user_note {
-    my( $self, $conn, $authtoken, $note ) = @_;
-    my $e = new_editor(xact=>1, authtoken=>$authtoken);
-    return $e->die_event unless $e->checkauth;
-
-    my $user = $e->retrieve_actor_user($note->usr)
-        or return $e->die_event;
-
-    return $e->die_event unless
-        $e->allowed('UPDATE_USER',$user->home_ou);
-
-    $note->creator($e->requestor->id);
-    $e->create_actor_usr_note($note) or return $e->die_event;
-    $e->commit;
-    return $note->id;
-}
-
-
-__PACKAGE__->register_method(
-    method    => 'delete_user_note',
-    api_name  => 'open-ils.actor.note.delete',
-    signature => q/
-        Deletes a note for the given user
-        @param authtoken The login session key
-        @param noteid The note id
-    /
-);
-sub delete_user_note {
-    my( $self, $conn, $authtoken, $noteid ) = @_;
-
-    my $e = new_editor(xact=>1, authtoken=>$authtoken);
-    return $e->die_event unless $e->checkauth;
-    my $note = $e->retrieve_actor_usr_note($noteid)
-        or return $e->die_event;
-    my $user = $e->retrieve_actor_user($note->usr)
-        or return $e->die_event;
-    return $e->die_event unless
-        $e->allowed('UPDATE_USER', $user->home_ou);
-
-    $e->delete_actor_usr_note($note) or return $e->die_event;
-    $e->commit;
-    return 1;
-}
-
-
-__PACKAGE__->register_method(
-    method    => 'update_user_note',
-    api_name  => 'open-ils.actor.note.update',
-    signature => q/
-        @param authtoken The login session key
-        @param note The note
-    /
-);
-
-sub update_user_note {
-    my( $self, $conn, $auth, $note ) = @_;
-    my $e = new_editor(authtoken=>$auth, xact=>1);
-    return $e->die_event unless $e->checkauth;
-    my $patron = $e->retrieve_actor_user($note->usr)
-        or return $e->die_event;
-    return $e->die_event unless
-        $e->allowed('UPDATE_USER', $patron->home_ou);
-    $e->update_actor_user_note($note)
-        or return $e->die_event;
-    $e->commit;
-    return 1;
-}
-
 __PACKAGE__->register_method(
     method        => 'fetch_patron_messages',
     api_name      => 'open-ils.actor.message.retrieve',
@@ -3385,11 +3265,9 @@ sub new_flesh_user {
     if($fetch_notes) {
         # grab notes (now actor.usr_message_penalty) that have not hit their stop_date
         # NOTE: This is a view that already filters out deleted messages that are not
-        # attached to a penalty, but the query is slow if we include deleted=f, so we
-        # post-filter that.  This counts both user messages and standing penalties, but
-        # linked ones are only counted once.
+        # attached to a penalty
         $user->notes([
-            grep { !$_->deleted or $_->deleted eq 'f' } @{ $e->search_actor_usr_message_penalty([
+            @{ $e->search_actor_usr_message_penalty([
                 {   usr => $id,
                     '-or' => [
                         {stop_date => undef},
index 5b9a3c7..3521685 100644 (file)
@@ -1223,15 +1223,15 @@ sub create_user_note {
     return $e->event unless
         my $card = $e->search_actor_card({barcode=>$user_barcode})->[0];
 
-    my $note = Fieldmapper::actor::usr_note->new;
+    my $note = Fieldmapper::actor::usr_message->new;
     $note->usr($card->usr);
     $note->title($title);
-    $note->creator($e->requestor->id);
+    $note->sending_lib($e->requestor->home_ou);
     $note->create_date('now');
     $note->pub('f');
-    $note->value($note_txt);
+    $note->message($note_txt);
 
-    $e->create_actor_usr_note($note) or return $e->event;
+    $e->create_actor_usr_message($note) or return $e->event;
     $e->commit;
     return OpenILS::Event->new('SUCCESS');
 }
index 7f3b9ae..62f34ce 100644 (file)
@@ -445,8 +445,8 @@ sub modify_from_fieldmapper {
     actor::org_unit::closed_date->has_a( org_unit => 'actor::org_unit' );
     actor::org_unit_setting->has_a( org_unit => 'actor::org_unit' );
 
-    actor::usr_note->has_a( usr => 'actor::user' );
-    actor::user->has_many( notes => 'actor::usr_note' );
+    actor::usr_message->has_a( usr => 'actor::user' );
+    actor::user->has_many( notes => 'actor::usr_message' );
 
     actor::user_standing_penalty->has_a( usr => 'actor::user' );
     actor::user->has_many( standing_penalties => 'actor::user_standing_penalty' );
index 4db37c2..6bf0481 100644 (file)
@@ -36,12 +36,12 @@ __PACKAGE__->columns( Primary => qw/id/ );
 __PACKAGE__->columns( Essential => qw/from_org to_org prox/ );
 
 #-------------------------------------------------------------------------------
-package actor::usr_note;
+package actor::usr_message;
 use base qw/actor/;
 
-__PACKAGE__->table( 'actor_usr_note' );
+__PACKAGE__->table( 'actor_usr_message' );
 __PACKAGE__->columns( Primary => qw/id/ );
-__PACKAGE__->columns( Essential => qw/usr title creator create_date value pub/ );
+__PACKAGE__->columns( Essential => qw/usr title message create_date deleted read_date sending_lib pub stop_date editor edit_date/ );
 
 #-------------------------------------------------------------------------------
 package actor::workstation;
index 196c46c..0d2b49c 100644 (file)
     actor::card->sequence( 'actor.card_id_seq' );
 
     #---------------------------------------------------------------------
-    package actor::usr_note;
+    package actor::usr_message;
     
-    actor::usr_note->table( 'actor.usr_note' );
-    actor::usr_note->sequence( 'actor.usr_note_id_seq' );
+    actor::usr_message->table( 'actor.usr_message' );
+    actor::usr_message->sequence( 'actor.usr_message_id_seq' );
 
     #---------------------------------------------------------------------
 
index e8b8efb..3a4359b 100644 (file)
@@ -2251,7 +2251,7 @@ SELECT  h.id, h.request_time, h.capture_time, h.fulfillment_time, h.checkin_time
         u.barred AS usr_barred, u.deleted AS usr_deleted, u.juvenile AS usr_juvenile,
         u.usrgroup AS usr_usrgroup, u.claims_returned_count AS usr_claims_returned_count,
         u.credit_forward_balance AS usr_credit_forward_balance, u.last_xact_id AS usr_last_xact_id,
-        u.alert_message AS usr_alert_message, u.create_date AS usr_create_date,
+        u.create_date AS usr_create_date,
         u.expire_date AS usr_expire_date, u.claims_never_checked_out_count AS usr_claims_never_checked_out_count,
         u.last_update_time AS usr_last_update_time,
 
@@ -2299,7 +2299,7 @@ SELECT  h.id, h.request_time, h.capture_time, h.fulfillment_time, h.checkin_time
         ru.barred AS rusr_barred, ru.deleted AS rusr_deleted, ru.juvenile AS rusr_juvenile,
         ru.usrgroup AS rusr_usrgroup, ru.claims_returned_count AS rusr_claims_returned_count,
         ru.credit_forward_balance AS rusr_credit_forward_balance, ru.last_xact_id AS rusr_last_xact_id,
-        ru.alert_message AS rusr_alert_message, ru.create_date AS rusr_create_date,
+        ru.create_date AS rusr_create_date,
         ru.expire_date AS rusr_expire_date, ru.claims_never_checked_out_count AS rusr_claims_never_checked_out_count,
         ru.last_update_time AS rusr_last_update_time,
 
index c26d8bf..43824cf 100644 (file)
@@ -20,6 +20,7 @@ use OpenILS::Application::Actor;
 use OpenILS::Const qw/:const/;
 use OpenILS::Utils::DateTime qw/:datetime/;
 use DateTime::Format::ISO8601;
+use OpenILS::Utils::Fieldmapper;
 my $U = 'OpenILS::Application::AppUtils';
 
 our (@ISA, @EXPORT_OK);
@@ -51,6 +52,9 @@ sub new {
 
     syslog("LOG_DEBUG", "OILS: new OpenILS Patron(%s => %s): searching...", $key, $patron_id);
 
+    my $idl = OpenSRF::Utils::SettingsClient->new->config_value("IDL");
+    Fieldmapper->import(IDL => $idl);
+
     my $e = OpenILS::SIP->editor();
     # Pass the authtoken, if any, to the editor so that we can use it
     # to fake a context org_unit for the csp.ignore_proximity in
@@ -1011,7 +1015,7 @@ sub block {
 
     syslog('LOG_INFO', "OILS: Blocking user %s", $u->card->barcode );
 
-    return $self if $u->card->active eq 'f';
+    return $self if $u->card->active eq 'f'; # TODO: don't think this will ever be true
 
     $e->xact_begin;    # connect and start a new transaction
 
@@ -1022,28 +1026,46 @@ sub block {
         return $self;
     }
 
-    # retrieve the un-fleshed user object for update
-    $u = $e->retrieve_actor_user($u->id);
-    my $note = $u->alert_message || "";
-    $note = "<sip> CARD BLOCKED BY SELF-CHECK MACHINE. $blocked_card_msg</sip>\n$note"; # XXX Config option
-    $note =~ s/\s*$//;  # kill trailng whitespace
-    $u->alert_message($note);
+    # Use the ws_ou or home_ou of the authsession user, if any, as a
+    # context org_unit for the created penalty
+    my $here;
+    if ($e->authtoken()) {
+        my $auth_usr = $e->checkauth();
+        if ($auth_usr) {
+            $here = $auth_usr->ws_ou() || $auth_usr->home_ou();
+        }
+    }
 
-    if( ! $e->update_actor_user($u) ) {
-        syslog('LOG_ERR', "OILS: Block: patron alert update failed: %s", $e->event->{textcode});
+    my $penalty = Fieldmapper::actor::user_standing_penalty->new;
+    $penalty->usr( $u->id );
+    $penalty->org_unit( $here );
+    $penalty->set_date('now');
+    $penalty->staff( $e->checkauth()->id() );
+    $penalty->standing_penalty(20); # ALERT_NOTE
+
+    my $note = "<sip> CARD BLOCKED BY SELF-CHECK MACHINE. $blocked_card_msg</sip>\n"; # XXX Config option
+    my $msg = {
+      title => 'SIP',
+      message => $note
+    };
+    my $penalty_result = $U->simplereq(
+      'open-ils.actor',
+      'open-ils.actor.user.penalty.apply', $e->authtoken, $penalty, $msg);
+    if( my $result_code = $U->event_code($penalty_result) ) {
+        my $textcode = $penalty_result->{textcode};
+        syslog('LOG_ERR', "OILS: Block: patron penalty failed: %s", $textcode);
         $e->rollback; # rollback + disconnect
         return $self;
     }
 
-    # stay in synch
-    $self->{user}->alert_message( $note );
-
-    $e->commit; # commits and disconnects
+    $e->commit;
     return $self;
 }
 
 # Testing purposes only
 sub enable {
+    # TODO: we never actually enter this sub if the patron's card is not active
+    # For now, to test the removal of the SIP penalties, manually activate the card first
     my ($self, $card_retained) = @_;
     $self->{screen_msg} = "All privileges restored.";
 
@@ -1053,33 +1075,33 @@ sub enable {
 
     syslog('LOG_INFO', "OILS: Unblocking user %s", $u->card->barcode );
 
-    return $self if $u->card->active eq 't';
-
     $e->xact_begin;    # connect and start a new transaction
 
-    $u->card->active('t');
-    if( ! $e->update_actor_card($u->card) ) {
-        syslog('LOG_ERR', "OILS: Unblock card update failed: %s", $e->event->{textcode});
-        $e->rollback; # rollback + disconnect
-        return $self;
+    if ($u->card->active eq 'f') {
+        $u->card->active('t');
+        if( ! $e->update_actor_card($u->card) ) {
+            syslog('LOG_ERR', "OILS: Unblock card update failed: %s", $e->event->{textcode});
+            $e->rollback; # rollback + disconnect
+            return $self;
+        }
     }
 
-    # retrieve the un-fleshed user object for update
-    $u = $e->retrieve_actor_user($u->id);
-    my $note = $u->alert_message || "";
-    $note =~ s#<sip>.*</sip>##;
-    $note =~ s/^\s*//;  # kill leading whitespace
-    $note =~ s/\s*$//;  # kill trailng whitespace
-    $u->alert_message($note);
+    # look for sip related penalties
+    my $sip_penalties = $e->search_actor_usr_message_penalty({ usr => $u->id, title => 'SIP', stop_date => undef });
 
-    if( ! $e->update_actor_user($u) ) {
-        syslog('LOG_ERR', "OILS: Unblock: patron alert update failed: %s", $e->event->{textcode});
-        $e->rollback; # rollback + disconnect
-        return $self;
+    if (scalar(@{ $sip_penalties }) == 0) {
+        syslog('LOG_INFO', 'OILS: Unblock: no SIP penalties to archive');
     }
 
-    # stay in synch
-    $self->{user}->alert_message( $note );
+    foreach my $aump (@{ $sip_penalties }) {
+        my $penalty = $e->retrieve_actor_user_standing_penalty( $aump->ausp_id() );
+        $penalty->stop_date('now');
+        if ( ! $e->update_actor_user_standing_penalty($penalty) ) {
+            syslog('LOG_ERR', "OILS: Unblock: patron alert update failed: %s", $e->event->{textcode});
+            $e->rollback; # rollback + disconnect
+            return $self;
+        }
+    }
 
     $e->commit; # commits and disconnects
     return $self;
index b1f69ec..4722e23 100644 (file)
@@ -79,7 +79,7 @@ BEGIN
         UPDATE actor.usr_address SET usr = dest_usr WHERE usr = src_usr;
     END IF;
 
-    UPDATE actor.usr_note SET usr = dest_usr WHERE usr = src_usr;
+    UPDATE actor.usr_message SET usr = dest_usr WHERE usr = src_usr;
     -- dupes are technically OK in actor.usr_standing_penalty, should manually delete them...
     UPDATE actor.usr_standing_penalty SET usr = dest_usr WHERE usr = src_usr;
     PERFORM actor.usr_merge_rows('actor.usr_org_unit_opt_in', 'usr', src_usr, dest_usr);
@@ -488,13 +488,14 @@ BEGIN
        UPDATE actor.usr_address SET replaces = NULL
                WHERE usr = src_usr AND replaces IS NOT NULL;
        DELETE FROM actor.usr_address WHERE usr = src_usr;
-       DELETE FROM actor.usr_note WHERE usr = src_usr;
-       UPDATE actor.usr_note SET creator = dest_usr WHERE creator = src_usr;
        DELETE FROM actor.usr_org_unit_opt_in WHERE usr = src_usr;
        UPDATE actor.usr_org_unit_opt_in SET staff = dest_usr WHERE staff = src_usr;
        DELETE FROM actor.usr_setting WHERE usr = src_usr;
        DELETE FROM actor.usr_standing_penalty WHERE usr = src_usr;
+       UPDATE actor.usr_message SET title = 'purged', message = 'purged', read_date = NOW() WHERE usr = src_usr;
+       DELETE FROM actor.usr_message WHERE usr = src_usr;
        UPDATE actor.usr_standing_penalty SET staff = dest_usr WHERE staff = src_usr;
+       UPDATE actor.usr_message SET editor = dest_usr WHERE editor = src_usr;
 
        -- asset.*
        UPDATE asset.call_number SET creator = dest_usr WHERE creator = src_usr;
@@ -850,7 +851,6 @@ BEGIN
                        claims_returned_count = DEFAULT,
                        credit_forward_balance = DEFAULT,
                        last_xact_id = DEFAULT,
-                       alert_message = NULL,
                        pref_prefix = NULL,
                        pref_first_given_name = NULL,
                        pref_second_given_name = NULL,
diff --git a/Open-ILS/src/support-scripts/test-scripts/notes.pl b/Open-ILS/src/support-scripts/test-scripts/notes.pl
deleted file mode 100755 (executable)
index 0bbbc15..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-#!/usr/bin/perl
-require '../oils_header.pl';
-use vars qw/ $user $authtoken /;    # FIXME: $user not used?
-use strict; use warnings;
-use Time::HiRes qw/time/;
-use Data::Dumper;
-use OpenSRF::Utils::JSON;
-
-#-----------------------------------------------------------------------------
-# Creates, retrieves and deletes notes
-#-----------------------------------------------------------------------------
-
-err("usage: $0 <config> <username> <password> <patronid> <title> <text>") unless $ARGV[5];
-
-my $config   = shift;  # - bootstrap config
-my $username = shift;  # - oils login username
-my $password = shift;  # - oils login password
-my $patronid = shift;
-my $title    = shift;
-my $text     = shift;
-
-
-sub go {
-       osrf_connect($config);
-       oils_login($username, $password);
-       create_note();
-       retrieve_notes();
-       delete_notes();
-       oils_logout();
-}
-go();
-
-
-
-#-----------------------------------------------------------------------------
-# 
-#-----------------------------------------------------------------------------
-my @created_ids;
-sub create_note {
-
-       for(0..9) {
-               my $note = Fieldmapper::actor::usr_note->new;
-       
-               $note->usr($patronid);
-               $note->title($title);
-               $note->value($text);
-               $note->pub(0);
-       
-               my $id = simplereq(
-                       'open-ils.actor', 
-                       'open-ils.actor.note.create', $authtoken, $note );
-       
-               oils_event_die($id);
-               printl("created new note $id");
-               push(@created_ids, $id);
-       }
-
-       return 1;
-}
-
-sub retrieve_notes {
-
-       my $notes = simplereq(
-               'open-ils.actor',
-               'open-ils.actor.note.retrieve.all', $authtoken, 
-               { patronid => $patronid} );
-
-       oils_event_die($notes);
-
-       for my $n (@$notes) {
-               printl("received note:");
-               printl("\t". $n->creator);
-               printl("\t". $n->usr);
-               printl("\t". $n->title);
-               printl("\t". $n->value);
-       }
-}
-
-sub delete_notes {
-       for(@created_ids) {
-               my $stat = simplereq(
-                       'open-ils.actor', 
-                       'open-ils.actor.note.delete', $authtoken, $_);
-               oils_event_die($stat);
-               printl("deleted note $_");
-       }
-}
-
diff --git a/Open-ILS/src/templates/staff/circ/patron/t_new_note_dialog.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_new_note_dialog.tt2
deleted file mode 100644 (file)
index 6e9919a..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-<form ng-submit="ok(args)" role="form">
-    <div class="modal-header">
-      <button type="button" class="close" ng-click="cancel()" 
-        aria-hidden="true">&times;</button>
-      <h4 class="modal-title">[% l('Create a new note') %]</h4>
-    </div>
-    <div class="modal-body">
-      <div class="form-group row">
-        <div class="col-md-3">
-          <label for="note-title">[% l('Title') %]</label>
-        </div>
-        <div class="col-md-9">
-          <input type="text" class="form-control" focus-me='focusNote' required
-            id="note-title" ng-model="args.title" placeholder="[% l('Title...') %]"/>
-        </div>
-      </div>
-      <div class="form-group row">
-        <div class="col-md-3">
-          <label for="note-pub">[% l('Patron Visible?') %]</label>
-        </div>
-        <div class="col-md-9">
-          <input type="checkbox" class="checkbox" 
-            id="note-pub" ng-model="args.pub"/>
-        </div>
-      </div>
-      <div class="form-group row">
-        <div class="col-md-3">
-          <label for="note-value">[% l('Value') %]</label>
-        </div>
-        <div class="col-md-9">
-          <textarea class="form-control" required
-            id="note-value" ng-model="args.value" placeholder="[% l('Value...') %]">
-          </textarea>
-        </div>
-      </div>
-    </div>
-    <div class="modal-footer">
-      <div class="col-md-2">
-        <input type="text" class="form-control" ng-hide="!require_initials"
-          id="initials" ng-model="args.initials" placeholder="[% l('Initials') %]" 
-          ng-required="require_initials" />
-      </div>
-      <input type="submit" class="btn btn-primary" value="[% l('OK') %]"/>
-      <button class="btn btn-warning" ng-click="cancel()">[% l('Cancel') %]</button>
-    </div>
-  </div> <!-- modal-content -->
-</form>
diff --git a/Open-ILS/src/templates/staff/circ/patron/t_notes.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_notes.tt2
deleted file mode 100644 (file)
index 0fe8693..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-<div class="row">
-  <div class="col-md-12">
-    <button class="btn btn-default" ng-click="newNote()">
-      [% l('Add New Note') %]
-    </button>
-  </div>
-</div>
-
-<div class="row pad-vert" ng-repeat="note in notes">
-  <div class="col-md-12">
-    <div class="row">
-      <div class="col-md-6 strong-text">{{note.title()}}</div>
-      <div class="col-md-6">
-        <div class="pull-right">
-          <span class="pad-horiz alert alert-warning" ng-if="note.pub() == 't'">[% l('Patron Visible') %]</span>
-          <span class="pad-horiz alert alert-info" ng-if="note.pub() == 'f'">[% l('Staff Only') %]</span>
-          <span class="pad-horiz">{{note.create_date() | date:$root.egDateAndTimeFormat}}</span>
-          <span>[% l('Created by [_1]', '{{note.creator().usrname()}}') %]</span>
-        </div>
-      </div>
-    </div>
-    <div class="row">
-      <!-- hmm, not sure why the margin-left is needed.. the well? -->
-      <div class="col-md-12 well" style="margin-left:12px">
-        <div class="row">
-          <div class="col-md-8">
-            <div class="">{{note.value()}}</div>
-          </div>
-          <div class="col-md-4">
-            <div class="pull-right">
-              <button ng-click="printNote(note)" class="btn btn-default">
-                [% l('Print') %]
-              </button>
-              <button ng-click="deleteNote(note)" class="btn btn-warning">
-                [% l('Delete') %]
-              </button>
-            </div>
-          </div>
-        </div>
-      </div>
-    </div>
-  </div>
-  <hr/>
-</div>
diff --git a/Open-ILS/src/templates/staff/share/print_templates/t_patron_note.tt2 b/Open-ILS/src/templates/staff/share/print_templates/t_patron_note.tt2
deleted file mode 100644 (file)
index bc6c7c7..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-<!--
-Template for printing a patron note. Fields include:
-
-* note.usr.family_name
-* note.usr.first_name
-* note.usr.second_given_name
-* note.usr.card.barcode
-* note.create_date
-
--->
-<h3>[% l(
-  'Pertaining to [_1], [_2] [_3] : [_4]',
-  '{{note.usr.family_name}}',
-  '{{note.usr.first_given_name}}',
-  '{{note.usr.second_given_name}}',
-  '{{note.usr.card.barcode}}') %]</h3>
-
-<p>[% l('Created on [_1]', '{{note.create_date | date:$root.egDateAndTimeFormat}}') %]</p>
-<b>{{note.title}}</b>
-<br/>
-<p>{{note.value}}</p>
index 24b8dc7..0c4268a 100644 (file)
@@ -181,12 +181,6 @@ angular.module('egPatronApp', ['ngRoute', 'ui.bootstrap', 'egUserBucketMod',
         resolve : resolver
     });
 
-    $routeProvider.when('/circ/patron/:id/notes', {
-        templateUrl: './circ/patron/t_notes',
-        controller: 'PatronNotesCtrl',
-        resolve : resolver
-    });
-
     $routeProvider.when('/circ/patron/:id/triggered_events', {
         templateUrl: './circ/patron/t_triggered_events',
         controller: 'PatronTriggeredEventsCtrl',
@@ -1184,83 +1178,6 @@ function($scope,  $q , $routeParams , $location , egCore , patronSvc,  bucketSvc
 
 }])
 
-.controller('PatronNotesCtrl',
-       ['$scope','$filter','$routeParams','$location','egCore','patronSvc','$uibModal',
-        'egConfirmDialog',
-function($scope,  $filter , $routeParams , $location , egCore , patronSvc , $uibModal,
-         egConfirmDialog) {
-    $scope.initTab('other', $routeParams.id);
-    var usr_id = $routeParams.id;
-
-    // fetch the notes
-    function refreshPage() {
-        $scope.notes = [];
-        egCore.pcrud.search('aun', 
-            {usr : usr_id}, 
-            {flesh : 1, flesh_fields : {aun : ['creator']}}, 
-            {authoritative : true})
-        .then(null, null, function(note) {
-            $scope.notes.push(note);
-        });
-    }
-
-    // open the new-note dialog and create the note
-    $scope.newNote = function() {
-        $uibModal.open({
-            templateUrl: './circ/patron/t_new_note_dialog',
-            backdrop: 'static',
-            controller: 
-                ['$scope', '$uibModalInstance',
-            function($scope, $uibModalInstance) {
-                $scope.focusNote = true;
-                $scope.args = {};
-                $scope.require_initials = egCore.env.aous['ui.staff.require_initials.patron_info_notes'];
-                $scope.ok = function(count) { $uibModalInstance.close($scope.args) }
-                $scope.cancel = function () { $uibModalInstance.dismiss() }
-            }],
-        }).result.then(
-            function(args) {
-                if (!args.value) return;
-                var note = new egCore.idl.aun();
-                note.usr(usr_id);
-                note.title(args.title);
-                note.value(args.value);
-                note.pub(args.pub ? 't' : 'f');
-                note.creator(egCore.auth.user().id());
-                if (args.initials) 
-                    note.value(note.value() + ' [' + args.initials + ']');
-                egCore.pcrud.create(note).then(function() {refreshPage()});
-            }
-        );
-    }
-
-    // delete the selected note
-    $scope.deleteNote = function(note) {
-        egConfirmDialog.open(
-            egCore.strings.PATRON_NOTE_DELETE_CONFIRM_TITLE, egCore.strings.PATRON_NOTE_DELETE_CONFIRM,
-            {ok : function() {
-                egCore.pcrud.remove(note).then(function() {refreshPage()});
-            },
-            note_title : note.title(),
-            create_date : note.create_date()
-        });
-    }
-
-    // print the selected note
-    $scope.printNote = function(note) {
-        var hash = egCore.idl.toHash(note);
-        hash.usr = egCore.idl.toHash($scope.patron());
-        egCore.print.print({
-            context : 'default', 
-            template : 'patron_note', 
-            scope : {note : hash}
-        });
-    }
-
-    // perform the initial note fetch
-    refreshPage();
-}])
-
 .controller('PatronGroupCtrl',
        ['$scope','$routeParams','$q','$window','$timeout','$location','egCore',
         'patronSvc','$uibModal','egPromptDialog','egConfirmDialog',
index 1a62232..1798e3d 100644 (file)
@@ -387,7 +387,6 @@ var CHECK_USERNAME                          = 'open-ils.actor:open-ils.actor.username.exists';
 var FETCH_CIRC_BY_ID                           = 'open-ils.circ:open-ils.circ.retrieve';
 var FETCH_MR_DESCRIPTORS               = 'open-ils.search:open-ils.search.metabib.record_to_descriptors';
 var FETCH_HIGHEST_PERM_ORG             = 'open-ils.actor:open-ils.actor.user.perm.highest_org.batch';
-var FETCH_USER_NOTES                           = 'open-ils.actor:open-ils.actor.note.retrieve.all';
 var FETCH_ORG_BY_SHORTNAME             = 'open-ils.actor:open-ils.actor.org_unit.retrieve_by_shortname';
 var FETCH_BIB_IDS_BY_BARCODE = 'open-ils.search:open-ils.search.multi_home.bib_ids.by_barcode';
 var FETCH_ORG_SETTING = 'open-ils.actor:open-ils.actor.ou_setting.ancestor_default';