Commit graph

33 commits

Author SHA1 Message Date
Jonathan Druart
d63b4a766c Bug 11221: ensure that SQLHelper uses NULL rather than 0000-00-00 as default date value
The default values for date fields is undef, so if a date field contains
an empty string, we should insert NULL in the DB, not 0000-00-00.
The format_date_in_iso routine should be only called if a date is
defined, is not equal to an empty string and does not match the iso
regex.

This patch fixes a bug where editing or creating a patron record
without setting the birth date results in 0000-00-00 rather than null
being set as the dateofbirth value.

Partial test plan:
1. Create a new patron. Leave dateofbirth empty.
2. Save the record.
3. Open the record for editing.
4. Save the record without making changes.
5. Koha gives no error.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.
Now when no date is given NULL is saved to the database.

Tested:
- Adding a patron without date of birth
- Editing the patron, entering a date of birth
- Editing the patron, deleting date of birth
All worked as expected.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-11-19 15:29:08 +00:00
Jared Camins-Esakov
480841965e Bug 10403: add ability to change fund on receipt
Right now there is no way to change the budget or fund when receiving an
item, which is annoying, particularly at the end of the fiscal year when
every item not already received has to be switched to the following
year's budget. This patch adds the ability to change the budget and fund
when receiving.

To test:
1) Apply patch.
2) Create an order for a vendor, choosing a fund to use for that order.
3) Receive the order, leaving the fund unchanged. Make sure the fund
   did not change.
4) Create another order for a vendor, choosing a fund to use for that
   order.
5) Receive the order, this time changing the fund. Make sure the fund
   is changed.
6) Run the unit test:
    > prove t/db_dependent/Acquisition.t
7) Sign off.

(Notes: this patch depends on the Acquisitions.t unit test improvements
in bug 10274; the seemingly-unrelated change in SQLHelper quiets an
irritating warning caused by the NewOrder call in ModReceiveOrder)

Signed-off-by: Mathieu Saby <mathieu.saby@univ-rennes2.fr>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-22 12:57:25 +00:00
16cc80d2bd Bug 6679 - [SIGNED-OFF] fix 3 perlcritic violations in C4/SQLHelper.pm
Subroutine prototypes used at line 251, column 1.  See page 194 of PBP.  (Severity: 5)
Subroutine prototypes used at line 287, column 1.  See page 194 of PBP.  (Severity: 5)
Subroutine prototypes used at line 317, column 1.  See page 194 of PBP.  (Severity: 5)

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
2012-09-20 12:01:38 +02:00
Paul Poulain
8449b14dcb Revert "Bug 8089: Use Koha::Cache for all caching"
This reverts commit 215abc8024.

The 3 patches for bug 8089 have been reverted, because they break
jenkins & Koha.
A follow-up has been provided, but it does not solve the problem on my
test server, it just changes the error message.

After a discussion with jared, Dobrica should work on another patch, so
the best option is to revert.
2012-09-12 14:12:41 +02:00
Jared Camins-Esakov
215abc8024 Bug 8089: Use Koha::Cache for all caching
1. Replace all instances of memoize_memcached with appropriate calls
into Koha::Cache:
* reports/guided_reports.pl
* C4::Biblio::GetMarcStructure
* C4::Languages::getFrameworkLanguages
* C4::Languages::getAllLanguages
* C4::SQLHelper::GetPrimaryKeys
* C4::SQLHelper::_get_columns

2. Replace all references to memcached with the appropriate calls into
Koha::Cache in C4::Context.

Test plan :
* have DEBUG env set to 1
* reach addbiblio page to test the patch in Biblio.pm, or setup more than 1
  language
* you should see in the logs that you're reading and writing from cache
* run the test suite twice both with and without the following environment
  variables set:
export MEMCACHED_SERVERS=127.0.0.1:11211
export MEMCACHED_NAMESPACE=KOHA
export CACHING_SYSTEM=memcached

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

I'm unsure about some of the caching times 10000 is a long long time,
but other than that, works fine.
2012-09-07 16:28:29 +02:00
Chris Cormack
509d673f10 Bug 7941 : Fix version numbers in modules
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
2012-06-11 17:29:38 +02:00
Chris Cormack
516abc4896 Bug 7432 : Fixing caching for SQLHelper
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2012-02-15 10:26:24 +01:00
Chris Cormack
94516e7f2a Bug 7276 : Follow up, adding a sub to clear the cache
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
2012-01-17 18:13:52 +01:00
Henri-Damien LAURENT
6c38cc23d9 Bug 7276 : member entry Performance improvement
Before this patch : 9619 borrowers added in 31 Minutes, After : 68 seconds.
This adds Hashref to table structure in C4::SQLHelper to speed up bulk edits.

Signed-off-by: Stéphane Delaune <stephane.delaune@biblibre.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
2012-01-17 18:13:51 +01:00
Ian Walls
440c0f21ee Bug 7134: patron records getting corrupted birthdates
If no date of birth is provided in a new member form, the borrower gets the birthdate of "00/02/0", which
is obviously incorrect (the result of passing 0 to the database directly)

The fix is to remove a conditional check buried deep in C4::SQLHelper.  This is in a helper subroutine that was changed
for the Unified Member Search dev (bug 6253).  Reverting this small change to the conditional does not seem to break
search, but testing will be required.

To test:
1. apply patch, and create a new patron with blank birthdate.  The new patron should now have a blank birthdate instead of '00/02/0'
2. search for a borrower by 1 part surname, confirm search works
3. search for a borrower by 2 part surname, confirm search works
4. search for a borrower across firstname AND surname; confirm
5. search for a borrower and include categorycode/branchcode filters

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
I confirm all working tests 1-5
1. Created patron with blank birthdate - birthdate was blank
2. Searched for patron "henry james acevedo III" by using "acevedo" - result was correct
3. Searched for mr. acevedo using "Acevedo III" - result was correct
4. Searched for Henry James Acevedo III, Henry Acevedo and James Acevedo - results were correct
5. Searched for Mr Acevedo with the branch he was not in, with the branch he is in, with a category he was not, and a category he was. All results were correct.

also noted: inner searching seems to be working now? Example: Henry James (firstname) Acevedo III (surname) - searching James Acevedo brings back the correct patron.
Not complaining, just noting. :)

Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
2011-11-18 22:59:11 +01:00
Ian Walls
36d8e5df96 Bug 7061: unnecessary global variables declared in C4::SQLHelper
Removes $tablename and $hash from global scope of C4/SQLHelper.pm.  They are never used;
all instances of $table are locally scoped to the subroutines, and $hash is never used.

This may help with persistance; if not, it's at least a bit of trivial cleanup.

To test:

1.  Search for a patron
2.  Create a Contract in Acquisitions
3.  Modify that Contract
4.  Delete that Contract

All instances should return error free.  This checks the subroutines of SQLHelper

Signed-off-by: Nicole C. Engard <nengard@bywatersolutions.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
2011-11-04 12:11:13 +01:00
Ian Walls
d80cf35e9b Bug 6253 followup: explicitly check ref value for ARRAY before casting
in C4::SQLHelper::_Process_Operands, $operand has been modified to be cast as an array ref
if the incoming $operand is not a ref.  However, the incoming $operand could be some other
kind of ref (hashref for example), which would case the dereferencing in line 419 to fail and exit.

Adding an explicit test for whether the ref is ARRAY seems to clear up this issue.

To test, run t/db_dependent/Members.t.  Before, it fails after test 3.  After, it completes all tests.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
2011-10-20 09:20:20 +13:00
Srdjan Jankovic
18b8991cf1 bug_6253: Unified member Search()
Removed SearchMembers() and replaced with more generic Search()
Amended Search() to try cardnumber first
Replaced SearchMembers() calls with Search()
Replaced SELECT with Search() where appropriate
C4::SQLHelper:
- added support for '' key for search filter.
- when passing an array to filter, join with OR (rather than AND)
- added support for key => [val1, val2] in filter
- did not document - there was no input documentation to start with,
  and SQLHelper should be replaced with something better anyway

Signed-off-by: Liz Rea <lrea@nekls.org>
(again - testing merge issue)
The functionality of the patch seems to be maintained with Biblibre's changes.

I tested the following:
Extended attribute searching: works
3 part name searching: works
2 part name searching: works
1 part name searching: works

From:
mainpage.pl
members-home.pl
	Patron search limited by branch: Works
	Patron search limited by patron category: works
	Ordering by cardnumber instead of surname: works
The "Check Out" field in the masthead.

Circ Autocomplete is not reliably functional at this time, but the problem appears to predate this patch.
Signed-off-by: Ian Walls <ian.walls@bywatersolutions.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
2011-10-19 16:23:02 +13:00
Henri-Damien LAURENT
e2fd348f7f Bug 6017 : MT3157 : editing an attribute lead to Error500
Editing an extended attribute in the extended attribute tab would lead to an Error500
This patch adds some checks for values before UPDATE in SQLHelper.pm
And Adds some checks also befaore calling ModMember in members/memberentry

Signed-off-by: Stéphane Delaune <stephane.delaune@biblibre.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
2011-04-08 14:14:32 +12:00
Andrew Elwell
aa9b4d92cd POD Cleanups
Signed-off-by: Andrew Elwell <Andrew.Elwell@gmail.com>
Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
2010-06-09 08:38:59 -04:00
ef58c445d3 removed needless imports of the YAML module
Removed instances of 'use YAML' that were either completely
unnecessary or which were used only in debug code.  Also
removed a needless import of Data::Dumper.

Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
2010-05-25 23:30:48 -04:00
Lars Wirzenius
7279f55b60 Fix FSF address in directory C4/
Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
2010-03-16 20:17:56 -04:00
Henri-Damien LAURENT
7540dda2eb Bug Fixing Search By initials incorrect
Adding a research scope : field_start_with
Using this kind of research if searching by initial
2010-01-28 15:11:55 +01:00
Henri-Damien LAURENT
2086615a35 SQLHelper : InsertInTable enhancement
InsertInTable can now add values to table where primaryKey requires
user input such as branches table
2010-01-28 15:11:54 +01:00
Henri-Damien LAURENT
a97d12faa7 C4::SQLHelper Changing $$ notation to $ -> 2010-01-28 15:11:51 +01:00
Henri-Damien LAURENT
6a3579b2f3 MT 2285 : enhancement for patronSearch 2010-01-28 15:11:51 +01:00
Henri-Damien LAURENT
697e8e7014 SearchInTable : problem with primary key searches
SearchInTable was filtering primary Key thus returning the whole table when asked a search on a primary key
2010-01-28 15:11:45 +01:00
Henri-Damien LAURENT
486c0b075e SQLHelper Enhancement Adding contain as searchtype 2009-11-06 12:33:15 +01:00
Henri-Damien LAURENT
ee7d0af37b POD improvement 2009-11-02 16:51:20 +01:00
Henri-Damien LAURENT
e3a8f1e20d MT 2168 : Logical AND between multiple words strings
C4::SQLHelper was doing an implicit OR of multiple words strings
It is now fixed and does an AND
2009-10-26 15:34:33 +01:00
Henri-Damien LAURENT
67c69a3b66 Adding logging DBI errors if in Debug Mode 2009-10-26 15:34:33 +01:00
Henri-Damien LAURENT
581bd9c563 removing unconditional warning 2009-10-14 18:19:09 +02:00
Henri-Damien LAURENT
687943ff38 Followup 300bd572d3
Adding Tablename to SQLHelper
2009-10-14 18:19:09 +02:00
Henri-Damien LAURENT
300bd572d3 SQLHelper Adding tablename to filters output 2009-10-05 07:47:56 +02:00
Henri-Damien LAURENT
70a6b86c74 Improving SQLHelper
More concise and more readable
removing do local $"= using join instead
Adding Caching of queries
Adding Some tests
API between function reorganizing for more consistency
2009-09-30 11:30:37 +02:00
Henri-Damien LAURENT
2a4f2098b4 Improving C4::SQLHelper
Adding support for string, hash and arrayref in SearchIntable
SearchInTable now add
	limits and
	sortby
	filter on fields to returns (enter an arrayref here)
	filter on fields to limit the search on
	searchtype which can be exact or wide

GetPrimaryKey now returns an array of all the fields which are primary keys
Adding Internal functions
_Process_Operands
_filter_hash
_filter_string
_filter_fields
2009-09-30 11:30:36 +02:00
Henri-Damien LAURENT
adaffc363b defining a value which could be optionnal
Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
2009-09-30 11:29:23 +02:00
Henri-Damien LAURENT
4271bbb738 Modifying Members : Add Mod and GetMember
This update the way Member is added and editing so that import and Edition
 could be best automatized
GetMember evolves and allow ppl to serach on a hash of data

Adding SQLHelper A new package to deal with INSERT UPDATE and SELECT

Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
2009-09-30 11:29:23 +02:00