Bug 6842 FU : library transfer limits edits not stored

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Bug 6842 FU : library transfer limits edits not stored

Henri-Damien LAURENT
Followup :
Changes the DeleteBranchTransferLimits signature :
one now needs to delete only the limits for ONE branch
---
 C4/Circulation.pm               |   11 +++++++----
 admin/branch_transfer_limits.pl |    3 ++-
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/C4/Circulation.pm b/C4/Circulation.pm
index 02e13c0..efd7dc0 100644
--- a/C4/Circulation.pm
+++ b/C4/Circulation.pm
@@ -2938,14 +2938,17 @@ sub CreateBranchTransferLimit {
 
 =head2 DeleteBranchTransferLimits
 
-  DeleteBranchTransferLimits();
+DeleteBranchTransferLimits($frombranch);
+
+Deletes all the branch transfer limits for one branch
 
 =cut
 
 sub DeleteBranchTransferLimits {
-   my $dbh = C4::Context->dbh;
-   my $sth = $dbh->prepare("TRUNCATE TABLE branch_transfer_limits");
-   $sth->execute();
+    my $branch = shift;
+    my $dbh    = C4::Context->dbh;
+    my $sth    = $dbh->prepare("DELETE FROM branch_transfer_limits WHERE fromBranch = ?");
+    $sth->execute($branch);
 }
 
 sub ReturnLostItem{
diff --git a/admin/branch_transfer_limits.pl b/admin/branch_transfer_limits.pl
index 8c6f42e..e7422a6 100755
--- a/admin/branch_transfer_limits.pl
+++ b/admin/branch_transfer_limits.pl
@@ -93,7 +93,8 @@ while ( my $row = $sth->fetchrow_hashref ) {
 
 ## If Form Data Passed, Update the Database
 if ( $input->param('updateLimits') ) {
- DeleteBranchTransferLimits();
+    DeleteBranchTransferLimits($branchcode);
+
 
  foreach my $code ( @codes ) {
  foreach my $toBranch ( @branchcodes ) {
--
1.7.7.3

_______________________________________________
Koha-patches mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-patches
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/