diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index 8b50a71deb0..629672d06c4 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -474,7 +474,7 @@ if ($nboftargetok) { print "Clean $BUILDROOT\n"; $ret=`rm -f $BUILDROOT/$PROJECT/.buildpath`; $ret=`rm -fr $BUILDROOT/$PROJECT/.cache`; - $ret=`rm -fr $BUILDROOT/$PROJECT/.codeclimate`; + $ret=`rm -fr $BUILDROOT/$PROJECT/.codeclimate.yml`; $ret=`rm -fr $BUILDROOT/$PROJECT/.externalToolBuilders`; $ret=`rm -fr $BUILDROOT/$PROJECT/.git*`; $ret=`rm -fr $BUILDROOT/$PROJECT/.project`; @@ -484,8 +484,11 @@ if ($nboftargetok) { $ret=`rm -fr $BUILDROOT/$PROJECT/.stickler.yml`; $ret=`rm -fr $BUILDROOT/$PROJECT/.travis.yml`; $ret=`rm -fr $BUILDROOT/$PROJECT/.tx`; + $ret=`rm -fr $BUILDROOT/$PROJECT/.pre-commit-config.yaml`; + $ret=`rm -fr $BUILDROOT/$PROJECT/.phan`; $ret=`rm -f $BUILDROOT/$PROJECT/build.xml`; $ret=`rm -f $BUILDROOT/$PROJECT/phpstan.neon`; + $ret=`rm -fr $BUILDROOT/$PROJECT/phpstan.neon.dist`; $ret=`rm -f $BUILDROOT/$PROJECT/pom.xml`; $ret=`rm -f $BUILDROOT/$PROJECT/README-*.md`; diff --git a/dev/tools/phan/baseline.txt b/dev/tools/phan/baseline.txt index 400ab4fe833..9ce6425b6c4 100644 --- a/dev/tools/phan/baseline.txt +++ b/dev/tools/phan/baseline.txt @@ -9,36 +9,36 @@ */ return [ // # Issue statistics: - // PhanPluginUnknownPropertyType : 1000+ occurrences - // PhanUndeclaredProperty : 840+ occurrences - // PhanPossiblyUndeclaredGlobalVariable : 630+ occurrences - // PhanTypeMismatchArgumentProbablyReal : 470+ occurrences - // PhanUndeclaredGlobalVariable : 410+ occurrences - // PhanPluginUnknownArrayMethodReturnType : 380+ occurrences - // PhanPluginUnknownArrayMethodParamType : 290+ occurrences + // PhanUndeclaredProperty : 800+ occurrences + // PhanPluginUnknownPropertyType : 740+ occurrences + // PhanPossiblyUndeclaredGlobalVariable : 600+ occurrences + // PhanTypeMismatchArgumentProbablyReal : 430+ occurrences + // PhanUndeclaredGlobalVariable : 380+ occurrences + // PhanPluginUnknownArrayMethodReturnType : 320+ occurrences + // PhanPluginUnknownArrayMethodParamType : 270+ occurrences // PhanPossiblyUndeclaredVariable : 260+ occurrences - // PhanTypeMismatchProperty : 180+ occurrences - // PhanPluginUnknownArrayFunctionReturnType : 140+ occurrences - // PhanPluginUnknownArrayFunctionParamType : 120+ occurrences + // PhanTypeMismatchProperty : 170+ occurrences + // PhanPluginUnknownArrayFunctionParamType : 110+ occurrences // PhanTypeMismatchArgumentNullableInternal : 70+ occurrences // PhanPluginUndeclaredVariableIsset : 65+ occurrences - // PhanPluginUnknownArrayPropertyType : 65+ occurrences - // PhanPluginEmptyStatementIf : 50+ occurrences + // PhanPluginUnknownArrayPropertyType : 60+ occurrences + // PhanPluginUnknownArrayFunctionReturnType : 55+ occurrences // PhanRedefineFunction : 50+ occurrences - // PhanTypeSuspiciousNonTraversableForeach : 50+ occurrences - // PhanTypeInvalidDimOffset : 35+ occurrences - // PhanTypeMismatchDimFetch : 30+ occurrences - // PhanPluginUnknownObjectMethodCall : 25+ occurrences + // PhanPluginEmptyStatementIf : 45+ occurrences + // PhanTypeMismatchDimFetch : 40+ occurrences + // PhanTypeSuspiciousNonTraversableForeach : 30+ occurrences // PhanTypeExpectedObjectPropAccess : 25+ occurrences + // PhanTypeInvalidDimOffset : 25+ occurrences + // PhanPluginUnknownObjectMethodCall : 15+ occurrences // PhanTypeComparisonFromArray : 15+ occurrences // PhanUndeclaredConstant : 15+ occurrences + // PhanUndeclaredMethod : 15+ occurrences // PhanEmptyForeach : 10+ occurrences // PhanPluginConstantVariableNull : 10+ occurrences - // PhanPluginSuspiciousParamPosition : 10+ occurrences // PhanPossiblyNullTypeMismatchProperty : 10+ occurrences // PhanTypeMismatchDimFetchNullable : 10+ occurrences - // PhanUndeclaredMethod : 10+ occurrences // PhanPluginBothLiteralsBinaryOp : 8 occurrences + // PhanPluginSuspiciousParamPosition : 8 occurrences // PhanPluginDuplicateExpressionBinaryOp : 7 occurrences // PhanParamTooMany : 5 occurrences // PhanPluginDuplicateArrayKey : 4 occurrences @@ -51,11 +51,8 @@ return [ 'file_suppressions' => [ 'htdocs/accountancy/class/accountancycategory.class.php' => ['PhanPluginUnknownArrayPropertyType'], 'htdocs/accountancy/class/accountancyexport.class.php' => ['PhanUndeclaredProperty'], - 'htdocs/accountancy/class/accountingjournal.class.php' => ['PhanTypeInvalidDimOffset'], - 'htdocs/accountancy/journal/purchasesjournal.php' => ['PhanTypeInvalidDimOffset'], 'htdocs/adherents/canvas/actions_adherentcard_common.class.php' => ['PhanTypeSuspiciousNonTraversableForeach'], 'htdocs/adherents/list.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/adherents/stats/index.php' => ['PhanTypeInvalidDimOffset'], 'htdocs/admin/fckeditor.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/api/class/api_access.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanUndeclaredProperty'], 'htdocs/api/class/api_documents.class.php' => ['PhanPluginDuplicateExpressionBinaryOp', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPossiblyUndeclaredVariable'], @@ -82,21 +79,16 @@ return [ 'htdocs/bom/bom_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/bom/class/api_boms.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], 'htdocs/bom/class/bom.class.php' => ['PhanPluginUnknownArrayMethodParamType'], - 'htdocs/bom/lib/bom.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/bom/tpl/objectline_edit.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/bom/tpl/objectline_view.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/bookcal/availabilities_card.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/bookcal/availabilities_list.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/bookcal/booking_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/bookcal/calendar_card.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/bookcal/calendar_list.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/bookcal/class/availabilities.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'], 'htdocs/bookcal/class/calendar.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'], - 'htdocs/bookcal/lib/bookcal.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], - 'htdocs/bookcal/lib/bookcal_availabilities.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], - 'htdocs/bookcal/lib/bookcal_calendar.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/categories/class/api_categories.class.php' => ['PhanAccessMethodProtected', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/categories/class/categorie.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType', 'PhanTypeMismatchProperty'], + 'htdocs/categories/class/categorie.class.php' => ['PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty'], 'htdocs/categories/edit.php' => ['PhanTypeMismatchDimFetch'], 'htdocs/categories/index.php' => ['PhanTypeMismatchDimFetch'], 'htdocs/categories/info.php' => ['PhanTypeMismatchDimFetch'], @@ -114,7 +106,7 @@ return [ 'htdocs/comm/action/list.php' => ['PhanTypeMismatchProperty'], 'htdocs/comm/action/pertype.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanTypeComparisonFromArray', 'PhanTypeMismatchDimFetch'], 'htdocs/comm/action/peruser.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanTypeComparisonFromArray'], - 'htdocs/comm/mailing/card.php' => ['PhanPluginSuspiciousParamPosition', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/comm/mailing/card.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/comm/mailing/cibles.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'], 'htdocs/comm/mailing/class/advtargetemailing.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayPropertyType'], 'htdocs/comm/mailing/class/html.formadvtargetemailing.class.php' => ['PhanPluginUnknownArrayMethodParamType'], @@ -123,16 +115,13 @@ return [ 'htdocs/comm/propal/card.php' => ['PhanTypeMismatchProperty'], 'htdocs/comm/propal/class/api_proposals.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], 'htdocs/comm/propal/class/propal.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], - 'htdocs/comm/propal/class/propalestats.class.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/comm/propal/list.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/comm/propal/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/commande/class/api_orders.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], 'htdocs/commande/class/commande.class.php' => ['PhanUndeclaredProperty'], - 'htdocs/commande/class/commandestats.class.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/commande/customer.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/commande/list.php' => ['PhanUndeclaredProperty'], 'htdocs/commande/list_det.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidDimOffset', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/commande/stats/index.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/commande/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/compta/accounting-files.php' => ['PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'], 'htdocs/compta/bank/account_statement_document.php' => ['PhanUndeclaredGlobalVariable'], @@ -156,21 +145,20 @@ return [ 'htdocs/compta/charges/index.php' => ['PhanTypeMismatchArgumentNullableInternal'], 'htdocs/compta/clients.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], 'htdocs/compta/deplacement/class/deplacement.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], - 'htdocs/compta/deplacement/class/deplacementstats.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], 'htdocs/compta/deplacement/stats/index.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/compta/facture/agenda-rec.php' => ['PhanPluginEmptyStatementIf'], 'htdocs/compta/facture/card.php' => ['PhanUndeclaredProperty'], '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/class/facturestats.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], + 'htdocs/compta/facture/class/facturestats.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/compta/facture/class/paymentterm.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/compta/facture/contact.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/compta/facture/invoicetemplate_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/compta/facture/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/compta/facture/note.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/compta/facture/prelevement.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/compta/facture/stats/index.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidDimOffset', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/compta/facture/stats/index.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/compta/facture/tpl/linkedobjectblock.tpl.php' => ['PhanEmptyFQSENInClasslike', 'PhanInvalidFQSENInClasslike', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredProperty'], 'htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/compta/journal/purchasesjournal.php' => ['PhanPossiblyUndeclaredGlobalVariable'], @@ -246,7 +234,6 @@ return [ 'htdocs/core/ajax/ajaxdirtree.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], 'htdocs/core/ajax/fileupload.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/core/ajax/onlineSign.php' => ['PhanPluginUnknownArrayFunctionParamType'], - 'htdocs/core/ajax/saveinplace.php' => ['PhanUndeclaredProperty'], 'htdocs/core/ajax/selectobject.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/core/ajax/selectsearchbox.php' => ['PhanPluginUndeclaredVariableIsset'], 'htdocs/core/boxes/box_actions.php' => ['PhanPossiblyUndeclaredVariable'], @@ -304,7 +291,7 @@ return [ 'htdocs/core/class/html.formcompany.class.php' => ['PhanUndeclaredProperty'], 'htdocs/core/class/html.formfile.class.php' => ['PhanPluginConstantVariableNull', 'PhanPluginUnknownArrayMethodParamType', 'PhanTypeInvalidDimOffset', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/core/class/html.formldap.class.php' => ['PhanPluginUnknownArrayMethodParamType'], - 'htdocs/core/class/html.formmail.class.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], + 'htdocs/core/class/html.formmail.class.php' => ['PhanUndeclaredProperty'], 'htdocs/core/class/html.formmargin.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanUndeclaredProperty'], 'htdocs/core/class/html.formprojet.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/core/class/html.formsetup.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayPropertyType'], @@ -318,7 +305,7 @@ return [ 'htdocs/core/class/socialnetworkmanager.class.php' => ['PhanPluginUnknownArrayMethodParamType'], 'htdocs/core/class/stats.class.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchDimFetch'], 'htdocs/core/class/timespent.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'], - 'htdocs/core/class/translate.class.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal'], + 'htdocs/core/class/translate.class.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownArrayPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal'], 'htdocs/core/class/utils.class.php' => ['PhanPluginConstantVariableNull', 'PhanPossiblyUndeclaredVariable'], 'htdocs/core/customreports.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDimFetchNullable'], 'htdocs/core/datepicker.php' => ['PhanTypeInvalidDimOffset'], @@ -330,58 +317,32 @@ return [ 'htdocs/core/filemanagerdol/connectors/php/connector.lib.php' => ['PhanPluginConstantVariableNull', 'PhanPluginUnknownArrayFunctionParamType', 'PhanTypeInvalidDimOffset'], 'htdocs/core/lib/accounting.lib.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/core/lib/admin.lib.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanUndeclaredProperty'], - 'htdocs/core/lib/agenda.lib.php' => ['PhanPluginConstantVariableNull', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/core/lib/agenda.lib.php' => ['PhanPluginConstantVariableNull', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/core/lib/ajax.lib.php' => ['PhanPluginUnknownArrayFunctionParamType'], - 'htdocs/core/lib/asset.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/core/lib/bank.lib.php' => ['PhanPluginEmptyStatementIf', 'PhanUndeclaredProperty'], 'htdocs/core/lib/company.lib.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeInvalidDimOffset', 'PhanTypeMismatchProperty'], - 'htdocs/core/lib/contract.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], - 'htdocs/core/lib/cron.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/core/lib/customreports.lib.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanTypeMismatchDimFetch'], 'htdocs/core/lib/date.lib.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal'], 'htdocs/core/lib/doc.lib.php' => ['PhanPossiblyUndeclaredVariable'], - 'htdocs/core/lib/ecm.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], - 'htdocs/core/lib/eventorganization.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], - 'htdocs/core/lib/expedition.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], - 'htdocs/core/lib/expensereport.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/core/lib/files.lib.php' => ['PhanUndeclaredProperty'], - 'htdocs/core/lib/fourn.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/core/lib/ftp.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal'], 'htdocs/core/lib/functions2.lib.php' => ['PhanUndeclaredProperty'], 'htdocs/core/lib/functionsnumtoword.lib.php' => ['PhanPossiblyUndeclaredVariable'], 'htdocs/core/lib/geturl.lib.php' => ['PhanPluginConstantVariableNull', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanTypeMismatchArgumentNullableInternal'], - 'htdocs/core/lib/holiday.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], - 'htdocs/core/lib/hrm.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/core/lib/images.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal'], - 'htdocs/core/lib/import.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], - 'htdocs/core/lib/invoice.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/core/lib/invoice2.lib.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPossiblyUndeclaredVariable'], - 'htdocs/core/lib/ldap.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/core/lib/loan.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], - 'htdocs/core/lib/mailmanspip.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/core/lib/memory.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], - 'htdocs/core/lib/multicurrency.lib.php' => ['PhanPluginUnknownArrayFunctionParamType'], 'htdocs/core/lib/oauth.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], - 'htdocs/core/lib/order.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/core/lib/payments.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/core/lib/pdf.lib.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredProperty'], - 'htdocs/core/lib/prelevement.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/core/lib/price.lib.php' => ['PhanPluginSuspiciousParamPosition', 'PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanPossiblyUndeclaredVariable'], - 'htdocs/core/lib/product.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType', 'PhanPossiblyUndeclaredVariable'], 'htdocs/core/lib/project.lib.php' => ['PhanUndeclaredProperty'], - 'htdocs/core/lib/receiptprinter.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/core/lib/report.lib.php' => ['PhanPluginUnknownArrayFunctionParamType'], - 'htdocs/core/lib/resource.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], - 'htdocs/core/lib/salaries.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/core/lib/security.lib.php' => ['PhanPluginUnknownArrayFunctionParamType'], 'htdocs/core/lib/signature.lib.php' => ['PhanPossiblyUndeclaredVariable'], - 'htdocs/core/lib/socialnetwork.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], - 'htdocs/core/lib/stock.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], - 'htdocs/core/lib/takepos.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/core/lib/tax.lib.php' => ['PhanPossiblyUndeclaredVariable'], - 'htdocs/core/lib/ticket.lib.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/core/lib/treeview.lib.php' => ['PhanPluginUnknownArrayFunctionParamType'], - 'htdocs/core/lib/website.lib.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/core/lib/xcal.lib.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPossiblyUndeclaredVariable', 'PhanUndeclaredProperty'], 'htdocs/core/menus/standard/auguria.lib.php' => ['PhanTypeInvalidDimOffset'], 'htdocs/core/menus/standard/eldy_menu.php' => ['PhanTypeInvalidDimOffset'], @@ -457,8 +418,8 @@ return [ 'htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php' => ['PhanPossiblyUndeclaredVariable'], 'htdocs/core/modules/supplier_order/modules_commandefournisseur.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/core/modules/supplier_payment/doc/pdf_standard_supplierpayment.modules.php' => ['PhanPluginUnknownPropertyType'], - 'htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], + 'htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php' => ['PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], + 'htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php' => ['PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], 'htdocs/core/modules/syslog/mod_syslog_file.php' => ['PhanPluginDuplicateArrayKey'], 'htdocs/core/modules/syslog/mod_syslog_syslog.php' => ['PhanPluginConstantVariableNull', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeSuspiciousNonTraversableForeach'], @@ -518,7 +479,6 @@ return [ 'htdocs/don/card.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'], 'htdocs/don/class/api_donations.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], 'htdocs/don/class/don.class.php' => ['PhanParamTooMany', 'PhanPluginEmptyStatementIf', 'PhanPluginUnknownPropertyType'], - 'htdocs/don/class/donstats.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], 'htdocs/don/class/paymentdonation.class.php' => ['PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/don/document.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], 'htdocs/don/index.php' => ['PhanPluginUndeclaredVariableIsset'], @@ -528,7 +488,6 @@ return [ 'htdocs/don/paiement/list.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/don/payment/card.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/don/payment/payment.php' => ['PhanPossiblyUndeclaredGlobalVariable'], - 'htdocs/don/stats/index.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/don/tpl/linkedobjectblock.tpl.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/ecm/class/ecmdirectory.class.php' => ['PhanPluginUnknownArrayPropertyType', 'PhanPossiblyUndeclaredVariable'], 'htdocs/ecm/class/ecmfiles.class.php' => ['PhanPluginUnknownPropertyType', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], @@ -540,8 +499,6 @@ return [ 'htdocs/emailcollector/class/emailcollector.class.php' => ['PhanPossiblyUndeclaredVariable', 'PhanUndeclaredProperty'], 'htdocs/emailcollector/class/emailcollectoraction.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/emailcollector/class/emailcollectorfilter.class.php' => ['PhanPluginUnknownPropertyType'], - 'htdocs/emailcollector/lib/emailcollector.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], - 'htdocs/eventorganization/class/conferenceorbooth.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], 'htdocs/eventorganization/class/conferenceorboothattendee.class.php' => ['PhanPluginUnknownPropertyType', 'PhanPossiblyNullTypeMismatchProperty', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'], 'htdocs/eventorganization/conferenceorbooth_card.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/eventorganization/conferenceorbooth_contact.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], @@ -549,12 +506,10 @@ return [ 'htdocs/eventorganization/conferenceorboothattendee_card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], 'htdocs/eventorganization/conferenceorboothattendee_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/eventorganization/core/actions_massactions_mail.inc.php' => ['PhanUndeclaredProperty'], - 'htdocs/eventorganization/lib/eventorganization_conferenceorbooth.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/expedition/card.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/expedition/class/api_shipments.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], 'htdocs/expedition/class/expedition.class.php' => ['PhanUndeclaredProperty'], 'htdocs/expedition/class/expeditionlinebatch.class.php' => ['PhanPluginUnknownPropertyType'], - 'htdocs/expedition/class/expeditionstats.class.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/expedition/contact.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/expedition/dispatch.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/expedition/document.php' => ['PhanPossiblyUndeclaredGlobalVariable'], @@ -564,7 +519,6 @@ return [ 'htdocs/expedition/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/expensereport/card.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/expensereport/class/api_expensereports.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/expensereport/class/expensereportstats.class.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/expensereport/class/paymentexpensereport.class.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/expensereport/payment/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], 'htdocs/expensereport/payment/info.php' => ['PhanUndeclaredGlobalVariable'], @@ -577,7 +531,7 @@ return [ 'htdocs/fichinter/card-rec.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/fichinter/class/api_interventions.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanUndeclaredProperty'], 'htdocs/fichinter/class/fichinterrec.class.php' => ['PhanUndeclaredProperty'], - 'htdocs/fichinter/class/fichinterstats.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], + 'htdocs/fichinter/class/fichinterstats.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/fichinter/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/fichinter/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/filefunc.inc.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], @@ -626,19 +580,12 @@ return [ 'htdocs/hrm/job_agenda.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/hrm/job_card.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/hrm/job_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/hrm/lib/hrm.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], - 'htdocs/hrm/lib/hrm_job.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], - 'htdocs/hrm/lib/hrm_position.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], - 'htdocs/hrm/lib/hrm_skill.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], - 'htdocs/hrm/lib/hrm_skilldet.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], - 'htdocs/hrm/lib/hrm_skillrank.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/hrm/position_list.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'], 'htdocs/hrm/skill_card.php' => ['PhanTypeExpectedObjectPropAccess', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/hrm/skill_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/imports/class/import.class.php' => ['PhanPluginEmptyStatementIf'], 'htdocs/imports/emptyexample.php' => ['PhanRedefineFunction', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/imports/import.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/index.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/install/check.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal'], 'htdocs/install/fileconf.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal'], 'htdocs/install/inc.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanRedefineFunction'], @@ -649,7 +596,6 @@ return [ 'htdocs/install/upgrade.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal'], 'htdocs/intracommreport/card.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/intracommreport/class/intracommreport.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable'], - 'htdocs/intracommreport/lib/intracommreport.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], 'htdocs/knowledgemanagement/class/knowledgerecord.class.php' => ['PhanUndeclaredProperty'], 'htdocs/knowledgemanagement/knowledgerecord_card.php' => ['PhanPluginEmptyStatementIf', 'PhanTypeMismatchArgumentProbablyReal'], @@ -670,8 +616,6 @@ return [ 'htdocs/master.inc.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/mrp/class/api_mos.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], 'htdocs/mrp/class/mo.class.php' => ['PhanTypeMismatchProperty'], - 'htdocs/mrp/lib/mrp.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], - 'htdocs/mrp/lib/mrp_mo.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/mrp/mo_card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/mrp/mo_movements.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable'], 'htdocs/mrp/mo_production.php' => ['PhanTypeMismatchArgumentProbablyReal'], @@ -682,7 +626,7 @@ return [ 'htdocs/opcachepreload.php' => ['PhanEmptyForeach'], 'htdocs/opensurvey/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/opensurvey/class/opensurveysondage.class.php' => ['PhanPluginUnknownPropertyType', 'PhanTypeMismatchProperty'], - 'htdocs/opensurvey/lib/opensurvey.lib.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/opensurvey/lib/opensurvey.lib.php' => ['PhanPluginUnknownArrayFunctionParamType'], 'htdocs/opensurvey/list.php' => ['PhanEmptyForeach', 'PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/opensurvey/results.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredGlobalVariable'], 'htdocs/opensurvey/wizard/choix_date.php' => ['PhanPossiblyUndeclaredGlobalVariable'], @@ -691,12 +635,10 @@ return [ 'htdocs/partnership/class/partnership.class.php' => ['PhanUndeclaredProperty'], 'htdocs/partnership/class/partnershiputils.class.php' => ['PhanPluginUnknownObjectMethodCall'], 'htdocs/partnership/core/modules/partnership/mod_partnership_advanced.php' => ['PhanUndeclaredProperty'], - 'htdocs/partnership/lib/partnership.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/partnership/partnership_card.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/partnership/partnership_list.php' => ['PhanUndeclaredProperty'], 'htdocs/paypal/lib/paypal.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/printing/index.php' => ['PhanUndeclaredProperty'], - 'htdocs/printing/lib/printing.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/product/admin/product.php' => ['PhanPluginEmptyStatementIf', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/product/ajax/products.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/product/canvas/product/actions_card_product.class.php' => ['PhanTypeSuspiciousNonTraversableForeach'], @@ -717,7 +659,6 @@ return [ 'htdocs/product/inventory/card.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/product/inventory/class/inventory.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], 'htdocs/product/inventory/inventory.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/product/inventory/lib/inventory.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/product/inventory/list.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/product/list.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/product/price.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], @@ -744,7 +685,6 @@ return [ 'htdocs/product/stock/stats/reception.php' => ['PhanUndeclaredProperty'], 'htdocs/product/stock/stockatdate.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/product/stock/stocktransfer/class/stocktransferline.class.php' => ['PhanUndeclaredProperty'], - 'htdocs/product/stock/stocktransfer/lib/stocktransfer.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/product/stock/stocktransfer/stocktransfer_card.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/product/stock/stocktransfer/stocktransfer_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/product/stock/tpl/stockcorrection.tpl.php' => ['PhanUndeclaredProperty'], @@ -756,7 +696,7 @@ return [ 'htdocs/projet/ajax/projects.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/projet/card.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/projet/class/api_tasks.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/projet/class/projectstats.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable'], + 'htdocs/projet/class/projectstats.class.php' => ['PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable'], 'htdocs/projet/class/task.class.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], 'htdocs/projet/class/taskstats.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], 'htdocs/projet/contact.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeComparisonFromArray', 'PhanTypeMismatchArgumentProbablyReal'], @@ -808,7 +748,7 @@ return [ 'htdocs/public/ticket/view.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/public/webportal/tpl/menu.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/public/webportal/webportal.main.inc.php' => ['PhanPossiblyNullTypeMismatchProperty', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanRedefineFunction'], - 'htdocs/public/website/index.php' => ['PhanRedefineFunction', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/public/website/index.php' => ['PhanRedefineFunction'], 'htdocs/public/website/javascript.js.php' => ['PhanRedefineFunction'], 'htdocs/public/website/styles.css.php' => ['PhanRedefineFunction'], 'htdocs/reception/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], @@ -837,13 +777,12 @@ return [ 'htdocs/recruitment/recruitmentjobposition_note.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/resource/class/dolresource.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/resource/class/html.formresource.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanTypeExpectedObjectPropAccess'], - 'htdocs/resource/element_resource.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], + 'htdocs/resource/element_resource.php' => ['PhanUndeclaredProperty'], 'htdocs/salaries/admin/salaries.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/salaries/card.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/salaries/class/api_salaries.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], 'htdocs/salaries/class/paymentsalary.class.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownArrayPropertyType', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/salaries/class/salariesstats.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], - 'htdocs/salaries/class/salary.class.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType'], + 'htdocs/salaries/class/salariesstats.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/salaries/document.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/salaries/info.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/salaries/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], @@ -853,7 +792,6 @@ return [ 'htdocs/societe/ajax/ajaxcompanies.php' => ['PhanUndeclaredProperty'], 'htdocs/societe/ajax/company.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/societe/canvas/actions_card_common.class.php' => ['PhanTypeSuspiciousNonTraversableForeach'], - 'htdocs/societe/card.php' => ['PhanTypeMismatchProperty'], 'htdocs/societe/checkvat/checkVatPopup.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/societe/class/api_contacts.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'], 'htdocs/societe/class/api_thirdparties.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanTypeSuspiciousNonTraversableForeach', 'PhanUndeclaredProperty'], @@ -870,15 +808,13 @@ return [ 'htdocs/stripe/ajax/ajax.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/stripe/class/actions_stripe.class.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanPluginSuspiciousParamPosition', 'PhanPluginUnknownArrayMethodParamType', 'PhanUndeclaredProperty'], 'htdocs/stripe/class/stripe.class.php' => ['PhanPluginConstantVariableNull', 'PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], - 'htdocs/stripe/lib/stripe.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/supplier_proposal/card.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/supplier_proposal/class/api_supplier_proposals.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanUndeclaredProperty'], - 'htdocs/supplier_proposal/class/supplier_proposal.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], + 'htdocs/supplier_proposal/class/supplier_proposal.class.php' => ['PhanUndeclaredProperty'], 'htdocs/supplier_proposal/list.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/supplier_proposal/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/support/inc.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanRedefineFunction'], 'htdocs/takepos/admin/orderprinters.php' => ['PhanTypeMismatchDimFetch'], - 'htdocs/takepos/admin/terminal.php' => ['PhanPluginUnknownObjectMethodCall'], 'htdocs/takepos/ajax/ajax.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/takepos/floors.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/takepos/freezone.php' => ['PhanTypeMismatchArgumentProbablyReal'], @@ -905,7 +841,7 @@ return [ 'htdocs/ticket/class/api_tickets.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/ticket/class/cticketcategory.class.php' => ['PhanUndeclaredProperty'], 'htdocs/ticket/class/ticket.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], - 'htdocs/ticket/class/ticketstats.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], + 'htdocs/ticket/class/ticketstats.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/ticket/contact.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/ticket/index.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal'], 'htdocs/ticket/list.php' => ['PhanTypeComparisonFromArray'], @@ -922,24 +858,20 @@ return [ 'htdocs/variants/combinations.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchProperty'], 'htdocs/variants/tpl/productattributevalueline_edit.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/variants/tpl/productattributevalueline_view.tpl.php' => ['PhanUndeclaredProperty'], - 'htdocs/viewimage.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanRedefineFunction'], + 'htdocs/viewimage.php' => ['PhanRedefineFunction', 'PhanUndeclaredMethod'], 'htdocs/webhook/class/api_webhook.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/webhook/class/target.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanPossiblyNullTypeMismatchProperty'], - 'htdocs/webhook/lib/webhook.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], - 'htdocs/webhook/lib/webhook_target.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/webhook/class/target.class.php' => ['PhanUndeclaredMethod'], 'htdocs/webhook/target_card.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/webhook/target_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/webportal/class/context.class.php' => ['PhanPluginUnknownArrayMethodParamType'], 'htdocs/webportal/class/controller.class.php' => ['PhanPluginUnknownArrayMethodParamType'], 'htdocs/webportal/class/html.formcardwebportal.class.php' => ['PhanUndeclaredProperty'], 'htdocs/webportal/class/html.formlistwebportal.class.php' => ['PhanPluginUnknownArrayPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], - 'htdocs/webportal/class/html.formwebportal.class.php' => ['PhanTypeInvalidDimOffset'], 'htdocs/webportal/class/webportalinvoice.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/webportal/class/webportalmember.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/webportal/class/webportalpropal.class.php' => ['PhanUndeclaredProperty'], - 'htdocs/webportal/lib/webportal.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/webservices/server_actioncomm.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanUndeclaredProperty'], - 'htdocs/webservices/server_category.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredProperty'], + 'htdocs/webservices/server_category.php' => ['PhanUndeclaredProperty'], 'htdocs/webservices/server_contact.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], 'htdocs/webservices/server_invoice.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/webservices/server_order.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanUndeclaredProperty'], @@ -950,21 +882,17 @@ return [ 'htdocs/webservices/server_thirdparty.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], 'htdocs/webservices/server_user.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanUndeclaredProperty'], 'htdocs/website/class/website.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPossiblyNullTypeMismatchProperty', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal'], - 'htdocs/website/index.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/website/lib/websiteaccount.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], + 'htdocs/website/index.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/website/samples/wrapper.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/website/websiteaccount_card.php' => ['PhanUndeclaredProperty'], 'htdocs/workstation/class/api_workstations.class.php' => ['PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/workstation/class/workstation.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredProperty'], + 'htdocs/workstation/class/workstation.class.php' => ['PhanUndeclaredProperty'], 'htdocs/workstation/class/workstationresource.class.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/workstation/class/workstationusergroup.class.php' => ['PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/workstation/lib/workstation.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], - 'htdocs/workstation/lib/workstation_workstation.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/workstation/workstation_card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/workstation/workstation_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/zapier/class/api_zapier.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], 'htdocs/zapier/class/hook.class.php' => ['PhanUndeclaredProperty'], - 'htdocs/zapier/lib/zapier.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'internal' => ['PhanUndeclaredConstant'], ], // 'directory_suppressions' => ['src/directory_name' => ['PhanIssueName1', 'PhanIssueName2']] can be manually added if needed. diff --git a/htdocs/accountancy/class/accountingjournal.class.php b/htdocs/accountancy/class/accountingjournal.class.php index 3a0b59a6740..f428ee2700e 100644 --- a/htdocs/accountancy/class/accountingjournal.class.php +++ b/htdocs/accountancy/class/accountingjournal.class.php @@ -462,7 +462,7 @@ class AccountingJournal extends CommonObject $element = array( 'ref' => dol_trunc($element_static->ref, 16, 'right', 'UTF-8', 1), - 'error' => $pre_data_info['error'], + 'error' => array_key_exists('error', $pre_data_info) ? $pre_data_info['error'] : '', 'blocks' => array(), ); diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index bbdc454b3a0..b80276bb527 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -142,10 +142,12 @@ $sql .= " soc.rowid as socid, soc.nom as name, soc.email as email, bu1.type as t if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) { $sql .= " spe.accountancy_code_customer_general,"; $sql .= " spe.accountancy_code_customer as code_compta_client,"; + $sql .= " spe.accountancy_code_supplier_general,"; $sql .= " spe.accountancy_code_supplier as code_compta_fournisseur,"; } else { $sql .= " soc.accountancy_code_customer_general,"; $sql .= " soc.code_compta as code_compta_client,"; + $sql .= " soc.accountancy_code_supplier_general,"; $sql .= " soc.code_compta_fournisseur,"; } $sql .= " u.accountancy_code, u.rowid as userid, u.lastname as lastname, u.firstname as firstname, u.email as useremail, u.statut as userstatus,"; @@ -228,6 +230,7 @@ $tabmoreinfo = array(); '; $account_customer = 'NotDefined'; +$account_supplier = 'NotDefined'; //print $sql; dol_syslog("accountancy/journal/bankjournal.php", LOG_DEBUG); @@ -285,6 +288,7 @@ if ($result) { $compta_soc = 'NotDefined'; $accountancy_code_general = 'NotDefined'; if ($lineisapurchase > 0) { + $accountancy_code_general = (!empty($obj->accountancy_code_supplier_general)) ? $obj->accountancy_code_supplier_general : $account_supplier; $compta_soc = (($obj->code_compta_fournisseur != "") ? $obj->code_compta_fournisseur : $account_supplier); } if ($lineisasale > 0) { @@ -1034,7 +1038,8 @@ if ($action == 'exportcsv' && $user->hasRight('accounting', 'bind', 'write')) { print '"'.$val["type_payment"].'"'.$sep; print '"'.length_accountg(html_entity_decode($k)).'"'.$sep; if ($tabtype[$key] == 'payment_supplier') { - print '"'.getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER').'"'.$sep; + $account_ledger = (!empty($obj->accountancy_code_supplier_general)) ? $obj->accountancy_code_supplier_general : $account_supplier; + print '"'.$account_ledger.'"'.$sep; } elseif ($tabtype[$key] == 'payment') { $account_ledger = (!empty($obj->accountancy_code_customer_general)) ? $obj->accountancy_code_customer_general : $account_customer; print '"'.$account_ledger.'"'.$sep; diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 0652a6bfc52..d225daccce8 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -86,6 +86,8 @@ $tabrclocaltax1 = array(); $tabrclocaltax2 = array(); $tabpay = array(); +$cptcli = 'NotDefined'; +$cptfour = 'NotDefined'; /* * Actions @@ -133,10 +135,14 @@ $sql .= " p.default_vat_code AS product_buy_default_vat_code, p.tva_tx as produc $sql .= " co.code as country_code, co.label as country_label,"; $sql .= " s.rowid as socid, s.nom as name, s.fournisseur, s.code_client, s.code_fournisseur, s.fk_pays,"; if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) { + $sql .= " spe.accountancy_code_customer_general,"; $sql .= " spe.accountancy_code_customer as code_compta,"; + $sql .= " spe.accountancy_code_supplier_general,"; $sql .= " spe.accountancy_code_supplier as code_compta_fournisseur,"; } else { + $sql .= " s.accountancy_code_customer_general,"; $sql .= " s.code_compta as code_compta,"; + $sql .= " s.accountancy_code_supplier_general,"; $sql .= " s.code_compta_fournisseur,"; } if (getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) { @@ -221,6 +227,7 @@ if ($result) { $obj = $db->fetch_object($result); // Controls + $accountancy_code_supplier_general = (!empty($obj->accountancy_code_supplier_general)) ? $obj->accountancy_code_supplier_general : $cptfour; $compta_soc = ($obj->code_compta_fournisseur != "") ? $obj->code_compta_fournisseur : $cptfour; $compta_prod = $obj->compte; @@ -339,6 +346,7 @@ if ($result) { 'id' => $obj->socid, 'name' => $obj->name, 'code_fournisseur' => $obj->code_fournisseur, + 'accountancy_code_supplier_general' => $accountancy_code_supplier_general, 'code_compta_fournisseur' => $compta_soc ); @@ -427,6 +435,7 @@ if ($action == 'writebookkeeping' && !$error && $user->hasRight('accounting', 'b $companystatic->id = $tabcompany[$key]['id']; $companystatic->name = $tabcompany[$key]['name']; + $companystatic->accountancy_code_supplier_general = $tabcompany[$key]['accountancy_code_supplier_general']; $companystatic->code_compta_fournisseur = $tabcompany[$key]['code_compta_fournisseur']; $companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur']; $companystatic->fournisseur = 1; @@ -479,7 +488,7 @@ if ($action == 'writebookkeeping' && !$error && $user->hasRight('accounting', 'b $bookkeeping->subledger_account = $tabcompany[$key]['code_compta_fournisseur']; $bookkeeping->subledger_label = $tabcompany[$key]['name']; - $bookkeeping->numero_compte = getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER'); + $bookkeeping->numero_compte = $tabcompany[$key]['accountancy_code_supplier_general']; $bookkeeping->label_compte = $accountingaccountsupplier->label; $bookkeeping->label_operation = $bookkeepingstatic->accountingLabelForOperation($companystatic->name, $invoicestatic->ref_supplier, $langs->trans("SubledgerAccount")); @@ -546,7 +555,7 @@ if ($action == 'writebookkeeping' && !$error && $user->hasRight('accounting', 'b if (getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT')) { if ($k == getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT')) { - $bookkeeping->subledger_account = $tabcompany[$key]['code_compta']; + $bookkeeping->subledger_account = $tabcompany[$key]['code_compta_fournisseur']; $bookkeeping->subledger_label = $tabcompany[$key]['name']; } else { $bookkeeping->subledger_account = ''; @@ -803,6 +812,7 @@ if ($action == 'exportcsv' && !$error) { // ISO and not UTF8 ! foreach ($tabfac as $key => $val) { $companystatic->id = $tabcompany[$key]['id']; $companystatic->name = $tabcompany[$key]['name']; + $companystatic->accountancy_code_supplier_general = !empty($tabcompany[$key]['accountancy_code_supplier_general']) ? $tabcompany[$key]['accountancy_code_supplier_general'] : $cptfour; $companystatic->code_compta_fournisseur = $tabcompany[$key]['code_compta_fournisseur']; $companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur']; $companystatic->fournisseur = 1; @@ -839,7 +849,7 @@ if ($action == 'exportcsv' && !$error) { // ISO and not UTF8 ! print '"'.$val["refsologest"].'"'.$sep; print '"'.csvClean(dol_trunc($companystatic->name, 32)).'"'.$sep; print '"'.length_accounta(html_entity_decode($k)).'"'.$sep; - print '"'.length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER')).'"'.$sep; + print '"'.length_accountg($companystatic->accountancy_code_supplier_general).'"'.$sep; print '"'.length_accounta(html_entity_decode($k)).'"'.$sep; print '"'.$langs->trans("Thirdparty").'"'.$sep; print '"'.csvClean($bookkeepingstatic->accountingLabelForOperation($companystatic->name, $val["refsuppliersologest"], $langs->trans("Thirdparty"))).'"'.$sep; @@ -1057,6 +1067,7 @@ if (empty($action) || $action == 'view') { foreach ($tabfac as $key => $val) { $companystatic->id = $tabcompany[$key]['id']; $companystatic->name = $tabcompany[$key]['name']; + $companystatic->accountancy_code_supplier_general = !empty($tabcompany[$key]['accountancy_code_supplier_general']) ? $tabcompany[$key]['accountancy_code_supplier_general'] : $cptfour; $companystatic->code_compta_fournisseur = $tabcompany[$key]['code_compta_fournisseur']; $companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur']; $companystatic->fournisseur = 1; @@ -1131,7 +1142,7 @@ if (empty($action) || $action == 'view') { print "".$invoicestatic->getNomUrl(1).""; // Account print ""; - $accountoshow = length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER')); + $accountoshow = length_accountg(!empty($tabcompany[$key]['accountancy_code_supplier_general']) ? $tabcompany[$key]['accountancy_code_supplier_general'] : $cptfour); if (($accountoshow == "") || $accountoshow == 'NotDefined') { print ''.$langs->trans("MainAccountForSuppliersNotDefined").''; } else { @@ -1182,7 +1193,7 @@ if (empty($action) || $action == 'view') { print ""; if (getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT')) { if ($k == getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT')) { - print length_accounta($tabcompany[$key]['code_compta']); + print length_accounta($tabcompany[$key]['code_compta_fournisseur']); } } elseif (($accountoshow == "") || $accountoshow == 'NotDefined') { print '' . $langs->trans("ThirdpartyAccountNotDefined") . ''; diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index c6347a4689c..694cf1df68f 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -136,10 +136,12 @@ $sql .= " s.rowid as socid, s.nom as name, s.code_client, s.code_fournisseur,"; if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) { $sql .= " spe.accountancy_code_customer_general,"; $sql .= " spe.accountancy_code_customer as code_compta_client,"; + $sql .= " spe.accountancy_code_supplier_general,"; $sql .= " spe.accountancy_code_supplier as code_compta_fournisseur,"; } else { $sql .= " s.accountancy_code_customer_general,"; $sql .= " s.code_compta as code_compta_client,"; + $sql .= " s.accountancy_code_supplier_general,"; $sql .= " s.code_compta_fournisseur,"; } $sql .= " p.rowid as pid, p.ref as pref, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte,"; diff --git a/htdocs/adherents/class/adherentstats.class.php b/htdocs/adherents/class/adherentstats.class.php index 27173334e7d..83fe00991f3 100644 --- a/htdocs/adherents/class/adherentstats.class.php +++ b/htdocs/adherents/class/adherentstats.class.php @@ -172,7 +172,7 @@ class AdherentStats extends Stats /** * Return nb, total and average * - * @return array Array with nb, total amount, average for each year + * @return array Array with nb, total amount, average for each year */ public function getAllByYear() { diff --git a/htdocs/admin/invoice.php b/htdocs/admin/invoice.php index 163cb2cdab5..6ec4e02bd69 100644 --- a/htdocs/admin/invoice.php +++ b/htdocs/admin/invoice.php @@ -9,6 +9,7 @@ * Copyright (C) 2022 Anthony Berton * Copyright (C) 2024 MDW * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 Alexandre Spangaro * * 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 @@ -758,6 +759,17 @@ print ""; print ajax_combobox("chq", array(), 0, 0, 'resolve', '-2'); print ""; + +// Structured communication +// Specific to Belgium - See core/lib/functions_be.lib.php +if ($mysoc->country_code == 'BE') { + print '' . $langs->trans("InvoicePaymentManageStructuredCommunication") . ' '; + print $form->textwithpicto('', $langs->trans("InvoicePaymentManageStructuredCommunicationHelp"), 1, 'help') . ''; + print ''; + print ajax_constantonoff('INVOICE_PAYMENT_ENABLE_STRUCTURED_COMMUNICATION'); + print ''; +} + print ""; print ''; diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index e36c446c064..48aa3b76946 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -1123,7 +1123,7 @@ if ($num) { print "\n"; print ''; - print ''; + print ''; $fieldsforcontent = array('topic', 'email_from','joinfiles', 'content'); if (getDolGlobalString('MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES')) { @@ -1155,7 +1155,7 @@ if ($num) { } if ($tmpfieldlist == 'content') { - print $form->textwithpicto($langs->trans("Content"), $tabhelp[25][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'
'; + print $form->textwithpicto($langs->trans("Content"), $tabhelp[25][$tmpfieldlist], 1, 'help', 'margintoponly', 0, 2, $tmpfieldlist).'
'; $okforextended = true; if (!getDolGlobalString('FCKEDITOR_ENABLE_MAIL')) { $okforextended = false; @@ -1165,7 +1165,7 @@ if ($num) { } if ($tmpfieldlist == 'content_lines') { print '
'."\n"; - print $form->textwithpicto($langs->trans("ContentForLines"), $tabhelp[25][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'
'; + print $form->textwithpicto($langs->trans("ContentForLines"), $tabhelp[25][$tmpfieldlist], 1, 'help', 'margintoponly', 0, 2, $tmpfieldlist).'
'; $okforextended = true; if (!getDolGlobalString('FCKEDITOR_ENABLE_MAIL')) { $okforextended = false; diff --git a/htdocs/bom/lib/bom.lib.php b/htdocs/bom/lib/bom.lib.php index c98d314741d..360e6a868ff 100644 --- a/htdocs/bom/lib/bom.lib.php +++ b/htdocs/bom/lib/bom.lib.php @@ -1,6 +1,7 @@ * Copyright (C) 2019-2023 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 @@ -25,7 +26,7 @@ /** * Prepare admin pages header * - * @return array + * @return array Array of tabs to show */ function bomAdminPrepareHead() { @@ -73,7 +74,7 @@ function bomAdminPrepareHead() * Prepare array of tabs for BillOfMaterials * * @param BOM $object BillOfMaterials - * @return array Array of tabs + * @return array Array of tabs to show */ function bomPrepareHead($object) { diff --git a/htdocs/bookcal/booking_list.php b/htdocs/bookcal/booking_list.php index 29fd7c9d005..f00e0303550 100644 --- a/htdocs/bookcal/booking_list.php +++ b/htdocs/bookcal/booking_list.php @@ -95,7 +95,7 @@ if (!$permissiontoread) { * Actions */ -$parameters = ''; +$parameters = array(); $helpurl = ''; $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { diff --git a/htdocs/bookcal/lib/bookcal.lib.php b/htdocs/bookcal/lib/bookcal.lib.php index 049de3c6472..8ce10a34009 100644 --- a/htdocs/bookcal/lib/bookcal.lib.php +++ b/htdocs/bookcal/lib/bookcal.lib.php @@ -1,6 +1,7 @@ * 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 @@ -25,7 +26,7 @@ /** * Prepare admin pages header * - * @return array + * @return array Array of tabs to show */ function bookcalAdminPrepareHead() { diff --git a/htdocs/bookcal/lib/bookcal_availabilities.lib.php b/htdocs/bookcal/lib/bookcal_availabilities.lib.php index a91e79cce52..558470345b6 100644 --- a/htdocs/bookcal/lib/bookcal_availabilities.lib.php +++ b/htdocs/bookcal/lib/bookcal_availabilities.lib.php @@ -1,6 +1,7 @@ * 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 @@ -26,7 +27,7 @@ * Prepare array of tabs for Availabilities * * @param Availabilities $object Availabilities - * @return array Array of tabs + * @return array Array of tabs to show */ function availabilitiesPrepareHead($object) { diff --git a/htdocs/bookcal/lib/bookcal_calendar.lib.php b/htdocs/bookcal/lib/bookcal_calendar.lib.php index 9a2bd1213e2..37cdcd18798 100644 --- a/htdocs/bookcal/lib/bookcal_calendar.lib.php +++ b/htdocs/bookcal/lib/bookcal_calendar.lib.php @@ -1,6 +1,7 @@ * 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 @@ -26,7 +27,7 @@ * Prepare array of tabs for Calendar * * @param Calendar $object Calendar - * @return array Array of tabs + * @return array Array of tabs to show */ function calendarPrepareHead($object) { diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 035736b0e03..649385d7d15 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -263,12 +263,12 @@ class Categorie extends CommonObject public $cats = array(); /** - * @var array Mother of table + * @var array Mother of table */ public $motherof = array(); /** - * @var array children + * @var Categorie[] children */ public $childs = array(); @@ -338,7 +338,7 @@ class Categorie extends CommonObject /** * Get map list * - * @return array + * @return array */ public function getMapList() { @@ -361,7 +361,7 @@ class Categorie extends CommonObject /** * Get MAP_ID * - * @return array + * @return array */ public function getMapId() { @@ -1105,7 +1105,7 @@ class Categorie extends CommonObject /** * Return direct children ids of a category into an array * - * @return array|int Return integer <0 KO, array ok + * @return Categorie[]|int Return integer <0 KO, array ok */ public function get_filles() { @@ -1337,14 +1337,14 @@ class Categorie extends CommonObject /** * Returns all categories * - * @param int $type Type of category (0, 1, ...) + * @param ?int $type Type of category (0, 1, ...) * @param boolean $parent Just parent categories if true - * @return array|int Table of Object Category, -1 on error + * @return array|int<-1,-1> Table of Object Category, -1 on error */ public function get_all_categories($type = null, $parent = false) { // phpcs:enable - if (!is_numeric($type)) { + if (!is_numeric($type) && !is_null($type)) { $type = $this->MAP_ID[$type]; } @@ -1376,8 +1376,8 @@ class Categorie extends CommonObject /** * Returns the top level categories (which are not child) * - * @param int $type Type of category (0, 1, ...) - * @return array + * @param ?int $type Type of category (0, 1, ...) + * @return array|int<-1,-1> Table of Object Category, -1 on error */ public function get_main_categories($type = null) { @@ -1443,7 +1443,7 @@ class Categorie extends CommonObject * @param string $url Url ('', 'none' or 'urltouse') * @param int $nocolor 0 * @param int $addpicto Add picto into link - * @return array + * @return string[] */ public function print_all_ways($sep = '>>', $url = '', $nocolor = 0, $addpicto = 0) { @@ -1850,9 +1850,9 @@ class Categorie extends CommonObject /** * Add the image uploaded as $file to the directory $sdir/-/photos/ * - * @param string $sdir Root destination directory - * @param array $file Uploaded file name - * @return void + * @param string $sdir Root destination directory + * @param array{name:string,tmp_name:string} $file Uploaded file name + * @return void */ public function add_photo($sdir, $file) { @@ -1898,9 +1898,9 @@ class Categorie extends CommonObject /** * Return an array with all photos inside the directory * - * @param string $dir Dir to scan - * @param int $nbmax Nombre maximum de photos (0=pas de max) - * @return array Tableau de photos + * @param string $dir Dir to scan + * @param int $nbmax Nombre maximum de photos (0=pas de max) + * @return array Table with images */ public function liste_photos($dir, $nbmax = 0) { @@ -1997,7 +1997,7 @@ class Categorie extends CommonObject } /** - * Update ou cree les traductions des infos produits + * Create or Update translations of categories labels * * @param User $user Object user * @param int $notrigger 1=Does not execute triggers, 0= execute triggers @@ -2021,7 +2021,7 @@ class Categorie extends CommonObject if ($key == $current_lang) { $sql2 = ''; - if ($this->db->num_rows($result)) { // si aucune ligne dans la base + if ($this->db->num_rows($result)) { // if no line in database $sql2 = "UPDATE ".MAIN_DB_PREFIX."categorie_lang"; $sql2 .= " SET label = '".$this->db->escape($this->label)."',"; $sql2 .= " description = '".$this->db->escape($this->description)."'"; @@ -2037,7 +2037,7 @@ class Categorie extends CommonObject return -1; } } elseif (isset($this->multilangs[$key])) { - if ($this->db->num_rows($result)) { // si aucune ligne dans la base + if ($this->db->num_rows($result)) { // if no line in database $sql2 = "UPDATE ".MAIN_DB_PREFIX."categorie_lang"; $sql2 .= " SET label='".$this->db->escape($this->multilangs[$key]["label"])."',"; $sql2 .= " description='".$this->db->escape($this->multilangs[$key]["description"])."'"; @@ -2179,7 +2179,7 @@ class Categorie extends CommonObject * * @param string $type The category type (e.g Categorie::TYPE_WAREHOUSE) * @param string $rowIdName The name of the row id inside the whole sql query (e.g. "e.rowid") - * @param Array $searchList A list with the selected categories + * @param string[] $searchList A list with the selected categories * @return string A additional SQL SELECT query * @deprecated search on some categories must be done using a WHERE EXISTS or NOT EXISTS and not a LEFT JOIN */ diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 6ad82fd0362..e0cbadb55b4 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -66,6 +66,10 @@ if (isModEnabled('member')) { if (isModEnabled('intervention')) { require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; } +if (isModEnabled('accounting')) { + require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; + require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; +} // Load translation files required by the page $langs->loadLangs(array('companies', 'banks')); @@ -373,12 +377,20 @@ if ($object->id > 0) { print ''; if (isModEnabled('accounting')) { - require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; + $formaccounting = new FormAccounting($db); + print ''; print ''; print $form->editfieldkey("CustomerAccountancyCodeGeneral", 'customeraccountancycodegeneral', length_accountg($object->accountancy_code_customer_general), $object, $user->hasRight('societe', 'creer')); print ''; - print $form->editfieldval("CustomerAccountancyCodeGeneral", 'customeraccountancycodegeneral', length_accountg($object->accountancy_code_customer_general), $object, $user->hasRight('societe', 'creer')); + if ($action == 'editcustomeraccountancycodegeneral' && $user->hasRight('societe', 'creer')) { + print $formaccounting->formAccountingAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->accountancy_code_customer_general, 'customeraccountancycodegeneral', 0, 1, '', 1); + } else { + $accountingaccount = new AccountingAccount($db); + $accountingaccount->fetch(0, $object->accountancy_code_customer_general, 1); + + print $accountingaccount->getNomUrl(0, 1, 1, '', 1); + } $accountingAccountByDefault = " (" . $langs->trans("AccountingAccountByDefaultShort") . ": " . length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER')) . ")"; print (getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER') ? $accountingAccountByDefault : ''); print ''; diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index ad445ce6fe0..c70f8e846b9 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1454,6 +1454,11 @@ if (empty($reshook)) { if ($result > 0) { $db->commit(); + $ret = $object->fetch($id); // Reload to get new records + if ($ret > 0) { + $object->fetch_thirdparty(); + } + if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) { // Define output language $outputlangs = $langs; @@ -1462,10 +1467,6 @@ if (empty($reshook)) { $newlang = (GETPOST('lang_id', 'aZ09') ? GETPOST('lang_id', 'aZ09') : $object->thirdparty->default_lang); $outputlangs->setDefaultLang($newlang); } - $ret = $object->fetch($id); // Reload to get new records - if ($ret > 0) { - $object->fetch_thirdparty(); - } $object->generateDocument($object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref); } diff --git a/htdocs/comm/propal/class/propalestats.class.php b/htdocs/comm/propal/class/propalestats.class.php index 3e134a91669..a96dc3486f8 100644 --- a/htdocs/comm/propal/class/propalestats.class.php +++ b/htdocs/comm/propal/class/propalestats.class.php @@ -137,7 +137,7 @@ class PropaleStats extends Stats * * @param int $year Year to scan * @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month - * @return array Array with number by month + * @return array,array{0:int<1,12>,1:int}> Array with number by month */ public function getNbByMonth($year, $format = 0) { @@ -161,7 +161,7 @@ class PropaleStats extends Stats /** * Return propals number per year * - * @return array Array with number by year + * @return array Array of nb each year * */ public function getNbByYear() @@ -186,7 +186,7 @@ class PropaleStats extends Stats * * @param int $year Year to scan * @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month - * @return array Array with amount by month + * @return array,array{0:int<1,12>,1:int|float}> Array with amount by month */ public function getAmountByMonth($year, $format = 0) { @@ -211,7 +211,7 @@ class PropaleStats extends Stats * Return the propals amount average by month for a year * * @param int $year year for stats - * @return array array with number by month + * @return array,array{0:int<1,12>,1:int|float}> Array with number by month */ public function getAverageByMonth($year) { @@ -234,7 +234,7 @@ class PropaleStats extends Stats /** * Return nb, total and average * - * @return array Array of values + * @return array Array with nb, total amount, average for each year */ public function getAllByYear() { diff --git a/htdocs/comm/propal/stats/index.php b/htdocs/comm/propal/stats/index.php index 3db4d075dd4..c17659abe8b 100644 --- a/htdocs/comm/propal/stats/index.php +++ b/htdocs/comm/propal/stats/index.php @@ -334,7 +334,7 @@ print ''; $oldyear = 0; foreach ($data as $val) { $year = $val['year']; - while (!empty($year) && $oldyear > $year + 1) { // If we have empty year + while (!empty($year) && $oldyear > (int) $year + 1) { // If we have empty year $oldyear--; print ''; diff --git a/htdocs/commande/class/commandestats.class.php b/htdocs/commande/class/commandestats.class.php index ca2bc3e8826..f7fb16a08d2 100644 --- a/htdocs/commande/class/commandestats.class.php +++ b/htdocs/commande/class/commandestats.class.php @@ -5,6 +5,7 @@ * Copyright (C) 2012 Marcos García * Copyright (C) 2020 Maxime DEMAREST * 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 @@ -150,7 +151,7 @@ class CommandeStats extends Stats * * @param int $year Year to scan * @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month - * @return array Array with number by month + * @return array,array{0:int<1,12>,1:int}> Array with number by month */ public function getNbByMonth($year, $format = 0) { @@ -174,7 +175,7 @@ class CommandeStats extends Stats /** * Return orders number per year * - * @return array Array with number by year + * @return array Array of nb each year * */ public function getNbByYear() @@ -199,7 +200,7 @@ class CommandeStats extends Stats * * @param int $year Year to scan * @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month - * @return array Array with amount by month + * @return array,array{0:int<1,12>,1:int|float}> Array with amount by month */ public function getAmountByMonth($year, $format = 0) { @@ -224,7 +225,7 @@ class CommandeStats extends Stats * Return the orders amount average by month for a year * * @param int $year year for stats - * @return array array with number by month + * @return array,array{0:int<1,12>,1:int|float}> Array with number by month */ public function getAverageByMonth($year) { @@ -247,7 +248,7 @@ class CommandeStats extends Stats /** * Return nb, total and average * - * @return array Array of values + * @return array Array of values */ public function getAllByYear() { @@ -271,7 +272,7 @@ class CommandeStats extends Stats * * @param int $year Year to scan * @param int $limit Limit - * @return array Array of values + * @return array,array{0:int<1,12>,1:int|float}> Array of values */ public function getAllByProduct($year, $limit = 10) { diff --git a/htdocs/commande/stats/index.php b/htdocs/commande/stats/index.php index adb5ab5b7d8..72c265f8242 100644 --- a/htdocs/commande/stats/index.php +++ b/htdocs/commande/stats/index.php @@ -136,6 +136,7 @@ $data = $stats->getNbByMonthWithPrevYear($endyear, $startyear); // $data = array(array('Lib',val1,val2,val3),...) +$fileurlnb = ''; if (!$user->hasRight('societe', 'client', 'voir')) { $filenamenb = $dir.'/ordersnbinyear-'.$user->id.'-'.$year.'.png'; if ($mode == 'customer') { @@ -183,6 +184,7 @@ $data = $stats->getAmountByMonthWithPrevYear($endyear, $startyear); //var_dump($data); // $data = array(array('Lib',val1,val2,val3),...) +$fileurlamount = ''; if (!$user->hasRight('societe', 'client', 'voir')) { $filenameamount = $dir.'/ordersamountinyear-'.$user->id.'-'.$year.'.png'; if ($mode == 'customer') { @@ -228,6 +230,8 @@ if (!$mesg) { $data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear); + +$fileurl_avg = ''; if (!$user->hasRight('societe', 'client', 'voir')) { $filename_avg = $dir.'/ordersaverage-'.$user->id.'-'.$year.'.png'; if ($mode == 'customer') { @@ -334,6 +338,8 @@ if ($user->admin) { } print ''; // Category +$cat_type = 0; +$cat_label = ''; if ($mode == 'customer') { $cat_type = Categorie::TYPE_CUSTOMER; $cat_label = $langs->trans("Category").' '.lcfirst($langs->trans("Customer")); @@ -398,7 +404,7 @@ print ''; $oldyear = 0; foreach ($data as $val) { $year = $val['year']; - while (!empty($year) && $oldyear > $year + 1) { // If we have empty year + while (!empty($year) && $oldyear > (int) $year + 1) { // If we have empty year $oldyear--; print ''; diff --git a/htdocs/compta/deplacement/class/deplacementstats.class.php b/htdocs/compta/deplacement/class/deplacementstats.class.php index 6f2d814d298..aabb1b77f38 100644 --- a/htdocs/compta/deplacement/class/deplacementstats.class.php +++ b/htdocs/compta/deplacement/class/deplacementstats.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003 Rodolphe Quiedeville * Copyright (c) 2005-2008 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin + * 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 @@ -35,11 +36,26 @@ class DeplacementStats extends Stats */ public $table_element; + /** + * @var int + */ public $socid; + /** + * @var int + */ public $userid; + /** + * @var string + */ public $from; + /** + * @var string + */ public $field; + /** + * @var string + */ public $where; /** @@ -47,7 +63,7 @@ class DeplacementStats extends Stats * * @param DoliDB $db Database handler * @param int $socid Id third party - * @param mixed $userid Id user for filter or array of user ids + * @param int|int[] $userid Id user for filter or array of user ids * @return void */ public function __construct($db, $socid = 0, $userid = 0) @@ -78,7 +94,7 @@ class DeplacementStats extends Stats /** * Renvoie le nombre de facture par annee * - * @return array Array of values + * @return array Array of nb each year */ public function getNbByYear() { @@ -96,7 +112,7 @@ class DeplacementStats extends Stats * * @param int $year Year to scan * @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month - * @return array Array of values + * @return array,array{0:int<1,12>,1:int}> Array with number by month */ public function getNbByMonth($year, $format = 0) { @@ -118,7 +134,7 @@ class DeplacementStats extends Stats * * @param int $year Year to scan * @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month - * @return array Array of values + * @return array,array{0:int<1,12>,1:int|float}> Array of values */ public function getAmountByMonth($year, $format = 0) { @@ -138,7 +154,7 @@ class DeplacementStats extends Stats * Return average amount * * @param int $year Year to scan - * @return array Array of values + * @return array,array{0:int<1,12>,1:int|float}> Array with number by month */ public function getAverageByMonth($year) { @@ -155,7 +171,7 @@ class DeplacementStats extends Stats /** * Return nb, total and average * - * @return array Array of values + * @return array Array of values */ public function getAllByYear() { diff --git a/htdocs/compta/deplacement/stats/index.php b/htdocs/compta/deplacement/stats/index.php index 33520b4d3b6..55b28a9102d 100644 --- a/htdocs/compta/deplacement/stats/index.php +++ b/htdocs/compta/deplacement/stats/index.php @@ -167,6 +167,7 @@ if (!$mesg) { $data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear); +$filename_avg = ''; if (!$user->hasRight('societe', 'client', 'voir')) { $filename_avg = $dir.'/ordersaverage-'.$user->id.'-'.$year.'.png'; if ($mode == 'customer') { @@ -282,7 +283,7 @@ print ''; $oldyear = 0; foreach ($data as $val) { $year = $val['year']; - while ($year && $oldyear > $year + 1) { // If we have empty year + while ($year && $oldyear > (int) $year + 1) { // If we have empty year $oldyear--; print ''; print ''.$oldyear.''; diff --git a/htdocs/compta/facture/class/facturestats.class.php b/htdocs/compta/facture/class/facturestats.class.php index bde740a2666..9750fff5f5b 100644 --- a/htdocs/compta/facture/class/facturestats.class.php +++ b/htdocs/compta/facture/class/facturestats.class.php @@ -154,7 +154,7 @@ class FactureStats extends Stats /** * Return invoices number per year * - * @return array Array with number by year + * @return array Array of nb each year */ public function getNbByYear() { @@ -228,7 +228,7 @@ class FactureStats extends Stats /** * Return nb, total and average * - * @return array Array of values + * @return array Array of values */ public function getAllByYear() { diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 979c9541416..89919a8b1d5 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -2267,7 +2267,7 @@ class BonPrelevement extends CommonObject public function EnregDestinataireSEPA($row_code_client, $row_nom, $row_address, $row_zip, $row_town, $row_country_code, $row_cb, $row_cg, $row_cc, $row_somme, $row_ref, $row_idfac, $row_iban, $row_bic, $row_datec, $row_drum, $row_rum, $type = 'direct-debit', $row_comment = '') { // phpcs:enable - global $conf; + global $conf, $mysoc; if (getDolGlobalString('SEPA_FORCE_TWO_DECIMAL')) { $row_somme = number_format((float) price2num($row_somme, 'MT'), 2, ".", ""); @@ -2330,8 +2330,20 @@ class BonPrelevement extends CommonObject $XML_DEBITOR .= ' ' . $CrLf; $XML_DEBITOR .= ' ' . $CrLf; $XML_DEBITOR .= ' ' . $CrLf; - // A string with some information on payment - 140 max - $XML_DEBITOR .= ' ' . getDolGlobalString('PRELEVEMENT_USTRD', dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($row_ref . ($row_comment ? ' - ' . $row_comment : '')), '', '', '', 1), 135, 'right', 'UTF-8', 1))) . '' . $CrLf; // Free unstuctured data - 140 max + + // Structured data for Belgium + if (getDolGlobalString('INVOICE_PAYMENT_ENABLE_STRUCTURED_COMMUNICATION') && $mysoc->country_code == 'BE') { + include_once DOL_DOCUMENT_ROOT.'/core/lib/functions_be.lib.php'; + + $invoicestatic = new Facture($this->db); + $invoicestatic->fetch($row_idfac); + + $invoicePaymentKey = dolBECalculateStructuredCommunication($invoicestatic->ref, $invoicestatic->type); + $XML_DEBITOR .= ' ' . $invoicePaymentKey . '' . $CrLf; + } else { + // A string with some information on payment - 140 max + $XML_DEBITOR .= ' ' . getDolGlobalString('PRELEVEMENT_USTRD', dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($row_ref . ($row_comment ? ' - ' . $row_comment : '')), '', '', '', 1), 135, 'right', 'UTF-8', 1))) . '' . $CrLf; // Free unstuctured data - 140 max + } $XML_DEBITOR .= ' ' . $CrLf; $XML_DEBITOR .= ' ' . $CrLf; return $XML_DEBITOR; diff --git a/htdocs/core/boxes/box_actions.php b/htdocs/core/boxes/box_actions.php index dff2d54a91c..4d9954669eb 100644 --- a/htdocs/core/boxes/box_actions.php +++ b/htdocs/core/boxes/box_actions.php @@ -55,6 +55,9 @@ class box_actions extends ModeleBoxes $this->enabled = isModEnabled('agenda'); $this->hidden = !($user->hasRight('agenda', 'myactions', 'read')); + + $this->urltoaddentry = DOL_URL_ROOT.'/comm/action/card.php?action=create'; + $this->msgNoRecords = 'NoActionsToDo'; } /** @@ -173,12 +176,12 @@ class box_actions extends ModeleBoxes $line++; } - if ($num == 0) { - $this->info_box_contents[$line][0] = array( - 'td' => 'class="center"', - 'text' => ''.$langs->trans("NoActionsToDo").'' - ); - } + // if ($num == 0) { + // $this->info_box_contents[$line][0] = array( + // 'td' => 'class="center"', + // 'text' => ''.$langs->trans("NoActionsToDo").'' + // ); + // } $this->db->free($result); } else { diff --git a/htdocs/core/boxes/box_boms.php b/htdocs/core/boxes/box_boms.php index e5c8a0ca6e6..99ca90917e2 100644 --- a/htdocs/core/boxes/box_boms.php +++ b/htdocs/core/boxes/box_boms.php @@ -51,6 +51,8 @@ class box_boms extends ModeleBoxes $this->db = $db; $this->hidden = !$user->hasRight('bom', 'read'); + $this->urltoaddentry = DOL_URL_ROOT.'/bom/bom_card.php?action=create'; + $this->msgNoRecords = 'NoRecordedOrders'; } /** @@ -149,12 +151,12 @@ class box_boms extends ModeleBoxes $line++; } - if ($num == 0) { - $this->info_box_contents[$line][0] = array( - 'td' => 'class="center"', - 'text' => ''.$langs->trans("NoRecordedOrders").'' - ); - } + // if ($num == 0) { + // $this->info_box_contents[$line][0] = array( + // 'td' => 'class="center"', + // 'text' => ''.$langs->trans("NoRecordedOrders").'' + // ); + // } $this->db->free($result); } else { diff --git a/htdocs/core/boxes/box_bookmarks.php b/htdocs/core/boxes/box_bookmarks.php index 9c025931400..ddaf6749dfd 100644 --- a/htdocs/core/boxes/box_bookmarks.php +++ b/htdocs/core/boxes/box_bookmarks.php @@ -47,6 +47,8 @@ class box_bookmarks extends ModeleBoxes $this->db = $db; $this->hidden = !$user->hasRight('bookmark', 'lire'); + $this->urltoaddentry = DOL_URL_ROOT.'/bookmarks/card.php?action=create'; + $this->msgNoRecords = 'NoRecordedBookmarks'; } /** @@ -109,17 +111,17 @@ class box_bookmarks extends ModeleBoxes $line++; } - if ($num == 0) { - $mytxt = $langs->trans("NoRecordedBookmarks"); - if ($user->hasRight("bookmark", "creer")) { - $mytxt .= ' '.$langs->trans("ClickToAdd"); - } - $this->info_box_contents[$line][0] = array( - 'td' => 'class="center" colspan="2"', - 'tooltip' => $mytxt, - 'url' => DOL_URL_ROOT.'/bookmarks/list.php', 'text' => $mytxt, - ); - } + // if ($num == 0) { + // $mytxt = $langs->trans("NoRecordedBookmarks"); + // if ($user->hasRight("bookmark", "creer")) { + // $mytxt .= ' '.$langs->trans("ClickToAdd"); + // } + // $this->info_box_contents[$line][0] = array( + // 'td' => 'class="center" colspan="2"', + // 'tooltip' => $mytxt, + // 'url' => DOL_URL_ROOT.'/bookmarks/list.php', 'text' => $mytxt, + // ); + // } $this->db->free($result); } else { diff --git a/htdocs/core/boxes/box_clients.php b/htdocs/core/boxes/box_clients.php index 0b18e3ca48f..8d30c4f3505 100644 --- a/htdocs/core/boxes/box_clients.php +++ b/htdocs/core/boxes/box_clients.php @@ -58,6 +58,9 @@ class box_clients extends ModeleBoxes } $this->hidden = !($user->hasRight('societe', 'read') && empty($user->socid)); + + $this->urltoaddentry = DOL_URL_ROOT.'/societe/card.php?action=create&type=c'; + $this->msgNoRecords = 'NoRecordedCustomers'; } /** @@ -147,12 +150,6 @@ class box_clients extends ModeleBoxes $line++; } - if ($num == 0) { - $this->info_box_contents[$line][0] = array( - 'td' => 'class="center"', - 'text' => ''.$langs->trans("NoRecordedCustomers").'' - ); - } $this->db->free($result); } else { diff --git a/htdocs/core/boxes/box_commandes.php b/htdocs/core/boxes/box_commandes.php index de80645db7d..288492c9601 100644 --- a/htdocs/core/boxes/box_commandes.php +++ b/htdocs/core/boxes/box_commandes.php @@ -51,6 +51,10 @@ class box_commandes extends ModeleBoxes $this->db = $db; $this->hidden = !$user->hasRight('commande', 'lire'); + + $this->urltoaddentry = DOL_URL_ROOT.'/commande/card.php?action=create'; + + $this->msgNoRecords = 'NoRecordedOrders'; } /** @@ -186,12 +190,6 @@ class box_commandes extends ModeleBoxes $line++; } - if ($num == 0) { - $this->info_box_contents[$line][0] = array( - 'td' => 'class="center"', - 'text' => ''.$langs->trans("NoRecordedOrders").'' - ); - } $this->db->free($result); } else { diff --git a/htdocs/core/boxes/box_comptes.php b/htdocs/core/boxes/box_comptes.php index dc0a9e29354..f67bf006148 100644 --- a/htdocs/core/boxes/box_comptes.php +++ b/htdocs/core/boxes/box_comptes.php @@ -60,6 +60,8 @@ class box_comptes extends ModeleBoxes } $this->hidden = !$user->hasRight('banque', 'lire'); + $this->urltoaddentry = DOL_URL_ROOT.'/compta/bank/card.php?action=create'; + $this->msgNoRecords = 'NoRecordedBankAccounts'; } /** @@ -164,12 +166,6 @@ class box_comptes extends ModeleBoxes $line++; } - if ($num == 0) { - $this->info_box_contents[$line][0] = array( - 'td' => 'class="center"', - 'text' => ''.$langs->trans("NoRecordedBankAccounts").'' - ); - } $this->db->free($result); } else { diff --git a/htdocs/core/boxes/box_contacts.php b/htdocs/core/boxes/box_contacts.php index 06a5db32149..5b95234e478 100644 --- a/htdocs/core/boxes/box_contacts.php +++ b/htdocs/core/boxes/box_contacts.php @@ -54,6 +54,9 @@ class box_contacts extends ModeleBoxes $this->db = $db; $this->hidden = !($user->hasRight('societe', 'lire') && $user->hasRight('societe', 'contact', 'lire')); + + $this->urltoaddentry = DOL_URL_ROOT.'/contact/card.php?action=create'; + $this->msgNoRecords = 'NoRecordedContacts'; } /** @@ -183,13 +186,13 @@ class box_contacts extends ModeleBoxes $line++; } - if ($num == 0) { - $this->info_box_contents[$line][0] = array( - 'td' => 'class="center"', - 'text' => ''.$langs->trans("NoRecordedContacts").'', - 'asis' => 1 - ); - } + // if ($num == 0) { + // $this->info_box_contents[$line][0] = array( + // 'td' => 'class="center"', + // 'text' => ''.$langs->trans("NoRecordedContacts").'', + // 'asis' => 1 + // ); + // } $this->db->free($result); } else { diff --git a/htdocs/core/boxes/box_contracts.php b/htdocs/core/boxes/box_contracts.php index d3c66fce04b..e7700692e3e 100644 --- a/htdocs/core/boxes/box_contracts.php +++ b/htdocs/core/boxes/box_contracts.php @@ -50,6 +50,8 @@ class box_contracts extends ModeleBoxes $this->db = $db; $this->hidden = !($user->hasRight('contrat', 'lire')); + $this->urltoaddentry = DOL_URL_ROOT.'/contrat/card.php?action=create'; + $this->msgNoRecords = 'NoRecordedContracts'; } /** @@ -162,12 +164,12 @@ class box_contracts extends ModeleBoxes $line++; } - if ($num == 0) { - $this->info_box_contents[$line][0] = array( - 'td' => 'class="center"', - 'text' => ''.$langs->trans("NoRecordedContracts").'' - ); - } + // if ($num == 0) { + // $this->info_box_contents[$line][0] = array( + // 'td' => 'class="center"', + // 'text' => ''.$langs->trans("NoRecordedContracts").'' + // ); + // } $this->db->free($resql); } else { diff --git a/htdocs/core/boxes/box_external_rss.php b/htdocs/core/boxes/box_external_rss.php index 73f69b2d723..07829e463c4 100644 --- a/htdocs/core/boxes/box_external_rss.php +++ b/htdocs/core/boxes/box_external_rss.php @@ -52,6 +52,7 @@ class box_external_rss extends ModeleBoxes { $this->db = $db; $this->paramdef = $param; + $this->urltoaddentry = DOL_URL_ROOT.'/admin/external_rss.php'; } /** diff --git a/htdocs/core/boxes/box_factures.php b/htdocs/core/boxes/box_factures.php index 408fcb1fa49..ee333e1eec5 100644 --- a/htdocs/core/boxes/box_factures.php +++ b/htdocs/core/boxes/box_factures.php @@ -49,6 +49,8 @@ class box_factures extends ModeleBoxes $this->db = $db; $this->hidden = !$user->hasRight('facture', 'lire'); + $this->urltoaddentry = DOL_URL_ROOT.'/compta/facture/card.php?action=create'; + $this->msgNoRecords = 'NoRecordedInvoices'; } /** @@ -197,12 +199,12 @@ class box_factures extends ModeleBoxes $line++; } - if ($num == 0) { - $this->info_box_contents[$line][0] = array( - 'td' => 'class="center"', - 'text' => ''.$langs->trans("NoRecordedInvoices").'', - ); - } + // if ($num == 0) { + // $this->info_box_contents[$line][0] = array( + // 'td' => 'class="center"', + // 'text' => ''.$langs->trans("NoRecordedInvoices").'', + // ); + // } $this->db->free($result); } else { diff --git a/htdocs/core/boxes/box_factures_fourn.php b/htdocs/core/boxes/box_factures_fourn.php index dceb3d6843c..511a041a035 100644 --- a/htdocs/core/boxes/box_factures_fourn.php +++ b/htdocs/core/boxes/box_factures_fourn.php @@ -50,6 +50,8 @@ class box_factures_fourn extends ModeleBoxes $this->db = $db; $this->hidden = !($user->hasRight('fournisseur', 'facture', 'lire')); + $this->urltoaddentry = DOL_URL_ROOT.'/fourn/facture/card.php?action=create'; + $this->msgNoRecords = 'NoModifiedSupplierBills'; } /** @@ -193,12 +195,12 @@ class box_factures_fourn extends ModeleBoxes $line++; } - if ($num == 0) { - $this->info_box_contents[$line][0] = array( - 'td' => 'class="center"', - 'text' => ''.$langs->trans("NoModifiedSupplierBills").'', - ); - } + // if ($num == 0) { + // $this->info_box_contents[$line][0] = array( + // 'td' => 'class="center"', + // 'text' => ''.$langs->trans("NoModifiedSupplierBills").'', + // ); + // } $this->db->free($result); } else { diff --git a/htdocs/core/boxes/box_factures_imp.php b/htdocs/core/boxes/box_factures_imp.php index d6a24e31576..cf4d4967a16 100644 --- a/htdocs/core/boxes/box_factures_imp.php +++ b/htdocs/core/boxes/box_factures_imp.php @@ -53,6 +53,8 @@ class box_factures_imp extends ModeleBoxes $this->db = $db; $this->hidden = !($user->hasRight('facture', 'lire')); + $this->urltoaddentry = DOL_URL_ROOT.'/compta/facture/card.php?action=create'; + $this->msgNoRecords = 'NoUnpaidCustomerBills'; } /** @@ -220,10 +222,10 @@ class box_factures_imp extends ModeleBoxes } if ($num == 0) { - $this->info_box_contents[$line][0] = array( - 'td' => 'class="center" colspan="3"', - 'text' => ''.$langs->trans("NoUnpaidCustomerBills").'' - ); + // $this->info_box_contents[$line][0] = array( + // 'td' => 'class="center" colspan="3"', + // 'text' => ''.$langs->trans("NoUnpaidCustomerBills").'' + // ); } else { $sql = "SELECT SUM(f.total_ht) as total_ht ".$sql2; diff --git a/htdocs/core/boxes/box_fediverse.php b/htdocs/core/boxes/box_fediverse.php index 7ce725e741a..b4cd84fc642 100644 --- a/htdocs/core/boxes/box_fediverse.php +++ b/htdocs/core/boxes/box_fediverse.php @@ -50,6 +50,8 @@ class box_fediverse extends ModeleBoxes { $this->db = $db; $this->paramdef = $param; + $this->urltoaddentry = DOL_URL_ROOT.'/admin/fediverse.php'; + $this->msgNoRecords = 'NoRecordFound'; } /** @@ -150,12 +152,12 @@ class box_fediverse extends ModeleBoxes } - if ($nbitems == 0) { - $this->info_box_contents[$line][0] = array( - 'td' => 'class="center"', - 'text' => ''.$langs->trans("NoRecordFound").'' - ); - } + // if ($nbitems == 0) { + // $this->info_box_contents[$line][0] = array( + // 'td' => 'class="center"', + // 'text' => ''.$langs->trans("NoRecordFound").'' + // ); + // } } diff --git a/htdocs/core/boxes/box_ficheinter.php b/htdocs/core/boxes/box_ficheinter.php index dfa059d4bf6..ff12319eebe 100644 --- a/htdocs/core/boxes/box_ficheinter.php +++ b/htdocs/core/boxes/box_ficheinter.php @@ -50,6 +50,8 @@ class box_ficheinter extends ModeleBoxes $this->db = $db; $this->hidden = !($user->hasRight('ficheinter', 'lire')); + $this->urltoaddentry = DOL_URL_ROOT.'/fichinter/card.php?action=create'; + $this->msgNoRecords = 'NoRecordedInterventions'; } /** @@ -151,12 +153,12 @@ class box_ficheinter extends ModeleBoxes $i++; } - if ($num == 0) { - $this->info_box_contents[$i][0] = array( - 'td' => 'class="center"', - 'text' => ''.$langs->trans("NoRecordedInterventions").'' - ); - } + // if ($num == 0) { + // $this->info_box_contents[$i][0] = array( + // 'td' => 'class="center"', + // 'text' => ''.$langs->trans("NoRecordedInterventions").'' + // ); + // } $this->db->free($resql); } else { diff --git a/htdocs/core/boxes/box_fournisseurs.php b/htdocs/core/boxes/box_fournisseurs.php index 4917492036b..6cd7b8c3bab 100644 --- a/htdocs/core/boxes/box_fournisseurs.php +++ b/htdocs/core/boxes/box_fournisseurs.php @@ -51,6 +51,8 @@ class box_fournisseurs extends ModeleBoxes $this->db = $db; $this->hidden = !($user->hasRight('societe', 'read') && empty($user->socid)); + $this->urltoaddentry = DOL_URL_ROOT.'/societe/card.php?action=create&type=f'; + $this->msgNoRecords = 'NoRecordedSuppliers'; } /** @@ -138,13 +140,13 @@ class box_fournisseurs extends ModeleBoxes $line++; } - if ($num == 0) { - $langs->load("suppliers"); - $this->info_box_contents[$line][0] = array( - 'td' => 'class="center"', - 'text' => ''.$langs->trans("NoRecordedSuppliers").'' - ); - } + // if ($num == 0) { + // $langs->load("suppliers"); + // $this->info_box_contents[$line][0] = array( + // 'td' => 'class="center"', + // 'text' => ''.$langs->trans("NoRecordedSuppliers").'' + // ); + // } $this->db->free($result); } else { diff --git a/htdocs/core/boxes/box_members_last_subscriptions.php b/htdocs/core/boxes/box_members_last_subscriptions.php index 03c77b0500e..f6323dd7af9 100644 --- a/htdocs/core/boxes/box_members_last_subscriptions.php +++ b/htdocs/core/boxes/box_members_last_subscriptions.php @@ -59,6 +59,9 @@ class box_members_last_subscriptions extends ModeleBoxes } $this->hidden = !(isModEnabled('member') && $user->hasRight('adherent', 'lire')); + + $this->urltoaddentry = DOL_URL_ROOT.'/adherents/card.php?leftmenu=members&action=create'; + $this->msgNoRecords = 'NoRecordedMembers'; } /** @@ -156,12 +159,6 @@ class box_members_last_subscriptions extends ModeleBoxes $line++; } - if ($num == 0) { - $this->info_box_contents[$line][0] = array( - 'td' => 'class="center"', - 'text' => ''.$langs->trans("NoRecordedMembers").'', - ); - } $this->db->free($result); } else { diff --git a/htdocs/core/boxes/box_mos.php b/htdocs/core/boxes/box_mos.php index 214c38ced17..be80c7d4536 100644 --- a/htdocs/core/boxes/box_mos.php +++ b/htdocs/core/boxes/box_mos.php @@ -51,6 +51,9 @@ class box_mos extends ModeleBoxes $this->db = $db; $this->hidden = !$user->hasRight('bom', 'read'); + + $this->urltoaddentry = DOL_URL_ROOT.'/mrp/mo_card.php?action=create'; + $this->msgNoRecords = 'NoRecordedOrders'; } /** @@ -146,12 +149,6 @@ class box_mos extends ModeleBoxes $line++; } - if ($num == 0) { - $this->info_box_contents[$line][0] = array( - 'td' => 'class="center"', - 'text' => ''.$langs->trans("NoRecordedOrders").'' - ); - } $this->db->free($result); } else { diff --git a/htdocs/core/boxes/box_produits.php b/htdocs/core/boxes/box_produits.php index 52a27b151cb..db7710e960b 100644 --- a/htdocs/core/boxes/box_produits.php +++ b/htdocs/core/boxes/box_produits.php @@ -55,6 +55,8 @@ class box_produits extends ModeleBoxes $tmpentry = array('enabled' => (isModEnabled("product") || isModEnabled("service")), 'perms' => ($user->hasRight('produit', 'lire') || $user->hasRight('service', 'lire')), 'module' => 'product|service'); $showmode = isVisibleToUserType(($user->socid > 0 ? 1 : 0), $tmpentry, $listofmodulesforexternal); $this->hidden = ($showmode != 1); + $this->urltoaddentry = DOL_URL_ROOT.'/product/card.php?action=create'; + $this->msgNoRecords = 'NoRecordedProducts'; } /** @@ -210,12 +212,12 @@ class box_produits extends ModeleBoxes $line++; } - if ($num == 0) { - $this->info_box_contents[$line][0] = array( - 'td' => 'class="center"', - 'text' => $langs->trans("NoRecordedProducts"), - ); - } + // if ($num == 0) { + // $this->info_box_contents[$line][0] = array( + // 'td' => 'class="center"', + // 'text' => $langs->trans("NoRecordedProducts"), + // ); + // } $this->db->free($result); } else { diff --git a/htdocs/core/boxes/box_produits_alerte_stock.php b/htdocs/core/boxes/box_produits_alerte_stock.php index da714ede7ab..f2a18d04ccc 100644 --- a/htdocs/core/boxes/box_produits_alerte_stock.php +++ b/htdocs/core/boxes/box_produits_alerte_stock.php @@ -57,6 +57,8 @@ class box_produits_alerte_stock extends ModeleBoxes $tmpentry = array('enabled' => ((isModEnabled("product") || isModEnabled("service")) && isModEnabled('stock')), 'perms' => $user->hasRight('stock', 'lire'), 'module' => 'product|service|stock'); $showmode = isVisibleToUserType(($user->socid > 0 ? 1 : 0), $tmpentry, $listofmodulesforexternal); $this->hidden = ($showmode != 1); + $this->urltoaddentry = DOL_URL_ROOT.'/product/card.php?action=create'; + $this->msgNoRecords = 'NoTooLowStockProducts'; } /** @@ -202,12 +204,12 @@ class box_produits_alerte_stock extends ModeleBoxes $line++; } - if ($num == 0) { - $this->info_box_contents[$line][0] = array( - 'td' => 'class="center"', - 'text' => $langs->trans("NoTooLowStockProducts"), - ); - } + // if ($num == 0) { + // $this->info_box_contents[$line][0] = array( + // 'td' => 'class="center"', + // 'text' => $langs->trans("NoTooLowStockProducts"), + // ); + // } $this->db->free($result); } else { diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php index e713b654997..e58fa7047dc 100644 --- a/htdocs/core/boxes/box_project.php +++ b/htdocs/core/boxes/box_project.php @@ -54,6 +54,8 @@ class box_project extends ModeleBoxes $this->boxlabel = "OpenedProjects"; $this->hidden = !$user->hasRight('projet', 'lire'); + $this->urltoaddentry = DOL_URL_ROOT.'/projet/card.php?action=create'; + $this->msgNoRecords = 'NoOpenedProjects'; } /** @@ -175,33 +177,34 @@ class box_project extends ModeleBoxes } } - - // Add the sum à the bottom of the boxes - $this->info_box_contents[$i][] = array( - 'tr' => 'class="liste_total_wrap"', - 'td' => 'class="liste_total"', - 'text' => $langs->trans("Total")." ".$textHead, - ); - $this->info_box_contents[$i][] = array( - 'td' => 'class="right liste_total" ', - 'text' => round($num, 0)." ".$langs->trans("Projects"), - ); - $this->info_box_contents[$i][] = array( - 'td' => 'class="right liste_total" ', - 'text' => (($max < $num) ? '' : (round($totalnbTask, 0)." ".$langs->trans("Tasks"))), - ); - $this->info_box_contents[$i][] = array( - 'td' => 'class="liste_total"', - 'text' => " ", - ); - $this->info_box_contents[$i][] = array( - 'td' => 'class="liste_total"', - 'text' => " ", - ); - $this->info_box_contents[$i][] = array( - 'td' => 'class="liste_total"', - 'text' => " ", - ); + if ($num > 0) { + // Add the sum à the bottom of the boxes + $this->info_box_contents[$i][] = array( + 'tr' => 'class="liste_total_wrap"', + 'td' => 'class="liste_total"', + 'text' => $langs->trans("Total")." ".$textHead, + ); + $this->info_box_contents[$i][] = array( + 'td' => 'class="right liste_total" ', + 'text' => round($num, 0)." ".$langs->trans("Projects"), + ); + $this->info_box_contents[$i][] = array( + 'td' => 'class="right liste_total" ', + 'text' => (($max < $num) ? '' : (round($totalnbTask, 0)." ".$langs->trans("Tasks"))), + ); + $this->info_box_contents[$i][] = array( + 'td' => 'class="liste_total"', + 'text' => " ", + ); + $this->info_box_contents[$i][] = array( + 'td' => 'class="liste_total"', + 'text' => " ", + ); + $this->info_box_contents[$i][] = array( + 'td' => 'class="liste_total"', + 'text' => " ", + ); + } } diff --git a/htdocs/core/boxes/box_project_opportunities.php b/htdocs/core/boxes/box_project_opportunities.php index 43e35640e7e..9781657ccdd 100644 --- a/htdocs/core/boxes/box_project_opportunities.php +++ b/htdocs/core/boxes/box_project_opportunities.php @@ -55,6 +55,8 @@ class box_project_opportunities extends ModeleBoxes $this->enabled = getDolGlobalInt('PROJECT_USE_OPPORTUNITIES'); $this->hidden = !$user->hasRight('projet', 'lire'); + $this->urltoaddentry = DOL_URL_ROOT.'/projet/card.php?action=create'; + $this->msgNoRecords = 'NoOpenedProjectsOpportunities'; } /** @@ -160,33 +162,34 @@ class box_project_opportunities extends ModeleBoxes } } - - // Add the sum à the bottom of the boxes - $this->info_box_contents[$i][] = array( - 'tr' => 'class="liste_total_wrap"', - 'td' => 'class="liste_total"', - 'text' => $langs->trans("Total")." ".$textHead, - ); - $this->info_box_contents[$i][] = array( - 'td' => 'class="right liste_total" ', - 'text' => round($num, 0)." ".$langs->trans("Projects"), - ); - $this->info_box_contents[$i][] = array( - 'td' => 'class="liste_total"', - 'text' => " ", - ); - $this->info_box_contents[$i][] = array( - 'td' => 'class="liste_total"', - 'text' => " ", - ); - $this->info_box_contents[$i][] = array( - 'td' => 'class="liste_total"', - 'text' => " ", - ); - $this->info_box_contents[$i][] = array( - 'td' => 'class="liste_total"', - 'text' => " ", - ); + if ($num > 0) { + // Add the sum à the bottom of the boxes + $this->info_box_contents[$i][] = array( + 'tr' => 'class="liste_total_wrap"', + 'td' => 'class="liste_total"', + 'text' => $langs->trans("Total")." ".$textHead, + ); + $this->info_box_contents[$i][] = array( + 'td' => 'class="right liste_total" ', + 'text' => round($num, 0)." ".$langs->trans("Projects"), + ); + $this->info_box_contents[$i][] = array( + 'td' => 'class="liste_total"', + 'text' => " ", + ); + $this->info_box_contents[$i][] = array( + 'td' => 'class="liste_total"', + 'text' => " ", + ); + $this->info_box_contents[$i][] = array( + 'td' => 'class="liste_total"', + 'text' => " ", + ); + $this->info_box_contents[$i][] = array( + 'td' => 'class="liste_total"', + 'text' => " ", + ); + } } diff --git a/htdocs/core/boxes/box_propales.php b/htdocs/core/boxes/box_propales.php index 59daa109ef1..09b12577f48 100644 --- a/htdocs/core/boxes/box_propales.php +++ b/htdocs/core/boxes/box_propales.php @@ -52,6 +52,9 @@ class box_propales extends ModeleBoxes $this->db = $db; $this->hidden = !($user->hasRight('propal', 'read')); + + $this->urltoaddentry = DOL_URL_ROOT.'/comm/propal/card.php?action=create'; + $this->msgNoRecords = 'NoRecordedProposals'; } /** @@ -171,12 +174,6 @@ class box_propales extends ModeleBoxes $line++; } - if ($num == 0) { - $this->info_box_contents[$line][0] = array( - 'td' => 'class="center"', - 'text' => $langs->trans("NoRecordedProposals"), - ); - } $this->db->free($result); } else { diff --git a/htdocs/core/boxes/box_prospect.php b/htdocs/core/boxes/box_prospect.php index 0052c28a331..dd90e6f1910 100644 --- a/htdocs/core/boxes/box_prospect.php +++ b/htdocs/core/boxes/box_prospect.php @@ -60,6 +60,9 @@ class box_prospect extends ModeleBoxes } $this->hidden = !($user->hasRight('societe', 'read') && empty($user->socid)); + + $this->urltoaddentry = DOL_URL_ROOT.'/societe/card.php?action=create&type=p'; + $this->msgNoRecords = 'NoRecordedProspects'; } /** @@ -153,13 +156,6 @@ class box_prospect extends ModeleBoxes $line++; } - if ($num == 0) { - $this->info_box_contents[$line][0] = array( - 'td' => 'class="center"', - 'text' => ''.$langs->trans("NoRecordedProspects").'' - ); - } - $this->db->free($resql); } else { $this->info_box_contents[0][0] = array( diff --git a/htdocs/core/boxes/box_scheduled_jobs.php b/htdocs/core/boxes/box_scheduled_jobs.php index 1b621155ee2..cf1d6f683fe 100644 --- a/htdocs/core/boxes/box_scheduled_jobs.php +++ b/htdocs/core/boxes/box_scheduled_jobs.php @@ -51,6 +51,9 @@ class box_scheduled_jobs extends ModeleBoxes $this->db = $db; $this->hidden = !($user->hasRight('cron', 'read')); + + $this->urltoaddentry = DOL_URL_ROOT.'/cron/card.php?action=create'; + $this->msgNoRecords = 'NoScheduledJobs'; } /** @@ -159,26 +162,27 @@ class box_scheduled_jobs extends ModeleBoxes ); $line++; } - - // Line nb job in error - $this->info_box_contents[$line][] = array( - 'td' => 'class="tdoverflowmax300" colspan="3"', - 'text' => $langs->trans("NumberScheduledJobError") - ); - $textnoformat = ''; - if ($nbjobsnotfinished) { - $textnoformat .= '
'.$nbjobsnotfinished.'
'; + if ($num > 0) { + // Line nb job in error + $this->info_box_contents[$line][] = array( + 'td' => 'class="tdoverflowmax300" colspan="3"', + 'text' => $langs->trans("NumberScheduledJobError") + ); + $textnoformat = ''; + if ($nbjobsnotfinished) { + $textnoformat .= '
'.$nbjobsnotfinished.'
'; + } + if ($nbjobsinerror) { + $textnoformat .= '
'.$nbjobsinerror.'
'; + } + if (empty($nbjobsnotfinished) && empty($nbjobsinerror)) { + $textnoformat .= '
0
'; + } + $this->info_box_contents[$line][] = array( + 'td' => 'class="right"', + 'textnoformat' => $textnoformat + ); } - if ($nbjobsinerror) { - $textnoformat .= '
'.$nbjobsinerror.'
'; - } - if (empty($nbjobsnotfinished) && empty($nbjobsinerror)) { - $textnoformat .= '
0
'; - } - $this->info_box_contents[$line][] = array( - 'td' => 'class="right"', - 'textnoformat' => $textnoformat - ); } else { $this->info_box_contents[0][0] = array( 'td' => '', diff --git a/htdocs/core/boxes/box_services_contracts.php b/htdocs/core/boxes/box_services_contracts.php index ccdf6b9fce1..87acbc6c000 100644 --- a/htdocs/core/boxes/box_services_contracts.php +++ b/htdocs/core/boxes/box_services_contracts.php @@ -51,6 +51,9 @@ class box_services_contracts extends ModeleBoxes $this->db = $db; $this->hidden = !($user->hasRight('service', 'lire') && $user->hasRight('contrat', 'lire')); + + $this->urltoaddentry = DOL_URL_ROOT.'/contrat/card.php?action=create'; + $this->msgNoRecords = 'NoContractedProducts'; } /** @@ -200,12 +203,6 @@ class box_services_contracts extends ModeleBoxes $i++; } - if ($num == 0) { - $this->info_box_contents[$i][0] = array( - 'td' => 'class="center"', - 'text' => ''.$langs->trans("NoContractedProducts").'' - ); - } $this->db->free($result); } else { diff --git a/htdocs/core/boxes/box_services_expired.php b/htdocs/core/boxes/box_services_expired.php index f5c7ee6211a..13ed4b8d54d 100644 --- a/htdocs/core/boxes/box_services_expired.php +++ b/htdocs/core/boxes/box_services_expired.php @@ -48,6 +48,9 @@ class box_services_expired extends ModeleBoxes $this->db = $db; $this->hidden = !($user->hasRight('contrat', 'lire')); + + $this->urltoaddentry = DOL_URL_ROOT.'/contrat/card.php?action=create'; + $this->msgNoRecords = 'NoExpiredServices'; } /** @@ -155,13 +158,6 @@ class box_services_expired extends ModeleBoxes $i++; } - if ($num == 0) { - $langs->load("contracts"); - $this->info_box_contents[$i][] = array( - 'td' => 'class="nohover center"', - 'text' => ''.$langs->trans("NoExpiredServices").'' - ); - } $this->db->free($resql); } else { diff --git a/htdocs/core/boxes/box_shipments.php b/htdocs/core/boxes/box_shipments.php index 9dbf5448c07..a2d54f3e948 100644 --- a/htdocs/core/boxes/box_shipments.php +++ b/htdocs/core/boxes/box_shipments.php @@ -51,6 +51,9 @@ class box_shipments extends ModeleBoxes $this->db = $db; $this->hidden = !$user->hasRight('expedition', 'lire'); + + $this->urltoaddentry = DOL_URL_ROOT.'/expedition/card.php?action=create2'; + $this->msgNoRecords = 'NoRecordedShipments'; } /** @@ -163,12 +166,12 @@ class box_shipments extends ModeleBoxes $line++; } - if ($num == 0) { - $this->info_box_contents[$line][0] = array( - 'td' => 'class="center"', - 'text' => ''.$langs->trans("NoRecordedShipments").'' - ); - } + // if ($num == 0) { + // $this->info_box_contents[$line][0] = array( + // 'td' => 'class="center"', + // 'text' => ''.$langs->trans("NoRecordedShipments").'' + // ); + // } $this->db->free($result); } else { diff --git a/htdocs/core/boxes/box_supplier_orders.php b/htdocs/core/boxes/box_supplier_orders.php index 168d5f6fc9b..1c6c9475c09 100644 --- a/htdocs/core/boxes/box_supplier_orders.php +++ b/htdocs/core/boxes/box_supplier_orders.php @@ -49,6 +49,9 @@ class box_supplier_orders extends ModeleBoxes $this->db = $db; $this->hidden = !($user->hasRight('fournisseur', 'commande', 'lire')); + + $this->urltoaddentry = DOL_URL_ROOT.'/fourn/commande/card.php?action=create'; + $this->msgNoRecords = 'NoSupplierOrder'; } /** @@ -160,13 +163,6 @@ class box_supplier_orders extends ModeleBoxes $line++; } - if ($num == 0) { - $this->info_box_contents[$line][] = array( - 'td' => 'class="center"', - 'text' => ''.$langs->trans("NoSupplierOrder").'', - ); - } - $this->db->free($result); } else { $this->info_box_contents[0][] = array( diff --git a/htdocs/core/boxes/modules_boxes.php b/htdocs/core/boxes/modules_boxes.php index d7d237d6961..355d087e83a 100644 --- a/htdocs/core/boxes/modules_boxes.php +++ b/htdocs/core/boxes/modules_boxes.php @@ -158,6 +158,14 @@ class ModeleBoxes // Can't be abstract as it is instantiated to build "empty" bo * @var string[] Example array("accounting") */ public $depends; + /** + * @var string urltoaddentry + */ + public $urltoaddentry; + /** + * @var string msg when no records exist + */ + public $msgNoRecords = 'NoRecordFound'; @@ -429,6 +437,17 @@ class ModeleBoxes // Can't be abstract as it is instantiated to build "empty" bo $out .= "\n"; } } + } else { + if (!empty($head['text']) || !empty($head['sublink']) || !empty($head['subpicto']) || $nblines) { + $out .= ''.$langs->trans($this->msgNoRecords).' '; + + // Check if $urltoaddentry is defined for the widget + if (!empty($this->urltoaddentry)) { + $out .= ''.img_picto($langs->trans("New"), 'add', 'pictofixedwidth').''; + } + + $out .= ''; + } } if (!empty($head['text']) || !empty($head['sublink']) || !empty($head['subpicto']) || $nblines) { diff --git a/htdocs/core/class/commonhookactions.class.php b/htdocs/core/class/commonhookactions.class.php index a6fd27afe7c..8b5067f03cf 100644 --- a/htdocs/core/class/commonhookactions.class.php +++ b/htdocs/core/class/commonhookactions.class.php @@ -38,6 +38,16 @@ abstract class CommonHookActions */ public $results = array(); + /** + * @var string + */ + public $error; + + /** + * @var string[] + */ + public $errors = array(); + /** * Check context of hook * @param array $parameters Hook parameters. diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index ca55cd4e839..3aee2589b32 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3349,10 +3349,11 @@ abstract class CommonObject if ($resql) { $i = 0; $num = $this->db->num_rows($resql); + $grandchild = getDolGlobalInt('MAIN_CARE_GRANDCHILD'); while ($i < $num) { $row = $this->db->fetch_row($resql); $rows[] = $row[0]; // Add parent line into array rows - $children = $this->getChildrenOfLine($row[0]); + $children = $this->getChildrenOfLine($row[0], $grandchild); if (!empty($children)) { foreach ($children as $child) { array_push($rows, $child); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index fb7b3c43813..b63aee32b78 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -9561,6 +9561,9 @@ class Form } $possiblelinks = array(); + + $dontIncludeCompletedItems = getDolGlobalString('DONT_INCLUDE_COMPLETED_ELEMENTS_LINKS'); + if (is_object($object->thirdparty) && !empty($object->thirdparty->id) && $object->thirdparty->id > 0) { $listofidcompanytoscan = $object->thirdparty->id; if (($object->thirdparty->parent > 0) && getDolGlobalString('THIRDPARTY_INCLUDE_PARENT_IN_LINKTO')) { @@ -9581,27 +9584,27 @@ class Form 'enabled' => isModEnabled('propal'), 'perms' => 1, 'label' => 'LinkToProposal', - 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('propal') . ')'), + 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('propal') . ')'.($dontIncludeCompletedItems ? ' AND t.fk_statut < 4' : '')), 'shipping' => array( 'enabled' => isModEnabled('shipping'), 'perms' => 1, 'label' => 'LinkToExpedition', - 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "expedition as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('shipping') . ')'), + 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "expedition as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('shipping') . ')'.($dontIncludeCompletedItems ? ' AND t.fk_statut < 2' : '')), 'order' => array( 'enabled' => isModEnabled('order'), 'perms' => 1, 'label' => 'LinkToOrder', - 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('commande') . ')'), + 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('commande') . ')'.($dontIncludeCompletedItems ? ' AND t.facture < 1' : '')), 'invoice' => array( 'enabled' => isModEnabled('invoice'), 'perms' => 1, 'label' => 'LinkToInvoice', - 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('invoice') . ')'), + 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('invoice') . ')'.($dontIncludeCompletedItems ? ' AND t.paye < 1' : '')), 'invoice_template' => array( 'enabled' => isModEnabled('invoice'), 'perms' => 1, 'label' => 'LinkToTemplateInvoice', - 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.titre as ref, t.total_ht FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "facture_rec as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('invoice') . ')'), + 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.titre as ref, t.total_ht FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "facture_rec as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('invoice') . ')'.($dontIncludeCompletedItems ? ' AND t.paye < 1' : '')), 'contrat' => array( 'enabled' => isModEnabled('contract'), 'perms' => 1, @@ -9618,33 +9621,33 @@ class Form 'enabled' => isModEnabled('supplier_proposal'), 'perms' => 1, 'label' => 'LinkToSupplierProposal', - 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('supplier_proposal') . ')'), + 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('supplier_proposal') . ')'.($dontIncludeCompletedItems ? ' AND t.fk_statut < 4' : '')), 'order_supplier' => array( 'enabled' => isModEnabled("supplier_order"), 'perms' => 1, 'label' => 'LinkToSupplierOrder', - 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('commande_fournisseur') . ')'), + 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('commande_fournisseur') . ')'.($dontIncludeCompletedItems ? ' AND t.billed < 1' : '')), 'invoice_supplier' => array( 'enabled' => isModEnabled("supplier_invoice"), 'perms' => 1, 'label' => 'LinkToSupplierInvoice', - 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('facture_fourn') . ')'), + 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('facture_fourn') . ')'.($dontIncludeCompletedItems ? ' AND t.paye < 1' : '')), 'ticket' => array( 'enabled' => isModEnabled('ticket'), 'perms' => 1, 'label' => 'LinkToTicket', - 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.track_id, '0' as total_ht FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "ticket as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('ticket') . ')'), + 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.track_id, '0' as total_ht FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "ticket as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('ticket') . ')'.($dontIncludeCompletedItems ? ' AND t.fk_statut < 8' : '')), 'mo' => array( 'enabled' => isModEnabled('mrp'), 'perms' => 1, 'label' => 'LinkToMo', - 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.rowid, '0' as total_ht FROM " . $this->db->prefix() . "societe as s INNER JOIN " . $this->db->prefix() . "mrp_mo as t ON t.fk_soc = s.rowid WHERE t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('mo') . ')') + 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.rowid, '0' as total_ht FROM " . $this->db->prefix() . "societe as s INNER JOIN " . $this->db->prefix() . "mrp_mo as t ON t.fk_soc = s.rowid WHERE t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('mo') . ')'.($dontIncludeCompletedItems ? ' AND t.status < 3' : '')) ); } if ($object->table_element == 'commande_fournisseur') { - $possiblelinks['mo']['sql'] = "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.rowid, '0' as total_ht FROM ".$this->db->prefix()."societe as s INNER JOIN ".$this->db->prefix().'mrp_mo as t ON t.fk_soc = s.rowid WHERE t.entity IN ('.getEntity('mo').')'; + $possiblelinks['mo']['sql'] = "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.rowid, '0' as total_ht FROM ".$this->db->prefix()."societe as s INNER JOIN ".$this->db->prefix().'mrp_mo as t ON t.fk_soc = s.rowid WHERE t.entity IN ('.getEntity('mo').')'.($dontIncludeCompletedItems ? ' AND t.status < 3' : ''); } elseif ($object->table_element == 'mrp_mo') { - $possiblelinks['order_supplier']['sql'] = "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix().'commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.entity IN ('.getEntity('commande_fournisseur').')'; + $possiblelinks['order_supplier']['sql'] = "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix().'commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.entity IN ('.getEntity('commande_fournisseur').')'.($dontIncludeCompletedItems ? ' AND t.billed < 1' : ''); } $reshook = 0; // Ensure $reshook is defined for static analysis diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 8b5c9a10bb8..b6a4c32c907 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -117,33 +117,54 @@ class FormMail extends Form */ public $inreplyto; + /** + * @var int<0,1> + */ public $withsubstit; // Show substitution array + /** + * @var int<0,1> + */ public $withfrom; /** - * @var int|string|array + * @var int<0,1>|string[] */ public $withto; // Show recipient emails + /** + * @var int<0,1> + */ public $withreplyto; /** - * @var int|string 0 = Do not Show free text for recipient emails + * @var int<0,1>|string 0 = Do not Show free text for recipient emails * 1 = Show free text for recipient emails * or a free email */ public $withtofree; + /** + * @var int<0,1>|string[] + */ public $withtocc; + /** + * @var int<0,1>|string|string[] When 1|'1', enable BCC field, when not 0, use as default BCC email + */ public $withtoccc; + /** + * @var int<0,1>|string + */ public $withtopic; + /** + * @var int<0,1> + */ public $witherrorsto; /** - * @var int|string 0=No attaches files, 1=Show attached files, 2=Can add new attached files, 'text'=Show attached files and the text + * @var int<0,2>|string 0=No attaches files, 1=Show attached files, 2=Can add new attached files, 'text'=Show attached files and the text */ public $withfile; /** - * @var int 1=Add a button "Fill with layout" + * @var int<0,1> 1=Add a button "Fill with layout" */ public $withlayout; @@ -153,23 +174,65 @@ class FormMail extends Form public $withaiprompt; /** - * @var int 1=Add a checkbox "Attach also main document" for mass actions (checked by default), -1=Add checkbox (not checked by default) + * @var int<-1,1> 1=Add a checkbox "Attach also main document" for mass actions (checked by default), -1=Add checkbox (not checked by default) */ public $withmaindocfile; + /** + * @var int<0,1>|string + */ public $withbody; + /** + * @var int<0,1> + */ public $withfromreadonly; + /** + * @var int<0,1> + */ public $withreplytoreadonly; + /** + * @var int<0,1> + */ public $withtoreadonly; + /** + * @var int<0,1> + */ public $withtoccreadonly; + /** + * @var int<0,1> + */ public $witherrorstoreadonly; + /** + * @var int<0,1> + */ public $withtocccreadonly; + /** + * @var int<0,1> + */ public $withtopicreadonly; + /** + * @var int<0,1> + */ public $withbodyreadonly; + /** + * @var int<0,1> + */ public $withfilereadonly; + /** + * @var int<0,1> + */ public $withdeliveryreceipt; + /** + * @var int<0,1> + */ public $withcancel; + /** + * @var int<0,1> + */ public $withdeliveryreceiptreadonly; + /** + * @var int<-1,1> + */ public $withfckeditor; /** @@ -177,19 +240,36 @@ class FormMail extends Form */ public $ckeditortoolbar; + /** + * @var array + */ public $substit = array(); + /** + * @var string[] + */ public $substit_lines = array(); /** * @var array{}|array{models:string,langsmodels?:string,fileinit?:string[],returnurl:string} */ public $param = array(); + /** + * @var string[] + */ public $withtouser = array(); + /** + * @var string[] + */ public $withtoccuser = array(); + /** + * @var ModelMail[] + */ public $lines_model; - // -1 suggest the checkbox 'one email per recipient' not checked, 0 = no suggestion, 1 = suggest and checked + /** + * @var int<-1,1> -1 suggests the checkbox 'one email per recipient' not checked, 0 = no suggestion, 1 = suggest and checked + */ public $withoptiononeemailperrecipient; @@ -208,7 +288,7 @@ class FormMail extends Form $this->withto = 1; $this->withtofree = 1; $this->withtocc = 1; - $this->withtoccc = 0; + $this->withtoccc = '0'; $this->witherrorsto = 0; $this->withtopic = 1; $this->withfile = 0; // 1=Add section "Attached files". 2=Can add files. @@ -732,7 +812,7 @@ class FormMail extends Form if (empty($withtoselected) && count($tmparray) == 1 && GETPOST('action', 'aZ09') == 'presend') { $withtoselected = array_keys($tmparray); } - $out .= $form->multiselectarray("receiveruser", $tmparray, $withtoselected, null, null, 'inline-block minwidth500', null, ""); + $out .= $form->multiselectarray("receiveruser", $tmparray, $withtoselected, 0, 0, 'inline-block minwidth500', 0, ""); $out .= "\n"; } @@ -781,7 +861,7 @@ class FormMail extends Form if (empty($withtoselected) && count($tmparray) == 1 && GETPOST('action', 'aZ09') == 'presend') { $withtoselected = array_keys($tmparray); } - $out .= $form->multiselectarray("receiverccuser", $tmparray, $withtoselected, null, null, 'inline-block minwidth500', null, ""); + $out .= $form->multiselectarray("receiverccuser", $tmparray, $withtoselected, 0, 0, 'inline-block minwidth500', 0, ""); $out .= "\n"; } @@ -879,9 +959,9 @@ class FormMail extends Form } $out .= '
'; } - } elseif (empty($this->withmaindocfile)) { + } /*elseif (empty($this->withmaindocfile)) { //$out .= ''.$langs->trans("NoAttachedFiles").'
'; - } + }*/ if ($this->withfile == 2) { $maxfilesizearray = getMaxFileSizeArray(); $maxmin = $maxfilesizearray['maxmin']; @@ -917,7 +997,7 @@ class FormMail extends Form // Complete substitution array with the url to make online payment $validpaymentmethod = array(); - if (empty($this->substit['__REF__'])) { + if (empty($this->substit['__REF__'])) { // @phan-suppress-current-line PhanTypeMismatchProperty $paymenturl = ''; } else { // Set the online payment url link into __ONLINE_PAYMENT_URL__ key @@ -950,11 +1030,11 @@ class FormMail extends Form $this->substit['__ONLINE_INTERVIEW_SCHEDULER_TEXT_AND_URL__'] = ''; - // Add lines substitution key from each line + // Generate the string with the template for lines repeated and filled for each line $lines = ''; $defaultlines = $arraydefaultmessage->content_lines; if (isset($defaultlines)) { - foreach ($this->substit_lines as $substit_line) { + foreach ($this->substit_lines as $lineid => $substit_line) { $lines .= make_substitutions($defaultlines, $substit_line)."\n"; } } @@ -1168,7 +1248,7 @@ class FormMail extends Form } } - $out .= $form->multiselectarray("receiver", $tmparray, $withtoselected, null, null, 'inline-block minwidth500', 0, 0); + $out .= $form->multiselectarray("receiver", $tmparray, $withtoselected, 0, 0, 'inline-block minwidth500', 0, 0); } } $out .= "\n"; @@ -1216,7 +1296,7 @@ class FormMail extends Form $withtoccselected = GETPOST("receivercc", 'array'); // Array of selected value - $out .= $form->multiselectarray("receivercc", $tmparray, $withtoccselected, null, null, 'inline-block minwidth500', 0, 0); + $out .= $form->multiselectarray("receivercc", $tmparray, $withtoccselected, 0, 0, 'inline-block minwidth500', 0, 0); } } $out .= "\n"; @@ -1265,7 +1345,7 @@ class FormMail extends Form $withtocccselected = GETPOST("receiverccc", 'array'); // Array of selected value - $out .= $form->multiselectarray("receiverccc", $tmparray, $withtocccselected, null, null, 'inline-block minwidth500', 0, 0); + $out .= $form->multiselectarray("receiverccc", $tmparray, $withtocccselected, 0, 0, 'inline-block minwidth500', 0, 0); } } @@ -1971,7 +2051,8 @@ class FormMail extends Form } } } - $this->substit_lines[] = $substit_line; + + $this->substit_lines[$line->id] = $substit_line; // @phan-suppress-current-line PhanTypeMismatchProperty } } } @@ -1981,8 +2062,8 @@ class FormMail extends Form * This include the complete_substitutions_array. * * @param string $mode 'formemail', 'formemailwithlines', 'formemailforlines', 'emailing', ... - * @param Object $object Object if applicable - * @return array Array of substitution values for emails. + * @param ?Object $object Object if applicable + * @return array Array of substitution values for emails. */ public static function getAvailableSubstitKey($mode = 'formemail', $object = null) { @@ -2132,7 +2213,7 @@ class ModelMail extends CommonObject "active" => array("type" => "integer", "label" => "Active", "enabled" => "1", 'position' => 65, 'notnull' => 1, "visible" => "-1", "alwayseditable" => "1",), "topic" => array("type" => "text", "label" => "Topic", "enabled" => "1", 'position' => 70, 'notnull' => 0, "visible" => "-1", "alwayseditable" => "1",), "content" => array("type" => "mediumtext", "label" => "Content", "enabled" => "1", 'position' => 75, 'notnull' => 0, "visible" => "-1", "alwayseditable" => "1",), - "content_lines" => array("type" => "text", "label" => "Contentlines", "enabled" => "1", 'position' => 80, 'notnull' => 0, "visible" => "-1", "alwayseditable" => "1",), + "content_lines" => array("type" => "text", "label" => "Contentlines", "enabled" => "getDolGlobalString('MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES')", 'position' => 80, 'notnull' => 0, "visible" => "-1", "alwayseditable" => "1",), "enabled" => array("type" => "varchar(255)", "label" => "Enabled", "enabled" => "1", 'position' => 85, 'notnull' => 0, "visible" => "-1", "alwayseditable" => "1",), "joinfiles" => array("type" => "varchar(255)", "label" => "Joinfiles", "enabled" => "1", 'position' => 90, 'notnull' => 0, "visible" => "-1", "alwayseditable" => "1",), "email_from" => array("type" => "varchar(255)", "label" => "Emailfrom", "enabled" => "1", 'position' => 95, 'notnull' => 0, "visible" => "-1", "alwayseditable" => "1",), @@ -2141,12 +2222,33 @@ class ModelMail extends CommonObject "email_tobcc" => array("type" => "varchar(255)", "label" => "Emailtobcc", "enabled" => "1", 'position' => 110, 'notnull' => 0, "visible" => "-1", "alwayseditable" => "1",), "defaultfortype" => array("type" => "smallint(6)", "label" => "Defaultfortype", "enabled" => "1", 'position' => 115, 'notnull' => 0, "visible" => "-1", "alwayseditable" => "1",), ); + /** + * @var int + */ public $rowid; + /** + * @var string + */ public $type_template; + /** + * @var int|string + */ public $datec; + /** + * @var int + */ public $tms; + /** + * @var int + */ public $active; + /** + * @var string + */ public $enabled; + /** + * @var int + */ public $defaultfortype; /** @@ -2175,16 +2277,38 @@ class ModelMail extends CommonObject public $topic; /** - * @var string Model mail content + * @var string Model mail content */ public $content; + /** + * @var string Model to use to generate the string with each lines + */ public $content_lines; + + /** + * @var string + */ public $lang; + /** + * @var int<0,1> + */ public $joinfiles; + /** + * @var string + */ public $email_from; + /** + * @var string + */ public $email_to; + /** + * @var string + */ public $email_tocc; + /** + * @var string + */ public $email_tobcc; /** diff --git a/htdocs/core/class/stats.class.php b/htdocs/core/class/stats.class.php index 2499ec19ff1..a372e6013a8 100644 --- a/htdocs/core/class/stats.class.php +++ b/htdocs/core/class/stats.class.php @@ -424,7 +424,7 @@ abstract class Stats * Return nb of elements, total amount and avg amount each year * * @param string $sql SQL request - * @return array Array with nb, total amount, average for each year + * @return array Array with nb, total amount, average for each year */ protected function _getAllByYear($sql) { diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index 4cc81b629bd..3d29f9c3e58 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -213,7 +213,7 @@ class Translate /** * Load translation files. * - * @param array $domains Array of lang files to load + * @param string[] $domains Array of lang files to load * @return int Return integer <0 if KO, 0 if already loaded or loading not required, >0 if OK */ public function loadLangs($domains) @@ -243,12 +243,12 @@ class Translate * If $domain is "file@module" instead of "file" then we look for module lang file * in htdocs/custom/modules/mymodule/langs/code_CODE/file.lang * then in htdocs/module/langs/code_CODE/file.lang instead of htdocs/langs/code_CODE/file.lang - * @param integer $alt 0 (try xx_ZZ then 1), 1 (try xx_XX then 2), 2 (try en_US) + * @param int $alt 0 (try xx_ZZ then 1), 1 (try xx_XX then 2), 2 (try en_US) * @param int $stopafterdirection Stop when the DIRECTION tag is found (optimize speed) * @param string $forcelangdir To force a different lang directory * @param int $loadfromfileonly 1=Do not load overwritten translation from file or old conf. * @param int $forceloadifalreadynotfound Force attempt to reload lang file if it was previously not found - * @param array $tabtranslatedomain Store translations to be stored in cache + * @param array $tabtranslatedomain Store translations to be stored in cache * @param string $langkey To create key for cachekey in recursivity * @return int Return integer <0 if KO, 0 if already loaded or loading not required, >0 if OK * @see loadLangs() @@ -867,11 +867,11 @@ class Translate /** * Return list of all available languages * - * @param string $langdir Directory to scan - * @param integer $maxlength Max length for each value in combo box (will be truncated) - * @param int $usecode 1=Show code instead of country name for language variant, 2=Show only code - * @param int $mainlangonly 1=Show only main languages ('fr_FR' no' fr_BE', 'es_ES' not 'es_MX', ...) - * @return array List of languages + * @param string $langdir Directory to scan + * @param int $maxlength Max length for each value in combo box (will be truncated) + * @param int<0,1> $usecode 1=Show code instead of country name for language variant, 2=Show only code + * @param int<0,1> $mainlangonly 1=Show only main languages ('fr_FR' no' fr_BE', 'es_ES' not 'es_MX', ...) + * @return array List of languages */ public function get_available_languages($langdir = DOL_DOCUMENT_ROOT, $maxlength = 0, $usecode = 0, $mainlangonly = 0) { @@ -1195,7 +1195,7 @@ class Translate * Return an array with content of all loaded translation keys (found into this->tab_translate) so * we get a substitution array we can use for substitutions (for mail or ODT generation for example) * - * @return array Array of translation keys lang_key => string_translation_loaded + * @return array Array of translation keys lang_key => string_translation_loaded */ public function get_translations_for_substitutions() { diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 0464f172375..f3e67229b67 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -2076,7 +2076,7 @@ function phpinfo_array() /** * Return array head with list of tabs to view object information. * - * @return array head array with tabs + * @return array Array of tabs to show */ function company_admin_prepare_head() { @@ -2115,7 +2115,7 @@ function company_admin_prepare_head() /** * Return array head with list of tabs to view object information. * - * @return array head array with tabs + * @return array Array of tabs to show */ function email_admin_prepare_head() { diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index 0032de1b22c..cbcdf3b0019 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -512,7 +512,7 @@ function actions_prepare_head($object) * Define head array for tabs of agenda setup pages * * @param string $param Parameters to add to url - * @return array Array of head + * @return array Array of tabs to show */ function calendars_prepare_head($param) { diff --git a/htdocs/core/lib/asset.lib.php b/htdocs/core/lib/asset.lib.php index 0a8e06eb1bf..6ced74e5966 100644 --- a/htdocs/core/lib/asset.lib.php +++ b/htdocs/core/lib/asset.lib.php @@ -1,6 +1,7 @@ - * Copyright (C) 2022 Frédéric France +/* Copyright (C) 2018-2022 OpenDSI + * Copyright (C) 2022-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 @@ -25,7 +26,7 @@ /** * Prepare admin pages header * - * @return array head array with tabs + * @return array head array with tabs */ function assetAdminPrepareHead() { @@ -82,7 +83,7 @@ function assetAdminPrepareHead() * Prepare array of tabs for Asset * * @param Asset $object Asset - * @return array Array of tabs + * @return array Array of tabs */ function assetPrepareHead(Asset $object) { @@ -178,7 +179,7 @@ function assetPrepareHead(Asset $object) * Prepare array of tabs for AssetModel * * @param AssetModel $object AssetModel - * @return array Array of tabs + * @return array Array of tabs to show */ function assetModelPrepareHead($object) { diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index c1337f02968..ece419a576b 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -38,7 +38,7 @@ * Return array of tabs to used on pages for third parties cards. * * @param Societe $object Object company shown - * @return array Array of tabs + * @return array Array of tabs to show */ function societe_prepare_head(Societe $object) { @@ -477,7 +477,7 @@ function societe_prepare_head(Societe $object) * Return array of tabs to used on page * * @param Object $object Object for tabs - * @return array Array of tabs + * @return array Array of tabs to show */ function societe_prepare_head2($object) { @@ -503,7 +503,7 @@ function societe_prepare_head2($object) /** * Return array head with list of tabs to view object information. * - * @return array head array with tabs + * @return array Array of tabs to show */ function societe_admin_prepare_head() { diff --git a/htdocs/core/lib/contract.lib.php b/htdocs/core/lib/contract.lib.php index b1a9f36432f..532b2652003 100644 --- a/htdocs/core/lib/contract.lib.php +++ b/htdocs/core/lib/contract.lib.php @@ -142,7 +142,7 @@ function contract_prepare_head(Contrat $object) /** * Return array head with list of tabs to view object information. * - * @return array head array with tabs + * @return array Array of tabs to show */ function contract_admin_prepare_head() { diff --git a/htdocs/core/lib/cron.lib.php b/htdocs/core/lib/cron.lib.php index ba86ee940ad..c39f5b3719d 100644 --- a/htdocs/core/lib/cron.lib.php +++ b/htdocs/core/lib/cron.lib.php @@ -1,6 +1,7 @@ + * 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 @@ -26,7 +27,7 @@ /** * Return array of tabs to used on pages to setup cron module. * - * @return array Array of tabs + * @return array Array of tabs to show */ function cronadmin_prepare_head() { @@ -56,7 +57,7 @@ function cronadmin_prepare_head() * Return array of tabs to used on a cron job * * @param Cronjob $object Object cron - * @return array Array of tabs + * @return array Array of tabs to show */ function cron_prepare_head(Cronjob $object) { diff --git a/htdocs/core/lib/ecm.lib.php b/htdocs/core/lib/ecm.lib.php index ffdff4a5f43..fb4c0b241c0 100644 --- a/htdocs/core/lib/ecm.lib.php +++ b/htdocs/core/lib/ecm.lib.php @@ -174,7 +174,7 @@ function ecm_prepare_head_fm($object) /** * Return array head with list of tabs to view object information. * - * @return array head array with tabs + * @return array Array of tabs to show */ function ecm_admin_prepare_head() { diff --git a/htdocs/core/lib/eventorganization.lib.php b/htdocs/core/lib/eventorganization.lib.php index 09ebc88a0b3..79510429856 100644 --- a/htdocs/core/lib/eventorganization.lib.php +++ b/htdocs/core/lib/eventorganization.lib.php @@ -1,6 +1,7 @@ * Copyright (C) 2023 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 @@ -25,7 +26,7 @@ /** * Prepare admin pages header * - * @return array + * @return array Array of tabs to show */ function eventorganizationAdminPrepareHead() { diff --git a/htdocs/core/lib/expedition.lib.php b/htdocs/core/lib/expedition.lib.php index 7510a73569b..72646e4f34e 100644 --- a/htdocs/core/lib/expedition.lib.php +++ b/htdocs/core/lib/expedition.lib.php @@ -69,7 +69,7 @@ function expedition_prepare_head(Expedition $object) /** * Return array head with list of tabs to view object information. * - * @return array head array with tabs + * @return array Array of tabs to show */ function expedition_admin_prepare_head() { diff --git a/htdocs/core/lib/expensereport.lib.php b/htdocs/core/lib/expensereport.lib.php index 518ed2d475f..3f13f3a6e44 100644 --- a/htdocs/core/lib/expensereport.lib.php +++ b/htdocs/core/lib/expensereport.lib.php @@ -94,7 +94,7 @@ function expensereport_prepare_head($object) * It loads tabs from modules looking for the entity payment * * @param PaymentExpenseReport $object Current payment object - * @return array Tabs for the payment section + * @return array Array of tabs to show */ function payment_expensereport_prepare_head(PaymentExpenseReport $object) { @@ -127,7 +127,7 @@ function payment_expensereport_prepare_head(PaymentExpenseReport $object) /** * Return array head with list of tabs to view object information. * - * @return array head array with tabs + * @return array Array of tabs to show */ function expensereport_admin_prepare_head() { diff --git a/htdocs/core/lib/fourn.lib.php b/htdocs/core/lib/fourn.lib.php index 121e41c3ee3..3d4e58ac624 100644 --- a/htdocs/core/lib/fourn.lib.php +++ b/htdocs/core/lib/fourn.lib.php @@ -283,7 +283,7 @@ function ordersupplier_prepare_head(CommandeFournisseur $object) /** * Return array head with list of tabs to view object information. * - * @return array head array with tabs + * @return array Array of tabs to show */ function supplierorder_admin_prepare_head() { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 9882c04ff67..a4179610170 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -9,7 +9,7 @@ * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2010-2018 Juanjo Menent * Copyright (C) 2013 Cédric Salvador - * Copyright (C) 2013-2021 Alexandre Spangaro + * Copyright (C) 2013-2024 Alexandre Spangaro * Copyright (C) 2014 Cédric GROSS * Copyright (C) 2014-2015 Marcos García * Copyright (C) 2015 Jean-François Ferry @@ -233,6 +233,21 @@ function getDolGlobalInt($key, $default = 0) return (int) (isset($conf->global->$key) ? $conf->global->$key : $default); } +/** + * Return a Dolibarr global constant float value. + * The constants $conf->global->xxx are loaded by the script master.inc.php included at begin of any PHP page. + * + * @param string $key Key to return value, return $default if not set + * @param float $default Value to return if not defined + * @return float Value returned + * @see getDolUserInt() + */ +function getDolGlobalFloat($key, $default = 0) +{ + global $conf; + return (float) (isset($conf->global->$key) ? $conf->global->$key : $default); +} + /** * Return a Dolibarr global constant boolean value. * The constants $conf->global->xxx are loaded by the script master.inc.php included at begin of any PHP page. @@ -9303,6 +9318,12 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $substitutionarray['__ONLINE_PAYMENT_TEXT_AND_URL__'] = ($paymenturl ? str_replace('\n', "\n", $outputlangs->trans("PredefinedMailContentLink", $paymenturl)) : ''); $substitutionarray['__ONLINE_PAYMENT_URL__'] = $paymenturl; + // Show structured communication + if (getDolGlobalString('INVOICE_PAYMENT_ENABLE_STRUCTURED_COMMUNICATION') && $object->element == 'facture') { + include_once DOL_DOCUMENT_ROOT.'/core/lib/functions_be.lib.php'; + $substitutionarray['__PAYMENT_STRUCTURED_COMMUNICATION__'] = dolBECalculateStructuredCommunication($object->ref, $object->type); + } + if (getDolGlobalString('PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD') && is_object($object) && $object->element == 'propal') { $substitutionarray['__DIRECTDOWNLOAD_URL_PROPOSAL__'] = $object->getLastMainDocLink($object->element); } else { diff --git a/htdocs/core/lib/functions_be.lib.php b/htdocs/core/lib/functions_be.lib.php new file mode 100644 index 00000000000..c607b400d3f --- /dev/null +++ b/htdocs/core/lib/functions_be.lib.php @@ -0,0 +1,77 @@ + + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * or see https://www.gnu.org/ + */ + +/** + * \file htdocs/core/lib/functions_be.lib.php + * \brief A set of belgium functions for Dolibarr + * This file contains rare functions. + */ + + +/** + * Calculate Structured Communication / BE Bank payment reference number + * + * @param string $invoice_number Invoice number to generate payment reference + * @param int $invoice_type Invoice type + * @return string String structured communication for payment + */ +function dolBECalculateStructuredCommunication($invoice_number, $invoice_type) +{ + $invoice_number = preg_replace('/[^0-9]/', '', $invoice_number); // Keep only numbers + + // We complete with 0 and take the last 8 digits of the number are used to generate the reference base. + $invoice_number = substr('00000000'.$invoice_number, -8); + + // Prefix with invoice type + switch ($invoice_type) { + case '0': + $invoice_type = '20'; // invoice type standard + break; + case '1': + $invoice_type = '30'; // invoice type replacement + break; + case '2': + $invoice_type = '40'; // invoice type credit note + break; + case '3': + $invoice_type = '21'; // invoice type deposit + break; + case '5': + $invoice_type = '20'; // invoice type situation, force to standard + break; + default: + $invoice_type = '00'; + } + + // Calculate module97 + $invoice_number = $invoice_type.$invoice_number; + $mod97 = intval($invoice_number) % 97; + $controlKey = ($mod97 === 0) ? 97 : $mod97; + + // Add the check digit at the end of the reference + $invoice_number .= $controlKey; + + // Format reference as XXX/XXXX/XXXXX + $part1 = '+++'.substr($invoice_number, 0, 3); + $part2 = substr($invoice_number, 3, 4); + $part3 = substr($invoice_number, 7, 5).'+++'; // Includes last 3 digits + 2 check digits + + $invoice_number = $part1 . '/' . $part2 . '/' . $part3; + + return $invoice_number; +} diff --git a/htdocs/core/lib/holiday.lib.php b/htdocs/core/lib/holiday.lib.php index 76361b759c4..e25ee0b5902 100644 --- a/htdocs/core/lib/holiday.lib.php +++ b/htdocs/core/lib/holiday.lib.php @@ -1,6 +1,7 @@ * Copyright (C) 2022 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 @@ -26,7 +27,7 @@ * Return array head with list of tabs to view object information * * @param Object $object Holiday - * @return array head + * @return array Array of tabs to show */ function holiday_prepare_head($object) { @@ -76,7 +77,7 @@ function holiday_prepare_head($object) /** * Return array head with list of tabs to view object information * - * @return array head + * @return array Array of tabs to show */ function holiday_admin_prepare_head() { diff --git a/htdocs/core/lib/hrm.lib.php b/htdocs/core/lib/hrm.lib.php index 77c380918a4..88176b3cff2 100644 --- a/htdocs/core/lib/hrm.lib.php +++ b/htdocs/core/lib/hrm.lib.php @@ -63,7 +63,7 @@ function establishment_prepare_head($object) /** * Return array head with list of tabs to view object information * - * @return array head + * @return array Array of tabs to show */ function hrm_admin_prepare_head() { diff --git a/htdocs/core/lib/import.lib.php b/htdocs/core/lib/import.lib.php index 371bc6ed7c1..ed84858103a 100644 --- a/htdocs/core/lib/import.lib.php +++ b/htdocs/core/lib/import.lib.php @@ -4,6 +4,7 @@ * Copyright (C) 2010 Regis Houssin * Copyright (C) 2010 Juanjo Menent * Copyright (C) 2018-2021 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 @@ -31,7 +32,7 @@ * * @param string $param Params to add on url links * @param int $maxstep Limit steps to maxstep or no limit if 0 - * @return array Array of tabs + * @return array Array of tabs to show */ function import_prepare_head($param, $maxstep = 0) { diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index d9b7928ba49..24dc64a36a8 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -33,7 +33,7 @@ * Initialize the array of tabs for customer invoice * * @param Facture $object Invoice object - * @return array Array of head tabs + * @return array Array of tabs to show */ function facture_prepare_head($object) { @@ -164,7 +164,7 @@ function facture_prepare_head($object) /** * Return array head with list of tabs to view object information. * - * @return array head array with tabs + * @return array Array of tabs to show */ function invoice_admin_prepare_head() { @@ -248,7 +248,7 @@ function invoice_admin_prepare_head() * Return array head with list of tabs to view object information. * * @param FactureRec $object Invoice model object - * @return array head array with tabs + * @return array Array of tabs to show */ function invoice_rec_prepare_head($object) { @@ -311,7 +311,7 @@ function invoice_rec_prepare_head($object) * Return array head with list of tabs to view object information. * * @param Facture $object Invoice object - * @return array head array with tabs + * @return array Array of tabs to show */ function supplier_invoice_rec_prepare_head($object) { @@ -366,7 +366,7 @@ function getNumberInvoicesPieChart($mode) $amount_mode = (getDolGlobalInt('FACTURE_VALIDATED_IN_AMOUNT') == 1); - $sql = "SELECT"; + $sql = "SELECT"; $sql .= " sum(".$db->ifsql("f.date_lim_reglement < '".date_format($datenowsub30, 'Y-m-d')."'", $amount_mode ? "f.total_ht" : 1, 0).") as late30"; $sql .= ", sum(".$db->ifsql("f.date_lim_reglement < '".date_format($datenowsub15, 'Y-m-d')."' AND f.date_lim_reglement >= '".date_format($datenowsub30, 'Y-m-d')."'", $amount_mode ? "f.total_ht" : 1, 0).") as late15"; $sql .= ", sum(".$db->ifsql("f.date_lim_reglement < '".date_format($now, 'Y-m-d')."' AND f.date_lim_reglement >= '".date_format($datenowsub15, 'Y-m-d')."'", $amount_mode ? "f.total_ht" : 1, 0).") as latenow"; diff --git a/htdocs/core/lib/ldap.lib.php b/htdocs/core/lib/ldap.lib.php index 9b5c039372e..04bc6bedb1a 100644 --- a/htdocs/core/lib/ldap.lib.php +++ b/htdocs/core/lib/ldap.lib.php @@ -28,7 +28,7 @@ /** * Initialize the array of tabs for customer invoice * - * @return array Array of head tabs + * @return array Array of tabs to show */ function ldap_prepare_head() { diff --git a/htdocs/core/lib/mailmanspip.lib.php b/htdocs/core/lib/mailmanspip.lib.php index 5449da31228..095f275b9d2 100644 --- a/htdocs/core/lib/mailmanspip.lib.php +++ b/htdocs/core/lib/mailmanspip.lib.php @@ -1,5 +1,6 @@ + * 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 @@ -24,7 +25,7 @@ /** * Return array head with list of tabs to view object information * - * @return array Tabs of the module + * @return array Array of tabs to show */ function mailmanspip_admin_prepare_head() { diff --git a/htdocs/core/lib/multicurrency.lib.php b/htdocs/core/lib/multicurrency.lib.php index 1be514c60eb..6172fda2065 100644 --- a/htdocs/core/lib/multicurrency.lib.php +++ b/htdocs/core/lib/multicurrency.lib.php @@ -56,7 +56,7 @@ function multicurrencyAdminPrepareHead() /** * Prepare array with list of currency tabs * - * @param array $aCurrencies Currencies array + * @param string[] $aCurrencies Currencies array * @return array Array of tabs to show */ function multicurrencyLimitPrepareHead($aCurrencies) diff --git a/htdocs/core/lib/oauth.lib.php b/htdocs/core/lib/oauth.lib.php index ecd69c3d045..383546cf036 100644 --- a/htdocs/core/lib/oauth.lib.php +++ b/htdocs/core/lib/oauth.lib.php @@ -1,6 +1,7 @@ + * 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 @@ -359,7 +360,7 @@ function getSupportedOauth2Array() /** * Return array of tabs to used on pages to setup cron module. * - * @return array Array of tabs + * @return array Array of tabs to show */ function oauthadmin_prepare_head() { diff --git a/htdocs/core/lib/order.lib.php b/htdocs/core/lib/order.lib.php index d89d4897dc7..0f50d417ccc 100644 --- a/htdocs/core/lib/order.lib.php +++ b/htdocs/core/lib/order.lib.php @@ -174,7 +174,7 @@ function commande_prepare_head(Commande $object) /** * Return array head with list of tabs to view object information. * - * @return array head array with tabs + * @return array Array of tabs to show */ function order_admin_prepare_head() { diff --git a/htdocs/core/lib/payments.lib.php b/htdocs/core/lib/payments.lib.php index a5e48935052..fa7ad623f3a 100644 --- a/htdocs/core/lib/payments.lib.php +++ b/htdocs/core/lib/payments.lib.php @@ -4,6 +4,7 @@ * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2020 Abbes Bahfir * Copyright (C) 2021 Waël Almoman + * 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 @@ -25,7 +26,7 @@ * It loads tabs from modules looking for the entity payment * * @param Paiement $object Current payment object - * @return array Tabs for the payment section + * @return array Array of tabs for the payment section */ function payment_prepare_head(Paiement $object) { @@ -73,7 +74,7 @@ function payment_prepare_head(Paiement $object) * It loads tabs from modules looking for the entity payment * * @param int $id ID of bank line - * @return array Tabs for the Bankline section + * @return array Array of tabs for the Banline section */ function bankline_prepare_head($id) { @@ -108,7 +109,7 @@ function bankline_prepare_head($id) * It loads tabs from modules looking for the entity payment_supplier * * @param Paiement $object Current payment object - * @return array Tabs for the payment section + * @return array Tabs for the payment section */ function payment_supplier_prepare_head(Paiement $object) { diff --git a/htdocs/core/lib/prelevement.lib.php b/htdocs/core/lib/prelevement.lib.php index 460697a2813..830369fe846 100644 --- a/htdocs/core/lib/prelevement.lib.php +++ b/htdocs/core/lib/prelevement.lib.php @@ -123,7 +123,7 @@ function prelevement_check_config($type = 'direct-debit') * @param BonPrelevement $object Member * @param int $nbOfInvoices No of invoices * @param int $nbOfSalaryInvoice No of salary invoices - * @return array head + * @return array Array of tabs to show */ function bon_prelevement_prepare_head(BonPrelevement $object, $nbOfInvoices, $nbOfSalaryInvoice) { diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index a809f438419..53383acad48 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -193,6 +193,7 @@ function product_prepare_head($object) // Attachments require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; + $upload_dir = ''; if (isModEnabled("product") && ($object->type == Product::TYPE_PRODUCT)) { $upload_dir = $conf->product->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref); } @@ -315,10 +316,10 @@ function productlot_prepare_head($object) /** -* Return array head with list of tabs to view object information. -* -* @return array head array with tabs -*/ + * Return array head with list of tabs to view object information. + * + * @return array Array of tabs to show + */ function product_admin_prepare_head() { global $langs, $conf, $user, $db; @@ -378,7 +379,7 @@ function product_admin_prepare_head() /** * Return array head with list of tabs to view object information. * - * @return array head array with tabs + * @return array Array of tabs to show */ function product_lot_admin_prepare_head() { diff --git a/htdocs/core/lib/receiptprinter.lib.php b/htdocs/core/lib/receiptprinter.lib.php index 7bbfbc66387..4999dab2894 100644 --- a/htdocs/core/lib/receiptprinter.lib.php +++ b/htdocs/core/lib/receiptprinter.lib.php @@ -1,6 +1,7 @@ * Copyright (C) 2015 Frederic 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 @@ -28,7 +29,7 @@ * Define head array for tabs of receipt printer setup pages * * @param string $mode Mode - * @return Array of head + * @return array Array of tabs to show */ function receiptprinteradmin_prepare_head($mode) { diff --git a/htdocs/core/lib/resource.lib.php b/htdocs/core/lib/resource.lib.php index 8bdaf599d78..2bacb7043b2 100644 --- a/htdocs/core/lib/resource.lib.php +++ b/htdocs/core/lib/resource.lib.php @@ -3,6 +3,7 @@ * Copyright (C) 2013 Jean-François Ferry * Copyright (C) 2016 Gilles Poirier * Copyright (C) 2023 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 @@ -28,7 +29,7 @@ * Prepare head for tabs * * @param Dolresource $object Object - * @return array Array of head entries + * @return array Array of tabs to show */ function resource_prepare_head($object) { @@ -110,7 +111,7 @@ function resource_prepare_head($object) /** * Prepare head for admin tabs * - * @return array Array of head entries + * @return array Array of tabs to show */ function resource_admin_prepare_head() { diff --git a/htdocs/core/lib/salaries.lib.php b/htdocs/core/lib/salaries.lib.php index 6038510a7fa..4a6133a54a7 100644 --- a/htdocs/core/lib/salaries.lib.php +++ b/htdocs/core/lib/salaries.lib.php @@ -4,6 +4,7 @@ * Copyright (C) 2019 Alexandre Spangaro * Copyright (C) 2021 Gauthier VERDOL * Copyright (C) 2023 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 @@ -25,7 +26,7 @@ * It loads tabs from modules looking for the entity salaries * * @param Paiement $object Current salaries object - * @return array Tabs for the salaries section + * @return array Tabs for the salaries section */ function salaries_prepare_head($object) { @@ -98,7 +99,7 @@ function salaries_prepare_head($object) /** * Return array head with list of tabs to view object information * - * @return array head + * @return array Array of tabs to show */ function salaries_admin_prepare_head() { diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index 66fc5f15bcf..e6592e3e841 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -1,7 +1,8 @@ - * Copyright (C) 2008-2017 Regis Houssin - * Copyright (C) 2024 MDW +/* Copyright (C) 2008-2011 Laurent Destailleur + * Copyright (C) 2008-2017 Regis Houssin + * Copyright (C) 2024 MDW + * Copyright (C) 2024 Frédéric France * * 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 @@ -586,7 +587,7 @@ function dolJSToSetRandomPassword($htmlname, $htmlnameofbutton = 'generate_token $out .= 'jQuery(document).ready(function () { jQuery("#'.dol_escape_js($htmlnameofbutton).'").click(function() { var currenttoken = jQuery("meta[name=anti-csrf-currenttoken]").attr("content"); - console.log("We click on the button '.dol_escape_js($htmlnameofbutton).' to suggest a key. anti-csrf-currentotken is "+currenttoken+". We will fill '.dol_escape_js($htmlname).'"); + console.log("We click on the button '.dol_escape_js($htmlnameofbutton).' to suggest a key. anti-csrf-currenttoken is "+currenttoken+". We will fill '.dol_escape_js($htmlname).'"); jQuery.get( "'.DOL_URL_ROOT.'/core/ajax/security.php", { action: \'getrandompassword\', generic: '.($generic ? '1' : '0').', diff --git a/htdocs/core/lib/socialnetwork.lib.php b/htdocs/core/lib/socialnetwork.lib.php index 368b356f962..a195534d522 100644 --- a/htdocs/core/lib/socialnetwork.lib.php +++ b/htdocs/core/lib/socialnetwork.lib.php @@ -4,6 +4,7 @@ * Copyright (C) 2019 Alexandre Spangaro * Copyright (C) 2021 Gauthier VERDOL * Copyright (C) 2023 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 @@ -22,7 +23,7 @@ /** * Function for return different onglet of socialnetworks admin page - * @return array Tabs for the admin section + * @return array Tabs for the admin section */ function socialnetwork_prepare_head() { diff --git a/htdocs/core/lib/stock.lib.php b/htdocs/core/lib/stock.lib.php index c8cb6c22892..9a9238f91c1 100644 --- a/htdocs/core/lib/stock.lib.php +++ b/htdocs/core/lib/stock.lib.php @@ -87,7 +87,7 @@ function stock_prepare_head($object) /** * Return array head with list of tabs to view object information. * - * @return array head array with tabs + * @return array Array of tabs to show */ function stock_admin_prepare_head() { diff --git a/htdocs/core/lib/takepos.lib.php b/htdocs/core/lib/takepos.lib.php index c7714501d90..c956308145f 100644 --- a/htdocs/core/lib/takepos.lib.php +++ b/htdocs/core/lib/takepos.lib.php @@ -1,6 +1,7 @@ * Copyright (C) 2022 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 @@ -25,7 +26,7 @@ /** * Prepare array with list of tabs * - * @return array Array of tabs + * @return array Array of tabs to show */ function takepos_admin_prepare_head() { diff --git a/htdocs/core/lib/ticket.lib.php b/htdocs/core/lib/ticket.lib.php index 3ba2088e4b2..2ed7811961e 100644 --- a/htdocs/core/lib/ticket.lib.php +++ b/htdocs/core/lib/ticket.lib.php @@ -27,7 +27,7 @@ /** * Build tabs for admin page * - * @return array + * @return array */ function ticketAdminPrepareHead() { @@ -79,7 +79,7 @@ function ticketAdminPrepareHead() * Build tabs for a Ticket object * * @param Ticket $object Object Ticket - * @return array Array of tabs + * @return array Array of tabs to show */ function ticket_prepare_head($object) { @@ -218,12 +218,12 @@ function generate_random_id($car = 16) /** * Show http header, open body tag and show HTML header banner for public pages for tickets * - * @param string $title Title - * @param string $head Head array - * @param int $disablejs More content into html header - * @param int $disablehead More content into html header - * @param array $arrayofjs Array of complementary js files - * @param array $arrayofcss Array of complementary css files + * @param string $title Title + * @param string $head Head array + * @param int<0,1> $disablejs More content into html header + * @param int<0,1> $disablehead More content into html header + * @param string[] $arrayofjs Array of complementary js files + * @param string[] $arrayofcss Array of complementary css files * @return void */ function llxHeaderTicket($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index c4bebcedbb6..814c741090f 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -512,8 +512,8 @@ function dolWebsiteSaveContent($content) * @param string $containerref Ref of container to redirect to (Example: 'mypage' or 'mypage.php'). * @param string $containeraliasalt Ref of alternative aliases to redirect to. * @param int $containerid Id of container. - * @param int $permanent 0=Use temporary redirect 302, 1=Use permanent redirect 301 - * @param array $parameters Array of parameters to append to the URL. + * @param int<0,1> $permanent 0=Use temporary redirect 302, 1=Use permanent redirect 301 + * @param array $parameters Array of parameters to append to the URL. * @return void */ function redirectToContainer($containerref, $containeraliasalt = '', $containerid = 0, $permanent = 0, $parameters = array()) @@ -654,7 +654,7 @@ function includeContainer($containerref) * 'Name', 'os'=>'Windows', 'price'=>10)); ?> * * @param string $type 'blogpost', 'product', 'software', 'organization', 'qa', ... - * @param array $data Array of data parameters for structured data + * @param array $data Array of data parameters for structured data * @return string HTML content */ function getStructuredData($type, $data = array()) @@ -862,7 +862,7 @@ function getStructuredData($type, $data = array()) /** * Return HTML content to add as header card for an article, news or Blog Post or home page. * - * @param array $params Array of parameters + * @param ?array $params Array of parameters * @return string HTML content */ function getSocialNetworkHeaderCards($params = null) @@ -1106,7 +1106,7 @@ function getImagePublicURLOfObject($object, $no = 1, $extName = '') * Return array with list of all public files of a given object. * * @param Object $object Object - * @return array List of public files of object + * @return array List of public files of object * @see getImagePublicURLOfObject() */ function getPublicFilesOfObject($object) @@ -1163,11 +1163,11 @@ function getPublicFilesOfObject($object) * @param string $searchstring Search string * @param int $max Max number of answers * @param string $sortfield Sort Fields - * @param string $sortorder Sort order ('DESC' or 'ASC') + * @param 'DESC'|'ASC' $sortorder Sort order ('DESC' or 'ASC') * @param string $langcode Language code ('' or 'en', 'fr', 'es', ...) - * @param array $otherfilters Other filters - * @param int $status 0 or 1, or -1 for both - * @return array Array with results of search + * @param array $otherfilters Other filters + * @param int<-1,1> $status 0 or 1, or -1 for both + * @return array{list?:WebsitePage[],code?:string,message?:string} Array with results of search */ function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25, $sortfield = 'date_creation', $sortorder = 'DESC', $langcode = '', $otherfilters = [], $status = 1) { @@ -1534,7 +1534,7 @@ function getAllImages($object, $objectpage, $urltograb, &$tmp, &$action, $modify * Retrieves the details of a news post by its ID. * * @param string $postId The ID of the news post to retrieve. - * @return array|int Return array if OK, -1 if KO + * @return array|int<-1,-1> Return array if OK, -1 if KO */ function getNewsDetailsById($postId) { diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 143d5e9eddb..60660b9aa30 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -1,18 +1,19 @@ - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2008 Raphael Bertrand - * Copyright (C) 2010-2014 Juanjo Menent - * Copyright (C) 2012 Christophe Battarel - * Copyright (C) 2012 Cédric Salvador - * Copyright (C) 2012-2014 Raphaël Doursenaud - * Copyright (C) 2015 Marcos García - * Copyright (C) 2017-2018 Ferran Marcet - * Copyright (C) 2018-2024 Frédéric France - * Copyright (C) 2022 Anthony Berton - * Copyright (C) 2022 Charlene Benke - * Copyright (C) 2024 MDW +/* Copyright (C) 2004-2014 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2008 Raphael Bertrand + * Copyright (C) 2010-2014 Juanjo Menent + * Copyright (C) 2012 Christophe Battarel + * Copyright (C) 2012 Cédric Salvador + * Copyright (C) 2012-2014 Raphaël Doursenaud + * Copyright (C) 2015 Marcos García + * Copyright (C) 2017-2018 Ferran Marcet + * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2022 Anthony Berton + * Copyright (C) 2022 Charlene Benke + * Copyright (C) 2024 MDW * Copyright (C) 2024 Nick Fragoulis + * Copyright (C) 2024 Alexandre Spangaro * * 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 @@ -1325,6 +1326,13 @@ class pdf_crabe extends ModelePDFFactures $posy = pdf_bank($pdf, $outputlangs, $curx, $cury, $account, 0, $default_font_size); $posy += 2; + + if (getDolGlobalString('INVOICE_PAYMENT_ENABLE_STRUCTURED_COMMUNICATION')) { + include_once DOL_DOCUMENT_ROOT.'/core/lib/functions_be.lib.php'; + $invoicePaymentKey = dolBECalculateStructuredCommunication($object->ref, $object->type); + + $pdf->MultiCell(100, 3, $outputlangs->transnoentities('StructuredCommunication').": " . $outputlangs->convToOutputCharset($invoicePaymentKey), 0, 'L', 0); + } } } } diff --git a/htdocs/core/modules/facture/doc/pdf_octopus.modules.php b/htdocs/core/modules/facture/doc/pdf_octopus.modules.php index 5513d1bbaf9..2a8a8dd7c2d 100644 --- a/htdocs/core/modules/facture/doc/pdf_octopus.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_octopus.modules.php @@ -1528,6 +1528,14 @@ class pdf_octopus extends ModelePDFFactures $posy = pdf_bank($pdf, $outputlangs, $curx, $cury, $account, 0, $default_font_size); $posy += 2; + + // Show structured communication + if (getDolGlobalString('INVOICE_PAYMENT_ENABLE_STRUCTURED_COMMUNICATION')) { + include_once DOL_DOCUMENT_ROOT.'/core/lib/functions_be.lib.php'; + $invoicePaymentKey = dolBECalculateStructuredCommunication($object->ref, $object->type); + + $pdf->MultiCell(100, 3, $outputlangs->transnoentities('StructuredCommunication').": " . $outputlangs->convToOutputCharset($invoicePaymentKey), 0, 'L', 0); + } } } } diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 5db21abcc50..dad947ab22a 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -1,18 +1,18 @@ - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2008 Raphael Bertrand - * Copyright (C) 2010-2014 Juanjo Menent - * Copyright (C) 2012 Christophe Battarel - * Copyright (C) 2012 Cédric Salvador - * Copyright (C) 2012-2014 Raphaël Doursenaud - * Copyright (C) 2015 Marcos García - * Copyright (C) 2017 Ferran Marcet - * Copyright (C) 2018-2024 Frédéric France - * Copyright (C) 2022 Anthony Berton - * Copyright (C) 2022 Alexandre Spangaro - * Copyright (C) 2024 MDW - * Copyright (C) 2024 Nick Fragoulis +/* Copyright (C) 2004-2014 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2008 Raphael Bertrand + * Copyright (C) 2010-2014 Juanjo Menent + * Copyright (C) 2012 Christophe Battarel + * Copyright (C) 2012 Cédric Salvador + * Copyright (C) 2012-2014 Raphaël Doursenaud + * Copyright (C) 2015 Marcos García + * Copyright (C) 2017 Ferran Marcet + * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2022 Anthony Berton + * Copyright (C) 2022-2024 Alexandre Spangaro + * Copyright (C) 2024 MDW + * Copyright (C) 2024 Nick Fragoulis * * 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 @@ -1449,6 +1449,14 @@ class pdf_sponge extends ModelePDFFactures $pdf->MultiCell(30, 3, $langs->trans("INVOICE_ADD_EPC_QR_CODEPay"), 0, 'L', 0); $posy = $pdf->GetY() + 2; } + + // Show structured communication + if (getDolGlobalString('INVOICE_PAYMENT_ENABLE_STRUCTURED_COMMUNICATION')) { + include_once DOL_DOCUMENT_ROOT.'/core/lib/functions_be.lib.php'; + $invoicePaymentKey = dolBECalculateStructuredCommunication($object->ref, $object->type); + + $pdf->MultiCell(100, 3, $outputlangs->transnoentities('StructuredCommunication').": " . $outputlangs->convToOutputCharset($invoicePaymentKey), 0, 'L', 0); + } } } } diff --git a/htdocs/core/modules/modVariants.class.php b/htdocs/core/modules/modVariants.class.php index f2a1373b89c..dfb0dd463e2 100644 --- a/htdocs/core/modules/modVariants.class.php +++ b/htdocs/core/modules/modVariants.class.php @@ -1,8 +1,9 @@ - * Copyright (C) 2004-2012 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2016 Marcos García +/* Copyright (C) 2003 Rodolphe Quiedeville + * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2016 Marcos García + * Copyright (C) 2024 Frédéric France * * 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 @@ -123,4 +124,29 @@ class modVariants extends DolibarrModules $this->rights[$r][4] = 'delete'; // In php code, permission will be checked by test if ($user->rights->eventorganization->level1) $r++; } + + /** + * Function called when module is enabled. + * The init function adds constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. + * It also creates data directories + * + * @param string $options Options when enabling module ('', 'noboxes') + * @return int 1 if OK, 0 if KO + */ + public function init($options = '') + { + $result = $this->_load_tables('/install/mysql/', 'variants'); + if ($result < 0) { + // Do not activate module if error 'not allowed' returned when loading module SQL queries + // (the _load_table run sql with run_sql with the error allowed parameter set to 'default') + return -1; + } + + // Permissions + $this->remove($options); + + $sql = array(); + + return $this->_init($sql, $options); + } } diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php index 3d215cc3a6f..728a9856da1 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -559,7 +559,7 @@ class pdf_aurore extends ModelePDFSupplierProposal } if ($localtax2_type && $localtax2ligne != 0) { if (empty($this->localtax2[$localtax2_type][$localtax2_rate])) { - $this->localtax2[$localtax2_type][$localtax2_rate] = $localtax2ligne; + $this->localtax2[$localtax2_type][$localtax2_rate] = (float) $localtax2ligne; } else { $this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne; } @@ -869,7 +869,7 @@ class pdf_aurore extends ModelePDFSupplierProposal * Show total to pay * * @param TCPDF $pdf Object PDF - * @param Facture $object Object invoice + * @param SupplierProposal $object Object proposal * @param int $deja_regle Montant deja regle * @param int $posy Position depart * @param Translate $outputlangs Object langs @@ -1144,7 +1144,7 @@ class pdf_aurore extends ModelePDFSupplierProposal //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) { - $pdf->RoundedRect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, $this->corner_radius, '1001', 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR'))); + $pdf->RoundedRect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, $this->corner_radius, '1001', 'F', array(), explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR'))); } } @@ -1210,6 +1210,7 @@ class pdf_aurore extends ModelePDFSupplierProposal protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs) { global $conf, $langs; + '@phan-var-force SupplierProposal $object'; // Load traductions files required by page $outputlangs->loadLangs(array("main", "bills", "supplier_proposal", "companies")); diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php index 72044b24b05..0713297269d 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php @@ -694,7 +694,7 @@ class pdf_zenith extends ModelePDFSupplierProposal } if ($localtax2_type && $localtax2ligne != 0) { if (empty($this->localtax2[$localtax2_type][$localtax2_rate])) { - $this->localtax2[$localtax2_type][$localtax2_rate] = $localtax2ligne; + $this->localtax2[$localtax2_type][$localtax2_rate] = (float) $localtax2ligne; } else { $this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne; } @@ -1146,7 +1146,7 @@ class pdf_zenith extends ModelePDFSupplierProposal //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) { - $pdf->RoundedRect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight, $this->corner_radius, '1001', 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR'))); + $pdf->RoundedRect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight, $this->corner_radius, '1001', 'F', array(), explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR'))); } } diff --git a/htdocs/don/class/donstats.class.php b/htdocs/don/class/donstats.class.php index 1e8f9f09d47..b0e8440e2f7 100644 --- a/htdocs/don/class/donstats.class.php +++ b/htdocs/don/class/donstats.class.php @@ -3,6 +3,7 @@ * Copyright (c) 2005-2013 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2011 Juanjo Menent + * 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 @@ -38,7 +39,13 @@ class DonationStats extends Stats */ public $table_element; + /** + * @var int + */ public $socid; + /** + * @var int + */ public $userid; /** @@ -114,7 +121,7 @@ class DonationStats extends Stats * * @param int $year Year to scan * @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month - * @return array Array with number by month + * @return array,array{0:int<1,12>,1:int}> Array with number by month */ public function getNbByMonth($year, $format = 0) { @@ -132,7 +139,7 @@ class DonationStats extends Stats /** * Return shipments number per year * - * @return array Array with number by year + * @return array Array of nb each year * */ public function getNbByYear() @@ -152,7 +159,7 @@ class DonationStats extends Stats * * @param int $year Year * @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month - * @return array Array of amount each month + * @return array,array{0:int<1,12>,1:int|float}> Array of amount each month */ public function getAmountByMonth($year, $format = 0) { @@ -171,7 +178,7 @@ class DonationStats extends Stats * Return average amount each month * * @param int $year Year - * @return array Array of average each month + * @return array,array{0:int<1,12>,1:int|float}> Array with number by month */ public function getAverageByMonth($year) { @@ -189,7 +196,7 @@ class DonationStats extends Stats /** * Return nb, total and average * - * @return array Array of values + * @return array Array of values */ public function getAllByYear() { diff --git a/htdocs/don/stats/index.php b/htdocs/don/stats/index.php index 2813f9a130c..783a9a45028 100644 --- a/htdocs/don/stats/index.php +++ b/htdocs/don/stats/index.php @@ -38,7 +38,7 @@ $WIDTH = DolGraph::getDefaultGraphSizeForStats('width'); $HEIGHT = DolGraph::getDefaultGraphSizeForStats('height'); // Load translation files required by the page -$langs->loadLangs("donations"); +$langs->loadLangs(array("donations")); $userid = GETPOSTINT('userid'); $socid = GETPOSTINT('socid'); @@ -226,7 +226,7 @@ if (isModEnabled('category')) { $cat_type = Categorie::TYPE_CUSTOMER; $cat_label = $langs->trans("Category").' '.lcfirst($langs->trans("Customer")); 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('custcats', $cate_arbo, GETPOST('custcats', 'array'), 0, 0, 'widthcentpercentminusx maxwidth300'); print ''; @@ -274,7 +274,7 @@ print ''; $oldyear = 0; foreach ($data as $val) { $year = $val['year']; - while (!empty($year) && $oldyear > $year + 1) { + while (!empty($year) && $oldyear > (int) $year + 1) { $oldyear--; print ''; print ''.$oldyear.''; diff --git a/htdocs/emailcollector/lib/emailcollector.lib.php b/htdocs/emailcollector/lib/emailcollector.lib.php index 75a5d47103e..492b5b4aa86 100644 --- a/htdocs/emailcollector/lib/emailcollector.lib.php +++ b/htdocs/emailcollector/lib/emailcollector.lib.php @@ -27,7 +27,7 @@ * Prepare array of tabs for EmailCollector * * @param EmailCollector $object EmailCollector - * @return array Array of tabs + * @return array Array of tabs to show */ function emailcollectorPrepareHead($object) { diff --git a/htdocs/eventorganization/class/conferenceorbooth.class.php b/htdocs/eventorganization/class/conferenceorbooth.class.php index a6ad366354a..f232592f51a 100644 --- a/htdocs/eventorganization/class/conferenceorbooth.class.php +++ b/htdocs/eventorganization/class/conferenceorbooth.class.php @@ -120,18 +120,54 @@ class ConferenceOrBooth extends ActionComm 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'position' => 1000, 'notnull' => -1, 'visible' => -2,), 'status' => array('type' => 'smallint', 'label' => 'Status', 'enabled' => 1, 'position' => 1000, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'index' => 1, 'arrayofkeyval' => array('0' => 'EvntOrgDraft', '1' => 'EvntOrgSuggested', '2' => 'EvntOrgConfirmed', '3' => 'EvntOrgNotQualified', '4' => 'EvntOrgDone', '9' => 'EvntOrgCancelled'),), ); + /** + * @var int + */ public $rowid; + /** + * @var int + */ public $id; + /** + * @var string + */ public $label; + /** + * @var int + */ public $fk_soc; + /** + * @var int + */ public $fk_project; + /** + * @var string + */ public $note; + /** + * @var int + */ public $fk_action; + /** + * @var int + */ public $datec; + /** + * @var int + */ public $fk_user_author; + /** + * @var int + */ public $fk_user_mod; + /** + * @var string + */ public $import_key; + /** + * @var int + */ public $status; // END MODULEBUILDER PROPERTIES @@ -714,7 +750,7 @@ class ConferenceOrBooth extends ActionComm } if (property_exists($this, 'amount')) { $return .= '
'; - $return .= ''.price($this->amount, 0, $langs, 1, -1, -1, $conf->currency).''; + $return .= ''.price($this->amount, 0, $langs, 1, -1, -1, $conf->currency).''; // @phan-suppress-current-line PhanUndeclaredProperty } if (method_exists($this, 'getLibStatut')) { $return .= '
'.$this->getLibStatut(3).'
'; @@ -773,10 +809,10 @@ class ConferenceOrBooth extends ActionComm * * @param string $modele Force template to use ('' to not force) * @param Translate $outputlangs object lang a utiliser pour traduction - * @param int $hidedetails Hide details of lines - * @param int $hidedesc Hide description - * @param int $hideref Hide ref - * @param null|array $moreparams Array to provide more information + * @param int<0,1> $hidedetails Hide details of lines + * @param int<0,1> $hidedesc Hide description + * @param int<0,1> $hideref Hide ref + * @param array $moreparams Array to provide more information * @return int 0 if KO, 1 if OK */ public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null) diff --git a/htdocs/eventorganization/lib/eventorganization_conferenceorbooth.lib.php b/htdocs/eventorganization/lib/eventorganization_conferenceorbooth.lib.php index 2945f6ae3fb..111da1e56ae 100644 --- a/htdocs/eventorganization/lib/eventorganization_conferenceorbooth.lib.php +++ b/htdocs/eventorganization/lib/eventorganization_conferenceorbooth.lib.php @@ -28,7 +28,7 @@ * * @param ConferenceOrBooth $object ConferenceOrBooth * @param int $with_project Add project id to URL - * @return array Array of tabs + * @return array Array of tabs to show */ function conferenceorboothPrepareHead($object, $with_project = 0) { @@ -116,7 +116,7 @@ function conferenceorboothPrepareHead($object, $with_project = 0) * Prepare array of tabs for ConferenceOrBooth Project tab * * @param Project $object Project - * @return array + * @return array */ function conferenceorboothProjectPrepareHead($object) { @@ -191,7 +191,7 @@ function conferenceorboothProjectPrepareHead($object) * Prepare array of tabs for ConferenceOrBoothAttendees * * @param ConferenceOrBoothAttendee $object ConferenceOrBoothAttendee - * @return array> Array of tabs + * @return array Array of tabs */ function conferenceorboothAttendeePrepareHead($object) { diff --git a/htdocs/expedition/class/expeditionstats.class.php b/htdocs/expedition/class/expeditionstats.class.php index 425cd4a7e1b..d53bd0e0628 100644 --- a/htdocs/expedition/class/expeditionstats.class.php +++ b/htdocs/expedition/class/expeditionstats.class.php @@ -3,6 +3,7 @@ * Copyright (c) 2005-2013 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2011 Juanjo Menent + * 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 @@ -112,7 +113,7 @@ class ExpeditionStats extends Stats * * @param int $year Year to scan * @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month - * @return array Array with number by month + * @return array,array{0:int<1,12>,1:int}> Array with number by month */ public function getNbByMonth($year, $format = 0) { @@ -135,7 +136,7 @@ class ExpeditionStats extends Stats /** * Return shipments number per year * - * @return array Array with number by year + * @return array Array of nb each year * */ public function getNbByYear() @@ -159,7 +160,7 @@ class ExpeditionStats extends Stats * * @param int $year Year to scan * @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month - * @return array Array with amount by month + * @return array,array{0:int<1,12>,1:int|float}> Array of values */ public function getAmountByMonth($year, $format = 0) { @@ -183,7 +184,7 @@ class ExpeditionStats extends Stats * Return the orders amount average by month for a year * * @param int $year year for stats - * @return array array with number by month + * @return array,array{0:int<1,12>,1:int|float}> Array with number by month */ public function getAverageByMonth($year) { @@ -205,7 +206,7 @@ class ExpeditionStats extends Stats /** * Return nb, total and average * - * @return array Array of values + * @return array Array of values */ public function getAllByYear() { diff --git a/htdocs/expedition/stats/index.php b/htdocs/expedition/stats/index.php index f8d905475c2..f21be7acba5 100644 --- a/htdocs/expedition/stats/index.php +++ b/htdocs/expedition/stats/index.php @@ -262,7 +262,7 @@ print ''; $oldyear = 0; foreach ($data as $val) { $year = $val['year']; - while (!empty($year) && $oldyear > $year + 1) { // If we have empty year + while (!empty($year) && $oldyear > (int) $year + 1) { // If we have empty year $oldyear--; diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 84575129068..db64e5294e4 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -1722,6 +1722,15 @@ if ($action == 'create') { $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id."&rowid=".GETPOSTINT('rowid'), $langs->trans("DeleteLine"), $langs->trans("ConfirmDeleteLine"), "confirm_delete_line", '', 'yes', 1); } + // Call Hook formConfirm + $parameters = array('formConfirm' => $formconfirm); + $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if (empty($reshook)) { + $formconfirm .= $hookmanager->resPrint; + } elseif ($reshook > 0) { + $formconfirm = $hookmanager->resPrint; + } + // Print form confirm print $formconfirm; diff --git a/htdocs/expensereport/class/expensereportstats.class.php b/htdocs/expensereport/class/expensereportstats.class.php index 5f1c0858959..8b25b65281a 100644 --- a/htdocs/expensereport/class/expensereportstats.class.php +++ b/htdocs/expensereport/class/expensereportstats.class.php @@ -3,6 +3,7 @@ * Copyright (c) 2005-2008 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * 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 @@ -112,7 +113,7 @@ class ExpenseReportStats extends Stats /** * Return nb of expense report per year * - * @return array Array of values + * @return array Array of nb each year */ public function getNbByYear() { @@ -130,7 +131,7 @@ class ExpenseReportStats extends Stats * * @param int $year Year to scan * @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month - * @return array Array of values + * @return array,array{0:int<1,12>,1:int}> Array with number by month */ public function getNbByMonth($year, $format = 0) { @@ -152,7 +153,7 @@ class ExpenseReportStats extends Stats * * @param int $year Year to scan * @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month - * @return array Array of values + * @return array,array{0:int<1,12>,1:int|float}> Array of values */ public function getAmountByMonth($year, $format = 0) { @@ -172,7 +173,7 @@ class ExpenseReportStats extends Stats * Return average amount * * @param int $year Year to scan - * @return array Array of values + * @return array,array{0:int<1,12>,1:int|float}> Array with number by month */ public function getAverageByMonth($year) { @@ -189,7 +190,7 @@ class ExpenseReportStats extends Stats /** * Return nb, total and average * - * @return array Array of values + * @return array Array of values */ public function getAllByYear() { diff --git a/htdocs/expensereport/stats/index.php b/htdocs/expensereport/stats/index.php index c302138a8bd..34e87c54b64 100644 --- a/htdocs/expensereport/stats/index.php +++ b/htdocs/expensereport/stats/index.php @@ -3,6 +3,7 @@ * Copyright (c) 2004-2012 Laurent Destailleur * Copyright (C) 2012 Marcos García * Copyright (C) 2018 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 @@ -39,7 +40,8 @@ $mode = GETPOSTISSET("mode") ? GETPOST("mode", 'aZ09') : 'customer'; $object_status = GETPOST('object_status', 'intcomma'); $userid = GETPOSTINT('userid'); -$socid = GETPOSTINT('socid'); if ($socid < 0) { +$socid = GETPOSTINT('socid'); +if ($socid < 0) { $socid = 0; } $id = GETPOSTINT('id'); @@ -272,7 +274,7 @@ print ''; $oldyear = 0; foreach ($data as $val) { $year = $val['year']; - while ($year && $oldyear > $year + 1) { // If we have empty year + while ($year && $oldyear > (int) $year + 1) { // If we have empty year $oldyear--; print ''; diff --git a/htdocs/fichinter/class/fichinterstats.class.php b/htdocs/fichinter/class/fichinterstats.class.php index d5d58ec8bfd..c2f7fbd7638 100644 --- a/htdocs/fichinter/class/fichinterstats.class.php +++ b/htdocs/fichinter/class/fichinterstats.class.php @@ -91,7 +91,7 @@ class FichinterStats extends Stats * * @param int $year Year to scan * @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month - * @return array Array with number by month + * @return array,array{0:int<1,12>,1:int}> Array with number by month */ public function getNbByMonth($year, $format = 0) { @@ -114,7 +114,7 @@ class FichinterStats extends Stats /** * Return interventions number per year * - * @return array Array with number by year + * @return array Array of nb each year * */ public function getNbByYear() @@ -138,7 +138,7 @@ class FichinterStats extends Stats * * @param int $year Year to scan * @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month - * @return array Array with amount by month + * @return array,array{0:int<1,12>,1:int|float}> Array with amount by month */ public function getAmountByMonth($year, $format = 0) { @@ -162,7 +162,7 @@ class FichinterStats extends Stats * Return the intervention amount average by month for a year * * @param int $year year for stats - * @return array array with number by month + * @return array,array{0:int<1,12>,1:int|float}> Array with number by month */ public function getAverageByMonth($year) { @@ -184,7 +184,7 @@ class FichinterStats extends Stats /** * Return nb, total and average * - * @return array Array of values + * @return array Array of values */ public function getAllByYear() { diff --git a/htdocs/fichinter/stats/index.php b/htdocs/fichinter/stats/index.php index cdd926c9471..63af162e404 100644 --- a/htdocs/fichinter/stats/index.php +++ b/htdocs/fichinter/stats/index.php @@ -1,5 +1,6 @@ + * 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 @@ -271,7 +272,7 @@ print ''; $oldyear = 0; foreach ($data as $val) { $year = $val['year']; - while (!empty($year) && $oldyear > $year + 1) { + while (!empty($year) && $oldyear > (int) $year + 1) { // If we have empty year $oldyear--; diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 1044bfbb05e..8d1f5be1016 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -1,14 +1,15 @@ - * Copyright (C) 2003 Eric Seigne - * Copyright (C) 2004-2016 Laurent Destailleur - * Copyright (C) 2005-2010 Regis Houssin - * Copyright (C) 2010-2015 Juanjo Menent - * Copyright (C) 2014 Jean Heimburger - * Copyright (C) 2015 Marcos García - * Copyright (C) 2015 Raphaël Doursenaud - * Copyright (C) 2021 Frédéric France +/* Copyright (C) 2001-2005 Rodolphe Quiedeville + * Copyright (C) 2003 Eric Seigne + * Copyright (C) 2004-2016 Laurent Destailleur + * Copyright (C) 2005-2010 Regis Houssin + * Copyright (C) 2010-2015 Juanjo Menent + * Copyright (C) 2014 Jean Heimburger + * Copyright (C) 2015 Marcos García + * Copyright (C) 2015 Raphaël Doursenaud + * Copyright (C) 2021 Frédéric France * Copyright (C) 2024 MDW + * Copyright (C) 2024 Alexandre Spangaro * * 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 @@ -34,7 +35,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; -require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture-rec.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture-rec.class.php'; require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; @@ -46,7 +47,8 @@ if (isModEnabled('category')) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; } if (isModEnabled('accounting')) { - require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; + require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; + require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; } // Load translation files required by page @@ -106,7 +108,18 @@ if (empty($reshook)) { $action = ""; } - // Set supplier accounting account + // set general supplier accounting account + if ($action == 'setsupplieraccountancycodegeneral' && $user->hasRight('societe', 'creer')) { + $result = $object->fetch($id); + $object->accountancy_code_supplier_general = GETPOST("supplieraccountancycodegeneral"); + $result = $object->update($object->id, $user, 1, 0, 1); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + $_GET['action'] = 'editsupplieraccountancycode'; + } + } + + // Set auxiliary supplier accounting account if ($action == 'setsupplieraccountancycode' && $user->hasRight('societe', 'creer')) { $result = $object->fetch($id); $object->code_compta_fournisseur = GETPOST("supplieraccountancycode"); @@ -248,6 +261,27 @@ if ($object->id > 0) { print ''; print ''; + if (isModEnabled('accounting')) { + $formaccounting = new FormAccounting($db); + + print ''; + print ''; + print $form->editfieldkey("SupplierAccountancyCodeGeneral", 'supplieraccountancycodegeneral', length_accountg($object->accountancy_code_supplier_general), $object, $user->hasRight('societe', 'creer')); + print ''; + if ($action == 'editsupplieraccountancycodegeneral' && $user->hasRight('societe', 'creer')) { + print $formaccounting->formAccountingAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->accountancy_code_supplier_general, 'supplieraccountancycodegeneral', 0, 1, '', 1); + } else { + $accountingaccount = new AccountingAccount($db); + $accountingaccount->fetch(0, $object->accountancy_code_supplier_general, 1); + + print $accountingaccount->getNomUrl(0, 1, 1, '', 1); + } + $accountingAccountByDefault = " (" . $langs->trans("AccountingAccountByDefaultShort") . ": " . length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER')) . ")"; + print (getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER') ? $accountingAccountByDefault : ''); + print ''; + print ''; + } + $langs->load('compta'); print ''; print ''; diff --git a/htdocs/hrm/lib/hrm.lib.php b/htdocs/hrm/lib/hrm.lib.php index 88a851f0137..3dd00c38b62 100644 --- a/htdocs/hrm/lib/hrm.lib.php +++ b/htdocs/hrm/lib/hrm.lib.php @@ -5,6 +5,7 @@ * Copyright (C) 2021 Jean-Pascal BOUDET * Copyright (C) 2021 Grégory BLEMAND * Copyright (C) 2022 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 @@ -29,7 +30,7 @@ /** * Prepare admin pages header * - * @return array + * @return array Array of tabs to show */ function hrmAdminPrepareHead() { diff --git a/htdocs/hrm/lib/hrm_job.lib.php b/htdocs/hrm/lib/hrm_job.lib.php index adeb2637445..69df852cadf 100644 --- a/htdocs/hrm/lib/hrm_job.lib.php +++ b/htdocs/hrm/lib/hrm_job.lib.php @@ -3,6 +3,7 @@ * Copyright (C) 2021 Greg Rastklan * Copyright (C) 2021 Jean-Pascal BOUDET * Copyright (C) 2021 Grégory BLEMAND + * 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 @@ -28,7 +29,7 @@ * Prepare array of tabs for Job * * @param Job $object Job - * @return array Array of tabs + * @return array Array of tabs to show */ function jobPrepareHead($object) { diff --git a/htdocs/hrm/lib/hrm_position.lib.php b/htdocs/hrm/lib/hrm_position.lib.php index 2cb05a9593b..c21c042bbc6 100644 --- a/htdocs/hrm/lib/hrm_position.lib.php +++ b/htdocs/hrm/lib/hrm_position.lib.php @@ -3,6 +3,7 @@ * Copyright (C) 2021 Greg Rastklan * Copyright (C) 2021 Jean-Pascal BOUDET * Copyright (C) 2021 Grégory BLEMAND + * 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 @@ -29,7 +30,7 @@ * Prepare array of tabs for positions * * @param Position $object Position - * @return array Array of tabs + * @return array Array of tabs to show */ function positionCardPrepareHead($object) { diff --git a/htdocs/hrm/lib/hrm_skill.lib.php b/htdocs/hrm/lib/hrm_skill.lib.php index c3b7b892c79..9c5a61c158c 100644 --- a/htdocs/hrm/lib/hrm_skill.lib.php +++ b/htdocs/hrm/lib/hrm_skill.lib.php @@ -3,6 +3,7 @@ * Copyright (C) 2021 Greg Rastklan * Copyright (C) 2021 Jean-Pascal BOUDET * Copyright (C) 2021 Grégory BLEMAND + * 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 @@ -28,7 +29,7 @@ * Prepare array of tabs for Skill * * @param Skill $object Skill - * @return array Array of tabs + * @return array Array of tabs to show */ function skillPrepareHead($object) { diff --git a/htdocs/hrm/lib/hrm_skilldet.lib.php b/htdocs/hrm/lib/hrm_skilldet.lib.php index 1ba52808f28..679fae5ffb0 100644 --- a/htdocs/hrm/lib/hrm_skilldet.lib.php +++ b/htdocs/hrm/lib/hrm_skilldet.lib.php @@ -3,6 +3,7 @@ * Copyright (C) 2021 Greg Rastklan * Copyright (C) 2021 Jean-Pascal BOUDET * Copyright (C) 2021 Grégory BLEMAND + * 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 @@ -28,7 +29,7 @@ * Prepare array of tabs for Skilldet * * @param Skilldet $object Skilldet - * @return array Array of tabs + * @return array Array of tabs to show */ function skilldetPrepareHead($object) { diff --git a/htdocs/hrm/lib/hrm_skillrank.lib.php b/htdocs/hrm/lib/hrm_skillrank.lib.php index 1d0083ea37f..6ab9e994f5e 100644 --- a/htdocs/hrm/lib/hrm_skillrank.lib.php +++ b/htdocs/hrm/lib/hrm_skillrank.lib.php @@ -3,6 +3,7 @@ * Copyright (C) 2021 Greg Rastklan * Copyright (C) 2021 Jean-Pascal BOUDET * Copyright (C) 2021 Grégory BLEMAND + * 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 @@ -28,7 +29,7 @@ * Prepare array of tabs for SkillRank * * @param SkillRank $object SkillRank - * @return array Array of tabs + * @return array Array of tabs to show */ function skillrankPrepareHead($object) { @@ -115,7 +116,7 @@ function displayRankInfos($selected_rank, $fk_skill, $inputname = 'TNote', $mode $skilldet = new Skilldet($db); $Lines = $skilldet->fetchAll('ASC', 'rankorder', 0, 0, '(fk_skill:=:'.((int) $fk_skill).')'); - if (!is_array($Lines) && $Lines<0) { + if (!is_array($Lines) && $Lines < 0) { setEventMessages($skilldet->error, $skilldet->errors, 'errors'); } if (empty($Lines)) { diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index ef9bdf9a17c..a6e52a77659 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -355,7 +355,7 @@ if ($step == 1 || !$datatoimport) { //var_dump($key.' '.$value['position_of_profile'].' '.$value['import_code'].' '.$objimport->array_import_module[$key]['module']->getName().' '.$objimport->array_import_code[$key]); print ''; $titleofmodule = $objimport->array_import_module[$key]['module']->getName(); - // Special cas for import common to module/services + // Special case for import common to module/services if (in_array($objimport->array_import_code[$key], array('produit_supplierprices', 'produit_multiprice', 'produit_languages'))) { $titleofmodule = $langs->trans("ProductOrService"); } @@ -414,7 +414,7 @@ if ($step == 2 && $datatoimport) { print ''.$langs->trans("Module").''; print ''; $titleofmodule = $objimport->array_import_module[0]['module']->getName(); - // Special cas for import common to module/services + // Special case for import common to module/services if (in_array($objimport->array_import_code[0], array('produit_supplierprices', 'produit_multiprice', 'produit_languages'))) { $titleofmodule = $langs->trans("ProductOrService"); } @@ -531,7 +531,7 @@ if ($step == 3 && $datatoimport) { print ''.$langs->trans("Module").''; print ''; $titleofmodule = $objimport->array_import_module[0]['module']->getName(); - // Special cas for import common to module/services + // Special case for import common to module/services if (in_array($objimport->array_import_code[0], array('produit_supplierprices', 'produit_multiprice', 'produit_languages'))) { $titleofmodule = $langs->trans("ProductOrService"); } @@ -936,7 +936,7 @@ if ($step == 4 && $datatoimport) { print ''.$langs->trans("Module").''; print ''; $titleofmodule = $objimport->array_import_module[0]['module']->getName(); - // Special cas for import common to module/services + // Special case for import common to module/services if (in_array($objimport->array_import_code[0], array('produit_supplierprices', 'produit_multiprice', 'produit_languages'))) { $titleofmodule = $langs->trans("ProductOrService"); } @@ -1606,7 +1606,7 @@ if ($step == 5 && $datatoimport) { print ''.$langs->trans("Module").''; print ''; $titleofmodule = $objimport->array_import_module[0]['module']->getName(); - // Special cas for import common to module/services + // Special case for import common to module/services if (in_array($objimport->array_import_code[0], array('produit_supplierprices', 'produit_multiprice', 'produit_languages'))) { $titleofmodule = $langs->trans("ProductOrService"); } @@ -2095,7 +2095,7 @@ if ($step == 6 && $datatoimport) { print ''.$langs->trans("Module").''; print ''; $titleofmodule = $objimport->array_import_module[0]['module']->getName(); - // Special cas for import common to module/services + // Special case for import common to module/services if (in_array($objimport->array_import_code[0], array('produit_supplierprices', 'produit_multiprice', 'produit_languages'))) { $titleofmodule = $langs->trans("ProductOrService"); } diff --git a/htdocs/install/mysql/data/llx_accounting_category-accounting.sql b/htdocs/install/mysql/data/llx_accounting_category-accounting.sql new file mode 100644 index 00000000000..e1c19d2031e --- /dev/null +++ b/htdocs/install/mysql/data/llx_accounting_category-accounting.sql @@ -0,0 +1,26 @@ +-- Copyright (C) 2016-2024 Alexandre Spangaro +-- Copyright (C) 2017 Laurent Destailleur +-- +-- 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 +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- + +-- Insert first personalized report. This is a minimal default setup. +INSERT INTO llx_c_accounting_report (code, label, fk_country, active) VALUES ('REP', 'Report personalized', 0, 1); + +-- Group of accounting accounts for report. This is a minimal default setup. +INSERT INTO llx_c_accounting_category (rowid, fk_report, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 1, 1, 'INCOMES', 'Income of products/services', 'Example: 7xxxxx', 0, 0, '', '10', 0, 1); +INSERT INTO llx_c_accounting_category (rowid, fk_report, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 2, 1, 'EXPENSES', 'Expenses of products/services', 'Example: 6xxxxx', 0, 0, '', '20', 0, 1); +INSERT INTO llx_c_accounting_category (rowid, fk_report, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 3, 1, 'PROFIT', 'Balance', '', 0, 1, 'INCOMES+EXPENSES', '30', 0, 1); + diff --git a/htdocs/install/mysql/data/llx_accounting_category.sql b/htdocs/install/mysql/data/llx_accounting_category.sql deleted file mode 100644 index 6621dc32f52..00000000000 --- a/htdocs/install/mysql/data/llx_accounting_category.sql +++ /dev/null @@ -1,24 +0,0 @@ --- Copyright (C) 2016 Alexandre Spangaro --- Copyright (C) 2017 Laurent Destailleur --- --- 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 --- the Free Software Foundation; either version 3 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program. If not, see . --- --- - - --- Group of accounting accounts for report. This is a minimal default setup. -INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 1, 'INCOMES', 'Income of products/services', 'Example: 7xxxxx', 0, 0, '', '10', 0, 1); -INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 2, 'EXPENSES', 'Expenses of products/services', 'Example: 6xxxxx', 0, 0, '', '20', 0, 1); -INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 3, 'PROFIT', 'Balance', '', 0, 1, 'INCOMES+EXPENSES', '30', 0, 1); - diff --git a/htdocs/install/mysql/migration/20.0.0-21.0.0.sql b/htdocs/install/mysql/migration/20.0.0-21.0.0.sql index 48029144088..393d29b2674 100644 --- a/htdocs/install/mysql/migration/20.0.0-21.0.0.sql +++ b/htdocs/install/mysql/migration/20.0.0-21.0.0.sql @@ -134,28 +134,6 @@ ALTER TABLE llx_socpeople ADD COLUMN ip varchar(250); ALTER TABLE llx_webhook_target ADD COLUMN trigger_stack text; --- Product attribut extrafields -CREATE TABLE llx_product_attribute_extrafields -( - rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - fk_object integer NOT NULL, - import_key varchar(14) -- import key -) ENGINE=innodb; - -ALTER TABLE llx_product_attribute_extrafields ADD INDEX idx_product_attribute_extrafields (fk_object); - --- Product attribut value extrafields -CREATE TABLE llx_product_attribute_value_extrafields -( - rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - fk_object integer NOT NULL, - import_key varchar(14) -- import key -) ENGINE=innodb; - -ALTER TABLE llx_product_attribute_value_extrafields ADD INDEX idx_product_attribute_value_extrafields (fk_object); - ALTER TABLE llx_recruitment_recruitmentcandidature MODIFY fk_user_creat integer NULL; ALTER TABLE llx_ecm_files ADD COLUMN agenda_id integer; @@ -239,3 +217,38 @@ INNER JOIN llx_categorie AS c AND c.type = 8 SET bl.fk_categ = c.rowid WHERE c.rowid IS NOT NULL; + +-- Accounting - Add personalized multi-report +create table llx_c_accounting_report +( + rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY, + entity integer NOT NULL DEFAULT 1, + code varchar(16) NOT NULL, + label varchar(255) NOT NULL, + fk_country integer DEFAULT NULL, + active integer DEFAULT 1 +) ENGINE=innodb; + +ALTER TABLE llx_c_accounting_report ADD UNIQUE INDEX uk_c_accounting_report (code,entity); + +INSERT INTO llx_c_accounting_report (code, label, active) VALUES ('REP', 'Report personalized', 1); + +ALTER TABLE llx_c_accounting_category ADD COLUMN fk_report integer NOT NULL DEFAULT 1 AFTER entity; + +ALTER TABLE llx_c_accounting_category DROP INDEX uk_c_accounting_category; +ALTER TABLE llx_c_accounting_category ADD UNIQUE INDEX uk_c_accounting_category (code,entity,fk_report); + +create table llx_accounting_category_account +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + fk_accounting_category integer, + fk_accounting_account bigint +) ENGINE=innodb; + +ALTER TABLE llx_accounting_category_account ADD INDEX idx_accounting_category_account_fk_accounting_category (fk_accounting_category); +ALTER TABLE llx_accounting_category_account ADD CONSTRAINT fk_accounting_category_account_fk_accounting_category FOREIGN KEY (fk_accounting_category) REFERENCES llx_c_accounting_category (rowid); + +ALTER TABLE llx_accounting_category_account ADD INDEX idx_accounting_category_account_fk_accounting_account (fk_accounting_account); +ALTER TABLE llx_accounting_category_account ADD CONSTRAINT fk_accounting_category_account_fk_accounting_account FOREIGN KEY (fk_accounting_account) REFERENCES llx_accounting_account (rowid); + +ALTER TABLE llx_accounting_category_account ADD UNIQUE INDEX uk_accounting_category_account(fk_accounting_category, fk_accounting_account); diff --git a/htdocs/install/mysql/tables/llx_accounting_category_account-accounting.key.sql b/htdocs/install/mysql/tables/llx_accounting_category_account-accounting.key.sql new file mode 100644 index 00000000000..7c4a543ebc0 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_accounting_category_account-accounting.key.sql @@ -0,0 +1,26 @@ +-- =================================================================== +-- Copyright (C) 2024 Alexandre Spangaro +-- +-- 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 +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- Table for connect accounting category with accounting account +-- =================================================================== + +ALTER TABLE llx_accounting_category_account ADD INDEX idx_accounting_category_account_fk_accounting_category (fk_accounting_category); +ALTER TABLE llx_accounting_category_account ADD CONSTRAINT fk_accounting_category_account_fk_accounting_category FOREIGN KEY (fk_accounting_category) REFERENCES llx_c_accounting_category (rowid); + +ALTER TABLE llx_accounting_category_account ADD INDEX idx_accounting_category_account_fk_accounting_account (fk_accounting_account); +ALTER TABLE llx_accounting_category_account ADD CONSTRAINT fk_accounting_category_account_fk_accounting_account FOREIGN KEY (fk_accounting_account) REFERENCES llx_accounting_account (rowid); + +ALTER TABLE llx_accounting_category_account ADD UNIQUE INDEX uk_accounting_category_account (fk_accounting_category, fk_accounting_account); diff --git a/htdocs/install/mysql/tables/llx_accounting_category_account-accounting.sql b/htdocs/install/mysql/tables/llx_accounting_category_account-accounting.sql new file mode 100644 index 00000000000..876381fd431 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_accounting_category_account-accounting.sql @@ -0,0 +1,25 @@ +-- =================================================================== +-- Copyright (C) 2024 Alexandre Spangaro +-- +-- 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 +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- Table for connect accounting category with accounting account +-- =================================================================== + +CREATE TABLE llx_accounting_category_account +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + fk_accounting_category integer, + fk_accounting_account bigint +) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_c_accounting_category.key.sql b/htdocs/install/mysql/tables/llx_c_accounting_category-accounting.key.sql similarity index 88% rename from htdocs/install/mysql/tables/llx_c_accounting_category.key.sql rename to htdocs/install/mysql/tables/llx_c_accounting_category-accounting.key.sql index 5042fbae6ae..436f44718a7 100644 --- a/htdocs/install/mysql/tables/llx_c_accounting_category.key.sql +++ b/htdocs/install/mysql/tables/llx_c_accounting_category-accounting.key.sql @@ -1,5 +1,5 @@ -- =================================================================== --- Copyright (C) 2015-2016 Alexandre Spangaro +-- Copyright (C) 2015-2024 Alexandre Spangaro -- -- 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 @@ -17,5 +17,4 @@ -- Table with category for accounting account -- =================================================================== -ALTER TABLE llx_c_accounting_category ADD UNIQUE INDEX uk_c_accounting_category(code,entity); - +ALTER TABLE llx_c_accounting_category ADD UNIQUE INDEX uk_c_accounting_category (code,entity,fk_report); diff --git a/htdocs/install/mysql/tables/llx_c_accounting_category.sql b/htdocs/install/mysql/tables/llx_c_accounting_category-accounting.sql similarity index 83% rename from htdocs/install/mysql/tables/llx_c_accounting_category.sql rename to htdocs/install/mysql/tables/llx_c_accounting_category-accounting.sql index 697bd2a99f1..58e0f2de93d 100644 --- a/htdocs/install/mysql/tables/llx_c_accounting_category.sql +++ b/htdocs/install/mysql/tables/llx_c_accounting_category-accounting.sql @@ -1,6 +1,6 @@ -- =================================================================== --- Copyright (C) 2015-2016 Alexandre Spangaro --- Copyright (C) 2016 Jamal Elbaz +-- Copyright (C) 2015-2024 Alexandre Spangaro +-- Copyright (C) 2016 Jamal Elbaz -- -- 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 @@ -23,12 +23,13 @@ CREATE TABLE llx_c_accounting_category ( rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY, entity integer NOT NULL DEFAULT 1, + fk_report integer NOT NULL DEFAULT 1, code varchar(16) NOT NULL, label varchar(255) NOT NULL, range_account varchar(255) NOT NULL, -- Comment - sens tinyint NOT NULL DEFAULT '0', -- For international accounting 0 : credit - debit / 1 : debit - credit + sens tinyint NOT NULL DEFAULT '0', -- For international accounting | 0: credit - debit / 1: debit - credit category_type tinyint NOT NULL DEFAULT '0', -- Field calculated or not - formula varchar(255) NOT NULL, -- Example : 1 + 2 (rowid of the category) + formula varchar(255) NOT NULL, -- Example: 1 + 2 (rowid of the category) position integer DEFAULT 0, fk_country integer DEFAULT NULL, -- This category is dedicated to a country active integer DEFAULT 1 diff --git a/htdocs/install/mysql/tables/llx_c_accounting_report-accounting.key.sql b/htdocs/install/mysql/tables/llx_c_accounting_report-accounting.key.sql new file mode 100644 index 00000000000..2fab7c1e533 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_c_accounting_report-accounting.key.sql @@ -0,0 +1,20 @@ +-- =================================================================== +-- Copyright (C) 2024 Alexandre Spangaro +-- +-- 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 +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- Table for personalized report for category of accounting account +-- =================================================================== + +ALTER TABLE llx_c_accounting_report ADD UNIQUE INDEX uk_c_accounting_report (code,entity); diff --git a/htdocs/install/mysql/tables/llx_c_accounting_report-accounting.sql b/htdocs/install/mysql/tables/llx_c_accounting_report-accounting.sql new file mode 100644 index 00000000000..334a23dbcc9 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_c_accounting_report-accounting.sql @@ -0,0 +1,27 @@ +-- =================================================================== +-- Copyright (C) 2024 Alexandre Spangaro +-- +-- 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 +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- Table for personalized report for category of accounting account +-- =================================================================== + +CREATE TABLE llx_c_accounting_report ( + rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY, + entity integer NOT NULL DEFAULT 1, + code varchar(16) NOT NULL, + label varchar(255) NOT NULL, + fk_country integer DEFAULT NULL, -- This report is dedicated to a country + active integer DEFAULT 1 +) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_c_email_templates.sql b/htdocs/install/mysql/tables/llx_c_email_templates.sql index 06c053004ec..fd436bdc87b 100644 --- a/htdocs/install/mysql/tables/llx_c_email_templates.sql +++ b/htdocs/install/mysql/tables/llx_c_email_templates.sql @@ -30,7 +30,7 @@ create table llx_c_email_templates tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, label varchar(180), -- Label of predefined email position smallint, -- Position - defaultfortype smallint DEFAULT 0, -- 1=Use this template by default when creating a new email for this type + defaultfortype smallint DEFAULT 0, -- 1=Use this template by default when creating a new email for this type enabled varchar(255) DEFAULT '1', -- Condition to have this module visible active tinyint DEFAULT 1 NOT NULL, email_from varchar(255), -- default email from @@ -40,5 +40,5 @@ create table llx_c_email_templates topic text, -- Predefined topic joinfiles text, -- Files to attach content mediumtext, -- Predefined text - content_lines text -- Predefined lines + content_lines text -- Predefined text to use to generate the string concatenated with all lines )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_webhook_target-webhook.sql b/htdocs/install/mysql/tables/llx_webhook_target-webhook.sql index 2253084b9ca..3a6004a2d02 100644 --- a/htdocs/install/mysql/tables/llx_webhook_target-webhook.sql +++ b/htdocs/install/mysql/tables/llx_webhook_target-webhook.sql @@ -14,7 +14,7 @@ -- along with this program. If not, see https://www.gnu.org/licenses/. -CREATE TABLE llx_webhook_target( +CREATE TABLE llx_webhook_target ( -- BEGIN MODULEBUILDER FIELDS rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, ref varchar(128) NOT NULL, @@ -32,6 +32,6 @@ CREATE TABLE llx_webhook_target( connection_method varchar(255) NULL, -- to store the way to authenticate to the webhook connection_data varchar(255) NULL, -- to store the data to use to authenticate to the webhook trigger_codes text NULL, -- list of selected trigger that must call the webhook - trigger_stack text -- json object to store trigger to be sent manually + trigger_stack text -- json object to store trigger to be sent manually -- END MODULEBUILDER FIELDS ) ENGINE=innodb; diff --git a/htdocs/intracommreport/lib/intracommreport.lib.php b/htdocs/intracommreport/lib/intracommreport.lib.php index ad19b8002af..27467f2a125 100644 --- a/htdocs/intracommreport/lib/intracommreport.lib.php +++ b/htdocs/intracommreport/lib/intracommreport.lib.php @@ -1,5 +1,6 @@ * * 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 @@ -24,7 +25,7 @@ /** * Prepare admin pages header * - * @return array + * @return array Array of tabs to show */ function intracommreportAdminPrepareHead() { @@ -75,7 +76,7 @@ function intracommreportAdminPrepareHead() * Prepare array of tabs for IntraCommReport * * @param IntraCommReport $object IntraCommReport - * @return array Array of tabs + * @return array Array of tabs to show */ function intracommreportPrepareHead($object) { diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 913ee3b72ed..601a170444e 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1487,6 +1487,8 @@ ForceInvoiceDate=Force invoice date to validation date SuggestedPaymentModesIfNotDefinedInInvoice=Suggested payments mode on invoice by default if not defined on the invoice SuggestPaymentByRIBOnAccount=Suggest payment by withdrawal on account SuggestPaymentByChequeToAddress=Suggest payment by check to +InvoicePaymentManageStructuredCommunication=Generate structured communication for invoice payment +InvoicePaymentManageStructuredCommunicationHelp=In some countries, it is necessary to display a structured reference to facilitate payments and their reconciliation FreeLegalTextOnInvoices=Free text on invoices WatermarkOnDraftInvoices=Watermark on draft invoices (none if empty) PaymentsNumberingModule=Payments numbering model diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index f1e1bfc4e2d..d5c859db49a 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -514,6 +514,7 @@ PrettyLittleSentence=Accept the amount of payments due by checks issued in my na IntracommunityVATNumber=Intra-Community VAT ID PaymentByChequeOrderedTo=Check payments (including tax) are payable to %s, send to PaymentByChequeOrderedToShort=Check payments (incl. tax) are payable to +StructuredCommunication=Structured communication SendTo=sent to PaymentByTransferOnThisBankAccount=Payment by transfer to the following bank account VATIsNotUsedForInvoice=* Non applicable VAT art-293B of CGI diff --git a/htdocs/langs/en_US/boxes.lang b/htdocs/langs/en_US/boxes.lang index 19e38c96890..5cef15e6404 100644 --- a/htdocs/langs/en_US/boxes.lang +++ b/htdocs/langs/en_US/boxes.lang @@ -119,6 +119,9 @@ NoRecordedShipments=No recorded customer shipment BoxCustomersOutstandingBillReached=Customers with outstanding limit reached BoxTitleLastFediverseInfos=Last %s posts from %s BoxLastFediverseInfos=Latest Fediverse Updates: News and Trends +NoOpenedProjectsOpportunities=No open opportunities +NoOpenedProjects=No open projects +NoScheduledJobs=No Scheduled jobs # Pages UsersHome=Home users and groups MembersHome=Home Membership diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 0b8825cf058..17d9a2f4efa 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -349,6 +349,10 @@ QtyRecalculatedWithPackaging=The quantity of the line were recalculated accordin #Attributes Attributes=Attributes +ProductAttributeExtrafields=Variant attributes extrafields +ProductAttributeExtrafieldsSetup=Setup of Variant attributes extrafields +ProductAttributeValueExtrafields=Variant attributes values extrafields +ProductAttributeValueExtrafieldsSetup=Setup of Variant attributes values extrafields VariantAttributes=Variant attributes ProductAttributes=Variant attributes for products ProductAttributeName=Variant attribute %s diff --git a/htdocs/langs/fr_FR/boxes.lang b/htdocs/langs/fr_FR/boxes.lang index d4c0c4d6e86..f30449960da 100644 --- a/htdocs/langs/fr_FR/boxes.lang +++ b/htdocs/langs/fr_FR/boxes.lang @@ -118,6 +118,8 @@ NoRecordedShipments=Aucune expédition client BoxCustomersOutstandingBillReached=Clients dont l'en-cours de facturation est dépassé BoxTitleLastFediverseInfos=Les %s derniers messages de %s BoxLastFediverseInfos=Dernières mises à jour de Fediverse : Actualités et Tendances +NoOpenedProjectsOpportunities=Aucune opportunités ouvertes +NoOpenedProjects=Aucun projet ouvert # Pages UsersHome=Accueil des utilisateurs et groupes MembersHome=Accueil des adhérents diff --git a/htdocs/margin/lib/margins.lib.php b/htdocs/margin/lib/margins.lib.php index f6d94797387..abf1958dedb 100644 --- a/htdocs/margin/lib/margins.lib.php +++ b/htdocs/margin/lib/margins.lib.php @@ -27,7 +27,7 @@ /** * Define head array for tabs of marges tools setup pages * - * @return Array of head + * @return array Array of tabs to show */ function marges_admin_prepare_head() { @@ -55,7 +55,7 @@ function marges_admin_prepare_head() /** * Return array of tabs to used on pages for third parties cards. * - * @return array Array of tabs + * @return array Array of tabs to show */ function marges_prepare_head() { diff --git a/htdocs/mrp/lib/mrp.lib.php b/htdocs/mrp/lib/mrp.lib.php index 20840d40e1b..17e1eae0639 100644 --- a/htdocs/mrp/lib/mrp.lib.php +++ b/htdocs/mrp/lib/mrp.lib.php @@ -1,6 +1,7 @@ * 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 @@ -25,7 +26,7 @@ /** * Prepare admin pages header * - * @return array + * @return array Array of tabs to show */ function mrpAdminPrepareHead() { diff --git a/htdocs/mrp/lib/mrp_mo.lib.php b/htdocs/mrp/lib/mrp_mo.lib.php index 63f39445e91..3b135210fdd 100644 --- a/htdocs/mrp/lib/mrp_mo.lib.php +++ b/htdocs/mrp/lib/mrp_mo.lib.php @@ -1,6 +1,7 @@ + * 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 @@ -26,7 +27,7 @@ * Prepare array of tabs for Mo * * @param Mo $object Mo - * @return array Array of tabs + * @return array Array of tabs to show */ function moPrepareHead($object) { diff --git a/htdocs/opensurvey/lib/opensurvey.lib.php b/htdocs/opensurvey/lib/opensurvey.lib.php index 6ec2ee54605..cec135abe00 100644 --- a/htdocs/opensurvey/lib/opensurvey.lib.php +++ b/htdocs/opensurvey/lib/opensurvey.lib.php @@ -29,7 +29,7 @@ * It loads tabs from modules looking for the entity Opensurveyso * * @param Opensurveysondage $object Current viewing poll - * @return array Tabs for the opensurvey section + * @return array Tabs for the opensurvey section */ function opensurvey_prepare_head(Opensurveysondage $object) { diff --git a/htdocs/partnership/lib/partnership.lib.php b/htdocs/partnership/lib/partnership.lib.php index f5822e20a16..92ae9e1c4db 100644 --- a/htdocs/partnership/lib/partnership.lib.php +++ b/htdocs/partnership/lib/partnership.lib.php @@ -1,6 +1,7 @@ * 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 @@ -25,7 +26,7 @@ /** * Prepare admin pages header * - * @return array + * @return array Array of tabs to show */ function partnershipAdminPrepareHead() { @@ -78,7 +79,7 @@ function partnershipAdminPrepareHead() * Prepare array of tabs for Partnership * * @param Partnership $object Partnership - * @return array Array of tabs + * @return array Array of tabs to show */ function partnershipPrepareHead($object) { diff --git a/htdocs/paypal/lib/paypal.lib.php b/htdocs/paypal/lib/paypal.lib.php index 13733e2be52..8ba85109cb8 100644 --- a/htdocs/paypal/lib/paypal.lib.php +++ b/htdocs/paypal/lib/paypal.lib.php @@ -29,7 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; /** * Define head array for tabs of paypal tools setup pages * - * @return Array of head + * @return array Array of tabs to show */ function paypaladmin_prepare_head() { diff --git a/htdocs/printing/lib/printing.lib.php b/htdocs/printing/lib/printing.lib.php index 291ebd46ca8..fc038c68c3a 100644 --- a/htdocs/printing/lib/printing.lib.php +++ b/htdocs/printing/lib/printing.lib.php @@ -1,6 +1,7 @@ * Copyright (C) 2018 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 @@ -28,7 +29,7 @@ * Define head array for tabs of printing tools setup pages * * @param string $mode Mode - * @return array Array of head + * @return array Array of tabs to show */ function printingAdminPrepareHead($mode) { diff --git a/htdocs/product/inventory/lib/inventory.lib.php b/htdocs/product/inventory/lib/inventory.lib.php index a3534229246..cff17432fe7 100644 --- a/htdocs/product/inventory/lib/inventory.lib.php +++ b/htdocs/product/inventory/lib/inventory.lib.php @@ -1,6 +1,7 @@ * Copyright (C) 2015 ATM Consulting + * 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 @@ -25,7 +26,7 @@ /** * Define head array for tabs of inventory tools setup pages * - * @return array Array of head + * @return array Array of tabs to show */ function inventoryAdminPrepareHead() { @@ -64,7 +65,7 @@ function inventoryAdminPrepareHead() * @param string $title parameter * @param string $get parameter * - * @return array Array of head + * @return array Array of tabs to show */ function inventoryPrepareHead(&$inventory, $title = 'Inventory', $get = '') { @@ -75,7 +76,7 @@ function inventoryPrepareHead(&$inventory, $title = 'Inventory', $get = '') array(dol_buildpath('/product/inventory/inventory.php?id='.$inventory->id.$get, 1), $langs->trans('Inventory'), 'inventory') ); - $h=2; + $h = 2; complete_head_from_modules($conf, $langs, $inventory, $head, $h, 'inventory'); complete_head_from_modules($conf, $langs, $inventory, $head, $h, 'inventory', 'remove'); diff --git a/htdocs/product/stock/stocktransfer/lib/stocktransfer.lib.php b/htdocs/product/stock/stocktransfer/lib/stocktransfer.lib.php index 90fd3f25ba9..0392e51dff0 100644 --- a/htdocs/product/stock/stocktransfer/lib/stocktransfer.lib.php +++ b/htdocs/product/stock/stocktransfer/lib/stocktransfer.lib.php @@ -1,6 +1,7 @@ + * 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 @@ -25,7 +26,7 @@ /** * Prepare admin pages header * - * @return array + * @return array Array of tabs to show */ function stocktransferAdminPrepareHead() { diff --git a/htdocs/projet/class/projectstats.class.php b/htdocs/projet/class/projectstats.class.php index 5c4e6c2045a..48500e722be 100644 --- a/htdocs/projet/class/projectstats.class.php +++ b/htdocs/projet/class/projectstats.class.php @@ -135,7 +135,7 @@ class ProjectStats extends Stats /** * Return count, and sum of products * - * @return array of values + * @return array Array of values */ public function getAllByYear() { @@ -237,7 +237,7 @@ class ProjectStats extends Stats * * @param int $year Year to scan * @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month - * @return array Array of values + * @return array,array{0:int<1,12>,1:int}> Array with number by month */ public function getNbByMonth($year, $format = 0) { @@ -262,7 +262,7 @@ class ProjectStats extends Stats * * @param int $year Year to scan * @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month - * @return array Array with amount by month + * @return array,array{0:int<1,12>,1:int|float}> Array with amount by month */ public function getAmountByMonth($year, $format = 0) { @@ -374,7 +374,7 @@ class ProjectStats extends Stats * * @param int $year Year to scan * @param int $wonlostfilter Add a filter on status won/lost - * @return array Array with amount by month + * @return array,array{0:int<1,12>,1:int|float}> Array with amount by month */ public function getWeightedAmountByMonth($year, $wonlostfilter = 1) { @@ -482,7 +482,7 @@ class ProjectStats extends Stats * * @param int $year Year to scan * @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month - * @return array Array with amount by month + * @return array,array{0:int<1,12>,1:int|float}> Array with amount by month */ public function getTransformRateByMonth($year, $format = 0) { @@ -531,7 +531,7 @@ class ProjectStats extends Stats /** * Return average of entity by month * @param int $year year number - * @return array + * @return array,array{0:int<1,12>,1:int|float}> Array with number by month */ protected function getAverageByMonth($year) { diff --git a/htdocs/projet/class/taskstats.class.php b/htdocs/projet/class/taskstats.class.php index 9d792420754..b4290635b7e 100644 --- a/htdocs/projet/class/taskstats.class.php +++ b/htdocs/projet/class/taskstats.class.php @@ -1,6 +1,7 @@ * 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 @@ -113,7 +114,7 @@ class TaskStats extends Stats /** * Return count, and sum of products * - * @return array of values + * @return array Array of values */ public function getAllByYear() { @@ -173,7 +174,7 @@ class TaskStats extends Stats * * @param int $year Year to scan * @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month - * @return array Array of values + * @return array,array{0:int<1,12>,1:int}> Array with number by month */ public function getNbByMonth($year, $format = 0) { @@ -201,7 +202,7 @@ class TaskStats extends Stats * * @param int $year Year to scan * @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month - * @return array Array with amount by month + * @return array,array{0:int<1,12>,1:int|float}> Array of values */ public function getAmountByMonth($year, $format = 0) { diff --git a/htdocs/projet/stats/index.php b/htdocs/projet/stats/index.php index eb99b0d35d1..6a3bcc6724a 100644 --- a/htdocs/projet/stats/index.php +++ b/htdocs/projet/stats/index.php @@ -1,6 +1,7 @@ * Copyright (C) 2015-2021 Laurent Destailleur + * 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 @@ -279,7 +280,7 @@ print ''; $oldyear = 0; foreach ($data_all_year as $val) { $year = $val['year']; - while ($year && $oldyear > $year + 1) { // If we have empty year + while ($year && $oldyear > (int) $year + 1) { // If we have empty year $oldyear--; print ''; diff --git a/htdocs/projet/tasks/stats/index.php b/htdocs/projet/tasks/stats/index.php index fc6bdc33d97..04e2b9fbccf 100644 --- a/htdocs/projet/tasks/stats/index.php +++ b/htdocs/projet/tasks/stats/index.php @@ -1,6 +1,7 @@ * Copyright (C) 2015 Laurent Destailleur + * 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 @@ -190,7 +191,7 @@ print ''; $oldyear = 0; foreach ($data_all_year as $val) { $year = $val['year']; - while ($year && $oldyear > $year + 1) { // If we have empty year + while ($year && $oldyear > (int) $year + 1) { // If we have empty year $oldyear--; print ''; diff --git a/htdocs/public/project/suggestbooth.php b/htdocs/public/project/suggestbooth.php index eff1c46628b..e8fe227c50d 100644 --- a/htdocs/public/project/suggestbooth.php +++ b/htdocs/public/project/suggestbooth.php @@ -67,7 +67,7 @@ $error = 0; $backtopage = GETPOST('backtopage', 'alpha'); $action = GETPOST('action', 'aZ09'); -$eventtype = GETPOST("eventtype"); +$eventtype = GETPOSTINT("eventtype"); $email = GETPOST("email"); $societe = GETPOST("societe"); $label = GETPOST("label"); diff --git a/htdocs/public/project/suggestconference.php b/htdocs/public/project/suggestconference.php index ff764b1fcae..ad1a877e085 100644 --- a/htdocs/public/project/suggestconference.php +++ b/htdocs/public/project/suggestconference.php @@ -67,7 +67,7 @@ $error = 0; $backtopage = GETPOST('backtopage', 'alpha'); $action = GETPOST('action', 'aZ09'); -$eventtype = GETPOST("eventtype"); +$eventtype = GETPOSTINT("eventtype"); $email = GETPOST("email"); $societe = GETPOST("societe"); $label = GETPOST("label"); diff --git a/htdocs/reception/class/receptionstats.class.php b/htdocs/reception/class/receptionstats.class.php index fa62583f102..fb5bb7ac696 100644 --- a/htdocs/reception/class/receptionstats.class.php +++ b/htdocs/reception/class/receptionstats.class.php @@ -167,7 +167,7 @@ class ReceptionStats extends Stats * Return the orders amount average by month for a year * * @param int $year year for stats - * @return array,array{0:int<1,12>,1:int|float}> Array of average each month array with number by month + * @return array,array{0:int<1,12>,1:int|float}> Array of average each month */ public function getAverageByMonth($year) { @@ -189,7 +189,7 @@ class ReceptionStats extends Stats /** * Return nb, total and average * - * @return array Array with nb, total amount, average for each year + * @return array Array of values */ public function getAllByYear() { diff --git a/htdocs/resource/element_resource.php b/htdocs/resource/element_resource.php index 3f74defca3c..f10db268366 100644 --- a/htdocs/resource/element_resource.php +++ b/htdocs/resource/element_resource.php @@ -113,6 +113,7 @@ if ($reshook < 0) { if (empty($reshook)) { $error = 0; + $objstat = null; if ($action == 'add_element_resource' && !$cancel) { $res = 0; @@ -185,7 +186,7 @@ if (empty($reshook)) { } } - if (!$error && $res > 0) { + if (!$error && $res > 0 && is_object($objstat)) { setEventMessages($langs->trans('ResourceLinkedWithSuccess'), null, 'mesgs'); header("Location: ".$_SERVER['PHP_SELF'].'?element='.$element.'&element_id='.$objstat->id); exit; @@ -195,15 +196,15 @@ if (empty($reshook)) { } // Update resource - if ($action == 'update_linked_resource' && $user->hasRight('resource', 'write') && !GETPOST('cancel', 'alpha')) { + if ($action == 'update_linked_resource' && $user->hasRight('resource', 'write') && !GETPOST('cancel', 'alpha') && is_object($objstat)) { $res = $object->fetchElementResource($lineid); if ($res) { $object->busy = $busy; $object->mandatory = $mandatory; if (getDolGlobalString('RESOURCE_USED_IN_EVENT_CHECK') && $object->element_type == 'action' && $object->resource_type == 'dolresource' && intval($object->busy) == 1) { - $eventDateStart = $object->objelement->datep; - $eventDateEnd = $object->objelement->datef; + $eventDateStart = $object->objelement->datep; // @phan-suppress-current-line PhanUndeclaredProperty + $eventDateEnd = $object->objelement->datef; // @phan-suppress-current-line PhanUndeclaredProperty $isFullDayEvent = $objstat->fulldayevent; if (empty($eventDateEnd)) { if ($isFullDayEvent) { @@ -482,7 +483,7 @@ if (!$ret) { $listofcontactid = array(); // not used yet $listofotherid = array(); // not used yet print '
'; - print $form->select_dolusers_forevent('view', 'assignedtouser', 1, '', 0, '', '', 0, 0, 0, '', ($act->datep != $act->datef) ? 1 : 0, $listofuserid, $listofcontactid, $listofotherid); + print $form->select_dolusers_forevent('view', 'assignedtouser', 1, array(), 0, '', array(), 0, 0, 0, '', ($act->datep != $act->datef) ? 1 : 0, $listofuserid, $listofcontactid, $listofotherid); print '
'; /*if (in_array($user->id,array_keys($listofuserid))) { diff --git a/htdocs/salaries/class/paymentsalary.class.php b/htdocs/salaries/class/paymentsalary.class.php index ff54b229846..64269370560 100644 --- a/htdocs/salaries/class/paymentsalary.class.php +++ b/htdocs/salaries/class/paymentsalary.class.php @@ -80,13 +80,14 @@ class PaymentSalary extends CommonObject public $datep = ''; /** - * @deprecated + * @deprecated Use $amount * @see $amount + * @var float|string */ public $total; /** - * @var float Total amount of payment + * @var float Total amount of payment */ public $amount; @@ -102,7 +103,7 @@ class PaymentSalary extends CommonObject /** * @var string - * @deprecated + * @deprecated Use $num_payment */ public $num_paiement; @@ -295,7 +296,7 @@ class PaymentSalary extends CommonObject //$deposits=$tmpsalary->getSumDepositsUsed(); $deposits = 0; $alreadypayed = price2num($paiement + $creditnotes + $deposits, 'MT'); - $remaintopay = price2num($tmpsalary->amount - $paiement - $creditnotes - $deposits, 'MT'); + $remaintopay = price2num((float) $tmpsalary->amount - $paiement - $creditnotes - $deposits, 'MT'); if ($remaintopay == 0) { $result = $tmpsalary->setPaid($user); } else { diff --git a/htdocs/salaries/class/salariesstats.class.php b/htdocs/salaries/class/salariesstats.class.php index 384e939787e..11c250fcab4 100644 --- a/htdocs/salaries/class/salariesstats.class.php +++ b/htdocs/salaries/class/salariesstats.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2018 Alexandre Spangaro * Copyright (c) 2018 Fidesio * Copyright (C) 2021 Gauthier VERDOL + * 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 @@ -47,7 +48,7 @@ class SalariesStats extends Stats * * @param DoliDB $db Database handler * @param int $socid Id third party - * @param mixed $userid Id user for filter or array of user ids + * @param int|int[] $userid Id user for filter or array of user ids * @return void */ public function __construct($db, $socid = 0, $userid = 0) @@ -77,7 +78,7 @@ class SalariesStats extends Stats /** * Return the number of salary by year * - * @return array Array of values + * @return array Array of nb each year */ public function getNbByYear() { @@ -95,7 +96,7 @@ class SalariesStats extends Stats * * @param int $year Year to scan * @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month - * @return array Array of values by month + * @return array,array{0:int<1,12>,1:int}> Array with number by month */ public function getNbByMonth($year, $format = 0) { @@ -117,7 +118,7 @@ class SalariesStats extends Stats * * @param int $year Year to scan * @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month - * @return array Array of values + * @return array,array{0:int<1,12>,1:int|float}> Array of values */ public function getAmountByMonth($year, $format = 0) { @@ -137,7 +138,7 @@ class SalariesStats extends Stats * Return average amount * * @param int $year Year to scan - * @return array Array of values + * @return array,array{0:int<1,12>,1:int|float}> Array of values */ public function getAverageByMonth($year) { @@ -154,7 +155,7 @@ class SalariesStats extends Stats /** * Return nb, total and average * - * @return array Array of values + * @return array Array of values */ public function getAllByYear() { diff --git a/htdocs/salaries/class/salary.class.php b/htdocs/salaries/class/salary.class.php index 1daacafe330..5e8f0901494 100644 --- a/htdocs/salaries/class/salary.class.php +++ b/htdocs/salaries/class/salary.class.php @@ -67,10 +67,22 @@ class Salary extends CommonObject */ public $fk_user; + /** + * @var int|string + */ public $datep; + /** + * @var int|string + */ public $datev; + /** + * @var string + */ public $salary; + /** + * @var float|string + */ public $amount; /** @@ -78,7 +90,13 @@ class Salary extends CommonObject */ public $fk_project; + /** + * @var int + */ public $type_payment; // TODO Rename into type_payment_id + /** + * @var string + */ public $type_payment_code; /** @@ -86,7 +104,13 @@ class Salary extends CommonObject */ public $label; + /** + * @var int|string + */ public $datesp; + /** + * @var int|string + */ public $dateep; /** @@ -116,19 +140,22 @@ class Salary extends CommonObject public $fk_user_modif; /** - * @var user User + * @var User */ public $user; /** - * @var int 1 if salary paid COMPLETELY, 0 otherwise (do not use it anymore, use statut and close_code) - * @deprecated + * @var int<0,1> 1 if salary paid COMPLETELY, 0 otherwise (do not use it anymore, use statut and close_code) + * @deprecated Use $status and $close_code */ public $paye; const STATUS_UNPAID = 0; const STATUS_PAID = 1; + /** + * @var string + */ public $resteapayer; public $fields = array( @@ -847,7 +874,9 @@ class Salary extends CommonObject $return .= ''; } if (!empty($arraydata['user']) && is_object($arraydata['user'])) { - $return .= '
'.$arraydata['user']->getNomUrl(empty($arraydata['user']->photo) ? 1 : -1, '', 0, 0, 16, 0, '', 'maxwidth100').''; + $user = $arraydata['user']; + '@phan-var-force User $user'; + $return .= '
'.$user->getNomUrl(empty($arraydata['user']->photo) ? 1 : -1, '', 0, 0, 16, 0, '', 'maxwidth100').''; } if (property_exists($this, 'amount')) { $return .= '
'.price($this->amount).''; diff --git a/htdocs/salaries/paiement_salary.php b/htdocs/salaries/paiement_salary.php index 5f3165ed14b..b9095416ec3 100644 --- a/htdocs/salaries/paiement_salary.php +++ b/htdocs/salaries/paiement_salary.php @@ -2,6 +2,7 @@ /* Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2016-2018 Frédéric France * Copyright (C) 2021 Gauthier VERDOL + * 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 @@ -282,7 +283,7 @@ if ($action == 'create') { print ''.price($sumpaid).""; - print ''.price($objp->amount - $sumpaid).""; + print ''.price((float) $objp->amount - $sumpaid).""; print ''; if ($sumpaid < $objp->amount) { @@ -292,7 +293,7 @@ if ($action == 'create') { if (!empty($conf->use_javascript_ajax)) { print img_picto("Auto fill", 'rightarrow', "class='AutoFillAmount' data-rowid='".$namef."' data-value='".($objp->amount - $sumpaid)."'"); } */ - $valuetoshow = GETPOSTISSET($namef) ? GETPOST($namef) : ($objp->amount - $sumpaid); + $valuetoshow = GETPOSTISSET($namef) ? GETPOST($namef) : ((float) $objp->amount - $sumpaid); print ''; print ''; diff --git a/htdocs/salaries/stats/index.php b/htdocs/salaries/stats/index.php index 592883b8443..0566503e631 100644 --- a/htdocs/salaries/stats/index.php +++ b/htdocs/salaries/stats/index.php @@ -240,7 +240,7 @@ print ''; $oldyear = 0; foreach ($data as $val) { $year = $val['year']; - while ($year && $oldyear > $year + 1) { + while ($year && $oldyear > (int) $year + 1) { // If we have empty year $oldyear--; diff --git a/htdocs/salaries/virement_request.php b/htdocs/salaries/virement_request.php index 96a5db052a2..a2733f878b4 100644 --- a/htdocs/salaries/virement_request.php +++ b/htdocs/salaries/virement_request.php @@ -424,7 +424,7 @@ if ($resql) { // print ''.$langs->trans("AlreadyPaid").' :'.price($totalpaid)."\n"; // print ''.$langs->trans("AmountExpected").' :'.price($object->amount)."\n"; - $resteapayer = $object->amount - $totalpaid; + $resteapayer = (float) $object->amount - $totalpaid; // $cssforamountpaymentcomplete = 'amountpaymentcomplete'; // print ''.$langs->trans("RemainderToPay")." :"; diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 0e8fee90371..a1a8b990b93 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -362,17 +362,17 @@ if (empty($reshook)) { $object->prefix_comm = GETPOST('prefix_comm', 'alphanohtml'); $object->code_client = GETPOSTISSET('customer_code') ? GETPOST('customer_code', 'alpha') : GETPOST('code_client', 'alpha'); $object->code_fournisseur = GETPOSTISSET('supplier_code') ? GETPOST('supplier_code', 'alpha') : GETPOST('code_fournisseur', 'alpha'); - $object->capital = GETPOST('capital', 'alphanohtml'); + $object->capital = GETPOSTFLOAT('capital'); $object->barcode = GETPOST('barcode', 'alphanohtml'); $object->tva_intra = GETPOST('tva_intra', 'alphanohtml'); - $object->tva_assuj = GETPOST('assujtva_value', 'alpha'); + $object->tva_assuj = GETPOSTINT('assujtva_value'); $object->vat_reverse_charge = GETPOST('vat_reverse_charge') == 'on' ? 1 : 0; - $object->status = GETPOST('status', 'alpha'); + $object->status = GETPOSTINT('status'); // Local Taxes - $object->localtax1_assuj = GETPOST('localtax1assuj_value', 'alpha'); - $object->localtax2_assuj = GETPOST('localtax2assuj_value', 'alpha'); + $object->localtax1_assuj = GETPOSTINT('localtax1assuj_value'); + $object->localtax2_assuj = GETPOSTINT('localtax2assuj_value'); $object->localtax1_value = GETPOST('lt1', 'alpha'); $object->localtax2_value = GETPOST('lt2', 'alpha'); @@ -1040,8 +1040,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio } // Prospect / Customer if (GETPOST("type", 'aZ') == 'c') { - if (getDolGlobalString('THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT')) { - $object->client = getDolGlobalString('THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT'); + if (getDolGlobalInt('THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT')) { + $object->client = getDolGlobalInt('THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT'); } else { $object->client = 3; } @@ -1092,7 +1092,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio $object->fax = GETPOST('fax', 'alpha'); $object->email = GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL); $object->url = GETPOST('url', 'custom', 0, FILTER_SANITIZE_URL); - $object->capital = GETPOST('capital', 'alphanohtml'); + $object->capital = GETPOSTFLOAT('capital'); $paymentTermId = GETPOSTINT('cond_reglement_id'); // can be set by default values on create page and not already in get or post variables if (empty($paymentTermId) && !GETPOSTISSET('cond_reglement_id')) { $paymentTermId = getDolGlobalString('MAIN_DEFAULT_PAYMENT_TERM_ID'); @@ -1122,8 +1122,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio $object->localtax1_assuj = GETPOSTINT('localtax1assuj_value'); $object->localtax2_assuj = GETPOSTINT('localtax2assuj_value'); - $object->localtax1_value = GETPOSTINT('lt1'); - $object->localtax2_value = GETPOSTINT('lt2'); + $object->localtax1_value = GETPOST('lt1', 'alpha'); + $object->localtax2_value = GETPOST('lt2', 'alpha'); $object->tva_intra = GETPOST('tva_intra', 'alphanohtml'); @@ -2089,7 +2089,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio $object->email = GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL); $object->no_email = GETPOSTINT("no_email"); $object->url = GETPOST('url', 'custom', 0, FILTER_SANITIZE_URL); - $object->capital = GETPOST('capital', 'alphanohtml'); + $object->capital = GETPOSTFLOAT('capital'); $object->idprof1 = GETPOST('idprof1', 'alphanohtml'); $object->idprof2 = GETPOST('idprof2', 'alphanohtml'); $object->idprof3 = GETPOST('idprof3', 'alphanohtml'); @@ -2137,8 +2137,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio } //Local Taxes - $object->localtax1_assuj = GETPOST('localtax1assuj_value'); - $object->localtax2_assuj = GETPOST('localtax2assuj_value'); + $object->localtax1_assuj = GETPOSTINT('localtax1assuj_value'); + $object->localtax2_assuj = GETPOSTINT('localtax2assuj_value'); $object->localtax1_value = GETPOST('lt1'); $object->localtax2_value = GETPOST('lt2'); @@ -2690,7 +2690,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio // Capital print ''.$form->editfieldkey('Capital', 'capital', '', $object, 0).''; print ' '.$langs->trans("Currency".$object->multicurrency_code).''; } else { diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 794c9807712..c1efa366118 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -682,7 +682,13 @@ class Societe extends CommonObject public $code_compta_fournisseur; /** - * Accounting code for supplier + * Accounting general account for supplier + * @var string + */ + public $accountancy_code_supplier_general; + + /** + * Accounting auxiliary account for supplier * @var string */ public $accountancy_code_supplier; @@ -989,6 +995,7 @@ class Societe extends CommonObject $this->accountancy_code_customer_general = trim($this->accountancy_code_customer_general); $this->accountancy_code_customer = trim((string) $this->code_compta_client); + $this->accountancy_code_supplier_general = trim($this->accountancy_code_supplier_general); $this->accountancy_code_supplier = trim((string) $this->code_compta_fournisseur); $this->accountancy_code_buy = trim((string) $this->accountancy_code_buy); $this->accountancy_code_sell = trim((string) $this->accountancy_code_sell); @@ -1089,6 +1096,7 @@ class Societe extends CommonObject $sql .= ", vat_reverse_charge"; $sql .= ", accountancy_code_customer_general"; $sql .= ", accountancy_code_customer"; + $sql .= ", accountancy_code_supplier_general"; $sql .= ", accountancy_code_supplier"; $sql .= ", accountancy_code_buy"; $sql .= ", accountancy_code_sell"; @@ -1098,6 +1106,7 @@ class Societe extends CommonObject $sql .= ", ".(empty($this->vat_reverse_charge) ? '0' : '1'); $sql .= ", '".$this->db->escape($this->accountancy_code_customer_general)."'"; $sql .= ", '".$this->db->escape($this->accountancy_code_customer)."'"; + $sql .= ", '".$this->db->escape($this->accountancy_code_supplier_general)."'"; $sql .= ", '".$this->db->escape($this->accountancy_code_supplier)."'"; $sql .= ", '".$this->db->escape($this->accountancy_code_buy)."'"; $sql .= ", '".$this->db->escape($this->accountancy_code_sell)."'"; @@ -1503,8 +1512,10 @@ class Societe extends CommonObject $this->get_codefournisseur($this, 1); } + $this->accountancy_code_customer_general = trim($this->accountancy_code_customer_general); $this->code_compta_client = trim($this->code_compta_client); - $this->code_compta_fournisseur = (empty($this->code_compta_fournisseur) ? '' : trim($this->code_compta_fournisseur)); + $this->accountancy_code_supplier_general = trim($this->accountancy_code_supplier_general); + $this->code_compta_fournisseur = trim($this->code_compta_fournisseur); // Check parameters. More tests are done later in the ->verify() if (!is_numeric($this->client) && !is_numeric($this->fournisseur)) { @@ -1686,6 +1697,7 @@ class Societe extends CommonObject } if ($supplier) { + $sql .= ", accountancy_code_supplier_general = ".(!empty($this->accountancy_code_supplier_general) ? "'".$this->db->escape($this->accountancy_code_supplier_general)."'" : "null"); $sql .= ", code_compta_fournisseur = ".(($this->code_compta_fournisseur != "") ? "'".$this->db->escape($this->code_compta_fournisseur)."'" : "null"); } } @@ -1779,6 +1791,7 @@ class Societe extends CommonObject $sql .= ", vat_reverse_charge"; $sql .= ", accountancy_code_customer_general"; $sql .= ", accountancy_code_customer"; + $sql .= ", accountancy_code_supplier_general"; $sql .= ", accountancy_code_supplier"; $sql .= ", accountancy_code_buy"; $sql .= ", accountancy_code_sell"; @@ -1788,6 +1801,7 @@ class Societe extends CommonObject $sql .= ", ".(empty($this->vat_reverse_charge) ? '0' : '1'); $sql .= ", '".$this->db->escape($this->accountancy_code_customer_general)."'"; $sql .= ", '".$this->db->escape($this->code_compta_client)."'"; + $sql .= ", '".$this->db->escape($this->accountancy_code_supplier_general)."'"; $sql .= ", '".$this->db->escape($this->code_compta_fournisseur)."'"; $sql .= ", '".$this->db->escape($this->accountancy_code_buy)."'"; $sql .= ", '".$this->db->escape($this->accountancy_code_sell)."'"; @@ -1893,12 +1907,12 @@ class Societe extends CommonObject $sql .= ', s.webservices_url, s.webservices_key, s.model_pdf, s.last_main_doc'; if (!getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) { $sql .= ', s.accountancy_code_customer_general, s.code_compta'; - $sql .= ', s.code_compta_fournisseur'; + $sql .= ', s.accountancy_code_supplier_general, s.code_compta_fournisseur'; $sql .= ', s.accountancy_code_buy, s.accountancy_code_sell'; $sql .= ', s.vat_reverse_charge as soc_vat_reverse_charge'; } else { $sql .= ', spe.accountancy_code_customer_general, spe.accountancy_code_customer as code_compta'; - $sql .= ', spe.accountancy_code_supplier as code_compta_fournisseur'; + $sql .= ', spe.accountancy_code_supplier_general, spe.accountancy_code_supplier as code_compta_fournisseur'; $sql .= ', spe.accountancy_code_buy, spe.accountancy_code_sell'; $sql .= ', spe.vat_reverse_charge as spe_vat_reverse_charge'; } @@ -2058,6 +2072,7 @@ class Societe extends CommonObject $this->accountancy_code_customer_general = $obj->accountancy_code_customer_general; $this->code_compta_client = $obj->code_compta; + $this->accountancy_code_supplier_general = $obj->accountancy_code_supplier_general; $this->code_compta_fournisseur = $obj->code_compta_fournisseur; $this->barcode = $obj->barcode; diff --git a/htdocs/stripe/lib/stripe.lib.php b/htdocs/stripe/lib/stripe.lib.php index de510a35d56..9f94fadd5eb 100644 --- a/htdocs/stripe/lib/stripe.lib.php +++ b/htdocs/stripe/lib/stripe.lib.php @@ -1,6 +1,7 @@ * 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 @@ -27,7 +28,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; /** * Define head array for tabs of stripe tools setup pages * - * @return Array of head + * @return array Array of tabs to show */ function stripeadmin_prepare_head() { diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index a3d739f5bd0..aa7f2274c78 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -290,7 +290,7 @@ if (empty($reshook)) { $object->cond_reglement_id = GETPOSTINT('cond_reglement_id'); $object->mode_reglement_id = GETPOSTINT('mode_reglement_id'); $object->fk_account = GETPOSTINT('fk_account'); - $object->socid = GETPOST('socid'); + $object->socid = GETPOSTINT('socid'); $object->fk_project = GETPOSTINT('projectid'); $object->model_pdf = GETPOST('model'); $object->author = $user->id; // deprecated diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 6f573d2022b..d400c8e46f1 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -92,15 +92,25 @@ class SupplierProposal extends CommonObject */ protected $table_ref_field = 'ref'; + /** + * @var int + */ public $socid; // Id client /** - * @deprecated + * @deprecated Use $user_author_id * @see $user_author_id + * @var int */ public $author; + /** + * @var string + */ public $ref_fourn; //Reference saisie lors de l'ajout d'une ligne à la demande + /** + * @var string + */ public $ref_supplier; //Reference saisie lors de l'ajout d'une ligne à la demande /** @@ -120,43 +130,60 @@ class SupplierProposal extends CommonObject public $delivery_date; /** - * @deprecated + * @deprecated Use $date_creation * @see $date_creation + * @var int|string */ public $datec; /** - * @deprecated + * @deprecated Use $date_validation * @see $date_validation + * @var int|string */ public $datev; + /** + * @var int + */ public $user_author_id; /** - * @deprecated + * @deprecated Use $price_ht * @see $price_ht + * @var float */ public $price; /** - * @deprecated + * @deprecated Use $total_tva * @see $total_tva + * @var float */ public $tva; /** - * @deprecated + * @deprecated Use $total_ttc * @see $total_ttc + * @var float */ public $total; + /** + * @var string + */ public $cond_reglement_code; + /** + * @var string + */ public $cond_reglement_doc; // label doc + /** + * @var string + */ public $mode_reglement_code; /** - * @deprecated + * @deprecated Use $mode_reglement_code * @var string Mode reglement */ public $mode_reglement; @@ -166,12 +193,21 @@ class SupplierProposal extends CommonObject */ public $extraparams = array(); public $lines = array(); + /** + * @var SupplierProposalLine + */ public $line; public $labelStatus = array(); public $labelStatusShort = array(); + /** + * @var int + */ public $nbtodo; + /** + * @var int + */ public $nbtodolate; // Multicurrency @@ -180,10 +216,25 @@ class SupplierProposal extends CommonObject */ public $fk_multicurrency; + /** + * @var string + */ public $multicurrency_code; + /** + * @var float + */ public $multicurrency_tx; + /** + * @var float + */ public $multicurrency_total_ht; + /** + * @var float + */ public $multicurrency_total_tva; + /** + * @var float + */ public $multicurrency_total_ttc; /** @@ -361,15 +412,15 @@ class SupplierProposal extends CommonObject * et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue) * * @param string $desc Description de la ligne - * @param double $pu_ht Prix unitaire - * @param double $qty Quantite - * @param double $txtva Taux de tva - * @param double $txlocaltax1 Local tax 1 rate - * @param double $txlocaltax2 Local tax 2 rate + * @param float $pu_ht Prix unitaire + * @param float $qty Quantite + * @param float $txtva Taux de tva + * @param float $txlocaltax1 Local tax 1 rate + * @param float $txlocaltax2 Local tax 2 rate * @param int $fk_product Product/Service ID predefined - * @param double $remise_percent Percentage discount of the line + * @param float $remise_percent Percentage discount of the line * @param string $price_base_type HT or TTC - * @param double $pu_ttc Prix unitaire TTC + * @param float $pu_ttc Prix unitaire TTC * @param int $info_bits Bits of type of lines * @param int $type Type of line (product, service) * @param int $rang Position of line @@ -378,12 +429,12 @@ class SupplierProposal extends CommonObject * @param int $fk_fournprice Id supplier price. If 0, we will take best price. If -1 we keep it empty. * @param int $pa_ht Buying price without tax * @param string $label ??? - * @param array $array_options extrafields array + * @param array $array_options extrafields array * @param string $ref_supplier Supplier price reference * @param int $fk_unit Id of the unit to use. * @param string $origin 'order', 'supplier_proposal', ... * @param int $origin_id Id of origin line - * @param double $pu_ht_devise Amount in currency + * @param float $pu_ht_devise Amount in currency * @param int $date_start Date start * @param int $date_end Date end * @return int >0 if OK, <0 if KO @@ -648,12 +699,12 @@ class SupplierProposal extends CommonObject * Update a proposal line * * @param int $rowid Id de la ligne - * @param double $pu Unit price (HT or TTC depending on price_base_type) - * @param double $qty Quantity - * @param double $remise_percent Discount on line - * @param double $txtva VAT rate - * @param double $txlocaltax1 Local tax 1 rate - * @param double $txlocaltax2 Local tax 2 rate + * @param float $pu Unit price (HT or TTC depending on price_base_type) + * @param float $qty Quantity + * @param float $remise_percent Discount on line + * @param float $txtva VAT rate + * @param float $txlocaltax1 Local tax 1 rate + * @param float $txlocaltax2 Local tax 2 rate * @param string $desc Description * @param string $price_base_type HT or TTC * @param int $info_bits Miscellaneous information @@ -664,10 +715,10 @@ class SupplierProposal extends CommonObject * @param int $pa_ht Price (without tax) of product when it was bought * @param string $label ??? * @param int $type 0/1=Product/service - * @param array $array_options extrafields array + * @param array $array_options extrafields array * @param string $ref_supplier Supplier price reference * @param int $fk_unit Id of the unit to use. - * @param double $pu_ht_devise Unit price in currency + * @param float $pu_ht_devise Unit price in currency * @return int 0 if OK, <0 if KO */ public function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $desc = '', $price_base_type = 'HT', $info_bits = 0, $special_code = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $type = 0, $array_options = [], $ref_supplier = '', $fk_unit = 0, $pu_ht_devise = 0) @@ -1145,6 +1196,7 @@ class SupplierProposal extends CommonObject require_once DOL_DOCUMENT_ROOT."/core/modules/supplier_proposal/" . getDolGlobalString('SUPPLIER_PROPOSAL_ADDON').'.php'; $obj = getDolGlobalString('SUPPLIER_PROPOSAL_ADDON'); $modSupplierProposal = new $obj(); + '@phan-var-force ModeleNumRefSupplierProposal $modSupplierProposal'; $this->ref = $modSupplierProposal->getNextValue($objsoc, $this); // Create clone @@ -1541,7 +1593,7 @@ class SupplierProposal extends CommonObject * Set an overall discount on the proposal * * @param User $user Object user that modify - * @param double $remise Amount discount + * @param float $remise Amount discount * @return int Return integer <0 if ko, >0 if ok */ /* @@ -1574,7 +1626,7 @@ class SupplierProposal extends CommonObject * Set an absolute overall discount on the proposal * * @param User $user Object user that modify - * @param double $remise Amount discount + * @param float $remise Amount discount * @return int Return integer <0 if ko, >0 if ok */ /* @@ -1774,7 +1826,7 @@ class SupplierProposal extends CommonObject } $productsupplier->id = $product->fk_product; - $productsupplier->update_buyprice($product->qty, $product->total_ht, $user, 'HT', $this->thirdparty, '', $ref_fourn, $product->tva_tx, 0, 0, 0, $product->info_bits, '', '', array(), '', $product->multicurrency_total_ht, 'HT', $multicurrency_tx, $product->multicurrency_code, '', '', ''); + $productsupplier->update_buyprice($product->qty, $product->total_ht, $user, 'HT', $this->thirdparty, 0, $ref_fourn, $product->tva_tx, 0, 0, 0, $product->info_bits, 0, '', array(), '', $product->multicurrency_total_ht, 'HT', $multicurrency_tx, $product->multicurrency_code, '', '', 0); } return 1; @@ -1930,7 +1982,7 @@ class SupplierProposal extends CommonObject * @param int $offset For pagination * @param string $sortfield Sort criteria * @param string $sortorder Sort order - * @return array|int -1 if KO, array with result if OK + * @return array|array|int<-1,-1> -1 if KO, array with result if OK */ public function liste_array($shortlist = 0, $draft = 0, $notcurrentuser = 0, $socid = 0, $limit = 0, $offset = 0, $sortfield = 'p.datec', $sortorder = 'DESC') { @@ -2237,6 +2289,7 @@ class SupplierProposal extends CommonObject if ($resql) { $label = $labelShort = ''; $status = ''; + $delay_warning = 0; if ($mode == 'opened') { $delay_warning = !empty($conf->supplier_proposal->cloture->warning_delay) ? $conf->supplier_proposal->cloture->warning_delay : 0; $status = self::STATUS_VALIDATED; @@ -2430,6 +2483,7 @@ class SupplierProposal extends CommonObject } $obj = new $classname(); + '@phan-var-force ModeleNumRefSupplierProposal $obj'; $numref = ""; $numref = $obj->getNextValue($soc, $this); @@ -2676,13 +2730,13 @@ class SupplierProposal extends CommonObject /** * Create a document onto disk according to template module. * - * @param string $modele Force model to use ('' to not force) - * @param Translate $outputlangs Object langs to use for output - * @param int $hidedetails Hide details of lines - * @param int $hidedesc Hide description - * @param int $hideref Hide ref - * @param null|array $moreparams Array to provide more information - * @return int 0 if KO, 1 if OK + * @param string $modele Force model to use ('' to not force) + * @param Translate $outputlangs Object langs to use for output + * @param int<0,1> $hidedetails Hide details of lines + * @param int<0,1> $hidedesc Hide description + * @param int<0,1> $hideref Hide ref + * @param ?array $moreparams Array to provide more information + * @return int 0 if KO, 1 if OK */ public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null) { @@ -2821,6 +2875,9 @@ class SupplierProposalLine extends CommonObjectLine */ public $fk_parent_attribute = 'fk_supplier_proposal'; + /** + * @var SupplierProposalLine + */ public $oldline; /** @@ -2838,6 +2895,9 @@ class SupplierProposalLine extends CommonObjectLine */ public $fk_parent_line; + /** + * @var string + */ public $desc; // Description ligne /** @@ -2846,8 +2906,9 @@ class SupplierProposalLine extends CommonObjectLine public $fk_product; // Id produit predefini /** - * @deprecated + * @deprecated Use $product_type * @see $product_type + * @var int */ public $fk_product_type; /** @@ -2861,7 +2922,13 @@ class SupplierProposalLine extends CommonObjectLine * @var float Quantity */ public $qty; + /** + * @var float|string + */ public $tva_tx; + /** + * @var string + */ public $vat_src_code; /** @@ -2869,6 +2936,9 @@ class SupplierProposalLine extends CommonObjectLine * @var float */ public $subprice; + /** + * @var float|string + */ public $remise_percent; /** @@ -2876,6 +2946,9 @@ class SupplierProposalLine extends CommonObjectLine */ public $fk_remise_except; + /** + * @var int + */ public $rang = 0; /** @@ -2883,8 +2956,17 @@ class SupplierProposalLine extends CommonObjectLine */ public $fk_fournprice; + /** + * @var int|float|string + */ public $pa_ht; + /** + * @var int|float + */ public $marge_tx; + /** + * @var int|float + */ public $marque_tx; /** @@ -2895,20 +2977,39 @@ class SupplierProposalLine extends CommonObjectLine // 2: ecotaxe // 3: option line (when qty = 0) + /** + * @var int + */ public $info_bits = 0; // Liste d'options cumulables: // Bit 0: 0 si TVA normal - 1 if TVA NPR // Bit 1: 0 ligne normal - 1 if fixed reduction + /** + * @var float + */ public $total_ht; // Total HT de la ligne toute quantite et incluant la remise ligne + /** + * @var float + */ public $total_tva; // Total TVA de la ligne toute quantite et incluant la remise ligne + /** + * @var float + */ public $total_ttc; // Total TTC de la ligne toute quantite et incluant la remise ligne + /** + * @var int|string + */ public $date_start; + /** + * @var int|string + */ public $date_end; // From llx_product /** - * @deprecated + * @var string + * @deprecated Use $product_ref * @see $product_ref */ public $ref; @@ -2920,7 +3021,8 @@ class SupplierProposalLine extends CommonObjectLine public $product_ref; /** - * @deprecated + * @var string + * @deprecated Use $product_label * @see $product_label */ public $libelle; @@ -2943,16 +3045,43 @@ class SupplierProposalLine extends CommonObjectLine */ public $product_desc; + /** + * @var int|string + */ public $localtax1_tx; // Local tax 1 + /** + * @var int|string + */ public $localtax2_tx; // Local tax 2 + /** + * @var string + */ public $localtax1_type; // Local tax 1 type + /** + * @var string + */ public $localtax2_type; // Local tax 2 type + /** + * @var float + */ public $total_localtax1; // Line total local tax 1 + /** + * @var float + */ public $total_localtax2; // Line total local tax 2 + /** + * @var int<0,1> + */ public $skip_update_total; // Skip update price total for special lines + /** + * @var string + */ public $ref_fourn; + /** + * @var string + */ public $ref_supplier; // Multicurrency @@ -2961,10 +3090,25 @@ class SupplierProposalLine extends CommonObjectLine */ public $fk_multicurrency; + /** + * @var string + */ public $multicurrency_code; + /** + * @var float + */ public $multicurrency_subprice; + /** + * @var float + */ public $multicurrency_total_ht; + /** + * @var float + */ public $multicurrency_total_tva; + /** + * @var float + */ public $multicurrency_total_ttc; /** @@ -3085,10 +3229,10 @@ class SupplierProposalLine extends CommonObjectLine $this->localtax2_tx = 0; } if (empty($this->localtax1_type)) { - $this->localtax1_type = 0; + $this->localtax1_type = ''; } if (empty($this->localtax2_type)) { - $this->localtax2_type = 0; + $this->localtax2_type = ''; } if (empty($this->total_localtax1)) { $this->total_localtax1 = 0; @@ -3293,10 +3437,10 @@ class SupplierProposalLine extends CommonObjectLine $this->total_localtax2 = 0; } if (empty($this->localtax1_type)) { - $this->localtax1_type = 0; + $this->localtax1_type = ''; } if (empty($this->localtax2_type)) { - $this->localtax2_type = 0; + $this->localtax2_type = ''; } if (empty($this->marque_tx)) { $this->marque_tx = 0; diff --git a/htdocs/takepos/admin/terminal.php b/htdocs/takepos/admin/terminal.php index 038b9cfbcba..c2226fe798e 100644 --- a/htdocs/takepos/admin/terminal.php +++ b/htdocs/takepos/admin/terminal.php @@ -4,6 +4,7 @@ * Copyright (C) 2021 Thibault FOUCART * Copyright (C) 2022 Alexandre Spangaro * 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 @@ -452,6 +453,7 @@ if (getDolGlobalString('TAKEPOS_ADDON') == "terminal") { require_once $dir.$filebis; $module = new $classname($db); + '@phan-var-force ModeleNumRefFactures $module'; // Show modules according to features level if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index bdd2ca68c0d..15ba7e9dc08 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -764,6 +764,7 @@ if ($action == 'create' || $action == 'presend') { accessforbidden('', 0, 1); } + $formconfirm = ''; // Confirmation close if ($action == 'close') { @@ -788,27 +789,39 @@ if ($action == 'create' || $action == 'presend') { ), ); - print $form->formconfirm($url_page_current."?track_id=".$object->track_id, $langs->trans("CloseATicket"), $langs->trans("ConfirmCloseAticket"), "confirm_close", $formquestion, '', 1); + $formconfirm = $form->formconfirm($url_page_current."?track_id=".$object->track_id, $langs->trans("CloseATicket"), $langs->trans("ConfirmCloseAticket"), "confirm_close", $formquestion, '', 1); } // Confirmation abandon if ($action == 'abandon') { - print $form->formconfirm($url_page_current."?track_id=".$object->track_id, $langs->trans("AbandonTicket"), $langs->trans("ConfirmAbandonTicket"), "confirm_abandon", '', '', 1); + $formconfirm = $form->formconfirm($url_page_current."?track_id=".$object->track_id, $langs->trans("AbandonTicket"), $langs->trans("ConfirmAbandonTicket"), "confirm_abandon", '', '', 1); } // Confirmation delete if ($action == 'delete') { - print $form->formconfirm($url_page_current."?track_id=".$object->track_id, $langs->trans("Delete"), $langs->trans("ConfirmDeleteTicket"), "confirm_delete_ticket", '', '', 1); + $formconfirm = $form->formconfirm($url_page_current."?track_id=".$object->track_id, $langs->trans("Delete"), $langs->trans("ConfirmDeleteTicket"), "confirm_delete_ticket", '', '', 1); } // Confirm reopen if ($action == 'reopen') { - print $form->formconfirm($url_page_current.'?track_id='.$object->track_id, $langs->trans('ReOpen'), $langs->trans('ConfirmReOpenTicket'), 'confirm_reopen', '', '', 1); + $formconfirm = $form->formconfirm($url_page_current.'?track_id='.$object->track_id, $langs->trans('ReOpen'), $langs->trans('ConfirmReOpenTicket'), 'confirm_reopen', '', '', 1); } // Confirmation status change if ($action == 'set_status') { $new_status = GETPOST('new_status'); //var_dump($url_page_current . "?track_id=" . $object->track_id); - print $form->formconfirm($url_page_current."?track_id=".$object->track_id."&new_status=".GETPOST('new_status'), $langs->trans("TicketChangeStatus"), $langs->trans("TicketConfirmChangeStatus", $langs->transnoentities($object->labelStatusShort[$new_status])), "confirm_set_status", '', '', 1); + $formconfirm = $form->formconfirm($url_page_current."?track_id=".$object->track_id."&new_status=".GETPOST('new_status'), $langs->trans("TicketChangeStatus"), $langs->trans("TicketConfirmChangeStatus", $langs->transnoentities($object->labelStatusShort[$new_status])), "confirm_set_status", '', '', 1); } + // Call Hook formConfirm + $parameters = array('formConfirm' => $formconfirm); + $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if (empty($reshook)) { + $formconfirm .= $hookmanager->resPrint; + } elseif ($reshook > 0) { + $formconfirm = $hookmanager->resPrint; + } + + // Print form confirm + print $formconfirm; + // project info if ($projectid > 0) { $projectstat = new Project($db); diff --git a/htdocs/ticket/class/ticketstats.class.php b/htdocs/ticket/class/ticketstats.class.php index ae052f6243c..a491775376e 100644 --- a/htdocs/ticket/class/ticketstats.class.php +++ b/htdocs/ticket/class/ticketstats.class.php @@ -1,5 +1,6 @@ + * 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 @@ -46,7 +47,7 @@ class TicketStats extends Stats * * @param DoliDB $db Database handler * @param int $socid Id third party - * @param mixed $userid Id user for filter or array of user ids + * @param int|int[] $userid Id user for filter or array of user ids * @return void */ public function __construct($db, $socid = 0, $userid = 0) @@ -76,7 +77,7 @@ class TicketStats extends Stats /** * Renvoie le nombre de tickets par annee * - * @return array Array of values + * @return array Array of values */ public function getNbByYear() { @@ -93,7 +94,7 @@ class TicketStats extends Stats * * @param int $year Year to scan * @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month - * @return array Array of values + * @return array,array{0:int<1,12>,1:int}> Array with number by month */ public function getNbByMonth($year, $format = 0) { @@ -110,11 +111,11 @@ class TicketStats extends Stats } /** - * Return th eamount of tickets for a month and a given year + * Return the number of tickets for a month and a given year * * @param int $year Year to scan * @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month - * @return array Array of values + * @return array,array{0:int<1,12>,1:int|float}> Array of values */ public function getAmountByMonth($year, $format = 0) { @@ -134,7 +135,7 @@ class TicketStats extends Stats * Return average amount * * @param int $year Year to scan - * @return array Array of values + * @return array,array{0:int<1,12>,1:int|float}> Array of values */ public function getAverageByMonth($year) { @@ -151,7 +152,7 @@ class TicketStats extends Stats /** * Return nb, total and average * - * @return array Array of values + * @return array Array of values */ public function getAllByYear() { diff --git a/htdocs/ticket/stats/index.php b/htdocs/ticket/stats/index.php index 721f4f30b12..99798ff54be 100644 --- a/htdocs/ticket/stats/index.php +++ b/htdocs/ticket/stats/index.php @@ -1,5 +1,6 @@ + * 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 @@ -210,7 +211,7 @@ print ''; $oldyear = 0; foreach ($data as $val) { $year = $val['year']; - while (!empty($year) && $oldyear > $year + 1) { // If we have empty year + while (!empty($year) && $oldyear > (int) $year + 1) { // If we have empty year $oldyear--; print ''; diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index 0f318cf1ca1..ce544627181 100644 --- a/htdocs/user/perms.php +++ b/htdocs/user/perms.php @@ -708,7 +708,7 @@ if ($result) { print ' '.img_warning($langs->trans("AllowAnyPrivileges")); } } - // Special cas for reading bank account when you have permission to manage Chart of account + // Special case for reading bank account when you have permission to manage Chart of account if ($obj->module == 'banque' && $obj->perms == 'lire') { if (isModEnabled("accounting") && $object->hasRight('accounting', 'chartofaccount')) { print ' '.img_warning($langs->trans("WarningReadBankAlsoAllowedIfUserHasPermission")); diff --git a/htdocs/variants/admin/admin.php b/htdocs/variants/admin/admin.php index 8c48c87bd7d..e730042d5f9 100644 --- a/htdocs/variants/admin/admin.php +++ b/htdocs/variants/admin/admin.php @@ -19,6 +19,7 @@ // Load Dolibarr environment require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/variants/lib/variants.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; $langs->loadLangs(array("admin", "products")); @@ -66,6 +67,10 @@ llxHeader('', $title); $linkback = ''.$langs->trans("BackToModuleList").''; print load_fiche_titre($title, $linkback, 'title_setup'); +$head = adminProductAttributePrepareHead(); + +print dol_get_fiche_head($head, 'admin', $title, -1, 'product'); + print '
'; print ''; print ''; diff --git a/htdocs/variants/admin/product_attribute_extrafields.php b/htdocs/variants/admin/product_attribute_extrafields.php new file mode 100644 index 00000000000..b3ab3724edc --- /dev/null +++ b/htdocs/variants/admin/product_attribute_extrafields.php @@ -0,0 +1,103 @@ + + * Copyright (C) 2024 Frédéric France + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/variants/admin/product_attribute_value_extrafields.php + * \ingroup variants + * \brief Page to setup extra fields of product_attribute_value + */ + +// Load Dolibarr environment +require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/variants/lib/variants.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; + + +if (!$user->admin) { + accessforbidden(); +} + +// Load translation files required by the page +$langs->loadLangs(array('admin', 'other', 'product')); + + +$extrafields = new ExtraFields($db); +$form = new Form($db); + +// List of supported format +$tmptype2label = ExtraFields::$type2label; +$type2label = array(''); +foreach ($tmptype2label as $key => $val) { + $type2label[$key] = $langs->transnoentitiesnoconv($val); +} + +$action = GETPOST('action', 'aZ09'); +$attrname = GETPOST('attrname', 'alpha'); +$elementtype = 'product_attribute'; //Must be the $table_element of the class that manage extrafield + +if (!$user->admin) { + accessforbidden(); +} + + +/* + * Actions + */ + +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; + + + +/* + * View + */ + +$title = $langs->trans("ProductAttributeExtrafieldsSetup"); +llxHeader('', $title); + +$linkback = ''.$langs->trans("BackToModuleList").''; +print load_fiche_titre($title, $linkback, 'title_setup'); + +$head = adminProductAttributePrepareHead(); + +print dol_get_fiche_head($head, 'product_attribute', $title, -1, 'product'); + +require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; + +print dol_get_fiche_end(); + + +// Creation of an optional field +if ($action == 'create') { + print '
'; + print load_fiche_titre($langs->trans('NewAttribute')); + + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; +} + +// Edition of an optional field +if ($action == 'edit' && !empty($attrname)) { + print "
"; + print load_fiche_titre($langs->trans("FieldEdition", $attrname)); + + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; +} + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/variants/admin/product_attribute_value_extrafields.php b/htdocs/variants/admin/product_attribute_value_extrafields.php new file mode 100644 index 00000000000..ef7cebff9d4 --- /dev/null +++ b/htdocs/variants/admin/product_attribute_value_extrafields.php @@ -0,0 +1,102 @@ + + * Copyright (C) 2024 Frédéric France + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/variants/admin/product_attribute_extrafields.php + * \ingroup variants + * \brief Page to setup extra fields of product_attribute_value + */ + +// Load Dolibarr environment +require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/variants/lib/variants.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; + + +if (!$user->admin) { + accessforbidden(); +} + +// Load translation files required by the page +$langs->loadLangs(array('admin', 'other', 'sendings')); + +$extrafields = new ExtraFields($db); +$form = new Form($db); + +// List of supported format +$tmptype2label = ExtraFields::$type2label; +$type2label = array(''); +foreach ($tmptype2label as $key => $val) { + $type2label[$key] = $langs->transnoentitiesnoconv($val); +} + +$action = GETPOST('action', 'aZ09'); +$attrname = GETPOST('attrname', 'alpha'); +$elementtype = 'product_attribute_value'; //Must be the $table_element of the class that manage extrafield + +if (!$user->admin) { + accessforbidden(); +} + + +/* + * Actions + */ + +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; + + + +/* + * View + */ + +$title = $langs->trans("ProductAttributeValueExtrafieldsSetup"); +llxHeader('', $title); + +$linkback = ''.$langs->trans("BackToModuleList").''; +print load_fiche_titre($title, $linkback, 'title_setup'); + +$head = adminProductAttributePrepareHead(); + +print dol_get_fiche_head($head, 'product_attribute_value', $title, -1, 'product'); + +require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; + +print dol_get_fiche_end(); + + +// Creation of an optional field +if ($action == 'create') { + print '
'; + print load_fiche_titre($langs->trans('NewAttribute')); + + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; +} + +// Edition of an optional field +if ($action == 'edit' && !empty($attrname)) { + print "
"; + print load_fiche_titre($langs->trans("FieldEdition", $attrname)); + + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; +} + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/variants/card.php b/htdocs/variants/card.php index 5cf4220d79a..8ccf07de1c9 100644 --- a/htdocs/variants/card.php +++ b/htdocs/variants/card.php @@ -1,7 +1,7 @@ - * Copyright (C) 2018 Frédéric France - * Copyright (C) 2022 Open-Dsi +/* Copyright (C) 2016 Marcos García + * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2022 Open-Dsi * * 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 @@ -56,6 +56,10 @@ $hookmanager->initHooks(array('productattributecard', 'globalcard')); $result = restrictedArea($user, 'variants'); $object = new ProductAttribute($db); +$extrafields = new ExtraFields($db); + +// Fetch optionals attributes and labels +$extrafields->fetch_name_optionals_label($object->table_element); // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be 'include', not 'include_once' @@ -180,6 +184,9 @@ if ($action == 'create') { // Common attributes include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_add.tpl.php'; + // Other attributes + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; + print '' . "\n"; print dol_get_fiche_end(); @@ -215,6 +222,9 @@ if ($action == 'create') { // Common attributes include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php'; + // Other attributes + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php'; + $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; @@ -274,6 +284,9 @@ if ($action == 'create') { // Common attributes include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php'; + // Other attributes + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; + print ''; print ''; print ''; @@ -310,7 +323,7 @@ if ($action == 'create') { print load_fiche_titre($langs->trans("PossibleValues") . (!empty($object->lines) ? '(' . count($object->lines) . ')' : '')); - print ' + print ' diff --git a/htdocs/variants/class/ProductAttribute.class.php b/htdocs/variants/class/ProductAttribute.class.php index 48e28511c37..9f12cab929f 100644 --- a/htdocs/variants/class/ProductAttribute.class.php +++ b/htdocs/variants/class/ProductAttribute.class.php @@ -2,7 +2,7 @@ /* Copyright (C) 2016 Marcos García * Copyright (C) 2022 Open-Dsi * Copyright (C) 2023-2024 Frédéric France - * Copyright (C) 2024 MDW + * 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 @@ -167,7 +167,7 @@ class ProductAttribute extends CommonObject $this->db = $db; $this->ismultientitymanaged = 1; - $this->isextrafieldmanaged = 0; + $this->isextrafieldmanaged = 1; $this->entity = $conf->entity; if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid'])) { @@ -255,6 +255,10 @@ class ProductAttribute extends CommonObject if (!$error) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element); + $result = $this->insertExtraFields(); + if ($result < 0) { + $error++; + } } if (!$error && !$notrigger) { @@ -322,6 +326,7 @@ class ProductAttribute extends CommonObject $this->label = $obj->label; $this->rang = $obj->position; // deprecated $this->position = $obj->position; + $this->fetch_optionals(); } $this->db->free($resql); @@ -418,7 +423,12 @@ class ProductAttribute extends CommonObject $this->errors[] = "Error " . $this->db->lasterror(); $error++; } - + if (!$error) { + $result = $this->insertExtraFields(); + if ($result < 0) { + $error++; + } + } if (!$error && !$notrigger) { // Call trigger $result = $this->call_trigger('PRODUCT_ATTRIBUTE_MODIFY', $user); @@ -575,6 +585,7 @@ class ProductAttribute extends CommonObject $line->ref = $obj->ref; $line->value = $obj->value; $line->position = $obj->position; + $line->fetch_optionals(); $this->lines[$i] = $line; $i++; diff --git a/htdocs/variants/class/ProductAttributeValue.class.php b/htdocs/variants/class/ProductAttributeValue.class.php index 1b2ff094e04..1f8aa46971b 100644 --- a/htdocs/variants/class/ProductAttributeValue.class.php +++ b/htdocs/variants/class/ProductAttributeValue.class.php @@ -1,8 +1,8 @@ - * Copyright (C) 2022 Open-Dsi - * Copyright (C) 2024 MDW - * Copyright (C) 2024 Frédéric France +/* Copyright (C) 2016 Marcos García + * Copyright (C) 2022 Open-Dsi + * Copyright (C) 2024 MDW + * Copyright (C) 2024 Frédéric France * * 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,7 +118,7 @@ class ProductAttributeValue extends CommonObjectLine $this->db = $db; $this->ismultientitymanaged = 1; - $this->isextrafieldmanaged = 0; + $this->isextrafieldmanaged = 1; $this->entity = $conf->entity; if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid'])) { @@ -177,6 +177,11 @@ class ProductAttributeValue extends CommonObjectLine $this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Value")); $error++; } + // Position to use + if (empty($this->position)) { + $positionmax = $this->getMaxAttributesValuesPosition($this->fk_product_attribute); + $this->position = $positionmax + 1; + } if ($error) { dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); return -1; @@ -204,6 +209,10 @@ class ProductAttributeValue extends CommonObjectLine if (!$error) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element); + $result = $this->insertExtraFields(); + if ($result < 0) { + $error++; + } } if (!$error && !$notrigger) { @@ -269,6 +278,7 @@ class ProductAttributeValue extends CommonObjectLine $this->fk_product_attribute = $obj->fk_product_attribute; $this->ref = $obj->ref; $this->value = $obj->value; + $this->fetch_optionals(); } $this->db->free($resql); @@ -454,7 +464,12 @@ class ProductAttributeValue extends CommonObjectLine $error++; } } - + if (!$error) { + $result = $this->insertExtraFields(); + if ($result < 0) { + $error++; + } + } if (!$error) { $this->db->commit(); return 1; @@ -464,6 +479,27 @@ class ProductAttributeValue extends CommonObjectLine } } + /** + * Get max value used for position of attributes + * @param int $fk_product_attribute Id of attribute + * + * @return int Max value of position in table of attributes + */ + public function getMaxAttributesValuesPosition($fk_product_attribute) + { + // Search the last position of attributes + $sql = "SELECT max(position) FROM " . MAIN_DB_PREFIX . $this->table_element; + $sql .= " WHERE entity IN (" . getEntity('product') . ")"; + $sql .= ' AND fk_product_attribute='.(int) $fk_product_attribute; + dol_syslog(__METHOD__, LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) { + $row = $this->db->fetch_row($resql); + return $row[0]; + } + return 0; + } + /** * Test if used by a product * diff --git a/htdocs/variants/lib/variants.lib.php b/htdocs/variants/lib/variants.lib.php index 4cba6c7f93d..0f173333c9e 100644 --- a/htdocs/variants/lib/variants.lib.php +++ b/htdocs/variants/lib/variants.lib.php @@ -53,3 +53,42 @@ function productAttributePrepareHead($object) return $head; } + +/** + * Prepare array with list of tabs + * + * @return array Array of tabs to show + */ +function adminProductAttributePrepareHead() +{ + global $langs, $conf; + $langs->load("products"); + + $h = 0; + $head = array(); + + $head[$h][0] = DOL_URL_ROOT.'/variants/admin/admin.php'; + $head[$h][1] = $langs->trans("ProductAttribute"); + $head[$h][2] = 'admin'; + $h++; + + $head[$h][0] = DOL_URL_ROOT.'/variants/admin/product_attribute_extrafields.php'; + $head[$h][1] = $langs->trans("ProductAttributeExtrafields"); + $head[$h][2] = 'product_attribute'; + $h++; + + $head[$h][0] = DOL_URL_ROOT.'/variants/admin/product_attribute_value_extrafields.php'; + $head[$h][1] = $langs->trans("ProductAttributeValueExtrafields"); + $head[$h][2] = 'product_attribute_value'; + $h++; + + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab + // $this->tabs = array('entity:-tabname); to remove a tab + complete_head_from_modules($conf, $langs, null, $head, $h, 'admin_product_attribute'); + + complete_head_from_modules($conf, $langs, null, $head, $h, 'admin_product_attribute', 'remove'); + + return $head; +} diff --git a/htdocs/variants/list.php b/htdocs/variants/list.php index 4a8feb6cb52..482272fba78 100644 --- a/htdocs/variants/list.php +++ b/htdocs/variants/list.php @@ -61,14 +61,14 @@ $pagenext = $page + 1; // Initialize a technical objects $object = new ProductAttribute($db); -//$extrafields = new ExtraFields($db); +$extrafields = new ExtraFields($db); $diroutputmassaction = $conf->variants->dir_output.'/temp/massgeneration/'.$user->id; $hookmanager->initHooks(array('productattributelist')); // Note that conf->hooks_modules contains array // Fetch optionals attributes and labels -//$extrafields->fetch_name_optionals_label($object->table_element); +$extrafields->fetch_name_optionals_label($object->table_element); -//$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); +$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); // Default sort order (if not yet defined by previous GETPOST) if (!$sortfield) { @@ -138,7 +138,7 @@ $arrayfields['nb_products'] = array( 'help' => '' ); // Extra fields -//include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); @@ -243,11 +243,11 @@ $morecss = array(); $sql = "SELECT COUNT(DISTINCT pav.rowid) AS nb_of_values, COUNT(DISTINCT pac2v.fk_prod_combination) AS nb_products, "; $sql .= $object->getFieldList("t"); // Add fields from extrafields -//if (!empty($extrafields->attributes[$object->table_element]['label'])) { -// foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { -// $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key." as options_".$key.", " : ""); -// } -//} +if (!empty($extrafields->attributes[$object->table_element]['label'])) { + foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { + $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : ""); + } +} // Add fields from hooks $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook @@ -257,9 +257,9 @@ $sql = preg_replace('/,\s*$/', '', $sql); $sqlfields = $sql; // $sql fields to remove for count total $sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t"; -//if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { -// $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)"; -//} +if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)"; +} $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_attribute_combination2val AS pac2v ON pac2v.fk_prod_attr = t.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_attribute_value AS pav ON pav.fk_product_attribute = t.rowid"; // Add table from hooks @@ -305,7 +305,7 @@ if ($search_all) { } //$sql.= dolSqlDateFilter("t.field", $search_xxxday, $search_xxxmonth, $search_xxxyear); // Add where from extra fields -//include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; // Add where from hooks $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook @@ -317,11 +317,11 @@ foreach ($object->fields as $key => $val) { $sql .= "t.".$db->sanitize($key).", "; } // Add fields from extrafields -//if (!empty($extrafields->attributes[$object->table_element]['label'])) { -// foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { -// $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : ''); -// } -//} +if (!empty($extrafields->attributes[$object->table_element]['label'])) { + foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { + $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : ''); + } +} // Add where from hooks $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object, $action); // Note that $action and $object may have been modified by hook @@ -624,7 +624,7 @@ foreach ($object->fields as $key => $val) { } $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label if (!empty($arrayfields['t.'.$key]['checked'])) { - print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''), 0, (empty($val['helplist']) ? '' : $val['helplist']))."\n"; + print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, '', $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''), 0, (empty($val['helplist']) ? '' : $val['helplist']))."\n"; $totalarray['nbfield']++; } } @@ -683,6 +683,7 @@ while ($i < $imaxinloop) { // Store properties in $object $object->setVarsFromFetchObj($obj); + $object->fetch_optionals(); if ($mode == 'kanban') { if ($i == 0) { @@ -857,7 +858,7 @@ print ''."\n"; print ''."\n"; -$forcereloadpage = !getDolGlobalString('MAIN_FORCE_RELOAD_PAGE') ? 0 : 1; +$forcereloadpage = getDolGlobalString('MAIN_FORCE_RELOAD_PAGE') ? 1 : 0; $tagidfortablednd = (empty($tagidfortablednd) ? 'tableattributes' : $tagidfortablednd); ?>