From 205c0ac62dfc3a436f643fe3dc4cecf20e3f6800 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 29 Mar 2014 05:18:24 +0100 Subject: [PATCH] Fix: invert logic. Show child options when parent option is selected instead of selected parent when a child is selected. --- htdocs/compta/facture.php | 46 ++++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 831eb3f52ad..e11d47face0 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -677,13 +677,14 @@ else if ($action == 'add' && $user->rights->facture->creer) $id = $object->create($user); - if(GETPOST('invoiceAvoirWithLines', 'int')==1 && $id>0) { - + if (GETPOST('invoiceAvoirWithLines', 'int')==1 && $id>0) + { $facture_source = new Facture($db); // fetch origin object - if($facture_source->fetch($object->fk_facture_source)>0) { - - foreach($facture_source->lines as $line) { + if ($facture_source->fetch($object->fk_facture_source)>0) + { + foreach($facture_source->lines as $line) + { $line->fk_facture = $object->id; $line->subprice =-$line->subprice; // invert price for object @@ -733,14 +734,16 @@ 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) { + 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)) { $error ++; setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), 'errors'); } - if (! $error) { + if (! $error) + { $object->socid = GETPOST('socid', 'int'); $object->type = $_POST['type']; $object->number = $_POST['facnumber']; @@ -759,8 +762,10 @@ else if ($action == 'add' && $user->rights->facture->creer) } // Standard or deposit or proforma invoice - if (($_POST['type'] == 0 || $_POST['type'] == 3 || $_POST['type'] == 4) && $_POST['fac_rec'] <= 0) { - if (GETPOST('socid', 'int') < 1) { + if (($_POST['type'] == 0 || $_POST['type'] == 3 || $_POST['type'] == 4) && $_POST['fac_rec'] <= 0) + { + if (GETPOST('socid', 'int') < 1) + { $error ++; setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Customer")), 'errors'); } @@ -771,7 +776,8 @@ else if ($action == 'add' && $user->rights->facture->creer) setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), 'errors'); } - if (! $error) { + if (! $error) + { // Si facture standard $object->socid = GETPOST('socid', 'int'); $object->type = GETPOST('type'); @@ -2014,7 +2020,7 @@ if ($action == 'create') // Standard invoice print ''; - print ''; + print ''; print ''; $desc = $form->textwithpicto($langs->trans("InvoiceStandardAsk"), $langs->transnoentities("InvoiceStandardDesc"), 1); print $desc; @@ -2101,10 +2107,18 @@ if ($action == 'create') print ' disabled="disabled"'; print '>'; print ''; + // Show credit note options only if we checked credit note print ''; @@ -2124,9 +2138,11 @@ if ($action == 'create') $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1); print $desc; + print '
'; print '    0 ? 'checked="checked"':'').' /> "; - print '
    0 ? 'checked="checked"':'').' /> "; - + print '
    0 ? 'checked="checked"':'').' /> "; + print '
'; + print '' . "\n"; } else