// Avoid updating checkout counts when a checkout turns
// into a renewal via auto_renew.
- if (!co_resp.auto_renew) {
+ if (!co_resp.auto_renew && !params.noncat) {
patronSvc.patron_stats.checkouts.out++;
patronSvc.patron_stats.checkouts.total_out++;
}
row_item.title = egCore.env.cnct.map[params.noncat_type].name();
row_item.noncat_count = params.noncat_count;
row_item.circ = new egCore.idl.circ();
- row_item.circ.due_date(co_resp.evt.payload.noncat_circ.duedate());
+ row_item.circ.due_date(co_resp.evt[0].payload.noncat_circ.duedate());
+ // Non-cat circs don't return the full list of circs.
+ // Refresh the list of non-cat circs from the server.
+ patronSvc.getUserNonCats(patronSvc.current.id());
}
}
return service.renew(params, options);
}
- return service.flesh_response_data('checkout', evt, params, options)
+ var action = params.noncat ? 'noncat_checkout' : 'checkout';
+
+ return service.flesh_response_data(action, evt, params, options)
.then(function() {
return service.handle_checkout_resp(evt, params, options);
})
.then(function(final_resp) {
- return service.munge_resp_data(final_resp,'checkout',method)
+ return service.munge_resp_data(final_resp,action,method)
})
});
});
}
egWorkLog.record(
- worklog_action == 'checkout'
+ (worklog_action == 'checkout' || worklog_action == 'noncat_checkout')
? egCore.strings.EG_WORK_LOG_CHECKOUT
: (worklog_action == 'renew'
? egCore.strings.EG_WORK_LOG_RENEW
}
// TODO: renewal responses should include the patron
- if (!payload.patron && payload.circ) {
- promises.push(
- egCore.pcrud.retrieve('au', payload.circ.usr())
- .then(function(user) {payload.patron = user})
- );
+ if (!payload.patron) {
+ var user_id;
+ if (payload.circ) user_id = payload.circ.usr();
+ if (payload.noncat_circ) user_id = payload.noncat_circ.patron();
+ if (user_id) {
+ promises.push(
+ egCore.pcrud.retrieve('au', user_id)
+ .then(function(user) {payload.patron = user})
+ );
+ }
}
// extract precat values
entry['item_id'] = data.response.data.acp.id();
entry['patron_id'] = data.response.data.au.id();
}
+ if (data.action == 'noncat_checkout') {
+ entry['user'] = data.response.data.au.family_name();
+ entry['patron_id'] = data.response.data.au.id();
+ }
if (data.action == 'renew') {
entry['item'] = data.response.params.copy_barcode;
entry['user'] = data.response.data.au.family_name();