Fix: Pb with predefined invoices
This commit is contained in:
parent
f57aaf4f4a
commit
23516a466c
@ -26,9 +26,9 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/compta/facture.php
|
* \file htdocs/compta/facture.php
|
||||||
* \ingroup facture
|
* \ingroup facture
|
||||||
* \brief Page to create/see an invoice
|
* \brief Page to create/see an invoice
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require '../main.inc.php';
|
require '../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
||||||
@ -1904,9 +1904,9 @@ llxHeader('',$langs->trans('Bill'),'EN:Customers_Invoices|FR:Factures_Clients|ES
|
|||||||
|
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
*
|
*
|
||||||
* Mode creation
|
* Mode creation
|
||||||
*
|
*
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
if ($action == 'create')
|
if ($action == 'create')
|
||||||
{
|
{
|
||||||
$facturestatic=new Facture($db);
|
$facturestatic=new Facture($db);
|
||||||
@ -2000,8 +2000,26 @@ if ($action == 'create')
|
|||||||
// Ref
|
// Ref
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans('Ref').'</td><td colspan="2">'.$langs->trans('Draft').'</td></tr>';
|
print '<tr><td class="fieldrequired">'.$langs->trans('Ref').'</td><td colspan="2">'.$langs->trans('Draft').'</td></tr>';
|
||||||
|
|
||||||
|
// Tiers
|
||||||
|
print '<tr>';
|
||||||
|
print '<td class="fieldrequired">'.$langs->trans('Customer').'</td>';
|
||||||
|
if($soc->id > 0)
|
||||||
|
{
|
||||||
|
print '<td colspan="2">';
|
||||||
|
print $soc->getNomUrl(1);
|
||||||
|
print '<input type="hidden" name="socid" value="'.$soc->id.'">';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<td colspan="2">';
|
||||||
|
print $form->select_company('','socid','s.client = 1 OR s.client = 3',1);
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
print '</tr>'."\n";
|
||||||
|
|
||||||
// Factures predefinies
|
// Factures predefinies
|
||||||
if (empty($origin) && empty($originid) && $socid>0)
|
if (empty($origin) && empty($originid) && $socid > 0)
|
||||||
{
|
{
|
||||||
$sql = 'SELECT r.rowid, r.titre, r.total_ttc';
|
$sql = 'SELECT r.rowid, r.titre, r.total_ttc';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture_rec as r';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture_rec as r';
|
||||||
@ -2036,24 +2054,6 @@ if ($action == 'create')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tiers
|
|
||||||
print '<tr>';
|
|
||||||
print '<td class="fieldrequired">'.$langs->trans('Customer').'</td>';
|
|
||||||
if($soc->id > 0)
|
|
||||||
{
|
|
||||||
print '<td colspan="2">';
|
|
||||||
print $soc->getNomUrl(1);
|
|
||||||
print '<input type="hidden" name="socid" value="'.$soc->id.'">';
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<td colspan="2">';
|
|
||||||
print $form->select_company('','socid','s.client = 1 OR s.client = 3',1);
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
print '</tr>'."\n";
|
|
||||||
|
|
||||||
// Type de facture
|
// Type de facture
|
||||||
$facids=$facturestatic->list_replacable_invoices($soc->id);
|
$facids=$facturestatic->list_replacable_invoices($soc->id);
|
||||||
if ($facids < 0)
|
if ($facids < 0)
|
||||||
|
|||||||
@ -106,6 +106,7 @@ if ($action == 'delete' && $user->rights->facture->supprimer)
|
|||||||
llxHeader('',$langs->trans("RepeatableInvoices"),'ch-facture.html#s-fac-facture-rec');
|
llxHeader('',$langs->trans("RepeatableInvoices"),'ch-facture.html#s-fac-facture-rec');
|
||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
$companystatic = new Societe($db);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create mode
|
* Create mode
|
||||||
@ -114,7 +115,7 @@ if ($action == 'create')
|
|||||||
{
|
{
|
||||||
print_fiche_titre($langs->trans("CreateRepeatableInvoice"));
|
print_fiche_titre($langs->trans("CreateRepeatableInvoice"));
|
||||||
|
|
||||||
$object = new Facture($db); // Source invoice
|
$object = new FactureRec($db); // Source invoice
|
||||||
$product_static = new Product($db);
|
$product_static = new Product($db);
|
||||||
|
|
||||||
if ($object->fetch($id) > 0)
|
if ($object->fetch($id) > 0)
|
||||||
@ -364,7 +365,13 @@ else
|
|||||||
$author = new User($db);
|
$author = new User($db);
|
||||||
$author->fetch($object->user_author);
|
$author->fetch($object->user_author);
|
||||||
|
|
||||||
dol_fiche_head($head, 'compta', $langs->trans("PredefinedInvoices"),0,'company'); // Add a div
|
$head=array();
|
||||||
|
$h=0;
|
||||||
|
$head[$h][0] = $_SERVER["PHP_SELF"].'?id='.$object->id;
|
||||||
|
$head[$h][1] = $langs->trans("CardBill");
|
||||||
|
$head[$h][2] = 'card';
|
||||||
|
|
||||||
|
dol_fiche_head($head, 'card', $langs->trans("PredefinedInvoices"),0,'bill'); // Add a div
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
@ -552,7 +559,10 @@ else
|
|||||||
|
|
||||||
print '<td><a href="'.$_SERVER['PHP_SELF'].'?id='.$objp->facid.'">'.img_object($langs->trans("ShowBill"),"bill").' '.$objp->titre;
|
print '<td><a href="'.$_SERVER['PHP_SELF'].'?id='.$objp->facid.'">'.img_object($langs->trans("ShowBill"),"bill").' '.$objp->titre;
|
||||||
print "</a></td>\n";
|
print "</a></td>\n";
|
||||||
print '<td><a href="../fiche.php?socid='.$objp->socid.'">'.$objp->nom.'</a></td>';
|
|
||||||
|
$companystatic->id=$objp->socid;
|
||||||
|
$companystatic->name=$objp->nom;
|
||||||
|
print '<td>'.$companystatic->getNomUrl(1,'customer').'</td>';
|
||||||
|
|
||||||
print '<td align="right">'.price($objp->total).'</td>'."\n";
|
print '<td align="right">'.price($objp->total).'</td>'."\n";
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user