On avance sur LivraisonParSecteurs

This commit is contained in:
2021-02-04 08:39:38 +01:00
parent 2165100ac7
commit aa5a914df3
14 changed files with 485 additions and 45 deletions

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8" ?>
<routes xmlns="http://symfony.com/schema/routing"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
<route id="livraisonparsecteurs.back.config" path="/admin/module/LivraisonParSecteurs">
<default key="_controller">LivraisonParSecteurs\Controller\BackOfficeController::viewAction</default>
</route>
<route id="livraisonparsecteurs.back.price" path="/admin/module/LivraisonParSecteurs/config">
<default key="_controller">LivraisonParSecteurs\Controller\BackOfficeController::updatePrice</default>
</route>
<route id="livraisonparsecteurs.toggle.visible" path="/admin/module/LivraisonParSecteurs/toggle-online/{id}" methods="post">
<default key="_controller">LivraisonParSecteurs\Controller\BackOfficeController::toggleActive</default>
<requirement key="id">\d+</requirement>
</route>
</routes>

View File

@@ -0,0 +1,2 @@
# Sqlfile -> Database map
thelia.sql=thelia

View File

@@ -1,70 +1,48 @@
# This is a fix for InnoDB in MySQL >= 4.1.x
# It "suspends judgement" for fkey relationships until are tables are set.
SET FOREIGN_KEY_CHECKS = 0;
-- ---------------------------------------------------------------------
-- secteur
-- lps_secteur
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `lps_secteur`;
CREATE TABLE `lps_secteur`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`nom` VARCHAR(50) NOT NULL
`id` INTEGER NOT NULL,
`nom` VARCHAR(50) NOT NULL,
`active` TINYINT DEFAULT 1 NOT NULL,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`)
) ENGINE=InnoDB;
INSERT INTO `lps_secteur`(`id`,`nom`) VALUES (1, 'Capso'), (2, 'Pays de Lumbres'), (3, 'Haut des Flanders'), (4, 'Flandres intérieur');
-- ---------------------------------------------------------------------
-- secteur_commune
-- lps_secteur_commune
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `lps_secteur_commune`;
CREATE TABLE `lps_secteur_commune`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`id_secteur` INTEGER NOT NULL,
`zipcode` VARCHAR(10) NOT NULL
PRIMARY KEY (`id_secteur`,`zipcode`)
CONSTRAINT `fk_id_secteur`
`zipcode` VARCHAR(10) NOT NULL,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`),
INDEX `fi_secteur_commune_secteur` (`id_secteur`),
CONSTRAINT `fk_secteur_commune_secteur`
FOREIGN KEY (`id_secteur`)
REFERENCES `lps_secteur` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE,
CONSTRAINT `fk_zipcode`
FOREIGN KEY (`zipcode`)
REFERENCES `address` (`zipcode`)
ON UPDATE RESTRICT
ON DELETE CASCADE
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- secteur_horaires
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `lps_secteur_horaires`;
CREATE TABLE `lps_secteur_horaires`
(
`id_secteur` INTEGER NOT NULL,
`jour` TINYINT NOT NULL,
`heure_debut` TIME NOT NULL,
`heure_fin` TIME NOT NULL
PRIMARY KEY (`id_secteur`,`jour`)
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- Insertion des données
-- ---------------------------------------------------------------------
INSERT INTO `secteur`(`id`,`nom`) VALUES
(1, 'Capso'),
(2, 'Pays de Lumbres'),
(3, 'Haut des Flanders'),
(4, 'Flandres intérieur')
);
INSERT INTO `secteur_commune`(`id_secteur`,`zipcode`) VALUES
INSERT INTO `lps_secteur_commune`(`id_secteur`,`zipcode`) VALUES
(1,'62120'),
(1,'62129'),
(1,'62219'),
@@ -72,7 +50,9 @@ INSERT INTO `secteur_commune`(`id_secteur`,`zipcode`) VALUES
(1,'62510'),
(1,'62570'),
(1,'62575'),
(1,'62910'),
(1,'62910');
INSERT INTO `lps_secteur_commune`(`id_secteur`,`zipcode`) VALUES
(2,'62010'),
(2,'62024'),
(2,'62088'),
@@ -91,9 +71,30 @@ INSERT INTO `secteur_commune`(`id_secteur`,`zipcode`) VALUES
(2,'62882'),
(2,'62897'),
(2,'62898'),
(2,'62905')
);
(2,'62905');
-- ---------------------------------------------------------------------
-- lps_secteur_horaires
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `lps_secteur_horaires`;
CREATE TABLE `lps_secteur_horaires`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`id_secteur` INTEGER NOT NULL,
`jour` INTEGER NOT NULL,
`heure_debut` TIME NOT NULL,
`heure_fin` TIME NOT NULL,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`),
INDEX `fi_secteur_horaires_secteur` (`id_secteur`),
CONSTRAINT `fk_secteur_horaires_secteur`
FOREIGN KEY (`id_secteur`)
REFERENCES `lps_secteur` (`id`)
ON DELETE CASCADE
) ENGINE=InnoDB;
# This restores the fkey checks, after having unset them earlier
SET FOREIGN_KEY_CHECKS = 1;