Skip to content

Commit

Permalink
Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into d…
Browse files Browse the repository at this point in the history
…evelop
  • Loading branch information
eldy committed Jul 3, 2024
2 parents 21e4c0e + b0cd32b commit bd3b7a1
Show file tree
Hide file tree
Showing 64 changed files with 456 additions and 227 deletions.
3 changes: 2 additions & 1 deletion htdocs/admin/company.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2017 Rui Strecht <rui.strecht@aliartalentos.com>
* Copyright (C) 2023 Nick Fragoulis
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -92,7 +93,7 @@
activateModulesRequiredByCountry($mysoc->country_code);
}

$tmparray = getState(GETPOSTINT('state_id'), 'all', $db, $langs, 0);
$tmparray = getState(GETPOSTINT('state_id'), 'all', $db, 0, $langs, 0);
if (!empty($tmparray['id'])) {
$mysoc->state_id = $tmparray['id'];
$mysoc->state_code = $tmparray['code'];
Expand Down
3 changes: 2 additions & 1 deletion htdocs/ai/ajax/generate_content.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* Copyright (C) 2012 J. Fernando Lagrange <fernando@demo-tic.org>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2023 Eric Seigne <eric.seigne@cap-rel.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -57,7 +58,7 @@
$jsonData = json_decode($rawData, true);

if (is_null($jsonData)) {
dol_print_error('data with format JSON valide.');
dol_print_error($db, 'data with format JSON valide.');
}
$ai = new Ai($db);

Expand Down
16 changes: 14 additions & 2 deletions htdocs/comm/card.php
Original file line number Diff line number Diff line change
Expand Up @@ -1210,7 +1210,9 @@
// print $formfile->getDocumentsLink($contrat->element, $filename, $filedir);
print $late;
print "</td>\n";
print '<td class="nowrap">'.dol_trunc($objp->refsup, 12)."</td>\n";
print '<td class="nowrap">';
print dol_trunc(strtolower(get_class($object)) == strtolower(Client::class) ? $objp->refcus : $objp->refsup, 12);
print "</td>\n";
//print '<td class="right" width="80px"><span title="'.$langs->trans("DateCreation").'">'.dol_print_date($db->jdate($objp->dc), 'day')."</span></td>\n";
print '<td class="right" width="80px"><span title="'.$langs->trans("DateContract").'">'.dol_print_date($db->jdate($objp->dcon), 'day')."</span></td>\n";
print '<td width="20">&nbsp;</td>';
Expand Down Expand Up @@ -1422,7 +1424,7 @@
* Latest invoices
*/
if (isModEnabled('invoice') && $user->hasRight('facture', 'lire')) {
$sql = 'SELECT f.rowid as facid, f.ref, f.type';
$sql = 'SELECT f.rowid as facid, f.ref, f.type, f.ref_client';
$sql .= ', f.total_ht';
$sql .= ', f.total_tva';
$sql .= ', f.total_ttc';
Expand Down Expand Up @@ -1452,6 +1454,9 @@
if (getDolGlobalString('MAIN_SHOW_PRICE_WITH_TAX_IN_SUMMARIES')) {
$colspan++;
}
if (getDolGlobalString('MAIN_SHOW_REF_CUSTOMER_INVOICES')) {
$colspan++;
}
print '<td colspan="'.$colspan.'">';
print '<table class="centpercent nobordernopadding"><tr><td>'.$langs->trans("LastCustomersBills", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->id.'"><span class="hideonsmartphone">'.$langs->trans("AllBills").'</span><span class="badge marginleftonlyshort">'.$num.'</span></a></td>';
print '<td width="20px" class="right"><a href="'.DOL_URL_ROOT.'/compta/facture/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"), 'stats').'</a></td>';
Expand All @@ -1466,6 +1471,7 @@

$facturestatic->id = $objp->facid;
$facturestatic->ref = $objp->ref;
$facturestatic->ref_client = $objp->ref_client;
$facturestatic->type = $objp->type;
$facturestatic->total_ht = $objp->total_ht;
$facturestatic->total_tva = $objp->total_tva;
Expand Down Expand Up @@ -1511,6 +1517,11 @@
// $urlsource = '/compta/facture/card.php?id='.$objp->cid;
//print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir);
print '</td>';
if (getDolGlobalString('MAIN_SHOW_REF_CUSTOMER_INVOICES')) {
print '<td class="left nowraponall">';
print $objp->ref_client;
print '</td>';
}
if ($objp->df > 0) {
print '<td width="80px" title="'.dol_escape_htmltag($langs->trans('DateInvoice')).'">'.dol_print_date($db->jdate($objp->df), 'day').'</td>';
} else {
Expand All @@ -1521,6 +1532,7 @@
} else {
print '<td><b>!!!</b></td>';
}

print '<td class="right nowraponall">';
print price($objp->total_ht);
print '</td>';
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 @@ -1136,7 +1136,7 @@ public function create($user, $notrigger = 0)
$this->add_contact($objcontact->fk_socpeople, $objcontact->code, $objcontact->source); // May failed because of duplicate key or because code of contact type does not exists for new object
}
} else {
dol_print_error($resqlcontact);
dol_print_error($this->db, $resqlcontact);
}
}

Expand Down
5 changes: 3 additions & 2 deletions htdocs/compta/bank/releve.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* Copyright (C) 2017 Patrick Delcroix <pmpdelcroix@gmail.com>
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -312,7 +313,7 @@

// If not cash account and can be reconciliate
if ($user->hasRight('banque', 'consolidate')) {
$buttonreconcile = '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?action=reconcile&sortfield=b.datev,b.dateo,b.rowid&sortorder=asc,asc,asc&search_conciliated=0&search_account='.$id.$param.'">'.$titletoconciliatemanual.'</a>';
$buttonreconcile = '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?action=reconcile&token='.newToken().'&sortfield=b.datev,b.dateo,b.rowid&sortorder=asc,asc,asc&search_conciliated=0&search_account='.$id.$param.'">'.$titletoconciliatemanual.'</a>';
} else {
$buttonreconcile = '<a class="butActionRefused classfortooltip" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$titletoconciliatemanual.'</a>';
}
Expand All @@ -323,7 +324,7 @@
if ($user->hasRight('banque', 'consolidate')) {
$newparam = $param;
$newparam = preg_replace('/search_conciliated=\d+/i', '', $newparam);
$buttonreconcile .= ' <a class="butAction" style="margin-bottom: 5px !important; margin-top: 5px !important" href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?action=reconcile&sortfield=b.datev,b.dateo,b.rowid&sortorder=asc,asc,asc&search_conciliated=0'.$newparam.'">'.$titletoconciliateauto.'</a>';
$buttonreconcile .= ' <a class="butAction" style="margin-bottom: 5px !important; margin-top: 5px !important" href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?action=reconcile&token='.newToken().'&sortfield=b.datev,b.dateo,b.rowid&sortorder=asc,asc,asc&search_conciliated=0'.$newparam.'">'.$titletoconciliateauto.'</a>';
} else {
$buttonreconcile .= ' <a class="butActionRefused" style="margin-bottom: 5px !important; margin-top: 5px !important" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$titletoconciliateauto.'</a>';
}
Expand Down
2 changes: 1 addition & 1 deletion htdocs/compta/facture/class/facture.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ public function create(User $user, $notrigger = 0, $forceduedate = 0)
$this->add_contact($objcontact->fk_socpeople, $objcontact->code, $objcontact->source); // May failed because of duplicate key or because code of contact type does not exists for new object
}
} else {
dol_print_error($resqlcontact);
dol_print_error($this->db, $resqlcontact);
}
}

Expand Down
14 changes: 7 additions & 7 deletions htdocs/compta/facture/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@
$search_product_category = GETPOST('search_product_category', 'intcomma');
$search_fac_rec_source_title = GETPOST("search_fac_rec_source_title", 'alpha');

$search_late = GETPOST('search_late');
if ($search_late == 'late') {
$search_option = GETPOST('search_option');
if ($search_option == 'late') {
$search_status = '1';
}

Expand Down Expand Up @@ -398,7 +398,7 @@
$toselect = array();
$search_array_options = array();
$search_categ_cus = 0;
$search_late = '';
$search_option = '';
$socid = 0;
}

Expand Down Expand Up @@ -859,7 +859,7 @@
if ($search_datelimit_end) {
$sql .= " AND f.date_lim_reglement <= '".$db->idate($search_datelimit_end)."'";
}
if ($search_late == 'late') {
if ($search_option == 'late') {
$sql .= " AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->client->warning_delay)."'";
}
/*if ($search_sale > 0) {
Expand Down Expand Up @@ -1181,8 +1181,8 @@
if ($show_files) {
$param .= '&show_files='.urlencode((string) ($show_files));
}
if ($search_late) {
$param .= "&search_late=".urlencode($search_late);
if ($search_option) {
$param .= "&search_option=".urlencode($search_option);
}
if ($optioncss != '') {
$param .= '&optioncss='.urlencode($optioncss);
Expand Down Expand Up @@ -1322,7 +1322,7 @@
}
// alert on due date
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= '<label for="search_late">'.$langs->trans('Alert').' </label><input type="checkbox" name="search_late" id="search_late" value="late"'.($search_late == 'late' ? ' checked' : '').'>';
$moreforfilter .= '<label for="search_option">'.$langs->trans('Alert').' </label><input type="checkbox" name="search_option" id="search_option" value="late"'.($search_option == 'late' ? ' checked' : '').'>';
$moreforfilter .= '</div>';

$parameters = array();
Expand Down
26 changes: 13 additions & 13 deletions htdocs/compta/stats/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -487,22 +487,22 @@
//var_dump($annee.' '.$year_end.' '.$mois.' '.$month_end);
if ($annee < $year_end || ($annee == $year_end && $mois <= $month_end)) {
if ($annee_decalage > $minyear && $case <= $casenow) {
if (!empty($cumulative_ht[$caseprev]) && !empty($cumulative_ht[$case])) {
$percent = (round(($cumulative_ht[$case] - $cumulative_ht[$caseprev]) / $cumulative_ht[$caseprev], 4) * 100);
//print "X $cumulative_ht[$case] - $cumulative_ht[$caseprev] - $cumulative_ht[$caseprev] - $percent X";
if (!empty($cumulative[$caseprev]) && !empty($cumulative[$case])) {
$percent = (round(($cumulative[$case] - $cumulative[$caseprev]) / $cumulative[$caseprev], 4) * 100);
//print "X $cumulative[$case] - $cumulative[$caseprev] - $cumulative[$caseprev] - $percent X";
print($percent >= 0 ? "+$percent" : "$percent").'%';
}
if (!empty($cumulative_ht[$caseprev]) && empty($cumulative_ht[$case])) {
if (!empty($cumulative[$caseprev]) && empty($cumulative[$case])) {
print '-100%';
}
if (empty($cumulative_ht[$caseprev]) && !empty($cumulative_ht[$case])) {
if (empty($cumulative[$caseprev]) && !empty($cumulative[$case])) {
//print '<td class="right">+Inf%</td>';
print '-';
}
if (isset($cumulative_ht[$caseprev]) && empty($cumulative_ht[$caseprev]) && empty($cumulative_ht[$case])) {
if (isset($cumulative[$caseprev]) && empty($cumulative[$caseprev]) && empty($cumulative[$case])) {
print '+0%';
}
if (!isset($cumulative_ht[$caseprev]) && empty($cumulative_ht[$case])) {
if (!isset($cumulative[$caseprev]) && empty($cumulative[$case])) {
print '-';
}
} else {
Expand Down Expand Up @@ -627,24 +627,24 @@

// Pourcentage total
if ($annee > $minyear && $annee <= max($nowyear, $maxyear)) {
if (!empty($total_ht[$annee - 1]) && !empty($total_ht[$annee])) {
$percent = (round(($total_ht[$annee] - $total_ht[$annee - 1]) / $total_ht[$annee - 1], 4) * 100);
if (!empty($total[$annee - 1]) && !empty($total[$annee])) {
$percent = (round(($total[$annee] - $total[$annee - 1]) / $total[$annee - 1], 4) * 100);
print '<td class="nowrap borderrightlight right">';
print($percent >= 0 ? "+$percent" : "$percent").'%';
print '</td>';
}
if (!empty($total_ht[$annee - 1]) && empty($total_ht[$annee])) {
if (!empty($total[$annee - 1]) && empty($total[$annee])) {
print '<td class="borderrightlight right">-100%</td>';
}
if (empty($total_ht[$annee - 1]) && !empty($total_ht[$annee])) {
if (empty($total[$annee - 1]) && !empty($total[$annee])) {
print '<td class="borderrightlight right">+'.$langs->trans('Inf').'%</td>';
}
if (empty($total_ht[$annee - 1]) && empty($total_ht[$annee])) {
if (empty($total[$annee - 1]) && empty($total[$annee])) {
print '<td class="borderrightlight right">+0%</td>';
}
} else {
print '<td class="borderrightlight right">';
if (!empty($total_ht[$annee]) || ($minyear <= $annee && $annee <= max($nowyear, $maxyear))) {
if (!empty($total[$annee]) || ($minyear <= $annee && $annee <= max($nowyear, $maxyear))) {
print '-';
} else {
print '&nbsp;';
Expand Down
4 changes: 2 additions & 2 deletions htdocs/contrat/class/contrat.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1135,7 +1135,7 @@ public function create($user)
$this->add_contact($objcontact->fk_socpeople, $objcontact->code, $objcontact->source); // May failed because of duplicate key or because code of contact type does not exists for new object
}
} else {
dol_print_error($resqlcontact);
dol_print_error($this->db, $resqlcontact);
}
}
}
Expand Down Expand Up @@ -1731,7 +1731,7 @@ public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_star
$localtaxes_type = getLocalTaxesFromRate($tvatx, 0, $this->societe, $mysoc);
$tvatx = preg_replace('/\s*\(.*\)/', '', $tvatx); // Remove code into vatrate.

$tabprice = calcul_price_total($qty, $pu, $remise_percent, $tvatx, $localtax1tx, $localtax2tx, 0, $price_base_type, $info_bits, 1, $mysoc, $localtaxes_type);
$tabprice = calcul_price_total($qty, $pu, $remise_percent, (float) price2num($tvatx), $localtax1tx, $localtax2tx, 0, $price_base_type, $info_bits, 1, $mysoc, $localtaxes_type);
$total_ht = $tabprice[0];
$total_tva = $tabprice[1];
$total_ttc = $tabprice[2];
Expand Down
2 changes: 1 addition & 1 deletion htdocs/contrat/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -1203,7 +1203,7 @@
}
// Zip
if (!empty($arrayfields['s.zip']['checked'])) {
print '<td class="nocellnopadd">';
print '<td class="center nocellnopadd">';
print $obj->zip;
print '</td>';
if (!$i) {
Expand Down
6 changes: 3 additions & 3 deletions htdocs/core/class/commondocgenerator.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ public function get_substitutionarray_mysoc($mysoc, $outputlangs)
$mysoc->country = $outputlangs->transnoentitiesnoconv("Country".$mysoc->country_code);
}
if (empty($mysoc->state) && !empty($mysoc->state_code)) {
$mysoc->state = getState($mysoc->state_code, 0);
$mysoc->state = getState($mysoc->state_code, '0');
}

$logotouse = $conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small;
Expand Down Expand Up @@ -365,7 +365,7 @@ public function get_substitutionarray_thirdparty($object, $outputlangs, $array_k
$object->country = $outputlangs->transnoentitiesnoconv("Country".$object->country_code);
}
if (empty($object->state) && !empty($object->state_code)) {
$object->state = getState($object->state_code, 0);
$object->state = getState($object->state_code, '0');
}

$array_thirdparty = array(
Expand Down Expand Up @@ -431,7 +431,7 @@ public function get_substitutionarray_contact($object, $outputlangs, $array_key
$object->country = $outputlangs->transnoentitiesnoconv("Country".$object->country_code);
}
if (empty($object->state) && !empty($object->state_code)) {
$object->state = getState($object->state_code, 0);
$object->state = getState($object->state_code, '0');
}

$array_contact = array(
Expand Down
4 changes: 2 additions & 2 deletions htdocs/core/class/html.formprojet.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,7 @@ public function selectInvoiceAndLine($selectedInvoiceId = 0, $selectedLineId = 0
}
$out .= '</select>';
} else {
dol_print_error($this->db->lasterror);
dol_print_error($this->db, $this->db->lasterror);
return '';
}
}
Expand Down Expand Up @@ -929,7 +929,7 @@ public function selectInvoiceAndLine($selectedInvoiceId = 0, $selectedLineId = 0
$out .= '</select>';
}
} else {
dol_print_error($this->db->lasterror);
dol_print_error($this->db, $this->db->lasterror);
return '';
}

Expand Down
5 changes: 3 additions & 2 deletions htdocs/core/class/rssparser.class.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2011-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -290,9 +291,9 @@ public function parser($urlRSS, $maxNb = 0, $cachedelay = 60, $cachedir = '')

xml_set_object($xmlparser, $this);
// @phan-suppress-next-line PhanUndeclaredFunctionInCallable
xml_set_element_handler($xmlparser, 'feed_start_element', 'feed_end_element');
xml_set_element_handler($xmlparser, 'feed_start_element', 'feed_end_element'); // @phpstan-ignore-line
// @phan-suppress-next-line PhanUndeclaredFunctionInCallable
xml_set_character_data_handler($xmlparser, 'feed_cdata');
xml_set_character_data_handler($xmlparser, 'feed_cdata'); // @phpstan-ignore-line

$status = xml_parse($xmlparser, $str, false);

Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/lib/functions.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -2659,7 +2659,7 @@ function dol_get_fiche_end($notab = 0)
* @param CommonObject $object Object to show
* @param string $paramid Name of parameter to use to name the id into the URL next/previous link
* @param string $morehtml More html content to output just before the nav bar
* @param int $shownav Show Condition (navigation is shown if value is 1)
* @param int|bool $shownav Show Condition (navigation is shown if value is 1 or true)
* @param string $fieldid Name of the field in DB to use to select next et previous (we make the select max and min on this field). Use 'none' for no prev/next search.
* @param string $fieldref Name of the field (object->ref) to use to select next et previous
* @param string $morehtmlref More html to show after the ref (see $morehtmlleft for before)
Expand Down
Loading

0 comments on commit bd3b7a1

Please sign in to comment.