mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
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:
|
||||
|
||||
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 method nb_expedition() has been renamed into countNbOfShipments()
|
||||
* The deprecated method "escapeunderscore()" of database handlers has been removed. You must use "escapeforlike()" instead.
|
||||
* 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']);
|
||||
|
||||
// Define type of hook ('output' or 'addreplace').
|
||||
// TODO Remove hooks with type 'output' (exemple getNomUrl). All hooks must be converted into 'addreplace' hooks.
|
||||
$hooktype = 'output';
|
||||
if (in_array(
|
||||
$method,
|
||||
array(
|
||||
'addCalendarChoice',
|
||||
'addCalendarView',
|
||||
'addMoreActionsButtons',
|
||||
'addMoreMassActions',
|
||||
'addSearchEntry',
|
||||
'addStatisticLine',
|
||||
'addSectionECMAuto',
|
||||
'checkSecureAccess',
|
||||
'createDictionaryFieldlist',
|
||||
'editDictionaryFieldlist',
|
||||
'getFormMail',
|
||||
'deleteFile',
|
||||
'doActions',
|
||||
'doMassActions',
|
||||
'formatEvent',
|
||||
'formConfirm',
|
||||
'formCreateThirdpartyOptions',
|
||||
'formObjectOptions',
|
||||
'formattachOptions',
|
||||
'formBuilddocLineOptions',
|
||||
'formatNotificationMessage',
|
||||
'formConfirm',
|
||||
'getAccessForbiddenMessage',
|
||||
'getDirList',
|
||||
'hookGetEntity',
|
||||
'getFormMail',
|
||||
'getFormatedCustomerRef',
|
||||
'getFormatedSupplierRef',
|
||||
'getIdProfUrl',
|
||||
'getInputIdProf',
|
||||
'isPaymentOK',
|
||||
'llxFooter',
|
||||
'menuDropdownQuickaddItems',
|
||||
'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';
|
||||
$hooktype = 'addreplace';
|
||||
// TODO Remove hooks with type 'output' (exemple createFrom). All hooks must be converted into 'addreplace' hooks.
|
||||
if (!in_array($method, array(
|
||||
'createFrom',
|
||||
'dashboardMembers',
|
||||
'dashboardEmailings',
|
||||
'dashboardPropals',
|
||||
'dashboardPropals',
|
||||
'dashboardCommercials',
|
||||
'dashboardOrders',
|
||||
'dashboardSpecialBills',
|
||||
'dashboardAccountancy',
|
||||
'dashboardContracts',
|
||||
'dashboardDonation',
|
||||
'dashboardWarehouseSendings',
|
||||
'dashboardExpenseReport',
|
||||
'dashboardInterventions',
|
||||
'dashboardOrdersSuppliers',
|
||||
'dashboardHRM',
|
||||
'dashboardMRP',
|
||||
'dashboardOpensurvey',
|
||||
'dashboardWarehouse',
|
||||
'dashboardProductServices',
|
||||
'dashboardActivities',
|
||||
'dashboardProjects',
|
||||
'dashboardWarehouseReceptions',
|
||||
'dashboardThirdparties',
|
||||
'dashboardSupplierProposal',
|
||||
'dashboardTickets',
|
||||
'dashboardUsersGroups',
|
||||
'insertExtraHeader',
|
||||
'insertExtraFooter',
|
||||
'printLeftBlock',
|
||||
'formAddObjectLine',
|
||||
'formBuilddocOption',
|
||||
'showSocinfoOnPrint'
|
||||
))) {
|
||||
$hooktype = 'output';
|
||||
}
|
||||
|
||||
// Init return properties
|
||||
|
|
|
|||
|
|
@ -286,9 +286,10 @@ $hookmanager->initHooks(array('document'));
|
|||
$parameters = array('ecmfile' => $ecmfile, 'modulepart' => $modulepart, 'original_file' => $original_file,
|
||||
'entity' => $entity, 'refname' => $refname, 'fullpath_original_file' => $fullpath_original_file,
|
||||
'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) {
|
||||
$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);
|
||||
print "ErrorDownloadDocumentHooks: ".$errors;
|
||||
exit;
|
||||
|
|
|
|||
|
|
@ -2603,11 +2603,11 @@ function printDropdownQuickadd()
|
|||
$parameters = array();
|
||||
$hook_items = $items;
|
||||
$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) {
|
||||
$items['items'] = array_merge($items['items'], $hookmanager->results); // add
|
||||
$items['items'] = array_merge($items['items'], $hookmanager->resArray); // add
|
||||
} else {
|
||||
$items = $hookmanager->results; // replace
|
||||
$items = $hookmanager->resArray; // replace
|
||||
}
|
||||
|
||||
// Sort menu items by 'position' value
|
||||
|
|
|
|||
|
|
@ -249,11 +249,12 @@ if ($resql) {
|
|||
|
||||
print '</div></div>';
|
||||
|
||||
$object = new stdClass();
|
||||
$parameters = array(
|
||||
//'type' => $type,
|
||||
'user' => $user,
|
||||
);
|
||||
$reshook = $hookmanager->executeHooks('dashboardMRP', $parameters);
|
||||
$reshook = $hookmanager->executeHooks('dashboardMRP', $parameters, $object);
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
|
|
|
|||
|
|
@ -919,7 +919,7 @@ class ProductAttribute extends CommonObject
|
|||
$parameters = array('rowid' => $rowid, 'position' => $position);
|
||||
$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); ?>">
|
||||
<?php
|
||||
if (is_object($hookmanager)) {
|
||||
$parameters = array('line'=>$line);
|
||||
$parameters = array('line' => $line);
|
||||
$reshook = $hookmanager->executeHooks('formEditProductOptions', $parameters, $object, $action);
|
||||
if (!empty($hookmanager->resPrint)) {
|
||||
print $hookmanager->resPrint;
|
||||
|
|
|
|||
|
|
@ -430,7 +430,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||
|
||||
$parameters = array();
|
||||
$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))
|
||||
$object->formAddObjectLine(1, $mysoc, $soc);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user