<!-- invalidate buttons -->
[% IF field.match('phone') OR field.match('email') %]
- <button ng-show="patron.[% field %] && !patron.isnew" class="btn btn-default"
- ng-click="">[% l('Invalidate') %]</button>
+ <button ng-show="patron.[% field %] && !patron.isnew"
+ class="btn btn-default"
+ ng-click="invalidate_field('[% field %]')">
+ [% l('Invalidate') %]
+ </button>
[% END %]
<!-- example strings -->
});
}
+ service.invalidate_field = function(patron, field) {
+ console.log('Invalidating patron field ' + field);
+
+ return egCore.net.request(
+ 'open-ils.actor',
+ 'open-ils.actor.invalidate.' + field,
+ egCore.auth.token(), patron.id, null, patron.home_ou.id()
+
+ ).then(function(res) {
+ // clear the invalid value from the form
+ patron[field] = '';
+
+ // update last_xact_id so future save operations
+ // on this patron will be allowed
+ patron.last_xact_id = res.payload.last_xact_id[patron.id];
+ });
+ }
+
service.init_patron = function(current) {
if (!current)
patron.home_ou = egCore.org.get(patron.home_ou.id);
patron.expire_date = new Date(Date.parse(patron.expire_date));
- patron.dob = new Date(Date.parse(patron.dob));
+ patron.dob = patron.dob ?
+ new Date(Date.parse(patron.dob)) : null;
patron.profile = current.profile(); // pre-hash version
patron.net_access_level = current.net_access_level();
patron.ident_type = current.ident_type();
$scope.hold_notify_sms = Boolean(notify.match(/sms/));
}
+ $scope.invalidate_field = function(field) {
+ patronRegSvc.invalidate_field($scope.patron, field);
+ }
+
$scope.edit_passthru.save = function() {
// toss the deleted addresses back into the patron's list of