NEW: ADD url to see the last version of a external module

This commit is contained in:
Inovea Conseil 2018-05-30 00:20:31 +02:00
parent ee83b9a7b2
commit e0c1e33012
2 changed files with 12 additions and 1 deletions

View File

@ -7,7 +7,8 @@
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
*
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
@ -666,6 +667,12 @@ if ($mode == 'common')
// Version
print '<td class="center nowrap" width="120px">';
print $versiontrans;
if (!empty($objMod->url_last_version)) {
$newversion = file_get_contents($objMod->url_last_version);
if (version_compare($newversion, $versiontrans) > 0) {
print "&nbsp;<span class='butAction' title='" . $langs->trans('LastStableVersion') . "'>$newversion</span>";
}
}
print "</td>\n";
// Activate/Disable and Setup (2 columns)

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2004-2018 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) ---Put here your own copyright and developer email---
*
* This program is free software; you can redistribute it and/or modify
@ -73,6 +74,9 @@ class modMyModule extends DolibarrModules
// Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'
$this->version = '1.0';
//Url to the file with your last numberversion of this module
$this->url_last_version = 'http://www.example.com/versionmodule.txt';
// Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
// Name of image file used for this module.