Project60 / org.project60.sepa

SEPA direct debit integration with civicrm
19 stars 46 forks source link

Can't declare a batch as received #678

Closed allinappliadmin closed 1 month ago

allinappliadmin commented 11 months ago

Although I see the 'mark as received' button, there is no link behind and I have no way to update the batch's status. Is it a bug or a missing option in the settings? Using CiviSEPA 1.8 on WP 6.2.2 / CiviCRM 5.62.1 image

bjendres commented 11 months ago

there is no link behind

@allinappliadmin A click on those buttons is supposed to trigger a JS call to close the group, and then refresh the page. Could you check for errors in the browser's JS console?

allinappliadmin commented 11 months ago

@bjendres you're right there's an error on:

Uncaught SyntaxError: unexpected token: identifier

it seems related to this file : admin.php:1030:85 and this script:

<script type="text/javascript">
var received_confirmation_message = "Voulez vous vraiment marquer ces groupes comme "règlement reçu" ?";

function mark_received(group_id) {
  if (confirm(received_confirmation_message)) {
    cj("#mark_received_" + group_id).hide();
    cj("#busy_" + group_id).show();
    CRM.api('SepaAlternativeBatching', 'received', {'q': 'civicrm/ajax/rest', 'txgroup_id': group_id},
      {success: function(data) {
        // reload page
        location.reload();
      },
       error: function(data) {
        // show error message
        cj("#busy_" + group_id).hide();
        alert(data.error_message.error_message);
      }}
    );
  }
}
</script>

when I try to click I get this error:

Uncaught ReferenceError: mark_received is not defined

What do you think about this?

bjendres commented 11 months ago

What do you think about this?

It seems like the received_confirmation_message is passed into the script file in a very unsafe way. This was, in fact, poorly implemented by myself in what feels like an eternity ago :) This needs to be fixed.

However, in the meantime, you could change the translation of the relevant string to something not containing double quotes ("), so it would work again for you.

allinappliadmin commented 11 months ago

where do I find this string? I'm not sure about what you're talking about.

However, in the meantime, you could change the translation of the relevant string to something not containing double quotes ("), so it would work again for you.

bjendres commented 11 months ago

where do I find this string? I'm not sure about what you're talking about.

I mean this string, that seems to have been translated to French. This French translation contains double quotes (") which them messes with the JS (and needs to be repaired).

See the string here: https://github.com/Project60/org.project60.sepa/blob/ba5fe43b8b3ee3a50ad2fdb085b97fb96e27ab1a/templates/CRM/Sepa/Page/DashBoard.tpl#L170

If you change the French translation in the translation file (HERE) it should work fine.

Alternatively, you can simply switch the language to English.

allinappliadmin commented 11 months ago

should I use simple quote in the translation ?

bjendres commented 11 months ago

should I use simple quote in the translation ?

I guess you can, since it seems to be working in English :)

allinappliadmin commented 11 months ago

was this translated on Transifex?

bjendres commented 11 months ago

was this translated on Transifex?

I don't know

allinappliadmin commented 11 months ago

Archive.zip

allinappliadmin commented 11 months ago

please find here the correct .po & .mo files and I've edited on Transifex: https://app.transifex.com/civicrm/civicrm_extensions/translate/#fr/sepa/319462832 I don't understand why Usha who did the translated used double quotes instead of simple. Anyway, it's fixed

allinappliadmin commented 11 months ago

thanks Björn

bjendres commented 11 months ago

I've changed the string delimiters to backticks with https://github.com/Project60/org.project60.sepa/commit/82d2cf36057733089a3d3f7d52bd51e806e39ab0. It's not really a fix, but it should make this issue less likely.

allinappliadmin commented 11 months ago

ok, thanks, anyway the translation was also fixed

allinappliadmin commented 10 months ago

I guess there was a problem with Transifex because I had to translate again the .po file on the instance even though it's up-to-date on Transifex. Which version/file/service is used by CiviCRM to update localization files.

bjendres commented 10 months ago

Does it work if you switch it to English? If so, somebody should probably adjust the individual localisations in transifex. Weird though, I though the back ticks should take care of this...

allinappliadmin commented 10 months ago

I haven't try with the English version but the problem is elsewhere. The localization file wasn't synchronized between Transifex where the chain is now properly translated without the double quotes that were previously present (I did this correction) and the somewhere-I-don't-where where the latest localization files are stored and ready to be automatically uploaded and updated on the CiviCRM instance. I've also wrote a message on the localization channel on Mattermost. But maybe there's a setting to change on 'your side' to improve the synchronization process.

Context of the issue: I first faced the issue on the instance because the chain was wrong, I then corrected it and modified the .po file and thought it was and would be fixed, and then the JS issue came again and I discovered that the .po file had been overwritten by an older version than the one on Transifex.

allinappliadmin commented 7 months ago

This issue is back again but with a different error. Using CiviCRM 5.67.3 and CiviSepa 1.9.1 The console shows me :

Uncaught ReferenceError: mark_received is not defined
    onclick https://domain.com/wp-admin/admin.php?page=CiviCRM&q=civicrm/sepa/dashboard&status=closed:1

Any thoughts about this?

allinappliadmin commented 6 months ago

Version 1.10-dev+4ad4b0cbb5336161 seems to fix the issue on CiviCRM 5.67.3 and I was able to mark a batch as received. Thanks for the improvements