FIX resolve conflicts
This commit is contained in:
commit
fcc7965a78
@ -23,7 +23,6 @@ Licence of dependencies of third-party components used by Dolibarr (all compatib
|
||||
Component Version License GPL Compatible Usage
|
||||
-------------------------------------------------------------------------------------
|
||||
PHP libraries:
|
||||
ADOdb-Date 0.36 Modified BSD License Yes Date convertion (not into rpm package)
|
||||
EvalMath 1.0 BSD Yes Safe math expressions evaluation
|
||||
Escpos-php 2.2 MIT License Yes Thermal receipt printer library, for use with ESC/POS compatible printers
|
||||
GeoIP2 0.2.0 Apache License 2.0 Yes Lib to make geoip convert
|
||||
|
||||
370
ChangeLog
370
ChangeLog
@ -2,31 +2,330 @@
|
||||
English Dolibarr ChangeLog
|
||||
--------------------------------------------------------------
|
||||
|
||||
|
||||
***** ChangeLog for 17.0.0 compared to 16.0.0 *****
|
||||
|
||||
For users:
|
||||
---------------
|
||||
|
||||
NEW Minimal PHP version is now PHP 7.0 instead of PHP 5.6
|
||||
|
||||
...
|
||||
NEW: Minimal PHP version is now PHP 7.0 instead of PHP 5.6
|
||||
NEW: #21780 Add pid field to Cronjob class and store PID on job execution
|
||||
NEW: #19680 Add option PRODUCT_ALLOW_EXTERNAL_DOWNLOAD to automatically have uploaded files shared publicly by a link
|
||||
NEW: #20650 can move the checkbox column on left (experimental option)
|
||||
NEW: #21000 Added columns 'alias_name' on poject, supplier invoice, supplier order, supplier proposals and taks list
|
||||
NEW: #21395 Added option for dark theme mode in display - color and theme
|
||||
NEW: #21397 added option to auto define barcode numbers for third-parties in barcode module setup
|
||||
NEW: #21399
|
||||
NEW: #21442 Enhancement of module builder init
|
||||
NEW: #21654 add bank account number used on invoices for debit
|
||||
NEW: #22048 Added notes to productlot module
|
||||
NEW: #22298 Bank - Add salaries & vat in the tab of planned entries of a bank account
|
||||
NEW: #22328
|
||||
NEW: #22424
|
||||
NEW: #22500 member module set up made easier
|
||||
NEW: #22527 projects and thirdparties can be viewed as conversation ("Message" view), like events/agenda.
|
||||
NEW: #22546 can now set user supervisors using mass action in htdocs/user
|
||||
NEW: #22594 can chose if VAT ID is unique or not for third parties
|
||||
NEW: #22622 all partneships displayed on tab partnership of a thirdparty and member
|
||||
NEW: #22676 massaction for updating product prices
|
||||
NEW: #22735 Massaction to affect users on projects
|
||||
NEW: #25594 can chose if VAT ID is unique or not for third parties
|
||||
NEW: #4482 adding js to hide/show advanced option on the export data page
|
||||
NEW: Accountancy - Add a graphic option to enable lettering function - FPC21
|
||||
NEW: Accountancy - Add a way to clean some words when you generate thirdparty accounting account
|
||||
NEW: Accountancy - Added an option during export to export or not the lettering FPC21
|
||||
NEW: Accountancy - Manage supplier deposit with specific account
|
||||
NEW: Accountancy - Model Digitaria - Add a way to clean some words when you generate thirdparty accounting account FPC22
|
||||
NEW: Add a button "Test collect" in email collector
|
||||
NEW: Add a constant to disallow modification of the product reference.
|
||||
NEW: Add a method doAutoRenewContracts that can be used as a cron task.
|
||||
NEW: Add " as enclosure by default for CSV export. Keep removing CR/LF.
|
||||
NEW: add attached file in presend email form of thirdparty card
|
||||
NEW: Add a way to enter LICENSE file content in property of website
|
||||
NEW: Add badge in admin extrafields setup
|
||||
NEW: add constant PROPAL_BYPASS_VALIDATED_STATUS
|
||||
NEW: Add date event (!= date project) and location on event organization
|
||||
NEW: Add employment anniversary in birthday box
|
||||
NEW: Add extrafield type "IP" to store IP addresses
|
||||
NEW: Add fail2ban rules examples to limit access to /public pages
|
||||
NEW: Add filter "Product subject to lot/Serial" in stock per lot/serial
|
||||
NEW: Add free membership amounts at the membership type level
|
||||
NEW: Add hidden option MAIN_EMAIL_SUPPORT_ACK to restore Email ack checkbox (feature abandonned by mailers)
|
||||
NEW: Add IMAP port setting on email collector module
|
||||
NEW: Adding JAPAN Chart-of-Account and regions/departments
|
||||
NEW: Adding NIF verification for Algeria
|
||||
NEW: Add link to create an element from the category page
|
||||
NEW: add margin infos to takepos invoice lines
|
||||
NEW: Add max size send for "backup and link to mail" option
|
||||
NEW: Add method httponly_accessforbidden()
|
||||
NEW: Add more advices into the Setup security page
|
||||
NEW: Add new global variable for keeping the previous signature information on proposale (case of reopen a proposale)
|
||||
NEW: Add objectLink on expedition
|
||||
NEW: Add oldcopy to Ticket so triggers intercepting TICKET_MODIFY have access to old values of the updated properties
|
||||
NEW: Add option FICHINTER_ALLOW_EXTERNAL_DOWNLOAD
|
||||
NEW: Add option --force on CLI cron_run_jobs.php
|
||||
NEW: Add option "Show price on the generated documents for receptions"
|
||||
NEW: Add performance index (name for company and contact) and llx_bank_url(url_id)
|
||||
NEW: Add picto property on sub-module for paswword generation
|
||||
NEW: Add price to product box in TakePOS
|
||||
NEW: add redirect on action confirm addconsumedline and addproduceline
|
||||
NEW: Add a new advanced permission "read price"
|
||||
NEW: Add substitution key __SENDEREMAIL_SIGNATURE__
|
||||
NEW: Add the referrer-policy to "same-origin" by default on all public pages.
|
||||
NEW: Add the SMTP header References on ticket email created by email
|
||||
NEW: Add the thirdparty column to the time list (projet/tasks/time.php)
|
||||
NEW: Add trigger to record the event of sending an email from a project #20912
|
||||
NEW: Allow download link option in module configuration (propal,invoice,supplier proposal, order)
|
||||
NEW: Bank - Add salaries & vat in tab planned entries
|
||||
NEW: Bulk action to remove a category in list/search website pages
|
||||
NEW: Can copy/paste images into emails sent.
|
||||
NEW: Can edit label of an emailing even once sent
|
||||
NEW: Can edit property css, cssview, csslist on extrafields
|
||||
NEW: Can enter the unit price including the vat
|
||||
NEW: Can invoice task time per different services
|
||||
NEW: Can join several files by default on email form
|
||||
NEW: Can send an email on scheduled job error
|
||||
NEW: Can set a commercial discount by entereing amount including VAT
|
||||
NEW: Can set a monthly frequency (or multiple) in cron tasks.
|
||||
NEW: Can set start and end dates and comment on button "Activate all services"
|
||||
NEW: can sort and preselected best supplier price
|
||||
NEW: Website Can delete a whole website if disabled
|
||||
NEW: Website Can remove a website template
|
||||
NEW: Website can set header "Strict-Transport-Security" in web sites.
|
||||
NEW: Website Can switch status of website and page from the website toolbar
|
||||
NEW: Website Templates of websites are now directories and not zip into core repo
|
||||
NEW: Website Add 4 other templates in website module
|
||||
NEW: Can use products categories to make inventory
|
||||
NEW: Change filter type on tickets list into a multiselect combo
|
||||
NEW: conf TIMESPENT_ALWAYS_UPDATE_THM, when it's on we always check current thm of user to update it in task time line
|
||||
NEW: constant PROPAL_NEW_AS_SIGNED
|
||||
NEW: show date delivery planned on orders linked to company and product
|
||||
NEW: default_lang for members
|
||||
NEW: Default template of contract is not mandatory
|
||||
NEW: Default values in extrafields are not more limited to 255 char.
|
||||
NEW: display currency in takepos menu
|
||||
NEW: Enable online signature for interventions
|
||||
NEW: Encrypt all sensitive constants in llx_const
|
||||
NEW: extrafield price with currency
|
||||
NEW: filter on reception dates (from / to) in cheque paiement card
|
||||
NEW: TakePOS Header Scroll in TakePOS
|
||||
NEW: TakePOS Add setup parameters, can setup terminal name
|
||||
NEW: TakePOS support of Stripe Terminal with Takepos
|
||||
NEW: TakePOS Receipt preview in TakePOS setup
|
||||
NEW: TakePOS different product list on smartphone
|
||||
NEW: If we select another view list mode, we keep it
|
||||
NEW: Init module bookcal
|
||||
NEW: Introduce dolEncrypt and dolDecrypt to be able to encrypt data in db
|
||||
NEW: Invoice - Add french mention on pdf when vat debit option is on
|
||||
NEW: invoice export : add accounting affectation
|
||||
NEW: label on products categories filter
|
||||
NEW: The link "add to bookmark" is always on top in the bookmark popup
|
||||
NEW: MAIN_SEARCH_CATEGORY_PRODUCT_ON_LISTS const to show category customer filter
|
||||
NEW: Make module WebservicesClient deprecated. Use module WebHook instead
|
||||
NEW: manage no email with thirdparties (better for GDPR)
|
||||
NEW: Manage Position (Rank) on Contract Lines
|
||||
NEW: Manage VAT on all lines on purchases cycle
|
||||
NEW: manage virtual stock at a future date
|
||||
NEW: On a bank reconciled line, we can modify the bank receipt
|
||||
NEW: On a form to send an email, we show all emails of all contacts of object
|
||||
NEW: Option PRODUCTBATCH_SHOW_WAREHOUSE_ON_SHIPMENT showing wh on PDF
|
||||
NEW: Option PRODUIT_DESC_IN_FORM accept (desktop only or +smartphone)
|
||||
NEW: Page for mass stock transfer can be used with no source stock
|
||||
NEW: parent company column and filter in invoice and order list
|
||||
NEW: Add show "Sales rep" option for PDF
|
||||
NEW: Picto for shared link is clicable
|
||||
NEW: possibility to select scopes with checkbox for Oauth tokens
|
||||
NEW: private and public note on user, thirdparty and contact list
|
||||
NEW: product categories filter on inventory list
|
||||
NEW: Product supplier price: autofill default supplier VAT
|
||||
NEW: Project - Add author on list
|
||||
NEW: Public counters feature
|
||||
NEW: Reception - Add a from/to on search on date field
|
||||
NEW: Start a simple support of recurrent events on agenda
|
||||
NEW: Resize parent company column in order list
|
||||
NEW: Saved token of OAUTH module are now encrypted into llx_oauth_token
|
||||
NEW: Save one click to select on delivery ack, on emails.
|
||||
NEW: scheduled job to send unpaid invoice reminder can now use the cc and bcc from email template
|
||||
NEW: set thirdparty type with company modify trigger
|
||||
NEW: Show also shceduled task never finished in scheduled task widget
|
||||
NEW: show badge with number of extrafields in setup
|
||||
NEW: show category tree in sellist and chkbxlst for common object
|
||||
NEW: Show picto and color into combo for selection of tags
|
||||
NEW: show product label on inventory
|
||||
NEW: show sell-by and eat-by dates only if not empty
|
||||
NEW: show SellBy/EatBy dates for each batch product in shipment card
|
||||
NEW: skip accept/refuse process for proposals (option PROPAL_SKIP_ACCEPT_REFUSE)
|
||||
NEW: SMTP using oauth2 authentication
|
||||
NEW: can substitue project title in mail template
|
||||
NEW: Supplier order list - Add column private and public note
|
||||
NEW: Support IP type in extrafields
|
||||
NEW: Table of membership types
|
||||
NEW: The purge of files can purge only if older than a number of seconds
|
||||
NEW: Update ActionComm type_code on email message ticket
|
||||
NEW: VAT - Admin - Add information on deadline day for submission of VAT declaration
|
||||
NEW: expand/collapse permissions on user permission page
|
||||
NEW: Show delivery mode on PDF for proposals
|
||||
NEW: Add the target to select attendees of event for emailings
|
||||
|
||||
|
||||
For developers or integrators:
|
||||
------------------------------
|
||||
|
||||
NEW Minimal PHP version is now PHP 7.0 instead of PHP 5.6
|
||||
|
||||
...
|
||||
NEW: ModuleBuilder can generate code of class from an existing SQL table
|
||||
NEW: #22370 Modulebuilder supports 'alwayseditable' (like extrafields)
|
||||
NEW: #20912 Add trigger to record the event of sending an email from a project
|
||||
NEW: #21750 Added "Get lines and Post lines from BOM" at the REST Service
|
||||
NEW: Removed completely the need for the library adodbtime
|
||||
NEW: hook on agenda pages
|
||||
NEW: hook to complete payment in TakePOS
|
||||
NEW: hook "changeHelpURL" to modify target of the help button
|
||||
NEW: hook formConfirm on action comm card
|
||||
NEW: hook to modify supplier product html select
|
||||
NEW: Add new hook for show virtual stock details on product stock card
|
||||
NEW: Add new hooks for actioncomm
|
||||
NEW: conf->global->SYSLOG_FILE_ONEPERSESSION accept a string
|
||||
NEW: translate for contact type API, setup/ticket API, shipping method API
|
||||
NEW: All ajax pages have now a top_httphead()
|
||||
NEW: support multilang in Civilities API
|
||||
NEW: Add API for the partnership module
|
||||
NEW: Add "Get lines and Post lines from BOM" in the API
|
||||
NEW: Replace fk_categories_product with categories_product in inventory
|
||||
NEW: Rewrite of SQL request. Removed the join on category (for filter on categ), replaced with a EXISTS/NOT
|
||||
|
||||
|
||||
WARNING:
|
||||
|
||||
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
|
||||
* Minimal PHP version is now PHP 7.0 instead of PHP 5.6
|
||||
* The signature of method getNomUrl() of class ProductFournisseur has been modified to match the signature of method Product
|
||||
* Trigger ORDER_SUPPLIER_DISPATCH is removed, use ORDER_SUPPLIER_RECEIVE and/or LINEORDER_SUPPLIER_DISPATCH instead.
|
||||
* All functions fetch_all() have been set to deprecated for naming consitency, use fetchAll() instead.
|
||||
* Code standardization: '$user->rights->propale' is now '$user->rights->propal' everywhere.
|
||||
* Deprecated method set_billed() on shipment and reception class has been removed. Use setBilled() instead.
|
||||
* Tables llx_prelevement_facture and llx_prelevement_facture_demande have been renamed into llx_prelevement and llx_prelevement_demande.
|
||||
* Rename MAIN_LIST_ALLOW_NOTES into MAIN_LIST_HIDE_NOTES and rename MAIN_LIST_ALLOW_PRIVATE_NOTES into MAIN_LIST_HIDE_PRIVATE_NOTES
|
||||
* Rename the substitution for project label instead of project title in substitution variables
|
||||
|
||||
|
||||
***** ChangeLog for 16.0.2 compared to 16.0.1 *****
|
||||
|
||||
FIX: 16.0 - computed extrafields are not displayed if the object has no other extrafields
|
||||
FIX: #22538
|
||||
FIX: Accountancy - Review of Winfic - eWinfic - Winsis compta export format
|
||||
FIX: add loadRoleMode on getlinearray
|
||||
FIX: Autosearch on takepos was broken
|
||||
FIX: avoid access forbidden with numeric ref
|
||||
FIX: avoid error, check of product fetch is already check before
|
||||
FIX: avoid error, fetch of product is mandatory (by id or by ref)
|
||||
FIX: avoid unnecessary multiple calculation (#22637)
|
||||
FIX: bug on selected value for select_bom() function
|
||||
FIX: can not set prospect status "Do not contact"
|
||||
FIX: change in the communication status of the prospect
|
||||
FIX: check $id, already checked before
|
||||
FIX: closed warehouse for shipping
|
||||
FIX: extrafields_add tpl for stock movement
|
||||
FIX: the request SQL for transversal user, the join on usergroup table must be with getEntity('usergroup')
|
||||
FIX: Import of contact when there is duplicate thirdparties
|
||||
FIX: Import of socialnetwork field
|
||||
FIX: input selector is wrong with PRODUCT_LOAD_EXTRAFIELD_INTO_OBJECTLINES usage
|
||||
FIX: install wizard error management
|
||||
FIX: just add integer
|
||||
FIX: Missing $object for online signature link build
|
||||
FIX: missing quote
|
||||
FIX: only modify hidden checkbox/multislected extrafields on update if they are provided in request
|
||||
FIX: php doc
|
||||
FIX: private message ticket become public if edit action
|
||||
FIX: remove > 0 and -1
|
||||
FIX: remove db object to avoid error with postgresql
|
||||
FIX: Search ambigous field on MO list
|
||||
FIX: Search on social networks
|
||||
FIX: Subscription must be stopped when max of attendees reached.
|
||||
FIX: supplier price update: missing error reporting
|
||||
FIX: travis & stickler feedbacks
|
||||
FIX: we must be able to select only bom of a specific product + several fixes on select_bom() function
|
||||
FIX: wrong perm check
|
||||
FIX: wrong typo, remove quote
|
||||
FIX: wrong var typo
|
||||
|
||||
|
||||
***** ChangeLog for 16.0.1 compared to 16.0.0 *****
|
||||
|
||||
FIX: #16476 on massaction the pdf generation is not using the t…
|
||||
FIX: #21416 Filter tag no-categorie in members
|
||||
FIX: #21543
|
||||
FIX: #21799 inactive companies shall not be selectable for new proposals, orders and invoices
|
||||
FIX: #21859 Don't show html balise on list for private/public note
|
||||
FIX: #22164
|
||||
FIX: #22241
|
||||
FIX: #22263 Accountancy - Account number expected in place of a rowid on parent account on export
|
||||
FIX: #22264 Accountancy - Translation on chart of accounts export
|
||||
FIX: #22265 Accountancy - Account number expected in place of a rowid on export
|
||||
FIX: #22334
|
||||
FIX: #22360
|
||||
FIX: #22379 creating events on supplier order
|
||||
FIX: #22382 Error on length of supplier reference
|
||||
FIX: #22386 IBAN not mandatory for International Export Countries
|
||||
FIX: #22440 Lang Key "UserAccountNotDefined" is missing
|
||||
FIX: #22482
|
||||
FIX: #22507
|
||||
FIX: Accountancy - Some manuals operations are displayed in subledger
|
||||
FIX: API reception return error 500
|
||||
FIX: avoid override initial message ($this instead $object)
|
||||
FIX: avoid some warnings (php8+)
|
||||
FIX: Bad backtopage and CSRF on link for ticket message
|
||||
FIX: bad closing select
|
||||
FIX: broken feature, wrong fk_parent_line after cloning object
|
||||
FIX: Column label
|
||||
FIX: compatibility if javascript not actived
|
||||
FIX: compatibility with Mysql <= 5.7
|
||||
FIX: contact deletion: execute trigger before really deleting
|
||||
FIX: CronJob sendBackup
|
||||
FIX: CSRF + lost value of constant after use save button
|
||||
FIX: CSS
|
||||
FIX: data integrity for llx_delivery table
|
||||
FIX: default value for partnership status
|
||||
FIX: deletion of the MO_CHILD link
|
||||
FIX: Dictionary - Display error on cache_vatrates
|
||||
FIX: Dolibarr#16476 version 2a
|
||||
FIX: Duplicate creation of invoice when closing shipment linked to order
|
||||
FIX: Duplicate in list when filtering on categories
|
||||
FIX: extrafields with value '0' was ''
|
||||
FIX: filters lost when sorting on productMargin and customerMargins
|
||||
FIX: fk_expedition in $line can be usefull for triggers
|
||||
FIX: Import in upgrade when using a socialnetwork field.
|
||||
FIX: input hidden with fk_product of line on mo production can be usefull
|
||||
FIX: inventory code must be different at each transation
|
||||
FIX: inventory total columns
|
||||
FIX: Issue #16476 on massaction the pdf generation is not using the thirdparty language settings
|
||||
FIX: Linked object agenda card
|
||||
FIX: missing check if category module is enabled
|
||||
FIX: missing check if incoice as a payment (wrong status)
|
||||
FIX: missing class "societe" when create another object with workflow
|
||||
FIX: missing error message if image size too large
|
||||
FIX: Missing reposition
|
||||
FIX: missing the management of a constant in the Ticket config
|
||||
FIX: Missing token in different URLs links
|
||||
FIX: @ must be allowed into dol_eval to allow rules including external module string 'abc@def'
|
||||
FIX: - php V8 get number doc saphir
|
||||
FIX: - php V8 propal index last draft
|
||||
FIX: Preview button position on documents list (case when the file is too long)
|
||||
FIX: Project - on global view, missing display of ref customer
|
||||
FIX: Protection against bad value into accurancy setup
|
||||
FIX: reading of trackid in emailcollector (when on recipient suffix)
|
||||
FIX: recruitment linked files
|
||||
FIX: Remove use of code we should not have
|
||||
FIX: Restore the option MAIN_OPTIMIZEFORTEXTBROWSER
|
||||
FIX: Rich text is not diplayed
|
||||
FIX: same thing in deleteline
|
||||
FIX: Supplier Reference is lost when page breaks
|
||||
FIX: support of array parameters in "add to bookmark" feature.
|
||||
FIX: Test that web dir is correct in install
|
||||
FIX: the shipment PDF was using the full size logo instead of small
|
||||
FIX: Token Error : delete stock transfer
|
||||
FIX: ToOfferALinkForOnlinePayment not translated
|
||||
FIX: tooltip of technical tables added of a module
|
||||
FIX: wrong result check when update expensereport line
|
||||
|
||||
|
||||
***** ChangeLog for 16.0.0 compared to 15.0.0 *****
|
||||
|
||||
@ -79,7 +378,7 @@ NEW: Create contract from invoice
|
||||
NEW: Database: Can store the session into database (instead of beeing managed by PHP)
|
||||
NEW: Database: Some core tables are created only at module activation
|
||||
NEW: Default value for MAIN_SECURITY_CSRF_WITH_TOKEN is now 2 (GET are also protected agains CSRF attacks)
|
||||
NEW: deposit payment terms: add field into dictionary admin page to define default percentage of deposit.
|
||||
NEW: deposit payment terms: add field into dictionary admin page to define default percentage of deposit.
|
||||
NEW: Dictionaries - add possibility to manage countries in EEC
|
||||
NEW: Dictionaries - Availibility dictionnary has a new column unit and number
|
||||
NEW: Display errors in a message box after generating documents
|
||||
@ -187,9 +486,9 @@ NEW: Can update rank of invoice, proposal and order lines with API update
|
||||
NEW: update rank line is possible on API for customer invoices, sales orders and supplier invoice
|
||||
NEW: Add option MAIN_API_DEBUG to save API logs into a file
|
||||
|
||||
Hooks:
|
||||
Hooks:
|
||||
NEW: Hook getNomUrl available everywhere in tooltip of ref links
|
||||
NEW: Add hooks: selectContactListWhere hook, selectThirdpartyListWhere hook
|
||||
NEW: Add hooks: selectContactListWhere hook, selectThirdpartyListWhere hook
|
||||
NEW: Add hook before the public ticket list
|
||||
NEW: Add hook for Notif
|
||||
NEW: Add hook for more buttons
|
||||
@ -221,12 +520,12 @@ NEW: Option INVOICEREC_SET_AUTOFILL_DATE_START/END
|
||||
WARNING:
|
||||
|
||||
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
|
||||
* There is a new specific permission to be allowed to enter timesheets. If you use timesheet, don't forget to give the new permission (disable and
|
||||
* There is a new specific permission to be allowed to enter timesheets. If you use timesheet, don't forget to give the new permission (disable and
|
||||
enable the module project if it is not visible).
|
||||
* The default value for MAIN_SECURITY_CSRF_WITH_TOKEN has been set to 2. It means any POST and any GET request that contains the "action" or "massaction"
|
||||
with a value of a sensitive action must also a valid token parameter (With previous value 1, only POST was concerned). Note: With value 3, any URL
|
||||
with parameter "action" or "massaction" need the token, whatever is the value of the action.
|
||||
* verifCond('stringtoevaluate') now return false when string contains a bad syntax content instead of true.
|
||||
* verifCond('stringtoevaluate') now return false when string contains a bad syntax content instead of true.
|
||||
* The deprecated method thirdparty_doc_create() has been removed. You can use the generateDocument() instead.
|
||||
* All triggers with a name XXX_UPDATE have been renamed with name XXX_MODIFY for code consistency purpose.
|
||||
* Rename build_path_from_id_categ() into buildPathFromId() and set method to private.
|
||||
@ -235,6 +534,7 @@ Following changes may create regressions for some external modules, but were nec
|
||||
* Method fetch_all of DolResource has been renamed into fetchAll() to match naming conventions.
|
||||
* The hook 'upgrade' and 'doUpgrade2" has been renamed 'doUpgradeBefore' and 'doUpgradeAfterDB'. A new trigger 'doUpgradeAfterFiles' has been introduced.
|
||||
* The context hook 'suppliercard' when on the supplier tab of a thirdparty has been renamed into 'thirdpartysupplier'
|
||||
* Because the module Resources highly linked to the Agenda module, the menu for Resources module has been moved into top menu Agenda.
|
||||
|
||||
|
||||
***** ChangeLog for 15.0.3 compared to 15.0.2 *****
|
||||
@ -442,7 +742,7 @@ For users:
|
||||
|
||||
NEW: Online proposal signature
|
||||
NEW: Can define some max limit on expense report (per period, per type or expense, ...)
|
||||
NEW: Provide a special pages for bookmarks and multicompany for a better use of some mobile applications (like DoliDroid)
|
||||
NEW: Provide a special pages for bookmarks and multicompany for a better use of some mobile applications (like DoliDroid)
|
||||
NEW: Allow the use of __NEWREF__ to get for example the new reference a draft order will get after validation.
|
||||
NEW: Add option to disable globaly some notifications emails.
|
||||
NEW: #18401 Add __NEWREF__ subtitute to get new object reference.
|
||||
@ -491,7 +791,7 @@ NEW: can enable/disable external calendar by default
|
||||
NEW: Can hide sender name on PDF documents
|
||||
NEW: Can select lot from a combo list of existing batch numbers (in MRP consumtion)
|
||||
NEW: Can set the default BOM on a product
|
||||
NEW: Can set/unset the usual working day of the week (friday, saturday, sunday)
|
||||
NEW: Can set/unset the usual working day of the week (friday, saturday, sunday)
|
||||
NEW: Can show progression of task into combo list of tasks
|
||||
NEW: can upload the odt file for the product doc template
|
||||
NEW: Contract - Add From/to input on search date
|
||||
@ -555,7 +855,7 @@ For developers:
|
||||
|
||||
API:
|
||||
NEW: #18319 REST API - Shipment: Add 'close' action / endpoint / POST method.
|
||||
NEW: add API /approve and /makeOrder for purchase orders
|
||||
NEW: add API /approve and /makeOrder for purchase orders
|
||||
NEW: API for knowledgemanagement
|
||||
NEW: API get list of legal form of business
|
||||
NEW: API list of staff units
|
||||
@ -592,21 +892,21 @@ NEW: Experimental feature to manage user sessions in database
|
||||
|
||||
|
||||
WARNING:
|
||||
|
||||
|
||||
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
|
||||
* ALL EXTERNAL MODULES THAT WERE NOT CORRECTLY DEVELOPPED WILL NOT WORK ON V15 (All modules that forgot to manage the security token field
|
||||
* ALL EXTERNAL MODULES THAT WERE NOT CORRECTLY DEVELOPPED WILL NOT WORK ON V15 (All modules that forgot to manage the security token field
|
||||
into forms will be broken. The security token field is expected since Dolibarr v9 but a lot of external modules did not implement it).
|
||||
* Update hook 'printOriginObjectLine', removed check on product type and special code. Need now reshook.
|
||||
* Old deprecated module "SimplePOS" has been completely removed. Use module "TakePOS" is you need a Point Of Sale.
|
||||
* The method static ActionComm::getActions($db, ...) is no more static. Use $actioncomm->getActions(...) instead (without $db param).
|
||||
* The method static ActionComm::getActions($db, ...) is no more static. Use $actioncomm->getActions(...) instead (without $db param).
|
||||
* The 'action=delete&file=...' has been replaced with 'action=deletefile&file=...' to avoid confusion with deletion of object lines.
|
||||
* Method getDictvalue has been renamed into getDictionaryValue to match camel case rule.
|
||||
* To execute shell or command line command, your code must never use method like exec, shell_exec, popen, .. but must use the built-in
|
||||
method executeCLI() available into core/class/utils.class.php
|
||||
* To execute shell or command line command, your code must never use method like exec, shell_exec, popen, .. but must use the built-in
|
||||
method executeCLI() available into core/class/utils.class.php
|
||||
* Class file expeditionbatch.class.php renamed to expeditionlinebatch.class.php
|
||||
* ExpeditionLineBatch::fetchAll is not static anymore and first parameter $db is removed
|
||||
* ExtraFields->showOutputField parameter 4 'extrafieldsobjectkey' is now required
|
||||
* CommonObject method add_object_linked now sets targettype to 'mymodule_myobject' instead of 'myobject',
|
||||
* CommonObject method add_object_linked now sets targettype to 'mymodule_myobject' instead of 'myobject',
|
||||
you can use hook 'setLinkedObjectSourceTargetType' to set your usual targettype
|
||||
|
||||
|
||||
@ -895,10 +1195,10 @@ For users:
|
||||
----------
|
||||
NEW: Module Recruitment to follow application to job positions is now stable.
|
||||
NEW: Feature to make Stock Inventories
|
||||
NEW: Several security issues after a second private bug hunting campaign.
|
||||
NEW: Several security issues after a second private bug hunting campaign.
|
||||
NEW: A lot of fix into english text after a small proofreading campaign (still not perfect, but really better)
|
||||
NEW: All main menu entries are using the picto of the module
|
||||
NEW: Add a copy to clipboard button on some fields
|
||||
NEW: Add a copy to clipboard button on some fields
|
||||
NEW: Add an example of scheduled job to send email reminder for unpaid invoices
|
||||
NEW: Add some color and picto for the direction of movement
|
||||
NEW: add the column "Channel" into the list of orders
|
||||
@ -969,7 +1269,7 @@ NEW: can show the leave dates/holidays on the agenda view
|
||||
NEW: Support color for types of event
|
||||
|
||||
Bank
|
||||
NEW: Bank Entries : display user linked to a salary or a taxes
|
||||
NEW: Bank Entries : display user linked to a salary or a taxes
|
||||
NEW: Add bulk actions for Bank Transfer
|
||||
|
||||
ECM/GED
|
||||
@ -992,7 +1292,7 @@ NEW: option to automatically create a login/user when a new subscription of a me
|
||||
NEW: option to select membership type on the online payment page for membership subscription or renewal
|
||||
|
||||
Products
|
||||
NEW: Add price min and price min including tax into product export
|
||||
NEW: Add price min and price min including tax into product export
|
||||
NEW: Add a ref in product customer price
|
||||
NEW: customer ref for product customer prices
|
||||
NEW: Set status of all variants when changing status of parent
|
||||
@ -1045,8 +1345,8 @@ NEW: add option in Workflow module to set a shipment as closed
|
||||
|
||||
|
||||
for Admins
|
||||
NEW: Add a security center page with all information and advices related to the security of your instance
|
||||
NEW: Add a performance center page with all information and advices related to the performance of your instance
|
||||
NEW: Add a security center page with all information and advices related to the security of your instance
|
||||
NEW: Add a performance center page with all information and advices related to the performance of your instance
|
||||
|
||||
Modules
|
||||
NEW: Module Recruitment is now stable
|
||||
@ -1092,7 +1392,7 @@ NEW: API get the list of product ids only
|
||||
NEW: add link to OpenAPI specifications XML file in REST API module setup: swagger.json file can be included into external tools like redoc
|
||||
NEW: add native compression in REST APIs
|
||||
NEW: Product Variants API, add variant stock to response by parameter
|
||||
NEW: Product API route added to get product stock and product with or without variants #13739 #17390
|
||||
NEW: Product API route added to get product stock and product with or without variants #13739 #17390
|
||||
|
||||
Hooks
|
||||
NEW: hook printFieldListTitle for cabyprodserv.php
|
||||
@ -1117,8 +1417,8 @@ Following changes may create regressions for some external modules, but were nec
|
||||
* Removed deprecated substitution key __REFCLIENT__ (replaced with __REF_CLIENT__)
|
||||
* Removed constant MAIN_COUNTRIES_IN_EEC. You can now set if country is in Europe or not from the dictionary of countries.
|
||||
* v14 seems to work correctly on PHP v8 but it generates a lot of verbose warnings. Currently, v14 i snot yet officialy supported with PHP 8.
|
||||
* To execute shell or command line command, your code must never use method like exec, shell_exec, popen, .. but must use the built-in
|
||||
method executeCLI() available into core/class/utils.class.php
|
||||
* To execute shell or command line command, your code must never use method like exec, shell_exec, popen, .. but must use the built-in
|
||||
method executeCLI() available into core/class/utils.class.php
|
||||
|
||||
|
||||
***** ChangeLog for 13.0.5 compared to 13.0.4 *****
|
||||
@ -1345,7 +1645,7 @@ NEW: Module "Credit transfer SEPA" to manage payment of vendors using bank credi
|
||||
NEW: Module Intracomm report
|
||||
NEW: Module Reception (for a more accurate management of your receptions) moved from experimental to stable.
|
||||
NEW: Module Recruitment to manage Job position and applications.
|
||||
NEW: Several security issues after a private bug bounty campaign.
|
||||
NEW: Several security issues after a private bug bounty campaign.
|
||||
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 balance - add a menu entry to show subtotal by group
|
||||
@ -1481,7 +1781,7 @@ NEW: show user on external calender events (when found)
|
||||
NEW: subject title with company name instead of application title in ticket message
|
||||
NEW: Support for Samba4 AD
|
||||
NEW: TakePOS appearance tab with more visual parameters
|
||||
NEW: TakePOS add alert before changing thirdparty
|
||||
NEW: TakePOS add alert before changing thirdparty
|
||||
NEW: TakePOS add third order printer
|
||||
NEW: TakePOS can change thirdparty with barcode scan
|
||||
NEW: TakePOS can create a thirdparty customer from TakePOS frontend
|
||||
@ -1492,9 +1792,9 @@ NEW: TakePOS display resiliate status for members
|
||||
NEW: TakePOS Gift Receipt
|
||||
NEW: TakePOS multicurrency compatibility
|
||||
NEW: TakePOS multicurrency total
|
||||
NEW: TakePOS print payment method and change
|
||||
NEW: TakePOS print payment method and change
|
||||
NEW: TakePOS restrict thirdparty to customer
|
||||
NEW: TakePOS show available stock
|
||||
NEW: TakePOS show available stock
|
||||
NEW: TakePOS Weighing Scale compatibility with TakePOS connector #14725
|
||||
NEW: Thirdparty Import new fields: mother company,outstanding debt limit,bank account,incoterms
|
||||
NEW: Thirdparty module : box on customer/supplier tab for invoice outsantding amount late
|
||||
@ -1507,8 +1807,8 @@ NEW: VAT report - Invert constant to show by default zero VAT in reports
|
||||
NEW: website page fields selection
|
||||
NEW: website - global header of a website can also have dynamic content
|
||||
NEW: when creating a user from a member linked to a thirdparty, you can choose to create it as external or internal user
|
||||
NEW: add clone button on miscellaneous payment
|
||||
NEW: add option to put the product label in bold in the PDF templates if configured #15065
|
||||
NEW: add clone button on miscellaneous payment
|
||||
NEW: add option to put the product label in bold in the PDF templates if configured #15065
|
||||
NEW: add option "If the feature to manage kits of module Stock is used, show details of subproducts of a kit on PDF."
|
||||
|
||||
|
||||
|
||||
@ -56,6 +56,10 @@ Vous pouvez aussi utiliser un serveur Web et une base de données prise en charg
|
||||
|
||||
Pour mettre à jour Dolibarr depuis une vieille version vers celle ci:
|
||||
|
||||
- Faites une sauvegarde de votre instance [voir ce tutorial](https://wiki.dolibarr.org/index.php/Installation_-_Upgrade#Upgrade_Dolibarr)
|
||||
|
||||
- Vérifiez que la nouvelle version est compatible avec la version PHP de votre serveur [voir PHP support](https://wiki.dolibarr.org/index.php/Releases).
|
||||
|
||||
- Ecrasez les vieux fichiers dans le vieux répertoire 'dolibarr' par les fichiers
|
||||
fournis dans ce nouveau package.
|
||||
|
||||
|
||||
@ -81,7 +81,7 @@ If you don't have time to install it yourself, you can try some commercial 'read
|
||||
Dolibarr supports upgrading, usually without the need for any (commercial) support (depending on if you use any commercial extensions). It supports upgrading all the way from any version after 2.8 without breakage. This is unique in the ERP ecosystem and a benefit our users highly appreciate!
|
||||
|
||||
- At first make a backup of your Dolibarr files & then [see](https://wiki.dolibarr.org/index.php/Installation_-_Upgrade#Upgrade_Dolibarr)
|
||||
- Check that your installed PHP version is supported by the new version [see PHP support](./doc/phpmatrix.md).
|
||||
- Check that your installed PHP version is supported by the new version [see PHP support](https://wiki.dolibarr.org/index.php/Releases).
|
||||
- Overwrite all old files from 'dolibarr' directory with files provided into the new version's package.
|
||||
- At first next access, Dolibarr will redirect you to the "install/" page to follow the upgrade process.
|
||||
If an `install.lock` file exists to lock any other upgrade process, the application will ask you to remove the file manually (you should find the `install.lock` file in the directory used to store generated and uploaded documents, in most cases, it is the directory called "*documents*").
|
||||
|
||||
@ -19,7 +19,6 @@ Depends: libapache2-mod-php5 | libapache2-mod-php5filter | php5-cgi | php5-fpm |
|
||||
php-pear, php-mail-mime,
|
||||
# php-tcpdf,
|
||||
# libfpdf-tpl-php, php-fpdf,
|
||||
# libphp-adodb,
|
||||
# libnusoap-php,
|
||||
# libphp-pclzip,
|
||||
# Required javascript libraries
|
||||
|
||||
@ -61,31 +61,6 @@ License: GPL-3+
|
||||
|
||||
------------------------------------------------------------
|
||||
|
||||
Files: htdocs/includes/adodbtime/*
|
||||
Copyright: 2003-2005, John Lim
|
||||
unknown, jackbbs
|
||||
License: BSD-3-Clause
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
.
|
||||
Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
.
|
||||
Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
.
|
||||
Neither the name of the John Lim nor the names of its contributors may be
|
||||
used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
Comment:
|
||||
Those files are not shipped in the binary package since we use
|
||||
the library as packaged in "libphp-adodb".
|
||||
|
||||
|
||||
------------------------------------------------------------
|
||||
|
||||
Files: htdocs/includes/ckeditor/*
|
||||
Copyright: 2003-2012 CKSource - Frederico Knabben
|
||||
License: GPL-2+
|
||||
|
||||
@ -146,7 +146,6 @@ case "$1" in
|
||||
#else
|
||||
# File already exist. We add params not found.
|
||||
#echo Add new params to overwrite path to use shared libraries/fonts
|
||||
#grep -q -c "dolibarr_lib_ADODB_PATH" $config || [ ! -d "/usr/share/php/adodb" ] || echo "<?php \$dolibarr_lib_ADODB_PATH='/usr/share/php/adodb'; ?>" >> $config
|
||||
##grep -q -c "dolibarr_lib_GEOIP_PATH" $config || echo "<?php \$dolibarr_lib_GEOIP_PATH=''; ?>" >> $config
|
||||
#grep -q -c "dolibarr_lib_NUSOAP_PATH" $config || [ ! -d "/usr/share/php/nusoap" ] || echo "<?php \$dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap'; ?>" >> $config
|
||||
#grep -q -c "dolibarr_lib_ODTPHP_PATHTOPCLZIP" $config || [ ! -d "/usr/share/php/libphp-pclzip" ] || echo "<?php \$dolibarr_lib_ODTPHP_PATHTOPCLZIP='/usr/share/php/libphp-pclzip'; ?>" >> $config
|
||||
|
||||
@ -31,7 +31,6 @@ $force_install_distrib='debian';
|
||||
// - not removed from package (see rm in rules file),
|
||||
// - declared into dependencies (see Depends in control file)
|
||||
//$force_dolibarr_lib_TCPDF_PATH='';
|
||||
//$force_dolibarr_lib_ADODB_PATH='/usr/share/php/adodb';
|
||||
//$force_dolibarr_lib_GEOIP_PATH='';
|
||||
//$force_dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap';
|
||||
//$force_dolibarr_lib_ODTPHP_PATHTOPCLZIP='/usr/share/php/libphp-pclzip';
|
||||
|
||||
@ -89,7 +89,6 @@ override_dh_install:
|
||||
rm -fr build/zip
|
||||
|
||||
# clean from all PHP embedded libraries (we use package dependencies instead)
|
||||
# rm -fr htdocs/includes/adodbtime
|
||||
# rm -fr htdocs/includes/geoip
|
||||
# rm -fr htdocs/includes/nusoap
|
||||
# rm -fr htdocs/includes/odtphp/zip/pclzip
|
||||
|
||||
@ -621,7 +621,6 @@ if ($nboftargetok) {
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nnnick/chartjs/scripts`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nnnick/chartjs/src`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nnnick/chartjs/test`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/lib/Mail`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/samples`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/php-iban/docs`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/sabre/sabre/*/tests`;
|
||||
|
||||
@ -293,6 +293,7 @@ foreach my $PROJECT (@PROJECTLIST) {
|
||||
}
|
||||
print "Clean $BUILDROOT\n";
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECTLC/.cache`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECTLC/.git`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECTLC/.project`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECTLC/.settings`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECTLC/index.php`;
|
||||
|
||||
@ -25,7 +25,7 @@ BuildArch: noarch
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
|
||||
Group: Applications/Productivity
|
||||
Requires: httpd, php >= 5.3.0, php-cli, php-gd, php-ldap, php-imap, php-mysqli, php-adodb, php-nusoap, dejavu-sans-fonts
|
||||
Requires: httpd, php >= 5.3.0, php-cli, php-gd, php-ldap, php-imap, php-mysqli, php-nusoap, dejavu-sans-fonts
|
||||
Requires: mysql-server, mysql
|
||||
#BuildRequires: desktop-file-utils
|
||||
|
||||
@ -104,7 +104,6 @@ cui hai bisogno ed essere facile da usare.
|
||||
%{__cp} -pr htdocs $RPM_BUILD_ROOT%{_datadir}/%{name}
|
||||
%{__cp} -pr scripts $RPM_BUILD_ROOT%{_datadir}/%{name}
|
||||
%{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/includes/ckeditor/_source
|
||||
%{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/includes/adodbtime
|
||||
%{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/includes/nusoap
|
||||
%{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/includes/fonts
|
||||
|
||||
@ -165,6 +164,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/barcode
|
||||
%_datadir/dolibarr/htdocs/blockedlog
|
||||
%_datadir/dolibarr/htdocs/bookmarks
|
||||
%_datadir/dolibarr/htdocs/bookcal
|
||||
%_datadir/dolibarr/htdocs/bom
|
||||
%_datadir/dolibarr/htdocs/categories
|
||||
%_datadir/dolibarr/htdocs/collab
|
||||
@ -274,7 +274,6 @@ if [ -s $config ] && grep -q "File generated by" $config
|
||||
then
|
||||
# File already exist. We add params not found.
|
||||
echo Add new params to overwrite path to use shared libraries/fonts
|
||||
grep -q -c "dolibarr_lib_ADODB_PATH" $config || [ ! -d "/usr/share/php/adodb" ] || echo "<?php \$dolibarr_lib_ADODB_PATH='/usr/share/php/adodb'; ?>" >> $config
|
||||
grep -q -c "dolibarr_lib_FPDI_PATH" $config || [ ! -d "/usr/share/php/fpdi" ] || echo "<?php \$dolibarr_lib_FPDI_PATH='/usr/share/php/fpdi'; ?>" >> $config
|
||||
#grep -q -c "dolibarr_lib_GEOIP_PATH" $config || echo "<?php \$dolibarr_lib_GEOIP_PATH=''; ?>" >> $config
|
||||
grep -q -c "dolibarr_lib_NUSOAP_PATH" $config || [ ! -d "/usr/share/php/nusoap" ] || echo "<?php \$dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap'; ?>" >> $config
|
||||
|
||||
@ -46,7 +46,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version}
|
||||
Group: Applications/Productivity
|
||||
Requires: httpd, php >= 5.3.0, php-cli, php-gd, php-ldap, php-imap, php-mysqli, php-adodb, php-nusoap, dejavu-sans-fonts, php-mbstring, php-xml
|
||||
Requires: httpd, php >= 5.3.0, php-cli, php-gd, php-ldap, php-imap, php-mysqli, php-nusoap, dejavu-sans-fonts, php-mbstring, php-xml
|
||||
Requires: mysql-server, mysql
|
||||
BuildRequires: desktop-file-utils
|
||||
%else
|
||||
@ -58,7 +58,7 @@ Requires: mysql, mysql-client
|
||||
%if 0%{?suse_version}
|
||||
# Voir http://en.opensuse.org/openSUSE:Packaging_Conventions_RPM_Macros
|
||||
Group: Productivity/Office/Management
|
||||
Requires: apache2, apache2-mod_php5, php5 >= 5.3.0, php5-gd, php5-ldap, php5-imap, php5-mysql, php5-openssl, dejavu
|
||||
Requires: apache2, apache2-mod_php, php >= 5.3.0, php-gd, php-ldap, php-imap, php-mysql, php-openssl, dejavu
|
||||
Requires: mysql-community-server, mysql-community-server-client
|
||||
BuildRequires: update-desktop-files fdupes
|
||||
%else
|
||||
@ -169,7 +169,6 @@ cui hai bisogno ed essere facile da usare.
|
||||
%{__cp} -pr scripts $RPM_BUILD_ROOT%{_datadir}/%{name}
|
||||
%{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/includes/ckeditor/_source
|
||||
%if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version}
|
||||
%{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/includes/adodbtime
|
||||
%{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/includes/nusoap
|
||||
%{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/includes/fonts
|
||||
%else
|
||||
@ -246,6 +245,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/barcode
|
||||
%_datadir/dolibarr/htdocs/blockedlog
|
||||
%_datadir/dolibarr/htdocs/bookmarks
|
||||
%_datadir/dolibarr/htdocs/bookcal
|
||||
%_datadir/dolibarr/htdocs/bom
|
||||
%_datadir/dolibarr/htdocs/categories
|
||||
%_datadir/dolibarr/htdocs/collab
|
||||
@ -425,7 +425,6 @@ if [ -s $config ] && grep -q "File generated by" $config
|
||||
then
|
||||
# File already exist. We add params not found.
|
||||
echo Add new params to overwrite path to use shared libraries/fonts
|
||||
grep -q -c "dolibarr_lib_ADODB_PATH" $config || [ ! -d "/usr/share/php/adodb" ] || echo "<?php \$dolibarr_lib_ADODB_PATH='/usr/share/php/adodb'; ?>" >> $config
|
||||
grep -q -c "dolibarr_lib_FPDI_PATH" $config || [ ! -d "/usr/share/php/fpdi" ] || echo "<?php \$dolibarr_lib_FPDI_PATH='/usr/share/php/fpdi'; ?>" >> $config
|
||||
#grep -q -c "dolibarr_lib_GEOIP_PATH" $config || echo "<?php \$dolibarr_lib_GEOIP_PATH=''; ?>" >> $config
|
||||
grep -q -c "dolibarr_lib_NUSOAP_PATH" $config || [ ! -d "/usr/share/php/nusoap" ] || echo "<?php \$dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap'; ?>" >> $config
|
||||
|
||||
@ -162,6 +162,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/barcode
|
||||
%_datadir/dolibarr/htdocs/blockedlog
|
||||
%_datadir/dolibarr/htdocs/bookmarks
|
||||
%_datadir/dolibarr/htdocs/bookcal
|
||||
%_datadir/dolibarr/htdocs/bom
|
||||
%_datadir/dolibarr/htdocs/categories
|
||||
%_datadir/dolibarr/htdocs/collab
|
||||
@ -271,7 +272,6 @@ if [ -s $config ] && grep -q "File generated by" $config
|
||||
then
|
||||
# File already exist. We add params not found.
|
||||
echo Add new params to overwrite path to use shared libraries/fonts
|
||||
grep -q -c "dolibarr_lib_ADODB_PATH" $config || [ ! -d "/usr/share/php/adodb" ] || echo "<?php \$dolibarr_lib_ADODB_PATH='/usr/share/php/adodb'; ?>" >> $config
|
||||
grep -q -c "dolibarr_lib_FPDI_PATH" $config || [ ! -d "/usr/share/php/fpdi" ] || echo "<?php \$dolibarr_lib_FPDI_PATH='/usr/share/php/fpdi'; ?>" >> $config
|
||||
#grep -q -c "dolibarr_lib_GEOIP_PATH" $config || echo "<?php \$dolibarr_lib_GEOIP_PATH=''; ?>" >> $config
|
||||
grep -q -c "dolibarr_lib_NUSOAP_PATH" $config || [ ! -d "/usr/share/php/nusoap" ] || echo "<?php \$dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap'; ?>" >> $config
|
||||
|
||||
@ -25,7 +25,7 @@ BuildArch: noarch
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
|
||||
Group: Productivity/Office/Management
|
||||
Requires: apache2, apache2-mod_php5, php5 >= 5.3.0, php5-gd, php5-ldap, php5-imap, php5-mysql, php5-openssl, dejavu
|
||||
Requires: apache2, apache2-mod_php, php >= 5.3.0, php-gd, php-ldap, php-imap, php-mysql, php-openssl, dejavu
|
||||
Requires: mysql-community-server, mysql-community-server-client
|
||||
%if 0%{?suse_version}
|
||||
BuildRequires: update-desktop-files fdupes
|
||||
@ -66,9 +66,8 @@ ed essere facile da usare.
|
||||
Programmo web, progettato per poter fornire solo ciò di
|
||||
cui hai bisogno ed essere facile da usare.
|
||||
|
||||
%_datadir/dolibarr/htdocs/webhook
|
||||
|
||||
#---- prep
|
||||
#---- prepo
|
||||
%prep
|
||||
%setup -q
|
||||
%patch0 -p0 -b .patch
|
||||
@ -173,6 +172,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/barcode
|
||||
%_datadir/dolibarr/htdocs/blockedlog
|
||||
%_datadir/dolibarr/htdocs/bookmarks
|
||||
%_datadir/dolibarr/htdocs/bookcal
|
||||
%_datadir/dolibarr/htdocs/bom
|
||||
%_datadir/dolibarr/htdocs/categories
|
||||
%_datadir/dolibarr/htdocs/collab
|
||||
@ -282,7 +282,6 @@ if [ -s $config ] && grep -q "File generated by" $config
|
||||
then
|
||||
# File already exist. We add params not found.
|
||||
echo Add new params to overwrite path to use shared libraries/fonts
|
||||
grep -q -c "dolibarr_lib_ADODB_PATH" $config || [ ! -d "/usr/share/php/adodb" ] || echo "<?php \$dolibarr_lib_ADODB_PATH='/usr/share/php/adodb'; ?>" >> $config
|
||||
grep -q -c "dolibarr_lib_FPDI_PATH" $config || [ ! -d "/usr/share/php/fpdi" ] || echo "<?php \$dolibarr_lib_FPDI_PATH='/usr/share/php/fpdi'; ?>" >> $config
|
||||
#grep -q -c "dolibarr_lib_GEOIP_PATH" $config || echo "<?php \$dolibarr_lib_GEOIP_PATH=''; ?>" >> $config
|
||||
grep -q -c "dolibarr_lib_NUSOAP_PATH" $config || [ ! -d "/usr/share/php/nusoap" ] || echo "<?php \$dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap'; ?>" >> $config
|
||||
|
||||
@ -20,7 +20,6 @@ $force_install_lockinstall='444';
|
||||
$force_install_distrib='rpmfedora';
|
||||
|
||||
// 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_FPDI_PATH='/usr/share/php/fpdi';
|
||||
//$force_dolibarr_lib_GEOIP_PATH='';
|
||||
$force_dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap';
|
||||
|
||||
@ -20,7 +20,6 @@ $force_install_lockinstall='444';
|
||||
$force_install_distrib='rpmmandriva';
|
||||
|
||||
// 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_FPDI_PATH='/usr/share/php/fpdi';
|
||||
//$force_dolibarr_lib_GEOIP_PATH='';
|
||||
$force_dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap';
|
||||
|
||||
@ -20,7 +20,6 @@ $force_install_lockinstall='444';
|
||||
$force_install_distrib='rpmopensuse';
|
||||
|
||||
// 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_FPDI_PATH='/usr/share/php/fpdi';
|
||||
//$force_dolibarr_lib_GEOIP_PATH='';
|
||||
//$force_dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap';
|
||||
|
||||
@ -1,28 +1,29 @@
|
||||
# ldapsearch_sample1.txt
|
||||
# ldapsearch is into package ldap-utils on debian.
|
||||
#
|
||||
# Use this sample to search into a ldap
|
||||
# Use this samples to test a ldap_bind or to make a search into a ldap
|
||||
#
|
||||
|
||||
# Anonymous access
|
||||
# ldapsearch -h hostname -p 389
|
||||
# ldapsearch -h hostname -p 389
|
||||
#
|
||||
# Login access (using a Bind DN)
|
||||
# ldapsearch -h hostname -p 389 -z 0 -D "uid=root,cn=users,dc=ldap,dc=test,dc=local" -w password
|
||||
# ldapsearch -H ldap://hostname:389 -z 0 -D "uid=root,cn=users,dc=ldap,dc=test,dc=local" -w password
|
||||
# ldapsearch -d1 -H ldap://hostname:389 -x -z 0 -D "uid=root,cn=users,dc=ldap,dc=test,dc=local" -w password
|
||||
# ldapsearch -H ldap://hostname:389 -z 0 -D "uid=root,cn=users,dc=ldap,dc=test,dc=local" -w password
|
||||
# Such access must succeed to use LDAP as login module.
|
||||
# ldapsearch -h hostname -p 389 -z 0 -D "uid=root,cn=users,dc=ldap,dc=test,dc=local" -w password
|
||||
# ldapsearch -H ldap://hostname:389 -z 0 -D "uid=root,cn=users,dc=ldap,dc=test,dc=local" -w password
|
||||
# ldapsearch -d1 -H ldap://hostname:389 -x -z 0 -D "uid=root,cn=users,dc=ldap,dc=test,dc=local" -w password
|
||||
# ldapsearch -H ldap://hostname:389 -z 0 -D "uid=root,cn=users,dc=ldap,dc=test,dc=local" -w password
|
||||
#
|
||||
# Login access in SSL (using a Bind DN)
|
||||
# ldapsearch -H ldaps://hostnamme:636 -z 0 -D "uid=root,cn=users,dc=ldap,dc=test,dc=local" -w password -b "cn=users,dc=ldap,dc=test,dc=local
|
||||
# ldapsearch -H ldaps://hostnamme:636 -z 0 -D "uid=root,cn=users,dc=ldap,dc=test,dc=local" -w password -b "cn=users,dc=ldap,dc=test,dc=local"
|
||||
# If it fails, you may try to use "hostname" that is real name of certificate.
|
||||
# You must also check that /etc/ldap/ldap.conf contains the line TLS_CACERT /etc/ssl/certs/ca-certificates.crt
|
||||
|
||||
# What to search
|
||||
# ldapsearch -h hostname -p 389 -x -D "uid=root,cn=users,dc=ldap,dc=test,dc=local" -w password -b "cn=users,dc=ldap,dc=test,dc=local"
|
||||
# ldapsearch -h hostname -p 389 -x -D "cn=manager,o=somecompany.com" -w password -b "ou=people,dc=teclib,dc=infra"
|
||||
# ldapsearch -h hostname -p 389 -x -D "cn=manager,o=somecompany.com" -w password -b "o=somecompany.com" "(objectclass=*)"
|
||||
# ldapsearch -h hostname -p 389 -x -D "uid=root,cn=users,dc=ldap,dc=test,dc=local" -w password -b "cn=users,dc=ldap,dc=test,dc=local"
|
||||
# ldapsearch -h hostname -p 389 -x -D "cn=manager,o=somecompany.com" -w password -b "ou=people,dc=teclib,dc=infra"
|
||||
# ldapsearch -h hostname -p 389 -x -D "cn=manager,o=somecompany.com" -w password -b "o=somecompany.com" "(objectclass=*)"
|
||||
#
|
||||
# Example to test a ldap search:
|
||||
# ldapsearch -h hostname -p 389 -x -z 5 -b 'OU=Collaborateurs,OU=Utilisateurs,OU=MyCompany,DC=bocal,DC=lan' -D 'CN=UserAdmin,OU=Informatique,OU=Utilisateurs,OU=MyCompany,DC=bocal,DC=lan' -w password
|
||||
# ldapsearch -h hostname -p 389 -x -z 5 -b 'OU=Collaborateurs,OU=Utilisateurs,OU=MyCompany,DC=bocal,DC=lan' -D 'CN=UserAdmin,OU=Informatique,OU=Utilisateurs,OU=MyCompany,DC=bocal,DC=lan' -w password
|
||||
|
||||
|
||||
@ -12,3 +12,11 @@ Le client règle rapidement et on lui accorde un escompte de 3% (120 € * 3% =
|
||||
411xxx 3,60 € TTC
|
||||
|
||||
Et ça marche à l’inverse avec un fournisseur sauf que l’on est en 775000 au lieu de 665000 pour escompte obtenus.
|
||||
|
||||
|
||||
|
||||
|
||||
Un compte comptable de Tiers vente = Acount Receivable
|
||||
Un compte comptable de Tiers achat = Acount Payable
|
||||
|
||||
|
||||
@ -3,7 +3,14 @@
|
||||
#php_admin_value mail.force_extra_parameters "-f postmaster@mydomain.com"
|
||||
php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f postmaster@mydomain.com"
|
||||
php_admin_value open_basedir /tmp/:/home/.../htdocs:/home/.../dolibarr_documents:
|
||||
|
||||
|
||||
# Add this to use a custom apparmor profile when using apache php handler
|
||||
<IfModule mod_apparmor.c>
|
||||
AADefaultHatName sellyoursaas-instances
|
||||
</IfModule>
|
||||
|
||||
|
||||
ServerName myvirtualalias
|
||||
ServerAlias myvirtualalias
|
||||
|
||||
@ -82,9 +89,9 @@
|
||||
# /usr/share/doc/apache2.2-common/README.Debian.gz for more info.
|
||||
# If both key and certificate are stored in the same file, only the
|
||||
# SSLCertificateFile directive is needed.
|
||||
SSLCertificateFile /etc/letsencrypt/live/www.mydomain.com/cert.pem
|
||||
SSLCertificateKeyFile /etc/letsencrypt/live/www.mydomain.com/privkey.pem
|
||||
SSLCertificateChainFile /etc/letsencrypt/live/www.mydomain.com/chain.pem
|
||||
#SSLCertificateFile /etc/letsencrypt/live/www.mydomain.com/cert.pem
|
||||
#SSLCertificateKeyFile /etc/letsencrypt/live/www.mydomain.com/privkey.pem
|
||||
#SSLCertificateChainFile /etc/letsencrypt/live/www.mydomain.com/chain.pem
|
||||
|
||||
#RewriteEngine on
|
||||
#RewriteCond %{SERVER_PORT} ^80$
|
||||
|
||||
@ -15,9 +15,10 @@
|
||||
<exclude-pattern type="relative">htdocs/install/doctemplates/websites</exclude-pattern>
|
||||
<exclude-pattern type="relative">htdocs/conf.php</exclude-pattern>
|
||||
<exclude-pattern type="relative">*/nltechno*</exclude-pattern>
|
||||
<exclude-pattern type="relative">*/htdocs/includes</exclude-pattern>
|
||||
<exclude-pattern type="relative">source</exclude-pattern>
|
||||
<exclude-pattern type="relative">.git</exclude-pattern>
|
||||
<exclude-pattern>htdocs/includes</exclude-pattern>
|
||||
<exclude-pattern>htdocs/install/doctemplates/websites</exclude-pattern>
|
||||
|
||||
<!-- List of all tests -->
|
||||
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
# Fail2Ban configuration file
|
||||
#
|
||||
# Regexp to catch known spambots and software alike. Please verify
|
||||
# that it is your intent to block IPs which were driven by
|
||||
# above mentioned bots.
|
||||
# Regexp to detect access on public pages so we can add mitigation on IP making too much
|
||||
# access to your a Dolibarr instance.
|
||||
|
||||
|
||||
[Definition]
|
||||
@ -11,7 +10,7 @@
|
||||
# echo `date +'%Y-%m-%d %H:%M:%S'`" INFO 1.2.3.4 --- Access to GET /public/clicktodial/cidlookup.php" >> /mypath/documents/dolibarr.log
|
||||
#
|
||||
# then
|
||||
# fail2ban-client status web-dol-passforgotten
|
||||
# fail2ban-client status web-dolibarr-limitpublic
|
||||
#
|
||||
# To test rule file on a existing log file
|
||||
# fail2ban-regex /mypath/documents/dolibarr.log /etc/fail2ban/filter.d/web-dolibarr-limitpublic.conf
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
# Fail2Ban configuration file
|
||||
#
|
||||
# Regexp to catch known spambots and software alike. Please verify
|
||||
# that it is your intent to block IPs which were driven by
|
||||
# above mentioned bots.
|
||||
# Regexp to detect try to check a couple login/password so we can add mitigation
|
||||
# on IP making too much tries.
|
||||
|
||||
|
||||
[Definition]
|
||||
@ -11,7 +10,7 @@
|
||||
# echo `date +'%Y-%m-%d %H:%M:%S'`" INFO 1.2.3.4 functions_dolibarr::check_user_password_abcd Authentication KO" >> /mypath/documents/dolibarr.log
|
||||
#
|
||||
# then
|
||||
# fail2ban-client status web-dol-bruteforce
|
||||
# fail2ban-client status web-dolibarr-rulesbruteforce
|
||||
#
|
||||
# To test rule file on a existing log file
|
||||
# fail2ban-regex /mypath/documents/dolibarr.log /etc/fail2ban/filter.d/web-dolibarr-rulesbruteforce.conf
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
# Fail2Ban configuration file
|
||||
#
|
||||
# Regexp to catch known spambots and software alike. Please verify
|
||||
# that it is your intent to block IPs which were driven by
|
||||
# above mentioned bots.
|
||||
# Regexp to detect access on passwordforgotten.php page so we can add mitigation on IP making too much
|
||||
# access to this Dolibarr page.
|
||||
|
||||
|
||||
[Definition]
|
||||
@ -11,7 +10,7 @@
|
||||
# echo `date +'%Y-%m-%d %H:%M:%S'`" INFO 1.2.3.4 --- Access to GET /passwordforgotten.php - action=buildnewpassword, massaction=" >> /mypath/documents/dolibarr.log
|
||||
#
|
||||
# then
|
||||
# fail2ban-client status web-dol-passforgotten
|
||||
# fail2ban-client status web-dolibarr-rulespassforgotten
|
||||
#
|
||||
# To test rule file on a existing log file
|
||||
# fail2ban-regex /mypath/documents/dolibarr.log /etc/fail2ban/filter.d/web-dolibarr-rulespassforgotten.conf
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Count number of different contributors and number of commits for a given year.
|
||||
#
|
||||
|
||||
if [ "x$1" = "x" ]; then
|
||||
echo "Usage: $0 YEAR"
|
||||
exit
|
||||
|
||||
@ -1,6 +1,10 @@
|
||||
#/bin/bash
|
||||
Releases=("3.8" "3.9" "4.0" "5.0" "6.0" " 7.0" "develop")
|
||||
Dates=("2013-01-01", "2014-01-01", "2015-01-01", "2016-07-01", "2017-02-01", "2017-07-01", "2018-02-01", "2050-01-01")
|
||||
#
|
||||
# Count number of commits per user and per versions (using date for version detection)
|
||||
#
|
||||
|
||||
Releases=("16.0" "develop")
|
||||
Dates=("2022-01-01" "2022-08-31" "2050-01-01")
|
||||
let "counter = 1"
|
||||
|
||||
for i in "${Releases[@]}"
|
||||
|
||||
16
dev/tools/github_lines_perusers.sh
Executable file
16
dev/tools/github_lines_perusers.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#/bin/bash
|
||||
#
|
||||
# Count number of lines modified per user for a given branch
|
||||
#
|
||||
|
||||
if [ "x$2" = "x" ]; then
|
||||
echo "Usage: $0 tagnamestart|START tagnameend|HEAD"
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
echo "git log $1..$2 --shortstat | grep ... | perl ... > /tmp/github_lines_perusers.tmp"
|
||||
git log $1..$2 --shortstat | grep -e 'Author:' -e 'Date:' -e ' changed' -e ' insertion' -e ' deletion' | perl -n -e '/^(.*)$/; $line = $1; if ($line =~ /(changed|insertion|deletion)/) { $line =~ s/[^0-9\s]//g; my @arr=split /\s+/, $line; $tot=0; for (1..@arr) { $tot += $arr[$_]; }; print $tot."\n"; } else { print $line."\n"; };' > /tmp/github_lines_perusers.tmp
|
||||
|
||||
cat /tmp/github_lines_perusers.tmp | awk 'BEGIN { FS="\n"; print "user and nb of lines"; lastuser=""; } { if ($1 ~ /Author:/) { lastuser=$1 }; if ($1 ~ /^[0-9]+$/) { aaa[lastuser]+=$1; } } END { for (var in aaa) print var," ",aaa[var]; } '
|
||||
|
||||
@ -121,9 +121,11 @@ main()
|
||||
|
||||
# Search of all jpg/jpeg/png in $INPUT
|
||||
# We remove images from $OUTPUT if $OUTPUT is a subdirectory of $INPUT
|
||||
echo "Scan $INPUT to find images with find $INPUT -regextype posix-extended -regex '.*\.(jpg|jpeg|png)' | grep -v '/gource/' | grep -v '/includes/' | grep -v '/custom/' | grep -v $OUTPUT"
|
||||
echo "Scan $INPUT to find images with find $INPUT -regextype posix-extended -regex '.*\.(jpg|jpeg|png)' | grep -v '/gource/' | grep -v '/includes/' | grep -v '/custom/' | grep -v '/documents/' | grep -v $OUTPUT"
|
||||
#echo "Scan $INPUT to find images with find $INPUT -regextype posix-extended -regex '.*\.(jpg|jpeg|png)' | grep -v '/gource/' | grep -v '/includes/' | grep -v '/custom/'"
|
||||
IMAGES=$(find $INPUT -regextype posix-extended -regex '.*\.(jpg|jpeg|png)' | grep -v '/gource/' | grep -v '/includes/' | grep -v '/custom/' | grep -v '/documents/' | grep -v $OUTPUT)
|
||||
|
||||
#IMAGES=$(find $INPUT -regextype posix-extended -regex '.*\.(jpg|jpeg|png)' | grep -v '/gource/' | grep -v '/includes/' | grep -v '/custom/')
|
||||
|
||||
if [ "$QUIET" == "0" ]; then
|
||||
echo --- Optimizing $INPUT ---
|
||||
echo
|
||||
|
||||
@ -85,7 +85,7 @@ if ($action == 'add' && $user->hasRight('accounting', 'chartofaccount')) {
|
||||
// Clean code
|
||||
|
||||
// To manage zero or not at the end of the accounting account
|
||||
if ($conf->global->ACCOUNTING_MANAGE_ZERO == 1) {
|
||||
if (!empty($conf->global->ACCOUNTING_MANAGE_ZERO)) {
|
||||
$account_number = $account_number;
|
||||
} else {
|
||||
$account_number = clean_account($account_number);
|
||||
@ -148,7 +148,7 @@ if ($action == 'add' && $user->hasRight('accounting', 'chartofaccount')) {
|
||||
// Clean code
|
||||
|
||||
// To manage zero or not at the end of the accounting account
|
||||
if (isset($conf->global->ACCOUNTING_MANAGE_ZERO) && $conf->global->ACCOUNTING_MANAGE_ZERO == 1) {
|
||||
if (!empty($conf->global->ACCOUNTING_MANAGE_ZERO)) {
|
||||
$account_number = $account_number;
|
||||
} else {
|
||||
$account_number = clean_account($account_number);
|
||||
@ -426,11 +426,9 @@ if ($action == 'create') {
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Modify').'</a>';
|
||||
}
|
||||
|
||||
if ($user->hasRight('accounting', 'chartofaccount')) {
|
||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id.'">'.$langs->trans('Delete').'</a>';
|
||||
} else {
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Delete').'</a>';
|
||||
}
|
||||
// Delete
|
||||
$permissiontodelete = $user->hasRight('accounting', 'chartofaccount');
|
||||
print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete);
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@ $langs->loadLangs(array("admin", "compta"));
|
||||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (empty($user->rights->accounting->fiscalyear->write)) { // If we can read accounting records, we should be able to see fiscal year.
|
||||
if (!$user->hasRight('accounting', 'fiscalyear', 'write')) { // If we can read accounting records, we should be able to see fiscal year.
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
@ -35,7 +35,7 @@ $langs->loadLangs(array("admin", "compta"));
|
||||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (empty($user->rights->accounting->fiscalyear->write)) {
|
||||
if (!$user->hasRight('accounting', 'fiscalyear', 'write')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
@ -305,7 +305,7 @@ if ($action == 'create') {
|
||||
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&id='.$id.'">'.$langs->trans('Modify').'</a>';
|
||||
|
||||
// print '<a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?action=delete&token='.newToken().'&id=' . $id . '">' . $langs->trans('Delete') . '</a>';
|
||||
//print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete);
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
@ -34,7 +34,7 @@ $langs->loadLangs(array("admin", "compta"));
|
||||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (empty($user->rights->accounting->fiscalyear->write)) {
|
||||
if (!$user->hasRight('accounting', 'fiscalyear', 'write')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
@ -247,6 +247,20 @@ if ($action == 'setdisablebindingonexpensereports') {
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'setenablelettering') {
|
||||
$setenablelettering = GETPOST('value', 'int');
|
||||
$res = dolibarr_set_const($db, "ACCOUNTING_ENABLE_LETTERING", $setenablelettering, 'yesno', 0, '', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
} else {
|
||||
setEventMessages($langs->trans("Error"), null, 'mesgs');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -266,6 +280,9 @@ if (!$user->admin) {
|
||||
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
print '<div class="info">' . $langs->trans("ConstantIsOn", "FACTURE_DEPOSITS_ARE_JUST_PAYMENTS") . '</div>';
|
||||
}
|
||||
if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
print '<div class="info">' . $langs->trans("ConstantIsOn", "FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS") . '</div>';
|
||||
}
|
||||
if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
|
||||
print '<div class="info">' . $langs->trans("ConstantIsOn", "ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY") . '</div>';
|
||||
}
|
||||
@ -463,6 +480,27 @@ print '</tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
// Lettering params
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="2">'.$langs->trans('Options').' '.$langs->trans('Lettering').'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("ACCOUNTING_ENABLE_LETTERING").'</td>';
|
||||
if (!empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) {
|
||||
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setenablelettering&value=0">';
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
print '</a></td>';
|
||||
} else {
|
||||
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setenablelettering&value=1">';
|
||||
print img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
print '</a></td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<div class="center"><input type="submit" class="button button-edit" name="button" value="'.$langs->trans('Modify').'"></div>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
@ -611,12 +611,6 @@ if ($id) {
|
||||
if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i', $obj->code))) {
|
||||
$iserasable = 0;
|
||||
$canbedisabled = 0;
|
||||
} elseif ($obj->code == 'RECEP') {
|
||||
$iserasable = 0;
|
||||
$canbedisabled = 0;
|
||||
} elseif ($obj->code == 'EF0') {
|
||||
$iserasable = 0;
|
||||
$canbedisabled = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -45,7 +45,7 @@ $langs->loadLangs(array("companies", "compta", "accountancy", "products"));
|
||||
if (!isModEnabled('accounting')) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (empty($user->rights->accounting->bind->write)) {
|
||||
if (!$user->hasRight('accounting', 'bind', 'write')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
@ -150,7 +150,7 @@ if (!isModEnabled('accounting')) {
|
||||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (empty($user->rights->accounting->mouvements->lire)) {
|
||||
if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
@ -86,7 +86,7 @@ if (!isModEnabled('accounting')) {
|
||||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (empty($user->rights->accounting->mouvements->lire)) {
|
||||
if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
@ -155,7 +155,7 @@ $hookmanager->initHooks(array('bookkeepinglist'));
|
||||
$formaccounting = new FormAccounting($db);
|
||||
$form = new Form($db);
|
||||
|
||||
if (!in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && !GETPOSTISSET('begin') && !GETPOSTISSET('formfilteraction') && GETPOST('page', 'int') == '' && !GETPOST('noreset', 'int') && $user->rights->accounting->mouvements->export) {
|
||||
if (!in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && !GETPOSTISSET('begin') && !GETPOSTISSET('formfilteraction') && GETPOST('page', 'int') == '' && !GETPOST('noreset', 'int') && $user->hasRight('accounting', 'mouvements', 'export')) {
|
||||
if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET('restore_lastsearch_values') && !GETPOST('search_accountancy_code_start')) {
|
||||
$query = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear ";
|
||||
$query .= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."' limit 1";
|
||||
@ -221,7 +221,7 @@ if (!isModEnabled('accounting')) {
|
||||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (empty($user->rights->accounting->mouvements->lire)) {
|
||||
if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
@ -235,7 +235,7 @@ $param = '';
|
||||
if (GETPOST('cancel', 'alpha')) {
|
||||
$action = 'list'; $massaction = '';
|
||||
}
|
||||
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'preunlettering' && $massaction != 'predeletebookkeepingwriting') {
|
||||
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'preunletteringauto' && $massaction != 'preunletteringmanual' && $massaction != 'predeletebookkeepingwriting') {
|
||||
$massaction = '';
|
||||
}
|
||||
|
||||
@ -347,6 +347,10 @@ if (empty($reshook)) {
|
||||
$filter['t.numero_compte<='] = $search_accountancy_code_end;
|
||||
$param .= '&search_accountancy_code_end='.urlencode($search_accountancy_code_end);
|
||||
}
|
||||
if (!empty($search_accountancy_aux_code)) {
|
||||
$filter['t.subledger_account'] = $search_accountancy_aux_code;
|
||||
$param .= '&search_accountancy_aux_code='.urlencode($search_accountancy_aux_code);
|
||||
}
|
||||
if (!empty($search_accountancy_aux_code_start)) {
|
||||
$filter['t.subledger_account>='] = $search_accountancy_aux_code_start;
|
||||
$param .= '&search_accountancy_aux_code_start='.urlencode($search_accountancy_aux_code_start);
|
||||
@ -434,7 +438,7 @@ if (empty($reshook)) {
|
||||
$param .= '&search_import_key='.urlencode($search_import_key);
|
||||
}
|
||||
|
||||
//if ($action == 'delbookkeepingyearconfirm' && $user->rights->accounting->mouvements->supprimer_tous) {
|
||||
//if ($action == 'delbookkeepingyearconfirm' && !$user->hasRight('accounting', 'mouvements', 'supprimer_tous')) {
|
||||
// $delmonth = GETPOST('delmonth', 'int');
|
||||
// $delyear = GETPOST('delyear', 'int');
|
||||
// if ($delyear == -1) {
|
||||
@ -486,44 +490,61 @@ if (empty($reshook)) {
|
||||
$uploaddir = $conf->societe->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
|
||||
if (!$error && $action == 'deletebookkeepingwriting' && $confirm == "yes" && $user->rights->accounting->mouvements->supprimer) {
|
||||
if (!$error && $action == 'deletebookkeepingwriting' && $confirm == "yes" && $user->hasRight('accounting', 'mouvements', 'supprimer')) {
|
||||
$db->begin();
|
||||
|
||||
if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING')) {
|
||||
$lettering = new Lettering($db);
|
||||
$nb_lettering = $lettering->bookkeepingLetteringAll($toselect, true);
|
||||
if ($nb_lettering < 0) {
|
||||
setEventMessages('', $lettering->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
$nbok = 0;
|
||||
foreach ($toselect as $toselectid) {
|
||||
$result = $object->fetch($toselectid);
|
||||
if ($result > 0 && (!isset($object->date_validation) || $object->date_validation === '')) {
|
||||
$result = $object->deleteMvtNum($object->piece_num);
|
||||
if ($result > 0) {
|
||||
$nbok++;
|
||||
} else {
|
||||
if (!$error) {
|
||||
foreach ($toselect as $toselectid) {
|
||||
$result = $object->fetch($toselectid);
|
||||
if ($result > 0 && (!isset($object->date_validation) || $object->date_validation === '')) {
|
||||
$result = $object->deleteMvtNum($object->piece_num);
|
||||
if ($result > 0) {
|
||||
$nbok++;
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
} elseif ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
} elseif ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Message for elements well deleted
|
||||
if ($nbok > 1) {
|
||||
setEventMessages($langs->trans("RecordsDeleted", $nbok), null, 'mesgs');
|
||||
} elseif ($nbok > 0) {
|
||||
setEventMessages($langs->trans("RecordDeleted", $nbok), null, 'mesgs');
|
||||
} elseif (!$error) {
|
||||
setEventMessages($langs->trans("NoRecordDeleted"), null, 'mesgs');
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
|
||||
// Message for elements well deleted
|
||||
if ($nbok > 1) {
|
||||
setEventMessages($langs->trans("RecordsDeleted", $nbok), null, 'mesgs');
|
||||
} elseif ($nbok > 0) {
|
||||
setEventMessages($langs->trans("RecordDeleted", $nbok), null, 'mesgs');
|
||||
} else {
|
||||
setEventMessages($langs->trans("NoRecordDeleted"), null, 'mesgs');
|
||||
}
|
||||
|
||||
header("Location: ".$_SERVER["PHP_SELF"]."?noreset=1".($param ? '&'.$param : ''));
|
||||
exit;
|
||||
} else {
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
|
||||
// others mass actions
|
||||
if (!$error && getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && $user->rights->accounting->mouvements->creer) {
|
||||
if ($massaction == 'lettering') {
|
||||
if (!$error && getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && $user->hasRight('accounting', 'mouvements', 'creer')) {
|
||||
if ($massaction == 'letteringauto') {
|
||||
$lettering = new Lettering($db);
|
||||
$nb_lettering = $lettering->bookkeepingLetteringAll($toselect);
|
||||
if ($nb_lettering < 0) {
|
||||
@ -544,7 +565,17 @@ if (empty($reshook)) {
|
||||
header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
|
||||
exit();
|
||||
}
|
||||
} elseif ($action == 'unlettering' && $confirm == "yes") {
|
||||
} elseif ($massaction == 'letteringmanual') {
|
||||
$lettering = new Lettering($db);
|
||||
$result = $lettering->updateLettering($toselect);
|
||||
if ($result < 0) {
|
||||
setEventMessages('', $lettering->errors, 'errors');
|
||||
} else {
|
||||
setEventMessages($langs->trans('AccountancyOneLetteringModifiedSuccessfully'), array(), 'mesgs');
|
||||
header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
|
||||
exit();
|
||||
}
|
||||
} elseif ($action == 'unletteringauto' && $confirm == "yes") {
|
||||
$lettering = new Lettering($db);
|
||||
$nb_lettering = $lettering->bookkeepingLetteringAll($toselect, true);
|
||||
if ($nb_lettering < 0) {
|
||||
@ -565,6 +596,16 @@ if (empty($reshook)) {
|
||||
header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
|
||||
exit();
|
||||
}
|
||||
} elseif ($action == 'unletteringmanual' && $confirm == "yes") {
|
||||
$lettering = new Lettering($db);
|
||||
$nb_lettering = $lettering->deleteLettering($toselect);
|
||||
if ($result < 0) {
|
||||
setEventMessages('', $lettering->errors, 'errors');
|
||||
} else {
|
||||
setEventMessages($langs->trans('AccountancyOneUnletteringModifiedSuccessfully'), array(), 'mesgs');
|
||||
header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -652,7 +693,7 @@ if (!empty($sortfield)) {
|
||||
|
||||
// Export into a file with format defined into setup (FEC, CSV, ...)
|
||||
// Must be after definition of $sql
|
||||
if ($action == 'export_fileconfirm' && $user->rights->accounting->mouvements->export) {
|
||||
if ($action == 'export_fileconfirm' && $user->hasRight('accounting', 'mouvements', 'export')) {
|
||||
// TODO Replace the fetchAll to get all ->line followed by call to ->export(). It consumes too much memory on large export.
|
||||
// Replace this with the query($sql) and loop on each line to export them.
|
||||
$result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter, 'AND', (empty($conf->global->ACCOUNTING_REEXPORT) ? 0 : 1));
|
||||
@ -663,6 +704,17 @@ if ($action == 'export_fileconfirm' && $user->rights->accounting->mouvements->ex
|
||||
// Export files then exit
|
||||
$accountancyexport = new AccountancyExport($db);
|
||||
|
||||
$notexportlettering = GETPOST('notexportlettering', 'alpha');
|
||||
|
||||
if (!empty($notexportlettering)) {
|
||||
if (is_array($object->lines)) {
|
||||
foreach ($object->lines as $k => $movement) {
|
||||
unset($object->lines[$k]->lettering_code);
|
||||
unset($object->lines[$k]->date_lettering);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$mimetype = $accountancyexport->getMimeType($formatexportset);
|
||||
|
||||
top_httphead($mimetype, 1);
|
||||
@ -765,6 +817,19 @@ $formconfirm = '';
|
||||
if ($action == 'export_file') {
|
||||
$form_question = array();
|
||||
|
||||
if (getDolGlobalInt("ACCOUNTING_ENABLE_LETTERING")) {
|
||||
// If 1, we check by default.
|
||||
$checked = !empty($conf->global->ACCOUNTING_DEFAULT_NOT_EXPORT_LETTERING) ? 'true' : 'false';
|
||||
$form_question['notexportlettering'] = array(
|
||||
'name' => 'notexportlettering',
|
||||
'type' => 'checkbox',
|
||||
'label' => $langs->trans('NotExportLettering'),
|
||||
'value' => $checked,
|
||||
);
|
||||
|
||||
$form_question['separator'] = array('name'=>'separator', 'type'=>'separator');
|
||||
}
|
||||
|
||||
// If 1 or not set, we check by default.
|
||||
$checked = (!isset($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE) || !empty($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE));
|
||||
$form_question['notifiedexportdate'] = array(
|
||||
@ -774,7 +839,7 @@ if ($action == 'export_file') {
|
||||
'value' => (!empty($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE) ? 'false' : 'true'),
|
||||
);
|
||||
|
||||
$form_question['separator'] = array('name'=>'separator', 'type'=>'separator');
|
||||
$form_question['separator2'] = array('name'=>'separator2', 'type'=>'separator');
|
||||
|
||||
if (!getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")) {
|
||||
// If 0 or not set, we NOT check by default.
|
||||
@ -786,10 +851,10 @@ if ($action == 'export_file') {
|
||||
'value' => $checked,
|
||||
);
|
||||
|
||||
$form_question['separator2'] = array('name'=>'separator2', 'type'=>'separator');
|
||||
$form_question['separator3'] = array('name'=>'separator3', 'type'=>'separator');
|
||||
}
|
||||
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', $langs->trans('ConfirmExportFile'), 'export_fileconfirm', $form_question, '', 1, 300, 600);
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', $langs->trans('ConfirmExportFile'), 'export_fileconfirm', $form_question, '', 1, 350, 600);
|
||||
}
|
||||
|
||||
//if ($action == 'delbookkeepingyear') {
|
||||
@ -846,16 +911,16 @@ if ($limit > 0 && $limit != $conf->liste_limit) {
|
||||
|
||||
// List of mass actions available
|
||||
$arrayofmassactions = array();
|
||||
/*
|
||||
if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && $user->rights->accounting->mouvements->creer) {
|
||||
$arrayofmassactions['lettering'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('Lettering');
|
||||
$arrayofmassactions['preunlettering'] = img_picto('', 'uncheck', 'class="pictofixedwidth"') . $langs->trans('Unlettering');
|
||||
$arrayofmassactions['letteringauto'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('LetteringAuto');
|
||||
$arrayofmassactions['preunletteringauto'] = img_picto('', 'uncheck', 'class="pictofixedwidth"') . $langs->trans('UnletteringAuto');
|
||||
$arrayofmassactions['letteringmanual'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('LetteringManual');
|
||||
$arrayofmassactions['preunletteringmanual'] = img_picto('', 'uncheck', 'class="pictofixedwidth"') . $langs->trans('UnletteringManual');
|
||||
}
|
||||
*/
|
||||
if ($user->rights->accounting->mouvements->supprimer) {
|
||||
if ($user->hasRight('accounting', 'mouvements', 'supprimer')) {
|
||||
$arrayofmassactions['predeletebookkeepingwriting'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
|
||||
}
|
||||
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('preunlettering', 'predeletebookkeepingwriting'))) {
|
||||
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('preunletteringauto', 'preunletteringmanual', 'predeletebookkeepingwriting'))) {
|
||||
$arrayofmassactions = array();
|
||||
}
|
||||
$massactionbutton = $form->selectMassAction($massaction, $arrayofmassactions);
|
||||
@ -888,8 +953,8 @@ if (empty($reshook)) {
|
||||
}
|
||||
$newcardbutton .= '<span class="valignmiddle marginrightonly">'.$langs->trans("IncludeDocsAlreadyExported").'</span>';
|
||||
|
||||
if (!empty($user->rights->accounting->mouvements->export)) {
|
||||
$newcardbutton .= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', 'fa fa-file-export paddingleft', $_SERVER["PHP_SELF"].'?action=export_file&token='.newToken().($param ? '&'.$param : ''), $user->rights->accounting->mouvements->export);
|
||||
if ($user->hasRight('accounting', 'mouvements', 'export')) {
|
||||
$newcardbutton .= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', 'fa fa-file-export paddingleft', $_SERVER["PHP_SELF"].'?action=export_file&token='.newToken().($param ? '&'.$param : ''), $user->hasRight('accounting', 'mouvements', 'export'));
|
||||
}
|
||||
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
|
||||
@ -900,13 +965,15 @@ if (empty($reshook)) {
|
||||
if (!empty($socid)) {
|
||||
$url .= '&socid='.$socid;
|
||||
}
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', $url, '', $user->rights->accounting->mouvements->creer);
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', $url, '', $user->hasRight('accounting', 'mouvements', 'creer'));
|
||||
}
|
||||
|
||||
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1);
|
||||
|
||||
if ($massaction == 'preunlettering') {
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassUnlettering"), $langs->trans("ConfirmMassUnletteringQuestion", count($toselect)), "unlettering", null, '', 0, 200, 500, 1);
|
||||
if ($massaction == 'preunletteringauto') {
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassUnletteringAuto"), $langs->trans("ConfirmMassUnletteringQuestion", count($toselect)), "unletteringauto", null, '', 0, 200, 500, 1);
|
||||
} elseif ($massaction == 'preunletteringmanual') {
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassUnletteringManual"), $langs->trans("ConfirmMassUnletteringQuestion", count($toselect)), "unletteringmanual", null, '', 0, 200, 500, 1);
|
||||
} elseif ($massaction == 'predeletebookkeepingwriting') {
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassDeleteBookkeepingWriting"), $langs->trans("ConfirmMassDeleteBookkeepingWritingQuestion", count($toselect)), "deletebookkeepingwriting", null, '', 0, 200, 500, 1);
|
||||
}
|
||||
@ -926,7 +993,7 @@ if ($massactionbutton && $contextpage != 'poslist') {
|
||||
$moreforfilter = '';
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
||||
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) {
|
||||
$moreforfilter .= $hookmanager->resPrint;
|
||||
} else {
|
||||
@ -938,7 +1005,13 @@ print '<table class="tagtable liste centpercent">';
|
||||
|
||||
// Filters lines
|
||||
print '<tr class="liste_titre_filter">';
|
||||
|
||||
// Action column
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td class="liste_titre center">';
|
||||
$searchpicto = $form->showFilterButtons('left');
|
||||
print $searchpicto;
|
||||
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>';
|
||||
@ -946,7 +1019,7 @@ if (!empty($arrayfields['t.piece_num']['checked'])) {
|
||||
// Code journal
|
||||
if (!empty($arrayfields['t.code_journal']['checked'])) {
|
||||
print '<td class="liste_titre center">';
|
||||
print $formaccounting->multi_select_journal($search_ledger_code, 'search_ledger_code', 0, 1, 1, 1, 'small maxwidth150');
|
||||
print $formaccounting->multi_select_journal($search_ledger_code, 'search_ledger_code', 0, 1, 1, 1, 'small maxwidth75');
|
||||
print '</td>';
|
||||
}
|
||||
// Date document
|
||||
@ -1074,13 +1147,18 @@ if (!empty($arrayfields['t.import_key']['checked'])) {
|
||||
print '</td>';
|
||||
}
|
||||
// Action column
|
||||
print '<td class="liste_titre center">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td class="liste_titre center">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
|
||||
}
|
||||
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);
|
||||
}
|
||||
@ -1130,7 +1208,9 @@ if (!empty($arrayfields['t.date_validated']['checked'])) {
|
||||
if (!empty($arrayfields['t.import_key']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['t.import_key']['label'], $_SERVER["PHP_SELF"], "t.import_key", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
}
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
@ -1185,6 +1265,18 @@ while ($i < min($num, $limit)) {
|
||||
$total_credit += $line->credit;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
// Action column
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td class="nowraponall center">';
|
||||
if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
$selected = 0;
|
||||
if (in_array($line->id, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
}
|
||||
print '<input id="cb'.$line->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$line->id.'"'.($selected ? ' checked="checked"' : '').' />';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Piece number
|
||||
if (!empty($arrayfields['t.piece_num']['checked'])) {
|
||||
@ -1389,15 +1481,17 @@ while ($i < min($num, $limit)) {
|
||||
}
|
||||
|
||||
// Action column
|
||||
print '<td class="nowraponall center">';
|
||||
if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
$selected = 0;
|
||||
if (in_array($line->id, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td class="nowraponall center">';
|
||||
if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
$selected = 0;
|
||||
if (in_array($line->id, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
}
|
||||
print '<input id="cb'.$line->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$line->id.'"'.($selected ? ' checked="checked"' : '').' />';
|
||||
}
|
||||
print '<input id="cb'.$line->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$line->id.'"'.($selected ? ' checked="checked"' : '').' />';
|
||||
print '</td>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
|
||||
@ -194,7 +194,7 @@ if (!isModEnabled('accounting')) {
|
||||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (empty($user->rights->accounting->mouvements->lire)) {
|
||||
if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
@ -209,7 +209,7 @@ if (GETPOST('cancel', 'alpha')) {
|
||||
$action = 'list';
|
||||
$massaction = '';
|
||||
}
|
||||
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'preunlettering' && $massaction != 'predeletebookkeepingwriting') {
|
||||
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'preunletteringauto' && $massaction != 'preunletteringmanual' && $massaction != 'predeletebookkeepingwriting') {
|
||||
$massaction = '';
|
||||
}
|
||||
|
||||
@ -401,44 +401,61 @@ if (empty($reshook)) {
|
||||
$uploaddir = $conf->societe->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
|
||||
if (!$error && $action == 'deletebookkeepingwriting' && $confirm == "yes" && $user->rights->accounting->mouvements->supprimer) {
|
||||
if (!$error && $action == 'deletebookkeepingwriting' && $confirm == "yes" && $user->hasRight('accounting', 'mouvements', 'supprimer')) {
|
||||
$db->begin();
|
||||
|
||||
if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING')) {
|
||||
$lettering = new Lettering($db);
|
||||
$nb_lettering = $lettering->bookkeepingLetteringAll($toselect, true);
|
||||
if ($nb_lettering < 0) {
|
||||
setEventMessages('', $lettering->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
$nbok = 0;
|
||||
foreach ($toselect as $toselectid) {
|
||||
$result = $object->fetch($toselectid);
|
||||
if ($result > 0 && (!isset($object->date_validation) || $object->date_validation === '')) {
|
||||
$result = $object->deleteMvtNum($object->piece_num);
|
||||
if ($result > 0) {
|
||||
$nbok++;
|
||||
} else {
|
||||
if (!$error) {
|
||||
foreach ($toselect as $toselectid) {
|
||||
$result = $object->fetch($toselectid);
|
||||
if ($result > 0 && (!isset($object->date_validation) || $object->date_validation === '')) {
|
||||
$result = $object->deleteMvtNum($object->piece_num);
|
||||
if ($result > 0) {
|
||||
$nbok++;
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
} elseif ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
} elseif ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Message for elements well deleted
|
||||
if ($nbok > 1) {
|
||||
setEventMessages($langs->trans("RecordsDeleted", $nbok), null, 'mesgs');
|
||||
} elseif ($nbok > 0) {
|
||||
setEventMessages($langs->trans("RecordDeleted", $nbok), null, 'mesgs');
|
||||
} elseif (!$error) {
|
||||
setEventMessages($langs->trans("NoRecordDeleted"), null, 'mesgs');
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
|
||||
// Message for elements well deleted
|
||||
if ($nbok > 1) {
|
||||
setEventMessages($langs->trans("RecordsDeleted", $nbok), null, 'mesgs');
|
||||
} elseif ($nbok > 0) {
|
||||
setEventMessages($langs->trans("RecordDeleted", $nbok), null, 'mesgs');
|
||||
} elseif (!$error) {
|
||||
setEventMessages($langs->trans("NoRecordDeleted"), null, 'mesgs');
|
||||
}
|
||||
|
||||
header("Location: ".$_SERVER["PHP_SELF"]."?noreset=1".($param ? '&'.$param : ''));
|
||||
exit;
|
||||
} else {
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
|
||||
// others mass actions
|
||||
if (!$error && getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && $user->rights->accounting->mouvements->creer) {
|
||||
if ($massaction == 'lettering') {
|
||||
if (!$error && getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && $user->hasRight('accounting', 'mouvements', 'creer')) {
|
||||
if ($massaction == 'letteringauto') {
|
||||
$lettering = new Lettering($db);
|
||||
$nb_lettering = $lettering->bookkeepingLetteringAll($toselect);
|
||||
if ($nb_lettering < 0) {
|
||||
@ -459,7 +476,17 @@ if (empty($reshook)) {
|
||||
header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
|
||||
exit();
|
||||
}
|
||||
} elseif ($action == 'unlettering' && $confirm == "yes") {
|
||||
} elseif ($massaction == 'letteringmanual') {
|
||||
$lettering = new Lettering($db);
|
||||
$result = $lettering->updateLettering($toselect);
|
||||
if ($result < 0) {
|
||||
setEventMessages('', $lettering->errors, 'errors');
|
||||
} else {
|
||||
setEventMessages($langs->trans('AccountancyOneLetteringModifiedSuccessfully'), array(), 'mesgs');
|
||||
header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
|
||||
exit();
|
||||
}
|
||||
} elseif ($action == 'unletteringauto' && $confirm == "yes") {
|
||||
$lettering = new Lettering($db);
|
||||
$nb_lettering = $lettering->bookkeepingLetteringAll($toselect, true);
|
||||
if ($nb_lettering < 0) {
|
||||
@ -480,6 +507,16 @@ if (empty($reshook)) {
|
||||
header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
|
||||
exit();
|
||||
}
|
||||
} elseif ($action == 'unletteringmanual' && $confirm == "yes") {
|
||||
$lettering = new Lettering($db);
|
||||
$nb_lettering = $lettering->deleteLettering($toselect);
|
||||
if ($result < 0) {
|
||||
setEventMessages('', $lettering->errors, 'errors');
|
||||
} else {
|
||||
setEventMessages($langs->trans('AccountancyOneUnletteringModifiedSuccessfully'), array(), 'mesgs');
|
||||
header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -579,14 +616,16 @@ print $formconfirm;
|
||||
|
||||
// List of mass actions available
|
||||
$arrayofmassactions = array();
|
||||
if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && $user->rights->accounting->mouvements->creer) {
|
||||
$arrayofmassactions['lettering'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('Lettering');
|
||||
$arrayofmassactions['preunlettering'] = img_picto('', 'uncheck', 'class="pictofixedwidth"') . $langs->trans('Unlettering');
|
||||
if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && $user->hasRight('accounting', 'mouvements', 'creer')) {
|
||||
$arrayofmassactions['letteringauto'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('LetteringAuto');
|
||||
$arrayofmassactions['preunletteringauto'] = img_picto('', 'uncheck', 'class="pictofixedwidth"') . $langs->trans('UnletteringAuto');
|
||||
$arrayofmassactions['letteringmanual'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('LetteringManual');
|
||||
$arrayofmassactions['preunletteringmanual'] = img_picto('', 'uncheck', 'class="pictofixedwidth"') . $langs->trans('UnletteringManual');
|
||||
}
|
||||
if ($user->rights->accounting->mouvements->supprimer) {
|
||||
if ($user->hasRight('accounting', 'mouvements', 'supprimer')) {
|
||||
$arrayofmassactions['predeletebookkeepingwriting'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
|
||||
}
|
||||
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('preunlettering', 'predeletebookkeepingwriting'))) {
|
||||
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('preunletteringauto', 'preunletteringmanual', 'predeletebookkeepingwriting'))) {
|
||||
$arrayofmassactions = array();
|
||||
}
|
||||
$massactionbutton = $form->selectMassAction($massaction, $arrayofmassactions);
|
||||
@ -626,8 +665,10 @@ if ($limit > 0 && $limit != $conf->liste_limit) {
|
||||
|
||||
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $result, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1);
|
||||
|
||||
if ($massaction == 'preunlettering') {
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassUnlettering"), $langs->trans("ConfirmMassUnletteringQuestion", count($toselect)), "unlettering", null, '', 0, 200, 500, 1);
|
||||
if ($massaction == 'preunletteringauto') {
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassUnletteringAuto"), $langs->trans("ConfirmMassUnletteringQuestion", count($toselect)), "unletteringauto", null, '', 0, 200, 500, 1);
|
||||
} elseif ($massaction == 'preunletteringmanual') {
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassUnletteringManual"), $langs->trans("ConfirmMassUnletteringQuestion", count($toselect)), "unletteringmanual", null, '', 0, 200, 500, 1);
|
||||
} elseif ($massaction == 'predeletebookkeepingwriting') {
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassDeleteBookkeepingWriting"), $langs->trans("ConfirmMassDeleteBookkeepingWritingQuestion", count($toselect)), "deletebookkeepingwriting", null, '', 0, 200, 500, 1);
|
||||
}
|
||||
@ -645,7 +686,7 @@ if ($massaction == 'preunlettering') {
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||
|
||||
$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, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields
|
||||
if ($massactionbutton && $contextpage != 'poslist') {
|
||||
$selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
|
||||
}
|
||||
@ -699,15 +740,21 @@ print '<table class="tagtable liste centpercent">';
|
||||
|
||||
// Filters lines
|
||||
print '<tr class="liste_titre_filter">';
|
||||
|
||||
// Action column
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td class="liste_titre center">';
|
||||
$searchpicto = $form->showFilterButtons('left');
|
||||
print $searchpicto;
|
||||
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>';
|
||||
print '<td class="liste_titre"><input type="text" name="search_mvt_num" class="width50" value="'.dol_escape_htmltag($search_mvt_num).'"></td>';
|
||||
}
|
||||
// Code journal
|
||||
if (!empty($arrayfields['t.code_journal']['checked'])) {
|
||||
print '<td class="liste_titre center">';
|
||||
print $formaccounting->multi_select_journal($search_ledger_code, 'search_ledger_code', 0, 1, 1, 1);
|
||||
print $formaccounting->multi_select_journal($search_ledger_code, 'search_ledger_code', 0, 1, 1, 1, 'maxwidth75');
|
||||
print '</td>';
|
||||
}
|
||||
// Date document
|
||||
@ -778,13 +825,18 @@ $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // N
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
// Action column
|
||||
print '<td class="liste_titre center">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td class="liste_titre center">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
|
||||
}
|
||||
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);
|
||||
}
|
||||
@ -822,7 +874,9 @@ if (!empty($arrayfields['t.import_key']['checked'])) {
|
||||
$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 ');
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
||||
$displayed_account_number = null; // Start with undefined to be able to distinguish with empty
|
||||
@ -935,7 +989,18 @@ while ($i < min($num, $limit)) {
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Action column
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td class="nowraponall center">';
|
||||
if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
$selected = 0;
|
||||
if (in_array($line->id, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
}
|
||||
print '<input id="cb' . $line->id . '" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $line->id . '"' . ($selected ? ' checked="checked"' : '') . ' />';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
// Piece number
|
||||
if (!empty($arrayfields['t.piece_num']['checked'])) {
|
||||
print '<td>';
|
||||
@ -1108,15 +1173,17 @@ while ($i < min($num, $limit)) {
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
// Action column
|
||||
print '<td class="nowraponall center">';
|
||||
if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
$selected = 0;
|
||||
if (in_array($line->id, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td class="nowraponall center">';
|
||||
if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
$selected = 0;
|
||||
if (in_array($line->id, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
}
|
||||
print '<input id="cb' . $line->id . '" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $line->id . '"' . ($selected ? ' checked="checked"' : '') . ' />';
|
||||
}
|
||||
print '<input id="cb' . $line->id . '" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $line->id . '"' . ($selected ? ' checked="checked"' : '') . ' />';
|
||||
print '</td>';
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@ -718,9 +718,12 @@ class AccountancyExport
|
||||
|
||||
/**
|
||||
* Export format : WinFic - eWinfic - WinSis Compta
|
||||
* Last review for this format : 2022-11-01 Alexandre Spangaro (aspangaro@open-dsi.fr)
|
||||
*
|
||||
* Help : https://wiki.gestan.fr/lib/exe/fetch.php?media=wiki:v15:compta:accountancy-format_winfic-ewinfic-winsiscompta.pdf
|
||||
*
|
||||
* @param array $TData data
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function exportWinfic(&$TData)
|
||||
@ -728,10 +731,14 @@ class AccountancyExport
|
||||
global $conf;
|
||||
|
||||
$end_line = "\r\n";
|
||||
$index = 1;
|
||||
|
||||
//We should use dol_now function not time however this is wrong date to transfert in accounting
|
||||
//$date_ecriture = dol_print_date(dol_now(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy
|
||||
//$date_ecriture = dol_print_date(time(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy
|
||||
|
||||
// Warning ! When truncation is necessary, no dot because 3 dots = three characters. The columns are shifted
|
||||
|
||||
foreach ($TData as $data) {
|
||||
$code_compta = $data->numero_compte;
|
||||
if (!empty($data->subledger_account)) {
|
||||
@ -740,7 +747,7 @@ class AccountancyExport
|
||||
|
||||
$Tab = array();
|
||||
//$Tab['type_ligne'] = 'M';
|
||||
$Tab['code_journal'] = str_pad(self::trunc($data->code_journal, 2), 2);
|
||||
$Tab['code_journal'] = str_pad(dol_trunc($data->code_journal, 2, 'right', 'UTF-8', 1), 2);
|
||||
|
||||
//We use invoice date $data->doc_date not $date_ecriture which is the transfert date
|
||||
//maybe we should set an option for customer who prefer to keep in accounting software the tranfert date instead of invoice date ?
|
||||
@ -749,11 +756,11 @@ class AccountancyExport
|
||||
|
||||
$Tab['folio'] = ' 1';
|
||||
|
||||
$Tab['num_ecriture'] = str_pad(self::trunc($data->piece_num, 6), 6, ' ', STR_PAD_LEFT);
|
||||
$Tab['num_ecriture'] = str_pad(dol_trunc($index, 6, 'right', 'UTF-8', 1), 6, ' ', STR_PAD_LEFT);
|
||||
|
||||
$Tab['jour_ecriture'] = dol_print_date($data->doc_date, '%d%m%y');
|
||||
|
||||
$Tab['num_compte'] = str_pad(self::trunc($code_compta, 6), 6, '0');
|
||||
$Tab['num_compte'] = str_pad(dol_trunc($code_compta, 6, 'right', 'UTF-8', 1), 6, '0');
|
||||
|
||||
if ($data->sens == 'D') {
|
||||
$Tab['montant_debit'] = str_pad(number_format($data->debit, 2, ',', ''), 13, ' ', STR_PAD_LEFT);
|
||||
@ -765,11 +772,11 @@ class AccountancyExport
|
||||
$Tab['montant_crebit'] = str_pad(number_format($data->credit, 2, ',', ''), 13, ' ', STR_PAD_LEFT);
|
||||
}
|
||||
|
||||
$Tab['libelle_ecriture'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref).' '.dol_string_unaccent($data->label_operation), 30), 30);
|
||||
$Tab['libelle_ecriture'] = str_pad(dol_trunc(dol_string_unaccent($data->doc_ref).' '.dol_string_unaccent($data->label_operation), 30, 'right', 'UTF-8', 1), 30);
|
||||
|
||||
$Tab['lettrage'] = str_repeat(' ', 2);
|
||||
$Tab['lettrage'] = str_repeat(dol_trunc($data->lettering_code, 2, 'left', 'UTF-8', 1), 2);
|
||||
|
||||
$Tab['code_piece'] = str_repeat(' ', 5);
|
||||
$Tab['code_piece'] = str_pad(dol_trunc($data->piece_num, 5, 'left', 'UTF-8', 1), 5, ' ', STR_PAD_LEFT);
|
||||
|
||||
$Tab['code_stat'] = str_repeat(' ', 4);
|
||||
|
||||
@ -793,6 +800,8 @@ class AccountancyExport
|
||||
$Tab['end_line'] = $end_line;
|
||||
|
||||
print implode('|', $Tab);
|
||||
|
||||
$index++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -730,7 +730,7 @@ class AccountingAccount extends CommonObject
|
||||
* @param Product $product Product object sell or buy
|
||||
* @param Facture|FactureFournisseur $facture Facture
|
||||
* @param FactureLigne|SupplierInvoiceLine $factureDet Facture Det
|
||||
* @param array $accountingAccount Array of Account account
|
||||
* @param array $accountingAccount Array of Accounting account
|
||||
* @param string $type Customer / Supplier
|
||||
* @return array|int Accounting accounts suggested or < 0 if technical error.
|
||||
*/
|
||||
@ -868,20 +868,44 @@ class AccountingAccount extends CommonObject
|
||||
}
|
||||
|
||||
// Manage Deposit
|
||||
if ($factureDet->desc == "(DEPOSIT)" || $facture->type == $facture::TYPE_DEPOSIT) {
|
||||
$accountdeposittoventilated = new self($this->db);
|
||||
if ($type == 'customer') {
|
||||
$result = $accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT, 1);
|
||||
} elseif ($type == 'supplier') {
|
||||
$result = $accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT, 1);
|
||||
}
|
||||
if (isset($result) && $result < 0) {
|
||||
return -1;
|
||||
if (getDolGlobalString('ACCOUNTING_ACCOUNT_' . strtoupper($type) . '_DEPOSIT')) {
|
||||
if ($factureDet->desc == "(DEPOSIT)" || $facture->type == $facture::TYPE_DEPOSIT) {
|
||||
$accountdeposittoventilated = new self($this->db);
|
||||
if ($type == 'customer') {
|
||||
$result = $accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT, 1);
|
||||
} elseif ($type == 'supplier') {
|
||||
$result = $accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT, 1);
|
||||
}
|
||||
if (isset($result) && $result < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
$code_l = $accountdeposittoventilated->ref;
|
||||
$code_p = '';
|
||||
$code_t = '';
|
||||
$suggestedid = $accountdeposittoventilated->rowid;
|
||||
$suggestedaccountingaccountfor = 'deposit';
|
||||
}
|
||||
|
||||
$code_l = $accountdeposittoventilated->ref;
|
||||
$suggestedid = $accountdeposittoventilated->rowid;
|
||||
$suggestedaccountingaccountfor = 'deposit';
|
||||
// For credit note invoice, if origin invoice is a deposit invoice, force also on specific customer/supplier deposit account
|
||||
if (!empty($facture->fk_facture_source)) {
|
||||
$invoiceSource = new $facture($this->db);
|
||||
$invoiceSource->fetch($facture->fk_facture_source);
|
||||
|
||||
if ($facture->type == $facture::TYPE_CREDIT_NOTE && $invoiceSource->type == $facture::TYPE_DEPOSIT) {
|
||||
$accountdeposittoventilated = new self($this->db);
|
||||
if ($type == 'customer') {
|
||||
$accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT, 1);
|
||||
} elseif ($type == 'supplier') {
|
||||
$accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT, 1);
|
||||
}
|
||||
$code_l = $accountdeposittoventilated->ref;
|
||||
$code_p = '';
|
||||
$code_t = '';
|
||||
$suggestedid = $accountdeposittoventilated->rowid;
|
||||
$suggestedaccountingaccountfor = 'deposit';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If $suggestedid could not be guessed yet, we set it from the generic default accounting code $code_l
|
||||
|
||||
@ -231,7 +231,7 @@ class AccountingJournal extends CommonObject
|
||||
* Return clicable name (with picto eventually)
|
||||
*
|
||||
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
|
||||
* @param int $withlabel 0=No label, 1=Include label of journal
|
||||
* @param int $withlabel 0=No label, 1=Include label of journal, 2=Include nature of journal
|
||||
* @param int $nourl 1=Disable url
|
||||
* @param string $moretitle Add more text to title tooltip
|
||||
* @param int $notooltip 1=Disable tooltip
|
||||
@ -281,9 +281,14 @@ class AccountingJournal extends CommonObject
|
||||
}
|
||||
|
||||
$label_link = $this->code;
|
||||
if ($withlabel && !empty($this->label)) {
|
||||
if ($withlabel != 2 && !empty($this->label)) {
|
||||
$label_link .= ' - '.($nourl ? '<span class="opacitymedium">' : '').$langs->transnoentities($this->label).($nourl ? '</span>' : '');
|
||||
}
|
||||
if ($withlabel == 2 && !empty($this->nature)) {
|
||||
$key = $langs->trans("AccountingJournalType".strtoupper($this->nature));
|
||||
$transferlabel = ($this->nature && $key != "AccountingJournalType".strtoupper($langs->trans($this->nature)) ? $key : $this->label);
|
||||
$label_link .= ' - '.($nourl ? '<span class="opacitymedium">' : '').$transferlabel.($nourl ? '</span>' : '');
|
||||
}
|
||||
|
||||
$result .= $linkstart;
|
||||
if ($withpicto) {
|
||||
@ -441,26 +446,40 @@ class AccountingJournal extends CommonObject
|
||||
$langs->loadLangs(array("assets"));
|
||||
|
||||
// Clean parameters
|
||||
if (empty($type)) $type = 'view';
|
||||
if (empty($in_bookkeeping)) $in_bookkeeping = 'notyet';
|
||||
if (empty($type)) {
|
||||
$type = 'view';
|
||||
}
|
||||
if (empty($in_bookkeeping)) {
|
||||
$in_bookkeeping = 'notyet';
|
||||
}
|
||||
|
||||
$sql = "";
|
||||
if ($in_bookkeeping == 'already' || $in_bookkeeping == 'notyet') {
|
||||
|
||||
// FIXME sql error with Mysql 5.7
|
||||
/*if ($in_bookkeeping == 'already' || $in_bookkeeping == 'notyet') {
|
||||
$sql .= "WITH in_accounting_bookkeeping(fk_docdet) AS (";
|
||||
$sql .= " SELECT DISTINCT fk_docdet";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping";
|
||||
$sql .= " WHERE doc_type = 'asset'";
|
||||
$sql .= ")";
|
||||
}
|
||||
$sql .= ") ";
|
||||
}*/
|
||||
|
||||
$sql .= "SELECT ad.fk_asset AS rowid, a.ref AS asset_ref, a.label AS asset_label, a.acquisition_value_ht AS asset_acquisition_value_ht";
|
||||
$sql .= ", a.disposal_date AS asset_disposal_date, a.disposal_amount_ht AS asset_disposal_amount_ht, a.disposal_subject_to_vat AS asset_disposal_subject_to_vat";
|
||||
$sql .= ", ad.rowid AS depreciation_id, ad.depreciation_mode, ad.ref AS depreciation_ref, ad.depreciation_date, ad.depreciation_ht, ad.accountancy_code_debit, ad.accountancy_code_credit";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "asset_depreciation as ad";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "asset as a ON a.rowid = ad.fk_asset";
|
||||
if ($in_bookkeeping == 'already' || $in_bookkeeping == 'notyet') {
|
||||
// FIXME sql error with Mysql 5.7
|
||||
/*if ($in_bookkeeping == 'already' || $in_bookkeeping == 'notyet') {
|
||||
$sql .= " LEFT JOIN in_accounting_bookkeeping as iab ON iab.fk_docdet = ad.rowid";
|
||||
}
|
||||
}*/
|
||||
$sql .= " WHERE a.entity IN (" . getEntity('asset', 0) . ')'; // We don't share object for accountancy, we use source object sharing
|
||||
// Compatibility with Mysql 5.7
|
||||
if ($in_bookkeeping == 'already') {
|
||||
$sql .= " AND EXISTS (SELECT iab.fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS iab WHERE iab.fk_docdet = ad.rowid AND doc_type = 'asset')";
|
||||
} elseif ($in_bookkeeping == 'notyet') {
|
||||
$sql .= " AND NOT EXISTS (SELECT iab.fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS iab WHERE iab.fk_docdet = ad.rowid AND doc_type = 'asset')";
|
||||
}
|
||||
$sql .= " AND ad.ref != ''"; // not reversal lines
|
||||
if ($date_start && $date_end) {
|
||||
$sql .= " AND ad.depreciation_date >= '" . $this->db->idate($date_start) . "' AND ad.depreciation_date <= '" . $this->db->idate($date_end) . "'";
|
||||
@ -470,9 +489,10 @@ class AccountingJournal extends CommonObject
|
||||
$sql .= " AND ad.depreciation_date >= '" . $this->db->idate($conf->global->ACCOUNTING_DATE_START_BINDING) . "'";
|
||||
}
|
||||
// Already in bookkeeping or not
|
||||
if ($in_bookkeeping == 'already' || $in_bookkeeping == 'notyet') {
|
||||
// FIXME sql error with Mysql 5.7
|
||||
/*if ($in_bookkeeping == 'already' || $in_bookkeeping == 'notyet') {
|
||||
$sql .= " AND iab.fk_docdet IS" . ($in_bookkeeping == 'already' ? " NOT" : "") . " NULL";
|
||||
}
|
||||
}*/
|
||||
$sql .= " ORDER BY ad.depreciation_date";
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
@ -33,11 +33,52 @@ include_once DOL_DOCUMENT_ROOT."/core/lib/date.lib.php";
|
||||
*/
|
||||
class Lettering extends BookKeeping
|
||||
{
|
||||
/**
|
||||
* @var BookKeeping[] Bookkeeping cached
|
||||
*/
|
||||
public static $bookkeeping_cached = array();
|
||||
|
||||
public static $doc_type_infos = array(
|
||||
'customer_invoice' => array(
|
||||
'payment_table' => 'paiement',
|
||||
'payment_table_fk_bank' => 'fk_bank',
|
||||
'doc_payment_table' => 'paiement_facture',
|
||||
'doc_payment_table_fk_payment' => 'fk_paiement',
|
||||
'doc_payment_table_fk_doc' => 'fk_facture',
|
||||
'linked_info' => array(
|
||||
array(
|
||||
'table' => 'paiement_facture',
|
||||
'fk_doc' => 'fk_facture',
|
||||
'fk_link' => 'fk_paiement',
|
||||
'prefix' => 'p',
|
||||
),
|
||||
array(
|
||||
'table' => 'societe_remise_except',
|
||||
'fk_doc' => 'fk_facture_source',
|
||||
'fk_link' => 'fk_facture',
|
||||
'prefix' => 'a',
|
||||
'is_fk_link_is_also_fk_doc' => true,
|
||||
),
|
||||
),
|
||||
),
|
||||
'supplier_invoice' => array(
|
||||
'payment_table' => 'paiementfourn',
|
||||
'payment_table_fk_bank' => 'fk_bank',
|
||||
'doc_payment_table' => 'paiementfourn_facturefourn',
|
||||
'doc_payment_table_fk_payment' => 'fk_paiementfourn',
|
||||
'doc_payment_table_fk_doc' => 'fk_facturefourn',
|
||||
'linked_info' => array(
|
||||
array(
|
||||
'table' => 'paiementfourn_facturefourn',
|
||||
'fk_doc' => 'fk_facturefourn',
|
||||
'fk_link' => 'fk_paiementfourn',
|
||||
'prefix' => 'p',
|
||||
),
|
||||
array(
|
||||
'table' => 'societe_remise_except',
|
||||
'fk_doc' => 'fk_invoice_supplier_source',
|
||||
'fk_link' => 'fk_invoice_supplier',
|
||||
'prefix' => 'a',
|
||||
'is_fk_link_is_also_fk_doc' => true,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* letteringThirdparty
|
||||
@ -250,26 +291,17 @@ class Lettering extends BookKeeping
|
||||
$lettre = 'AAA';
|
||||
|
||||
$sql = "SELECT DISTINCT ab2.lettering_code";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping As ab";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url AS bu ON bu.fk_bank = ab.fk_doc";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url AS bu2 ON bu2.url_id = bu.url_id";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_bookkeeping AS ab2 ON ab2.fk_doc = bu2.fk_bank";
|
||||
$sql .= " WHERE ab.rowid IN (" . $this->db->sanitize(implode(',', $ids)) . ")";
|
||||
$sql .= " AND ab.doc_type = 'bank'";
|
||||
$sql .= " AND ab2.doc_type = 'bank'";
|
||||
$sql .= " AND bu.type = 'company'";
|
||||
$sql .= " AND bu2.type = 'company'";
|
||||
$sql .= " AND ab.subledger_account != ''";
|
||||
$sql .= " AND ab2.subledger_account != ''";
|
||||
$sql .= " AND ab.lettering_code IS NULL";
|
||||
$sql .= " AND ab2.lettering_code != ''";
|
||||
$sql .= " ORDER BY ab2.lettering_code DESC";
|
||||
$sql .= " LIMIT 1 ";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS ab";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_bookkeeping AS ab2 ON ab2.subledger_account = ab.subledger_account";
|
||||
$sql .= " WHERE ab.rowid IN (" . $this->db->sanitize(implode(',', $ids)) . ")";
|
||||
$sql .= " AND ab2.lettering_code != ''";
|
||||
$sql .= " ORDER BY ab2.lettering_code DESC";
|
||||
$sql .= " LIMIT 1 ";
|
||||
|
||||
$resqla = $this->db->query($sql);
|
||||
if ($resqla) {
|
||||
$obj = $this->db->fetch_object($resqla);
|
||||
$lettre = (empty($obj->lettering_code) ? 'AAA' : $obj->lettering_code);
|
||||
$lettre = (empty($obj->lettering_code) ? $lettre : $obj->lettering_code);
|
||||
if (!empty($obj->lettering_code)) {
|
||||
$lettre++;
|
||||
}
|
||||
@ -301,7 +333,7 @@ class Lettering extends BookKeeping
|
||||
if (!$error) {
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping SET";
|
||||
$sql .= " lettering_code='".$this->db->escape($lettre)."'";
|
||||
$sql .= " , date_lettering = '".$this->db->idate($now)."'"; // todo correct date it's false
|
||||
$sql .= ", date_lettering = '".$this->db->idate($now)."'"; // todo correct date it's false
|
||||
$sql .= " WHERE rowid IN (".$this->db->sanitize(implode(',', $ids)).") AND lettering_code IS NULL AND subledger_account != ''";
|
||||
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
@ -336,7 +368,7 @@ class Lettering extends BookKeeping
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping SET";
|
||||
$sql .= " lettering_code = NULL";
|
||||
$sql .= " , date_lettering = NULL";
|
||||
$sql .= ", date_lettering = NULL";
|
||||
$sql .= " WHERE rowid IN (".$this->db->sanitize(implode(',', $ids)).")";
|
||||
$sql .= " AND subledger_account != ''";
|
||||
|
||||
@ -374,16 +406,7 @@ class Lettering extends BookKeeping
|
||||
$errors = array();
|
||||
$nb_lettering = 0;
|
||||
|
||||
$result = $this->bookkeepingLettering($bookkeeping_ids, 'customer_invoice', $unlettering);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
$errors = array_merge($errors, $this->errors);
|
||||
$nb_lettering += abs($result) - 2;
|
||||
} else {
|
||||
$nb_lettering += $result;
|
||||
}
|
||||
|
||||
$result = $this->bookkeepingLettering($bookkeeping_ids, 'supplier_invoice', $unlettering);
|
||||
$result = $this->bookkeepingLettering($bookkeeping_ids, $unlettering);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
$errors = array_merge($errors, $this->errors);
|
||||
@ -404,11 +427,10 @@ class Lettering extends BookKeeping
|
||||
* Lettering bookkeeping lines
|
||||
*
|
||||
* @param array $bookkeeping_ids Lettering specific list of bookkeeping id
|
||||
* @param string $type Type of bookkeeping type to lettering ('customer_invoice' or 'supplier_invoice')
|
||||
* @param bool $unlettering Do unlettering
|
||||
* @return int <0 if error (nb lettered = result -1), 0 if noting to lettering, >0 if OK (nb lettered)
|
||||
*/
|
||||
public function bookkeepingLettering($bookkeeping_ids, $type = 'customer_invoice', $unlettering = false)
|
||||
public function bookkeepingLettering($bookkeeping_ids, $unlettering = false)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
@ -416,11 +438,14 @@ class Lettering extends BookKeeping
|
||||
|
||||
// Clean parameters
|
||||
$bookkeeping_ids = is_array($bookkeeping_ids) ? $bookkeeping_ids : array();
|
||||
$type = trim($type);
|
||||
|
||||
$error = 0;
|
||||
$nb_lettering = 0;
|
||||
$grouped_lines = $this->getLinkedLines($bookkeeping_ids, $type);
|
||||
$grouped_lines = $this->getLinkedLines($bookkeeping_ids);
|
||||
if (!is_array($grouped_lines)) {
|
||||
return -2;
|
||||
}
|
||||
|
||||
foreach ($grouped_lines as $lines) {
|
||||
$group_error = 0;
|
||||
$total = 0;
|
||||
@ -478,52 +503,214 @@ class Lettering extends BookKeeping
|
||||
/**
|
||||
* Lettering bookkeeping lines
|
||||
*
|
||||
* @param array $bookkeeping_ids Lettering specific list of bookkeeping id
|
||||
* @param string $type Type of bookkeeping type to lettering ('customer_invoice' or 'supplier_invoice')
|
||||
* @return array|int <0 if error otherwise all linked lines by block
|
||||
* @param array $bookkeeping_ids Lettering specific list of bookkeeping id
|
||||
* @param bool $only_has_subledger_account Get only lines who have subledger account
|
||||
* @return array|int <0 if error otherwise all linked lines by block
|
||||
*/
|
||||
public function getLinkedLines($bookkeeping_ids, $type = 'customer_invoice')
|
||||
public function getLinkedLines($bookkeeping_ids, $only_has_subledger_account = true)
|
||||
{
|
||||
global $conf, $langs;
|
||||
$this->errors = array();
|
||||
|
||||
// Clean parameters
|
||||
$bookkeeping_ids = is_array($bookkeeping_ids) ? $bookkeeping_ids : array();
|
||||
$type = trim($type);
|
||||
|
||||
if ($type == 'customer_invoice') {
|
||||
$doc_type = 'customer_invoice';
|
||||
$bank_url_type = 'payment';
|
||||
$payment_element = 'paiement_facture';
|
||||
$fk_payment_element = 'fk_paiement';
|
||||
$fk_element = 'fk_facture';
|
||||
$account_number = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
|
||||
} elseif ($type == 'supplier_invoice') {
|
||||
$doc_type = 'supplier_invoice';
|
||||
$bank_url_type = 'payment_supplier';
|
||||
$payment_element = 'paiementfourn_facturefourn';
|
||||
$fk_payment_element = 'fk_paiementfourn';
|
||||
$fk_element = 'fk_facturefourn';
|
||||
$account_number = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
|
||||
} else {
|
||||
// Get all bookkeeping lines
|
||||
$sql = "SELECT DISTINCT ab.doc_type, ab.fk_doc";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS ab";
|
||||
$sql .= " WHERE ab.entity IN (" . getEntity('accountancy') . ")";
|
||||
$sql .= " AND ab.fk_doc > 0";
|
||||
if (!empty($bookkeeping_ids)) {
|
||||
// Get all bookkeeping lines of piece number
|
||||
$sql .= " AND EXISTS (";
|
||||
$sql .= " SELECT rowid";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS pn";
|
||||
$sql .= " WHERE pn.entity IN (" . getEntity('accountancy') . ")";
|
||||
$sql .= " AND pn.rowid IN (" . $this->db->sanitize(implode(',', $bookkeeping_ids)) . ")";
|
||||
$sql .= " AND pn.piece_num = ab.piece_num";
|
||||
$sql .= " )";
|
||||
}
|
||||
if ($only_has_subledger_account) $sql .= " AND ab.subledger_account != ''";
|
||||
|
||||
dol_syslog(__METHOD__ . " - Get all bookkeeping lines", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$this->errors[] = "Error " . $this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
|
||||
$bookkeeping_lines_by_type = array();
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$bookkeeping_lines_by_type[$obj->doc_type][$obj->fk_doc] = $obj->fk_doc;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
if (empty($bookkeeping_lines_by_type)) {
|
||||
return array();
|
||||
}
|
||||
|
||||
if (!empty($bookkeeping_lines_by_type['bank'])) {
|
||||
$new_bookkeeping_lines_by_type = $this->getDocTypeAndFkDocFromBankLines($bookkeeping_lines_by_type['bank']);
|
||||
if (!is_array($new_bookkeeping_lines_by_type)) {
|
||||
return -1;
|
||||
}
|
||||
foreach ($new_bookkeeping_lines_by_type as $doc_type => $fk_docs) {
|
||||
foreach ($fk_docs as $fk_doc) {
|
||||
$bookkeeping_lines_by_type[$doc_type][$fk_doc] = $fk_doc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$grouped_lines = array();
|
||||
foreach (self::$doc_type_infos as $doc_type => $doc_type_info) {
|
||||
if (!is_array($bookkeeping_lines_by_type[$doc_type])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get all document ids grouped
|
||||
$doc_grouped = $this->getLinkedDocumentByGroup($bookkeeping_lines_by_type[$doc_type], $doc_type);
|
||||
if (!is_array($doc_grouped)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Group all lines by document/piece number
|
||||
foreach ($doc_grouped as $doc_ids) {
|
||||
$bank_ids = $this->getBankLinesFromFkDocAndDocType($doc_ids, $doc_type);
|
||||
if (!is_array($bank_ids)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Get all bookkeeping lines linked
|
||||
$sql = "SELECT DISTINCT ab.rowid, ab.piece_num, ab.debit, ab.credit, ab.lettering_code";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS ab";
|
||||
$sql .= " WHERE ab.entity IN (" . getEntity('accountancy') . ")";
|
||||
$sql .= " AND (";
|
||||
if (!empty($bank_ids)) {
|
||||
$sql .= " EXISTS (";
|
||||
$sql .= " SELECT bpn.rowid";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS bpn";
|
||||
$sql .= " WHERE bpn.entity IN (" . getEntity('accountancy') . ")";
|
||||
$sql .= " AND bpn.doc_type = 'bank'";
|
||||
$sql .= " AND bpn.fk_doc IN (" . $this->db->sanitize(implode(',', $bank_ids)) . ")";
|
||||
$sql .= " AND bpn.piece_num = ab.piece_num";
|
||||
$sql .= " ) OR ";
|
||||
}
|
||||
$sql .= " EXISTS (";
|
||||
$sql .= " SELECT dpn.rowid";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS dpn";
|
||||
$sql .= " WHERE dpn.entity IN (" . getEntity('accountancy') . ")";
|
||||
$sql .= " AND dpn.doc_type = '" . $this->db->escape($doc_type) . "'";
|
||||
$sql .= " AND dpn.fk_doc IN (" . $this->db->sanitize(implode(',', $doc_ids)) . ")";
|
||||
$sql .= " AND dpn.piece_num = ab.piece_num";
|
||||
$sql .= " )";
|
||||
$sql .= ")";
|
||||
if ($only_has_subledger_account) $sql .= " AND ab.subledger_account != ''";
|
||||
|
||||
dol_syslog(__METHOD__ . " - Get all bookkeeping lines linked", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$this->errors[] = "Error " . $this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
|
||||
$group = array();
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$group[$obj->rowid] = array(
|
||||
'id' => $obj->rowid,
|
||||
'piece_num' => $obj->piece_num,
|
||||
'debit' => $obj->debit,
|
||||
'credit' => $obj->credit,
|
||||
'lettering_code' => $obj->lettering_code,
|
||||
);
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
if (!empty($group)) $grouped_lines[] = $group;
|
||||
}
|
||||
}
|
||||
|
||||
return $grouped_lines;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all fk_doc by doc_type from list of bank ids
|
||||
*
|
||||
* @param array $bank_ids List of bank ids
|
||||
* @return array|int <0 if error otherwise all fk_doc by doc_type
|
||||
*/
|
||||
public function getDocTypeAndFkDocFromBankLines($bank_ids)
|
||||
{
|
||||
dol_syslog(__METHOD__ . " - bank_ids=".json_encode($bank_ids), LOG_DEBUG);
|
||||
|
||||
// Clean parameters
|
||||
$bank_ids = is_array($bank_ids) ? $bank_ids : array();
|
||||
|
||||
if (empty($bank_ids)) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$bookkeeping_lines_by_type = array();
|
||||
foreach (self::$doc_type_infos as $doc_type => $doc_type_info) {
|
||||
// Get all fk_doc by doc_type from bank ids
|
||||
$sql = "SELECT DISTINCT dp." . $doc_type_info['doc_payment_table_fk_doc'] . " AS fk_doc";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . $doc_type_info['payment_table'] . " AS p";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . $doc_type_info['doc_payment_table'] . " AS dp ON dp." . $doc_type_info['doc_payment_table_fk_payment'] . " = p.rowid";
|
||||
$sql .= " WHERE p." . $doc_type_info['payment_table_fk_bank'] . " IN (" . $this->db->sanitize(implode(',', $bank_ids)) . ")";
|
||||
$sql .= " AND dp." . $doc_type_info['doc_payment_table_fk_doc'] . " > 0";
|
||||
|
||||
dol_syslog(__METHOD__ . " - Get all fk_doc by doc_type from list of bank ids for '" . $doc_type . "'", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$this->errors[] = "Error " . $this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$bookkeeping_lines_by_type[$doc_type][$obj->fk_doc] = $obj->fk_doc;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
}
|
||||
|
||||
return $bookkeeping_lines_by_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all bank ids from list of document ids of a type
|
||||
*
|
||||
* @param array $document_ids List of document id
|
||||
* @param string $doc_type Type of document ('customer_invoice' or 'supplier_invoice', ...)
|
||||
* @return array|int <0 if error otherwise all all bank ids from list of document ids of a type
|
||||
*/
|
||||
public function getBankLinesFromFkDocAndDocType($document_ids, $doc_type)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
dol_syslog(__METHOD__ . " - bank_ids=".json_encode($document_ids) . ", doc_type=$doc_type", LOG_DEBUG);
|
||||
|
||||
// Clean parameters
|
||||
$document_ids = is_array($document_ids) ? $document_ids : array();
|
||||
$doc_type = trim($doc_type);
|
||||
|
||||
if (empty($document_ids)) {
|
||||
return array();
|
||||
}
|
||||
if (!is_array(self::$doc_type_infos[$doc_type])) {
|
||||
$langs->load('errors');
|
||||
$this->errors[] = $langs->trans('ErrorBadParameters');
|
||||
return -1;
|
||||
}
|
||||
|
||||
$payment_ids = array();
|
||||
$doc_type_info = self::$doc_type_infos[$doc_type];
|
||||
$bank_ids = array();
|
||||
|
||||
// Get all payment id from bank lines
|
||||
$sql = "SELECT DISTINCT bu.url_id AS payment_id";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS ab";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url AS bu ON bu.fk_bank = ab.fk_doc";
|
||||
$sql .= " WHERE ab.doc_type = 'bank'";
|
||||
// $sql .= " AND ab.subledger_account != ''";
|
||||
// $sql .= " AND ab.numero_compte = '" . $this->db->escape($account_number) . "'";
|
||||
$sql .= " AND bu.type = '" . $this->db->escape($bank_url_type) . "'";
|
||||
if (!empty($bookkeeping_ids)) $sql .= " AND ab.rowid IN (" . $this->db->sanitize(implode(',', $bookkeeping_ids)) . ")";
|
||||
// Get all fk_doc by doc_type from bank ids
|
||||
$sql = "SELECT DISTINCT p." . $doc_type_info['payment_table_fk_bank'] . " AS fk_doc";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . $doc_type_info['payment_table'] . " AS p";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . $doc_type_info['doc_payment_table'] . " AS dp ON dp." . $doc_type_info['doc_payment_table_fk_payment'] . " = p.rowid";
|
||||
$sql .= " WHERE dp." . $doc_type_info['doc_payment_table_fk_doc'] . " IN (" . $this->db->sanitize(implode(',', $document_ids)) . ")";
|
||||
$sql .= " AND p." . $doc_type_info['payment_table_fk_bank'] . " > 0";
|
||||
|
||||
dol_syslog(__METHOD__ . " - Get all payment id from bank lines", LOG_DEBUG);
|
||||
dol_syslog(__METHOD__ . " - Get all bank ids from list of document ids of a type '" . $doc_type . "'", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$this->errors[] = "Error " . $this->db->lasterror();
|
||||
@ -531,218 +718,137 @@ class Lettering extends BookKeeping
|
||||
}
|
||||
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$payment_ids[$obj->payment_id] = $obj->payment_id;
|
||||
$bank_ids[$obj->fk_doc] = $obj->fk_doc;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
// Get all payment id from payment lines
|
||||
$sql = "SELECT DISTINCT pe.$fk_payment_element AS payment_id";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS ab";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "$payment_element AS pe ON pe.$fk_element = ab.fk_doc";
|
||||
$sql .= " WHERE ab.doc_type = '" . $this->db->escape($doc_type) . "'";
|
||||
// $sql .= " AND ab.subledger_account != ''";
|
||||
// $sql .= " AND ab.numero_compte = '" . $this->db->escape($account_number) . "'";
|
||||
$sql .= " AND pe.$fk_payment_element IS NOT NULL";
|
||||
if (!empty($bookkeeping_ids)) $sql .= " AND ab.rowid IN (" . $this->db->sanitize(implode(',', $bookkeeping_ids)) . ")";
|
||||
|
||||
dol_syslog(__METHOD__ . " - Get all payment id from bank lines", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$this->errors[] = "Error " . $this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$payment_ids[$obj->payment_id] = $obj->payment_id;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
if (empty($payment_ids)) {
|
||||
return array();
|
||||
}
|
||||
|
||||
// Get all payments linked by group
|
||||
$payment_by_group = $this->getLinkedPaymentByGroup($payment_ids, $type);
|
||||
|
||||
$groups = array();
|
||||
foreach ($payment_by_group as $payment_list) {
|
||||
$lines = array();
|
||||
|
||||
// Get bank lines
|
||||
$sql = "SELECT DISTINCT ab.rowid, ab.piece_num, ab.lettering_code, ab.debit, ab.credit";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "bank_url AS bu";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_bookkeeping AS ab ON ab.fk_doc = bu.fk_bank";
|
||||
$sql .= " WHERE bu.url_id IN (" . $this->db->sanitize(implode(',', $payment_list)) . ")";
|
||||
$sql .= " AND bu.type = '" . $this->db->escape($bank_url_type) . "'";
|
||||
$sql .= " AND ab.doc_type = 'bank'";
|
||||
$sql .= " AND ab.subledger_account != ''";
|
||||
$sql .= " AND ab.numero_compte = '" . $this->db->escape($account_number) . "'";
|
||||
|
||||
dol_syslog(__METHOD__ . " - Get bank lines", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$this->errors[] = "Error " . $this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$lines[$obj->rowid] = array('id' => $obj->rowid, 'piece_num' => $obj->piece_num, 'lettering_code' => $obj->lettering_code, 'debit' => $obj->debit, 'credit' => $obj->credit);
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
// Get payment lines
|
||||
$sql = "SELECT DISTINCT ab.rowid, ab.piece_num, ab.lettering_code, ab.debit, ab.credit";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "$payment_element AS pe";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_bookkeeping AS ab ON ab.fk_doc = pe.$fk_element";
|
||||
$sql .= " WHERE pe.$fk_payment_element IN (" . $this->db->sanitize(implode(',', $payment_list)) . ")";
|
||||
$sql .= " AND ab.doc_type = '" . $this->db->escape($doc_type) . "'";
|
||||
$sql .= " AND ab.subledger_account != ''";
|
||||
$sql .= " AND ab.numero_compte = '" . $this->db->escape($account_number) . "'";
|
||||
|
||||
dol_syslog(__METHOD__ . " - Get payment lines", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$this->errors[] = "Error " . $this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$lines[$obj->rowid] = array('id' => $obj->rowid, 'piece_num' => $obj->piece_num, 'lettering_code' => $obj->lettering_code, 'debit' => $obj->debit, 'credit' => $obj->credit);
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
if (!empty($lines)) {
|
||||
$groups[] = $lines;
|
||||
}
|
||||
}
|
||||
|
||||
return $groups;
|
||||
return $bank_ids;
|
||||
}
|
||||
|
||||
/**
|
||||
* Linked payment by group
|
||||
* Get all linked document ids by group and type
|
||||
*
|
||||
* @param array $payment_ids list of payment id
|
||||
* @param string $type Type of bookkeeping type to lettering ('customer_invoice' or 'supplier_invoice')
|
||||
* @return array|int <0 if error otherwise all linked lines by block
|
||||
* @param array $document_ids List of document id
|
||||
* @param string $doc_type Type of document ('customer_invoice' or 'supplier_invoice', ...)
|
||||
* @return array|int <0 if error otherwise all linked document ids by group and type [ [ 'doc_type' => [ doc_id, ... ], ... ], ... ]
|
||||
*/
|
||||
public function getLinkedPaymentByGroup($payment_ids, $type)
|
||||
public function getLinkedDocumentByGroup($document_ids, $doc_type)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
// Clean parameters
|
||||
$payment_ids = is_array($payment_ids) ? $payment_ids : array();
|
||||
$type = trim($type);
|
||||
$document_ids = is_array($document_ids) ? $document_ids : array();
|
||||
$doc_type = trim($doc_type);
|
||||
|
||||
if (empty($payment_ids)) {
|
||||
if (empty($document_ids)) {
|
||||
return array();
|
||||
}
|
||||
|
||||
if ($type == 'customer_invoice') {
|
||||
$payment_element = 'paiement_facture';
|
||||
$fk_payment_element = 'fk_paiement';
|
||||
$fk_element = 'fk_facture';
|
||||
} elseif ($type == 'supplier_invoice') {
|
||||
$payment_element = 'paiementfourn_facturefourn';
|
||||
$fk_payment_element = 'fk_paiementfourn';
|
||||
$fk_element = 'fk_facturefourn';
|
||||
} else {
|
||||
if (!is_array(self::$doc_type_infos[$doc_type])) {
|
||||
$langs->load('errors');
|
||||
$this->errors[] = $langs->trans('ErrorBadParameters');
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Get payment lines
|
||||
$sql = "SELECT DISTINCT pe2.$fk_payment_element, pe2.$fk_element";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "$payment_element AS pe";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "$payment_element AS pe2 ON pe2.$fk_element = pe.$fk_element";
|
||||
$sql .= " WHERE pe.$fk_payment_element IN (" . $this->db->sanitize(implode(',', $payment_ids)) . ")";
|
||||
$doc_type_info = self::$doc_type_infos[$doc_type];
|
||||
|
||||
dol_syslog(__METHOD__ . " - Get payment lines", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$this->errors[] = "Error " . $this->db->lasterror();
|
||||
return -1;
|
||||
// Get document lines
|
||||
$current_document_ids = array();
|
||||
$link_by_element = array();
|
||||
$element_by_link = array();
|
||||
foreach ($doc_type_info['linked_info'] as $linked_info) {
|
||||
$sql = "SELECT DISTINCT tl2." . $linked_info['fk_link'] . " AS fk_link, tl2." . $linked_info['fk_doc'] . " AS fk_doc";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . $linked_info['table'] . " AS tl";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . $linked_info['table'] . " AS tl2 ON tl2." . $linked_info['fk_link'] . " = tl." . $linked_info['fk_link'];
|
||||
$sql .= " WHERE tl." . $linked_info['fk_doc'] . " IN (" . $this->db->sanitize(implode(',', $document_ids)) . ")";
|
||||
|
||||
dol_syslog(__METHOD__ . " - Get document lines", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$this->errors[] = "Error " . $this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
|
||||
$is_fk_link_is_also_fk_doc = !empty($linked_info['is_fk_link_is_also_fk_doc']);
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$current_document_ids[$obj->fk_doc] = $obj->fk_doc;
|
||||
|
||||
$link_key = $linked_info['prefix'] . $obj->fk_link;
|
||||
$element_by_link[$link_key][$obj->fk_doc] = $obj->fk_doc;
|
||||
$link_by_element[$obj->fk_doc][$link_key] = $link_key;
|
||||
if ($is_fk_link_is_also_fk_doc) {
|
||||
$element_by_link[$link_key][$obj->fk_link] = $obj->fk_link;
|
||||
$link_by_element[$obj->fk_link][$link_key] = $link_key;
|
||||
}
|
||||
}
|
||||
$this->db->free($resql);
|
||||
}
|
||||
|
||||
$current_payment_ids = array();
|
||||
$payment_by_element = array();
|
||||
$element_by_payment = array();
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$current_payment_ids[$obj->$fk_payment_element] = $obj->$fk_payment_element;
|
||||
$element_by_payment[$obj->$fk_payment_element][$obj->$fk_element] = $obj->$fk_element;
|
||||
$payment_by_element[$obj->$fk_element][$obj->$fk_payment_element] = $obj->$fk_payment_element;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
if (count(array_diff($payment_ids, $current_payment_ids))) {
|
||||
return $this->getLinkedPaymentByGroup($current_payment_ids, $type);
|
||||
if (count(array_diff($document_ids, $current_document_ids))) {
|
||||
return $this->getLinkedDocumentByGroup($current_document_ids, $doc_type);
|
||||
}
|
||||
|
||||
return $this->getGroupElements($payment_by_element, $element_by_payment);
|
||||
return $this->getGroupElements($link_by_element, $element_by_link);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get payment ids grouped by payment id and element id in common
|
||||
* Get element ids grouped by link or element in common
|
||||
*
|
||||
* @param array $payment_by_element List of payment ids by element id
|
||||
* @param array $element_by_payment List of element ids by payment id
|
||||
* @param int $element_id Element Id (used for recursive function)
|
||||
* @param array $current_group Current group (used for recursive function)
|
||||
* @return array List of payment ids grouped by payment id and element id in common
|
||||
* @param array $link_by_element List of payment ids by link key
|
||||
* @param array $element_by_link List of element ids by link key
|
||||
* @param string $link_key Link key (used for recursive function)
|
||||
* @param array $current_group Current group (used for recursive function)
|
||||
* @return array List of element ids grouped by link or element in common
|
||||
*/
|
||||
public function getGroupElements(&$payment_by_element, &$element_by_payment, $element_id = 0, &$current_group = array())
|
||||
public function getGroupElements(&$link_by_element, &$element_by_link, $link_key = '', &$current_group = array())
|
||||
{
|
||||
$grouped_payments = array();
|
||||
if ($element_id > 0 && !isset($payment_by_element[$element_id])) {
|
||||
// Return if specific element id not found
|
||||
return $grouped_payments;
|
||||
$grouped_elements = array();
|
||||
if (!empty($link_key) && !isset($element_by_link[$link_key])) {
|
||||
// Return if specific link key not found
|
||||
return $grouped_elements;
|
||||
}
|
||||
|
||||
$save_payment_by_element = null;
|
||||
$save_element_by_payment = null;
|
||||
if ($element_id == 0) {
|
||||
if (empty($link_key)) {
|
||||
// Save list when is the begin of recursive function
|
||||
$save_payment_by_element = $payment_by_element;
|
||||
$save_element_by_payment = $element_by_payment;
|
||||
$save_link_by_element = $link_by_element;
|
||||
$save_element_by_link = $element_by_link;
|
||||
}
|
||||
|
||||
do {
|
||||
// Get current element id, get this payment id list and delete the entry
|
||||
$current_element_id = $element_id > 0 ? $element_id : array_keys($payment_by_element)[0];
|
||||
$payment_ids = $payment_by_element[$current_element_id];
|
||||
unset($payment_by_element[$current_element_id]);
|
||||
$current_link_key = !empty($link_key) ? $link_key : array_keys($element_by_link)[0];
|
||||
$element_ids = $element_by_link[$current_link_key];
|
||||
unset($element_by_link[$current_link_key]);
|
||||
|
||||
foreach ($payment_ids as $payment_id) {
|
||||
// Continue if payment id in not found
|
||||
if (!isset($element_by_payment[$payment_id])) continue;
|
||||
foreach ($element_ids as $element_id) {
|
||||
// Continue if element id in not found
|
||||
if (!isset($link_by_element[$element_id])) continue;
|
||||
|
||||
// Set the payment in the current group
|
||||
$current_group[$payment_id] = $payment_id;
|
||||
// Set the element in the current group
|
||||
$current_group[$element_id] = $element_id;
|
||||
|
||||
// Get current element ids, get this payment id list and delete the entry
|
||||
$element_ids = $element_by_payment[$payment_id];
|
||||
unset($element_by_payment[$payment_id]);
|
||||
// Get current link keys, get this element id list and delete the entry
|
||||
$link_keys = $link_by_element[$element_id];
|
||||
unset($link_by_element[$element_id]);
|
||||
|
||||
// Set payment id on the current group for each element id of the payment
|
||||
foreach ($element_ids as $id) {
|
||||
$this->getGroupElements($payment_by_element, $element_by_payment, $id, $current_group);
|
||||
// Set element id on the current group for each link key of the element
|
||||
foreach ($link_keys as $key) {
|
||||
$this->getGroupElements($link_by_element, $element_by_link, $key, $current_group);
|
||||
}
|
||||
}
|
||||
|
||||
if ($element_id == 0) {
|
||||
if (empty($link_key)) {
|
||||
// Save current group and reset the current group when is the begin of recursive function
|
||||
$grouped_payments[] = $current_group;
|
||||
$grouped_elements[] = $current_group;
|
||||
$current_group = array();
|
||||
}
|
||||
} while (!empty($payment_by_element) && $element_id == 0);
|
||||
} while (!empty($element_by_link) && empty($link_key));
|
||||
|
||||
if ($element_id == 0) {
|
||||
if (empty($link_key)) {
|
||||
// Restore list when is the begin of recursive function
|
||||
$payment_by_element = $save_payment_by_element;
|
||||
$element_by_payment = $save_element_by_payment;
|
||||
$link_by_element = $save_link_by_element;
|
||||
$element_by_link = $save_element_by_link;
|
||||
}
|
||||
|
||||
return $grouped_payments;
|
||||
return $grouped_elements;
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ if (!isModEnabled('accounting')) {
|
||||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (empty($user->rights->accounting->fiscalyear->write)) {
|
||||
if (!$user->hasRight('accounting', 'fiscalyear', 'write')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ if (!isModEnabled('accounting')) {
|
||||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (empty($user->rights->accounting->mouvements->lire)) {
|
||||
if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ if (empty($user->rights->accounting->mouvements->lire)) {
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'ventil' && $user->rights->accounting->bind->write) {
|
||||
if ($action == 'ventil' && $user->hasRight('accounting', 'bind', 'write')) {
|
||||
if (!$cancel) {
|
||||
if ($codeventil < 0) {
|
||||
$codeventil = 0;
|
||||
|
||||
@ -47,7 +47,7 @@ if (!isModEnabled('accounting')) {
|
||||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (empty($user->rights->accounting->bind->write)) {
|
||||
if (!$user->hasRight('accounting', 'bind', 'write')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
@ -84,7 +84,7 @@ if (!isModEnabled('accounting')) {
|
||||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (empty($user->rights->accounting->mouvements->lire)) {
|
||||
if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
@ -93,7 +93,7 @@ if (empty($user->rights->accounting->mouvements->lire)) {
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (($action == 'clean' || $action == 'validatehistory') && $user->rights->accounting->bind->write) {
|
||||
if (($action == 'clean' || $action == 'validatehistory') && $user->hasRight('accounting', 'bind', 'write')) {
|
||||
// Clean database by removing binding done on non existing or no more existing accounts
|
||||
$db->begin();
|
||||
$sql1 = "UPDATE ".MAIN_DB_PREFIX."facturedet as fd";
|
||||
@ -142,7 +142,7 @@ if ($action == 'validatehistory') {
|
||||
}*/
|
||||
|
||||
// Customer Invoice lines (must be same request than into page list.php for manual binding)
|
||||
$sql = "SELECT f.rowid as facid, f.ref as ref, f.datef, f.type as ftype,";
|
||||
$sql = "SELECT f.rowid as facid, f.ref as ref, f.datef, f.type as ftype, f.fk_facture_source,";
|
||||
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tva_tx as tva_tx_prod,";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
@ -237,7 +237,8 @@ if ($action == 'validatehistory') {
|
||||
$facture_static->ref = $objp->ref;
|
||||
$facture_static->id = $objp->facid;
|
||||
$facture_static->type = $objp->ftype;
|
||||
$facture_static->date = $objp->datef;
|
||||
$facture_static->date = $db->jdate($objp->datef);
|
||||
$facture_static->fk_facture_source = $objp->fk_facture_source;
|
||||
|
||||
$facture_static_det->id = $objp->rowid;
|
||||
$facture_static_det->total_ht = $objp->total_ht;
|
||||
|
||||
@ -91,7 +91,7 @@ if (!isModEnabled('accounting')) {
|
||||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (empty($user->rights->accounting->mouvements->lire)) {
|
||||
if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
@ -126,7 +126,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
||||
$search_tvaintra = '';
|
||||
}
|
||||
|
||||
if (is_array($changeaccount) && count($changeaccount) > 0 && $user->rights->accounting->bind->write) {
|
||||
if (is_array($changeaccount) && count($changeaccount) > 0 && $user->hasRight('accounting', 'bind', 'write')) {
|
||||
$error = 0;
|
||||
|
||||
if (!(GETPOST('account_parent', 'int') >= 0)) {
|
||||
|
||||
@ -110,7 +110,7 @@ if (!isModEnabled('accounting')) {
|
||||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (empty($user->rights->accounting->mouvements->lire)) {
|
||||
if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
@ -229,7 +229,7 @@ if (empty($chartaccountcode)) {
|
||||
}
|
||||
|
||||
// Customer Invoice lines
|
||||
$sql = "SELECT f.rowid as facid, f.ref, f.datef, f.type as ftype,";
|
||||
$sql = "SELECT f.rowid as facid, f.ref, f.datef, f.type as ftype, f.fk_facture_source,";
|
||||
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tva_tx as tva_tx_prod,";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
@ -579,6 +579,7 @@ if ($result) {
|
||||
$facture_static->id = $objp->facid;
|
||||
$facture_static->type = $objp->ftype;
|
||||
$facture_static->date = $db->jdate($objp->datef);
|
||||
$facture_static->fk_facture_source = $objp->fk_facture_source;
|
||||
|
||||
$facture_static_det->id = $objp->rowid;
|
||||
$facture_static_det->total_ht = $objp->total_ht;
|
||||
@ -725,7 +726,7 @@ if ($result) {
|
||||
|
||||
// Suggested accounting account
|
||||
print '<td>';
|
||||
print $formaccounting->select_account(($default_account > 0 && $confirm === 'yes' && in_array($objp->rowid."_".$i, $toselect)) ? $default_account : $suggestedid, 'codeventil'.$facture_static_det->id, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone');
|
||||
print $formaccounting->select_account(($default_account > 0 && $confirm === 'yes' && in_array($objp->rowid."_".$i, $toselect)) ? $default_account : $suggestedid, 'codeventil'.$facture_static_det->id, 1, array(), 0, 0, 'codeventil maxwidth150 maxwidthonsmartphone', 'cachewithshowemptyone');
|
||||
print '</td>';
|
||||
|
||||
// Column with checkbox
|
||||
|
||||
@ -417,7 +417,7 @@ if ($result) {
|
||||
print '<td class="center">'.vatrate($objp->tva_tx.($objp->vat_src_code ? ' ('.$objp->vat_src_code.')' : '')).'</td>';
|
||||
|
||||
// Accounting account affected
|
||||
print '<td class="center">';
|
||||
print '<td>';
|
||||
print $accountingaccountstatic->getNomUrl(0, 1, 1, '', 1);
|
||||
print ' <a class="editfielda reposition marginleftonly marginrightonly" href="./card.php?id='.$objp->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($param ? '?'.$param : '')).'">';
|
||||
print img_edit();
|
||||
|
||||
@ -503,7 +503,7 @@ if ($result) {
|
||||
|
||||
// Suggested accounting account
|
||||
print '<td>';
|
||||
print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone');
|
||||
print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone');
|
||||
print '</td>';
|
||||
|
||||
print '<td class="center">';
|
||||
|
||||
@ -113,15 +113,17 @@ if (!empty($conf->global->INVOICE_USE_SITUATION) && $conf->global->INVOICE_USE_S
|
||||
</script>';
|
||||
}
|
||||
|
||||
|
||||
print load_fiche_titre($langs->trans("AccountancyArea"), $resultboxes['selectboxlist'], 'accountancy', 0, '', '', $showtutorial);
|
||||
|
||||
if (!empty($conf->global->INVOICE_USE_SITUATION) && $conf->global->INVOICE_USE_SITUATION == 1) {
|
||||
print info_admin($langs->trans("SorryThisModuleIsNotCompatibleWithTheExperimentalFeatureOfSituationInvoices"));
|
||||
print "<br>";
|
||||
}
|
||||
|
||||
print '<div class="'.($helpisexpanded ? '' : 'hideobject').'" id="idfaq">'; // hideobject is to start hidden
|
||||
print "<br>\n";
|
||||
print '<span class="opacitymedium">'.$langs->trans("AccountancyAreaDescIntro")."</span><br>\n";
|
||||
if ($user->hasRight('accounting', 'chartofaccount')) {
|
||||
print "<br>\n"; print "<br>\n";
|
||||
|
||||
print load_fiche_titre('<span class="fa fa-calendar-check-o"></span> '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."\n";
|
||||
print '<hr>';
|
||||
print "<br>\n";
|
||||
|
||||
@ -1032,9 +1032,11 @@ if (empty($action) || $action == 'view') {
|
||||
$salarystatic = new Salary($db);
|
||||
$variousstatic = new PaymentVarious($db);
|
||||
|
||||
llxHeader('', $langs->trans("FinanceJournal"));
|
||||
$title = $langs->trans("GenerationOfAccountingEntries").' - '.$accountingjournalstatic->getNomUrl(0, 2, 1, '', 1);
|
||||
|
||||
$nom = $langs->trans("FinanceJournal").' | '.$accountingjournalstatic->getNomUrl(0, 1, 1, '', 1);
|
||||
llxHeader('', dol_string_nohtmltag($title));
|
||||
|
||||
$nom = $title;
|
||||
$builddate = dol_now();
|
||||
//$description = $langs->trans("DescFinanceJournal") . '<br>';
|
||||
$description = $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
||||
@ -1052,6 +1054,7 @@ if (empty($action) || $action == 'view') {
|
||||
|
||||
journalHead($nom, '', $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
|
||||
|
||||
$desc = '';
|
||||
|
||||
// Test that setup is complete (we are in accounting, so test on entity is always on $conf->entity only, no sharing allowed)
|
||||
$sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."bank_account WHERE entity = ".((int) $conf->entity)." AND fk_accountancy_journal IS NULL AND clos=0";
|
||||
@ -1074,7 +1077,7 @@ if (empty($action) || $action == 'view') {
|
||||
if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1'
|
||||
|| ($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1'
|
||||
|| empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') {
|
||||
print '<br><div class="warning">'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
|
||||
print ($desc ? '' : '<br>').'<div class="warning">'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
|
||||
$desc = ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '{link}');
|
||||
$desc = str_replace('{link}', '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>', $desc);
|
||||
print $desc;
|
||||
@ -1125,8 +1128,8 @@ if (empty($action) || $action == 'view') {
|
||||
|
||||
$i = 0;
|
||||
print '<div class="div-table-responsive">';
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print "<td>".$langs->trans("Date")."</td>";
|
||||
print "<td>".$langs->trans("Piece").' ('.$langs->trans("ObjectsRef").")</td>";
|
||||
print "<td>".$langs->trans("AccountAccounting")."</td>";
|
||||
|
||||
@ -496,14 +496,16 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
||||
}
|
||||
|
||||
if (empty($action) || $action == 'view') {
|
||||
llxHeader('', $langs->trans("ExpenseReportsJournal"));
|
||||
$title = $langs->trans("GenerationOfAccountingEntries").' - '.$accountingjournalstatic->getNomUrl(0, 2, 1, '', 1);
|
||||
|
||||
$nom = $langs->trans("ExpenseReportsJournal").' | '.$accountingjournalstatic->getNomUrl(0, 1, 1, '', 1);
|
||||
llxHeader('', dol_string_nohtmltag($title));
|
||||
|
||||
$nom = $title;
|
||||
$nomlink = '';
|
||||
$periodlink = '';
|
||||
$exportlink = '';
|
||||
$builddate = dol_now();
|
||||
$description .= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
||||
$description = $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
||||
|
||||
$listofchoices = array('notyet'=>$langs->trans("NotYetInGeneralLedger"), 'already'=>$langs->trans("AlreadyInGeneralLedger"));
|
||||
$period = $form->selectDate($date_start ? $date_start : -1, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end ? $date_end : -1, 'date_end', 0, 0, 0, '', 1, 0);
|
||||
|
||||
@ -133,7 +133,7 @@ if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
|
||||
$sql .= " WHERE f.fk_statut > 0";
|
||||
$sql .= " AND fd.fk_code_ventilation > 0";
|
||||
$sql .= " AND f.entity IN (".getEntity('facture_fourn', 0).")"; // We don't share object for accountancy
|
||||
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$sql .= " AND f.type IN (".FactureFournisseur::TYPE_STANDARD.",".FactureFournisseur::TYPE_REPLACEMENT.",".FactureFournisseur::TYPE_CREDIT_NOTE.",".FactureFournisseur::TYPE_SITUATION.")";
|
||||
} else {
|
||||
$sql .= " AND f.type IN (".FactureFournisseur::TYPE_STANDARD.",".FactureFournisseur::TYPE_REPLACEMENT.",".FactureFournisseur::TYPE_CREDIT_NOTE.",".FactureFournisseur::TYPE_DEPOSIT.",".FactureFournisseur::TYPE_SITUATION.")";
|
||||
@ -379,7 +379,7 @@ if ($action == 'writebookkeeping') {
|
||||
if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING')) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php';
|
||||
$lettering_static = new Lettering($db);
|
||||
$nb_lettering = $lettering_static->bookkeepingLettering(array($bookkeeping->id), 'supplier_invoice');
|
||||
$nb_lettering = $lettering_static->bookkeepingLettering(array($bookkeeping->id));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -756,15 +756,17 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
||||
}
|
||||
|
||||
if (empty($action) || $action == 'view') {
|
||||
llxHeader('', $langs->trans("PurchasesJournal"));
|
||||
$title = $langs->trans("GenerationOfAccountingEntries").' - '.$accountingjournalstatic->getNomUrl(0, 2, 1, '', 1);
|
||||
|
||||
$nom = $langs->trans("PurchasesJournal").' | '.$accountingjournalstatic->getNomUrl(0, 1, 1, '', 1);
|
||||
llxHeader('', dol_string_nohtmltag($title));
|
||||
|
||||
$nom = $title;
|
||||
$nomlink = '';
|
||||
$periodlink = '';
|
||||
$exportlink = '';
|
||||
$builddate = dol_now();
|
||||
$description = $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
||||
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$description .= $langs->trans("DepositsAreNotIncluded");
|
||||
} else {
|
||||
$description .= $langs->trans("DepositsAreIncluded");
|
||||
|
||||
@ -393,7 +393,7 @@ if ($action == 'writebookkeeping') {
|
||||
if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING')) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php';
|
||||
$lettering_static = new Lettering($db);
|
||||
$nb_lettering = $lettering_static->bookkeepingLettering(array($bookkeeping->id), 'customer_invoice');
|
||||
$nb_lettering = $lettering_static->bookkeepingLettering(array($bookkeeping->id));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -699,9 +699,11 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
||||
|
||||
|
||||
if (empty($action) || $action == 'view') {
|
||||
llxHeader('', $langs->trans("SellsJournal"));
|
||||
$title = $langs->trans("GenerationOfAccountingEntries").' - '.$accountingjournalstatic->getNomUrl(0, 2, 1, '', 1);
|
||||
|
||||
$nom = $langs->trans("SellsJournal").' | '.$accountingjournalstatic->getNomUrl(0, 1, 1, '', 1);
|
||||
llxHeader('', dol_string_nohtmltag($title));
|
||||
|
||||
$nom = $title;
|
||||
$nomlink = '';
|
||||
$periodlink = '';
|
||||
$exportlink = '';
|
||||
|
||||
@ -165,22 +165,18 @@ if ($reload) {
|
||||
$form = new Form($db);
|
||||
|
||||
if ($object->nature == 2) {
|
||||
$title = $langs->trans("SellsJournal");
|
||||
$some_mandatory_steps_of_setup_were_not_done = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "" || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1';
|
||||
$account_accounting_not_defined = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "" || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1';
|
||||
} elseif ($object->nature == 3) {
|
||||
$title = $langs->trans("PurchasesJournal");
|
||||
$some_mandatory_steps_of_setup_were_not_done = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "" || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1';
|
||||
$account_accounting_not_defined = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "" || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1';
|
||||
} elseif ($object->nature == 4) {
|
||||
$title = $langs->trans("FinanceJournal");
|
||||
$some_mandatory_steps_of_setup_were_not_done = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "" || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1'
|
||||
|| $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "" || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1'
|
||||
|| empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1';
|
||||
$account_accounting_not_defined = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "" || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1'
|
||||
|| $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "" || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1';
|
||||
} elseif ($object->nature == 5) {
|
||||
$title = $langs->trans("ExpenseReportsJournal");
|
||||
$some_mandatory_steps_of_setup_were_not_done = empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1';
|
||||
$account_accounting_not_defined = empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1';
|
||||
} else {
|
||||
@ -189,8 +185,11 @@ if ($object->nature == 2) {
|
||||
$account_accounting_not_defined = false;
|
||||
}
|
||||
|
||||
$title = $langs->trans("GenerationOfAccountingEntries") . ' - ' . $object->getNomUrl(0, 2, 1, '', 1);
|
||||
|
||||
$nom = $title . ' | ' . $object->getNomUrl(0, 1, 1, '', 1);
|
||||
llxHeader('', dol_string_nohtmltag($title));
|
||||
|
||||
$nom = $title;
|
||||
$nomlink = '';
|
||||
$periodlink = '';
|
||||
$exportlink = '';
|
||||
@ -202,6 +201,9 @@ if ($object->nature == 2 || $object->nature == 3) {
|
||||
} else {
|
||||
$description .= $langs->trans("DepositsAreIncluded");
|
||||
}
|
||||
if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$description .= $langs->trans("SupplierDepositsAreNotIncluded");
|
||||
}
|
||||
}
|
||||
|
||||
$listofchoices = array('notyet' => $langs->trans("NotYetInGeneralLedger"), 'already' => $langs->trans("AlreadyInGeneralLedger"));
|
||||
@ -210,8 +212,6 @@ $period .= ' - ' . $langs->trans("JournalizationInLedgerStatus") . ' ' . $form-
|
||||
|
||||
$varlink = 'id_journal=' . $id_journal;
|
||||
|
||||
llxHeader('', $title);
|
||||
|
||||
journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
|
||||
|
||||
if ($object->nature == 4) { // Bank journal
|
||||
@ -290,19 +290,21 @@ print '<td class="right">' . $langs->trans("Debit") . '</td>';
|
||||
print '<td class="right">' . $langs->trans("Credit") . '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
foreach ($journal_data as $element_id => $element) {
|
||||
foreach ($element['blocks'] as $lines) {
|
||||
foreach ($lines as $line) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>' . $line['date'] . '</td>';
|
||||
print '<td>' . $line['piece'] . '</td>';
|
||||
print '<td>' . $line['account_accounting'] . '</td>';
|
||||
print '<td>' . $line['subledger_account'] . '</td>';
|
||||
print '<td>' . $line['label_operation'] . '</td>';
|
||||
if ($object->nature == 4) print '<td class="center">' . $line['payment_mode'] . '</td>';
|
||||
print '<td class="right nowraponall">' . $line['debit'] . '</td>';
|
||||
print '<td class="right nowraponall">' . $line['credit'] . '</td>';
|
||||
print '</tr>';
|
||||
if (is_array($journal_data) && !empty($journal_data)) {
|
||||
foreach ($journal_data as $element_id => $element) {
|
||||
foreach ($element['blocks'] as $lines) {
|
||||
foreach ($lines as $line) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>' . $line['date'] . '</td>';
|
||||
print '<td>' . $line['piece'] . '</td>';
|
||||
print '<td>' . $line['account_accounting'] . '</td>';
|
||||
print '<td>' . $line['subledger_account'] . '</td>';
|
||||
print '<td>' . $line['label_operation'] . '</td>';
|
||||
if ($object->nature == 4) print '<td class="center">' . $line['payment_mode'] . '</td>';
|
||||
print '<td class="right nowraponall">' . $line['debit'] . '</td>';
|
||||
print '<td class="right nowraponall">' . $line['credit'] . '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -140,7 +140,7 @@ if ($action == 'validatehistory') {
|
||||
}*/
|
||||
|
||||
// Supplier Invoice Lines (must be same request than into page list.php for manual binding)
|
||||
$sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.type as ftype,";
|
||||
$sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.type as ftype, f.fk_facture_source,";
|
||||
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tva_tx as tva_tx_prod,";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
@ -233,7 +233,10 @@ if ($action == 'validatehistory') {
|
||||
$facture_static->ref = $objp->ref;
|
||||
$facture_static->id = $objp->facid;
|
||||
$facture_static->type = $objp->ftype;
|
||||
$facture_static->date = $objp->datef;
|
||||
$facture_static->ref_supplier = $objp->ref_supplier;
|
||||
$facture_static->label = $objp->invoice_label;
|
||||
$facture_static->date = $db->jdate($objp->datef);
|
||||
$facture_static->fk_facture_source = $objp->fk_facture_source;
|
||||
|
||||
$facture_static_det->id = $objp->rowid;
|
||||
$facture_static_det->total_ht = $objp->total_ht;
|
||||
|
||||
@ -232,7 +232,7 @@ if (empty($chartaccountcode)) {
|
||||
}
|
||||
|
||||
// Supplier Invoice Lines
|
||||
$sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.type as ftype,";
|
||||
$sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.type as ftype, f.fk_facture_source,";
|
||||
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tva_tx as tva_tx_prod,";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
@ -342,7 +342,7 @@ if (strlen(trim($search_country))) {
|
||||
if (strlen(trim($search_tvaintra))) {
|
||||
$sql .= natural_search("s.tva_intra", $search_tvaintra);
|
||||
}
|
||||
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$sql .= " AND f.type IN (".FactureFournisseur::TYPE_STANDARD.",".FactureFournisseur::TYPE_REPLACEMENT.",".FactureFournisseur::TYPE_CREDIT_NOTE.",".FactureFournisseur::TYPE_SITUATION.")";
|
||||
} else {
|
||||
$sql .= " AND f.type IN (".FactureFournisseur::TYPE_STANDARD.",".FactureFournisseur::TYPE_REPLACEMENT.",".FactureFournisseur::TYPE_CREDIT_NOTE.",".FactureFournisseur::TYPE_DEPOSIT.",".FactureFournisseur::TYPE_SITUATION.")";
|
||||
@ -592,6 +592,7 @@ if ($result) {
|
||||
$facturefourn_static->ref_supplier = $objp->ref_supplier;
|
||||
$facturefourn_static->label = $objp->invoice_label;
|
||||
$facturefourn_static->date = $db->jdate($objp->datef);
|
||||
$facturefourn_static->fk_facture_source = $objp->fk_facture_source;
|
||||
|
||||
$facturefourn_static_det->id = $objp->rowid;
|
||||
$facturefourn_static_det->total_ht = $objp->total_ht;
|
||||
@ -749,7 +750,7 @@ if ($result) {
|
||||
|
||||
// Suggested accounting account
|
||||
print '<td>';
|
||||
print $formaccounting->select_account(($default_account > 0 && $confirm === 'yes' && in_array($objp->rowid."_".$i, $toselect)) ? $default_account : $suggestedid, 'codeventil'.$facturefourn_static_det->id, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone');
|
||||
print $formaccounting->select_account(($default_account > 0 && $confirm === 'yes' && in_array($objp->rowid."_".$i, $toselect)) ? $default_account : $suggestedid, 'codeventil'.$facturefourn_static_det->id, 1, array(), 0, 0, 'codeventil maxwidth150 maxwidthonsmartphone', 'cachewithshowemptyone');
|
||||
print '</td>';
|
||||
|
||||
// Column with checkbox
|
||||
|
||||
@ -100,7 +100,7 @@ if ($action == 'set_default') {
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
} elseif ($action == 'updateall') {
|
||||
} elseif ($action == 'updatemainoptions') {
|
||||
$db->begin();
|
||||
$res1 = $res2 = $res3 = $res4 = $res5 = $res6 = $res7 = 0;
|
||||
$res1 = dolibarr_set_const($db, 'ADHERENT_LOGIN_NOT_REQUIRED', GETPOST('ADHERENT_LOGIN_NOT_REQUIRED', 'alpha') ? 0 : 1, 'chaine', 0, '', $conf->entity);
|
||||
@ -123,6 +123,35 @@ if ($action == 'set_default') {
|
||||
setEventMessages('RecordModifiedSuccessfully', null, 'mesgs');
|
||||
$db->commit();
|
||||
}
|
||||
} elseif ($action == 'updatememberscards') {
|
||||
$db->begin();
|
||||
$res1 = $res2 = $res3 = $res4 = 0;
|
||||
$res1 = dolibarr_set_const($db, 'ADHERENT_CARD_TYPE', GETPOST('ADHERENT_CARD_TYPE'), 'chaine', 0, '', $conf->entity);
|
||||
$res2 = dolibarr_set_const($db, 'ADHERENT_CARD_HEADER_TEXT', GETPOST('ADHERENT_CARD_HEADER_TEXT', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
$res3 = dolibarr_set_const($db, 'ADHERENT_CARD_TEXT', GETPOST('ADHERENT_CARD_TEXT', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
$res3 = dolibarr_set_const($db, 'ADHERENT_CARD_TEXT_RIGHT', GETPOST('ADHERENT_CARD_TEXT_RIGHT', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
$res4 = dolibarr_set_const($db, 'ADHERENT_CARD_FOOTER_TEXT', GETPOST('ADHERENT_CARD_FOOTER_TEXT', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
|
||||
if ($res1 < 0 || $res2 < 0 || $res3 < 0 || $res4 < 0) {
|
||||
setEventMessages('ErrorFailedToSaveDate', null, 'errors');
|
||||
$db->rollback();
|
||||
} else {
|
||||
setEventMessages('RecordModifiedSuccessfully', null, 'mesgs');
|
||||
$db->commit();
|
||||
}
|
||||
} elseif ($action == 'updatememberstickets') {
|
||||
$db->begin();
|
||||
$res1 = $res2 = 0;
|
||||
$res1 = dolibarr_set_const($db, 'ADHERENT_ETIQUETTE_TYPE', GETPOST('ADHERENT_ETIQUETTE_TYPE'), 'chaine', 0, '', $conf->entity);
|
||||
$res2 = dolibarr_set_const($db, 'ADHERENT_ETIQUETTE_TEXT', GETPOST('ADHERENT_ETIQUETTE_TEXT', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
|
||||
if ($res1 < 0 || $res2 < 0) {
|
||||
setEventMessages('ErrorFailedToSaveDate', null, 'errors');
|
||||
$db->rollback();
|
||||
} else {
|
||||
setEventMessages('RecordModifiedSuccessfully', null, 'mesgs');
|
||||
$db->commit();
|
||||
}
|
||||
}
|
||||
|
||||
// Action to update or add a constant
|
||||
@ -130,6 +159,7 @@ if ($action == 'update' || $action == 'add') {
|
||||
$constname = GETPOST('constname', 'alpha');
|
||||
$constvalue = (GETPOST('constvalue_'.$constname) ? GETPOST('constvalue_'.$constname) : GETPOST('constvalue'));
|
||||
|
||||
|
||||
if (($constname == 'ADHERENT_CARD_TYPE' || $constname == 'ADHERENT_ETIQUETTE_TYPE' || $constname == 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS') && $constvalue == -1) {
|
||||
$constvalue = '';
|
||||
}
|
||||
@ -195,10 +225,10 @@ print dol_get_fiche_head($head, 'general', $langs->trans("Members"), -1, 'user')
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="updateall">';
|
||||
print '<input type="hidden" name="action" value="updatemainoptions">';
|
||||
|
||||
|
||||
// Mains options
|
||||
// Main options
|
||||
|
||||
print load_fiche_titre($langs->trans("MemberMainOptions"), '', '');
|
||||
|
||||
@ -294,6 +324,8 @@ print '</form>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
// Document templates for documents generated from member record
|
||||
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
|
||||
// Defined model definition table
|
||||
@ -431,24 +463,12 @@ print '</div>';
|
||||
|
||||
|
||||
|
||||
/*
|
||||
TODO Use a global form instead of embeded form into table
|
||||
|
||||
// Generation of cards for members
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="updateall">';
|
||||
*/
|
||||
|
||||
/*
|
||||
* Edit info of model document
|
||||
*/
|
||||
$constantes = array(
|
||||
'ADHERENT_CARD_TYPE',
|
||||
//'ADHERENT_CARD_BACKGROUND',
|
||||
'ADHERENT_CARD_HEADER_TEXT',
|
||||
'ADHERENT_CARD_TEXT',
|
||||
'ADHERENT_CARD_TEXT_RIGHT',
|
||||
'ADHERENT_CARD_FOOTER_TEXT'
|
||||
);
|
||||
print '<input type="hidden" name="action" value="updatememberscards">';
|
||||
|
||||
print load_fiche_titre($langs->trans("MembersCards"), '', '');
|
||||
|
||||
@ -457,15 +477,65 @@ $helptext .= '__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULL
|
||||
$helptext .= '__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, ';
|
||||
$helptext .= '__YEAR__, __MONTH__, __DAY__';
|
||||
|
||||
form_constantes($constantes, 0, $helptext);
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td>'.$form->textwithpicto($langs->trans("Value"), $helptext, 1, 'help', '', 0, 2, 'idhelptext').'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Format of cards page
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("DescADHERENT_CARD_TYPE").'</td><td>';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/format_cards.lib.php'; // List of possible labels (defined into $_Avery_Labels variable set into format_cards.lib.php)
|
||||
$arrayoflabels = array();
|
||||
foreach (array_keys($_Avery_Labels) as $codecards) {
|
||||
$arrayoflabels[$codecards] = $_Avery_Labels[$codecards]['name'];
|
||||
}
|
||||
print $form->selectarray('ADHERENT_CARD_TYPE', $arrayoflabels, getDolGlobalString('ADHERENT_CARD_TYPE') ? getDolGlobalString('ADHERENT_CARD_TYPE') : 'CARD', 1, 0, 0);
|
||||
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Text printed on top of member cards
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("DescADHERENT_CARD_HEADER_TEXT").'</td><td>';
|
||||
print '<input type="text" class="flat minwidth300" name="ADHERENT_CARD_HEADER_TEXT" value="'.dol_escape_htmltag(getDolGlobalString('ADHERENT_CARD_HEADER_TEXT')).'">';
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Text printed on member cards (align on left)
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("DescADHERENT_CARD_TEXT").'</td><td>';
|
||||
print '<textarea class="flat" name="ADHERENT_CARD_TEXT" cols="50" rows="5" wrap="soft">'."\n";
|
||||
print getDolGlobalString('ADHERENT_CARD_TEXT');
|
||||
print '</textarea>';
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Text printed on member cards (align on right)
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("DescADHERENT_CARD_TEXT_RIGHT").'</td><td>';
|
||||
print '<textarea class="flat" name="ADHERENT_CARD_TEXT_RIGHT" cols="50" rows="5" wrap="soft">'."\n";
|
||||
print getDolGlobalString('ADHERENT_CARD_TEXT_RIGHT');
|
||||
print '</textarea>';
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Text printed on bottom of member cards
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("DescADHERENT_CARD_FOOTER_TEXT").'</td><td>';
|
||||
print '<input type="text" class="flat minwidth300" name="ADHERENT_CARD_FOOTER_TEXT" value="'.dol_escape_htmltag(getDolGlobalString('ADHERENT_CARD_FOOTER_TEXT')).'">';
|
||||
print "</td></tr>\n";
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Update").'" name="Button">';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
// Membership address sheet
|
||||
|
||||
/*
|
||||
* Edit info of model document
|
||||
*/
|
||||
$constantes = array('ADHERENT_ETIQUETTE_TYPE', 'ADHERENT_ETIQUETTE_TEXT');
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="updatememberstickets">';
|
||||
|
||||
print load_fiche_titre($langs->trans("MembersTickets"), '', '');
|
||||
|
||||
@ -474,9 +544,42 @@ $helptext .= '__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULL
|
||||
$helptext .= '__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, ';
|
||||
$helptext .= '__YEAR__, __MONTH__, __DAY__';
|
||||
|
||||
form_constantes($constantes, 0, $helptext);
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td>'.$form->textwithpicto($langs->trans("Value"), $helptext, 1, 'help', '', 0, 2, 'idhelptext').'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
//print '</form>';
|
||||
// Format of labels page
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("DescADHERENT_ETIQUETTE_TYPE").'</td><td>';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/format_cards.lib.php'; // List of possible labels (defined into $_Avery_Labels variable set into format_cards.lib.php)
|
||||
$arrayoflabels = array();
|
||||
foreach (array_keys($_Avery_Labels) as $codecards) {
|
||||
$arrayoflabels[$codecards] = $_Avery_Labels[$codecards]['name'];
|
||||
}
|
||||
print $form->selectarray('ADHERENT_ETIQUETTE_TYPE', $arrayoflabels, getDolGlobalString('ADHERENT_ETIQUETTE_TYPE') ? getDolGlobalString('ADHERENT_ETIQUETTE_TYPE') : 'CARD', 1, 0, 0);
|
||||
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Text printed on member address sheets
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("DescADHERENT_ETIQUETTE_TEXT").'</td><td>';
|
||||
print '<textarea class="flat" name="ADHERENT_ETIQUETTE_TEXT" cols="50" rows="5" wrap="soft">'."\n";
|
||||
print getDolGlobalString('ADHERENT_ETIQUETTE_TEXT');
|
||||
print '</textarea>';
|
||||
print "</td></tr>\n";
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Update").'" name="Button">';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
print "<br>";
|
||||
|
||||
|
||||
@ -133,7 +133,7 @@ if (empty($user->socid)) {
|
||||
}
|
||||
|
||||
if ($user->rights->adherent->supprimer) {
|
||||
echo '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&action=delete&token='.newToken().'&canvas='.$canvas.'">'.$langs->trans('Delete').'</a>';
|
||||
print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&action=delete&token='.newToken().'&canvas='.$canvas, 'delete', $user->rights->adherent->supprimer);
|
||||
}
|
||||
|
||||
echo '</div><br>';
|
||||
|
||||
@ -98,14 +98,14 @@ if ($id > 0 || !empty($ref)) {
|
||||
$result = $object->fetch($id, $ref);
|
||||
|
||||
// Define variables to know what current user can do on users
|
||||
$canadduser = ($user->admin || $user->rights->user->user->creer);
|
||||
$canadduser = ($user->admin || $user->hasRight('user', 'user', 'creer'));
|
||||
// Define variables to know what current user can do on properties of user linked to edited member
|
||||
if ($object->user_id) {
|
||||
// $User is the user who edits, $object->user_id is the id of the related user in the edited member
|
||||
$caneditfielduser = ((($user->id == $object->user_id) && $user->rights->user->self->creer)
|
||||
|| (($user->id != $object->user_id) && $user->rights->user->user->creer));
|
||||
$caneditpassworduser = ((($user->id == $object->user_id) && $user->rights->user->self->password)
|
||||
|| (($user->id != $object->user_id) && $user->rights->user->user->password));
|
||||
$caneditfielduser = ((($user->id == $object->user_id) && $user->hasRight('user', 'self', 'creer'))
|
||||
|| (($user->id != $object->user_id) && $user->hasRight('user', 'user', 'creer')));
|
||||
$caneditpassworduser = ((($user->id == $object->user_id) && $user->hasRight('user', 'self', 'password'))
|
||||
|| (($user->id != $object->user_id) && $user->hasRight('user', 'user', 'password')));
|
||||
}
|
||||
}
|
||||
|
||||
@ -154,9 +154,9 @@ if (empty($reshook)) {
|
||||
$action = '';
|
||||
}
|
||||
|
||||
if ($action == 'setuserid' && ($user->rights->user->self->creer || $user->rights->user->user->creer)) {
|
||||
if ($action == 'setuserid' && ($user->hasRight('user', 'self', 'creer') || $user->hasRight('user', 'user', 'creer'))) {
|
||||
$error = 0;
|
||||
if (empty($user->rights->user->user->creer)) { // If can edit only itself user, we can link to itself only
|
||||
if (!$user->hasRight('user', 'user', 'creer')) { // If can edit only itself user, we can link to itself only
|
||||
if ($userid != $user->id && $userid != $object->user_id) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorUserPermissionAllowsToLinksToItselfOnly"), null, 'errors');
|
||||
@ -206,7 +206,7 @@ if (empty($reshook)) {
|
||||
}
|
||||
|
||||
// Create user from a member
|
||||
if ($action == 'confirm_create_user' && $confirm == 'yes' && $user->rights->user->user->creer) {
|
||||
if ($action == 'confirm_create_user' && $confirm == 'yes' && $user->hasRight('user', 'user', 'creer')) {
|
||||
if ($result > 0) {
|
||||
// Creation user
|
||||
$nuser = new User($db);
|
||||
@ -230,7 +230,7 @@ if (empty($reshook)) {
|
||||
}
|
||||
|
||||
// Create third party from a member
|
||||
if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights->societe->creer) {
|
||||
if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->hasRight('societe', 'creer')) {
|
||||
if ($result > 0) {
|
||||
// User creation
|
||||
$company = new Societe($db);
|
||||
@ -585,7 +585,10 @@ if (empty($reshook)) {
|
||||
$db->commit();
|
||||
$rowid = $object->id;
|
||||
$id = $object->id;
|
||||
|
||||
$backtopage = preg_replace('/__ID__/', $id, $backtopage);
|
||||
} else {
|
||||
$error++;
|
||||
$db->rollback();
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
@ -614,7 +617,7 @@ if (empty($reshook)) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($user->rights->adherent->supprimer && $action == 'confirm_delete' && $confirm == 'yes') {
|
||||
if ($user->hasRight('adherent', 'supprimer') && $action == 'confirm_delete' && $confirm == 'yes') {
|
||||
$result = $object->delete($id, $user);
|
||||
if ($result > 0) {
|
||||
if (!empty($backtopage)) {
|
||||
@ -703,7 +706,7 @@ if (empty($reshook)) {
|
||||
$action = '';
|
||||
}
|
||||
|
||||
if ($user->rights->adherent->supprimer && $action == 'confirm_resiliate') {
|
||||
if ($user->hasRight('adherent', 'supprimer') && $action == 'confirm_resiliate') {
|
||||
$error = 0;
|
||||
|
||||
if ($confirm == 'yes') {
|
||||
@ -774,7 +777,7 @@ if (empty($reshook)) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($user->rights->adherent->supprimer && $action == 'confirm_exclude') {
|
||||
if ($user->hasRight('adherent', 'supprimer') && $action == 'confirm_exclude') {
|
||||
$error = 0;
|
||||
|
||||
if ($confirm == 'yes') {
|
||||
@ -846,7 +849,7 @@ if (empty($reshook)) {
|
||||
}
|
||||
|
||||
// SPIP Management
|
||||
if ($user->rights->adherent->supprimer && $action == 'confirm_del_spip' && $confirm == 'yes') {
|
||||
if ($user->hasRight('adherent', 'supprimer') && $action == 'confirm_del_spip' && $confirm == 'yes') {
|
||||
if (!count($object->errors)) {
|
||||
if (!$mailmanspip->del_to_spip($object)) {
|
||||
setEventMessages($langs->trans('DeleteIntoSpipError').': '.$mailmanspip->error, null, 'errors');
|
||||
@ -1041,8 +1044,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
print '<td>'.img_picto('', 'object_email').' <input type="text" name="member_email" class="minwidth300" maxlength="255" value="'.(GETPOSTISSET('member_email') ? GETPOST('member_email', 'alpha') : $soc->email).'"></td></tr>';
|
||||
|
||||
// Website
|
||||
print '<tr><td>'.$form->editfieldkey('Web', 'member_url', '', $object, 0).'</td>';
|
||||
print '<td>'.img_picto('', 'globe').' <input type="text" class="maxwidth500 widthcentpercentminusx" name="member_url" id="member_url" value="'.$object->url.'"></td></tr>';
|
||||
print '<tr><td>'.$form->editfieldkey('Web', 'member_url', GETPOST('member_url', 'alpha'), $object, 0).'</td>';
|
||||
print '<td>'.img_picto('', 'globe').' <input type="text" class="maxwidth500 widthcentpercentminusx" name="member_url" id="member_url" value="'.(GETPOSTISSET('member_url', 'alpha') ? GETPOST('member_url', 'alpha') : $object->url).'"></td></tr>';
|
||||
|
||||
// Address
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Address").'</td><td>';
|
||||
@ -1115,7 +1118,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Categories
|
||||
if (isModEnabled('categorie') && !empty($user->rights->categorie->lire)) {
|
||||
if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) {
|
||||
print '<tr><td>'.$form->editfieldkey("Categories", 'memcats', '', $object, 0).'</td><td>';
|
||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_MEMBER, null, 'parent', null, null, 1);
|
||||
print img_picto('', 'category').$form->multiselectarray('memcats', $cate_arbo, GETPOST('memcats', 'array'), null, null, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
|
||||
@ -1364,7 +1367,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Categories
|
||||
if (isModEnabled('categorie') && !empty($user->rights->categorie->lire)) {
|
||||
if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) {
|
||||
print '<tr><td>'.$form->editfieldkey("Categories", 'memcats', '', $object, 0).'</td>';
|
||||
print '<td>';
|
||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_MEMBER, null, null, null, null, 1);
|
||||
@ -1722,10 +1725,12 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
}
|
||||
|
||||
// Type
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Type").'</td><td class="valeur">'.$adht->getNomUrl(1)."</td></tr>\n";
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Type").'</td>';
|
||||
print '<td class="valeur">'.$adht->getNomUrl(1)."</td></tr>\n";
|
||||
|
||||
// Morphy
|
||||
print '<tr><td>'.$langs->trans("MemberNature").'</td><td class="valeur" >'.$object->getmorphylib().'</td>';
|
||||
print '<tr><td>'.$langs->trans("MemberNature").'</td>';
|
||||
print '<td class="valeur" >'.$object->getmorphylib('', 1).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Company
|
||||
@ -1788,7 +1793,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
print '<table class="border tableforfield centpercent">';
|
||||
|
||||
// Tags / Categories
|
||||
if (isModEnabled('categorie') && !empty($user->rights->categorie->lire)) {
|
||||
if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) {
|
||||
print '<tr><td>'.$langs->trans("Categories").'</td>';
|
||||
print '<td colspan="2">';
|
||||
print $form->showCategories($object->id, Categorie::TYPE_MEMBER, 1);
|
||||
@ -1857,7 +1862,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
// Login Dolibarr - Link to user
|
||||
print '<tr><td>';
|
||||
$editenable = $user->hasRight('adherent', 'creer') && $user->rights->user->user->creer;
|
||||
$editenable = $user->hasRight('adherent', 'creer') && $user->hasRight('user', 'user', 'creer');
|
||||
print $form->editfieldkey('LinkedToDolibarrUser', 'login', '', $object, $editenable);
|
||||
print '</td><td colspan="2" class="valeur">';
|
||||
if ($action == 'editlogin') {
|
||||
@ -1894,7 +1899,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
// Send
|
||||
if (empty($user->socid)) {
|
||||
if (Adherent::STATUS_VALIDATED == $object->statut) {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init#formmailbeforetitle">'.$langs->trans('SendMail').'</a>'."\n";
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.((int) $object->id).'&action=presend&mode=init#formmailbeforetitle">'.$langs->trans('SendMail').'</a>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
@ -1914,7 +1919,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
// Modify
|
||||
if ($user->hasRight('adherent', 'creer')) {
|
||||
print '<a class="butAction" href="card.php?rowid='.$id.'&action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a>'."\n";
|
||||
print '<a class="butAction" href="card.php?rowid='.((int) $object->id).'&action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a>'."\n";
|
||||
} else {
|
||||
print '<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Modify").'</span>'."\n";
|
||||
}
|
||||
@ -1922,7 +1927,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
// Validate
|
||||
if (Adherent::STATUS_DRAFT == $object->statut) {
|
||||
if ($user->hasRight('adherent', 'creer')) {
|
||||
print '<a class="butAction" href="card.php?rowid='.$id.'&action=valid">'.$langs->trans("Validate").'</a>'."\n";
|
||||
print '<a class="butAction" href="card.php?rowid='.((int) $object->id).'&action=valid&token='.newToken().'">'.$langs->trans("Validate").'</a>'."\n";
|
||||
} else {
|
||||
print '<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Validate").'</span>'."\n";
|
||||
}
|
||||
@ -1931,7 +1936,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
// Reactivate
|
||||
if (Adherent::STATUS_RESILIATED == $object->statut || Adherent::STATUS_EXCLUDED == $object->statut) {
|
||||
if ($user->hasRight('adherent', 'creer')) {
|
||||
print '<a class="butAction" href="card.php?rowid='.$id.'&action=valid">'.$langs->trans("Reenable")."</a>\n";
|
||||
print '<a class="butAction" href="card.php?rowid='.((int) $object->id).'&action=valid">'.$langs->trans("Reenable")."</a>\n";
|
||||
} else {
|
||||
print '<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Reenable").'</span>'."\n";
|
||||
}
|
||||
@ -1939,8 +1944,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
// Resiliate
|
||||
if (Adherent::STATUS_VALIDATED == $object->statut) {
|
||||
if ($user->rights->adherent->supprimer) {
|
||||
print '<a class="butAction" href="card.php?rowid='.$id.'&action=resiliate">'.$langs->trans("Resiliate")."</a></span>\n";
|
||||
if ($user->hasRight('adherent', 'supprimer')) {
|
||||
print '<a class="butAction" href="card.php?rowid='.((int) $object->id).'&action=resiliate">'.$langs->trans("Resiliate")."</a></span>\n";
|
||||
} else {
|
||||
print '<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Resiliate").'</span>'."\n";
|
||||
}
|
||||
@ -1948,8 +1953,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
// Exclude
|
||||
if (Adherent::STATUS_VALIDATED == $object->statut) {
|
||||
if ($user->rights->adherent->supprimer) {
|
||||
print '<a class="butAction" href="card.php?rowid='.$id.'&action=exclude">'.$langs->trans("Exclude")."</a></span>\n";
|
||||
if ($user->hasRight('adherent', 'supprimer')) {
|
||||
print '<a class="butAction" href="card.php?rowid='.((int) $object->id).'&action=exclude">'.$langs->trans("Exclude")."</a></span>\n";
|
||||
} else {
|
||||
print '<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Exclude").'</span>'."\n";
|
||||
}
|
||||
@ -1957,9 +1962,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
// Create third party
|
||||
if (isModEnabled('societe') && !$object->socid) {
|
||||
if ($user->rights->societe->creer) {
|
||||
if ($user->hasRight('societe', 'creer')) {
|
||||
if (Adherent::STATUS_DRAFT != $object->statut) {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&action=create_thirdparty" title="'.dol_escape_htmltag($langs->trans("CreateDolibarrThirdPartyDesc")).'">'.$langs->trans("CreateDolibarrThirdParty").'</a>'."\n";
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.((int) $object->id).'&action=create_thirdparty" title="'.dol_escape_htmltag($langs->trans("CreateDolibarrThirdPartyDesc")).'">'.$langs->trans("CreateDolibarrThirdParty").'</a>'."\n";
|
||||
} else {
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("ValidateBefore")).'">'.$langs->trans("CreateDolibarrThirdParty").'</a>'."\n";
|
||||
}
|
||||
@ -1970,9 +1975,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
// Create user
|
||||
if (!$user->socid && !$object->user_id) {
|
||||
if ($user->rights->user->user->creer) {
|
||||
if ($user->hasRight('user', 'user', 'creer')) {
|
||||
if (Adherent::STATUS_DRAFT != $object->statut) {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&action=create_user" title="'.dol_escape_htmltag($langs->trans("CreateDolibarrLoginDesc")).'">'.$langs->trans("CreateDolibarrLogin").'</a>'."\n";
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.((int) $object->id).'&action=create_user" title="'.dol_escape_htmltag($langs->trans("CreateDolibarrLoginDesc")).'">'.$langs->trans("CreateDolibarrLogin").'</a>'."\n";
|
||||
} else {
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("ValidateBefore")).'">'.$langs->trans("CreateDolibarrLogin").'</a>'."\n";
|
||||
}
|
||||
@ -1986,16 +1991,16 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
$isinspip = $mailmanspip->is_in_spip($object);
|
||||
|
||||
if ($isinspip == 1) {
|
||||
print '<a class="butAction" href="card.php?rowid='.$object->id.'&action=del_spip&token='.newToken().'">'.$langs->trans("DeleteIntoSpip").'</a>'."\n";
|
||||
print '<a class="butAction" href="card.php?rowid='.((int) $object->id).'&action=del_spip&token='.newToken().'">'.$langs->trans("DeleteIntoSpip").'</a>'."\n";
|
||||
}
|
||||
if ($isinspip == 0) {
|
||||
print '<a class="butAction" href="card.php?rowid='.$object->id.'&action=add_spip&token='.newToken().'">'.$langs->trans("AddIntoSpip").'</a>'."\n";
|
||||
print '<a class="butAction" href="card.php?rowid='.((int) $object->id).'&action=add_spip&token='.newToken().'">'.$langs->trans("AddIntoSpip").'</a>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
// Delete
|
||||
if ($user->rights->adherent->supprimer) {
|
||||
print '<a class="butActionDelete" href="card.php?rowid='.$object->id.'&action=delete&token='.newToken().'">'.$langs->trans("Delete").'</a>'."\n";
|
||||
if ($user->hasRight('adherent', 'supprimer')) {
|
||||
print '<a class="butActionDelete" href="card.php?rowid='.((int) $object->id).'&action=delete&token='.newToken().'">'.$langs->trans("Delete").'</a>'."\n";
|
||||
} else {
|
||||
print '<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Delete").'</span>'."\n";
|
||||
}
|
||||
@ -2021,7 +2026,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
$filename = dol_sanitizeFileName($object->ref);
|
||||
$filedir = $conf->adherent->dir_output.'/'.get_exdir(0, 0, 0, 1, $object, 'member');
|
||||
$urlsource = $_SERVER['PHP_SELF'].'?id='.$object->id;
|
||||
$genallowed = $user->rights->adherent->lire;
|
||||
$genallowed = $user->hasRight('adherent', 'lire');
|
||||
$delallowed = $user->hasRight('adherent', 'creer');
|
||||
|
||||
print $formfile->showdocuments('member', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', (empty($object->default_lang) ? '' : $object->default_lang), '', $object);
|
||||
|
||||
@ -520,21 +520,51 @@ class Adherent extends CommonObject
|
||||
* Return translated label by the nature of a adherent (physical or moral)
|
||||
*
|
||||
* @param string $morphy Nature of the adherent (physical or moral)
|
||||
* @param int $addbadge Add badge (1=Full label, 2=First letters only)
|
||||
* @return string Label
|
||||
*/
|
||||
public function getmorphylib($morphy = '')
|
||||
public function getmorphylib($morphy = '', $addbadge = 0)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
// Clean var
|
||||
if (!$morphy) {
|
||||
$morphy = $this->morphy;
|
||||
}
|
||||
if ($morphy == 'phy') {
|
||||
return $langs->trans("Physical");
|
||||
|
||||
if ($addbadge) {
|
||||
$s = '';
|
||||
$labeltoshowm = $langs->trans("Moral");
|
||||
$labeltoshowp = $langs->trans("Physical");
|
||||
if ($morphy == 'phy') {
|
||||
$labeltoshow = $labeltoshowp;
|
||||
if ($addbadge == 2) {
|
||||
$labeltoshow = dol_strtoupper(dolGetFirstLetters($labeltoshowp));
|
||||
if ($labeltoshow == dol_strtoupper(dolGetFirstLetters($labeltoshowm))) {
|
||||
$labeltoshow = dol_strtoupper(dolGetFirstLetters($labeltoshowp, 2));
|
||||
}
|
||||
}
|
||||
$s .= '<span class="member-individual-back paddingleftimp paddingrightimp" title="'.$langs->trans("Physical").'">'.$labeltoshow.'</span>';
|
||||
}
|
||||
if ($morphy == 'mor') {
|
||||
$labeltoshow = $labeltoshowm;
|
||||
if ($addbadge == 2) {
|
||||
$labeltoshow = dol_strtoupper(dolGetFirstLetters($labeltoshowm));
|
||||
if ($labeltoshow == dol_strtoupper(dolGetFirstLetters($labeltoshowp))) {
|
||||
$labeltoshow = dol_strtoupper(dolGetFirstLetters($labeltoshowm, 2));
|
||||
}
|
||||
}
|
||||
$s .= '<span class="member-company-back paddingleftimp paddingrightimp" title="'.$langs->trans("Moral").'">'.$labeltoshow.'</span>';
|
||||
}
|
||||
} else {
|
||||
if ($morphy == 'phy') {
|
||||
$s = $langs->trans("Physical");
|
||||
} elseif ($morphy == 'mor') {
|
||||
$s = $langs->trans("Moral");
|
||||
}
|
||||
}
|
||||
if ($morphy == 'mor') {
|
||||
return $langs->trans("Moral");
|
||||
}
|
||||
return $morphy;
|
||||
|
||||
return $s;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -710,7 +740,7 @@ class Adherent extends CommonObject
|
||||
$sql .= ", state_id = ".($this->state_id > 0 ? $this->db->escape($this->state_id) : "null");
|
||||
$sql .= ", email = '".$this->db->escape($this->email)."'";
|
||||
$sql .= ", url = ".(!empty($this->url) ? "'".$this->db->escape($this->url)."'" : "null");
|
||||
$sql .= ", socialnetworks = '".$this->db->escape(json_encode($this->socialnetworks))."'";
|
||||
$sql .= ", socialnetworks = ".($this->socialnetworks ? "'".$this->db->escape(json_encode($this->socialnetworks))."'" : "null");
|
||||
$sql .= ", phone = ".($this->phone ? "'".$this->db->escape($this->phone)."'" : "null");
|
||||
$sql .= ", phone_perso = ".($this->phone_perso ? "'".$this->db->escape($this->phone_perso)."'" : "null");
|
||||
$sql .= ", phone_mobile = ".($this->phone_mobile ? "'".$this->db->escape($this->phone_mobile)."'" : "null");
|
||||
@ -2352,8 +2382,8 @@ class Adherent extends CommonObject
|
||||
$statusType = 'status1';
|
||||
$labelStatus = $langs->trans("MemberStatusActive");
|
||||
$labelStatusShort = $langs->trans("MemberStatusActiveShort");
|
||||
} elseif ($date_end_subscription < dol_now()) {
|
||||
$statusType = 'status3';
|
||||
} elseif ($date_end_subscription < dol_now()) { // expired
|
||||
$statusType = 'status8';
|
||||
$labelStatus = $langs->trans("MemberStatusActiveLate");
|
||||
$labelStatusShort = $langs->trans("MemberStatusActiveLateShort");
|
||||
} else {
|
||||
@ -2927,17 +2957,18 @@ class Adherent extends CommonObject
|
||||
dol_syslog(__METHOD__.' - Process delta = '.$daysbeforeend, LOG_DEBUG);
|
||||
|
||||
if (!is_numeric($daysbeforeend)) {
|
||||
$blockingerrormsg = "Value for delta is not a positive or negative numeric";
|
||||
$blockingerrormsg = "Value for delta is not a numeric value";
|
||||
$nbko++;
|
||||
break;
|
||||
}
|
||||
|
||||
$tmp = dol_getdate($now);
|
||||
$datetosearchfor = dol_time_plus_duree(dol_mktime(0, 0, 0, $tmp['mon'], $tmp['mday'], $tmp['year']), $daysbeforeend, 'd');
|
||||
$datetosearchfor = dol_time_plus_duree(dol_mktime(0, 0, 0, $tmp['mon'], $tmp['mday'], $tmp['year'], 'tzserver'), $daysbeforeend, 'd');
|
||||
|
||||
$sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'adherent';
|
||||
$sql .= " WHERE entity = ".$conf->entity; // Do not use getEntity('adherent').")" here, we want the batch to be on its entity only;
|
||||
$sql .= " WHERE entity = ".((int) $conf->entity); // Do not use getEntity('adherent').")" here, we want the batch to be on its entity only;
|
||||
$sql .= " AND datefin = '".$this->db->idate($datetosearchfor)."'";
|
||||
//$sql .= " LIMIT 10000";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
@ -2970,7 +3001,7 @@ class Adherent extends CommonObject
|
||||
dol_syslog("sendReminderForExpiredSubscription Language for member id ".$adherent->id." set to ".$outputlangs->defaultlang." mysoc->default_lang=".$mysoc->default_lang);
|
||||
|
||||
$arraydefaultmessage = null;
|
||||
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_REMIND_EXPIRATION;
|
||||
$labeltouse = getDolGlobalString('ADHERENT_EMAIL_TEMPLATE_REMIND_EXPIRATION');
|
||||
|
||||
if (!empty($labeltouse)) {
|
||||
$arraydefaultmessage = $formmail->getEMailTemplate($this->db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
|
||||
@ -2994,7 +3025,7 @@ class Adherent extends CommonObject
|
||||
$result = $cmail->sendfile();
|
||||
if (!$result) {
|
||||
$error++;
|
||||
$this->error = $cmail->error;
|
||||
$this->error .= $cmail->error.' ';
|
||||
if (!is_null($cmail->errors)) {
|
||||
$this->errors += $cmail->errors;
|
||||
}
|
||||
@ -3012,8 +3043,7 @@ class Adherent extends CommonObject
|
||||
$extraparams = '';
|
||||
|
||||
$actionmsg = '';
|
||||
$actionmsg2 = $langs->transnoentities('MailSentBy').' '.CMailFile::getValidAddress($from, 4, 0, 1).' '.$langs->transnoentities('To').' '.
|
||||
CMailFile::getValidAddress($sendto, 4, 0, 1);
|
||||
$actionmsg2 = $langs->transnoentities('MailSentBy').' '.CMailFile::getValidAddress($from, 4, 0, 1).' '.$langs->transnoentities('To').' '.CMailFile::getValidAddress($sendto, 4, 0, 1);
|
||||
if ($message) {
|
||||
$actionmsg = $langs->transnoentities('MailFrom').': '.dol_escape_htmltag($from);
|
||||
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTo').': '.dol_escape_htmltag($sendto));
|
||||
@ -3060,7 +3090,10 @@ class Adherent extends CommonObject
|
||||
$actioncomm->create($user);
|
||||
}
|
||||
} else {
|
||||
$blockingerrormsg = "Can't find email template, defined into member module setup, to use for reminding";
|
||||
//$blockingerrormsg = "Can't find email template with label=".$labeltouse.", to use for the reminding email";
|
||||
|
||||
$error++;
|
||||
$this->error .= "Can't find email template with label=".$labeltouse.", to use for the reminding email ";
|
||||
|
||||
$nbko++;
|
||||
$listofmembersko[$adherent->id] = $adherent->id;
|
||||
@ -3102,7 +3135,7 @@ class Adherent extends CommonObject
|
||||
if ($listofids) {
|
||||
$listofids .= ']';
|
||||
}
|
||||
$this->output .= $listofids;
|
||||
$this->output .= ' ids='.$listofids;
|
||||
}
|
||||
if ($nbko) {
|
||||
$this->output .= ' - Canceled for '.$nbko.' member (no email or email sending error)';
|
||||
@ -3130,6 +3163,6 @@ class Adherent extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return $nbko;
|
||||
}
|
||||
}
|
||||
|
||||
@ -480,11 +480,11 @@ class Members extends DolibarrApi
|
||||
/**
|
||||
* Add a subscription for a member
|
||||
*
|
||||
* @param int $id ID of member
|
||||
* @param int $start_date Start date {@from body} {@type timestamp}
|
||||
* @param int $end_date End date {@from body} {@type timestamp}
|
||||
* @param float $amount Amount (may be 0) {@from body}
|
||||
* @param string $label Label {@from body}
|
||||
* @param int $id ID of member
|
||||
* @param string $start_date Start date {@from body} {@type timestamp}
|
||||
* @param string $end_date End date {@from body} {@type timestamp}
|
||||
* @param float $amount Amount (may be 0) {@from body}
|
||||
* @param string $label Label {@from body}
|
||||
* @return int ID of subscription
|
||||
*
|
||||
* @url POST {id}/subscriptions
|
||||
|
||||
@ -76,14 +76,14 @@ if ($id > 0 || !empty($ref)) {
|
||||
$result = $object->fetch($id, $ref);
|
||||
|
||||
// Define variables to know what current user can do on users
|
||||
$canadduser = ($user->admin || $user->rights->user->user->creer);
|
||||
$canadduser = ($user->admin || $user->hasRight('user', 'user', 'creer'));
|
||||
// Define variables to know what current user can do on properties of user linked to edited member
|
||||
if ($object->user_id) {
|
||||
// $User is the user who edits, $object->user_id is the id of the related user in the edited member
|
||||
$caneditfielduser = ((($user->id == $object->user_id) && $user->rights->user->self->creer)
|
||||
|| (($user->id != $object->user_id) && $user->rights->user->user->creer));
|
||||
$caneditpassworduser = ((($user->id == $object->user_id) && $user->rights->user->self->password)
|
||||
|| (($user->id != $object->user_id) && $user->rights->user->user->password));
|
||||
$caneditfielduser = ((($user->id == $object->user_id) && $$user->hasRight('user', 'self', 'creer'))
|
||||
|| (($user->id != $object->user_id) && $user->hasRight('user', 'user', 'creer')));
|
||||
$caneditpassworduser = ((($user->id == $object->user_id) && $user->hasRight('user', 'self', 'password'))
|
||||
|| (($user->id != $object->user_id) && $user->hasRight('user', 'user', 'password')));
|
||||
}
|
||||
}
|
||||
|
||||
@ -158,13 +158,12 @@ if ($id > 0) {
|
||||
}
|
||||
|
||||
// Type
|
||||
print '<tr><td>'.$langs->trans("Type").'</td><td class="valeur">'.$membert->getNomUrl(1)."</td></tr>\n";
|
||||
print '<tr><td>'.$langs->trans("Type").'</td>';
|
||||
print '<td class="valeur">'.$membert->getNomUrl(1)."</td></tr>\n";
|
||||
|
||||
// Morphy
|
||||
print '<tr><td class="titlefield">'.$langs->trans("MemberNature").'</td><td class="valeur" >'.$object->getmorphylib().'</td>';
|
||||
/*print '<td rowspan="'.$rowspan.'" class="center" valign="middle" width="25%">';
|
||||
print $form->showphoto('memberphoto',$object);
|
||||
print '</td>';*/
|
||||
print '<tr><td class="titlefield">'.$langs->trans("MemberNature").'</td>';
|
||||
print '<td class="valeur" >'.$object->getmorphylib('', 1).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Company
|
||||
|
||||
@ -87,7 +87,9 @@ print load_fiche_titre($langs->trans("MembersArea"), $resultboxes['selectboxlist
|
||||
|
||||
$MembersValidated = array();
|
||||
$MembersToValidate = array();
|
||||
$MembersWaitingSubscription = array();
|
||||
$MembersUpToDate = array();
|
||||
$MembersExpired = array();
|
||||
$MembersExcluded = array();
|
||||
$MembersResiliated = array();
|
||||
|
||||
@ -137,13 +139,36 @@ if ($resql) {
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
// Members waiting subscription
|
||||
$sql = "SELECT count(*) as somme , d.fk_adherent_type";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
|
||||
$sql .= " WHERE d.entity IN (".getEntity('adherent').")";
|
||||
$sql .= " AND d.statut = 1"; // validated
|
||||
$sql .= " AND (d.datefin IS NULL AND t.subscription = '1')";
|
||||
$sql .= " AND t.rowid = d.fk_adherent_type";
|
||||
$sql .= " GROUP BY d.fk_adherent_type";
|
||||
|
||||
dol_syslog("index.php::select nb of uptodate members by type", LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$objp = $db->fetch_object($resql);
|
||||
$MembersWaitingSubscription[$objp->fk_adherent_type] = $objp->somme;
|
||||
$i++;
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
|
||||
// Members up to date list
|
||||
// current rule: uptodate = the end date is in future whatever is type
|
||||
// current rule: uptodate = the end date is in future or no subcription required
|
||||
// old rule: uptodate = if type does not need payment, that end date is null, if type need payment that end date is in future)
|
||||
$sql = "SELECT count(*) as somme , d.fk_adherent_type";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
|
||||
$sql .= " WHERE d.entity IN (".getEntity('adherent').")";
|
||||
$sql .= " AND d.statut = 1 AND (d.datefin >= '".$db->idate($now)."' OR t.subscription = 0)";
|
||||
$sql .= " AND d.statut = 1"; // validated
|
||||
$sql .= " AND (d.datefin >= '".$db->idate($now)."' OR t.subscription = '0')"; // end date in future
|
||||
$sql .= " AND t.rowid = d.fk_adherent_type";
|
||||
$sql .= " GROUP BY d.fk_adherent_type";
|
||||
|
||||
@ -160,6 +185,28 @@ if ($resql) {
|
||||
$db->free($resql);
|
||||
}
|
||||
|
||||
// Members expired list
|
||||
$sql = "SELECT count(*) as somme , d.fk_adherent_type";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
|
||||
$sql .= " WHERE d.entity IN (".getEntity('adherent').")";
|
||||
$sql .= " AND d.statut = 1"; // validated
|
||||
$sql .= " AND (d.datefin < '".$db->idate($now)."' AND t.subscription = '1')";
|
||||
$sql .= " AND t.rowid = d.fk_adherent_type";
|
||||
$sql .= " GROUP BY d.fk_adherent_type";
|
||||
|
||||
dol_syslog("index.php::select nb of uptodate members by type", LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$objp = $db->fetch_object($resql);
|
||||
$MembersExpired[$objp->fk_adherent_type] = $objp->somme;
|
||||
$i++;
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
|
||||
/*
|
||||
* Statistics
|
||||
*/
|
||||
@ -172,8 +219,9 @@ if ($conf->use_javascript_ajax) {
|
||||
$boxgraph .='<tr><td class="center" colspan="2">';
|
||||
|
||||
$SumToValidate = 0;
|
||||
$SumValidated = 0;
|
||||
$SumWaitingSubscription = 0;
|
||||
$SumUpToDate = 0;
|
||||
$SumExpired = 0;
|
||||
$SumResiliated = 0;
|
||||
$SumExcluded = 0;
|
||||
|
||||
@ -182,23 +230,26 @@ if ($conf->use_javascript_ajax) {
|
||||
$i = 0;
|
||||
foreach ($AdherentType as $key => $adhtype) {
|
||||
$dataval['draft'][] = array($i, isset($MembersToValidate[$key]) ? $MembersToValidate[$key] : 0);
|
||||
$dataval['waitingsubscription'][] = array($i, isset($MembersWaitingSubscription[$key]) ? $MembersWaitingSubscription[$key] : 0);
|
||||
$dataval['uptodate'][] = array($i, isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0);
|
||||
$dataval['notuptodate'][] = array($i, isset($MembersValidated[$key]) ? $MembersValidated[$key] - (isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0) : 0);
|
||||
$dataval['expired'][] = array($i, isset($MembersExpired[$key]) ? $MembersExpired[$key] : 0);
|
||||
$dataval['excluded'][] = array($i, isset($MembersExcluded[$key]) ? $MembersExcluded[$key] : 0);
|
||||
$dataval['resiliated'][] = array($i, isset($MembersResiliated[$key]) ? $MembersResiliated[$key] : 0);
|
||||
|
||||
$SumToValidate += isset($MembersToValidate[$key]) ? $MembersToValidate[$key] : 0;
|
||||
$SumValidated += isset($MembersValidated[$key]) ? $MembersValidated[$key] - (isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0) : 0;
|
||||
$SumWaitingSubscription += isset($MembersWaitingSubscription[$key]) ? $MembersWaitingSubscription[$key] : 0;
|
||||
$SumUpToDate += isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0;
|
||||
$SumExpired += isset($MembersExpired[$key]) ? $MembersExpired[$key] : 0;
|
||||
$SumExcluded += isset($MembersExcluded[$key]) ? $MembersExcluded [$key] : 0;
|
||||
$SumResiliated += isset($MembersResiliated[$key]) ? $MembersResiliated[$key] : 0;
|
||||
$i++;
|
||||
}
|
||||
$total = $SumToValidate + $SumValidated + $SumUpToDate + $SumExcluded + $SumResiliated;
|
||||
$total = $SumToValidate + $SumWaitingSubscription + $SumUpToDate + $SumExpired + $SumExcluded + $SumResiliated;
|
||||
$dataseries = array();
|
||||
$dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusToValid"), round($SumToValidate)); // Draft, not yet validated
|
||||
$dataseries[] = array($langs->transnoentitiesnoconv("WaitingSubscription"), round($SumWaitingSubscription));
|
||||
$dataseries[] = array($langs->transnoentitiesnoconv("UpToDate"), round($SumUpToDate));
|
||||
$dataseries[] = array($langs->transnoentitiesnoconv("OutOfDate"), round($SumValidated));
|
||||
$dataseries[] = array($langs->transnoentitiesnoconv("OutOfDate"), round($SumExpired));
|
||||
$dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusExcluded"), round($SumExcluded));
|
||||
$dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusResiliated"), round($SumResiliated));
|
||||
|
||||
@ -207,7 +258,7 @@ if ($conf->use_javascript_ajax) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||
$dolgraph = new DolGraph();
|
||||
$dolgraph->SetData($dataseries);
|
||||
$dolgraph->SetDataColor(array('-'.$badgeStatus0, $badgeStatus4, '-'.$badgeStatus1, '-'.$badgeStatus8, $badgeStatus6));
|
||||
$dolgraph->SetDataColor(array('-'.$badgeStatus0, $badgeStatus1, $badgeStatus4, $badgeStatus8, '-'.$badgeStatus8, $badgeStatus6));
|
||||
$dolgraph->setShowLegend(2);
|
||||
$dolgraph->setShowPercent(1);
|
||||
$dolgraph->SetType(array('pie'));
|
||||
@ -217,7 +268,7 @@ if ($conf->use_javascript_ajax) {
|
||||
|
||||
$boxgraph .= '</td></tr>';
|
||||
$boxgraph .= '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td class="right">';
|
||||
$boxgraph .= $SumToValidate + $SumValidated + $SumUpToDate + $SumExcluded + $SumResiliated;
|
||||
$boxgraph .= $SumToValidate + $SumWaitingSubscription + $SumUpToDate + $SumExpired + $SumExcluded + $SumResiliated;
|
||||
$boxgraph .= '</td></tr>';
|
||||
$boxgraph .= '</table>';
|
||||
$boxgraph .= '</div>';
|
||||
|
||||
@ -142,31 +142,31 @@ if ($db->type == 'pgsql') {
|
||||
unset($fieldstosearchall['d.rowid']);
|
||||
}
|
||||
$arrayfields = array(
|
||||
'd.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
|
||||
'd.civility'=>array('label'=>$langs->trans("Civility"), 'checked'=>0),
|
||||
'd.lastname'=>array('label'=>$langs->trans("Lastname"), 'checked'=>1),
|
||||
'd.firstname'=>array('label'=>$langs->trans("Firstname"), 'checked'=>1),
|
||||
'd.gender'=>array('label'=>$langs->trans("Gender"), 'checked'=>0),
|
||||
'd.company'=>array('label'=>$langs->trans("Company"), 'checked'=>1),
|
||||
'd.login'=>array('label'=>$langs->trans("Login"), 'checked'=>1),
|
||||
'd.morphy'=>array('label'=>$langs->trans("MemberNature"), 'checked'=>1),
|
||||
't.libelle'=>array('label'=>$langs->trans("Type"), 'checked'=>1),
|
||||
'd.email'=>array('label'=>$langs->trans("Email"), 'checked'=>1),
|
||||
'd.address'=>array('label'=>$langs->trans("Address"), 'checked'=>0),
|
||||
'd.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>0),
|
||||
'd.town'=>array('label'=>$langs->trans("Town"), 'checked'=>0),
|
||||
'd.phone'=>array('label'=>$langs->trans("Phone"), 'checked'=>0),
|
||||
'd.phone_perso'=>array('label'=>$langs->trans("PhonePerso"), 'checked'=>0),
|
||||
'd.phone_mobile'=>array('label'=>$langs->trans("PhoneMobile"), 'checked'=>0),
|
||||
'state.nom'=>array('label'=>$langs->trans("State"), 'checked'=>0),
|
||||
'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0),
|
||||
/*'d.note_public'=>array('label'=>$langs->trans("NotePublic"), 'checked'=>0),
|
||||
'd.note_private'=>array('label'=>$langs->trans("NotePrivate"), 'checked'=>0),*/
|
||||
'd.datefin'=>array('label'=>$langs->trans("EndSubscription"), 'checked'=>1, 'position'=>500),
|
||||
'd.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
|
||||
'd.birth'=>array('label'=>$langs->trans("Birthday"), 'checked'=>0, 'position'=>500),
|
||||
'd.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
|
||||
'd.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
|
||||
'd.ref'=>array('label'=>"Ref", 'checked'=>1),
|
||||
'd.civility'=>array('label'=>"Civility", 'checked'=>0),
|
||||
'd.lastname'=>array('label'=>"Lastname", 'checked'=>1),
|
||||
'd.firstname'=>array('label'=>"Firstname", 'checked'=>1),
|
||||
'd.gender'=>array('label'=>"Gender", 'checked'=>0),
|
||||
'd.company'=>array('label'=>"Company", 'checked'=>1),
|
||||
'd.login'=>array('label'=>"Login", 'checked'=>1),
|
||||
'd.morphy'=>array('label'=>"MemberNature", 'checked'=>1),
|
||||
't.libelle'=>array('label'=>"Type", 'checked'=>1),
|
||||
'd.email'=>array('label'=>"Email", 'checked'=>1),
|
||||
'd.address'=>array('label'=>"Address", 'checked'=>0),
|
||||
'd.zip'=>array('label'=>"Zip", 'checked'=>0),
|
||||
'd.town'=>array('label'=>"Town", 'checked'=>0),
|
||||
'd.phone'=>array('label'=>"Phone", 'checked'=>0),
|
||||
'd.phone_perso'=>array('label'=>"PhonePerso", 'checked'=>0),
|
||||
'd.phone_mobile'=>array('label'=>"PhoneMobile", 'checked'=>0),
|
||||
'state.nom'=>array('label'=>"State", 'checked'=>0),
|
||||
'country.code_iso'=>array('label'=>"Country", 'checked'=>0),
|
||||
/*'d.note_public'=>array('label'=>"NotePublic", 'checked'=>0),
|
||||
'd.note_private'=>array('label'=>"NotePrivate", 'checked'=>0),*/
|
||||
'd.datefin'=>array('label'=>"EndSubscription", 'checked'=>1, 'position'=>500),
|
||||
'd.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
|
||||
'd.birth'=>array('label'=>"Birthday", 'checked'=>0, 'position'=>500),
|
||||
'd.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
|
||||
'd.statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
|
||||
'd.import_key'=>array('label'=>"ImportId", 'checked'=>0, 'position'=>1100),
|
||||
);
|
||||
// Extra fields
|
||||
@ -300,8 +300,8 @@ if (empty($reshook)) {
|
||||
// Mass actions
|
||||
$objectclass = 'Adherent';
|
||||
$objectlabel = 'Members';
|
||||
$permissiontoread = $user->rights->adherent->lire;
|
||||
$permissiontodelete = $user->rights->adherent->supprimer;
|
||||
$permissiontoread = $user->hasRight('adherent', 'lire');
|
||||
$permissiontodelete = $user->hasRight('adherent', 'supprimer');
|
||||
$permissiontoadd = $user->hasRight('adherent', 'creer');
|
||||
$uploaddir = $conf->adherent->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
@ -350,27 +350,47 @@ $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d";
|
||||
if (!empty($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (d.rowid = ef.fk_object)";
|
||||
}
|
||||
if ((!empty($search_categ) && ($search_categ > 0 || $search_categ == -2)) || !empty($catid)) {
|
||||
// We need this table joined to the select in order to filter by categ
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_member as cm ON d.rowid = cm.fk_member";
|
||||
}
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = d.country)";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = d.state_id)";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on (s.rowid = d.fk_soc)";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."adherent_type as t";
|
||||
$sql .= " WHERE d.fk_adherent_type = t.rowid";
|
||||
if ($catid > 0) {
|
||||
$sql .= " AND cm.fk_categorie = ".((int) $catid);
|
||||
|
||||
if ($catid && empty($search_categ)) {
|
||||
$search_categ = $catid;
|
||||
}
|
||||
if ($catid == -2) {
|
||||
$sql .= " AND cm.fk_categorie IS NULL";
|
||||
}
|
||||
if ($search_categ > 0) {
|
||||
$sql .= " AND cm.fk_categorie = ".((int) $search_categ);
|
||||
}
|
||||
if ($search_categ == -2) {
|
||||
$sql .= " AND cm.fk_categorie IS NULL";
|
||||
|
||||
$searchCategoryContactList = $search_categ ? array($search_categ) : array();
|
||||
$searchCategoryContactOperator = 0;
|
||||
// Search for tag/category ($searchCategoryContactList is an array of ID)
|
||||
if (!empty($searchCategoryContactList)) {
|
||||
$searchCategoryContactSqlList = array();
|
||||
$listofcategoryid = '';
|
||||
foreach ($searchCategoryContactList as $searchCategoryContact) {
|
||||
if (intval($searchCategoryContact) == -2) {
|
||||
$searchCategoryContactSqlList[] = "NOT EXISTS (SELECT ck.fk_categorie FROM ".MAIN_DB_PREFIX."categorie_member as ck WHERE d.rowid = ck.fk_member)";
|
||||
} elseif (intval($searchCategoryContact) > 0) {
|
||||
if ($searchCategoryContactOperator == 0) {
|
||||
$searchCategoryContactSqlList[] = " EXISTS (SELECT ck.fk_categorie FROM ".MAIN_DB_PREFIX."categorie_member as ck WHERE d.rowid = ck.fk_member AND ck.fk_categorie = ".((int) $searchCategoryContact).")";
|
||||
} else {
|
||||
$listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryContact);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($listofcategoryid) {
|
||||
$searchCategoryContactSqlList[] = " EXISTS (SELECT ck.fk_categorie FROM ".MAIN_DB_PREFIX."categorie_member as ck WHERE d.rowid = ck.fk_member AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid)."))";
|
||||
}
|
||||
if ($searchCategoryContactOperator == 1) {
|
||||
if (!empty($searchCategoryContactSqlList)) {
|
||||
$sql .= " AND (".implode(' OR ', $searchCategoryContactSqlList).")";
|
||||
}
|
||||
} else {
|
||||
if (!empty($searchCategoryContactSqlList)) {
|
||||
$sql .= " AND (".implode(' AND ', $searchCategoryContactSqlList).")";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sql .= " AND d.entity IN (".getEntity('adherent').")";
|
||||
if ($sall) {
|
||||
$sql .= natural_search(array_keys($fieldstosearchall), $sall);
|
||||
@ -379,7 +399,10 @@ if ($search_type > 0) {
|
||||
$sql .= " AND t.rowid=".((int) $search_type);
|
||||
}
|
||||
if ($search_filter == 'withoutsubscription') {
|
||||
$sql .= " AND (datefin IS NULL OR t.subscription = '0')";
|
||||
$sql .= " AND (datefin IS NULL)";
|
||||
}
|
||||
if ($search_filter == 'waitingsubscription') {
|
||||
$sql .= " AND (datefin IS NULL AND t.subscription = '1')";
|
||||
}
|
||||
if ($search_filter == 'uptodate') {
|
||||
$sql .= " AND (datefin >= '".$db->idate($now)."' OR t.subscription = '0')";
|
||||
@ -391,7 +414,7 @@ if ($search_status != '') {
|
||||
// Peut valoir un nombre ou liste de nombre separes par virgules
|
||||
$sql .= " AND d.statut in (".$db->sanitize($db->escape($search_status)).")";
|
||||
}
|
||||
if ($search_morphy != '') {
|
||||
if ($search_morphy != '' && $search_morphy != '-1') {
|
||||
$sql .= natural_search("d.morphy", $search_morphy);
|
||||
}
|
||||
if ($search_ref) {
|
||||
@ -498,35 +521,6 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $
|
||||
$help_url = 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros';
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
if (GETPOSTISSET("search_status")) {
|
||||
if ($search_status == '-1,1') { // TODO : check this test as -1 == Adherent::STATUS_DRAFT and -2 == Adherent::STATUS_EXLCUDED
|
||||
$title = $langs->trans("MembersListQualified");
|
||||
}
|
||||
if ($search_status == Adherent::STATUS_DRAFT) {
|
||||
$title = $langs->trans("MembersListToValid");
|
||||
}
|
||||
if ($search_status == Adherent::STATUS_VALIDATED && $filter == '') {
|
||||
$title = $langs->trans("MenuMembersValidated");
|
||||
}
|
||||
if ($search_status == Adherent::STATUS_VALIDATED && $filter == 'withoutsubscription') {
|
||||
$title = $langs->trans("MembersWithSubscriptionToReceive");
|
||||
}
|
||||
if ($search_status == Adherent::STATUS_VALIDATED && $filter == 'uptodate') {
|
||||
$title = $langs->trans("MembersListUpToDate");
|
||||
}
|
||||
if ($search_status == Adherent::STATUS_VALIDATED && $filter == 'outofdate') {
|
||||
$title = $langs->trans("MembersListNotUpToDate");
|
||||
}
|
||||
if ((string) $search_status == (string) Adherent::STATUS_RESILIATED) { // The cast to string is required to have test false when search_status is ''
|
||||
$title = $langs->trans("MembersListResiliated");
|
||||
}
|
||||
if ($search_status == Adherent::STATUS_EXCLUDED) {
|
||||
$title = $langs->trans("MembersListExcluded");
|
||||
}
|
||||
} elseif ($action == 'search') {
|
||||
$title = $langs->trans("MembersListQualified");
|
||||
}
|
||||
|
||||
if ($search_type > 0) {
|
||||
$membertype = new AdherentType($db);
|
||||
$result = $membertype->fetch($search_type);
|
||||
@ -620,13 +614,13 @@ $arrayofmassactions = array(
|
||||
if ($user->hasRight('adherent', 'creer')) {
|
||||
$arrayofmassactions['close'] = img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Resiliate");
|
||||
}
|
||||
if ($user->rights->adherent->supprimer) {
|
||||
if ($user->hasRight('adherent', 'supprimer')) {
|
||||
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
|
||||
}
|
||||
if (isModEnabled('category') && $user->rights->adherent->creer) {
|
||||
if (isModEnabled('category') && $user->hasRight('adherent', 'creer')) {
|
||||
$arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag");
|
||||
}
|
||||
if ($user->hasRight('adherent', 'creer') && $user->rights->user->user->creer) {
|
||||
if ($user->hasRight('adherent', 'creer') && $user->hasRight('user', 'user', 'creer')) {
|
||||
$arrayofmassactions['createexternaluser'] = img_picto('', 'user', 'class="pictofixedwidth"').$langs->trans("CreateExternalUser");
|
||||
}
|
||||
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete', 'preaffecttag'))) {
|
||||
@ -667,10 +661,10 @@ if ($sall) {
|
||||
|
||||
// Filter on categories
|
||||
$moreforfilter = '';
|
||||
if (isModEnabled('categorie') && $user->rights->categorie->lire) {
|
||||
if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$moreforfilter .= img_picto($langs->trans('Categories'), 'category', 'class="pictofixedlength"').$formother->select_categories(Categorie::TYPE_MEMBER, $search_categ, 'search_categ', 1);
|
||||
$moreforfilter .= img_picto($langs->trans('Categories'), 'category', 'class="pictofixedlength"').$formother->select_categories(Categorie::TYPE_MEMBER, $search_categ, 'search_categ', 1, $langs->trans("MembersCategoriesShort"));
|
||||
$moreforfilter .= '</div>';
|
||||
}
|
||||
$parameters = array();
|
||||
@ -741,10 +735,11 @@ if (!empty($arrayfields['d.login']['checked'])) {
|
||||
print '<td class="liste_titre left">';
|
||||
print '<input class="flat maxwidth75imp" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).'"></td>';
|
||||
}
|
||||
// Nature
|
||||
if (!empty($arrayfields['d.morphy']['checked'])) {
|
||||
print '<td class="liste_titre left">';
|
||||
print '<td class="liste_titre center">';
|
||||
$arraymorphy = array('mor'=>$langs->trans("Moral"), 'phy'=>$langs->trans("Physical"));
|
||||
print $form->selectarray('search_morphy', $arraymorphy, $search_morphy, 1);
|
||||
print $form->selectarray('search_morphy', $arraymorphy, $search_morphy, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100');
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['t.libelle']['checked'])) {
|
||||
@ -805,7 +800,8 @@ if (!empty($arrayfields['d.email']['checked'])) {
|
||||
// End of subscription date
|
||||
if (!empty($arrayfields['d.datefin']['checked'])) {
|
||||
print '<td class="liste_titre center">';
|
||||
$selectarray = array('-1'=>'', 'withoutsubscription'=>$langs->trans("WithoutSubscription"), 'uptodate'=>$langs->trans("UpToDate"), 'outofdate'=>$langs->trans("OutOfDate"));
|
||||
//$selectarray = array('-1'=>'', 'withoutsubscription'=>$langs->trans("WithoutSubscription"), 'uptodate'=>$langs->trans("UpToDate"), 'outofdate'=>$langs->trans("OutOfDate"));
|
||||
$selectarray = array('-1'=>'', 'waitingsubscription'=>$langs->trans("WaitingSubscription"), 'uptodate'=>$langs->trans("UpToDate"), 'outofdate'=>$langs->trans("OutOfDate"));
|
||||
print $form->selectarray('search_filter', $selectarray, $search_filter);
|
||||
print '</td>';
|
||||
}
|
||||
@ -919,7 +915,7 @@ if (!empty($arrayfields['d.email']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['d.email']['label'], $_SERVER["PHP_SELF"], 'd.email', '', $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['d.datefin']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['d.datefin']['label'], $_SERVER["PHP_SELF"], 'd.datefin', '', $param, '', $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre($arrayfields['d.datefin']['label'], $_SERVER["PHP_SELF"], 'd.datefin,t.subscription', '', $param, '', $sortfield, $sortorder, 'center ');
|
||||
}
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||
@ -938,7 +934,7 @@ if (!empty($arrayfields['d.tms']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['d.tms']['label'], $_SERVER["PHP_SELF"], "d.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['d.statut']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['d.statut']['label'], $_SERVER["PHP_SELF"], "d.statut", "", $param, 'class="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($arrayfields['d.statut']['label'], $_SERVER["PHP_SELF"], "d.statut,t.subscription,d.datefin", "", $param, 'class="right"', $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['d.import_key']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['d.import_key']['label'], $_SERVER["PHP_SELF"], "d.import_key", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
@ -955,6 +951,7 @@ while ($i < min($num, $limit)) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$datefin = $db->jdate($obj->datefin);
|
||||
|
||||
$memberstatic->id = $obj->rowid;
|
||||
$memberstatic->ref = $obj->ref;
|
||||
$memberstatic->civility_id = $obj->civility;
|
||||
@ -970,6 +967,7 @@ while ($i < min($num, $limit)) {
|
||||
$memberstatic->morphy = $obj->morphy;
|
||||
$memberstatic->note_public = $obj->note_public;
|
||||
$memberstatic->note_private = $obj->note_private;
|
||||
$memberstatic->need_subscription = $obj->subscription;
|
||||
|
||||
if (!empty($obj->fk_soc)) {
|
||||
$memberstatic->fetch_thirdparty();
|
||||
@ -1070,14 +1068,7 @@ while ($i < min($num, $limit)) {
|
||||
// Nature (Moral/Physical)
|
||||
if (!empty($arrayfields['d.morphy']['checked'])) {
|
||||
print '<td class="center">';
|
||||
$s = '';
|
||||
if ($obj->morphy == 'phy') {
|
||||
$s .= '<span class="customer-back" title="'.$langs->trans("Physical").'">'.dol_substr($langs->trans("Physical"), 0, 1).'</span>';
|
||||
}
|
||||
if ($obj->morphy == 'mor') {
|
||||
$s .= '<span class="vendor-back" title="'.$langs->trans("Moral").'">'.dol_substr($langs->trans("Moral"), 0, 1).'</span>';
|
||||
}
|
||||
print $s;
|
||||
print $memberstatic->getmorphylib('', 2);
|
||||
print "</td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
@ -1183,7 +1174,7 @@ while ($i < min($num, $limit)) {
|
||||
}
|
||||
} else {
|
||||
if (!empty($obj->subscription)) {
|
||||
print $langs->trans("SubscriptionNotReceived");
|
||||
print '<span class="opacitymedium">'.$langs->trans("SubscriptionNotReceived").'</span>';
|
||||
if ($obj->statut > 0) {
|
||||
print " ".img_warning();
|
||||
}
|
||||
|
||||
@ -59,14 +59,14 @@ if ($id > 0 || !empty($ref)) {
|
||||
$result = $object->fetch($id, $ref);
|
||||
|
||||
// Define variables to know what current user can do on users
|
||||
$canadduser = ($user->admin || $user->rights->user->user->creer);
|
||||
$canadduser = ($user->admin || $user->hasRight('user', 'user', 'creer'));
|
||||
// Define variables to know what current user can do on properties of user linked to edited member
|
||||
if ($object->user_id) {
|
||||
// $User is the user who edits, $object->user_id is the id of the related user in the edited member
|
||||
$caneditfielduser = ((($user->id == $object->user_id) && $user->rights->user->self->creer)
|
||||
|| (($user->id != $object->user_id) && $user->rights->user->user->creer));
|
||||
$caneditpassworduser = ((($user->id == $object->user_id) && $user->rights->user->self->password)
|
||||
|| (($user->id != $object->user_id) && $user->rights->user->user->password));
|
||||
$caneditfielduser = ((($user->id == $object->user_id) && $user->hasRight('user', 'self', 'creer'))
|
||||
|| (($user->id != $object->user_id) && $user->hasRight('user', 'user', 'creer')));
|
||||
$caneditpassworduser = ((($user->id == $object->user_id) && $user->hasRight('user', 'self', 'password'))
|
||||
|| (($user->id != $object->user_id) && $user->hasRight('user', 'user', 'password')));
|
||||
}
|
||||
}
|
||||
|
||||
@ -133,13 +133,12 @@ if ($id) {
|
||||
}
|
||||
|
||||
// Type
|
||||
print '<tr><td>'.$langs->trans("Type").'</td><td class="valeur">'.$adht->getNomUrl(1)."</td></tr>\n";
|
||||
print '<tr><td>'.$langs->trans("Type").'</td>';
|
||||
print '<td class="valeur">'.$adht->getNomUrl(1)."</td></tr>\n";
|
||||
|
||||
// Morphy
|
||||
print '<tr><td class="titlefield">'.$langs->trans("MemberNature").'</td><td class="valeur" >'.$object->getmorphylib().'</td>';
|
||||
/*print '<td rowspan="'.$rowspan.'" class="center" valign="middle" width="25%">';
|
||||
print $form->showphoto('memberphoto',$member);
|
||||
print '</td>';*/
|
||||
print '<tr><td class="titlefield">'.$langs->trans("MemberNature").'</td>';
|
||||
print '<td class="valeur" >'.$object->getmorphylib('', 1).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Company
|
||||
|
||||
@ -40,7 +40,7 @@ if ($user->socid > 0) {
|
||||
}
|
||||
$result = restrictedArea($user, 'adherent', '', '', 'cotisation');
|
||||
|
||||
$year = strftime("%Y", time());
|
||||
$year = dol_print_date(dol_now('gmt'), "%Y", 'gmt');
|
||||
$startyear = $year - (empty($conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS) ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS)));
|
||||
$endyear = $year;
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@ if ($user->socid > 0) {
|
||||
}
|
||||
$result = restrictedArea($user, 'adherent', '', '', 'cotisation');
|
||||
|
||||
$year = strftime("%Y", time());
|
||||
$year = dol_print_date(dol_now('gmt'), "%Y", 'gmt');
|
||||
$startyear = $year - (empty($conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS) ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS)));
|
||||
$endyear = $year;
|
||||
|
||||
|
||||
@ -47,7 +47,7 @@ if ($user->socid > 0) {
|
||||
}
|
||||
$result = restrictedArea($user, 'adherent', '', '', 'cotisation');
|
||||
|
||||
$year = strftime("%Y", time());
|
||||
$year = dol_print_date(dol_now('gmt'), "%Y", 'gmt');
|
||||
$startyear = $year - (empty($conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS) ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS)));
|
||||
$endyear = $year;
|
||||
|
||||
|
||||
@ -506,10 +506,12 @@ if ($rowid > 0) {
|
||||
}
|
||||
|
||||
// Type
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Type").'</td><td class="valeur">'.$adht->getNomUrl(1)."</td></tr>\n";
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Type").'</td>';
|
||||
print '<td class="valeur">'.$adht->getNomUrl(1)."</td></tr>\n";
|
||||
|
||||
// Morphy
|
||||
print '<tr><td>'.$langs->trans("MemberNature").'</td><td class="valeur" >'.$object->getmorphylib().'</td>';
|
||||
print '<tr><td>'.$langs->trans("MemberNature").'</td>';
|
||||
print '<td class="valeur" >'.$object->getmorphylib('', 1).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Company
|
||||
|
||||
@ -288,7 +288,7 @@ if ($rowid && $action != 'edit') {
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border centpercent">';
|
||||
print '<table class="border centpercent tableforfield">';
|
||||
|
||||
// Member
|
||||
$adh->ref = $adh->getFullName($langs);
|
||||
@ -320,7 +320,7 @@ if ($rowid && $action != 'edit') {
|
||||
print '</tr>';
|
||||
|
||||
// Amount
|
||||
print '<tr><td>'.$langs->trans("Amount").'</td><td class="valeur">'.price($object->amount).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Amount").'</td><td class="valeur"><span class="amount">'.price($object->amount).'</span></td></tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td class="valeur">'.$object->note.'</td></tr>';
|
||||
|
||||
@ -118,7 +118,7 @@ if ($cancel) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'add' && $user->rights->adherent->configurer) {
|
||||
if ($action == 'add' && $user->hasRight('adherent', 'configurer')) {
|
||||
$object->label = trim($label);
|
||||
$object->morphy = trim($morphy);
|
||||
$object->status = (int) $status;
|
||||
@ -145,6 +145,7 @@ if ($action == 'add' && $user->rights->adherent->configurer) {
|
||||
$sql = "SELECT libelle FROM ".MAIN_DB_PREFIX."adherent_type WHERE libelle='".$db->escape($object->label)."'";
|
||||
$sql .= " WHERE entity IN (".getEntity('member_type').")";
|
||||
$result = $db->query($sql);
|
||||
$num = null;
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
}
|
||||
@ -504,19 +505,19 @@ if ($rowid > 0) {
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
// Edit
|
||||
if ($user->rights->adherent->configurer) {
|
||||
if ($user->hasRight('adherent', 'configurer')) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&token='.newToken().'&rowid='.$object->id.'">'.$langs->trans("Modify").'</a></div>';
|
||||
}
|
||||
|
||||
// Add
|
||||
if ($user->rights->adherent->configurer && !empty($object->status)) {
|
||||
if ($user->hasRight('adherent', 'configurer')&& !empty($object->status)) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?action=create&token='.newToken().'&typeid='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?rowid='.$object->id).'">'.$langs->trans("AddMember").'</a></div>';
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NoAddMember")).'">'.$langs->trans("AddMember").'</a></div>';
|
||||
}
|
||||
|
||||
// Delete
|
||||
if ($user->rights->adherent->configurer) {
|
||||
if ($user->hasRight('adherent', 'configurer')) {
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=delete&token='.newToken().'&rowid='.$object->id.'">'.$langs->trans("DeleteType").'</a></div>';
|
||||
}
|
||||
|
||||
@ -720,7 +721,7 @@ if ($rowid > 0) {
|
||||
*/
|
||||
|
||||
// Moral/Physique
|
||||
print "<td>".$adh->getmorphylib($objp->morphy)."</td>\n";
|
||||
print "<td>".$adh->getmorphylib($objp->morphy, 1)."</td>\n";
|
||||
|
||||
// EMail
|
||||
print "<td>".dol_print_email($objp->email, 0, 0, 1)."</td>\n";
|
||||
@ -740,9 +741,9 @@ if ($rowid > 0) {
|
||||
}
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td class="nowrap left">';
|
||||
print '<td class="nowrap center">';
|
||||
if (!empty($objp->subscription)) {
|
||||
print $langs->trans("SubscriptionNotReceived");
|
||||
print '<span class="opacitymedium">'.$langs->trans("SubscriptionNotReceived").'</span>';
|
||||
if ($objp->status > 0) {
|
||||
print " ".img_warning();
|
||||
}
|
||||
@ -757,8 +758,8 @@ if ($rowid > 0) {
|
||||
if ($user->hasRight('adherent', 'creer')) {
|
||||
print '<a class="editfielda marginleftonly" href="card.php?rowid='.$objp->rowid.'&action=edit&token='.newToken().'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?rowid='.$object->id).'">'.img_edit().'</a>';
|
||||
}
|
||||
if ($user->rights->adherent->supprimer) {
|
||||
print '<a class="marginleftonly" href="card.php?rowid='.$objp->rowid.'&action=resign&token='.newToken().'">'.img_picto($langs->trans("Resiliate"), 'disable.png').'</a>';
|
||||
if ($user->hasRight('adherent', 'supprimer')) {
|
||||
print '<a class="marginleftonly" href="card.php?rowid='.$objp->rowid.'&action=resiliate&token='.newToken().'">'.img_picto($langs->trans("Resiliate"), 'disable.png').'</a>';
|
||||
}
|
||||
print "</td>";
|
||||
|
||||
@ -845,7 +846,7 @@ if ($rowid > 0) {
|
||||
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor = new DolEditor('comment', $object->note, '', 280, 'dolibarr_notes', '', false, true, empty($conf->fckeditor->enabled) ? false : $conf->fckeditor->enabled, 15, '90%');
|
||||
$doleditor = new DolEditor('comment', $object->note_public, '', 220, 'dolibarr_notes', '', false, true, empty($conf->fckeditor->enabled) ? false : $conf->fckeditor->enabled, 15, '90%');
|
||||
$doleditor->Create();
|
||||
print "</td></tr>";
|
||||
|
||||
|
||||
@ -190,7 +190,7 @@ print dol_get_fiche_end();
|
||||
print "\n<div class=\"tabsAction\">\n";
|
||||
|
||||
if ($action == '') {
|
||||
if ($user->rights->produit->creer || $user->rights->service->creer) {
|
||||
if ($user->hasRight('produit', 'creer') || $user->hasRight('service', 'creer')) {
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/adherents/type_translation.php?action=create&token='.newToken().'&rowid='.$object->id.'">'.$langs->trans("Add").'</a>';
|
||||
if ($cnt_trans > 0) {
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/adherents/type_translation.php?action=edit&token='.newToken().'&rowid='.$object->id.'">'.$langs->trans("Update").'</a>';
|
||||
@ -226,7 +226,7 @@ if ($action == 'edit') {
|
||||
print '<table class="border centpercent">';
|
||||
print '<tr><td class="tdtop titlefieldcreate fieldrequired">'.$langs->trans('Label').'</td><td><input name="libelle-'.$key.'" class="minwidth300" value="'.dol_escape_htmltag($object->multilangs[$key]["label"]).'"></td></tr>';
|
||||
print '<tr><td class="tdtop">'.$langs->trans('Description').'</td><td>';
|
||||
$doleditor = new DolEditor("desc-$key", $object->multilangs[$key]["description"], '', 160, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_PRODUCTDESC'), ROWS_3, '90%');
|
||||
$doleditor = new DolEditor("desc-$key", $object->multilangs[$key]["description"], '', 160, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_SOCIETE'), ROWS_3, '90%');
|
||||
$doleditor->Create();
|
||||
print '</td></tr>';
|
||||
print '</td></tr>';
|
||||
@ -271,7 +271,7 @@ if ($action == 'edit') {
|
||||
* Form to add a new translation
|
||||
*/
|
||||
|
||||
if ($action == 'create' && $user->rights->adherent->configurer) {
|
||||
if ($action == 'create' && $user->hasRight('adherent', 'configurer')) {
|
||||
//WYSIWYG Editor
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
|
||||
@ -289,7 +289,7 @@ if ($action == 'create' && $user->rights->adherent->configurer) {
|
||||
print '</td></tr>';
|
||||
print '<tr><td class="tdtop fieldrequired">'.$langs->trans('Label').'</td><td><input name="libelle" class="minwidth300" value="'.dol_escape_htmltag(GETPOST("libelle", 'alphanohtml')).'"></td></tr>';
|
||||
print '<tr><td class="tdtop">'.$langs->trans('Description').'</td><td>';
|
||||
$doleditor = new DolEditor('desc', '', '', 160, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_PRODUCTDESC'), ROWS_3, '90%');
|
||||
$doleditor = new DolEditor('desc', '', '', 160, 'dolibarr_notes', '', false, true, empty($conf->fckeditor->enabled) ? false : $conf->fckeditor->enabled, ROWS_3, '90%');
|
||||
$doleditor->Create();
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
@ -65,18 +65,21 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
|
||||
* View
|
||||
*/
|
||||
|
||||
$textobject = $langs->transnoentitiesnoconv("Bank");
|
||||
$help_url = '';
|
||||
$page_name = "BankSetupModule";
|
||||
|
||||
llxHeader('', $langs->trans("BankSetupModule"), $help_url);
|
||||
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("BankSetupModule"), $linkback, 'title_setup');
|
||||
print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');
|
||||
|
||||
|
||||
$head = bank_admin_prepare_head(null);
|
||||
|
||||
print dol_get_fiche_head($head, 'attributes', $langs->trans("BankSetupModule"), -1, 'account');
|
||||
print dol_get_fiche_head($head, 'attributes', $langs->trans($page_name), -1, 'account');
|
||||
|
||||
$textobject = $langs->transnoentitiesnoconv("Bank");
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file admin/bankline_extrafields.php
|
||||
* \file htdocs/admin/bankline_extrafields.php
|
||||
* \ingroup bank
|
||||
* \brief Page to setup extra fields of bankline
|
||||
*/
|
||||
@ -41,7 +41,7 @@ $form = new Form($db);
|
||||
|
||||
// List of supported format
|
||||
$tmptype2label = ExtraFields::$type2label;
|
||||
$type2label = [];
|
||||
$type2label = array();
|
||||
foreach ($tmptype2label as $key => $val) {
|
||||
$type2label[$key] = $langs->transnoentitiesnoconv($val);
|
||||
}
|
||||
@ -80,6 +80,8 @@ $head = bank_admin_prepare_head(null);
|
||||
|
||||
print dol_get_fiche_head($head, 'bankline_extrafields', $langs->trans($page_name), -1, 'account');
|
||||
|
||||
$textobject = $langs->transnoentitiesnoconv("BankTransaction");
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
@ -182,7 +182,39 @@ if ($action == 'updateMask') {
|
||||
} else {
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
} elseif ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_ORDER') {
|
||||
} elseif (preg_match('/set_(.*)/', $action, $reg)) {
|
||||
$code = $reg[1];
|
||||
$value = (GETPOST($code) ? GETPOST($code) : 1);
|
||||
|
||||
$res = dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
if ($error) {
|
||||
setEventMessages($langs->trans('Error'), null, 'errors');
|
||||
} else {
|
||||
setEventMessages($langs->trans('SetupSaved'), null, 'mesgs');
|
||||
header("Location: " . $_SERVER["PHP_SELF"]);
|
||||
exit();
|
||||
}
|
||||
} elseif (preg_match('/del_(.*)/', $action, $reg)) {
|
||||
$code = $reg[1];
|
||||
$res = dolibarr_del_const($db, $code, $conf->entity);
|
||||
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
if ($error) {
|
||||
setEventMessages($langs->trans('Error'), null, 'errors');
|
||||
} else {
|
||||
setEventMessages($langs->trans('SetupSaved'), null, 'mesgs');
|
||||
header("Location: " . $_SERVER["PHP_SELF"]);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
/*elseif ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_ORDER') {
|
||||
// Activate ask for payment bank
|
||||
$res = dolibarr_set_const($db, "BANK_ASK_PAYMENT_BANK_DURING_ORDER", $value, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
@ -208,7 +240,8 @@ if ($action == 'updateMask') {
|
||||
} else {
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
}
|
||||
} */
|
||||
|
||||
|
||||
|
||||
/*
|
||||
@ -636,10 +669,18 @@ print '<input class="flat minwidth200" type="text" name="COMMANDE_DRAFT_WATERMAR
|
||||
print '</td><td class="right">';
|
||||
print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Allow external download
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("AllowExternalDownload").'</td>';
|
||||
print '<td class="center" colspan="2">';
|
||||
print ajax_constantonoff('ORDER_ALLOW_EXTERNAL_DOWNLOAD', array(), null, 0, 0, 0, 2, 0, 1);
|
||||
print '</td></tr>';
|
||||
print '</form>';
|
||||
|
||||
/*
|
||||
// Seems to be not so used. So kept hidden for the moment to avoid dangerous options inflation.
|
||||
// TODO Must be implemented by PDF templates
|
||||
// Ask for payment bank during order
|
||||
if ($conf->banque->enabled) {
|
||||
|
||||
|
||||
@ -55,6 +55,8 @@ if (empty($conf->global->CONTRACT_ADDON)) {
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
|
||||
$error=0;
|
||||
|
||||
if ($action == 'updateMask') {
|
||||
$maskconst = GETPOST('maskconstcontract', 'alpha');
|
||||
$maskvalue = GETPOST('maskcontract', 'alpha');
|
||||
@ -128,6 +130,8 @@ if ($action == 'updateMask') {
|
||||
if ($ret > 0) {
|
||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||
}
|
||||
} elseif ($action == 'unsetdoc') {
|
||||
dolibarr_del_const($db, "CONTRACT_ADDON_PDF", $conf->entity);
|
||||
} elseif ($action == 'setmod') {
|
||||
// TODO Verifier si module numerotation choisi peut etre active
|
||||
// par appel methode canBeActivated
|
||||
@ -152,9 +156,45 @@ if ($action == 'updateMask') {
|
||||
} else {
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
} elseif ($action == "allowonlinesign") {
|
||||
if (!dolibarr_set_const($db, "CONTRACT_ALLOW_ONLINESIGN", $value, 0, 'int', $conf->entity)) {
|
||||
$error++;
|
||||
}
|
||||
} elseif (preg_match('/set_(.*)/', $action, $reg)) {
|
||||
$code = $reg[1];
|
||||
$value = (GETPOST($code) ? GETPOST($code) : 1);
|
||||
|
||||
$res = dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
if ($error) {
|
||||
setEventMessages($langs->trans('Error'), null, 'errors');
|
||||
} else {
|
||||
setEventMessages($langs->trans('SetupSaved'), null, 'mesgs');
|
||||
header("Location: " . $_SERVER["PHP_SELF"]);
|
||||
exit();
|
||||
}
|
||||
} elseif (preg_match('/del_(.*)/', $action, $reg)) {
|
||||
$code = $reg[1];
|
||||
$res = dolibarr_del_const($db, $code, $conf->entity);
|
||||
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
if ($error) {
|
||||
setEventMessages($langs->trans('Error'), null, 'errors');
|
||||
} else {
|
||||
setEventMessages($langs->trans('SetupSaved'), null, 'mesgs');
|
||||
header("Location: " . $_SERVER["PHP_SELF"]);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
@ -178,6 +218,7 @@ print dol_get_fiche_head($head, 'contract', $langs->trans("Contracts"), -1, 'con
|
||||
|
||||
print load_fiche_titre($langs->trans("ContractsNumberingModules"), '', '');
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width="100">'.$langs->trans("Name").'</td>';
|
||||
@ -271,7 +312,7 @@ foreach ($dirmodels as $reldir) {
|
||||
}
|
||||
}
|
||||
|
||||
print '</table><br>';
|
||||
print '</table></div><br>';
|
||||
|
||||
/*
|
||||
* Documents models for Contracts
|
||||
@ -299,6 +340,7 @@ if ($resql) {
|
||||
}
|
||||
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Name").'</td>';
|
||||
@ -369,9 +411,9 @@ foreach ($dirmodels as $reldir) {
|
||||
// Defaut
|
||||
print '<td class="center">';
|
||||
if ($conf->global->CONTRACT_ADDON_PDF == $name) {
|
||||
print img_picto($langs->trans("Default"), 'on');
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=unsetdoc&token='.newToken().'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'&type=order_supplier" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
|
||||
} else {
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
@ -415,6 +457,7 @@ foreach ($dirmodels as $reldir) {
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
print "<br>";
|
||||
|
||||
/*
|
||||
@ -427,6 +470,8 @@ print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="set_other">';
|
||||
|
||||
print load_fiche_titre($langs->trans("OtherOptions"), '', '');
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Parameter").'</td>';
|
||||
@ -469,7 +514,31 @@ print $form->selectyesno("activate_hideClosedServiceByDefault", (!empty($conf->g
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Allow online signing
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("AllowOnlineSign").'</td>';
|
||||
print '<td class="center">';
|
||||
if ($conf->global->CONTRACT_ALLOW_ONLINESIGN) {
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=allowonlinesign&token='.newToken().'&value=0">';
|
||||
print img_picto($langs->trans("Activited"), 'switch_on');
|
||||
print '</a>';
|
||||
} else {
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=allowonlinesign&token='.newToken().'&value=1">';
|
||||
print img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
print '</a>';
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Allow external download
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("AllowExternalDownload").'</td>';
|
||||
print '<td class="center" colspan="2">';
|
||||
print ajax_constantonoff('CONTRACT_ALLOW_EXTERNAL_DOWNLOAD', array(), null, 0, 0, 0, 2, 0, 1);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print $form->buttonsSaveCancel("Save", '');
|
||||
|
||||
|
||||
@ -1637,7 +1637,7 @@ if ($id > 0) {
|
||||
if ($showfield) {
|
||||
if ($value == 'country') {
|
||||
print '<td class="liste_titre">';
|
||||
print $form->select_country($search_country_id, 'search_country_id', '', 28, 'maxwidth150 maxwidthonsmartphone');
|
||||
print $form->select_country($search_country_id, 'search_country_id', '', 28, 'minwidth100 maxwidth150 maxwidthonsmartphone');
|
||||
print '</td>';
|
||||
$filterfound++;
|
||||
} elseif ($value == 'code') {
|
||||
@ -2128,7 +2128,7 @@ if ($id > 0) {
|
||||
$class .= ' right';
|
||||
}
|
||||
if (in_array($value, array('localtax1_type', 'localtax2_type'))) {
|
||||
$class .= ' nowrap';
|
||||
$class .= ' nowraponall';
|
||||
}
|
||||
if (in_array($value, array('use_default', 'fk_parent', 'sortorder'))) {
|
||||
$class .= ' center';
|
||||
@ -2273,8 +2273,9 @@ if ($id > 0) {
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="2">'.$langs->trans("Dictionary").'</td>';
|
||||
print '<td>'.$langs->trans("Dictionary").'</td>';
|
||||
print '<td></td>';
|
||||
print '<td class="hideonsmartphone"></td>';
|
||||
print '</tr>';
|
||||
|
||||
$showemptyline = '';
|
||||
@ -2285,13 +2286,13 @@ if ($id > 0) {
|
||||
|
||||
if ($i) {
|
||||
if ($showemptyline) {
|
||||
print '<tr class="oddeven"><td width="50%"> </td><td> </td><td> </td></tr>';
|
||||
print '<tr class="oddeven"><td></td><td></td><td class="hideonsmartphone"></td></tr>';
|
||||
$showemptyline = 0;
|
||||
}
|
||||
|
||||
|
||||
$value = $tabname[$i];
|
||||
print '<tr class="oddeven"><td width="50%">';
|
||||
print '<tr class="oddeven"><td class="minwidth200">';
|
||||
if (!empty($tabcond[$i])) {
|
||||
$tabnamenoprefix = preg_replace('/'.MAIN_DB_PREFIX.'/', '', $tabname[$i]);
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$i.'">';
|
||||
@ -2309,7 +2310,7 @@ if ($id > 0) {
|
||||
print img_picto('Edit', 'edit', '');
|
||||
print '</a>';
|
||||
print '</td>';
|
||||
print '<td class="right">';
|
||||
print '<td class="right hideonsmartphone">';
|
||||
print $form->textwithpicto('', $langs->trans("Table").': '.MAIN_DB_PREFIX.$tabname[$i]);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
@ -2374,7 +2375,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
} // For state page, we do not show the country input (we link to region, not country)
|
||||
print '<td>';
|
||||
$fieldname = 'country';
|
||||
print $form->select_country((!empty($obj->country_code) ? $obj->country_code : (!empty($obj->country) ? $obj->country : '')), $fieldname, '', 28, 'maxwidth150 maxwidthonsmartphone');
|
||||
print $form->select_country((!empty($obj->country_code) ? $obj->country_code : (!empty($obj->country) ? $obj->country : '')), $fieldname, '', 28, 'minwidth100 maxwidth150 maxwidthonsmartphone');
|
||||
print '</td>';
|
||||
} elseif ($value == 'country_id') {
|
||||
if (!in_array('country', $fieldlist)) { // If there is already a field country, we don't show country_id (avoid duplicate)
|
||||
|
||||
@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
|
||||
dol_include_once('/emailcollector/class/emailcollector.class.php');
|
||||
require_once DOL_DOCUMENT_ROOT.'/emailcollector/class/emailcollector.class.php';
|
||||
|
||||
// Load translation files required by page
|
||||
$langs->loadLangs(array("admin", "other"));
|
||||
@ -50,7 +50,7 @@ $mode = GETPOST('mode', 'aZ');
|
||||
$id = GETPOST('id', 'int');
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
|
||||
@ -220,7 +220,7 @@ if ($action == 'edit') {
|
||||
foreach ($arrayofparameters as $constname => $val) {
|
||||
if ($val['enabled']==1) {
|
||||
$setupnotempty++;
|
||||
print '<tr class="oddeven"><td>';
|
||||
print '<tr class="oddeven"><td><!-- '.$constname.' -->';
|
||||
$tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : '');
|
||||
$tooltiphelp .= (($langs->trans($constname . 'Tooltip2') && $langs->trans($constname . 'Tooltip2') != $constname . 'Tooltip2') ? '<br><br>'."\n".$langs->trans($constname . 'Tooltip2') : '');
|
||||
print '<span id="helplink'.$constname.'" class="spanforparamtooltip">'.$form->textwithpicto($langs->trans($constname), $tooltiphelp, 1, 'info', '', 0, 3, 'tootips'.$constname).'</span>';
|
||||
@ -302,7 +302,8 @@ if ($action == 'edit') {
|
||||
foreach ($arrayofparameters as $constname => $val) {
|
||||
if ($val['enabled']==1) {
|
||||
$setupnotempty++;
|
||||
print '<tr class="oddeven"><td>';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td><!-- '.$constname.' -->';
|
||||
$tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : '');
|
||||
$tooltiphelp .= (($langs->trans($constname . 'Tooltip2') && $langs->trans($constname . 'Tooltip2') != $constname . 'Tooltip2') ? '<br><br>'."\n".$langs->trans($constname . 'Tooltip2') : '');
|
||||
print $form->textwithpicto($langs->trans($constname), $tooltiphelp);
|
||||
@ -320,12 +321,17 @@ if ($action == 'edit') {
|
||||
$formmail = new FormMail($db);
|
||||
|
||||
$tmp = explode(':', $val['type']);
|
||||
|
||||
$template = $formmail->getEMailTemplate($db, $tmp[1], $user, $langs, getDolGlobalString($constname));
|
||||
if ($template < 0) {
|
||||
setEventMessages(null, $formmail->errors, 'errors');
|
||||
$labelemailtemplate = getDolGlobalString($constname);
|
||||
if ($labelemailtemplate && $labelemailtemplate != '-1') {
|
||||
$template = $formmail->getEMailTemplate($db, $tmp[1], $user, $langs, getDolGlobalString($constname));
|
||||
if (is_numeric($template) && $template < 0) {
|
||||
setEventMessages($formmail->error, $formmail->errors, 'errors');
|
||||
} else {
|
||||
if ($template->label != 'default') {
|
||||
print $langs->trans($template->label);
|
||||
}
|
||||
}
|
||||
}
|
||||
print $langs->trans($template->label);
|
||||
}
|
||||
} elseif (preg_match('/category:/', $val['type'])) {
|
||||
if (getDolGlobalString($constname)) {
|
||||
@ -353,16 +359,21 @@ if ($action == 'edit') {
|
||||
}
|
||||
} elseif ($val['type'] == 'product') {
|
||||
$product = new Product($db);
|
||||
$resprod = $product->fetch(getDolGlobalString($constname));
|
||||
if ($resprod > 0) {
|
||||
print $product->getNomUrl(1);
|
||||
} elseif ($resprod < 0) {
|
||||
setEventMessages($product->error, $product->errors, "errors");
|
||||
$idproduct = getDolGlobalString($constname);
|
||||
if ($idproduct > 0) {
|
||||
$resprod = $product->fetch($idproduct);
|
||||
if ($resprod > 0) {
|
||||
print $product->getNomUrl(1);
|
||||
} elseif ($resprod < 0) {
|
||||
setEventMessages($product->error, $product->errors, "errors");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
print getDolGlobalString($constname);
|
||||
}
|
||||
print '</td></tr>';
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -232,6 +232,37 @@ if ($action == 'updateMask') {
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
}
|
||||
} elseif (preg_match('/set_(.*)/', $action, $reg)) {
|
||||
$code = $reg[1];
|
||||
$value = (GETPOST($code) ? GETPOST($code) : 1);
|
||||
|
||||
$res = dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
if ($error) {
|
||||
setEventMessages($langs->trans('Error'), null, 'errors');
|
||||
} else {
|
||||
setEventMessages($langs->trans('SetupSaved'), null, 'mesgs');
|
||||
header("Location: " . $_SERVER["PHP_SELF"]);
|
||||
exit();
|
||||
}
|
||||
} elseif (preg_match('/del_(.*)/', $action, $reg)) {
|
||||
$code = $reg[1];
|
||||
$res = dolibarr_del_const($db, $code, $conf->entity);
|
||||
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
if ($error) {
|
||||
setEventMessages($langs->trans('Error'), null, 'errors');
|
||||
} else {
|
||||
setEventMessages($langs->trans('SetupSaved'), null, 'mesgs');
|
||||
header("Location: " . $_SERVER["PHP_SELF"]);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -771,20 +802,15 @@ print '</form>';
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("InvoiceCheckPosteriorDate"). ' ' ;
|
||||
print $form->textwithpicto('', $langs->trans("InvoiceCheckPosteriorDateHelp"), 1, 'help') . '</td>';
|
||||
print '<td class="left">';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('INVOICE_CHECK_POSTERIOR_DATE');
|
||||
} else {
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'" />';
|
||||
print '<input type="hidden" name="action" value="set_INVOICE_CHECK_POSTERIOR_DATE" />';
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("INVOICE_CHECK_POSTERIOR_DATE", $arrval, $conf->global->INVOICE_CHECK_POSTERIOR_DATE);
|
||||
print '</td>';
|
||||
print '<td class="center">';
|
||||
print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'" />';
|
||||
print '</form>';
|
||||
}
|
||||
print '<td class="left" colspan="2">';
|
||||
print ajax_constantonoff('INVOICE_CHECK_POSTERIOR_DATE');
|
||||
print '</td></tr>';
|
||||
|
||||
// Allow external download
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("AllowExternalDownload").'</td>';
|
||||
print '<td class="left" colspan="2">';
|
||||
print ajax_constantonoff('INVOICE_ALLOW_EXTERNAL_DOWNLOAD', array(), null, 0, 0, 0, 2, 0, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
@ -51,7 +51,7 @@ $modules = array(
|
||||
'NOTE_PUBLIC' => 'FCKeditorForNotePublic',
|
||||
'NOTE_PRIVATE' => 'FCKeditorForNotePrivate',
|
||||
'SOCIETE' => 'FCKeditorForCompany',
|
||||
'PRODUCTDESC' => 'FCKeditorForProduct',
|
||||
//'PRODUCTDESC' => 'FCKeditorForProduct',
|
||||
'DETAILS' => 'FCKeditorForProductDetails',
|
||||
'USERSIGN' => 'FCKeditorForUserSignature',
|
||||
'MAILING' => 'FCKeditorForMailing',
|
||||
@ -93,7 +93,7 @@ foreach ($modules as $const => $desc) {
|
||||
if ($action == 'enable_'.strtolower($const)) {
|
||||
dolibarr_set_const($db, "FCKEDITOR_ENABLE_".$const, "1", 'chaine', 0, '', $conf->entity);
|
||||
// If fckeditor is active in the product/service description, it is activated in the forms
|
||||
if ($const == 'PRODUCTDESC' && !empty($conf->global->PRODUIT_DESC_IN_FORM)) {
|
||||
if ($const == 'PRODUCTDESC' && getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE')) {
|
||||
dolibarr_set_const($db, "FCKEDITOR_ENABLE_DETAILS", "1", 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
@ -166,7 +166,12 @@ if (empty($conf->use_javascript_ajax)) {
|
||||
print '<!-- constant = '.$constante.' -->'."\n";
|
||||
print '<tr class="oddeven">';
|
||||
print '<td width="16">'.img_object("", $picto[$const]).'</td>';
|
||||
print '<td>'.$langs->trans($desc).'</td>';
|
||||
print '<td>';
|
||||
print $langs->trans($desc);
|
||||
if ($const == 'DETAILS') {
|
||||
print '<br><span class="warning">'.$langs->trans("FCKeditorForProductDetails2").'</span>';
|
||||
}
|
||||
print '</td>';
|
||||
print '<td class="center" width="100">';
|
||||
$value = (isset($conf->global->$constante) ? $conf->global->$constante : 0);
|
||||
if ($value == 0) {
|
||||
@ -185,6 +190,7 @@ if (empty($conf->use_javascript_ajax)) {
|
||||
|
||||
print '<form name="formtest" method="POST" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="page_y" value="">';
|
||||
|
||||
// Skins
|
||||
show_skin(null, 1);
|
||||
@ -219,7 +225,7 @@ if (empty($conf->use_javascript_ajax)) {
|
||||
print $conf->global->FCKEDITOR_TEST;
|
||||
print '</div>';
|
||||
}
|
||||
print $form->buttonsSaveCancel("Save", '');
|
||||
print $form->buttonsSaveCancel("Save", '', null, 0, 'reposition');
|
||||
print '<div id="divforlog"></div>';
|
||||
print '</form>'."\n";
|
||||
|
||||
|
||||
@ -208,6 +208,32 @@ if ($action == 'updateMask') {
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
} else {
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
} elseif ($action == "set_FICHINTER_ALLOW_ONLINE_SIGN") {
|
||||
$val = GETPOST('FICHINTER_ALLOW_ONLINE_SIGN', 'alpha');
|
||||
$res = dolibarr_set_const($db, "FICHINTER_ALLOW_ONLINE_SIGN", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity);
|
||||
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
} else {
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
} elseif ($action == "set_FICHINTER_ALLOW_EXTERNAL_DOWNLOAD") {
|
||||
$val = GETPOST('FICHINTER_ALLOW_EXTERNAL_DOWNLOAD', 'alpha');
|
||||
$res = dolibarr_set_const($db, "FICHINTER_ALLOW_EXTERNAL_DOWNLOAD", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity);
|
||||
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
} else {
|
||||
@ -594,6 +620,39 @@ print '<input type="submit" class="button button-edit" value="'.$langs->trans("M
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '</form>';
|
||||
// Allow online signing
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="set_FICHINTER_ALLOW_ONLINE_SIGN">';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>';
|
||||
print $langs->trans("AllowOnlineSign");
|
||||
print '</td>';
|
||||
print '<td class="center">';
|
||||
print '<input type="checkbox" name="FICHINTER_ALLOW_ONLINE_SIGN"'.(getDolGlobalString("FICHINTER_ALLOW_ONLINE_SIGN") ? ' checked' : '').'>';
|
||||
print '</td>';
|
||||
print '<td class="right">';
|
||||
print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '</form>';
|
||||
// Allow external download
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="set_FICHINTER_ALLOW_EXTERNAL_DOWNLOAD">';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>';
|
||||
print $langs->trans("AllowExternalDownload");
|
||||
print '</td>';
|
||||
print '<td class="center">';
|
||||
print '<input type="checkbox" name="FICHINTER_ALLOW_EXTERNAL_DOWNLOAD"'.(getDolGlobalString("FICHINTER_ALLOW_EXTERNAL_DOWNLOAD") ? ' checked' : '').'>';
|
||||
print '</td>';
|
||||
print '<td class="right">';
|
||||
print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '</form>';
|
||||
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
@ -53,27 +53,20 @@ if ($action == 'set') {
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!$error && $gimcdf && !file_exists($gimcdf)) {
|
||||
setEventMessages($langs->trans("ErrorFileNotFound", $gimcdf), null, 'errors');
|
||||
$res1 = dolibarr_set_const($db, "GEOIP_VERSION", GETPOST('geoipversion', 'aZ09'), 'chaine', 0, '', $conf->entity);
|
||||
if (!($res1 > 0)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
$res2 = dolibarr_set_const($db, "GEOIPMAXMIND_COUNTRY_DATAFILE", $gimcdf, 'chaine', 0, '', $conf->entity);
|
||||
if (!($res2 > 0)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$res1 = dolibarr_set_const($db, "GEOIP_VERSION", GETPOST('geoipversion', 'aZ09'), 'chaine', 0, '', $conf->entity);
|
||||
if (!($res1 > 0)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
$res2 = dolibarr_set_const($db, "GEOIPMAXMIND_COUNTRY_DATAFILE", $gimcdf, 'chaine', 0, '', $conf->entity);
|
||||
if (!($res2 > 0)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
} else {
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
} else {
|
||||
//setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
@ -112,8 +105,8 @@ print '<td class="right"><input type="submit" class="button button-edit" value="
|
||||
print "</tr>\n";
|
||||
|
||||
// Lib version
|
||||
print '<tr class="oddeven"><td width="50%">'.$langs->trans("GeoIPLibVersion").'</td>';
|
||||
print '<td colspan="2">';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("GeoIPLibVersion").'</td>';
|
||||
print '<td>';
|
||||
$arrayofvalues = array('php' => 'Native PHP functions', '1' => 'Embedded GeoIP v1', '2' => 'Embedded GeoIP v2');
|
||||
print $form->selectarray('geoipversion', $arrayofvalues, (isset($conf->global->GEOIP_VERSION) ? $conf->global->GEOIP_VERSION : '2'));
|
||||
if ($conf->global->GEOIP_VERSION == 'php') {
|
||||
@ -124,16 +117,29 @@ if ($conf->global->GEOIP_VERSION == 'php') {
|
||||
print '<br>'.$langs->trans("Version").': '.$version;
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print '</td></tr>';
|
||||
|
||||
$gimcdf = getDolGlobalString('GEOIPMAXMIND_COUNTRY_DATAFILE');
|
||||
|
||||
// Path to database file
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("PathToGeoIPMaxmindCountryDataFile").'</td>';
|
||||
print '<td colspan="2">';
|
||||
|
||||
print '<td>';
|
||||
if ($conf->global->GEOIP_VERSION == 'php') {
|
||||
print 'Using geoip PHP internal functions. Value must be '.geoip_db_filename(GEOIP_COUNTRY_EDITION).' or '.geoip_db_filename(GEOIP_CITY_EDITION_REV1).' or /pathtodatafile/GeoLite2-Country.mmdb<br>';
|
||||
}
|
||||
print '<input type="text" class="minwidth200" name="GEOIPMAXMIND_COUNTRY_DATAFILE" value="'.dol_escape_htmltag($conf->global->GEOIPMAXMIND_COUNTRY_DATAFILE).'">';
|
||||
print '<input type="text" class="minwidth200" name="GEOIPMAXMIND_COUNTRY_DATAFILE" value="'.dol_escape_htmltag(getDolGlobalString('GEOIPMAXMIND_COUNTRY_DATAFILE')).'">';
|
||||
if (!file_exists($gimcdf)) {
|
||||
print '<div class="error">'.$langs->trans("ErrorFileNotFound", $gimcdf).'</div>';
|
||||
}
|
||||
print '</td><td>';
|
||||
print '<span class="opacitymedium">';
|
||||
print $langs->trans("Example").'<br>';
|
||||
print '/usr/local/share/GeoIP/GeoIP.dat<br>
|
||||
/usr/share/GeoIP/GeoIP.dat<br>
|
||||
/usr/share/GeoIP/GeoLite2-Country.mmdb';
|
||||
print '</span>';
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
@ -145,12 +151,16 @@ print '<br>';
|
||||
print $langs->trans("NoteOnPathLocation").'<br>';
|
||||
|
||||
$url1 = 'http://www.maxmind.com/en/city?rId=awstats';
|
||||
print $langs->trans("YouCanDownloadFreeDatFileTo", '<a href="'.$url1.'" target="_blank" rel="noopener noreferrer external">'.$url1.'</a>');
|
||||
$textoshow = $langs->trans("YouCanDownloadFreeDatFileTo", '{s1}');
|
||||
$textoshow = str_replace('{s1}', '<a href="'.$url1.'" target="_blank" rel="noopener noreferrer external">'.$url1.'</a>', $textoshow);
|
||||
print $textoshow;
|
||||
|
||||
print '<br>';
|
||||
|
||||
$url2 = 'http://www.maxmind.com/en/city?rId=awstats';
|
||||
print $langs->trans("YouCanDownloadAdvancedDatFileTo", '<a href="'.$url2.'" target="_blank" rel="noopener noreferrer external">'.$url2.'</a>');
|
||||
$textoshow = $langs->trans("YouCanDownloadAdvancedDatFileTo", '{s1}');
|
||||
$textoshow = str_replace('{s1}', '<a href="'.$url2.'" target="_blank" rel="noopener noreferrer external">'.$url2.'</a>', $textoshow);
|
||||
print $textoshow;
|
||||
|
||||
if ($geoip) {
|
||||
print '<br><br>';
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2020 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2007-2022 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2009-2018 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
@ -30,11 +30,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('companies', 'products', 'admin'));
|
||||
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$cancel = GETPOST('cancel', 'aZ09');
|
||||
$currencycode = GETPOST('currencycode', 'alpha');
|
||||
|
||||
if (isModEnabled('multicompany') && !empty($conf->global->MULTICURRENCY_USE_LIMIT_BY_CURRENCY)) {
|
||||
@ -49,25 +46,36 @@ $mainroundingruletot = 'MAIN_ROUNDING_RULE_TOT'.(!empty($currencycode) ? '_'.$cu
|
||||
|
||||
$valmainmaxdecimalsunit = GETPOST($mainmaxdecimalsunit, 'int');
|
||||
$valmainmaxdecimalstot = GETPOST($mainmaxdecimalstot, 'int');
|
||||
$valmainmaxdecimalsshown = GETPOST($mainmaxdecimalsshown, 'int');
|
||||
$valmainmaxdecimalsshown = GETPOST($mainmaxdecimalsshown, 'alpha'); // Can be 'x.y' but also 'x...'
|
||||
$valmainroundingruletot = price2num(GETPOST($mainroundingruletot, 'alphanohtml'), '', 2);
|
||||
|
||||
if ($action == 'update') {
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'update' && !$cancel) {
|
||||
$error = 0;
|
||||
$MAXDEC = 8;
|
||||
if ($_POST[$mainmaxdecimalsunit] > $MAXDEC
|
||||
|| $_POST[$mainmaxdecimalstot] > $MAXDEC
|
||||
|| $_POST[$mainmaxdecimalsshown] > $MAXDEC) {
|
||||
if ($valmainmaxdecimalsunit > $MAXDEC
|
||||
|| $valmainmaxdecimalstot > $MAXDEC
|
||||
|| $valmainmaxdecimalsshown > $MAXDEC) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorDecimalLargerThanAreForbidden", $MAXDEC), null, 'errors');
|
||||
$action = 'edit';
|
||||
}
|
||||
|
||||
if ($_POST[$mainmaxdecimalsunit].(!empty($currencycode) ? '_'.$currencycode : '') < 0
|
||||
|| $_POST[$mainmaxdecimalstot] < 0
|
||||
|| $_POST[$mainmaxdecimalsshown] < 0) {
|
||||
if ($valmainmaxdecimalsunit < 0
|
||||
|| $valmainmaxdecimalstot < 0
|
||||
|| $valmainmaxdecimalsshown < 0) {
|
||||
$langs->load("errors");
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorNegativeValueNotAllowed"), null, 'errors');
|
||||
$action = 'edit';
|
||||
}
|
||||
|
||||
if ($valmainroundingruletot) {
|
||||
@ -75,9 +83,23 @@ if ($action == 'update') {
|
||||
$langs->load("errors");
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorMAIN_ROUNDING_RULE_TOTCanMAIN_MAX_DECIMALS_TOT"), null, 'errors');
|
||||
$action = 'edit';
|
||||
}
|
||||
}
|
||||
|
||||
if ((float) $valmainmaxdecimalsshown == 0) {
|
||||
$langs->load("errors");
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorValueCantBeNull", dol_trunc(dol_string_nohtmltag($langs->transnoentitiesnoconv("MAIN_MAX_DECIMALS_SHOWN")), 40)), null, 'errors');
|
||||
$action = 'edit';
|
||||
}
|
||||
if (! $error && ((float) $valmainmaxdecimalsshown < $valmainmaxdecimalsunit || (float) $valmainmaxdecimalsshown < $valmainmaxdecimalstot)) {
|
||||
$langs->load("errors");
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorValueForTooLow", dol_trunc(dol_string_nohtmltag($langs->transnoentitiesnoconv("MAIN_MAX_DECIMALS_SHOWN")), 40)), null, 'errors');
|
||||
$action = 'edit';
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
dolibarr_set_const($db, $mainmaxdecimalsunit, $valmainmaxdecimalsunit, 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, $mainmaxdecimalstot, $valmainmaxdecimalstot, 'chaine', 0, '', $conf->entity);
|
||||
@ -144,24 +166,25 @@ if ($action == 'edit') {
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_UNIT"), $langs->trans("ParameterActiveForNextInputOnly"));
|
||||
print '</td><td><input class="flat" name="'.$mainmaxdecimalsunit.'" size="3" value="'.(isset($conf->global->$mainmaxdecimalsunit) ? $conf->global->$mainmaxdecimalsunit : $conf->global->MAIN_MAX_DECIMALS_UNIT).'"></td></tr>';
|
||||
print '</td><td><input class="flat right" name="'.$mainmaxdecimalsunit.'" size="3" value="'.(GETPOSTISSET($mainmaxdecimalsunit) ? GETPOST($mainmaxdecimalsunit) : getDolGlobalInt('MAIN_MAX_DECIMALS_UNIT', 0)).'"></td></tr>';
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_TOT"), $langs->trans("ParameterActiveForNextInputOnly"));
|
||||
print '</td><td><input class="flat" name="'.$mainmaxdecimalstot.'" size="3" value="'.(isset($conf->global->$mainmaxdecimalstot) ? $conf->global->$mainmaxdecimalstot : $conf->global->MAIN_MAX_DECIMALS_TOT).'"></td></tr>';
|
||||
print '</td><td><input class="flat right" name="'.$mainmaxdecimalstot.'" size="3" value="'.(GETPOSTISSET($mainmaxdecimalstot) ? GETPOST($mainmaxdecimalstot) : getDolGlobalInt('MAIN_MAX_DECIMALS_TOT', 0)).'"></td></tr>';
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAX_DECIMALS_SHOWN").'</td>';
|
||||
print '<td><input class="flat" name="'.$mainmaxdecimalsshown.'" size="3" value="'.(isset($conf->global->$mainmaxdecimalsshown) ? $conf->global->$mainmaxdecimalsshown : $conf->global->MAIN_MAX_DECIMALS_SHOWN).'"></td></tr>';
|
||||
print '<td><input class="flat right" name="'.$mainmaxdecimalsshown.'" size="3" value="'.(GETPOSTISSET($mainmaxdecimalsshown) ? GETPOST($mainmaxdecimalsshown) : getDolGlobalString('MAIN_MAX_DECIMALS_SHOWN')).'"></td></tr>';
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $form->textwithpicto($langs->trans("MAIN_ROUNDING_RULE_TOT"), $langs->trans("ParameterActiveForNextInputOnly"));
|
||||
print '</td><td><input class="flat" name="'.$mainroundingruletot.'" size="3" value="'.(isset($conf->global->$mainroundingruletot) ? $conf->global->$mainroundingruletot : (!empty($conf->global->MAIN_ROUNDING_RULE_TOT) ? $conf->global->MAIN_ROUNDING_RULE_TOT : '')).'"></td></tr>';
|
||||
print '</td><td><input class="flat right" name="'.$mainroundingruletot.'" size="3" value="'.(GETPOSTISSET($mainroundingruletot) ? GETPOST($mainroundingruletot) : getDolGlobalString('MAIN_ROUNDING_RULE_TOT')).'"></td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<br>';
|
||||
print '<div class="center">';
|
||||
print '<input class="button button-save" type="submit" value="'.$langs->trans("Save").'">';
|
||||
print '<input class="button button-save" type="submit" name="save" value="'.$langs->trans("Save").'">';
|
||||
print ' ';
|
||||
print '<input class="button button-cancel" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '</div>';
|
||||
print '<br>';
|
||||
|
||||
@ -170,7 +193,7 @@ if ($action == 'edit') {
|
||||
} else {
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td class="right">'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_UNIT"), $langs->trans("ParameterActiveForNextInputOnly"));
|
||||
@ -191,7 +214,7 @@ if ($action == 'edit') {
|
||||
print '</div>';
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().''.(!empty($currencycode) ? '¤cycode='.$currencycode : '').'">'.$langs->trans("Modify").'</a>';
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().(!empty($currencycode) ? '¤cycode='.$currencycode : '').'">'.$langs->trans("Modify").'</a>';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
|
||||
@ -123,31 +123,35 @@ print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Parameter").'</td>';
|
||||
print '<td>'.$langs->trans("Value").'</td>';
|
||||
print '<td>'.$langs->trans("Example").'</td>';
|
||||
print '<td class="hideonsmartphone">'.$langs->trans("Example").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("MailingEMailFrom").'</td><td>';
|
||||
print '<input size="32" type="text" name="MAILING_EMAIL_FROM" value="'.$conf->global->MAILING_EMAIL_FROM.'">';
|
||||
$help = img_help(1, $langs->trans("EMailHelpMsgSPFDKIM"));
|
||||
print $langs->trans("MailingEMailFrom").' '.$help.'</td><td>';
|
||||
print '<input class="minwidth100" type="text" name="MAILING_EMAIL_FROM" value="'.$conf->global->MAILING_EMAIL_FROM.'">';
|
||||
if (!empty($conf->global->MAILING_EMAIL_FROM) && !isValidEmail($conf->global->MAILING_EMAIL_FROM)) {
|
||||
print ' '.img_warning($langs->trans("BadEMail"));
|
||||
}
|
||||
print '</td><td><span class="opacitymedium">'.dol_escape_htmltag(($mysoc->name ? $mysoc->name : 'MyName').' <noreply@example.com>').'</span></td>';
|
||||
print '</td>';
|
||||
print '<td class="hideonsmartphone"><span class="opacitymedium">'.dol_escape_htmltag(($mysoc->name ? $mysoc->name : 'MyName').' <noreply@example.com>').'</span></td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("MailingEMailError").'</td><td>';
|
||||
print '<input size="32" type="text" name="MAILING_EMAIL_ERRORSTO" value="'.$conf->global->MAILING_EMAIL_ERRORSTO.'">';
|
||||
print '<input class="minwidth100" type="text" name="MAILING_EMAIL_ERRORSTO" value="'.$conf->global->MAILING_EMAIL_ERRORSTO.'">';
|
||||
if (!empty($conf->global->MAILING_EMAIL_ERRORSTO) && !isValidEmail($conf->global->MAILING_EMAIL_ERRORSTO)) {
|
||||
print ' '.img_warning($langs->trans("BadEMail"));
|
||||
}
|
||||
print '</td><td><span class="opacitymedium">webmaster@example.com></span></td>';
|
||||
print '</td>';
|
||||
print '<td class="hideonsmartphone"><span class="opacitymedium">webmaster@example.com></span></td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("MailingDelay").'</td><td>';
|
||||
print '<input class="width75" type="text" name="MAILING_DELAY" value="'.$conf->global->MAILING_DELAY.'">';
|
||||
print '</td><td></td>';
|
||||
print '</td>';
|
||||
print '<td class="hideonsmartphone"></td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
@ -156,11 +160,12 @@ print '</tr>';
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("ActivateCheckReadKey").'</td><td>';
|
||||
print '<input size="32" type="text" name="MAILING_EMAIL_UNSUBSCRIBE_KEY" id="MAILING_EMAIL_UNSUBSCRIBE_KEY" value="'.$conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY.'">';
|
||||
print '<input class="minwidth100 maxwdith250 widthcentpercentminusx" type="text" name="MAILING_EMAIL_UNSUBSCRIBE_KEY" id="MAILING_EMAIL_UNSUBSCRIBE_KEY" value="'.$conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY.'">';
|
||||
if (!empty($conf->use_javascript_ajax)) {
|
||||
print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token" class="linkobject"');
|
||||
}
|
||||
print '</td><td></td>';
|
||||
print '</td>';
|
||||
print '<td class="hideonsmartphone"></td>';
|
||||
print '</tr>';
|
||||
|
||||
// default blacklist from mailing
|
||||
@ -170,7 +175,7 @@ print '<td>';
|
||||
$blacklist_setting=array(0=>$langs->trans('No'), 1=>$langs->trans('Yes'), 2=>$langs->trans('DefaultStatusEmptyMandatory'));
|
||||
print $form->selectarray("MAILING_CONTACT_DEFAULT_BULK_STATUS", $blacklist_setting, $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS);
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
print '<td class="hideonsmartphone"></td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
@ -178,7 +183,8 @@ if (!empty($conf->use_javascript_ajax) && $conf->global->MAIN_FEATURES_LEVEL >=
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("MailAdvTargetRecipients").'</td><td>';
|
||||
print ajax_constantonoff('EMAILING_USE_ADVANCED_SELECTOR');
|
||||
print '</td><td></td>';
|
||||
print '</td>';
|
||||
print '<td class="hideonsmartphone"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
|
||||
@ -34,14 +34,15 @@ $langs->loadLangs(array("companies", "products", "admin", "mails", "other", "err
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$cancel = GETPOST('cancel', 'aZ09');
|
||||
|
||||
$trackid = GETPOST('trackid');
|
||||
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
$usersignature = $user->signature;
|
||||
// For action = test or send, we ensure that content is not html, even for signature, because this we want a test with NO html.
|
||||
|
||||
if ($action == 'test' || $action == 'send') {
|
||||
// For action = test or send, we ensure that content is not html, even for signature, because for this we want a test with NO html.
|
||||
if ($action == 'test' || ($action == 'send' && $trackid = 'test')) {
|
||||
$usersignature = dol_string_nohtmltag($usersignature, 2);
|
||||
}
|
||||
|
||||
@ -118,6 +119,11 @@ if ($action == 'update' && !$cancel) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'disablephpmailwarning' && !$cancel) {
|
||||
dolibarr_set_const($db, 'MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP', 1, 'chaine', 1, 0, $conf->entity);
|
||||
|
||||
setEventMessages($langs->trans("WarningDisabled"), null, 'mesgs');
|
||||
}
|
||||
|
||||
// Actions to send emails
|
||||
$id = 0;
|
||||
@ -125,7 +131,7 @@ $actiontypecode = ''; // Not an event for agenda
|
||||
$triggersendname = ''; // Disable triggers
|
||||
$paramname = 'id';
|
||||
$mode = 'emailfortest';
|
||||
$trackid = (($action == 'testhtml') ? "testhtml" : "test");
|
||||
$trackid = ($action == 'send' ? GETPOST('trackid', 'aZ09') : $action);
|
||||
$sendcontext = '';
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||
|
||||
@ -138,7 +144,6 @@ if ($action == 'presend' && GETPOST('trackid', 'alphanohtml') == 'testhtml') {
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
@ -375,7 +380,7 @@ if ($action == 'edit') {
|
||||
|
||||
// SuperAdministrator access only
|
||||
if ((empty($conf->global->MAIN_MODULE_MULTICOMPANY)) || ($user->admin && !$user->entity)) {
|
||||
print $form->selectarray('MAIN_MAIL_SENDMODE', $listofmethods, $conf->global->MAIN_MAIL_SENDMODE);
|
||||
print $form->selectarray('MAIN_MAIL_SENDMODE', $listofmethods, getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'));
|
||||
} else {
|
||||
$text = $listofmethods[$conf->global->MAIN_MAIL_SENDMODE];
|
||||
if (empty($text)) {
|
||||
@ -383,13 +388,13 @@ if ($action == 'edit') {
|
||||
}
|
||||
$htmltext = $langs->trans("ContactSuperAdminForChange");
|
||||
print $form->textwithpicto($text, $htmltext, 1, 'superadmin');
|
||||
print '<input type="hidden" name="MAIN_MAIL_SENDMODE" value="'.$conf->global->MAIN_MAIL_SENDMODE.'">';
|
||||
print '<input type="hidden" name="MAIN_MAIL_SENDMODE" value="'.getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail').'">';
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Host server
|
||||
print '<tr class="oddeven">';
|
||||
if (!$conf->use_javascript_ajax && $linuxlike && $conf->global->MAIN_MAIL_SENDMODE == 'mail') {
|
||||
if (!$conf->use_javascript_ajax && $linuxlike && getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') == 'mail') {
|
||||
print '<td>';
|
||||
print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike");
|
||||
print '</td><td>';
|
||||
@ -423,7 +428,7 @@ if ($action == 'edit') {
|
||||
|
||||
// Port
|
||||
print '<tr class="oddeven"><td>';
|
||||
if (!$conf->use_javascript_ajax && $linuxlike && $conf->global->MAIN_MAIL_SENDMODE == 'mail') {
|
||||
if (!$conf->use_javascript_ajax && $linuxlike && getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') == 'mail') {
|
||||
print $langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike");
|
||||
print '</td><td>';
|
||||
print '<span class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
|
||||
@ -450,8 +455,27 @@ if ($action == 'edit') {
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Auth mode
|
||||
if (!empty($conf->use_javascript_ajax) || (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'), array('smtps', 'swiftmailer')))) {
|
||||
print '<tr class="oddeven smtp_auth_method"><td>'.$langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE").'</td><td>';
|
||||
if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
|
||||
// Note: Default value for MAIN_MAIL_SMTPS_AUTH_TYPE if not defined is 'LOGIN' (but login/pass may be empty and they won't be provided in such a case)
|
||||
print '<input type="radio" id="radio_pw" name="MAIN_MAIL_SMTPS_AUTH_TYPE" value="LOGIN"'.(getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE', 'LOGIN') == 'LOGIN' ? ' checked' : '').'> ';
|
||||
print '<label for="radio_pw" >'.$langs->trans("UsePassword").'</label>';
|
||||
print ' ';
|
||||
print '<input type="radio" id="radio_oauth" name="MAIN_MAIL_SMTPS_AUTH_TYPE" value="XOAUTH2"'.(getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE') == 'XOAUTH2' ? ' checked' : '').'> ';
|
||||
print '<label for="radio_oauth" >'.$form->textwithpicto($langs->trans("UseOauth"), $langs->trans("OauthNotAvailableForAllAndHadToBeCreatedBefore")).'</label>';
|
||||
} else {
|
||||
$value = getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE', 'LOGIN');
|
||||
$htmltext = $langs->trans("ContactSuperAdminForChange");
|
||||
print $form->textwithpicto($langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE"), $htmltext, 1, 'superadmin');
|
||||
print '<input type="hidden" id="MAIN_MAIL_SMTPS_AUTH_TYPE" name="MAIN_MAIL_SMTPS_AUTH_TYPE" value="'.$value.'">';
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// ID
|
||||
if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer')))) {
|
||||
if (!empty($conf->use_javascript_ajax) || (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'), array('smtps', 'swiftmailer')))) {
|
||||
$mainstmpid = (!empty($conf->global->MAIN_MAIL_SMTPS_ID) ? $conf->global->MAIN_MAIL_SMTPS_ID : '');
|
||||
print '<tr class="drag drop oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTPS_ID").'</td><td>';
|
||||
// SuperAdministrator access only
|
||||
@ -466,26 +490,8 @@ if ($action == 'edit') {
|
||||
}
|
||||
|
||||
|
||||
// OAUTH
|
||||
if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer')))) {
|
||||
print '<tr class="oddeven smtp_auth_method"><td>'.$langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE").'</td><td>';
|
||||
if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
|
||||
print '<input type="radio" id="radio_pw" name="MAIN_MAIL_SMTPS_AUTH_TYPE" value="LOGIN"'.(getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE') == 'LOGIN' ? ' checked' : '').'> ';
|
||||
print '<label for="radio_pw" >'.$langs->trans("UsePassword").'</label>';
|
||||
print ' ';
|
||||
print '<input type="radio" id="radio_oauth" name="MAIN_MAIL_SMTPS_AUTH_TYPE" value="XOAUTH2"'.(getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE') == 'XOAUTH2' ? ' checked' : '').'> ';
|
||||
print '<label for="radio_oauth" >'.$form->textwithpicto($langs->trans("UseOauth"), $langs->trans("OauthNotAvailableForAllAndHadToBeCreatedBefore")).'</label>';
|
||||
} else {
|
||||
$value = getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE', 'LOGIN');
|
||||
$htmltext = $langs->trans("ContactSuperAdminForChange");
|
||||
print $form->textwithpicto($langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE"), $htmltext, 1, 'superadmin');
|
||||
print '<input type="hidden" id="MAIN_MAIL_SMTPS_AUTH_TYPE" name="MAIN_MAIL_SMTPS_AUTH_TYPE" value="'.$value.'">';
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// PW
|
||||
if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer')))) {
|
||||
if (!empty($conf->use_javascript_ajax) || (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'), array('smtps', 'swiftmailer')))) {
|
||||
$mainsmtppw = (!empty($conf->global->MAIN_MAIL_SMTPS_PW) ? $conf->global->MAIN_MAIL_SMTPS_PW : '');
|
||||
print '<tr class="drag drop oddeven smtp_pw"><td>';
|
||||
print $form->textwithpicto($langs->trans("MAIN_MAIL_SMTPS_PW"), $langs->trans("WithGMailYouCanCreateADedicatedPassword"));
|
||||
@ -502,7 +508,7 @@ if ($action == 'edit') {
|
||||
}
|
||||
|
||||
// OAUTH service provider
|
||||
if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer')))) {
|
||||
if (!empty($conf->use_javascript_ajax) || (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'), array('smtps', 'swiftmailer')))) {
|
||||
print '<tr class="oddeven smtp_oauth_service"><td>'.$langs->trans("MAIN_MAIL_SMTPS_OAUTH_SERVICE").'</td><td>';
|
||||
|
||||
// SuperAdministrator access only
|
||||
@ -521,7 +527,7 @@ if ($action == 'edit') {
|
||||
}
|
||||
// TLS
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_TLS").'</td><td>';
|
||||
if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer')))) {
|
||||
if (!empty($conf->use_javascript_ajax) || (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'), array('smtps', 'swiftmailer')))) {
|
||||
if (function_exists('openssl_open')) {
|
||||
print $form->selectyesno('MAIN_MAIL_EMAIL_TLS', (!empty($conf->global->MAIN_MAIL_EMAIL_TLS) ? $conf->global->MAIN_MAIL_EMAIL_TLS : 0), 1);
|
||||
} else {
|
||||
@ -534,7 +540,7 @@ if ($action == 'edit') {
|
||||
|
||||
// STARTTLS
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").'</td><td>';
|
||||
if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer')))) {
|
||||
if (!empty($conf->use_javascript_ajax) || (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'), array('smtps', 'swiftmailer')))) {
|
||||
if (function_exists('openssl_open')) {
|
||||
print $form->selectyesno('MAIN_MAIL_EMAIL_STARTTLS', (!empty($conf->global->MAIN_MAIL_EMAIL_STARTTLS) ? $conf->global->MAIN_MAIL_EMAIL_STARTTLS : 0), 1);
|
||||
} else {
|
||||
@ -547,7 +553,7 @@ if ($action == 'edit') {
|
||||
|
||||
// SMTP_ALLOW_SELF_SIGNED
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").'</td><td>';
|
||||
if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer')))) {
|
||||
if (!empty($conf->use_javascript_ajax) || (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'), array('smtps', 'swiftmailer')))) {
|
||||
if (function_exists('openssl_open')) {
|
||||
print $form->selectyesno('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED', (!empty($conf->global->MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED) ? $conf->global->MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED : 0), 1);
|
||||
} else {
|
||||
@ -560,7 +566,7 @@ if ($action == 'edit') {
|
||||
|
||||
// DKIM
|
||||
print '<tr class="oddeven dkim"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_ENABLED").'</td><td>';
|
||||
if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('swiftmailer')))) {
|
||||
if (!empty($conf->use_javascript_ajax) || (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'), array('swiftmailer')))) {
|
||||
if (function_exists('openssl_open')) {
|
||||
print $form->selectyesno('MAIN_MAIL_EMAIL_DKIM_ENABLED', (!empty($conf->global->MAIN_MAIL_EMAIL_DKIM_ENABLED) ? $conf->global->MAIN_MAIL_EMAIL_DKIM_ENABLED : 0), 1);
|
||||
} else {
|
||||
@ -594,7 +600,8 @@ if ($action == 'edit') {
|
||||
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("OtherOptions").'</td><td></td></tr>';
|
||||
|
||||
// From
|
||||
print '<tr class="oddeven"><td class="fieldrequired">'.$langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ?ini_get('sendmail_from') : $langs->transnoentities("Undefined")).'</td>';
|
||||
$help = img_help(1, $langs->trans("EMailHelpMsgSPFDKIM"));
|
||||
print '<tr class="oddeven"><td class="fieldrequired">'.$langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ?ini_get('sendmail_from') : $langs->transnoentities("Undefined")).' '.$help.'</td>';
|
||||
print '<td><input class="flat minwidth200" name="MAIN_MAIL_EMAIL_FROM" value="'.(!empty($conf->global->MAIN_MAIL_EMAIL_FROM) ? $conf->global->MAIN_MAIL_EMAIL_FROM : '');
|
||||
print '"></td></tr>';
|
||||
|
||||
@ -671,20 +678,21 @@ if ($action == 'edit') {
|
||||
|
||||
// Method
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SENDMODE").'</td><td>';
|
||||
$text = $listofmethods[$conf->global->MAIN_MAIL_SENDMODE];
|
||||
$text = $listofmethods[getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail')];
|
||||
if (empty($text)) {
|
||||
$text = $langs->trans("Undefined").img_warning();
|
||||
}
|
||||
print $text;
|
||||
|
||||
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail' && empty($conf->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP)) {
|
||||
print $form->textwithpicto('', $langs->trans("WarningPHPMail").'<br>'.$langs->trans("WarningPHPMailA").'<br>'.$langs->trans("WarningPHPMailB").'<br>'.$langs->trans("WarningPHPMailC").'<br><br>'.$langs->trans("WarningPHPMailD"), 1, 'warning');
|
||||
if (getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') == 'mail' && empty($conf->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP)) {
|
||||
$textwarning = $langs->trans("WarningPHPMail").'<br>'.$langs->trans("WarningPHPMailA").'<br>'.$langs->trans("WarningPHPMailB").'<br>'.$langs->trans("WarningPHPMailC").'<br><br>'.$langs->trans("WarningPHPMailD");
|
||||
print $form->textwithpicto('', $textwarning, 1, 'warning');
|
||||
}
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
// Host server
|
||||
if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE') == 'mail')) {
|
||||
if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') == 'mail')) {
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike").'</td><td><span class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span></td></tr>';
|
||||
} else {
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTP_SERVER", ini_get('SMTP') ?ini_get('SMTP') : $langs->transnoentities("Undefined")).'</td><td>'.(!empty($conf->global->MAIN_MAIL_SMTP_SERVER) ? $conf->global->MAIN_MAIL_SMTP_SERVER : '').'</td></tr>';
|
||||
@ -692,31 +700,31 @@ if ($action == 'edit') {
|
||||
|
||||
|
||||
// Port
|
||||
if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE') == 'mail')) {
|
||||
if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') == 'mail')) {
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike").'</td><td><span class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span></td></tr>';
|
||||
} else {
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTP_PORT", ini_get('smtp_port') ?ini_get('smtp_port') : $langs->transnoentities("Undefined")).'</td><td>'.(!empty($conf->global->MAIN_MAIL_SMTP_PORT) ? $conf->global->MAIN_MAIL_SMTP_PORT : '').'</td></tr>';
|
||||
}
|
||||
|
||||
// SMTPS ID
|
||||
if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE'), array('smtps', 'swiftmailer'))) {
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTPS_ID").'</td><td>'.$conf->global->MAIN_MAIL_SMTPS_ID.'</td></tr>';
|
||||
}
|
||||
|
||||
// AUTH method
|
||||
if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE'), array('smtps', 'swiftmailer'))) {
|
||||
if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'), array('smtps', 'swiftmailer'))) {
|
||||
$authtype = getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE', 'LOGIN');
|
||||
$text = ($authtype === "LOGIN") ? $langs->trans("UsePassword") : ($authtype === "XOAUTH2" ? $langs->trans("UseOauth") : '') ;
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE").'</td><td>'.$text.'</td></tr>';
|
||||
}
|
||||
|
||||
// SMTPS ID
|
||||
if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'), array('smtps', 'swiftmailer'))) {
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTPS_ID").'</td><td>'.$conf->global->MAIN_MAIL_SMTPS_ID.'</td></tr>';
|
||||
}
|
||||
|
||||
// SMTPS PW
|
||||
if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE'), array('smtps', 'swiftmailer')) && getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE') != "XOAUTH2") {
|
||||
if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'), array('smtps', 'swiftmailer')) && getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE') != "XOAUTH2") {
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTPS_PW").'</td><td>'.preg_replace('/./', '*', $conf->global->MAIN_MAIL_SMTPS_PW).'</td></tr>';
|
||||
}
|
||||
|
||||
// SMTPS oauth service
|
||||
if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE'), array('smtps', 'swiftmailer')) && getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE') === "XOAUTH2") {
|
||||
if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'), array('smtps', 'swiftmailer')) && getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE') === "XOAUTH2") {
|
||||
$text = $oauthservices[$conf->global->MAIN_MAIL_SMTPS_OAUTH_SERVICE];
|
||||
if (empty($text)) {
|
||||
$text = $langs->trans("Undefined").img_warning();
|
||||
@ -726,7 +734,7 @@ if ($action == 'edit') {
|
||||
|
||||
// TLS
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_TLS").'</td><td>';
|
||||
if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))) {
|
||||
if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'), array('smtps', 'swiftmailer'))) {
|
||||
if (function_exists('openssl_open')) {
|
||||
print yn($conf->global->MAIN_MAIL_EMAIL_TLS);
|
||||
} else {
|
||||
@ -739,7 +747,7 @@ if ($action == 'edit') {
|
||||
|
||||
// STARTTLS
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").'</td><td>';
|
||||
if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))) {
|
||||
if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'), array('smtps', 'swiftmailer'))) {
|
||||
if (function_exists('openssl_open')) {
|
||||
print yn($conf->global->MAIN_MAIL_EMAIL_STARTTLS);
|
||||
} else {
|
||||
@ -752,7 +760,7 @@ if ($action == 'edit') {
|
||||
|
||||
// SMTP_ALLOW_SELF_SIGNED
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").'</td><td>';
|
||||
if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))) {
|
||||
if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'), array('smtps', 'swiftmailer'))) {
|
||||
if (function_exists('openssl_open')) {
|
||||
print yn($conf->global->MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED);
|
||||
} else {
|
||||
@ -767,7 +775,7 @@ if ($action == 'edit') {
|
||||
if ($conf->global->MAIN_MAIL_SENDMODE == 'swiftmailer') {
|
||||
// DKIM
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_ENABLED").'</td><td>';
|
||||
if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('swiftmailer'))) {
|
||||
if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'), array('swiftmailer'))) {
|
||||
if (function_exists('openssl_open')) {
|
||||
print yn(getDolGlobalInt('MAIN_MAIL_EMAIL_DKIM_ENABLED'));
|
||||
} else {
|
||||
@ -797,8 +805,14 @@ if ($action == 'edit') {
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail' && empty($conf->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP)) {
|
||||
print info_admin($langs->trans("WarningPHPMail").'<br>'.$langs->trans("WarningPHPMailA").'<br>'.$langs->trans("WarningPHPMailB").'<br>'.$langs->trans("WarningPHPMailC").'<br><br>'.$langs->trans("WarningPHPMailD"), 0, 0, 'warning');
|
||||
if (getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') == 'mail' && empty($conf->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP)) {
|
||||
$messagetoshow = $langs->trans("WarningPHPMail").'<br>'.$langs->trans("WarningPHPMailA").'<br>'.$langs->trans("WarningPHPMailB").'<br>'.$langs->trans("WarningPHPMailC").'<br><br>'.$langs->trans("WarningPHPMailD");
|
||||
$messagetoshow .= ' '.$langs->trans("WarningPHPMailDbis", '{s1}', '{s2}');
|
||||
$linktosetvar1 = '<a href="'.$_SERVER["PHP_SELF"].'?action=disablephpmailwarning&token='.newToken().'">';
|
||||
$linktosetvar2 = '</a>';
|
||||
$messagetoshow = str_replace('{s1}', $linktosetvar1, $messagetoshow);
|
||||
$messagetoshow = str_replace('{s2}', $linktosetvar2, $messagetoshow);
|
||||
print info_admin($messagetoshow, 0, 0, 'warning');
|
||||
}
|
||||
|
||||
print '<br>';
|
||||
@ -808,7 +822,8 @@ if ($action == 'edit') {
|
||||
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("OtherOptions").'</td><td></td></tr>';
|
||||
|
||||
// From
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ?ini_get('sendmail_from') : $langs->transnoentities("Undefined")).'</td>';
|
||||
$help = img_help(1, $langs->trans("EMailHelpMsgSPFDKIM"));
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ?ini_get('sendmail_from') : $langs->transnoentities("Undefined")).' '.$help.'</td>';
|
||||
print '<td>'.$conf->global->MAIN_MAIL_EMAIL_FROM;
|
||||
if (empty($conf->global->MAIN_MAIL_EMAIL_FROM)) {
|
||||
print img_warning($langs->trans("Mandatory"));
|
||||
@ -903,7 +918,7 @@ if ($action == 'edit') {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a>';
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_ALL_MAILS)) {
|
||||
if ($conf->global->MAIN_MAIL_SENDMODE != 'mail' || !$linuxlike) {
|
||||
if (getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') != 'mail' || !$linuxlike) {
|
||||
if (function_exists('fsockopen') && $port && $server) {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=testconnect&date='.dol_now().'#formmailaftertstconnect">'.$langs->trans("DoTestServerAvailability").'</a>';
|
||||
}
|
||||
@ -921,7 +936,7 @@ if ($action == 'edit') {
|
||||
print '</div>';
|
||||
|
||||
|
||||
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail' && empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA)) {
|
||||
if (getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') == 'mail' && empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA)) {
|
||||
/*
|
||||
// Warning 1
|
||||
if ($linuxlike)
|
||||
@ -938,11 +953,11 @@ if ($action == 'edit') {
|
||||
|
||||
if (!in_array($action, array('testconnect', 'test', 'testhtml'))) {
|
||||
$text = '';
|
||||
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail') {
|
||||
if (getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') == 'mail') {
|
||||
//$text .= $langs->trans("WarningPHPMail"); // To encourage to use SMTPS
|
||||
}
|
||||
|
||||
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail') {
|
||||
if (getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') == 'mail') {
|
||||
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. Example 'include:sendgrid.net include:spf.mydomain.com'
|
||||
$text .= ($text ? '<br><br>' : '').'<!-- MAIN_EXTERNAL_MAIL_SPF_STRING_TO_ADD -->'.$langs->trans("WarningPHPMailSPF", $conf->global->MAIN_EXTERNAL_MAIL_SPF_STRING_TO_ADD);
|
||||
|
||||
@ -34,10 +34,6 @@ $langs->loadLangs(array('companies', 'products', 'admin', 'mails', 'other', 'err
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$cancel = GETPOST('cancel', 'aZ09');
|
||||
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
$usersignature = $user->signature;
|
||||
// For action = test or send, we ensure that content is not html, even for signature, because this we want a test with NO html.
|
||||
if ($action == 'test' || $action == 'send') {
|
||||
@ -61,6 +57,10 @@ $substitutionarrayfortest = array(
|
||||
);
|
||||
complete_substitutions_array($substitutionarrayfortest, $langs);
|
||||
|
||||
// Security check
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@ -394,6 +394,25 @@ if ($action == 'edit') {
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// AUTH method
|
||||
if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) {
|
||||
print '<tr class="oddeven smtp_auth_method hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE").'</td><td>';
|
||||
if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
|
||||
// Note: Default value for MAIN_MAIL_SMTPS_AUTH_TYPE if not defined is 'LOGIN' (but login/pass may be empty and they won't be provided in such a case)
|
||||
print '<input type="radio" id="radio_pw" name="MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING" value="LOGIN"'.(getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING', 'LOGIN') == 'LOGIN' ? ' checked' : '').'> ';
|
||||
print '<label for="radio_pw" >'.$langs->trans("UsePassword").'</label>';
|
||||
print ' ';
|
||||
print '<input type="radio" id="radio_oauth" name="MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING" value="XOAUTH2"'.(getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING') == 'XOAUTH2' ? ' checked' : '').'> ';
|
||||
print '<label for="radio_oauth" >'.$form->textwithpicto($langs->trans("UseOauth"), $langs->trans("OauthNotAvailableForAllAndHadToBeCreatedBefore")).'</label>';
|
||||
} else {
|
||||
$value = getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING', 'LOGIN');
|
||||
$htmltext = $langs->trans("ContactSuperAdminForChange");
|
||||
print $form->textwithpicto($langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE"), $htmltext, 1, 'superadmin');
|
||||
print '<input type="hidden" id="MAIN_MAIL_SMTPS_AUTH_TYPE" name="MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING" value="'.$value.'">';
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// ID
|
||||
if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) {
|
||||
$mainstmpid = (!empty($conf->global->MAIN_MAIL_SMTPS_ID_EMAILING) ? $conf->global->MAIN_MAIL_SMTPS_ID_EMAILING : '');
|
||||
@ -409,24 +428,6 @@ if ($action == 'edit') {
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// OAUTH
|
||||
if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) {
|
||||
print '<tr class="oddeven smtp_auth_method hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE").'</td><td>';
|
||||
if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity)) {
|
||||
print '<input type="radio" id="radio_pw" name="MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING" value="LOGIN"'.(getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING') == 'LOGIN' ? ' checked' : '').'> ';
|
||||
print '<label for="radio_pw" >'.$langs->trans("UsePassword").'</label>';
|
||||
print ' ';
|
||||
print '<input type="radio" id="radio_oauth" name="MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING" value="XOAUTH2"'.(getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING') == 'XOAUTH2' ? ' checked' : '').'> ';
|
||||
print '<label for="radio_oauth" >'.$form->textwithpicto($langs->trans("UseOauth"), $langs->trans("OauthNotAvailableForAllAndHadToBeCreatedBefore")).'</label>';
|
||||
} else {
|
||||
$value = getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING', 'LOGIN');
|
||||
$htmltext = $langs->trans("ContactSuperAdminForChange");
|
||||
print $form->textwithpicto($langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE"), $htmltext, 1, 'superadmin');
|
||||
print '<input type="hidden" id="MAIN_MAIL_SMTPS_AUTH_TYPE" name="MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING" value="'.$value.'">';
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// PW
|
||||
if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) {
|
||||
$mainsmtppw = (!empty($conf->global->MAIN_MAIL_SMTPS_PW_EMAILING) ? $conf->global->MAIN_MAIL_SMTPS_PW_EMAILING : '');
|
||||
@ -442,7 +443,7 @@ if ($action == 'edit') {
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// OAUTH service provider
|
||||
// OAUTH service provider
|
||||
if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) {
|
||||
print '<tr class="oddeven smtp_oauth_service hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_OAUTH_SERVICE").'</td><td>';
|
||||
|
||||
@ -546,11 +547,6 @@ if ($action == 'edit') {
|
||||
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTP_PORT", ini_get('smtp_port') ?ini_get('smtp_port') : $langs->transnoentities("Undefined")).'</td><td>'.(!empty($conf->global->MAIN_MAIL_SMTP_PORT_EMAILING) ? $conf->global->MAIN_MAIL_SMTP_PORT_EMAILING : '').'</td></tr>';
|
||||
}
|
||||
|
||||
// SMTPS ID
|
||||
if (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer'))) {
|
||||
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_ID").'</td><td>'.getDolGlobalString('MAIN_MAIL_SMTPS_ID_EMAILING').'</td></tr>';
|
||||
}
|
||||
|
||||
// AUTH method
|
||||
if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING'), array('smtps', 'swiftmailer'))) {
|
||||
$authtype = getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING', 'LOGIN');
|
||||
@ -558,6 +554,11 @@ if ($action == 'edit') {
|
||||
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE").'</td><td>'.$text.'</td></tr>';
|
||||
}
|
||||
|
||||
// SMTPS ID
|
||||
if (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer'))) {
|
||||
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_ID").'</td><td>'.getDolGlobalString('MAIN_MAIL_SMTPS_ID_EMAILING').'</td></tr>';
|
||||
}
|
||||
|
||||
// SMTPS PW
|
||||
if (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')) && getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING') != "XOAUTH2") {
|
||||
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_PW").'</td><td>'.preg_replace('/./', '*', getDolGlobalString('MAIN_MAIL_SMTPS_PW_EMAILING')).'</td></tr>';
|
||||
@ -707,8 +708,8 @@ if ($action == 'edit') {
|
||||
$formmail->withfrom = 1;
|
||||
$formmail->witherrorsto = 1;
|
||||
$formmail->withto = (GETPOSTISSET('sendto') ? GETPOST('sendto', 'restricthtml') : ($user->email ? $user->email : 1));
|
||||
$formmail->withtocc = (GETPOSTISSET(['sendtocc']) ? GETPOST('sendtocc', 'restricthtml') : 1); // ! empty to keep field if empty
|
||||
$formmail->withtoccc = (GETPOSTISSET(['sendtoccc']) ? GETPOST('sendtoccc', 'restricthtml') : 1); // ! empty to keep field if empty
|
||||
$formmail->withtocc = (GETPOSTISSET('sendtocc') ? GETPOST('sendtocc', 'restricthtml') : 1); // ! empty to keep field if empty
|
||||
$formmail->withtoccc = (GETPOSTISSET('sendtoccc') ? GETPOST('sendtoccc', 'restricthtml') : 1); // ! empty to keep field if empty
|
||||
$formmail->withtopic = (GETPOSTISSET('subject') ? GETPOST('subject') : $langs->trans("Test"));
|
||||
$formmail->withtopicreadonly = 0;
|
||||
$formmail->withfile = 2;
|
||||
|
||||
@ -56,7 +56,7 @@ if (isModEnabled('eventorganization')) {
|
||||
$langs->loadLangs($langsArray);
|
||||
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view';
|
||||
$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view';
|
||||
$massaction = GETPOST('massaction', 'alpha');
|
||||
$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
|
||||
$mode = GETPOST('mode', 'aZ09');
|
||||
@ -350,7 +350,7 @@ if (empty($reshook)) {
|
||||
}
|
||||
|
||||
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
|
||||
$action = 'add';
|
||||
$action = 'create';
|
||||
}
|
||||
}
|
||||
|
||||
@ -366,7 +366,7 @@ if (empty($reshook)) {
|
||||
// List of values
|
||||
$i = 0;
|
||||
foreach ($listfieldinsert as $f => $value) {
|
||||
$keycode = $listfieldvalue[$i];
|
||||
$keycode = isset($listfieldvalue[$i]) ? $listfieldvalue[$i] : "";
|
||||
if ($value == 'lang') {
|
||||
$keycode = 'langcode';
|
||||
}
|
||||
@ -424,7 +424,7 @@ if (empty($reshook)) {
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
$action = 'add';
|
||||
$action = 'create';
|
||||
}
|
||||
}
|
||||
|
||||
@ -654,7 +654,7 @@ $linkback = '';
|
||||
$titlepicto = 'title_setup';
|
||||
|
||||
|
||||
$url = DOL_URL_ROOT.'/admin/mails_templates.php?action=add&token='.newToken();
|
||||
$url = DOL_URL_ROOT.'/admin/mails_templates.php?action=create';
|
||||
$newcardbutton = dolGetButtonTitle($langs->trans('NewEMailTemplate'), '', 'fa fa-plus-circle', $url, '', $permissiontoadd);
|
||||
|
||||
|
||||
@ -685,10 +685,11 @@ if ($action == 'delete') {
|
||||
|
||||
$fieldlist = explode(',', $tabfield[$id]);
|
||||
|
||||
if ($action == 'add') {
|
||||
if ($action == 'create') {
|
||||
// Form to add a new line
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from', 'alpha')).'">';
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
@ -739,7 +740,6 @@ if ($action == 'add') {
|
||||
if ($fieldlist[$field] == 'content_lines') {
|
||||
$valuetoshow = '';
|
||||
}
|
||||
|
||||
if ($valuetoshow != '') {
|
||||
print '<th class="'.$align.'">';
|
||||
if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) {
|
||||
@ -820,16 +820,15 @@ if ($action == 'add') {
|
||||
|
||||
// Input field
|
||||
if ($tmpfieldlist == 'topic') {
|
||||
print '<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.'" value="'.(!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '').'">';
|
||||
print '<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.'" value="'.(!empty($obj->$tmpfieldlist) ? $obj->$tmpfieldlist : '').'">';
|
||||
} elseif ($tmpfieldlist == 'joinfiles') {
|
||||
print '<input type="text" class="flat maxwidth50" name="'.$tmpfieldlist.'" value="'.(isset($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '1').'">';
|
||||
print $form->selectyesno($tmpfieldlist, (isset($obj->$tmpfieldlist) ? $obj->$tmpfieldlist : '0'), 1, false, 0, 1);
|
||||
} else {
|
||||
// print '<textarea cols="3" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(!empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'</textarea>';
|
||||
$okforextended = true;
|
||||
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
|
||||
$okforextended = false;
|
||||
}
|
||||
$doleditor = new DolEditor($tmpfieldlist, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 180, 'dolibarr_mailings', 'In', 0, true, $okforextended, ROWS_4, '90%');
|
||||
$doleditor = new DolEditor($tmpfieldlist, (!empty($obj->$tmpfieldlist) ? $obj->$tmpfieldlist : ''), '', 180, 'dolibarr_mailings', 'In', 0, true, $okforextended, ROWS_4, '90%');
|
||||
print $doleditor->Create(1);
|
||||
}
|
||||
print '</td>';
|
||||
@ -917,7 +916,7 @@ foreach ($fieldlist as $field => $value) {
|
||||
print '</td>';
|
||||
} elseif ($value == 'fk_user') {
|
||||
print '<td class="liste_titre">';
|
||||
print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, ($user->admin ? '' : 'hierarchyme'), null, 0, 0, 0, '', 0, '', 'maxwidth150');
|
||||
print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, ($user->admin ? '' : 'hierarchyme'), null, 0, 0, 0, '', 0, '', 'maxwidth150', 1);
|
||||
print '</td>';
|
||||
} elseif ($value == 'topic') {
|
||||
print '<td class="liste_titre"><input type="text" name="search_topic" value="'.dol_escape_htmltag($search_topic).'"></td>';
|
||||
@ -1024,7 +1023,7 @@ if ($num) {
|
||||
$reshook = $hookmanager->executeHooks('editEmailTemplateFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$error = $hookmanager->error; $errors = $hookmanager->errors;
|
||||
|
||||
// Show fields
|
||||
// Show main fields
|
||||
if (empty($reshook)) {
|
||||
fieldList($fieldlist, $obj, $tabname[$id], 'edit');
|
||||
}
|
||||
@ -1045,7 +1044,7 @@ if ($num) {
|
||||
foreach ($fieldsforcontent as $tmpfieldlist) {
|
||||
$showfield = 1;
|
||||
$align = "left";
|
||||
$valuetoshow = $obj->{$tmpfieldlist};
|
||||
$valuetoshow = $obj->$tmpfieldlist;
|
||||
|
||||
$class = 'tddict';
|
||||
// Show value for field
|
||||
@ -1059,7 +1058,7 @@ if ($num) {
|
||||
}
|
||||
if ($tmpfieldlist == 'joinfiles') {
|
||||
print '<strong>'.$form->textwithpicto($langs->trans("FilesAttachedToEmail"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</strong> ';
|
||||
print '<input type="text" class="flat maxwidth50" name="'.$tmpfieldlist.'-'.$rowid.'" value="'.(!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '').'">';
|
||||
print $form->selectyesno($tmpfieldlist.'-'.$rowid, (isset($obj->$tmpfieldlist) ? $obj->$tmpfieldlist : '0'), 1, false, 0, 1);
|
||||
}
|
||||
|
||||
// If $acceptlocallinktomedia is true, we can add link media files int email templates (we already can do this into HTML editor of an email).
|
||||
@ -1174,7 +1173,7 @@ if ($num) {
|
||||
$class .= ' tdoverflowmax100';
|
||||
}
|
||||
if ($value == 'topic') {
|
||||
$class .= 'tdoverflowmax200 small';
|
||||
$class .= ' tdoverflowmax200 small';
|
||||
}
|
||||
if ($value == 'type_template') {
|
||||
$valuetoshow = isset($elementList[$valuetoshow]) ? $elementList[$valuetoshow] : $valuetoshow;
|
||||
@ -1204,7 +1203,7 @@ if ($num) {
|
||||
if ($value == 'joinfiles') {
|
||||
$align = "center";
|
||||
if ($valuetoshow) {
|
||||
$valuetoshow = 1;
|
||||
$valuetoshow = yn(1);
|
||||
} else {
|
||||
$valuetoshow = '';
|
||||
}
|
||||
@ -1311,7 +1310,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
if ($value == 'fk_user') {
|
||||
print '<td>';
|
||||
if ($user->admin) {
|
||||
print $form->select_dolusers(empty($obj->{$value}) ? '' : $obj->{$value}, 'fk_user', 1, null, 0, ($user->admin ? '' : 'hierarchyme'), null, 0, 0, 0, '', 0, '', 'minwidth150 maxwidth300');
|
||||
print $form->select_dolusers(empty($obj->{$value}) ? '' : $obj->{$value}, 'fk_user', 1, null, 0, ($user->admin ? '' : 'hierarchyme'), null, 0, 0, 0, '', 0, '', 'minwidth150 maxwidth200');
|
||||
} else {
|
||||
if ($context == 'add') { // I am not admin and we show the add form
|
||||
print $user->getNomUrl(1); // Me
|
||||
@ -1335,29 +1334,29 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
if (getDolGlobalInt('MAIN_MULTILANGS')) {
|
||||
$selectedlang = GETPOSTISSET('langcode') ?GETPOST('langcode', 'aZ09') : $langs->defaultlang;
|
||||
if ($context == 'edit') {
|
||||
$selectedlang = $obj->{$value};
|
||||
$selectedlang = $obj->lang;
|
||||
}
|
||||
print $formadmin->select_language($selectedlang, 'langcode', 0, null, 1, 0, 0, 'maxwidth150');
|
||||
} else {
|
||||
if (!empty($obj->{$value})) {
|
||||
print $obj->{$value}.' - '.$langs->trans('Language_'.$obj->{$value});
|
||||
if (!empty($obj->lang)) {
|
||||
print $obj->lang.' - '.$langs->trans('Language_'.$obj->lang);
|
||||
}
|
||||
$keyname = $value;
|
||||
if ($keyname == 'lang') {
|
||||
$keyname = 'langcode'; // Avoid conflict with lang param
|
||||
}
|
||||
print '<input type="hidden" value="'.(empty($obj->{$value}) ? '' : $obj->{$value}).'" name="'.$keyname.'">';
|
||||
print '<input type="hidden" value="'.(empty($obj->lang) ? '' : $obj->lang).'" name="'.$keyname.'">';
|
||||
}
|
||||
print '</td>';
|
||||
} elseif ($value == 'type_template') {
|
||||
// Le type de template
|
||||
print '<td class="center">';
|
||||
if ($context == 'edit' && !empty($obj->{$value}) && !in_array($obj->{$value}, array_keys($elementList))) {
|
||||
if ($context == 'edit' && !empty($obj->type_template) && !in_array($obj->type_template, array_keys($elementList))) {
|
||||
// Current template type is an unknown type, so we must keep it as it is.
|
||||
print '<input type="hidden" name="type_template" value="'.$obj->{$value}.'">';
|
||||
print $obj->{$value};
|
||||
print '<input type="hidden" name="type_template" value="'.$obj->type_template.'">';
|
||||
print $obj->type_template;
|
||||
} else {
|
||||
print $form->selectarray('type_template', $elementList, (!empty($obj->{$value}) ? $obj->{$value}:''), 1, 0, 0, '', 0, 0, 0, '', 'minwidth150', 1, '', 0, 1);
|
||||
print $form->selectarray('type_template', $elementList, (!empty($obj->type_template) ? $obj->type_template:''), 1, 0, 0, '', 0, 0, 0, '', 'minwidth150', 1, '', 0, 1);
|
||||
}
|
||||
print '</td>';
|
||||
} elseif ($context == 'add' && in_array($value, array('topic', 'joinfiles', 'content', 'content_lines'))) {
|
||||
@ -1378,7 +1377,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
$class = 'maxwidth50'; $classtd = 'center';
|
||||
}
|
||||
if ($value == 'position') {
|
||||
$class = 'maxwidth50'; $classtd = 'center';
|
||||
$class = 'maxwidth50 center'; $classtd = 'center';
|
||||
}
|
||||
if ($value == 'libelle') {
|
||||
$class = 'quatrevingtpercent';
|
||||
@ -1395,7 +1394,6 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
if (empty($user->admin)) {
|
||||
print $form->selectyesno($value, '1', 1);
|
||||
} else {
|
||||
//print '<input type="text" '.$size.'class="flat'.($class?' '.$class:'').'" value="1" name="'.$fieldlist[$field].'">';
|
||||
print $form->selectyesno($value, (isset($obj->{$value}) ? $obj->{$value}:''), 1);
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -32,23 +32,28 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
$langs->loadLangs(array('companies', 'products', 'admin', 'mails', 'other', 'errors'));
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$cancel = GETPOST('cancel', 'alpha');
|
||||
$cancel = GETPOST('cancel', 'aZ09');
|
||||
|
||||
$usersignature = $user->signature;
|
||||
// For action = test or send, we ensure that content is not html, even for signature, because this we want a test with NO html.
|
||||
if ($action == 'test' || $action == 'send') {
|
||||
$usersignature = dol_string_nohtmltag($usersignature);
|
||||
$usersignature = dol_string_nohtmltag($usersignature, 2);
|
||||
}
|
||||
|
||||
$substitutionarrayfortest = array(
|
||||
'__LOGIN__' => $user->login,
|
||||
'__ID__' => 'TESTIdRecord',
|
||||
'__EMAIL__' => 'TESTEMail',
|
||||
'__LASTNAME__' => 'TESTLastname',
|
||||
'__FIRSTNAME__' => 'TESTFirstname',
|
||||
'__USER_SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $usersignature : ''),
|
||||
'__SENDEREMAIL_SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $usersignature : ''), // Done into actions_sendmails
|
||||
//'__PERSONALIZED__' => 'TESTPersonalized' // Hiden because not used yet
|
||||
'__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT,
|
||||
'__ID__' => 'TESTIdRecord',
|
||||
'__EMAIL__' => 'TESTEMail',
|
||||
'__LOGIN__' => $user->login,
|
||||
'__LASTNAME__' => 'TESTLastname',
|
||||
'__FIRSTNAME__' => 'TESTFirstname',
|
||||
'__ADDRESS__'=> 'RecipientAddress',
|
||||
'__ZIP__'=> 'RecipientZip',
|
||||
'__TOWN_'=> 'RecipientTown',
|
||||
'__COUNTRY__'=> 'RecipientCountry',
|
||||
'__USER_SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $usersignature : ''),
|
||||
'__SENDEREMAIL_SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $usersignature : ''), // Done into actions_sendmails
|
||||
//'__PERSONALIZED__' => 'TESTPersonalized' // Hiden because not used yet
|
||||
);
|
||||
complete_substitutions_array($substitutionarrayfortest, $langs);
|
||||
|
||||
@ -94,10 +99,10 @@ $trackid = (($action == 'testhtml') ? "testhtml" : "test");
|
||||
$sendcontext = 'ticket'; // Force to use dedicated context of setup for ticket
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||
|
||||
if ($action == 'presend' && GETPOST('trackid') == 'test') {
|
||||
if ($action == 'presend' && GETPOST('trackid', 'alphanohtml') == 'test') {
|
||||
$action = 'test';
|
||||
}
|
||||
if ($action == 'presend' && GETPOST('trackid') == 'testhtml') {
|
||||
if ($action == 'presend' && GETPOST('trackid', 'alphanohtml') == 'testhtml') {
|
||||
$action = 'testhtml';
|
||||
}
|
||||
|
||||
@ -317,12 +322,15 @@ if ($action == 'edit') {
|
||||
|
||||
// Host server
|
||||
|
||||
print '<tr class="oddeven hideifdefault"><td>';
|
||||
print '<tr class="oddeven hideifdefault">';
|
||||
if (!$conf->use_javascript_ajax && $linuxlike && $conf->global->MAIN_MAIL_SENDMODE_TICKET == 'mail') {
|
||||
print '<td>';
|
||||
print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike");
|
||||
print '</td><td>';
|
||||
print $langs->trans("SeeLocalSendMailSetup");
|
||||
print '<span class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td>';
|
||||
$mainserver = (!empty($conf->global->MAIN_MAIL_SMTP_SERVER_TICKET) ? $conf->global->MAIN_MAIL_SMTP_SERVER_TICKET : '');
|
||||
$smtpserver = ini_get('SMTP') ?ini_get('SMTP') : $langs->transnoentities("Undefined");
|
||||
if ($linuxlike) {
|
||||
@ -333,17 +341,18 @@ if ($action == 'edit') {
|
||||
print '</td><td>';
|
||||
// SuperAdministrator access only
|
||||
if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
|
||||
print '<input class="flat" id="MAIN_MAIL_SMTP_SERVER_TICKET" name="MAIN_MAIL_SMTP_SERVER_TICKET" size="18" value="'.$mainserver.'">';
|
||||
print '<input class="flat minwidth300" id="MAIN_MAIL_SMTP_SERVER_TICKET" name="MAIN_MAIL_SMTP_SERVER_TICKET" size="18" value="'.$mainserver.'">';
|
||||
print '<input type="hidden" id="MAIN_MAIL_SMTP_SERVER_TICKET_sav" name="MAIN_MAIL_SMTP_SERVER_TICKET_sav" value="'.$mainserver.'">';
|
||||
print '<span id="smtp_server_mess">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
|
||||
print '<span id="smtp_server_mess" class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
|
||||
} else {
|
||||
$text = !empty($mainserver) ? $mainserver : $smtpserver;
|
||||
$htmltext = $langs->trans("ContactSuperAdminForChange");
|
||||
print $form->textwithpicto($text, $htmltext, 1, 'superadmin');
|
||||
print '<input type="hidden" id="MAIN_MAIL_SMTP_SERVER_TICKET" name="MAIN_MAIL_SMTP_SERVER_TICKET" value="'.$mainserver.'">';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
print '</tr>';
|
||||
|
||||
// Port
|
||||
|
||||
@ -351,7 +360,7 @@ if ($action == 'edit') {
|
||||
if (!$conf->use_javascript_ajax && $linuxlike && $conf->global->MAIN_MAIL_SENDMODE_TICKET == 'mail') {
|
||||
print $langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike");
|
||||
print '</td><td>';
|
||||
print $langs->trans("SeeLocalSendMailSetup");
|
||||
print '<span class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
|
||||
} else {
|
||||
$mainport = (!empty($conf->global->MAIN_MAIL_SMTP_PORT_TICKET) ? $conf->global->MAIN_MAIL_SMTP_PORT_TICKET : '');
|
||||
$smtpport = ini_get('smtp_port') ?ini_get('smtp_port') : $langs->transnoentities("Undefined");
|
||||
@ -365,7 +374,7 @@ if ($action == 'edit') {
|
||||
if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
|
||||
print '<input class="flat" id="MAIN_MAIL_SMTP_PORT_TICKET" name="MAIN_MAIL_SMTP_PORT_TICKET" size="3" value="'.$mainport.'">';
|
||||
print '<input type="hidden" id="MAIN_MAIL_SMTP_PORT_TICKET_sav" name="MAIN_MAIL_SMTP_PORT_TICKET_sav" value="'.$mainport.'">';
|
||||
print '<span id="smtp_port_mess">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
|
||||
print '<span id="smtp_port_mess" class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
|
||||
} else {
|
||||
$text = (!empty($mainport) ? $mainport : $smtpport);
|
||||
$htmltext = $langs->trans("ContactSuperAdminForChange");
|
||||
@ -375,6 +384,25 @@ if ($action == 'edit') {
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// AUTH method
|
||||
if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer')))) {
|
||||
print '<tr class="oddeven smtp_auth_method hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE").'</td><td>';
|
||||
if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
|
||||
// Note: Default value for MAIN_MAIL_SMTPS_AUTH_TYPE if not defined is 'LOGIN' (but login/pass may be empty and they won't be provided in such a case)
|
||||
print '<input type="radio" id="radio_pw" name="MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET" value="LOGIN"'.(getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET', 'LOGIN') == 'LOGIN' ? ' checked' : '').'> ';
|
||||
print '<label for="radio_pw" >'.$langs->trans("UsePassword").'</label>';
|
||||
print ' ';
|
||||
print '<input type="radio" id="radio_oauth" name="MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET" value="XOAUTH2"'.(getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET') == 'XOAUTH2' ? ' checked' : '').'> ';
|
||||
print '<label for="radio_oauth" >'.$form->textwithpicto($langs->trans("UseOauth"), $langs->trans("OauthNotAvailableForAllAndHadToBeCreatedBefore")).'</label>';
|
||||
} else {
|
||||
$value = getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET', 'LOGIN');
|
||||
$htmltext = $langs->trans("ContactSuperAdminForChange");
|
||||
print $form->textwithpicto($langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE"), $htmltext, 1, 'superadmin');
|
||||
print '<input type="hidden" id="MAIN_MAIL_SMTPS_AUTH_TYPE" name="MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET" value="'.$value.'">';
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// ID
|
||||
if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer')))) {
|
||||
$mainstmpid = (!empty($conf->global->MAIN_MAIL_SMTPS_ID_TICKET) ? $conf->global->MAIN_MAIL_SMTPS_ID_TICKET : '');
|
||||
@ -390,25 +418,6 @@ if ($action == 'edit') {
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// OAUTH
|
||||
if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer')))) {
|
||||
print '<tr class="oddeven smtp_auth_method hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE").'</td><td>';
|
||||
if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity)) {
|
||||
print '<input type="radio" id="radio_pw" name="MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET" value="LOGIN"'.(getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET') == 'LOGIN' ? ' checked' : '').'> ';
|
||||
print '<label for="radio_pw" >'.$langs->trans("UsePassword").'</label>';
|
||||
print ' ';
|
||||
print '<input type="radio" id="radio_oauth" name="MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET" value="XOAUTH2"'.(getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET') == 'XOAUTH2' ? ' checked' : '').'> ';
|
||||
print '<label for="radio_oauth" >'.$form->textwithpicto($langs->trans("UseOauth"), $langs->trans("OauthNotAvailableForAllAndHadToBeCreatedBefore")).'</label>';
|
||||
} else {
|
||||
$value = getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET', 'LOGIN');
|
||||
$htmltext = $langs->trans("ContactSuperAdminForChange");
|
||||
print $form->textwithpicto($langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE"), $htmltext, 1, 'superadmin');
|
||||
print '<input type="hidden" id="MAIN_MAIL_SMTPS_AUTH_TYPE" name="MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET" value="'.$value.'">';
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
// PW
|
||||
if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer')))) {
|
||||
$mainsmtppw = (!empty($conf->global->MAIN_MAIL_SMTPS_PW_TICKET) ? $conf->global->MAIN_MAIL_SMTPS_PW_TICKET : '');
|
||||
@ -514,11 +523,6 @@ if ($action == 'edit') {
|
||||
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTP_PORT", ini_get('smtp_port') ?ini_get('smtp_port') : $langs->transnoentities("Undefined")).'</td><td>'.(!empty($conf->global->MAIN_MAIL_SMTP_PORT_TICKET) ? $conf->global->MAIN_MAIL_SMTP_PORT_TICKET : '').'</td></tr>';
|
||||
}
|
||||
|
||||
// SMTPS ID
|
||||
if (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer'))) {
|
||||
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_ID").'</td><td>'.$conf->global->MAIN_MAIL_SMTPS_ID_TICKET.'</td></tr>';
|
||||
}
|
||||
|
||||
// AUTH method
|
||||
if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET'), array('smtps', 'swiftmailer'))) {
|
||||
$authtype = getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET', 'LOGIN');
|
||||
@ -526,6 +530,11 @@ if ($action == 'edit') {
|
||||
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE").'</td><td>'.$text.'</td></tr>';
|
||||
}
|
||||
|
||||
// SMTPS ID
|
||||
if (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer'))) {
|
||||
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_ID").'</td><td>'.$conf->global->MAIN_MAIL_SMTPS_ID_TICKET.'</td></tr>';
|
||||
}
|
||||
|
||||
// SMTPS PW
|
||||
if (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer')) && getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET') != "XOAUTH2") {
|
||||
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_PW").'</td><td>'.preg_replace('/./', '*', $conf->global->MAIN_MAIL_SMTPS_PW_TICKET).'</td></tr>';
|
||||
@ -621,6 +630,7 @@ if ($action == 'edit') {
|
||||
|
||||
// Run the test to connect
|
||||
if ($action == 'testconnect') {
|
||||
print '<div id="formmailaftertstconnect" name="formmailaftertstconnect"></div>';
|
||||
print load_fiche_titre($langs->trans("DoTestServerAvailability"));
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
||||
@ -651,8 +661,8 @@ if ($action == 'edit') {
|
||||
// Cree l'objet formulaire mail
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
$formmail->fromname = (GETPOSTISSET('fromname') ? GETPOST('fromname') : $conf->global->MAIN_MAIL_EMAIL_FROM);
|
||||
$formmail->frommail = (GETPOSTISSET('frommail') ? GETPOST('frommail') : $conf->global->MAIN_MAIL_EMAIL_FROM);
|
||||
$formmail->fromname = (GETPOSTISSET('fromname') ? GETPOST('fromname', 'restricthtml') : $conf->global->MAIN_MAIL_EMAIL_FROM);
|
||||
$formmail->frommail = (GETPOSTISSET('frommail') ? GETPOST('frommail', 'restricthtml') : $conf->global->MAIN_MAIL_EMAIL_FROM);
|
||||
$formmail->trackid = (($action == 'testhtml') ? "testhtml" : "test");
|
||||
$formmail->withfromreadonly = 0;
|
||||
$formmail->withsubstit = 0;
|
||||
@ -679,7 +689,7 @@ if ($action == 'edit') {
|
||||
$formmail->param["returnurl"] = $_SERVER["PHP_SELF"];
|
||||
|
||||
// Init list of files
|
||||
if (GETPOST("mode") == 'init') {
|
||||
if (GETPOST("mode", "aZ09") == 'init') {
|
||||
$formmail->clear_attached_files();
|
||||
}
|
||||
|
||||
|
||||
@ -1118,7 +1118,13 @@ if ($mode == 'deploy') {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$message = info_admin($langs->trans("InstallModuleFromWebHasBeenDisabledByFile", $dolibarrdataroot.'/installmodules.lock'));
|
||||
if (getDolGlobalString('MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US')) {
|
||||
// Show clean message
|
||||
$message = info_admin($langs->trans('InstallModuleFromWebHasBeenDisabledContactUs'));
|
||||
} else {
|
||||
// Show technical message
|
||||
$message = info_admin($langs->trans("InstallModuleFromWebHasBeenDisabledByFile", $dolibarrdataroot.'/installmodules.lock'));
|
||||
}
|
||||
$allowfromweb = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -85,7 +85,11 @@ if ($action == 'update') {
|
||||
}
|
||||
}
|
||||
if (GETPOSTISSET($constvalue.'_SCOPE')) {
|
||||
$scopestring = implode(',', GETPOST($constvalue.'_SCOPE'));
|
||||
if (is_array(GETPOST($constvalue.'_SCOPE'))) {
|
||||
$scopestring = implode(',', GETPOST($constvalue.'_SCOPE'));
|
||||
} else {
|
||||
$scopestring = GETPOST($constvalue.'_SCOPE');
|
||||
}
|
||||
if (!dolibarr_set_const($db, $constvalue.'_SCOPE', $scopestring, 'chaine', 0, '', $conf->entity)) {
|
||||
$error++;
|
||||
}
|
||||
@ -97,6 +101,7 @@ if ($action == 'update') {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!$error) {
|
||||
setEventMessages($langs->trans("SetupSaved"), null);
|
||||
} else {
|
||||
@ -104,6 +109,48 @@ if ($action == 'update') {
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'confirm_delete') {
|
||||
$provider = GETPOST('provider', 'aZ09');
|
||||
$label = GETPOST('label');
|
||||
|
||||
$globalkey = empty($provider) ? $label : $label.'-'.$provider;
|
||||
|
||||
if (getDolGlobalString($globalkey.'_ID') && getDolGlobalString($globalkey.'_SECRET')) { // If ID and secret exist, we delete first the token
|
||||
$backtourl = DOL_URL_ROOT.'/admin/oauth.php?action=delete_entry&provider='.$provider.'&label='.$label.'&token='.newToken();
|
||||
$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
|
||||
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
|
||||
$callbacktodel = $urlwithroot;
|
||||
if ($label == 'OAUTH_GOOGLE') {
|
||||
$callbacktodel .= '/core/modules/oauth/google_oauthcallback.php?action=delete&keyforprovider='.$provider.'&token='.newToken().'&backtourl='.urlencode($backtourl);
|
||||
} elseif ($label == 'OAUTH_GITHUB') {
|
||||
$callbacktodel .= '/core/modules/oauth/github_oauthcallback.php?action=delete&keyforprovider='.$provider.'&token='.newToken().'&backtourl='.urlencode($backtourl);
|
||||
} elseif ($label == 'OAUTH_STRIPE_LIVE') {
|
||||
$callbacktodel .= '/core/modules/oauth/stripelive_oauthcallback.php?action=delete&keyforprovider='.$provider.'&token='.newToken().'&backtourl='.urlencode($backtourl);
|
||||
} elseif ($label == 'OAUTH_STRIPE_TEST') {
|
||||
$callbacktodel .= '/core/modules/oauth/stripetest_oauthcallback.php?action=delete&keyforprovider='.$provider.'&token='.newToken().'&backtourl='.urlencode($backtourl);
|
||||
} elseif ($label == 'OAUTH_OTHER') {
|
||||
$callbacktodel .= '/core/modules/oauth/generic_oauthcallback.php?action=delete&keyforprovider='.$provider.'&token='.newToken().'&backtourl='.urlencode($backtourl);
|
||||
}
|
||||
header("Location: ".$callbacktodel);
|
||||
exit;
|
||||
} else {
|
||||
$action = 'delete_entry';
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'delete_entry') {
|
||||
$provider = GETPOST('provider', 'aZ09');
|
||||
$label = GETPOST('label');
|
||||
|
||||
$globalkey = empty($provider) ? $label : $label.'-'.$provider;
|
||||
|
||||
if (!dolibarr_del_const($db, $globalkey.'_NAME', $conf->entity) || !dolibarr_del_const($db, $globalkey.'_ID', $conf->entity) || !dolibarr_del_const($db, $globalkey.'_SECRET', $conf->entity) || !dolibarr_del_const($db, $globalkey.'_URLAUTHORIZE', $conf->entity) || !dolibarr_del_const($db, $globalkey.'_SCOPE', $conf->entity)) {
|
||||
setEventMessages($langs->trans("ErrorInEntryDeletion"), null, 'errors');
|
||||
$error++;
|
||||
} else {
|
||||
setEventMessages($langs->trans("EntryDeleted"), null);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -112,6 +159,13 @@ if ($action == 'update') {
|
||||
llxHeader();
|
||||
|
||||
$form = new Form($db);
|
||||
// Confirmation of action process
|
||||
if ($action == 'delete') {
|
||||
$formquestion = array();
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?provider='.GETPOST('provider').'&label='.GETPOST('label'), $langs->trans('OAuthServiceConfirmDeleteTitle'), $langs->trans('OAuthServiceConfirmDeleteMessage'), 'confirm_delete', $formquestion, 0, 1, 220);
|
||||
print $formconfirm;
|
||||
}
|
||||
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans('ConfigOAuth'), $linkback, 'title_setup');
|
||||
@ -156,7 +210,7 @@ print dol_get_fiche_end();
|
||||
|
||||
print '</form>';
|
||||
|
||||
|
||||
$listinsetup = [];
|
||||
// Define $listinsetup
|
||||
foreach ($conf->global as $key => $val) {
|
||||
if (!empty($val) && preg_match('/^OAUTH_.*_ID$/', $key)) {
|
||||
@ -227,6 +281,17 @@ if (count($listinsetup) > 0) {
|
||||
print $langs->trans("OAUTH_URL_FOR_CREDENTIAL", $supportedoauth2array[$keyforsupportedoauth2array]['urlforcredentials']);
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Delete
|
||||
print '<td>';
|
||||
$label = preg_replace('/_NAME$/', '', $keyforsupportedoauth2array);
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&provider='.$keyforprovider.'&label='.$label.'">';
|
||||
print img_picto('', 'delete');
|
||||
print '</a>';
|
||||
|
||||
print '</form>';
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
|
||||
if ($supported) {
|
||||
@ -234,41 +299,53 @@ if (count($listinsetup) > 0) {
|
||||
print '<tr class="oddeven value">';
|
||||
print '<td>'.$langs->trans("UseTheFollowingUrlAsRedirectURI").'</td>';
|
||||
print '<td><input style="width: 80%" type"text" name="uri'.$keyforsupportedoauth2array.'" value="'.$redirect_uri.'" disabled>';
|
||||
print '</td></tr>';
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
print '</tr>';
|
||||
|
||||
if ($keyforsupportedoauth2array == 'OAUTH_OTHER_NAME') {
|
||||
print '<tr class="oddeven value">';
|
||||
print '<td>'.$langs->trans("URLOfServiceForAuthorization").'</td>';
|
||||
print '<td><input style="width: 80%" type"text" name="'.$key[3].'" value="'.getDolGlobalString($key[3]).'" >';
|
||||
print '</td></tr>';
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
} else {
|
||||
print '<tr class="oddeven value">';
|
||||
print '<td>'.$langs->trans("UseTheFollowingUrlAsRedirectURI").'</td>';
|
||||
print '<td>'.$langs->trans("FeatureNotYetSupported").'</td>';
|
||||
print '</td></tr>';
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Api Id
|
||||
print '<tr class="oddeven value">';
|
||||
print '<td><label for="'.$key[1].'">'.$langs->trans("OAUTH_ID").'</label></td>';
|
||||
print '<td><input type="text" size="100" id="'.$key[1].'" name="'.$key[1].'" value="'.getDolGlobalString($key[1]).'">';
|
||||
print '</td></tr>';
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Api Secret
|
||||
print '<tr class="oddeven value">';
|
||||
print '<td><label for="'.$key[2].'">'.$langs->trans("OAUTH_SECRET").'</label></td>';
|
||||
print '<td><input type="password" size="100" id="'.$key[2].'" name="'.$key[2].'" value="'.getDolGlobalString($key[2]).'">';
|
||||
print '</td></tr>';
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
print '</tr>';
|
||||
|
||||
// TODO Move this into token generation
|
||||
// TODO Move this into token generation ?
|
||||
if ($supported) {
|
||||
if ($keyforsupportedoauth2array == 'OAUTH_OTHER_NAME') {
|
||||
print '<tr class="oddeven value">';
|
||||
print '<td>'.$langs->trans("Scopes").'</td>';
|
||||
print '<td>';
|
||||
print '<input style="width: 80%" type"text" name="'.$key[4].'" value="'.getDolGlobalString($key[4]).'" >';
|
||||
print '</td></tr>';
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
print '</tr>';
|
||||
} else {
|
||||
$availablescopes = array_flip(explode(',', $supportedoauth2array[$keyforsupportedoauth2array]['availablescopes']));
|
||||
$currentscopes = explode(',', getDolGlobalString($key[4]));
|
||||
@ -288,13 +365,17 @@ if (count($listinsetup) > 0) {
|
||||
print '<input type="checkbox" id="'.$keyforprovider.$scope.'" name="'.$key[4].'[]" value="'.$scope.'"'.($val ? ' checked' : '').'>';
|
||||
print '<label style="margin-right: 10px" for="'.$keyforprovider.$scope.'">'.$scope.'</label>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
} else {
|
||||
print '<tr class="oddeven value">';
|
||||
print '<td>'.$langs->trans("UseTheFollowingUrlAsRedirectURI").'</td>';
|
||||
print '<td>'.$langs->trans("FeatureNotYetSupported").'</td>';
|
||||
print '</td></tr>';
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print '</table>'."\n";
|
||||
|
||||
@ -291,6 +291,14 @@ if ($mode == 'setup' && $user->admin) {
|
||||
print '</td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
// Scopes
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("Scopes").'</td>';
|
||||
print '<td colspan="2">';
|
||||
$currentscopes = getDolGlobalString($key[4]);
|
||||
print $currentscopes;
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td'.(empty($key['required']) ? '' : ' class="required"').'>';
|
||||
//var_dump($key);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2022 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2012-2107 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2019 Ferran Marcet <fmarcet@2byte.es>
|
||||
@ -314,7 +314,7 @@ print load_fiche_titre($langs->trans("PDFAddressForging"), '', '');
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table summary="more" class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
|
||||
print '<tr class="liste_titre"><td class="">'.$langs->trans("Parameter").'</td><td></td></tr>';
|
||||
|
||||
// Show sender name
|
||||
|
||||
@ -378,6 +378,7 @@ if ($conf->use_javascript_ajax) {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("MAIN_PDF_NO_RECIPENT_FRAME", $arrval, $conf->global->MAIN_PDF_NO_RECIPENT_FRAME);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
//Invert sender and recipient
|
||||
|
||||
@ -443,7 +444,7 @@ if ($mysoc->useLocalTax(1) || $mysoc->useLocalTax(2)) {
|
||||
print load_fiche_titre($title, '', '');
|
||||
|
||||
print '<table summary="more" class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td></td></tr>';
|
||||
|
||||
// Hide any information on Sale tax / VAT
|
||||
|
||||
@ -463,22 +464,20 @@ print '<br>';
|
||||
|
||||
|
||||
// Other
|
||||
|
||||
print load_fiche_titre($langs->trans("Other"), '', '');
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table summary="more" class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
// Use 2 languages into PDF
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("PDF_USE_ALSO_LANGUAGE_CODE").'</td><td>';
|
||||
//if (getDolGlobalInt('MAIN_MULTILANGS'))
|
||||
//{
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $form->textwithpicto($langs->trans("PDFIn2Languages"), $langs->trans("PDF_USE_ALSO_LANGUAGE_CODE"));
|
||||
print '</td><td>';
|
||||
$selected = GETPOSTISSET('PDF_USE_ALSO_LANGUAGE_CODE') ? GETPOST('PDF_USE_ALSO_LANGUAGE_CODE') : (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) ? $conf->global->PDF_USE_ALSO_LANGUAGE_CODE : 0);
|
||||
print $formadmin->select_language($selected, 'PDF_USE_ALSO_LANGUAGE_CODE', 0, null, 1);
|
||||
//} else {
|
||||
// print '<span class="opacitymedium">'.$langs->trans("MultiLangNotEnabled").'</span>';
|
||||
//}
|
||||
print '</td></tr>';
|
||||
|
||||
// Height of logo
|
||||
|
||||
@ -625,6 +625,15 @@ print '<td class="right"><input type="submit" class="button button-edit" value="
|
||||
print '</tr>';
|
||||
print '</form>';
|
||||
|
||||
// Allow external download
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("AllowExternalDownload").'</td>';
|
||||
print '<td class="center" colspan="2">';
|
||||
print ajax_constantonoff('PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD', array(), null, 0, 0, 0, 2, 0, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
|
||||
// default update prices on cloning a proposal
|
||||
/*
|
||||
print '<form method="post" action="' . $_SERVER["PHP_SELF"] . '">';
|
||||
|
||||
@ -46,7 +46,7 @@ $allow_disable_encryption = true;
|
||||
*/
|
||||
|
||||
if ($action == 'setgeneraterule') {
|
||||
if (!dolibarr_set_const($db, 'USER_PASSWORD_GENERATED', $_GET["value"], 'chaine', 0, '', $conf->entity)) {
|
||||
if (!dolibarr_set_const($db, 'USER_PASSWORD_GENERATED', GETPOST("value", "alphanohtml"), 'chaine', 0, '', $conf->entity)) {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
@ -56,7 +56,11 @@ if ($action == 'activate_encrypt') {
|
||||
|
||||
$db->begin();
|
||||
|
||||
dolibarr_set_const($db, "DATABASE_PWD_ENCRYPTED", "1", 'chaine', 0, '', $conf->entity);
|
||||
// On old version a bug created the constant into user entity, so we delete it to be sure, such entry won't exists. We want it in entity 0 or nowhere.
|
||||
dolibarr_del_const($db, "DATABASE_PWD_ENCRYPTED", "1", 'chaine', 0, '', $conf->entity);
|
||||
// We set entity=0 (all) because DATABASE_PWD_ENCRYPTED is a setup into conf file, so always shared for everybody
|
||||
$entityforall = 0;
|
||||
dolibarr_set_const($db, "DATABASE_PWD_ENCRYPTED", "1", 'chaine', 0, '', $entityforall);
|
||||
|
||||
$sql = "SELECT u.rowid, u.pass, u.pass_crypted";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||
@ -377,7 +381,8 @@ if ($conf->global->USER_PASSWORD_GENERATED == "Perso") {
|
||||
}
|
||||
|
||||
|
||||
// Cryptage mot de passe
|
||||
// Crypt passwords in database
|
||||
|
||||
print '<br>';
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
@ -393,20 +398,20 @@ print '</tr>';
|
||||
// Disable clear password in database
|
||||
print '<tr class="oddeven">';
|
||||
print '<td colspan="3">'.$langs->trans("DoNotStoreClearPassword").'</td>';
|
||||
print '<td align="center" width="60">';
|
||||
print '<td class="center" width="60">';
|
||||
if (getDolGlobalString('DATABASE_PWD_ENCRYPTED')) {
|
||||
print img_picto($langs->trans("Active"), 'tick');
|
||||
}
|
||||
print '</td>';
|
||||
if (!getDolGlobalString('DATABASE_PWD_ENCRYPTED')) {
|
||||
print '<td align="center" width="100">';
|
||||
print '<a class="reposition" href="security.php?action=activate_encrypt&token='.newToken().'">'.$langs->trans("Activate").'</a>';
|
||||
print '<td class="center" width="100">';
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=activate_encrypt&token='.newToken().'">'.$langs->trans("Activate").'</a>';
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
// Database conf file encryption
|
||||
if (getDolGlobalString('DATABASE_PWD_ENCRYPTED')) {
|
||||
print '<td align="center" width="100">';
|
||||
print '<td class="center" width="100">';
|
||||
if ($allow_disable_encryption) {
|
||||
//On n'autorise pas l'annulation de l'encryption car les mots de passe ne peuvent pas etre decodes
|
||||
//Do not allow "disable encryption" as passwords cannot be decrypted
|
||||
@ -419,7 +424,8 @@ if (getDolGlobalString('DATABASE_PWD_ENCRYPTED')) {
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
|
||||
// Cryptage du mot de base de la base dans conf.php
|
||||
|
||||
// Crypt password into config file conf.php
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td colspan="3">'.$langs->trans("MainDbPasswordFileConfEncrypted").'</td>';
|
||||
@ -430,7 +436,7 @@ if (preg_match('/crypted:/i', $dolibarr_main_db_pass) || !empty($dolibarr_main_d
|
||||
|
||||
print '</td>';
|
||||
|
||||
print '<td align="center" width="100">';
|
||||
print '<td class="center" width="100">';
|
||||
if (empty($dolibarr_main_db_pass) && empty($dolibarr_main_db_encrypted_pass)) {
|
||||
$langs->load("errors");
|
||||
print img_warning($langs->trans("WarningPassIsEmpty"));
|
||||
@ -452,18 +458,18 @@ print '</tr>';
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td colspan="3">'.$langs->trans("DisableForgetPasswordLinkOnLogonPage").'</td>';
|
||||
print '<td align="center" width="60">';
|
||||
print '<td class="center" width="60">';
|
||||
if (getDolGlobalString('MAIN_SECURITY_DISABLEFORGETPASSLINK')) {
|
||||
print img_picto($langs->trans("Active"), 'tick');
|
||||
}
|
||||
print '</td>';
|
||||
if (!getDolGlobalString('MAIN_SECURITY_DISABLEFORGETPASSLINK')) {
|
||||
print '<td align="center" width="100">';
|
||||
print '<td class="center" width="100">';
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=activate_MAIN_SECURITY_DISABLEFORGETPASSLINK&token='.newToken().'">'.$langs->trans("Activate").'</a>';
|
||||
print "</td>";
|
||||
}
|
||||
if (getDolGlobalString('MAIN_SECURITY_DISABLEFORGETPASSLINK')) {
|
||||
print '<td align="center" width="100">';
|
||||
print '<td center="center" width="100">';
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=disable_MAIN_SECURITY_DISABLEFORGETPASSLINK&token='.newToken().'">'.$langs->trans("Disable").'</a>';
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
@ -193,7 +193,7 @@ print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("MaxNumberOfPostOnPublicPagesByIP").'</td><td class="right">';
|
||||
print '</td>';
|
||||
print '<td class="nowrap">';
|
||||
print '<input class="flat right width50" name="MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS" type="text" value="'.getDolGlobalInt("MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS", 1000).'"> '.strtolower($langs->trans("Posts"));
|
||||
print '<input class="flat right width50" name="MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS" type="text" value="'.getDolGlobalInt("MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS", 1000).'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
@ -445,7 +445,7 @@ if (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)
|
||||
|| !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)
|
||||
|| !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION)
|
||||
|| !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)
|
||||
|| !empty($conf->mrp->enabled)) {
|
||||
|| isModEnabled('mrp')) {
|
||||
$virtualdiffersfromphysical = 1; // According to increase/decrease stock options, virtual and physical stock may differs.
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user