Merge branch 'develop' of https://github.com/Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
1b044fd9d6
@ -153,7 +153,7 @@ if ($action=='edit_carrier' || $action=='setvalue')
|
|||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<tr '.$bc[$var].'><td class="fieldrequired">';
|
print '<tr '.$bc[$var].'><td class="fieldrequired">';
|
||||||
print $langs->trans("Tracking").'</td><td>';
|
print $langs->trans("Tracking").'</td><td>';
|
||||||
print '<input size="128" type="text" name="tracking" value="'.$object->listmeths[0]['tracking'].'">';
|
print '<input size="80" type="text" name="tracking" value="'.$object->listmeths[0]['tracking'].'">';
|
||||||
print ' '.$langs->trans("Example").': http://www.website.com/dir/{TRACKID}';
|
print ' '.$langs->trans("Example").': http://www.website.com/dir/{TRACKID}';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
@ -194,7 +194,7 @@ else
|
|||||||
print '<td>'.$object->listmeths[$i]['code'].'</td>';
|
print '<td>'.$object->listmeths[$i]['code'].'</td>';
|
||||||
print '<td>'.$object->listmeths[$i]['libelle'].'</td>';
|
print '<td>'.$object->listmeths[$i]['libelle'].'</td>';
|
||||||
print '<td>'.$object->listmeths[$i]['description'].'</td>';
|
print '<td>'.$object->listmeths[$i]['description'].'</td>';
|
||||||
print '<td>'.$object->listmeths[$i]['tracking'].'</td>';
|
print '<td>'.dol_trunc($object->listmeths[$i]['tracking'],92,'middle').'</td>';
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
if($object->listmeths[$i]['active'] == 0)
|
if($object->listmeths[$i]['active'] == 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1611,7 +1611,7 @@ class Facture extends CommonInvoice
|
|||||||
$now=dol_now();
|
$now=dol_now();
|
||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
dol_syslog(get_class($this).'::validate user='.$user->id.', force_number='.$force_number.', idwarehouse='.$idwarehouse, LOG_WARNING);
|
dol_syslog(get_class($this).'::validate user='.$user->id.', force_number='.$force_number.', idwarehouse='.$idwarehouse);
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if (! $this->brouillon)
|
if (! $this->brouillon)
|
||||||
@ -2611,11 +2611,10 @@ class Facture extends CommonInvoice
|
|||||||
{
|
{
|
||||||
$maxfacnumber = $this->getNextNumRef($this->client,'last');
|
$maxfacnumber = $this->getNextNumRef($this->client,'last');
|
||||||
$ventilExportCompta = $this->getVentilExportCompta();
|
$ventilExportCompta = $this->getVentilExportCompta();
|
||||||
// Si derniere facture et si non ventilee, on peut supprimer
|
// If there is no invoice into the reset range and not already dispatched, we can delete
|
||||||
if ($maxfacnumber == $this->ref && $ventilExportCompta == 0)
|
if ($maxfacnumber == '' && $ventilExportCompta == 0) return 1;
|
||||||
{
|
// If invoice to delete is last one and not already dispatched, we can delete
|
||||||
return 1;
|
if ($maxfacnumber == $this->ref && $ventilExportCompta == 0) return 1;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if ($this->statut == 0 && $facref == 'PROV') // Si facture brouillon et provisoire
|
else if ($this->statut == 0 && $facref == 'PROV') // Si facture brouillon et provisoire
|
||||||
{
|
{
|
||||||
|
|||||||
@ -506,7 +506,7 @@ function array2table($data,$tableMarkup=1,$tableoptions='',$troptions='',$tdopti
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return next value for a mask
|
* Return last or next value for a mask (according to area we should not reset)
|
||||||
*
|
*
|
||||||
* @param DoliDB $db Database handler
|
* @param DoliDB $db Database handler
|
||||||
* @param string $mask Mask to use
|
* @param string $mask Mask to use
|
||||||
@ -688,7 +688,6 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
|
|||||||
$posnumstart=strpos($maskwithnocode,$maskcounter); // Pos of counter in final string (from 0 to ...)
|
$posnumstart=strpos($maskwithnocode,$maskcounter); // Pos of counter in final string (from 0 to ...)
|
||||||
if ($posnumstart < 0) return 'ErrorBadMaskFailedToLocatePosOfSequence';
|
if ($posnumstart < 0) return 'ErrorBadMaskFailedToLocatePosOfSequence';
|
||||||
$sqlstring='SUBSTRING('.$field.', '.($posnumstart+1).', '.dol_strlen($maskcounter).')';
|
$sqlstring='SUBSTRING('.$field.', '.($posnumstart+1).', '.dol_strlen($maskcounter).')';
|
||||||
//print "x".$sqlstring;
|
|
||||||
|
|
||||||
// Define $maskLike
|
// Define $maskLike
|
||||||
$maskLike = dol_string_nospecial($mask);
|
$maskLike = dol_string_nospecial($mask);
|
||||||
@ -701,7 +700,6 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
|
|||||||
$maskLike = preg_replace('/\{dd\}/i','__',$maskLike);
|
$maskLike = preg_replace('/\{dd\}/i','__',$maskLike);
|
||||||
$maskLike = str_replace(dol_string_nospecial('{'.$masktri.'}'),str_pad("",dol_strlen($maskcounter),"_"),$maskLike);
|
$maskLike = str_replace(dol_string_nospecial('{'.$masktri.'}'),str_pad("",dol_strlen($maskcounter),"_"),$maskLike);
|
||||||
if ($maskrefclient) $maskLike = str_replace(dol_string_nospecial('{'.$maskrefclient.'}'),str_pad("",dol_strlen($maskrefclient),"_"),$maskLike);
|
if ($maskrefclient) $maskLike = str_replace(dol_string_nospecial('{'.$maskrefclient.'}'),str_pad("",dol_strlen($maskrefclient),"_"),$maskLike);
|
||||||
//if ($masktype) $maskLike = str_replace(dol_string_nospecial('{'.$masktype.'}'),str_pad("",dol_strlen($masktype),"_"),$maskLike);
|
|
||||||
if ($masktype) $maskLike = str_replace(dol_string_nospecial('{'.$masktype.'}'),$masktype_value,$maskLike);
|
if ($masktype) $maskLike = str_replace(dol_string_nospecial('{'.$masktype.'}'),$masktype_value,$maskLike);
|
||||||
|
|
||||||
// Get counter in database
|
// Get counter in database
|
||||||
@ -715,7 +713,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
|
|||||||
if ($sqlwhere) $sql.=' AND '.$sqlwhere;
|
if ($sqlwhere) $sql.=' AND '.$sqlwhere;
|
||||||
|
|
||||||
//print $sql.'<br>';
|
//print $sql.'<br>';
|
||||||
dol_syslog("functions2::get_next_value sql=".$sql, LOG_DEBUG);
|
dol_syslog("functions2::get_next_value mode=".$mode." sql=".$sql, LOG_DEBUG);
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
@ -725,7 +723,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
|
|||||||
else dol_print_error($db);
|
else dol_print_error($db);
|
||||||
if (empty($counter) || preg_match('/[^0-9]/i',$counter)) $counter=$maskoffset;
|
if (empty($counter) || preg_match('/[^0-9]/i',$counter)) $counter=$maskoffset;
|
||||||
|
|
||||||
if ($mode == 'last')
|
if ($mode == 'last') // We found value for counter = last counter value. Now need to get corresponding ref of invoice.
|
||||||
{
|
{
|
||||||
$counterpadded=str_pad($counter,dol_strlen($maskcounter),"0",STR_PAD_LEFT);
|
$counterpadded=str_pad($counter,dol_strlen($maskcounter),"0",STR_PAD_LEFT);
|
||||||
|
|
||||||
@ -740,14 +738,16 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
|
|||||||
$maskLike = preg_replace('/\{dd\}/i','__',$maskLike);
|
$maskLike = preg_replace('/\{dd\}/i','__',$maskLike);
|
||||||
$maskLike = str_replace(dol_string_nospecial('{'.$masktri.'}'),$counterpadded,$maskLike);
|
$maskLike = str_replace(dol_string_nospecial('{'.$masktri.'}'),$counterpadded,$maskLike);
|
||||||
if ($maskrefclient) $maskLike = str_replace(dol_string_nospecial('{'.$maskrefclient.'}'),str_pad("",dol_strlen($maskrefclient),"_"),$maskLike);
|
if ($maskrefclient) $maskLike = str_replace(dol_string_nospecial('{'.$maskrefclient.'}'),str_pad("",dol_strlen($maskrefclient),"_"),$maskLike);
|
||||||
//if ($masktype) $maskLike = str_replace(dol_string_nospecial('{'.$masktype.'}'),str_pad("",dol_strlen($masktype),"_"),$maskLike);
|
|
||||||
if ($masktype) $maskLike = str_replace(dol_string_nospecial('{'.$masktype.'}'),$masktype_value,$maskLike);
|
if ($masktype) $maskLike = str_replace(dol_string_nospecial('{'.$masktype.'}'),$masktype_value,$maskLike);
|
||||||
|
|
||||||
$ref='';
|
$ref='';
|
||||||
$sql = "SELECT facnumber as ref";
|
$sql = "SELECT ".$field." as ref";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture";
|
$sql.= " FROM ".MAIN_DB_PREFIX.$table;
|
||||||
$sql.= " WHERE facnumber LIKE '".$maskLike."'";
|
$sql.= " WHERE ".$field." LIKE '".$maskLike."'";
|
||||||
|
$sql.= " AND ".$field." NOT LIKE '%PROV%'";
|
||||||
$sql.= " AND entity IN (".getEntity($table, 1).")";
|
$sql.= " AND entity IN (".getEntity($table, 1).")";
|
||||||
|
if ($where) $sql.=$where;
|
||||||
|
if ($sqlwhere) $sql.=' AND '.$sqlwhere;
|
||||||
|
|
||||||
dol_syslog("functions2::get_next_value sql=".$sql);
|
dol_syslog("functions2::get_next_value sql=".$sql);
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
|
|||||||
@ -110,6 +110,14 @@ ALTER TABLE llx_c_shipment_mode ADD COLUMN tracking VARCHAR(256) NOT NULL DEFAUL
|
|||||||
-- VMYSQL4.3 ALTER TABLE llx_c_shipment_mode CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT;
|
-- VMYSQL4.3 ALTER TABLE llx_c_shipment_mode CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT;
|
||||||
-- VPGSQL8.2 DROP table llx_c_shipment_mode;
|
-- VPGSQL8.2 DROP table llx_c_shipment_mode;
|
||||||
-- VPGSQL8.2 CREATE TABLE llx_c_shipment_mode (rowid SERIAL PRIMARY KEY, tms timestamp, code varchar(30) NOT NULL, libelle varchar(50) NOT NULL, description text, tracking varchar(256) NOT NULL, active integer DEFAULT 0, module varchar(32) NULL);
|
-- VPGSQL8.2 CREATE TABLE llx_c_shipment_mode (rowid SERIAL PRIMARY KEY, tms timestamp, code varchar(30) NOT NULL, libelle varchar(50) NOT NULL, description text, tracking varchar(256) NOT NULL, active integer DEFAULT 0, module varchar(32) NULL);
|
||||||
|
-- VPGSQL8.2 INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (1,'CATCH','Catch','Catch by client','',1);
|
||||||
|
-- VPGSQL8.2 INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (2,'TRANS','Transporter','Generic transporter','',1);
|
||||||
|
-- VPGSQL8.2 INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (3,'COLSUI','Colissimo Suivi','Colissimo Suivi','',0);
|
||||||
|
-- VPGSQL8.2 INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (4,'LETTREMAX','Lettre Max','Courrier Suivi et Lettre Max','',0);
|
||||||
|
-- VPGSQL8.2 INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (5,'UPS','UPS','United Parcel Service','http://wwwapps.ups.com/etracking/tracking.cgi?InquiryNumber2=&InquiryNumber3=&tracknums_displayed=3&loc=fr_FR&TypeOfInquiryNumber=T&HTMLVersion=4.0&InquiryNumber22=&InquiryNumber32=&track=Track&Suivi.x=64&Suivi.y=7&Suivi=Valider&InquiryNumber1={TRACKID}',0);
|
||||||
|
-- VPGSQL8.2 INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (6,'KIALA','KIALA','Relais Kiala','http://www.kiala.fr/tnt/delivery/{TRACKID}',0);
|
||||||
|
-- VPGSQL8.2 INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (7,'GLS','GLS','General Logistics Systems','http://www.gls-group.eu/276-I-PORTAL-WEB/content/GLS/FR01/FR/5004.htm?txtAction=71000&txtRefNo={TRACKID}',0);
|
||||||
|
-- VPGSQL8.2 INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (8,'CHRONO','Chronopost','Chronopost','http://www.chronopost.fr/expedier/inputLTNumbersNoJahia.do?listeNumeros={TRACKID}',0);
|
||||||
|
|
||||||
-- and create the new index and constraint
|
-- and create the new index and constraint
|
||||||
ALTER TABLE llx_expedition ADD INDEX idx_expedition_fk_shipping_method (fk_shipping_method);
|
ALTER TABLE llx_expedition ADD INDEX idx_expedition_fk_shipping_method (fk_shipping_method);
|
||||||
|
|||||||
@ -127,8 +127,32 @@ class Functions2Test extends PHPUnit_Framework_TestCase
|
|||||||
$result=jsUnEscape('%u03BD%u03B5%u03BF');
|
$result=jsUnEscape('%u03BD%u03B5%u03BF');
|
||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." result=".$result."\n";
|
||||||
$this->assertEquals('νεο',$result);
|
$this->assertEquals('νεο',$result);
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* isValidMailDomain
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testIsValidMailDomain()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* isValidURL
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testIsValidUrl()
|
||||||
|
{
|
||||||
|
$result=isValidUrl('http://www.google.com',1);
|
||||||
|
print __METHOD__." result=".$result."\n";
|
||||||
|
$this->assertEquals(1,$result);
|
||||||
|
$result=isValidUrl('www.google.com',2);
|
||||||
|
print __METHOD__." result=".$result."\n";
|
||||||
|
$this->assertEquals(0,$result);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@ -131,6 +131,7 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
// First we try with a simple mask, with no reset
|
// First we try with a simple mask, with no reset
|
||||||
// and we test counter is still increase second year.
|
// and we test counter is still increase second year.
|
||||||
|
$conf->global->FACTURE_ADDON='mercure';
|
||||||
$conf->global->FACTURE_MERCURE_MASK_CREDIT='{yyyy}-{0000}';
|
$conf->global->FACTURE_MERCURE_MASK_CREDIT='{yyyy}-{0000}';
|
||||||
$conf->global->FACTURE_MERCURE_MASK_INVOICE='{yyyy}-{0000}';
|
$conf->global->FACTURE_MERCURE_MASK_INVOICE='{yyyy}-{0000}';
|
||||||
|
|
||||||
@ -140,17 +141,31 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase
|
|||||||
$numbering=new mod_facture_mercure();
|
$numbering=new mod_facture_mercure();
|
||||||
$result=$numbering->getNextValue($mysoc, $localobject);
|
$result=$numbering->getNextValue($mysoc, $localobject);
|
||||||
$result2=$localobject->create($user,1);
|
$result2=$localobject->create($user,1);
|
||||||
$result3=$localobject->validate($user, $result);
|
$result3=$localobject->validate($user, $result); // create invoice by forcing ref
|
||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." result=".$result."\n";
|
||||||
$this->assertEquals('1915-0001', $result); // counter must start to 1
|
$this->assertEquals('1915-0001', $result); // counter must start to 1
|
||||||
|
$result=$localobject->is_erasable();
|
||||||
|
print __METHOD__." is_erasable=".$result."\n";
|
||||||
|
$this->assertEquals(1, $result); // Can be deleted
|
||||||
|
|
||||||
$localobject=new Facture($this->savdb);
|
$localobject2=new Facture($this->savdb);
|
||||||
$localobject->initAsSpecimen();
|
$localobject2->initAsSpecimen();
|
||||||
$localobject->date=dol_mktime(12, 0, 0, 1, 1, 1916); // we use following year for second invoice
|
$localobject2->date=dol_mktime(12, 0, 0, 1, 1, 1916); // we use following year for second invoice (there is no reset into mask)
|
||||||
$numbering=new mod_facture_mercure();
|
$numbering=new mod_facture_mercure();
|
||||||
$result=$numbering->getNextValue($mysoc, $localobject);
|
$result=$numbering->getNextValue($mysoc, $localobject2, 'last');
|
||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." result=".$result."\n";
|
||||||
$this->assertEquals('1916-0002', $result); // counter must not be reset
|
$this->assertEquals('1915-0001', $result);
|
||||||
|
$result=$numbering->getNextValue($mysoc, $localobject2);
|
||||||
|
$result2=$localobject2->create($user,1);
|
||||||
|
$result3=$localobject2->validate($user, $result); // create invoice by forcing ref
|
||||||
|
print __METHOD__." result=".$result."\n";
|
||||||
|
$this->assertEquals('1916-0002', $result); // counter must not be reseted so be 2
|
||||||
|
$result=$localobject2->is_erasable();
|
||||||
|
print __METHOD__." is_erasable=".$result."\n";
|
||||||
|
$this->assertEquals(1, $result); // Can be deleted
|
||||||
|
$result=$localobject->is_erasable();
|
||||||
|
print __METHOD__." is_erasable=".$result."\n";
|
||||||
|
$this->assertEquals(0, $result); // Case 1 can not be deleted (case 2 is more recent)
|
||||||
|
|
||||||
// Now we try with a reset
|
// Now we try with a reset
|
||||||
$conf->global->FACTURE_MERCURE_MASK_CREDIT='{yyyy}-{0000@1}';
|
$conf->global->FACTURE_MERCURE_MASK_CREDIT='{yyyy}-{0000@1}';
|
||||||
@ -162,7 +177,7 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase
|
|||||||
$numbering=new mod_facture_mercure();
|
$numbering=new mod_facture_mercure();
|
||||||
$result=$numbering->getNextValue($mysoc, $localobject);
|
$result=$numbering->getNextValue($mysoc, $localobject);
|
||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." result=".$result."\n";
|
||||||
$this->assertEquals('1910-0001', $result); // counter must start to 1
|
$this->assertEquals('1910-0001', $result); // counter must start to 1
|
||||||
|
|
||||||
// Same mask but we add month
|
// Same mask but we add month
|
||||||
$conf->global->FACTURE_MERCURE_MASK_CREDIT='{yyyy}{mm}-{0000@1}';
|
$conf->global->FACTURE_MERCURE_MASK_CREDIT='{yyyy}{mm}-{0000@1}';
|
||||||
@ -175,15 +190,26 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase
|
|||||||
$result2=$localobject->create($user,1);
|
$result2=$localobject->create($user,1);
|
||||||
$result3=$localobject->validate($user, $result);
|
$result3=$localobject->validate($user, $result);
|
||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." result=".$result."\n";
|
||||||
$this->assertEquals('192001-0001', $result); // counter must start to 1
|
$this->assertEquals('192001-0001', $result); // counter must start to 1
|
||||||
|
$result=$localobject->is_erasable();
|
||||||
|
print __METHOD__." is_erasable=".$result."\n";
|
||||||
|
$this->assertEquals(1, $result); // Can be deleted
|
||||||
|
|
||||||
$localobject=new Facture($this->savdb);
|
$localobject2=new Facture($this->savdb);
|
||||||
$localobject->initAsSpecimen();
|
$localobject2->initAsSpecimen();
|
||||||
$localobject->date=dol_mktime(12, 0, 0, 1, 1, 1921); // we use following year for second invoice
|
$localobject2->date=dol_mktime(12, 0, 0, 1, 1, 1921); // we use following year for second invoice (and there is a reset required)
|
||||||
$numbering=new mod_facture_mercure();
|
$numbering=new mod_facture_mercure();
|
||||||
$result=$numbering->getNextValue($mysoc, $localobject);
|
$result=$numbering->getNextValue($mysoc, $localobject2);
|
||||||
print __METHOD__." result=".$result."\n";
|
$result2=$localobject2->create($user,1);
|
||||||
$this->assertEquals('192101-0001', $result); // counter must be resete to 1
|
$result3=$localobject2->validate($user, $result);
|
||||||
|
print __METHOD__." result=".$result."\n";
|
||||||
|
$this->assertEquals('192101-0001', $result); // counter must be reseted to 1
|
||||||
|
$result=$localobject2->is_erasable();
|
||||||
|
print __METHOD__." is_erasable=".$result."\n";
|
||||||
|
$this->assertEquals(1, $result); // Can be deleted
|
||||||
|
$result=$localobject->is_erasable();
|
||||||
|
print __METHOD__." is_erasable=".$result."\n";
|
||||||
|
$this->assertEquals(1, $result); // Case 1 can be deleted (because there was a reset for case 2)
|
||||||
|
|
||||||
|
|
||||||
// Now we try with a different fiscal month (forced by mask)
|
// Now we try with a different fiscal month (forced by mask)
|
||||||
@ -194,16 +220,25 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase
|
|||||||
$localobject->initAsSpecimen();
|
$localobject->initAsSpecimen();
|
||||||
$localobject->date=dol_mktime(12, 0, 0, 1, 1, 1930); // we use year 1930 to be sure to not have existing invoice for this year
|
$localobject->date=dol_mktime(12, 0, 0, 1, 1, 1930); // we use year 1930 to be sure to not have existing invoice for this year
|
||||||
$numbering=new mod_facture_mercure();
|
$numbering=new mod_facture_mercure();
|
||||||
|
$result=$numbering->getNextValue($mysoc, $localobject, 'last');
|
||||||
|
print __METHOD__." result for last=".$result."\n";
|
||||||
|
$this->assertEquals('', $result); // no existing ref into reset range
|
||||||
$result=$numbering->getNextValue($mysoc, $localobject);
|
$result=$numbering->getNextValue($mysoc, $localobject);
|
||||||
$result2=$localobject->create($user,1);
|
$result2=$localobject->create($user,1);
|
||||||
$result3=$localobject->validate($user, $result);
|
$result3=$localobject->validate($user, $result);
|
||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." result=".$result."\n";
|
||||||
$this->assertEquals('193001-0001', $result); // counter must start to 1
|
$this->assertEquals('193001-0001', $result); // counter must start to 1
|
||||||
|
$result=$numbering->getNextValue($mysoc, $localobject, 'last');
|
||||||
|
print __METHOD__." result for last=".$result."\n";
|
||||||
|
$this->assertEquals('193001-0001', $result); // last ref into reset range should be same than last created
|
||||||
|
|
||||||
$localobject=new Facture($this->savdb);
|
$localobject=new Facture($this->savdb);
|
||||||
$localobject->initAsSpecimen();
|
$localobject->initAsSpecimen();
|
||||||
$localobject->date=dol_mktime(12, 0, 0, 12, 1, 1930); // we use same year but fiscal month after
|
$localobject->date=dol_mktime(12, 0, 0, 12, 1, 1930); // we use same year but fiscal month after
|
||||||
$numbering=new mod_facture_mercure();
|
$numbering=new mod_facture_mercure();
|
||||||
|
$result=$numbering->getNextValue($mysoc, $localobject, 'last');
|
||||||
|
print __METHOD__." result for last=".$result."\n";
|
||||||
|
$this->assertEquals('', $result); // last ref into reset range should be ''
|
||||||
$result=$numbering->getNextValue($mysoc, $localobject);
|
$result=$numbering->getNextValue($mysoc, $localobject);
|
||||||
$result2=$localobject->create($user,1);
|
$result2=$localobject->create($user,1);
|
||||||
$result3=$localobject->validate($user, $result);
|
$result3=$localobject->validate($user, $result);
|
||||||
@ -222,7 +257,7 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
$localobject=new Facture($this->savdb);
|
$localobject=new Facture($this->savdb);
|
||||||
$localobject->initAsSpecimen();
|
$localobject->initAsSpecimen();
|
||||||
$localobject->date=dol_mktime(12, 0, 0, 12, 1, 1931); // we use different discal year but same year
|
$localobject->date=dol_mktime(12, 0, 0, 12, 1, 1931); // we use different fiscal year but same year
|
||||||
$numbering=new mod_facture_mercure();
|
$numbering=new mod_facture_mercure();
|
||||||
$result=$numbering->getNextValue($mysoc, $localobject);
|
$result=$numbering->getNextValue($mysoc, $localobject);
|
||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." result=".$result."\n";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user