From 56d4a8a73759e0b5d7928908c9ed07c047bf38f1 Mon Sep 17 00:00:00 2001 From: atm-quentin Date: Fri, 16 Nov 2018 15:16:48 +0100 Subject: [PATCH] revert some code --- htdocs/compta/facture/class/facture.class.php | 11 +---- htdocs/compta/paiement.php | 2 +- .../modules/facture/mod_facture_mercure.php | 47 ++----------------- 3 files changed, 8 insertions(+), 52 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 69816eb1660..36dc78d4e0f 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3348,15 +3348,8 @@ class Facture extends CommonInvoice $mybool=false; - - $constant = 'FACTURE_ADDON_'.$this->entity; - - if (! empty($conf->global->$constant)) { - $classname = $conf->global->$constant; // for multicompany proposal sharing - } else { - $classname = $conf->global->FACTURE_ADDON; - } - $file = $classname.".php"; + $file = $conf->global->FACTURE_ADDON.".php"; + $classname = $conf->global->FACTURE_ADDON; // Include file with class diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 965141da766..c8146691b55 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -528,7 +528,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie $sql = 'SELECT f.rowid as facid, f.facnumber, f.total_ttc, f.multicurrency_code, f.multicurrency_total_ttc, f.type,'; $sql.= ' f.datef as df, f.fk_soc as socid, f.date_lim_reglement as dlr'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture as f'; - $sql.= ' WHERE f.entity IN ('.getEntity('invoice', $conf->entity).')'; + $sql.= ' WHERE f.entity IN ('.getEntity('invoice').')'; $sql.= ' AND (f.fk_soc = '.$facture->socid; // Can pay invoices of all child of parent company if(!empty($conf->global->FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS) && !empty($facture->thirdparty->parent)) { diff --git a/htdocs/core/modules/facture/mod_facture_mercure.php b/htdocs/core/modules/facture/mod_facture_mercure.php index 73c8984d336..1225fbd5964 100644 --- a/htdocs/core/modules/facture/mod_facture_mercure.php +++ b/htdocs/core/modules/facture/mod_facture_mercure.php @@ -138,69 +138,32 @@ class mod_facture_mercure extends ModeleNumRefFactures function getNextValue($objsoc, $invoice, $mode='next') { global $db,$conf; - require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php'; - // Get Mask value $mask = ''; if (is_object($invoice) && $invoice->type == 1) { - $constant = 'FACTURE_MERCURE_MASK_REPLACEMENT_'.$invoice->entity; - if (! empty($conf->global->$constant)) { - $mask = $conf->global->$constant; // for multicompany proposal sharing - } else { $mask=$conf->global->FACTURE_MERCURE_MASK_REPLACEMENT; - } if (! $mask) { - $constant = 'FACTURE_MERCURE_MASK_INVOICE_'.$invoice->entity; - if (! empty($conf->global->$constant)) { - $mask = $conf->global->$constant; // for multicompany proposal sharing - } else { $mask=$conf->global->FACTURE_MERCURE_MASK_INVOICE; } } - } - else if (is_object($invoice) && $invoice->type == 2){ - $constant = 'FACTURE_MERCURE_MASK_CREDIT_'.$invoice->entity; - if (! empty($conf->global->$constant)) { - $mask = $conf->global->$constant; // for multicompany proposal sharing - } else { - $mask=$conf->global->FACTURE_MERCURE_MASK_CREDIT; - } - } - else if (is_object($invoice) && $invoice->type == 3){ - $constant = 'FACTURE_MERCURE_MASK_DEPOSIT_'.$invoice->entity; - if (! empty($conf->global->$constant)) { - $mask = $conf->global->$constant; // for multicompany proposal sharing - } else { - $mask=$conf->global->FACTURE_MERCURE_MASK_DEPOSIT; - } - } - else { - $constant = 'FACTURE_MERCURE_MASK_INVOICE_'.$invoice->entity; - if (! empty($conf->global->$constant)) { - $mask = $conf->global->$constant; // for multicompany proposal sharing - } else { - $mask=$conf->global->FACTURE_MERCURE_MASK_INVOICE; - } - } + else if (is_object($invoice) && $invoice->type == 2) $mask=$conf->global->FACTURE_MERCURE_MASK_CREDIT; + else if (is_object($invoice) && $invoice->type == 3) $mask=$conf->global->FACTURE_MERCURE_MASK_DEPOSIT; + else $mask=$conf->global->FACTURE_MERCURE_MASK_INVOICE; if (! $mask) { $this->error='NotConfigured'; return 0; } - $where=''; //if ($facture->type == 2) $where.= " AND type = 2"; //else $where.=" AND type != 2"; - - // Get entities + // Get entities $entity = getEntity('invoicenumber', 1, $invoice); - - $numFinal=get_next_value($db,$mask,'facture','facnumber',$where,$objsoc,$invoice->date,$mode,false,null,$entity); + $numFinal=get_next_value($db,$mask,'facture','facnumber',$where,$objsoc,$invoice->date,$mode,false,null,$entity); if (! preg_match('/([0-9])+/',$numFinal)) $this->error = $numFinal; - return $numFinal; }