Skip to content

Commit

Permalink
Fix: make fix on predefined invoice feature.
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed May 27, 2009
1 parent 930b400 commit 892a8c1
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
13 changes: 8 additions & 5 deletions htdocs/compta/facture.php
Expand Up @@ -483,7 +483,7 @@


/*
* Insert invoice
* Insert new invoice in database
*/
if ($_POST['action'] == 'add' && $user->rights->facture->creer)
{
Expand Down Expand Up @@ -533,7 +533,7 @@
}
}

// Facture avoir
// Credit note invoice
if ($_POST['type'] == 2)
{
if (! $_POST['fac_avoir'] > 0)
Expand Down Expand Up @@ -1453,7 +1453,7 @@
{
if ($_GET['propalid'] == 0 && $_GET['commandeid'] == 0 && $_GET['contratid'] == 0)
{
$sql = 'SELECT r.rowid, r.titre, r.amount FROM '.MAIN_DB_PREFIX.'facture_rec as r';
$sql = 'SELECT r.rowid, r.titre, r.total_ttc FROM '.MAIN_DB_PREFIX.'facture_rec as r';
$sql.= ' WHERE r.fk_soc = '.$soc->id;
$resql=$db->query($sql);
if ($resql)
Expand All @@ -1463,12 +1463,15 @@

if ($num > 0)
{
print '<tr><td>'.$langs->trans('CreateFromRepeatableInvoice').'</td><td><select class="flat" name="fac_rec">';
print '<tr><td>'.$langs->trans('CreateFromRepeatableInvoice').'</td><td>';
print '<select class="flat" name="fac_rec">';
print '<option value="0" selected="true"></option>';
while ($i < $num)
{
$objp = $db->fetch_object($resql);
print '<option value="'.$objp->rowid.'">'.$objp->titre.' : '.$objp->amount.'</option>';
print '<option value="'.$objp->rowid.'"';
if ($_POST["fac_rec"] == $objp->rowid) print ' selected="true"';
print '>'.$objp->titre.' ('.$objp->total_ttc.' '.$langs->trans("TTC").')</option>';
$i++;
}
print '</select></td></tr>';
Expand Down
1 change: 1 addition & 0 deletions htdocs/compta/facture/facture-rec.class.php
Expand Up @@ -327,6 +327,7 @@ function fetch_lines()
$this->lignes[$i] = $faclig;
$i++;
}

$this->db->free($result);
return 1;
}
Expand Down
4 changes: 2 additions & 2 deletions htdocs/compta/facture/fiche-rec.php
Expand Up @@ -543,11 +543,11 @@
{
if ($objp->fk_statut == 0)
{
print '<td align="center">brouillon</td>';
print '<td align="center">'.$langs->trans("Draft").'</td>';
}
else
{
print '<td align="center"><a href="facture.php?filtre=paye:0,fk_statut:1">impay�e</a></td>';
print '<td align="center"><a href="facture.php?filtre=paye:0,fk_statut:1">'.$langs->trans("Validated").'</a></td>';
}
}
else
Expand Down
8 changes: 4 additions & 4 deletions htdocs/facture.class.php
Expand Up @@ -158,7 +158,7 @@ function create($user,$notrigger=0)
if ($this->fac_rec > 0)
{
require_once(DOL_DOCUMENT_ROOT.'/compta/facture/facture-rec.class.php');
$_facrec = new FactureRec($this->db, $this->fac_rec);
$_facrec = new FactureRec($this->db);
$result=$_facrec->fetch($this->fac_rec);

$this->projetid = $_facrec->projetid;
Expand Down Expand Up @@ -277,7 +277,7 @@ function create($user,$notrigger=0)
}

/*
* Produits de la facture récurrente
* Insert lines of predefined invoices
*/
if (! $error && $this->fac_rec > 0)
{
Expand All @@ -298,8 +298,8 @@ function create($user,$notrigger=0)
$tva_tx,
$_facrec->lignes[$i]->produit_id,
$_facrec->lignes[$i]->remise_percent,
'','',0,0,'','HT',
$_facref->lignes[$i]->product_type
'','',0,0,'','HT',0,
$_facrec->lignes[$i]->product_type
);

if ( $result_insert < 0)
Expand Down

0 comments on commit 892a8c1

Please sign in to comment.