Fix: [ bug #1476 ] Invoice creation form loses invoice date when there

is a validation error
This commit is contained in:
Laurent Destailleur 2014-06-21 15:35:30 +02:00
parent 39eea995a4
commit 76532218c2
2 changed files with 15 additions and 19 deletions

View File

@ -3,6 +3,7 @@ English Dolibarr ChangeLog
--------------------------------------------------------------
***** ChangeLog for 3.5.4 compared to 3.5.3 *****
Fix: [ bug #1476 ] Invoice creation form loses invoice date when there is a validation error.
Fix: [ bug #1431 ] Reception and Send supplier order box has a weird top margin.
Fix: [ bug #1428 ] "Nothing" is shown in the middle of the screen in a supplier order.
Fix: The object deliverycompany was not used anymore and output of

View File

@ -676,8 +676,8 @@ else if ($action == 'add' && $user->rights->facture->creer)
// Replacement invoice
if ($_POST['type'] == 1)
{
$datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
if (empty($datefacture))
$dateinvoice = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
if (empty($dateinvoice))
{
$error++;
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")),'errors');
@ -695,7 +695,7 @@ else if ($action == 'add' && $user->rights->facture->creer)
$result=$object->fetch($_POST['fac_replacement']);
$object->fetch_thirdparty();
$object->date = $datefacture;
$object->date = $dateinvoice;
$object->note_public = trim($_POST['note_public']);
$object->note = trim($_POST['note']);
$object->ref_client = $_POST['ref_client'];
@ -725,8 +725,8 @@ else if ($action == 'add' && $user->rights->facture->creer)
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CorrectInvoice")),'errors');
}
$datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
if (empty($datefacture))
$dateinvoice = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
if (empty($dateinvoice))
{
$error++;
setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("Date")),'errors');
@ -734,14 +734,9 @@ else if ($action == 'add' && $user->rights->facture->creer)
if (! $error)
{
// Si facture avoir
$datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
//$result=$object->fetch($_POST['fac_avoir']);
$object->socid = GETPOST('socid','int');
$object->number = $_POST['facnumber'];
$object->date = $datefacture;
$object->date = $dateinvoice;
$object->note_public = trim($_POST['note_public']);
$object->note = trim($_POST['note']);
$object->ref_client = $_POST['ref_client'];
@ -777,8 +772,8 @@ else if ($action == 'add' && $user->rights->facture->creer)
// Standard invoice or Deposit invoice created from a Predefined invoice
if (($_POST['type'] == 0 || $_POST['type'] == 3) && $_POST['fac_rec'] > 0)
{
$datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
if (empty($datefacture))
$dateinvoice = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
if (empty($dateinvoice))
{
$error++;
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")),'errors');
@ -789,7 +784,7 @@ else if ($action == 'add' && $user->rights->facture->creer)
$object->socid = GETPOST('socid','int');
$object->type = $_POST['type'];
$object->number = $_POST['facnumber'];
$object->date = $datefacture;
$object->date = $dateinvoice;
$object->note_public = trim($_POST['note_public']);
$object->note_private = trim($_POST['note_private']);
$object->ref_client = $_POST['ref_client'];
@ -814,8 +809,8 @@ else if ($action == 'add' && $user->rights->facture->creer)
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Customer")),'errors');
}
$datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
if (empty($datefacture))
$dateinvoice = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
if (empty($dateinvoice))
{
$error++;
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")),'errors');
@ -827,7 +822,7 @@ else if ($action == 'add' && $user->rights->facture->creer)
$object->socid = GETPOST('socid','int');
$object->type = GETPOST('type');
$object->number = $_POST['facnumber'];
$object->date = $datefacture;
$object->date = $dateinvoice;
$object->note_public = trim($_POST['note_public']);
$object->note_private = trim($_POST['note_private']);
$object->ref_client = $_POST['ref_client'];
@ -2084,7 +2079,7 @@ if ($action == 'create')
$mode_reglement_id = (! empty($objectsrc->mode_reglement_id)?$objectsrc->mode_reglement_id:(! empty($soc->mode_reglement_id)?$soc->mode_reglement_id:0));
$remise_percent = (! empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(! empty($soc->remise_percent)?$soc->remise_percent:0));
$remise_absolue = (! empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(! empty($soc->remise_absolue)?$soc->remise_absolue:0));
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:'';
$dateinvoice = (empty($dateinvoice)?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$dateinvoice);
//Replicate extrafields
$objectsrc->fetch_optionals($originid);
@ -2097,7 +2092,7 @@ if ($action == 'create')
$mode_reglement_id = $soc->mode_reglement_id;
$remise_percent = $soc->remise_percent;
$remise_absolue = 0;
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:'';
$dateinvoice = (empty($dateinvoice)?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$dateinvoice);
}
$absolute_discount=$soc->getAvailableDiscounts();