From 6e06c82bb439e80de433a0eaba40f6a04587e785 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 7 May 2010 18:36:54 +0000 Subject: [PATCH] Fix: Can create a deposit invoice from a predefined invoice --- htdocs/compta/facture.php | 8 ++++---- htdocs/compta/facture/fiche-rec.php | 27 ++++++++++++++------------- 2 files changed, 18 insertions(+), 17 deletions(-) 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 ''; + + print ''; + print ''; + print ''; print ''; - print ""; @@ -383,7 +384,9 @@ else print '"; } - print "
'.$langs->trans("Ref").''.$fac->titre.'
'.$langs->trans("Customer").''.$soc->getNomUrl(1).'". $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)."

"; + print ""; + + print ''; /* * Lines @@ -494,9 +497,7 @@ else $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_rec as f"; $sql.= " WHERE f.fk_soc = s.rowid"; $sql.= " AND s.entity = ".$conf->entity; - - if ($socid) - $sql .= " AND s.rowid = ".$socid; + if ($socid) $sql .= " AND s.rowid = ".$socid; //$sql .= " ORDER BY $sortfield $sortorder, rowid DESC "; // $sql .= $db->plimit($limit + 1,$offset); @@ -537,11 +538,11 @@ else { if ($objp->fk_statut == 0) { - print ''.$langs->trans("Draft").''; + print ''.$langs->trans("Draft").''; } else { - print ''.$langs->trans("Validated").''; + print ''.$langs->trans("Validated").''; } } else