2
0
forked from Wavyzz/dolibarr

delete unused code (fix phpstan also) (#26780)

This commit is contained in:
Frédéric FRANCE
2023-11-21 23:40:43 +01:00
committed by GitHub
parent 8a19e2f251
commit b8a4181748

View File

@@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseom.com>
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2023 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -157,66 +157,6 @@ class ActionsDatapolicy extends CommonHookActions
}
}
/**
* Overloading the doMassActions function : replacing the parent's function with the one below
*
* @param array $parameters Hook metadatas (context, etc...)
* @param CommonObject $object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...)
* @param string $action Current action (if set). Generally create or edit or null
* @param HookManager $hookmanager Hook manager propagated to allow calling another hook
* @return int < 0 on error, 0 on success, 1 to replace standard code
*/
public function doMassActions($parameters, &$object, &$action, $hookmanager)
{
$error = 0; // Error counter
/* print_r($parameters); print_r($object); echo "action: " . $action; */
//if (in_array($parameters['currentcontext'], array('somecontext1', 'somecontext2'))) {
// // do something only for the context 'somecontext1' or 'somecontext2'
// foreach ($parameters['toselect'] as $objectid) {
// // Do action on each object id
// }
//}
if (!$error) {
$this->results = array('myreturn' => 999);
$this->resprints = 'A text to show';
return 0; // or return 1 to replace standard code
} else {
$this->errors[] = 'Error message';
return -1;
}
}
/**
* Overloading the addMoreMassActions function : replacing the parent's function with the one below
*
* @param array $parameters Hook metadatas (context, etc...)
* @param CommonObject $object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...)
* @param string $action Current action (if set). Generally create or edit or null
* @param HookManager $hookmanager Hook manager propagated to allow calling another hook
* @return int < 0 on error, 0 on success, 1 to replace standard code
*/
public function addMoreMassActions($parameters, &$object, &$action, $hookmanager)
{
global $langs;
$error = 0; // Error counter
/* print_r($parameters); print_r($object); echo "action: " . $action; */
if (in_array($parameters['currentcontext'], array('somecontext1', 'somecontext2'))) { // do something only for the context 'somecontext1' or 'somecontext2'
$this->resprints = '<option value="0"'.(!empty($disabled) ? ' disabled="disabled"' : '').'>'.$langs->trans("datapolicyMassAction").'</option>';
}
if (!$error) {
return 0; // or return 1 to replace standard code
} else {
$this->errors[] = 'Error message';
return -1;
}
}
/**
* addMoreActionsButtons
*