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

(-)a/C4/Circulation.pm (-28 / +27 lines)
Lines 3037-3087 sub LostItem{ Link Here
3037
}
3037
}
3038
3038
3039
sub GetOfflineOperations {
3039
sub GetOfflineOperations {
3040
	my $dbh = C4::Context->dbh;
3040
    my $dbh = C4::Context->dbh;
3041
	my $sth = $dbh->prepare("SELECT * FROM pending_offline_operations WHERE branchcode=? ORDER BY timestamp");
3041
    my $sth = $dbh->prepare("SELECT * FROM pending_offline_operations WHERE branchcode=? ORDER BY timestamp");
3042
	$sth->execute(C4::Context->userenv->{'branch'});
3042
    $sth->execute(C4::Context->userenv->{'branch'});
3043
	my $results = $sth->fetchall_arrayref({});
3043
    my $results = $sth->fetchall_arrayref({});
3044
	$sth->finish;
3044
    $sth->finish;
3045
	return $results;
3045
    return $results;
3046
}
3046
}
3047
3047
3048
sub GetOfflineOperation {
3048
sub GetOfflineOperation {
3049
	my $dbh = C4::Context->dbh;
3049
    my $dbh = C4::Context->dbh;
3050
	my $sth = $dbh->prepare("SELECT * FROM pending_offline_operations WHERE operationid=?");
3050
    my $sth = $dbh->prepare("SELECT * FROM pending_offline_operations WHERE operationid=?");
3051
	$sth->execute( shift );
3051
    $sth->execute( shift );
3052
	my $result = $sth->fetchrow_hashref;
3052
    my $result = $sth->fetchrow_hashref;
3053
	$sth->finish;
3053
    $sth->finish;
3054
	return $result;
3054
    return $result;
3055
}
3055
}
3056
3056
3057
sub AddOfflineOperation {
3057
sub AddOfflineOperation {
3058
	my $dbh = C4::Context->dbh;
3058
    my $dbh = C4::Context->dbh;
3059
	warn Data::Dumper::Dumper(@_);
3059
    my $sth = $dbh->prepare("INSERT INTO pending_offline_operations (userid, branchcode, timestamp, action, barcode, cardnumber) VALUES(?,?,?,?,?,?)");
3060
	my $sth = $dbh->prepare("INSERT INTO pending_offline_operations VALUES('',?,?,?,?,?,?)");
3060
    $sth->execute( @_ );
3061
	$sth->execute( @_ );
3061
    return "Added.";
3062
	return "Added.";
3063
}
3062
}
3064
3063
3065
sub DeleteOfflineOperation {
3064
sub DeleteOfflineOperation {
3066
	my $dbh = C4::Context->dbh;
3065
    my $dbh = C4::Context->dbh;
3067
	my $sth = $dbh->prepare("DELETE FROM pending_offline_operations WHERE operationid=?");
3066
    my $sth = $dbh->prepare("DELETE FROM pending_offline_operations WHERE operationid=?");
3068
	$sth->execute( shift );
3067
    $sth->execute( shift );
3069
	return "Deleted.";
3068
    return "Deleted.";
3070
}
3069
}
3071
3070
3072
sub ProcessOfflineOperation {
3071
sub ProcessOfflineOperation {
3073
	my $operation = shift;
3072
    my $operation = shift;
3074
3073
3075
    my $report;
3074
    my $report;
3076
	if ( $operation->{action} eq 'return' ) {
3075
    if ( $operation->{action} eq 'return' ) {
3077
        $report = ProcessOfflineReturn( $operation );
3076
        $report = ProcessOfflineReturn( $operation );
3078
	} elsif ( $operation->{action} eq 'issue' ) {
3077
    } elsif ( $operation->{action} eq 'issue' ) {
3079
	    $report = ProcessOfflineIssue( $operation );
3078
        $report = ProcessOfflineIssue( $operation );
3080
	}
3079
    }
3081
3080
3082
	DeleteOfflineOperation( $operation->{operationid} ) if $operation->{operationid};
3081
    DeleteOfflineOperation( $operation->{operationid} ) if $operation->{operationid};
3083
3082
3084
	return $report;
3083
    return $report;
3085
}
3084
}
3086
3085
3087
sub ProcessOfflineReturn {
3086
sub ProcessOfflineReturn {
(-)a/installer/data/mysql/updatedatabase.pl (-4 / +4 lines)
Lines 15-23 Link Here
15
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
16
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
17
#
17
#
18
# You should have received a copy of the GNU General Public License along with
18
# You should have received a copy of the GNU General Public License along
19
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
19
# with Koha; if not, write to the Free Software Foundation, Inc.,
20
# Suite 330, Boston, MA  02111-1307 USA
20
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21
#
21
#
22
22
23
# Bugs/ToDo:
23
# Bugs/ToDo:
Lines 4714-4720 if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { Link Here
4714
4714
4715
$DBversion = "3.07.00.XXX";
4715
$DBversion = "3.07.00.XXX";
4716
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
4716
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
4717
    $dbh->do("CREATE TABLE `pending_offline_operations` ( `operationid` int(11) NOT NULL AUTO_INCREMENT, `userid` varchar(30) NOT NULL, `branchcode` varchar(10) NOT NULL, `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `action` varchar(10) NOT NULL, `barcode` varchar(20) NOT NULL, `cardnumber` varchar(16) DEFAULT NULL, PRIMARY KEY (`operationid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8;");
4717
    $dbh->do("CREATE TABLE pending_offline_operations ( operationid int(11) NOT NULL AUTO_INCREMENT, userid varchar(30) NOT NULL, branchcode varchar(10) NOT NULL, timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, action varchar(10) NOT NULL, barcode varchar(20) NOT NULL, cardnumber varchar(16) DEFAULT NULL, PRIMARY KEY (operationid) ) ENGINE=MyISAM DEFAULT CHARSET=utf8;");
4718
    print "Upgrade to $DBversion done ( adding offline operations table )\n";
4718
    print "Upgrade to $DBversion done ( adding offline operations table )\n";
4719
    SetVersion($DBversion);
4719
    SetVersion($DBversion);
4720
}
4720
}
(-)a/offline_circ/list.pl (-11 / +16 lines)
Lines 13-23 Link Here
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
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.
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
15
#
16
# You should have received a copy of the GNU General Public License along with
16
# You should have received a copy of the GNU General Public License along
17
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# Suite 330, Boston, MA  02111-1307 USA
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
#
19
#
20
20
21
use strict;
22
use warnings;
23
21
use CGI;
24
use CGI;
22
use C4::Output;
25
use C4::Output;
23
use C4::Auth;
26
use C4::Auth;
Lines 41-54 my ($template, $loggedinuser, $cookie) = get_template_and_user({ Link Here
41
my $operations = GetOfflineOperations;
44
my $operations = GetOfflineOperations;
42
45
43
for (@$operations) {
46
for (@$operations) {
44
	my $biblio             = GetBiblioFromItemNumber(undef, $_->{'barcode'});
47
    my $biblio             = GetBiblioFromItemNumber(undef, $_->{'barcode'});
45
	$_->{'bibliotitle'}    = $biblio->{'title'};
48
    $_->{'bibliotitle'}    = $biblio->{'title'};
46
	$_->{'biblionumber'}   = $biblio->{'biblionumber'};
49
    $_->{'biblionumber'}   = $biblio->{'biblionumber'};
47
	my $borrower           = GetMemberDetails(undef,$_->{'cardnumber'});
50
    my $borrower           = GetMemberDetails(undef,$_->{'cardnumber'});
48
	$_->{'borrowernumber'} = $borrower->{'borrowernumber'};
51
    if ($borrower) {
49
	$_->{'borrower'}       = join(' ', $borrower->{'firstname'}, $borrower->{'surname'});
52
        $_->{'borrowernumber'} = $borrower->{'borrowernumber'};
50
	$_->{'actionissue'}    = $_->{'action'} eq 'issue';
53
        $_->{'borrower'}       = ($borrower->{'firstname'}?$borrower->{'firstname'}:'').' '.$borrower->{'surname'};
51
	$_->{'actionreturn'}   = $_->{'action'} eq 'return';
54
    }
55
    $_->{'actionissue'}    = $_->{'action'} eq 'issue';
56
    $_->{'actionreturn'}   = $_->{'action'} eq 'return';
52
}
57
}
53
$template->param(pending_operations => $operations);
58
$template->param(pending_operations => $operations);
54
59
(-)a/offline_circ/process.pl (-3 / +6 lines)
Lines 13-23 Link Here
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
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.
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
15
#
16
# You should have received a copy of the GNU General Public License along with
16
# You should have received a copy of the GNU General Public License along
17
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# Suite 330, Boston, MA  02111-1307 USA
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
#
19
#
20
20
21
use strict;
22
use warnings;
23
21
use CGI;
24
use CGI;
22
use C4::Auth;
25
use C4::Auth;
23
use C4::Circulation;
26
use C4::Circulation;
(-)a/offline_circ/process_koc.pl (-3 / +3 lines)
Lines 13-21 Link Here
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
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.
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
15
#
16
# You should have received a copy of the GNU General Public License along with
16
# You should have received a copy of the GNU General Public License along
17
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# Suite 330, Boston, MA  02111-1307 USA
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
#
19
#
20
20
21
use strict;
21
use strict;
(-)a/offline_circ/service.pl (-12 / +14 lines)
Lines 13-23 Link Here
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
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.
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
15
#
16
# You should have received a copy of the GNU General Public License along with
16
# You should have received a copy of the GNU General Public License along
17
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# Suite 330, Boston, MA  02111-1307 USA
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
#
19
#
20
20
21
use strict;
22
use warnings;
23
21
use CGI;
24
use CGI;
22
use C4::Auth;
25
use C4::Auth;
23
use C4::Circulation;
26
use C4::Circulation;
Lines 30-46 my ($status, $cookie, $sessionId) = C4::Auth::check_api_auth($cgi, undef); Link Here
30
my $result;
33
my $result;
31
34
32
if ($status eq 'ok') { # if authentication is ok
35
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
36
    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(
37
        $result = AddOfflineOperation(
35
	        $cgi->param('userid')     || '',
38
            $cgi->param('userid')     || '',
36
            $cgi->param('branchcode') || '',
39
            $cgi->param('branchcode') || '',
37
            $cgi->param('timestamp')  || '',
40
            $cgi->param('timestamp')  || '',
38
            $cgi->param('action')     || '',
41
            $cgi->param('action')     || '',
39
            $cgi->param('barcode')    || '',
42
            $cgi->param('barcode')    || '',
40
            $cgi->param('cardnumber') || '',
43
            $cgi->param('cardnumber') || '',
41
		);
44
        );
42
	} else {
45
    } else {
43
		$result = ProcessOfflineOperation(
46
        $result = ProcessOfflineOperation(
44
            {
47
            {
45
                'userid'      => $cgi->param('userid'),
48
                'userid'      => $cgi->param('userid'),
46
                'branchcode'  => $cgi->param('branchcode'),
49
                'branchcode'  => $cgi->param('branchcode'),
Lines 49-56 if ($status eq 'ok') { # if authentication is ok Link Here
49
                'barcode'     => $cgi->param('barcode'),
52
                'barcode'     => $cgi->param('barcode'),
50
                'cardnumber'  => $cgi->param('cardnumber'),
53
                'cardnumber'  => $cgi->param('cardnumber'),
51
            }
54
            }
52
		);
55
        );
53
	}
56
    }
54
} else {
57
} else {
55
    $result = "Authentication failed."
58
    $result = "Authentication failed."
56
}
59
}
57
- 

Return to bug 5877