Revert default type of hooks. Default is now 'addreplace' hooks (and
exception become 'output' hooks, that become deprecated).
This commit is contained in:
parent
35eeb4a3c0
commit
236b3aa9e8
@ -11,8 +11,9 @@ NEW: PHP 8.2 compatibility:
|
|||||||
WARNING:
|
WARNING:
|
||||||
|
|
||||||
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
|
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
|
||||||
* The deprecated method escapeunderscore() of database handlers has been removed. You must use escapeforlike instead.
|
* The deprecated method "escapeunderscore()" of database handlers has been removed. You must use "escapeforlike()" instead.
|
||||||
* The method nb_expedition() has been renamed into countNbOfShipments()
|
* The method "nb_expedition()" has been renamed into "countNbOfShipments()"
|
||||||
|
* Revert default type of hooks. Default is now 'addreplace' hooks (and exception become 'output' hooks, that become deprecated).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -162,84 +162,44 @@ class HookManager
|
|||||||
//dol_syslog(get_class($this).'::executeHooks method='.$method." action=".$action." context=".$parameters['context']);
|
//dol_syslog(get_class($this).'::executeHooks method='.$method." action=".$action." context=".$parameters['context']);
|
||||||
|
|
||||||
// Define type of hook ('output' or 'addreplace').
|
// Define type of hook ('output' or 'addreplace').
|
||||||
// TODO Remove hooks with type 'output' (exemple getNomUrl). All hooks must be converted into 'addreplace' hooks.
|
$hooktype = 'addreplace';
|
||||||
$hooktype = 'output';
|
// TODO Remove hooks with type 'output' (exemple createFrom). All hooks must be converted into 'addreplace' hooks.
|
||||||
if (in_array(
|
if (!in_array($method, array(
|
||||||
$method,
|
'createFrom',
|
||||||
array(
|
'dashboardMembers',
|
||||||
'addCalendarChoice',
|
'dashboardEmailings',
|
||||||
'addCalendarView',
|
'dashboardPropals',
|
||||||
'addMoreActionsButtons',
|
'dashboardPropals',
|
||||||
'addMoreMassActions',
|
'dashboardCommercials',
|
||||||
'addSearchEntry',
|
'dashboardOrders',
|
||||||
'addStatisticLine',
|
'dashboardSpecialBills',
|
||||||
'addSectionECMAuto',
|
'dashboardAccountancy',
|
||||||
'checkSecureAccess',
|
'dashboardContracts',
|
||||||
'createDictionaryFieldlist',
|
'dashboardDonation',
|
||||||
'editDictionaryFieldlist',
|
'dashboardWarehouseSendings',
|
||||||
'getFormMail',
|
'dashboardExpenseReport',
|
||||||
'deleteFile',
|
'dashboardInterventions',
|
||||||
'doActions',
|
'dashboardOrdersSuppliers',
|
||||||
'doMassActions',
|
'dashboardHRM',
|
||||||
'formatEvent',
|
'dashboardMRP',
|
||||||
'formConfirm',
|
'dashboardOpensurvey',
|
||||||
'formCreateThirdpartyOptions',
|
'dashboardWarehouse',
|
||||||
'formObjectOptions',
|
'dashboardProductServices',
|
||||||
'formattachOptions',
|
'dashboardActivities',
|
||||||
'formBuilddocLineOptions',
|
'dashboardProjects',
|
||||||
'formatNotificationMessage',
|
'dashboardWarehouseReceptions',
|
||||||
'formConfirm',
|
'dashboardThirdparties',
|
||||||
'getAccessForbiddenMessage',
|
'dashboardSupplierProposal',
|
||||||
'getDirList',
|
'dashboardTickets',
|
||||||
'hookGetEntity',
|
'dashboardUsersGroups',
|
||||||
'getFormMail',
|
'insertExtraHeader',
|
||||||
'getFormatedCustomerRef',
|
'insertExtraFooter',
|
||||||
'getFormatedSupplierRef',
|
'printLeftBlock',
|
||||||
'getIdProfUrl',
|
'formAddObjectLine',
|
||||||
'getInputIdProf',
|
'formBuilddocOption',
|
||||||
'isPaymentOK',
|
'showSocinfoOnPrint'
|
||||||
'llxFooter',
|
))) {
|
||||||
'menuDropdownQuickaddItems',
|
$hooktype = 'output';
|
||||||
'menuLeftMenuItems',
|
|
||||||
'moveUploadedFile',
|
|
||||||
'moreHtmlStatus',
|
|
||||||
'pdf_build_address',
|
|
||||||
'pdf_writelinedesc',
|
|
||||||
'pdf_getlinenum',
|
|
||||||
'pdf_getlineref',
|
|
||||||
'pdf_getlineref_supplier',
|
|
||||||
'pdf_getlinevatrate',
|
|
||||||
'pdf_getlineupexcltax',
|
|
||||||
'pdf_getlineupwithtax',
|
|
||||||
'pdf_getlineqty',
|
|
||||||
'pdf_getlineqty_asked',
|
|
||||||
'pdf_getlineqty_shipped',
|
|
||||||
'pdf_getlineqty_keeptoship',
|
|
||||||
'pdf_getlineunit',
|
|
||||||
'pdf_getlineremisepercent',
|
|
||||||
'pdf_getlineprogress',
|
|
||||||
'pdf_getlinetotalexcltax',
|
|
||||||
'pdf_getlinetotalwithtax',
|
|
||||||
'paymentsupplierinvoices',
|
|
||||||
'printAddress',
|
|
||||||
'printEmail',
|
|
||||||
'printSearchForm',
|
|
||||||
'printTabsHead',
|
|
||||||
'printObjectLine',
|
|
||||||
'printObjectSubLine',
|
|
||||||
'restrictedArea',
|
|
||||||
'sendMail',
|
|
||||||
'sendMailAfter',
|
|
||||||
'showOptionals',
|
|
||||||
'showLinkToObjectBlock',
|
|
||||||
'setContentSecurityPolicy',
|
|
||||||
'setHtmlTitle',
|
|
||||||
'completeTabsHead',
|
|
||||||
'formDolBanner',
|
|
||||||
'displayMarginInfos',
|
|
||||||
)
|
|
||||||
)) {
|
|
||||||
$hooktype = 'addreplace';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init return properties
|
// Init return properties
|
||||||
|
|||||||
@ -286,9 +286,10 @@ $hookmanager->initHooks(array('document'));
|
|||||||
$parameters = array('ecmfile' => $ecmfile, 'modulepart' => $modulepart, 'original_file' => $original_file,
|
$parameters = array('ecmfile' => $ecmfile, 'modulepart' => $modulepart, 'original_file' => $original_file,
|
||||||
'entity' => $entity, 'refname' => $refname, 'fullpath_original_file' => $fullpath_original_file,
|
'entity' => $entity, 'refname' => $refname, 'fullpath_original_file' => $fullpath_original_file,
|
||||||
'filename' => $filename, 'fullpath_original_file_osencoded' => $fullpath_original_file_osencoded);
|
'filename' => $filename, 'fullpath_original_file_osencoded' => $fullpath_original_file_osencoded);
|
||||||
$reshook = $hookmanager->executeHooks('downloadDocument', $parameters); // Note that $action and $object may have been
|
$object = new stdClass();
|
||||||
|
$reshook = $hookmanager->executeHooks('downloadDocument', $parameters, $object, $action); // Note that $action and $object may have been
|
||||||
if ($reshook < 0) {
|
if ($reshook < 0) {
|
||||||
$errors = $hookmanager->error.(is_array($hookmanager->errors) ? (!empty($hookmanager->error) ? ', ' : '').join($separator, $hookmanager->errors) : '');
|
$errors = $hookmanager->error.(is_array($hookmanager->errors) ? (!empty($hookmanager->error) ? ', ' : '').join(', ', $hookmanager->errors) : '');
|
||||||
dol_syslog("document.php - Errors when executing the hook 'downloadDocument' : ".$errors);
|
dol_syslog("document.php - Errors when executing the hook 'downloadDocument' : ".$errors);
|
||||||
print "ErrorDownloadDocumentHooks: ".$errors;
|
print "ErrorDownloadDocumentHooks: ".$errors;
|
||||||
exit;
|
exit;
|
||||||
|
|||||||
@ -2603,11 +2603,11 @@ function printDropdownQuickadd()
|
|||||||
$parameters = array();
|
$parameters = array();
|
||||||
$hook_items = $items;
|
$hook_items = $items;
|
||||||
$reshook = $hookmanager->executeHooks('menuDropdownQuickaddItems', $parameters, $hook_items); // Note that $action and $object may have been modified by some hooks
|
$reshook = $hookmanager->executeHooks('menuDropdownQuickaddItems', $parameters, $hook_items); // Note that $action and $object may have been modified by some hooks
|
||||||
if (is_numeric($reshook) && !empty($hookmanager->results) && is_array($hookmanager->results)) {
|
if (is_numeric($reshook) && !empty($hookmanager->resArray) && is_array($hookmanager->resArray)) {
|
||||||
if ($reshook == 0) {
|
if ($reshook == 0) {
|
||||||
$items['items'] = array_merge($items['items'], $hookmanager->results); // add
|
$items['items'] = array_merge($items['items'], $hookmanager->resArray); // add
|
||||||
} else {
|
} else {
|
||||||
$items = $hookmanager->results; // replace
|
$items = $hookmanager->resArray; // replace
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sort menu items by 'position' value
|
// Sort menu items by 'position' value
|
||||||
|
|||||||
@ -249,11 +249,12 @@ if ($resql) {
|
|||||||
|
|
||||||
print '</div></div>';
|
print '</div></div>';
|
||||||
|
|
||||||
|
$object = new stdClass();
|
||||||
$parameters = array(
|
$parameters = array(
|
||||||
//'type' => $type,
|
//'type' => $type,
|
||||||
'user' => $user,
|
'user' => $user,
|
||||||
);
|
);
|
||||||
$reshook = $hookmanager->executeHooks('dashboardMRP', $parameters);
|
$reshook = $hookmanager->executeHooks('dashboardMRP', $parameters, $object);
|
||||||
|
|
||||||
// End of page
|
// End of page
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|||||||
@ -919,7 +919,7 @@ class ProductAttribute extends CommonObject
|
|||||||
$parameters = array('rowid' => $rowid, 'position' => $position);
|
$parameters = array('rowid' => $rowid, 'position' => $position);
|
||||||
$action = '';
|
$action = '';
|
||||||
$reshook = $hookmanager->executeHooks('afterPositionOfAttributeUpdate', $parameters, $this, $action);
|
$reshook = $hookmanager->executeHooks('afterPositionOfAttributeUpdate', $parameters, $this, $action);
|
||||||
return 1;
|
return ($reshook >= 0 ? 1 : -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -54,7 +54,7 @@ $coldisplay++;
|
|||||||
<input type="text" name="line_ref" id="line_ref" class="flat" value="<?php echo (GETPOSTISSET("line_ref") ? GETPOST("line_ref", 'alpha', 2) : $line->ref); ?>">
|
<input type="text" name="line_ref" id="line_ref" class="flat" value="<?php echo (GETPOSTISSET("line_ref") ? GETPOST("line_ref", 'alpha', 2) : $line->ref); ?>">
|
||||||
<?php
|
<?php
|
||||||
if (is_object($hookmanager)) {
|
if (is_object($hookmanager)) {
|
||||||
$parameters = array('line'=>$line);
|
$parameters = array('line' => $line);
|
||||||
$reshook = $hookmanager->executeHooks('formEditProductOptions', $parameters, $object, $action);
|
$reshook = $hookmanager->executeHooks('formEditProductOptions', $parameters, $object, $action);
|
||||||
if (!empty($hookmanager->resPrint)) {
|
if (!empty($hookmanager->resPrint)) {
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
|
|||||||
@ -430,7 +430,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
|
|
||||||
$parameters = array();
|
$parameters = array();
|
||||||
$reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
if ($reshook < 0) {
|
||||||
|
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
}
|
||||||
if (empty($reshook))
|
if (empty($reshook))
|
||||||
$object->formAddObjectLine(1, $mysoc, $soc);
|
$object->formAddObjectLine(1, $mysoc, $soc);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user