FIX is_erasable report bad value when thirdparty was not loaded
This commit is contained in:
parent
7cf4ec772a
commit
436ec93084
@ -1753,9 +1753,9 @@ class Facture extends CommonInvoice
|
|||||||
global $langs,$conf;
|
global $langs,$conf;
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
|
|
||||||
if (empty($rowid)) $rowid=$this->id;
|
$rowid=$this->id;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::delete rowid=".$rowid, LOG_DEBUG);
|
dol_syslog(get_class($this)."::delete rowid=".$rowid.", ref=".$this->ref.", thirdparty=".$this->thirdparty->name, LOG_DEBUG);
|
||||||
|
|
||||||
// Test to avoid invoice deletion (allowed if draft)
|
// Test to avoid invoice deletion (allowed if draft)
|
||||||
$test = $this->is_erasable();
|
$test = $this->is_erasable();
|
||||||
@ -3227,7 +3227,7 @@ class Facture extends CommonInvoice
|
|||||||
|
|
||||||
if (! empty($conf->global->FACTURE_ADDON))
|
if (! empty($conf->global->FACTURE_ADDON))
|
||||||
{
|
{
|
||||||
dol_syslog("Call getNextNumRef with FACTURE_ADDON = ".$conf->global->FACTURE_ADDON);
|
dol_syslog("Call getNextNumRef with FACTURE_ADDON = ".$conf->global->FACTURE_ADDON.", thirdparty=".$soc->nom.", type=".$soc->typent_code, LOG_DEBUG);
|
||||||
|
|
||||||
$mybool=false;
|
$mybool=false;
|
||||||
|
|
||||||
@ -3399,6 +3399,9 @@ class Facture extends CommonInvoice
|
|||||||
// If not a draft invoice and not temporary invoice
|
// If not a draft invoice and not temporary invoice
|
||||||
if ($tmppart !== 'PROV')
|
if ($tmppart !== 'PROV')
|
||||||
{
|
{
|
||||||
|
// We need to have this->thirdparty defined, in case of numbering rule use tags that depend on thirdparty (like {t} tag).
|
||||||
|
if (empty($this->thirdparty)) $this->fetch_thirdparty();
|
||||||
|
|
||||||
$maxfacnumber = $this->getNextNumRef($this->thirdparty,'last');
|
$maxfacnumber = $this->getNextNumRef($this->thirdparty,'last');
|
||||||
$ventilExportCompta = $this->getVentilExportCompta();
|
$ventilExportCompta = $this->getVentilExportCompta();
|
||||||
|
|
||||||
|
|||||||
@ -723,7 +723,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
|
|||||||
// but we should use local year and month of user
|
// but we should use local year and month of user
|
||||||
|
|
||||||
// For debugging
|
// For debugging
|
||||||
dol_syslog("mask=".$mask);
|
//dol_syslog("mask=".$mask, LOG_DEBUG);
|
||||||
//include_once(DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php');
|
//include_once(DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php');
|
||||||
//$mask='FA{yy}{mm}-{0000@99}';
|
//$mask='FA{yy}{mm}-{0000@99}';
|
||||||
//$date=dol_mktime(12, 0, 0, 1, 1, 1900);
|
//$date=dol_mktime(12, 0, 0, 1, 1, 1900);
|
||||||
@ -1148,6 +1148,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
|
|||||||
dol_syslog("functions2::get_next_value return ".$numFinal,LOG_DEBUG);
|
dol_syslog("functions2::get_next_value return ".$numFinal,LOG_DEBUG);
|
||||||
return $numFinal;
|
return $numFinal;
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_string_between($string, $start, $end){
|
function get_string_between($string, $start, $end){
|
||||||
$string = " ".$string;
|
$string = " ".$string;
|
||||||
$ini = strpos($string,$start);
|
$ini = strpos($string,$start);
|
||||||
@ -1156,6 +1157,7 @@ function get_string_between($string, $start, $end){
|
|||||||
$len = strpos($string,$end,$ini) - $ini;
|
$len = strpos($string,$end,$ini) - $ini;
|
||||||
return substr($string,$ini,$len);
|
return substr($string,$ini,$len);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check value
|
* Check value
|
||||||
*
|
*
|
||||||
|
|||||||
@ -135,7 +135,6 @@ class FactureTest extends PHPUnit_Framework_TestCase
|
|||||||
$localobject=new Facture($this->savdb);
|
$localobject=new Facture($this->savdb);
|
||||||
$localobject->initAsSpecimen();
|
$localobject->initAsSpecimen();
|
||||||
$result=$localobject->create($user);
|
$result=$localobject->create($user);
|
||||||
|
|
||||||
$this->assertLessThan($result, 0);
|
$this->assertLessThan($result, 0);
|
||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." result=".$result."\n";
|
||||||
return $result;
|
return $result;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user