Merge branch '16.0' of git@github.com:Dolibarr/dolibarr.git into 17.0
This commit is contained in:
commit
51bf3f0686
@ -72,10 +72,6 @@ jobs:
|
|||||||
if: type = pull_request OR type = push
|
if: type = pull_request OR type = push
|
||||||
php: '8.1'
|
php: '8.1'
|
||||||
env: DB=mysql
|
env: DB=mysql
|
||||||
- stage: PHP Dev
|
|
||||||
if: type = push AND branch = develop
|
|
||||||
php: nightly
|
|
||||||
env: DB=mysql
|
|
||||||
- stage: PHP Dev
|
- stage: PHP Dev
|
||||||
if: type = push AND branch = 17.0
|
if: type = push AND branch = 17.0
|
||||||
php: nightly
|
php: nightly
|
||||||
|
|||||||
@ -3538,6 +3538,7 @@ class Facture extends CommonInvoice
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Add an invoice line into database (linked to product/service or not).
|
* 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
|
* 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
|
* 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)
|
* par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,produit)
|
||||||
|
|||||||
@ -7851,7 +7851,13 @@ class Form
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add where from hooks
|
// 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
|
$reshook = $hookmanager->executeHooks('selectForFormsListWhere', $parameters); // Note that $action and $object may have been modified by hook
|
||||||
if (!empty($hookmanager->resPrint)) {
|
if (!empty($hookmanager->resPrint)) {
|
||||||
$sql .= $hookmanager->resPrint;
|
$sql .= $hookmanager->resPrint;
|
||||||
|
|||||||
@ -989,15 +989,15 @@ class FormCompany extends Form
|
|||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
$tax = get_localtax_by_third($local);
|
$tax = get_localtax_by_third($local);
|
||||||
|
|
||||||
$num = $this->db->num_rows($tax);
|
if ($tax) {
|
||||||
$i = 0;
|
|
||||||
if ($num) {
|
|
||||||
$valors = explode(":", $tax);
|
$valors = explode(":", $tax);
|
||||||
|
$nbvalues = count($valors);
|
||||||
|
|
||||||
if (count($valors) > 1) {
|
if ($nbvalues > 1) {
|
||||||
//montar select
|
//montar select
|
||||||
print '<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'">';
|
print '<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'">';
|
||||||
while ($i <= (count($valors)) - 1) {
|
$i = 0;
|
||||||
|
while ($i < $nbvalues) {
|
||||||
if ($selected == $valors[$i]) {
|
if ($selected == $valors[$i]) {
|
||||||
print '<option value="'.$valors[$i].'" selected>';
|
print '<option value="'.$valors[$i].'" selected>';
|
||||||
} else {
|
} else {
|
||||||
@ -1007,7 +1007,7 @@ class FormCompany extends Form
|
|||||||
print '</option>';
|
print '</option>';
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
print'</select>';
|
print '</select>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6150,30 +6150,30 @@ function isOnlyOneLocalTax($local)
|
|||||||
/**
|
/**
|
||||||
* Get values of localtaxes (1 or 2) for company country for the common vat with the highest value
|
* Get values of localtaxes (1 or 2) for company country for the common vat with the highest value
|
||||||
*
|
*
|
||||||
* @param int $local LocalTax to get
|
* @param int $local LocalTax to get
|
||||||
* @return number Values of localtax
|
* @return string Values of localtax (Can be '20', '-19:-15:-9')
|
||||||
*/
|
*/
|
||||||
function get_localtax_by_third($local)
|
function get_localtax_by_third($local)
|
||||||
{
|
{
|
||||||
global $db, $mysoc;
|
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 = " SELECT t.localtax".$local." as localtax";
|
||||||
$sql .= " WHERE c.code = '".$db->escape($mysoc->country_code)."' AND t.active = 1 AND t.taux=(";
|
$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 .= " 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 t.active = 1 AND t.taux = (";
|
||||||
$sql .= " WHERE c.code = '".$db->escape($mysoc->country_code)."' AND tt.active = 1";
|
$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 .= " )";
|
$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);
|
$resql = $db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
if ($local == 1) {
|
return $obj->localtax;
|
||||||
return $obj->localtax1;
|
} else {
|
||||||
} elseif ($local == 2) {
|
return 'Error';
|
||||||
return $obj->localtax2;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return '0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -6282,7 +6282,7 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi
|
|||||||
}
|
}
|
||||||
|
|
||||||
$sql .= ", ".MAIN_DB_PREFIX."c_country as c";
|
$sql .= ", ".MAIN_DB_PREFIX."c_country as c";
|
||||||
if ($mysoc->country_code == 'ES') {
|
if (!empty($mysoc) && $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 ??
|
$sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$db->escape($buyer->country_code)."'"; // local tax in spain use the buyer country ??
|
||||||
} else {
|
} else {
|
||||||
$sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$db->escape(empty($seller->country_code) ? $mysoc->country_code : $seller->country_code)."'";
|
$sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$db->escape(empty($seller->country_code) ? $mysoc->country_code : $seller->country_code)."'";
|
||||||
|
|||||||
@ -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_commande_fournisseurdet MODIFY COLUMN ref varchar(128);
|
||||||
ALTER TABLE llx_facture_fourn_det 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;
|
||||||
|
|
||||||
|
|||||||
@ -1353,7 +1353,7 @@ class Ticket extends CommonObject
|
|||||||
public function LibStatut($status, $mode = 0, $notooltip = 0, $progress = 0)
|
public function LibStatut($status, $mode = 0, $notooltip = 0, $progress = 0)
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $langs;
|
global $langs, $hookmanager;
|
||||||
|
|
||||||
$labelStatus = $this->statuts[$status];
|
$labelStatus = $this->statuts[$status];
|
||||||
$labelStatusShort = $this->statuts_short[$status];
|
$labelStatusShort = $this->statuts_short[$status];
|
||||||
@ -1381,6 +1381,18 @@ class Ticket extends CommonObject
|
|||||||
$mode = 0;
|
$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();
|
$params = array();
|
||||||
if ($notooltip) {
|
if ($notooltip) {
|
||||||
$params = array('tooltip' => 'no');
|
$params = array('tooltip' => 'no');
|
||||||
|
|||||||
@ -1248,7 +1248,7 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testGetDefaultTva
|
* testGetDefaultLocalTax
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
@ -1335,6 +1335,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
|
* testDolExplodeIntoArray
|
||||||
*
|
*
|
||||||
|
|||||||
@ -152,6 +152,8 @@ class NumberingModulesTest extends PHPUnit\Framework\TestCase
|
|||||||
|
|
||||||
$localobject=new Facture($this->savdb);
|
$localobject=new Facture($this->savdb);
|
||||||
$localobject->initAsSpecimen();
|
$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}
|
$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();
|
$numbering=new mod_facture_mercure();
|
||||||
$result=$numbering->getNextValue($mysoc, $localobject);
|
$result=$numbering->getNextValue($mysoc, $localobject);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user