Koha/koha-tmpl/intranet-tmpl/prog/en/modules/members/deletemem.tt
Emmi 07af7b228f
Bug 23219: Cancel patrons holds when patron delete
Currently deleting a patron deletes all their holds and leaves
no record to the "old_reserves" table.

 Steps to reproduce:
- Create a patron
- Add holds for patron
- Holds are recorded to "reserves" table
- Delete patron
- Confirm delete
=>Patron and all holds are deleted and no record of holds is
left in "old_reserves" table

This patch displays alert text notifying user that deleting patron
cancels all their holds. Holds are cancelled instead of deleting them.
This patch also writes stringified datetime to holds cancel log instead
of whole datetime object.

To test:
- Apply this patch
- Create a patron
- Add holds for patron
- Holds are recorded to "reserves" table
- Delete patron
- Alert text of holds is displayed
- Confirm patron delete
=> Patron is deleted, their holds are cancelled and moved to
"old_reserves" table

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Nadine Pierre <nadine.pierre@inLibro.com>
Signed-off-by: Arthur Bousquet <arthur.bousquet@inlibro.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-07-15 12:48:36 +01:00

72 lines
3 KiB
Text

[% USE raw %]
[% USE Asset %]
[% USE Price %]
[% USE Branches %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Delete patron [% patron.firstname | html %] [% patron.surname | html %]</title>
[% INCLUDE 'doc-head-close.inc' %]
</head>
<body id="pat_deletemem" class="pat">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'patron-search.inc' %]
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a> &rsaquo; Delete patron [% patron.firstname | html %] [% patron.surname | html %]</div>
<div class="main container-fluid">
<div class="row">
<div class="col-sm-10 col-sm-push-2">
<main>
[% INCLUDE 'members-toolbar.inc' %]
[% IF ( ItemsOnIssues || charges || guarantees ) %]
<div class="dialog alert">
<h3>Cannot delete patron</h3>
<ul>
[% IF ( ItemsOnIssues ) %]
<li>Patron has [% ItemsOnIssues | html %] item(s) checked out.</li>
[% END %]
[% IF ( charges ) %]
<li>Patron has [% charges | $Price %] in fines.</li>
[% END %]
[% IF ( guarantees ) %]
<li>Patron's record has guaranteed accounts attached.</li>
[% END %]
</ul>
</div>
[% ELSIF op == 'delete_confirm' and patron %]
[%# TODO add "patron does not exist" unless patron %]
<div class="dialog alert">
[% IF ( ItemsOnHold ) %]
<h3>Patron has [% ItemsOnHold | html %] hold(s). Deleting patron cancels all their holds.</h3></br>
[% END %]
<h3>Are you sure you want to delete the patron [% patron.firstname | html %] [% patron.surname | html %]? This cannot be undone.</h3>
<form action="/cgi-bin/koha/members/deletemem.pl">
<input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
<input type="hidden" name="member" value="[% patron.borrowernumber | html %]"/>
<input type="hidden" name="op" value="delete_confirmed" />
<button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
</form>
<form action="/cgi-bin/koha/members/moremember.pl">
<input type="hidden" name="borrowernumber" value="[% patron.borrowernumber | html %]"/>
<button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
</form>
</div>
[% END %]
</main>
</div> <!-- /.col-sm-10.col-sm-push-2 -->
<div class="col-sm-2 col-sm-pull-10">
<aside>
[% INCLUDE 'circ-menu.inc' %]
</aside>
</div> <!-- /.col-sm-2.col-sm-pull-10 -->
</div> <!-- /.row -->
[% MACRO jsinclude BLOCK %]
[% INCLUDE 'str/members-menu.inc' %]
[% Asset.js("js/members-menu.js") | $raw %]
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]