Marcel de Rooy [Mon, 2 May 2016 10:26:44 +0000 (12:26 +0200)]
Bug 16412: Cache undef in L1 only
No need to cache undef in L2.
Prevent numerous warnings like:
Use of uninitialized value in subroutine entry at /usr/share/koha/masterclone/Koha/Cache.pm line 284
Test plan:
Run t/Cache.t
Run t/db_dependent/sysprefs.t
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Amended patch: remove trailing space char and replace 'you' with 'we' to
match existing wordings.
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Kyle M Hall [Tue, 10 May 2016 19:05:00 +0000 (19:05 +0000)]
Bug 16496 - accountlines.issue_id not set when new overdue is processed
It appears that somehow the adding of issue_id to accountlines for new
fines was missed! This is incredibly important, otherwise UpdateFine
will always create a new fine!
Test Plan:
1) Create a new overdue checkout
2) Run fines.pl to generate an accountline for it
3) Note it has no issue_id
4) Apply this patch
5) Repeat steps 1 and 2
6) Note it now has an issue_id!
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Owen Leonard [Wed, 4 May 2016 13:34:46 +0000 (09:34 -0400)]
Bug 13041 - Can't add user as manager of basket if name includes a single quote
If you are trying to add a user as a manager of a basket in
acquisitions, a JavaScript error will be triggered if that user has a
single quote in their name (e.g. "O'Neil"). This patch corrects the
issue by removing the "onclick" attribute and using the JS change made
in Bug 16386.
Also changed by this patch: Increased the size of the patron search
popup and made a correction to some invalid HTML.
To test you should have a patron whose name contains a single quote who
is also a user with permission to manage acquisitions.
- Apply the patch and go to Acquisitions.
- Locate an open basket and view the details for that basket.
- In the "Managed by" section, click the "Add user" button to trigger
the patron search popup.
- Search for the patron described above and click the "Add" button.
- In the parent window, the patron you chose should have been added to
the "Managed by" section.
Tested on top of Bug 16383, behaves as expected. Signed-off-by: Marc Véron <veron@veron.ch> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
Owen Leonard [Fri, 29 Apr 2016 00:52:40 +0000 (20:52 -0400)]
Bug 16386 - Replace the use of "onclick" from patron card creator templates
This patch removes the use of "onclick" from several patron card creator
templates. Events are defined instead in JavaScript.
Also changed:
- Patron search pop-up window is now slightly larger because I found it
never quite large enough to prevent horizontal scrolling.
- Replaced "Borrower" with "Patron" in a couple of places.
- "Add" link in patron search pop-up is now styled as a Bootstrap
button.
- Removed Bootstrap styles from some submit buttons.
- Some Font Awesome icons were made using the invalid element
<icon></icon> instead of <i></i>. These are corrected.
- Fixed some other HTML validation errors.
To test, apply the patch and go to Tools -> Patron card creator.
- Choose New -> Card batch.
- Click "Add patrons" and perform a search for patrons in the pop-up
window.
- Click the "Add" button. The corresponding borrowernumber should be
added to the textarea in the parent window, and a message should
appear at the top of the pop-up window confirming that the patron
has been added. (Note: This patch fixes a version of Bug 13041 which
prevented the "add" button from working on patrons whose name
include an apostrophe).
- In the parent page, in the list of patrons you added to the batch,
confirm that clicking the "Delete" link triggers a confirmation
dialog. Test both confirming and canceling.
- Confirm that clicking the "Export" button next to an individual
patron triggers a modal window.
- In the export window, confirm that the "Cancel" link works to
close the modal.
- Click the "Export" button again and then the "Export" button in
the modal.
- Test that the "Done" button works to close the modal.
- Choose Manage -> Card batches.
- Test the "Delete" and "Export" buttons as described above.
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
All works, no errors.
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
Aleisha [Tue, 23 Feb 2016 04:06:30 +0000 (04:06 +0000)]
Bug 15823: Can still access patron discharge slip without having the syspref on
EDIT: Fix for OPAC side
EDIT: Comment 10
EDIT: Merge conflicts
To test:
1) Ensure syspref useDischarge is disabled
2) Go to /cgi-bin/koha/members/discharge.pl?borrowernumber=X&discharge=1
3) Validate that you are still able to generate a discharge slip for this patron
4) Apply patch and refresh page
5) Confirm that you are redirected to the circulation.pl page for the user and that an error message is there.
OPAC SIDE
6) Go to the OPAC
7) Go to /cgi-bin/koha/opac-discharge.pl
8) Confirm you get a message saying discharges are disabled
9) Go to /cgi-bin/koha/opac-discharge.pl?op=request
10) Confirm you see same message
Sponsored-by: Catalyst IT
Followed test plan, works as expected (both staff client and OPAC).
Re-tested, works OK. Signed-off-by: Marc Véron <veron@veron.ch> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
Bug 16451: Fix missisng body id in orders_by_budget.tt
Bug 11371 introduced a new template, which fails the xt/tt_valid.t tests.
To test:
- On master, run:
$ prove xt/tt_valid.t
=> FAIL: Tests fail on orders_by_budget.tt
- Apply the patch
- Run
$ prove xt/tt_valid.t
=> SUCCESS: Tests don't fail on orders_by_budget.tt
- Sign off
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>
Bug 16453: Make Elasticsearch tests be skipped if configuration entry missing
The current tests fail to run if the configuration entry is missing. This is
problematic on jenkins and should be fixed.
To test:
- On master, having koha-conf.xml without (or commented) an <elasticsearch> entry
- Run:
$ prove t/db_dependent/Koha_ElasticSearch_Indexer.t \
t/db_dependent/Koha_SearchEngine_Elasticsearch_Search.t -v
=> FAIL: Tests fail due to missing configuration entry
- Apply the patch
- Run:
$ prove t/db_dependent/Koha_ElasticSearch_Indexer.t \
t/db_dependent/Koha_SearchEngine_Elasticsearch_Search.t -v
=> SUCCESS: Tests pass, and the ES-configuration-dependent tests are skipped
- Have elasticsearch running and the koha-conf.xml entry
- Run:
$ prove t/db_dependent/Koha_ElasticSearch_Indexer.t \
t/db_dependent/Koha_SearchEngine_Elasticsearch_Search.t -v
=> SUCCESS: Same results as without the patch
- Sign off
Jonathan Druart [Tue, 3 May 2016 07:58:33 +0000 (08:58 +0100)]
Bug 16426: follow-up of bug 15840 - correctly manage userid while inserting patrons
Bug 15840 tried to fix a bug but makes things more complicated than it
was before.
If an userid is not provided for 1 or more rows of the csv file, it
should not be updated. However, if a userid is provided and it already
used by an other patron, the import should fail for this row (but not
crash!).
Test plan:
0/ Create a patron with a userid=your_userid
1/ Use the import patron tool to update this userid
=> userid should have been updated
2/ Update another data and do not provide the userid
=> data should have been updated and not the userid
3/ Update another data and provide the userid, but set it to an empty
string, or '0'
=> data should have been updated and not the userid
4/ Update another patron, and set userid=your_userid
=> Update should fail and an error whouls be displayed ("already used by
another patron")
Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
Jonathan Druart [Tue, 3 May 2016 07:58:26 +0000 (08:58 +0100)]
Bug 16426: Add tests for ModMember - do not update userid
Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
Jonathan Druart [Thu, 5 May 2016 13:52:04 +0000 (14:52 +0100)]
Bug 16447: Remove occurrence of the borrow permission which does no longer exist
Bug 7976 has removed this permission, but other patches re-added it...
Note that the occurrences in sendbasket.pl, edithelp.pl, opac/svc/login should
have been removed by bug 7976.
Test plan:
git grep 'borrow.*=> 1'
should not return any results.
Signed-off-by: Marc Véron <veron@veron.ch> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Brendan Gallagher <bredan@bywatersolutions.com>
Bug 16448: Fix perlcritic errors introduced by 12478
Bug 12478 introduced two perlcritic errors. This patch fixes them.
To test:
- On master, run:
$ prove t/00-testcritic.t
=> FAIL: catalogue/search.pl and Koha/Authority.pm fail the critic tests.
- Apply the patch
- Run:
$ prove t/00-testcritic.t
=> SUCCESS: All happy
- Sign off :-D
Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>
All test successful. Needs $ export TEST_QA=1
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Brendan Gallagher <bredan@bywatersolutions.com>
Jonathan Druart [Tue, 3 May 2016 15:13:44 +0000 (16:13 +0100)]
Bug 16325: Do not return all suggestions if search for STATUS=''
This is a quick and dirty way to fix a bad bug in a messy area.
The "unknown status" tab in the suggestions table display all the
suggestions. It should only display suggestions with a STATUS=''
Test plan:
- Create some suggestions
- Go to Home > Acquisitions > Suggestions management
- Edit some suggestions and give them different status,
e.g. accepted, rejected, pending.
- Verify that they appear in the tabs as appropriate
- Edit one suggestion, set "Mark selected as" to --Choose a status--
=> Without this patch: New tab "Status unknown" containing all
suggestions
=> With this patch: tab contains only suggestions with "Unknown status"
Works as expected. Signed-off-by: Marc Véron <veron@veron.ch> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Brendan Gallagher <bredan@bywatersolutions.com>
Jonathan Druart [Tue, 3 May 2016 15:13:27 +0000 (16:13 +0100)]
Bug 16325: Add a test for SearchSuggestions when searching for STATUS=''
Test fails as expected without second patch and passes OK with second patch. Signed-off-by: Marc Véron <veron@veron.ch> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Brendan Gallagher <bredan@bywatersolutions.com>
Hector Castro [Wed, 4 May 2016 18:10:41 +0000 (12:10 -0600)]
Bug 16439: Allow styling to button for upload local cover images (Font Awesome Icons)
Improve button for upload local cover image with Font Awesome Icon
To test:
-Set syspref LocalCoverImages and OPACLocalCoverImages to Allow
-A new tab 'Images' appear in bib record detail on Intranet.
-Notice about the button upload.
-Apply the patch and reload the page.
-The button is changed for class=btn btn-mini like the button "edit"
used in items in the tab Holdings
-Also added the Font Awesome icon upload "fa fa-upload" class.
Button is styled as expected. Signed-off-by: Marc Véron <veron@veron.ch> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Brendan Gallagher <bredan@bywatersolutions.com>
Hector Castro [Tue, 3 May 2016 20:53:25 +0000 (14:53 -0600)]
Bug 16438: Use Font Awesome icons in batch templates
Add Font Awesome icons in tables in authorities and bib records
in batch item/record deletion, modification templates
To test:
1- Go to Tools > Batch item/record deletion/modification
2- Try to delete/modify itmes/bib and authorities records
3- Look all tables presented and notice about the new icons in Select all
Clear all, etc.
4- Apply patch and repeat step 1 to 3
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Work, nice view.
No Errors
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Brendan Gallagher <bredan@bywatersolutions.com>
Owen Leonard [Tue, 3 May 2016 17:09:54 +0000 (13:09 -0400)]
Bug 16159 - guarantor section missing ID on patron add form
In the patron entry form template most <fieldset> and <legend> tags have
unique ids. This patch adds ids to fieldsets and legends which lack
them.
To test apply the patch and view the patron entry form. There should be
no visual changes. There should be no HTML validation errors triggered
by this change.
Signed-off-by: Marc Véron <veron@veron.ch> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Brendan Gallagher <bredan@bywatersolutions.com>
Owen Leonard [Mon, 2 May 2016 14:04:21 +0000 (10:04 -0400)]
Bug 16415 - Layout problem on staff client detail page if local cover images are enabled
This patch fixes a layout problem which appears on the staff client
bibliographic detail page if local covers are enabled but Amazon covers
are not.
To test, apply the patch and turn off AmazonCoverImages.
- Enable the LocalCoverImages system preference and locate or create a
record which has a local cover image associated with it.
- View the bibliographic detail page. The bibliographic details should
display in two columns, with text on the left and local cover image on
the right.
- Test with AmazonCoverImages and LocalCoverImages enabled.
- Test with AmazonCoverImages enabled and LocalCoverImages disabled.
All combinations are OK. Signed-off-by: Marc Véron <veron@veron.ch> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Brendan Gallagher <bredan@bywatersolutions.com>
Owen Leonard [Tue, 3 May 2016 13:48:11 +0000 (09:48 -0400)]
Bug 16315 - OPAC Shelfbrowser doesn't display the full title
This patch adds subtitle information to the display of titles in the
OPAC's shelf browser.
To test, apply the patch and make sure OPACShelfBrowser is enabled.
- View the detail page for any title in the OPAC which has items.
- Click the "Browse shelf" link next to any item in the holdings table.
- The titles in the shelf browser should display with all subtitle
information as defined in Keywords to MARC mapping.
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Adding 245a and c as 'subtitle' in Keywords to Marc make them
show on shelf browser.
No errors.
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Brendan Gallagher <bredan@bywatersolutions.com>
Marcel de Rooy [Mon, 2 May 2016 08:06:05 +0000 (10:06 +0200)]
Bug 16411: Make Hold.t not depend on two existing branches
If you do not have two branches, this test will fail.
Can't call method "branchcode" on an undefined value.
This patch adds a borrower and two branches with TestBuilder.
Test plan:
Run the test.
Signed-off-by: Marc Véron <veron@veron.ch> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Brendan Gallagher <bredan@bywatersolutions.com>
Kyle M Hall [Tue, 3 May 2016 10:36:15 +0000 (10:36 +0000)]
Bug 16429 - Fix root problem
The root of this issue is old code in circulation.pl that is no longer
needed and leaves the affected scripts open to future regressions.
Signed-off-by: Marc Véron <veron@veron.ch> Signed-off-by: Heather Braum <hbraum@nekls.org> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Kyle M Hall [Tue, 3 May 2016 10:30:20 +0000 (10:30 +0000)]
Bug 16429 - Going to circulation from notice triggers may change logged in branch
If you edit notice triggers and then use the "Checko out" tab from the
top bar, you may change your logged in library by accident!
Test Plan:
1) Disable the system preference CircAutocompl
2) Go to the notice triggers
3) Select the triggers for a library other than the one you logged in as
4) Use the "Check out" tab at the top to check out to a patron
5) Note your logged in branch has changed ( you'll need to refresh the
page if the check out search took you directly to one patron ).
6) Apply this patch
7) Repeat steps 2-4
8) Note the branch no longer changes
Tested with both patches applied. Works as expected. Signed-off-by: Marc Véron <veron@veron.ch> Signed-off-by: Heather Braum <hbraum@nekls.org> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This test fails if you do not have a MPL branch, but a closer look shows
that we only need to replace one occurrence.
Test plan:
Run Accounts.t
Signed-off-by: Marc Véron <veron@veron.ch> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Jonathan Druart [Mon, 2 May 2016 09:40:27 +0000 (10:40 +0100)]
Bug 16405: Fix Circulation/NoIssuesChargeGuarantees.t test 2
Resolves:
Failed test 'Patron cannot check out item due to debt for guarantee'
at t/db_dependent/Circulation/NoIssuesChargeGuarantees.t line 63.
got: '10'
expected: '10.00'
Test plan:
Run the test again.
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Bug 10171: (QA followup) Make search tests use the right form
This bug removed the search tab from the main search box, so the tests
that use /cgi-bin/koha/catalogue/search.pl for searching, should use
the advanced search box instead.
To test:
- Run
$ prove t/db_dependent/www/search_utf8.t
=> FAIL: Several tests related to searching on the intranet interface fail.
- Apply the patch
- Run
$ prove t/db_dependent/www/search_utf8.t
=> SUCCESS: Tests pass
- Be happy
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Julian Maurice [Tue, 24 Mar 2015 10:30:00 +0000 (11:30 +0100)]
Bug 13903: Add API routes to list, create, update, delete reserves
GET /reserves?borrowernumber=X (list)
POST /reserves (create)
PUT /reserves/{reserve_id} (update)
DELETE /reserves/{reserve_id} (delete)
Unit tests in t/db_dependent/api/v1/reserves.t
Test plan:
1. Apply patch
2. Run unit tests
3. Play with the API with your favorite REST client, using documentation
in the swagger.json file
4. Try to make reserves until the maximum number of reserves for a user
is reached (you should have a 403 error)
Depends on bug 15126
Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Bug 16155: (QA followup) fix small bug in t/db_dependent/ILSDI_Services.t
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
With all patches applied all test pass,
all == git grep -l "use t::lib::TestBuilder" | grep -v -e 'pm$' -e Old | xargs prove
No errors
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Bug 16155: [QA Follow-up] Add transaction to BiblioFrameworks.t
This unit test does not have a transaction.
It does not need TestBuilder.
Test plan:
[1] Optionally remove records with mfw1, mfw2 from biblio_framework table.
If you ran this test before and it failed, you may have them.
[2] Run the test.
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Marcel de Rooy [Tue, 29 Mar 2016 13:32:24 +0000 (15:32 +0200)]
Bug 16155: Adjust a few other tests
Accounts.t: Only added a line that ensures the MPL branch exists.
AnonymiseIssueHistory.t: Only add a branch to work with.
Barcodes.t: Replaced clear with delete_all.
CalcFine.t: Remove default issuing rule and add one instead of updating.
Holds.t: Add category S in case it would not exist.
Members.t: Replaced clear with delete_all.
MoveItemFromBiblio.t: Replace last _fk construction.
Test plan:
Run these tests. (See note).
Git grep for only_fk, {_fk} and TestBuilder::default_value.
Note: Holds.t does not pass. Tests 9 and 39 fail, but they did already.
not ok 9 - GetReservesFromItemnumber should return a valid borrowernumber
not ok 39 - Test AlterPriority(), move to bottom
So this test needs attention, but on another report please :)
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Marcel de Rooy [Thu, 10 Mar 2016 13:42:08 +0000 (14:42 +0100)]
Bug 16155: Adjust TestBuilder.t
The changes in TestBuilder.pm require some changes in this test.
[1] Tests have been organized under subtests. A few superfluous tests have
been removed. (There is still some overlap between the sections
of overduerules_transport_type and userpermission.)
[2] The results in the build all sources-test are checked one step further.
[3] Tests are added for field length, null values and delete method.
[4] The former defaults from TestBuilder are incorporated in the tests
for userpermission.
Test plan:
Run t/db_dependent/TestBuilder.t
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Marcel de Rooy [Fri, 4 Mar 2016 14:15:40 +0000 (15:15 +0100)]
Bug 16155: Composite keys in TestBuilder and more
The number of tests using TestBuilder is gradually growing. Once you
are familiar with its use, you will appreciate it and find yourself
using it when writing new tests. Although it works quite well, some details
still needs some polishing.
While looking at the handling of composite keys in TestBuilder, a number
of related points came up too. This patch finally ended up in setting
the following design goals:
[1] TB should not only look at the first column of a composite FK.
[2] TB should optionally create records for fixed FK values.
[3] TB should create a new record, never change an existing record.
[4] TB should respect auto_increment columns.
[5] Passing a hash for a foreign key should always imply a new record.
[6] Explicitly passing undef for a column should mean NULL.
[7] Add a delete method; it will replace the clear method.
[8] Simplify by removing $default_values, hash key _fk and param only_fk.
The comments below further clarify these points. Note that they refer to
the old behavior (before this patch) unless stated otherwise.
Comments for point 1
====================
Look at:
$builder->build({
source => 'UserPermission',
value => {
borrowernumber => $borrowerno,
module_bit => { flag => 'my flag' },
code => 'will_be_ignored',
},
});
Module_bit and code here are a composite FK to permissions.
TB ignores the value for the code column here and creates a record with a
randomized code.
But if we would pass the hash in the second column of this compound key like:
borrowernumber => $borrowerno,
module_bit => 10,
code => { code => 'new_code' },
TB would now crash when passing the hash for code thru to DBIx.
Comments for point 2
====================
Look at:
$builder->build({
source => 'UserPermission',
value => {
borrowernumber => $borrowerno,
module_bit => 99,
code => 'new_super_tool',
},
});
TB detects a fixed value for the module_bit, continues and will crash on
DBIx if the foreign keys are not found. In this case it would be friendly
to create a missing linked record.
Comments for point 3
====================
Look at:
$builder->build({
source => 'Branch',
value => { branchcode => 'CPL' },
});
If this branch already exists, this call would modify the branch record and
overwrite all columns with randomized values (expected or not). In any case,
it would be safer here to return undef than modifying an existing record.
Comments for point 4
====================
Look at:
$builder->build({
source => 'Borrower',
value => { borrowernumber => '123456789' },
});
If this number would exist, we would update (as earlier). But if this
number does not exist, we would create the record. Although that is
technically possible, I would prefer to have TB respect the auto
increment property of this column.
Comments for point 5
====================
Look at:
$builder->build({
source => 'Item',
value => { homebranch => { branchcode => 'MPL' } },
});
As discussed under point 3, we should actually not pass primary key values
if we expect to build new records. The same also holds for the deeper
(recursive) calls to build when using hashes like here for homebranch.
In this case again an existing record might be overwritten.
Comments for point 6
====================
Look at:
$builder->build({
source => 'Reserve',
value => { itemnumber => undef },
});
As you know, a reserve without an itemnumber is a biblio level hold.
Unfortunately, TB did not care about passing undefs until now. So you would
get an item level hold.
In the new situation TB will respect these explicit undefs, as long as the
corresponding foreign key column is nullable of course.
Comments for point 7
====================
This patch will allow you to delete records created by TB:
my $patron = $builder->build({ source => 'Borrower' });
$builder->delete({ source => 'Borrower', records => $patron });
Or:
$builder->delete({ source => 'Borrower', records => [ $patron, ... ] });
For safety, delete requires you to provide all primary key values in the
passed hashref(s).
Deleting all records in a table via clear is no longer supported and can
still be arranged in one statement.
Comments for point 8
====================
Current use of TestBuilder reveals that $default_values and only_fk
are not really needed. The current $default_values should imo not be in the
module anyway; if you want to use it, you could still pass it to TB:
$builder->build({ ..., value => { %defa, %your_values } });
Only_fk stops at the very last step of saving the top level record while
storing all linked records at the lower levels. Practical use is not
very obvious; it can be easily simulated by one delete statement.
The hash key _fk is now used to store all linked records one or more levels
down. It is used in a few tests to retrieve a value one level down.
Why not retrieve that one value via the database and get rid of the
whole structure?
Implementation
==============
This highlights the main changes:
The $default_value hash (with some hardcoded values for UserPermission)
is removed from the module. It was used by a test in TestBuilder.t and has
been relocated.
The value of $gen_type is returned now by sub _gen_type. (See new.)
The main change in the build method is moving the foreign keys logic to a
new subroutine _create_links. This routine now looks at all columns of a
composite FK. It checks if a linked record exists for passed values, and
it looks at NULL values.
Routine _buildColumnValues is slightly adjusted to allow for passed undef
values. The theoretically endless loop is replaced by three tries. For
composite unique constraints we only check complete sets of values.
Routine _getForeignKeys contains a check to not return the same relation
twice in case of doubled belongs_to relations in the DBIx scheme.
The eval in _storeColumnValues is removed. The autoincrement check in sub
_buildColumnValue got more priority; the handling of foreign keys has been
adjusted and a check for not-nullable columns has been added.
TEST PLAN
=========
This patch only deals with the TestBuilder module itself. In the follow-up
patches TestBuilder.t and a few other unit tests are adjusted.
[1] Do not yet apply this patch. But apply the 'OldBehavior' patch.
Verify that all tests pass. (They cover the first six design goals.)
[2] Apply this patch. Does TestBuilder still compile (perl -c)?
[3] Run the OldBehavior test again. Do all tests fail now? This means
that we got rid of all unwanted side-effects in the list of goals.
[4] Run some other tests that use TestBuilder. (See below.)
Skip the following tests; a follow-up patch deals with them.
t/db_dependent/Accounts.t
t/db_dependent/Barcodes.t
t/db_dependent/Circulation/AnonymiseIssueHistory.t
t/db_dependent/Circulation/CalcFine.t
t/db_dependent/Holds.t
t/db_dependent/Items/MoveItemFromBiblio.t
t/db_dependent/Koha/BiblioFrameworks.t
t/db_dependent/Members.t
t/db_dependent/TestBuilder.t
Jonathan Druart [Thu, 10 Mar 2016 14:47:36 +0000 (14:47 +0000)]
Bug 15263: (follow-up) XSLT display fetches sysprefs for every result processed
Set variables ($sysxml, $xslfilename, $lang) if they are not passed to
the subroutine. This happens from catalogue/detail.pl,
opac/opac-shelves.pl, opac/opac-tags.pl and virtualshelves/shelves.pl.
Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Mirko Tietgen [Sun, 29 Nov 2015 19:35:19 +0000 (20:35 +0100)]
Bug 15263: XSLT display fetches sysprefs for every result processed
On search, every single result goes through some XSLT processing.
This includes fetching the relevant sysprefs every single time.
We should do it only once per search.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This patch introduces the koha-sitemap script. This script wraps calls to
the misc/cronjobs/sitemap.pl script so it can be done easily instance-wise.
It sets /var/lib/koha/${instance}/sitemap as the destination directory for
the sitemap files. A followup will make them available through an Apache
configuration entry.
koha-functions.sh is provided with a handy is_sitemap_enabled function so
we can later add filters to other commands (koha-list, koha-foreach, etc).
Exposes sitemap files to apache. This is suitable for including the sitemap in
the robots.txt file as proposed in
Note: it depends on Apache 2.4+ so we can patch the file as needed. Older
Apache users will be warned that they need to tweak the apache files on their
own.
To test:
- You can build a package out of this patchset, or do the following on a kohadevbox
cp debian/scripts/koha-functions.sh /usr/share/koha/bin
- Run
$ debian/scripts/koha-sitemap --help
- Go through all the options (--enable, --disable, generate).
(a) --enable:
- debian/scripts/koha-sitemap --enable kohadev
=> SUCCESS: /var/lib/koha/kohadev/sitemap.enabled is created
- call it again, a suitable warning is raised and the file is still there
(b) debian/scripts/koha-sitemap --disable kohadev
=> SUCCESS: /var/lib/koha/kohadev/sitemap.enabled is deleted
- call it again, a suitable warning is raised and the file does not exist
(c) --generate:
- debian/scripts/koha-sitemap --generate kohadev
=> SUCCESS: sitemapindex.xml and sitemap000X.xml files are generated in
/var/lib/koha/kohadev/sitemap/
- Sign off :-D
Sponsored-by: Orex Digital Signed-off-by: Frédéric Demians <f.demians@tamil.fr> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Alex Arnaud [Thu, 11 Feb 2016 15:02:42 +0000 (16:02 +0100)]
Bug 15564 - Fix tranfert branch: Set collection branch with return branch if it is empty.
Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Natasha [Wed, 20 Jan 2016 23:35:48 +0000 (23:35 +0000)]
Bug 15564 - Display "print slip" option when returning an item which is in a rotating collection
To Test -
1. Make a new rotating collection (under tools) with at least one book in it.
2. Check out the book/s from rotating collection.
3. Set library to a different library.
4. Check in book you just checked out.
5. Should show a dialog box with no print slip link or city.
6. Apply patch and repeat steps 1-4. Dialog box should now show the item name, city name and print slip link.
Patch works as expected. (Superfluous white space removed on line 136) Signed-off-by: Marc Véron <veron@veron.ch> Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Bug 16383: Making Local Use sysprefs actions buttons
To test:
1) Go to Admin -> System Preferences -> Local Use tab
2) Confirm buttons show as font awesome buttons and work as expected
3) Confirm buttons do not wrap on a narrower browser
Sponsored-by: Catalyst IT Signed-off-by: Marc Véron <veron@veron.ch> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Jonathan Druart [Fri, 29 Apr 2016 15:52:26 +0000 (16:52 +0100)]
Bug 16398: Keep the expanded view after clearing the search form
On the advanced search form, the "Clear fields" button should pass expanded_options
param to preserve the view we use.
Test plan:
- Click on more options
- Fill some fields
- Click on "Clear fields"
=> Without this patch you get the "fewer options" view
=> With this patch, you will keep the "more options" view
Signed-off-by: Marc Véron <veron@veron.ch> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Katrin Fischer [Fri, 29 Apr 2016 00:53:43 +0000 (02:53 +0200)]
Bug 16384: Fix cancel link for 'Edit basket'
When you edit the basket from the basket summary page,
saving the change brings you back to the basket summary
page, but cancelling brings you to the baskets page of
the vendor.
To test:
- Add a basket in acq
- Test cancel link returns to baskets page of vendor
- Add a basket and save
- Edit this basket
- Test cancel link now returns to basket summary page
Signed-off-by: Marc Véron <veron@veron.ch> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
On fixing this tests, we retrieved the JSON data for the datatable used on
the 'Manage staged records' page. It would be cool to check the data it
carries makes sense.
To test:
- Run t/db_dependent/www/batch.t
=> SUCCESS: Tests pass
- Sign off :-D
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
All test pass
prove t/db_dependent/www/batch.t
t/db_dependent/www/batch.t .. ok
All tests successful.
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Bug 16423: Fix t/db_dependent/www/batch.t so it matches new layout
This patch adjusts batch.t so it matches the use of datatables on the
'Manage staged records' page, and small layout changes already fixed
on search_utf8.t.
The tests are slightly modified so they actually test interesting stuff.
Some were passing only because an undefined value was passed.
To test:
- On master, run
$ prove t/db_dependent/www/batch.t
=> FAIL: Tests fail notably
- Apply the patch
- Run:
$ prove t/db_dependent/www/batch.t
=> SUCCESS: Notice tests now pass.
- Sign off :-D
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Test pass
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Jonathan Druart [Mon, 2 May 2016 14:41:42 +0000 (15:41 +0100)]
Bug 16419: follow-up of bug 11371 - Fix t/db_dependent/Acquisition.t
The tests added by bug 11371 have been put after the rollback statement.
Test plan:
prove t/db_dependent/Acquisition.t
should return green
Signed-off-by: Marc Véron <veron@veron.ch> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Tests fail before the patch, and pass with it. QA scripts like the patch too.
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Failed test 'GetReservesFromItemnumber should return a valid borrowernumber'
at t/db_dependent/Holds.t line 97.
got: '2000001890'
expected: '2000001889'
Failed test 'Test AlterPriority(), move to bottom'
at t/db_dependent/Holds.t line 220.
got: '4'
expected: '5'
Test plan:
Run the test before and after applying this patch.
Signed-off-by: Marc Véron <veron@veron.ch> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Resolves:
Failed test 'GetBranchitem returns holdallowed and return branch'
at t/db_dependent/Circulation/Branch.t line 226.
Structures begin differing at:
$got->{hold_fulfillment_policy} = 'any'
$expected->{hold_fulfillment_policy} = Does not exist
Failed test 'Without parameters GetBranchItemRule returns the values in default_circ_rules'
at t/db_dependent/Circulation/Branch.t line 234.
Structures begin differing at:
$got->{hold_fulfillment_policy} = 'any'
$expected->{hold_fulfillment_policy} = Does not exist
Failed test 'With only a branchcode GetBranchItemRule returns values in default_branch_circ_rules'
at t/db_dependent/Circulation/Branch.t line 239.
Structures begin differing at:
$got->{hold_fulfillment_policy} = 'any'
$expected->{hold_fulfillment_policy} = Does not exist
Failed test 'With only one parametern GetBranchItemRule returns default values'
at t/db_dependent/Circulation/Branch.t line 244.
Structures begin differing at:
$got->{hold_fulfillment_policy} = 'any'
$expected->{hold_fulfillment_policy} = Does not exist
Test plan:
Run test before and after applying this patch.
Signed-off-by: Marc Véron <veron@veron.ch> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Note: I do not see the usefulness of the lazy_any variable, I don't
think it make things easier to read.
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Owen Leonard [Tue, 26 Apr 2016 18:54:23 +0000 (14:54 -0400)]
Bug 16369 - Clean up and improve plugins template
This patch makes multiple changes to the plugins home page template to
bring it up to date with current interface patterns.
Test the following changes:
- Breacrumb links have been corrected to include "Tools" in the path.
Verify that this link is correct.
- A toolbar has been added for an "Upload plugin" button. Uploading is
an action, not a view, so it should be displayed in a toolbar. Verify
that the button works correctly.
- Messages are now formatted as messages rather than as headings. To
test, trigger a message by, for instance, uninstalling all plugins or
passing an invalid "method" parameter with the URL.
- Incorrect capitalization corrected.
- Plugin actions are moved to a single "Actions" dropdown menu. This
includes 'Run report,' 'Run tool,' 'Configure,' and 'Uninstall.' Test
that all these menu options work correctly.
- The standard "Tools" sidebar menu has been added.
- An "onclick" attribute has been removed in favor of defining the event
in JavaScript. Test by choosing the 'Uninstall' menu item for a
plugin. Test both confirm and cancel actions.
Also changed:
- Corrected capitalization on the tools home page.
- Adding missing plugins link to the tools sidebar menu.
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Items.t inserts an item via biblioitem not correctly linked to biblio.
The new foreign key constraint does not allow that.
Actually, we should be choosing to either remove biblioitems from Koha or
remove biblionumber from items.
Note: This seems to be the only case where an item is added this way.
Test plan:
Run Items.t
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Mark Tompsett [Thu, 31 Mar 2016 00:11:45 +0000 (20:11 -0400)]
Bug 16170 - Corrected to make work more smoothly
Signed-off-by: Mark Tompsett <mtompset@hotmail.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Marcel de Rooy [Wed, 23 Mar 2016 15:59:26 +0000 (16:59 +0100)]
Bug 16170: Pseudo foreign key in Items
While many of us would like to get rid of biblioitems one day, the current
scheme includes a biblioitemnumber and a biblionumber in Items.
(Which is not so great..)
But also note that biblionumber is NOT defined as a foreign key in Items,
although a belongs_to relation has been added to the DBIx scheme!
This inconsistency should be resolved. The "remove biblioitem table"
operation is a large one, but in the meantime we better make biblionumber
a regular FK not a 'pseudo' one.
Note: If in an (very) exceptional case biblionumbers are found in items,
that do not exist in biblio, this patch prints a warning at upgrade
time and does not add the constraint.
@RM: Please update the DBIx scheme accordingly.
Test plan:
[1] Run the upgrade. Check if the FK constraint has been added.
[2] Remove the FK constraint. Change the biblionumber of one item to an
unexisting record. Run the upgrade again. Notice the warning.
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Tested both cases: constraint added as well as warning printed.
Signed-off-by: Mark Tompsett <mtompset@hotmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Owen Leonard [Fri, 29 Apr 2016 16:29:01 +0000 (12:29 -0400)]
Bug 16397 - Unable to delete audio alerts
This patch corrects a JavaScript error which has arisen due to the
jQuery upgrade. This should have been included in Bug 16321.
To test, apply the patch and go to Administration -> Audio alerts.
- In the list of existing audio alerts, check one or more checkboxes.
The "Delete selected" button should become enabled.
- Uncheck all checkboxes and check that the "Delete selected" button is
now disabled.
- Confirm that deletions are completed correctly.
Signed-off-by: Marc Véron <veron@veron.ch> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Tested with memcached and without MEMCACHED_SERVERS.
Cache.t, Context.t and sysprefs.t pass now.
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Mark Tompsett [Mon, 8 Jun 2015 03:40:50 +0000 (23:40 -0400)]
Bug 14362: Regression tests
This should trigger the error. Attempts to shift system time
zones did not make sense as to the number of failures.
Added Time::Fake dependency, if it isn't installed these extra
tests don't run. There is a nice skip message about it.
Added License text.
TEST PLAN
---------
1) apply test patch
2) sudo dpkg-reconfigure tzdata
-- set your system time to GMT (Africa/Abidjan)
3) prove t/Circulation/AgeRestrictionMarkers.t
-- should not fail, even if you change system
time to any time.
4) sudo dpkg-reconfigure tzdata
-- set your timezone to Eastern
5) sudo date -s"2015-06-18 21:15:00"
6) date
-- should be past 9pm Eastern timezone
7) prove t/Circulation/AgeRestrictionMarkers.t
-- kaboom!
8) sudo date -s"2015-06-18 12:00:00"
9) date
-- should be noon Eastern timezone
10) prove t/Circulation/AgeRestrictionMarkers.t
-- success?! Time sensitive tests are bad tests.
11) sudo apt-get install libtime-fake-perl
12) prove t/Circulation/AgeRestrictionMarkers.t
-- kaboom!
-- changing timezone to anything other than GMT
should trigger a kaboom.
13) apply fix patch
14) prove t/Circulation/AgeRestrictionMarkers.t
-- should work all the time.
15) less t/Circulation/AgeRestrictionMarkers.t
-- the license text should be similar to
http://wiki.koha-community.org/wiki/Coding_Guidelines#Licence
16) koha qa test tools.
Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Mark Tompsett [Mon, 8 Jun 2015 01:26:53 +0000 (21:26 -0400)]
Bug 14362: PEGI15 Circulation/AgeRestrictionMarkers test fails
It is best to test when UTC date is a date in the future compared
to your timezone. I'm in Eastern, so right now, I expect this
test to fail for another 2.5 hours.
TEST PLAN
---------
1) prove t/Circulation/AgeRestrictionMarkers.t
-- fails for PEGI 15 after 9pm.
2) Apply patch
3) prove t/Circulation/AgeRestrictionMarkers.t
-- works.
4) koha qa test tools
Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Jonathan Druart [Mon, 4 Jan 2016 09:23:15 +0000 (09:23 +0000)]
Bug 12528: redirect to 404 if at least 1 pref is off
Signed-off-by: Marc Véron <veron@veron.ch> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Kyle M Hall [Mon, 4 Jan 2016 09:21:07 +0000 (09:21 +0000)]
Bug 12528: Bug 9254: Followup - Rename pref to EnhancedMessagingPreferencesOPAC
If the new pref is named EnhancedMessagingPreferencesOPAC, it will show
up adjacent to EnhancedMessagingPreferences
Signed-off-by: Marc Véron <veron@veron.ch> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Bouzid Fergani [Mon, 28 Dec 2015 13:59:21 +0000 (08:59 -0500)]
Bug 12528 - fix problem when insert OPACEnhancedMessagingPreferences
Signed-off-by: Aleisha <aleishaamohia@hotmail.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Bouzid Fergani [Mon, 2 Nov 2015 21:45:45 +0000 (16:45 -0500)]
Bug 12528 - Enable staff to deny message setting access to patrons on the OPAC
- Change the preference Enhancedmessagingpreference description.
- Enable default EnhancedMessagingPreferences and OPACEnhancedMessagingPreferences.
- not sent e-mail it's necessary, when user call opac-messaging.pl directly..
Testing:
I Apply the patch
II Run updatedatabase.pl
0) Search OPACEnhancedMessagingPreferences preference;
1) Validate "OPACEnhancedMessagingPreferences show patron messaging
setting on the OPAC (NOTE: EnhancedMessagingPreferences must be
enabled).";
2) Disable OPACEnhancedMessagingPreferences preference;
3) Enable EnhancedMessagingPreferences preference;
4) On the OPAC -> user's settings, validate "your messaging" is not
showed.
Signed-off-by: Frederic Demians <f.demians@tamil.fr>
Works as expected. With the new syspref, patrons can be forbidden to
modify themselves their own messaging preferences.
Marcel de Rooy [Mon, 18 Jan 2016 10:48:14 +0000 (11:48 +0100)]
Bug 15543: Use another notice in membership_expiry.pl
This patch adds a letter parameter to the cron job membership_expiry.
It is used to substitute the default notice by another one.
This could be handy if you e.g. send a reminder after the first notice.
In any case, it allows for more flexibility.
Apart from this new parameter, this patch removes the sub parse_letter from
the code. The call to GetPreparedLetter is moved to the for loop and the
call to getletter is removed (no longer needed). If there is no letter
found, the Letter module already warns you. So we just exit the loop.
Test plan:
[1] Run membership_expiry.pl -c -n -v -let NOT_EXIST
Check if you see a warning (coming from Letters.pm)
[2] Check if you have some soon expiring patrons or add before/after
parameter to include some.
Run membership_expiry.pl -c -n -v [-before ?] [-after ?]
[3] Create a new notice MEMBERSHIP2. Copy the text from the original notice
and make some adjustments.
[4] Run membership_expiry.pl -c -v -let MEMBERSHIP2 [-before ?] [-after ?].
Be aware that this call generates email messages.
Verify that the email contained the adjusted text.
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
On top of Bug 14834
Work as described, tested using '-n' to see messages on terminal, e.g.
membership_expiry.pl -v -n -c -before 3 -branch BC -after 2 --letter MEMEXP2
No errors
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Bug 14834: Make membership_expiry cronjob more flexible
This patch adds three parameters to the cron job: -before and -after, and
-branch.
You can run the cronjob now in an adjusted frequency: say once a week with
before 6 or after 6 (not both together). If your pref is set to 14, running
before=6 will include expiries from 8 days to 14 days ahead. When you
use after=6, you would include 14 days to 20 days ahead, etc.
You could also rerun the job of yesterday by setting before=1 and after=-1;
this could help in case of problem recovery.
Obviously, the branch parameter can be used as a filter.
NOTE: Why are these parameters passed only via the command line?
Well, obviously the branch parameter is not suitable for a pref.
The before/after parameter allows you to handle expiry mails different from
the normal scheme or could be used in some sort of recovery. In those cases
it will be more practical to use a command line parameter than editing a
pref.
NOTE: The unit test has been adjusted for the above reasons, but I also
added some lines to let existing expires not interfere with the added
borrowers by an additional count and using the branchcode parameter.
Test plan:
[1] Run the adjusted unit test GetUpcomingMembershipExpires.t
[2] Set the expiry date for patron A to now+16 (with pref 14).
Set the expiry date for patron B to now+11.
[3] Run the cronjob without range. You should not see A and B.
[4] Run the cronjob with before 3. You should see patron B.
[5] Run the cronjob with before 3 and after 2. You should see A and B.
[6] Repeat step 5 with a branchcode that does not exist. No patrons.
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Work as described following test plan.
Test pass
No errors
New parameters work with one (-) or two(--) dashes, no problem
with that but convention suggest that 'long' options use two-dashes.
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>