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 Jan 2, 2025
2 parents ee8863d + cc58d13 commit c1a9c39
Show file tree
Hide file tree
Showing 12 changed files with 159 additions and 146 deletions.
119 changes: 52 additions & 67 deletions dev/tools/phan/baseline.txt

Large diffs are not rendered by default.

17 changes: 9 additions & 8 deletions htdocs/compta/facture/class/facture-rec.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,8 @@ public function update(User $user, $notrigger = 0)
$sql .= " localtax2 = ".((float) $this->total_localtax2).",";
$sql .= " total_ht = ".((float) $this->total_ht).",";
$sql .= " total_ttc = ".((float) $this->total_ttc).",";
$sql .= " fk_societe_rib = ".(!empty($this->fk_societe_rib) ? ((int) $this->fk_societe_rib) : 'NULL');;
$sql .= " fk_societe_rib = ".(!empty($this->fk_societe_rib) ? ((int) $this->fk_societe_rib) : 'NULL');
;
// TODO Add missing fields
$sql .= " WHERE rowid = ".((int) $this->id);

Expand Down Expand Up @@ -1599,13 +1600,13 @@ public function getLibStatut($mode = 0, $alreadypaid = -1)
/**
* Return label of a status
*
* @param int $recur Is it a recurring invoice ?
* @param int $status Id status (suspended or not)
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=long label + picto
* @param integer $alreadypaid Not used for recurring invoices
* @param int $type Type invoice
* @param int $nbofopendirectdebitorcredittransfer Nb of open direct debit or credit transfer
* @return string Label of status
* @param int $recur Is it a recurring invoice ?
* @param int $status Id status (suspended or not)
* @param int<0,6> $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=long label + picto
* @param int $alreadypaid Not used for recurring invoices
* @param int $type Type invoice
* @param int $nbofopendirectdebitorcredittransfer @unused-param Nb of open direct debit or credit transfer
* @return string Label of status
*/
public function LibStatut($recur, $status, $mode = 0, $alreadypaid = -1, $type = 0, $nbofopendirectdebitorcredittransfer = 0)
{
Expand Down
23 changes: 12 additions & 11 deletions htdocs/core/class/commoninvoice.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -493,8 +493,8 @@ public function getIdReplacingInvoice($option = '')
/**
* Return list of open direct debit or credit transfer
*
* @param string $type 'bank-transfer' or 'direct-debit'
* @return array<array{amount:int|float,date:int,num:string,ref:string,ref_ext?:string,fk_bank_line?:int,type:string}> Array with list of payments
* @param 'bank-transfer'|'direct-debit' $type 'bank-transfer' or 'direct-debit'
* @return array<array{id:int,invoiceid:int,date:''|int,amount:float}> Array with list of payments
*/
public function getListOfOpenDirectDebitOrCreditTransfer($type)
{
Expand All @@ -514,17 +514,18 @@ public function getListOfOpenDirectDebitOrCreditTransfer($type)
$sql .= " ORDER BY pfd.date_demande DESC";

$resql = $this->db->query($sql);
$num = 0;
if ($resql) {
$num = $this->db->num_rows($resql);
$i = 0;
while ($i < $num) {
$obj = $this->db->fetch_object($resql);
if ($obj) {
$listofopendirectdebitorcredittransfer[] = array(
'id' => $obj->rowid,
'id' => (int) $obj->rowid,
'invoiceid' => (int) $this->id,
'date' => $this->db->jdate($obj->date_demande),
'amount' => $obj->amount
'amount' => (float) $obj->amount
);
}

Expand Down Expand Up @@ -909,13 +910,13 @@ public function getLibStatut($mode = 0, $alreadypaid = -1)
/**
* Return label of a status
*
* @param int $paye Status field paye
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=long label + picto
* @param integer $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommend to put here amount paid if you have it, -1 otherwise)
* @param int $type Type invoice. If -1, we use $this->type
* @param int $nbofopendirectdebitorcredittransfer Nb of open direct debit or credit transfer
* @return string Label of status
* @param int $paye Status field paye (or $recur)
* @param int $status Id status
* @param int<0,6> $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=long label + picto
* @param int $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommend to put here amount paid if you have it, -1 otherwise)
* @param int $type Type invoice. If -1, we use $this->type
* @param int $nbofopendirectdebitorcredittransfer Nb of open direct debit or credit transfer
* @return string Label of status
*/
public function LibStatut($paye, $status, $mode = 0, $alreadypaid = -1, $type = -1, $nbofopendirectdebitorcredittransfer = 0)
{
Expand Down
26 changes: 14 additions & 12 deletions htdocs/core/class/html.form.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -737,17 +737,17 @@ public function textwithtooltip($text, $htmltext, $tooltipon = 1, $direction = 0
* Show a text with a picto and a tooltip on picto
*
* @param string $text Text to show
* @param string $htmltext Content of tooltip
* @param int $direction 1=Icon is after text, -1=Icon is before text, 0=no icon
* @param string $htmltooltip Content of tooltip
* @param int<-1,1> $direction 1=Icon is after text, -1=Icon is before text, 0=no icon
* @param string $type Type of picto ('info', 'infoclickable', 'help', 'helpclickable', 'warning', 'superadmin', 'mypicto@mymodule', ...) or image filepath or 'none'
* @param string $extracss Add a CSS style to td, div or span tag
* @param int $noencodehtmltext Do not encode into html entity the htmltext
* @param int $notabs 0=Include table and tr tags, 1=Do not include table and tr tags, 2=use div, 3=use span
* @param int<0,1> $noencodehtmltext Do not encode into html entity the htmltext
* @param int<0,3> $notabs 0=Include table and tr tags, 1=Do not include table and tr tags, 2=use div, 3=use span
* @param string $tooltiptrigger ''=Tooltip on hover and hidden on smartphone, 'abconsmartphone'=Tooltip on hover and on click on smartphone, 'abc'=Tooltip on click (abc is a unique key, clickable link is on image or on link if param $type='none' or on both if $type='xxxclickable')
* @param int $forcenowrap Force no wrap between text and picto (works with notabs=2 only)
* @param int<0,1> $forcenowrap Force no wrap between text and picto (works with notabs=2 only)
* @return string HTML code of text, picto, tooltip
*/
public function textwithpicto($text, $htmltext, $direction = 1, $type = 'help', $extracss = 'valignmiddle', $noencodehtmltext = 0, $notabs = 3, $tooltiptrigger = '', $forcenowrap = 0)
public function textwithpicto($text, $htmltooltip, $direction = 1, $type = 'help', $extracss = 'valignmiddle', $noencodehtmltext = 0, $notabs = 3, $tooltiptrigger = '', $forcenowrap = 0)
{
global $conf, $langs;

Expand All @@ -773,8 +773,8 @@ public function textwithpicto($text, $htmltext, $direction = 1, $type = 'help',
if ($type == 'info' || $type == 'infoclickable' || $type == 'help' || $type == 'helpclickable') {
return $text;
} else {
$alt = $htmltext;
$htmltext = '';
$alt = $htmltooltip;
$htmltooltip = '';
}
}

Expand Down Expand Up @@ -810,7 +810,7 @@ public function textwithpicto($text, $htmltext, $direction = 1, $type = 'help',
$img = img_picto($alt, $type); // $type can be an image path
}

return $this->textwithtooltip($text, $htmltext, ((($tooltiptrigger && !$img) || strpos($type, 'clickable')) ? 3 : 2), $direction, $img, $extracss, $notabs, '', $noencodehtmltext, $tooltiptrigger, $forcenowrap);
return $this->textwithtooltip($text, $htmltooltip, ((($tooltiptrigger && !$img) || strpos($type, 'clickable')) ? 3 : 2), $direction, $img, $extracss, $notabs, '', $noencodehtmltext, $tooltiptrigger, $forcenowrap);
}

/**
Expand Down Expand Up @@ -5275,7 +5275,7 @@ public function selectRib($selected = '', $htmlname = 'ribcompanyid', $filtre =

$sql = "SELECT rowid, label, bank, status, iban_prefix, bic";
$sql .= " FROM " . $this->db->prefix() . "societe_rib";
$sql.= " WHERE type = 'ban'";
$sql .= " WHERE type = 'ban'";
if ($filtre) { // TODO Support USF
$sql .= " AND " . $filtre;
}
Expand Down Expand Up @@ -5469,7 +5469,9 @@ public function formRib($page, $selected = '', $htmlname = 'ribcompanyid', $filt
$result = $bankstatic->fetch($selected);
if ($result) {
print $bankstatic->label;
if ($showibanbic) print ' (' . $bankstatic->iban . '/' .$bankstatic->bic. ')';
if ($showibanbic) {
print ' (' . $bankstatic->iban . '/' .$bankstatic->bic. ')';
}
}
} else {
print "&nbsp;";
Expand Down Expand Up @@ -8769,7 +8771,7 @@ public function selectForFormsList($objecttmp, $htmlname, $preselectedvalue, $sh
}
$splittedfieldstoshow = explode(',', $fieldstoshow);
foreach ($splittedfieldstoshow as &$field2) {
if (is_numeric($pos=strpos($field2, ' '))) {
if (is_numeric($pos = strpos($field2, ' '))) {
$field2 = substr($field2, 0, $pos);
}
}
Expand Down
14 changes: 7 additions & 7 deletions htdocs/fourn/class/fournisseur.facture-rec.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1595,13 +1595,13 @@ public function getLibStatut($mode = 0, $alreadypaid = -1)
/**
* Return label of a status
*
* @param int $recur Is it a recurring invoice ?
* @param int $status Id status (suspended or not)
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=long label + picto
* @param integer $alreadypaid Not used for recurring invoices
* @param int $type Type invoice
* @param int $nbofopendirectdebitorcredittransfer Nb of open direct debit or credit transfer
* @return string Label of status
* @param int $recur Is it a recurring invoice ?
* @param int $status Id status (suspended or not)
* @param int<0,6> $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=long label + picto
* @param int $alreadypaid Not used for recurring invoices
* @param int $type Type invoice
* @param int $nbofopendirectdebitorcredittransfer @unused-param Nb of open direct debit or credit transfer
* @return string Label of status
*/
public function LibStatut($recur, $status, $mode = 0, $alreadypaid = -1, $type = 0, $nbofopendirectdebitorcredittransfer = 0)
{
Expand Down
2 changes: 1 addition & 1 deletion htdocs/fourn/facture/card.php
Original file line number Diff line number Diff line change
Expand Up @@ -4067,7 +4067,7 @@ function setRadioForTypeOfInvoice() {

// Validate
if ($action != 'confirm_edit' && $object->status == FactureFournisseur::STATUS_DRAFT && count($object->lines) > 0
&& ((($object->type == FactureFournisseur::TYPE_STANDARD || $object->type == FactureFournisseur::TYPE_REPLACEMENT || $object->type == FactureFournisseur::TYPE_DEPOSIT || $object->type == FactureFournisseur::TYPE_PROFORMA || $object->type == FactureFournisseur::TYPE_SITUATION) && (getDolGlobalString('SUPPLIER_INVOICE_ENABLE_NEGATIVE') || $object->total_ttc >= 0))
&& ((($object->type == FactureFournisseur::TYPE_STANDARD || $object->type == FactureFournisseur::TYPE_REPLACEMENT || $object->type == FactureFournisseur::TYPE_DEPOSIT || $object->type == FactureFournisseur::TYPE_PROFORMA || $object->type == FactureFournisseur::TYPE_SITUATION) && (getDolGlobalString('SUPPLIER_INVOICE_ENABLE_NEGATIVE') || $object->total_ttc >= 0)) // @phan-suppress-current-line PhanDeprecatedClassConstant
|| ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE && $object->total_ttc <= 0))) {
if (count($object->lines)) {

Check failure on line 4072 in htdocs/fourn/facture/card.php

View workflow job for this annotation

GitHub Actions / phpstan / php-stan (8.2)

If condition is always true.
if ($usercanvalidate) {
Expand Down
14 changes: 7 additions & 7 deletions htdocs/mrp/mo_production.php
Original file line number Diff line number Diff line change
Expand Up @@ -944,24 +944,24 @@
print '<tr class="liste_titre">';
// Product
print '<td>';
print $form->select_produits('', 'productidtoadd', '', 0, 0, -1, 2, '', 1, array(), 0, '1', 0, 'maxwidth150');
print $form->select_produits(0, 'productidtoadd', '', 0, 0, -1, 2, '', 1, array(), 0, '1', 0, 'maxwidth150');
print '</td>';
// Qty
print '<td class="right"><input type="text" name="qtytoadd" value="1" class="width40 right"></td>';
// Unit
print '<td>';
if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
//...
}
//if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
//...
//}
print '</td>';
// Cost price
if ($permissiontoupdatecost && getDolGlobalString('MRP_SHOW_COST_FOR_CONSUMPTION')) {
print '<td></td>';
}

$colspan="3";
$colspan = 3;
if (isModEnabled('stock')) {
$colspan++;;
$colspan++;
}
if (isModEnabled('productbatch')) {
$colspan++;
Expand Down Expand Up @@ -1598,7 +1598,7 @@

// Product
print '<td>';
print $form->select_produits('', 'productidtoadd', '', 0, 0, -1, 2, '', 1, array(), 0, '1', 0, 'maxwidth300');
print $form->select_produits(0, 'productidtoadd', '', 0, 0, -1, 2, '', 1, array(), 0, '1', 0, 'maxwidth300');
print '</td>';
// Qty
print '<td class="right"><input type="text" name="qtytoadd" value="1" class="width50 right"></td>';
Expand Down
10 changes: 6 additions & 4 deletions htdocs/projet/activity/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,16 @@
$morehtml .= '<input type="submit" class="button smallpaddingimp" name="refresh" value="'.$langs->trans("Refresh").'">';

if ($mine) {
$tooltiphelp = $langs->trans("MyTasksDesc");
$htmltooltip = $langs->trans("MyTasksDesc");
} else {
if ($user->hasRight('projet', 'all', 'lire') && !$socid) {
$tooltiphelp = $langs->trans("TasksDesc");
$htmltooltip = $langs->trans("TasksDesc");
} else {
$tooltiphelp = $langs->trans("TasksPublicDesc");
$htmltooltip = $langs->trans("TasksPublicDesc");
}
}

print_barre_liste($form->textwithpicto($title, $tooltiphelp), 0, $_SERVER["PHP_SELF"], '', '', '', '', 0, -1, 'projecttask', 0, $morehtml);
print_barre_liste($form->textwithpicto($title, $htmltooltip), 0, $_SERVER["PHP_SELF"], '', '', '', '', 0, -1, 'projecttask', 0, $morehtml);

print '<div class="fichecenter"><div class="fichethirdleft">';

Expand Down Expand Up @@ -518,6 +518,7 @@
$taskstatic->dateo = $db->jdate($obj->date_start);
$taskstatic->datee = $db->jdate($obj->date_end);

/* username and userstatic not used + not defined
$username = '';
if ($obj->userid && $userstatic->id != $obj->userid) { // We have a user and it is not last loaded user
$result = $userstatic->fetch($obj->userid);
Expand All @@ -528,6 +529,7 @@
if ($userstatic->id) {
$username = $userstatic->getNomUrl(0, 0);
}
*/

print '<tr class="oddeven">';
//print '<td>'.$username.'</td>';
Expand Down
27 changes: 22 additions & 5 deletions htdocs/projet/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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 @@ -138,21 +139,37 @@
$morehtml .= '</form>';

if ($mine) {
$tooltiphelp = $langs->trans("MyProjectsDesc");
$htmltooltip = $langs->trans("MyProjectsDesc");
} else {
if ($user->hasRight('projet', 'all', 'lire') && !$socid) {
$tooltiphelp = $langs->trans("ProjectsDesc");
$htmltooltip = $langs->trans("ProjectsDesc");
} else {
$tooltiphelp = $langs->trans("ProjectsPublicDesc");
$htmltooltip = $langs->trans("ProjectsPublicDesc");
}
}

print_barre_liste($form->textwithpicto($title, $tooltiphelp), 0, $_SERVER["PHP_SELF"], '', '', '', '', 0, -1, 'project', 0, $morehtml);
print_barre_liste($form->textwithpicto($title, $htmltooltip), 0, $_SERVER["PHP_SELF"], '', '', '', '', 0, -1, 'project', 0, $morehtml);


// Get list of ponderated percent and colors for each status
include DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
$listofoppstatus = array(); $listofopplabel = array(); $listofoppcode = array(); $colorseries = array();
// Available from theme_vars:
'
@phan-var-force string $badgeStatus0
@phan-var-force string $badgeStatus1
@phan-var-force string $badgeStatus2
@phan-var-force string $badgeStatus3
@phan-var-force string $badgeStatus4
@phan-var-force string $badgeStatus5
@phan-var-force string $badgeStatus6
@phan-var-force string $badgeStatus7
@phan-var-force string $badgeStatus8
@phan-var-force string $badgeStatus9
';
$listofoppstatus = array();
$listofopplabel = array();
$listofoppcode = array();
$colorseries = array();
$sql = "SELECT cls.rowid, cls.code, cls.percent, cls.label";
$sql .= " FROM ".MAIN_DB_PREFIX."c_lead_status as cls";
$sql .= " WHERE active=1";
Expand Down
25 changes: 14 additions & 11 deletions htdocs/projet/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@
$searchCategoryCustomerOperator = getDolGlobalString('MAIN_SEARCH_CAT_OR_BY_DEFAULT');
}
$searchCategoryCustomerList = GETPOST('search_category_customer_list', 'array');
$search_omitChildren = 0;
if (getDolGlobalInt('PROJECT_ENABLE_SUB_PROJECT')) {
$search_omitChildren = GETPOST('search_omitChildren', 'alpha') == 'on' ? 1 : 0;
}
Expand Down Expand Up @@ -264,10 +265,10 @@
$arrayfields['opp_weighted_amount'] = array('label' => 'OpportunityWeightedAmountShort', 'checked' => 0, 'enabled' => (!getDolGlobalString('PROJECT_USE_OPPORTUNITIES') ? 0 : 1), 'position' => 106);
$arrayfields['u.login'] = array('label' => "Author", 'checked' => -1, 'position' => 165);
// Force some fields according to search_usage filter...
if (GETPOST('search_usage_opportunity')) {
//$arrayfields['p.usage_opportunity']['visible'] = 1; // Not require, filter on search_opp_status is enough
//$arrayfields['p.usage_opportunity']['checked'] = 1; // Not require, filter on search_opp_status is enough
}
//if (GETPOST('search_usage_opportunity')) {
//$arrayfields['p.usage_opportunity']['visible'] = 1; // Not required, filter on search_opp_status is enough
//$arrayfields['p.usage_opportunity']['checked'] = 1; // Not required, filter on search_opp_status is enough
//}
if (GETPOST('search_usage_event_organization')) {
$arrayfields['p.fk_opp_status']['enabled'] = 0;
$arrayfields['p.opp_amount']['enabled'] = 0;
Expand All @@ -293,8 +294,8 @@
// TODO Move this into a inc file
$groupbyvalues = array();
$groupofcollpasedvalues = array();
$groupbyold = null;
if ($mode == 'kanban' && $groupby) {
$groupbyold = null;
$groupbyfield = preg_replace('/[a-z]\./', '', $groupby);
if (!empty($object->fields[$groupbyfield]['alias'])) {
$groupbyfield = $object->fields[$groupbyfield]['alias'];
Expand Down Expand Up @@ -1165,18 +1166,18 @@
print '<input type="hidden" name="groupby" value="'.$groupby.'">';

// Show description of content
$texthelp = '';
$htmltooltip = '';
if ($search_project_user == $user->id) {
$texthelp .= $langs->trans("MyProjectsDesc");
$htmltooltip .= $langs->trans("MyProjectsDesc");
} else {
if ($user->hasRight('projet', 'all', 'lire') && !$socid) {
$texthelp .= $langs->trans("ProjectsDesc");
$htmltooltip .= $langs->trans("ProjectsDesc");
} else {
$texthelp .= $langs->trans("ProjectsPublicDesc");
$htmltooltip .= $langs->trans("ProjectsPublicDesc");
}
}

print_barre_liste($form->textwithpicto($title, $texthelp), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'project', 0, $newcardbutton, '', $limit, 0, 0, 1);
print_barre_liste($form->textwithpicto($title, $htmltooltip), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'project', 0, $newcardbutton, '', $limit, 0, 0, 1);


$topicmail = "Information";
Expand Down Expand Up @@ -1699,7 +1700,7 @@
if (get_class($c) == 'User') {
$stringassignedusers .= $c->getNomUrl(-2, '', 0, 0, 24, 1, '', 'valignmiddle'.($ifisrt ? '' : ' notfirst'));
} else {
$stringassignedusers .= $c->getNomUrl(-2, '', 0, '', -1, 0, 'valignmiddle'.($ifisrt ? '' : ' notfirst'));
$stringassignedusers .= $c->getNomUrl(-2, '', 0, 0, -1, 0, 'valignmiddle'.($ifisrt ? '' : ' notfirst'));
}
$ifisrt = 0;
}
Expand All @@ -1712,6 +1713,8 @@
print '<tr class="trkanban'.(empty($groupby) ? '' : ' trkanbangroupby').'"><td colspan="'.$savnbfield.'">';
}

$groupbyvalue = 'unset';
$groupbyfield = 'unsetfield';
if (!empty($groupby)) {
if (is_null($groupbyold)) {
print '<div class="box-flex-container-columns kanban">'; // Start div for all kanban columns
Expand Down
Loading

0 comments on commit c1a9c39

Please sign in to comment.