| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <?php
- class ActionsDocumentFollower
- {
- /**
- * Overriding the doActions function : replacing the parent 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
- */
- function doActions($parameters, &$object, &$action, $hookmanager)
- {
- $error = 0; // Error counter
- $myvalue = 'test'; // A result value
- print_r($parameters);
- echo "action: " . $action;
- print_r($object);
- die;
- if (in_array('somecontext', explode(':', $parameters['context'])))
- {
- // do something only for the context 'somecontext'
- }
- if (! $error)
- {
- $this->results = array('myreturn' => $myvalue);
- $this->resprints = 'A text to show';
- return 0; // or return 1 to replace standard code
- }
- else
- {
- $this->errors[] = 'Error message';
- return -1;
- }
- }
- }
|