NEW warning on module blocked log reset if country code is FR
fix wrong paste click
This commit is contained in:
parent
8019f73f99
commit
a2df87ab15
@ -94,6 +94,8 @@ $hookmanager->initHooks(array('adminmodules','globaladmin'));
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
$formconfirm = '';
|
||||||
|
|
||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
@ -236,8 +238,7 @@ if ($action == 'set' && $user->admin)
|
|||||||
header("Location: ".$_SERVER["PHP_SELF"]."?mode=".$mode.$param.($page_y?'&page_y='.$page_y:''));
|
header("Location: ".$_SERVER["PHP_SELF"]."?mode=".$mode.$param.($page_y?'&page_y='.$page_y:''));
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
else if ($action == 'reset' && $user->admin && GETPOST('confirm') == 'yes')
|
||||||
if ($action == 'reset' && $user->admin)
|
|
||||||
{
|
{
|
||||||
$result=unActivateModule($value);
|
$result=unActivateModule($value);
|
||||||
if ($result) setEventMessages($result, null, 'errors');
|
if ($result) setEventMessages($result, null, 'errors');
|
||||||
@ -423,6 +424,22 @@ foreach ($modulesdir as $dir)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($action == 'reset_confirm' && $user->admin)
|
||||||
|
{
|
||||||
|
if(!empty($modules[$value])) {
|
||||||
|
$objMod = $modules[$value];
|
||||||
|
|
||||||
|
if(!empty($objMod->langfiles)) $langs->loadLangs($objMod->langfiles);
|
||||||
|
|
||||||
|
$form = new Form($db);
|
||||||
|
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?value='.$value.'&mode='.$mode.$param, $langs->trans('ConfirmUnactivation'), $langs->trans(GETPOST('confirm_message_code')), 'reset', '', 'no', 1);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
print $formconfirm;
|
||||||
|
|
||||||
asort($orders);
|
asort($orders);
|
||||||
//var_dump($orders);
|
//var_dump($orders);
|
||||||
//var_dump($categ);
|
//var_dump($categ);
|
||||||
@ -679,9 +696,20 @@ if ($mode == 'common')
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&module_position='.$module_position.'&action=reset&value=' . $modName . '&mode=' . $mode . $param . '">';
|
if(!empty($objMod->warnings_unactivation[$mysoc->country_code]) && method_exists($objMod, 'alreadyUsed') && $objMod->alreadyUsed()) {
|
||||||
|
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&module_position='.$module_position.'&action=reset_confirm&confirm_message_code='.$objMod->warnings_unactivation[$mysoc->country_code].'&value=' . $modName . '&mode=' . $mode . $param . '">';
|
||||||
print img_picto($langs->trans("Activated"),'switch_on');
|
print img_picto($langs->trans("Activated"),'switch_on');
|
||||||
print '</a>';
|
print '</a>';
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&module_position='.$module_position.'&action=reset&value=' . $modName . '&mode=' . $mode .'&confirm=yes' . $param . '">';
|
||||||
|
print img_picto($langs->trans("Activated"),'switch_on');
|
||||||
|
print '</a>';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
print '</td>'."\n";
|
print '</td>'."\n";
|
||||||
|
|
||||||
|
|||||||
@ -69,7 +69,9 @@ class modBlockedLog extends DolibarrModules
|
|||||||
$this->depends = array('always'=>'modFacture'); // List of modules id that must be enabled if this module is enabled
|
$this->depends = array('always'=>'modFacture'); // List of modules id that must be enabled if this module is enabled
|
||||||
$this->requiredby = array(); // List of modules id to disable if this one is disabled
|
$this->requiredby = array(); // List of modules id to disable if this one is disabled
|
||||||
$this->conflictwith = array(); // List of modules id this module is in conflict with
|
$this->conflictwith = array(); // List of modules id this module is in conflict with
|
||||||
$this->langfiles = array();
|
$this->langfiles = array('blockedlog');
|
||||||
|
|
||||||
|
$this->warnings_unactivation = array('FR'=>'BlockedLogAreRequiredByYourCountryLegislation');
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
//-----------
|
//-----------
|
||||||
@ -87,4 +89,51 @@ class modBlockedLog extends DolibarrModules
|
|||||||
//------------------
|
//------------------
|
||||||
$this->menu = array();
|
$this->menu = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if module was already used before unactivation linked to warnings_unactivation property
|
||||||
|
*/
|
||||||
|
function alreadyUsed() {
|
||||||
|
|
||||||
|
$res = $this->db->query("SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."blockedlog");
|
||||||
|
if($res!==false) {
|
||||||
|
$obj = $this->db->fetch_object($res);
|
||||||
|
return ($obj->nb > 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function called when module is disabled.
|
||||||
|
* The remove function removes tabs, constants, boxes, permissions and menus from Dolibarr database.
|
||||||
|
* Data directories are not deleted
|
||||||
|
*
|
||||||
|
* @param string $options Options when enabling module ('', 'noboxes')
|
||||||
|
* @return int 1 if OK, 0 if KO
|
||||||
|
*/
|
||||||
|
function remove($options = '') {
|
||||||
|
|
||||||
|
global $user;
|
||||||
|
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
|
||||||
|
|
||||||
|
$object=new stdClass;
|
||||||
|
$object->id = 1;
|
||||||
|
$object->element = 'module';
|
||||||
|
$object->ref = 'module';
|
||||||
|
$object->date = time();
|
||||||
|
|
||||||
|
$b=new BlockedLog($this->db);
|
||||||
|
$b->setObjectData($object, 'MODULE_RESET', -1);
|
||||||
|
|
||||||
|
$res = $b->create($user);
|
||||||
|
if($res<=0) {
|
||||||
|
$this->error = $b->error;
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->_remove(array(), $options);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1765,3 +1765,4 @@ ResourceSetup=Configuration du module Resource
|
|||||||
UseSearchToSelectResource=Use a search form to choose a resource (rather than a drop-down list).
|
UseSearchToSelectResource=Use a search form to choose a resource (rather than a drop-down list).
|
||||||
DisabledResourceLinkUser=Disabled resource link to user
|
DisabledResourceLinkUser=Disabled resource link to user
|
||||||
DisabledResourceLinkContact=Disabled resource link to contact
|
DisabledResourceLinkContact=Disabled resource link to contact
|
||||||
|
ConfirmUnactivation=Confirm module reset
|
||||||
|
|||||||
@ -27,3 +27,4 @@ logDOC_PREVIEW=Preview of a validated document in order to print or download
|
|||||||
logDOC_DOWNLOAD=Download of a validated document in order to print or send
|
logDOC_DOWNLOAD=Download of a validated document in order to print or send
|
||||||
DataOfArchivedEvent=Full datas of archived event
|
DataOfArchivedEvent=Full datas of archived event
|
||||||
ImpossibleToReloadObject=Object (type %s, id %s) removed
|
ImpossibleToReloadObject=Object (type %s, id %s) removed
|
||||||
|
BlockedLogAreRequiredByYourCountryLegislation=Unalterable logs are required by the legislation of your country. Disabling this module may render any future transactions invalid with respect to the law and the use of non-legal software as it can not be validated by a tax audit.
|
||||||
Loading…
Reference in New Issue
Block a user