merge from develop

This commit is contained in:
Florian HENRY 2020-11-19 13:53:34 +01:00
commit 46326d7659
2195 changed files with 126810 additions and 117262 deletions

View File

@ -13,5 +13,5 @@ jobs:
- name: Exakat - name: Exakat
uses: docker://exakat/exakat-ga uses: docker://exakat/exakat-ga
with: with:
ignore_rules: 'Classes/UseInstanceof,Performances/PrePostIncrement,Functions/WrongNumberOfArguments,Variables/UndefinedVariable,Classes/DontUnsetProperties,Classes/NonPpp,Classes/StaticMethodsCalledFromObject,Classes/UseClassOperator,Functions/UsesDefaultArguments,Php/NoClassInGlobal,Php/ShouldUseCoalesce,Structures/MergeIfThen,Structures/ElseIfElseif,Structures/RepeatedPrint,Structures/UselessParenthesis,Structures/SwitchWithoutDefault,Structures/ShouldMakeTernary,Structures/UseConstant' 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/MergeIfThen,Structures/ElseIfElseif,Structures/RepeatedPrint,Structures/SameConditions,Structures/SwitchWithoutDefault,Structures/ShouldMakeTernary,Structures/UselessParenthesis,Structures/UseConstant'
ignore_dirs: '/htdocs/includes,/htdocs/build,/htdocs/dev,/htdocs/doc,/htdocs/scripts,/htdocs/test' ignore_dirs: '/htdocs/includes,/build,/dev,/doc,/scripts,/test'

View File

@ -17,8 +17,10 @@ filter:
- build/* - build/*
- dev/* - dev/*
- doc/* - doc/*
- test/* - documents/*
- htdocs/includes/* - htdocs/includes/*
- node_modules/*
- test/*
paths: paths:
- htdocs/* - htdocs/*
- scripts/* - scripts/*

View File

@ -35,10 +35,6 @@ addons:
php: php:
- '5.6' - '5.6'
- '7.0'
- '7.1'
- '7.2'
- '7.3'
- '7.4' - '7.4'
- nightly - nightly
@ -112,24 +108,36 @@ install:
echo "Updating Composer" echo "Updating Composer"
rm $TRAVIS_BUILD_DIR/composer.json rm $TRAVIS_BUILD_DIR/composer.json
rm $TRAVIS_BUILD_DIR/composer.lock rm $TRAVIS_BUILD_DIR/composer.lock
composer -V
composer self-update composer self-update
# To have composer making parallel downloads
composer global require hirak/prestissimo
composer -n init composer -n init
composer -n config vendor-dir htdocs/includes composer -n config vendor-dir htdocs/includes
composer -n config -g vendor-dir htdocs/includes
echo echo
- | - |
echo "Installing Composer dependencies - PHP Unit, Parallel Lint, PHP CodeSniffer - for $TRAVIS_PHP_VERSION" echo "Installing Composer dependencies - PHP Unit, Parallel Lint, PHP CodeSniffer - for $TRAVIS_PHP_VERSION"
if [ "$TRAVIS_PHP_VERSION" = '5.6' ] || [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] \ if [ "$TRAVIS_PHP_VERSION" = '5.6' ]; then
[ "$TRAVIS_PHP_VERSION" = '7.2' ] || [ "$TRAVIS_PHP_VERSION" = '7.3' ] || [ "$TRAVIS_PHP_VERSION" = '7.4' ]; then
composer -n require phpunit/phpunit ^5 \ composer -n require phpunit/phpunit ^5 \
php-parallel-lint/php-parallel-lint ^1 \ php-parallel-lint/php-parallel-lint ^1 \
php-parallel-lint/php-console-highlighter ^0 \ php-parallel-lint/php-console-highlighter ^0 \
squizlabs/php_codesniffer ^3 squizlabs/php_codesniffer ^3
fi fi
if [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = '7.2' ]; then
composer -n require phpunit/phpunit ^6 \
php-parallel-lint/php-parallel-lint ^1 \
php-parallel-lint/php-console-highlighter ^0 \
squizlabs/php_codesniffer ^3
fi
if [ "$TRAVIS_PHP_VERSION" = '7.3' ] || [ "$TRAVIS_PHP_VERSION" = '7.4' ]; then
composer -n require phpunit/phpunit ^7 \
php-parallel-lint/php-parallel-lint ^1.2 \
php-parallel-lint/php-console-highlighter ^0 \
squizlabs/php_codesniffer ^3
fi
# phpunit 9 is required for php 8
if [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then if [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then
composer -n require --ignore-platform-reqs phpunit/phpunit ^5 \ composer -n require --ignore-platform-reqs phpunit/phpunit ^7 \
php-parallel-lint/php-parallel-lint ^1.2 \ php-parallel-lint/php-parallel-lint ^1.2 \
php-parallel-lint/php-console-highlighter ^0 \ php-parallel-lint/php-console-highlighter ^0 \
squizlabs/php_codesniffer ^3 squizlabs/php_codesniffer ^3
@ -138,7 +146,10 @@ install:
- | - |
echo "Adding path of binaries tools installed by composer to the PATH" echo "Adding path of binaries tools installed by composer to the PATH"
export PATH="$TRAVIS_BUILD_DIR/htdocs/includes/bin:$PATH" export PATH="$TRAVIS_BUILD_DIR/htdocs/includes/bin:$TRAVIS_BUILD_DIR/vendor/bin:$TRAVIS_BUILD_DIR/htdocs/includes:$PATH"
echo $PATH
ls $TRAVIS_BUILD_DIR/vendor
ls $TRAVIS_BUILD_DIR/htdocs/includes/bin
echo echo
@ -165,15 +176,20 @@ before_script:
- | - |
echo "Versions information" echo "Versions information"
echo
# Check PHP # Check PHP
echo "PHP version" echo "PHP version"
php -i | head - php -i | head -
# Check PHP CodeSniffer installation # Check Parallel-lint version
echo "Parallel-lint version"
which parallel-lint
parallel-lint -V
# Check PHP CodeSniffer version
echo "PHPCS version" echo "PHPCS version"
which phpcs which phpcs
phpcs --version | head - phpcs --version | head -
phpcs -i | head - phpcs -i | head -
# Check PHPUnit installation # Check PHPUnit version
echo "PHPUnit version" echo "PHPUnit version"
which phpunit which phpunit
phpunit --version | head - phpunit --version | head -
@ -287,12 +303,13 @@ script:
echo echo
- | - |
echo "Checking coding style (excluding Pull Requests builds)" echo "Checking coding style (excluding Pull Requests builds to not overload travis, excluding also some jobs to avoid duplicate tests)"
# Ensure we catch errors # Ensure we catch errors
set -e set -e
# Exclusions are defined in the ruleset.xml file # Exclusions are defined in the ruleset.xml file
#phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true . if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_PHP_VERSION" = "7.4" ] && [ "$DB" = "mysql" ]; then
if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .; fi phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .;
fi
set +e set +e
echo echo
@ -409,7 +426,7 @@ script:
php step5.php 12.0.0 13.0.0 > $TRAVIS_BUILD_DIR/upgrade12001300-3.log php step5.php 12.0.0 13.0.0 > $TRAVIS_BUILD_DIR/upgrade12001300-3.log
# Enable modules not enabled into original dump # Enable modules not enabled into original dump
php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_API,MAIN_MODULE_SUPPLIERPROPOSAL,MAIN_MODULE_WEBSITE,MAIN_MODULE_TICKETSUP,MAIN_MODULE_ACCOUNTING > $TRAVIS_BUILD_DIR/enablemodule.log php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_API,MAIN_MODULE_SUPPLIERPROPOSAL,MAIN_MODULE_WEBSITE,MAIN_MODULE_TICKET,MAIN_MODULE_ACCOUNTING,MAIN_MODULE_MRP > $TRAVIS_BUILD_DIR/enablemodule.log
echo $? echo $?
cd - cd -
set +e set +e

View File

@ -21,6 +21,7 @@ Mobiledetect 2.8.34 MIT License Yes
NuSoap 0.9.5 LGPL 2.1+ Yes Library to develop SOAP Web services (not into rpm and deb package) NuSoap 0.9.5 LGPL 2.1+ Yes Library to develop SOAP Web services (not into rpm and deb package)
PEAR Mail_MIME 1.8.9 BSD Yes NuSoap dependency PEAR Mail_MIME 1.8.9 BSD Yes NuSoap dependency
ParseDown 1.6 MIT License Yes Markdown parser ParseDown 1.6 MIT License Yes Markdown parser
PCLZip 2.8.4 LGPL-3+ Yes Library to zip/unzip files
PHPDebugBar 1.15.1 MIT License Yes Used only by the module "debugbar" for developers PHPDebugBar 1.15.1 MIT License Yes Used only by the module "debugbar" for developers
PHPExcel 1.8.1 LGPL-2.1+ Yes Read/Write XLS files, read ODS files PHPExcel 1.8.1 LGPL-2.1+ Yes Read/Write XLS files, read ODS files
PHPSpreadSheet ? LGPL-2.1+ Yes Read/Write XLS files, read ODS files PHPSpreadSheet ? LGPL-2.1+ Yes Read/Write XLS files, read ODS files

267
ChangeLog
View File

@ -4,152 +4,155 @@ English Dolibarr ChangeLog
***** ChangeLog for 13.0.0 compared to 12.0.0 ***** ***** ChangeLog for 13.0.0 compared to 12.0.0 *****
For users: For users:
----------
NEW: Add module "Credit transfer SEPA" to manage payment of vendors using bank credit transfer SEPA files. NEW: Add module "Credit transfer SEPA" to manage payment of vendors using bank credit transfer SEPA files.
NEW: Module Reception (for a more accurate management of your receptions) moved from experimental to stable. NEW: Module Reception (for a more accurate management of your receptions) moved from experimental to stable.
NEW: Several security issues after a private bug bounty campaign. NEW: Several security issues after a private bug bounty campaign.
NEW: #15065 Fix formatting
NEW: #15065 Put the product label in bold in the PDF templates if configured NEW: #15065 Put the product label in bold in the PDF templates if configured
NEW: Accountancy - Add chart of sub accounts NEW: Accountancy - add chart of sub accounts
NEW: Accountancy - Add options to disable binding on sales, purchases & expense reports independently of the modules NEW: Accountancy - add options to disable binding on sales, purchases & expense reports independently of the modules
NEW: Accountancy balance - Add a input to show subtotal by group NEW: Accountancy balance - add a menu entry to show subtotal by group
NEW: Accountancy - Move to real ledger, real journals, menu disposition NEW: Accountancy - move to real ledger, real journals, menu disposition
NEW: Accountancy - On transfers, select the periodicity by default NEW: Accountancy - on transfers, select the periodicity by default
NEW: Add 2 rules for emailcollector: Message send/not sent from Dolibarr NEW: new currency rate editor
NEW: Add a counter of number of words of pages in website module NEW: add 2 rules for emailcollector: Message send/not sent from Dolibarr
NEW: add alert before change thirdparty in takepos NEW: add a counter of number of words for pages in website module
NEW: Add a page to list Stock at a given date. NEW: add alert before changing thirdparty in TakePOS
NEW: Add a start date to begin binding in accountancy NEW: add a page to list Stock at a given date in the past
NEW: Add a stat page to list popularity of products on invoices NEW: add a start date to begin binding in accountancy
NEW: Add calendar selection for agenda view NEW: add a statistics page to list popularity of products on invoices
NEW: add class for ticket edition (pdf or odt) NEW: add calendar selection for agenda view
NEW: Add column payment term into list of supplier invoices. NEW: Support documents generation for ticket edition (PDF or ODT)
NEW: Add column quantity in product margin page NEW: add column payment term into list of supplier invoices
NEW: Add column vat rate in page to define accounting account on product/service NEW: add column quantity in product margin page
NEW: Add common list function for available app/module page NEW: add column vat rate in page to define accounting account on product/service
NEW: add common list function for available app/module page
NEW: add costprice in fields of products list NEW: add costprice in fields of products list
NEW: ADDED IMPORT TOOL FOR CUSTOMER ORDER, PO, PROPOSAL MODULE, SUPPLIER INVOICE NEW: added an import profile for CUSTOMER ORDER, PO, PROPOSAL MODULE, SUPPLIER INVOICE
NEW: Added incoterms to substitution array NEW: added incoterms data into the substitution array
NEW: Add employee in expense report binding page NEW: add employee link in expense report binding page
NEW: Add export for various payment NEW: add export for various payment
NEW: add extra fields labels and values in mail on create ticket NEW: add Extrafields labels and values in mail on create ticket
NEW: Add extrafields support on ECM module NEW: add Extrafields support on ECM module
NEW: Add filter rules "is answer" and "is not answer" in email collector NEW: add filter rules "is answer" and "is not answer" in email collector
NEW: Add focus when editing on product/stock/product.php Close #14548 NEW: add focus when editing on product/stock/product.php Close #14548
NEW: add formConfirm hook on product page NEW: add formConfirm hook on product page
NEW: add free text on each terminal of cash desk NEW: add free text on each terminal of cash desk
NEW: Add function dolButtonToOpenUrlInDialogPopup() to be able to open NEW: add function dolButtonToOpenUrlInDialogPopup() to be able to open
NEW: Add global search for customer payments and vendor payments NEW: add global search for customer payments and vendor payments
NEW: Add global search for miscellaneous payments NEW: add global search for miscellaneous payments
NEW: Add helper function for table headers with numbers NEW: add helper function for table headers with numbers
NEW: add hooks on stats pages NEW: add hooks on stats pages
NEW: Add link to edit property from search result of website pages NEW: add link to edit property from search result of website pages
NEW: Add link to reset qty on supplier dispatch page NEW: add link to reset qty on supplier dispatch page
NEW: add MAIN_EMAILCOLLECTOR_MAIL_WITHOUT_HEADER const to remove header in email collector NEW: add MAIN_EMAILCOLLECTOR_MAIL_WITHOUT_HEADER const to remove header stored by email collector
NEW: Add Manufacturing Orders into the automatic ECM NEW: add Manufacturing Orders attached files into the automatic ECM view
NEW: add margin info in invoice list NEW: add margin info in invoice list
NEW: Add mass action to set category on a list of website pages. NEW: add mass action to set category on a list of website pages
NEW: Add mass deletion for events NEW: add mass deletion for events
NEW: Add __MEMBER_TYPE__ substitution key NEW: add mass deletion for draft invoices
NEW: Add message in error_log after detection of SQL or script injection NEW: add __MEMBER_TYPE__ substitution key
NEW: Add module Credit transfer SEPA to manage payment of supplier using NEW: add a message in error_log after detection of SQL or script injection
NEW: Add more filters on monthly statement list NEW: add module Credit transfer SEPA to manage payment of supplier using
NEW: Add option TAKEPOS_CAN_FORCE_BANK_ACCOUNT_DURING_PAYMENT NEW: add more filters on monthly statement list
NEW: Add option to define a default warehouse at user level NEW: add option TAKEPOS_CAN_FORCE_BANK_ACCOUNT_DURING_PAYMENT
NEW: Add option to include products without alert in replenish NEW: add option to define a default warehouse at user level
NEW: add option to include products without alert in replenish
NEW: add order by lastname and firstname by default in get sales representatives NEW: add order by lastname and firstname by default in get sales representatives
NEW: Add param to not show links when output tags NEW: add param to not show links when output tags
NEW: Add PDF document templates for warehouses (list of stock) NEW: add PDF document templates for warehouses (list of stock)
NEW: Add property cssview when declaring fields of an object NEW: add property cssview when declaring fields of an object
NEW: Add prospect status managment for the contact with managment of custom icon NEW: add prospect status managment for the contact with managment of custom icon
NEW: Add public note on products. This also partially fix the #14342 NEW: add public note on products ; this also partially fix the #14342
NEW: Add quick dropdown menu in top right menu (MAIN_USE_TOP_MENU_QUICKADD_DROPDOWN) NEW: add quick dropdown menu in top right menu (MAIN_USE_TOP_MENU_QUICKADD_DROPDOWN)
NEW: add region in export companies and contacts NEW: add region in export companies and contacts
NEW: add rights on margin info on invoice list NEW: add rights on margin info on invoice list
NEW: Add search param for close date on order list NEW: add search param for close date on order list
NEW: add send context for ticket NEW: add send context for ticket
NEW: Add show preview for mail attachement on form mail NEW: add show preview for mail attachement on form mail
NEW: add state origin for product NEW: add state origin for product
NEW: add State/Province origin for products NEW: add State/Province origin for products
NEW: Add the workflow interaction close intervention on closing ticket NEW: add the workflow interaction close intervention on closing ticket
NEW: Add third order printer to TakePOS NEW: add third order printer to TakePOS
NEW: add tracking number in list and search_all items NEW: add tracking number in list and search_all items
NEW: add two hooks printFieldListFrom and printFieldSearchParam NEW: add two hooks printFieldListFrom and printFieldSearchParam
NEW: Add __TYPE__ substitution key NEW: add __TYPE__ substitution key
NEW: Add validation of MX domain for emails NEW: add validation of MX domain for emails
NEW: add vcard for aderent and user NEW: add vcard for aderent and user
NEW: add week number for month view in agenda NEW: add week number for month view in agenda
NEW: Algeria data (tva and forme_juridique) NEW: Algeria data (tva and forme_juridique)
NEW: Allow click on all header numbers on commerce area NEW: allow click on all header numbers on commerce area
NEW: Allow to reopen interventions (green button) NEW: allow to reopen interventions (green button)
NEW: Allow zero quality on supplier/vendor order line NEW: allow zero quality on supplier/vendor order line
NEW: Appearance tab in TakePOS with more visual parameters NEW: appearance tab in TakePOS with more visual parameters
NEW: Better currency rate editor NEW: better currency rate editor
NEW: Calculate the virtual stock in transverse mode ( not on getEntity('commande'), ... but on getEntity('stock') ) NEW: calculate the virtual stock in transverse mode ( not on getEntity('commande'), ... but on getEntity('stock') )
NEW: Can add event to log into blockedlog module with a constant. NEW: can add event to log into blockedlog module with a constant
NEW: Can build vendor invoice from vendor orders NEW: can build vendor invoice from vendor orders
NEW: Can change a product in line of recurring invoice or contract NEW: can change a product in line of recurring invoice or contract
NEW: Can change size of logo on PDF documents NEW: can change size of logo on PDF documents
NEW: Can change VAT rate of all lines of a draft object in one step. NEW: can change VAT rate of all lines of a draft object in one step
NEW: Can define date range of validity of a login during creation NEW: can define date range of validity of a login during creation
NEW: Can disable, from edit page, the whole web site NEW: can disable, from edit page, the whole web site
NEW: can edit and set sales representatives directly on thirdparty card NEW: can edit and set sales representatives directly on thirdparty card
NEW: Can edit the list of sending email profiles. NEW: Can edit the list of sending email profiles.
NEW: Can enable/disable users in bulk actions NEW: can enable/disable users in bulk actions
NEW: Can filter on accounting system ref in export of chart of account NEW: can filter on accounting system ref in export of chart of account
NEW: Can filter on container type, language and tags in the list of pages NEW: can filter on container type, language and tags in the list of pages
NEW: Can force the antivirus from conf file or autoprepend ini setup. NEW: can force the antivirus from conf file or autoprepend ini setup
NEW: Can hide eatby, sellby dates with option PRODUCT_DISABLE_SELLBY and PRODUCT_DISABLE_EATBY NEW: can hide eatby, sellby dates with option PRODUCT_DISABLE_SELLBY and PRODUCT_DISABLE_EATBY
NEW: Can import proposals, sales orders, supplier invoices NEW: can import proposals, sales orders, supplier invoices
NEW: can set a dedicated SMTP config for sending email from public ticket interface NEW: can set a dedicated SMTP config for sending email from public ticket interface
NEW: Can set tags/categories to website pages. NEW: can set tags/categories to website pages
NEW: Can set type of price without tax per default for new sale price creation NEW: can set type of price without tax per default for new sale price creation
NEW: Can use desired stock of a given warehouse for replenishment NEW: can use desired stock of a given warehouse for replenishment
NEW: Can use THEME_DARKMODEENABLED=2 for a preview of theme in dark mode NEW: can use THEME_DARKMODEENABLED=2 for a preview of theme in dark mode
NEW: change thirdparty with barcode scan in takepos NEW: change thirdparty with barcode scan in TakePOS
NEW: Common behavior for monthly leave list view NEW: common behavior for monthly leave list view
NEW: conf to allow show full arbo in warehouse getnomurl NEW: conf to allow show full arbo in warehouse getnomurl
NEW: convert all subscription in datetime NEW: convert all subscription in datetime
NEW: create thirdparty customer from TAKEPOS NEW: create thirdparty customer from TakePOS
NEW: Date shipment from order accepts hours NEW: date shipment from order accepts hours
NEW: Declinaison price level compatibility NEW: declinaison price level compatibility
NEW: Delayed payment in TakePOS NEW: delayed payment in TakePOS
NEW: Development of module Recruitment NEW: development of module Recruitment
NEW: display date range if exist in takepos NEW: display date range if exist in TakePOS
NEW: display resiliate status in takepos for member NEW: display resiliate status in TakePOS for member
NEW: display stat for BOM on "object referent"/linked Object product tab NEW: display stat for BOM on "object referent"/linked Object product tab
NEW: edit and update a ticket NEW: edit and update a ticket
NEW: edit or delete dispatched lines NEW: edit or delete dispatched lines
NEW: Email configuration - Allow auto signed certificat when smtp ssl activated NEW: Email configuration - allow auto signed certificat when smtp ssl activated
NEW: enable free emails input with select2 NEW: enable free emails input with select2
NEW: endpoint getContacts and Clean results NEW: endpoint getContacts and Clean results
NEW: Events in agenda for contact NEW: Events in agenda for contact
NEW: Field to link website page to an other object NEW: Field to link website page to an other object
NEW: Fill ECM src object fields in dol_add_file_process NEW: fill ECM src object fields in dol_add_file_process
NEW: filter on progress column in task list NEW: filter on progress column in task list
NEW: filter product list by country and/or state/province NEW: filter product list by country and/or state/province
NEW: format tickets sent by mail in public interface NEW: format tickets sent by mail in public interface
NEW: add juridical status for Algeria NEW: add juridical status for Algeria
NEW: form to add customer/supplier into categories NEW: form to add customer/supplier into categories
NEW: Framework is ready for CSRF token protection on explicit GET URLs. NEW: Framework is ready for CSRF token protection on explicit GET URLs
NEW: get all child recursively NEW: get all child recursively
NEW: Get contacts list of a given order NEW: get contacts list of a given order
NEW: helper functions for export with phpspreadsheet NEW: helper functions for export with phpspreadsheet
NEW: hide closed contract lines NEW: hide closed contract lines
NEW: hide label in pdf for variants NEW: hide label in PDF for variants
NEW: Hook on propal card NEW: Hook on propal card
NEW: If specific help page is available, we change color of icon NEW: if specific help page is available, we change color of icon
NEW: Include the tag editor of page as a popup into website editor NEW: include the tag editor of page as a popup into website editor
NEW: Introduce constant FACTUREFOURN_REUSE_NOTES_ON_CREATE_FROM NEW: introduce constant FACTUREFOURN_REUSE_NOTES_ON_CREATE_FROM
NEW: Introducing new modal boxes in TakePOS NEW: introducing new modal boxes in TakePOS
NEW: Keep takepos terminal when login/logout NEW: keep TakePOS terminal when login/logout
NEW: Link on balance to the ledger NEW: link on balance to the ledger
NEW: MAIN_EMAILCOLLECTOR_MAIL_WITHOUT_HEADER const in email collector NEW: MAIN_EMAILCOLLECTOR_MAIL_WITHOUT_HEADER const in email collector
NEW: manage errors on update extra fields in ticket card NEW: manage errors on update extra fields in ticket card
NEW: mass-actions for the event list view NEW: mass-actions for the event list view
NEW: Module Intracomm report NEW: Module Intracomm report
NEW: More filter for "View change logs" NEW: more filter for "View change logs"
NEW: multicurrency total in takepos NEW: multicurrency total in TakePOS
NEW: multiselect type and date to date filter NEW: multiselect type and date to date filter
NEW: Nature of product is now a dictionay NEW: Nature of product is now a dictionay
NEW: new line template: hidden conf to fill service dates from the last service line NEW: new line template: hidden conf to fill service dates from the last service line
@ -158,38 +161,38 @@ NEW: possibilty to group payments by mode and show their subtotal
NEW: Print payment method and change in TakePOS NEW: Print payment method and change in TakePOS
NEW: Priority and transparency from external calendar events NEW: Priority and transparency from external calendar events
NEW: Products Import/Export 'default warehouse' and 'use batch number' fields NEW: Products Import/Export 'default warehouse' and 'use batch number' fields
NEW: Purchase price table: Added filterable table columns NEW: Purchase price table: added filterable table columns
NEW: rate editor for multicurrency NEW: rate editor for multicurrency
NEW: ref_ext field for Commande lines, order lines, Attributes and Combinations, Invoice lines, payments, order lines NEW: ref_ext field for Commande lines, order lines, Attributes and Combinations, Invoice lines, payments, order lines
NEW: remove new lines in mail on add ticket message NEW: remove new lines in mail on add ticket message
NEW: restrict thirdparty to customer in takepos NEW: restrict thirdparty to customer in TakePOS
NEW: Allow to edit "demand reason" field though API NEW: allow to edit "demand reason" field though API
NEW: Rule "email to" accept wildcard * NEW: Rule "email to" accept wildcard *
NEW: Save filter of the project homepage NEW: Save filter of the project homepage
NEW: Select-able columns on customer invoice paymnet list NEW: select-able columns on customer invoice paymnet list
NEW: Select-able columns on miscellaneous payments + more data columns NEW: select-able columns on miscellaneous payments + more data columns
NEW: Select-able columns on social taxes list NEW: select-able columns on social taxes list
NEW: Select-able columns on supplier invoice payment list NEW: select-able columns on supplier invoice payment list
NEW: send context and remove new lines on create ticket NEW: send context and remove new lines on create ticket
NEW: set entity when creating invoice on takepos NEW: set entity when creating invoice on takepos
NEW: Show available stock in TakePOS NEW: show available stock in TakePOS
NEW: Show category filter on lists only when user have rights to read categories NEW: show category filter on lists only when user have rights to read categories
NEW: Show header number and make it clickable in warehouse arean, payment area, shipment area NEW: show header number and make it clickable in warehouse arean, payment area, shipment area
NEW: Show image of user in the combo select of users NEW: show image of user in the combo select of users
NEW: Show label on batch card NEW: show label on batch card
NEW: Show line number on intervention card (via MAIN_VIEW_LINE_NUMBER) NEW: show line number on intervention card (via MAIN_VIEW_LINE_NUMBER)
NEW: show links for select and multi-select in category extra field NEW: show links for select and multi-select in category extra field
NEW: Show module and permission ids on user/group rights (only admin) NEW: show module and permission ids on user/group rights (only admin)
NEW: Show place from events on import calender NEW: show place from events on import calender
NEW: Show references in contract form on interventions NEW: show references in contract form on interventions
NEW: Show tags and status in search list of website pages NEW: show tags and status in search list of website pages
NEW: Show user on external calender events (when found) NEW: show user on external calender events (when found)
NEW: subject title with company name instead of application title in ticket message NEW: subject title with company name instead of application title in ticket message
NEW: Support for Samba4 AD NEW: Support for Samba4 AD
NEW: TakePOS connector compatibility with RECEIPT PRINTERS module NEW: TakePOS connector compatibility with RECEIPT PRINTERS module
NEW: TakePOS Gift Receipt NEW: TakePOS Gift Receipt
NEW: TakePOS Multicurrency compatibility NEW: TakePOS Multicurrency compatibility
NEW: The global header of a website can also have dynamic content NEW: the global header of a website can also have dynamic content
NEW: Third-Party Import new fields: mother company,outstanding debt limit,bank account,incoterms NEW: Third-Party Import new fields: mother company,outstanding debt limit,bank account,incoterms
NEW: Thirdparty module : box on customer/supplier tab for invoice outsantding amount late NEW: Thirdparty module : box on customer/supplier tab for invoice outsantding amount late
NEW: ticket classification on create from email collector NEW: ticket classification on create from email collector
@ -198,16 +201,18 @@ NEW: translate classification labels in ticket
NEW: triggers create, modify, delete NEW: triggers create, modify, delete
NEW: VAT for Algeria NEW: VAT for Algeria
NEW: Use preselect third-party from list on new card NEW: Use preselect third-party from list on new card
NEW: Vat report - Invert constant to show by default zero vat in reports NEW: VAT report - Invert constant to show by default zero vat in reports
NEW: website page fields selection NEW: website page fields selection
NEW: Weighing Scale compatibility with TakePOS connector NEW: Weighing Scale compatibility with TakePOS connector
NEW: When creating a user from a member linked to a thirdparty, you can choose to create if as external or internal user NEW: when creating a user from a member linked to a thirdparty, you can choose to create if as external or internal user
NEW: Add clone functionality on miscellaneous payment NEW: add clone functionality on miscellaneous payment
For developers: For developers:
---------------
NEW: Can use dynamic code into the 'enabled' property of DAO fields NEW: Can use dynamic code into the 'enabled' property of DAO fields
NEW: API Can update a payment NEW: API can update a payment
NEW: api get member by thirdparty NEW: API get member by thirdparty
NEW: API get thirdparty by barcode NEW: API get thirdparty by barcode
NEW: API get users by email / login NEW: API get users by email / login
NEW: fetch contact by email with REST API NEW: fetch contact by email with REST API
@ -215,14 +220,15 @@ NEW: field ref_ext in llx_commandedet
NEW: fields ref_ext for Attributes and Combinations NEW: fields ref_ext for Attributes and Combinations
NEW: get state by REST API NEW: get state by REST API
NEW: get state dictionnary by REST API NEW: get state dictionnary by REST API
NEW: Improve Product API for variant products NEW: improve Product API for variant products
NEW: Oauth SCOPE for Admin SDK NEW: OAuth SCOPE for Admin SDK
NEW: Retrieve discount from invoice from API NEW: retrieve discount from invoice from API
NEW: standardizes API thirdparties by email like other object NEW: standardizes API thirdparties by email like other object
NEW: thirdparty REST API: endpoint to set price level NEW: Thirdparty REST API: endpoint to set price level
NEW: Use new category API for project list view NEW: use new category API for project list view
NEW: Triggers Attributes and Attributes values NEW: Triggers Attributes and Attributes values
NEW: Add hooks on newpayment page to allow external payment modules NEW: add hooks on newpayment page to allow external payment modules
WARNING: WARNING:
@ -288,6 +294,7 @@ FIX: Visualization rights correction on last modified contacts box
FIX: Wrong redirection FIX: Wrong redirection
FIX: Yogosha report 4425 (backport) FIX: Yogosha report 4425 (backport)
***** ChangeLog for 12.0.2 compared to 12.0.1 ***** ***** ChangeLog for 12.0.2 compared to 12.0.1 *****
FIX: computation of the bottom margin of <body> returns NaN because body is not loaded yet FIX: computation of the bottom margin of <body> returns NaN because body is not loaded yet
FIX: DebugBar hides content at page bottom FIX: DebugBar hides content at page bottom

View File

@ -6,7 +6,7 @@
Dolibarr ERP & CRM est un logiciel moderne pour gérer votre activité (société, association, auto-entrepreneurs, artisans). Dolibarr ERP & CRM est un logiciel moderne pour gérer votre activité (société, association, auto-entrepreneurs, artisans).
Il est simple d'utilisation et modulaire, vous permettant de n'activez que les fonctions dont vous avez besoin (contacts, fournisseurs, factures, commandes, stocks, agenda, ...). Il est simple d'utilisation et modulaire, vous permettant de n'activez que les fonctions dont vous avez besoin (contacts, fournisseurs, factures, commandes, stocks, agenda, ...).
![ScreenShot](https://www.dolibarr.org/images/dolibarr_screenshot1_1920x1080.jpg) ![ScreenShot](https://www.dolibarr.org/medias/dolibarr_screenshot1_1920x1080.jpg)
## LICENCE ## LICENCE

View File

@ -15,7 +15,7 @@ You can use it as a standalone application or as a web application to access it
Dolibarr has a large community ready to help you, free forums and [oficially preferred partners ready to offer commercial support should you need it](https://partners.dolibarr.org) Dolibarr has a large community ready to help you, free forums and [oficially preferred partners ready to offer commercial support should you need it](https://partners.dolibarr.org)
![ScreenShot](https://www.dolibarr.org/images/dolibarr_screenshot1_1920x1080.jpg) ![ScreenShot](https://www.dolibarr.org/medias/dolibarr_screenshot1_1920x1080.jpg)
## LICENSE ## LICENSE

View File

@ -232,7 +232,7 @@ $dolibarr_main_prod='0';
# Examples: # Examples:
# $dolibarr_mailing_limit_sendbycli='0'; # $dolibarr_mailing_limit_sendbycli='0';
# dolibarr_distrib # dolibarr_main_distrib
# A key to identify the distribution used for first installation # A key to identify the distribution used for first installation
$dolibarr_distrib = 'deb'; $dolibarr_main_distrib = 'debian';

View File

@ -24,6 +24,7 @@ $force_install_databaserootpass='__SUPERUSERPASSWORD__';
$force_install_dolibarrlogin='admin'; $force_install_dolibarrlogin='admin';
$force_install_nophpinfo='1'; $force_install_nophpinfo='1';
$force_install_lockinstall='444'; $force_install_lockinstall='444';
$force_install_distrib='debian';
// Value to overwrite path to use shared libraries/fonts instead of embedded one. // Value to overwrite path to use shared libraries/fonts instead of embedded one.
// If during install, we enable/disable declaration to use non embedded libraries, we must also check they are // If during install, we enable/disable declaration to use non embedded libraries, we must also check they are

View File

@ -22,6 +22,7 @@ $force_install_databaserootpass='WAMPMYSQLNEWPASSWORD';
$force_install_dolibarrlogin='admin'; $force_install_dolibarrlogin='admin';
$force_install_nophpinfo='1'; $force_install_nophpinfo='1';
$force_install_lockinstall='644'; $force_install_lockinstall='644';
$force_install_distrib='doliwamp';
$force_install_module=''; $force_install_module='';
?> ?>

View File

@ -17,6 +17,7 @@ $force_install_databaserootpass='__SUPERUSERPASSWORD__';
$force_install_dolibarrlogin='admin'; $force_install_dolibarrlogin='admin';
$force_install_nophpinfo='1'; $force_install_nophpinfo='1';
$force_install_lockinstall='444'; $force_install_lockinstall='444';
$force_install_distrib='rpmfedora';
// Value to overwrite path to use shared libraries/fonts instead of embedded one // Value to overwrite path to use shared libraries/fonts instead of embedded one
$force_dolibarr_lib_ADODB_PATH='/usr/share/php/adodb'; $force_dolibarr_lib_ADODB_PATH='/usr/share/php/adodb';

View File

@ -17,6 +17,7 @@ $force_install_databaserootpass='__SUPERUSERPASSWORD__';
$force_install_dolibarrlogin='admin'; $force_install_dolibarrlogin='admin';
$force_install_nophpinfo='1'; $force_install_nophpinfo='1';
$force_install_lockinstall='444'; $force_install_lockinstall='444';
$force_install_distrib='rpmgeneric';
// Value to overwrite path to use shared libraries/fonts instead of embedded one // Value to overwrite path to use shared libraries/fonts instead of embedded one
// We don't force any external lib with generic package // We don't force any external lib with generic package

View File

@ -17,6 +17,7 @@ $force_install_databaserootpass='__SUPERUSERPASSWORD__';
$force_install_dolibarrlogin='admin'; $force_install_dolibarrlogin='admin';
$force_install_nophpinfo='1'; $force_install_nophpinfo='1';
$force_install_lockinstall='444'; $force_install_lockinstall='444';
$force_install_distrib='rpmmandriva';
// Value to overwrite path to use shared libraries/fonts instead of embedded one // Value to overwrite path to use shared libraries/fonts instead of embedded one
$force_dolibarr_lib_ADODB_PATH='/usr/share/php/adodb'; $force_dolibarr_lib_ADODB_PATH='/usr/share/php/adodb';

View File

@ -17,6 +17,7 @@ $force_install_databaserootpass='__SUPERUSERPASSWORD__';
$force_install_dolibarrlogin='admin'; $force_install_dolibarrlogin='admin';
$force_install_nophpinfo='1'; $force_install_nophpinfo='1';
$force_install_lockinstall='444'; $force_install_lockinstall='444';
$force_install_distrib='rpmopensuse';
// Value to overwrite path to use shared libraries/fonts instead of embedded one // Value to overwrite path to use shared libraries/fonts instead of embedded one
//$force_dolibarr_lib_ADODB_PATH='/usr/share/php/adodb'; //$force_dolibarr_lib_ADODB_PATH='/usr/share/php/adodb';

View File

@ -1,10 +1,19 @@
# HOW TO BUILD # HOW TO BUILD
## DEVELOPPER ACCOUNT
## ENABLE MODULE ZAPIER ON DOLIBARR
This should also enable the module API (required for authentication by Zapier service and to execute action in Dolibarr by Zapier).
Create the Dolibarr login that will be used by Zapier to call APIs. Give the login the permissions on the action you plan to automate.
## CREATE A ZAPIER DEVELOPPER ACCOUNT
At first, you need to have a Zapier developper acoount, create it here [Zapier Platform](https://developer.zapier.com/) At first, you need to have a Zapier developper acoount, create it here [Zapier Platform](https://developer.zapier.com/)
## BUILD INTEGRATION
## INSTALL ZAPIER COMMAND LINE TOOLS WITH LINK TO ZAPIER ONLINE ACCOUNT
### Install Node.js ### Install Node.js
@ -17,7 +26,7 @@ After installation, confirm that Node.js is ready to use:
Next let's install the Zapier CLI tools. The CLI will allow you to build your app, deploy it to the Zapier platform, do local testing, manage users and testers, view remote logs, collaborate with your team, and more: Next let's install the Zapier CLI tools. The CLI will allow you to build your app, deploy it to the Zapier platform, do local testing, manage users and testers, view remote logs, collaborate with your team, and more:
`cd dev/exemples/zapier` `cd dev/examples/zapier`
`npm install -g zapier-platform-cli` to install the CLI globally `npm install -g zapier-platform-cli` to install the CLI globally
@ -27,13 +36,15 @@ Next let's install the Zapier CLI tools. The CLI will allow you to build your ap
Let's configure authentication between your dev environment and the Zapier platform. You'll use the email address and password you use to log in to the Zapier application. Let's configure authentication between your dev environment and the Zapier platform. You'll use the email address and password you use to log in to the Zapier application.
`zapier --version` `zapier login`
This command will set up a .zapierrc file in your home directory. This command will set up a .zapierrc file in your home directory.
### Install the Project ### Install the Project
In zapier exemple directory, run: In zapier example directory, run:
`cd dev/examples/zapier`
`npm install` `npm install`
@ -41,8 +52,17 @@ In zapier exemple directory, run:
Let's deploy it! When you're ready to try your code out on the Zapier platform use the push command. Only you will be able to see the app until you invite testers. Let's deploy it! When you're ready to try your code out on the Zapier platform use the push command. Only you will be able to see the app until you invite testers.
`zapier register` (the first time, choose name for example "Dolibarr")
`zapier push` `zapier push`
### More info After a push, the Application, with the name you defined during the register step, is available when creating a Zap.
You will find original tutorial here : [https://zapier.com/developer/start/introduction](https://zapier.com/developer/start/introduction) You will find original tutorial here : [https://zapier.com/developer/start/introduction](https://zapier.com/developer/start/introduction)
### Create a Zap
Create a ZAP that use the application you registered.
For authentication, you must enter the login / pass of account used by Zapier to call APIs.

View File

@ -1,6 +1,6 @@
/*jshint esversion: 6 */ /*jshint esversion: 6 */
const testAuth = (z , bundle) => { const test = (z , bundle) => {
const url = bundle.authData.url+'/api/index.php/login'; const url = bundle.authData.url+'/api/index.php/status';
// Normally you want to make a request to an endpoint that is either specifically designed to test auth, or one that // Normally you want to make a request to an endpoint that is either specifically designed to test auth, or one that
// every user will have access to, such as an account or profile endpoint like /me. // every user will have access to, such as an account or profile endpoint like /me.
// In this example, we'll hit httpbin, which validates the Authorization Header against the arguments passed in the URL path // In this example, we'll hit httpbin, which validates the Authorization Header against the arguments passed in the URL path
@ -11,44 +11,69 @@ const testAuth = (z , bundle) => {
// This method can return any truthy value to indicate the credentials are valid. // This method can return any truthy value to indicate the credentials are valid.
// Raise an error to show // Raise an error to show
return promise.then((response) => { return promise.then((response) => {
if (response.status === 401) { if (response.status === 400) {
throw new Error('The Session Key you supplied is invalid'); throw new Error('400 -The Session Key you supplied is invalid');
}
if (response.status === 403) {
throw new Error('403 -The Session Key you supplied is invalid');
} }
return response; return response;
}); });
}; };
const getSessionKey = (z, bundle) => { // To include the session key header on all outbound requests, simply define a function here.
// It runs runs before each request is sent out, allowing you to make tweaks to the request in a centralized spot
const includeSessionKeyHeader = (request, z, bundle) => {
if (bundle.authData.sessionKey) {
request.headers = request.headers || {};
request.headers['DOLAPIKEY'] = bundle.authData.sessionKey;
}
return request;
};
// If we get a response and it is a 401, we can raise a special error telling Zapier to retry this after another exchange.
const sessionRefreshIf401 = (response, z, bundle) => {
if (bundle.authData.sessionKey) {
if (response.status === 401) {
throw new z.errors.RefreshAuthError('Session apikey needs refreshing.');
}
}
return response;
};
const getSessionKey = async (z, bundle) => {
const url = bundle.authData.url + '/api/index.php/login'; const url = bundle.authData.url + '/api/index.php/login';
const promise = z.request({ const response = await z.request({
method: 'POST',
url: url, url: url,
method: 'POST',
body: { body: {
login: bundle.authData.login, login: bundle.authData.login,
password: bundle.authData.password, password: bundle.authData.password,
} },
}); });
return promise.then((response) => { // if (response.status === 401) {
if (response.status === 401) { // throw new Error('The login/password you supplied is invalid');
throw new Error('The login/password you supplied is invalid'); // }
}
const json = JSON.parse(response.content); const json = JSON.parse(response.content);
return { return {
sessionKey: json.success.token || 'secret' sessionKey: json.success.token || '',
}; };
});
}; };
module.exports = { module.exports = {
config: {
type: 'session', type: 'session',
sessionConfig: {
perform: getSessionKey
},
// Define any auth fields your app requires here. The user will be prompted to enter this info when // Define any auth fields your app requires here. The user will be prompted to enter this info when
// they connect their account. // they connect their account.
fields: [ fields: [
{ {
key: 'url', key: 'url',
label: 'Url of service', label: 'Url of service without trailing-slash',
required: true, required: true,
type: 'string' type: 'string'
}, },
@ -67,11 +92,11 @@ module.exports = {
], ],
// The test method allows Zapier to verify that the credentials a user provides are valid. We'll execute this // The test method allows Zapier to verify that the credentials a user provides are valid. We'll execute this
// method whenever a user connects their account for the first time. // method whenever a user connects their account for the first time.
test: testAuth, test,
// The method that will exchange the fields provided by the user for session credentials. // The method that will exchange the fields provided by the user for session credentials.
sessionConfig: {
perform: getSessionKey
},
// assuming "login" is a key returned from the test // assuming "login" is a key returned from the test
connectionLabel: '{{login}}' connectionLabel: '{{login}}'
},
befores: [includeSessionKeyHeader],
afters: [sessionRefreshIf401],
}; };

View File

@ -72,7 +72,7 @@ module.exports = {
}, },
outputFields: [ outputFields: [
{key: 'id', label: 'ID'}, {key: 'id', type: "integer", label: 'ID'},
{key: 'name', label: 'Name'}, {key: 'name', label: 'Name'},
{key: 'name_alias', label: 'Name alias'}, {key: 'name_alias', label: 'Name alias'},
{key: 'address', label: 'Address'}, {key: 'address', label: 'Address'},
@ -81,8 +81,8 @@ module.exports = {
{key: 'phone', label: 'Phone'}, {key: 'phone', label: 'Phone'},
{key: 'fax', label: 'Fax'}, {key: 'fax', label: 'Fax'},
{key: 'email', label: 'Email'}, {key: 'email', label: 'Email'},
{key: 'client', label: 'Customer/Prospect 0/1/2/3'}, {key: 'client', type: "integer", label: 'Customer/Prospect 0/1/2/3'},
{key: 'fournisseur', label: 'Supplier 0/1'}, {key: 'fournisseur', type: "integer", label: 'Supplier 0/1'},
{key: 'code_client', label: 'Customer code'}, {key: 'code_client', label: 'Customer code'},
{key: 'code_fournisseur', label: 'Supplier code'} {key: 'code_fournisseur', label: 'Supplier code'}
] ]

View File

@ -1,33 +1,39 @@
/*jshint esversion: 6 */ /*jshint esversion: 6 */
const triggerThirdparty = require('./triggers/thirdparty');
const triggerOrder = require('./triggers/order');
const triggerAction = require('./triggers/action'); const triggerAction = require('./triggers/action');
const triggerOrder = require('./triggers/order');
const triggerThirdparty = require('./triggers/thirdparty');
const triggerTicket = require('./triggers/ticket');
const triggerUser = require('./triggers/user');
const searchThirdparty = require('./searches/thirdparty'); const searchThirdparty = require('./searches/thirdparty');
const createThirdparty = require('./creates/thirdparty'); const createThirdparty = require('./creates/thirdparty');
const authentication = require('./authentication'); const {
config: authentication,
befores = [],
afters = [],
} = require('./authentication');
// To include the session key header on all outbound requests, simply define a function here. // To include the session key header on all outbound requests, simply define a function here.
// It runs runs before each request is sent out, allowing you to make tweaks to the request in a centralized spot // It runs runs before each request is sent out, allowing you to make tweaks to the request in a centralized spot
const includeSessionKeyHeader = (request, z, bundle) => { // const includeSessionKeyHeader = (request, z, bundle) => {
if (bundle.authData.sessionKey) { // if (bundle.authData.sessionKey) {
request.headers = request.headers || {}; // request.headers = request.headers || {};
request.headers['DOLAPIKEY'] = bundle.authData.sessionKey; // request.headers['DOLAPIKEY'] = bundle.authData.sessionKey;
} // }
return request; // return request;
}; // };
// If we get a response and it is a 401, we can raise a special error telling Zapier to retry this after another exchange. // If we get a response and it is a 401, we can raise a special error telling Zapier to retry this after another exchange.
const sessionRefreshIf401 = (response, z, bundle) => { // const sessionRefreshIf401 = (response, z, bundle) => {
if (bundle.authData.sessionKey) { // if (bundle.authData.sessionKey) {
if (response.status === 401) { // if (response.status === 401) {
throw new z.errors.RefreshAuthError('Session apikey needs refreshing.'); // throw new z.errors.RefreshAuthError('Session apikey needs refreshing.');
} // }
} // }
return response; // return response;
}; // };
// We can roll up all our behaviors in an App. // We can roll up all our behaviors in an App.
const App = { const App = {
@ -40,11 +46,11 @@ const App = {
// beforeRequest & afterResponse are optional hooks into the provided HTTP client // beforeRequest & afterResponse are optional hooks into the provided HTTP client
beforeRequest: [ beforeRequest: [
includeSessionKeyHeader ...befores
], ],
afterResponse: [ afterResponse: [
sessionRefreshIf401 ...afters
], ],
// If you want to define optional resources to simplify creation of triggers, searches, creates - do that here! // If you want to define optional resources to simplify creation of triggers, searches, creates - do that here!
@ -53,9 +59,11 @@ const App = {
// If you want your trigger to show up, you better include it here! // If you want your trigger to show up, you better include it here!
triggers: { triggers: {
[triggerThirdparty.key]: triggerThirdparty, [triggerAction.key]: triggerAction,
[triggerOrder.key]: triggerOrder, [triggerOrder.key]: triggerOrder,
[triggerAction.key]: triggerAction [triggerThirdparty.key]: triggerThirdparty,
[triggerTicket.key]: triggerTicket,
[triggerUser.key]: triggerUser,
}, },
// If you want your searches to show up, you better include it here! // If you want your searches to show up, you better include it here!

View File

@ -1,6 +1,6 @@
{ {
"name": "dolibarr", "name": "dolibarr",
"version": "1.0.0", "version": "1.13.0",
"description": "An app for connecting Dolibarr to the Zapier platform.", "description": "An app for connecting Dolibarr to the Zapier platform.",
"repository": "Dolibarr/dolibarr", "repository": "Dolibarr/dolibarr",
"homepage": "https://www.dolibarr.org/", "homepage": "https://www.dolibarr.org/",
@ -15,7 +15,7 @@
"npm": ">=5.6.0" "npm": ">=5.6.0"
}, },
"dependencies": { "dependencies": {
"zapier-platform-core": "8.0.1" "zapier-platform-core": "10.1.1"
}, },
"devDependencies": { "devDependencies": {
"mocha": "^5.2.0", "mocha": "^5.2.0",

View File

@ -54,13 +54,20 @@ module.exports = {
// outputFields: () => { return []; } // outputFields: () => { return []; }
// Alternatively, a static field definition should be provided, to specify labels for the fields // Alternatively, a static field definition should be provided, to specify labels for the fields
outputFields: [ outputFields: [
{key: 'id', label: 'ID'}, {
{key: 'createdAt', label: 'Created At'}, key: 'id',
type: "integer",
label: 'ID'
},
{key: 'createdAt', type: "integer", label: 'Created At'},
{key: 'name', label: 'Name'}, {key: 'name', label: 'Name'},
{key: 'firstname', label: 'Firstname'}, {key: 'firstname', label: 'Firstname'},
{key: 'directions', label: 'Directions'}, {key: 'directions', label: 'Directions'},
{key: 'authorId', label: 'Author ID'}, {key: 'authorId', type: "integer", label: 'Author ID'},
{key: 'style', label: 'Style'} {
key: 'style',
label: 'Style'
}
] ]
} }
}; };

View File

@ -17,7 +17,7 @@ const subscribeHook = (z, bundle) => {
const options = { const options = {
url: url, url: url,
method: 'POST', method: 'POST',
body: JSON.stringify(data) body: data,
}; };
// You may return a promise or a normal data structure from any perform method. // You may return a promise or a normal data structure from any perform method.
@ -100,7 +100,7 @@ module.exports = {
noun: 'Action', noun: 'Action',
display: { display: {
label: 'New Agenda', label: 'New Agenda',
description: 'Trigger when a new agenda with action is done in Dolibarr.' description: 'Triggers when a new agenda with action is done in Dolibarr.'
}, },
// `operation` is where the business logic goes. // `operation` is where the business logic goes.
@ -111,6 +111,7 @@ module.exports = {
inputFields: [ inputFields: [
{ {
key: 'action', key: 'action',
required: true,
type: 'string', type: 'string',
helpText: 'Which action of agenda this should trigger on.', helpText: 'Which action of agenda this should trigger on.',
choices: { choices: {
@ -145,12 +146,33 @@ module.exports = {
// outputFields: () => { return []; } // outputFields: () => { return []; }
// Alternatively, a static field definition should be provided, to specify labels for the fields // Alternatively, a static field definition should be provided, to specify labels for the fields
outputFields: [ outputFields: [
{key: 'id', label: 'ID'}, {
{key: 'createdAt', label: 'Created At'}, key: 'id',
{key: 'name', label: 'Name'}, type: "integer",
{key: 'usertodo__name', label: 'UserToDo Name'}, label: 'ID'
{key: 'authorId', label: 'Author ID'}, },
{key: 'action', label: 'Action'} {
key: 'createdAt',
type: "integer",
label: 'Created At'
},
{
key: 'name',
label: 'Name'
},
{
key: 'usertodo__name',
label: 'UserToDo Name'
},
{
key: 'authorId',
type: "integer",
label: 'Author ID'
},
{
key: 'action',
label: 'Action'
}
] ]
} }
}; };

View File

@ -17,7 +17,7 @@ const subscribeHook = (z, bundle) => {
const options = { const options = {
url: url, url: url,
method: 'POST', method: 'POST',
body: JSON.stringify(data) body: data,
}; };
// You may return a promise or a normal data structure from any perform method. // You may return a promise or a normal data structure from any perform method.
@ -90,7 +90,7 @@ module.exports = {
noun: 'Order', noun: 'Order',
display: { display: {
label: 'New Order', label: 'New Order',
description: 'Trigger when a new order with action is done in Dolibarr.' description: 'Triggers when a new order with action is done in Dolibarr.'
}, },
// `operation` is where the business logic goes. // `operation` is where the business logic goes.
@ -101,6 +101,7 @@ module.exports = {
inputFields: [ inputFields: [
{ {
key: 'action', key: 'action',
required: true,
type: 'string', type: 'string',
helpText: 'Which action of order this should trigger on.', helpText: 'Which action of order this should trigger on.',
choices: { choices: {
@ -136,11 +137,11 @@ module.exports = {
// outputFields: () => { return []; } // outputFields: () => { return []; }
// Alternatively, a static field definition should be provided, to specify labels for the fields // Alternatively, a static field definition should be provided, to specify labels for the fields
outputFields: [ outputFields: [
{key: 'id', label: 'ID'}, {key: 'id', type: "integer", label: 'ID'},
{key: 'createdAt', label: 'Created At'}, {key: 'createdAt', type: "integer", label: 'Created At'},
{key: 'name', label: 'Name'}, {key: 'name', label: 'Name'},
{key: 'directions', label: 'Directions'}, {key: 'directions', label: 'Directions'},
{key: 'authorId', label: 'Author ID'}, {key: 'authorId', type: "integer", label: 'Author ID'},
{key: 'module', label: 'Module'}, {key: 'module', label: 'Module'},
{key: 'action', label: 'Action'} {key: 'action', label: 'Action'}
] ]

View File

@ -17,7 +17,7 @@ const subscribeHook = (z, bundle) => {
const options = { const options = {
url: url, url: url,
method: 'POST', method: 'POST',
body: JSON.stringify(data) body: data,
}; };
// You may return a promise or a normal data structure from any perform method. // You may return a promise or a normal data structure from any perform method.
@ -112,7 +112,7 @@ module.exports = {
noun: 'Thirdparty', noun: 'Thirdparty',
display: { display: {
label: 'New Thirdparty', label: 'New Thirdparty',
description: 'Trigger when a new thirdpaty action is done in Dolibarr.' description: 'Triggers when a new thirdpaty action is done in Dolibarr.'
}, },
// `operation` is where the business logic goes. // `operation` is where the business logic goes.
@ -123,6 +123,7 @@ module.exports = {
inputFields: [ inputFields: [
{ {
key: 'action', key: 'action',
required: true,
type: 'string', type: 'string',
helpText: 'Which action of thirdparty this should trigger on.', helpText: 'Which action of thirdparty this should trigger on.',
choices: { choices: {
@ -159,12 +160,12 @@ module.exports = {
// outputFields: () => { return []; } // outputFields: () => { return []; }
// Alternatively, a static field definition should be provided, to specify labels for the fields // Alternatively, a static field definition should be provided, to specify labels for the fields
outputFields: [ outputFields: [
{key: 'id', label: 'ID'}, {key: 'id', type: "integer", label: 'ID'},
{key: 'createdAt', label: 'Created At'}, {key: 'createdAt', label: 'Created At'},
{key: 'name', label: 'Name'}, {key: 'name', label: 'Name'},
{key: 'name_alias', label: 'Name alias'}, {key: 'name_alias', label: 'Name alias'},
{key: 'firstname', label: 'Firstame'}, {key: 'firstname', label: 'Firstname'},
{key: 'authorId', label: 'Author ID'}, {key: 'authorId', type: "integer", label: 'Author ID'},
{key: 'action', label: 'Action'}, {key: 'action', label: 'Action'},
{key: 'client', label: 'Customer/Prospect 0/1/2/3'}, {key: 'client', label: 'Customer/Prospect 0/1/2/3'},
{key: 'fournisseur', label: 'Supplier 0/1'}, {key: 'fournisseur', label: 'Supplier 0/1'},

View File

@ -0,0 +1,237 @@
const subscribeHook = (z, bundle) => {
// `z.console.log()` is similar to `console.log()`.
z.console.log('suscribing hook!');
// bundle.targetUrl has the Hook URL this app should call when an action is created.
const data = {
url: bundle.targetUrl,
event: bundle.event,
module: 'ticket',
action: bundle.inputData.action
};
const url = bundle.authData.url + '/api/index.php/zapierapi/hook';
// You can build requests and our client will helpfully inject all the variables
// you need to complete. You can also register middleware to control this.
const options = {
url: url,
method: 'POST',
body: data,
};
// You may return a promise or a normal data structure from any perform method.
return z.request(options).then((response) => JSON.parse(response.content));
};
const unsubscribeHook = (z, bundle) => {
// bundle.subscribeData contains the parsed response JSON from the subscribe
// request made initially.
z.console.log('unsuscribing hook!');
// You can build requests and our client will helpfully inject all the variables
// you need to complete. You can also register middleware to control this.
const options = {
url: bundle.authData.url + '/api/index.php/zapierapi/hook/' + bundle.subscribeData.id,
method: 'DELETE',
};
// You may return a promise or a normal data structure from any perform method.
return z.request(options).then((response) => JSON.parse(response.content));
};
const getTicket = (z, bundle) => {
// bundle.cleanedRequest will include the parsed JSON object (if it's not a
// test poll) and also a .querystring property with the URL's query string.
const ticket = {
id: bundle.cleanedRequest.id,
track_id: bundle.cleanedRequest.track_id,
subject: bundle.cleanedRequest.subject,
message: bundle.cleanedRequest.message,
lastname: bundle.cleanedRequest.lastname,
firstname: bundle.cleanedRequest.firstname,
address: bundle.cleanedRequest.address,
zip: bundle.cleanedRequest.zip,
town: bundle.cleanedRequest.town,
email_from: bundle.cleanedRequest.email_from,
login: bundle.cleanedRequest.login,
authorId: bundle.cleanedRequest.authorId,
createdAt: bundle.cleanedRequest.createdAt,
action: bundle.cleanedRequest.action
};
return [ticket];
};
const getFallbackRealTicket = (z, bundle) => {
// For the test poll, you should get some real data, to aid the setup process.
const module = bundle.inputData.module;
const options = {
url: bundle.authData.url + '/api/index.php/tickets/0',
};
return z.request(options).then((response) => [JSON.parse(response.content)]);
};
// const getModulesChoices = (z/*, bundle*/) => {
// // For the test poll, you should get some real data, to aid the setup process.
// const options = {
// url: bundle.authData.url + '/api/index.php/zapierapi/getmoduleschoices',
// };
// return z.request(options).then((response) => JSON.parse(response.content));
// };
// const getModulesChoices = () => {
// return {
// orders: "Order",
// invoices: "Invoice",
// thirdparties: "Thirdparty",
// users: "User",
// tickets: "Ticket",
// contacts: "Contacts"
// };
// };
// const getActionsChoices = (z, bundle) => {
// // For the test poll, you should get some real data, to aid the setup process.
// const module = bundle.inputData.module;
// const options = {
// url: url: bundle.authData.url + '/api/index.php/zapierapi/getactionschoices/thirparty`,
// };
// return z.request(options).then((response) => JSON.parse(response.content));
// };
// We recommend writing your triggers separate like this and rolling them
// into the App definition at the end.
module.exports = {
key: 'ticket',
// You'll want to provide some helpful display labels and descriptions
// for tickets. Zapier will put them into the UX.
noun: 'Ticket',
display: {
label: 'New Ticket',
description: 'Triggers when a new ticket action is done in Dolibarr.'
},
// `operation` is where the business logic goes.
operation: {
// `inputFields` can define the fields a ticket could provide,
// we'll pass them in as `bundle.inputData` later.
inputFields: [
{
key: 'action',
type: 'string',
required: true,
helpText: 'Which action of ticket this should trigger on.',
choices: {
create: "Create",
modify: "Modify",
validate: "Validate",
}
}
],
type: 'hook',
performSubscribe: subscribeHook,
performUnsubscribe: unsubscribeHook,
perform: getTicket,
performList: getFallbackRealTicket,
// In cases where Zapier needs to show an example record to the user, but we are unable to get a live example
// from the API, Zapier will fallback to this hard-coded sample. It should reflect the data structure of
// returned records, and have obviously dummy values that we can show to any user.
sample: {
id: 1,
track_id: 'Xaz123er',
subject: 'Subject',
message: 'Message',
createdAt: 1472069465,
lastname: 'DOE',
firstname: 'John',
email: 'john@doe.com',
address: 'Park Avenue',
zip: '12345',
town: 'NEW-YORK',
email_from: 'doe.john@example;com',
authorId: 1,
action: 'create'
},
// If the resource can have fields that are custom on a per-user basis, define a function to fetch the custom
// field definitions. The result will be used to augment the sample.
// outputFields: () => { return []; }
// Alternatively, a static field definition should be provided, to specify labels for the fields
outputFields: [
{
key: 'id',
type: "integer",
label: 'ID'
},
{
key: 'track_id',
type: "string",
label: 'TrackID'
},
{
key: 'subject',
type: "string",
label: 'Subject'
},
{
key: 'message',
type: "string",
label: 'Message'
},
{
key: 'createdAt',
type: "integer",
label: 'Created At'
},
{
key: 'lastname',
label: 'Lastname'
},
{
key: 'firstname',
label: 'Firstname'
},
{
key: 'email',
label: 'Email'
},
{
key: 'address',
label: 'Address'
},
{
key: 'zip',
label: 'Zip'
},
{
key: 'town',
label: 'Town'
},
{
key: 'email_from',
type: 'string',
label: 'Email from'
},
{
key: 'authorId',
type: "integer",
label: 'Author ID'
},
{
key: 'action',
type: 'string',
label: 'Action'
}
]
}
};

View File

@ -0,0 +1,177 @@
const subscribeHook = (z, bundle) => {
// `z.console.log()` is similar to `console.log()`.
z.console.log('suscribing hook!');
// bundle.targetUrl has the Hook URL this app should call when an action is created.
const data = {
url: bundle.targetUrl,
event: bundle.event,
module: 'user',
action: bundle.inputData.action
};
const url = bundle.authData.url + '/api/index.php/zapierapi/hook';
// You can build requests and our client will helpfully inject all the variables
// you need to complete. You can also register middleware to control this.
const options = {
url: url,
method: 'POST',
body: data,
};
// You may return a promise or a normal data structure from any perform method.
return z.request(options).then((response) => JSON.parse(response.content));
};
const unsubscribeHook = (z, bundle) => {
// bundle.subscribeData contains the parsed response JSON from the subscribe
// request made initially.
z.console.log('unsuscribing hook!');
// You can build requests and our client will helpfully inject all the variables
// you need to complete. You can also register middleware to control this.
const options = {
url: bundle.authData.url + '/api/index.php/zapierapi/hook/' + bundle.subscribeData.id,
method: 'DELETE',
};
// You may return a promise or a normal data structure from any perform method.
return z.request(options).then((response) => JSON.parse(response.content));
};
const getUser = (z, bundle) => {
// bundle.cleanedRequest will include the parsed JSON object (if it's not a
// test poll) and also a .querystring property with the URL's query string.
const user = {
id: bundle.cleanedRequest.id,
lastname: bundle.cleanedRequest.lastname,
firstname: bundle.cleanedRequest.firstname,
address: bundle.cleanedRequest.address,
zip: bundle.cleanedRequest.zip,
town: bundle.cleanedRequest.town,
email: bundle.cleanedRequest.email,
login: bundle.cleanedRequest.login,
authorId: bundle.cleanedRequest.authorId,
createdAt: bundle.cleanedRequest.createdAt,
action: bundle.cleanedRequest.action
};
return [user];
};
const getFallbackRealUser = (z, bundle) => {
// For the test poll, you should get some real data, to aid the setup process.
const module = bundle.inputData.module;
const options = {
url: bundle.authData.url + '/api/index.php/users/0',
};
return z.request(options).then((response) => [JSON.parse(response.content)]);
};
// const getModulesChoices = (z/*, bundle*/) => {
// // For the test poll, you should get some real data, to aid the setup process.
// const options = {
// url: bundle.authData.url + '/api/index.php/zapierapi/getmoduleschoices',
// };
// return z.request(options).then((response) => JSON.parse(response.content));
// };
// const getModulesChoices = () => {
// return {
// orders: "Order",
// invoices: "Invoice",
// thirdparties: "Thirdparty",
// users: "User",
// contacts: "Contacts"
// };
// };
// const getActionsChoices = (z, bundle) => {
// // For the test poll, you should get some real data, to aid the setup process.
// const module = bundle.inputData.module;
// const options = {
// url: url: bundle.authData.url + '/api/index.php/zapierapi/getactionschoices/thirparty`,
// };
// return z.request(options).then((response) => JSON.parse(response.content));
// };
// We recommend writing your triggers separate like this and rolling them
// into the App definition at the end.
module.exports = {
key: 'user',
// You'll want to provide some helpful display labels and descriptions
// for users. Zapier will put them into the UX.
noun: 'User',
display: {
label: 'New User',
description: 'Triggers when a new user action is done in Dolibarr.'
},
// `operation` is where the business logic goes.
operation: {
// `inputFields` can define the fields a user could provide,
// we'll pass them in as `bundle.inputData` later.
inputFields: [
{
key: 'action',
required: true,
type: 'string',
helpText: 'Which action of user this should trigger on.',
choices: {
create: "Create",
modify: "Modify",
validate: "Validate",
}
}
],
type: 'hook',
performSubscribe: subscribeHook,
performUnsubscribe: unsubscribeHook,
perform: getUser,
performList: getFallbackRealUser,
// In cases where Zapier needs to show an example record to the user, but we are unable to get a live example
// from the API, Zapier will fallback to this hard-coded sample. It should reflect the data structure of
// returned records, and have obviously dummy values that we can show to any user.
sample: {
id: 1,
createdAt: 1472069465,
lastname: 'DOE',
firstname: 'John',
email: 'john@doe.com',
address: 'Park Avenue',
zip: '12345',
town: 'NEW-YORK',
login: 'doe.john',
authorId: 1,
action: 'create'
},
// If the resource can have fields that are custom on a per-user basis, define a function to fetch the custom
// field definitions. The result will be used to augment the sample.
// outputFields: () => { return []; }
// Alternatively, a static field definition should be provided, to specify labels for the fields
outputFields: [
{key: 'id', type: "integer", label: 'ID'},
{key: 'createdAt', type: "integer", label: 'Created At'},
{key: 'lastname', label: 'Lastname'},
{key: 'firstname', label: 'Firstname'},
{key: 'email', label: 'Email'},
{key: 'address', label: 'Address'},
{key: 'zip', label: 'Zip'},
{key: 'town', label: 'Town'},
{key: 'login', label: 'Login'},
{key: 'authorId', type: "integer", label: 'Author ID'},
{key: 'action', label: 'Action'}
]
}
};

View File

@ -1,28 +1,29 @@
README (deutsch / german / allemand) README (deutsch / german / allemand)
-------------------------------- ------------------------------------
-------------------------------- ------------------------------------
Download / Herunterladen Download / Herunterladen
-------------------------------- ------------------------------------
* Dolibarr ERP/CRM kann man über die offizielle Dolibarr Website * Dolibarr ERP/CRM kann man über die offizielle Dolibarr Website
https://www.dolibarr.org/downloads https://www.dolibarr.org/downloads
oder direkt von Sourceforge
oder direkt bei Sourceforge
https://sourceforge.net/projects/dolibarr/files/ https://sourceforge.net/projects/dolibarr/files/
herunterladen. herunterladen.
* Die meisten externen Module/Themens sind über den DoliStore verfügbar:
https://www.dolistore.com/de/
------------------------------------
Installation / Hilfe
------------------------------------
-------------------------------- * Für eine kurze Einleitung schau in die README Datei im Hauptverzeichnis.
Installation
--------------------------------
* Für eine kurze Einleitung, schau auf die README Datei im Hauptverzeichnis.
* Umfangreiche Dokumentationen sind im Dolibarr Wiki zu finden: * Umfangreiche Dokumentationen sind im Dolibarr Wiki zu finden:
https://wiki.dolibarr.org/index.php/Hauptseite https://wiki.dolibarr.org/index.php/Hauptseite
@ -31,3 +32,14 @@ Installation
https://www.dolibarr.de/ https://www.dolibarr.de/
------------------------------------
Zusatzmodule
------------------------------------
* Die meisten externen Module/Themen sind über den offiziellen DoliStore verfügbar:
https://www.dolistore.com/de/

View File

@ -610,7 +610,7 @@ if ($result)
if (empty($defaultvalue)) $defaultvalue = $compta_prodbuy; if (empty($defaultvalue)) $defaultvalue = $compta_prodbuy;
$codesell = length_accountg($obj->accountancy_code_buy); $codesell = length_accountg($obj->accountancy_code_buy);
if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1); print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1, 0, 'maxwidth300 maxwidthonsmartphone productforselect');
print '</td>'; print '</td>';
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') { } elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
// Accounting account buy intra (In EEC) // Accounting account buy intra (In EEC)
@ -620,7 +620,7 @@ if ($result)
$codesell = length_accountg($obj->accountancy_code_buy_intra); $codesell = length_accountg($obj->accountancy_code_buy_intra);
//var_dump($defaultvalue.' - '.$codesell.' - '.$compta_prodsell); //var_dump($defaultvalue.' - '.$codesell.' - '.$compta_prodsell);
if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1); print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1, 0, 'maxwidth300 maxwidthonsmartphone productforselect');
print '</td>'; print '</td>';
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') { } elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
// Accounting account buy export (Out of EEC) // Accounting account buy export (Out of EEC)
@ -630,7 +630,7 @@ if ($result)
$codesell = length_accountg($obj->accountancy_code_buy_export); $codesell = length_accountg($obj->accountancy_code_buy_export);
//var_dump($defaultvalue.' - '.$codesell.' - '.$compta_prodsell); //var_dump($defaultvalue.' - '.$codesell.' - '.$compta_prodsell);
if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1); print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1, 0, 'maxwidth300 maxwidthonsmartphone productforselect');
print '</td>'; print '</td>';
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL') { } elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
// Accounting account sell // Accounting account sell
@ -640,7 +640,7 @@ if ($result)
$codesell = length_accountg($obj->accountancy_code_sell); $codesell = length_accountg($obj->accountancy_code_sell);
//var_dump($defaultvalue.' - '.$codesell.' - '.$compta_prodsell); //var_dump($defaultvalue.' - '.$codesell.' - '.$compta_prodsell);
if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1); print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1, 0, 'maxwidth300 maxwidthonsmartphone productforselect');
print '</td>'; print '</td>';
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') { } elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
// Accounting account sell intra (In EEC) // Accounting account sell intra (In EEC)
@ -650,7 +650,7 @@ if ($result)
$codesell = length_accountg($obj->accountancy_code_sell_intra); $codesell = length_accountg($obj->accountancy_code_sell_intra);
//var_dump($defaultvalue.' - '.$codesell.' - '.$compta_prodsell); //var_dump($defaultvalue.' - '.$codesell.' - '.$compta_prodsell);
if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1); print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1, 0, 'maxwidth300 maxwidthonsmartphone productforselect');
print '</td>'; print '</td>';
} else { } else {
// Accounting account sell export (Out of EEC) // Accounting account sell export (Out of EEC)
@ -659,13 +659,13 @@ if ($result)
if (empty($defaultvalue)) $defaultvalue = $compta_prodsell; if (empty($defaultvalue)) $defaultvalue = $compta_prodsell;
$codesell = length_accountg($obj->accountancy_code_sell_export); $codesell = length_accountg($obj->accountancy_code_sell_export);
if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1); print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1, 0, 'maxwidth300 maxwidthonsmartphone productforselect');
print '</td>'; print '</td>';
} }
// Checkbox select // Checkbox select
print '<td class="center">'; print '<td class="center">';
print '<input type="checkbox" class="checkforselect" name="chk_prod[]" value="'.$obj->rowid.'"/></td>'; print '<input type="checkbox" class="checkforselect productforselectcodeventil_'.$product_static->id.'" name="chk_prod[]" value="'.$obj->rowid.'"/></td>';
print "</tr>"; print "</tr>";
$i++; $i++;
} }
@ -689,7 +689,17 @@ if ($result)
if (atleastoneselected) jQuery("#changeaccount").attr(\'class\',\'button\'); if (atleastoneselected) jQuery("#changeaccount").attr(\'class\',\'button\');
else jQuery("#changeaccount").attr(\'class\',\'button\'); else jQuery("#changeaccount").attr(\'class\',\'button\');
} }
jQuery(".checkforselect, #checkallactions").click(function() {
jQuery(".checkforselect").change(function() {
init_savebutton();
});
jQuery(".productforselect").change(function() {
console.log($(this).attr("id")+" "+$(this).val());
if ($(this).val() && $(this).val() != -1) {
$(".productforselect"+$(this).attr("id")).prop(\'checked\', true);
} else {
$(".productforselect"+$(this).attr("id")).prop(\'checked\', false);
}
init_savebutton(); init_savebutton();
}); });

View File

@ -105,7 +105,7 @@ $title = $langs->trans('ChartOfIndividualAccountsOfSubsidiaryLedger');
llxHeader('', $title); llxHeader('', $title);
// Customer // Customer
$sql = "SELECT sa.rowid, sa.nom as label, sa.code_compta as subaccount, '0' as type, sa.entity"; $sql = "SELECT sa.rowid, sa.nom as label, sa.code_compta as subaccount, '1' as type, sa.entity";
$sql .= " FROM ".MAIN_DB_PREFIX."societe sa"; $sql .= " FROM ".MAIN_DB_PREFIX."societe sa";
$sql .= " WHERE sa.entity IN (".getEntity('societe').")"; $sql .= " WHERE sa.entity IN (".getEntity('societe').")";
$sql .= " AND sa.code_compta <> ''"; $sql .= " AND sa.code_compta <> ''";
@ -148,7 +148,7 @@ if (!empty($search_type) && $search_type >= 0) $sql .= " HAVING type LIKE '".$db
// Supplier // Supplier
$sql .= " UNION "; $sql .= " UNION ";
$sql .= " SELECT sa.rowid, sa.nom as label, sa.code_compta_fournisseur as subaccount, '1' as type, sa.entity FROM ".MAIN_DB_PREFIX."societe sa"; $sql .= " SELECT sa.rowid, sa.nom as label, sa.code_compta_fournisseur as subaccount, '2' as type, sa.entity FROM ".MAIN_DB_PREFIX."societe sa";
$sql .= " WHERE sa.entity IN (".getEntity('societe').")"; $sql .= " WHERE sa.entity IN (".getEntity('societe').")";
$sql .= " AND sa.code_compta_fournisseur <> ''"; $sql .= " AND sa.code_compta_fournisseur <> ''";
//print $sql; //print $sql;
@ -190,7 +190,7 @@ if (!empty($search_type) && $search_type >= 0) $sql .= " HAVING type LIKE '".$db
// User // User
$sql .= " UNION "; $sql .= " UNION ";
$sql .= " SELECT u.rowid, u.lastname as label, u.accountancy_code as subaccount, '2' as type, u.entity FROM ".MAIN_DB_PREFIX."user u"; $sql .= " SELECT u.rowid, u.lastname as label, u.accountancy_code as subaccount, '3' as type, u.entity FROM ".MAIN_DB_PREFIX."user u";
$sql .= " WHERE u.entity IN (".getEntity('user').")"; $sql .= " WHERE u.entity IN (".getEntity('user').")";
$sql .= " AND u.accountancy_code <> ''"; $sql .= " AND u.accountancy_code <> ''";
//print $sql; //print $sql;
@ -287,7 +287,7 @@ if ($resql)
print '<tr class="liste_titre_filter">'; print '<tr class="liste_titre_filter">';
if (!empty($arrayfields['subaccount']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_subaccount" value="'.$search_subaccount.'"></td>'; if (!empty($arrayfields['subaccount']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_subaccount" value="'.$search_subaccount.'"></td>';
if (!empty($arrayfields['label']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_label" value="'.$search_label.'"></td>'; if (!empty($arrayfields['label']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_label" value="'.$search_label.'"></td>';
if (!empty($arrayfields['type']['checked'])) print '<td class="liste_titre center">'.$form->selectarray('search_type', array('0'=>$langs->trans('Customer'), '1'=>$langs->trans('Supplier'), '2'=>$langs->trans('Employee')), $search_type, 1).'</td>'; if (!empty($arrayfields['type']['checked'])) print '<td class="liste_titre center">'.$form->selectarray('search_type', array('1'=>$langs->trans('Customer'), '2'=>$langs->trans('Supplier'), '3'=>$langs->trans('Employee')), $search_type, 1).'</td>';
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { if (!empty($arrayfields['reconcilable']['checked'])) print '<td class="liste_titre">&nbsp;</td>'; } if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { if (!empty($arrayfields['reconcilable']['checked'])) print '<td class="liste_titre">&nbsp;</td>'; }
print '<td class="liste_titre maxwidthsearch">'; print '<td class="liste_titre maxwidthsearch">';
$searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1); $searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1);
@ -335,17 +335,17 @@ if ($resql)
print '<td class="center">'; print '<td class="center">';
$s = ''; $s = '';
// Customer // Customer
if ($obj->type == 0) if ($obj->type == 1)
{ {
$s .= '<a class="customer-back" style="padding-left: 6px; padding-right: 6px" title="'.$langs->trans("Customer").'" href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->rowid.'">'.$langs->trans("Customer").'</a>'; $s .= '<a class="customer-back" style="padding-left: 6px; padding-right: 6px" title="'.$langs->trans("Customer").'" href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->rowid.'">'.$langs->trans("Customer").'</a>';
} }
// Supplier // Supplier
elseif ($obj->type == 1) elseif ($obj->type == 2)
{ {
$s .= '<a class="vendor-back" style="padding-left: 6px; padding-right: 6px" title="'.$langs->trans("Supplier").'" href="'.DOL_URL_ROOT.'/fourn/card.php?socid='.$obj->rowid.'">'.$langs->trans("Supplier").'</a>'; $s .= '<a class="vendor-back" style="padding-left: 6px; padding-right: 6px" title="'.$langs->trans("Supplier").'" href="'.DOL_URL_ROOT.'/fourn/card.php?socid='.$obj->rowid.'">'.$langs->trans("Supplier").'</a>';
} }
// User // User
elseif ($obj->type == 2) elseif ($obj->type == 3)
{ {
$s .= '<a class="user-back" style="padding-left: 6px; padding-right: 6px" title="'.$langs->trans("Employee").'" href="'.DOL_URL_ROOT.'/user/card.php?id='.$obj->id.'">'.$langs->trans("Employee").'</a>'; $s .= '<a class="user-back" style="padding-left: 6px; padding-right: 6px" title="'.$langs->trans("Employee").'" href="'.DOL_URL_ROOT.'/user/card.php?id='.$obj->id.'">'.$langs->trans("Employee").'</a>';
} }
@ -378,17 +378,17 @@ if ($resql)
print '<td class="center">'; print '<td class="center">';
$e = ''; $e = '';
// Customer // Customer
if ($obj->type == 0) if ($obj->type == 1)
{ {
$e .= '<a class="editfielda" title="'.$langs->trans("Customer").'" href="'.DOL_URL_ROOT.'/societe/card.php?action=edit&socid='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_edit().'</a>'; $e .= '<a class="editfielda" title="'.$langs->trans("Customer").'" href="'.DOL_URL_ROOT.'/societe/card.php?action=edit&socid='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_edit().'</a>';
} }
// Supplier // Supplier
elseif ($obj->type == 1) elseif ($obj->type == 2)
{ {
$e .= '<a class="editfielda" title="'.$langs->trans("Supplier").'" href="'.DOL_URL_ROOT.'/societe/card.php?action=edit&socid='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_edit().'</a>'; $e .= '<a class="editfielda" title="'.$langs->trans("Supplier").'" href="'.DOL_URL_ROOT.'/societe/card.php?action=edit&socid='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_edit().'</a>';
} }
// User // User
elseif ($obj->type == 2) elseif ($obj->type == 3)
{ {
$e .= '<a class="editfielda" title="'.$langs->trans("Employee").'" href="'.DOL_URL_ROOT.'/user/card.php?action=edit&id='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_edit().'</a>'; $e .= '<a class="editfielda" title="'.$langs->trans("Employee").'" href="'.DOL_URL_ROOT.'/user/card.php?action=edit&id='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_edit().'</a>';
} }

View File

@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("accountancy")); $langs->loadLangs(array("accountancy", "compta"));
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int')); $search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int'));
@ -376,18 +376,17 @@ print '<input type="hidden" name="formfilteraction" id="formfilteraction" value=
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param); $newcardbutton .= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param);
$newcardbutton .= dolGetButtonTitle($langs->trans('VueByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param, '', 1, array('morecss'=>'marginleftonly btnTitleSelected')); $newcardbutton .= dolGetButtonTitle($langs->trans('VueByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param, '', 1, array('morecss'=>'marginleftonly btnTitleSelected'));
$newcardbutton .= ' &nbsp; '; $newcardbutton .= ' &nbsp; ';
$newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', './card.php?action=create'); $newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?action=create');
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy', 0, $viewflat.$newcardbutton, '', $limit, 0, 0, 1); print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1);
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields

View File

@ -0,0 +1,766 @@
<?php
/* Copyright (C) 2016 Neil Orley <neil.orley@oeris.fr>
* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018 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
* 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 htdocs/accountancy/bookkeeping/listbysubaccount.php
* \ingroup Accountancy (Double entries)
* \brief List operation of ledger ordered by subaccount number
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("accountancy", "compta"));
$action = GETPOST('action', 'aZ09');
$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int'));
$search_date_end = dol_mktime(0, 0, 0, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int'));
$search_doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int'));
$search_accountancy_code = GETPOST("search_accountancy_code");
$search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha');
if ($search_accountancy_code_start == - 1) {
$search_accountancy_code_start = '';
}
$search_accountancy_code_end = GETPOST('search_accountancy_code_end', 'alpha');
if ($search_accountancy_code_end == - 1) {
$search_accountancy_code_end = '';
}
$search_doc_ref = GETPOST('search_doc_ref', 'alpha');
$search_label_operation = GETPOST('search_label_operation', 'alpha');
$search_mvt_num = GETPOST('search_mvt_num', 'int');
$search_direction = GETPOST('search_direction', 'alpha');
$search_ledger_code = GETPOST('search_ledger_code', 'alpha');
$search_debit = GETPOST('search_debit', 'alpha');
$search_credit = GETPOST('search_credit', 'alpha');
$search_lettering_code = GETPOST('search_lettering_code', 'alpha');
$search_not_reconciled = GETPOST('search_reconciled_option', 'alpha');
if (GETPOST("button_delmvt_x") || GETPOST("button_delmvt.x") || GETPOST("button_delmvt")) {
$action = 'delbookkeepingyear';
}
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page < 0) { $page = 0; }
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if ($sortorder == "") $sortorder = "ASC";
if ($sortfield == "") $sortfield = "t.doc_date,t.rowid";
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$object = new BookKeeping($db);
$formfile = new FormFile($db);
$hookmanager->initHooks(array('bookkeepingbysubaccountlist'));
$formaccounting = new FormAccounting($db);
$form = new Form($db);
if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET('search_date_startday') && !GETPOSTISSET('search_date_startmonth') && !GETPOSTISSET('search_date_starthour')) {
$sql = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear ";
$sql .= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."'";
$sql .= $db->plimit(1);
$res = $db->query($sql);
if ($res->num_rows > 0) {
$fiscalYear = $db->fetch_object($res);
$search_date_start = strtotime($fiscalYear->date_start);
$search_date_end = strtotime($fiscalYear->date_end);
} else {
$month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
$year_start = dol_print_date(dol_now(), '%Y');
if (dol_print_date(dol_now(), '%m') < $month_start) $year_start--; // If current month is lower that starting fiscal month, we start last year
$year_end = $year_start + 1;
$month_end = $month_start - 1;
if ($month_end < 1)
{
$month_end = 12;
$year_end--;
}
$search_date_start = dol_mktime(0, 0, 0, $month_start, 1, $year_start);
$search_date_end = dol_get_last_day($year_end, $month_end);
}
}
$arrayfields = array(
// 't.subledger_account'=>array('label'=>$langs->trans("SubledgerAccount"), 'checked'=>1),
't.code_journal'=>array('label'=>$langs->trans("Codejournal"), 'checked'=>1),
't.piece_num'=>array('label'=>$langs->trans("TransactionNumShort"), 'checked'=>1),
't.doc_date'=>array('label'=>$langs->trans("Docdate"), 'checked'=>1),
't.doc_ref'=>array('label'=>$langs->trans("Piece"), 'checked'=>1),
't.label_operation'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
't.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1),
't.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1),
't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1),
);
if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) unset($arrayfields['t.lettering_code']);
/*
* Action
*/
if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; }
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; }
$parameters = array('socid'=>$socid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook))
{
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
{
$search_doc_date = '';
$search_accountancy_code = '';
$search_accountancy_code_start = '';
$search_accountancy_code_end = '';
$search_label_account = '';
$search_doc_ref = '';
$search_label_operation = '';
$search_mvt_num = '';
$search_direction = '';
$search_ledger_code = '';
$search_date_start = '';
$search_date_end = '';
$search_date_startyear = '';
$search_date_startmonth = '';
$search_date_startday = '';
$search_date_endyear = '';
$search_date_endmonth = '';
$search_date_endday = '';
$search_debit = '';
$search_credit = '';
$search_lettering_code = '';
$search_not_reconciled = '';
}
// Must be after the remove filter action, before the export.
$param = '';
$filter = array();
if (!empty($search_date_start)) {
$filter['t.doc_date>='] = $search_date_start;
$param .= '&search_date_startmonth='.GETPOST('search_date_startmonth', 'int').'&search_date_startday='.GETPOST('search_date_startday', 'int').'&search_date_startyear='.GETPOST('search_date_startyear', 'int');
}
if (!empty($search_date_end)) {
$filter['t.doc_date<='] = $search_date_end;
$param .= '&search_date_endmonth='.GETPOST('search_date_endmonth', 'int').'&search_date_endday='.GETPOST('search_date_endday', 'int').'&search_date_endyear='.GETPOST('search_date_endyear', 'int');
}
if (!empty($search_doc_date)) {
$filter['t.doc_date'] = $search_doc_date;
$param .= '&doc_datemonth='.GETPOST('doc_datemonth', 'int').'&doc_dateday='.GETPOST('doc_dateday', 'int').'&doc_dateyear='.GETPOST('doc_dateyear', 'int');
}
if (!empty($search_accountancy_code_start)) {
$filter['t.subledger_account>='] = $search_accountancy_code_start;
$param .= '&search_accountancy_code_start='.urlencode($search_accountancy_code_start);
}
if (!empty($search_accountancy_code_end)) {
$filter['t.subledger_account<='] = $search_accountancy_code_end;
$param .= '&search_accountancy_code_end='.urlencode($search_accountancy_code_end);
}
if (!empty($search_label_account)) {
$filter['t.label_compte'] = $search_label_account;
$param .= '&search_label_compte='.urlencode($search_label_account);
}
if (!empty($search_mvt_num)) {
$filter['t.piece_num'] = $search_mvt_num;
$param .= '&search_mvt_num='.urlencode($search_mvt_num);
}
if (!empty($search_doc_ref)) {
$filter['t.doc_ref'] = $search_doc_ref;
$param .= '&search_doc_ref='.urlencode($search_doc_ref);
}
if (!empty($search_label_operation)) {
$filter['t.label_operation'] = $search_label_operation;
$param .= '&search_label_operation='.urlencode($search_label_operation);
}
if (!empty($search_direction)) {
$filter['t.sens'] = $search_direction;
$param .= '&search_direction='.urlencode($search_direction);
}
if (!empty($search_ledger_code)) {
$filter['t.code_journal'] = $search_ledger_code;
$param .= '&search_ledger_code='.urlencode($search_ledger_code);
}
if (!empty($search_debit)) {
$filter['t.debit'] = $search_debit;
$param .= '&search_debit='.urlencode($search_debit);
}
if (!empty($search_credit)) {
$filter['t.credit'] = $search_credit;
$param .= '&search_credit='.urlencode($search_credit);
}
if (!empty($search_lettering_code)) {
$filter['t.lettering_code'] = $search_lettering_code;
$param .= '&search_lettering_code='.urlencode($search_lettering_code);
}
if (!empty($search_not_reconciled)) {
$filter['t.reconciled_option'] = $search_not_reconciled;
$param .= '&search_not_reconciled='.urlencode($search_not_reconciled);
}
}
if ($action == 'delbookkeeping' && $user->rights->accounting->mouvements->supprimer) {
$import_key = GETPOST('importkey', 'alpha');
if (!empty($import_key)) {
$result = $object->deleteByImportkey($import_key);
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
// Make a redirect to avoid to launch the delete later after a back button
header("Location: listbyaccount.php".($param ? '?'.$param : ''));
exit;
}
}
if ($action == 'delbookkeepingyearconfirm' && $user->rights->accounting->mouvements->supprimer_tous) {
$delmonth = GETPOST('delmonth', 'int');
$delyear = GETPOST('delyear', 'int');
if ($delyear == -1) {
$delyear = 0;
}
$deljournal = GETPOST('deljournal', 'alpha');
if ($deljournal == -1) {
$deljournal = 0;
}
if (!empty($delmonth) || !empty($delyear) || !empty($deljournal))
{
$result = $object->deleteByYearAndJournal($delyear, $deljournal, '', ($delmonth > 0 ? $delmonth : 0));
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
} else {
setEventMessages("RecordDeleted", null, 'mesgs');
}
// Make a redirect to avoid to launch the delete later after a back button
header("Location: listbysubaccount.php".($param ? '?'.$param : ''));
exit;
} else {
setEventMessages("NoRecordDeleted", null, 'warnings');
}
}
if ($action == 'delmouvconfirm' && $user->rights->accounting->mouvements->supprimer) {
$mvt_num = GETPOST('mvt_num', 'int');
if (!empty($mvt_num)) {
$result = $object->deleteMvtNum($mvt_num);
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
} else {
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
}
header("Location: listbysubaccount.php?noreset=1".($param ? '&'.$param : ''));
exit;
}
}
/*
* View
*/
$formaccounting = new FormAccounting($db);
$formfile = new FormFile($db);
$formother = new FormOther($db);
$form = new Form($db);
$title_page = $langs->trans("Operations").' - '.$langs->trans("VueByAccountAccounting").' ('.$langs->trans("BookkeepingSubAccount").')';
llxHeader('', $title_page);
// List
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$nbtotalofrecords = $object->fetchAllByAccount($sortorder, $sortfield, 0, 0, $filter, 'AND', 1);
if ($nbtotalofrecords < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
}
$result = $object->fetchAllByAccount($sortorder, $sortfield, $limit, $offset, $filter, 'AND', 1);
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
$num = count($object->lines);
if ($action == 'delmouv') {
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?mvt_num='.GETPOST('mvt_num'), $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvtPartial'), 'delmouvconfirm', '', 0, 1);
print $formconfirm;
}
if ($action == 'delbookkeepingyear') {
$form_question = array();
$delyear = GETPOST('delyear', 'int');
$deljournal = GETPOST('deljournal', 'alpha');
if (empty($delyear)) {
$delyear = dol_print_date(dol_now(), '%Y');
}
$month_array = array();
for ($i = 1; $i <= 12; $i++) {
$month_array[$i] = $langs->trans("Month".sprintf("%02d", $i));
}
$year_array = $formaccounting->selectyear_accountancy_bookkepping($delyear, 'delyear', 0, 'array');
$journal_array = $formaccounting->select_journal($deljournal, 'deljournal', '', 1, 1, 1, '', 0, 1);
$form_question['delmonth'] = array(
'name' => 'delmonth',
'type' => 'select',
'label' => $langs->trans('DelMonth'),
'values' => $month_array,
'default' => ''
);
$form_question['delyear'] = array(
'name' => 'delyear',
'type' => 'select',
'label' => $langs->trans('DelYear'),
'values' => $year_array,
'default' => $delyear
);
$form_question['deljournal'] = array(
'name' => 'deljournal',
'type' => 'other', // We don't use select here, the journal_array is already a select html component
'label' => $langs->trans('DelJournal'),
'value' => $journal_array,
'default' => $deljournal
);
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt', $langs->transnoentitiesnoconv("RegistrationInAccounting")), 'delbookkeepingyearconfirm', $form_question, '', 1, 300);
print $formconfirm;
}
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="list">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
$newcardbutton = dolGetButtonTitle($langs->trans('ViewAccountList'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php', '', 1, array('morecss'=>'marginleftonly btnTitleSelected'));
$newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?action=create');
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit);
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
if ($massactionbutton) $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
// Reverse sort order
if (preg_match('/^asc/i', $sortorder)) $sortorder = "asc";
else $sortorder = "desc";
$moreforfilter = '';
// Accountancy account
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('AccountAccounting').': ';
$moreforfilter .= '<div class="nowrap inline-block">';
$moreforfilter .= $langs->trans('From').' ';
$moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_start, 'search_accountancy_code_start', 1, 'maxwidth200');
$moreforfilter .= ' '.$langs->trans('to').' ';
$moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_end, 'search_accountancy_code_end', 1, 'maxwidth200');
$moreforfilter .= '</div>';
$moreforfilter .= '</div>';
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
else $moreforfilter = $hookmanager->resPrint;
print '<div class="liste_titre liste_titre_bydiv centpercent">';
print $moreforfilter;
print '</div>';
print '<div class="div-table-responsive">';
print '<table class="tagtable liste centpercent">';
// Filters lines
print '<tr class="liste_titre_filter">';
// Code journal
if (!empty($arrayfields['t.code_journal']['checked'])) {
print '<td class="liste_titre center"><input type="text" name="search_ledger_code" size="3" value="'.dol_escape_htmltag($search_ledger_code).'"></td>';
}
// Date document
if (!empty($arrayfields['t.doc_date']['checked'])) {
print '<td class="liste_titre center">';
print '<div class="nowrap">';
print $form->selectDate($search_date_start, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
print '</div>';
print '<div class="nowrap">';
print $form->selectDate($search_date_end, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
print '</div>';
print '</td>';
}
// Movement number
if (!empty($arrayfields['t.piece_num']['checked']))
{
print '<td class="liste_titre"><input type="text" name="search_mvt_num" size="6" value="'.dol_escape_htmltag($search_mvt_num).'"></td>';
}
// Ref document
if (!empty($arrayfields['t.doc_ref']['checked'])) {
print '<td class="liste_titre"><input type="text" size="7" class="flat" name="search_doc_ref" value="'.dol_escape_htmltag($search_doc_ref).'"/></td>';
}
// Label operation
if (!empty($arrayfields['t.label_operation']['checked'])) {
print '<td class="liste_titre"><input type="text" size="7" class="flat" name="search_label_operation" value="'.dol_escape_htmltag($search_label_operation).'"/></td>';
}
// Debit
if (!empty($arrayfields['t.debit']['checked'])) {
print '<td class="liste_titre right"><input type="text" class="flat" name="search_debit" size="4" value="'.dol_escape_htmltag($search_debit).'"></td>';
}
// Credit
if (!empty($arrayfields['t.credit']['checked'])) {
print '<td class="liste_titre right"><input type="text" class="flat" name="search_credit" size="4" value="'.dol_escape_htmltag($search_credit).'"></td>';
}
// Lettering code
if (!empty($arrayfields['t.lettering_code']['checked']))
{
print '<td class="liste_titre center">';
print '<input type="text" size="3" class="flat" name="search_lettering_code" value="'.$search_lettering_code.'"/>';
print '<br><span class="nowrap"><input type="checkbox" name="search_reconciled_option" value="notreconciled"'.($search_not_reconciled == 'notreconciled' ? ' checked' : '').'>'.$langs->trans("NotReconciled").'</span>';
print '</td>';
}
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields);
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
print '<td class="liste_titre center">';
$searchpicto = $form->showFilterButtons();
print $searchpicto;
print '</td>';
print "</tr>\n";
print '<tr class="liste_titre">';
if (!empty($arrayfields['t.code_journal']['checked'])) print_liste_field_titre($arrayfields['t.code_journal']['label'], $_SERVER['PHP_SELF'], "t.code_journal", "", $param, '', $sortfield, $sortorder, 'center ');
if (!empty($arrayfields['t.doc_date']['checked'])) print_liste_field_titre($arrayfields['t.doc_date']['label'], $_SERVER['PHP_SELF'], "t.doc_date", "", $param, '', $sortfield, $sortorder, 'center ');
if (!empty($arrayfields['t.piece_num']['checked'])) print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['t.doc_ref']['checked'])) print_liste_field_titre($arrayfields['t.doc_ref']['label'], $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder);
if (!empty($arrayfields['t.label_operation']['checked'])) print_liste_field_titre($arrayfields['t.label_operation']['label'], $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder);
if (!empty($arrayfields['t.debit']['checked'])) print_liste_field_titre($arrayfields['t.debit']['label'], $_SERVER['PHP_SELF'], "t.debit", "", $param, '', $sortfield, $sortorder, 'right ');
if (!empty($arrayfields['t.credit']['checked'])) print_liste_field_titre($arrayfields['t.credit']['label'], $_SERVER['PHP_SELF'], "t.credit", "", $param, '', $sortfield, $sortorder, 'right ');
if (!empty($arrayfields['t.lettering_code']['checked'])) print_liste_field_titre($arrayfields['t.lettering_code']['label'], $_SERVER['PHP_SELF'], "t.lettering_code", "", $param, '', $sortfield, $sortorder, 'center ');
// Hook fields
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $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 ');
print "</tr>\n";
$total_debit = 0;
$total_credit = 0;
$sous_total_debit = 0;
$sous_total_credit = 0;
$displayed_account_number = null; // Start with undefined to be able to distinguish with empty
// Loop on record
// --------------------------------------------------------------------
$i = 0;
$totalarray = array();
while ($i < min($num, $limit))
{
$line = $object->lines[$i];
$total_debit += $line->debit;
$total_credit += $line->credit;
$accountg = length_accounta($line->subledger_account);
//if (empty($accountg)) $accountg = '-';
// Is it a break ?
if ($accountg != $displayed_account_number || !isset($displayed_account_number)) {
$colspan = $totalarray['nbfield'] - 3;
$colspanend = $totalarray['nbfield'] - 7;
// Show a subtotal by accounting account
if (isset($displayed_account_number)) {
print '<tr class="liste_total">';
print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("TotalForAccount").' '.length_accounta($displayed_account_number).':</td>';
print '<td class="nowrap right">'.price($sous_total_debit).'</td>';
print '<td class="nowrap right">'.price($sous_total_credit).'</td>';
print '<td colspan="'.$colspanend.'"></td>';
print '</tr>';
// Show balance of last shown account
$balance = $sous_total_debit - $sous_total_credit;
print '<tr class="liste_total">';
print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("Balance").':</td>';
if ($balance > 0)
{
print '<td class="nowraponall right">';
print price($sous_total_debit - $sous_total_credit);
print '</td>';
print '<td></td>';
} else {
print '<td></td>';
print '<td class="nowraponall right">';
print price($sous_total_credit - $sous_total_debit);
print '</td>';
}
print '<td colspan="'.$colspanend.'"></td>';
print '</tr>';
}
// Show the break account
print "<tr>";
print '<td colspan="'.($totalarray['nbfield'] ? $totalarray['nbfield'] : 9).'" style="font-weight:bold; border-bottom: 1pt solid black;">';
if ($line->subledger_account != "" && $line->subledger_account != '-1') print length_accounta($line->subledger_account).' : '.$object->get_compte_desc($line->numero_compte);
else print '<span class="error">'.$langs->trans("Unknown").'</span>';
print '</td>';
print '</tr>';
$displayed_account_number = $accountg;
//if (empty($displayed_account_number)) $displayed_account_number='-';
$sous_total_debit = 0;
$sous_total_credit = 0;
$colspan = 0;
}
print '<tr class="oddeven">';
// Journal code
if (!empty($arrayfields['t.code_journal']['checked']))
{
$accountingjournal = new AccountingJournal($db);
$result = $accountingjournal->fetch('', $line->code_journal);
$journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $line->code_journal);
print '<td class="center">'.$journaltoshow.'</td>';
if (!$i) $totalarray['nbfield']++;
}
// Document date
if (!empty($arrayfields['t.doc_date']['checked']))
{
print '<td class="center">'.dol_print_date($line->doc_date, 'day').'</td>';
if (!$i) $totalarray['nbfield']++;
}
// Piece number
if (!empty($arrayfields['t.piece_num']['checked']))
{
print '<td>';
$object->id = $line->id;
$object->piece_num = $line->piece_num;
print $object->getNomUrl(1, '', 0, '', 1);
print '</td>';
if (!$i) $totalarray['nbfield']++;
}
// Document ref
if (!empty($arrayfields['t.doc_ref']['checked']))
{
if ($line->doc_type == 'customer_invoice')
{
$langs->loadLangs(array('bills'));
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$objectstatic = new Facture($db);
$objectstatic->fetch($line->fk_doc);
//$modulepart = 'facture';
$filename = dol_sanitizeFileName($line->doc_ref);
$filedir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($line->doc_ref);
$urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id;
$documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
} elseif ($line->doc_type == 'supplier_invoice')
{
$langs->loadLangs(array('bills'));
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
$objectstatic = new FactureFournisseur($db);
$objectstatic->fetch($line->fk_doc);
//$modulepart = 'invoice_supplier';
$filename = dol_sanitizeFileName($line->doc_ref);
$filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($line->fk_doc, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref);
$subdir = get_exdir($objectstatic->id, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref);
$documentlink = $formfile->getDocumentsLink($objectstatic->element, $subdir, $filedir);
} elseif ($line->doc_type == 'expense_report')
{
$langs->loadLangs(array('trips'));
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
$objectstatic = new ExpenseReport($db);
$objectstatic->fetch($line->fk_doc);
//$modulepart = 'expensereport';
$filename = dol_sanitizeFileName($line->doc_ref);
$filedir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($line->doc_ref);
$urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id;
$documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
} else {
// Other type
}
print '<td class="nowrap">';
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
// Picto + Ref
print '<td class="nobordernopadding nowrap">';
if ($line->doc_type == 'customer_invoice' || $line->doc_type == 'supplier_invoice' || $line->doc_type == 'expense_report')
{
print $objectstatic->getNomUrl(1, '', 0, 0, '', 0, -1, 1);
print $documentlink;
} else {
print $line->doc_ref;
}
print '</td></tr></table>';
print "</td>\n";
if (!$i) $totalarray['nbfield']++;
}
// Label operation
if (!empty($arrayfields['t.label_operation']['checked'])) {
// Affiche un lien vers la facture client/fournisseur
$doc_ref = preg_replace('/\(.*\)/', '', $line->doc_ref);
print strlen(length_accounta($line->subledger_account)) == 0 ? '<td>'.$line->label_operation.'</td>' : '<td>'.$line->label_operation.'<br><span style="font-size:0.8em">('.length_accounta($line->subledger_account).')</span></td>';
if (!$i) $totalarray['nbfield']++;
}
// Amount debit
if (!empty($arrayfields['t.debit']['checked']))
{
print '<td class="nowrap right">'.($line->debit ? price($line->debit) : '').'</td>';
if (!$i) $totalarray['nbfield']++;
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'totaldebit';
$totalarray['val']['totaldebit'] += $line->debit;
}
// Amount credit
if (!empty($arrayfields['t.credit']['checked'])) {
print '<td class="nowrap right">'.($line->credit ? price($line->credit) : '').'</td>';
if (!$i) $totalarray['nbfield']++;
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'totalcredit';
$totalarray['val']['totalcredit'] += $line->credit;
}
// Lettering code
if (!empty($arrayfields['t.lettering_code']['checked']))
{
print '<td class="center">'.$line->lettering_code.'</td>';
if (!$i) $totalarray['nbfield']++;
}
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
print '<td class="nowraponall center">';
if (empty($line->date_export)) {
if ($user->rights->accounting->mouvements->creer) {
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num='.$line->piece_num.$param.'&page='.$page.($sortfield ? '&sortfield='.$sortfield : '').($sortorder ? '&sortorder='.$sortorder : '').'">'.img_edit().'</a>';
}
if ($user->rights->accounting->mouvements->supprimer) {
print ' &nbsp; <a class="paddingleft" href="'.$_SERVER['PHP_SELF'].'?action=delmouv&mvt_num='.$line->piece_num.$param.'&page='.$page.($sortfield ? '&sortfield='.$sortfield : '').($sortorder ? '&sortorder='.$sortorder : '').'">'.img_delete().'</a>';
}
}
print '</td>';
if (!$i) $totalarray['nbfield']++;
// Comptabilise le sous-total
$sous_total_debit += $line->debit;
$sous_total_credit += $line->credit;
print "</tr>\n";
$i++;
}
// Show sub-total of last shown account
$colspan = $totalarray['nbfield'] - 3;
$colspanend = $totalarray['nbfield'] - 8;
print '<tr class="liste_total">';
print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("TotalForAccount").' '.$accountg.':</td>';
print '<td class="nowrap right">'.price($sous_total_debit).'</td>';
print '<td class="nowrap right">'.price($sous_total_credit).'</td>';
print '<td colspan="'.$colspanend.'"></td>';
print '</tr>';
// Show balance of last shown account
$balance = $sous_total_debit - $sous_total_credit;
print '<tr class="liste_total">';
print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("Balance").':</td>';
if ($balance > 0)
{
print '<td class="nowraponall right">';
print price($sous_total_debit - $sous_total_credit);
print '</td>';
print '<td></td>';
} else {
print '<td></td>';
print '<td class="nowraponall right">';
print price($sous_total_credit - $sous_total_debit);
print '</td>';
}
print '<td colspan="'.$colspanend.'"></td>';
print '</tr>';
// Show total line
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
print "</table>";
print '</div>';
// TODO Replace this with mass delete action
if ($user->rights->accounting->mouvements->supprimer_tous) {
print '<div class="tabsAction tabsActionNoBottom">'."\n";
print '<a class="butActionDelete" name="button_delmvt" href="'.$_SERVER["PHP_SELF"].'?action=delbookkeepingyear'.($param ? '&'.$param : '').'">'.$langs->trans("DeleteMvt").'</a>';
print '</div>';
}
print '</form>';
// End of page
llxFooter();
$db->close();

View File

@ -4,7 +4,7 @@
* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com> * Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2019 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2013-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -41,7 +41,7 @@ $massaction = GETPOST('massaction', 'alpha');
$show_files = GETPOST('show_files', 'int'); $show_files = GETPOST('show_files', 'int');
$confirm = GETPOST('confirm', 'alpha'); $confirm = GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array'); $toselect = GETPOST('toselect', 'array');
$socid = GETPOST('socid', 'int') ?GETPOST('socid', 'int') : GETPOST('id', 'int'); $socid = GETPOST('socid', 'int') ? ((int) GETPOST('socid', 'int')) : ((int) GETPOST('id', 'int'));
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST("sortfield", 'alpha');

View File

@ -386,6 +386,7 @@ class AccountancyExport
foreach ($objectLines as $line) { foreach ($objectLines as $line) {
$date = dol_print_date($line->doc_date, '%d/%m/%Y'); $date = dol_print_date($line->doc_date, '%d/%m/%Y');
print $date.$separator; print $date.$separator;
print $line->code_journal.$separator; print $line->code_journal.$separator;
print length_accountg($line->numero_compte).$separator; print length_accountg($line->numero_compte).$separator;
@ -394,7 +395,7 @@ class AccountancyExport
print price($line->debit).$separator; print price($line->debit).$separator;
print price($line->credit).$separator; print price($line->credit).$separator;
print 'E'.$separator; print 'E'.$separator;
print length_accountg($line->subledger_account).$separator; print length_accounta($line->subledger_account).$separator;
print $end_line; print $end_line;
} }
} }

View File

@ -768,10 +768,11 @@ class BookKeeping extends CommonObject
* @param int $offset offset limit * @param int $offset offset limit
* @param array $filter filter array * @param array $filter filter array
* @param string $filtermode filter mode (AND or OR) * @param string $filtermode filter mode (AND or OR)
* @param int $option option (0: general account or 1: subaccount)
* *
* @return int <0 if KO, >=0 if OK * @return int <0 if KO, >=0 if OK
*/ */
public function fetchAllByAccount($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') public function fetchAllByAccount($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND', $option = 0)
{ {
global $conf; global $conf;
@ -836,7 +837,13 @@ class BookKeeping extends CommonObject
$sql .= ' AND '.implode(' '.$filtermode.' ', $sqlwhere); $sql .= ' AND '.implode(' '.$filtermode.' ', $sqlwhere);
} }
// Affichage par compte comptable // Affichage par compte comptable
if (!empty($option)) {
$sql .= ' AND t.subledger_account IS NOT NULL';
$sql .= ' ORDER BY t.subledger_account ASC';
} else {
$sql .= ' ORDER BY t.numero_compte ASC'; $sql .= ' ORDER BY t.numero_compte ASC';
}
if (!empty($sortfield)) { if (!empty($sortfield)) {
$sql .= ', '.$sortfield.' '.$sortorder; $sql .= ', '.$sortfield.' '.$sortorder;
} }

View File

@ -357,12 +357,6 @@ if ($result) {
print '<span class="opacitymedium">'.$langs->trans("DescVentilTodoCustomer").'</span></br><br>'; print '<span class="opacitymedium">'.$langs->trans("DescVentilTodoCustomer").'</span></br><br>';
/*$topicmail="Information";
$modelmail="project";
$objecttmp=new Project($db);
$trackid='prj'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';*/
if ($msg) print $msg.'<br>'; if ($msg) print $msg.'<br>';
$moreforfilter = ''; $moreforfilter = '';

View File

@ -285,12 +285,6 @@ if ($result) {
print '<span class="opacitymedium">'.$langs->trans("DescVentilTodoExpenseReport").'</span></br><br>'; print '<span class="opacitymedium">'.$langs->trans("DescVentilTodoExpenseReport").'</span></br><br>';
/*$topicmail="Information";
$modelmail="project";
$objecttmp=new Project($db);
$trackid='prj'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';*/
if ($msg) print $msg.'<br>'; if ($msg) print $msg.'<br>';
$moreforfilter = ''; $moreforfilter = '';

View File

@ -854,7 +854,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
print '"'.$date.'"'.$sep; print '"'.$date.'"'.$sep;
print '"'.$val["type_payment"].'"'.$sep; print '"'.$val["type_payment"].'"'.$sep;
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep; print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep; print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
print " ".$sep; print " ".$sep;
print '"'.$reflabel.'"'.$sep; print '"'.$reflabel.'"'.$sep;
print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep; print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
@ -882,7 +882,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
print '"'.$key.'"'.$sep; print '"'.$key.'"'.$sep;
print '"'.$date.'"'.$sep; print '"'.$date.'"'.$sep;
print '"'.$val["type_payment"].'"'.$sep; print '"'.$val["type_payment"].'"'.$sep;
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep; print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
if ($tabtype[$key] == 'payment_supplier') { if ($tabtype[$key] == 'payment_supplier') {
print '"'.$conf->global->ACCOUNTING_ACCOUNT_SUPPLIER.'"'.$sep; print '"'.$conf->global->ACCOUNTING_ACCOUNT_SUPPLIER.'"'.$sep;
} elseif ($tabtype[$key] == 'payment') { } elseif ($tabtype[$key] == 'payment') {
@ -892,7 +892,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
} elseif ($tabtype[$key] == 'payment_salary') { } elseif ($tabtype[$key] == 'payment_salary') {
print '"'.$conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT.'"'.$sep; print '"'.$conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT.'"'.$sep;
} else { } else {
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep; print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
} }
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep; print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
print '"'.$reflabel.'"'.$sep; print '"'.$reflabel.'"'.$sep;
@ -915,7 +915,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
print '"'.$date.'"'.$sep; print '"'.$date.'"'.$sep;
print '"'.$val["type_payment"].'"'.$sep; print '"'.$val["type_payment"].'"'.$sep;
print '"'.length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE).'"'.$sep; print '"'.length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE).'"'.$sep;
print '"'.length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE).'"'.$sep; print '"'.length_accounta($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE).'"'.$sep;
print "".$sep; print "".$sep;
print '"'.$reflabel.'"'.$sep; print '"'.$reflabel.'"'.$sep;
print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep; print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
@ -1115,7 +1115,7 @@ if (empty($action) || $action == 'view') {
if ($tabtype[$key] == 'payment_vat') $account_ledger = $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT; if ($tabtype[$key] == 'payment_vat') $account_ledger = $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT;
if ($tabtype[$key] == 'member') $account_ledger = $conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT; if ($tabtype[$key] == 'member') $account_ledger = $conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT;
if ($tabtype[$key] == 'payment_various') $account_ledger = $tabpay[$key]["account_various"]; if ($tabtype[$key] == 'payment_various') $account_ledger = $tabpay[$key]["account_various"];
$accounttoshow = length_accounta($account_ledger); $accounttoshow = length_accountg($account_ledger);
if (empty($accounttoshow) || $accounttoshow == 'NotDefined') if (empty($accounttoshow) || $accounttoshow == 'NotDefined')
{ {
if ($tabtype[$key] == 'unknown') if ($tabtype[$key] == 'unknown')

View File

@ -669,7 +669,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep; print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep; print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
print '""'.$sep; print '""'.$sep;
print '"'.$langs->trans("VAT").' - '.$def_tva[$key].'"'.$sep; print '"'.$langs->trans("VAT").' - '.join(', ', $def_tva[$key][$k]).' %"'.$sep;
print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.$val["refsuppliersologest"].' - '.$langs->trans("VAT").join(', ', $def_tva[$key][$k]).' %'.($numtax ? ' - Localtax '.$numtax : '').'"'.$sep; print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.$val["refsuppliersologest"].' - '.$langs->trans("VAT").join(', ', $def_tva[$key][$k]).' %'.($numtax ? ' - Localtax '.$numtax : '').'"'.$sep;
print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep; print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep; print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;

View File

@ -628,7 +628,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
print '""' . $sep; print '""' . $sep;
print '"'.$langs->trans("VAT").' - '.$def_tva[$key].' %"'.$sep; print '"' . $langs->trans("VAT") . ' - ' . join(', ', $def_tva[$key][$k]) . ' %"' . $sep;
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT") . join(', ', $def_tva[$key][$k]) . ' %' . ($numtax ? ' - Localtax ' . $numtax : '') . '"' . $sep; print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT") . join(', ', $def_tva[$key][$k]) . ' %' . ($numtax ? ' - Localtax ' . $numtax : '') . '"' . $sep;
print '"' . ($mt < 0 ? price(-$mt) : '') . '"' . $sep; print '"' . ($mt < 0 ? price(-$mt) : '') . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep; print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;

View File

@ -358,12 +358,6 @@ if ($result) {
print '<span class="opacitymedium">'.$langs->trans("DescVentilTodoCustomer").'</span></br><br>'; print '<span class="opacitymedium">'.$langs->trans("DescVentilTodoCustomer").'</span></br><br>';
/*$topicmail="Information";
$modelmail="project";
$objecttmp=new Project($db);
$trackid='prj'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';*/
if ($msg) print $msg.'<br>'; if ($msg) print $msg.'<br>';
$moreforfilter = ''; $moreforfilter = '';

View File

@ -8,6 +8,7 @@
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 J. Fernando Lagrange <fernando@demo-tic.org> * Copyright (C) 2012 J. Fernando Lagrange <fernando@demo-tic.org>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2020 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -39,7 +40,12 @@ $langs->loadLangs(array("admin", "members"));
if (!$user->admin) accessforbidden(); if (!$user->admin) accessforbidden();
$type = array('yesno', 'texte', 'chaine'); $choices = array('yesno', 'texte', 'chaine');
$value = GETPOST('value', 'alpha');
$label = GETPOST('label', 'alpha');
$scandir = GETPOST('scandir', 'alpha');
$type = 'member';
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
@ -48,8 +54,50 @@ $action = GETPOST('action', 'aZ09');
* Actions * Actions
*/ */
// include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
if ($action == 'updateall') {
if ($action == 'set_default') {
$ret = addDocumentModel($value, $type, $label, $scandir);
$res = true;
} elseif ($action == 'del_default') {
$ret = delDocumentModel($value, $type);
if ($ret > 0) {
if ($conf->global->MEMBER_ADDON_PDF_ODT == "$value") {
dolibarr_del_const($db, 'MEMBER_ADDON_PDF_ODT', $conf->entity);
}
}
$res = true;
} elseif ($action == 'setdoc') {
// Set default model
if (dolibarr_set_const($db, "MEMBER_ADDON_PDF_ODT", $value, 'chaine', 0, '', $conf->entity)) {
// La constante qui a ete lue en avant du nouveau set
// on passe donc par une variable pour avoir un affichage coherent
$conf->global->MEMBER_ADDON_PDF_ODT = $value;
}
// On active le modele
$ret = delDocumentModel($value, $type);
if ($ret > 0) {
$ret = addDocumentModel($value, $type, $label, $scandir);
}
$res = true;
} elseif (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) {
$code = $reg[1];
if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0) {
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
} else {
dol_print_error($db);
}
} elseif (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) {
$code = $reg[1];
if (dolibarr_del_const($db, $code, $conf->entity) > 0) {
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
} else {
dol_print_error($db);
}
} elseif ($action == 'updateall') {
$db->begin(); $db->begin();
$res1 = $res2 = $res3 = $res4 = $res5 = $res6 = 0; $res1 = $res2 = $res3 = $res4 = $res5 = $res6 = 0;
$res1 = dolibarr_set_const($db, 'ADHERENT_LOGIN_NOT_REQUIRED', GETPOST('ADHERENT_LOGIN_NOT_REQUIRED', 'alpha') ? 0 : 1, 'chaine', 0, '', $conf->entity); $res1 = dolibarr_set_const($db, 'ADHERENT_LOGIN_NOT_REQUIRED', GETPOST('ADHERENT_LOGIN_NOT_REQUIRED', 'alpha') ? 0 : 1, 'chaine', 0, '', $conf->entity);
@ -86,7 +134,7 @@ if ($action == 'update' || $action == 'add') {
$consttype = GETPOST('consttype', 'alpha'); $consttype = GETPOST('consttype', 'alpha');
$constnote = GETPOST('constnote'); $constnote = GETPOST('constnote');
$res = dolibarr_set_const($db, $constname, $constvalue, $type[$consttype], 0, $constnote, $conf->entity); $res = dolibarr_set_const($db, $constname, $constvalue, $choices[$consttype], 0, $constnote, $conf->entity);
if (!$res > 0) $error++; if (!$res > 0) $error++;
@ -245,6 +293,137 @@ $helptext .= '__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL_
$helptext .= '__YEAR__, __MONTH__, __DAY__'; $helptext .= '__YEAR__, __MONTH__, __DAY__';
form_constantes($constantes, 0, $helptext); form_constantes($constantes, 0, $helptext);
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
// Defini tableau def des modeles
$def = array();
$sql = "SELECT nom";
$sql .= " FROM ".MAIN_DB_PREFIX."document_model";
$sql .= " WHERE type = '".$db->escape($type)."'";
$sql .= " AND entity = ".$conf->entity;
$resql = $db->query($sql);
if ($resql) {
$i = 0;
$num_rows = $db->num_rows($resql);
while ($i < $num_rows) {
$array = $db->fetch_array($resql);
array_push($def, $array[0]);
$i++;
}
} else {
dol_print_error($db);
}
print load_fiche_titre($langs->trans("MembersDocModules"), '', '');
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Description").'</td>';
print '<td align="center" width="60">'.$langs->trans("Status")."</td>\n";
print '<td align="center" width="60">'.$langs->trans("Default")."</td>\n";
print '<td align="center" width="80">'.$langs->trans("ShortInfo").'</td>';
print '<td align="center" width="80">'.$langs->trans("Preview").'</td>';
print "</tr>\n";
clearstatcache();
foreach ($dirmodels as $reldir) {
foreach (array('', '/doc') as $valdir) {
$dir = dol_buildpath($reldir."core/modules/member".$valdir);
if (is_dir($dir)) {
$handle = opendir($dir);
if (is_resource($handle)) {
while (($file = readdir($handle)) !== false) {
$filelist[] = $file;
}
closedir($handle);
arsort($filelist);
foreach ($filelist as $file) {
if (preg_match('/\.class\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
if (file_exists($dir.'/'.$file)) {
$name = substr($file, 4, dol_strlen($file) - 14);
$classname = substr($file, 0, dol_strlen($file) - 10);
require_once $dir.'/'.$file;
$module = new $classname($db);
$modulequalified = 1;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
$modulequalified = 0;
}
if ($modulequalified) {
print '<tr class="oddeven"><td width="100">';
print (empty($module->name) ? $name : $module->name);
print "</td><td>\n";
if (method_exists($module, 'info')) {
print $module->info($langs);
} else {
print $module->description;
}
print '</td>';
// Active
if (in_array($name, $def)) {
print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del_default&amp;token='.newToken().'&amp;value='.$name.'">';
print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>';
print '</td>';
} else {
print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set_default&amp;token='.newToken().'&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>";
}
// Defaut
print '<td class="center">';
if ($conf->global->MEMBER_ADDON_PDF == $name) {
print img_picto($langs->trans("Default"), 'on');
} else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;token='.newToken().'&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
}
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
if ($module->type == 'pdf') {
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>';
// Preview
print '<td class="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'contract').'</a>';
} else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
}
print '</td>';
print "</tr>\n";
}
}
}
}
}
}
}
}
print '</table>';
print "<br>";
print dol_get_fiche_end(); print dol_get_fiche_end();

View File

@ -6,7 +6,7 @@
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2012-2020 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2012-2020 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2015-2018 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2015-2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -191,6 +191,9 @@ if (empty($reshook)) {
if ($result < 0) { if ($result < 0) {
$langs->load("errors"); $langs->load("errors");
setEventMessages($langs->trans($nuser->error), null, 'errors'); setEventMessages($langs->trans($nuser->error), null, 'errors');
} else {
setEventMessages($langs->trans("NewUserCreated", $nuser->login), null, 'mesgs');
$action = '';
} }
} else { } else {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
@ -1272,7 +1275,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Confirm create user // Confirm create user
if ($action == 'create_user') { if ($action == 'create_user') {
$login = $object->login; $login = (GETPOSTISSET('login') ? GETPOST('login', 'alphanohtml') : $object->login);
if (empty($login)) { if (empty($login)) {
// Full firstname and name separated with a dot : firstname.name // Full firstname and name separated with a dot : firstname.name
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
@ -1561,7 +1564,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'userid', ''); $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'userid', '');
} else { } else {
if ($object->user_id) { if ($object->user_id) {
$form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'none'); $linkeduser = new User($db);
$linkeduser->fetch($object->user_id);
print $linkeduser->getNomUrl(-1);
} else { } else {
print $langs->trans("NoDolibarrAccess"); print $langs->trans("NoDolibarrAccess");
} }
@ -1701,13 +1706,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
} }
} }
// Delete
if ($user->rights->adherent->supprimer) {
print '<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?rowid='.$object->id.'&action=delete&token='.newToken().'">'.$langs->trans("Delete")."</a></div>\n";
} else {
print '<div class="inline-block divButAction"><font class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Delete")."</font></div>";
}
// Action SPIP // Action SPIP
if (!empty($conf->mailmanspip->enabled) && !empty($conf->global->ADHERENT_USE_SPIP)) { if (!empty($conf->mailmanspip->enabled) && !empty($conf->global->ADHERENT_USE_SPIP)) {
$isinspip = $mailmanspip->is_in_spip($object); $isinspip = $mailmanspip->is_in_spip($object);
@ -1719,6 +1717,13 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?rowid='.$object->id.'&action=add_spip">'.$langs->trans("AddIntoSpip")."</a></div>\n"; print '<div class="inline-block divButAction"><a class="butAction" href="card.php?rowid='.$object->id.'&action=add_spip">'.$langs->trans("AddIntoSpip")."</a></div>\n";
} }
} }
// Delete
if ($user->rights->adherent->supprimer) {
print '<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?rowid='.$object->id.'&action=delete&token='.newToken().'">'.$langs->trans("Delete")."</a></div>\n";
} else {
print '<div class="inline-block divButAction"><font class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Delete")."</font></div>";
}
} }
} }
print '</div>'; print '</div>';

View File

@ -7,7 +7,7 @@
* Copyright (C) 2009-2017 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2009-2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2014-2018 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2014-2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015-2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2015-2020 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2018-2019 Thibault FOUCART <support@ptibogxiv.net> * Copyright (C) 2018-2019 Thibault FOUCART <support@ptibogxiv.net>
@ -60,6 +60,9 @@ class Adherent extends CommonObject
*/ */
public $ismultientitymanaged = 1; public $ismultientitymanaged = 1;
/**
* @var string picto
*/
public $picto = 'member'; public $picto = 'member';
@ -70,13 +73,19 @@ class Adherent extends CommonObject
*/ */
public $login; public $login;
//! Clear password in memory /**
* @var string Clear password in memory
*/
public $pass; public $pass;
//! Clear password in database (defined if DATABASE_PWD_ENCRYPTED=0) /**
* @var string Clear password in database (defined if DATABASE_PWD_ENCRYPTED=0)
*/
public $pass_indatabase; public $pass_indatabase;
//! Encrypted password in database (always defined) /**
* @var string Encrypted password in database (always defined)
*/
public $pass_indatabase_crypted; public $pass_indatabase_crypted;
/** /**
@ -169,6 +178,11 @@ class Adherent extends CommonObject
*/ */
public $phone_perso; public $phone_perso;
/**
* @var string Professional Phone number
*/
public $phone_pro;
/** /**
* @var string Mobile phone number * @var string Mobile phone number
*/ */
@ -184,6 +198,9 @@ class Adherent extends CommonObject
*/ */
public $poste; public $poste;
/**
* @var string mor or phy
*/
public $morphy; public $morphy;
public $public; public $public;
@ -191,6 +208,10 @@ class Adherent extends CommonObject
// -1:brouillon, 0:resilie, >=1:valide,paye // -1:brouillon, 0:resilie, >=1:valide,paye
// def in common object // def in common object
//public $status; //public $status;
/**
* @var string photo of member
*/
public $photo; public $photo;
/** /**
@ -209,6 +230,9 @@ class Adherent extends CommonObject
public $datevalid; public $datevalid;
/**
* @var string gender
*/
public $gender; public $gender;
public $birth; public $birth;
@ -258,7 +282,11 @@ class Adherent extends CommonObject
*/ */
public $entity; public $entity;
public $fields = array('rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), /**
* @var array fields
*/
public $fields = array(
'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10),
'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 15, 'index' => 1), 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 15, 'index' => 1),
'ref_ext' => array('type' => 'varchar(128)', 'label' => 'Ref ext', 'enabled' => 1, 'visible' => 0, 'position' => 20), 'ref_ext' => array('type' => 'varchar(128)', 'label' => 'Ref ext', 'enabled' => 1, 'visible' => 0, 'position' => 20),
'civility' => array('type' => 'varchar(6)', 'label' => 'Civility', 'enabled' => 1, 'visible' => -1, 'position' => 25), 'civility' => array('type' => 'varchar(6)', 'label' => 'Civility', 'enabled' => 1, 'visible' => -1, 'position' => 25),
@ -298,7 +326,8 @@ class Adherent extends CommonObject
'statut' => array('type' => 'smallint(6)', 'label' => 'Statut', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 500, 'statut' => array('type' => 'smallint(6)', 'label' => 'Statut', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 500,
'arrayofkeyval' => array(0 => 'Draft', 1 => 'Validated', -1 => 'MemberStatusResiliatedShort')), 'arrayofkeyval' => array(0 => 'Draft', 1 => 'Validated', -1 => 'MemberStatusResiliatedShort')),
'model_pdf' => array('type' => 'varchar(255)', 'label' => 'Model pdf', 'enabled' => 1, 'visible' => 0, 'position' => 800), 'model_pdf' => array('type' => 'varchar(255)', 'label' => 'Model pdf', 'enabled' => 1, 'visible' => 0, 'position' => 800),
'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'position' => 805)); 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'position' => 805)
);
/** /**
@ -407,7 +436,8 @@ class Adherent extends CommonObject
$infos .= $langs->transnoentities("Public").": ".yn($this->public); $infos .= $langs->transnoentities("Public").": ".yn($this->public);
// Substitutions // Substitutions
$substitutionarray = array('__ID__' => $this->id, '__MEMBER_ID__' => $this->id, '__CIVILITY__' => $this->getCivilityLabel(), $substitutionarray = array(
'__ID__' => $this->id, '__MEMBER_ID__' => $this->id, '__CIVILITY__' => $this->getCivilityLabel(),
'__FIRSTNAME__' => $msgishtml ? dol_htmlentitiesbr($this->firstname) : ($this->firstname ? $this->firstname : ''), '__FIRSTNAME__' => $msgishtml ? dol_htmlentitiesbr($this->firstname) : ($this->firstname ? $this->firstname : ''),
'__LASTNAME__' => $msgishtml ? dol_htmlentitiesbr($this->lastname) : ($this->lastname ? $this->lastname : ''), '__LASTNAME__' => $msgishtml ? dol_htmlentitiesbr($this->lastname) : ($this->lastname ? $this->lastname : ''),
'__FULLNAME__' => $msgishtml ? dol_htmlentitiesbr($this->getFullName($langs)) : $this->getFullName($langs), '__FULLNAME__' => $msgishtml ? dol_htmlentitiesbr($this->getFullName($langs)) : $this->getFullName($langs),
@ -422,7 +452,8 @@ class Adherent extends CommonObject
'__PHONE__' => $msgishtml ? dol_htmlentitiesbr($this->phone) : ($this->phone ? $this->phone : ''), '__PHONE__' => $msgishtml ? dol_htmlentitiesbr($this->phone) : ($this->phone ? $this->phone : ''),
'__PHONEPRO__' => $msgishtml ? dol_htmlentitiesbr($this->phone_perso) : ($this->phone_perso ? $this->phone_perso : ''), '__PHONEPRO__' => $msgishtml ? dol_htmlentitiesbr($this->phone_perso) : ($this->phone_perso ? $this->phone_perso : ''),
'__PHONEMOBILE__' => $msgishtml ? dol_htmlentitiesbr($this->phone_mobile) : ($this->phone_mobile ? $this->phone_mobile : ''), '__PHONEMOBILE__' => $msgishtml ? dol_htmlentitiesbr($this->phone_mobile) : ($this->phone_mobile ? $this->phone_mobile : ''),
'__TYPE__' => $msgishtml ? dol_htmlentitiesbr($this->type) : ($this->type ? $this->type : '')); '__TYPE__' => $msgishtml ? dol_htmlentitiesbr($this->type) : ($this->type ? $this->type : '')
);
complete_substitutions_array($substitutionarray, $langs, $this); complete_substitutions_array($substitutionarray, $langs, $this);
@ -589,9 +620,7 @@ class Adherent extends CommonObject
$this->town = ($this->town ? $this->town : $this->town); $this->town = ($this->town ? $this->town : $this->town);
$this->country_id = ($this->country_id > 0 ? $this->country_id : $this->country_id); $this->country_id = ($this->country_id > 0 ? $this->country_id : $this->country_id);
$this->state_id = ($this->state_id > 0 ? $this->state_id : $this->state_id); $this->state_id = ($this->state_id > 0 ? $this->state_id : $this->state_id);
if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->lastname = dol_ucwords(dol_strtolower($this->lastname)); $this->setUpperOrLowerCase();
if (!empty($conf->global->MAIN_ALL_TO_UPPER)) $this->lastname = dol_strtoupper($this->lastname);
if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->firstname = dol_ucwords(dol_strtolower($this->firstname));
$this->note_public = ($this->note_public ? $this->note_public : $this->note_public); $this->note_public = ($this->note_public ? $this->note_public : $this->note_public);
$this->note_private = ($this->note_private ? $this->note_private : $this->note_private); $this->note_private = ($this->note_private ? $this->note_private : $this->note_private);
@ -1984,7 +2013,8 @@ class Adherent extends CommonObject
} }
$label .= '<div class="centpercent">'; $label .= '<div class="centpercent">';
$label .= '<u>'.$langs->trans("Member").'</u>'; $label .= img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("Member").'</u>';
$label .= ' '.$this->getLibStatut(4);
if (!empty($this->ref)) $label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref; if (!empty($this->ref)) $label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
if (!empty($this->firstname) || !empty($this->lastname)) $label .= '<br><b>'.$langs->trans('Name').':</b> '.$this->getFullName($langs); if (!empty($this->firstname) || !empty($this->lastname)) $label .= '<br><b>'.$langs->trans('Name').':</b> '.$this->getFullName($langs);
if (!empty($this->company)) $label .= '<br><b>'.$langs->trans('Company').':</b> '.$this->company; if (!empty($this->company)) $label .= '<br><b>'.$langs->trans('Company').':</b> '.$this->company;
@ -2276,14 +2306,16 @@ class Adherent extends CommonObject
* Used to build previews or test instances. * Used to build previews or test instances.
* id must be 0 if object instance is a specimen. * id must be 0 if object instance is a specimen.
* *
* @return void * @return int
*/ */
public function initAsSpecimen() public function initAsSpecimen()
{ {
global $user, $langs; global $user, $langs;
$now = dol_now();
// Initialise parametres // Initialise parametres
$this->id = 0; $this->id = 0;
$this->entity = 1;
$this->specimen = 1; $this->specimen = 1;
$this->civility_id = 0; $this->civility_id = 0;
$this->lastname = 'DOLIBARR'; $this->lastname = 'DOLIBARR';
@ -2300,24 +2332,30 @@ class Adherent extends CommonObject
$this->country = 'France'; $this->country = 'France';
$this->morphy = 'mor'; $this->morphy = 'mor';
$this->email = 'specimen@specimen.com'; $this->email = 'specimen@specimen.com';
$this->socialnetworks = array('skype' => 'skypepseudo', 'twitter' => 'twitterpseudo', 'facebook' => 'facebookpseudo', 'linkedin' => 'linkedinpseudo'); $this->socialnetworks = array(
'skype' => 'skypepseudo',
'twitter' => 'twitterpseudo',
'facebook' => 'facebookpseudo',
'linkedin' => 'linkedinpseudo',
);
$this->phone = '0999999999'; $this->phone = '0999999999';
$this->phone_perso = '0999999998'; $this->phone_perso = '0999999998';
$this->phone_mobile = '0999999997'; $this->phone_mobile = '0999999997';
$this->note_private = 'No comment'; $this->note_public = 'This is a public note';
$this->birth = time(); $this->note_private = 'This is a private note';
$this->birth = $now;
$this->photo = ''; $this->photo = '';
$this->public = 1; $this->public = 1;
$this->statut = 0; $this->statut = 0;
$this->datefin = time(); $this->datefin = $now;
$this->datevalid = time(); $this->datevalid = $now;
$this->typeid = 1; // Id type adherent $this->typeid = 1; // Id type adherent
$this->type = 'Type adherent'; // Libelle type adherent $this->type = 'Type adherent'; // Libelle type adherent
$this->need_subscription = 0; $this->need_subscription = 0;
$this->first_subscription_date = time(); $this->first_subscription_date = $now;
$this->first_subscription_date_start = $this->first_subscription_date; $this->first_subscription_date_start = $this->first_subscription_date;
$this->first_subscription_date_end = dol_time_plus_duree($this->first_subscription_date_start, 1, 'y'); $this->first_subscription_date_end = dol_time_plus_duree($this->first_subscription_date_start, 1, 'y');
$this->first_subscription_amount = 10; $this->first_subscription_amount = 10;
@ -2326,6 +2364,7 @@ class Adherent extends CommonObject
$this->last_subscription_date_start = $this->first_subscription_date; $this->last_subscription_date_start = $this->first_subscription_date;
$this->last_subscription_date_end = dol_time_plus_duree($this->last_subscription_date_start, 1, 'y'); $this->last_subscription_date_end = dol_time_plus_duree($this->last_subscription_date_start, 1, 'y');
$this->last_subscription_amount = 10; $this->last_subscription_amount = 10;
return 1;
} }
@ -2365,6 +2404,7 @@ class Adherent extends CommonObject
global $conf, $langs; global $conf, $langs;
$info = array(); $info = array();
$socialnetworks = getArrayOfSocialNetworks();
$keymodified = false; $keymodified = false;
// Object classes // Object classes
@ -2379,8 +2419,13 @@ class Adherent extends CommonObject
} }
// Possible LDAP KEY (constname => varname) // Possible LDAP KEY (constname => varname)
$ldapkey = array('LDAP_MEMBER_FIELD_FULLNAME' => 'fullname', 'LDAP_MEMBER_FIELD_NAME' => 'lastname', 'LDAP_MEMBER_FIELD_LOGIN' => 'login', 'LDAP_MEMBER_FIELD_LOGIN_SAMBA' => 'login', $ldapkey = array(
'LDAP_MEMBER_FIELD_MAIL' => 'email'); 'LDAP_MEMBER_FIELD_FULLNAME' => 'fullname',
'LDAP_MEMBER_FIELD_NAME' => 'lastname',
'LDAP_MEMBER_FIELD_LOGIN' => 'login',
'LDAP_MEMBER_FIELD_LOGIN_SAMBA' => 'login',
'LDAP_MEMBER_FIELD_MAIL' => 'email'
);
// Member // Member
foreach ($ldapkey as $constname => $varname) { foreach ($ldapkey as $constname => $varname) {
@ -2400,10 +2445,11 @@ class Adherent extends CommonObject
if ($this->zip && !empty($conf->global->LDAP_MEMBER_FIELD_ZIP)) $info[$conf->global->LDAP_MEMBER_FIELD_ZIP] = $this->zip; if ($this->zip && !empty($conf->global->LDAP_MEMBER_FIELD_ZIP)) $info[$conf->global->LDAP_MEMBER_FIELD_ZIP] = $this->zip;
if ($this->town && !empty($conf->global->LDAP_MEMBER_FIELD_TOWN)) $info[$conf->global->LDAP_MEMBER_FIELD_TOWN] = $this->town; if ($this->town && !empty($conf->global->LDAP_MEMBER_FIELD_TOWN)) $info[$conf->global->LDAP_MEMBER_FIELD_TOWN] = $this->town;
if ($this->country_code && !empty($conf->global->LDAP_MEMBER_FIELD_COUNTRY)) $info[$conf->global->LDAP_MEMBER_FIELD_COUNTRY] = $this->country_code; if ($this->country_code && !empty($conf->global->LDAP_MEMBER_FIELD_COUNTRY)) $info[$conf->global->LDAP_MEMBER_FIELD_COUNTRY] = $this->country_code;
if ($this->skype && !empty($conf->global->LDAP_MEMBER_FIELD_SKYPE)) $info[$conf->global->LDAP_MEMBER_FIELD_SKYPE] = $this->skype; foreach ($socialnetworks as $key => $value) {
if ($this->twitter && !empty($conf->global->LDAP_MEMBER_FIELD_TWITTER)) $info[$conf->global->LDAP_MEMBER_FIELD_TWITTER] = $this->twitter; if ($this->socialnetworks[$value['label']] && !empty($conf->global->{'LDAP_MEMBER_FIELD_'.strtoupper($value['label'])})) {
if ($this->facebook && !empty($conf->global->LDAP_MEMBER_FIELD_FACEBOOK)) $info[$conf->global->LDAP_MEMBER_FIELD_FACEBOOK] = $this->facebook; $info[$conf->global->{'LDAP_MEMBER_FIELD_'.strtoupper($value['label'])}] = $this->socialnetworks[$value['label']];
if ($this->linkedin && !empty($conf->global->LDAP_MEMBER_FIELD_LINKEDIN)) $info[$conf->global->LDAP_MEMBER_FIELD_LINKEDIN] = $this->linkedin; }
}
if ($this->phone && !empty($conf->global->LDAP_MEMBER_FIELD_PHONE)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE] = $this->phone; if ($this->phone && !empty($conf->global->LDAP_MEMBER_FIELD_PHONE)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE] = $this->phone;
if ($this->phone_perso && !empty($conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO] = $this->phone_perso; if ($this->phone_perso && !empty($conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO] = $this->phone_perso;
if ($this->phone_mobile && !empty($conf->global->LDAP_MEMBER_FIELD_MOBILE)) $info[$conf->global->LDAP_MEMBER_FIELD_MOBILE] = $this->phone_mobile; if ($this->phone_mobile && !empty($conf->global->LDAP_MEMBER_FIELD_MOBILE)) $info[$conf->global->LDAP_MEMBER_FIELD_MOBILE] = $this->phone_mobile;
@ -2416,8 +2462,12 @@ class Adherent extends CommonObject
// When password is modified // When password is modified
if (!empty($this->pass)) { if (!empty($this->pass)) {
if (!empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD] = $this->pass; // this->pass = mot de passe non crypte if (!empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) {
if (!empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass, 4); // Create OpenLDAP MD5 password (TODO add type of encryption) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD] = $this->pass; // this->pass = mot de passe non crypte
}
if (!empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) {
$info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass, 4); // Create OpenLDAP MD5 password (TODO add type of encryption)
}
} // Set LDAP password if possible } // Set LDAP password if possible
elseif ($conf->global->LDAP_SERVER_PROTOCOLVERSION !== '3') { // If ldap key is modified and LDAPv3 we use ldap_rename function for avoid lose encrypt password elseif ($conf->global->LDAP_SERVER_PROTOCOLVERSION !== '3') { // If ldap key is modified and LDAPv3 we use ldap_rename function for avoid lose encrypt password
if (!empty($conf->global->DATABASE_PWD_ENCRYPTED)) { if (!empty($conf->global->DATABASE_PWD_ENCRYPTED)) {

View File

@ -85,7 +85,6 @@ class AdherentType extends CommonObject
/** /**
* @var int Subsription required (0 or 1) * @var int Subsription required (0 or 1)
* @since 5.0
*/ */
public $subscription; public $subscription;
@ -95,9 +94,15 @@ class AdherentType extends CommonObject
/** @var integer Can vote */ /** @var integer Can vote */
public $vote; public $vote;
/** @var string Email sent during validation */ /** @var string Email sent during validation of member */
public $mail_valid; public $mail_valid;
/** @var string Email sent after recording a new subscription */
public $mail_subscription = '';
/** @var string Email sent after resiliation */
public $mail_resiliate = '';
/** @var array Array of members */ /** @var array Array of members */
public $members = array(); public $members = array();
@ -151,7 +156,7 @@ class AdherentType extends CommonObject
} }
/** /**
* Update or add a translation for a product * Update or add a translation for this member type
* *
* @param User $user Object user making update * @param User $user Object user making update
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
@ -236,11 +241,10 @@ class AdherentType extends CommonObject
} }
/** /**
* Delete a language for this product * Delete a language for this member type
* *
* @param string $langtodelete Language code to delete * @param string $langtodelete Language code to delete
* @param User $user Object user making delete * @param User $user Object user making delete
*
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function delMultiLangs($langtodelete, $user) public function delMultiLangs($langtodelete, $user)
@ -268,7 +272,7 @@ class AdherentType extends CommonObject
} }
/** /**
* Fonction qui permet de creer le status de l'adherent * Function to create the member type
* *
* @param User $user User making creation * @param User $user User making creation
* @param int $notrigger 1=do not execute triggers, 0 otherwise * @param int $notrigger 1=do not execute triggers, 0 otherwise
@ -574,7 +578,7 @@ class AdherentType extends CommonObject
public function getmorphylib($morphy = '') public function getmorphylib($morphy = '')
{ {
global $langs; global $langs;
if ($morphy == 'phy') { return $langs->trans("Physical"); } elseif ($morphy == 'mor') { return $langs->trans("Moral"); } else return $langs->trans("MorPhy"); if ($morphy == 'phy') { return $langs->trans("Physical"); } elseif ($morphy == 'mor') { return $langs->trans("Moral"); } else return $langs->trans("MorAndPhy");
//return $morphy; //return $morphy;
} }
@ -591,7 +595,15 @@ class AdherentType extends CommonObject
global $langs; global $langs;
$result = ''; $result = '';
$label = $langs->trans("ShowTypeCard", $this->label);
$label = '';
$label = img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("MemberType").'</u>';
$label .= ' '.$this->getLibStatut(4);
$label .= '<br>'.$langs->trans("Label").': '.$this->label;
if (isset($this->subscription)) {
$label .= '<br>'.$langs->trans("SubscriptionRequired").': '.yn($this->subscription);
}
$linkstart = '<a href="'.DOL_URL_ROOT.'/adherents/type.php?rowid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; $linkstart = '<a href="'.DOL_URL_ROOT.'/adherents/type.php?rowid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$linkend = '</a>'; $linkend = '</a>';
@ -707,7 +719,7 @@ class AdherentType extends CommonObject
*/ */
public function initAsSpecimen() public function initAsSpecimen()
{ {
global $conf, $user, $langs; global $user;
// Initialise parametres // Initialise parametres
$this->id = 0; $this->id = 0;
@ -735,8 +747,6 @@ class AdherentType extends CommonObject
*/ */
public function getMailOnValid() public function getMailOnValid()
{ {
global $conf;
if (!empty($this->mail_valid) && trim(dol_htmlentitiesbr_decode($this->mail_valid))) { if (!empty($this->mail_valid) && trim(dol_htmlentitiesbr_decode($this->mail_valid))) {
return $this->mail_valid; return $this->mail_valid;
} }
@ -751,8 +761,6 @@ class AdherentType extends CommonObject
*/ */
public function getMailOnSubscription() public function getMailOnSubscription()
{ {
global $conf;
// mail_subscription not defined so never used // mail_subscription not defined so never used
if (!empty($this->mail_subscription) && trim(dol_htmlentitiesbr_decode($this->mail_subscription))) { // Property not yet defined if (!empty($this->mail_subscription) && trim(dol_htmlentitiesbr_decode($this->mail_subscription))) { // Property not yet defined
return $this->mail_subscription; return $this->mail_subscription;
@ -768,8 +776,6 @@ class AdherentType extends CommonObject
*/ */
public function getMailOnResiliate() public function getMailOnResiliate()
{ {
global $conf;
// NOTE mail_resiliate not defined so never used // NOTE mail_resiliate not defined so never used
if (!empty($this->mail_resiliate) && trim(dol_htmlentitiesbr_decode($this->mail_resiliate))) { // Property not yet defined if (!empty($this->mail_resiliate) && trim(dol_htmlentitiesbr_decode($this->mail_resiliate))) { // Property not yet defined
return $this->mail_resiliate; return $this->mail_resiliate;

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2016 Xebax Christy <xebax@wanadoo.fr> /* Copyright (C) 2016 Xebax Christy <xebax@wanadoo.fr>
* Copyright (C) 2017 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2020 Thibault FOUCART<support@ptibogxiv.net> * Copyright (C) 2020 Thibault FOUCART<support@ptibogxiv.net>
* Copyright (C) 2020 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -66,12 +67,16 @@ class Members extends DolibarrApi
} }
$member = new Adherent($this->db); $member = new Adherent($this->db);
if ($id == 0) {
$result = $member->initAsSpecimen();
} else {
$result = $member->fetch($id); $result = $member->fetch($id);
}
if (!$result) { if (!$result) {
throw new RestException(404, 'member not found'); throw new RestException(404, 'member not found');
} }
if (!DolibarrApi::_checkAccessToResource('adherent', $member->id)) { if (!DolibarrApi::_checkAccessToResource('adherent', $member->id) && $id > 0) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
} }
@ -85,7 +90,7 @@ class Members extends DolibarrApi
* *
* @param int $thirdparty ID of third party * @param int $thirdparty ID of third party
* *
* @return array|mixed Data without useless information * @return Object Data without useless information
* *
* @url GET thirdparty/{thirdparty} * @url GET thirdparty/{thirdparty}
* *
@ -118,7 +123,7 @@ class Members extends DolibarrApi
* *
* @param string $email Email of third party * @param string $email Email of third party
* *
* @return array|mixed Data without useless information * @return Object Data without useless information
* *
* @url GET thirdparty/email/{email} * @url GET thirdparty/email/{email}
* *
@ -157,7 +162,7 @@ class Members extends DolibarrApi
* *
* @param string $barcode Barcode of third party * @param string $barcode Barcode of third party
* *
* @return array|mixed Data without useless information * @return Object Data without useless information
* *
* @url GET thirdparty/barcode/{barcode} * @url GET thirdparty/barcode/{barcode}
* *
@ -301,7 +306,7 @@ class Members extends DolibarrApi
* *
* @param int $id ID of member to update * @param int $id ID of member to update
* @param array $request_data Datas * @param array $request_data Datas
* @return int * @return Object Updated object
*/ */
public function put($id, $request_data = null) public function put($id, $request_data = null)
{ {
@ -405,8 +410,8 @@ class Members extends DolibarrApi
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param Object $object Object to clean
* @return array Array of cleaned object properties * @return Object Object with cleaned properties
*/ */
protected function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {

View File

@ -261,8 +261,8 @@ class MembersTypes extends DolibarrApi
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param Object $object Object to clean
* @return array Array of cleaned object properties * @return Object Object with cleaned properties
*/ */
protected function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {

View File

@ -52,7 +52,7 @@ class Subscriptions extends DolibarrApi
* Return an array with subscription informations * Return an array with subscription informations
* *
* @param int $id ID of subscription * @param int $id ID of subscription
* @return array|mixed data without useless information * @return Object data without useless information
* *
* @throws RestException * @throws RestException
*/ */
@ -168,7 +168,7 @@ class Subscriptions extends DolibarrApi
* *
* @param int $id ID of subscription to update * @param int $id ID of subscription to update
* @param array $request_data Datas * @param array $request_data Datas
* @return int * @return Object
*/ */
public function put($id, $request_data = null) public function put($id, $request_data = null)
{ {

View File

@ -156,7 +156,7 @@ class Subscription extends CommonObject
} else { } else {
$type = $this->fk_type; $type = $this->fk_type;
} }
$sql .= " VALUES (".$this->fk_adherent.", '".$type."', '".$this->db->idate($now)."',"; $sql .= " VALUES (".$this->fk_adherent.", '".$this->db->escape($type)."', '".$this->db->idate($now)."',";
$sql .= " '".$this->db->idate($this->dateh)."',"; $sql .= " '".$this->db->idate($this->dateh)."',";
$sql .= " '".$this->db->idate($this->datef)."',"; $sql .= " '".$this->db->idate($this->datef)."',";
$sql .= " ".$this->amount.","; $sql .= " ".$this->amount.",";

View File

@ -37,7 +37,8 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
$langs->loadLangs(array("companies", "members", "other")); $langs->loadLangs(array("companies", "members", "other"));
$id = GETPOST('id', 'int'); $id = GETPOSTISSET('id') ? GETPOST('id', 'int') : GETPOST('rowid', 'int');
$ref = GETPOST('ref', 'alphanohtml');
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha'); $confirm = GETPOST('confirm', 'alpha');
@ -60,7 +61,7 @@ if (!$sortfield) $sortfield = "name";
$form = new Form($db); $form = new Form($db);
$object = new Adherent($db); $object = new Adherent($db);
$membert = new AdherentType($db); $membert = new AdherentType($db);
$result = $object->fetch($id); $result = $object->fetch($id, $ref);
if ($result < 0) { if ($result < 0) {
dol_print_error($db); dol_print_error($db);
exit; exit;

View File

@ -284,10 +284,10 @@ print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
*/ */
$max = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT; $max = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
$sql = "SELECT a.rowid, a.statut, a.lastname, a.firstname, a.societe as company, a.fk_soc,"; $sql = "SELECT a.rowid, a.statut as status, a.lastname, a.firstname, a.societe as company, a.fk_soc,";
$sql .= " a.gender, a.email, a.photo, a.morphy,"; $sql .= " a.gender, a.email, a.photo, a.morphy,";
$sql .= " a.tms as datem, datefin as date_end_subscription,"; $sql .= " a.tms as datem, a.datefin as date_end_subscription,";
$sql .= " ta.rowid as typeid, ta.libelle as label, ta.subscription"; $sql .= " ta.rowid as typeid, ta.libelle as label, ta.subscription as need_subscription";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as ta"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as ta";
$sql .= " WHERE a.entity IN (".getEntity('adherent').")"; $sql .= " WHERE a.entity IN (".getEntity('adherent').")";
$sql .= " AND a.fk_adherent_type = ta.rowid"; $sql .= " AND a.fk_adherent_type = ta.rowid";
@ -306,7 +306,7 @@ if ($resql) {
$i = 0; $i = 0;
while ($i < $num) { while ($i < $num) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
print '<tr class="oddeven">';
$staticmember->id = $obj->rowid; $staticmember->id = $obj->rowid;
$staticmember->ref = $obj->rowid; $staticmember->ref = $obj->rowid;
$staticmember->lastname = $obj->lastname; $staticmember->lastname = $obj->lastname;
@ -315,6 +315,9 @@ if ($resql) {
$staticmember->email = $obj->email; $staticmember->email = $obj->email;
$staticmember->photo = $obj->photo; $staticmember->photo = $obj->photo;
$staticmember->morphy = $obj->morphy; $staticmember->morphy = $obj->morphy;
$staticmember->statut = $obj->status;
$staticmember->need_subscription = $obj->need_subscription;
$staticmember->datefin = $db->jdate($obj->date_end_subscription);
if (!empty($obj->fk_soc)) { if (!empty($obj->fk_soc)) {
$staticmember->fk_soc = $obj->fk_soc; $staticmember->fk_soc = $obj->fk_soc;
$staticmember->fetch_thirdparty(); $staticmember->fetch_thirdparty();
@ -322,12 +325,16 @@ if ($resql) {
} else { } else {
$staticmember->name = $obj->company; $staticmember->name = $obj->company;
} }
$statictype->id = $obj->typeid; $statictype->id = $obj->typeid;
$statictype->label = $obj->label; $statictype->label = $obj->label;
$statictype->subscription = $obj->need_subscription;
print '<tr class="oddeven">';
print '<td class="nowraponall">'.$staticmember->getNomUrl(-1, 32).'</td>'; print '<td class="nowraponall">'.$staticmember->getNomUrl(-1, 32).'</td>';
print '<td>'.$statictype->getNomUrl(1, 32).'</td>'; print '<td>'.$statictype->getNomUrl(1, 32).'</td>';
print '<td>'.dol_print_date($db->jdate($obj->datem), 'dayhour').'</td>'; print '<td>'.dol_print_date($db->jdate($obj->datem), 'dayhour').'</td>';
print '<td class="right">'.$staticmember->LibStatut($obj->statut, ($obj->subscription == 'yes' ? 1 : 0), $db->jdate($obj->date_end_subscription), 3).'</td>'; print '<td class="right">'.$staticmember->getLibStatut(3).'</td>';
print '</tr>'; print '</tr>';
$i++; $i++;
} }
@ -344,12 +351,14 @@ if ($resql) {
*/ */
$max = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT; $max = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
$sql = "SELECT a.rowid, a.statut, a.lastname, a.firstname, a.societe as company, a.fk_soc,"; $sql = "SELECT a.rowid, a.statut as status, a.lastname, a.firstname, a.societe as company, a.fk_soc,";
$sql .= " a.gender, a.email, a.photo, a.morphy,"; $sql .= " a.gender, a.email, a.photo, a.morphy,";
$sql .= " a.datefin as date_end_subscription,"; $sql .= " a.datefin as date_end_subscription,";
$sql .= " ta.rowid as typeid, ta.libelle as label, ta.subscription as need_subscription,";
$sql .= " c.rowid as cid, c.tms as datem, c.datec as datec, c.dateadh as date_start, c.datef as date_end, c.subscription"; $sql .= " c.rowid as cid, c.tms as datem, c.datec as datec, c.dateadh as date_start, c.datef as date_end, c.subscription";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."subscription as c"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as ta, ".MAIN_DB_PREFIX."subscription as c";
$sql .= " WHERE a.entity IN (".getEntity('adherent').")"; $sql .= " WHERE a.entity IN (".getEntity('adherent').")";
$sql .= " AND a.fk_adherent_type = ta.rowid";
$sql .= " AND c.fk_adherent = a.rowid"; $sql .= " AND c.fk_adherent = a.rowid";
$sql .= $db->order("c.tms", "DESC"); $sql .= $db->order("c.tms", "DESC");
$sql .= $db->plimit($max, 0); $sql .= $db->plimit($max, 0);
@ -366,9 +375,7 @@ if ($resql) {
$i = 0; $i = 0;
while ($i < $num) { while ($i < $num) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
print '<tr class="oddeven">';
$subscriptionstatic->id = $obj->cid;
$subscriptionstatic->ref = $obj->cid;
$staticmember->id = $obj->rowid; $staticmember->id = $obj->rowid;
$staticmember->ref = $obj->rowid; $staticmember->ref = $obj->rowid;
$staticmember->lastname = $obj->lastname; $staticmember->lastname = $obj->lastname;
@ -377,6 +384,9 @@ if ($resql) {
$staticmember->email = $obj->email; $staticmember->email = $obj->email;
$staticmember->photo = $obj->photo; $staticmember->photo = $obj->photo;
$staticmember->morphy = $obj->morphy; $staticmember->morphy = $obj->morphy;
$staticmember->statut = $obj->status;
$staticmember->need_subscription = $obj->need_subscription;
$staticmember->datefin = $db->jdate($obj->date_end_subscription);
if (!empty($obj->fk_soc)) { if (!empty($obj->fk_soc)) {
$staticmember->fk_soc = $obj->fk_soc; $staticmember->fk_soc = $obj->fk_soc;
$staticmember->fetch_thirdparty(); $staticmember->fetch_thirdparty();
@ -384,6 +394,11 @@ if ($resql) {
} else { } else {
$staticmember->name = $obj->company; $staticmember->name = $obj->company;
} }
$subscriptionstatic->id = $obj->cid;
$subscriptionstatic->ref = $obj->cid;
print '<tr class="oddeven">';
print '<td class="nowraponall">'.$subscriptionstatic->getNomUrl(1).'</td>'; print '<td class="nowraponall">'.$subscriptionstatic->getNomUrl(1).'</td>';
print '<td class="nowraponall">'.$staticmember->getNomUrl(-1, 32, 'subscription').'</td>'; print '<td class="nowraponall">'.$staticmember->getNomUrl(-1, 32, 'subscription').'</td>';
print '<td class="nowraponall">'.get_date_range($db->jdate($obj->date_start), $db->jdate($obj->date_end)).'</td>'; print '<td class="nowraponall">'.get_date_range($db->jdate($obj->date_start), $db->jdate($obj->date_end)).'</td>';

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2007-2019 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2007-2019 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -44,6 +44,9 @@ $rowid = GETPOST("rowid", "int") ?GETPOST("rowid", "int") : GETPOST("id", "int")
$typeid = GETPOST("typeid", "int"); $typeid = GETPOST("typeid", "int");
$cancel = GETPOST('cancel', 'alpha'); $cancel = GETPOST('cancel', 'alpha');
$confirm = GETPOST('confirm'); $confirm = GETPOST('confirm');
$note = GETPOST('note', 'alpha');
$typeid = (int) GETPOST('typeid', 'int');
$amount = price2num(GETPOST('amount', 'alpha'), 'MT');
if (!$user->rights->adherent->cotisation->lire) if (!$user->rights->adherent->cotisation->lire)
accessforbidden(); accessforbidden();
@ -84,7 +87,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'update' && !$cance
} else { } else {
$accountline->datev = dol_mktime($_POST['datesubhour'], $_POST['datesubmin'], 0, $_POST['datesubmonth'], $_POST['datesubday'], $_POST['datesubyear']); $accountline->datev = dol_mktime($_POST['datesubhour'], $_POST['datesubmin'], 0, $_POST['datesubmonth'], $_POST['datesubday'], $_POST['datesubyear']);
$accountline->dateo = dol_mktime($_POST['datesubhour'], $_POST['datesubmin'], 0, $_POST['datesubmonth'], $_POST['datesubday'], $_POST['datesubyear']); $accountline->dateo = dol_mktime($_POST['datesubhour'], $_POST['datesubmin'], 0, $_POST['datesubmonth'], $_POST['datesubday'], $_POST['datesubyear']);
$accountline->amount = $_POST["amount"]; $accountline->amount = $amount;
$result = $accountline->update($user); $result = $accountline->update($user);
if ($result < 0) { if ($result < 0) {
$errmsg = $accountline->error; $errmsg = $accountline->error;
@ -96,9 +99,9 @@ if ($user->rights->adherent->cotisation->creer && $action == 'update' && !$cance
// Modify values // Modify values
$object->dateh = dol_mktime($_POST['datesubhour'], $_POST['datesubmin'], 0, $_POST['datesubmonth'], $_POST['datesubday'], $_POST['datesubyear']); $object->dateh = dol_mktime($_POST['datesubhour'], $_POST['datesubmin'], 0, $_POST['datesubmonth'], $_POST['datesubday'], $_POST['datesubyear']);
$object->datef = dol_mktime($_POST['datesubendhour'], $_POST['datesubendmin'], 0, $_POST['datesubendmonth'], $_POST['datesubendday'], $_POST['datesubendyear']); $object->datef = dol_mktime($_POST['datesubendhour'], $_POST['datesubendmin'], 0, $_POST['datesubendmonth'], $_POST['datesubendday'], $_POST['datesubendyear']);
$object->fk_type = $_POST["typeid"]; $object->fk_type = $typeid;
$object->note = $_POST["note"]; $object->note = $note;
$object->amount = $_POST["amount"]; $object->amount = $amount;
//print 'datef='.$object->datef.' '.$_POST['datesubendday']; //print 'datef='.$object->datef.' '.$_POST['datesubendday'];
$result = $object->update($user); $result = $object->update($user);
@ -216,8 +219,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit') {
print '<input type="text" class="flat" size="60" name="note" value="'.$object->note.'"></td></tr>'; print '<input type="text" class="flat" size="60" name="note" value="'.$object->note.'"></td></tr>';
// Bank line // Bank line
if (!empty($conf->banque->enabled)) { if (!empty($conf->banque->enabled) && ($conf->global->ADHERENT_BANK_USE || $object->fk_bank)) {
if ($conf->global->ADHERENT_BANK_USE || $object->fk_bank) {
print '<tr><td>'.$langs->trans("BankTransactionLine").'</td><td class="valeur" colspan="2">'; print '<tr><td>'.$langs->trans("BankTransactionLine").'</td><td class="valeur" colspan="2">';
if ($object->fk_bank) { if ($object->fk_bank) {
$bankline = new AccountLine($db); $bankline = new AccountLine($db);
@ -228,7 +230,6 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit') {
} }
print '</td></tr>'; print '</td></tr>';
} }
}
print '</table>'; print '</table>';
@ -316,8 +317,7 @@ if ($rowid && $action != 'edit') {
print '<tr><td>'.$langs->trans("Label").'</td><td class="valeur">'.$object->note.'</td></tr>'; print '<tr><td>'.$langs->trans("Label").'</td><td class="valeur">'.$object->note.'</td></tr>';
// Bank line // Bank line
if (!empty($conf->banque->enabled)) { if (!empty($conf->banque->enabled) && ($conf->global->ADHERENT_BANK_USE || $object->fk_bank)) {
if ($conf->global->ADHERENT_BANK_USE || $object->fk_bank) {
print '<tr><td>'.$langs->trans("BankTransactionLine").'</td><td class="valeur">'; print '<tr><td>'.$langs->trans("BankTransactionLine").'</td><td class="valeur">';
if ($object->fk_bank) { if ($object->fk_bank) {
$bankline = new AccountLine($db); $bankline = new AccountLine($db);
@ -328,7 +328,6 @@ if ($rowid && $action != 'edit') {
} }
print '</td></tr>'; print '</td></tr>';
} }
}
print "</table>\n"; print "</table>\n";
print '</div>'; print '</div>';

View File

@ -247,7 +247,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<th>'.$langs->trans("Ref").'</th>'; print '<th>'.$langs->trans("Ref").'</th>';
print '<th>'.$langs->trans("Label").'</th>'; print '<th>'.$langs->trans("Label").'</th>';
print '<th class="center">'.$langs->trans("MemberNature").'</th>'; print '<th class="center">'.$langs->trans("MembersNature").'</th>';
print '<th class="center">'.$langs->trans("SubscriptionRequired").'</th>'; print '<th class="center">'.$langs->trans("SubscriptionRequired").'</th>';
print '<th class="center">'.$langs->trans("VoteAllowed").'</th>'; print '<th class="center">'.$langs->trans("VoteAllowed").'</th>';
print '<th class="center">'.$langs->trans("Status").'</th>'; print '<th class="center">'.$langs->trans("Status").'</th>';
@ -263,6 +263,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
$membertype->ref = $objp->rowid; $membertype->ref = $objp->rowid;
$membertype->label = $objp->rowid; $membertype->label = $objp->rowid;
$membertype->status = $objp->status; $membertype->status = $objp->status;
$membertype->subscription = $objp->subscription;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'; print '<td>';
@ -271,7 +272,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
print '</td>'; print '</td>';
print '<td>'.dol_escape_htmltag($objp->label).'</td>'; print '<td>'.dol_escape_htmltag($objp->label).'</td>';
print '<td class="center">'; print '<td class="center">';
if ($objp->morphy == 'phy') { print $langs->trans("Physical"); } elseif ($objp->morphy == 'mor') { print $langs->trans("Moral"); } else print $langs->trans("MorPhy"); if ($objp->morphy == 'phy') { print $langs->trans("Physical"); } elseif ($objp->morphy == 'mor') { print $langs->trans("Moral"); } else print $langs->trans("MorAndPhy");
print '</td>'; print '</td>';
print '<td class="center">'.yn($objp->subscription).'</td>'; print '<td class="center">'.yn($objp->subscription).'</td>';
print '<td class="center">'.yn($objp->vote).'</td>'; print '<td class="center">'.yn($objp->vote).'</td>';
@ -321,10 +322,10 @@ if ($action == 'create') {
// Morphy // Morphy
$morphys = array(); $morphys = array();
$morphys[""] = $langs->trans("MorPhy"); $morphys[""] = $langs->trans("MorAndPhy");
$morphys["phy"] = $langs->trans("Physical"); $morphys["phy"] = $langs->trans("Physical");
$morphys["mor"] = $langs->trans("Moral"); $morphys["mor"] = $langs->trans("Moral");
print '<tr><td><span>'.$langs->trans("MemberNature").'</span></td><td>'; print '<tr><td><span>'.$langs->trans("MembersNature").'</span></td><td>';
print $form->selectarray("morphy", $morphys, GETPOSTISSET("morphy") ? GETPOST("morphy", 'aZ09') : 'morphy'); print $form->selectarray("morphy", $morphys, GETPOSTISSET("morphy") ? GETPOST("morphy", 'aZ09') : 'morphy');
print "</td></tr>"; print "</td></tr>";
@ -343,12 +344,12 @@ if ($action == 'create') {
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>'; print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor('comment', $object->note, '', 280, 'dolibarr_notes', '', false, true, $conf->fckeditor->enabled, 15, '90%'); $doleditor = new DolEditor('comment', $object->note, '', 200, 'dolibarr_notes', '', false, true, $conf->fckeditor->enabled, 15, '90%');
$doleditor->Create(); $doleditor->Create();
print '<tr><td class="tdtop">'.$langs->trans("WelcomeEMail").'</td><td>'; print '<tr><td class="tdtop">'.$langs->trans("WelcomeEMail").'</td><td>';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor('mail_valid', $object->mail_valid, '', 280, 'dolibarr_notes', '', false, true, $conf->fckeditor->enabled, 15, '90%'); $doleditor = new DolEditor('mail_valid', $object->mail_valid, '', 250, 'dolibarr_notes', '', false, true, $conf->fckeditor->enabled, 15, '90%');
$doleditor->Create(); $doleditor->Create();
print '</td></tr>'; print '</td></tr>';
@ -401,7 +402,7 @@ if ($rowid > 0) {
print '<table class="border centpercent">'; print '<table class="border centpercent">';
// Morphy // Morphy
print '<tr><td>'.$langs->trans("MemberNature").'</td><td class="valeur" >'.$object->getmorphylib($object->morphy).'</td>'; print '<tr><td>'.$langs->trans("MembersNature").'</td><td class="valeur" >'.$object->getmorphylib($object->morphy).'</td>';
print '</tr>'; print '</tr>';
print '<tr><td class="titlefield">'.$langs->trans("SubscriptionRequired").'</td><td>'; print '<tr><td class="titlefield">'.$langs->trans("SubscriptionRequired").'</td><td>';
@ -614,13 +615,16 @@ if ($rowid > 0) {
$adh = new Adherent($db); $adh = new Adherent($db);
$adh->lastname = $objp->lastname; $adh->lastname = $objp->lastname;
$adh->firstname = $objp->firstname; $adh->firstname = $objp->firstname;
$adh->datefin = $datefin;
$adh->need_subscription = $objp->subscription;
$adh->statut = $objp->status;
// Lastname // Lastname
print '<tr class="oddeven">'; print '<tr class="oddeven">';
if ($objp->company != '') { if ($objp->company != '') {
print '<td><a href="card.php?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowMember"), "user").' '.$adh->getFullName($langs, 0, -1, 20).' / '.dol_trunc($objp->societe, 12).'</a></td>'."\n"; print '<td><a href="card.php?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowMember"), "user", 'class="paddingright"').$adh->getFullName($langs, 0, -1, 20).' / '.dol_trunc($objp->company, 12).'</a></td>'."\n";
} else { } else {
print '<td><a href="card.php?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowMember"), "user").' '.$adh->getFullName($langs, 0, -1, 32).'</a></td>'."\n"; print '<td><a href="card.php?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowMember"), "user", 'class="paddingright"').$adh->getFullName($langs, 0, -1, 32).'</a></td>'."\n";
} }
// Login // Login
@ -640,9 +644,9 @@ if ($rowid > 0) {
// EMail // EMail
print "<td>".dol_print_email($objp->email, 0, 0, 1)."</td>\n"; print "<td>".dol_print_email($objp->email, 0, 0, 1)."</td>\n";
// Statut // Status
print '<td class="nowrap">'; print '<td class="nowrap">';
print $adh->LibStatut($objp->status, $objp->subscription, $datefin, 2); print $adh->getLibStatut(2);
print "</td>"; print "</td>";
// Date end subscription // Date end subscription
@ -668,11 +672,10 @@ if ($rowid > 0) {
// Actions // Actions
print '<td class="center">'; print '<td class="center">';
if ($user->rights->adherent->creer) { if ($user->rights->adherent->creer) {
print '<a class="editfielda" href="card.php?rowid='.$objp->rowid.'&action=edit&backtopage='.urlencode($_SERVER["PHP_SELF"].'?rowid='.$object->id).'">'.img_edit().'</a>'; print '<a class="editfielda marginleftonly" href="card.php?rowid='.$objp->rowid.'&action=edit&backtopage='.urlencode($_SERVER["PHP_SELF"].'?rowid='.$object->id).'">'.img_edit().'</a>';
} }
print '&nbsp;';
if ($user->rights->adherent->supprimer) { if ($user->rights->adherent->supprimer) {
print '<a href="card.php?rowid='.$objp->rowid.'&action=resign">'.img_picto($langs->trans("Resiliate"), 'disable.png').'</a>'; print '<a class="marginleftonly" href="card.php?rowid='.$objp->rowid.'&action=resign">'.img_picto($langs->trans("Resiliate"), 'disable.png').'</a>';
} }
print "</td>"; print "</td>";
@ -723,11 +726,11 @@ if ($rowid > 0) {
print '</td></tr>'; print '</td></tr>';
// Morphy // Morphy
$morphys[""] = $langs->trans("MorPhy"); $morphys[""] = $langs->trans("MorAndPhy");
$morphys["phy"] = $langs->trans("Physical"); $morphys["phy"] = $langs->trans("Physical");
$morphys["mor"] = $langs->trans("Moral"); $morphys["mor"] = $langs->trans("Moral");
print '<tr><td><span>'.$langs->trans("MemberNature").'</span></td><td>'; print '<tr><td><span>'.$langs->trans("MembersNature").'</span></td><td>';
print $form->selectarray("morphy", $morphys, GETPOSTISSET("morphy") ? GETPOST("morphy") : $object->morphy); print $form->selectarray("morphy", $morphys, GETPOSTISSET("morphy") ? GETPOST("morphy", 'aZ09') : $object->morphy);
print "</td></tr>"; print "</td></tr>";
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>'; print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';

View File

@ -3,6 +3,7 @@
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com> * Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
* Copyright (C) 2020 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -39,8 +40,7 @@ $result = restrictedArea($user, 'adherent', $id, '', '', 'socid', 'rowid', $objc
$result = $adherent->fetch($id); $result = $adherent->fetch($id);
if ($result <= 0) if ($result <= 0) {
{
dol_print_error($adherent->error); dol_print_error($adherent->error);
exit; exit;
} }
@ -48,8 +48,7 @@ if ($result <= 0)
$physicalperson = 1; $physicalperson = 1;
$company = new Societe($db); $company = new Societe($db);
if ($adherent->socid) if ($adherent->socid) {
{
$result = $company->fetch($adherent->socid); $result = $company->fetch($adherent->socid);
} }
@ -72,37 +71,35 @@ $v->setAddress("", "", $adherent->address, $adherent->town, $adherent->state, $a
$v->setLabel("", "", $adherent->address, $adherent->town, $adherent->state, $adherent->zip, $country, "TYPE=WORK"); $v->setLabel("", "", $adherent->address, $adherent->town, $adherent->state, $adherent->zip, $country, "TYPE=WORK");
$v->setEmail($adherent->email); $v->setEmail($adherent->email);
$v->setNote($adherent->note); $v->setNote($adherent->note_public);
$v->setTitle($adherent->poste); $v->setTitle($adherent->poste);
// Data from linked company // Data from linked company
if ($company->id) if ($company->id) {
{
$v->setURL($company->url, "TYPE=WORK"); $v->setURL($company->url, "TYPE=WORK");
if (! $adherent->phone_pro) $v->setPhoneNumber($company->phone, "TYPE=WORK;VOICE"); if (!$adherent->phone_pro) {
if (! $adherent->fax) $v->setPhoneNumber($company->fax, "TYPE=WORK;FAX"); $v->setPhoneNumber($company->phone, "TYPE=WORK;VOICE");
if (! $adherent->zip) $v->setAddress("", "", $company->address, $company->town, $company->state, $company->zip, $company->country, "TYPE=WORK;POSTAL"); }
if (!$adherent->fax) {
$v->setPhoneNumber($company->fax, "TYPE=WORK;FAX");
}
if (!$adherent->zip) {
$v->setAddress("", "", $company->address, $company->town, $company->state, $company->zip, $company->country, "TYPE=WORK;POSTAL");
}
// when company e-mail is empty, use only adherent e-mail // when company e-mail is empty, use only adherent e-mail
if (empty(trim($company->email))) if (empty(trim($company->email))) {
{
// was set before, don't set twice // was set before, don't set twice
} } elseif (empty(trim($adherent->email))) {
// when adherent e-mail is empty, use only company e-mail // when adherent e-mail is empty, use only company e-mail
elseif (empty(trim($adherent->email)))
{
$v->setEmail($company->email); $v->setEmail($company->email);
} } elseif (strtolower(end(explode("@", $adherent->email))) == strtolower(end(explode("@", $company->email)))) {
// when e-mail domain of adherent and company are the same, use adherent e-mail at first (and company e-mail at second) // when e-mail domain of adherent and company are the same, use adherent e-mail at first (and company e-mail at second)
elseif (strtolower(end(explode("@", $adherent->email))) == strtolower(end(explode("@", $company->email))))
{
$v->setEmail($adherent->email); $v->setEmail($adherent->email);
// support by Microsoft Outlook (2019 and possible earlier) // support by Microsoft Outlook (2019 and possible earlier)
$v->setEmail($company->email, 'INTERNET'); $v->setEmail($company->email, 'INTERNET');
} } else {
// when e-mail of adherent and company complete different use company e-mail at first (and adherent e-mail at second) // when e-mail of adherent and company complete different use company e-mail at first (and adherent e-mail at second)
else {
$v->setEmail($company->email); $v->setEmail($company->email);
// support by Microsoft Outlook (2019 and possible earlier) // support by Microsoft Outlook (2019 and possible earlier)
@ -110,12 +107,16 @@ if ($company->id)
} }
// Si adherent lie a un tiers non de type "particulier" // Si adherent lie a un tiers non de type "particulier"
if ($adherent->typent_code != 'TE_PRIVATE') $v->setOrg($company->name); if ($company->typent_code != 'TE_PRIVATE') {
$v->setOrg($company->name);
}
} }
// Personal informations // Personal informations
$v->setPhoneNumber($adherent->phone_perso, "TYPE=HOME;VOICE"); $v->setPhoneNumber($adherent->phone_perso, "TYPE=HOME;VOICE");
if ($adherent->birthday) $v->setBirthday($adherent->birthday); if ($adherent->birth) {
$v->setBirthday($adherent->birth);
}
$db->close(); $db->close();

View File

@ -378,9 +378,8 @@ if ($result)
print '<td class="center">'; print '<td class="center">';
if ($action != 'edit' || GETPOST('rowid') != $obj->rowid) if ($action != 'edit' || GETPOST('rowid') != $obj->rowid)
{ {
print '<a href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&mode='.$mode.'&action=edit&token='.newToken().((empty($user->entity) && $debug) ? '&debug=1' : '').'">'.img_edit().'</a>'; print '<a class="editfielda marginleftonly marginrightonly" href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&mode='.$mode.'&action=edit&token='.newToken().((empty($user->entity) && $debug) ? '&debug=1' : '').'">'.img_edit().'</a>';
print ' &nbsp; '; print '<a class="marginleftonly marginrightonly" href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&mode='.$mode.'&action=delete&token='.newToken().((empty($user->entity) && $debug) ? '&debug=1' : '').'">'.img_delete().'</a>';
print '<a href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&mode='.$mode.'&action=delete&token='.newToken().((empty($user->entity) && $debug) ? '&debug=1' : '').'">'.img_delete().'</a>';
} else { } else {
print '<input type="hidden" name="page" value="'.$page.'">'; print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="rowid" value="'.$id.'">'; print '<input type="hidden" name="rowid" value="'.$id.'">';

View File

@ -221,7 +221,9 @@ class PrestaShopWebservice
* Load XML from string. Can throw exception * Load XML from string. Can throw exception
* *
* @param string $response String from a CURL response * @param string $response String from a CURL response
* @return SimpleXMLElement status_code, response * @return SimpleXMLElement|boolean status_code, response
*
* @throw PrestaShopWebserviceException
*/ */
protected function parseXML($response) protected function parseXML($response)
{ {
@ -250,7 +252,9 @@ class PrestaShopWebservice
* Examples are given in the tutorial</p> * Examples are given in the tutorial</p>
* *
* @param array $options Options * @param array $options Options
* @return SimpleXMLElement status_code, response * @return SimpleXMLElement|boolean status_code, response
*
* @throw PrestaShopWebserviceException
*/ */
public function add($options) public function add($options)
{ {
@ -268,10 +272,10 @@ class PrestaShopWebservice
} else { } else {
throw new PrestaShopWebserviceException('Bad parameters given'); throw new PrestaShopWebserviceException('Bad parameters given');
} }
$request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => $xml)); $request = $this->executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => $xml));
self::checkStatusCode($request['status_code']); $this->checkStatusCode($request['status_code']);
return self::parseXML($request['response']); return $this->parseXML($request['response']);
} }
/** /**
@ -300,7 +304,9 @@ class PrestaShopWebservice
* ?> * ?>
* </code> * </code>
* @param array $options Array representing resource to get. * @param array $options Array representing resource to get.
* @return SimpleXMLElement status_code, response * @return SimpleXMLElement|boolean status_code, response
*
* @throw PrestaShopWebserviceException
*/ */
public function get($options) public function get($options)
{ {
@ -326,9 +332,9 @@ class PrestaShopWebservice
throw new PrestaShopWebserviceException('Bad parameters given '); throw new PrestaShopWebserviceException('Bad parameters given ');
} }
$request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'GET')); $request = $this->executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'GET'));
self::checkStatusCode($request['status_code']); // check the response validity $this->checkStatusCode($request['status_code']); // check the response validity
return self::parseXML($request['response']); return $this->parseXML($request['response']);
} }
/** /**
@ -336,6 +342,8 @@ class PrestaShopWebservice
* *
* @param array $options Array representing resource for head request. * @param array $options Array representing resource for head request.
* @return SimpleXMLElement status_code, response * @return SimpleXMLElement status_code, response
*
* @throw PrestaShopWebserviceException
*/ */
public function head($options) public function head($options)
{ {
@ -358,8 +366,8 @@ class PrestaShopWebservice
} else { } else {
throw new PrestaShopWebserviceException('Bad parameters given'); throw new PrestaShopWebserviceException('Bad parameters given');
} }
$request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'HEAD', CURLOPT_NOBODY => true)); $request = $this->executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'HEAD', CURLOPT_NOBODY => true));
self::checkStatusCode($request['status_code']); // check the response validity $this->checkStatusCode($request['status_code']); // check the response validity
return $request['header']; return $request['header'];
} }
/** /**
@ -371,7 +379,9 @@ class PrestaShopWebservice
* Examples are given in the tutorial</p> * Examples are given in the tutorial</p>
* *
* @param array $options Array representing resource to edit. * @param array $options Array representing resource to edit.
* @return SimpleXMLElement status_code, response * @return SimpleXMLElement|boolean status_code, response
*
* @throw PrestaShopWebserviceException
*/ */
public function edit($options) public function edit($options)
{ {
@ -390,9 +400,9 @@ class PrestaShopWebservice
throw new PrestaShopWebserviceException('Bad parameters given'); throw new PrestaShopWebserviceException('Bad parameters given');
} }
$request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_POSTFIELDS => $xml)); $request = $this->executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_POSTFIELDS => $xml));
self::checkStatusCode($request['status_code']); // check the response validity $this->checkStatusCode($request['status_code']); // check the response validity
return self::parseXML($request['response']); return $this->parseXML($request['response']);
} }
} }

View File

@ -0,0 +1 @@

View File

@ -0,0 +1 @@

View File

@ -688,61 +688,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
{ {
print info_admin($debuginfo); print info_admin($debuginfo);
} }
// Select mail models is same action as presend
if (GETPOST('modelselected')) {
$action = 'presend';
}
/*
if ($action != 'presend') {
print '<div class="fichecenter"><div class="fichehalfleft">';
print '<a name="builddoc"></a>'; // ancre
*/
// Documents
/*$objref = dol_sanitizeFileName($object->ref);
$relativepath = $comref . '/' . $comref . '.pdf';
$filedir = $conf->emailcollector->dir_output . '/' . $objref;
$urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
$genallowed = $user->rights->emailcollector->read; // If you can read, you can build the PDF to read content
$delallowed = $user->rights->emailcollector->create; // If you can create/edit, you can remove a file on card
print $formfile->showdocuments('emailcollector', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang);
*/
/*
// Show links to link elements
$linktoelem = $form->showLinkToObjectBlock($object, null, array('emailcollector'));
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
$MAXEVENT = 10;
$morehtmlright = '<a href="' . dol_buildpath('/emailcollector/emailcollector_info.php', 1) . '?id=' . $object->id . '">';
$morehtmlright .= $langs->trans("SeeAll");
$morehtmlright .= '</a>';
// List of actions on element
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
$formactions = new FormActions($db);
$somethingshown = $formactions->showactions($object, 'emailcollector_emailcollector', $socid, 1, '', $MAXEVENT, '', $morehtmlright);
print '</div></div></div>';
}
*/
//Select mail models is same action as presend
/*
if (GETPOST('modelselected')) $action = 'presend';
// Presend form
$modelmail='inventory';
$defaulttopic='InformationMessage';
$diroutput = $conf->product->dir_output.'/inventory';
$trackid = 'stockinv'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
*/
} }
// End of page // End of page

View File

@ -393,7 +393,7 @@ foreach ($object->fields as $key => $val)
if (!empty($arrayfields['t.'.$key]['checked'])) if (!empty($arrayfields['t.'.$key]['checked']))
{ {
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">'; print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1); if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
elseif (strpos($val['type'], 'integer:') === 0) { elseif (strpos($val['type'], 'integer:') === 0) {
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1); print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1);
} elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">'; } elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';

View File

@ -118,7 +118,7 @@ foreach ($eventstolog as $key => $arr)
print '<td>'.$arr['id'].'</td>'; print '<td>'.$arr['id'].'</td>';
print '<td class="center">'; print '<td class="center">';
$key = 'MAIN_LOGEVENTS_'.$arr['id']; $key = 'MAIN_LOGEVENTS_'.$arr['id'];
$value = $conf->global->$key; $value = empty($conf->global->$key) ? '' : $conf->global->$key;
print '<input class="oddeven checkforselect" type="checkbox" name="'.$key.'" value="1"'.($value ? ' checked' : '').'>'; print '<input class="oddeven checkforselect" type="checkbox" name="'.$key.'" value="1"'.($value ? ' checked' : '').'>';
print '</td></tr>'."\n"; print '</td></tr>'."\n";
} }

View File

@ -216,9 +216,8 @@ if (empty($conf->use_javascript_ajax))
print '</form>'."\n"; print '</form>'."\n";
// Add env of ckeditor // Add env of ckeditor
// This is to show how CKEditor detect browser to understand why editor is disabled or not // This is to show how CKEditor detect browser to understand why editor is disabled or not. To help debug.
if (1 == 2) // Change this to enable output /*
{
print '<br><script language="javascript"> print '<br><script language="javascript">
function jsdump(obj, id) { function jsdump(obj, id) {
var out = \'\'; var out = \'\';
@ -232,6 +231,7 @@ if (empty($conf->use_javascript_ajax))
jsdump(CKEDITOR.env, "divforlog"); jsdump(CKEDITOR.env, "divforlog");
</script>'; </script>';
} }
*/
} }
// End of page // End of page

View File

@ -795,7 +795,7 @@ if ($action == 'edit')
{ {
if (!empty($conf->global->MAIN_EXTERNAL_MAIL_SPF_STRING_TO_ADD)) if (!empty($conf->global->MAIN_EXTERNAL_MAIL_SPF_STRING_TO_ADD))
{ {
// List of string to add in SPF if the setup use the mail method // List of string to add in SPF if the setup use the mail method. Example 'include:sendgrid.net include:spf.mydomain.com'
$text .= ($text ? '<br><br>' : '').$langs->trans("WarningPHPMailSPF", $conf->global->MAIN_EXTERNAL_MAIL_SPF_STRING_TO_ADD); $text .= ($text ? '<br><br>' : '').$langs->trans("WarningPHPMailSPF", $conf->global->MAIN_EXTERNAL_MAIL_SPF_STRING_TO_ADD);
} else { } else {
// MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS is list of IPs where email is sent from. Example: '1.2.3.4, [aaaa:bbbb:cccc:dddd]'. // MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS is list of IPs where email is sent from. Example: '1.2.3.4, [aaaa:bbbb:cccc:dddd]'.
@ -808,12 +808,13 @@ if ($action == 'edit')
} else { } else {
if (!empty($conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS)) if (!empty($conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS))
{ {
// List of IP show as record to add as allowed IP if we use the smtp method // List of IP show as record to add as allowed IP if we use the smtp method. Value is '1.2.3.4, [aaaa:bbbb:cccc:dddd]'
// TODO Add a key to allow to show the IP/name of server detected dynamically
$text .= ($text ? '<br><br>' : '').$langs->trans("WarningPHPMail2", $conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS); $text .= ($text ? '<br><br>' : '').$langs->trans("WarningPHPMail2", $conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS);
} }
if (!empty($conf->global->MAIN_EXTERNAL_SMTP_SPF_STRING_TO_ADD)) // Should be required only if you have set to use your own SMTP and wat to warn users to update their domain name to match your SMTP server. if (!empty($conf->global->MAIN_EXTERNAL_SMTP_SPF_STRING_TO_ADD)) // Should be required only if you have preset the Dolibarr to use your own SMTP and you want to warn users to update their domain name to match your SMTP server.
{ {
// List of string to add in SPF if we use the smtp method // List of string to add in SPF if we use the smtp method. Example 'include:spf.mydomain.com'
$text .= ($text ? '<br><br>' : '').$langs->trans("WarningPHPMailSPF", $conf->global->MAIN_EXTERNAL_SMTP_SPF_STRING_TO_ADD); $text .= ($text ? '<br><br>' : '').$langs->trans("WarningPHPMailSPF", $conf->global->MAIN_EXTERNAL_SMTP_SPF_STRING_TO_ADD);
} }
} }

View File

@ -427,7 +427,7 @@ print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorde
$topicmail = "Information"; $topicmail = "Information";
//$modelmail="subscription"; //$modelmail="subscription";
$objecttmp = new EmailSenderProfile($db); $objecttmp = new EmailSenderProfile($db);
//$trackid='sub'.$object->id; //$trackid = (($action == 'testhtml') ? "testhtml" : "test");
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
if ($search_all) if ($search_all)
@ -474,7 +474,7 @@ foreach ($object->fields as $key => $val)
if (!empty($arrayfields['t.'.$key]['checked'])) if (!empty($arrayfields['t.'.$key]['checked']))
{ {
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">'; print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1); if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
elseif (strpos($val['type'], 'integer:') === 0) { elseif (strpos($val['type'], 'integer:') === 0) {
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1); print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1);
} elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">'; } elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';

View File

@ -11,7 +11,7 @@
* Copyright (C) 2011-2016 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2011-2016 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -139,7 +139,15 @@ if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES))
$tabhelp = array(); $tabhelp = array();
$tabhelp[25] = array('topic'=>$helpsubstit, 'joinfiles'=>$langs->trans('AttachMainDocByDefault'), 'content'=>$helpsubstit, 'content_lines'=>$helpsubstitforlines, 'type_template'=>$langs->trans("TemplateForElement"), 'private'=>$langs->trans("TemplateIsVisibleByOwnerOnly"), 'position'=>$langs->trans("PositionIntoComboList")); $tabhelp[25] = array(
'topic'=>$helpsubstit,
'joinfiles'=>$langs->trans('AttachMainDocByDefault'),
'content'=>$helpsubstit,
'content_lines'=>$helpsubstitforlines,
'type_template'=>$langs->trans("TemplateForElement"),
'private'=>$langs->trans("TemplateIsVisibleByOwnerOnly"),
'position'=>$langs->trans("PositionIntoComboList")
);
// List of check for fields (NOT USED YET) // List of check for fields (NOT USED YET)
$tabfieldcheck = array(); $tabfieldcheck = array();
@ -154,22 +162,54 @@ $elementList = array();
$elementList['all'] = '-- '.dol_escape_htmltag($langs->trans("All")).' --'; $elementList['all'] = '-- '.dol_escape_htmltag($langs->trans("All")).' --';
$elementList['none'] = '-- '.dol_escape_htmltag($langs->trans("None")).' --'; $elementList['none'] = '-- '.dol_escape_htmltag($langs->trans("None")).' --';
$elementList['user'] = img_picto('', 'user', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToUser')); $elementList['user'] = img_picto('', 'user', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToUser'));
if ($conf->adherent->enabled && $user->rights->adherent->lire) $elementList['member'] = img_picto('', 'object_member', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToMember')); if ($conf->adherent->enabled && $user->rights->adherent->lire) {
if ($conf->recruitment->enabled && $user->rights->recruitment->recruitmentjobposition->read) $elementList['recruitmentcandidature_send'] = img_picto('', 'recruitmentcandidature', 'class="paddingright"').dol_escape_htmltag($langs->trans('RecruitmentCandidatures')); $elementList['member'] = img_picto('', 'object_member', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToMember'));
if ($conf->societe->enabled && $user->rights->societe->lire) $elementList['thirdparty'] = img_picto('', 'company', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToThirdparty')); }
if ($conf->projet->enabled) $elementList['project'] = img_picto('', 'project', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToProject')); if ($conf->recruitment->enabled && $user->rights->recruitment->recruitmentjobposition->read) {
if ($conf->propal->enabled && $user->rights->propal->lire) $elementList['propal_send'] = dol_escape_htmltag($langs->trans('MailToSendProposal')); $elementList['recruitmentcandidature_send'] = img_picto('', 'recruitmentcandidature', 'class="paddingright"').dol_escape_htmltag($langs->trans('RecruitmentCandidatures'));
if ($conf->commande->enabled && $user->rights->commande->lire) $elementList['order_send'] = dol_escape_htmltag($langs->trans('MailToSendOrder')); }
if ($conf->facture->enabled && $user->rights->facture->lire) $elementList['facture_send'] = dol_escape_htmltag($langs->trans('MailToSendInvoice')); if ($conf->societe->enabled && $user->rights->societe->lire) {
if ($conf->expedition->enabled) $elementList['shipping_send'] = dol_escape_htmltag($langs->trans('MailToSendShipment')); $elementList['thirdparty'] = img_picto('', 'company', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToThirdparty'));
if ($conf->reception->enabled) $elementList['reception_send'] = dol_escape_htmltag($langs->trans('MailToSendReception')); }
if ($conf->ficheinter->enabled) $elementList['fichinter_send'] = dol_escape_htmltag($langs->trans('MailToSendIntervention')); if ($conf->projet->enabled) {
if ($conf->supplier_proposal->enabled) $elementList['supplier_proposal_send'] = dol_escape_htmltag($langs->trans('MailToSendSupplierRequestForQuotation')); $elementList['project'] = img_picto('', 'project', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToProject'));
if (($conf->fournisseur->enabled && $user->rights->fournisseur->commande->lire && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || ($conf->supplier_order->enabled && $user->rights->supplier_order->lire)) $elementList['order_supplier_send'] = dol_escape_htmltag($langs->trans('MailToSendSupplierOrder')); }
if (($conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || ($conf->supplier_invoice->enabled && $user->rights->supplier_invoice->lire)) $elementList['invoice_supplier_send'] = dol_escape_htmltag($langs->trans('MailToSendSupplierInvoice')); if ($conf->propal->enabled && $user->rights->propal->lire) {
if ($conf->contrat->enabled && $user->rights->contrat->lire) $elementList['contract'] = img_picto('', 'contract', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendContract')); $elementList['propal_send'] = img_picto('', 'propal', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendProposal'));
if ($conf->ticket->enabled && $user->rights->ticket->read) $elementList['ticket_send'] = img_picto('', 'ticket', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToTicket')); }
if ($conf->agenda->enabled) $elementList['actioncomm_send'] = img_picto('', 'action', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendEventPush')); if ($conf->commande->enabled && $user->rights->commande->lire) {
$elementList['order_send'] = img_picto('', 'order', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendOrder'));
}
if ($conf->facture->enabled && $user->rights->facture->lire) {
$elementList['facture_send'] = img_picto('', 'bill', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendInvoice'));
}
if ($conf->expedition->enabled) {
$elementList['shipping_send'] = img_picto('', 'dolly', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendShipment'));
}
if ($conf->reception->enabled) {
$elementList['reception_send'] = img_picto('', 'dolly', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendReception'));
}
if ($conf->ficheinter->enabled) {
$elementList['fichinter_send'] = img_picto('', 'intervention', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendIntervention'));
}
if ($conf->supplier_proposal->enabled) {
$elementList['supplier_proposal_send'] = img_picto('', 'propal', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendSupplierRequestForQuotation'));
}
if (($conf->fournisseur->enabled && $user->rights->fournisseur->commande->lire && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || ($conf->supplier_order->enabled && $user->rights->supplier_order->lire)) {
$elementList['order_supplier_send'] = img_picto('', 'order', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendSupplierOrder'));
}
if (($conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || ($conf->supplier_invoice->enabled && $user->rights->supplier_invoice->lire)) {
$elementList['invoice_supplier_send'] = img_picto('', 'bill', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendSupplierInvoice'));
}
if ($conf->contrat->enabled && $user->rights->contrat->lire) {
$elementList['contract'] = img_picto('', 'contract', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendContract'));
}
if ($conf->ticket->enabled && $user->rights->ticket->read) {
$elementList['ticket_send'] = img_picto('', 'ticket', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToTicket'));
}
if ($conf->agenda->enabled) {
$elementList['actioncomm_send'] = img_picto('', 'action', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendEventPush'));
}
$parameters = array('elementList'=>$elementList); $parameters = array('elementList'=>$elementList);
$reshook = $hookmanager->executeHooks('emailElementlist', $parameters); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('emailElementlist', $parameters); // Note that $action and $object may have been modified by some hooks
@ -188,18 +228,22 @@ $id = 25;
* Actions * Actions
*/ */
if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; } if (GETPOST('cancel', 'alpha')) {
$action = 'list';
$massaction = '';
}
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; } if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; }
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if (empty($reshook)) if (empty($reshook)) {
{
// Purge search criteria // Purge search criteria
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
{ // All tests are required to be compatible with all browsers
$search_label = ''; $search_label = '';
$search_type_template = ''; $search_type_template = '';
$search_lang = ''; $search_lang = '';
@ -210,8 +254,7 @@ if (empty($reshook))
} }
// Actions add or modify an entry into a dictionary // Actions add or modify an entry into a dictionary
if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) {
{
$listfield = explode(',', str_replace(' ', '', $tabfield[$id])); $listfield = explode(',', str_replace(' ', '', $tabfield[$id]));
$listfieldinsert = explode(',', $tabfieldinsert[$id]); $listfieldinsert = explode(',', $tabfieldinsert[$id]);
$listfieldmodify = explode(',', $tabfieldinsert[$id]); $listfieldmodify = explode(',', $tabfieldinsert[$id]);
@ -219,8 +262,7 @@ if (empty($reshook))
// Check that all fields are filled // Check that all fields are filled
$ok = 1; $ok = 1;
foreach ($listfield as $f => $value) foreach ($listfield as $f => $value) {
{
// Not mandatory fields // Not mandatory fields
if ($value == 'joinfiles') continue; if ($value == 'joinfiles') continue;
if ($value == 'content') continue; if ($value == 'content') continue;
@ -662,7 +704,7 @@ if ($resql)
print '<td class="liste_titre"><input type="text" name="search_topic" value="'.dol_escape_htmltag($search_topic).'"></td>'; print '<td class="liste_titre"><input type="text" name="search_topic" value="'.dol_escape_htmltag($search_topic).'"></td>';
} elseif ($value == 'type_template') { } elseif ($value == 'type_template') {
print '<td class="liste_titre center">'; print '<td class="liste_titre center">';
print $form->selectarray('search_type_template', $elementList, $search_type_template, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth150', 1, '', 0, 1); print $form->selectarray('search_type_template', $elementList, $search_type_template, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth200', 1, '', 0, 1);
print '</td>'; print '</td>';
} elseif (!in_array($value, array('content', 'content_lines'))) { } elseif (!in_array($value, array('content', 'content_lines'))) {
print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>';
@ -1033,7 +1075,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
print '<input type="hidden" name="type_template" value="'.$obj->{$fieldlist[$field]}.'">'; print '<input type="hidden" name="type_template" value="'.$obj->{$fieldlist[$field]}.'">';
print $obj->{$fieldlist[$field]}; print $obj->{$fieldlist[$field]};
} else { } else {
print $form->selectarray('type_template', $elementList, (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:''), 1, 0, 0, '', 0, 0, 0, '', 'maxwidth150', 1, '', 0, 1); print $form->selectarray('type_template', $elementList, (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:''), 1, 0, 0, '', 0, 0, 0, '', 'maxwidth200', 1, '', 0, 1);
} }
print '</td>'; print '</td>';
} elseif ($context == 'add' && in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) continue; } elseif ($context == 'add' && in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) continue;

View File

@ -281,7 +281,7 @@ if ($action == 'set' && $user->admin)
$form = new Form($db); $form = new Form($db);
//$morejs = array("/admin/dolistore/js/dolistore.js.php"); $morejs = array();
$morecss = array("/admin/dolistore/css/dolistore.css"); $morecss = array("/admin/dolistore/css/dolistore.css");
// Set dir where external modules are installed // Set dir where external modules are installed
@ -402,7 +402,7 @@ foreach ($modulesdir as $dir)
$arrayofwarningsext[$modName] = $objMod->warnings_activation_ext; $arrayofwarningsext[$modName] = $objMod->warnings_activation_ext;
} }
$familyposition = $familyinfo[$familykey]['position']; $familyposition = (empty($familyinfo[$familykey]['position']) ? 0 : $familyinfo[$familykey]['position']);
$listOfOfficialModuleGroups = array('hr', 'technic', 'interface', 'technic', 'portal', 'financial', 'crm', 'base', 'products', 'srm', 'ecm', 'projects', 'other'); $listOfOfficialModuleGroups = array('hr', 'technic', 'interface', 'technic', 'portal', 'financial', 'crm', 'base', 'products', 'srm', 'ecm', 'projects', 'other');
if ($external && !in_array($familykey, $listOfOfficialModuleGroups)) if ($external && !in_array($familykey, $listOfOfficialModuleGroups))
{ {

View File

@ -51,35 +51,33 @@ if ($cancel) {
if ($action == 'update') if ($action == 'update')
{ {
dolibarr_set_const($db, "MAIN_PDF_FORMAT", $_POST["MAIN_PDF_FORMAT"], 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_PDF_FORMAT", GETPOST("MAIN_PDF_FORMAT"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PDF_MARGIN_LEFT", $_POST["MAIN_PDF_MARGIN_LEFT"], 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_PDF_MARGIN_LEFT", GETPOST("MAIN_PDF_MARGIN_LEFT"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PDF_MARGIN_RIGHT", $_POST["MAIN_PDF_MARGIN_RIGHT"], 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_PDF_MARGIN_RIGHT", GETPOST("MAIN_PDF_MARGIN_TOP"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PDF_MARGIN_TOP", $_POST["MAIN_PDF_MARGIN_TOP"], 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_PDF_MARGIN_BOTTOM", GETPOST("MAIN_PDF_MARGIN_BOTTOM"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PDF_MARGIN_BOTTOM", $_POST["MAIN_PDF_MARGIN_BOTTOM"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PROFID1_IN_ADDRESS", GETPOST("MAIN_PROFID1_IN_ADDRESS", "nohtml"), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_PROFID1_IN_ADDRESS", GETPOST("MAIN_PROFID1_IN_ADDRESS"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PROFID2_IN_ADDRESS", GETPOST("MAIN_PROFID2_IN_ADDRESS", "nohtml"), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_PROFID2_IN_ADDRESS", GETPOST("MAIN_PROFID2_IN_ADDRESS"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PROFID3_IN_ADDRESS", GETPOST("MAIN_PROFID3_IN_ADDRESS", "nohtml"), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_PROFID3_IN_ADDRESS", GETPOST("MAIN_PROFID3_IN_ADDRESS"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PROFID4_IN_ADDRESS", GETPOST("MAIN_PROFID4_IN_ADDRESS", "nohtml"), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_PROFID4_IN_ADDRESS", GETPOST("MAIN_PROFID4_IN_ADDRESS"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PROFID5_IN_ADDRESS", GETPOST("MAIN_PROFID5_IN_ADDRESS", "nohtml"), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_PROFID5_IN_ADDRESS", GETPOST("MAIN_PROFID5_IN_ADDRESS"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PROFID6_IN_ADDRESS", GETPOST("MAIN_PROFID6_IN_ADDRESS", "nohtml"), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_PROFID6_IN_ADDRESS", GETPOST("MAIN_PROFID6_IN_ADDRESS"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT", $_POST["MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT"], 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT", GETPOST("MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_TVAINTRA_NOT_IN_ADDRESS", $_POST["MAIN_TVAINTRA_NOT_IN_ADDRESS"], 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_TVAINTRA_NOT_IN_ADDRESS", GETPOST("MAIN_TVAINTRA_NOT_IN_ADDRESS"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS"], 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS", GETPOST("MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DESC", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_DESC"], 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DESC", GETPOST("MAIN_GENERATE_DOCUMENTS_HIDE_DESC"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_REF", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_REF"], 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_REF", GETPOST("MAIN_GENERATE_DOCUMENTS_HIDE_REF"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_DOCUMENTS_LOGO_HEIGHT", GETPOST("MAIN_DOCUMENTS_LOGO_HEIGHT", 'int'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_DOCUMENTS_LOGO_HEIGHT", GETPOST("MAIN_DOCUMENTS_LOGO_HEIGHT", 'int'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INVERT_SENDER_RECIPIENT", $_POST["MAIN_INVERT_SENDER_RECIPIENT"], 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INVERT_SENDER_RECIPIENT", GETPOST("MAIN_INVERT_SENDER_RECIPIENT"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PDF_USE_ISO_LOCATION", $_POST["MAIN_PDF_USE_ISO_LOCATION"], 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_PDF_USE_ISO_LOCATION", GETPOST("MAIN_PDF_USE_ISO_LOCATION"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS", $_POST["MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS"], 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS", GETPOST("MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_SECOND_TAX", GETPOST("MAIN_PDF_MAIN_HIDE_SECOND_TAX"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_SECOND_TAX", $_POST["MAIN_PDF_MAIN_HIDE_SECOND_TAX"], 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_THIRD_TAX", GETPOST("MAIN_PDF_MAIN_HIDE_THIRD_TAX"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_THIRD_TAX", $_POST["MAIN_PDF_MAIN_HIDE_THIRD_TAX"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "PDF_USE_ALSO_LANGUAGE_CODE", GETPOST('PDF_USE_ALSO_LANGUAGE_CODE', 'alpha'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "PDF_USE_ALSO_LANGUAGE_CODE", GETPOST('PDF_USE_ALSO_LANGUAGE_CODE', 'alpha'), 'chaine', 0, '', $conf->entity);

View File

@ -153,7 +153,7 @@ if (ini_get('safe_mode') && !empty($conf->global->MAIN_ANTIVIRUS_COMMAND))
dol_syslog("safe_mode is on, basedir is ".$basedir.", safe_mode_exec_dir is ".ini_get('safe_mode_exec_dir'), LOG_WARNING); dol_syslog("safe_mode is on, basedir is ".$basedir.", safe_mode_exec_dir is ".ini_get('safe_mode_exec_dir'), LOG_WARNING);
} }
} }
print '<input type="text" name="MAIN_ANTIVIRUS_COMMAND" class="minwidth500imp" value="'.(!empty($conf->global->MAIN_ANTIVIRUS_COMMAND) ?dol_escape_htmltag($conf->global->MAIN_ANTIVIRUS_COMMAND) : '').'">'; print '<input type="text" '.(defined('MAIN_ANTIVIRUS_COMMAND') ? 'disabled' : '').' name="MAIN_ANTIVIRUS_COMMAND" class="minwidth500imp" value="'.(!empty($conf->global->MAIN_ANTIVIRUS_COMMAND) ?dol_escape_htmltag($conf->global->MAIN_ANTIVIRUS_COMMAND) : '').'">';
if (defined('MAIN_ANTIVIRUS_COMMAND')) { if (defined('MAIN_ANTIVIRUS_COMMAND')) {
print '<br><span class="opacitymedium">'.$langs->trans("ValueIsForcedBySystem").'</span>'; print '<br><span class="opacitymedium">'.$langs->trans("ValueIsForcedBySystem").'</span>';
} }

View File

@ -483,13 +483,15 @@ if ($virtualdiffersfromphysical)
print '</tr>'."\n"; print '</tr>'."\n";
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$langs->trans("UseVirtualStockByDefault").'</td>'; print '<td>';
print $form->textwithpicto($langs->trans("UseRealStockByDefault"), $langs->trans("ReplenishmentCalculation"));
print '</td>';
print '<td class="right">'; print '<td class="right">';
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_USE_VIRTUAL_STOCK'); print ajax_constantonoff('STOCK_USE_REAL_STOCK_BY_DEFAULT_FOR_REPLENISHMENT');
} else { } else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_USE_VIRTUAL_STOCK", $arrval, $conf->global->STOCK_USE_VIRTUAL_STOCK); print $form->selectarray("STOCK_USE_REAL_STOCK_BY_DEFAULT_FOR_REPLENISHMENT", $arrval, $conf->global->STOCK_USE_REAL_STOCK_BY_DEFAULT_FOR_REPLENISHMENT);
} }
print "</td>\n"; print "</td>\n";
print "</tr>\n"; print "</tr>\n";
@ -668,8 +670,8 @@ print load_fiche_titre($langs->trans("Other"), '', '');
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print "<td>".$langs->trans("Other")."</td>\n"; print "<td>".$langs->trans("Parameter")."</td>\n";
print '<td class="right">'.$langs->trans("Status").'</td>'."\n"; print '<td class="right">'.$langs->trans("Value").'</td>'."\n";
print '</tr>'."\n"; print '</tr>'."\n";
print '<tr class="oddeven">'; print '<tr class="oddeven">';

View File

@ -83,6 +83,7 @@ print '<li>';
print '<a target="_blank" href="https://www.dolibarr.org/" rel="external">'.$langs->trans("OfficialWebSite").'</a>'; print '<a target="_blank" href="https://www.dolibarr.org/" rel="external">'.$langs->trans("OfficialWebSite").'</a>';
print '</li>'; print '</li>';
// Show local site // Show local site
/*
if (preg_match('/^fr_/i', $langs->getDefaultLang())) if (preg_match('/^fr_/i', $langs->getDefaultLang()))
{ {
print '<li>'; print '<li>';
@ -112,7 +113,7 @@ if (preg_match('/^de_/i', $langs->getDefaultLang()))
print '<li>'; print '<li>';
print '<a target="_blank" href="https://www.dolibarr.de/" rel="external">'.$langs->trans("OfficialWebSiteLocal", $langs->transnoentitiesnoconv("Germany")).'</a>'; print '<a target="_blank" href="https://www.dolibarr.de/" rel="external">'.$langs->trans("OfficialWebSiteLocal", $langs->transnoentitiesnoconv("Germany")).'</a>';
print '</li>'; print '</li>';
} }*/
print '<li>'; print '<li>';
print '<a target="_blank" href="https://wiki.dolibarr.org/" rel="external">'.$langs->trans("OfficialWiki").'</a>'; print '<a target="_blank" href="https://wiki.dolibarr.org/" rel="external">'.$langs->trans("OfficialWiki").'</a>';
print '</li>'; print '</li>';
@ -168,7 +169,7 @@ print $langs->trans("OtherResources").':';
print '<ul>'; print '<ul>';
$url = 'https://saas.dolibarr.org'; $title = $langs->trans("OfficialWebHostingService"); $url = 'https://saas.dolibarr.org'; $title = $langs->trans("OfficialWebHostingService");
if (preg_match('/^fr_/i', $langs->getDefaultLang())) $url = 'https://wiki.dolibarr.org/index.php/Solutions_de_Cloud'; if (preg_match('/^fr_/i', $langs->getDefaultLang())) $url = 'https://wiki.dolibarr.org/index.php/Solutions_Cloud_pour_Dolibarr_ERP_CRM';
if (preg_match('/^es_/i', $langs->getDefaultLang())) $url = 'https://wiki.dolibarr.org/index.php/Soluciones_en_la_Nube'; if (preg_match('/^es_/i', $langs->getDefaultLang())) $url = 'https://wiki.dolibarr.org/index.php/Soluciones_en_la_Nube';
print '<li>'; print '<li>';
print '<a target="_blank" href="'.$url.'" rel="external">'.$title.'</a>'; print '<a target="_blank" href="'.$url.'" rel="external">'.$title.'</a>';

View File

@ -50,7 +50,11 @@ if ($action == 'getlastversion')
{ {
$result = getURLContent('https://sourceforge.net/projects/dolibarr/rss'); $result = getURLContent('https://sourceforge.net/projects/dolibarr/rss');
//var_dump($result['content']); //var_dump($result['content']);
if (function_exists('simplexml_load_string')) {
$sfurl = simplexml_load_string($result['content']); $sfurl = simplexml_load_string($result['content']);
} else {
setEventMessages($langs->trans("ErrorPHPDoesNotSupport", "xml"), null, 'errors');
}
} }

View File

@ -62,7 +62,7 @@ print "<br><strong>Web server</strong> - ".$langs->trans("Version").": ".$_SERVE
print '<br>'; print '<br>';
print '<strong>'.$langs->trans("XDebug").'</strong>: '; print '<strong>'.$langs->trans("XDebug").'</strong>: ';
$test = !function_exists('xdebug_is_enabled'); $test = !function_exists('xdebug_is_enabled');
if ($test) print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled"); if ($test) print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled").' - '.$langs->trans("NotSlowedDownByThis");
else { else {
print img_picto('', 'warning').' '.$langs->trans("ModuleActivated", $langs->transnoentities("XDebug")); print img_picto('', 'warning').' '.$langs->trans("ModuleActivated", $langs->transnoentities("XDebug"));
print ' - '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php">XDebug admin page</a>'; print ' - '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php">XDebug admin page</a>';
@ -73,7 +73,7 @@ print '<br>';
print '<br>'; print '<br>';
print '<strong>'.$langs->trans("Syslog").'</strong>: '; print '<strong>'.$langs->trans("Syslog").'</strong>: ';
$test = empty($conf->syslog->enabled); $test = empty($conf->syslog->enabled);
if ($test) print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled"); if ($test) print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled").' - '.$langs->trans("NotSlowedDownByThis");
else { else {
print img_picto('', 'warning').' '.$langs->trans("ModuleActivated", $langs->transnoentities("Syslog")); print img_picto('', 'warning').' '.$langs->trans("ModuleActivated", $langs->transnoentities("Syslog"));
//print ' '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php'.'">XDebug admin page</a>'; //print ' '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php'.'">XDebug admin page</a>';
@ -84,7 +84,7 @@ print '<br>';
print '<br>'; print '<br>';
print '<strong>'.$langs->trans("DebugBar").'</strong>: '; print '<strong>'.$langs->trans("DebugBar").'</strong>: ';
$test = empty($conf->debugbar->enabled); $test = empty($conf->debugbar->enabled);
if ($test) print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled"); if ($test) print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled").' - '.$langs->trans("NotSlowedDownByThis");
else { else {
print img_picto('', 'warning').' '.$langs->trans("ModuleActivated", $langs->transnoentities("DebugBar")); print img_picto('', 'warning').' '.$langs->trans("ModuleActivated", $langs->transnoentities("DebugBar"));
//print ' '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php'.'">XDebug admin page</a>'; //print ' '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php'.'">XDebug admin page</a>';

View File

@ -105,36 +105,21 @@ if (!isset($_GET["testget"]) && !isset($_POST["testpost"]) && !isset($_GET["main
print '</td></tr>'; print '</td></tr>';
print '<tr><td>Sessions support</td><td>'; print '<tr><td>Sessions support</td><td>';
if (!function_exists("session_id")) if (!function_exists("session_id"))
{ {
print '<img src="'.$ErrorPicturePath.'" alt="Error"> '.$langs->trans("ErrorPHPDoesNotSupportSessions"); print '<img src="'.$ErrorPicturePath.'" alt="Error"> '.$langs->trans("ErrorPHPDoesNotSupportSessions");
} else { } else {
print '<img src="'.$OkayPicturePath.'" alt="Ok"> '.$langs->trans("PHPSupportSessions"); print '<img src="'.$OkayPicturePath.'" alt="Ok"> '.$langs->trans("PHPSupportSessions");
} }
print '</td></tr>'; print '</td></tr>';
print '<tr><td>UTF-8 support</td><td>'; print '<tr><td>UTF-8 support</td><td>';
if (!function_exists("utf8_encode")) if (!function_exists("utf8_encode"))
{ {
print '<img src="'.$WarningPicturePath.'" alt="Warning"> '.$langs->trans("ErrorPHPDoesNotSupport", "UTF8"); print '<img src="'.$WarningPicturePath.'" alt="Warning"> '.$langs->trans("ErrorPHPDoesNotSupport", "UTF8");
} else { } else {
print '<img src="'.$OkayPicturePath.'" alt="Ok"> '.$langs->trans("PHPSupport", "UTF8"); print '<img src="'.$OkayPicturePath.'" alt="Ok"> '.$langs->trans("PHPSupport", "UTF8");
} }
print '</td></tr>';
print '<tr><td>MBString support</td><td>';
if (!function_exists("mb_check_encoding"))
{
print '<img src="'.$WarningPicturePath.'" alt="Warning"> '.$langs->trans("ErrorPHPDoesNotSupport", "mbstring");
} else {
print '<img src="'.$OkayPicturePath.'" alt="Ok"> '.$langs->trans("PHPSupport", "mbstring");
}
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
@ -153,6 +138,28 @@ print '<td align="center">'.$langs->trans("FunctionTest").'</td>';
print '<td>'.$langs->trans("Result").'</td>'; print '<td>'.$langs->trans("Result").'</td>';
print '</tr>'; print '</tr>';
$functions = ["mb_check_encoding"];
$name = "MBString";
print "<tr>";
print "<td>".$name."</td>";
//print getTableColumn($name, $activatedExtensions);
print getTableColumn($name, $loadedExtensions);
print getTableColumnFunction($functions);
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
print "</tr>";
$functions = ["json_decode"];
$name = "JSON";
print "<tr>";
print "<td>".$name."</td>";
//print getTableColumn($name, $activatedExtensions);
print getTableColumn($name, $loadedExtensions);
print getTableColumnFunction($functions);
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
print "</tr>";
$functions = ["imagecreate"]; $functions = ["imagecreate"];
$name = "GD"; $name = "GD";
@ -186,7 +193,6 @@ if (empty($_SERVER["SERVER_ADMIN"]) || $_SERVER["SERVER_ADMIN"] != 'doliwamp@loc
print getTableColumn($name, $loadedExtensions); print getTableColumn($name, $loadedExtensions);
print getTableColumnFunction($functions); print getTableColumnFunction($functions);
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions); print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
print "</tr>"; print "</tr>";
} }
@ -225,7 +231,7 @@ foreach ($phparray as $key => $value)
print '<td>'.$keyparam.'</td>'; print '<td>'.$keyparam.'</td>';
$valtoshow = $keyvalue; $valtoshow = $keyvalue;
if ($keyparam == 'X-ChromePhp-Data') $valtoshow = dol_trunc($keyvalue, 80); if ($keyparam == 'X-ChromePhp-Data') $valtoshow = dol_trunc($keyvalue, 80);
print '<td colspan="2">'; print '<td colspan="2" class="wordbreak">';
if ($keyparam == 'Path') $valtoshow = implode('; ', explode(';', trim($valtoshow))); if ($keyparam == 'Path') $valtoshow = implode('; ', explode(';', trim($valtoshow)));
if ($keyparam == 'PATH') $valtoshow = implode('; ', explode(';', trim($valtoshow))); if ($keyparam == 'PATH') $valtoshow = implode('; ', explode(';', trim($valtoshow)));
if ($keyparam == '_SERVER["PATH"]') $valtoshow = implode('; ', explode(';', trim($valtoshow))); if ($keyparam == '_SERVER["PATH"]') $valtoshow = implode('; ', explode(';', trim($valtoshow)));
@ -425,7 +431,7 @@ function getResultColumn($name, array $activated, array $loaded, array $function
} }
$html = "<td>"; $html = "<td>";
$html .= $result ? $langs->trans("PHPSupport".$name) : $langs->trans("ErrorPHPDoesNotSupport".$name); $html .= $result ? $langs->trans("PHPSupport", $name) : $langs->trans("ErrorPHPDoesNotSupport".$name);
$html .= "</td>"; $html .= "</td>";
return $html; return $html;

View File

@ -25,6 +25,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/events.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("install", "other", "admin")); $langs->loadLangs(array("install", "other", "admin"));
@ -52,7 +53,7 @@ print load_fiche_titre($langs->trans("Security"), '', 'title_setup');
print '<span class="opacitymedium">'.$langs->trans("YouMayFindSecurityAdviceHere", 'hhttps://wiki.dolibarr.org/index.php/Security_information').'</span> (<a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("Reload").'</a>)<br>'; print '<span class="opacitymedium">'.$langs->trans("YouMayFindSecurityAdviceHere", 'hhttps://wiki.dolibarr.org/index.php/Security_information').'</span> (<a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("Reload").'</a>)<br>';
print '<br>'; print '<br>';
print load_fiche_titre($langs->trans("PHPSetup"), '', ''); print load_fiche_titre($langs->trans("PHPSetup"), '', 'folder');
// Get version of PHP // Get version of PHP
$phpversion = version_php(); $phpversion = version_php();
@ -66,43 +67,55 @@ print "<strong>PHP safe_mode</strong> = ".(ini_get('safe_mode') ? ini_get('safe_
print "<strong>PHP open_basedir</strong> = ".(ini_get('open_basedir') ? ini_get('open_basedir') : yn(0))."<br>\n"; print "<strong>PHP open_basedir</strong> = ".(ini_get('open_basedir') ? ini_get('open_basedir') : yn(0))."<br>\n";
print '<br>'; print '<br>';
print load_fiche_titre($langs->trans("ConfigFile"), '', '');
print '<strong>'.$langs->trans("dolibarr_main_prod").'</strong>: '.$dolibarr_main_prod;
// dolibarr_main_prod
print '<br>';
print '<br>';
print load_fiche_titre($langs->trans("PermissionsOnFiles"), '', '');
print '<strong>'.$langs->trans("PermissionOnFileInWebRoot").'</strong>: ';
// TODO
print 'TODO';
print '<br>';
print '<br>';
print load_fiche_titre($langs->trans("Modules"), '', '');
// XDebug // XDebug
print '<strong>'.$langs->trans("XDebug").'</strong>: '; print '<strong>'.$langs->trans("XDebug").'</strong>: ';
$test = !function_exists('xdebug_is_enabled'); $test = !function_exists('xdebug_is_enabled');
if ($test) print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled"); if ($test) print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled").' - '.$langs->trans("NotRiskOfLeakWithThis");
else { else {
print img_picto('', 'warning').' '.$langs->trans("ModuleActivatedMayExposeInformation", $langs->transnoentities("XDebug")); print img_picto('', 'warning').' '.$langs->trans("ModuleActivatedMayExposeInformation", $langs->transnoentities("XDebug"));
print ' - '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php">XDebug admin page</a>'; print ' - '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php">XDebug admin page</a>';
} }
print '<br>'; print '<br>';
// Module log
print '<br>'; print '<br>';
print load_fiche_titre($langs->trans("ConfigFile"), '', 'folder');
print '<strong>'.$langs->trans("dolibarr_main_prod").'</strong>: '.$dolibarr_main_prod;
if (empty($dolibarr_main_prod)) {
print ' &nbsp; '.img_picto('', 'warning').' '.$langs->trans("IfYouAreOnAProductionSetThis", 1);
}
print '<br>';
print '<strong>'.$langs->trans("dolibarr_nocsrfcheck").'</strong>: '.$dolibarr_nocsrfcheck;
if (!empty($dolibarr_nocsrfcheck)) {
print img_picto('', 'warning').' &nbsp; '.$langs->trans("IfYouAreOnAProductionSetThis", 0);
}
print '<br>';
print '<br>';
print '<br>';
print load_fiche_titre($langs->trans("Permissions"), '', 'folder');
print '<strong>'.$langs->trans("PermissionsOnFilesInWebRoot").'</strong>: ';
// TODO Check permission are read only except for custom dir
print 'TODO';
print '<br>';
print '<strong>'.$langs->trans("PermissionsOnFile", 'conf.php').'</strong>: ';
// TODO Check permission on file conf.php (read only for the web user)
print 'TODO';
print '<br>';
print '<br>';
print '<br>';
print load_fiche_titre($langs->trans("Modules"), '', 'folder');
// Module log
print '<strong>'.$langs->trans("Syslog").'</strong>: '; print '<strong>'.$langs->trans("Syslog").'</strong>: ';
$test = empty($conf->syslog->enabled); $test = empty($conf->syslog->enabled);
if ($test) print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled"); if ($test) print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled").' - '.$langs->trans("NotRiskOfLeakWithThis");
else { else {
print img_picto('', 'warning').' '.$langs->trans("ModuleActivatedMayExposeInformation", $langs->transnoentities("Syslog")); print img_picto('', 'warning').' '.$langs->trans("ModuleActivatedMayExposeInformation", $langs->transnoentities("Syslog"));
//print ' '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php'.'">XDebug admin page</a>'; //print ' '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php'.'">XDebug admin page</a>';
@ -110,35 +123,53 @@ else {
print '<br>'; print '<br>';
// Module debugbar // Module debugbar
print '<br>';
print '<strong>'.$langs->trans("DebugBar").'</strong>: '; print '<strong>'.$langs->trans("DebugBar").'</strong>: ';
$test = empty($conf->debugbar->enabled); $test = empty($conf->debugbar->enabled);
if ($test) print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled"); if ($test) print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled").' - '.$langs->trans("NotRiskOfLeakWithThis");
else { else {
print img_picto('', 'error').' '.$langs->trans("ModuleActivatedDoNotUseInProduction", $langs->transnoentities("DebugBar")); print img_picto('', 'error').' '.$langs->trans("ModuleActivatedDoNotUseInProduction", $langs->transnoentities("DebugBar"));
//print ' '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php'.'">XDebug admin page</a>'; //print ' '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php'.'">XDebug admin page</a>';
} }
print '<br>'; print '<br>';
print '<br>';
print load_fiche_titre($langs->trans("SecuritySetup"), '', ''); print '<br>';
print '<br>';
print load_fiche_titre($langs->trans("Menu").' '.$langs->trans("SecuritySetup"), '', 'folder');
//print '<strong>'.$langs->trans("PasswordEncryption").'</strong>: '; //print '<strong>'.$langs->trans("PasswordEncryption").'</strong>: ';
print '<strong>MAIN_SECURITY_HASH_ALGO</strong> = '.$conf->global->MAIN_SECURITY_HASH_ALGO." &nbsp; (Recommanded value: 'password_hash')<br>"; print '<strong>MAIN_SECURITY_HASH_ALGO</strong> = '.(empty($conf->global->MAIN_SECURITY_HASH_ALGO) ? 'unset' : '')." &nbsp; ";
print '<span class="opacitymedium"> &nbsp; If unset: \'md5\'</span> ';
print '<span class="opacitymedium"> - Recommanded value: \'password_hash\'</span><br>';
print '<strong>MAIN_SECURITY_SALT</strong> = '.$conf->global->MAIN_SECURITY_SALT.'<br>'; print '<strong>MAIN_SECURITY_SALT</strong> = '.$conf->global->MAIN_SECURITY_SALT.'<br>';
print '<br>'; print '<br>';
// TODO // TODO
print '<strong>'.$langs->trans("AntivirusEnabledOnUpload").'</strong>: '; print '<strong>'.$langs->trans("AntivirusEnabledOnUpload").'</strong>: ';
// TODO print yn($conf->global->MAIN_ANTIVIRUS_COMMAND ? 1 : 0);
if (!empty($conf->global->MAIN_ANTIVIRUS_COMMAND)) {
print ' &nbsp; - '.$conf->global->MAIN_ANTIVIRUS_COMMAND;
if (defined('MAIN_ANTIVIRUS_COMMAND')) {
print ' - <span class="opacitymedium">'.$langs->trans("ValueIsForcedBySystem").'</span>';
}
}
print '<br>'; print '<br>';
print '<br>'; print '<br>';
print '<strong>'.$langs->trans("SecurityAudit").'</strong>: '; $securityevent = new Events($db);
// TODO Disabled or enabled ? $eventstolog = $securityevent->eventstolog;
print '<br>';
print '<strong>'.$langs->trans("LogEvents").'</strong>: ';
// Loop on each event type
foreach ($eventstolog as $key => $arr)
{
if ($arr['id'])
{
$key = 'MAIN_LOGEVENTS_'.$arr['id'];
$value = empty($conf->global->$key) ? '' : $conf->global->$key;
if ($value) print $key.', ';
}
}

View File

@ -6,6 +6,7 @@
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2011 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2020 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -42,6 +43,8 @@ $action = GETPOST('action', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha');
$value = GETPOST('value', 'alpha'); $value = GETPOST('value', 'alpha');
$label = GETPOST('label', 'alpha');
$scandir = GETPOST('scandir', 'alpha');
$type = 'user'; $type = 'user';

View File

@ -1,6 +1,7 @@
<?php <?php
/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> /* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2020 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -91,8 +92,8 @@ class DolibarrApi
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param Object $object Object to clean
* @return array Array of cleaned object properties * @return Object Object with cleaned properties
*/ */
protected function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
@ -220,11 +221,9 @@ class DolibarrApi
} }
} }
if (!empty($object->thirdparty) && is_object($object->thirdparty)) if (!empty($object->thirdparty) && is_object($object->thirdparty)) {
{
$this->_cleanObjectDatas($object->thirdparty); $this->_cleanObjectDatas($object->thirdparty);
} }
return $object; return $object;
} }

View File

@ -229,9 +229,7 @@ class Documents extends DolibarrApi
if ($result <= 0) { if ($result <= 0) {
throw new RestException(500, 'Error generating document'); throw new RestException(500, 'Error generating document');
} }
} } else {
else
{
throw new RestException(403, 'Generation not available for this modulepart'); throw new RestException(403, 'Generation not available for this modulepart');
} }
@ -277,6 +275,8 @@ class Documents extends DolibarrApi
} }
$id = (empty($id) ? 0 : $id); $id = (empty($id) ? 0 : $id);
$recursive = 0;
$type = 'files';
if ($modulepart == 'societe' || $modulepart == 'thirdparty') if ($modulepart == 'societe' || $modulepart == 'thirdparty')
{ {
@ -474,15 +474,29 @@ class Documents extends DolibarrApi
} }
$upload_dir = $conf->categorie->multidir_output[$object->entity].'/'.get_exdir($object->id, 2, 0, 0, $object, 'category').$object->id."/photos/".dol_sanitizeFileName($object->ref); $upload_dir = $conf->categorie->multidir_output[$object->entity].'/'.get_exdir($object->id, 2, 0, 0, $object, 'category').$object->id."/photos/".dol_sanitizeFileName($object->ref);
} } elseif ($modulepart == 'ecm') {
else throw new RestException(500, 'Modulepart Ecm not implemented yet.');
{ // // require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php';
// if (!DolibarrApiAccess::$user->rights->ecm->read) {
// throw new RestException(401);
// }
// // $object = new EcmDirectory($this->db);
// // $result = $object->fetch($ref);
// // if (!$result) {
// // throw new RestException(404, 'EcmDirectory not found');
// // }
// $upload_dir = $conf->ecm->dir_output;
// $type = 'all';
// $recursive = 0;
} else {
throw new RestException(500, 'Modulepart '.$modulepart.' not implemented yet.'); throw new RestException(500, 'Modulepart '.$modulepart.' not implemented yet.');
} }
$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1); $filearray = dol_dir_list($upload_dir, $type, $recursive, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
if (empty($filearray)) { if (empty($filearray)) {
throw new RestException(404, 'Search for modulepart '.$modulepart.' with Id '.$object->id.(!empty($object->Ref) ? ' or Ref '.$object->ref : '').' does not return any document.'); throw new RestException(404, 'Search for modulepart '.$modulepart.' with Id '.$object->id.(!empty($object->ref) ? ' or Ref '.$object->ref : '').' does not return any document.');
} }
return $filearray; return $filearray;
@ -594,9 +608,7 @@ class Documents extends DolibarrApi
{ {
$tmpreldir = dol_sanitizeFileName($object->project->ref).'/'; $tmpreldir = dol_sanitizeFileName($object->project->ref).'/';
} }
} } else {
else
{
throw new RestException(500, 'Error while fetching Task '.$ref); throw new RestException(500, 'Error while fetching Task '.$ref);
} }
} }
@ -621,10 +633,8 @@ class Documents extends DolibarrApi
$modulepart = 'propale'; $modulepart = 'propale';
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
$object = new Propal($this->db); $object = new Propal($this->db);
} } else {
// TODO Implement additional moduleparts // TODO Implement additional moduleparts
else
{
throw new RestException(500, 'Modulepart '.$modulepart.' not implemented yet.'); throw new RestException(500, 'Modulepart '.$modulepart.' not implemented yet.');
} }
@ -662,9 +672,7 @@ class Documents extends DolibarrApi
{ {
throw new RestException(500, 'This value of modulepart does not support yet usage of ref. Check modulepart parameter or try to use subdir parameter instead of ref.'); throw new RestException(500, 'This value of modulepart does not support yet usage of ref. Check modulepart parameter or try to use subdir parameter instead of ref.');
} }
} } else {
else
{
if ($modulepart == 'invoice') $modulepart = 'facture'; if ($modulepart == 'invoice') $modulepart = 'facture';
if ($modulepart == 'member') $modulepart = 'adherent'; if ($modulepart == 'member') $modulepart = 'adherent';
@ -702,20 +710,16 @@ class Documents extends DolibarrApi
} }
$fhandle = @fopen($destfiletmp, 'w'); $fhandle = @fopen($destfiletmp, 'w');
if ($fhandle) if ($fhandle) {
{
$nbofbyteswrote = fwrite($fhandle, $newfilecontent); $nbofbyteswrote = fwrite($fhandle, $newfilecontent);
fclose($fhandle); fclose($fhandle);
@chmod($destfiletmp, octdec($conf->global->MAIN_UMASK)); @chmod($destfiletmp, octdec($conf->global->MAIN_UMASK));
} } else {
else
{
throw new RestException(500, "Failed to open file '".$destfiletmp."' for write"); throw new RestException(500, "Failed to open file '".$destfiletmp."' for write");
} }
$result = dol_move($destfiletmp, $destfile, 0, $overwriteifexists, 1); $result = dol_move($destfiletmp, $destfile, 0, $overwriteifexists, 1);
if (!$result) if (!$result) {
{
throw new RestException(500, "Failed to move file into '".$destfile."'"); throw new RestException(500, "Failed to move file into '".$destfile."'");
} }

View File

@ -3,7 +3,7 @@
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2017 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2017 Neil Orley <neil.orley@oeris.fr> * Copyright (C) 2017 Neil Orley <neil.orley@oeris.fr>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2020 Thibault FOUCART <support@ptibogxiv.net> * Copyright (C) 2018-2020 Thibault FOUCART <support@ptibogxiv.net>
* *
* *
@ -525,8 +525,8 @@ class Setup extends DolibarrApi
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param Object $object Object to clean
* @return array Array of cleaned object properties * @return Object Object with cleaned properties
*/ */
protected function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {

View File

@ -130,9 +130,6 @@ class Asset extends CommonObject
*/ */
public $description; public $description;
public $note_public;
public $note_private;
/** /**
* @var integer|string date_creation * @var integer|string date_creation
*/ */
@ -151,6 +148,9 @@ class Asset extends CommonObject
*/ */
public $fk_user_modif; public $fk_user_modif;
/**
* @var string import key
*/
public $import_key; public $import_key;
/** /**

View File

@ -339,7 +339,7 @@ print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sort
$topicmail = "SendAssetsRef"; $topicmail = "SendAssetsRef";
$modelmail = "asset"; $modelmail = "asset";
$objecttmp = new Asset($db); $objecttmp = new Asset($db);
$trackid = 'xxxx'.$object->id; $trackid = 'asset'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
if ($sall) if ($sall)
@ -386,7 +386,7 @@ foreach ($object->fields as $key => $val)
if (!empty($arrayfields['t.'.$key]['checked'])) if (!empty($arrayfields['t.'.$key]['checked']))
{ {
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">'; print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1); if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
elseif (strpos($val['type'], 'integer:') === 0) { elseif (strpos($val['type'], 'integer:') === 0) {
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1); print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1);
} elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">'; } elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';

View File

@ -69,8 +69,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
// Load object // Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
//if ($id > 0 || ! empty($ref)) $upload_dir = $conf->bom->multidir_output[$object->entity?$object->entity:1] . "/bom/" . dol_sanitizeFileName($object->id); if ($id > 0 || !empty($ref)) $upload_dir = $conf->bom->multidir_output[$object->entity ? $object->entity : 1]."/bom/".get_exdir(0, 0, 0, 1, $object);
if ($id > 0 || !empty($ref)) $upload_dir = $conf->bom->multidir_output[$object->entity ? $object->entity : 1]."/bom/".dol_sanitizeFileName($object->ref);
/* /*

View File

@ -439,7 +439,7 @@ print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sort
$topicmail = "SendBillOfMaterialsRef"; $topicmail = "SendBillOfMaterialsRef";
$modelmail = "bom"; $modelmail = "bom";
$objecttmp = new BOM($db); $objecttmp = new BOM($db);
$trackid = 'xxxx'.$object->id; $trackid = 'bom'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
if ($search_all) if ($search_all)
@ -486,7 +486,7 @@ foreach ($object->fields as $key => $val)
if (!empty($arrayfields['t.'.$key]['checked'])) if (!empty($arrayfields['t.'.$key]['checked']))
{ {
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">'; print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1); if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
elseif (strpos($val['type'], 'integer:') === 0) { elseif (strpos($val['type'], 'integer:') === 0) {
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1); print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1);
} elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">'; } elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';

View File

@ -1,6 +1,7 @@
<?php <?php
/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> /* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2019 Maxime Kohlhaas <maxime@atm-consulting.fr> * Copyright (C) 2019 Maxime Kohlhaas <maxime@atm-consulting.fr>
* Copyright (C) 2020 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -131,8 +132,7 @@ class Boms extends DolibarrApi
} }
if ($sqlfilters) if ($sqlfilters)
{ {
if (!DolibarrApi::_checkFilters($sqlfilters)) if (!DolibarrApi::_checkFilters($sqlfilters)) {
{
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
} }
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
@ -224,8 +224,7 @@ class Boms extends DolibarrApi
$this->bom->$field = $value; $this->bom->$field = $value;
} }
if ($this->bom->update($id, DolibarrApiAccess::$user) > 0) if ($this->bom->update(DolibarrApiAccess::$user) > 0) {
{
return $this->get($id); return $this->get($id);
} else { } else {
throw new RestException(500, $this->bom->error); throw new RestException(500, $this->bom->error);
@ -270,8 +269,8 @@ class Boms extends DolibarrApi
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param Object $object Object to clean
* @return array Array of cleaned object properties * @return Object Object with cleaned properties
*/ */
protected function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {

View File

@ -92,8 +92,10 @@ class BOM extends CommonObject
'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=> 1, 'default'=>1, 'index'=>1, 'position'=>5), 'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=> 1, 'default'=>1, 'index'=>1, 'position'=>5),
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'noteditable'=>1, 'visible'=>4, 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of BOM", 'showoncombobox'=>'1',), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'noteditable'=>1, 'visible'=>4, 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of BOM", 'showoncombobox'=>'1',),
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'autofocusoncreate'=>1), 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'autofocusoncreate'=>1),
'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,), //'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>1, 'position'=>10, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing', 1=>'Disassembly')),
'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>-1, 'position'=>32, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing')),
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:1:(finished IS NULL or finished <> 0)', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp'), 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:1:(finished IS NULL or finished <> 0)', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp'),
'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,),
'qty' => array('type'=>'real', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>55, 'notnull'=>1, 'isameasure'=>'1', 'css'=>'maxwidth75imp'), 'qty' => array('type'=>'real', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>55, 'notnull'=>1, 'isameasure'=>'1', 'css'=>'maxwidth75imp'),
//'efficiency' => array('type'=>'real', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>-1, 'default'=>1, 'position'=>100, 'notnull'=>0, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLossForProductProduced'), //'efficiency' => array('type'=>'real', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>-1, 'default'=>1, 'position'=>100, 'notnull'=>0, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLossForProductProduced'),
'duration' => array('type'=>'duration', 'label'=>'EstimatedDuration', 'enabled'=>1, 'visible'=>-1, 'position'=>101, 'notnull'=>-1, 'css'=>'maxwidth50imp', 'help'=>'EstimatedDurationDesc'), 'duration' => array('type'=>'duration', 'label'=>'EstimatedDuration', 'enabled'=>1, 'visible'=>-1, 'position'=>101, 'notnull'=>-1, 'css'=>'maxwidth50imp', 'help'=>'EstimatedDurationDesc'),
@ -113,6 +115,7 @@ class BOM extends CommonObject
public $rowid; public $rowid;
public $ref; public $ref;
public $label; public $label;
public $bomtype;
public $description; public $description;
public $note_public; public $note_public;
public $note_private; public $note_private;
@ -204,7 +207,7 @@ class BOM extends CommonObject
// Translate some data of arrayofkeyval // Translate some data of arrayofkeyval
foreach ($this->fields as $key => $val) foreach ($this->fields as $key => $val)
{ {
if (is_array($val['arrayofkeyval'])) if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval']))
{ {
foreach ($val['arrayofkeyval'] as $key2 => $val2) foreach ($val['arrayofkeyval'] as $key2 => $val2)
{ {
@ -738,19 +741,17 @@ class BOM extends CommonObject
public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
{ {
global $db, $conf, $langs, $hookmanager; global $db, $conf, $langs, $hookmanager;
global $dolibarr_main_authentication, $dolibarr_main_demo;
global $menumanager;
if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips
$result = ''; $result = '';
$label = img_picto('', $this->picto).' <u>'.$langs->trans("BillOfMaterials").'</u>'; $label = img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("BillOfMaterials").'</u>';
if (isset($this->status)) {
$label .= ' '.$this->getLibStatut(5);
}
$label .= '<br>'; $label .= '<br>';
$label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref; $label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref;
if (isset($this->status)) {
$label .= '<br><b>'.$langs->trans("Status").":</b> ".$this->getLibStatut(5);
}
$url = dol_buildpath('/bom/bom_card.php', 1).'?id='.$this->id; $url = dol_buildpath('/bom/bom_card.php', 1).'?id='.$this->id;
@ -1145,7 +1146,7 @@ class BOMLine extends CommonObjectLine
// Translate some data of arrayofkeyval // Translate some data of arrayofkeyval
foreach ($this->fields as $key => $val) foreach ($this->fields as $key => $val)
{ {
if (is_array($val['arrayofkeyval'])) if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval']))
{ {
foreach ($val['arrayofkeyval'] as $key2 => $val2) foreach ($val['arrayofkeyval'] as $key2 => $val2)
{ {

View File

@ -153,7 +153,7 @@ if ($action == 'create')
print '<table class="border centpercent tableforfieldcreate">'; print '<table class="border centpercent tableforfieldcreate">';
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("BookmarkTitle").'</td><td><input id="titlebookmark" class="flat minwidth100" name="title" value="'.$title.'"></td><td class="hideonsmartphone">'.$langs->trans("SetHereATitleForLink").'</td></tr>'; print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("BookmarkTitle").'</td><td><input id="titlebookmark" class="flat minwidth300" name="title" value="'.dol_escape_htmltag($title).'"></td><td class="hideonsmartphone">'.$langs->trans("SetHereATitleForLink").'</td></tr>';
dol_set_focus('#titlebookmark'); dol_set_focus('#titlebookmark');
// Url // Url
@ -167,12 +167,12 @@ if ($action == 'create')
// Owner // Owner
print '<tr><td>'.$langs->trans("Owner").'</td><td>'; print '<tr><td>'.$langs->trans("Owner").'</td><td>';
print img_picto('', 'user').' '.$form->select_dolusers(isset($_POST['userid']) ? $_POST['userid'] : $user->id, 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); print img_picto('', 'user').' '.$form->select_dolusers(GETPOSTISSET('userid') ? GETPOST('userid', 'int') : $user->id, 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
print '</td><td class="hideonsmartphone">&nbsp;</td></tr>'; print '</td><td class="hideonsmartphone">&nbsp;</td></tr>';
// Position // Position
print '<tr><td>'.$langs->trans("Position").'</td><td>'; print '<tr><td>'.$langs->trans("Position").'</td><td>';
print '<input class="flat" name="position" size="5" value="'.(isset($_POST["position"]) ? $_POST["position"] : $object->position).'">'; print '<input class="flat" name="position" size="5" value="'.(GETPOSTISSET("position") ? GETPOST("position", 'int') : $object->position).'">';
print '</td><td class="hideonsmartphone">&nbsp;</td></tr>'; print '</td><td class="hideonsmartphone">&nbsp;</td></tr>';
print '</table>'; print '</table>';
@ -238,7 +238,7 @@ if ($id > 0 && !preg_match('/^add/i', $action))
} }
print '</td><td>'; print '</td><td>';
if ($action == 'edit') print '<input class="flat minwidth200" name="title" value="'.(isset($_POST["title"]) ?GETPOST("title", '', 2) : $object->title).'">'; if ($action == 'edit') print '<input class="flat minwidth300" name="title" value="'.(GETPOSTISSET("title") ? GETPOST("title", '', 2) : $object->title).'">';
else print $object->title; else print $object->title;
print '</td></tr>'; print '</td></tr>';
@ -251,7 +251,7 @@ if ($id > 0 && !preg_match('/^add/i', $action))
print '</span>'; print '</span>';
} }
print '</td><td>'; print '</td><td>';
if ($action == 'edit') print '<input class="flat minwidth500" name="url" value="'.(isset($_POST["url"]) ? $_POST["url"] : $object->url).'">'; if ($action == 'edit') print '<input class="flat minwidth500 quatrevingtpercent" name="url" value="'.(GETPOSTISSET("url") ? GETPOST("url") : $object->url).'">';
else print '<a href="'.(preg_match('/^http/i', $object->url) ? $object->url : DOL_URL_ROOT.$object->url).'"'.($object->target ? ' target="_blank"' : '').'>'.$object->url.'</a>'; else print '<a href="'.(preg_match('/^http/i', $object->url) ? $object->url : DOL_URL_ROOT.$object->url).'"'.($object->target ? ' target="_blank"' : '').'>'.$object->url.'</a>';
print '</td></tr>'; print '</td></tr>';
@ -259,7 +259,7 @@ if ($id > 0 && !preg_match('/^add/i', $action))
if ($action == 'edit') if ($action == 'edit')
{ {
$liste = array(1=>$langs->trans("OpenANewWindow"), 0=>$langs->trans("ReplaceWindow")); $liste = array(1=>$langs->trans("OpenANewWindow"), 0=>$langs->trans("ReplaceWindow"));
print $form->selectarray('target', $liste, isset($_POST["target"]) ? $_POST["target"] : $object->target); print $form->selectarray('target', $liste, GETPOSTISSET("target") ? GETPOST("target") : $object->target);
} else { } else {
if ($object->target == 0) print $langs->trans("ReplaceWindow"); if ($object->target == 0) print $langs->trans("ReplaceWindow");
if ($object->target == 1) print $langs->trans("OpenANewWindow"); if ($object->target == 1) print $langs->trans("OpenANewWindow");
@ -269,7 +269,7 @@ if ($id > 0 && !preg_match('/^add/i', $action))
print '<tr><td>'.$langs->trans("Owner").'</td><td>'; print '<tr><td>'.$langs->trans("Owner").'</td><td>';
if ($action == 'edit' && $user->admin) if ($action == 'edit' && $user->admin)
{ {
print img_picto('', 'user').' '.$form->select_dolusers(isset($_POST['userid']) ? $_POST['userid'] : ($object->fk_user ? $object->fk_user : ''), 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); print img_picto('', 'user').' '.$form->select_dolusers(GETPOSTISSET('userid') ? GETPOST('userid', 'int') : ($object->fk_user ? $object->fk_user : ''), 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
} else { } else {
if ($object->fk_user > 0) if ($object->fk_user > 0)
{ {
@ -284,7 +284,7 @@ if ($id > 0 && !preg_match('/^add/i', $action))
// Position // Position
print '<tr><td>'.$langs->trans("Position").'</td><td>'; print '<tr><td>'.$langs->trans("Position").'</td><td>';
if ($action == 'edit') print '<input class="flat" name="position" size="5" value="'.(isset($_POST["position"]) ? $_POST["position"] : $object->position).'">'; if ($action == 'edit') print '<input class="flat" name="position" size="5" value="'.(GETPOSTISSET("position") ? GETPOST("position", 'int') : $object->position).'">';
else print $object->position; else print $object->position;
print '</td></tr>'; print '</td></tr>';

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2005-2020 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -197,14 +197,14 @@ while ($i < min($num, $limit))
// Title // Title
print "<td>"; print "<td>";
$linkintern = 1; $linkintern = 1;
if ($linkintern) print "<a href=\"".$obj->url."\">"; if ($linkintern) print '<a href="'.$obj->url.'">';
print $title; print $title;
if ($linkintern) print "</a>"; if ($linkintern) print "</a>";
print "</td>\n"; print "</td>\n";
// Url // Url
print '<td class="tdoverflowmax200">'; print '<td class="tdoverflowmax200">';
if (!$linkintern) print '<a href="'.$obj->url.'"'.($obj->target ? ' target="newlink"' : '').'>'; if (!$linkintern) print '<a href="'.$obj->url.'"'.($obj->target ? ' target="newlink" rel="noopener"' : '').'>';
print $link; print $link;
if (!$linkintern) print '</a>'; if (!$linkintern) print '</a>';
print "</td>\n"; print "</td>\n";
@ -241,7 +241,7 @@ while ($i < min($num, $limit))
print '<td class="nowrap right">'; print '<td class="nowrap right">';
if ($user->rights->bookmark->creer) if ($user->rights->bookmark->creer)
{ {
print '<a class="editfielda" href="'.DOL_URL_ROOT."/bookmarks/card.php?action=edit&token='.newToken().'&id=".$obj->rowid."&backtopage=".urlencode($_SERVER["PHP_SELF"]).'">'.img_edit()."</a>"; print '<a class="editfielda" href="'.DOL_URL_ROOT.'/bookmarks/card.php?action=edit&token='.newToken().'&id='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_edit()."</a>";
} }
if ($user->rights->bookmark->supprimer) if ($user->rights->bookmark->supprimer)
{ {

View File

@ -32,7 +32,7 @@ $conf_db_base = $dolibarr_main_db_name;
$conf_fksoc = (!empty($_SESSION["CASHDESK_ID_THIRDPARTY"])) ? $_SESSION["CASHDESK_ID_THIRDPARTY"] : ($conf->global->CASHDESK_ID_THIRDPARTY > 0 ? $conf->global->CASHDESK_ID_THIRDPARTY : 0); $conf_fksoc = (!empty($_SESSION["CASHDESK_ID_THIRDPARTY"])) ? $_SESSION["CASHDESK_ID_THIRDPARTY"] : ($conf->global->CASHDESK_ID_THIRDPARTY > 0 ? $conf->global->CASHDESK_ID_THIRDPARTY : 0);
// Identifiant unique correspondant a l'entrepot a utiliser // Identifiant unique correspondant a l'entrepot a utiliser
$conf_fkentrepot = (!empty($_SESSION["CASHDESK_ID_WAREHOUSE"])) ? $_SESSION["CASHDESK_ID_WAREHOUSE"] : ($conf->global->CASHDESK_ID_WAREHOUSE > 0 ? $conf->global->CASHDESK_ID_WAREHOUSE : 0); $conf_fkentrepot = (!empty($_SESSION["CASHDESK_ID_WAREHOUSE"])) ? $_SESSION["CASHDESK_ID_WAREHOUSE"] : ($conf->global->CASHDESK_ID_WAREHOUSE > 0 ? $conf->global->CASHDESK_ID_WAREHOUSE : 0);
if (!empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) $conf_fkentrepot = 0; // If option to disable stock decrease is on, we set warehouse id to 0. if (!empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) $conf_fkentrepot = 0; // If option to disable the stock decrease is on, we set warehouse id to 0.
// Identifiant unique correspondant au compte caisse / liquide // Identifiant unique correspondant au compte caisse / liquide
$conf_fkaccount_cash = (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"])) ? $_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"] : ($conf->global->CASHDESK_ID_BANKACCOUNT_CASH > 0 ? $conf->global->CASHDESK_ID_BANKACCOUNT_CASH : 0); $conf_fkaccount_cash = (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"])) ? $_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"] : ($conf->global->CASHDESK_ID_BANKACCOUNT_CASH > 0 ? $conf->global->CASHDESK_ID_BANKACCOUNT_CASH : 0);
@ -46,6 +46,3 @@ $conf_fkaccount_cb = (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CB"])) ? $_SESSI
// View parameters // View parameters
$conf_taille_listes = (empty($conf->global->PRODUIT_LIMIT_SIZE) ? 1000 : $conf->global->PRODUIT_LIMIT_SIZE); // Number max of lines to show in lists $conf_taille_listes = (empty($conf->global->PRODUIT_LIMIT_SIZE) ? 1000 : $conf->global->PRODUIT_LIMIT_SIZE); // Number max of lines to show in lists
$conf_nbr_car_listes = 60; // Nombre max de caracteres par ligne dans les listes $conf_nbr_car_listes = 60; // Nombre max de caracteres par ligne dans les listes
// Add hidden option to force decrease of stock whatever is user setup
if (!empty($conf->global->CASHDESK_FORCE_STOCK_ON_BILL)) $conf->global->STOCK_CALCULATE_ON_BILL = 1;

View File

@ -5,6 +5,7 @@
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com> * Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2020 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -35,26 +36,24 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
$langs->load("categories"); $langs->load("categories");
// Security check // Security check
$socid = GETPOST('socid', 'int'); $socid = (int) GETPOST('socid', 'int');
if (!$user->rights->categorie->lire) accessforbidden(); if (!$user->rights->categorie->lire) accessforbidden();
$action = GETPOST('action', 'alpha'); $action = GETPOST('action', 'alpha');
$cancel = GETPOST('cancel', 'alpha'); $cancel = GETPOST('cancel', 'alpha');
$origin = GETPOST('origin', 'alpha'); $origin = GETPOST('origin', 'alpha');
$catorigin = GETPOST('catorigin', 'int'); $catorigin = (int) GETPOST('catorigin', 'int');
$type = GETPOST('type', 'aZ09'); $type = GETPOST('type', 'aZ09');
$urlfrom = GETPOST('urlfrom', 'alpha'); $urlfrom = GETPOST('urlfrom', 'alpha');
$backtopage = GETPOST('backtopage', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha');
$socid = GETPOST('socid', 'int'); $label = (string) GETPOST('label', 'alphanohtml');
$label = GETPOST('label'); $description = (string) GETPOST('description', 'restricthtml');
$description = GETPOST('description'); $color = preg_replace('/[^0-9a-f#]/i', '', (string) GETPOST('color', 'alphanohtml'));
$color = GETPOST('color'); $visible = (int) GETPOST('visible', 'int');
$visible = GETPOST('visible'); $parent = (int) GETPOST('parent', 'int');
$parent = GETPOST('parent');
if ($origin) if ($origin) {
{
if ($type == Categorie::TYPE_PRODUCT) $idProdOrigin = $origin; if ($type == Categorie::TYPE_PRODUCT) $idProdOrigin = $origin;
if ($type == Categorie::TYPE_SUPPLIER) $idSupplierOrigin = $origin; if ($type == Categorie::TYPE_SUPPLIER) $idSupplierOrigin = $origin;
if ($type == Categorie::TYPE_CUSTOMER) $idCompanyOrigin = $origin; if ($type == Categorie::TYPE_CUSTOMER) $idCompanyOrigin = $origin;
@ -90,32 +89,25 @@ if ($action == 'add' && $user->rights->categorie->creer)
{ {
header("Location: ".$urlfrom); header("Location: ".$urlfrom);
exit; exit;
} elseif ($backtopage) } elseif ($backtopage) {
{
header("Location: ".$backtopage); header("Location: ".$backtopage);
exit; exit;
} elseif ($idProdOrigin) } elseif ($idProdOrigin) {
{
header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idProdOrigin.'&type='.$type); header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idProdOrigin.'&type='.$type);
exit; exit;
} elseif ($idCompanyOrigin) } elseif ($idCompanyOrigin) {
{
header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idCompanyOrigin.'&type='.$type); header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idCompanyOrigin.'&type='.$type);
exit; exit;
} elseif ($idSupplierOrigin) } elseif ($idSupplierOrigin) {
{
header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idSupplierOrigin.'&type='.$type); header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idSupplierOrigin.'&type='.$type);
exit; exit;
} elseif ($idMemberOrigin) } elseif ($idMemberOrigin) {
{
header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idMemberOrigin.'&type='.$type); header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idMemberOrigin.'&type='.$type);
exit; exit;
} elseif ($idContactOrigin) } elseif ($idContactOrigin) {
{
header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idContactOrigin.'&type='.$type); header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idContactOrigin.'&type='.$type);
exit; exit;
} elseif ($idProjectOrigin) } elseif ($idProjectOrigin) {
{
header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idProjectOrigin.'&type='.$type); header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idProjectOrigin.'&type='.$type);
exit; exit;
} else { } else {

View File

@ -658,7 +658,7 @@ class Categories extends DolibarrApi
* Clean sensible object datas * Clean sensible object datas
* *
* @param Categorie $object Object to clean * @param Categorie $object Object to clean
* @return array Array of cleaned object properties * @return Object Object with cleaned properties
*/ */
protected function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {

View File

@ -1415,11 +1415,12 @@ class Categorie extends CommonObject
if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type]; if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type];
if ($type === Categorie::TYPE_BANK_LINE) { // TODO Remove this with standard category code if ($type === Categorie::TYPE_BANK_LINE) { // TODO Remove this with standard category code after migration of llx_bank_categ into llx_categorie
// Load bank groups // Load bank categories
$sql = "SELECT c.label, c.rowid"; $sql = "SELECT c.label, c.rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."bank_class as a, ".MAIN_DB_PREFIX."bank_categ as c"; $sql .= " FROM ".MAIN_DB_PREFIX."bank_class as a, ".MAIN_DB_PREFIX."bank_categ as c";
$sql .= " WHERE a.lineid=".$id." AND a.fk_categ = c.rowid"; $sql .= " WHERE a.lineid=".$id." AND a.fk_categ = c.rowid";
$sql .= " AND c.entity IN (".getEntity('category').")";
$sql .= " ORDER BY c.label"; $sql .= " ORDER BY c.label";
$res = $this->db->query($sql); $res = $this->db->query($sql);

View File

@ -3,6 +3,7 @@
* Copyright (C) 2006-2016 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2006-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com> * Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2020 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -39,10 +40,10 @@ $action = (GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'edit');
$confirm = GETPOST('confirm'); $confirm = GETPOST('confirm');
$cancel = GETPOST('cancel', 'alpha'); $cancel = GETPOST('cancel', 'alpha');
$socid = GETPOST('socid', 'int'); $socid = (int) GETPOST('socid', 'int');
$label = GETPOST('label', 'alphanohtml'); $label = (string) GETPOST('label', 'alphanohtml');
$description = GETPOST('description', 'restricthtml'); $description = (string) GETPOST('description', 'restricthtml');
$color = preg_replace('/[^0-9a-f#]/i', '', GETPOST('color', 'alphanohtml')); $color = preg_replace('/[^0-9a-f#]/i', '', (string) GETPOST('color', 'alphanohtml'));
$visible = (int) GETPOST('visible', 'int'); $visible = (int) GETPOST('visible', 'int');
$parent = (int) GETPOST('parent', 'int'); $parent = (int) GETPOST('parent', 'int');

View File

@ -278,13 +278,13 @@ print "<div class='tabsAction'>\n";
if ($user->rights->categorie->creer) if ($user->rights->categorie->creer)
{ {
$socid = ($object->socid ? "&amp;socid=".$object->socid : ""); $socid = ($object->socid ? "&socid=".$object->socid : "");
print "<a class='butAction' href='edit.php?id=".$object->id.$socid."&amp;type=".$type."'>".$langs->trans("Modify")."</a>"; print '<a class="butAction" href="edit.php?id='.$object->id.$socid.'&type='.$type.'">'.$langs->trans("Modify").'</a>';
} }
if ($user->rights->categorie->supprimer) if ($user->rights->categorie->supprimer)
{ {
print "<a class='butActionDelete' href='".DOL_URL_ROOT."/categories/viewcat.php?action=delete&amp;token='.newToken().'&amp;id=".$object->id."&amp;type=".$type."'>".$langs->trans("Delete")."</a>"; print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id.'&type='.$type.'">'.$langs->trans("Delete").'</a>';
} }
print "</div>"; print "</div>";

View File

@ -524,7 +524,7 @@ class ActionComm extends CommonObject
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."actioncomm", "id"); $this->ref =$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."actioncomm", "id");
// Now insert assigned users // Now insert assigned users
if (!$error) if (!$error)

View File

@ -327,8 +327,8 @@ class AgendaEvents extends DolibarrApi
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param Object $object Object to clean
* @return array Array of cleaned object properties * @return Object Object with cleaned properties
*/ */
protected function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {

View File

@ -43,16 +43,36 @@ class CActionComm
*/ */
public $id; public $id;
/**
* @var string code
*/
public $code; public $code;
/**
* @var string type
*/
public $type; public $type;
public $libelle; // deprecated
/**
* @var string label
* @deprecated
* @see $label
*/
public $libelle;
/** /**
* @var string Type of agenda event label * @var string Type of agenda event label
*/ */
public $label; public $label;
/**
* @var int active
*/
public $active; public $active;
/**
* @var string color hex
*/
public $color; public $color;
/** /**
@ -60,6 +80,9 @@ class CActionComm
*/ */
public $picto; public $picto;
/**
* @var array array of type_actions
*/
public $type_actions = array(); public $type_actions = array();
@ -76,14 +99,14 @@ class CActionComm
/** /**
* Load action type from database * Load action type from database
* *
* @param int $id id or code of action type to read * @param int|string $id id or code of action type to read
* @return int 1=ok, 0=not found, -1=error * @return int 1=ok, 0=not found, -1=error
*/ */
public function fetch($id) public function fetch($id)
{ {
$sql = "SELECT id, code, type, libelle as label, color, active, picto"; $sql = "SELECT id, code, type, libelle as label, color, active, picto";
$sql .= " FROM ".MAIN_DB_PREFIX."c_actioncomm"; $sql .= " FROM ".MAIN_DB_PREFIX."c_actioncomm";
if (is_numeric($id)) $sql .= " WHERE id=".$id; if (is_numeric($id)) $sql .= " WHERE id=".(int) $id;
else $sql .= " WHERE code='".$this->db->escape($id)."'"; else $sql .= " WHERE code='".$this->db->escape($id)."'";
dol_syslog(get_class($this)."::fetch", LOG_DEBUG); dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
@ -138,7 +161,9 @@ class CActionComm
$sql = "SELECT id, code, libelle as label, module, type, color, picto"; $sql = "SELECT id, code, libelle as label, module, type, color, picto";
$sql .= " FROM ".MAIN_DB_PREFIX."c_actioncomm"; $sql .= " FROM ".MAIN_DB_PREFIX."c_actioncomm";
$sql .= " WHERE 1=1"; $sql .= " WHERE 1=1";
if ($active != '') $sql .= " AND active=".$active; if ($active != '') {
$sql .= " AND active=".(int) $active;
}
if (!empty($excludetype)) $sql .= " AND type <> '".$this->db->escape($excludetype)."'"; if (!empty($excludetype)) $sql .= " AND type <> '".$this->db->escape($excludetype)."'";
if ($morefilter) $sql .= " AND ".$morefilter; if ($morefilter) $sql .= " AND ".$morefilter;
$sql .= " ORDER BY module, position, type"; $sql .= " ORDER BY module, position, type";

View File

@ -1265,7 +1265,7 @@ if (empty($action) || $action == 'show_month') // View by month
/* Show days before the beginning of the current month (previous month) */ /* Show days before the beginning of the current month (previous month) */
$style = 'cal_other_month cal_past'; $style = 'cal_other_month cal_past';
if ($iter_day == 6) $style .= ' cal_other_month_right'; if ($iter_day == 6) $style .= ' cal_other_month_right';
echo ' <td class="'.$style.' nowrap" width="14%" valign="top">'; echo ' <td class="'.$style.' nowrap tdtop" width="14%">';
show_day_events($db, $max_day_in_prev_month + $tmpday, $prev_month, $prev_year, $month, $style, $eventarray, $maxprint, $maxnbofchar, $newparam); show_day_events($db, $max_day_in_prev_month + $tmpday, $prev_month, $prev_year, $month, $style, $eventarray, $maxprint, $maxnbofchar, $newparam);
echo " </td>\n"; echo " </td>\n";
} elseif ($tmpday <= $max_day_in_month) { } elseif ($tmpday <= $max_day_in_month) {
@ -1278,14 +1278,14 @@ if (empty($action) || $action == 'show_month') // View by month
if ($today) $style = 'cal_today'; if ($today) $style = 'cal_today';
if ($curtime < $todaytms) $style .= ' cal_past'; if ($curtime < $todaytms) $style .= ' cal_past';
//var_dump($todayarray['mday']."==".$tmpday." && ".$todayarray['mon']."==".$month." && ".$todayarray['year']."==".$year.' -> '.$style); //var_dump($todayarray['mday']."==".$tmpday." && ".$todayarray['mon']."==".$month." && ".$todayarray['year']."==".$year.' -> '.$style);
echo ' <td class="'.$style.' nowrap" width="14%" valign="top">'; echo ' <td class="'.$style.' nowrap tdtop" width="14%">';
show_day_events($db, $tmpday, $month, $year, $month, $style, $eventarray, $maxprint, $maxnbofchar, $newparam); show_day_events($db, $tmpday, $month, $year, $month, $style, $eventarray, $maxprint, $maxnbofchar, $newparam);
echo "</td>\n"; echo "</td>\n";
} else { } else {
/* Show days after the current month (next month) */ /* Show days after the current month (next month) */
$style = 'cal_other_month'; $style = 'cal_other_month';
if ($iter_day == 6) $style .= ' cal_other_month_right'; if ($iter_day == 6) $style .= ' cal_other_month_right';
echo ' <td class="'.$style.' nowrap" width="14%" valign="top">'; echo ' <td class="'.$style.' nowrap tdtop" width="14%">';
show_day_events($db, $tmpday - $max_day_in_month, $next_month, $next_year, $month, $style, $eventarray, $maxprint, $maxnbofchar, $newparam); show_day_events($db, $tmpday - $max_day_in_month, $next_month, $next_year, $month, $style, $eventarray, $maxprint, $maxnbofchar, $newparam);
echo "</td>\n"; echo "</td>\n";
} }
@ -1477,28 +1477,30 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
print "\n"; print "\n";
// Line with title of day
$curtime = dol_mktime(0, 0, 0, $month, $day, $year); $curtime = dol_mktime(0, 0, 0, $month, $day, $year);
print '<div id="dayevent_'.$dateint.'" class="dayevent tagtable centpercent nobordernopadding">'."\n"; $urltoshow = DOL_URL_ROOT.'/comm/action/index.php?action=show_day&day='.str_pad($day, 2, "0", STR_PAD_LEFT).'&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$year.$newparam;
$urltocreate = '';
if ($nonew <= 0)
{
print '<div class="tagtr"><div class="nowrap float">';
print '<a class="dayevent-aday" style="color: #666" href="'.DOL_URL_ROOT.'/comm/action/index.php?';
print 'action=show_day&day='.str_pad($day, 2, "0", STR_PAD_LEFT).'&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$year;
print $newparam;
print '">';
if ($showinfo) print dol_print_date($curtime, 'daytextshort');
else print dol_print_date($curtime, '%d');
print '</a>';
print '</div><div class="floatright nowrap">';
if ($user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create) if ($user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create)
{ {
$newparam .= '&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$year; $newparam .= '&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$year;
//$param='month='.$monthshown.'&year='.$year;
$hourminsec = '100000'; $hourminsec = '100000';
print '<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.sprintf("%04d%02d%02d", $year, $month, $day).$hourminsec.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam ? '?'.$newparam : '')).'">'; $urltocreate = DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.sprintf("%04d%02d%02d", $year, $month, $day).$hourminsec.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam ? '?'.$newparam : ''));
}
// Line with title of day
print '<div id="dayevent_'.$dateint.'" class="cursorpointer dayevent tagtable centpercent nobordernopadding" onclick="window.location=\''.$urltocreate.'\';">'."\n";
if ($nonew <= 0)
{
print '<div class="tagtr"><div class="nowrap tagtd">';
print '<a class="dayevent-aday" style="color: #666" href="'.$urltoshow.'">';
if ($showinfo) print dol_print_date($curtime, 'daytextshort');
else print dol_print_date($curtime, '%d');
print '</a>';
print '</div><div class="nowrap tagtd right">';
if ($user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create)
{
print '<a class="cursoradd" href="'.$urltocreate.'">'; // Explicit link, usefull for nojs interfaces
print img_picto($langs->trans("NewAction"), 'edit_add.png'); print img_picto($langs->trans("NewAction"), 'edit_add.png');
print '</a>'; print '</a>';
} }
@ -1838,7 +1840,9 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
break; break;
} }
} }
if (!$i) print '&nbsp;'; if (!$i) { // No events
print '&nbsp;';
}
if (!empty($conf->global->MAIN_JS_SWITCH_AGENDA) && $i > $maxprint && $maxprint) if (!empty($conf->global->MAIN_JS_SWITCH_AGENDA) && $i > $maxprint && $maxprint)
{ {

View File

@ -137,10 +137,10 @@ if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) {
* Draft customer proposals * Draft customer proposals
*/ */
if (!empty($conf->propal->enabled) && $user->rights->propal->lire) { if (!empty($conf->propal->enabled) && $user->rights->propal->lire) {
$sql = "SELECT p.rowid, p.ref, p.ref_client, p.total_ht, p.tva as total_tva, p.total as total_ttc"; $sql = "SELECT p.rowid, p.ref, p.ref_client, p.total_ht, p.tva as total_tva, p.total as total_ttc, p.fk_statut as status,";
$sql .= ", s.rowid as socid, s.nom as name, s.client, s.canvas, s.code_client, s.email, s.entity, s.code_compta"; $sql .= " s.rowid as socid, s.nom as name, s.client, s.canvas, s.code_client, s.email, s.entity, s.code_compta";
$sql .= " FROM ".MAIN_DB_PREFIX."propal as p"; $sql .= " FROM ".MAIN_DB_PREFIX."propal as p,";
$sql .= ", ".MAIN_DB_PREFIX."societe as s"; $sql .= " ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " WHERE p.entity IN (".getEntity($propalstatic->element).")"; $sql .= " WHERE p.entity IN (".getEntity($propalstatic->element).")";
$sql .= " AND p.fk_soc = s.rowid"; $sql .= " AND p.fk_soc = s.rowid";
@ -167,6 +167,7 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) {
$propalstatic->total_ht = $obj->total_ht; $propalstatic->total_ht = $obj->total_ht;
$propalstatic->total_tva = $obj->total_tva; $propalstatic->total_tva = $obj->total_tva;
$propalstatic->total_ttc = $obj->total_ttc; $propalstatic->total_ttc = $obj->total_ttc;
$propalstatic->statut = $obj->status;
$companystatic->id = $obj->socid; $companystatic->id = $obj->socid;
$companystatic->name = $obj->name; $companystatic->name = $obj->name;
@ -203,10 +204,10 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) {
* Draft supplier proposals * Draft supplier proposals
*/ */
if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire) { if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire) {
$sql = "SELECT p.rowid, p.ref, p.total_ht, p.tva as total_tva, p.total as total_ttc"; $sql = "SELECT p.rowid, p.ref, p.total_ht, p.tva as total_tva, p.total as total_ttc, p.fk_statut as status,";
$sql .= ", s.rowid as socid, s.nom as name, s.client, s.canvas, s.code_client, s.code_fournisseur, s.entity, s.email"; $sql .= " s.rowid as socid, s.nom as name, s.client, s.canvas, s.code_client, s.code_fournisseur, s.entity, s.email";
$sql .= " FROM ".MAIN_DB_PREFIX."supplier_proposal as p"; $sql .= " FROM ".MAIN_DB_PREFIX."supplier_proposal as p,";
$sql .= ", ".MAIN_DB_PREFIX."societe as s"; $sql .= " ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " WHERE p.entity IN (".getEntity($supplierproposalstatic->element).")"; $sql .= " WHERE p.entity IN (".getEntity($supplierproposalstatic->element).")";
$sql .= " AND p.fk_statut = ".SupplierProposal::STATUS_DRAFT; $sql .= " AND p.fk_statut = ".SupplierProposal::STATUS_DRAFT;
@ -232,6 +233,7 @@ if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposa
$supplierproposalstatic->total_ht = $obj->total_ht; $supplierproposalstatic->total_ht = $obj->total_ht;
$supplierproposalstatic->total_tva = $obj->total_tva; $supplierproposalstatic->total_tva = $obj->total_tva;
$supplierproposalstatic->total_ttc = $obj->total_ttc; $supplierproposalstatic->total_ttc = $obj->total_ttc;
$supplierproposalstatic->statut = $obj->status;
$companystatic->id = $obj->socid; $companystatic->id = $obj->socid;
$companystatic->name = $obj->name; $companystatic->name = $obj->name;
@ -267,10 +269,10 @@ if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposa
* Draft customer orders * Draft customer orders
*/ */
if (!empty($conf->commande->enabled) && $user->rights->commande->lire) { if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
$sql = "SELECT c.rowid, c.ref, c.ref_client, c.total_ht, c.tva as total_tva, c.total_ttc"; $sql = "SELECT c.rowid, c.ref, c.ref_client, c.total_ht, c.tva as total_tva, c.total_ttc, c.fk_statut as status,";
$sql .= ", s.rowid as socid, s.nom as name, s.client, s.canvas, s.code_client, s.email, s.entity, s.code_compta"; $sql .= " s.rowid as socid, s.nom as name, s.client, s.canvas, s.code_client, s.email, s.entity, s.code_compta";
$sql .= " FROM ".MAIN_DB_PREFIX."commande as c"; $sql .= " FROM ".MAIN_DB_PREFIX."commande as c,";
$sql .= ", ".MAIN_DB_PREFIX."societe as s"; $sql .= " ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " WHERE c.entity IN (".getEntity($orderstatic->element).")"; $sql .= " WHERE c.entity IN (".getEntity($orderstatic->element).")";
$sql .= " AND c.fk_statut = ".Commande::STATUS_DRAFT; $sql .= " AND c.fk_statut = ".Commande::STATUS_DRAFT;
@ -297,6 +299,7 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
$orderstatic->total_ht = $obj->total_ht; $orderstatic->total_ht = $obj->total_ht;
$orderstatic->total_tva = $obj->total_tva; $orderstatic->total_tva = $obj->total_tva;
$orderstatic->total_ttc = $obj->total_ttc; $orderstatic->total_ttc = $obj->total_ttc;
$orderstatic->statut = $obj->status;
$companystatic->id = $obj->socid; $companystatic->id = $obj->socid;
$companystatic->name = $obj->name; $companystatic->name = $obj->name;
@ -329,13 +332,13 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
/* /*
* Draft suppliers orders * Draft purchase orders
*/ */
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled)) && $user->rights->fournisseur->commande->lire) { if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled)) && $user->rights->fournisseur->commande->lire) {
$sql = "SELECT cf.rowid, cf.ref, cf.ref_supplier, cf.total_ttc"; $sql = "SELECT cf.rowid, cf.ref, cf.ref_supplier, cf.total_ttc, cf.fk_statut as status,";
$sql .= ", s.rowid as socid, s.nom as name, s.client, s.canvas, s.code_client, s.code_fournisseur, s.entity, s.email"; $sql .= " s.rowid as socid, s.nom as name, s.client, s.canvas, s.code_client, s.code_fournisseur, s.entity, s.email";
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as cf"; $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as cf,";
$sql .= ", ".MAIN_DB_PREFIX."societe as s"; $sql .= " ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " WHERE cf.entity IN (".getEntity($supplierorderstatic->element).")"; $sql .= " WHERE cf.entity IN (".getEntity($supplierorderstatic->element).")";
$sql .= " AND cf.fk_statut = ".CommandeFournisseur::STATUS_DRAFT; $sql .= " AND cf.fk_statut = ".CommandeFournisseur::STATUS_DRAFT;
@ -362,6 +365,7 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
$supplierorderstatic->total_ht = $obj->total_ht; $supplierorderstatic->total_ht = $obj->total_ht;
$supplierorderstatic->total_tva = $obj->total_tva; $supplierorderstatic->total_tva = $obj->total_tva;
$supplierorderstatic->total_ttc = $obj->total_ttc; $supplierorderstatic->total_ttc = $obj->total_ttc;
$supplierorderstatic->statut = $obj->status;
$companystatic->id = $obj->socid; $companystatic->id = $obj->socid;
$companystatic->name = $obj->name; $companystatic->name = $obj->name;

View File

@ -171,19 +171,21 @@ if (empty($reshook))
GETPOST('date_deliveryday', 'int'), GETPOST('date_deliveryday', 'int'),
GETPOST('date_deliveryyear', 'int') GETPOST('date_deliveryyear', 'int')
); );
if (!empty($object->date_livraison) && !empty($date_delivery)) $date_delivery_old = (empty($object->delivery_date) ? $object->date_livraison : $object->delivery_date);
if (!empty($date_delivery_old) && !empty($date_delivery))
{ {
//Attempt to get the date without possible hour rounding errors //Attempt to get the date without possible hour rounding errors
$old_date_delivery = dol_mktime(12, 0, 0, $old_date_delivery = dol_mktime(12, 0, 0,
dol_print_date($object->date_livraison, '%m'), dol_print_date($date_delivery_old, '%m'),
dol_print_date($object->date_livraison, '%d'), dol_print_date($date_delivery_old, '%d'),
dol_print_date($object->date_livraison, '%Y') dol_print_date($date_delivery_old, '%Y')
); );
//Calculate the difference and apply if necessary //Calculate the difference and apply if necessary
$difference = $date_delivery - $old_date_delivery; $difference = $date_delivery - $old_date_delivery;
if ($difference != 0) if ($difference != 0)
{ {
$object->date_livraison = $date_delivery; $object->date_livraison = $date_delivery;
$object->delivery_date = $date_delivery;
foreach ($object->lines as $line) foreach ($object->lines as $line)
{ {
if (isset($line->date_start)) $line->date_start = $line->date_start + $difference; if (isset($line->date_start)) $line->date_start = $line->date_start + $difference;
@ -340,7 +342,9 @@ if (empty($reshook))
if ($object->fetch(GETPOST('copie_propal', 'int')) > 0) { if ($object->fetch(GETPOST('copie_propal', 'int')) > 0) {
$object->ref = GETPOST('ref'); $object->ref = GETPOST('ref');
$object->datep = $datep; $object->datep = $datep;
$object->date_livraison = $date_delivery; $object->date = $datep;
$object->date_livraison = $date_delivery; // deprecated
$object->delivery_date = $date_delivery;
$object->availability_id = GETPOST('availability_id'); $object->availability_id = GETPOST('availability_id');
$object->demand_reason_id = GETPOST('demand_reason_id'); $object->demand_reason_id = GETPOST('demand_reason_id');
$object->fk_delivery_address = GETPOST('fk_address', 'int'); $object->fk_delivery_address = GETPOST('fk_address', 'int');
@ -354,8 +358,9 @@ if (empty($reshook))
$object->socid = GETPOST('socid', 'int'); $object->socid = GETPOST('socid', 'int');
$object->contact_id = GETPOST('contactid', 'int'); $object->contact_id = GETPOST('contactid', 'int');
$object->fk_project = GETPOST('projectid', 'int'); $object->fk_project = GETPOST('projectid', 'int');
$object->model_pdf = GETPOST('model'); $object->model_pdf = GETPOST('model', 'alphanohtml');
$object->author = $user->id; // deprecated $object->author = $user->id; // deprecated
$object->user_author_id = $user->id;
$object->note_private = GETPOST('note_private', 'restricthtml'); $object->note_private = GETPOST('note_private', 'restricthtml');
$object->note_public = GETPOST('note_public', 'restricthtml'); $object->note_public = GETPOST('note_public', 'restricthtml');
$object->statut = Propal::STATUS_DRAFT; $object->statut = Propal::STATUS_DRAFT;
@ -371,7 +376,9 @@ if (empty($reshook))
$object->ref = GETPOST('ref'); $object->ref = GETPOST('ref');
$object->ref_client = GETPOST('ref_client'); $object->ref_client = GETPOST('ref_client');
$object->datep = $datep; $object->datep = $datep;
$object->date = $datep;
$object->date_livraison = $date_delivery; $object->date_livraison = $date_delivery;
$object->delivery_date = $date_delivery;
$object->availability_id = GETPOST('availability_id', 'int'); $object->availability_id = GETPOST('availability_id', 'int');
$object->demand_reason_id = GETPOST('demand_reason_id', 'int'); $object->demand_reason_id = GETPOST('demand_reason_id', 'int');
$object->fk_delivery_address = GETPOST('fk_address', 'int'); $object->fk_delivery_address = GETPOST('fk_address', 'int');
@ -1516,11 +1523,12 @@ if ($action == 'create')
print '<td>'; print '<td>';
print $form->select_company('', 'socid', '(s.client = 1 OR s.client = 2 OR s.client = 3) AND status=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300 maxwidth500'); print $form->select_company('', 'socid', '(s.client = 1 OR s.client = 2 OR s.client = 3) AND status=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300 maxwidth500');
// reload page to retrieve customer informations // reload page to retrieve customer informations
if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE)) if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED))
{ {
print '<script type="text/javascript"> print '<script type="text/javascript">
$(document).ready(function() { $(document).ready(function() {
$("#socid").change(function() { $("#socid").change(function() {
console.log("We have changed the company - Reload page");
var socid = $(this).val(); var socid = $(this).val();
// reload page // reload page
window.location.href = "'.$_SERVER["PHP_SELF"].'?action=create&socid="+socid+"&ref_client="+$("input[name=ref_client]").val(); window.location.href = "'.$_SERVER["PHP_SELF"].'?action=create&socid="+socid+"&ref_client="+$("input[name=ref_client]").val();
@ -1826,8 +1834,8 @@ if ($action == 'create')
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)')) array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)'))
); );
if (!empty($conf->global->PROPAL_CLONE_DATE_DELIVERY) && !empty($object->date_livraison)) { if (!empty($conf->global->PROPAL_CLONE_DATE_DELIVERY) && !empty($object->delivery_date)) {
$formquestion[] = array('type' => 'date', 'name' => 'date_delivery', 'label' => $langs->trans("DeliveryDate"), 'value' => $object->date_livraison); $formquestion[] = array('type' => 'date', 'name' => 'date_delivery', 'label' => $langs->trans("DeliveryDate"), 'value' => $object->delivery_date);
} }
// Incomplete payment. We ask if reason = discount or other // Incomplete payment. We ask if reason = discount or other
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmClonePropal', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmClonePropal', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
@ -1837,7 +1845,7 @@ if ($action == 'create')
{ {
//Form to close proposal (signed or not) //Form to close proposal (signed or not)
$formquestion = array( $formquestion = array(
array('type' => 'select', 'name' => 'statut', 'label' => '<span class="fieldrequired">'.$langs->trans("CloseAs").'</span>', 'values' => array(2=>$object->LibStatut($object::STATUS_SIGNED), 3=>$object->LibStatut($object::STATUS_NOTSIGNED))), array('type' => 'select', 'name' => 'statut', 'label' => '<span class="fieldrequired">'.$langs->trans("CloseAs").'</span>', 'values' => array($object::STATUS_SIGNED => $object->LibStatut($object::STATUS_SIGNED), $object::STATUS_NOTSIGNED => $object->LibStatut($object::STATUS_NOTSIGNED))),
array('type' => 'text', 'name' => 'note_private', 'label' => $langs->trans("Note"), 'value' => '') // Field to complete private note (not replace) array('type' => 'text', 'name' => 'note_private', 'label' => $langs->trans("Note"), 'value' => '') // Field to complete private note (not replace)
); );
@ -2051,9 +2059,9 @@ if ($action == 'create')
// Delivery date // Delivery date
$langs->load('deliveries'); $langs->load('deliveries');
print '<tr><td>'; print '<tr><td>';
print $form->editfieldkey($langs->trans('DeliveryDate'), 'date_livraison', $object->date_livraison, $object, $usercancreate, 'datepicker'); print $form->editfieldkey($langs->trans('DeliveryDate'), 'date_livraison', $object->delivery_date, $object, $usercancreate, 'datepicker');
print '</td><td>'; print '</td><td>';
print $form->editfieldval($langs->trans('DeliveryDate'), 'date_livraison', $object->date_livraison, $object, $usercancreate, 'datepicker'); print $form->editfieldval($langs->trans('DeliveryDate'), 'date_livraison', $object->delivery_date, $object, $usercancreate, 'datepicker');
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';

View File

@ -846,8 +846,8 @@ class Proposals extends DolibarrApi
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param Object $object Object to clean
* @return array Array of cleaned object properties * @return Object Object with cleaned properties
*/ */
protected function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {

View File

@ -13,7 +13,7 @@
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com> * Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -151,10 +151,16 @@ class Propal extends CommonObject
*/ */
public $datep; public $datep;
/**
* @var int Date expected for delivery
* @deprecated
*/
public $date_livraison; // deprecated; Use delivery_date instead.
/** /**
* @var integer|string $delivery_date; * @var integer|string $delivery_date;
*/ */
public $delivery_date; public $delivery_date; // Date expected of shipment (date starting shipment, not the reception that occurs some days after)
public $fin_validite; public $fin_validite;
@ -214,8 +220,6 @@ class Propal extends CommonObject
public $labelStatus = array(); public $labelStatus = array();
public $labelStatusShort = array(); public $labelStatusShort = array();
public $specimen;
// Multicurrency // Multicurrency
/** /**
* @var int ID * @var int ID
@ -987,6 +991,9 @@ class Propal extends CommonObject
$this->multicurrency_tx = 1; $this->multicurrency_tx = 1;
} }
// Set tmp vars
$delivery_date = empty($this->delivery_date) ? $this->date_livraison : $this->delivery_date;
dol_syslog(get_class($this)."::create"); dol_syslog(get_class($this)."::create");
// Check parameters // Check parameters
@ -1074,7 +1081,7 @@ class Propal extends CommonObject
$sql .= ", ".($this->mode_reglement_id > 0 ? $this->mode_reglement_id : 'NULL'); $sql .= ", ".($this->mode_reglement_id > 0 ? $this->mode_reglement_id : 'NULL');
$sql .= ", ".($this->fk_account > 0 ? $this->fk_account : 'NULL'); $sql .= ", ".($this->fk_account > 0 ? $this->fk_account : 'NULL');
$sql .= ", '".$this->db->escape($this->ref_client)."'"; $sql .= ", '".$this->db->escape($this->ref_client)."'";
$sql .= ", ".($this->date_livraison != '' ? "'".$this->db->idate($this->date_livraison)."'" : "NULL"); $sql .= ", ".(empty($delivery_date) ? "NULL" : "'".$this->db->idate($delivery_date)."'");
$sql .= ", ".($this->shipping_method_id > 0 ? $this->shipping_method_id : 'NULL'); $sql .= ", ".($this->shipping_method_id > 0 ? $this->shipping_method_id : 'NULL');
$sql .= ", ".$this->availability_id; $sql .= ", ".$this->availability_id;
$sql .= ", ".$this->demand_reason_id; $sql .= ", ".$this->demand_reason_id;
@ -1437,7 +1444,7 @@ class Propal extends CommonObject
$sql .= ", p.date_valid as datev"; $sql .= ", p.date_valid as datev";
$sql .= ", p.datep as dp"; $sql .= ", p.datep as dp";
$sql .= ", p.fin_validite as dfv"; $sql .= ", p.fin_validite as dfv";
$sql .= ", p.date_livraison as date_livraison"; $sql .= ", p.date_livraison as delivery_date";
$sql .= ", p.model_pdf, p.last_main_doc, p.ref_client, p.extraparams"; $sql .= ", p.model_pdf, p.last_main_doc, p.ref_client, p.extraparams";
$sql .= ", p.note_private, p.note_public"; $sql .= ", p.note_private, p.note_public";
$sql .= ", p.fk_projet as fk_project, p.fk_statut"; $sql .= ", p.fk_projet as fk_project, p.fk_statut";
@ -1519,7 +1526,8 @@ class Propal extends CommonObject
$this->date = $this->db->jdate($obj->dp); // Proposal date $this->date = $this->db->jdate($obj->dp); // Proposal date
$this->datep = $this->db->jdate($obj->dp); // deprecated $this->datep = $this->db->jdate($obj->dp); // deprecated
$this->fin_validite = $this->db->jdate($obj->dfv); $this->fin_validite = $this->db->jdate($obj->dfv);
$this->date_livraison = $this->db->jdate($obj->date_livraison); $this->date_livraison = $this->db->jdate($obj->delivery_date); // deprecated
$this->delivery_date = $this->db->jdate($obj->delivery_date);
$this->shipping_method_id = ($obj->fk_shipping_method > 0) ? $obj->fk_shipping_method : null; $this->shipping_method_id = ($obj->fk_shipping_method > 0) ? $obj->fk_shipping_method : null;
$this->availability_id = $obj->fk_availability; $this->availability_id = $obj->fk_availability;
$this->availability_code = $obj->availability_code; $this->availability_code = $obj->availability_code;
@ -1615,7 +1623,6 @@ class Propal extends CommonObject
// Update request // Update request
$sql = "UPDATE ".MAIN_DB_PREFIX."propal SET"; $sql = "UPDATE ".MAIN_DB_PREFIX."propal SET";
$sql .= " ref=".(isset($this->ref) ? "'".$this->db->escape($this->ref)."'" : "null").","; $sql .= " ref=".(isset($this->ref) ? "'".$this->db->escape($this->ref)."'" : "null").",";
$sql .= " ref_client=".(isset($this->ref_client) ? "'".$this->db->escape($this->ref_client)."'" : "null").","; $sql .= " ref_client=".(isset($this->ref_client) ? "'".$this->db->escape($this->ref_client)."'" : "null").",";
$sql .= " ref_ext=".(isset($this->ref_ext) ? "'".$this->db->escape($this->ref_ext)."'" : "null").","; $sql .= " ref_ext=".(isset($this->ref_ext) ? "'".$this->db->escape($this->ref_ext)."'" : "null").",";
@ -1639,7 +1646,6 @@ class Propal extends CommonObject
$sql .= " note_public=".(isset($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : "null").","; $sql .= " note_public=".(isset($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : "null").",";
$sql .= " model_pdf=".(isset($this->modelpdf) ? "'".$this->db->escape($this->modelpdf)."'" : "null").","; $sql .= " model_pdf=".(isset($this->modelpdf) ? "'".$this->db->escape($this->modelpdf)."'" : "null").",";
$sql .= " import_key=".(isset($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null").""; $sql .= " import_key=".(isset($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null")."";
$sql .= " WHERE rowid=".$this->id; $sql .= " WHERE rowid=".$this->id;
$this->db->begin(); $this->db->begin();
@ -2108,6 +2114,7 @@ class Propal extends CommonObject
{ {
$this->oldcopy = clone $this; $this->oldcopy = clone $this;
$this->date_livraison = $delivery_date; $this->date_livraison = $delivery_date;
$this->delivery_date = $delivery_date;
} }
if (!$notrigger && empty($error)) if (!$notrigger && empty($error))
@ -3566,21 +3573,28 @@ class Propal extends CommonObject
if ($user->rights->propal->lire) if ($user->rights->propal->lire)
{ {
$label = img_picto('', $this->picto).' <u>'.$langs->trans("Proposal").'</u>'; $label = img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("Proposal").'</u>';
if (!empty($this->ref))
$label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
if (!empty($this->ref_client))
$label .= '<br><b>'.$langs->trans('RefCustomer').':</b> '.$this->ref_client;
if (!empty($this->total_ht))
$label .= '<br><b>'.$langs->trans('AmountHT').':</b> '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
if (!empty($this->total_tva))
$label .= '<br><b>'.$langs->trans('VAT').':</b> '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
if (!empty($this->total_ttc))
$label .= '<br><b>'.$langs->trans('AmountTTC').':</b> '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
if (isset($this->statut)) { if (isset($this->statut)) {
$label .= '<br><b>'.$langs->trans("Status").":</b> ".$this->getLibStatut(5); $label .= ' '.$this->getLibStatut(5);
}
if (!empty($this->ref)) {
$label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
}
if (!empty($this->ref_client)) {
$label .= '<br><b>'.$langs->trans('RefCustomer').':</b> '.$this->ref_client;
}
if (!empty($this->total_ht)) {
$label .= '<br><b>'.$langs->trans('AmountHT').':</b> '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
}
if (!empty($this->total_tva)) {
$label .= '<br><b>'.$langs->trans('VAT').':</b> '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
}
if (!empty($this->total_ttc)) {
$label .= '<br><b>'.$langs->trans('AmountTTC').':</b> '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
}
if (!empty($this->delivery_date)) {
$label .= '<br><b>'.$langs->trans('DeliveryDate').':</b> '.dol_print_date($this->delivery_date, 'dayhour');
} }
if ($option == '') { if ($option == '') {
$url = DOL_URL_ROOT.'/comm/propal/card.php?id='.$this->id.$get_params; $url = DOL_URL_ROOT.'/comm/propal/card.php?id='.$this->id.$get_params;

View File

@ -188,14 +188,7 @@ $arrayfields = array(
'p.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000), 'p.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
); );
// Extra fields // Extra fields
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_array_fields.tpl.php';
{
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val)
{
if (!empty($extrafields->attributes[$object->table_element]['list'][$key]))
$arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
}
}
/* /*

View File

@ -120,6 +120,8 @@ if (!empty($conf->expedition->enabled) && !empty($conf->global->WAREHOUSE_ASK_WA
$error = 0; $error = 0;
$date_delivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int'));
/* /*
* Actions * Actions
@ -274,7 +276,8 @@ if (empty($reshook))
$object->fk_account = GETPOST('fk_account', 'int'); $object->fk_account = GETPOST('fk_account', 'int');
$object->availability_id = GETPOST('availability_id'); $object->availability_id = GETPOST('availability_id');
$object->demand_reason_id = GETPOST('demand_reason_id'); $object->demand_reason_id = GETPOST('demand_reason_id');
$object->date_livraison = $datelivraison; $object->date_livraison = $datelivraison; // deprecated
$object->delivery_date = $datelivraison;
$object->shipping_method_id = GETPOST('shipping_method_id', 'int'); $object->shipping_method_id = GETPOST('shipping_method_id', 'int');
$object->warehouse_id = GETPOST('warehouse_id', 'int'); $object->warehouse_id = GETPOST('warehouse_id', 'int');
$object->fk_delivery_address = GETPOST('fk_address'); $object->fk_delivery_address = GETPOST('fk_address');
@ -538,10 +541,10 @@ if (empty($reshook))
} }
} elseif ($action == 'setdate_livraison' && $usercancreate) { } elseif ($action == 'setdate_livraison' && $usercancreate) {
// print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year']; // print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year'];
$datedelivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int')); $date_delivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int'));
$object->fetch($id); $object->fetch($id);
$result = $object->setDeliveryDate($user, $datedelivery); $result = $object->setDeliveryDate($user, $date_delivery);
if ($result < 0) { if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
@ -1278,15 +1281,6 @@ if (empty($reshook))
if ($error) $action = 'edit_extras'; if ($error) $action = 'edit_extras';
} }
if ($action == 'set_thirdparty' && $usercancreate)
{
$object->fetch($id);
$object->setValueFrom('fk_soc', $socid, '', '', 'date', '', $user, 'ORDER_MODIFY');
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
exit();
}
// add lines from objectlinked // add lines from objectlinked
if ($action == 'import_lines_from_object' if ($action == 'import_lines_from_object'
&& $usercancreate && $usercancreate
@ -1520,7 +1514,8 @@ if ($action == 'create' && $usercancreate)
$remise_absolue = (!empty($objectsrc->remise_absolue) ? $objectsrc->remise_absolue : (!empty($soc->remise_absolue) ? $soc->remise_absolue : 0)); $remise_absolue = (!empty($objectsrc->remise_absolue) ? $objectsrc->remise_absolue : (!empty($soc->remise_absolue) ? $soc->remise_absolue : 0));
$dateorder = empty($conf->global->MAIN_AUTOFILL_DATE_ORDER) ?-1 : ''; $dateorder = empty($conf->global->MAIN_AUTOFILL_DATE_ORDER) ?-1 : '';
$datedelivery = (!empty($objectsrc->date_livraison) ? $objectsrc->date_livraison : ''); $date_delivery = (!empty($objectsrc->delivery_date) ? $objectsrc->delivery_date : '');
if (empty($date_delivery)) $date_delivery = (!empty($objectsrc->date_livraison) ? $objectsrc->date_livraison : '');
if (!empty($conf->multicurrency->enabled)) if (!empty($conf->multicurrency->enabled))
{ {
@ -1587,11 +1582,12 @@ if ($action == 'create' && $usercancreate)
print '<td>'; print '<td>';
print $form->select_company('', 'socid', '(s.client = 1 OR s.client = 2 OR s.client = 3)', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300'); print $form->select_company('', 'socid', '(s.client = 1 OR s.client = 2 OR s.client = 3)', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300');
// reload page to retrieve customer informations // reload page to retrieve customer informations
if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE)) if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED))
{ {
print '<script type="text/javascript"> print '<script type="text/javascript">
$(document).ready(function() { $(document).ready(function() {
$("#socid").change(function() { $("#socid").change(function() {
console.log("We have changed the company - Reload page");
var socid = $(this).val(); var socid = $(this).val();
// reload page // reload page
window.location.href = "'.$_SERVER["PHP_SELF"].'?action=create&socid="+socid+"&ref_client="+$("input[name=ref_client]").val(); window.location.href = "'.$_SERVER["PHP_SELF"].'?action=create&socid="+socid+"&ref_client="+$("input[name=ref_client]").val();
@ -1632,8 +1628,7 @@ if ($action == 'create' && $usercancreate)
// Date delivery planned // Date delivery planned
print '<tr><td>'.$langs->trans("DateDeliveryPlanned").'</td>'; print '<tr><td>'.$langs->trans("DateDeliveryPlanned").'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
//print dol_print_date($object->date_livraison, "day"); // date_livraison come from order and will be stored into date_delivery planed. $date_delivery = ($date_delivery ? $date_delivery : $object->date_delivery);
$date_delivery = ($date_delivery ? $date_delivery : $object->date_livraison); // $date_delivery comes from GETPOST
print $form->selectDate($date_delivery ? $date_delivery : -1, 'date_delivery', 1, 1, 1); print $form->selectDate($date_delivery ? $date_delivery : -1, 'date_delivery', 1, 1, 1);
print "</td>\n"; print "</td>\n";
print '</tr>'; print '</tr>';
@ -2029,7 +2024,6 @@ if ($action == 'create' && $usercancreate)
$linkback = '<a href="'.DOL_URL_ROOT.'/commande/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/commande/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
$morehtmlref = '<div class="refidno">'; $morehtmlref = '<div class="refidno">';
// Ref customer // Ref customer
$morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string', '', 0, 1); $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string', '', 0, 1);
@ -2151,12 +2145,12 @@ if ($action == 'create' && $usercancreate)
print '<form name="setdate_livraison" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">'; print '<form name="setdate_livraison" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="setdate_livraison">'; print '<input type="hidden" name="action" value="setdate_livraison">';
print $form->selectDate($object->date_livraison ? $object->date_livraison : -1, 'liv_', 1, 1, '', "setdate_livraison", 1, 0); print $form->selectDate($object->delivery_date ? $object->delivery_date : -1, 'liv_', 1, 1, '', "setdate_livraison", 1, 0);
print '<input type="submit" class="button" value="'.$langs->trans('Modify').'">'; print '<input type="submit" class="button" value="'.$langs->trans('Modify').'">';
print '</form>'; print '</form>';
} else { } else {
print $object->date_livraison ? dol_print_date($object->date_livraison, 'dayhour') : '&nbsp;'; print $object->delivery_date ? dol_print_date($object->delivery_date, 'dayhour') : '&nbsp;';
if ($object->hasDelay() && !empty($object->date_livraison)) { if ($object->hasDelay() && !empty($object->delivery_date)) {
print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning");
} }
} }

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