mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Merge branch '17.0' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
ec45cb23ac
|
|
@ -72,10 +72,6 @@ jobs:
|
|||
if: type = pull_request OR type = push
|
||||
php: '8.1'
|
||||
env: DB=mysql
|
||||
- stage: PHP Dev
|
||||
if: type = push AND branch = develop
|
||||
php: nightly
|
||||
env: DB=mysql
|
||||
- stage: PHP Dev
|
||||
if: type = push AND branch = 17.0
|
||||
php: nightly
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013-2023 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
|
|
@ -437,6 +437,9 @@ if (empty($reshook)) {
|
|||
|
||||
$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS', 2);
|
||||
$remise_percent = price2num(GETPOST('remise_percent'.$predef), '', 2);
|
||||
if (empty($remise_percent)) {
|
||||
$remise_percent = 0;
|
||||
}
|
||||
|
||||
// Extrafields
|
||||
$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
|
||||
|
|
@ -784,6 +787,9 @@ if (empty($reshook)) {
|
|||
}*/
|
||||
|
||||
$remise_percent = price2num(GETPOST('remise_percent'), '', 2);
|
||||
if (empty($remise_percent)) {
|
||||
$remise_percent = 0;
|
||||
}
|
||||
|
||||
// Check minimum price
|
||||
$productid = GETPOST('productid', 'int');
|
||||
|
|
|
|||
|
|
@ -3578,6 +3578,7 @@ class Facture extends CommonInvoice
|
|||
|
||||
/**
|
||||
* Add an invoice line into database (linked to product/service or not).
|
||||
* Note: ->thirdparty must be defined.
|
||||
* Les parametres sont deja cense etre juste et avec valeurs finales a l'appel
|
||||
* de cette methode. Aussi, pour le taux tva, il doit deja avoir ete defini
|
||||
* par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,produit)
|
||||
|
|
|
|||
|
|
@ -7947,7 +7947,13 @@ class Form
|
|||
}
|
||||
|
||||
// Add where from hooks
|
||||
$parameters = array();
|
||||
$parameters = array(
|
||||
'object' => $objecttmp,
|
||||
'htmlname' => $htmlname,
|
||||
'filter' => $filter,
|
||||
'searchkey' => $searchkey
|
||||
);
|
||||
|
||||
$reshook = $hookmanager->executeHooks('selectForFormsListWhere', $parameters); // Note that $action and $object may have been modified by hook
|
||||
if (!empty($hookmanager->resPrint)) {
|
||||
$sql .= $hookmanager->resPrint;
|
||||
|
|
|
|||
|
|
@ -989,15 +989,15 @@ class FormCompany extends Form
|
|||
// phpcs:enable
|
||||
$tax = get_localtax_by_third($local);
|
||||
|
||||
$num = $this->db->num_rows($tax);
|
||||
$i = 0;
|
||||
if ($num) {
|
||||
if ($tax) {
|
||||
$valors = explode(":", $tax);
|
||||
$nbvalues = count($valors);
|
||||
|
||||
if (count($valors) > 1) {
|
||||
if ($nbvalues > 1) {
|
||||
//montar select
|
||||
print '<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'">';
|
||||
while ($i <= (count($valors)) - 1) {
|
||||
$i = 0;
|
||||
while ($i < $nbvalues) {
|
||||
if ($selected == $valors[$i]) {
|
||||
print '<option value="'.$valors[$i].'" selected>';
|
||||
} else {
|
||||
|
|
@ -1007,7 +1007,7 @@ class FormCompany extends Form
|
|||
print '</option>';
|
||||
$i++;
|
||||
}
|
||||
print'</select>';
|
||||
print '</select>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6190,30 +6190,30 @@ function isOnlyOneLocalTax($local)
|
|||
/**
|
||||
* Get values of localtaxes (1 or 2) for company country for the common vat with the highest value
|
||||
*
|
||||
* @param int $local LocalTax to get
|
||||
* @return number Values of localtax
|
||||
* @param int $local LocalTax to get
|
||||
* @return string Values of localtax (Can be '20', '-19:-15:-9')
|
||||
*/
|
||||
function get_localtax_by_third($local)
|
||||
{
|
||||
global $db, $mysoc;
|
||||
$sql = "SELECT t.localtax1, t.localtax2 ";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t inner join ".MAIN_DB_PREFIX."c_country as c ON c.rowid=t.fk_pays";
|
||||
$sql .= " WHERE c.code = '".$db->escape($mysoc->country_code)."' AND t.active = 1 AND t.taux=(";
|
||||
$sql .= " SELECT max(tt.taux) FROM ".MAIN_DB_PREFIX."c_tva as tt inner join ".MAIN_DB_PREFIX."c_country as c ON c.rowid=tt.fk_pays";
|
||||
$sql .= " WHERE c.code = '".$db->escape($mysoc->country_code)."' AND tt.active = 1";
|
||||
$sql .= " )";
|
||||
|
||||
$sql = " SELECT t.localtax".$local." as localtax";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t INNER JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = t.fk_pays";
|
||||
$sql .= " WHERE c.code = '".$db->escape($mysoc->country_code)."' AND t.active = 1 AND t.taux = (";
|
||||
$sql .= "SELECT MAX(tt.taux) FROM ".MAIN_DB_PREFIX."c_tva as tt INNER JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = tt.fk_pays";
|
||||
$sql .= " WHERE c.code = '".$db->escape($mysoc->country_code)."' AND tt.active = 1)";
|
||||
$sql .= " AND t.localtax".$local."_type <> '0'";
|
||||
$sql .= " ORDER BY t.rowid DESC";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($local == 1) {
|
||||
return $obj->localtax1;
|
||||
} elseif ($local == 2) {
|
||||
return $obj->localtax2;
|
||||
}
|
||||
return $obj->localtax;
|
||||
} else {
|
||||
return 'Error';
|
||||
}
|
||||
|
||||
return 0;
|
||||
return '0';
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -6322,10 +6322,12 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi
|
|||
}
|
||||
|
||||
$sql .= ", ".MAIN_DB_PREFIX."c_country as c";
|
||||
if ($mysoc->country_code == 'ES') {
|
||||
$sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$db->escape($buyer->country_code)."'"; // local tax in spain use the buyer country ??
|
||||
if (!empty($mysoc) && $mysoc->country_code == 'ES') {
|
||||
$countrycodetouse = ((empty($buyer) || empty($buyer->country_code)) ? $mysoc->country_code : $buyer->country_code);
|
||||
$sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$db->escape($countrycodetouse)."'"; // local tax in spain use the buyer country ??
|
||||
} else {
|
||||
$sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$db->escape(empty($seller->country_code) ? $mysoc->country_code : $seller->country_code)."'";
|
||||
$countrycodetouse = ((empty($seller) || empty($seller->country_code)) ? $mysoc->country_code : $seller->country_code);
|
||||
$sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$db->escape($countrycodetouse)."'";
|
||||
}
|
||||
$sql .= " AND t.taux = ".((float) $vatratecleaned)." AND t.active = 1";
|
||||
if ($vatratecode) {
|
||||
|
|
|
|||
|
|
@ -561,3 +561,6 @@ ALTER TABLE llx_bank ADD COLUMN amount_main_currency double(24,8) NULL;
|
|||
|
||||
ALTER TABLE llx_commande_fournisseurdet MODIFY COLUMN ref varchar(128);
|
||||
ALTER TABLE llx_facture_fourn_det MODIFY COLUMN ref varchar(128);
|
||||
|
||||
UPDATE llx_c_tva SET localtax2 = '-19:-15:-9' WHERE localtax2 = '-19' AND localtax2_type = '5' AND fk_pays = 4 AND taux = 21;
|
||||
|
||||
|
|
|
|||
|
|
@ -124,15 +124,15 @@ class PriceParser
|
|||
*/
|
||||
public function parseExpression($product, $expression, $values)
|
||||
{
|
||||
global $user;
|
||||
global $hookmanager;
|
||||
global $user, $hookmanager, $extrafields;
|
||||
|
||||
$action = 'PARSEEXPRESSION';
|
||||
if ($result = $hookmanager->executeHooks('doDynamiPrice', array(
|
||||
'expression' =>$expression,
|
||||
'product' => $product,
|
||||
'values' => $values
|
||||
if ($reshook = $hookmanager->executeHooks('doDynamiPrice', array(
|
||||
'expression' => &$expression,
|
||||
'product' => &$product,
|
||||
'values' => &$values
|
||||
), $this, $action)) {
|
||||
return $result;
|
||||
return $hookmanager->resArray['return'];
|
||||
}
|
||||
//Check if empty
|
||||
$expression = trim($expression);
|
||||
|
|
@ -154,8 +154,12 @@ class PriceParser
|
|||
"pmp" => $product->pmp,
|
||||
));
|
||||
|
||||
//Retrieve all extrafield for product and add it to values
|
||||
$extrafields = new ExtraFields($this->db);
|
||||
// Retrieve all extrafields if not already not know (should not happen)
|
||||
if (! is_object($extrafields)) {
|
||||
$extrafields = new ExtraFields($this->db);
|
||||
$extrafields->fetch_name_optionals_label();
|
||||
}
|
||||
|
||||
$product->fetch_optionals();
|
||||
if (is_array($extrafields->attributes[$product->table_element]['label'])) {
|
||||
foreach ($extrafields->attributes[$product->table_element]['label'] as $key => $label) {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (C) 2004-2019 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2012-2016 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2013-2019 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013-2023 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2013 Jean Heimburger <jean@tiaris.info>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
|
|
@ -1374,6 +1374,7 @@ while ($i < $imaxinloop) {
|
|||
$product_static->ref_fourn = empty($obj->ref_supplier) ? '' : $obj->ref_supplier; // deprecated
|
||||
$product_static->ref_supplier = empty($obj->ref_supplier) ? '' : $obj->ref_supplier;
|
||||
$product_static->label = $obj->label;
|
||||
$product_static->barcode = $obj->barcode;
|
||||
$product_static->finished = $obj->finished;
|
||||
$product_static->type = $obj->fk_product_type;
|
||||
$product_static->status_buy = $obj->tobuy;
|
||||
|
|
|
|||
|
|
@ -1383,7 +1383,7 @@ class Ticket extends CommonObject
|
|||
public function LibStatut($status, $mode = 0, $notooltip = 0, $progress = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
global $langs, $hookmanager;
|
||||
|
||||
$labelStatus = $this->statuts[$status];
|
||||
$labelStatusShort = $this->statuts_short[$status];
|
||||
|
|
@ -1411,6 +1411,18 @@ class Ticket extends CommonObject
|
|||
$mode = 0;
|
||||
}
|
||||
|
||||
$parameters = array(
|
||||
'status' => $status,
|
||||
'mode' => $mode,
|
||||
);
|
||||
|
||||
// Note that $action and $object may have been modified by hook
|
||||
$reshook = $hookmanager->executeHooks('LibStatut', $parameters, $this);
|
||||
|
||||
if ($reshook > 0) {
|
||||
return $hookmanager->resPrint;
|
||||
}
|
||||
|
||||
$params = array();
|
||||
if ($notooltip) {
|
||||
$params = array('tooltip' => 'no');
|
||||
|
|
|
|||
|
|
@ -80,6 +80,7 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase
|
|||
protected $savuser;
|
||||
protected $savlangs;
|
||||
protected $savdb;
|
||||
protected $savmysoc;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
|
@ -92,11 +93,12 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase
|
|||
parent::__construct();
|
||||
|
||||
//$this->sharedFixture
|
||||
global $conf,$user,$langs,$db;
|
||||
global $conf,$user,$langs,$db,$mysoc;
|
||||
$this->savconf=$conf;
|
||||
$this->savuser=$user;
|
||||
$this->savlangs=$langs;
|
||||
$this->savdb=$db;
|
||||
$this->savmysoc=$mysoc;
|
||||
|
||||
print __METHOD__." db->type=".$db->type." user->id=".$user->id;
|
||||
//print " - db ".$db->db;
|
||||
|
|
@ -142,17 +144,18 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase
|
|||
}
|
||||
|
||||
/**
|
||||
* Init phpunit tests
|
||||
* Init phpunit tests. Restore variables before each test.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
global $conf,$user,$langs,$db,$mysoc;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
$mysoc=$this->savmysoc;
|
||||
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
|
|
@ -1233,7 +1236,6 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase
|
|||
// We do same tests but with option SERVICE_ARE_ECOMMERCE_200238EC on.
|
||||
$conf->global->SERVICE_ARE_ECOMMERCE_200238EC = 1;
|
||||
|
||||
|
||||
// Test RULE 1 (FR-US)
|
||||
$vat=get_default_tva($companyfr, $companyus, 0);
|
||||
$this->assertEquals(0, $vat, 'RULE 1 ECOMMERCE_200238EC');
|
||||
|
|
@ -1256,7 +1258,7 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase
|
|||
}
|
||||
|
||||
/**
|
||||
* testGetDefaultTva
|
||||
* testGetDefaultLocalTax
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
|
@ -1343,6 +1345,27 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* testGetLocalTaxByThird
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetLocalTaxByThird()
|
||||
{
|
||||
global $mysoc;
|
||||
|
||||
$mysoc->country_code = 'ES';
|
||||
|
||||
$result = get_localtax_by_third(1);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals('5.2', $result);
|
||||
|
||||
$result = get_localtax_by_third(2);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals('-19:-15:-9', $result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* testDolExplodeIntoArray
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
/* Copyright (C) 2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2012-2023 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -152,6 +152,8 @@ class NumberingModulesTest extends PHPUnit\Framework\TestCase
|
|||
|
||||
$localobject=new Facture($this->savdb);
|
||||
$localobject->initAsSpecimen();
|
||||
$localobject->fetch_thirdparty();
|
||||
|
||||
$localobject->date=dol_mktime(12, 0, 0, 1, 1, 1915); // we use year 1915 to be sure to not have existing invoice for this year (usefull only if numbering is {0000@1}
|
||||
$numbering=new mod_facture_mercure();
|
||||
$result=$numbering->getNextValue($mysoc, $localobject);
|
||||
|
|
@ -165,8 +167,11 @@ class NumberingModulesTest extends PHPUnit\Framework\TestCase
|
|||
$result=$localobject->is_erasable();
|
||||
print __METHOD__." is_erasable=".$result."\n";
|
||||
$this->assertGreaterThanOrEqual(1, $result, 'Test for is_erasable, 1st invoice'); // Can be deleted
|
||||
|
||||
$localobject2=new Facture($this->savdb);
|
||||
$localobject2->initAsSpecimen();
|
||||
$localobject2->fetch_thirdparty();
|
||||
|
||||
$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();
|
||||
$result=$numbering->getNextValue($mysoc, $localobject2, 'last');
|
||||
|
|
@ -193,6 +198,8 @@ class NumberingModulesTest extends PHPUnit\Framework\TestCase
|
|||
|
||||
$localobject=new Facture($this->savdb);
|
||||
$localobject->initAsSpecimen();
|
||||
$localobject->fetch_thirdparty();
|
||||
|
||||
$localobject->date=dol_mktime(12, 0, 0, 1, 1, 1910); // we use year 1910 to be sure to not have existing invoice for this year
|
||||
$numbering=new mod_facture_mercure();
|
||||
$result=$numbering->getNextValue($mysoc, $localobject);
|
||||
|
|
@ -200,15 +207,21 @@ class NumberingModulesTest extends PHPUnit\Framework\TestCase
|
|||
$result3=$localobject->validate($user, $result);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals('1910-0001', $result, 'Test for {yyyy}-{0000@1} 1st invoice'); // counter must start to 1
|
||||
|
||||
$localobject2=new Facture($this->savdb);
|
||||
$localobject2->initAsSpecimen();
|
||||
$localobject2->fetch_thirdparty();
|
||||
|
||||
$localobject2->date=dol_mktime(12, 0, 0, 1, 1, 1910); // we use same year for second invoice (and there is a reset required)
|
||||
$numbering=new mod_facture_mercure();
|
||||
$result=$numbering->getNextValue($mysoc, $localobject2);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals('1910-0002', $result, 'Test for {yyyy}-{0000@1} 2nd invoice, same day'); // counter must be now 2
|
||||
|
||||
$localobject3=new Facture($this->savdb);
|
||||
$localobject3->initAsSpecimen();
|
||||
$localobject3->fetch_thirdparty();
|
||||
|
||||
$localobject3->date=dol_mktime(12, 0, 0, 1, 1, 1911); // we use next year for third invoice (and there is a reset required)
|
||||
$numbering=new mod_facture_mercure();
|
||||
$result=$numbering->getNextValue($mysoc, $localobject3);
|
||||
|
|
@ -218,8 +231,11 @@ class NumberingModulesTest extends PHPUnit\Framework\TestCase
|
|||
// Same but we add month after year
|
||||
$conf->global->FACTURE_MERCURE_MASK_CREDIT='{yyyy}{mm}-{0000@1}';
|
||||
$conf->global->FACTURE_MERCURE_MASK_INVOICE='{yyyy}{mm}-{0000@1}';
|
||||
|
||||
$localobject=new Facture($this->savdb);
|
||||
$localobject->initAsSpecimen();
|
||||
$localobject->fetch_thirdparty();
|
||||
|
||||
$localobject->date=dol_mktime(12, 0, 0, 1, 1, 1920); // we use year 1920 to be sure to not have existing invoice for this year
|
||||
$numbering=new mod_facture_mercure();
|
||||
$result=$numbering->getNextValue($mysoc, $localobject);
|
||||
|
|
@ -230,8 +246,11 @@ class NumberingModulesTest extends PHPUnit\Framework\TestCase
|
|||
$result=$localobject->is_erasable();
|
||||
print __METHOD__." is_erasable=".$result."\n";
|
||||
$this->assertGreaterThanOrEqual(1, $result); // Can be deleted
|
||||
|
||||
$localobject2=new Facture($this->savdb);
|
||||
$localobject2->initAsSpecimen();
|
||||
$localobject2->fetch_thirdparty();
|
||||
|
||||
$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();
|
||||
$result=$numbering->getNextValue($mysoc, $localobject2);
|
||||
|
|
@ -251,6 +270,7 @@ class NumberingModulesTest extends PHPUnit\Framework\TestCase
|
|||
$conf->global->FACTURE_MERCURE_MASK_INVOICE='{mm}{yy}-{0000@1}';
|
||||
$localobject=new Facture($this->savdb);
|
||||
$localobject->initAsSpecimen();
|
||||
$localobject->fetch_thirdparty();
|
||||
$localobject->date=dol_mktime(12, 0, 0, 1, 1, 1925); // we use year 1925 to be sure to not have existing invoice for this year
|
||||
$numbering=new mod_facture_mercure();
|
||||
$result=$numbering->getNextValue($mysoc, $localobject);
|
||||
|
|
@ -261,8 +281,10 @@ class NumberingModulesTest extends PHPUnit\Framework\TestCase
|
|||
$result=$localobject->is_erasable(); // This call get getNextNumRef with param 'last'
|
||||
print __METHOD__." is_erasable=".$result."\n";
|
||||
$this->assertGreaterThanOrEqual(1, $result); // Can be deleted
|
||||
|
||||
$localobject2=new Facture($this->savdb);
|
||||
$localobject2->initAsSpecimen();
|
||||
$localobject2->fetch_thirdparty();
|
||||
$localobject2->date=dol_mktime(12, 0, 0, 1, 1, 1925); // we use same year 1925 for second invoice (and there is a reset required)
|
||||
$numbering=new mod_facture_mercure();
|
||||
$result=$numbering->getNextValue($mysoc, $localobject2);
|
||||
|
|
@ -276,8 +298,10 @@ class NumberingModulesTest extends PHPUnit\Framework\TestCase
|
|||
$result=$localobject->is_erasable();
|
||||
print __METHOD__." is_erasable=".$result."\n";
|
||||
$this->assertLessThanOrEqual(0, $result); // Case 1 can not be deleted (because there is an invoice 2)
|
||||
|
||||
$localobject3=new Facture($this->savdb);
|
||||
$localobject3->initAsSpecimen();
|
||||
$localobject3->fetch_thirdparty();
|
||||
$localobject3->date=dol_mktime(12, 0, 0, 1, 1, 1926); // we use following year for third invoice (and there is a reset required)
|
||||
$numbering=new mod_facture_mercure();
|
||||
$result=$numbering->getNextValue($mysoc, $localobject3);
|
||||
|
|
@ -295,6 +319,8 @@ class NumberingModulesTest extends PHPUnit\Framework\TestCase
|
|||
|
||||
$localobject=new Facture($this->savdb);
|
||||
$localobject->initAsSpecimen();
|
||||
$localobject->fetch_thirdparty();
|
||||
|
||||
$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();
|
||||
$result=$numbering->getNextValue($mysoc, $localobject, 'last');
|
||||
|
|
@ -311,6 +337,8 @@ class NumberingModulesTest extends PHPUnit\Framework\TestCase
|
|||
|
||||
$localobject=new Facture($this->savdb);
|
||||
$localobject->initAsSpecimen();
|
||||
$localobject->fetch_thirdparty();
|
||||
|
||||
$localobject->date=dol_mktime(12, 0, 0, 12, 1, 1930); // we use same year but fiscal month after
|
||||
$numbering=new mod_facture_mercure();
|
||||
$result=$numbering->getNextValue($mysoc, $localobject, 'last');
|
||||
|
|
@ -324,6 +352,8 @@ class NumberingModulesTest extends PHPUnit\Framework\TestCase
|
|||
|
||||
$localobject=new Facture($this->savdb);
|
||||
$localobject->initAsSpecimen();
|
||||
$localobject->fetch_thirdparty();
|
||||
|
||||
$localobject->date=dol_mktime(12, 0, 0, 1, 1, 1931); // we use same fiscal year but different year
|
||||
$numbering=new mod_facture_mercure();
|
||||
$result=$numbering->getNextValue($mysoc, $localobject);
|
||||
|
|
@ -334,6 +364,8 @@ class NumberingModulesTest extends PHPUnit\Framework\TestCase
|
|||
|
||||
$localobject=new Facture($this->savdb);
|
||||
$localobject->initAsSpecimen();
|
||||
$localobject->fetch_thirdparty();
|
||||
|
||||
$localobject->date=dol_mktime(12, 0, 0, 12, 1, 1931); // we use different fiscal year but same year
|
||||
$numbering=new mod_facture_mercure();
|
||||
$result=$numbering->getNextValue($mysoc, $localobject);
|
||||
|
|
@ -348,6 +380,8 @@ class NumberingModulesTest extends PHPUnit\Framework\TestCase
|
|||
|
||||
$localobject=new Facture($this->savdb);
|
||||
$localobject->initAsSpecimen();
|
||||
$localobject->fetch_thirdparty();
|
||||
|
||||
$localobject->date=dol_mktime(12, 0, 0, 1, 1, 1940); // we use year 1940 to be sure to not have existing invoice for this year
|
||||
$numbering=new mod_facture_mercure();
|
||||
$result=$numbering->getNextValue($mysoc, $localobject);
|
||||
|
|
@ -358,6 +392,8 @@ class NumberingModulesTest extends PHPUnit\Framework\TestCase
|
|||
|
||||
$localobject=new Facture($this->savdb);
|
||||
$localobject->initAsSpecimen();
|
||||
$localobject->fetch_thirdparty();
|
||||
|
||||
$localobject->date=dol_mktime(12, 0, 0, 12, 1, 1940); // we use same year but fiscal month after
|
||||
$numbering=new mod_facture_mercure();
|
||||
$result=$numbering->getNextValue($mysoc, $localobject);
|
||||
|
|
@ -368,6 +404,8 @@ class NumberingModulesTest extends PHPUnit\Framework\TestCase
|
|||
|
||||
$localobject=new Facture($this->savdb);
|
||||
$localobject->initAsSpecimen();
|
||||
$localobject->fetch_thirdparty();
|
||||
|
||||
$localobject->date=dol_mktime(12, 0, 0, 1, 1, 1941); // we use same fiscal year but different year
|
||||
$numbering=new mod_facture_mercure();
|
||||
$result=$numbering->getNextValue($mysoc, $localobject);
|
||||
|
|
@ -378,6 +416,8 @@ class NumberingModulesTest extends PHPUnit\Framework\TestCase
|
|||
|
||||
$localobject=new Facture($this->savdb);
|
||||
$localobject->initAsSpecimen();
|
||||
$localobject->fetch_thirdparty();
|
||||
|
||||
$localobject->date=dol_mktime(12, 0, 0, 12, 1, 1941); // we use different discal year but same year
|
||||
$numbering=new mod_facture_mercure();
|
||||
$result=$numbering->getNextValue($mysoc, $localobject);
|
||||
|
|
@ -392,6 +432,8 @@ class NumberingModulesTest extends PHPUnit\Framework\TestCase
|
|||
|
||||
$localobject=new Facture($this->savdb);
|
||||
$localobject->initAsSpecimen();
|
||||
$localobject->fetch_thirdparty();
|
||||
|
||||
$localobject->date=dol_mktime(12, 0, 0, 1, 1, 1950); // we use year 1950 to be sure to not have existing invoice for this year
|
||||
$numbering=new mod_facture_mercure();
|
||||
$result=$numbering->getNextValue($mysoc, $localobject);
|
||||
|
|
@ -402,6 +444,8 @@ class NumberingModulesTest extends PHPUnit\Framework\TestCase
|
|||
|
||||
$localobject=new Facture($this->savdb);
|
||||
$localobject->initAsSpecimen();
|
||||
$localobject->fetch_thirdparty();
|
||||
|
||||
$localobject->date=dol_mktime(12, 0, 0, 12, 1, 1950); // we use same year but fiscal month after
|
||||
$numbering=new mod_facture_mercure();
|
||||
$result=$numbering->getNextValue($mysoc, $localobject);
|
||||
|
|
@ -412,6 +456,8 @@ class NumberingModulesTest extends PHPUnit\Framework\TestCase
|
|||
|
||||
$localobject=new Facture($this->savdb);
|
||||
$localobject->initAsSpecimen();
|
||||
$localobject->fetch_thirdparty();
|
||||
|
||||
$localobject->date=dol_mktime(12, 0, 0, 1, 1, 1951); // we use same fiscal year but different year
|
||||
$numbering=new mod_facture_mercure();
|
||||
$result=$numbering->getNextValue($mysoc, $localobject);
|
||||
|
|
@ -422,6 +468,8 @@ class NumberingModulesTest extends PHPUnit\Framework\TestCase
|
|||
|
||||
$localobject=new Facture($this->savdb);
|
||||
$localobject->initAsSpecimen();
|
||||
$localobject->fetch_thirdparty();
|
||||
|
||||
$localobject->date=dol_mktime(12, 0, 0, 12, 1, 1951); // we use different discal year but same year
|
||||
$numbering=new mod_facture_mercure();
|
||||
$result=$numbering->getNextValue($mysoc, $localobject);
|
||||
|
|
@ -436,6 +484,8 @@ class NumberingModulesTest extends PHPUnit\Framework\TestCase
|
|||
|
||||
$localobject=new Facture($this->savdb);
|
||||
$localobject->initAsSpecimen();
|
||||
$localobject->fetch_thirdparty();
|
||||
|
||||
$localobject->date=dol_mktime(12, 0, 0, 1, 1, 1960); // we use year 1960 to be sure to not have existing invoice for this year
|
||||
$numbering=new mod_facture_mercure();
|
||||
$result=$numbering->getNextValue($mysoc, $localobject);
|
||||
|
|
@ -446,6 +496,8 @@ class NumberingModulesTest extends PHPUnit\Framework\TestCase
|
|||
|
||||
$localobject=new Facture($this->savdb);
|
||||
$localobject->initAsSpecimen();
|
||||
$localobject->fetch_thirdparty();
|
||||
|
||||
$localobject->date=dol_mktime(12, 0, 0, 12, 1, 1960); // we use same year but fiscal month after
|
||||
$numbering=new mod_facture_mercure();
|
||||
$result=$numbering->getNextValue($mysoc, $localobject);
|
||||
|
|
@ -456,6 +508,8 @@ class NumberingModulesTest extends PHPUnit\Framework\TestCase
|
|||
|
||||
$localobject=new Facture($this->savdb);
|
||||
$localobject->initAsSpecimen();
|
||||
$localobject->fetch_thirdparty();
|
||||
|
||||
$localobject->date=dol_mktime(12, 0, 0, 1, 1, 1961); // we use same fiscal year but different year
|
||||
$numbering=new mod_facture_mercure();
|
||||
$result=$numbering->getNextValue($mysoc, $localobject);
|
||||
|
|
@ -466,6 +520,8 @@ class NumberingModulesTest extends PHPUnit\Framework\TestCase
|
|||
|
||||
$localobject=new Facture($this->savdb);
|
||||
$localobject->initAsSpecimen();
|
||||
$localobject->fetch_thirdparty();
|
||||
|
||||
$localobject->date=dol_mktime(12, 0, 0, 12, 1, 1961); // we use different discal year but same year
|
||||
$numbering=new mod_facture_mercure();
|
||||
$result=$numbering->getNextValue($mysoc, $localobject);
|
||||
|
|
@ -480,6 +536,8 @@ class NumberingModulesTest extends PHPUnit\Framework\TestCase
|
|||
|
||||
$localobject=new Facture($this->savdb);
|
||||
$localobject->initAsSpecimen();
|
||||
$localobject->fetch_thirdparty();
|
||||
|
||||
$localobject->date=dol_mktime(12, 0, 0, 1, 1, 1970); // we use year 1970 to be sure to not have existing invoice for this year
|
||||
$numbering=new mod_facture_mercure();
|
||||
$result=$numbering->getNextValue($mysoc, $localobject);
|
||||
|
|
@ -490,6 +548,8 @@ class NumberingModulesTest extends PHPUnit\Framework\TestCase
|
|||
|
||||
$localobject=new Facture($this->savdb);
|
||||
$localobject->initAsSpecimen();
|
||||
$localobject->fetch_thirdparty();
|
||||
|
||||
$localobject->date=dol_mktime(12, 0, 0, 12, 1, 1970); // we use same year but fiscal month after
|
||||
$numbering=new mod_facture_mercure();
|
||||
$result=$numbering->getNextValue($mysoc, $localobject);
|
||||
|
|
@ -500,6 +560,8 @@ class NumberingModulesTest extends PHPUnit\Framework\TestCase
|
|||
|
||||
$localobject=new Facture($this->savdb);
|
||||
$localobject->initAsSpecimen();
|
||||
$localobject->fetch_thirdparty();
|
||||
|
||||
$localobject->date=dol_mktime(12, 0, 0, 1, 1, 1971); // we use same fiscal year but different year
|
||||
$numbering=new mod_facture_mercure();
|
||||
$result=$numbering->getNextValue($mysoc, $localobject);
|
||||
|
|
@ -510,6 +572,8 @@ class NumberingModulesTest extends PHPUnit\Framework\TestCase
|
|||
|
||||
$localobject=new Facture($this->savdb);
|
||||
$localobject->initAsSpecimen();
|
||||
$localobject->fetch_thirdparty();
|
||||
|
||||
$localobject->date=dol_mktime(12, 0, 0, 12, 1, 1971); // we use different fiscal year but same year
|
||||
$numbering=new mod_facture_mercure();
|
||||
$result=$numbering->getNextValue($mysoc, $localobject);
|
||||
|
|
@ -523,6 +587,8 @@ class NumberingModulesTest extends PHPUnit\Framework\TestCase
|
|||
|
||||
$localobject=new Facture($this->savdb);
|
||||
$localobject->initAsSpecimen();
|
||||
$localobject->fetch_thirdparty();
|
||||
|
||||
$localobject->date=dol_mktime(12, 0, 0, 1, 1, 1980); // we use year 1980 to be sure to not have existing invoice for this year
|
||||
$numbering=new mod_facture_mercure();
|
||||
$result=$numbering->getNextValue($mysoc, $localobject);
|
||||
|
|
@ -533,6 +599,8 @@ class NumberingModulesTest extends PHPUnit\Framework\TestCase
|
|||
|
||||
$localobject=new Facture($this->savdb);
|
||||
$localobject->initAsSpecimen();
|
||||
$localobject->fetch_thirdparty();
|
||||
|
||||
$localobject->date=dol_mktime(12, 0, 0, 1, 1, 1980); // we use year 1980 to be sure to not have existing invoice for this year
|
||||
$numbering=new mod_facture_mercure();
|
||||
$result=$numbering->getNextValue($mysoc, $localobject);
|
||||
|
|
@ -543,6 +611,8 @@ class NumberingModulesTest extends PHPUnit\Framework\TestCase
|
|||
|
||||
$localobject=new Facture($this->savdb);
|
||||
$localobject->initAsSpecimen();
|
||||
$localobject->fetch_thirdparty();
|
||||
|
||||
$localobject->date=dol_mktime(12, 0, 0, 2, 1, 1980); // we use year 1980 to be sure to not have existing invoice for this year
|
||||
$numbering=new mod_facture_mercure();
|
||||
$result=$numbering->getNextValue($mysoc, $localobject);
|
||||
|
|
@ -553,6 +623,8 @@ class NumberingModulesTest extends PHPUnit\Framework\TestCase
|
|||
|
||||
$localobject=new Facture($this->savdb);
|
||||
$localobject->initAsSpecimen();
|
||||
$localobject->fetch_thirdparty();
|
||||
|
||||
$localobject->date=dol_mktime(12, 0, 0, 1, 1, 1981); // we use year 1981 to be sure to not have existing invoice for this year
|
||||
$numbering=new mod_facture_mercure();
|
||||
$result=$numbering->getNextValue($mysoc, $localobject);
|
||||
|
|
@ -572,6 +644,8 @@ class NumberingModulesTest extends PHPUnit\Framework\TestCase
|
|||
|
||||
$localobject=new Facture($this->savdb);
|
||||
$localobject->initAsSpecimen();
|
||||
$localobject->fetch_thirdparty();
|
||||
|
||||
$localobject->date=dol_mktime(12, 0, 0, 1, 1, 1982); // we use year 1982 to be sure to not have existing invoice for this year
|
||||
$numbering=new mod_facture_mercure();
|
||||
$result=$numbering->getNextValue($tmpthirdparty, $localobject);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user