Skip to content

Commit

Permalink
fix(events): event copies with horaires after 0h had it at the wrong …
Browse files Browse the repository at this point in the history
…date

Copy of an event had horaire_fin *before* horaire_deb if original horaire_fin was after midnight; horaires of event copied were in the wrong day (the same day as dateEvenement) if horaires of original were after midnight
  • Loading branch information
agilare committed Jun 22, 2023
1 parent dd17aab commit f9ab8f3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
- users - edit : "avec affiliation" value must be sent in submit, rm conditions
- events
- in edit and copy form config of datepicker to allow adding event for today event after 0h
- [ ] copy of an event had horaire_fin *before* horaire_deb if original horaire_fin was after midnight; horaires of event copied were in the wrong day (the same day as dateEvenement) if horaires of original were after midnight
- copy of an event had horaire_fin *before* horaire_deb if original horaire_fin was after midnight; horaires of event copied were in the wrong day (the same day as dateEvenement) if horaires of original were after midnight

### Added

Expand Down
32 changes: 22 additions & 10 deletions evenement-copy.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
$tab_lieu = $connector->fetchArray($req_lieu);


if ($authorization->estAuteur($_SESSION['SidPersonne'], $get['idE'], "evenement") || $_SESSION['Sgroupe'] <= 6
if ($authorization->estAuteur($_SESSION['SidPersonne'], $get['idE'], "evenement") || $_SESSION['Sgroupe'] <= UserLevel::AUTHOR
|| (isset($_SESSION['Saffiliation_lieu']) && isset($tab_lieu['idLieu']) && $tab_lieu['idLieu'] == $_SESSION['Saffiliation_lieu'])
|| $authorization->isPersonneInEvenementByOrganisateur($_SESSION['SidPersonne'], $get['idE'])
|| (isset($tab_lieu['idLieu']) && $authorization->isPersonneInLieuByOrganisateur($_SESSION['SidPersonne'], $tab_lieu['idLieu']))
Expand Down Expand Up @@ -182,11 +182,17 @@
$tab_champs['dateEvenement'] = date('Y-m-d', $dateIncrUnix);
$tab_champs['dateAjout'] = date("Y-m-d H:i:s");
$tab_champs['date_derniere_modif'] = date("Y-m-d H:i:s");

if (mb_substr($tab_champs['horaire_debut'], 11) != "06:00:01"
&& $tab_champs['horaire_debut'] != "0000-00-00 00:00:00")
// dump($tab_champs);
if (mb_substr($tab_champs['horaire_debut'], 11) != "06:00:01" && $tab_champs['horaire_debut'] != "0000-00-00 00:00:00")
{
$tab_champs['horaire_debut'] = $tab_champs['dateEvenement']." ".mb_substr($tab_champs['horaire_debut'], 11);
if (mb_substr($tab_champs['horaire_debut'], 0, 10) > $date_originale )
{
$tab_champs['horaire_debut'] = date_lendemain($tab_champs['dateEvenement'])." ".mb_substr($tab_champs['horaire_debut'], 11);
}
else
{
$tab_champs['horaire_debut'] = $tab_champs['dateEvenement']." ".mb_substr($tab_champs['horaire_debut'], 11);
}
}
else
{
Expand All @@ -195,11 +201,17 @@


//echo date_lendemain($tab_champs['dateEvenement'])." 06:00:01";
if (mb_substr($tab_champs['horaire_fin'], 11) != "06:00:01"
&& $tab_champs['horaire_fin'] != "0000-00-00 00:00:00")
{

$tab_champs['horaire_fin'] = $tab_champs['dateEvenement']." ".mb_substr($tab_champs['horaire_fin'], 11);
if (mb_substr($tab_champs['horaire_fin'], 11) != "06:00:01" && $tab_champs['horaire_fin'] != "0000-00-00 00:00:00")
{ // echo $date_originale;
if (mb_substr($tab_champs['horaire_fin'], 0, 10) > $date_originale)
{ // echo $tab_champs['horaire_fin'];
$tab_champs['horaire_fin'] = date_lendemain($tab_champs['dateEvenement'])." ".mb_substr($tab_champs['horaire_fin'], 11);

}
else
{
$tab_champs['horaire_fin'] = $tab_champs['dateEvenement']." ".mb_substr($tab_champs['horaire_fin'], 11);
}
}
else
{
Expand Down

0 comments on commit f9ab8f3

Please sign in to comment.