Commit graph

35 commits

Author SHA1 Message Date
9c5b819100 Bug 15009: QA follow-up
This patch adds a test to check the unicity of auth cats, simplify
the GetBudgetAuthCats subroutine and make it return an arrayref of scalar
instead of an arrayref of hashref with only 1 key.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2016-04-29 13:00:21 +00:00
66aacace08 Bug 16154: CGI->multi_param - Declare a list
This patch replaces the occurrences of
  my @foo = $cgi->param('foo');
with
  my @foo = $cgi->multi_param('foo');

perl -p -i -e
's/^(\s*my\s*@\w+\s*=\s*)\$(cgi|input|query)\->param\(/$1\$$2\->multi_param\(/xms'
**/*.pl

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
2016-04-26 23:16:42 +00:00
1538e9ecf4 Bug 15084: Replace C4::Budgets::GetCurrencies with Koha::Acquisition::Currencies->search
Most part of the code here is unnecessary complex. We should selected
the currency if it is selected, that's all :)

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
2016-03-03 20:39:01 +00:00
ff1579de6d Bug 15258: Fix Perl scripts declaring unused variables
Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

All affected files tested with `perl -c`.
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
2015-12-30 17:24:45 -07:00
ac541e0fa1 Bug 15344: Remove unucessary call to GetMemberDetails
This subroutine does a lot a processing and should only be called when
necessary.
In the get_template_and_user subroutine (so called from any pages of
Koha), it is call to pass the branchcode, title, firstname, surname and
borrowernumber values for the logged in user.
This subroutine calls GetMemberAccountRecords which retrieve the items
infos for all accountlines entries of the logged in user.
On members/members.pl, let's say you have 74 entries in the accountlines
tables, the page will execute 115 SELECT instead of 35 if you don't have any
accountlines entries.
With this patch, the number of SELECT is always 31.

To test this patch you should have technical skills to know what to do.

Note that USER_INFO was an array of... 1 element. Now it's a hashref.

Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2015-12-30 11:53:18 +00:00
Mark Tompsett
fea7b9b4d4 Bug 4502: An attempt to make things more sensible.
The reason the budget_period_id was not defined was because in
two cases it was not passed! This patch adds those missing
parameters. And as a result, cuts out the attempt to default the
authcat to '' unless the budget_period_id is defined.

Additionally, the start and end months don't seem to be passed,
so rather than have it blow up, checking them forces the else
case logic.

budget_period_id is the budget id. If you have two budgets,
you can craft a URL to work with budget_period_id matching
those two ids. Anything else should trigger the new error which
was modified to reflect more of what the problem is.

Follow the test plan in comment #6. Feel free to also to attempt
crafting URLs and triggering errors.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Well, works and does not explode any more
No errors

To trigger the new message simply put /cgi-bin/koha/admin/aqplan.pl
on your staff page, an intriguing 'Planning for by Asort1' appears :)

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-11-19 20:23:46 -03:00
Jonathan Druart
0a39123771 Bug 4502: Catch software error if no active budget defined
TEST PLAN
---------
0) Back up your database.
1) In mysql client:
   > DROP DATABASE {your koha database name};
   > CREATE DATABASE {your koha database name};
   > QUIT;
2) Go to the staff client, and install all the default
   and optional things -- except patrons. :)
3) Log into staff client.
4) Create a patron -> New Patron -> Staff
5) Enter data and Save
6) More -> Set Permissions
7) Make superlibrarian
8) Log out
9) Log in as new superlibrarian
10) Acquisitions -> Budgets -> New Budget
11) Enter a non-active budget with some funds.
    -- Once saved, it should list in the inactive budgets.
12) Click on the name.
13) Click on one of the Planning submenu options.
14) Click the 'Submit' button in the Filter area.
    -- This should trigger the blow up.
15) Apply the patch
16) Repeat steps 12-15
    -- The kaboom is avoided and a nice message given.

NOTE: This does not solve all the problems in this ugly, ugly
      module area. It does solve the one thing it is meant to:
      that nasty kaboom.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-11-19 20:23:46 -03:00
Marc Véron
e4cc11ee13 Bug 14931: Remove C4::Dates from files admin/aq*.pl
This patch removes C4::Dates from:

- admin/aqbudgets.pl
- admin/aqplan.pl
- admin/aqcontract.pl

To test:

- Apply patch

- Go to Home > Adminstration > Budgets > All funds
  (admin/aqbudgets.pl)
- Verify that everything displays as before

- Edit one of the funds and click on 'Planning - Plan by months'
  (admin/aqplan.pl)
- Verify that planning works as before

- Go to Home > Acquisitions, search for an active vendor and view the vendor
- Click on 'Contracts' at the left
  (admin/aqcontract.pl)
- Create and edit contracts and verify that it works OK.
  (Note: there is no help for this page, see Bug 14929)

Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>
Works as advertised. Tested with dateformat syspref
Dates in planning by months not needed to be on iso format, aqplan.pl
uses instead Date::Calc

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-10-29 12:00:28 -03:00
e0ed9cbcf6 Bug 14649: Fix regression - display fund name on budget planning
A patch from bug 11714 removes 'budget_name_indent', which was useless.
The script and the template should use the budget_name value.

Note that this patch impacts the CSV export, which does not work, so it cannot be
tested.

Test plan:
Edit a fund and click on one of the Planning value (by months, etc.)
The "Fund name" column should be correctly populated with the fund
names.

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-09-07 11:45:26 -03:00
Mark Tompsett
63427fce60 Bug 14428: Remove C4::Input
Jonathan Druart agreed that C4::Input is vestigial code that should be removed.
Here is how I checked. First I found where C4::Input was used. Then, I checked
what functions are in the package: just checkdigit. Then, I confirmed that
checkdigit is not used at all in any acquisition, administration, or member
related perl scripts. Lastly, I took a look at our supposed test file for the
package. It was painfully sparse.

As such, this patch removes the test file and the package file, and removes
C4::Input references from these six files:
- acqui/addorderiso2709.pl
- acqui/basketgroup.pl
- acqui/neworderempty.pl
- acqui/uncertainprice.pl
- admin/aqplan.pl
- members/memberentry.pl
NOTE: neworderempty had 3 lines of it?! Didn't anyone see that?!

Here is the output of what I did to confirm this correction:

mtompset@debian:~/kohaclone$ git reset --hard origin/master
HEAD is now at 6e9086f Bug 3206: (QA followup) missing comma on sysprefs.sql
mtompset@debian:~/kohaclone$ git grep C4::Input
C4/Input.pm:package C4::Input; #assumes C4/Input
C4/Input.pm:C4::Input - Miscellaneous sanity checks
C4/Input.pm:  use C4::Input;
acqui/addorderiso2709.pl:use C4::Input;
acqui/basketgroup.pl:use C4::Input;
acqui/neworderempty.pl:use C4::Input;
acqui/neworderempty.pl:use C4::Input;
acqui/neworderempty.pl:use C4::Input;
acqui/uncertainprice.pl:use C4::Input;
admin/aqplan.pl:use C4::Input;
members/memberentry.pl:use C4::Input;
t/Input.t:        use_ok('C4::Input');
mtompset@debian:~/kohaclone$ grep sub C4/Input.pm
sub checkdigit ($;$) {
                my $temp2 = substr($infl,$i,1);
        if ($rem eq substr($infl,8,1)) {
} # sub checkdigit
mtompset@debian:~/kohaclone$ grep checkdigit `find acqui -type f`
mtompset@debian:~/kohaclone$ grep checkdigit `find admin -type f`
mtompset@debian:~/kohaclone$ grep checkdigit `find members -type f`
mtompset@debian:~/kohaclone$ cat t/Input.t

use strict;
use warnings;

use Test::More tests => 1;

BEGIN {
        use_ok('C4::Input');
}

Apply this patch, and the output of git grep C4::Input will be empty.
Run koha qa test tools (kind of overkill)

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-07-10 10:53:56 -03:00
Stefan Weil
3f3a29f796 Bug 14383: admin: Fix some typos in comments and documentation
Most of them were found and fixed using codespell.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-06-22 17:34:46 -03:00
Jonathan Druart
a6c9bd0eb5 Bug 9978: Replace license header with the correct license (GPLv3+)
Signed-off-by: Chris Nighswonger <cnighswonger@foundations.edu>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>

http://bugs.koha-community.org/show_bug.cgi?id=9987

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-04-20 09:59:38 -03:00
Jonathan Druart
934de70eec Bug 3969: Fix funds search
The funds search does not work at all.
On the budget and the budget plan page, the library dropdown list is
empty.

Test plan:
On the budget, the budget plan and the fund pages, confirm that you are
able to search a fund by code (or name) and the library dropdown list is
correctly filled.

Tested with several combinations. Works as expected.
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Tested various combinations, no problems found.
Passes tests and QA script.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-03-31 10:12:44 -03:00
Jonathan Druart
e20270fec4 Bug 11944: use CGI( -utf8 ) everywhere
Signed-off-by: Paola Rossi <paola.rossi@cineca.it>
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Dobrica Pavlinusic <dpavlin@rot13.org>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-01-13 13:07:21 -03:00
Jonathan Druart
5afb6a30ca Bug 12979: Price formatting should only be defined at one place
There are some places where the price format is defined.
All these occurrences should be removed use the way introduced by bug
12844.

Test plan:
1/ Verify you don't see any price formatting change on the basketgroup pdf
(for layout2pages, payout2pagesde, layout3pages and layout3pagesfr).
2/ On admin/aqbudgetperiods.pl, the budget total should be unchanged
too.

Signed-off-by: Paola Rossi <paola.rossi@cineca.it>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-07 15:03:30 -03:00
Jonathan Druart
4bdc803120 Bug 12844: Use Koha::Number::Price where it can be useful
This patch use the new module into pl and tt script.

Note that we could use it in the acqui/pdfformat/layout*.pm files.

Test plan:
1/ Verify that the acquisition home page displayes the prices as before.
2/ Verify that the budgets page displayes the prices as before.
3/ Verify that the funds page displayes the prices as before.
4/ Verify that the planning page displayes the prices as before. (Note
that 1 price is now formatted: 'Fund remaining').
5/ Create an order from a staged file. This stage file should contain a
formatted price.

Signed-off-by: Paola Rossi <paola.rossi@cineca.it>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-10-27 12:56:21 -03:00
Bernardo Gonzalez Kriegel
1b25d910ae Bug 766: Remove CGI::scrolling_list from aqplan.pl
This patch removes 3 occurences on aqplan.pl

To test:
1. You need a budget and a fund
2. Apply the patch
3. Go to Aquisitions, click on your fund
4. Select one of the options on pulldown Planning
e.g. "Plan by months"
5. Now to the left there are two boxes, Filter and Export

a) Filter: (1) pulldown below 'Select planning type'
check that works selecting other values and submit
This pulldown showed originally code types,
untranslatable BTW. Added a TT block to allow translation
and shows legends that match Planning pulldown, but not
the order.

b) Export: pulldowns for filetype (2) and delimiter (3)
Those have originally one value each, and for me Export
does not work, before or after patch, but check that
pulldown exist.

Notes:
A) 5.a) I can change de order of main Planning pulldown,
is harcoded. The values for Filter pulldown are sorted on
aqplan.pl. Is one or the other.
If desired, TT block can be moved to includes/budgets-admin-toolbar.inc
(where hardcoded Planning lives)

B) 5.b) Moved 'Export' legend inside it's box, like Filter.

C) Finally: there is something strange, before or after patch.
There is an empty option 'Planning by " if you select planning
using main pulldown, it disappears if you select planning using
Filter (not a mistery, using Planning fills $auth_cats_loop,
using Filter submit button does not)

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Looks like this needs more work, but no regressions found that were
caused by the patch.
Passes tests and QA script.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-08-13 10:11:01 -03:00
afd2418d73 Bug 11349: Change .tmpl -> .tt in scripts using templates
Since we switched to Template Toolkit we don't need to stick with the
sufix we used for HTML::Template::Pro.

This patch changes the occurences of '.tmpl' in favour of '.tt'.

To test:
- Apply the patch
- Install koha, and verify that every page can be accesed

Regards
To+

P.S. a followup will remove the glue code.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-07-17 11:05:49 -03:00
Jonathan Druart
14def333db Bug 766: remove disused routine buildCGISort
buildCGISort can be deleted.

Test plan:
  git grep buildCGISort
should return no result.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

No more buildCGISort

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-04 23:03:24 +00:00
Julian Maurice
203757e353 Bug 7304: More permissions for budgets
- Possibility to add users to a budget
- Restrictions changed to:
  - None
  - Owner
  - Owner and users
  - Owner, users and library
- Restricted users cannot spent on these budgets (they cannot modify them
  either)

Modified pages:
 - admin/aqbudgets.pl
 - admin/aqplan.pl
 - suggestion/suggestion.pl
 - acqui/acqui-home.pl
 - acqui/addorderiso2709.pl
 - acqui/basket.pl
 - acqui/neworderempty.pl

Unit tests in t/Budgets/CanUserUseBudget.t and t/Budgets/CanUserModifyBudget.t

Bug 7304 tmp

Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
2012-06-27 16:25:44 +02:00
Colin Campbell
263dded818 Bug 6752: Be stricter with utf-8 encoding of output
use encoding(UTF-8) rather than utf-8 for stricter
encoding
Marking output as ':utf8' only flags the data as utf8
using :encoding(UTF-8) also checks it as valid utf-8
see binmode in perlfunc for more details
In accordance with the robustness principle input
filehandles have not been changed as code may make
the undocumented assumption that invalid utf-8 is present
in the imput
Fixes errors reported by t/00-testcritic.t
Where feasable some filehandles have been made lexical rather than
reusing global filehandle vars

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
2012-01-27 12:11:06 +01:00
Chris Cormack
1c429d8f63 Bug 6679: Fixing admin/aqplain :encoding(UTF-8) gives strict validation
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
2011-11-06 17:36:41 +01:00
Chris Cormack
0dbad3efce Bug 6834 : Removing last of the $template->{param_map}
Signed-off-by: Ian Walls <ian.walls@bywatersolutions.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
2011-09-03 06:37:50 +12:00
Colin Campbell
1a03a8a38e Bug 6181: Remove CGI Scolling lists from C4::Budgets
As noted on bug 766 more cases of usage of
CGI::scrolling_list were imported into C4::Budgets
Even if we were not trying to remove usage of this
the C4 modules are not the place to generate markup
Most of these routines are noise as they are not used in
any current code but cause confusion and increase
maintenance overhead. They are removed

The sort dropboxes on order create are the only
references in current templates to these routines
they have been replaced by a select list generated
by the markup.
They can probably be removed too but their existence
although the option that causes them to be displayed
seems unlikely to be set. I've left them pending
resolution of some of the inconsistencies and
confusions surrounding Budgts

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
2011-08-14 20:24:31 +12:00
4b69538f9b Fix for Bug 4913 - Budget pages should show currency name instead of symbol
This patch adds a new include file to handle the display of the active
currency name and a warning if no currency is active.

Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
2010-11-15 15:13:55 +13:00
b49a0a30a1 bug 4176: remove references to unimplemented system preference MIME
The intended functionality of this system preference was never
implemented.  To avoid template changes prior to 3.2.0, put in
hard-coded string 'CSV' to (accurately) identify the type of
the output files in the affected reports.

Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
2010-10-21 21:36:45 -04:00
Alex Arnaud
47f49d2e7f (BUG #4857) aqplan.pl: consideration of Planning categories with authorised values
Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
2010-06-24 20:42:47 -04:00
Nahuel ANGELINETTI
d43cf08837 (MT #2565) fix aqplan csv export, and turn off debug
This fix the csv export that doesn't export correctly the budget name, it's empty column.
And it turn off some SQL debug that slow down the result of the page and the csv export.

Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
2010-05-26 10:53:01 -04:00
Donovan Jones
bce3e2e619 Bug 2505 - Add commented use warnings where missing in the admin/ directory 2010-04-21 20:20:11 +12:00
Lars Wirzenius
2c67656108 Fix FSF address in directory admin/
Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
2010-03-16 20:17:50 -04:00
Henri-Damien LAURENT
9d6df13554 (bug #4135) fix aqplan form
This fix the form to have always the submit button, and fix security issue in aqplan.pl(authnotrequired set to 1)

Conflicts solved:

	koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tmpl

Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
2010-02-17 05:10:11 -05:00
Paul Poulain
521bb9654d code cleaning
* removed unused sub in Budgets.pm
* lot of cleaning in aqplan.pl
* typo changes in aqplan.tmpl
2009-09-30 11:30:25 +02:00
Paul Poulain
d347b15163 budgfixing budgets & planning and code cleaning
* fix a bug for new orders budget : the Asort1 was displayed by default. Now, it's the sortN_authcat of the 1st budget (the one selected by default)
* change in GetBudgetAuthCats : returns all auth values used by at least one budget (not Asort* categories, as previously)
* code cleaning in GetAuthvalueDropbox (and select aqbudgets.* instead of *, to avoid data corruption due to duplicate column name)
2009-09-30 11:30:25 +02:00
Mason James
5022a8583a big aqplan commit v2 for mantis:1177 2009-09-30 11:30:25 +02:00
Paul Poulain
1d4fb38a27 planning management
for each budget period and budget, the library can enter planning on branches, itemtype, month or any auth_value selected as planning category for a given budget
2009-09-30 11:30:16 +02:00