Merge branch 'develop' into extrafields_object_filter

This commit is contained in:
Frédéric FRANCE 2024-12-19 20:36:32 +01:00 committed by GitHub
commit 786a6571f4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
260 changed files with 3322 additions and 2866 deletions

View file

@ -0,0 +1,3 @@
# Add this tag for any changes for more than 1 line
"Pending analysis of PR (maintenance team)":
min: 1

21
.github/workflows/pr-18-autolabel.yaml vendored Normal file
View file

@ -0,0 +1,21 @@
name: "Set label for v18"
on:
pull_request:
types: [opened, synchronize, reopened]
branches:
- "18.0"
push:
branches:
- "18.0"
jobs:
changed-lines-count-labeler:
runs-on: ubuntu-latest
name: An action for automatically labelling pull requests based on the changed lines count
steps:
- name: Set a label
uses: vkirilichev/changed-lines-count-labeler@v0.2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
configuration-path: .github/changed-lines-count-labeler.yml
continue-on-error: true

View file

@ -1,3 +1,4 @@
name: Set reviewer for v18
on:
pull_request:
types: [opened, synchronize, reopened]
@ -7,15 +8,13 @@ on:
branches:
- "18.0"
permissions: write-all
jobs:
run:
pr18:
runs-on: ubuntu-latest
env:
# GH_TOKEN: ${{ secrets.GH_TOKEN }}
GH_TOKEN: ${{ github.token }}
#env:
# GH_TOKEN: ${{ github.token }}
# GH_TOKENS: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout repository
@ -26,20 +25,31 @@ jobs:
sudo apt update
sudo apt install gh -y
#- name: Authenticate GitHub CLI
# run: |
# echo "GH_TOKEN=$GH_TOKEN"
# gh auth login --with-token <<< "$GH_TOKEN"
- name: Assign reviewer
env:
#REVIEWER: "eldy,lvessiller-opendsi,rycks" # Remplacez par le nom d'utilisateur GitHub du reviewer
REVIEWER: "rycks" # Remplacez par le nom d'utilisateur GitHub du reviewer
run: |
# shellcheck disable=2086
echo "GH_TOKEN=$GH_TOKEN"
echo "Run action by ${{ github.actor }}"
# shellcheck disable=2086
echo "github.token=${{ github.token }}"
# shellcheck disable=2086
echo "secrets.GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}"
# shellcheck disable=2086
echo "GITHUB_EVENT_PATH=$GITHUB_EVENT_PATH"
# shellcheck disable=2086
echo Get the pr_number
# shellcheck disable=2086
pr_number=$(jq --raw-output .number < $GITHUB_EVENT_PATH)
# shellcheck disable=2086
echo "pr_number=$pr_number"
# shellcheck disable=2086
echo Authenticate login gh
# shellcheck disable=2086
gh auth login --with-token <<< "${{ secrets.GITHUB_TOKEN }}"
# shellcheck disable=2086
gh auth setup-git
# shellcheck disable=2086
gh pr edit $pr_number --add-reviewer "$REVIEWER"
continue-on-error: true

View file

@ -1,3 +1,4 @@
name: Test github actions
on:
workflow_dispatch:
pull_request:
@ -5,7 +6,13 @@ on:
branches:
- "18.0"
permissions: write-all
env:
ENVGHT: ${{ secrets.GITHUB_TOKEN }}
ENVGHU: ${{ github.token }}
VARAAA: ${{ vars.AAA }}
SECBBB: ${{ secrets.BBB }}
VARREPORGCCC: ${{ vars.CCC }}
ENVFIX: "abc"
jobs:
testjob:
@ -13,7 +20,19 @@ jobs:
steps:
- name: Log
run: |
echo "Run action by ${{ github.actor }}"
echo "github.token=${{ github.token }}"
echo "secrets.GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}"
echo "GITHUB_EVENT_PATH=$GITHUB_EVENT_PATH"
echo "repo-token: ${{secrets.GITHUB_TOKEN}}"
echo "variable org: ${{vars.AAA}}"
echo "env prg: ${{env.AAA}}"
echo "env prg: ${{env.VARAAA}}"
echo "secret org: ${{secrets.BBB}}"
echo "variable repository of orga: ${{vars.CCC}}"
echo "ENVGHT: ${{env.ENVGHT}}"
echo "ENVGHU: ${{env.ENVGHU}}"
echo "VARAAA: ${{vars.AAA}}"
echo "ENVAAA: ${{env.VARAAA}}"
echo "VARREPORGCCC: ${{env.VARREPORGCCC}}"
echo "ENVFIX: ${{env.ENVFIX}}"

3
.gitignore vendored
View file

@ -90,3 +90,6 @@ phpstan_custom.neon
/.php-cs-fixer.cache
/.php_cs.cache
/.cache
# ignore .htaccess files
.htaccess

View file

@ -18,7 +18,7 @@ repos:
# git commit -a -m "My message" --no-verify
# (Recommendation: run git commit -a .. once, then with `--no-verify`)
- id: no-commit-to-branch
args: [--branch, develop, --pattern, \d+.0]
args: [--branch, develop, --pattern, \d+.0$]
# This checks that xml files are correct
- id: check-xml
exclude: |

View file

@ -27,6 +27,7 @@ if (!defined("NOHTTPSREDIRECT")) {
}
// Defined some constants and load Dolibarr env to reduce PHPStan bootstrap that fails to load a lot of things.
$dolibarr_main_document_root = __DIR__ . '/../../htdocs';
define('DOL_DOCUMENT_ROOT', __DIR__ . '/../../htdocs');
define('DOL_DATA_ROOT', __DIR__ . '/../../documents');
define('DOL_URL_ROOT', '/');
@ -42,6 +43,7 @@ define('MAIN_DB_PREFIX', 'llx_');
* @var User $user
*/
global $conf, $db, $hookmanager, $langs, $mysoc, $user;
global $conf, $db, $hookmanager, $langs, $mysoc, $user;
global $dolibarr_main_document_root;
// include_once DOL_DOCUMENT_ROOT . '/../../htdocs/main.inc.php';

File diff suppressed because it is too large Load diff

View file

@ -883,7 +883,7 @@ $html .= '<h2><span class="fas fa-code pictofixedwidth"></span>'.$title_security
$html .= '<div class="boxallwidth">'."\n";
$html .= '<div class="div-table-responsive">'."\n";
$html .= '<table class="list_technical_debt centpercent">'."\n";
$html .= '<tr class="trgroup"><td>Commit ID</td><td>Date</td><td style="white-space: nowrap">Reported on<br>Yogosha</td><td style="white-space: nowrap">Reported on<br>GIT</td><td style="white-space: nowrap">Reported on<br>CVE</td><td>Title</td><td>Branch of fix</td></tr>'."\n";
$html .= '<tr class="trgroup"><td>Commit ID</td><td>Date</td><td style="white-space: nowrap">Reported on<br>Yogosha</td><td style="white-space: nowrap">Reported on<br>GIT</td><td style="white-space: nowrap"><a href="https://www.cve.org/CVERecord/SearchResults?query=dolibarr">Reported on<br>CVE</a></td><td>Title</td><td>Branch of fix</td></tr>'."\n";
foreach ($arrayofalerts as $key => $alert) {
$cve = '';
$yogosha = empty($alert['issueidyogosha']) ? '' : $alert['issueidyogosha'];

View file

@ -10,43 +10,43 @@
return [
// # Issue statistics:
// PhanUndeclaredProperty : 560+ occurrences
// PhanPossiblyUndeclaredGlobalVariable : 350+ occurrences
// PhanUndeclaredGlobalVariable : 300+ occurrences
// PhanPossiblyUndeclaredGlobalVariable : 320+ occurrences
// PhanUndeclaredGlobalVariable : 290+ occurrences
// PhanTypeMismatchArgumentProbablyReal : 230+ occurrences
// PhanPluginUnknownArrayMethodReturnType : 180+ occurrences
// PhanTypeMismatchProperty : 140+ occurrences
// PhanTypeMismatchProperty : 130+ occurrences
// PhanPluginUnknownArrayMethodParamType : 120+ occurrences
// PhanPluginUnknownPropertyType : 120+ occurrences
// PhanPossiblyUndeclaredVariable : 80+ occurrences
// PhanPluginUndeclaredVariableIsset : 60+ occurrences
// PhanPluginUnknownPropertyType : 110+ occurrences
// PhanPossiblyUndeclaredVariable : 65+ occurrences
// PhanRedefineFunction : 45+ occurrences
// PhanTypeExpectedObjectPropAccess : 45+ occurrences
// PhanTypeMismatchArgumentNullableInternal : 40+ occurrences
// PhanPluginSuspiciousParamOrder : 35+ occurrences
// PhanTypeInvalidDimOffset : 30+ occurrences
// PhanTypeMismatchDimFetch : 30+ occurrences
// PhanPluginEmptyStatementIf : 15+ occurrences
// PhanUndeclaredConstant : 15+ occurrences
// PhanPluginUnknownObjectMethodCall : 10+ occurrences
// PhanTypeComparisonFromArray : 10+ occurrences
// PhanTypeMismatchDimFetchNullable : 10+ occurrences
// PhanUndeclaredMethod : 10+ occurrences
// PhanEmptyForeach : 8 occurrences
// PhanTypeArraySuspiciousNull : 8 occurrences
// PhanPluginBothLiteralsBinaryOp : 7 occurrences
// PhanPluginDuplicateExpressionBinaryOp : 7 occurrences
// PhanPluginSuspiciousParamPosition : 7 occurrences
// PhanTypeArraySuspiciousNull : 6 occurrences
// PhanParamTooMany : 5 occurrences
// PhanPossiblyNullTypeMismatchProperty : 5 occurrences
// PhanParamTooMany : 4 occurrences
// PhanPluginDuplicateArrayKey : 4 occurrences
// PhanEmptyFQSENInClasslike : 3 occurrences
// PhanInvalidFQSENInClasslike : 3 occurrences
// PhanTypeMismatchReturn : 3 occurrences
// PhanTypeExpectedObjectPropAccessButGotNull : 2 occurrences
// PhanTypeMismatchDimAssignment : 2 occurrences
// PhanTypeSuspiciousStringExpression : 2 occurrences
// PhanUndeclaredTypeParameter : 2 occurrences
// PhanAccessMethodProtected : 1 occurrence
// PhanPluginUnknownArrayPropertyType : 1 occurrence
// PhanTypeConversionFromArray : 1 occurrence
// PhanTypeMismatchArgumentInternalProbablyReal : 1 occurrence
// Currently, file_suppressions and directory_suppressions are the only supported suppressions
'file_suppressions' => [
@ -60,7 +60,7 @@ return [
'htdocs/api/class/api_login.class.php' => ['PhanPluginUnknownArrayMethodReturnType'],
'htdocs/api/class/api_setup.class.php' => ['PhanPluginUnknownArrayMethodReturnType'],
'htdocs/api/class/api_status.class.php' => ['PhanPluginUnknownArrayMethodReturnType'],
'htdocs/asset/class/asset.class.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanTypeInvalidDimOffset'],
'htdocs/asset/class/asset.class.php' => ['PhanTypeInvalidDimOffset'],
'htdocs/asset/class/assetdepreciationoptions.class.php' => ['PhanTypeInvalidDimOffset'],
'htdocs/asset/class/assetmodel.class.php' => ['PhanUndeclaredProperty'],
'htdocs/asset/tpl/accountancy_codes_edit.tpl.php' => ['PhanTypeMismatchArgumentProbablyReal'],
@ -106,7 +106,6 @@ return [
'htdocs/compta/bank/various_payment/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/compta/bank/various_payment/document.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/compta/bank/various_payment/info.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/compta/bank/various_payment/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchProperty'],
'htdocs/compta/cashcontrol/cashcontrol_card.php' => ['PhanPluginDuplicateExpressionBinaryOp'],
'htdocs/compta/cashcontrol/cashcontrol_list.php' => ['PhanTypeMismatchProperty'],
'htdocs/compta/clients.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'],
@ -134,13 +133,12 @@ return [
'htdocs/core/actions_addupdatedelete.inc.php' => ['PhanTypeMismatchDimFetch', 'PhanUndeclaredProperty'],
'htdocs/core/actions_massactions.inc.php' => ['PhanUndeclaredProperty'],
'htdocs/core/actions_printing.inc.php' => ['PhanUndeclaredProperty'],
'htdocs/core/actions_sendmails.inc.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/core/actions_sendmails.inc.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/core/ajax/ajaxdirtree.php' => ['PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'],
'htdocs/core/class/canvas.class.php' => ['PhanParamTooMany', 'PhanUndeclaredMethod'],
'htdocs/core/class/ccountry.class.php' => ['PhanUndeclaredProperty'],
'htdocs/core/class/cgenericdic.class.php' => ['PhanUndeclaredProperty'],
'htdocs/core/class/commonobject.class.php' => ['PhanParamTooMany', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
'htdocs/core/class/commonorder.class.php' => ['PhanPluginUnknownPropertyType'],
'htdocs/core/class/commonpeople.class.php' => ['PhanUndeclaredProperty'],
'htdocs/core/class/commonsocialnetworks.class.php' => ['PhanUndeclaredProperty'],
'htdocs/core/class/conf.class.php' => ['PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchProperty'],
@ -153,6 +151,7 @@ return [
'htdocs/core/class/html.formcompany.class.php' => ['PhanUndeclaredProperty'],
'htdocs/core/class/html.formfile.class.php' => ['PhanUndeclaredProperty'],
'htdocs/core/class/html.formmail.class.php' => ['PhanUndeclaredProperty'],
'htdocs/core/class/ldap.class.php' => ['PhanTypeMismatchArgumentInternalProbablyReal'],
'htdocs/core/class/notify.class.php' => ['PhanUndeclaredProperty'],
'htdocs/core/class/smtps.class.php' => ['PhanTypeConversionFromArray'],
'htdocs/core/class/timespent.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'],
@ -170,49 +169,65 @@ return [
'htdocs/core/lib/project.lib.php' => ['PhanUndeclaredProperty'],
'htdocs/core/lib/xcal.lib.php' => ['PhanUndeclaredProperty'],
'htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/core/modules/asset/mod_asset_advanced.php' => ['PhanUndeclaredProperty'],
'htdocs/core/modules/asset/mod_asset_advanced.php' => ['PhanPluginSuspiciousParamOrder', 'PhanUndeclaredProperty'],
'htdocs/core/modules/barcode/doc/phpbarcode.modules.php' => ['PhanPossiblyNullTypeMismatchProperty', 'PhanPossiblyUndeclaredVariable'],
'htdocs/core/modules/barcode/mod_barcode_product_standard.php' => ['PhanPluginUnknownPropertyType'],
'htdocs/core/modules/bom/mod_bom_advanced.php' => ['PhanUndeclaredProperty'],
'htdocs/core/modules/barcode/mod_barcode_product_standard.php' => ['PhanPluginSuspiciousParamOrder', 'PhanPluginUnknownPropertyType'],
'htdocs/core/modules/barcode/mod_barcode_thirdparty_standard.php' => ['PhanPluginSuspiciousParamOrder'],
'htdocs/core/modules/bom/mod_bom_advanced.php' => ['PhanPluginSuspiciousParamOrder', 'PhanUndeclaredProperty'],
'htdocs/core/modules/cheque/mod_chequereceipt_thyme.php' => ['PhanPluginSuspiciousParamOrder'],
'htdocs/core/modules/commande/doc/pdf_einstein.modules.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
'htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'],
'htdocs/core/modules/commande/mod_commande_saphir.php' => ['PhanPluginSuspiciousParamOrder'],
'htdocs/core/modules/commande/modules_commande.php' => ['PhanPluginUnknownPropertyType'],
'htdocs/core/modules/contract/doc/pdf_strato.modules.php' => ['PhanTypeMismatchArgumentNullableInternal'],
'htdocs/core/modules/contract/mod_contract_magre.php' => ['PhanPluginSuspiciousParamOrder'],
'htdocs/core/modules/delivery/doc/pdf_storm.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/core/modules/delivery/doc/pdf_typhon.modules.php' => ['PhanPluginUnknownPropertyType'],
'htdocs/core/modules/delivery/mod_delivery_saphir.php' => ['PhanUndeclaredProperty'],
'htdocs/core/modules/delivery/mod_delivery_saphir.php' => ['PhanPluginSuspiciousParamOrder', 'PhanUndeclaredProperty'],
'htdocs/core/modules/expedition/doc/pdf_merou.modules.php' => ['PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/core/modules/expedition/mod_expedition_ribera.php' => ['PhanPluginSuspiciousParamOrder'],
'htdocs/core/modules/expensereport/doc/pdf_standard_expensereport.modules.php' => ['PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'],
'htdocs/core/modules/expensereport/mod_expensereport_sand.php' => ['PhanPluginSuspiciousParamOrder'],
'htdocs/core/modules/facture/doc/pdf_crabe.modules.php' => ['PhanPluginEmptyStatementIf', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
'htdocs/core/modules/facture/doc/pdf_octopus.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'],
'htdocs/core/modules/facture/doc/pdf_sponge.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'],
'htdocs/core/modules/facture/modules_facture.php' => ['PhanPluginUnknownPropertyType'],
'htdocs/core/modules/fichinter/mod_arctic.php' => ['PhanPluginSuspiciousParamOrder'],
'htdocs/core/modules/fichinter/mod_pacific.php' => ['PhanPossiblyUndeclaredVariable'],
'htdocs/core/modules/holiday/mod_holiday_immaculate.php' => ['PhanPluginSuspiciousParamOrder'],
'htdocs/core/modules/hrm/doc/pdf_standard_evaluation.modules.php' => ['PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'],
'htdocs/core/modules/hrm/mod_evaluation_advanced.php' => ['PhanUndeclaredProperty'],
'htdocs/core/modules/hrm/mod_evaluation_advanced.php' => ['PhanPluginSuspiciousParamOrder', 'PhanUndeclaredProperty'],
'htdocs/core/modules/import/import_csv.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchProperty'],
'htdocs/core/modules/import/import_xlsx.modules.php' => ['PhanTypeMismatchProperty'],
'htdocs/core/modules/mailings/contacts1.modules.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/core/modules/mailings/thirdparties.modules.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/core/modules/movement/doc/pdf_standard_movementstock.modules.php' => ['PhanPluginDuplicateExpressionBinaryOp', 'PhanPluginEmptyStatementIf', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable'],
'htdocs/core/modules/mrp/doc/pdf_vinci.modules.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
'htdocs/core/modules/mrp/mod_mo_advanced.php' => ['PhanUndeclaredProperty'],
'htdocs/core/modules/mrp/mod_mo_advanced.php' => ['PhanPluginSuspiciousParamOrder', 'PhanUndeclaredProperty'],
'htdocs/core/modules/oauth/github_oauthcallback.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/core/modules/payment/mod_payment_ant.php' => ['PhanPluginSuspiciousParamOrder'],
'htdocs/core/modules/printing/printgcp.modules.php' => ['PhanTypeMismatchDimFetch'],
'htdocs/core/modules/product/doc/pdf_standard.modules.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredVariable'],
'htdocs/core/modules/product/mod_codeproduct_elephant.php' => ['PhanPluginSuspiciousParamOrder'],
'htdocs/core/modules/product_batch/mod_lot_advanced.php' => ['PhanPluginSuspiciousParamOrder'],
'htdocs/core/modules/product_batch/mod_sn_advanced.php' => ['PhanPluginSuspiciousParamOrder'],
'htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php' => ['PhanUndeclaredProperty'],
'htdocs/core/modules/project/doc/pdf_timespent.modules.php' => ['PhanUndeclaredProperty'],
'htdocs/core/modules/project/mod_project_universal.php' => ['PhanPluginSuspiciousParamOrder'],
'htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanUndeclaredProperty'],
'htdocs/core/modules/project/task/mod_task_universal.php' => ['PhanPluginSuspiciousParamOrder'],
'htdocs/core/modules/propale/doc/pdf_azur.modules.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
'htdocs/core/modules/propale/doc/pdf_cyan.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'],
'htdocs/core/modules/propale/mod_propale_saphir.php' => ['PhanPluginSuspiciousParamOrder'],
'htdocs/core/modules/propale/modules_propale.php' => ['PhanPluginUnknownPropertyType'],
'htdocs/core/modules/reception/doc/pdf_squille.modules.php' => ['PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredProperty'],
'htdocs/core/modules/societe/mod_codecompta_aquarium.php' => ['PhanPluginUnknownPropertyType'],
'htdocs/core/modules/societe/mod_codecompta_digitaria.php' => ['PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal'],
'htdocs/core/modules/reception/mod_reception_moonstone.php' => ['PhanPluginSuspiciousParamOrder'],
'htdocs/core/modules/societe/mod_codecompta_aquarium.php' => ['PhanPluginSuspiciousParamOrder', 'PhanPluginUnknownPropertyType'],
'htdocs/core/modules/societe/mod_codecompta_digitaria.php' => ['PhanPluginSuspiciousParamOrder', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal'],
'htdocs/core/modules/stock/doc/pdf_standard_stock.modules.php' => ['PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable'],
'htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanUndeclaredProperty'],
'htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/core/modules/stocktransfer/mod_stocktransfer_advanced.php' => ['PhanUndeclaredProperty'],
'htdocs/core/modules/stocktransfer/mod_stocktransfer_advanced.php' => ['PhanPluginSuspiciousParamOrder', 'PhanUndeclaredProperty'],
'htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php' => ['PhanPossiblyUndeclaredVariable'],
'htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'],
'htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php' => ['PhanPossiblyUndeclaredVariable'],
@ -221,24 +236,24 @@ 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_payment/mod_supplier_payment_brodator.php' => ['PhanPluginSuspiciousParamOrder'],
'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/supplier_proposal/mod_supplier_proposal_saphir.php' => ['PhanPluginSuspiciousParamOrder'],
'htdocs/core/modules/takepos/mod_takepos_ref_universal.php' => ['PhanPluginSuspiciousParamOrder'],
'htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php' => ['PhanPossiblyUndeclaredVariable'],
'htdocs/core/modules/ticket/mod_ticket_universal.php' => ['PhanPluginSuspiciousParamOrder'],
'htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php' => ['PhanPossiblyUndeclaredVariable'],
'htdocs/core/modules/workstation/mod_workstation_advanced.php' => ['PhanUndeclaredProperty'],
'htdocs/core/modules/workstation/mod_workstation_advanced.php' => ['PhanPluginSuspiciousParamOrder', 'PhanUndeclaredProperty'],
'htdocs/core/search_page.php' => ['PhanEmptyForeach', 'PhanPluginBothLiteralsBinaryOp'],
'htdocs/core/tpl/ajaxrow.tpl.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanUndeclaredGlobalVariable'],
'htdocs/core/tpl/ajaxrow.tpl.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/core/tpl/commonfields_view.tpl.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/core/tpl/document_actions_post_headers.tpl.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanUndeclaredGlobalVariable'],
'htdocs/core/tpl/extrafields_edit.tpl.php' => ['PhanPluginUndeclaredVariableIsset'],
'htdocs/core/tpl/extrafields_list_search_title.tpl.php' => ['PhanPluginUndeclaredVariableIsset'],
'htdocs/core/tpl/document_actions_post_headers.tpl.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/core/tpl/extrafields_view.tpl.php' => ['PhanUndeclaredProperty'],
'htdocs/core/tpl/filemanager.tpl.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanUndeclaredGlobalVariable'],
'htdocs/core/tpl/formlayoutai.tpl.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanUndeclaredGlobalVariable'],
'htdocs/core/tpl/list_print_total.tpl.php' => ['PhanPluginUndeclaredVariableIsset'],
'htdocs/core/tpl/massactions_pre.tpl.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/core/tpl/notes.tpl.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/core/tpl/filemanager.tpl.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanUndeclaredGlobalVariable'],
'htdocs/core/tpl/formlayoutai.tpl.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/core/tpl/massactions_pre.tpl.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/core/tpl/notes.tpl.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/core/tpl/object_discounts.tpl.php' => ['PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredGlobalVariable'],
'htdocs/core/tpl/objectline_create.tpl.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'],
'htdocs/core/tpl/objectline_view.tpl.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
@ -262,11 +277,10 @@ return [
'htdocs/delivery/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'],
'htdocs/document.php' => ['PhanRedefineFunction'],
'htdocs/don/admin/donation.php' => ['PhanUndeclaredMethod'],
'htdocs/don/card.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/don/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/don/class/api_donations.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'],
'htdocs/don/class/don.class.php' => ['PhanParamTooMany'],
'htdocs/don/document.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'],
'htdocs/don/index.php' => ['PhanPluginUndeclaredVariableIsset'],
'htdocs/don/info.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'],
'htdocs/don/list.php' => ['PhanTypeMismatchProperty'],
'htdocs/don/note.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'],
@ -277,9 +291,9 @@ return [
'htdocs/ecm/dir_card.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/ecm/index.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/emailcollector/class/emailcollector.class.php' => ['PhanUndeclaredProperty'],
'htdocs/emailcollector/lib/emailcollector.lib.php' => ['PhanUndeclaredTypeParameter'],
'htdocs/eventorganization/class/conferenceorboothattendee.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'],
'htdocs/eventorganization/conferenceorbooth_card.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/eventorganization/conferenceorbooth_contact.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'],
'htdocs/eventorganization/conferenceorbooth_list.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/eventorganization/conferenceorboothattendee_card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'],
'htdocs/eventorganization/conferenceorboothattendee_list.php' => ['PhanTypeMismatchArgumentProbablyReal'],
@ -303,12 +317,12 @@ return [
'htdocs/expensereport/tpl/expensereport_linktofile.tpl.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/expensereport/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'],
'htdocs/externalsite/frames.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/fichinter/card-rec.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'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/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/fichinter/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'],
'htdocs/filefunc.inc.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'],
'htdocs/filefunc.inc.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'],
'htdocs/fourn/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/fourn/class/api_supplier_invoices.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'],
'htdocs/fourn/class/api_supplier_orders.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchArgumentProbablyReal'],
@ -325,7 +339,7 @@ return [
'htdocs/fourn/facture/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchProperty'],
'htdocs/fourn/facture/list-rec.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/fourn/facture/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/fourn/facture/paiement.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'],
'htdocs/fourn/facture/paiement.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'],
'htdocs/fourn/paiement/card.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/fourn/paiement/document.php' => ['PhanTypeMismatchArgumentProbablyReal'],
@ -353,12 +367,10 @@ return [
'htdocs/imports/emptyexample.php' => ['PhanRedefineFunction', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/imports/import.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/install/check.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal'],
'htdocs/install/fileconf.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/install/inc.php' => ['PhanPluginUndeclaredVariableIsset'],
'htdocs/install/fileconf.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/install/index.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/install/repair.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/install/repair.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/install/step2.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredProperty'],
'htdocs/install/step5.php' => ['PhanPluginUndeclaredVariableIsset'],
'htdocs/install/upgrade.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal'],
'htdocs/intracommreport/card.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'],
@ -376,7 +388,7 @@ return [
'htdocs/mrp/class/mo.class.php' => ['PhanTypeMismatchProperty'],
'htdocs/mrp/mo_card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/mrp/mo_movements.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable'],
'htdocs/mrp/mo_production.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/mrp/mo_production.php' => ['PhanPluginEmptyStatementIf', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/mrp/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'],
'htdocs/mrp/tpl/originproductline.tpl.php' => ['PhanUndeclaredProperty'],
'htdocs/multicurrency/class/api_multicurrencies.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'],
@ -384,7 +396,6 @@ return [
'htdocs/opcachepreload.php' => ['PhanEmptyForeach'],
'htdocs/opensurvey/card.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/opensurvey/class/opensurveysondage.class.php' => ['PhanTypeMismatchProperty'],
'htdocs/opensurvey/list.php' => ['PhanPluginUndeclaredVariableIsset'],
'htdocs/opensurvey/results.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredGlobalVariable'],
'htdocs/opensurvey/wizard/choix_date.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/opensurvey/wizard/create_survey.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
@ -401,12 +412,11 @@ return [
'htdocs/product/class/html.formproduct.class.php' => ['PhanUndeclaredProperty'],
'htdocs/product/class/productfournisseurprice.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'],
'htdocs/product/document.php' => ['PhanPossiblyNullTypeMismatchProperty', 'PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/product/index.php' => ['PhanPluginUndeclaredVariableIsset'],
'htdocs/product/inventory/card.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/product/inventory/class/inventory.class.php' => ['PhanUndeclaredProperty'],
'htdocs/product/inventory/inventory.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/product/inventory/list.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/product/list.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/product/list.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/product/price.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/product/reassort.php' => ['PhanTypeExpectedObjectPropAccessButGotNull'],
'htdocs/product/stats/card.php' => ['PhanTypeComparisonFromArray'],
@ -417,8 +427,8 @@ return [
'htdocs/product/stock/class/mouvementstock.class.php' => ['PhanPossiblyUndeclaredVariable'],
'htdocs/product/stock/info.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/product/stock/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
'htdocs/product/stock/movement_card.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/product/stock/movement_list.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanPluginUndeclaredVariableIsset', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/product/stock/movement_card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/product/stock/movement_list.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/product/stock/product.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/product/stock/productlot_card.php' => ['PhanUndeclaredProperty'],
'htdocs/product/stock/productlot_list.php' => ['PhanTypeMismatchArgumentProbablyReal'],
@ -442,7 +452,7 @@ return [
'htdocs/projet/element.php' => ['PhanUndeclaredProperty'],
'htdocs/projet/ganttchart.inc.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'],
'htdocs/projet/ganttview.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/projet/graph_opportunities.inc.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanUndeclaredGlobalVariable'],
'htdocs/projet/graph_opportunities.inc.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/projet/index.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/projet/list.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/projet/stats/index.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
@ -453,11 +463,11 @@ return [
'htdocs/projet/tasks/list.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/projet/tasks/note.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/projet/tasks/task.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/projet/tasks/time.php' => ['PhanEmptyForeach', 'PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidDimOffset', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
'htdocs/projet/tasks/time.php' => ['PhanEmptyForeach', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidDimOffset', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
'htdocs/projet/tasks/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'],
'htdocs/public/agenda/agendaexport.php' => ['PhanRedefineFunction'],
'htdocs/public/bookcal/index.php' => ['PhanRedefineFunction'],
'htdocs/public/company/new.php' => ['PhanRedefineFunction', 'PhanUndeclaredGlobalVariable'],
'htdocs/public/company/new.php' => ['PhanRedefineFunction'],
'htdocs/public/cron/cron_run_jobs_by_url.php' => ['PhanUndeclaredProperty'],
'htdocs/public/demo/index.php' => ['PhanRedefineFunction'],
'htdocs/public/donations/donateurs_code.php' => ['PhanRedefineFunction'],
@ -480,7 +490,6 @@ return [
'htdocs/public/project/viewandvote.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'],
'htdocs/public/recruitment/view.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'],
'htdocs/public/stripe/ipn.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'],
'htdocs/public/test/test_arrays.php' => ['PhanPluginUndeclaredVariableIsset'],
'htdocs/public/ticket/create_ticket.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchDimFetchNullable', 'PhanTypeMismatchProperty'],
'htdocs/public/ticket/view.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/public/webportal/tpl/menu.tpl.php' => ['PhanUndeclaredProperty'],
@ -492,15 +501,15 @@ return [
'htdocs/reception/class/reception.class.php' => ['PhanUndeclaredProperty'],
'htdocs/reception/contact.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/reception/dispatch.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/reception/list.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/reception/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/reception/note.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/recruitment/admin/setup.php' => ['PhanEmptyForeach'],
'htdocs/recruitment/admin/setup_candidatures.php' => ['PhanEmptyForeach'],
'htdocs/recruitment/class/recruitmentcandidature.class.php' => ['PhanUndeclaredProperty'],
'htdocs/recruitment/class/recruitmentjobposition.class.php' => ['PhanUndeclaredProperty'],
'htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
'htdocs/recruitment/core/modules/recruitment/mod_recruitmentcandidature_advanced.php' => ['PhanUndeclaredProperty'],
'htdocs/recruitment/core/modules/recruitment/mod_recruitmentjobposition_advanced.php' => ['PhanUndeclaredProperty'],
'htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
'htdocs/recruitment/core/modules/recruitment/mod_recruitmentcandidature_advanced.php' => ['PhanPluginSuspiciousParamOrder', 'PhanUndeclaredProperty'],
'htdocs/recruitment/core/modules/recruitment/mod_recruitmentjobposition_advanced.php' => ['PhanPluginSuspiciousParamOrder', 'PhanUndeclaredProperty'],
'htdocs/recruitment/index.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/recruitment/recruitmentcandidature_card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
'htdocs/recruitment/recruitmentcandidature_list.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
@ -514,7 +523,7 @@ return [
'htdocs/salaries/card.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/salaries/class/api_salaries.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'],
'htdocs/salaries/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'],
'htdocs/salaries/paiement_salary.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
'htdocs/salaries/paiement_salary.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
'htdocs/salaries/virement_request.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/societe/admin/societe.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredMethod'],
'htdocs/societe/ajax/company.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
@ -522,7 +531,7 @@ return [
'htdocs/societe/class/api_thirdparties.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'],
'htdocs/societe/class/societe.class.php' => ['PhanTypeMismatchProperty'],
'htdocs/societe/consumption.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/societe/list.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/societe/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/societe/paymentmodes.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanUndeclaredGlobalVariable'],
'htdocs/societe/price.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/societe/tpl/linesalesrepresentative.tpl.php' => ['PhanTypeMismatchArgumentProbablyReal'],
@ -536,10 +545,9 @@ return [
'htdocs/takepos/ajax/ajax.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
'htdocs/takepos/floors.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/takepos/freezone.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/takepos/index.php' => ['PhanPluginUndeclaredVariableIsset'],
'htdocs/takepos/invoice.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'],
'htdocs/takepos/pay.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/takepos/split.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/takepos/split.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/theme/eldy/badges.inc.php' => ['PhanRedefineFunction'],
'htdocs/theme/eldy/btn.inc.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/theme/eldy/dropdown.inc.php' => ['PhanUndeclaredGlobalVariable'],
@ -597,7 +605,6 @@ return [
'htdocs/workstation/workstation_list.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/zapier/class/api_zapier.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'],
'htdocs/zapier/class/hook.class.php' => ['PhanUndeclaredProperty'],
'internal' => ['PhanUndeclaredConstant'],
],
// 'directory_suppressions' => ['src/directory_name' => ['PhanIssueName1', 'PhanIssueName2']] can be manually added if needed.
// (directory_suppressions will currently be ignored by subsequent calls to --save-baseline, but may be preserved in future Phan releases)

View file

@ -136,7 +136,7 @@ class AccountancyImport
$sens = 'C';
}
return "'" . $this->db->escape($sens) . "'";
return $sens;
}
return "''";

View file

@ -3,7 +3,8 @@
* Copyright (C) 2015-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2015-2020 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Jose MARTINEZ <jose.martinez@pichinov.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -68,7 +69,7 @@ class BookKeeping extends CommonObject
public $doc_date;
/**
* @var int Deadline for payment
* @var int|null|'' Deadline for payment
*/
public $date_lim_reglement;
@ -324,7 +325,7 @@ class BookKeeping extends CommonObject
$this->piece_num = 0;
// First check if line not yet already in bookkeeping.
// Note that we must include 'doc_type - fk_doc - numero_compte - label' to be sure to have unicity of line (because we may have several lines
// Note that we must include 'doc_type - fk_doc - numero_compte - label - subledger_account (if not empty)' to be sure to have unicity of line (because we may have several lines
// with same doc_type, fk_doc, numero_compte for 1 invoice line when using localtaxes with same account)
// WARNING: This is not reliable, label may have been modified. This is just a small protection.
// The page that make transfer make the test on couple (doc_type - fk_doc) only.
@ -338,6 +339,9 @@ class BookKeeping extends CommonObject
}
$sql .= " AND numero_compte = '".$this->db->escape($this->numero_compte)."'";
$sql .= " AND label_operation = '".$this->db->escape($this->label_operation)."'";
if (!empty($this->subledger_account)) {
$sql .= " AND subledger_account = '".$this->db->escape($this->subledger_account)."'";
}
$sql .= " AND entity = ".$conf->entity; // Do not use getEntity for accounting features
$resql = $this->db->query($sql);
@ -2863,10 +2867,8 @@ class BookKeeping extends CommonObject
$sql = 'SELECT';
$sql .= " t.numero_compte,";
$sql .= " t.label_compte,";
if ($separate_auxiliary_account) {
$sql .= " t.subledger_account,";
$sql .= " t.subledger_label,";
$sql .= " NULLIF(t.subledger_account, '') as subledger_account,"; // fix db issues with Null or "" values
}
$sql .= " aa.pcg_type,";
$sql .= " (SUM(t.credit) - SUM(t.debit)) as opening_balance";
@ -2878,10 +2880,11 @@ class BookKeeping extends CommonObject
$sql .= ' AND aa.pcg_type IN (' . $this->db->sanitize(implode(',', $pcg_type_filter), 1) . ')';
$sql .= " AND DATE(t.doc_date) >= '" . $this->db->idate($fiscal_period->date_start) . "'";
$sql .= " AND DATE(t.doc_date) <= '" . $this->db->idate($fiscal_period->date_end) . "'";
$sql .= ' GROUP BY t.numero_compte, t.label_compte, aa.pcg_type';
$sql .= ' GROUP BY t.numero_compte, aa.pcg_type';
if ($separate_auxiliary_account) {
$sql .= ' ,t.subledger_account, t.subledger_label';
$sql .= " , NULLIF(t.subledger_account, '')";
}
$sql .= ' HAVING (SUM(t.credit) - SUM(t.debit)) != 0 '; // Exclude rows with opening_balance = 0
$sql .= $this->db->order("t.numero_compte", "ASC");
$resql = $this->db->query($sql);
@ -2902,24 +2905,41 @@ class BookKeeping extends CommonObject
$bookkeeping = new BookKeeping($this->db);
$bookkeeping->doc_date = $new_fiscal_period->date_start;
$bookkeeping->date_lim_reglement = 0;
$bookkeeping->doc_ref = $new_fiscal_period->label;
$bookkeeping->date_lim_reglement = '';
$bookkeeping->doc_ref = $fiscal_period->label;
$bookkeeping->date_creation = $now;
$bookkeeping->doc_type = 'closure';
$bookkeeping->fk_doc = $new_fiscal_period->id;
$bookkeeping->fk_doc = $fiscal_period->id;
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
$bookkeeping->thirdparty_code = '';
if ($separate_auxiliary_account) {
$bookkeeping->subledger_account = $obj->subledger_account;
$bookkeeping->subledger_label = $obj->subledger_label;
$sql = 'SELECT';
$sql .= " subledger_label";
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
$sql .= " WHERE subledger_account = '" . $this->db->escape($obj->subledger_account) . "'";
$sql .= " ORDER BY doc_date DESC";
$sql .= " LIMIT 1";
$result = $this->db->query($sql);
if (!$result) {
$this->errors[] = 'Error: ' . $this->db->lasterror();
dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
$error++;
}
$objtmp = $this->db->fetch_object($result);
$bookkeeping->subledger_label = $objtmp->subledger_label; // latest subledger label used
} else {
$bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = '';
$bookkeeping->subledger_account = null;
$bookkeeping->subledger_label = null;
}
$bookkeeping->numero_compte = $obj->numero_compte;
$bookkeeping->label_compte = $obj->label_compte;
$accountingaccount = new AccountingAccount($this->db);
$accountingaccount->fetch(0, $obj->numero_compte);
$bookkeeping->label_compte = $accountingaccount->label; // latest account label used
$bookkeeping->label_operation = $new_fiscal_period->label;
$bookkeeping->montant = $mt;
@ -2933,8 +2953,7 @@ class BookKeeping extends CommonObject
$result = $bookkeeping->create($user);
if ($result < 0) {
$this->error = $bookkeeping->error;
$this->errors = $bookkeeping->errors;
$this->setErrorsFromObject($bookkeeping);
$error++;
break;
}
@ -2949,21 +2968,35 @@ class BookKeeping extends CommonObject
$bookkeeping = new BookKeeping($this->db);
$bookkeeping->doc_date = $new_fiscal_period->date_start;
$bookkeeping->date_lim_reglement = 0;
$bookkeeping->doc_ref = $new_fiscal_period->label;
$bookkeeping->date_lim_reglement = '';
$bookkeeping->doc_ref = $fiscal_period->label;
$bookkeeping->date_creation = $now;
$bookkeeping->doc_type = 'closure';
$bookkeeping->fk_doc = $new_fiscal_period->id;
$bookkeeping->fk_doc = $fiscal_period->id;
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
$bookkeeping->thirdparty_code = '';
if ($separate_auxiliary_account) {
$bookkeeping->subledger_label = '';
$bookkeeping->subledger_account = $obj->subledger_account;
$bookkeeping->subledger_label = $obj->subledger_label;
$sql = 'SELECT';
$sql .= " subledger_label";
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
$sql .= " WHERE subledger_account = '" . $this->db->escape($obj->subledger_account) . "'";
$sql .= " ORDER BY doc_date DESC";
$sql .= " LIMIT 1";
$result = $this->db->query($sql);
if (!$result) {
$this->errors[] = 'Error: ' . $this->db->lasterror();
dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
$error++;
}
$objtmp = $this->db->fetch_object($result);
$bookkeeping->subledger_label = $objtmp->subledger_label; // latest subledger label used
} else {
$bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = '';
$bookkeeping->subledger_account = null;
$bookkeeping->subledger_label = null;
}
$bookkeeping->numero_compte = $accountingaccount->account_number;
@ -2981,8 +3014,7 @@ class BookKeeping extends CommonObject
$result = $bookkeeping->create($user);
if ($result < 0) {
$this->error = $bookkeeping->error;
$this->errors = $bookkeeping->errors;
$this->setErrorsFromObject($bookkeeping);
$error++;
}
}

View file

@ -864,14 +864,14 @@ class Lettering extends BookKeeping
$sql = "SELECT DISTINCT tl2.fk_link, tl2.fk_doc";
$sql .= " FROM (";
// @phan-suppress-next-line PhanTypePossiblyInvalidDimOffset
$sql .= " SELECT DISTINCT " . $this->db->ifsql("tll.".$this->db->sanitize($linked_info['fk_table_link_line_parent']), "tll.".$this->db->sanitize($linked_info['fk_table_link_line_parent']), "tl.".$this->db->sanitize($linked_info['fk_link']))." AS fk_link, tl.".$this->db->sanitize($linked_info['fk_doc'])." AS fk_doc";
$sql .= " SELECT DISTINCT " . $this->db->ifsql("tll.".$this->db->sanitize($linked_info['fk_table_link_line_parent'])." IS NOT NULL", "tll.".$this->db->sanitize($linked_info['fk_table_link_line_parent']), "tl.".$this->db->sanitize($linked_info['fk_link']))." AS fk_link, tl.".$this->db->sanitize($linked_info['fk_doc'])." AS fk_doc";
$sql .= " FROM " . MAIN_DB_PREFIX .$this->db->sanitize($linked_info['table'])." AS tl";
// @phan-suppress-next-line PhanTypePossiblyInvalidDimOffset
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . $this->db->sanitize($linked_info['table_link_line']) . " AS tll ON tll.".$this->db->sanitize($linked_info['fk_table_link_line']) . " = tl.".$this->db->sanitize($linked_info['fk_line_link']);
$sql .= ") AS tl";
$sql .= " LEFT JOIN (";
// @phan-suppress-next-line PhanTypePossiblyInvalidDimOffset
$sql .= " SELECT DISTINCT " . $this->db->ifsql("tll.".$this->db->sanitize($linked_info['fk_table_link_line_parent']), "tll.".$this->db->sanitize($linked_info['fk_table_link_line_parent']), "tl.".$this->db->sanitize($linked_info['fk_link']))." AS fk_link, tl.".$this->db->sanitize($linked_info['fk_doc'])." AS fk_doc";
$sql .= " SELECT DISTINCT " . $this->db->ifsql("tll.".$this->db->sanitize($linked_info['fk_table_link_line_parent'])." IS NOT NULL", "tll.".$this->db->sanitize($linked_info['fk_table_link_line_parent']), "tl.".$this->db->sanitize($linked_info['fk_link']))." AS fk_link, tl.".$this->db->sanitize($linked_info['fk_doc'])." AS fk_doc";
$sql .= " FROM " . MAIN_DB_PREFIX .$this->db->sanitize($linked_info['table'])." AS tl";
// @phan-suppress-next-line PhanTypePossiblyInvalidDimOffset
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . $this->db->sanitize($linked_info['table_link_line']) . " AS tll ON tll.".$this->db->sanitize($linked_info['fk_table_link_line']) . " = tl.".$this->db->sanitize($linked_info['fk_line_link']);

View file

@ -461,12 +461,12 @@ SELECT
fk_facture,
COUNT(fd.rowid) as nb
FROM
".MAIN_DB_PREFIX."facturedet as fd
".MAIN_DB_PREFIX."facturedet as fd
WHERE
fd.product_type <= 2
AND fd.fk_code_ventilation <= 0
AND fd.total_ttc <> 0
AND fk_facture IN (".$db->sanitize(implode(",", array_keys($tabfac))).")
AND fk_facture IN (".$db->sanitize(implode(",", array_keys($tabfac))).")
GROUP BY fk_facture
";
$resql = $db->query($sql);

View file

@ -19,8 +19,11 @@
/**
* @var Adherent $object
* @var Canvas $this
* @var Conf $conf
* @var Translate $langs
*
* @var string $canvas
*/
// Protection to avoid direct call of template

View file

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2010 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2012 Philippe Grand <philippe.grand@atoo-net.com>
/* Copyright (C) 2010 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2012 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -19,8 +19,11 @@
/**
* @var Adherent $object
* @var Canvas $this
* @var Conf $conf
* @var Translate $langs
*
* @var string $canvas
*/
// Protection to avoid direct call of template

View file

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2012-2022 Philippe Grand <philippe.grand@atoo-net.com>
/* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2012-2022 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -19,9 +19,12 @@
/**
* @var Adherent $object
* @var Canvas $this
* @var Conf $conf
* @var Translate $langs
* @var User $user
*
* @var string $canvas
*/
// Protection to avoid direct call of template

View file

@ -374,7 +374,7 @@ class Adherent extends CommonObject
*/
const STATUS_VALIDATED = 1;
/**
* Resiliated
* Resiliated (membership end and was not renew)
*/
const STATUS_RESILIATED = 0;
/**

View file

@ -53,6 +53,7 @@ $langs->loadLangs(array('admin', 'other', 'agenda', 'users'));
$action = GETPOST('action', 'aZ09');
$value = GETPOST('value', 'alpha');
$label = GETPOST('label', 'alpha');
$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
$param = GETPOST('param', 'alpha');

View file

@ -48,6 +48,7 @@ $langs->loadLangs(array("admin", "other", "agenda"));
$action = GETPOST('action', 'aZ09');
$value = GETPOST('value', 'alpha');
$label = GETPOST('label', 'alpha');
$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
$param = GETPOST('param', 'alpha');

View file

@ -1381,7 +1381,26 @@ if ($id > 0) {
$tablecode = 't.code';
$tableprefix = '';
$tableprefixarray = array(DICT_FORME_JURIDIQUE => 'f.code', DICT_DEPARTEMENTS => 'd.code_departement', DICT_REGIONS => 'r.code_region', DICT_COUNTRY => 'c.code', DICT_CIVILITY => 'c.code', DICT_ACTIONCOMM => 'a.code', DICT_CURRENCIES => 'code_iso', DICT_ECOTAXE => 'e.code', DICT_HOLIDAY_TYPES => 'h.code', DICT_CHARGESOCIALES => 'a.code', DICT_HRM_PUBLIC_HOLIDAY => 'a.code', DICT_UNITS => 'r.code', DICT_SOCIALNETWORKS => 's.code', 45 => 'f.code', 46 => 'f.code', 47 => 'f.code', 48 => 'f.code');
$tableprefixarray = array(
DICT_FORME_JURIDIQUE => 'f.code',
DICT_DEPARTEMENTS => 'd.code_departement',
DICT_REGIONS => 'r.code_region',
DICT_COUNTRY => 'c.code',
DICT_CIVILITY => 'c.code',
DICT_ACTIONCOMM => 'a.code',
DICT_CHARGESOCIALES => 'a.code',
DICT_TYPENT => 't.code',
DICT_CURRENCIES => 'c.code_iso',
DICT_ECOTAXE => 'e.code',
DICT_HOLIDAY_TYPES => 'h.code',
DICT_HRM_PUBLIC_HOLIDAY => 'a.code',
DICT_UNITS => 'r.code',
DICT_SOCIALNETWORKS => 's.code',
45 => 'f.code',
46 => 'f.code',
47 => 'f.code',
48 => 'f.code',
);
if (!empty($tableprefixarray[$id])) {
$tablecode = $tableprefixarray[$id];
$tableprefix = preg_replace('/\..*$/', '.', $tablecode);

View file

@ -61,16 +61,16 @@ print load_fiche_titre($langs->trans("SetupArea"), '', 'tools');
if (getDolGlobalString('MAIN_MOTD_SETUPPAGE')) {
$conf->global->MAIN_MOTD_SETUPPAGE = preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>/i', '<br>', $conf->global->MAIN_MOTD_SETUPPAGE);
$conf->global->MAIN_MOTD_SETUPPAGE = preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>/i', '<br>', getDolGlobalString('MAIN_MOTD_SETUPPAGE'));
if (getDolGlobalString('MAIN_MOTD_SETUPPAGE')) {
$i = 0;
$reg = array();
while (preg_match('/__\(([a-zA-Z|@]+)\)__/i', $conf->global->MAIN_MOTD_SETUPPAGE, $reg) && $i < 100) {
while (preg_match('/__\(([a-zA-Z|@]+)\)__/i', getDolGlobalString('MAIN_MOTD_SETUPPAGE'), $reg) && $i < 100) {
$tmp = explode('|', $reg[1]);
if (!empty($tmp[1])) {
$langs->load($tmp[1]);
}
$conf->global->MAIN_MOTD_SETUPPAGE = preg_replace('/__\('.preg_quote($reg[1]).'\)__/i', $langs->trans($tmp[0]), $conf->global->MAIN_MOTD_SETUPPAGE);
$conf->global->MAIN_MOTD_SETUPPAGE = preg_replace('/__\('.preg_quote($reg[1]).'\)__/i', $langs->trans($tmp[0]), getDolGlobalString('MAIN_MOTD_SETUPPAGE'));
$i++;
}

View file

@ -1059,9 +1059,24 @@ if ($action == 'edit') {
$text .= /* ($text ? '<br><br>' : ''). */$langs->trans("WarningPHPMailSPF", getDolGlobalString('MAIN_EXTERNAL_SMTP_SPF_STRING_TO_ADD'));
}
if (getDolGlobalString('MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS')) { // Not defined by default. Depend on platform.
$ipstoshow = '';
// List of IP shown as record to add as allowed IP if we use the smtp method. Value is '1.2.3.4, [aaaa:bbbb:cccc:dddd]'
// TODO Add a key to allow to show the IP/name of server detected dynamically
$text .= ($text ? '<br><br>' : '').$langs->trans("WarningPHPMail2", getDolGlobalString('MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS'));
$arrayipstoshow = explode(',', getDolGlobalString('MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS'));
foreach ($arrayipstoshow as $iptoshow) {
// If MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS is an URL to get/show the public IP/name of server detected dynamically
if (preg_match('/^http/i', $iptoshow)) {
$tmpresult = getURLContent($iptoshow, 'GET', '', 1, array(), array('http', 'https'), 0);
if (!empty($tmpresult['content'])) {
$iptoshow = $tmpresult['content'];
} else {
$iptoshow = ''; // Failed to get IP
}
}
$ipstoshow .= ($ipstoshow ? ', ' : '').trim($iptoshow);
}
if ($ipstoshow) {
$text .= ($text ? '<br><br>' : '').$langs->trans("WarningPHPMail2", $ipstoshow);
}
}
}

View file

@ -1,8 +1,8 @@
<?php
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -55,7 +55,6 @@ $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always ''
$mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hierarchy', 'calendar', ...)
$id = GETPOSTINT('id');
$rowid = GETPOST('rowid', 'alpha');
// Load variable for pagination
$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
@ -83,8 +82,8 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen
// Default sort order (if not yet defined by previous GETPOST)
if (!$sortfield) {
reset($object->fields); // Reset is required to avoid key() to return null.
$sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition.
reset($object->fields); // Reset is required to avoid key() to return null.
$sortfield = "t.position"; // Set here default search field. By default 1st field in definition.
}
if (!$sortorder) {
$sortorder = "ASC";
@ -804,14 +803,11 @@ while ($i < $imaxinloop) {
$url .= '&limit='.((int) $limit);
}
if ($page) {
$url .= '&page='.urlencode((string) ($page));
}
if ($sortfield) {
$url .= '&sortfield='.urlencode($sortfield);
}
if ($sortorder) {
$url .= '&page='.urlencode($sortorder);
$url .= '&page='.urlencode((string) $page);
}
$url .= '&sortfield='.urlencode((string) $sortfield);
$url .= '&page='.urlencode((string) $sortorder);
print '<a class="editfielda reposition marginrightonly marginleftonly" href="'.$url.'&action=edit&token='.newToken().'&rowid='.$obj->rowid.'">'.img_edit().'</a>';
//print ' &nbsp; ';
print '<a class=" marginrightonly marginleftonly" href="'.$url.'&action=delete&token='.newToken().'">'.img_delete().'</a> &nbsp; ';
@ -828,7 +824,6 @@ while ($i < $imaxinloop) {
}
}
print '</tr>'."\n";
}

View file

@ -37,10 +37,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/openid_connect.lib.php';
* @var User $user
*/
$langs->load("admin");
$langs->load("openidconnect");
$langs->loadLangs(["admin", "openidconnect"]);
if (!$user->admin) accessforbidden();
if (!$user->admin) {
accessforbidden();
}
$action = GETPOST('action', 'alpha');
@ -143,8 +144,6 @@ print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="set">';
$var=true;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameters").'</td>'."\n";
@ -153,8 +152,7 @@ print '<td align="right">'.$langs->trans("Value").'</td>'."\n";
print "</tr>\n";
// MAIN_AUTHENTICATION_OIDC_LOGIN_CLAIM
$var = !$var;
print '<tr ' . $bc[$var] . '>' . "\n";
print '<tr class="oddeven">' . "\n";
print '<td>'.$langs->trans("MainAuthenticationOidcLoginClaimName").'</td>'."\n";
print '<td>'.$langs->trans("MainAuthenticationOidcLoginClaimDesc").'</td>'."\n";
print '<td align="right">' . "\n";
@ -162,8 +160,7 @@ print '<input name="MAIN_AUTHENTICATION_OIDC_LOGIN_CLAIM" id="MAIN_AUTHENTICATIO
print '</td></tr>' . "\n";
// MAIN_AUTHENTICATION_OIDC_CLIENT_ID
$var = !$var;
print '<tr ' . $bc[$var] . '>' . "\n";
print '<tr class="oddeven">' . "\n";
print '<td>'.$langs->trans("MainAuthenticationOidcClientIdName").'</td>'."\n";
print '<td>'.$langs->trans("MainAuthenticationOidcClientIdDesc").'</td>'."\n";
print '<td align="right">' . "\n";
@ -171,8 +168,7 @@ print '<input name="MAIN_AUTHENTICATION_OIDC_CLIENT_ID" id="MAIN_AUTHENTICATION_
print '</td></tr>' . "\n";
// MAIN_AUTHENTICATION_OIDC_CLIENT_SECRET
$var = !$var;
print '<tr ' . $bc[$var] . '>' . "\n";
print '<tr class="oddeven">' . "\n";
print '<td>'.$langs->trans("MainAuthenticationOidcClientSecretName").'</td>'."\n";
print '<td>'.$langs->trans("MainAuthenticationOidcClientSecretDesc").'</td>'."\n";
print '<td align="right">' . "\n";
@ -180,8 +176,7 @@ print '<input type="password" name="MAIN_AUTHENTICATION_OIDC_CLIENT_SECRET" id="
print '</td></tr>' . "\n";
// MAIN_AUTHENTICATION_OIDC_SCOPES
$var = !$var;
print '<tr ' . $bc[$var] . '>' . "\n";
print '<tr class="oddeven">' . "\n";
print '<td>'.$langs->trans("MainAuthenticationOidcScopesName").'</td>'."\n";
print '<td>'.$langs->trans("MainAuthenticationOidcScopesDesc").'</td>'."\n";
print '<td align="right">' . "\n";
@ -189,8 +184,7 @@ print '<input name="MAIN_AUTHENTICATION_OIDC_SCOPES" id="MAIN_AUTHENTICATION_OID
print '</td></tr>' . "\n";
// MAIN_AUTHENTICATION_OIDC_AUTHORIZE_URL
$var = !$var;
print '<tr ' . $bc[$var] . '>' . "\n";
print '<tr class="oddeven">' . "\n";
print '<td>'.$langs->trans("MainAuthenticationOidcAuthorizeUrlName").'</td>'."\n";
print '<td>'.$langs->trans("MainAuthenticationOidcAuthorizeUrlDesc").'</td>'."\n";
print '<td align="right">' . "\n";
@ -198,8 +192,7 @@ print '<input name="MAIN_AUTHENTICATION_OIDC_AUTHORIZE_URL" id="MAIN_AUTHENTICAT
print '</td></tr>' . "\n";
// MAIN_AUTHENTICATION_OIDC_TOKEN_URL
$var = !$var;
print '<tr ' . $bc[$var] . '>' . "\n";
print '<tr class="oddeven">' . "\n";
print '<td>'.$langs->trans("MainAuthenticationOidcTokenUrlName").'</td>'."\n";
print '<td>'.$langs->trans("MainAuthenticationOidcTokenUrlDesc").'</td>'."\n";
print '<td align="right">' . "\n";
@ -207,8 +200,7 @@ print '<input name="MAIN_AUTHENTICATION_OIDC_TOKEN_URL" id="MAIN_AUTHENTICATION_
print '</td></tr>' . "\n";
// MAIN_AUTHENTICATION_OIDC_USERINFO_URL
$var = !$var;
print '<tr ' . $bc[$var] . '>' . "\n";
print '<tr class="oddeven">' . "\n";
print '<td>'.$langs->trans("MainAuthenticationOidcUserinfoUrlName").'</td>'."\n";
print '<td>'.$langs->trans("MainAuthenticationOidcUserinfoUrlDesc").'</td>'."\n";
print '<td align="right">' . "\n";
@ -216,8 +208,7 @@ print '<input name="MAIN_AUTHENTICATION_OIDC_USERINFO_URL" id="MAIN_AUTHENTICATI
print '</td></tr>' . "\n";
// MAIN_AUTHENTICATION_OIDC_LOGOUT_URL
$var = !$var;
print '<tr ' . $bc[$var] . '>' . "\n";
print '<tr class="oddeven">' . "\n";
print '<td>'.$langs->trans("MainAuthenticationOidcLogoutUrlName").'</td>'."\n";
print '<td>'.$langs->trans("MainAuthenticationOidcLogoutUrlDesc").'</td>'."\n";
print '<td align="right">' . "\n";
@ -225,8 +216,7 @@ print '<input name="MAIN_AUTHENTICATION_OIDC_LOGOUT_URL" id="MAIN_AUTHENTICATION
print '</td></tr>' . "\n";
// REDIRECT_URL
$var = !$var;
print '<tr ' . $bc[$var] . '>' . "\n";
print '<tr class="oddeven">' . "\n";
print '<td>'.$langs->trans("MainAuthenticationOidcRedirectUrlName").'</td>'."\n";
print '<td>'.$langs->trans("MainAuthenticationOidcRedirectUrlDesc").'</td>'."\n";
print '<td align="right">' . "\n";
@ -234,8 +224,7 @@ print '<input class="minwidth300" value="'.dol_escape_htmltag(openid_connect_get
print '</td></tr>' . "\n";
// LOGOUT_URL
$var = !$var;
print '<tr ' . $bc[$var] . '>' . "\n";
print '<tr class="oddeven">' . "\n";
print '<td>'.$langs->trans("MainAuthenticationOidcLogoutRedirectUrlName").'</td>'."\n";
print '<td>'.$langs->trans("MainAuthenticationOidcLogoutRedirectUrlDesc").'</td>'."\n";
print '<td align="right">' . "\n";
@ -256,3 +245,4 @@ print '<br>';
print dol_get_fiche_end();
llxFooter();
$db->close();

View file

@ -76,6 +76,7 @@ if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) {
$res3 = 1;
$res4 = 1;
$res5 = 1;
$res6 = 1;
if (GETPOSTISSET('MAIN_APPLICATION_TITLE')) {
$res1 = dolibarr_set_const($db, "MAIN_APPLICATION_TITLE", GETPOST("MAIN_APPLICATION_TITLE", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
}
@ -91,7 +92,10 @@ if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) {
if (GETPOSTISSET('MAIN_SECURITY_MAX_ATTACHMENT_ON_FORMS')) {
$res5 = dolibarr_set_const($db, "MAIN_SECURITY_MAX_ATTACHMENT_ON_FORMS", GETPOST("MAIN_SECURITY_MAX_ATTACHMENT_ON_FORMS", 'alphanohtml'), 'int', 0, '', $conf->entity);
}
if ($res1 && $res2 && $res3 && $res4 && $res5) {
if (GETPOSTISSET('MAIN_SECURITY_MAX_NUMBER_FAILED_AUTH')) {
$res6 = dolibarr_set_const($db, "MAIN_SECURITY_MAX_NUMBER_FAILED_AUTH", GETPOST("MAIN_SECURITY_MAX_NUMBER_FAILED_AUTH", 'alphanohtml'), 'int', 0, '', $conf->entity);
}
if ($res1 && $res2 && $res3 && $res4 && $res5 && $res6) {
setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
}
}

View file

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2007-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
/* Copyright (C) 2007-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2020-2024 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -83,10 +83,10 @@ if ($action == 'send' && !$cancel) {
}
$sendto = GETPOST("sendto", 'alphanohtml');
$body = GETPOST('message', 'alphanohtml');
$deliveryreceipt = GETPOST("deliveryreceipt", 'alphanohtml');
$deferred = GETPOST('deferred', 'alphanohtml');
$priority = GETPOST('priority', 'alphanohtml');
$class = GETPOST('class', 'alphanohtml');
$deliveryreceipt = GETPOSTINT("deliveryreceipt");
$deferred = GETPOSTINT('deferred');
$priority = GETPOSTINT('priority');
$class = GETPOSTINT('class');
$errors_to = GETPOST("errorstosms", 'alphanohtml');
// Create form object

View file

@ -371,7 +371,7 @@ print "</td>\n</tr>\n";
$found++;
if (isModEnabled("reception")) {
print '<!-- STOCK_CALCULATE_ON_RECEPTION_CLOSE -->';
print '<!-- STOCK_CALCULATE_ON_RECEPTION -->';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("StockOnReception").'</td>';
print '<td class="right">';
@ -386,7 +386,7 @@ if (isModEnabled("reception")) {
print "</td>\n</tr>\n";
$found++;
print '<!-- STOCK_CALCULATE_ON_RECEPTION_CLOSE -->';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("StockOnReceptionOnClosing").'</td>';
print '<td class="right">';

View file

@ -38,6 +38,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/events.class.php';
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*
* @var string[] $arrayofstreamtodisable // $arrayofstreamtodisable is defined into filefunc.inc.php
* @var string $conffile // $conffile is defined into filefunc.inc.php
*/
// Load translation files required by the page

View file

@ -132,7 +132,7 @@ if (empty($reshook)) {
// Action dispose object
if ($action == 'confirm_disposal' && $confirm == 'yes' && $permissiontoadd) {
$object->disposal_date = dol_mktime(12, 0, 0, GETPOSTINT('disposal_datemonth'), GETPOSTINT('disposal_dateday'), GETPOSTINT('disposal_dateyear')); // for date without hour, we use gmt
$object->disposal_date = dol_mktime(0, 0, 0, GETPOSTINT('disposal_datemonth'), GETPOSTINT('disposal_dateday'), GETPOSTINT('disposal_dateyear'), 'gmt'); // for date without hour, we use gmt
$object->disposal_amount_ht = GETPOSTINT('disposal_amount');
$object->fk_disposal_type = GETPOSTINT('fk_disposal_type');
$disposal_invoice_id = GETPOSTINT('disposal_invoice_id');
@ -273,7 +273,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Disposal
$langs->load('bills');
$disposal_date = dol_mktime(12, 0, 0, GETPOSTINT('disposal_datemonth'), GETPOSTINT('disposal_dateday'), GETPOSTINT('disposal_dateyear')); // for date without hour, we use gmt
$disposal_date = dol_mktime(0, 0, 0, GETPOSTINT('disposal_datemonth'), GETPOSTINT('disposal_dateday'), GETPOSTINT('disposal_dateyear'), 'gmt'); // for date without hour, we use gmt
$disposal_amount = GETPOSTINT('disposal_amount');
$fk_disposal_type = GETPOSTINT('fk_disposal_type');
$disposal_invoice_id = GETPOSTINT('disposal_invoice_id');

View file

@ -262,7 +262,7 @@ class AssetDepreciationOptions extends CommonObject
if (in_array($field_info['type'], array('text', 'html'))) {
$value = GETPOST($html_name, 'restricthtml');
} elseif ($field_info['type'] == 'date') {
$value = dol_mktime(12, 0, 0, GETPOSTINT($html_name . 'month'), GETPOSTINT($html_name . 'day'), GETPOSTINT($html_name . 'year')); // for date without hour, we use gmt
$value = dol_mktime(0, 0, 0, GETPOSTINT($html_name . 'month'), GETPOSTINT($html_name . 'day'), GETPOSTINT($html_name . 'year'), 'gmt'); // for date without hour, we use gmt
} elseif ($field_info['type'] == 'datetime') {
$value = dol_mktime(GETPOSTINT($html_name . 'hour'), GETPOSTINT($html_name . 'min'), GETPOSTINT($html_name . 'sec'), GETPOSTINT($html_name . 'month'), GETPOSTINT($html_name . 'day'), GETPOSTINT($html_name . 'year'), 'tzuserrel');
} elseif ($field_info['type'] == 'duration') {

View file

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2021 Open-Dsi <support@open-dsi.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
/* Copyright (C) 2021 Open-Dsi <support@open-dsi.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -30,6 +30,7 @@
* @var Form $form
* @var HookManager $hookmanager
* @var AssetDepreciationOptions $assetdepreciationoptions
* @var Translate $langs
*/
'
@phan-var-force ?Form $form

View file

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2021 Open-Dsi <support@open-dsi.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
/* Copyright (C) 2021 Open-Dsi <support@open-dsi.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -27,8 +27,13 @@
*/
/**
* @var AssetDepreciationOptions $assetdepreciationoptions
* @var DoliDB $db
* @var Form $form
* @var HookManager $hookmanager
* @var Translate $langs
*
* @var string $action
*/
// Protection to avoid direct call of template

View file

@ -80,7 +80,7 @@ $search_end = -1;
if (GETPOST('search_endyear') != '') {
$search_end = dol_mktime(23, 59, 59, $search_endmonth, $search_endday, $search_endyear);
}
$search_code = GETPOST('search_code', 'alpha');
$search_code = GETPOST('search_code', 'array:alpha');
$search_ref = GETPOST('search_ref', 'alpha');
$search_amount = GETPOST('search_amount', 'alpha');
@ -138,7 +138,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_fk_user = '';
$search_start = -1;
$search_end = -1;
$search_code = '';
$search_code = array();
$search_ref = '';
$search_amount = '';
$search_showonlyerrors = 0;
@ -496,15 +496,13 @@ print '</td>';
// Actions code
print '<td class="liste_titre">';
print $form->selectarray('search_code', $block_static->trackedevents, $search_code, 1, 0, 0, '', 1, 0, 0, 'ASC', 'maxwidth150', 1);
//print $form->selectarray('search_code', $block_static->trackedevents, $search_code, 1, 0, 0, '', 1, 0, 0, 'ASC', 'maxwidth150', 1);
print $form->multiselectarray('search_code', $block_static->trackedevents, $search_code, 0, 0, 'maxwidth150', 1);
print '</td>';
// Ref
print '<td class="liste_titre"><input type="text" class="maxwidth50" name="search_ref" value="'.dol_escape_htmltag($search_ref).'"></td>';
// Link to ref
print '<td class="liste_titre"></td>';
// Amount
print '<td class="liste_titre right"><input type="text" class="maxwidth50" name="search_amount" value="'.dol_escape_htmltag($search_amount).'"></td>';
@ -521,6 +519,9 @@ print $form->selectarray('search_showonlyerrors', $array, $search_showonlyerrors
print '</td>';
// Status note
//print '<td class="liste_titre"></td>';
// Link to original ref into business software
print '<td class="liste_titre"></td>';
// Action column
@ -543,12 +544,12 @@ print getTitleFieldOfList($langs->trans('Date'), 0, $_SERVER["PHP_SELF"], 'date_
print getTitleFieldOfList($langs->trans('Author'), 0, $_SERVER["PHP_SELF"], 'user_fullname', '', $param, '', $sortfield, $sortorder, '')."\n";
print getTitleFieldOfList($langs->trans('Action'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, '')."\n";
print getTitleFieldOfList($langs->trans('Ref'), 0, $_SERVER["PHP_SELF"], 'ref_object', '', $param, '', $sortfield, $sortorder, '')."\n";
print getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, '')."\n";
print getTitleFieldOfList($langs->trans('Amount'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right ')."\n";
print getTitleFieldOfList($langs->trans('DataOfArchivedEvent'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ', 0, $langs->trans('DataOfArchivedEventHelp').'<br>'.$langs->trans('DataOfArchivedEventHelp2'), 1)."\n";
print getTitleFieldOfList($langs->trans('DataOfArchivedEvent'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ', 0, $langs->trans('DataOfArchivedEventHelp'), 1)."\n";
print getTitleFieldOfList($langs->trans('Fingerprint'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, '')."\n";
print getTitleFieldOfList($langs->trans('Status'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ')."\n";
print getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ')."\n";
print getTitleFieldOfList($form->textwithpicto($langs->trans('Status'), $langs->trans('DataOfArchivedEventHelp2')), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ')."\n";
//print getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ')."\n";
print getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, '')."\n";
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print getTitleFieldOfList('<span id="blockchainstatus"></span>', 0, $_SERVER["PHP_SELF"], '', '', $param, 'class="center"', $sortfield, $sortorder, '')."\n";
@ -633,12 +634,6 @@ if (is_array($blocks)) {
print dol_escape_htmltag($block->ref_object);
print '</td>';
// Link to source object
print '<td class="tdoverflowmax150"'.(preg_match('/<a/', $object_link) ? '' : 'title="'.dol_escape_htmltag(dol_string_nohtmltag($object_link.($object_link_title ? ' - '.$object_link_title : ''))).'"').'>';
print '<!-- object_link -->'; // $object_link can be a '<a href' link or a text
print $object_link;
print '</td>';
// Amount
print '<td class="right nowraponall">'.price($block->amounts).'</td>';
@ -666,14 +661,18 @@ if (is_array($blocks)) {
} else {
print '<span class="badge badge-status4 badge-status" title="'.$langs->trans('OkCheckFingerprintValidity').'">OK</span>';
}
print '</td>';
//print '</td>';
// Note
print '<td class="center">';
//print '<td class="center">';
if (!$checkresult[$block->id] || ($loweridinerror && $block->id >= $loweridinerror)) { // If error
if ($checkresult[$block->id]) {
print $form->textwithpicto('', $langs->trans('OkCheckFingerprintValidityButChainIsKo'));
} else {
//print $form->textwithpicto('', $langs->trans('KoCheckFingerprintValidity'));
}
} else {
//print $form->textwithpicto('', $langs->trans('DataOfArchivedEventHelp2'));
}
if (getDolGlobalString('BLOCKEDLOG_USE_REMOTE_AUTHORITY') && getDolGlobalString('BLOCKEDLOG_AUTHORITY_URL')) {
@ -681,6 +680,12 @@ if (is_array($blocks)) {
}
print '</td>';
// Link to source object
print '<td class="tdoverflowmax150"'.(preg_match('/<a/', $object_link) ? '' : 'title="'.dol_escape_htmltag(dol_string_nohtmltag($object_link.($object_link_title ? ' - '.$object_link_title : ''))).'"').'>';
print '<!-- object_link -->'; // $object_link can be a '<a href' link or a text
print $object_link;
print '</td>';
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre">';

View file

@ -169,7 +169,7 @@ class BlockedLog
// Customer Invoice/Facture / Payment
if (isModEnabled('invoice')) {
$this->trackedevents['BILL_VALIDATE'] = 'logBILL_VALIDATE';
$this->trackedevents['BILL_DELETE'] = 'logBILL_DELETE';
//$this->trackedevents['BILL_UPDATE'] = 'logBILL_UPDATE';
$this->trackedevents['BILL_SENTBYMAIL'] = 'logBILL_SENTBYMAIL';
$this->trackedevents['DOC_DOWNLOAD'] = 'BlockedLogBillDownload';
$this->trackedevents['DOC_PREVIEW'] = 'BlockedLogBillPreview';
@ -532,7 +532,8 @@ class BlockedLog
continue; // Discard some properties
}
if (!in_array($key, array(
'ref', 'ref_client', 'ref_supplier', 'date', 'datef', 'datev', 'type', 'total_ht', 'total_tva', 'total_ttc', 'localtax1', 'localtax2', 'revenuestamp', 'datepointoftax', 'note_public', 'lines'
'ref', 'ref_client', 'ref_supplier', 'date', 'datef', 'datev', 'type', 'total_ht', 'total_tva', 'total_ttc', 'localtax1', 'localtax2', 'revenuestamp', 'datepointoftax', 'note_public', 'lines',
'module_source', 'pos_source'
))) {
continue; // Discard if not into a dedicated list
}
@ -542,7 +543,13 @@ class BlockedLog
$lineid++;
foreach ($tmpline as $keyline => $valueline) {
if (!in_array($keyline, array(
'ref', 'multicurrency_code', 'multicurrency_total_ht', 'multicurrency_total_tva', 'multicurrency_total_ttc', 'qty', 'product_type', 'product_label', 'vat_src_code', 'tva_tx', 'info_bits', 'localtax1_tx', 'localtax2_tx', 'total_ht', 'total_tva', 'total_ttc', 'total_localtax1', 'total_localtax2'
'ref', 'product_type', 'product_label',
'qty',
'subprice',
'vat_src_code', 'tva_tx', 'localtax1_tx', 'localtax2_tx',
'total_ht', 'total_tva', 'total_ttc', 'total_localtax1', 'total_localtax2',
'multicurrency_code', 'multicurrency_total_ht', 'multicurrency_total_tva', 'multicurrency_total_ttc',
'info_bits', 'special_code',
))) {
continue; // Discard if not into a dedicated list
}
@ -846,12 +853,12 @@ class BlockedLog
*/
public function dolEncodeBlockedData($data, $mode = 0)
{
$aaa = '';
try {
$aaa = json_encode($data);
} catch (Exception $e) {
//print $e->getErrs);
// print $e->getErrs);
}
//var_dump($aaa);
return $aaa;
}
@ -866,12 +873,12 @@ class BlockedLog
*/
public function dolDecodeBlockedData($data, $mode = 0)
{
$aaa = null;
try {
$aaa = (object) jsonOrUnserialize($data);
} catch (Exception $e) {
//print $e->getErrs);
// print $e->getErrs);
}
//var_dump($aaa);
return $aaa;
}
@ -901,12 +908,10 @@ class BlockedLog
*/
public function create($user, $forcesignature = '')
{
global $conf, $langs, $hookmanager;
global $conf, $langs;
$langs->load('blockedlog');
$error = 0;
// Clean data
$this->amounts = (float) $this->amounts;
@ -941,9 +946,9 @@ class BlockedLog
$this->db->begin();
$previoushash = $this->getPreviousHash(1, 0); // This get last record and lock database until insert is done
$previoushash = $this->getPreviousHash(1, 0); // This get last record and lock database until insert is done and transaction closed
$keyforsignature = $this->buildKeyForSignature();
$keyforsignature = $this->buildKeyForSignature(); // All the information for the has (meta data + data saved)
include_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php';
@ -1142,18 +1147,18 @@ class BlockedLog
/**
* Return array of log objects (with criteria)
*
* @param string $element element to search
* @param int $fk_object id of object to search
* @param int<0,max> $limit max number of element, 0 for all
* @param string $sortfield sort field
* @param string $sortorder sort order
* @param int $search_fk_user id of user(s)
* @param int $search_start start time limit
* @param int $search_end end time limit
* @param string $search_ref search ref
* @param string $search_amount search amount
* @param string $search_code search code
* @return BlockedLog[]|int<-2,-1> Array of object log or <0 if error
* @param string $element element to search
* @param int $fk_object id of object to search
* @param int<0,max> $limit max number of element, 0 for all
* @param string $sortfield sort field
* @param string $sortorder sort order
* @param int $search_fk_user id of user(s)
* @param int $search_start start time limit
* @param int $search_end end time limit
* @param string $search_ref search ref
* @param string $search_amount search amount
* @param string|string[] $search_code search code
* @return BlockedLog[]|int<-2,-1> Array of object log or <0 if error
*/
public function getLog($element, $fk_object, $limit = 0, $sortfield = '', $sortorder = '', $search_fk_user = -1, $search_start = -1, $search_end = -1, $search_ref = '', $search_amount = '', $search_code = '')
{
@ -1195,8 +1200,14 @@ class BlockedLog
if ($search_amount != '') {
$sql .= natural_search("amounts", $search_amount, 1);
}
if ($search_code != '' && $search_code != '-1') {
$sql .= natural_search("action", $search_code, 3);
if (is_array($search_code)) {
if (!empty($search_code)) {
$sql .= natural_search("action", implode(',', $search_code), 3);
}
} else {
if ($search_code != '' && $search_code != '-1') {
$sql .= natural_search("action", $search_code, 3);
}
}
$sql .= $this->db->order($sortfield, $sortorder);

View file

@ -1,13 +1,13 @@
<?php
/* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2010-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2024 Vincent Maury <vmaury@timgroup.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
/* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2010-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 Vincent Maury <vmaury@timgroup.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -34,7 +34,19 @@
*/
require_once DOL_DOCUMENT_ROOT."/product/class/html.formproduct.class.php";
/**
* @var BOMLine $line
* @var CommonObject $this
* @var CommonObject $object
* @var HookManager $hookmanager
* @var Societe $buyer
* @var Societe $seller
* @var Translate $langs
*
* @var string $action
* @var int $i
* @var bool $var
*/
// Protection to avoid direct call of template
if (empty($object) || !is_object($object)) {

View file

@ -45,6 +45,7 @@
*
* @var int $i
* @var int $num
* @var string $action
*/
'
@phan-var-force CommonObjectLine $line

View file

@ -1546,8 +1546,8 @@ if ($action == 'create') {
$listofuserid[$firstelem['id']]['transparency'] = (GETPOSTISSET('transparency') ? GETPOST('transparency', 'alpha') : 0); // 0 by default when refreshing
}
}
print '<div class="assignedtouser">';
print $form->select_dolusers_forevent(($action == 'create' ? 'add' : 'update'), 'assignedtouser', 1, array(), 0, '', array(), 0, 0, 0, 'AND u.statut != 0', 1, $listofuserid, $listofcontactid, $listofotherid);
print '<!-- list of user to assign --><div class="assignedtouser">';
print $form->select_dolusers_forevent(($action == 'create' ? 'add' : 'update'), 'assignedtouser', 1, array(), 0, '', array(), 0, 0, 0, 'u.statut:<>:0', 1, $listofuserid, $listofcontactid, $listofotherid);
print '</div>';
print '</td></tr>';
@ -1811,7 +1811,7 @@ if ($action == 'create') {
print "\n".'<script type="text/javascript">';
print '$(document).ready(function () {
const reminderDefaultEventTypes = '.$reminderDefaultEventTypes.';
const reminderDefaultEventTypes = \''.dol_escape_js($reminderDefaultEventTypes).'\';
$("#actioncode").change(function(){
var selected_event_type = $("#actioncode option:selected").val();
@ -1820,9 +1820,9 @@ if ($action == 'create') {
$("#addreminder").prop("checked", true);
// Set period with default reminder period
$("[name=\"offsetvalue\"]").val("' . $reminderDefaultOffset . '");
$("[name=\"offsetvalue\"]").val(\'' . dol_escape_js((string) $reminderDefaultOffset) . '\');
$("#select_offsetunittype_duration").select2("destroy");
$("#select_offsetunittype_duration").val("'.$reminderDefaultUnit.'");
$("#select_offsetunittype_duration").val(\''.dol_escape_js($reminderDefaultUnit).'\');
$("#select_offsetunittype_duration").select2();
$("#selectremindertype").select2("destroy");
@ -1832,7 +1832,7 @@ if ($action == 'create') {
// Set default reminder mail model
$("#select_actioncommsendmodel_mail").closest("tr").show();
$("#select_actioncommsendmodel_mail").select2("destroy");
$("#select_actioncommsendmodel_mail").val("'.$reminderDefaultEmailModel.'");
$("#select_actioncommsendmodel_mail").val(\''.dol_escape_js((string) $reminderDefaultEmailModel).'\');
$("#select_actioncommsendmodel_mail").select2();
}
});
@ -1955,6 +1955,8 @@ if ($id > 0) {
}
if ($action == 'edit') {
$caneditdateorowner = ($object->type != 'systemauto');
if (!empty($conf->use_javascript_ajax)) {
print "\n".'<script type="text/javascript">';
print '$(document).ready(function () {
@ -1972,7 +1974,9 @@ if ($id > 0) {
$(".fulldayendmin").prop("disabled", true).val("59");
}
}
setdatefields();
'.($caneditdateorowner ? ' setdatefields();' : '').'
$("#fullday").change(function() {
setdatefields();
});
@ -2052,7 +2056,8 @@ if ($id > 0) {
print '<tr><td'.(!getDolGlobalString('AGENDA_USE_EVENT_TYPE') ? ' class="fieldrequired titlefieldcreate"' : '').'>'.$langs->trans("Title").'</td><td colspan="3"><input type="text" name="label" class="soixantepercent" value="'.$object->label.'"></td></tr>';
// Full day event
print '<tr><td><span class="fieldrequired">'.$langs->trans("Date").'</span></td><td colspan="3" class="valignmiddle height30 small"><input type="checkbox" id="fullday" name="fullday" '.($object->fulldayevent ? ' checked' : '').'>';
print '<tr><td><span class="fieldrequired">'.$langs->trans("Date").'</span></td><td colspan="3" class="valignmiddle height30 small">';
print '<input '.($caneditdateorowner ? '' : ' disabled').' type="checkbox" id="fullday" name="fullday" '.($object->fulldayevent ? ' checked' : '').'>';
print '<label for="fullday">'.$langs->trans("EventOnFullDay").'</label>';
// // Recurring event
@ -2123,9 +2128,9 @@ if ($id > 0) {
*/
print '</td><td td colspan="3">';
$tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT');
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 0, "action", 1, 2, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 0, "action", 1, 2, ($caneditdateorowner ? 0 : 1), 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
print ' <span class="hideonsmartphone">&nbsp; &nbsp; - &nbsp; &nbsp;</span> ';
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 2, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 2, ($caneditdateorowner ? 0 : 1), 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
print '</td></tr>';
print '<tr><td class="">&nbsp;</td><td></td></tr>';
@ -2164,7 +2169,7 @@ if ($id > 0) {
print '<tr><td class="tdtop nowrap fieldrequired">'.$langs->trans("ActionAssignedTo").'</td><td colspan="3">';
print '<div class="assignedtouser">';
print $form->select_dolusers_forevent(($action == 'create' ? 'add' : 'update'), 'assignedtouser', 1, array(), 0, '', array(), 0, 0, 0, 'AND u.statut != 0', 1, $listofuserid, $listofcontactid, $listofotherid);
print $form->select_dolusers_forevent(($action == 'create' ? 'add' : 'update'), 'assignedtouser', 1, array(), 0, '', array(), 0, 0, 0, 'u.statut:<>:0', 1, $listofuserid, $listofcontactid, $listofotherid, $caneditdateorowner);
print '</div>';
/*if (in_array($user->id,array_keys($listofuserid)))
{
@ -2414,7 +2419,7 @@ if ($id > 0) {
print "\n".'<script type="text/javascript">';
print '$(document).ready(function () {
const reminderDefaultEventTypes = '.$reminderDefaultEventTypes.';
const reminderDefaultEventTypes = \''.dol_escape_js($reminderDefaultEventTypes).'\';
$("#actioncode").change(function(){
var selected_event_type = $("#actioncode option:selected").val();
@ -2423,9 +2428,9 @@ if ($id > 0) {
$("#addreminder").prop("checked", true);
// Set period with default reminder period
$("#offsetvalue").val('.$reminderDefaultOffset.');
$("#offsetvalue").val(\''.dol_escape_js($reminderDefaultOffset).'\');
$("#select_offsetunittype_duration").select2("destroy");
$("#select_offsetunittype_duration").val("'.$reminderDefaultUnit.'");
$("#select_offsetunittype_duration").val(\''.dol_escape_js($reminderDefaultUnit).'\');
$("#select_offsetunittype_duration").select2();
$("#selectremindertype").select2("destroy");
@ -2435,7 +2440,7 @@ if ($id > 0) {
// Set default reminder mail model
$("#select_actioncommsendmodel_mail").closest("tr").show();
$("#select_actioncommsendmodel_mail").select2("destroy");
$("#select_actioncommsendmodel_mail").val("'.$reminderDefaultEmailModel.'");
$("#select_actioncommsendmodel_mail").val(\''.dol_escape_js($reminderDefaultEmailModel).'\');
$("#select_actioncommsendmodel_mail").select2();
}
});

View file

@ -569,12 +569,12 @@ $viewmode .= '<span class="marginrightonly"></span>'; // To add a space before t
$newparam = '';
$newcardbutton = '';
if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')) {
$tmpforcreatebutton = dol_getdate(dol_now(), true);
$tmpforcreatebutton = dol_getdate(dol_now('tzuserrel'), true);
$newparam .= '&month='.((int) $month).'&year='.((int) $tmpforcreatebutton['year']).'&mode='.urlencode($mode);
//$param='month='.$monthshown.'&year='.$year;
$hourminsec = dol_print_date(dol_mktime(10, 0, 0, 1, 1, 1970, 'gmt'), '%H', 'gmt').'0000'; // Set $hourminsec to '100000' to auto set hour to 10:00 at creation
//$hourminsec = dol_print_date(dol_mktime(10, 0, 0, 1, 1, 1970, 'gmt'), '%H', 'gmt').'0000'; // Set $hourminsec to '100000' to auto set hour to 10:00 at creation
$urltocreateaction = DOL_URL_ROOT.'/comm/action/card.php?action=create';
$urltocreateaction .= '&apyear='.$tmpforcreatebutton['year'].'&apmonth='.$tmpforcreatebutton['mon'].'&apday='.$tmpforcreatebutton['mday'].'&aphour='.$tmpforcreatebutton['hours'].'&apmin='.$tmpforcreatebutton['minutes'];

View file

@ -736,13 +736,13 @@ $viewmode .= '</div>';
$viewmode .= '<span class="marginrightonly"></span>';
$tmpforcreatebutton = dol_getdate(dol_now(), true);
$tmpforcreatebutton = dol_getdate(dol_now('tzuserrel'), true);
$newparam = '&month='.str_pad((string) $month, 2, "0", STR_PAD_LEFT).'&year='.$tmpforcreatebutton['year'];
$url = DOL_URL_ROOT.'/comm/action/card.php?action=create';
$url .= '&apyear='.$tmpforcreatebutton['year'].'&apmonth='.$tmpforcreatebutton['mon'].'&apday='.$tmpforcreatebutton['mday'].'&aphour='.$tmpforcreatebutton['hours'].'&apmin='.$tmpforcreatebutton['minutes'];
$url .= '&apyear='.$tmpforcreatebutton['year'].'&apmonth='.$tmpforcreatebutton['mon'].'&apday='.$tmpforcreatebutton['mday'];
$url .= '&aphour='.$tmpforcreatebutton['hours'].'&apmin='.$tmpforcreatebutton['minutes'];
$url .= '&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam ? '?'.$newparam : ''));
$newcardbutton = dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', $url, '', (int) ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')));

View file

@ -487,7 +487,7 @@ $viewmode .= '<span class="marginrightonly"></span>';
$newparam = '';
$newcardbutton = '';
if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')) {
$tmpforcreatebutton = dol_getdate(dol_now(), true);
$tmpforcreatebutton = dol_getdate(dol_now('tzuserrel'), true);
$newparam .= '&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$tmpforcreatebutton['year'];

View file

@ -492,7 +492,7 @@ $viewmode .= '<span class="marginrightonly"></span>';
$newparam = '';
$newcardbutton = '';
if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')) {
$tmpforcreatebutton = dol_getdate(dol_now(), true);
$tmpforcreatebutton = dol_getdate(dol_now('tzuserrel'), true);
$newparam .= '&month='.urlencode(str_pad((string) $month, 2, "0", STR_PAD_LEFT)).'&year='.((int) $tmpforcreatebutton['year']);
if ($begin_h !== '') {

View file

@ -1712,35 +1712,37 @@ if ($object->id > 0) {
}
// Add invoice
if ($user->socid == 0) {
if (isModEnabled('deplacement') && $object->status == 1) {
$langs->load("trips");
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/deplacement/card.php?socid='.$object->id.'&amp;action=create">'.$langs->trans("AddTrip").'</a></div>';
}
if (isModEnabled('deplacement') && $object->status == 1) {
$langs->load("trips");
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/deplacement/card.php?socid='.$object->id.'&amp;action=create">'.$langs->trans("AddTrip").'</a></div>';
}
if (isModEnabled('invoice') && $object->status == 1) {
if (!$user->hasRight('facture', 'creer')) {
$langs->load("bills");
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("NotAllowed")).'" href="#">'.$langs->trans("AddBill").'</a></div>';
if (isModEnabled('invoice') && $object->status == 1) {
if (!$user->hasRight('facture', 'creer')) {
$langs->load("bills");
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("NotAllowed")).'" href="#">'.$langs->trans("AddBill").'</a></div>';
} else {
$langs->loadLangs(array("orders", "bills"));
if ($object->client != 0 && $object->client != 2) {
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/card.php?action=create&socid='.$object->id.'">'.$langs->trans("AddBill").'</a></div>';
} else {
$langs->loadLangs(array("orders", "bills"));
if (isModEnabled('order')) {
if ($object->client != 0 && $object->client != 2) {
if (!empty($orders2invoice) && $orders2invoice > 0) {
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/commande/list.php?socid='.$object->id.'&search_billed=0&autoselectall=1">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>';
} else {
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("NoOrdersToInvoice")).'" href="#">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>';
}
} else {
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("ThirdPartyMustBeEditAsCustomer")).'" href="#">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>';
}
}
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("ThirdPartyMustBeEditAsCustomer")).'" href="#">'.$langs->trans("AddBill").'</a></div>';
}
}
}
if (isModEnabled('invoice') && $object->status == 1) {
if ($user->hasRight('facture', 'creer')) {
if (isModEnabled('order')) {
if ($object->client != 0 && $object->client != 2) {
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/card.php?action=create&socid='.$object->id.'">'.$langs->trans("AddBill").'</a></div>';
if (!empty($orders2invoice) && $orders2invoice > 0) {
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/commande/list.php?socid='.$object->id.'&search_billed=0&autoselectall=1">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>';
} else {
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("NoOrdersToInvoice")).'" href="#">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>';
}
} else {
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("ThirdPartyMustBeEditAsCustomer")).'" href="#">'.$langs->trans("AddBill").'</a></div>';
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("ThirdPartyMustBeEditAsCustomer")).'" href="#">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>';
}
}
}

View file

@ -323,7 +323,7 @@ class FormAdvTargetEmailing extends Form
}
}
if (!empty($InfoFieldList[1])) {
$sql .= " ORDER BY nom";
$sql .= $this->db->order($InfoFieldList[1]);
}
// $sql.= ' WHERE entity = '.$conf->entity;
@ -334,8 +334,10 @@ class FormAdvTargetEmailing extends Form
if ($num) {
while ($i < $num) {
$obj = $this->db->fetch_object($resql);
$fieldtoread = $InfoFieldList[1];
$labeltoshow = dol_trunc($obj->$fieldtoread, 90);
$options_array[$obj->rowid] = $labeltoshow;
$i++;
}
@ -401,6 +403,20 @@ class FormAdvTargetEmailing extends Form
global $conf, $langs;
$form = new Form($this->db);
foreach ($options_array as $okey => $val) {
if ((string) $okey == '') {
continue;
}
$valarray = explode('|', $val);
$val = $valarray[0];
if ($val) {
$options_array[$okey] = $langs->trans($val);
} else {
$options_array[$okey] = $val;
}
}
$return = $form->multiselectarray($htmlname, $options_array, $selected_array, 0, 0, '', 0, 295);
return $return;
}

View file

@ -1896,6 +1896,14 @@ if ($action == 'create') {
if ($element == 'project') {
$projectid = $originid;
// Fetch project and thirdparty
$project = new Project($db);
$project->fetch($projectid);
if ($project->socid > 0) {
$soc = new Societe($db);
$soc->fetch($project->socid);
}
} else {
// For compatibility
if ($element == 'order' || $element == 'commande') {
@ -1928,9 +1936,9 @@ if ($action == 'create') {
$soc = $objectsrc->thirdparty;
$cond_reglement_id = (!empty($objectsrc->cond_reglement_id) ? $objectsrc->cond_reglement_id : (!empty($soc->cond_reglement_id) ? $soc->cond_reglement_id : 0));
$mode_reglement_id = (!empty($objectsrc->mode_reglement_id) ? $objectsrc->mode_reglement_id : (!empty($soc->mode_reglement_id) ? $soc->mode_reglement_id : 0));
$warehouse_id = (!empty($objectsrc->warehouse_id) ? $objectsrc->warehouse_id : (!empty($soc->warehouse_id) ? $soc->warehouse_id : 0));
$cond_reglement_id = (!empty($objectsrc->cond_reglement_id) ? $objectsrc->cond_reglement_id : (!empty($soc->cond_reglement_id) ? $soc->cond_reglement_id : 0));
$mode_reglement_id = (!empty($objectsrc->mode_reglement_id) ? $objectsrc->mode_reglement_id : (!empty($soc->mode_reglement_id) ? $soc->mode_reglement_id : 0));
$warehouse_id = (!empty($objectsrc->warehouse_id) ? $objectsrc->warehouse_id : (!empty($soc->warehouse_id) ? $soc->warehouse_id : 0));
// Replicate extrafields
$objectsrc->fetch_optionals();
@ -1945,7 +1953,10 @@ if ($action == 'create') {
}
}
}
} else {
}
// Load default values from thirdparty
if (!empty($soc)) {
$cond_reglement_id = empty($soc->cond_reglement_id) ? $cond_reglement_id : $soc->cond_reglement_id;
$deposit_percent = empty($soc->deposit_percent) ? $deposit_percent : $soc->deposit_percent;
$mode_reglement_id = empty($soc->mode_reglement_id) ? $mode_reglement_id : $soc->mode_reglement_id;

View file

@ -154,6 +154,7 @@ $search_date_signature_start = dol_mktime(0, 0, 0, $search_date_signature_startm
$search_date_signature_end = dol_mktime(23, 59, 59, $search_date_signature_endmonth, $search_date_signature_endday, $search_date_signature_endyear);
$search_status = GETPOST('search_status', 'alpha');
$search_note_public = GETPOST('search_note_public', 'alpha');
$search_import_key = trim(GETPOST("search_import_key", "alpha"));
$search_option = GETPOST('search_option', 'alpha');
if ($search_option == 'late') {
@ -267,6 +268,7 @@ $arrayfields = array(
'p.date_cloture' => array('label' => "DateClosing", 'checked' => 0, 'position' => 500),
'p.note_public' => array('label' => 'NotePublic', 'checked' => 0, 'position' => 510, 'enabled' => (!getDolGlobalInt('MAIN_LIST_HIDE_PUBLIC_NOTES'))),
'p.note_private' => array('label' => 'NotePrivate', 'checked' => 0, 'position' => 511, 'enabled' => (!getDolGlobalInt('MAIN_LIST_HIDE_PRIVATE_NOTES'))),
'p.import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'position' => 999),
'p.fk_statut' => array('label' => "Status", 'checked' => 1, 'position' => 1000),
);
@ -396,7 +398,6 @@ if (empty($reshook)) {
$search_availability = '';
$search_option = '';
$search_status = '';
$search_categ_cus = 0;
$search_fk_cond_reglement = '';
$search_fk_shipping_method = '';
$search_fk_input_reason = '';
@ -409,8 +410,13 @@ if (empty($reshook)) {
$search_date_signature_endyear = '';
$search_date_signature_start = '';
$search_date_signature_end = '';
$search_import_key = '';
$search_categ_cus = 0;
$search_all = '';
$toselect = array();
$search_array_options = array();
$socid = 0;
}
@ -578,7 +584,7 @@ $sql .= " typent.code as typent_code,";
$sql .= " ava.rowid as availability,";
$sql .= " country.code as country_code,";
$sql .= " state.code_departement as state_code, state.nom as state_name,";
$sql .= ' p.rowid, p.entity as propal_entity, p.note_private, p.total_ht, p.total_tva, p.total_ttc, p.localtax1, p.localtax2, p.ref, p.ref_client, p.fk_statut as status, p.fk_user_author, p.datep as dp, p.fin_validite as dfv, p.date_livraison as ddelivery,';
$sql .= ' p.rowid, p.entity as propal_entity, p.note_private, p.total_ht, p.total_tva, p.total_ttc, p.localtax1, p.localtax2, p.ref, p.ref_client, p.fk_statut as status, p.import_key, p.fk_user_author, p.datep as dp, p.fin_validite as dfv, p.date_livraison as ddelivery,';
$sql .= ' p.fk_multicurrency, p.multicurrency_code, p.multicurrency_tx, p.multicurrency_total_ht, p.multicurrency_total_tva, p.multicurrency_total_ttc,';
$sql .= ' p.datec as date_creation, p.tms as date_modification, p.date_cloture as date_cloture,';
$sql .= ' p.date_signature as dsignature,';
@ -753,6 +759,9 @@ if ($search_date_signature_end) {
if ($search_note_public) {
$sql .= " AND p.note_public LIKE '%".$db->escape($db->escapeforlike($search_note_public))."%'";
}
if ($search_import_key) {
$sql .= natural_search("s.import_key", $search_import_key);
}
// Search on user
if ($search_user > 0) {
$sql .= " AND EXISTS (";
@ -921,6 +930,12 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.((int) $limit);
}
if ($optioncss != '') {
$param .= '&optioncss='.urlencode($optioncss);
}
if ($socid > 0) {
$param .= '&socid='.urlencode((string) ($socid));
}
if ($search_all) {
$param .= '&search_all='.urlencode($search_all);
}
@ -1026,12 +1041,6 @@ if ($search_town) {
if ($search_zip) {
$param .= '&search_zip='.urlencode($search_zip);
}
if ($socid > 0) {
$param .= '&socid='.urlencode((string) ($socid));
}
if ($optioncss != '') {
$param .= '&optioncss='.urlencode($optioncss);
}
if ($search_categ_cus > 0) {
$param .= '&search_categ_cus='.urlencode((string) ($search_categ_cus));
}
@ -1086,6 +1095,9 @@ if ($search_date_signature_endmonth) {
if ($search_date_signature_endyear) {
$param .= '&search_date_signature_endyear='.urlencode((string) ($search_date_signature_endyear));
}
if ($search_import_key != '') {
$param .= '&search_import_key='.urlencode($search_import_key);
}
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
@ -1499,6 +1511,12 @@ if (!empty($arrayfields['p.note_private']['checked'])) {
print '<td class="liste_titre">';
print '</td>';
}
// Import key
if (!empty($arrayfields['p.import_key']['checked'])) {
print '<td class="liste_titre maxwidthonsmartphone center">';
print '<input class="flat searchstring maxwidth50" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).'">';
print '</td>';
}
// Status
if (!empty($arrayfields['p.fk_statut']['checked'])) {
print '<td class="liste_titre center parentonrightofpage">';
@ -1715,6 +1733,11 @@ if (!empty($arrayfields['p.note_private']['checked'])) {
print_liste_field_titre($arrayfields['p.note_private']['label'], $_SERVER["PHP_SELF"], "p.note_private", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
$totalarray['nbfield']++;
}
// Import key
if (!empty($arrayfields['p.import_key']['checked'])) {
print_liste_field_titre($arrayfields['p.import_key']['label'], $_SERVER["PHP_SELF"], "p.import_key", "", $param, '', $sortfield, $sortorder, 'center ');
}
// Status
if (!empty($arrayfields['p.fk_statut']['checked'])) {
print_liste_field_titre($arrayfields['p.fk_statut']['label'], $_SERVER["PHP_SELF"], "p.fk_statut", "", $param, '', $sortfield, $sortorder, 'center ');
$totalarray['nbfield']++;
@ -1960,8 +1983,8 @@ while ($i < $imaxinloop) {
}
// Country
if (!empty($arrayfields['country.code_iso']['checked'])) {
print '<td class="center">';
$tmparray = getCountry($obj->fk_pays, 'all');
print '<td class="center tdoverflowmax100" title="'.dolPrintHTML($tmparray['label']).'">';
print $tmparray['label'];
print '</td>';
if (!$i) {
@ -2375,6 +2398,15 @@ while ($i < $imaxinloop) {
$totalarray['nbfield']++;
}
}
// Import key
if (!empty($arrayfields['p.import_key']['checked'])) {
print '<td class="nowrap center">'.dol_escape_htmltag($obj->import_key).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Status
if (!empty($arrayfields['p.fk_statut']['checked'])) {
print '<td class="nowrap center">'.$objectstatic->getLibStatut(5).'</td>';

View file

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -44,6 +44,7 @@ if (isModEnabled('invoice')) {
// Security check
$socid = GETPOSTINT("socid");
$id = 0;
if ($user->socid > 0) {
$action = '';
$id = $user->socid;

View file

@ -148,6 +148,8 @@ $search_deliveryday = '';
$search_deliverymonth = '';
$search_deliveryyear = '';
$search_import_key = trim(GETPOST("search_import_key", "alpha"));
$diroutputmassaction = $conf->commande->multidir_output[$conf->entity].'/temp/massgeneration/'.$user->id;
// Load variable for pagination
@ -335,9 +337,6 @@ if (empty($reshook)) {
$search_project = '';
$search_status = '';
$search_billed = '';
$toselect = array();
$search_array_options = array();
$search_categ_cus = 0;
$search_datecloture_start = '';
$search_datecloture_end = '';
$search_fk_cond_reglement = '';
@ -345,6 +344,12 @@ if (empty($reshook)) {
$search_fk_mode_reglement = '';
$search_fk_input_reason = '';
$search_option = '';
$search_import_key = '';
$search_categ_cus = 0;
$search_all = '';
$toselect = array();
$search_array_options = array();
}
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
|| GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) {
@ -1080,6 +1085,9 @@ if ($search_fk_mode_reglement > 0) {
if ($search_fk_input_reason > 0) {
$sql .= " AND c.fk_input_reason = ".((int) $search_fk_input_reason);
}
if ($search_import_key) {
$sql .= natural_search("s.import_key", $search_import_key);
}
// Search on user
if ($search_user > 0) {
$sql .= " AND EXISTS (";
@ -1266,6 +1274,12 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.((int) $limit);
}
if ($optioncss != '') {
$param .= '&optioncss='.urlencode($optioncss);
}
if ($show_files) {
$param .= '&show_files='.urlencode((string) ($show_files));
}
if ($search_all) {
$param .= '&search_all='.urlencode($search_all);
}
@ -1374,12 +1388,6 @@ if ($search_product_category != '') {
if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
$param .= '&search_categ_cus='.urlencode((string) ($search_categ_cus));
}
if ($show_files) {
$param .= '&show_files='.urlencode((string) ($show_files));
}
if ($optioncss != '') {
$param .= '&optioncss='.urlencode($optioncss);
}
if ($search_billed != '') {
$param .= '&search_billed='.urlencode($search_billed);
}
@ -1395,6 +1403,9 @@ if ($search_fk_mode_reglement > 0) {
if ($search_fk_input_reason > 0) {
$param .= '&search_fk_input_reason='.urlencode((string) ($search_fk_input_reason));
}
if ($search_import_key != '') {
$param .= '&search_import_key='.urlencode($search_import_key);
}
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
@ -1876,6 +1887,7 @@ if (!empty($arrayfields['c.facture']['checked'])) {
// Import key
if (!empty($arrayfields['c.import_key']['checked'])) {
print '<td class="liste_titre maxwidthonsmartphone center">';
print '<input class="flat searchstring maxwidth50" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).'">';
print '</td>';
}
@ -2090,14 +2102,17 @@ $parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Status billed
if (!empty($arrayfields['c.facture']['checked'])) {
print_liste_field_titre($arrayfields['c.facture']['label'], $_SERVER["PHP_SELF"], 'c.facture', '', $param, '', $sortfield, $sortorder, 'center ');
$totalarray['nbfield']++;
}
// Import key
if (!empty($arrayfields['c.import_key']['checked'])) {
print_liste_field_titre($arrayfields['c.import_key']['label'], $_SERVER["PHP_SELF"], "c.import_key", "", $param, '', $sortfield, $sortorder, 'center ');
$totalarray['nbfield']++;
}
// Status
if (!empty($arrayfields['c.fk_statut']['checked'])) {
print_liste_field_titre($arrayfields['c.fk_statut']['label'], $_SERVER["PHP_SELF"], "c.fk_statut", "", $param, '', $sortfield, $sortorder, 'center ');
$totalarray['nbfield']++;

View file

@ -900,7 +900,7 @@ if ($resql) {
}
// Code to adjust value date with plus and less picto using an Ajax call instead of a full reload of page
$urlajax = DOL_URL_ROOT.'/core/ajax/bankconciliate.php?token='.currentToken();
$urlajax = DOL_URL_ROOT.'/core/ajax/bankconciliate.php?format=dayreduceformat&token='.currentToken();
print '
<script type="text/javascript">
$(function() {
@ -909,10 +909,10 @@ if ($resql) {
current.click(function()
{
var url = "'.$urlajax.'&"+current.attr("href").split("?")[1];
console.log("We click on ajaxforbankoperationchange url="+url);
$.get(url, function(data)
{
console.log(url)
console.log(data)
console.log(data);
current.parent().parent().find(".spanforajaxedit").replaceWith(data);
});
return false;
@ -1663,7 +1663,9 @@ if ($resql) {
// Date ope
if (!empty($arrayfields['b.dateo']['checked'])) {
print '<td class="nowraponall center">';
print '<span class="spanforajaxedit" id="dateoperation_'.$objp->rowid.'" title="'.dol_print_date($db->jdate($objp->do), "day").'">'.dol_print_date($db->jdate($objp->do), "dayreduceformat")."</span>";
print '<span class="spanforajaxedit" id="dateoperation_'.$objp->rowid.'" title="'.dol_print_date($db->jdate($objp->do), "day").'">';
print dol_print_date($db->jdate($objp->do), "dayreduceformat");
print "</span>";
print '&nbsp;';
print '<span class="inline-block">';
print '<a class="ajaxforbankoperationchange" href="'.$_SERVER['PHP_SELF'].'?action=doprev&amp;account='.$objp->bankid.'&amp;rowid='.$objp->rowid.'">';
@ -1680,7 +1682,9 @@ if ($resql) {
// Date value
if (!empty($arrayfields['b.datev']['checked'])) {
print '<td class="nowraponall center">';
print '<span class="spanforajaxedit" id="datevalue_'.$objp->rowid.'" title="'.dol_print_date($db->jdate($objp->dv), "day").'">'.dol_print_date($db->jdate($objp->dv), "dayreduceformat")."</span>";
print '<span class="spanforajaxedit" id="datevalue_'.$objp->rowid.'" title="'.dol_print_date($db->jdate($objp->dv), "day").'">';
print dol_print_date($db->jdate($objp->dv), "dayreduceformat");
print "</span>";
print '&nbsp;';
print '<span class="inline-block">';
print '<a class="ajaxforbankoperationchange" href="'.$_SERVER['PHP_SELF'].'?action=dvprev&amp;account='.$objp->bankid.'&amp;rowid='.$objp->rowid.'">';

View file

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2017-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -833,6 +833,7 @@ class PaymentVarious extends CommonObject
global $langs;
$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
$bankline = ((empty($arraydata['bankline']) || empty($arraydata['bankline']->id)) ? 0 : $arraydata['bankline']);
$return = '<div class="box-flex-item box-flex-grow-zero">';
$return .= '<div class="info-box info-box-sm">';
@ -844,8 +845,8 @@ class PaymentVarious extends CommonObject
if ($selected >= 0) {
$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
}
if (property_exists($this, 'fk_bank')) {
$return .= ' | <span class="info-box-status ">'.$this->fk_bank.'</span>';
if (!empty($bankline) && $bankline instanceof AccountLine) {
$return .= ' | <span class="info-box-status ">'.$bankline->getNomUrl(1).'</span>';
}
if (property_exists($this, 'datep')) {
$return .= '<br><span class="opacitymedium">'.$langs->trans("Date").'</span> : <span class="info-box-label">'.dol_print_date($this->db->jdate($this->datep), 'day').'</span>';

View file

@ -672,10 +672,10 @@ if ($result) {
current.click(function()
{
var url = "'.$urlajax.'&"+current.attr("href").split("?")[1];
console.log("We click on ajaxforbankoperationchange url="+url);
$.get(url, function(data)
{
console.log(url)
console.log(data)
console.log(data);
current.parent().prev().replaceWith(data);
});
return false;

View file

@ -744,12 +744,11 @@ if (empty($numref)) {
var current = $(this);
current.click(function()
{
console.log("We click on ajaxforbankoperationchange");
var url = "'.$urlajax.'&"+current.attr("href").split("?")[1];
console.log("We click on ajaxforbankoperationchange url="+url);
$.get(url, function(data)
{
console.log(url)
console.log(data)
console.log(data);
current.parent().parent().find(".spanforajaxedit").replaceWith(data);
});
return false;

View file

@ -239,27 +239,23 @@ if (empty($reshook)) {
$form = new Form($db);
$proj = null;
$accountingaccount = new AccountingAccount($db);
$bankline = new AccountLine($db);
$variousstatic = new PaymentVarious($db);
$accountstatic = null;
$accountingjournal = null;
if ($arrayfields['account']['checked'] || $arrayfields['subledger']['checked']) {
$formaccounting = new FormAccounting($db);
}
if ($arrayfields['bank']['checked'] && isModEnabled('accounting')) {
$accountingjournal = new AccountingJournal($db);
}
if ($arrayfields['ref']['checked']) {
$variousstatic = new PaymentVarious($db);
}
if ($arrayfields['bank']['checked']) {
$accountstatic = new Account($db);
$accountstatic = new Account($db);
}
if ($arrayfields['project']['checked']) {
$proj = new Project($db);
}
if ($arrayfields['entry']['checked']) {
$bankline = new AccountLine($db);
}
if ($arrayfields['account']['checked']) {
$accountingaccount = new AccountingAccount($db);
}
$title = $langs->trans("VariousPayments");
//$help_url = "EN:Module_MyObject|FR:Module_MyObject_FR|ES:Módulo_MyObject";
@ -720,20 +716,25 @@ while ($i < $imaxinloop) {
$variousstatic->label = $obj->label;
$variousstatic->datep = $obj->datep;
$variousstatic->type_payment = $obj->payment_code;
$bankline->fetch($obj->fk_bank);
$variousstatic->fk_bank = $bankline->getNomUrl(1);
$variousstatic->amount = $obj->amount;
$accountingaccount->fetch(0, $obj->accountancy_code, 1);
$variousstatic->accountancy_code = $accountingaccount->getNomUrl(0, 0, 1, $obj->accountingaccount, 1);
if ($mode == 'kanban') {
if ($obj->fk_bank > 0) {
$bankline->fetch($obj->fk_bank);
} else {
$bankline->id = 0;
}
if ($i == 0) {
print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
print '<div class="box-flex-container kanban">';
}
// Output Kanban
print $variousstatic->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
print $variousstatic->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected), 'bankline' => $bankline));
if ($i == ($imaxinloop) - 1) {
print '</div>';
print '</td></tr>';
@ -819,12 +820,12 @@ while ($i < $imaxinloop) {
// Bank account
if ($arrayfields['bank']['checked']) {
print '<td class="nowraponall">';
if ($obj->bid > 0) {
if (is_object($accountstatic) && $obj->bid > 0) {
$accountstatic->id = $obj->bid;
$accountstatic->ref = $obj->bref;
$accountstatic->number = $obj->bnumber;
if (isModEnabled('accounting')) {
if (isModEnabled('accounting') && is_object($accountingjournal)) {
$accountstatic->account_number = $obj->bank_account_number;
$accountingjournal->fetch($obj->accountancy_journal);
$accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1);
@ -832,8 +833,6 @@ while ($i < $imaxinloop) {
$accountstatic->label = $obj->blabel;
print $accountstatic->getNomUrl(1);
} else {
print '&nbsp;';
}
print '</td>';
if (!$i) {

View file

@ -105,7 +105,10 @@ $pagenext = $page + 1;
$object = new FactureRec($db);
if (($id > 0 || $ref) && $action != 'create' && $action != 'add') {
$ret = $object->fetch($id, $ref);
if (!$ret) {
if ($ret < 0) {
dol_print_error($db, $object->error, $object->errors);
exit;
} elseif (! $ret) {
setEventMessages($langs->trans("ErrorRecordNotFound"), null, 'errors');
}
}
@ -1424,14 +1427,10 @@ if ($action == 'create') {
}
print '</tr></table>';
print '</td><td>';
if ($object->type != Facture::TYPE_CREDIT_NOTE) {
if ($action == 'editconditions') {
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->cond_reglement_id, 'cond_reglement_id');
} else {
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->cond_reglement_id, 'none');
}
if ($action == 'editconditions') {
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->cond_reglement_id, 'cond_reglement_id');
} else {
print '&nbsp;';
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->cond_reglement_id, 'none');
}
print '</td></tr>';
@ -1799,6 +1798,7 @@ if ($action == 'create') {
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
$formactions = new FormActions($db);
$morehtmlcenter = '';
$somethingshown = $formactions->showactions($object, $object->element, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlcenter);
print '</div>';

View file

@ -1108,7 +1108,7 @@ if (empty($reshook)) {
$object->fk_incoterms = GETPOSTINT('incoterm_id');
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
$object->multicurrency_tx = GETPOSTINT('originmulticurrency_tx');
$object->multicurrency_tx = GETPOSTFLOAT('originmulticurrency_tx');
// Special properties of replacement invoice
$object->fk_facture_source = GETPOSTINT('fac_replacement');
@ -1169,7 +1169,7 @@ if (empty($reshook)) {
$object->fk_incoterms = GETPOSTINT('incoterm_id');
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
$object->multicurrency_tx = GETPOSTINT('originmulticurrency_tx');
$object->multicurrency_tx = GETPOSTFLOAT('originmulticurrency_tx');
// Special properties of replacement invoice
$object->fk_facture_source = $sourceinvoice > 0 ? $sourceinvoice : '';
@ -1408,7 +1408,7 @@ if (empty($reshook)) {
$object->fk_incoterms = GETPOSTINT('incoterm_id');
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
$object->multicurrency_tx = GETPOSTINT('originmulticurrency_tx');
$object->multicurrency_tx = GETPOSTFLOAT('originmulticurrency_tx');
// Source facture
$object->fac_rec = GETPOSTINT('fac_rec');
@ -1495,7 +1495,7 @@ if (empty($reshook)) {
$object->fk_incoterms = GETPOSTINT('incoterm_id');
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
$object->multicurrency_tx = GETPOSTINT('originmulticurrency_tx');
$object->multicurrency_tx = GETPOSTFLOAT('originmulticurrency_tx');
if (GETPOST('type') == Facture::TYPE_SITUATION) {
$object->situation_counter = 1;
@ -2766,7 +2766,7 @@ if (empty($reshook)) {
// Invoice situation
if (getDolGlobalInt('INVOICE_USE_SITUATION') == 2) {
$previousprogress = $line->getAllPrevProgress($line->fk_facture);
$fullprogress = price2num(GETPOST('progress', 'alpha'));
$fullprogress = price2num(GETPOST('progress', 'alpha'), 2);
if ($fullprogress < $previousprogress) {
$error++;

View file

@ -721,11 +721,11 @@ class Invoices extends DolibarrApi
}
}
if ($this->invoice->update(DolibarrApiAccess::$user)) {
if ($this->invoice->update(DolibarrApiAccess::$user) > 0) {
return $this->get($id);
} else {
throw new RestException(500, $this->invoice->error);
}
return false;
}
/**

View file

@ -398,7 +398,7 @@ class FactureRec extends CommonInvoice
$sql .= ", '".$this->db->escape($facsrc->multicurrency_code)."'";
$sql .= ", ".((float) $facsrc->multicurrency_tx);
$sql .= ", ".((int) $this->suspended);
$sql .= ", ".((int) $this->fk_societe_rib);
$sql .= ", ".(!empty($this->fk_societe_rib) ? ((int) $this->fk_societe_rib) : 'NULL');
$sql .= ")";
if ($this->db->query($sql)) {
@ -571,7 +571,7 @@ class FactureRec extends CommonInvoice
$sql .= " localtax2 = ".((float) $this->total_localtax2).",";
$sql .= " total_ht = ".((float) $this->total_ht).",";
$sql .= " total_ttc = ".((float) $this->total_ttc).",";
$sql .= " fk_societe_rib = ".((int) $this->fk_societe_rib);
$sql .= " fk_societe_rib = ".(!empty($this->fk_societe_rib) ? ((int) $this->fk_societe_rib) : 'NULL');;
// TODO Add missing fields
$sql .= " WHERE rowid = ".((int) $this->id);
@ -1478,6 +1478,7 @@ class FactureRec extends CommonInvoice
$nb_create++;
$this->output .= $langs->trans("InvoiceGeneratedFromTemplate", $facture->ref, $facturerec->ref)."\n";
} else {
$this->output .= $langs->trans("InvoiceGeneratedFromTemplateError", $facture->ref, $facturerec->ref, $this->error)."\n";
$this->db->rollback("createRecurringInvoices Process invoice template id=".$facturerec->id.", ref=".$facturerec->ref);
}

View file

@ -486,7 +486,8 @@ class Facture extends CommonInvoice
$this->type = self::TYPE_STANDARD;
}
$this->ref_client = trim($this->ref_client);
$this->ref_client = trim($this->ref_client); // deprecated
$this->ref_customer = trim($this->ref_customer);
$this->note_private = (isset($this->note_private) ? trim($this->note_private) : '');
$this->note = (isset($this->note) ? trim($this->note) : $this->note_private); // deprecated
@ -906,17 +907,18 @@ class Facture extends CommonInvoice
1
);
if ($result < 0) {
$this->error = $newinvoiceline->error;
$this->errors = array_merge($this->errors, $newinvoiceline->errors);
$error++;
break;
}
// Defined the new fk_parent_line
if ($result > 0 && $newinvoiceline->product_type == 9) {
$fk_parent_line = $result;
}
}
if ($result < 0) {
$this->error = $newinvoiceline->error;
$this->errors = $newinvoiceline->errors;
$error++;
break;
}
}
} elseif (!$error && empty($this->fac_rec)) { // If this->lines is an array of invoice line arrays
$fk_parent_line = 0;
@ -2514,9 +2516,13 @@ class Facture extends CommonInvoice
if (isset($this->ref_ext)) {
$this->ref_ext = trim($this->ref_ext);
}
if (isset($this->ref_client)) {
// deprecated
if (!empty($this->ref_client)) {
$this->ref_client = trim($this->ref_client);
}
if (!empty($this->ref_customer)) {
$this->ref_customer = trim($this->ref_customer);
}
if (isset($this->increment)) {
$this->increment = trim($this->increment);
}
@ -2545,7 +2551,6 @@ class Facture extends CommonInvoice
$this->retained_warranty = (float) $this->retained_warranty;
}
// Check parameters
// Put here code to add control on parameters values
@ -2555,7 +2560,7 @@ class Facture extends CommonInvoice
$sql .= " ref_ext=".(isset($this->ref_ext) ? "'".$this->db->escape($this->ref_ext)."'" : "null").",";
$sql .= " type=".(isset($this->type) ? $this->db->escape($this->type) : "null").",";
$sql .= " subtype=".(isset($this->subtype) ? $this->db->escape($this->subtype) : "null").",";
$sql .= " ref_client=".(isset($this->ref_client) ? "'".$this->db->escape($this->ref_client)."'" : "null").",";
$sql .= " ref_client=".(!empty($this->ref_customer) ? "'".$this->db->escape($this->ref_customer)."'" : (isset($this->ref_client) ? "'".$this->db->escape($this->ref_client)."'" : "null")).",";
$sql .= " increment=".(isset($this->increment) ? "'".$this->db->escape($this->increment)."'" : "null").",";
$sql .= " fk_soc=".(isset($this->socid) ? $this->db->escape($this->socid) : "null").",";
$sql .= " datec=".(strval($this->date_creation) != '' ? "'".$this->db->idate($this->date_creation)."'" : 'null').",";
@ -2760,7 +2765,8 @@ class Facture extends CommonInvoice
}
if (!$error) {
$this->ref_client = $ref_client;
$this->ref_client = $ref_client; //deprecated
$this->ref_customer = $ref_client;
}
if (!$notrigger && empty($error)) {
@ -2773,7 +2779,8 @@ class Facture extends CommonInvoice
}
if (!$error) {
$this->ref_client = $ref_client;
$this->ref_client = $ref_client; //deprecated
$this->ref_customer = $ref_client;
$this->db->commit();
return 1;

View file

@ -158,6 +158,7 @@ $search_categ_cus = GETPOST("search_categ_cus", 'intcomma');
$search_product_category = GETPOST('search_product_category', 'intcomma');
$search_fac_rec_source_title = GETPOST("search_fac_rec_source_title", 'alpha');
$search_fk_fac_rec_source = GETPOST('search_fk_fac_rec_source', 'int');
$search_import_key = trim(GETPOST("search_import_key", "alpha"));
$search_option = GETPOST('search_option');
if ($search_option == 'late') {
@ -269,6 +270,7 @@ $arrayfields = array(
'f.note_public' => array('label' => 'NotePublic', 'checked' => 0, 'position' => 520, 'enabled' => (!getDolGlobalInt('MAIN_LIST_HIDE_PUBLIC_NOTES'))),
'f.note_private' => array('label' => 'NotePrivate', 'checked' => 0, 'position' => 521, 'enabled' => (!getDolGlobalInt('MAIN_LIST_HIDE_PRIVATE_NOTES'))),
'f.fk_fac_rec_source' => array('label' => 'GeneratedFromTemplate', 'checked' => 0, 'position' => 530, 'enabled' => '1'),
'f.import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'position' => 999),
'f.fk_statut' => array('label' => "Status", 'checked' => 1, 'position' => 1000),
);
@ -408,7 +410,10 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter',
$search_datelimit_end = '';
$search_fac_rec_source_title = '';
$search_option = '';
$search_import_key = '';
$search_categ_cus = 0;
$search_all = '';
$toselect = array();
$search_array_options = array();
}
@ -656,7 +661,7 @@ $sql .= ' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,';
$sql .= ' f.fk_user_author,';
$sql .= ' f.fk_multicurrency, f.multicurrency_code, f.multicurrency_tx, f.multicurrency_total_ht, f.multicurrency_total_tva as multicurrency_total_vat, f.multicurrency_total_ttc,';
$sql .= ' f.datef, f.date_valid, f.date_lim_reglement as datelimite, f.module_source, f.pos_source,';
$sql .= ' f.paye as paye, f.fk_statut, f.close_code,';
$sql .= ' f.paye as paye, f.fk_statut, f.import_key, f.close_code,';
$sql .= ' f.datec as date_creation, f.tms as date_modification, f.date_closing as date_closing,';
$sql .= ' f.retained_warranty, f.retained_warranty_date_limit, f.situation_final, f.situation_cycle_ref, f.situation_counter,';
$sql .= ' s.rowid as socid, s.nom as name, s.name_alias as alias, s.email, s.phone, s.fax, s.address, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur,';
@ -888,6 +893,9 @@ if (!empty($search_fac_rec_source_title)) {
if ($search_fk_fac_rec_source) {
$sql .= ' AND f.fk_fac_rec_source = ' . (int) $search_fk_fac_rec_source;
}
if ($search_import_key) {
$sql .= natural_search("s.import_key", $search_import_key);
}
// Search on user
if ($search_user > 0) {
$sql .= " AND EXISTS (";
@ -1052,6 +1060,12 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.((int) $limit);
}
if ($optioncss != '') {
$param .= '&optioncss='.urlencode($optioncss);
}
if ($show_files) {
$param .= '&show_files='.urlencode((string) ($show_files));
}
if ($search_all) {
$param .= '&search_all='.urlencode($search_all);
}
@ -1208,15 +1222,9 @@ if ($search_module_source) {
if ($search_pos_source) {
$param .= '&search_pos_source='.urlencode($search_pos_source);
}
if ($show_files) {
$param .= '&show_files='.urlencode((string) ($show_files));
}
if ($search_option) {
$param .= "&search_option=".urlencode($search_option);
}
if ($optioncss != '') {
$param .= '&optioncss='.urlencode($optioncss);
}
if ($search_categ_cus > 0) {
$param .= '&search_categ_cus='.urlencode((string) ($search_categ_cus));
}
@ -1226,6 +1234,9 @@ if (!empty($search_fac_rec_source_title)) {
if ($search_fk_fac_rec_source) {
$param .= '&search_fk_fac_rec_source=' . (int) $search_fk_fac_rec_source;
}
if ($search_import_key != '') {
$param .= '&search_import_key='.urlencode($search_import_key);
}
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
@ -1690,6 +1701,12 @@ if (!empty($arrayfields['f.fk_fac_rec_source']['checked'])) {
print '<input class="flat maxwidth50imp" type="text" name="search_fac_rec_source_title" id="search_fac_rec_source_title" value="'.dol_escape_htmltag($search_fac_rec_source_title).'">';
print '</td>';
}
// Import key
if (!empty($arrayfields['f.import_key']['checked'])) {
print '<td class="liste_titre maxwidthonsmartphone center">';
print '<input class="flat searchstring maxwidth50" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).'">';
print '</td>';
}
// Status
if (!empty($arrayfields['f.fk_statut']['checked'])) {
print '<td class="liste_titre center parentonrightofpage">';
@ -1924,6 +1941,12 @@ if (!empty($arrayfields['f.fk_fac_rec_source']['checked'])) {
print_liste_field_titre($arrayfields['f.fk_fac_rec_source']['label'], $_SERVER["PHP_SELF"], "facrec.titre", "", $param, '', $sortfield, $sortorder);
$totalarray['nbfield']++;
}
// Import key
if (!empty($arrayfields['f.import_key']['checked'])) {
print_liste_field_titre($arrayfields['f.import_key']['label'], $_SERVER["PHP_SELF"], "f.import_key", "", $param, '', $sortfield, $sortorder, 'center ');
$totalarray['nbfield']++;
}
// Status
if (!empty($arrayfields['f.fk_statut']['checked'])) {
print_liste_field_titre($arrayfields['f.fk_statut']['label'], $_SERVER["PHP_SELF"], "f.fk_statut,f.paye,f.type", "", $param, '', $sortfield, $sortorder, 'center ');
$totalarray['nbfield']++;
@ -2343,10 +2366,10 @@ if ($num > 0) {
}
// Type ent
if (!empty($arrayfields['typent.code']['checked'])) {
print '<td class="center">';
if (!is_array($typenArray) || count($typenArray) == 0) {
$typenArray = $formcompany->typent_array(1);
}
print '<td class="center tdoverflowmax100" title="'.dolPrintHTML($typenArray[$obj->typent_code]).'">';
if (!empty($obj->typent_code)) {
print $typenArray[$obj->typent_code];
}
@ -2357,10 +2380,10 @@ if ($num > 0) {
}
// Staff
if (!empty($arrayfields['staff.code']['checked'])) {
print '<td class="center">';
if (!is_array($conf->cache['staff']) || count($conf->cache['staff']) == 0) {
$conf->cache['staff'] = $formcompany->effectif_array(1);
}
print '<td class="center tdoverflowmax100" title="'.dolPrintHTML($conf->cache['staff'][$obj->staff_code]).'">';
print $conf->cache['staff'][$obj->staff_code];
print '</td>';
if (!$i) {
@ -2532,8 +2555,6 @@ if ($num > 0) {
}
}
//else print $langs->trans("NoSalesRepresentativeAffected");
} else {
print '&nbsp;';
}
print '</td>';
if (!$i) {
@ -2751,6 +2772,15 @@ if ($num > 0) {
$totalarray['nbfield']++;
}
}
// Import key
if (!empty($arrayfields['f.import_key']['checked'])) {
print '<td class="nowrap center">'.dol_escape_htmltag($obj->import_key).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Status
if (!empty($arrayfields['f.fk_statut']['checked'])) {
print '<td class="nowrap center">';

View file

@ -312,7 +312,7 @@ print '</td></tr>';
// ThirdParty Type
print '<tr><td>'.$langs->trans("ThirdPartyType").'</td><td>';
$sortparam_typent = (!getDolGlobalString('SOCIETE_SORT_ON_TYPEENT') ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label.
$sortparam_typent = getDolGlobalString('SOCIETE_SORT_ON_TYPEENT', 'ASC'); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label.
print $form->selectarray("typent_id", $formcompany->typent_array(0), $typent_id, 1, 0, 0, '', 0, 0, 0, $sortparam_typent, '', 1);
if ($user->admin) {
print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
@ -342,7 +342,7 @@ if (isModEnabled('category')) {
// User
print '<tr><td>'.$langs->trans("CreatedBy").'</td><td>';
print img_picto('', 'user', 'class="pictofixedwidth"');
print $form->select_dolusers($userid, 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'widthcentpercentminusx maxwidth300');
print $form->select_dolusers($userid ? $userid : -1, 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'widthcentpercentminusx maxwidth300');
print '</td></tr>';
// Status
print '<tr><td>'.$langs->trans("Status").'</td><td>';

View file

@ -455,7 +455,7 @@ while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) { // $
print '<tr class="oddeven">';
print '<td class="nowrap"><a href="'.DOL_URL_ROOT.'/compta/localtax/quadri_detail.php?leftmenu=tax_vat&month='.$m.'&year='.$y.'">'.dol_print_date(dol_mktime(0, 0, 0, (int) $m, 1, (int) $y), "%b %Y").'</a></td>';
print '<td class="nowrap"><a href="'.DOL_URL_ROOT.'/compta/localtax/quadri_detail.php?leftmenu=tax_vat&month='.$m.'&year='.$y.'&localTaxType='.$localTaxType.'">'.dol_print_date(dol_mktime(0, 0, 0, (int) $m, 1, (int) $y), "%b %Y").'</a></td>';
$x_coll_sum = 0;
foreach (array_keys($x_coll) as $rate) {

View file

@ -334,8 +334,22 @@ class Paiement extends CommonObject
if (empty($value)) {
continue;
}
// $key is id of invoice, $value is amount, $way is a 'dolibarr' if amount is in main currency, 'customer' if in foreign currency
$value_converted = MultiCurrency::getAmountConversionFromInvoiceRate($key, $value, $way);
$value_converted = false;
$tmparray = MultiCurrency::getInvoiceRate($key, 'facture');
$invoice_multicurrency_tx = $tmparray['invoice_multicurrency_tx'];
$invoice_multicurrency_code = $tmparray['invoice_multicurrency_code'];
// $key is id of invoice, $value is amount, $way is 'dolibarr' if amount is in main currency, 'customer' if in foreign currency
if ($invoice_multicurrency_tx) {
if ($way == 'dolibarr') {
$value_converted = (float) price2num($value * $invoice_multicurrency_tx, 'MU');
} else {
$value_converted = (float) price2num($value / $invoice_multicurrency_tx, 'MU');
}
} else {
$invoice_multicurrency_tx = false;
}
// Add controls of input validity
if ($value_converted === false) {
// We failed to find the conversion for one invoice
@ -344,8 +358,8 @@ class Paiement extends CommonObject
}
// Set the currency of the invoice
$currencyofinvoiceforthisline = empty($this->multicurrency_code[$key]) ? $conf->currency : $this->multicurrency_code[$key];
// If a payment was enter into section of foreign currency of invoice, we want to pay in the currency if invoice
$currencyofinvoiceforthisline = empty($this->multicurrency_code[$key]) ? $invoice_multicurrency_code : $this->multicurrency_code[$key];
// If a payment was entered into the section of the foreign currency of invoice, we want to pay in the currency of invoice
$currencyofpaymentforthisline = empty($this->multicurrency_amounts[$key]) ? $conf->currency : $this->multicurrency_code[$key];
//var_dump("Invoice ID: ".$key.", amount in company cur:".$this->amounts[$key]." amount in invoice cur:".$this->multicurrency_amounts[$key]." => currencyofinvoice= ".$currencyofinvoiceforthisline." - currencyofpaymentforthisline =".$currencyofpaymentforthisline);
@ -1310,12 +1324,10 @@ class Paiement extends CommonObject
*/
public function getWay()
{
global $conf;
$way = 'dolibarr';
if (isModEnabled('multicurrency')) {
foreach ($this->multicurrency_amounts as $value) {
if (!empty($value)) { // one value found then payment is in invoice currency
if (!empty($value)) { // one value found into multicurrency_amounts so payment is in invoice currency
$way = 'customer';
break;
}

View file

@ -1090,6 +1090,7 @@ class BonPrelevement extends CommonObject
// Pre-store some values into variables to simplify following sql requests
if ($sourcetype != 'salary') {
$entities = $type != 'bank-transfer' ? getEntity('invoice') : getEntity('supplier_invoice');
$sqlTable = $type != 'bank-transfer' ? "facture" : "facture_fourn";
$socOrUser = 'fk_soc';
$societeOrUser = 'societe';
} else {
@ -1099,8 +1100,6 @@ class BonPrelevement extends CommonObject
$societeOrUser = 'user';
}
$sqlTable = $type != 'bank-transfer' ? "facture" : "facture_fourn";
$thirdpartyBANId = 0;
// Check if there is an iban associated to the bank transfer request or if we take the default
@ -1160,7 +1159,7 @@ class BonPrelevement extends CommonObject
$sql .= ", CONCAT(s.firstname,' ',s.lastname) as name";
$sql .= ", f.ref, sr.bic, sr.iban_prefix, 'FRST' as frstrecur";
}
$sql .= " FROM " . $this->db->prefix() . $sqlTable . " as f";
$sql .= " FROM " . $this->db->prefix() . $sqlTable . " as f"; // f is salary, facture or facture_fourn
$sql .= " LEFT JOIN " . $this->db->prefix() . "prelevement_demande as pd ON f.rowid = pd.fk_".$this->db->sanitize($sqlTable);
$sql .= " LEFT JOIN " . $this->db->prefix() . $this->db->sanitize($societeOrUser)." as s ON s.rowid = f.".$this->db->sanitize($socOrUser);
$sql .= " LEFT JOIN " . $this->db->prefix() . $this->db->sanitize($societeOrUser."_rib")." as sr ON s.rowid = sr.".$this->db->sanitize($socOrUser);

View file

@ -2,7 +2,7 @@
/* Copyright (C) 2004-2020 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2016-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2017-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2017-2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
@ -212,7 +212,7 @@ if (empty($reshook)) {
$object->periode = $dateperiod;
$object->period = $dateperiod;
$object->amount = $amount;
$object->fk_user = $fk_user;
$object->fk_user = $fk_user;
$object->mode_reglement_id = GETPOSTINT('mode_reglement_id');
$object->fk_account = GETPOSTINT('fk_account');
$object->fk_project = GETPOSTINT('fk_project');
@ -250,7 +250,7 @@ if (empty($reshook)) {
$object->period = $dateperiod;
$object->periode = $dateperiod;
$object->amount = $amount;
$object->fk_user = $fk_user;
// $object->fk_user = $fk_user;
$result = $object->update($user);
if ($result <= 0) {

View file

@ -498,22 +498,31 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) {
//var_dump($annee.' '.$year_end.' '.$mois.' '.$month_end);
if ($annee < $year_end || ($annee == $year_end && $mois <= $month_end)) {
if ($annee_decalage > $minyear && $case <= $casenow) {
if (!empty($cumulative[$caseprev]) && !empty($cumulative[$case])) {
$percent = (round(($cumulative[$case] - $cumulative[$caseprev]) / $cumulative[$caseprev], 4) * 100);
//print "X $cumulative[$case] - $cumulative[$caseprev] - $cumulative[$caseprev] - $percent X";
if ($modecompta=='CREANCES-DETTES') {
$cumulative_previous_year = (!empty($cumulative_ht[$caseprev])?$cumulative_ht[$caseprev]:0);
$cumulative_year = (!empty($cumulative_ht[$case])?$cumulative_ht[$case]:0);
$isset_cumulative_previous_year = isset($cumulative_ht[$caseprev]);
} else {
$cumulative_previous_year = (!empty($cumulative[$caseprev])?$cumulative[$caseprev]:0);
$cumulative_year = (!empty($cumulative[$case])?$cumulative[$case]:0);
$isset_cumulative_previous_year = isset($cumulative_ht[$caseprev]);
}
if (!empty($cumulative_previous_year) && !empty($cumulative_year)) {
$percent = (round(($cumulative_year - $cumulative_previous_year) / $cumulative_previous_year, 4) * 100);
//print "X $cumulative_year - $cumulative_previous_year - $cumulative_previous_year - $percent X";
print($percent >= 0 ? "+$percent" : "$percent").'%';
}
if (!empty($cumulative[$caseprev]) && empty($cumulative[$case])) {
if (!empty($cumulative_previous_year) && empty($cumulative_year)) {
print '-100%';
}
if (empty($cumulative[$caseprev]) && !empty($cumulative[$case])) {
if (empty($cumulative_previous_year) && !empty($cumulative_year)) {
//print '<td class="right">+Inf%</td>';
print '-';
}
if (isset($cumulative[$caseprev]) && empty($cumulative[$caseprev]) && empty($cumulative[$case])) {
if ($isset_cumulative_previous_year && empty($cumulative_previous_year) && empty($cumulative_year)) {
print '+0%';
}
if (!isset($cumulative[$caseprev]) && empty($cumulative[$case])) {
if (!$isset_cumulative_previous_year && empty($cumulative_year)) {
print '-';
}
} else {
@ -618,7 +627,7 @@ print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td>';
for ($annee = $year_start; $annee <= $year_end; $annee++) {
if ($modecompta == 'CREANCES-DETTES') {
// Montant total HT
if ($total_ht[$annee] || ($annee >= $minyear && $annee <= max($nowyear, $maxyear))) {
if (isset($total_ht[$annee]) || ($annee >= $minyear && $annee <= max($nowyear, $maxyear))) {
print '<td class="nowrap right">';
print(empty($total_ht[$annee]) ? '0' : price($total_ht[$annee]));
print "</td>";
@ -638,19 +647,26 @@ for ($annee = $year_start; $annee <= $year_end; $annee++) {
// Pourcentage total
if ($annee > $minyear && $annee <= max($nowyear, $maxyear)) {
if (!empty($total[$annee - 1]) && !empty($total[$annee])) {
$percent = (round(($total[$annee] - $total[$annee - 1]) / $total[$annee - 1], 4) * 100);
if ($modecompta == 'CREANCES-DETTES') {
$total_previous_year = (!empty($total_ht[$annee - 1])?$total_ht[$annee - 1]:0);
$total_year = (!empty($total_ht[$annee])?$total_ht[$annee]:0);
} else {
$total_previous_year = (!empty($total[$annee - 1])?$total[$annee - 1]:0);
$total_year = (!empty($total[$annee])?$total[$annee]:0);
}
if (!empty($total_previous_year) && !empty($total_year)) {
$percent = (round(($total_year - $total_previous_year) / $total_previous_year, 4) * 100);
print '<td class="nowrap borderrightlight right">';
print($percent >= 0 ? "+$percent" : "$percent").'%';
print '</td>';
}
if (!empty($total[$annee - 1]) && empty($total[$annee])) {
if (!empty($total_previous_year) && empty($total_year)) {
print '<td class="borderrightlight right">-100%</td>';
}
if (empty($total[$annee - 1]) && !empty($total[$annee])) {
if (empty($total_previous_year) && !empty($total_year)) {
print '<td class="borderrightlight right">+'.$langs->trans('Inf').'%</td>';
}
if (empty($total[$annee - 1]) && empty($total[$annee])) {
if (empty($total_previous_year) && empty($total_year)) {
print '<td class="borderrightlight right">+0%</td>';
}
} else {

View file

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2010 Regis Houssin <regis.houssin@inodbox.com>
/* Copyright (C) 2010 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -17,9 +17,12 @@
*/
/**
* @var Canvas $this
* @var Conf $conf
* @var Contact $object
* @var Translate $langs
*
* @var string $canvas
*/
// Protection to avoid direct call of template

View file

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2010 Regis Houssin <regis.houssin@inodbox.com>
/* Copyright (C) 2010 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -17,9 +17,12 @@
*/
/**
* @var Canvas $this
* @var Conf $conf
* @var Contact $object
* @var Translate $langs
*
* @var string $canvas
*/
// Protection to avoid direct call of template

View file

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com>
/* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -17,10 +17,13 @@
*/
/**
* @var Canvas $this
* @var Conf $conf
* @var Contact $object
* @var Translate $langs
* @var User $user
*
* @var string $canvas
*/
// Protection to avoid direct call of template

View file

@ -484,6 +484,10 @@ class Contact extends CommonObject
$error = 0;
$now = dol_now();
if (empty($this->date_creation)) {
$this->date_creation = $now;
}
$this->db->begin();
// Clean parameters

View file

@ -1006,12 +1006,13 @@ class Contrat extends CommonObject
/**
* Create a contract into database
*
* @param User $user User that create
* @return int Return integer <0 if KO, id of contract if OK
* @param User $user User that create
* @param int<0,1> $notrigger 0=launch triggers after, 1=disable triggers
* @return int Return integer <0 if KO, id of contract if OK
*/
public function create($user)
public function create($user, $notrigger = 0)
{
global $conf, $langs, $mysoc;
global $conf, $langs;
// Check parameters
$paramsok = 1;
@ -1167,22 +1168,18 @@ class Contrat extends CommonObject
}
}
if (!$error) {
if (!$error && !$notrigger) {
// Call trigger
$result = $this->call_trigger('CONTRACT_CREATE', $user);
if ($result < 0) {
$error++;
}
// End call triggers
}
if (!$error) {
$this->db->commit();
return $this->id;
} else {
dol_syslog(get_class($this)."::create - 30 - ".$this->error, LOG_ERR);
$this->db->rollback();
return -3;
}
if (!$error) {
$this->db->commit();
return $this->id;
} else {
$this->error = "Failed to add contract";
dol_syslog(get_class($this)."::create - 20 - ".$this->error, LOG_ERR);

View file

@ -55,10 +55,13 @@
* @var ?string $objectlabel
* @var ?string $option
* @var ?int $deliveryreceipt
* @var string $action
* @var string $massaction
* @var string $objectclass
* @var string $uploaddir
* @var string $confirm
* @var string $month
* @var string $year
* @var int $error
*/
'

View file

@ -53,6 +53,8 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$action = GETPOST('action', 'aZ09');
$format = GETPOST('format');
// Security check
// Checks are done later
@ -72,7 +74,7 @@ if (($user->hasRight('banque', 'modifier') || $user->hasRight('banque', 'consoli
$al->datev_next(GETPOSTINT('rowid'));
$al->fetch(GETPOSTINT('rowid'));
print '<span class="spanforajaxedit" id="datevalue_'.$al->id.'">'.dol_print_date($al->datev, "day").'</span>';
print '<span class="spanforajaxedit" id="datevalue_'.$al->id.'">'.dol_print_date($al->datev, ($format ? $format : "day")).'</span>';
exit;
}
@ -83,7 +85,7 @@ if (($user->hasRight('banque', 'modifier') || $user->hasRight('banque', 'consoli
$al->datev_previous(GETPOSTINT('rowid'));
$al->fetch(GETPOSTINT('rowid'));
print '<span class="spanforajaxedit" id="datevalue_'.$al->id.'">'.dol_print_date($al->datev, "day").'</span>';
print '<span class="spanforajaxedit" id="datevalue_'.$al->id.'">'.dol_print_date($al->datev, ($format ? $format : "day")).'</span>';
exit;
}
@ -94,7 +96,7 @@ if (($user->hasRight('banque', 'modifier') || $user->hasRight('banque', 'consoli
$al->dateo_next(GETPOSTINT('rowid'));
$al->fetch(GETPOSTINT('rowid'));
print '<span class="spanforajaxedit" id="dateoperation_'.$al->id.'">'.dol_print_date($al->dateo, "day").'</span>';
print '<span class="spanforajaxedit" id="dateoperation_'.$al->id.'">'.dol_print_date($al->dateo, ($format ? $format : "day")).'</span>';
exit;
}
@ -105,7 +107,7 @@ if (($user->hasRight('banque', 'modifier') || $user->hasRight('banque', 'consoli
$al->dateo_previous(GETPOSTINT('rowid'));
$al->fetch(GETPOSTINT('rowid'));
print '<span class="spanforajaxedit" id="dateoperation_'.$al->id.'">'.dol_print_date($al->dateo, "day").'</span>';
print '<span class="spanforajaxedit" id="dateoperation_'.$al->id.'">'.dol_print_date($al->dateo, ($format ? $format : "day")).'</span>';
exit;
}

View file

@ -223,6 +223,11 @@ abstract class CommonDocGenerator
*/
public $cols;
/**
* @var array<string,array{page:int,y:float|int}> Array of position data
*/
public $afterColsLinePositions;
/**
* @var array{fullpath:string} Array with result of doc generation. content is array('fullpath'=>$file)
*/
@ -1253,6 +1258,64 @@ abstract class CommonDocGenerator
}
}
/**
* Get position in PDF after col display
* @return false|array{page:int,y:float|int,col:string}
*/
public function getMaxAfterColsLinePositionsData()
{
if (empty($this->afterColsLinePositions) || !is_array($this->afterColsLinePositions)) {
return false;
}
$colId = '';
$maxPage = $maxY = 0;
foreach ($this->afterColsLinePositions as $colKey => $value) {
if ($value['page'] > $maxPage) {
$colId = $colKey;
$maxPage = $value['page'];
$maxY = $value['y']; // if page is higher we need to reset y to new max page y
} elseif ($value['page'] == $maxPage) {
$maxY = max($value['y'], $maxY);
$colId = $colKey;
}
}
return [
'col' => $colId,
'y' => $maxY,
'page' => $maxPage
];
}
/**
* Used for reset afterColsLinePositions var in start of a new pdf draw line loop
* @param float $y the new $y position usually get by TCPDF::GetY()
* @param int $pageNumb the page number to reset at
* @return void
*/
public function resetAfterColsLinePositionsData(float $y, int $pageNumb)
{
$this->afterColsLinePositions = [];
$this->setAfterColsLinePositionsData('startLine', $y, $pageNumb);
}
/**
* Used for to set afterColsLinePositions var in a pdf draw line loop
* @param string $colId the column id used as key in $this->cols or an unique id code like startLine or separateLine ....
* @param float $y the $y position usually get by TCPDF::GetY() where print data ended
* @param int $pageNumb the page number where print data ended
* @return void
*/
public function setAfterColsLinePositionsData(string $colId, float $y, int $pageNumb)
{
$this->afterColsLinePositions[$colId] = [
'page' => $pageNumb,
'y' => $y
];
}
/**
* uasort callback function to Sort columns fields
*
@ -1466,6 +1529,7 @@ abstract class CommonDocGenerator
// set cell padding with column content definition
$pdf->setCellPaddings(isset($colDef['content']['padding'][3]) ? $colDef['content']['padding'][3] : 0, isset($colDef['content']['padding'][0]) ? $colDef['content']['padding'][0] : 0, isset($colDef['content']['padding'][1]) ? $colDef['content']['padding'][1] : 0, isset($colDef['content']['padding'][2]) ? $colDef['content']['padding'][2] : 0);
$pdf->writeHTMLCell($colDef['width'], 2, isset($colDef['xStartPos']) ? $colDef['xStartPos'] : 0, $curY, $columnText, 0, 1, 0, true, $colDef['content']['align']);
$this->setAfterColsLinePositionsData($colKey, $pdf->GetY(), $pdf->getPage());
// restore cell padding
$pdf->setCellPaddings($curentCellPaddinds['L'], $curentCellPaddinds['T'], $curentCellPaddinds['R'], $curentCellPaddinds['B']);

View file

@ -4925,6 +4925,15 @@ abstract class CommonObject
$haschild = 0;
foreach ($arraytoscan as $table => $element) {
//print $id.'-'.$table.'-'.$elementname.'<br>';
// Check if module is enabled (to avoid error if tables of module not created)
if (isset($element['enabled']) && !empty($element['enabled'])) {
$enabled = (int) dol_eval($element['enabled'], 1);
if (empty($enabled)) {
continue;
}
}
// Check if element can be deleted
$sql = "SELECT COUNT(*) as nb";
$sql .= " FROM ".$this->db->prefix().$table." as c";
@ -6604,14 +6613,14 @@ abstract class CommonObject
* Data to describe values to insert/update are stored into $this->array_options=array('options_codeforfield1'=>'valueforfield1', 'options_codeforfield2'=>'valueforfield2', ...)
* This function delete record with all extrafields and insert them again from the array $this->array_options.
*
* @param string $trigger If defined, call also the trigger (for example COMPANY_MODIFY)
* @param string $trigger If defined, call also the trigger (for example COMPANY_MODIFY). Must be used for action 'update_extras'. For other actions, trigger is called explicitly by caller.
* @param User $userused Object user
* @return int<-1,1> -1=error, O=did nothing, 1=OK
* @see insertExtraLanguages(), updateExtraField(), deleteExtraField(), setValueFrom()
*/
public function insertExtraFields($trigger = '', $userused = null)
{
global $conf, $langs, $user;
global $langs, $user;
if (getDolGlobalString('MAIN_EXTRAFIELDS_DISABLED')) {
return 0;
@ -10335,6 +10344,7 @@ abstract class CommonObject
if (array_key_exists('date_creation', $fieldvalues) && empty($fieldvalues['date_creation'])) {
$fieldvalues['date_creation'] = $this->db->idate($now);
$this->date_creation = $this->db->idate($now);
}
if (array_key_exists('fk_user_creat', $fieldvalues) && !($fieldvalues['fk_user_creat'] > 0)) {
$fieldvalues['fk_user_creat'] = $user->id;

View file

@ -181,6 +181,12 @@ class DiscountAbsolute extends CommonObject
*/
public $type_invoice_supplier_source;
/* Customer Discount */
const TYPE_CUSTOMER = 0;
/* Supplier Discount */
const TYPE_SUPPLIER = 1;
/**
* Constructor
*

View file

@ -1213,8 +1213,8 @@ class DolGraph
$values[$x] = (is_numeric($tmpvalue) ? $tmpvalue : null);
$arrayofgroupslegend[$i] = array(
'stacknum' => (int) $tmpykey[1],
'legend' => $this->Legend[$tmpykey[1]],
'legendwithgroup' => $this->Legend[$tmpykey[1]] . ' - ' . $tmpykey[2]
'legend' => $this->Legend[$tmpykey[1]] ?? '',
'legendwithgroup' => ($this->Legend[$tmpykey[1]] ?? '') . ' - ' . $tmpykey[2]
);
} else {
$tmpvalue = (array_key_exists('y_' . $i, $valarray) ? $valarray['y_' . $i] : $valarray[$i + 1]);

View file

@ -2059,7 +2059,6 @@ class ExtraFields
}
//if ($computed) $value = // $value is already calculated into $value before calling this method
$showsize = 0;
if ($type == 'date') {
$showsize = 10;
@ -2087,9 +2086,9 @@ class ExtraFields
} elseif ($type == 'double') {
if (!empty($value)) {
//$value=price($value);
$sizeparts = explode(",", $size);
$number_decimals = array_key_exists(1, $sizeparts) ? $sizeparts[1] : 0;
$value = price($value, 0, $outputlangs, 0, 0, $number_decimals, '');
//$sizeparts = explode(",", $size);
//$number_decimals = array_key_exists(1, $sizeparts) ? $sizeparts[1] : 0;
$value = price($value, 0, $outputlangs, 0, 0, -2, '');
}
} elseif ($type == 'boolean') {
$checked = '';

View file

@ -232,7 +232,7 @@ class HookManager
// Define type of hook ('output' or 'addreplace').
$hooktype = 'addreplace';
// TODO Remove hooks with type 'output' (example createFrom). All hooks must be converted into 'addreplace' hooks.
// TODO Remove hooks with type 'output' (example createFrom). All these hooks must be converted into 'addreplace' hooks.
if (in_array($method, array(
'createFrom',
'dashboardAccountancy',

View file

@ -1149,15 +1149,16 @@ class Form
* Return list of types of lines (product or service)
* Example: 0=product, 1=service, 9=other (for external module)
*
* @param string $selected Preselected type
* @param string $htmlname Name of field in html form
* @param int<0,1>|string $showempty Add an empty field
* @param int $hidetext Do not show label 'Type' before combo box (used only if there is at least 2 choices to select)
* @param integer $forceall 1=Force to show products and services in combo list, whatever are activated modules, 0=No force, 2=Force to show only Products, 3=Force to show only services, -1=Force none (and set hidden field to 'service')
* @param string $morecss More css
* @param string $selected Preselected type
* @param string $htmlname Name of field in html form
* @param int<0,1>|string $showempty Add an empty field
* @param int $hidetext Do not show label 'Type' before combo box (used only if there is at least 2 choices to select)
* @param integer $forceall 1=Force to show products and services in combo list, whatever are activated modules, 0=No force, 2=Force to show only Products, 3=Force to show only services, -1=Force none (and set hidden field to 'service')
* @param string $morecss More css
* @param int $useajaxcombo 1=Use ajaxcombo
* @return void
*/
public function select_type_of_lines($selected = '', $htmlname = 'type', $showempty = 0, $hidetext = 0, $forceall = 0, $morecss = "")
public function select_type_of_lines($selected = '', $htmlname = 'type', $showempty = 0, $hidetext = 0, $forceall = 0, $morecss = "", $useajaxcombo = 1)
{
// phpcs:enable
global $langs;
@ -1166,11 +1167,11 @@ class Form
if ($forceall == 1 || (empty($forceall) && isModEnabled("product") && isModEnabled("service"))
|| (empty($forceall) && !isModEnabled('product') && !isModEnabled('service'))) {
if (empty($hidetext)) {
print $langs->trans("Type") . ': ';
print $langs->trans("Type").'...';
}
print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_' . $htmlname . '" name="' . $htmlname . '">';
if ($showempty) {
print '<option value="-1"';
print '<option value="-1" class="opacitymedium"'.($useajaxcombo ? '' : ' disabled="disabled"');
if ($selected == -1) {
print ' selected';
}
@ -1196,7 +1197,10 @@ class Form
print '>' . $langs->trans("Service");
print '</select>';
print ajax_combobox('select_' . $htmlname);
if ($useajaxcombo) {
print ajax_combobox('select_' . $htmlname);
}
//if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
}
if ((empty($forceall) && !isModEnabled('product') && isModEnabled("service")) || $forceall == 3) {
@ -2228,7 +2232,17 @@ class Form
$sql .= " AND u.fk_soc IS NULL";
}
if (!empty($morefilter)) {
$sql .= " " . $morefilter;
$errormessage = '';
$sql .= forgeSQLFromUniversalSearchCriteria($morefilter, $errormessage);
if ($errormessage) {
$this->errors[] = $errormessage;
dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
if ($outputmode == 0) {
return 'Error bad param $morefilter';
} else {
return array();
}
}
}
//Add hook to filter on user (for example on usergroup define in custom modules)
@ -2425,28 +2439,29 @@ class Form
* Return select list of users. Selected users are stored into session.
* List of users are provided into $_SESSION['assignedtouser'].
*
* @param string $action Value for $action
* @param string $htmlname Field name in form
* @param int<0,1> $show_empty 0=list without the empty value, 1=add empty value
* @param int[] $exclude Array list of users id to exclude
* @param int<0,1> $disabled If select list must be disabled
* @param int[]|string $include Array list of users id to include or 'hierarchy' to have only supervised users
* @param int[]|int $enableonly Array list of users id to be enabled. All other must be disabled
* @param string $force_entity '0' or Ids of environment to force
* @param int $maxlength Maximum length of string into list (0=no limit)
* @param int<0,1> $showstatus 0=show user status only if status is disabled, 1=always show user status into label, -1=never show user status
* @param string $morefilter Add more filters into sql request
* @param int $showproperties Show properties of each attendees
* @param int[] $listofuserid Array with properties of each user
* @param int[] $listofcontactid Array with properties of each contact
* @param int[] $listofotherid Array with properties of each other contact
* @return string HTML select string
* @param string $action Value for $action
* @param string $htmlname Field name in form
* @param int<0,1> $show_empty 0=list without the empty value, 1=add empty value
* @param int[] $exclude Array list of users id to exclude
* @param int<0,1> $disabled If select list must be disabled
* @param int[]|''|'hierarchy'|'hierarchyme' $include Array list of users id to include or 'hierarchy' to have only supervised users
* @param int[]|int $enableonly Array list of users id to be enabled. All other must be disabled
* @param string $force_entity '0' or Ids of environment to force
* @param int $maxlength Maximum length of string into list (0=no limit)
* @param int<0,1> $showstatus 0=show user status only if status is disabled, 1=always show user status into label, -1=never show user status
* @param string $morefilter Add more filters into sql request (Example: '(employee:=:1)'). This value must not come from user input.
* @param int $showproperties Show properties of each attendees
* @param int[] $listofuserid Array with properties of each user
* @param int[] $listofcontactid Array with properties of each contact
* @param int[] $listofotherid Array with properties of each other contact
* @param int $canremoveowner 1 if we can remove owner, 0=no way
* @return string HTML select string
* @see select_dolgroups()
*/
public function select_dolusers_forevent($action = '', $htmlname = 'userid', $show_empty = 0, $exclude = null, $disabled = 0, $include = array(), $enableonly = array(), $force_entity = '0', $maxlength = 0, $showstatus = 0, $morefilter = '', $showproperties = 0, $listofuserid = array(), $listofcontactid = array(), $listofotherid = array())
public function select_dolusers_forevent($action = '', $htmlname = 'userid', $show_empty = 0, $exclude = null, $disabled = 0, $include = array(), $enableonly = array(), $force_entity = '0', $maxlength = 0, $showstatus = 0, $morefilter = '', $showproperties = 0, $listofuserid = array(), $listofcontactid = array(), $listofotherid = array(), $canremoveowner = 1)
{
// phpcs:enable
global $langs;
global $langs, $user;
$userstatic = new User($this->db);
$out = '';
@ -2479,8 +2494,25 @@ class Form
$ownerid = $value['id'];
$out .= ' (' . $langs->trans("Owner") . ')';
}
// Add picto to delete owner/assignee
if ($nbassignetouser > 1 && $action != 'view') {
$out .= ' <input type="image" style="border: 0px;" src="' . img_picto($langs->trans("Remove"), 'delete', '', 0, 1) . '" value="' . $userstatic->id . '" class="removedassigned reposition" id="removedassigned_' . $userstatic->id . '" name="removedassigned_' . $userstatic->id . '">';
$canremoveassignee = 1;
if ($i == 0) {
// We are on the owner of the event
if (!$canremoveowner) {
$canremoveassignee = 0;
}
if (!$user->hasRight('agenda', 'allactions', 'create')) {
$canremoveassignee = 0; // Can't remove the owner
}
} else {
// We are not on the owner of the event but on a secondary assignee
}
if ($canremoveassignee) {
// If user has all permission, he should be ableto remove a assignee.
// If user has not all permission, he can onlyremove assignee of other (he can't remove itself)
$out .= ' <input type="image" style="border: 0px;" src="' . img_picto($langs->trans("Remove"), 'delete', '', 0, 1) . '" value="' . $userstatic->id . '" class="removedassigned reposition" id="removedassigned_' . $userstatic->id . '" name="removedassigned_' . $userstatic->id . '">';
}
}
// Show my availability
if ($showproperties) {
@ -7271,7 +7303,7 @@ class Form
// Input area to enter date manually
$retstring .= '<input id="' . $prefix . '" name="' . $prefix . '" type="text" class="maxwidthdate center" maxlength="11" value="' . $formated_date . '"';
$retstring .= ($disabled ? ' disabled' : '');
$retstring .= ' onChange="dpChangeDay(\'' . $prefix . '\',\'' . $langs->trans("FormatDateShortJavaInput") . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
$retstring .= ' onChange="dpChangeDay(\'' . dol_escape_js($prefix) . '\',\'' . dol_escape_js($langs->trans("FormatDateShortJavaInput")) . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
$retstring .= ' autocomplete="off">';
// Icon calendar
@ -7404,6 +7436,7 @@ class Form
$hourend = $hourstart;
}
}
// Show hour
$retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'hour' : '') . '" id="' . $prefix . 'hour" name="' . $prefix . 'hour">';
if ($emptyhours) {
@ -7426,7 +7459,7 @@ class Form
if ($m) {
// Show minutes
$retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'min' : '') . '" id="' . $prefix . 'min" name="' . $prefix . 'min">';
$retstring .= '<select ' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'min' : '') . '" id="' . $prefix . 'min" name="' . $prefix . 'min">';
if ($emptyhours) {
$retstring .= '<option value="-1">&nbsp;</option>';
}
@ -7444,7 +7477,7 @@ class Form
}
// Add a "Now" link
if (!empty($conf->use_javascript_ajax) && $addnowlink) {
if (!empty($conf->use_javascript_ajax) && $addnowlink && !$disabled) {
// Script which will be inserted in the onClick of the "Now" link
$reset_scripts = "";
if ($addnowlink == 2) { // local computer time
@ -7531,7 +7564,7 @@ class Form
}
// Add a "Plus one hour" link
if ($conf->use_javascript_ajax && $addplusone) {
if ($conf->use_javascript_ajax && $addplusone && !$disabled) {
// Script which will be inserted in the onClick of the "Add plusone" link
$reset_scripts = "";
@ -7569,7 +7602,7 @@ class Form
}
// Add a link to set data
if ($conf->use_javascript_ajax && !empty($adddateof)) {
if ($conf->use_javascript_ajax && !empty($adddateof) && !$disabled) {
if (!is_array($adddateof)) {
$arrayofdateof = array(array('adddateof' => $adddateof, 'labeladddateof' => $labeladddateof));
} else {
@ -10539,7 +10572,7 @@ class Form
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return select list of groups
* Return select list of user groups
*
* @param int|object|object[] $selected Id group or group(s) preselected
* @param string $htmlname Field name in form

View file

@ -840,39 +840,6 @@ class FormFile
$morecss = 'maxwidth100';
}
$out .= $form->selectarray('model', $modellist, $modelselected, $showempty, 0, 0, '', 0, 0, 0, '', $morecss, 1, '', 0, 0);
// script for select the separator
/* TODO This must appear on export feature only
$out .= '<label class="forhide" for="delimiter">Delimiter:</label>';
$out .= '<input type="radio" class="testinput forhide" name="delimiter" value="," id="comma" checked><label class="forhide" for="comma">,</label>';
$out .= '<input type="radio" class="testinput forhide" name="delimiter" value=";" id="semicolon"><label class="forhide" for="semicolon">;</label>';
$out .= '<script>
jQuery(document).ready(function() {
$(".selectformat").on("change", function() {
var separator;
var selected = $(this).val();
if (selected == "excel2007" || selected == "tsv") {
$("input.testinput").prop("disabled", true);
$(".forhide").hide();
} else {
$("input.testinput").prop("disabled", false);
$(".forhide").show();
}
if ($("#semicolon").is(":checked")) {
separator = ";";
} else {
separator = ",";
}
});
if ("' . $conf->global->EXPORT_CSV_SEPARATOR_TO_USE . '" == ";") {
$("#semicolon").prop("checked", true);
} else {
$("#comma").prop("checked", true);
}
});
</script>';
*/
if ($conf->use_javascript_ajax) {
$out .= ajax_combobox('model');
}
@ -1420,7 +1387,7 @@ class FormFile
// Show title of list of existing files
$morehtmlright = '';
if (!empty($moreoptions['showhideaddbutton']) && $conf->use_javascript_ajax) {
$tmpurlforbutton = 'javascript:console.log("open add file form");jQuery(".divattachnewfile").toggle(); if (!jQuery(".divattachnewfile").is(":hidden")) { jQuery("input[type=\'file\']").click(); }';
$tmpurlforbutton = 'javascript:console.log("open add file form");jQuery(".divattachnewfile").toggle(); if (!jQuery(".divattachnewfile").is(":hidden")) { jQuery("input[type=\'file\']").click();}void(0);';
$morehtmlright .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', $tmpurlforbutton, '', $permtoeditline);
}
@ -2254,7 +2221,7 @@ class FormFile
$morehtmlright = '';
if (!empty($moreoptions['showhideaddbutton']) && $conf->use_javascript_ajax) {
$morehtmlright .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', 'javascript:console.log("open addlink form"); jQuery(".divlinkfile").toggle();', '', $permissiontoedit);
$morehtmlright .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', 'javascript:console.log("open addlink form"); jQuery(".divlinkfile").toggle(); void(0);', '', $permissiontoedit);
}
// Show list of associated links

View file

@ -1331,12 +1331,25 @@ class FormSetupItem
public function generateOutputFieldColor()
{
global $langs;
$out = '';
$this->fieldAttr['disabled'] = null;
$color = colorArrayToHex(colorStringToArray($this->fieldValue, array()), '');
if ($color) {
return '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
$useDefaultColor = false;
if (!$color && !empty($this->defaultFieldValue)) {
$color = $this->defaultFieldValue;
$useDefaultColor = true;
}
return $langs->trans("Default");
if ($color) {
$out.= '<input type="color" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; " value="#'.$color.'">';
}
if ($useDefaultColor) {
$out.= ' '.$langs->trans("Default");
} else {
$out.= ' #'.$color;
}
return $out;
}
/**
* generateInputFieldColor

View file

@ -895,7 +895,7 @@ class FormTicket
$ticketstat->loadCacheTypesTickets();
print '<select id="select'.$htmlname.'" class="flat minwidth100'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.($multiselect ? '[]' : '').'"'.($multiselect ? ' multiple' : '').'>';
if ($empty) {
if ($empty && !$multiselect) {
print '<option value="">'.((is_numeric($empty) || $empty == 'ifone') ? '&nbsp;' : $empty).'</option>';
}
@ -932,7 +932,7 @@ class FormTicket
print ' selected="selected"';
} elseif (in_array($id, $selected)) {
print ' selected="selected"';
} elseif ($arraytypes['use_default'] == "1" && empty($selected)) {
} elseif ($arraytypes['use_default'] == "1" && empty($selected) && !$multiselect) {
print ' selected="selected"';
} elseif (count($ticketstat->cache_types_tickets) == 1 && (!$empty || $empty == 'ifone')) { // If only 1 choice, we autoselect it
print ' selected="selected"';

View file

@ -629,17 +629,17 @@ class Translate
$newstr = $key;
$reg = array();
if (preg_match('/^Civility([0-9A-Z]+)$/i', $key, $reg)) {
if (preg_match('/^Civility([0-9A-Z_]+)$/i', $key, $reg)) {
$newstr = $this->getLabelFromKey($db, $reg[1], 'c_civility', 'code', 'label');
} elseif (preg_match('/^Currency([A-Z][A-Z][A-Z])$/i', $key, $reg)) {
$newstr = $this->getLabelFromKey($db, $reg[1], 'c_currencies', 'code_iso', 'label');
} elseif (preg_match('/^SendingMethod([0-9A-Z]+)$/i', $key, $reg)) {
} elseif (preg_match('/^SendingMethod([0-9A-Z_]+)$/i', $key, $reg)) {
$newstr = $this->getLabelFromKey($db, $reg[1], 'c_shipment_mode', 'code', 'libelle');
} elseif (preg_match('/^PaymentType(?:Short)?([0-9A-Z]+)$/i', $key, $reg)) {
} elseif (preg_match('/^PaymentType(?:Short)?([0-9A-Z_]+)$/i', $key, $reg)) {
$newstr = $this->getLabelFromKey($db, $reg[1], 'c_paiement', 'code', 'libelle', '', 1);
} elseif (preg_match('/^OppStatus([0-9A-Z]+)$/i', $key, $reg)) {
} elseif (preg_match('/^OppStatus([0-9A-Z_]+)$/i', $key, $reg)) {
$newstr = $this->getLabelFromKey($db, $reg[1], 'c_lead_status', 'code', 'label');
} elseif (preg_match('/^OrderSource([0-9A-Z]+)$/i', $key, $reg)) {
} elseif (preg_match('/^OrderSource([0-9A-Z_]+)$/i', $key, $reg)) {
// TODO OrderSourceX must be replaced with content of table llx_c_input_reason or llx_c_input_method
//$newstr=$this->getLabelFromKey($db,$reg[1],'llx_c_input_reason','code','label');
}

View file

@ -282,7 +282,7 @@ if (!class_exists('MenuManager')) {
$menufound = 0;
$dirmenus = array_merge(array("/core/menus/"), (array) $conf->modules_parts['menus']);
foreach ($dirmenus as $dirmenu) {
$menufound = dol_include_once($dirmenu."standard/".$file_menu);
$menufound = dol_include_once($dirmenu."standard/".dol_sanitizeFileName($file_menu));
if ($menufound) {
break;
}
@ -290,7 +290,7 @@ if (!class_exists('MenuManager')) {
if (!$menufound) { // If failed to include, we try with standard
dol_syslog("You define a menu manager '".$file_menu."' that can not be loaded.", LOG_WARNING);
$file_menu = 'eldy_menu.php';
include_once DOL_DOCUMENT_ROOT."/core/menus/standard/".$file_menu;
include_once DOL_DOCUMENT_ROOT."/core/menus/standard/".dol_sanitizeFileName($file_menu);
}
}
// @phan-suppress-next-line PhanRedefinedClassReference

View file

@ -222,37 +222,59 @@ function getObjectFromID(id){
return theObject;
}
// Called after selection of a date to save details into detailed fields
// Called after the selection or typing of a date to save details into detailed fields
function dpChangeDay(dateFieldID, format)
{
//showDP.datefieldID=dateFieldID;
console.log("Call dpChangeDay, we save date into detailed fields from format = "+format);
var thefield=getObjectFromID(dateFieldID);
var thefieldday=getObjectFromID(dateFieldID+"day");
var thefieldmonth=getObjectFromID(dateFieldID+"month");
var thefieldyear=getObjectFromID(dateFieldID+"year");
var thefield = getObjectFromID(dateFieldID);
var thefieldday = getObjectFromID(dateFieldID+"day");
var thefieldmonth = getObjectFromID(dateFieldID+"month");
var thefieldyear = getObjectFromID(dateFieldID+"year");
var date=getDateFromFormat(thefield.value, format);
var date = getDateFromFormat(thefield.value, format);
//console.log(date);
if (date)
{
thefieldday.value=date.getDate();
if(thefieldday.onchange) thefieldday.onchange.call(thefieldday);
thefieldmonth.value=date.getMonth()+1;
if(thefieldmonth.onchange) thefieldmonth.onchange.call(thefieldmonth);
thefieldyear.value=date.getFullYear();
if(thefieldyear.onchange) thefieldyear.onchange.call(thefieldyear);
thefieldday.value = date.getDate();
if (thefieldday.onchange) thefieldday.onchange.call(thefieldday);
thefieldmonth.value = date.getMonth()+1;
if (thefieldmonth.onchange) thefieldmonth.onchange.call(thefieldmonth);
thefieldyear.value = date.getFullYear();
if (thefieldyear.onchange) thefieldyear.onchange.call(thefieldyear);
return 1;
}
else
{
thefieldday.value='';
if(thefieldday.onchange) thefieldday.onchange.call(thefieldday);
thefieldmonth.value='';
if(thefieldmonth.onchange) thefieldmonth.onchange.call(thefieldmonth);
thefieldyear.value='';
if(thefieldyear.onchange) thefieldyear.onchange.call(thefieldyear);
// Replace yyyy into yy
newformat = format.replace(/yyyy/g, 'yy');
if (newformat != format) {
console.log("dpChangeDay, we try now from format = "+newformat);
var date = getDateFromFormat(thefield.value, newformat);
//console.log(date);
if (date)
{
thefieldday.value = date.getDate();
if (thefieldday.onchange) thefieldday.onchange.call(thefieldday);
thefieldmonth.value = date.getMonth()+1;
if (thefieldmonth.onchange) thefieldmonth.onchange.call(thefieldmonth);
thefieldyear.value = date.getFullYear();
if (thefieldyear.onchange) thefieldyear.onchange.call(thefieldyear);
return 2;
}
}
thefieldday.value = '';
if (thefieldday.onchange) thefieldday.onchange.call(thefieldday);
thefieldmonth.value = '';
if (thefieldmonth.onchange) thefieldmonth.onchange.call(thefieldmonth);
thefieldyear.value = '';
if (thefieldyear.onchange) thefieldyear.onchange.call(thefieldyear);
return 0;
}
/*
@ -337,13 +359,13 @@ function formatDate(date,format)
* Licence: GPL
* ==================================================================
*/
function getDateFromFormat(val,format)
function getDateFromFormat(val, format)
{
// alert('getDateFromFormat val='+val+' format='+format);
// Force parameters en chaine
val=val+"";
format=format+"";
val = val+"";
format = format+"";
if (val == '') return 0;
@ -356,17 +378,14 @@ function getDateFromFormat(val,format)
var seconde=now.getSeconds();
var i=0;
var d=0; // -d- follows the date string while -i- follows the format
// string
var d=0; // -d- follows the date string while -i- follows the format string
while (i < format.length)
{
c=format.charAt(i); // Recupere char du format
substr="";
j=i;
while ((format.charAt(j)==c) && (j < format.length)) // Recupere char
// successif
// identiques
while ((format.charAt(j)==c) && (j < format.length)) // Get successive similar characters
{
substr += format.charAt(j++);
}
@ -1538,11 +1557,13 @@ if (!getDolGlobalString('MAIN_DISABLE_SELECT2_FOCUS_PROTECTION') && !defined('DI
* TODO: Recheck with the select2 GH issue and remove once this is fixed on their side
*/
$(document).on('select2:open', (e) => {
console.log("Execute the focus (click on combo or use space when on component");
console.log("Execute the focus (click on combo or use space when on component)");
const target = $(e.target);
if (target && target.length) {
let id = target[0].id || target[0].name;
if (id.substr(-2) == "[]") id = id.substr(0,id.length-2);
if (id.substr(-2) == "[]") {
id = id.substr(0,id.length-2);
}
document.querySelector('input[aria-controls*='+id+']').focus();
}
});

View file

@ -1641,14 +1641,19 @@ function dol_delete_dir($dir, $nophperrors = 0)
* @param int $onlysub Delete only files and subdir, not main directory
* @param int $countdeleted Counter to count nb of elements found really deleted
* @param int $indexdatabase Try to remove also index entries.
* @param int $nolog Disable log files (too verbose when making recursive directories)
* @param int $nolog 1=Disable log for files and subdirectories (too verbose when making recursive directories)
* @param int $level 0 = level or recursivity
* @return int Number of files and directory we try to remove. NB really removed is returned into var by reference $countdeleted.
*/
function dol_delete_dir_recursive($dir, $count = 0, $nophperrors = 0, $onlysub = 0, &$countdeleted = 0, $indexdatabase = 1, $nolog = 0)
function dol_delete_dir_recursive($dir, $count = 0, $nophperrors = 0, $onlysub = 0, &$countdeleted = 0, $indexdatabase = 1, $nolog = 0, $level = 0)
{
if (empty($nolog)) {
if (empty($nolog) || empty($level)) {
dol_syslog("functions.lib:dol_delete_dir_recursive ".$dir, LOG_DEBUG);
}
if ($level > 1000) {
dol_syslog("functions.lib:dol_delete_dir_recursive too many depth", LOG_WARNING);
}
if (dol_is_dir($dir)) {
$dir_osencoded = dol_osencode($dir);
if ($handle = opendir("$dir_osencoded")) {
@ -1659,7 +1664,7 @@ function dol_delete_dir_recursive($dir, $count = 0, $nophperrors = 0, $onlysub =
if ($item != "." && $item != "..") {
if (is_dir(dol_osencode("$dir/$item")) && !is_link(dol_osencode("$dir/$item"))) {
$count = dol_delete_dir_recursive("$dir/$item", $count, $nophperrors, 0, $countdeleted, $indexdatabase, $nolog);
$count = dol_delete_dir_recursive("$dir/$item", $count, $nophperrors, 0, $countdeleted, $indexdatabase, $nolog, ($level + 1));
} else {
$result = dol_delete_file("$dir/$item", 1, $nophperrors, 0, null, false, $indexdatabase, $nolog);
$count++;
@ -2485,7 +2490,7 @@ function dol_compress_file($inputfile, $outputfile, $mode = "gz", &$errorstring
if (defined('ODTPHP_PATHTOPCLZIP')) {
$foundhandler = 1;
include_once ODTPHP_PATHTOPCLZIP.'/pclzip.lib.php';
include_once ODTPHP_PATHTOPCLZIP.'pclzip.lib.php';
$archive = new PclZip($outputfile);
$result = $archive->add($inputfile, PCLZIP_OPT_REMOVE_PATH, dirname($inputfile));
@ -2552,7 +2557,7 @@ function dol_uncompress($inputfile, $outputdir)
if ($fileinfo["extension"] == "zip") {
if (defined('ODTPHP_PATHTOPCLZIP') && !getDolGlobalString('MAIN_USE_ZIPARCHIVE_FOR_ZIP_UNCOMPRESS')) {
dol_syslog("Constant ODTPHP_PATHTOPCLZIP for pclzip library is set to ".ODTPHP_PATHTOPCLZIP.", so we use Pclzip to unzip into ".$outputdir);
include_once ODTPHP_PATHTOPCLZIP.'/pclzip.lib.php';
include_once ODTPHP_PATHTOPCLZIP.'pclzip.lib.php';
$archive = new PclZip($inputfile);
// We create output dir manually, so it uses the correct permission (When created by the archive->extract, dir is rwx for everybody).

View file

@ -10587,6 +10587,7 @@ function dol_eval($s, $returnvalue = 1, $hideerrors = 1, $onlysimplestring = '1'
while ($scheck && $savescheck != $scheck) {
$savescheck = $scheck;
$scheck = preg_replace('/->[a-zA-Z0-9_]+\(/', '->__METHOD__', $scheck); // accept parenthesis in '...->method(...'
$scheck = preg_replace('/::[a-zA-Z0-9_]+\(/', '->__METHOD__', $scheck); // accept parenthesis in '...::method(...'
$scheck = preg_replace('/^\(/', '__PARENTHESIS__ ', $scheck); // accept parenthesis in '(...'. Must replace with __PARENTHESIS__ with a space after to allow following substitutions
$scheck = preg_replace('/\s\(/', '__PARENTHESIS__ ', $scheck); // accept parenthesis in '... (' like in 'if ($a == 1)'. Must replace with __PARENTHESIS__ with a space after to allow following substitutions
$scheck = preg_replace('/^!?[a-zA-Z0-9_]+\(/', '__FUNCTION__', $scheck); // accept parenthesis in 'function(' and '!function('
@ -10647,22 +10648,26 @@ function dol_eval($s, $returnvalue = 1, $hideerrors = 1, $onlysimplestring = '1'
$forbiddenphpstrings = array('$$', '$_', '}[');
$forbiddenphpstrings = array_merge($forbiddenphpstrings, array('_ENV', '_SESSION', '_COOKIE', '_GET', '_POST', '_REQUEST', 'ReflectionFunction'));
// We list all forbidden function as keywords we don't want to see (we don't mind it if is "kewyord(" or just "keyword", we don't want "keyword" at all)
$forbiddenphpfunctions = array();
// @phpcs:ignore
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("base64"."_"."decode", "rawurl"."decode", "url"."decode", "str"."_rot13", "hex"."2bin")); // name of forbidden functions are split to avoid false positive
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("fopen", "file_put_contents", "fputs", "fputscsv", "fwrite", "fpassthru", "require", "include", "mkdir", "rmdir", "symlink", "touch", "unlink", "umask"));
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("override_function", "session_id", "session_create_id", "session_regenerate_id"));
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("get_defined_functions", "get_defined_vars", "get_defined_constants", "get_declared_classes"));
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("function", "call_user_func"));
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("function", "call_user_func", "call_user_func_array"));
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("require", "include", "require_once", "include_once"));
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("exec", "passthru", "shell_exec", "system", "proc_open", "popen"));
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("dol_eval", "executeCLI", "verifCond")); // native dolibarr functions
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("eval", "create_function", "assert", "mb_ereg_replace")); // function with eval capabilities
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("dol_compress_dir", "dol_decode", "dol_delete_file", "dol_delete_dir", "dol_delete_dir_recursive", "dol_copy", "archiveOrBackupFile")); // more dolibarr functions
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("fopen", "file_put_contents", "fputs", "fputscsv", "fwrite", "fpassthru", "mkdir", "rmdir", "symlink", "touch", "unlink", "umask"));
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("require", "include"));
$forbiddenphpmethods = array('invoke', 'invokeArgs'); // Method of ReflectionFunction to execute a function
$forbiddenphpregex = 'global\s+\$|\b('.implode('|', $forbiddenphpfunctions).')\b';
$forbiddenphpregex = 'global\s*\$';
$forbiddenphpregex .= '|';
$forbiddenphpregex .= '\b('.implode('|', $forbiddenphpfunctions).')\b';
$forbiddenphpmethodsregex = '->('.implode('|', $forbiddenphpmethods).')';
@ -11734,7 +11739,7 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0)
*/
function showDirectDownloadLink($object)
{
global $conf, $langs;
global $langs;
$out = '';
$url = $object->getLastMainDocLink($object->element);
@ -11846,6 +11851,25 @@ function getAdvancedPreviewUrl($modulepart, $relativepath, $alldata = 0, $param
}
}
/**
* Make content of an input box selected when we click into input field.
*
* @param int $idcode Id of special code
* @return string
*/
function getLabelSpecialCode($idcode)
{
global $langs;
$arrayspecialines = array(1 => 'Transport', 2 => 'EcoTax', 3 => 'Option');
if ($idcode > 10) {
return 'Module ID '.$idcode;
}
if (!empty($arrayspecialines[$idcode])) {
return $langs->trans($arrayspecialines[$idcode]);
}
return '';
}
/**
* Make content of an input box selected when we click into input field.

View file

@ -63,10 +63,11 @@ $shmoffset = 1000; // Max number of entries found into a language file. If too l
* @param string $memoryid Memory id of shared area
* @param mixed $data Data to save. It must not be a null value.
* @param int $expire ttl in seconds, 0 never expire
* @param int $filecache 1 Enable file cache if no other session cache available, 0 Disabled (default)
* @return int Return integer <0 if KO, 0 if nothing is done, Nb of bytes written if OK
* @see dol_getcache()
*/
function dol_setcache($memoryid, $data, $expire = 0)
function dol_setcache($memoryid, $data, $expire = 0, $filecache = 0)
{
global $conf;
@ -124,6 +125,31 @@ function dol_setcache($memoryid, $data, $expire = 0)
} elseif (getDolGlobalInt('MAIN_OPTIMIZE_SPEED') & 0x02) { // This is a really not reliable cache ! Use Memcached instead.
// Using shmop
$result = dol_setshmop($memoryid, $data, $expire);
} elseif ($filecache > 0) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
$now = dol_now();
$memoryid = session_name().'_'.$memoryid;
$dircache = 'dolcache';
$pathcache = DOL_DATA_ROOT.'/'.$dircache;
if (!dol_is_dir($pathcache)) {
$result = dol_mkdir($pathcache);
if ($result < 0) {
return $result;
}
}
if ($expire != 0) {
$expire = dol_time_plus_duree($now, $expire, 's');
}
$cachedata = array("expire" => $expire, "data" => $data);
$cachejson = dolEncrypt(json_encode($cachedata));
if (!dol_is_file($pathcache.'/'.$memoryid.'.cache')) {
$result = file_put_contents($pathcache.'/'.$memoryid.'.cache', $cachejson);
} else {
return 0;
}
} else {
// No intersession cache system available, we use at least the perpage cache
$conf->cache['cachememory_'.$memoryid] = $data;
@ -137,10 +163,11 @@ function dol_setcache($memoryid, $data, $expire = 0)
* Read a memory area shared by all users, all sessions on server
*
* @param string $memoryid Memory id of shared area
* @param int $filecache 1 Enable file cache if no other session cache available, 0 Disabled (default)
* @return int|mixed Return integer <0 if KO, data if OK, null if not found into cache or no caching feature enabled
* @see dol_setcache()
*/
function dol_getcache($memoryid)
function dol_getcache($memoryid, $filecache = 0)
{
global $conf;
@ -203,6 +230,31 @@ function dol_getcache($memoryid)
// Using shmop
$data = dol_getshmop($memoryid);
return $data;
} elseif ($filecache > 0) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
$now = dol_now();
$memoryid = session_name().'_'.$memoryid;
$dircache = 'dolcache';
$pathcache = DOL_DATA_ROOT.'/'.$dircache;
if (!dol_is_file($pathcache.'/'.$memoryid.'.cache')) {
return null;
}
$data = file_get_contents($pathcache.'/'.$memoryid.'.cache');
if (!$data) {
return -1;
}
$json = json_decode(dolDecrypt($data));
if ($json->expire > $now) {
return $json->data;
} else {
$result = dol_delete_file($pathcache.'/'.$memoryid.'.cache');
if (!$result) {
return -2;
}
}
return null;
} else {
// No intersession cache system available, we use at least the perpage cache
if (isset($conf->cache['cachememory_'.$memoryid])) {

View file

@ -2629,8 +2629,11 @@ function pdf_getLinkedObjects(&$object, $outputlangs)
if (is_object($hookmanager)) {
$parameters = array('linkedobjects' => $linkedobjects, 'outputlangs' => $outputlangs);
$action = '';
$hookmanager->executeHooks('pdf_getLinkedObjects', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if (!empty($hookmanager->resArray)) {
$reshook = $hookmanager->executeHooks('pdf_getLinkedObjects', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook)) {
$linkedobjects = array_replace($linkedobjects, $hookmanager->resArray); // array_replace is used to preserve keys
} elseif ($reshook>0) {
// The array must be reinserted even if it is empty because clearing the array could be one of the actions performed by the hook.
$linkedobjects = $hookmanager->resArray;
}
}

View file

@ -694,8 +694,8 @@ function showWebsiteTemplates(Website $website)
/**
* Check a new string containing only php code (including <php tag)
* - Block if bad code in the new string.
* - Block also if user has no permission to change PHP code.
* - Block if user has no permission to change PHP code.
* - Block also if bad code found in the new string.
*
* @param string $phpfullcodestringold PHP old string (before the change). For example "<?php echo 'a' ?><php echo 'b' ?>"
* @param string $phpfullcodestring PHP new string. For example "<?php echo 'a' ?><php echo 'c' ?>"
@ -722,13 +722,15 @@ function checkPHPCode(&$phpfullcodestringold, &$phpfullcodestring)
// Then check forbidden commands
if (!$error) {
$forbiddenphpstrings = array('$$', '}[');
$forbiddenphpstrings = array_merge($forbiddenphpstrings, array('ReflectionFunction'));
$forbiddenphpstrings = array('$$', '$_', '}[');
//$forbiddenphpstrings = array_merge($forbiddenphpstrings, array('_ENV', '_SESSION', '_COOKIE', '_GET', '_POST', '_REQUEST', 'ReflectionFunction'));
$forbiddenphpstrings = array_merge($forbiddenphpstrings, array('_ENV', 'ReflectionFunction'));
$forbiddenphpfunctions = array();
//$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("base64"."_"."decode", "rawurl"."decode", "url"."decode", "str"."_rot13", "hex"."2bin")); // name of forbidden functions are split to avoid false positive
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("override_function", "session_id", "session_create_id", "session_regenerate_id"));
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("get_defined_functions", "get_defined_vars", "get_defined_constants", "get_declared_classes"));
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("call_user_func"));
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("call_user_func", "call_user_func_array"));
//$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("require", "include", "require_once", "include_once"));
if (!getDolGlobalString('WEBSITE_PHP_ALLOW_EXEC')) { // If option is not on, we disallow functions to execute commands
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("exec", "passthru", "shell_exec", "system", "proc_open", "popen"));
@ -736,27 +738,38 @@ function checkPHPCode(&$phpfullcodestringold, &$phpfullcodestring)
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("eval", "create_function", "assert", "mb_ereg_replace")); // function with eval capabilities
}
if (!getDolGlobalString('WEBSITE_PHP_ALLOW_WRITE')) { // If option is not on, we disallow functions to write files
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("dol_compress_dir", "dol_decode", "dol_delete_file", "dol_delete_dir", "dol_delete_dir_recursive", "dol_copy", "archiveOrBackupFile")); // more dolibarr functions
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("fopen", "file_put_contents", "fputs", "fputscsv", "fwrite", "fpassthru", "mkdir", "rmdir", "symlink", "touch", "unlink", "umask"));
}
//$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("require", "include"));
$forbiddenphpmethods = array('invoke', 'invokeArgs'); // Method of ReflectionFunction to execute a function
foreach ($forbiddenphpstrings as $forbiddenphpstring) {
if (preg_match('/'.preg_quote($forbiddenphpstring, '/').'/ms', $phpfullcodestring)) {
if (preg_match('/'.preg_quote($forbiddenphpstring, '/').'/ims', $phpfullcodestring)) {
$error++;
setEventMessages($langs->trans("DynamicPHPCodeContainsAForbiddenInstruction", $forbiddenphpstring), null, 'errors');
break;
}
}
foreach ($forbiddenphpfunctions as $forbiddenphpcommand) {
if (preg_match('/'.$forbiddenphpcommand.'\s*\(/ms', $phpfullcodestring)) {
/* replaced with next block
foreach ($forbiddenphpfunctions as $forbiddenphpfunction) { // Check "function(" but also "'function'(" and "function ("
if (preg_match('/'.$forbiddenphpfunction.'[\'\s]*\(/ims', $phpfullcodestring)) {
$error++;
setEventMessages($langs->trans("DynamicPHPCodeContainsAForbiddenInstruction", $forbiddenphpcommand), null, 'errors');
setEventMessages($langs->trans("DynamicPHPCodeContainsAForbiddenInstruction", $forbiddenphpfunction), null, 'errors');
break;
}
}*/
foreach ($forbiddenphpfunctions as $forbiddenphpfunction) { // Check "function" whatever is "function(" or "function'(" or "function (" or "function"
if (preg_match('/\b'.$forbiddenphpfunction.'\b/ims', $phpfullcodestring)) {
$error++;
setEventMessages($langs->trans("DynamicPHPCodeContainsAForbiddenInstruction", $forbiddenphpfunction), null, 'errors');
break;
}
}
foreach ($forbiddenphpmethods as $forbiddenphpmethod) {
if (preg_match('/->'.$forbiddenphpmethod.'/ms', $phpfullcodestring)) {
if (preg_match('/->'.$forbiddenphpmethod.'/ims', $phpfullcodestring)) {
$error++;
setEventMessages($langs->trans("DynamicPHPCodeContainsAForbiddenInstruction", $forbiddenphpmethod), null, 'errors');
break;
@ -764,14 +777,14 @@ function checkPHPCode(&$phpfullcodestringold, &$phpfullcodestring)
}
}
// This char can be used to execute RCE for example using with echo `ls`
// This char can be used to execute RCE for example by using echo `ls`
if (!$error) {
$forbiddenphpchars = array();
if (!getDolGlobalString('WEBSITE_PHP_ALLOW_DANGEROUS_CHARS')) { // If option is not on, we disallow functions to execute commands
$forbiddenphpchars = array("`");
}
foreach ($forbiddenphpchars as $forbiddenphpchar) {
if (preg_match('/'.$forbiddenphpchar.'/ms', $phpfullcodestring)) {
if (preg_match('/'.$forbiddenphpchar.'/ims', $phpfullcodestring)) {
$error++;
setEventMessages($langs->trans("DynamicPHPCodeContainsAForbiddenInstruction", $forbiddenphpchar), null, 'errors');
break;
@ -779,23 +792,31 @@ function checkPHPCode(&$phpfullcodestringold, &$phpfullcodestring)
}
}
// Deny dynamic functions '${a}(' or '$a[b](' => So we refuse '}(' and ']('
// Deny code to call a function obfuscated with comment, like "exec/*...*/ ('ls')";
if (!$error) {
if (preg_match('/[}\]]\(/ims', $phpfullcodestring)) {
if (preg_match('/\*\/\s*\(/ims', $phpfullcodestring)) {
$error++;
setEventMessages($langs->trans("DynamicPHPCodeContainsAForbiddenInstruction", "exec/*...*/ ('ls')"), null, 'errors');
}
}
// Deny dynamic functions '${a}(' or '$a[b](' => So we refuse '}(' and ']('
if (!$error) {
if (preg_match('/[}\]]\s*\(/ims', $phpfullcodestring)) {
$error++;
setEventMessages($langs->trans("DynamicPHPCodeContainsAForbiddenInstruction", ']('), null, 'errors');
}
}
// Deny dynamic functions '$xxx('
// Deny dynamic functions '$xxx(' or '$xxx (' or '$xxx" ('
if (!$error) {
if (preg_match('/\$[a-z0-9_\-\/\*]+\(/ims', $phpfullcodestring)) {
if (preg_match('/\$[a-z0-9_\-\/\*\"]+\s*\(/ims', $phpfullcodestring)) {
$error++;
setEventMessages($langs->trans("DynamicPHPCodeContainsAForbiddenInstruction", '$...('), null, 'errors');
}
}
// No need to block $conf->global->aaa() because PHP try to run method aaa an not function into $conf->global->aaa.
// No need to block $conf->global->aaa() because PHP try to run the method aaa of $conf->global and not the function into $conf->global->aaa.
// Then check if installmodules does not block dynamic PHP code change.
if ($phpfullcodestringold != $phpfullcodestring) {

View file

@ -173,8 +173,9 @@ class pdf_standard_asset extends ModelePDFAsset
// Load translation files required by the page
$outputlangs->loadLangs(array("main", "bills", "products", "dict", "companies"));
global $outputlangsbis;
$outputlangsbis = null;
if (getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE') && $outputlangs->defaultlang != getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE')) {
global $outputlangsbis;
$outputlangsbis = new Translate('', $conf);
$outputlangsbis->setDefaultLang(getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE'));
$outputlangsbis->loadLangs(array("main", "bills", "products", "dict", "companies"));

View file

@ -70,7 +70,7 @@ class mod_asset_advanced extends ModeleNumRefAsset
$text .= '<input type="hidden" name="token" value="'.newToken().'">';
$text .= '<input type="hidden" name="action" value="updateMask">';
$text .= '<input type="hidden" name="maskconst" value="ASSET_ADVANCED_MASK">';
$text .= '<table class="nobordernopadding" width="100%">';
$text .= '<table class="nobordernopadding centpercent">';
$tooltip = $langs->trans("GenericMaskCodes", $langs->transnoentities("Asset"), $langs->transnoentities("Asset"));
$tooltip .= $langs->trans("GenericMaskCodes2");
@ -81,7 +81,7 @@ class mod_asset_advanced extends ModeleNumRefAsset
// Parametrage du prefix
$text .= '<tr><td>'.$langs->trans("Mask").':</td>';
$text .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="mask" value="'.getDolGlobalString('ASSET_ADVANCED_MASK').'">', $tooltip, 1, 1).'</td>';
$text .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="mask" value="'.getDolGlobalString('ASSET_ADVANCED_MASK').'">', $tooltip, 1, 'help', 'valignmiddle', 0, 3, $this->name).'</td>';
$text .= '<td class="left" rowspan="2">&nbsp; <input type="submit" class="button button-edit reposition smallpaddingimp" name="Button"value="'.$langs->trans("Modify").'"></td>';

View file

@ -95,7 +95,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
// Mask parameter
//$texte.= '<tr><td>'.$langs->trans("Mask").' ('.$langs->trans("BarCodeModel").'):</td>';
$texte .= '<tr><td>'.$langs->trans("Mask").':</td>';
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="value1" value="'.(getDolGlobalString('BARCODE_STANDARD_PRODUCT_MASK') ? $conf->global->BARCODE_STANDARD_PRODUCT_MASK : '').'"'.$disabled.'>', $tooltip, 1, 1).'</td>';
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="value1" value="'.getDolGlobalString('BARCODE_STANDARD_PRODUCT_MASK').'"'.$disabled.'>', $tooltip, 1, 'help', 'valignmiddle', 0, 3, $this->name).'</td>';
$texte .= '<td class="left" rowspan="2">&nbsp; <input type="submit" class="button button-edit reposition smallpaddingimp" name="modify" value="'.$langs->trans("Modify").'"'.$disabled.'></td>';
$texte .= '</tr>';

View file

@ -131,7 +131,7 @@ class mod_barcode_thirdparty_standard extends ModeleNumRefBarCode
// Mask parameter
//$texte.= '<tr><td>'.$langs->trans("Mask").' ('.$langs->trans("BarCodeModel").'):</td>';
$texte .= '<tr><td>'.$langs->trans("Mask").':</td>';
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="value1" value="'.(getDolGlobalString('BARCODE_STANDARD_THIRDPARTY_MASK') ? $conf->global->BARCODE_STANDARD_THIRDPARTY_MASK : '').'"'.$disabled.'>', $tooltip, 1, 1).'</td>';
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="value1" value="'.getDolGlobalString('BARCODE_STANDARD_THIRDPARTY_MASK').'"'.$disabled.'>', $tooltip, 1, 'help', 'valignmiddle', 0, 3, $this->name).'</td>';
$texte .= '<td class="left" rowspan="2">&nbsp; <input type="submit" class="button button-edit reposition smallpaddingimp" name="modify" value="'.$langs->trans("Modify").'"'.$disabled.'></td>';
$texte .= '</tr>';

View file

@ -82,7 +82,7 @@ class mod_bom_advanced extends ModeleNumRefBoms
// Parametrage du prefix
$texte .= '<tr><td>'.$langs->trans("Mask").':</td>';
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskBom" value="'.getDolGlobalString('BOM_ADVANCED_MASK').'">', $tooltip, 1, 1).'</td>';
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskBom" value="'.getDolGlobalString('BOM_ADVANCED_MASK').'">', $tooltip, 1, 'help', 'valignmiddle', 0, 3, $this->name).'</td>';
$texte .= '<td class="left" rowspan="2">&nbsp; <input type="submit" class="button button-edit reposition smallpaddingimp" name="Button"value="'.$langs->trans("Modify").'"></td>';

View file

@ -76,7 +76,7 @@ class mod_chequereceipt_thyme extends ModeleNumRefChequeReceipts
// Parametrage du prefix
$texte .= '<tr><td>'.$langs->trans("Mask").':</td>';
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskchequereceipts" value="' . getDolGlobalString('CHEQUERECEIPTS_THYME_MASK').'">', $tooltip, 1, 1).'</td>';
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskchequereceipts" value="' . getDolGlobalString('CHEQUERECEIPTS_THYME_MASK').'">', $tooltip, 1, 'help', 'valignmiddle', 0, 3, $this->name).'</td>';
$texte .= '<td class="left" rowspan="2">&nbsp;<input type="submit" class="button button-edit reposition smallpaddingimp" name="Button"value="'.$langs->trans("Modify").'"></td>';

View file

@ -200,10 +200,7 @@ class pdf_eratosthene extends ModelePDFCommandes
$nblines = (is_array($object->lines) ? count($object->lines) : 0);
$hidetop = 0;
if (getDolGlobalString('MAIN_PDF_DISABLE_COL_HEAD_TITLE')) {
$hidetop = getDolGlobalString('MAIN_PDF_DISABLE_COL_HEAD_TITLE');
}
$hidetop = getDolGlobalInt('MAIN_PDF_DISABLE_COL_HEAD_TITLE');
// Loop on each lines to detect if there is at least one image to show
$realpatharray = array();
@ -366,6 +363,10 @@ class pdf_eratosthene extends ModelePDFCommandes
$tab_top = 90 + $top_shift + $shipp_shift;
$tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
if (!$hidetop && getDolGlobalInt('MAIN_PDF_ENABLE_COL_HEAD_TITLE_REPEAT')) {
// TODO : make this hidden conf the default behavior for each PDF when each PDF managed this new Display
$tab_top_newpage+= $this->tabTitleHeight;
}
$tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext;
@ -549,7 +550,24 @@ class pdf_eratosthene extends ModelePDFCommandes
$pageposbeforeprintlines = $pdf->getPage();
$pagenb = $pageposbeforeprintlines;
for ($i = 0; $i < $nblines; $i++) {
$linePosition = $i + 1;
$curY = $nexY;
// in First Check line page break and add page if needed
if (isset($object->lines[$i]->pagebreak) && $object->lines[$i]->pagebreak) {
// New page
$pdf->AddPage();
if (!empty($tplidx)) {
$pdf->useTemplate($tplidx);
}
$pdf->setPage($pdf->getNumPages());
$nexY = $tab_top_newpage;
}
$this->resetAfterColsLinePositionsData($nexY, $pdf->getPage());
$pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage
$pdf->SetTextColor(0, 0, 0);
@ -560,114 +578,76 @@ class pdf_eratosthene extends ModelePDFCommandes
}
$pdf->setTopMargin($tab_top_newpage);
$pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it.
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
$pageposbefore = $pdf->getPage();
$curYBefore = $curY;
$showpricebeforepagebreak = 1;
// Allows data in the first page if description is long enough to break in multiples pages
$showpricebeforepagebreak = getDolGlobalInt('MAIN_PDF_DATA_ON_FIRST_PAGE');
$posYAfterImage = 0;
$posYAfterDescription = 0;
if ($this->getColumnStatus('photo')) {
// We start with Photo of product line
if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { // If photo too high, we moved completely on new page
$imageTopMargin = 1;
if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imageTopMargin + $imglinesize['height']) > ($this->page_hauteur - $heightforfooter)) { // If photo too high, we moved completely on new page
$pdf->AddPage('', '', true);
if (!empty($tplidx)) {
$pdf->useTemplate($tplidx);
}
$pdf->setPage($pageposbefore + 1);
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
$curY = $tab_top_newpage;
// Allows data in the first page if description is long enough to break in multiples pages
if (getDolGlobalInt('MAIN_PDF_DATA_ON_FIRST_PAGE')) {
$showpricebeforepagebreak = 1;
} else {
$showpricebeforepagebreak = 0;
}
$showpricebeforepagebreak = 0;
}
// I remove the line commented below because it probably uselesss (or bug source) no need to change bottom margin because we have checked image fit
//$pdf->setPageOrientation('', 0, $heightforfooter + $heightforfreetext); // The only function to edit the bottom margin of current page to set it.
if (!empty($this->cols['photo']) && isset($imglinesize['width']) && isset($imglinesize['height'])) {
$pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY + 1, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi
$pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY + $imageTopMargin, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi
// $pdf->Image does not increase value return by getY, so we save it manually
$posYAfterImage = $curY + $imglinesize['height'];
$this->setAfterColsLinePositionsData('photo', $posYAfterImage, $pdf->getPage());
}
}
// restore Page orientation for text
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
// Description of product line
if ($this->getColumnStatus('desc')) {
$pdf->startTransaction();
$this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc);
$pageposafter = $pdf->getPage();
if ($pageposafter > $pageposbefore) { // There is a pagebreak
$pdf->rollbackTransaction(true);
$pageposafter = $pageposbefore;
//print $pageposafter.'-'.$pageposbefore;exit;
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
$this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc);
$pageposafter = $pdf->getPage();
$posyafter = $pdf->GetY();
if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { // There is no space left for total+free text
if ($i == ($nblines - 1)) { // No more lines, and no space left to show total, so we create a new page
$pdf->AddPage('', '', true);
if (!empty($tplidx)) {
$pdf->useTemplate($tplidx);
}
$pdf->setPage($pageposafter + 1);
}
} else {
// We found a page break
// Allows data in the first page if description is long enough to break in multiples pages
if (getDolGlobalInt('MAIN_PDF_DATA_ON_FIRST_PAGE')) {
$showpricebeforepagebreak = 1;
} else {
$showpricebeforepagebreak = 0;
}
}
} else { // No pagebreak
$pdf->commitTransaction();
}
$posYAfterDescription = $pdf->GetY();
$this->setAfterColsLinePositionsData('desc', $pdf->GetY(), $pdf->getPage());
}
$nexY = max($pdf->GetY(), $posYAfterImage);
$pageposafter = $pdf->getPage();
$afterPosData = $this->getMaxAfterColsLinePositionsData();
$pdf->setPage($pageposbefore);
$pdf->setTopMargin($this->marge_haute);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
$pdf->setPageOrientation('', 0, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
// We suppose that a too long description or photo were moved completely on next page
if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
$pdf->setPage($pageposafter);
if ($afterPosData['page'] > $pageposbefore && (empty($showpricebeforepagebreak) || ($curY + 4) > ($this->page_hauteur - $heightforfooter))) {
$pdf->setPage($afterPosData['page']);
$curY = $tab_top_newpage;
}
$pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font
// # of line
// Line position
if ($this->getColumnStatus('position')) {
$this->printStdColumnContent($pdf, $curY, 'position', (string) ($i + 1));
$this->printStdColumnContent($pdf, $curY, 'position', strval($linePosition));
}
// VAT Rate
if ($this->getColumnStatus('vat')) {
$vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails);
$this->printStdColumnContent($pdf, $curY, 'vat', $vat_rate);
$nexY = max($pdf->GetY(), $nexY);
}
// Unit price before discount
if ($this->getColumnStatus('subprice')) {
$up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails);
$this->printStdColumnContent($pdf, $curY, 'subprice', $up_excl_tax);
$nexY = max($pdf->GetY(), $nexY);
}
// Quantity
@ -675,7 +655,6 @@ class pdf_eratosthene extends ModelePDFCommandes
if ($this->getColumnStatus('qty')) {
$qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails);
$this->printStdColumnContent($pdf, $curY, 'qty', $qty);
$nexY = max($pdf->GetY(), $nexY);
}
@ -683,28 +662,24 @@ class pdf_eratosthene extends ModelePDFCommandes
if ($this->getColumnStatus('unit')) {
$unit = pdf_getlineunit($object, $i, $outputlangs, $hidedetails);
$this->printStdColumnContent($pdf, $curY, 'unit', $unit);
$nexY = max($pdf->GetY(), $nexY);
}
// Discount on line
if ($this->getColumnStatus('discount') && $object->lines[$i]->remise_percent) {
$remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails);
$this->printStdColumnContent($pdf, $curY, 'discount', $remise_percent);
$nexY = max($pdf->GetY(), $nexY);
}
// Total excl tax line (HT)
if ($this->getColumnStatus('totalexcltax')) {
$total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails);
$this->printStdColumnContent($pdf, $curY, 'totalexcltax', $total_excl_tax);
$nexY = max($pdf->GetY(), $nexY);
}
// Total with tax line (TTC)
if ($this->getColumnStatus('totalincltax')) {
$total_incl_tax = pdf_getlinetotalwithtax($object, $i, $outputlangs, $hidedetails);
$this->printStdColumnContent($pdf, $curY, 'totalincltax', $total_incl_tax);
$nexY = max($pdf->GetY(), $nexY);
}
// Extrafields
@ -713,17 +688,18 @@ class pdf_eratosthene extends ModelePDFCommandes
if ($this->getColumnStatus($extrafieldColKey)) {
$extrafieldValue = $this->getExtrafieldContent($object->lines[$i], $extrafieldColKey, $outputlangs);
$this->printStdColumnContent($pdf, $curY, $extrafieldColKey, $extrafieldValue);
$nexY = max($pdf->GetY(), $nexY);
$this->setAfterColsLinePositionsData('options_'.$extrafieldColKey, $pdf->GetY(), $pdf->getPage());
}
}
}
$afterPosData = $this->getMaxAfterColsLinePositionsData();
$parameters = array(
'object' => $object,
'i' => $i,
'pdf' => & $pdf,
'curY' => & $curY,
'nexY' => & $nexY,
'nexY' => & $afterPosData['y'], // for backward module hook compatibility Y will be accessible by $object->getMaxAfterColsLinePositionsData()
'outputlangs' => $outputlangs,
'hidedetails' => $hidedetails
);
@ -785,60 +761,86 @@ class pdf_eratosthene extends ModelePDFCommandes
}
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate' => $vatrate, 'vatcode' => $vatcode, 'amount' => $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne);
$afterPosData = $this->getMaxAfterColsLinePositionsData();
$pdf->setPage($afterPosData['page']);
$nexY = $afterPosData['y'];
// Add line
if (getDolGlobalInt('MAIN_PDF_DASH_BETWEEN_LINES') && $i < ($nblines - 1)) {
$pdf->setPage($pageposafter);
if (getDolGlobalString('MAIN_PDF_DASH_BETWEEN_LINES') && $i < ($nblines - 1) && $afterPosData['y'] < $this->page_hauteur - $heightforfooter - 5) {
$pdf->SetLineStyle(array('dash' => '1,1', 'color' => array(80, 80, 80)));
//$pdf->SetDrawColor(190,190,200);
$pdf->line($this->marge_gauche, $nexY, $this->page_largeur - $this->marge_droite, $nexY);
$pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1);
$pdf->SetLineStyle(array('dash' => 0));
}
$nexY += 2; // Add space between lines
}
// Detect if some page were added automatically and output _tableau for past pages
while ($pagenb < $pageposafter) {
$pdf->setPage($pagenb);
if ($pagenb == $pageposbeforeprintlines) {
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code, $outputlangsbis);
// Add last page for document footer if there are not enough size left
$afterPosData = $this->getMaxAfterColsLinePositionsData();
if ($afterPosData['y'] > $this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot) ) {
$pdf->AddPage();
if (!empty($tplidx)) {
$pdf->useTemplate($tplidx);
}
$pagenb++;
$pdf->setPage($pagenb);
}
// Draw table frames and columns borders
$drawTabNumbPage = $pdf->getNumPages();
for ($i=$pageposbeforeprintlines; $i<=$drawTabNumbPage; $i++) {
$pdf->setPage($i);
// reset page orientation each loop to override it if it was changed
$pdf->setPageOrientation('', 0, 0); // The only function to edit the bottom margin of current page to set it.
$drawTabHideTop = $hidetop;
$drawTabTop = $tab_top_newpage;
$drawTabBottom = $this->page_hauteur - $heightforfooter;;
$hideBottom = 0; // TODO understand why it change to 1 or 0 during process
if ($i == $pageposbeforeprintlines) {
// first page need to start after notes
$drawTabTop = $tab_top;
} elseif (!$drawTabHideTop) {
if (getDolGlobalInt('MAIN_PDF_ENABLE_COL_HEAD_TITLE_REPEAT')) {
$drawTabTop-= $this->tabTitleHeight;
} else {
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code, $outputlangsbis);
}
$this->_pagefoot($pdf, $object, $outputlangs, 1);
$pagenb++;
$pdf->setPage($pagenb);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs);
}
if (!empty($tplidx)) {
$pdf->useTemplate($tplidx);
$drawTabHideTop = 1;
}
}
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) { // @phan-suppress-current-line PhanUndeclaredProperty
if ($pagenb == $pageposafter) {
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code, $outputlangsbis);
} else {
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code, $outputlangsbis);
}
$this->_pagefoot($pdf, $object, $outputlangs, 1);
// New page
$pdf->AddPage();
if (!empty($tplidx)) {
$pdf->useTemplate($tplidx);
}
$pagenb++;
if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs);
}
// last page need to include document footer
if ($i == $pdf->getNumPages()) {
// remove document footer height to tab bottom position
$drawTabBottom-= $heightforfreetext + $heightforinfotot;
}
$drawTabHeight = $drawTabBottom - $drawTabTop;
$this->_tableau($pdf, $drawTabTop, $drawTabHeight, 0, $outputlangs, $drawTabHideTop, $hideBottom, $object->multicurrency_code, $outputlangsbis);
$hideFreeText = $i != $pdf->getNumPages() ? 1 : 0; // Display free text only in last page
$this->_pagefoot($pdf, $object, $outputlangs, $hideFreeText);
$pdf->setPage($i); // in case of _pagefoot or _tableau change it
// reset page orientation each loop to override it if it was changed by _pagefoot or _tableau change it
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
// Don't print head on first page ($pageposbeforeprintlines) because already added previously
if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') && $i != $pageposbeforeprintlines) {
$this->_pagehead($pdf, $object, 0, $outputlangs);
}
if (!empty($tplidx)) {
$pdf->useTemplate($tplidx);
}
}
// Show square
if ($pagenb == $pageposbeforeprintlines) {
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, $hidetop, 0, $object->multicurrency_code, $outputlangsbis);
} else {
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code, $outputlangsbis);
}
// reset text color before print footers
$pdf->SetTextColor(0, 0, 0);
$pdf->setPage($pdf->getNumPages());
$bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
// Display infos area
@ -847,16 +849,8 @@ class pdf_eratosthene extends ModelePDFCommandes
// Display total zone
$posy = $this->drawTotalTable($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs);
// Display payment area
/*
if ($deja_regle)
{
$posy=$this->drawPaymentsTable($pdf, $object, $posy, $outputlangs);
}
*/
// Pagefoot
$this->_pagefoot($pdf, $object, $outputlangs);
// Add number of pages in footer
if (method_exists($pdf, 'AliasNbPages')) {
$pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod
}

View file

@ -82,7 +82,7 @@ class mod_commande_saphir extends ModeleNumRefCommandes
// Parametrage du prefix
$texte .= '<tr><td>'.$langs->trans("Mask").':</td>';
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskorder" value="'.getDolGlobalString("COMMANDE_SAPHIR_MASK").'">', $tooltip, 1, 1).'</td>';
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskorder" value="'.getDolGlobalString("COMMANDE_SAPHIR_MASK").'">', $tooltip, 1, 'help', 'valignmiddle', 0, 3, $this->name).'</td>';
$texte .= '<td class="left" rowspan="2">&nbsp; <input type="submit" class="button button-edit reposition smallpaddingimp" name="Button"value="'.$langs->trans("Modify").'"></td>';

View file

@ -73,7 +73,7 @@ class mod_contract_magre extends ModelNumRefContracts
$tooltip .= '<br>'.$langs->trans("GenericMaskCodes5b");
$texte .= '<tr><td>'.$langs->trans("Mask").':</td>';
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskcontract" value="'.getDolGlobalString("CONTRACT_MAGRE_MASK").'">', $tooltip, 1, 1).'</td>';
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskcontract" value="'.getDolGlobalString("CONTRACT_MAGRE_MASK").'">', $tooltip, 1, 'help', 'valignmiddle', 0, 3, $this->name).'</td>';
$texte .= '<td class="left" rowspan="2">&nbsp; <input type="submit" class="button button-edit reposition smallpaddingimp" name="Button"value="'.$langs->trans("Modify").'"></td>';
$texte .= '</tr>';
$texte .= '</table>';

View file

@ -87,7 +87,7 @@ class mod_delivery_saphir extends ModeleNumRefDeliveryOrder
// Parametrage du prefix
$texte .= '<tr><td>'.$langs->trans("Mask").':</td>';
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskdelivery" value="'.getDolGlobalString('DELIVERY_SAPHIR_MASK').'">', $tooltip, 1, 1).'</td>';
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskdelivery" value="'.getDolGlobalString('DELIVERY_SAPHIR_MASK').'">', $tooltip, 1, 'help', 'valignmiddle', 0, 3, $this->name).'</td>';
$texte .= '<td class="left" rowspan="2">&nbsp; <input type="submit" class="button button-edit reposition smallpaddingimp" name="Button"value="'.$langs->trans("Modify").'"></td>';

Some files were not shown because too many files have changed in this diff Show more