Fix: Can create a deposit invoice from a predefined invoice
This commit is contained in:
parent
61811dc5be
commit
6e06c82bb4
@ -508,6 +508,7 @@ if ($_POST['action'] == 'add' && $user->rights->facture->creer)
|
|||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
|
|
||||||
// Replacement invoice
|
// Replacement invoice
|
||||||
if ($_POST['type'] == 1)
|
if ($_POST['type'] == 1)
|
||||||
{
|
{
|
||||||
@ -606,8 +607,8 @@ if ($_POST['action'] == 'add' && $user->rights->facture->creer)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Standard invoice created from a predefined invoice
|
// Standard invoice or Deposit invoice created from a predefined invoice
|
||||||
if ($_POST['type'] == 0 && $_POST['fac_rec'] > 0)
|
if (($_POST['type'] == 0 || $_POST['type'] == 3) && $_POST['fac_rec'] > 0)
|
||||||
{
|
{
|
||||||
$datefacture = dol_mktime(12, 0 , 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
$datefacture = dol_mktime(12, 0 , 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
||||||
if (empty($datefacture))
|
if (empty($datefacture))
|
||||||
@ -627,9 +628,8 @@ if ($_POST['action'] == 'add' && $user->rights->facture->creer)
|
|||||||
$facture->ref_client = $_POST['ref_client'];
|
$facture->ref_client = $_POST['ref_client'];
|
||||||
$facture->modelpdf = $_POST['model'];
|
$facture->modelpdf = $_POST['model'];
|
||||||
|
|
||||||
// Proprietes particulieres a facture recurrente
|
// Source facture
|
||||||
$facture->fac_rec = $_POST['fac_rec'];
|
$facture->fac_rec = $_POST['fac_rec'];
|
||||||
$facture->type = 0;
|
|
||||||
|
|
||||||
$facid = $facture->create($user);
|
$facid = $facture->create($user);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -57,7 +57,8 @@ $sortfield="f.datef";
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Ajout
|
|
||||||
|
// Create predefined invoice
|
||||||
if ($_POST["action"] == 'add')
|
if ($_POST["action"] == 'add')
|
||||||
{
|
{
|
||||||
$facturerec = new FactureRec($db, $facid);
|
$facturerec = new FactureRec($db, $facid);
|
||||||
@ -341,16 +342,16 @@ else
|
|||||||
$author = new User($db);
|
$author = new User($db);
|
||||||
$author->fetch($fac->user_author);
|
$author->fetch($fac->user_author);
|
||||||
|
|
||||||
print_titre($langs->trans("PredefinedInvoices").': '.$fac->titre);
|
|
||||||
print '<br>';
|
|
||||||
|
|
||||||
/*
|
dol_fiche_head($head, 'compta', $langs->trans("PredefinedInvoices"),0,'company'); // Add a div
|
||||||
* Facture
|
|
||||||
*/
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
|
print '<tr><td>'.$langs->trans("Ref").'</td>';
|
||||||
|
print '<td colspan="4">'.$fac->titre.'</td>';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("Customer").'</td>';
|
print '<tr><td>'.$langs->trans("Customer").'</td>';
|
||||||
print '<td colspan="3">'.$soc->getNomUrl(1).'</td>';
|
print '<td colspan="3">'.$soc->getNomUrl(1).'</td>';
|
||||||
|
|
||||||
print "<td>". $langs->trans("PaymentConditions") ." : ";
|
print "<td>". $langs->trans("PaymentConditions") ." : ";
|
||||||
$html->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$fac->id,$fac->cond_reglement_id,'none');
|
$html->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$fac->id,$fac->cond_reglement_id,'none');
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
@ -383,7 +384,9 @@ else
|
|||||||
print '<tr><td colspan="5">'.$langs->trans("Note").' : '.nl2br($fac->note)."</td></tr>";
|
print '<tr><td colspan="5">'.$langs->trans("Note").' : '.nl2br($fac->note)."</td></tr>";
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</table><br>";
|
print "</table>";
|
||||||
|
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Lines
|
* Lines
|
||||||
@ -494,9 +497,7 @@ else
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_rec as f";
|
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_rec as f";
|
||||||
$sql.= " WHERE f.fk_soc = s.rowid";
|
$sql.= " WHERE f.fk_soc = s.rowid";
|
||||||
$sql.= " AND s.entity = ".$conf->entity;
|
$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 .= " ORDER BY $sortfield $sortorder, rowid DESC ";
|
||||||
// $sql .= $db->plimit($limit + 1,$offset);
|
// $sql .= $db->plimit($limit + 1,$offset);
|
||||||
@ -537,11 +538,11 @@ else
|
|||||||
{
|
{
|
||||||
if ($objp->fk_statut == 0)
|
if ($objp->fk_statut == 0)
|
||||||
{
|
{
|
||||||
print '<td align="center">'.$langs->trans("Draft").'</td>';
|
print '<td align="right">'.$langs->trans("Draft").'</td>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<td align="center"><a href="facture.php?filtre=paye:0,fk_statut:1">'.$langs->trans("Validated").'</a></td>';
|
print '<td align="right"><a href="facture.php?filtre=paye:0,fk_statut:1">'.$langs->trans("Validated").'</a></td>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user