Project60 / Project60/org.project60.banking

CSV importer: validate line_filter

Open
#447 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
22
Forks
45
Avg merge
3d 15h
Merged PRs (30d)
7

Description

And another one ;)

Since regular expressions can be quite sophisticated I think we should validate entries for line_filter.

First of all this should happen while submitting the form:

  • execute the regex
  • check for result FALSE

I not sure how to implement the config validation - is there a preferred method?
I think this should / could be done in class CRM_Banking_Form_Configure (CRM/Banking/Form/Configure.php).

  • CRM_Banking_Form_Configure inherits CRM_Core_Form which offers public function validate(). Should I overwrite this one (of course calling parent::validate())?
  • The example in the Developer documentation uses addRules().
  • If I implement the validation in CRM_Banking_Form_Configure: how do I check which plugin is used?
  • Or is there another way I am not aware of?

I will try to find out myself but I'm also grateful for any directions.

I think it would be best to also check the result during the actual imports - just in case someone fiddled with the JSON directly in the database table civicrm_bank_plugin_instance). What do you think?
In that case we could set a civi error - but I am not quite sure how do to that - maybe someone can give me a hint?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with CRM/Banking/Form/Configure.php, CRM_Core_Form::validate(), and the QuickForm addRules() example linked in the issue. Trace how the CSV importer uses line_filter and how configuration is read from civicrm_bank_plugin_instance. Done means invalid regular expressions are rejected during form submission and safely handled during imports.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.