Skip to content

Commit

Permalink
Fix #1872 - Admin - Install Module - "Back to Module Loader" shows pa…
Browse files Browse the repository at this point in the history
…ge with header only
  • Loading branch information
serhiisamko091184 authored and jack7anderson7 committed May 15, 2024
1 parent 04275ae commit d282375
Showing 1 changed file with 34 additions and 9 deletions.
43 changes: 34 additions & 9 deletions modules/Administration/UpgradeHistory.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
<?php
if (!defined('sugarEntry') || !sugarEntry) {
die('Not A Valid Entry Point');
}

/**
*
* SugarCRM Community Edition is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
*
* SuiteCRM is an extension to SugarCRM Community Edition developed by SalesAgility Ltd.
* Copyright (C) 2011 - 2018 SalesAgility Ltd.
* Copyright (C) 2011 - 2024 SalesAgility Ltd.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
Expand Down Expand Up @@ -41,9 +39,9 @@
* display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM".
*/




if (!defined('sugarEntry') || !sugarEntry) {
die('Not A Valid Entry Point');
}

// The history of upgrades on the system
#[\AllowDynamicProperties]
Expand Down Expand Up @@ -196,8 +194,8 @@ public function UninstallAvailable($patch_list, $patch_to_check)
//or the unique_keys do not match
$patch_to_check_backup_path = clean_path(remove_file_extension(from_html($patch_to_check->filename))).'-restore';
$more_recent_patch_backup_path = clean_path(remove_file_extension(from_html($more_recent_patch->filename))).'-restore';
$patch_to_check_timestamp = TimeDate::getInstance()->fromUser($patch_to_check->date_entered)->getTimestamp();
$more_resent_patch_timestamp = TimeDate::getInstance()->fromUser($more_recent_patch->date_entered)->getTimestamp();
$patch_to_check_timestamp = $this->getPackageTimestamp($this->getPackageDateString($patch_to_check));
$more_resent_patch_timestamp = $this->getPackageTimestamp($this->getPackageDateString($more_recent_patch));
if (
$this->foundConflict($patch_to_check_backup_path, $more_recent_patch_backup_path) &&
($more_resent_patch_timestamp >= $patch_to_check_timestamp)
Expand Down Expand Up @@ -305,4 +303,31 @@ public function retrieve($id = -1, $encode=true, $deleted=true)
{
return parent::retrieve($id, $encode, false); //ignore the deleted filter. the table does not have the deleted column in it.
}

/**
* Returns correct string for getting timestamp if the package has just been installed;
* @param UpgradeHistory $bean
* @return string
*/
protected function getPackageDateString(UpgradeHistory $bean): string
{
global $timedate;

if (!$bean->date_entered) {
return $timedate->to_display_date_time($bean->date_modified);
}

return $bean->date_entered;
}

/**
* Handler to get timestamp if the package has just been installed;
* @param $date
* @return int
*/
protected function getPackageTimestamp($date): int
{
global $timedate;
return $timedate->fromUser($date)->getTimestamp();
}
}

0 comments on commit d282375

Please sign in to comment.