check for missing recipients

This commit is contained in:
Daniel Seifert 2022-08-09 12:02:06 +02:00
parent 1ac8b193e9
commit 3c12bd79b5
Signed by: DanielS
GPG Key ID: 8A7C4C6ED1915C6F
2 changed files with 10 additions and 6 deletions

View File

@ -67,6 +67,8 @@ class d3linkmobility_ordermanager_action extends d3ordermanager_action_abstract
return 'D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_ERR_NOVALIDTPL';
} elseif ($this->hasRequiredValuesCmsSource(false)) {
return 'D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_ERR_NOVALIDCMS';
} elseif ($this->hasRequiredValuesRecipient(false)) {
return 'D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_ERR_NORECIPIENT';
} else {
return 'D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_ERR_UNDEFINED';
}
@ -132,7 +134,7 @@ class d3linkmobility_ordermanager_action extends d3ordermanager_action_abstract
(
$this->hasRequiredValuesTplSource(true) ||
$this->hasRequiredValuesCmsSource(true)
) && $this->hasRequiredValuesRecipient();
) && $this->hasRequiredValuesRecipient(true);
}
/**
@ -204,16 +206,17 @@ class d3linkmobility_ordermanager_action extends d3ordermanager_action_abstract
/**
* @return bool
*/
protected function hasRequiredValuesRecipient(): bool
protected function hasRequiredValuesRecipient(bool $blExpected): bool
{
$toCust = (bool) $this->getManager()->getValue('blLinkMobilityMessageToCustomer');
$toCustom = (bool) $this->getManager()->getValue('blLinkMobilityMessageToCustom');
$toCustomAddress = (string) $this->getManager()->getValue('sLinkMobilityMessageToCustomAddress');
return $toCust || (
$toCustom &&
(bool) strlen(trim($toCustomAddress))
);
if ($blExpected === true) {
return $toCust || ( $toCustom && (bool) strlen( trim( $toCustomAddress ) ) === true );
} else {
return !($toCust || ( $toCustom && (bool) strlen( trim( $toCustomAddress ) ) === true ));
}
}
/**

View File

@ -47,6 +47,7 @@ $aLang = [
'D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_ERR_NOVALIDSOURCE' => 'keine gültige Inhaltsquelle gesetzt',
'D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_ERR_NOVALIDTPL' => 'keine gültigen Templatedaten gesetzt',
'D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_ERR_NOVALIDCMS' => 'kein gültiger CMS-Eintrag gesetzt',
'D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_ERR_NORECIPIENT' => 'kein gültiger Empfänger gesetzt',
'D3_ORDERMANAGER_ACTION_LINKMOBILITYMESSAGE_ERR_UNDEFINED' => 'unbekannter Fehler',
'D3_ORDERMANAGER_JOBDESC_SENDLMMESSAGE' => 'sende SMS via LinkMobility an %s',