From 7c16b67b9c748dc87b84a1a0011097dddb292bc2 Mon Sep 17 00:00:00 2001 From: Stakovicz Date: Thu, 5 Dec 2024 12:40:33 +0100 Subject: [PATCH 1/5] issue#1564 change database image --- compose.yml | 2 +- docker/dockerfiles/mysql/Dockerfile | 2 +- docker/dockerfiles/mysql/my.cnf | 1 + docker/dockerfiles/mysqltest/Dockerfile | 2 +- docker/dockerfiles/mysqltest/my.cnf | 1 + 5 files changed, 5 insertions(+), 3 deletions(-) diff --git a/compose.yml b/compose.yml index 342fddeb9..29913e1c2 100644 --- a/compose.yml +++ b/compose.yml @@ -21,7 +21,7 @@ services: volumes: - ./data/mysqltest:/var/lib/mysql healthcheck: - test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"] + test: ["CMD", "mysqladmin", "ping", "-h", "localhost"] timeout: 20s retries: 10 diff --git a/docker/dockerfiles/mysql/Dockerfile b/docker/dockerfiles/mysql/Dockerfile index 386be002c..bb1325601 100644 --- a/docker/dockerfiles/mysql/Dockerfile +++ b/docker/dockerfiles/mysql/Dockerfile @@ -1,4 +1,4 @@ -FROM mariadb:10.0.29 +FROM mysql:5.7 COPY my.cnf /etc/mysql/my.cnf COPY mysql /opt/mysql diff --git a/docker/dockerfiles/mysql/my.cnf b/docker/dockerfiles/mysql/my.cnf index 74833b96a..f12448d2d 100644 --- a/docker/dockerfiles/mysql/my.cnf +++ b/docker/dockerfiles/mysql/my.cnf @@ -2,3 +2,4 @@ skip-host-cache skip-name-resolve innodb_file_per_table=1 +sql-mode="STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION" diff --git a/docker/dockerfiles/mysqltest/Dockerfile b/docker/dockerfiles/mysqltest/Dockerfile index 12ab8ca35..45ba3b8d9 100644 --- a/docker/dockerfiles/mysqltest/Dockerfile +++ b/docker/dockerfiles/mysqltest/Dockerfile @@ -1,4 +1,4 @@ -FROM mariadb:10.0.29 +FROM mysql:5.7 COPY my.cnf /etc/mysql/my.cnf COPY mysql /opt/mysql diff --git a/docker/dockerfiles/mysqltest/my.cnf b/docker/dockerfiles/mysqltest/my.cnf index 74833b96a..f12448d2d 100644 --- a/docker/dockerfiles/mysqltest/my.cnf +++ b/docker/dockerfiles/mysqltest/my.cnf @@ -2,3 +2,4 @@ skip-host-cache skip-name-resolve innodb_file_per_table=1 +sql-mode="STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION" From 54baf5e742c268d60702509b43d21cbc153ba24e Mon Sep 17 00:00:00 2001 From: Stakovicz Date: Thu, 5 Dec 2024 13:11:53 +0100 Subject: [PATCH 2/5] issue#1564 fix fixtures --- db/migrations/20180526091813_init.sql | 10 +++++----- db/seeds/Compta.php | 4 ++-- db/seeds/Event.php | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/db/migrations/20180526091813_init.sql b/db/migrations/20180526091813_init.sql index f0eaec830..737283cf7 100644 --- a/db/migrations/20180526091813_init.sql +++ b/db/migrations/20180526091813_init.sql @@ -394,8 +394,8 @@ CREATE TABLE `afup_forum` ( `trello_list_id` varchar(100) CHARACTER SET utf8 DEFAULT NULL, `logo_url` varchar(100) CHARACTER SET utf8 DEFAULT NULL, `nb_places` int(11) unsigned NOT NULL DEFAULT '0', - `date_debut` date NOT NULL DEFAULT '0000-00-00', - `date_fin` date NOT NULL DEFAULT '0000-00-00', + `date_debut` date NULL, + `date_fin` date NULL, `annee` int(11) DEFAULT NULL, `text` text, `date_fin_appel_projet` int(11) DEFAULT NULL, @@ -935,7 +935,7 @@ DROP TABLE IF EXISTS `afup_sessions`; CREATE TABLE `afup_sessions` ( `session_id` int(11) NOT NULL AUTO_INCREMENT, `id_forum` smallint(6) NOT NULL DEFAULT '0', - `date_soumission` date NOT NULL DEFAULT '0000-00-00', + `date_soumission` date NULL, `titre` varchar(255) NOT NULL DEFAULT '', `abstract` text NOT NULL, `staff_notes` text, @@ -985,7 +985,7 @@ CREATE TABLE `afup_sessions_note` ( `session_id` int(11) NOT NULL DEFAULT '0', `note` tinyint(4) NOT NULL DEFAULT '0', `salt` char(32) NOT NULL DEFAULT '', - `date_soumission` date NOT NULL DEFAULT '0000-00-00', + `date_soumission` date NULL, PRIMARY KEY (`note`,`session_id`,`salt`) USING BTREE ) ENGINE=MyISAM DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -1441,7 +1441,7 @@ CREATE TABLE `compta` ( `attachment_filename` varchar(255) DEFAULT NULL, `numero` varchar(50) NOT NULL, `idmode_regl` tinyint(5) NOT NULL, - `date_regl` date NOT NULL, + `date_regl` date NULL, `obs_regl` varchar(255) NOT NULL, `idevenement` tinyint(5) NOT NULL, `idcompte` tinyint(2) NOT NULL DEFAULT '1', diff --git a/db/seeds/Compta.php b/db/seeds/Compta.php index 9a7c9ec5a..4f7a8cebb 100644 --- a/db/seeds/Compta.php +++ b/db/seeds/Compta.php @@ -69,7 +69,7 @@ public function run() 'idoperation' => 0, 'idcategorie' => 0, 'idmode_regl' => 0, - 'date_regl' => '0000-00-00', + 'date_regl' => null, 'idevenement' => 0, ], [ @@ -89,7 +89,7 @@ public function run() 'idoperation' => 0, 'idcategorie' => 0, 'idmode_regl' => 0, - 'date_regl' => '0000-00-00', + 'date_regl' => null, 'idevenement' => 0, ], ]; diff --git a/db/seeds/Event.php b/db/seeds/Event.php index 2146ce292..f67a1739a 100644 --- a/db/seeds/Event.php +++ b/db/seeds/Event.php @@ -40,7 +40,7 @@ public function run() 'date_fin_saisie_nuites_hotel' => $event - $oneDayInSeconds * 7, 'place_name' => 'Paris', 'place_address' => 'Marriott Rive Gauche', - 'date_annonce_planning' => date('Y-m-d H:i:s', $now - $oneMonthInSeconds), + 'date_annonce_planning' => $now - $oneMonthInSeconds, 'transport_information_enabled' => 1, 'has_prices_defined_with_vat' => 1, ], @@ -70,7 +70,7 @@ public function run() 'date_fin_saisie_nuites_hotel' => $event - $oneDayInSeconds * 7, 'place_name' => 'Paris', 'place_address' => 'Marriott Rive Gauche', - 'date_annonce_planning' => date('Y-m-d H:i:s', $now - $oneMonthInSeconds), + 'date_annonce_planning' => $now - $oneMonthInSeconds, 'transport_information_enabled' => 1, 'has_prices_defined_with_vat' => 1, ], From 53202396daf49c1a78ca0be47c165aa06123a8b1 Mon Sep 17 00:00:00 2001 From: Stakovicz Date: Thu, 5 Dec 2024 20:16:03 +0100 Subject: [PATCH 3/5] issue#1564 fix tests --- .../20241202162110_mariadb_to_mysql.php | 19 +++++++++++++++++++ htdocs/pages/administration/compta_devis.php | 14 +++++++------- .../pages/administration/compta_facture.php | 6 +++--- .../administration/forum_inscriptions.php | 4 ++-- .../pages/administration/forum_sessions.php | 16 ++++++++-------- sources/Afup/Comptabilite/Facture.php | 4 ++-- sources/Afup/Corporate/Feuille.php | 4 ++-- sources/Afup/Forum/AppelConferencier.php | 19 +++++++++++-------- sources/Afup/Forum/Inscriptions.php | 2 +- sources/Afup/Utils/Base_De_Donnees.php | 4 ++++ .../Repository/CompanyMemberRepository.php | 4 +++- .../Model/Repository/EventRepository.php | 16 +++++++++++----- .../Model/Repository/InvoiceRepository.php | 2 ++ .../Model/Repository/SpeakerRepository.php | 7 +++++-- .../Event/Model/Repository/TalkRepository.php | 6 ++++-- .../Repository/TicketEventTypeRepository.php | 4 ++-- sources/AppBundle/Event/Model/Talk.php | 4 ++-- sources/AppBundle/Event/Model/Ticket.php | 6 +++--- 18 files changed, 91 insertions(+), 50 deletions(-) create mode 100644 db/migrations/20241202162110_mariadb_to_mysql.php diff --git a/db/migrations/20241202162110_mariadb_to_mysql.php b/db/migrations/20241202162110_mariadb_to_mysql.php new file mode 100644 index 000000000..f74fff656 --- /dev/null +++ b/db/migrations/20241202162110_mariadb_to_mysql.php @@ -0,0 +1,19 @@ +execute("ALTER TABLE afup_sessions ALTER COLUMN skill SET DEFAULT 0"); + $this->execute("ALTER TABLE afup_sessions ALTER COLUMN has_allowed_to_sharing_with_local_offices SET DEFAULT 0"); + $this->execute("ALTER TABLE compta MODIFY idevenement TINYINT(5) NULL"); + $this->execute("ALTER TABLE compta_categorie MODIFY idevenement TINYINT(5) NULL"); + $this->execute("ALTER TABLE afup_compta_facture MODIFY date_facture DATE NULL"); + $this->execute("ALTER TABLE afup_compta_facture MODIFY numero_facture VARCHAR(50) NULL"); + $this->execute("ALTER TABLE compta MODIFY idclef VARCHAR(20) NULL"); + $this->execute("ALTER TABLE afup_inscription_forum MODIFY transport_mode SMALLINT NULL"); + } +} + diff --git a/htdocs/pages/administration/compta_devis.php b/htdocs/pages/administration/compta_devis.php index cf5c7ec0a..b4da2d37b 100644 --- a/htdocs/pages/administration/compta_devis.php +++ b/htdocs/pages/administration/compta_devis.php @@ -239,9 +239,9 @@ function prepareDefaultsFromComptaFacId(Facture $comptaFact, $id) { $ok = $comptaFact->ajouter_details( $valeur['ref'.$i], $valeur['designation'.$i], - $valeur['quantite'.$i], - $valeur['pu'.$i], - $valeur['tva'.$i] + (int)$valeur['quantite'.$i], + (float)$valeur['pu'.$i], + (int)$valeur['tva'.$i] ); } } else { @@ -264,7 +264,7 @@ function prepareDefaultsFromComptaFacId(Facture $comptaFact, $id) { $valeur['ref_clt2'], $valeur['ref_clt3'], $valeur['numero_devis'], - $valeur['numero_facture'], + $valeur['numero_facture'] ?? null, 0, null, $valeur['devise_facture'] @@ -275,9 +275,9 @@ function prepareDefaultsFromComptaFacId(Facture $comptaFact, $id) { $valeur['id'.$i], $valeur['ref'.$i], $valeur['designation'.$i], - $valeur['quantite'.$i], - $valeur['pu'.$i], - $valeur['tva'.$i] + (int)$valeur['quantite'.$i], + (float)$valeur['pu'.$i], + (int)$valeur['tva'.$i] ); } diff --git a/htdocs/pages/administration/compta_facture.php b/htdocs/pages/administration/compta_facture.php index 336891bfb..3a28f9ab6 100644 --- a/htdocs/pages/administration/compta_facture.php +++ b/htdocs/pages/administration/compta_facture.php @@ -247,9 +247,9 @@ $valeur['id'.$i], $valeur['ref'.$i], $valeur['designation'.$i], - $valeur['quantite'.$i], - $valeur['pu'.$i], - $valeur['tva'.$i] + (int)$valeur['quantite'.$i], + (float)$valeur['pu'.$i], + (int)$valeur['tva'.$i] ); } diff --git a/htdocs/pages/administration/forum_inscriptions.php b/htdocs/pages/administration/forum_inscriptions.php index de4eee3f7..7598b8d25 100644 --- a/htdocs/pages/administration/forum_inscriptions.php +++ b/htdocs/pages/administration/forum_inscriptions.php @@ -399,8 +399,8 @@ function updateGlobalsForTarif( $valeurs['commentaires'], $valeurs['etat'], $valeurs['facturation'], - $valeurs['transport_mode'], - $valeurs['transport_distance']); + (int)$valeurs['transport_mode'], + (int)$valeurs['transport_distance']); /** @var \AppBundle\Event\Model\Ticket $ticket */ $ticket = $ticketRepository->get($_GET['id']); diff --git a/htdocs/pages/administration/forum_sessions.php b/htdocs/pages/administration/forum_sessions.php index 4cfe5b018..0c3be72b8 100644 --- a/htdocs/pages/administration/forum_sessions.php +++ b/htdocs/pages/administration/forum_sessions.php @@ -241,10 +241,10 @@ $valeurs['date_soumission']['Y'].'-'.$valeurs['date_soumission']['M'].'-'.$valeurs['date_soumission']['d'], $valeurs['titre'], $valeurs['abstract'], - $valeurs['genre'], - $valeurs['plannifie'], - isset($valeurs['needs_mentoring']) ? $valeurs['needs_mentoring'] : 0, - $valeurs['skill'], + (int)$valeurs['genre'], + (int)$valeurs['plannifie'], + isset($valeurs['needs_mentoring']) ? (int)$valeurs['needs_mentoring'] : 0, + (int)$valeurs['skill'], $valeurs['use_markdown'] ); $ok = (bool)$session_id; @@ -255,8 +255,8 @@ $valeurs['date_soumission']['Y'].'-'.$valeurs['date_soumission']['M'].'-'.$valeurs['date_soumission']['d'], $valeurs['titre'], $valeurs['abstract'], - $valeurs['genre'], - $valeurs['plannifie'], + (int)$valeurs['genre'], + (int)$valeurs['plannifie'], $valeurs['joindin'], $valeurs['youtube_id'], $valeurs['slides_url'], @@ -264,8 +264,8 @@ $valeurs['blog_post_url'], $valeurs['interview_url'], $valeurs['language_code'], - $valeurs['skill'], - $valeurs['needs_mentoring'], + (int)$valeurs['skill'], + (int)$valeurs['needs_mentoring'], $valeurs['use_markdown'], $valeurs['video_has_fr_subtitles'], $valeurs['video_has_en_subtitles'], diff --git a/sources/Afup/Comptabilite/Facture.php b/sources/Afup/Comptabilite/Facture.php index 68d1b5aa6..f3497b8a1 100644 --- a/sources/Afup/Comptabilite/Facture.php +++ b/sources/Afup/Comptabilite/Facture.php @@ -180,7 +180,7 @@ function ajouter($date_devis, $societe, $service, $adresse, $code_postal, $ville return $this->_bdd->executer($requete); } - function ajouter_details($ref, $designation, $quantite, $pu, $tva = 0) + function ajouter_details($ref, $designation, int $quantite, float $pu, int $tva = 0) { $requete = 'INSERT INTO '; $requete .= 'afup_compta_facture_details ('; @@ -237,7 +237,7 @@ function modifier($id, $date_devis, $societe, $service, $adresse, $code_postal, return $this->_bdd->executer($requete); } - function modifier_details($id, $ref, $designation, $quantite, $pu, $tva = 0) + function modifier_details($id, $ref, $designation, int $quantite, float $pu, int $tva = 0) { $requete = 'UPDATE '; $requete .= 'afup_compta_facture_details '; diff --git a/sources/Afup/Corporate/Feuille.php b/sources/Afup/Corporate/Feuille.php index 6ea7fb0f5..7d3fda2b3 100644 --- a/sources/Afup/Corporate/Feuille.php +++ b/sources/Afup/Corporate/Feuille.php @@ -45,7 +45,7 @@ function inserer() } $requete = 'INSERT INTO afup_site_feuille SET - id_parent = ' . $this->bdd->echapper($this->id_parent) . ', + id_parent = ' . $this->bdd->echapper(!$this->id_parent ? null : $this->id_parent) . ', nom = ' . $this->bdd->echapper($this->nom) . ', lien = ' . $this->bdd->echapper($this->lien) . ', alt = ' . $this->bdd->echapper($this->alt) . ', @@ -66,7 +66,7 @@ function modifier() { $requete = 'UPDATE afup_site_feuille SET - id_parent = ' . $this->bdd->echapper($this->id_parent) . ', + id_parent = ' . $this->bdd->echapper(!$this->id_parent ? null : $this->id_parent) . ', nom = ' . $this->bdd->echapper($this->nom) . ', lien = ' . $this->bdd->echapper($this->lien) . ', alt = ' . $this->bdd->echapper($this->alt) . ', diff --git a/sources/Afup/Forum/AppelConferencier.php b/sources/Afup/Forum/AppelConferencier.php index 74ce6b207..f5c680c5b 100644 --- a/sources/Afup/Forum/AppelConferencier.php +++ b/sources/Afup/Forum/AppelConferencier.php @@ -404,8 +404,8 @@ public function modifierSession( $date_soumission, $titre, $abstract, - $genre, - $plannifie, + int $genre, + int $plannifie, $joindin = null, $youtubeId = null, $slidesUrl = null, @@ -413,8 +413,8 @@ public function modifierSession( $blogPostUrl = null, $interviewUrl = null, $languageCode = null, - $skill = null, - $needs_mentoring = null, + int $skill = null, + int $needs_mentoring = null, $use_markdown = null, $video_has_fr_subtitles = null, $video_has_en_subtitles = null, @@ -499,10 +499,10 @@ public function ajouterSession( $date_soumission, $titre, $abstract, - $genre, - $plannifie = 0, - $needs_mentoring = 0, - $level = Talk::SKILL_NA, + int $genre, + int $plannifie = 0, + int $needs_mentoring = 0, + int $level = Talk::SKILL_NA, $useMarkdown = false ) { @@ -541,6 +541,9 @@ function delierSession($session_id) public function lierConferencierSession($conferencier_id, $session_id) { + if (!$conferencier_id) { + return true; + } $donnees = array( $this->_bdd->echapper($conferencier_id), $this->_bdd->echapper($session_id), diff --git a/sources/Afup/Forum/Inscriptions.php b/sources/Afup/Forum/Inscriptions.php index e316f7e0f..2f1934566 100644 --- a/sources/Afup/Forum/Inscriptions.php +++ b/sources/Afup/Forum/Inscriptions.php @@ -263,7 +263,7 @@ function obtenirListe($id_forum = null, function modifierInscription($id, $reference, $type_inscription, $civilite, $nom, $prenom, $email, $telephone, $coupon, $citer_societe, $newsletter_afup, $newsletter_nexen, $mail_partenaire, $commentaires, $etat, $facturation, - $transportMode, $transportDistance) + int $transportMode, int $transportDistance) { $requete = 'UPDATE '; $requete .= ' afup_inscription_forum '; diff --git a/sources/Afup/Utils/Base_De_Donnees.php b/sources/Afup/Utils/Base_De_Donnees.php index f97bb1e89..b43e0199c 100644 --- a/sources/Afup/Utils/Base_De_Donnees.php +++ b/sources/Afup/Utils/Base_De_Donnees.php @@ -234,6 +234,10 @@ public function getLastErrorMessage() function executer($requete) { $result = mysqli_query($this->getDbLink(), $requete); + if (!$result) { + throw new \RuntimeException(mysqli_error($this->getDbLink())); + } + return $result; } diff --git a/sources/AppBundle/Association/Model/Repository/CompanyMemberRepository.php b/sources/AppBundle/Association/Model/Repository/CompanyMemberRepository.php index 21f4eeb72..8281b4b24 100644 --- a/sources/AppBundle/Association/Model/Repository/CompanyMemberRepository.php +++ b/sources/AppBundle/Association/Model/Repository/CompanyMemberRepository.php @@ -4,6 +4,7 @@ use AppBundle\Association\Model\CompanyMember; use Aura\SqlQuery\Common\SelectInterface; +use CCMBenchmark\Ting\Driver\Mysqli\Serializer\Boolean; use CCMBenchmark\Ting\Repository\HydratorSingleObject; use CCMBenchmark\Ting\Repository\Metadata; use CCMBenchmark\Ting\Repository\MetadataInitializer; @@ -170,7 +171,8 @@ public static function initMetadata(SerializerFactoryInterface $serializerFactor ->addField([ 'columnName' => 'public_profile_enabled', 'fieldName' => 'publicProfileEnabled', - 'type' => 'boolean', + 'type' => 'bool', + 'serializer' => Boolean::class ]) ->addField([ 'columnName' => 'description', diff --git a/sources/AppBundle/Event/Model/Repository/EventRepository.php b/sources/AppBundle/Event/Model/Repository/EventRepository.php index 1a0f32fed..b624a8a67 100644 --- a/sources/AppBundle/Event/Model/Repository/EventRepository.php +++ b/sources/AppBundle/Event/Model/Repository/EventRepository.php @@ -5,6 +5,7 @@ use AppBundle\Event\Model\Event; use AppBundle\Event\Model\GithubUser; use AppBundle\Event\Model\Ticket; +use CCMBenchmark\Ting\Driver\Mysqli\Serializer\Boolean; use CCMBenchmark\Ting\Repository\CollectionInterface; use CCMBenchmark\Ting\Repository\HydratorArray; use CCMBenchmark\Ting\Repository\HydratorSingleObject; @@ -326,22 +327,26 @@ public static function initMetadata(SerializerFactoryInterface $serializerFactor ->addField([ 'columnName' => 'vote_enabled', 'fieldName' => 'voteEnabled', - 'type' => 'boolean' + 'type' => 'bool', + 'serializer' => Boolean::class ]) ->addField([ 'columnName' => 'has_prices_defined_with_vat', 'fieldName' => 'hasPricesDefinedWithVat', - 'type' => 'boolean' + 'type' => 'bool', + 'serializer' => Boolean::class ]) ->addField([ 'columnName' => 'speakers_diner_enabled', 'fieldName' => 'speakersDinerEnabled', - 'type' => 'boolean' + 'type' => 'bool', + 'serializer' => Boolean::class ]) ->addField([ 'columnName' => 'accomodation_enabled', 'fieldName' => 'accomodationEnabled', - 'type' => 'boolean' + 'type' => 'bool', + 'serializer' => Boolean::class ]) ->addField([ 'columnName' => 'waiting_list_url', @@ -351,7 +356,8 @@ public static function initMetadata(SerializerFactoryInterface $serializerFactor ->addField([ 'columnName' => 'transport_information_enabled', 'fieldName' => 'transportInformationEnabled', - 'type' => 'boolean', + 'type' => 'bool', + 'serializer' => Boolean::class ]) ; diff --git a/sources/AppBundle/Event/Model/Repository/InvoiceRepository.php b/sources/AppBundle/Event/Model/Repository/InvoiceRepository.php index 84fceaa93..0f9b8116c 100644 --- a/sources/AppBundle/Event/Model/Repository/InvoiceRepository.php +++ b/sources/AppBundle/Event/Model/Repository/InvoiceRepository.php @@ -32,6 +32,8 @@ public function saveWithTickets(Invoice $invoice) continue; } $ticket + ->setTransportMode(null) + ->setTransportDistance(null) ->setReference($invoice->getReference()) ->setDate(new \DateTime()) ->setAmount($ticket->getTicketEventType()->getPrice()) diff --git a/sources/AppBundle/Event/Model/Repository/SpeakerRepository.php b/sources/AppBundle/Event/Model/Repository/SpeakerRepository.php index 807768342..5a587e2da 100644 --- a/sources/AppBundle/Event/Model/Repository/SpeakerRepository.php +++ b/sources/AppBundle/Event/Model/Repository/SpeakerRepository.php @@ -7,6 +7,7 @@ use AppBundle\Event\Model\Speaker; use AppBundle\Event\Model\Talk; use Assert\Assertion; +use CCMBenchmark\Ting\Driver\Mysqli\Serializer\Boolean; use CCMBenchmark\Ting\Repository\CollectionInterface; use CCMBenchmark\Ting\Repository\HydratorSingleObject; use CCMBenchmark\Ting\Repository\Metadata; @@ -264,12 +265,14 @@ public static function initMetadata(SerializerFactoryInterface $serializerFactor ->addField([ 'columnName' => 'will_attend_speakers_diner', 'fieldName' => 'willAttendSpeakersDiner', - 'type' => 'bool' + 'type' => 'bool', + 'serializer' => Boolean::class ]) ->addField([ 'columnName' => 'has_special_diet', 'fieldName' => 'hasSpecialDiet', - 'type' => 'bool' + 'type' => 'bool', + 'serializer' => Boolean::class ]) ->addField([ 'columnName' => 'special_diet_description', diff --git a/sources/AppBundle/Event/Model/Repository/TalkRepository.php b/sources/AppBundle/Event/Model/Repository/TalkRepository.php index ed7e042aa..99624eb04 100644 --- a/sources/AppBundle/Event/Model/Repository/TalkRepository.php +++ b/sources/AppBundle/Event/Model/Repository/TalkRepository.php @@ -390,12 +390,14 @@ public static function initMetadata(SerializerFactoryInterface $serializerFactor ->addField([ 'columnName' => 'video_has_fr_subtitles', 'fieldName' => 'videoHasFrSubtitles', - 'type' => 'bool' + 'type' => 'bool', + 'serializer' => Boolean::class ]) ->addField([ 'columnName' => 'video_has_en_subtitles', 'fieldName' => 'videoHasEnSubtitles', - 'type' => 'bool' + 'type' => 'bool', + 'serializer' => Boolean::class ]) ->addField([ 'columnName' => 'slides_url', diff --git a/sources/AppBundle/Event/Model/Repository/TicketEventTypeRepository.php b/sources/AppBundle/Event/Model/Repository/TicketEventTypeRepository.php index 36c4f4ea3..089524ff8 100644 --- a/sources/AppBundle/Event/Model/Repository/TicketEventTypeRepository.php +++ b/sources/AppBundle/Event/Model/Repository/TicketEventTypeRepository.php @@ -73,8 +73,8 @@ public function update(TicketEventType $ticketEventType) 'id_tarif' => $ticketEventType->getTicketTypeId(), 'id_event' => $ticketEventType->getEventId(), 'price' => $ticketEventType->getPrice(), - 'date_start' => $ticketEventType->getDateStart()->format(\DateTime::ATOM), - 'date_end' => $ticketEventType->getDateEnd()->format(\DateTime::ATOM), + 'date_start' => $ticketEventType->getDateStart()->format('Y-m-d H:i:s'), + 'date_end' => $ticketEventType->getDateEnd()->format('Y-m-d H:i:s'), 'description' => $ticketEventType->getDescription(), 'max_tickets' => $ticketEventType->getMaxTickets() ]); diff --git a/sources/AppBundle/Event/Model/Talk.php b/sources/AppBundle/Event/Model/Talk.php index 96edf48ad..bd7a2227e 100644 --- a/sources/AppBundle/Event/Model/Talk.php +++ b/sources/AppBundle/Event/Model/Talk.php @@ -162,10 +162,10 @@ class Talk implements NotifyPropertyInterface private $useMarkdown = true; /** - * @var bool|null + * @var bool * @Assert\NotNull() */ - private $hasAllowedToSharingWithLocalOffices = null; + private $hasAllowedToSharingWithLocalOffices = false; /** * @return int diff --git a/sources/AppBundle/Event/Model/Ticket.php b/sources/AppBundle/Event/Model/Ticket.php index 4b83e4630..565475920 100644 --- a/sources/AppBundle/Event/Model/Ticket.php +++ b/sources/AppBundle/Event/Model/Ticket.php @@ -253,7 +253,7 @@ class Ticket implements NotifyPropertyInterface protected $nearestOffice; /** - * @var null|string + * @var null|int */ protected $transportMode; @@ -787,7 +787,7 @@ public function setNearestOffice($nearestOffice) } /** - * @return null|string + * @return null|int */ public function getTransportMode() { @@ -795,7 +795,7 @@ public function getTransportMode() } /** - * @param null|string $transportMode + * @param null|int $transportMode * * @return $this */ From cb946cdbe517951e4d5235351d2aaec781743d6d Mon Sep 17 00:00:00 2001 From: Stakovicz Date: Thu, 5 Dec 2024 20:55:43 +0100 Subject: [PATCH 4/5] issue#1564 sql schema --- db/migrations/20180526091813_init.sql | 4 ++-- db/migrations/20241202162110_mariadb_to_mysql.php | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/db/migrations/20180526091813_init.sql b/db/migrations/20180526091813_init.sql index 737283cf7..45b5d38e5 100644 --- a/db/migrations/20180526091813_init.sql +++ b/db/migrations/20180526091813_init.sql @@ -935,7 +935,7 @@ DROP TABLE IF EXISTS `afup_sessions`; CREATE TABLE `afup_sessions` ( `session_id` int(11) NOT NULL AUTO_INCREMENT, `id_forum` smallint(6) NOT NULL DEFAULT '0', - `date_soumission` date NULL, + `date_soumission` date NOT NULL, `titre` varchar(255) NOT NULL DEFAULT '', `abstract` text NOT NULL, `staff_notes` text, @@ -985,7 +985,7 @@ CREATE TABLE `afup_sessions_note` ( `session_id` int(11) NOT NULL DEFAULT '0', `note` tinyint(4) NOT NULL DEFAULT '0', `salt` char(32) NOT NULL DEFAULT '', - `date_soumission` date NULL, + `date_soumission` date NOT NULL, PRIMARY KEY (`note`,`session_id`,`salt`) USING BTREE ) ENGINE=MyISAM DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; diff --git a/db/migrations/20241202162110_mariadb_to_mysql.php b/db/migrations/20241202162110_mariadb_to_mysql.php index f74fff656..d3c94060e 100644 --- a/db/migrations/20241202162110_mariadb_to_mysql.php +++ b/db/migrations/20241202162110_mariadb_to_mysql.php @@ -7,8 +7,11 @@ class MariaDBToMysql extends AbstractMigration public function change() { $this->execute("ALTER TABLE afup_sessions ALTER COLUMN skill SET DEFAULT 0"); + $this->execute("ALTER TABLE afup_forum MODIFY date_debut date NULL"); + $this->execute("ALTER TABLE afup_forum MODIFY date_fin date NULL"); $this->execute("ALTER TABLE afup_sessions ALTER COLUMN has_allowed_to_sharing_with_local_offices SET DEFAULT 0"); $this->execute("ALTER TABLE compta MODIFY idevenement TINYINT(5) NULL"); + $this->execute("ALTER TABLE compta MODIFY date_regl date NULL"); $this->execute("ALTER TABLE compta_categorie MODIFY idevenement TINYINT(5) NULL"); $this->execute("ALTER TABLE afup_compta_facture MODIFY date_facture DATE NULL"); $this->execute("ALTER TABLE afup_compta_facture MODIFY numero_facture VARCHAR(50) NULL"); From 548e32d3f53ddc95bd6a5d5d7358de86dfc1aef9 Mon Sep 17 00:00:00 2001 From: Stakovicz Date: Thu, 5 Dec 2024 21:00:45 +0100 Subject: [PATCH 5/5] issue#1564 lint compose.yml --- compose.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/compose.yml b/compose.yml index 29913e1c2..5c2e7b79b 100644 --- a/compose.yml +++ b/compose.yml @@ -1,5 +1,3 @@ -version: "2.2" - services: db: build: ./docker/dockerfiles/mysql @@ -21,7 +19,7 @@ services: volumes: - ./data/mysqltest:/var/lib/mysql healthcheck: - test: ["CMD", "mysqladmin", "ping", "-h", "localhost"] + test: [ "CMD", "mysqladmin", "ping", "-h", "localhost" ] timeout: 20s retries: 10 @@ -58,7 +56,7 @@ services: links: - statictestresources healthcheck: - test: ["CMD", "curl", "-f", "https://apachephptest:80"] + test: [ "CMD", "curl", "-f", "https://apachephptest:80" ] interval: 30s timeout: 10s retries: 5 @@ -76,8 +74,8 @@ services: .env user: localUser volumes: - - ./data/composer:/home/localUser/.composer - - ./:/var/www/html + - ./data/composer:/home/localUser/.composer + - ./:/var/www/html links: - db - apachephp