Merge remote-tracking branch 'Dolibarr/11.0' into 11

This commit is contained in:
Francis Appels 2020-02-07 10:02:51 +01:00
commit 4760e5b1b3
1169 changed files with 14292 additions and 9936 deletions

View File

@ -213,6 +213,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/public %_datadir/dolibarr/htdocs/public
%_datadir/dolibarr/htdocs/reception %_datadir/dolibarr/htdocs/reception
%_datadir/dolibarr/htdocs/resource %_datadir/dolibarr/htdocs/resource
%_datadir/dolibarr/htdocs/salaries
%_datadir/dolibarr/htdocs/societe %_datadir/dolibarr/htdocs/societe
%_datadir/dolibarr/htdocs/stripe %_datadir/dolibarr/htdocs/stripe
%_datadir/dolibarr/htdocs/supplier_proposal %_datadir/dolibarr/htdocs/supplier_proposal
@ -224,6 +225,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/variants %_datadir/dolibarr/htdocs/variants
%_datadir/dolibarr/htdocs/webservices %_datadir/dolibarr/htdocs/webservices
%_datadir/dolibarr/htdocs/website %_datadir/dolibarr/htdocs/website
%_datadir/dolibarr/htdocs/zapier
%_datadir/dolibarr/htdocs/*.ico %_datadir/dolibarr/htdocs/*.ico
%_datadir/dolibarr/htdocs/*.patch %_datadir/dolibarr/htdocs/*.patch
%_datadir/dolibarr/htdocs/*.php %_datadir/dolibarr/htdocs/*.php

View File

@ -293,6 +293,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/public %_datadir/dolibarr/htdocs/public
%_datadir/dolibarr/htdocs/reception %_datadir/dolibarr/htdocs/reception
%_datadir/dolibarr/htdocs/resource %_datadir/dolibarr/htdocs/resource
%_datadir/dolibarr/htdocs/salaries
%_datadir/dolibarr/htdocs/societe %_datadir/dolibarr/htdocs/societe
%_datadir/dolibarr/htdocs/stripe %_datadir/dolibarr/htdocs/stripe
%_datadir/dolibarr/htdocs/supplier_proposal %_datadir/dolibarr/htdocs/supplier_proposal
@ -304,6 +305,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/variants %_datadir/dolibarr/htdocs/variants
%_datadir/dolibarr/htdocs/webservices %_datadir/dolibarr/htdocs/webservices
%_datadir/dolibarr/htdocs/website %_datadir/dolibarr/htdocs/website
%_datadir/dolibarr/htdocs/zapier
%_datadir/dolibarr/htdocs/*.ico %_datadir/dolibarr/htdocs/*.ico
%_datadir/dolibarr/htdocs/*.patch %_datadir/dolibarr/htdocs/*.patch
%_datadir/dolibarr/htdocs/*.php %_datadir/dolibarr/htdocs/*.php

View File

@ -210,6 +210,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/public %_datadir/dolibarr/htdocs/public
%_datadir/dolibarr/htdocs/reception %_datadir/dolibarr/htdocs/reception
%_datadir/dolibarr/htdocs/resource %_datadir/dolibarr/htdocs/resource
%_datadir/dolibarr/htdocs/salaries
%_datadir/dolibarr/htdocs/societe %_datadir/dolibarr/htdocs/societe
%_datadir/dolibarr/htdocs/stripe %_datadir/dolibarr/htdocs/stripe
%_datadir/dolibarr/htdocs/supplier_proposal %_datadir/dolibarr/htdocs/supplier_proposal
@ -221,6 +222,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/variants %_datadir/dolibarr/htdocs/variants
%_datadir/dolibarr/htdocs/webservices %_datadir/dolibarr/htdocs/webservices
%_datadir/dolibarr/htdocs/website %_datadir/dolibarr/htdocs/website
%_datadir/dolibarr/htdocs/zapier
%_datadir/dolibarr/htdocs/*.ico %_datadir/dolibarr/htdocs/*.ico
%_datadir/dolibarr/htdocs/*.patch %_datadir/dolibarr/htdocs/*.patch
%_datadir/dolibarr/htdocs/*.php %_datadir/dolibarr/htdocs/*.php

View File

@ -221,6 +221,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/public %_datadir/dolibarr/htdocs/public
%_datadir/dolibarr/htdocs/reception %_datadir/dolibarr/htdocs/reception
%_datadir/dolibarr/htdocs/resource %_datadir/dolibarr/htdocs/resource
%_datadir/dolibarr/htdocs/salaries
%_datadir/dolibarr/htdocs/societe %_datadir/dolibarr/htdocs/societe
%_datadir/dolibarr/htdocs/stripe %_datadir/dolibarr/htdocs/stripe
%_datadir/dolibarr/htdocs/supplier_proposal %_datadir/dolibarr/htdocs/supplier_proposal
@ -232,6 +233,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/variants %_datadir/dolibarr/htdocs/variants
%_datadir/dolibarr/htdocs/webservices %_datadir/dolibarr/htdocs/webservices
%_datadir/dolibarr/htdocs/website %_datadir/dolibarr/htdocs/website
%_datadir/dolibarr/htdocs/zapier
%_datadir/dolibarr/htdocs/*.ico %_datadir/dolibarr/htdocs/*.ico
%_datadir/dolibarr/htdocs/*.patch %_datadir/dolibarr/htdocs/*.patch
%_datadir/dolibarr/htdocs/*.php %_datadir/dolibarr/htdocs/*.php

View File

@ -63,10 +63,49 @@ with
if (isset($this->imagekeys)) { if (isset($this->imagekeys)) {
foreach($this->imagekeys as $file) { foreach($this->imagekeys as $file) {
// unlink($file); // DOL CHANGE If we keep this, source image files are physically destroyed
// unlink($file);
} }
} }
* Replace in tcpdf.php
$preserve = array(
'file_id',
'internal_encoding',
'state',
'bufferlen',
'buffer',
'cached_files',
with
$preserve = array(
'file_id',
'internal_encoding',
'state',
'bufferlen',
'buffer',
'cached_files',
// @CHANGE DOL
'imagekeys',
* Replace in tcpdf.php
if (!@TCPDF_STATIC::file_exists($file)) {
return false;
}
with
if (!@TCPDF_STATIC::file_exists($file)) {
// DOL CHANGE If we keep this, the image is not visible on pages after the first one.
//var_dump($file.' '.(!@TCPDF_STATIC::file_exists($file)));
//return false;
}
* In tecnickcom/tcpdf/include/tcpdf_static, in function fopenLocal, replace * In tecnickcom/tcpdf/include/tcpdf_static, in function fopenLocal, replace
if (strpos($filename, '://') === false) { if (strpos($filename, '://') === false) {

View File

@ -54,3 +54,5 @@ fi
echo Think to launch also: echo Think to launch also:
echo "> dev/tools/fixaltlanguages.sh fix all" echo "> dev/tools/fixaltlanguages.sh fix all"
echo "For v11: Replace also regex \(.*(sponge|cornas|eratosthene|cyan).*\) with ''"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 357 KiB

After

Width:  |  Height:  |  Size: 281 KiB

View File

@ -125,7 +125,7 @@ class AccountancyExport
* @param int $type Format id * @param int $type Format id
* @return string Format code * @return string Format code
*/ */
private static function getFormatCode($type) public static function getFormatCode($type)
{ {
$formatcode = array( $formatcode = array(
self::$EXPORT_TYPE_CONFIGURABLE => 'csv', self::$EXPORT_TYPE_CONFIGURABLE => 'csv',

View File

@ -171,6 +171,7 @@ class AccountingAccount extends CommonObject
$sql .= " a.rowid = " . (int) $rowid; $sql .= " a.rowid = " . (int) $rowid;
} elseif ($account_number) { } elseif ($account_number) {
$sql .= " a.account_number = '" . $this->db->escape($account_number) . "'"; $sql .= " a.account_number = '" . $this->db->escape($account_number) . "'";
$sql .= " AND a.entity = ".$conf->entity;
} }
if (! empty($limittocurrentchart)) { if (! empty($limittocurrentchart)) {
$sql .= ' AND a.fk_pcg_version IN (SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $this->db->escape($conf->global->CHARTOFACCOUNTS) . ')'; $sql .= ' AND a.fk_pcg_version IN (SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $this->db->escape($conf->global->CHARTOFACCOUNTS) . ')';

View File

@ -152,6 +152,8 @@ if ($action == 'validatehistory') {
while ($i < min($num_lines, 10000)) { // No more than 10000 at once while ($i < min($num_lines, 10000)) { // No more than 10000 at once
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$isBuyerInEEC = isInEEC($objp);
// Search suggested account for product/service // Search suggested account for product/service
$suggestedaccountingaccountfor = ''; $suggestedaccountingaccountfor = '';
if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country) if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)

View File

@ -230,7 +230,7 @@ if (strlen(trim($search_country))) {
elseif ($search_country == 'special_eec') $sql .= " AND co.code IN (".$country_code_in_EEC.")"; elseif ($search_country == 'special_eec') $sql .= " AND co.code IN (".$country_code_in_EEC.")";
elseif ($search_country == 'special_eecnotme') $sql .= " AND co.code IN (".$country_code_in_EEC_without_me.")"; elseif ($search_country == 'special_eecnotme') $sql .= " AND co.code IN (".$country_code_in_EEC_without_me.")";
elseif ($search_country == 'special_noteec') $sql .= " AND co.code NOT IN (".$country_code_in_EEC.")"; elseif ($search_country == 'special_noteec') $sql .= " AND co.code NOT IN (".$country_code_in_EEC.")";
else $sql .= natural_search(array("co.code", "co.label"), $search_country); else $sql .= natural_search("co.code", $search_country);
} }
if (strlen(trim($search_tvaintra))) { if (strlen(trim($search_tvaintra))) {
$sql .= natural_search("s.tva_intra", $search_tvaintra); $sql .= natural_search("s.tva_intra", $search_tvaintra);

View File

@ -262,7 +262,7 @@ if (strlen(trim($search_country))) {
elseif ($search_country == 'special_eec') $sql .= " AND co.code IN (".$country_code_in_EEC.")"; elseif ($search_country == 'special_eec') $sql .= " AND co.code IN (".$country_code_in_EEC.")";
elseif ($search_country == 'special_eecnotme') $sql .= " AND co.code IN (".$country_code_in_EEC_without_me.")"; elseif ($search_country == 'special_eecnotme') $sql .= " AND co.code IN (".$country_code_in_EEC_without_me.")";
elseif ($search_country == 'special_noteec') $sql .= " AND co.code NOT IN (".$country_code_in_EEC.")"; elseif ($search_country == 'special_noteec') $sql .= " AND co.code NOT IN (".$country_code_in_EEC.")";
else $sql .= natural_search(array("co.code", "co.label"), $search_country); else $sql .= natural_search("co.code", $search_country);
} }
if (strlen(trim($search_tvaintra))) { if (strlen(trim($search_tvaintra))) {
$sql .= natural_search("s.tva_intra", $search_tvaintra); $sql .= natural_search("s.tva_intra", $search_tvaintra);

View File

@ -141,12 +141,14 @@ if ($action == 'validatehistory') {
} else { } else {
$num_lines = $db->num_rows($result); $num_lines = $db->num_rows($result);
$isSellerInEEC = isInEEC($mysoc); $isBuyerInEEC = isInEEC($mysoc);
$i = 0; $i = 0;
while ($i < min($num_lines, 10000)) { // No more than 10000 at once while ($i < min($num_lines, 10000)) { // No more than 10000 at once
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$isSellerInEEC = isInEEC($objp);
// Search suggested account for product/service // Search suggested account for product/service
$suggestedaccountingaccountfor = ''; $suggestedaccountingaccountfor = '';
if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country) if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)

View File

@ -225,7 +225,7 @@ if (strlen(trim($search_country))) {
elseif ($search_country == 'special_eec') $sql .= " AND co.code IN (".$country_code_in_EEC.")"; elseif ($search_country == 'special_eec') $sql .= " AND co.code IN (".$country_code_in_EEC.")";
elseif ($search_country == 'special_eecnotme') $sql .= " AND co.code IN (".$country_code_in_EEC_without_me.")"; elseif ($search_country == 'special_eecnotme') $sql .= " AND co.code IN (".$country_code_in_EEC_without_me.")";
elseif ($search_country == 'special_noteec') $sql .= " AND co.code NOT IN (".$country_code_in_EEC.")"; elseif ($search_country == 'special_noteec') $sql .= " AND co.code NOT IN (".$country_code_in_EEC.")";
else $sql .= natural_search(array("co.code", "co.label"), $search_country); else $sql .= natural_search("co.code", $search_country);
} }
if (strlen(trim($search_tvaintra))) { if (strlen(trim($search_tvaintra))) {
$sql .= natural_search("s.tva_intra", $search_tvaintra); $sql .= natural_search("s.tva_intra", $search_tvaintra);

View File

@ -263,7 +263,7 @@ if (strlen(trim($search_country))) {
elseif ($search_country == 'special_eec') $sql .= " AND co.code IN (".$country_code_in_EEC.")"; elseif ($search_country == 'special_eec') $sql .= " AND co.code IN (".$country_code_in_EEC.")";
elseif ($search_country == 'special_eecnotme') $sql .= " AND co.code IN (".$country_code_in_EEC_without_me.")"; elseif ($search_country == 'special_eecnotme') $sql .= " AND co.code IN (".$country_code_in_EEC_without_me.")";
elseif ($search_country == 'special_noteec') $sql .= " AND co.code NOT IN (".$country_code_in_EEC.")"; elseif ($search_country == 'special_noteec') $sql .= " AND co.code NOT IN (".$country_code_in_EEC.")";
else $sql .= natural_search(array("co.code", "co.label"), $search_country); else $sql .= natural_search("co.code", $search_country);
} }
if (strlen(trim($search_tvaintra))) { if (strlen(trim($search_tvaintra))) {
$sql .= natural_search("s.tva_intra", $search_tvaintra); $sql .= natural_search("s.tva_intra", $search_tvaintra);

View File

@ -34,8 +34,10 @@ $endaccountingperiod = dol_print_date(dol_now(), '%Y%m%d');
header('Content-Type: text/csv'); header('Content-Type: text/csv');
include_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancyexport.class.php';
$accountancyexport = new AccountancyExport($db);
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == "11" && $type_export == "general_ledger") // Specific filename for FEC model export into the general ledger if ($accountancyexport->getFormatCode($formatexportset) == $accountancyexport::$EXPORT_TYPE_FEC && $type_export == "general_ledger") // Specific filename for FEC model export into the general ledger
{ {
// FEC format is defined here: https://www.legifrance.gouv.fr/affichCodeArticle.do?idArticle=LEGIARTI000027804775&cidTexte=LEGITEXT000006069583&dateTexte=20130802&oldAction=rechCodeArticle // FEC format is defined here: https://www.legifrance.gouv.fr/affichCodeArticle.do?idArticle=LEGIARTI000027804775&cidTexte=LEGITEXT000006069583&dateTexte=20130802&oldAction=rechCodeArticle
if (empty($search_date_end)) if (empty($search_date_end))

View File

@ -2750,6 +2750,9 @@ class Adherent extends CommonObject
$nbok = 0; $nbok = 0;
$nbko = 0; $nbko = 0;
$listofmembersok = array();
$listofmembersko = array();
$arraydaysbeforeend=explode(';', $daysbeforeendlist); $arraydaysbeforeend=explode(';', $daysbeforeendlist);
foreach($arraydaysbeforeend as $daysbeforeend) // Loop on each delay foreach($arraydaysbeforeend as $daysbeforeend) // Loop on each delay
{ {
@ -2766,7 +2769,8 @@ class Adherent extends CommonObject
$datetosearchfor = dol_time_plus_duree(dol_mktime(0, 0, 0, $tmp['mon'], $tmp['mday'], $tmp['year']), $daysbeforeend, 'd'); $datetosearchfor = dol_time_plus_duree(dol_mktime(0, 0, 0, $tmp['mon'], $tmp['mday'], $tmp['year']), $daysbeforeend, 'd');
$sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'adherent'; $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'adherent';
$sql.= " WHERE datefin = '".$this->db->idate($datetosearchfor)."'"; $sql.= " WHERE entity = ".$conf->entity; // Do not use getEntity('adherent').")" here, we want the batch to be on its entity only;
$sql.= " AND datefin = '".$this->db->idate($datetosearchfor)."'";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
@ -2787,6 +2791,7 @@ class Adherent extends CommonObject
if (empty($adherent->email)) if (empty($adherent->email))
{ {
$nbko++; $nbko++;
$listofmembersko[$adherent->id]=$adherent->id;
} }
else else
{ {
@ -2828,12 +2833,16 @@ class Adherent extends CommonObject
{ {
$error++; $error++;
$this->error = $cmail->error; $this->error = $cmail->error;
$this->errors += $cmail->errors; if (! is_null($cmail->errors)) {
$this->errors += $cmail->errors;
}
$nbko++; $nbko++;
$listofmembersko[$adherent->id]=$adherent->id;
} }
else else
{ {
$nbok++; $nbok++;
$listofmembersok[$adherent->id]=$adherent->id;
$message = $msg; $message = $msg;
$sendto = $to; $sendto = $to;
@ -2892,7 +2901,10 @@ class Adherent extends CommonObject
else else
{ {
$blockingerrormsg="Can't find email template, defined into member module setup, to use for reminding"; $blockingerrormsg="Can't find email template, defined into member module setup, to use for reminding";
$nbko++; $nbko++;
$listofmembersko[$adherent->id]=$adherent->id;
break; break;
} }
} }
@ -2916,7 +2928,39 @@ class Adherent extends CommonObject
{ {
$this->output = 'Found '.($nbok + $nbko).' members to send reminder to.'; $this->output = 'Found '.($nbok + $nbko).' members to send reminder to.';
$this->output.= ' Send email successfuly to '.$nbok.' members'; $this->output.= ' Send email successfuly to '.$nbok.' members';
if ($nbko) $this->output.= ' - Canceled for '.$nbko.' member (no email or email sending error)'; if (is_array($listofmembersok)) {
$listofids = ''; $i = 0;
foreach($listofmembersok as $idmember) {
if ($i > 100) {
$listofids .= ', ...';
break;
}
if (empty($listofids)) $listofids .= ' [';
else $listofids .= ', ';
$listofids .= $idmember;
$i++;
}
if ($listofids) $listofids .= ']';
$this->output .= $listofids;
}
if ($nbko) {
$this->output.= ' - Canceled for '.$nbko.' member (no email or email sending error)';
if (is_array($listofmembersko)) {
$listofids = ''; $i = 0;
foreach($listofmembersko as $idmember) {
if ($i > 100) {
$listofids .= ', ...';
break;
}
if (empty($listofids)) $listofids .= ' [';
else $listofids .= ', ';
$listofids .= $idmember;
$i++;
}
if ($listofids) $listofids .= ']';
$this->output .= $listofids;
}
}
} }
return 0; return 0;

View File

@ -95,15 +95,15 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha'))
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOM", GETPOST("nom", 'nohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOM", GETPOST("nom", 'nohtml'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ADDRESS", GETPOST("MAIN_INFO_SOCIETE_ADDRESS", 'nohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ADDRESS", GETPOST("MAIN_INFO_SOCIETE_ADDRESS", 'nohtml'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TOWN", GETPOST("MAIN_INFO_SOCIETE_TOWN", 'nohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TOWN", GETPOST("MAIN_INFO_SOCIETE_TOWN", 'nohtml'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ZIP", GETPOST("MAIN_INFO_SOCIETE_ZIP", 'alpha'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ZIP", GETPOST("MAIN_INFO_SOCIETE_ZIP", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_REGION", GETPOST("region_code", 'alpha'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_REGION", GETPOST("region_code", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MONNAIE", GETPOST("currency", 'aZ09'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_MONNAIE", GETPOST("currency", 'aZ09'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TEL", GETPOST("tel", 'alpha'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TEL", GETPOST("tel", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FAX", GETPOST("fax", 'alpha'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FAX", GETPOST("fax", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MAIL", GETPOST("mail", 'alpha'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MAIL", GETPOST("mail", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_WEB", GETPOST("web", 'alpha'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_WEB", GETPOST("web", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOTE", GETPOST("note", 'none'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOTE", GETPOST("note", 'none'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_GENCOD", GETPOST("barcode", 'alpha'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_GENCOD", GETPOST("barcode", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
$dirforimage = $conf->mycompany->dir_output.'/logos/'; $dirforimage = $conf->mycompany->dir_output.'/logos/';

View File

@ -40,7 +40,7 @@ $update=GETPOST('update', 'alpha');
$delete=GETPOST('delete', 'none'); // Do not use alpha here $delete=GETPOST('delete', 'none'); // Do not use alpha here
$debug=GETPOST('debug', 'int'); $debug=GETPOST('debug', 'int');
$consts=GETPOST('const', 'array'); $consts=GETPOST('const', 'array');
$constname=GETPOST('constname', 'alpha'); $constname=GETPOST('constname', 'alphanohtml');
$constvalue=GETPOST('constvalue', 'none'); // We shoul dbe able to send everything here $constvalue=GETPOST('constvalue', 'none'); // We shoul dbe able to send everything here
$constnote=GETPOST('constnote', 'alpha'); $constnote=GETPOST('constnote', 'alpha');

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2017-2018 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2017-2020 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2017-2018 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2017-2018 Regis Houssin <regis.houssin@inodbox.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -52,15 +52,15 @@ $pagenext = $page + 1;
if (!$sortfield) $sortfield = 'page,param'; if (!$sortfield) $sortfield = 'page,param';
if (!$sortorder) $sortorder = 'ASC'; if (!$sortorder) $sortorder = 'ASC';
$defaulturl = GETPOST('defaulturl'); $defaulturl = GETPOST('defaulturl', 'alphanohtml');
$defaultkey = GETPOST('defaultkey', 'alpha'); $defaultkey = GETPOST('defaultkey', 'alphanohtml');
$defaultvalue = GETPOST('defaultvalue'); $defaultvalue = GETPOST('defaultvalue', 'none');
$defaulturl = preg_replace('/^\//', '', $defaulturl); $defaulturl = preg_replace('/^\//', '', $defaulturl);
$urlpage = GETPOST('urlpage'); $urlpage = GETPOST('urlpage', 'alphanohtml');
$key = GETPOST('key'); $key = GETPOST('key', 'alphanohtml');
$value = GETPOST('value'); $value = GETPOST('value', 'none');
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('admindefaultvalues', 'globaladmin')); $hookmanager->initHooks(array('admindefaultvalues', 'globaladmin'));
@ -193,14 +193,14 @@ $enabledisablehtml .= $langs->trans("EnableDefaultValues").' ';
if (empty($conf->global->MAIN_ENABLE_DEFAULT_VALUES)) if (empty($conf->global->MAIN_ENABLE_DEFAULT_VALUES))
{ {
// Button off, click to enable // Button off, click to enable
$enabledisablehtml .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_DEFAULT_VALUES&value=1'.$param.'">'; $enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_DEFAULT_VALUES&value=1'.$param.'">';
$enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off'); $enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off');
$enabledisablehtml .= '</a>'; $enabledisablehtml .= '</a>';
} }
else else
{ {
// Button on, click to disable // Button on, click to disable
$enabledisablehtml .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_DEFAULT_VALUES&value=0'.$param.'">'; $enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_DEFAULT_VALUES&value=0'.$param.'">';
$enabledisablehtml .= img_picto($langs->trans("Activated"), 'switch_on'); $enabledisablehtml .= img_picto($langs->trans("Activated"), 'switch_on');
$enabledisablehtml .= '</a>'; $enabledisablehtml .= '</a>';
} }
@ -210,9 +210,9 @@ print load_fiche_titre($langs->trans("DefaultValues"), $enabledisablehtml, 'titl
print '<span class="opacitymedium">'.$langs->trans("DefaultValuesDesc")."</span><br>\n"; print '<span class="opacitymedium">'.$langs->trans("DefaultValuesDesc")."</span><br>\n";
print "<br>\n"; print "<br>\n";
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage; if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit; if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
if ($optioncss != '') $param .= '&optioncss='.$optioncss; if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
if ($defaulturl) $param .= '&defaulturl='.urlencode($defaulturl); if ($defaulturl) $param .= '&defaulturl='.urlencode($defaulturl);
if ($defaultkey) $param .= '&defaultkey='.urlencode($defaultkey); if ($defaultkey) $param .= '&defaultkey='.urlencode($defaultkey);
if ($defaultvalue) $param .= '&defaultvalue='.urlencode($defaultvalue); if ($defaultvalue) $param .= '&defaultvalue='.urlencode($defaultvalue);
@ -359,7 +359,7 @@ if ($result)
// Page // Page
print '<td>'; print '<td>';
if ($action != 'edit' || GETPOST('rowid') != $obj->rowid) print $obj->page; if ($action != 'edit' || GETPOST('rowid', 'int') != $obj->rowid) print $obj->page;
else print '<input type="text" name="urlpage" value="'.dol_escape_htmltag($obj->page).'">'; else print '<input type="text" name="urlpage" value="'.dol_escape_htmltag($obj->page).'">';
print '</td>'."\n"; print '</td>'."\n";
@ -378,7 +378,7 @@ if ($result)
print '<input type="hidden" name="const['.$i.'][name]" value="'.$obj->transkey.'">'; print '<input type="hidden" name="const['.$i.'][name]" value="'.$obj->transkey.'">';
print '<input type="text" id="value_'.$i.'" class="flat inputforupdate" size="30" name="const['.$i.'][value]" value="'.dol_escape_htmltag($obj->transvalue).'">'; print '<input type="text" id="value_'.$i.'" class="flat inputforupdate" size="30" name="const['.$i.'][value]" value="'.dol_escape_htmltag($obj->transvalue).'">';
*/ */
if ($action != 'edit' || GETPOST('rowid') != $obj->rowid) print $obj->value; if ($action != 'edit' || GETPOST('rowid') != $obj->rowid) print dol_escape_htmltag($obj->value);
else print '<input type="text" name="value" value="'.dol_escape_htmltag($obj->value).'">'; else print '<input type="text" name="value" value="'.dol_escape_htmltag($obj->value).'">';
print '</td>'; print '</td>';
} }

View File

@ -58,6 +58,7 @@ if ($id == 10 && !empty($user->rights->accounting->chartofaccount)) $allowed = 1
if ($id == 17 && !empty($user->rights->accounting->chartofaccount)) $allowed = 1; // Dictionary with type of expense report and accounting account allowed to manager of chart account if ($id == 17 && !empty($user->rights->accounting->chartofaccount)) $allowed = 1; // Dictionary with type of expense report and accounting account allowed to manager of chart account
if (!$allowed) accessforbidden(); if (!$allowed) accessforbidden();
$acts =array(); $actl =array();
$acts[0] = "activate"; $acts[0] = "activate";
$acts[1] = "disable"; $acts[1] = "disable";
$actl[0] = img_picto($langs->trans("Disabled"), 'switch_off'); $actl[0] = img_picto($langs->trans("Disabled"), 'switch_off');
@ -76,7 +77,7 @@ $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
$search_country_id = GETPOST('search_country_id', 'int'); $search_country_id = GETPOST('search_country_id', 'int');
if ($search_country_id == '' && ($id == 2 || $id == 3 || $id == 10)) // Not a so good idea to force on current country for all dictionaries. Some tables have entries that are for all countries, we must be able to see them, so this is done for dedicated dictionaries only. if (! GETPOSTISSET('search_country_id') && $search_country_id == '' && ($id == 2 || $id == 3 || $id == 10)) // Not a so good idea to force on current country for all dictionaries. Some tables have entries that are for all countries, we must be able to see them, so this is done for dedicated dictionaries only.
{ {
$search_country_id = $mysoc->country_id; $search_country_id = $mysoc->country_id;
} }
@ -178,7 +179,7 @@ $tablib[38] = "DictionarySocialNetworks";
$tabsql = array(); $tabsql = array();
$tabsql[1] = "SELECT f.rowid as rowid, f.code, f.libelle, c.code as country_code, c.label as country, f.active FROM ".MAIN_DB_PREFIX."c_forme_juridique as f, ".MAIN_DB_PREFIX."c_country as c WHERE f.fk_pays=c.rowid"; $tabsql[1] = "SELECT f.rowid as rowid, f.code, f.libelle, c.code as country_code, c.label as country, f.active FROM ".MAIN_DB_PREFIX."c_forme_juridique as f, ".MAIN_DB_PREFIX."c_country as c WHERE f.fk_pays=c.rowid";
$tabsql[2] = "SELECT d.rowid as rowid, d.code_departement as code, d.nom as libelle, d.fk_region as region_id, r.nom as region, c.code as country_code, c.label as country, d.active FROM ".MAIN_DB_PREFIX."c_departements as d, ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_country as c WHERE d.fk_region=r.code_region and r.fk_pays=c.rowid and r.active=1 and c.active=1"; $tabsql[2] = "SELECT d.rowid as rowid, d.code_departement as code, d.nom as libelle, d.fk_region as region_id, r.nom as region, c.code as country_code, c.label as country, d.active FROM ".MAIN_DB_PREFIX."c_departements as d, ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_country as c WHERE d.fk_region=r.code_region and r.fk_pays=c.rowid and r.active=1 and c.active=1";
$tabsql[3] = "SELECT r.rowid as rowid, r.code_region as code, r.nom as libelle, r.fk_pays as country_id, c.code as country_code, c.label as country, r.active FROM ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_country as c WHERE r.fk_pays=c.rowid and c.active=1"; $tabsql[3] = "SELECT r.rowid as rowid, r.code_region as state_code, r.nom as libelle, r.fk_pays as country_id, c.code as country_code, c.label as country, r.active FROM ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_country as c WHERE r.fk_pays=c.rowid and c.active=1";
$tabsql[4] = "SELECT c.rowid as rowid, c.code, c.label, c.active, c.favorite FROM ".MAIN_DB_PREFIX."c_country AS c"; $tabsql[4] = "SELECT c.rowid as rowid, c.code, c.label, c.active, c.favorite FROM ".MAIN_DB_PREFIX."c_country AS c";
$tabsql[5] = "SELECT c.rowid as rowid, c.code as code, c.label, c.active FROM ".MAIN_DB_PREFIX."c_civility AS c"; $tabsql[5] = "SELECT c.rowid as rowid, c.code as code, c.label, c.active FROM ".MAIN_DB_PREFIX."c_civility AS c";
$tabsql[6] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.type, a.active, a.module, a.color, a.position FROM ".MAIN_DB_PREFIX."c_actioncomm AS a"; $tabsql[6] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.type, a.active, a.module, a.color, a.position FROM ".MAIN_DB_PREFIX."c_actioncomm AS a";
@ -759,12 +760,13 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$_POST[$listfieldvalue[$i]] = getEntity($tabname[$id]); $_POST[$listfieldvalue[$i]] = getEntity($tabname[$id]);
} }
if ($i) $sql .= ","; if ($i) $sql .= ",";
if ($listfieldvalue[$i] == 'sortorder') // For column name 'sortorder', we use the field name 'position' if ($listfieldvalue[$i] == 'sortorder') // For column name 'sortorder', we use the field name 'position'
{ {
$sql .= "'".(int) $db->escape($_POST['position'])."'"; $sql .= "'".(int) $db->escape(GETPOST('position'))."'";
} }
elseif ($_POST[$listfieldvalue[$i]] == '' && !($listfieldvalue[$i] == 'code' && $id == 10)) $sql .= "null"; // For vat, we want/accept code = '' elseif ($_POST[$listfieldvalue[$i]] == '' && !($listfieldvalue[$i] == 'code' && $id == 10)) $sql .= "null"; // For vat, we want/accept code = ''
else $sql .= "'".$db->escape($_POST[$listfieldvalue[$i]])."'"; else $sql .= "'".$db->escape(GETPOST($listfieldvalue[$i], 'nohtml'))."'";
$i++; $i++;
} }
$sql .= ",1)"; $sql .= ",1)";
@ -1011,6 +1013,7 @@ if ($id)
if ($search_code != '' && $id == 9) $sql .= natural_search("code_iso", $search_code); if ($search_code != '' && $id == 9) $sql .= natural_search("code_iso", $search_code);
elseif ($search_code != '' && $id == 28) $sql .= natural_search("h.code", $search_code); elseif ($search_code != '' && $id == 28) $sql .= natural_search("h.code", $search_code);
elseif ($search_code != '' && $id == 32) $sql .= natural_search("a.code", $search_code); elseif ($search_code != '' && $id == 32) $sql .= natural_search("a.code", $search_code);
elseif ($search_code != '' && $id == 3) $sql .= natural_search("r.code_region", $search_code);
elseif ($search_code != '' && $id != 9) $sql .= natural_search("code", $search_code); elseif ($search_code != '' && $id != 9) $sql .= natural_search("code", $search_code);
if ($sortfield) if ($sortfield)
@ -1146,7 +1149,7 @@ if ($id)
if ($fieldlist[$field] == 'revenuestamp_type') { $valuetoshow = $langs->trans('TypeOfRevenueStamp'); } if ($fieldlist[$field] == 'revenuestamp_type') { $valuetoshow = $langs->trans('TypeOfRevenueStamp'); }
if ($fieldlist[$field] == 'use_default') { $valuetoshow = $langs->trans('Default'); } if ($fieldlist[$field] == 'use_default') { $valuetoshow = $langs->trans('Default'); }
if ($id == 2) // Special cas for state page if ($id == 2) // Special case for state page
{ {
if ($fieldlist[$field] == 'region_id') { $valuetoshow = '&nbsp;'; $showfield = 1; } if ($fieldlist[$field] == 'region_id') { $valuetoshow = '&nbsp;'; $showfield = 1; }
if ($fieldlist[$field] == 'region') { $valuetoshow = $langs->trans("Country").'/'.$langs->trans("Region"); $showfield = 1; } if ($fieldlist[$field] == 'region') { $valuetoshow = $langs->trans("Country").'/'.$langs->trans("Region"); $showfield = 1; }
@ -1228,6 +1231,7 @@ if ($id)
// List of available record in database // List of available record in database
dol_syslog("htdocs/admin/dict", LOG_DEBUG); dol_syslog("htdocs/admin/dict", LOG_DEBUG);
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
@ -1620,7 +1624,9 @@ if ($id)
$key = $langs->trans($obj->label); $key = $langs->trans($obj->label);
$valuetoshow = ($obj->label && $key != strtoupper($obj->label) ? $key : $obj->{$fieldlist[$field]}); $valuetoshow = ($obj->label && $key != strtoupper($obj->label) ? $key : $obj->{$fieldlist[$field]});
} }
elseif ($fieldlist[$field] == 'code' && $id == 3) {
$valuetoshow = $obj->state_code;
}
$class .= ($class ? ' ' : '').'tddict'; $class .= ($class ? ' ' : '').'tddict';
if ($fieldlist[$field] == 'note' && $id == 10) $class .= ' tdoverflowmax200'; if ($fieldlist[$field] == 'note' && $id == 10) $class .= ' tdoverflowmax200';
if ($fieldlist[$field] == 'tracking') $class .= ' tdoverflowauto'; if ($fieldlist[$field] == 'tracking') $class .= ' tdoverflowauto';

View File

@ -349,7 +349,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
} }
// Call Hook formConfirm // Call Hook formConfirm
$parameters = array('lineid' => $lineid); $parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid);
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) $formconfirm .= $hookmanager->resPrint; if (empty($reshook)) $formconfirm .= $hookmanager->resPrint;
elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint; elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint;

View File

@ -201,7 +201,7 @@ dol_fiche_head($head, 'shipment', $langs->trans("Sendings"), -1, 'sending');
// Shipment numbering model // Shipment numbering model
print load_fiche_titre($langs->trans("SendingsNumberingModules")); print load_fiche_titre($langs->trans("SendingsNumberingModules"), '', '');
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@ -304,7 +304,7 @@ print '</table><br>';
/* /*
* Documents models for Sendings Receipt * Documents models for Sendings Receipt
*/ */
print load_fiche_titre($langs->trans("SendingsReceiptModel")); print load_fiche_titre($langs->trans("SendingsReceiptModel"), '', '');
// Defini tableau def de modele invoice // Defini tableau def de modele invoice
$type="shipping"; $type="shipping";
@ -463,7 +463,7 @@ print '<br>';
* Other options * Other options
* *
*/ */
print load_fiche_titre($langs->trans("OtherOptions")); print load_fiche_titre($langs->trans("OtherOptions"), '', '');
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';

View File

@ -758,13 +758,31 @@ else
$text = ''; $text = '';
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail') if ($conf->global->MAIN_MAIL_SENDMODE == 'mail')
{ {
$text .= $langs->trans("WarningPHPMail"); $text .= $langs->trans("WarningPHPMail"); // To encourage to use SMTPS
} }
//$conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS='1.2.3.4';
if (!empty($conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS)) if ($conf->global->MAIN_MAIL_SENDMODE == 'mail')
{ {
$text .= ($text ? '<br>' : '').$langs->trans("WarningPHPMail2", $conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS); // MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS is list of IPs where email is sent from. Example: '1.2.3.4, [aaaa:bbbb:cccc:dddd]'.
if (!empty($conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS))
{
// List of IP show as record to add in SPF if we use the mail method
$text .= ($text ? '<br><br>' : '').$langs->trans("WarningPHPMailSPF", $conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS);
}
} else {
if (!empty($conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS))
{
// List of IP show as record to add as allowed IP if we use the smtp method
$text .= ($text ? '<br><br>' : '').$langs->trans("WarningPHPMail2", $conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS);
}
if (!empty($conf->global->MAIN_EXTERNAL_SMTP_SPF_STRING_TO_ADD))
{
// List of string to add in SPF if we use the smtp method
$text .= ($text ? '<br><br>' : '').$langs->trans("WarningPHPMailSPF", $conf->global->MAIN_EXTERNAL_SMTP_SPF_STRING_TO_ADD);
}
} }
if ($text) print info_admin($text); if ($text) print info_admin($text);
} }
@ -840,6 +858,11 @@ else
print $formmail->get_form('addfile', 'removefile'); print $formmail->get_form('addfile', 'removefile');
dol_fiche_end(); dol_fiche_end();
// References
print '<span class="opacitymedium">'.$langs->trans("EMailsWillHaveMessageID").': ';
print dol_escape_htmltag('<timestamp.*@'.dol_getprefix('email').'>');
print '</span>';
} }
} }

View File

@ -113,10 +113,12 @@ llxHeader('', $langs->trans("NotificationSetup"));
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("NotificationSetup"), $linkback, 'title_setup'); print load_fiche_titre($langs->trans("NotificationSetup"), $linkback, 'title_setup');
print '<span class="opacitymedium">';
print $langs->trans("NotificationsDesc").'<br>'; print $langs->trans("NotificationsDesc").'<br>';
print $langs->trans("NotificationsDescUser").'<br>'; print $langs->trans("NotificationsDescUser").'<br>';
if (!empty($conf->societe->enabled)) print $langs->trans("NotificationsDescContact").'<br>'; if (!empty($conf->societe->enabled)) print $langs->trans("NotificationsDescContact").'<br>';
print $langs->trans("NotificationsDescGlobal").'<br>'; print $langs->trans("NotificationsDescGlobal").'<br>';
print '</span>';
print '<br>'; print '<br>';
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';

View File

@ -49,12 +49,15 @@ $tmp=getBrowserInfo($_SERVER["HTTP_USER_AGENT"]);
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td colspan="2">'.$langs->trans("Value").'</td></tr>'."\n"; print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td colspan="2">'.$langs->trans("Value").'</td></tr>'."\n";
print '<tr class="oddeven"><td width="300">'.$langs->trans("UserAgent").'</td><td colspan="2">'.$_SERVER['HTTP_USER_AGENT'].'</td></tr>'."\n"; print '<tr class="oddeven"><td width="300">'.$langs->trans("UserAgent").'</td><td colspan="2">'.dol_escape_htmltag($_SERVER['HTTP_USER_AGENT']).'</td></tr>'."\n";
print '<tr class="oddeven"><td width="300">'.$langs->trans("BrowserName").'</td><td colspan="2">'.$tmp['browsername'].'</td></tr>'."\n"; print '<tr class="oddeven"><td width="300">'.$langs->trans("BrowserName").'</td><td colspan="2">'.$tmp['browsername'].'</td></tr>'."\n";
print '<tr class="oddeven"><td width="300">'.$langs->trans("BrowserOS").'</td><td colspan="2">'.$tmp['browseros'].'</td></tr>'."\n"; print '<tr class="oddeven"><td width="300">'.$langs->trans("BrowserOS").'</td><td colspan="2">'.$tmp['browseros'].'</td></tr>'."\n";
print '<tr class="oddeven"><td width="300">'.$langs->trans("Version").'</td><td colspan="2">'.$tmp['browserversion'].'</td></tr>'."\n"; print '<tr class="oddeven"><td width="300">'.$langs->trans("Version").'</td><td colspan="2">'.$tmp['browserversion'].'</td></tr>'."\n";
print '<tr class="oddeven"><td width="300">'.$langs->trans("Layout").' (phone/tablet/classic)</td><td colspan="2">'.$tmp['layout'].'</td></tr>'."\n"; print '<tr class="oddeven"><td width="300">'.$langs->trans("Layout").' (phone/tablet/classic)</td><td colspan="2">'.$tmp['layout'].'</td></tr>'."\n";
print '<tr class="oddeven"><td width="300">'.$langs->trans("IPAddress").'</td><td colspan="2">'.$_SERVER['REMOTE_ADDR'].'</td></tr>'."\n"; print '<tr class="oddeven"><td width="300">'.$langs->trans("IPAddress").'</td><td colspan="2">'.dol_escape_htmltag($_SERVER['REMOTE_ADDR']);
if (! empty($_SERVER['HTTP_CLIENT_IP'])) print ' (HTTP_CLIENT_IP='.dol_escape_htmltag($_SERVER['HTTP_CLIENT_IP']).')';
if (! empty($_SERVER['HTTP_X_FORWARDED_FOR'])) print ' (HTTP_X_FORWARDED_FOR='.dol_escape_htmltag($_SERVER['HTTP_X_FORWARDED_FOR']).')';
print '</td></tr>'."\n";
print '<tr class="oddeven"><td width="300">'.$langs->trans("SessionName").'</td><td colspan="2">'.session_name().'</td></tr>'."\n"; print '<tr class="oddeven"><td width="300">'.$langs->trans("SessionName").'</td><td colspan="2">'.session_name().'</td></tr>'."\n";
print '<tr class="oddeven"><td width="300">'.$langs->trans("SessionId").'</td><td colspan="2">'.session_id().'</td></tr>'."\n"; print '<tr class="oddeven"><td width="300">'.$langs->trans("SessionId").'</td><td colspan="2">'.session_id().'</td></tr>'."\n";

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2007-2016 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2007-2020 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009-2017 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2009-2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2017 Frédéric France <frederic.france@free.fr> * Copyright (C) 2017 Frédéric France <frederic.france@free.fr>
* *
@ -35,9 +35,9 @@ if (!$user->admin) accessforbidden();
$id = GETPOST('rowid', 'int'); $id = GETPOST('rowid', 'int');
$action = GETPOST('action', 'alpha'); $action = GETPOST('action', 'alpha');
$langcode = GETPOST('langcode', 'alpha'); $langcode = GETPOST('langcode', 'alphanohtml');
$transkey = GETPOST('transkey', 'alpha'); $transkey = GETPOST('transkey', 'alphanohtml');
$transvalue = GETPOST('transvalue', 'alpha'); $transvalue = GETPOST('transvalue', 'none');
$mode = GETPOST('mode', 'aZ09') ?GETPOST('mode', 'aZ09') : 'overwrite'; $mode = GETPOST('mode', 'aZ09') ?GETPOST('mode', 'aZ09') : 'overwrite';
@ -190,7 +190,6 @@ if ($action == 'delete')
/* /*
* View * View
*/ */
@ -208,14 +207,14 @@ $enabledisablehtml .= $langs->trans("EnableOverwriteTranslation").' ';
if (empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION)) if (empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION))
{ {
// Button off, click to enable // Button off, click to enable
$enabledisablehtml .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_OVERWRITE_TRANSLATION&value=1'.$param.'">'; $enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_OVERWRITE_TRANSLATION&value=1'.$param.'">';
$enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off'); $enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off');
$enabledisablehtml .= '</a>'; $enabledisablehtml .= '</a>';
} }
else else
{ {
// Button on, click to disable // Button on, click to disable
$enabledisablehtml .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_OVERWRITE_TRANSLATION&value=0'.$param.'">'; $enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_OVERWRITE_TRANSLATION&value=0'.$param.'">';
$enabledisablehtml .= img_picto($langs->trans("Activated"), 'switch_on'); $enabledisablehtml .= img_picto($langs->trans("Activated"), 'switch_on');
$enabledisablehtml .= '</a>'; $enabledisablehtml .= '</a>';
} }
@ -231,9 +230,9 @@ print '<span class="opacitymedium">'.$form->textwithpicto($langs->trans("Current
print '<br>'; print '<br>';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
if ($optioncss != '') $param.='&optioncss='.$optioncss; if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
if ($langcode) $param.='&langcode='.urlencode($langcode); if ($langcode) $param.='&langcode='.urlencode($langcode);
if ($transkey) $param.='&transkey='.urlencode($transkey); if ($transkey) $param.='&transkey='.urlencode($transkey);
if ($transvalue) $param.='&transvalue='.urlencode($transvalue); if ($transvalue) $param.='&transvalue='.urlencode($transvalue);
@ -348,11 +347,11 @@ if ($mode == 'overwrite')
*/ */
if ($action == 'edit' && $obj->rowid == GETPOST('rowid', 'int')) if ($action == 'edit' && $obj->rowid == GETPOST('rowid', 'int'))
{ {
print '<input type="text" class="quatrevingtpercent" name="transvalue" value="'.$obj->transvalue.'">'; print '<input type="text" class="quatrevingtpercent" name="transvalue" value="'.dol_escape_htmltag($obj->transvalue).'">';
} }
else else
{ {
print $obj->transvalue; print dol_escape_htmltag($obj->transvalue);
} }
print '</td>'; print '</td>';

View File

@ -150,6 +150,12 @@ class DolibarrApi
unset($object->context); unset($object->context);
unset($object->next_prev_filter); unset($object->next_prev_filter);
unset($object->region);
unset($object->region_code);
unset($object->libelle_statut);
unset($object->libelle_paiement);
if ($object->table_element != 'ticket') { if ($object->table_element != 'ticket') {
unset($object->comments); unset($object->comments);
} }

View File

@ -53,7 +53,7 @@ class Setup extends DolibarrApi
* @param int $limit Number of items per page * @param int $limit Number of items per page
* @param int $page Page number {@min 0} * @param int $page Page number {@min 0}
* @param int $active Payment type is active or not {@min 0} {@max 1} * @param int $active Payment type is active or not {@min 0} {@max 1}
* @param string $sqlfilters SQL criteria to filter with. Syntax example "(t.code:=:'CHQ')" * @param string $sqlfilters SQL criteria to filter with. Syntax example "(t.code:=:'OrderByWWW')"
* *
* @url GET dictionary/ordering_methods * @url GET dictionary/ordering_methods
* *

View File

@ -224,7 +224,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
} }
// Call Hook formConfirm // Call Hook formConfirm
$parameters = array('lineid' => $lineid); $parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid);
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) $formconfirm .= $hookmanager->resPrint; if (empty($reshook)) $formconfirm .= $hookmanager->resPrint;
elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint; elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint;

View File

@ -155,6 +155,8 @@ if (empty($reshook))
if (!$error) if (!$error)
{ {
$lastposition = 0;
$bomline = new BOMLine($db); $bomline = new BOMLine($db);
$bomline->fk_bom = $id; $bomline->fk_bom = $id;
$bomline->fk_product = $idprod; $bomline->fk_product = $idprod;
@ -163,6 +165,12 @@ if (empty($reshook))
$bomline->disable_stock_change = (int) $disable_stock_change; $bomline->disable_stock_change = (int) $disable_stock_change;
$bomline->efficiency = $efficiency; $bomline->efficiency = $efficiency;
// Rang to use
$rangmax = $object->line_max(0);
$ranktouse = $rangmax + 1;
$bomline->position = ($ranktouse + 1);
$result = $bomline->create($user); $result = $bomline->create($user);
if ($result <= 0) if ($result <= 0)
{ {
@ -449,7 +457,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
} }
// Call Hook formConfirm // Call Hook formConfirm
$parameters = array('lineid' => $lineid); $parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid);
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) $formconfirm .= $hookmanager->resPrint; if (empty($reshook)) $formconfirm .= $hookmanager->resPrint;
elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint; elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint;

View File

@ -1116,7 +1116,7 @@ class Categorie extends CommonObject
// Include or exclude leaf including $markafterid from tree // Include or exclude leaf including $markafterid from tree
if (count($markafterid) > 0) if (count($markafterid) > 0)
{ {
$keyfiltercatid = implode('|', $markafterid); $keyfiltercatid = '(' . implode('|', $markafterid) . ')';
//print "Look to discard category ".$markafterid."\n"; //print "Look to discard category ".$markafterid."\n";
$keyfilter1 = '^'.$keyfiltercatid.'$'; $keyfilter1 = '^'.$keyfiltercatid.'$';

View File

@ -207,7 +207,7 @@ elseif ($type == Categorie::TYPE_MEMBER) $title = $langs->trans("MembersCateg
elseif ($type == Categorie::TYPE_CONTACT) $title = $langs->trans("ContactCategoriesShort"); elseif ($type == Categorie::TYPE_CONTACT) $title = $langs->trans("ContactCategoriesShort");
elseif ($type == Categorie::TYPE_ACCOUNT) $title = $langs->trans("AccountsCategoriesShort"); elseif ($type == Categorie::TYPE_ACCOUNT) $title = $langs->trans("AccountsCategoriesShort");
elseif ($type == Categorie::TYPE_PROJECT) $title = $langs->trans("ProjectsCategoriesShort"); elseif ($type == Categorie::TYPE_PROJECT) $title = $langs->trans("ProjectsCategoriesShort");
elseif ($type == Categorie::TYPE_USER) $title = $langs->trans("ProjectsCategoriesShort"); elseif ($type == Categorie::TYPE_USER) $title = $langs->trans("UsersCategoriesShort");
else $title = $langs->trans("Category"); else $title = $langs->trans("Category");
$head = categories_prepare_head($object, $type); $head = categories_prepare_head($object, $type);

View File

@ -229,7 +229,6 @@ class AgendaEvents extends DolibarrApi
* *
* @return int * @return int
*/ */
/*
public function put($id, $request_data = null) public function put($id, $request_data = null)
{ {
if (! DolibarrApiAccess::$user->rights->agenda->myactions->create) { if (! DolibarrApiAccess::$user->rights->agenda->myactions->create) {
@ -245,11 +244,11 @@ class AgendaEvents extends DolibarrApi
$this->actioncomm->fetch_userassigned(); $this->actioncomm->fetch_userassigned();
$this->actioncomm->oldcopy = clone $this->actioncomm; $this->actioncomm->oldcopy = clone $this->actioncomm;
} }
if ( ! $result ) { if (! $result ) {
throw new RestException(404, 'actioncomm not found'); throw new RestException(404, 'actioncomm not found');
} }
if ( ! DolibarrApi::_checkAccessToResource('actioncomm',$this->actioncomm->id)) { if (! DolibarrApi::_checkAccessToResource('actioncomm', $this->actioncomm->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
} }
foreach($request_data as $field => $value) { foreach($request_data as $field => $value) {
@ -257,12 +256,11 @@ class AgendaEvents extends DolibarrApi
$this->actioncomm->$field = $value; $this->actioncomm->$field = $value;
} }
if ($this->actioncomm->update($id, DolibarrApiAccess::$user,1,'','','update')) if ($this->actioncomm->update(DolibarrApiAccess::$user, 1) > 0)
return $this->get($id); return $this->get($id);
return false; return false;
} }
*/
/** /**
* Delete Agenda Event * Delete Agenda Event

View File

@ -49,10 +49,10 @@ $usergroup = GETPOST("search_usergroup", "int", 3) ?GETPOST("search_usergroup",
$showbirthday = 0; $showbirthday = 0;
// If not choice done on calendar owner, we filter on user. // If not choice done on calendar owner, we filter on user.
if (empty($filtert) && empty($conf->global->AGENDA_ALL_CALENDARS)) /*if (empty($filtert) && empty($conf->global->AGENDA_ALL_CALENDARS))
{ {
$filtert = $user->id; $filtert = $user->id;
} }*/
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha');

View File

@ -1953,7 +1953,7 @@ if ($action == 'create')
} }
// Call Hook formConfirm // Call Hook formConfirm
$parameters = array('lineid' => $lineid); $parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid);
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) $formconfirm .= $hookmanager->resPrint; if (empty($reshook)) $formconfirm .= $hookmanager->resPrint;
elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint; elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint;

View File

@ -2064,7 +2064,7 @@ if ($action == 'create' && $usercancreate)
} }
// Call Hook formConfirm // Call Hook formConfirm
$parameters = array('lineid' => $lineid); $parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid);
// Note that $action and $object may be modified by hook // Note that $action and $object may be modified by hook
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action);
if (empty($reshook)) $formconfirm .= $hookmanager->resPrint; if (empty($reshook)) $formconfirm .= $hookmanager->resPrint;

View File

@ -353,8 +353,13 @@ if (GETPOST('save') && !$cancel && $user->rights->banque->modifier)
if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->banque->modifier) if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->banque->modifier)
{ {
$accline = new AccountLine($db); $accline = new AccountLine($db);
$result = $accline->fetch(GETPOST("rowid")); $result = $accline->fetch(GETPOST("rowid", "int"));
$result = $accline->delete($user); $result = $accline->delete($user);
if ($result <= 0) {
setEventMessages($accline->error, $accline->errors, 'errors');
} else {
setEventMessages('RecordDeleted', null, 'mesgs');
}
} }

View File

@ -1883,13 +1883,15 @@ class AccountLine extends CommonObject
} }
/** /**
* Delete transaction bank line record * Delete bank transaction record
* *
* @param User $user User object that delete * @param User $user User object that delete
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function delete(User $user = null) public function delete(User $user = null)
{ {
global $conf;
$nbko = 0; $nbko = 0;
if ($this->rappro) if ($this->rappro)
@ -1901,6 +1903,26 @@ class AccountLine extends CommonObject
$this->db->begin(); $this->db->begin();
// Protection to avoid any delete of accounted lines. Protection on by default
if (empty($conf->global->BANK_ALLOW_TRANSACTION_DELETION_EVEN_IF_IN_ACCOUNTING))
{
$sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."accounting_bookkeeping WHERE doc_type = 'bank' AND fk_doc = ".$this->id;
$resql = $this->db->query($sql);
if ($resql) {
$obj = $this->db->fetch_object($resql);
if ($obj && $obj->nb) {
$this->error = 'ErrorRecordAlreadyInAccountingDeletionNotPossible';
$this->db->rollback();
return -1;
}
}
else {
$this->error = $this->db->lasterror();
$this->db->rollback();
return -1;
}
}
// Delete urls // Delete urls
$result = $this->delete_urls($user); $result = $this->delete_urls($user);
if ($result < 0) if ($result < 0)
@ -2250,11 +2272,11 @@ class AccountLine extends CommonObject
/** /**
* Return clicable name (with picto eventually) * Return clickable name (with picto eventually)
* *
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param int $maxlen Longueur max libelle * @param int $maxlen Longueur max libelle
* @param string $option Option ('showall') * @param string $option Option ('', 'showall', 'showconciliated', 'showconciliatedandaccounted'). Options may be slow.
* @param int $notooltip 1=Disable tooltip * @param int $notooltip 1=Disable tooltip
* @return string Chaine avec URL * @return string Chaine avec URL
*/ */
@ -2272,7 +2294,7 @@ class AccountLine extends CommonObject
if ($withpicto != 2) $result .= ($this->ref ? $this->ref : $this->rowid); if ($withpicto != 2) $result .= ($this->ref ? $this->ref : $this->rowid);
$result .= $linkend; $result .= $linkend;
if ($option == 'showall' || $option == 'showconciliated') $result .= ' ('; if ($option == 'showall' || $option == 'showconciliated' || $option == 'showconciliatedandaccounted') $result .= ' <span class="opacitymedium">(';
if ($option == 'showall') if ($option == 'showall')
{ {
$result .= $langs->trans("BankAccount").': '; $result .= $langs->trans("BankAccount").': ';
@ -2282,12 +2304,25 @@ class AccountLine extends CommonObject
$accountstatic->label = $this->bank_account_label; $accountstatic->label = $this->bank_account_label;
$result .= $accountstatic->getNomUrl(0).', '; $result .= $accountstatic->getNomUrl(0).', ';
} }
if ($option == 'showall' || $option == 'showconciliated') if ($option == 'showall' || $option == 'showconciliated' || $option == 'showconciliatedandaccounted')
{ {
$result .= $langs->trans("BankLineConciliated").': '; $result .= $langs->trans("BankLineConciliated").': ';
$result .= yn($this->rappro); $result .= yn($this->rappro);
} }
if ($option == 'showall' || $option == 'showconciliated') $result .= ')'; if ($option == 'showall' || $option == 'showconciliatedandaccounted')
{
$sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."accounting_bookkeeping WHERE doc_type = 'bank' AND fk_doc = ".$this->id;
$resql = $this->db->query($sql);
if ($resql) {
$obj = $this->db->fetch_object($resql);
if ($obj && $obj->nb) {
$result .= ' - '.$langs->trans("Accounted").': '.yn(1);
} else {
$result .= ' - '.$langs->trans("Accounted").': '.yn(0);
}
}
}
if ($option == 'showall' || $option == 'showconciliated' || $option == 'showconciliatedandaccounted') $result .= ')</span>';
return $result; return $result;
} }

View File

@ -411,8 +411,9 @@ class BankAccounts extends DolibarrApi
* @throws RestException * @throws RestException
* *
* @url GET {id}/lines * @url GET {id}/lines
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.import_key:<:'20160101')"
*/ */
public function getLines($id) public function getLines($id, $sqlfilters = '')
{ {
$list = array(); $list = array();
@ -428,6 +429,18 @@ class BankAccounts extends DolibarrApi
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."bank "; $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."bank ";
$sql .= " WHERE fk_account = ".$id; $sql .= " WHERE fk_account = ".$id;
// Add sql filters
if ($sqlfilters)
{
if (! DolibarrApi::_checkFilters($sqlfilters))
{
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
}
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
}
$sql .= " ORDER BY rowid"; $sql .= " ORDER BY rowid";
$result = $this->db->query($sql); $result = $this->db->query($sql);

View File

@ -345,7 +345,8 @@ if ($action == "create" || $action == "start")
print '<td>'; print '<td>';
$array = array(); $array = array();
for($i = 1; $i <= max(1, $conf->global->TAKEPOS_NUM_TERMINALS); $i++) { $numterminals = max(1, $conf->global->TAKEPOS_NUM_TERMINALS);
for($i = 1; $i <= $numterminals; $i++) {
$array[$i] = $i; $array[$i] = $i;
} }
$selectedposnumber = 0; $showempty = 1; $selectedposnumber = 0; $showempty = 1;

View File

@ -3889,7 +3889,7 @@ elseif ($id > 0 || !empty($ref))
} }
// Call Hook formConfirm // Call Hook formConfirm
$parameters = array('lineid' => $lineid); $parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid, 'remainingtopay' => &$resteapayer);
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) $formconfirm .= $hookmanager->resPrint; if (empty($reshook)) $formconfirm .= $hookmanager->resPrint;
elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint; elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint;

View File

@ -4005,6 +4005,7 @@ class Facture extends CommonInvoice
if ($generic_facture->hasDelay()) { if ($generic_facture->hasDelay()) {
$response->nbtodolate++; $response->nbtodolate++;
$response->url_late=DOL_URL_ROOT.'/compta/facture/list.php?search_option=late&mainmenu=billing&leftmenu=customers_bills';
} }
} }

View File

@ -387,7 +387,7 @@ if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT';
$sql .= ' f.rowid as id, f.ref, f.ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.fk_cond_reglement, f.total as total_ht, f.tva as total_vat, f.total_ttc,'; $sql .= ' f.rowid as id, f.ref, f.ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.fk_cond_reglement, f.total as total_ht, f.tva as total_vat, f.total_ttc,';
$sql .= ' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,'; $sql .= ' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,';
$sql .= ' f.datef as df, f.date_lim_reglement as datelimite, f.module_source, f.pos_source,'; $sql .= ' f.datef as df, f.date_lim_reglement as datelimite, f.module_source, f.pos_source,';
$sql .= ' f.paye as paye, f.fk_statut,'; $sql .= ' f.paye as paye, f.fk_statut, f.close_code,';
$sql .= ' f.datec as date_creation, f.tms as date_update, f.date_closing as date_closing,'; $sql .= ' f.datec as date_creation, f.tms as date_update, f.date_closing as date_closing,';
$sql .= ' f.retained_warranty, f.retained_warranty_date_limit, f.situation_final, f.situation_cycle_ref, f.situation_counter,'; $sql .= ' f.retained_warranty, f.retained_warranty_date_limit, f.situation_final, f.situation_cycle_ref, f.situation_counter,';
$sql .= ' s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur,'; $sql .= ' s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur,';
@ -502,7 +502,7 @@ if (!$sall)
$sql .= ' GROUP BY f.rowid, f.ref, ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.fk_cond_reglement, f.total, f.tva, f.total_ttc,'; $sql .= ' GROUP BY f.rowid, f.ref, ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.fk_cond_reglement, f.total, f.tva, f.total_ttc,';
$sql .= ' f.localtax1, f.localtax2,'; $sql .= ' f.localtax1, f.localtax2,';
$sql .= ' f.datef, f.date_lim_reglement, f.module_source, f.pos_source,'; $sql .= ' f.datef, f.date_lim_reglement, f.module_source, f.pos_source,';
$sql .= ' f.paye, f.fk_statut,'; $sql .= ' f.paye, f.fk_statut, f.close_code,';
$sql .= ' f.datec, f.tms, f.date_closing,'; $sql .= ' f.datec, f.tms, f.date_closing,';
$sql .= ' f.retained_warranty, f.retained_warranty_date_limit, f.situation_final, f.situation_cycle_ref, f.situation_counter,'; $sql .= ' f.retained_warranty, f.retained_warranty_date_limit, f.situation_final, f.situation_cycle_ref, f.situation_counter,';
$sql .= ' s.rowid, s.nom, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,'; $sql .= ' s.rowid, s.nom, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,';
@ -987,6 +987,7 @@ if ($resql)
$facturestatic->total_tva = $obj->total_vat; $facturestatic->total_tva = $obj->total_vat;
$facturestatic->total_ttc = $obj->total_ttc; $facturestatic->total_ttc = $obj->total_ttc;
$facturestatic->statut = $obj->fk_statut; $facturestatic->statut = $obj->fk_statut;
$facturestatic->close_code = $obj->close_code;
$facturestatic->total_ttc = $obj->total_ttc; $facturestatic->total_ttc = $obj->total_ttc;
$facturestatic->paye = $obj->paye; $facturestatic->paye = $obj->paye;
$facturestatic->fk_soc = $obj->fk_soc; $facturestatic->fk_soc = $obj->fk_soc;
@ -1022,7 +1023,11 @@ if ($resql)
$totaldeposits = $facturestatic->getSumDepositsUsed(); $totaldeposits = $facturestatic->getSumDepositsUsed();
$totalpay = $paiement + $totalcreditnotes + $totaldeposits; $totalpay = $paiement + $totalcreditnotes + $totaldeposits;
$remaintopay = price2num($facturestatic->total_ttc - $totalpay); $remaintopay = price2num($facturestatic->total_ttc - $totalpay);
if ($facturestatic->type == Facture::TYPE_CREDIT_NOTE && $obj->paye == 1) {
if ($facturestatic->statut == Facture::STATUS_CLOSED && $facturestatic->close_code == 'discount_vat') { // If invoice closed with discount for anticipated payment
$remaintopay = 0;
}
if ($facturestatic->type == Facture::TYPE_CREDIT_NOTE && $obj->paye == 1) { // If credit note closed, we take into account the amount not yet consummed
$remaincreditnote = $discount->getAvailableDiscounts($obj->fk_soc, '', 'rc.fk_facture_source='.$facturestatic->id); $remaincreditnote = $discount->getAvailableDiscounts($obj->fk_soc, '', 'rc.fk_facture_source='.$facturestatic->id);
$remaintopay = -$remaincreditnote; $remaintopay = -$remaincreditnote;
$totalpay = price2num($facturestatic->total_ttc - $remaintopay); $totalpay = price2num($facturestatic->total_ttc - $remaintopay);
@ -1281,9 +1286,12 @@ if ($resql)
$totalarray['val']['totalam'] += $totalpay; $totalarray['val']['totalam'] += $totalpay;
} }
// Pending amount
if (!empty($arrayfields['rtp']['checked'])) if (!empty($arrayfields['rtp']['checked']))
{ {
print '<td class="right nowrap">'.(!empty($remaintopay) ?price($remaintopay, 0, $langs) : '&nbsp;').'</td>'; // TODO Use a denormalized field print '<td class="right nowrap">';
print (!empty($remaintopay) ? price($remaintopay, 0, $langs) : '&nbsp;');
print '</td>'; // TODO Use a denormalized field
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'rtp'; if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'rtp';
$totalarray['val']['rtp'] += $remaintopay; $totalarray['val']['rtp'] += $remaintopay;

View File

@ -222,7 +222,7 @@ print '</td></tr>';
// Payment type (VIR, LIQ, ...) // Payment type (VIR, LIQ, ...)
$labeltype = $langs->trans("PaymentType".$object->type_code) != ("PaymentType".$object->type_code) ? $langs->trans("PaymentType".$object->type_code) : $object->type_label; $labeltype = $langs->trans("PaymentType".$object->type_code) != ("PaymentType".$object->type_code) ? $langs->trans("PaymentType".$object->type_code) : $object->type_label;
print '<tr><td>'.$langs->trans('PaymentMode').'</td><td>'.$labeltype; print '<tr><td>'.$langs->trans('PaymentMode').'</td><td>'.$labeltype;
print $object->num_paiement ? ' - '.$object->num_paiement : ''; print $object->num_payment? ' - '.$object->num_payment : '';
print '</td></tr>'; print '</td></tr>';
// Amount // Amount
@ -297,7 +297,7 @@ if (!empty($conf->banque->enabled))
print '<tr>'; print '<tr>';
print '<td>'.$langs->trans('BankTransactionLine').'</td>'; print '<td>'.$langs->trans('BankTransactionLine').'</td>';
print '<td>'; print '<td>';
print $bankline->getNomUrl(1, 0, 'showconciliated'); print $bankline->getNomUrl(1, 0, 'showconciliatedandaccounted');
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }

View File

@ -248,7 +248,7 @@ if ($id > 0 || $ref)
} }
// Call Hook formConfirm // Call Hook formConfirm
/*$parameters = array(); /*$parameters = array('formConfirm' => $formconfirm);
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) $formconfirm.=$hookmanager->resPrint; if (empty($reshook)) $formconfirm.=$hookmanager->resPrint;
elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint;*/ elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint;*/

View File

@ -505,7 +505,7 @@ elseif ($modecompta=="BOOKKEEPING")
$resultNP = $totPerAccount[$cpt['account_number']]['NP']; $resultNP = $totPerAccount[$cpt['account_number']]['NP'];
$resultN = $totPerAccount[$cpt['account_number']]['N']; $resultN = $totPerAccount[$cpt['account_number']]['N'];
if ($showaccountdetail == 'all' || $resultN > 0) { if ($showaccountdetail == 'all' || $resultN != 0) {
print '<tr>'; print '<tr>';
print '<td></td>'; print '<td></td>';
print '<td class="tdoverflowmax200">'; print '<td class="tdoverflowmax200">';

View File

@ -72,8 +72,8 @@ class Contact extends CommonObject
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>30, 'index'=>1), 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>30, 'index'=>1),
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>35), 'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>35),
'civility' =>array('type'=>'varchar(6)', 'label'=>'Civility', 'enabled'=>1, 'visible'=>-1, 'position'=>40), 'civility' =>array('type'=>'varchar(6)', 'label'=>'Civility', 'enabled'=>1, 'visible'=>-1, 'position'=>40),
'lastname' =>array('type'=>'varchar(50)', 'label'=>'Lastname', 'enabled'=>1, 'visible'=>-1, 'position'=>45), 'lastname' =>array('type'=>'varchar(50)', 'label'=>'Lastname', 'enabled'=>1, 'visible'=>-1, 'position'=>45, 'showoncombobox'=>1),
'firstname' =>array('type'=>'varchar(50)', 'label'=>'Firstname', 'enabled'=>1, 'visible'=>-1, 'position'=>50), 'firstname' =>array('type'=>'varchar(50)', 'label'=>'Firstname', 'enabled'=>1, 'visible'=>-1, 'position'=>50, 'showoncombobox'=>1),
'address' =>array('type'=>'varchar(255)', 'label'=>'Address', 'enabled'=>1, 'visible'=>-1, 'position'=>55), 'address' =>array('type'=>'varchar(255)', 'label'=>'Address', 'enabled'=>1, 'visible'=>-1, 'position'=>55),
'zip' =>array('type'=>'varchar(25)', 'label'=>'Zip', 'enabled'=>1, 'visible'=>-1, 'position'=>60), 'zip' =>array('type'=>'varchar(25)', 'label'=>'Zip', 'enabled'=>1, 'visible'=>-1, 'position'=>60),
'town' =>array('type'=>'text', 'label'=>'Town', 'enabled'=>1, 'visible'=>-1, 'position'=>65), 'town' =>array('type'=>'text', 'label'=>'Town', 'enabled'=>1, 'visible'=>-1, 'position'=>65),
@ -988,19 +988,25 @@ class Contact extends CommonObject
} }
/** /**
* Set property ->gender from property ->civility_id * Set the property "gender" of this class, based on the property "civility_id"
* or use property "civility_code" as fallback, when "civility_id" is not available.
* *
* @return void * @return void
*/ */
public function setGenderFromCivility() public function setGenderFromCivility()
{ {
unset($this->gender); unset($this->gender);
if (in_array($this->civility_id, array('MR'))) {
$this->gender = 'man'; if (in_array($this->civility_id, array('MR')) || in_array($this->civility_code, array('MR')))
} elseif (in_array($this->civility_id, array('MME', 'MLE'))) { {
$this->gender = 'woman'; $this->gender = 'man';
} }
elseif(in_array($this->civility_id, array('MME','MLE')) || in_array($this->civility_code, array('MME','MLE')))
{
$this->gender = 'woman';
}
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps

View File

@ -1356,6 +1356,7 @@ else
// Call Hook formConfirm // Call Hook formConfirm
$parameters = array( $parameters = array(
'formConfirm' => $formconfirm,
'id' => $id, 'id' => $id,
//'lineid' => $lineid, //'lineid' => $lineid,
); );

View File

@ -53,8 +53,8 @@ print '<!-- Ajax page called with url '.dol_escape_htmltag($_SERVER["PHP_SELF"])
// If ok // If ok
if ($action == 'firstpingok') if ($action == 'firstpingok')
{ {
// Note: pings are by installation, done on entity 1. // Note: pings are per installed instances / entity.
// Once this constant are set, no more ping will be tried (except if we add parameter &forceping=1 on URL). So we can say this are 'first' ping. // Once this constants are set, no more ping will be tried (except if we add parameter &forceping=1 on URL). So we can say this are 'first' ping.
dolibarr_set_const($db, 'MAIN_FIRST_PING_OK_DATE', dol_print_date($now, 'dayhourlog', 'gmt')); dolibarr_set_const($db, 'MAIN_FIRST_PING_OK_DATE', dol_print_date($now, 'dayhourlog', 'gmt'));
dolibarr_set_const($db, 'MAIN_FIRST_PING_OK_ID', $hash_unique_id); dolibarr_set_const($db, 'MAIN_FIRST_PING_OK_ID', $hash_unique_id);

View File

@ -3,6 +3,7 @@
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr> * Copyright (C) 2015 Frederic France <frederic.france@free.fr>
* Copyright (C) 2016 Juan José Menent <jmenent@2byte.es> * Copyright (C) 2016 Juan José Menent <jmenent@2byte.es>
* Copyright (C) 2020 Pierre Ardoin <mapiolca@me.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -97,7 +98,8 @@ class box_project extends ModeleBoxes
$sql = "SELECT p.rowid, p.ref, p.title, p.fk_statut, p.public"; $sql = "SELECT p.rowid, p.ref, p.title, p.fk_statut, p.public";
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
$sql.= " WHERE p.fk_statut = 1"; // Only open projects $sql.= " WHERE p.entity IN (".getEntity('project').")"; // Only current entity or severals if permission ok
$sql.= " AND p.fk_statut = 1"; // Only open projects
if (! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")"; // public and assigned to, or restricted to company for external users if (! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")"; // public and assigned to, or restricted to company for external users
$sql.= " ORDER BY p.datec DESC"; $sql.= " ORDER BY p.datec DESC";

View File

@ -137,6 +137,13 @@ class CMailFile
{ {
global $conf, $dolibarr_main_data_root; global $conf, $dolibarr_main_data_root;
// Clean values of $mimefilename_list
if (is_array($mimefilename_list)) {
foreach($mimefilename_list as $key => $val) {
$mimefilename_list[$key] = dol_string_unaccent($mimefilename_list[$key]);
}
}
$this->subject = $subject; $this->subject = $subject;
$this->addr_to = $to; $this->addr_to = $to;
$this->addr_from = $from; $this->addr_from = $from;
@ -508,7 +515,7 @@ class CMailFile
$res = false; $res = false;
if (empty($conf->global->MAIN_DISABLE_ALL_MAILS) || !empty($conf->global->MAIN_MAIL_FORCE_SENDTO)) if (empty($conf->global->MAIN_DISABLE_ALL_MAILS))
{ {
require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager = new HookManager($db); $hookmanager = new HookManager($db);

View File

@ -103,7 +103,12 @@ abstract class CommonInvoice extends CommonObject
$alreadypaid+=$this->getSommePaiement($multicurrency); $alreadypaid+=$this->getSommePaiement($multicurrency);
$alreadypaid+=$this->getSumDepositsUsed($multicurrency); $alreadypaid+=$this->getSumDepositsUsed($multicurrency);
$alreadypaid+=$this->getSumCreditNotesUsed($multicurrency); $alreadypaid+=$this->getSumCreditNotesUsed($multicurrency);
return $this->total_ttc - $alreadypaid;
$remaintopay = ($this->total_ttc - $alreadypaid);
if ($this->statut == self::STATUS_CLOSED && $this->close_code == 'discount_vat') { // If invoice closed with discount for anticipated payment
$remaintopay = 0;
}
return $remaintopay;
} }
/** /**

View File

@ -2744,10 +2744,13 @@ abstract class CommonObject
public function line_max($fk_parent_line = 0) public function line_max($fk_parent_line = 0)
{ {
// phpcs:enable // phpcs:enable
$positionfield = 'rang';
if ($this->table_element == 'bom') $positionfield = 'position';
// Search the last rang with fk_parent_line // Search the last rang with fk_parent_line
if ($fk_parent_line) if ($fk_parent_line)
{ {
$sql = 'SELECT max(rang) FROM '.MAIN_DB_PREFIX.$this->table_element_line; $sql = 'SELECT max('.$positionfield.') FROM '.MAIN_DB_PREFIX.$this->table_element_line;
$sql .= ' WHERE '.$this->fk_element.' = '.$this->id; $sql .= ' WHERE '.$this->fk_element.' = '.$this->id;
$sql .= ' AND fk_parent_line = '.$fk_parent_line; $sql .= ' AND fk_parent_line = '.$fk_parent_line;
@ -2769,7 +2772,7 @@ abstract class CommonObject
// If not, search the last rang of element // If not, search the last rang of element
else else
{ {
$sql = 'SELECT max(rang) FROM '.MAIN_DB_PREFIX.$this->table_element_line; $sql = 'SELECT max('.$positionfield.') FROM '.MAIN_DB_PREFIX.$this->table_element_line;
$sql .= ' WHERE '.$this->fk_element.' = '.$this->id; $sql .= ' WHERE '.$this->fk_element.' = '.$this->id;
dol_syslog(get_class($this)."::line_max", LOG_DEBUG); dol_syslog(get_class($this)."::line_max", LOG_DEBUG);

View File

@ -514,7 +514,7 @@ class dolReceiptPrinter extends Printer
{ {
global $conf; global $conf;
$error = 0; $error = 0;
$img = EscposImage::load(DOL_DOCUMENT_ROOT .'/theme/common/dolibarr_logo_bw.png'); $img = EscposImage::load(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo_bw.png');
//$this->profile = CapabilityProfile::load("TM-T88IV"); //$this->profile = CapabilityProfile::load("TM-T88IV");
$ret = $this->initPrinter($printerid); $ret = $this->initPrinter($printerid);
if ($ret>0) { if ($ret>0) {

View File

@ -1324,6 +1324,7 @@ class ExtraFields
print 'Error in request '.$sql.' '.$this->db->lasterror().'. Check setup of extra parameters.<br>'; print 'Error in request '.$sql.' '.$this->db->lasterror().'. Check setup of extra parameters.<br>';
} }
} else { } else {
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
$data = $form->select_all_categories(Categorie::$MAP_ID_TO_CODE[$InfoFieldList[5]], '', 'parent', 64, $InfoFieldList[6], 1, 1); $data = $form->select_all_categories(Categorie::$MAP_ID_TO_CODE[$InfoFieldList[5]], '', 'parent', 64, $InfoFieldList[6], 1, 1);
$out .= '<option value="0">&nbsp;</option>'; $out .= '<option value="0">&nbsp;</option>';
foreach ($data as $data_key => $data_value) { foreach ($data as $data_key => $data_value) {
@ -1550,6 +1551,7 @@ class ExtraFields
print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>'; print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>';
} }
} else { } else {
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
$data = $form->select_all_categories(Categorie::$MAP_ID_TO_CODE[$InfoFieldList[5]], '', 'parent', 64, $InfoFieldList[6], 1, 1); $data = $form->select_all_categories(Categorie::$MAP_ID_TO_CODE[$InfoFieldList[5]], '', 'parent', 64, $InfoFieldList[6], 1, 1);
$out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, '', 0, '', 0, '100%'); $out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, '', 0, '', 0, '100%');
} }

View File

@ -96,12 +96,9 @@ class FormAdmin
if ($showcode == 1) $valuetoshow=$key.' - '.$value; if ($showcode == 1) $valuetoshow=$key.' - '.$value;
if ($showcode == 2) $valuetoshow=$value.' ('.$key.')'; if ($showcode == 2) $valuetoshow=$value.' ('.$key.')';
if ($filter && is_array($filter)) if ($filter && is_array($filter) && array_key_exists($key, $filter))
{ {
if ( ! array_key_exists($key, $filter)) continue;
{
$out.= '<option value="'.$key.'">'.$valuetoshow.'</option>';
}
} }
elseif ($selected == $key) elseif ($selected == $key)
{ {

View File

@ -29,7 +29,7 @@ require_once DOL_DOCUMENT_ROOT .'/core/db/Database.interface.php';
*/ */
abstract class DoliDB implements Database abstract class DoliDB implements Database
{ {
/** @var bool|resource Database handler */ /** @var bool|resource|SQLite3 Database handler */
public $db; public $db;
/** @var string Database type */ /** @var string Database type */
public $type; public $type;

View File

@ -545,7 +545,9 @@ function calendars_prepare_head($param)
$h++; $h++;
} }
$head[$h][0] = DOL_URL_ROOT.'/comm/action/peruser.php'.($param?'?'.$param:''); $newparam = $param;
$newparam = preg_replace('/&?search_filtert=\d+/', '', $newparam);
$head[$h][0] = DOL_URL_ROOT.'/comm/action/peruser.php'.($newparam?'?'.$newparam:'');
$head[$h][1] = $langs->trans("ViewPerUser"); $head[$h][1] = $langs->trans("ViewPerUser");
$head[$h][2] = 'cardperuser'; $head[$h][2] = 'cardperuser';
$h++; $h++;

View File

@ -207,7 +207,13 @@ function societe_prepare_head(Societe $object)
$sql = "SELECT COUNT(n.rowid) as nb"; $sql = "SELECT COUNT(n.rowid) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."societe_rib as n"; $sql .= " FROM ".MAIN_DB_PREFIX."societe_rib as n";
$sql .= " WHERE fk_soc = ".$object->id; $sql .= " WHERE n.fk_soc = ".$object->id;
if (empty($conf->stripe->enabled)) {
$sql .= " AND n.stripe_card_ref IS NULL";
} else {
$sql .= " AND (n.stripe_card_ref IS NULL OR (n.stripe_card_ref IS NOT NULL AND n.status = ".$servicestatus."))";
}
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
{ {

View File

@ -224,7 +224,54 @@ function dol_shutdown()
*/ */
function GETPOSTISSET($paramname) function GETPOSTISSET($paramname)
{ {
return (isset($_POST[$paramname]) || isset($_GET[$paramname])); $isset = 0;
$relativepathstring = $_SERVER["PHP_SELF"];
// Clean $relativepathstring
if (constant('DOL_URL_ROOT')) $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_URL_ROOT'), '/').'/', '', $relativepathstring);
$relativepathstring = preg_replace('/^\//', '', $relativepathstring);
$relativepathstring = preg_replace('/^custom\//', '', $relativepathstring);
//var_dump($relativepathstring);
//var_dump($user->default_values);
// Code for search criteria persistence.
// Retrieve values if restore_lastsearch_values
if (!empty($_GET['restore_lastsearch_values'])) // Use $_GET here and not GETPOST
{
if (!empty($_SESSION['lastsearch_values_'.$relativepathstring])) // If there is saved values
{
$tmp = json_decode($_SESSION['lastsearch_values_'.$relativepathstring], true);
if (is_array($tmp))
{
foreach ($tmp as $key => $val)
{
if ($key == $paramname) // We are on the requested parameter
{
$isset = 1;
break;
}
}
}
}
// If there is saved contextpage, page or limit
if ($paramname == 'contextpage' && !empty($_SESSION['lastsearch_contextpage_'.$relativepathstring]))
{
$isset = 1;
}
elseif ($paramname == 'page' && !empty($_SESSION['lastsearch_page_'.$relativepathstring]))
{
$isset = 1;
}
elseif ($paramname == 'limit' && !empty($_SESSION['lastsearch_limit_'.$relativepathstring]))
{
$isset = 1;
}
}
else {
$isset = (isset($_POST[$paramname]) || isset($_GET[$paramname]));
}
return $isset;
} }
/** /**
@ -1058,10 +1105,13 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename =
'ip' => false 'ip' => false
); );
// This is when server run behind a reverse proxy $remoteip = getUserRemoteIP(); // Get ip when page run on a web server
if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) $data['ip'] = $_SERVER['HTTP_X_FORWARDED_FOR'].(empty($_SERVER["REMOTE_ADDR"]) ? '' : '->'.$_SERVER['REMOTE_ADDR']); if (! empty($remoteip)) {
// This is when server run normally on a server $data['ip'] = $remoteip;
elseif (!empty($_SERVER["REMOTE_ADDR"])) $data['ip'] = $_SERVER['REMOTE_ADDR']; // This is when server run behind a reverse proxy
if (!empty($_SERVER['HTTP_X_FORWARDED_FOR']) && $_SERVER['HTTP_X_FORWARDED_FOR'] != $remoteip) $data['ip'] = $_SERVER['HTTP_X_FORWARDED_FOR'].' -> '.$data['ip'];
elseif (!empty($_SERVER['HTTP_CLIENT_IP']) && $_SERVER['HTTP_CLIENT_IP'] != $remoteip) $data['ip'] = $_SERVER['HTTP_CLIENT_IP'].' -> '.$data['ip'];
}
// This is when PHP session is ran inside a web server but not inside a client request (example: init code of apache) // This is when PHP session is ran inside a web server but not inside a client request (example: init code of apache)
elseif (!empty($_SERVER['SERVER_ADDR'])) $data['ip'] = $_SERVER['SERVER_ADDR']; elseif (!empty($_SERVER['SERVER_ADDR'])) $data['ip'] = $_SERVER['SERVER_ADDR'];
// This is when PHP session is ran outside a web server, like from Windows command line (Not always defined, but useful if OS defined it). // This is when PHP session is ran outside a web server, like from Windows command line (Not always defined, but useful if OS defined it).
@ -5294,10 +5344,10 @@ function get_default_localtax($thirdparty_seller, $thirdparty_buyer, $local, $id
/** /**
* Return yes or no in current language * Return yes or no in current language
* *
* @param string $yesno Value to test (1, 'yes', 'true' or 0, 'no', 'false') * @param string|int $yesno Value to test (1, 'yes', 'true' or 0, 'no', 'false')
* @param integer $case 1=Yes/No, 0=yes/no, 2=Disabled checkbox, 3=Disabled checkbox + Yes/No * @param integer $case 1=Yes/No, 0=yes/no, 2=Disabled checkbox, 3=Disabled checkbox + Yes/No
* @param int $color 0=texte only, 1=Text is formated with a color font style ('ok' or 'error'), 2=Text is formated with 'ok' color. * @param int $color 0=texte only, 1=Text is formated with a color font style ('ok' or 'error'), 2=Text is formated with 'ok' color.
* @return string HTML string * @return string HTML string
*/ */
function yn($yesno, $case = 1, $color = 0) function yn($yesno, $case = 1, $color = 0)
{ {
@ -5946,7 +5996,8 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
'__MYCOMPANY_TOWN__' => $mysoc->town, '__MYCOMPANY_TOWN__' => $mysoc->town,
'__MYCOMPANY_COUNTRY__' => $mysoc->country, '__MYCOMPANY_COUNTRY__' => $mysoc->country,
'__MYCOMPANY_COUNTRY_ID__' => $mysoc->country_id, '__MYCOMPANY_COUNTRY_ID__' => $mysoc->country_id,
'__MYCOMPANY_CURRENCY_CODE__' => $conf->currency '__MYCOMPANY_COUNTRY_CODE__' => $mysoc->country_code,
'__MYCOMPANY_CURRENCY_CODE__' => $conf->currency
)); ));
} }
@ -7417,7 +7468,7 @@ function printCommonFooter($zone = 'private')
if (constant('DOL_URL_ROOT')) $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_URL_ROOT'), '/').'/', '', $relativepathstring); if (constant('DOL_URL_ROOT')) $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_URL_ROOT'), '/').'/', '', $relativepathstring);
$relativepathstring = preg_replace('/^\//', '', $relativepathstring); $relativepathstring = preg_replace('/^\//', '', $relativepathstring);
$relativepathstring = preg_replace('/^custom\//', '', $relativepathstring); $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring);
$tmpqueryarraywehave = explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING'])); //$tmpqueryarraywehave = explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING']));
if (!empty($user->default_values[$relativepathstring]['focus'])) if (!empty($user->default_values[$relativepathstring]['focus']))
{ {
foreach ($user->default_values[$relativepathstring]['focus'] as $defkey => $defval) foreach ($user->default_values[$relativepathstring]['focus'] as $defkey => $defval)
@ -7429,7 +7480,9 @@ function printCommonFooter($zone = 'private')
$foundintru = 0; $foundintru = 0;
foreach ($tmpqueryarraytohave as $tmpquerytohave) foreach ($tmpqueryarraytohave as $tmpquerytohave)
{ {
if (!in_array($tmpquerytohave, $tmpqueryarraywehave)) $foundintru = 1; $tmpquerytohaveparam = explode('=', $tmpquerytohave);
//print "console.log('".$tmpquerytohaveparam[0]." ".$tmpquerytohaveparam[1]." ".GETPOST($tmpquerytohaveparam[0])."');";
if (!GETPOSTISSET($tmpquerytohaveparam[0]) || ($tmpquerytohaveparam[1] != GETPOST($tmpquerytohaveparam[0]))) $foundintru = 1;
} }
if (!$foundintru) $qualified = 1; if (!$foundintru) $qualified = 1;
//var_dump($defkey.'-'.$qualified); //var_dump($defkey.'-'.$qualified);
@ -7459,7 +7512,9 @@ function printCommonFooter($zone = 'private')
$foundintru = 0; $foundintru = 0;
foreach ($tmpqueryarraytohave as $tmpquerytohave) foreach ($tmpqueryarraytohave as $tmpquerytohave)
{ {
if (!in_array($tmpquerytohave, $tmpqueryarraywehave)) $foundintru = 1; $tmpquerytohaveparam = explode('=', $tmpquerytohave);
//print "console.log('".$tmpquerytohaveparam[0]." ".$tmpquerytohaveparam[1]." ".GETPOST($tmpquerytohaveparam[0])."');";
if (!GETPOSTISSET($tmpquerytohaveparam[0]) || ($tmpquerytohaveparam[1] != GETPOST($tmpquerytohaveparam[0]))) $foundintru = 1;
} }
if (!$foundintru) $qualified = 1; if (!$foundintru) $qualified = 1;
//var_dump($defkey.'-'.$qualified); //var_dump($defkey.'-'.$qualified);

View File

@ -2154,7 +2154,7 @@ function pdf_getLinkedObjects($object, $outputlangs)
$linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date_contrat, 'day', '', $outputlangs); $linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date_contrat, 'day', '', $outputlangs);
} }
} }
else if ($objecttype == 'fichinter') elseif ($objecttype == 'fichinter')
{ {
$outputlangs->load('interventions'); $outputlangs->load('interventions');
foreach($objects as $elementobject) foreach($objects as $elementobject)

View File

@ -104,7 +104,7 @@ function checkLoginPassEntity($usertotest, $passwordtotest, $entitytotest, $auth
} }
else else
{ {
dol_syslog("Authentification ko - failed to load file '".$authfile."'", LOG_ERR); dol_syslog("Authentication KO - failed to load file '".$authfile."'", LOG_ERR);
sleep(1); sleep(1);
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array('other', 'main', 'errors')); $langs->loadLangs(array('other', 'main', 'errors'));
@ -221,7 +221,7 @@ if (! function_exists('dol_loginfunction'))
// Show logo (search in order: small company logo, large company logo, theme logo, common logo) // Show logo (search in order: small company logo, large company logo, theme logo, common logo)
$width=0; $width=0;
$urllogo=DOL_URL_ROOT.'/theme/login_logo.png'; $urllogo=DOL_URL_ROOT.'/theme/common/login_logo.png';
if (! empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) if (! empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small))
{ {

View File

@ -119,7 +119,7 @@ function shipping_prepare_head($object)
*/ */
function delivery_prepare_head($object) function delivery_prepare_head($object)
{ {
global $langs, $conf, $user; global $langs, $db, $conf, $user;
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("sendings","deliveries")); $langs->loadLangs(array("sendings","deliveries"));
@ -140,29 +140,56 @@ function delivery_prepare_head($object)
$head[$h][2] = 'delivery'; $head[$h][2] = 'delivery';
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT."/expedition/contact.php?id=".$object->origin_id; // Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
// complete_head_from_modules use $object->id for this link so we temporary change it
$savObjectId = $object->id;
// Get parent object
$tmpobject = null;
if ($object->origin) {
$tmpobject = new Expedition($db);
$tmpobject->fetch($object->origin_id);
} else {
$tmpobject = $object;
}
$head[$h][0] = DOL_URL_ROOT."/expedition/contact.php?id=".$tmpobject->id;
$head[$h][1] = $langs->trans("ContactsAddresses"); $head[$h][1] = $langs->trans("ContactsAddresses");
$head[$h][2] = 'contact'; $head[$h][2] = 'contact';
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT."/expedition/note.php?id=".$object->origin_id;
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
$upload_dir = $conf->commande->dir_output . "/" . dol_sanitizeFileName($tmpobject->ref);
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
$nbLinks=Link::count($db, $tmpobject->element, $tmpobject->id);
$head[$h][0] = DOL_URL_ROOT.'/expedition/document.php?id='.$tmpobject->id;
$head[$h][1] = $langs->trans('Documents');
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.($nbFiles+$nbLinks).'</span>';
$head[$h][2] = 'documents';
$h++;
$nbNote = 0;
if (!empty($tmpobject->note_private)) $nbNote++;
if (!empty($tmpobject->note_public)) $nbNote++;
$head[$h][0] = DOL_URL_ROOT."/expedition/note.php?id=".$tmpobject->id;
$head[$h][1] = $langs->trans("Notes"); $head[$h][1] = $langs->trans("Notes");
if ($nbNote > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
$head[$h][2] = 'note'; $head[$h][2] = 'note';
$h++; $h++;
// Show more tabs from modules $object->id = $tmpobject->id;
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
// complete_head_from_modules use $object->id for this link so we temporary change it
$tmpObjectId = $object->id;
$object->id = $object->origin_id;
complete_head_from_modules($conf, $langs, $object, $head, $h, 'delivery'); complete_head_from_modules($conf, $langs, $object, $head, $h, 'delivery');
complete_head_from_modules($conf, $langs, $object, $head, $h, 'delivery', 'remove'); complete_head_from_modules($conf, $langs, $object, $head, $h, 'delivery', 'remove');
$object->id = $tmpObjectId; $object->id = $savObjectId;
return $head; return $head;
} }

View File

@ -222,7 +222,7 @@ function llxHeaderTicket($title, $head = "", $disablejs = 0, $disablehead = 0, $
// Print logo // Print logo
if (! empty($conf->global->TICKET_SHOW_COMPANY_LOGO)) if (! empty($conf->global->TICKET_SHOW_COMPANY_LOGO))
{ {
$urllogo = DOL_URL_ROOT . '/theme/login_logo.png'; $urllogo = DOL_URL_ROOT . '/theme/common/login_logo.png';
if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output . '/logos/thumbs/' . $mysoc->logo_small)) { if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output . '/logos/thumbs/' . $mysoc->logo_small)) {
$urllogo = DOL_URL_ROOT . '/viewimage.php?modulepart=mycompany&amp;entity='.$conf->entity.'&amp;file=' . urlencode('logos/thumbs/'.$mysoc->logo_small); $urllogo = DOL_URL_ROOT . '/viewimage.php?modulepart=mycompany&amp;entity='.$conf->entity.'&amp;file=' . urlencode('logos/thumbs/'.$mysoc->logo_small);

View File

@ -110,7 +110,7 @@ function check_user_password_dolibarr($usertotest, $passwordtotest, $entitytotes
else else
{ {
sleep(2); // Anti brut force protection sleep(2); // Anti brut force protection
dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentification ko bad password for '".$usertotest."', cryptType=".$cryptType); dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentication KO bad password for '".$usertotest."', cryptType=".$cryptType, LOG_NOTICE);
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array('main', 'errors')); $langs->loadLangs(array('main', 'errors'));
@ -129,7 +129,7 @@ function check_user_password_dolibarr($usertotest, $passwordtotest, $entitytotes
$ret = $mc->checkRight($obj->rowid, $entitytotest); $ret = $mc->checkRight($obj->rowid, $entitytotest);
if ($ret < 0) if ($ret < 0)
{ {
dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentification ko entity '" . $entitytotest . "' not allowed for user '" . $obj->rowid . "'"); dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentication KO entity '" . $entitytotest . "' not allowed for user '" . $obj->rowid . "'", LOG_NOTICE);
$login = ''; // force authentication failure $login = ''; // force authentication failure
} }
} }
@ -137,7 +137,7 @@ function check_user_password_dolibarr($usertotest, $passwordtotest, $entitytotes
} }
else else
{ {
dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentification ko user not found for '".$usertotest."'"); dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentication KO user not found for '".$usertotest."'", LOG_NOTICE);
sleep(1); sleep(1);
// Load translation files required by the page // Load translation files required by the page
@ -148,7 +148,7 @@ function check_user_password_dolibarr($usertotest, $passwordtotest, $entitytotes
} }
else else
{ {
dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentification ko db error for '".$usertotest."' error=".$db->lasterror()); dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentication KO db error for '".$usertotest."' error=".$db->lasterror(), LOG_ERR);
sleep(1); sleep(1);
$_SESSION["dol_loginmesg"]=$db->lasterror(); $_SESSION["dol_loginmesg"]=$db->lasterror();
} }

View File

@ -52,7 +52,7 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest)
if (! function_exists("ldap_connect")) if (! function_exists("ldap_connect"))
{ {
dol_syslog("functions_ldap::check_user_password_ldap Authentification ko failed to connect to LDAP. LDAP functions are disabled on this PHP"); dol_syslog("functions_ldap::check_user_password_ldap Authentication KO failed to connect to LDAP. LDAP functions are disabled on this PHP", LOG_ERR);
sleep(1); sleep(1);
// Load translation files required by the page // Load translation files required by the page
@ -202,7 +202,7 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest)
$ret=$mc->checkRight($usertmp->id, $entitytotest); $ret=$mc->checkRight($usertmp->id, $entitytotest);
if ($ret < 0) if ($ret < 0)
{ {
dol_syslog("functions_ldap::check_user_password_ldap Authentification ko entity '".$entitytotest."' not allowed for user '".$usertmp->id."'"); dol_syslog("functions_ldap::check_user_password_ldap Authentication KO entity '".$entitytotest."' not allowed for user '".$usertmp->id."'", LOG_NOTICE);
$login=''; // force authentication failure $login=''; // force authentication failure
} }
unset($usertmp); unset($usertmp);
@ -210,7 +210,7 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest)
} }
if ($result == 1) if ($result == 1)
{ {
dol_syslog("functions_ldap::check_user_password_ldap Authentification ko bad user/password for '".$usertotest."'"); dol_syslog("functions_ldap::check_user_password_ldap Authentication KO bad user/password for '".$usertotest."'", LOG_NOTICE);
sleep(1); sleep(1);
// Load translation files required by the page // Load translation files required by the page
@ -229,7 +229,7 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest)
** 49 - Wrong password ** 49 - Wrong password
** 53 - Account inactive (manually locked out by administrator) ** 53 - Account inactive (manually locked out by administrator)
*/ */
dol_syslog("functions_ldap::check_user_password_ldap Authentification ko failed to connect to LDAP for '".$usertotest."'"); dol_syslog("functions_ldap::check_user_password_ldap Authentication KO failed to connect to LDAP for '".$usertotest."'", LOG_NOTICE);
if (is_resource($ldap->connection)) // If connection ok but bind ko if (is_resource($ldap->connection)) // If connection ok but bind ko
{ {
$ldap->ldapErrorCode = ldap_errno($ldap->connection); $ldap->ldapErrorCode = ldap_errno($ldap->connection);

View File

@ -239,11 +239,20 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
!empty($user->rights->contrat->lire) || !empty($user->rights->contrat->lire) ||
!empty($user->rights->ficheinter->lire) !empty($user->rights->ficheinter->lire)
), ),
'module'=>'propal|commande|supplier_order|contrat|ficheinter' 'module'=>'propal|commande|supplier_order|supplier_proposal|contrat|ficheinter'
); );
$onlysupplierorder = ! empty($user->rights->fournisseur->commande->lire) &&
empty($user->rights->propal->lire) &&
empty($user->rights->commande->lire) &&
empty($user->rights->supplier_order->lire) &&
empty($user->rights->supplier_proposal->lire) &&
empty($user->rights->contrat->lire) &&
empty($user->rights->ficheinter->lire);
$menu_arr[] = array( $menu_arr[] = array(
'name' => 'Commercial', 'name' => 'Commercial',
'link' => '/comm/index.php?mainmenu=commercial&amp;leftmenu=', 'link' => ($onlysupplierorder ? '/fourn/commande/index.php?mainmenu=commercial&amp;leftmenu=' : '/comm/index.php?mainmenu=commercial&amp;leftmenu='),
'title' => "Commercial", 'title' => "Commercial",
'level' => 0, 'level' => 0,
'enabled' => $showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal), 'enabled' => $showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal),

View File

@ -440,7 +440,12 @@ class pdf_einstein extends ModelePDFCommandes
else else
{ {
// We found a page break // We found a page break
$showpricebeforepagebreak=0;
// Allows data in the first page if description is long enough to break in multiples pages
if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
$showpricebeforepagebreak = 1;
else
$showpricebeforepagebreak = 0;
} }
} }
else // No pagebreak else // No pagebreak

View File

@ -572,7 +572,12 @@ class pdf_eratosthene extends ModelePDFCommandes
$pdf->setPage($pageposbefore+1); $pdf->setPage($pageposbefore+1);
$curY = $tab_top_newpage; $curY = $tab_top_newpage;
$showpricebeforepagebreak=0;
// Allows data in the first page if description is long enough to break in multiples pages
if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
$showpricebeforepagebreak = 1;
else
$showpricebeforepagebreak = 0;
} }
if (!empty($this->cols['photo']) && isset($imglinesize['width']) && isset($imglinesize['height'])) if (!empty($this->cols['photo']) && isset($imglinesize['width']) && isset($imglinesize['height']))
@ -610,7 +615,12 @@ class pdf_eratosthene extends ModelePDFCommandes
else else
{ {
// We found a page break // We found a page break
$showpricebeforepagebreak=0;
// Allows data in the first page if description is long enough to break in multiples pages
if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
$showpricebeforepagebreak = 1;
else
$showpricebeforepagebreak = 0;
} }
} }
else // No pagebreak else // No pagebreak

View File

@ -391,7 +391,12 @@ class pdf_strato extends ModelePDFContract
else else
{ {
// We found a page break // We found a page break
$showpricebeforepagebreak=0;
// Allows data in the first page if description is long enough to break in multiples pages
if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
$showpricebeforepagebreak = 1;
else
$showpricebeforepagebreak = 0;
} }
} }
else // No pagebreak else // No pagebreak

View File

@ -433,7 +433,12 @@ class pdf_espadon extends ModelePdfExpedition
$pdf->setPage($pageposbefore+1); $pdf->setPage($pageposbefore+1);
$curY = $tab_top_newpage; $curY = $tab_top_newpage;
$showpricebeforepagebreak=0;
// Allows data in the first page if description is long enough to break in multiples pages
if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
$showpricebeforepagebreak = 1;
else
$showpricebeforepagebreak = 0;
} }
@ -475,7 +480,12 @@ class pdf_espadon extends ModelePdfExpedition
else else
{ {
// We found a page break // We found a page break
$showpricebeforepagebreak=0;
// Allows data in the first page if description is long enough to break in multiples pages
if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
$showpricebeforepagebreak = 1;
else
$showpricebeforepagebreak = 0;
} }
} }
else // No pagebreak else // No pagebreak

View File

@ -452,7 +452,12 @@ class pdf_rouget extends ModelePdfExpedition
$pdf->setPage($pageposbefore + 1); $pdf->setPage($pageposbefore + 1);
$curY = $tab_top_newpage; $curY = $tab_top_newpage;
$showpricebeforepagebreak = 0;
// Allows data in the first page if description is long enough to break in multiples pages
if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
$showpricebeforepagebreak = 1;
else
$showpricebeforepagebreak = 0;
} }
if (isset($imglinesize['width']) && isset($imglinesize['height'])) if (isset($imglinesize['width']) && isset($imglinesize['height']))
@ -494,7 +499,12 @@ class pdf_rouget extends ModelePdfExpedition
else else
{ {
// We found a page break // We found a page break
$showpricebeforepagebreak = 0;
// Allows data in the first page if description is long enough to break in multiples pages
if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
$showpricebeforepagebreak = 1;
else
$showpricebeforepagebreak = 0;
} }
} }
else // No pagebreak else // No pagebreak

View File

@ -385,7 +385,12 @@ class pdf_standard extends ModeleExpenseReport
else else
{ {
// We found a page break // We found a page break
$showpricebeforepagebreak=0;
// Allows data in the first page if description is long enough to break in multiples pages
if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
$showpricebeforepagebreak = 1;
else
$showpricebeforepagebreak = 0;
} }
} }
else // No pagebreak else // No pagebreak

View File

@ -494,7 +494,12 @@ class pdf_crabe extends ModelePDFFactures
$pdf->setPage($pageposbefore + 1); $pdf->setPage($pageposbefore + 1);
$curY = $tab_top_newpage; $curY = $tab_top_newpage;
$showpricebeforepagebreak = 0;
// Allows data in the first page if description is long enough to break in multiples pages
if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
$showpricebeforepagebreak = 1;
else
$showpricebeforepagebreak = 0;
} }
if (isset($imglinesize['width']) && isset($imglinesize['height'])) if (isset($imglinesize['width']) && isset($imglinesize['height']))
@ -534,7 +539,12 @@ class pdf_crabe extends ModelePDFFactures
else else
{ {
// We found a page break // We found a page break
$showpricebeforepagebreak = 0;
// Allows data in the first page if description is long enough to break in multiples pages
if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
$showpricebeforepagebreak = 1;
else
$showpricebeforepagebreak = 0;
} }
} }
else // No pagebreak else // No pagebreak
@ -903,6 +913,8 @@ class pdf_crabe extends ModelePDFFactures
$i++; $i++;
} }
return $tab3_top + $y + 3;
} }
else else
{ {

View File

@ -600,7 +600,12 @@ class pdf_sponge extends ModelePDFFactures
$pdf->setPage($pageposbefore+1); $pdf->setPage($pageposbefore+1);
$curY = $tab_top_newpage; $curY = $tab_top_newpage;
$showpricebeforepagebreak=0;
// Allows data in the first page if description is long enough to break in multiples pages
if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
$showpricebeforepagebreak = 1;
else
$showpricebeforepagebreak = 0;
} }
if (!empty($this->cols['photo']) && isset($imglinesize['width']) && isset($imglinesize['height'])) if (!empty($this->cols['photo']) && isset($imglinesize['width']) && isset($imglinesize['height']))
@ -639,7 +644,12 @@ class pdf_sponge extends ModelePDFFactures
else else
{ {
// We found a page break // We found a page break
$showpricebeforepagebreak=0;
// Allows data in the first page if description is long enough to break in multiples pages
if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
$showpricebeforepagebreak = 1;
else
$showpricebeforepagebreak = 0;
} }
} }
else // No pagebreak else // No pagebreak
@ -1021,6 +1031,8 @@ class pdf_sponge extends ModelePDFFactures
$i++; $i++;
} }
return $tab3_top + $y + 3;
} }
else else
{ {

View File

@ -409,7 +409,12 @@ class pdf_typhon extends ModelePDFDeliveryOrder
else else
{ {
// We found a page break // We found a page break
$showpricebeforepagebreak=0;
// Allows data in the first page if description is long enough to break in multiples pages
if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
$showpricebeforepagebreak = 1;
else
$showpricebeforepagebreak = 0;
} }
} }
else // No pagebreak else // No pagebreak

View File

@ -216,7 +216,8 @@ class modFacture extends DolibarrModules
's.code_compta_fournisseur'=>'SupplierAccountancyCode', 's.tva_intra'=>'VATIntra', 's.code_compta_fournisseur'=>'SupplierAccountancyCode', 's.tva_intra'=>'VATIntra',
'f.rowid'=>"InvoiceId", 'f.ref'=>"InvoiceRef", 'f.ref_client'=>'RefCustomer', 'f.rowid'=>"InvoiceId", 'f.ref'=>"InvoiceRef", 'f.ref_client'=>'RefCustomer',
'f.type'=>"Type", 'f.datec'=>"InvoiceDateCreation", 'f.datef'=>"DateInvoice", 'f.date_lim_reglement'=>"DateDue", 'f.total'=>"TotalHT", 'f.type'=>"Type", 'f.datec'=>"InvoiceDateCreation", 'f.datef'=>"DateInvoice", 'f.date_lim_reglement'=>"DateDue", 'f.total'=>"TotalHT",
'f.total_ttc'=>"TotalTTC", 'f.tva'=>"TotalVAT", 'f.localtax1'=>'LocalTax1', 'f.localtax2'=>'LocalTax2', 'none.rest'=>'Rest', 'f.paye'=>"InvoicePaidCompletely", 'f.fk_statut'=>'InvoiceStatus', 'f.total_ttc'=>"TotalTTC", 'f.tva'=>"TotalVAT", 'f.localtax1'=>'LocalTax1', 'f.localtax2'=>'LocalTax2', 'f.paye'=>"InvoicePaidCompletely", 'f.fk_statut'=>'InvoiceStatus', 'f.close_code'=>'EarlyClosingReason', 'f.close_note'=>'EarlyClosingComment',
'none.rest'=>'Rest',
'f.note_private'=>"NotePrivate", 'f.note_public'=>"NotePublic", 'f.fk_user_author'=>'CreatedById', 'uc.login'=>'CreatedByLogin', 'f.note_private'=>"NotePrivate", 'f.note_public'=>"NotePublic", 'f.fk_user_author'=>'CreatedById', 'uc.login'=>'CreatedByLogin',
'f.fk_user_valid'=>'ValidatedById', 'uv.login'=>'ValidatedByLogin', 'pj.ref'=>'ProjectRef', 'pj.title'=>'ProjectLabel', 'fd.rowid'=>'LineId', 'fd.description'=>"LineDescription", 'f.fk_user_valid'=>'ValidatedById', 'uv.login'=>'ValidatedByLogin', 'pj.ref'=>'ProjectRef', 'pj.title'=>'ProjectLabel', 'fd.rowid'=>'LineId', 'fd.description'=>"LineDescription",
'fd.subprice'=>"LineUnitPrice", 'fd.tva_tx'=>"LineVATRate", 'fd.qty'=>"LineQty", 'fd.total_ht'=>"LineTotalHT", 'fd.total_tva'=>"LineTotalVAT", 'fd.subprice'=>"LineUnitPrice", 'fd.tva_tx'=>"LineVATRate", 'fd.qty'=>"LineQty", 'fd.total_ht'=>"LineTotalHT", 'fd.total_tva'=>"LineTotalVAT",
@ -241,7 +242,8 @@ class modFacture extends DolibarrModules
's.rowid'=>'Numeric', 's.nom'=>'Text', 's.code_client'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', 'c.code'=>'Text', 'cd.nom'=>'Text', 's.phone'=>'Text', 's.siren'=>'Text', 's.rowid'=>'Numeric', 's.nom'=>'Text', 's.code_client'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', 'c.code'=>'Text', 'cd.nom'=>'Text', 's.phone'=>'Text', 's.siren'=>'Text',
's.siret'=>'Text', 's.ape'=>'Text', 's.idprof4'=>'Text', 's.code_compta'=>'Text', 's.code_compta_fournisseur'=>'Text', 's.tva_intra'=>'Text', 's.siret'=>'Text', 's.ape'=>'Text', 's.idprof4'=>'Text', 's.code_compta'=>'Text', 's.code_compta_fournisseur'=>'Text', 's.tva_intra'=>'Text',
'f.rowid'=>'Numeric', 'f.ref'=>"Text", 'f.ref_client'=>'Text', 'f.type'=>"Numeric", 'f.datec'=>"Date", 'f.datef'=>"Date", 'f.date_lim_reglement'=>"Date", 'f.rowid'=>'Numeric', 'f.ref'=>"Text", 'f.ref_client'=>'Text', 'f.type'=>"Numeric", 'f.datec'=>"Date", 'f.datef'=>"Date", 'f.date_lim_reglement'=>"Date",
'f.total'=>"Numeric", 'f.total_ttc'=>"Numeric", 'f.tva'=>"Numeric", 'f.localtax1'=>'Numeric', 'f.localtax2'=>'Numeric', 'none.rest'=>"NumericCompute", 'f.paye'=>"Boolean", 'f.fk_statut'=>'Numeric', 'f.total'=>"Numeric", 'f.total_ttc'=>"Numeric", 'f.tva'=>"Numeric", 'f.localtax1'=>'Numeric', 'f.localtax2'=>'Numeric', 'f.paye'=>"Boolean", 'f.fk_statut'=>'Numeric', 'f.close_code'=>'Text', 'f.close_note'=>'Text',
'none.rest'=>"NumericCompute",
'f.note_private'=>"Text", 'f.note_public'=>"Text", 'f.fk_user_author'=>'Numeric', 'uc.login'=>'Text', 'f.fk_user_valid'=>'Numeric', 'uv.login'=>'Text', 'f.note_private'=>"Text", 'f.note_public'=>"Text", 'f.fk_user_author'=>'Numeric', 'uc.login'=>'Text', 'f.fk_user_valid'=>'Numeric', 'uv.login'=>'Text',
'pj.ref'=>'Text', 'pj.title'=>'Text', 'fd.rowid'=>'Numeric', 'fd.label'=>'Text', 'fd.description'=>"Text", 'fd.subprice'=>"Numeric", 'fd.tva_tx'=>"Numeric", 'pj.ref'=>'Text', 'pj.title'=>'Text', 'fd.rowid'=>'Numeric', 'fd.label'=>'Text', 'fd.description'=>"Text", 'fd.subprice'=>"Numeric", 'fd.tva_tx'=>"Numeric",
'fd.qty'=>"Numeric", 'fd.total_ht'=>"Numeric", 'fd.total_tva'=>"Numeric", 'fd.total_ttc'=>"Numeric", 'fd.date_start'=>"Date", 'fd.date_end'=>"Date", 'fd.qty'=>"Numeric", 'fd.total_ht'=>"Numeric", 'fd.total_tva'=>"Numeric", 'fd.total_ttc'=>"Numeric", 'fd.date_start'=>"Date", 'fd.date_end'=>"Date",
@ -263,7 +265,7 @@ class modFacture extends DolibarrModules
'f.fk_user_author'=>'user', 'uc.login'=>'user', 'f.fk_user_valid'=>'user', 'uv.login'=>'user' 'f.fk_user_author'=>'user', 'uc.login'=>'user', 'f.fk_user_valid'=>'user', 'uv.login'=>'user'
); );
$this->export_special_array[$r] = array('none.rest'=>'getRemainToPay'); $this->export_special_array[$r] = array('none.rest'=>'getRemainToPay');
$this->export_dependencies_array[$r] = array('invoice_line'=>'fd.rowid', 'product'=>'fd.rowid', 'none.rest'=>array('f.rowid', 'f.total_ttc')); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them $this->export_dependencies_array[$r] = array('invoice_line'=>'fd.rowid', 'product'=>'fd.rowid', 'none.rest'=>array('f.rowid', 'f.total_ttc', 'f.close_code')); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
$keyforselect = 'facture'; $keyforelement = 'invoice'; $keyforaliasextra = 'extra'; $keyforselect = 'facture'; $keyforelement = 'invoice'; $keyforaliasextra = 'extra';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
$keyforselect = 'facturedet'; $keyforelement = 'invoice_line'; $keyforaliasextra = 'extra2'; $keyforselect = 'facturedet'; $keyforelement = 'invoice_line'; $keyforaliasextra = 'extra2';
@ -289,6 +291,7 @@ class modFacture extends DolibarrModules
if (isset($user) && empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' AND sc.fk_user = '.$user->id; if (isset($user) && empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' AND sc.fk_user = '.$user->id;
$r++; $r++;
$this->export_code[$r] = $this->rights_class.'_'.$r; $this->export_code[$r] = $this->rights_class.'_'.$r;
$this->export_label[$r] = 'CustomersInvoicesAndPayments'; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_label[$r] = 'CustomersInvoicesAndPayments'; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_icon[$r] = 'invoice'; $this->export_icon[$r] = 'invoice';
@ -300,7 +303,8 @@ class modFacture extends DolibarrModules
's.code_compta_fournisseur'=>'SupplierAccountancyCode', 's.tva_intra'=>'VATIntra', 's.code_compta_fournisseur'=>'SupplierAccountancyCode', 's.tva_intra'=>'VATIntra',
'f.rowid'=>"InvoiceId", 'f.ref'=>"InvoiceRef", 'f.ref_client'=>'RefCustomer', 'f.rowid'=>"InvoiceId", 'f.ref'=>"InvoiceRef", 'f.ref_client'=>'RefCustomer',
'f.type'=>"Type", 'f.datec'=>"InvoiceDateCreation", 'f.datef'=>"DateInvoice", 'f.date_lim_reglement'=>"DateDue", 'f.total'=>"TotalHT", 'f.type'=>"Type", 'f.datec'=>"InvoiceDateCreation", 'f.datef'=>"DateInvoice", 'f.date_lim_reglement'=>"DateDue", 'f.total'=>"TotalHT",
'f.total_ttc'=>"TotalTTC", 'f.tva'=>"TotalVAT", 'f.localtax1'=>'LocalTax1', 'f.localtax2'=>'LocalTax2', 'none.rest'=>'Rest', 'f.paye'=>"InvoicePaidCompletely", 'f.fk_statut'=>'InvoiceStatus', 'f.total_ttc'=>"TotalTTC", 'f.tva'=>"TotalVAT", 'f.localtax1'=>'LocalTax1', 'f.localtax2'=>'LocalTax2', 'f.paye'=>"InvoicePaidCompletely", 'f.fk_statut'=>'InvoiceStatus', 'f.close_code'=>'EarlyClosingReason', 'f.close_note'=>'EarlyClosingComment',
'none.rest'=>'Rest',
'f.note_private'=>"NotePrivate", 'f.note_public'=>"NotePublic", 'f.fk_user_author'=>'CreatedById', 'uc.login'=>'CreatedByLogin', 'f.note_private'=>"NotePrivate", 'f.note_public'=>"NotePublic", 'f.fk_user_author'=>'CreatedById', 'uc.login'=>'CreatedByLogin',
'f.fk_user_valid'=>'ValidatedById', 'uv.login'=>'ValidatedByLogin', 'pj.ref'=>'ProjectRef', 'pj.title'=>'ProjectLabel', 'p.rowid'=>'PaymentId', 'p.ref'=>'PaymentRef', 'f.fk_user_valid'=>'ValidatedById', 'uv.login'=>'ValidatedByLogin', 'pj.ref'=>'ProjectRef', 'pj.title'=>'ProjectLabel', 'p.rowid'=>'PaymentId', 'p.ref'=>'PaymentRef',
'p.amount'=>'AmountPayment', 'pf.amount'=>'AmountPaymentDistributedOnInvoice', 'p.datep'=>'DatePayment', 'p.num_paiement'=>'PaymentNumber', 'p.amount'=>'AmountPayment', 'pf.amount'=>'AmountPaymentDistributedOnInvoice', 'p.datep'=>'DatePayment', 'p.num_paiement'=>'PaymentNumber',
@ -325,9 +329,10 @@ class modFacture extends DolibarrModules
's.rowid'=>'Numeric', 's.nom'=>'Text', 's.code_client'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', 'c.code'=>'Text', 'cd.nom'=>'Text', 's.phone'=>'Text', 's.siren'=>'Text', 's.rowid'=>'Numeric', 's.nom'=>'Text', 's.code_client'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', 'c.code'=>'Text', 'cd.nom'=>'Text', 's.phone'=>'Text', 's.siren'=>'Text',
's.siret'=>'Text', 's.ape'=>'Text', 's.idprof4'=>'Text', 's.code_compta'=>'Text', 's.code_compta_fournisseur'=>'Text', 's.tva_intra'=>'Text', 's.siret'=>'Text', 's.ape'=>'Text', 's.idprof4'=>'Text', 's.code_compta'=>'Text', 's.code_compta_fournisseur'=>'Text', 's.tva_intra'=>'Text',
'f.rowid'=>"Numeric", 'f.ref'=>"Text", 'f.ref_client'=>'Text', 'f.type'=>"Numeric", 'f.datec'=>"Date", 'f.datef'=>"Date", 'f.date_lim_reglement'=>"Date", 'f.rowid'=>"Numeric", 'f.ref'=>"Text", 'f.ref_client'=>'Text', 'f.type'=>"Numeric", 'f.datec'=>"Date", 'f.datef'=>"Date", 'f.date_lim_reglement'=>"Date",
'f.total'=>"Numeric", 'f.total_ttc'=>"Numeric", 'f.tva'=>"Numeric", 'f.localtax1'=>'Numeric', 'f.localtax2'=>'Numeric', 'none.rest'=>'NumericCompute', 'f.paye'=>"Boolean", 'f.fk_statut'=>'Status', 'f.total'=>"Numeric", 'f.total_ttc'=>"Numeric", 'f.tva'=>"Numeric", 'f.localtax1'=>'Numeric', 'f.localtax2'=>'Numeric', 'f.paye'=>"Boolean", 'f.fk_statut'=>'Status', 'f.close_code'=>'Text', 'f.close_note'=>'Text',
'none.rest'=>'NumericCompute',
'f.note_private'=>"Text", 'f.note_public'=>"Text", 'f.fk_user_author'=>'Numeric', 'uc.login'=>'Text', 'f.fk_user_valid'=>'Numeric', 'uv.login'=>'Text', 'f.note_private'=>"Text", 'f.note_public'=>"Text", 'f.fk_user_author'=>'Numeric', 'uc.login'=>'Text', 'f.fk_user_valid'=>'Numeric', 'uv.login'=>'Text',
'pj.ref'=>'Text', 'p.amount'=>'Numeric', 'pf.amount'=>'Numeric', 'p.rowid'=>'Numeric', 'p.ref'=>'Text', 'p.title'=>'Text', 'p.datep'=>'Date', 'p.num_paiement'=>'Numeric', 'pj.ref'=>'Text', 'pj.title'=>'Text', 'p.amount'=>'Numeric', 'pf.amount'=>'Numeric', 'p.rowid'=>'Numeric', 'p.ref'=>'Text', 'p.title'=>'Text', 'p.datep'=>'Date', 'p.num_paiement'=>'Numeric',
'p.fk_bank'=>'Numeric', 'p.note'=>'Text', 'pt.code'=>'Text', 'pt.libelle'=>'text', 'ba.ref'=>'Text' 'p.fk_bank'=>'Numeric', 'p.note'=>'Text', 'pt.code'=>'Text', 'pt.libelle'=>'text', 'ba.ref'=>'Text'
); );
if (! empty($conf->cashdesk->enabled) || ! empty($conf->takepos->enabled) || ! empty($conf->global->INVOICE_SHOW_POS)) if (! empty($conf->cashdesk->enabled) || ! empty($conf->takepos->enabled) || ! empty($conf->global->INVOICE_SHOW_POS))
@ -338,12 +343,12 @@ class modFacture extends DolibarrModules
$this->export_entities_array[$r] = array( $this->export_entities_array[$r] = array(
's.rowid'=>"company", 's.nom'=>'company', 's.code_client'=>'company', 's.address'=>'company', 's.zip'=>'company', 's.town'=>'company', 'c.code'=>'company', 'cd.nom'=>'company', 's.phone'=>'company', 's.rowid'=>"company", 's.nom'=>'company', 's.code_client'=>'company', 's.address'=>'company', 's.zip'=>'company', 's.town'=>'company', 'c.code'=>'company', 'cd.nom'=>'company', 's.phone'=>'company',
's.siren'=>'company', 's.siret'=>'company', 's.ape'=>'company', 's.idprof4'=>'company', 's.code_compta'=>'company', 's.code_compta_fournisseur'=>'company', 's.siren'=>'company', 's.siret'=>'company', 's.ape'=>'company', 's.idprof4'=>'company', 's.code_compta'=>'company', 's.code_compta_fournisseur'=>'company',
's.tva_intra'=>'company', 'pj.ref'=>'project', 'p.title'=>'project', 'p.rowid'=>'payment', 'p.ref'=>'payment', 'p.amount'=>'payment', 'pf.amount'=>'payment', 'p.datep'=>'payment', 's.tva_intra'=>'company', 'pj.ref'=>'project', 'pj.title'=>'project', 'p.rowid'=>'payment', 'p.ref'=>'payment', 'p.amount'=>'payment', 'pf.amount'=>'payment', 'p.datep'=>'payment',
'p.num_paiement'=>'payment', 'pt.code'=>'payment', 'pt.libelle'=>'payment', 'p.note'=>'payment', 'f.fk_user_author'=>'user', 'uc.login'=>'user', 'p.num_paiement'=>'payment', 'pt.code'=>'payment', 'pt.libelle'=>'payment', 'p.note'=>'payment', 'f.fk_user_author'=>'user', 'uc.login'=>'user',
'f.fk_user_valid'=>'user', 'uv.login'=>'user', 'p.fk_bank'=>'account', 'ba.ref'=>'account' 'f.fk_user_valid'=>'user', 'uv.login'=>'user', 'p.fk_bank'=>'account', 'ba.ref'=>'account'
); );
$this->export_special_array[$r] = array('none.rest'=>'getRemainToPay'); $this->export_special_array[$r] = array('none.rest'=>'getRemainToPay');
$this->export_dependencies_array[$r] = array('payment'=>'p.rowid', 'none.rest'=>array('f.rowid', 'f.total_ttc')); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them $this->export_dependencies_array[$r] = array('payment'=>'p.rowid', 'none.rest'=>array('f.rowid', 'f.total_ttc', 'f.close_code')); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them, or just to have field we need
$keyforselect = 'facture'; $keyforelement = 'invoice'; $keyforaliasextra = 'extra'; $keyforselect = 'facture'; $keyforelement = 'invoice'; $keyforaliasextra = 'extra';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
$this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_start[$r]='SELECT DISTINCT ';

View File

@ -47,7 +47,7 @@ class modLabel extends DolibarrModules
$this->module_position = '75'; $this->module_position = '75';
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i', '', get_class($this)); $this->name = preg_replace('/^mod/i', '', get_class($this));
$this->description = "Gestion des etiquettes"; $this->description = "Management of stickers";
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
$this->version = 'development'; $this->version = 'development';
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);

View File

@ -45,6 +45,7 @@ class modModuleBuilder extends DolibarrModules
// Family can be 'crm','financial','hr','projects','products','ecm','technic','other' // Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
// It is used to group modules in module setup page // It is used to group modules in module setup page
$this->family = "technic"; $this->family = "technic";
$this->module_position = '90';
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i', '', get_class($this)); $this->name = preg_replace('/^mod/i', '', get_class($this));
$this->description = "A RAD (Rapid Application Development) tool to help developers to build their own module."; $this->description = "A RAD (Rapid Application Development) tool to help developers to build their own module.";
@ -82,6 +83,21 @@ class modModuleBuilder extends DolibarrModules
//------ //------
$this->boxes = array(); $this->boxes = array();
// Permissions
//------------
$this->rights = array(); // Permission array used by this module
$this->rights_class = 'modulebuilder';
$r=0;
$r++;
$this->rights[$r][0] = 3301;
$this->rights[$r][1] = 'Generate new modules';
$this->rights[$r][2] = 'a';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'run';
// Main menu entries // Main menu entries
//------------------ //------------------
$this->menu = array(); $this->menu = array();

View File

@ -348,6 +348,7 @@ class modStock extends DolibarrModules
$this->import_examplevalues_array[$r]=array( $this->import_examplevalues_array[$r]=array(
'ps.fk_product'=>"PREF123456",'ps.fk_entrepot'=>"ALM001",'ps.reel'=>"10" 'ps.fk_product'=>"PREF123456",'ps.fk_entrepot'=>"ALM001",'ps.reel'=>"10"
); );
$this->import_updatekeys_array[$r]=array('ps.fk_product'=>'Product', 'ps.fk_entrepot'=>"Warehouse");
$this->import_run_sql_after_array[$r]=array( // Because we may change data that are denormalized, we must update dernormalized data after. $this->import_run_sql_after_array[$r]=array( // Because we may change data that are denormalized, we must update dernormalized data after.
'UPDATE '.MAIN_DB_PREFIX.'product p SET p.stock= (SELECT SUM(ps.reel) FROM '.MAIN_DB_PREFIX.'product_stock ps WHERE ps.fk_product = p.rowid);' 'UPDATE '.MAIN_DB_PREFIX.'product p SET p.stock= (SELECT SUM(ps.reel) FROM '.MAIN_DB_PREFIX.'product_stock ps WHERE ps.fk_product = p.rowid);'
); );

View File

@ -362,7 +362,13 @@ class pdf_baleine extends ModelePDFProjects
else else
{ {
// We found a page break // We found a page break
$showpricebeforepagebreak=0;
// Allows data in the first page if description is long enough to break in multiples pages
if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
$showpricebeforepagebreak = 1;
else
$showpricebeforepagebreak = 0;
$forcedesconsamepage=1; $forcedesconsamepage=1;
if ($forcedesconsamepage) if ($forcedesconsamepage)
{ {

View File

@ -512,7 +512,13 @@ class pdf_beluga extends ModelePDFProjects
else else
{ {
// We found a page break // We found a page break
$showpricebeforepagebreak=0;
// Allows data in the first page if description is long enough to break in multiples pages
if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
$showpricebeforepagebreak = 1;
else
$showpricebeforepagebreak = 0;
$forcedesconsamepage=1; $forcedesconsamepage=1;
if ($forcedesconsamepage) if ($forcedesconsamepage)
{ {

View File

@ -293,7 +293,13 @@ class pdf_timespent extends ModelePDFProjects
else else
{ {
// We found a page break // We found a page break
$showpricebeforepagebreak=0;
// Allows data in the first page if description is long enough to break in multiples pages
if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
$showpricebeforepagebreak = 1;
else
$showpricebeforepagebreak = 0;
$forcedesconsamepage=1; $forcedesconsamepage=1;
if ($forcedesconsamepage) if ($forcedesconsamepage)
{ {

View File

@ -502,7 +502,12 @@ class pdf_azur extends ModelePDFPropales
$pdf->setPage($pageposbefore + 1); $pdf->setPage($pageposbefore + 1);
$curY = $tab_top_newpage; $curY = $tab_top_newpage;
$showpricebeforepagebreak = 0;
// Allows data in the first page if description is long enough to break in multiples pages
if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
$showpricebeforepagebreak = 1;
else
$showpricebeforepagebreak = 0;
} }
if (isset($imglinesize['width']) && isset($imglinesize['height'])) if (isset($imglinesize['width']) && isset($imglinesize['height']))
@ -543,7 +548,12 @@ class pdf_azur extends ModelePDFPropales
else else
{ {
// We found a page break // We found a page break
$showpricebeforepagebreak = 0;
// Allows data in the first page if description is long enough to break in multiples pages
if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
$showpricebeforepagebreak = 1;
else
$showpricebeforepagebreak = 0;
} }
} }
else // No pagebreak else // No pagebreak

View File

@ -582,7 +582,12 @@ class pdf_cyan extends ModelePDFPropales
$pdf->setPage($pageposbefore+1); $pdf->setPage($pageposbefore+1);
$curY = $tab_top_newpage; $curY = $tab_top_newpage;
$showpricebeforepagebreak=0;
// Allows data in the first page if description is long enough to break in multiples pages
if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
$showpricebeforepagebreak = 1;
else
$showpricebeforepagebreak = 0;
} }
@ -624,7 +629,12 @@ class pdf_cyan extends ModelePDFPropales
else else
{ {
// We found a page break // We found a page break
$showpricebeforepagebreak=0;
// Allows data in the first page if description is long enough to break in multiples pages
if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
$showpricebeforepagebreak = 1;
else
$showpricebeforepagebreak = 0;
} }
} }
else // No pagebreak else // No pagebreak

View File

@ -374,7 +374,12 @@ class pdf_squille extends ModelePdfReception
$pdf->setPage($pageposbefore + 1); $pdf->setPage($pageposbefore + 1);
$curY = $tab_top_newpage; $curY = $tab_top_newpage;
$showpricebeforepagebreak = 0;
// Allows data in the first page if description is long enough to break in multiples pages
if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
$showpricebeforepagebreak = 1;
else
$showpricebeforepagebreak = 0;
} }
if (isset($imglinesize['width']) && isset($imglinesize['height'])) if (isset($imglinesize['width']) && isset($imglinesize['height']))
@ -417,7 +422,12 @@ class pdf_squille extends ModelePdfReception
else else
{ {
// We found a page break // We found a page break
$showpricebeforepagebreak = 0;
// Allows data in the first page if description is long enough to break in multiples pages
if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
$showpricebeforepagebreak = 1;
else
$showpricebeforepagebreak = 0;
} }
} }
else // No pagebreak else // No pagebreak

View File

@ -383,7 +383,12 @@ class pdf_standard extends ModelePDFStock
else else
{ {
// We found a page break // We found a page break
$showpricebeforepagebreak=0;
// Allows data in the first page if description is long enough to break in multiples pages
if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
$showpricebeforepagebreak = 1;
else
$showpricebeforepagebreak = 0;
} }
} }
else // No pagebreak else // No pagebreak

View File

@ -543,7 +543,12 @@ class pdf_stdmovement extends ModelePDFMovement
else else
{ {
// We found a page break // We found a page break
$showpricebeforepagebreak=0;
// Allows data in the first page if description is long enough to break in multiples pages
if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
$showpricebeforepagebreak = 1;
else
$showpricebeforepagebreak = 0;
} }
} }
else // No pagebreak else // No pagebreak

View File

@ -430,7 +430,12 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
else else
{ {
// We found a page break // We found a page break
$showpricebeforepagebreak=0;
// Allows data in the first page if description is long enough to break in multiples pages
if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
$showpricebeforepagebreak = 1;
else
$showpricebeforepagebreak = 0;
} }
} }
else // No pagebreak else // No pagebreak

View File

@ -523,7 +523,12 @@ class pdf_cornas extends ModelePDFSuppliersOrders
$pdf->setPage($pageposbefore+1); $pdf->setPage($pageposbefore+1);
$curY = $tab_top_newpage; $curY = $tab_top_newpage;
$showpricebeforepagebreak=0;
// Allows data in the first page if description is long enough to break in multiples pages
if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
$showpricebeforepagebreak = 1;
else
$showpricebeforepagebreak = 0;
} }
if (!empty($imglinesize['width']) && !empty($imglinesize['height'])) if (!empty($imglinesize['width']) && !empty($imglinesize['height']))
@ -564,7 +569,12 @@ class pdf_cornas extends ModelePDFSuppliersOrders
else else
{ {
// We found a page break // We found a page break
$showpricebeforepagebreak=0;
// Allows data in the first page if description is long enough to break in multiples pages
if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
$showpricebeforepagebreak = 1;
else
$showpricebeforepagebreak = 0;
} }
} }
else // No pagebreak else // No pagebreak

View File

@ -445,7 +445,12 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$pdf->setPage($pageposbefore+1); $pdf->setPage($pageposbefore+1);
$curY = $tab_top_newpage; $curY = $tab_top_newpage;
$showpricebeforepagebreak=0;
// Allows data in the first page if description is long enough to break in multiples pages
if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
$showpricebeforepagebreak = 1;
else
$showpricebeforepagebreak = 0;
} }
if (!empty($imglinesize['width']) && !empty($imglinesize['height'])) if (!empty($imglinesize['width']) && !empty($imglinesize['height']))
@ -492,7 +497,12 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
else else
{ {
// We found a page break // We found a page break
$showpricebeforepagebreak=0;
// Allows data in the first page if description is long enough to break in multiples pages
if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
$showpricebeforepagebreak = 1;
else
$showpricebeforepagebreak = 0;
} }
} }
else // No pagebreak else // No pagebreak

View File

@ -365,7 +365,12 @@ class pdf_standard extends ModelePDFSuppliersPayments
else else
{ {
// We found a page break // We found a page break
$showpricebeforepagebreak=0;
// Allows data in the first page if description is long enough to break in multiples pages
if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
$showpricebeforepagebreak = 1;
else
$showpricebeforepagebreak = 0;
} }
} }
else // No pagebreak else // No pagebreak

View File

@ -430,7 +430,12 @@ class pdf_aurore extends ModelePDFSupplierProposal
$pdf->setPage($pageposbefore+1); $pdf->setPage($pageposbefore+1);
$curY = $tab_top_newpage; $curY = $tab_top_newpage;
$showpricebeforepagebreak=0;
// Allows data in the first page if description is long enough to break in multiples pages
if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
$showpricebeforepagebreak = 1;
else
$showpricebeforepagebreak = 0;
} }
if (!empty($imglinesize['width']) && !empty($imglinesize['height'])) if (!empty($imglinesize['width']) && !empty($imglinesize['height']))
@ -480,7 +485,12 @@ class pdf_aurore extends ModelePDFSupplierProposal
else else
{ {
// We found a page break // We found a page break
$showpricebeforepagebreak=0;
// Allows data in the first page if description is long enough to break in multiples pages
if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
$showpricebeforepagebreak = 1;
else
$showpricebeforepagebreak = 0;
} }
} }
else // No pagebreak else // No pagebreak

View File

@ -8,7 +8,7 @@ if (empty($conf) || !is_object($conf))
} }
// Loop to complete $param for extrafields // Loop to complete $param for extrafields
if (!empty($search_array_options)) // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ... if (!empty($search_array_options) && is_array($search_array_options)) // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ...
{ {
if (empty($search_options_pattern)) $search_options_pattern = 'search_options_'; if (empty($search_options_pattern)) $search_options_pattern = 'search_options_';

View File

@ -2013,6 +2013,9 @@ class EmailCollector extends CommonObject
// TEXT // TEXT
if ($p->type == 0 && $data) { if ($p->type == 0 && $data) {
if(!empty($params['charset'])) {
$data = $this->convertStringEncoding($data, $params['charset']);
}
// Messages may be split in different parts because of inline attachments, // Messages may be split in different parts because of inline attachments,
// so append parts together with blank row. // so append parts together with blank row.
if (strtolower($p->subtype) == 'plain') if (strtolower($p->subtype) == 'plain')
@ -2028,6 +2031,9 @@ class EmailCollector extends CommonObject
// There are no PHP functions to parse embedded messages, // There are no PHP functions to parse embedded messages,
// so this just appends the raw source to the main message. // so this just appends the raw source to the main message.
elseif ($p->type == 2 && $data) { elseif ($p->type == 2 && $data) {
if(!empty($params['charset'])) {
$data = $this->convertStringEncoding($data, $params['charset']);
}
$plainmsg .= $data."\n\n"; $plainmsg .= $data."\n\n";
} }
@ -2039,4 +2045,28 @@ class EmailCollector extends CommonObject
} }
} }
} }
/**
* Converts a string from one encoding to another.
*
* @param string $string String to convert
* @param string $fromEncoding String encoding
* @param string $toEncoding String return encoding
* @return string Converted string if conversion was successful, or the original string if not
* @throws Exception
*/
protected function convertStringEncoding($string, $fromEncoding, $toEncoding = 'UTF-8')
{
if(!$string || $fromEncoding == $toEncoding) {
return $string;
}
$convertedString = function_exists('iconv') ? @iconv($fromEncoding, $toEncoding . '//IGNORE', $string) : null;
if(!$convertedString && extension_loaded('mbstring')) {
$convertedString = @mb_convert_encoding($string, $toEncoding, $fromEncoding);
}
if(!$convertedString) {
throw new Exception('Mime string encoding conversion failed');
}
return $convertedString;
}
} }

View File

@ -1693,7 +1693,7 @@ elseif ($id || $ref)
} }
// Call Hook formConfirm // Call Hook formConfirm
$parameters = array(); $parameters = array('formConfirm' => $formconfirm);
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) $formconfirm .= $hookmanager->resPrint; if (empty($reshook)) $formconfirm .= $hookmanager->resPrint;
elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint; elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint;

View File

@ -211,7 +211,7 @@ if ($id > 0 || !empty($ref))
//print '<div class="fichehalfleft">'; //print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">'; print '<table class="border centpercent tableforfield">';
// Linked documents // Linked documents
if ($typeobject == 'commande' && $object->$typeobject->id && !empty($conf->commande->enabled)) if ($typeobject == 'commande' && $object->$typeobject->id && !empty($conf->commande->enabled))

View File

@ -261,7 +261,7 @@ if ($id > 0 || !empty($ref))
} }
// Call Hook formConfirm // Call Hook formConfirm
$parameters = array(); $parameters = array('formConfirm' => $formconfirm);
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) $formconfirm .= $hookmanager->resPrint; if (empty($reshook)) $formconfirm .= $hookmanager->resPrint;
elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint; elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint;

View File

@ -501,6 +501,9 @@ class ExpenseReports extends DolibarrApi
// phpcs:enable // phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
unset($object->cond_reglement);
unset($object->shipping_method_id);
unset($object->barcode_type); unset($object->barcode_type);
unset($object->barcode_type_code); unset($object->barcode_type_code);
unset($object->barcode_type_label); unset($object->barcode_type_label);

Some files were not shown because too many files have changed in this diff Show More