Skip to content

Commit 68ac9ba

Browse files
committed
Add more information into notes of event
1 parent c4c0b57 commit 68ac9ba

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

class/sellyoursaasutils.class.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@ public function doValidateDraftInvoices($restrictonthirdpartyid = 0, $maxtoproce
134134
if (is_array($invoice->linkedObjects['contrat']) && count($invoice->linkedObjects['contrat']) > 0) {
135135
$errorforinvoice = 0;
136136

137+
$codepaiementdirectdebit = 'PRE';
138+
$codepaiementtransfer = 'VIR';
139+
137140
$this->db->begin();
138141

139142
foreach ($invoice->linkedObjects['contrat'] as $idcontract => $contract) {
@@ -225,6 +228,11 @@ public function doValidateDraftInvoices($restrictonthirdpartyid = 0, $maxtoproce
225228
}
226229

227230
$invoice->context['actionmsgmore'] = 'Invoice id = '.$invoice->id.' validated by doValidateDraftInvoices()';
231+
if ($invoice->mode_reglement_code == $codepaiementtransfer) {
232+
$invoice->context['actionmsgmore'] .= '. Payment mode is a credit transfer ('.$invoice->mode_reglement_code.') so we will send an email to the customer after validation to inform it about invoice availability.';
233+
} else {
234+
$invoice->context['actionmsgmore'] .= '. Payment mode is NOT a credit transfer ('.$invoice->mode_reglement_code.') so no email is sent after the invoice validation. May be done later by another process.';
235+
}
228236

229237
$result = $invoice->validate($user); // Validate invoice (does not regenerate the PDF)
230238

@@ -259,9 +267,6 @@ public function doValidateDraftInvoices($restrictonthirdpartyid = 0, $maxtoproce
259267
if (!$errorforinvoice) {
260268
dol_syslog("-- Check if invoice payment mode is a differed mode (direct debit or credit transfer): mode_reglement_code=".$invoice->mode_reglement_code);
261269

262-
$codepaiementdirectdebit = 'PRE';
263-
$codepaiementtransfer = 'VIR';
264-
265270
if ($invoice->mode_reglement_code == $codepaiementdirectdebit || $invoice->mode_reglement_code == $codepaiementtransfer) {
266271
// If customer invoice is an invoice to pay with a direct debit or is waiting a credit transfer
267272
$enddatetoscan = dol_time_plus_duree($now, 20, 'd');
@@ -439,7 +444,7 @@ public function doValidateDraftInvoices($restrictonthirdpartyid = 0, $maxtoproce
439444
$from = getDolGlobalString('SELLYOURSAAS_NOREPLY_EMAIL');
440445

441446
$trackid = 'inv'.$invoice->id;
442-
$moreinheader = 'X-Dolibarr-Info: doValidateInvoice'."\r\n";
447+
$moreinheader = 'X-Dolibarr-Info: doValidateInvoice invoice is available'."\r\n";
443448
$addr_cc = '';
444449
if (!empty($invoice->thirdparty->array_options['options_emailccinvoice'])) {
445450
dol_syslog("We add the recipient ".$invoice->thirdparty->array_options['options_emailccinvoice']." as CC to warn about invoice availability (direct debit or credit transfer case)", LOG_DEBUG);

0 commit comments

Comments
 (0)