Merge branch 'Dolibarr:develop' into fboitel-dev-scrutinizer-001

This commit is contained in:
fboitel 2022-06-13 15:24:10 +02:00 committed by GitHub
commit a43fb180b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 104 additions and 73 deletions

View File

@ -1,8 +1,8 @@
<?php
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013 Charles-Fr BENKE <charles.fr@benke.fr>
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013 Charles-Fr BENKE <charles.fr@benke.fr>
*
* 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
@ -78,6 +78,9 @@ if (!empty($ref)) {
$id = $object->id;
}
$annee = '';
$totentrees = array();
$totsorties = array();
// Ce rapport de tresorerie est base sur llx_bank (car doit inclure les transactions sans facture)
// plutot que sur llx_paiement + llx_paiementfourn
@ -192,14 +195,14 @@ for ($mois = 1; $mois < 13; $mois++) {
$case = sprintf("%04s-%02s", $annee, $mois);
print '<td class="right" width="10%">&nbsp;';
if ($decaiss[$case] > 0) {
if (isset($decaiss[$case]) && $decaiss[$case] > 0) {
print price($decaiss[$case]);
$totsorties[$annee] += $decaiss[$case];
}
print "</td>";
print '<td class="right borderrightlight" width="10%">&nbsp;';
if ($encaiss[$case] > 0) {
if (isset($encaiss[$case]) && $encaiss[$case] > 0) {
print price($encaiss[$case]);
$totentrees[$annee] += $encaiss[$case];
}
@ -211,7 +214,8 @@ for ($mois = 1; $mois < 13; $mois++) {
// Total debit-credit
print '<tr class="liste_total"><td><b>'.$langs->trans("Total")."</b></td>";
for ($annee = $year_start; $annee <= $year_end; $annee++) {
print '<td class="right nowraponall"><b>'.price($totsorties[$annee]).'</b></td><td class="right nowraponall"><b>'.price($totentrees[$annee]).'</b></td>';
print '<td class="right nowraponall"><b>'. (isset($totsorties[$annee]) ? price($totsorties[$annee]) : '') .'</b></td>';
print '<td class="right nowraponall"><b>'. (isset($totentrees[$annee]) ? price($totentrees[$annee]) : '') .'</b></td>';
}
print "</tr>\n";
@ -245,6 +249,7 @@ if ($resql) {
print '<table class="noborder centpercent">';
$nbcol = '';
print '<tr class="liste_total"><td><b>'.$langs->trans("CurrentBalance")."</b></td>";
print '<td colspan="'.($nbcol).'" class="right">'.price($balance).'</td>';
print "</tr>\n";
@ -267,7 +272,7 @@ if ($result < 0) {
$sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
$sql .= " WHERE b.fk_account = ba.rowid";
$sql .= " AND ba.entity IN (".getEntity('bank_account').")";
if ($id && $_GET["option"] != 'all') {
if ($id && GETPOST("option") != 'all') {
$sql .= " AND b.fk_account IN (".$db->sanitize($id).")";
}
@ -299,7 +304,7 @@ if ($result < 0) {
$sql .= " AND b.datev >= '".($year - $annee)."-01-01 00:00:00'";
$sql .= " AND b.datev <= '".($year - $annee)."-12-31 23:59:59'";
$sql .= " AND b.amount > 0";
if ($id && $_GET["option"] != 'all') {
if ($id && GETPOST("option") != 'all') {
$sql .= " AND b.fk_account IN (".$db->sanitize($id).")";
}
$sql .= " GROUP BY date_format(b.datev,'%m');";
@ -381,7 +386,7 @@ if ($result < 0) {
$sql .= " AND b.datev >= '".($year - $annee)."-01-01 00:00:00'";
$sql .= " AND b.datev <= '".($year - $annee)."-12-31 23:59:59'";
$sql .= " AND b.amount < 0";
if ($id && $_GET["option"] != 'all') {
if ($id && GETPOST("option") != 'all') {
$sql .= " AND b.fk_account IN (".$db->sanitize($id).")";
}
$sql .= " GROUP BY date_format(b.datev,'%m');";

View File

@ -458,7 +458,7 @@ if ($action == 'create') {
print '<td>';
// Editor wysiwyg
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor('account_comment', (GETPOST("account_comment") ?GETPOST("account_comment") : $object->comment), '', 90, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_4, '90%');
$doleditor = new DolEditor('account_comment', (GETPOST("account_comment") ?GETPOST("account_comment") : $object->comment), '', 90, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_SOCIETE'), ROWS_4, '90%');
$doleditor->Create();
print '</td></tr>';

View File

@ -145,6 +145,12 @@ class Account extends CommonObject
*/
public $iban_prefix;
/**
* Address of the bank
* @var string
*/
public $domiciliation;
/**
* XML SEPA format: place Payment Type Information (PmtTpInf) in Credit Transfer Transaction Information (CdtTrfTxInf)
* @var int

View File

@ -95,7 +95,7 @@ if ($result < 0) {
$sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
$sql .= " WHERE b.fk_account = ba.rowid";
$sql .= " AND ba.entity IN (".getEntity('bank_account').")";
if ($account && $_GET["option"] != 'all') {
if ($account && GETPOST("option") != 'all') {
$sql .= " AND b.fk_account IN (".$db->sanitize($account).")";
}
@ -137,7 +137,7 @@ if ($result < 0) {
$sql .= " AND ba.entity IN (".getEntity('bank_account').")";
$sql .= " AND b.datev >= '".$db->escape($year)."-".$db->escape($month)."-01 00:00:00'";
$sql .= " AND b.datev < '".$db->escape($yearnext)."-".$db->escape($monthnext)."-01 00:00:00'";
if ($account && $_GET["option"] != 'all') {
if ($account && GETPOST("option") != 'all') {
$sql .= " AND b.fk_account IN (".$db->sanitize($account).")";
}
$sql .= " GROUP BY date_format(b.datev,'%Y%m%d')";
@ -165,7 +165,7 @@ if ($result < 0) {
$sql .= " WHERE b.fk_account = ba.rowid";
$sql .= " AND ba.entity IN (".getEntity('bank_account').")";
$sql .= " AND b.datev < '".$db->escape($year)."-".sprintf("%02s", $month)."-01'";
if ($account && $_GET["option"] != 'all') {
if ($account && GETPOST("option") != 'all') {
$sql .= " AND b.fk_account IN (".$db->sanitize($account).")";
}
@ -279,7 +279,7 @@ if ($result < 0) {
$sql .= " AND ba.entity IN (".getEntity('bank_account').")";
$sql .= " AND b.datev >= '".$db->escape($year)."-01-01 00:00:00'";
$sql .= " AND b.datev <= '".$db->escape($year)."-12-31 23:59:59'";
if ($account && $_GET["option"] != 'all') {
if ($account && GETPOST("option") != 'all') {
$sql .= " AND b.fk_account IN (".$db->sanitize($account).")";
}
$sql .= " GROUP BY date_format(b.datev,'%Y%m%d')";
@ -307,7 +307,7 @@ if ($result < 0) {
$sql .= " WHERE b.fk_account = ba.rowid";
$sql .= " AND ba.entity IN (".getEntity('bank_account').")";
$sql .= " AND b.datev < '".$db->escape($year)."-01-01'";
if ($account && $_GET["option"] != 'all') {
if ($account && GETPOST("option") != 'all') {
$sql .= " AND b.fk_account IN (".$db->sanitize($account).")";
}
@ -415,7 +415,7 @@ if ($result < 0) {
$sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
$sql .= " WHERE b.fk_account = ba.rowid";
$sql .= " AND ba.entity IN (".getEntity('bank_account').")";
if ($account && $_GET["option"] != 'all') {
if ($account && GETPOST("option") != 'all') {
$sql .= " AND b.fk_account IN (".$db->sanitize($account).")";
}
$sql .= " GROUP BY date_format(b.datev,'%Y%m%d')";
@ -540,7 +540,7 @@ if ($result < 0) {
$sql .= " AND b.datev >= '".$db->escape($year)."-".$db->escape($month)."-01 00:00:00'";
$sql .= " AND b.datev < '".$db->escape($yearnext)."-".$db->escape($monthnext)."-01 00:00:00'";
$sql .= " AND b.amount > 0";
if ($account && $_GET["option"] != 'all') {
if ($account && GETPOST("option") != 'all') {
$sql .= " AND b.fk_account IN (".$db->sanitize($account).")";
}
$sql .= " GROUP BY date_format(b.datev,'%d')";
@ -575,7 +575,7 @@ if ($result < 0) {
$sql .= " AND b.datev >= '".$db->escape($year)."-".$db->escape($month)."-01 00:00:00'";
$sql .= " AND b.datev < '".$db->escape($yearnext)."-".$db->escape($monthnext)."-01 00:00:00'";
$sql .= " AND b.amount < 0";
if ($account && $_GET["option"] != 'all') {
if ($account && GETPOST("option") != 'all') {
$sql .= " AND b.fk_account IN (".$db->sanitize($account).")";
}
$sql .= " GROUP BY date_format(b.datev,'%d')";
@ -649,7 +649,7 @@ if ($result < 0) {
$sql .= " AND b.datev >= '".$db->escape($year)."-01-01 00:00:00'";
$sql .= " AND b.datev <= '".$db->escape($year)."-12-31 23:59:59'";
$sql .= " AND b.amount > 0";
if ($account && $_GET["option"] != 'all') {
if ($account && GETPOST("option") != 'all') {
$sql .= " AND b.fk_account IN (".$db->sanitize($account).")";
}
$sql .= " GROUP BY date_format(b.datev,'%m');";
@ -676,7 +676,7 @@ if ($result < 0) {
$sql .= " AND b.datev >= '".$db->escape($year)."-01-01 00:00:00'";
$sql .= " AND b.datev <= '".$db->escape($year)."-12-31 23:59:59'";
$sql .= " AND b.amount < 0";
if ($account && $_GET["option"] != 'all') {
if ($account && GETPOST("option") != 'all') {
$sql .= " AND b.fk_account IN (".$db->sanitize($account).")";
}
$sql .= " GROUP BY date_format(b.datev,'%m')";
@ -748,7 +748,7 @@ if ($account) {
if (!preg_match('/,/', $account)) {
$moreparam = '&month='.$month.'&year='.$year.($mode == 'showalltime' ? '&mode=showalltime' : '');
if ($_GET["option"] != 'all') {
if (GETPOST("option") != 'all') {
$morehtml = '<a href="'.$_SERVER["PHP_SELF"].'?account='.$account.'&option=all'.$moreparam.'">'.$langs->trans("ShowAllAccounts").'</a>';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', '', $moreparam, 0, '', '', 1);
} else {

View File

@ -1,10 +1,11 @@
<?php
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2019 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2017 Patrick Delcroix <pmpdelcroix@gmail.com>
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2019 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2017 Patrick Delcroix <pmpdelcroix@gmail.com>
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
*
* 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
@ -57,6 +58,8 @@ $ve = GETPOST("ve", 'alpha');
$brref = GETPOST('brref', 'alpha');
$oldbankreceipt = GETPOST('oldbankreceipt', 'alpha');
$newbankreceipt = GETPOST('newbankreceipt', 'alpha');
$rel = GETPOST("rel", 'alphanohtml');
$backtopage = GETPOST('backtopage', 'alpha');
// Security check
$fieldid = (!empty($ref) ? $ref : $id);
@ -112,7 +115,7 @@ $contextpage = 'banktransactionlist'.(empty($object->ref) ? '' : '-'.$object->id
// Define number of receipt to show (current, previous or next one ?)
$found = false;
if ($_GET["rel"] == 'prev') {
if ($rel == 'prev') {
// Recherche valeur pour num = numero releve precedent
$sql = "SELECT DISTINCT(b.num_releve) as num";
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
@ -130,7 +133,7 @@ if ($_GET["rel"] == 'prev') {
$found = true;
}
}
} elseif ($_GET["rel"] == 'next') {
} elseif ($rel == 'next') {
// Recherche valeur pour num = numero releve precedent
$sql = "SELECT DISTINCT(b.num_releve) as num";
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
@ -237,10 +240,10 @@ if (empty($numref)) {
$sql .= $db->order($sortfield, $sortorder);
// Count total nb of records
$nbtotalofrecords = '';
$totalnboflines = 0;
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
$totalnboflines = $db->num_rows($result);
}
$sql .= $db->plimit($conf->liste_limit + 1, $offset);
@ -399,9 +402,8 @@ if (empty($numref)) {
$title = $langs->trans("AccountStatement").' '.$numref.' - '.$langs->trans("BankAccount").' '.$object->getNomUrl(1, 'receipts');
print load_fiche_titre($title, $morehtmlright, '');
//print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, 0, $nbtotalofrecords, 'bank_account', 0, '', '', 0, 1);
print "<form method=\"post\" action=\"releve.php\">";
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="add">';

View File

@ -1,8 +1,8 @@
<?php
/* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2008-2009 Laurent Destailleur (Eldy) <eldy@users.sourceforge.net>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com
/* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2008-2009 Laurent Destailleur (Eldy) <eldy@users.sourceforge.net>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com
* Copyright (C) 2016 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -185,7 +185,7 @@ if (GETPOST("account") || GETPOST("ref")) {
$solde = $object->solde(0);
if ($conf->global->MULTICOMPANY_INVOICE_SHARING_ENABLED) {
if (getDolGlobalInt('MULTICOMPANY_INVOICE_SHARING_ENABLED')) {
$colspan = 6;
} else {
$colspan = 5;
@ -199,7 +199,7 @@ if (GETPOST("account") || GETPOST("ref")) {
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("DateDue").'</td>';
print '<td>'.$langs->trans("Description").'</td>';
if ($conf->global->MULTICOMPANY_INVOICE_SHARING_ENABLED) {
if (getDolGlobalInt('MULTICOMPANY_INVOICE_SHARING_ENABLED')) {
print '<td>'.$langs->trans("Entity").'</td>';
}
print '<td>'.$langs->trans("ThirdParty").'</td>';

View File

@ -6636,13 +6636,17 @@ function dol_string_nohtmltag($stringtoclean, $removelinefeed = 1, $pagecodeto =
} else {
// Remove '<' into remainging, so remove non closing html tags like '<abc' or '<<abc'. Note: '<123abc' is not a html tag (can be kept), but '<abc123' is (must be removed).
$pattern = "/<[^<>]+>/";
// Example of $temp: <a href="/myurl" title="<u>A title</u>">0000-021</a>
// pass 1 - $temp after pass 1: <a href="/myurl" title="A title">0000-021
// pass 2 - $temp after pass 2: 0000-021
$tempbis = $temp;
do {
// Example of $temp: <a href="/myurl" title="<u>A title</u>">0000-021</a>
// pass 1 - $temp after pass 1: <a href="/myurl" title="A title">0000-021
// pass 2 - $temp after pass 2: 0000-021
$temp = $tempbis;
$tempbis = str_replace('<>', '', $temp); // No reason to have this into a text, except if value is to try bypass the next html cleaning
$tempbis = preg_replace($pattern, '', $tempbis);
//$idowhile++; print $temp.'-'.$tempbis."\n"; if ($idowhile > 100) break;
} while ($tempbis != $temp);
$temp = $tempbis;
// Remove '<' into remaining, so remove non closing html tags like '<abc' or '<<abc'. Note: '<123abc' is not a html tag (can be kept), but '<abc123' is (must be removed).

View File

@ -68,6 +68,19 @@ $hookmanager->initHooks(array('intracommcard', 'globalcard'));
$error = 0;
$permissiontoread = $user->rights->intracommreport->read;
$permissiontoadd = $user->rights->intracommreport->write;
$permissiontodelete = $user->rights->intracommreport->delete;
// Security check (enable the most restrictive one)
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (isset($object->status) && ($object->status == $object::STATUS_DRAFT) ? 1 : 0);
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
if (empty($conf->intracommreport->enabled)) accessforbidden();
if (!$permissiontoread) accessforbidden();
/*
* Actions
@ -80,7 +93,7 @@ if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if ($user->rights->intracommreport->delete && $action == 'confirm_delete' && $confirm == 'yes') {
if ($permissiontodelete && $action == 'confirm_delete' && $confirm == 'yes') {
$result = $object->delete($id, $user);
if ($result > 0) {
if (!empty($backtopage)) {
@ -95,7 +108,7 @@ if ($user->rights->intracommreport->delete && $action == 'confirm_delete' && $co
}
}
if ($action == 'add' && $user->rights->intracommreport->write) {
if ($action == 'add' && $permissiontoadd) {
$object->label = trim($label);
$object->type = trim($exporttype);
$object->type_declaration = $type_declaration;

View File

@ -24,6 +24,7 @@
*/
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
/**
* Class to manage intracomm report
*/
@ -124,7 +125,6 @@ class IntracommReport extends CommonObject
*/
public function getXML($mode = 'O', $type = 'introduction', $period_reference = '')
{
global $conf, $mysoc;
/**************Construction de quelques variables********************/
@ -286,34 +286,34 @@ class IntracommReport extends CommonObject
global $mysoc, $conf;
if ($type == 'expedition' || $exporttype == 'des') {
$sql = 'SELECT f.ref as refinvoice, f.total_ht';
$sql = "SELECT f.ref as refinvoice, f.total_ht";
$table = 'facture';
$table_extraf = 'facture_extrafields';
$tabledet = 'facturedet';
$field_link = 'fk_facture';
} else { // Introduction
$sql = 'SELECT f.ref_supplier as refinvoice, f.total_ht';
$sql = "SELECT f.ref_supplier as refinvoice, f.total_ht";
$table = 'facture_fourn';
$table_extraf = 'facture_fourn_extrafields';
$tabledet = 'facture_fourn_det';
$field_link = 'fk_facture_fourn';
}
$sql .= ', l.fk_product, l.qty
$sql .= ", l.fk_product, l.qty
, p.weight, p.rowid as id_prod, p.customcode
, s.rowid as id_client, s.nom, s.zip, s.fk_pays, s.tva_intra
, c.code
, ext.mode_transport
FROM '.MAIN_DB_PREFIX.$tabledet.' l
INNER JOIN '.MAIN_DB_PREFIX.$table.' f ON (f.rowid = l.'.$field_link.')
LEFT JOIN '.MAIN_DB_PREFIX.$table_extraf.' ext ON (ext.fk_object = f.rowid)
INNER JOIN '.MAIN_DB_PREFIX.'product p ON (p.rowid = l.fk_product)
INNER JOIN '.MAIN_DB_PREFIX.'societe s ON (s.rowid = f.fk_soc)
LEFT JOIN '.MAIN_DB_PREFIX.'c_country c ON (c.rowid = s.fk_pays)
FROM ".MAIN_DB_PREFIX.$tabledet." l
INNER JOIN ".MAIN_DB_PREFIX.$table." f ON (f.rowid = l.".$this->db->escape($field_link).")
LEFT JOIN ".MAIN_DB_PREFIX.$table_extraf." ext ON (ext.fk_object = f.rowid)
INNER JOIN ".MAIN_DB_PREFIX."product p ON (p.rowid = l.fk_product)
INNER JOIN ".MAIN_DB_PREFIX."societe s ON (s.rowid = f.fk_soc)
LEFT JOIN ".MAIN_DB_PREFIX."c_country c ON (c.rowid = s.fk_pays)
WHERE f.fk_statut > 0
AND l.product_type = '.($exporttype == 'des' ? 1 : 0).'
AND f.entity = '.$conf->entity.'
AND (s.fk_pays <> '.$mysoc->country_id.' OR s.fk_pays IS NULL)
AND f.datef BETWEEN "'.$period_reference.'-01" AND "'.$period_reference.'-'.date('t').'"';
AND l.product_type = ".($exporttype == "des" ? 1 : 0)."
AND f.entity = ".((int) $conf->entity)."
AND (s.fk_pays <> ".((int) $mysoc->country_id)." OR s.fk_pays IS NULL)
AND f.datef BETWEEN '".$this->db->escape($period_reference)."-01' AND '".$this->db->escape($period_reference)."-".date('t')."'";
return $sql;
}
@ -399,27 +399,27 @@ class IntracommReport extends CommonObject
}
foreach ($TLinesFraisDePort as $res) {
$sql = 'SELECT p.customcode
FROM '.MAIN_DB_PREFIX.$tabledet.' d
INNER JOIN '.MAIN_DB_PREFIX.$table.' f ON (f.rowid = d.'.$field_link.')
INNER JOIN '.MAIN_DB_PREFIX.'product p ON (p.rowid = d.fk_product)
$sql = "SELECT p.customcode
FROM ".MAIN_DB_PREFIX.$tabledet." d
INNER JOIN ".MAIN_DB_PREFIX.$table." f ON (f.rowid = d.".$this->db->escape($field_link).")
INNER JOIN ".MAIN_DB_PREFIX."product p ON (p.rowid = d.fk_product)
WHERE d.fk_product IS NOT NULL
AND f.entity = '.$conf->entity.'
AND '.$more_sql.' = "'.$res->refinvoice.'"
AND f.entity = ".((int) $conf->entity)."
AND ".$more_sql." = '".$this->db->escape($res->refinvoice)."'
AND d.total_ht =
(
SELECT MAX(d.total_ht)
FROM '.MAIN_DB_PREFIX.$tabledet.' d
INNER JOIN '.MAIN_DB_PREFIX.$table.' f ON (f.rowid = d.'.$field_link.')
FROM ".MAIN_DB_PREFIX.$tabledet." d
INNER JOIN ".MAIN_DB_PREFIX.$table." f ON (f.rowid = d.".$this->db->escape($field_link).")
WHERE d.fk_product IS NOT NULL
AND '.$more_sql.' = "'.$res->refinvoice.'"
AND ".$more_sql." = '".$this->db->escape($res->refinvoice)."'
AND d.fk_product NOT IN
(
SELECT fk_product
FROM '.MAIN_DB_PREFIX.'categorie_product
WHERE fk_categorie = '.((int) $categ_fraisdeport->id).'
FROM ".MAIN_DB_PREFIX."categorie_product
WHERE fk_categorie = ".((int) $categ_fraisdeport->id)."
)
)';
)";
$resql = $this->db->query($sql);
$ress = $this->db->fetch_object($resql);
@ -437,7 +437,9 @@ class IntracommReport extends CommonObject
*/
public function getNextDeclarationNumber()
{
$resql = $this->db->query('SELECT MAX(numero_declaration) as max_declaration_number FROM '.MAIN_DB_PREFIX.$this->table_element." WHERE exporttype='".$this->db->escape($this->exporttype)."'");
$sql = "SELECT MAX(numero_declaration) as max_declaration_number FROM ".MAIN_DB_PREFIX.$this->table_element;
$sql .= " WHERE exporttype = '".$this->db->escape($this->exporttype)."'";
$resql = $this->db->query($sql);
if ($resql) {
$res = $this->db->fetch_object($resql);
}
@ -463,7 +465,6 @@ class IntracommReport extends CommonObject
*/
public function generateXMLFile()
{
$name = $this->periode.'.xml';
$fname = sys_get_temp_dir().'/'.$name;
$f = fopen($fname, 'w+');