revert some code
This commit is contained in:
parent
7571760fdd
commit
56d4a8a737
@ -3348,15 +3348,8 @@ class Facture extends CommonInvoice
|
|||||||
$mybool=false;
|
$mybool=false;
|
||||||
|
|
||||||
|
|
||||||
|
$file = $conf->global->FACTURE_ADDON.".php";
|
||||||
$constant = 'FACTURE_ADDON_'.$this->entity;
|
|
||||||
|
|
||||||
if (! empty($conf->global->$constant)) {
|
|
||||||
$classname = $conf->global->$constant; // for multicompany proposal sharing
|
|
||||||
} else {
|
|
||||||
$classname = $conf->global->FACTURE_ADDON;
|
$classname = $conf->global->FACTURE_ADDON;
|
||||||
}
|
|
||||||
$file = $classname.".php";
|
|
||||||
|
|
||||||
|
|
||||||
// Include file with class
|
// Include file with class
|
||||||
|
|||||||
@ -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 = '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.= ' f.datef as df, f.fk_soc as socid, f.date_lim_reglement as dlr';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture as f';
|
$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;
|
$sql.= ' AND (f.fk_soc = '.$facture->socid;
|
||||||
// Can pay invoices of all child of parent company
|
// Can pay invoices of all child of parent company
|
||||||
if(!empty($conf->global->FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS) && !empty($facture->thirdparty->parent)) {
|
if(!empty($conf->global->FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS) && !empty($facture->thirdparty->parent)) {
|
||||||
|
|||||||
@ -138,69 +138,32 @@ class mod_facture_mercure extends ModeleNumRefFactures
|
|||||||
function getNextValue($objsoc, $invoice, $mode='next')
|
function getNextValue($objsoc, $invoice, $mode='next')
|
||||||
{
|
{
|
||||||
global $db,$conf;
|
global $db,$conf;
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php';
|
require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php';
|
||||||
|
|
||||||
// Get Mask value
|
// Get Mask value
|
||||||
$mask = '';
|
$mask = '';
|
||||||
if (is_object($invoice) && $invoice->type == 1)
|
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;
|
$mask=$conf->global->FACTURE_MERCURE_MASK_REPLACEMENT;
|
||||||
}
|
|
||||||
if (! $mask)
|
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;
|
$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)
|
if (! $mask)
|
||||||
{
|
{
|
||||||
$this->error='NotConfigured';
|
$this->error='NotConfigured';
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$where='';
|
$where='';
|
||||||
//if ($facture->type == 2) $where.= " AND type = 2";
|
//if ($facture->type == 2) $where.= " AND type = 2";
|
||||||
//else $where.=" AND type != 2";
|
//else $where.=" AND type != 2";
|
||||||
|
|
||||||
// Get entities
|
// Get entities
|
||||||
$entity = getEntity('invoicenumber', 1, $invoice);
|
$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;
|
if (! preg_match('/([0-9])+/',$numFinal)) $this->error = $numFinal;
|
||||||
|
|
||||||
return $numFinal;
|
return $numFinal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user