return $e->die_event unless
$e->allowed('BAR_PATRON', $patron->home_ou);
}
+ if(($patron->photo_url)) {
+ return $e->die_event unless
+ $e->allowed('UPDATE_USER_PHOTO_URL', $patron->home_ou);
+ }
} else {
$new_patron = $patron;
'au.barred' : 'au.unbarred';
}
+ if($old_patron->photo_url ne $new_patron->photo_url) {
+ my $perm = 'UPDATE_USER_PHOTO_URL';
+ return $e->die_event unless $e->allowed($perm, $patron->home_ou);
+ }
+
# update the password by itself to avoid the password protection magic
if ($patron->passwd && $patron->passwd ne $old_patron->passwd) {
modify_migrated_user_password($e, $patron->id, $patron->passwd);
( 630, 'VIEW_GEOLOCATION_SERVICES', oils_i18n_gettext(630,
'View geographic location services', 'ppl', 'description')),
( 631, 'ADMIN_GEOLOCATION_SERVICES', oils_i18n_gettext(631,
- 'Administer geographic location services', 'ppl', 'description'))
+ 'Administer geographic location services', 'ppl', 'description')),
+ ( 632, 'UPDATE_USER_PHOTO_URL', oils_i18n_gettext(632,
+ 'Update the user photo url field in patron registration and editor', 'ppl', 'description'))
;
'PATRON_EXCEEDS_FINES.override',
'PATRON_EXCEEDS_OVERDUE_COUNT.override',
'RETRIEVE_RESERVATION_PULL_LIST',
- 'UPDATE_HOLD');
+ 'UPDATE_HOLD',
+ 'UPDATE_USER_PHOTO_URL');
-- Add advanced circulation permissions to the Circulation Admin group
'For staff-placed holds, in the absence of a patron preferred pickup location, fall back to using the staff workstation OU (rather than patron home OU)',
'coust', 'description'),
'bool', null)
+,( 'ui.patron.edit.au.photo_url.require', 'gui',
+ oils_i18n_gettext('ui.patron.edit.au.photo_url.require',
+ 'Require Photo URL field on patron registration',
+ 'coust', 'label'),
+ oils_i18n_gettext('ui.patron.edit.au.photo_url.require',
+ 'The Photo URL field will be required on the patron registration screen.',
+ 'coust', 'description'),
+ 'bool', null)
+,( 'ui.patron.edit.au.photo_url.show', 'gui',
+ oils_i18n_gettext('ui.patron.edit.au.photo_url.show',
+ 'Show Photo URL field on patron registration',
+ 'coust', 'label'),
+ oils_i18n_gettext('ui.patron.edit.au.photo_url.show',
+ 'The Photo URL field will be shown on the patron registration screen. Showing a field makes it appear with required fields even when not required. If the field is required this setting is ignored.',
+ 'coust', 'description'),
+ 'bool', null)
+,( 'ui.patron.edit.au.photo_url.suggest', 'gui',
+ oils_i18n_gettext('ui.patron.edit.au.photo_url.suggest',
+ 'Suggest Photo URL field on patron registration',
+ 'coust', 'label'),
+ oils_i18n_gettext('ui.patron.edit.au.photo_url.suggest',
+ 'The Photo URL field will be suggested on the patron registration screen. Suggesting a field makes it appear when suggested fields are shown. If the field is shown or required this setting is ignored.',
+ 'coust', 'description'),
+ 'bool', null)
;
UPDATE config.org_unit_setting_type
--- /dev/null
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+INSERT into config.org_unit_setting_type
+ (name, grp, label, description, datatype)
+ VALUES (
+ 'ui.patron.edit.au.photo_url.require',
+ 'gui',
+ oils_i18n_gettext(
+ 'ui.patron.edit.au.photo_url.require',
+ 'Require Photo URL field on patron registration',
+ 'coust',
+ 'label'
+ ),
+ oils_i18n_gettext(
+ 'ui.patron.edit.au.photo_url.require',
+ 'The Photo URL field will be required on the patron registration screen.',
+ 'coust',
+ 'description'
+ ),
+ 'bool'
+ );
+
+INSERT into config.org_unit_setting_type
+ (name, grp, label, description, datatype)
+ VALUES (
+ 'ui.patron.edit.au.photo_url.show',
+ 'gui',
+ oils_i18n_gettext(
+ 'ui.patron.edit.au.photo_url.show',
+ 'Show Photo URL field on patron registration',
+ 'coust',
+ 'label'
+ ),
+ oils_i18n_gettext(
+ 'ui.patron.edit.au.photo_url.show',
+ 'The Photo URL field will be shown on the patron registration screen. Showing a field makes it appear with required fields even when not required. If the field is required this setting is ignored.',
+ 'coust',
+ 'description'
+ ),
+ 'bool'
+ );
+
+INSERT into config.org_unit_setting_type
+ (name, grp, label, description, datatype)
+ VALUES (
+ 'ui.patron.edit.au.photo_url.suggest',
+ 'gui',
+ oils_i18n_gettext(
+ 'ui.patron.edit.au.photo_url.suggest',
+ 'Suggest Photo URL field on patron registration',
+ 'coust',
+ 'label'
+ ),
+
+ oils_i18n_gettext(
+ 'ui.patron.edit.au.photo_url.suggest',
+ 'The Photo URL field will be suggested on the patron registration screen. Suggesting a field makes it appear when suggested fields are shown. If the field is shown or required this setting is ignored.',
+ 'coust',
+ 'description'
+ ),
+ 'bool'
+ );
+
+INSERT INTO permission.perm_list ( id, code, description ) VALUES
+( 632, 'UPDATE_USER_PHOTO_URL', oils_i18n_gettext( 632,
+ 'Update the user photo url field in patron registration and editor', 'ppl', 'description' ))
+;
+
+INSERT INTO permission.grp_perm_map (grp, perm, depth, grantable)
+ SELECT
+ pgt.id, perm.id, aout.depth, FALSE
+ FROM
+ permission.grp_tree pgt,
+ permission.perm_list perm,
+ actor.org_unit_type aout
+ WHERE
+ pgt.name = 'Circulators' AND
+ aout.name = 'System' AND
+ perm.code = 'UPDATE_USER_PHOTO_URL'
+;
+
+COMMIT;
<tr fmclass='au' fmfield='ident_type' required='required'></tr>
<tr fmclass='au' fmfield='ident_value'></tr>
<tr fmclass='au' fmfield='ident_value2'><td></td><td id='parentGuardian'></td></t></tr>
+ <tr fmclass='au' fmfield='photo_url'></tr>
<tr fmclass='au' fmfield='email'></tr>
<tr fmclass='au' fmfield='day_phone'></tr>
<tr fmclass='au' fmfield='evening_phone'></tr>
</div>
</div>
+<!-- PHOTO_URL -->
+<div class="row reg-field-row" ng-show="show_field('au.photo_url')">
+ [% draw_field_label('au', 'photo_url') %]
+ [% draw_form_input('au', 'photo_url', '', 'photo_url') %]
+ <div class="col-md-3 patron-reg-example">
+ <span ng-if="org_settings['ui.patron.edit.au.photo_url.example']">
+ [% l('Example: [_1]',
+ "{{org_settings['ui.patron.edit.au.photo_url.example']}}") %]
+ </span>
+ </div>
+</div>
<!-- EMAIL -->
<div class="row reg-field-row" ng-show="show_field('au.email')">
'ui.patron.edit.au.ident_value.suggest',
'ui.patron.edit.au.ident_value2.show',
'ui.patron.edit.au.ident_value2.suggest',
+ 'ui.patron.edit.au.photo_url.require',
+ 'ui.patron.edit.au.photo_url.show',
+ 'ui.patron.edit.au.photo_url.suggest',
'ui.patron.edit.au.email.require',
'ui.patron.edit.au.email.show',
'ui.patron.edit.au.email.suggest',
}
}
break;
+ if(fmfield == 'photo_url') {
+ // Are we allowed to update the photo url?
+ var permission = 'UPDATE_USER_PHOTO_URL';
+ var ou = staff.ws_ou();
+ if(fmObject.home_ou() != null) {
+ ou = fmObject.home_ou();
+ }
+ var resp = fieldmapper.standardRequest(
+ ['open-ils.actor', 'open-ils.actor.user.perm.check'],
+ { params : [openils.User.authtoken, staff.id(), ou, [permission] ] }
+ );
+ if(resp[0]) { // No permission to edit the photo url
+ disabled = true;
+ }
+ }
case 'ac' : if(!editCard) editCard = patron.card(); fmObject = editCard; break;
case 'aua' :
fmObject = patron.addresses().filter(
'ui.patron.edit.au.ident_value.suggest',
'ui.patron.edit.au.ident_value2.show',
'ui.patron.edit.au.ident_value2.suggest',
+ 'ui.patron.edit.au.photo_url.require',
+ 'ui.patron.edit.au.photo_url.show',
+ 'ui.patron.edit.au.photo_url.suggest',
'ui.patron.edit.au.email.require',
'ui.patron.edit.au.email.show',
'ui.patron.edit.au.email.suggest',
'au.pref_family_name' : 2,
'au.ident_type' : 3,
'au.ident_type2' : 2,
+ 'au.photo_url' : 2,
'au.home_ou' : 3,
'au.profile' : 3,
'au.expire_date' : 3,
--- /dev/null
+== Photo URL ==
+
+Editing of the patron's photo URL can now be done in the staff client's patron registration and edit screen. A new permission UPDATE_USER_PHOTO_URL controls the ability to actually edit the field.