Fix: Correction régression sur création factures
This commit is contained in:
parent
264b99a0b0
commit
94a21ca9fc
@ -176,10 +176,8 @@ if ($_POST['action'] == 'add')
|
|||||||
if ($_POST['propalid'])
|
if ($_POST['propalid'])
|
||||||
{
|
{
|
||||||
$facture->propalid = $_POST['propalid'];
|
$facture->propalid = $_POST['propalid'];
|
||||||
|
|
||||||
$facid = $facture->create($user);
|
$facid = $facture->create($user);
|
||||||
|
if ($facid > 0)
|
||||||
if ($facid)
|
|
||||||
{
|
{
|
||||||
$prop = New Propal($db);
|
$prop = New Propal($db);
|
||||||
if ( $prop->fetch($_POST['propalid']) )
|
if ( $prop->fetch($_POST['propalid']) )
|
||||||
@ -188,14 +186,15 @@ if ($_POST['action'] == 'add')
|
|||||||
{
|
{
|
||||||
$liblignefac=($prop->lignes[$i]->desc?$prop->lignes[$i]->desc:$prop->lignes[$i]->libelle);
|
$liblignefac=($prop->lignes[$i]->desc?$prop->lignes[$i]->desc:$prop->lignes[$i]->libelle);
|
||||||
|
|
||||||
$result = $facture->addline($facid,
|
$result = $facture->addline(
|
||||||
addslashes($liblignefac),
|
$facid,
|
||||||
$prop->lignes[$i]->desc,
|
addslashes($liblignefac),
|
||||||
$prop->lignes[$i]->subprice,
|
$prop->lignes[$i]->desc,
|
||||||
$prop->lignes[$i]->qty,
|
$prop->lignes[$i]->subprice,
|
||||||
$prop->lignes[$i]->tva_tx,
|
$prop->lignes[$i]->qty,
|
||||||
$prop->lignes[$i]->product_id,
|
$prop->lignes[$i]->tva_tx,
|
||||||
$prop->lignes[$i]->remise_percent);
|
$prop->lignes[$i]->product_id,
|
||||||
|
$prop->lignes[$i]->remise_percent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -203,6 +202,10 @@ if ($_POST['action'] == 'add')
|
|||||||
print $langs->trans('UnknownError');
|
print $langs->trans('UnknownError');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dolibarr_print_error($db,$facture->error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -212,7 +215,7 @@ if ($_POST['action'] == 'add')
|
|||||||
{
|
{
|
||||||
$facture->commandeid = $_POST['commandeid'];
|
$facture->commandeid = $_POST['commandeid'];
|
||||||
$facid = $facture->create($user);
|
$facid = $facture->create($user);
|
||||||
if ($facid)
|
if ($facid > 0)
|
||||||
{
|
{
|
||||||
$comm = New Commande($db);
|
$comm = New Commande($db);
|
||||||
if ( $comm->fetch($_POST['commandeid']) )
|
if ( $comm->fetch($_POST['commandeid']) )
|
||||||
@ -220,14 +223,15 @@ if ($_POST['action'] == 'add')
|
|||||||
$lines = $comm->fetch_lignes();
|
$lines = $comm->fetch_lignes();
|
||||||
for ($i = 0 ; $i < sizeof($lines) ; $i++)
|
for ($i = 0 ; $i < sizeof($lines) ; $i++)
|
||||||
{
|
{
|
||||||
$result = $facture->addline($facid,
|
$result = $facture->addline(
|
||||||
addslashes($lines[$i]->description),
|
$facid,
|
||||||
$lines[$i]->desc,
|
addslashes($lines[$i]->description),
|
||||||
$lines[$i]->subprice,
|
$lines[$i]->desc,
|
||||||
$lines[$i]->qty,
|
$lines[$i]->subprice,
|
||||||
$lines[$i]->tva_tx,
|
$lines[$i]->qty,
|
||||||
$lines[$i]->product_id,
|
$lines[$i]->tva_tx,
|
||||||
$lines[$i]->remise_percent);
|
$lines[$i]->product_id,
|
||||||
|
$lines[$i]->remise_percent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -237,7 +241,7 @@ if ($_POST['action'] == 'add')
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dolibarr_print_error($db);
|
dolibarr_print_error($db,$facture->error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -248,8 +252,7 @@ if ($_POST['action'] == 'add')
|
|||||||
{
|
{
|
||||||
$facture->contratid = $_POST['contratid'];
|
$facture->contratid = $_POST['contratid'];
|
||||||
$facid = $facture->create($user);
|
$facid = $facture->create($user);
|
||||||
|
if ($facid > 0)
|
||||||
if ($facid)
|
|
||||||
{
|
{
|
||||||
$contrat = New Contrat($db);
|
$contrat = New Contrat($db);
|
||||||
if ($contrat->fetch($_POST['contratid']) > 0)
|
if ($contrat->fetch($_POST['contratid']) > 0)
|
||||||
@ -266,15 +269,17 @@ if ($_POST['action'] == 'add')
|
|||||||
$date_end=$contrat->lignes[$i]->date_fin_prevue;
|
$date_end=$contrat->lignes[$i]->date_fin_prevue;
|
||||||
if ($contrat->lignes[$i]->date_fin_reel) $date_end=$contrat->lignes[$i]->date_fin_reel;
|
if ($contrat->lignes[$i]->date_fin_reel) $date_end=$contrat->lignes[$i]->date_fin_reel;
|
||||||
|
|
||||||
$result = $facture->addline($facid,
|
$result = $facture->addline(
|
||||||
addslashes($liblignefac),
|
$facid,
|
||||||
$lines[$i]->subprice,
|
addslashes($liblignefac),
|
||||||
$lines[$i]->qty,
|
'',
|
||||||
$lines[$i]->tva_tx,
|
$lines[$i]->subprice,
|
||||||
$lines[$i]->product_id,
|
$lines[$i]->qty,
|
||||||
$lines[$i]->remise_percent,
|
$lines[$i]->tva_tx,
|
||||||
$date_start,
|
$lines[$i]->product_id,
|
||||||
$date_end);
|
$lines[$i]->remise_percent,
|
||||||
|
$date_start,
|
||||||
|
$date_end);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -284,7 +289,7 @@ if ($_POST['action'] == 'add')
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dolibarr_print_error($db);
|
dolibarr_print_error($db,$facture->error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -47,7 +47,6 @@ if ($user->societe_id > 0)
|
|||||||
$user->getrights('facture');
|
$user->getrights('facture');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($action == 'recontact')
|
if ($action == 'recontact')
|
||||||
{
|
{
|
||||||
$dr = mktime(0, 0, 0, $remonth, $reday, $reyear);
|
$dr = mktime(0, 0, 0, $remonth, $reday, $reyear);
|
||||||
@ -127,7 +126,11 @@ if ($socid > 0)
|
|||||||
{
|
{
|
||||||
$societe = new Societe($db);
|
$societe = new Societe($db);
|
||||||
$societe->fetch($socid, $to); // si $to='next' ajouter " AND s.idp > $socid ORDER BY idp ASC LIMIT 1";
|
$societe->fetch($socid, $to); // si $to='next' ajouter " AND s.idp > $socid ORDER BY idp ASC LIMIT 1";
|
||||||
|
if ($societe->id <= 0)
|
||||||
|
{
|
||||||
|
dolibarr_print_error($db,$societe->error);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Affichage onglets
|
* Affichage onglets
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -106,9 +106,9 @@ class Facture
|
|||||||
|
|
||||||
// On positionne en mode brouillon la facture
|
// On positionne en mode brouillon la facture
|
||||||
$this->brouillon = 1;
|
$this->brouillon = 1;
|
||||||
|
|
||||||
dolibarr_syslog("Facture::create");
|
dolibarr_syslog("Facture::create");
|
||||||
|
|
||||||
// Facture récurrente
|
// Facture récurrente
|
||||||
if ($this->fac_rec > 0)
|
if ($this->fac_rec > 0)
|
||||||
{
|
{
|
||||||
@ -130,7 +130,7 @@ class Facture
|
|||||||
$datelim=$this->calculate_date_lim_reglement();
|
$datelim=$this->calculate_date_lim_reglement();
|
||||||
|
|
||||||
// Insertion dans la base
|
// Insertion dans la base
|
||||||
$socid = $this->socidp;
|
$socid = $this->socidp;
|
||||||
$number = $this->number;
|
$number = $this->number;
|
||||||
$amount = $this->amount;
|
$amount = $this->amount;
|
||||||
$remise = $this->remise;
|
$remise = $this->remise;
|
||||||
@ -997,22 +997,23 @@ class Facture
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Ajoute une ligne de facture (associé à un produit/service prédéfini ou non)
|
* \brief Ajoute une ligne de facture (associé à un produit/service prédéfini ou non)
|
||||||
* \param facid id de la facture
|
* \param facid id de la facture
|
||||||
* \param desc description de la ligne
|
* \param desc description de la ligne
|
||||||
* \param pu prix unitaire
|
* \param product_desc surcharge description produit
|
||||||
* \param qty quantit
|
* \param pu prix unitaire
|
||||||
* \param txtva taux de tva
|
* \param qty quantit
|
||||||
* \param fk_product id du produit/service predéfini
|
* \param txtva taux de tva
|
||||||
* \param remise_percent pourcentage de remise de la ligne
|
* \param fk_product id du produit/service predéfini
|
||||||
* \param datestart date de debut de validité du service
|
* \param remise_percent pourcentage de remise de la ligne
|
||||||
* \param dateend date de fin de validité du service
|
* \param datestart date de debut de validité du service
|
||||||
* \param ventil code de ventilation comptable
|
* \param dateend date de fin de validité du service
|
||||||
|
* \param ventil code de ventilation comptable
|
||||||
*/
|
*/
|
||||||
function addline($facid, $desc, $product_desc, $pu, $qty, $txtva, $fk_product=0, $remise_percent=0, $datestart='', $dateend='', $ventil = 0)
|
function addline($facid, $desc, $product_desc, $pu, $qty, $txtva, $fk_product=0, $remise_percent=0, $datestart='', $dateend='', $ventil = 0)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
dolibarr_syslog("facture.class.php::addline($facid,$desc,$pu,$qty,$txtva,$fk_product,$remise_percent,$datestart,$dateend,$ventil)");
|
dolibarr_syslog("facture.class.php::addline($facid,$desc,$product_desc,$pu,$qty,$txtva,$fk_product,$remise_percent,$datestart,$dateend,$ventil)");
|
||||||
|
|
||||||
if ($this->brouillon)
|
if ($this->brouillon)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user