diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 4d3c194bce1..de1cba15e17 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -37,6 +37,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; +require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture-rec.class.php'; require_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/modules/facture/modules_facture.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/discount.class.php'; @@ -810,7 +811,7 @@ if (empty($reshook)) } // Standard invoice or Deposit invoice created from a Predefined invoice - if (($_POST['type'] == Facture::TYPE_STANDARD || $_POST['type'] == Facture::TYPE_DEPOSIT) && $_POST['fac_rec'] > 0) + if (($_POST['type'] == Facture::TYPE_STANDARD || $_POST['type'] == Facture::TYPE_DEPOSIT) && GETPOST('fac_rec') > 0) { $dateinvoice = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); if (empty($dateinvoice)) @@ -832,14 +833,14 @@ if (empty($reshook)) $object->modelpdf = $_POST['model']; // Source facture - $object->fac_rec = $_POST['fac_rec']; + $object->fac_rec = GETPOST('fac_rec'); $id = $object->create($user); } } // Standard or deposit or proforma invoice - if (($_POST['type'] == Facture::TYPE_STANDARD || $_POST['type'] == Facture::TYPE_DEPOSIT || $_POST['type'] == Facture::TYPE_PROFORMA || ($_POST['type'] == Facture::TYPE_SITUATION && empty($_POST['situations']))) && $_POST['fac_rec'] <= 0) + if (($_POST['type'] == Facture::TYPE_STANDARD || $_POST['type'] == Facture::TYPE_DEPOSIT || $_POST['type'] == Facture::TYPE_PROFORMA || ($_POST['type'] == Facture::TYPE_SITUATION && empty($_POST['situations']))) && GETPOST('fac_rec') <= 0) { if (GETPOST('socid', 'int') < 1) { @@ -1955,7 +1956,7 @@ if ($action == 'create') // Thirdparty print '