Skip to content

Conversation

@tomkalon
Copy link

Q A
Branch? 2.1
Bug fix? no
New feature? yes
BC breaks? no
Related tickets #131
License MIT

Introduced InvoiceSequenceScopeEnum (monthly, annually, global)
Modified SequentialInvoiceNumberGenerator to support:

  • monthly invoice number resets
  • annually invoice number resets
  • default global sequence (current behavior)

Added ENV parameter:
SYLIUS_INVOICING_SEQUENCE_SCOPE=monthly

Accepted values:
monthly: separate invoice sequences per month
annually: separate invoice sequences per year
(anything else or empty): one global sequence

Kept backward compatibility — global behavior is preserved unless explicitly configured

@tomkalon tomkalon force-pushed the feature/sequence-number branch from 3404493 to 3ca816e Compare October 21, 2025 07:50
Comment on lines 14 to 16
<field name="year" type="integer" nullable="true"/>
<field name="month" type="integer"/>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not having a sequence_type and an enum of possibilities? If we want to improve this or change the behavior we would be obliged to add one or more columns.
WDYT?

sylius_invoicing.invoice_save_path: "%kernel.project_dir%/private/invoices/"
sylius_invoicing.filesystem_adapter.invoice: "sylius_invoicing_invoice"
sylius_invoicing.sequence_scope: '%env(default::SYLIUS_INVOICING_SEQUENCE_SCOPE)%'
env(SYLIUS_INVOICING_SEQUENCE_SCOPE): 'global'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I disagree with the (anything else or empty): one global sequence.

Either it's global or empty, but "anything else" could lead to future issues with custom developments.

Comment on lines +75 to +76
'year' => (int) $now->format('Y'),
'month' => (int) $now->format('m'),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get why you have values here.

You wrote "monthly" or "yearly". You didn't specify that we could chose when it happens precisely.
I feel strange about this.

@tomkalon tomkalon force-pushed the feature/sequence-number branch 4 times, most recently from 3982118 to 2f4c991 Compare October 22, 2025 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make Invoice entity more customizable Sequence number placed in invoiceNumber should be reset every month

2 participants