diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index d6085a40913fc..1dbbfa4dbe434 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -8250,6 +8250,18 @@ parameters: count: 1 path: ../../htdocs/compta/tva/clients.php + - + message: '#^Expression "''…" on a separate line does not do anything\.$#' + identifier: expr.resultUnused + count: 1 + path: ../../htdocs/compta/tva/clients.php + + - + message: '#^Expression "''…" on a separate line does not do anything\.$#' + identifier: expr.resultUnused + count: 1 + path: ../../htdocs/compta/tva/index.php + - message: '#^Strict comparison using \=\=\= between true and true will always evaluate to true\.$#' identifier: identical.alwaysTrue diff --git a/dev/tools/phan/baseline.txt b/dev/tools/phan/baseline.txt index a9d07010f5137..3ddb23b6f7cbb 100644 --- a/dev/tools/phan/baseline.txt +++ b/dev/tools/phan/baseline.txt @@ -10,9 +10,9 @@ return [ // # Issue statistics: // PhanUndeclaredProperty : 560+ occurrences - // PhanPossiblyUndeclaredGlobalVariable : 490+ occurrences - // PhanUndeclaredGlobalVariable : 350+ occurrences - // PhanTypeMismatchArgumentProbablyReal : 260+ occurrences + // PhanPossiblyUndeclaredGlobalVariable : 460+ occurrences + // PhanUndeclaredGlobalVariable : 320+ occurrences + // PhanTypeMismatchArgumentProbablyReal : 250+ occurrences // PhanPluginUnknownArrayMethodReturnType : 180+ occurrences // PhanTypeMismatchProperty : 140+ occurrences // PhanPluginUnknownPropertyType : 130+ occurrences @@ -22,8 +22,8 @@ return [ // PhanRedefineFunction : 45+ occurrences // PhanTypeExpectedObjectPropAccess : 45+ occurrences // PhanTypeMismatchArgumentNullableInternal : 40+ occurrences - // PhanTypeInvalidDimOffset : 35+ occurrences // PhanPluginEmptyStatementIf : 30+ occurrences + // PhanTypeInvalidDimOffset : 30+ occurrences // PhanTypeMismatchDimFetch : 30+ occurrences // PhanUndeclaredConstant : 15+ occurrences // PhanEmptyForeach : 10+ occurrences @@ -115,15 +115,10 @@ return [ 'htdocs/compta/facture/class/api_invoices.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeComparisonFromArray', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/compta/facture/class/facture-rec.class.php' => ['PhanUndeclaredProperty'], 'htdocs/compta/facture/class/facture.class.php' => ['PhanUndeclaredProperty'], - 'htdocs/compta/facture/note.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/compta/facture/prelevement.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/compta/facture/stats/index.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/compta/facture/tpl/linkedobjectblock.tpl.php' => ['PhanEmptyFQSENInClasslike', 'PhanInvalidFQSENInClasslike', 'PhanTypeMismatchArgumentNullableInternal'], 'htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php' => ['PhanUndeclaredProperty'], - 'htdocs/compta/journal/purchasesjournal.php' => ['PhanPossiblyUndeclaredGlobalVariable'], - 'htdocs/compta/journal/sellsjournal.php' => ['PhanPossiblyUndeclaredGlobalVariable'], - 'htdocs/compta/localtax/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], - 'htdocs/compta/localtax/clients.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredGlobalVariable'], + 'htdocs/compta/localtax/card.php' => ['PhanUndeclaredGlobalVariable'], + 'htdocs/compta/localtax/clients.php' => ['PhanTypeExpectedObjectPropAccess'], 'htdocs/compta/localtax/index.php' => ['PhanRedefineFunction'], 'htdocs/compta/localtax/list.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/compta/paiement.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchDimFetch'], @@ -140,7 +135,6 @@ return [ 'htdocs/compta/prelevement/line.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/prelevement/orders_list.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/compta/prelevement/stats.php' => ['PhanPossiblyUndeclaredGlobalVariable'], - 'htdocs/compta/resultat/clientfourn.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/resultat/index.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/resultat/result.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/sociales/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredProperty'], @@ -156,13 +150,11 @@ return [ 'htdocs/compta/stats/supplier_turnover_by_thirdparty.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/tva/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal'], 'htdocs/compta/tva/class/paymentvat.class.php' => ['PhanUndeclaredProperty'], - 'htdocs/compta/tva/clients.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeArraySuspiciousNull', 'PhanTypeInvalidDimOffset', 'PhanTypeMismatchDimFetchNullable', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'], - 'htdocs/compta/tva/index.php' => ['PhanRedefineFunction', 'PhanUndeclaredGlobalVariable'], + 'htdocs/compta/tva/clients.php' => ['PhanTypeArraySuspiciousNull', 'PhanTypeInvalidDimOffset', 'PhanTypeMismatchProperty'], 'htdocs/compta/tva/payments.php' => ['PhanTypeMismatchArgumentNullableInternal'], 'htdocs/compta/tva/quadri_detail.php' => ['PhanTypeArraySuspiciousNull', 'PhanTypeInvalidDimOffset', 'PhanTypeMismatchProperty'], 'htdocs/contact/card.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/contact/consumption.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/contact/list.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/contact/perso.php' => ['PhanTypeMismatchProperty'], 'htdocs/contrat/agenda.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/contrat/card.php' => ['PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'], @@ -549,7 +541,6 @@ return [ 'htdocs/public/recruitment/view.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/public/stripe/ipn.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/public/test/test_arrays.php' => ['PhanPluginUndeclaredVariableIsset'], - 'htdocs/public/test/test_forms.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/public/ticket/create_ticket.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchDimFetchNullable', 'PhanTypeMismatchProperty'], 'htdocs/public/ticket/view.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/public/webportal/tpl/menu.tpl.php' => ['PhanUndeclaredProperty'], @@ -634,7 +625,6 @@ return [ 'htdocs/user/class/api_users.class.php' => ['PhanTypeMismatchProperty'], 'htdocs/user/class/user.class.php' => ['PhanUndeclaredProperty'], 'htdocs/user/class/usergroup.class.php' => ['PhanUndeclaredProperty'], - 'htdocs/user/param_ihm.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/variants/ajax/get_attribute_values.php' => ['PhanTypeComparisonFromArray'], 'htdocs/variants/class/ProductCombination.class.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/variants/combinations.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchProperty'], diff --git a/htdocs/compta/facture/note.php b/htdocs/compta/facture/note.php index 68550e0422d88..f7defd3217085 100644 --- a/htdocs/compta/facture/note.php +++ b/htdocs/compta/facture/note.php @@ -5,6 +5,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2017 Ferran Marcet * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * 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 @@ -54,7 +55,7 @@ $object = new Facture($db); // Load object if ($id > 0 || !empty($ref)) { - $object->fetch($id, $ref, '', '', (getDolGlobalString('INVOICE_USE_SITUATION') ? $conf->global->INVOICE_USE_SITUATION : 0)); + $object->fetch($id, $ref, '', 0, (getDolGlobalString('INVOICE_USE_SITUATION') ? $conf->global->INVOICE_USE_SITUATION : 0)); } $permissionnote = $user->hasRight('facture', 'creer'); // Used by the include of actions_setnotes.inc.php diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 69b68a1695d42..29d6488f4ab5d 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -75,6 +75,7 @@ } // Load object +$isdraft = 1; if ($id > 0 || !empty($ref)) { $ret = $object->fetch($id, $ref); $isdraft = (($object->status == FactureFournisseur::STATUS_DRAFT) ? 1 : 0); @@ -310,8 +311,8 @@ $filtercreditnote = "fk_invoice_supplier_source IS NOT NULL AND (description NOT LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS PAID)%')"; } - $absolute_discount = $object->thirdparty->getAvailableDiscounts('', $filterabsolutediscount, 0, 1); - $absolute_creditnote = $object->thirdparty->getAvailableDiscounts('', $filtercreditnote, 0, 1); + $absolute_discount = $object->thirdparty->getAvailableDiscounts(null, $filterabsolutediscount, 0, 1); + $absolute_creditnote = $object->thirdparty->getAvailableDiscounts(null, $filtercreditnote, 0, 1); $absolute_discount = price2num($absolute_discount, 'MT'); $absolute_creditnote = price2num($absolute_creditnote, 'MT'); } else { @@ -323,8 +324,8 @@ $filtercreditnote = "fk_facture_source IS NOT NULL AND (description NOT LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS RECEIVED)%')"; } - $absolute_discount = $object->thirdparty->getAvailableDiscounts('', $filterabsolutediscount); - $absolute_creditnote = $object->thirdparty->getAvailableDiscounts('', $filtercreditnote); + $absolute_discount = $object->thirdparty->getAvailableDiscounts(null, $filterabsolutediscount); + $absolute_creditnote = $object->thirdparty->getAvailableDiscounts(null, $filtercreditnote); $absolute_discount = price2num($absolute_discount, 'MT'); $absolute_creditnote = price2num($absolute_creditnote, 'MT'); } @@ -821,7 +822,7 @@ print img_warning('Error on default bank number for IBAN : '.$langs->trans($companyBankAccount->error)); } } elseif ($numopen || ($type != 'bank-transfer' && $object->mode_reglement_code == 'PRE') || ($type == 'bank-transfer' && $object->mode_reglement_code == 'VIR')) { - print img_warning($langs->trans("NoDefaultIBANFound")); + print img_warning($langs->trans("NoDefaultIBANFound")); } //print ''; diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php index 28ae66bcb5395..8e9c2c9ce8d69 100644 --- a/htdocs/compta/facture/stats/index.php +++ b/htdocs/compta/facture/stats/index.php @@ -142,6 +142,7 @@ //var_dump($data); $filenamenb = $dir."/invoicesnbinyear-".$year.".png"; +$fileurlnb = ''; if ($mode == 'customer') { $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesnbinyear-'.$year.'.png'; } @@ -178,6 +179,7 @@ // $data = array(array('Lib',val1,val2,val3),...) $filenameamount = $dir."/invoicesamountinyear-".$year.".png"; +$fileurlamount = ''; if ($mode == 'customer') { $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesamountinyear-'.$year.'.png'; } @@ -212,6 +214,7 @@ $data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear); +$fileurl_avg = ''; if (!$user->hasRight('societe', 'client', 'voir')) { $filename_avg = $dir.'/ordersaverage-'.$user->id.'-'.$year.'.png'; if ($mode == 'customer') { @@ -318,6 +321,8 @@ // Category if (isModEnabled('category')) { + $cat_type = ''; + $cat_label = ''; if ($mode == 'customer') { $cat_type = Categorie::TYPE_CUSTOMER; $cat_label = $langs->trans("Category").' '.lcfirst($langs->trans("Customer")); @@ -327,7 +332,7 @@ $cat_label = $langs->trans("Category").' '.lcfirst($langs->trans("Supplier")); } print ''.$cat_label.''; - $cate_arbo = $form->select_all_categories($cat_type, null, 'parent', null, null, 1); + $cate_arbo = $form->select_all_categories($cat_type, '', 'parent', 0, 0, 1); print img_picto('', 'category', 'class="pictofixedwidth"'); print $form->multiselectarray('select_categ_categ_id', $cate_arbo, GETPOST('select_categ_categ_id', 'array'), 0, 0, 'widthcentpercentminusx maxwidth300'); //print $formother->select_categories($cat_type, $categ_id, 'categ_id', true); diff --git a/htdocs/compta/journal/purchasesjournal.php b/htdocs/compta/journal/purchasesjournal.php index 1c398bb363354..f7e14b0a4c29b 100644 --- a/htdocs/compta/journal/purchasesjournal.php +++ b/htdocs/compta/journal/purchasesjournal.php @@ -147,6 +147,8 @@ $db->query('SET SQL_BIG_SELECTS=1'); } +$tabfac = array(); + $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); @@ -154,7 +156,6 @@ $cptfour = ((getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER') != "") ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : $langs->trans("CodeNotDef")); $cpttva = (getDolGlobalString('ACCOUNTING_VAT_BUY_ACCOUNT') ? $conf->global->ACCOUNTING_VAT_BUY_ACCOUNT : $langs->trans("CodeNotDef")); - $tabfac = array(); $tabht = array(); $tabtva = array(); $tabttc = array(); diff --git a/htdocs/compta/journal/sellsjournal.php b/htdocs/compta/journal/sellsjournal.php index 82dcf48aa4b09..6b9157e1de29a 100644 --- a/htdocs/compta/journal/sellsjournal.php +++ b/htdocs/compta/journal/sellsjournal.php @@ -161,9 +161,10 @@ $db->query('SET SQL_BIG_SELECTS=1'); } +$tabfac = array(); + $result = $db->query($sql); if ($result) { - $tabfac = array(); $tabht = array(); $tabtva = array(); $tablocaltax1 = array(); diff --git a/htdocs/compta/localtax/card.php b/htdocs/compta/localtax/card.php index 2a88632027b75..5a4077091d530 100644 --- a/htdocs/compta/localtax/card.php +++ b/htdocs/compta/localtax/card.php @@ -2,6 +2,7 @@ /* Copyright (C) 2011-2014 Juanjo Menent * Copyright (C) 2015 Marcos García * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2024 MDW * * 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 @@ -118,6 +119,8 @@ if ($result > 0) { $result = $accountline->delete($user); // $result may be 0 if not found (when bank entry was deleted manually and fk_bank point to nothing) } + } else { + $accountline = null; } if ($result >= 0) { @@ -125,7 +128,7 @@ header("Location: ".DOL_URL_ROOT.'/compta/localtax/list.php?localTaxType='.$object->ltt); exit; } else { - $object->error = $accountline->error; + $object->error = $accountline !== null ? $accountline->error : "No account line / no bank identified found"; $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); } diff --git a/htdocs/compta/localtax/clients.php b/htdocs/compta/localtax/clients.php index 818696545cd05..c4946dafa5dec 100644 --- a/htdocs/compta/localtax/clients.php +++ b/htdocs/compta/localtax/clients.php @@ -57,6 +57,7 @@ } $date_start = dol_mktime(0, 0, 0, GETPOSTINT("date_startmonth"), GETPOSTINT("date_startday"), GETPOSTINT("date_startyear")); $date_end = dol_mktime(23, 59, 59, GETPOSTINT("date_endmonth"), GETPOSTINT("date_endday"), GETPOSTINT("date_endyear")); +$q = 0; // Quarter if (empty($date_start) || empty($date_end)) { // We define date_start and date_end $q = GETPOST("q"); @@ -124,7 +125,12 @@ accessforbidden('Parameter localTaxType is missing'); } +$builddate = dol_now(); $calc = 0; +$calcmode = "Unknown"; +$find = ''; +$replace = ''; +$period = ''; /* * View */ @@ -203,6 +209,9 @@ print '
'; print ''; +$x_coll_sum = 0; // Initialize value +$x_paye_sum = 0; // Initialize value + // IRPF that the customer has retained me if ($calc == 0 || $calc == 2) { print ''; @@ -231,11 +240,11 @@ $total = 0; $totalamount = 0; $i = 1; - foreach ($coll_list as $coll) { - if (($min == 0 || ($min > 0 && $coll->amount > $min)) && ($local == 1 ? $coll->localtax1 : $coll->localtax2) != 0) { - $intra = str_replace($find, $replace, $coll->tva_intra); + foreach ($coll_list as $coll_obj) { + if (($min == 0 || ($min > 0 && $coll_obj->amount > $min)) && ($local == 1 ? $coll_obj->localtax1 : $coll_obj->localtax2) != 0) { + $intra = str_replace($find, $replace, $coll_obj->tva_intra); if (empty($intra)) { - if ($coll->assuj == '1') { + if ($coll_obj->assuj == '1') { $intra = $langs->trans('Unknown'); } else { $intra = ''; @@ -243,16 +252,16 @@ } print ''; print '"; - $company_static->id = $coll->socid; - $company_static->name = $coll->name; + $company_static->id = $coll_obj->socid; + $company_static->name = $coll_obj->name; print ''; $find = array(' ', '.'); $replace = array('', ''); print ''; - print ''; - print ''; - $totalamount += $coll->amount; - $total += ($local == 1 ? $coll->localtax1 : $coll->localtax2); + print ''; + print ''; + $totalamount += $coll_obj->amount; + $total += ($local == 1 ? $coll_obj->localtax1 : $coll_obj->localtax2); print "\n"; $i++; } @@ -296,11 +305,11 @@ $total = 0; $totalamount = 0; $i = 1; - foreach ($coll_list as $coll) { - if (($min == 0 || ($min > 0 && $coll->amount > $min)) && ($local == 1 ? $coll->localtax1 : $coll->localtax2) != 0) { - $intra = str_replace($find, $replace, $coll->tva_intra); + foreach ($coll_list as $coll_obj) { + if (($min == 0 || ($min > 0 && $coll_obj->amount > $min)) && ($local == 1 ? $coll_obj->localtax1 : $coll_obj->localtax2) != 0) { + $intra = str_replace($find, $replace, $coll_obj->tva_intra); if (empty($intra)) { - if ($coll->assuj == '1') { + if ($coll_obj->assuj == '1') { $intra = $langs->trans('Unknown'); } else { $intra = ''; @@ -308,16 +317,16 @@ } print ''; print '"; - $company_static->id = $coll->socid; - $company_static->name = $coll->name; + $company_static->id = $coll_obj->socid; + $company_static->name = $coll_obj->name; print ''; $find = array(' ', '.'); $replace = array('', ''); print '"; - print ''; - print ''; - $totalamount += $coll->amount; - $total += ($local == 1 ? $coll->localtax1 : $coll->localtax2); + print ''; + print ''; + $totalamount += $coll_obj->amount; + $total += ($local == 1 ? $coll_obj->localtax1 : $coll_obj->localtax2); print "\n"; $i++; } diff --git a/htdocs/compta/localtax/index.php b/htdocs/compta/localtax/index.php index a45def867f38e..212055a9612f6 100644 --- a/htdocs/compta/localtax/index.php +++ b/htdocs/compta/localtax/index.php @@ -114,7 +114,7 @@ * @param string $date Date * @return void */ -function pt($db, $sql, $date) +function localtax_pt($db, $sql, $date) { global $conf, $bc, $langs; @@ -600,7 +600,7 @@ function pt($db, $sql, $date) $sql .= " ORDER BY dm ASC, mode ASC"; //print $sql; -pt($db, $sql, $langs->trans("Month")); +localtax_pt($db, $sql, $langs->trans("Month")); print ''; diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 941a3813fe9f9..b6ac6879ea7dc 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -106,10 +106,10 @@ setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } +$paiement_id = 0; if (empty($reshook)) { if (($action == 'add_paiement' || ($action == 'confirm_paiement' && $confirm == 'yes')) && $usercanissuepayment) { $datepaye = dol_mktime(12, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear')); - $paiement_id = 0; $totalpayment = 0; $multicurrency_totalpayment = 0; $atleastonepaymentnotnull = 0; @@ -669,6 +669,7 @@ function callForResult(imgId) $remaintopay = price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits, 'MT'); // Multicurrency Price + $tooltiponmulticurrencyfullamount = ''; if (isModEnabled('multicurrency')) { $multicurrency_payment = $invoice->getSommePaiement(1); $multicurrency_creditnotes = $invoice->getSumCreditNotesUsed(1); @@ -676,15 +677,15 @@ function callForResult(imgId) $multicurrency_alreadypayed = price2num($multicurrency_payment + $multicurrency_creditnotes + $multicurrency_deposits, 'MT'); $multicurrency_remaintopay = price2num($invoice->multicurrency_total_ttc - $multicurrency_payment - $multicurrency_creditnotes - $multicurrency_deposits, 'MT'); // Multicurrency full amount tooltip - $tootltiponmulticurrencyfullamount = $langs->trans('AmountHT') . ": " . price($objp->multicurrency_total_ht, 0, $langs, 0, -1, -1, $objp->multicurrency_code) . "
"; - $tootltiponmulticurrencyfullamount .= $langs->trans('AmountVAT') . ": " . price($objp->multicurrency_total_tva, 0, $langs, 0, -1, -1, $objp->multicurrency_code) . "
"; - $tootltiponmulticurrencyfullamount .= $langs->trans('AmountTTC') . ": " . price($objp->multicurrency_total_ttc, 0, $langs, 0, -1, -1, $objp->multicurrency_code) . "
"; + $tooltiponmulticurrencyfullamount = $langs->trans('AmountHT') . ": " . price($objp->multicurrency_total_ht, 0, $langs, 0, -1, -1, $objp->multicurrency_code) . "
"; + $tooltiponmulticurrencyfullamount .= $langs->trans('AmountVAT') . ": " . price($objp->multicurrency_total_tva, 0, $langs, 0, -1, -1, $objp->multicurrency_code) . "
"; + $tooltiponmulticurrencyfullamount .= $langs->trans('AmountTTC') . ": " . price($objp->multicurrency_total_ttc, 0, $langs, 0, -1, -1, $objp->multicurrency_code) . "
"; } // Full amount tooltip - $tootltiponfullamount = $langs->trans('AmountHT') . ": " . price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency) . "
"; - $tootltiponfullamount .= $langs->trans('AmountVAT') . ": " . price($objp->total_tva, 0, $langs, 0, -1, -1, $conf->currency) . "
"; - $tootltiponfullamount .= $langs->trans('AmountTTC') . ": " . price($objp->total_ttc, 0, $langs, 0, -1, -1, $conf->currency) . "
"; + $tooltiponfullamount = $langs->trans('AmountHT') . ": " . price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency) . "
"; + $tooltiponfullamount .= $langs->trans('AmountVAT') . ": " . price($objp->total_tva, 0, $langs, 0, -1, -1, $conf->currency) . "
"; + $tooltiponfullamount .= $langs->trans('AmountTTC') . ": " . price($objp->total_ttc, 0, $langs, 0, -1, -1, $conf->currency) . "
"; print ''; @@ -721,7 +722,7 @@ function callForResult(imgId) if (isModEnabled('multicurrency')) { print ''; @@ -767,7 +768,7 @@ function callForResult(imgId) } // Full amount - print ''; + print ''; // Received + already paid print ''; print ''; // Landing page @@ -412,7 +414,7 @@ function init_myfunc() print empty($dolibarr_main_demo) ? '' : ' disabled="disabled"'; // Disabled for demo print '> '; print ''."\n"; @@ -554,7 +556,7 @@ function init_myfunc() print ''."\n"; print ''; print ''; print ''; print ''; - print ''; + print ''; // Max size for lists print '';
'.$i."'.$company_static->getNomUrl(1).''.$intra.''.price($coll->amount).''.price($local == 1 ? $coll->localtax1 : $coll->localtax2).''.price($coll_obj->amount).''.price($local == 1 ? $coll_obj->localtax1 : $coll_obj->localtax2).'
'.$i."'.$company_static->getNomUrl(1).''.$intra."'.price($coll->amount).''.price($local == 1 ? $coll->localtax1 : $coll->localtax2).''.price($coll_obj->amount).''.price($local == 1 ? $coll_obj->localtax1 : $coll_obj->localtax2).'
'; if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) { - print '' . price($sign * $objp->multicurrency_total_ttc); + print '' . price($sign * $objp->multicurrency_total_ttc); } print ''.price($sign * $objp->total_ttc).''.price($sign * $objp->total_ttc).''.price($sign * $paiement); diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 4cd75354d10f5..34610f8d98a92 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -10,6 +10,7 @@ * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2020 Maxime DEMAREST * Copyright (C) 2021 Alexandre Spangaro + * Copyright (C) 2024 MDW * * 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 @@ -185,6 +186,10 @@ $total_ht = 0; $total_ttc = 0; +$builddate = ''; +$name = ''; +$period = ''; + // Affiche en-tete de rapport if ($modecompta == "CREANCES-DETTES") { $name = $langs->trans("ReportInOut").', '.$langs->trans("ByPredefinedAccountGroups"); @@ -211,7 +216,7 @@ } elseif ($modecompta == "BOOKKEEPING") { $name = $langs->trans("ReportInOut").', '.$langs->trans("ByPredefinedAccountGroups"); $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); - $arraylist = array('no'=>$langs->trans("CustomerCode"), 'yes'=>$langs->trans("AccountWithNonZeroValues"), 'all'=>$langs->trans("All")); + $arraylist = array('no' => $langs->trans("CustomerCode"), 'yes' => $langs->trans("AccountWithNonZeroValues"), 'all' => $langs->trans("All")); $period .= '     '.$langs->trans("DetailBy").' '.$form->selectarray('showaccountdetail', $arraylist, $showaccountdetail, 0); $periodlink = ($year_start ? "".img_previous()." ".img_next()."" : ""); $description = $langs->trans("RulesResultBookkeepingPredefined"); @@ -238,7 +243,7 @@ $calcmode .= ''; -report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, array('modecompta'=>$modecompta, 'showaccountdetail'=>$showaccountdetail), $calcmode); +report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, array('modecompta' => $modecompta, 'showaccountdetail' => $showaccountdetail), $calcmode); if (isModEnabled('accounting') && $modecompta != 'BOOKKEEPING') { print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, '1'); diff --git a/htdocs/compta/tva/clients.php b/htdocs/compta/tva/clients.php index 0887b7cf2ae05..32cee3b385ceb 100644 --- a/htdocs/compta/tva/clients.php +++ b/htdocs/compta/tva/clients.php @@ -1,11 +1,11 @@ - * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2004-2018 Laurent Destailleur - * Copyright (C) 2006 Yannick Warnier - * Copyright (C) 2014 Ferran Marcet - * Copyright (C) 2018-2024 Frédéric France - * Copyright (C) 2024 MDW +/* Copyright (C) 2001-2003 Rodolphe Quiedeville + * Copyright (C) 2004 Eric Seigne + * Copyright (C) 2004-2018 Laurent Destailleur + * Copyright (C) 2006 Yannick Warnier + * Copyright (C) 2014 Ferran Marcet + * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2024 MDW * * 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 @@ -55,6 +55,17 @@ $langs->loadLangs(array("other", "compta", "banks", "bills", "companies", "product", "trips", "admin")); include DOL_DOCUMENT_ROOT.'/compta/tva/initdatesforvat.inc.php'; +' +@phan-var-force int $date_start +@phan-var-force int $date_end +@phan-var-force string $date_start_month +@phan-var-force string $date_start_year +@phan-var-force string $date_start_day +@phan-var-force string $date_end_month +@phan-var-force string $date_end_year +@phan-var-force string $date_end_day +@phan-var-force int $year_current +'; $min = price2num(GETPOST("min", "alpha")); if (empty($min)) { @@ -258,7 +269,7 @@ $company_static->name = $x_coll[$my_coll_thirdpartyid]['company_name'][$id]; $company_static->name_alias = $x_coll[$my_coll_thirdpartyid]['company_alias'][$id]; $company_static->email = $x_coll[$my_coll_thirdpartyid]['company_email'][$id]; - $company_static->tva_intra = isset($x_coll[$my_coll_thirdpartyid]['tva_intra'][$id]) ? $x_coll[$my_coll_thirdpartyid]['tva_intra'][$id] : '0'; + $company_static->tva_intra = isset($x_coll[$my_coll_thirdpartyid]['tva_intra'][$id]) ? $x_coll[$my_coll_thirdpartyid]['tva_intra'][$id] : '0'; // @phan-suppress-current-line PhanTypeInvalidDimOffset $company_static->client = $x_coll[$my_coll_thirdpartyid]['company_client'][$id]; $company_static->fournisseur = $x_coll[$my_coll_thirdpartyid]['company_fournisseur'][$id]; $company_static->status = $x_coll[$my_coll_thirdpartyid]['company_status'][$id]; @@ -274,8 +285,8 @@ 'pid' => $x_coll[$my_coll_thirdpartyid]['pid'][$id], 'pref' => isset($x_coll[$my_coll_thirdpartyid]['pref'][$id]) ? $x_coll[$my_coll_thirdpartyid]['pref'][$id] : '', 'ptype' => $x_coll[$my_coll_thirdpartyid]['ptype'][$id], - 'pstatus' => isset($x_paye[$my_coll_thirdpartyid]['pstatus'][$id]) ? $x_paye[$my_coll_thirdpartyid]['pstatus'][$id] : '', - 'pstatusbuy' => isset($x_paye[$my_coll_thirdpartyid]['pstatusbuy'][$id]) ? $x_paye[$my_coll_thirdpartyid]['pstatusbuy'][$id] : '', + 'pstatus' => isset($x_paye[$my_coll_thirdpartyid]['pstatus'][$id]) ? $x_paye[$my_coll_thirdpartyid]['pstatus'][$id] : '', // @phan-suppress-current-line PhanTypeInvalidDimOffset + 'pstatusbuy' => isset($x_paye[$my_coll_thirdpartyid]['pstatusbuy'][$id]) ? $x_paye[$my_coll_thirdpartyid]['pstatusbuy'][$id] : '', // @phan-suppress-current-line PhanTypeInvalidDimOffset 'payment_id' => $x_coll[$my_coll_thirdpartyid]['payment_id'][$id], 'payment_ref' => isset($x_coll[$my_coll_thirdpartyid]['payment_ref'][$id]) ? $x_coll[$my_coll_thirdpartyid]['payment_ref'][$id] : '', @@ -331,7 +342,7 @@ 'ftotal_ttc' => price2num($x_paye[$my_paye_thirdpartyid]['ftotal_ttc'][$id]), 'dtotal_ttc' => price2num($x_paye[$my_paye_thirdpartyid]['dtotal_ttc'][$id]), 'dtype' => $x_paye[$my_paye_thirdpartyid]['dtype'][$id], - 'drate' => $x_paye[$my_coll_thirdpartyid]['drate'][$id], + 'drate' => $x_paye[$my_paye_thirdpartyid]['drate'][$id], 'ddate_start' => $x_paye[$my_paye_thirdpartyid]['ddate_start'][$id], 'ddate_end' => $x_paye[$my_paye_thirdpartyid]['ddate_end'][$id], 'totalht' => price2num($x_paye[$my_paye_thirdpartyid]['totalht_list'][$id]), @@ -373,7 +384,7 @@ 'ftotal_ttc' => price2num($x_paye[$my_paye_thirdpartyid]['ftotal_ttc'][$id]), 'dtotal_ttc' => price2num($x_paye[$my_paye_thirdpartyid]['dtotal_ttc'][$id]), 'dtype' => $x_paye[$my_paye_thirdpartyid]['dtype'][$id], - 'drate' => $x_paye[$my_coll_thirdpartyid]['drate'][$id], + 'drate' => $x_paye[$my_paye_thirdpartyid]['drate'][$id], 'datef' => $x_paye[$my_paye_thirdpartyid]['datef'][$id], 'datep' => $x_paye[$my_paye_thirdpartyid]['datep'][$id], diff --git a/htdocs/compta/tva/index.php b/htdocs/compta/tva/index.php index fc4bd35c4f81c..4cce111a0995e 100644 --- a/htdocs/compta/tva/index.php +++ b/htdocs/compta/tva/index.php @@ -57,6 +57,16 @@ $refresh = true; include DOL_DOCUMENT_ROOT.'/compta/tva/initdatesforvat.inc.php'; +' +@phan-var-force int $date_start +@phan-var-force int $date_end +@phan-var-force string $date_start_month +@phan-var-force string $date_start_year +@phan-var-force string $date_start_day +@phan-var-force string $date_end_month +@phan-var-force string $date_end_year +@phan-var-force string $date_end_day +'; // Define modetax (0 or 1) // 0=normal, 1=option vat for services is on debit, 2=option on payments for products diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index e4831263affb5..0d971f01723ff 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -330,7 +330,7 @@ if (!isset($invoice)) { require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $invoice = new Facture($db); - $invoice->fetch(null, "(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")"); + $invoice->fetch(0, "(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")"); $invoice->delete_linked_contact('external', 'BILLING'); } $invoice->add_contact($idcontact, 'BILLING'); ?> diff --git a/htdocs/core/class/commonpeople.class.php b/htdocs/core/class/commonpeople.class.php index 222fe8b542400..8bd31082ba7bb 100644 --- a/htdocs/core/class/commonpeople.class.php +++ b/htdocs/core/class/commonpeople.class.php @@ -128,6 +128,27 @@ public function getFullName($langs, $option = 0, $nameorder = -1, $maxlen = 0) return dol_string_nohtmltag(dol_trunc($ret, $maxlen)); } + + /** + * Return civility label of object + * + * @return string Translated name of civility + */ + public function getCivilityLabel() + { + global $langs; + + $code = (!empty($this->civility_code) ? $this->civility_code : (!empty($this->civility_id) ? $this->civility : (!empty($this->civilite) ? $this->civilite : ''))); + if (empty($code)) { + return ''; + } + + $langs->load("dict"); + return $langs->getLabelFromKey($this->db, "Civility".$code, "c_civility", "code", "label", $code); + } + + + /** * Return full address for banner * diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php index df2897a86cfca..0393580b88f25 100644 --- a/htdocs/user/param_ihm.php +++ b/htdocs/user/param_ihm.php @@ -4,6 +4,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2018 Ferran Marcet * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * 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 @@ -44,6 +45,7 @@ // Defini si peux lire/modifier permissions $canreaduser = ($user->admin || $user->hasRight("user", "user", "read")); +$caneditfield = false; $id = GETPOSTINT('id'); $action = GETPOST('action', 'aZ09'); @@ -97,7 +99,7 @@ * Actions */ -$parameters = array('id'=>$socid); +$parameters = array('id' => $socid); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -220,39 +222,39 @@ // List of possible landing pages $tmparray = array(); -$tmparray['index.php'] = array('label'=>'Dashboard', 'picto'=>'graph'); +$tmparray['index.php'] = array('label' => 'Dashboard', 'picto' => 'graph'); if (isModEnabled("societe")) { - $tmparray['societe/index.php?mainmenu=companies&leftmenu='] = array('label'=>'ThirdPartiesArea', 'picto'=>'company'); + $tmparray['societe/index.php?mainmenu=companies&leftmenu='] = array('label' => 'ThirdPartiesArea', 'picto' => 'company'); } if (isModEnabled('project')) { - $tmparray['projet/index.php?mainmenu=project&leftmenu='] = array('label'=>'ProjectsArea', 'picto'=>'project'); + $tmparray['projet/index.php?mainmenu=project&leftmenu='] = array('label' => 'ProjectsArea', 'picto' => 'project'); if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) { - $tmparray['projet/list.php?mainmenu=project&leftmenu=&search_usage_opportunity=1&search_status=99&search_opp_status=openedopp&contextpage=lead'] = array('label'=>'ListOpenLeads', 'picto'=>'project'); + $tmparray['projet/list.php?mainmenu=project&leftmenu=&search_usage_opportunity=1&search_status=99&search_opp_status=openedopp&contextpage=lead'] = array('label' => 'ListOpenLeads', 'picto' => 'project'); } } if (isModEnabled('holiday') || isModEnabled('expensereport')) { - $tmparray['hrm/index.php?mainmenu=hrm&leftmenu='] = array('label'=>'HRMArea', 'picto'=>'user'); // TODO Complete list with first level of menus + $tmparray['hrm/index.php?mainmenu=hrm&leftmenu='] = array('label' => 'HRMArea', 'picto' => 'user'); // TODO Complete list with first level of menus } if (isModEnabled("product") || isModEnabled("service")) { - $tmparray['product/index.php?mainmenu=products&leftmenu='] = array('label'=>'ProductsAndServicesArea', 'picto'=>'product'); + $tmparray['product/index.php?mainmenu=products&leftmenu='] = array('label' => 'ProductsAndServicesArea', 'picto' => 'product'); } if (isModEnabled("propal") || isModEnabled('order') || isModEnabled('intervention') || isModEnabled('contract')) { - $tmparray['comm/index.php?mainmenu=commercial&leftmenu='] = array('label'=>'CommercialArea', 'picto'=>'commercial'); + $tmparray['comm/index.php?mainmenu=commercial&leftmenu='] = array('label' => 'CommercialArea', 'picto' => 'commercial'); } if (isModEnabled('invoice')) { - $tmparray['compta/index.php?mainmenu=billing&leftmenu='] = array('label'=>'InvoicesArea', 'picto'=>'bill'); + $tmparray['compta/index.php?mainmenu=billing&leftmenu='] = array('label' => 'InvoicesArea', 'picto' => 'bill'); } if (isModEnabled('comptabilite') || isModEnabled('accounting')) { - $tmparray['compta/index.php?mainmenu=accountancy&leftmenu='] = array('label'=>'AccountancyTreasuryArea', 'picto'=>'bill'); + $tmparray['compta/index.php?mainmenu=accountancy&leftmenu='] = array('label' => 'AccountancyTreasuryArea', 'picto' => 'bill'); } if (isModEnabled('member')) { - $tmparray['adherents/index.php?mainmenu=members&leftmenu='] = array('label'=>'MembersArea', 'picto'=>'member'); + $tmparray['adherents/index.php?mainmenu=members&leftmenu='] = array('label' => 'MembersArea', 'picto' => 'member'); } if (isModEnabled('agenda')) { - $tmparray['comm/action/index.php?mainmenu=agenda&leftmenu='] = array('label'=>'Agenda', 'picto'=>'action'); + $tmparray['comm/action/index.php?mainmenu=agenda&leftmenu='] = array('label' => 'Agenda', 'picto' => 'action'); } if (isModEnabled('ticket')) { - $tmparray['ticket/list.php?mainmenu=ticket&leftmenu='] = array('label'=>'Tickets', 'picto'=>'ticket'); + $tmparray['ticket/list.php?mainmenu=ticket&leftmenu='] = array('label' => 'Tickets', 'picto' => 'ticket'); } // add bookmarks to available landing pages if (!getDolGlobalString('MAIN_NO_BOOKMARKS_FOR_LANDING_PAGES')) { @@ -269,15 +271,15 @@ $num_rows = $db->num_rows($resql); if ($num_rows > 0) { $tmparray['sep'.$i] = array( - 'data-html'=>'--- '.$langs->trans("Bookmarks").'', - 'label'=>'--- '.$langs->trans("Bookmarks"), + 'data-html' => '--- '.$langs->trans("Bookmarks").'', + 'label' => '--- '.$langs->trans("Bookmarks"), 'picto' => '', ); while ($i < $num_rows) { $obj = $db->fetch_object($resql); $landing_url = str_replace(DOL_URL_ROOT, '', $obj->url); - $tmparray[$landing_url] = array('label'=>$obj->title, 'picto'=>'generic'); + $tmparray[$landing_url] = array('label' => $obj->title, 'picto' => 'generic'); $i++; } } @@ -388,7 +390,7 @@ function init_myfunc() print empty($dolibarr_main_demo) ? '' : ' disabled="disabled"'; // Disabled for demo print '> '; - print $formadmin->select_language((!empty($object->conf->MAIN_LANG_DEFAULT) ? $object->conf->MAIN_LANG_DEFAULT : ''), 'main_lang_default', 1, null, 0, 0, (!empty($dolibarr_main_demo))); + print $formadmin->select_language((!empty($object->conf->MAIN_LANG_DEFAULT) ? $object->conf->MAIN_LANG_DEFAULT : ''), 'main_lang_default', 1, array(), 0, 0, (!empty($dolibarr_main_demo))); print '
'."\n"; - $tmplist = array(''=>' ', 'show_list'=>$langs->trans("ViewList"), 'show_month'=>$langs->trans("ViewCal"), 'show_week'=>$langs->trans("ViewWeek"), 'show_day'=>$langs->trans("ViewDay"), 'show_peruser'=>$langs->trans("ViewPerUser")); + $tmplist = array('' => ' ', 'show_list' => $langs->trans("ViewList"), 'show_month' => $langs->trans("ViewCal"), 'show_week' => $langs->trans("ViewWeek"), 'show_day' => $langs->trans("ViewDay"), 'show_peruser' => $langs->trans("ViewPerUser")); print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, (isset($object->conf->AGENDA_DEFAULT_VIEW) ? $object->conf->AGENDA_DEFAULT_VIEW : ''), 0, 0, 0, ''); print '
 conf->AGENDA_DEFAULT_VIEW) ? " checked" : "").'> '.$langs->trans("UsePersonalValue").''."\n"; - $tmplist = array(''=>' ', 'show_list'=>$langs->trans("ViewList"), 'show_month'=>$langs->trans("ViewCal"), 'show_week'=>$langs->trans("ViewWeek"), 'show_day'=>$langs->trans("ViewDay"), 'show_peruser'=>$langs->trans("ViewPerUser")); + $tmplist = array('' => ' ', 'show_list' => $langs->trans("ViewList"), 'show_month' => $langs->trans("ViewCal"), 'show_week' => $langs->trans("ViewWeek"), 'show_day' => $langs->trans("ViewDay"), 'show_peruser' => $langs->trans("ViewPerUser")); if (!empty($object->conf->AGENDA_DEFAULT_VIEW)) { print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, $object->conf->AGENDA_DEFAULT_VIEW, 0, 0, 0, '', 0, 0, 1); } @@ -564,7 +566,7 @@ function init_myfunc() print '
'.$langs->trans("MAIN_CHECKBOX_LEFT_COLUMN").''.(getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN') ? $langs->trans("Yes") : $langs->trans("No")).'conf->MAIN_CHECKBOX_LEFT_COLUMN) ? " checked" : "").'> '.$langs->trans("UsePersonalValue").''.(isset($object->conf->MAIN_CHECKBOX_LEFT_COLUMN) ?( $object->conf->MAIN_CHECKBOX_LEFT_COLUMN == 1 ? $langs->trans("Yes") : $langs->trans("No")) : ' ').'
'.(isset($object->conf->MAIN_CHECKBOX_LEFT_COLUMN) ? ($object->conf->MAIN_CHECKBOX_LEFT_COLUMN == 1 ? $langs->trans("Yes") : $langs->trans("No")) : ' ').'
'.$langs->trans("MaxSizeList").'