Merge branch '20.0up' into 20.0

This commit is contained in:
Juanjo Menent 2024-10-10 09:11:58 +02:00
commit f1cd746f7b
5 changed files with 44 additions and 13 deletions

View file

@ -4054,7 +4054,7 @@ class Facture extends CommonInvoice
* @param double $remise_percent Percentage discount of the line
* @param int $date_start Date de debut de validite du service
* @param int $date_end Date de fin de validite du service
* @param double $txtva VAT Rate (Can be '8.5', '8.5 (ABC)')
* @param double|string $txtva VAT Rate (Can be '8.5', '8.5 (ABC)')
* @param double $txlocaltax1 Local tax 1 rate
* @param double $txlocaltax2 Local tax 2 rate
* @param string $price_base_type HT or TTC

View file

@ -603,8 +603,12 @@ function getBrowserInfo($user_agent)
$version = end($reg);
} elseif (preg_match('/l[iy]n(x|ks)(\(|\/|\s)*([\d\.]+)/i', $user_agent, $reg)) {
// MS products at end
$name = 'lynxlinks';
$name = 'textbrowser';
$version = empty($reg[3]) ? '' : $reg[3];
} elseif (preg_match('/w3m\/([\d\.]+)/i', $user_agent, $reg)) {
// MS products at end
$name = 'textbrowser';
$version = empty($reg[1]) ? '' : $reg[1];
}
if ($tablet) {

View file

@ -510,7 +510,7 @@ if (GETPOST('theme', 'aZ09')) {
}
// Set global MAIN_OPTIMIZEFORTEXTBROWSER (must be before login part)
if (GETPOSTINT('textbrowser') || (!empty($conf->browser->name) && $conf->browser->name == 'lynxlinks')) { // If we must enable text browser
if (GETPOSTINT('textbrowser') || (!empty($conf->browser->name) && $conf->browser->name == 'textbrowser')) { // If we must enable text browser
$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER = 2;
}

View file

@ -968,7 +968,12 @@ if (empty($reshook)) {
if (!$permissiontoupdateline) {
dol_htmloutput_errors($langs->trans("NotEnoughPermissions", "TakePos").' - No permission to updateqty', null, 1);
} else {
$result = $invoice->updateline($line->id, $line->desc, $line->subprice, $number, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit);
$vatratecode = $line->tva_tx;
if ($line->vat_src_code) {
$vatratecode .= ' ('.$line->vat_src_code.')';
}
$result = $invoice->updateline($line->id, $line->desc, $line->subprice, $number, $line->remise_percent, $line->date_start, $line->date_end, $vatratecode, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit);
}
}
}
@ -1002,12 +1007,18 @@ if (empty($reshook)) {
// TODO Check also that invoice->ref is (PROV-POS1-2) with 1 = terminal and 2, the invoice ID
}
}
$vatratecode = $line->tva_tx;
if ($line->vat_src_code) {
$vatratecode .= ' ('.$line->vat_src_code.')';
}
if (!$permissiontoupdateline) {
dol_htmloutput_errors($langs->trans("NotEnoughPermissions", "TakePos").' - No permission to updateprice', null, 1);
} elseif (getDolGlobalInt('TAKEPOS_CHANGE_PRICE_HT') == 1) {
$result = $invoice->updateline($line->id, $line->desc, $number, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit);
$result = $invoice->updateline($line->id, $line->desc, $number, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $vatratecode, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit);
} else {
$result = $invoice->updateline($line->id, $line->desc, $number, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'TTC', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit);
$result = $invoice->updateline($line->id, $line->desc, $number, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $vatratecode, $line->localtax1_tx, $line->localtax2_tx, 'TTC', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit);
}
}
}
@ -1050,7 +1061,11 @@ if (empty($reshook)) {
if (!$permissiontoupdateline) {
dol_htmloutput_errors($langs->trans("NotEnoughPermissions", "TakePos"), null, 1);
} else {
$result = $invoice->updateline($line->id, $line->desc, $line->subprice, $line->qty, $number, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit);
$vatratecode = $line->tva_tx;
if ($line->vat_src_code) {
$vatratecode .= ' ('.$line->vat_src_code.')';
}
$result = $invoice->updateline($line->id, $line->desc, $line->subprice, $line->qty, $number, $line->date_start, $line->date_end, $vatratecode, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit);
}
}
}
@ -1060,7 +1075,11 @@ if (empty($reshook)) {
$invoice->fetch($placeid);
} elseif ($action == 'update_reduction_global' && $user->hasRight('takepos', 'editlines')) {
foreach ($invoice->lines as $line) {
$result = $invoice->updateline($line->id, $line->desc, $line->subprice, $line->qty, $number, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit);
$vatratecode = $line->tva_tx;
if ($line->vat_src_code) {
$vatratecode .= ' ('.$line->vat_src_code.')';
}
$result = $invoice->updateline($line->id, $line->desc, $line->subprice, $line->qty, $number, $line->date_start, $line->date_end, $vatratecode, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit);
}
$invoice->fetch($placeid);

View file

@ -533,7 +533,7 @@ class FunctionsLibTest extends CommonClassTest
$this->assertFalse($tmp['tablet']);
$this->assertEquals('classic', $tmp['layout']);
//Internet Explorer 11
// Internet Explorer 11
$user_agent = 'Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko';
$tmp = getBrowserInfo($user_agent);
$this->assertEquals('ie', $tmp['browsername']);
@ -542,7 +542,7 @@ class FunctionsLibTest extends CommonClassTest
$this->assertFalse($tmp['tablet']);
$this->assertEquals('classic', $tmp['layout']);
//Internet Explorer 11 bis
// Internet Explorer 11 bis
$user_agent = 'Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; NP06; rv:11.0) like Gecko';
$tmp = getBrowserInfo($user_agent);
$this->assertEquals('ie', $tmp['browsername']);
@ -551,7 +551,7 @@ class FunctionsLibTest extends CommonClassTest
$this->assertFalse($tmp['tablet']);
$this->assertEquals('classic', $tmp['layout']);
//iPad
// iPad
$user_agent = 'Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5355d Safari/8536.25';
$tmp = getBrowserInfo($user_agent);
$this->assertEquals('safari', $tmp['browsername']);
@ -560,13 +560,21 @@ class FunctionsLibTest extends CommonClassTest
$this->assertEquals('tablet', $tmp['layout']);
$this->assertEquals('iphone', $tmp['phone']);
//Lynx
// Lynx
$user_agent = 'Lynx/2.8.8dev.3 libwww‑FM/2.14 SSL‑MM/1.4.1';
$tmp = getBrowserInfo($user_agent);
$this->assertEquals('lynxlinks', $tmp['browsername']);
$this->assertEquals('textbrowser', $tmp['browsername']);
$this->assertEquals('2.8.8', $tmp['browserversion']);
$this->assertEquals('unknown', $tmp['browseros']);
$this->assertEquals('classic', $tmp['layout']);
// W3M
$user_agent = 'w3m/1.2.3-git123456';
$tmp = getBrowserInfo($user_agent);
$this->assertEquals('textbrowser', $tmp['browsername']);
$this->assertEquals('1.2.3', $tmp['browserversion']);
$this->assertEquals('unknown', $tmp['browseros']);
$this->assertEquals('classic', $tmp['layout']);
}