Skip to content

Commit

Permalink
document: Hide time for due date
Browse files Browse the repository at this point in the history
In the public interface, when an item is "on loan" the due date
displayed contains the time. The time information isn't necessary to be
displayed.

The birth date should not be displayed in the patron profile view in the
public interface.

Closes rero#1395
Closes rero#1386

Co-Authored-by: Renaud Michotte <renaud.michotte@gmail.com>
  • Loading branch information
zannkukai committed Nov 6, 2020
1 parent 363e1ce commit a407ecd
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
3 changes: 2 additions & 1 deletion rero_ils/modules/items/api/circulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1230,14 +1230,15 @@ def available(self):
"""Get availability for item."""
return self.item_has_active_loan_or_request() == 0

def get_item_end_date(self, format='short'):
def get_item_end_date(self, format='short', time_format='medium'):
"""Get item due date for a given item."""
loan = get_loan_for_item(item_pid_to_object(self.pid))
if loan:
end_date = loan['end_date']
due_date = format_date_filter(
end_date,
date_format=format,
time_format=time_format,
locale=current_i18n.locale.language,
)
return due_date
Expand Down
2 changes: 1 addition & 1 deletion rero_ils/modules/items/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def item_availability_text(item):
else:
text = ''
if item.status == ItemStatus.ON_LOAN:
due_date = item.get_item_end_date(format='short')
due_date = item.get_item_end_date(format='short', time_format=None)
text = '{msg} {date}'.format(
msg=_('due until'),
date=due_date)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,7 @@
<div class="rero-ils-person-icon col-sm-2 col-lg-1">
<i class="fa fa-user fa-5x"></i>
</div>
<hgroup class="col-sm-10 col-lg-11 align-self-end">
<hgroup class="col-sm-10 col-lg-11 align-self-center">
<h1 class="mb-0">{{ record.first_name }} {{ record.last_name }}</h1>
{% if record.birth_date %}
<p>
<b>{{ _('Date of birth') }}:</b> {{ record.birth_date | format_date(
date_format='medium',
time_format=None,
locale=current_i18n.locale.language
)}}
</p>
{% endif %}
</hgroup>
</header>

0 comments on commit a407ecd

Please sign in to comment.