NEW Add check to avoid invoice date in future
This commit is contained in:
parent
0c34543145
commit
e2598f5af3
@ -977,46 +977,49 @@ if (empty($reshook))
|
|||||||
if ($_POST['type'] == Facture::TYPE_REPLACEMENT)
|
if ($_POST['type'] == Facture::TYPE_REPLACEMENT)
|
||||||
{
|
{
|
||||||
$dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
$dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
||||||
if (empty($dateinvoice))
|
if (empty($dateinvoice)) {
|
||||||
{
|
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
||||||
$action = 'create';
|
$action = 'create';
|
||||||
|
} elseif ($dateinvoice > (dol_now() + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
||||||
|
$error++;
|
||||||
|
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
|
||||||
|
$action = 'create';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(GETPOST('fac_replacement', 'int') > 0)) {
|
if (!($_POST['fac_replacement'] > 0)) {
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ReplaceInvoice")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ReplaceInvoice")), null, 'errors');
|
||||||
$action = 'create';
|
$action = 'create';
|
||||||
}
|
}
|
||||||
|
|
||||||
$date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'));
|
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
// This is a replacement invoice
|
// This is a replacement invoice
|
||||||
$result = $object->fetch(GETPOST('fac_replacement', 'int'));
|
$result = $object->fetch($_POST['fac_replacement']);
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
|
|
||||||
$object->date = $dateinvoice;
|
$object->date = $dateinvoice;
|
||||||
$object->date_pointoftax = $date_pointoftax;
|
$object->date_pointoftax = $date_pointoftax;
|
||||||
$object->note_public = trim(GETPOST('note_public', 'restricthtml'));
|
$object->note_public = trim(GETPOST('note_public', 'restricthtml'));
|
||||||
// We do not copy the private note
|
// We do not copy the private note
|
||||||
$object->ref_client = GETPOST('ref_client');
|
$object->ref_client = $_POST['ref_client'];
|
||||||
//$object->ref_int = $_POST['ref_int'];
|
$object->ref_int = $_POST['ref_int'];
|
||||||
$object->model_pdf = GETPOST('model');
|
$object->model_pdf = $_POST['model'];
|
||||||
$object->fk_project = GETPOST('projectid', 'int');
|
$object->fk_project = $_POST['projectid'];
|
||||||
$object->cond_reglement_id = GETPOST('cond_reglement_id', 'int');
|
$object->cond_reglement_id = $_POST['cond_reglement_id'];
|
||||||
$object->mode_reglement_id = GETPOST('mode_reglement_id', 'int');
|
$object->mode_reglement_id = $_POST['mode_reglement_id'];
|
||||||
$object->fk_account = GETPOST('fk_account', 'int');
|
$object->fk_account = GETPOST('fk_account', 'int');
|
||||||
$object->remise_absolue = GETPOST('remise_absolue', 'alpha');
|
$object->remise_absolue = $_POST['remise_absolue'];
|
||||||
$object->remise_percent = GETPOST('remise_percent', 'alpha');
|
$object->remise_percent = $_POST['remise_percent'];
|
||||||
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
|
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
|
||||||
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
|
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
|
||||||
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
|
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
|
||||||
$object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int');
|
$object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int');
|
||||||
|
|
||||||
// Proprietes particulieres a facture de remplacement
|
// Proprietes particulieres a facture de remplacement
|
||||||
$object->fk_facture_source = GETPOST('fac_replacement', 'int');
|
$object->fk_facture_source = $_POST['fac_replacement'];
|
||||||
$object->type = Facture::TYPE_REPLACEMENT;
|
$object->type = Facture::TYPE_REPLACEMENT;
|
||||||
|
|
||||||
$id = $object->createFromCurrent($user);
|
$id = $object->createFromCurrent($user);
|
||||||
@ -1029,7 +1032,7 @@ if (empty($reshook))
|
|||||||
// Credit note invoice
|
// Credit note invoice
|
||||||
if (GETPOST('type') == Facture::TYPE_CREDIT_NOTE)
|
if (GETPOST('type') == Facture::TYPE_CREDIT_NOTE)
|
||||||
{
|
{
|
||||||
$sourceinvoice = GETPOST('fac_avoir');
|
$sourceinvoice = GETPOST('fac_avoir', 'int');
|
||||||
if (!($sourceinvoice > 0) && empty($conf->global->INVOICE_CREDIT_NOTE_STANDALONE))
|
if (!($sourceinvoice > 0) && empty($conf->global->INVOICE_CREDIT_NOTE_STANDALONE))
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
@ -1038,11 +1041,14 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
|
|
||||||
$dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
$dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
||||||
if (empty($dateinvoice))
|
if (empty($dateinvoice)) {
|
||||||
{
|
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
||||||
$action = 'create';
|
$action = 'create';
|
||||||
|
} elseif ($dateinvoice > (dol_now() + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
||||||
|
$error++;
|
||||||
|
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
|
||||||
|
$action = 'create';
|
||||||
}
|
}
|
||||||
|
|
||||||
$date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'));
|
$date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'));
|
||||||
@ -1255,11 +1261,14 @@ if (empty($reshook))
|
|||||||
if (($_POST['type'] == Facture::TYPE_STANDARD || $_POST['type'] == Facture::TYPE_DEPOSIT) && GETPOST('fac_rec', 'int') > 0)
|
if (($_POST['type'] == Facture::TYPE_STANDARD || $_POST['type'] == Facture::TYPE_DEPOSIT) && GETPOST('fac_rec', 'int') > 0)
|
||||||
{
|
{
|
||||||
$dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
$dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
||||||
if (empty($dateinvoice))
|
if (empty($dateinvoice)) {
|
||||||
{
|
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
||||||
$action = 'create';
|
$action = 'create';
|
||||||
|
} elseif ($dateinvoice > (dol_now() + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
||||||
|
$error++;
|
||||||
|
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
|
||||||
|
$action = 'create';
|
||||||
}
|
}
|
||||||
|
|
||||||
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
||||||
@ -1305,11 +1314,14 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
|
|
||||||
$dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
$dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
||||||
if (empty($dateinvoice))
|
if (empty($dateinvoice)) {
|
||||||
{
|
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
||||||
$action = 'create';
|
$action = 'create';
|
||||||
|
} elseif ($dateinvoice > (dol_now() + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
||||||
|
$error++;
|
||||||
|
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
|
||||||
|
$action = 'create';
|
||||||
}
|
}
|
||||||
|
|
||||||
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
||||||
@ -1725,16 +1737,20 @@ if (empty($reshook))
|
|||||||
// Situation invoices
|
// Situation invoices
|
||||||
if (GETPOST('type') == Facture::TYPE_SITUATION && (!empty($_POST['situations'])))
|
if (GETPOST('type') == Facture::TYPE_SITUATION && (!empty($_POST['situations'])))
|
||||||
{
|
{
|
||||||
$datefacture = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
$dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
||||||
if (empty($datefacture)) {
|
if (empty($dateinvoice)) {
|
||||||
$error++;
|
$error++;
|
||||||
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date"));
|
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date"));
|
||||||
setEventMessages($mesg, null, 'errors');
|
setEventMessages($mesg, null, 'errors');
|
||||||
|
} elseif ($dateinvoice > (dol_now() + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
||||||
|
$error++;
|
||||||
|
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
|
||||||
|
$action = 'create';
|
||||||
}
|
}
|
||||||
|
|
||||||
$date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'));
|
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
||||||
|
|
||||||
if (!(GETPOST('situations', 'int') > 0)) {
|
if (!($_POST['situations'] > 0)) {
|
||||||
$error++;
|
$error++;
|
||||||
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("InvoiceSituation"));
|
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("InvoiceSituation"));
|
||||||
setEventMessages($mesg, null, 'errors');
|
setEventMessages($mesg, null, 'errors');
|
||||||
@ -1742,8 +1758,8 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
$result = $object->fetch(GETPOST('situations', 'int'));
|
$result = $object->fetch($_POST['situations']);
|
||||||
$object->fk_facture_source = GETPOST('situations', 'int');
|
$object->fk_facture_source = $_POST['situations'];
|
||||||
$object->type = Facture::TYPE_SITUATION;
|
$object->type = Facture::TYPE_SITUATION;
|
||||||
|
|
||||||
if (!empty($origin) && !empty($originid))
|
if (!empty($origin) && !empty($originid))
|
||||||
@ -1811,7 +1827,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
|
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
$object->date = $datefacture;
|
$object->date = $dateinvoice;
|
||||||
$object->date_pointoftax = $date_pointoftax;
|
$object->date_pointoftax = $date_pointoftax;
|
||||||
$object->note_public = trim(GETPOST('note_public', 'restricthtml'));
|
$object->note_public = trim(GETPOST('note_public', 'restricthtml'));
|
||||||
$object->note = trim(GETPOST('note', 'restricthtml'));
|
$object->note = trim(GETPOST('note', 'restricthtml'));
|
||||||
@ -3347,11 +3363,11 @@ if ($action == 'create')
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$datefacture = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
$newdateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
||||||
|
|
||||||
// Date invoice
|
// Date invoice
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans('DateInvoice').'</td><td colspan="2">';
|
print '<tr><td class="fieldrequired">'.$langs->trans('DateInvoice').'</td><td colspan="2">';
|
||||||
print $form->selectDate($datefacture ? $datefacture : $dateinvoice, '', '', '', '', "add", 1, 1);
|
print $form->selectDate($newdateinvoice ? $newdateinvoice : $dateinvoice, '', '', '', '', "add", 1, 1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Date point of tax
|
// Date point of tax
|
||||||
@ -3509,7 +3525,7 @@ if ($action == 'create')
|
|||||||
$htmltext = '';
|
$htmltext = '';
|
||||||
if (GETPOST('fac_rec', 'int') > 0)
|
if (GETPOST('fac_rec', 'int') > 0)
|
||||||
{
|
{
|
||||||
$dateexample = ($datefacture ? $datefacture : $dateinvoice);
|
$dateexample = ($newdateinvoice ? $newdateinvoice : $dateinvoice);
|
||||||
if (empty($dateexample)) $dateexample = dol_now();
|
if (empty($dateexample)) $dateexample = dol_now();
|
||||||
$substitutionarray = array(
|
$substitutionarray = array(
|
||||||
'__TOTAL_HT__' => $langs->trans("AmountHT").' ('.$langs->trans("Example").': '.price($exampletemplateinvoice->total_ht).')',
|
'__TOTAL_HT__' => $langs->trans("AmountHT").' ('.$langs->trans("Example").': '.price($exampletemplateinvoice->total_ht).')',
|
||||||
|
|||||||
@ -655,19 +655,23 @@ if (empty($reshook))
|
|||||||
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
||||||
if ($ret < 0) $error++;
|
if ($ret < 0) $error++;
|
||||||
|
|
||||||
$datefacture = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
$dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
||||||
$datedue = dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear']);
|
$datedue = dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear']);
|
||||||
|
|
||||||
// Replacement invoice
|
// Replacement invoice
|
||||||
if ($_POST['type'] == FactureFournisseur::TYPE_REPLACEMENT)
|
if ($_POST['type'] == FactureFournisseur::TYPE_REPLACEMENT)
|
||||||
{
|
{
|
||||||
if ($datefacture == '')
|
if (empty($dateinvoice)) {
|
||||||
{
|
|
||||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('DateInvoice')), null, 'errors');
|
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('DateInvoice')), null, 'errors');
|
||||||
$action = 'create';
|
$action = 'create';
|
||||||
$_GET['socid'] = $_POST['socid'];
|
$_GET['socid'] = $_POST['socid'];
|
||||||
$error++;
|
$error++;
|
||||||
|
} elseif ($dateinvoice > (dol_now() + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
||||||
|
$error++;
|
||||||
|
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
|
||||||
|
$action = 'create';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(GETPOST('fac_replacement', 'int') > 0)) {
|
if (!(GETPOST('fac_replacement', 'int') > 0)) {
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ReplaceInvoice")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ReplaceInvoice")), null, 'errors');
|
||||||
@ -682,7 +686,7 @@ if (empty($reshook))
|
|||||||
$object->ref_supplier = GETPOST('ref_supplier', 'alpha');
|
$object->ref_supplier = GETPOST('ref_supplier', 'alpha');
|
||||||
$object->socid = GETPOST('socid', 'int');
|
$object->socid = GETPOST('socid', 'int');
|
||||||
$object->libelle = GETPOST('label', 'nohtml');
|
$object->libelle = GETPOST('label', 'nohtml');
|
||||||
$object->date = $datefacture;
|
$object->date = $dateinvoice;
|
||||||
$object->date_echeance = $datedue;
|
$object->date_echeance = $datedue;
|
||||||
$object->note_public = GETPOST('note_public', 'restricthtml');
|
$object->note_public = GETPOST('note_public', 'restricthtml');
|
||||||
$object->note_private = GETPOST('note_private', 'restricthtml');
|
$object->note_private = GETPOST('note_private', 'restricthtml');
|
||||||
@ -723,13 +727,18 @@ if (empty($reshook))
|
|||||||
$action = 'create';
|
$action = 'create';
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
if ($datefacture == '')
|
|
||||||
{
|
if (empty($dateinvoice)) {
|
||||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('DateInvoice')), null, 'errors');
|
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('DateInvoice')), null, 'errors');
|
||||||
$action = 'create';
|
$action = 'create';
|
||||||
$_GET['socid'] = $_POST['socid'];
|
$_GET['socid'] = $_POST['socid'];
|
||||||
$error++;
|
$error++;
|
||||||
|
} elseif ($dateinvoice > (dol_now() + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
||||||
|
$error++;
|
||||||
|
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
|
||||||
|
$action = 'create';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!GETPOST('ref_supplier'))
|
if (!GETPOST('ref_supplier'))
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('RefSupplier')), null, 'errors');
|
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('RefSupplier')), null, 'errors');
|
||||||
@ -748,7 +757,7 @@ if (empty($reshook))
|
|||||||
$object->socid = GETPOST('socid', 'int');
|
$object->socid = GETPOST('socid', 'int');
|
||||||
$object->libelle = GETPOST('label', 'nohtml');
|
$object->libelle = GETPOST('label', 'nohtml');
|
||||||
$object->label = GETPOST('label', 'nohtml');
|
$object->label = GETPOST('label', 'nohtml');
|
||||||
$object->date = $datefacture;
|
$object->date = $dateinvoice;
|
||||||
$object->date_echeance = $datedue;
|
$object->date_echeance = $datedue;
|
||||||
$object->note_public = GETPOST('note_public', 'restricthtml');
|
$object->note_public = GETPOST('note_public', 'restricthtml');
|
||||||
$object->note_private = GETPOST('note_private', 'restricthtml');
|
$object->note_private = GETPOST('note_private', 'restricthtml');
|
||||||
@ -837,13 +846,17 @@ if (empty($reshook))
|
|||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($datefacture == '')
|
if (empty($dateinvoice)) {
|
||||||
{
|
|
||||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('DateInvoice')), null, 'errors');
|
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('DateInvoice')), null, 'errors');
|
||||||
$action = 'create';
|
$action = 'create';
|
||||||
$_GET['socid'] = $_POST['socid'];
|
$_GET['socid'] = $_POST['socid'];
|
||||||
$error++;
|
$error++;
|
||||||
|
} elseif ($dateinvoice > (dol_now() + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
||||||
|
$error++;
|
||||||
|
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
|
||||||
|
$action = 'create';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!GETPOST('ref_supplier'))
|
if (!GETPOST('ref_supplier'))
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('RefSupplier')), null, 'errors');
|
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('RefSupplier')), null, 'errors');
|
||||||
@ -861,7 +874,7 @@ if (empty($reshook))
|
|||||||
$object->ref_supplier = $_POST['ref_supplier'];
|
$object->ref_supplier = $_POST['ref_supplier'];
|
||||||
$object->socid = $_POST['socid'];
|
$object->socid = $_POST['socid'];
|
||||||
$object->libelle = $_POST['label'];
|
$object->libelle = $_POST['label'];
|
||||||
$object->date = $datefacture;
|
$object->date = $dateinvoice;
|
||||||
$object->date_echeance = $datedue;
|
$object->date_echeance = $datedue;
|
||||||
$object->note_public = GETPOST('note_public', 'restricthtml');
|
$object->note_public = GETPOST('note_public', 'restricthtml');
|
||||||
$object->note_private = GETPOST('note_private', 'restricthtml');
|
$object->note_private = GETPOST('note_private', 'restricthtml');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user