mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-22 17:31:25 +01:00
Better error management
This commit is contained in:
@@ -984,15 +984,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 {
|
||||||
@@ -1002,7 +1002,7 @@ class FormCompany extends Form
|
|||||||
print '</option>';
|
print '</option>';
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
print'</select>';
|
print '</select>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5682,19 +5682,18 @@ 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.localtax".$local." as localtax";
|
$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 .= " 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 .= " 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 .= "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 .= " WHERE c.code = '".$db->escape($mysoc->country_code)."' AND tt.active = 1)";
|
||||||
$sql .= " ) ";
|
|
||||||
$sql .= " AND t.localtax".$local."_type > 0";
|
$sql .= " AND t.localtax".$local."_type > 0";
|
||||||
$sql .= " ORDER BY t.rowid DESC";
|
$sql .= " ORDER BY t.rowid DESC";
|
||||||
|
|
||||||
@@ -5702,9 +5701,11 @@ function get_localtax_by_third($local)
|
|||||||
if ($resql) {
|
if ($resql) {
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
return $obj->localtax;
|
return $obj->localtax;
|
||||||
|
} else {
|
||||||
|
return 'Error';
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return '0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -533,3 +533,7 @@ 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);
|
||||||
|
|
||||||
|
ALTER TABLE llx_c_tva SET localtax2 = '-19:-15:-9' WHERE localtax2 = '-19' AND localtax2_type = '5' AND fk_pays = 4 AND rowid = 44;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user