diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index a7a07f35d7c..5663f428f9c 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -508,6 +508,7 @@ if ($_POST['action'] == 'add' && $user->rights->facture->creer)
$db->begin();
+
// Replacement invoice
if ($_POST['type'] == 1)
{
@@ -606,8 +607,8 @@ if ($_POST['action'] == 'add' && $user->rights->facture->creer)
}
}
- // Standard invoice created from a predefined invoice
- if ($_POST['type'] == 0 && $_POST['fac_rec'] > 0)
+ // 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))
@@ -627,9 +628,8 @@ if ($_POST['action'] == 'add' && $user->rights->facture->creer)
$facture->ref_client = $_POST['ref_client'];
$facture->modelpdf = $_POST['model'];
- // Proprietes particulieres a facture recurrente
+ // Source facture
$facture->fac_rec = $_POST['fac_rec'];
- $facture->type = 0;
$facid = $facture->create($user);
}
diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php
index 8ce412a5dd2..57c099c8016 100644
--- a/htdocs/compta/facture/fiche-rec.php
+++ b/htdocs/compta/facture/fiche-rec.php
@@ -57,7 +57,8 @@ $sortfield="f.datef";
* Actions
*/
-// Ajout
+
+// Create predefined invoice
if ($_POST["action"] == 'add')
{
$facturerec = new FactureRec($db, $facid);
@@ -341,16 +342,16 @@ else
$author = new User($db);
$author->fetch($fac->user_author);
- print_titre($langs->trans("PredefinedInvoices").': '.$fac->titre);
- print '
';
- /*
- * Facture
- */
+ dol_fiche_head($head, 'compta', $langs->trans("PredefinedInvoices"),0,'company'); // Add a div
+
print '
| '.$langs->trans("Ref").' | '; + print ''.$fac->titre.' | '; + print '|||
| '.$langs->trans("Customer").' | '; print ''.$soc->getNomUrl(1).' | '; - print "". $langs->trans("PaymentConditions") ." : "; $html->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$fac->id,$fac->cond_reglement_id,'none'); print " | ||
| '.$langs->trans("Note").' : '.nl2br($fac->note)." | ||||