| '.$langs->trans('DiscountType').' | ';
print ' ';
@@ -205,8 +201,8 @@ if ($socid > 0)
print ' ';
- if($displayCustomer) {
- if($displaySupplier) {
+ if($isCustomer) {
+ if($isSupplier) {
print '';
print ' ';
print load_fiche_titre($langs->trans("CustomerDiscounts"), '', '');
@@ -263,8 +259,8 @@ if ($socid > 0)
}
}
- if($displaySupplier) {
- if($displayCustomer) {
+ if($isSupplier) {
+ if($isCustomer) {
print ' '; // class="fichehalfleft"
print ' ';
print ' ';
@@ -321,7 +317,7 @@ if ($socid > 0)
dol_print_error($db);
}
- if($displayCustomer) {
+ if($isCustomer) {
print ' '; // class="ficheaddleft"
print ' '; // class="fichehalfright"
print ' '; // class="fichecenter"
diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php
index 92e2f1d5d71..b580684af7e 100644
--- a/htdocs/comm/remx.php
+++ b/htdocs/comm/remx.php
@@ -238,9 +238,6 @@ if ($socid > 0)
$isCustomer = $object->client == 1 || $object->client == 3;
$isSupplier = $object->fournisseur == 1;
- $displayCustomer = $conf->global->MAIN_FEATURES_LEVEL <= 0 || $isCustomer;
- $displaySupplier = $conf->global->MAIN_FEATURES_LEVEL > 0 && $isSupplier;
-
/*
* Display tabs
*/
@@ -259,7 +256,7 @@ if ($socid > 0)
print '';
- if(! $displayCustomer && ! $displaySupplier) {
+ if(! $isCustomer && ! $isSupplier) {
print ''.$langs->trans('ThirdpartyIsNeitherCustomerNorClientSoCannotHaveDiscounts').' ';
dol_fiche_end();
@@ -274,7 +271,7 @@ if ($socid > 0)
print '';
- if($displayCustomer) { // Calcul avoirs client en cours
+ if($isCustomer) { // Calcul avoirs client en cours
$remise_all=$remise_user=0;
$sql = "SELECT SUM(rc.amount_ht) as amount, rc.fk_user";
$sql.= " FROM ".MAIN_DB_PREFIX."societe_remise_except as rc";
@@ -305,7 +302,7 @@ if ($socid > 0)
}
}
- if($displaySupplier) {
+ if($isSupplier) {
// Calcul avoirs fournisseur en cours
$remise_all=$remise_user=0;
$sql = "SELECT SUM(rc.amount_ht) as amount, rc.fk_user";
@@ -349,16 +346,16 @@ if ($socid > 0)
print '';
- if($conf->global->MAIN_FEATURES_LEVEL <= 0 || ($isCustomer && ! $isSupplier)) {
+ if($isCustomer && ! $isSupplier) {
print '';
}
- if($conf->global->MAIN_FEATURES_LEVEL > 0 && (! $isCustomer && $isSupplier)) {
+ if(! $isCustomer && $isSupplier) {
print '';
}
print '';
- if($conf->global->MAIN_FEATURES_LEVEL > 0 && $isCustomer && $isSupplier) {
+ if($isCustomer && $isSupplier) {
print '| '.$langs->trans('DiscountType').' | ';
print ' ';
print ' ';
@@ -408,8 +405,8 @@ if ($socid > 0)
print load_fiche_titre($langs->trans("DiscountStillRemaining"));
- if($displayCustomer) {
- if($displaySupplier) {
+ if($isCustomer) {
+ if($isSupplier) {
print '';
print ' ';
print load_fiche_titre($langs->trans("CustomerDiscounts"), '', '');
@@ -541,8 +538,8 @@ if ($socid > 0)
}
}
- if($displaySupplier) {
- if($displayCustomer) {
+ if($isSupplier) {
+ if($isCustomer) {
print ' '; // class="fichehalfleft"
print ' ';
print ' ';
@@ -677,7 +674,7 @@ if ($socid > 0)
dol_print_error($db);
}
- if($displayCustomer) {
+ if($isCustomer) {
print ' '; // class="ficheaddleft"
print ' '; // class="fichehalfright"
print ' '; // class="fichecenter"
@@ -692,8 +689,8 @@ if ($socid > 0)
print load_fiche_titre($langs->trans("DiscountAlreadyCounted"));
- if($displayCustomer) {
- if($displaySupplier) {
+ if($isCustomer) {
+ if($isSupplier) {
print '';
print ' ';
print load_fiche_titre($langs->trans("CustomerDiscounts"), '', '');
@@ -843,8 +840,8 @@ if ($socid > 0)
}
}
- if($displaySupplier) {
- if($displayCustomer) {
+ if($isSupplier) {
+ if($isCustomer) {
print ' '; // class="fichehalfleft"
print ' ';
print ' ';
@@ -994,7 +991,7 @@ if ($socid > 0)
dol_print_error($db);
}
- if($displayCustomer) {
+ if($isCustomer) {
print ' '; // class="ficheaddleft"
print ' '; // class="fichehalfright"
print ' '; // class="fichecenter"
diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php
index a5d5490e660..877ba0f6e14 100644
--- a/htdocs/fourn/card.php
+++ b/htdocs/fourn/card.php
@@ -258,40 +258,38 @@ if ($object->id > 0)
print " | ";
print ' ';
- if($conf->global->MAIN_FEATURES_LEVEL > 0) {
- // Relative discounts (Discounts-Drawbacks-Rebates)
- print '';
- print '| ';
- print $langs->trans("CustomerRelativeDiscountShort");
- print ' | | ';
- if ($user->rights->societe->creer && !$user->societe_id > 0)
- {
- print ''.img_edit($langs->trans("Modify")).'';
- }
- print ' | ';
- print ' | '.($object->remise_supplier_percent?''.$object->remise_supplier_percent.'%':'').' | ';
- print ' ';
-
- // Absolute discounts (Discounts-Drawbacks-Rebates)
- print '| ';
- print '';
- print ' | ';
- print '';
- $amount_discount=$object->getAvailableDiscounts('', '', 0, 1);
- if ($amount_discount < 0) dol_print_error($db,$object->error);
- if ($amount_discount > 0) print 'id).'">'.price($amount_discount,1,$langs,1,-1,-1,$conf->currency).'';
- //else print $langs->trans("DiscountNone");
- print ' | ';
- print ' ';
+ // Relative discounts (Discounts-Drawbacks-Rebates)
+ print '';
+ print '| ';
+ print $langs->trans("CustomerRelativeDiscountShort");
+ print ' | | ';
+ if ($user->rights->societe->creer && !$user->societe_id > 0)
+ {
+ print ''.img_edit($langs->trans("Modify")).'';
}
+ print ' | ';
+ print ' | '.($object->remise_supplier_percent?''.$object->remise_supplier_percent.'%':'').' | ';
+ print ' ';
+
+ // Absolute discounts (Discounts-Drawbacks-Rebates)
+ print '| ';
+ print '';
+ print ' | ';
+ print '';
+ $amount_discount=$object->getAvailableDiscounts('', '', 0, 1);
+ if ($amount_discount < 0) dol_print_error($db,$object->error);
+ if ($amount_discount > 0) print 'id).'">'.price($amount_discount,1,$langs,1,-1,-1,$conf->currency).'';
+ //else print $langs->trans("DiscountNone");
+ print ' | ';
+ print ' ';
print '';
print '| ';
diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php
index c7487f4cc51..4225646a3af 100644
--- a/htdocs/fourn/commande/card.php
+++ b/htdocs/fourn/commande/card.php
@@ -1479,7 +1479,7 @@ if ($action=='create')
}
print ' | ';
- if ($conf->global->MAIN_FEATURES_LEVEL > 0 && $societe->id > 0)
+ if ($societe->id > 0)
{
// Discounts for third party
print ' | ' . $langs->trans('Discounts') . ' | ';
@@ -1874,32 +1874,29 @@ elseif (! empty($object->id))
print ' | '.$author->getNomUrl(1, '', 0, 0, 0).' | ';
print ' ';
- if ($conf->global->MAIN_FEATURES_LEVEL > 0) {
-
- // Relative and absolute discounts
- if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
- $filterabsolutediscount = "fk_invoice_supplier_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
- $filtercreditnote = "fk_invoice_supplier_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
- } else {
- $filterabsolutediscount = "fk_invoice_supplier_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS PAID)%')";
- $filtercreditnote = "fk_invoice_supplier_source IS NOT NULL AND (description NOT LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS PAID)%')";
- }
-
- $absolute_discount = $societe->getAvailableDiscounts('', $filterabsolutediscount, 0, 1);
- $absolute_creditnote = $societe->getAvailableDiscounts('', $filtercreditnote, 0, 1);
- $absolute_discount = price2num($absolute_discount, 'MT');
- $absolute_creditnote = price2num($absolute_creditnote, 'MT');
-
- print '| ' . $langs->trans('Discounts') . ' | ';
-
- $thirdparty = $societe;
- $discount_type = 1;
- $backtopage = urlencode($_SERVER["PHP_SELF"] . '?id=' . $object->id);
- include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php';
-
- print ' | ';
+ // Relative and absolute discounts
+ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
+ $filterabsolutediscount = "fk_invoice_supplier_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
+ $filtercreditnote = "fk_invoice_supplier_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
+ } else {
+ $filterabsolutediscount = "fk_invoice_supplier_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS PAID)%')";
+ $filtercreditnote = "fk_invoice_supplier_source IS NOT NULL AND (description NOT LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS PAID)%')";
}
+ $absolute_discount = $societe->getAvailableDiscounts('', $filterabsolutediscount, 0, 1);
+ $absolute_creditnote = $societe->getAvailableDiscounts('', $filtercreditnote, 0, 1);
+ $absolute_discount = price2num($absolute_discount, 'MT');
+ $absolute_creditnote = price2num($absolute_creditnote, 'MT');
+
+ print '| ' . $langs->trans('Discounts') . ' | ';
+
+ $thirdparty = $societe;
+ $discount_type = 1;
+ $backtopage = urlencode($_SERVER["PHP_SELF"] . '?id=' . $object->id);
+ include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php';
+
+ print ' | ';
+
// Conditions de reglement par defaut
$langs->load('bills');
print '| ';
diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php
index 14909a1fc2e..8069f6cf520 100644
--- a/htdocs/fourn/facture/card.php
+++ b/htdocs/fourn/facture/card.php
@@ -1848,74 +1848,71 @@ if ($action == 'create')
if (empty($origin))
{
- if ($conf->global->MAIN_FEATURES_LEVEL > 0) // Need to fix reports of standard accounting module to manage supplier credit note
+ if ($societe->id > 0)
{
- if ($societe->id > 0)
- {
- // Credit note
- if (empty($conf->global->INVOICE_DISABLE_CREDIT_NOTE))
- {
- print '';
- }
- }
- else
+ // Credit note
+ if (empty($conf->global->INVOICE_DISABLE_CREDIT_NOTE))
{
print '' . "\n";
+
+ print ' ';
+ print ' 0 ? 'checked':'').' /> ";
+ print ' 0 ? 'checked':'').' /> ";
+ print ' ';
+
+ print '';
}
}
+ else
+ {
+ print '' . "\n";
+ }
}
print '';
print ' | ';
- if ($conf->global->MAIN_FEATURES_LEVEL > 0 && $societe->id > 0)
+ if ($societe->id > 0)
{
// Discounts for third party
print '| ' . $langs->trans('Discounts') . ' | ';
@@ -2411,18 +2408,17 @@ else
}
print ' | ';
- if ($conf->global->MAIN_FEATURES_LEVEL > 0) {
- // Relative and absolute discounts
- print '| ' . $langs->trans('Discounts');
- print ' | ';
- $thirdparty = $societe;
- $discount_type = 1;
- $backtopage = urlencode($_SERVER["PHP_SELF"] . '?facid=' . $object->id);
- include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php';
+ // Relative and absolute discounts
+ print ' | | ' . $langs->trans('Discounts');
+ print ' | ';
- print ' | ';
- }
+ $thirdparty = $societe;
+ $discount_type = 1;
+ $backtopage = urlencode($_SERVER["PHP_SELF"] . '?facid=' . $object->id);
+ include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php';
+
+ print '';
// Label
print '';
@@ -2782,41 +2778,39 @@ else
$creditnoteamount = 0;
$depositamount = 0;
- if($conf->global->MAIN_FEATURES_LEVEL > 0) {
- $sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,";
- $sql .= " re.description, re.fk_invoice_supplier_source";
- $sql .= " FROM " . MAIN_DB_PREFIX . "societe_remise_except as re";
- $sql .= " WHERE fk_invoice_supplier = " . $object->id;
- $resql = $db->query($sql);
- if ($resql) {
- $num = $db->num_rows($resql);
- $i = 0;
- $invoice = new FactureFournisseur($db);
- while ($i < $num) {
- $obj = $db->fetch_object($resql);
- $invoice->fetch($obj->fk_invoice_supplier_source);
- print ' | ';
- if ($invoice->type == FactureFournisseur::TYPE_CREDIT_NOTE)
- print $langs->trans("CreditNote") . ' ';
- if ($invoice->type == FactureFournisseur::TYPE_DEPOSIT)
- print $langs->trans("Deposit") . ' ';
- print $invoice->getNomUrl(0);
- print ' : | ';
- print '' . price($obj->amount_ttc) . ' | ';
- print '';
- print 'id . '&action=unlinkdiscount&discountid=' . $obj->rowid . '">' . img_delete() . '';
- print ' | ';
- $i ++;
- if ($invoice->type == FactureFournisseur::TYPE_CREDIT_NOTE)
- $creditnoteamount += $obj->amount_ttc;
- if ($invoice->type == FactureFournisseur::TYPE_DEPOSIT)
- $depositamount += $obj->amount_ttc;
- }
- } else {
- dol_print_error($db);
- }
- }
+ $sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,";
+ $sql .= " re.description, re.fk_invoice_supplier_source";
+ $sql .= " FROM " . MAIN_DB_PREFIX . "societe_remise_except as re";
+ $sql .= " WHERE fk_invoice_supplier = " . $object->id;
+ $resql = $db->query($sql);
+ if ($resql) {
+ $num = $db->num_rows($resql);
+ $i = 0;
+ $invoice = new FactureFournisseur($db);
+ while ($i < $num) {
+ $obj = $db->fetch_object($resql);
+ $invoice->fetch($obj->fk_invoice_supplier_source);
+ print '| ';
+ if ($invoice->type == FactureFournisseur::TYPE_CREDIT_NOTE)
+ print $langs->trans("CreditNote") . ' ';
+ if ($invoice->type == FactureFournisseur::TYPE_DEPOSIT)
+ print $langs->trans("Deposit") . ' ';
+ print $invoice->getNomUrl(0);
+ print ' : | ';
+ print '' . price($obj->amount_ttc) . ' | ';
+ print '';
+ print 'id . '&action=unlinkdiscount&discountid=' . $obj->rowid . '">' . img_delete() . '';
+ print ' | ';
+ $i ++;
+ if ($invoice->type == FactureFournisseur::TYPE_CREDIT_NOTE)
+ $creditnoteamount += $obj->amount_ttc;
+ if ($invoice->type == FactureFournisseur::TYPE_DEPOSIT)
+ $depositamount += $obj->amount_ttc;
+ }
+ } else {
+ dol_print_error($db);
+ }
// Paye partiellement 'escompte'
if (($object->statut == FactureFournisseur::STATUS_CLOSED || $object->statut == FactureFournisseur::STATUS_ABANDONED) && $object->close_code == 'discount_vat') {
@@ -3029,7 +3023,7 @@ else
}
// Reverse back money or convert to reduction
- if ($conf->global->MAIN_FEATURES_LEVEL > 0 && ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE || $object->type == FactureFournisseur::TYPE_DEPOSIT || $object->type == FactureFournisseur::TYPE_STANDARD)) {
+ if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE || $object->type == FactureFournisseur::TYPE_DEPOSIT || $object->type == FactureFournisseur::TYPE_STANDARD) {
// For credit note only
if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE && $object->statut == 1 && $object->paye == 0)
{
diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php
index 4e4611d4fd5..e906fea4041 100644
--- a/htdocs/supplier_proposal/card.php
+++ b/htdocs/supplier_proposal/card.php
@@ -1050,7 +1050,7 @@ if ($action == 'create')
}
print '' . "\n";
- if ($conf->global->MAIN_FEATURES_LEVEL > 0 && $soc->id > 0)
+ if ($soc->id > 0)
{
// Discounts for third party
print '| ' . $langs->trans('Discounts') . ' | ';
@@ -1404,32 +1404,29 @@ if ($action == 'create')
print '';
- if ($conf->global->MAIN_FEATURES_LEVEL > 0) {
-
- // Relative and absolute discounts
- if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
- $filterabsolutediscount = "fk_invoice_supplier_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
- $filtercreditnote = "fk_invoice_supplier_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
- } else {
- $filterabsolutediscount = "fk_invoice_supplier_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS PAID)%')";
- $filtercreditnote = "fk_invoice_supplier_source IS NOT NULL AND (description NOT LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS PAID)%')";
- }
-
- print '| ' . $langs->trans('Discounts') . ' | ';
-
- $absolute_discount = $soc->getAvailableDiscounts('', $filterabsolutediscount, 0, 1);
- $absolute_creditnote = $soc->getAvailableDiscounts('', $filtercreditnote, 0, 1);
- $absolute_discount = price2num($absolute_discount, 'MT');
- $absolute_creditnote = price2num($absolute_creditnote, 'MT');
-
- $thirdparty = $soc;
- $discount_type = 1;
- $backtopage = urlencode($_SERVER["PHP_SELF"] . '?id=' . $object->id);
- include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php';
-
- print ' | ';
+ // Relative and absolute discounts
+ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
+ $filterabsolutediscount = "fk_invoice_supplier_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
+ $filtercreditnote = "fk_invoice_supplier_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
+ } else {
+ $filterabsolutediscount = "fk_invoice_supplier_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS PAID)%')";
+ $filtercreditnote = "fk_invoice_supplier_source IS NOT NULL AND (description NOT LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS PAID)%')";
}
+ print '| ' . $langs->trans('Discounts') . ' | ';
+
+ $absolute_discount = $soc->getAvailableDiscounts('', $filterabsolutediscount, 0, 1);
+ $absolute_creditnote = $soc->getAvailableDiscounts('', $filtercreditnote, 0, 1);
+ $absolute_discount = price2num($absolute_discount, 'MT');
+ $absolute_creditnote = price2num($absolute_creditnote, 'MT');
+
+ $thirdparty = $soc;
+ $discount_type = 1;
+ $backtopage = urlencode($_SERVER["PHP_SELF"] . '?id=' . $object->id);
+ include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php';
+
+ print ' | ';
+
// Payment term
print '| ';
print ' | | |