Closed thomasjthomasj closed 9 years ago
Could Product\Unit\BarcodeEdit
have a second method to allow custom barcodes? Currently the barcode edit controller uses a Unit\Edit
object to save the custom barcode which does a lot of unnecessary stuff. It would be good if this method could validate the given barcode somehow too.
Provides a framework for generating barcodes for units. Currently only supports Code 39 and EAN 13 but left open to add more in the future.
This PR includes:
Product\Barcode\CodeGenerator
namespace (I wanted to call itGenerator
but there's already a class calledGenerate
😤)GeneratorInterface
interface representing a barcode generatorGeneratorCollection
for storing barcode generatorsAbstractGenerator
for basic generator functionalityCode39Generator
for generating CODE 39 barcodes (but really it just returns the unit ID)Ean13Generator
for generating EAN 13 barcodesException\BarcodeGenerationException
to be thrown if a barcode cannot be generated, and caught to relay that information to the userProduct\Barcode\ValidTypes
class of statics for checking that barcode types are validProduct\Unit\BarcodeEdit
class for generating a barcode and saving it to the databasebarcode
column inproduct_unit
column againbarcode-generator
option tobarcode.yml
fixture