Bugzilla – Attachment 2433 Details for
Bug 5072
Filling an order page with no budget defined causes a 500 error
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
proposed patch
0001-Bug-5072-prevent-creating-new-orders-if-there-are-no.patch (text/plain), 4.52 KB, created by
Robin Sheat
on 2010-07-29 04:17:38 UTC
(
hide
)
Description:
proposed patch
Filename:
MIME Type:
Creator:
Robin Sheat
Created:
2010-07-29 04:17:38 UTC
Size:
4.52 KB
patch
obsolete
>From 95d1efd4fe9d98f3552ec16861413c8ce61ce15e Mon Sep 17 00:00:00 2001 >From: Robin Sheat <robin@catalyst.net.nz> >Date: Thu, 29 Jul 2010 16:10:52 +1200 >Subject: [PATCH] Bug 5072 - prevent creating new orders if there are no valid budgets > >On the basket editing screen, the links to add orders to a basket are >hidden unless a valid fund is available. >--- > .gitignore | 2 ++ > C4/Budgets.pm | 12 ++++++------ > acqui/basket.pl | 13 +++++++++++++ > acqui/neworderempty.pl | 2 +- > .../prog/en/modules/acqui/basket.tmpl | 4 ++++ > 5 files changed, 26 insertions(+), 7 deletions(-) > create mode 100644 .gitignore > >diff --git a/.gitignore b/.gitignore >new file mode 100644 >index 0000000..d38c149 >--- /dev/null >+++ b/.gitignore >@@ -0,0 +1,2 @@ >+*.swp >+*~ >diff --git a/C4/Budgets.pm b/C4/Budgets.pm >index 005bba8..97f6fcd 100644 >--- a/C4/Budgets.pm >+++ b/C4/Budgets.pm >@@ -660,11 +660,11 @@ sub GetBudget { > return $result; > } > >-=head2 GetBudgets >+=head2 GetChildBudgetsSpent > >- &GetBudgets($filter, $order_by); >+ &GetChildBudgetsSpent($budget-id); > >-gets all budgets >+gets the total spent of the level and sublevels of $budget_id > > =cut > >@@ -687,11 +687,11 @@ sub GetChildBudgetsSpent { > return $total_spent; > } > >-=head2 GetChildBudgetsSpent >+=head2 GetBudgets > >- &GetChildBudgetsSpent($budget-id); >+ &GetBudgets($filter, $order_by); > >-gets the total spent of the level and sublevels of $budget_id >+gets all budgets > > =cut > >diff --git a/acqui/basket.pl b/acqui/basket.pl >index 005fcb9..6671ee8 100755 >--- a/acqui/basket.pl >+++ b/acqui/basket.pl >@@ -287,6 +287,18 @@ if ( $op eq 'delete_confirm' ) { > > my $contract = &GetContract($basket->{contractnumber}); > my @orders = GetOrders($basketno); >+ >+ my $borrower= GetMember('borrowernumber' => $loggedinuser); >+ my $budgets = GetBudgetHierarchy(q{},$borrower->{branchcode},$borrower->{borrowernumber}); >+ my $has_budgets = 0; >+ foreach my $r (@{$budgets}) { >+ if (!defined $r->{budget_amount} || $r->{budget_amount} == 0) { >+ next; >+ } >+ $has_budgets = 1; >+ last; >+ } >+ > $template->param( > basketno => $basketno, > basketname => $basket->{'basketname'}, >@@ -316,6 +328,7 @@ if ( $op eq 'delete_confirm' ) { > basketgroups => $basketgroups, > grouped => $basket->{basketgroupid}, > unclosable => @orders ? 0 : 1, >+ has_budgets => $has_budgets, > ); > } > >diff --git a/acqui/neworderempty.pl b/acqui/neworderempty.pl >index a580ae7..39bf0d9 100755 >--- a/acqui/neworderempty.pl >+++ b/acqui/neworderempty.pl >@@ -92,7 +92,7 @@ use C4::ImportBatch qw/GetImportRecordMarc SetImportRecordStatus/; > > my $input = new CGI; > my $booksellerid = $input->param('booksellerid'); # FIXME: else ERROR! >-my $budget_id = $input->param('budget_id') || 0; # FIXME: else ERROR! >+my $budget_id = $input->param('budget_id') || 0; > my $title = $input->param('title'); > my $author = $input->param('author'); > my $publicationyear = $input->param('publicationyear'); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tmpl >index 3021681..fef0708 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tmpl >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tmpl >@@ -288,6 +288,7 @@ > <!-- TMPL_UNLESS name="closedate" --> > <fieldset id="acqui_basket_add"> > <legend>Add Order To Basket</legend> >+ <!-- TMPL_IF NAME="has_budgets" --> > <form action="/cgi-bin/koha/acqui/neworderbiblio.pl" method="post"> > <input type="hidden" name="booksellerid" value="<!-- TMPL_VAR NAME="booksellerid" -->" /> > <input type="hidden" name="basketno" value="<!-- TMPL_VAR NAME="basketno" -->" /> >@@ -299,6 +300,9 @@ > <li><a href="/cgi-bin/koha/acqui/addorderiso2709.pl?booksellerid=<!-- TMPL_VAR NAME="booksellerid" -->&basketno=<!-- TMPL_VAR NAME="basketno" -->"> From a staged file</a></li> > </ul> > </form> >+ <!-- TMPL_ELSE --> >+ You can't create any orders unless you first <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">define a budget and a fund</a>. >+ <!-- /TMPL_IF --> > </fieldset> > <!-- /TMPL_UNLESS --> > <!-- /TMPL_UNLESS --> >-- >1.7.0.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 5072
:
2433
|
4802
|
4803
|
4804
|
4805
|
4818
|
4819