Merge branch '17.0' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2022-12-31 17:30:44 +01:00
commit 4c85236243
10 changed files with 31 additions and 49 deletions

View File

@ -134,7 +134,8 @@ if ($action == 'add_currency') {
dolibarr_set_const($db, 'MULTICURRENCY_APP_SOURCE', GETPOST('MULTICURRENCY_APP_SOURCE', 'alpha'));
//dolibarr_set_const($db, 'MULTICURRENCY_ALTERNATE_SOURCE', GETPOST('MULTICURRENCY_ALTERNATE_SOURCE', 'alpha'));
} else {
$result = MultiCurrency::syncRates($conf->global->MULTICURRENCY_APP_ID);
$multiurrency = new MultiCurrency($db);
$result = $multiurrency->syncRates(getDolGlobalString('MULTICURRENCY_APP_ID'));
if ($result > 0) {
setEventMessages($langs->trans("CurrencyRateSyncSucceed"), null, "mesgs");
}

View File

@ -18,11 +18,13 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/compta/localtax/index.php
* \ingroup tax
* \brief Index page of IRPF reports
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php';
@ -441,16 +443,6 @@ while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) { // $
$hookmanager->initHooks(array('externalbalance'));
$reshook = $hookmanager->executeHooks('addVatLine', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if (!is_array($x_coll) && $coll_listbuy == -1) {
$langs->load("errors");
print '<tr><td colspan="5">'.$langs->trans("ErrorNoAccountancyModuleLoaded").'</td></tr>';
break;
}
if (!is_array($x_paye) && $coll_listbuy == -2) {
print '<tr><td colspan="5">'.$langs->trans("FeatureNotYetAvailable").'</td></tr>';
break;
}
print '<tr class="oddeven">';
print '<td class="nowrap"><a href="'.DOL_URL_ROOT.'/compta/localtax/quadri_detail.php?leftmenu=tax_vat&month='.$m.'&year='.$y.'">'.dol_print_date(dol_mktime(0, 0, 0, $m, 1, $y), "%b %Y").'</a></td>';

View File

@ -389,16 +389,6 @@ if ($refresh === true) {
$hookmanager->initHooks(array('externalbalance'));
$reshook = $hookmanager->executeHooks('addVatLine', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if (!is_array($x_coll) && $coll_listbuy == -1) {
$langs->load("errors");
print '<tr><td colspan="5">' . $langs->trans("ErrorNoAccountancyModuleLoaded") . '</td></tr>';
break;
}
if (!is_array($x_paye) && $coll_listbuy == -2) {
print '<tr><td colspan="5">' . $langs->trans("FeatureNotYetAvailable") . '</td></tr>';
break;
}
print '<tr class="oddeven">';
print '<td class="nowrap"><a href="' . DOL_URL_ROOT . '/compta/tva/quadri_detail.php?leftmenu=tax_vat&month=' . $m . '&year=' . $y . '">' . dol_print_date(dol_mktime(0, 0, 0, $m, 1, $y), "%b %Y") . '</a></td>';

View File

@ -600,30 +600,27 @@ class Job extends CommonObject
}
/**
* Get last job for user
* Get the last occupied position for a user
*
* @param int $fk_user id of user we need to get last job
* @return mixed|string|null
* @param int $fk_user Id of user we need to get last job
* @return Position|string Last occupied position
*/
public function getLastJobForUser($fk_user)
{
global $db;
$j = new Job($db);
$Tab = $j->getForUser($fk_user);
$Tab = $this->getForUser($fk_user);
if (empty($Tab)) return '';
$job = array_shift($Tab);
$lastpos = array_shift($Tab);
return $job;
return $lastpos;
}
/**
* Get jobs for user
* Get array of occupied positions for a user
*
* @param int $userid id of user we need to get job list
* @return array of jobs
* @param int $userid Id of user we need to get job list
* @return Position[] Array of occupied positions
*/
public function getForUser($userid)
{

View File

@ -1036,6 +1036,8 @@ class Position extends CommonObject
}
/**
* getForUser
*
* @param int $userid id of user we need to get position list
* @return array|int of positions of user with for each of them the job fetched into that array
*/
@ -1049,7 +1051,7 @@ class Position extends CommonObject
}
/**
* Create a document onto disk according to template module.
* Create a document onto disk according to template module.
*
* @param string $modele Force template to use ('' to not force)
* @param Translate $outputlangs objet lang a utiliser pour traduction

View File

@ -1731,9 +1731,9 @@ if ($dirins && $action == 'confirm_deleteobject' && $objectname) {
);
$resultko = 0;
foreach ($filetodelete as $filetodelete) {
$resulttmp = dol_delete_file($dir.'/'.$filetodelete, 0, 0, 1);
$resulttmp = dol_delete_file($dir.'/'.$filetodelete.'.back', 0, 0, 1);
foreach ($filetodelete as $tmpfiletodelete) {
$resulttmp = dol_delete_file($dir.'/'.$tmpfiletodelete, 0, 0, 1);
$resulttmp = dol_delete_file($dir.'/'.$tmpfiletodelete.'.back', 0, 0, 1);
if (!$resulttmp) {
$resultko++;
}

View File

@ -428,7 +428,7 @@ class MultiCurrency extends CommonObject
*
* @param string $code currency code
* @param double $rate new rate
* @return int -1 if KO, 1 if OK, 2 if label found and OK
* @return int -1 if KO, 1 if OK, 2 if label found and OK
*/
public function addRateFromDolibarr($code, $rate)
{
@ -609,11 +609,11 @@ class MultiCurrency extends CommonObject
* @param stdClass $TRate Object containing all currencies rates
* @return int -1 if KO, 0 if nothing, 1 if OK
*/
public static function recalculRates(&$TRate)
public function recalculRates(&$TRate)
{
global $conf;
if ($conf->currency != $conf->global->MULTICURRENCY_APP_SOURCE) {
if ($conf->currency != getDolGlobalString('MULTICURRENCY_APP_SOURCE')) {
$alternate_source = 'USD'.$conf->currency;
if (!empty($TRate->$alternate_source)) {
$coef = $TRate->USDUSD / $TRate->$alternate_source;
@ -637,7 +637,7 @@ class MultiCurrency extends CommonObject
* @param int $addifnotfound Add if not found
* @return int <0 if KO, >0 if OK
*/
public static function syncRates($key, $addifnotfound = 0)
public function syncRates($key, $addifnotfound = 0)
{
global $conf, $db, $langs;
@ -656,16 +656,16 @@ class MultiCurrency extends CommonObject
if ($response->success) {
$TRate = $response->quotes;
$timestamp = $response->timestamp;
//$timestamp = $response->timestamp;
if (self::recalculRates($TRate) >= 0) {
if ($this->recalculRates($TRate) >= 0) {
foreach ($TRate as $currency_code => $rate) {
$code = substr($currency_code, 3, 3);
$obj = new MultiCurrency($db);
if ($obj->fetch(null, $code) > 0) {
$obj->updateRate($rate);
} elseif ($addifnotfound) {
self::addRateFromDolibarr($code, $rate);
$this->addRateFromDolibarr($code, $rate);
}
}
}

View File

@ -271,7 +271,7 @@ if (!in_array($action, array("updateRate", "deleteRate"))) {
print ' <td>'.$langs->trans('Date').'</td>';
print ' <td>';
print $form->selectDate($dateinput, 'dateinput', 0, 0, 1);
print $form->selectDate($dateinput, 'dateinput', 0, 0, 1, '', 1, 1);
print '</td>';
print '<td> '.$langs->trans('Currency').'</td>';

View File

@ -420,8 +420,8 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { // TODO Not used by current code
$location = array();
$location[""] = $langs->trans("NotDefined");
foreach ($locations as $locations) {
$location[$locations->id] = $locations->display_name;
foreach ($locations as $tmplocation) {
$location[$tmplocation->id] = $tmplocation->display_name;
}
print $form->selectarray("STRIPE_LOCATION", $location, getDolGlobalString('STRIPE_LOCATION'));
print '</td></tr>';

View File

@ -219,8 +219,8 @@ if (isModEnabled("banque")) {
$reader = array();
$reader[""] = $langs->trans("NoReader");
foreach ($readers as $readers) {
$reader[$reader->id] = $readers->label.' ('.$readers->status.')';
foreach ($readers as $tmpreader) {
$reader[$tmpreader->id] = $tmpreader->label.' ('.$tmpreader->status.')';
}
print $form->selectarray('CASHDESK_ID_BANKACCOUNT_STRIPETERMINAL'.$terminaltouse, $reader, $conf->global->{'CASHDESK_ID_BANKACCOUNT_STRIPETERMINAL'.$terminaltouse});
print '</td></tr>';