mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Fix: Suite correction bug gestion avoirs
This commit is contained in:
parent
7960db1c3c
commit
5697f3c0de
|
|
@ -127,7 +127,7 @@ if ($_GET["action"] == 'create')
|
|||
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="2">';
|
||||
if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client);
|
||||
else print $langs->trans("CompanyHasNoRelativeDiscount");
|
||||
$absolute_discount=$soc->getCurrentDiscount();
|
||||
$absolute_discount=$soc->getAvailableDiscounts();
|
||||
print '. ';
|
||||
if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->trans("Currency".$conf->monnaie));
|
||||
else print $langs->trans("CompanyHasNoAbsoluteDiscount");
|
||||
|
|
|
|||
|
|
@ -265,7 +265,7 @@ if ($socid > 0)
|
|||
print '</td></tr></table>';
|
||||
print '</td>';
|
||||
print '<td colspan="3">';
|
||||
$amount_discount=$objsoc->getcurrentDiscount();
|
||||
$amount_discount=$objsoc->getAvailableDiscounts();
|
||||
if ($amount_discount < 0) dolibarr_print_error($db,$societe->error);
|
||||
if ($amount_discount > 0) print price($amount_discount).' '.$langs->trans("Currency".$conf->monnaie);
|
||||
else print $langs->trans("DiscountNone");
|
||||
|
|
|
|||
|
|
@ -823,8 +823,8 @@ if ($_GET['propalid'] > 0)
|
|||
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="5">';
|
||||
if ($societe->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$societe->remise_client);
|
||||
else print $langs->trans("CompanyHasNoRelativeDiscount");
|
||||
$absolute_discount=$societe->getCurrentDiscount('','fk_facture_source IS NULL');
|
||||
$absolute_creditnote=$societe->getCurrentDiscount('','fk_facture_source IS NOT NULL');
|
||||
$absolute_discount=$societe->getAvailableDiscounts('','fk_facture_source IS NULL');
|
||||
$absolute_creditnote=$societe->getAvailableDiscounts('','fk_facture_source IS NOT NULL');
|
||||
print '. ';
|
||||
if ($absolute_discount)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ if ($_GET["propalid"] > 0)
|
|||
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="5">';
|
||||
if ($societe->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$societe->remise_client);
|
||||
else print $langs->trans("CompanyHasNoRelativeDiscount");
|
||||
$absolute_discount=$societe->getCurrentDiscount();
|
||||
$absolute_discount=$societe->getAvailableDiscounts();
|
||||
print '. ';
|
||||
if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",$absolute_discount,$langs->trans("Currency".$conf->monnaie));
|
||||
else print $langs->trans("CompanyHasNoAbsoluteDiscount");
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ if ($_GET['propalid'])
|
|||
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="3">';
|
||||
if ($societe->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$societe->remise_client);
|
||||
else print $langs->trans("CompanyHasNoRelativeDiscount");
|
||||
$absolute_discount=$societe->getCurrentDiscount();
|
||||
$absolute_discount=$societe->getAvailableDiscounts();
|
||||
print '. ';
|
||||
if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",$absolute_discount,$langs->trans("Currency".$conf->monnaie));
|
||||
else print $langs->trans("CompanyHasNoAbsoluteDiscount");
|
||||
|
|
|
|||
|
|
@ -786,7 +786,7 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer)
|
|||
print '<tr><td>'.$langs->trans('Discounts').'</td><td>';
|
||||
if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client);
|
||||
else print $langs->trans("CompanyHasNoRelativeDiscount");
|
||||
$absolute_discount=$soc->getCurrentDiscount();
|
||||
$absolute_discount=$soc->getAvailableDiscounts();
|
||||
print '. ';
|
||||
if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->trans("Currency".$conf->monnaie));
|
||||
else print $langs->trans("CompanyHasNoAbsoluteDiscount");
|
||||
|
|
@ -1111,8 +1111,8 @@ else
|
|||
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="3">';
|
||||
if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client);
|
||||
else print $langs->trans("CompanyHasNoRelativeDiscount");
|
||||
$absolute_discount=$soc->getCurrentDiscount('','fk_facture_source IS NULL');
|
||||
$absolute_creditnote=$soc->getCurrentDiscount('','fk_facture_source IS NOT NULL');
|
||||
$absolute_discount=$soc->getAvailableDiscounts('','fk_facture_source IS NULL');
|
||||
$absolute_creditnote=$soc->getAvailableDiscounts('','fk_facture_source IS NOT NULL');
|
||||
print '. ';
|
||||
if ($absolute_discount)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -135,8 +135,8 @@ if ($_GET["id"] > 0)
|
|||
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="3">';
|
||||
if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client);
|
||||
else print $langs->trans("CompanyHasNoRelativeDiscount");
|
||||
$absolute_discount=$soc->getCurrentDiscount('','fk_facture_source IS NULL');
|
||||
$absolute_creditnote=$soc->getCurrentDiscount('','fk_facture_source IS NOT NULL');
|
||||
$absolute_discount=$soc->getAvailableDiscounts('','fk_facture_source IS NULL');
|
||||
$absolute_creditnote=$soc->getAvailableDiscounts('','fk_facture_source IS NOT NULL');
|
||||
print '. ';
|
||||
if ($absolute_discount)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1138,7 +1138,7 @@ if ($_REQUEST['action'] == 'builddoc') // En get ou en post
|
|||
}
|
||||
}
|
||||
|
||||
llxHeader('',$langs->trans('Bill'),'Facture');
|
||||
llxHeader('',$langs->trans('Bill'),'HelpInvoice');
|
||||
|
||||
$html = new Form($db);
|
||||
|
||||
|
|
@ -1693,8 +1693,11 @@ else
|
|||
/* *************************************************************************** */
|
||||
if ($mesg) print $mesg.'<br>';
|
||||
|
||||
$fac = New Facture($db);
|
||||
if ($fac->fetch($_GET['facid']))
|
||||
$facstatic = new Facture($db);
|
||||
|
||||
$fac = new Facture($db);
|
||||
$result=$fac->fetch($_GET['facid']);
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($user->societe_id>0 && $user->societe_id!=$fac->socid) accessforbidden('',0);
|
||||
|
||||
|
|
@ -1702,12 +1705,14 @@ else
|
|||
|
||||
$soc = new Societe($db, $fac->socid);
|
||||
$soc->fetch($fac->socid);
|
||||
$absolute_discount=$soc->getCurrentDiscount('','fk_facture_source IS NULL');
|
||||
$absolute_creditnote=$soc->getCurrentDiscount('','fk_facture_source IS NOT NULL');
|
||||
$absolute_discount=$soc->getAvailableDiscounts('','fk_facture_source IS NULL');
|
||||
$absolute_creditnote=$soc->getAvailableDiscounts('','fk_facture_source IS NOT NULL');
|
||||
|
||||
$totalpaye = $fac->getSommePaiement();
|
||||
$resteapayer = $fac->total_ttc - $totalpaye;
|
||||
$totalpaye = $fac->getSommePaiement();
|
||||
$totalavoir = $fac->getSommeCreditNote();
|
||||
$resteapayer = $fac->total_ttc - $totalpaye - $totalavoir;
|
||||
if ($fac->paye) $resteapayer=0;
|
||||
$resteapayeraffiche=$resteapayer;
|
||||
|
||||
$author = new User($db);
|
||||
if ($fac->user_author)
|
||||
|
|
@ -1873,6 +1878,7 @@ else
|
|||
/*
|
||||
* Facture
|
||||
*/
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Reference
|
||||
|
|
@ -1942,7 +1948,7 @@ else
|
|||
$facreplaced->fetch($fac->fk_facture_source);
|
||||
print ' ('.$langs->transnoentities("CorrectInvoice",$facreplaced->getNomUrl(1)).')';
|
||||
}
|
||||
$facidavoir=$fac->getIdAvoirInvoice();
|
||||
$facidavoir=$fac->getListIdAvoirFromInvoice();
|
||||
if (sizeof($facidavoir) > 0)
|
||||
{
|
||||
print ' ('.$langs->transnoentities("InvoiceHasAvoir");
|
||||
|
|
@ -2057,13 +2063,35 @@ else
|
|||
|
||||
// Facturé
|
||||
print '<tr><td colspan="2" align="right">'.$langs->trans("Billed").' :</td><td align="right" style="border: 1px solid;">'.price($fac->total_ttc).'</td><td>'.$langs->trans('Currency'.$conf->monnaie).'</td></tr>';
|
||||
|
||||
$resteapayeraffiche=$resteapayer;
|
||||
|
||||
// Boucle sur chaque facture avoir appliquee
|
||||
|
||||
|
||||
|
||||
$sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,";
|
||||
$sql.= " re.description, re.fk_facture_source, re.fk_facture_source";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX ."societe_remise_except as re";
|
||||
$sql.= " WHERE fk_facture = ".$fac->id;
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
$invoice=new Facture($db);
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
print '<tr><td colspan="2" align="right">'.$langs->trans("CreditNote").' ';
|
||||
$invoice->fetch($obj->fk_facture_source);
|
||||
print $invoice->getNomUrl(0);
|
||||
print ' :</td>';
|
||||
print '<td align="right" style="border: 1px solid;">'.price($obj->amount_ttc).'</td><td>'.$langs->trans('Currency'.$conf->monnaie).'</td></tr>';
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
// Payé partiellement 'escompte'
|
||||
if (($fac->statut == 2 || $fac->statut == 3) && $fac->close_code == 'escompte')
|
||||
{
|
||||
|
|
@ -2177,6 +2205,7 @@ else
|
|||
|
||||
// Lit lignes de facture pour déterminer montant
|
||||
// On s'en sert pas mais ca sert pour debuggage
|
||||
/*
|
||||
$sql = 'SELECT l.price as price, l.qty, l.rowid, l.tva_taux,';
|
||||
$sql .= ' l.remise_percent, l.subprice';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'facturedet as l ';
|
||||
|
|
@ -2201,6 +2230,7 @@ else
|
|||
$i++;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// Montants
|
||||
print '<tr><td>'.$langs->trans('AmountHT').'</td>';
|
||||
|
|
@ -2736,8 +2766,9 @@ else
|
|||
if ($fac->statut == 1 && $fac->paye == 0 && $resteapayer > 0
|
||||
&& $user->rights->facture->paiement)
|
||||
{
|
||||
if ($totalpaye > 0)
|
||||
if ($totalpaye > 0 || $totalavoir > 0)
|
||||
{
|
||||
// If one payment or one credit note was linked to this invoice
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$fac->id.'&action=payed">'.$langs->trans('ClassifyPayedPartially').'</a>';
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@ if ($socid > 0)
|
|||
print '</td></tr></table>';
|
||||
print '</td>';
|
||||
print '<td colspan="3">';
|
||||
$amount_discount=$societe->getCurrentDiscount();
|
||||
$amount_discount=$societe->getAvailableDiscounts();
|
||||
if ($amount_discount < 0) dolibarr_print_error($db,$societe->error);
|
||||
if ($amount_discount > 0) print price($amount_discount).' '.$langs->trans("Currency".$conf->monnaie);
|
||||
else print $langs->trans("DiscountNone");
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ if ($_GET["propalid"] > 0)
|
|||
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="5">';
|
||||
if ($societe->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$societe->remise_client);
|
||||
else print $langs->trans("CompanyHasNoRelativeDiscount");
|
||||
$absolute_discount=$societe->getCurrentDiscount();
|
||||
$absolute_discount=$societe->getAvailableDiscounts();
|
||||
print '. ';
|
||||
if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",$absolute_discount,$langs->trans("Currency".$conf->monnaie));
|
||||
else print $langs->trans("CompanyHasNoAbsoluteDiscount");
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@ if ($id > 0)
|
|||
print '<tr><td>'.$langs->trans('Discount').'</td><td>';
|
||||
if ($contrat->societe->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$contrat->societe->remise_client);
|
||||
else print $langs->trans("CompanyHasNoRelativeDiscount");
|
||||
$absolute_discount=$contrat->societe->getCurrentDiscount();
|
||||
$absolute_discount=$contrat->societe->getAvailableDiscounts();
|
||||
print '. ';
|
||||
if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",$absolute_discount,$langs->trans("Currency".$conf->monnaie));
|
||||
else print $langs->trans("CompanyHasNoAbsoluteDiscount");
|
||||
|
|
|
|||
|
|
@ -428,7 +428,7 @@ if ($_GET["action"] == 'create')
|
|||
print '<tr><td>'.$langs->trans('Discount').'</td><td>';
|
||||
if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client);
|
||||
else print $langs->trans("CompanyHasNoRelativeDiscount");
|
||||
$absolute_discount=$soc->getCurrentDiscount();
|
||||
$absolute_discount=$soc->getAvailableDiscounts();
|
||||
print '. ';
|
||||
if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",$absolute_discount,$langs->trans("Currency".$conf->monnaie));
|
||||
else print $langs->trans("CompanyHasNoAbsoluteDiscount");
|
||||
|
|
@ -679,7 +679,7 @@ else
|
|||
print '<tr><td>'.$langs->trans('Discount').'</td><td colspan="3">';
|
||||
if ($contrat->societe->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$contrat->societe->remise_client);
|
||||
else print $langs->trans("CompanyHasNoRelativeDiscount");
|
||||
$absolute_discount=$contrat->societe->getCurrentDiscount();
|
||||
$absolute_discount=$contrat->societe->getAvailableDiscounts();
|
||||
print '. ';
|
||||
if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",$absolute_discount,$langs->trans("Currency".$conf->monnaie));
|
||||
else print $langs->trans("CompanyHasNoAbsoluteDiscount");
|
||||
|
|
|
|||
|
|
@ -176,7 +176,7 @@ if ($lineid > 0)
|
|||
print '<tr><td>'.$langs->trans('Discount').'</td><td>';
|
||||
if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client);
|
||||
else print $langs->trans("CompanyHasNoRelativeDiscount");
|
||||
$absolute_discount=$soc->getCurrentDiscount();
|
||||
$absolute_discount=$soc->getAvailableDiscounts();
|
||||
print '. ';
|
||||
if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",$absolute_discount,$langs->trans("Currency".$conf->monnaie));
|
||||
else print $langs->trans("CompanyHasNoAbsoluteDiscount");
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ if ($_GET["id"])
|
|||
print '<tr><td>'.$langs->trans('Discount').'</td><td>';
|
||||
if ($contrat->societe->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$contrat->societe->remise_client);
|
||||
else print $langs->trans("CompanyHasNoRelativeDiscount");
|
||||
$absolute_discount=$contrat->societe->getCurrentDiscount();
|
||||
$absolute_discount=$contrat->societe->getAvailableDiscounts();
|
||||
print '. ';
|
||||
if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",$absolute_discount,$langs->trans("Currency".$conf->monnaie));
|
||||
else print $langs->trans("CompanyHasNoAbsoluteDiscount");
|
||||
|
|
|
|||
|
|
@ -271,7 +271,7 @@ class DiscountAbsolute
|
|||
* \param filter Filtre autre
|
||||
* \return int <0 si ko, montant avoir sinon
|
||||
*/
|
||||
function getCurrentDiscount($company='', $user='',$filter='')
|
||||
function getAvailableDiscounts($company='', $user='',$filter='')
|
||||
{
|
||||
$sql = "SELECT SUM(rc.amount_ttc) as amount";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe_remise_except as rc";
|
||||
|
|
@ -280,7 +280,7 @@ class DiscountAbsolute
|
|||
if (is_object($user)) $sql.= " AND rc.fk_user = ".$user->id;
|
||||
if ($filter) $sql.=' AND '.$filter;
|
||||
|
||||
dolibarr_syslog("Discount::getCurrentDiscount sql=".$sql,LOG_DEBUG);
|
||||
dolibarr_syslog("Discount::getAvailableDiscounts sql=".$sql,LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
|
@ -291,6 +291,30 @@ class DiscountAbsolute
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Renvoie montant TTC des avoirs utilises par la facture
|
||||
* \return int <0 if KO, Credit note amount otherwise
|
||||
*/
|
||||
function getSommeCreditNote($invoice)
|
||||
{
|
||||
$sql = 'SELECT sum(rc.amount_ttc) as amount';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe_remise_except as rc';
|
||||
$sql.= ' WHERE rc.fk_facture = '.$invoice->id;
|
||||
|
||||
dolibarr_syslog("Discount::getSommeCreditNote sql=".$sql,LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
return $obj->amount;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
\brief Renvoie nom clicable (avec eventuellement le picto)
|
||||
\param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
|
||||
|
|
|
|||
|
|
@ -1814,36 +1814,57 @@ class Facture extends CommonObject
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Renvoie tableau des ids de facture avoir issus de la facture
|
||||
* \return array Tableau d'id de factures avoirs
|
||||
*/
|
||||
function getIdAvoirInvoice()
|
||||
{
|
||||
$idarray=array();
|
||||
/**
|
||||
* \brief Renvoie montant TTC des avoirs utilises par la facture
|
||||
* \return int <0 if KO, Credit note amount otherwise
|
||||
*/
|
||||
function getSommeCreditNote()
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT.'/discount.class.php');
|
||||
|
||||
$sql = 'SELECT rowid';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture';
|
||||
$sql.= ' WHERE fk_facture_source = '.$this->id;
|
||||
$sql.= ' AND type = 2';
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows();
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $this->db->fetch_row($i);
|
||||
$idarray[]=$row[0];
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($this->db);
|
||||
}
|
||||
return $idarray;
|
||||
}
|
||||
$discountstatic=new DiscountAbsolute($this->db);
|
||||
$result=$discountstatic->getSommeCreditNote($this);
|
||||
if ($result >= 0)
|
||||
{
|
||||
return $result;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$discountstatic->error;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Renvoie tableau des ids de facture avoir issus de la facture
|
||||
* \return array Tableau d'id de factures avoirs
|
||||
*/
|
||||
function getListIdAvoirFromInvoice()
|
||||
{
|
||||
$idarray=array();
|
||||
|
||||
$sql = 'SELECT rowid';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture';
|
||||
$sql.= ' WHERE fk_facture_source = '.$this->id;
|
||||
$sql.= ' AND type = 2';
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $this->db->fetch_row($resql);
|
||||
$idarray[]=$row[0];
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($this->db);
|
||||
}
|
||||
return $idarray;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Renvoie l'id de la facture qui la remplace
|
||||
|
|
|
|||
|
|
@ -745,7 +745,7 @@ class Form
|
|||
{
|
||||
global $langs,$conf;
|
||||
|
||||
// On recherche les societes
|
||||
// On recherche les remises
|
||||
$sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,";
|
||||
$sql.= " re.description, re.fk_facture_source";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX ."societe_remise_except as re";
|
||||
|
|
|
|||
|
|
@ -843,10 +843,10 @@ function top_menu($head, $title="", $target="")
|
|||
/**
|
||||
* \brief Affiche barre de menu gauche
|
||||
* \param menu_array Tableau des entrees de menu
|
||||
* \param help_url Url pour le lien aide ('' par defaut)
|
||||
* \param helppagename Url pour le lien aide ('' par defaut)
|
||||
* \param form_search Formulaire de recherche permanant supplementaire
|
||||
*/
|
||||
function left_menu($menu_array, $help_url='', $form_search='')
|
||||
function left_menu($menu_array, $helppagename='', $form_search='')
|
||||
{
|
||||
global $user, $conf, $langs, $db;
|
||||
|
||||
|
|
@ -908,12 +908,23 @@ function left_menu($menu_array, $help_url='', $form_search='')
|
|||
}
|
||||
|
||||
// Lien vers l'aide en ligne (uniquement si langue fr_FR)
|
||||
if ($help_url)
|
||||
if ($helppagename)
|
||||
{
|
||||
$langs->load("help");
|
||||
|
||||
$helpbaseurl='';
|
||||
if ($langs->defaultlang == "fr_FR") $helpbaseurl='http://www.dolibarr.com/wikidev/index.php/%s';
|
||||
|
||||
if ($helpbaseurl) print '<div class="help"><a class="help" target="_blank" href="'.sprintf($helpbaseurl,$help_url).'">'.$langs->trans("Help").'</a></div>';
|
||||
|
||||
$helppage=$langs->trans($helppagename);
|
||||
|
||||
if ($helpbaseurl)
|
||||
{
|
||||
print '<div class="help">';
|
||||
print '<a class="help" target="_blank" href="';
|
||||
print sprintf($helpbaseurl,$helppage);
|
||||
print '">'.$langs->trans("Help").'</a>';
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($conf->global->MAIN_SHOW_BUGTRACK_LINK == 1)
|
||||
|
|
|
|||
|
|
@ -1031,23 +1031,22 @@ class Societe
|
|||
* \param filter Filtre autre
|
||||
* \return int <0 if KO, Credit note amount otherwise
|
||||
*/
|
||||
function getCurrentDiscount($user='',$filter='')
|
||||
function getAvailableDiscounts($user='',$filter='')
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT.'/discount.class.php');
|
||||
|
||||
$discountstatic=new DiscountAbsolute($this->db);
|
||||
$result=$discountstatic->getCurrentDiscount($this,$user,$filter);
|
||||
$result=$discountstatic->getAvailableDiscounts($this,$user,$filter);
|
||||
if ($result >= 0)
|
||||
{
|
||||
return $result;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$discount->error;
|
||||
$this->error=$discountstatic->error;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function set_price_level($price_level, $user)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user