Merge branch 'develop' of github.com:Dolibarr/dolibarr into new-task-list-filter-category-customer
This commit is contained in:
commit
3e09fb60c6
@ -24,7 +24,6 @@ Component Version License GPL Compatible
|
||||
-------------------------------------------------------------------------------------
|
||||
PHP libraries:
|
||||
ADOdb-Date 0.36 Modified BSD License Yes Date convertion (not into rpm package)
|
||||
CKEditor 4.12.1 LGPL-2.1+ Yes Editor WYSIWYG
|
||||
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
|
||||
@ -50,6 +49,7 @@ TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes
|
||||
JS libraries:
|
||||
Ace 1.4.14 BSD Yes JS library to get code syntaxique coloration in a textarea.
|
||||
ChartJS 3.7.1 MIT License Yes JS library for graph
|
||||
CKEditor 4.18 LGPL-2.1+ Yes Editor WYSIWYG
|
||||
jQuery 3.6.0 MIT License Yes JS library
|
||||
jQuery UI 1.13.1 GPL and MIT License Yes JS library plugin UI
|
||||
jQuery select2 4.0.13 GPL and Apache License Yes JS library plugin for sexier multiselect. Warning: 4.0.6+ create troubles without patching css
|
||||
|
||||
277
ChangeLog
277
ChangeLog
@ -9,24 +9,182 @@ English Dolibarr ChangeLog
|
||||
For users:
|
||||
---------------
|
||||
|
||||
NEW: PHP 8.0 compatibility
|
||||
|
||||
|
||||
NEW: PHP 8.1 compatibility
|
||||
NEW: Support for recurring purchase invoices.
|
||||
NEW: #20292 Include German public holidays
|
||||
NEW: #17123 added ExtraFields for Stock Mouvement
|
||||
NEW: #20609 : new massaction to assign a sale representatives on a selection of thirdparties
|
||||
NEW: #20653 edit discount pourcentage for all lines in one shot
|
||||
NEW: Accept 'auto' for ref of object on import of purchase order/proposal
|
||||
NEW: Accountancy - Add more filters and info on page to bind accounting accounts
|
||||
NEW: Accountancy - Add subledger account when we generate a transaction with a deposit invoice
|
||||
NEW: Accountancy - Add a massaction to preselect an account (customer and supplier list)
|
||||
NEW: ACE Editor is restored at same cursor position after a save.
|
||||
NEW: Add "addMoreActionsButtons" hook to subscription form
|
||||
NEW: Add an option in GUI to show a Quick add button into top menu bar
|
||||
NEW: Module Recruitment - Add a public page with all list of open job positions.
|
||||
NEW: Module Recruitment - Add a tab with list of application on the jobposition file.
|
||||
NEW: Add a workflow to auto link contract on a ticket
|
||||
NEW: Add column date of Signature on proposal list
|
||||
NEW: Add column template invoice in invoice list
|
||||
NEW: Add column "Total HT" to products array on document creation card
|
||||
NEW: ADD configuration for text color of button action
|
||||
NEW: Add constant to hide categories in TakePos
|
||||
NEW: Add constant to show category description in TakePos
|
||||
NEW: Add constant to show only the products in stock in TakePos
|
||||
NEW: Add entity filter in exports
|
||||
NEW: Show the event block on recurring invoices #20870
|
||||
NEW: Add filter "opportunity status" on statistics of projects.
|
||||
NEW: Add firstname, lastname and max number of attendees for module "Event Organization"
|
||||
NEW: add margin info in proposal and order list
|
||||
NEW: Add massaction "Edit Extrafield" for Product
|
||||
NEW: Add more fields to detect duplicate during import of thirdparties
|
||||
NEW: Add option to foce delivery on email for purchase order receipt to yes
|
||||
NEW: Add param boder table for md theme
|
||||
NEW: Add param color button action
|
||||
NEW: Add possibility to create contract from invoice
|
||||
NEW: Add possibility with constant MAIN_LOGIN_BADCHARUNAUTHORIZED to define bad character unauthorized into login name
|
||||
NEW: Add private and public notes on tax files.
|
||||
NEW: Add status "Obsolete" to KM articles
|
||||
NEW: Add substitutions "user numbers"
|
||||
NEW: Add the possibility to add sub-BOMs to BOM
|
||||
NEW: allow a ticket to be automatically marked as read when created from backend.
|
||||
NEW: allow cut&paste as real numeric value to excel
|
||||
NEW: A public form to send a message and create a lead is available
|
||||
NEW: automatically set totally received status in reception
|
||||
NEW: Auto set invoice paid when adding credit not and remain to pay is 0
|
||||
NEW: Availibility dictionnary has a new column unit and number
|
||||
NEW: barcode rule to insert product in takepos
|
||||
NEW: Can change value of AWP during the inventory
|
||||
NEW: Can enter price with tax for predefined products on purchase objects
|
||||
NEW: Can filter on a thirdparty on product statistics
|
||||
NEW: Can removed doc templates from setup page of thirdparty
|
||||
NEW: Can set the parent company during the creation of thirdparty (action=add of societe/card.php)
|
||||
NEW: Can use ! to make a search that exclude a string
|
||||
NEW: Change in theme colors does not need to use the refresh button
|
||||
NEW: clean values and amount in FEC import
|
||||
NEW: const MAIL_MASS_ACTION_ADD_LAST_IF_MAIN_DOC_NOT_FOUND for mailing mass action
|
||||
NEW: Contact filter project list
|
||||
NEW: Create contract from invoice
|
||||
NEW: create third-party with contact if not found on public ticket
|
||||
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: Dictionaries - add possibility to manage countries in EEC
|
||||
NEW: display errors in a message box after generating documents
|
||||
NEW: Display physical and virtual stock of the products when creating OF from a BOM
|
||||
NEW: Display product ref in "Object link" product tab for BOM
|
||||
NEW: Enhance the import. Can use 'auto' for the ref (import of orders)
|
||||
NEW: Events on Proposal to Return to Draft
|
||||
NEW: Page to list expense report payments
|
||||
NEW: JS inventory autocalc input
|
||||
NEW: language support for more emailing target selectors
|
||||
NEW: leave requests: add field into type dictionary to block request if balance is negative
|
||||
NEW: MAIN_MAIL_AUTOCOPY_TO can accept several email and special keys
|
||||
NEW: MAIN_SEARCH_CAT_OR_BY_DEFAULT const for search by category
|
||||
NEW: Mass action "Close shipments"
|
||||
NEW: Module website now supports the multicompany module
|
||||
NEW: More mode for THEME_TOPMENU_DISABLE_IMAGE (2, 3, ...)
|
||||
NEW: Add option to move checkbox column as first column on Thirdparty list (only few screens)
|
||||
NEW: Add tabs for nets Bom
|
||||
NEW: on redirect of page in website module, GET parameters are kept.
|
||||
NEW: optional display warning icons on ticket list
|
||||
NEW: option to default check "notify tier at creation" in ticket module
|
||||
NEW: option update prices on proposal cloning
|
||||
NEW: payment conditions enabling semi-automatic deposit creation (Issue #18439)
|
||||
NEW: possibility to consume multiple batch
|
||||
NEW: Reverse movement product consumption
|
||||
NEW: Send email to the supplier order contact
|
||||
NEW: New permission to report time on timesheet.
|
||||
NEW: SEPA XML - option to place payment Type Info at Credit transfer Transaction level
|
||||
NEW: Show number of votes into the label of tab "Results" of a survey
|
||||
NEW: Show product reference in Takepos
|
||||
NEW: Some core tables are created only at module activation
|
||||
NEW: split consumption line on MO
|
||||
NEW: stock filter in reassort lists
|
||||
NEW: stock limit in stock export CSV
|
||||
NEW: Sub-bom are availables
|
||||
NEW: Supplier order - Show ref supplier of reception in linked object block
|
||||
NEW: support user_modif in order
|
||||
NEW: TakePos - pagination on search results
|
||||
NEW: The backup tools has an "lowmemory" option for mysqldump on large database
|
||||
NEW: The 'reposition' class works on ajax constantonoff that make redirects
|
||||
NEW: Thirdparty - Add rules "customer accountancy code" is mandatory to validate invoice
|
||||
NEW: thumbnail field in product list
|
||||
NEW: total mark rate in list
|
||||
NEW: uncheck "send message" by default on a ticket when private messages has been checked
|
||||
NEW: VAT Report by month - Show detail by rate and also by code
|
||||
NEW: Ticket triggers: allow to automatically send messages on new tickets
|
||||
NEW: Accountancy - Add hidden feature for accounting reconciliation
|
||||
NEW: Can store the session into database (instead of beeing managed by PHP)
|
||||
|
||||
Modules
|
||||
NEW: Module Partnership Management
|
||||
NEW: Experimental module Event Organization Management
|
||||
NEW: Experimental module Workstations Management
|
||||
NEW: Experimental module Partnership Management
|
||||
|
||||
|
||||
For developers:
|
||||
---------------
|
||||
|
||||
NEW: A lot of addition of hooks.
|
||||
|
||||
For developers or integrators:
|
||||
------------------------------
|
||||
NEW: dol_uncompress() supports more extensions (.gz, .bz2, .zstd). Only .zip was supported before.
|
||||
NEW: Implement a generic method for Kaban views
|
||||
NEW: Upgrade chartjs library to 3.7.1
|
||||
NEW: update rank line is possible on API for customer invoices, sales orders and supplier invoice
|
||||
NEW: stripe element with more gateways
|
||||
NEW: solde() function evolution to be able to get solde until a chosen date
|
||||
NEW: Suggest a way to run upgrade per entities.
|
||||
NEW: Support html content for multiselect component.
|
||||
NEW: ModuleBuilder - Add tabs view in module builder
|
||||
NEW: ModuleBuilder - More feature that can be modifed after module generation
|
||||
NEW: Hook getNomUrl available everywhere in tooltip of ref links
|
||||
NEW: Identification of tr is possible with by attribute data-id on some pages
|
||||
NEW: Import with select boxes V2
|
||||
NEW: Can update rank of invoice, proposal and order lines with API update
|
||||
NEW: Can use current entity filter on 'chkbxlst'
|
||||
NEW: Creation of the function select_bom() used to display bom select list
|
||||
NEW: add printFieldListWhere hook in product reassort card
|
||||
NEW: Add trigger and event on completely received status change
|
||||
NEW: Add utility function send backup by mail
|
||||
NEW: add WordPress OAuth to save a token (not SSO)
|
||||
NEW: A module can embed a sql script run at each Dolibarr upgrade
|
||||
NEW: API Proposals - Add POST lines
|
||||
NEW: API REST filter states by country
|
||||
NEW: Add option INVOICEREC_SET_AUTOFILL_DATE_START/END
|
||||
NEW: Add option MAIN_API_DEBUG to save API logs into a file
|
||||
NEW: Add param to keep the robot=index meta tag on public pages
|
||||
NEW: Add method hintindex() in database handlers.
|
||||
NEW: add modifications for new function "$db->prefix()"
|
||||
NEW: addMoreActionsButtonsList hook for button in list
|
||||
NEW: Add API to get a template invoice
|
||||
NEW: Standardize a lot of code.
|
||||
NEW: #20736 Allow extrafields SQL filters on REST API product lookup
|
||||
NEW: #19294 implement detailed timespent in task of project API
|
||||
NEW: Add a protection into PHPunit to avoid to forget a var_dump
|
||||
NEW: Add datem and type parameters to API to create movements
|
||||
NEW: Add hidden option on contract PDF line to hide qty and price
|
||||
NEW: Option MAIL_MASS_ACTION_ADD_LAST_IF_MAIN_DOC_NOT_FOUND to send last document in mass mailing action
|
||||
NEW: Add hooks: selectContactListWhere hook, selectThirdpartyListWhere hook
|
||||
NEW: TakePos - add hooks complete product display
|
||||
NEW: TakePos - add hooks for cart display
|
||||
NEW: TakePos - add hooks to complete ajax return array
|
||||
NEW: Add hook before the public ticket list
|
||||
NEW: Add hook doaction in takepos invoice
|
||||
NEW: Add Hook for Notif
|
||||
NEW: Add hook for more buttons
|
||||
NEW: Add hook printFieldListWhere in "show_contacts" function
|
||||
NEW: Add hook printFieldWhere in load_state_board function
|
||||
NEW: Add hooks contact tab badge and hooks parameter for avoid conflicts
|
||||
NEW: Add hook selectProductsListWhere in select_produits_list function
|
||||
NEW: Add hooks in commercial index
|
||||
NEW: Add hooks in customers and products boxes
|
||||
NEW: Add hooks in thirdparty index page
|
||||
NEW: Add hooks on project task time page
|
||||
NEW: Add hooks on salaries and sociales card
|
||||
NEW: Add hooks select product list and select thirdparty list function
|
||||
NEW: Add hook to getSellPrice function
|
||||
|
||||
|
||||
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
|
||||
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.
|
||||
@ -37,6 +195,105 @@ Following changes may create regressions for some external modules, but were nec
|
||||
* Move massaction 'confirm_createbills' from actions_massactions.inc.php to commande/list.php
|
||||
* Method fetch_all_resources(), fetch_all_used(), fetch_all_available() of DolResource has been removed (they were not used by core code).
|
||||
* 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.
|
||||
|
||||
|
||||
|
||||
***** ChangeLog for 15.0.2 compared to 15.0.1 *****
|
||||
|
||||
FIX: #19777 #20281
|
||||
FIX: #20140 #20301
|
||||
FIX: #20279 Accountancy - PostGreSQL - Error on mass update lines already binded
|
||||
FIX: #20476 migration postgresql 14.0.x to 15.0.x packaging type
|
||||
FIX: #20733 Inventory: Do not use batch qty even if present if batch module is disabled.
|
||||
FIX: action comm list: holiday last day not included + handle duration with halfdays
|
||||
FIX: Add missing entity on salary's payment
|
||||
FIX: Add 'recruitment' into check array
|
||||
FIX: add tools to fix bad bank amount in accounting with multicurrency
|
||||
FIX: assign member cateogry to a member
|
||||
FIX: backport
|
||||
FIX: bad bank amount in accounting with multicurrency
|
||||
FIX: Bad condition on remx
|
||||
FIX: Bad filter on date on salary list
|
||||
FIX: bad link to add a customer price (token duplicated)
|
||||
FIX: bad status of member on widget by type and status
|
||||
FIX: better error management at product selling price update
|
||||
FIX: Can't edit bank record
|
||||
FIX: check mandatory thirdparty fields for mass action
|
||||
FIX: check thirdparty object loaded and properties exist
|
||||
FIX: comment
|
||||
FIX: compatibility for ticket number sharing
|
||||
FIX: compatibility with multicompany sharings
|
||||
FIX: contact card: single extrafield update failed
|
||||
FIX: country not visible into list of states
|
||||
FIX: Delete an extrafield where type is double
|
||||
FIX: deprecated module are not more viewed as external modules
|
||||
FIX: Disable customer type by default if type prospect/customer is disabled
|
||||
FIX: each time we create a supplier order, we need to give it a ref_supplier
|
||||
FIX: Error management
|
||||
FIX: fatal error for $db usage in tpl
|
||||
FIX: filter into the list of product lots
|
||||
FIX: Filter on Object Referent page give CRSF page
|
||||
FIX: Fix default options ($hidedetails, $hidedesc, $hideref) with globales when generate PDF in mass actions
|
||||
FIX: Fix search by filters
|
||||
FIX: Fix the adding of lines in the create invoice functions
|
||||
FIX: forgotten form confirm before various payment delete
|
||||
FIX: holiday/leave requests: write status change emails in HTML
|
||||
FIX: include discount price for PMP after a reception (Issue #20029)
|
||||
FIX: incrementation
|
||||
FIX: in salary stats and payment list, we must check right perms as well as salary list
|
||||
FIX: intervention entity missing
|
||||
FIX: label tax cat trad
|
||||
FIX: Mass action ship orders
|
||||
FIX: missing advanced perms
|
||||
FIX: missing call to executeHooks()
|
||||
FIX: Missing entity on adding new VAT
|
||||
FIX: missing hook for row ordering
|
||||
FIX: missing hook parameter ($possiblelinks)
|
||||
FIX: missing parenthesis
|
||||
FIX: missing picto in combo of mass actions of thirdparties.
|
||||
FIX: missing signature library when ODT model is used
|
||||
FIX: Missing unset fields after updateline expensereport
|
||||
FIX: ModuileBuilder - Fix getLinesArray() error reporting
|
||||
FIX: Move delete task time trigger position
|
||||
FIX: Navigation between invoices
|
||||
FIX: No empty line inserted into accounting_bookkeeping
|
||||
FIX: Numbering of sepa files
|
||||
FIX: object cloning: set unique extrafield values to null to prevent duplicates
|
||||
FIX: on update with action reminder in future there is user key error
|
||||
FIX: originproductline array td identification data-id
|
||||
FIX: out of memory when more than 100 000 invoices.
|
||||
FIX: permit access to medias when logged in a different entity
|
||||
FIX: phpcs
|
||||
FIX: project creation prevented if PROJECTLEADER contact role renamed, de-activated or deleted
|
||||
FIX: project timesheet by week: cleanup unused code
|
||||
FIX: project timesheet: public holidays offset by 1 day
|
||||
FIX: project timesheets: assume Saturday and Sunday as default weekend days when working days conf is empty or badly formed
|
||||
FIX: propal list: bad error management when setting "not signed" mass action
|
||||
FIX: propal list mass action translations and error management (v14 edition)
|
||||
FIX: propal list: missing not signed massaction translation keys for transifex
|
||||
FIX: PR returns
|
||||
FIX: ref_client doesn't exists on supplier invoice, then ref_fourn needs to have a default value when we want to bill several supplier orders
|
||||
FIX: replenish and manage product stock by warhouse
|
||||
FIX: sending email on payment of registration of event
|
||||
FIX: SEPA ICS is not mandatory for bank transfer
|
||||
FIX: Set datec when add time spent on a project task
|
||||
FIX: status filter on supplierOrder stats doesn't work
|
||||
FIX: stickler-ci
|
||||
FIX: still prevent project creation if PROJECTLEADER role unavailable, but with a specific error message
|
||||
FIX: Supplier order stats
|
||||
FIX: Tabulation must be allowed for HTML content
|
||||
FIX: tool to fix bank account not in main currency for vendor invoice
|
||||
FIX: translations
|
||||
FIX: Travis + Update dev
|
||||
FIX: truncate Customer Reference too long on PDF header (PR #20718)
|
||||
FIX: uniformize code
|
||||
FIX: Update of sale price (log not correctly updated)
|
||||
FIX: user actions rights when mulit-company transverse mode is enabled
|
||||
FIX: user employee tab: offset in open days messes up holiday length calculation
|
||||
FIX: We need to have a different default_ref_supplier for each new fourn invoice
|
||||
FIX: "WHERE" clause missing on resource export
|
||||
FIX: #yogosha9754
|
||||
|
||||
|
||||
***** ChangeLog for 15.0.1 compared to 15.0.0 *****
|
||||
|
||||
25
README.md
25
README.md
@ -111,7 +111,7 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
|
||||
|
||||
- Customers/Prospects + Contacts management
|
||||
- Opportunities or Leads management
|
||||
- Commercial proposals management
|
||||
- Commercial proposals management (online signing)
|
||||
- Customer Orders management
|
||||
- Contracts/Subscription management
|
||||
- Interventions management
|
||||
@ -129,11 +129,11 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
|
||||
- Supplier Invoices/credit notes and payment management
|
||||
- INCOTERMS
|
||||
|
||||
Finance / Accounting
|
||||
Finance/Accounting
|
||||
|
||||
- Invoices / Payments
|
||||
- Invoices/Payments
|
||||
- Bank accounts management
|
||||
- Direct debit orders management (European SEPA)
|
||||
- Direct debit and Credit transfer management (European SEPA)
|
||||
- Accounting management
|
||||
- Donations management
|
||||
- Loan management
|
||||
@ -142,14 +142,14 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
|
||||
|
||||
Collaboration
|
||||
|
||||
- Shared calendar/agenda (with ical and vcal export for third party tools integration)
|
||||
- Shared calendar/agenda (with ical and vcal import/export for third party tools integration)
|
||||
- Projects & Tasks management
|
||||
- Ticket System
|
||||
- Surveys
|
||||
|
||||
HR
|
||||
|
||||
- Employee's leave requests management
|
||||
- Employee's leaves management
|
||||
- Expense reports
|
||||
- Recruitment management
|
||||
- Timesheets
|
||||
@ -157,16 +157,14 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
|
||||
### Other application/modules
|
||||
|
||||
- Electronic Document Management (EDM)
|
||||
- Bookmarks management
|
||||
- Bookmarks
|
||||
- Reporting
|
||||
- Data export/import
|
||||
- Barcodes
|
||||
- Margin calculations
|
||||
- LDAP connectivity
|
||||
- ClickToDial integration
|
||||
- Mass emailing
|
||||
- RSS integration
|
||||
- Skype integration
|
||||
- Social platforms linking
|
||||
- Payment platforms integration (PayPal, Stripe, Paybox...)
|
||||
- Email-Collector
|
||||
@ -175,13 +173,12 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
|
||||
|
||||
### Other general features
|
||||
|
||||
- Localization in most major languages
|
||||
- Multi-Language Support
|
||||
- Multi-Language Support (Localization in most major languages)
|
||||
- Multi-Users and groups with finely grained rights
|
||||
- Multi-Currency
|
||||
- Multi-Company (by adding of an external module)
|
||||
- Very user friendly and easy to use
|
||||
- customizable Dashboard
|
||||
- Customizable dashboards
|
||||
- Highly customizable: enable only the modules you need, add user personalized fields, choose your skin, several menu managers (can be used by internal users as a back-office with a particular menu, or by external users as a front-office with another one)
|
||||
- APIs (REST, SOAP)
|
||||
- Code that is easy to understand, maintain and develop (PHP with no heavy framework; trigger and hook architecture)
|
||||
@ -191,8 +188,9 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
|
||||
- Canadian double taxes (federal/province) and other countries using cumulative VAT
|
||||
- Tunisian tax stamp
|
||||
- Argentina invoice numbering using A,B,C...
|
||||
- ZATCA e-invoicing QR-Code
|
||||
- Compatible with [European directives](https://europa.eu/legislation_summaries/taxation/l31057_en.htm) (2006/112/CE ... 2010/45/UE)
|
||||
- Compatible with European GDPR rules
|
||||
- Compatible with data privacy rules (europe GDPR, ...)
|
||||
- ...
|
||||
- Flexible PDF & ODT generation for invoices, proposals, orders...
|
||||
- ...
|
||||
@ -244,6 +242,7 @@ Follow Dolibarr project on:
|
||||
- [Facebook](https://www.facebook.com/dolibarr)
|
||||
- [Twitter](https://www.twitter.com/dolibarr)
|
||||
- [LinkedIn](https://www.linkedin.com/company/association-dolibarr)
|
||||
- [Reddit](https://www.reddit.com/r/Dolibarr_ERP_CRM/)
|
||||
- [YouTube](https://www.youtube.com/user/DolibarrERPCRM)
|
||||
- [GitHub](https://github.com/Dolibarr/dolibarr)
|
||||
|
||||
|
||||
@ -6,8 +6,9 @@ This file contains some policies about the security reports on Dolibarr ERP CRM
|
||||
|
||||
| Version | Supported |
|
||||
| ---------- | ---------------------- |
|
||||
| <= 14.0.4 | :x: |
|
||||
| >= 14.0.5+ | :white_check_mark: except CSRF attacks|
|
||||
| <= 15.0.0 | :x: |
|
||||
| >= 15.0.1+ | :white_check_mark: except CSRF attacks|
|
||||
| >= 16.0.0 | :white_check_mark: |
|
||||
| >= develop | :white_check_mark: |
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
@ -27,12 +27,12 @@ OutputBaseFilename=__FILENAMEEXEDOLIWAMP__
|
||||
;SourceDir=Z:\home\ldestailleur\git\dolibarrxxx
|
||||
SourceDir=..\..\..
|
||||
AppId=doliwamp
|
||||
AppPublisher=NLTechno
|
||||
AppPublisherURL=https://www.nltechno.com
|
||||
AppPublisher=DoliCloud
|
||||
AppPublisherURL=https://www.dolicloud.com
|
||||
AppSupportURL=https://www.dolibarr.org
|
||||
AppUpdatesURL=https://www.dolibarr.org
|
||||
AppComments=DoliWamp includes Dolibarr, Apache, PHP and Mysql software.
|
||||
AppCopyright=Copyright (C) 2008-2020 Laurent Destailleur (NLTechno), Fabian Rodriguez (Le Goût du Libre)
|
||||
AppCopyright=Copyright (C) 2008-2022 Laurent Destailleur (NLTechno), Fabian Rodriguez (Le Goût du Libre)
|
||||
DefaultDirName=c:\dolibarr
|
||||
DefaultGroupName=Dolibarr
|
||||
;LicenseFile=COPYING
|
||||
@ -99,13 +99,12 @@ Source: "build\exe\doliwamp\startdoliwamp_manual_donotuse.bat.install"; DestDir:
|
||||
Source: "build\exe\doliwamp\builddemosslfiles.bat.install"; DestDir: "{app}\"; Flags: ignoreversion;
|
||||
Source: "build\exe\doliwamp\UsedPort.exe"; DestDir: "{app}\"; Flags: ignoreversion;
|
||||
|
||||
; PhpMyAdmin, Apache, Php, Mysql
|
||||
; Apache, Php, Mysql
|
||||
; Put here path of Wampserver applications
|
||||
; Value OK: apache 2.2.6, php 5.2.5 (5.2.11, 5.3.0 and 5.3.1 fails if php_exif, php_pgsql, php_zip is on), mysql 5.0.45
|
||||
; Value OK: apache 2.2.11, php 5.3.0 (if no php_exif, php_pgsql, php_zip), mysql 5.0.45
|
||||
; Value OK: apache 2.4.9, php 5.5.12, mysql 5.0.45 instead of 5.6.17 (wampserver2.5-Apache-2.4.9-Mysql-5.6.17-php5.5.12-32b.exe)
|
||||
; Value OK: apache 2.4.41, php 7.3.12, mariadb10.4.10 (wampserver3.2.0_x64.exe)
|
||||
Source: "C:\wamp64\apps\phpmyadmin4.9.2\*.*"; DestDir: "{app}\apps\phpmyadmin4.9.2"; Flags: ignoreversion recursesubdirs; Excludes: "config.inc.php,wampserver.conf,*.log,*_log,darkblue_orange"
|
||||
;Source: "C:\Program Files\Wamp\bin\apache\apache2.4.9\*.*"; DestDir: "{app}\bin\apache\apache2.4.9"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,httpd.conf,wampserver.conf,*.log,*_log"
|
||||
Source: "C:\wamp64\bin\apache\apache2.4.41\*.*"; DestDir: "{app}\bin\apache\apache2.4.41"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,httpd.conf,wampserver.conf,*.log,*_log"
|
||||
;Source: "C:\Program Files\Wamp\bin\php\php5.5.12\*.*"; DestDir: "{app}\bin\php\php5.5.12"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,phpForApache.ini,wampserver.conf,*.log,*_log"
|
||||
@ -125,9 +124,7 @@ Source: "scripts\*.*"; DestDir: "{app}\www\dolibarr\scripts"; Flags: ignoreversi
|
||||
Source: "*.*"; DestDir: "{app}\www\dolibarr"; Flags: ignoreversion; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,default.properties,install.lock"
|
||||
|
||||
; Config files
|
||||
Source: "build\exe\doliwamp\phpmyadmin.conf.install"; DestDir: "{app}\alias"; Flags: ignoreversion;
|
||||
Source: "build\exe\doliwamp\dolibarr.conf.install"; DestDir: "{app}\alias"; Flags: ignoreversion;
|
||||
Source: "build\exe\doliwamp\config.inc.php.install"; DestDir: "{app}\apps\phpmyadmin4.1.14"; Flags: ignoreversion;
|
||||
;Source: "build\exe\doliwamp\httpd.conf.install"; DestDir: "{app}\bin\apache\apache2.4.9\conf"; Flags: ignoreversion;
|
||||
Source: "build\exe\doliwamp\httpd.conf.install"; DestDir: "{app}\bin\apache\apache2.4.41\conf"; Flags: ignoreversion;
|
||||
Source: "build\exe\doliwamp\my.ini.install"; DestDir: "{app}\bin\mysql\mysql5.0.45"; Flags: ignoreversion;
|
||||
@ -196,7 +193,6 @@ var destFileA: String;
|
||||
var srcContents: String;
|
||||
var browser: String;
|
||||
var mysqlVersion: String;
|
||||
var phpmyadminVersion: String;
|
||||
var phpDllCopy: String;
|
||||
var batFile: String;
|
||||
|
||||
@ -246,7 +242,6 @@ begin
|
||||
phpVersion := '7.3.12' ;
|
||||
//mysqlVersion := '5.0.45';
|
||||
mysqlVersion := '10.4.10';
|
||||
phpmyadminVersion := '4.1.14';
|
||||
|
||||
smtpServer := 'localhost';
|
||||
apachePort := '80';
|
||||
@ -635,27 +630,6 @@ begin
|
||||
begin
|
||||
|
||||
|
||||
//----------------------------------------------
|
||||
// Create file alias phpmyadmin (always)
|
||||
//----------------------------------------------
|
||||
|
||||
destFile := pathWithSlashes+'/alias/phpmyadmin.conf';
|
||||
srcFile := pathWithSlashes+'/alias/phpmyadmin.conf.install';
|
||||
|
||||
if FileExists(srcFile) then
|
||||
begin
|
||||
LoadStringFromFile (srcFile, srcContents);
|
||||
|
||||
//installDir et version de phpmyadmin
|
||||
StringChangeEx (srcContents, 'WAMPROOT', pathWithSlashes, True);
|
||||
StringChangeEx (srcContents, 'WAMPPHPMYADMINVERSION', phpmyadminVersion, True);
|
||||
|
||||
SaveStringToFile(destFile,srcContents, False);
|
||||
end;
|
||||
DeleteFile(srcFile);
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------
|
||||
// Create file alias dolibarr (if not exists)
|
||||
//----------------------------------------------
|
||||
@ -691,35 +665,6 @@ begin
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------
|
||||
// Create file configuration for phpmyadmin (if not exists)
|
||||
//----------------------------------------------
|
||||
|
||||
destFile := pathWithSlashes+'/apps/phpmyadmin'+phpmyadminVersion+'/config.inc.php';
|
||||
srcFile := pathWithSlashes+'/apps/phpmyadmin'+phpmyadminVersion+'/config.inc.php.install';
|
||||
|
||||
if FileExists(srcFile) then
|
||||
begin
|
||||
if not FileExists (destFile) then
|
||||
begin
|
||||
LoadStringFromFile (srcFile, srcContents);
|
||||
StringChangeEx (srcContents, 'WAMPMYSQLNEWPASSWORD', mypass, True);
|
||||
StringChangeEx (srcContents, 'WAMPMYSQLPORT', myport, True);
|
||||
SaveStringToFile(destFile,srcContents, False);
|
||||
end
|
||||
else
|
||||
begin
|
||||
// We must replace to use format 2.4 of apache
|
||||
DeleteFile(destFile);
|
||||
LoadStringFromFile (srcFile, srcContents);
|
||||
StringChangeEx (srcContents, 'WAMPMYSQLNEWPASSWORD', mypass, True);
|
||||
StringChangeEx (srcContents, 'WAMPMYSQLPORT', myport, True);
|
||||
SaveStringToFile(destFile,srcContents, False);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------
|
||||
// Create file httpd.conf (if not exists)
|
||||
//----------------------------------------------
|
||||
|
||||
@ -582,9 +582,7 @@ if ($nboftargetok) {
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/teclib*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/timesheet*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/webmail*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/themes/oblyon*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/themes/allscreen*`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/theme/common/octicons/LICENSE`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/theme/common/fontawesome-5/svgs`;
|
||||
|
||||
# Removed other test files
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/public/test`;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*spl_autoload_register(function ($class_name) {
|
||||
var_dump('class='.$class_name);
|
||||
//var_dump('class='.$class_name);
|
||||
require $class_name;
|
||||
});
|
||||
*/
|
||||
|
||||
@ -300,7 +300,7 @@ if ($action == 'create') {
|
||||
|
||||
// Edit mode
|
||||
if ($action == 'update') {
|
||||
print dol_get_fiche_head($head, 'card', $langs->trans('AccountAccounting'), 0, 'billr');
|
||||
print dol_get_fiche_head($head, 'card', $langs->trans('AccountAccounting'), 0, 'accounting_account');
|
||||
|
||||
print '<form name="update" action="'.$_SERVER["PHP_SELF"].'" method="POST">'."\n";
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
@ -368,7 +368,7 @@ if ($action == 'create') {
|
||||
// View mode
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/accountancy/admin/account.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
print dol_get_fiche_head($head, 'card', $langs->trans('AccountAccounting'), -1, 'billr');
|
||||
print dol_get_fiche_head($head, 'card', $langs->trans('AccountAccounting'), -1, 'accounting_account');
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'account_number', 'ref');
|
||||
|
||||
|
||||
@ -95,10 +95,11 @@ if ($conf->loan->enabled) {
|
||||
$list_account[] = 'LOAN_ACCOUNTING_ACCOUNT_INTEREST';
|
||||
$list_account[] = 'LOAN_ACCOUNTING_ACCOUNT_INSURANCE';
|
||||
}
|
||||
$list_account[] = 'ACCOUNTING_ACCOUNT_SUSPENSE';
|
||||
if ($conf->societe->enabled) {
|
||||
$list_account[] = '---Deposits---';
|
||||
$list_account[] = 'ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT';
|
||||
}
|
||||
$list_account[] = 'ACCOUNTING_ACCOUNT_SUSPENSE';
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -134,6 +135,20 @@ if ($action == 'update') {
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'setdisableauxiliaryaccountoncustomerdeposit') {
|
||||
$setDisableAuxiliaryAccountOnCustomerDeposit = GETPOST('value', 'int');
|
||||
$res = dolibarr_set_const($db, "ACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT", $setDisableAuxiliaryAccountOnCustomerDeposit, 'yesno', 0, '', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
} else {
|
||||
setEventMessages($langs->trans("Error"), null, 'mesgs');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -231,6 +246,20 @@ foreach ($list_account as $key) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($conf->societe->enabled) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>' . img_picto('', 'bill', 'class="pictofixedwidth"') . $langs->trans("UseAuxiliaryAccountOnCustomerDeposit") . '</td>';
|
||||
if (!empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT)) {
|
||||
print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?token=' . newToken() . '&action=setdisableauxiliaryaccountoncustomerdeposit&value=0">';
|
||||
print img_picto($langs->trans("Activated"), 'switch_on', '', false, 0, 0, '', 'warning');
|
||||
print '</a></td>';
|
||||
} else {
|
||||
print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?token=' . newToken() . '&action=setdisableauxiliaryaccountoncustomerdeposit&value=1">';
|
||||
print img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
print '</a></td>';
|
||||
}
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print "</table>\n";
|
||||
print "</div>\n";
|
||||
|
||||
@ -384,6 +384,7 @@ if ($search_onpurchase != '' && $search_onpurchase != '-1') {
|
||||
$sql .= " GROUP BY p.rowid, p.ref, p.label, p.description, p.tosell, p.tobuy, p.tva_tx,";
|
||||
$sql .= " p.fk_product_type,";
|
||||
$sql .= ' p.tms,';
|
||||
$sql .= ' aa.rowid,';
|
||||
if (empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
$sql .= " p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy, p.accountancy_code_buy_intra, p.accountancy_code_buy_export";
|
||||
} else {
|
||||
@ -394,8 +395,8 @@ $sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
$resql = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($resql);
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
@ -405,9 +406,9 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
dol_syslog("/accountancy/admin/productaccount.php", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
$param = '';
|
||||
@ -607,7 +608,7 @@ if ($result) {
|
||||
|
||||
$i = 0;
|
||||
while ($i < min($num, $limit)) {
|
||||
$obj = $db->fetch_object($result);
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
// Ref produit as link
|
||||
$product_static->ref = $obj->ref;
|
||||
@ -890,7 +891,7 @@ if ($result) {
|
||||
|
||||
print '</form>';
|
||||
|
||||
$db->free($result);
|
||||
$db->free($resql);
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
@ -349,7 +349,7 @@ if ($action != 'export_csv') {
|
||||
$sql .= " GROUP BY t.numero_compte";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
$nrows = $resql->num_rows;
|
||||
$nrows = $db->num_rows($resql);
|
||||
$opening_balances = array();
|
||||
for ($i = 0; $i < $nrows; $i++) {
|
||||
$arr = $resql->fetch_array();
|
||||
|
||||
@ -431,12 +431,12 @@ if ($action == 'create') {
|
||||
// Account movement
|
||||
print '<tr>';
|
||||
print '<td class="titlefield">'.$langs->trans("NumMvts").'</td>';
|
||||
print '<td>'.$object->piece_num.'</td>';
|
||||
print '<td>'.($mode == '_tmp' ? '<span class="opacitymedium" title="Id tmp '.$object->piece_num.'">'.$langs->trans("Draft").'</span>' : $object->piece_num).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Date
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print '<table class="nobordernopadding centpercent"><tr><td>';
|
||||
print $langs->trans('Docdate');
|
||||
print '</td>';
|
||||
if ($action != 'editdate') {
|
||||
|
||||
@ -304,7 +304,7 @@ if (empty($reshook)) {
|
||||
$search_lettering_code = '';
|
||||
$search_not_reconciled = '';
|
||||
$search_import_key = '';
|
||||
$toselect = '';
|
||||
$toselect = array();
|
||||
}
|
||||
|
||||
// Must be after the remove filter action, before the export.
|
||||
|
||||
@ -259,7 +259,7 @@ if (empty($reshook)) {
|
||||
$search_lettering_code = '';
|
||||
$search_not_reconciled = '';
|
||||
$search_import_key = '';
|
||||
$toselect = '';
|
||||
$toselect = array();
|
||||
}
|
||||
|
||||
// Must be after the remove filter action, before the export.
|
||||
@ -653,6 +653,11 @@ if (preg_match('/^asc/i', $sortorder)) {
|
||||
$sortorder = "desc";
|
||||
}
|
||||
|
||||
// Warning to explain why list of record is not consistent with the other list view (missing a lot of lines)
|
||||
if ($type == 'sub') {
|
||||
print info_admin($langs->trans("WarningRecordWithoutSubledgerAreExcluded"));
|
||||
}
|
||||
|
||||
$moreforfilter = '';
|
||||
|
||||
// Accountancy account
|
||||
|
||||
@ -586,11 +586,11 @@ class AccountingAccount extends CommonObject
|
||||
$sql .= ' WHERE a.rowid = ' . ((int) $id);
|
||||
|
||||
dol_syslog(get_class($this) . '::info sql=' . $sql);
|
||||
$result = $this->db->query($sql);
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
if ($result) {
|
||||
if ($this->db->num_rows($result)) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
if ($resql) {
|
||||
if ($this->db->num_rows($resql)) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$this->id = $obj->rowid;
|
||||
if ($obj->fk_user_author) {
|
||||
$cuser = new User($this->db);
|
||||
@ -605,7 +605,7 @@ class AccountingAccount extends CommonObject
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
$this->date_modification = $this->db->jdate($obj->tms);
|
||||
}
|
||||
$this->db->free($result);
|
||||
$this->db->free($resql);
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
@ -748,6 +748,7 @@ class AccountingAccount extends CommonObject
|
||||
$reshook = $hookmanager->executeHooks('accoutancyBindingCalculation', $parameters); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if (empty($reshook)) {
|
||||
$const_name = '';
|
||||
if ($type == 'customer') {
|
||||
$const_name = "SOLD";
|
||||
} elseif ($type == 'supplier') {
|
||||
|
||||
@ -1843,8 +1843,8 @@ class BookKeeping extends CommonObject
|
||||
/**
|
||||
* Transform transaction
|
||||
*
|
||||
* @param number $direction If 0 tmp => real, if 1 real => tmp
|
||||
* @param string $piece_num Piece num
|
||||
* @param number $direction If 0: tmp => real, if 1: real => tmp
|
||||
* @param string $piece_num Piece num = Transaction ref
|
||||
* @return int int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function transformTransaction($direction = 0, $piece_num = '')
|
||||
@ -1862,57 +1862,82 @@ class BookKeeping extends CommonObject
|
||||
if ($next_piecenum < 0) {
|
||||
$error++;
|
||||
}
|
||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.$this->table_element.' (doc_date, doc_type,';
|
||||
$sql .= ' doc_ref, fk_doc, fk_docdet, entity, thirdparty_code, subledger_account, subledger_label,';
|
||||
$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
|
||||
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num, date_creation)';
|
||||
$sql .= ' SELECT doc_date, doc_type,';
|
||||
$sql .= ' doc_ref, fk_doc, fk_docdet, entity, thirdparty_code, subledger_account, subledger_label,';
|
||||
$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
|
||||
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, '.((int) $next_piecenum).", '".$this->db->idate($now)."'";
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error++;
|
||||
$this->errors[] = 'Error '.$this->db->lasterror();
|
||||
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
|
||||
|
||||
if (!$error) {
|
||||
// Delete if there is an empty line
|
||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity)." AND numero_compte IS NULL AND debit = 0 AND credit = 0";
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error++;
|
||||
$this->errors[] = 'Error '.$this->db->lasterror();
|
||||
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
|
||||
}
|
||||
}
|
||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error++;
|
||||
$this->errors[] = 'Error '.$this->db->lasterror();
|
||||
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
|
||||
|
||||
if (!$error) {
|
||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.$this->table_element.' (doc_date, doc_type,';
|
||||
$sql .= ' doc_ref, fk_doc, fk_docdet, entity, thirdparty_code, subledger_account, subledger_label,';
|
||||
$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
|
||||
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num, date_creation)';
|
||||
$sql .= ' SELECT doc_date, doc_type,';
|
||||
$sql .= ' doc_ref, fk_doc, fk_docdet, entity, thirdparty_code, subledger_account, subledger_label,';
|
||||
$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
|
||||
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, '.((int) $next_piecenum).", '".$this->db->idate($now)."'";
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error++;
|
||||
$this->errors[] = 'Error '.$this->db->lasterror();
|
||||
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error++;
|
||||
$this->errors[] = 'Error '.$this->db->lasterror();
|
||||
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
|
||||
}
|
||||
}
|
||||
} elseif ($direction == 1) {
|
||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error++;
|
||||
$this->errors[] = 'Error '.$this->db->lasterror();
|
||||
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
|
||||
if (!$error) {
|
||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error++;
|
||||
$this->errors[] = 'Error '.$this->db->lasterror();
|
||||
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
|
||||
}
|
||||
}
|
||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.$this->table_element.'_tmp (doc_date, doc_type,';
|
||||
$sql .= ' doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,';
|
||||
$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
|
||||
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num)';
|
||||
$sql .= ' SELECT doc_date, doc_type,';
|
||||
$sql .= ' doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,';
|
||||
$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
|
||||
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error++;
|
||||
$this->errors[] = 'Error '.$this->db->lasterror();
|
||||
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
|
||||
|
||||
if (!$error) {
|
||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.$this->table_element.'_tmp (doc_date, doc_type,';
|
||||
$sql .= ' doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,';
|
||||
$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
|
||||
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num)';
|
||||
$sql .= ' SELECT doc_date, doc_type,';
|
||||
$sql .= ' doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,';
|
||||
$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
|
||||
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error++;
|
||||
$this->errors[] = 'Error '.$this->db->lasterror();
|
||||
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
|
||||
}
|
||||
}
|
||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error++;
|
||||
$this->errors[] = 'Error '.$this->db->lasterror();
|
||||
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
|
||||
|
||||
if (!$error) {
|
||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error++;
|
||||
$this->errors[] = 'Error '.$this->db->lasterror();
|
||||
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!$error) {
|
||||
|
||||
@ -266,14 +266,14 @@ class Lettering extends BookKeeping
|
||||
$sql .= " ORDER BY ab2.lettering_code DESC";
|
||||
$sql .= " LIMIT 1 ";
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$resqla = $this->db->query($sql);
|
||||
if ($resqla) {
|
||||
$obj = $this->db->fetch_object($resqla);
|
||||
$lettre = (empty($obj->lettering_code) ? 'AAA' : $obj->lettering_code);
|
||||
if (!empty($obj->lettering_code)) {
|
||||
$lettre++;
|
||||
}
|
||||
$this->db->free($result);
|
||||
$this->db->free($resqla);
|
||||
} else {
|
||||
$this->errors[] = 'Error'.$this->db->lasterror();
|
||||
$error++;
|
||||
@ -281,14 +281,14 @@ class Lettering extends BookKeeping
|
||||
|
||||
$sql = "SELECT SUM(ABS(debit)) as deb, SUM(ABS(credit)) as cred FROM ".MAIN_DB_PREFIX."accounting_bookkeeping WHERE ";
|
||||
$sql .= " rowid IN (".$this->db->sanitize(implode(',', $ids)).") AND lettering_code IS NULL AND subledger_account != ''";
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$resqlb = $this->db->query($sql);
|
||||
if ($resqlb) {
|
||||
$obj = $this->db->fetch_object($resqlb);
|
||||
if (!(round(abs($obj->deb), 2) === round(abs($obj->cred), 2))) {
|
||||
$this->errors[] = 'Total not exacts '.round(abs($obj->deb), 2).' vs '.round(abs($obj->cred), 2);
|
||||
$error++;
|
||||
}
|
||||
$this->db->free($result);
|
||||
$this->db->free($resqlb);
|
||||
} else {
|
||||
$this->errors[] = 'Erreur sql'.$this->db->lasterror();
|
||||
$error++;
|
||||
@ -699,6 +699,8 @@ class Lettering extends BookKeeping
|
||||
return $grouped_payments;
|
||||
}
|
||||
|
||||
$save_payment_by_element = null;
|
||||
$save_element_by_payment = null;
|
||||
if ($element_id == 0) {
|
||||
// Save list when is the begin of recursive function
|
||||
$save_payment_by_element = $payment_by_element;
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
* Copyright (C) 2013-2021 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -46,6 +47,7 @@ $show_files = GETPOST('show_files', 'int');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
$default_account = GETPOST('default_account', 'int');
|
||||
|
||||
// Select Box
|
||||
$mesCasesCochees = GETPOST('toselect', 'array');
|
||||
@ -434,12 +436,15 @@ if ($result) {
|
||||
|
||||
$arrayofmassactions = array(
|
||||
'ventil'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Ventilate")
|
||||
,'set_default_account'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("ConfirmPreselectAccount")
|
||||
//'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
|
||||
//'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
|
||||
);
|
||||
//if ($user->rights->mymodule->supprimer) $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
|
||||
//if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton = $form->selectMassAction('ventil', $arrayofmassactions, 1);
|
||||
if ($massaction !== 'set_default_account') {
|
||||
$massactionbutton = $form->selectMassAction('ventil', $arrayofmassactions, 1);
|
||||
}
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">'."\n";
|
||||
print '<input type="hidden" name="action" value="ventil">';
|
||||
@ -454,6 +459,14 @@ if ($result) {
|
||||
|
||||
print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
|
||||
|
||||
if ($massaction == 'set_default_account') {
|
||||
$formquestion[]=array('type' => 'other',
|
||||
'name' => 'set_default_account',
|
||||
'label' => $langs->trans("AccountancyCode"),
|
||||
'value' => $formaccounting->select_account('', 'default_account', 1, array(), 0, 0, 'maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone'));
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmPreselectAccount"), $langs->trans("ConfirmPreselectAccountQuestion", count($toselect)), "confirm_set_default_account", $formquestion, 1, 0, 200, 500, 1);
|
||||
}
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("DescVentilTodoCustomer").'</span></br><br>';
|
||||
|
||||
if ($msg) {
|
||||
@ -712,7 +725,7 @@ if ($result) {
|
||||
|
||||
// Suggested accounting account
|
||||
print '<td>';
|
||||
print $formaccounting->select_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 maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone');
|
||||
print '</td>';
|
||||
|
||||
// Column with checkbox
|
||||
@ -721,6 +734,14 @@ if ($result) {
|
||||
if (!empty($suggestedid) && $suggestedaccountingaccountfor != '' && $suggestedaccountingaccountfor != 'eecwithoutvatnumber') {
|
||||
$ischecked = 1;
|
||||
}
|
||||
|
||||
if (!empty($toselect)) {
|
||||
$ischecked = 0;
|
||||
if (in_array($objp->rowid."_".$i, $toselect)) {
|
||||
$ischecked=1;
|
||||
}
|
||||
}
|
||||
|
||||
print '<input type="checkbox" class="flat checkforselect checkforselect'.$facture_static_det->id.'" name="toselect[]" value="'.$facture_static_det->id."_".$i.'"'.($ischecked ? " checked" : "").'/>';
|
||||
print '</td>';
|
||||
|
||||
|
||||
@ -558,11 +558,11 @@ if ($result) {
|
||||
}
|
||||
|
||||
|
||||
/*var_dump($tabpay);
|
||||
var_dump($tabcompany);
|
||||
var_dump($tabbq);
|
||||
var_dump($tabtp);
|
||||
var_dump($tabtype);*/
|
||||
//var_dump($tabpay);
|
||||
//var_dump($tabcompany);
|
||||
//var_dump($tabbq);
|
||||
//var_dump($tabtp);
|
||||
//var_dump($tabtype);
|
||||
|
||||
// Write bookkeeping
|
||||
if (!$error && $action == 'writebookkeeping') {
|
||||
@ -594,9 +594,9 @@ if (!$error && $action == 'writebookkeeping') {
|
||||
$db->begin();
|
||||
|
||||
// Introduce a protection. Total of tabtp must be total of tabbq
|
||||
/*var_dump($tabpay);
|
||||
var_dump($tabtp);
|
||||
var_dump($tabbq);exit;*/
|
||||
//var_dump($tabpay);
|
||||
//var_dump($tabtp);
|
||||
//var_dump($tabbq);exit;
|
||||
|
||||
// Bank
|
||||
if (!$errorforline && is_array($tabbq[$key])) {
|
||||
@ -1267,9 +1267,9 @@ if (empty($action) || $action == 'view') {
|
||||
$accounttoshowsubledger = length_accounta($k);
|
||||
if ($accounttoshow != $accounttoshowsubledger) {
|
||||
if (empty($accounttoshowsubledger) || $accounttoshowsubledger == 'NotDefined') {
|
||||
/*var_dump($tabpay[$key]);
|
||||
var_dump($tabtype[$key]);
|
||||
var_dump($tabbq[$key]);*/
|
||||
//var_dump($tabpay[$key]);
|
||||
//var_dump($tabtype[$key]);
|
||||
//var_dump($tabbq[$key]);
|
||||
//print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
|
||||
if (!empty($tabcompany[$key]['code_compta'])) {
|
||||
if (in_array($tabtype[$key], array('payment_various', 'payment_salary'))) {
|
||||
|
||||
@ -418,9 +418,14 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||
$bookkeeping->thirdparty_code = $companystatic->code_client;
|
||||
|
||||
if ($k == getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT')) {
|
||||
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
|
||||
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
|
||||
if (!empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT)) {
|
||||
if ($k == getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT')) {
|
||||
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
|
||||
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
|
||||
} else {
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
}
|
||||
} else {
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
@ -897,12 +902,12 @@ if (empty($action) || $action == 'view') {
|
||||
print "</td>";
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
if ($k == getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT')) {
|
||||
if (($accountoshow == "") || $accountoshow == 'NotDefined') {
|
||||
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
|
||||
} else {
|
||||
if (!empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT)) {
|
||||
if ($k == getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT')) {
|
||||
print length_accounta($tabcompany[$key]['code_compta']);
|
||||
}
|
||||
} elseif (($accountoshow == "") || $accountoshow == 'NotDefined') {
|
||||
print '<span class="error">' . $langs->trans("ThirdpartyAccountNotDefined") . '</span>';
|
||||
}
|
||||
print '</td>';
|
||||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
|
||||
@ -43,17 +43,6 @@ if ($in_bookkeeping == '') {
|
||||
$in_bookkeeping = 'notyet';
|
||||
}
|
||||
|
||||
// Security check
|
||||
if (empty($conf->accounting->enabled)) {
|
||||
accessforbidden();
|
||||
}
|
||||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (empty($user->rights->accounting->mouvements->lire)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
// Get information of journal
|
||||
$object = new AccountingJournal($db);
|
||||
$result = $object->fetch($id_journal);
|
||||
@ -65,7 +54,7 @@ if ($result > 0) {
|
||||
accessforbidden($langs->trans('ErrorRecordNotFound'));
|
||||
}
|
||||
|
||||
$hookmanager->initHooks(array('globaljournal', $object->nature_text . 'journal'));
|
||||
$hookmanager->initHooks(array('globaljournal', $object->nature.'journal'));
|
||||
$parameters = array();
|
||||
|
||||
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
|
||||
@ -93,6 +82,18 @@ if (!is_array($journal_data)) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
// Security check
|
||||
if (empty($conf->accounting->enabled)) {
|
||||
accessforbidden();
|
||||
}
|
||||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (empty($user->rights->accounting->mouvements->lire)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2013-2021 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>s
|
||||
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
@ -47,6 +48,7 @@ $show_files = GETPOST('show_files', 'int');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
$default_account = GETPOST('default_account', 'int');
|
||||
|
||||
// Select Box
|
||||
$mesCasesCochees = GETPOST('toselect', 'array');
|
||||
@ -442,12 +444,15 @@ if ($result) {
|
||||
|
||||
$arrayofmassactions = array(
|
||||
'ventil'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Ventilate")
|
||||
,'set_default_account'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("ConfirmPreselectAccount")
|
||||
//'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
|
||||
//'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
|
||||
);
|
||||
//if ($user->rights->mymodule->supprimer) $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
|
||||
//if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton = $form->selectMassAction('ventil', $arrayofmassactions, 1);
|
||||
if ($massaction !== 'set_default_account') {
|
||||
$massactionbutton = $form->selectMassAction('ventil', $arrayofmassactions, 1);
|
||||
}
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">'."\n";
|
||||
print '<input type="hidden" name="action" value="ventil">';
|
||||
@ -462,6 +467,14 @@ if ($result) {
|
||||
|
||||
print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
|
||||
|
||||
if ($massaction == 'set_default_account') {
|
||||
$formquestion[]=array('type' => 'other',
|
||||
'name' => 'set_default_account',
|
||||
'label' => $langs->trans("AccountancyCode"),
|
||||
'value' => $formaccounting->select_account('', 'default_account', 1, array(), 0, 0, 'maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone'));
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmPreselectAccount"), $langs->trans("ConfirmPreselectAccountQuestion", count($toselect)), "confirm_set_default_account", $formquestion, 1, 0, 200, 500, 1);
|
||||
}
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("DescVentilTodoCustomer").'</span></br><br>';
|
||||
|
||||
if ($msg) {
|
||||
@ -736,7 +749,7 @@ if ($result) {
|
||||
|
||||
// Suggested accounting account
|
||||
print '<td>';
|
||||
print $formaccounting->select_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 maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone');
|
||||
print '</td>';
|
||||
|
||||
// Column with checkbox
|
||||
@ -745,6 +758,14 @@ if ($result) {
|
||||
if (!empty($suggestedid) && $suggestedaccountingaccountfor != '' && $suggestedaccountingaccountfor != 'eecwithoutvatnumber') {
|
||||
$ischecked = 1;
|
||||
}
|
||||
|
||||
if (!empty($toselect)) {
|
||||
$ischecked = 0;
|
||||
if (in_array($objp->rowid."_".$i, $toselect)) {
|
||||
$ischecked=1;
|
||||
}
|
||||
}
|
||||
|
||||
print '<input type="checkbox" class="flat checkforselect checkforselect'.$facturefourn_static_det->id.'" name="toselect[]" value="'.$facturefourn_static_det->id."_".$i.'"'.($ischecked ? " checked" : "").'/>';
|
||||
print '</td>';
|
||||
|
||||
|
||||
@ -64,7 +64,7 @@ if ($action == 'set_default') {
|
||||
} elseif ($action == 'del_default') {
|
||||
$ret = delDocumentModel($value, $type);
|
||||
if ($ret > 0) {
|
||||
if ($conf->global->MEMBER_ADDON_PDF_ODT == "$value") {
|
||||
if (getDolGlobalString('MEMBER_ADDON_PDF_ODT') == "$value") {
|
||||
dolibarr_del_const($db, 'MEMBER_ADDON_PDF_ODT', $conf->entity);
|
||||
}
|
||||
}
|
||||
|
||||
@ -95,12 +95,13 @@ if ($action == 'update') {
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$title = $langs->trans("MembersSetup");
|
||||
$help_url = 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros';
|
||||
llxHeader('', $langs->trans("MembersSetup"), $help_url);
|
||||
llxHeader('', $title, $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("MembersSetup"), $linkback, 'title_setup');
|
||||
print load_fiche_titre($title, $linkback, 'title_setup');
|
||||
|
||||
$head = member_admin_prepare_head();
|
||||
|
||||
|
||||
@ -163,7 +163,7 @@ if ($object->id > 0) {
|
||||
|
||||
$newcardbutton = '';
|
||||
if (!empty($conf->agenda->enabled)) {
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage=1&origin=member&originid='.$id);
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']).($object->id > 0 ? '?id='.$object->id : '').'&origin=member&originid='.$id);
|
||||
}
|
||||
|
||||
if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
|
||||
|
||||
@ -1286,7 +1286,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
print '</td></tr>';
|
||||
|
||||
// EMail
|
||||
print '<tr><td>'.($conf->global->ADHERENT_MAIL_REQUIRED ? '<span class="fieldrequired">' : '').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED ? '</span>' : '').'</td>';
|
||||
print '<tr><td>'.(getDolGlobalString("ADHERENT_MAIL_REQUIRED") ? '<span class="fieldrequired">' : '').$langs->trans("EMail").(getDolGlobalString("ADHERENT_MAIL_REQUIRED") ? '</span>' : '').'</td>';
|
||||
print '<td>'.img_picto('', 'object_email', 'class="pictofixedwidth"').'<input type="text" name="member_email" class="minwidth300" maxlength="255" value="'.(GETPOSTISSET("member_email") ? GETPOST("member_email", '', 2) : $object->email).'"></td></tr>';
|
||||
|
||||
// Website
|
||||
@ -2030,7 +2030,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
$MAX = 10;
|
||||
|
||||
$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-list-alt imgforviewmode', DOL_URL_ROOT.'/adherents/agenda.php?id='.$object->id);
|
||||
$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/adherents/agenda.php?id='.$object->id);
|
||||
|
||||
// List of actions on element
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
|
||||
|
||||
@ -490,17 +490,17 @@ class Subscription extends CommonObject
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'subscription as c';
|
||||
$sql .= ' WHERE c.rowid = '.((int) $id);
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
if ($this->db->num_rows($result)) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
if ($this->db->num_rows($resql)) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$this->id = $obj->rowid;
|
||||
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
$this->date_modification = $this->db->jdate($obj->datem);
|
||||
}
|
||||
|
||||
$this->db->free($result);
|
||||
$this->db->free($resql);
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
|
||||
@ -99,12 +99,12 @@ $sql .= " WHERE t.entity IN (".getEntity('member_type').")";
|
||||
$sql .= " GROUP BY t.rowid, t.libelle, t.subscription, d.statut";
|
||||
|
||||
dol_syslog("index.php::select nb of members per type", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$objp = $db->fetch_object($result);
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
$adhtype = new AdherentType($db);
|
||||
$adhtype->id = $objp->rowid;
|
||||
@ -127,7 +127,7 @@ if ($result) {
|
||||
|
||||
$i++;
|
||||
}
|
||||
$db->free($result);
|
||||
$db->free($resql);
|
||||
}
|
||||
|
||||
$now = dol_now();
|
||||
@ -143,16 +143,16 @@ $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);
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$objp = $db->fetch_object($result);
|
||||
$objp = $db->fetch_object($resql);
|
||||
$MembersUpToDate[$objp->fk_adherent_type] = $objp->somme;
|
||||
$i++;
|
||||
}
|
||||
$db->free();
|
||||
$db->free($resql);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@ -215,7 +215,7 @@ if (empty($reshook)) {
|
||||
$search_status = "";
|
||||
$catid = "";
|
||||
$sall = "";
|
||||
$toselect = '';
|
||||
$toselect = array();
|
||||
$search_array_options = array();
|
||||
}
|
||||
|
||||
@ -305,6 +305,8 @@ $formother = new FormOther($db);
|
||||
$membertypestatic = new AdherentType($db);
|
||||
$memberstatic = new Adherent($db);
|
||||
|
||||
$title = $langs->trans("Members");
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
if ((!empty($search_categ) && $search_categ > 0) || !empty($catid)) {
|
||||
@ -471,42 +473,41 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $
|
||||
exit;
|
||||
}
|
||||
|
||||
llxHeader('', $langs->trans("Member"), 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros');
|
||||
llxHeader('', $title, 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros');
|
||||
|
||||
$titre = $langs->trans("MembersList");
|
||||
if (GETPOSTISSET("search_status")) {
|
||||
if ($search_status == '-1,1') { // TODO : check this test as -1 == Adherent::STATUS_DRAFT and -2 == Adherent::STATUS_EXLCUDED
|
||||
$titre = $langs->trans("MembersListQualified");
|
||||
$title = $langs->trans("MembersListQualified");
|
||||
}
|
||||
if ($search_status == Adherent::STATUS_DRAFT) {
|
||||
$titre = $langs->trans("MembersListToValid");
|
||||
$title = $langs->trans("MembersListToValid");
|
||||
}
|
||||
if ($search_status == Adherent::STATUS_VALIDATED && $filter == '') {
|
||||
$titre = $langs->trans("MenuMembersValidated");
|
||||
$title = $langs->trans("MenuMembersValidated");
|
||||
}
|
||||
if ($search_status == Adherent::STATUS_VALIDATED && $filter == 'withoutsubscription') {
|
||||
$titre = $langs->trans("MembersWithSubscriptionToReceive");
|
||||
$title = $langs->trans("MembersWithSubscriptionToReceive");
|
||||
}
|
||||
if ($search_status == Adherent::STATUS_VALIDATED && $filter == 'uptodate') {
|
||||
$titre = $langs->trans("MembersListUpToDate");
|
||||
$title = $langs->trans("MembersListUpToDate");
|
||||
}
|
||||
if ($search_status == Adherent::STATUS_VALIDATED && $filter == 'outofdate') {
|
||||
$titre = $langs->trans("MembersListNotUpToDate");
|
||||
$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 ''
|
||||
$titre = $langs->trans("MembersListResiliated");
|
||||
$title = $langs->trans("MembersListResiliated");
|
||||
}
|
||||
if ($search_status == Adherent::STATUS_EXCLUDED) {
|
||||
$titre = $langs->trans("MembersListExcluded");
|
||||
$title = $langs->trans("MembersListExcluded");
|
||||
}
|
||||
} elseif ($action == 'search') {
|
||||
$titre = $langs->trans("MembersListQualified");
|
||||
$title = $langs->trans("MembersListQualified");
|
||||
}
|
||||
|
||||
if ($search_type > 0) {
|
||||
$membertype = new AdherentType($db);
|
||||
$result = $membertype->fetch($search_type);
|
||||
$titre .= " (".$membertype->label.")";
|
||||
$title .= " (".$membertype->label.")";
|
||||
}
|
||||
|
||||
$param = '';
|
||||
@ -623,7 +624,7 @@ print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
|
||||
print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
|
||||
|
||||
$topicmail = "Information";
|
||||
$modelmail = "member";
|
||||
|
||||
@ -85,11 +85,18 @@ $usercanclose = $user->rights->partnership->write; // Used by the include of
|
||||
$upload_dir = $conf->partnership->multidir_output[isset($object->entity) ? $object->entity : 1];
|
||||
|
||||
|
||||
if ($conf->global->PARTNERSHIP_IS_MANAGED_FOR != 'member') accessforbidden();
|
||||
if (empty($conf->partnership->enabled)) accessforbidden();
|
||||
if (empty($permissiontoread)) accessforbidden();
|
||||
if ($action == 'edit' && empty($permissiontoadd)) accessforbidden();
|
||||
|
||||
if (getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR') != 'member') {
|
||||
accessforbidden('Partnership module is not activated for members');
|
||||
}
|
||||
if (empty($conf->partnership->enabled)) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (empty($permissiontoread)) {
|
||||
accessforbidden();
|
||||
}
|
||||
if ($action == 'edit' && empty($permissiontoadd)) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (($action == 'update' || $action == 'edit') && $object->status != $object::STATUS_DRAFT) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
@ -135,7 +135,7 @@ if (empty($reshook)) {
|
||||
$search_note = "";
|
||||
$search_amount = "";
|
||||
$search_account = "";
|
||||
$toselect = '';
|
||||
$toselect = array();
|
||||
$search_array_options = array();
|
||||
}
|
||||
}
|
||||
|
||||
@ -173,6 +173,9 @@ if (!empty($triggers)) {
|
||||
if ($module == 'contact') {
|
||||
$module = 'societe';
|
||||
}
|
||||
if ($module == 'facturerec') {
|
||||
$module = 'facture';
|
||||
}
|
||||
|
||||
// If 'element' value is myobject@mymodule instead of mymodule
|
||||
$tmparray = explode('@', $module);
|
||||
|
||||
@ -101,7 +101,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
||||
$defaulturl = '';
|
||||
$defaultkey = '';
|
||||
$defaultvalue = '';
|
||||
$toselect = '';
|
||||
$toselect = array();
|
||||
$search_array_options = array();
|
||||
}
|
||||
|
||||
|
||||
@ -104,50 +104,50 @@ $taborder = array(9, 15, 30, 0, 4, 3, 2, 0, 1, 8, 19, 16, 39, 27, 40, 38, 0, 5,
|
||||
|
||||
// Name of SQL tables of dictionaries
|
||||
$tabname = array();
|
||||
$tabname[1] = MAIN_DB_PREFIX."c_forme_juridique";
|
||||
$tabname[2] = MAIN_DB_PREFIX."c_departements";
|
||||
$tabname[3] = MAIN_DB_PREFIX."c_regions";
|
||||
$tabname[4] = MAIN_DB_PREFIX."c_country";
|
||||
$tabname[5] = MAIN_DB_PREFIX."c_civility";
|
||||
$tabname[6] = MAIN_DB_PREFIX."c_actioncomm";
|
||||
$tabname[7] = MAIN_DB_PREFIX."c_chargesociales";
|
||||
$tabname[8] = MAIN_DB_PREFIX."c_typent";
|
||||
$tabname[9] = MAIN_DB_PREFIX."c_currencies";
|
||||
$tabname[10] = MAIN_DB_PREFIX."c_tva";
|
||||
$tabname[11] = MAIN_DB_PREFIX."c_type_contact";
|
||||
$tabname[12] = MAIN_DB_PREFIX."c_payment_term";
|
||||
$tabname[13] = MAIN_DB_PREFIX."c_paiement";
|
||||
$tabname[14] = MAIN_DB_PREFIX."c_ecotaxe";
|
||||
$tabname[15] = MAIN_DB_PREFIX."c_paper_format";
|
||||
$tabname[16] = MAIN_DB_PREFIX."c_prospectlevel";
|
||||
$tabname[17] = MAIN_DB_PREFIX."c_type_fees";
|
||||
$tabname[18] = MAIN_DB_PREFIX."c_shipment_mode";
|
||||
$tabname[19] = MAIN_DB_PREFIX."c_effectif";
|
||||
$tabname[20] = MAIN_DB_PREFIX."c_input_method";
|
||||
$tabname[21] = MAIN_DB_PREFIX."c_availability";
|
||||
$tabname[22] = MAIN_DB_PREFIX."c_input_reason";
|
||||
$tabname[23] = MAIN_DB_PREFIX."c_revenuestamp";
|
||||
$tabname[24] = MAIN_DB_PREFIX."c_type_resource";
|
||||
$tabname[25] = MAIN_DB_PREFIX."c_type_container";
|
||||
//$tabname[26]= MAIN_DB_PREFIX."c_units";
|
||||
$tabname[27] = MAIN_DB_PREFIX."c_stcomm";
|
||||
$tabname[28] = MAIN_DB_PREFIX."c_holiday_types";
|
||||
$tabname[29] = MAIN_DB_PREFIX."c_lead_status";
|
||||
$tabname[30] = MAIN_DB_PREFIX."c_format_cards";
|
||||
//$tabname[31]= MAIN_DB_PREFIX."accounting_system";
|
||||
$tabname[32] = MAIN_DB_PREFIX."c_hrm_public_holiday";
|
||||
$tabname[33] = MAIN_DB_PREFIX."c_hrm_department";
|
||||
$tabname[34] = MAIN_DB_PREFIX."c_hrm_function";
|
||||
$tabname[35] = MAIN_DB_PREFIX."c_exp_tax_cat";
|
||||
$tabname[36] = MAIN_DB_PREFIX."c_exp_tax_range";
|
||||
$tabname[37] = MAIN_DB_PREFIX."c_units";
|
||||
$tabname[38] = MAIN_DB_PREFIX."c_socialnetworks";
|
||||
$tabname[39] = MAIN_DB_PREFIX."c_prospectcontactlevel";
|
||||
$tabname[40] = MAIN_DB_PREFIX."c_stcommcontact";
|
||||
$tabname[41] = MAIN_DB_PREFIX."c_transport_mode";
|
||||
$tabname[42] = MAIN_DB_PREFIX."c_product_nature";
|
||||
$tabname[43] = MAIN_DB_PREFIX."c_productbatch_qcstatus";
|
||||
$tabname[44] = MAIN_DB_PREFIX."c_asset_disposal_type";
|
||||
$tabname[1] = "c_forme_juridique";
|
||||
$tabname[2] = "c_departements";
|
||||
$tabname[3] = "c_regions";
|
||||
$tabname[4] = "c_country";
|
||||
$tabname[5] = "c_civility";
|
||||
$tabname[6] = "c_actioncomm";
|
||||
$tabname[7] = "c_chargesociales";
|
||||
$tabname[8] = "c_typent";
|
||||
$tabname[9] = "c_currencies";
|
||||
$tabname[10] = "c_tva";
|
||||
$tabname[11] = "c_type_contact";
|
||||
$tabname[12] = "c_payment_term";
|
||||
$tabname[13] = "c_paiement";
|
||||
$tabname[14] = "c_ecotaxe";
|
||||
$tabname[15] = "c_paper_format";
|
||||
$tabname[16] = "c_prospectlevel";
|
||||
$tabname[17] = "c_type_fees";
|
||||
$tabname[18] = "c_shipment_mode";
|
||||
$tabname[19] = "c_effectif";
|
||||
$tabname[20] = "c_input_method";
|
||||
$tabname[21] = "c_availability";
|
||||
$tabname[22] = "c_input_reason";
|
||||
$tabname[23] = "c_revenuestamp";
|
||||
$tabname[24] = "c_type_resource";
|
||||
$tabname[25] = "c_type_container";
|
||||
//$tabname[26]= "c_units";
|
||||
$tabname[27] = "c_stcomm";
|
||||
$tabname[28] = "c_holiday_types";
|
||||
$tabname[29] = "c_lead_status";
|
||||
$tabname[30] = "c_format_cards";
|
||||
//$tabname[31]= "accounting_system";
|
||||
$tabname[32] = "c_hrm_public_holiday";
|
||||
$tabname[33] = "c_hrm_department";
|
||||
$tabname[34] = "c_hrm_function";
|
||||
$tabname[35] = "c_exp_tax_cat";
|
||||
$tabname[36] = "c_exp_tax_range";
|
||||
$tabname[37] = "c_units";
|
||||
$tabname[38] = "c_socialnetworks";
|
||||
$tabname[39] = "c_prospectcontactlevel";
|
||||
$tabname[40] = "c_stcommcontact";
|
||||
$tabname[41] = "c_transport_mode";
|
||||
$tabname[42] = "c_product_nature";
|
||||
$tabname[43] = "c_productbatch_qcstatus";
|
||||
$tabname[44] = "c_asset_disposal_type";
|
||||
|
||||
// Dictionary labels
|
||||
$tablib = array();
|
||||
@ -209,7 +209,7 @@ $tabsql[8] = "SELECT t.id as rowid, t.code as code, t.libelle, t.fk_country as
|
||||
$tabsql[9] = "SELECT c.code_iso as code, c.label, c.unicode, c.active FROM ".MAIN_DB_PREFIX."c_currencies AS c";
|
||||
$tabsql[10] = "SELECT t.rowid, t.code, t.taux, t.localtax1_type, t.localtax1, t.localtax2_type, t.localtax2, c.label as country, c.code as country_code, t.fk_pays as country_id, t.recuperableonly, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid";
|
||||
$tabsql[11] = "SELECT t.rowid as rowid, t.element, t.source, t.code, t.libelle, t.position, t.active FROM ".MAIN_DB_PREFIX."c_type_contact AS t";
|
||||
$tabsql[12] = "SELECT c.rowid as rowid, c.code, c.libelle, c.libelle_facture, c.nbjour, c.type_cdr, c.decalage, c.active, c.sortorder, c.entity FROM ".MAIN_DB_PREFIX."c_payment_term AS c WHERE c.entity = ".getEntity($tabname[12]);
|
||||
$tabsql[12] = "SELECT c.rowid as rowid, c.code, c.libelle, c.libelle_facture, c.deposit_percent, c.nbjour, c.type_cdr, c.decalage, c.active, c.sortorder, c.entity FROM ".MAIN_DB_PREFIX."c_payment_term AS c WHERE c.entity = ".getEntity($tabname[12]);
|
||||
$tabsql[13] = "SELECT c.id as rowid, c.code, c.libelle, c.type, c.active, c.entity FROM ".MAIN_DB_PREFIX."c_paiement AS c WHERE c.entity = ".getEntity($tabname[13]);
|
||||
$tabsql[14] = "SELECT e.rowid as rowid, e.code as code, e.label, e.price, e.organization, e.fk_pays as country_id, c.code as country_code, c.label as country, e.active FROM ".MAIN_DB_PREFIX."c_ecotaxe AS e, ".MAIN_DB_PREFIX."c_country as c WHERE e.fk_pays=c.rowid and c.active=1";
|
||||
$tabsql[15] = "SELECT rowid as rowid, code, label as libelle, width, height, unit, active FROM ".MAIN_DB_PREFIX."c_paper_format";
|
||||
@ -265,7 +265,7 @@ $tabsqlsort[17] = "code ASC";
|
||||
$tabsqlsort[18] = "code ASC, libelle ASC";
|
||||
$tabsqlsort[19] = "id ASC";
|
||||
$tabsqlsort[20] = "code ASC, libelle ASC";
|
||||
$tabsqlsort[21] = "code ASC, label ASC, position ASC, type_duration ASC, qty ASC";
|
||||
$tabsqlsort[21] = "position ASC, type_duration ASC, qty ASC";
|
||||
$tabsqlsort[22] = "code ASC, label ASC";
|
||||
$tabsqlsort[23] = "country ASC, taux ASC";
|
||||
$tabsqlsort[24] = "code ASC, label ASC";
|
||||
@ -303,7 +303,7 @@ $tabfield[8] = "code,libelle,country_id,country".(!empty($conf->global->SOCIETE_
|
||||
$tabfield[9] = "code,label,unicode";
|
||||
$tabfield[10] = "country_id,country,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note";
|
||||
$tabfield[11] = "element,source,code,libelle,position";
|
||||
$tabfield[12] = "code,libelle,libelle_facture,nbjour,type_cdr,decalage,sortorder,entity";
|
||||
$tabfield[12] = "code,libelle,libelle_facture,deposit_percent,nbjour,type_cdr,decalage,sortorder,entity";
|
||||
$tabfield[13] = "code,libelle,type,entity";
|
||||
$tabfield[14] = "code,label,price,organization,country";
|
||||
$tabfield[15] = "code,libelle,width,height,unit";
|
||||
@ -350,7 +350,7 @@ $tabfieldvalue[8] = "code,libelle,country".(!empty($conf->global->SOCIETE_SORT_O
|
||||
$tabfieldvalue[9] = "code,label,unicode";
|
||||
$tabfieldvalue[10] = "country,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note";
|
||||
$tabfieldvalue[11] = "element,source,code,libelle,position";
|
||||
$tabfieldvalue[12] = "code,libelle,libelle_facture,nbjour,type_cdr,decalage,sortorder";
|
||||
$tabfieldvalue[12] = "code,libelle,libelle_facture,deposit_percent,nbjour,type_cdr,decalage,sortorder";
|
||||
$tabfieldvalue[13] = "code,libelle,type";
|
||||
$tabfieldvalue[14] = "code,label,price,organization,country";
|
||||
$tabfieldvalue[15] = "code,libelle,width,height,unit";
|
||||
@ -397,7 +397,7 @@ $tabfieldinsert[8] = "code,libelle,fk_country".(!empty($conf->global->SOCIETE_SO
|
||||
$tabfieldinsert[9] = "code_iso,label,unicode";
|
||||
$tabfieldinsert[10] = "fk_pays,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note";
|
||||
$tabfieldinsert[11] = "element,source,code,libelle,position";
|
||||
$tabfieldinsert[12] = "code,libelle,libelle_facture,nbjour,type_cdr,decalage,sortorder,entity";
|
||||
$tabfieldinsert[12] = "code,libelle,libelle_facture,deposit_percent,nbjour,type_cdr,decalage,sortorder,entity";
|
||||
$tabfieldinsert[13] = "code,libelle,type,entity";
|
||||
$tabfieldinsert[14] = "code,label,price,organization,fk_pays";
|
||||
$tabfieldinsert[15] = "code,label,width,height,unit";
|
||||
@ -528,112 +528,90 @@ $tabcond[42] = !empty($conf->product->enabled);
|
||||
$tabcond[43] = !empty($conf->product->enabled) && !empty($conf->productbatch->enabled) && $conf->global->MAIN_FEATURES_LEVEL >= 2;
|
||||
$tabcond[44] = !empty($conf->asset->enabled);
|
||||
|
||||
// List of help for fields
|
||||
// List of help for fields (no more used, help is defined into tabcomplete)
|
||||
$tabhelp = array();
|
||||
$tabhelp[1] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[2] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[3] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[4] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[5] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[6] = array('code'=>$langs->trans("EnterAnyCode"), 'color'=>$langs->trans("ColorFormat"), 'position'=>$langs->trans("PositionIntoComboList"));
|
||||
$tabhelp[7] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[8] = array('code'=>$langs->trans("EnterAnyCode"), 'position'=>$langs->trans("PositionIntoComboList"));
|
||||
$tabhelp[9] = array('code'=>$langs->trans("EnterAnyCode"), 'unicode'=>$langs->trans("UnicodeCurrency"));
|
||||
$tabhelp[10] = array('code'=>$langs->trans("EnterAnyCode"), 'taux'=>$langs->trans("SellTaxRate"), 'recuperableonly'=>$langs->trans("RecuperableOnly"), 'localtax1_type'=>$langs->trans("LocalTaxDesc"), 'localtax2_type'=>$langs->trans("LocalTaxDesc"));
|
||||
$tabhelp[11] = array('code'=>$langs->trans("EnterAnyCode"), 'position'=>$langs->trans("PositionIntoComboList"));
|
||||
$tabhelp[12] = array('code'=>$langs->trans("EnterAnyCode"), 'type_cdr'=>$langs->trans("TypeCdr", $langs->transnoentitiesnoconv("NbOfDays"), $langs->transnoentitiesnoconv("Offset"), $langs->transnoentitiesnoconv("NbOfDays"), $langs->transnoentitiesnoconv("Offset")));
|
||||
$tabhelp[13] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[14] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[15] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[16] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[17] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[18] = array('code'=>$langs->trans("EnterAnyCode"), 'tracking'=>$langs->trans("UrlTrackingDesc"));
|
||||
$tabhelp[19] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[20] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[21] = array('code'=>$langs->trans("EnterAnyCode"), 'position'=>$langs->trans("PositionIntoComboList"));
|
||||
$tabhelp[22] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[23] = array('revenuestamp_type'=>'FixedOrPercent');
|
||||
$tabhelp[24] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[25] = array('code'=>$langs->trans('EnterAnyCode'));
|
||||
//$tabhelp[26] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[27] = array('code'=>$langs->trans("EnterAnyCode"), 'picto'=>$langs->trans("PictoHelp"));
|
||||
$tabhelp[28] = array('affect'=>$langs->trans("FollowedByACounter"), 'delay'=>$langs->trans("MinimumNoticePeriod"), 'newbymonth'=>$langs->trans("NbAddedAutomatically"));
|
||||
$tabhelp[29] = array('code'=>$langs->trans("EnterAnyCode"), 'percent'=>$langs->trans("OpportunityPercent"), 'position'=>$langs->trans("PositionIntoComboList"));
|
||||
$tabhelp[30] = array('code'=>$langs->trans("EnterAnyCode"), 'name'=>$langs->trans("LabelName"), 'paper_size'=>$langs->trans("LabelPaperSize"));
|
||||
//$tabhelp[31] = array('pcg_version'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[32] = array('code'=>$langs->trans("EnterAnyCode"), 'dayrule'=>"Keep empty for a date defined with month and day (most common case).<br>Use a keyword like 'easter', 'eastermonday', ... for a date predefined by complex rules.", 'country'=>$langs->trans("CountryIfSpecificToOneCountry"), 'year'=>$langs->trans("ZeroMeansEveryYear"));
|
||||
$tabhelp[33] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[34] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[35] = array();
|
||||
$tabhelp[36] = array('range_ik'=>$langs->trans('PrevRangeToThisRange'));
|
||||
$tabhelp[37] = array('code'=>$langs->trans("EnterAnyCode"), 'unit_type' => $langs->trans('Measuringtype_durationDesc'), 'scale' => $langs->trans('MeasuringScaleDesc'));
|
||||
$tabhelp[38] = array('code'=>$langs->trans("EnterAnyCode"), 'url' => $langs->trans('UrlSocialNetworksDesc'), 'icon' => $langs->trans('FafaIconSocialNetworksDesc'));
|
||||
$tabhelp[39] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[40] = array('code'=>$langs->trans("EnterAnyCode"), 'picto'=>$langs->trans("PictoHelp"));
|
||||
$tabhelp[41] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[42] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[43] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[44] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
|
||||
// Table to store complete informations (will replace all other table). Key is table name.
|
||||
$tabcomplete = array(
|
||||
'c_forme_juridique'=>array('picto'=>'company'),
|
||||
'c_departements'=>array('picto'=>'state'),
|
||||
'c_regions'=>array('picto'=>'region'),
|
||||
'c_country'=>array('picto'=>'country'),
|
||||
'c_civility'=>array('picto'=>'contact'),
|
||||
'c_actioncomm'=>array('picto'=>'action'),
|
||||
'c_chargesociales'=>array('picto'=>'bill'),
|
||||
'c_typent'=>array('picto'=>'company'),
|
||||
'c_currencies'=>array('picto'=>'multicurrency'),
|
||||
'c_tva'=>array('picto'=>'bill'),
|
||||
'c_type_contact'=>array('picto'=>'contact'),
|
||||
'c_payment_term'=>array('picto'=>'bill'),
|
||||
'c_paiement'=>array('picto'=>'bill'),
|
||||
'c_ecotaxe'=>array('picto'=>'bill'),
|
||||
'c_paper_format'=>array('picto'=>'generic'),
|
||||
'c_prospectlevel'=>array('picto'=>'company'),
|
||||
'c_type_fees'=>array('picto'=>'trip'),
|
||||
'c_effectif'=>array('picto'=>'company'),
|
||||
'c_input_method'=>array('picto'=>'order'),
|
||||
'c_input_reason'=>array('picto'=>'order'),
|
||||
'c_availability'=>array('picto'=>'shipment'),
|
||||
'c_shipment_mode'=>array('picto'=>'shipment'),
|
||||
'c_revenuestamp'=>array('picto'=>'bill'),
|
||||
'c_type_resource'=>array('picto'=>'resource'),
|
||||
'c_type_container'=>array('picto'=>'website'),
|
||||
'c_stcomm'=>array('picto'=>'company'),
|
||||
'c_holiday_types'=>array('picto'=>'holiday'),
|
||||
'c_lead_status'=>array('picto'=>'project'),
|
||||
'c_format_cards'=>array('picto'=>'generic'),
|
||||
'c_hrm_public_holiday'=>array('picto'=>'holiday'),
|
||||
'c_hrm_department'=>array('picto'=>'hrm'),
|
||||
'c_hrm_function'=>array('picto'=>'hrm'),
|
||||
'c_exp_tax_cat'=>array('picto'=>'expensereport'),
|
||||
'c_exp_tax_range'=>array('picto'=>'expensereport'),
|
||||
'c_units'=>array('picto'=>'product'),
|
||||
'c_socialnetworks'=>array('picto'=>'share-alt'),
|
||||
'c_product_nature'=>array('picto'=>'product'),
|
||||
'c_transport_mode'=>array('picto'=>'incoterm'),
|
||||
'c_prospectcontactlevel'=>array('picto'=>'company'),
|
||||
'c_stcommcontact'=>array('picto'=>'company'),
|
||||
'c_product_nature'=>array('picto'=>'product'),
|
||||
'c_productbatch_qcstatus'=>array('picto'=>'lot'),
|
||||
'c_asset_disposal_type'=>array('picto'=>'asset'),
|
||||
|
||||
'c_forme_juridique'=>array('picto'=>'company', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
|
||||
'c_departements'=>array('picto'=>'state', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
|
||||
'c_regions'=>array('picto'=>'region', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
|
||||
'c_country'=>array('picto'=>'country', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
|
||||
'c_civility'=>array('picto'=>'contact', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
|
||||
'c_actioncomm'=>array('picto'=>'action', 'help'=>array('code'=>$langs->trans("EnterAnyCode"), 'color'=>$langs->trans("ColorFormat"), 'position'=>$langs->trans("PositionIntoComboList"))),
|
||||
'c_chargesociales'=>array('picto'=>'bill', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
|
||||
'c_typent'=>array('picto'=>'company', 'help'=>array('code'=>$langs->trans("EnterAnyCode"), 'position'=>$langs->trans("PositionIntoComboList"))),
|
||||
'c_currencies'=>array('picto'=>'multicurrency', 'help'=>array('code'=>$langs->trans("EnterAnyCode"), 'unicode'=>$langs->trans("UnicodeCurrency"))),
|
||||
'c_tva'=>array('picto'=>'bill', 'help'=>array('code'=>$langs->trans("EnterAnyCode"), 'taux'=>$langs->trans("SellTaxRate"), 'recuperableonly'=>$langs->trans("RecuperableOnly"), 'localtax1_type'=>$langs->trans("LocalTaxDesc"), 'localtax2_type'=>$langs->trans("LocalTaxDesc"))),
|
||||
'c_type_contact'=>array('picto'=>'contact', 'help'=>array('code'=>$langs->trans("EnterAnyCode"), 'position'=>$langs->trans("PositionIntoComboList"))),
|
||||
'c_payment_term'=>array('picto'=>'bill', 'help'=>array('code'=>$langs->trans("EnterAnyCode"), 'type_cdr'=>$langs->trans("TypeCdr", $langs->transnoentitiesnoconv("NbOfDays"), $langs->transnoentitiesnoconv("Offset"), $langs->transnoentitiesnoconv("NbOfDays"), $langs->transnoentitiesnoconv("Offset")))),
|
||||
'c_paiement'=>array('picto'=>'bill', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
|
||||
'c_ecotaxe'=>array('picto'=>'bill', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
|
||||
'c_paper_format'=>array('picto'=>'generic', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
|
||||
'c_prospectlevel'=>array('picto'=>'company', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
|
||||
'c_type_fees'=>array('picto'=>'trip', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
|
||||
'c_shipment_mode'=>array('picto'=>'shipment', 'help'=>array('code'=>$langs->trans("EnterAnyCode"), 'tracking'=>$langs->trans("UrlTrackingDesc"))),
|
||||
'c_effectif'=>array('picto'=>'company', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
|
||||
'c_input_method'=>array('picto'=>'order', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
|
||||
'c_input_reason'=>array('picto'=>'order', 'help'=>array('code'=>$langs->trans("EnterAnyCode"), 'position'=>$langs->trans("PositionIntoComboList"))),
|
||||
'c_availability'=>array('picto'=>'shipment', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
|
||||
'c_revenuestamp'=>array('picto'=>'bill', 'help'=>array('revenuestamp_type'=>$langs->trans('FixedOrPercent'))),
|
||||
'c_type_resource'=>array('picto'=>'resource', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
|
||||
'c_type_container'=>array('picto'=>'website', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
|
||||
'c_stcomm'=>array('picto'=>'company', 'help'=>array('code'=>$langs->trans("EnterAnyCode"), 'picto'=>$langs->trans("PictoHelp"))),
|
||||
'c_holiday_types'=>array('picto'=>'holiday', 'help'=>array('affect'=>$langs->trans("FollowedByACounter"), 'delay'=>$langs->trans("MinimumNoticePeriod"), 'newbymonth'=>$langs->trans("NbAddedAutomatically"))),
|
||||
'c_lead_status'=>array('picto'=>'project', 'help'=>array('code'=>$langs->trans("EnterAnyCode"), 'percent'=>$langs->trans("OpportunityPercent"), 'position'=>$langs->trans("PositionIntoComboList"))),
|
||||
'c_format_cards'=>array('picto'=>'generic', 'help'=>array('code'=>$langs->trans("EnterAnyCode"), 'name'=>$langs->trans("LabelName"), 'paper_size'=>$langs->trans("LabelPaperSize"))),
|
||||
'c_hrm_public_holiday'=>array('picto'=>'holiday', 'help'=>array('code'=>$langs->trans("EnterAnyCode"), 'dayrule'=>"Keep empty for a date defined with month and day (most common case).<br>Use a keyword like 'easter', 'eastermonday', ... for a date predefined by complex rules.", 'country'=>$langs->trans("CountryIfSpecificToOneCountry"), 'year'=>$langs->trans("ZeroMeansEveryYear"))),
|
||||
'c_hrm_department'=>array('picto'=>'hrm', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
|
||||
'c_hrm_function'=>array('picto'=>'hrm', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
|
||||
'c_exp_tax_cat'=>array('picto'=>'expensereport', 'help'=>array()),
|
||||
'c_exp_tax_range'=>array('picto'=>'expensereport', 'help'=>array('range_ik'=>$langs->trans('PrevRangeToThisRange'))),
|
||||
'c_units'=>array('picto'=>'product', 'help'=>array('code'=>$langs->trans("EnterAnyCode"), 'unit_type' => $langs->trans('Measuringtype_durationDesc'), 'scale' => $langs->trans('MeasuringScaleDesc'))),
|
||||
'c_socialnetworks'=>array('picto'=>'share-alt', 'help'=>array('code'=>$langs->trans("EnterAnyCode"), 'url' => $langs->trans('UrlSocialNetworksDesc'), 'icon' => $langs->trans('FafaIconSocialNetworksDesc'))),
|
||||
'c_prospectcontactlevel'=>array('picto'=>'company', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
|
||||
'c_stcommcontact'=>array('picto'=>'company', 'help'=>array('code'=>$langs->trans("EnterAnyCode"), 'picto'=>$langs->trans("PictoHelp"))),
|
||||
'c_transport_mode'=>array('picto'=>'incoterm', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
|
||||
'c_product_nature'=>array('picto'=>'product', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
|
||||
'c_productbatch_qcstatus'=>array('picto'=>'lot', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
|
||||
'c_asset_disposal_type'=>array('picto'=>'asset', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
|
||||
);
|
||||
|
||||
|
||||
// Complete all arrays with entries found into modules
|
||||
complete_dictionary_with_modules($taborder, $tabname, $tablib, $tabsql, $tabsqlsort, $tabfield, $tabfieldvalue, $tabfieldinsert, $tabrowid, $tabcond, $tabhelp, $tabcomplete);
|
||||
|
||||
// Complete the table $tabcomplete
|
||||
$i = 0;
|
||||
foreach ($tabcomplete as $key => $value) {
|
||||
$i++;
|
||||
$tabcomplete[$key]['id'] = $i;
|
||||
$tabcomplete[$key]['cond'] = $tabcond[$i];
|
||||
$tabcomplete[$key]['rowid'] = $tabrowid[$i];
|
||||
$tabcomplete[$key]['fieldinsert'] = $tabfieldinsert[$i];
|
||||
$tabcomplete[$key]['fieldvalue'] = $tabfieldvalue[$i];
|
||||
$tabcomplete[$key]['lib'] = $tablib[$i];
|
||||
$tabcomplete[$key]['sql'] = $tabsql[$i];
|
||||
$tabcomplete[$key]['sqlsort'] = $tabsqlsort[$i];
|
||||
$tabcomplete[$key]['field'] = $tabfield[$i];
|
||||
}
|
||||
|
||||
$keytable = '';
|
||||
if ($id > 0) {
|
||||
$arrayofkeys = array_keys($tabcomplete);
|
||||
$keytable = $arrayofkeys[$id - 1];
|
||||
}
|
||||
|
||||
// Defaut sortorder
|
||||
if (empty($sortfield)) {
|
||||
$tmp1 = explode(',', empty($tabsqlsort[$id]) ? '' : $tabsqlsort[$id]);
|
||||
$tmp1 = explode(',', empty($tabcomplete[$keytable]['sqlsort']) ? '' : $tabcomplete[$keytable]['sqlsort']);
|
||||
$tmp2 = explode(' ', $tmp1[0]);
|
||||
$sortfield = preg_replace('/^.*\./', '', $tmp2[0]);
|
||||
$sortorder = $tmp2[1];
|
||||
//var_dump($sortfield);var_dump($sortorder);
|
||||
}
|
||||
|
||||
|
||||
// Define elementList and sourceList (used for dictionary type of contacts "llx_c_type_contact")
|
||||
$elementList = array();
|
||||
$sourceList = array();
|
||||
@ -675,25 +653,22 @@ if ($id == 11) {
|
||||
}
|
||||
|
||||
// Define localtax_typeList (used for dictionary "llx_c_tva")
|
||||
$localtax_typeList = array();
|
||||
if ($id == 10) {
|
||||
$localtax_typeList = array(
|
||||
"0" => $langs->trans("No"),
|
||||
"1" => $langs->trans("Yes").' ('.$langs->trans("Type")." 1)", //$langs->trans("%ageOnAllWithoutVAT"),
|
||||
"2" => $langs->trans("Yes").' ('.$langs->trans("Type")." 2)", //$langs->trans("%ageOnAllBeforeVAT"),
|
||||
"3" => $langs->trans("Yes").' ('.$langs->trans("Type")." 3)", //$langs->trans("%ageOnProductsWithoutVAT"),
|
||||
"4" => $langs->trans("Yes").' ('.$langs->trans("Type")." 4)", //$langs->trans("%ageOnProductsBeforeVAT"),
|
||||
"5" => $langs->trans("Yes").' ('.$langs->trans("Type")." 5)", //$langs->trans("%ageOnServiceWithoutVAT"),
|
||||
"6" => $langs->trans("Yes").' ('.$langs->trans("Type")." 6)" //$langs->trans("%ageOnServiceBeforeVAT"),
|
||||
);
|
||||
}
|
||||
|
||||
$localtax_typeList = array(
|
||||
"0" => $langs->trans("No"),
|
||||
"1" => $langs->trans("Yes").' ('.$langs->trans("Type")." 1)", //$langs->trans("%ageOnAllWithoutVAT"),
|
||||
"2" => $langs->trans("Yes").' ('.$langs->trans("Type")." 2)", //$langs->trans("%ageOnAllBeforeVAT"),
|
||||
"3" => $langs->trans("Yes").' ('.$langs->trans("Type")." 3)", //$langs->trans("%ageOnProductsWithoutVAT"),
|
||||
"4" => $langs->trans("Yes").' ('.$langs->trans("Type")." 4)", //$langs->trans("%ageOnProductsBeforeVAT"),
|
||||
"5" => $langs->trans("Yes").' ('.$langs->trans("Type")." 5)", //$langs->trans("%ageOnServiceWithoutVAT"),
|
||||
"6" => $langs->trans("Yes").' ('.$langs->trans("Type")." 6)" //$langs->trans("%ageOnServiceBeforeVAT"),
|
||||
);
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
$object = new stdClass();
|
||||
$parameters = array(
|
||||
'id' =>$id,
|
||||
'rowid' =>$rowid,
|
||||
@ -761,7 +736,7 @@ if (empty($reshook)) {
|
||||
continue; // For a column name 'sortorder', we use the field name 'position'
|
||||
}
|
||||
if ((!GETPOSTISSET($value) || GETPOST($value) == '')
|
||||
&& (!in_array($value, array('decalage', 'module', 'accountancy_code', 'accountancy_code_sell', 'accountancy_code_buy', 'tracking', 'picto')) // Fields that are not mandatory
|
||||
&& (!in_array($value, array('decalage', 'module', 'accountancy_code', 'accountancy_code_sell', 'accountancy_code_buy', 'tracking', 'picto', 'deposit_percent')) // Fields that are not mandatory
|
||||
&& ($id != 10 || ($value != 'code' && $value != 'note')) // Field code and note is not mandatory for dictionary table 10
|
||||
)
|
||||
) {
|
||||
@ -774,6 +749,9 @@ if (empty($reshook)) {
|
||||
if ($fieldnamekey == 'libelle_facture') {
|
||||
$fieldnamekey = 'LabelOnDocuments';
|
||||
}
|
||||
if ($fieldnamekey == 'deposit_percent') {
|
||||
$fieldnamekey = 'DepositPercent';
|
||||
}
|
||||
if ($fieldnamekey == 'nbjour') {
|
||||
$fieldnamekey = 'NbOfDays';
|
||||
}
|
||||
@ -817,11 +795,11 @@ if (empty($reshook)) {
|
||||
$fieldnamekey = 'UseByDefault';
|
||||
}
|
||||
|
||||
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
|
||||
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
|
||||
}
|
||||
}
|
||||
// Other checks
|
||||
if (GETPOST('actionadd') && $tabname[$id] == MAIN_DB_PREFIX."c_actioncomm" && GETPOSTISSET("type") && in_array(GETPOST("type"), array('system', 'systemauto'))) {
|
||||
if (GETPOST('actionadd') && $tabname[$id] == "c_actioncomm" && GETPOSTISSET("type") && in_array(GETPOST("type"), array('system', 'systemauto'))) {
|
||||
$ok = 0;
|
||||
setEventMessages($langs->transnoentities('ErrorReservedTypeSystemSystemAuto'), null, 'errors');
|
||||
}
|
||||
@ -869,7 +847,7 @@ if (empty($reshook)) {
|
||||
if ($tabrowid[$id]) {
|
||||
// Get free id for insert
|
||||
$newid = 0;
|
||||
$sql = "SELECT max(".$tabrowid[$id].") newid from ".$tabname[$id];
|
||||
$sql = "SELECT MAX(".$tabrowid[$id].") as newid FROM ".MAIN_DB_PREFIX.$tabname[$id];
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$obj = $db->fetch_object($result);
|
||||
@ -880,7 +858,7 @@ if (empty($reshook)) {
|
||||
}
|
||||
|
||||
// Add new entry
|
||||
$sql = "INSERT INTO ".$tabname[$id]." (";
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX.$tabname[$id]." (";
|
||||
// List of fields
|
||||
if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert)) {
|
||||
$sql .= $tabrowid[$id].",";
|
||||
@ -956,7 +934,7 @@ if (empty($reshook)) {
|
||||
}
|
||||
|
||||
// Modify entry
|
||||
$sql = "UPDATE ".$tabname[$id]." SET ";
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$tabname[$id]." SET ";
|
||||
// Modifie valeur des champs
|
||||
if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldmodify)) {
|
||||
$sql .= $tabrowid[$id]."=";
|
||||
@ -1011,11 +989,6 @@ if (empty($reshook)) {
|
||||
setEventMessages($db->error(), null, 'errors');
|
||||
}
|
||||
}
|
||||
//$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
|
||||
}
|
||||
|
||||
if (GETPOST('actioncancel')) {
|
||||
//$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
|
||||
}
|
||||
|
||||
if ($action == 'confirm_delete' && $confirm == 'yes') { // delete
|
||||
@ -1025,7 +998,7 @@ if (empty($reshook)) {
|
||||
$rowidcol = "rowid";
|
||||
}
|
||||
|
||||
$sql = "DELETE FROM ".$tabname[$id]." WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX.$tabname[$id]." WHERE ".$rowidcol." = '".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
|
||||
|
||||
dol_syslog("delete", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
@ -1047,9 +1020,9 @@ if (empty($reshook)) {
|
||||
}
|
||||
|
||||
if ($rowid) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$tabname[$id]." SET active = 1 WHERE ".$rowidcol." = '".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
|
||||
} elseif ($code) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$tabname[$id]." SET active = 1 WHERE code = '".$db->escape(dol_escape_htmltag($code))."'".($entity != '' ? " AND entity = ".(int) $entity : '');
|
||||
}
|
||||
|
||||
$result = $db->query($sql);
|
||||
@ -1067,9 +1040,9 @@ if (empty($reshook)) {
|
||||
}
|
||||
|
||||
if ($rowid) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$tabname[$id]." SET active = 0 WHERE ".$rowidcol." = '".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
|
||||
} elseif ($code) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$tabname[$id]." SET active = 0 WHERE code = '".$db->escape(dol_escape_htmltag($code))."'".($entity != '' ? " AND entity = ".(int) $entity : '');
|
||||
}
|
||||
|
||||
$result = $db->query($sql);
|
||||
@ -1087,9 +1060,9 @@ if (empty($reshook)) {
|
||||
}
|
||||
|
||||
if ($rowid) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$tabname[$id]." SET favorite = 1 WHERE ".$rowidcol." = '".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
|
||||
} elseif ($code) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$tabname[$id]." SET favorite = 1 WHERE code = '".$db->escape(dol_escape_htmltag($code))."'".($entity != '' ? " AND entity = ".(int) $entity : '');
|
||||
}
|
||||
|
||||
$result = $db->query($sql);
|
||||
@ -1107,9 +1080,9 @@ if (empty($reshook)) {
|
||||
}
|
||||
|
||||
if ($rowid) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$tabname[$id]." SET favorite = 0 WHERE ".$rowidcol." = '".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
|
||||
} elseif ($code) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$tabname[$id]." SET favorite = 0 WHERE code = '".$db->escape(dol_escape_htmltag($code))."'".($entity != '' ? " AND entity = ".(int) $entity : '');
|
||||
}
|
||||
|
||||
$result = $db->query($sql);
|
||||
@ -1127,9 +1100,9 @@ if (empty($reshook)) {
|
||||
}
|
||||
|
||||
if ($rowid) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET eec = 1 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$tabname[$id]." SET eec = 1 WHERE ".$rowidcol." = '".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
|
||||
} elseif ($code) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET eec = 1 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$tabname[$id]." SET eec = 1 WHERE code = '".$db->escape(dol_escape_htmltag($code))."'".($entity != '' ? " AND entity = ".(int) $entity : '');
|
||||
}
|
||||
|
||||
$result = $db->query($sql);
|
||||
@ -1147,9 +1120,9 @@ if (empty($reshook)) {
|
||||
}
|
||||
|
||||
if ($rowid) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET eec = 0 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$tabname[$id]." SET eec = 0 WHERE ".$rowidcol." = '".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
|
||||
} elseif ($code) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET eec = 0 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$tabname[$id]." SET eec = 0 WHERE code = '".$db->escape(dol_escape_htmltag($code))."'".($entity != '' ? " AND entity = ".(int) $entity : '');
|
||||
}
|
||||
|
||||
$result = $db->query($sql);
|
||||
@ -1225,7 +1198,7 @@ if ($action == 'delete') {
|
||||
/*
|
||||
* Show a dictionary
|
||||
*/
|
||||
if ($id) {
|
||||
if ($id > 0) {
|
||||
// Complete search values request with sort criteria
|
||||
$sql = $tabsql[$id];
|
||||
|
||||
@ -1293,6 +1266,7 @@ if ($id) {
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
// Line for title
|
||||
print '<!-- line title to add new entry -->';
|
||||
$tdsoffields = '<tr class="liste_titre">';
|
||||
foreach ($fieldlist as $field => $value) {
|
||||
if ($value == 'entity') {
|
||||
@ -1315,7 +1289,7 @@ if ($id) {
|
||||
$valuetoshow = $langs->trans("PriceUHT");
|
||||
}
|
||||
if ($value == 'taux') {
|
||||
if ($tabname[$id] != MAIN_DB_PREFIX."c_revenuestamp") {
|
||||
if ($tabname[$id] != "c_revenuestamp") {
|
||||
$valuetoshow = $langs->trans("Rate");
|
||||
} else {
|
||||
$valuetoshow = $langs->trans("Amount");
|
||||
@ -1341,7 +1315,7 @@ if ($id) {
|
||||
$valuetoshow = $langs->trans("Language");
|
||||
}
|
||||
if ($value == 'type') {
|
||||
if ($tabname[$id] == MAIN_DB_PREFIX."c_paiement") {
|
||||
if ($tabname[$id] == "c_paiement") {
|
||||
$valuetoshow = $form->textwithtooltip($langs->trans("Type"), $langs->trans("TypePaymentDesc"), 2, 1, img_help(1, ''));
|
||||
} else {
|
||||
$valuetoshow = $langs->trans("Type");
|
||||
@ -1356,6 +1330,10 @@ if ($id) {
|
||||
if ($value == 'libelle_facture') {
|
||||
$valuetoshow = $form->textwithtooltip($langs->trans("LabelOnDocuments"), $langs->trans("LabelUsedByDefault"), 2, 1, img_help(1, ''));
|
||||
}
|
||||
if ($value == 'deposit_percent') {
|
||||
$valuetoshow = $langs->trans('DepositPercent');
|
||||
$class = 'right';
|
||||
}
|
||||
if ($value == 'country') {
|
||||
if (in_array('region_id', $fieldlist)) {
|
||||
print '<td> </td>'; continue;
|
||||
@ -1367,12 +1345,14 @@ if ($id) {
|
||||
}
|
||||
if ($value == 'nbjour') {
|
||||
$valuetoshow = $langs->trans("NbOfDays");
|
||||
$class = 'right';
|
||||
}
|
||||
if ($value == 'type_cdr') {
|
||||
$valuetoshow = $langs->trans("AtEndOfMonth"); $class = "center";
|
||||
}
|
||||
if ($value == 'decalage') {
|
||||
$valuetoshow = $langs->trans("Offset");
|
||||
$class = 'right';
|
||||
}
|
||||
if ($value == 'width' || $value == 'nx') {
|
||||
$valuetoshow = $langs->trans("Width");
|
||||
@ -1409,6 +1389,7 @@ if ($id) {
|
||||
}
|
||||
if ($value == 'sortorder') {
|
||||
$valuetoshow = $langs->trans("SortOrder");
|
||||
$class = 'center';
|
||||
}
|
||||
if ($value == 'short_label') {
|
||||
$valuetoshow = $langs->trans("ShortLabel");
|
||||
@ -1505,7 +1486,7 @@ if ($id) {
|
||||
}
|
||||
|
||||
if ($valuetoshow != '') {
|
||||
$tdsoffields .= '<td'.($class ? ' class="'.$class.'"' : '').'>';
|
||||
$tdsoffields .= '<th'.($class ? ' class="'.$class.'"' : '').'>';
|
||||
if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) {
|
||||
$tdsoffields .= '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
|
||||
} elseif (!empty($tabhelp[$id][$value])) {
|
||||
@ -1513,29 +1494,29 @@ if ($id) {
|
||||
} else {
|
||||
$tdsoffields .= $valuetoshow;
|
||||
}
|
||||
$tdsoffields .= '</td>';
|
||||
$tdsoffields .= '</th>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($id == 4) {
|
||||
$tdsoffields .= '<td></td>';
|
||||
$tdsoffields .= '<td></td>';
|
||||
$tdsoffields .= '<th></th>';
|
||||
$tdsoffields .= '<th></th>';
|
||||
}
|
||||
$tdsoffields .= '<td>';
|
||||
$tdsoffields .= '<th>';
|
||||
$tdsoffields .= '<input type="hidden" name="id" value="'.$id.'">';
|
||||
if (!is_null($withentity)) {
|
||||
$tdsoffields .= '<input type="hidden" name="entity" value="'.$withentity.'">';
|
||||
}
|
||||
$tdsoffields .= '</td>';
|
||||
$tdsoffields .= '<td style="min-width: 26px;"></td>';
|
||||
$tdsoffields .= '<td style="min-width: 26px;"></td>';
|
||||
$tdsoffields .= '</th>';
|
||||
$tdsoffields .= '<th style="min-width: 26px;"></th>';
|
||||
$tdsoffields .= '<th style="min-width: 26px;"></th>';
|
||||
$tdsoffields .= '</tr>';
|
||||
|
||||
print $tdsoffields;
|
||||
|
||||
|
||||
// Line to enter new values
|
||||
print '<!-- line to add new entry -->';
|
||||
print '<!-- line input to add new entry -->';
|
||||
print '<tr class="oddeven nodrag nodrop nohover">';
|
||||
|
||||
$obj = new stdClass();
|
||||
@ -1606,6 +1587,7 @@ if ($id) {
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
// Title line with search input fields
|
||||
print '<!-- line title to search record -->'."\n";
|
||||
print '<tr class="liste_titre_filter">';
|
||||
$filterfound = 0;
|
||||
foreach ($fieldlist as $field => $value) {
|
||||
@ -1650,6 +1632,7 @@ if ($id) {
|
||||
print '</tr>';
|
||||
|
||||
// Title of lines
|
||||
print '<!-- line title of record -->'."\n";
|
||||
print '<tr class="liste_titre">';
|
||||
foreach ($fieldlist as $field => $value) {
|
||||
if ($value == 'entity') {
|
||||
@ -1676,7 +1659,7 @@ if ($id) {
|
||||
$valuetoshow = $langs->trans("PriceUHT");
|
||||
}
|
||||
if ($value == 'taux') {
|
||||
if ($tabname[$id] != MAIN_DB_PREFIX."c_revenuestamp") {
|
||||
if ($tabname[$id] != "c_revenuestamp") {
|
||||
$valuetoshow = $langs->trans("Rate");
|
||||
} else {
|
||||
$valuetoshow = $langs->trans("Amount");
|
||||
@ -1717,6 +1700,10 @@ if ($id) {
|
||||
if ($value == 'libelle_facture') {
|
||||
$valuetoshow = $langs->trans("LabelOnDocuments");
|
||||
}
|
||||
if ($value == 'deposit_percent') {
|
||||
$valuetoshow = $langs->trans('DepositPercent');
|
||||
$cssprefix = 'right ';
|
||||
}
|
||||
if ($value == 'country') {
|
||||
$valuetoshow = $langs->trans("Country");
|
||||
}
|
||||
@ -1725,12 +1712,14 @@ if ($id) {
|
||||
}
|
||||
if ($value == 'nbjour') {
|
||||
$valuetoshow = $langs->trans("NbOfDays");
|
||||
$cssprefix = 'right ';
|
||||
}
|
||||
if ($value == 'type_cdr') {
|
||||
$valuetoshow = $langs->trans("AtEndOfMonth"); $cssprefix = "center ";
|
||||
}
|
||||
if ($value == 'decalage') {
|
||||
$valuetoshow = $langs->trans("Offset");
|
||||
$cssprefix = 'right ';
|
||||
}
|
||||
if ($value == 'width' || $value == 'nx') {
|
||||
$valuetoshow = $langs->trans("Width");
|
||||
@ -1764,6 +1753,7 @@ if ($id) {
|
||||
}
|
||||
if ($value == 'sortorder') {
|
||||
$valuetoshow = $langs->trans("SortOrder");
|
||||
$cssprefix = 'center ';
|
||||
}
|
||||
if ($value == 'short_label') {
|
||||
$valuetoshow = $langs->trans("ShortLabel");
|
||||
@ -1962,58 +1952,58 @@ if ($id) {
|
||||
$key = $langs->trans("PaymentCondition".strtoupper($obj->code));
|
||||
$valuetoshow = ($obj->code && $key != "PaymentCondition".strtoupper($obj->code) ? $key : $obj->{$value});
|
||||
$valuetoshow = nl2br($valuetoshow);
|
||||
} elseif ($value == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_country') {
|
||||
} elseif ($value == 'label' && $tabname[$id] == 'c_country') {
|
||||
$key = $langs->trans("Country".strtoupper($obj->code));
|
||||
$valuetoshow = ($obj->code && $key != "Country".strtoupper($obj->code) ? $key : $obj->{$value});
|
||||
} elseif ($value == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_availability') {
|
||||
} elseif ($value == 'label' && $tabname[$id] == 'c_availability') {
|
||||
$langs->load("propal");
|
||||
$key = $langs->trans("AvailabilityType".strtoupper($obj->code));
|
||||
$valuetoshow = ($obj->code && $key != "AvailabilityType".strtoupper($obj->code) ? $key : $obj->{$value});
|
||||
} elseif ($value == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_actioncomm') {
|
||||
} elseif ($value == 'libelle' && $tabname[$id] == 'c_actioncomm') {
|
||||
$key = $langs->trans("Action".strtoupper($obj->code));
|
||||
$valuetoshow = ($obj->code && $key != "Action".strtoupper($obj->code) ? $key : $obj->{$value});
|
||||
} elseif (!empty($obj->code_iso) && $value == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_currencies') {
|
||||
} elseif (!empty($obj->code_iso) && $value == 'label' && $tabname[$id] == 'c_currencies') {
|
||||
$key = $langs->trans("Currency".strtoupper($obj->code_iso));
|
||||
$valuetoshow = ($obj->code_iso && $key != "Currency".strtoupper($obj->code_iso) ? $key : $obj->{$value});
|
||||
} elseif ($value == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_typent') {
|
||||
} elseif ($value == 'libelle' && $tabname[$id] == 'c_typent') {
|
||||
$key = $langs->trans(strtoupper($obj->code));
|
||||
$valuetoshow = ($key != strtoupper($obj->code) ? $key : $obj->{$value});
|
||||
} elseif ($value == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_prospectlevel') {
|
||||
} elseif ($value == 'libelle' && $tabname[$id] == 'c_prospectlevel') {
|
||||
$key = $langs->trans(strtoupper($obj->code));
|
||||
$valuetoshow = ($key != strtoupper($obj->code) ? $key : $obj->{$value});
|
||||
} elseif ($value == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_civility') {
|
||||
} elseif ($value == 'label' && $tabname[$id] == 'c_civility') {
|
||||
$key = $langs->trans("Civility".strtoupper($obj->code));
|
||||
$valuetoshow = ($obj->code && $key != "Civility".strtoupper($obj->code) ? $key : $obj->{$value});
|
||||
} elseif ($value == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_type_contact') {
|
||||
} elseif ($value == 'libelle' && $tabname[$id] == 'c_type_contact') {
|
||||
$langs->load('agenda');
|
||||
$key = $langs->trans("TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code));
|
||||
$valuetoshow = ($obj->code && $key != "TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code) ? $key : $obj->{$value});
|
||||
} elseif ($value == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_payment_term') {
|
||||
} elseif ($value == 'libelle' && $tabname[$id] == 'c_payment_term') {
|
||||
$langs->load("bills");
|
||||
$key = $langs->trans("PaymentConditionShort".strtoupper($obj->code));
|
||||
$valuetoshow = ($obj->code && $key != "PaymentConditionShort".strtoupper($obj->code) ? $key : $obj->{$value});
|
||||
} elseif ($value == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_paiement') {
|
||||
} elseif ($value == 'libelle' && $tabname[$id] == 'c_paiement') {
|
||||
$langs->load("bills");
|
||||
$key = $langs->trans("PaymentType".strtoupper($obj->code));
|
||||
$valuetoshow = ($obj->code && $key != "PaymentType".strtoupper($obj->code) ? $key : $obj->{$value});
|
||||
} elseif ($value == 'type' && $tabname[$id] == MAIN_DB_PREFIX.'c_paiement') {
|
||||
} elseif ($value == 'type' && $tabname[$id] == 'c_paiement') {
|
||||
$payment_type_list = array(0=>$langs->trans('PaymentTypeCustomer'), 1=>$langs->trans('PaymentTypeSupplier'), 2=>$langs->trans('PaymentTypeBoth'));
|
||||
$valuetoshow = $payment_type_list[$valuetoshow];
|
||||
} elseif ($value == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_input_reason') {
|
||||
} elseif ($value == 'label' && $tabname[$id] == 'c_input_reason') {
|
||||
$key = $langs->trans("DemandReasonType".strtoupper($obj->code));
|
||||
$valuetoshow = ($obj->code && $key != "DemandReasonType".strtoupper($obj->code) ? $key : $obj->{$value});
|
||||
} elseif ($value == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_input_method') {
|
||||
} elseif ($value == 'libelle' && $tabname[$id] == 'c_input_method') {
|
||||
$langs->load("orders");
|
||||
$key = $langs->trans($obj->code);
|
||||
$valuetoshow = ($obj->code && $key != $obj->code) ? $key : $obj->{$value};
|
||||
} elseif ($value == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_shipment_mode') {
|
||||
} elseif ($value == 'libelle' && $tabname[$id] == 'c_shipment_mode') {
|
||||
$langs->load("sendings");
|
||||
$key = $langs->trans("SendingMethod".strtoupper($obj->code));
|
||||
$valuetoshow = ($obj->code && $key != "SendingMethod".strtoupper($obj->code) ? $key : $obj->{$value});
|
||||
} elseif ($value == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_paper_format') {
|
||||
} elseif ($value == 'libelle' && $tabname[$id] == 'c_paper_format') {
|
||||
$key = $langs->trans('PaperFormat'.strtoupper($obj->code));
|
||||
$valuetoshow = ($obj->code && $key != 'PaperFormat'.strtoupper($obj->code) ? $key : $obj->{$value});
|
||||
} elseif ($value == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_type_fees') {
|
||||
} elseif ($value == 'label' && $tabname[$id] == 'c_type_fees') {
|
||||
$langs->load('trips');
|
||||
$key = $langs->trans(strtoupper($obj->code));
|
||||
$valuetoshow = ($obj->code && $key != strtoupper($obj->code) ? $key : $obj->{$value});
|
||||
@ -2021,13 +2011,13 @@ if ($id) {
|
||||
$showfield = 0;
|
||||
} elseif ($value == 'unicode') {
|
||||
$valuetoshow = $langs->getCurrencySymbol($obj->code, 1);
|
||||
} elseif ($value == 'label' && $tabname[GETPOST("id", 'int')] == MAIN_DB_PREFIX.'c_units') {
|
||||
} elseif ($value == 'label' && $tabname[GETPOST("id", 'int')] == 'c_units') {
|
||||
$langs->load("products");
|
||||
$valuetoshow = $langs->trans($obj->{$value});
|
||||
} elseif ($value == 'short_label' && $tabname[GETPOST("id", 'int')] == MAIN_DB_PREFIX.'c_units') {
|
||||
} elseif ($value == 'short_label' && $tabname[GETPOST("id", 'int')] == 'c_units') {
|
||||
$langs->load("products");
|
||||
$valuetoshow = $langs->trans($obj->{$value});
|
||||
} elseif (($value == 'unit') && ($tabname[$id] == MAIN_DB_PREFIX.'c_paper_format')) {
|
||||
} elseif (($value == 'unit') && ($tabname[$id] == 'c_paper_format')) {
|
||||
$key = $langs->trans('SizeUnit'.strtolower($obj->unit));
|
||||
$valuetoshow = ($obj->code && $key != 'SizeUnit'.strtolower($obj->unit) ? $key : $obj->{$value});
|
||||
} elseif ($value == 'localtax1' || $value == 'localtax2') {
|
||||
@ -2068,20 +2058,20 @@ if ($id) {
|
||||
}
|
||||
} elseif ($value == 'fk_c_exp_tax_cat') {
|
||||
$tmpid = $valuetoshow;
|
||||
$valuetoshow = getDictionaryValue(MAIN_DB_PREFIX.'c_exp_tax_cat', 'label', $tmpid);
|
||||
$valuetoshow = getDictionaryValue('c_exp_tax_cat', 'label', $tmpid);
|
||||
$valuetoshow = $langs->trans($valuetoshow ? $valuetoshow : $tmpid);
|
||||
} elseif ($tabname[$id] == MAIN_DB_PREFIX.'c_exp_tax_cat') {
|
||||
} elseif ($tabname[$id] == 'c_exp_tax_cat') {
|
||||
$valuetoshow = $langs->trans($valuetoshow);
|
||||
} elseif ($value == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_units') {
|
||||
} elseif ($value == 'label' && $tabname[$id] == 'c_units') {
|
||||
$langs->load('other');
|
||||
$key = $langs->trans($obj->label);
|
||||
$valuetoshow = ($obj->label && $key != strtoupper($obj->label) ? $key : $obj->{$value});
|
||||
} elseif ($value == 'code' && $id == 3) {
|
||||
$valuetoshow = $obj->state_code;
|
||||
} elseif ($value == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_product_nature') {
|
||||
} elseif ($value == 'label' && $tabname[$id] == 'c_product_nature') {
|
||||
$langs->load("products");
|
||||
$valuetoshow = $langs->trans($obj->{$value});
|
||||
} elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_productbatch_qcstatus') {
|
||||
} elseif ($fieldlist[$field] == 'label' && $tabname[$id] == 'c_productbatch_qcstatus') {
|
||||
$langs->load("productbatch");
|
||||
$valuetoshow = $langs->trans($obj->{$value});
|
||||
} elseif ($value == 'block_if_negative') {
|
||||
@ -2097,13 +2087,13 @@ if ($id) {
|
||||
if ($value == 'tracking') {
|
||||
$class .= ' tdoverflowauto';
|
||||
}
|
||||
if (in_array($value, array('pos', 'position'))) {
|
||||
if (in_array($value, array('nbjour', 'decalage', 'pos', 'position', 'deposit_percent'))) {
|
||||
$class .= ' right';
|
||||
}
|
||||
if (in_array($value, array('localtax1_type', 'localtax2_type'))) {
|
||||
$class .= ' nowrap';
|
||||
}
|
||||
if (in_array($value, array('use_default', 'fk_parent'))) {
|
||||
if (in_array($value, array('use_default', 'fk_parent', 'sortorder'))) {
|
||||
$class .= ' center';
|
||||
}
|
||||
if ($value == 'public') {
|
||||
@ -2147,7 +2137,7 @@ if ($id) {
|
||||
if (!empty($obj->code) && $obj->code == 'RECEP') {
|
||||
$canbemodified = 1;
|
||||
}
|
||||
if ($tabname[$id] == MAIN_DB_PREFIX."c_actioncomm") {
|
||||
if ($tabname[$id] == "c_actioncomm") {
|
||||
$canbemodified = 1;
|
||||
}
|
||||
|
||||
@ -2174,7 +2164,7 @@ if ($id) {
|
||||
if ($iserasable) {
|
||||
print '<a class="reposition" href="'.$url.'action='.$acts[$obj->eec].'_eec&token='.newToken().'">'.$actl[$obj->eec].'</a>';
|
||||
} else {
|
||||
print $langs->trans("AlwaysActive");
|
||||
print '<span class="opacitymedium">'.$langs->trans("AlwaysActive").'</span>';
|
||||
}
|
||||
print '</td>';
|
||||
print '<td class="nowrap center">';
|
||||
@ -2182,7 +2172,7 @@ if ($id) {
|
||||
if ($iserasable) {
|
||||
print '<a class="reposition" href="'.$url.'action='.$acts[$obj->favorite].'_favorite&token='.newToken().'">'.$actl[$obj->favorite].'</a>';
|
||||
} else {
|
||||
print $langs->trans("AlwaysActive");
|
||||
print '<span class="opacitymedium">'.$langs->trans("AlwaysActive").'</span>';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
@ -2199,7 +2189,7 @@ if ($id) {
|
||||
} elseif (isset($obj->type) && in_array($obj->type, array('system')) && !empty($obj->active) && $obj->code != 'AC_OTH') {
|
||||
print $langs->trans("UsedOnlyWithTypeOption");
|
||||
} else {
|
||||
print $langs->trans("AlwaysActive");
|
||||
print '<span class="opacitymedium">'.$langs->trans("AlwaysActive").'</span>';
|
||||
}
|
||||
}
|
||||
print "</td>";
|
||||
@ -2283,7 +2273,7 @@ if ($id) {
|
||||
print '</a>';
|
||||
print '</td>';
|
||||
print '<td class="right">';
|
||||
print $form->textwithpicto('', $langs->trans("Table").': '.$tabname[$i]);
|
||||
print $form->textwithpicto('', $langs->trans("Table").': '.MAIN_DB_PREFIX.$tabname[$i]);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
$lastlineisempty = false;
|
||||
@ -2333,7 +2323,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
continue;
|
||||
}
|
||||
|
||||
if (in_array($value, array('code', 'libelle', 'type')) && $tabname == MAIN_DB_PREFIX."c_actioncomm" && in_array($obj->type, array('system', 'systemauto'))) {
|
||||
if (in_array($value, array('code', 'libelle', 'type')) && $tabname == "c_actioncomm" && in_array($obj->type, array('system', 'systemauto'))) {
|
||||
$hidden = (!empty($obj->{$value}) ? $obj->{$value}:'');
|
||||
print '<td>';
|
||||
print '<input type="hidden" name="'. $value .'" value="'.$hidden.'">';
|
||||
@ -2369,15 +2359,9 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
print '<td>';
|
||||
print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'lang');
|
||||
print '</td>';
|
||||
} elseif ($value == 'element') {
|
||||
// The type of the element (for contact types)
|
||||
} elseif (in_array($value, array('element', 'source'))) { //Example: the type and source of the element (for contact types)
|
||||
print '<td>';
|
||||
print $form->selectarray('element', $elementList, (!empty($obj->{$value}) ? $obj->{$value}:''));
|
||||
print '</td>';
|
||||
} elseif ($value == 'source') {
|
||||
// The source of the element (for contact types)
|
||||
print '<td>';
|
||||
print $form->selectarray('source', $sourceList, (!empty($obj->{$value}) ? $obj->{$value}:''));
|
||||
print $form->selectarray($value, $elementList, (!empty($obj->{$value}) ? $obj->{$value}:''));
|
||||
print '</td>';
|
||||
} elseif (in_array($value, array('public', 'use_default'))) {
|
||||
// Fields 0/1 with a combo select Yes/No
|
||||
@ -2389,12 +2373,12 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
print '<td>';
|
||||
print $form->selectyesno("private", (!empty($obj->{$value}) ? $obj->{$value}:''));
|
||||
print '</td>';
|
||||
} elseif ($value == 'type' && $tabname == MAIN_DB_PREFIX."c_actioncomm") {
|
||||
} elseif ($value == 'type' && $tabname == "c_actioncomm") {
|
||||
$type = (!empty($obj->type) ? $obj->type : 'user'); // Check if type is different of 'user' (external module)
|
||||
print '<td>';
|
||||
print $type.'<input type="hidden" name="type" value="'.$type.'">';
|
||||
print '</td>';
|
||||
} elseif ($value == 'type' && $tabname == MAIN_DB_PREFIX.'c_paiement') {
|
||||
} elseif ($value == 'type' && $tabname == 'c_paiement') {
|
||||
print '<td>';
|
||||
$select_list = array(0=>$langs->trans('PaymentTypeCustomer'), 1=>$langs->trans('PaymentTypeSupplier'), 2=>$langs->trans('PaymentTypeBoth'));
|
||||
print $form->selectarray($value, $select_list, (!empty($obj->{$value}) ? $obj->{$value}:'2'));
|
||||
@ -2412,7 +2396,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
}
|
||||
print '</td>';
|
||||
} elseif (in_array($value, array('nbjour', 'decalage', 'taux', 'localtax1', 'localtax2'))) {
|
||||
$class = "left";
|
||||
$class = "right";
|
||||
if (in_array($value, array('taux', 'localtax1', 'localtax2'))) {
|
||||
$class = "center"; // Fields aligned on right
|
||||
}
|
||||
@ -2424,7 +2408,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
$transfound = 0;
|
||||
$transkey = '';
|
||||
// Special case for labels
|
||||
if ($tabname == MAIN_DB_PREFIX.'c_payment_term') {
|
||||
if ($tabname == 'c_payment_term') {
|
||||
$langs->load("bills");
|
||||
$transkey = "PaymentCondition".strtoupper($obj->code);
|
||||
if ($langs->trans($transkey) != $transkey) {
|
||||
@ -2490,18 +2474,21 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
print '</td>';
|
||||
} else {
|
||||
$fieldValue = isset($obj->{$value}) ? $obj->{$value}: '';
|
||||
$classtd = ''; $class = '';
|
||||
|
||||
if ($value == 'sortorder') {
|
||||
$fieldlist[$field] = 'position';
|
||||
}
|
||||
|
||||
$classtd = ''; $class = '';
|
||||
if ($fieldlist[$field] == 'code') {
|
||||
$class = 'maxwidth100';
|
||||
}
|
||||
if (in_array($fieldlist[$field], array('pos', 'position'))) {
|
||||
if (in_array($fieldlist[$field], array('deposit_percent'))) {
|
||||
$classtd = 'right'; $class = 'maxwidth50 right';
|
||||
}
|
||||
if (in_array($fieldlist[$field], array('pos', 'position'))) {
|
||||
$classtd = 'center'; $class = 'maxwidth50 center';
|
||||
}
|
||||
if (in_array($fieldlist[$field], array('dayrule', 'day', 'month', 'year', 'use_default', 'affect', 'delay', 'public', 'sortorder', 'sens', 'category_type', 'fk_parent'))) {
|
||||
$class = 'maxwidth50 center';
|
||||
}
|
||||
@ -2522,19 +2509,19 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
$maxlength = '';
|
||||
if (in_array($fieldlist[$field], array('libelle', 'label'))) {
|
||||
switch ($tabname) {
|
||||
case MAIN_DB_PREFIX . 'c_accounting_category':
|
||||
case MAIN_DB_PREFIX . 'c_ecotaxe':
|
||||
case MAIN_DB_PREFIX . 'c_email_senderprofile':
|
||||
case MAIN_DB_PREFIX . 'c_forme_juridique':
|
||||
case MAIN_DB_PREFIX . 'c_holiday_types':
|
||||
case MAIN_DB_PREFIX . 'c_payment_term':
|
||||
case MAIN_DB_PREFIX . 'c_transport_mode':
|
||||
case 'c_accounting_category':
|
||||
case 'c_ecotaxe':
|
||||
case 'c_email_senderprofile':
|
||||
case 'c_forme_juridique':
|
||||
case 'c_holiday_types':
|
||||
case 'c_payment_term':
|
||||
case 'c_transport_mode':
|
||||
$maxlength = ' maxlength="255"';
|
||||
break;
|
||||
case MAIN_DB_PREFIX . 'c_email_templates':
|
||||
case 'c_email_templates':
|
||||
$maxlength = ' maxlength="180"';
|
||||
break;
|
||||
case MAIN_DB_PREFIX . 'c_socialnetworks':
|
||||
case 'c_socialnetworks':
|
||||
$maxlength = ' maxlength="150"';
|
||||
break;
|
||||
default:
|
||||
@ -2547,10 +2534,10 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
$transkey = '';
|
||||
if (in_array($fieldlist[$field], array('label', 'libelle'))) { // For label
|
||||
// Special case for labels
|
||||
if ($tabname == MAIN_DB_PREFIX.'c_civility' && !empty($obj->code)) {
|
||||
if ($tabname == 'c_civility' && !empty($obj->code)) {
|
||||
$transkey = "Civility".strtoupper($obj->code);
|
||||
}
|
||||
if ($tabname == MAIN_DB_PREFIX.'c_payment_term' && !empty($obj->code)) {
|
||||
if ($tabname == 'c_payment_term' && !empty($obj->code)) {
|
||||
$langs->load("bills");
|
||||
$transkey = "PaymentConditionShort".strtoupper($obj->code);
|
||||
}
|
||||
|
||||
@ -232,6 +232,9 @@ class PrestaShopWebservice
|
||||
if ($response != '') {
|
||||
libxml_clear_errors();
|
||||
libxml_use_internal_errors(true);
|
||||
if (!function_exists('simplexml_load_string')) {
|
||||
throw new PrestaShopWebserviceException('Method simplexml_load_string not available. Your PHP does not support xml.');
|
||||
}
|
||||
$xml = simplexml_load_string($response, 'SimpleXMLElement', LIBXML_NOCDATA|LIBXML_NONET);
|
||||
if (libxml_get_errors()) {
|
||||
$msg = var_export(libxml_get_errors(), true);
|
||||
|
||||
@ -428,15 +428,21 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
$connectstringtarget = $connectstringserver.$object->getEncodedUtf7($targetdir);
|
||||
}
|
||||
|
||||
$timeoutconnect = empty($conf->global->MAIN_USE_CONNECT_TIMEOUT) ? 10 : $conf->global->MAIN_USE_CONNECT_TIMEOUT;
|
||||
$timeoutread = empty($conf->global->MAIN_USE_RESPONSE_TIMEOUT) ? 30 : $conf->global->MAIN_USE_RESPONSE_TIMEOUT;
|
||||
$timeoutconnect = empty($conf->global->MAIN_USE_CONNECT_TIMEOUT) ? 5 : $conf->global->MAIN_USE_CONNECT_TIMEOUT;
|
||||
$timeoutread = empty($conf->global->MAIN_USE_RESPONSE_TIMEOUT) ? 20 : $conf->global->MAIN_USE_RESPONSE_TIMEOUT;
|
||||
|
||||
dol_syslog("imap_open connectstring=".$connectstringsource." login=".$object->login." password=".$object->password." timeoutconnect=".$timeoutconnect." timeoutread=".$timeoutread);
|
||||
|
||||
imap_timeout(IMAP_OPENTIMEOUT, $timeoutconnect);
|
||||
imap_timeout(IMAP_READTIMEOUT, $timeoutread);
|
||||
$result1 = imap_timeout(IMAP_OPENTIMEOUT, $timeoutconnect); // timeout seems ignored with ssl connect
|
||||
$result2 = imap_timeout(IMAP_READTIMEOUT, $timeoutread);
|
||||
$result3 = imap_timeout(IMAP_WRITETIMEOUT, 5);
|
||||
$result4 = imap_timeout(IMAP_CLOSETIMEOUT, 5);
|
||||
|
||||
dol_syslog("result1=".$result1." result2=".$result2." result3=".$result3." result4=".$result4);
|
||||
|
||||
$connection = imap_open($connectstringsource, $object->login, $object->password);
|
||||
|
||||
//dol_syslog("end imap_open connection=".var_export($connection, true));
|
||||
} catch (Exception $e) {
|
||||
print $e->getMessage();
|
||||
}
|
||||
@ -490,7 +496,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table id="tablelineoffilters" class="noborder margintable noshadow">';
|
||||
print '<tr class="liste_titre nodrag nodrop">';
|
||||
print '<td>'.img_picto('', 'filter', 'class="pictofixedwidth"').$form->textwithpicto($langs->trans("Filters"), $langs->trans("EmailCollectorFilterDesc")).'</td><td></td><td></td>';
|
||||
print '<td>'.img_picto('', 'filter', 'class="pictofixedwidth opacitymedium"').$form->textwithpicto($langs->trans("Filters"), $langs->trans("EmailCollectorFilterDesc")).'</td><td></td><td></td>';
|
||||
print '</tr>';
|
||||
// Add filter
|
||||
print '<tr class="oddeven nodrag nodrop">';
|
||||
@ -647,7 +653,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
print $form->textwithpicto('', $langs->transnoentitiesnoconv('EmailCollectorLoadThirdPartyHelp'));
|
||||
}
|
||||
print '</td>';
|
||||
print '<td class="wordbreak minwidth300">';
|
||||
print '<td class="wordbreak minwidth300 small">';
|
||||
if ($action == 'editoperation' && $ruleaction['id'] == $operationid) {
|
||||
print '<input type="text" class="quatrevingtquinzepercent" name="operationparam2" value="'.$ruleaction['actionparam'].'"><br>';
|
||||
print '<input type="hidden" name="rowidoperation2" value="'.$ruleaction['id'].'">';
|
||||
|
||||
@ -44,6 +44,7 @@ $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'emailcollectorlist'; // To manage different context of search
|
||||
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
|
||||
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
|
||||
$mode = GETPOST('mode', 'aZ');
|
||||
|
||||
$id = GETPOST('id', 'int');
|
||||
|
||||
@ -53,8 +54,9 @@ $sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) {
|
||||
// If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
|
||||
$page = 0;
|
||||
} // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
|
||||
}
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
@ -74,7 +76,7 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen
|
||||
|
||||
// Default sort order (if not yet defined by previous GETPOST)
|
||||
if (!$sortfield) {
|
||||
$sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition.
|
||||
$sortfield = "t.ref"; // Set here default search field. By default 1st field in definition.
|
||||
}
|
||||
if (!$sortorder) {
|
||||
$sortorder = "ASC";
|
||||
@ -89,12 +91,16 @@ if ($user->socid > 0) { // Protection if external user
|
||||
//$result = restrictedArea($user, 'emailcollector', $id, '');
|
||||
|
||||
// Initialize array of search criterias
|
||||
$search_all = GETPOST("search_all", 'alphanohtml');
|
||||
$search_all = GETPOST('search_all', 'alphanohtml');
|
||||
$search = array();
|
||||
foreach ($object->fields as $key => $val) {
|
||||
if (GETPOST('search_'.$key, 'alpha') !== '') {
|
||||
$search[$key] = GETPOST('search_'.$key, 'alpha');
|
||||
}
|
||||
if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
|
||||
$search[$key.'_dtstart'] = dol_mktime(0, 0, 0, GETPOST('search_'.$key.'_dtstartmonth', 'int'), GETPOST('search_'.$key.'_dtstartday', 'int'), GETPOST('search_'.$key.'_dtstartyear', 'int'));
|
||||
$search[$key.'_dtend'] = dol_mktime(23, 59, 59, GETPOST('search_'.$key.'_dtendmonth', 'int'), GETPOST('search_'.$key.'_dtendday', 'int'), GETPOST('search_'.$key.'_dtendyear', 'int'));
|
||||
}
|
||||
}
|
||||
|
||||
// List of fields to search into when doing a "search in all"
|
||||
@ -110,29 +116,19 @@ $arrayfields = array();
|
||||
foreach ($object->fields as $key => $val) {
|
||||
// If $val['visible']==0, then we never show the field
|
||||
if (!empty($val['visible'])) {
|
||||
$visible = dol_eval($val['visible'], 1, 1, '1');
|
||||
$visible = (int) dol_eval($val['visible'], 1);
|
||||
$arrayfields['t.'.$key] = array(
|
||||
'label'=>$val['label'],
|
||||
'checked'=>(($visible < 0) ? 0 : 1),
|
||||
'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1, 1, '1')),
|
||||
'position'=>$val['position']
|
||||
'enabled'=>(abs($visible) != 3 && dol_eval($val['enabled'], 1)),
|
||||
'position'=>$val['position'],
|
||||
'help'=> isset($val['help']) ? $val['help'] : ''
|
||||
);
|
||||
}
|
||||
}
|
||||
// Extra fields
|
||||
if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||
if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) {
|
||||
$arrayfields["ef.".$key] = array(
|
||||
'label'=>$extrafields->attributes[$object->table_element]['label'][$key],
|
||||
'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1),
|
||||
'position'=>$extrafields->attributes[$object->table_element]['pos'][$key],
|
||||
'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]),
|
||||
'langfile'=>$extrafields->attributes[$object->table_element]['langfile'][$key]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
|
||||
|
||||
$object->fields = dol_sort_array($object->fields, 'position');
|
||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||
|
||||
@ -157,7 +153,8 @@ if (empty($conf->emailcollector->enabled)) {
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel', 'alpha')) {
|
||||
$action = 'list'; $massaction = '';
|
||||
$action = 'list';
|
||||
$massaction = '';
|
||||
}
|
||||
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
|
||||
$massaction = '';
|
||||
@ -177,8 +174,12 @@ if (empty($reshook)) {
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
|
||||
foreach ($object->fields as $key => $val) {
|
||||
$search[$key] = '';
|
||||
if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
|
||||
$search[$key.'_dtstart'] = '';
|
||||
$search[$key.'_dtend'] = '';
|
||||
}
|
||||
}
|
||||
$toselect = '';
|
||||
$toselect = array();
|
||||
$search_array_options = array();
|
||||
}
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
|
||||
@ -201,20 +202,22 @@ if (empty($reshook)) {
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
$help_url = "EN:Module_EMail_Collector|FR:Module_Collecteur_de_courrier_électronique|ES:Module_EMail_Collector";
|
||||
$title = $langs->trans('ListOf', $langs->transnoentitiesnoconv("EmailCollector"));
|
||||
$morejs = array();
|
||||
$morecss = array();
|
||||
|
||||
|
||||
// Build and execute select
|
||||
// --------------------------------------------------------------------
|
||||
$sql = 'SELECT ';
|
||||
foreach ($object->fields as $key => $val) {
|
||||
$sql .= "t.".$key.", ";
|
||||
}
|
||||
$sql .= $object->getFieldList('t');
|
||||
// Add fields from extrafields
|
||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key." as options_".$key.', ' : '');
|
||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
|
||||
}
|
||||
}
|
||||
// Add fields from hooks
|
||||
@ -232,18 +235,32 @@ if ($object->ismultientitymanaged == 1) {
|
||||
$sql .= " WHERE 1 = 1";
|
||||
}
|
||||
foreach ($search as $key => $val) {
|
||||
if ($key == 'status' && $search[$key] == -1) {
|
||||
continue;
|
||||
}
|
||||
$mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
|
||||
if (strpos($object->fields[$key]['type'], 'integer:') === 0) {
|
||||
if ($search[$key] == '-1') {
|
||||
$search[$key] = '';
|
||||
if (array_key_exists($key, $object->fields)) {
|
||||
if ($key == 'status' && $search[$key] == -1) {
|
||||
continue;
|
||||
}
|
||||
$mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
|
||||
if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) {
|
||||
if ($search[$key] == '-1' || ($search[$key] === '0' && (empty($object->fields[$key]['arrayofkeyval']) || !array_key_exists('0', $object->fields[$key]['arrayofkeyval'])))) {
|
||||
$search[$key] = '';
|
||||
}
|
||||
$mode_search = 2;
|
||||
}
|
||||
if ($search[$key] != '') {
|
||||
$sql .= natural_search("t.".$db->escape($key), $search[$key], (($key == 'status') ? 2 : $mode_search));
|
||||
}
|
||||
} else {
|
||||
if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') {
|
||||
$columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key);
|
||||
if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) {
|
||||
if (preg_match('/_dtstart$/', $key)) {
|
||||
$sql .= " AND t.".$db->escape($columnName)." >= '".$db->idate($search[$key])."'";
|
||||
}
|
||||
if (preg_match('/_dtend$/', $key)) {
|
||||
$sql .= " AND t.".$db->escape($columnName)." <= '".$db->idate($search[$key])."'";
|
||||
}
|
||||
}
|
||||
}
|
||||
$mode_search = 2;
|
||||
}
|
||||
if ($search[$key] != '') {
|
||||
$sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search));
|
||||
}
|
||||
}
|
||||
if ($search_all) {
|
||||
@ -258,49 +275,48 @@ $sql .= $hookmanager->resPrint;
|
||||
|
||||
/* If a group by is required
|
||||
$sql.= " GROUP BY ";
|
||||
foreach ($object->fields as $key => $val)
|
||||
{
|
||||
$sql .= "t.".$key.", ";
|
||||
foreach ($object->fields as $key => $val) {
|
||||
$sql .= "t.".$db->escape($key).", ";
|
||||
}
|
||||
// Add fields from extrafields
|
||||
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
|
||||
}
|
||||
}
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
$sql=preg_replace('/, $/','', $sql);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
$sql = preg_replace('/,\s*$/', '', $sql);
|
||||
*/
|
||||
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$resql = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($resql);
|
||||
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
}
|
||||
}
|
||||
// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set.
|
||||
if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) {
|
||||
$num = $nbtotalofrecords;
|
||||
} else {
|
||||
if ($limit) {
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
}
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql) {
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
$db->free($resql);
|
||||
}
|
||||
// Complete request and execute it with limit
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
if ($limit) {
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
}
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql) {
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
// Direct jump if only one record found
|
||||
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
|
||||
@ -314,7 +330,7 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $
|
||||
// Output page
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
llxHeader('', $title, $help_url);
|
||||
llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', '');
|
||||
|
||||
$arrayofselected = is_array($toselect) ? $toselect : array();
|
||||
|
||||
@ -328,9 +344,11 @@ if ($limit > 0 && $limit != $conf->liste_limit) {
|
||||
foreach ($search as $key => $val) {
|
||||
if (is_array($search[$key]) && count($search[$key])) {
|
||||
foreach ($search[$key] as $skey) {
|
||||
$param .= '&search_'.$key.'[]='.urlencode($skey);
|
||||
if ($skey != '') {
|
||||
$param .= '&search_'.$key.'[]='.urlencode($skey);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
} elseif ($search[$key] != '') {
|
||||
$param .= '&search_'.$key.'='.urlencode($search[$key]);
|
||||
}
|
||||
}
|
||||
@ -339,6 +357,10 @@ if ($optioncss != '') {
|
||||
}
|
||||
// Add $param from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||
// Add $param from hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$param .= $hookmanager->resPrint;
|
||||
|
||||
// List of mass actions available
|
||||
$arrayofmassactions = array(
|
||||
@ -353,7 +375,7 @@ if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'pr
|
||||
}
|
||||
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||
if ($optioncss != '') {
|
||||
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
}
|
||||
@ -398,7 +420,7 @@ if (!empty($moreforfilter)) {
|
||||
}
|
||||
|
||||
$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
|
||||
$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
|
||||
|
||||
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
||||
@ -408,25 +430,43 @@ print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwit
|
||||
// Fields title search
|
||||
// --------------------------------------------------------------------
|
||||
print '<tr class="liste_titre">';
|
||||
// Action column
|
||||
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
$searchpicto = $form->showFilterButtons('left');
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
}
|
||||
foreach ($object->fields as $key => $val) {
|
||||
$cssforfield = (empty($val['css']) ? '' : $val['css']);
|
||||
$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
|
||||
if ($key == 'status') {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
} elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
} elseif (in_array($val['type'], array('timestamp'))) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
||||
} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') {
|
||||
} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'right';
|
||||
}
|
||||
if (!empty($arrayfields['t.'.$key]['checked'])) {
|
||||
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
|
||||
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
|
||||
print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
|
||||
} elseif (strpos($val['type'], 'integer:') === 0) {
|
||||
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1);
|
||||
} elseif (!preg_match('/^(date|timestamp)/', $val['type'])) {
|
||||
print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
|
||||
print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
|
||||
} elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) {
|
||||
print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', 'maxwidth125', 1);
|
||||
} elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
|
||||
print '<div class="nowrap">';
|
||||
print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
|
||||
print '</div>';
|
||||
} elseif ($key == 'lang') {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
|
||||
$formadmin = new FormAdmin($db);
|
||||
print $formadmin->select_language($search[$key], 'search_lang', 0, null, 1, 0, 0, 'minwidth150 maxwidth200', 2);
|
||||
} else {
|
||||
print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
@ -439,39 +479,51 @@ $parameters = array('arrayfields'=>$arrayfields);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Action column
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
}
|
||||
print '</tr>'."\n";
|
||||
|
||||
$totalarray = array();
|
||||
$totalarray['nbfield'] = 0;
|
||||
|
||||
// Fields title label
|
||||
// --------------------------------------------------------------------
|
||||
print '<tr class="liste_titre">';
|
||||
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
||||
print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
|
||||
}
|
||||
foreach ($object->fields as $key => $val) {
|
||||
$cssforfield = (empty($val['css']) ? '' : $val['css']);
|
||||
$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
|
||||
if ($key == 'status') {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
} elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
} elseif (in_array($val['type'], array('timestamp'))) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
||||
} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') {
|
||||
} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'right';
|
||||
}
|
||||
$cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label
|
||||
if (!empty($arrayfields['t.'.$key]['checked'])) {
|
||||
print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n";
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||
// Hook fields
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Action column
|
||||
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
|
||||
if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
||||
print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
|
||||
}
|
||||
$totalarray['nbfield']++;
|
||||
print '</tr>'."\n";
|
||||
|
||||
|
||||
@ -489,8 +541,10 @@ if (isset($extrafields->attributes[$object->table_element]['computed']) && is_ar
|
||||
// Loop on record
|
||||
// --------------------------------------------------------------------
|
||||
$i = 0;
|
||||
$totalarray = array();
|
||||
while ($i < ($limit ? min($num, $limit) : $num)) {
|
||||
$savnbfield = $totalarray['nbfield'];
|
||||
$totalarray['nbfield'] = 0;
|
||||
$imaxinloop = ($limit ? min($num, $limit) : $num);
|
||||
while ($i < $imaxinloop) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
if (empty($obj)) {
|
||||
break; // Should not happen
|
||||
@ -499,73 +553,107 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
|
||||
// Store properties in $object
|
||||
$object->setVarsFromFetchObj($obj);
|
||||
|
||||
// Show here line of result
|
||||
print '<tr class="oddeven">';
|
||||
foreach ($object->fields as $key => $val) {
|
||||
$cssforfield = (empty($val['css']) ? '' : $val['css']);
|
||||
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
} elseif ($key == 'status') {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
if ($mode == 'kanban') {
|
||||
if ($i == 0) {
|
||||
print '<tr><td colspan="'.$savnbfield.'">';
|
||||
print '<div class="box-flex-container">';
|
||||
}
|
||||
|
||||
if (in_array($val['type'], array('timestamp'))) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
||||
} elseif ($key == 'ref') {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
||||
// Output Kanban
|
||||
print $object->getKanbanView('');
|
||||
if ($i == ($imaxinloop - 1)) {
|
||||
print '</div>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status'))) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'right';
|
||||
}
|
||||
//if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
|
||||
|
||||
if (!empty($arrayfields['t.'.$key]['checked'])) {
|
||||
print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>';
|
||||
if ($key == 'status') {
|
||||
print $object->getLibStatut(5);
|
||||
} else {
|
||||
print $object->showOutputField($val, $key, $object->$key, '');
|
||||
} else {
|
||||
// Show here line of result
|
||||
$j = 0;
|
||||
print '<tr data-rowid="'.$object->id.'" class="oddeven">';
|
||||
// Action column
|
||||
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
||||
print '<td class="nowrap center">';
|
||||
if ($massactionbutton || $massaction) { // 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($object->id, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
}
|
||||
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
|
||||
if (!$i) {
|
||||
$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
|
||||
}
|
||||
if (!isset($totalarray['val'])) {
|
||||
$totalarray['val'] = array();
|
||||
}
|
||||
if (!isset($totalarray['val']['t.'.$key])) {
|
||||
$totalarray['val']['t.'.$key] = 0;
|
||||
}
|
||||
$totalarray['val']['t.'.$key] += $object->$key;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
||||
// Fields from hook
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Action column
|
||||
print '<td class="nowrap center">';
|
||||
if ($massactionbutton || $massaction) { // 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($object->id, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
}
|
||||
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
foreach ($object->fields as $key => $val) {
|
||||
$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
|
||||
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
} elseif ($key == 'status') {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
}
|
||||
|
||||
print '</tr>'."\n";
|
||||
if (in_array($val['type'], array('timestamp'))) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
||||
} elseif ($key == 'ref') {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
||||
}
|
||||
|
||||
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'right';
|
||||
}
|
||||
//if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
|
||||
|
||||
if (!empty($arrayfields['t.'.$key]['checked'])) {
|
||||
print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '');
|
||||
if (preg_match('/tdoverflow/', $cssforfield)) {
|
||||
print ' title="'.dol_escape_htmltag($object->$key).'"';
|
||||
}
|
||||
print '>';
|
||||
if ($key == 'status') {
|
||||
print $object->getLibStatut(5);
|
||||
} elseif ($key == 'rowid') {
|
||||
print $object->showOutputField($val, $key, $object->id, '');
|
||||
} else {
|
||||
print $object->showOutputField($val, $key, $object->$key, '');
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
|
||||
if (!$i) {
|
||||
$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
|
||||
}
|
||||
if (!isset($totalarray['val'])) {
|
||||
$totalarray['val'] = array();
|
||||
}
|
||||
if (!isset($totalarray['val']['t.'.$key])) {
|
||||
$totalarray['val']['t.'.$key] = 0;
|
||||
}
|
||||
$totalarray['val']['t.'.$key] += $object->$key;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
||||
// Fields from hook
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Action column
|
||||
if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
||||
print '<td class="nowrap center">';
|
||||
if ($massactionbutton || $massaction) { // 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($object->id, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
}
|
||||
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
print '</tr>'."\n";
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
@ -582,7 +670,7 @@ if ($num == 0) {
|
||||
$colspan++;
|
||||
}
|
||||
}
|
||||
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
|
||||
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
|
||||
}
|
||||
|
||||
|
||||
@ -596,16 +684,18 @@ print '</table>'."\n";
|
||||
print '</div>'."\n";
|
||||
|
||||
print load_fiche_titre($langs->trans("Other"), '', '');
|
||||
|
||||
|
||||
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Parameter").'</td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Hide e-mail headers from collected messages
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("EmailCollectorHideMailHeaders").'</td>';
|
||||
print '<tr class="oddeven"><td>'.$form->textwithpicto($langs->trans("EmailCollectorHideMailHeaders"), $langs->transnoentitiesnoconv("EmailCollectorHideMailHeadersHelp")).'</td>';
|
||||
print '<td class="left">';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('MAIN_EMAILCOLLECTOR_MAIL_WITHOUT_HEADER');
|
||||
@ -614,12 +704,13 @@ if ($conf->use_javascript_ajax) {
|
||||
print $form->selectarray("MAIN_EMAILCOLLECTOR_MAIL_WITHOUT_HEADER", $arrval, $conf->global->TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND);
|
||||
}
|
||||
print '</td>';
|
||||
print '<td class="center">';
|
||||
print $form->textwithpicto('', $langs->trans("EmailCollectorHideMailHeadersHelp"), 1, 'help');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '</table><br>';
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '</form>'."\n";
|
||||
|
||||
if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
|
||||
|
||||
@ -220,7 +220,7 @@ if ($action == 'edit') {
|
||||
foreach ($arrayofparameters as $constname => $val) {
|
||||
if ($val['enabled']==1) {
|
||||
$setupnotempty++;
|
||||
print '<tr class="oddeven"><td>aa';
|
||||
print '<tr class="oddeven"><td>';
|
||||
$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>';
|
||||
@ -457,7 +457,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
|
||||
|
||||
print '<td class="center">';
|
||||
$constforvar = 'EVENTORGANIZATION_'.strtoupper($myTmpObjectKey).'_ADDON';
|
||||
if ($conf->global->$constforvar == $file) {
|
||||
if (getDolGlobalString($constforvar) == $file) {
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
} else {
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&object='.strtolower($myTmpObjectKey).'&value='.urlencode($file).'">';
|
||||
@ -597,7 +597,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
|
||||
// Default
|
||||
print '<td class="center">';
|
||||
$constforvar = 'EVENTORGANIZATION_'.strtoupper($myTmpObjectKey).'_ADDON';
|
||||
if ($conf->global->$constforvar == $name) {
|
||||
if (getDolGlobalString($constforvar) == $name) {
|
||||
//print img_picto($langs->trans("Default"), 'on');
|
||||
// Even if choice is the default value, we allow to disable it. Replace this with previous line if you need to disable unset
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetdoc&token='.newToken().'&object='.urlencode(strtolower($myTmpObjectKey)).'&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'&type='.urlencode($type).'" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
|
||||
|
||||
@ -36,10 +36,10 @@ $langs->loadLangs(array("admin", "trips", "errors", "other", "dict"));
|
||||
$error = 0;
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
$id = GETPOST('id', 'int');
|
||||
$ikoffset = GETPOST('ikoffset', 'int');
|
||||
$coef = GETPOST('coef', 'int');
|
||||
|
||||
$fk_c_exp_tax_cat = GETPOST('fk_c_exp_tax_cat');
|
||||
$fk_range = GETPOST('fk_range', 'int');
|
||||
|
||||
@ -62,9 +62,16 @@ if ($action == 'updateik') {
|
||||
}
|
||||
}
|
||||
|
||||
$expIk->setValues($_POST);
|
||||
$result = $expIk->create($user);
|
||||
$expIk->coef = $coef;
|
||||
$expIk->ikoffset = $ikoffset;
|
||||
$expIk->fk_c_exp_tax_cat = $fk_c_exp_tax_cat;
|
||||
$expIk->fk_range = $fk_range;
|
||||
|
||||
if ($expIk->id > 0) {
|
||||
$result = $expIk->update($user);
|
||||
} else {
|
||||
$result = $expIk->create($user);
|
||||
}
|
||||
if ($result > 0) {
|
||||
setEventMessages('SetupSaved', null, 'mesgs');
|
||||
|
||||
|
||||
@ -34,13 +34,19 @@ require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport_rule.class.ph
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("admin", "other", "trips", "errors", "dict"));
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('admin', 'dictionaryadmin','expensereport_rules'));
|
||||
|
||||
$object = new ExpenseReportRule($db);
|
||||
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('admin', 'dictionaryadmin','expensereport_rules'));
|
||||
|
||||
/*
|
||||
* Action
|
||||
*/
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
@ -51,7 +57,6 @@ if ($reshook < 0) {
|
||||
if (empty($reshook)) {
|
||||
//Init error
|
||||
$error = false;
|
||||
$message = false;
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$id = GETPOST('id', 'int');
|
||||
@ -59,21 +64,20 @@ if (empty($reshook)) {
|
||||
$apply_to = GETPOST('apply_to');
|
||||
$fk_user = GETPOST('fk_user', 'int');
|
||||
$fk_usergroup = GETPOST('fk_usergroup', 'int');
|
||||
|
||||
$fk_c_type_fees = GETPOST('fk_c_type_fees');
|
||||
$restrictive = GETPOST('restrictive', 'int');
|
||||
$fk_c_type_fees = GETPOST('fk_c_type_fees', 'int');
|
||||
$code_expense_rules_type = GETPOST('code_expense_rules_type');
|
||||
$dates = dol_mktime(12, 0, 0, GETPOST('startmonth'), GETPOST('startday'), GETPOST('startyear'));
|
||||
$datee = dol_mktime(12, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear'));
|
||||
$amount = GETPOST('amount');
|
||||
$amount = price2num(GETPOST('amount'), 'MT', 2);
|
||||
|
||||
$object = new ExpenseReportRule($db);
|
||||
if (!empty($id)) {
|
||||
$result = $object->fetch($id);
|
||||
if ($result < 0) {
|
||||
dol_print_error('', $object->error, $object->errors);
|
||||
}
|
||||
}
|
||||
// TODO do action
|
||||
|
||||
if ($action == 'save') {
|
||||
$error = 0;
|
||||
|
||||
@ -104,8 +108,6 @@ if (empty($reshook)) {
|
||||
}
|
||||
|
||||
if (empty($error)) {
|
||||
$object->setValues($_POST);
|
||||
|
||||
if ($apply_to == 'U') {
|
||||
$object->fk_user = (int) $fk_user;
|
||||
$object->fk_usergroup = 0;
|
||||
@ -122,18 +124,30 @@ if (empty($reshook)) {
|
||||
|
||||
$object->dates = $dates;
|
||||
$object->datee = $datee;
|
||||
|
||||
$object->restrictive = $restrictive;
|
||||
$object->fk_c_type_fees = $fk_c_type_fees;
|
||||
$object->code_expense_rules_type = $code_expense_rules_type;
|
||||
$object->amount = $amount;
|
||||
$object->entity = $conf->entity;
|
||||
|
||||
$res = $object->create($user);
|
||||
if ($object->id > 0) {
|
||||
$res = $object->update($user);
|
||||
} else {
|
||||
$res = $object->create($user);
|
||||
}
|
||||
if ($res > 0) {
|
||||
setEventMessages($langs->trans('ExpenseReportRuleSave'), null);
|
||||
} else {
|
||||
dol_print_error($object->db);
|
||||
$error++;
|
||||
}
|
||||
|
||||
header('Location: ' . $_SERVER['PHP_SELF']);
|
||||
exit;
|
||||
if (!$error) {
|
||||
header('Location: ' . $_SERVER['PHP_SELF']);
|
||||
exit;
|
||||
} else {
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'delete') {
|
||||
// TODO add confirm
|
||||
@ -207,7 +221,7 @@ if ($action != 'edit') {
|
||||
echo '<td class="linecoltyperule">' . $form->selectarray('code_expense_rules_type', $tab_rules_type, '', 0) . '</td>';
|
||||
echo '<td class="linecoldatestart">' . $form->selectDate(strtotime(date('Y-m-01', dol_now())), 'start', '', '', 0, '', 1, 0) . '</td>';
|
||||
echo '<td class="linecoldateend>' . $form->selectDate(strtotime(date('Y-m-t', dol_now())), 'end', '', '', 0, '', 1, 0) . '</td>';
|
||||
echo '<td class="linecolamount"><input type="text" value="" class="maxwidth100" name="amount" class="amount" /> ' . $conf->currency . '</td>';
|
||||
echo '<td class="linecolamount"><input type="text" value="" class="maxwidth100" name="amount" class="amount right" /></td>';
|
||||
echo '<td class="linecolrestrictive">' . $form->selectyesno('restrictive', 0, 1) . '</td>';
|
||||
echo '<td class="right linecolbutton"><input type="submit" class="button button-add" value="' . $langs->trans('Add') . '" /></td>';
|
||||
echo '</tr>';
|
||||
@ -266,11 +280,11 @@ foreach ($rules as $rule) {
|
||||
if ($rule->fk_c_type_fees == -1) {
|
||||
echo $langs->trans('AllExpenseReport');
|
||||
} else {
|
||||
$key = getDictionaryValue(MAIN_DB_PREFIX . 'c_type_fees', 'code', $rule->fk_c_type_fees, false, 'id');
|
||||
$key = getDictionaryValue('c_type_fees', 'code', $rule->fk_c_type_fees, false, 'id');
|
||||
if ($key && $key != $langs->trans($key)) {
|
||||
echo $langs->trans($key);
|
||||
} else {
|
||||
$value = getDictionaryValue(MAIN_DB_PREFIX . 'c_type_fees', 'label', $rule->fk_c_type_fees, false, 'id');
|
||||
$value = getDictionaryValue('c_type_fees', 'label', $rule->fk_c_type_fees, false, 'id');
|
||||
echo $langs->trans($value ? $value : 'Undefined'); // TODO check to return trans of 'code'
|
||||
}
|
||||
}
|
||||
@ -304,10 +318,10 @@ foreach ($rules as $rule) {
|
||||
}
|
||||
echo '</td>';
|
||||
|
||||
|
||||
// Amount
|
||||
echo '<td class="linecolamount">';
|
||||
if ($action == 'edit' && $object->id == $rule->id) {
|
||||
echo '<input type="text" value="' . price2num($object->amount) . '" name="amount" class="amount" />' . $conf->currency;
|
||||
echo '<input type="text" value="' . price2num($object->amount) . '" name="amount" class="amount width50 right" />';
|
||||
} else {
|
||||
echo price($rule->amount, 0, $langs, 1, -1, -1, $conf->currency);
|
||||
}
|
||||
|
||||
@ -442,23 +442,23 @@ print '<td>'.$langs->trans("Parameter").'</td>';
|
||||
print '<td align="center" width="60">'.$langs->trans("Value").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
/*var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY);
|
||||
var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY);
|
||||
var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY);
|
||||
var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY);
|
||||
*/
|
||||
//var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY);
|
||||
//var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY);
|
||||
//var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY);
|
||||
//var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY);
|
||||
|
||||
if (!isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY)) {
|
||||
$conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY = 1;
|
||||
}
|
||||
if (!isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY)) {
|
||||
$conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY = 1;
|
||||
}
|
||||
/*
|
||||
var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY);
|
||||
var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY);
|
||||
var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY);
|
||||
var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY);
|
||||
*/
|
||||
|
||||
//var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY);
|
||||
//var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY);
|
||||
//var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY);
|
||||
//var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY);
|
||||
|
||||
|
||||
// Set working days
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
@ -279,7 +279,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
|
||||
|
||||
print '<td class="center">';
|
||||
$constforvar = 'HRMTEST_'.strtoupper($myTmpObjectKey).'_ADDON';
|
||||
if ($conf->global->$constforvar == $file) {
|
||||
if (getDolGlobalString($constforvar) == $file) {
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
} else {
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&object='.strtolower($myTmpObjectKey).'&value='.urlencode($file).'">';
|
||||
@ -421,7 +421,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
|
||||
// Default
|
||||
print '<td class="center">';
|
||||
$constforvar = 'HRMTEST_'.strtoupper($myTmpObjectKey).'_ADDON';
|
||||
if ($conf->global->$constforvar == $name) {
|
||||
if (getDolGlobalString($constforvar) == $name) {
|
||||
//print img_picto($langs->trans("Default"), 'on');
|
||||
// Even if choice is the default value, we allow to disable it. Replace this with previous line if you need to disable unset
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetdoc&token='.newToken().'&object='.urlencode(strtolower($myTmpObjectKey)).'&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'&type='.urlencode($type).'" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
|
||||
|
||||
@ -323,130 +323,6 @@ print '<br>';
|
||||
|
||||
clearstatcache();
|
||||
|
||||
if ($mode == 'template') {
|
||||
// Themes and themes options
|
||||
showSkins(null, 1);
|
||||
}
|
||||
|
||||
if ($mode == 'dashboard') {
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table summary="blockdashboard" class="noborder centpercent editmode tableforfield">';
|
||||
|
||||
// Message of the day on home page
|
||||
$substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount'));
|
||||
complete_substitutions_array($substitutionarray, $langs);
|
||||
|
||||
print '<tr class="oddeven width25p"><td>';
|
||||
$texthelp = $langs->trans("FollowingConstantsWillBeSubstituted") . '<br>';
|
||||
foreach ($substitutionarray as $key => $val) {
|
||||
$texthelp .= $key . '<br>';
|
||||
}
|
||||
print $form->textwithpicto($langs->trans("MessageOfDay"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessageofday');
|
||||
|
||||
print '</td><td>';
|
||||
|
||||
$doleditor = new DolEditor('main_motd', (isset($conf->global->MAIN_MOTD) ? $conf->global->MAIN_MOTD : ''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%');
|
||||
$doleditor->Create();
|
||||
|
||||
print '</td></tr>' . "\n";
|
||||
|
||||
/* no more need for this option. It is now a widget already controlled by end user
|
||||
print '<tr class="oddeven"><td>' . $langs->trans('BoxstatsDisableGlobal') . '</td><td>';
|
||||
print ajax_constantonoff("MAIN_DISABLE_GLOBAL_BOXSTATS", array(), $conf->entity, 0, 0, 1, 0);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
*/
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table summary="blockdashboard" class="noborder centpercent editmode tableforfield">';
|
||||
|
||||
print '<tr class="liste_titre"><td class="titlefieldmiddle">';
|
||||
print $langs->trans("DashboardDisableBlocks");
|
||||
print '</td><td class="titlefieldmiddle">';
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableGlobal') . '</td><td>';
|
||||
print ajax_constantonoff("MAIN_DISABLE_GLOBAL_WORKBOARD", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
|
||||
// Block meteo
|
||||
print '<tr class="oddeven"><td>' . $langs->trans('MAIN_DISABLE_METEO') . '</td><td>';
|
||||
print ajax_constantonoff("MAIN_DISABLE_METEO", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Block agenda
|
||||
print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockAgenda') . '</td><td>';
|
||||
print ajax_constantonoff("MAIN_DISABLE_BLOCK_AGENDA", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Block agenda
|
||||
print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockProject') . '</td><td>';
|
||||
print ajax_constantonoff("MAIN_DISABLE_BLOCK_PROJECT", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Block customer
|
||||
print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockCustomer') . '</td><td>';
|
||||
print ajax_constantonoff("MAIN_DISABLE_BLOCK_CUSTOMER", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Block supplier
|
||||
print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockSupplier') . '</td><td>';
|
||||
print ajax_constantonoff("MAIN_DISABLE_BLOCK_SUPPLIER", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Block contract
|
||||
print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockContract') . '</td><td>';
|
||||
print ajax_constantonoff("MAIN_DISABLE_BLOCK_CONTRACT", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Block ticket
|
||||
print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockTicket') . '</td><td>';
|
||||
print ajax_constantonoff("MAIN_DISABLE_BLOCK_TICKET", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Block bank
|
||||
print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockBank') . '</td><td>';
|
||||
print ajax_constantonoff("MAIN_DISABLE_BLOCK_BANK", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Block adherent
|
||||
print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockAdherent') . '</td><td>';
|
||||
print ajax_constantonoff("MAIN_DISABLE_BLOCK_ADHERENT", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Block expense report
|
||||
print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockExpenseReport') . '</td><td>';
|
||||
print ajax_constantonoff("MAIN_DISABLE_BLOCK_EXPENSEREPORT", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Block holiday
|
||||
print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockHoliday') . '</td><td>';
|
||||
print ajax_constantonoff("MAIN_DISABLE_BLOCK_HOLIDAY", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print '</table>' . "\n";
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
if ($mode == 'other') {
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table summary="edit" class="noborder centpercent editmode tableforfield">';
|
||||
@ -587,6 +463,133 @@ if ($mode == 'other') {
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
|
||||
if ($mode == 'template') {
|
||||
// Themes and themes options
|
||||
showSkins(null, 1);
|
||||
}
|
||||
|
||||
|
||||
if ($mode == 'dashboard') {
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table summary="blockdashboard" class="noborder centpercent editmode tableforfield">';
|
||||
|
||||
// Message of the day on home page
|
||||
$substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount'));
|
||||
complete_substitutions_array($substitutionarray, $langs);
|
||||
|
||||
print '<tr class="oddeven width25p"><td>';
|
||||
$texthelp = $langs->trans("FollowingConstantsWillBeSubstituted") . '<br>';
|
||||
foreach ($substitutionarray as $key => $val) {
|
||||
$texthelp .= $key . '<br>';
|
||||
}
|
||||
print $form->textwithpicto($langs->trans("MessageOfDay"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessageofday');
|
||||
|
||||
print '</td><td>';
|
||||
|
||||
$doleditor = new DolEditor('main_motd', (isset($conf->global->MAIN_MOTD) ? $conf->global->MAIN_MOTD : ''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%');
|
||||
$doleditor->Create();
|
||||
|
||||
print '</td></tr>' . "\n";
|
||||
|
||||
/* no more need for this option. It is now a widget already controlled by end user
|
||||
print '<tr class="oddeven"><td>' . $langs->trans('BoxstatsDisableGlobal') . '</td><td>';
|
||||
print ajax_constantonoff("MAIN_DISABLE_GLOBAL_BOXSTATS", array(), $conf->entity, 0, 0, 1, 0);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
*/
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table summary="blockdashboard" class="noborder centpercent editmode tableforfield">';
|
||||
|
||||
print '<tr class="liste_titre"><td class="titlefieldmiddle">';
|
||||
print $langs->trans("DashboardDisableBlocks");
|
||||
print '</td><td class="titlefieldmiddle">';
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableGlobal') . '</td><td>';
|
||||
print ajax_constantonoff("MAIN_DISABLE_GLOBAL_WORKBOARD", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
|
||||
// Block meteo
|
||||
print '<tr class="oddeven"><td>' . $langs->trans('MAIN_DISABLE_METEO') . '</td><td>';
|
||||
print ajax_constantonoff("MAIN_DISABLE_METEO", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Block agenda
|
||||
print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockAgenda') . '</td><td>';
|
||||
print ajax_constantonoff("MAIN_DISABLE_BLOCK_AGENDA", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Block agenda
|
||||
print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockProject') . '</td><td>';
|
||||
print ajax_constantonoff("MAIN_DISABLE_BLOCK_PROJECT", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Block customer
|
||||
print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockCustomer') . '</td><td>';
|
||||
print ajax_constantonoff("MAIN_DISABLE_BLOCK_CUSTOMER", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Block supplier
|
||||
print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockSupplier') . '</td><td>';
|
||||
print ajax_constantonoff("MAIN_DISABLE_BLOCK_SUPPLIER", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Block contract
|
||||
print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockContract') . '</td><td>';
|
||||
print ajax_constantonoff("MAIN_DISABLE_BLOCK_CONTRACT", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Block ticket
|
||||
print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockTicket') . '</td><td>';
|
||||
print ajax_constantonoff("MAIN_DISABLE_BLOCK_TICKET", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Block bank
|
||||
print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockBank') . '</td><td>';
|
||||
print ajax_constantonoff("MAIN_DISABLE_BLOCK_BANK", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Block adherent
|
||||
print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockAdherent') . '</td><td>';
|
||||
print ajax_constantonoff("MAIN_DISABLE_BLOCK_ADHERENT", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Block expense report
|
||||
print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockExpenseReport') . '</td><td>';
|
||||
print ajax_constantonoff("MAIN_DISABLE_BLOCK_EXPENSEREPORT", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Block holiday
|
||||
print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockHoliday') . '</td><td>';
|
||||
print ajax_constantonoff("MAIN_DISABLE_BLOCK_HOLIDAY", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print '</table>' . "\n";
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
|
||||
if ($mode == 'login') {
|
||||
// Other
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
|
||||
@ -403,7 +403,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
|
||||
|
||||
print '<td class="center">';
|
||||
$constforvar = 'KNOWLEDGEMANAGEMENT_'.strtoupper($myTmpObjectKey).'_ADDON';
|
||||
if ($conf->global->$constforvar == $file) {
|
||||
if (getDolGlobalString($constforvar) == $file) {
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
} else {
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&object='.strtolower($myTmpObjectKey).'&value='.urlencode($file).'">';
|
||||
@ -545,7 +545,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
|
||||
// Default
|
||||
print '<td class="center">';
|
||||
$constforvar = 'KNOWLEDGEMANAGEMENT_'.strtoupper($myTmpObjectKey).'_ADDON';
|
||||
if ($conf->global->$constforvar == $name) {
|
||||
if (getDolGlobalString($constforvar) == $name) {
|
||||
//print img_picto($langs->trans("Default"), 'on');
|
||||
// Even if choice is the default value, we allow to disable it. Replace this with previous line if you need to disable unset
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetdoc&token='.newToken().'&object='.urlencode(strtolower($myTmpObjectKey)).'&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'&type='.urlencode($type).'" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
|
||||
|
||||
@ -169,7 +169,7 @@ if (empty($reshook)) {
|
||||
foreach ($object->fields as $key => $val) {
|
||||
$search[$key] = '';
|
||||
}
|
||||
$toselect = '';
|
||||
$toselect = array();
|
||||
$search_array_options = array();
|
||||
}
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
|
||||
|
||||
@ -66,10 +66,6 @@ $search_lang = GETPOST('search_lang', 'alpha');
|
||||
$search_fk_user = GETPOST('search_fk_user', 'intcomma');
|
||||
$search_topic = GETPOST('search_topic', 'alpha');
|
||||
|
||||
if (!empty($user->socid)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
$acts = array();
|
||||
$actl = array();
|
||||
$acts[0] = "activate";
|
||||
@ -100,6 +96,7 @@ if (empty($sortorder)) {
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('emailtemplates'));
|
||||
|
||||
|
||||
// Name of SQL tables of dictionaries
|
||||
$tabname = array();
|
||||
$tabname[25] = MAIN_DB_PREFIX."c_email_templates";
|
||||
@ -246,6 +243,12 @@ if ($reshook == 0) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (!empty($user->socid)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
$permissiontoadd = 1;
|
||||
|
||||
//asort($elementList);
|
||||
@ -273,6 +276,9 @@ if ($reshook < 0) {
|
||||
}
|
||||
|
||||
if (empty($reshook)) {
|
||||
// Selection of new fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
|
||||
// All tests are required to be compatible with all browsers
|
||||
@ -281,7 +287,7 @@ if (empty($reshook)) {
|
||||
$search_lang = '';
|
||||
$search_fk_user = '';
|
||||
$search_topic = '';
|
||||
$toselect = '';
|
||||
$toselect = array();
|
||||
$search_array_options = array();
|
||||
}
|
||||
|
||||
@ -395,7 +401,7 @@ if (empty($reshook)) {
|
||||
}
|
||||
} elseif ($keycode == 'content') {
|
||||
$sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'";
|
||||
} elseif (in_array($keycode, array('joinfiles', 'private', 'position'))) {
|
||||
} elseif (in_array($keycode, array('joinfiles', 'private', 'position', 'entity'))) {
|
||||
$sql .= (int) GETPOST($keycode, 'int');
|
||||
} else {
|
||||
$sql .= "'".$db->escape(GETPOST($keycode, 'nohtml'))."'";
|
||||
@ -502,9 +508,9 @@ if (empty($reshook)) {
|
||||
if ($action == 'confirm_delete' && $confirm == 'yes') { // delete
|
||||
$rowidcol = "rowid";
|
||||
|
||||
$sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol."=".((int) $rowid);
|
||||
$sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol." = ".((int) $rowid);
|
||||
if (!$user->admin) { // A non admin user can only edit its own template
|
||||
$sql .= " AND fk_user = ".((int) $user->id);
|
||||
$sql .= " AND fk_user = ".((int) $user->id);
|
||||
}
|
||||
dol_syslog("delete", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
@ -548,47 +554,20 @@ if (empty($reshook)) {
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
$formadmin = new FormAdmin($db);
|
||||
|
||||
//$help_url = "EN:Module_MyObject|FR:Module_MyObject_FR|ES:Módulo_MyObject";
|
||||
$help_url = '';
|
||||
if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates')) {
|
||||
$title = $langs->trans("EMailsSetup");
|
||||
} else {
|
||||
$title = $langs->trans("EMailsTemplates");
|
||||
$title = $langs->trans("EMailTemplates");
|
||||
}
|
||||
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
$linkback = '';
|
||||
$titlepicto = 'title_setup';
|
||||
|
||||
|
||||
$url = DOL_URL_ROOT.'/admin/mails_templates.php?action=add';
|
||||
$newcardbutton = dolGetButtonTitle($langs->trans('NewEMailTemplate'), '', 'fa fa-plus-circle', $url, '', $permissiontoadd);
|
||||
|
||||
|
||||
if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates')) {
|
||||
print load_fiche_titre($title, '', $titlepicto);
|
||||
} else {
|
||||
print load_fiche_titre($title, $newcardbutton, $titlepicto);
|
||||
}
|
||||
|
||||
if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates')) {
|
||||
$head = email_admin_prepare_head();
|
||||
|
||||
print dol_get_fiche_head($head, 'templates', '', -1);
|
||||
|
||||
if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates')) {
|
||||
print load_fiche_titre('', $newcardbutton, '');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Confirmation de la suppression de la ligne
|
||||
if ($action == 'delete') {
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$code.'&id='.$id, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete', '', 0, 1);
|
||||
}
|
||||
|
||||
$morejs = array();
|
||||
$morecss = array();
|
||||
|
||||
$sql = "SELECT rowid as rowid, module, label, type_template, lang, fk_user, private, position, topic, joinfiles, content_lines, content, enabled, active";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_email_templates";
|
||||
@ -623,6 +602,78 @@ $sql .= $db->order($sortfield, $sortorder);
|
||||
$sql .= $db->plimit($listlimit + 1, $offset);
|
||||
//print $sql;
|
||||
|
||||
// Output page
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', '');
|
||||
|
||||
$arrayofselected = is_array($toselect) ? $toselect : array();
|
||||
|
||||
$param = '';
|
||||
if (!empty($mode)) {
|
||||
$param .= '&mode='.urlencode($mode);
|
||||
}
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
|
||||
$param .= '&contextpage='.urlencode($contextpage);
|
||||
}
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) {
|
||||
$param .= '&limit='.urlencode($limit);
|
||||
}
|
||||
foreach ($search as $key => $val) {
|
||||
if (is_array($search[$key]) && count($search[$key])) {
|
||||
foreach ($search[$key] as $skey) {
|
||||
if ($skey != '') {
|
||||
$param .= '&search_'.$key.'[]='.urlencode($skey);
|
||||
}
|
||||
}
|
||||
} elseif ($search[$key] != '') {
|
||||
$param .= '&search_'.$key.'='.urlencode($search[$key]);
|
||||
}
|
||||
}
|
||||
if ($optioncss != '') {
|
||||
$param .= '&optioncss='.urlencode($optioncss);
|
||||
}
|
||||
// Add $param from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||
// Add $param from hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$param .= $hookmanager->resPrint;
|
||||
|
||||
|
||||
$linkback = '';
|
||||
$titlepicto = 'title_setup';
|
||||
|
||||
|
||||
$url = DOL_URL_ROOT.'/admin/mails_templates.php?action=add&token='.newToken();
|
||||
$newcardbutton = dolGetButtonTitle($langs->trans('NewEMailTemplate'), '', 'fa fa-plus-circle', $url, '', $permissiontoadd);
|
||||
|
||||
|
||||
if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates')) {
|
||||
print load_fiche_titre($title, '', $titlepicto);
|
||||
} else {
|
||||
print load_fiche_titre($title, $newcardbutton, $titlepicto);
|
||||
}
|
||||
|
||||
if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates')) {
|
||||
$head = email_admin_prepare_head();
|
||||
|
||||
print dol_get_fiche_head($head, 'templates', '', -1);
|
||||
|
||||
if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates')) {
|
||||
print load_fiche_titre('', $newcardbutton, '');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Confirmation de la suppression de la ligne
|
||||
if ($action == 'delete') {
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$code.'&id='.$id, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete', '', 0, 1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$fieldlist = explode(',', $tabfield[$id]);
|
||||
|
||||
if ($action == 'add') {
|
||||
@ -681,7 +732,7 @@ if ($action == 'add') {
|
||||
}
|
||||
|
||||
if ($valuetoshow != '') {
|
||||
print '<td class="'.$align.'">';
|
||||
print '<th class="'.$align.'">';
|
||||
if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) {
|
||||
print '<a href="'.$tabhelp[$id][$value].'" target="_blank" rel="noopener noreferrer">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
|
||||
} elseif (!empty($tabhelp[$id][$value])) {
|
||||
@ -693,12 +744,12 @@ if ($action == 'add') {
|
||||
} else {
|
||||
print $valuetoshow;
|
||||
}
|
||||
print '</td>';
|
||||
print '</th>';
|
||||
}
|
||||
}
|
||||
print '<td>';
|
||||
print '<th>';
|
||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||
print '</td>';
|
||||
print '</th>';
|
||||
print '</tr>';
|
||||
|
||||
$obj = new stdClass();
|
||||
@ -742,7 +793,7 @@ if ($action == 'add') {
|
||||
$fieldsforcontent = array('topic', 'joinfiles', 'content', 'content_lines');
|
||||
}
|
||||
foreach ($fieldsforcontent as $tmpfieldlist) {
|
||||
print '<tr class="impair nodrag nodrop nohover"><td colspan="6" class="nobottom">';
|
||||
print '<tr class="impair nodrag nodrop nohover"><td colspan="7" class="nobottom">';
|
||||
|
||||
// Label
|
||||
if ($tmpfieldlist == 'topic') {
|
||||
@ -773,24 +824,33 @@ if ($action == 'add') {
|
||||
print $doleditor->Create(1);
|
||||
}
|
||||
print '</td>';
|
||||
if ($tmpfieldlist == 'topic') {
|
||||
print '<td class="center" rowspan="'.(count($fieldsforcontent)).'">';
|
||||
if ($action != 'edit') {
|
||||
print '<input type="submit" class="button button-add" name="actionadd" value="'.$langs->trans("Add").'"><br>';
|
||||
print '<input type="submit" class="button button-cancel" name="actioncancel" value="'.$langs->trans("Cancel").'">';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
// else print '<td></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
if ($action != 'edit') {
|
||||
print '<center>';
|
||||
print '<input type="submit" class="button button-add" name="actionadd" value="'.$langs->trans("Add").'"> ';
|
||||
print '<input type="submit" class="button button-cancel" name="actioncancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '</center>';
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
print '</form>';
|
||||
print '<br>';
|
||||
print '<br><br>';
|
||||
} // END IF not edit
|
||||
|
||||
// List of available record in database
|
||||
dol_syslog("htdocs/admin/dict", LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql) {
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from', 'alpha')).'">';
|
||||
@ -798,157 +858,155 @@ print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('fro
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
// List of available record in database
|
||||
dol_syslog("htdocs/admin/dict", LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
$i = 0;
|
||||
|
||||
$param = '&id='.$id;
|
||||
if ($search_label) {
|
||||
$param .= '&search_label='.urlencode($search_label);
|
||||
}
|
||||
if ($search_lang > 0) {
|
||||
$param .= '&search_lang='.urlencode($search_lang);
|
||||
}
|
||||
if ($search_type_template != '-1') {
|
||||
$param .= '&search_type_template='.urlencode($search_type_template);
|
||||
}
|
||||
if ($search_fk_user > 0) {
|
||||
$param .= '&search_fk_user='.urlencode($search_fk_user);
|
||||
}
|
||||
if ($search_topic) {
|
||||
$param .= '&search_topic='.urlencode($search_topic);
|
||||
}
|
||||
$param = '&id='.$id;
|
||||
if ($search_label) {
|
||||
$param .= '&search_label='.urlencode($search_label);
|
||||
}
|
||||
if ($search_lang > 0) {
|
||||
$param .= '&search_lang='.urlencode($search_lang);
|
||||
}
|
||||
if ($search_type_template != '-1') {
|
||||
$param .= '&search_type_template='.urlencode($search_type_template);
|
||||
}
|
||||
if ($search_fk_user > 0) {
|
||||
$param .= '&search_fk_user='.urlencode($search_fk_user);
|
||||
}
|
||||
if ($search_topic) {
|
||||
$param .= '&search_topic='.urlencode($search_topic);
|
||||
}
|
||||
|
||||
$paramwithsearch = $param;
|
||||
if ($sortorder) {
|
||||
$paramwithsearch .= '&sortorder='.urlencode($sortorder);
|
||||
}
|
||||
if ($sortfield) {
|
||||
$paramwithsearch .= '&sortfield='.urlencode($sortfield);
|
||||
}
|
||||
if (GETPOST('from', 'alpha')) {
|
||||
$paramwithsearch .= '&from='.urlencode(GETPOST('from', 'alpha'));
|
||||
}
|
||||
$paramwithsearch = $param;
|
||||
if ($sortorder) {
|
||||
$paramwithsearch .= '&sortorder='.urlencode($sortorder);
|
||||
}
|
||||
if ($sortfield) {
|
||||
$paramwithsearch .= '&sortfield='.urlencode($sortfield);
|
||||
}
|
||||
if (GETPOST('from', 'alpha')) {
|
||||
$paramwithsearch .= '&from='.urlencode(GETPOST('from', 'alpha'));
|
||||
}
|
||||
|
||||
// There is several pages
|
||||
if ($num > $listlimit) {
|
||||
print '<tr class="none"><td class="right" colspan="'.(3 + count($fieldlist)).'">';
|
||||
print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page + 1).'</span></li>');
|
||||
print '</td></tr>';
|
||||
}
|
||||
// There is several pages
|
||||
if ($num > $listlimit) {
|
||||
print '<tr class="none"><td class="right" colspan="'.(3 + count($fieldlist)).'">';
|
||||
print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page + 1).'</span></li>');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
// Title line with search boxes
|
||||
print '<tr class="liste_titre">';
|
||||
// Title line with search boxes
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
foreach ($fieldlist as $field => $value) {
|
||||
if ($value == 'label') {
|
||||
print '<td class="liste_titre"><input type="text" name="search_label" class="maxwidth200" value="'.dol_escape_htmltag($search_label).'"></td>';
|
||||
} elseif ($value == 'lang') {
|
||||
print '<td class="liste_titre">';
|
||||
print $formadmin->select_language($search_lang, 'search_lang', 0, null, 1, 0, 0, 'maxwidth150');
|
||||
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 '</td>';
|
||||
} elseif ($value == 'topic') {
|
||||
print '<td class="liste_titre"><input type="text" name="search_topic" value="'.dol_escape_htmltag($search_topic).'"></td>';
|
||||
} elseif ($value == 'type_template') {
|
||||
print '<td class="liste_titre center">';
|
||||
print $form->selectarray('search_type_template', $elementList, $search_type_template, 1, 0, 0, '', 0, 0, 0, '', 'minwidth150', 1, '', 0, 1);
|
||||
print '</td>';
|
||||
} elseif (!in_array($value, array('content', 'content_lines'))) {
|
||||
print '<td class="liste_titre"></td>';
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) {
|
||||
foreach ($fieldlist as $field => $value) {
|
||||
if ($value == 'label') {
|
||||
print '<td class="liste_titre"><input type="text" name="search_label" class="maxwidth200" value="'.dol_escape_htmltag($search_label).'"></td>';
|
||||
} elseif ($value == 'lang') {
|
||||
print '<td class="liste_titre">';
|
||||
print $formadmin->select_language($search_lang, 'search_lang', 0, null, 1, 0, 0, 'maxwidth150');
|
||||
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 '</td>';
|
||||
} elseif ($value == 'topic') {
|
||||
print '<td class="liste_titre"><input type="text" name="search_topic" value="'.dol_escape_htmltag($search_topic).'"></td>';
|
||||
} elseif ($value == 'type_template') {
|
||||
print '<td class="liste_titre center">';
|
||||
print $form->selectarray('search_type_template', $elementList, $search_type_template, 1, 0, 0, '', 0, 0, 0, '', 'minwidth150', 1, '', 0, 1);
|
||||
print '</td>';
|
||||
} elseif (!in_array($value, array('content', 'content_lines'))) {
|
||||
print '<td class="liste_titre"></td>';
|
||||
}
|
||||
}
|
||||
|
||||
// Action column
|
||||
print '<td class="liste_titre right" width="64">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) {
|
||||
print '<td class="liste_titre"></td>';
|
||||
}
|
||||
|
||||
// Title of lines
|
||||
print '<tr class="liste_titre">';
|
||||
foreach ($fieldlist as $field => $value) {
|
||||
$showfield = 1; // By defaut
|
||||
$align = "left";
|
||||
$sortable = 1;
|
||||
$valuetoshow = '';
|
||||
$forcenowrap = 1;
|
||||
/*
|
||||
$tmparray=getLabelOfField($fieldlist[$field]);
|
||||
$showfield=$tmp['showfield'];
|
||||
$valuetoshow=$tmp['valuetoshow'];
|
||||
$align=$tmp['align'];
|
||||
$sortable=$tmp['sortable'];
|
||||
*/
|
||||
$valuetoshow = ucfirst($fieldlist[$field]); // By defaut
|
||||
$valuetoshow = $langs->trans($valuetoshow); // try to translate
|
||||
if ($fieldlist[$field] == 'fk_user') {
|
||||
$valuetoshow = $langs->trans("Owner");
|
||||
}
|
||||
if ($fieldlist[$field] == 'lang') {
|
||||
$valuetoshow = $langs->trans("Language");
|
||||
}
|
||||
if ($fieldlist[$field] == 'type') {
|
||||
$valuetoshow = $langs->trans("Type");
|
||||
}
|
||||
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') {
|
||||
$valuetoshow = $langs->trans("Code");
|
||||
}
|
||||
if ($fieldlist[$field] == 'type_template') {
|
||||
$align = 'center';
|
||||
$valuetoshow = $langs->trans("TypeOfTemplate");
|
||||
}
|
||||
if ($fieldlist[$field] == 'private') {
|
||||
$align = 'center';
|
||||
}
|
||||
if ($fieldlist[$field] == 'position') {
|
||||
$align = 'center';
|
||||
}
|
||||
// Action column
|
||||
print '<td class="liste_titre right" width="64">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
if ($fieldlist[$field] == 'joinfiles') {
|
||||
$valuetoshow = $langs->trans("FilesAttachedToEmail"); $align = 'center'; $forcenowrap = 0;
|
||||
}
|
||||
if ($fieldlist[$field] == 'content') {
|
||||
$valuetoshow = $langs->trans("Content"); $showfield = 0;
|
||||
}
|
||||
if ($fieldlist[$field] == 'content_lines') {
|
||||
$valuetoshow = $langs->trans("ContentForLines"); $showfield = 0;
|
||||
}
|
||||
|
||||
// Show fields
|
||||
if ($showfield) {
|
||||
if (!empty($tabhelp[$id][$value])) {
|
||||
if (in_array($value, array('topic'))) {
|
||||
$valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, 'tooltip'.$value, $forcenowrap); // Tooltip on click
|
||||
} else {
|
||||
$valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, '', $forcenowrap); // Tooltip on hover
|
||||
}
|
||||
}
|
||||
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable ? $fieldlist[$field] : ''), ($page ? 'page='.$page.'&' : ''), $param, "align=".$align, $sortfield, $sortorder);
|
||||
}
|
||||
// Title of lines
|
||||
print '<tr class="liste_titre">';
|
||||
foreach ($fieldlist as $field => $value) {
|
||||
$showfield = 1; // By defaut
|
||||
$align = "left";
|
||||
$sortable = 1;
|
||||
$valuetoshow = '';
|
||||
$forcenowrap = 1;
|
||||
/*
|
||||
$tmparray=getLabelOfField($fieldlist[$field]);
|
||||
$showfield=$tmp['showfield'];
|
||||
$valuetoshow=$tmp['valuetoshow'];
|
||||
$align=$tmp['align'];
|
||||
$sortable=$tmp['sortable'];
|
||||
*/
|
||||
$valuetoshow = ucfirst($fieldlist[$field]); // By defaut
|
||||
$valuetoshow = $langs->trans($valuetoshow); // try to translate
|
||||
if ($fieldlist[$field] == 'fk_user') {
|
||||
$valuetoshow = $langs->trans("Owner");
|
||||
}
|
||||
if ($fieldlist[$field] == 'lang') {
|
||||
$valuetoshow = $langs->trans("Language");
|
||||
}
|
||||
if ($fieldlist[$field] == 'type') {
|
||||
$valuetoshow = $langs->trans("Type");
|
||||
}
|
||||
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') {
|
||||
$valuetoshow = $langs->trans("Code");
|
||||
}
|
||||
if ($fieldlist[$field] == 'type_template') {
|
||||
$align = 'center';
|
||||
$valuetoshow = $langs->trans("TypeOfTemplate");
|
||||
}
|
||||
if ($fieldlist[$field] == 'private') {
|
||||
$align = 'center';
|
||||
}
|
||||
if ($fieldlist[$field] == 'position') {
|
||||
$align = 'center';
|
||||
}
|
||||
|
||||
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page ? 'page='.$page.'&' : ''), $param, 'align="center"', $sortfield, $sortorder);
|
||||
print getTitleFieldOfList('');
|
||||
print '</tr>';
|
||||
if ($fieldlist[$field] == 'joinfiles') {
|
||||
$valuetoshow = $langs->trans("FilesAttachedToEmail"); $align = 'center'; $forcenowrap = 0;
|
||||
}
|
||||
if ($fieldlist[$field] == 'content') {
|
||||
$valuetoshow = $langs->trans("Content"); $showfield = 0;
|
||||
}
|
||||
if ($fieldlist[$field] == 'content_lines') {
|
||||
$valuetoshow = $langs->trans("ContentForLines"); $showfield = 0;
|
||||
}
|
||||
|
||||
if ($num) {
|
||||
// Lines with values
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
// Show fields
|
||||
if ($showfield) {
|
||||
if (!empty($tabhelp[$id][$value])) {
|
||||
if (in_array($value, array('topic'))) {
|
||||
$valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, 'tooltip'.$value, $forcenowrap); // Tooltip on click
|
||||
} else {
|
||||
$valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, '', $forcenowrap); // Tooltip on hover
|
||||
}
|
||||
}
|
||||
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable ? $fieldlist[$field] : ''), ($page ? 'page='.$page.'&' : ''), $param, "align=".$align, $sortfield, $sortorder);
|
||||
}
|
||||
}
|
||||
|
||||
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page ? 'page='.$page.'&' : ''), $param, 'align="center"', $sortfield, $sortorder);
|
||||
print getTitleFieldOfList('');
|
||||
print '</tr>';
|
||||
|
||||
if ($num) {
|
||||
$nbqualified = 0;
|
||||
|
||||
// Lines with values
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
if ($obj) {
|
||||
if ($action == 'edit' && ($rowid == (!empty($obj->rowid) ? $obj->rowid : $obj->code))) {
|
||||
print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">';
|
||||
|
||||
@ -1018,6 +1076,8 @@ if ($resql) {
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
$nbqualified++;
|
||||
} else {
|
||||
// If template is for a module, check module is enabled.
|
||||
if ($obj->module) {
|
||||
@ -1039,6 +1099,8 @@ if ($resql) {
|
||||
continue; // Email template not qualified
|
||||
}
|
||||
|
||||
$nbqualified++;
|
||||
|
||||
print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">';
|
||||
|
||||
$tmpaction = 'view';
|
||||
@ -1155,13 +1217,16 @@ if ($resql) {
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
// If no record found
|
||||
if ($nbqualified == 0) {
|
||||
$colspan = 10;
|
||||
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
@ -172,6 +172,10 @@ foreach ($modulesdir as $dir) {
|
||||
$moduleposition = '80'; // External modules at end by default
|
||||
}
|
||||
|
||||
if (empty($familyinfo[$familykey]['position'])) {
|
||||
$familyinfo[$familykey]['position'] = '0';
|
||||
}
|
||||
|
||||
$orders[$i] = $familyinfo[$familykey]['position']."_".$familykey."_".$moduleposition."_".$j; // Sort by family, then by module position then number
|
||||
$dirmod[$i] = $dir;
|
||||
//print $i.'-'.$dirmod[$i].'<br>';
|
||||
@ -250,19 +254,19 @@ if (!empty($conf->global->$const_name)) {
|
||||
$text .= $langs->trans("Disabled");
|
||||
}
|
||||
$tmp = $objMod->getLastActivationInfo();
|
||||
$authorid = $tmp['authorid'];
|
||||
$authorid = (empty($tmp['authorid']) ? '' : $tmp['authorid']);
|
||||
if ($authorid > 0) {
|
||||
$tmpuser = new User($db);
|
||||
$tmpuser->fetch($authorid);
|
||||
$text .= '<br><span class="opacitymedium">'.$langs->trans("LastActivationAuthor").':</span> ';
|
||||
$text .= $tmpuser->getNomUrl(1);
|
||||
}
|
||||
$ip = $tmp['ip'];
|
||||
$ip = (empty($tmp['ip']) ? '' : $tmp['ip']);
|
||||
if ($ip) {
|
||||
$text .= '<br><span class="opacitymedium">'.$langs->trans("LastActivationIP").':</span> ';
|
||||
$text .= $ip;
|
||||
}
|
||||
$lastactivationversion = $tmp['lastactivationversion'];
|
||||
$lastactivationversion = (empty($tmp['lastactivationversion']) ? '' : $tmp['lastactivationversion']);
|
||||
if ($lastactivationversion) {
|
||||
$text .= '<br><span class="opacitymedium">'.$langs->trans("LastActivationVersion").':</span> ';
|
||||
$text .= $lastactivationversion;
|
||||
|
||||
@ -529,7 +529,7 @@ if ($mode == 'common' || $mode == 'commonkanban') {
|
||||
$moreforfilter .= dolGetButtonTitle($langs->trans('CheckForModuleUpdate'), $langs->trans('CheckForModuleUpdate').'<br>'.$langs->trans('CheckForModuleUpdateHelp'), 'fa fa-sync', $_SERVER["PHP_SELF"].'?action=checklastversion&token='.newToken().'&mode='.$mode.$param, '', 1, array('morecss'=>'reposition'));
|
||||
$moreforfilter .= dolGetButtonTitleSeparator();
|
||||
$moreforfilter .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=commonkanban'.$param, '', ($mode == 'commonkanban' ? 2 : 1), array('morecss'=>'reposition'));
|
||||
$moreforfilter .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-list-alt imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.$param, '', ($mode == 'common' ? 2 : 1), array('morecss'=>'reposition'));
|
||||
$moreforfilter .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.$param, '', ($mode == 'common' ? 2 : 1), array('morecss'=>'reposition'));
|
||||
$moreforfilter .= '</li></ul></div>';
|
||||
|
||||
//$moreforfilter .= '<div class="floatright center marginrightonly hideonsmartphone" style="padding-top: 3px"><span class="paddingright">'.$moreinfo.'</span> '.$moreinfo2.'</div>';
|
||||
|
||||
@ -78,7 +78,7 @@ print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Parameters").'</td>'."\n";
|
||||
print '<td class="right" width="60">'.$langs->trans("Value").'</td>'."\n";
|
||||
print '<td class="right">'.$langs->trans("Value").'</td>'."\n";
|
||||
print '<td></td>';
|
||||
|
||||
|
||||
@ -106,6 +106,15 @@ if (empty($conf->use_javascript_ajax)) {
|
||||
print '</tr>';
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans('EnableResourceUsedInEventCheck').'</td>';
|
||||
print '<td class="right">';
|
||||
echo ajax_constantonoff('RESOURCE_USED_IN_EVENT_CHECK');
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
print '</tr>';
|
||||
|
||||
/*
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans('DisabledResourceLinkUser').'</td>';
|
||||
print '<td class="right">';
|
||||
@ -122,15 +131,7 @@ echo ajax_constantonoff('RESOURCE_HIDE_ADD_CONTACT_THIPARTY');
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans('EnableResourceUsedInEventCheck').'</td>';
|
||||
print '<td class="right">';
|
||||
echo ajax_constantonoff('RESOURCE_USED_IN_EVENT_CHECK');
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
print '</tr>';
|
||||
*/
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
@ -74,7 +74,6 @@ llxHeader('', $langs->trans("ResourceSetup"));
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("ResourceSetup"), $linkback, 'title_setup');
|
||||
print "<br>\n";
|
||||
|
||||
$head = resource_admin_prepare_head();
|
||||
|
||||
|
||||
@ -407,10 +407,10 @@ if (empty($error) && !empty($xml)) {
|
||||
$checksumget = md5(join(',', $checksumconcat));
|
||||
$checksumtoget = trim((string) $xml->dolibarr_htdocs_dir_checksum);
|
||||
|
||||
/*var_dump(count($file_list['added']));
|
||||
var_dump($checksumget);
|
||||
var_dump($checksumtoget);
|
||||
var_dump($checksumget == $checksumtoget);*/
|
||||
//var_dump(count($file_list['added']));
|
||||
//var_dump($checksumget);
|
||||
//var_dump($checksumtoget);
|
||||
//var_dump($checksumget == $checksumtoget);
|
||||
|
||||
$resultcomment = '';
|
||||
|
||||
|
||||
@ -183,6 +183,22 @@ print "<td>".$name."</td>";
|
||||
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
|
||||
print "</tr>";
|
||||
|
||||
$functions = ["easter_date"];
|
||||
$name = "Calendar";
|
||||
|
||||
print "<tr>";
|
||||
print "<td>".$name."</td>";
|
||||
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
|
||||
print "</tr>";
|
||||
|
||||
$functions = ["simplexml_load_string"];
|
||||
$name = "Xml";
|
||||
|
||||
print "<tr>";
|
||||
print "<td>".$name."</td>";
|
||||
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
|
||||
print "</tr>";
|
||||
|
||||
if (empty($_SERVER["SERVER_ADMIN"]) || $_SERVER["SERVER_ADMIN"] != 'doliwamp@localhost') {
|
||||
$functions = ["locale_get_primary_language", "locale_get_region"];
|
||||
$name = "Intl";
|
||||
|
||||
@ -58,23 +58,6 @@ print $langs->trans("xcache.optimizer").': '.yn(ini_get('xcache.optimizer')).' (
|
||||
print $langs->trans("xcache.stat").': '.yn(ini_get('xcache.stat')).'<br>'."\n";
|
||||
print $langs->trans("xcache.coverager").': '.yn(ini_get('xcache.coverager')).'<br>'."\n";
|
||||
|
||||
//print xcache_get();
|
||||
/*
|
||||
$cacheinfos = array();
|
||||
for ($i = 0; $i < 10; $i ++)
|
||||
{
|
||||
$data = xcache_info(XC_TYPE_PHP, $i);
|
||||
$data['cacheid'] = $i;
|
||||
$cacheinfos[] = $data;
|
||||
}
|
||||
|
||||
var_dump($cacheinfos);
|
||||
|
||||
if ($action == 'clear')
|
||||
{
|
||||
xcache_clear_cache();
|
||||
}
|
||||
*/
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
|
||||
@ -99,6 +99,50 @@ if ($action == 'updateMask') {
|
||||
// par appel methode canBeActivated
|
||||
|
||||
dolibarr_set_const($db, "TICKET_ADDON", $value, 'chaine', 0, '', $conf->entity);
|
||||
} elseif ($action == 'setvarworkflow') {
|
||||
$param_auto_read = GETPOST('TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND', 'alpha');
|
||||
$res = dolibarr_set_const($db, 'TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND', $param_auto_read, 'chaine', 0, '', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
$param_auto_assign = GETPOST('TICKET_AUTO_ASSIGN_USER_CREATE', 'alpha');
|
||||
$res = dolibarr_set_const($db, 'TICKET_AUTO_ASSIGN_USER_CREATE', $param_auto_assign, 'chaine', 0, '', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
$param_limit_view = GETPOST('TICKET_LIMIT_VIEW_ASSIGNED_ONLY', 'alpha');
|
||||
$res = dolibarr_set_const($db, 'TICKET_LIMIT_VIEW_ASSIGNED_ONLY', $param_limit_view, 'chaine', 0, '', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (GETPOSTISSET('product_category_id')) {
|
||||
$param_ticket_product_category = GETPOST('product_category_id', 'int');
|
||||
$res = dolibarr_set_const($db, 'TICKET_PRODUCT_CATEGORY', $param_ticket_product_category, 'chaine', 0, '', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
$param_delay_first_response = GETPOST('delay_first_response', 'int');
|
||||
$res = dolibarr_set_const($db, 'TICKET_DELAY_BEFORE_FIRST_RESPONSE', $param_delay_first_response, 'chaine', 0, '', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
$param_delay_between_responses = GETPOST('delay_between_responses', 'int');
|
||||
$res = dolibarr_set_const($db, 'TICKET_DELAY_SINCE_LAST_RESPONSE', $param_delay_between_responses, 'chaine', 0, '', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
$param_auto_notify_close = GETPOST('TICKET_NOTIFY_AT_CLOSING', 'alpha');
|
||||
$res = dolibarr_set_const($db, 'TICKET_NOTIFY_AT_CLOSING', $param_auto_notify_close, 'chaine', 0, '', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
}
|
||||
} elseif ($action == 'setvar') {
|
||||
include_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php";
|
||||
|
||||
@ -146,50 +190,6 @@ if ($action == 'updateMask') {
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'setvarworkflow') {
|
||||
$param_auto_read = GETPOST('TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND', 'alpha');
|
||||
$res = dolibarr_set_const($db, 'TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND', $param_auto_read, 'chaine', 0, '', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
$param_auto_assign = GETPOST('TICKET_AUTO_ASSIGN_USER_CREATE', 'alpha');
|
||||
$res = dolibarr_set_const($db, 'TICKET_AUTO_ASSIGN_USER_CREATE', $param_auto_assign, 'chaine', 0, '', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'setvarworkflowother' || $action == 'setvarworkflow') {
|
||||
$param_ticket_product_category = GETPOST('product_category_id', 'int');
|
||||
$res = dolibarr_set_const($db, 'TICKET_PRODUCT_CATEGORY', $param_ticket_product_category, 'chaine', 0, '', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'setvarother') {
|
||||
$param_must_exists = GETPOST('TICKET_EMAIL_MUST_EXISTS', 'alpha');
|
||||
$res = dolibarr_set_const($db, 'TICKET_EMAIL_MUST_EXISTS', $param_must_exists, 'chaine', 0, '', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
$param_disable_email = GETPOST('TICKET_DISABLE_NOTIFICATION_MAILS', 'alpha');
|
||||
$res = dolibarr_set_const($db, 'TICKET_DISABLE_NOTIFICATION_MAILS', $param_disable_email, 'chaine', 0, '', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
|
||||
$param_show_module_logo = GETPOST('TICKET_SHOW_MODULE_LOGO', 'alpha');
|
||||
$res = dolibarr_set_const($db, 'TICKET_SHOW_MODULE_LOGO', $param_show_module_logo, 'chaine', 0, '', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
|
||||
$param_notification_also_main_addressemail = GETPOST('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', 'alpha');
|
||||
@ -198,34 +198,9 @@ if ($action == 'setvarother') {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
$param_limit_view = GETPOST('TICKET_LIMIT_VIEW_ASSIGNED_ONLY', 'alpha');
|
||||
$res = dolibarr_set_const($db, 'TICKET_LIMIT_VIEW_ASSIGNED_ONLY', $param_limit_view, 'chaine', 0, '', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
$param_delay_first_response = GETPOST('delay_first_response', 'int');
|
||||
$res = dolibarr_set_const($db, 'TICKET_DELAY_BEFORE_FIRST_RESPONSE', $param_delay_first_response, 'chaine', 0, '', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
$param_delay_between_responses = GETPOST('delay_between_responses', 'int');
|
||||
$res = dolibarr_set_const($db, 'TICKET_DELAY_SINCE_LAST_RESPONSE', $param_delay_between_responses, 'chaine', 0, '', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
$param_auto_notify_close = GETPOST('TICKET_NOTIFY_AT_CLOSING', 'alpha');
|
||||
$res = dolibarr_set_const($db, 'TICKET_NOTIFY_AT_CLOSING', $param_auto_notify_close, 'chaine', 0, '', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
@ -384,8 +359,8 @@ if ($resql) {
|
||||
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print "<table class=\"noborder\" width=\"100%\">\n";
|
||||
print "<tr class=\"liste_titre\">\n";
|
||||
print '<table class="noborder cenpercent">'."\n";
|
||||
print '<tr class="liste_titre">'."\n";
|
||||
print '<td>'.$langs->trans("Name").'</td>';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td class="center" width="60">'.$langs->trans("Status")."</td>\n";
|
||||
@ -502,13 +477,14 @@ foreach ($dirmodels as $reldir) {
|
||||
print '</table>';
|
||||
print '</div><br>';
|
||||
|
||||
if (empty($conf->use_javascript_ajax)) {
|
||||
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" >';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="setvarworkflow">';
|
||||
}
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" >';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="setvarworkflow">';
|
||||
print '<input type="hidden" name="page_y" value="">';
|
||||
|
||||
print load_fiche_titre($langs->trans("Other"), '', '');
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
@ -563,34 +539,24 @@ print $formcategory->textwithpicto('', $langs->trans("TicketsAutoNotifyCloseHelp
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Choose which product category is used for tickets
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" >';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="setvarworkflowother">';
|
||||
if (! empty($conf->product->enabled)) {
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("TicketChooseProductCategory").'</td>';
|
||||
print '<td class="left">';
|
||||
$formcategory->selectProductCategory($conf->global->TICKET_PRODUCT_CATEGORY, 'product_category_id');
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_combobox('select_'.$htmlname);
|
||||
}
|
||||
print '</td>';
|
||||
print '<td class="center">';
|
||||
print $formcategory->textwithpicto('', $langs->trans("TicketChooseProductCategoryHelp"), 1, 'help');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("TicketChooseProductCategory").'</td>';
|
||||
print '<td class="left">';
|
||||
$formcategory->selectProductCategory($conf->global->TICKET_PRODUCT_CATEGORY, 'product_category_id');
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_combobox('select_'.$htmlname);
|
||||
}
|
||||
print '</td>';
|
||||
print '<td class="center">';
|
||||
print $formcategory->textwithpicto('', $langs->trans("TicketChooseProductCategoryHelp"), 1, 'help');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Define wanted maximum time elapsed before answers to tickets
|
||||
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" >';
|
||||
print '<input type="hidden" name="action" value="setvarother">';
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("TicketsDelayBeforeFirstAnswer")."</td>";
|
||||
print '<td class="left">
|
||||
<input type="number" value="'.$conf->global->TICKET_DELAY_BEFORE_FIRST_RESPONSE.'" name="delay_first_response">
|
||||
<input type="submit" class="button small" value="'.$langs->trans("Save").'">
|
||||
<input type="number" value="'.$conf->global->TICKET_DELAY_BEFORE_FIRST_RESPONSE.'" name="delay_first_response" class="width50">
|
||||
</td>';
|
||||
print '<td class="center">';
|
||||
print $formcategory->textwithpicto('', $langs->trans("TicketsDelayBeforeFirstAnswerHelp"), 1, 'help');
|
||||
@ -600,8 +566,7 @@ print '</tr>';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("TicketsDelayBetweenAnswers")."</td>";
|
||||
print '<td class="left">
|
||||
<input type="number" value="'.$conf->global->TICKET_DELAY_SINCE_LAST_RESPONSE.'" name="delay_between_responses">
|
||||
<input type="submit" class="button small" value="'.$langs->trans("Save").'">
|
||||
<input type="number" value="'.$conf->global->TICKET_DELAY_SINCE_LAST_RESPONSE.'" name="delay_between_responses" class="width50">
|
||||
</td>';
|
||||
print '<td class="center">';
|
||||
print $formcategory->textwithpicto('', $langs->trans("TicketsDelayBetweenAnswersHelp"), 1, 'help');
|
||||
@ -610,9 +575,7 @@ print '</tr>';
|
||||
|
||||
print '</table><br>';
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button button-save" value="'.$langs->trans("Save").'">';
|
||||
print '</div>';
|
||||
print $formcategory->buttonsSaveCancel("Save", '', array(), 0, 'reposition');
|
||||
|
||||
print '</form>';
|
||||
|
||||
@ -622,9 +585,10 @@ print load_fiche_titre($langs->trans("Notification"), '', '');
|
||||
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" >';
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" >';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="setvar">';
|
||||
print '<input type="hidden" name="page_y" value="">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="3">'.$langs->trans("Email").'</td>';
|
||||
@ -699,7 +663,7 @@ print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print $formcategory->buttonsSaveCancel("Save", '');
|
||||
print $formcategory->buttonsSaveCancel("Save", '', array(), 0, 'reposition');
|
||||
|
||||
print '</form>';
|
||||
|
||||
|
||||
@ -42,21 +42,24 @@ $label = GETPOST('label', 'alpha');
|
||||
$scandir = GETPOST('scandir', 'alpha');
|
||||
$type = 'ticket';
|
||||
|
||||
$error = 0;
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
$error = 0;
|
||||
$errors = array();
|
||||
|
||||
if ($action == 'setTICKET_ENABLE_PUBLIC_INTERFACE') {
|
||||
if (GETPOST('value')) {
|
||||
dolibarr_set_const($db, 'TICKET_ENABLE_PUBLIC_INTERFACE', 1, 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, 'TICKET_ENABLE_PUBLIC_INTERFACE', 1, 'chaine', 0, '', $conf->entity);
|
||||
} else {
|
||||
dolibarr_set_const($db, 'TICKET_ENABLE_PUBLIC_INTERFACE', 0, 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, 'TICKET_ENABLE_PUBLIC_INTERFACE', 0, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'setvar') {
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
$errors[] = $db->lasterror();
|
||||
}
|
||||
} elseif ($action == 'setvar') {
|
||||
include_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php";
|
||||
|
||||
if (GETPOSTISSET('TICKET_ENABLE_PUBLIC_INTERFACE')) { // only for no js case
|
||||
@ -64,14 +67,7 @@ if ($action == 'setvar') {
|
||||
$res = dolibarr_set_const($db, 'TICKET_ENABLE_PUBLIC_INTERFACE', $param_enable_public_interface, 'chaine', 0, '', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (GETPOSTISSET('TICKET_EMAIL_MUST_EXISTS')) { // only for no js case
|
||||
$param_must_exists = GETPOST('TICKET_EMAIL_MUST_EXISTS', 'alpha');
|
||||
$res = dolibarr_set_const($db, 'TICKET_EMAIL_MUST_EXISTS', $param_must_exists, 'chaine', 0, '', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
$errors[] = $db->lasterror();
|
||||
}
|
||||
}
|
||||
|
||||
@ -80,6 +76,7 @@ if ($action == 'setvar') {
|
||||
$res = dolibarr_set_const($db, 'TICKET_DISABLE_CUSTOMER_MAILS', $param_disable_email, 'chaine', 0, '', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
$errors[] = $db->lasterror();
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,6 +85,7 @@ if ($action == 'setvar') {
|
||||
$res = dolibarr_set_const($db, 'TICKET_SHOW_COMPANY_LOGO', $param_show_module_logo, 'chaine', 0, '', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
$errors[] = $db->lasterror();
|
||||
}
|
||||
}
|
||||
|
||||
@ -99,6 +97,7 @@ if ($action == 'setvar') {
|
||||
}
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
$errors[] = $db->lasterror();
|
||||
}
|
||||
|
||||
$text_home = GETPOST('TICKET_PUBLIC_TEXT_HOME', 'restricthtml');
|
||||
@ -109,6 +108,7 @@ if ($action == 'setvar') {
|
||||
}
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
$errors[] = $db->lasterror();
|
||||
}
|
||||
|
||||
$text_help = GETPOST('TICKET_PUBLIC_TEXT_HELP_MESSAGE', 'restricthtml');
|
||||
@ -119,6 +119,7 @@ if ($action == 'setvar') {
|
||||
}
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
$errors[] = $db->lasterror();
|
||||
}
|
||||
|
||||
$mail_new_ticket = GETPOST('TICKET_MESSAGE_MAIL_NEW', 'restricthtml');
|
||||
@ -129,6 +130,7 @@ if ($action == 'setvar') {
|
||||
}
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
$errors[] = $db->lasterror();
|
||||
}
|
||||
|
||||
$url_interface = GETPOST('TICKET_URL_PUBLIC_INTERFACE', 'alpha');
|
||||
@ -139,12 +141,14 @@ if ($action == 'setvar') {
|
||||
}
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
$errors[] = $db->lasterror();
|
||||
}
|
||||
|
||||
$param_public_notification_new_message_default_email = GETPOST('TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL', 'alpha');
|
||||
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL', $param_public_notification_new_message_default_email, 'chaine', 0, '', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
$errors[] = $db->lasterror();
|
||||
}
|
||||
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
|
||||
@ -152,10 +156,60 @@ if ($action == 'setvar') {
|
||||
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', $param_notification_also_main_addressemail, 'chaine', 0, '', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
$errors[] = $db->lasterror();
|
||||
}
|
||||
}
|
||||
} elseif (preg_match('/set_(.*)/', $action, $reg)) {
|
||||
$code = $reg[1];
|
||||
$value = GETPOSTISSET($code) ? GETPOST($code, 'int') : 1;
|
||||
$res = dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
$errors[] = $db->lasterror();
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
if ($code == 'TICKET_EMAIL_MUST_EXISTS') {
|
||||
$res = dolibarr_del_const($db, 'TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
$errors[] = $db->lasterror();
|
||||
}
|
||||
} elseif ($code == 'TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST') {
|
||||
$res = dolibarr_del_const($db, 'TICKET_EMAIL_MUST_EXISTS', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
$errors[] = $db->lasterror();
|
||||
}
|
||||
|
||||
// enable captcha by default
|
||||
$res = dolibarr_set_const($db, 'MAIN_SECURITY_ENABLECAPTCHA', 1, 'chaine', 0, '', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
$errors[] = $db->lasterror();
|
||||
}
|
||||
}
|
||||
}
|
||||
} elseif (preg_match('/del_(.*)/', $action, $reg)) {
|
||||
$code = $reg[1];
|
||||
$res = dolibarr_del_const($db, $code, $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
$errors[] = $db->lasterror();
|
||||
}
|
||||
}
|
||||
|
||||
if ($action != '') {
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
setEventMessage($langs->trans('SetupSaved'));
|
||||
header("Location: " . $_SERVER['PHP_SELF']);
|
||||
exit;
|
||||
} else {
|
||||
$db->rollback();
|
||||
setEventMessages('', $errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@ -180,7 +234,7 @@ $head = ticketAdminPrepareHead();
|
||||
|
||||
print dol_get_fiche_head($head, 'public', $langs->trans("Module56000Name"), -1, "ticket");
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("TicketPublicAccess").'</span> : <a class="wordbreak" href="'.DOL_URL_ROOT.'/public/ticket/index.php" target="_blank" rel="noopener noreferrer">'.dol_buildpath('/public/ticket/index.php', 2).'</a>';
|
||||
print '<span class="opacitymedium">'.$langs->trans("TicketPublicAccess").'</span> : <a class="wordbreak" href="'.DOL_URL_ROOT.'/public/ticket/index.php?entity='.$conf->entity.'" target="_blank" rel="noopener noreferrer">'.dol_buildpath('/public/ticket/index.php?entity='.$conf->entity, 2).'</a>';
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
@ -220,11 +274,10 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
|
||||
// Check if email exists
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("TicketsEmailMustExist").'</td>';
|
||||
print '<td class="left">';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('TICKET_EMAIL_MUST_EXISTS');
|
||||
if (empty(getDolGlobalInt('TICKET_EMAIL_MUST_EXISTS'))) {
|
||||
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=set_TICKET_EMAIL_MUST_EXISTS">' . img_picto($langs->trans('Disabled'), 'switch_off') . '</a>';
|
||||
} else {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("TICKET_EMAIL_MUST_EXISTS", $arrval, $conf->global->TICKET_EMAIL_MUST_EXISTS);
|
||||
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=del_TICKET_EMAIL_MUST_EXISTS">' . img_picto($langs->trans('Enabled'), 'switch_on') . '</a>';
|
||||
}
|
||||
print '</td>';
|
||||
print '<td class="center width75">';
|
||||
@ -232,6 +285,20 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Create third-party with contact if email not linked to a contact
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("TicketCreateThirdPartyWithContactIfNotExist").'</td>';
|
||||
print '<td class="left">';
|
||||
if (empty(getDolGlobalInt('TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST'))) {
|
||||
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=set_TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST">' . img_picto($langs->trans('Disabled'), 'switch_off') . '</a>';
|
||||
} else {
|
||||
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=del_TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST">' . img_picto($langs->trans('Enabled'), 'switch_on') . '</a>';
|
||||
}
|
||||
print '</td>';
|
||||
print '<td class="center width75">';
|
||||
print $form->textwithpicto('', $langs->trans("TicketCreateThirdPartyWithContactIfNotExistHelp"), 1, 'help');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
/*if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||
{
|
||||
// Show logo for module
|
||||
@ -341,7 +408,7 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
|
||||
|
||||
print '<br><br>';
|
||||
|
||||
print_fiche_titre($langs->trans("Emails"));
|
||||
print load_fiche_titre($langs->trans("Emails"));
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
@ -61,7 +61,11 @@ $version = '0.0';
|
||||
if ($action == 'getlastversion') {
|
||||
$result = getURLContent('https://sourceforge.net/projects/dolibarr/rss');
|
||||
//var_dump($result['content']);
|
||||
$sfurl = simplexml_load_string($result['content'], 'SimpleXMLElement', LIBXML_NOCDATA|LIBXML_NONET);
|
||||
if (function_exists('simplexml_load_string')) {
|
||||
$sfurl = simplexml_load_string($result['content'], 'SimpleXMLElement', LIBXML_NOCDATA|LIBXML_NONET);
|
||||
} else {
|
||||
$sfurl = 'xml_not_available';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -82,7 +86,10 @@ if (function_exists('curl_init')) {
|
||||
$conf->global->MAIN_USE_RESPONSE_TIMEOUT = 10;
|
||||
|
||||
if ($action == 'getlastversion') {
|
||||
if ($sfurl) {
|
||||
if ($sfurl == 'xml_not_available') {
|
||||
$langs->load("errors");
|
||||
print $langs->trans("LastStableVersion").' : <b class="error">'.$langs->trans("ErrorFunctionNotAvailableInPHP", 'simplexml_load_string').'</b><br>';
|
||||
} elseif ($sfurl) {
|
||||
$i = 0;
|
||||
while (!empty($sfurl->channel[0]->item[$i]->title) && $i < 10000) {
|
||||
$title = $sfurl->channel[0]->item[$i]->title;
|
||||
|
||||
@ -90,7 +90,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
|
||||
$transkey = '';
|
||||
$transvalue = '';
|
||||
$toselect = '';
|
||||
$toselect = array();
|
||||
$search_array_options = array();
|
||||
}
|
||||
|
||||
@ -444,9 +444,9 @@ if ($mode == 'overwrite') {
|
||||
|
||||
if ($mode == 'searchkey') {
|
||||
$nbempty = 0;
|
||||
/*var_dump($langcode);
|
||||
var_dump($transkey);
|
||||
var_dump($transvalue);*/
|
||||
//var_dump($langcode);
|
||||
//var_dump($transkey);
|
||||
//var_dump($transvalue);
|
||||
if (empty($langcode) || $langcode == '-1') {
|
||||
$nbempty++;
|
||||
}
|
||||
|
||||
@ -295,7 +295,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
|
||||
|
||||
print '<td class="center">';
|
||||
$constforvar = 'WORKSTATION_'.strtoupper($myTmpObjectKey).'_ADDON';
|
||||
if ($conf->global->$constforvar == $file) {
|
||||
if (getDolGlobalString($constforvar) == $file) {
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
} else {
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&object='.strtolower($myTmpObjectKey).'&value='.urlencode($file).'">';
|
||||
@ -437,7 +437,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
|
||||
// Default
|
||||
print '<td class="center">';
|
||||
$constforvar = 'WORKSTATION_'.strtoupper($myTmpObjectKey).'_ADDON';
|
||||
if ($conf->global->$constforvar == $name) {
|
||||
if (getDolGlobalString($constforvar) == $name) {
|
||||
print img_picto($langs->trans("Default"), 'on');
|
||||
} else {
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
|
||||
|
||||
@ -568,10 +568,9 @@ class Documents extends DolibarrApi
|
||||
{
|
||||
global $db, $conf;
|
||||
|
||||
/*var_dump($modulepart);
|
||||
var_dump($filename);
|
||||
var_dump($filecontent);
|
||||
exit;*/
|
||||
//var_dump($modulepart);
|
||||
//var_dump($filename);
|
||||
//var_dump($filecontent);exit;
|
||||
|
||||
if (empty($modulepart)) {
|
||||
throw new RestException(400, 'Modulepart not provided.');
|
||||
|
||||
@ -100,7 +100,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
|
||||
$url = $_SERVER['PHP_SELF'];
|
||||
if (preg_match('/api\/index\.php$/', $url)) { // sometimes $_SERVER['PHP_SELF'] is 'api\/index\.php' instead of 'api\/index\.php/explorer.php' or 'api\/index\.php/method'
|
||||
$url = $_SERVER['PHP_SELF'].$_SERVER['PATH_INFO'];
|
||||
$url = $_SERVER['PHP_SELF'].(empty($_SERVER['PATH_INFO']) ? $_SERVER['ORIG_PATH_INFO'] : $_SERVER['PATH_INFO']);
|
||||
}
|
||||
// Fix for some NGINX setups (this should not be required even with NGINX, however setup of NGINX are often mysterious and this may help is such cases)
|
||||
if (!empty($conf->global->MAIN_NGINX_FIX)) {
|
||||
|
||||
@ -266,7 +266,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
|
||||
|
||||
print '<td class="center">';
|
||||
$constforvar = 'ASSET_'.strtoupper($myTmpObjectKey).'_ADDON';
|
||||
if ($conf->global->$constforvar == $file) {
|
||||
if (getDolGlobalString($constforvar) == $file) {
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
} else {
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&object='.strtolower($myTmpObjectKey).'&value='.urlencode($file).'">';
|
||||
@ -408,7 +408,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
|
||||
// Default
|
||||
print '<td class="center">';
|
||||
$constforvar = 'ASSET_'.strtoupper($myTmpObjectKey).'_ADDON';
|
||||
if ($conf->global->$constforvar == $name) {
|
||||
if (getDolGlobalString($constforvar) == $name) {
|
||||
//print img_picto($langs->trans("Default"), 'on');
|
||||
// Even if choice is the default value, we allow to disable it. Replace this with previous line if you need to disable unset
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetdoc&token='.newToken().'&object='.urlencode(strtolower($myTmpObjectKey)).'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'&type='.urlencode($type).'" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
|
||||
|
||||
@ -408,7 +408,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
|
||||
$MAXEVENT = 10;
|
||||
|
||||
$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-list-alt imgforviewmode', DOL_URL_ROOT.'/asset/agenda.php?id='.$object->id);
|
||||
$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/asset/agenda.php?id='.$object->id);
|
||||
|
||||
// List of actions on element
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
|
||||
|
||||
@ -315,7 +315,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
|
||||
// $MAXEVENT = 10;
|
||||
//
|
||||
// $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-list-alt imgforviewmode', DOL_URL_ROOT . '/asset/model/agenda.php?id=' . $object->id);
|
||||
// $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT . '/asset/model/agenda.php?id=' . $object->id);
|
||||
//
|
||||
// // List of actions on element
|
||||
// include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
|
||||
|
||||
@ -286,7 +286,7 @@ if ($conf->product->enabled || $conf->product->service) {
|
||||
print '<input type="submit" class="button" name="submitformbarcodeproductgen" id="submitformbarcodeproductgen" value="'.$langs->trans("InitEmptyBarCode", min($maxperinit, $nbno)).'"'.$moretags1.'>';
|
||||
$moretags2 = (($nbno == $nbtotal) ? ' disabled' : '');
|
||||
print ' ';
|
||||
print '<input type="submit" class="button" name="eraseallbarcode" id="eraseallbarcode" value="'.$langs->trans("EraseAllCurrentBarCode").'"'.$moretags2.' onClick="return confirm_erase();">';
|
||||
print '<input type="submit" class="button butActionDelete" name="eraseallbarcode" id="eraseallbarcode" value="'.$langs->trans("EraseAllCurrentBarCode").'"'.$moretags2.' onClick="return confirm_erase();">';
|
||||
print '<br><br><br><br>';
|
||||
}
|
||||
|
||||
|
||||
@ -118,7 +118,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
||||
$search_ref = '';
|
||||
$search_amount = '';
|
||||
$search_showonlyerrors = 0;
|
||||
$toselect = '';
|
||||
$toselect = array();
|
||||
$search_array_options = array();
|
||||
}
|
||||
|
||||
|
||||
@ -92,11 +92,11 @@ function formatObject($objtoshow, $prefix)
|
||||
$s .= '<tr><td>'.($prefix ? $prefix.' > ' : '').$key.'</td>';
|
||||
$s .= '<td>';
|
||||
if (in_array($key, array('date', 'datef', 'dateh', 'datec', 'datem', 'datep'))) {
|
||||
/*var_dump(is_object($val));
|
||||
var_dump(is_array($val));
|
||||
var_dump(is_array($val));
|
||||
var_dump(@get_class($val));
|
||||
var_dump($val);*/
|
||||
//var_dump(is_object($val));
|
||||
//var_dump(is_array($val));
|
||||
//var_dump(is_array($val));
|
||||
//var_dump(@get_class($val));
|
||||
//var_dump($val);
|
||||
$s .= dol_print_date($val, 'dayhour');
|
||||
} else {
|
||||
$s .= $val;
|
||||
|
||||
@ -742,7 +742,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
|
||||
$MAXEVENT = 10;
|
||||
|
||||
$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-list-alt imgforviewmode', DOL_URL_ROOT.'/bom/bom_agenda.php?id='.$object->id);
|
||||
$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/bom/bom_agenda.php?id='.$object->id);
|
||||
|
||||
// List of actions on element
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
|
||||
|
||||
@ -184,7 +184,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
$viewlink = dolGetButtonTitle($langs->trans('GroupByProduct'), '', 'fa fa-list-alt imgforviewmode', $_SERVER['PHP_SELF'].'?id='.$object->id.'&token='.newToken(), '', 1, array('morecss' => 'reposition '.($action !== 'treeview' ? 'btnTitleSelected':'')));
|
||||
$viewlink = dolGetButtonTitle($langs->trans('GroupByProduct'), '', 'fa fa-bars imgforviewmode', $_SERVER['PHP_SELF'].'?id='.$object->id.'&token='.newToken(), '', 1, array('morecss' => 'reposition '.($action !== 'treeview' ? 'btnTitleSelected':'')));
|
||||
$viewlink .= dolGetButtonTitle($langs->trans('TreeStructure'), '', 'fa fa-stream imgforviewmode', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=treeview&token='.newToken(), '', 1, array('morecss' => 'reposition marginleftonly '.($action == 'treeview' ? 'btnTitleSelected':'')));
|
||||
|
||||
print load_fiche_titre($langs->trans("BillOfMaterials"), $viewlink, 'cubes');
|
||||
|
||||
@ -102,7 +102,8 @@ if (empty($nosearch)) {
|
||||
print '<td colspan="3">'.$langs->trans("Search").'</td>';
|
||||
print '</tr>';
|
||||
print '<tr class="oddeven nohover"><td>';
|
||||
print $langs->trans("Name").':</td><td><input class="flat inputsearch" type="text" name="catname" value="'.$catname.'"/></td><td><input type="submit" class="button" value="'.$langs->trans("Search").'"></td></tr>';
|
||||
print $langs->trans("Name").':</td><td><input class="flat inputsearch" type="text" name="catname" value="'.dol_escape_htmltag($catname).'"></td>';
|
||||
print '<td><input type="submit" class="button small" value="'.$langs->trans("Search").'"></td></tr>';
|
||||
print '</table></form>';
|
||||
|
||||
|
||||
|
||||
@ -734,9 +734,9 @@ if ($type == Categorie::TYPE_MEMBER) {
|
||||
print '<input type="hidden" name="action" value="addintocategory">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td>';
|
||||
print $langs->trans("AddMemberIntoCategory").' ';
|
||||
print $langs->trans("AssignCategoryTo").' ';
|
||||
print $form->selectMembers('', 'elemid');
|
||||
print '<input type="submit" class="button buttongen" value="'.$langs->trans("ClassifyInCategory").'"></td>';
|
||||
print '<input type="submit" class="button buttongen" value="'.$langs->trans("Save").'"></td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
|
||||
@ -461,6 +461,13 @@ if (empty($reshook) && $action == 'add') {
|
||||
}
|
||||
}
|
||||
|
||||
// Modify $moreparam so we are sure to see the event we have just created, whatever are the default value of filter on next page.
|
||||
/*$moreparam .= ($moreparam ? '&' : '').'search_actioncode=0';
|
||||
$moreparam .= ($moreparam ? '&' : '').'search_status=-1';
|
||||
$moreparam .= ($moreparam ? '&' : '').'search_filtert='.$object->userownerid;
|
||||
*/
|
||||
$moreparam .= ($moreparam ? '&' : '').'disabledefaultvalues=1';
|
||||
|
||||
if ($error) {
|
||||
$db->rollback();
|
||||
} else {
|
||||
@ -674,7 +681,7 @@ if (empty($reshook) && $action == 'update') {
|
||||
$object->errors[] = $object->error;
|
||||
} else {
|
||||
if ($db->num_rows($resql) > 0) {
|
||||
// already in use
|
||||
// Resource already in use
|
||||
$error++;
|
||||
$object->error = $langs->trans('ErrorResourcesAlreadyInUse').' : ';
|
||||
while ($obj = $db->fetch_object($resql)) {
|
||||
@ -853,7 +860,7 @@ if (empty($reshook) && GETPOST('actionmove', 'alpha') == 'mupdate') {
|
||||
$object->errors[] = $object->error;
|
||||
} else {
|
||||
if ($db->num_rows($resql) > 0) {
|
||||
// already in use
|
||||
// Resource already in use
|
||||
$error++;
|
||||
$object->error = $langs->trans('ErrorResourcesAlreadyInUse').' : ';
|
||||
while ($obj = $db->fetch_object($resql)) {
|
||||
@ -952,16 +959,17 @@ if ($action == 'create') {
|
||||
console.log("setdatefields");
|
||||
setdatefields();
|
||||
});
|
||||
|
||||
$("#selectcomplete").change(function() {
|
||||
if ($("#selectcomplete").val() == 100)
|
||||
{
|
||||
console.log("we change the complete status - set the doneby");
|
||||
if ($("#selectcomplete").val() == 100) {
|
||||
if ($("#doneby").val() <= 0) $("#doneby").val(\''.((int) $user->id).'\');
|
||||
}
|
||||
if ($("#selectcomplete").val() == 0)
|
||||
{
|
||||
if ($("#selectcomplete").val() == 0) {
|
||||
$("#doneby").val(-1);
|
||||
}
|
||||
});
|
||||
|
||||
$("#actioncode").change(function() {
|
||||
if ($("#actioncode").val() == \'AC_RDV\') $("#dateend").addClass("fieldrequired");
|
||||
else $("#dateend").removeClass("fieldrequired");
|
||||
@ -1019,59 +1027,15 @@ if ($action == 'create') {
|
||||
print '<tr><td'.(empty($conf->global->AGENDA_USE_EVENT_TYPE) ? ' class="fieldrequired titlefieldcreate"' : '').'>'.$langs->trans("Label").'</td><td><input type="text" id="label" name="label" class="soixantepercent" value="'.GETPOST('label').'"></td></tr>';
|
||||
|
||||
// Full day
|
||||
print '<tr><td><label for="fullday">'.$langs->trans("EventOnFullDay").'</label></td><td><input type="checkbox" id="fullday" name="fullday" '.(GETPOST('fullday') ? ' checked' : '').'></td></tr>';
|
||||
print '<tr><td><span class="fieldrequired">'.$langs->trans("Date").'</span></td><td class="valignmiddle height30 small"><input type="checkbox" id="fullday" name="fullday" '.(GETPOST('fullday') ? ' checked' : '').'><label for="fullday">'.$langs->trans("EventOnFullDay").'</label>';
|
||||
|
||||
$datep = ($datep ? $datep : (is_null($object->datep) ? '' : $object->datep));
|
||||
if (GETPOST('datep', 'int', 1)) {
|
||||
$datep = dol_stringtotime(GETPOST('datep', 'int', 1), 'tzuser');
|
||||
}
|
||||
$datef = ($datef ? $datef : $object->datef);
|
||||
if (GETPOST('datef', 'int', 1)) {
|
||||
$datef = dol_stringtotime(GETPOST('datef', 'int', 1), 'tzuser');
|
||||
}
|
||||
if (empty($datef) && !empty($datep)) {
|
||||
if (GETPOST("actioncode", 'aZ09') == 'AC_RDV' || empty($conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT)) {
|
||||
$datef = dol_time_plus_duree($datep, (empty($conf->global->AGENDA_AUTOSET_END_DATE_WITH_DELTA_HOURS) ? 1 : $conf->global->AGENDA_AUTOSET_END_DATE_WITH_DELTA_HOURS), 'h');
|
||||
}
|
||||
}
|
||||
|
||||
// Date start
|
||||
print '<tr><td class="nowrap">';
|
||||
print '<span class="fieldrequired">'.$langs->trans("DateActionStart").'</span>';
|
||||
print ' - ';
|
||||
print '<span id="dateend"'.(GETPOST("actioncode", 'aZ09') == 'AC_RDV' ? ' class="fieldrequired"' : '').'>'.$langs->trans("DateActionEnd").'</span>';
|
||||
print '</td><td>';
|
||||
if (GETPOST("afaire") == 1) {
|
||||
print $form->selectDate($datep, 'ap', 1, 1, 0, "action", 1, 2, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuserrel'); // Empty value not allowed for start date and hours if "todo"
|
||||
} else {
|
||||
print $form->selectDate($datep, 'ap', 1, 1, 1, "action", 1, 2, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuserrel');
|
||||
}
|
||||
print ' <span class="hideonsmartphone"> - </span> ';
|
||||
//print ' - ';
|
||||
if (GETPOST("afaire") == 1) {
|
||||
print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend', '', '', '', 1, '', '', 'tzuserrel');
|
||||
} else {
|
||||
print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend', '', '', '', 1, '', '', 'tzuserrel');
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Date end
|
||||
/*print '<tr><td>';
|
||||
print '<span id="dateend"'.(GETPOST("actioncode", 'aZ09') == 'AC_RDV' ? ' class="fieldrequired"' : '').'>'.$langs->trans("DateActionEnd").'</span>';
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if (GETPOST("afaire") == 1) {
|
||||
print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 2, 0, 'fulldayend');
|
||||
} else {
|
||||
print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 2, 0, 'fulldayend');
|
||||
}
|
||||
print '</td></tr>';*/
|
||||
|
||||
// Dev in progress
|
||||
// Recurring event
|
||||
$userepeatevent = ($conf->global->MAIN_FEATURES_LEVEL == 2 ? 1 : 0);
|
||||
if ($userepeatevent) {
|
||||
// Repeat
|
||||
print '<tr><td></td><td colspan="3">';
|
||||
//print '<tr><td></td><td colspan="3" class="opacitymedium">';
|
||||
print ' <div class="opacitymedium inline-block">';
|
||||
print img_picto($langs->trans("Recurrence"), 'recurring', 'class="paddingright2"');
|
||||
print '<input type="hidden" name="recurid" value="'.$object->recurid.'">';
|
||||
$selectedrecurrulefreq = 'no';
|
||||
$selectedrecurrulebymonthday = '';
|
||||
@ -1120,34 +1084,51 @@ if ($action == 'create') {
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
print '</td></tr>';
|
||||
print '</div>';
|
||||
//print '</td></tr>';
|
||||
}
|
||||
|
||||
// Status
|
||||
print '<tr><td>'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td>';
|
||||
print '<td>';
|
||||
$percent = $complete !=='' ? $complete : -1;
|
||||
if (GETPOSTISSET('status')) {
|
||||
$percent = GETPOST('status');
|
||||
} elseif (GETPOSTISSET('percentage')) {
|
||||
$percent = GETPOST('percentage', 'int');
|
||||
} else {
|
||||
if ($complete == '0' || GETPOST("afaire") == 1) {
|
||||
$percent = '0';
|
||||
} elseif ($complete == 100 || GETPOST("afaire") == 2) {
|
||||
$percent = 100;
|
||||
}
|
||||
}
|
||||
$formactions->form_select_status_action('formaction', $percent, 1, 'complete', 0, 0, 'maxwidth200');
|
||||
print '</td></tr>';
|
||||
|
||||
// Location
|
||||
if (empty($conf->global->AGENDA_DISABLE_LOCATION)) {
|
||||
print '<tr><td>'.$langs->trans("Location").'</td><td><input type="text" name="location" class="minwidth300 maxwidth150onsmartphone" value="'.(GETPOST('location') ? GETPOST('location') : $object->location).'"></td></tr>';
|
||||
$datep = ($datep ? $datep : (is_null($object->datep) ? '' : $object->datep));
|
||||
if (GETPOST('datep', 'int', 1)) {
|
||||
$datep = dol_stringtotime(GETPOST('datep', 'int', 1), 'tzuser');
|
||||
}
|
||||
$datef = ($datef ? $datef : $object->datef);
|
||||
if (GETPOST('datef', 'int', 1)) {
|
||||
$datef = dol_stringtotime(GETPOST('datef', 'int', 1), 'tzuser');
|
||||
}
|
||||
if (empty($datef) && !empty($datep)) {
|
||||
if (GETPOST("actioncode", 'aZ09') == 'AC_RDV' || empty($conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT)) {
|
||||
$datef = dol_time_plus_duree($datep, (empty($conf->global->AGENDA_AUTOSET_END_DATE_WITH_DELTA_HOURS) ? 1 : $conf->global->AGENDA_AUTOSET_END_DATE_WITH_DELTA_HOURS), 'h');
|
||||
}
|
||||
}
|
||||
|
||||
// Date start
|
||||
print '<tr><td class="nowrap">';
|
||||
/*
|
||||
print '<span class="fieldrequired">'.$langs->trans("DateActionStart").'</span>';
|
||||
print ' - ';
|
||||
print '<span id="dateend"'.(GETPOST("actioncode", 'aZ09') == 'AC_RDV' ? ' class="fieldrequired"' : '').'>'.$langs->trans("DateActionEnd").'</span>';
|
||||
*/
|
||||
print '</td><td>';
|
||||
if (GETPOST("afaire") == 1) {
|
||||
print $form->selectDate($datep, 'ap', 1, 1, 0, "action", 1, 2, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuserrel'); // Empty value not allowed for start date and hours if "todo"
|
||||
} else {
|
||||
print $form->selectDate($datep, 'ap', 1, 1, 1, "action", 1, 2, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuserrel');
|
||||
}
|
||||
print ' <span class="hideonsmartphone"> - </span> ';
|
||||
if (GETPOST("afaire") == 1) {
|
||||
print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend', '', '', '', 1, '', '', 'tzuserrel');
|
||||
} else {
|
||||
print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend', '', '', '', 1, '', '', 'tzuserrel');
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td class=""> </td><td></td></tr>';
|
||||
|
||||
// Assigned to
|
||||
print '<tr><td class="tdtop nowrap">'.$langs->trans("ActionAffectedTo").'</td><td>';
|
||||
print '<tr><td class="tdtop nowrap"><span class="fieldrequired">'.$langs->trans("ActionAffectedTo").'</span></td><td>';
|
||||
$listofuserid = array();
|
||||
$listofcontactid = array();
|
||||
$listofotherid = array();
|
||||
@ -1181,6 +1162,29 @@ if ($action == 'create') {
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Location
|
||||
if (empty($conf->global->AGENDA_DISABLE_LOCATION)) {
|
||||
print '<tr><td>'.$langs->trans("Location").'</td><td><input type="text" name="location" class="minwidth300 maxwidth150onsmartphone" value="'.(GETPOST('location') ? GETPOST('location') : $object->location).'"></td></tr>';
|
||||
}
|
||||
|
||||
// Status
|
||||
print '<tr><td>'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td>';
|
||||
print '<td>';
|
||||
$percent = $complete !=='' ? $complete : -1;
|
||||
if (GETPOSTISSET('status')) {
|
||||
$percent = GETPOST('status');
|
||||
} elseif (GETPOSTISSET('percentage')) {
|
||||
$percent = GETPOST('percentage', 'int');
|
||||
} else {
|
||||
if ($complete == '0' || GETPOST("afaire") == 1) {
|
||||
$percent = '0';
|
||||
} elseif ($complete == 100 || GETPOST("afaire") == 2) {
|
||||
$percent = 100;
|
||||
}
|
||||
}
|
||||
$formactions->form_select_status_action('formaction', $percent, 1, 'complete', 0, 0, 'maxwidth200');
|
||||
print '</td></tr>';
|
||||
|
||||
if ($conf->categorie->enabled) {
|
||||
// Categories
|
||||
print '<tr><td>'.$langs->trans("Categories").'</td><td>';
|
||||
@ -1523,6 +1527,7 @@ if ($id > 0) {
|
||||
if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Type").'</td><td colspan="3">';
|
||||
if ($object->type_code != 'AC_OTH_AUTO') {
|
||||
print img_picto($langs->trans("ActionType"), 'square', 'class="fawidth30 inline-block" style="color: #ddd;"');
|
||||
print $formactions->select_type_actions(GETPOST("actioncode", 'aZ09') ? GETPOST("actioncode", 'aZ09') : $object->type_code, "actioncode", "systemauto", 0, 0, 0, 1);
|
||||
} else {
|
||||
print '<input type="hidden" name="actioncode" value="'.$object->type_code.'">';
|
||||
@ -1533,40 +1538,19 @@ if ($id > 0) {
|
||||
}
|
||||
|
||||
// Title
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Title").'</td><td colspan="3"><input type="text" name="label" class="soixantepercent" value="'.$object->label.'"></td></tr>';
|
||||
print '<tr><td'.(empty($conf->global->AGENDA_USE_EVENT_TYPE) ? ' class="fieldrequired titlefieldcreate"' : '').'>'.$langs->trans("Title").'</td><td colspan="3"><input type="text" name="label" class="soixantepercent" value="'.$object->label.'"></td></tr>';
|
||||
|
||||
// Full day event
|
||||
print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td colspan="3"><input type="checkbox" id="fullday" name="fullday" '.($object->fulldayevent ? ' checked' : '').'></td></tr>';
|
||||
print '<tr><td><span class="fieldrequired">'.$langs->trans("Date").'</span></td><td colspan="3" class="valignmiddle height30 small"><input type="checkbox" id="fullday" name="fullday" '.($object->fulldayevent ? ' checked' : '').'>';
|
||||
print '<label for="fullday">'.$langs->trans("EventOnFullDay").'</label>';
|
||||
|
||||
// Date start - end
|
||||
print '<tr><td class="nowrap">';
|
||||
print '<span class="fieldrequired">'.$langs->trans("DateActionStart").'</span>';
|
||||
print ' - ';
|
||||
print '<span id="dateend"'.($object->type_code == 'AC_RDV' ? ' class="fieldrequired"' : '').'>'.$langs->trans("DateActionEnd").'</span>';
|
||||
print '</td><td td colspan="3">';
|
||||
$tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT');
|
||||
if (GETPOST("afaire") == 1) {
|
||||
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
|
||||
} elseif (GETPOST("afaire") == 2) {
|
||||
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
|
||||
} else {
|
||||
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
|
||||
}
|
||||
print ' - ';
|
||||
if (GETPOST("afaire") == 1) {
|
||||
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
|
||||
} elseif (GETPOST("afaire") == 2) {
|
||||
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
|
||||
} else {
|
||||
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Dev in progress
|
||||
// Recurring event
|
||||
$userepeatevent = ($conf->global->MAIN_FEATURES_LEVEL == 2 ? 1 : 0);
|
||||
if ($userepeatevent) {
|
||||
// Repeat
|
||||
print '<tr><td></td><td colspan="3">';
|
||||
//print '<tr><td></td><td colspan="3">';
|
||||
print ' <div class="opacitymedium inline-block">';
|
||||
print img_picto($langs->trans("Recurrence"), 'recurring', 'class="paddingright2"');
|
||||
print '<input type="hidden" name="recurid" value="'.$object->recurid.'">';
|
||||
$selectedrecurrulefreq = 'no';
|
||||
$selectedrecurrulebymonthday = '';
|
||||
@ -1615,19 +1599,37 @@ if ($id > 0) {
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
print '</td></tr>';
|
||||
print '</div>';
|
||||
//print '</td></tr>';
|
||||
}
|
||||
|
||||
// Status
|
||||
print '<tr><td class="nowrap">'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td><td colspan="3">';
|
||||
$percent = GETPOSTISSET("percentage") ? GETPOST("percentage", "int") : $object->percentage;
|
||||
$formactions->form_select_status_action('formaction', $percent, 1, 'complete', 0, 0, 'maxwidth200');
|
||||
print '</td></tr>';
|
||||
|
||||
// Location
|
||||
if (empty($conf->global->AGENDA_DISABLE_LOCATION)) {
|
||||
print '<tr><td>'.$langs->trans("Location").'</td><td colspan="3"><input type="text" name="location" class="width500" value="'.$object->location.'"></td></tr>';
|
||||
// Date start - end
|
||||
print '<tr><td class="nowrap">';
|
||||
/*print '<span class="fieldrequired">'.$langs->trans("DateActionStart").'</span>';
|
||||
print ' - ';
|
||||
print '<span id="dateend"'.($object->type_code == 'AC_RDV' ? ' class="fieldrequired"' : '').'>'.$langs->trans("DateActionEnd").'</span>';
|
||||
*/
|
||||
print '</td><td td colspan="3">';
|
||||
$tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT');
|
||||
if (GETPOST("afaire") == 1) {
|
||||
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
|
||||
} elseif (GETPOST("afaire") == 2) {
|
||||
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
|
||||
} else {
|
||||
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
|
||||
}
|
||||
print ' <span class="hideonsmartphone"> - </span> ';
|
||||
if (GETPOST("afaire") == 1) {
|
||||
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
|
||||
} elseif (GETPOST("afaire") == 2) {
|
||||
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
|
||||
} else {
|
||||
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td class=""> </td><td></td></tr>';
|
||||
|
||||
// Assigned to
|
||||
$listofuserid = array(); // User assigned
|
||||
@ -1678,6 +1680,18 @@ if ($id > 0) {
|
||||
print $form->select_dolusers($object->userdoneid > 0 ? $object->userdoneid : -1, 'doneby', 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Location
|
||||
if (empty($conf->global->AGENDA_DISABLE_LOCATION)) {
|
||||
print '<tr><td>'.$langs->trans("Location").'</td><td colspan="3"><input type="text" name="location" class="width500" value="'.$object->location.'"></td></tr>';
|
||||
}
|
||||
|
||||
// Status
|
||||
print '<tr><td class="nowrap">'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td><td colspan="3">';
|
||||
$percent = GETPOSTISSET("percentage") ? GETPOST("percentage", "int") : $object->percentage;
|
||||
$formactions->form_select_status_action('formaction', $percent, 1, 'complete', 0, 0, 'maxwidth200');
|
||||
print '</td></tr>';
|
||||
|
||||
// Tags-Categories
|
||||
if ($conf->categorie->enabled) {
|
||||
print '<tr><td>'.$langs->trans("Categories").'</td><td colspan="3">';
|
||||
@ -1786,7 +1800,7 @@ if ($id > 0) {
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
|
||||
// Editeur wysiwyg
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor = new DolEditor('note', $object->note_private, '', 200, 'dolibarr_notes', 'In', true, true, $conf->fckeditor->enabled, ROWS_5, '90%');
|
||||
$doleditor = new DolEditor('note', $object->note_private, '', 120, 'dolibarr_notes', 'In', true, true, $conf->fckeditor->enabled, ROWS_4, '90%');
|
||||
$doleditor->Create();
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
@ -1598,7 +1598,7 @@ class ActionComm extends CommonObject
|
||||
//$tooltip .= '<br><b>'.img_picto('', 'email').' '.$langs->trans("Email").'</b>';
|
||||
$tooltip .= '<br><b>'.$langs->trans('MailTopic').':</b> '.$this->email_subject;
|
||||
$tooltip .= '<br><b>'.$langs->trans('MailFrom').':</b> '.str_replace(array('<', '>'), array('&lt', '&gt'), $this->email_from);
|
||||
$tooltip .= '<br><b>'.$langs->trans('MailTo').':</b>, '.str_replace(array('<', '>'), array('&lt', '&gt'), $this->email_to);
|
||||
$tooltip .= '<br><b>'.$langs->trans('MailTo').':</b> '.str_replace(array('<', '>'), array('&lt', '&gt'), $this->email_to);
|
||||
if (!empty($this->email_tocc)) {
|
||||
$tooltip .= '<br><b>'.$langs->trans('MailCC').':</b> '.str_replace(array('<', '>'), array('&lt', '&gt'), $this->email_tocc);
|
||||
}
|
||||
@ -1621,7 +1621,7 @@ class ActionComm extends CommonObject
|
||||
$label = $langs->trans("ShowAction");
|
||||
$linkclose .= ' alt="'.dol_escape_htmltag($tooltip, 1).'"';
|
||||
}
|
||||
$linkclose .= ' title="'.dol_escape_htmltag($tooltip, 1, 0, 0, '', 1).'"';
|
||||
$linkclose .= ' title="'.dol_escape_htmltag($tooltip, 1, 0, '', 1).'"';
|
||||
$linkclose .= ' class="'.$classname.' classfortooltip"';
|
||||
/*
|
||||
$hookmanager->initHooks(array('actiondao'));
|
||||
|
||||
@ -49,6 +49,8 @@ if (empty($conf->global->AGENDA_EXT_NB)) {
|
||||
}
|
||||
$MAXAGENDA = $conf->global->AGENDA_EXT_NB;
|
||||
|
||||
$disabledefaultvalues = GETPOST('disabledefaultvalues', 'int');
|
||||
|
||||
$check_holiday = GETPOST('check_holiday', 'int');
|
||||
$filter = GETPOST("search_filter", 'alpha', 3) ? GETPOST("search_filter", 'alpha', 3) : GETPOST("filter", 'alpha', 3);
|
||||
$filtert = GETPOST("search_filtert", "int", 3) ? GETPOST("search_filtert", "int", 3) : GETPOST("filtert", "int", 3);
|
||||
@ -110,7 +112,7 @@ $week = GETPOST("week", "int") ?GETPOST("week", "int") : date("W");
|
||||
$day = GETPOST("day", "int") ?GETPOST("day", "int") : date("d");
|
||||
$pid = GETPOST("search_projectid", "int", 3) ? GETPOST("search_projectid", "int", 3) : GETPOST("projectid", "int", 3);
|
||||
$status = GETPOSTISSET("search_status") ? GETPOST("search_status", 'aZ09') : GETPOST("status", 'aZ09'); // status may be 0, 50, 100, 'todo'
|
||||
$type = GETPOSTISSET("search_type", 'aZ09') ? GETPOST("search_type", 'aZ09') : GETPOST("type", 'aZ09');
|
||||
$type = GETPOSTISSET("search_type") ? GETPOST("search_type", 'aZ09') : GETPOST("type", 'aZ09');
|
||||
$maxprint = GETPOSTISSET("maxprint") ? GETPOST("maxprint", 'int') : $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW;
|
||||
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
|
||||
|
||||
@ -128,14 +130,11 @@ if (GETPOST('search_actioncode', 'array:aZ09')) {
|
||||
$actioncode = '0';
|
||||
}
|
||||
} else {
|
||||
$actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE));
|
||||
}
|
||||
if ($actioncode == '' && empty($actioncodearray)) {
|
||||
$actioncode = (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE);
|
||||
$actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode") == '0' ? '0' : ((empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE));
|
||||
}
|
||||
|
||||
if ($status == '' && !GETPOSTISSET('search_status')) {
|
||||
$status = (empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
|
||||
$status = ((empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
|
||||
}
|
||||
|
||||
$defaultview = (empty($conf->global->AGENDA_DEFAULT_VIEW) ? 'show_month' : $conf->global->AGENDA_DEFAULT_VIEW);
|
||||
@ -1191,7 +1190,8 @@ if (count($listofextcals)) {
|
||||
foreach ($icalevents as $icalevent) {
|
||||
//var_dump($icalevent);
|
||||
|
||||
//print $icalevent['SUMMARY'].'->'.var_dump($icalevent).'<br>';exit;
|
||||
//print $icalevent['SUMMARY'].'->';
|
||||
//var_dump($icalevent);exit;
|
||||
if (!empty($icalevent['RRULE'])) {
|
||||
continue; // We found a repeatable event. It was already split into unitary events, so we discard general rule.
|
||||
}
|
||||
|
||||
@ -45,6 +45,11 @@ $langs->loadLangs(array("users", "companies", "agenda", "commercial", "other", "
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$massaction = GETPOST('massaction', 'alpha');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'actioncommlist'; // To manage different context of search
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
|
||||
$disabledefaultvalues = GETPOST('disabledefaultvalues', 'int');
|
||||
|
||||
$mode = GETPOST('mode', 'aZ09');
|
||||
if (empty($mode) && preg_match('/show_/', $action)) {
|
||||
@ -54,12 +59,9 @@ $resourceid = GETPOST("search_resourceid", "int") ?GETPOST("search_resourceid",
|
||||
$pid = GETPOST("search_projectid", 'int', 3) ?GETPOST("search_projectid", 'int', 3) : GETPOST("projectid", 'int', 3);
|
||||
$search_status = (GETPOST("search_status", 'aZ09') != '') ? GETPOST("search_status", 'aZ09') : GETPOST("status", 'aZ09');
|
||||
$type = GETPOST('search_type', 'alphanohtml') ?GETPOST('search_type', 'alphanohtml') : GETPOST('type', 'alphanohtml');
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
$year = GETPOST("year", 'int');
|
||||
$month = GETPOST("month", 'int');
|
||||
$day = GETPOST("day", 'int');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
|
||||
// Set actioncode (this code must be same for setting actioncode into peruser, listacton and index)
|
||||
if (GETPOST('search_actioncode', 'array')) {
|
||||
@ -68,11 +70,9 @@ if (GETPOST('search_actioncode', 'array')) {
|
||||
$actioncode = '0';
|
||||
}
|
||||
} else {
|
||||
$actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE));
|
||||
}
|
||||
if ($actioncode == '' && empty($actioncodearray)) {
|
||||
$actioncode = (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE);
|
||||
$actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode") == '0' ? '0' : ((empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE));
|
||||
}
|
||||
|
||||
$search_id = GETPOST('search_id', 'alpha');
|
||||
$search_title = GETPOST('search_title', 'alpha');
|
||||
$search_note = GETPOST('search_note', 'alpha');
|
||||
@ -83,7 +83,7 @@ $datestart_dtend = dol_mktime(23, 59, 59, GETPOST('datestart_dtendmonth', 'int')
|
||||
$dateend_dtstart = dol_mktime(0, 0, 0, GETPOST('dateend_dtstartmonth', 'int'), GETPOST('dateend_dtstartday', 'int'), GETPOST('dateend_dtstartyear', 'int'), 'tzuserrel');
|
||||
$dateend_dtend = dol_mktime(23, 59, 59, GETPOST('dateend_dtendmonth', 'int'), GETPOST('dateend_dtendday', 'int'), GETPOST('dateend_dtendyear', 'int'), 'tzuserrel');
|
||||
if ($search_status == '' && !GETPOSTISSET('search_status')) {
|
||||
$search_status = (empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
|
||||
$search_status = ((empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
|
||||
}
|
||||
if (empty($mode) && !GETPOSTISSET('mode')) {
|
||||
$mode = (empty($conf->global->AGENDA_DEFAULT_VIEW) ? 'show_month' : $conf->global->AGENDA_DEFAULT_VIEW);
|
||||
@ -216,8 +216,15 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
||||
$datestart_dtend = '';
|
||||
$dateend_dtstart = '';
|
||||
$dateend_dtend = '';
|
||||
$actioncode = '';
|
||||
$search_status = '';
|
||||
$toselect = '';
|
||||
$pid = '';
|
||||
$socid = '';
|
||||
$resourceid = '';
|
||||
$filter = '';
|
||||
$filtert = '';
|
||||
$usergroup = '';
|
||||
$toselect = array();
|
||||
$search_array_options = array();
|
||||
}
|
||||
|
||||
@ -299,7 +306,7 @@ if ($actioncode != '') {
|
||||
if ($resourceid > 0) {
|
||||
$param .= "&search_resourceid=".urlencode($resourceid);
|
||||
}
|
||||
if ($search_status != '' && $search_status > -1) {
|
||||
if ($search_status != '') {
|
||||
$param .= "&search_status=".urlencode($search_status);
|
||||
}
|
||||
if ($filter) {
|
||||
|
||||
@ -45,6 +45,8 @@ if (!isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) {
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
$disabledefaultvalues = GETPOST('disabledefaultvalues', 'int');
|
||||
|
||||
$filter = GETPOST("search_filter", 'alpha', 3) ? GETPOST("search_filter", 'alpha', 3) : GETPOST("filter", 'alpha', 3);
|
||||
$filtert = GETPOST("search_filtert", "int", 3) ? GETPOST("search_filtert", "int", 3) : GETPOST("filtert", "int", 3);
|
||||
$usergroup = GETPOST("search_usergroup", "int", 3) ? GETPOST("search_usergroup", "int", 3) : GETPOST("usergroup", "int", 3);
|
||||
@ -110,10 +112,7 @@ if (GETPOST('search_actioncode', 'array')) {
|
||||
$actioncode = '0';
|
||||
}
|
||||
} else {
|
||||
$actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode", "alpha") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE));
|
||||
}
|
||||
if ($actioncode == '' && empty($actioncodearray)) {
|
||||
$actioncode = (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE);
|
||||
$actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode", "alpha") == '0' ? '0' : ((empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE));
|
||||
}
|
||||
|
||||
$dateselect = dol_mktime(0, 0, 0, GETPOST('dateselectmonth', 'int'), GETPOST('dateselectday', 'int'), GETPOST('dateselectyear', 'int'));
|
||||
@ -145,7 +144,7 @@ $begin_d = 1;
|
||||
$end_d = 53;
|
||||
|
||||
if ($status == '' && !GETPOSTISSET('search_status')) {
|
||||
$status = (empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
|
||||
$status = ((empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
|
||||
}
|
||||
if (empty($mode) && !GETPOSTISSET('mode')) {
|
||||
$mode = (empty($conf->global->AGENDA_DEFAULT_VIEW) ? 'show_month' : $conf->global->AGENDA_DEFAULT_VIEW);
|
||||
@ -961,7 +960,9 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s
|
||||
$ymd = sprintf("%04d", $year).sprintf("%02d", $month).sprintf("%02d", $day);
|
||||
|
||||
$nextindextouse = count($colorindexused); // At first run, this is 0, so fist user has 0, next 1, ...
|
||||
//if ($username->id && $day==1) var_dump($eventarray);
|
||||
//if ($username->id && $day==1) {
|
||||
//var_dump($eventarray);
|
||||
//}
|
||||
|
||||
// We are in a particular day for $username, now we scan all events
|
||||
foreach ($eventarray as $daykey => $notused) {
|
||||
|
||||
@ -45,6 +45,8 @@ if (!isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) {
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
$disabledefaultvalues = GETPOST('disabledefaultvalues', 'int');
|
||||
|
||||
$filter = GETPOST("search_filter", 'alpha', 3) ? GETPOST("search_filter", 'alpha', 3) : GETPOST("filter", 'alpha', 3);
|
||||
$filtert = GETPOST("search_filtert", "int", 3) ? GETPOST("search_filtert", "int", 3) : GETPOST("filtert", "int", 3);
|
||||
$usergroup = GETPOST("search_usergroup", "int", 3) ? GETPOST("search_usergroup", "int", 3) : GETPOST("usergroup", "int", 3);
|
||||
@ -110,10 +112,7 @@ if (GETPOST('search_actioncode', 'array:aZ09')) {
|
||||
$actioncode = '0';
|
||||
}
|
||||
} else {
|
||||
$actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode", "alpha") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE));
|
||||
}
|
||||
if ($actioncode == '' && empty($actioncodearray)) {
|
||||
$actioncode = (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE);
|
||||
$actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode", "alpha") == '0' ? '0' : ((empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE));
|
||||
}
|
||||
|
||||
$dateselect = dol_mktime(0, 0, 0, GETPOST('dateselectmonth', 'int'), GETPOST('dateselectday', 'int'), GETPOST('dateselectyear', 'int'));
|
||||
@ -154,7 +153,7 @@ if ($end_d < $begin_d) {
|
||||
}
|
||||
|
||||
if ($status == '' && !GETPOSTISSET('search_status')) {
|
||||
$status = (empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
|
||||
$status = ((empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
|
||||
}
|
||||
|
||||
if (empty($mode) && !GETPOSTISSET('mode')) {
|
||||
@ -1130,7 +1129,9 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
|
||||
|
||||
$colorindexused[$user->id] = 0; // Color index for current user (user->id) is always 0
|
||||
$nextindextouse = count($colorindexused); // At first run this is 0, so first user has 0, next 1, ...
|
||||
//if ($username->id && $day==1) var_dump($eventarray);
|
||||
//if ($username->id && $day==1) {
|
||||
//var_dump($eventarray);
|
||||
//}
|
||||
|
||||
// We are in a particular day for $username, now we scan all events
|
||||
foreach ($eventarray as $daykey => $notused) {
|
||||
|
||||
@ -173,7 +173,7 @@ if (empty($reshook)) {
|
||||
// terms of the settlement
|
||||
if ($action == 'setconditions' && $user->rights->societe->creer) {
|
||||
$object->fetch($id);
|
||||
$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
|
||||
$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'), GETPOST('cond_reglement_id_deposit_percent', 'alpha'));
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
@ -415,9 +415,9 @@ if ($object->id > 0) {
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editconditions') {
|
||||
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->cond_reglement_id, 'cond_reglement_id', 1);
|
||||
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->cond_reglement_id, 'cond_reglement_id', 1, '', 1, $object->deposit_percent);
|
||||
} else {
|
||||
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->cond_reglement_id, 'none');
|
||||
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->cond_reglement_id, 'none', 0, '', 1, $object->deposit_percent);
|
||||
}
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
|
||||
@ -634,7 +634,11 @@ if (!empty($conf->societe->enabled) && $user->rights->societe->lire) {
|
||||
print $s;
|
||||
|
||||
print '</td>';
|
||||
print '<td class="right nowrap tddate">'.dol_print_date($db->jdate($objp->tms), 'day').'</td>';
|
||||
|
||||
$datem = $db->jdate($objp->tms);
|
||||
print '<td class="right nowrap tddate" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($datem, 'dayhour', 'tzuserrel')).'">';
|
||||
print dol_print_date($datem, 'day', 'tzuserrel');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$i++;
|
||||
@ -725,7 +729,11 @@ if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_S
|
||||
print $s;
|
||||
|
||||
print '</td>';
|
||||
print '<td class="right tddate">'.dol_print_date($db->jdate($objp->dm), 'day').'</td>';
|
||||
|
||||
$datem = $db->jdate($objp->dm);
|
||||
print '<td class="right tddate" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($datem, 'dayhour', 'tzuserrel')).'">';
|
||||
print dol_print_date($datem, 'day', 'tzuserrel');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$i++;
|
||||
@ -922,7 +930,10 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) {
|
||||
print '</td>';
|
||||
|
||||
print '<td class="nowrap">'.$companystatic->getNomUrl(1, 'customer', 44).'</td>';
|
||||
print '<td class="right tddate">'.dol_print_date($db->jdate($obj->dp), 'day').'</td>';
|
||||
$datem = $db->jdate($obj->dp);
|
||||
print '<td class="center tddate" title="'.dol_escape_htmltag($langs->trans("Date").': '.dol_print_date($datem, 'day', 'tzserver')).'">';
|
||||
print dol_print_date($datem, 'day', 'tzserver');
|
||||
print '</td>';
|
||||
print '<td class="right tdamount amount">'.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).'</td>';
|
||||
print '<td align="center" width="14">'.$propalstatic->LibStatut($obj->fk_statut, 3).'</td>';
|
||||
|
||||
@ -1039,7 +1050,11 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
|
||||
print '</td>';
|
||||
|
||||
print '<td class="nowrap">'.$companystatic->getNomUrl(1, 'customer', 44).'</td>';
|
||||
print '<td class="right tddate">'.dol_print_date($db->jdate($obj->dv), 'day').'</td>';
|
||||
$datem = $db->jdate($obj->dv);
|
||||
print '<td class="center tddate" title="'.dol_escape_htmltag($langs->trans("DateValue").': '.dol_print_date($datem, 'day', 'tzserver')).'">';
|
||||
print dol_print_date($datem, 'day', 'tzserver');
|
||||
print '</td>';
|
||||
|
||||
print '<td class="right tdamount amount">'.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).'</td>';
|
||||
print '<td align="center" width="14">'.$orderstatic->LibStatut($obj->fk_statut, $obj->billed, 3).'</td>';
|
||||
|
||||
|
||||
@ -961,7 +961,7 @@ if ($action == 'create') {
|
||||
if (GETPOST('cancel', 'alpha') || $confirm == 'no' || $action == '' || in_array($action, array('settodraft', 'valid', 'delete', 'sendall', 'clone', 'test'))) {
|
||||
print "\n\n<div class=\"tabsAction\">\n";
|
||||
|
||||
if (($object->statut == 1) && ($user->rights->mailing->valider || $object->fk_user_valid == $user->id)) {
|
||||
if (($object->statut == 1) && ($user->rights->mailing->valider || $object->user_validation == $user->id)) {
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=settodraft&token='.newToken().'&id='.$object->id.'">'.$langs->trans("SetToDraft").'</a>';
|
||||
}
|
||||
|
||||
@ -1066,7 +1066,7 @@ if ($action == 'create') {
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
print dol_set_focus('#sendto');
|
||||
dol_set_focus('#sendto');
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -86,6 +86,11 @@ class Mailing extends CommonObject
|
||||
*/
|
||||
public $email_from;
|
||||
|
||||
/**
|
||||
* @var string email to
|
||||
*/
|
||||
public $sendto;
|
||||
|
||||
/**
|
||||
* @var string email reply to
|
||||
*/
|
||||
@ -175,6 +180,11 @@ class Mailing extends CommonObject
|
||||
*/
|
||||
public $statuts = array();
|
||||
|
||||
/**
|
||||
* @var array substitutionarray
|
||||
*/
|
||||
public $substitutionarray;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
||||
@ -103,7 +103,7 @@ if (empty($reshook)) {
|
||||
}*/
|
||||
$search_ref = '';
|
||||
$search_all = '';
|
||||
$toselect = '';
|
||||
$toselect = array();
|
||||
$search_array_options = array();
|
||||
}
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
|
||||
|
||||
@ -402,6 +402,7 @@ if (empty($reshook)) {
|
||||
$object->warehouse_id = GETPOST('warehouse_id', 'int');
|
||||
$object->duree_validite = $duration;
|
||||
$object->cond_reglement_id = GETPOST('cond_reglement_id');
|
||||
$object->deposit_percent = GETPOST('cond_reglement_id_deposit_percent', 'alpha');
|
||||
$object->mode_reglement_id = GETPOST('mode_reglement_id');
|
||||
$object->fk_account = GETPOST('fk_account', 'int');
|
||||
$object->remise_absolue = price2num(GETPOST('remise_absolue'), 'MU', 2); // deprecated
|
||||
@ -434,6 +435,7 @@ if (empty($reshook)) {
|
||||
$object->warehouse_id = GETPOST('warehouse_id', 'int');
|
||||
$object->duree_validite = price2num(GETPOST('duree_validite', 'alpha'));
|
||||
$object->cond_reglement_id = GETPOST('cond_reglement_id', 'int');
|
||||
$object->deposit_percent = GETPOST('cond_reglement_id_deposit_percent', 'alpha');
|
||||
$object->mode_reglement_id = GETPOST('mode_reglement_id', 'int');
|
||||
$object->fk_account = GETPOST('fk_account', 'int');
|
||||
$object->contact_id = GETPOST('contactid', 'int');
|
||||
@ -687,10 +689,62 @@ if (empty($reshook)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
$deposit = null;
|
||||
$locationTarget = '';
|
||||
|
||||
$deposit_percent_from_payment_terms = getDictionaryValue('c_payment_term', 'deposit_percent', $object->cond_reglement_id);
|
||||
|
||||
if (
|
||||
!$error && GETPOST('statut', 'int') == $object::STATUS_SIGNED && GETPOST('generate_deposit', 'alpha') == 'on'
|
||||
&& ! empty($deposit_percent_from_payment_terms) && ! empty($conf->facture->enabled) && ! empty($user->rights->facture->creer)
|
||||
) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
||||
|
||||
$date = dol_mktime(0, 0, 0, GETPOST('datefmonth', 'int'), GETPOST('datefday', 'int'), GETPOST('datefyear', 'int'));
|
||||
$forceFields = array();
|
||||
|
||||
if (GETPOSTISSET('date_pointoftax')) {
|
||||
$forceFields['date_pointoftax'] = dol_mktime(0, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'));
|
||||
}
|
||||
|
||||
$deposit = Facture::createDepositFromOrigin($object, $date, GETPOST('cond_reglement_id', 'int'), $user, 0, GETPOST('validate_generated_deposit', 'alpha') == 'on', $forceFields);
|
||||
|
||||
if ($deposit) {
|
||||
setEventMessage('DepositGenerated');
|
||||
$locationTarget = DOL_URL_ROOT . '/compta/facture/card.php?id=' . $deposit->id;
|
||||
} else {
|
||||
$error++;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
|
||||
if ($deposit && empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||
$ret = $deposit->fetch($deposit->id); // Reload to get new records
|
||||
$outputlangs = $langs;
|
||||
|
||||
if ($conf->global->MAIN_MULTILANGS) {
|
||||
$outputlangs = new Translate('', $conf);
|
||||
$outputlangs->setDefaultLang($deposit->thirdparty->default_lang);
|
||||
$outputlangs->load('products');
|
||||
}
|
||||
|
||||
$result = $deposit->generateDocument($deposit->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
|
||||
if ($result < 0) {
|
||||
setEventMessages($deposit->error, $deposit->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
if ($locationTarget) {
|
||||
header('Location: ' . $locationTarget);
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
$db->rollback();
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -831,6 +885,13 @@ if (empty($reshook)) {
|
||||
foreach ($object->lines as $line) {
|
||||
$result = $object->updateline($line->id, $line->subprice, $line->qty, $line->remise_percent, $vat_rate, $localtax1_rate, $localtax2_rate, $line->desc, 'HT', $line->info_bits, $line->special_code, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->product_type, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice);
|
||||
}
|
||||
} elseif ($action == 'addline' && GETPOST('submitforalllines', 'alpha') && GETPOST('remiseforalllines', 'alpha') !== '' && $usercancreate) {
|
||||
// Define vat_rate
|
||||
$remise_percent = (GETPOST('remiseforalllines') ? GETPOST('remiseforalllines') : 0);
|
||||
$remise_percent = str_replace('*', '', $remise_percent);
|
||||
foreach ($object->lines as $line) {
|
||||
$result = $object->updateline($line->id, $line->subprice, $line->qty, $remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->desc, 'HT', $line->info_bits, $line->special_code, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->product_type, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice);
|
||||
}
|
||||
} elseif ($action == 'addline' && $usercancreate) { // Add line
|
||||
// Set if we used free entry or predefined product
|
||||
$predef = '';
|
||||
@ -1363,7 +1424,7 @@ if (empty($reshook)) {
|
||||
$result = $object->set_demand_reason($user, GETPOST('demand_reason_id', 'int'));
|
||||
} elseif ($action == 'setconditions' && $usercancreate) {
|
||||
// Terms of payment
|
||||
$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
|
||||
$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'), GETPOST('cond_reglement_id_deposit_percent', 'alpha'));
|
||||
} elseif ($action == 'setremisepercent' && $usercancreate) {
|
||||
$result = $object->set_remise_percent($user, price2num(GETPOST('remise_percent'), '', 2));
|
||||
} elseif ($action == 'setremiseabsolue' && $usercancreate) {
|
||||
@ -1579,19 +1640,19 @@ if ($action == 'create') {
|
||||
print '<table class="border centpercent">';
|
||||
|
||||
// Reference
|
||||
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans('Ref').'</td><td>'.$langs->trans("Draft").'</td></tr>';
|
||||
print '<tr class="field_ref"><td class="titlefieldcreate fieldrequired">'.$langs->trans('Ref').'</td><td class="valuefieldcreate">'.$langs->trans("Draft").'</td></tr>';
|
||||
|
||||
// Ref customer
|
||||
print '<tr><td>'.$langs->trans('RefCustomer').'</td><td>';
|
||||
print '<tr class="field_ref_client"><td class="titlefieldcreate">'.$langs->trans('RefCustomer').'</td><td class="valuefieldcreate">';
|
||||
print '<input type="text" name="ref_client" value="'.GETPOST('ref_client').'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Third party
|
||||
print '<tr>';
|
||||
print '<td class="fieldrequired">'.$langs->trans('Customer').'</td>';
|
||||
print '<tr class="field_socid">';
|
||||
print '<td class="titlefieldcreate fieldrequired">'.$langs->trans('Customer').'</td>';
|
||||
$shipping_method_id = 0;
|
||||
if ($socid > 0) {
|
||||
print '<td>';
|
||||
print '<td class="valuefieldcreate">';
|
||||
print $soc->getNomUrl(1);
|
||||
print '<input type="hidden" name="socid" value="'.$soc->id.'">';
|
||||
print '</td>';
|
||||
@ -1600,7 +1661,7 @@ if ($action == 'create') {
|
||||
}
|
||||
//$warehouse_id = $soc->warehouse_id;
|
||||
} else {
|
||||
print '<td>';
|
||||
print '<td class="valuefieldcreate">';
|
||||
print img_picto('', 'company').$form->select_company('', 'socid', '(s.client = 1 OR s.client = 2 OR s.client = 3) AND status=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300 maxwidth500 widthcentpercentminusxx');
|
||||
// reload page to retrieve customer informations
|
||||
if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) {
|
||||
@ -1623,13 +1684,13 @@ if ($action == 'create') {
|
||||
|
||||
if ($socid > 0) {
|
||||
// Contacts (ask contact only if thirdparty already defined).
|
||||
print "<tr><td>".$langs->trans("DefaultContact").'</td><td>';
|
||||
print '<tr class="field_contactid"><td class="titlefieldcreate">'.$langs->trans("DefaultContact").'</td><td class="valuefieldcreate">';
|
||||
print img_picto('', 'contact');
|
||||
print $form->selectcontacts($soc->id, $contactid, 'contactid', 1, '', '', 0, 'minwidth300');
|
||||
print '</td></tr>';
|
||||
|
||||
// Third party discounts info line
|
||||
print '<tr><td>'.$langs->trans('Discounts').'</td><td>';
|
||||
print '<tr class="field_discount_info"><td class="titlefieldcreate">'.$langs->trans('Discounts').'</td><td class="valuefieldcreate">';
|
||||
|
||||
$absolute_discount = $soc->getAvailableDiscounts();
|
||||
|
||||
@ -1641,44 +1702,44 @@ if ($action == 'create') {
|
||||
}
|
||||
|
||||
// Date
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('DatePropal').'</td><td>';
|
||||
print '<tr class="field_addprop"><td class="titlefieldcreate fieldrequired">'.$langs->trans('DatePropal').'</td><td class="valuefieldcreate">';
|
||||
print $form->selectDate('', '', '', '', '', "addprop", 1, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Validaty duration
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("ValidityDuration").'</td><td>'.img_picto('', 'clock', 'class="paddingright"').'<input name="duree_validite" class="width50" value="'.(GETPOSTISSET('duree_validite') ? GETPOST('duree_validite', 'alphanohtml') : $conf->global->PROPALE_VALIDITY_DURATION).'"> '.$langs->trans("days").'</td></tr>';
|
||||
print '<tr class="field_duree_validitee"><td class="titlefieldcreate fieldrequired">'.$langs->trans("ValidityDuration").'</td><td class="valuefieldcreate">'.img_picto('', 'clock', 'class="paddingright"').'<input name="duree_validite" class="width50" value="'.(GETPOSTISSET('duree_validite') ? GETPOST('duree_validite', 'alphanohtml') : $conf->global->PROPALE_VALIDITY_DURATION).'"> '.$langs->trans("days").'</td></tr>';
|
||||
|
||||
// Terms of payment
|
||||
print '<tr><td class="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td>';
|
||||
print img_picto('', 'payment', 'class="pictofixedwidth"');
|
||||
$form->select_conditions_paiements((GETPOSTISSET('cond_reglement_id') && GETPOST('cond_reglement_id') != 0) ? GETPOST('cond_reglement_id', 'int') : $soc->cond_reglement_id, 'cond_reglement_id', -1, 1);
|
||||
print '<tr class="field_cond_reglement_id"><td class="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td>';
|
||||
print img_picto('', 'paiment');
|
||||
$form->select_conditions_paiements((GETPOSTISSET('cond_reglement_id') && GETPOST('cond_reglement_id') != 0) ? GETPOST('cond_reglement_id', 'int') : $soc->cond_reglement_id, 'cond_reglement_id', 1, 1, 0, '', (GETPOSTISSET('cond_reglement_id_deposit_percent') ? GETPOST('cond_reglement_id_deposit_percent', 'alpha') : $soc->deposit_percent));
|
||||
print '</td></tr>';
|
||||
|
||||
// Mode of payment
|
||||
print '<tr><td>'.$langs->trans('PaymentMode').'</td><td>';
|
||||
print '<tr class="field_mode_reglement_id"><td class="titlefieldcreate">'.$langs->trans('PaymentMode').'</td><td class="valuefieldcreate">';
|
||||
print img_picto('', 'bank', 'class="pictofixedwidth"');
|
||||
$form->select_types_paiements((GETPOSTISSET('mode_reglement_id') ? GETPOST('mode_reglement_id', 'int') : $soc->mode_reglement_id), 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx');
|
||||
print '</td></tr>';
|
||||
|
||||
// Bank Account
|
||||
if (!empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL) && !empty($conf->banque->enabled)) {
|
||||
print '<tr><td>'.$langs->trans('BankAccount').'</td><td>';
|
||||
print '<tr class="field_fk_account"><td class="titlefieldcreate">'.$langs->trans('BankAccount').'</td><td class="valuefieldcreate">';
|
||||
print img_picto('', 'bank_account', 'class="pictofixedwidth"').$form->select_comptes($soc->fk_account, 'fk_account', 0, '', 1, '', 0, 'maxwidth200 widthcentpercentminusx', 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Source / Channel - What trigger creation
|
||||
print '<tr><td>'.$langs->trans('Source').'</td><td>';
|
||||
print '<tr class="field_demand_reason_id"><td class="titlefieldcreate">'.$langs->trans('Source').'</td><td class="valuefieldcreate">';
|
||||
print img_picto('', 'question', 'class="pictofixedwidth"');
|
||||
$form->selectInputReason('', 'demand_reason_id', "SRC_PROP", 1, 'maxwidth200 widthcentpercentminusx');
|
||||
print '</td></tr>';
|
||||
|
||||
// Delivery delay
|
||||
print '<tr class="fielddeliverydelay"><td>'.$langs->trans('AvailabilityPeriod');
|
||||
print '<tr class="field_availability_id"><td class="titlefieldcreate">'.$langs->trans('AvailabilityPeriod');
|
||||
if (!empty($conf->commande->enabled)) {
|
||||
print ' ('.$langs->trans('AfterOrder').')';
|
||||
}
|
||||
print '</td><td>';
|
||||
print '</td><td class="valuefieldcreate">';
|
||||
print img_picto('', 'clock', 'class="pictofixedwidth"');
|
||||
$form->selectAvailabilityDelay('', 'availability_id', '', 1, 'maxwidth200 widthcentpercentminusx');
|
||||
print '</td></tr>';
|
||||
@ -1688,7 +1749,7 @@ if ($action == 'create') {
|
||||
if (!empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD) && !empty($soc->shipping_method_id)) {
|
||||
$shipping_method_id = $soc->shipping_method_id;
|
||||
}
|
||||
print '<tr><td>'.$langs->trans('SendingMethod').'</td><td>';
|
||||
print '<tr class="field_shipping_method_id"><td class="titlefieldcreate">'.$langs->trans('SendingMethod').'</td><td class="valuefieldcreate">';
|
||||
print img_picto('', 'object_dollyrevert', 'class="pictofixedwidth"');
|
||||
print $form->selectShippingMethod($shipping_method_id, 'shipping_method_id', '', 1, '', 0, 'maxwidth200 widthcentpercentminusx');
|
||||
print '</td></tr>';
|
||||
@ -1698,14 +1759,14 @@ if ($action == 'create') {
|
||||
if (!empty($conf->stock->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
|
||||
$formproduct = new FormProduct($db);
|
||||
print '<tr><td>'.$langs->trans('Warehouse').'</td><td>';
|
||||
print '<tr class="field_warehouse_id"><td class="titlefieldcreate">'.$langs->trans('Warehouse').'</td><td class="valuefieldcreate">';
|
||||
print img_picto('', 'stock', 'class="pictofixedwidth"').$formproduct->selectWarehouses($warehouse_id, 'warehouse_id', '', 1, 0, 0, '', 0, 0, array(), 'maxwidth500 widthcentpercentminusxx');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Delivery date (or manufacturing)
|
||||
print '<tr><td>'.$langs->trans("DeliveryDate").'</td>';
|
||||
print '<td>';
|
||||
print '<tr class="field_date_livraison"><td class="titlefieldcreate">'.$langs->trans("DeliveryDate").'</td>';
|
||||
print '<td class="valuefieldcreate">';
|
||||
if (isset($conf->global->DATE_LIVRAISON_WEEK_DELAY) && is_numeric($conf->global->DATE_LIVRAISON_WEEK_DELAY)) {
|
||||
$tmpdte = time() + ((7 * $conf->global->DATE_LIVRAISON_WEEK_DELAY) * 24 * 60 * 60);
|
||||
$syear = date("Y", $tmpdte);
|
||||
@ -1720,8 +1781,8 @@ if ($action == 'create') {
|
||||
// Project
|
||||
if (!empty($conf->projet->enabled)) {
|
||||
$langs->load("projects");
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("Project").'</td><td>';
|
||||
print '<tr class="field_projectid">';
|
||||
print '<td class="titlefieldcreate">'.$langs->trans("Project").'</td><td class="valuefieldcreate">';
|
||||
print img_picto('', 'project', 'class="pictofixedwidth"').$formproject->select_projects(($soc->id > 0 ? $soc->id : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx');
|
||||
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$soc->id.'&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddProject").'"></span></a>';
|
||||
print '</td>';
|
||||
@ -1730,17 +1791,17 @@ if ($action == 'create') {
|
||||
|
||||
// Incoterms
|
||||
if (!empty($conf->incoterm->enabled)) {
|
||||
print '<tr>';
|
||||
print '<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans("IncotermLabel"), $soc->label_incoterms, 1).'</label></td>';
|
||||
print '<td class="maxwidthonsmartphone">';
|
||||
print '<tr class="field_incoterm_id">';
|
||||
print '<td class="titlefieldcreate"><label for="incoterm_id">'.$form->textwithpicto($langs->trans("IncotermLabel"), $soc->label_incoterms, 1).'</label></td>';
|
||||
print '<td class="valuefieldcreate maxwidthonsmartphone">';
|
||||
print $form->select_incoterms((!empty($soc->fk_incoterms) ? $soc->fk_incoterms : ''), (!empty($soc->location_incoterms) ? $soc->location_incoterms : ''));
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Template to use by default
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("DefaultModel").'</td>';
|
||||
print '<td>';
|
||||
print '<tr class="field_model">';
|
||||
print '<td class="titlefieldcreate">'.$langs->trans("DefaultModel").'</td>';
|
||||
print '<td class="valuefieldcreate">';
|
||||
print img_picto('', 'pdf', 'class="pictofixedwidth"');
|
||||
$liste = ModelePDFPropales::liste_modeles($db);
|
||||
$preselected = (!empty($conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT) ? $conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT : getDolGlobalString("PROPALE_ADDON_PDF"));
|
||||
@ -1749,26 +1810,26 @@ if ($action == 'create') {
|
||||
|
||||
// Multicurrency
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
print '<tr>';
|
||||
print '<td>'.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).'</td>';
|
||||
print '<td class="maxwidthonsmartphone">';
|
||||
print '<tr class="field_currency">';
|
||||
print '<td class="titlefieldcreate">'.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).'</td>';
|
||||
print '<td class="valuefieldcreate maxwidthonsmartphone">';
|
||||
print img_picto('', 'currency', 'class="pictofixedwidth"').$form->selectMultiCurrency($currency_code, 'multicurrency_code', 0);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Public note
|
||||
print '<tr>';
|
||||
print '<td class="tdtop">'.$langs->trans('NotePublic').'</td>';
|
||||
print '<td valign="top">';
|
||||
print '<tr class="field_note_public">';
|
||||
print '<td class="titlefieldcreate tdtop">'.$langs->trans('NotePublic').'</td>';
|
||||
print '<td class="valuefieldcreate">';
|
||||
$note_public = $object->getDefaultCreateValueFor('note_public', (!empty($objectsrc) ? $objectsrc->note_public : null));
|
||||
$doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PUBLIC) ? 0 : 1, ROWS_3, '90%');
|
||||
print $doleditor->Create(1);
|
||||
|
||||
// Private note
|
||||
if (empty($user->socid)) {
|
||||
print '<tr>';
|
||||
print '<td class="tdtop">'.$langs->trans('NotePrivate').'</td>';
|
||||
print '<td valign="top">';
|
||||
print '<tr class="field_note_private">';
|
||||
print '<td class="titlefieldcreate tdtop">'.$langs->trans('NotePrivate').'</td>';
|
||||
print '<td class="valuefieldcreate">';
|
||||
$note_private = $object->getDefaultCreateValueFor('note_private', ((!empty($origin) && !empty($originid) && is_object($objectsrc)) ? $objectsrc->note_private : null));
|
||||
$doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PRIVATE) ? 0 : 1, ROWS_3, '90%');
|
||||
print $doleditor->Create(1);
|
||||
@ -1938,6 +1999,129 @@ if ($action == 'create') {
|
||||
array('type' => 'text', 'name' => 'note_private', 'label' => $langs->trans("Note"), 'value' => '') // Field to complete private note (not replace)
|
||||
);
|
||||
|
||||
$deposit_percent_from_payment_terms = getDictionaryValue('c_payment_term', 'deposit_percent', $object->cond_reglement_id);
|
||||
|
||||
if (! empty($deposit_percent_from_payment_terms) && ! empty($conf->facture->enabled) && ! empty($user->rights->facture->creer)) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
||||
|
||||
$object->fetchObjectLinked();
|
||||
|
||||
$eligibleForDepositGeneration = true;
|
||||
|
||||
if (array_key_exists('facture', $object->linkedObjects)) {
|
||||
foreach ($object->linkedObjects['facture'] as $invoice) {
|
||||
if ($invoice->type == Facture::TYPE_DEPOSIT) {
|
||||
$eligibleForDepositGeneration = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($eligibleForDepositGeneration && array_key_exists('commande', $object->linkedObjects)) {
|
||||
foreach ($object->linkedObjects['commande'] as $order) {
|
||||
$order->fetchObjectLinked();
|
||||
|
||||
if (array_key_exists('facture', $order->linkedObjects)) {
|
||||
foreach ($order->linkedObjects['facture'] as $invoice) {
|
||||
if ($invoice->type == Facture::TYPE_DEPOSIT) {
|
||||
$eligibleForDepositGeneration = false;
|
||||
break 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($eligibleForDepositGeneration) {
|
||||
$formquestion[] = array(
|
||||
'type' => 'checkbox',
|
||||
'tdclass' => 'showonlyifsigned',
|
||||
'name' => 'generate_deposit',
|
||||
'label' => $form->textwithpicto($langs->trans('GenerateDeposit', $object->deposit_percent), $langs->trans('DepositGenerationPermittedByThePaymentTermsSelected'))
|
||||
);
|
||||
|
||||
$formquestion[] = array(
|
||||
'type' => 'date',
|
||||
'tdclass' => 'fieldrequired showonlyifgeneratedeposit',
|
||||
'name' => 'datef',
|
||||
'label' => $langs->trans('DateInvoice'),
|
||||
'value' => dol_now(),
|
||||
'datenow' => true
|
||||
);
|
||||
|
||||
if (! empty($conf->global->INVOICE_POINTOFTAX_DATE)) {
|
||||
$formquestion[] = array(
|
||||
'type' => 'date',
|
||||
'tdclass' => 'fieldrequired showonlyifgeneratedeposit',
|
||||
'name' => 'date_pointoftax',
|
||||
'label' => $langs->trans('DatePointOfTax'),
|
||||
'value' => dol_now(),
|
||||
'datenow' => true
|
||||
);
|
||||
}
|
||||
|
||||
ob_start();
|
||||
$form->select_conditions_paiements(0, 'cond_reglement_id', -1, 0, 0, 'minwidth200');
|
||||
$paymentTermsSelect = ob_get_clean();
|
||||
|
||||
$formquestion[] = array(
|
||||
'type' => 'other',
|
||||
'tdclass' => 'fieldrequired showonlyifgeneratedeposit',
|
||||
'name' => 'cond_reglement_id',
|
||||
'label' => $langs->trans('PaymentTerm'),
|
||||
'value' => $paymentTermsSelect
|
||||
);
|
||||
|
||||
$formquestion[] = array(
|
||||
'type' => 'checkbox',
|
||||
'tdclass' => 'showonlyifgeneratedeposit',
|
||||
'name' => 'validate_generated_deposit',
|
||||
'label' => $langs->trans('ValidateGeneratedDeposit')
|
||||
);
|
||||
|
||||
$formquestion[] = array(
|
||||
'type' => 'onecolumn',
|
||||
'value' => '
|
||||
<script>
|
||||
let signedValue = ' . $object::STATUS_SIGNED . ';
|
||||
|
||||
$(document).ready(function() {
|
||||
$("[name=generate_deposit]").change(function () {
|
||||
let $self = $(this);
|
||||
let $target = $(".showonlyifgeneratedeposit").parent(".tagtr");
|
||||
|
||||
if (! $self.parents(".tagtr").is(":hidden") && $self.is(":checked")) {
|
||||
$target.show();
|
||||
} else {
|
||||
$target.hide();
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
$("#statut").change(function() {
|
||||
let $target = $(".showonlyifsigned").parent(".tagtr");
|
||||
|
||||
if ($(this).val() == signedValue) {
|
||||
$target.show();
|
||||
} else {
|
||||
$target.hide();
|
||||
}
|
||||
|
||||
$("[name=generate_deposit]").trigger("change");
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
$("#statut").trigger("change");
|
||||
});
|
||||
</script>
|
||||
'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($conf->notification->enabled)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php';
|
||||
$notify = new Notify($db);
|
||||
@ -2164,17 +2348,17 @@ if ($action == 'create') {
|
||||
print '</tr></table>';
|
||||
print '</td><td class="valuefield">';
|
||||
if ($action == 'editconditions' && $usercancreate && $caneditfield) {
|
||||
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'cond_reglement_id');
|
||||
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'cond_reglement_id', 0, '', 1, $object->deposit_percent);
|
||||
} else {
|
||||
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'none');
|
||||
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'none', 0, '', 1, $object->deposit_percent);
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Payment mode
|
||||
print '<tr>';
|
||||
print '<td class="valuefield">';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print '<tr class="field_mode_reglement_id">';
|
||||
print '<td class="titlefieldcreate">';
|
||||
print '<table class="nobordernopadding centpercent"><tr><td>';
|
||||
print $langs->trans('PaymentMode');
|
||||
print '</td>';
|
||||
if ($action != 'editmode' && $usercancreate && $caneditfield) {
|
||||
@ -2193,7 +2377,7 @@ if ($action == 'create') {
|
||||
$langs->load('deliveries');
|
||||
print '<tr><td>';
|
||||
print $form->editfieldkey($langs->trans('DeliveryDate'), 'date_livraison', $object->delivery_date, $object, $usercancreate && $caneditfield, 'datepicker');
|
||||
print '</td><td class="valuefield">';
|
||||
print '</td><td class="valuefieldedit">';
|
||||
print $form->editfieldval($langs->trans('DeliveryDate'), 'date_livraison', $object->delivery_date, $object, $usercancreate && $caneditfield, 'datepicker');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
@ -2224,7 +2408,7 @@ if ($action == 'create') {
|
||||
// Shipping Method
|
||||
if (!empty($conf->expedition->enabled)) {
|
||||
print '<tr><td>';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||
print '<table class="nobordernopadding centpercent"><tr><td>';
|
||||
print $langs->trans('SendingMethod');
|
||||
print '</td>';
|
||||
if ($action != 'editshippingmethod' && $usercancreate && $caneditfield) {
|
||||
@ -2246,7 +2430,7 @@ if ($action == 'create') {
|
||||
$langs->load('stocks');
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
|
||||
$formproduct = new FormProduct($db);
|
||||
print '<tr><td>';
|
||||
print '<tr class="field_warehouse_id"><td class="titlefieldcreate">';
|
||||
$editenable = $usercancreate;
|
||||
print $form->editfieldkey("Warehouse", 'warehouse', '', $object, $editenable);
|
||||
print '</td><td class="valuefieldcreate">';
|
||||
@ -2261,7 +2445,7 @@ if ($action == 'create') {
|
||||
|
||||
// Origin of demand
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print '<table class="nobordernopadding centpercent"><tr><td>';
|
||||
print $langs->trans('Source');
|
||||
print '</td>';
|
||||
if ($action != 'editdemandreason' && $usercancreate) {
|
||||
|
||||
@ -519,7 +519,9 @@ class Proposals extends DolibarrApi
|
||||
isset($request_data->date_end) ? $request_data->date_end : $propalline->date_end,
|
||||
isset($request_data->array_options) ? $request_data->array_options : $propalline->array_options,
|
||||
isset($request_data->fk_unit) ? $request_data->fk_unit : $propalline->fk_unit,
|
||||
isset($request_data->multicurrency_subprice) ? $request_data->multicurrency_subprice : $propalline->subprice
|
||||
isset($request_data->multicurrency_subprice) ? $request_data->multicurrency_subprice : $propalline->subprice,
|
||||
0,
|
||||
isset($request_data->rang) ? $request_data->rang : $propalline->rang
|
||||
);
|
||||
|
||||
if ($updateRes > 0) {
|
||||
@ -643,7 +645,7 @@ class Proposals extends DolibarrApi
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$contacts = $this->invoice->liste_contact();
|
||||
$contacts = $this->propal->liste_contact();
|
||||
|
||||
foreach ($contacts as $contact) {
|
||||
if ($contact['id'] == $contactid && $contact['code'] == $type) {
|
||||
|
||||
@ -206,6 +206,7 @@ class Propal extends CommonObject
|
||||
public $total;
|
||||
|
||||
public $cond_reglement_code;
|
||||
public $deposit_percent;
|
||||
public $mode_reglement_code;
|
||||
public $remise_percent;
|
||||
|
||||
@ -319,6 +320,7 @@ class Propal extends CommonObject
|
||||
'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>1, 'visible'=>-1, 'position'=>150),
|
||||
'fk_currency' =>array('type'=>'varchar(3)', 'label'=>'Currency', 'enabled'=>1, 'visible'=>-1, 'position'=>155),
|
||||
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'position'=>160),
|
||||
'deposit_percent' =>array('type'=>'varchar(63)', 'label'=>'DepositPercent', 'enabled'=>1, 'visible'=>-1, 'position'=>161),
|
||||
'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'PaymentMode', 'enabled'=>1, 'visible'=>-1, 'position'=>165),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>170),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>175),
|
||||
@ -488,7 +490,6 @@ class Propal extends CommonObject
|
||||
$line->subprice = -$remise->amount_ht;
|
||||
$line->fk_product = 0; // Id produit predefined
|
||||
$line->qty = 1;
|
||||
$line->remise = 0;
|
||||
$line->remise_percent = 0;
|
||||
$line->rang = -1;
|
||||
$line->info_bits = 2;
|
||||
@ -734,7 +735,6 @@ class Propal extends CommonObject
|
||||
|
||||
// TODO deprecated
|
||||
$this->line->price = $price;
|
||||
$this->line->remise = $remise;
|
||||
|
||||
if (is_array($array_options) && count($array_options) > 0) {
|
||||
$this->line->array_options = $array_options;
|
||||
@ -804,9 +804,10 @@ class Propal extends CommonObject
|
||||
* @param string $fk_unit Code of the unit to use. Null to use the default one
|
||||
* @param double $pu_ht_devise Unit price in currency
|
||||
* @param int $notrigger disable line update trigger
|
||||
* @param integer $rang line rank
|
||||
* @return int 0 if OK, <0 if KO
|
||||
*/
|
||||
public function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $desc = '', $price_base_type = 'HT', $info_bits = 0, $special_code = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $type = 0, $date_start = '', $date_end = '', $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0)
|
||||
public function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $desc = '', $price_base_type = 'HT', $info_bits = 0, $special_code = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $type = 0, $date_start = '', $date_end = '', $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0, $rang = 0)
|
||||
{
|
||||
global $mysoc, $langs;
|
||||
|
||||
@ -892,6 +893,7 @@ class Propal extends CommonObject
|
||||
$line->oldline = $staticline;
|
||||
$this->line = $line;
|
||||
$this->line->context = $this->context;
|
||||
$this->line->rang = $rang;
|
||||
|
||||
// Reorder if fk_parent_line change
|
||||
if (!empty($fk_parent_line) && !empty($staticline->fk_parent_line) && $fk_parent_line != $staticline->fk_parent_line) {
|
||||
@ -932,7 +934,6 @@ class Propal extends CommonObject
|
||||
|
||||
// TODO deprecated
|
||||
$this->line->price = $price;
|
||||
$this->line->remise = $remise;
|
||||
|
||||
if (is_array($array_options) && count($array_options) > 0) {
|
||||
// We replace values in this->line->array_options only for entries defined into $array_options
|
||||
@ -1100,6 +1101,7 @@ class Propal extends CommonObject
|
||||
$sql .= ", model_pdf";
|
||||
$sql .= ", fin_validite";
|
||||
$sql .= ", fk_cond_reglement";
|
||||
$sql .= ", deposit_percent";
|
||||
$sql .= ", fk_mode_reglement";
|
||||
$sql .= ", fk_account";
|
||||
$sql .= ", ref_client";
|
||||
@ -1133,6 +1135,7 @@ class Propal extends CommonObject
|
||||
$sql .= ", '".$this->db->escape($this->model_pdf)."'";
|
||||
$sql .= ", ".($this->fin_validite != '' ? "'".$this->db->idate($this->fin_validite)."'" : "NULL");
|
||||
$sql .= ", ".($this->cond_reglement_id > 0 ? ((int) $this->cond_reglement_id) : 'NULL');
|
||||
$sql .= ", ".(! empty($this->deposit_percent) ? "'".$this->db->escape($this->deposit_percent)."'" : 'NULL');
|
||||
$sql .= ", ".($this->mode_reglement_id > 0 ? ((int) $this->mode_reglement_id) : 'NULL');
|
||||
$sql .= ", ".($this->fk_account > 0 ? ((int) $this->fk_account) : 'NULL');
|
||||
$sql .= ", '".$this->db->escape($this->ref_client)."'";
|
||||
@ -1360,6 +1363,7 @@ class Propal extends CommonObject
|
||||
if ($objsoc->fetch($socid) > 0) {
|
||||
$object->socid = $objsoc->id;
|
||||
$object->cond_reglement_id = (!empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0);
|
||||
$object->deposit_percent = (!empty($objsoc->deposit_percent) ? $objsoc->deposit_percent : null);
|
||||
$object->mode_reglement_id = (!empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0);
|
||||
$object->fk_delivery_address = '';
|
||||
|
||||
@ -1536,7 +1540,7 @@ class Propal extends CommonObject
|
||||
$sql .= ", c.label as statut_label";
|
||||
$sql .= ", ca.code as availability_code, ca.label as availability";
|
||||
$sql .= ", dr.code as demand_reason_code, dr.label as demand_reason";
|
||||
$sql .= ", cr.code as cond_reglement_code, cr.libelle as cond_reglement, cr.libelle_facture as cond_reglement_libelle_doc";
|
||||
$sql .= ", cr.code as cond_reglement_code, cr.libelle as cond_reglement, cr.libelle_facture as cond_reglement_libelle_doc, p.deposit_percent";
|
||||
$sql .= ", cp.code as mode_reglement_code, cp.libelle as mode_reglement";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."propal as p";
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_propalst as c ON p.fk_statut = c.id';
|
||||
@ -1619,6 +1623,7 @@ class Propal extends CommonObject
|
||||
$this->cond_reglement_code = $obj->cond_reglement_code;
|
||||
$this->cond_reglement = $obj->cond_reglement;
|
||||
$this->cond_reglement_doc = $obj->cond_reglement_libelle_doc;
|
||||
$this->deposit_percent = $obj->deposit_percent;
|
||||
|
||||
$this->extraparams = (array) json_decode($obj->extraparams, true);
|
||||
|
||||
@ -1728,6 +1733,7 @@ class Propal extends CommonObject
|
||||
$sql .= " fk_user_valid=".(isset($this->user_valid) ? $this->user_valid : "null").",";
|
||||
$sql .= " fk_projet=".(isset($this->fk_project) ? $this->fk_project : "null").",";
|
||||
$sql .= " fk_cond_reglement=".(isset($this->cond_reglement_id) ? $this->cond_reglement_id : "null").",";
|
||||
$sql .= " deposit_percent=".(! empty($this->deposit_percent) ? "'".$this->db->escape($this->deposit_percent)."'" : "null").",";
|
||||
$sql .= " fk_mode_reglement=".(isset($this->mode_reglement_id) ? $this->mode_reglement_id : "null").",";
|
||||
$sql .= " fk_input_reason=".(isset($this->demand_reason_id) ? $this->demand_reason_id : "null").",";
|
||||
$sql .= " note_private=".(isset($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : "null").",";
|
||||
@ -1891,14 +1897,15 @@ class Propal extends CommonObject
|
||||
|
||||
// multilangs
|
||||
if (!empty($conf->global->MAIN_MULTILANGS) && !empty($objp->fk_product) && !empty($loadalsotranslation)) {
|
||||
$line = new Product($this->db);
|
||||
$line->fetch($objp->fk_product);
|
||||
$line->getMultiLangs();
|
||||
$tmpproduct = new Product($this->db);
|
||||
$tmpproduct->fetch($objp->fk_product);
|
||||
$tmpproduct->getMultiLangs();
|
||||
|
||||
$line->multilangs = $tmpproduct->multilangs;
|
||||
}
|
||||
|
||||
$this->lines[$i] = $line;
|
||||
//dol_syslog("1 ".$line->fk_product);
|
||||
//print "xx $i ".$this->lines[$i]->fk_product;
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -3984,6 +3991,7 @@ class PropaleLigne extends CommonObjectLine
|
||||
public $multicurrency_total_tva;
|
||||
public $multicurrency_total_ttc;
|
||||
|
||||
|
||||
/**
|
||||
* Class line Contructor
|
||||
*
|
||||
@ -4123,9 +4131,6 @@ class PropaleLigne extends CommonObjectLine
|
||||
if (empty($this->rang)) {
|
||||
$this->rang = 0;
|
||||
}
|
||||
if (empty($this->remise)) {
|
||||
$this->remise = 0;
|
||||
}
|
||||
if (empty($this->remise_percent) || !is_numeric($this->remise_percent)) {
|
||||
$this->remise_percent = 0;
|
||||
}
|
||||
@ -4355,9 +4360,6 @@ class PropaleLigne extends CommonObjectLine
|
||||
if (empty($this->price)) {
|
||||
$this->price = 0; // TODO A virer
|
||||
}
|
||||
if (empty($this->remise)) {
|
||||
$this->remise = 0; // TODO A virer
|
||||
}
|
||||
if (empty($this->remise_percent)) {
|
||||
$this->remise_percent = 0;
|
||||
}
|
||||
|
||||
@ -340,7 +340,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
||||
$search_availability = '';
|
||||
$search_status = '';
|
||||
$object_statut = '';
|
||||
$toselect = '';
|
||||
$toselect = array();
|
||||
$search_array_options = array();
|
||||
$search_categ_cus = 0;
|
||||
$search_fk_cond_reglement = '';
|
||||
@ -377,14 +377,14 @@ if ($action == 'validate' && $permissiontovalidate) {
|
||||
if ($tmpproposal->fetch($checked) > 0) {
|
||||
if ($tmpproposal->statut == $tmpproposal::STATUS_DRAFT) {
|
||||
if ($tmpproposal->valid($user) > 0) {
|
||||
setEventMessage($langs->trans('hasBeenValidated', $tmpproposal->ref), 'mesgs');
|
||||
setEventMessages($langs->trans('hasBeenValidated', $tmpproposal->ref), null, 'mesgs');
|
||||
} else {
|
||||
setEventMessage($tmpproposal->error, $tmpproposal->errors, 'errors');
|
||||
setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
setEventMessage($langs->trans('ErrorIsNotADraft', $tmpproposal->ref), 'errors');
|
||||
setEventMessages($langs->trans('ErrorIsNotADraft', $tmpproposal->ref), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
@ -410,7 +410,7 @@ if ($action == "sign" && $permissiontoclose) {
|
||||
if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED) {
|
||||
$tmpproposal->statut = $tmpproposal::STATUS_SIGNED;
|
||||
if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_SIGNED) >= 0) {
|
||||
setEventMessage($tmpproposal->ref." ".$langs->trans('Signed'), 'mesgs');
|
||||
setEventMessages($tmpproposal->ref." ".$langs->trans('Signed'), null, 'mesgs');
|
||||
} else {
|
||||
setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors');
|
||||
$error++;
|
||||
@ -537,7 +537,7 @@ $sql .= ' p.fk_multicurrency, p.multicurrency_code, p.multicurrency_tx, p.multic
|
||||
$sql .= ' p.datec as date_creation, p.tms as date_update, p.date_cloture as date_cloture,';
|
||||
$sql .= ' p.date_signature as dsignature,';
|
||||
$sql .= ' p.note_public, p.note_private,';
|
||||
$sql .= ' p.fk_cond_reglement,p.fk_mode_reglement,p.fk_shipping_method,p.fk_input_reason,';
|
||||
$sql .= ' p.fk_cond_reglement,p.deposit_percent,p.fk_mode_reglement,p.fk_shipping_method,p.fk_input_reason,';
|
||||
$sql .= " pr.rowid as project_id, pr.ref as project_ref, pr.title as project_label,";
|
||||
$sql .= ' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as user_statut, u.entity as user_entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender';
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
@ -765,12 +765,12 @@ if ($resql) {
|
||||
if ($socid > 0) {
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($socid);
|
||||
$title = $langs->trans('ListOfProposals').' - '.$soc->name;
|
||||
$title = $langs->trans('Proposals').' - '.$soc->name;
|
||||
if (empty($search_societe)) {
|
||||
$search_societe = $soc->name;
|
||||
}
|
||||
} else {
|
||||
$title = $langs->trans('ListOfProposals');
|
||||
$title = $langs->trans('Proposals');
|
||||
}
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
@ -1043,7 +1043,7 @@ if ($resql) {
|
||||
$moreforfilter = '';
|
||||
|
||||
// If the user can view prospects other than his'
|
||||
if ($user->rights->societe->client->voir || $socid) {
|
||||
if ($user->rights->user->user->lire) {
|
||||
$langs->load("commercial");
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$tmptitle = $langs->trans('ThirdPartiesOfSaleRepresentative');
|
||||
@ -1051,9 +1051,9 @@ if ($resql) {
|
||||
$moreforfilter .= '</div>';
|
||||
}
|
||||
// If the user can view prospects other than his'
|
||||
if ($user->rights->societe->client->voir || $socid) {
|
||||
if ($user->rights->user->user->lire) {
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$tmptitle = $langs->trans('LinkedToSpecificUsers');
|
||||
$tmptitle = $langs->trans('LinkedToSpecificUsers');
|
||||
$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_user, 'search_user', $tmptitle, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth250 widthcentpercentminusx');
|
||||
$moreforfilter .= '</div>';
|
||||
}
|
||||
@ -1224,7 +1224,7 @@ if ($resql) {
|
||||
// Payment term
|
||||
if (!empty($arrayfields['p.fk_cond_reglement']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
$form->select_conditions_paiements($search_fk_cond_reglement, 'search_fk_cond_reglement', -1, 1, 1);
|
||||
$form->select_conditions_paiements($search_fk_cond_reglement, 'search_fk_cond_reglement', 1, 1, 1);
|
||||
print '</td>';
|
||||
}
|
||||
// Payment mode
|
||||
@ -1821,7 +1821,7 @@ if ($resql) {
|
||||
// Payment terms
|
||||
if (!empty($arrayfields['p.fk_cond_reglement']['checked'])) {
|
||||
print '<td>';
|
||||
$form->form_conditions_reglement($_SERVER['PHP_SELF'], $obj->fk_cond_reglement, 'none');
|
||||
$form->form_conditions_reglement($_SERVER['PHP_SELF'], $obj->fk_cond_reglement, 'none', 0, '', 1, $obj->deposit_percent);
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
@ -2097,7 +2097,7 @@ if ($resql) {
|
||||
// Note public
|
||||
if (!empty($arrayfields['p.note_public']['checked'])) {
|
||||
print '<td class="center">';
|
||||
print dol_escape_htmltag($obj->note_public);
|
||||
print dol_string_nohtmltag($obj->note_public);
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
@ -2106,7 +2106,7 @@ if ($resql) {
|
||||
// Note private
|
||||
if (!empty($arrayfields['p.note_private']['checked'])) {
|
||||
print '<td class="center">';
|
||||
print dol_escape_htmltag($obj->note_private);
|
||||
print dol_string_nohtmltag($obj->note_private);
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
@ -2133,7 +2133,7 @@ if ($resql) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
print '</tr>'."\n";
|
||||
|
||||
$i++;
|
||||
}
|
||||
@ -2141,6 +2141,17 @@ if ($resql) {
|
||||
// Show total line
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
|
||||
|
||||
// If no record found
|
||||
if ($num == 0) {
|
||||
$colspan = 1;
|
||||
foreach ($arrayfields as $key => $val) {
|
||||
if (!empty($val['checked'])) {
|
||||
$colspan++;
|
||||
}
|
||||
}
|
||||
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
|
||||
}
|
||||
|
||||
$db->free($resql);
|
||||
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
|
||||
|
||||
@ -272,6 +272,7 @@ if (empty($reshook)) {
|
||||
$object->ref_client = GETPOST('ref_client', 'alpha');
|
||||
$object->model_pdf = GETPOST('model');
|
||||
$object->cond_reglement_id = GETPOST('cond_reglement_id');
|
||||
$object->deposit_percent = GETPOST('cond_reglement_id_deposit_percent', 'alpha');
|
||||
$object->mode_reglement_id = GETPOST('mode_reglement_id');
|
||||
$object->fk_account = GETPOST('fk_account', 'int');
|
||||
$object->availability_id = GETPOST('availability_id');
|
||||
@ -571,7 +572,7 @@ if (empty($reshook)) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
} elseif ($action == 'setconditions' && $usercancreate) {
|
||||
$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
|
||||
$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'), GETPOST('cond_reglement_id_deposit_percent', 'alpha'));
|
||||
if ($result < 0) {
|
||||
dol_print_error($db, $object->error);
|
||||
} else {
|
||||
@ -628,6 +629,13 @@ if (empty($reshook)) {
|
||||
foreach ($object->lines as $line) {
|
||||
$result = $object->updateline($line->id, $line->desc, $line->subprice, $line->qty, $line->remise_percent, $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $line->info_bits, $line->date_start, $line->date_end, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->fk_unit, $line->multicurrency_subprice);
|
||||
}
|
||||
} elseif ($action == 'addline' && GETPOST('submitforalllines', 'alpha') && GETPOST('remiseforalllines', 'alpha') !== '' && $usercancreate) {
|
||||
// Define remise_percent
|
||||
$remise_percent = (GETPOST('remiseforalllines') ? GETPOST('remiseforalllines') : 0);
|
||||
$remise_percent = str_replace('*', '', $remise_percent);
|
||||
foreach ($object->lines as $line) {
|
||||
$result = $object->updateline($line->id, $line->desc, $line->subprice, $line->qty, $remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->date_start, $line->date_end, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->fk_unit, $line->multicurrency_subprice);
|
||||
}
|
||||
} elseif ($action == 'addline' && $usercancreate) { // Add a new line
|
||||
$langs->load('errors');
|
||||
$error = 0;
|
||||
@ -1169,28 +1177,76 @@ if (empty($reshook)) {
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$locationTarget = '';
|
||||
$db->begin();
|
||||
$result = $object->valid($user, $idwarehouse);
|
||||
if ($result >= 0) {
|
||||
// Define output language
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
|
||||
$newlang = GETPOST('lang_id', 'aZ09');
|
||||
}
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) {
|
||||
$newlang = $object->thirdparty->default_lang;
|
||||
}
|
||||
if (!empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
$model = $object->model_pdf;
|
||||
$ret = $object->fetch($id); // Reload to get new records
|
||||
$error = 0;
|
||||
$deposit = null;
|
||||
|
||||
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
$deposit_percent_from_payment_terms = getDictionaryValue('c_payment_term', 'deposit_percent', $object->cond_reglement_id);
|
||||
|
||||
if (
|
||||
GETPOST('generate_deposit', 'alpha') == 'on' && ! empty($deposit_percent_from_payment_terms)
|
||||
&& ! empty($conf->facture->enabled) && ! empty($user->rights->facture->creer)
|
||||
) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
||||
|
||||
$date = dol_mktime(0, 0, 0, GETPOST('datefmonth', 'int'), GETPOST('datefday', 'int'), GETPOST('datefyear', 'int'));
|
||||
$forceFields = array();
|
||||
|
||||
if (GETPOSTISSET('date_pointoftax')) {
|
||||
$forceFields['date_pointoftax'] = dol_mktime(0, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'));
|
||||
}
|
||||
|
||||
$deposit = Facture::createDepositFromOrigin($object, $date, GETPOST('cond_reglement_id', 'int'), $user, 0, GETPOST('validate_generated_deposit', 'alpha') == 'on', $forceFields);
|
||||
|
||||
if ($deposit) {
|
||||
setEventMessage('DepositGenerated');
|
||||
$locationTarget = DOL_URL_ROOT . '/compta/facture/card.php?id=' . $deposit->id;
|
||||
} else {
|
||||
$error++;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
// Define output language
|
||||
if (! $error) {
|
||||
$db->commit();
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
|
||||
$newlang = GETPOST('lang_id', 'aZ09');
|
||||
}
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) {
|
||||
$newlang = $object->thirdparty->default_lang;
|
||||
}
|
||||
if (!empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
$model = $object->model_pdf;
|
||||
$ret = $object->fetch($id); // Reload to get new records
|
||||
|
||||
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
|
||||
if ($deposit) {
|
||||
$deposit->fetch($deposit->id); // Reload to get new records
|
||||
$deposit->generateDocument($deposit->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}
|
||||
}
|
||||
|
||||
if ($locationTarget) {
|
||||
header('Location: ' . $locationTarget);
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
$db->rollback();
|
||||
}
|
||||
} else {
|
||||
$db->rollback();
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
@ -1453,6 +1509,10 @@ if ($action == 'create' && $usercancreate) {
|
||||
|
||||
$currency_code = $conf->currency;
|
||||
|
||||
$cond_reglement_id = GETPOST('cond_reglement_id', 'int');
|
||||
$deposit_percent = GETPOST('cond_reglement_id_deposit_percent', 'alpha');
|
||||
$mode_reglement_id = GETPOST('mode_reglement_id', 'int');
|
||||
|
||||
if (!empty($origin) && !empty($originid)) {
|
||||
// Parse element/subelement (ex: project_task)
|
||||
$element = $subelement = $origin;
|
||||
@ -1468,6 +1528,9 @@ if ($action == 'create' && $usercancreate) {
|
||||
if (!$cond_reglement_id) {
|
||||
$cond_reglement_id = $soc->cond_reglement_id;
|
||||
}
|
||||
if (!$deposit_percent) {
|
||||
$deposit_percent = $soc->deposit_percent;
|
||||
}
|
||||
if (!$mode_reglement_id) {
|
||||
$mode_reglement_id = $soc->mode_reglement_id;
|
||||
}
|
||||
@ -1508,6 +1571,7 @@ if ($action == 'create' && $usercancreate) {
|
||||
|
||||
$soc = $objectsrc->thirdparty;
|
||||
$cond_reglement_id = (!empty($objectsrc->cond_reglement_id) ? $objectsrc->cond_reglement_id : (!empty($soc->cond_reglement_id) ? $soc->cond_reglement_id : 0)); // TODO maybe add default value option
|
||||
$deposit_percent = (!empty($objectsrc->deposit_percent) ? $objectsrc->deposit_percent : (!empty($soc->deposit_percent) ? $soc->deposit_percent : null));
|
||||
$mode_reglement_id = (!empty($objectsrc->mode_reglement_id) ? $objectsrc->mode_reglement_id : (!empty($soc->mode_reglement_id) ? $soc->mode_reglement_id : 0));
|
||||
$fk_account = (!empty($objectsrc->fk_account) ? $objectsrc->fk_account : (!empty($soc->fk_account) ? $soc->fk_account : 0));
|
||||
$availability_id = (!empty($objectsrc->availability_id) ? $objectsrc->availability_id : 0);
|
||||
@ -1540,6 +1604,7 @@ if ($action == 'create' && $usercancreate) {
|
||||
}
|
||||
} else {
|
||||
$cond_reglement_id = $soc->cond_reglement_id;
|
||||
$deposit_percent = $soc->deposit_percent;
|
||||
$mode_reglement_id = $soc->mode_reglement_id;
|
||||
$fk_account = $soc->fk_account;
|
||||
$availability_id = 0;
|
||||
@ -1668,10 +1733,10 @@ if ($action == 'create' && $usercancreate) {
|
||||
$form->selectAvailabilityDelay($availability_id, 'availability_id', '', 1, 'maxwidth200 widthcentpercentminusx');
|
||||
print '</td></tr>';
|
||||
|
||||
// Terms of the settlement
|
||||
// Terms of payment
|
||||
print '<tr><td class="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td>';
|
||||
print img_picto('', 'payment', 'class="pictofixedwidth"');
|
||||
$form->select_conditions_paiements($cond_reglement_id, 'cond_reglement_id', - 1, 1);
|
||||
$form->select_conditions_paiements($cond_reglement_id, 'cond_reglement_id', 1, 1, 0, 'maxwidth200 widthcentpercentminusx', $deposit_percent);
|
||||
print '</td></tr>';
|
||||
|
||||
// Payment mode
|
||||
@ -1771,7 +1836,7 @@ if ($action == 'create' && $usercancreate) {
|
||||
print '<tr>';
|
||||
print '<td>'.$form->editfieldkey("Currency", 'multicurrency_code', '', $object, 0).'</td>';
|
||||
print '<td class="maxwidthonsmartphone">';
|
||||
print img_picto('', 'currency', 'class="pictofixedwidth"').$form->selectMultiCurrency($currency_code, 'multicurrency_code');
|
||||
print img_picto('', 'currency', 'class="pictofixedwidth"').$form->selectMultiCurrency($currency_code, 'multicurrency_code', 0, '', false, 'maxwidth200 widthcentpercentminusx');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -1960,6 +2025,111 @@ if ($action == 'create' && $usercancreate) {
|
||||
if ($nbMandated > 0 ) $text .= '<div><span class="clearboth nowraponall warning">'.$langs->trans("mandatoryPeriodNeedTobeSetMsgValidate").'</span></div>';
|
||||
|
||||
|
||||
$deposit_percent_from_payment_terms = getDictionaryValue('c_payment_term', 'deposit_percent', $object->cond_reglement_id);
|
||||
|
||||
if (! empty($deposit_percent_from_payment_terms) && ! empty($conf->facture->enabled) && ! empty($user->rights->facture->creer)) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
||||
|
||||
$object->fetchObjectLinked();
|
||||
|
||||
$eligibleForDepositGeneration = true;
|
||||
|
||||
if (array_key_exists('facture', $object->linkedObjects)) {
|
||||
foreach ($object->linkedObjects['facture'] as $invoice) {
|
||||
if ($invoice->type == Facture::TYPE_DEPOSIT) {
|
||||
$eligibleForDepositGeneration = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($eligibleForDepositGeneration && array_key_exists('propal', $object->linkedObjects)) {
|
||||
foreach ($object->linkedObjects['propal'] as $proposal) {
|
||||
$proposal->fetchObjectLinked();
|
||||
|
||||
if (array_key_exists('facture', $proposal->linkedObjects)) {
|
||||
foreach ($proposal->linkedObjects['facture'] as $invoice) {
|
||||
if ($invoice->type == Facture::TYPE_DEPOSIT) {
|
||||
$eligibleForDepositGeneration = false;
|
||||
break 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($eligibleForDepositGeneration) {
|
||||
$formquestion[] = array(
|
||||
'type' => 'checkbox',
|
||||
'tdclass' => '',
|
||||
'name' => 'generate_deposit',
|
||||
'label' => $form->textwithpicto($langs->trans('GenerateDeposit', $object->deposit_percent), $langs->trans('DepositGenerationPermittedByThePaymentTermsSelected'))
|
||||
);
|
||||
|
||||
$formquestion[] = array(
|
||||
'type' => 'date',
|
||||
'tdclass' => 'fieldrequired showonlyifgeneratedeposit',
|
||||
'name' => 'datef',
|
||||
'label' => $langs->trans('DateInvoice'),
|
||||
'value' => dol_now(),
|
||||
'datenow' => true
|
||||
);
|
||||
|
||||
if (! empty($conf->global->INVOICE_POINTOFTAX_DATE)) {
|
||||
$formquestion[] = array(
|
||||
'type' => 'date',
|
||||
'tdclass' => 'fieldrequired showonlyifgeneratedeposit',
|
||||
'name' => 'date_pointoftax',
|
||||
'label' => $langs->trans('DatePointOfTax'),
|
||||
'value' => dol_now(),
|
||||
'datenow' => true
|
||||
);
|
||||
}
|
||||
|
||||
ob_start();
|
||||
$form->select_conditions_paiements(0, 'cond_reglement_id', -1, 0, 0, 'minwidth200');
|
||||
$paymentTermsSelect = ob_get_clean();
|
||||
|
||||
$formquestion[] = array(
|
||||
'type' => 'other',
|
||||
'tdclass' => 'fieldrequired showonlyifgeneratedeposit',
|
||||
'name' => 'cond_reglement_id',
|
||||
'label' => $langs->trans('PaymentTerm'),
|
||||
'value' => $paymentTermsSelect
|
||||
);
|
||||
|
||||
$formquestion[] = array(
|
||||
'type' => 'checkbox',
|
||||
'tdclass' => 'showonlyifgeneratedeposit',
|
||||
'name' => 'validate_generated_deposit',
|
||||
'label' => $langs->trans('ValidateGeneratedDeposit')
|
||||
);
|
||||
|
||||
$formquestion[] = array(
|
||||
'type' => 'onecolumn',
|
||||
'value' => '
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$("[name=generate_deposit]").change(function () {
|
||||
let $self = $(this);
|
||||
let $target = $(".showonlyifgeneratedeposit").parent(".tagtr");
|
||||
|
||||
if (! $self.parents(".tagtr").is(":hidden") && $self.is(":checked")) {
|
||||
$target.show();
|
||||
} else {
|
||||
$target.hide();
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateOrder'), $text, 'confirm_validate', $formquestion, 0, 1, 220);
|
||||
}
|
||||
@ -2263,9 +2433,9 @@ if ($action == 'create' && $usercancreate) {
|
||||
print $form->editfieldkey("PaymentConditionsShort", 'conditions', '', $object, $editenable);
|
||||
print '</td><td class="valuefield">';
|
||||
if ($action == 'editconditions') {
|
||||
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'cond_reglement_id', 1);
|
||||
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'cond_reglement_id', 1, '', 1, $object->deposit_percent);
|
||||
} else {
|
||||
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'none', 1);
|
||||
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'none', 1, '', 1, $object->deposit_percent);
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
|
||||
@ -439,7 +439,8 @@ class Orders extends DolibarrApi
|
||||
$request_data->fk_unit,
|
||||
$request_data->multicurrency_subprice,
|
||||
0,
|
||||
$request_data->ref_ext
|
||||
$request_data->ref_ext,
|
||||
$request_data->rang
|
||||
);
|
||||
|
||||
if ($updateRes > 0) {
|
||||
|
||||
@ -134,6 +134,11 @@ class Commande extends CommonOrder
|
||||
*/
|
||||
public $cond_reglement_code;
|
||||
|
||||
/**
|
||||
* @var double Deposit % for payment terms
|
||||
*/
|
||||
public $deposit_percent;
|
||||
|
||||
/**
|
||||
* @var int bank account ID
|
||||
*/
|
||||
@ -332,6 +337,7 @@ class Commande extends CommonOrder
|
||||
'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>1, 'visible'=>-1, 'position'=>170),
|
||||
'fk_currency' =>array('type'=>'varchar(3)', 'label'=>'MulticurrencyID', 'enabled'=>1, 'visible'=>-1, 'position'=>175),
|
||||
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'position'=>180),
|
||||
'deposit_percent' =>array('type'=>'varchar(63)', 'label'=>'DepositPercent', 'enabled'=>1, 'visible'=>-1, 'position'=>181),
|
||||
'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'PaymentMode', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
|
||||
'date_livraison' =>array('type'=>'date', 'label'=>'DateDeliveryPlanned', 'enabled'=>1, 'visible'=>-1, 'position'=>190),
|
||||
'fk_shipping_method' =>array('type'=>'integer', 'label'=>'ShippingMethod', 'enabled'=>1, 'visible'=>-1, 'position'=>195),
|
||||
@ -940,7 +946,7 @@ class Commande extends CommonOrder
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."commande (";
|
||||
$sql .= " ref, fk_soc, date_creation, fk_user_author, fk_projet, date_commande, source, note_private, note_public, ref_ext, ref_client, ref_int";
|
||||
$sql .= ", model_pdf, fk_cond_reglement, fk_mode_reglement, fk_account, fk_availability, fk_input_reason, date_livraison, fk_delivery_address";
|
||||
$sql .= ", model_pdf, fk_cond_reglement, deposit_percent, fk_mode_reglement, fk_account, fk_availability, fk_input_reason, date_livraison, fk_delivery_address";
|
||||
$sql .= ", fk_shipping_method";
|
||||
$sql .= ", fk_warehouse";
|
||||
$sql .= ", remise_absolue, remise_percent";
|
||||
@ -961,6 +967,7 @@ class Commande extends CommonOrder
|
||||
$sql .= ", ".($this->ref_int ? "'".$this->db->escape($this->ref_int)."'" : "null");
|
||||
$sql .= ", '".$this->db->escape($this->model_pdf)."'";
|
||||
$sql .= ", ".($this->cond_reglement_id > 0 ? ((int) $this->cond_reglement_id) : "null");
|
||||
$sql .= ", ".(! empty($this->deposit_percent) ? "'".$this->db->escape($this->deposit_percent)."'" : "null");
|
||||
$sql .= ", ".($this->mode_reglement_id > 0 ? ((int) $this->mode_reglement_id) : "null");
|
||||
$sql .= ", ".($this->fk_account > 0 ? ((int) $this->fk_account) : 'NULL');
|
||||
$sql .= ", ".($this->availability_id > 0 ? ((int) $this->availability_id) : "null");
|
||||
@ -1212,6 +1219,7 @@ class Commande extends CommonOrder
|
||||
if ($objsoc->fetch($socid) > 0) {
|
||||
$this->socid = $objsoc->id;
|
||||
$this->cond_reglement_id = (!empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0);
|
||||
$this->deposit_percent = (!empty($objsoc->deposit_percent) ? $objsoc->deposit_percent : null);
|
||||
$this->mode_reglement_id = (!empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0);
|
||||
$this->fk_project = 0;
|
||||
$this->fk_delivery_address = 0;
|
||||
@ -1354,6 +1362,7 @@ class Commande extends CommonOrder
|
||||
$this->socid = $object->socid;
|
||||
$this->fk_project = $object->fk_project;
|
||||
$this->cond_reglement_id = $object->cond_reglement_id;
|
||||
$this->deposit_percent = $object->deposit_percent;
|
||||
$this->mode_reglement_id = $object->mode_reglement_id;
|
||||
$this->fk_account = $object->fk_account;
|
||||
$this->availability_id = $object->availability_id;
|
||||
@ -1657,7 +1666,6 @@ class Commande extends CommonOrder
|
||||
|
||||
// TODO Ne plus utiliser
|
||||
$this->line->price = $price;
|
||||
$this->line->remise = $remise;
|
||||
|
||||
if (is_array($array_options) && count($array_options) > 0) {
|
||||
$this->line->array_options = $array_options;
|
||||
@ -1811,7 +1819,7 @@ class Commande extends CommonOrder
|
||||
}
|
||||
|
||||
$sql = 'SELECT c.rowid, c.entity, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_user_valid, c.fk_user_modif, c.fk_statut';
|
||||
$sql .= ', c.amount_ht, c.total_ht, c.total_ttc, c.total_tva, c.localtax1 as total_localtax1, c.localtax2 as total_localtax2, c.fk_cond_reglement, c.fk_mode_reglement, c.fk_availability, c.fk_input_reason';
|
||||
$sql .= ', c.amount_ht, c.total_ht, c.total_ttc, c.total_tva, c.localtax1 as total_localtax1, c.localtax2 as total_localtax2, c.fk_cond_reglement, c.deposit_percent, c.fk_mode_reglement, c.fk_availability, c.fk_input_reason';
|
||||
$sql .= ', c.fk_account';
|
||||
$sql .= ', c.date_commande, c.date_valid, c.tms';
|
||||
$sql .= ', c.date_livraison as delivery_date';
|
||||
@ -1904,6 +1912,7 @@ class Commande extends CommonOrder
|
||||
$this->cond_reglement_code = $obj->cond_reglement_code;
|
||||
$this->cond_reglement = $obj->cond_reglement_libelle;
|
||||
$this->cond_reglement_doc = $obj->cond_reglement_libelle_doc;
|
||||
$this->deposit_percent = $obj->deposit_percent;
|
||||
$this->fk_account = $obj->fk_account;
|
||||
$this->availability_id = $obj->fk_availability;
|
||||
$this->availability_code = $obj->availability_code;
|
||||
@ -2000,7 +2009,6 @@ class Commande extends CommonOrder
|
||||
$line->price = -$remise->amount_ht;
|
||||
$line->fk_product = 0; // Id produit predefini
|
||||
$line->qty = 1;
|
||||
$line->remise = 0;
|
||||
$line->remise_percent = 0;
|
||||
$line->rang = -1;
|
||||
$line->info_bits = 2;
|
||||
@ -2144,9 +2152,11 @@ class Commande extends CommonOrder
|
||||
|
||||
// multilangs
|
||||
if (!empty($conf->global->MAIN_MULTILANGS) && !empty($objp->fk_product) && !empty($loadalsotranslation)) {
|
||||
$line = new Product($this->db);
|
||||
$line->fetch($objp->fk_product);
|
||||
$line->getMultiLangs();
|
||||
$tmpproduct = new Product($this->db);
|
||||
$tmpproduct->fetch($objp->fk_product);
|
||||
$tmpproduct->getMultiLangs();
|
||||
|
||||
$line->multilangs = $tmpproduct->multilangs;
|
||||
}
|
||||
|
||||
$this->lines[$i] = $line;
|
||||
@ -3077,9 +3087,10 @@ class Commande extends CommonOrder
|
||||
* @param double $pu_ht_devise Amount in currency
|
||||
* @param int $notrigger disable line update trigger
|
||||
* @param string $ref_ext external reference
|
||||
* @param integer $rang line rank
|
||||
* @return int < 0 if KO, > 0 if OK
|
||||
*/
|
||||
public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $price_base_type = 'HT', $info_bits = 0, $date_start = '', $date_end = '', $type = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $special_code = 0, $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0, $ref_ext = '')
|
||||
public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $price_base_type = 'HT', $info_bits = 0, $date_start = '', $date_end = '', $type = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $special_code = 0, $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0, $ref_ext = '', $rang = 0)
|
||||
{
|
||||
global $conf, $mysoc, $langs, $user;
|
||||
|
||||
@ -3204,6 +3215,7 @@ class Commande extends CommonOrder
|
||||
$line->oldline = $staticline;
|
||||
$this->line = $line;
|
||||
$this->line->context = $this->context;
|
||||
$this->line->rang = $rang;
|
||||
|
||||
// Reorder if fk_parent_line change
|
||||
if (!empty($fk_parent_line) && !empty($staticline->fk_parent_line) && $fk_parent_line != $staticline->fk_parent_line) {
|
||||
@ -3250,7 +3262,6 @@ class Commande extends CommonOrder
|
||||
|
||||
// TODO deprecated
|
||||
$this->line->price = $price;
|
||||
$this->line->remise = $remise;
|
||||
|
||||
if (is_array($array_options) && count($array_options) > 0) {
|
||||
// We replace values in this->line->array_options only for entries defined into $array_options
|
||||
@ -3340,6 +3351,7 @@ class Commande extends CommonOrder
|
||||
$sql .= " fk_user_valid=".(isset($this->user_valid) ? $this->user_valid : "null").",";
|
||||
$sql .= " fk_projet=".(isset($this->fk_project) ? $this->fk_project : "null").",";
|
||||
$sql .= " fk_cond_reglement=".(isset($this->cond_reglement_id) ? $this->cond_reglement_id : "null").",";
|
||||
$sql .= " deposit_percent=".(! empty($this->deposit_percent) ? strval($this->deposit_percent) : "null").",";
|
||||
$sql .= " fk_mode_reglement=".(isset($this->mode_reglement_id) ? $this->mode_reglement_id : "null").",";
|
||||
$sql .= " date_livraison=".(strval($this->delivery_date) != '' ? "'".$this->db->idate($this->delivery_date)."'" : 'null').",";
|
||||
$sql .= " fk_shipping_method=".(isset($this->shipping_method_id) ? $this->shipping_method_id : "null").",";
|
||||
@ -4391,9 +4403,6 @@ class OrderLine extends CommonOrderLine
|
||||
if (empty($this->rang)) {
|
||||
$this->rang = 0;
|
||||
}
|
||||
if (empty($this->remise)) {
|
||||
$this->remise = 0;
|
||||
}
|
||||
if (empty($this->remise_percent)) {
|
||||
$this->remise_percent = 0;
|
||||
}
|
||||
@ -4566,9 +4575,6 @@ class OrderLine extends CommonOrderLine
|
||||
if (empty($this->marge_tx)) {
|
||||
$this->marge_tx = 0;
|
||||
}
|
||||
if (empty($this->remise)) {
|
||||
$this->remise = 0;
|
||||
}
|
||||
if (empty($this->remise_percent)) {
|
||||
$this->remise_percent = 0;
|
||||
}
|
||||
|
||||
@ -267,7 +267,7 @@ if (empty($reshook)) {
|
||||
$search_project = '';
|
||||
$search_status = '';
|
||||
$search_billed = '';
|
||||
$toselect = '';
|
||||
$toselect = array();
|
||||
$search_array_options = array();
|
||||
$search_categ_cus = 0;
|
||||
$search_datecloture_start = '';
|
||||
@ -787,7 +787,7 @@ $sql .= ' c.date_valid, c.date_commande, c.note_public, c.note_private, c.date_l
|
||||
$sql .= ' c.date_creation as date_creation, c.tms as date_update, c.date_cloture as date_cloture,';
|
||||
$sql .= ' p.rowid as project_id, p.ref as project_ref, p.title as project_label,';
|
||||
$sql .= ' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as user_statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender,';
|
||||
$sql .= ' c.fk_cond_reglement,c.fk_mode_reglement,c.fk_shipping_method,';
|
||||
$sql .= ' c.fk_cond_reglement,c.deposit_percent,c.fk_mode_reglement,c.fk_shipping_method,';
|
||||
$sql .= ' c.fk_input_reason, c.import_key';
|
||||
if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
|
||||
$sql .= ", cc.fk_categorie, cc.fk_soc";
|
||||
@ -1015,12 +1015,12 @@ if ($resql) {
|
||||
if ($socid > 0) {
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($socid);
|
||||
$title = $langs->trans('ListOfOrders').' - '.$soc->name;
|
||||
$title = $langs->trans('CustomersOrders').' - '.$soc->name;
|
||||
if (empty($search_company)) {
|
||||
$search_company = $soc->name;
|
||||
}
|
||||
} else {
|
||||
$title = $langs->trans('ListOfOrders');
|
||||
$title = $langs->trans('CustomersOrders');
|
||||
}
|
||||
if (strval($search_status) == '0') {
|
||||
$title .= ' - '.$langs->trans('StatusOrderDraftShort');
|
||||
@ -1321,7 +1321,7 @@ if ($resql) {
|
||||
$moreforfilter = '';
|
||||
|
||||
// If the user can view prospects other than his'
|
||||
if ($user->rights->societe->client->voir || $socid) {
|
||||
if ($user->rights->user->user->lire) {
|
||||
$langs->load("commercial");
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$tmptitle = $langs->trans('ThirdPartiesOfSaleRepresentative');
|
||||
@ -1479,7 +1479,7 @@ if ($resql) {
|
||||
// Payment term
|
||||
if (!empty($arrayfields['c.fk_cond_reglement']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
$form->select_conditions_paiements($search_fk_cond_reglement, 'search_fk_cond_reglement', -1, 1, 1);
|
||||
$form->select_conditions_paiements($search_fk_cond_reglement, 'search_fk_cond_reglement', 1, 1, 1);
|
||||
print '</td>';
|
||||
}
|
||||
// Payment mode
|
||||
@ -2032,7 +2032,7 @@ if ($resql) {
|
||||
// Payment terms
|
||||
if (!empty($arrayfields['c.fk_cond_reglement']['checked'])) {
|
||||
print '<td>';
|
||||
$form->form_conditions_reglement($_SERVER['PHP_SELF'], $obj->fk_cond_reglement, 'none');
|
||||
$form->form_conditions_reglement($_SERVER['PHP_SELF'], $obj->fk_cond_reglement, 'none', 0, '', 1, $obj->deposit_percent);
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
@ -2290,8 +2290,8 @@ if ($resql) {
|
||||
|
||||
// Note public
|
||||
if (!empty($arrayfields['c.note_public']['checked'])) {
|
||||
print '<td align="center" class="nowrap">';
|
||||
print dol_escape_htmltag($obj->note_public);
|
||||
print '<td class="center">';
|
||||
print dol_string_nohtmltag($obj->note_public);
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
@ -2300,8 +2300,8 @@ if ($resql) {
|
||||
|
||||
// Note private
|
||||
if (!empty($arrayfields['c.note_private']['checked'])) {
|
||||
print '<td align="center" class="nowrap">';
|
||||
print dol_escape_htmltag($obj->note_private);
|
||||
print '<td class="center">';
|
||||
print dol_string_nohtmltag($obj->note_private);
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
|
||||
@ -214,7 +214,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
||||
$search_thirdparty_user = '';
|
||||
$search_num_releve = '';
|
||||
$search_conciliated = '';
|
||||
$toselect = '';
|
||||
$toselect = array();
|
||||
|
||||
$search_account = "";
|
||||
if ($id > 0 || !empty($ref)) {
|
||||
|
||||
@ -165,7 +165,7 @@ class PaymentVarious extends CommonObject
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
public function __construct($db)
|
||||
public function __construct(DoliDB $db)
|
||||
{
|
||||
$this->db = $db;
|
||||
$this->element = 'payment_various';
|
||||
|
||||
@ -52,11 +52,12 @@ if (!empty($conf->salaries->enabled)) {
|
||||
|
||||
|
||||
$id = GETPOST('rowid', 'int');
|
||||
$accountid = (GETPOST('id', 'int') ? GETPOST('id', 'int') : GETPOST('account', 'int'));
|
||||
$rowid = GETPOST("rowid", 'int');
|
||||
$accountoldid = GETPOST('account', 'int'); // GETPOST('account') is old account id
|
||||
$accountid = GETPOST('accountid', 'int'); // GETPOST('accountid') is new account id
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$rowid = GETPOST("rowid", 'int');
|
||||
$orig_account = GETPOST("orig_account");
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
$cancel = GETPOST('cancel', 'alpha');
|
||||
@ -69,7 +70,7 @@ if ($user->socid) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
|
||||
$result = restrictedArea($user, 'banque', $accountid, 'bank_account');
|
||||
$result = restrictedArea($user, 'banque', $accountoldid, 'bank_account');
|
||||
if (empty($user->rights->banque->lire) && empty($user->rights->banque->consolidate)) {
|
||||
accessforbidden();
|
||||
}
|
||||
@ -124,18 +125,26 @@ if ($user->rights->banque->modifier && $action == "update") {
|
||||
$error = 0;
|
||||
|
||||
$acline = new AccountLine($db);
|
||||
$acline->fetch($rowid);
|
||||
$result = $acline->fetch($rowid);
|
||||
if ($result <= 0) {
|
||||
dol_syslog('Failed to read bank line with id '.$rowid, LOG_WARNING); // This happens due to old bug that has set fk_account to null.
|
||||
$acline->id = $rowid;
|
||||
}
|
||||
|
||||
$acsource = new Account($db);
|
||||
$acsource->fetch($id);
|
||||
$acsource->fetch($accountoldid);
|
||||
|
||||
$actarget = new Account($db);
|
||||
if (GETPOST('accountid', 'int') > 0 && !$acline->rappro && !$acline->getVentilExportCompta()) { // We ask to change bank account
|
||||
$actarget->fetch(GETPOST('accountid', 'int'));
|
||||
} else {
|
||||
$actarget->fetch($id);
|
||||
$actarget->fetch($accountoldid);
|
||||
}
|
||||
|
||||
if (!($actarget->id > 0)) {
|
||||
setEventMessages($langs->trans("ErrorFailedToLoadBankAccount"), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if ($actarget->courant == Account::TYPE_CASH && GETPOST('value', 'alpha') != 'LIQ') {
|
||||
setEventMessages($langs->trans("ErrorCashAccountAcceptsOnlyCashMoney"), null, 'errors');
|
||||
$error++;
|
||||
@ -229,7 +238,7 @@ if ($user->rights->banque->consolidate && ($action == 'num_releve' || $action ==
|
||||
$db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."bank";
|
||||
$sql .= " SET num_releve=".($num_rel ? "'".$db->escape($num_rel)."'" : "null");
|
||||
$sql .= " SET num_releve = ".($num_rel ? "'".$db->escape($num_rel)."'" : "null");
|
||||
if (empty($num_rel)) {
|
||||
$sql .= ", rappro = 0";
|
||||
} else {
|
||||
@ -307,7 +316,6 @@ if ($result) {
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<input type="hidden" name="orig_account" value="'.$orig_account.'">';
|
||||
print '<input type="hidden" name="account" value="'.$acct->id.'">';
|
||||
print '<input type="hidden" name="id" value="'.$acct->id.'">';
|
||||
|
||||
print dol_get_fiche_head($head, 'bankline', $langs->trans('LineRecord'), 0, 'accountline', 0);
|
||||
|
||||
@ -326,11 +334,12 @@ if ($result) {
|
||||
// Bank account
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("Account").'</td>';
|
||||
print '<td>';
|
||||
if (!$objp->rappro && !$bankline->getVentilExportCompta()) {
|
||||
print img_picto('', 'bank_account', 'class="paddingright"');
|
||||
print $form->select_comptes($acct->id, 'accountid', 0, '', 0, '', 0, '', 1);
|
||||
} else {
|
||||
// $objp->fk_account may be not > 0 if data was lost by an old bug. In such a case, we let a chance to user to fix it.
|
||||
if (($objp->rappro || $bankline->getVentilExportCompta()) && $objp->fk_account > 0) {
|
||||
print $acct->getNomUrl(1, 'transactions', 'reflabel');
|
||||
} else {
|
||||
print img_picto('', 'bank_account', 'class="paddingright"');
|
||||
print $form->select_comptes($acct->id, 'accountid', 0, '', ($acct->id > 0 ? $acct->id : 1), '', 0, '', 1);
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -534,7 +534,7 @@ foreach ($accounts as $key => $type) {
|
||||
|
||||
// Ref
|
||||
if (!empty($arrayfields['b.ref']['checked'])) {
|
||||
print '<td class="nowrap">'.$objecttmp->getNomUrl(1).'</td>';
|
||||
print '<td class="nowraponall">'.$objecttmp->getNomUrl(1).'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
@ -586,7 +586,7 @@ foreach ($accounts as $key => $type) {
|
||||
|
||||
// Accountancy journal
|
||||
if (!empty($arrayfields['b.fk_accountancy_journal']['checked'])) {
|
||||
print '<td>';
|
||||
print '<td class="tdoverflowmax125">';
|
||||
if (!empty($conf->accounting->enabled)) {
|
||||
if (empty($objecttmp->fk_accountancy_journal)) {
|
||||
print img_warning($langs->trans("Mandatory"));
|
||||
@ -606,7 +606,7 @@ foreach ($accounts as $key => $type) {
|
||||
|
||||
// Currency
|
||||
if (!empty($arrayfields['b.currency_code']['checked'])) {
|
||||
print '<td class="center">';
|
||||
print '<td class="center nowraponall">';
|
||||
print $objecttmp->currency_code;
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
@ -616,7 +616,7 @@ foreach ($accounts as $key => $type) {
|
||||
|
||||
// Transactions to reconcile
|
||||
if (!empty($arrayfields['toreconcile']['checked'])) {
|
||||
print '<td class="center">';
|
||||
print '<td class="center tdoverflowmax125">';
|
||||
|
||||
$conciliate = $objecttmp->canBeConciliated();
|
||||
if ($conciliate == -2) {
|
||||
@ -663,7 +663,7 @@ foreach ($accounts as $key => $type) {
|
||||
print $hookmanager->resPrint;
|
||||
// Date creation
|
||||
if (!empty($arrayfields['b.datec']['checked'])) {
|
||||
print '<td class="center">';
|
||||
print '<td class="center nowraponall">';
|
||||
print dol_print_date($objecttmp->date_creation, 'dayhour');
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
@ -672,7 +672,7 @@ foreach ($accounts as $key => $type) {
|
||||
}
|
||||
// Date modification
|
||||
if (!empty($arrayfields['b.tms']['checked'])) {
|
||||
print '<td class="center">';
|
||||
print '<td class="center nowraponall">';
|
||||
print dol_print_date($objecttmp->date_update, 'dayhour');
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
|
||||
@ -40,7 +40,6 @@ $socid = GETPOST("socid", "int");
|
||||
if ($user->socid) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
$result = restrictedArea($user, 'banque', '', '', '');
|
||||
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
|
||||
@ -173,6 +172,11 @@ $arrayfields = array(
|
||||
|
||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||
|
||||
$object = new PaymentVarious($db);
|
||||
|
||||
$result = restrictedArea($user, 'banque', '', '', '');
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
@ -271,19 +275,19 @@ if ($search_all) {
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
$totalnboflines = 0;
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$totalnboflines = $db->num_rows($result);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$totalnboflines = $db->num_rows($resql);
|
||||
}
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
// Direct jump if only one record found
|
||||
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all) {
|
||||
$obj = $db->fetch_object($result);
|
||||
$obj = $db->fetch_object($resql);
|
||||
$id = $obj->rowid;
|
||||
header("Location: ".DOL_URL_ROOT.'/compta/bank/various_payment/card.php?id='.$id);
|
||||
exit;
|
||||
@ -535,13 +539,13 @@ if ($result) {
|
||||
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'maxwidthsearch ');
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'maxwidthsearch center ');
|
||||
print '</tr>';
|
||||
|
||||
|
||||
$totalarray = array();
|
||||
while ($i < min($num, $limit)) {
|
||||
$obj = $db->fetch_object($result);
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$variousstatic->id = $obj->rowid;
|
||||
$variousstatic->ref = $obj->rowid;
|
||||
@ -652,7 +656,7 @@ if ($result) {
|
||||
if ($arrayfields['account']['checked']) {
|
||||
$accountingaccount->fetch('', $obj->accountancy_code, 1);
|
||||
|
||||
print '<td>'.$accountingaccount->getNomUrl(0, 1, 1, '', 1).'</td>';
|
||||
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->accountancy_code.' '.$obj->accountancy_label).'">'.$accountingaccount->getNomUrl(0, 1, 1, '', 1).'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
@ -660,7 +664,7 @@ if ($result) {
|
||||
|
||||
// Accounting subledger account
|
||||
if ($arrayfields['subledger']['checked']) {
|
||||
print '<td>'.length_accounta($obj->subledger_account).'</td>';
|
||||
print '<td class="tdoverflowmax150">'.length_accounta($obj->subledger_account).'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
@ -704,7 +708,7 @@ if ($result) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
print "</tr>";
|
||||
print '</tr>'."\n";
|
||||
|
||||
$i++;
|
||||
}
|
||||
@ -712,11 +716,27 @@ if ($result) {
|
||||
// Show total line
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
print '</form>';
|
||||
// If no record found
|
||||
if ($num == 0) {
|
||||
$colspan = 1;
|
||||
foreach ($arrayfields as $key => $val) {
|
||||
if (!empty($val['checked'])) {
|
||||
$colspan++;
|
||||
}
|
||||
}
|
||||
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
|
||||
}
|
||||
|
||||
$db->free($result);
|
||||
$db->free($resql);
|
||||
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print '</table>'."\n";
|
||||
print '</div>'."\n";
|
||||
|
||||
print '</form>'."\n";
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
@ -165,7 +165,7 @@ if (empty($reshook)) {
|
||||
$search[$key.'_dtend'] = '';
|
||||
}
|
||||
}
|
||||
$toselect = '';
|
||||
$toselect = array();
|
||||
$search_array_options = array();
|
||||
}
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
|
||||
|
||||
@ -121,7 +121,7 @@ class Deplacement extends CommonObject
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
public function __construct($db)
|
||||
public function __construct(DoliDB $db)
|
||||
{
|
||||
$this->db = $db;
|
||||
|
||||
|
||||
@ -158,7 +158,7 @@ if ($resql) {
|
||||
print '<input class="flat" type="text" size="1" maxlength="2" name="day" value="'.$day.'">';
|
||||
}
|
||||
print '<input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">';
|
||||
$formother->select_year($year ? $year : -1, 'year', 1, 20, 5);
|
||||
print $formother->selectyear($year ? $year : -1, 'year', 1, 20, 5);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" size="10" type="text" name="search_name" value="'.$search_name.'">';
|
||||
|
||||
@ -1695,7 +1695,20 @@ if ($action == 'create') {
|
||||
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
|
||||
|
||||
|
||||
print '</div></div>';
|
||||
print '</div>';
|
||||
print '<div class="fichehalfright">';
|
||||
|
||||
$MAXEVENT = 10;
|
||||
|
||||
//$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', dol_buildpath('/mymodule/myobject_agenda.php', 1).'?id='.$object->id);
|
||||
|
||||
// List of actions on element
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
|
||||
$formactions = new FormActions($db);
|
||||
$somethingshown = $formactions->showactions($object, $object->element, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlcenter);
|
||||
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -305,7 +305,7 @@ if (empty($reshook)) {
|
||||
$object->fetch($id);
|
||||
|
||||
if (!empty($conf->global-> INVOICE_CHECK_POSTERIOR_DATE)) {
|
||||
$last_of_type = $object->willBeLastOfSameType();
|
||||
$last_of_type = $object->willBeLastOfSameType(true);
|
||||
if (empty($object->date_validation) && !$last_of_type[0]) {
|
||||
setEventMessages($langs->transnoentities("ErrorInvoiceIsNotLastOfSameType", $object->ref, dol_print_date($object->date, 'day'), dol_print_date($last_of_type[1], 'day')), null, 'errors');
|
||||
$action = '';
|
||||
@ -1994,6 +1994,13 @@ if (empty($reshook)) {
|
||||
foreach ($object->lines as $line) {
|
||||
$result = $object->updateline($line->id, $line->desc, $line->subprice, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit, $line->multicurrency_subprice);
|
||||
}
|
||||
} elseif ($action == 'addline' && GETPOST('submitforalllines', 'alpha') && GETPOST('remiseforalllines', 'alpha') !== '' && $usercancreate) {
|
||||
// Define vat_rate
|
||||
$remise_percent = (GETPOST('remiseforalllines') ? GETPOST('remiseforalllines') : 0);
|
||||
$remise_percent = str_replace('*', '', $remise_percent);
|
||||
foreach ($object->lines as $line) {
|
||||
$result = $object->updateline($line->id, $line->desc, $line->subprice, $line->qty, $remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit, $line->multicurrency_subprice);
|
||||
}
|
||||
} elseif ($action == 'addline' && $usercancreate) { // Add a new line
|
||||
$langs->load('errors');
|
||||
$error = 0;
|
||||
@ -3280,10 +3287,21 @@ if ($action == 'create') {
|
||||
'variable' => $langs->transnoentitiesnoconv('VarAmountOneLine', $langs->transnoentitiesnoconv('Deposit')),
|
||||
'variablealllines' => $langs->transnoentitiesnoconv('VarAmountAllLines')
|
||||
);
|
||||
print $form->selectarray('typedeposit', $arraylist, GETPOST('typedeposit', 'aZ09'), 0, 0, 0, '', 1);
|
||||
$typedeposit = GETPOST('typedeposit', 'aZ09');
|
||||
$valuedeposit = GETPOST('valuedeposit', 'int');
|
||||
if (empty($typedeposit) && ! empty($objectsrc->deposit_percent)) {
|
||||
$origin_payment_conditions_deposit_percent = getDictionaryValue('c_payment_term', 'deposit_percent', $objectsrc->cond_reglement_id);
|
||||
if (! empty($origin_payment_conditions_deposit_percent)) {
|
||||
$typedeposit = 'variable';
|
||||
}
|
||||
}
|
||||
if (empty($valuedeposit) && $typedeposit == 'variable' && ! empty($objectsrc->deposit_percent)) {
|
||||
$valuedeposit = $objectsrc->deposit_percent;
|
||||
}
|
||||
print $form->selectarray('typedeposit', $arraylist, $typedeposit, 0, 0, 0, '', 1);
|
||||
print '</td>';
|
||||
print '<td class="nowrap" style="padding-left: 5px">';
|
||||
print '<span class="opacitymedium paddingleft">'.$langs->trans("AmountOrPercent").'</span><input type="text" id="valuedeposit" name="valuedeposit" class="width75 right" value="'.GETPOST('valuedeposit', 'int').'"/>';
|
||||
print '<span class="opacitymedium paddingleft">'.$langs->trans("AmountOrPercent").'</span><input type="text" id="valuedeposit" name="valuedeposit" class="width75 right" value="'.$valuedeposit.'"/>';
|
||||
print '</td>';
|
||||
}
|
||||
print '</tr></table>';
|
||||
|
||||
@ -451,7 +451,8 @@ class Invoices extends DolibarrApi
|
||||
$request_data->fk_unit,
|
||||
$request_data->multicurrency_subprice,
|
||||
0,
|
||||
$request_data->ref_ext
|
||||
$request_data->ref_ext,
|
||||
$request_data->rang
|
||||
);
|
||||
|
||||
if ($updateRes > 0) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user