LP1904036 Patron edit stat cat create + delete handled OK
authorBill Erickson <berickxx@gmail.com>
Tue, 7 Jun 2022 16:11:02 +0000 (12:11 -0400)
committerGalen Charlton <gmc@equinoxOLI.org>
Fri, 28 Oct 2022 00:13:42 +0000 (20:13 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Jane Sandberg <js7389@princeton.edu>
Signed-off-by: Galen Charlton <gmc@equinoxOLI.org>
Open-ILS/src/eg2/src/app/staff/circ/patron/edit.component.ts

index 57cf8f9..18667f3 100644 (file)
@@ -901,7 +901,17 @@ export class EditComponent implements OnInit, AfterViewInit {
                 map.ischanged(true);
                 map.isdeleted(false);
             } else {
-                map.isdeleted(true);
+                if (map.isnew()) {
+                    // Deleting a stat cat that was created during this
+                    // edit session just means removing it from the list
+                    // of maps to consider.
+                    this.patron.stat_cat_entries(
+                        this.patron.stat_cat_entries()
+                            .filter(m => m.stat_cat() !== cat.id())
+                    );
+                } else {
+                    map.isdeleted(true);
+                }
             }
         } else {
             map = this.idl.create('actscecm');