View | Details | Raw Unified | Return to bug 16276
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/cleanborrowers.tt (-1 / +11 lines)
Lines 12-18 Link Here
12
         */
12
         */
13
          function checkForm(form) {
13
          function checkForm(form) {
14
              if((form.checkbox[0].checked)){
14
              if((form.checkbox[0].checked)){
15
                  if ( (!form.date1.value) && (!form.borrower_dateexpiry.value) && (!form.borrower_categorycode.value) && (!form.patron_list_id.value)){
15
                  if ( (!form.date1.value) && (!form.borrower_dateexpiry.value) [% IF Koha.Preference('TrackLastPatronActivity') %]&& (!form.borrower_lastseen.value) [% END %]&& (!form.borrower_categorycode.value) && (!form.patron_list_id.value)){
16
                    alert(_("Please enter at least one criterion for deletion!"));
16
                    alert(_("Please enter at least one criterion for deletion!"));
17
                    return false;
17
                    return false;
18
                  }
18
                  }
Lines 77-82 Link Here
77
                    <input size="10" id="borrower_dateexpiry" name="borrower_dateexpiry" type="text" class="datepicker" />
77
                    <input size="10" id="borrower_dateexpiry" name="borrower_dateexpiry" type="text" class="datepicker" />
78
                    <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
78
                    <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
79
                </li>
79
                </li>
80
                [% IF Koha.Preference('TrackLastPatronActivity') %]
81
                    <li>
82
                        <label for="borrower_lastseen">who have not been connected since:</label>
83
                        <input size="10" id="borrower_lastseen" name="borrower_lastseen" type="text" class="datepicker" />
84
                        <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
85
                    </li>
86
                [% END %]
80
                <li>
87
                <li>
81
                    <label for="borrower_categorycode">whose patron category is:</label>
88
                    <label for="borrower_categorycode">whose patron category is:</label>
82
                    <select id="borrower_categorycode" name="borrower_categorycode">
89
                    <select id="borrower_categorycode" name="borrower_categorycode">
Lines 160-165 Link Here
160
            <input type="hidden" name="not_borrowed_since" value="[% not_borrowed_since | $KohaDates %]" />
167
            <input type="hidden" name="not_borrowed_since" value="[% not_borrowed_since | $KohaDates %]" />
161
            <input type="hidden" name="last_issue_date" value="[% last_issue_date | $KohaDates %]" />
168
            <input type="hidden" name="last_issue_date" value="[% last_issue_date | $KohaDates %]" />
162
            <input type="hidden" name="borrower_dateexpiry" value="[% borrower_dateexpiry | $KohaDates %]" />
169
            <input type="hidden" name="borrower_dateexpiry" value="[% borrower_dateexpiry | $KohaDates %]" />
170
            [% IF Koha.Preference('TrackLastPatronActivity') %]
171
                <input type="hidden" name="borrower_lastseen" value="[% borrower_lastseen | $KohaDates %]" />
172
            [% END %]
163
            <input type="hidden" name="borrower_categorycode" value="[% borrower_categorycode %]" />
173
            <input type="hidden" name="borrower_categorycode" value="[% borrower_categorycode %]" />
164
            <input type="hidden" name="patron_list_id" value="[% patron_list_id %]" />
174
            <input type="hidden" name="patron_list_id" value="[% patron_list_id %]" />
165
    </fieldset>
175
    </fieldset>
(-)a/tools/cleanborrowers.pl (-3 / +13 lines)
Lines 64-69 my $borrower_dateexpiry = Link Here
64
  $params->{borrower_dateexpiry}
64
  $params->{borrower_dateexpiry}
65
  ? dt_from_string $params->{borrower_dateexpiry}
65
  ? dt_from_string $params->{borrower_dateexpiry}
66
  : undef;
66
  : undef;
67
my $borrower_lastseen =
68
  $params->{borrower_lastseen}
69
  ? dt_from_string $params->{borrower_lastseen}
70
  : undef;
67
my $patron_list_id = $params->{patron_list_id};
71
my $patron_list_id = $params->{patron_list_id};
68
72
69
my $borrower_categorycode = $params->{'borrower_categorycode'} || q{};
73
my $borrower_categorycode = $params->{'borrower_categorycode'} || q{};
Lines 88-93 if ( $step == 2 ) { Link Here
88
             _get_selection_params(
92
             _get_selection_params(
89
                  $not_borrowed_since,
93
                  $not_borrowed_since,
90
                  $borrower_dateexpiry,
94
                  $borrower_dateexpiry,
95
                  $borrower_lastseen,
91
                  $borrower_categorycode,
96
                  $borrower_categorycode,
92
                  $patron_list_id,
97
                  $patron_list_id,
93
             )
98
             )
Lines 117-123 elsif ( $step == 3 ) { Link Here
117
    if ($do_delete) {
122
    if ($do_delete) {
118
        my $patrons_to_delete = GetBorrowersToExpunge(
123
        my $patrons_to_delete = GetBorrowersToExpunge(
119
                _get_selection_params(
124
                _get_selection_params(
120
                    $not_borrowed_since, $borrower_dateexpiry,
125
                    $not_borrowed_since, $borrower_dateexpiry, $borrower_lastseen,
121
                    $borrower_categorycode, $patron_list_id
126
                    $borrower_categorycode, $patron_list_id
122
                )
127
                )
123
            );
128
            );
Lines 165-170 $template->param( Link Here
165
    step                   => $step,
170
    step                   => $step,
166
    not_borrowed_since   => $not_borrowed_since,
171
    not_borrowed_since   => $not_borrowed_since,
167
    borrower_dateexpiry    => $borrower_dateexpiry,
172
    borrower_dateexpiry    => $borrower_dateexpiry,
173
    borrower_lastseen      => $borrower_lastseen,
168
    last_issue_date        => $last_issue_date,
174
    last_issue_date        => $last_issue_date,
169
    borrower_categorycodes => GetBorrowercategoryList(),
175
    borrower_categorycodes => GetBorrowercategoryList(),
170
    borrower_categorycode  => $borrower_categorycode,
176
    borrower_categorycode  => $borrower_categorycode,
Lines 183-189 sub _skip_borrowers_with_nonzero_balance { Link Here
183
}
189
}
184
190
185
sub _get_selection_params {
191
sub _get_selection_params {
186
    my ($not_borrowed_since, $borrower_dateexpiry, $borrower_categorycode, $patron_list_id) = @_;
192
    my ($not_borrowed_since, $borrower_dateexpiry, $borrower_lastseen, $borrower_categorycode, $patron_list_id) = @_;
187
193
188
    my $params = {};
194
    my $params = {};
189
    $params->{not_borrowed_since} = output_pref({
195
    $params->{not_borrowed_since} = output_pref({
Lines 196-201 sub _get_selection_params { Link Here
196
        dateformat => 'iso',
202
        dateformat => 'iso',
197
        dateonly   => 1
203
        dateonly   => 1
198
    }) if $borrower_dateexpiry;
204
    }) if $borrower_dateexpiry;
205
    $params->{last_seen} = output_pref({
206
        dt         => $borrower_lastseen,
207
        dateformat => 'iso',
208
        dateonly   => 1
209
    }) if $borrower_lastseen;
199
    $params->{category_code} = $borrower_categorycode if $borrower_categorycode;
210
    $params->{category_code} = $borrower_categorycode if $borrower_categorycode;
200
    $params->{patron_list_id} = $patron_list_id if $patron_list_id;
211
    $params->{patron_list_id} = $patron_list_id if $patron_list_id;
201
212
202
- 

Return to bug 16276