Commit graph

56 commits

Author SHA1 Message Date
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
6f599652b1 Bug 13215: The same letter code can be used for several libraries
This patch fixes a major issue introduced by the
commit 5c4fdcf Bug 11742: A letter code should be unique.

The interface should let the possibility to create a default template
letter and some specific ones, with the same letter code (letter.code).

The patches submitted on bug 11742 tried to fix an issue based on a
(very bad) assumption: letter.code should be considered as a primary key and
should be uniq.

This patch reintroduces this behavior.
Note that the interface will block a letter code used in different
module (this is consistent not to have the same letter code used for different
needs).

This patch is absolutely not perfect, it just tries to change as less
change as possible and to use new tested subroutines.

Test plan:
1/ Verify that the problem raised on bug 11742 does not appears anymore.
2/ Verify there are no regression on adding, editing, copying, deleting
letters.
3/ Verify you are allowed to create a default letter template with a letter
code and to reuse for a specific letter (i.e. for a given library).

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-27 11:42:14 -03:00
6997276e51 Bug 13330 - All overdue items with fines returned via checkouts table will have fines forgiven!
Due to a disconnect between how booleans are handled in Perl vs JSON,
all checkins done from the checkouts table will have fines forgiven!
This is because the parameters sent to svc/checkin are coded in JSON
and the JSON false is treated in Perl as the string 'false' which
evaluates to true!

Test Plan:
1) Find a patron with an overdue item that has a fine
2) Return the item via the checkouts table on circulation.pl or moremember.pl
3) Note the fine is forgiven
4) Apply this patch
5) Repeat steps 1-2
6) Note the fine is no longer forgiven

Signed-off-by: Liz Rea <liz@catalyst.net.nz>
Verified bug, fix corrects the problem.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Also tested waiving fines form the check-in page still works.
Passes tests and QA script.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-25 15:25:14 -03:00
463d52ce15 Bug 13099 - "Item hasn't been transferred yet" shows pickup branch rather than holding branch
The "Item hasn't been transferred yet" message on circulation.pl and
moremember.pl in the holds table shows the pickup branch rather than
holding branch.

Test Plan:
1) Place an item on hold for a patron
2) Check the item in to set the hold to waiting
3) Place an item level hold for another patron,
   make the pickup location be a different library
4) Load the holds tab on the patron details page for the second patron
5) Note it says "Item hasn't been transferred yet from <Pickup Library>"
6) Apply this patch
7) Repeat step 4
8) Note the library listed is now the holding library

Signed-off-by: Paola Rossi <paola.rossi@cineca.it>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described and passes tests and QA script.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-20 18:10:19 -03:00
Jonathan Druart
dddde58967 Bug 9043: The comma (,) should be kept to separate multi-valuated prefs
The prefs language and opaclanguages used the comma to separate the
different values.

The new prefs OpacAdvSearchMoreOptions and OpacAdvSearchOptions should
do the same.

To reproduce the issue: update the language pref (or opaclanguages) and
refresh the page.
=> The pref values are not checked anymore and the language selection
(bottom of the page) does not appear.

Test plan:
1/ Verify that the behavior described above is fixed.
2/ Verify that the original test plan of bug 9043 still passes.

Note: The 2 OpacAdvSearchMoreOptions and OpacAdvSearchOptions pref
values are overwritten but the feature have just been pushed recently.
It should not affect a production environment.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

I was able to reproduce the issue and verify that this patch corrected
the problem. Langage selection and OpacAdvSearchOptions worked
correctly.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-17 14:49:59 -03:00
13fda83783 Bug 13195 - Regression: Circulation checkouts table no longer shows item type description
Another regression caused by Bug 11703: The list of checkouts on the
circulation and patron detail page shows item type codes instead of the
full description.

Test Plan:
1) View a patron's checkouts, note the Item type column displays the
   code rather than the description.
2) Apply this patch
3) Refresh the page, note the description is now displayed

Signed-off-by: Frederic Demians <f.demians@tamil.fr>

Works as described.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>

Works as described, no problems found.
Passes tests and QA script.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-16 21:35:09 -03:00
17e6a8b652 Bug 12778 - Regression: Item lost status doesn't show in list of checkouts
When using the longoverdue script it's possible that items marked lost
remain on the patron account. I think it's important for staff to see
that some items are marked lost - currently the list of checkouts
doesn't show any sign of the lost status.

Test Plan:
1) Find a patron with a checked out lost item
2) Note the lost status is not displayed in the checkouts table
3) Apply this patch
4) Refresh the page, note the lost status now displays
5) Repeat this test plan for a damaged item

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Tested successfully with damaged and multiple lost values.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described, no problems found.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-16 21:15:11 -03:00
Jonathan Druart
0f3a04609c Bug 13232: Search patrons by a first letter should not redirect to a patron detail page
Bug 12833 allows to find a patron with his cardnumber.
But this won't never append if the firstletter parameter is given.

Actually the firstletter param is the only one to take into account if
it exists.

Test plan:
Search patrons by a first letter and verify that the feature is back.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>

To reproduce the problem you need at least one borrower with a blank
cardnumber

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
works as descrobed, no problems found.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-14 09:33:00 -03:00
Jonathan Druart
28ebfafc9b Bug 9043: Syspref improvement: add new type "multiple"
This patch adds a new type "multiple" for syspref.
This new type allows to select several values for one syspref.

Signed-off-by: Koha Team Lyon 3 <koha@univ-lyon3.fr>
Signed-off-by: Jacek Ablewicz <abl@biblos.pk.edu.pl>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-10 12:25:12 -03:00
ca13806073 Bug 10860 - Change "in-house use" to "on-site checkout"
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-03 10:26:22 -03:00
Jonathan Druart
2e72eb8880 Bug 10860: In-House Use
This patch implements the In-House Use feature for Koha.

It adds:
- 2 new sysprefs:
  'In-House Use' to enable/disable this feature
  'In-House Use Forced' to enable/disable the feature for *all* users.
- 2 new columns issues.inhouse_use and old_issues.inhouse_use
- Datatable on the circulation history pages (readingrec) at the OPAC
  and the intranet.

A new checkbox in the Circulation tab. If checked, the issue become a
in-house use (in the statistics and issues tables).
When you check it, the due date changes to the today date.

The syspref "In-House Use Force" allows to force the in-house use to
permit the checkout even if the borrower is debarred or others problems.

In the issue table, a new string (in red) marks the issue as "in-house use".

The circulation history contains 3 tabs : "all", "checkout" and
"in-house use" (OPAC and intranet).

The cronjob script:
If AutomaticItemReturn if off, a library would like not to do a transit
operation manually. This script (to launch each night) do returns
for a specific branches.

Test plan:
1/ Execute the updatedatabase entry
2/ Enable the 'In-House Use' pref.
3/ Checkout a biblio for a patron and check the 'in-house use' checkbox.
4/ Check that the due date is the today date (with 23:59) and is not modifiable.
5/ Click on the check out button and check that the new check out
appears in the table bellow with the "(In-house use)" string.
6/ Go on the circulation history pages (readingrec and opac-readingrec)
and try the 3 tabs. In the last one, your last checkout should appear.
7/ Check in.
8/ Check readingrec pages.
9/ Choose a debarred patron and check that you cannot checkout a biblio
for him.
10/ Switch on the 'In-House Use Forced' pref
11/ You are now allowed to checkout a biblio for the debarred patron.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-03 10:26:19 -03:00
Petter Goksoyr Asen
ca756f44d7 Bug 12590 - Support deletion of biblio in svc API
The /svc endpoint allows you to create and update biblio records.
This patch extends it so that it is also possible to delete a biblio.

Test plan
* Create a new biblio by sending a POST request to /svc/new_bib with a
  marcxml record as request body. Note the biblionumber it gets assigned.
* Make some changes to the marcxml record, and update it by sending
  a POST request to /svc/bib/{bibilonumber}
* Observe that the changes are persisted on the biblio record.
* Now delete the bilblio by sending a DELETE request to
  /svc/bib/{biblionumber}
* Observe that the biblio is indeed gone from the db.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
This works as described and passes tests and QA script.
I tested using curl for a record with and one without items:

curl -X DELETE 'http://localhost:8080/cgi-bin/koha/svc/bib/2' --cookie /tmp/svc.cookies
<?xml version='1.0' standalone='yes'?>
<response>
  <error>This Biblio has items attached, please delete them first before deleting this biblio </error>
</response>

curl -X DELETE 'http://localhost:8080/cgi-bin/koha/svc/bib/3' --cookie /tmp/svc.cookies
<?xml version='1.0' standalone='yes'?>
<response>
  <status>OK, biblio deleted</status>
</response>

The deletion is processed correctly and the indexes are updated.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-10-27 11:13:49 -03:00
8848e72d78 Bug 13020 - Checkouts table default ordering is incorrect
The checkouts table is no longer keeping "today's checkouts" in the
order they were scanned.

Test Plan:
1) Create 3 records "Test 1", "Test 2" and "Test 3" each with one item
2) Check out the items to a patron in the order "Test 2", "Test 1", "Test 3".
3) Note the order is incorrect.
4) Apply this patch
5) Refresh the page
6) Note the order is now correct

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Note that the bug already exists before bug 12550. I checked on a 3.14.x
branch (without the ajax circ stuff), and the order is the same as with
this patch.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-10-19 11:30:58 -03:00
Dobrica Pavlinusic
b8fae8489f Bug 12729 - Overdue items won't show as overdue in red in circulation
It seems that Firefox date parser doesn't like our dates which are
formatted in ISO format like "2014-08-06 00:00:00". This results in
missing red color in overdue dates.

So intead of munching different date formats and JavaScript (and having
to support different browers) this patch moves check for overdue dates
back to mysql and just transfers boolean value to JavaScript so it can
show correct class for date_due.

Test scenario:
1. find borrower with overdue checkouts
2. verify that all dates are black (and are in ISO format)
3. apply this patch
4. reload page and verify that overdue dates turned red

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Tested with different due dates (hourly and not) and different date formats.
Passes tests and QA script.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-09-16 15:17:53 -03:00
Jonathan Druart
0965dfcc15 Bug 12833: Patron search should search on extended attributes
Before Bug 9811, the patron search searched on extended attributes.

This patch restore this behavior.

Test plan:
0/ Create a patron attribute PA
1/ Create a patron A (cardnumber CNA) with PA="foo"
2/ Create a patron B (cardnumber CNB) with PA="foo bar"
3/ Search for CNA should redirect on the patron detail page.
4/ Search for "foo" should display the search result with 2 results.

Signed-off-by: Nick Clemens <nick@quecheelibrary.org>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
'Searchable' patron attributes can now be searched for again.
Works as described, passes stests and QA script.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-09-09 10:08:59 -03:00
Jonathan Druart
782d9613da Bug 12662: (follow-up) Ajax-based check in does not work for some system preference settings enabled
ModItem is needed too.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-07-30 14:29:29 -03:00
Jacek Ablewicz
0f4ceeb38d Bug 12662: Ajax-based check in does not work for some system preference settings enabled
To reproduce:

- enable "InProcessingToShelvingCart" or "ReturnToShelvingCart"
system preference,
- for a sample patron with 1+ checkouts, try to check in some item[s]
using checkboxes in the "Check in" column in the checkouts table
which is displayed in the "Check out" or "Details" patron account tabs,
- observe that clicking "Renew or return checked items" button only
results in ajax "spinning wheel" stuck in infinite loop; check-in
operation is not performed.

To test:

- follow the steps above to reproduce this bug
- apply patch
- redo the test; ensure that this issue is no longer reproductible.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-07-30 14:29:08 -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
6cc316f999 Bug 11703: (qa followup) consistency in svc
This patch removes the trailing .pl from the introduced svc scripts.
Also removes a leftover (wrong license text)

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-07-03 12:38:13 -03:00
a31cac1693 Bug 11703 [QA Followup] - Restore showing earliest renewal date for 'too early' renewals
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>

Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.org>
2014-07-03 11:22:10 -03:00
0badd2bcb5 Bug 11703 [QA Followup]
* Bold record title, fix table width
* Change output_pref_due to output_pref
* Retain functionality of IssuesDefaultSortOrder system preferences
* Use datatables.inc in circulation.tt
* Fix up holds table details
* Add plugin to about
* fix relatives' checkouts
* add too_many string
* remove dead syspref from db
* Sort relatives' checkouts and holds tables client side
* Provide context for translation of strings
* Fix unterminated string literal, add missing paren
* Add replacement of _AUTHOR_ with title's author for holds
* Format prices correctly
* Format checkout dates correctly

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>

Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.org>
2014-07-03 11:22:10 -03:00
82275fa2db Bug 11703 - Convert checkouts table to ajax datatable
When a patron has many checked out items, circulation.pl can take a very
long time to load ( on the order of minutes in some cases ). This is
primarily due to the processing of the previous checkouts list. If we
convert to this table to a datatable that fetches its data via ajax, we
can make circulation.pl far more responsive. The same should be done
with relative's checkouts as well.

Test Plan:
1) Apply this patch
2) Observe that the checkouts and relatives' checkouts tables
   are now loaded asynchronously
3) Observe and verify the renew and return actions are now
   ajax based and function in a manner equivilent to how they
   used to.

This bug had quite a few followups, so I squashed all of them into one
change so that code is easier to follow. Original commit messages are below:

Bug 11703 - Use the ajax datatables on patron details page

Bug 11703 - Convert holds tables to ajax datatables

Bug 11703 [QA Followup 1] - Center bProcessing message over table

Bug 11703 [QA Followup 2] - Remove icons from checkout and clear buttons

Bug 11703 [QA Followup 3] - Remove references to UseTablesortForCirc

Bug 11703 [QA Followup 4] - Add back in Today's checkouts/Previous checkouts rows

Bug 11703 [QA Followup 5]

Bug 11703 [QA Followup 6] - Move strings to an include file for translation purposes

Bug 11703 [QA Followup 7] - Fix issues spotted by koha-qa.pl

Bug 11703 [QA Followup 8] - Speed up api/checkouts.pl as much as possible

Bug 11703 [QA Followup 9] - Move scripts from api directory to svc directory

Bug 11703 [QA Followup 10] - Fix errors caused by rebase

Bug 11703 [QA Followup 11] - Prevent multiple fetchs from ajax source

Bug 11703 [QA Followup 12] - Fix problem detected by koha-qa.pl

Bug 11703 [QA Followup 13] - Removed uneccessary data from renewal box during renewal

Bug 11703 [QA Followup 14] - Fix table column span

Signed-off-by: Dobrica Pavlinusic <dpavlin@rot13.org>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.
Test plan on bug report:
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11703#c98

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>

Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.org>
2014-07-03 11:22:10 -03:00
Olli-Antti Kivilahti
a660d2208b Bug 9811 - datetime does not respect DateFormat-system prefrence
To test:
Try searching by the date of birth using the left filter column. Good luck.

After applying this patch:
You can search using your preferred DateFormat.

Merci bocu

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-07-01 09:58:11 -03:00
Jonathan Druart
24d6d83ada Bug 9811: Patron search improvement
This patch add DataTables using server-side processing for the patrons
search.

It adds:
- 1 module C4/Utils/DataTables/Members.pm
- 2 services svc/members/search and svc/members/add_to_list
- 1 template members/tables/members_results.tt
- 1 new practice which is to add template for DataTables in a
  subdirectory named 'tables'.

Impacted scripts: members/members-home.pl and members/members.pl

To go further: We can imagine that all patrons searches use the same
service with no big changes: 1 little template creates a JSON file and
to implement DataTables on the template page, that's all.

Amended patch: Since bug 10565 has been pushed, these patches don't
apply cleanly. I had to rewrite a part of the patron list feature.
I removed the choice to add all resultant patrons from a search. I think
this choice is useless with this patch: we are able to display the
number of patrons we want and to select all of them.

Test plan:
- Check that there is no regression on searching patrons.
- Try filters on the left of the screen.
- Try to sort each column.
- Try the "Browse by last name" links.
- Check that the "Clear" button clears yours filters.
- Try with IndependantBranches ON and OFF.
- Verify this feature does not break the patron list feature (cf bug
  10565).

Signed-off-by: Cedric Vita <cedric.vita@dracenie.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script, couldn't find any regressions
or problems. Some notes left on the bug.

Bug 9811: Add unit tests for C4::Utils::DT::Members

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>

Bug 9811: QA followup

- removes 2 tabs
- removes mysqlisms
- add sort on borrowernotes
- fix wrong capitalization
- cat => Category

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Thx for fixing these!

Bug 9811 - multilines notes brakes JSON

In new patron search feature, the search results are fetched using Ajax and returned in JSON format.
The JSON is created by TT using koha-tmpl/intranet-tmpl/prog/en/modules/members/tables/members_results.tt.
One of the fields is the borrower notes. When this notes contains several lines, the JSON is broken.

This patch uses TT fileters to consert in notes linefeeds into HTML line break (html_line_break) and then remove linefeeds (collapse).

Test plan :
- perform a member search that does not return a borrower with a circ note
- edit one of the borrowers returned by this search
- enter serveral lines of text in "Circulation note" and save
- reperform the member search
=> circ note is well displayed on several lines

Bug 9811: use count(primary_key) instead of count(*)

Bug 9811: A limit clause should be always added.

By default, we want to retrieve 20 first results.

Bug 9811: Load the page without any data.

Displaying the first 20 patrons is not useful. With this patch, the
table is hidden and no record is retrieved by default.
On the same way, the existing side effect on redirect disappears.

Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi>
-------------
-TEST REPORT-
-------------
For the filter: Tested all the search fields, branches, search type.
Found a bug with "date of birth", followup provided.
Tested display limits and verified that AJAX-queries are
  efficient (using LIMIT clause) to not stress DB needlessly.
Tested adding Patrons to a list.
A good feature, which seems to work quite well.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Adding my test plan to the last patch of this bug.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-07-01 09:57:09 -03:00
Jonathan Druart
5c4fdcf78a Bug 11742: A letter code should be unique.
This patch is a dirty way to fix a design issue on notices.
Currently the code assumes that a letter code is unique. Which is wrong,
the primary key is module, code, branchcode.

Maybe we should add a primary key (id) for the letter table in order to
pass the id to the template and correctly manage the letter code
duplication.

Test plan:
Try to duplicate a letter code using edit, add and copy actions.
If you manage to do it, please describe how you did.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
2014-06-23 15:19:55 -03:00
Robin Sheat
e9715c7921 Bug 12041 - improve Koha::Cache
This makes Koha::Cache behave better by default. It will use memcached
if available to do shared caching, if that's not available it will fall
back to in-memory caching. It also allows for a singleton accessor to
allow a single cache to be shared within a process.

* Added tests to confirm UTF8-cleanness.
* Added minor fixups to stop warnings.

Test plan:
* The t/Cache.t file runs successfully with and without the
  MEMCACHED_SERVERS envvar set (and memcached running in the
  environment.)

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-06-19 13:05:04 -03:00
da8d126c9a Bug 12114: (QA Followup) Use JSON instead of JSON::XS
RM note: on most platforms, the JSON module will use JSON::XS
by default.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-25 15:32:06 +00:00
Katrin Fischer
3268ae4a00 Bug 12114: Fix encoding problem with reports JSON web service (staff)
Repeat tests from first patch, but this time, access the report
with your staff client base URL.

<Staff BaseURL>/cgi-bin/koha/svc/report?id=<reportid>

Based on paste from Galen Charlton.

Followed test plan. Result as expected.
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-25 15:31:55 +00:00
aace5d436d Bug 11704: Make */svc/report print the correct headers
To test:
1 - Go through the first comments instructions to reproduce
    and verify the bug is present (OPAC and STAFF)
2 - Apply the patch
3 - Repeat step 1 and notice
   * characters are not broken anymore
   * the header is correct
4 - Sign off

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-02-13 02:59:42 +00:00
Mark Tompsett
33bdec2c3d Bug 11491: (QA follow-up) updated license and use Modern::Perl
Replaced License text with latest one from
    http://wiki.koha-community.org/wiki/Coding_Guidelines#Licence
and tweaked copyright lines accordingly.

Also changed use strict and use warnings into use Modern::Perl
as per PERL2 from the coding guidelines.

TEST PLAN
---------
1) less ~/kohaclone/opac/svc/report
   - The license does not reflect the current license
   - This will have use strict and use warnings
2) Apply patch
   - The license should be corrected
3) It should still run
     https://.../cgi-bin/koha/svc/report?id=##
     https://.../cgi-bin/koha/svc/report?id=##&annotated=blah
   Where ## reflects a public report available (for OPAC).

Signed-off-by: Holger Meißner <h.meissner.82@web.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-01-31 20:29:21 +00:00
Mark Tompsett
25f134f525 Bug 11491: add option to supply field names in reports web service output
The staff and public catalog reports web services (/svc/report) return
JSON output, in particular an array contain an array for each row
of the report output.

This patch adds a URL parameter, annotated, which when supplied and
set to a value that evaluates to Perl true, will cause the output
to be emited as a JSON array of hashes, where each hash represents
a row of report output and the hash keys are the column names
or labels set in the report definition.

This patch also moves code around to make diffs between svc/report and
opac/svc/report smaller.

The suggestion to return an array of hashes was made by Chris Cormack.

TEST PLAN
---------
 1) Log into staff client
 2) Reports
 3) Used save reports
 4) Click the Action button on any report
     WITHOUT PARAMETERS.
    -- with parameters blows up in master and this.
 5) Click Edit
 6) Make the report public
 7) Update the SQL
 8) Note the ID number of the report
 9) Note the ID number of a non-public report
10) Make up a crazy ID number for a non-existant report
11) In a new tab (with the appropriate edits)
     https://OPAC/cgi-bin/koha/svc/report?id=# from step 8
    -- JSON data has arrays of field values.
     https://OPAC/cgi-bin/koha/svc/report?id=# from step 8&annotated=1
    -- JSON data has arrays of field values.
     https://OPAC/cgi-bin/koha/svc/report?id=# from step 9
    -- Software error: Sorry this report is not public
     https://OPAC/cgi-bin/koha/svc/report?id=# from step 9&annotated=1
    -- Software error: Sorry this report is not public
     https://OPAC/cgi-bin/koha/svc/report?id=# from step 10
    -- Software error: Sorry this report is not public
     https://OPAC/cgi-bin/koha/svc/report?id=# from step 10&annotated=1
    -- Software error: Sorry this report is not public
     https://STAFF/cgi-bin/koha/svc/report?id=# from step 8
    -- JSON data has arrays of field values.
     https://STAFF/cgi-bin/koha/svc/report?id=# from step 8&annotated=1
    -- JSON data has arrays of field values.
     https://STAFF/cgi-bin/koha/svc/report?id=# from step 9
    -- JSON data has arrays of field values.
     https://STAFF/cgi-bin/koha/svc/report?id=# from step 9&annotated=1
    -- JSON data has arrays of field values.
     https://STAFF/cgi-bin/koha/svc/report?id=# from step 10
    -- Software error: hash- or arrayref expected (not a simple scalar, use allow_nonref to allow this) at /usr/share/perl5/JSON.pm line 154.
     https://STAFF/cgi-bin/koha/svc/report?id=# from step 10&annotated=1
    -- Software error: hash- or arrayref expected (not a simple scalar, use allow_nonref to allow this) at /usr/share/perl5/JSON.pm line 154.

12) Apply the patch
13) ~/qa-test-tools/koha-qa.pl -v 2 -c 2
    -- There should be no problems. All OK.

14) In a new tab (with the appropriate edits)
     https://OPAC/cgi-bin/koha/svc/report?id=# from step 8
    -- JSON data has arrays of field values.
     https://OPAC/cgi-bin/koha/svc/report?id=# from step 8&annotated=1
    -- JSON data has arrays of hashes with field names as keys
     https://OPAC/cgi-bin/koha/svc/report?id=# from step 9
    -- Software error: Sorry this report is not public
     https://OPAC/cgi-bin/koha/svc/report?id=# from step 9&annotated=1
    -- Software error: Sorry this report is not public
     https://OPAC/cgi-bin/koha/svc/report?id=# from step 10
    -- Software error: There is no such report.
     https://OPAC/cgi-bin/koha/svc/report?id=# from step 10&annotated=1
    -- Software error: There is no such report.
     https://STAFF/cgi-bin/koha/svc/report?id=# from step 8
    -- JSON data has arrays of field values.
     https://STAFF/cgi-bin/koha/svc/report?id=# from step 8&annotated=1
    -- JSON data has arrays of hashes with field names as keys
     https://STAFF/cgi-bin/koha/svc/report?id=# from step 9
    -- JSON data has arrays of field values.
     https://STAFF/cgi-bin/koha/svc/report?id=# from step 9&annotated=1
    -- JSON data has arrays of hashes with field names as keys
     https://STAFF/cgi-bin/koha/svc/report?id=# from step 10
    -- Software error: There is no such report.
     https://STAFF/cgi-bin/koha/svc/report?id=# from step 10&annotated=1
    -- Software error: There is no such report.

Signed-off-by: Holger Meißner <h.meissner.82@web.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-01-31 20:22:34 +00:00
Jonathan Druart
1dc7d421bc Bug 7813: (follow-up) improvements for deleting local cover images
This patch:
- displays a js alert if a problem occurred on deleting the
  image on the server.
- adds a class for the new span (in order to avoid future problem, if
  someone adds a new span).
- adds a title for the [X] link.
- deal with the upload_local_cover_images permission (don't display the
  delete link if the logged in user does not have it).
- changes the license version.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
I like the ehancements to the original patch and work as expected.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-09-21 18:11:13 +00:00
ab362b93a7 Bug 7813: Ability to delete local cover images
This patch adds the ability to delete local cover images from the
detail page. It adds an 'X' button to trigger the deletion. It occurs
using a new SVC script called cover_images that accepts the following
parameters:

 - action
 - biblionumber (used for checking imagenumber validity)
 - imagenumber (repeatable)

It then deletes all valid images passed and returns a JSON object
containing the imagenumbers and the deletion status (1/0). The operation
is triggered using jQuery.ajax, and with the response the corresponding
images get deleted.

Note: currently one image is deleted at a time, but the code is there to
be used.

To test:
- Open the detail page fr a biblionumber containing one or more cover
  images, go to its images tab.
- Apply the patch, reload the page, go to the images tab.
- Thumbnails should look better than before ;-)
- An 'X' button should show below each cover.
- Clicking the 'X' button should trigger an alert message asking for
  confirmation.
 a) Cancel: nothing happens, reload the page and check nothing got
    deleted.
 b) Accept: the deleted image should be gone, reload the page to check
    it doesn't exist anymore and is not a browser/DOM manipulation trick.
- Signoff

Note: check having more cover images than those that fit the width and
see it wraps fine.

P.S. I chose not to implement every possible action on the svc script, but
another bug could be filled for more improvements.

Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-09-21 18:08:51 +00:00
Thatcher Rea
06b9bb2097 Bug 9908 - Fixing OCLC Connexion Client
Fix issue where exporting a bib from the OCLC Connexion client
or web interface to a Koha database would always result in
an "Unsuccessful request" error.

To Test:

[1] Apply patch
[2] Start the Connexion import daemon.
[3] Start the Connexion client or web interface (requires that you
    you posses OCLC cataloging credentials).
[4] Locate a bib and use Connexion to export it to the Koha database.
[5] Verify that the bib is successfully added.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
All tests and QA script pass.
Logical change and trusting sign off here as I don't have
access to WorldCat for testing this.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2013-03-29 21:29:10 -04:00
Bernardo Gonzalez Kriegel
9205e732fb Bug 9827: remove 'insecure' system preference
This patch removes 'insecure' system preference.

Also removes remaining code that make use of
the preference. It's broken anyway.

Only remains a reference in POD of C4/Boolean.pm

To test:
1) If you like, enable 'insecure' syspref. Broken system.
WARN: be prepared to revert value in database.

2) Apply the patch

3) Run updatedatabase.pl

4) Check that Staff login proceeds as usual.

5) Check that 'insecure' syspref is no more.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Amended patch: Remove 2 occurrences of insecure (in comment only)
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2013-03-19 21:46:34 -04:00
Jared Camins-Esakov
6e71b80ca3 Bug 7475: Teach matching rules to handle authorities
* Add the code necessary to handle authorities with matching rules and
  import batches.
* Update all the scripts that use the matcher and import batch code
  to use the new API.
* Add authority records to the matching rules interface in the staff
  client.

http://bugs.koha-community.org/show_bug.cgi?id=2060
Signed-off-by: Elliott Davis <elliott@bywatersolutions.com>

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Rebased on latest master 11 September 2012
2012-09-19 17:15:56 +02:00
Srdjan
42acfbf75b Bug 7993: Save reports with Group/Subgroup hierarchy
This should make saved reports more manageable.
Group/Subgroup hierarchy is stored in authorised_values,
categories REPORT_GROUP and REPORT_SUBGROUP, connected by
REPORT_SUBGROUP.lib_opac -> REPORT_GROUP.authorised_value

Database changes:
* authorised_values: expanded category to 16 chars
* created default set of REPORT_GROUP authorised values to match
  hardcoded report areas
* reports_dictionary: replaced area int with report_area text, converted
  values
* saved_sql: added report_area, report_group and report_subgroup;
  report_area is not currently used, saved for the record

C4/Reports/Guided.pm:
* Replaced Area numeric values with the mnemonic codes
* get_report_areas(): returns hardcoded areas list
* created get_report_areas(): returns full hierarchy (groups with belonging
  subgroups)
* save_report(): changed iterface, accepts fields hashref as input
* update_sql(): changed iterface, accepts id and fields hashref as input
* get_saved_reports():]
- join to authorised_values to pick group and subgroup name
- accept group and subgroup filter params
* get_saved_report():
- changed iterface, return record hashref
- join to authorised_values to pick group and subgroup name
* build_authorised_value_list(): new sub, moved code from
  reports/guided_reports.pl
* Updated interfaces in:
cronjobs/runreport.pl, svc/report, opac/svc/report: get_saved_report()
reports/dictionary.pl: get_report_areas()
reports/guided_reports.pl

reports/guided_reports_start.tt:
* Reports list:
- added group/subgroup filter
- display area/group/subgroup for the reports
* Create report wizard:
- carry area to the end
- select group and subgroup when saving the report; group defaults to area,
  useful when report groups match areas
* Update report and Create from SQL: added group/subgroup
* Amended reports/guided_reports.pl accordingly

Conflicts:

    C4/Reports/Guided.pm
    admin/authorised_values.pl
    installer/data/mysql/kohastructure.sql
    installer/data/mysql/updatedatabase.pl
    koha-tmpl/intranet-tmpl/prog/en/modules/reports/dictionary.tmpl
    koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tmpl
    misc/cronjobs/runreport.pl
    reports/dictionary.pl
    reports/guided_reports.pl

Signed-off-by: Delaye Stephane <stephane.delaye@biblibre.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
2012-09-18 17:49:08 +02:00
Paul Poulain
0d4acbba5c Merge remote-tracking branch 'origin/new/bug_7613' 2012-09-05 14:54:33 +02:00
D Ruth Bavousett
fafd3e87f5 Bug 7613: OCLC Connexion web service and desktop client, followup patch
Prior patches to this bug had lots of comments like "I don't have a way to test this, so..."

In the OCLC Connexion web, when you choose the option to export to MARC, it'll *send* it, and
say, "Record Exported," but the web client does nothing whatever to confirm that the record
actually landed in Koha.  That's a flaw in their software, but can be easily checked by
looking in Koha to see if an import batch got created.  The desktop client is a little
smarter about this, but needed much more testing, also.

With this patch, both the client and web will actually work.  With a config file and set up as
previously described, The record will be staged and/or imported, and the desktop client returns
a useful message about what happened, *and* the staff client URL to the record.

Oodles of gobs of bunches of thanks to Virginia Military Institute, for loaning me their OCLC
authorization credentials so this could be tested, as well as for great suggestions of cosmetic
improvements to the mechanism and output.
2012-09-05 14:53:13 +02:00
Paul Poulain
108e901043 Merge remote-tracking branch 'origin/new/bug_7729' 2012-07-17 18:21:38 +02:00
MJ Ray
6dba1394e1 Bug 7729 : svc/new_bib: support ?items=1 to add POSTed items to the new biblio too
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
2012-07-17 18:12:09 +02:00
Jared Camins-Esakov
19264af3f4 Bug 8256: Teach webservice to select reports by name
Adds the ability to pass a hash to C4::Reports::Guided::get_saved_report
which specifies a name or id to select the report.

Test plan:
1. Create a report (or choose an existing one), and mark it public
2. Run the report using the web service: [IntranetBaseURL]/cgi-bin/koha/svc/report?id=whatever
3. Confirm you get the expected results
4. Run the report by name using the web service: [IntranetBaseURL]/cgi-bin/koha/svc/report?name=[Report name] (keep spaces in the name)
5. Confirm you get the same results
6. Run the report using the public web service: [OPACBaseURL]/cgi-bin/koha/svc/report?id=whatever
7. Confirm you get the same results
8. Run the report by name using the public web service: [OPACBaseURL]/cgi-bin/koha/svc/report?name=[Report name] (keep spaces in the name)
9. Confirm you get the same results
10. Sign off

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
- Adding, editing and deleting reports works
- id parameter works
- new name parameter works
- public and non-public works

Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
2012-07-10 11:59:44 +02:00
Paul Poulain
66dbe7dc66 Bug 7248 follow-up (alternative)
This patch introduces some new features for caching system:
* the type of caching is retrieved from ENV variable in httpd configuration if not forced when the ->new() is called.
* if $ENV{DEBUG} is ON, you'll have feedback when something is set or read from cache
* the Koha::Cache->is_cache_active is now available and will return 1 if there is a caching system available. It's a replacement for C4::Context->ismemcached
* fixes the mistake for debug/compress_threshold and expire_time parameters

The 2 report web service modules have been updated to use this new API

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2012-05-15 18:05:58 +02:00
Jared Camins-Esakov
02a6d2b1d0 Bug 7249: Syspref to control number of rows in web service results
The original patches for bug 7249 had a hardcoded limit of ten rows in the
results returned by the web service. This patch adds a SvcMaxReportRows syspref
which allows the librarian to choose how many rows should be returned by the
web service.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
2012-05-11 10:26:33 +02:00
Chris Hall
24213703d5 Bug 7249 : Allow reports to be called through a restful interface
Hands back JSON, and supports caching

Squashed commit of the following:

commit 5c93506079738b9a13139417d3a0734289a4b007
Author: Chris Hall <chrish@catalyst.net.nz>
Date:   Mon Nov 21 15:41:14 2011 +1300

    Fixed bugs when creating reports, added more user friendly input and
    feedback

commit c62430bb358ee4af6ee5331b4d3a2ed67f723032
Author: Chris Hall <chrish@catalyst.net.nz>
Date:   Mon Nov 21 12:00:27 2011 +1300

    Added caching to intranet report webservices, added cache expiry and public
    options to reports

commit 2d89f0777d95b26bf08635782070b6367d0698f3
Author: Chris Cormack <chris@bigballofwax.co.nz>
Date:   Wed Nov 9 20:29:26 2011 +1300

    Working on caching for services

commit e0511f180cebd81747858ad776433fe3a1cf6854
Author: Chris Cormack <chris@bigballofwax.co.nz>
Date:   Wed Nov 9 08:28:26 2011 +1300

    Starting work on webservices

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Patch includes database update adding 2 new fields to the saved_sql table.

1) Checked that adding/deleting/editing of sql reports still works and new
fields are correctly saved to the database.

2) The saved reports page now lists the new fields correctly.

3) Checking URLs with JSON output
- if report is not public http://localhost/cgi-bin/koha/svc/report?id=2 fails,
but http://localhost:8080/cgi-bin/koha/svc/report?id=2 works
- if report is public, both links work

4) Checking results are cached
Created a report listing my borrowers, setting caching to 60 seconds and
added new borrowers before doing following tests.
- URL doesn't show new borrower immediately - correct
- Turning off the usecache system preference updates data - correct
- Restarting memcached updates data '/etc/init.d/memcached restart' - correct
- Waiting until cache time runs out updates data - correct

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Retested the feature and renewing my sign-off.

There are some things that should be noted:
- currently there is a hardcoded limit of 10 results for the reports webservice
- reports with runtime parameters are currently not supported
2012-05-11 10:26:29 +02:00
Srdjan
12ff7355bb bug_7613: OCLC Connexion gateway
svc/import_bib:
* takes POST request with parameters in url and MARC XML as DATA
* pushes MARC XML to an impoort bach queue of type 'webservice'
* returns status and imported record XML
* is a drop-in replacement for svc/new_bib

misc/cronjobs/import_webservice_batch.pl:
* a cron job for processing impoort bach queues of type 'webservice'
* batches can also be processed through the UI

misc/bin/connexion_import_daemon.pl:
* a daemon that listens for OCLC Connexion requests and is compliant
  with OCLC Gateway spec
* takes request with MARC XML
* takes import batch params from a config file and forwards the lot to
  svc/import_bib
* returns status

ImportBatches:
* Added new import batch type of 'webservice'
* Changed interface to AddImportBatch() - now it takes a hashref
* Replaced batch_type = 'batch' with
  batch_type IN ( 'batch', 'webservice' ) in some SELECTs

Signed-off-by: MJ Ray <mjr@phonecoop.coop>
2012-04-06 17:26:20 +02:00
MJ Ray
9d394e12fc Bug 7729 : svc/bib: support appending ?items=1 to the URL to fetch or modify items
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
2012-03-29 16:52:04 +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
0700a8b732 bug 4896: granular permissions now always on (DB rev 138)
Per the following koha-devel thread, the use of
staff user subpermissions, AKA granular permissions, is
now the default behavior in Koha.  This patch removes
the GranularPermissions system preference.

[1] http://lists.koha-community.org/pipermail/koha-devel/2010-February/033670.html

Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
2010-06-19 07:56:03 -04:00
Lars Wirzenius
d5386c1f61 Fix FSF address in directory svc/
Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
2010-03-16 20:17:51 -04:00