<?php

		global $conf,$user,$langs,$mysoc, $hookmanager;

        if (empty($conf->global->DOLITOOLS_USE_UPDATELINES)) return;

        if ($object->statut > 0) return;

        if (! in_array('propalcard',$hookmanager->contextarray) && ! in_array('ordercard',$hookmanager->contextarray) && ! in_array('invoicecard',$hookmanager->contextarray)) return;

		$langs->load('updatelines@dolitools');

		if (is_array($parameters) && ! empty($parameters))
		{
			foreach($parameters as $key=>$value)
			{
				$$key=$value;
			}
		}

		$element = $object->element;

		// TODO uniformiser
		if ($element == 'propal') $element = 'propale';

		/*
		 *  Refresh Prices on propal line
		 */
		if (($action == 'updatelines' || (!empty($conf->global->ALLOW_VAT_UPDATE) && $action == 'updatevat'))  && (($user->rights->dolitools->updatelines->propale && $user->rights->$element->creer && $element == 'propale') || ($user->rights->dolitools->updatelines->order && $user->rights->$element->creer && $element == 'commande') || ($user->rights->dolitools->updatelines->invoice && $user->rights->$element->creer && $element == 'facture')))
		{
			include_once __DIR__ . '/../../lib/updatelines.lib.php';
			return updatelines($object, $action);
		}
