Bug 25473

Summary: Can't add order from MARC file, save button does nothing
Product: Koha Reporter: Victor Grousset/tuxayo <victor>
Component: AcquisitionsAssignee: Owen Leonard <oleonard>
Status: CLOSED FIXED QA Contact: Jonathan Druart <jonathan.druart>
Severity: major    
Priority: P5 - low CC: aleisha, jonathan.druart, martin.renvoize, oleonard
Version: master   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25563
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
20.05.00, 19.11.07, 19.05.12
Bug Depends on: 22734    
Bug Blocks:    
Attachments: Bug 25473: Move JavaScript out of the footer of addorderiso2709.tt
Bug 25473: Move JavaScript out of the footer of addorderiso2709.tt
Bug 25473: Move JavaScript out of the footer of addorderiso2709.tt

Description Victor Grousset/tuxayo 2020-05-13 03:35:59 UTC
tl;dr it seems form error handling can break it. (when not ticking a record to import)

== Test plan ==
1. stage a marc record
2. acquisitions: have a basket
3. click on "Add to basket"
4. "From a staged file"
5. "Add orders" button
6. Optional open JavaScript console
   - You see twice the error "$ is not defined"
   - not sure if related though
7. Don't tick the record
8. Save (at least try)
9. You should see an expected error message
10. Tick the record
11. Choose a fund
12. Save (at least try)
13. Nothing happens :<
Comment 1 Jonathan Druart 2020-05-14 10:59:23 UTC
So basically we have the plugin (cataloguing/value_builder/dateaccessioned.pl) that is using the jQuery selector '$' but it is not defined yet as we have it at the bottom (jsinclude).

This can be a serious problems for other pages as well.
Comment 2 Owen Leonard 2020-05-14 11:54:22 UTC
Caused by 22734 in which I moved JavaScript to the footer, ignoring the work I did in Bug 21989, in which I moved JavaScript OUT of the footer because it broke JavaScript.
Comment 3 Owen Leonard 2020-05-14 12:17:30 UTC
Created attachment 104878 [details] [review]
Bug 25473: Move JavaScript out of the footer of addorderiso2709.tt

This patch undoes the move of the JavaScript block to the footer made in
Bug 22734. The item information tab can include embedded JavaScript for
cataloging plugins, and these don't currently work with JS in the
footer.

To test, apply the patch and test the JavaScript driven features of the
"Add to basket from a staged file" page:

- Acquisitions -> Vendor -> Basket -> Add to basket from a staged file
  - MARC and Card previews, select all/clear all
  - Item information tab: Cataloging plugins for fields like
    date acquired, barcode
  - Default accounting details tab: Show inactive control
Comment 4 Victor Grousset/tuxayo 2020-05-14 22:37:55 UTC
After testing.

== Good news ==
No more JS errors :D


== Some things couldn't be tested. ==

> Item information tab: Cataloging plugins for fields like
    date acquired, barcode

- date acquired ok
- barcode: nothing happens, no error. Does it depends on other data/config?

> Default accounting details tab: Show inactive control

I couldn't find how to make a fund inactive ^^"


== Bad news ==
test plan of comment 0 fails
Comment 5 Katrin Fischer 2020-05-15 06:27:16 UTC
> > Item information tab: Cataloging plugins for fields like
>     date acquired, barcode
> 
> - date acquired ok
> - barcode: nothing happens, no error. Does it depends on other data/config?

This one depends on the AutoBarcode system preference. You possible need to activate the feature first - it's off by default.

> > Default accounting details tab: Show inactive control
> 
> I couldn't find how to make a fund inactive ^^"

Go to: Acquisition > Budets
Edit the budget to set it not active (first checkbox, not the locked one)
Comment 6 Victor Grousset/tuxayo 2020-05-15 23:21:10 UTC
Thanks Katrin :)


Issue of comment 0 is still happening unfortunately.
Comment 7 Victor Grousset/tuxayo 2020-05-15 23:22:58 UTC
(but the rest is fixed, nice catch Owen for the cataloging plugins, they indeed where broken)
Comment 8 Jonathan Druart 2020-05-21 09:44:14 UTC
(In reply to Victor Grousset/tuxayo from comment #6)
> Issue of comment 0 is still happening unfortunately.

This is something different, see bug 25563.
Comment 9 Nick Clemens 2020-05-21 10:21:13 UTC
Created attachment 105174 [details] [review]
Bug 25473: Move JavaScript out of the footer of addorderiso2709.tt

This patch undoes the move of the JavaScript block to the footer made in
Bug 22734. The item information tab can include embedded JavaScript for
cataloging plugins, and these don't currently work with JS in the
footer.

To test, apply the patch and test the JavaScript driven features of the
"Add to basket from a staged file" page:

- Acquisitions -> Vendor -> Basket -> Add to basket from a staged file
  - MARC and Card previews, select all/clear all
  - Item information tab: Cataloging plugins for fields like
    date acquired, barcode
  - Default accounting details tab: Show inactive control

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 10 Katrin Fischer 2020-05-21 11:12:14 UTC
I guess this can be safely ignored here? :)

FAIL	  js_in_body
A <script> tag found inside head, must be moved to the body (see bug 17858)
Comment 11 Katrin Fischer 2020-05-21 11:16:34 UTC
Created attachment 105178 [details] [review]
Bug 25473: Move JavaScript out of the footer of addorderiso2709.tt

This patch undoes the move of the JavaScript block to the footer made in
Bug 22734. The item information tab can include embedded JavaScript for
cataloging plugins, and these don't currently work with JS in the
footer.

To test, apply the patch and test the JavaScript driven features of the
"Add to basket from a staged file" page:

- Acquisitions -> Vendor -> Basket -> Add to basket from a staged file
  - MARC and Card previews, select all/clear all
  - Item information tab: Cataloging plugins for fields like
    date acquired, barcode
  - Default accounting details tab: Show inactive control

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 12 Victor Grousset/tuxayo 2020-05-21 16:47:30 UTC
(In reply to Jonathan Druart from comment #8)
> (In reply to Victor Grousset/tuxayo from comment #6)
> > Issue of comment 0 is still happening unfortunately.
> 
> This is something different, see bug 25563.

That was the initial bug report and the title this bug still reflects it XD

Anyway, thank you that you moved to bug 25563.

So, everything go fixed in the end 🥳🥳 Thanks all!
Comment 13 Martin Renvoize 2020-05-22 08:34:06 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 14 Aleisha Amohia 2020-06-12 01:24:37 UTC
backported to 19.11.x for 19.11.07
Comment 15 Victor Grousset/tuxayo 2020-06-12 21:19:44 UTC
Backported to 19.05.x branch for 19.05.12