-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
users: add new fields, move fields from the patron #1695
users: add new fields, move fields from the patron #1695
Conversation
5956da6
to
30ea20e
Compare
30ea20e
to
c249e2b
Compare
c249e2b
to
b042219
Compare
98d13ee
to
35ce713
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commit message proposition:
users: add new fields, move fields from the patron
* Replaces the phone field by home, business, mobile, other phone fields
in the user data model.
* Adds country and gender fields in the user data model.
* Adds 3 invenio-userprofiles configuration to specify the list of
countries, the default country and the read only fields.
* Makes the barcode repetitive.
* Removes all user fields from the patron data model.
* Adds the second address, the local code, the source fields in the
patron data model.
"secound_address": { | ||
"title": "Secound address", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"secound_address": { | |
"title": "Secound address", | |
"second_address": { | |
"title": "Second address", |
@@ -6,10 +6,13 @@ | |||
"additionalProperties": false, | |||
"propertiesOrder": [ | |||
"user_id", | |||
"secound_address", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"secound_address", | |
"second_address", |
@@ -6,10 +6,13 @@ | |||
"additionalProperties": false, | |||
"propertiesOrder": [ | |||
"user_id", | |||
"secound_address", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"secound_address", | |
"second_address", |
"secound_address": { | ||
"title": "Secound address", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"secound_address": { | |
"title": "Secound address", | |
"second_address": { | |
"title": "Second address", |
"country": { | ||
"type": "text" | ||
}, | ||
"secound_address": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"secound_address": { | |
"second_address": { |
"title": "business phone number", | ||
"description": "business phone number with the international prefix, without spaces.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"title": "business phone number", | |
"description": "business phone number with the international prefix, without spaces.", | |
"title": "Business phone number", | |
"description": "Business phone number with the international prefix, without spaces.", |
729a78f
to
ea9b133
Compare
* Adds a new 'user' resource to manage the user profiles. It contains the user personal data as opposed to the patron data that are link to a specific organisation. * Writes a REST API: * A GET, POST, PUT methods to create, update and retrieves the patron personal information. * A search endpoint to retrieve the patron personal information given an email or a username. * Creates units testing. * Centralizes several views and methods in a specific `User` python class. * Disables the validation email for freshly created user. * Uses the standard ngx-formly `widget` field for the user JSON schema. Co-Authored-by: Aly Badr <[email protected]> Co-Authored-by: Johnny Mariéthoz <[email protected]>
1828eae
to
4b77046
Compare
377ebb6
to
fdf434b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commit messages approved.
3cc4c88
to
702696c
Compare
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- In the professional view
- (!) I am not able to add a new user (personal data).
- When creating a new user, it is very difficult to find Switzerland in the list of countries. Ideally put Switzerland as default value (this should then be different for UCL). Also sort the list alphabetically (as in
provisionActivity
in the document editor), or put the few preferred values on top.
- (!) I am not able to add a new user (personal data).
- In the public view
- In
account/settings/profile/
, some field labels should not have uppercase letter for the 2nd word (Postal Code, Birth Date) - In
account/settings/profile/
, if I update my profile, and then change the page language to English (for example), I land on/lang/?lang_code=en
and receive a Page not found. - From RERO ILS homepage, when I click on "My account", it lasts long before displaying the account. A spinner would be great.
- Some responsive problems: in the ILL requests tab
- Some responsive problems: in the fees tab
- In
This is an Invenio bug, present also on SONAR. An issue has been open: inveniosoftware/invenio-userprofiles#119 All of the following problem will be done in an other US (patron profile using Angular):
|
rero_ils/modules/items/cli.py
Outdated
@@ -331,7 +331,7 @@ def get_patrons_barcodes(): | |||
barcodes = [] | |||
for uuid in patrons_ids: | |||
patron = Patron.get_record_by_id(uuid) | |||
barcode = patron.patron.get('barcode') | |||
patron_barcodes = patron.patron.get('barcode') | |||
if barcode: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if patron_barcodes ?
rero_ils/modules/loans/cli.py
Outdated
@@ -394,8 +394,8 @@ def get_random_patron(exclude_this_barcode): | |||
.filter('term', organisation__pid=org_pid)\ | |||
.source(['patron']).scan() | |||
for patron in patrons: | |||
if patron.patron.barcode != exclude_this_barcode: | |||
return Patron.get_patron_by_barcode(barcode=patron.patron.barcode) | |||
if patron.patron.barcode[0] != exclude_this_barcode: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since a patron can have multiple barcodes, this check is not valid anymore. Need to check that the exclude_this_barcode
is not in the list patron.patron.barcode
rero_ils/modules/patrons/cli.py
Outdated
@@ -122,6 +122,7 @@ def import_users(infile, append, verbose, password, lazy, dont_stop_on_error, | |||
patron.reindex() | |||
pids.append(patron.pid) | |||
except Exception as err: | |||
raise(err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to comment this line?
rero_ils/modules/utils.py
Outdated
@@ -303,7 +314,7 @@ def generate_item_barcode(data=None): | |||
data['barcode'] = 'f-{}'.format( | |||
datetime.now().strftime('%Y%m%d%I%M%S%f')) | |||
if data.get('patron') and not data.get('patron', {}).get('barcode'): | |||
data['patron']['barcode'] = 'f-{}'.format( | |||
data['patron']['barcode'][0] = 'f-{}'.format( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data['patron']['barcode'] = ['f-{}'.format(
datetime.now().strftime('%Y%m%d%I%M%S%f'))]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right. But as the barcode is required for a patron, this case should never happens! Can I remove this?
702696c
to
a9f6dc7
Compare
@@ -21,6 +21,6 @@ | |||
<i class="fa fa-user fa-5x"></i> | |||
</div> | |||
<hgroup class="col-sm-10 col-lg-11 align-self-center"> | |||
<h1 class="mb-0">{{ record.first_name }} {{ record.last_name }}</h1> | |||
<h1 class="mb-0">{{ record.dumps().first_name }} {{ record.dumps().last_name }}</h1> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is better to store result of dumps into a local variable because dumps() do a call to database (see patrons.api.dumps())
Maybe that could be done in the parent template (patron_profile.html) or as argument when calling the template
<div class="row pl-2 pr-2"> | ||
<div class="col-lg-3 font-weight-bold"> | ||
{{_('Keep history')}}: | ||
</a> | ||
</div> | ||
<div class="col-lg-9"> | ||
<i class="fa fa-circle mr- text-{{ 'success' if record.patron.keep_history else 'danger' }}"></i> | ||
{% if record.patron.keep_history %} | ||
{% if record.dumps().keep_history %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same before
@@ -59,7 +59,7 @@ | |||
<span class="badge badge-danger font-weight-normal">{{ fees.open.total_amount | format_currency(fees.open.currency) }}</span> | |||
</a> | |||
</li> | |||
{% if record.patron.keep_history %} | |||
{% if record.dumps().keep_history %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same before
|
||
res, _ = postdata( | ||
client, | ||
post_entrypoint, | ||
data | ||
) | ||
print(res.json) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could be removed
* Replaces the phone field by home, business, mobile, other phone fields in the user data model. * Adds country and gender fields in the user data model. * Adds 3 invenio-userprofiles configuration to specify the list of countries, the default country and the read only fields. * Makes the barcode repetitive. * Removes all user fields from the patron data model. * Adds the second address, the local code, the source fields in the patron data model. * Closes rero#1724, rero#1634, rero#1615, rero#1490, rero#1467, rero#1318, rero#1384, rero#1670. Co-Authored-by: Johnny Mariéthoz <[email protected]>
a9f6dc7
to
fb8f162
Compare
in the user data model.
countries, the default country and the read only fields.
patron data model.
Co-Authored-by: Johnny Mariéthoz [email protected]
Why are you opening this PR?
Dependencies
My PR depends on the following
rero-ils-ui
's PR(s):How to test?
Code review check list