Skip to content

Commit

Permalink
Add a notification when recurring invoice template is missing recurre…
Browse files Browse the repository at this point in the history
…nce.
  • Loading branch information
emaijala committed Dec 9, 2024
1 parent b833eef commit d4ac212
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 11 deletions.
13 changes: 12 additions & 1 deletion form.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,18 @@ function createForm($strFunc, $strList, $strForm)
$strForm, $formConfig, $intKeyValue ? false : true, true, $recordDeleted
);

if ($strForm == 'invoice_template' && !empty($astrValues['next_interval_date'])
if ($intKeyValue && $strForm == 'invoice_template') {
$alertClass = empty($astrValues['next_interval_date']) || empty($astrValues['interval_type'])
? '' : ' hidden';

?>
<div class="alert alert-warning message js-recurrence-alert<?php echo $alertClass?>" role="alert">
<?php echo Translator::translate('RecurrenceOrNextInvoiceDateNotSet')?>
</div>
<?php
}

if (!empty($astrValues['next_interval_date'])
&& strDate2UnixTime($astrValues['next_interval_date']) <= time()
) {
?>
Expand Down
12 changes: 12 additions & 0 deletions js/mlinvoice-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -1121,6 +1121,18 @@ MLInvoice.addModule('Form', function mlinvoiceForm() {
$('.deleted-record-msg').remove();
MLInvoice.highlightButton('.save_button', false);
MLInvoice.infomsg(MLInvoice.translate('RecordSaved'), 2000);
if ('invoice_template' === _formConfig.type) {
const alertEl = document.querySelector('.js-recurrence-alert');
if (alertEl) {
const intervalTypeEl = document.getElementById('interval_type');
const nextDateEl = document.getElementById('next_interval_date');
if (intervalTypeEl && nextDateEl) {
alertEl.classList.toggle('hidden', intervalTypeEl.value !== '0' && nextDateEl.value !== '');
} else {
console.warn('Interval type or next invoice date field not found');
}
}
}
if (redirectUrl) {
if ('openwindow' === redirectStyle) {
window.open(redirectUrl);
Expand Down
4 changes: 2 additions & 2 deletions js/mlinvoice.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/mlinvoice.min.js.map

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion lang/en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ RecurringInvoicesDueForProcesing = 'There are recurring invoices due for process
CheckCreatedInvoice = 'Check created invoice'
CheckUpdatedInvoice = 'Check updated invoice'


; Updater
UpdateAvailable = '(update v{version} available)'
UpdateAvailableTitle = 'Update to version {version} available (release date {date})'
Expand Down Expand Up @@ -322,7 +323,7 @@ RemovingObsoleteFiles = 'Removing obsolete files, please wait...'
ObsoleteFilesRemoved = 'Obsolete files have been removed.'
UpdateBackupDescription = 'Creating a backup of files may slow down the update significantly. In some cases it can lead to the installation timing out. Backup of the database must be done separately.'
UpdateCreateBackup = 'Create Backup of files (in backup subdirectory on the server, does not include the database)'

RecurrenceOrNextInvoiceDateNotSet = 'Recurrence or next invoice date not set'

; Form Buttons
Save = 'Save'
Expand Down
1 change: 1 addition & 0 deletions lang/fi-FI.ini
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ RemovingObsoleteFiles = 'Poistetaan vanhentuneita tiedostoja, odota...'
ObsoleteFilesRemoved = 'Vanhentuneet tiedostot on poistettu.'
UpdateBackupDescription = 'Varmuuskopion tekeminen voi hidastaa päivitystä huomattavasti. Joissain tapauksissa päivitys voi myös keskeytyä aikakatkaisuun. Tietokannan varmuuskopiointi on suoritettava erikseen.'
UpdateCreateBackup = 'Tee varmuuskopio (backup-hakemistoon palvelimella, ei sisällä tietokantaa)'
RecurrenceOrNextInvoiceDateNotSet = 'Toistuvuus tai seuraavan laskun päivä määrittämättä'

; Form Buttons
Save = 'Tallenna'
Expand Down
12 changes: 6 additions & 6 deletions lang/sv-FI.ini
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ BaseName = 'Företagets namn'
RowType = 'Rad typ'
OrgUnitNumber = 'Organisationsbeteckning (OVT)'
PaymentIntermediator = 'Betalningsförmedlare (Finvoice)'
InvoiceIntervalType = 'Upprepas'
InvoiceIntervalNone = 'Upprepas inte'
InvoiceIntervalType = 'Frekvens'
InvoiceIntervalNone = 'Ingen'
InvoiceIntervalMonth = 'Månadsvis'
InvoiceIntervalMonths = 'Var %d månader'
InvoiceIntervalYear = 'Årsvis'
Expand Down Expand Up @@ -266,7 +266,7 @@ UnsavedData = 'All information är inte sparad'
ErrInvalidValue = 'Felaktigt värde i fält'
DuplicateValue = 'Värdet i fält %s är redan ibruk'
NonOpenInvoiceModificationWarning = 'Varning! Modifierande av en faktura med icke-oavslutad status.'
CreateCopyForNextInvoice = 'Skapa en kopia av fakturan för nästa upprepning.'
CreateCopyForNextInvoice = 'Skapa en kopia för nästa återkommande fakturan.'
SearchYTJPrompt = 'Ange FO-nummer eller företagets namn'
NoYTJResultsFound = 'Inga resultat. Obs! Tjänsten omfattar inte alla företagsformer.'
Modified = 'Ändrad'
Expand Down Expand Up @@ -324,7 +324,7 @@ RemovingObsoleteFiles = 'Raderar föråldrade filer, var god vänta...'
ObsoleteFilesRemoved = 'Föråldrade filer har raderats.'
UpdateBackupDescription = 'Att skapa en säkerhetskopia kan sakta ner uppdateringen avsevärt. I vissa fall kan det leda till att installationen avbryts. Säkerhetskopiering av databasen måste göras separat.'
UpdateCreateBackup = 'Skapa en säkerhetskopia (i backup mapp på servern, inkluderar inte databasen)'

RecurrenceOrNextInvoiceDateNotSet = 'Frekvens eller nästa fakturas datum inte definierat'

; Form Buttons
Save = 'Spara'
Expand Down Expand Up @@ -638,8 +638,8 @@ LabelOpenInvoices = 'Oavslutade fakturor'
NoOpenInvoices = 'Inga oavslutade fakturor'
LabelUnpaidInvoices = 'Obetalda fakturor'
NoUnpaidInvoices = 'Inga obetalda fakturor'
LabelInvoicesWithIntervalDue = 'Obehandlade, upprepande fakturor'
NoRepeatingInvoices = 'Inga obehandlade upprepande fakturor'
LabelInvoicesWithIntervalDue = 'Obehandlade, återkommande fakturor'
NoRepeatingInvoices = 'Inga obehandlade återkommande fakturor'
LabelUnfinishedOffers = 'Oavslutade anbud'

; General Settings
Expand Down

0 comments on commit d4ac212

Please sign in to comment.