When defining repeatable invoices, the payment mode wasn't stored in the
database, so nobody could create an invoice based on this "predefined invoice" later on.
This commit is contained in:
parent
6ec1e9d298
commit
40c33d355a
@ -96,10 +96,11 @@ class FactureRec extends Facture
|
||||
// On positionne en mode brouillon la facture
|
||||
$this->brouillon = 1;
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."facture_rec (titre, fk_soc, datec, amount, remise, remise_percent, note, fk_user_author,fk_projet, fk_cond_reglement) ";
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."facture_rec (titre, fk_soc, datec, amount, remise, remise_percent, note, fk_user_author,fk_projet, fk_cond_reglement, fk_mode_reglement) ";
|
||||
$sql.= " VALUES ('$this->titre', '$facsrc->socid', now(), '$facsrc->amount', '$facsrc->remise', '$facsrc->remise_percent', '".addslashes($this->note)."','$user->id',";
|
||||
$sql.= " ".($facsrc->projetid?"'".$facsrc->projetid."'":"null").", ";
|
||||
$sql.= " '".$facsrc->cond_reglement_id."')";
|
||||
$sql.= " '".$facsrc->cond_reglement_id."',";
|
||||
$sql.= " '".$facsrc->mode_reglement_id."')";
|
||||
if ( $this->db->query($sql) )
|
||||
{
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."facture_rec");
|
||||
@ -150,7 +151,7 @@ class FactureRec extends Facture
|
||||
function fetch($rowid, $societe_id=0)
|
||||
{
|
||||
|
||||
$sql = "SELECT f.fk_soc,f.titre,f.amount,f.tva,f.total,f.total_ttc,f.remise,f.remise_percent,f.fk_projet, c.rowid as crid, c.libelle, c.libelle_facture, f.note, f.fk_user_author";
|
||||
$sql = "SELECT f.fk_soc,f.titre,f.amount,f.tva,f.total,f.total_ttc,f.remise,f.remise_percent,f.fk_projet, c.rowid as crid, c.libelle, c.libelle_facture, f.note, f.fk_user_author, f.fk_mode_reglement";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture_rec as f, ".MAIN_DB_PREFIX."cond_reglement as c";
|
||||
$sql .= " WHERE f.rowid=$rowid AND c.rowid = f.fk_cond_reglement";
|
||||
|
||||
@ -178,6 +179,7 @@ class FactureRec extends Facture
|
||||
$this->socid = $obj->fk_soc;
|
||||
$this->statut = $obj->fk_statut;
|
||||
$this->date_lim_reglement = $obj->dlr;
|
||||
$this->mode_reglement_id = $obj->fk_mode_reglement;
|
||||
$this->cond_reglement_id = $obj->crid;
|
||||
$this->cond_reglement = $obj->libelle;
|
||||
$this->cond_reglement_facture = $obj->libelle_facture;
|
||||
|
||||
@ -135,13 +135,16 @@ if ($_GET["action"] == 'create')
|
||||
print '<textarea name="note" wrap="soft" cols="60" rows="8"></textarea></td></tr>';
|
||||
|
||||
print "<tr><td>".$langs->trans("Author")." :</td><td>".$user->fullname."</td></tr>";
|
||||
print "<tr><td>Conditions de réglement :</td><td>";
|
||||
|
||||
print $facture->cond_reglement;
|
||||
|
||||
print "<tr><td>".$langs->trans("PaymentConditions")." :</td><td>";
|
||||
$html->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$facture->id,$facture->cond_reglement_id,'none');
|
||||
print "</td></tr>";
|
||||
|
||||
print "<tr><td>Projet :</td><td>";
|
||||
print "<tr><td>".$langs->trans("PaymentMode")." :</td><td>";
|
||||
$html->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$facture->id,$facture->mode_reglement_id,'none');
|
||||
print "</td></tr>";
|
||||
|
||||
print "<tr><td>".$langs->trans("Project")." :</td><td>";
|
||||
if ($facture->projetid > 0)
|
||||
{
|
||||
$proj = new Project($db);
|
||||
@ -153,7 +156,11 @@ if ($_GET["action"] == 'create')
|
||||
|
||||
|
||||
print '<br>';
|
||||
print_titre('Services/Produits');
|
||||
if ($conf->service->enabled) {
|
||||
print_titre($langs->trans("ProductsAndServices"));
|
||||
} else {
|
||||
print_titre($langs->trans("Products"));
|
||||
}
|
||||
|
||||
/*
|
||||
* Lignes de factures
|
||||
@ -299,7 +306,9 @@ else
|
||||
print "<td colspan=\"3\">";
|
||||
print '<b><a href="../fiche.php?socid='.$soc->id.'">'.$soc->nom.'</a></b></td>';
|
||||
|
||||
print "<td>Conditions de réglement : " . $fac->cond_reglement ."</td></tr>";
|
||||
print "<td>". $langs->trans("PaymentConditions") ." : ";
|
||||
$html->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$fac->id,$fac->cond_reglement_id,'none');
|
||||
print "</td></tr>";
|
||||
|
||||
print "<tr><td>".$langs->trans("Author")."</td><td colspan=\"3\">$author->fullname</td>";
|
||||
|
||||
@ -312,6 +321,8 @@ else
|
||||
print '<td rowspan="4" valign="top">';
|
||||
}
|
||||
|
||||
print $langs->trans("PaymentMode") ." : ";
|
||||
$html->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$fac->id,$fac->mode_reglement_id,'none');
|
||||
print "</td></tr>";
|
||||
|
||||
print '<tr><td>'.$langs->trans("AmountHT").'</td>';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user