Comment 3 for bug 1832735

Revision history for this message
Josh Stompro (u-launchpad-stompro-org) wrote :

Confirmed in EG 3.3.4

In the browser console, there is an error when the ok button is pressed in the add alert popup.

TypeError: Cannot read property 'push' of undefined
    at app.js:2310

Which is in app.js

 a.ack_time(null);
                            a.alert_type(
                                $scope.alert_types.filter(function(at) {
                                    return at.id() == copy_alert.alert_type;
                                })[0]
                            );
----> cp.copy_alerts().push( a );
                        });

So cp.copy_alerts() isn't defined when it is called.

I noticed that the copy_alert_dialog() compared to the copy_note_dialog() function is missing a bit like this.

2126 angular.forEach(copy_list, function (cp) {
2127 if (!angular.isArray(cp.notes())) cp.notes([]); <----
2128 var n = new egCore.idl.acpn();
2129 n.isnew(1);

copy_alert_dialog() doesn't seem to have anything defining an empty cp.copy_alert([]) like the copy notes do. So maybe adding in something like "if (!angular.isArray(cp.copy_alerts())) cp.copy_alerts([]);" after the forEach would do the trick.

                     if (typeof(copy_alert.note) != 'undefined' &&
2302 copy_alert.note != '') {
2303 angular.forEach(copy_list, function (cp) {
2304 var a = new egCore.idl.aca();
2305 a.isnew(1);
2306 a.create_staff(copy_alert.create_staff);