diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 0f459a286257e404c53cbf8e3704d4e37604a887..a19262144ebe50fd684927ab3cfe2cc8f41fa476 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1995,8 +1995,10 @@ if ($action == 'create') if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code; } - if(!empty($soc->id)) $absolute_discount = $soc->getAvailableDiscounts(); - + if (!empty($soc->id)) $absolute_discount = $soc->getAvailableDiscounts(); + $note_public = $object->getDefaultCreateValueFor('note_public', (is_object($objectsrc)?$objectsrc->note_public:null)); + $note_private = $object->getDefaultCreateValueFor('note_private', ((! empty($origin) && ! empty($originid) && is_object($objectsrc))?$objectsrc->note_private:null)); + if (! empty($conf->use_javascript_ajax)) { require_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; @@ -2077,13 +2079,19 @@ if ($action == 'create') } print '</tr>' . "\n"; - // Predefined invoices + // Overwrite value if creation of invoice is from a predefined invoice if (empty($origin) && empty($originid) && GETPOST('fac_rec','int') > 0) { $invoice_predefined = new FactureRec($db); $invoice_predefined->fetch(GETPOST('fac_rec','int')); $dateinvoice = $invoice_predefined->date_when; // To use next gen date by default later + if (empty($projectid)) $projectid = $invoice_predefined->fk_project; + $cond_reglement_id = $invoice_predefined->cond_reglement_id; + $mode_reglement_id = $invoice_predefined->mode_reglement_id; + $fk_account = $invoice_predefined->fk_account; + $note_public = $invoice_predefined->note_public; + $note_private = $invoice_predefined->note_private; $sql = 'SELECT r.rowid, r.titre, r.total_ttc'; $sql .= ' FROM ' . MAIN_DB_PREFIX . 'facture_rec as r'; @@ -2467,7 +2475,6 @@ if ($action == 'create') print '<tr>'; print '<td class="border" valign="top">' . $langs->trans('NotePublic') . '</td>'; print '<td valign="top" colspan="2">'; - $note_public = $object->getDefaultCreateValueFor('note_public', (is_object($objectsrc)?$objectsrc->note_public:null)); $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); print $doleditor->Create(1); @@ -2477,7 +2484,6 @@ if ($action == 'create') print '<tr>'; print '<td class="border" valign="top">' . $langs->trans('NotePrivate') . '</td>'; print '<td valign="top" colspan="2">'; - $note_private = $object->getDefaultCreateValueFor('note_private', ((! empty($origin) && ! empty($originid) && is_object($objectsrc))?$objectsrc->note_private:null)); $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); print $doleditor->Create(1); // print '<textarea name="note_private" wrap="soft" cols="70" rows="'.ROWS_3.'">'.$note_private.'.</textarea>