Skip to content

Commit 5d70d1a

Browse files
committed
Add version of the current module, and the last stable module.
1 parent 71e746d commit 5d70d1a

3 files changed

Lines changed: 47 additions & 2 deletions

File tree

app/code/community/Devopensource/Redsys/Helper/Data.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<?php
22
class Devopensource_Redsys_Helper_Data extends Mage_Core_Helper_Abstract {
33

4+
CONST MODULE_URL_VERSION_STABLE = 'https://raw.githubusercontent.com/DevopensourceTeam/Devopensource_Redsys/master/app/code/community/Devopensource/Redsys/etc/config.xml';
5+
46
public function getMessage(){
57
return Mage::getStoreConfig('payment/redsys/message_credit_card', Mage::app()->getStore());
68
}
@@ -347,4 +349,35 @@ public function createTransaction($order,$decodeData){
347349
$transaction->save();
348350
}
349351

352+
public function getCurrentVersion(){
353+
354+
return (string) Mage::getConfig()->getNode('modules/'.$this->_getModuleName().'/version');
355+
}
356+
357+
public function getModuleName(){
358+
359+
return (string) $this->_getModuleName();
360+
}
361+
362+
public function getLatestVersionStable(){
363+
364+
$xmlObj = simplexml_load_file(self::MODULE_URL_VERSION_STABLE);
365+
$moduleName = $this->getModuleName();
366+
367+
$versionLatestStable = $xmlObj->modules->$moduleName->version;
368+
369+
return $versionLatestStable;
370+
}
371+
372+
public function isCurrentVersionLatest(){
373+
374+
$verCurrent = str_replace(".", "", $this->getCurrentVersion());
375+
$verLatest = str_replace(".", "", $this->getLatestVersionStable());
376+
377+
if($verCurrent < $verLatest){
378+
return false;
379+
}
380+
381+
return true;
382+
}
350383
}

app/design/adminhtml/default/default/template/devopensource/redsys/hint.phtml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,18 @@
1111
max-width:75px;
1212
}
1313

14+
.no-latest-version{
15+
color: red;
16+
}
17+
18+
.latest-version{
19+
color: green;
20+
}
21+
1422
</style>
1523
<div class="header_redsys">
16-
<?php echo $this->__('Module developed by <a href="http://devopensource.com/">Devopensource.com</a> if you need support contact with <a href="mailto:info@devopensource.com" >info@devopensource.com</a> or help us keep the module <a href="https://github.com/DevopensourceTeam/Devopensource_Redsys" >in github</a>. You can view the <a href="https://github.com/DevopensourceTeam/Devopensource_Redsys/wiki">documentation here</a>'); ?> <img class="logo-redsys" src="http://modules.devopensource.com/assets/logo/devopensource_redsys.png" />
24+
<?php echo $this->__('Module developed by <a href="http://devopensource.com/">Devopensource.com</a> if you need support contact with <a href="mailto:info@devopensource.com" >info@devopensource.com</a> or help us keep the module <a href="https://github.com/DevopensourceTeam/Devopensource_Redsys" >in github</a>. You can view the <a href="https://github.com/DevopensourceTeam/Devopensource_Redsys/wiki">documentation here</a>'); ?> <img class="logo-redsys" src="http://modules.devopensource.com/assets/logo/devopensource_redsys.png" /></br>
25+
<p class="<?php if (Mage::helper('devopensource_redsys')->isCurrentVersionLatest()): echo 'latest-version'; else: echo 'no-latest-version'; endif; ?>"><strong><?php echo $this->__('Your version:') ?> <?php echo Mage::helper('devopensource_redsys')->getModuleName(); ?> v<?php echo Mage::helper('devopensource_redsys')->getCurrentVersion(); ?></strong></p>
26+
<p><strong><?php echo $this->__('Latest version stable:') ?> <?php echo Mage::helper('devopensource_redsys')->getModuleName(); ?> v<?php echo Mage::helper('devopensource_redsys')->getLatestVersionStable(); ?></strong></p>
1727
</div>
1828

app/locale/es_ES/Devopensource_Redsys.csv

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,6 @@
3838
"Module developed by <a href=""http://devopensource.com/"">Devopensource.com</a> if you need support contact with <a href=""mailto:info@devopensource.com"" >info@devopensource.com</a> or help us keep the module <a href=""https://github.com/DevopensourceTeam/Devopensource_Redsys"" >in github</a>. You can view the <a href=""https://github.com/DevopensourceTeam/Devopensource_Redsys/wiki"">documentation here</a>","Módulo desarollado por <a href=""http://devopensource.com/"">Devopensource.com</a> si necesitas soporte ponte en contacto con <a href=""mailto:info@devopensource.com"" >info@devopensource.com</a> o ayúdanos a mantener el módulo <a href=""https://github.com/DevopensourceTeam/Devopensource_Redsys"" >en github</a>. Puedes ver la <a href=""https://github.com/DevopensourceTeam/Devopensource_Redsys/wiki"">documentacion aquí</a>"
3939
"Enabled in developer restriction","Habilitado en la restricción de desarrolladores"
4040
"(response:%s)","(respuesta:%s)"
41-
"Display Error Messages Clients","Mostrar mensajes de error redsys a los clientes"
41+
"Display Error Messages Clients","Mostrar mensajes de error redsys a los clientes"
42+
"Your version:","Tu versión:"
43+
"Latest version stable:","Última versión estable:"

0 commit comments

Comments
 (0)