Merge branch '15.0' of git@github.com:Dolibarr/dolibarr.git into 16.0

Conflicts:
	htdocs/comm/propal/class/api_proposals.class.php
This commit is contained in:
Laurent Destailleur 2022-08-25 14:31:47 +02:00
commit 0d693d723a
10 changed files with 47 additions and 17 deletions

View File

@ -496,8 +496,12 @@ class Proposals extends DolibarrApi
$request_data = (object) $request_data;
$request_data->desc = sanitizeVal($request_data->desc, 'restricthtml');
$request_data->label = sanitizeVal($request_data->label);
if (isset($request_data->desc)) {
$request_data->desc = sanitizeVal($request_data->desc, 'restricthtml');
}
if (isset($request_data->label)) {
$request_data->label = sanitizeVal($request_data->label);
}
$propalline = new PropaleLigne($this->db);
$result = $propalline->fetch($lineid);

View File

@ -69,12 +69,12 @@ if (!$sortorder) {
// Date range
$year = GETPOST('year', 'int');
if (empty($year)) {
$year_current = strftime("%Y", dol_now());
$month_current = strftime("%m", dol_now());
$year_current = dol_print_date(dol_now(), "%Y");
$month_current = dol_print_date(dol_now(), "%m");
$year_start = $year_current;
} else {
$year_current = $year;
$month_current = strftime("%m", dol_now());
$month_current = dol_print_date(dol_now(), "%m");
$year_start = $year;
}
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
@ -1039,7 +1039,7 @@ if ($modecompta == 'BOOKKEEPING') {
if ($modecompta == 'CREANCES-DETTES' || $modecompta == 'RECETTES-DEPENSES') {
$langs->load('trips');
if ($modecompta == 'CREANCES-DETTES') {
$sql = "SELECT p.rowid, p.ref, u.rowid as userid, u.firstname, u.lastname, date_format(date_valid,'%Y-%m') as dm, sum(p.total_ht) as amount_ht,sum(p.total_ttc) as amount_ttc";
$sql = "SELECT p.rowid, p.ref, u.rowid as userid, u.firstname, u.lastname, date_format(date_valid,'%Y-%m') as dm, p.total_ht as amount_ht, p.total_ttc as amount_ttc";
$sql .= " FROM ".MAIN_DB_PREFIX."expensereport as p";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user_author";
$sql .= " WHERE p.entity IN (".getEntity('expensereport').")";
@ -1047,7 +1047,7 @@ if ($modecompta == 'BOOKKEEPING') {
$column = 'p.date_valid';
} else {
$sql = "SELECT p.rowid, p.ref, u.rowid as userid, u.firstname, u.lastname, date_format(pe.datep,'%Y-%m') as dm, sum(p.total_ht) as amount_ht, sum(p.total_ttc) as amount_ttc";
$sql = "SELECT p.rowid, p.ref, u.rowid as userid, u.firstname, u.lastname, date_format(pe.datep,'%Y-%m') as dm, sum(pe.amount) as amount_ht, sum(pe.amount) as amount_ttc";
$sql .= " FROM ".MAIN_DB_PREFIX."expensereport as p";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user_author";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."payment_expensereport as pe ON pe.fk_expensereport = p.rowid";

View File

@ -47,12 +47,12 @@ $nbofyear = 4;
// Date range
$year = GETPOST('year', 'int');
if (empty($year)) {
$year_current = strftime("%Y", dol_now());
$month_current = strftime("%m", dol_now());
$year_current = dol_print_date(dol_now(), "%Y");
$month_current = dol_print_date(dol_now(), "%m");
$year_start = $year_current - ($nbofyear - 1);
} else {
$year_current = $year;
$month_current = strftime("%m", dol_now());
$month_current = dol_print_date(dol_now(), "%m");
$year_start = $year - ($nbofyear - 1);
}
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);

View File

@ -69,6 +69,8 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
$month_end = $month_start - 1;
if ($month_end < 1) {
$month_end = 12;
} else {
$year_end++;
}
} else {
$month_end = $month_start;

View File

@ -39,12 +39,12 @@ $nbofyear = 4;
// Date range
$year = GETPOST('year', 'int');
if (empty($year)) {
$year_current = strftime("%Y", dol_now());
$month_current = strftime("%m", dol_now());
$year_current = dol_print_date(dol_now(), "%Y");
$month_current = dol_print_date(dol_now(), "%m");
$year_start = $year_current - ($nbofyear - 1);
} else {
$year_current = $year;
$month_current = strftime("%m", dol_now());
$month_current = dol_print_date(dol_now(), "%m");
$year_start = $year - ($nbofyear - 1);
}
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear, 'tzserver'); // We use timezone of server so report is same from everywhere
@ -56,7 +56,7 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
if ($q == 0) {
// We define date_start and date_end
$year_end = $year_start + ($nbofyear - 1);
$month_start = GETPOST("month") ? GETPOST("month", 'int') : ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
$month_start = GETPOSTISSET("month") ? GETPOST("month", 'int') : ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1);
if (!GETPOST('month')) {
if (!GETPOST("year") && $month_start > $month_current) {
$year_start--;
@ -65,6 +65,8 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
$month_end = $month_start - 1;
if ($month_end < 1) {
$month_end = 12;
} else {
$year_end++;
}
} else {
$month_end = $month_start;

View File

@ -6451,11 +6451,15 @@ class Form
} elseif ($usecalendar == 'jquery') {
if (!$disabled) {
// Output javascript for datepicker
$minYear = $conf->global->MIN_YEAR_SELECT_DATE ? $conf->global->MIN_YEAR_SELECT_DATE : (date('Y') - 100);
$maxYear = $conf->global->MAX_YEAR_SELECT_DATE ? $conf->global->MAX_YEAR_SELECT_DATE : (date('Y') + 100);
$retstring .= "<script type='text/javascript'>";
$retstring .= "$(function(){ $('#".$prefix."').datepicker({
dateFormat: '".$langs->trans("FormatDateShortJQueryInput")."',
autoclose: true,
todayHighlight: true,";
todayHighlight: true,
yearRange: '".$minYear.":".$maxYear."',";
if (!empty($conf->dol_use_jmobile)) {
$retstring .= "
beforeShow: function (input, datePicker) {

View File

@ -3191,6 +3191,8 @@ function dol_print_phone($phone, $countrycode = '', $cid = 0, $socid = 0, $addli
$newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 2).$separ.substr($newphone, 5, 2).$separ.substr($newphone, 7, 2).$separ.substr($newphone, 9, 2);
} elseif (dol_strlen($phone) == 12) {
$newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 1).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 2);
} elseif (dol_strlen($phone) == 13) {
$newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 3).$separ.substr($newphone, 11, 2);
}
} elseif (strtoupper($countrycode) == "CA") {
if (dol_strlen($phone) == 10) {

View File

@ -194,7 +194,7 @@ if ($action == 'presend') {
}
$formmail->withto = $liste;
$formmail->withtofree = (GETPOSTISSET('sendto') ? (GETPOST('sendto', 'alphawithlgt') ? GETPOST('sendto', 'alphawithlgt') : '1') : '1');
$formmail->withtofree = (GETPOST('sendto', 'alphawithlgt') ? GETPOST('sendto', 'alphawithlgt') : '1');
$formmail->withtocc = $liste;
$formmail->withtoccc = getDolGlobalString('MAIN_EMAIL_USECCC');
$formmail->withtopic = $topicmail;

View File

@ -493,14 +493,30 @@ if (!function_exists('ftp_connect')) {
//$newsection = '/./';
$newsection = ssh2_sftp_realpath($conn_id, ".").'/./'; // workaround for bug https://bugs.php.net/bug.php?id=64169
}
//$newsection='/';
//$dirHandle = opendir("ssh2.sftp://$conn_id".$newsection);
//$dirHandle = opendir("ssh2.sftp://".intval($conn_id).ssh2_sftp_realpath($conn_id, ".").'/./');
$contents = scandir('ssh2.sftp://'.intval($conn_id).$newsection);
$buff = array();
foreach ($contents as $i => $key) {
$buff[$i] = "---------- - root root 1234 Aug 01 2000 ".$key;
}
//$i = 0;
//$handle = opendir('ssh2.sftp://'.intval($conn_id).$newsection);
//$buff=array();
//while (false !== ($file = readdir($handle))) {
// if (substr("$file", 0, 1) != "."){
// if (is_dir($file)) {
// $buff[$i]="d--------- - root root 1234 Aug 01 2000 ".$file;
// } else {
// $buff[$i]="---------- - root root 1234 Aug 01 2000 ".$file;
// }
// }
// $i++;
//}
} else {
$buff = ftp_rawlist($conn_id, $newsectioniso);
$contents = ftp_nlist($conn_id, $newsectioniso); // Sometimes rawlist fails but never nlist

View File

@ -755,7 +755,7 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac
$morehtmlright = dolGetButtonTitle($langs->trans('Add'), $langs->trans('NotEnoughPermissions'), 'fa fa-plus-circle', '', '', -2);
}
} else {
$morehtmlright = dolGetButtonTitle($langs->trans('Add'), 'AlreadyOneBankAccount', 'fa fa-plus-circle', '', '', -2);
$morehtmlright = dolGetButtonTitle($langs->trans('Add'), $langs->trans('AlreadyOneBankAccount'), 'fa fa-plus-circle', '', '', -2);
}
print load_fiche_titre($langs->trans("BankAccounts"), $morehtmlright, 'bank_account');