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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/offline_circ/list.tmpl (+97 lines)
Line 0 Link Here
1
    <!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
2
    <title>Koha &rsaquo; Circulation &rsaquo; Offline Circulation</title>
3
    <!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
4
    <script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
5
    <script type="text/javascript" language="javascript">
6
        $(document).ready(function() {
7
            $('#checkall').click(function() {
8
                $(":checkbox").attr('checked', $('#checkall').is(':checked')); 
9
            });
10
            $('#process,#delete').click(function() {
11
                var action = $(this).attr("id");
12
                $(":checkbox[name=operationid]:checked").each(function() {
13
                    var cb = $(this);
14
                    $.ajax({
15
                        url: "process.pl", 
16
                        data: { 'action': action, 'operationid': this.value },
17
                        async: false,
18
                        dataType: "text",
19
                        success: function(data) {
20
                            cb.replaceWith(data);
21
                        }});
22
                });
23
                if( $('#operations tbody :checkbox').size() == 0 ) {
24
                    $('#actions').hide();
25
                }
26
            });
27
        });
28
    </script>
29
</head>
30
<body>
31
    <!-- TMPL_INCLUDE NAME="header.inc" -->
32
    <!-- TMPL_INCLUDE NAME="circ-search.inc" -->
33
34
    <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a> &rsaquo; Offline Circulation</div>
35
36
    <div id="doc" class="yui-t7">
37
       
38
	    <div id="bd">
39
40
	    <h2>Offline Circulation</h2>
41
	
42
	    <!-- TMPL_IF NAME="operations" -->
43
	
44
	        <form>
45
46
	        <table id="operations">
47
	            <thead>
48
		            <tr>
49
		                <th><input type="checkbox" name="checkall" id="checkall" /></th>
50
			            <th>Date</th>
51
			            <th>Action</th>
52
			            <th>Barcode</th>
53
			            <th>Cardnumber</th>
54
		            </tr>
55
		        </thead>
56
		        <tbody>
57
		            <!-- TMPL_LOOP NAME="operations" -->
58
		                <tr class="oc-<!-- TMPL_VAR NAME="action" -->">
59
		                    <td><input type="checkbox" name="operationid" value="<!-- TMPL_VAR NAME="operationid" -->" /></td>
60
			                <td><!-- TMPL_VAR NAME="timestamp" --></td>
61
			                <td><!-- TMPL_VAR NAME="action" --></td>
62
			                <td>
63
			                    <!-- TMPL_IF NAME="biblionumber" -->
64
			                        <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->" title="<!-- TMPL_VAR NAME="bibliotitle" -->"><!-- TMPL_VAR NAME="barcode" --></a>
65
			                    <!-- TMPL_ELSE -->
66
			                        <span class="error"><!-- TMPL_VAR NAME="barcode" --></span>
67
			                    <!-- /TMPL_IF -->
68
			                </td>
69
			                <td>
70
			                <!-- TMPL_IF NAME="actionissue" -->
71
		                        <!-- TMPL_IF NAME="borrowernumber" -->
72
		                            <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->" title="<!-- TMPL_VAR NAME="borrower" -->"><!-- TMPL_VAR NAME="cardnumber" --></a>
73
		                        <!-- TMPL_ELSE -->
74
		                            <span class="error"><!-- TMPL_VAR NAME="cardnumber" --></span>
75
		                        <!-- /TMPL_IF -->
76
			                <!-- /TMPL_IF -->
77
			                </td>
78
		                </tr>
79
		            <!-- /TMPL_LOOP -->
80
		        </tbody>
81
	        </table>
82
83
            <p id="actions">For the selected operations:
84
            <input type="button" id="process" value="Process" />
85
            <input type="button" id="delete" value="Delete" /></p>
86
            
87
            </form>
88
89
        <!-- TMPL_ELSE -->
90
        
91
            <p>There is no pending offline operations.</p>
92
            
93
        <!-- /TMPL_IF -->
94
        
95
    </div>
96
97
    <!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->
(-)a/offline_circ/list.pl (+57 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# 2009 BibLibre <jeanandre.santoni@biblibre.com>
4
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 2 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along with
17
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
18
# Suite 330, Boston, MA  02111-1307 USA
19
#
20
21
use CGI;
22
use C4::Output;
23
use C4::Auth;
24
use C4::Koha;
25
use C4::Context;
26
use C4::Circulation;
27
use C4::Branch;
28
use C4::Members;
29
use C4::Biblio;
30
31
my $query = CGI->new;
32
33
my ($template, $loggedinuser, $cookie) = get_template_and_user({ 
34
    template_name => "offline_circ/list.tmpl",
35
    query => $query,
36
    type => "intranet",
37
    authnotrequired => 0,
38
    flagsrequired   => { circulate => "circulate_remaining_permissions" },
39
});
40
41
my $operations = GetOfflineOperations;
42
43
for (@$operations) {
44
	my $biblio             = GetBiblioFromItemNumber(undef, $_->{'barcode'});
45
	$_->{'bibliotitle'}    = $biblio->{'title'};
46
	$_->{'biblionumber'}   = $biblio->{'biblionumber'};
47
	my $borrower           = GetMemberDetails(undef,$_->{'cardnumber'});
48
	$_->{'borrowernumber'} = $borrower->{'borrowernumber'};
49
	$_->{'borrower'}       = join(' ', $borrower->{'firstname'}, $borrower->{'surname'});
50
	$_->{'actionissue'}    = $_->{'action'} eq 'issue';
51
	$_->{'actionreturn'}   = $_->{'action'} eq 'return';
52
}
53
54
$template->param(operations => $operations);
55
56
output_html_with_http_headers $query, $cookie, $template->output;
57
(-)a/offline_circ/process.pl (+48 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# 2009 BibLibre <jeanandre.santoni@biblibre.com>
4
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 2 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along with
17
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
18
# Suite 330, Boston, MA  02111-1307 USA
19
#
20
21
use CGI;
22
use C4::Auth;
23
use C4::Circulation;
24
25
my $query = CGI->new;
26
27
my ($template, $loggedinuser, $cookie) = get_template_and_user({ 
28
    template_name => "offline_circ/list.tmpl",
29
    query => $query,
30
    type => "intranet",
31
    authnotrequired => 0,
32
    flagsrequired   => { circulate => "circulate_remaining_permissions" },
33
});
34
35
my $operationid = $query->param('operationid');
36
my $action = $query->param('action');
37
my $result;
38
39
if ( $action eq 'process' ) {
40
    my $operation = GetOfflineOperation( $operationid );
41
    $result = ProcessOfflineOperation( $operation );
42
} elsif ( $action eq 'delete' ) {
43
    $result = DeleteOfflineOperation( $operationid );
44
}
45
46
print CGI::header('-type'=>'text/plain', '-charset'=>'utf-8');
47
print $result;
48
(-)a/offline_circ/service.pl (-1 / +60 lines)
Line 0 Link Here
0
- 
1
#!/usr/bin/perl
2
3
# 2009 BibLibre <jeanandre.santoni@biblibre.com>
4
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 2 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along with
17
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
18
# Suite 330, Boston, MA  02111-1307 USA
19
#
20
21
use CGI;
22
use C4::Auth;
23
use C4::Circulation;
24
25
my $cgi = CGI->new;
26
27
# get the status of the user, this will check his credentials and rights
28
my ($status, $cookie, $sessionId) = C4::Auth::check_api_auth($cgi, undef);
29
30
my $result;
31
32
if ($status eq 'ok') { # if authentication is ok
33
	if ( $cgi->param('pending') eq 'true' ) { # if the 'pending' flag is true, we store the operation in the db instead of directly processing them
34
		$result = AddOfflineOperation(
35
	        $cgi->param('userid')     || '',
36
            $cgi->param('branchcode') || '',
37
            $cgi->param('timestamp')  || '',
38
            $cgi->param('action')     || '',
39
            $cgi->param('barcode')    || '',
40
            $cgi->param('cardnumber') || '',
41
		);
42
	} else {
43
		$result = ProcessOfflineOperation(
44
            {
45
                'userid'      => $cgi->param('userid'),
46
                'branchcode'  => $cgi->param('branchcode'),
47
                'timestamp'   => $cgi->param('timestamp'),
48
                'action'      => $cgi->param('action'),
49
                'barcode'     => $cgi->param('barcode'),
50
                'cardnumber'  => $cgi->param('cardnumber'),
51
            }
52
		);
53
	}
54
} else {
55
    $result = "Authentication failed."
56
}
57
58
print CGI::header('-type'=>'text/plain', '-charset'=>'utf-8');
59
print $result;
60

Return to bug 5877