revert some code

This commit is contained in:
atm-quentin 2018-11-16 15:16:48 +01:00
parent 7571760fdd
commit 56d4a8a737
3 changed files with 8 additions and 52 deletions

View File

@ -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

View File

@ -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)) {

View File

@ -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;
}