<?php

		global $conf,$user,$langs,$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 VAT
		 */
		if (!empty($conf->global->ALLOW_VAT_UPDATE) && $action != 'editline' && $action != 'statut' && count($object->lines) > 0 &&
		(($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' && $object->statut < 1)))
		{
			// add button
			print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=updatevat">'.$langs->trans('Update VAT').'</a>';
		}

		/*
		 *  Refresh Prices on propal line
		 */
		if ($action != 'editline' && $action != 'statut' && count($object->lines) > 0 &&
		(($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')))
		{
			// add button
			print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=updatelines">'.$langs->trans('UpdateLines').'</a>';
		}
