Fix: make fix on predefined invoice feature.
This commit is contained in:
parent
930b400458
commit
892a8c1ce4
@ -483,7 +483,7 @@ if ($_REQUEST['action'] == 'confirm_converttoreduc' && $_REQUEST['confirm'] == '
|
||||
|
||||
|
||||
/*
|
||||
* Insert invoice
|
||||
* Insert new invoice in database
|
||||
*/
|
||||
if ($_POST['action'] == 'add' && $user->rights->facture->creer)
|
||||
{
|
||||
@ -533,7 +533,7 @@ if ($_POST['action'] == 'add' && $user->rights->facture->creer)
|
||||
}
|
||||
}
|
||||
|
||||
// Facture avoir
|
||||
// Credit note invoice
|
||||
if ($_POST['type'] == 2)
|
||||
{
|
||||
if (! $_POST['fac_avoir'] > 0)
|
||||
@ -1453,7 +1453,7 @@ if ($_GET['action'] == 'create')
|
||||
{
|
||||
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)
|
||||
@ -1463,12 +1463,15 @@ if ($_GET['action'] == 'create')
|
||||
|
||||
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>';
|
||||
|
||||
@ -327,6 +327,7 @@ class FactureRec extends Facture
|
||||
$this->lignes[$i] = $faclig;
|
||||
$i++;
|
||||
}
|
||||
|
||||
$this->db->free($result);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -543,11 +543,11 @@ else
|
||||
{
|
||||
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<EFBFBD>e</a></td>';
|
||||
print '<td align="center"><a href="facture.php?filtre=paye:0,fk_statut:1">'.$langs->trans("Validated").'</a></td>';
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@ -158,7 +158,7 @@ class Facture extends CommonObject
|
||||
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;
|
||||
@ -277,7 +277,7 @@ class Facture extends CommonObject
|
||||
}
|
||||
|
||||
/*
|
||||
* Produits de la facture récurrente
|
||||
* Insert lines of predefined invoices
|
||||
*/
|
||||
if (! $error && $this->fac_rec > 0)
|
||||
{
|
||||
@ -298,8 +298,8 @@ class Facture extends CommonObject
|
||||
$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)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user