Skip to content

Commit c00b6e5

Browse files
committed
Fix the upgrade page should not be visible when usng external support
page
1 parent 34e48c4 commit c00b6e5

16 files changed

+164
-39
lines changed

myaccount/tpl/action_create_recinvoice_after_payment_creation.tpl.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@
1515
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
*/
1717

18+
/**
19+
* @var Conf $conf
20+
* @var DoliDB $db
21+
* @var HookManager $hookmanager
22+
* @var Translate $langs
23+
*/
24+
1825
// Protection to avoid direct call of template
1926
if (empty($conf) || ! is_object($conf)) {
2027
print "Error, template page can't be called as URL";

myaccount/tpl/automigration.tpl.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@
1515
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
*/
1717

18+
/**
19+
* @var Conf $conf
20+
* @var DoliDB $db
21+
* @var HookManager $hookmanager
22+
* @var Translate $langs
23+
*/
24+
1825
// Protection to avoid direct call of template
1926
if (empty($conf) || ! is_object($conf)) {
2027
print "Error, template page can't be called as URL";

myaccount/tpl/autoupgrade.tpl.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@
1515
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
*/
1717

18+
/**
19+
* @var Conf $conf
20+
* @var DoliDB $db
21+
* @var HookManager $hookmanager
22+
* @var Translate $langs
23+
*/
24+
1825
// Protection to avoid direct call of template
1926
if (empty($conf) || ! is_object($conf)) {
2027
print "Error, template page can't be called as URL";

myaccount/tpl/becomereseller.tpl.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@
1515
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
*/
1717

18+
/**
19+
* @var Conf $conf
20+
* @var DoliDB $db
21+
* @var HookManager $hookmanager
22+
* @var Translate $langs
23+
*/
24+
1825
// Protection to avoid direct call of template
1926
if (empty($conf) || ! is_object($conf)) {
2027
print "Error, template page can't be called as URL";

myaccount/tpl/billing.tpl.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,8 @@
1515
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
*/
1717

18-
// Protection to avoid direct call of template
19-
if (empty($conf) || ! is_object($conf)) {
20-
print "Error, template page can't be called as URL";
21-
exit(1);
22-
}
23-
2418
/**
19+
* @var Conf $conf
2520
* @var DoliDB $db
2621
* @var HookManager $hookmanager
2722
* @var Translate $langs
@@ -30,6 +25,14 @@
3025
* @var int $nowmonth
3126
* @var int $nowyear
3227
*/
28+
29+
30+
// Protection to avoid direct call of template
31+
if (empty($conf) || ! is_object($conf)) {
32+
print "Error, template page can't be called as URL";
33+
exit(1);
34+
}
35+
3336
?>
3437
<!-- BEGIN PHP TEMPLATE billing.tpl.php -->
3538
<?php

myaccount/tpl/dashboard.tpl.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@
1515
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
*/
1717

18+
/**
19+
* @var Conf $conf
20+
* @var DoliDB $db
21+
* @var Translate $langs
22+
*/
23+
1824
// Protection to avoid direct call of template
1925
if (empty($conf) || ! is_object($conf)) {
2026
print "Error, template page can't be called as URL";

myaccount/tpl/instances.tpl.php

Lines changed: 54 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,14 @@
1515
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
*/
1717

18-
// $initialaction can be set
18+
/**
19+
* @var Conf $conf
20+
* @var DoliDB $db
21+
* @var Translate $langs
22+
*
23+
* @var string $initialaction can be set
24+
* @var Societe $mythirdpartyaccount
25+
*/
1926

2027
// Protection to avoid direct call of template
2128
if (empty($conf) || ! is_object($conf)) {
@@ -1250,8 +1257,10 @@
12501257
</div></div>
12511258
12521259
</form>
1253-
</div>
1260+
</div>';
12541261

1262+
// Tab for SSH/SFTP
1263+
print '
12551264
<!-- tab ssh/sftp -->
12561265
<div class="tab-pane" id="tab_ssh_'.$contract->id.'">
12571266
<p class="opacitymedium" style="padding: 15px">'.$langs->trans("SSHFTPDesc");
@@ -1321,7 +1330,10 @@
13211330
}
13221331

13231332
print '
1324-
</div> <!-- END TAB SSH PANE -->
1333+
</div> <!-- END TAB SSH PANE -->';
1334+
1335+
// Tab for DB access
1336+
print '
13251337
13261338
<!-- tab db -->
13271339
<div class="tab-pane" id="tab_db_'.$contract->id.'">
@@ -1436,32 +1448,47 @@
14361448
}
14371449
}
14381450
}
1439-
print ' <!-- tab upgrade -->
1440-
<div class="tab-pane" id="tab_upgrade_'.$contract->id.'">';
1441-
if ($lastversiondolibarrinstance < $newversiondolibarr) {
1442-
print ' <form class="form-upgrade" action="'.$_SERVER["PHP_SELF"].'" method="POST">
1443-
<input type="hidden" name="token" value="'.newToken().'">
1444-
<input type="hidden" name="mode" value="autoupgrade">
1445-
<input type="hidden" name="backtopagesupport" value="'.$_SERVER["PHP_SELF"].'?mode=instances">
1446-
<input type="hidden" name="instanceselect" value="'.$priority.'_'.$contract->id.'">
1447-
<p class="opacitymediumbis" style="padding: 15px">
1448-
'.$langs->trans("NewerVersionAvailable", $lastversiondolibarrinstance, $newversiondolibarr).'
1449-
</p>
1450-
<p class="center" style="padding-bottom: 15px">
1451-
<input type="submit" class="btn" name="undeploy" value="'.$langs->trans("Upgrade").'">
1452-
</p>
1453-
</form>';
1454-
}else {
1455-
print ' <p class="opacitymediumbis" style="padding: 15px">
1456-
'.$langs->trans("AlreadyToLastVersionUpgrade", $newversiondolibarr).'
1457-
</p>
1458-
';
1451+
1452+
// Get the URL for support
1453+
$sellyoursaassupporturl = getDolGlobalString('SELLYOURSAAS_SUPPORT_URL');
1454+
if (! empty($mythirdpartyaccount->array_options['options_domain_registration_page'])
1455+
&& $mythirdpartyaccount->array_options['options_domain_registration_page'] != getDolGlobalString('SELLYOURSAAS_MAIN_DOMAIN_NAME')) {
1456+
$newnamekey = 'SELLYOURSAAS_SUPPORT_URL_'.strtoupper(str_replace('.', '_', $mythirdpartyaccount->array_options['options_domain_registration_page']));
1457+
if (getDolGlobalString($newnamekey)) {
1458+
$sellyoursaassupporturl = getDolGlobalString($newnamekey);
1459+
}
14591460
}
14601461

1461-
print ' </div>
1462-
<!-- END tab upgrade -->
1463-
';
1464-
print ' <!-- tab destroy -->
1462+
// Tab for upgrade
1463+
if (empty($sellyoursaassupporturl)) {
1464+
print ' <!-- tab upgrade -->
1465+
<div class="tab-pane" id="tab_upgrade_'.$contract->id.'">';
1466+
if ($lastversiondolibarrinstance < $newversiondolibarr) {
1467+
print ' <form class="form-upgrade" action="'.$_SERVER["PHP_SELF"].'" method="POST">
1468+
<input type="hidden" name="token" value="'.newToken().'">
1469+
<input type="hidden" name="mode" value="autoupgrade">
1470+
<input type="hidden" name="backtopagesupport" value="'.$_SERVER["PHP_SELF"].'?mode=instances">
1471+
<input type="hidden" name="instanceselect" value="'.$priority.'_'.$contract->id.'">
1472+
<p class="opacitymediumbis" style="padding: 15px">
1473+
'.$langs->trans("NewerVersionAvailable", $lastversiondolibarrinstance, $newversiondolibarr).'
1474+
</p>
1475+
<p class="center" style="padding-bottom: 15px">
1476+
<input type="submit" class="btn" name="undeploy" value="'.$langs->trans("Upgrade").'">
1477+
</p>
1478+
</form>';
1479+
} else {
1480+
print ' <p class="opacitymediumbis" style="padding: 15px">
1481+
'.$langs->trans("AlreadyToLastVersionUpgrade", $newversiondolibarr).'
1482+
</p>';
1483+
}
1484+
1485+
print "\n".' </div>
1486+
<!-- END tab upgrade -->';
1487+
}
1488+
1489+
// Tab de destroy/cancel instance
1490+
print '
1491+
<!-- tab destroy -->
14651492
<div class="tab-pane" id="tab_danger_'.$contract->id.'">
14661493
14671494
<form class="form-group" action="'.$_SERVER["PHP_SELF"].'" method="POST">

myaccount/tpl/loginmyaccount.tpl.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,19 @@
1616
*/
1717

1818
// Need global variable to be defined by caller (like dol_loginfunction)
19-
// $conf
2019
// $title
2120
// $urllogo
2221
// $focus_element
2322
// $captcha_refresh
2423
// Caller can also set $morelogincontent = array(['options']=>array('js'=>..., 'table'=>...);
2524

25+
/**
26+
* @var Conf $conf
27+
* @var DoliDB $db
28+
* @var HookManager $hookmanager
29+
* @var Translate $langs
30+
*/
31+
2632
// Protection to avoid direct call of template
2733
if (empty($conf) || ! is_object($conf)) {
2834
print "Error, template page can't be called as URL";

myaccount/tpl/myaccount.tpl.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@
1717

1818
/**
1919
* @var Conf $conf
20+
* @var DoliDB $db
21+
* @var HookManager $hookmanager
2022
* @var Translate $langs
23+
*
2124
* @var Societe $mythirdpartyaccount
2225
*/
2326

myaccount/tpl/mycustomerbilling.tpl.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@
1515
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
*/
1717

18+
/**
19+
* @var Conf $conf
20+
* @var DoliDB $db
21+
* @var HookManager $hookmanager
22+
* @var Translate $langs
23+
*/
24+
1825
// Protection to avoid direct call of template
1926
if (empty($conf) || ! is_object($conf)) {
2027
print "Error, template page can't be called as URL";

0 commit comments

Comments
 (0)