Repository navigation
Render the back-office lists with the data table and post every state change with a token - #45
Merged
ThomasDaSilva merged 3 commits intoOct 28, 2026
Conversation
…state change with a token
…abel deletion and answer 404 on a missing customs invoice
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The labels and bordereaux pages of the Twig back office now use the theme's BoDataTable, like the other admin lists. Every action that deletes or creates a file is a POST that carries the admin token.
Lists
Actions
POST /admin/module/ColissimoLabel/label/deletewith_token,number, and optionallyedit-orderandorder_id. It replacesGET /label/delete/{number}. A second click on the same button redirects where it used to return a 500. An empty number is refused: it would have matched every file of the label folder.GET /label/{number}answers 404 for an unknown label or a missing file (it was a 500).<number>.*and<number>-CN23.*at the root of the label folder only, using the stored tracking number. The old prefix match also removed the files of any longer number starting with the same characters.GET /customs-invoice/{orderId}answers 404 for a non-numeric id, an order without a label or a missing CN23 file (it was a 500 or an empty PDF), and sends the file with a properContent-Disposition.<messageContent>shows "Unknown error" on the bordereau page instead of a 500.Order page
?tab=bill, which is where the module redirects after a label deletion and where the list links to.table-responsivewrapper. At 1440 px it used to be 1543 px wide in a 734 px column, which pushed the generate and delete buttons off screen.Signature rule
New
ColissimoLabel::canCountryBeNotSigned(string $numericIsoCode), used bycanOrderBeNotSigned()and by the list. It compares strictly after padding the code to three digits, so40(Austria) and56(Belgium), as stored by a shop migrated from Thelia 2, are still accepted, as the former loose comparison did.Performance
The list loads labels, delivery addresses, countries with their translation, currencies and order weights once for all orders. On a migrated database with 128 orders, that brings the page from 576 SQL queries to about 190. The rest comes mostly from
Order::getTotalAmount()per order, kept so the total uses the core formula.Breaking changes, hence 3.1.0
$CLEAR_LABEL_URL(loopcolissimolabel.label-info) is now the URL to POST to. The Readme lists the parameters.GET /label/delete/{number}andGET /bordereau/generateare gone.BordereauController::listBordereauAction()takes the request and has no$errorargument any more.Tests
New PHPUnit tests in
tests/, with no database: the HTTP method of the three state-changing routes, the signature rule, the refusal of an empty tracking number, the exact file deletion and the deletion limited to the root of the folder. They do not cover the token and permission checks, which need a booted kernel. From the root of a Thelia install:tests/*is excluded from the module services.How it was checked
Thelia 3 (main) with the default-twig back office, at 1440 px: label deletion from the list and from the order page, the bill tab opened after it, the order page label table and its buttons within the column, bordereau deletion, customs invoice download and its 404s, a wrong token (403), the old GET routes (404 and 405), PHPStan level 0 and Twig lint. All product weights of the test orders were 0 or empty, so the grouped weight query was only compared on those values. Bordereau generation was not run against the Colissimo web service.