webstaff: fix updating stat cats in the volume/copy editor
authorGalen Charlton <gmc@esilibrary.com>
Thu, 28 Jan 2016 19:13:27 +0000 (14:13 -0500)
committerKathy Lussier <klussier@masslnc.org>
Tue, 2 Feb 2016 19:58:54 +0000 (14:58 -0500)
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js

index f52e88b..760a56b 100644 (file)
@@ -891,26 +891,25 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore ,
                         );
     
                         if (newval) {
-                            var e = new egCore.idl.ascecm();
+                            var e = new egCore.idl.asce();
                             e.isnew( 1 );
-                            e.owning_copy( cp.id() );
                             e.stat_cat( id );
-                            e.stat_cat_entry( newval );
+                            e.id(newval);
 
                             cp.stat_cat_entries(
-                                cp.stat_cat_entries().concat([ e ])
+                                cp.stat_cat_entries() ?
+                                    cp.stat_cat_entries().concat([ e ]) :
+                                    [ e ]
                             );
 
                         }
 
-                        cp.stat_cat_entries( // trim out ephemeral deleted ones
+                        // trim out all deleted ones; the API used to
+                        // do the update doesn't actually consult
+                        // isdeleted for stat cat entries
+                        cp.stat_cat_entries(
                             cp.stat_cat_entries().filter(function (e) {
-                                if (Boolean(e.isnew())) {
-                                    if (Boolean(e.isdeleted())) {
-                                        return false;
-                                    }
-                                }
-                                return true;
+                                return !Boolean(e.isdeleted());
                             })
                         );
    
@@ -1238,7 +1237,7 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore ,
                                 });
 
                                 if (right_sc.length > 0) {
-                                    value_hash[right_sc[0].stat_cat_entry()] = right_sc[0].stat_cat_entry();
+                                    value_hash[right_sc[0].id()] = right_sc[0].id();
                                 } else {
                                     none = true;
                                 }