Merge pull request #20449 from atm-greg/FIX_develop_missing_hooks_for_dictionaryadmin
add more specific context and doAction hook
This commit is contained in:
commit
35822370ec
@ -94,7 +94,7 @@ if (!GETPOSTISSET('search_country_id') && $search_country_id == '' && ($id == 2
|
|||||||
$search_code = GETPOST('search_code', 'alpha');
|
$search_code = GETPOST('search_code', 'alpha');
|
||||||
|
|
||||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||||
$hookmanager->initHooks(array('admin'));
|
$hookmanager->initHooks(array('admin', 'dictionaryadmin'));
|
||||||
|
|
||||||
// This page is a generic page to edit dictionaries
|
// This page is a generic page to edit dictionaries
|
||||||
// Put here declaration of dictionaries properties
|
// Put here declaration of dictionaries properties
|
||||||
@ -694,13 +694,38 @@ if ($id == 10) {
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
$parameters = array(
|
||||||
|
'id' =>$id,
|
||||||
|
'rowid' =>$rowid,
|
||||||
|
'code' =>$code,
|
||||||
|
'confirm' =>$confirm,
|
||||||
|
'entity' =>$entity,
|
||||||
|
'taborder' =>$taborder,
|
||||||
|
'tabname' =>$tabname,
|
||||||
|
'tablib' =>$tablib,
|
||||||
|
'tabsql' =>$tabsql,
|
||||||
|
'tabsqlsort' =>$tabsqlsort,
|
||||||
|
'tabfield' =>$tabfield,
|
||||||
|
'tabfieldvalue' =>$tabfieldvalue,
|
||||||
|
'tabfieldinsert'=>$tabfieldinsert,
|
||||||
|
'tabrowid' =>$tabrowid,
|
||||||
|
'tabcond' =>$tabcond,
|
||||||
|
'tabhelp' =>$tabhelp,
|
||||||
|
'tabcomplete' =>$tabcomplete
|
||||||
|
);
|
||||||
|
$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 (GETPOST('button_removefilter', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter_x', 'alpha')) {
|
if (GETPOST('button_removefilter', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter_x', 'alpha')) {
|
||||||
$search_country_id = '';
|
$search_country_id = '';
|
||||||
$search_code = '';
|
$search_code = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actions add or modify an entry into a dictionary
|
if (empty($reshook)) {
|
||||||
if (GETPOST('actionadd') || GETPOST('actionmodify')) {
|
// Actions add or modify an entry into a dictionary
|
||||||
|
if (GETPOST('actionadd') || GETPOST('actionmodify')) {
|
||||||
$listfield = explode(',', str_replace(' ', '', $tabfield[$id]));
|
$listfield = explode(',', str_replace(' ', '', $tabfield[$id]));
|
||||||
$listfieldinsert = explode(',', $tabfieldinsert[$id]);
|
$listfieldinsert = explode(',', $tabfieldinsert[$id]);
|
||||||
$listfieldmodify = explode(',', $tabfieldinsert[$id]);
|
$listfieldmodify = explode(',', $tabfieldinsert[$id]);
|
||||||
@ -987,13 +1012,13 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
|
//$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GETPOST('actioncancel')) {
|
if (GETPOST('actioncancel')) {
|
||||||
//$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
|
//$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'confirm_delete' && $confirm == 'yes') { // delete
|
if ($action == 'confirm_delete' && $confirm == 'yes') { // delete
|
||||||
if ($tabrowid[$id]) {
|
if ($tabrowid[$id]) {
|
||||||
$rowidcol = $tabrowid[$id];
|
$rowidcol = $tabrowid[$id];
|
||||||
} else {
|
} else {
|
||||||
@ -1011,10 +1036,10 @@ if ($action == 'confirm_delete' && $confirm == 'yes') { // delete
|
|||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// activate
|
// activate
|
||||||
if ($action == $acts[0]) {
|
if ($action == $acts[0]) {
|
||||||
if ($tabrowid[$id]) {
|
if ($tabrowid[$id]) {
|
||||||
$rowidcol = $tabrowid[$id];
|
$rowidcol = $tabrowid[$id];
|
||||||
} else {
|
} else {
|
||||||
@ -1031,10 +1056,10 @@ if ($action == $acts[0]) {
|
|||||||
if (!$result) {
|
if (!$result) {
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// disable
|
// disable
|
||||||
if ($action == $acts[1]) {
|
if ($action == $acts[1]) {
|
||||||
if ($tabrowid[$id]) {
|
if ($tabrowid[$id]) {
|
||||||
$rowidcol = $tabrowid[$id];
|
$rowidcol = $tabrowid[$id];
|
||||||
} else {
|
} else {
|
||||||
@ -1051,10 +1076,10 @@ if ($action == $acts[1]) {
|
|||||||
if (!$result) {
|
if (!$result) {
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// favorite
|
// favorite
|
||||||
if ($action == 'activate_favorite') {
|
if ($action == 'activate_favorite') {
|
||||||
if ($tabrowid[$id]) {
|
if ($tabrowid[$id]) {
|
||||||
$rowidcol = $tabrowid[$id];
|
$rowidcol = $tabrowid[$id];
|
||||||
} else {
|
} else {
|
||||||
@ -1071,10 +1096,10 @@ if ($action == 'activate_favorite') {
|
|||||||
if (!$result) {
|
if (!$result) {
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// disable favorite
|
// disable favorite
|
||||||
if ($action == 'disable_favorite') {
|
if ($action == 'disable_favorite') {
|
||||||
if ($tabrowid[$id]) {
|
if ($tabrowid[$id]) {
|
||||||
$rowidcol = $tabrowid[$id];
|
$rowidcol = $tabrowid[$id];
|
||||||
} else {
|
} else {
|
||||||
@ -1091,10 +1116,10 @@ if ($action == 'disable_favorite') {
|
|||||||
if (!$result) {
|
if (!$result) {
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Is in EEC - Activate
|
// Is in EEC - Activate
|
||||||
if ($action == 'activate_eec') {
|
if ($action == 'activate_eec') {
|
||||||
if ($tabrowid[$id]) {
|
if ($tabrowid[$id]) {
|
||||||
$rowidcol = $tabrowid[$id];
|
$rowidcol = $tabrowid[$id];
|
||||||
} else {
|
} else {
|
||||||
@ -1111,10 +1136,10 @@ if ($action == 'activate_eec') {
|
|||||||
if (!$result) {
|
if (!$result) {
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Is in EEC - Disable
|
// Is in EEC - Disable
|
||||||
if ($action == 'disable_eec') {
|
if ($action == 'disable_eec') {
|
||||||
if ($tabrowid[$id]) {
|
if ($tabrowid[$id]) {
|
||||||
$rowidcol = $tabrowid[$id];
|
$rowidcol = $tabrowid[$id];
|
||||||
} else {
|
} else {
|
||||||
@ -1131,8 +1156,8 @@ if ($action == 'disable_eec') {
|
|||||||
if (!$result) {
|
if (!$result) {
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user