<?php
		global $conf, $langs, $user, $hookmanager;

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

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

		$element = $object->element;
		if ($element == 'propale') $element = 'propal';

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

		if ($object->statut == 0  && ($element == 'propal' || $element == 'commande' || $element == 'facture') && $user->rights->{$element}->creer)
		{

			if ($action == 'draftedit' || ( ! empty($conf->global->DOLITOOLS_DRAFT_ALWAYS_EDITABLE) && empty($action)) )
			{
				if ( ! include_once(__DIR__ . '/../../includes/draftedit.inc.php') ) return 0;

				exit; // very important
			}
		}
