Bugzilla – Attachment 7812 Details for
Bug 5877
Offline circulation improvements : upload all files, apply at once
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 5877 QA follow-up
Bug-5877-QA-follow-up.patch (text/plain), 11.30 KB, created by
Paul Poulain
on 2012-02-22 17:12:41 UTC
(
hide
)
Description:
Bug 5877 QA follow-up
Filename:
MIME Type:
Creator:
Paul Poulain
Created:
2012-02-22 17:12:41 UTC
Size:
11.30 KB
patch
obsolete
>From 38434e6044c905197f8fbb9471897b5be45b2843 Mon Sep 17 00:00:00 2001 >From: Paul Poulain <paul.poulain@biblibre.com> >Date: Wed, 22 Feb 2012 18:12:04 +0100 >Subject: [PATCH] Bug 5877 QA follow-up > >* removing tabs as indenter >* adding fieldnames in INSERT clause >* updating FSF address >* removing ` in SQL table creation (mysql-ism) >* use strict & use warning added & no error in logs checked > >Note that process_koc.pl and updatedatabase are not related to this bug, but the FSF address was wrong, I fixed it as well >--- > C4/Circulation.pm | 55 +++++++++++++++---------------- > installer/data/mysql/updatedatabase.pl | 8 ++-- > offline_circ/list.pl | 27 +++++++++------ > offline_circ/process.pl | 9 +++-- > offline_circ/process_koc.pl | 6 ++-- > offline_circ/service.pl | 25 ++++++++------ > 6 files changed, 70 insertions(+), 60 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index d44e862..1a156d9 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -3037,51 +3037,50 @@ sub LostItem{ > } > > sub GetOfflineOperations { >- my $dbh = C4::Context->dbh; >- my $sth = $dbh->prepare("SELECT * FROM pending_offline_operations WHERE branchcode=? ORDER BY timestamp"); >- $sth->execute(C4::Context->userenv->{'branch'}); >- my $results = $sth->fetchall_arrayref({}); >- $sth->finish; >- return $results; >+ my $dbh = C4::Context->dbh; >+ my $sth = $dbh->prepare("SELECT * FROM pending_offline_operations WHERE branchcode=? ORDER BY timestamp"); >+ $sth->execute(C4::Context->userenv->{'branch'}); >+ my $results = $sth->fetchall_arrayref({}); >+ $sth->finish; >+ return $results; > } > > sub GetOfflineOperation { >- my $dbh = C4::Context->dbh; >- my $sth = $dbh->prepare("SELECT * FROM pending_offline_operations WHERE operationid=?"); >- $sth->execute( shift ); >- my $result = $sth->fetchrow_hashref; >- $sth->finish; >- return $result; >+ my $dbh = C4::Context->dbh; >+ my $sth = $dbh->prepare("SELECT * FROM pending_offline_operations WHERE operationid=?"); >+ $sth->execute( shift ); >+ my $result = $sth->fetchrow_hashref; >+ $sth->finish; >+ return $result; > } > > sub AddOfflineOperation { >- my $dbh = C4::Context->dbh; >- warn Data::Dumper::Dumper(@_); >- my $sth = $dbh->prepare("INSERT INTO pending_offline_operations VALUES('',?,?,?,?,?,?)"); >- $sth->execute( @_ ); >- return "Added."; >+ my $dbh = C4::Context->dbh; >+ my $sth = $dbh->prepare("INSERT INTO pending_offline_operations (userid, branchcode, timestamp, action, barcode, cardnumber) VALUES(?,?,?,?,?,?)"); >+ $sth->execute( @_ ); >+ return "Added."; > } > > sub DeleteOfflineOperation { >- my $dbh = C4::Context->dbh; >- my $sth = $dbh->prepare("DELETE FROM pending_offline_operations WHERE operationid=?"); >- $sth->execute( shift ); >- return "Deleted."; >+ my $dbh = C4::Context->dbh; >+ my $sth = $dbh->prepare("DELETE FROM pending_offline_operations WHERE operationid=?"); >+ $sth->execute( shift ); >+ return "Deleted."; > } > > sub ProcessOfflineOperation { >- my $operation = shift; >+ my $operation = shift; > > my $report; >- if ( $operation->{action} eq 'return' ) { >+ if ( $operation->{action} eq 'return' ) { > $report = ProcessOfflineReturn( $operation ); >- } elsif ( $operation->{action} eq 'issue' ) { >- $report = ProcessOfflineIssue( $operation ); >- } >+ } elsif ( $operation->{action} eq 'issue' ) { >+ $report = ProcessOfflineIssue( $operation ); >+ } > >- DeleteOfflineOperation( $operation->{operationid} ) if $operation->{operationid}; >+ DeleteOfflineOperation( $operation->{operationid} ) if $operation->{operationid}; > >- return $report; >+ return $report; > } > > sub ProcessOfflineReturn { >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index ae614b2..66eba71 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -15,9 +15,9 @@ > # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR > # A PARTICULAR PURPOSE. See the GNU General Public License for more details. > # >-# You should have received a copy of the GNU General Public License along with >-# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, >-# Suite 330, Boston, MA 02111-1307 USA >+# You should have received a copy of the GNU General Public License along >+# with Koha; if not, write to the Free Software Foundation, Inc., >+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. > # > > # Bugs/ToDo: >@@ -4714,7 +4714,7 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { > > $DBversion = "3.07.00.XXX"; > if (C4::Context->preference("Version") < TransformToNum($DBversion)) { >- $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;"); >+ $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;"); > print "Upgrade to $DBversion done ( adding offline operations table )\n"; > SetVersion($DBversion); > } >diff --git a/offline_circ/list.pl b/offline_circ/list.pl >index 72d6dae..de129ff 100755 >--- a/offline_circ/list.pl >+++ b/offline_circ/list.pl >@@ -13,11 +13,14 @@ > # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR > # A PARTICULAR PURPOSE. See the GNU General Public License for more details. > # >-# You should have received a copy of the GNU General Public License along with >-# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, >-# Suite 330, Boston, MA 02111-1307 USA >+# You should have received a copy of the GNU General Public License along >+# with Koha; if not, write to the Free Software Foundation, Inc., >+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. > # > >+use strict; >+use warnings; >+ > use CGI; > use C4::Output; > use C4::Auth; >@@ -41,14 +44,16 @@ my ($template, $loggedinuser, $cookie) = get_template_and_user({ > my $operations = GetOfflineOperations; > > for (@$operations) { >- my $biblio = GetBiblioFromItemNumber(undef, $_->{'barcode'}); >- $_->{'bibliotitle'} = $biblio->{'title'}; >- $_->{'biblionumber'} = $biblio->{'biblionumber'}; >- my $borrower = GetMemberDetails(undef,$_->{'cardnumber'}); >- $_->{'borrowernumber'} = $borrower->{'borrowernumber'}; >- $_->{'borrower'} = join(' ', $borrower->{'firstname'}, $borrower->{'surname'}); >- $_->{'actionissue'} = $_->{'action'} eq 'issue'; >- $_->{'actionreturn'} = $_->{'action'} eq 'return'; >+ my $biblio = GetBiblioFromItemNumber(undef, $_->{'barcode'}); >+ $_->{'bibliotitle'} = $biblio->{'title'}; >+ $_->{'biblionumber'} = $biblio->{'biblionumber'}; >+ my $borrower = GetMemberDetails(undef,$_->{'cardnumber'}); >+ if ($borrower) { >+ $_->{'borrowernumber'} = $borrower->{'borrowernumber'}; >+ $_->{'borrower'} = ($borrower->{'firstname'}?$borrower->{'firstname'}:'').' '.$borrower->{'surname'}; >+ } >+ $_->{'actionissue'} = $_->{'action'} eq 'issue'; >+ $_->{'actionreturn'} = $_->{'action'} eq 'return'; > } > $template->param(pending_operations => $operations); > >diff --git a/offline_circ/process.pl b/offline_circ/process.pl >index d814f74..86b5fda 100755 >--- a/offline_circ/process.pl >+++ b/offline_circ/process.pl >@@ -13,11 +13,14 @@ > # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR > # A PARTICULAR PURPOSE. See the GNU General Public License for more details. > # >-# You should have received a copy of the GNU General Public License along with >-# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, >-# Suite 330, Boston, MA 02111-1307 USA >+# You should have received a copy of the GNU General Public License along >+# with Koha; if not, write to the Free Software Foundation, Inc., >+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. > # > >+use strict; >+use warnings; >+ > use CGI; > use C4::Auth; > use C4::Circulation; >diff --git a/offline_circ/process_koc.pl b/offline_circ/process_koc.pl >index 6c48ffb..736d918 100755 >--- a/offline_circ/process_koc.pl >+++ b/offline_circ/process_koc.pl >@@ -13,9 +13,9 @@ > # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR > # A PARTICULAR PURPOSE. See the GNU General Public License for more details. > # >-# You should have received a copy of the GNU General Public License along with >-# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, >-# Suite 330, Boston, MA 02111-1307 USA >+# You should have received a copy of the GNU General Public License along >+# with Koha; if not, write to the Free Software Foundation, Inc., >+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. > # > > use strict; >diff --git a/offline_circ/service.pl b/offline_circ/service.pl >index 8d1dd5f..ce0ab4a 100755 >--- a/offline_circ/service.pl >+++ b/offline_circ/service.pl >@@ -13,11 +13,14 @@ > # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR > # A PARTICULAR PURPOSE. See the GNU General Public License for more details. > # >-# You should have received a copy of the GNU General Public License along with >-# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, >-# Suite 330, Boston, MA 02111-1307 USA >+# You should have received a copy of the GNU General Public License along >+# with Koha; if not, write to the Free Software Foundation, Inc., >+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. > # > >+use strict; >+use warnings; >+ > use CGI; > use C4::Auth; > use C4::Circulation; >@@ -30,17 +33,17 @@ my ($status, $cookie, $sessionId) = C4::Auth::check_api_auth($cgi, undef); > my $result; > > if ($status eq 'ok') { # if authentication is ok >- if ( $cgi->param('pending') eq 'true' ) { # if the 'pending' flag is true, we store the operation in the db instead of directly processing them >- $result = AddOfflineOperation( >- $cgi->param('userid') || '', >+ if ( $cgi->param('pending') eq 'true' ) { # if the 'pending' flag is true, we store the operation in the db instead of directly processing them >+ $result = AddOfflineOperation( >+ $cgi->param('userid') || '', > $cgi->param('branchcode') || '', > $cgi->param('timestamp') || '', > $cgi->param('action') || '', > $cgi->param('barcode') || '', > $cgi->param('cardnumber') || '', >- ); >- } else { >- $result = ProcessOfflineOperation( >+ ); >+ } else { >+ $result = ProcessOfflineOperation( > { > 'userid' => $cgi->param('userid'), > 'branchcode' => $cgi->param('branchcode'), >@@ -49,8 +52,8 @@ if ($status eq 'ok') { # if authentication is ok > 'barcode' => $cgi->param('barcode'), > 'cardnumber' => $cgi->param('cardnumber'), > } >- ); >- } >+ ); >+ } > } else { > $result = "Authentication failed." > } >-- >1.7.5.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 5877
:
3315
|
3400
|
4661
|
4861
|
4862
|
5681
|
5683
|
6540
|
7218
|
7250
|
7618
|
7715
|
7716
|
7717
|
7718
| 7812 |
7960