Merge branch 'develop' into formAddPropertyMB

This commit is contained in:
lamrani abdelwadoud 2023-08-30 12:11:42 +02:00 committed by GitHub
commit 1d3f2fc34a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1935 changed files with 59364 additions and 110526 deletions

View file

@ -2,8 +2,9 @@
name: "Exakat analysis"
on:
# execute once a month, the 1st
schedule:
- cron: "0 20 * * *"
- cron: "0 20 1 * *"
workflow_dispatch:
branches:
- develop
@ -22,4 +23,6 @@ jobs:
uses: docker://exakat/exakat-ga
with:
ignore_rules: 'Classes/UseInstanceof,Performances/PrePostIncrement,Functions/UndefinedFunctions,Functions/WrongNumberOfArguments,Functions/WrongTypeWithCall,Variables/UndefinedVariable,Classes/DontUnsetProperties,Classes/NonPpp,Classes/StaticMethodsCalledFromObject,Classes/UseClassOperator,Functions/UsesDefaultArguments,Php/NoClassInGlobal,Php/ShouldUseCoalesce,Php/WrongTypeForNativeFunction,Structures/AddZero,Structures/DropElseAfterReturn,Structures/IfWithSameConditions,Structures/MergeIfThen,Structures/ElseIfElseif,Structures/ExitUsage,Structures/RepeatedPrint,Structures/RepeatedRegex,Structures/SameConditions,Structures/SwitchWithoutDefault,Structures/ShouldMakeTernary,Structures/UselessParenthesis,Structures/UseConstant'
ignore_dirs: '/htdocs/includes,/build,/dev,/doc,/scripts,/test'
ignore_dirs: '/htdocs/includes/,/htdocs/install/doctemplates/,/build/,/dev/,/doc/,/scripts/,/test/'
file_extensions: php
project_reports: Perfile

30
.github/workflows/phpcs.yml vendored Normal file
View file

@ -0,0 +1,30 @@
name: "PHPCS"
on:
pull_request:
paths:
- "**.php"
- "phpcs.xml"
- ".github/workflows/phpcs.yml"
jobs:
phpcs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 50 # important!
# we may use whatever way to install phpcs, just specify the path on the next step
# however, curl seems to be the fastest
- name: Install PHP_CodeSniffer
run: |
curl -OL https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar
php phpcs.phar --version
- uses: thenabeel/action-phpcs@v8
with:
files: "**.php" # you may customize glob as needed
phpcs_path: php phpcs.phar
standard: dev/setup/codesniffer/ruleset.xml
fail_on_warnings: false

View file

@ -13,7 +13,7 @@ jobs:
# uses: ./.github/workflows/files_changed.yaml
# with:
# folder_path: .*
linter_name:
name: Run & fix PHP Code Sniffer
runs-on: ubuntu-latest

7
.gitignore vendored
View file

@ -59,11 +59,6 @@ package-lock.json
doc/install.lock
/.asciidoctorconfig.adoc
# Qodana
.idea/vcs.xml
.idea/modules.xml
.idea/workspace.xml
.idea/inspectionProfiles/Project_Default.xml
.idea/jsLinters/jshint.xml
.idea
/composer.json
/composer.lock

View file

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="7.1">
<component name="PhpProjectSharedConfiguration" php_language_level="7.1" />
</project>

View file

@ -1,236 +0,0 @@
# .scrutinizer.yml
#build:
# - php-scrutinizer-run
build:
nodes:
analysis:
tests:
override:
- command: php-scrutinizer-run
idle_timeout: 8000
#- php-scrutinizer-run --sub-project-dir=htdocs/admin
imports:
- php
filter:
excluded_paths:
- build/
- dev/
- doc/
- documents/
- node_modules/
- test/
- htdocs/custom/
- htdocs/includes/
- htdocs/install/doctemplates/
#dependency_paths:
# - htdocs/includes/
paths:
- htdocs/*
- scripts/*
tools:
# php_analyzer. Doc on https://scrutinizer-ci.com/docs/tools/php/php-analyzer/
php_analyzer:
enabled: true
extensions:
- php
#dependency_paths:
# - htdocs/includes/
filter:
excluded_paths:
- build/
- dev/
- doc/
- documents/
- htdocs/custom/
- htdocs/includes/
- htdocs/install/doctemplates/
- htdocs/core/class/lessc.class.php
- node_modules/
- test/
paths:
- htdocs/*
- scripts/*
config:
parameter_reference_check:
enabled: true
checkstyle:
enabled: false
no_trailing_whitespace: true
naming:
enabled: true
local_variable: ^[a-z][a-zA-Z0-9]*$
abstract_class_name: ^Abstract|Factory$
utility_class_name: Utils?$
constant_name: ^[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)*$
property_name: ^[a-z][a-zA-Z0-9]*$
method_name: ^(?:[a-z]|__)[a-zA-Z0-9]*$
parameter_name: ^[a-z][a-zA-Z0-9]*$
interface_name: ^[A-Z][a-zA-Z0-9]*Interface$
type_name: ^[A-Z][a-zA-Z0-9]*$
exception_name: ^[A-Z][a-zA-Z0-9]*Exception$
isser_method_name: ^(?:is|has|should|may|supports)
unreachable_code:
enabled: true
check_access_control:
enabled: true
typo_checks:
enabled: true
check_variables:
enabled: true
check_calls:
enabled: true
too_many_arguments: true
missing_argument: true
argument_type_checks: lenient # Allowed Values: "disabled", "lenient", "strict"
suspicious_code:
enabled: true
overriding_parameter: false
overriding_closure_use: true
parameter_closure_use_conflict: true
parameter_multiple_times: true
non_existent_class_in_instanceof_check: true
non_existent_class_in_catch_clause: true
assignment_of_null_return: true
non_commented_switch_fallthrough: true
non_commented_empty_catch_block: true
overriding_private_members: true
use_statement_alias_conflict: true
precedence_in_condition_assignment: true
dead_assignments:
enabled: true
verify_php_doc_comments:
enabled: false
parameters: true
return: true
suggest_more_specific_types: true
ask_for_return_if_not_inferrable: true
ask_for_param_type_annotation: true
loops_must_use_braces:
enabled: true
check_usage_context:
enabled: true
simplify_boolean_return:
enabled: false
phpunit_checks:
enabled: false
reflection_checks:
enabled: true
# Checks Common Precedence Mistakes
precedence_checks:
enabled: true
assignment_in_condition: true
comparison_of_bit_result: true
basic_semantic_checks:
enabled: true
# Disabled unused code. In most cases, we want to keep it.
unused_code:
enabled: false
deprecation_checks:
enabled: true
useless_function_calls:
enabled: true
metrics_lack_of_cohesion_methods:
enabled: true
metrics_coupling:
enabled: true
stable_code:
namespace_prefixes: []
classes: []
doctrine_parameter_binding:
enabled: false
doctrine_entity_manager_injection:
enabled: false
symfony_request_injection:
enabled: false
doc_comment_fixes:
enabled: true
reflection_fixes:
enabled: false
use_statement_fixes:
enabled: true
remove_unused: true
# Whether you would like multiple imports in one USE statement to be preserved, e.g. ``use A, B;``.
preserve_multiple: false
# Whether you would like to preserve blank lines between use statements.
preserve_blanklines: false
order_alphabetically: false
# To use specific config for a specific path, use path_configs: (see example on page https://scrutinizer-ci.com/docs/configuration/tool_config_structure)
# php_depend
#php_pdepend:
# enabled: false
# configuration_file: null
# suffixes:
# - php
# excluded_dirs: { }
# filter:
# excluded_paths:
# - 'build/*'
# - 'dev/*'
# - 'doc/*'
# - 'test/*'
# - 'htdocs/includes/*'
# paths: { }
# change tracking
#php_changetracking:
# enabled: false
# bug_patterns:
# - '\bfix(?:es|ed)?\b'
# feature_patterns:
# - '\badd(?:s|ed)?\b'
# - '\bimplement(?:s|ed)?\b'
# filter:
# excluded_paths:
# - 'build/*'
# - 'dev/*'
# - 'doc/*'
# - 'documents/*'
# - 'htdocs/includes/*'
# - 'node_modules/*'
# - 'test/*'
# paths: { }
# Similar code detection
#php_sim:
# enabled: false
# min_mass: 30
# filter:
# excluded_paths:
# - 'build/*'
# - 'dev/*'
# - 'doc/*'
# - 'documents/*'
# - 'htdocs/includes/*'
# - 'node_modules/*'
# - 'test/*'
# paths: { }
# Coding-Style / Bug Detection
#js_hint:
# enabled: false
# use_native_config: true
# extensions:
# - js
# filter:
# excluded_paths:
# - 'build/*'
# - 'dev/*'
# - 'doc/*'
# - 'documents/*'
# - 'htdocs/includes/*'
# - 'node_modules/*'
# - 'test/*'
# paths: { }
# config: { }
# path_configs: { }
before_commands: { }
after_commands: { }
artifacts: { }
build_failure_conditions: { }

View file

@ -1,14 +0,0 @@
---
linters:
phpcs:
standard: 'dev/setup/codesniffer/ruleset.xml'
extensions: 'php'
tab_width: 4
fixer: true
fixers:
enable: true
files:
ignore:
- 'htdocs/includes/*'

178
ChangeLog
View file

@ -3,13 +3,24 @@ English Dolibarr ChangeLog
--------------------------------------------------------------
***** ChangeLog for 1.0.0 compared to 18.0.0 *****
WARNING:
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
* The property ->brouillon has been removed from all classes. It was not reliable and was a duplicate of ->status == self::STATUS_DRAFT.
* The method get_substitutionarray_shipment_lines() has been removed. Use the generic get_substitutionarray_lines() instead.
***** ChangeLog for 18.0.0 compared to 17.0.0 *****
For uses:
---------
NEW: PHP 8.2 compatibility (test not yet completed).
NEW: Module Workstations Management upgraded to stable status.
NEW: PHP 8.2 compatibility (test not yet completed)
NEW: Module Workstations Management upgraded to stable status
NEW: Module Webhook upgraded to stable status
NEW: #23436 Group social networks fields
NEW: Accountancy - Add specific page to export accounting data rather than the journals page
@ -19,66 +30,56 @@ NEW: Accountancy - Manage intra-community VAT on supplier invoices - FPC22
NEW: Accountancy - iSuiteExpert export model
NEW: Accountancy - Quadratus export with attachments in accountancy export
NEW: Accountancy - Can filter on a custom group of accounts. Perf or ledger list.
NEW: Accountancy - Can select the export format during export of journals
NEW: Accountancy - sort of column of custom group of account
NEW: Can upload a file with drag and drop on purchase invoice, vats, salaries and social contributions
NEW: Authentication: #22740 add OpenID Connect impl
NEW: Authentication: add experimental support for Google OAuth2 connexion
NEW: Authentication: can now edit service name for OAuth token
NEW: Add a public virtual card page for each user
NEW: Add a status on supplier price ref (WIP to close a supplier ref)
NEW: add bookmarks in selectable landing pages for users
NEW: Add column ext_payment_site into societe_rib to allow multiple payment mode
NEW: add convertion of images to webp for a single image in website media editor
NEW: Add CRC for currency symbol before amount
NEW: add customer code to invoices listing
NEW: Add filter on nb of generation done in list of recurring invoices
NEW: Add filters and sort on product unit column
NEW: Add link to edit VAT list from error message of missing VAT
NEW: add margins in paiement/card.php
NEW: Add mass action delete on VAT
NEW: Add origin info when create a product batch when created from a movement stock
NEW: Add possibility to choose format #21426
NEW: Add SQL contraint on product_stock table to allow only exsting product and warehouse #23543
NEW: Add STRIPE_DEBUG, a way to log Stripe IPN
NEW: An external module can modify the quick search fields
NEW: Auto activate some modules on install (Export/Import/Wysiwyg editor)
NEW: Autofill email form with the email template with status "Default" on
NEW: Bank name no more mandatory on creation. Can be generated if empty.
NEW: Bank: Add fields zip, town, country for owner of a bank account
NEW: Bank: Bank name no more mandatory on creation. Can be generated if empty.
NEW: Bank: Add fields zip, town, country for owner of a bank account
NEW: batch referential objets
NEW: Can add the add now link on date into addfieldvalue()
NEW: Can add an array of several links in date selector
NEW: Can bin accounting line for a given month
NEW: Can edit account on miscellaneous payment (if not transfered)
NEW: Can edit inline the VAT number from supplier tab
NEW: Can fill date of salary payment with date of start of salary
NEW: Can go back to draft on shipment when stock change not on validate
NEW: Can modify bank account of sepa payment (if file not sent yet)
NEW: Customers: add date due and labels into customer comm card
NEW: Can select the export format during export of journals
NEW: Can set a checkbox in formconfirm by clicking on the label
NEW: Can set flag default value on email templates
NEW: Can set the page "List of opportunities" as landing page
NEW: Can show the sql request used on emailing selection
NEW: Can show the SQL request used on emailing selection
NEW: can stay on edit field when errors occurs
NEW: comment in api_mymodule for seperate methods
NEW: create email substitution variable for intervention signature URL
NEW: Contacts: presend mass action in contact list
NEW: Contacts: hook printFieldListFrom in contact list
NEW: Customers: add date due and labels into customer comm card
NEW: Debug the custom CSS feature to avoid a directory search/scan at
NEW: dev name
NEW: Disable bad reputation product price
NEW: dolExplodeIntoArray can accept regex
NEW: dol_sort_array can sort on alphabetical order even if val is num
NEW: element time integration code + SQL
NEW: Email: autofill email form with the email template with status "Default" on
NEW: Email: don't have closed contact proposed as receiver for the mails
NEW: Email: can set flag default value on email templates
NEW: Email-Collector: add field reply-to in email collector as possible filter
NEW: Email-Collector: substitute date now in email collector
NEW: Email-Collector: operation type in email collector to load or create contact
NEW: Email-Collector: easier setup - can also use ! for negative search
NEW: Email-Templates: show module into list of email templates
NEW: Events: can add any contact on events if global MAIN_ACTIONCOM_CAN_ADD_ANY_CONTACT is set at 1
NEW: Events: list with color
NEW: Events: remove default percentage for event creation url
NEW: expend/collapse list of social networks
NEW: Filter on amount and qty on list of service's contracts
NEW: formconfirm can support field with format datetime
NEW: getCommonSubstitutionArray to have more substitute keys
NEW: GeoIP: Can test a geoip conversion from the geoip setup page
NEW: GUI: add a CSS editor into the admin GUI
NEW: GUI: add dropdown button actions (example on Create button on project)
@ -89,14 +90,16 @@ NEW: GUI: can set background style with MAIN_LOGIN_BACKGROUND_STYLE
NEW: Help: Tooltip to explain how to add a photo on a product
NEW: Help: Possibility to link to German pages in help
NEW: helper functions for dates + small demo case
NEW: hook printFieldListFrom in contact list
NEW: HR - Salary: can fill date of salary payment with date of start of salary
NEW: HR - Salary: can modify the date of payment of a salary (if not reconciled)
NEW: HR - Salary: date for salary payment includes the hour/min
NEW: HR - Salary: adding button Send Email on the salary file
NEW: Import: filter on entity in import
NEW: Import: map table to element for get entity in import
NEW: inc.php: handle parameters from argv
NEW: Invoice - show category of operations
NEW: Installation: Auto activate some modules on install (Export/Import/Wysiwyg editor)
NEW: Invoice: show category of operations
NEW: Invoice: add customer code to invoices listing
NEW: Keep a link between user created from recruitment and application
NEW: Mass Actions: Better responsive for mass actions
NEW: Members: add numbering modules for members
@ -111,7 +114,8 @@ NEW: No overwrite of optionals during put() contact
NEW: Notifications: add Customer Order delivered (ORDER_NEW) in module Notification
NEW: Notifications: for Sign or Refused Propal from Online Page
NEW: Now we can edit amount on VAT and salaries clone action
NEW: only get openned contact from liste_contact function, to not have acces to closed contact as mail receiver
NEW: only get opened contact from liste_contact function, to not have access to closed contact as mail receiver
NEW: Option: MAIN_SECURITY_MAXFILESIZE_DOWNLOADED #yogosha10660
NEW: Option to manage deposit slips for more payment modes (not only
NEW: Option to show column for field and line selection on the left
NEW: Orders: add sub total in order list det
@ -120,65 +124,65 @@ NEW: Orders export: allow to export field 'shipment method'
NEW: payment default values when supplier order created from reception
NEW: Payment: manage contracts
NEW: Payment: sepaStripe now creates the payment mode with type pm_ using new API
NEW: presend mass action in contact list
NEW: Payment: add partial payment reason "withholding tax"
NEW: Payment: Can edit account on miscellaneous payment (if not transfered)
NEW: Print PDF: category of operation for crabe PDF model
NEW: Print PDF: Name and date to print on PDF Sign
NEW: Print PDF: Use the more recent PDF templates for documents by default on a fresh install
NEW: Print PDF: Option PDF_SHOW_PHONE_AFTER_USER_CONTACT to show phone after specific assigned contact on PDF
NEW: Print PDF: Option PDF_SHOW_EMAIL_AFTER_USER_CONTACT to show email after specific assigned contact on PDF
NEW: product images on popup are cached
NEW: Products: Add origin info when create a product batch when created from a movement stock
NEW: Products: Add statistics by amount on statistics of products.
NEW: Products: Add SQL contraint on product_stock table to allow only existing product and warehouse #23543
NEW: Proposals: filter for Signed+Billed in proposals
NEW: Proposals: can modify margin rates in offers like VAT rates
NEW: Proposals: option filter for NoSalesRepresentativeAffected in proposals list
NEW: Proposals: constant PROPALE_ADDON_NOTE_PUBLIC_DEFAULT
NEW: Provide the oldcopy value when calling setValueFrom() function with a trigger key
NEW: Reception: can receive more than qty ordered on reception
NEW: referential objects of batch
NEW: remove keys whose table element is the same as element in map list
NEW: repair script skip views
NEW: search on time spent duration range
NEW: Security: Save date to invalidate other session into user table
NEW: Security: Invalidate all sessions of a user when password is modified.
NEW: search on time spent duration range
NEW: set payment default values when supplier order created from reception
NEW: Service Contracts: Filter on amount and qty on list of service's contracts
NEW: set today start time at beginning
NEW: Show counter of access of website in website list
NEW: Show main currency in company info user tooltip
NEW: Show module into list of emails templates
NEW: Show picto into the combobox of widgets
NEW: Show supplier invoice ref of direct debit transfer tab invoices
NEW: show supplier name in getNomUrl of supplier order
NEW: sort of column of custom group of account
NEW: Supplier Invoices: add ability of ODT support to supplier invoices
NEW: Social Networks: expend/collapse list of social networks
NEW: Stock limit for alert and desired optimal stock by product and warehouse import
NEW: Stock: Add warehouse create and modify triggers.
NEW: Stock: Can select several warehouses into the view stock at date in past
NEW: Stripe: add STRIPE_DEBUG, a way to log Stripe IPN
NEW: Supplier Invoices: add ability of ODT support to supplier invoices
NEW: Supplier Order: show supplier name in getNomUrl of supplier order
NEW: Supplier Order: set payment default values when supplier order created from reception
NEW: Supplier Price: Add a status on supplier price ref (WIP to close a supplier ref)
NEW: Support different bank account for several direct debit payments
NEW: Support multiselect in the warehouse selection combo box
NEW: Option: MAIN_SECURITY_MAXFILESIZE_DOWNLOADED #yogosha10660
NEW: Survey: Comment on survey is possible only after vote.
NEW: tables: llx_element_time to store time spent on several elements (mo, ticket...)
NEW: TakePOS: adapt category and product pictures sizes on TakePOS
NEW: TakePOS: limit load products in TakePOS
NEW: The batch for remind on due date can be setup for using validation date
NEW: The refresh link for IMAP collector is always visible
NEW: The upgrade process can be done by creating a file upgrade.unlock
NEW: Third-Party: use an ajax component to switch prospection status on thirdparty list
NEW: Tickets: Send a notification email when ticket assigned
NEW: Tickets: set ticket status to answered if the client has answered from the public interface
NEW: Tickets: added an option to display the progress of tickets on the public interface
NEW: Tickets: add link to thirdparty tickets history
NEW: Tickets: notify also the contributor affected to a ticket if a new message public is post (add global TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ALSO_CONTRIBUTOR)
NEW: Upgrades: The upgrade process can be done by creating a file upgrade.unlock
NEW: Use a cache file for external RSS in calendar
NEW: Use by default the domain $dolibarr_main_url_root for SMTP HELO
NEW: Users: add a public virtual card page for each user
NEW: VAT can be modified during add of line
NEW: Website Module: Increment website counter on each page access in website module
NEW: write all fields and their properties in asciidoc format
NEW: Can add an array of several links in date selector
NEW: Website Module: Show counter of access of website in website list
NEW: Widgets: Show picto into the combobox of widgets
NEW: Widgets: Implement MAIN_ACTIVATE_FILECACHE on birthday widget
NEW: Widgets: Add widget "The next upcoming events"
NEW: Widgets: Add widget of open opportunities
NEW: use an ajax component to switch prospection status on thirdparty list
NEW: Add partial payment reason "withholding tax"
@ -188,25 +192,39 @@ For developers or integrators:
NEW: Make it possible to select hours and minutes in form_confirm
NEW: add triggers on mailing
NEW: Add a trigger when create a shipping line batch and fix propagate missing errors
NEW: add function for listiong objects from directory
NEW: add function for listing objects from directory
NEW: add helplist property to describe fields of objects
NEW: Hooks: printFieldListFrom in contact list
NEW: Hooks: add hook in loadLotStock() in html.formproduct.class.php file, add hook 'llxFooter', Add hook online sign
NEW: Update lib parsedownto 1.7.4, phpspreadsheet lib to v1.12, ESCPOS v3.0, jquery, Stripe.
NEW: API: Support contact in post() document API
NEW: API: more APIs (update currency rate, upload of supplier documents, ...)
NEW: Hooks: printFieldListFrom in contact list
NEW: Hooks: add hook in loadLotStock() in html.formproduct.class.php file
NEW: Hooks: add hook 'llxFooter'
NEW: Hooks: add hook online sign
NEW: Hooks: add sent info in the parameters provided to the hook sendMailAfter
NEW: Libraries: Update libs parsedownto 1.7.4, phpspreadsheet lib to v1.12, ESCPOS v3.0, jquery, Stripe.
NEW: ModuleBuilder: updating in modulbuilder on tab Menu when adding object
NEW: ModuleBuilder: add/edit permissions
NEW: ModuleBuilder: better generated documentation
NEW: add sent info in the parameters provided to the hook sendMailAfter
NEW: add setAsSelectUser into factory for generic setup page
NEW: add option keepspace into dol_string_nospecialchar()
NEW: dol_sort_array can sort on alphabetical order even if val is num
NEW: dolExplodeIntoArray can accept regex
NEW: element time integration code + SQL
NEW: tables: llx_element_time to store time spent on several elements (mo, ticket...)
NEW: Provide the oldcopy value when calling setValueFrom() function with a trigger key
NEW: getCommonSubstitutionArray to have more substitute keys
NEW: write all fields and their properties in asciidoc format
WARNING:
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
* Minimal PHP version is now PHP 7.1 instead of PHP 7.0
* Sensitive datas like keys in setup pages, that need encyption (for example the API keys of users, the CRON security key, the keys into the Stripe module, or
external modules setup pages that store sensitive keys or password), are using the $dolibarr_main_instance_unique_id as part of the key for encryption. So,
if you restore or duplicate the data from another instance dump, you must also update this parameter in ther conf.php file to allow decryption in the new instance, or
better, you must reenter the sensitive data into the setup pages of the new instance to resave them correctly.
Note that to find all the parameters that are encrypted into the setup database, you can do a "SELECT * FROM llx_const WHERE value LIKE '%dolcrypt%';"
* The deprecated method "escapeunderscore()" of database handlers has been removed. You must use "escapeforlike()" instead.
* The method "nb_expedition()" has been renamed into "countNbOfShipments()"
* Revert default type of hooks. Default is now 'addreplace' hooks (and exception become 'output' hooks, that become deprecated).
@ -217,6 +235,68 @@ Following changes may create regressions for some external modules, but were nec
* The method getCheckOption() and deleteCPUser() of class Holiday has been removed (it was not used)
***** ChangeLog for 17.0.3 compared to 17.0.2 *****
FIX: #20304 propaldates update
FIX: #24508 Label not reported when creating a supplier invoice template (#25340)
FIX: #24569 filters on stockadate page
FIX: #24631 Filter on categories of warehouses faulty
FIX: #24695
FIX: #24756 Total sum on annual report bank
FIX: #24918
FIX: #24985 Societe - Function thirdparty merging not working with module whose tables are not deployed by default
FIX: #24991
FIX: #24997 Update slovakia vat rate
FIX: #25223
FIX: ability to disable forcing focus on select2 to avoid side effects
FIX: Add hidden conf to add extrafields in canelle template : INVOICE_ADD_EXTRAFIELD_IN_NOTE
FIX: Add/Update required modules for thirdparties (by categ) & partnership
FIX: ajax on off setup type
FIX: avoid php8 warning
FIX: Bad management of localtax on TakePOS due to typo error in var name
FIX: can define empty qty by default when create object line
FIX: can not remove the last selected value with checkbox
FIX: case special char for password in email admin page
FIX: Change $key into $tmpkey
FIX: CommonObject::getRights()
FIX: commonobject: getRights() did not find rights correctly for objects built using modulebuilder
FIX: CVE reported by BELABED Skander (Akerva)
FIX: CVE XSS on company name reported by Belabed Skander from Akerva
FIX: decimal values were not possible on shipment quantities (introduced by #24882)
FIX: default value for condition of payment on proposal
FIX: default values were not set for specimen objects
FIX: Delete of bank of a thirdparty must need the edit thirdparty perm
FIX: display project tasks list columns (#24557)
FIX: dol_print_error parameters on ticket fetch method (#25318)
FIX: dol_trunc may not have the desired behaviour for truncating a cryptographic initialiszation vector, for instance when MAIN_DISABLE_TRUNC is used
FIX: Donation - Missing Language key
FIX: error expedition qty 0
FIX: extrafield quick edit not working on products
FIX: fatal error on Stripe setup page and security when terminal not used
FIX: Fatal Error PHP 8 : division by 0 (#25384)
FIX|Fix Change strpos for expedition and receipt in files.lib.php $haystack and $needle inversion
FIX: Fix main and left menu info for the root menu of the list of accountancy journal
FIX: Homogenise handling of null extrafield value in create/update
FIX: Langs was not loaded for extrafields error
FIX: Missing localtaxes on receipt in TakePOS
FIX: no change on thirdparties.modules.php required modules
FIX: OAUth2 module for Google with scopes for people and calendar
FIX: php8.1 warning on lists with total due to unset array key (#25460)
FIX: quickedit code missing on product card
FIX: Selection of customer on second or more parallel sell in TakePOS
FIX: Showing bank account on list for direct debit
FIX: SQL migration file
FIX: String was compared to an integer
FIX: to avoid wrong path of file (#25320)
FIX: Total sum on annual report bank
FIX: translation extrafield mass action #24080
FIX: Try to fix the date of invoice on TakePOS on eastern timezone
FIX: TVA calc option must be the same on update line as on create line
FIX: Update mouvementstock.class.php (#25396)
FIX: update product on translation update
FIX: use dol_substr instead of dol_trunc for truncating openssl initialization vector
FIX: We should always be able to filter on action type no matter if we can't read actions of others (#24462)
FIX: wrong var name
***** ChangeLog for 17.0.2 compared to 17.0.1 *****
FIX: Change strpos for expedition and receipt in files.lib $haystack and $needle inversion
FIX: Add hidden conf to add extrafields in canelle template : INVOICE_ADD_EXTRAFIELD_IN_NOTE

View file

@ -1,8 +1,7 @@
# DOLIBARR ERP & CRM
![Downloads per day](https://img.shields.io/sourceforge/dw/dolibarr.svg)
![Build status](https://img.shields.io/travis/Dolibarr/dolibarr/develop.svg)
[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%207.0-8892BF.svg?style=flat-square)](https://php.net/)
[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%207.1-8892BF.svg?style=flat-square)](https://php.net/)
[![GitHub release](https://img.shields.io/github/v/release/Dolibarr/dolibarr)](https://github.com/Dolibarr/dolibarr)
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/5521/badge)](https://bestpractices.coreinfrastructure.org/projects/5521)

View file

@ -48,14 +48,15 @@ Reports are processed around once a month.
ONLY vulnerabilities discovered, when the following setup on test platform is used, are "valid":
* The version to analyze must be the last version available into "develop" branch or into last stable "vX.Y" released version. Reports on vulnerabilities already fixed (so already reported) into the develop branch will not be validated.
* $dolibarr_main_prod must be set to 1 into conf.php
* $dolibarr_nocsrfcheck must be kept to the value 0 into conf.php (this is the default value)
* $dolibarr_main_force_https must be set to something else than 0.
* The constant MAIN_SECURITY_CSRF_WITH_TOKEN must be set to 3 into backoffice menu Home - Setup - Other (this protection should be set to 3 soon by default)
* The constant MAIN_SECURITY_CSRF_WITH_TOKEN must be set to 3 into backoffice menu Home - Setup - Other (this protection should be set to 3 soon by default). CSRF attacks are accepted but
double check that you have set MAIN_SECURITY_CSRF_WITH_TOKEN to value 3.
* ONLY security reports on modules provided by default and with the "stable" status are valid (troubles into "experimental", "developement" or external modules are not valid vulnerabilities).
* The root of web server must link to htdocs and the documents directory must be outside of the web server root (this is the default when using the default installer but may differs with external installer).
* The web server setup must be done so that only the documents directory is in write mode. The root directory called htdocs must be read-only.
* CSRF attacks are accepted but double check that you have set MAIN_SECURITY_CSRF_WITH_TOKEN to value 3.
* The modules DebugBar and ModuleBuilder must NOT be enabled. (by default, these modules are not enabled. They are developer tools)
* Ability for a high level user to edit web site pages into the CMS by including HTML or Javascript is an expected feature. Vulnerabilities into the website module are validated only if HTML or Javascript injection can be done by a non allowed user.
* Fail2ban rules for rate limit on the login page,password forgotten page, api calls and all public pages (/public/*) must be installed as recommendend into the section "About - Admin tools - Section Access limits and mitigation".

View file

@ -33,5 +33,5 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+$conffile = "/etc/dolibarr/conf.php";
+$conffiletoshow = "/etc/dolibarr/conf.php";
// Load conf file if it is already defined
$short_options = "c:h";
$long_options = array(

View file

@ -220,7 +220,8 @@ OPTIMIZE_OUTPUT_VHDL = NO
# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions
# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
EXTENSION_MAPPING = example=PHP
#EXTENSION_MAPPING = example=PHP
EXTENSION_MAPPING =
# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
# to include (a tag file for) the STL sources as input, then you should
@ -602,7 +603,8 @@ INPUT_ENCODING = UTF-8
# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
FILE_PATTERNS = *.php *.pl *.sql *.example
#FILE_PATTERNS = *.php *.pl *.sql *.example
FILE_PATTERNS = *.php *.pl
# The RECURSIVE tag can be used to turn specify whether or not subdirectories
# should be searched for input files as well. Possible values are YES and NO.

View file

@ -1,5 +1,5 @@
#-------------------------------------------------------------------#
# Makefile
# Makefile to build UsedPort exe
#-------------------------------------------------------------------#
# 1.0 Laurent Destailleur Creation
#-------------------------------------------------------------------#

View file

@ -1,9 +1,21 @@
PHPStan
https://phpstan.org
PHPStan (https://phpstan.org)
-----------------------------
PHPStan requires PHP >= 7.1
Install: composer require --dev phpstan/phpstan
Config File is: ./phpstan.neon
Config File: phpstan.neon
Install phpstan:
cd git; mkdir phpstan
cd phpstan
composer require --dev phpstan/phpstan
Build report from CLI:
cd git/dolibarr; mv htdocs/custom /tmp/
php ../phpstan/htdocs/includes/bin/phpstan -v analyze -a build/phpstan/bootstrap.php --memory-limit 4G --error-format=table htdocs/commande/class
php ../phpstan/htdocs/includes/bin/phpstan -v analyze -a build/phpstan/bootstrap.php --memory-limit 4G --error-format=table
mv /tmp/custom htdocs
Build HTML report from Cron:
Example of line to add into a cron to generate a HTML report:
0 1 5 * * cd /home/dolibarr/preview.dolibarr.org/dolibarr; chmod -R u+w /home/dolibarr/preview.dolibarr.org/dolibarr; git pull; /home/dolibarr/phpstan/vendor/bin/phpstan -v analyze -a build/phpstan/bootstrap.php --memory-limit 4G --error-format=github | awk ' BEGIN{ print "Date "strftime("%Y-%m-%d")"<br>" } { print $0"<br>" } END{ print NR } ' > /home/dolibarr/doxygen.dolibarr.org/phpstan/index.html

View file

@ -1,14 +1,11 @@
<?php
// Example to use PHPStan
// cd git/dolibarr
// /usr/bin/php7.2 ../phpstan.phar -l1 analyze htdocs/societe/website.php --memory-limit 2G
// Defined some constants and load Dolibarr env to reduce PHPStan bootstrap that fails to load a lot of things.
define('DOL_DOCUMENT_ROOT', __DIR__ . '/../../htdocs');
define('DOL_DATA_ROOT', __DIR__ . '/../../documents');
define('DOL_URL_ROOT', '/');
//define('DOL_DOCUMENT_ROOT', __DIR__ . '/../../htdocs');
//define('DOL_DATA_ROOT', __DIR__ . '/../../documents');
//define('DOL_URL_ROOT', '/');
// Load the main.inc.php file to have functions llx_Header and llx_Footer defined
// Load the main.inc.php file to have functions env defined
if (! defined("NOLOGIN")) define("NOLOGIN", '1');
if (! defined("NOHTTPSREDIRECT")) define("NOHTTPSREDIRECT", '1');
global $conf, $langs, $user, $db;
include_once __DIR__ . '/../../htdocs/main.inc.php';

8
build/rector/README Normal file
View file

@ -0,0 +1,8 @@
How to use Rector to fix code
-----------------------------
First, move rector.php file into htdocs
Then install rector.
Then ...

View file

@ -24,5 +24,5 @@ diff -up htdocs/install/inc.php.patch htdocs/install/inc.php
+$conffile = "/etc/dolibarr/conf.php";
+$conffiletoshow = "/etc/dolibarr/conf.php";
// Load conf file if it is already defined
$short_options = "c:h";
$long_options = array(

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -2,17 +2,20 @@
# Examle of rule you can add to fail2ban to restrict bruteforce attacks.
#
[web-dol-passforgotten]
; rule against call of passwordforgottenpage
[web-accesslog-limit403]
; rule against call of 403 forbidden access
; note: you must change the path of log file to the one of the web server for the virtual host of the Dolibarr
enabled = true
port = http,https
filter = web-dolibarr-rulespassforgotten
logpath = /mypath/documents/documents/dolibarr.log
filter = web-accesslog-limit403
logpath = /var/log/apache2/access.log
;logpath = /var/log/apache2/other_vhosts_access.log
action = %(action_mw)s
bantime = 4320000 ; 50 days
findtime = 86400 ; 1 day
maxretry = 10
maxretry = 100
[web-dol-bruteforce]
@ -28,10 +31,23 @@ findtime = 14400 ; 4 hours
maxretry = 20
[web-dol-passforgotten]
; rule against call of passwordforgottenpage
enabled = true
port = http,https
filter = web-dolibarr-rulespassforgotten
logpath = /mypath/documents/documents/dolibarr.log
action = %(action_mw)s
bantime = 4320000 ; 50 days
findtime = 86400 ; 1 day
maxretry = 10
[web-dol-limitpublic]
; rule to add rate limit on some public pages
; note you must keep enough for public access like agenda export, emailing trackers, stripe ipn access, ...
; note: you must keep enough for public access like agenda export, emailing trackers, stripe ipn access, ...
enabled = true
port = http,https
filter = web-dolibarr-limitpublic

354
dev/tools/apstats.php Executable file
View file

@ -0,0 +1,354 @@
#!/usr/bin/env php
<?php
/*
* Copyright (C) 2023 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file dev/tools/apstats.php
* \brief Script to report Advanced Statistics on a coding project
*/
$sapi_type = php_sapi_name();
$script_file = basename(__FILE__);
$path = dirname(__FILE__) . '/';
// Test si mode batch
$sapi_type = php_sapi_name();
if (substr($sapi_type, 0, 3) == 'cgi') {
echo "Error: You are using PHP for CGI. To execute " . $script_file . " from command line, you must use PHP for CLI mode.\n";
exit();
}
error_reporting(E_ALL & ~ E_DEPRECATED);
define('PRODUCT', "apstats");
define('VERSION', "1.0");
print '***** '.constant('PRODUCT').' - '.constant('VERSION').' *****'."\n";
if (empty($argv[1])) {
print 'You must run this tool being into the root of the project.'."\n";
print 'Usage: '.constant('PRODUCT').'.php pathto/index.html [--dir-scc=pathtoscc] [--dir-phpstan=pathtophpstan]'."\n";
print 'Example: '.constant('PRODUCT').'.php dev/tools/apstats.php documents/apstats/index.html --dir-scc=/snap/bin --dir-phpstan=~/git/phpstan/htdocs/includes/bin';
exit(0);
}
$outputpath = $argv[1];
$outputdir = dirname($outputpath);
$outputfile = basename($outputpath);
if (! is_dir($outputdir)) {
print 'Error: dir '.$outputdir.' does not exists or is not writable'."\n";
exit(1);
}
$dirscc = '';
$dirphpstan = '';
$i = 0;
while ($i < $argc) {
$reg = array();
if (preg_match('/--dir-scc=(.*)$/', $argv[$i], $reg)) {
$dirscc = $reg[1];
}
if (preg_match('/--dir-phpstan=(.*)$/', $argv[$i], $reg)) {
$dirphpstan = $reg[1];
}
$i++;
}
// Count lines of code of Dolibarr itself
/*
$commandcheck = 'cloc . --exclude-dir=includes --exclude-dir=custom --ignore-whitespace --vcs=git';
$resexec = shell_exec($commandcheck);
$resexec = (int) (empty($resexec) ? 0 : trim($resexec));
// Count lines of code of external dependencies
$commandcheck = 'cloc htdocs/includes --ignore-whitespace --vcs=git';
$resexec = shell_exec($commandcheck);
$resexec = (int) (empty($resexec) ? 0 : trim($resexec));
*/
// Count lines of code of application
$commandcheck = ($dirscc ? $dirscc.'/' : '').'scc . --exclude-dir=includes,custom';
print 'Execute SCC to count lines of code in project: '.$commandcheck."\n";
$output_arrproj = array();
$resexecproj = 0;
exec($commandcheck, $output_arrproj, $resexecproj);
// Count lines of code of dependencies
$commandcheck = ($dirscc ? $dirscc.'/' : '').'scc htdocs/includes';
print 'Execute SCC to count lines of code in dependencies: '.$commandcheck."\n";
$output_arrdep = array();
$resexecdep = 0;
exec($commandcheck, $output_arrdep, $resexecdep);
// Get technical debt
$commandcheck = ($dirphpstan ? $dirphpstan.'/' : '').'phpstan -v analyze -a build/phpstan/bootstrap.php --memory-limit 5G --error-format=github';
print 'Execute PHPStan to get the technical debt: '.$commandcheck."\n";
$output_arrtd = array();
$resexectd = 0;
exec($commandcheck, $output_arrtd, $resexectd);
$arrayoflineofcode = array();
$arraycocomo = array();
$arrayofmetrics = array(
'proj'=>array('Bytes'=>0, 'Files'=>0, 'Lines'=>0, 'Blanks'=>0, 'Comments'=>0, 'Code'=>0, 'Complexity'=>0),
'dep'=>array('Bytes'=>0, 'Files'=>0, 'Lines'=>0, 'Blanks'=>0, 'Comments'=>0, 'Code'=>0, 'Complexity'=>0)
);
// Analyse $output_arrproj
foreach (array('proj', 'dep') as $source) {
print 'Analyze SCC result for lines of code for '.$source."\n";
if ($source == 'proj') {
$output_arr = &$output_arrproj;
} elseif ($source == 'dep') {
$output_arr = &$output_arrdep;
} else {
print 'Bad value for $source';
die();
}
foreach ($output_arr as $line) {
if (preg_match('/^(───|Language|Total)/', $line)) {
continue;
}
//print $line."<br>\n";
if (preg_match('/^Estimated Cost.*\$(.*)/i', $line, $reg)) {
$arraycocomo[$source]['currency'] = preg_replace('/[^\d\.]/', '', str_replace(array(',', ' '), array('', ''), $reg[1]));
}
if (preg_match('/^Estimated Schedule Effort.*\s([\d\s,]+)/i', $line, $reg)) {
$arraycocomo[$source]['effort'] = str_replace(array(',', ' '), array('.', ''), $reg[1]);
}
if (preg_match('/^Estimated People.*\s([\d\s,]+)/i', $line, $reg)) {
$arraycocomo[$source]['people'] = str_replace(array(',', ' '), array('.', ''), $reg[1]);
}
if (preg_match('/^Processed\s(\d+)\s/i', $line, $reg)) {
$arrayofmetrics[$source]['Bytes'] = $reg[1];
}
if (preg_match('/^(.*)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)$/', $line, $reg)) {
$arrayoflineofcode[$source][$reg[1]]['Files'] = $reg[2];
$arrayoflineofcode[$source][$reg[1]]['Lines'] = $reg[3];
$arrayoflineofcode[$source][$reg[1]]['Blanks'] = $reg[4];
$arrayoflineofcode[$source][$reg[1]]['Comments'] = $reg[5];
$arrayoflineofcode[$source][$reg[1]]['Code'] = $reg[6];
$arrayoflineofcode[$source][$reg[1]]['Complexity'] = $reg[7];
}
}
if (!empty($arrayoflineofcode[$source])) {
foreach ($arrayoflineofcode[$source] as $key => $val) {
$arrayofmetrics[$source]['Files'] += $val['Files'];
$arrayofmetrics[$source]['Lines'] += $val['Lines'];
$arrayofmetrics[$source]['Blanks'] += $val['Blanks'];
$arrayofmetrics[$source]['Comments'] += $val['Comments'];
$arrayofmetrics[$source]['Code'] += $val['Code'];
$arrayofmetrics[$source]['Complexity'] += $val['Complexity'];
}
}
}
/*
* View
*/
$html = '<html>';
$html .= '<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.9.0/css/all.min.css" integrity="sha512-q3eWabyZPc1XTCmF+8/LuE1ozpg5xxn7iO89yfSOd5/oKvyqLngoNGsx8jq92Y8eXJ/IRxQbEC+FGSYxtk2oiw==" crossorigin="anonymous" referrerpolicy="no-referrer" />';
$html .= '<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.0/jquery.min.js" integrity="sha512-3gJwYpMe3QewGELv8k/BX9vcqhryRdzRMxVfq6ngyWXwo03GFEzjsUm8Q7RZcHPHksttq7/GFoxjCVUjkjvPdw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>';
$html .= '
<style>
body {
margin: 10px;
margin-left: 50px;
margin-right: 50px;
}
h1 {
font-size: 1.5em;
font-weight: bold;
padding-top: 5px;
padding-bottom: 5px;
margin-top: 5px;
margin-bottom: 5px;
}
header {
text-align: center;
}
header, section.chapter {
margin-top: 10px;
margin-bottom: 10px;
padding: 10px;
}
table {
border-collapse: collapse;
}
th,td {
padding-top: 5px;
padding-bottom: 5px;
padding-left: 10px;
padding-right: 10px;
}
.left {
text-align: left;
}
.right {
text-align: right;
}
.opacity {
opacity: 0.5;
}
.centpercent {
width: 100%;
}
.hidden {
display: none;
}
.trgroup {
background-color: #EEE;
}
</style>';
$html .= '<body>';
$html .= '<header>';
$html .= '<h1>Advanced Project Statistics</h1>';
$currentDate = date("Y-m-d H:i:s"); // Format: Year-Month-Day Hour:Minute:Second
$html .= '<span class="opacity">Generated on '.$currentDate.'</span>';
$html .= '</header>';
$html .= '<section class="chapter">';
$html .= '<h2>Lines of code</h2>';
$html .= '<table class="centpercent">';
$html .= '<tr class="loc">';
$html .= '<th class="left">Language</td>';
$html .= '<th class="right">Bytes</th>';
$html .= '<th class="right">Files</th>';
$html .= '<th class="right">Lines</th>';
$html .= '<th class="right">Blanks</th>';
$html .= '<th class="right">Comments</th>';
$html .= '<th class="right">Code</th>';
//$html .= '<td class="right">'.$val['Complexity'].'</td>';
$html .= '</th>';
foreach (array('proj', 'dep') as $source) {
$html .= '<tr class="trgroup" id="source'.$source.'">';
if ($source == 'proj') {
$html .= '<td>All files from project only';
} elseif ($source == 'dep') {
$html .= '<td>All files from dependencies';
}
$html .= ' &nbsp; &nbsp; <span class="seedetail" data-source="'.$source.'">(See detail per file type...)</span>';
$html .= '<td class="right">'.formatNumber($arrayofmetrics[$source]['Bytes']).'</td>';
$html .= '<td class="right">'.formatNumber($arrayofmetrics[$source]['Files']).'</td>';
$html .= '<td class="right">'.formatNumber($arrayofmetrics[$source]['Lines']).'</td>';
$html .= '<td class="right">'.formatNumber($arrayofmetrics[$source]['Blanks']).'</td>';
$html .= '<td class="right">'.formatNumber($arrayofmetrics[$source]['Comments']).'</td>';
$html .= '<td class="right">'.formatNumber($arrayofmetrics[$source]['Code']).'</td>';
$html .= '<td>TODO graph here...</td>';
$html .= '</tr>';
if (!empty($arrayoflineofcode[$source])) {
foreach ($arrayoflineofcode[$source] as $key => $val) {
$html .= '<tr class="loc hidden source'.$source.' language'.str_replace(' ', '', $key).'">';
$html .= '<td>'.$key.'</td>';
$html .= '<td class="right"></td>';
$html .= '<td class="right">'.(empty($val['Files']) ? '' : formatNumber($val['Files'])).'</td>';
$html .= '<td class="right">'.(empty($val['Lines']) ? '' : formatNumber($val['Lines'])).'</td>';
$html .= '<td class="right">'.(empty($val['Blanks']) ? '' : formatNumber($val['Blanks'])).'</td>';
$html .= '<td class="right">'.(empty($val['Comments']) ? '' : formatNumber($val['Comments'])).'</td>';
$html .= '<td class="right">'.(empty($val['Code']) ? '' : formatNumber($val['Code'])).'</td>';
//$html .= '<td class="right">'.(empty($val['Complexity']) ? '' : $val['Complexity']).'</td>';
$html .= '<td>TODO graph here...</td>';
$html .= '</tr>';
}
}
}
$html .= '<tr class="trgroup">';
$html .= '<td class="left">Total</td>';
$html .= '<td class="right">'.formatNumber($arrayofmetrics['proj']['Bytes'] + $arrayofmetrics['dep']['Bytes']).'</td>';
$html .= '<td class="right">'.formatNumber($arrayofmetrics['proj']['Files'] + $arrayofmetrics['dep']['Files']).'</td>';
$html .= '<td class="right">'.formatNumber($arrayofmetrics['proj']['Lines'] + $arrayofmetrics['dep']['Lines']).'</td>';
$html .= '<td class="right">'.formatNumber($arrayofmetrics['proj']['Blanks'] + $arrayofmetrics['dep']['Blanks']).'</td>';
$html .= '<td class="right">'.formatNumber($arrayofmetrics['proj']['Comments'] + $arrayofmetrics['dep']['Comments']).'</td>';
$html .= '<td class="right">'.formatNumber($arrayofmetrics['proj']['Code'] + $arrayofmetrics['dep']['Code']).'</td>';
//$html .= '<td>'.$arrayofmetrics['Complexity'].'</td>';
$html .= '<td></td>';
$html .= '</tr>';
$html .= '</table>';
$html .= '</section>';
$html .= '<section class="chapter">';
$html .= '<h2>Project value</h2><br>';
$html .= 'COCOMO (Basic organic model) value: $';
$html .= formatNumber($arraycocomo['proj']['currency'] + $arraycocomo['dep']['currency'], 2);
$html .= '<br>';
$html .= 'COCOMO (Basic organic model) effort: ';
$html .= formatNumber($arraycocomo['proj']['people'] * $arraycocomo['proj']['effort'] + $arraycocomo['dep']['people'] * $arraycocomo['dep']['effort']);
$html .= ' monthes people<br>';
$html .= '</section>';
$html .= '<section class="chapter">';
$html .= '<h2>Technical debt ('.count($output_arrtd).')</h2><br>';
$html .= join('<br>'."\n", $output_arrtd);
$html .= '</section>';
$html .= '
<script>
$(document).ready(function() {
$( ".seedetail" ).on( "click", function() {
var source = $(this).attr("data-source");
console.log("Click on "+source);
jQuery(".source"+source).toggle();
} );
});
</script>
';
$html .= '</boby>';
$html .= '</html>';
$fh = fopen($outputpath, 'w');
if ($fh) {
fwrite($fh, $html);
fclose($fh);
print 'Generation of output file '.$outputfile.' done.'."\n";
} else {
print 'Failed to open '.$outputfile.' for ouput.'."\n";
}
/**
* function to format a number
*
* @param string|int $number Number to format
* @param int $nbdec Number of decimal digits
* @return string Formated string
*/
function formatNumber($number, $nbdec = 0)
{
return number_format($number, 0, '.', ' ');
}

View file

@ -62,5 +62,5 @@ fi
echo Think to launch also:
echo "> dev/tools/fixaltlanguages.sh fix all"
echo "For v11: Replace also regex \(.*(sponge|cornas|eratosthene|cyan).*\) with '' on *.lang files"
#echo "For v11: Replace also regex \(.*(sponge|cornas|eratosthene|cyan).*\) with '' on *.lang files"

View file

@ -153,7 +153,9 @@ if (empty($reshook)) {
$resql = $db->query($sql);
if ($resql) {
$obj = $db->fetch_object($resql);
$country_code = $obj->code;
if ($obj) {
$country_code = $obj->code;
}
} else {
dol_print_error($db);
}
@ -259,7 +261,7 @@ if (strlen(trim($search_account))) {
$search_account_tmp_clean = $search_account_tmp;
$search_account_clean = $search_account;
$startchar = '%';
if (strpos($search_account_tmp, '^') === 0) {
if (substr($search_account_tmp, 0, 1) === '^') {
$startchar = '';
$search_account_tmp_clean = preg_replace('/^\^/', '', $search_account_tmp);
$search_account_clean = preg_replace('/^\^/', '', $search_account);
@ -390,11 +392,11 @@ if ($resql) {
print '<option value="-1">&nbsp;</option>';
while ($i < $numbis) {
$obj = $db->fetch_object($resqlchart);
print '<option value="'.$obj->rowid.'"';
print ($pcgver == $obj->rowid) ? ' selected' : '';
print '>'.$obj->pcg_version.' - '.$obj->label.' - ('.$obj->country_code.')</option>';
if ($obj) {
print '<option value="'.$obj->rowid.'"';
print ($pcgver == $obj->rowid) ? ' selected' : '';
print '>'.$obj->pcg_version.' - '.$obj->label.' - ('.$obj->country_code.')</option>';
}
$i++;
}
} else {

View file

@ -296,11 +296,6 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) {
setEventMessages($db->error(), null, 'errors');
}
}
//$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
}
if (GETPOST('actioncancel', 'alpha')) {
//$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
}
if ($action == 'confirm_delete' && $confirm == 'yes') { // delete

View file

@ -78,9 +78,16 @@ if ($mysoc->isInEEC()) {
$list_account[] = 'ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT';
$list_account[] = '---Others---';
$list_account[] = 'ACCOUNTING_VAT_BUY_ACCOUNT';
$list_account[] = 'ACCOUNTING_VAT_SOLD_ACCOUNT';
$list_account[] = 'ACCOUNTING_VAT_BUY_ACCOUNT';
/*if ($mysoc->useRevenueStamp()) {
$list_account[] = 'ACCOUNTING_REVENUESTAMP_SOLD_ACCOUNT';
$list_account[] = 'ACCOUNTING_REVENUESTAMP_BUY_ACCOUNT';
}*/
$list_account[] = 'ACCOUNTING_VAT_PAY_ACCOUNT';
if (!empty($conf->global->ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE)) {
$list_account[] = 'ACCOUNTING_VAT_BUY_REVERSE_CHARGES_CREDIT';
$list_account[] = 'ACCOUNTING_VAT_BUY_REVERSE_CHARGES_DEBIT';
@ -110,6 +117,7 @@ if (isModEnabled('societe')) {
/*
* Actions
*/
if ($action == 'update') {
$error = 0;
// Process $list_account_main
@ -257,6 +265,8 @@ foreach ($list_account as $key) {
print img_picto('', 'payment_vat', 'class="pictofixedwidth"');
} elseif (preg_match('/^ACCOUNTING_VAT/', $key)) {
print img_picto('', 'vat', 'class="pictofixedwidth"');
/*} elseif (preg_match('/^ACCOUNTING_REVENUESTAMP/', $key)) {
print img_picto('', 'vat', 'class="pictofixedwidth"');*/
} elseif (preg_match('/^ACCOUNTING_ACCOUNT_CUSTOMER/', $key)) {
print img_picto('', 'bill', 'class="pictofixedwidth"');
} elseif (preg_match('/^LOAN_ACCOUNTING_ACCOUNT/', $key)) {

View file

@ -49,6 +49,18 @@ if (!$sortorder) {
// Load translation files required by the page
$langs->loadLangs(array("admin", "compta"));
$error = 0;
$errors = array();
// List of status
static $tmpstatut2label = array(
'0' => 'OpenFiscalYear',
'1' => 'CloseFiscalYear'
);
$object = new Fiscalyear($db);
// Security check
if ($user->socid > 0) {
accessforbidden();
@ -57,24 +69,6 @@ if (!$user->hasRight('accounting', 'fiscalyear', 'write')) { // If
accessforbidden();
}
$error = 0;
// List of status
static $tmpstatut2label = array(
'0' => 'OpenFiscalYear',
'1' => 'CloseFiscalYear'
);
$statut2label = array(
''
);
foreach ($tmpstatut2label as $key => $val) {
$statut2label[$key] = $langs->trans($val);
}
$errors = array();
$object = new Fiscalyear($db);
/*
* Actions
@ -165,7 +159,7 @@ if ($result) {
$i++;
}
} else {
print '<tr class="oddeven"><td colspan="7" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
print '<tr class="oddeven"><td colspan="7"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
}
print '</table>';
print '</div>';

View file

@ -497,7 +497,7 @@ if ($action == 'create') {
// Ref document
print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print '<table class="nobordernopadding centpercent"><tr><td>';
print $langs->trans('Piece');
print '</td>';
if ($action != 'editdocref') {

View file

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2016 Jamal Elbaz <jamelbaz@gmail.pro>
* Copyright (C) 2016-2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2023 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -123,11 +123,19 @@ class AccountancyCategory // extends CommonObject
public $lines_display;
/**
* @var mixed Sample property 1
* @var mixed Sum debit credit
*/
public $sdc;
/**
* @var array Sum debit credit per month
*/
public $sdcpermonth;
/**
* @var array Sum debit credit per account
*/
public $sdcperaccount;
/**
* Constructor

View file

@ -734,7 +734,7 @@ class AccountingAccount extends CommonObject
* @param FactureLigne|SupplierInvoiceLine $factureDet Facture Det
* @param array $accountingAccount Array of Accounting account
* @param string $type Customer / Supplier
* @return array|int Accounting accounts suggested or < 0 if technical error.
* @return array|int Array of accounting accounts suggested or < 0 if technical error.
* 'suggestedaccountingaccountbydefaultfor'=>Will be used for the label to show on tooltip for account by default on any product
* 'suggestedaccountingaccountfor'=>Is the account suggested for this product
*/
@ -770,39 +770,39 @@ class AccountingAccount extends CommonObject
$suggestedaccountingaccountbydefaultfor = '';
if ($factureDet->product_type == 1) {
if ($buyer->country_code == $seller->country_code || empty($buyer->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
$code_l = (!empty($conf->global->{'ACCOUNTING_SERVICE_' . $const_name . '_ACCOUNT'}) ? $conf->global->{'ACCOUNTING_SERVICE_' . $const_name . '_ACCOUNT'} : '');
$code_l = getDolGlobalString('ACCOUNTING_SERVICE_' . $const_name . '_ACCOUNT');
$suggestedaccountingaccountbydefaultfor = '';
} else {
if ($isSellerInEEC && $isBuyerInEEC && $factureDet->tva_tx != 0) { // European intravat sale, but with a VAT
$code_l = (!empty($conf->global->{'ACCOUNTING_SERVICE_' . $const_name . '_ACCOUNT'}) ? $conf->global->{'ACCOUNTING_SERVICE_' . $const_name . '_ACCOUNT'} : '');
$code_l = getDolGlobalString('ACCOUNTING_SERVICE_' . $const_name . '_ACCOUNT');
$suggestedaccountingaccountbydefaultfor = 'eecwithvat';
} elseif ($isSellerInEEC && $isBuyerInEEC && empty($buyer->tva_intra)) { // European intravat sale, without VAT intra community number
$code_l = (!empty($conf->global->{'ACCOUNTING_SERVICE_' . $const_name . '_ACCOUNT'}) ? $conf->global->{'ACCOUNTING_SERVICE_' . $const_name . '_ACCOUNT'} : '');
$code_l = getDolGlobalString('ACCOUNTING_SERVICE_' . $const_name . '_ACCOUNT');
$suggestedaccountingaccountbydefaultfor = 'eecwithoutvatnumber';
} elseif ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
$code_l = (!empty($conf->global->{'ACCOUNTING_SERVICE_' . $const_name . '_INTRA_ACCOUNT'}) ? $conf->global->{'ACCOUNTING_SERVICE_' . $const_name . '_INTRA_ACCOUNT'} : '');
$code_l = getDolGlobalString('ACCOUNTING_SERVICE_' . $const_name . '_INTRA_ACCOUNT');
$suggestedaccountingaccountbydefaultfor = 'eec';
} else { // Foreign sale
$code_l = (!empty($conf->global->{'ACCOUNTING_SERVICE_' . $const_name . '_EXPORT_ACCOUNT'}) ? $conf->global->{'ACCOUNTING_SERVICE_' . $const_name . '_EXPORT_ACCOUNT'} : '');
$code_l = getDolGlobalString('ACCOUNTING_SERVICE_' . $const_name . '_EXPORT_ACCOUNT');
$suggestedaccountingaccountbydefaultfor = 'export';
}
}
} elseif ($factureDet->product_type == 0) {
if ($buyer->country_code == $seller->country_code || empty($buyer->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
$code_l = (!empty($conf->global->{'ACCOUNTING_PRODUCT_' . $const_name . '_ACCOUNT'}) ? $conf->global->{'ACCOUNTING_PRODUCT_' . $const_name . '_ACCOUNT'} : '');
$code_l = getDolGlobalString('ACCOUNTING_PRODUCT_' . $const_name . '_ACCOUNT');
$suggestedaccountingaccountbydefaultfor = '';
} else {
if ($isSellerInEEC && $isBuyerInEEC && $factureDet->tva_tx != 0) { // European intravat sale, but with a VAT
$code_l = (!empty($conf->global->{'ACCOUNTING_PRODUCT_' . $const_name . '_ACCOUNT'}) ? $conf->global->{'ACCOUNTING_PRODUCT_' . $const_name . '_ACCOUNT'} : '');
$code_l = getDolGlobalString('ACCOUNTING_PRODUCT_' . $const_name . '_ACCOUNT');
$suggestedaccountingaccountbydefaultfor = 'eecwithvat';
} elseif ($isSellerInEEC && $isBuyerInEEC && empty($buyer->tva_intra)) { // European intravat sale, without VAT intra community number
$code_l = (!empty($conf->global->{'ACCOUNTING_PRODUCT_' . $const_name . '_ACCOUNT'}) ? $conf->global->{'ACCOUNTING_PRODUCT_' . $const_name . '_ACCOUNT'} : '');
$code_l = getDolGlobalString('ACCOUNTING_PRODUCT_' . $const_name . '_ACCOUNT');
$suggestedaccountingaccountbydefaultfor = 'eecwithoutvatnumber';
} elseif ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
$code_l = (!empty($conf->global->{'ACCOUNTING_PRODUCT_' . $const_name . '_INTRA_ACCOUNT'}) ? $conf->global->{'ACCOUNTING_PRODUCT_' . $const_name . '_INTRA_ACCOUNT'} : '');
$code_l = getDolGlobalString('ACCOUNTING_PRODUCT_' . $const_name . '_INTRA_ACCOUNT');
$suggestedaccountingaccountbydefaultfor = 'eec';
} else {
$code_l = (!empty($conf->global->{'ACCOUNTING_PRODUCT_' . $const_name . '_EXPORT_ACCOUNT'}) ? $conf->global->{'ACCOUNTING_PRODUCT_' . $const_name . '_EXPORT_ACCOUNT'} : '');
$code_l = getDolGlobalString('ACCOUNTING_PRODUCT_' . $const_name . '_EXPORT_ACCOUNT');
$suggestedaccountingaccountbydefaultfor = 'export';
}
}
@ -941,5 +941,7 @@ class AccountingAccount extends CommonObject
return $hookmanager->resArray;
}
}
return -1;
}
}

View file

@ -42,7 +42,7 @@ class AccountingJournal extends CommonObject
public $fk_element = '';
/**
* @var int 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
* @var int Does object support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
*/
public $ismultientitymanaged = 0;

View file

@ -282,7 +282,7 @@ class BookKeeping extends CommonObject
$this->errors[] = $langs->trans('ErrorFieldAccountNotDefinedForBankLine', $this->fk_docdet, $this->doc_type);
} else {
//$this->errors[]=$langs->trans('ErrorFieldAccountNotDefinedForInvoiceLine', $this->doc_ref, $this->label_compte);
$mesg = $this->doc_ref.', '.$langs->trans("AccountAccounting").': '.$this->numero_compte;
$mesg = $this->doc_ref.', '.$langs->trans("AccountAccounting").': '.($this->numero_compte != -1 ? $this->numero_compte : $langs->trans("Unknown"));
if ($this->subledger_account && $this->subledger_account != $this->numero_compte) {
$mesg .= ', '.$langs->trans("SubledgerAccount").': '.$this->subledger_account;
}
@ -716,11 +716,10 @@ class BookKeeping extends CommonObject
/**
* Load object in memory from the database
*
* @param int $id Id object
* @param string $ref Ref
* @param string $mode Mode
*
* @return int <0 if KO, 0 if not found, >0 if OK
* @param int $id Id object
* @param string $ref Ref (Not used. Does not exists on this table, same as rowid)
* @param string $mode Mode
* @return int Int <0 if KO, 0 if not found, >0 if OK
*/
public function fetch($id, $ref = null, $mode = '')
{
@ -761,7 +760,7 @@ class BookKeeping extends CommonObject
$sql .= ' WHERE 1 = 1';
$sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
if (null !== $ref) {
$sql .= " AND t.ref = '".$this->db->escape($ref)."'";
$sql .= " AND t.rowid = ".((int) $ref);
} else {
$sql .= ' AND t.rowid = '.((int) $id);
}
@ -1480,15 +1479,16 @@ class BookKeeping extends CommonObject
* Delete bookkeeping by importkey
*
* @param string $importkey Import key
* @param string $mode Mode
* @return int Result
*/
public function deleteByImportkey($importkey)
public function deleteByImportkey($importkey, $mode = '')
{
$this->db->begin();
// first check if line not yet in bookkeeping
$sql = "DELETE";
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element;
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.$mode;
$sql .= " WHERE import_key = '".$this->db->escape($importkey)."'";
$resql = $this->db->query($sql);
@ -1562,9 +1562,10 @@ class BookKeeping extends CommonObject
* Delete bookkeeping by piece number
*
* @param int $piecenum Piecenum to delete
* @param string $mode Mode
* @return int Result
*/
public function deleteMvtNum($piecenum)
public function deleteMvtNum($piecenum, $mode = '')
{
global $conf;
@ -1572,7 +1573,7 @@ class BookKeeping extends CommonObject
// first check if line not yet in bookkeeping
$sql = "DELETE";
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element;
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.$mode;
$sql .= " WHERE piece_num = ".(int) $piecenum;
$sql .= " AND date_validated IS NULL"; // For security, exclusion of validated entries at the time of deletion
$sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features

View file

@ -262,11 +262,14 @@ if (isModEnabled('accounting')) {
print $boxlist;
print '</div>';
} else {
} elseif (isModEnabled('compta')) {
print load_fiche_titre($langs->trans("AccountancyArea"), '', 'accountancy');
print '<span class="opacitymedium">'.$langs->trans("Module10Desc")."</span>\n";
print "<br>";
} else {
// This case can happen mode no accounting module is on but module "intracommreport" is on
print load_fiche_titre($langs->trans("AccountancyArea"), '', 'accountancy');
}
// End of page

View file

@ -861,7 +861,7 @@ if (!$error && $action == 'writebookkeeping') {
if (price2num($totaldebit, 'MT') != price2num($totalcredit, 'MT')) {
$error++;
$errorforline++;
setEventMessages('Try to insert a non balanced transaction in book for '.$ref.'. Canceled. Surely a bug.', null, 'errors');
setEventMessages('We tried to insert a non balanced transaction in book for '.$ref.'. Canceled. Surely a bug.', null, 'errors');
}
if (!$errorforline) {

View file

@ -57,6 +57,9 @@ if ($in_bookkeeping == '') {
$now = dol_now();
$hookmanager->initHooks(array('expensereportsjournal'));
$parameters = array();
// Security check
if (!isModEnabled('accounting')) {
accessforbidden();
@ -102,11 +105,17 @@ $sql = "SELECT er.rowid, er.ref, er.date_debut as de,";
$sql .= " erd.rowid as erdid, erd.comments, erd.total_ht, erd.total_tva, erd.total_localtax1, erd.total_localtax2, erd.tva_tx, erd.total_ttc, erd.fk_code_ventilation, erd.vat_src_code, ";
$sql .= " u.rowid as uid, u.firstname, u.lastname, u.accountancy_code as user_accountancy_account,";
$sql .= " f.accountancy_code, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql .= " FROM ".MAIN_DB_PREFIX."expensereport_det as erd";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_fees as f ON f.id = erd.fk_c_type_fees";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = erd.fk_code_ventilation";
$sql .= " JOIN ".MAIN_DB_PREFIX."expensereport as er ON er.rowid = erd.fk_expensereport";
$sql .= " JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = er.fk_user_author";
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql .= " WHERE er.fk_statut > 0";
$sql .= " AND erd.fk_code_ventilation > 0";
$sql .= " AND er.entity IN (".getEntity('expensereport', 0).")"; // We don't share object for accountancy
@ -124,6 +133,9 @@ if ($in_bookkeeping == 'already') {
if ($in_bookkeeping == 'notyet') {
$sql .= " AND er.rowid NOT IN (SELECT fk_doc FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab WHERE ab.doc_type='expense_report')";
}
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql .= " ORDER BY er.date_debut";
dol_syslog('accountancy/journal/expensereportsjournal.php', LOG_DEBUG);
@ -380,7 +392,7 @@ if ($action == 'writebookkeeping') {
if (price2num($totaldebit, 'MT') != price2num($totalcredit, 'MT')) {
$error++;
$errorforline++;
setEventMessages('Try to insert a non balanced transaction in book for '.$val["ref"].'. Canceled. Surely a bug.', null, 'errors');
setEventMessages('We tried to insert a non balanced transaction in book for '.$val["ref"].'. Canceled. Surely a bug.', null, 'errors');
}
if (!$errorforline) {
@ -469,6 +481,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
print "\n";
}
}
// VAT
foreach ($tabtva[$key] as $k => $mt) {
if ($mt) {

View file

@ -122,6 +122,9 @@ if (getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) {
$sql .= " p.accountancy_code_buy,";
}
$sql .= " aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as fd";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = fd.fk_product";
if (getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) {
@ -134,6 +137,9 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays ";
if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) {
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity);
}
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql .= " WHERE f.fk_statut > 0";
$sql .= " AND fd.fk_code_ventilation > 0";
$sql .= " AND f.entity IN (".getEntity('facture_fourn', 0).")"; // We don't share object for accountancy
@ -156,6 +162,9 @@ if ($in_bookkeeping == 'already') {
if ($in_bookkeeping == 'notyet') {
$sql .= " AND f.rowid NOT IN (SELECT fk_doc FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab WHERE ab.doc_type='supplier_invoice')";
}
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql .= " ORDER BY f.datef";
dol_syslog('accountancy/journal/purchasesjournal.php', LOG_DEBUG);
@ -654,7 +663,7 @@ if ($action == 'writebookkeeping') {
$error++;
$errorforline++;
$errorforinvoice[$key] = 'amountsnotbalanced';
setEventMessages('Try to insert a non balanced transaction in book for '.$invoicestatic->ref.'. Canceled. Surely a bug.', null, 'errors');
setEventMessages('We tried to insert a non balanced transaction in book for '.$invoicestatic->ref.'. Canceled. Surely a bug.', null, 'errors');
}
if (!$errorforline) {
@ -1130,7 +1139,7 @@ if (empty($action) || $action == 'view') {
print "<td>";
$accountoshow = length_accountg($k);
if (($accountoshow == "") || $accountoshow == 'NotDefined') {
print '<span class="error">'.$langs->trans("VATAccountNotDefined").' ('.$langs->trans("Purchase").')</span>';
print '<span class="error">'.$langs->trans("VATAccountNotDefined").' ('.$langs->trans("AccountingJournalType3").')</span>';
} else {
print $accountoshow;
}

View file

@ -109,7 +109,7 @@ if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))
$date_end = dol_get_last_day($pastmonthyear, $pastmonth, false);
}
$sql = "SELECT f.rowid, f.ref, f.type, f.situation_cycle_ref, f.datef as df, f.ref_client, f.date_lim_reglement as dlr, f.close_code, f.retained_warranty,";
$sql = "SELECT f.rowid, f.ref, f.type, f.situation_cycle_ref, f.datef as df, f.ref_client, f.date_lim_reglement as dlr, f.close_code, f.retained_warranty, f.revenuestamp,";
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.situation_percent, fd.vat_src_code, fd.info_bits,";
$sql .= " s.rowid as socid, s.nom as name, s.code_client, s.code_fournisseur,";
if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) {
@ -125,6 +125,9 @@ if (getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) {
} else {
$sql .= " p.accountancy_code_sell";
}
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = fd.fk_product";
if (getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) {
@ -136,6 +139,9 @@ $sql .= " JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) {
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity);
}
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql .= " WHERE fd.fk_code_ventilation > 0";
$sql .= " AND f.entity IN (".getEntity('invoice', 0).')'; // We don't share object for accountancy, we use source object sharing
$sql .= " AND f.fk_statut > 0";
@ -161,8 +167,11 @@ if ($in_bookkeeping == 'notyet') {
$sql .= " AND f.rowid NOT IN (SELECT fk_doc FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')";
// $sql .= " AND fd.rowid NOT IN (SELECT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')"; // Useless, we save one line for all products with same account
}
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql .= " ORDER BY f.datef, f.ref";
//print $sql; exit;
//print $sql;
dol_syslog('accountancy/journal/sellsjournal.php', LOG_DEBUG);
$result = $db->query($sql);
@ -172,6 +181,7 @@ if ($result) {
$tabtva = array();
$def_tva = array();
$tabwarranty = array();
$tabrevenuestamp = array();
$tabttc = array();
$tablocaltax1 = array();
$tablocaltax2 = array();
@ -199,17 +209,19 @@ if ($result) {
}
}
//$compta_revenuestamp = getDolGlobalString('ACCOUNTING_REVENUESTAMP_SOLD_ACCOUNT', 'NotDefined');
$vatdata = getTaxesFromId($obj->tva_tx.($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : ''), $mysoc, $mysoc, 0);
$compta_tva = (!empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $cpttva);
$compta_localtax1 = (!empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $cpttva);
$compta_localtax2 = (!empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $cpttva);
// Define array to display all VAT rates that use this accounting account $compta_tva
// Define the array to store the detail of each vat rate and code for lines
if (price2num($obj->tva_tx) || !empty($obj->vat_src_code)) {
$def_tva[$obj->rowid][$compta_tva][vatrate($obj->tva_tx).($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : '')] = (vatrate($obj->tva_tx).($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : ''));
}
// Create a compensation rate.
// Create a compensation rate for situation invoice.
$situation_ratio = 1;
if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) {
if ($obj->situation_cycle_ref) {
@ -228,6 +240,8 @@ if ($result) {
}
}
$revenuestamp = (double) price2num($obj->revenuestamp, 'MT');
// Invoice lines
$tabfac[$obj->rowid]["date"] = $db->jdate($obj->df);
$tabfac[$obj->rowid]["datereg"] = $db->jdate($obj->dlr);
@ -235,6 +249,7 @@ if ($result) {
$tabfac[$obj->rowid]["type"] = $obj->type;
$tabfac[$obj->rowid]["description"] = $obj->label_compte;
$tabfac[$obj->rowid]["close_code"] = $obj->close_code; // close_code = 'replaced' for replacement invoices (not used in most european countries)
$tabfac[$obj->rowid]["revenuestamp"] = $revenuestamp;
//$tabfac[$obj->rowid]["fk_facturedet"] = $obj->fdid;
// Avoid warnings
@ -259,12 +274,19 @@ if ($result) {
// real data we should have stored and result obtained with a compensation.
// It also seems that credit notes on situation invoices are correctly saved (but it depends on the version used in fact).
// For credit notes, we hope to have situation_ratio = 1 so the compensation has no effect to avoid introducing troubles with credit notes.
$total_ttc = $obj->total_ttc * $situation_ratio;
if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) {
$total_ttc = $obj->total_ttc * $situation_ratio;
} else {
$total_ttc = $obj->total_ttc;
}
// Move a part of the retained warrenty into the account of warranty
if (getDolGlobalString('INVOICE_USE_RETAINED_WARRANTY') && $obj->retained_warranty > 0) {
$retained_warranty = (double) price2num($total_ttc * $obj->retained_warranty / 100, 'MT');
$retained_warranty = (double) price2num($total_ttc * $obj->retained_warranty / 100, 'MT'); // Calculate the amount of warrenty for this line (using the percent value)
$tabwarranty[$obj->rowid][$compta_soc] += $retained_warranty;
$total_ttc -= $retained_warranty;
}
$tabttc[$obj->rowid][$compta_soc] += $total_ttc;
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht * $situation_ratio;
$tva_npr = (($obj->info_bits & 1 == 1) ? 1 : 0);
@ -274,6 +296,32 @@ if ($result) {
$tablocaltax1[$obj->rowid][$compta_localtax1] += $obj->total_localtax1 * $situation_ratio;
$tablocaltax2[$obj->rowid][$compta_localtax2] += $obj->total_localtax2 * $situation_ratio;
$compta_revenuestamp = 'NotDefined';
if (!empty($revenuestamp)) {
$sqlrevenuestamp = "SELECT accountancy_code_sell FROM ".MAIN_DB_PREFIX."c_revenuestamp";
$sqlrevenuestamp .= " WHERE fk_pays = ".((int) $mysoc->country_id);
$sqlrevenuestamp .= " AND taux = ".((double) $revenuestamp);
$sqlrevenuestamp .= " AND active = 1";
$resqlrevenuestamp = $db->query($sqlrevenuestamp);
if ($resqlrevenuestamp) {
$num_rows_revenuestamp = $db->num_rows($resqlrevenuestamp);
if ($num_rows_revenuestamp > 1) {
dol_print_error($db, 'Failed 2 or more lines for the revenue stamp of your country. Check the dictionary of revenue stamp.');
} else {
$objrevenuestamp = $db->fetch_object($resqlrevenuestamp);
if ($objrevenuestamp) {
$compta_revenuestamp = $objrevenuestamp->accountancy_code_sell;
}
}
}
}
if (empty($tabrevenuestamp[$obj->rowid][$compta_revenuestamp]) && !empty($revenuestamp)) {
// The revenue stamp was never seen for this invoice id=$obj->rowid
$tabttc[$obj->rowid][$compta_soc] += $obj->revenuestamp;
$tabrevenuestamp[$obj->rowid][$compta_revenuestamp] = $obj->revenuestamp;
}
$tabcompany[$obj->rowid] = array(
'id' => $obj->socid,
@ -284,13 +332,15 @@ if ($result) {
$i++;
}
// After the loop on each line
} else {
dol_print_error($db);
}
$errorforinvoice = array();
// Loop in invoices to detect lines with not binding lines
// Loop on all invoices to detect lines without binded code (fk_code_ventilation <= 0)
foreach ($tabfac as $key => $val) { // Loop on each invoice
$sql = "SELECT COUNT(fd.rowid) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd";
@ -335,6 +385,7 @@ if ($action == 'writebookkeeping') {
$companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name'];
$companystatic->code_compta = $tabcompany[$key]['code_compta'];
$companystatic->code_compta_client = $tabcompany[$key]['code_compta'];
$companystatic->code_client = $tabcompany[$key]['code_client'];
$companystatic->client = 3;
@ -603,12 +654,66 @@ if ($action == 'writebookkeeping') {
}
}
// Revenue stamp
if (!$errorforline) {
foreach ($tabrevenuestamp[$key] as $k => $mt) {
if ($mt) {
$accountingaccount->fetch(null, $k, true); // TODO Use a cache for label
$label_account = $accountingaccount->label;
$bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"];
$bookkeeping->date_lim_reglement = $val["datereg"];
$bookkeeping->doc_ref = $val["ref"];
$bookkeeping->date_creation = $now;
$bookkeeping->doc_type = 'customer_invoice';
$bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
$bookkeeping->thirdparty_code = $companystatic->code_client;
$bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $k;
$bookkeeping->label_compte = $label_account;
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref.' - '.$langs->trans("RevenueStamp");
$bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt < 0) ? -$mt : 0;
$bookkeeping->credit = ($mt >= 0) ? $mt : 0;
$bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $langs->transnoentities($journal_label);
$bookkeeping->fk_user_author = $user->id;
$bookkeeping->entity = $conf->entity;
$totaldebit += $bookkeeping->debit;
$totalcredit += $bookkeeping->credit;
$result = $bookkeeping->create($user);
if ($result < 0) {
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') { // Already exists
$error++;
$errorforline++;
$errorforinvoice[$key] = 'alreadyjournalized';
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
} else {
$error++;
$errorforline++;
$errorforinvoice[$key] = 'other';
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
}
}
}
}
}
// Protection against a bug on lines before
if (!$errorforline && (price2num($totaldebit, 'MT') != price2num($totalcredit, 'MT'))) {
$error++;
$errorforline++;
$errorforinvoice[$key] = 'amountsnotbalanced';
setEventMessages('Try to insert a non balanced transaction in book for '.$invoicestatic->ref.'. Canceled. Surely a bug.', null, 'errors');
setEventMessages('We Tried to insert a non balanced transaction in book for '.$invoicestatic->ref.'. Canceled. Surely a bug.', null, 'errors');
}
if (!$errorforline) {
@ -660,6 +765,7 @@ $form = new Form($db);
// Export
if ($action == 'exportcsv') { // ISO and not UTF8 !
// Note that to have the button to get this feature enabled, you must enable ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL
$sep = getDolGlobalString('ACCOUNTING_EXPORT_SEPARATORCSV');
$filename = 'journal';
@ -787,6 +893,25 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
}
}
}
// Revenue stamp
foreach ($tabrevenuestamp[$key] as $k => $mt) {
//if ($mt) {
print '"'.$key.'"'.$sep;
print '"'.$date.'"'.$sep;
print '"'.$val["ref"].'"'.$sep;
print '"'.utf8_decode(dol_trunc($companystatic->name, 32)).'"'.$sep;
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
print '""'.$sep;
print '"'.$langs->trans("RevenueStamp").'"'.$sep;
print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.$invoicestatic->ref.' - '.$langs->trans("RevenueStamp").'"'.$sep;
print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
print '"'.$journal.'"';
print "\n";
//}
}
}
}
@ -883,6 +1008,7 @@ if (empty($action) || $action == 'view') {
$companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name'];
$companystatic->code_compta = $tabcompany[$key]['code_compta'];
$companystatic->code_compta_client = $tabcompany[$key]['code_compta'];
$companystatic->code_client = $tabcompany[$key]['code_client'];
$companystatic->client = 3;
@ -956,7 +1082,7 @@ if (empty($action) || $action == 'view') {
print "<td>";
$accountoshow = length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY'));
if (($accountoshow == "") || $accountoshow == 'NotDefined') {
print '<span class="error">'.$langs->trans("MainAccountForCustomersNotDefined").'</span>';
print '<span class="error">'.$langs->trans("MainAccountForRetainedWarrantyNotDefined").'</span>';
} else {
print $accountoshow;
}
@ -1067,7 +1193,7 @@ if (empty($action) || $action == 'view') {
print "<td>";
$accountoshow = length_accountg($k);
if (($accountoshow == "") || $accountoshow == 'NotDefined') {
print '<span class="error">'.$langs->trans("VATAccountNotDefined").' ('.$langs->trans("Sale").')</span>';
print '<span class="error">'.$langs->trans("VATAccountNotDefined").' ('.$langs->trans("AccountingJournalType2").')</span>';
} else {
print $accountoshow;
}
@ -1085,6 +1211,30 @@ if (empty($action) || $action == 'view') {
}
}
}
// Warranty
foreach ($tabrevenuestamp[$key] as $k => $mt) {
print '<tr class="oddeven">';
print "<!-- Thirdparty revenuestamp -->";
print "<td>".$date."</td>";
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
// Account
print "<td>";
$accountoshow = length_accountg($k);
if (($accountoshow == "") || $accountoshow == 'NotDefined') {
print '<span class="error">'.$langs->trans("MainAccountForRevenueStampSaleNotDefined").'</span>';
} else {
print $accountoshow;
}
print '</td>';
// Subledger account
print "<td>";
print '</td>';
print "<td>".$companystatic->getNomUrl(0, 'customer', 16).' - '.$invoicestatic->ref.' - '.$langs->trans("RevenueStamp")."</td>";
print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
print "</tr>";
}
}
if (!$i) {

View file

@ -340,7 +340,9 @@ print $form->selectyesno('ADHERENT_MAIL_REQUIRED', (!empty($conf->global->ADHERE
print "</td></tr>\n";
// Login/Pass required for members
print '<tr class="oddeven"><td>'.$langs->trans("AdherentLoginRequired").'</td><td>';
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("AdherentLoginRequired"), $langs->trans("AdherentLoginRequiredDesc"));
print '</td><td>';
print $form->selectyesno('ADHERENT_LOGIN_NOT_REQUIRED', (!empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED) ? 0 : 1), 1);
print "</td></tr>\n";

View file

@ -275,7 +275,7 @@ abstract class ActionsAdherentCardCommon
$obj = $this->db->fetch_object($resql);
$this->object->country_code = $obj->code;
$this->object->country = $langs->trans("Country".$obj->code) ? $langs->trans("Country".$obj->code) : $obj->libelle;
$this->object->country = $langs->trans("Country".$obj->code) ? $langs->trans("Country".$obj->code) : $obj->label;
} else {
dol_print_error($this->db);
}

View file

@ -119,6 +119,10 @@ if ($id) {
// Security check
$result = restrictedArea($user, 'adherent', $object->id, '', '', 'socid', 'rowid', 0);
if (!$user->hasRight('adherent', 'creer') && $action == 'edit') {
accessforbidden('Not enough permission');
}
$linkofpubliclist = DOL_MAIN_URL_ROOT.'/public/members/public_list.php'.((isModEnabled('multicompany')) ? '?entity='.$conf->entity : '');
@ -293,7 +297,9 @@ if (empty($reshook)) {
$object->lastname = trim(GETPOST("lastname", 'alphanohtml'));
$object->gender = trim(GETPOST("gender", 'alphanohtml'));
$object->login = trim(GETPOST("login", 'alphanohtml'));
$object->pass = trim(GETPOST("pass", 'none')); // For password, we must use 'none'
if (GETPOSTISSET('pass')) {
$object->pass = trim(GETPOST("pass", 'none')); // For password, we must use 'none'
}
$object->societe = trim(GETPOST("societe", 'alphanohtml')); // deprecated
$object->company = trim(GETPOST("societe", 'alphanohtml'));
@ -329,6 +335,7 @@ if (empty($reshook)) {
// Get status and public property
$object->statut = GETPOST("statut", 'alpha');
$object->status = GETPOST("statut", 'alpha');
$object->public = GETPOST("public", 'alpha');
// Fill array 'array_options' with data from add form
@ -346,10 +353,19 @@ if (empty($reshook)) {
}
// Check if we need to also synchronize password information
$nosyncuserpass = 0;
if ($object->user_id) { // If linked to a user
if ($user->id != $object->user_id && !$user->hasRight('user', 'user', 'password')) {
$nosyncuserpass = 1; // Disable synchronizing
$nosyncuserpass = 1; // no by default
if (GETPOSTISSET('pass')) {
if ($object->user_id) { // If member is linked to a user
$nosyncuserpass = 0; // We may try to sync password
if ($user->id == $object->user_id) {
if (!$user->hasRight('user', 'self', 'password')) {
$nosyncuserpass = 1; // Disable synchronizing
}
} else {
if (!$user->hasRight('user', 'user', 'password')) {
$nosyncuserpass = 1; // Disable synchronizing
}
}
}
}
@ -447,10 +463,6 @@ if (empty($reshook)) {
$phone = GETPOST("phone", 'alpha');
$phone_perso = GETPOST("phone_perso", 'alpha');
$phone_mobile = GETPOST("phone_mobile", 'alpha');
// $skype=GETPOST("member_skype", 'alpha');
// $twitter=GETPOST("member_twitter", 'alpha');
// $facebook=GETPOST("member_facebook", 'alpha');
// $linkedin=GETPOST("member_linkedin", 'alpha');
$email = preg_replace('/\s+/', '', GETPOST("member_email", 'alpha'));
$url = trim(GETPOST('url', 'custom', 0, FILTER_SANITIZE_URL));
$login = GETPOST("member_login", 'alphanohtml');
@ -568,7 +580,7 @@ if (empty($reshook)) {
if (!$error) {
$db->begin();
// Email about right and login does not exist
// Create the member
$result = $object->create($user);
if ($result > 0) {
// Foundation categories
@ -576,13 +588,15 @@ if (empty($reshook)) {
$object->setCategories($memcats);
$db->commit();
$rowid = $object->id;
$id = $object->id;
$backtopage = preg_replace('/__ID__/', $id, $backtopage);
} else {
$error++;
$db->rollback();
$error++;
setEventMessages($object->error, $object->errors, 'errors');
}
@ -1215,7 +1229,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Password
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
print '<tr><td class="fieldrequired">'.$langs->trans("Password").'</td><td><input type="password" name="pass" class="minwidth300" maxlength="50" value="'.dol_escape_htmltag(GETPOSTISSET("pass") ? GETPOST("pass", 'none', 2) : $object->pass).'"></td></tr>';
print '<tr><td class="fieldrequired">'.$langs->trans("Password").'</td><td><input type="password" name="pass" class="minwidth300" maxlength="50" value="'.dol_escape_htmltag(GETPOSTISSET("pass") ? GETPOST("pass", 'none', 2) : '').'"></td></tr>';
}
// Type

View file

@ -125,26 +125,26 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg) {
// List of values to scan for a replacement
$substitutionarray = array(
'__ID__'=>$objp->rowid,
'__REF__'=>$objp->ref,
'__LOGIN__'=>$objp->login,
'__FIRSTNAME__'=>$objp->firstname,
'__LASTNAME__'=>$objp->lastname,
'__FULLNAME__'=>$adherentstatic->getFullName($langs),
'__COMPANY__'=>$objp->company,
'__ADDRESS__'=>$objp->address,
'__ZIP__'=>$objp->zip,
'__TOWN__'=>$objp->town,
'__COUNTRY__'=>$objp->country,
'__COUNTRY_CODE__'=>$objp->country_code,
'__EMAIL__'=>$objp->email,
'__BIRTH__'=>dol_print_date($objp->birth, 'day'),
'__TYPE__'=>$objp->type,
'__YEAR__'=>$year,
'__MONTH__'=>$month,
'__DAY__'=>$day,
'__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT,
'__SERVER__'=>"https://".$_SERVER["SERVER_NAME"]."/"
'__ID__' => $objp->rowid,
'__REF__' => $objp->ref,
'__LOGIN__' => empty($objp->login) ? '' : $objp->login,
'__FIRSTNAME__' => empty($objp->firstname) ? '' : $objp->firstname,
'__LASTNAME__' => empty($objp->lastname) ? '' : $objp->lastname,
'__FULLNAME__' => $adherentstatic->getFullName($langs),
'__COMPANY__' => empty($objp->company) ? '' : $objp->company,
'__ADDRESS__' => empty($objp->address) ? '' : $objp->address,
'__ZIP__' => empty($objp->zip) ? '' : $objp->zip,
'__TOWN__' => empty($objp->town) ? '' : $objp->town,
'__COUNTRY__' => empty($objp->country) ? '' : $objp->country,
'__COUNTRY_CODE__' => empty($objp->country_code) ? '' : $objp->country_code,
'__EMAIL__' => empty($objp->email) ? '' : $objp->email,
'__BIRTH__' => dol_print_date($objp->birth, 'day'),
'__TYPE__' => empty($objp->type) ? '' : $objp->type,
'__YEAR__' => $year,
'__MONTH__' => $month,
'__DAY__' => $day,
'__DOL_MAIN_URL_ROOT__' => DOL_MAIN_URL_ROOT,
'__SERVER__' => "https://".$_SERVER["SERVER_NAME"]."/"
);
complete_substitutions_array($substitutionarray, $langs, $adherentstatic);

View file

@ -133,79 +133,11 @@ class Adherent extends CommonObject
*/
public $socid;
/**
* @var string Address
*/
public $address;
/**
* @var string zipcode
*/
public $zip;
/**
* @var string town
*/
public $town;
/**
* @var int Id of state
*/
public $state_id;
/**
* @var string Code of state
*/
public $state_code;
/**
* @var string Label of state
*/
public $state;
/**
* @var string email
*/
public $email;
/**
* @var string url
*/
public $url;
/**
* @var array array of socialnetworks
*/
public $socialnetworks;
/**
* @var string skype account
* @deprecated
* @see $socialnetworks
*/
public $skype;
/**
* @var string twitter account
* @deprecated
* @see $socialnetworks
*/
public $twitter;
/**
* @var string facebook account
* @deprecated
* @see $socialnetworks
*/
public $facebook;
/**
* @var string linkedin account
* @deprecated
* @see $socialnetworks
*/
public $linkedin;
/**
* @var string Phone number
*/
@ -337,16 +269,11 @@ class Adherent extends CommonObject
public $partnerships = array();
/**
* @var Adherent To contains a clone of this when we need to save old properties of object
* @var Facture To store the created invoice into subscriptionComplementaryActions()
*/
public $oldcopy;
public $invoice;
/**
* @var int Entity
*/
public $entity;
/**
* @var array fields
@ -499,7 +426,7 @@ class Adherent extends CommonObject
// Envoi mail confirmation
$from = $conf->email_from;
if (!empty(getDolGlobalString('ADHERENT_MAIL_FROM'))) {
if (getDolGlobalString('ADHERENT_MAIL_FROM')) {
$from = getDolGlobalString('ADHERENT_MAIL_FROM');
}
@ -2823,11 +2750,11 @@ class Adherent extends CommonObject
// Member
foreach ($ldapkey as $constname => $varname) {
if (!empty($this->$varname) && !empty($conf->global->$constname)) {
$info[$conf->global->$constname] = $this->$varname;
if (!empty($this->$varname) && getDolGlobalString($constname)) {
$info[getDolGlobalString($constname)] = $this->$varname;
// Check if it is the LDAP key and if its value has been changed
if (!empty($conf->global->LDAP_KEY_MEMBERS) && $conf->global->LDAP_KEY_MEMBERS == $conf->global->$constname) {
if (!empty($conf->global->LDAP_KEY_MEMBERS) && $conf->global->LDAP_KEY_MEMBERS == getDolGlobalString($constname)) {
if (!empty($this->oldcopy) && $this->$varname != $this->oldcopy->$varname) {
$keymodified = true; // For check if LDAP key has been modified
}
@ -2856,8 +2783,8 @@ class Adherent extends CommonObject
$info[$conf->global->LDAP_MEMBER_FIELD_COUNTRY] = $this->country_code;
}
foreach ($socialnetworks as $key => $value) {
if ($this->socialnetworks[$value['label']] && !empty($conf->global->{'LDAP_MEMBER_FIELD_'.strtoupper($value['label'])})) {
$info[$conf->global->{'LDAP_MEMBER_FIELD_'.strtoupper($value['label'])}] = $this->socialnetworks[$value['label']];
if ($this->socialnetworks[$value['label']] && getDolGlobalString('LDAP_MEMBER_FIELD_'.strtoupper($value['label']))) {
$info[getDolGlobalString('LDAP_MEMBER_FIELD_'.strtoupper($value['label']))] = $this->socialnetworks[$value['label']];
}
}
if ($this->phone && !empty($conf->global->LDAP_MEMBER_FIELD_PHONE)) {

View file

@ -199,7 +199,7 @@ class AdherentStats extends Stats
}
$sql .= " WHERE t.entity IN (".getEntity('member_type').")";
$sql .= " AND t.statut = 1";
$sql .= " GROUP BY t.rowid";
$sql .= " GROUP BY t.rowid, t.libelle";
dol_syslog("box_members_by_type::select nb of members per type", LOG_DEBUG);
$result = $this->db->query($sql);
@ -279,7 +279,8 @@ class AdherentStats extends Stats
$sql .= " AND d.datefin > '".$this->db->idate(dol_get_first_day($startYear))."'";
}
$sql .= " AND c.fk_parent = 0";
$sql .= " GROUP BY c.rowid ORDER BY label ASC";
$sql .= " GROUP BY c.rowid, c.label";
$sql .= " ORDER BY label ASC";
dol_syslog("box_members_by_type::select nb of members per type", LOG_DEBUG);
$result = $this->db->query($sql);

View file

@ -143,9 +143,6 @@ $fieldstosearchall = array(
'd.note_public'=>'NotePublic',
'd.note_private'=>'NotePrivate',
);
if ($db->type == 'pgsql') {
unset($fieldstosearchall['d.rowid']);
}
$arrayfields = array(
'd.ref'=>array('label'=>"Ref", 'checked'=>1),

View file

@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/vcard.class.php';
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alphanohtml');
$object = new adherent($db);
$object = new Adherent($db);
// Fetch object
if ($id > 0 || !empty($ref)) {

View file

@ -219,7 +219,7 @@ foreach ($dirmodels as $reldir) {
if ($module->isEnabled()) {
print '<tr class="oddeven"><td>'.$module->name."</td><td>\n";
print $module->info();
print $module->info($langs);
print '</td>';
// Show example of numbering module

View file

@ -164,7 +164,7 @@ foreach ($dirmodels as $reldir) {
print (empty($module->name) ? $name : $module->name);
print "</td><td>\n";
print $module->info();
print $module->info($langs);
print '</td>';

View file

@ -303,7 +303,7 @@ foreach ($dirmodels as $reldir) {
if ($module->isEnabled()) {
print '<tr class="oddeven"><td>'.$module->name."</td><td>\n";
print $module->info();
print $module->info($langs);
print '</td>';
// Show example of numbering model

View file

@ -254,7 +254,7 @@ foreach ($dirmodels as $reldir) {
if ($module->isEnabled()) {
print '<tr class="oddeven"><td>'.$module->nom."</td><td>\n";
print $module->info();
print $module->info($langs);
print '</td>';
// Show example of numbering model

View file

@ -189,7 +189,7 @@ $message .= '</div>';
$message .= ajax_autoselect('webdavpublicurl');
$message .= '<br>';
if (!empty(getDolGlobalString('DAV_ALLOW_PUBLIC_DIR'))) {
if (getDolGlobalString('DAV_ALLOW_PUBLIC_DIR')) {
$urlEntity = (isModEnabled('multicompany') ? '?entity=' . $conf->entity : '');
$url = '<a href="' . $urlwithroot . '/dav/fileserver.php/public/' . $urlEntity . '" target="_blank" rel="noopener noreferrer">' . $urlwithroot . '/dav/fileserver.php/public/' . $urlEntity . '</a>';

View file

@ -224,7 +224,7 @@ if ($action == 'edit') {
foreach ($modules as $module => $delays) {
if (isModEnabled($module)) {
foreach ($delays as $delay) {
$value = (!empty($conf->global->{$delay['code']}) ? $conf->global->{$delay['code']} : 0);
$value = getDolGlobalInt($delay['code']);
print '<tr class="oddeven">';
print '<td width="20px">' . img_object('', $delay['img']) . '</td>';
print '<td>' . $langs->trans('Delays_' . $delay['code']) . '</td><td class="nowraponall right">';
@ -258,7 +258,7 @@ if ($action == 'edit') {
foreach ($modules as $module => $delays) {
if (isModEnabled($module)) {
foreach ($delays as $delay) {
$value = (!empty($conf->global->{$delay['code']}) ? $conf->global->{$delay['code']} : 0);
$value = getDolGlobalInt($delay['code']);
print '<tr class="oddeven">';
print '<td width="20px">' . img_object('', $delay['img']) . '</td>';
print '<td>' . $langs->trans('Delays_' . $delay['code']) . '</td>';

View file

@ -266,7 +266,7 @@ if (!empty($conf->global->MAIN_SUBMODULE_DELIVERY)) {
}
print '<tr class="oddeven"><td>'.$module->name."</td><td>\n";
print $module->info();
print $module->info($langs);
print '</td>';
// Show example of numbering module

View file

@ -8,7 +8,7 @@
* Copyright (C) 2011 Remy Younes <ryounes@gmail.com>
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@ltairis.fr>
* Copyright (C) 2011-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2011-2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2019-2022 Frédéric France <frederic.france@netlogic.fr>
@ -208,7 +208,7 @@ $tabsql[6] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.t
$tabsql[7] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.accountancy_code as accountancy_code, c.code as country_code, c.label as country, a.fk_pays as country_id, a.active FROM ".MAIN_DB_PREFIX."c_chargesociales AS a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_pays = c.rowid and c.active = 1";
$tabsql[8] = "SELECT t.id as rowid, t.code as code, t.libelle, t.fk_country as country_id, c.code as country_code, c.label as country, t.position, t.active FROM ".MAIN_DB_PREFIX."c_typent as t LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON t.fk_country=c.rowid";
$tabsql[9] = "SELECT c.code_iso as code, c.label, c.unicode, c.active FROM ".MAIN_DB_PREFIX."c_currencies AS c";
$tabsql[10] = "SELECT t.rowid, t.code, t.taux, t.localtax1_type, t.localtax1, t.localtax2_type, t.localtax2, c.label as country, c.code as country_code, t.fk_pays as country_id, t.recuperableonly, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays = c.rowid";
$tabsql[10] = "SELECT t.rowid, t.entity, t.code, t.taux, t.localtax1_type, t.localtax1, t.localtax2_type, t.localtax2, c.label as country, c.code as country_code, t.fk_pays as country_id, t.recuperableonly, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays = c.rowid AND t.entity = ".getEntity($tabname[10]);
$tabsql[11] = "SELECT t.rowid as rowid, t.element, t.source, t.code, t.libelle, t.position, t.active FROM ".MAIN_DB_PREFIX."c_type_contact AS t";
$tabsql[12] = "SELECT c.rowid as rowid, c.code, c.libelle, c.libelle_facture, c.deposit_percent, c.nbjour, c.type_cdr, c.decalage, c.active, c.sortorder, c.entity FROM ".MAIN_DB_PREFIX."c_payment_term AS c WHERE c.entity = ".getEntity($tabname[12]);
$tabsql[13] = "SELECT c.id as rowid, c.code, c.libelle, c.type, c.active, c.entity FROM ".MAIN_DB_PREFIX."c_paiement AS c WHERE c.entity = ".getEntity($tabname[13]);
@ -396,7 +396,7 @@ $tabfieldinsert[6] = "code,libelle,type,color,position";
$tabfieldinsert[7] = "code,libelle,fk_pays,accountancy_code";
$tabfieldinsert[8] = "code,libelle,fk_country".(!empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? ',position' : '');
$tabfieldinsert[9] = "code_iso,label,unicode";
$tabfieldinsert[10] = "fk_pays,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note";
$tabfieldinsert[10] = "fk_pays,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note,entity";
$tabfieldinsert[11] = "element,source,code,libelle,position";
$tabfieldinsert[12] = "code,libelle,libelle_facture,deposit_percent,nbjour,type_cdr,decalage,sortorder,entity";
$tabfieldinsert[13] = "code,libelle,type,entity";
@ -1643,6 +1643,8 @@ if ($id > 0) {
print '<div class="div-table-responsive">';
print '<table class="noborder centpercent">';
$colspan = 0;
// Title line with search input fields
print '<!-- line title to search record -->'."\n";
print '<tr class="liste_titre_filter">';
@ -1658,7 +1660,6 @@ if ($id > 0) {
$colspan++;
}
$colspan = 0;
foreach ($fieldlist as $field => $value) {
if ($value == 'entity') {
continue;
@ -2310,7 +2311,7 @@ if ($id > 0) {
// Action button
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="center maxwidthsearch">';
print '<td class="center maxwidthsearch nowraponall">';
// Modify link
if ($canbemodified) {
print '<a class="reposition marginleftonly paddingleft marginrightonly paddingright editfielda" href="'.$url.'action=edit&token='.newToken().'">'.img_edit().'</a>';

View file

@ -41,6 +41,7 @@ class Dolistore
public $per_page; // pagination: display per page
public $categorie; // the current categorie
public $categories; // an array of categories
public $search; // the search keywords
// setups
@ -49,6 +50,8 @@ class Dolistore
public $lang; // the integer representing the lang in the store
public $debug_api; // usefull if no dialog
public $api;
public $products;
/**
* Constructor
@ -57,7 +60,7 @@ class Dolistore
*/
public function __construct($debug = false)
{
global $conf, $langs;
global $langs;
$this->url = DOL_URL_ROOT.'/admin/modules.php?mode=marketplace';
$this->shop_url = 'https://www.dolistore.com/index.php?controller=product&id_product=';

View file

@ -573,7 +573,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
}
}
$morehtml = $form->textwithpicto($langs->trans("NbOfEmailsInInbox"), 'Connect string = '.$connectstringserver.'<br>Option MAIN_IMAP_USE_PHPIMAP = '.getDolGlobalInt('MAIN_IMAP_USE_PHPIMAP')).': '.($morehtml ? $morehtml : '?');
$morehtml = $form->textwithpicto($langs->trans("NbOfEmailsInInbox"), 'Connect string = '.$connectstringserver.'<br>Option MAIN_IMAP_USE_PHPIMAP = '.getDolGlobalInt('MAIN_IMAP_USE_PHPIMAP')).': '.($morehtml !== '' ? $morehtml : '?');
$morehtml .= '<a class="flat paddingleft marginleftonly" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=scan&token='.newToken().'">'.img_picto('', 'refresh', 'class="paddingrightonly"').$langs->trans("Refresh").'</a>';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref.'<div class="refidno">'.$morehtml.'</div>', '', 0, '', '', 0, '');
@ -754,7 +754,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$fk_element = 'position';
$i = 0;
foreach ($object->actions as $ruleaction) {
$ruleactionobj = new EmailcollectorAction($db);
$ruleactionobj = new EmailCollectorAction($db);
$ruleactionobj->fetch($ruleaction['id']);
print '<tr class="drag drop oddeven" id="row-'.$ruleaction['id'].'">';

View file

@ -437,7 +437,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
dol_include_once('/'.$moduledir.'/class/'.strtolower($myTmpObjectKey).'.class.php');
print '<tr class="oddeven"><td>'.$module->name."</td><td>\n";
print $module->info();
print $module->info($langs);
print '</td>';
// Show example of numbering model

View file

@ -212,7 +212,7 @@ foreach ($dirmodels as $reldir) {
print '<tr><td>'.$module->name."</td>\n";
print '<td>';
print $module->info();
print $module->info($langs);
print '</td>';
// Show example of numbering module

View file

@ -232,7 +232,7 @@ foreach ($dirmodels as $reldir) {
if ($module->isEnabled()) {
print '<tr class="oddeven"><td>'.$module->nom."</td><td>\n";
print $module->info();
print $module->info($langs);
print '</td>';
// Show example of numbering model

View file

@ -302,7 +302,7 @@ if ($resql) {
$imageurl = $linkrss.$imageurl;
}
}
if ($imageurl && preg_match('/^http', $imageurl)) {
if ($imageurl && preg_match('/^http/', $imageurl)) {
print '<img height="32" src="'.$imageurl.'">';
} else {
print $langs->trans("None");

View file

@ -342,7 +342,7 @@ foreach ($dirmodels as $reldir) {
echo preg_replace('/\-.*$/', '', preg_replace('/mod_facture_/', '', preg_replace('/\.php$/', '', $file)));
print "</td><td>\n";
print $module->info();
print $module->info($langs);
print '</td>';
@ -635,7 +635,7 @@ if (!empty($conf->global->INVOICE_USE_DEFAULT_DOCUMENT)) { // Hidden conf
foreach ($listtype as $type => $trans) {
$thisTypeConfName = 'FACTURE_ADDON_PDF_'.$type;
$current = !empty($conf->global->{$thisTypeConfName}) ? $conf->global->{$thisTypeConfName}:$conf->global->FACTURE_ADDON_PDF;
$current = getDolGlobalString($thisTypeConfName, getDolGlobalString('FACTURE_ADDON_PDF'));
print '<tr >';
print '<td>'.$trans.'</td>';
print '<td colspan="2" >'.$form->selectarray('invoicetypemodels['.$type.']', ModelePDFFactures::liste_modeles($db), $current, 0, 0, 0).'</td>';

View file

@ -57,6 +57,7 @@ $modules = array(
'MAILING' => 'FCKeditorForMailing',
'MAIL' => 'FCKeditorForMail',
'TICKET' => 'FCKeditorForTicket',
'SPECIALCHAR' => 'SpecialChar activation',
);
// Conditions for the option to be offered
$conditions = array(
@ -69,6 +70,7 @@ $conditions = array(
'MAILING' => isModEnabled('mailing'),
'MAIL' => (isModEnabled('facture') || isModEnabled("propal") || isModEnabled('commande')),
'TICKET' => isModEnabled('ticket'),
'SPECIALCHAR' => 1,
);
// Picto
$picto = array(
@ -81,6 +83,7 @@ $picto = array(
'MAILING' => 'email',
'MAIL' => 'email',
'TICKET' => 'ticket',
'SPECIALCHAR' => 'generic'
);
@ -92,6 +95,7 @@ $picto = array(
foreach ($modules as $const => $desc) {
if ($action == 'enable_'.strtolower($const)) {
dolibarr_set_const($db, "FCKEDITOR_ENABLE_".$const, "1", 'chaine', 0, '', $conf->entity);
// If fckeditor is active in the product/service description, it is activated in the forms
if ($const == 'PRODUCTDESC' && getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE')) {
dolibarr_set_const($db, "FCKEDITOR_ENABLE_DETAILS", "1", 'chaine', 0, '', $conf->entity);
@ -221,6 +225,7 @@ if (empty($conf->use_javascript_ajax)) {
$editor = new DolEditor('formtestfield', isset($conf->global->FCKEDITOR_TEST) ? $conf->global->FCKEDITOR_TEST : 'Test', '', 200, $mode, 'In', true, $uselocalbrowser, 1, 120, 8, $readonly);
$editor->Create();
} else {
// CKEditor inline enabled with the contenteditable="true"
print '<div style="border: 1px solid #888;" contenteditable="true">';
print $conf->global->FCKEDITOR_TEST;
print '</div>';

View file

@ -303,7 +303,7 @@ foreach ($dirmodels as $reldir) {
print '<tr class="oddeven"><td>'.$module->nom."</td><td>\n";
print $module->info();
print $module->info($langs);
print '</td>';
// Show example of numbering model

View file

@ -213,7 +213,7 @@ foreach ($dirmodels as $reldir) {
if ($module->isEnabled()) {
print '<tr class="oddeven"><td>'.$module->nom."</td><td>\n";
print $module->info();
print $module->info($langs);
print '</td>';
// Show example of numbering model

View file

@ -259,7 +259,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
dol_include_once('/'.$moduledir.'/class/'.strtolower($myTmpObjectKey).'.class.php');
print '<tr class="oddeven"><td>'.$module->name."</td><td>\n";
print $module->info();
print $module->info($langs);
print '</td>';
// Show example of numbering model
@ -286,7 +286,8 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
}
print '</td>';
$mytmpinstance = new $myTmpObjectKey($db);
$nameofclass = ucfirst($myTmpObjectKey);
$mytmpinstance = new $nameofclass($db);
$mytmpinstance->initAsSpecimen();
// Info
@ -520,7 +521,7 @@ if ($action == 'edit') {
$arrayofmessagename[$modelmail->id] = $langs->trans(preg_replace('/\(|\)/', '', $modelmail->label)) . $moreonlabel;
}
}
print $form->selectarray($constname, $arrayofmessagename, $conf->global->{$constname}, 'None', 0, 0, '', 0, 0, 0, '', '', 1);
print $form->selectarray($constname, $arrayofmessagename, getDolGlobalString($constname), 'None', 0, 0, '', 0, 0, 0, '', '', 1);
} elseif (preg_match('/category:/', $val['type'])) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
@ -528,13 +529,13 @@ if ($action == 'edit') {
$tmp = explode(':', $val['type']);
print img_picto('', 'category', 'class="pictofixedwidth"');
print $formother->select_categories($tmp[1], $conf->global->{$constname}, $constname, 0, $langs->trans('CustomersProspectsCategoriesShort'));
print $formother->select_categories($tmp[1], getDolGlobalString($constname), $constname, 0, $langs->trans('CustomersProspectsCategoriesShort'));
} elseif (preg_match('/thirdparty_type/', $val['type'])) {
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php';
$formcompany = new FormCompany($db);
print $formcompany->selectProspectCustomerType($conf->global->{$constname}, $constname);
print $formcompany->selectProspectCustomerType(getDolGlobalString($constname), $constname);
} elseif ($val['type'] == 'securekey') {
print '<input required="required" type="text" class="flat" id="' . $constname . '" name="' . $constname . '" value="' . (GETPOST($constname, 'alpha') ? GETPOST($constname, 'alpha') : $conf->global->{$constname}) . '" size="40">';
print '<input required="required" type="text" class="flat" id="' . $constname . '" name="' . $constname . '" value="' . (GETPOST($constname, 'alpha') ? GETPOST($constname, 'alpha') : getDolGlobalString($constname)) . '" size="40">';
if (!empty($conf->use_javascript_ajax)) {
print '&nbsp;' . img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token' . $constname . '" class="linkobject"');
}
@ -548,7 +549,7 @@ if ($action == 'edit') {
$form->select_produits($selected, $constname, '', 0);
}
} else {
print '<input name="' . $constname . '" class="flat ' . (empty($val['css']) ? 'minwidth200' : $val['css']) . '" value="' . $conf->global->{$constname} . '">';
print '<input name="' . $constname . '" class="flat ' . (empty($val['css']) ? 'minwidth200' : $val['css']) . '" value="' . getDolGlobalString($constname) . '">';
}
print '</td></tr>';
}
@ -604,18 +605,18 @@ if ($action == 'edit') {
}
print '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>';
} elseif (preg_match('/thirdparty_type/', $val['type'])) {
if ($conf->global->{$constname}==2) {
if (getDolGlobalString($constname) == 2) {
print $langs->trans("Prospect");
} elseif ($conf->global->{$constname}==3) {
} elseif (getDolGlobalString($constname) == 3) {
print $langs->trans("ProspectCustomer");
} elseif ($conf->global->{$constname}==1) {
} elseif (getDolGlobalString($constname) == 1) {
print $langs->trans("Customer");
} elseif ($conf->global->{$constname}==0) {
} elseif (getDolGlobalString($constname) == 0) {
print $langs->trans("NorProspectNorCustomer");
}
} elseif ($val['type'] == 'product') {
$product = new Product($db);
$resprod = $product->fetch($conf->global->{$constname});
$resprod = $product->fetch(getDolGlobalString($constname));
if ($resprod > 0) {
print $product->ref;
} elseif ($resprod < 0) {

View file

@ -236,7 +236,7 @@ if ($action == 'edit') {
$arrayofmessagename[$modelmail->id] = $langs->trans(preg_replace('/\(|\)/', '', $modelmail->label)) . $moreonlabel;
}
}
print $form->selectarray($constname, $arrayofmessagename, $conf->global->{$constname}, 'None', 0, 0, '', 0, 0, 0, '', '', 1);
print $form->selectarray($constname, $arrayofmessagename, getDolGlobalString($constname), 'None', 0, 0, '', 0, 0, 0, '', '', 1);
} elseif (preg_match('/category:/', $val['type'])) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
@ -244,13 +244,13 @@ if ($action == 'edit') {
$tmp = explode(':', $val['type']);
print img_picto('', 'category', 'class="pictofixedwidth"');
print $formother->select_categories($tmp[1], $conf->global->{$constname}, $constname, 0, $langs->trans('CustomersProspectsCategoriesShort'));
print $formother->select_categories($tmp[1], getDolGlobalString($constname), $constname, 0, $langs->trans('CustomersProspectsCategoriesShort'));
} elseif (preg_match('/thirdparty_type/', $val['type'])) {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
$formcompany = new FormCompany($db);
print $formcompany->selectProspectCustomerType($conf->global->{$constname}, $constname);
print $formcompany->selectProspectCustomerType(getDolGlobalString($constname), $constname);
} else {
print '<input name="'.$constname.'" class="flat '.(empty($val['css']) ? 'minwidth200' : $val['css']).'" value="'.$conf->global->{$constname}.'">';
print '<input name="'.$constname.'" class="flat '.(empty($val['css']) ? 'minwidth200' : $val['css']).'" value="'.getDolGlobalString($constname).'">';
}
print '</td></tr>';
}
@ -293,7 +293,7 @@ if ($action == 'edit') {
print $langs->trans($template->label);
} elseif (preg_match('/category:/', $val['type'])) {
$c = new Categorie($db);
$result = $c->fetch($conf->global->{$constname});
$result = $c->fetch(getDolGlobalInt($constname));
if ($result < 0) {
setEventMessages(null, $c->errors, 'errors');
}
@ -385,7 +385,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
dol_include_once('/'.$moduledir.'/class/'.strtolower($myTmpObjectKey).'.class.php');
print '<tr class="oddeven"><td>'.$module->name."</td><td>\n";
print $module->info();
print $module->info($langs);
print '</td>';
// Show example of numbering model

View file

@ -82,9 +82,6 @@ if ($action == 'setvalue' && $user->admin) {
if (!dolibarr_set_const($db, 'LDAP_CONTACT_FIELD_MOBILE', GETPOST("fieldmobile"), 'chaine', 0, '', $conf->entity)) {
$error++;
}
if (!dolibarr_set_const($db, 'LDAP_CONTACT_FIELD_SKYPE', GETPOST("fieldskype"), 'chaine', 0, '', $conf->entity)) {
$error++;
}
if (!dolibarr_set_const($db, 'LDAP_CONTACT_FIELD_FAX', GETPOST("fieldfax"), 'chaine', 0, '', $conf->entity)) {
$error++;
}
@ -237,13 +234,6 @@ print '</td><td>'.$langs->trans("LDAPFieldMobileExample").'</td>';
print '<td class="right"><input type="radio" name="key" value="LDAP_CONTACT_FIELD_MOBILE"'.($conf->global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS == $conf->global->LDAP_CONTACT_FIELD_MOBILE ? ' checked' : '')."></td>";
print '</tr>';
// Skype
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldSkype").'</td><td>';
print '<input size="25" type="text" name="fieldskype" value="'.$conf->global->LDAP_CONTACT_FIELD_SKYPE.'">';
print '</td><td>'.$langs->trans("LDAPFieldSkypeExample").'</td>';
print '<td class="right"><input type="radio" name="key" value="LDAP_CONTACT_FIELD_SKYPE"'.($conf->global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS == $conf->global->LDAP_CONTACT_FIELD_SKYPE ? ' checked' : '')."></td>";
print '</tr>';
// Fax
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldFax").'</td><td>';
print '<input size="25" type="text" name="fieldfax" value="'.$conf->global->LDAP_CONTACT_FIELD_FAX.'">';

View file

@ -95,9 +95,6 @@ if ($action == 'setvalue' && $user->admin) {
if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_MOBILE', GETPOST("fieldmobile"), 'chaine', 0, '', $conf->entity)) {
$error++;
}
if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_SKYPE', GETPOST("fieldskype"), 'chaine', 0, '', $conf->entity)) {
$error++;
}
if (!dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_FAX', GETPOST("fieldfax"), 'chaine', 0, '', $conf->entity)) {
$error++;
}
@ -314,13 +311,6 @@ print '</td><td>'.$langs->trans("LDAPFieldMobileExample").'</td>';
print '<td class="right">&nbsp;</td>';
print '</tr>';
// Skype
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldSkype").'</td><td>';
print '<input size="25" type="text" name="fieldskype" value="'.$conf->global->LDAP_MEMBER_FIELD_SKYPE.'">';
print '</td><td>'.$langs->trans("LDAPFieldSkypeExample").'</td>';
print '<td class="right">&nbsp;</td>';
print '</tr>';
// Fax
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldFax").'</td><td>';
print '<input size="25" type="text" name="fieldfax" value="'.$conf->global->LDAP_MEMBER_FIELD_FAX.'">';

View file

@ -91,9 +91,6 @@ if ($action == 'setvalue' && $user->admin) {
if (!dolibarr_set_const($db, 'LDAP_FIELD_MOBILE', GETPOST("fieldmobile"), 'chaine', 0, '', $conf->entity)) {
$error++;
}
if (!dolibarr_set_const($db, 'LDAP_FIELD_SKYPE', GETPOST("fieldskype"), 'chaine', 0, '', $conf->entity)) {
$error++;
}
if (!dolibarr_set_const($db, 'LDAP_FIELD_FAX', GETPOST("fieldfax"), 'chaine', 0, '', $conf->entity)) {
$error++;
}
@ -294,13 +291,6 @@ print '</td><td>'.$langs->trans("LDAPFieldMobileExample").'</td>';
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_MOBILE"'.(getDolGlobalString('LDAP_KEY_USERS') == getDolGlobalString('LDAP_FIELD_MOBILE') ? ' checked' : '')."></td>";
print '</tr>';
// Skype
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldSkype").'</td><td>';
print '<input size="25" type="text" name="fieldskype" value="'.getDolGlobalString('LDAP_FIELD_SKYPE').'">';
print '</td><td>'.$langs->trans("LDAPFieldSkypeExample").'</td>';
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_SKYPE"'.(getDolGlobalString('LDAP_KEY_USERS') == getDolGlobalString('LDAP_FIELD_SKYPE') ? ' checked' : '')."></td>";
print '</tr>';
// Fax
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldFax").'</td><td>';
print '<input size="25" type="text" name="fieldfax" value="'.getDolGlobalString('LDAP_FIELD_FAX').'">';

View file

@ -2,6 +2,7 @@
/* Copyright (C) 2007-2022 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009-2018 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -262,6 +263,7 @@ if (empty($mysoc->country_code)) {
$sql = "SELECT taux as vat_rate, t.code as vat_code, t.localtax1 as localtax_rate1, t.localtax2 as localtax_rate2";
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c";
$sql .= " WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code='".$db->escape($mysoc->country_code)."' AND (t.taux <> 0 OR t.localtax1 <> '0' OR t.localtax2 <> '0')";
$sql .= " AND t.entity IN (".getEntity('c_tva').")";
$sql .= " ORDER BY t.taux ASC";
$resql = $db->query($sql);
if ($resql) {

View file

@ -664,7 +664,7 @@ if ($action == 'edit') {
if (empty($conf->global->MAIN_DISABLE_ALL_MAILS)) {
// Force e-mail recipient
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_FORCE_SENDTO").'</td><td>'.getDolGlobalString('MAIN_MAIL_FORCE_SENDTO');
if (!empty(getDolGlobalString('MAIN_MAIL_FORCE_SENDTO'))) {
if (getDolGlobalString('MAIN_MAIL_FORCE_SENDTO')) {
if (!isValidEmail(getDolGlobalString('MAIN_MAIL_FORCE_SENDTO'))) {
print img_warning($langs->trans("ErrorBadEMail"));
} else {

View file

@ -116,14 +116,14 @@ if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) {
// Nom des champs d'edition pour modification d'un enregistrement
$tabfieldvalue = array();
$tabfieldvalue[25] = "label,lang,type_template,fk_user,private,position,topic,joinfiles,defaultfortype,content";
$tabfieldvalue[25] = "label,lang,type_template,fk_user,private,position,topic,email_from,joinfiles,defaultfortype,content";
if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) {
$tabfieldvalue[25] .= ',content_lines';
}
// Nom des champs dans la table pour insertion d'un enregistrement
$tabfieldinsert = array();
$tabfieldinsert[25] = "label,lang,type_template,fk_user,private,position,topic,joinfiles,defaultfortype,content";
$tabfieldinsert[25] = "label,lang,type_template,fk_user,private,position,topic,email_from,joinfiles,defaultfortype,content";
if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) {
$tabfieldinsert[25] .= ',content_lines';
}
@ -168,6 +168,7 @@ $tabhelp[25] = array(
'private'=>$langs->trans("TemplateIsVisibleByOwnerOnly"),
'position'=>$langs->trans("PositionIntoComboList"),
'topic'=>'<span class="small">'.$helpsubstit.'</span>',
'email_from'=>$langs->trans('ForceEmailFrom'),
'joinfiles'=>$langs->trans('AttachMainDocByDefault'),
'defaultfortype'=>$langs->trans("DefaultForTypeDesc"),
'content'=>'<span class="small">'.$helpsubstit.'</span>',
@ -575,7 +576,7 @@ if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu
$morejs = array();
$morecss = array();
$sql = "SELECT rowid as rowid, module, label, type_template, lang, fk_user, private, position, topic, joinfiles, defaultfortype, content_lines, content, enabled, active";
$sql = "SELECT rowid as rowid, module, label, type_template, lang, fk_user, private, position, topic, email_from,joinfiles, defaultfortype, content_lines, content, enabled, active";
$sql .= " FROM ".MAIN_DB_PREFIX."c_email_templates";
$sql .= " WHERE entity IN (".getEntity('email_template').")";
if (!$user->admin) {
@ -805,15 +806,18 @@ if ($action == 'create') {
print '<tr class="impair nodrag nodrop nohover"><td colspan="9" class="nobottom">';
// Show fields for topic, join files and body
$fieldsforcontent = array('topic', 'joinfiles', 'content');
$fieldsforcontent = array('topic', 'email_from', 'joinfiles', 'content');
if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) {
$fieldsforcontent = array('topic', 'joinfiles', 'content', 'content_lines');
$fieldsforcontent = array('topic', 'email_from', 'joinfiles', 'content', 'content_lines');
}
foreach ($fieldsforcontent as $tmpfieldlist) {
// Topic of email
if ($tmpfieldlist == 'topic') {
print '<strong>'.$form->textwithpicto($langs->trans("Topic"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</strong> ';
}
if ($tmpfieldlist == 'email_from') {
print $form->textwithpicto($langs->trans("MailFrom"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist);
}
if ($tmpfieldlist == 'joinfiles') {
print '<strong>'.$form->textwithpicto($langs->trans("FilesAttachedToEmail"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</strong> ';
}
@ -827,6 +831,8 @@ if ($action == 'create') {
// Input field
if ($tmpfieldlist == 'topic') {
print '<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.'" value="'.(!empty($obj->$tmpfieldlist) ? $obj->$tmpfieldlist : '').'">';
} elseif ($tmpfieldlist == 'email_from') {
print '<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.'" value="'.(!empty($obj->$tmpfieldlist) ? $obj->$tmpfieldlist : '').'">';
} elseif ($tmpfieldlist == 'joinfiles') {
print $form->selectyesno($tmpfieldlist, (isset($obj->$tmpfieldlist) ? $obj->$tmpfieldlist : '0'), 1, false, 0, 1);
} else {
@ -1088,7 +1094,7 @@ if ($num) {
print '<tr class="oddeven nohover'.(in_array($tmpfieldlist, array('topic', 'joinfiles')) ? ' nobottom' : '').'" id="tr-'.$tmpfieldlist.'-'.$rowid.'">';
print '<td colspan="10">';
$fieldsforcontent = array('topic', 'joinfiles', 'content');
$fieldsforcontent = array('topic', 'email_from','joinfiles', 'content');
if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) {
$fieldsforcontent[] = 'content_lines';
}
@ -1106,6 +1112,11 @@ if ($num) {
print '<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.'-'.$rowid.'" value="'.(!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '').'">';
print '<br>'."\n";
}
if ($tmpfieldlist == 'email_from') {
print '<strong>'.$form->textwithpicto($langs->trans("MailFrom"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</strong> ';
print '<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.'-'.$rowid.'" value="'.(!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '').'">';
print '<br>'."\n";
}
if ($tmpfieldlist == 'joinfiles') {
print '<strong>'.$form->textwithpicto($langs->trans("FilesAttachedToEmail"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</strong> ';
print $form->selectyesno($tmpfieldlist.'-'.$rowid, (isset($obj->$tmpfieldlist) ? $obj->$tmpfieldlist : '0'), 1, false, 0, 1);

View file

@ -71,65 +71,6 @@ if (GETPOST("menu_handler")) {
* Actions
*/
if ($action == 'update') {
if (!$cancel) {
$leftmenu = ''; $mainmenu = '';
if (GETPOST('menuIdParent', 'alphanohtml') && !is_numeric(GETPOST('menuIdParent', 'alphanohtml'))) {
$tmp = explode('&', GETPOST('menuIdParent', 'alphanohtml'));
foreach ($tmp as $s) {
if (preg_match('/fk_mainmenu=/', $s)) {
$mainmenu = preg_replace('/fk_mainmenu=/', '', $s);
}
if (preg_match('/fk_leftmenu=/', $s)) {
$leftmenu = preg_replace('/fk_leftmenu=/', '', $s);
}
}
}
$menu = new Menubase($db);
$result = $menu->fetch(GETPOST('menuId', 'int'));
if ($result > 0) {
$menu->title = (string) GETPOST('titre', 'alphanohtml');
$menu->leftmenu = (string) GETPOST('leftmenu', 'aZ09');
$menu->url = (string) GETPOST('url', 'alphanohtml');
$menu->langs = (string) GETPOST('langs', 'alphanohtml');
$menu->position = (int) GETPOST('position', 'int');
$menu->enabled = (string) GETPOST('enabled', 'alphanohtml');
$menu->perms = (string) GETPOST('perms', 'alphanohtml');
$menu->target = (string) GETPOST('target', 'alphanohtml');
$menu->user = (string) GETPOST('user', 'alphanohtml');
$menu->mainmenu = (string) GETPOST('propertymainmenu', 'alphanohtml');
if (is_numeric(GETPOST('menuIdParent', 'alphanohtml'))) {
$menu->fk_menu = (int) GETPOST('menuIdParent', 'alphanohtml');
} else {
if (GETPOST('type', 'alphanohtml') == 'top') {
$menu->fk_menu = 0;
} else {
$menu->fk_menu = -1;
}
$menu->fk_mainmenu = $mainmenu;
$menu->fk_leftmenu = $leftmenu;
}
$result = $menu->update($user);
if ($result > 0) {
setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
} else {
setEventMessages($menu->error, $menu->errors, 'errors');
}
} else {
setEventMessages($menu->error, $menu->errors, 'errors');
}
$action = "edit";
header("Location: ".DOL_URL_ROOT."/admin/menus/index.php?menu_handler=".$menu_handler);
exit;
} else {
header("Location: ".DOL_URL_ROOT."/admin/menus/index.php?menu_handler=".$menu_handler);
exit;
}
}
if ($action == 'add') {
if ($cancel) {
header("Location: ".DOL_URL_ROOT."/admin/menus/index.php?menu_handler=".$menu_handler);
@ -138,8 +79,8 @@ if ($action == 'add') {
$leftmenu = '';
$mainmenu = '';
if (GETPOST('menuId', 'alphanohtml', 3) && !is_numeric(GETPOST('menuId', 'alphanohtml', 3))) {
$tmp = explode('&', GETPOST('menuId', 'alphanohtml', 3));
if (GETPOST('menuIdParent', 'alphanohtml') && !is_numeric(GETPOST('menuIdParent', 'alphanohtml'))) {
$tmp = explode('&', GETPOST('menuIdParent', 'alphanohtml'));
foreach ($tmp as $s) {
if (preg_match('/fk_mainmenu=/', $s)) {
$mainmenu = preg_replace('/fk_mainmenu=/', '', $s);
@ -173,12 +114,12 @@ if ($action == 'add') {
$action = 'create';
$error++;
}
if (!$error && GETPOST('menuId', 'alphanohtml', 3) && GETPOST('type') == 'top') {
if (!$error && GETPOST('menuIdParent', 'alphanohtml') && GETPOST('type') == 'top') {
setEventMessages($langs->trans("ErrorTopMenuMustHaveAParentWithId0"), null, 'errors');
$action = 'create';
$error++;
}
if (!$error && !GETPOST('menuId', 'alphanohtml', 3) && GETPOST('type') == 'left') {
if (!$error && !GETPOST('menuIdParent', 'alphanohtml') && GETPOST('type') == 'left') {
setEventMessages($langs->trans("ErrorLeftMenuMustHaveAParentId"), null, 'errors');
$action = 'create';
$error++;
@ -189,6 +130,7 @@ if ($action == 'add') {
$menu->menu_handler = preg_replace('/_menu$/', '', GETPOST('menu_handler', 'aZ09'));
$menu->type = (string) GETPOST('type', 'alphanohtml');
$menu->title = (string) GETPOST('titre', 'alphanohtml');
$menu->prefix = (string) GETPOST('picto', 'restricthtmlallowclass');
$menu->url = (string) GETPOST('url', 'alphanohtml');
$menu->langs = (string) GETPOST('langs', 'alphanohtml');
$menu->position = (int) GETPOST('position', 'int');
@ -197,8 +139,8 @@ if ($action == 'add') {
$menu->target = (string) GETPOST('target', 'alphanohtml');
$menu->user = (string) GETPOST('user', 'alphanohtml');
$menu->mainmenu = (string) GETPOST('propertymainmenu', 'alphanohtml');
if (is_numeric(GETPOST('menuId', 'alphanohtml', 3))) {
$menu->fk_menu = (int) GETPOST('menuId', 'alphanohtml', 3);
if (is_numeric(GETPOST('menuIdParent', 'alphanohtml'))) {
$menu->fk_menu = (int) GETPOST('menuIdParent', 'alphanohtml');
} else {
if (GETPOST('type', 'alphanohtml') == 'top') {
$menu->fk_menu = 0;
@ -220,6 +162,78 @@ if ($action == 'add') {
}
}
if ($action == 'update') {
if (!$cancel) {
$leftmenu = ''; $mainmenu = '';
if (GETPOST('menuIdParent', 'alphanohtml') && !is_numeric(GETPOST('menuIdParent', 'alphanohtml'))) {
$tmp = explode('&', GETPOST('menuIdParent', 'alphanohtml'));
foreach ($tmp as $s) {
if (preg_match('/fk_mainmenu=/', $s)) {
$mainmenu = preg_replace('/fk_mainmenu=/', '', $s);
}
if (preg_match('/fk_leftmenu=/', $s)) {
$leftmenu = preg_replace('/fk_leftmenu=/', '', $s);
}
}
}
$error = 0;
if (!$error && !GETPOST('url')) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("URL")), null, 'errors');
$action = 'create';
$error++;
}
if (!$error) {
$menu = new Menubase($db);
$result = $menu->fetch(GETPOST('menuId', 'int'));
if ($result > 0) {
$menu->title = (string) GETPOST('titre', 'alphanohtml');
$menu->prefix = (string) GETPOST('picto', 'restricthtmlallowclass');
$menu->leftmenu = (string) GETPOST('leftmenu', 'aZ09');
$menu->url = (string) GETPOST('url', 'alphanohtml');
$menu->langs = (string) GETPOST('langs', 'alphanohtml');
$menu->position = (int) GETPOST('position', 'int');
$menu->enabled = (string) GETPOST('enabled', 'alphanohtml');
$menu->perms = (string) GETPOST('perms', 'alphanohtml');
$menu->target = (string) GETPOST('target', 'alphanohtml');
$menu->user = (string) GETPOST('user', 'alphanohtml');
$menu->mainmenu = (string) GETPOST('propertymainmenu', 'alphanohtml');
if (is_numeric(GETPOST('menuIdParent', 'alphanohtml'))) {
$menu->fk_menu = (int) GETPOST('menuIdParent', 'alphanohtml');
} else {
if (GETPOST('type', 'alphanohtml') == 'top') {
$menu->fk_menu = 0;
} else {
$menu->fk_menu = -1;
}
$menu->fk_mainmenu = $mainmenu;
$menu->fk_leftmenu = $leftmenu;
}
$result = $menu->update($user);
if ($result > 0) {
setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
} else {
setEventMessages($menu->error, $menu->errors, 'errors');
}
} else {
setEventMessages($menu->error, $menu->errors, 'errors');
}
$action = "edit";
header("Location: ".DOL_URL_ROOT."/admin/menus/index.php?menu_handler=".$menu_handler);
exit;
} else {
$action = 'edit';
}
} else {
header("Location: ".DOL_URL_ROOT."/admin/menus/index.php?menu_handler=".$menu_handler);
exit;
}
}
/*
@ -239,14 +253,14 @@ if ($action == 'create') {
{
if (jQuery("#topleft").val() == \'top\')
{
jQuery("#menuId").prop("disabled", true);
jQuery("#menuId").val(\'\');
jQuery("#menuIdParent").prop("disabled", true);
jQuery("#menuIdParent").val(\'\');
jQuery("#propertymainmenu").removeAttr("disabled");
jQuery("#propertymainmenu").val(\'\');
}
if (jQuery("#topleft").val() == \'left\')
{
jQuery("#menuId").removeAttr("disabled");
jQuery("#menuIdParent").removeAttr("disabled");
jQuery("#propertymainmenu").prop("disabled", true);
}
}
@ -264,6 +278,7 @@ if ($action == 'create') {
print dol_get_fiche_head();
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="border centpercent">';
// Id
@ -274,7 +289,9 @@ if ($action == 'create') {
$parent_level = '';
if (GETPOST('menuId', 'int')) {
$sql = "SELECT m.rowid, m.mainmenu, m.leftmenu, m.level, m.langs FROM ".MAIN_DB_PREFIX."menu as m WHERE m.rowid = ".GETPOST('menuId', 'int');
$sql = "SELECT m.rowid, m.mainmenu, m.leftmenu, m.level, m.langs";
$sql .= " FROM ".MAIN_DB_PREFIX."menu as m";
$sql .= " WHERE m.rowid = ".((int) GETPOST('menuId', 'int'));
$res = $db->query($sql);
if ($res) {
while ($menu = $db->fetch_array($res)) {
@ -330,9 +347,9 @@ if ($action == 'create') {
// MenuId Parent
print '<tr><td class="fieldrequired">'.$langs->trans('MenuIdParent').'</td>';
if ($parent_rowid) {
print '<td>'.$parent_rowid.'<input type="hidden" name="menuId" value="'.$parent_rowid.'"></td>';
print '<td>'.$parent_rowid.'<input type="hidden" name="menuIdParent" value="'.$parent_rowid.'"></td>';
} else {
print '<td><input type="text" class="minwidth300" id="menuId" name="menuId" value="'.(GETPOSTISSET("menuId") ? GETPOST("menuId", 'int') : '').'"></td>';
print '<td><input type="text" class="minwidth300" id="menuIdParent" name="menuIdParent" value="'.(GETPOSTISSET("menuIdParent") ? GETPOST("menuIdParent", 'alphanohtml') : '').'"></td>';
}
print '<td>'.$langs->trans('DetailMenuIdParent');
print ', '.$langs->trans("Example").': fk_mainmenu=abc&fk_leftmenu=def';
@ -342,17 +359,21 @@ if ($action == 'create') {
print '<tr><td class="fieldrequired">'.$langs->trans('Title').'</td>';
print '<td><input type="text" class="minwidth300" name="titre" value="'.dol_escape_htmltag(GETPOST("titre", 'alphanohtml')).'"></td><td>'.$langs->trans('DetailTitre').'</td></tr>';
// Picto
print '<tr><td class="fieldrequired">'.$langs->trans('Image').'</td>';
print '<td><input type="text" class="minwidth300" name="picto" value="'.dol_escape_htmltag(GETPOST("picto", 'alphanohtmlallowclass')).'"></td><td>'.$langs->trans('Example').': fa-global</td></tr>';
// URL
print '<tr><td class="fieldrequired">'.$langs->trans('URL').'</td>';
print '<td><input type="text" class="minwidth500" name="url" value="'.GETPOST("url", 'alphanohtml').'"></td><td>'.$langs->trans('DetailUrl').'</td></tr>';
print '<td><input type="text" class="minwidth500" name="url" value="'.dol_escape_htmltag(GETPOST("url", 'alphanohtml')).'"></td><td>'.$langs->trans('DetailUrl').'</td></tr>';
// Langs
print '<tr><td>'.$langs->trans('LangFile').'</td>';
print '<td><input type="text" class="minwidth300" name="langs" value="'.$parent_langs.'"></td><td>'.$langs->trans('DetailLangs').'</td></tr>';
print '<td><input type="text" class="minwidth300" name="langs" value="'.dol_escape_htmltag($parent_langs).'"></td><td>'.$langs->trans('DetailLangs').'</td></tr>';
// Position
print '<tr><td>'.$langs->trans('Position').'</td>';
print '<td><input type="text" class="width100" name="position" value="'.dol_escape_htmltag(GETPOSTISSET("position") ? GETPOST("position", 'int') : 100).'"></td><td>'.$langs->trans('DetailPosition').'</td></tr>';
print '<td><input type="text" class="width100" name="position" value="'.((int) (GETPOSTISSET("position") ? GETPOSTINT("position") : 100)).'"></td><td>'.$langs->trans('DetailPosition').'</td></tr>';
// Enabled
print '<tr><td>'.$langs->trans('Enabled').'</td>';
@ -371,6 +392,7 @@ if ($action == 'create') {
print '</td></td><td>'.$langs->trans('DetailTarget').'</td></tr>';
print '</table>';
print '</div>';
print dol_get_fiche_end();
@ -381,13 +403,15 @@ if ($action == 'create') {
print load_fiche_titre($langs->trans("ModifMenu"), '', 'title_setup');
print '<br>';
print '<form action="./edit.php?action=update" method="POST" name="formmenuedit">';
print '<form action="./edit.php" method="POST" name="formmenuedit">';
print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="handler_origine" value="'.$menu_handler.'">';
print '<input type="hidden" name="menuId" value="'.GETPOST('menuId', 'int').'">';
print dol_get_fiche_head();
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="border centpercent">';
$menu = new Menubase($db);
@ -431,7 +455,7 @@ if ($action == 'create') {
}
else
{*/
print '<td><input type="text" class="minwidth300" id="propertymainmenu" name="propertymainmenu" value="'.(GETPOST("propertymainmenu", 'alphanohtml') ?GETPOST("propertymainmenu", 'alphanohtml') : $menu->mainmenu).'"></td>';
print '<td><input type="text" class="minwidth300" id="propertymainmenu" name="propertymainmenu" value="'.(GETPOST("propertymainmenu", 'alphanohtml') ? GETPOST("propertymainmenu", 'alphanohtml') : $menu->mainmenu).'"></td>';
//}
print '<td>';
print $langs->trans("Example").': mytopmenukey';
@ -448,7 +472,7 @@ if ($action == 'create') {
if ($menu->fk_leftmenu) {
$valtouse .= '&fk_leftmenu='.$menu->fk_leftmenu;
}
print '<td><input type="text" name="menuIdParent" value="'.$valtouse.'" class="minwidth300"></td>';
print '<td><input type="text" name="menuIdParent" value="'.dol_escape_htmltag(GETPOSTISSET('menuIdParent') ? GETPOST('menuIdParent') : $valtouse).'" class="minwidth300"></td>';
print '<td>'.$langs->trans('DetailMenuIdParent');
print ', <span class="opacitymedium">'.$langs->trans("Example").': fk_mainmenu=abc&fk_leftmenu=def</span>';
print '</td></tr>';
@ -460,9 +484,13 @@ if ($action == 'create') {
print '<tr><td class="fieldrequired">'.$langs->trans('Title').'</td>';
print '<td><input type="text" class="minwidth300" name="titre" value="'.dol_escape_htmltag($menu->title).'"></td><td>'.$langs->trans('DetailTitre').'</td></tr>';
// Url
// URL
print '<tr><td class="fieldrequired">'.$langs->trans('URL').'</td>';
print '<td><input type="text" class="quatrevingtpercent" name="url" value="'.$menu->url.'"></td><td>'.$langs->trans('DetailUrl').'</td></tr>';
print '<td><input type="text" class="quatrevingtpercent" name="url" value="'.dol_escape_htmltag($menu->url).'"></td><td>'.$langs->trans('DetailUrl').'</td></tr>';
// Picto
print '<tr><td class="fieldrequired">'.$langs->trans('Image').'</td>';
print '<td><input type="text" class="minwidth300" name="picto" value="'.dol_escape_htmltag($menu->prefix).'"></td><td>'.$langs->trans('Example').': fa-global</td></tr>';
// Langs
print '<tr><td>'.$langs->trans('LangFile').'</td>';
@ -470,7 +498,7 @@ if ($action == 'create') {
// Position
print '<tr><td>'.$langs->trans('Position').'</td>';
print '<td><input type="text" class="minwidth100" name="position" value="'.$menu->position.'"></td><td>'.$langs->trans('DetailPosition').'</td></tr>';
print '<td><input type="text" class="minwidth100" name="position" value="'.((int) $menu->position).'"></td><td>'.$langs->trans('DetailPosition').'</td></tr>';
// Enabled
print '<tr><td>'.$langs->trans('Enabled').'</td>';
@ -489,7 +517,8 @@ if ($action == 'create') {
print '</td></tr>';
// Target
print '<tr><td>'.$langs->trans('Target').'</td><td><select class="flat" id="target" name="target">';
print '<tr><td>'.$langs->trans('Target').'</td><td>';
print '<select class="flat" id="target" name="target">';
print '<option value=""'.($menu->target == "" ? ' selected' : '').'>&nbsp;</option>';
print '<option value="_blank"'.($menu->target == "_blank" ? ' selected' : '').'>'.$langs->trans('_blank').'</option>';
print '</select>';
@ -497,6 +526,7 @@ if ($action == 'create') {
print '</td><td>'.$langs->trans('DetailTarget').'</td></tr>';
print '</table>';
print '</div>';
print dol_get_fiche_end();

View file

@ -113,6 +113,14 @@ $urldolibarrmodules = 'https://www.dolistore.com/';
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('adminmodules', 'globaladmin'));
// Execution Time
$max_execution_time_for_deploy = (empty($conf->global->MODULE_UPLOAD_MAX_EXECUTION_TIME) ? 300 : $conf->global->MODULE_UPLOAD_MAX_EXECUTION_TIME); // 5mn if not defined
$max_time = @ini_get("max_execution_time");
if ($max_time && $max_time < $max_execution_time_for_deploy) {
dol_syslog("max_execution_time=".$max_time." is lower than max_execution_time_for_deploy=".$max_execution_time_for_deploy.". We try to increase it dynamically.");
@ini_set("max_execution_time", $max_execution_time_for_deploy); // This work only if safe mode is off. also web servers has timeout of 300
}
/*
* Actions
@ -983,7 +991,7 @@ if ($mode == 'common' || $mode == 'commonkanban') {
}
// Picto + Name of module
print ' <td class="tdoverflowmax300 maxwidth300" title="'.dol_escape_htmltag($objMod->getName()).'">';
print ' <td class="tdoverflowmax200 minwidth200imp" title="'.dol_escape_htmltag($objMod->getName()).'">';
$alttext = '';
//if (is_array($objMod->need_dolibarr_version)) $alttext.=($alttext?' - ':'').'Dolibarr >= '.join('.',$objMod->need_dolibarr_version);
//if (is_array($objMod->phpmin)) $alttext.=($alttext?' - ':'').'PHP >= '.join('.',$objMod->phpmin);
@ -1000,7 +1008,7 @@ if ($mode == 'common' || $mode == 'commonkanban') {
print "</td>\n";
// Desc
print '<td class="valignmiddle tdoverflowmax300">';
print '<td class="valignmiddle tdoverflowmax300 minwidth200imp">';
print nl2br($objMod->getDesc());
print "</td>\n";
@ -1011,7 +1019,7 @@ if ($mode == 'common' || $mode == 'commonkanban') {
print '</td>';
// Version
print '<td class="center nowrap" width="150px" title="'.dol_escape_htmltag(dol_string_nohtmltag($versiontrans)).'">';
print '<td class="center nowrap width150" title="'.dol_escape_htmltag(dol_string_nohtmltag($versiontrans)).'">';
if ($objMod->needUpdate) {
$versionTitle = $langs->trans('ModuleUpdateAvailable').' : '.$objMod->lastVersion;
print '<span class="badge badge-warning classfortooltip" title="'.dol_escape_htmltag($versionTitle).'">'.$versiontrans.'</span>';
@ -1021,7 +1029,7 @@ if ($mode == 'common' || $mode == 'commonkanban') {
print "</td>\n";
// Link enable/disable
print '<td class="center valignmiddle left" width="60px">';
print '<td class="center valignmiddle left nowraponall" width="60px">';
print $codeenabledisable;
print "</td>\n";

View file

@ -71,7 +71,7 @@ if ($action == 'updateMask') {
} elseif ($action == 'specimen') {
$modele = GETPOST('module', 'alpha');
$mo = new MO($db);
$mo = new Mo($db);
$mo->initAsSpecimen();
// Search template files
@ -218,7 +218,7 @@ foreach ($dirmodels as $reldir) {
if ($module->isEnabled()) {
print '<tr class="oddeven"><td>'.$module->name."</td><td>\n";
print $module->info();
print $module->info($langs);
print '</td>';
// Show example of numbering model
@ -244,7 +244,7 @@ foreach ($dirmodels as $reldir) {
}
print '</td>';
$mrp = new MO($db);
$mrp = new Mo($db);
$mrp->initAsSpecimen();
// Info

View file

@ -168,7 +168,7 @@ foreach ($dirmodels as $reldir) {
echo preg_replace('/\-.*$/', '', preg_replace('/mod_payment_/', '', preg_replace('/\.php$/', '', $file)));
print "</td><td>\n";
print $module->info();
print $module->info($langs);
print '</td>';

View file

@ -62,6 +62,18 @@ if ($action == 'update') {
if (GETPOSTISSET('MAIN_GENERATE_PROPOSALS_WITH_PICTURE')) {
dolibarr_set_const($db, "MAIN_GENERATE_PROPOSALS_WITH_PICTURE", GETPOST("MAIN_GENERATE_PROPOSALS_WITH_PICTURE"), 'chaine', 0, '', $conf->entity);
}
if (GETPOSTISSET('MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_UNIT_PRICE')) {
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_UNIT_PRICE", GETPOST("MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_UNIT_PRICE"), 'chaine', 0, '', $conf->entity);
}
if (GETPOSTISSET('MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_TOTAL_COLUMN')) {
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_TOTAL_COLUMN", GETPOST("MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_TOTAL_COLUMN"), 'chaine', 0, '', $conf->entity);
}
if (GETPOSTISSET('MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_UNIT_PRICE')) {
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_UNIT_PRICE", GETPOST("MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_UNIT_PRICE"), 'chaine', 0, '', $conf->entity);
}
if (GETPOSTISSET('MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_TOTAL_COLUMN')) {
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_TOTAL_COLUMN", GETPOST("MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_TOTAL_COLUMN"), 'chaine', 0, '', $conf->entity);
}
if (GETPOSTISSET('MAIN_DOCUMENTS_WITH_PICTURE_WIDTH')) {
dolibarr_set_const($db, "MAIN_DOCUMENTS_WITH_PICTURE_WIDTH", GETPOST("MAIN_DOCUMENTS_WITH_PICTURE_WIDTH", 'int'), 'chaine', 0, '', $conf->entity);
}
@ -149,6 +161,75 @@ if (isModEnabled('propal')) {
}
if (isModEnabled('supplier_proposal')) {
$langs->load("supplier_proposal");
print load_fiche_titre($langs->trans("SupplierProposal"), '', 'supplier_proposal');
print '<div class="div-table-responsive-no-min">';
print '<table summary="more" class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_UNIT_PRICE"), '');
print '</td><td>';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_UNIT_PRICE');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_UNIT_PRICE", $arrval, $conf->global->MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_UNIT_PRICE);
}
print '</td></tr>';
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_TOTAL_COLUMN"), '');
print '</td><td>';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_TOTAL_COLUMN');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_TOTAL_COLUMN", $arrval, $conf->global->MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_TOTAL_COLUMN);
}
print '</td></tr>';
print '</table>';
print '</div>';
}
if (isModEnabled('supplier_order')) {
$langs->load("supplier_order");
print load_fiche_titre($langs->trans("SupplierOrder"), '', 'supplier_proposal');
print '<div class="div-table-responsive-no-min">';
print '<table summary="more" class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_UNIT_PRICE"), '');
print '</td><td>';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_UNIT_PRICE');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_UNIT_PRICE", $arrval, $conf->global->MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_UNIT_PRICE);
}
print '</td></tr>';
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_TOTAL_COLUMN"), '');
print '</td><td>';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_TOTAL_COLUMN');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_TOTAL_COLUMN", $arrval, $conf->global->MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_TOTAL_COLUMN);
}
print '</td></tr>';
print '</table>';
print '</div>';
}
if (isModEnabled('facture')) {
print load_fiche_titre($langs->trans("Invoices"), '', 'bill');

View file

@ -292,7 +292,7 @@ foreach ($dirmodels as $reldir) {
if ($module->isEnabled()) {
print '<tr class="oddeven"><td>'.$module->nom."</td><td>\n";
print $module->info();
print $module->info($langs);
print '</td>';
// Show example of numbering module

View file

@ -218,7 +218,7 @@ foreach ($dirmodels as $reldir) {
print '<tr><td>'.$module->nom."</td>\n";
print '<td>';
print $module->info();
print $module->info($langs);
print '</td>';
// Show example of numbering module

View file

@ -130,7 +130,8 @@ if ($action == 'activate_encryptdbpassconf') {
header("Location: security.php");
exit;
} else {
setEventMessages($langs->trans('InstrucToClearPass', $dolibarr_main_db_pass), null, 'warnings');
//setEventMessages($langs->trans('InstrucToClearPass', $dolibarr_main_db_pass), null, 'warnings');
setEventMessages($langs->trans('InstrucToClearPass', $langs->transnoentitiesnoconv("DatabasePassword")), null, 'warnings');
}
}

View file

@ -185,7 +185,7 @@ if ($action == 'edit') {
// Method
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_SMS_SENDMODE").'</td><td>';
if (count($listofmethods)) {
print $form->selectarray('MAIN_SMS_SENDMODE', $listofmethods, $conf->global->MAIN_SMS_SENDMODE, 1);
print $form->selectarray('MAIN_SMS_SENDMODE', $listofmethods, getDolGlobalString('MAIN_SMS_SENDMODE'), 1);
} else {
print '<span class="error">'.$langs->trans("None").'</span>';
}
@ -224,7 +224,7 @@ if ($action == 'edit') {
// Method
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_SMS_SENDMODE").'</td><td>';
$text = empty(getDolGlobalString('MAIN_SMS_SENDMODE')) ? '' : $listofmethods[getDolGlobalString('MAIN_SMS_SENDMODE')];
$text = getDolGlobalString('MAIN_SMS_SENDMODE') ? $listofmethods[getDolGlobalString('MAIN_SMS_SENDMODE')] : '';
if (empty($text)) {
$text = $langs->trans("Undefined").' '.img_warning();
}
@ -256,19 +256,7 @@ if ($action == 'edit') {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>';
/*if ($conf->global->MAIN_SMS_SENDMODE != 'mail' || ! $linuxlike)
{
if (function_exists('fsockopen') && $port && $server)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=testconnect">'.$langs->trans("DoTestServerAvailability").'</a>';
}
}
else
{
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("FeatureNotAvailableOnLinux").'">'.$langs->trans("DoTestServerAvailability").'</a>';
}*/
if (count($listofmethods) && !empty($conf->global->MAIN_SMS_SENDMODE)) {
if (count($listofmethods) && getDolGlobalString('MAIN_SMS_SENDMODE')) {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=test&amp;mode=init">'.$langs->trans("DoTestSend").'</a>';
} else {
print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans("DoTestSend").'</a>';

View file

@ -227,7 +227,7 @@ print '<span class="opacitymedium">'.$langs->trans("StockTransferSetupPage").'</
$moduledir = 'stocktransfer';
$myTmpObjects = array();
$myTmpObjects[$moduledir]=array('includerefgeneration'=>1, 'includedocgeneration'=>1);
$myTmpObjects[$moduledir]=array('includerefgeneration'=>1, 'includedocgeneration'=>1, 'class'=>'StockTransfer');
foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
if ($myTmpObjectKey == 'MyObject') continue;
@ -272,7 +272,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
dol_include_once('/'.$moduledir.'/class/'.strtolower($myTmpObjectKey).'.class.php');
print '<tr class="oddeven"><td>'.$module->name."</td><td>\n";
print $module->info();
print $module->info($langs);
print '</td>';
// Show example of numbering model
@ -294,7 +294,8 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
}
print '</td>';
$mytmpinstance = new $myTmpObjectKey($db);
$nameofclass = $myTmpObjectArray['class'];
$mytmpinstance = new $nameofclass($db);
$mytmpinstance->initAsSpecimen();
// Info

View file

@ -246,7 +246,7 @@ foreach ($dirmodels as $reldir) {
print '<tr class="oddeven"><td>'.$module->nom."</td><td>\n";
print $module->info();
print $module->info($langs);
print '</td>';
// Show example of numbering module

View file

@ -262,7 +262,7 @@ foreach ($dirmodels as $reldir) {
print '<tr class="oddeven"><td>'.$module->nom."</td><td>\n";
print $module->info();
print $module->info($langs);
print '</td>';
// Show example of numbering module

View file

@ -241,7 +241,7 @@ foreach ($dirmodels as $reldir) {
echo preg_replace('/\-.*$/', '', preg_replace('/mod_supplier_payment_/', '', preg_replace('/\.php$/', '', $file)));
print "</td><td>\n";
print $module->info();
print $module->info($langs);
print '</td>';

View file

@ -271,7 +271,7 @@ foreach ($dirmodels as $reldir) {
if ($module->isEnabled()) {
print '<tr class="oddeven"><td>'.$module->nom."</td><td>\n";
print $module->info();
print $module->info($langs);
print '</td>';
// Show example of numbering module

View file

@ -92,8 +92,8 @@ if (empty($xmlremote) && !empty($conf->global->MAIN_FILECHECK_URL)) {
$xmlremote = $conf->global->MAIN_FILECHECK_URL;
}
$param = 'MAIN_FILECHECK_URL_'.DOL_VERSION;
if (empty($xmlremote) && !empty($conf->global->$param)) {
$xmlremote = $conf->global->$param;
if (empty($xmlremote) && getDolGlobalString($param)) {
$xmlremote = getDolGlobalString($param);
}
if (empty($xmlremote)) {
$xmlremote = 'https://www.dolibarr.org/files/stable/signatures/filelist-'.DOL_VERSION.'.xml';

View file

@ -220,15 +220,27 @@ print '<span class="opacitymedium">'.$langs->trans("ToActivateModule").'</span>'
print '<br>';
print '<br>';
$mode = '';
$arrayofmassactions = array();
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
$selectedfields = ($mode != 'kanban' ? $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')) : ''); // This also change content of $arrayfields
$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
$moreforfilter = '';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
// Lines with input filters
print '<tr class="liste_titre_filter">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre center maxwidthsearch">';
$searchpicto = $form->showFilterButtons();
print $searchpicto;
print '</td>';
}
if ($arrayfields['name']['checked']) {
print '<td class="liste_titre left">';
print '<input class="flat" type="text" name="search_name" size="8" value="'.dol_escape_htmltag($search_name).'">';
@ -253,16 +265,20 @@ if ($arrayfields['module_position']['checked']) {
print '<td class="liste_titre left">';
print '</td>';
}
print '<td class="liste_titre center maxwidthsearch">';
$searchpicto = $form->showFilterButtons();
print $searchpicto;
print '</td>';
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre center maxwidthsearch">';
$searchpicto = $form->showFilterButtons();
print $searchpicto;
print '</td>';
}
print '</tr>';
print '<tr class="liste_titre">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch actioncolumn');
}
if ($arrayfields['name']['checked']) {
print_liste_field_titre($arrayfields['name']['label'], $_SERVER["PHP_SELF"], "name", "", "", "", $sortfield, $sortorder);
}
@ -283,8 +299,10 @@ if ($arrayfields['module_position']['checked']) {
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
}
print '</tr>';
// sort list
@ -318,6 +336,10 @@ if ($sortfield == "name" && $sortorder == "asc") {
foreach ($moduleList as $module) {
print '<tr class="oddeven">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td></td>';
}
if ($arrayfields['name']['checked']) {
print '<td width="300" class="nowrap">';
@ -358,7 +380,10 @@ foreach ($moduleList as $module) {
print '<td class="center">'.$module->module_position.'</td>';
}
print '<td></td>';
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td></td>';
}
print '</tr>';
}

View file

@ -461,7 +461,7 @@ if (!empty($eventstolog) && is_array($eventstolog)) {
foreach ($eventstolog as $key => $arr) {
if ($arr['id']) {
$key = 'MAIN_LOGEVENTS_'.$arr['id'];
$value = empty($conf->global->$key) ? '' : $conf->global->$key;
$value = getDolGlobalString($key);
if ($value) {
if ($i > 0) {
$out .= ', ';

View file

@ -298,7 +298,7 @@ foreach ($dirmodels as $reldir) {
if ($module->isEnabled()) {
print '<tr class="oddeven"><td>'.$module->name."</td><td>\n";
print $module->info();
print $module->info($langs);
print '</td>';
// Show example of numbering model

View file

@ -318,7 +318,7 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
// Check if email exists
print '<tr class="oddeven"><td>'.$langs->trans("TicketsEmailMustExist").'</td>';
print '<td class="left">';
if (empty(getDolGlobalInt('TICKET_EMAIL_MUST_EXISTS'))) {
if (!getDolGlobalInt('TICKET_EMAIL_MUST_EXISTS')) {
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=set_TICKET_EMAIL_MUST_EXISTS&token='.newToken().'">' . img_picto($langs->trans('Disabled'), 'switch_off') . '</a>';
} else {
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=del_TICKET_EMAIL_MUST_EXISTS&token='.newToken().'">' . img_picto($langs->trans('Enabled'), 'switch_on') . '</a>';
@ -334,7 +334,7 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
/*
print '<tr class="oddeven"><td>'.$langs->trans("TicketCreateThirdPartyWithContactIfNotExist").'</td>';
print '<td class="left">';
if (empty(getDolGlobalInt('TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST'))) {
if (!getDolGlobalInt('TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST')) {
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=set_TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST&token='.newToken().'">' . img_picto($langs->trans('Disabled'), 'switch_off') . '</a>';
} else {
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=del_TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST&token='.newToken().'">' . img_picto($langs->trans('Enabled'), 'switch_on') . '</a>';
@ -397,7 +397,7 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
// Show progression
print '<tr class="oddeven"><td>'.$langs->trans("TicketsShowProgression").'</td>';
print '<td class="left">';
if (empty(getDolGlobalInt('TICKET_SHOW_PROGRESSION'))) {
if (!getDolGlobalInt('TICKET_SHOW_PROGRESSION')) {
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=set_TICKET_SHOW_PROGRESSION">' . img_picto($langs->trans('Disabled'), 'switch_off') . '</a>';
} else {
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=del_TICKET_SHOW_PROGRESSION">' . img_picto($langs->trans('Enabled'), 'switch_on') . '</a>';

View file

@ -57,12 +57,13 @@ $offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (!$sortfield) {
$sortfield = "dateevent";
$sortfield = "e.rowid";
}
if (!$sortorder) {
$sortorder = "DESC";
}
$search_rowid = GETPOST("search_rowid", "int");
$search_code = GETPOST("search_code", "alpha");
$search_ip = GETPOST("search_ip", "alpha");
$search_user = GETPOST("search_user", "alpha");
@ -145,6 +146,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$date_endmonth = '';
$date_startyear = '';
$date_endyear = '';
$search_rowid = '';
$search_code = '';
$search_ip = '';
$search_user = '';
@ -214,6 +216,9 @@ if ($date_start !== '') {
if ($date_end !== '' ) {
$sql .= " AND e.dateevent <= '".$db->idate($date_end)."'";
}
if ($search_rowid) {
$usefilter++; $sql .= natural_search("e.rowid", $search_rowid, 1);
}
if ($search_code) {
$usefilter++; $sql .= natural_search("e.type", $search_code, 0);
}
@ -264,6 +269,9 @@ if ($result) {
if ($optioncss != '') {
$param .= '&optioncss='.urlencode($optioncss);
}
if ($search_rowid) {
$param .= '&search_rowid='.urlencode($search_rowid);
}
if ($search_code) {
$param .= '&search_code='.urlencode($search_code);
}
@ -344,25 +352,31 @@ if ($result) {
print '</td>';
}
// ID
print '<td class="liste_titre">';
print '<input class="flat maxwidth50" type="text" name="search_rowid" value="'.dol_escape_htmltag($search_rowid).'">';
print '</td>';
// Date
print '<td class="liste_titre" width="15%">';
print $form->selectDate($date_start === '' ? -1 : $date_start, 'date_start', 0, 0, 0, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzuserrel');
print $form->selectDate($date_end === '' ? -1 : $date_end, 'date_end', 0, 0, 0, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzuserrel');
print '</td>';
print '<td class="liste_titre left">';
print '<input class="flat maxwidth100" type="text" name="search_code" value="'.dol_escape_htmltag($search_code).'">';
print '<td class="liste_titre">';
print '<input class="flat maxwidth75" type="text" name="search_code" value="'.dol_escape_htmltag($search_code).'">';
print '</td>';
// IP
print '<td class="liste_titre left">';
print '<input class="flat maxwidth100" type="text" name="search_ip" value="'.dol_escape_htmltag($search_ip).'">';
print '<td class="liste_titre">';
print '<input class="flat maxwidth75" type="text" name="search_ip" value="'.dol_escape_htmltag($search_ip).'">';
print '</td>';
print '<td class="liste_titre left">';
print '<td class="liste_titre">';
print '<input class="flat maxwidth100" type="text" name="search_user" value="'.dol_escape_htmltag($search_user).'">';
print '</td>';
print '<td class="liste_titre left">';
print '<td class="liste_titre">';
//print '<input class="flat maxwidth100" type="text" size="10" name="search_desc" value="'.$search_desc.'">';
print '</td>';
@ -394,6 +408,7 @@ if ($result) {
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre('');
}
print_liste_field_titre("ID", $_SERVER["PHP_SELF"], "e.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "e.dateevent", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Code", $_SERVER["PHP_SELF"], "e.type", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("IP", $_SERVER["PHP_SELF"], "e.ip", "", $param, '', $sortfield, $sortorder);
@ -425,6 +440,9 @@ if ($result) {
print '</td>';
}
// ID
print '<td class="nowrap left">'.dol_escape_htmltag($obj->rowid).'</td>';
// Date
print '<td class="nowrap left">'.dol_print_date($db->jdate($obj->dateevent), '%Y-%m-%d %H:%M:%S', 'tzuserrel').'</td>';
@ -437,7 +455,7 @@ if ($result) {
print '</td>';
// Login
print '<td class="tdoverflowmax150">';
print '<td class="tdoverflowmax125">';
if ($obj->fk_user > 0) {
$userstatic->id = $obj->fk_user;
$userstatic->login = $obj->login;
@ -457,7 +475,6 @@ if ($result) {
print '</td>';
// Description
print '<td>';
$text = $langs->trans($obj->description);
$reg = array();
if (preg_match('/\((.*)\)(.*)/i', $obj->description, $reg)) {
@ -467,19 +484,20 @@ if ($result) {
$text .= $reg[2];
}
}
print '<td class="tdoverflowmax400" title="'.dol_escape_htmltag($text).'">';
print dol_escape_htmltag($text);
print '</td>';
if (!empty($arrayfields['e.user_agent']['checked'])) {
// User agent
print '<td>';
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->user_agent).'">';
print dol_escape_htmltag($obj->user_agent);
print '</td>';
}
if (!empty($arrayfields['e.prefix_session']['checked'])) {
// User agent
print '<td>';
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->prefix_session).'">';
print dol_escape_htmltag($obj->prefix_session);
print '</td>';
}
@ -498,10 +516,11 @@ if ($result) {
}
if ($num == 0) {
$colspan = 8;
if ($usefilter) {
print '<tr><td colspan="7"><span class="opacitymedium">'.$langs->trans("NoEventFoundWithCriteria").'</span></td></tr>';
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoEventFoundWithCriteria").'</span></td></tr>';
} else {
print '<tr><td colspan="7"><span class="opacitymedium">'.$langs->trans("NoEventOrNoAuditSetup").'</span></td></tr>';
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoEventOrNoAuditSetup").'</span></td></tr>';
}
}
print "</table>";

View file

@ -249,7 +249,7 @@ if ($action == 'edit') {
$arrayofmessagename[$modelmail->id] = $langs->trans(preg_replace('/\(|\)/', '', $modelmail->label)) . $moreonlabel;
}
}
print $form->selectarray($constname, $arrayofmessagename, $conf->global->{$constname}, 'None', 0, 0, '', 0, 0, 0, '', '', 1);
print $form->selectarray($constname, $arrayofmessagename, getDolGlobalString($constname), 'None', 0, 0, '', 0, 0, 0, '', '', 1);
} elseif (preg_match('/category:/', $val['type'])) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
@ -257,13 +257,13 @@ if ($action == 'edit') {
$tmp = explode(':', $val['type']);
print img_picto('', 'category', 'class="pictofixedwidth"');
print $formother->select_categories($tmp[1], $conf->global->{$constname}, $constname, 0, $langs->trans('CustomersProspectsCategoriesShort'));
print $formother->select_categories($tmp[1], getDolGlobalString($constname), $constname, 0, $langs->trans('CustomersProspectsCategoriesShort'));
} elseif (preg_match('/thirdparty_type/', $val['type'])) {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
$formcompany = new FormCompany($db);
print $formcompany->selectProspectCustomerType($conf->global->{$constname}, $constname);
print $formcompany->selectProspectCustomerType(getDolGlobalString($constname), $constname);
} elseif ($val['type'] == 'securekey') {
print '<input required="required" type="text" class="flat" id="'.$constname.'" name="'.$constname.'" value="'.(GETPOST($constname, 'alpha') ?GETPOST($constname, 'alpha') : $conf->global->{$constname}).'" size="40">';
print '<input required="required" type="text" class="flat" id="'.$constname.'" name="'.$constname.'" value="'.(GETPOST($constname, 'alpha') ? GETPOST($constname, 'alpha') : getDolGlobalString($constname)).'" size="40">';
if (!empty($conf->use_javascript_ajax)) {
print '&nbsp;'.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token'.$constname.'" class="linkobject"');
}
@ -277,7 +277,7 @@ if ($action == 'edit') {
$form->select_produits($selected, $constname, '', 0);
}
} else {
print '<input name="'.$constname.'" class="flat '.(empty($val['css']) ? 'minwidth200' : $val['css']).'" value="'.$conf->global->{$constname}.'">';
print '<input name="'.$constname.'" class="flat '.(empty($val['css']) ? 'minwidth200' : $val['css']).'" value="'.getDolGlobalString($constname).'">';
}
print '</td></tr>';
}
@ -432,7 +432,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
dol_include_once('/'.$moduledir.'/class/'.strtolower($myTmpObjectKey).'.class.php');
print '<tr class="oddeven"><td>'.$module->name."</td><td>\n";
print $module->info();
print $module->info($langs);
print '</td>';
// Show example of numbering model

View file

@ -272,7 +272,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
dol_include_once('/'.$moduledir.'/class/'.strtolower($myTmpObjectKey).'.class.php');
print '<tr class="oddeven"><td>'.$module->name."</td><td>\n";
print $module->info();
print $module->info($langs);
print '</td>';
// Show example of numbering model
@ -299,7 +299,8 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
}
print '</td>';
$mytmpinstance = new $myTmpObjectKey($db);
$nameofclass = ucfirst($myTmpObjectKey);
$mytmpinstance = new $nameofclass($db);
$mytmpinstance->initAsSpecimen();
// Info

View file

@ -29,7 +29,6 @@ require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
*/
class DolibarrApi
{
/**
* @var DoliDb $db Database object
*/

View file

@ -44,6 +44,11 @@ class DolibarrApiAccess implements iAuthenticate
{
const REALM = 'Restricted Dolibarr API';
/**
* @var DoliDB Database handler
*/
public $db;
/**
* @var array $requires role required by API method user / external / admin
*/

View file

@ -32,7 +32,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
*/
class Documents extends DolibarrApi
{
/**
* @var array $DOCUMENT_FIELDS Mandatory fields, checked when create and update object
*/
@ -68,7 +67,7 @@ class Documents extends DolibarrApi
*/
public function index($modulepart, $original_file = '')
{
global $conf, $langs;
global $conf;
if (empty($modulepart)) {
throw new RestException(400, 'bad value for parameter modulepart');
@ -189,66 +188,66 @@ class Documents extends DolibarrApi
if ($modulepart == 'facture' || $modulepart == 'invoice') {
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$this->invoice = new Facture($this->db);
$result = $this->invoice->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file)));
$tmpobject = new Facture($this->db);
$result = $tmpobject->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file)));
if (!$result) {
throw new RestException(404, 'Invoice not found');
}
$templateused = $doctemplate ? $doctemplate : $this->invoice->model_pdf;
$result = $this->invoice->generateDocument($templateused, $outputlangs, $hidedetails, $hidedesc, $hideref);
$templateused = $doctemplate ? $doctemplate : $tmpobject->model_pdf;
$result = $tmpobject->generateDocument($templateused, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result <= 0) {
throw new RestException(500, 'Error generating document');
}
} elseif ($modulepart == 'facture_fournisseur' || $modulepart == 'invoice_supplier') {
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
$this->supplier_invoice = new FactureFournisseur($this->db);
$result = $this->supplier_invoice->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file)));
$tmpobject = new FactureFournisseur($this->db);
$result = $tmpobject->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file)));
if (!$result) {
throw new RestException(404, 'Supplier invoice not found');
}
$templateused = $doctemplate ? $doctemplate : $this->supplier_invoice->model_pdf;
$result = $this->supplier_invoice->generateDocument($templateused, $outputlangs, $hidedetails, $hidedesc, $hideref);
$templateused = $doctemplate ? $doctemplate : $tmpobject->model_pdf;
$result = $tmpobject->generateDocument($templateused, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result < 0) {
throw new RestException(500, 'Error generating document');
}
} elseif ($modulepart == 'commande' || $modulepart == 'order') {
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
$this->order = new Commande($this->db);
$result = $this->order->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file)));
$tmpobject = new Commande($this->db);
$result = $tmpobject->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file)));
if (!$result) {
throw new RestException(404, 'Order not found');
}
$templateused = $doctemplate ? $doctemplate : $this->order->model_pdf;
$result = $this->order->generateDocument($templateused, $outputlangs, $hidedetails, $hidedesc, $hideref);
$templateused = $doctemplate ? $doctemplate : $tmpobject->model_pdf;
$result = $tmpobject->generateDocument($templateused, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result <= 0) {
throw new RestException(500, 'Error generating document');
}
} elseif ($modulepart == 'propal' || $modulepart == 'proposal') {
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
$this->propal = new Propal($this->db);
$result = $this->propal->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file)));
$tmpobject = new Propal($this->db);
$result = $tmpobject->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file)));
if (!$result) {
throw new RestException(404, 'Proposal not found');
}
$templateused = $doctemplate ? $doctemplate : $this->propal->model_pdf;
$result = $this->propal->generateDocument($templateused, $outputlangs, $hidedetails, $hidedesc, $hideref);
$templateused = $doctemplate ? $doctemplate : $tmpobject->model_pdf;
$result = $tmpobject->generateDocument($templateused, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result <= 0) {
throw new RestException(500, 'Error generating document');
}
} elseif ($modulepart == 'contrat' || $modulepart == 'contract') {
require_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php';
$this->contract = new Contrat($this->db);
$result = $this->contract->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file)));
$tmpobject = new Contrat($this->db);
$result = $tmpobject->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file)));
if (!$result) {
throw new RestException(404, 'Contract not found');
}
$templateused = $doctemplate ? $doctemplate : $this->contract->model_pdf;
$result = $this->contract->generateDocument($templateused, $outputlangs, $hidedetails, $hidedesc, $hideref);
$templateused = $doctemplate ? $doctemplate : $tmpobject->model_pdf;
$result = $tmpobject->generateDocument($templateused, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result <= 0) {
throw new RestException(500, 'Error generating document missing doctemplate parameter');
@ -632,7 +631,7 @@ class Documents extends DolibarrApi
*/
public function post($filename, $modulepart, $ref = '', $subdir = '', $filecontent = '', $fileencoding = '', $overwriteifexists = 0, $createdirifnotexists = 1)
{
global $db, $conf;
global $conf;
//var_dump($modulepart);
//var_dump($filename);

View file

@ -26,6 +26,10 @@ require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
*/
class Login
{
/**
* @var DoliDB Database handler
*/
public $db;
/**
* Constructor of the class
@ -163,6 +167,9 @@ class Login
}
} else {
$token = $tmpuser->api_key;
if (!utf8_check($token)) {
throw new RestException(500, 'Error, the API token of this user has a non valid value. Try to update it with a valid value.');
}
}
//return token

View file

@ -24,8 +24,17 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
* @access protected
* @class DolibarrApiAccess {@requires user,external}
*/
class Status
class Status extends DolibarrApi
{
/**
* Constructor of the class
*/
public function __construct()
{
global $db;
$this->db = $db;
}
/**
* Get status (Dolibarr version)
*

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