FIX Must not be able to edit vat of all lines if not draft

This commit is contained in:
Laurent Destailleur 2021-02-02 16:12:03 +01:00
parent bd9eb4c949
commit c5201b95bb
5 changed files with 12 additions and 1 deletions

View File

@ -615,7 +615,7 @@ if (empty($reshook))
$result = $object->set_remise($user, GETPOST('remise_percent'));
} elseif ($action == 'setremiseabsolue' && $usercancreate) {
$result = $object->set_remise_absolue($user, GETPOST('remise_absolue'));
} elseif ($action == 'addline' && GETPOST('submitforalllines', 'aZ09') && GETPOST('vatforalllines', 'alpha')) {
} elseif ($action == 'addline' && GETPOST('submitforalllines', 'alpha') && GETPOST('vatforalllines', 'alpha')) {
// Define vat_rate
$vat_rate = (GETPOST('vatforalllines') ? GETPOST('vatforalllines') : 0);
$vat_rate = str_replace('*', '', $vat_rate);

View File

@ -1824,6 +1824,8 @@ class Commande extends CommonOrder
$this->project = null; // Clear if another value was already set by fetch_projet
$this->statut = $obj->fk_statut;
$this->status = $obj->fk_statut;
$this->user_author_id = $obj->fk_user_author;
$this->user_valid = $obj->fk_user_valid;
$this->total_ht = $obj->total_ht;

View File

@ -1594,6 +1594,8 @@ class Facture extends CommonInvoice
$this->project = null; // Clear if another value was already set by fetch_projet
$this->statut = $obj->fk_statut;
$this->status = $obj->fk_statut;
$this->date_lim_reglement = $this->db->jdate($obj->dlr);
$this->mode_reglement_id = $obj->fk_mode_reglement;
$this->mode_reglement_code = $obj->mode_reglement_code;

View File

@ -221,6 +221,12 @@ abstract class CommonObject
*/
public $statut;
/**
* @var int The object's status
* @see setStatut()
*/
public $status;
/**
* @var string
* @see getFullAddress()

View File

@ -65,6 +65,7 @@ if (!empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) || !empty($conf->global->FA
} else {
print $langs->trans('VAT');
}
if (in_array($object->element, array('propal', 'commande', 'facture')) && $object->status == $object::STATUS_DRAFT)
{
global $mysoc;