From e3aa84ff5a198fcec6c08315bc24243686b13835 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Sun, 2 Oct 2016 10:41:22 +0200 Subject: [PATCH] NEW Add last activation date as info in module list. --- htdocs/admin/modules.php | 26 ++++++++++------- htdocs/core/modules/DolibarrModules.class.php | 28 ++++++++++++++++++- htdocs/langs/en_US/admin.lang | 1 + 3 files changed, 44 insertions(+), 11 deletions(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 85e46b32333..9de1dae60b5 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -520,6 +520,11 @@ if ($mode != 'marketplace') { $text.='<br><strong>'.$langs->trans("Origin").':</strong> '.$langs->trans("Core").'<br>'; } + $text.='<br><strong>'.$langs->trans("LastActivationDate").':</strong> '; + if (! empty($conf->global->$const_name)) $text.=dol_print_date($objMod->getLastActivationDate(), 'dayhour'); + else $text.=$langs->trans("Disabled"); + $text.='<br>'; + $text.='<br><strong>'.$langs->trans("AddRemoveTabs").':</strong> '; if (isset($objMod->tabs) && is_array($objMod->tabs) && count($objMod->tabs)) { @@ -650,22 +655,23 @@ if ($mode != 'marketplace') print $form->textwithpicto('', $text, 1, 'help', 'minheight20'); - // Picto warning + print '</td>'; + + // Version + print '<td align="center" valign="top" class="nowrap">'; + + // Picto warning $version=$objMod->getVersion(0); $versiontrans=$objMod->getVersion(1); - if (preg_match('/development/i', $version)) print img_warning($langs->trans("Development"), 'style="float: right"'); - if (preg_match('/experimental/i', $version)) print img_warning($langs->trans("Experimental"), 'style="float: right"'); - if (preg_match('/deprecated/i', $version)) print img_warning($langs->trans("Deprecated"), 'style="float: right"'); + if (preg_match('/development/i', $version)) print img_warning($langs->trans("Development"), 'style="float: left"'); + if (preg_match('/experimental/i', $version)) print img_warning($langs->trans("Experimental"), 'style="float: left"'); + if (preg_match('/deprecated/i', $version)) print img_warning($langs->trans("Deprecated"), 'style="float: left"'); // Picto external - if ($textexternal) print img_picto($langs->trans("ExternalModule",$dirofmodule), 'external', 'style="float: right"'); + if ($textexternal) print img_picto($langs->trans("ExternalModule",$dirofmodule), 'external', 'style="float: left"'); - - print '</td>'; - - // Version - print '<td align="center" valign="top" class="nowrap">'; print $versiontrans; + print "</td>\n"; // Activate/Disable and Setup (2 columns) diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index b8b194e5be6..dbb8f9b3f01 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -709,7 +709,33 @@ class DolibarrModules // Can not be abstract, because we need to insta } } - + + /** + * Gives the last date of activation + * + * @return timestamp Date of last activation + */ + function getLastActivationDate() + { + global $conf; + + $sql = "SELECT tms FROM ".MAIN_DB_PREFIX."const"; + $sql.= " WHERE ".$this->db->decrypt('name')." = '".$this->const_name."'"; + $sql.= " AND entity IN (0, ".$conf->entity.")"; + + dol_syslog(get_class($this)."::getLastActiveDate", LOG_DEBUG); + $resql=$this->db->query($sql); + if (! $resql) $err++; + else + { + $obj=$this->db->fetch_object($resql); + if ($obj) return $this->db->jdate($obj->tms); + } + + return ''; + } + + /** * Insert constants for module activation * diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index aa1b98ccf58..0d5e6e464e9 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -278,6 +278,7 @@ YouCanSubmitFile=For this step, you can send package using this tool: Select mod CurrentVersion=Dolibarr current version CallUpdatePage=Go to the page that updates the database structure and data: %s. LastStableVersion=Latest stable version +LastActivationDate=Last activation date UpdateServerOffline=Update server offline GenericMaskCodes=You may enter any numbering mask. In this mask, the following tags could be used:<br><b>{000000}</b> corresponds to a number which will be incremented on each %s. Enter as many zeros as the desired length of the counter. The counter will be completed by zeros from the left in order to have as many zeros as the mask. <br><b>{000000+000}</b> same as previous but an offset corresponding to the number to the right of the + sign is applied starting on first %s. <br><b>{000000@x}</b> same as previous but the counter is reset to zero when month x is reached (x between 1 and 12, or 0 to use the early months of fiscal year defined in your configuration, or 99 to reset to zero every month). If this option is used and x is 2 or higher, then sequence {yy}{mm} or {yyyy}{mm} is also required. <br><b>{dd}</b> day (01 to 31).<br><b>{mm}</b> month (01 to 12).<br><b>{yy}</b>, <b>{yyyy}</b> or <b>{y}</b> year over 2, 4 or 1 numbers. <br> GenericMaskCodes2=<b>{cccc}</b> the client code on n characters<br><b>{cccc000}</b> the client code on n characters is followed by a counter dedicated for customer. This counter dedicated to customer is reset at same time than global counter.<br><b>{tttt}</b> The code of thirdparty type on n characters (see dictionary-thirdparty types).<br> -- GitLab