Skip to content

Commit

Permalink
NEW Add last activation author and ip of modules
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed May 6, 2017
1 parent d948447 commit 910a925
Show file tree
Hide file tree
Showing 19 changed files with 84 additions and 24 deletions.
18 changes: 18 additions & 0 deletions htdocs/admin/modulehelp.php
Expand Up @@ -330,6 +330,24 @@
else $text.=$langs->trans("Disabled");
$text.='<br>';

$tmp = $objMod->getLastActivationInfo();
$authorid = $tmp['authorid'];
if ($authorid > 0)
{
$tmpuser = new User($db);
$tmpuser->fetch($authorid);
$text.='<strong>'.$langs->trans("LastActivationAuthor").':</strong> ';
$text.= $tmpuser->getNomUrl(1);
$text.='<br>';
}
$ip = $tmp['ip'];
if ($ip)
{
$text.='<strong>'.$langs->trans("LastActivationIP").':</strong> ';
$text.= $ip;
$text.='<br>';
}

$moduledesclong=$objMod->getDescLong();
if ($moduledesclong) $text.='<br><hr><div class="moduledesclong">'.$moduledesclong.'<div>';
}
Expand Down
6 changes: 3 additions & 3 deletions htdocs/admin/modules.php
Expand Up @@ -402,9 +402,9 @@
print load_fiche_titre($langs->trans("ModulesSetup"),$moreinfo,'title_setup');

// Start to show page
if ($mode=='common') print $langs->trans("ModulesDesc")."<br>\n";
if ($mode=='marketplace') print $langs->trans("ModulesMarketPlaceDesc")."<br>\n";
if ($mode=='deploy') print $langs->trans("ModulesDeployDesc", $langs->transnoentitiesnoconv("AvailableModules"))."<br>\n";
if ($mode=='common') print '<span class="opacitymedium">'.$langs->trans("ModulesDesc")."</span><br>\n";
if ($mode=='marketplace') print '<span class="opacitymedium">'.$langs->trans("ModulesMarketPlaceDesc")."</span><br>\n";
if ($mode=='deploy') print '<span class="opacitymedium">'.$langs->trans("ModulesDeployDesc", $langs->transnoentitiesnoconv("AvailableModules"))."</span><br>\n";


$h = 0;
Expand Down
4 changes: 2 additions & 2 deletions htdocs/admin/user.php
Expand Up @@ -167,7 +167,7 @@

$head=user_admin_prepare_head();

dol_fiche_head($head,'card', $langs->trans("MenuUsersAndGroups"), 0, 'user');
dol_fiche_head($head,'card', $langs->trans("MenuUsersAndGroups"), -1, 'user');

print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
Expand Down Expand Up @@ -205,7 +205,7 @@

print '</table>';


print '<br>';

$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);

Expand Down
2 changes: 1 addition & 1 deletion htdocs/admin/usergroup.php
Expand Up @@ -151,7 +151,7 @@

$head=user_admin_prepare_head();

dol_fiche_head($head,'usergroupcard', $langs->trans("MenuUsersAndGroups"), 0, 'user');
dol_fiche_head($head,'usergroupcard', $langs->trans("MenuUsersAndGroups"), -1, 'user');


$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
Expand Down
2 changes: 1 addition & 1 deletion htdocs/comm/mailing/card.php
Expand Up @@ -1057,7 +1057,7 @@
// Print mail content
print load_fiche_titre($langs->trans("EMail"), $form->textwithpicto($langs->trans("AvailableVariables"), $htmltext, 1, 'help', '', 0, 2, 'emailsubstitionhelp'), 'title_generic');

dol_fiche_head('');
dol_fiche_head('', '', '', -1);

print '<table class="border" width="100%">';

Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/lib/admin.lib.php
Expand Up @@ -812,7 +812,7 @@ function activateModule($value,$withdeps=1)
return $ret;
}

$result=$objMod->init();
$result=$objMod->init(); // Enable module
if ($result <= 0)
{
$ret['errors'][]=$objMod->error;
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/menus/standard/auguria.lib.php
Expand Up @@ -269,7 +269,7 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM
print '<div class="menu_titre" id="menu_titre_logo"></div>';
print '<div class="menu_top" id="menu_top_logo"></div>';
print '<div class="menu_contenu" id="menu_contenu_logo">';
print '<div class="center"><img title="'.dol_escape_htmltag($title).'" alt="" src="'.$urllogo.'" style="max-width: 80%"></div>'."\n";
print '<div class="center"><img title="'.dol_escape_htmltag($title).'" alt="" src="'.$urllogo.'" style="max-width: 70%"></div>'."\n";
print '</div>';
print '<div class="menu_end" id="menu_end_logo"></div>';
print '</div>'."\n";
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/menus/standard/eldy.lib.php
Expand Up @@ -478,7 +478,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
print '<div class="menu_titre" id="menu_titre_logo"></div>';
print '<div class="menu_top" id="menu_top_logo"></div>';
print '<div class="menu_contenu" id="menu_contenu_logo">';
print '<div class="center"><img class="mycompany" title="'.dol_escape_htmltag($title).'" alt="" src="'.$urllogo.'" style="max-width: 80%"></div>'."\n";
print '<div class="center"><img class="mycompany" title="'.dol_escape_htmltag($title).'" alt="" src="'.$urllogo.'" style="max-width: 70%"></div>'."\n";
print '</div>';
print '<div class="menu_end" id="menu_end_logo"></div>';
print '</div>'."\n";
Expand Down
42 changes: 38 additions & 4 deletions htdocs/core/modules/DolibarrModules.class.php
Expand Up @@ -795,14 +795,45 @@ function getLastActivationDate()
}


/**
* Gives the last author of activation
*
* @return array Array array('authorid'=>Id of last activation user, 'lastactivationdate'=>Date of last activation)
*/
function getLastActivationInfo()
{
global $conf;

$sql = "SELECT tms, note 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);
$tmp=array();
if ($obj->note)
{
$tmp=json_decode($obj->note, true);
}
if ($obj) return array('authorid'=>$tmp['authorid'], 'ip'=>$tmp['ip'], 'lastactivationdate'=>$this->db->jdate($obj->tms));
}

return array();
}


/**
* Insert constants for module activation
*
* @return int Error count (0 if OK)
*/
function _active()
{
global $conf;
global $conf, $user;

$err = 0;

Expand All @@ -817,10 +848,13 @@ function _active()
$resql=$this->db->query($sql);
if (! $resql) $err++;

$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,value,visible,entity) VALUES";
$note=json_encode(array('authorid'=>$user->id, 'ip'=>$_SERVER['REMOTE_ADDR']));

$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name, value, visible, entity, note) VALUES";
$sql.= " (".$this->db->encrypt($this->const_name,1);
$sql.= ",".$this->db->encrypt('1',1);
$sql.= ",0,".$entity.")";
$sql.= ", ".$this->db->encrypt('1',1);
$sql.= ", 0, ".$entity;
$sql.= ", '".$this->db->escape($note)."')";

dol_syslog(get_class($this)."::_active", LOG_DEBUG);
$resql=$this->db->query($sql);
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/tpl/login.tpl.php
Expand Up @@ -258,7 +258,7 @@
<?php if ($main_home)
{
?>
<div class="center login_main_home" style="max-width: 80%">
<div class="center login_main_home" style="max-width: 70%">
<?php echo $main_home; ?>
</div><br>
<?php
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/tpl/passwordforgotten.tpl.php
Expand Up @@ -151,7 +151,7 @@
</form>


<div class="center login_main_home" style="max-width: 80%">
<div class="center login_main_home" style="max-width: 70%">
<?php if ($mode == 'dolibarr' || ! $disabled) { ?>
<font style="font-size: 12px;">
<?php echo $langs->trans('SendNewPasswordDesc'); ?>
Expand Down
4 changes: 3 additions & 1 deletion htdocs/langs/en_US/admin.lang
Expand Up @@ -302,6 +302,8 @@ CurrentVersion=Dolibarr current version
CallUpdatePage=Go to the page that updates the database structure and data: %s.
LastStableVersion=Latest stable version
LastActivationDate=Latest activation date
LastActivationAuthor=Latest activation author
LastActivationIP=Latest activation IP
UpdateServerOffline=Update server offline
WithCounter=Manage a counter
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>
Expand Down Expand Up @@ -1099,7 +1101,7 @@ WarningAtLeastKeyOrTranslationRequired=A search criteria is required at least fo
NewTranslationStringToShow=New translation string to show
OriginalValueWas=The original translation is overwritten. Original value was:<br><br>%s
TransKeyWithoutOriginalValue=You forced a new translation for the translation key '<strong>%s</strong>' that does not exists in any language files
TotalNumberOfActivatedModules=Total number of activated feature modules: <b>%s</b> / <b>%s</b>
TotalNumberOfActivatedModules=Activated feature/modules: <b>%s</b> / <b>%s</b>
YouMustEnableOneModule=You must at least enable 1 module
ClassNotFoundIntoPathWarning=Class %s not found into PHP path
YesInSummer=Yes in summer
Expand Down
2 changes: 1 addition & 1 deletion htdocs/societe/admin/contact_extrafields.php
Expand Up @@ -70,7 +70,7 @@

$head = societe_admin_prepare_head();

dol_fiche_head($head, 'attributes_contacts', $langs->trans("ThirdParties"), 0, 'company');
dol_fiche_head($head, 'attributes_contacts', $langs->trans("ThirdParties"), -1, 'company');

require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';

Expand Down
2 changes: 1 addition & 1 deletion htdocs/societe/admin/societe.php
Expand Up @@ -307,7 +307,7 @@

$head = societe_admin_prepare_head();

dol_fiche_head($head, 'general', $langs->trans("ThirdParties"), 0, 'company');
dol_fiche_head($head, 'general', $langs->trans("ThirdParties"), -1, 'company');

$dirsociete=array_merge(array('/core/modules/societe/'),$conf->modules_parts['societe']);

Expand Down
2 changes: 1 addition & 1 deletion htdocs/societe/admin/societe_extrafields.php
Expand Up @@ -71,7 +71,7 @@

$head = societe_admin_prepare_head();

dol_fiche_head($head, 'attributes', $langs->trans("ThirdParties"), 0, 'company');
dol_fiche_head($head, 'attributes', $langs->trans("ThirdParties"), -1, 'company');

require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';

Expand Down
Binary file modified htdocs/theme/dolibarr_logo.png 100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 8 additions & 2 deletions htdocs/theme/eldy/style.css.php
Expand Up @@ -90,7 +90,7 @@
$colorbacklinepair2='248,248,248'; // line pair
$colorbacklinepairhover='238,246,252'; // line pair
$colorbackbody='255,255,255';
$colortexttitlenotab='60,60,20';
$colortexttitlenotab='100,60,20';
$colortexttitle='0,0,0';
$colortext='0,0,0';
$colortextlink='0,0,120';
Expand Down Expand Up @@ -988,6 +988,9 @@
<?php if (! empty($conf->dol_hide_leftmenu) && ! empty($conf->dol_hide_topmenu)) print 'margin-top: 4px;'."\n"; ?>
<?php if (! empty($conf->dol_hide_leftmenu)) print 'margin-bottom: 12px;'."\n"; ?>
}
div.fiche>table:first-child {
margin-bottom: 15px !important;
}
div.fichecenter {
/* margin-top: 10px; */
width: 100%;
Expand Down Expand Up @@ -2018,6 +2021,9 @@
white-space: nowrap;
}

a.tabunactive {
color: rgb(<?php print $colortextlink; ?>) !important;
}
a.tab:link, a.tab:visited, a.tab:hover, a.tab#active {
font-family: <?php print $fontlist ?>;
padding: 12px 9px 12px;
Expand Down Expand Up @@ -3034,7 +3040,7 @@
div.titre {
font-family: <?php print $fontlist ?>;
font-size: 14px;
/* font-weight: bold; */
font-weight: bold;
color: rgb(<?php print $colortexttitlenotab; ?>);
text-decoration: none;
padding-top: 5px;
Expand Down
2 changes: 1 addition & 1 deletion htdocs/user/admin/group_extrafields.php
Expand Up @@ -71,7 +71,7 @@

$head = user_admin_prepare_head();

dol_fiche_head($head, 'attributes_group', $langs->trans("MenuUsersAndGroups"), 0, 'user');
dol_fiche_head($head, 'attributes_group', $langs->trans("MenuUsersAndGroups"), -1, 'user');

require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';

Expand Down
2 changes: 1 addition & 1 deletion htdocs/user/admin/user_extrafields.php
Expand Up @@ -70,7 +70,7 @@

$head = user_admin_prepare_head();

dol_fiche_head($head, 'attributes', $langs->trans("MenuUsersAndGroups"), 0, 'user');
dol_fiche_head($head, 'attributes', $langs->trans("MenuUsersAndGroups"), -1, 'user');

require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';

Expand Down

0 comments on commit 910a925

Please sign in to comment.