FIX SQL syntax error and CSRF check on vat reports

This commit is contained in:
Laurent Destailleur 2019-09-11 13:57:15 +02:00
parent 0e62d315f2
commit 3f3282400a
9 changed files with 63 additions and 32 deletions

View File

@ -156,8 +156,6 @@ $title=$langs->trans("LT".$object->ltt) . " - " . $langs->trans("Card");
$help_url=''; $help_url='';
llxHeader("", $title, $helpurl); llxHeader("", $title, $helpurl);
if ($action == 'create') if ($action == 'create')
{ {
print load_fiche_titre($langs->transcountry($lttype==2?"newLT2Payment":"newLT1Payment", $mysoc->country_code)); print load_fiche_titre($langs->transcountry($lttype==2?"newLT2Payment":"newLT1Payment", $mysoc->country_code));

View File

@ -85,6 +85,12 @@ $socid = GETPOST('socid', 'int');
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'tax', '', '', 'charges'); $result = restrictedArea($user, 'tax', '', '', 'charges');
if (empty($local))
{
accessforbidden('Parameter localTaxType is missing');
exit;
}
/* /*
@ -106,10 +112,11 @@ llxHeader('', '', '', '', 0, 0, '', '', $morequerystring);
$name=$langs->transcountry($local==1?"LT1ReportByCustomers":"LT2ReportByCustomers", $mysoc->country_code); $name=$langs->transcountry($local==1?"LT1ReportByCustomers":"LT2ReportByCustomers", $mysoc->country_code);
$fsearch.='<br>'; $fsearch ='<!-- hidden fields for form -->';
$fsearch.=' <input type="hidden" name="year" value="'.$year.'">'; $fsearch.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$fsearch.='<input type="hidden" name="modetax" value="'.$modetax.'">'; $fsearch.='<input type="hidden" name="modetax" value="'.$modetax.'">';
$fsearch.=' '.$langs->trans("SalesTurnoverMinimum").': '; $fsearch.='<input type="hidden" name="localTaxType" value="'.$local.'">';
$fsearch.=$langs->trans("SalesTurnoverMinimum").': ';
$fsearch.='<input type="text" name="min" id="min" value="'.$min.'" size="6">'; $fsearch.='<input type="text" name="min" id="min" value="'.$min.'" size="6">';
$calc=$conf->global->MAIN_INFO_LOCALTAX_CALC.$local; $calc=$conf->global->MAIN_INFO_LOCALTAX_CALC.$local;

View File

@ -188,6 +188,19 @@ function pt($db, $sql, $date)
} }
} }
if (empty($localTaxType))
{
accessforbidden('Parameter localTaxType is missing');
exit;
}
/*
* Actions
*/
// None
/* /*
* View * View
@ -213,7 +226,11 @@ if($localTaxType==1) {
$CalcLT= $conf->global->MAIN_INFO_LOCALTAX_CALC2; $CalcLT= $conf->global->MAIN_INFO_LOCALTAX_CALC2;
} }
$fsearch = '<!-- hidden fields for form -->';
$fsearch.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$fsearch.= '<input type="hidden" name="localTaxType" value="'.$localTaxType.'">'; $fsearch.= '<input type="hidden" name="localTaxType" value="'.$localTaxType.'">';
$fsearch.= '<input type="hidden" name="modetax" value="'.$modetax.'">';
$description = $fsearch; $description = $fsearch;
// Show report header // Show report header
@ -528,7 +545,7 @@ while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) // $mc
$total = $total + $diff; $total = $total + $diff;
$subtotal = price2num($subtotal + $diff, 'MT'); $subtotal = price2num($subtotal + $diff, 'MT');
print '<td class="nowrap right">'.price(price2num($diff, 'MT')).'</td>\n'; print '<td class="nowrap right">'.price(price2num($diff, 'MT')).'</td>'."\n";
print "<td>&nbsp;</td>\n"; print "<td>&nbsp;</td>\n";
print "</tr>\n"; print "</tr>\n";

View File

@ -97,6 +97,12 @@ $socid = GETPOST('socid', 'int');
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'tax', '', '', 'charges'); $result = restrictedArea($user, 'tax', '', '', 'charges');
if (empty($local))
{
accessforbidden('Parameter localTaxType is missing');
exit;
}
/* /*
@ -122,7 +128,8 @@ foreach ($listofparams as $param)
llxHeader('', $langs->trans("LocalTaxReport"), '', '', 0, 0, '', '', $morequerystring); llxHeader('', $langs->trans("LocalTaxReport"), '', '', 0, 0, '', '', $morequerystring);
$fsearch.=' <input type="hidden" name="year" value="'.$year.'">'; $fsearch = '<!-- hidden fields for form -->';
$fsearch.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$fsearch.= '<input type="hidden" name="modetax" value="'.$modetax.'">'; $fsearch.= '<input type="hidden" name="modetax" value="'.$modetax.'">';
$fsearch.= '<input type="hidden" name="localTaxType" value="'.$local.'">'; $fsearch.= '<input type="hidden" name="localTaxType" value="'.$local.'">';
@ -161,7 +168,7 @@ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$description.='<br>'.$langs->trans("DepositsAreNotIncluded"); $description.='<br>'.$langs->trans("DepositsAreNotIncluded");
} }
*/ */
if (! empty($conf->global->MAIN_MODULE_ACCOUNTING)) $description.='<br>'.$langs->trans("ThisIsAnEstimatedValue"); if (! empty($conf->global->MAIN_MODULE_ACCOUNTING)) $description.=$langs->trans("ThisIsAnEstimatedValue");
// Customers invoices // Customers invoices
$elementcust=$langs->trans("CustomersInvoices"); $elementcust=$langs->trans("CustomersInvoices");
@ -186,15 +193,14 @@ if ($mysoc->tva_assuj) {
report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, array(), $calcmode); report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, array(), $calcmode);
if($local==1){ if($local==1){
$vatcust=$langs->transcountry("LocalTax1", $mysoc->country_code); $vatcust=$langs->transcountry("LT1", $mysoc->country_code);
$vatsup=$langs->transcountry("LocalTax1", $mysoc->country_code); $vatsup=$langs->transcountry("LT1", $mysoc->country_code);
$vatexpensereport=$langs->transcountry("LocalTax1", $mysoc->country_code); $vatexpensereport=$langs->transcountry("LT1", $mysoc->country_code);
}else{ }else{
$vatcust=$langs->transcountry("LocalTax2", $mysoc->country_code); $vatcust=$langs->transcountry("LT2", $mysoc->country_code);
$vatsup=$langs->transcountry("LocalTax2", $mysoc->country_code); $vatsup=$langs->transcountry("LT2", $mysoc->country_code);
$vatexpensereport=$langs->transcountry("LocalTax2", $mysoc->country_code); $vatexpensereport=$langs->transcountry("LT2", $mysoc->country_code);
} }
// VAT Received and paid // VAT Received and paid

View File

@ -123,10 +123,10 @@ if (isset($_REQUEST['extra_report']) && $_REQUEST['extra_report'] == 1) {
llxHeader('', $langs->trans("VATReport"), '', '', 0, 0, '', '', $morequerystring); llxHeader('', $langs->trans("VATReport"), '', '', 0, 0, '', '', $morequerystring);
$fsearch.='<br>'; $fsearch ='<!-- hidden fields for form -->';
$fsearch.=' <input type="hidden" name="year" value="'.$year.'">'; $fsearch.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$fsearch.='<input type="hidden" name="modetax" value="'.$modetax.'">'; $fsearch.='<input type="hidden" name="modetax" value="'.$modetax.'">';
$fsearch.=' '.$langs->trans("SalesTurnoverMinimum").': '; $fsearch.=$langs->trans("SalesTurnoverMinimum").': ';
$fsearch.='<input type="text" name="min" id="min" value="'.$min.'" size="6">'; $fsearch.='<input type="text" name="min" id="min" value="'.$min.'" size="6">';
// Show report header // Show report header

View File

@ -198,7 +198,11 @@ $form=new Form($db);
$company_static=new Societe($db); $company_static=new Societe($db);
$tva = new Tva($db); $tva = new Tva($db);
$description = ''; $fsearch ='<!-- hidden fields for form -->';
$fsearch.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$fsearch.='<input type="hidden" name="modetax" value="'.$modetax.'">';
$description = $fsearch;
// Show report header // Show report header
$name = $langs->trans("ReportByMonth"); $name = $langs->trans("ReportByMonth");
@ -208,7 +212,7 @@ if ($modetax == 1) $calcmode=$langs->trans('OptionVATDebitOption');
if ($modetax == 2) $calcmode=$langs->trans('OptionPaymentForProductAndServices'); if ($modetax == 2) $calcmode=$langs->trans('OptionPaymentForProductAndServices');
$calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRules", DOL_URL_ROOT.'/admin/taxes.php').')'; $calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRules", DOL_URL_ROOT.'/admin/taxes.php').')';
$description = $langs->trans("VATSummary").'<br>'; $description .= $langs->trans("VATSummary").'<br>';
if ($conf->global->TAX_MODE_SELL_PRODUCT == 'invoice') $description.=$langs->trans("RulesVATDueProducts"); if ($conf->global->TAX_MODE_SELL_PRODUCT == 'invoice') $description.=$langs->trans("RulesVATDueProducts");
if ($conf->global->TAX_MODE_SELL_PRODUCT == 'payment') $description.=$langs->trans("RulesVATInProducts"); if ($conf->global->TAX_MODE_SELL_PRODUCT == 'payment') $description.=$langs->trans("RulesVATInProducts");
if ($conf->global->TAX_MODE_SELL_SERVICE == 'invoice') $description.='<br>'.$langs->trans("RulesVATDueServices"); if ($conf->global->TAX_MODE_SELL_SERVICE == 'invoice') $description.='<br>'.$langs->trans("RulesVATDueServices");

View File

@ -122,7 +122,8 @@ llxHeader('', $langs->trans("VATReport"), '', '', 0, 0, '', '', $morequerystring
//print load_fiche_titre($langs->trans("VAT"),""); //print load_fiche_titre($langs->trans("VAT"),"");
//$fsearch.='<br>'; //$fsearch.='<br>';
$fsearch.=' <input type="hidden" name="year" value="'.$year.'">'; $fsearch ='<!-- hidden fields for form -->';
$fsearch.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$fsearch.='<input type="hidden" name="modetax" value="'.$modetax.'">'; $fsearch.='<input type="hidden" name="modetax" value="'.$modetax.'">';
//$fsearch.=' '.$langs->trans("SalesTurnoverMinimum").': '; //$fsearch.=' '.$langs->trans("SalesTurnoverMinimum").': ';
//$fsearch.=' <input type="text" name="min" value="'.$min.'">'; //$fsearch.=' <input type="text" name="min" value="'.$min.'">';

View File

@ -96,8 +96,6 @@ LocalTax1IsNotUsedES= RE is not used
LocalTax2IsUsed=Use third tax LocalTax2IsUsed=Use third tax
LocalTax2IsUsedES= IRPF is used LocalTax2IsUsedES= IRPF is used
LocalTax2IsNotUsedES= IRPF is not used LocalTax2IsNotUsedES= IRPF is not used
LocalTax1ES=RE
LocalTax2ES=IRPF
WrongCustomerCode=Customer code invalid WrongCustomerCode=Customer code invalid
WrongSupplierCode=Vendor code invalid WrongSupplierCode=Vendor code invalid
CustomerCodeModel=Customer code model CustomerCodeModel=Customer code model