LP#1778571 Fix logic error converting JS bool to DB bool user/rsteed/lp1778571_copy_note_public_flag_fix
authorRemington Steed <rjs7@calvin.edu>
Thu, 25 Oct 2018 12:53:32 +0000 (08:53 -0400)
committerRemington Steed <rjs7@calvin.edu>
Thu, 25 Oct 2018 13:59:32 +0000 (09:59 -0400)
commita3fb88d8837dd4695b4c902691fa1634741a9c72
tree943b62e95b80e1ee30c25658ebf77ecd3ec7e174
parenta4eaea808ed3bded76fd6b70adcb8562a282d41b
LP#1778571 Fix logic error converting JS bool to DB bool

Two minor bugs in the Copy Notes editor had the same cause in two
separate places. The cause was forgetting to convert the checkbox status
(a JavaScript bool) to the correct database format ('t' or 'f'). The
resulting symptoms were buggy behavior related to the state of the
"Public Note" checkbox. This commit addresses both cases mentioned in
the bug report and comments.

To test the buggy behavior:
1. Edit an item (e.g. click the "Edit" link from the client OPAC view).
2. Click the "Item Notes" button (near the bottom of the editor).
3. Add a new note and check the "Public Note" box.
4. Click "OK".
5. Click "Item Notes" again and notice that the "Public Note" box on your
   new note is no longer checked. (That's bug #1.)
6. Check "Public Note" again, click "OK", and click "Save & Exit".
7. Edit the same item again. Click "Item Notes".
8. Your note should correctly have the "Public Note" checkbox checked.
9. Uncheck the box and click "OK". Click "Save & Exit".
10. Edit the same item. Click "Item Notes".
11. Notice that your change didn't save. The "Public Note" checkbox is
    still checked. (That's bug #2.)

To test the fixes:
- Clear your browser cache.
- Repeat the steps above, noticing that:
  - At step 5, the new note correctly has the "Public Note" checkbox
    checked.
  - At step 11, the edited note correctly has the "Public Note" checkbox
    unchecked.

NOTE: Testing requires clearing the browser cache, since the
t_copy_notes.tt2 file is fetched asynchronously by AngularJS.

Signed-off-by: Remington Steed <rjs7@calvin.edu>
Open-ILS/src/templates/staff/cat/volcopy/t_copy_notes.tt2
Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js