Skip to content

Commit

Permalink
don't convert $color/$common from array to string
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnRDOrazio committed May 20, 2022
1 parent fcb1108 commit 445d22c
Showing 1 changed file with 1 addition and 22 deletions.
23 changes: 1 addition & 22 deletions includes/LitCalAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -1716,7 +1716,7 @@ private function handleFestivityCreationWithCoincidence( object $row ) : void {
$this->Cal->setProperty( $key, "grade", LitGrade::MEMORIAL_OPT );
$coincidingMemorialName = $value->name;
}
$festivity = new Festivity( $row->Festivity->name, $row->Festivity->DATE, implode(',', $row->Festivity->color), LitFeastType::FIXED, LitGrade::MEMORIAL_OPT, implode(',', $row->Festivity->common) );
$festivity = new Festivity( $row->Festivity->name, $row->Festivity->DATE, $row->Festivity->color, LitFeastType::FIXED, LitGrade::MEMORIAL_OPT, $row->Festivity->common );
$this->Cal->addFestivity( $row->Festivity->tag, $festivity );
$this->Messages[] = sprintf(
/**translators:
Expand Down Expand Up @@ -1788,12 +1788,6 @@ private function createNewRegionalOrNationalFestivity( object $row ) : void {
$this->Messages[] = _( 'We should be creating a new festivity, however we do not seem to have the correct date information in order to proceed' ) . ' :: ' . $a;
return;
}
if( is_array( $row->Festivity->color ) ) {
$row->Festivity->color = implode(",", $row->Festivity->color);
}
if( is_array( $row->Festivity->common ) ) {
$row->Festivity->common = implode(",", $row->Festivity->common);
}
if( $this->festivityCanBeCreated( $row ) ) {
if( $this->festivityDoesNotCoincide( $row ) ) {
if( !property_exists( $row->Festivity, 'type' ) || !LitFeastType::isValid( $row->Festivity->type ) ) {
Expand Down Expand Up @@ -1910,12 +1904,6 @@ private function applyNationalCalendar() : void {
);
$this->loadPropriumDeSanctisData( $missal );
foreach ( $this->tempCal[ $missal ] as $row ) {
if( is_array( $row->COLOR ) ) {
$row->COLOR = implode(',', $row->COLOR);
}
if( is_array( $row->COMMON ) ) {
$row->COMMON = implode(',', $row->COMMON);
}
$currentFeastDate = DateTime::createFromFormat( '!j-n-Y', $row->DAY . '-' . $row->MONTH . '-' . $this->LitSettings->Year, new DateTimeZone( 'UTC' ) );
if( !$this->Cal->inSolemnitiesOrFeasts( $currentFeastDate ) ) {
$festivity = new Festivity( "[ {$this->NationalData->Metadata->Region} ] " . $row->NAME, $currentFeastDate, $row->COLOR, LitFeastType::FIXED, $row->GRADE, $row->COMMON, $row->DISPLAYGRADE );
Expand Down Expand Up @@ -1992,9 +1980,6 @@ private function makePatron( string $tag, string $nameSuffix, int $day, int $mon
$coincidingFestivity->grade = ( $coincidingFestivity->event->grade > LitGrade::SOLEMNITY ? '<i>' . $this->LitGrade->i18n( $coincidingFestivity->event->grade, false ) . '</i>' : $this->LitGrade->i18n( $coincidingFestivity->grade, false ) );
} else if ( $this->Cal->inFeastsOrMemorials( $currentFeastDate ) ) {
//we should probably be able to create it anyways in this case?
if( is_array( $color ) ) {
$color = implode(",", $color);
}
$this->Cal->addFestivity( $tag, new Festivity( $FestivityName, $currentFeastDate, $color, LitFeastType::FIXED, LitGrade::FEAST, LitCommon::PROPRIO ) );
$coincidingFestivity->grade = $this->LitGrade->i18n( $coincidingFestivity->event->grade, false );
}
Expand Down Expand Up @@ -2198,12 +2183,6 @@ private function calculateUniversalCalendar() : void {

private function applyDiocesanCalendar() {
foreach( $this->DiocesanData->LitCal as $key => $obj ) {
if( is_array( $obj->color ) ) {
$obj->color = implode( ',', $obj->color );
}
if( is_array( $obj->common ) ) {
$obj->common = implode( ',', $obj->common );
}
//if sinceYear is undefined or null or empty, let's go ahead and create the event in any case
//creation will be restricted only if explicitly defined by the sinceYear property
if( $this->LitSettings->Year >= $obj->sinceYear || $obj->sinceYear === null || $obj->sinceYear === 0 ) {
Expand Down

0 comments on commit 445d22c

Please sign in to comment.