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

(-)a/circ/waitingreserves.pl (-33 / +69 lines)
Lines 46-51 my $borrowernumber = $input->param('borrowernumber'); Link Here
46
my $fbr            = $input->param('fbr') || '';
46
my $fbr            = $input->param('fbr') || '';
47
my $tbr            = $input->param('tbr') || '';
47
my $tbr            = $input->param('tbr') || '';
48
my $all_branches   = $input->param('allbranches') || '';
48
my $all_branches   = $input->param('allbranches') || '';
49
my $cancelall      = $input->param('cancelall');
49
50
50
my $cancel;
51
my $cancel;
51
52
Lines 62-103 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
62
63
63
my $default = C4::Context->userenv->{'branch'};
64
my $default = C4::Context->userenv->{'branch'};
64
65
66
my $transfer_when_cancel_all = C4::Context->preference('TransferWhenCancelAllWaitingHolds');
67
$template->param( TransferWhenCancelAllWaitingHolds => 1 ) if $transfer_when_cancel_all;
68
69
my @cancel_result;
65
# if we have a return from the form we launch the subroutine CancelReserve
70
# if we have a return from the form we launch the subroutine CancelReserve
66
if ($item) {
71
if ($item) {
67
    my ( $messages, $nextreservinfo ) = ModReserveCancelAll( $item, $borrowernumber );
72
    my $res = cancel( $item, $borrowernumber, $fbr, $tbr );
68
    # if we have a result
73
    push @cancel_result, $res if $res;
69
    if ($nextreservinfo) {
70
        my $borrowerinfo = GetMemberDetails( $nextreservinfo );
71
        my $iteminfo = GetBiblioFromItemNumber($item);
72
        if ( $messages->{'transfert'} ) {
73
            $template->param(
74
                messagetransfert => $messages->{'transfert'},
75
                branchname       => GetBranchName($messages->{'transfert'}),
76
            );
77
        }
78
79
        $template->param(
80
            message             => 1,
81
            nextreservnumber    => $nextreservinfo,
82
            nextreservsurname   => $borrowerinfo->{'surname'},
83
            nextreservfirstname => $borrowerinfo->{'firstname'},
84
            nextreservitem      => $item,
85
            nextreservtitle     => $iteminfo->{'title'},
86
            waiting             => ($messages->{'waiting'}) ? 1 : 0,
87
        );
88
    }
89
90
# 	if the document is not in his homebranch location and there is not reservation after, we transfer it
91
    if ($fbr ne $tbr  and not $nextreservinfo) {
92
        ModItemTransfer( $item, $fbr, $tbr );
93
    }
94
}
74
}
75
95
if ( C4::Context->preference('IndependantBranches') ) {
76
if ( C4::Context->preference('IndependantBranches') ) {
96
    undef $all_branches;
77
    undef $all_branches;
97
} else {
78
} else {
98
    $template->param( all_branches_link => $input->url . '?allbranches=1&' . $input->query_string )
79
    $template->param( all_branches_link => $input->url . '?allbranches=1' )
99
      unless $all_branches;
80
      unless $all_branches;
100
}
81
}
82
$template->param( all_branches => 1 ) if $all_branches;
101
83
102
my (@reservloop, @overloop);
84
my (@reservloop, @overloop);
103
my ($reservcount, $overcount);
85
my ($reservcount, $overcount);
Lines 107-114 my @getreserves = $all_branches ? GetReservesForBranch() : GetReservesForBranch( Link Here
107
my $today = Date_to_Days(&Today);
89
my $today = Date_to_Days(&Today);
108
foreach my $num (@getreserves) {
90
foreach my $num (@getreserves) {
109
    next unless ($num->{'waitingdate'} && $num->{'waitingdate'} ne '0000-00-00');
91
    next unless ($num->{'waitingdate'} && $num->{'waitingdate'} ne '0000-00-00');
110
    my %getreserv;
92
111
    my $gettitle     = GetBiblioFromItemNumber( $num->{'itemnumber'} );
93
    my $itemnumber = $num->{'itemnumber'};
94
    my $gettitle     = GetBiblioFromItemNumber( $itemnumber );
95
    my $borrowernum = $num->{'borrowernumber'};
96
    my $holdingbranch = $gettitle->{'holdingbranch'};
97
    my $homebranch = $gettitle->{'homebranch'};
98
99
    if ($cancelall) {
100
        my $res = cancel( $itemnumber, $borrowernum, $holdingbranch, $homebranch, !$transfer_when_cancel_all );
101
        push @cancel_result, $res if $res;
102
        next;
103
    }
104
105
    my %getreserv = (
106
        itemnumber => $itemnumber,
107
        borrowernum => $borrowernum,
108
    );
109
112
    # fix up item type for display
110
    # fix up item type for display
113
    $gettitle->{'itemtype'} = C4::Context->preference('item-level_itypes') ? $gettitle->{'itype'} : $gettitle->{'itemtype'};
111
    $gettitle->{'itemtype'} = C4::Context->preference('item-level_itypes') ? $gettitle->{'itype'} : $gettitle->{'itemtype'};
114
    my $getborrower = GetMember(borrowernumber => $num->{'borrowernumber'});
112
    my $getborrower = GetMember(borrowernumber => $num->{'borrowernumber'});
Lines 122-138 foreach my $num (@getreserves) { Link Here
122
120
123
    $getreserv{'itemtype'}       = $itemtypeinfo->{'description'};
121
    $getreserv{'itemtype'}       = $itemtypeinfo->{'description'};
124
    $getreserv{'title'}          = $gettitle->{'title'};
122
    $getreserv{'title'}          = $gettitle->{'title'};
125
    $getreserv{'itemnumber'}     = $gettitle->{'itemnumber'};
126
    $getreserv{'biblionumber'}   = $gettitle->{'biblionumber'};
123
    $getreserv{'biblionumber'}   = $gettitle->{'biblionumber'};
127
    $getreserv{'barcode'}        = $gettitle->{'barcode'};
124
    $getreserv{'barcode'}        = $gettitle->{'barcode'};
128
    $getreserv{'branchname'}     = GetBranchName($gettitle->{'homebranch'});
125
    $getreserv{'branchname'}     = GetBranchName($gettitle->{'homebranch'});
129
    $getreserv{'homebranch'}     = $gettitle->{'homebranch'};
126
    $getreserv{'homebranch'}     = $gettitle->{'homebranch'};
130
    $getreserv{'holdingbranch'}  = $gettitle->{'holdingbranch'};
127
    $getreserv{'holdingbranch'}  = $gettitle->{'holdingbranch'};
131
    $getreserv{'itemcallnumber'} = $gettitle->{'itemcallnumber'};
128
    $getreserv{'itemcallnumber'} = $gettitle->{'itemcallnumber'};
132
    if ( $gettitle->{'homebranch'} ne $gettitle->{'holdingbranch'} ) {
129
    if ( $homebranch ne $holdingbranch ) {
133
        $getreserv{'dotransfer'} = 1;
130
        $getreserv{'dotransfer'} = 1;
134
    }
131
    }
135
    $getreserv{'borrowernum'}       = $getborrower->{'borrowernumber'};
136
    $getreserv{'borrowername'}      = $getborrower->{'surname'};
132
    $getreserv{'borrowername'}      = $getborrower->{'surname'};
137
    $getreserv{'borrowerfirstname'} = $getborrower->{'firstname'};
133
    $getreserv{'borrowerfirstname'} = $getborrower->{'firstname'};
138
    $getreserv{'borrowerphone'}     = $getborrower->{'phone'};
134
    $getreserv{'borrowerphone'}     = $getborrower->{'phone'};
Lines 150-155 foreach my $num (@getreserves) { Link Here
150
    
146
    
151
}
147
}
152
148
149
$template->param(cancel_result => \@cancel_result) if @cancel_result;
153
$template->param(
150
$template->param(
154
    reserveloop => \@reservloop,
151
    reserveloop => \@reservloop,
155
    reservecount => $reservcount,
152
    reservecount => $reservcount,
Lines 161-163 $template->param( Link Here
161
);
158
);
162
159
163
output_html_with_http_headers $input, $cookie, $template->output;
160
output_html_with_http_headers $input, $cookie, $template->output;
161
162
exit;
163
164
sub cancel {
165
    my ($item, $borrowernumber, $fbr, $tbr, $skip_transfers ) = @_;
166
167
    my $transfer = $fbr ne $tbr; # XXX && !$nextreservinfo;
168
169
    return if $transfer && $skip_transfers;
170
171
    my ( $messages, $nextreservinfo ) = ModReserveCancelAll( $item, $borrowernumber );
172
173
# 	if the document is not in his homebranch location and there is not reservation after, we transfer it
174
    if ($transfer && !$nextreservinfo) {
175
        ModItemTransfer( $item, $fbr, $tbr );
176
    }
177
    # if we have a result
178
    if ($nextreservinfo) {
179
        my %res;
180
        my $borrowerinfo = GetMemberDetails( $nextreservinfo );
181
        my $iteminfo = GetBiblioFromItemNumber($item);
182
        if ( $messages->{'transfert'} ) {
183
            $res{messagetransfert} = $messages->{'transfert'};
184
            $res{branchname}       = GetBranchName($messages->{'transfert'});
185
        }
186
187
        $res{message}             = 1;
188
        $res{nextreservnumber}    = $nextreservinfo;
189
        $res{nextreservsurname}   = $borrowerinfo->{'surname'};
190
        $res{nextreservfirstname} = $borrowerinfo->{'firstname'};
191
        $res{nextreservitem}      = $item;
192
        $res{nextreservtitle}     = $iteminfo->{'title'};
193
        $res{waiting}             = $messages->{'waiting'} ? 1 : 0;
194
195
        return \%res;
196
    }
197
198
    return;
199
}
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 330-335 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES Link Here
330
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('EasyAnalyticalRecords','0','If on, display in the catalogue screens tools to easily setup analytical record relationships','','YesNo');
330
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('EasyAnalyticalRecords','0','If on, display in the catalogue screens tools to easily setup analytical record relationships','','YesNo');
331
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacShowRecentComments',0,'If ON a link to recent comments will appear in the OPAC masthead',NULL,'YesNo');
331
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacShowRecentComments',0,'If ON a link to recent comments will appear in the OPAC masthead',NULL,'YesNo');
332
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('CircAutoPrintQuickSlip', '1', 'Choose what should happen when an empty barcode field is submitted in circulation: Display a print quick slip window or Clear the screen.',NULL,'YesNo');
332
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('CircAutoPrintQuickSlip', '1', 'Choose what should happen when an empty barcode field is submitted in circulation: Display a print quick slip window or Clear the screen.',NULL,'YesNo');
333
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('TransferWhenCancelAllWaitingHolds','0','Transfer items when cancelling all waiting holds',NULL,'YesNo');
333
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OPACLocalCoverImages','0','Display local cover images on OPAC search and details pages.','1','YesNo');
334
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OPACLocalCoverImages','0','Display local cover images on OPAC search and details pages.','1','YesNo');
334
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('LocalCoverImages','0','Display local cover images on intranet details pages.','1','YesNo');
335
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('LocalCoverImages','0','Display local cover images on intranet details pages.','1','YesNo');
335
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('AllowMultipleCovers','0','Allow multiple cover images to be attached to each bibliographic record.','1','YesNo');
336
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('AllowMultipleCovers','0','Allow multiple cover images to be attached to each bibliographic record.','1','YesNo');
(-)a/installer/data/mysql/updatedatabase.pl (+8 lines)
Lines 4663-4668 ENDOFRENEWAL Link Here
4663
    print "Upgrade to $DBversion done (Added a system preference to allow renewal of Patron account either from todays date or from existing expiry date in the patrons account.)\n";
4663
    print "Upgrade to $DBversion done (Added a system preference to allow renewal of Patron account either from todays date or from existing expiry date in the patrons account.)\n";
4664
    SetVersion($DBversion);
4664
    SetVersion($DBversion);
4665
}
4665
}
4666
4667
$DBversion = "3.07.00.XXX";
4668
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
4669
    $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('TransferWhenCancelAllWaitingHolds','0','Transfer items when cancelling all waiting holds',NULL,'YesNo')");
4670
    print "Upgrade to $DBversion done (Add sysprefs to control transfer when cancel all waiting holds)\n";
4671
    SetVersion ($DBversion);
4672
}
4673
4666
=head1 FUNCTIONS
4674
=head1 FUNCTIONS
4667
4675
4668
=head2 DropAllForeignKeys($table)
4676
=head2 DropAllForeignKeys($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (+6 lines)
Lines 317-322 Circulation: Link Here
317
                  yes: Enable
317
                  yes: Enable
318
                  no:  "Don't enable"
318
                  no:  "Don't enable"
319
            - "the ability to place holds on multiple biblio from the search results"	    
319
            - "the ability to place holds on multiple biblio from the search results"	    
320
        -
321
            - pref: TransferWhenCancelAllWaitingHolds
322
              choices:
323
                  yes: Transfer
324
                  no: "Don't transfer"
325
            - items when cancelling all waiting holds.
320
    Fines Policy:
326
    Fines Policy:
321
        -
327
        -
322
            - Calculate fines based on days overdue
328
            - Calculate fines based on days overdue
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt (-5 / +16 lines)
Lines 44-50 $.tablesorter.addParser({ Link Here
44
            View all branches</a></span>
44
            View all branches</a></span>
45
            [% END %]
45
            [% END %]
46
        </h2>
46
        </h2>
47
        [% IF ( messagetransfert ) %]
47
    [% IF ( cancel_result ) %]
48
        [% IF ( cancel_result.messagetransfert ) %]
48
            <div>
49
            <div>
49
                <h2>Hold find for ([% nextreservtitle %]), must be transferred</h2>
50
                <h2>Hold find for ([% nextreservtitle %]), must be transferred</h2>
50
                <p>This hold placed by : <b> [% nextreservsurname %] [% nextreservfirstname %]</b> at the library : <b> [% branchname %] </b>, Please transfer this hold.
51
                <p>This hold placed by : <b> [% nextreservsurname %] [% nextreservfirstname %]</b> at the library : <b> [% branchname %] </b>, Please transfer this hold.
Lines 54-60 $.tablesorter.addParser({ Link Here
54
                </form>
55
                </form>
55
            </div>
56
            </div>
56
        [% END %]
57
        [% END %]
57
        [% IF ( waiting ) %]
58
        [% IF ( cancel_result.waiting ) %]
58
            <div id="bloc25">
59
            <div id="bloc25">
59
                <h2>This hold is waiting</h2>
60
                <h2>This hold is waiting</h2>
60
                <p>This hold ([% nextreservtitle %]) was placed by <b> : [% nextreservsurname %] [% nextreservfirstname %]</b>,
61
                <p>This hold ([% nextreservtitle %]) was placed by <b> : [% nextreservsurname %] [% nextreservfirstname %]</b>,
Lines 65-71 $.tablesorter.addParser({ Link Here
65
                </form>
66
                </form>
66
            </div>
67
            </div>
67
        [% END %]
68
        [% END %]
68
        [% UNLESS ( message ) %]
69
    [% ELSE %]
69
        <div id="resultlist" class="toptabs">
70
        <div id="resultlist" class="toptabs">
70
            <ul>
71
            <ul>
71
                <li><a href="/cgi-bin/koha/circ/waitingreserves.pl#holdswaiting">[% reservecount %] Hold(s) waiting</a></li>
72
                <li><a href="/cgi-bin/koha/circ/waitingreserves.pl#holdswaiting">[% reservecount %] Hold(s) waiting</a></li>
Lines 117-123 $.tablesorter.addParser({ Link Here
117
        </div>
118
        </div>
118
        <div id="holdsover">
119
        <div id="holdsover">
119
                <p>Holds listed here have been awaiting pickup for more than [% ReservesMaxPickUpDelay %] days.</p>
120
                <p>Holds listed here have been awaiting pickup for more than [% ReservesMaxPickUpDelay %] days.</p>
120
                [% IF ( overloop ) %]
121
               [% IF ( overloop ) %]
122
               <p>
123
               <form name="cancelAllReserve" action="waitingreserves.pl" method="post">
124
                   <input type="hidden" name="cancelall" value="1" />
125
                   <input type="hidden" name="allbranches" value="[% allbranches %]" />
126
                   <input type="submit" value="Cancel [% IF TransferWhenCancelAllWaitingHolds %]and Transfer [% END %]All" />
127
               </form>
128
               [% UNLESS TransferWhenCancelAllWaitingHolds %]
129
               Only items that need not be transferred will be cancelled (TransferWhenCancelAllWaitingHolds sypref)
130
               [% END %]
131
               </p>
132
               <br/>
121
               <table id="holdso">
133
               <table id="holdso">
122
               <thead><tr>
134
               <thead><tr>
123
                    <th>Available since</th>
135
                    <th>Available since</th>
124
- 

Return to bug 6039