-
-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add barcodes generation #4512
Add barcodes generation #4512
Conversation
- Add a barcode library to composer - Add "smart" getters to Task entity - Add endpoint to generate labels in pdf - Label twig template
Calling `PUT /api/tasks/:id/note` with the following payload ```json { note: "Test" } ``` Will add the following string to the task command: `[USER]: Test`
…t action to perform
|
||
if (is_null($task)) { | ||
return $this->json(['error' => 'No data found.'], 404); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Antoine : expected behavior is:
- if task not assigned -> assign directly to you (and other (unassigned) tasks from the delivery)
- if task is assigned to you -> ask in app if you want to unassign it
- if task is assigned to somebody else -> ask in app if you want to get it
-> maybe add this as comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be checked the following points :
- getBarcodeFromEntity seems not to be called
- maybe we could display the barcode stuff in the dispatch somewhere?
- the logic in assign/unassign endpoint after scanning
- hide the barcode feature from shop owners, see how it behaves when you are logged in as a store
} | ||
} | ||
|
||
$this->taskManager->scan($task); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will send the "TASK SCANNED" message through EDIFACT to the transporter? (see command handler)
in this case I am not 100% sure it is good to have such side effect here (because the endpoint is mostly about assign/unassign) so maybe move it to a different endpoint for separation of concern
tell me if i a misunderstood things
|
||
$edi = $task->getImportMessage(); | ||
if (!is_null($edi)) { | ||
//TODO: Send edifact message when scanned |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO before merging I think?
@see https://github.com/ScientaNL/DoctrineJsonFunctions | ||
*/ | ||
$conn = $this->getEntityManager()->getConnection(); | ||
$sql = "SELECT id FROM task WHERE metadata->>'barcode' = :barcode"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check if you get the correct function here https://github.com/martin-georgiev/postgresql-for-doctrine/tree/main/src/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions
then add the function like this https://github.com/coopcycle/coopcycle-web/blob/master/app/config/config.yml#L335
) | ||
} | ||
|
||
export default function ({ items }) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe show it in the dispatch panel somewhere?
|
||
|
||
/** | ||
* @Route("/api/barcode", name="barcode_api") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be mapped to a web controller
$this->eventRecorder->record(new Event\TaskBarcodeScanned($task)); | ||
|
||
|
||
// $edi = $task->getImportMessage(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should create an issue to track this otherwise we will forget?
Linked with: coopcycle/coopcycle-app#1834