<link field="usr" reltype="has_a" key="id" map="" class="au"/>
</links>
</class>
- <class id="aus" controller="open-ils.cstore" oils_obj:fieldmapper="actor::user_setting" oils_persist:tablename="actor.usr_setting" reporter:label="User Setting">
+ <class id="aus" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="actor::user_setting" oils_persist:tablename="actor.usr_setting" reporter:label="User Setting">
<fields oils_persist:primary="id" oils_persist:sequence="actor.usr_setting_id_seq">
<field reporter:label="Setting ID" name="id" reporter:datatype="id" />
<field reporter:label="Name" name="name" reporter:datatype="link"/>
<link field="name" reltype="has_a" key="name" map="" class="cust"/>
<link field="usr" reltype="has_a" key="id" map="" class="au"/>
</links>
+ <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+ <actions>
+ <retrieve permission="VIEW_USER">
+ <context link="usr" field="home_ou" />
+ </retrieve>
+ </actions>
+ </permacrud>
</class>
<class id="mafe" controller="open-ils.cstore" oils_obj:fieldmapper="metabib::author_field_entry" oils_persist:tablename="metabib.author_field_entry" reporter:label="Author Field Entry">
<fields oils_persist:primary="id" oils_persist:sequence="metabib.author_field_entry_id_seq">
</span>
</div>
</div>
- <div class="row" ng-show="mode=='view'">
+ <div class="row">
<div class="form-group col-sm-6">
<label for="edit-request-email-notify">
<input type="checkbox" id="edit-request-email-notify"
ng-disabled="mode=='view'"
ng-model="request.email_notify"/>
- [% l('Email Notify?') %]
+ [% l('Notify By Email When Hold Ready?') %]
</label>
</div>
<div class="form-group col-sm-6">
- <label for="edit-request-phone-notify">
- [% l('Phone Notify?') %]</label>
+ <label for="edit-extra-phone-notify">
+ <input type="checkbox" id="edit-extra-phone-notify"
+ ng-disabled="mode=='view'"
+ ng-model="extra.phone_notify"/>
+ [% l('Notify By Phone When Hold Ready?') %]
+ </label>
<input type="text" class="form-control" focus-me='focusMe'
id="edit-request-phone-notify"
- ng-model="request.phone_notify"
- ng-disabled="true"/>
+ ng-disabled="mode=='view'"
+ ng-model="request.phone_notify"/>
</div>
</div>
</div>
.factory('egAcqRequests',
- ['$uibModal','$q','egCore','ngToast',
-function($uibModal , $q , egCore , ngToast) {
+ ['$uibModal','$q','egCore','egOrg','ngToast',
+function($uibModal , $q , egCore , egOrg , ngToast) {
var service = {};
,'request_type'
,'usr'
]
- ,'au' : ['card','home_ou']
+ ,'au' : [
+ 'card'
+ ,'home_ou'
+ ,'mailing_address'
+ ,'billing_address'
+ ,'settings'
+ ]
}
};
,'request_status'
,'usr'
]
- ,'au' : ['card','home_ou']
+ ,'au' : [
+ 'card'
+ ,'home_ou'
+ ,'mailing_address'
+ ,'billing_address'
+ ,'settings'
+ ]
}
};
if (request.need_before) {
request.need_before = new Date(request.need_before);
}
+ if (request.phone_notify) {
+ $m_scope.extra.phone_notify = true;
+ }
if (request.pickup_lib) {
$m_scope.request.pickup_lib =
egCore.idl.fromHash('aou',request.pickup_lib);
flesh : 1,
flesh_fields : {
'au' : [
- 'mailing_address'
- ,'billing_address'
+ 'card'
,'home_ou'
+ ,'mailing_address'
+ ,'billing_address'
+ ,'settings'
]
}
},
{ atomic : true }
- ).then(function(usr) {
- $m_scope.extra.user_obj =
- egCore.idl.toHash(usr[0]);
- $m_scope.request.usr =
- $m_scope.extra.user_obj.id;
+ ).then(function(users) {
+ var usr = egCore.idl.toHash(users[0]);
+ $m_scope.extra.user_obj = usr;
+ $m_scope.request.usr = usr.id;
+ angular.forEach(usr.settings, function(s) {
+ if (s.name == 'opac.hold_notify') {
+ if (s.value.match('phone')) {
+ $m_scope.extra.phone_notify = true;
+ }
+ if (s.value.match('email')) {
+ $m_scope.request.email_notify = true;
+ }
+ }
+ if (s.name == 'opac.default_phone') {
+ $m_scope.request.phone_notify = s.value;
+ }
+ if (s.name == 'opac.default_pickup_location') {
+ $m_scope.request.pickup_lib =
+ egOrg.get(s.value);
+ }
+ });
});
});
}
if (mode=='create') {
var aur_obj = egCore.idl.toHash(new egCore.idl.aurs());
if (row['usr']) {
- aur_obj.usr = row['usr'];
+ return egCore.pcrud.search('au', {
+ id : row['usr']
+ }, {
+ flesh : 1,
+ flesh_fields : {
+ 'au' : [
+ 'card'
+ ,'home_ou'
+ ,'mailing_address'
+ ,'billing_address'
+ ,'settings'
+ ]
+ }
+ },
+ { atomic : true }
+ ).then(function(users) {
+ var usr = egCore.idl.toHash(users[0]);
+ aur_obj.usr = usr.id;
+ angular.forEach(usr.settings, function(s) {
+ if (s.name == 'opac.hold_notify') {
+ if (s.value.match('email')) {
+ aur_obj.email_notify = true;
+ }
+ }
+ if (s.name == 'opac.default_phone') {
+ aur_obj.phone_notify = s.value;
+ }
+ if (s.name == 'opac.default_pickup_location') {
+ aur_obj.pickup_lib = egCore.idl.toHash(
+ egOrg.get(s.value)
+ );
+ }
+ });
+ return aur_obj;
+ });
+ } else {
+ return aur_obj;
}
- return aur_obj;
} else {
return egCore.pcrud.search('aurs', {
id : row['id']
if (aur_obj.need_before() && typeof aur_obj.need_before() == 'object') {
aur_obj.need_before( aur_obj.need_before().toISOString() );
}
+ if (!data.extra.phone_notify) {
+ aur_obj.phone_notify(null);
+ }
if (mode=='create') {
aur_obj.isnew('t');
aur_obj.pickup_lib( aur_obj.pickup_lib().id() );