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