From 251048f6a85ef3be180bba8829b546283b096acf Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Thu, 15 Sep 2016 14:11:00 +0000 Subject: [PATCH] Bug 14576 (QA Followup) Fix undelcared use of $item Move strings from js files Delete duplicated lines --- C4/Circulation.pm | 12 ++++-------- C4/Items.pm | 1 + C4/Reserves.pm | 2 ++ koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt | 2 ++ koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js | 4 ++-- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 2f6f0a5..3c5d832 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -1385,14 +1385,10 @@ sub AddIssue { } ); - if ( $item->{'location'} eq 'CART' && $item->{'permanent_location'} ne 'CART' ) { - ## Item was moved to cart via UpdateItemLocationOnCheckin, anything issued should be taken off the cart. - CartToShelf( $item->{'itemnumber'} ); - } - $item->{'issues'}++; - if ( C4::Context->preference('UpdateTotalIssuesOnCirc') ) { - UpdateTotalIssues($item->{'biblionumber'}, 1); - } + if ( $item->{'location'} eq 'CART' && $item->{'permanent_location'} ne 'CART' ) { + ## Item was moved to cart via UpdateItemLocationOnCheckin, anything issued should be taken off the cart. + CartToShelf( $item->{'itemnumber'} ); + } $item->{'issues'}++; if ( C4::Context->preference('UpdateTotalIssuesOnCirc') ) { diff --git a/C4/Items.pm b/C4/Items.pm index 20ba802..a843b25 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -625,6 +625,7 @@ sub ModItemTransfer { my ( $itemnumber, $frombranch, $tobranch ) = @_; my $dbh = C4::Context->dbh; + my $item = GetItem( $itemnumber ); # Remove the 'shelving cart' location status if it is being used. CartToShelf( $itemnumber ) if ( $item->{'location'} eq 'CART' && $item->{'permanent_location'} ne 'CART' ); diff --git a/C4/Reserves.pm b/C4/Reserves.pm index 0385069..6fbb911 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -1275,6 +1275,7 @@ sub ModReserveStatus { my $sth_set = $dbh->prepare($query); $sth_set->execute( $newstatus, $itemnumber ); + my $item = GetItem($itemnumber); if ( ( $item->{'location'} eq 'CART' && $item->{'permanent_location'} ne 'CART' ) && $newstatus ) { CartToShelf( $itemnumber ); } @@ -1350,6 +1351,7 @@ sub ModReserveAffect { if ( !$transferToDo && !$already_on_shelf ); _FixPriority( { biblionumber => $biblionumber } ); + my $item = GetItem($itemnumber); if ( ( $item->{'location'} eq 'CART' && $item->{'permanent_location'} ne 'CART' ) ) { CartToShelf( $itemnumber ); } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt index 22fb001..5aa3576 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt @@ -44,6 +44,8 @@ var MSG_SESSION_TIMED_OUT = _( "You need to log in again, your session has timed out" ); var MSG_DATA_NOT_SAVED = _( "Error; your data might not have been saved" ); var MSG_LOADING = _( "Loading..." ); + var MSG_ALL_VALUE_WARN = _("Note: _ALL_ value will override all other values"); + var MSG_UPD_LOC_FORMAT_WARN = _("The following values are not formatted correctly:"); //]]> diff --git a/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js b/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js index ff74b02..f86abee 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js +++ b/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js @@ -141,7 +141,7 @@ $( document ).ready( function () { $("#pref_UpdateItemLocationOnCheckin").change(function(){ var the_text = $(this).val(); var alert_text = ''; - if ( the_text.indexOf('_ALL_:') != -1 ) alert_text= _("Note: _ALL_ value will override all other values") + '\n'; + if ( the_text.indexOf('_ALL_:') != -1 ) alert_text = MSG_ALL_VALUE_WARN + '\n'; var split_text =the_text.split("\n"); var alert_issues = ''; var issue_count = 0; @@ -152,7 +152,7 @@ $( document ).ready( function () { issue_count++; } } - if (issue_count) alert_text += "\n"+_("The following values are not formatted correctly:")+"\n"+alert_issues; + if (issue_count) alert_text += "\n"+ MSG_UPD_LOC_FORMAT_WARN +"\n"+alert_issues; if ( alert_text.length ) alert(alert_text); }); -- 2.1.4