As suggested by Paul Poulain un Bug 8376, this patch adds a --where parameter to filter some kind of borrowers to export. Also adding a --separator parameter, usefull when the recipient of the export ask for a specific file format.
Created attachment 13362 [details] [review] Bug 9045 : Adding --where parameter to filter what kind of borrowers to export and --separator to choose a specific caracter for patron export
Created attachment 13363 [details] [review] Bug 9045 : Adding --where parameter to filter what kind of borrowers to export and --separator to choose a specific caracter for patron export
Forgot a warn, sent a new patch
Created attachment 13923 [details] [review] [SIGNED-OFF] Bug 9045 : Adding --where parameter to filter what kind of borrowers to export and --separator to choose a specific caracter for patron export Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Tested, works as advertised. Note, to use tab character as a separater, do this: -s $'\t'
*** Bug 8874 has been marked as a duplicate of this bug. ***
QA Comment: Nice addition! Two points of attention: Looking for a cardnumber that does not exist produces: DBD::mysql::st fetchrow_array failed: fetch() without execute() at ./export_borrowers.pl line 112. Please check if your query still has result records. Note that you should already do that on line 91 (first fetchrow). This may already give no results and a uninit warning in the log. Documentational note: Using a condition on a character field requires using quotes like: ./export_borrowers.pl -s @ -where "surname='De Rooy'" I would suggest explaining this in the usage statement with a simple example (not using the previous one :) Just for the record: The where clause coming from the command line is not checked, so could be misused (sql injection). Note that does not block this patch; more command-line scripts in misc contain similar constructs. Failed QA
Created attachment 16249 [details] [review] Bug 9045 followup : Adding test if results has some records and usage example for --where clause
Follow-up patch to answer Marcel De Rooy requirements. If request has no results, script exits with a meaningful message
Created attachment 16440 [details] [review] [SIGNED-OFF] Bug 9045 - Adding some parameters to export_borrowers.pl Followup : Adding test if results has some records and usage example for --where clause Signed-off-by: Owen Leonard <oleonard@myacpl.org> I infer from the bug comments that a proper test for this patch is to check how the script reacts if it returns no results with a --where clause, and to verify that there is a good usage example for the --where option. These are both true, so I think this passes.
Created attachment 16578 [details] [review] [PASSED QA] Bug 9045 : Adding --where parameter to filter what kind of borrowers to export and --separator to choose a specific caracter for patron export Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Tested, works as advertised. Note, to use tab character as a separater, do this: -s $'\t' Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> Comments on second patch.
Created attachment 16579 [details] [review] [PASSED QA] Bug 9045 - Adding some parameters to export_borrowers.pl Followup : Adding test if results has some records and usage example for --where clause Signed-off-by: Owen Leonard <oleonard@myacpl.org> I infer from the bug comments that a proper test for this patch is to check how the script reacts if it returns no results with a --where clause, and to verify that there is a good usage example for the --where option. These are both true, so I think this passes. Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> All tests and QA script pass. Tests done: - tested -s option with \; - tested -f surname -f borrowernumber to have multiple fields specified - tested -w with "borrowernumber > 100" and similar with and without results - if no results a message is shown - tested -h shows documentation for new options
This patch has been pushed to master.