Skip to content

Commit

Permalink
Merge branch 'Dolibarr:develop' into patch-13
Browse files Browse the repository at this point in the history
  • Loading branch information
zephyriony committed Jun 3, 2024
2 parents 875ffec + e5742de commit 9904e0e
Show file tree
Hide file tree
Showing 55 changed files with 1,181 additions and 911 deletions.
1 change: 1 addition & 0 deletions dev/tools/phan/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,7 @@
'PhanCompatibleNegativeStringOffset', // return false positive
'PhanPluginConstantVariableBool', // a lot of false positive, in most cases, we want to keep the code as it is
'PhanTypeObjectUnsetDeclaredProperty',
'PhanTypePossiblyInvalidDimOffset', // a lot of false positive, in most cases, we want to keep the code as it is

'PhanPluginWhitespaceTab', // Dolibarr used tabs
'PhanPluginCanUsePHP71Void', // Dolibarr is maintaining 7.0 compatibility
Expand Down
1 change: 1 addition & 0 deletions dev/tools/phan/config_extended.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
'PhanCompatibleNegativeStringOffset', // return false positive
'PhanPluginConstantVariableBool', // a lot of false positive, in most cases, we want to keep the code as it is
'PhanTypeObjectUnsetDeclaredProperty',
'PhanTypePossiblyInvalidDimOffset', // a lot of false positive, in most cases, we want to keep the code as it is

'PhanPluginWhitespaceTab', // Dolibarr used tabs
'PhanPluginCanUsePHP71Void', // Dolibarr is maintaining 7.0 compatibility
Expand Down
2 changes: 1 addition & 1 deletion htdocs/accountancy/bookkeeping/listbyaccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -1135,7 +1135,7 @@
// Journal code
if (!empty($arrayfields['t.code_journal']['checked'])) {
$accountingjournal = new AccountingJournal($db);
$result = $accountingjournal->fetch('', $line->code_journal);
$result = $accountingjournal->fetch(0, $line->code_journal);
$journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $line->code_journal);
print '<td class="center tdoverflowmax80">'.$journaltoshow.'</td>';
if (!$i) {
Expand Down
8 changes: 4 additions & 4 deletions htdocs/accountancy/class/accountingaccount.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -874,9 +874,9 @@ public function getAccountingCodeToBind(Societe $buyer, Societe $seller, Product
if ($factureDet->desc == "(DEPOSIT)" || $facture->type == $facture::TYPE_DEPOSIT) {
$accountdeposittoventilated = new self($this->db);
if ($type == 'customer') {
$result = $accountdeposittoventilated->fetch('', getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT'), 1);
$result = $accountdeposittoventilated->fetch(0, getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT'), 1);
} elseif ($type == 'supplier') {
$result = $accountdeposittoventilated->fetch('', getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT'), 1);
$result = $accountdeposittoventilated->fetch(0, getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT'), 1);
}
if (isset($result) && $result < 0) {
return -1;
Expand All @@ -897,9 +897,9 @@ public function getAccountingCodeToBind(Societe $buyer, Societe $seller, Product
if ($facture->type == $facture::TYPE_CREDIT_NOTE && $invoiceSource->type == $facture::TYPE_DEPOSIT) {
$accountdeposittoventilated = new self($this->db);
if ($type == 'customer') {
$accountdeposittoventilated->fetch('', getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT'), 1);
$accountdeposittoventilated->fetch(0, getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT'), 1);
} elseif ($type == 'supplier') {
$accountdeposittoventilated->fetch('', getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT'), 1);
$accountdeposittoventilated->fetch(0, getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT'), 1);
}
$code_l = $accountdeposittoventilated->ref;
$code_p = '';
Expand Down
13 changes: 4 additions & 9 deletions htdocs/adherents/card.php
Original file line number Diff line number Diff line change
Expand Up @@ -2064,15 +2064,10 @@ function initfieldrequired() {
*/

// Show online payment link
$useonlinepayment = (isModEnabled('paypal') || isModEnabled('stripe') || isModEnabled('paybox'));

$parameters = array();
$reshook = $hookmanager->executeHooks('doShowOnlinePaymentUrl', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
} else {
$useonlinepayment = $reshook;
}
// The list can be complete by the hook 'doValidatePayment' executed inside getValidOnlinePaymentMethods()
include_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
$validpaymentmethod = getValidOnlinePaymentMethods('');
$useonlinepayment = count($validpaymentmethod);

if ($useonlinepayment) {
print '<br>';
Expand Down
4 changes: 3 additions & 1 deletion htdocs/adherents/class/adherent.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -3282,7 +3282,9 @@ public function getKanbanView($option = '', $arraydata = null)
$return .= '<br><span class="info-box-label">'.$this->getmorphylib('', 2).'</span>';
}
if (method_exists($this, 'getLibStatut')) {
$return .= '<br><div class="info-box-status">'.$this->getLibStatut(3).'</div>';
$return .= '<br><div class="info-box-status paddingtop">';
$return .= $this->LibStatut($this->status, $this->need_subscription, $this->datefin, 5);
$return .= '</div>';
}
$return .= '</div>';
$return .= '</div>';
Expand Down
2 changes: 2 additions & 0 deletions htdocs/adherents/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -1245,8 +1245,10 @@
}
$membertypestatic->id = $obj->type_id;
$membertypestatic->label = $obj->type;

$memberstatic->type = $membertypestatic->label;
$memberstatic->photo = $obj->photo;

// Output Kanban
print $memberstatic->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
if ($i == (min($num, $limit) - 1)) {
Expand Down
15 changes: 5 additions & 10 deletions htdocs/adherents/subscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -822,16 +822,11 @@


if (($action != 'addsubscription' && $action != 'create_thirdparty')) {
// Shon online payment link
$useonlinepayment = (isModEnabled('paypal') || isModEnabled('stripe') || isModEnabled('paybox'));

$parameters = array();
$reshook = $hookmanager->executeHooks('doShowOnlinePaymentUrl', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
if (isset($hookmanager->resArray['showonlinepaymenturl'])) {
$useonlinepayment = $hookmanager->resArray['showonlinepaymenturl'];
}
}
// Show online payment link
// The list can be complete by the hook 'doValidatePayment' executed inside getValidOnlinePaymentMethods()
include_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
$validpaymentmethod = getValidOnlinePaymentMethods('');
$useonlinepayment = count($validpaymentmethod);

if ($useonlinepayment) {
print '<br>';
Expand Down
2 changes: 1 addition & 1 deletion htdocs/admin/system/security.php
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@
print '")</span><br>';
print '<br>';

print '<strong>WEBSITE_MAIN_SECURITY_FORCERP</strong> = '.getDolGlobalString('WEBSITE_MAIN_SECURITY_FORCERP', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>').' &nbsp; <span class="opacitymedium">('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or").' "strict-origin-when-cross-origin")</span><br>';
print '<strong>WEBSITE_MAIN_SECURITY_FORCERP</strong> = '.getDolGlobalString('WEBSITE_MAIN_SECURITY_FORCERP', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>').' &nbsp; <span class="opacitymedium">('.$langs->trans("Recommended").': '.$langs->trans("Undefined").'="strict-origin-when-cross-origin" '.$langs->trans("or").' "same-origin"=more secured)</span><br>';
print '<br>';

print '<strong>WEBSITE_MAIN_SECURITY_FORCESTS</strong> = '.getDolGlobalString('WEBSITE_MAIN_SECURITY_FORCESTS', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>').' &nbsp; <span class="opacitymedium">('.$langs->trans("Example").": \"max-age=31536000; includeSubDomains\")</span><br>";
Expand Down
3 changes: 3 additions & 0 deletions htdocs/asterisk/wrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ function llxFooter()
$caller = GETPOST('caller', 'alphanohtml');
$called = GETPOST('called', 'alphanohtml');

// Sanitize password to avoid to use the wrapper to inject malicious paylod into asterisk
$password = preg_replace('/[\n\r]/', '', $password);

// IP address of Asterisk server
$strHost = getDolGlobalString('ASTERISK_HOST');

Expand Down
4 changes: 2 additions & 2 deletions htdocs/comm/propal/class/propal.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -3654,7 +3654,7 @@ public function getTooltipContentArray($params)
}
if ($user->hasRight('propal', 'lire')) {
$datas['picto'] = img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("Proposal").'</u>';
if (isset($this->statut)) {
if (isset($this->status)) {
$datas['status'] = ' '.$this->getLibStatut(5);
}
if (!empty($this->ref)) {
Expand All @@ -3674,7 +3674,7 @@ public function getTooltipContentArray($params)
$langs->load('project');
if (empty($this->project)) {
$res = $this->fetch_project();
if ($res > 0 && $this->project instanceof Project) {
if ($res > 0 && !empty($this->project) && $this->project instanceof Project) {
$datas['project'] = '<br><b>'.$langs->trans('Project').':</b> '.$this->project->getNomUrl(1, '', 0, 1);
}
}
Expand Down
13 changes: 4 additions & 9 deletions htdocs/commande/card.php
Original file line number Diff line number Diff line change
Expand Up @@ -3129,15 +3129,10 @@
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem, $compatibleImportElementsList);

// Show online payment link
$useonlinepayment = (isModEnabled('paypal') || isModEnabled('stripe') || isModEnabled('paybox'));

$parameters = array();
$reshook = $hookmanager->executeHooks('doShowOnlinePaymentUrl', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
if (isset($hookmanager->resArray['showonlinepaymenturl'])) {
$useonlinepayment = $hookmanager->resArray['showonlinepaymenturl'];
}
}
// The list can be complete by the hook 'doValidatePayment' executed inside getValidOnlinePaymentMethods()
include_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
$validpaymentmethod = getValidOnlinePaymentMethods('');
$useonlinepayment = count($validpaymentmethod);

if (getDolGlobalString('ORDER_HIDE_ONLINE_PAYMENT_ON_ORDER')) {
$useonlinepayment = 0;
Expand Down
2 changes: 1 addition & 1 deletion htdocs/commande/class/commande.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -3756,7 +3756,7 @@ public function getTooltipContentArray($params)
$langs->load('project');
if (empty($this->project)) {
$res = $this->fetch_project();
if ($res > 0 && $this->project instanceof Project) {
if ($res > 0 && !empty($this->project) && $this->project instanceof Project) {
$datas['project'] = '<br><b>'.$langs->trans('Project').':</b> '.$this->project->getNomUrl(1, '', 0, 1);
}
}
Expand Down
16 changes: 13 additions & 3 deletions htdocs/compta/bank/bankentries_list.php
Original file line number Diff line number Diff line change
Expand Up @@ -1328,8 +1328,10 @@
$sqlforbalance .= " WHERE b.fk_account = ba.rowid";
$sqlforbalance .= " AND ba.entity IN (".getEntity('bank_account').")";
$sqlforbalance .= " AND b.fk_account = ".((int) $search_account);
// To limit record on the page
$sqlforbalance .= " AND (b.datev < '".$db->idate($db->jdate($objp->dv))."' OR (b.datev = '".$db->idate($db->jdate($objp->dv))."' AND (b.dateo < '".$db->idate($db->jdate($objp->do))."' OR (b.dateo = '".$db->idate($db->jdate($objp->do))."' AND b.rowid < ".$objp->rowid."))))";
$resqlforbalance = $db->query($sqlforbalance);

//print $sqlforbalance;
if ($resqlforbalance) {
$objforbalance = $db->fetch_object($resqlforbalance);
Expand Down Expand Up @@ -1396,14 +1398,22 @@
if (!empty($arrayfields['balancebefore']['checked'])) {
print '<td class="right">';
if ($search_conciliated !== '0') {
print price(price2num($balance, 'MT'), 1, $langs);
if ($sortfield == 'b.datev,b.dateo,b.rowid' && ($sortorder == 'desc' || $sortorder == 'desc,desc' || $sortorder == 'desc,desc,desc')) {
print price(price2num($balancebefore, 'MT'), 1, $langs);
} else {
print price(price2num($balance, 'MT'), 1, $langs);
}
}
print '</td>';
}
if (!empty($arrayfields['balance']['checked'])) {
print '<td class="right">';
if ($search_conciliated !== '0') {
print price(price2num($balance, 'MT'), 1, $langs);
if ($search_conciliated !== '0') { // If not filter of filter on "conciliated"
if ($sortfield == 'b.datev,b.dateo,b.rowid' && ($sortorder == 'desc' || $sortorder == 'desc,desc' || $sortorder == 'desc,desc,desc')) {
print price(price2num($balancebefore, 'MT'), 1, $langs);
} else {
print price(price2num($balance, 'MT'), 1, $langs);
}
}
print '</td>';
}
Expand Down
8 changes: 0 additions & 8 deletions htdocs/compta/facture/card.php
Original file line number Diff line number Diff line change
Expand Up @@ -6076,14 +6076,6 @@ function js_recalculate_revenuestamp(){
$validpaymentmethod = getValidOnlinePaymentMethods('');
$useonlinepayment = count($validpaymentmethod);

$parameters = array();
$reshook = $hookmanager->executeHooks('doShowOnlinePaymentUrl', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
if (isset($hookmanager->resArray['showonlinepaymenturl'])) {
$useonlinepayment = $hookmanager->resArray['showonlinepaymenturl'];
}
}

if ($object->status != Facture::STATUS_DRAFT && $useonlinepayment) {
print '<br><!-- Link to pay -->'."\n";
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
Expand Down
53 changes: 39 additions & 14 deletions htdocs/compta/stats/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

/**
* \file htdocs/compta/stats/index.php
* \brief Page reporting CA
* \brief Page reporting sell turnover
*/

// Load Dolibarr environment
Expand Down Expand Up @@ -58,12 +58,12 @@

// We define date_start and date_end
if (empty($date_start) || empty($date_end)) { // We define date_start and date_end
$q = GETPOST("q") ? GETPOST("q") : 0;
if ($q == 0) {
$q = GETPOSTINT("q");
if (empty($q)) {
// We define date_start and date_end
$year_end = $year_start + $nbofyear - (getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') > 1 ? 0 : 1);
$month_start = GETPOSTISSET("month") ? GETPOSTINT("month") : getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1);
if (!GETPOST('month')) {
if (!GETPOST('month')) { // If month not forced
if (!$year && $month_start > $month_current) {
$year_start--;
$year_end--;
Expand Down Expand Up @@ -96,8 +96,11 @@
}
}

$userid = GETPOSTINT('userid');
$socid = GETPOSTINT('socid');

$tmps = dol_getdate($date_start);
$mothn_start = $tmps['mon'];
$month_start = $tmps['mon'];
$year_start = $tmps['year'];
$tmpe = dol_getdate($date_end);
$month_end = $tmpe['mon'];
Expand All @@ -113,10 +116,7 @@
$modecompta = GETPOST("modecompta", 'alpha');
}

$userid = GETPOSTINT('userid');

// Security check
$socid = GETPOSTINT('socid');
if ($user->socid > 0) {
$socid = $user->socid;
}
Expand Down Expand Up @@ -184,7 +184,7 @@

// Define $calcmode line
$calcmode = '';
if ($modecompta == "RECETTES-DEPENSES" || $modecompta == "BOOKKEEINGCOLLECTED") {
if ($modecompta == "RECETTES-DEPENSES" || $modecompta == "BOOKKEEPINGCOLLECTED") {
/*if (isModEnabled('accounting')) {
$calcmode .= '<input type="radio" name="modecompta" id="modecompta3" value="BOOKKEEPINGCOLLECTED"'.($modecompta == 'BOOKKEEPINGCOLLECTED' ? ' checked="checked"' : '').'><label for="modecompta3"> '.$langs->trans("CalcModeBookkeeping").'</label>';
$calcmode .= '<br>';
Expand All @@ -197,6 +197,7 @@
} else {
if (isModEnabled('accounting')) {
$calcmode .= '<input type="radio" name="modecompta" id="modecompta3" value="BOOKKEEPING"'.($modecompta == 'BOOKKEEPING' ? ' checked="checked"' : '').'><label for="modecompta3"> '.$langs->trans("CalcModeBookkeeping").'</label>';
$calcmode .= ' <span class="opacitymedium hideonsmartphone">('.$langs->trans("DataMustHaveBeenTransferredInAccounting").')</span>';
$calcmode .= '<br>';
}
$calcmode .= '<input type="radio" name="modecompta" id="modecompta2" value="CREANCES-DETTES"'.($modecompta == 'CREANCES-DETTES' ? ' checked="checked"' : '').'><label for="modecompta2"> '.$langs->trans("CalcModeDebt");
Expand All @@ -208,8 +209,33 @@

report_header($name, $namelink, $period, $periodlink, $description, $builddate, $exportlink, $moreparam, $calcmode);

if (isModEnabled('accounting') && $modecompta != 'BOOKKEEPING') {
print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
if (isModEnabled('accounting')) {
if ($modecompta != 'BOOKKEEPING') {
print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
} else {
// Test if there is at least one line in bookkeeping
$pcgverid = getDolGlobalInt('CHARTOFACCOUNTS');
$pcgvercode = dol_getIdFromCode($db, $pcgverid, 'accounting_system', 'rowid', 'pcg_version');
if (empty($pcgvercode)) {
$pcgvercode = $pcgverid;
}

$sql = "SELECT b.rowid ";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as b,";
$sql .= " ".MAIN_DB_PREFIX."accounting_account as aa";
$sql .= " WHERE b.entity = ".$conf->entity; // In module double party accounting, we never share entities
$sql .= " AND b.numero_compte = aa.account_number";
$sql .= " AND aa.entity = ".$conf->entity;
$sql .= " AND aa.fk_pcg_version = '".$db->escape($pcgvercode)."'";
$sql .= $db->plimit(1);

$resql = $db->query($sql);
$nb = $db->num_rows($resql);
if ($nb == 0) {
$langs->load("errors");
print info_admin($langs->trans("WarningNoDataTransferedInAccountancyYet"), 0, 0, 1);
}
}
}


Expand Down Expand Up @@ -339,7 +365,7 @@
print '<td align="center" width="10%" colspan="2" class="borderrightlight">';
}
if ($modecompta != 'BOOKKEEPING') {
print '<a href="casoc.php?year='.$annee.'">';
print '<a href="casoc.php?year='.$annee.($modecompta ? '&modecompta='.$modecompta : '').'">';
}
print $annee;
if (getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') > 1) {
Expand Down Expand Up @@ -379,13 +405,12 @@
$maxyear = substr($maxyearmonth, 0, 4);
$nowyear = dol_print_date(dol_now('gmt'), "%Y", 'gmt');
$nowyearmonth = dol_print_date(dol_now(), "%Y%m");
//$nowyearmonth = strftime("%Y-%m", dol_now());
$maxyearmonth = max($maxyearmonth, $nowyearmonth);
$now = dol_now();
$casenow = dol_print_date($now, "%Y-%m");

// Loop on each month
$nb_mois_decalage = GETPOSTISSET('date_startmonth') ? (GETPOSTINT('date_startmonth') - 1) : (!getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') ? 0 : ($conf->global->SOCIETE_FISCAL_MONTH_START - 1));
$nb_mois_decalage = GETPOSTISSET('date_startmonth') ? (GETPOSTINT('date_startmonth') - 1) : (!getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') ? 0 : (getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') - 1));
for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) {
$mois_modulo = $mois; // ajout
if ($mois > 12) {
Expand Down
Loading

0 comments on commit 9904e0e

Please sign in to comment.