webstaff: Copy note bug fixing
authorMike Rylander <mrylander@gmail.com>
Wed, 2 Sep 2015 20:43:16 +0000 (16:43 -0400)
committerJason Stephenson <jstephenson@mvlc.org>
Mon, 14 Sep 2015 19:44:18 +0000 (15:44 -0400)
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/AssetCommon.pm
Open-ILS/src/templates/staff/cat/volcopy/t_copy_notes.tt2

index 7b0ea44..8d642b3 100644 (file)
@@ -228,7 +228,6 @@ sub update_copy_notes {
     my($class, $editor, $copy) = @_;
 
     return undef if $copy->isdeleted;
-    return undef unless $copy->ischanged or $copy->isnew;
 
     my $evt;
     my $incoming_notes = $copy->notes;
@@ -245,9 +244,9 @@ sub update_copy_notes {
             $new_note->creator( $incoming_note->creator || $editor->requestor->id );
             $incoming_note = $editor->create_asset_copy_note($new_note)
                 or return $editor->event;
-        } elif ($incoming_note->ischanged) {
+        } elsif ($incoming_note->ischanged) {
             $incoming_note = $editor->update_asset_copy_note($incoming_note)
-        } elif ($incoming_note->isdeleted) {
+        } elsif ($incoming_note->isdeleted) {
             $incoming_note = $editor->delete_asset_copy_note($incoming_note->id)
         }
     
@@ -360,11 +359,17 @@ sub update_fleshed_copies {
         $copy->location( $copy->location->id ) if ref($copy->location);
         $copy->circ_lib( $copy->circ_lib->id ) if ref($copy->circ_lib);
         
+        my $parts = $copy->parts;
+        $copy->clear_parts;
+
         my $sc_entries = $copy->stat_cat_entries;
         $copy->clear_stat_cat_entries;
 
-        my $parts = $copy->parts;
-        $copy->clear_parts;
+        my $sc_entries = $copy->stat_cat_entries;
+        $copy->clear_stat_cat_entries;
+
+        my $notes = $copy->notes;
+        $copy->clear_notes;
 
         if( $copy->isdeleted ) {
             $evt = $class->delete_copy($editor, $override, $vol, $copy, $retarget_holds, $force_delete_empty_bib);
@@ -382,9 +387,12 @@ sub update_fleshed_copies {
 
         $copy->stat_cat_entries( $sc_entries );
         $evt = $class->update_copy_stat_entries($editor, $copy, $delete_stats);
+
         $copy->parts( $parts );
         # probably okay to use $delete_stats here for simplicity
         $evt = $class->update_copy_parts($editor, $copy, $delete_stats, $create_parts);
+
+        $copy->notes( $notes );
         $evt = $class->update_copy_notes($editor, $copy);
         return $evt if $evt;
     }
index 7bd26a7..8b875f0 100644 (file)
@@ -52,7 +52,7 @@
         </div>
       </div>
 
-      <div class="row" ng-repeat="n in note_list" ng-init="pub = n.pub(); title = n.title(); value = n.value(); deleted = n.isdeleted()">
+      <div class="row" ng-repeat="n in note_list" ng-init="pub = n.pub() == 't'; title = n.title(); value = n.value(); deleted = n.isdeleted()">
         <div class="col-md-12">
           <div class="row">
             <div class="col-md-6">