Merge branch 'Dolibarr:develop' into SELECT_PRODUITS_LIST
This commit is contained in:
commit
ad0e0833b9
298
ChangeLog
298
ChangeLog
@ -24,216 +24,194 @@ For users:
|
||||
---------------
|
||||
|
||||
NEW: Minimal PHP version is now PHP 7.0 instead of PHP 5.6
|
||||
NEW: #19680 Add option PRODUCT_ALLOW_EXTERNAL_DOWNLOAD to automatically have uploaded files shared publicly by a link
|
||||
NEW: #21780 Add pid field to Cronjob class and store PID on job execution
|
||||
NEW: #20650 can move the checkbox column on left (experimental option MAIN_CHECKBOX_LEFT_COLUMN)
|
||||
NEW: #21000 Added columns 'alias_name' on project, supplier invoice, supplier order, supplier proposals and task list
|
||||
NEW: #21780 Add pid field to Cronjob class and store PID on job execution
|
||||
NEW: #21395 Added option for dark theme mode in display - color and theme
|
||||
NEW: #21397 added option to auto define barcode numbers for third-parties in barcode module setup
|
||||
NEW: #21399 add image for event_array
|
||||
NEW: #21399
|
||||
NEW: #21442 Enhancement of module builder init
|
||||
NEW: #21654 add bank account number used on invoices for debit
|
||||
NEW: #22048 added notes to productlot module
|
||||
NEW: #22048 Added notes to productlot module
|
||||
NEW: #22298 Bank - Add salaries & vat in the tab of planned entries of a bank account
|
||||
NEW: #22328 OAuth admin
|
||||
NEW: #22424 online signature for contracts
|
||||
NEW: #22328
|
||||
NEW: #22424
|
||||
NEW: #22500 member module set up made easier
|
||||
NEW: #22527 projects and thirdparties can be viewed as conversation ("Message" view), like events/agenda.
|
||||
NEW: #22546 can now set user supervisors using mass action in htdocs/user
|
||||
NEW: #22594 can chose if VAT ID is unique or not for third parties
|
||||
NEW: #22622 all partnerships displayed on tab partnership of a thirdparty and member
|
||||
NEW: #22676 massaction for updating product prices
|
||||
NEW: #22735 massaction to affect users on projects
|
||||
NEW: #25594 can chose if VAT ID is unique or not for third parties
|
||||
NEW: #22735 Massaction to assign users on projects
|
||||
NEW: #4482 adding js to hide/show advanced option on the export data page
|
||||
|
||||
NEW: Accountancy - Add a graphic option to enable lettering function - FPC21
|
||||
NEW: Accountancy - Add a way to clean some words when you generate thirdparty accounting account
|
||||
NEW: Accountancy - Added an option during export to export or not the lettering FPC21
|
||||
NEW: Accountancy - Manage supplier deposit with specific account
|
||||
NEW: Accountancy - Model Digitaria - Add a way to clean some words when you generate thirdparty accounting account FPC22
|
||||
NEW: Add a button "Test collect" in email collector
|
||||
NEW: Add a constant to disallow modification of the product reference.
|
||||
NEW: Add a method doAutoRenewContracts that can be used as a cron task.
|
||||
NEW: Add " as enclosure by default for CSV export. Keep removing CR/LF.
|
||||
NEW: add attached file in presend email form of thirdparty card
|
||||
NEW: Add a way to enter LICENSE file content in property of website
|
||||
NEW: Add badge in admin extrafields setup
|
||||
NEW: add constant PROPAL_BYPASS_VALIDATED_STATUS
|
||||
NEW: Add date event (!= date project) and location on event organization
|
||||
NEW: Add employment anniversary in birthday box
|
||||
NEW: Add extrafield type "IP" to store IP addresses
|
||||
NEW: Add fail2ban rules examples to limit access to /public pages
|
||||
NEW: Add filter "Product subject to lot/Serial" in stock per lot/serial
|
||||
NEW: Add hidden option MAIN_EMAIL_SUPPORT_ACK to restore Email ack checkbox (feature abandonned by mailers)
|
||||
NEW: Add IMAP port setting on email collector module
|
||||
NEW: Adding JAPAN Chart-of-Account and regions/departments
|
||||
NEW: Adding NIF verification for Algeria
|
||||
NEW: Add link to create an element from the category page
|
||||
NEW: add margin infos to takepos invoice lines
|
||||
NEW: Add max size send for "backup and link to mail" option
|
||||
NEW: Add method httponly_accessforbidden()
|
||||
NEW: Add more advices into the Setup security page
|
||||
NEW: Add new global variable for keeping the previous signature information on proposale (case of reopen a proposale)
|
||||
NEW: Add new global variable for keeping the previous signature information on proposal (case of reopening a proposal)
|
||||
NEW: Add objectLink on shipment
|
||||
NEW: Add option --force on CLI cron_run_jobs.php
|
||||
NEW: Add option "Show price on the generated documents for receptions"
|
||||
NEW: Add performance index (name for company and contact) and llx_bank_url(url_id)
|
||||
NEW: Add picto property on sub-module for password generation
|
||||
NEW: add redirect on action confirm addconsumedline and addproduceline
|
||||
NEW: Add a new advanced permission "read price"
|
||||
NEW: Add substitution key __SENDEREMAIL_SIGNATURE__
|
||||
NEW: Add the referrer-policy to "same-origin" by default on all public pages.
|
||||
NEW: Add the SMTP header References on ticket email created by email
|
||||
NEW: Add the thirdparty column to the time list (projet/tasks/time.php)
|
||||
NEW: Add trigger to record the event of sending an email from a project #20912
|
||||
NEW: Allow download link option in module configuration (propal,invoice,supplier proposal, order)
|
||||
NEW: Bulk action to remove a category in list/search website pages
|
||||
NEW: Can copy/paste images into emails sent.
|
||||
NEW: Can edit label of an emailing even once sent
|
||||
NEW: Can edit property css, cssview, csslist on extrafields
|
||||
NEW: Can enter the unit price including the vat when adding new product lines on invoices, orders, proposals, ...
|
||||
NEW: Can invoice task time per different services
|
||||
NEW: Can join several files by default on email form
|
||||
NEW: Can send an email on scheduled job error
|
||||
NEW: Can set a commercial discount by entering amount including VAT
|
||||
NEW: Can set a monthly frequency (or multiple) in cron tasks.
|
||||
NEW: Can set start and end dates and comment on button "Activate all services"
|
||||
NEW: Can sort on preselected best supplier price
|
||||
NEW: Can use products categories to make inventory
|
||||
NEW: Change filter type on tickets list into a multiselect combo
|
||||
NEW: conf TIMESPENT_ALWAYS_UPDATE_THM, when it's on we always check current thm of user to update it in task time line
|
||||
NEW: constant PROPAL_NEW_AS_SIGNED
|
||||
NEW: show date delivery planned on orders linked to company and product
|
||||
NEW: Default doc template of contracts is not mandatory
|
||||
NEW: Default values in extrafields are no more limited to 255 char.
|
||||
NEW: display currency in takepos menu
|
||||
NEW: Enable online signature for interventions
|
||||
NEW: extrafield price with currency
|
||||
NEW: filter on reception dates (from / to) in cheque paiement card
|
||||
NEW: Members: default_lang for members
|
||||
NEW: Members: Table of membership types
|
||||
NEW: Members: add free membership amounts at the membership type level
|
||||
NEW: TakePOS: Header Scroll in TakePOS
|
||||
NEW: TakePOS: add price to product box in TakePOS
|
||||
NEW: TakePOS: add setup parameters, can setup terminal name
|
||||
NEW: TakePOS: support of Stripe Terminal with TakePOS
|
||||
NEW: TakePOS: Receipt preview in TakePOS setup
|
||||
NEW: TakePOS: different product list on smartphone
|
||||
NEW: Website: can delete a whole website if disabled
|
||||
NEW: Website: can remove a website template
|
||||
NEW: Website: can set header "Strict-Transport-Security" in web sites.
|
||||
NEW: Website: can switch status of website and page from the website toolbar
|
||||
NEW: Website: Templates of websites are now directories and not zip into core repo
|
||||
NEW: Website: add 4 other templates in website module
|
||||
NEW: Website: Add counters for public access of pages on a website
|
||||
NEW: If we select another view list mode, we keep it
|
||||
NEW: Init module bookcal
|
||||
NEW: Encrypt all sensitive constants in llx_const using dolEncrypt/dolDecrypt
|
||||
NEW: Invoice - Add french mention on pdf when vat debit option is on
|
||||
NEW: invoice export : add accounting affectation
|
||||
NEW: label on products categories filter
|
||||
NEW: The link "add to bookmark" is always on top in the bookmark popup
|
||||
NEW: MAIN_SEARCH_CATEGORY_PRODUCT_ON_LISTS const to show category customer filter
|
||||
NEW: Make module WebservicesClient deprecated. Use module WebHook instead.
|
||||
NEW: manage no email with thirdparties (better for GDPR)
|
||||
NEW: Manage Position (Rank) on Contract Lines
|
||||
NEW: Manage VAT on all lines on purchases cycle
|
||||
NEW: Page to show virtual stock at a future date
|
||||
NEW: On a bank reconciled line, we can modify the bank receipt
|
||||
NEW: On a form to send an email, we show all emails of all contacts of object
|
||||
NEW: Option PRODUCTBATCH_SHOW_WAREHOUSE_ON_SHIPMENT showing wh on PDF
|
||||
NEW: Option PRODUIT_DESC_IN_FORM accept (desktop only or +smartphone)
|
||||
NEW: Page for mass stock transfer can be used with no source stock
|
||||
NEW: parent company column and filter in invoice and order list
|
||||
NEW: private and public note columns on user, thirdparty and contact lists
|
||||
NEW: Public counters feature
|
||||
NEW: Add "Show Sales rep" option for PDF
|
||||
NEW: Picto for shared link is clickable
|
||||
NEW: possibility to select scopes with checkbox for Oauth tokens
|
||||
NEW: private and public note on user, thirdparty and contact list
|
||||
NEW: product categories filter on inventory list
|
||||
NEW: Product supplier price: autofill default supplier VAT
|
||||
NEW: Project - author field become an available column on lists
|
||||
NEW: Reception - Add a from/to on search on date field
|
||||
NEW: Start a simple support of recurrent events on agenda
|
||||
NEW: Resize parent company column in order list
|
||||
NEW: Saved token of OAUTH module are now encrypted into llx_oauth_token
|
||||
NEW: Save one click to select on delivery ack, on emails.
|
||||
NEW: scheduled job to send unpaid invoice reminder can now use the cc and bcc from email template
|
||||
NEW: set thirdparty type with company modify trigger
|
||||
NEW: Show also scheduled task never finished in scheduled task widget
|
||||
NEW: show badge with number of extrafields in setup
|
||||
NEW: show category tree in sellist and chkbxlst for common object
|
||||
NEW: Show picto and color into combo for selection of tags
|
||||
NEW: show product label on inventory
|
||||
NEW: show sell-by and eat-by dates only if not empty
|
||||
NEW: show SellBy/EatBy dates for each batch product in shipment card
|
||||
NEW: Can skip accept/refuse steps for proposals (option PROPAL_SKIP_ACCEPT_REFUSE)
|
||||
NEW: experimental SMTP using PhpImap allowing OAuth2 authentication (need to add option MAIN_IMAP_USE_PHPIMAP)
|
||||
NEW: can substitue project title in mail template
|
||||
NEW: Supplier order list - Add column private and public note
|
||||
NEW: The purge of files can purge only if older than a number of seconds
|
||||
NEW: Update ActionComm type_code on email message ticket
|
||||
NEW: VAT - Admin - Add information on deadline day for submission of VAT declaration
|
||||
NEW: expand/collapse permissions on user permission page
|
||||
NEW: Show delivery mode on PDF for proposals
|
||||
NEW: Add the target to select attendees of event for emailings
|
||||
NEW: add redirect on action confirm addconsumedline and addproduceline
|
||||
NEW: Add the referrer-policy to "same-origin" by default on all public pages.
|
||||
NEW: Add trigger to record the event of sending an email from a project #20912
|
||||
NEW: Allow download link option in module configuration (propal, order, invoice, supplier proposal)
|
||||
NEW: Can enter the unit price including the VAT
|
||||
NEW: Can invoice task time per different services
|
||||
NEW: Can set a commercial discount by entering amount including VAT
|
||||
NEW: Can set start and end dates and comment on button "Activate all services"
|
||||
NEW: show date delivery planned on orders linked to company and product
|
||||
NEW: filter on reception dates (from / to) in cheque paiement card
|
||||
|
||||
NEW: Accountancy - add a graphic option to enable lettering function - FPC21
|
||||
NEW: Accountancy - add a way to clean some words when you generate thirdparty accounting account
|
||||
NEW: Accountancy - added an option during export to export or not the lettering FPC21
|
||||
NEW: Accountancy - Invoice export : add accounting affectation
|
||||
NEW: Accountancy - Manage supplier deposit with specific account
|
||||
NEW: Accountancy - Model Digitaria - Add a way to clean some words when you generate thirdparty accounting account FPC22
|
||||
NEW: Agenda - start a simple support of recurrent events on agenda
|
||||
NEW: Bank - add salaries & VAT in tab planned entries
|
||||
NEW: Bank - on a bank reconciled line, we can modify the bank receipt
|
||||
NEW: Contracts - add a method doAutoRenewContracts that can be used as a cron task
|
||||
NEW: Contracts - default template of contract is not mandatory
|
||||
NEW: Contracts - Manage Position (Rank) on Contract Lines
|
||||
NEW: EMail - can copy/paste images into emails sent
|
||||
NEW: EMail - can edit label of an emailing even once sent
|
||||
NEW: EMail - can join several files by default on email form
|
||||
NEW: EMail - can send an email on scheduled job error
|
||||
NEW: EMail - on a form to send an email, we show all emails of all contacts of object
|
||||
NEW: EMail - add the SMTP header References on ticket email created by email
|
||||
NEW: EMail - add substitution key __SENDEREMAIL_SIGNATURE__
|
||||
NEW: EMail - experimental SMTP using PhpImap allowing OAuth2 authentication (need to add option MAIN_IMAP_USE_PHPIMAP)
|
||||
NEW: EMail-Collector - add IMAP port setting
|
||||
NEW: EMail-Collector - add a button "Test collect"
|
||||
NEW: Event-Organization - add date event (!= date project) and location on event organization
|
||||
NEW: Expedition - add objectLink on expedition
|
||||
NEW: Export - Add " as enclosure by default for CSV export. Keep removing CR/LF.
|
||||
NEW: Extrafields - add badge in admin extrafields setup
|
||||
NEW: Extrafields - can edit property css, cssview, csslist on extrafields
|
||||
NEW: Extrafields - default values in extrafields are not more limited to 255 char.
|
||||
NEW: Extrafields - field price with currency
|
||||
NEW: Extrafields - support IP type to store IP addresses
|
||||
NEW: Finance - VAT - Admin - Add information on deadline day for submission of VAT declaration
|
||||
NEW: Interventions - enable online signature for interventions
|
||||
NEW: Invoice - add french mention on PDF when VAT debit option is on
|
||||
NEW: Members - default_lang for members
|
||||
NEW: Members - table of membership types
|
||||
NEW: Members - add free membership amounts at the membership type level
|
||||
NEW: OAuth - possibility to select scopes with checkbox for OAuth tokens
|
||||
NEW: OAuth - saved token of OAUTH module are now encrypted into llx_oauth_token
|
||||
NEW: Orders - resize parent company column in order list
|
||||
NEW: Products - Categories - label on products categories filter
|
||||
NEW: Products - Supplier price - autofill default supplier VAT
|
||||
NEW: Products - Supplier price - can sort and preselected best supplier price
|
||||
NEW: Projects - add author on list
|
||||
NEW: Projects - add thirdparty column to the time list (projet/tasks/time.php)
|
||||
NEW: Proposals - show delivery mode on PDF for proposals
|
||||
NEW: Proposals - skip accept/refuse process for proposals (option PROPAL_SKIP_ACCEPT_REFUSE)
|
||||
NEW: Reception - add a from/to on search on date field
|
||||
NEW: Stock - page for mass stock transfer can be used with no source stock
|
||||
NEW: Stock - product categories filter on inventory list
|
||||
NEW: Stock - show product label on inventory
|
||||
NEW: Stock - manage virtual stock at a future date
|
||||
NEW: Stock Inventory - add filter "Product subject to lot/Serial" in stock per lot/serial
|
||||
NEW: Stock Inventory - can use products categories to make inventory
|
||||
NEW: Supplier Order List - add column private and public note
|
||||
NEW: TakePOS - add margin infos to TakePOS invoice lines
|
||||
NEW: TakePOS - add price to product box in TakePOS
|
||||
NEW: TakePOS - add setup parameters, can setup terminal name
|
||||
NEW: TakePOS - different product list on smartphone
|
||||
NEW: TakePOS - display currency in TakePOS menu
|
||||
NEW: TakePOS - Header Scroll in TakePOS
|
||||
NEW: TakePOS - Receipt preview in TakePOS setup
|
||||
NEW: TakePOS - support of Stripe Terminal with TakePOS
|
||||
NEW: Thirdparty - manage no email with thirdparties (better for GDPR)
|
||||
NEW: Thirdparty - set thirdparty type with company modify trigger
|
||||
NEW: Tickets - change filter type on tickets list into a multiselect combo
|
||||
NEW: Tickets - add oldcopy to Ticket so triggers intercepting TICKET_MODIFY have access to old values of the updated properties
|
||||
NEW: Website - can delete a whole website if disabled
|
||||
NEW: Website - can remove a website template
|
||||
NEW: Website - can set header "Strict-Transport-Security" in web sites.
|
||||
NEW: Website - can switch status of website and page from the website toolbar
|
||||
NEW: Website - Templates of websites are now directories and not zip into core repo
|
||||
NEW: Website - add 4 other templates in website module
|
||||
|
||||
General:
|
||||
NEW: Actions: Bulk action to remove a category in list/search website pages
|
||||
NEW: Cronjobs: can set a monthly frequency (or multiple) in cron tasks
|
||||
NEW: Database: Encrypt all sensitive constants in llx_const
|
||||
NEW: Database: Add performance index (name for company and contact) and llx_bank_url(url_id)
|
||||
NEW: Database: Introduce dolEncrypt and dolDecrypt to be able to encrypt data in db
|
||||
NEW: GUI: If we select another view list mode, we keep it
|
||||
NEW: GUI: the link "add to bookmark" is always on top in the bookmark popup
|
||||
NEW: GUI: Picto for shared link is clickable
|
||||
NEW: GUI: add picto property on sub-module for password generation
|
||||
NEW: GUI: show also scheduled task never finished in scheduled task widget
|
||||
NEW: GUI: show badge with number of extrafields in setup
|
||||
NEW: GUI: show category tree in sellist and chkbxlst for common object
|
||||
NEW: GUI: show picto and color into combo for selection of tags
|
||||
NEW: GUI: show sell-by and eat-by dates only if not empty
|
||||
NEW: GUI: show SellBy/EatBy dates for each batch product in shipment card
|
||||
NEW: GUI/Permissions: expand/collapse permissions on user permission page
|
||||
NEW: Permissions: add a new advanced permission "read price"
|
||||
NEW: Print: add show "Sales rep" option for PDF
|
||||
NEW: Security: add fail2ban rules examples to limit access to /public pages
|
||||
|
||||
Option / Const for System:
|
||||
NEW: FICHINTER_ALLOW_EXTERNAL_DOWNLOAD
|
||||
NEW: MAIN_CHECKBOX_LEFT_COLUMN
|
||||
NEW: MAIN_EMAIL_SUPPORT_ACK
|
||||
NEW: MAIN_IMAP_USE_PHPIMAP
|
||||
NEW: MAIN_SEARCH_CATEGORY_PRODUCT_ON_LISTS - const to show category customer filter
|
||||
NEW: PRODUCT_ALLOW_EXTERNAL_DOWNLOAD
|
||||
NEW: PRODUCTBATCH_SHOW_WAREHOUSE_ON_SHIPMENT - showing warehouse on PDF
|
||||
NEW: PRODUIT_DESC_IN_FORM accept - desktop only or +smartphone
|
||||
NEW: PROPAL_BYPASS_VALIDATED_STATUS
|
||||
NEW: PROPAL_NEW_AS_SIGNED
|
||||
NEW: PROPAL_SKIP_ACCEPT_REFUSE
|
||||
NEW: TIMESPENT_ALWAYS_UPDATE_THM - when it's on we always check current thm of user to update it in task time line
|
||||
|
||||
Localisation:
|
||||
NEW: adding JAPAN Chart-of-Account and regions/departments
|
||||
NEW: adding NIF verification for Algeria
|
||||
NEW: Can set background style with MAIN_LOGIN_BACKGROUND_STYLE
|
||||
|
||||
Modules
|
||||
NEW: Experimental module Asset
|
||||
NEW: Init module bookcal
|
||||
NEW: Make module WebservicesClient deprecated. Use module WebHook instead.
|
||||
|
||||
|
||||
For developers or integrators:
|
||||
------------------------------
|
||||
|
||||
NEW: ModuleBuilder can generate code of class from an existing SQL table
|
||||
NEW: ModuleBuilder can generate code for a class from an existing SQL table
|
||||
NEW: #22370 Modulebuilder supports 'alwayseditable' (like extrafields)
|
||||
NEW: #20912 Add trigger to record the event of sending an email from a project
|
||||
NEW: #21750 Added "Get lines and Post lines from BOM" at the REST Service
|
||||
NEW: #22370 Modulebuilder supports 'alwayseditable' (like extrafields)
|
||||
NEW: Removed completely the need for the library adodbtime
|
||||
NEW: hook on agenda pages
|
||||
NEW: hook to complete payment in TakePOS
|
||||
NEW: hook "changeHelpURL" to modify target of the help button
|
||||
NEW: hook formConfirm on action comm card
|
||||
NEW: hook to modify supplier product html select
|
||||
NEW: Add new hook for show virtual stock details on product stock card
|
||||
NEW: Add new hooks for actioncomm
|
||||
NEW: conf->global->SYSLOG_FILE_ONEPERSESSION accept a string
|
||||
NEW: All ajax pages have now a top_httphead()
|
||||
|
||||
API:
|
||||
NEW: translation for contact type API, setup/ticket API, shipping method API
|
||||
NEW: All ajax pages have now a header build with top_httphead()
|
||||
NEW: support multilang in Civilities API
|
||||
NEW: Add API for the partnership module
|
||||
NEW: Add "Get lines and Post lines from BOM" in the API
|
||||
NEW: translate for contact type API, setup/ticket API, shipping method API
|
||||
NEW: support multilang in Civilities API
|
||||
|
||||
Hooks:
|
||||
NEW: Actioncomm - add new hooks for actioncomm
|
||||
NEW: Actioncomm - hook formConfirm on actioncomm card
|
||||
NEW: Agenda - hook on agenda pages
|
||||
NEW: Help - hook "changeHelpURL" to modify target of the help button
|
||||
NEW: Product - add hook to show virtual stock details on product stock card
|
||||
NEW: Product - add hook to modify supplier product html select
|
||||
NEW: TakePOS - add hook to complete payment in TakePOS
|
||||
|
||||
|
||||
NEW: Removed completely the need for the library adodbtime
|
||||
NEW: Replace fk_categories_product with categories_product in inventory
|
||||
NEW: Rewrite of SQL request. Removed the join on category (for filter on categ), replaced with a EXISTS/NOT
|
||||
NEW: Replace property fk_categories_product with categories_product in inventory class
|
||||
NEW: Rewrite of SQL request. Removed the join on category table (for filter on category), replaced with a EXISTS/NOT
|
||||
NEW: Add oldcopy to Ticket so triggers intercepting TICKET_MODIFY have access to old values of the updated properties
|
||||
NEW: #19680 Add option PRODUCT_ALLOW_EXTERNAL_DOWNLOAD to automatically have uploaded files shared publicly by a link
|
||||
NEW: Add option FICHINTER_ALLOW_EXTERNAL_DOWNLOAD
|
||||
|
||||
|
||||
WARNING:
|
||||
|
||||
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
|
||||
* Minimal PHP version is now PHP 7.0 instead of PHP 5.6
|
||||
* The signature of method getNomUrl() of class ProductFournisseur has been modified to match the signature of method Product
|
||||
* The signature of method getNomUrl() of class ProductFournisseur has been modified to match the signature of method Product->getNomUrl()
|
||||
* Trigger ORDER_SUPPLIER_DISPATCH is removed, use ORDER_SUPPLIER_RECEIVE and/or LINEORDER_SUPPLIER_DISPATCH instead.
|
||||
* All functions fetch_all() have been set to deprecated for naming consitency, use fetchAll() instead.
|
||||
* Code standardization: '$user->rights->propale' is now '$user->rights->propal' everywhere.
|
||||
@ -243,7 +221,7 @@ Following changes may create regressions for some external modules, but were nec
|
||||
* Rename the substitution for "project label" instead of "project title" in substitution variables
|
||||
* You must use "$objectoffield" to manipulate the current object inside the formulare of computed custom extrafields instead of $obj/$object.
|
||||
* Making a global search is sending the parameter using always the name search_all (instead of sometimes sall and search_all)
|
||||
|
||||
* The property $url_last_version must be public if defined into module descriptor files;
|
||||
|
||||
|
||||
***** ChangeLog for 16.0.4 compared to 16.0.3 *****
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||

|
||||

|
||||
[](https://php.net/)
|
||||
[](https://php.net/)
|
||||
[](https://github.com/Dolibarr/dolibarr)
|
||||
[](https://bestpractices.coreinfrastructure.org/projects/5521)
|
||||
|
||||
|
||||
@ -46,6 +46,7 @@ require_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php";
|
||||
|
||||
$includecustom=0;
|
||||
$includeconstants=array();
|
||||
$buildzip=0;
|
||||
|
||||
if (empty($argv[1])) {
|
||||
print "Usage: ".$script_file." release=autostable|auto[-mybuild]|x.y.z[-mybuild] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value] [buildzip=1]\n";
|
||||
@ -69,6 +70,9 @@ while ($i < $argc) {
|
||||
if (!empty($result["includeconstant"])) {
|
||||
$includeconstants[$i] = $result["includeconstant"];
|
||||
}
|
||||
if (!empty($result["buildzip"])) {
|
||||
$buildzip=1;
|
||||
}
|
||||
if (preg_match('/includeconstant=/', strval($argv[$i]))) {
|
||||
$tmp=explode(':', $result['includeconstant'], 3); // $includeconstant has been set with previous parse_str()
|
||||
if (count($tmp) != 3) {
|
||||
|
||||
@ -31,6 +31,7 @@ maxretry = 10
|
||||
[web-dol-limitpublic]
|
||||
|
||||
; rule to add rate limit on some public pages
|
||||
; note you must keep enough for public access like agenda export, emailing trackers, stripe ipn access, ...
|
||||
enabled = true
|
||||
port = http,https
|
||||
filter = web-dolibarr-limitpublic
|
||||
@ -38,5 +39,5 @@ logpath = /mypath/documents/documents/dolibarr.log
|
||||
action = %(action_mw)s
|
||||
bantime = 86400 ; 1 day
|
||||
findtime = 86400 ; 1 day
|
||||
maxretry = 500
|
||||
maxretry = 1000
|
||||
|
||||
|
||||
@ -719,7 +719,7 @@ if (count($sqlwhere) > 0) {
|
||||
// Export into a file with format defined into setup (FEC, CSV, ...)
|
||||
// Must be after definition of $sql
|
||||
if ($action == 'export_fileconfirm' && $user->hasRight('accounting', 'mouvements', 'export')) {
|
||||
// TODO Replace the fetchAll to get all ->line followed by call to ->export(). It consumes too much memory on large export.
|
||||
// TODO Replace the fetchAll to get all ->line followed by call to ->export(). It currently consumes too much memory on large export.
|
||||
// Replace this with the query($sql) and loop on each line to export them.
|
||||
$result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter, 'AND', (empty($conf->global->ACCOUNTING_REEXPORT) ? 0 : 1));
|
||||
|
||||
@ -729,6 +729,7 @@ if ($action == 'export_fileconfirm' && $user->hasRight('accounting', 'mouvements
|
||||
// Export files then exit
|
||||
$accountancyexport = new AccountancyExport($db);
|
||||
|
||||
$formatexport = GETPOST('formatexport', 'int');
|
||||
$notexportlettering = GETPOST('notexportlettering', 'alpha');
|
||||
|
||||
if (!empty($notexportlettering)) {
|
||||
@ -745,7 +746,7 @@ if ($action == 'export_fileconfirm' && $user->hasRight('accounting', 'mouvements
|
||||
$withAttachment = !empty(trim(GETPOST('notifiedexportfull', 'alphanohtml'))) ? 1 : 0;
|
||||
|
||||
// Output data on screen or download
|
||||
$result = $accountancyexport->export($object->lines, $formatexportset, $withAttachment);
|
||||
$result = $accountancyexport->export($object->lines, $formatexport, $withAttachment);
|
||||
|
||||
$error = 0;
|
||||
if ($result < 0) {
|
||||
@ -856,6 +857,17 @@ $formconfirm = '';
|
||||
if ($action == 'export_file') {
|
||||
$form_question = array();
|
||||
|
||||
$form_question['formatexport'] = array(
|
||||
'name' => 'formatexport',
|
||||
'type' => 'select',
|
||||
'label' => $langs->trans('Modelcsv'), // TODO Use Selectmodelcsv and show a select combo
|
||||
'values' => $listofformat,
|
||||
'default' => $formatexportset,
|
||||
'morecss' => 'minwidth200 maxwidth200'
|
||||
);
|
||||
|
||||
$form_question['separator0'] = array('name'=>'separator0', 'type'=>'separator');
|
||||
|
||||
if (getDolGlobalInt("ACCOUNTING_ENABLE_LETTERING")) {
|
||||
// If 1, we check by default.
|
||||
$checked = !empty($conf->global->ACCOUNTING_DEFAULT_NOT_EXPORT_LETTERING) ? 'true' : 'false';
|
||||
@ -866,7 +878,7 @@ if ($action == 'export_file') {
|
||||
'value' => $checked,
|
||||
);
|
||||
|
||||
$form_question['separator'] = array('name'=>'separator', 'type'=>'separator');
|
||||
$form_question['separator1'] = array('name'=>'separator1', 'type'=>'separator');
|
||||
}
|
||||
|
||||
// If 1 or not set, we check by default.
|
||||
@ -903,7 +915,7 @@ if ($action == 'export_file') {
|
||||
);
|
||||
}
|
||||
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', $langs->trans('ConfirmExportFile'), 'export_fileconfirm', $form_question, '', 1, 400, 600);
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans("ExportFilteredList").'...', $langs->trans('ConfirmExportFile'), 'export_fileconfirm', $form_question, '', 1, 420, 600);
|
||||
}
|
||||
|
||||
//if ($action == 'delbookkeepingyear') {
|
||||
@ -1362,7 +1374,7 @@ while ($i < min($num, $limit)) {
|
||||
$accountingjournal = new AccountingJournal($db);
|
||||
$result = $accountingjournal->fetch('', $line->code_journal);
|
||||
$journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $line->code_journal);
|
||||
print '<td class="center">'.$journaltoshow.'</td>';
|
||||
print '<td class="center tdoverflowmax150">'.$journaltoshow.'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@ -646,7 +646,7 @@ class AccountancyCategory // extends CommonObject
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as t";
|
||||
//if (in_array($this->db->type, array('mysql', 'mysqli'))) $sql.=' USE INDEX idx_accounting_bookkeeping_doc_date';
|
||||
$sql .= " WHERE t.entity = ".$conf->entity;
|
||||
$sql .= " WHERE t.entity = ".((int) $conf->entity);
|
||||
if (is_array($cpt)) {
|
||||
$sql .= " AND t.numero_compte IN (".$this->db->sanitize($listofaccount, 1).")";
|
||||
} else {
|
||||
|
||||
@ -1177,7 +1177,9 @@ class AccountancyExport
|
||||
print $line->code_journal . $separator;
|
||||
|
||||
// FEC:JournalLib
|
||||
print dol_string_unaccent($langs->transnoentities($line->journal_label)) . $separator;
|
||||
$labeljournal = dol_string_unaccent($langs->transnoentities($line->journal_label));
|
||||
$labeljournal = dol_string_nospecial($labeljournal, ' ');
|
||||
print $labeljournal . $separator;
|
||||
|
||||
// FEC:EcritureNum
|
||||
print $line->piece_num . $separator;
|
||||
@ -1308,7 +1310,9 @@ class AccountancyExport
|
||||
print $line->code_journal . $separator;
|
||||
|
||||
// FEC:JournalLib
|
||||
print dol_string_unaccent($langs->transnoentities($line->journal_label)) . $separator;
|
||||
$labeljournal = dol_string_unaccent($langs->transnoentities($line->journal_label));
|
||||
$labeljournal = dol_string_nospecial($labeljournal, ' ');
|
||||
print $labeljournal . $separator;
|
||||
|
||||
// FEC:EcritureNum
|
||||
print $line->piece_num . $separator;
|
||||
|
||||
@ -128,8 +128,8 @@ if ($action == 'validatehistory') {
|
||||
|
||||
// Now make the binding. Bind automatically only for product with a dedicated account that exists into chart of account, others need a manual bind
|
||||
// Customer Invoice lines (must be same request than into page list.php for manual binding)
|
||||
$sql = "SELECT f.rowid as facid, f.ref as ref, f.datef, f.type as ftype, f.fk_facture_source,";
|
||||
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
||||
$sql = "SELECT f.rowid as facid, f.ref as ref, f.datef, f.type as ftype, f.situation_cycle_ref, f.fk_facture_source,";
|
||||
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.situation_percent, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tva_tx as tva_tx_prod,";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
$sql .= " ppe.accountancy_code_sell as code_sell, ppe.accountancy_code_sell_intra as code_sell_intra, ppe.accountancy_code_sell_export as code_sell_export,";
|
||||
@ -312,6 +312,10 @@ print '<span class="opacitymedium">'.$langs->trans("DescVentilCustomer").'</span
|
||||
print '<span class="opacitymedium hideonsmartphone">'.$langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")).'<br>';
|
||||
print '</span><br>';
|
||||
|
||||
if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) {
|
||||
print info_admin($langs->trans("SorryThisModuleIsNotCompatibleWithTheExperimentalFeatureOfSituationInvoices"));
|
||||
print "<br>";
|
||||
}
|
||||
|
||||
$y = $year_current;
|
||||
|
||||
@ -386,6 +390,11 @@ if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
while ($row = $db->fetch_row($resql)) {
|
||||
// TODO When INVOICE_USE_SITUATION = 1, values here are wrong. There is no compensation on bad stored amounts
|
||||
//$situation_ratio = 1;
|
||||
//if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) {
|
||||
//}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>';
|
||||
if ($row[0] == 'tobind') {
|
||||
@ -519,6 +528,11 @@ if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
while ($row = $db->fetch_row($resql)) {
|
||||
// TODO When INVOICE_USE_SITUATION = 1, values here are wrong. There is no compensation on bad stored amounts
|
||||
//$situation_ratio = 1;
|
||||
//if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) {
|
||||
//}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>';
|
||||
if ($row[0] == 'tobind') {
|
||||
@ -630,7 +644,6 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa
|
||||
print "</table>\n";
|
||||
print '</div>';
|
||||
|
||||
|
||||
if (isModEnabled('margin')) {
|
||||
print "<br>\n";
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
@ -644,22 +657,41 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa
|
||||
print '<td width="60" class="right">'.$langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT)).'</td>';
|
||||
}
|
||||
print '<td width="60" class="right"><b>'.$langs->trans("Total").'</b></td></tr>';
|
||||
$sql = "SELECT '".$db->escape($langs->trans("Vide"))."' AS marge,";
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
|
||||
if ($j > 12) {
|
||||
$j -= 12;
|
||||
}
|
||||
$sql .= " SUM(".$db->ifsql("MONTH(f.datef)=".$j,
|
||||
" (".$db->ifsql("fd.total_ht < 0",
|
||||
" (-1 * (abs(fd.total_ht) - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100))))",
|
||||
" (fd.total_ht - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100)))").")",
|
||||
0).") AS month".str_pad($j, 2, '0', STR_PAD_LEFT).",";
|
||||
}
|
||||
$sql .= " SUM(".$db->ifsql("fd.total_ht < 0",
|
||||
" (-1 * (abs(fd.total_ht) - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100))))",
|
||||
" (fd.total_ht - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100)))").") as total";
|
||||
|
||||
if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) {
|
||||
// With old situation invoice setup
|
||||
$sql = "SELECT '".$db->escape($langs->trans("Vide"))."' AS marge,";
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
|
||||
if ($j > 12) {
|
||||
$j -= 12;
|
||||
}
|
||||
$sql .= " SUM(".$db->ifsql("MONTH(f.datef)=".$j,
|
||||
" (".$db->ifsql("fd.total_ht < 0",
|
||||
" (-1 * (abs(fd.total_ht) - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100))))", // TODO This is bugged, we must use the percent for the invoice and fd.situation_percent is cumulated percent !
|
||||
" (fd.total_ht - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100)))").")",
|
||||
0).") AS month".str_pad($j, 2, '0', STR_PAD_LEFT).",";
|
||||
}
|
||||
$sql .= " SUM(".$db->ifsql("fd.total_ht < 0",
|
||||
" (-1 * (abs(fd.total_ht) - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100))))", // TODO This is bugged, we must use the percent for the invoice and fd.situation_percent is cumulated percent !
|
||||
" (fd.total_ht - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100)))").") as total";
|
||||
} else {
|
||||
$sql = "SELECT '".$db->escape($langs->trans("Vide"))."' AS marge,";
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
|
||||
if ($j > 12) {
|
||||
$j -= 12;
|
||||
}
|
||||
$sql .= " SUM(".$db->ifsql("MONTH(f.datef)=".$j,
|
||||
" (".$db->ifsql("fd.total_ht < 0",
|
||||
" (-1 * (abs(fd.total_ht) - (fd.buy_price_ht * fd.qty)))",
|
||||
" (fd.total_ht - (fd.buy_price_ht * fd.qty))").")",
|
||||
0).") AS month".str_pad($j, 2, '0', STR_PAD_LEFT).",";
|
||||
}
|
||||
$sql .= " SUM(".$db->ifsql("fd.total_ht < 0",
|
||||
" (-1 * (abs(fd.total_ht) - (fd.buy_price_ht * fd.qty)))",
|
||||
" (fd.total_ht - (fd.buy_price_ht * fd.qty))").") as total";
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON f.rowid = fd.fk_facture";
|
||||
$sql .= " WHERE f.datef >= '".$db->idate($search_date_start)."'";
|
||||
|
||||
@ -189,8 +189,8 @@ print '<script type="text/javascript">
|
||||
/*
|
||||
* Customer Invoice lines
|
||||
*/
|
||||
$sql = "SELECT f.rowid as facid, f.ref as ref, f.type as ftype, f.datef, f.ref_client,";
|
||||
$sql .= " fd.rowid, fd.description, fd.product_type as line_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.vat_src_code, fd.total_ttc,";
|
||||
$sql = "SELECT f.rowid as facid, f.ref as ref, f.type as ftype, f.situation_cycle_ref, f.datef, f.ref_client,";
|
||||
$sql .= " fd.rowid, fd.description, fd.product_type as line_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.vat_src_code, fd.total_ttc, fd.situation_percent,";
|
||||
$sql .= " s.rowid as socid, s.nom as name, s.code_client,";
|
||||
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
|
||||
$sql .= " spe.accountancy_code_customer as code_compta_client,";
|
||||
@ -502,8 +502,33 @@ if ($result) {
|
||||
print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->description);
|
||||
print '</td>';
|
||||
|
||||
print '<td class="right nowraponall amount">'.price($objp->total_ht).'</td>';
|
||||
// Amount
|
||||
print '<td class="right nowraponall amount">';
|
||||
|
||||
// Create a compensation rate for old situation invoice feature.
|
||||
$situation_ratio = 1;
|
||||
if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) {
|
||||
if ($objp->situation_cycle_ref) {
|
||||
// Avoid divide by 0
|
||||
if ($objp->situation_percent == 0) {
|
||||
$situation_ratio = 0;
|
||||
} else {
|
||||
$line = new FactureLigne($db);
|
||||
$line->fetch($objp->rowid);
|
||||
|
||||
// Situation invoices handling
|
||||
$prev_progress = $line->get_prev_progress($objp->facid);
|
||||
|
||||
$situation_ratio = ($objp->situation_percent - $prev_progress) / $objp->situation_percent;
|
||||
}
|
||||
}
|
||||
print price($objp->total_ht * $situation_ratio);
|
||||
} else {
|
||||
print price($objp->total_ht);
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Vat rate
|
||||
print '<td class="right">'.vatrate($objp->tva_tx.($objp->vat_src_code ? ' ('.$objp->vat_src_code.')' : '')).'</td>';
|
||||
|
||||
// Thirdparty
|
||||
|
||||
@ -228,8 +228,8 @@ if (empty($chartaccountcode)) {
|
||||
}
|
||||
|
||||
// Customer Invoice lines
|
||||
$sql = "SELECT f.rowid as facid, f.ref, f.datef, f.type as ftype, f.fk_facture_source,";
|
||||
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
||||
$sql = "SELECT f.rowid as facid, f.ref, f.datef, f.type as ftype, f.situation_cycle_ref, f.fk_facture_source,";
|
||||
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.situation_percent, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tva_tx as tva_tx_prod,";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
$sql .= " ppe.accountancy_code_sell as code_sell, ppe.accountancy_code_sell_intra as code_sell_intra, ppe.accountancy_code_sell_export as code_sell_export,";
|
||||
@ -655,8 +655,30 @@ if ($result) {
|
||||
print $form->textwithtooltip(dol_trunc($text, $trunclength), $facture_static_det->desc);
|
||||
print '</td>';
|
||||
|
||||
// Amount
|
||||
print '<td class="right nowraponall amount">';
|
||||
print price($objp->total_ht);
|
||||
|
||||
// Create a compensation rate for old situation invoice feature.
|
||||
$situation_ratio = 1;
|
||||
if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) {
|
||||
if ($objp->situation_cycle_ref) {
|
||||
// Avoid divide by 0
|
||||
if ($objp->situation_percent == 0) {
|
||||
$situation_ratio = 0;
|
||||
} else {
|
||||
$line = new FactureLigne($db);
|
||||
$line->fetch($objp->rowid);
|
||||
|
||||
// Situation invoices handling
|
||||
$prev_progress = $line->get_prev_progress($objp->facid);
|
||||
|
||||
$situation_ratio = ($objp->situation_percent - $prev_progress) / $objp->situation_percent;
|
||||
}
|
||||
}
|
||||
print price($objp->total_ht * $situation_ratio);
|
||||
} else {
|
||||
print price($objp->total_ht);
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Vat rate
|
||||
|
||||
@ -83,12 +83,7 @@ $help_url = 'EN:Module_Double_Entry_Accounting#Setup';
|
||||
|
||||
llxHeader('', $langs->trans("AccountancyArea"), $help_url);
|
||||
|
||||
if (!empty($conf->global->INVOICE_USE_SITUATION) && $conf->global->INVOICE_USE_SITUATION == 1) {
|
||||
print load_fiche_titre($langs->trans("AccountancyArea"), '', 'accountancy');
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("SorryThisModuleIsNotCompatibleWithTheExperimentalFeatureOfSituationInvoices")."</span>\n";
|
||||
print "<br>";
|
||||
} elseif (isModEnabled('accounting')) {
|
||||
if (isModEnabled('accounting')) {
|
||||
$step = 0;
|
||||
|
||||
$resultboxes = FormOther::getBoxesArea($user, "27"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb)
|
||||
|
||||
@ -104,7 +104,7 @@ if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))
|
||||
}
|
||||
|
||||
$sql = "SELECT f.rowid, f.ref as ref, f.type, f.datef as df, f.libelle,f.ref_supplier, f.date_lim_reglement as dlr, f.close_code,";
|
||||
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.tva as total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.vat_src_code,";
|
||||
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.tva as total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.vat_src_code, fd.info_bits,";
|
||||
$sql .= " s.rowid as socid, s.nom as name, s.fournisseur, s.code_client, s.code_fournisseur,";
|
||||
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
|
||||
$sql .= " spe.accountancy_code_customer as code_compta,";
|
||||
@ -200,8 +200,8 @@ if ($result) {
|
||||
$def_tva[$obj->rowid][$compta_tva][vatrate($obj->tva_tx).($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : '')] = (vatrate($obj->tva_tx).($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : ''));
|
||||
}
|
||||
|
||||
$line = new SupplierInvoiceLine($db);
|
||||
$line->fetch($obj->fdid);
|
||||
//$line = new SupplierInvoiceLine($db);
|
||||
//$line->fetch($obj->fdid);
|
||||
|
||||
$tabfac[$obj->rowid]["date"] = $db->jdate($obj->df);
|
||||
$tabfac[$obj->rowid]["datereg"] = $db->jdate($obj->dlr);
|
||||
@ -233,7 +233,8 @@ if ($result) {
|
||||
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc;
|
||||
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht;
|
||||
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva;
|
||||
if (!empty($line->tva_npr)) { // Add an entry for counterpart
|
||||
$tva_npr = (($obj->info_bits & 1 == 1) ? 1 : 0);
|
||||
if ($tva_npr) { // If NPR, we add an entry for counterpartWe into tabother
|
||||
$tabother[$obj->rowid][$compta_counterpart_tva_npr] += $obj->total_tva;
|
||||
}
|
||||
$tablocaltax1[$obj->rowid][$compta_localtax1] += $obj->total_localtax1;
|
||||
@ -824,7 +825,6 @@ if (empty($action) || $action == 'view') {
|
||||
*/
|
||||
print '<br>';
|
||||
|
||||
$i = 0;
|
||||
print '<div class="div-table-responsive">';
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
print "<tr class=\"liste_titre\">";
|
||||
@ -837,7 +837,7 @@ if (empty($action) || $action == 'view') {
|
||||
print '<td class="center">'.$langs->trans("AccountingCredit")."</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
$r = '';
|
||||
$i = 0;
|
||||
|
||||
$invoicestatic = new FactureFournisseur($db);
|
||||
$companystatic = new Fournisseur($db);
|
||||
@ -887,6 +887,7 @@ if (empty($action) || $action == 'view') {
|
||||
print '<td class="right"></td>';
|
||||
print "</tr>";
|
||||
|
||||
$i++;
|
||||
continue;
|
||||
}
|
||||
if ($errorforinvoice[$key] == 'somelinesarenotbound') {
|
||||
@ -906,6 +907,8 @@ if (empty($action) || $action == 'view') {
|
||||
print '<td class="right"></td>';
|
||||
print '<td class="right"></td>';
|
||||
print "</tr>";
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
// Third party
|
||||
@ -936,6 +939,8 @@ if (empty($action) || $action == 'view') {
|
||||
print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
|
||||
print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
|
||||
print "</tr>";
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
// Product / Service
|
||||
@ -972,6 +977,8 @@ if (empty($action) || $action == 'view') {
|
||||
print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
|
||||
print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
|
||||
print "</tr>";
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
// VAT
|
||||
@ -1009,6 +1016,8 @@ if (empty($action) || $action == 'view') {
|
||||
print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
|
||||
print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
|
||||
print "</tr>";
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1037,11 +1046,17 @@ if (empty($action) || $action == 'view') {
|
||||
print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
|
||||
print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
|
||||
print "</tr>";
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$i) {
|
||||
print '<tr class="oddeven"><td colspan="7"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
|
||||
@ -106,8 +106,8 @@ if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))
|
||||
$date_end = dol_get_last_day($pastmonthyear, $pastmonth, false);
|
||||
}
|
||||
|
||||
$sql = "SELECT f.rowid, f.ref, f.type, f.datef as df, f.ref_client, f.date_lim_reglement as dlr, f.close_code, f.retained_warranty,";
|
||||
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.situation_percent, fd.vat_src_code,";
|
||||
$sql = "SELECT f.rowid, f.ref, f.type, f.situation_cycle_ref, f.datef as df, f.ref_client, f.date_lim_reglement as dlr, f.close_code, f.retained_warranty,";
|
||||
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.situation_percent, fd.vat_src_code, fd.info_bits,";
|
||||
$sql .= " s.rowid as socid, s.nom as name, s.code_client, s.code_fournisseur,";
|
||||
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
|
||||
$sql .= " spe.accountancy_code_customer as code_compta,";
|
||||
@ -206,21 +206,23 @@ if ($result) {
|
||||
$def_tva[$obj->rowid][$compta_tva][vatrate($obj->tva_tx).($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : '')] = (vatrate($obj->tva_tx).($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : ''));
|
||||
}
|
||||
|
||||
$line = new FactureLigne($db);
|
||||
$line->fetch($obj->fdid);
|
||||
// Create a compensation rate.
|
||||
$situation_ratio = 1;
|
||||
if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) {
|
||||
if ($obj->situation_cycle_ref) {
|
||||
// Avoid divide by 0
|
||||
if ($obj->situation_percent == 0) {
|
||||
$situation_ratio = 0;
|
||||
} else {
|
||||
$line = new FactureLigne($db);
|
||||
$line->fetch($obj->fdid);
|
||||
|
||||
// Situation invoices handling
|
||||
$prev_progress = $line->get_prev_progress($obj->rowid);
|
||||
// Situation invoices handling
|
||||
$prev_progress = $line->get_prev_progress($obj->rowid);
|
||||
|
||||
if ($obj->type == Facture::TYPE_SITUATION) {
|
||||
// Avoid divide by 0
|
||||
if ($obj->situation_percent == 0) {
|
||||
$situation_ratio = 0;
|
||||
} else {
|
||||
$situation_ratio = ($obj->situation_percent - $prev_progress) / $obj->situation_percent;
|
||||
$situation_ratio = ($obj->situation_percent - $prev_progress) / $obj->situation_percent;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$situation_ratio = 1;
|
||||
}
|
||||
|
||||
// Invoice lines
|
||||
@ -249,6 +251,11 @@ if ($result) {
|
||||
$tablocaltax2[$obj->rowid][$compta_localtax2] = 0;
|
||||
}
|
||||
|
||||
// Compensation of data for invoice situation by using $situation_ratio. This works (nearly) for invoice that was not correctly recorded
|
||||
// but it may introduces an error for situation invoices that were correctly saved. There is still rounding problem that differs between
|
||||
// real data we should have stored and result obtained with a compensation.
|
||||
// It also seems that credit notes on situation invoices are correctly saved (but it depends on the version used in fact).
|
||||
// For credit notes, we hope to have situation_ratio = 1 so the compensation has no effect to avoid introducing troubles with credit notes.
|
||||
$total_ttc = $obj->total_ttc * $situation_ratio;
|
||||
if (!empty($conf->global->INVOICE_USE_RETAINED_WARRANTY) && $obj->retained_warranty > 0) {
|
||||
$retained_warranty = (double) price2num($total_ttc * $obj->retained_warranty / 100, 'MT');
|
||||
@ -257,11 +264,14 @@ if ($result) {
|
||||
}
|
||||
$tabttc[$obj->rowid][$compta_soc] += $total_ttc;
|
||||
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht * $situation_ratio;
|
||||
if (empty($line->tva_npr)) {
|
||||
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva * $situation_ratio; // We ignore line if VAT is a NPR
|
||||
$tva_npr = (($obj->info_bits & 1 == 1) ? 1 : 0);
|
||||
if (!$tva_npr) { // We ignore line if VAT is a NPR
|
||||
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva * $situation_ratio;
|
||||
}
|
||||
$tablocaltax1[$obj->rowid][$compta_localtax1] += $obj->total_localtax1 * $situation_ratio;
|
||||
$tablocaltax2[$obj->rowid][$compta_localtax2] += $obj->total_localtax2 * $situation_ratio;
|
||||
|
||||
|
||||
$tabcompany[$obj->rowid] = array(
|
||||
'id' => $obj->socid,
|
||||
'name' => $obj->name,
|
||||
@ -658,7 +668,8 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
||||
foreach ($tabfac as $key => $val) {
|
||||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
$companystatic->code_compta = $tabcompany[$key]['code_compta'];
|
||||
$companystatic->code_compta = $tabcompany[$key]['code_compta']; // deprecated
|
||||
$companystatic->code_compta_client = $tabcompany[$key]['code_compta'];
|
||||
$companystatic->code_client = $tabcompany[$key]['code_client'];
|
||||
$companystatic->client = 3;
|
||||
|
||||
@ -846,7 +857,6 @@ if (empty($action) || $action == 'view') {
|
||||
*/
|
||||
print '<br>';
|
||||
|
||||
$i = 0;
|
||||
print '<div class="div-table-responsive">';
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
print "<tr class=\"liste_titre\">";
|
||||
@ -859,7 +869,7 @@ if (empty($action) || $action == 'view') {
|
||||
print '<td class="center">'.$langs->trans("AccountingCredit")."</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
$r = '';
|
||||
$i = 0;
|
||||
|
||||
$companystatic = new Client($db);
|
||||
$invoicestatic = new Facture($db);
|
||||
@ -907,6 +917,7 @@ if (empty($action) || $action == 'view') {
|
||||
print '<td class="right"></td>';
|
||||
print "</tr>";
|
||||
|
||||
$i++;
|
||||
continue;
|
||||
}
|
||||
if ($errorforinvoice[$key] == 'somelinesarenotbound') {
|
||||
@ -926,6 +937,8 @@ if (empty($action) || $action == 'view') {
|
||||
print '<td class="right"></td>';
|
||||
print '<td class="right"></td>';
|
||||
print "</tr>";
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
// Warranty
|
||||
@ -986,6 +999,8 @@ if (empty($action) || $action == 'view') {
|
||||
print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
|
||||
print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
|
||||
print "</tr>";
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
// Product / Service
|
||||
@ -1022,6 +1037,8 @@ if (empty($action) || $action == 'view') {
|
||||
print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
|
||||
print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
|
||||
print "</tr>";
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
// VAT
|
||||
@ -1058,11 +1075,17 @@ if (empty($action) || $action == 'view') {
|
||||
print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
|
||||
print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
|
||||
print "</tr>";
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$i) {
|
||||
print '<tr class="oddeven"><td colspan="6"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
|
||||
@ -1726,8 +1726,7 @@ class Adherent extends CommonObject
|
||||
return -2;
|
||||
}
|
||||
} else {
|
||||
$this->error = $subscription->error;
|
||||
$this->errors = $subscription->errors;
|
||||
$this->setErrorsFromObject($subscription);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@ -1790,13 +1789,11 @@ class Adherent extends CommonObject
|
||||
}
|
||||
} else {
|
||||
$error++;
|
||||
$this->error = $acct->error;
|
||||
$this->errors = $acct->errors;
|
||||
$this->setErrorsFromObject($acct);
|
||||
}
|
||||
} else {
|
||||
$error++;
|
||||
$this->error = $acct->error;
|
||||
$this->errors = $acct->errors;
|
||||
$this->setErrorsFromObject($acct);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3326,7 +3323,7 @@ class Adherent extends CommonObject
|
||||
$return .= '<br><span class="info-box-label">'.$this->getmorphylib('', 2).'</span>';
|
||||
}
|
||||
if (method_exists($this, 'getLibStatut')) {
|
||||
$return .= '<br><div class="info-box-status margintoponly">'.$this->getLibStatut(5).'</div>';
|
||||
$return .= '<br><div class="info-box-status margintoponly">'.$this->getLibStatut(3).'</div>';
|
||||
}
|
||||
$return .= '</div>';
|
||||
$return .= '</div>';
|
||||
|
||||
@ -1016,7 +1016,7 @@ class AdherentType extends CommonObject
|
||||
}
|
||||
}
|
||||
if (method_exists($this, 'getLibStatut')) {
|
||||
$return .= '<br><div class="info-box-status margintoponly">'.$this->getLibStatut(5).'</div>';
|
||||
$return .= '<br><div class="info-box-status margintoponly">'.$this->getLibStatut(3).'</div>';
|
||||
}
|
||||
$return .= '</div>';
|
||||
$return .= '</div>';
|
||||
|
||||
@ -238,11 +238,10 @@ class Members extends DolibarrApi
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||
if ($errormessage) {
|
||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
$sql .= $this->db->order($sortfield, $sortorder);
|
||||
|
||||
@ -103,11 +103,10 @@ class MembersTypes extends DolibarrApi
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||
if ($errormessage) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
$sql .= $this->db->order($sortfield, $sortorder);
|
||||
|
||||
@ -101,11 +101,10 @@ class Subscriptions extends DolibarrApi
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||
if ($errormessage) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
$sql .= $this->db->order($sortfield, $sortorder);
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
* Copyright (C) 2013-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2014-2016 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2021 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2021-2023 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -1014,7 +1014,8 @@ print "</tr>\n";
|
||||
$i = 0;
|
||||
$totalarray = array();
|
||||
$totalarray['nbfield'] = 0;
|
||||
while ($i < min($num, $limit)) {
|
||||
$imaxinloop = ($limit ? min($num, $limit) : $num);
|
||||
while ($i < $imaxinloop) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$datefin = $db->jdate($obj->datefin);
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* Copyright (C) 2004-2018 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012-2017 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2015-2016 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2018-2023 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2019 Thibault FOUCART <support@ptibogxiv.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -946,6 +946,8 @@ if ($rowid > 0) {
|
||||
|
||||
print '<tr>';
|
||||
// Date start subscription
|
||||
$currentyear = dol_print_date(time(), "%Y");
|
||||
$currentmonth = dol_print_date(time(), "%m");
|
||||
print '<td class="fieldrequired">'.$langs->trans("DateSubscription").'</td><td>';
|
||||
if (GETPOST('reday')) {
|
||||
$datefrom = dol_mktime(0, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
|
||||
@ -955,7 +957,7 @@ if ($rowid > 0) {
|
||||
if ($object->datefin > 0 && dol_time_plus_duree($object->datefin, $defaultdelay, $defaultdelayunit) > dol_now()) {
|
||||
$datefrom = dol_time_plus_duree($object->datefin, 1, 'd');
|
||||
} else {
|
||||
$datefrom = dol_get_first_day(dol_print_date(time(), "%Y"));
|
||||
$datefrom = dol_get_first_day($currentyear);
|
||||
}
|
||||
}
|
||||
print $form->selectDate($datefrom, '', '', '', '', "subscription", 1, 1);
|
||||
@ -966,7 +968,13 @@ if ($rowid > 0) {
|
||||
$dateto = dol_mktime(0, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear'));
|
||||
}
|
||||
if (!$dateto) {
|
||||
$dateto = -1; // By default, no date is suggested
|
||||
if (getDolGlobalInt('MEMBER_SUBSCRIPTION_SUGGEST_END_OF_MONTH')) {
|
||||
$dateto = dol_get_last_day($currentyear, $currentmonth);
|
||||
} elseif (getDolGlobalInt('MEMBER_SUBSCRIPTION_SUGGEST_END_OF_YEAR')) {
|
||||
$dateto = dol_get_last_day($currentyear);
|
||||
} else {
|
||||
$dateto = -1; // By default, no date is suggested
|
||||
}
|
||||
}
|
||||
print '<tr><td>'.$langs->trans("DateEndSubscription").'</td><td>';
|
||||
print $form->selectDate($dateto, 'end', '', '', '', "subscription", 1, 0);
|
||||
|
||||
@ -502,7 +502,8 @@ print "</tr>\n";
|
||||
|
||||
$totalarray = array();
|
||||
$totalarray['nbfield'] = 0;
|
||||
while ($i < min($num, $limit)) {
|
||||
$imaxinloop = ($limit ? min($num, $limit) : $num);
|
||||
while ($i < $imaxinloop) {
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
$subscription->ref = $obj->crowid;
|
||||
@ -546,7 +547,7 @@ while ($i < min($num, $limit)) {
|
||||
}
|
||||
// Output Kanban
|
||||
print $subscription->getKanbanView('');
|
||||
if ($i == (min($num, $limit) - 1)) {
|
||||
if ($i == ($imaxinloop - 1)) {
|
||||
print '</div>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -194,6 +194,10 @@ if (!empty($triggers)) {
|
||||
if ($trigger['code'] == 'FICHINTER_CLASSIFY_UNBILLED' && empty($conf->global->FICHINTER_CLASSIFY_BILLED)) {
|
||||
continue;
|
||||
}
|
||||
if ($trigger['code'] == 'ACTION_CREATE') {
|
||||
// This is the trigger to add an event, enabling it will create infinite loop
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($search_event === '' || preg_match('/'.preg_quote($search_event, '/').'/i', $trigger['code'])) {
|
||||
print '<!-- '.$trigger['position'].' -->';
|
||||
@ -202,7 +206,7 @@ if (!empty($triggers)) {
|
||||
print '<td>'.$trigger['label'].'</td>';
|
||||
print '<td class="right" width="40">';
|
||||
$key = 'MAIN_AGENDA_ACTIONAUTO_'.$trigger['code'];
|
||||
$value = $conf->global->$key;
|
||||
$value = getDolGlobalInt($key);
|
||||
print '<input class="oddeven" type="checkbox" name="'.$key.'" value="1"'.((($action == 'selectall' || $value) && $action != "selectnone") ? ' checked' : '').'>';
|
||||
print '</td></tr>'."\n";
|
||||
}
|
||||
|
||||
@ -203,7 +203,7 @@ print '<span class="opacitymedium">'.$langs->trans("AgendaExtSitesDesc")."</span
|
||||
print "<br>\n";
|
||||
|
||||
|
||||
$selectedvalue=$conf->global->AGENDA_DISABLE_EXT;
|
||||
$selectedvalue = getDolGlobalInt('AGENDA_DISABLE_EXT');
|
||||
if ($selectedvalue==1) $selectedvalue=0; else $selectedvalue=1;
|
||||
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
|
||||
@ -333,7 +333,7 @@ print '<td>'.$form->textwithpicto($langs->trans("AGENDA_DEFAULT_VIEW"), $htmltex
|
||||
print '<td class="center"> </td>'."\n";
|
||||
print '<td class="right">'."\n";
|
||||
$tmplist = array(''=>' ', 'show_list'=>$langs->trans("ViewList"), 'show_month'=>$langs->trans("ViewCal"), 'show_week'=>$langs->trans("ViewWeek"), 'show_day'=>$langs->trans("ViewDay"), 'show_peruser'=>$langs->trans("ViewPerUser"));
|
||||
print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, $conf->global->AGENDA_DEFAULT_VIEW);
|
||||
print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, getDolGlobalString('AGENDA_DEFAULT_VIEW'));
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// Manual or automatic
|
||||
@ -395,7 +395,7 @@ print '<tr class="oddeven">'."\n";
|
||||
print '<td>'.$langs->trans("AGENDA_DEFAULT_FILTER_STATUS").'</td>'."\n";
|
||||
print '<td class="center"> </td>'."\n";
|
||||
print '<td class="right">'."\n";
|
||||
$formactions->form_select_status_action('agenda', $conf->global->AGENDA_DEFAULT_FILTER_STATUS, 1, 'AGENDA_DEFAULT_FILTER_STATUS', 1, 2, 'minwidth100');
|
||||
$formactions->form_select_status_action('agenda', getDolGlobalString('AGENDA_DEFAULT_FILTER_STATUS'), 1, 'AGENDA_DEFAULT_FILTER_STATUS', 1, 2, 'minwidth100');
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
print '</table>';
|
||||
|
||||
@ -39,6 +39,23 @@ $langs->loadLangs(array("admin", "other", "agenda"));
|
||||
|
||||
$def = array();
|
||||
$actionsave = GETPOST('save', 'alpha');
|
||||
$MAIN_AGENDA_XCAL_EXPORTKEY = getDolGlobalString('MAIN_AGENDA_XCAL_EXPORTKEY');
|
||||
$MAIN_AGENDA_EXPORT_PAST_DELAY = getDolGlobalInt('MAIN_AGENDA_EXPORT_PAST_DELAY');
|
||||
$MAIN_AGENDA_EXPORT_CACHE = getDolGlobalInt('MAIN_AGENDA_EXPORT_CACHE');
|
||||
$AGENDA_EXPORT_FIX_TZ = getDolGlobalString('AGENDA_EXPORT_FIX_TZ');
|
||||
|
||||
if (GETPOSTISSET('MAIN_AGENDA_XCAL_EXPORTKEY')) {
|
||||
$MAIN_AGENDA_XCAL_EXPORTKEY = trim(GETPOST('MAIN_AGENDA_XCAL_EXPORTKEY', 'alpha'));
|
||||
}
|
||||
if (GETPOSTISSET('MAIN_AGENDA_EXPORT_PAST_DELAY')) {
|
||||
$MAIN_AGENDA_EXPORT_PAST_DELAY = intval(GETPOST('MAIN_AGENDA_EXPORT_PAST_DELAY', 'int'));
|
||||
}
|
||||
if (GETPOSTISSET('MAIN_AGENDA_EXPORT_CACHE')) {
|
||||
$MAIN_AGENDA_EXPORT_CACHE = intval(GETPOST('MAIN_AGENDA_EXPORT_CACHE', 'int'));
|
||||
}
|
||||
if (GETPOSTISSET('AGENDA_EXPORT_FIX_TZ')) {
|
||||
$AGENDA_EXPORT_FIX_TZ = trim(GETPOST('AGENDA_EXPORT_FIX_TZ', 'alpha'));
|
||||
}
|
||||
|
||||
// Sauvegardes parametres
|
||||
if ($actionsave) {
|
||||
@ -46,10 +63,10 @@ if ($actionsave) {
|
||||
|
||||
$db->begin();
|
||||
|
||||
$i += dolibarr_set_const($db, 'MAIN_AGENDA_XCAL_EXPORTKEY', trim(GETPOST('MAIN_AGENDA_XCAL_EXPORTKEY', 'alpha')), 'chaine', 0, '', $conf->entity);
|
||||
$i += dolibarr_set_const($db, 'MAIN_AGENDA_EXPORT_PAST_DELAY', trim(GETPOST('MAIN_AGENDA_EXPORT_PAST_DELAY', 'alpha')), 'chaine', 0, '', $conf->entity);
|
||||
$i += dolibarr_set_const($db, 'MAIN_AGENDA_EXPORT_CACHE', trim(GETPOST('MAIN_AGENDA_EXPORT_CACHE', 'alpha')), 'chaine', 0, '', $conf->entity);
|
||||
$i += dolibarr_set_const($db, 'AGENDA_EXPORT_FIX_TZ', trim(GETPOST('AGENDA_EXPORT_FIX_TZ', 'alpha')), 'chaine', 0, '', $conf->entity);
|
||||
$i += dolibarr_set_const($db, 'MAIN_AGENDA_XCAL_EXPORTKEY', $MAIN_AGENDA_XCAL_EXPORTKEY, 'chaine', 0, '', $conf->entity);
|
||||
$i += dolibarr_set_const($db, 'MAIN_AGENDA_EXPORT_PAST_DELAY', $MAIN_AGENDA_EXPORT_PAST_DELAY, 'chaine', 0, '', $conf->entity);
|
||||
$i += dolibarr_set_const($db, 'MAIN_AGENDA_EXPORT_CACHE', $MAIN_AGENDA_EXPORT_CACHE, 'chaine', 0, '', $conf->entity);
|
||||
$i += dolibarr_set_const($db, 'AGENDA_EXPORT_FIX_TZ', $AGENDA_EXPORT_FIX_TZ, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
if ($i >= 4) {
|
||||
$db->commit();
|
||||
@ -98,7 +115,7 @@ print "</tr>";
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="fieldrequired">'.$langs->trans("PasswordTogetVCalExport")."</td>";
|
||||
print '<td><input required="required" type="text" class="flat" id="MAIN_AGENDA_XCAL_EXPORTKEY" name="MAIN_AGENDA_XCAL_EXPORTKEY" value="'.(GETPOST('MAIN_AGENDA_XCAL_EXPORTKEY', 'alpha') ?GETPOST('MAIN_AGENDA_XCAL_EXPORTKEY', 'alpha') : $conf->global->MAIN_AGENDA_XCAL_EXPORTKEY).'" size="40">';
|
||||
print '<td><input required="required" type="text" class="flat" id="MAIN_AGENDA_XCAL_EXPORTKEY" name="MAIN_AGENDA_XCAL_EXPORTKEY" value="'.dol_escape_htmltag($MAIN_AGENDA_XCAL_EXPORTKEY).'" size="40">';
|
||||
if (!empty($conf->use_javascript_ajax)) {
|
||||
print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token" class="linkobject"');
|
||||
}
|
||||
@ -108,13 +125,13 @@ print "</tr>";
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print "<td>".$langs->trans("PastDelayVCalExport")."</td>";
|
||||
print "<td><input type=\"text\" class=\"flat\" name=\"MAIN_AGENDA_EXPORT_PAST_DELAY\" value=\"".(GETPOST('MAIN_AGENDA_EXPORT_PAST_DELAY', 'alpha') ?GETPOST('MAIN_AGENDA_EXPORT_PAST_DELAY', 'alpha') : $conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY)."\" size=\"10\"> ".$langs->trans("days")."</td>";
|
||||
print "<td><input type=\"text\" class=\"flat\" name=\"MAIN_AGENDA_EXPORT_PAST_DELAY\" value=\"".$MAIN_AGENDA_EXPORT_PAST_DELAY."\" size=\"10\"> ".$langs->trans("days")."</td>";
|
||||
print "<td> </td>";
|
||||
print "</tr>";
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print "<td>".$langs->trans("UseACacheDelay")."</td>";
|
||||
print "<td><input type=\"text\" class=\"flat\" name=\"MAIN_AGENDA_EXPORT_CACHE\" value=\"".(GETPOST('MAIN_AGENDA_EXPORT_CACHE', 'alpha') ?GETPOST('MAIN_AGENDA_EXPORT_CACHE', 'alpha') : $conf->global->MAIN_AGENDA_EXPORT_CACHE)."\" size=\"10\"></td>";
|
||||
print "<td><input type=\"text\" class=\"flat\" name=\"MAIN_AGENDA_EXPORT_CACHE\" value=\"".$MAIN_AGENDA_EXPORT_CACHE."\" size=\"10\"></td>";
|
||||
print "<td> </td>";
|
||||
print "</tr>";
|
||||
|
||||
@ -131,7 +148,7 @@ print "</tr>";
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("FixTZ")."</td>";
|
||||
print "<td>";
|
||||
print '<input class="flat" type="text" size="4" name="AGENDA_EXPORT_FIX_TZ" value="'.$conf->global->AGENDA_EXPORT_FIX_TZ.'">';
|
||||
print '<input class="flat" type="text" size="4" name="AGENDA_EXPORT_FIX_TZ" value="'.dol_escape_htmltag($AGENDA_EXPORT_FIX_TZ).'">';
|
||||
print ' '.$langs->trans("FillThisOnlyIfRequired");
|
||||
print "</td>";
|
||||
print "</tr>";
|
||||
|
||||
@ -64,9 +64,9 @@ if ($action == 'add' && GETPOST('update')) { // Click on button update must be u
|
||||
if ($action == 'add' && GETPOST('delete')) { // Click on button update must be used in priority before param $action
|
||||
$action = 'delete';
|
||||
}
|
||||
if ($action == 'update' && GETPOST('add')) { // Click on button add must be used in priority before param $action
|
||||
/*if ($action == 'update' && GETPOST('add')) { // 'add' button is always clicked as it is the first in form.
|
||||
$action = 'add';
|
||||
}
|
||||
}*/
|
||||
if ($action == 'delete' && GETPOST('add')) { // Click on button add must be used in priority before param $action
|
||||
$action = 'add';
|
||||
}
|
||||
@ -234,7 +234,7 @@ if (isModEnabled('multicompany') && !$user->entity) {
|
||||
print '<td class="center">';
|
||||
print '<input type="hidden" name="entity" value="' . $conf->entity . '">';
|
||||
}
|
||||
print '<input type="submit" class="button button-add small" name="add" value="'.$langs->trans("Add").'">';
|
||||
print '<input type="submit" class="button button-add small" id="add" name="add" value="'.$langs->trans("Add").'">';
|
||||
print "</td>\n";
|
||||
print '</tr>';
|
||||
|
||||
|
||||
@ -43,7 +43,7 @@ $arrayofparameters = array(
|
||||
'DAV_RESTICT_ON_IP'=>array('css'=>'minwidth200', 'enabled'=>1),
|
||||
'DAV_ALLOW_PRIVATE_DIR'=>array('css'=>'minwidth200', 'enabled'=>2),
|
||||
'DAV_ALLOW_PUBLIC_DIR'=>array('css'=>'minwidth200', 'enabled'=>1),
|
||||
'DAV_ALLOW_ECM_DIR'=>array('css'=>'minwidth200', 'enabled'=>$conf->ecm->enabled)
|
||||
'DAV_ALLOW_ECM_DIR'=>array('css'=>'minwidth200', 'enabled'=>isModEnabled('ecm'))
|
||||
);
|
||||
|
||||
// To fix when dire does not exists
|
||||
@ -124,6 +124,10 @@ if ($action == 'edit') {
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
foreach ($arrayofparameters as $key => $val) {
|
||||
if (isset($val['enabled']) && empty($val['enabled'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
$tooltiphelp = (($langs->trans($key.'Tooltip') != $key.'Tooltip') ? $langs->trans($key.'Tooltip') : '');
|
||||
$label = $langs->trans($key);
|
||||
|
||||
@ -513,7 +513,7 @@ $tabcond[25] = isModEnabled('website');
|
||||
$tabcond[27] = isModEnabled("societe");
|
||||
$tabcond[28] = isModEnabled('holiday');
|
||||
$tabcond[29] = isModEnabled('project');
|
||||
$tabcond[30] = isModEnabled('label');
|
||||
$tabcond[30] = (isModEnabled('label') || isModEnabled('barcode') || isModEnabled('adherent')); // stickers format dictionary
|
||||
//$tabcond[31]= isModEnabled('accounting');
|
||||
$tabcond[32] = (isModEnabled('holiday') || isModEnabled('hrm'));
|
||||
$tabcond[33] = isModEnabled('hrm');
|
||||
@ -599,6 +599,7 @@ foreach ($tabcomplete as $key => $value) {
|
||||
$tabcomplete[$key]['sql'] = $tabsql[$i];
|
||||
$tabcomplete[$key]['sqlsort'] = $tabsqlsort[$i];
|
||||
$tabcomplete[$key]['field'] = $tabfield[$i];
|
||||
//$tabcomplete[$key]['help'] = $tabhelp[$i]; // array help already loaded into tabcomplete
|
||||
}
|
||||
|
||||
$keytable = '';
|
||||
@ -616,7 +617,6 @@ if (empty($sortfield)) {
|
||||
//var_dump($sortfield);var_dump($sortorder);
|
||||
}
|
||||
|
||||
|
||||
// Define elementList and sourceList (used for dictionary type of contacts "llx_c_type_contact")
|
||||
$elementList = array();
|
||||
$sourceList = array();
|
||||
@ -1223,7 +1223,6 @@ if ($action == 'delete') {
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'rowid='.urlencode($rowid).'&code='.urlencode($code).$paramwithsearch, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete', '', 0, 1);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Show a dictionary
|
||||
*/
|
||||
@ -1571,7 +1570,6 @@ if ($id > 0) {
|
||||
unset($fieldlist[2]); // Remove field ??? if dictionary Regions
|
||||
}
|
||||
|
||||
|
||||
if (empty($reshook)) {
|
||||
fieldList($fieldlist, $obj, $tabname[$id], 'add');
|
||||
}
|
||||
@ -1927,8 +1925,8 @@ if ($id > 0) {
|
||||
if (!is_null($withentity)) {
|
||||
print '<input type="hidden" name="entity" value="'.$withentity.'">';
|
||||
}
|
||||
print '<input type="submit" class="button button-edit" name="actionmodify" value="'.$langs->trans("Modify").'">';
|
||||
print '<input type="submit" class="button button-cancel" name="actioncancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '<input type="submit" class="button button-edit small" name="actionmodify" value="'.$langs->trans("Modify").'">';
|
||||
print '<input type="submit" class="button button-cancel small" name="actioncancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '</td>';
|
||||
} else {
|
||||
$tmpaction = 'view';
|
||||
@ -2531,7 +2529,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
$classtd = 'right'; $class = 'maxwidth50 right';
|
||||
}
|
||||
if (in_array($fieldlist[$field], array('pos', 'position'))) {
|
||||
$classtd = 'center'; $class = 'maxwidth50 center';
|
||||
$classtd = 'right'; $class = 'maxwidth50 right';
|
||||
}
|
||||
if (in_array($fieldlist[$field], array('dayrule', 'day', 'month', 'year', 'use_default', 'affect', 'delay', 'public', 'sortorder', 'sens', 'category_type', 'fk_parent'))) {
|
||||
$class = 'maxwidth50 center';
|
||||
|
||||
@ -35,8 +35,6 @@ include_once DOL_DOCUMENT_ROOT.'/emailcollector/class/emailcollectorfilter.class
|
||||
include_once DOL_DOCUMENT_ROOT.'/emailcollector/class/emailcollectoraction.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/emailcollector/lib/emailcollector.lib.php';
|
||||
|
||||
// use Webklex\PHPIMAP;
|
||||
require DOL_DOCUMENT_ROOT.'/includes/webklex/php-imap/vendor/autoload.php';
|
||||
use Webklex\PHPIMAP\ClientManager;
|
||||
use Webklex\PHPIMAP\Exceptions\ConnectionFailedException;
|
||||
use Webklex\PHPIMAP\Exceptions\InvalidWhereQueryCriteriaException;
|
||||
@ -403,6 +401,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
|
||||
if ($action == 'scan') {
|
||||
if (!empty($conf->global->MAIN_IMAP_USE_PHPIMAP)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/webklex/php-imap/vendor/autoload.php';
|
||||
|
||||
if ($object->acces_type == 1) {
|
||||
// Mode OAUth2 with PHP-IMAP
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/oauth.lib.php'; // define $supportedoauth2array
|
||||
@ -448,8 +448,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
|
||||
// We have to save the token because Google give it only once
|
||||
$refreshtoken = $tokenobj->getRefreshToken();
|
||||
|
||||
//var_dump($tokenobj);
|
||||
$tokenobj = $apiService->refreshAccessToken($tokenobj);
|
||||
try {
|
||||
$tokenobj = $apiService->refreshAccessToken($tokenobj);
|
||||
} catch (Exception $e) {
|
||||
throw new Exception("Failed to refresh access token: ".$e->getMessage());
|
||||
}
|
||||
|
||||
$tokenobj->setRefreshToken($refreshtoken);
|
||||
$storage->storeAccessToken($OAUTH_SERVICENAME, $tokenobj);
|
||||
@ -496,6 +501,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
'authentication' => "login",
|
||||
]);
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
try {
|
||||
// To emulate the command connect, you can run
|
||||
@ -569,7 +575,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
}
|
||||
}
|
||||
|
||||
$morehtml = $form->textwithpicto($langs->trans("NbOfEmailsInInbox"), 'connect string '.$connectstringserver).': '.($morehtml ? $morehtml : '?');
|
||||
$morehtml = $form->textwithpicto($langs->trans("NbOfEmailsInInbox"), 'Connect string = '.$connectstringserver.'<br>Option MAIN_IMAP_USE_PHPIMAP = '.getDolGlobalInt('MAIN_IMAP_USE_PHPIMAP')).': '.($morehtml ? $morehtml : '?');
|
||||
$morehtml .= '<a class="flat paddingleft marginleftonly" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=scan&token='.newToken().'">'.img_picto('', 'refresh', 'class="paddingrightonly"').$langs->trans("Refresh").'</a>';
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref.'<div class="refidno">'.$morehtml.'</div>', '', 0, '', '', 0, '');
|
||||
|
||||
@ -364,7 +364,7 @@ foreach ($dirmodels as $reldir) {
|
||||
if ($conf->global->FACTURE_ADDON == $file || $conf->global->FACTURE_ADDON.'.php' == $file) {
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
} else {
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&value='.preg_replace('/\.php$/', '', $file).'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&value='.preg_replace('/\.php$/', '', $file).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
@ -629,7 +629,7 @@ if (!empty($conf->global->INVOICE_USE_DEFAULT_DOCUMENT)) { // Hidden conf
|
||||
Facture::TYPE_CREDIT_NOTE=>$langs->trans("InvoiceAvoir"),
|
||||
Facture::TYPE_DEPOSIT=>$langs->trans("InvoiceDeposit"),
|
||||
);
|
||||
if (!empty($conf->global->INVOICE_USE_SITUATION)) {
|
||||
if (getDolGlobalInt('INVOICE_USE_SITUATION')) {
|
||||
$listtype[Facture::TYPE_SITUATION] = $langs->trans("InvoiceSituation");
|
||||
}
|
||||
|
||||
@ -702,12 +702,14 @@ if (isModEnabled('banque')) {
|
||||
}
|
||||
print "</td></tr>";
|
||||
|
||||
$FACTURE_CHQ_NUMBER = getDolGlobalInt('FACTURE_CHQ_NUMBER');
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print "<td>".$langs->trans("SuggestPaymentByChequeToAddress")."</td>";
|
||||
print "<td>";
|
||||
print '<select class="flat" name="chq" id="chq">';
|
||||
print '<option value="0">'.$langs->trans("DoNotSuggestPaymentMode").'</option>';
|
||||
print '<option value="-1"'.($conf->global->FACTURE_CHQ_NUMBER ? ' selected' : '').'>'.$langs->trans("MenuCompanySetup").' ('.($mysoc->name ? $mysoc->name : $langs->trans("NotDefined")).')</option>';
|
||||
print '<option value="-1"'.($FACTURE_CHQ_NUMBER == -1 ? ' selected' : '').'>'.$langs->trans("MenuCompanySetup").' ('.($mysoc->name ? $mysoc->name : $langs->trans("NotDefined")).')</option>';
|
||||
|
||||
$sql = "SELECT rowid, label";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank_account";
|
||||
@ -723,7 +725,7 @@ if ($resql) {
|
||||
$row = $db->fetch_row($resql);
|
||||
|
||||
print '<option value="'.$row[0].'"';
|
||||
print $conf->global->FACTURE_CHQ_NUMBER == $row[0] ? ' selected' : '';
|
||||
print $FACTURE_CHQ_NUMBER == $row[0] ? ' selected' : '';
|
||||
print '>'.$langs->trans("OwnerOfBankAccount", $row[1]).'</option>';
|
||||
|
||||
$i++;
|
||||
|
||||
@ -163,6 +163,9 @@ $textoshow = str_replace('{s1}', '<a href="'.$url2.'" target="_blank" rel="noope
|
||||
print $textoshow;
|
||||
|
||||
if ($geoip) {
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
|
||||
print '<br><br>';
|
||||
print '<br><span class="opacitymedium">'.$langs->trans("TestGeoIPResult", $ip).':</span>';
|
||||
|
||||
@ -214,6 +217,20 @@ if ($geoip) {
|
||||
}
|
||||
}
|
||||
|
||||
$ip = GETPOST("iptotest");
|
||||
print '<br><input type="text class="width100" name="iptotest" id="iptotest" placeholder="'.dol_escape_htmltag($langs->trans("EnterAnIP")).'" value="'.$ip.'">';
|
||||
print '<input type="submit" class="width40 button small smallpaddingimp" value=" -> ">';
|
||||
if ($ip) {
|
||||
$result = dol_print_ip($ip, 1);
|
||||
if ($result) {
|
||||
print $result;
|
||||
} else {
|
||||
print $langs->trans("Error");
|
||||
}
|
||||
}
|
||||
|
||||
print '</form>';
|
||||
|
||||
$geoip->close();
|
||||
}
|
||||
|
||||
|
||||
@ -150,17 +150,17 @@ print '</tr>';
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("MailingEMailError").'</td><td>';
|
||||
print '<input class="minwidth100" type="text" name="MAILING_EMAIL_ERRORSTO" value="'.$conf->global->MAILING_EMAIL_ERRORSTO.'">';
|
||||
if (!empty($conf->global->MAILING_EMAIL_ERRORSTO) && !isValidEmail($conf->global->MAILING_EMAIL_ERRORSTO)) {
|
||||
print '<input class="minwidth100" type="text" name="MAILING_EMAIL_ERRORSTO" value="'.getDolGlobalString('MAILING_EMAIL_ERRORSTO').'">';
|
||||
if (getDolGlobalString('MAILING_EMAIL_ERRORSTO') && !isValidEmail(getDolGlobalString('MAILING_EMAIL_ERRORSTO'))) {
|
||||
print ' '.img_warning($langs->trans("BadEMail"));
|
||||
}
|
||||
print '</td>';
|
||||
print '<td class="hideonsmartphone"><span class="opacitymedium">webmaster@example.com></span></td>';
|
||||
print '<td class="hideonsmartphone"><span class="opacitymedium">'.dol_escape_htmltag('<webmaster@example.com>').'</span></td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $form->textwithpicto($langs->trans("MailingDelay"), $langs->trans("IfDefinedUseAValueBeetween", '0.001', '10')).'</td><td>';
|
||||
print '<input class="width75" type="text" name="MAILING_DELAY" value="'.$conf->global->MAILING_DELAY.'">';
|
||||
print '<input class="width75" type="text" name="MAILING_DELAY" value="'.getDolGlobalString('MAILING_DELAY').'">';
|
||||
print '</td>';
|
||||
print '<td class="hideonsmartphone"></td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -48,13 +48,14 @@ if ($action == 'test' || ($action == 'send' && $trackid = 'test')) {
|
||||
|
||||
$substitutionarrayfortest = array(
|
||||
'__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT,
|
||||
'__CHECK_READ__' => (!empty($object) && is_object($object) && is_object($object->thirdparty)) ? '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$object->thirdparty->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>' : '',
|
||||
'__CHECK_READ__' => '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag=undefinedtag&securitykey='.dol_hash($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY."-undefinedtag", 'md5').'" width="1" height="1" style="width:1px;height:1px" border="0" />',
|
||||
'__USER_LOGIN__' => $user->login,
|
||||
'__USER_EMAIL__' => $user->email,
|
||||
'__USER_SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $usersignature : ''), // Done into actions_sendmails
|
||||
'__SENDEREMAIL_SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $usersignature : ''), // Done into actions_sendmails
|
||||
'__ID__' => 'RecipientIdRecord',
|
||||
//'__EMAIL__' => 'RecipientEMail', // Done into actions_sendmails
|
||||
'__LOGIN__' => $user->login,
|
||||
'__LASTNAME__' => 'RecipientLastname',
|
||||
'__FIRSTNAME__' => 'RecipientFirstname',
|
||||
'__ADDRESS__'=> 'RecipientAddress',
|
||||
|
||||
@ -42,11 +42,13 @@ if ($action == 'test' || $action == 'send') {
|
||||
|
||||
$substitutionarrayfortest = array(
|
||||
'__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT,
|
||||
'__ID__' => 'RecipientIdRecord',
|
||||
//'__EMAIL__' => 'RecipientEMail', // Done into actions_sendmails
|
||||
'__CHECK_READ__' => (!empty($object) && is_object($object) && is_object($object->thirdparty)) ? '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$object->thirdparty->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>' : '',
|
||||
'__CHECK_READ__' => '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag=undefinedtag&securitykey='.dol_hash($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY."-undefinedtag", 'md5').'" width="1" height="1" style="width:1px;height:1px" border="0"/>',
|
||||
'__USER_LOGIN__' => $user->login,
|
||||
'__USER_EMAIL__' => $user->email,
|
||||
'__USER_SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $usersignature : ''), // Done into actions_sendmails
|
||||
'__SENDEREMAIL_SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $usersignature : ''), // Done into actions_sendmails
|
||||
'__ID__' => 'RecipientIdRecord',
|
||||
//'__EMAIL__' => 'RecipientEMail', // Done into actions_sendmails
|
||||
'__LOGIN__' => $user->login,
|
||||
'__LASTNAME__' => 'RecipientLastname',
|
||||
'__FIRSTNAME__' => 'RecipientFirstname',
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
* Copyright (C) 2011-2016 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2018-2023 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -307,13 +307,7 @@ if (empty($reshook)) {
|
||||
$ok = 1;
|
||||
foreach ($listfield as $f => $value) {
|
||||
// Not mandatory fields
|
||||
if ($value == 'joinfiles') {
|
||||
continue;
|
||||
}
|
||||
if ($value == 'content') {
|
||||
continue;
|
||||
}
|
||||
if ($value == 'content_lines') {
|
||||
if (in_array($value, ['joinfiles', 'content', 'content_lines', 'module'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@ -205,6 +205,7 @@ if ($action == 'install') {
|
||||
|
||||
dol_syslog("Uncompress of module file is a success.");
|
||||
|
||||
// We check if this is a metapackage
|
||||
$modulenamearrays = array();
|
||||
if (dol_is_file($modulenamedir.'/metapackage.conf')) {
|
||||
// This is a meta package
|
||||
@ -214,6 +215,7 @@ if ($action == 'install') {
|
||||
$modulenamearrays[$modulename] = $modulename;
|
||||
//var_dump($modulenamearrays);exit;
|
||||
|
||||
// Lop on each packacge of the metapackage
|
||||
foreach ($modulenamearrays as $modulenameval) {
|
||||
if (strpos($modulenameval, '#') === 0) {
|
||||
continue; // Discard comments
|
||||
@ -227,13 +229,14 @@ if ($action == 'install') {
|
||||
|
||||
// Now we install the module
|
||||
if (!$error) {
|
||||
@dol_delete_dir_recursive($dirins.'/'.$modulenameval); // delete the zip file
|
||||
dol_syslog("We copy now directory ".$conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulenameval." into target dir ".$dirins.'/'.$modulenameval);
|
||||
$result = dolCopyDir($modulenamedir, $dirins.'/'.$modulenameval, '0444', 1);
|
||||
@dol_delete_dir_recursive($dirins.'/'.$modulenameval); // delete the target directory
|
||||
$submodulenamedir = $conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulenameval;
|
||||
dol_syslog("We copy now directory ".$submodulenamedir." into target dir ".$dirins.'/'.$modulenameval);
|
||||
$result = dolCopyDir($submodulenamedir, $dirins.'/'.$modulenameval, '0444', 1);
|
||||
if ($result <= 0) {
|
||||
dol_syslog('Failed to call dolCopyDir result='.$result." with param ".$modulenamedir." and ".$dirins.'/'.$modulenameval, LOG_WARNING);
|
||||
dol_syslog('Failed to call dolCopyDir result='.$result." with param ".$submodulenamedir." and ".$dirins.'/'.$modulenameval, LOG_WARNING);
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans("ErrorFailToCopyDir", $modulenamedir, $dirins.'/'.$modulenameval), null, 'errors');
|
||||
setEventMessages($langs->trans("ErrorFailToCopyDir", $submodulenamedir, $dirins.'/'.$modulenameval), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
@ -971,7 +974,7 @@ if ($mode == 'common' || $mode == 'commonkanban') {
|
||||
}
|
||||
|
||||
// Picto + Name of module
|
||||
print ' <td class="tdoverflowmax300" title="'.dol_escape_htmltag($objMod->getName()).'">';
|
||||
print ' <td class="tdoverflowmax300 maxwidth300" title="'.dol_escape_htmltag($objMod->getName()).'">';
|
||||
$alttext = '';
|
||||
//if (is_array($objMod->need_dolibarr_version)) $alttext.=($alttext?' - ':'').'Dolibarr >= '.join('.',$objMod->need_dolibarr_version);
|
||||
//if (is_array($objMod->phpmin)) $alttext.=($alttext?' - ':'').'PHP >= '.join('.',$objMod->phpmin);
|
||||
|
||||
@ -427,11 +427,13 @@ foreach ($listofnotifiedevents as $notifiedevent) {
|
||||
} elseif ($notifiedevent['elementtype'] == 'expensereport' || $notifiedevent['elementtype'] == 'expense_report') {
|
||||
$elementPicto = 'expensereport';
|
||||
$elementLabel = $langs->trans('ExpenseReport');
|
||||
} elseif ($notifiedevent['elementtype'] == 'agenda') {
|
||||
$elementPicto = 'action';
|
||||
}
|
||||
|
||||
$labelfortrigger = 'AmountHT';
|
||||
$codehasnotrigger = 0;
|
||||
if (preg_match('/^HOLIDAY/', $notifiedevent['code'])) {
|
||||
if (preg_match('/^(ACTION|HOLIDAY)/', $notifiedevent['code'])) {
|
||||
$codehasnotrigger++;
|
||||
}
|
||||
|
||||
|
||||
@ -190,7 +190,7 @@ foreach ($dirmodels as $reldir) {
|
||||
if ($conf->global->PAYMENT_ADDON == $file || $conf->global->PAYMENT_ADDON.'.php' == $file) {
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
} else {
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&value='.preg_replace('/\.php$/', '', $file).'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&value='.preg_replace('/\.php$/', '', $file).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
@ -257,7 +257,7 @@ print "</tr>\n";
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("PaymentOnDifferentThirdBills");
|
||||
print '</td><td width="60" align="center">';
|
||||
print $form->selectyesno("FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS", $conf->global->FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS, 1);
|
||||
print $form->selectyesno("FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS", getDolGlobalInt('FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS'), 1);
|
||||
print '</td><td class="right">';
|
||||
print "</td></tr>\n";
|
||||
|
||||
@ -265,7 +265,7 @@ print "</td></tr>\n";
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("GroupPaymentsByModOnReports");
|
||||
print '</td><td width="60" align="center">';
|
||||
print $form->selectyesno("PAYMENTS_REPORT_GROUP_BY_MOD", $conf->global->PAYMENTS_REPORT_GROUP_BY_MOD, 1);
|
||||
print $form->selectyesno("PAYMENTS_REPORT_GROUP_BY_MOD", getDolGlobalInt('PAYMENTS_REPORT_GROUP_BY_MOD'), 1);
|
||||
print '</td><td class="right">';
|
||||
print "</td></tr>\n";
|
||||
|
||||
|
||||
@ -271,9 +271,19 @@ print '<input type="hidden" name="action" value="update">';
|
||||
clearstatcache();
|
||||
|
||||
|
||||
if (getDolGlobalString('PDF_SECURITY_ENCRYPTION')) {
|
||||
print '<div class="warning">';
|
||||
print 'The not supported and hidden option PDF_SECURITY_ENCRYPTION has been enabled. This means a lof of feature related to PDF will be broken, like mass PDF generation or online signature of PDF.'."\n";
|
||||
print 'You should disable this option.';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Misc options
|
||||
print load_fiche_titre($langs->trans("DictionaryPaperFormat"), '', '');
|
||||
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table summary="more" class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameters").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
@ -553,12 +553,12 @@ if (empty($conf->global->MAIN_EXEC_USE_POPEN)) {
|
||||
print $conf->global->MAIN_EXEC_USE_POPEN;
|
||||
}
|
||||
if ($execmethod == 1) {
|
||||
print '<span class="opacitymedium">, "exec" PHP method will be used for shell commands';
|
||||
print '<span class="opacitymedium"> "exec" PHP method will be used for shell commands';
|
||||
print ' ('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or").' 1)';
|
||||
print '</span>';
|
||||
}
|
||||
if ($execmethod == 2) {
|
||||
print '<span class="opacitymedium">, "popen" PHP method will be used for shell commands';
|
||||
print '<span class="opacitymedium"> "popen" PHP method will be used for shell commands';
|
||||
print ' ('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or").' 1)';
|
||||
print '</span>';
|
||||
}
|
||||
@ -580,15 +580,23 @@ print '<br>';
|
||||
print '<strong>MAIN_DOCUMENT_IS_OUTSIDE_WEBROOT_SO_NOEXE_NOT_REQUIRED</strong> = '.getDolGlobalString('MAIN_DOCUMENT_IS_OUTSIDE_WEBROOT_SO_NOEXE_NOT_REQUIRED', '<span class="opacitymedium">'.$langs->trans("Undefined").' ('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or").' 0)</span>')."<br>";
|
||||
print '<br>';
|
||||
|
||||
print '<strong>MAIN_SECURITY_FORCECSP</strong> = '.getDolGlobalString('MAIN_SECURITY_FORCECSP', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>').' <span class="opacitymedium">('.$langs->trans("Example").": \"frame-ancestors 'self'; default-src *; img-src * data:; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline';\")</span><br>";
|
||||
$examplecsprule = "frame-ancestors 'self'; img-src * data:; font-src *; default-src 'self' 'unsafe-inline' 'unsafe-eval' *.paypal.com *.stripe.com *.google.com *.googleapis.com *.google-analytics.com *.googletagmanager.com;";
|
||||
print '<strong>MAIN_SECURITY_FORCECSPRO</strong> = '.getDolGlobalString('MAIN_SECURITY_FORCECSP', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>').' <span class="opacitymedium">('.$langs->trans("Example").': "'.$examplecsprule.'")</span><br>';
|
||||
print '<br>';
|
||||
|
||||
$examplecsprule = "frame-ancestors 'self'; img-src * data:; font-src *; default-src 'self' 'unsafe-inline' 'unsafe-eval' *.paypal.com *.stripe.com *.google.com *.googleapis.com *.google-analytics.com *.googletagmanager.com;";
|
||||
print '<strong>MAIN_SECURITY_FORCECSP</strong> = '.getDolGlobalString('MAIN_SECURITY_FORCERP', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>').' <span class="opacitymedium">('.$langs->trans("Example").': "'.$examplecsprule.'")</span><br>';
|
||||
print '<br>';
|
||||
|
||||
print '<strong>MAIN_SECURITY_FORCERP</strong> = '.getDolGlobalString('MAIN_SECURITY_FORCERP', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>').' <span class="opacitymedium">('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or")." \"same-origin\" so browser doesn't send any referrer when going into another web site domain)</span><br>";
|
||||
print '<br>';
|
||||
|
||||
print '<strong>WEBSITE_MAIN_SECURITY_FORCECSP</strong> = '.getDolGlobalString('WEBSITE_MAIN_SECURITY_FORCECSP', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>');
|
||||
print ' <span class="opacitymedium">('.$langs->trans("Example").": \"frame-ancestors 'self'; default-src 'self' 'unsafe-inline'; style-src https://cdnjs.cloudflare.com https://fonts.googleapis.com 'unsafe-inline'; script-src https://cdn.transifex.com https://www.googletagmanager.com 'unsafe-inline'; object-src https://youtube.com; frame-src https://youtube.com; img-src * data:;\")</span><br>";
|
||||
print '<strong>WEBSITE_MAIN_SECURITY_FORCECSPRO</strong> = '.getDolGlobalString('WEBSITE_MAIN_SECURITY_FORCECSPRO', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>');
|
||||
print ' <span class="opacitymedium">('.$langs->trans("Example").": \"frame-ancestors 'self'; default-src 'self' 'unsafe-inline'; style-src https://cdnjs.cloudflare.com *.googleapis.com; script-src *.transifex.com *.google-analytics.com *.googletagmanager.com; object-src https://youtube.com; frame-src https://youtube.com; img-src * data:;\")</span><br>";
|
||||
print '<br>';
|
||||
|
||||
print '<strong>WEBSITE_MAIN_SECURITY_FORCECSP</strong> = '.getDolGlobalString('WEBSITE_MAIN_SECURITY_FORCECSP', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>');
|
||||
print ' <span class="opacitymedium">('.$langs->trans("Example").": \"frame-ancestors 'self'; default-src 'self' 'unsafe-inline'; style-src https://cdnjs.cloudflare.com *.googleapis.com; script-src *.transifex.com *.google-analytics.com *.googletagmanager.com; object-src https://youtube.com; frame-src https://youtube.com; img-src * data:;\")</span><br>";
|
||||
print '<br>';
|
||||
|
||||
print '<strong>WEBSITE_MAIN_SECURITY_FORCERP</strong> = '.getDolGlobalString('WEBSITE_MAIN_SECURITY_FORCERP', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>').' <span class="opacitymedium">('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or")." \"strict-origin-when-cross-origin\")</span><br>";
|
||||
|
||||
@ -329,7 +329,9 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Create third-party with contact if email not linked to a contact
|
||||
// Auto fill the contact found from email
|
||||
// This option is a serious security hole. it allowe to any non looged perso, to get the database of contacts
|
||||
/*
|
||||
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'))) {
|
||||
@ -342,6 +344,7 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
|
||||
print $form->textwithpicto('', $langs->trans("TicketCreateThirdPartyWithContactIfNotExistHelp"), 1, 'help');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
*/
|
||||
|
||||
/*if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||
{
|
||||
|
||||
@ -302,6 +302,7 @@ class DolibarrApi
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
||||
/**
|
||||
* Return if a $sqlfilters parameter is valid
|
||||
* Function no more used. Kept for backward compatibility with old APIs of modules
|
||||
*
|
||||
* @param string $sqlfilters sqlfilter string
|
||||
* @param string $error Error message
|
||||
@ -317,7 +318,8 @@ class DolibarrApi
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
||||
/**
|
||||
* Function to forge a SQL criteria from a Generic filter string
|
||||
* Function to forge a SQL criteria from a Generic filter string.
|
||||
* Function no more used. Kept for backward compatibility with old APIs of modules
|
||||
*
|
||||
* @param array $matches Array of found string by regex search.
|
||||
* Each entry is 1 and only 1 criteria.
|
||||
|
||||
@ -751,7 +751,7 @@ class Documents extends DolibarrApi
|
||||
throw new RestException(500, "Failed to open file '".$destfiletmp."' for write");
|
||||
}
|
||||
|
||||
$result = dol_move($destfiletmp, $destfile, 0, $overwriteifexists, 1);
|
||||
$result = dol_move($destfiletmp, $destfile, 0, $overwriteifexists, 1, 1);
|
||||
if (!$result) {
|
||||
throw new RestException(500, "Failed to move file into '".$destfile."'");
|
||||
}
|
||||
|
||||
@ -77,11 +77,10 @@ class Setup extends DolibarrApi
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||
if ($errormessage) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
|
||||
@ -141,11 +140,10 @@ class Setup extends DolibarrApi
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||
if ($errormessage) {
|
||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
|
||||
@ -206,11 +204,10 @@ class Setup extends DolibarrApi
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||
if ($errormessage) {
|
||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
|
||||
@ -277,11 +274,10 @@ class Setup extends DolibarrApi
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||
if ($errormessage) {
|
||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
$sql .= $this->db->order($sortfield, $sortorder);
|
||||
@ -378,11 +374,10 @@ class Setup extends DolibarrApi
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||
if ($errormessage) {
|
||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
$sql .= $this->db->order($sortfield, $sortorder);
|
||||
@ -550,11 +545,10 @@ class Setup extends DolibarrApi
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||
if ($errormessage) {
|
||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
|
||||
@ -665,11 +659,10 @@ class Setup extends DolibarrApi
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||
if ($errormessage) {
|
||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
|
||||
@ -729,11 +722,10 @@ class Setup extends DolibarrApi
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||
if ($errormessage) {
|
||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
|
||||
@ -798,11 +790,10 @@ class Setup extends DolibarrApi
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||
if ($errormessage) {
|
||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
|
||||
@ -864,11 +855,10 @@ class Setup extends DolibarrApi
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||
if ($errormessage) {
|
||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
|
||||
@ -939,11 +929,10 @@ class Setup extends DolibarrApi
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||
if ($errormessage) {
|
||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
|
||||
@ -1010,11 +999,10 @@ class Setup extends DolibarrApi
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||
if ($errormessage) {
|
||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
$sql .= $this->db->order($sortfield, $sortorder);
|
||||
@ -1084,11 +1072,10 @@ class Setup extends DolibarrApi
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||
if ($errormessage) {
|
||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
|
||||
@ -1149,11 +1136,10 @@ class Setup extends DolibarrApi
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||
if ($errormessage) {
|
||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
|
||||
@ -1209,11 +1195,10 @@ class Setup extends DolibarrApi
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||
if ($errormessage) {
|
||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
|
||||
@ -1270,11 +1255,10 @@ class Setup extends DolibarrApi
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||
if ($errormessage) {
|
||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
|
||||
@ -1333,11 +1317,10 @@ class Setup extends DolibarrApi
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||
if ($errormessage) {
|
||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
|
||||
@ -1392,11 +1375,10 @@ class Setup extends DolibarrApi
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||
if ($errormessage) {
|
||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
|
||||
@ -1458,11 +1440,10 @@ class Setup extends DolibarrApi
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||
if ($errormessage) {
|
||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
|
||||
@ -1519,11 +1500,10 @@ class Setup extends DolibarrApi
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||
if ($errormessage) {
|
||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
|
||||
@ -1582,11 +1562,10 @@ class Setup extends DolibarrApi
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||
if ($errormessage) {
|
||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
|
||||
@ -1646,11 +1625,10 @@ class Setup extends DolibarrApi
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||
if ($errormessage) {
|
||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -98,7 +98,7 @@ class Asset extends CommonObject
|
||||
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"),
|
||||
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>20, 'notnull'=>1, 'visible'=>1, 'noteditable'=>'0', 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'validate'=>'1', 'comment'=>"Reference of object"),
|
||||
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'cssview'=>'wordbreak', 'showoncombobox'=>'2', 'validate'=>'1',),
|
||||
'fk_asset_model' => array('type'=>'integer:AssetModel:asset/class/assetmodel.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'AssetModel', 'enabled'=>'1', 'position'=>40, 'notnull'=>0, 'visible'=>1, 'index'=>1, 'validate'=>'1',),
|
||||
'fk_asset_model' => array('type'=>'integer:AssetModel:asset/class/assetmodel.class.php:1:((status:=:1) and (entity:IN:__SHARED_ENTITIES__))', 'label'=>'AssetModel', 'enabled'=>'1', 'position'=>40, 'notnull'=>0, 'visible'=>1, 'index'=>1, 'validate'=>'1',),
|
||||
'qty' => array('type'=>'real', 'label'=>'Qty', 'enabled'=>'1', 'position'=>50, 'notnull'=>1, 'visible'=>0, 'default'=>'1', 'isameasure'=>'1', 'css'=>'maxwidth75imp', 'validate'=>'1',),
|
||||
'acquisition_type' => array('type'=>'smallint', 'label'=>'AssetAcquisitionType', 'enabled'=>'1', 'position'=>60, 'notnull'=>1, 'visible'=>1, 'arrayofkeyval'=>array('0'=>'AssetAcquisitionTypeNew', '1'=>'AssetAcquisitionTypeOccasion'), 'validate'=>'1',),
|
||||
'asset_type' => array('type'=>'smallint', 'label'=>'AssetType', 'enabled'=>'1', 'position'=>70, 'notnull'=>1, 'visible'=>1, 'arrayofkeyval'=>array('0'=>'AssetTypeIntangible', '1'=>'AssetTypeTangible', '2'=>'AssetTypeInProgress', '3'=>'AssetTypeFinancial'), 'validate'=>'1',),
|
||||
|
||||
@ -150,11 +150,10 @@ class Boms extends DolibarrApi
|
||||
}
|
||||
if ($sqlfilters) {
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||
if ($errormessage) {
|
||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
$sql .= $this->db->order($sortfield, $sortorder);
|
||||
|
||||
@ -1589,7 +1589,7 @@ class BOM extends CommonObject
|
||||
$return .= '<br><span class="info-box-label">'.$prod->getNomUrl(1).'</span>';
|
||||
}
|
||||
if (method_exists($this, 'getLibStatut')) {
|
||||
$return .= '<br><div class="info-box-status margintoponly">'.$this->getLibStatut(5).'</div>';
|
||||
$return .= '<br><div class="info-box-status margintoponly">'.$this->getLibStatut(3).'</div>';
|
||||
}
|
||||
|
||||
$return .= '</div>';
|
||||
|
||||
@ -156,20 +156,31 @@ function mrpCollapseBomManagement()
|
||||
<script type="text/javascript" language="javascript">
|
||||
|
||||
$(document).ready(function () {
|
||||
// When clicking on collapse
|
||||
$(".collapse_bom").click(function() {
|
||||
console.log("We click on collapse");
|
||||
var id_bom_line = $(this).attr('id').replace('collapse-', '');
|
||||
console.log($(this).html().indexOf('folder-open'));
|
||||
if($(this).html().indexOf('folder-open') <= 0) {
|
||||
function folderManage(element, onClose = 0) {
|
||||
let id_bom_line = element.attr('id').replace('collapse-', '');
|
||||
let TSubLines = $('[parentid="'+ id_bom_line +'"]');
|
||||
|
||||
if(element.html().indexOf('folder-open') <= 0 && onClose < 1) {
|
||||
$('[parentid="'+ id_bom_line +'"]').show();
|
||||
$(this).html('<?php echo dol_escape_js(img_picto('', 'folder-open')); ?>');
|
||||
element.html('<?php echo dol_escape_js(img_picto('', 'folder-open')); ?>');
|
||||
}
|
||||
else {
|
||||
$('[parentid="'+ id_bom_line +'"]').hide();
|
||||
$(this).html('<?php echo dol_escape_js(img_picto('', 'folder')); ?>');
|
||||
}
|
||||
for (let i = 0; i < TSubLines.length; i++) {
|
||||
let subBomFolder = $(TSubLines[i]).children('.linecoldescription').children('.collapse_bom');
|
||||
|
||||
if (subBomFolder.length > 0) {
|
||||
onClose = 1
|
||||
folderManage(subBomFolder, onClose);
|
||||
}
|
||||
}
|
||||
TSubLines.hide();
|
||||
element.html('<?php echo dol_escape_js(img_picto('', 'folder')); ?>');
|
||||
}
|
||||
}
|
||||
|
||||
// When clicking on collapse
|
||||
$(".collapse_bom").click(function() {
|
||||
folderManage($(this));
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
@ -64,7 +64,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) {
|
||||
print '</td>';
|
||||
echo '<td class="linkedcol-date">'.dol_print_date($objectlink->date_creation, 'day').'</td>';
|
||||
echo '<td class="linkedcol-amount right">';
|
||||
if ($user->rights->commande->lire) {
|
||||
if ($user->hasRight('commande', 'lire')) {
|
||||
$total = $total + $objectlink->total_ht;
|
||||
echo price($objectlink->total_ht);
|
||||
}
|
||||
|
||||
@ -88,8 +88,8 @@ if ($id > 0 || !empty($ref)) {
|
||||
// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
|
||||
$enablepermissioncheck = 0;
|
||||
if ($enablepermissioncheck) {
|
||||
$permissiontoread = $user->rights->bookcal->availabilities->read;
|
||||
$permissiontoadd = $user->rights->bookcal->availabilities->write;
|
||||
$permissiontoread = $user->hasRight('bookcal', 'availabilities', 'read');
|
||||
$permissiontoadd = $user->hasRight('bookcal', 'availabilities', 'write');
|
||||
} else {
|
||||
$permissiontoread = 1;
|
||||
$permissiontoadd = 1;
|
||||
@ -100,7 +100,7 @@ if ($enablepermissioncheck) {
|
||||
//if ($user->socid > 0) $socid = $user->socid;
|
||||
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
|
||||
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
|
||||
if (empty($conf->bookcal->enabled)) accessforbidden();
|
||||
if (!isModEnabled('bookcal')) accessforbidden();
|
||||
if (!$permissiontoread) accessforbidden();
|
||||
|
||||
|
||||
|
||||
@ -77,11 +77,11 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be includ
|
||||
// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
|
||||
$enablepermissioncheck = 0;
|
||||
if ($enablepermissioncheck) {
|
||||
$permissiontoread = $user->rights->bookcal->availabilities->read;
|
||||
$permissiontoadd = $user->rights->bookcal->availabilities->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
|
||||
$permissiontodelete = $user->rights->bookcal->availabilities->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
|
||||
$permissionnote = $user->rights->bookcal->availabilities->write; // Used by the include of actions_setnotes.inc.php
|
||||
$permissiondellink = $user->rights->bookcal->availabilities->write; // Used by the include of actions_dellink.inc.php
|
||||
$permissiontoread = $user->hasRight('bookcal', 'availabilities', 'read');
|
||||
$permissiontoadd = $user->hasRight('bookcal', 'availabilities', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
|
||||
$permissiontodelete = $user->hasRight('bookcal', 'availabilities', 'delete') || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
|
||||
$permissionnote = $user->hasRight('bookcal', 'availabilities', 'write'); // Used by the include of actions_setnotes.inc.php
|
||||
$permissiondellink = $user->hasRight('bookcal', 'availabilities', 'write'); // Used by the include of actions_dellink.inc.php
|
||||
} else {
|
||||
$permissiontoread = 1;
|
||||
$permissiontoadd = 1; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
|
||||
@ -97,7 +97,7 @@ $upload_dir = $conf->bookcal->multidir_output[isset($object->entity) ? $object->
|
||||
//if ($user->socid > 0) $socid = $user->socid;
|
||||
//$isdraft = (isset($object->status) && ($object->status == $object::STATUS_DRAFT) ? 1 : 0);
|
||||
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
|
||||
if (empty($conf->bookcal->enabled)) accessforbidden();
|
||||
if (!isModEnabled('bookcal')) accessforbidden();
|
||||
if (!$permissiontoread) accessforbidden();
|
||||
|
||||
|
||||
|
||||
@ -53,8 +53,8 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be includ
|
||||
// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
|
||||
$enablepermissioncheck = 0;
|
||||
if ($enablepermissioncheck) {
|
||||
$permissiontoread = $user->rights->bookcal->availabilities->read;
|
||||
$permission = $user->rights->bookcal->availabilities->write;
|
||||
$permissiontoread = $user->hasRight('bookcal', 'availabilities', 'read');
|
||||
$permission = $user->hasRight('bookcal', 'availabilities', 'write');
|
||||
} else {
|
||||
$permissiontoread = 1;
|
||||
$permission = 1;
|
||||
@ -65,7 +65,7 @@ if ($enablepermissioncheck) {
|
||||
//if ($user->socid > 0) $socid = $user->socid;
|
||||
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
|
||||
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
|
||||
if (empty($conf->bookcal->enabled)) accessforbidden();
|
||||
if (!isModEnabled('bookcal')) accessforbidden();
|
||||
if (!$permissiontoread) accessforbidden();
|
||||
|
||||
|
||||
|
||||
@ -78,8 +78,8 @@ if ($id > 0 || !empty($ref)) {
|
||||
// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
|
||||
$enablepermissioncheck = 0;
|
||||
if ($enablepermissioncheck) {
|
||||
$permissiontoread = $user->rights->bookcal->availabilities->read;
|
||||
$permissiontoadd = $user->rights->bookcal->availabilities->write; // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php
|
||||
$permissiontoread = $user->hasRight('bookcal', 'availabilities', 'read');
|
||||
$permissiontoadd = $user->hasRight('bookcal', 'availabilities', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php
|
||||
} else {
|
||||
$permissiontoread = 1;
|
||||
$permissiontoadd = 1;
|
||||
@ -90,7 +90,7 @@ if ($enablepermissioncheck) {
|
||||
//if ($user->socid > 0) $socid = $user->socid;
|
||||
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
|
||||
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
|
||||
if (empty($conf->bookcal->enabled)) accessforbidden();
|
||||
if (!isModEnabled('bookcal')) accessforbidden();
|
||||
if (!$permissiontoread) accessforbidden();
|
||||
|
||||
|
||||
@ -192,9 +192,9 @@ if ($object->id) {
|
||||
print dol_get_fiche_end();
|
||||
|
||||
$modulepart = 'bookcal';
|
||||
//$permissiontoadd = $user->rights->bookcal->availabilities->write;
|
||||
//$permissiontoadd = $user->hasRight('bookcal', 'availabilities', 'write');
|
||||
$permissiontoadd = 1;
|
||||
//$permtoedit = $user->rights->bookcal->availabilities->write;
|
||||
//$permtoedit = $user->hasRight('bookcal', 'availabilities', 'write');
|
||||
$permtoedit = 1;
|
||||
$param = '&id='.$object->id;
|
||||
|
||||
|
||||
@ -132,9 +132,9 @@ $arrayfields = dol_sort_array($arrayfields, 'position');
|
||||
// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
|
||||
$enablepermissioncheck = 0;
|
||||
if ($enablepermissioncheck) {
|
||||
$permissiontoread = $user->rights->bookcal->availabilities->read;
|
||||
$permissiontoadd = $user->rights->bookcal->availabilities->write;
|
||||
$permissiontodelete = $user->rights->bookcal->availabilities->delete;
|
||||
$permissiontoread = $user->hasRight('bookcal', 'availabilities', 'read');
|
||||
$permissiontoadd = $user->hasRight('bookcal', 'availabilities', 'write');
|
||||
$permissiontodelete = $user->hasRight('bookcal', 'availabilities', 'delete');
|
||||
} else {
|
||||
$permissiontoread = 1;
|
||||
$permissiontoadd = 1;
|
||||
@ -147,7 +147,7 @@ if ($user->socid > 0) accessforbidden();
|
||||
//$socid = 0; if ($user->socid > 0) $socid = $user->socid;
|
||||
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
|
||||
//restrictedArea($user, $object->element, 0, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
|
||||
if (empty($conf->bookcal->enabled)) accessforbidden('Module not enabled');
|
||||
if (!isModEnabled('bookcal')) accessforbidden('Module not enabled');
|
||||
if (!$permissiontoread) accessforbidden();
|
||||
|
||||
|
||||
|
||||
@ -56,9 +56,9 @@ if ($id > 0 || !empty($ref)) {
|
||||
// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
|
||||
$enablepermissioncheck = 0;
|
||||
if ($enablepermissioncheck) {
|
||||
$permissiontoread = $user->rights->bookcal->availabilities->read;
|
||||
$permissiontoadd = $user->rights->bookcal->availabilities->write;
|
||||
$permissionnote = $user->rights->bookcal->availabilities->write; // Used by the include of actions_setnotes.inc.php
|
||||
$permissiontoread = $user->hasRight('bookcal', 'availabilities', 'read');
|
||||
$permissiontoadd = $user->hasRight('bookcal', 'availabilities', 'write');
|
||||
$permissionnote = $user->hasRight('bookcal', 'availabilities', 'write'); // Used by the include of actions_setnotes.inc.php
|
||||
} else {
|
||||
$permissiontoread = 1;
|
||||
$permissiontoadd = 1;
|
||||
@ -70,7 +70,7 @@ if ($enablepermissioncheck) {
|
||||
//if ($user->socid > 0) $socid = $user->socid;
|
||||
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
|
||||
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
|
||||
if (empty($conf->bookcal->enabled)) accessforbidden();
|
||||
if (!isModEnabled('bookcal')) accessforbidden();
|
||||
if (!$permissiontoread) accessforbidden();
|
||||
|
||||
|
||||
|
||||
@ -71,7 +71,7 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
|
||||
|
||||
// BEGIN MODULEBUILDER DRAFT MYOBJECT
|
||||
// Draft MyObject
|
||||
if ($user->rights->bookcal->availabilities->read && !empty($conf->bookcal->enabled)) {
|
||||
if ($user->hasRight('bookcal', 'availabilities', 'read') && isModEnabled('bookcal')) {
|
||||
$langs->load("orders");
|
||||
|
||||
$sql = "SELECT rowid, `ref`, fk_soc, fk_project, description, note_public, note_private, date_creation, tms, fk_user_creat, fk_user_modif, last_main_doc, import_key, model_pdf, status, firstname, lastname, email, `start`, duration";
|
||||
@ -143,8 +143,7 @@ $max = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
|
||||
|
||||
/* BEGIN MODULEBUILDER LASTMODIFIED MYOBJECT
|
||||
// Last modified myobject
|
||||
if (! empty($conf->bookcal->enabled))
|
||||
{
|
||||
if (isModEnabled('bookcal')) {
|
||||
$sql = "SELECT rowid, `ref`, fk_soc, fk_project, description, note_public, note_private, date_creation, tms, fk_user_creat, fk_user_modif, last_main_doc, import_key, model_pdf, status, firstname, lastname, email, `start`, duration";
|
||||
$sql .= " FROM ". MAIN_DB_PREFIX . 'bookcal_booking';
|
||||
print "here2";
|
||||
|
||||
@ -100,7 +100,7 @@ if ($enablepermissioncheck) {
|
||||
//if ($user->socid > 0) $socid = $user->socid;
|
||||
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
|
||||
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
|
||||
if (empty($conf->bookcal->enabled)) accessforbidden();
|
||||
if (!isModEnabled('bookcal')) accessforbidden();
|
||||
if (!$permissiontoread) accessforbidden();
|
||||
|
||||
|
||||
|
||||
@ -97,7 +97,7 @@ $upload_dir = $conf->bookcal->multidir_output[isset($object->entity) ? $object->
|
||||
//if ($user->socid > 0) $socid = $user->socid;
|
||||
//$isdraft = (isset($object->status) && ($object->status == $object::STATUS_DRAFT) ? 1 : 0);
|
||||
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
|
||||
if (empty($conf->bookcal->enabled)) accessforbidden();
|
||||
if (!isModEnabled('bookcal')) accessforbidden();
|
||||
if (!$permissiontoread) accessforbidden();
|
||||
|
||||
|
||||
|
||||
@ -65,7 +65,7 @@ if ($enablepermissioncheck) {
|
||||
//if ($user->socid > 0) $socid = $user->socid;
|
||||
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
|
||||
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
|
||||
if (empty($conf->bookcal->enabled)) accessforbidden();
|
||||
if (!isModEnabled('bookcal')) accessforbidden();
|
||||
if (!$permissiontoread) accessforbidden();
|
||||
|
||||
|
||||
|
||||
@ -90,7 +90,7 @@ if ($enablepermissioncheck) {
|
||||
//if ($user->socid > 0) $socid = $user->socid;
|
||||
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
|
||||
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
|
||||
if (empty($conf->bookcal->enabled)) accessforbidden();
|
||||
if (!isModEnabled('bookcal')) accessforbidden();
|
||||
if (!$permissiontoread) accessforbidden();
|
||||
|
||||
|
||||
|
||||
@ -147,7 +147,7 @@ if ($user->socid > 0) accessforbidden();
|
||||
//$socid = 0; if ($user->socid > 0) $socid = $user->socid;
|
||||
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
|
||||
//restrictedArea($user, $object->element, 0, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
|
||||
if (empty($conf->bookcal->enabled)) accessforbidden('Module not enabled');
|
||||
if (!isModEnabled('bookcal')) accessforbidden('Module not enabled');
|
||||
if (!$permissiontoread) accessforbidden();
|
||||
|
||||
|
||||
|
||||
@ -70,7 +70,7 @@ if ($enablepermissioncheck) {
|
||||
//if ($user->socid > 0) $socid = $user->socid;
|
||||
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
|
||||
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
|
||||
if (empty($conf->bookcal->enabled)) accessforbidden();
|
||||
if (!isModEnabled('bookcal')) accessforbidden();
|
||||
if (!$permissiontoread) accessforbidden();
|
||||
|
||||
|
||||
|
||||
@ -201,7 +201,7 @@ class Availabilities extends CommonObject
|
||||
}
|
||||
|
||||
// Example to show how to set values of fields definition dynamically
|
||||
/*if ($user->rights->bookcal->availabilities->read) {
|
||||
/*if ($user->hasRight('bookcal', 'availabilities', 'read')) {
|
||||
$this->fields['myfield']['visible'] = 1;
|
||||
$this->fields['myfield']['noteditable'] = 0;
|
||||
}*/
|
||||
@ -516,7 +516,7 @@ class Availabilities extends CommonObject
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->bookcal->availabilities->write))
|
||||
/*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('bookcal', 'availabilities', 'write'))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->bookcal->availabilities->availabilities_advance->validate))))
|
||||
{
|
||||
$this->error='NotEnoughPermissions';
|
||||
|
||||
@ -104,7 +104,7 @@ class Booking extends CommonObject
|
||||
public $fields=array(
|
||||
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"),
|
||||
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>1.2, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'searchall'=>1, 'validate'=>'1', 'comment'=>"Reference of object"),
|
||||
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'picto'=>'company', 'enabled'=>'isModEnabled("societe")', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx', 'help'=>"LinkToThirparty", 'validate'=>'1',),
|
||||
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:((status:=:1) and (entity:IN:__SHARED_ENTITIES__))', 'label'=>'ThirdParty', 'picto'=>'company', 'enabled'=>'isModEnabled("societe")', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx', 'help'=>"LinkToThirparty", 'validate'=>'1',),
|
||||
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'picto'=>'project', 'enabled'=>'$conf->project->enabled', 'position'=>52, 'notnull'=>-1, 'visible'=>-1, 'index'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx', 'validate'=>'1',),
|
||||
'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>3, 'validate'=>'1',),
|
||||
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>61, 'notnull'=>0, 'visible'=>0, 'cssview'=>'wordbreak', 'validate'=>'1',),
|
||||
|
||||
@ -149,11 +149,10 @@ class Categories extends DolibarrApi
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||
if ($errormessage) {
|
||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
$sql .= $this->db->order($sortfield, $sortorder);
|
||||
|
||||
@ -176,7 +176,7 @@ if ($elemid && $action == 'addintocategory' &&
|
||||
($type == Categorie::TYPE_SUPPLIER && $user->rights->societe->creer) ||
|
||||
($type == Categorie::TYPE_TICKET && $user->rights->ticket->write) ||
|
||||
($type == Categorie::TYPE_PROJECT && $user->rights->projet->creer) ||
|
||||
($type == Categorie::TYPE_MEMBER && $user->rights->projet->creer) ||
|
||||
($type == Categorie::TYPE_MEMBER && $user->hasRight('adherent', 'creer')) ||
|
||||
($type == Categorie::TYPE_CONTACT && $user->rights->societe->creer) ||
|
||||
($type == Categorie::TYPE_USER && $user->rights->user->user->creer) ||
|
||||
($type == Categorie::TYPE_ACCOUNT && $user->rights->banque->configurer)
|
||||
|
||||
@ -1192,7 +1192,7 @@ if ($action == 'create') {
|
||||
print '<input type="hidden" name="donotclearsession" value="1">';
|
||||
print '<input type="hidden" name="page_y" value="">';
|
||||
if ($backtopage) {
|
||||
print '<input type="hidden" name="backtopage" value="'.($backtopage != '1' ? $backtopage : dol_htmlentities($_SERVER["HTTP_REFERER"])).'">';
|
||||
print '<input type="hidden" name="backtopage" value="'.($backtopage != '1' ? $backtopage : '').'">';
|
||||
}
|
||||
if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
|
||||
print '<input type="hidden" name="actioncode" value="'.dol_getIdFromCode($db, 'AC_OTH', 'c_actioncomm').'">';
|
||||
@ -1469,7 +1469,7 @@ if ($action == 'create') {
|
||||
print "\n".'<script type="text/javascript">';
|
||||
print '$(document).ready(function () {
|
||||
$("#projectid").change(function () {
|
||||
var url = "'.DOL_URL_ROOT.'/projet/ajax/projects.php?mode=gettasks&socid="+$("#projectid").val()+"&projectid="+$("#projectid").val();
|
||||
var url = "'.DOL_URL_ROOT.'/projet/ajax/projects.php?mode=gettasks&socid="+$("#search_socid").val()+"&projectid="+$("#projectid").val();
|
||||
console.log("Call url to get new list of tasks: "+url);
|
||||
$.get(url, function(data) {
|
||||
console.log(data);
|
||||
@ -1722,7 +1722,7 @@ if ($id > 0) {
|
||||
print '<input type="hidden" name="ref_ext" value="'.$object->ref_ext.'">';
|
||||
print '<input type="hidden" name="page_y" value="">';
|
||||
if ($backtopage) {
|
||||
print '<input type="hidden" name="backtopage" value="'.($backtopage != '1' ? $backtopage : dol_htmlentities($_SERVER["HTTP_REFERER"])).'">';
|
||||
print '<input type="hidden" name="backtopage" value="'.($backtopage != '1' ? $backtopage : '').'">';
|
||||
}
|
||||
if (empty($conf->global->AGENDA_USE_EVENT_TYPE) && ! preg_match('/^TICKET_MSG_PRIVATE/', $object->code)) {
|
||||
print '<input type="hidden" name="actioncode" value="'.$object->type_code.'">';
|
||||
|
||||
@ -742,8 +742,7 @@ class ActionComm extends CommonObject
|
||||
$action = '';
|
||||
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) {
|
||||
$this->errors += $hookmanager->errors;
|
||||
$this->error = $hookmanager->error;
|
||||
$this->setErrorsFromObject($hookmanager);
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
@ -2291,7 +2290,7 @@ class ActionComm extends CommonObject
|
||||
}
|
||||
|
||||
if ($result >= 0) {
|
||||
if (dol_move($outputfiletmp, $outputfile, 0, 1)) {
|
||||
if (dol_move($outputfiletmp, $outputfile, 0, 1, 0, 0)) {
|
||||
$result = 1;
|
||||
} else {
|
||||
$this->error = 'Failed to rename '.$outputfiletmp.' into '.$outputfile;
|
||||
@ -2551,7 +2550,7 @@ class ActionComm extends CommonObject
|
||||
}
|
||||
|
||||
// Sender
|
||||
$from = $conf->global->MAIN_MAIL_EMAIL_FROM;
|
||||
$from = getDolGlobalString('MAIN_MAIL_EMAIL_FROM');
|
||||
if (empty($from)) {
|
||||
$errormesg = "Failed to get sender into global setup MAIN_MAIL_EMAIL_FROM";
|
||||
$error++;
|
||||
@ -2559,7 +2558,7 @@ class ActionComm extends CommonObject
|
||||
|
||||
if (!$error) {
|
||||
// Errors Recipient
|
||||
$errors_to = $conf->global->MAIN_MAIL_ERRORS_TO;
|
||||
$errors_to = getDolGlobalString('MAIN_MAIL_ERRORS_TO');
|
||||
|
||||
// Mail Creation
|
||||
$cMailFile = new CMailFile($sendTopic, $to, $from, $sendContent, array(), array(), array(), '', "", 0, 1, $errors_to, '', '', '', '', '');
|
||||
|
||||
@ -101,6 +101,10 @@ class ActionCommReminder extends CommonObject
|
||||
public $entity;
|
||||
|
||||
public $dateremind;
|
||||
|
||||
/**
|
||||
* @var string reminder type email, browser, sms
|
||||
*/
|
||||
public $typeremind;
|
||||
|
||||
/**
|
||||
@ -108,7 +112,14 @@ class ActionCommReminder extends CommonObject
|
||||
*/
|
||||
public $fk_user;
|
||||
|
||||
/**
|
||||
* @var int offset value
|
||||
*/
|
||||
public $offsetvalue;
|
||||
|
||||
/**
|
||||
* @var string y, m, d, w, h, i
|
||||
*/
|
||||
public $offsetunit;
|
||||
|
||||
/**
|
||||
@ -130,11 +141,8 @@ class ActionCommReminder extends CommonObject
|
||||
* @var int Template Mail
|
||||
*/
|
||||
public $fk_email_template;
|
||||
|
||||
// END MODULEBUILDER PROPERTIES
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
|
||||
@ -159,11 +159,10 @@ class AgendaEvents extends DolibarrApi
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||
if ($errormessage) {
|
||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
$sql .= $this->db->order($sortfield, $sortorder);
|
||||
|
||||
@ -415,7 +415,7 @@ if ($usergroup > 0) {
|
||||
}
|
||||
$sql .= " s.nom as societe, s.rowid as socid, s.client, s.email as socemail,";
|
||||
$sql .= " a.id, a.code, a.label, a.note, a.datep as dp, a.datep2 as dp2, a.fulldayevent, a.location,";
|
||||
$sql .= ' a.fk_user_author,a.fk_user_action,';
|
||||
$sql .= " a.fk_user_author, a.fk_user_action,";
|
||||
$sql .= " a.fk_contact, a.note, a.percent as percent,";
|
||||
$sql .= " a.fk_element, a.elementtype, a.datec, a.tms as datem,";
|
||||
$sql .= " c.code as type_code, c.libelle as type_label, c.color as type_color, c.type as type_type, c.picto as type_picto,";
|
||||
@ -933,6 +933,7 @@ while ($i < $imaxinloop) {
|
||||
$actionstatic->note_private = dol_htmlentitiesbr($obj->note);
|
||||
$actionstatic->datep = $db->jdate($obj->dp);
|
||||
$actionstatic->percentage = $obj->percent;
|
||||
$actionstatic->authorid = $obj->fk_user_author;
|
||||
|
||||
// Initialize $this->userassigned && this->socpeopleassigned array && this->userownerid
|
||||
// but only if we need it
|
||||
@ -1010,7 +1011,8 @@ while ($i < $imaxinloop) {
|
||||
|
||||
// User owner
|
||||
if (!empty($arrayfields['owner']['checked'])) {
|
||||
print '<td class="tdoverflowmax150"' . ($event_owner_style != '' ? ' style="'.$event_owner_style.'"' : '') . '>'; // With edge and chrome the td overflow is not supported correctly when content is not full text.
|
||||
//print '<td class="tdoverflowmax150"' . ($event_owner_style != '' ? ' style="'.$event_owner_style.'"' : '') . '>';
|
||||
print '<td class="tdoverflowmax150">';
|
||||
if ($obj->fk_user_action > 0 && !isset($cache_user_list[$obj->fk_user_action])) {
|
||||
$userstatic = new User($db);
|
||||
$res = $userstatic->fetch($obj->fk_user_action);
|
||||
|
||||
@ -43,19 +43,21 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
$langs->load("mails");
|
||||
|
||||
$id = (GETPOST('mailid', 'int') ? GETPOST('mailid', 'int') : GETPOST('id', 'int'));
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$cancel = GETPOST('cancel');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$cancel = GETPOST('cancel', 'aZ09');
|
||||
$urlfrom = GETPOST('urlfrom');
|
||||
|
||||
// Initialize technical objects
|
||||
$object = new Mailing($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
if ($id > 0) {
|
||||
$result = $object->fetch($id);
|
||||
}
|
||||
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
// Fetch optionals attributes and labels
|
||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
@ -201,9 +203,9 @@ if (empty($reshook)) {
|
||||
|
||||
$thirdpartystatic = new Societe($db);
|
||||
// Loop on each email and send it
|
||||
$i = 0;
|
||||
$iforemailloop = 0;
|
||||
|
||||
while ($i < $num && $i < $conf->global->MAILING_LIMIT_SENDBYWEB) {
|
||||
while ($iforemailloop < $num && $iforemailloop < $conf->global->MAILING_LIMIT_SENDBYWEB) {
|
||||
// Here code is common with same loop ino mailing-send.php
|
||||
$res = 1;
|
||||
$now = dol_now();
|
||||
@ -223,7 +225,6 @@ if (empty($reshook)) {
|
||||
|
||||
$signature = ((!empty($user->signature) && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $user->signature : '');
|
||||
|
||||
$targetobject = null; // Not defined with mass emailing
|
||||
$parameters = array('mode'=>'emailing');
|
||||
$substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount'), $targetobject); // Note: On mass emailing, this is null because be don't know object
|
||||
|
||||
@ -249,9 +250,9 @@ if (empty($reshook)) {
|
||||
$substitutionarray['__OTHER5__'] = $other5;
|
||||
$substitutionarray['__USER_SIGNATURE__'] = $signature; // Signature is empty when ran from command line or taken from user in parameter)
|
||||
$substitutionarray['__SENDEREMAIL_SIGNATURE__'] = $signature; // Signature is empty when ran from command line or taken from user in parameter)
|
||||
$substitutionarray['__CHECK_READ__'] = '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.urlencode($obj->tag).'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'&email='.urlencode($obj->email).'&mtid='.$obj->rowid.'" width="1" height="1" style="width:1px;height:1px" border="0"/>';
|
||||
$substitutionarray['__UNSUBSCRIBE__'] = '<a href="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.urlencode($obj->tag).'&unsuscrib=1&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'&email='.urlencode($obj->email).'&mtid='.$obj->rowid.'" target="_blank" rel="noopener noreferrer">'.$langs->trans("MailUnsubcribe").'</a>';
|
||||
$substitutionarray['__UNSUBSCRIBE_URL__'] = DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.urlencode($obj->tag).'&unsuscrib=1&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'&email='.urlencode($obj->email).'&mtid='.$obj->rowid;
|
||||
$substitutionarray['__CHECK_READ__'] = '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.urlencode($obj->tag).'&securitykey='.dol_hash($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY.'-'.$obj->tag.'-'.$obj->email.'-'.$obj->rowid, "md5").'&email='.urlencode($obj->email).'&mtid='.((int) $obj->rowid).'" width="1" height="1" style="width:1px;height:1px" border="0"/>';
|
||||
$substitutionarray['__UNSUBSCRIBE__'] = '<a href="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.urlencode($obj->tag).'&unsuscrib=1&securitykey='.dol_hash($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY.'-'.$obj->tag.'-'.$obj->email.'-'.$obj->rowid, "md5").'&email='.urlencode($obj->email).'&mtid='.((int) $obj->rowid).'" target="_blank" rel="noopener noreferrer">'.$langs->trans("MailUnsubcribe").'</a>';
|
||||
$substitutionarray['__UNSUBSCRIBE_URL__'] = DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.urlencode($obj->tag).'&unsuscrib=1&securitykey='.dol_hash($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY.'-'.$obj->tag.'-'.$obj->email.'-'.$obj->rowid, "md5").'&email='.urlencode($obj->email).'&mtid='.((int) $obj->rowid);
|
||||
|
||||
$onlinepaymentenabled = 0;
|
||||
if (isModEnabled('paypal')) {
|
||||
@ -324,7 +325,7 @@ if (empty($reshook)) {
|
||||
$newmessage = make_substitutions($message, $substitutionarray, null, 0);
|
||||
|
||||
$moreinheader = '';
|
||||
if (preg_match('/__UNSUBSCRIBE__/', $message)) {
|
||||
if (preg_match('/__UNSUBSCRIBE_(_|URL_)/', $message)) {
|
||||
$moreinheader = "List-Unsubscribe: <__UNSUBSCRIBE_URL__>\n";
|
||||
$moreinheader = make_substitutions($moreinheader, $substitutionarray);
|
||||
}
|
||||
@ -366,7 +367,7 @@ if (empty($reshook)) {
|
||||
// Mail successful
|
||||
$nbok++;
|
||||
|
||||
dol_syslog("comm/mailing/card.php: ok for #".$i.($mail->error ? ' - '.$mail->error : ''), LOG_DEBUG);
|
||||
dol_syslog("comm/mailing/card.php: ok for #".$iforemailloop.($mail->error ? ' - '.$mail->error : ''), LOG_DEBUG);
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
|
||||
$sql .= " SET statut=1, date_envoi = '".$db->idate($now)."' WHERE rowid=".((int) $obj->rowid);
|
||||
@ -374,7 +375,7 @@ if (empty($reshook)) {
|
||||
if (!$resql2) {
|
||||
dol_print_error($db);
|
||||
} else {
|
||||
//if cheack read is use then update prospect contact status
|
||||
//if check read is use then update prospect contact status
|
||||
if (strpos($message, '__CHECK_READ__') !== false) {
|
||||
//Update status communication of thirdparty prospect
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=2 WHERE rowid IN (SELECT source_id FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE rowid=".((int) $obj->rowid).")";
|
||||
@ -405,7 +406,7 @@ if (empty($reshook)) {
|
||||
// Mail failed
|
||||
$nbko++;
|
||||
|
||||
dol_syslog("comm/mailing/card.php: error for #".$i.($mail->error ? ' - '.$mail->error : ''), LOG_WARNING);
|
||||
dol_syslog("comm/mailing/card.php: error for #".$iforemailloop.($mail->error ? ' - '.$mail->error : ''), LOG_WARNING);
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
|
||||
$sql .= " SET statut=-1, error_text='".$db->escape($mail->error)."', date_envoi='".$db->idate($now)."' WHERE rowid=".((int) $obj->rowid);
|
||||
@ -415,7 +416,7 @@ if (empty($reshook)) {
|
||||
}
|
||||
}
|
||||
|
||||
$i++;
|
||||
$iforemailloop++;
|
||||
}
|
||||
} else {
|
||||
setEventMessages($langs->transnoentitiesnoconv("NoMoreRecipientToSendTo"), null, 'mesgs');
|
||||
@ -468,19 +469,28 @@ if (empty($reshook)) {
|
||||
|
||||
if (!$error) {
|
||||
// Is the message in html
|
||||
$msgishtml = -1; // Unknow by default
|
||||
$msgishtml = -1; // Unknow = autodetect by default
|
||||
if (preg_match('/[\s\t]*<html>/i', $object->body)) {
|
||||
$msgishtml = 1;
|
||||
}
|
||||
|
||||
$signature = ((!empty($user->signature) && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $user->signature : '');
|
||||
|
||||
$parameters = array('mode'=>'emailing');
|
||||
$substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount'), $targetobject); // Note: On mass emailing, this is null because be don't know object
|
||||
|
||||
// other are set at begin of page
|
||||
$object->substitutionarrayfortest['__EMAIL__'] = $object->sendto;
|
||||
$object->substitutionarrayfortest['__MAILTOEMAIL__'] = '<a href="mailto:'.$object->sendto.'">'.$object->sendto.'</a>';
|
||||
$substitutionarray['__EMAIL__'] = $object->sendto;
|
||||
$substitutionarray['__MAILTOEMAIL__'] = '<a href="mailto:'.$object->sendto.'">'.$object->sendto.'</a>';
|
||||
$substitutionarray['__CHECK_READ__'] = '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag=undefinedintestmode&securitykey='.dol_hash($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY."-undefinedintestmode-".$obj->sendto."-0", 'md5').'&email='.urlencode($obj->sendto).'&mtid=0" width="1" height="1" style="width:1px;height:1px" border="0"/>';
|
||||
$substitutionarray['__UNSUBSCRIBE__'] = '<a href="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag=undefinedintestmode&unsuscrib=1&securitykey='.dol_hash($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY."-undefinedintestmode-".$obj->sendto."-0", 'md5').'&email='.urlencode($obj->sendto).'&mtid=0" target="_blank" rel="noopener noreferrer">'.$langs->trans("MailUnsubcribe").'</a>';
|
||||
$substitutionarray['__UNSUBSCRIBE_URL__'] = DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag=undefinedintestmode&unsuscrib=1&securitykey='.dol_hash($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY."-undefinedintestmode-".$obj->sendto."-0", 'md5').'&email='.urlencode($obj->sendto).'&mtid=0';
|
||||
|
||||
// Subject and message substitutions
|
||||
complete_substitutions_array($object->substitutionarrayfortest, $langs);
|
||||
$tmpsujet = make_substitutions($object->sujet, $object->substitutionarrayfortest);
|
||||
$tmpbody = make_substitutions($object->body, $object->substitutionarrayfortest);
|
||||
complete_substitutions_array($substitutionarray, $langs, $targetobject);
|
||||
|
||||
$tmpsujet = make_substitutions($object->sujet, $substitutionarray);
|
||||
$tmpbody = make_substitutions($object->body, $substitutionarray);
|
||||
|
||||
$arr_file = array();
|
||||
$arr_mime = array();
|
||||
@ -765,7 +775,7 @@ if ($action == 'create') {
|
||||
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("MailFrom").'</td><td><input class="flat minwidth200" name="from" value="'.getDolGlobalString('MAILING_EMAIL_FROM').'"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("MailErrorsTo").'</td><td><input class="flat minwidth200" name="errorsto" value="'.(getDolGlobalString('MAILING_EMAIL_ERRORSTO', getDolGlobalString('MAIN_MAIL_ERRORS_TO'))).'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("MailErrorsTo").'</td><td><input class="flat minwidth200" name="errorsto" value="'.getDolGlobalString('MAILING_EMAIL_ERRORSTO', getDolGlobalString('MAIN_MAIL_ERRORS_TO')).'"></td></tr>';
|
||||
|
||||
// Other attributes
|
||||
$parameters = array();
|
||||
@ -890,15 +900,21 @@ if ($action == 'create') {
|
||||
if (!isset($conf->global->MAILING_LIMIT_SENDBYCLI) || $conf->global->MAILING_LIMIT_SENDBYCLI >= 0) {
|
||||
$text .= '<br><br>';
|
||||
$text .= $langs->trans("MailingNeedCommand");
|
||||
$text .= '<br><textarea cols="60" rows="'.ROWS_2.'" wrap="soft" disabled>php ./scripts/emailings/mailing-send.php '.$object->id.' '.$user->login.'</textarea>';
|
||||
$text .= '<br><textarea class="quatrevingtpercent" rows="'.ROWS_2.'" wrap="soft" disabled>php ./scripts/emailings/mailing-send.php '.$object->id.' '.$user->login.'</textarea>';
|
||||
}
|
||||
|
||||
print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('SendMailing'), $text, 'sendallconfirmed', '', '', 1, 330, 600, 0, $langs->trans("Confirm"), $langs->trans("Cancel"));
|
||||
print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('SendMailing'), $text, 'sendallconfirmed', '', '', 1, 380, 660, 0, $langs->trans("Confirm"), $langs->trans("Cancel"));
|
||||
}
|
||||
}
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/comm/mailing/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
$morehtmlref = '<div class="refidno">';
|
||||
// Ref customer
|
||||
$morehtmlref .= $form->editfieldkey("", 'title', $object->title, $object, $user->hasRight('mailing', 'creer'), 'string', '', 0, 1);
|
||||
$morehtmlref .= $form->editfieldval("", 'title', $object->title, $object, $user->hasRight('mailing', 'creer'), 'string', '', null, null, '', 1);
|
||||
$morehtmlref .= '</div>';
|
||||
|
||||
$morehtmlright = '';
|
||||
$nbtry = $nbok = 0;
|
||||
if ($object->statut == 2 || $object->statut == 3) {
|
||||
@ -912,7 +928,7 @@ if ($action == 'create') {
|
||||
$morehtmlright .= ') ';
|
||||
}
|
||||
|
||||
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright);
|
||||
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
@ -920,14 +936,16 @@ if ($action == 'create') {
|
||||
print '<table class="border centpercent tableforfield">';
|
||||
|
||||
// Description
|
||||
/*
|
||||
print '<tr><td class="titlefield">';
|
||||
print $form->editfieldkey("MailTitle", 'title', $object->title, $object, $user->hasRight('mailing', 'creer'), 'string');
|
||||
print '</td><td>';
|
||||
print $form->editfieldval("MailTitle", 'title', $object->title, $object, $user->hasRight('mailing', 'creer'), 'string');
|
||||
print '</td></tr>';
|
||||
*/
|
||||
|
||||
// From
|
||||
print '<tr><td>';
|
||||
print '<tr><td class="titlefield">';
|
||||
print $form->editfieldkey("MailFrom", 'email_from', $object->email_from, $object, $user->hasRight('mailing', 'creer') && $object->statut < 3, 'string');
|
||||
print '</td><td>';
|
||||
print $form->editfieldval("MailFrom", 'email_from', $object->email_from, $object, $user->hasRight('mailing', 'creer') && $object->statut < 3, 'string');
|
||||
|
||||
@ -73,17 +73,19 @@ $result = $object->fetch($id);
|
||||
$hookmanager->initHooks(array('ciblescard', 'globalcard'));
|
||||
|
||||
// Security check
|
||||
if (!$user->rights->mailing->lire || (empty($conf->global->EXTERNAL_USERS_ARE_AUTHORIZED) && $user->socid > 0)) {
|
||||
if (!$user->hasRight('mailing', 'lire') || (empty($conf->global->EXTERNAL_USERS_ARE_AUTHORIZED) && $user->socid > 0)) {
|
||||
accessforbidden();
|
||||
}
|
||||
//$result = restrictedArea($user, 'mailing');
|
||||
|
||||
$sqlmessage = '';
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'add') {
|
||||
if ($action == 'add' && $user->hasRight('mailing', 'creer')) { // Add recipients
|
||||
$module = GETPOST("module", 'alpha');
|
||||
$result = -1;
|
||||
|
||||
@ -103,6 +105,8 @@ if ($action == 'add') {
|
||||
$obj = new $classname($db);
|
||||
dol_syslog("Call add_to_target on class ".$classname);
|
||||
$result = $obj->add_to_target($id);
|
||||
|
||||
$sqlmessage = $obj->sql;
|
||||
}
|
||||
}
|
||||
if ($result > 0) {
|
||||
@ -117,7 +121,7 @@ if ($action == 'add') {
|
||||
}
|
||||
}
|
||||
|
||||
if (GETPOST('clearlist', 'int')) {
|
||||
if (GETPOST('clearlist', 'int') && $user->hasRight('mailing', 'creer')) {
|
||||
// Loading Class
|
||||
$obj = new MailingTargets($db);
|
||||
$obj->clear_target($id);
|
||||
@ -127,7 +131,7 @@ if (GETPOST('clearlist', 'int')) {
|
||||
*/
|
||||
}
|
||||
|
||||
if (GETPOST('exportcsv', 'int')) {
|
||||
if (GETPOST('exportcsv', 'int') && $user->hasRight('mailing', 'lire')) {
|
||||
$completefilename = 'targets_emailing'.$object->id.'_'.dol_print_date(dol_now(), 'dayhourlog').'.csv';
|
||||
header('Content-Type: text/csv');
|
||||
header('Content-Disposition: attachment;filename='.$completefilename);
|
||||
@ -166,7 +170,7 @@ if (GETPOST('exportcsv', 'int')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($action == 'delete') {
|
||||
if ($action == 'delete' && $user->hasRight('mailing', 'creer')) {
|
||||
// Ici, rowid indique le destinataire et id le mailing
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE rowid = ".((int) $rowid);
|
||||
$resql = $db->query($sql);
|
||||
@ -212,6 +216,12 @@ if ($object->fetch($id) >= 0) {
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/comm/mailing/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
$morehtmlref = '<div class="refidno">';
|
||||
// Ref customer
|
||||
$morehtmlref .= $form->editfieldkey("", 'title', $object->title, $object, 0, 'string', '', 0, 1);
|
||||
$morehtmlref .= $form->editfieldval("", 'title', $object->title, $object, 0, 'string', '', null, null, '', 1);
|
||||
$morehtmlref .= '</div>';
|
||||
|
||||
$morehtmlright = '';
|
||||
$nbtry = $nbok = 0;
|
||||
if ($object->statut == 2 || $object->statut == 3) {
|
||||
@ -226,16 +236,16 @@ if ($object->fetch($id) >= 0) {
|
||||
$morehtmlright .= ') ';
|
||||
}
|
||||
|
||||
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright);
|
||||
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border centpercent tableforfield">';
|
||||
|
||||
print '<tr><td class="titlefield">'.$langs->trans("MailTitle").'</td><td colspan="3">'.$object->title.'</td></tr>';
|
||||
//print '<tr><td class="titlefield">'.$langs->trans("MailTitle").'</td><td colspan="3">'.$object->title.'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("MailFrom").'</td><td colspan="3">';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("MailFrom").'</td><td colspan="3">';
|
||||
$emailarray = CMailFile::getArrayAddress($object->email_from);
|
||||
foreach ($emailarray as $email => $name) {
|
||||
if ($name && $name != $email) {
|
||||
@ -285,7 +295,7 @@ if ($object->fetch($id) >= 0) {
|
||||
}
|
||||
}
|
||||
if (empty($nbemail)) {
|
||||
$nbemail .= ' '.img_warning('').' <span class="warning">'.$langs->trans("NoTargetYet").'</span>';
|
||||
$nbemail .= ' '.img_warning('');//.' <span class="warning">'.$langs->trans("NoTargetYet").'</span>';
|
||||
}
|
||||
if ($text) {
|
||||
print $form->textwithpicto($nbemail, $text, 1, 'warning');
|
||||
@ -310,22 +320,15 @@ if ($object->fetch($id) >= 0) {
|
||||
if ($allowaddtarget && $user->rights->mailing->creer) {
|
||||
print load_fiche_titre($langs->trans("ToAddRecipientsChooseHere"), ($user->admin ?info_admin($langs->trans("YouCanAddYourOwnPredefindedListHere"), 1) : ''), 'generic');
|
||||
|
||||
//print '<table class="noborder centpercent">';
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<div class="tagtable centpercent liste_titre_bydiv borderbottom" id="tablelines">';
|
||||
|
||||
//print '<tr class="liste_titre">';
|
||||
print '<div class="tagtr liste_titre">';
|
||||
//print '<td class="liste_titre">'.$langs->trans("RecipientSelectionModules").'</td>';
|
||||
print '<div class="tagtd"></div>';
|
||||
print '<div class="tagtd">'.$langs->trans("RecipientSelectionModules").'</div>';
|
||||
//print '<td class="liste_titre" align="center">'.$langs->trans("NbOfUniqueEMails").'</td>';
|
||||
print '<div class="tagtd" align="center">'.$langs->trans("NbOfUniqueEMails").'</div>';
|
||||
//print '<td class="liste_titre" align="left">'.$langs->trans("Filter").'</td>';
|
||||
print '<div class="tagtd left">'.$langs->trans("Filter").'</div>';
|
||||
//print '<td class="liste_titre" align="center"> </td>';
|
||||
print '<div class="tagtd"> </div>';
|
||||
//print "</tr>\n";
|
||||
print '</div>'; // End tr
|
||||
|
||||
clearstatcache();
|
||||
@ -390,12 +393,13 @@ if ($object->fetch($id) >= 0) {
|
||||
print '<div '.$bctag[$var].'>';
|
||||
}
|
||||
|
||||
print '<div class="tagtd">';
|
||||
print '<div class="tagtd paddingleftimp marginleftonly paddingrightimp marginrightonly valignmiddle center">';
|
||||
if (empty($obj->picto)) {
|
||||
$obj->picto = 'generic';
|
||||
}
|
||||
print img_object($langs->trans("EmailingTargetSelector").': '.get_class($obj), $obj->picto, 'class="valignmiddle pictomodule pictofixedwidth"');
|
||||
print ' ';
|
||||
print img_object($langs->trans("EmailingTargetSelector").': '.get_class($obj), $obj->picto, 'class="valignmiddle width25 size15x"');
|
||||
print '</div>';
|
||||
print '<div class="tagtd valignmiddle">'; // style="height: 4em"
|
||||
print $obj->getDesc();
|
||||
print '</div>';
|
||||
|
||||
@ -405,7 +409,7 @@ if ($object->fetch($id) >= 0) {
|
||||
dol_syslog($e->getMessage(), LOG_ERR);
|
||||
}
|
||||
|
||||
print '<div class="tagtd center">';
|
||||
print '<div class="tagtd center valignmiddle">';
|
||||
if ($nbofrecipient === '' || $nbofrecipient >= 0) {
|
||||
print $nbofrecipient;
|
||||
} else {
|
||||
@ -413,7 +417,7 @@ if ($object->fetch($id) >= 0) {
|
||||
}
|
||||
print '</div>';
|
||||
|
||||
print '<div class="tagtd left">';
|
||||
print '<div class="tagtd left valignmiddle">';
|
||||
if ($allowaddtarget) {
|
||||
try {
|
||||
$filter = $obj->formFilter();
|
||||
@ -428,7 +432,7 @@ if ($object->fetch($id) >= 0) {
|
||||
}
|
||||
print '</div>';
|
||||
|
||||
print '<div class="tagtd right">';
|
||||
print '<div class="tagtd right valignmiddle">';
|
||||
if ($allowaddtarget) {
|
||||
print '<input type="submit" class="button button-add small reposition" name="button_'.$modulename.'" value="'.$langs->trans("Add").'">';
|
||||
} else {
|
||||
@ -454,7 +458,14 @@ if ($object->fetch($id) >= 0) {
|
||||
print '</div>'; // End table
|
||||
print '</div>';
|
||||
|
||||
print '<br><br>';
|
||||
print '<br>';
|
||||
|
||||
if ($sqlmessage && $user->admin) {
|
||||
print info_admin($langs->trans("SQLUsedForExport").':<br> '.$sqlmessage, 0, 0, 1, '', 'TechnicalInformation');
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
// List of selected targets
|
||||
@ -548,7 +559,7 @@ if ($object->fetch($id) >= 0) {
|
||||
|
||||
$massactionbutton = '';
|
||||
|
||||
print_barre_liste($langs->trans("MailSelectedRecipients"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $morehtmlcenter, $num, $nbtotalofrecords, 'generic', 0, '', '', $limit);
|
||||
print_barre_liste($langs->trans("MailSelectedRecipients"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $morehtmlcenter, $num, $nbtotalofrecords, 'generic', 0, '', '', $limit, 0, 0, 1);
|
||||
|
||||
print '</form>';
|
||||
|
||||
@ -714,9 +725,13 @@ if ($object->fetch($id) >= 0) {
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
if ($object->statut < 2) {
|
||||
print '<tr><td colspan="9" class="opacitymedium">';
|
||||
print $langs->trans("NoTargetYet");
|
||||
if ($object->statut < $object::STATUS_SENTPARTIALY) {
|
||||
print '<tr><td colspan="9">';
|
||||
print '<span class="opacitymedium">'.$langs->trans("NoTargetYet").'</span>';
|
||||
print '</td></tr>';
|
||||
} else {
|
||||
print '<tr><td colspan="9">';
|
||||
print '<span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -191,6 +191,12 @@ class Mailing extends CommonObject
|
||||
public $substitutionarrayfortest;
|
||||
|
||||
|
||||
const STATUS_DRAFT = 0;
|
||||
const STATUS_VALIDATED = 1;
|
||||
const STATUS_SENTPARTIALY = 2;
|
||||
const STATUS_SENTCOMPLETELY = 3;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
|
||||
@ -58,6 +58,12 @@ if ($object->fetch($id) >= 0) {
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/comm/mailing/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
$morehtmlref = '<div class="refidno">';
|
||||
// Ref customer
|
||||
$morehtmlref .= $form->editfieldkey("", 'title', $object->title, $object, 0, 'string', '', 0, 1);
|
||||
$morehtmlref .= $form->editfieldval("", 'title', $object->title, $object, 0, 'string', '', null, null, '', 1);
|
||||
$morehtmlref .= '</div>';
|
||||
|
||||
$morehtmlright = '';
|
||||
$nbtry = $nbok = 0;
|
||||
if ($object->statut == 2 || $object->statut == 3) {
|
||||
@ -71,7 +77,7 @@ if ($object->fetch($id) >= 0) {
|
||||
$morehtmlright .= ') ';
|
||||
}
|
||||
|
||||
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright);
|
||||
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
|
||||
|
||||
print '<div class="underbanner clearboth"></div><br>';
|
||||
|
||||
|
||||
256
htdocs/comm/propal/agenda.php
Normal file
256
htdocs/comm/propal/agenda.php
Normal file
@ -0,0 +1,256 @@
|
||||
<?php
|
||||
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) ---Put here your own copyright and developer email---
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/comm/propal/agenda.php
|
||||
* \ingroup propal
|
||||
* \brief Tab of events on Proposal
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("propal", "other"));
|
||||
|
||||
// Get parameters
|
||||
$id = GETPOST('id', 'int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$cancel = GETPOST('cancel', 'aZ09');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
|
||||
if (GETPOST('actioncode', 'array')) {
|
||||
$actioncode = GETPOST('actioncode', 'array', 3);
|
||||
if (!count($actioncode)) {
|
||||
$actioncode = '0';
|
||||
}
|
||||
} else {
|
||||
$actioncode = GETPOST("actioncode", "alpha", 3) ? GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT'));
|
||||
}
|
||||
$search_rowid = GETPOST('search_rowid');
|
||||
$search_agenda_label = GETPOST('search_agenda_label');
|
||||
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) {
|
||||
$page = 0;
|
||||
} // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (!$sortfield) {
|
||||
$sortfield = 'a.datep,a.id';
|
||||
}
|
||||
if (!$sortorder) {
|
||||
$sortorder = 'DESC,DESC';
|
||||
}
|
||||
|
||||
// Initialize technical objects
|
||||
$object = new Propal($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
$diroutputmassaction = $conf->propal->multidir_output[$conf->entity].'/temp/massgeneration/'.$user->id;
|
||||
$hookmanager->initHooks(array('myobjectagenda', 'globalcard')); // Note that conf->hooks_modules contains array
|
||||
// Fetch optionals attributes and labels
|
||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
|
||||
// Load object
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
|
||||
if ($id > 0 || !empty($ref)) {
|
||||
$upload_dir = $conf->propal->multidir_output[!empty($object->entity) ? $object->entity : $conf->entity]."/".$object->id;
|
||||
}
|
||||
|
||||
$permissiontoread = $user->hasRight("propal", "lire");
|
||||
$permissiontoadd = $user->hasRight("propal", "creer");
|
||||
|
||||
// Security check
|
||||
if (!empty($user->socid)) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
|
||||
restrictedArea($user, 'propal', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
$parameters = array('id'=>$id);
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
|
||||
if (empty($reshook)) {
|
||||
// Cancel
|
||||
if (GETPOST('cancel', 'alpha') && !empty($backtopage)) {
|
||||
header("Location: ".$backtopage);
|
||||
exit;
|
||||
}
|
||||
|
||||
// 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
|
||||
$actioncode = '';
|
||||
$search_agenda_label = '';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
if ($object->id > 0) {
|
||||
$title = $langs->trans("Agenda");
|
||||
//if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title;
|
||||
$help_url = 'EN:Module_Agenda_En|DE:Modul_Terminplanung';
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
if (isModEnabled('notification')) {
|
||||
$langs->load("mails");
|
||||
}
|
||||
$head = propal_prepare_head($object);
|
||||
|
||||
|
||||
print dol_get_fiche_head($head, 'agenda', $langs->trans("Proposal"), -1, $object->picto);
|
||||
|
||||
// Object card
|
||||
// ------------------------------------------------------------
|
||||
$linkback = '<a href="'.dol_buildpath('/mymodule/myobject_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
$morehtmlref = '<div class="refidno">';
|
||||
// Ref customer
|
||||
$morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
|
||||
$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
|
||||
// Thirdparty
|
||||
$morehtmlref .= '<br>'.$object->thirdparty->getNomUrl(1);
|
||||
// Project
|
||||
if (isModEnabled('project')) {
|
||||
$langs->load("projects");
|
||||
$morehtmlref .= '<br>';
|
||||
if (0) {
|
||||
$morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"');
|
||||
if ($action != 'classify') {
|
||||
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> ';
|
||||
}
|
||||
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
|
||||
} else {
|
||||
if (!empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref .= $proj->getNomUrl(1);
|
||||
if ($proj->title) {
|
||||
$morehtmlref .= '<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).'</span>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$morehtmlref .= '</div>';
|
||||
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
$object->info($object->id);
|
||||
dol_print_object_info($object, 1);
|
||||
|
||||
print '</div>';
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
|
||||
|
||||
// Actions buttons
|
||||
|
||||
$objthirdparty = $object;
|
||||
$objcon = new stdClass();
|
||||
|
||||
$out = '&origin='.urlencode($object->element.(property_exists($object, 'module') ? '@'.$object->module : '')).'&originid='.urlencode($object->id);
|
||||
$urlbacktopage = $_SERVER['PHP_SELF'].'?id='.$object->id;
|
||||
$out .= '&backtopage='.urlencode($urlbacktopage);
|
||||
$permok = $user->rights->agenda->myactions->create;
|
||||
if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
|
||||
//$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
|
||||
if (get_class($objthirdparty) == 'Societe') {
|
||||
$out .= '&socid='.urlencode($objthirdparty->id);
|
||||
}
|
||||
$out .= (!empty($objcon->id) ? '&contactid='.urlencode($objcon->id) : '');
|
||||
//$out.=$langs->trans("AddAnAction").' ';
|
||||
//$out.=img_picto($langs->trans("AddAnAction"),'filenew');
|
||||
//$out.="</a>";
|
||||
}
|
||||
|
||||
$morehtmlright = '';
|
||||
|
||||
//$messagingUrl = DOL_URL_ROOT.'/societe/messaging.php?socid='.$object->id;
|
||||
//$morehtmlright .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 1);
|
||||
//$messagingUrl = DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id;
|
||||
//$morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 2);
|
||||
|
||||
if (isModEnabled('agenda')) {
|
||||
if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')) {
|
||||
$morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out);
|
||||
} else {
|
||||
$morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out, '', 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
|
||||
print '<br>';
|
||||
|
||||
$param = '&id='.$object->id.(!empty($socid) ? '&socid='.$socid : '');
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
|
||||
$param .= '&contextpage='.urlencode($contextpage);
|
||||
}
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) {
|
||||
$param .= '&limit='.urlencode($limit);
|
||||
}
|
||||
|
||||
// Try to know count of actioncomm from cache
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
|
||||
$cachekey = 'count_events_propal_'.$object->id;
|
||||
$nbEvent = dol_getcache($cachekey);
|
||||
|
||||
print_barre_liste($langs->trans("ActionsOnPropal").(is_numeric($nbEvent) ? '<span class="opacitymedium colorblack paddingleft">('.$nbEvent.')</span>': ''), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 1);
|
||||
//print_barre_liste($langs->trans("ActionsOnPropal"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 1);
|
||||
|
||||
// List of all actions
|
||||
$filters = array();
|
||||
$filters['search_agenda_label'] = $search_agenda_label;
|
||||
$filters['search_rowid'] = $search_rowid;
|
||||
|
||||
// TODO Replace this with same code than into list.php
|
||||
show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder, property_exists($object, 'module') ? $object->module : '');
|
||||
}
|
||||
}
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
@ -1396,6 +1396,9 @@ if (empty($reshook)) {
|
||||
$date_end = dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear'));
|
||||
|
||||
$remise_percent = price2num(GETPOST('remise_percent'), '', 2);
|
||||
if (empty($remise_percent)) {
|
||||
$remise_percent = 0;
|
||||
}
|
||||
|
||||
// Prepare a price equivalent for minimum price check
|
||||
$pu_equivalent = $pu_ht;
|
||||
@ -1803,7 +1806,7 @@ if ($action == 'create') {
|
||||
//$warehouse_id = $soc->warehouse_id;
|
||||
} else {
|
||||
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', 1, 0, null, 0, 'minwidth300 maxwidth500 widthcentpercentminusxx');
|
||||
print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company('', 'socid', '((s.client = 1 OR s.client = 2 OR s.client = 3) AND status=1)', 'SelectThirdParty', 1, 0, null, 0, 'minwidth300 maxwidth500 widthcentpercentminusxx');
|
||||
// reload page to retrieve customer informations
|
||||
if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) {
|
||||
print '<script type="text/javascript">
|
||||
@ -1826,7 +1829,7 @@ if ($action == 'create') {
|
||||
if ($socid > 0) {
|
||||
// Contacts (ask contact only if thirdparty already defined).
|
||||
print '<tr class="field_contactid"><td class="titlefieldcreate">'.$langs->trans("DefaultContact").'</td><td class="valuefieldcreate">';
|
||||
print img_picto('', 'contact');
|
||||
print img_picto('', 'contact', 'class="pictofixedwidth"');
|
||||
print $form->selectcontacts($soc->id, $contactid, 'contactid', 1, '', '', 0, 'minwidth300');
|
||||
print '</td></tr>';
|
||||
|
||||
@ -1844,22 +1847,26 @@ if ($action == 'create') {
|
||||
|
||||
// Date
|
||||
print '<tr class="field_addprop"><td class="titlefieldcreate fieldrequired">'.$langs->trans('DatePropal').'</td><td class="valuefieldcreate">';
|
||||
print img_picto('', 'action', 'class="pictofixedwidth"');
|
||||
print $form->selectDate('', '', '', '', '', "addprop", 1, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Validaty duration
|
||||
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>';
|
||||
print '<tr class="field_duree_validitee"><td class="titlefieldcreate fieldrequired">'.$langs->trans("ValidityDuration").'</td><td class="valuefieldcreate">'.img_picto('', 'clock', 'class="pictofixedwidth"').'<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 class="field_cond_reglement_id"><td class="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td>';
|
||||
print img_picto('', 'paiment');
|
||||
print $form->getSelectConditionsPaiements((GETPOSTISSET('cond_reglement_id') && GETPOST('cond_reglement_id', 'int') != 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 img_picto('', 'payment', 'class="pictofixedwidth"');
|
||||
// at last resort we take the payment term id which may be filled by default values set (if not getpostisset)
|
||||
$paymentTermId = (GETPOSTISSET('cond_reglement_id') && GETPOST('cond_reglement_id', 'int') != 0) ? GETPOST('cond_reglement_id', 'int') : (!empty($soc->cond_reglement_id) ? $soc->cond_reglement_id : GETPOST('cond_reglement_id', 'int'));
|
||||
print $form->getSelectConditionsPaiements($paymentTermId, '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 class="field_mode_reglement_id"><td class="titlefieldcreate">'.$langs->trans('PaymentMode').'</td><td class="valuefieldcreate">';
|
||||
print img_picto('', 'bank', 'class="pictofixedwidth"');
|
||||
print $form->select_types_paiements((GETPOSTISSET('mode_reglement_id') && GETPOST('mode_reglement_id', 'int') != 0) ? GETPOST('mode_reglement_id', 'int') : $soc->mode_reglement_id, 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx', 1);
|
||||
$paymentMethod = (GETPOSTISSET('mode_reglement_id') && GETPOST('mode_reglement_id', 'int') != 0) ? GETPOST('mode_reglement_id', 'int') : (!empty($soc->mode_reglement_id) ? $soc->mode_reglement_id : GETPOST('mode_reglement_id', 'int'));
|
||||
print $form->select_types_paiements($paymentMethod, 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx', 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Bank Account
|
||||
@ -1891,7 +1898,7 @@ if ($action == 'create') {
|
||||
$shipping_method_id = $soc->shipping_method_id;
|
||||
}
|
||||
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 img_picto('', 'dolly', 'class="pictofixedwidth"');
|
||||
$form->selectShippingMethod($shipping_method_id, 'shipping_method_id', '', 1, '', 0, 'maxwidth200 widthcentpercentminusx');
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -1908,6 +1915,7 @@ if ($action == 'create') {
|
||||
// Delivery date (or manufacturing)
|
||||
print '<tr class="field_date_livraison"><td class="titlefieldcreate">'.$langs->trans("DeliveryDate").'</td>';
|
||||
print '<td class="valuefieldcreate">';
|
||||
print img_picto('', 'action', 'class="pictofixedwidth"');
|
||||
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);
|
||||
@ -1935,6 +1943,7 @@ if ($action == 'create') {
|
||||
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 img_picto('', 'incoterm', 'class="pictofixedwidth"');
|
||||
print $form->select_incoterms((!empty($soc->fk_incoterms) ? $soc->fk_incoterms : ''), (!empty($soc->location_incoterms) ? $soc->location_incoterms : ''));
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -3029,10 +3038,14 @@ if ($action == 'create') {
|
||||
|
||||
print '</div><div class="fichehalfright">';
|
||||
|
||||
$MAXEVENT = 10;
|
||||
|
||||
$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/comm/propal/agenda.php?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, 'propal', $socid, 1);
|
||||
$somethingshown = $formactions->showactions($object, 'propal', $socid, 1, '', $MAXEVENT, '', $morehtmlcenter); // Show all action for thirdparty
|
||||
|
||||
print '</div></div>';
|
||||
}
|
||||
|
||||
@ -204,11 +204,10 @@ class Proposals extends DolibarrApi
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||
if ($errormessage) {
|
||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
$sql .= $this->db->order($sortfield, $sortorder);
|
||||
@ -309,14 +308,14 @@ class Proposals extends DolibarrApi
|
||||
}
|
||||
|
||||
if (!empty($sqlfilters)) {
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
$errormessage = '';
|
||||
$sql = forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||
if ($errormessage) {
|
||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
$filters = " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
$this->propal->getLinesArray($filters);
|
||||
$this->propal->getLinesArray($sql);
|
||||
$result = array();
|
||||
foreach ($this->propal->lines as $line) {
|
||||
array_push($result, $this->_cleanObjectDatas($line));
|
||||
|
||||
@ -213,6 +213,10 @@ class Propal extends CommonObject
|
||||
public $cond_reglement_code;
|
||||
public $deposit_percent;
|
||||
public $mode_reglement_code;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public $remise_percent;
|
||||
|
||||
/**
|
||||
@ -302,7 +306,7 @@ class Propal extends CommonObject
|
||||
'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>22),
|
||||
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'RefExt', 'enabled'=>1, 'visible'=>0, 'position'=>40),
|
||||
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'isModEnabled("societe")', 'visible'=>-1, 'position'=>23),
|
||||
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>"isModEnabled('project')", 'visible'=>-1, 'position'=>24),
|
||||
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:(fk_statut:=:1)', 'label'=>'Fk projet', 'enabled'=>"isModEnabled('project')", 'visible'=>-1, 'position'=>24),
|
||||
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>25),
|
||||
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>55),
|
||||
'datep' =>array('type'=>'date', 'label'=>'Date', 'enabled'=>1, 'visible'=>-1, 'position'=>60),
|
||||
@ -314,7 +318,7 @@ class Propal extends CommonObject
|
||||
'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>90),
|
||||
'fk_user_cloture' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user cloture', 'enabled'=>1, 'visible'=>-1, 'position'=>95),
|
||||
'price' =>array('type'=>'double', 'label'=>'Price', 'enabled'=>1, 'visible'=>-1, 'position'=>105),
|
||||
'remise_percent' =>array('type'=>'double', 'label'=>'RelativeDiscount', 'enabled'=>1, 'visible'=>-1, 'position'=>110),
|
||||
//'remise_percent' =>array('type'=>'double', 'label'=>'RelativeDiscount', 'enabled'=>1, 'visible'=>-1, 'position'=>110),
|
||||
//'remise_absolue' =>array('type'=>'double', 'label'=>'CustomerRelativeDiscount', 'enabled'=>1, 'visible'=>-1, 'position'=>115),
|
||||
//'remise' =>array('type'=>'double', 'label'=>'Remise', 'enabled'=>1, 'visible'=>-1, 'position'=>120),
|
||||
'total_ht' =>array('type'=>'double(24,8)', 'label'=>'TotalHT', 'enabled'=>1, 'visible'=>-1, 'position'=>125, 'isameasure'=>1),
|
||||
@ -917,8 +921,8 @@ class Propal extends CommonObject
|
||||
$this->line->tva_tx = $txtva;
|
||||
$this->line->localtax1_tx = $txlocaltax1;
|
||||
$this->line->localtax2_tx = $txlocaltax2;
|
||||
$this->line->localtax1_type = $localtaxes_type[0];
|
||||
$this->line->localtax2_type = $localtaxes_type[2];
|
||||
$this->line->localtax1_type = empty($localtaxes_type[0]) ? '' : $localtaxes_type[0];
|
||||
$this->line->localtax2_type = empty($localtaxes_type[2]) ? '' : $localtaxes_type[2];
|
||||
$this->line->remise_percent = $remise_percent;
|
||||
$this->line->subprice = $pu_ht;
|
||||
$this->line->info_bits = $info_bits;
|
||||
@ -1103,9 +1107,9 @@ class Propal extends CommonObject
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."propal (";
|
||||
$sql .= "fk_soc";
|
||||
$sql .= ", price";
|
||||
$sql .= ", remise";
|
||||
$sql .= ", remise_percent";
|
||||
$sql .= ", remise_absolue";
|
||||
$sql .= ", remise"; // deprecated
|
||||
$sql .= ", remise_percent"; // deprecated
|
||||
$sql .= ", remise_absolue"; // deprecated
|
||||
$sql .= ", total_tva";
|
||||
$sql .= ", total_ttc";
|
||||
$sql .= ", datep";
|
||||
@ -1139,7 +1143,7 @@ class Propal extends CommonObject
|
||||
$sql .= $this->socid;
|
||||
$sql .= ", 0";
|
||||
$sql .= ", ".((float) $this->remise); // deprecated
|
||||
$sql .= ", ".($this->remise_percent ? ((float) $this->remise_percent) : 'NULL');
|
||||
$sql .= ", ".($this->remise_percent ? ((float) $this->remise_percent) : 'NULL'); // deprecated
|
||||
$sql .= ", ".($this->remise_absolue ? ((float) $this->remise_absolue) : 'NULL'); // deprecated
|
||||
$sql .= ", 0";
|
||||
$sql .= ", 0";
|
||||
@ -1469,7 +1473,7 @@ class Propal extends CommonObject
|
||||
if (empty($conf->global->MAIN_KEEP_REF_CUSTOMER_ON_CLONING)) {
|
||||
$object->ref_client = '';
|
||||
}
|
||||
if ($conf->global->MAIN_DONT_KEEP_NOTE_ON_CLONING == 1) {
|
||||
if (getDolGlobalInt('MAIN_DONT_KEEP_NOTE_ON_CLONING') == 1) {
|
||||
$object->note_private = '';
|
||||
$object->note_public = '';
|
||||
}
|
||||
@ -1505,8 +1509,7 @@ class Propal extends CommonObject
|
||||
$action = '';
|
||||
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) {
|
||||
$this->errors += $hookmanager->errors;
|
||||
$this->error = $hookmanager->error;
|
||||
$this->setErrorsFromObject($hookmanager);
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
@ -1596,10 +1599,11 @@ class Propal extends CommonObject
|
||||
$this->ref = $obj->ref;
|
||||
$this->ref_client = $obj->ref_client;
|
||||
$this->ref_ext = $obj->ref_ext;
|
||||
$this->remise = $obj->remise;
|
||||
$this->remise_percent = $obj->remise_percent;
|
||||
$this->remise_absolue = $obj->remise_absolue;
|
||||
$this->total = $obj->total_ttc; // TODO deprecated
|
||||
|
||||
$this->remise = $obj->remise; // TODO deprecated
|
||||
$this->remise_percent = $obj->remise_percent; // TODO deprecated
|
||||
$this->remise_absolue = $obj->remise_absolue; // TODO deprecated
|
||||
$this->total = $obj->total_ttc; // TODO deprecated
|
||||
$this->total_ttc = $obj->total_ttc;
|
||||
$this->total_ht = $obj->total_ht;
|
||||
$this->total_tva = $obj->total_tva;
|
||||
@ -2452,6 +2456,7 @@ class Propal extends CommonObject
|
||||
* @param double $remise Amount discount
|
||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||
* @return int <0 if ko, >0 if ok
|
||||
* @deprecated remise_percent is a deprecated field for object parent
|
||||
*/
|
||||
public function set_remise_percent($user, $remise, $notrigger = 0)
|
||||
{
|
||||
@ -3977,7 +3982,7 @@ class Propal extends CommonObject
|
||||
$return .='<br><span class="" >'.$langs->trans("AmountHT").' : </span><span class="info-box-label amount">'.price($this->total_ht).'</span>';
|
||||
}
|
||||
if (method_exists($this, 'getLibStatut')) {
|
||||
$return .= '<br><div class="info-box-status margintoponly">'.$this->getLibStatut(5).'</div>';
|
||||
$return .= '<br><div class="info-box-status margintoponly">'.$this->getLibStatut(3).'</div>';
|
||||
}
|
||||
$return .= '</div>';
|
||||
$return .= '</div>';
|
||||
|
||||
@ -246,13 +246,12 @@ class PropaleStats extends Stats
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg";
|
||||
$sql .= " FROM ".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product";
|
||||
$sql .= " FROM ".$this->from." INNER JOIN ".$this->from_line." ON p.rowid = tl.fk_propal INNER JOIN ".MAIN_DB_PREFIX."product as product ON tl.fk_product = product.rowid";
|
||||
if (empty($user->rights->societe->client->voir) && !$user->socid) {
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
$sql .= $this->join;
|
||||
$sql .= " WHERE ".$this->where;
|
||||
$sql .= " AND p.rowid = tl.fk_propal AND tl.fk_product = product.rowid";
|
||||
$sql .= " AND ".$this->field_date." BETWEEN '".$this->db->idate(dol_get_first_day($year, 1, false))."' AND '".$this->db->idate(dol_get_last_day($year, 12, false))."'";
|
||||
$sql .= " GROUP BY product.ref";
|
||||
$sql .= $this->db->order('nb', 'DESC');
|
||||
|
||||
@ -1,126 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/comm/propal/info.php
|
||||
* \ingroup propal
|
||||
* \brief Page d'affichage des infos d'une proposition commerciale
|
||||
*/
|
||||
|
||||
// Load Dolibarr environment
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php';
|
||||
if (isModEnabled('project')) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
}
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('propal', 'compta'));
|
||||
|
||||
$id = GETPOST('id', 'int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$socid = GETPOST('socid', 'int');
|
||||
|
||||
$object = new Propal($db);
|
||||
if (!$object->fetch($id, $ref) > 0) {
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Security check
|
||||
if (!empty($user->socid)) {
|
||||
$socid = $user->socid;
|
||||
$object->id = $user->socid;
|
||||
}
|
||||
restrictedArea($user, 'propal', $object->id);
|
||||
|
||||
$usercancreate = $user->hasRight("propal", "creer");
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$title = $object->ref." - ".$langs->trans('Info');
|
||||
$help_url = 'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos';
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$head = propal_prepare_head($object);
|
||||
print dol_get_fiche_head($head, 'info', $langs->trans('Proposal'), -1, 'propal');
|
||||
|
||||
$object->info($object->id);
|
||||
|
||||
|
||||
// Proposal card
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/comm/propal/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
|
||||
$morehtmlref = '<div class="refidno">';
|
||||
// Ref customer
|
||||
$morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
|
||||
$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
|
||||
// Thirdparty
|
||||
$morehtmlref .= '<br>'.$object->thirdparty->getNomUrl(1);
|
||||
// Project
|
||||
if (isModEnabled('project')) {
|
||||
$langs->load("projects");
|
||||
$morehtmlref .= '<br>';
|
||||
if (0) {
|
||||
$morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"');
|
||||
if ($action != 'classify') {
|
||||
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> ';
|
||||
}
|
||||
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
|
||||
} else {
|
||||
if (!empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref .= $proj->getNomUrl(1);
|
||||
if ($proj->title) {
|
||||
$morehtmlref .= '<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).'</span>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$morehtmlref .= '</div>';
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
dol_print_object_info($object);
|
||||
|
||||
print '</div>';
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
@ -557,10 +557,6 @@ $formcompany = new FormCompany($db);
|
||||
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
|
||||
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
|
||||
$title = $langs->trans('ListOfProposals');
|
||||
$help_url = 'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos';
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
$sql = 'SELECT';
|
||||
if ($sall || $search_user > 0) {
|
||||
$sql = 'SELECT DISTINCT';
|
||||
@ -868,6 +864,9 @@ if ($resql) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$help_url = 'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos';
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
$param = '&search_status='.urlencode($search_status);
|
||||
if (!empty($mode)) {
|
||||
$param .= '&mode='.urlencode($mode);
|
||||
@ -1724,7 +1723,7 @@ if ($resql) {
|
||||
$objectstatic->author = $userstatic->getNomUrl(1);
|
||||
$objectstatic->fk_project = $projectstatic->getNomUrl(1);
|
||||
print $objectstatic->getKanbanView('');
|
||||
if ($i == (min($num, $limit) - 1)) {
|
||||
if ($i == ($imaxinloop - 1)) {
|
||||
print '</div>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -1785,7 +1785,7 @@ if ($action == 'create' && $usercancreate) {
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td>';
|
||||
print img_picto('', 'company').$form->select_company('', 'socid', '((s.client = 1 OR s.client = 2 OR s.client = 3) AND s.status=1)', 'SelectThirdParty', 1, 0, null, 0, 'minwidth175 maxwidth500 widthcentpercentminusxx');
|
||||
print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company('', 'socid', '((s.client = 1 OR s.client = 2 OR s.client = 3) AND s.status=1)', 'SelectThirdParty', 1, 0, null, 0, 'minwidth175 maxwidth500 widthcentpercentminusxx');
|
||||
// reload page to retrieve customer informations
|
||||
if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) {
|
||||
print '<script type="text/javascript">
|
||||
@ -1828,6 +1828,7 @@ if ($action == 'create' && $usercancreate) {
|
||||
|
||||
// Date
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('Date').'</td><td>';
|
||||
print img_picto('', 'action', 'class="pictofixedwidth"');
|
||||
print $form->selectDate('', 're', '', '', '', "crea_commande", 1, 1); // Always autofill date with current date
|
||||
print '</td></tr>';
|
||||
|
||||
@ -1835,6 +1836,7 @@ if ($action == 'create' && $usercancreate) {
|
||||
print '<tr><td>'.$langs->trans("DateDeliveryPlanned").'</td>';
|
||||
print '<td colspan="3">';
|
||||
$date_delivery = ($date_delivery ? $date_delivery : $object->delivery_date);
|
||||
print img_picto('', 'action', 'class="pictofixedwidth"');
|
||||
print $form->selectDate($date_delivery ? $date_delivery : -1, 'liv_', 1, 1, 1);
|
||||
print "</td>\n";
|
||||
print '</tr>';
|
||||
@ -1867,7 +1869,7 @@ if ($action == 'create' && $usercancreate) {
|
||||
// Shipping Method
|
||||
if (isModEnabled('expedition')) {
|
||||
print '<tr><td>'.$langs->trans('SendingMethod').'</td><td>';
|
||||
print img_picto('', 'object_dolly', 'class="pictofixedwidth"');
|
||||
print img_picto('', 'dolly', 'class="pictofixedwidth"');
|
||||
$form->selectShippingMethod((GETPOSTISSET('shipping_method_id')?GETPOST('shipping_method_id'):$shipping_method_id), 'shipping_method_id', '', 1, '', 0, 'maxwidth200 widthcentpercentminusx');
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -1911,6 +1913,7 @@ if ($action == 'create' && $usercancreate) {
|
||||
$incoterm_id = (!empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms : $soc->fk_incoterms);
|
||||
$incoterm_location = (!empty($objectsrc->location_incoterms) ? $objectsrc->location_incoterms : $soc->location_incoterms);
|
||||
}
|
||||
print img_picto('', 'incoterm', 'class="pictofixedwidth"');
|
||||
print $form->select_incoterms($incoterm_id, $incoterm_location);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -207,11 +207,10 @@ class Orders extends DolibarrApi
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||
if ($errormessage) {
|
||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
$sql .= $this->db->order($sortfield, $sortorder);
|
||||
|
||||
@ -210,7 +210,11 @@ class Commande extends CommonOrder
|
||||
*/
|
||||
public $fk_remise_except;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public $remise_percent;
|
||||
|
||||
public $remise_absolue;
|
||||
public $info_bits;
|
||||
public $rang;
|
||||
@ -312,7 +316,7 @@ class Commande extends CommonOrder
|
||||
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'RefExt', 'enabled'=>1, 'visible'=>0, 'position'=>26),
|
||||
'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>28),
|
||||
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'isModEnabled("societe")', 'visible'=>-1, 'notnull'=>1, 'position'=>20),
|
||||
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>"isModEnabled('project')", 'visible'=>-1, 'position'=>25),
|
||||
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:(fk_statut:=:1)', 'label'=>'Project', 'enabled'=>"isModEnabled('project')", 'visible'=>-1, 'position'=>25),
|
||||
'date_commande' =>array('type'=>'date', 'label'=>'Date', 'enabled'=>1, 'visible'=>1, 'position'=>60),
|
||||
'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>62),
|
||||
'date_cloture' =>array('type'=>'datetime', 'label'=>'DateClosing', 'enabled'=>1, 'visible'=>-1, 'position'=>65),
|
||||
@ -320,7 +324,7 @@ class Commande extends CommonOrder
|
||||
'fk_user_cloture' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserClosing', 'enabled'=>1, 'visible'=>-1, 'position'=>90),
|
||||
'source' =>array('type'=>'smallint(6)', 'label'=>'Source', 'enabled'=>1, 'visible'=>-1, 'position'=>95),
|
||||
//'amount_ht' =>array('type'=>'double(24,8)', 'label'=>'AmountHT', 'enabled'=>1, 'visible'=>-1, 'position'=>105),
|
||||
'remise_percent' =>array('type'=>'double', 'label'=>'RelativeDiscount', 'enabled'=>1, 'visible'=>-1, 'position'=>110),
|
||||
//'remise_percent' =>array('type'=>'double', 'label'=>'RelativeDiscount', 'enabled'=>1, 'visible'=>-1, 'position'=>110),
|
||||
'remise_absolue' =>array('type'=>'double', 'label'=>'CustomerRelativeDiscount', 'enabled'=>1, 'visible'=>-1, 'position'=>115),
|
||||
//'remise' =>array('type'=>'double', 'label'=>'Remise', 'enabled'=>1, 'visible'=>-1, 'position'=>120),
|
||||
'total_tva' =>array('type'=>'double(24,8)', 'label'=>'VAT', 'enabled'=>1, 'visible'=>-1, 'position'=>125, 'isameasure'=>1),
|
||||
@ -332,14 +336,14 @@ class Commande extends CommonOrder
|
||||
'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>155),
|
||||
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'PDFTemplate', 'enabled'=>1, 'visible'=>0, 'position'=>160),
|
||||
//'facture' =>array('type'=>'tinyint(4)', 'label'=>'ParentInvoice', 'enabled'=>1, 'visible'=>-1, 'position'=>165),
|
||||
'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>'$conf->banque->enabled', 'visible'=>-1, 'position'=>170),
|
||||
'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>'isModEnabled("banque")', '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),
|
||||
'fk_warehouse' =>array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Fk warehouse', 'enabled'=>'$conf->stock->enabled', 'visible'=>-1, 'position'=>200),
|
||||
'fk_warehouse' =>array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Fk warehouse', 'enabled'=>'isModEnabled("stock")', 'visible'=>-1, 'position'=>200),
|
||||
'fk_availability' =>array('type'=>'integer', 'label'=>'Availability', 'enabled'=>1, 'visible'=>-1, 'position'=>205),
|
||||
'fk_input_reason' =>array('type'=>'integer', 'label'=>'InputReason', 'enabled'=>1, 'visible'=>-1, 'position'=>210),
|
||||
//'fk_delivery_address' =>array('type'=>'integer', 'label'=>'DeliveryAddress', 'enabled'=>1, 'visible'=>-1, 'position'=>215),
|
||||
@ -974,7 +978,7 @@ class Commande extends CommonOrder
|
||||
$sql .= ", ".(!empty($this->shipping_method_id) && $this->shipping_method_id > 0 ? ((int) $this->shipping_method_id) : 'NULL');
|
||||
$sql .= ", ".(!empty($this->warehouse_id) && $this->warehouse_id > 0 ? ((int) $this->warehouse_id) : 'NULL');
|
||||
$sql .= ", ".($this->remise_absolue > 0 ? $this->db->escape($this->remise_absolue) : 'NULL');
|
||||
$sql .= ", ".($this->remise_percent > 0 ? $this->db->escape($this->remise_percent) : 0);
|
||||
$sql .= ", ".($this->remise_percent > 0 ? $this->db->escape($this->remise_percent) : 0); // TODO deprecated
|
||||
$sql .= ", ".(int) $this->fk_incoterms;
|
||||
$sql .= ", '".$this->db->escape($this->location_incoterms)."'";
|
||||
$sql .= ", ".setEntity($this);
|
||||
@ -1279,8 +1283,7 @@ class Commande extends CommonOrder
|
||||
$action = '';
|
||||
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) {
|
||||
$this->errors += $hookmanager->errors;
|
||||
$this->error = $hookmanager->error;
|
||||
$this->setErrorsFromObject($hookmanager);
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
@ -1436,8 +1439,7 @@ class Commande extends CommonOrder
|
||||
$action = '';
|
||||
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) {
|
||||
$this->errors += $hookmanager->errors;
|
||||
$this->error = $hookmanager->error;
|
||||
$this->setErrorsFromObject($hookmanager);
|
||||
$error++;
|
||||
}
|
||||
|
||||
@ -1922,7 +1924,7 @@ class Commande extends CommonOrder
|
||||
$this->date_validation = $this->db->jdate($obj->date_valid);
|
||||
$this->date_modification = $this->db->jdate($obj->tms);
|
||||
$this->remise = $obj->remise;
|
||||
$this->remise_percent = $obj->remise_percent;
|
||||
$this->remise_percent = $obj->remise_percent; // TODO deprecated
|
||||
$this->remise_absolue = $obj->remise_absolue;
|
||||
$this->source = $obj->source;
|
||||
$this->billed = $obj->billed;
|
||||
@ -2460,12 +2462,13 @@ class Commande extends CommonOrder
|
||||
* @param float $remise Discount (percent)
|
||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @deprecated remise_percent is a deprecated field for object parent
|
||||
*/
|
||||
public function setDiscount($user, $remise, $notrigger = 0)
|
||||
{
|
||||
$remise = trim($remise) ?trim($remise) : 0;
|
||||
|
||||
if ($user->rights->commande->creer) {
|
||||
if ($user->hasRight('commande', 'creer')) {
|
||||
$error = 0;
|
||||
|
||||
$this->db->begin();
|
||||
@ -2533,7 +2536,7 @@ class Commande extends CommonOrder
|
||||
|
||||
$remise = price2num($remise);
|
||||
|
||||
if ($user->rights->commande->creer) {
|
||||
if ($user->hasRight('commande', 'creer')) {
|
||||
$error = 0;
|
||||
|
||||
$this->db->begin();
|
||||
@ -2593,7 +2596,7 @@ class Commande extends CommonOrder
|
||||
public function set_date($user, $date, $notrigger = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
if ($user->rights->commande->creer) {
|
||||
if ($user->hasRight('commande', 'creer')) {
|
||||
$error = 0;
|
||||
|
||||
$this->db->begin();
|
||||
@ -2665,7 +2668,7 @@ class Commande extends CommonOrder
|
||||
*/
|
||||
public function setDeliveryDate($user, $delivery_date, $notrigger = 0)
|
||||
{
|
||||
if ($user->rights->commande->creer) {
|
||||
if ($user->hasRight('commande', 'creer')) {
|
||||
$error = 0;
|
||||
|
||||
$this->db->begin();
|
||||
@ -2924,7 +2927,7 @@ class Commande extends CommonOrder
|
||||
public function set_ref_client($user, $ref_client, $notrigger = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
if ($user->rights->commande->creer) {
|
||||
if ($user->hasRight('commande', 'creer')) {
|
||||
$error = 0;
|
||||
|
||||
$this->db->begin();
|
||||
@ -3176,17 +3179,17 @@ class Commande extends CommonOrder
|
||||
|
||||
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type, 100, $this->multicurrency_tx, $pu_ht_devise);
|
||||
|
||||
$total_ht = $tabprice[0];
|
||||
$total_ht = $tabprice[0];
|
||||
$total_tva = $tabprice[1];
|
||||
$total_ttc = $tabprice[2];
|
||||
$total_localtax1 = $tabprice[9];
|
||||
$total_localtax2 = $tabprice[10];
|
||||
$pu_ht = $tabprice[3];
|
||||
$pu_ht = $tabprice[3];
|
||||
$pu_tva = $tabprice[4];
|
||||
$pu_ttc = $tabprice[5];
|
||||
|
||||
// MultiCurrency
|
||||
$multicurrency_total_ht = $tabprice[16];
|
||||
$multicurrency_total_ht = $tabprice[16];
|
||||
$multicurrency_total_tva = $tabprice[17];
|
||||
$multicurrency_total_ttc = $tabprice[18];
|
||||
$pu_ht_devise = $tabprice[19];
|
||||
|
||||
@ -55,7 +55,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) {
|
||||
echo '<td class="linkedcol-ref">'.$objectlink->ref_client.'</td>';
|
||||
echo '<td class="linkedcol-date center">'.dol_print_date($objectlink->date, 'day').'</td>';
|
||||
echo '<td class="linkedcol-amount right">';
|
||||
if ($user->rights->commande->lire) {
|
||||
if ($user->hasRight('commande', 'lire')) {
|
||||
$total = $total + $objectlink->total_ht;
|
||||
echo price($objectlink->total_ht);
|
||||
}
|
||||
|
||||
@ -527,6 +527,14 @@ if ($action == 'create') {
|
||||
print '<td><input type="text" class="flat minwidth150" name="bank" value="'.(GETPOST('bank') ?GETPOST('bank', 'alpha') : $object->bank).'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
// IBAN
|
||||
print '<tr><td>'.$langs->trans($ibankey).'</td>';
|
||||
print '<td><input maxlength="34" type="text" class="flat minwidth300" name="iban" value="'.(GETPOSTISSET('iban') ?GETPOST('iban', 'alpha') : $object->iban).'"></td></tr>';
|
||||
|
||||
// BIC
|
||||
print '<tr><td>'.$langs->trans($bickey).'</td>';
|
||||
print '<td><input maxlength="11" type="text" class="flat minwidth150" name="bic" value="'.(GETPOSTISSET('bic') ?GETPOST('bic', 'alpha') : $object->bic).'"></td></tr>';
|
||||
|
||||
// Show fields of bank account
|
||||
$sizecss = '';
|
||||
foreach ($object->getFieldsToShow() as $val) {
|
||||
@ -559,13 +567,6 @@ if ($action == 'create') {
|
||||
$bickey = "SWIFT";
|
||||
}
|
||||
|
||||
// IBAN
|
||||
print '<tr><td>'.$langs->trans($ibankey).'</td>';
|
||||
print '<td><input maxlength="34" type="text" class="flat minwidth300" name="iban" value="'.(GETPOSTISSET('iban') ?GETPOST('iban', 'alpha') : $object->iban).'"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans($bickey).'</td>';
|
||||
print '<td><input maxlength="11" type="text" class="flat minwidth150" name="bic" value="'.(GETPOSTISSET('bic') ?GETPOST('bic', 'alpha') : $object->bic).'"></td></tr>';
|
||||
|
||||
if (isModEnabled('paymentbybanktransfer')) {
|
||||
print '<tr><td>'.$form->textwithpicto($langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation"), $langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp")).'</td>';
|
||||
print '<td><input type="checkbox" class="flat" name="pti_in_ctti"'. (empty(GETPOST('pti_in_ctti')) ? '' : ' checked ') . '>';
|
||||
@ -753,6 +754,38 @@ if ($action == 'create') {
|
||||
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("BankName").'</td>';
|
||||
print '<td>'.$object->bank.'</td></tr>';
|
||||
|
||||
$ibankey = FormBank::getIBANLabel($object);
|
||||
$bickey = "BICNumber";
|
||||
if ($object->getCountryCode() == 'IN') {
|
||||
$bickey = "SWIFT";
|
||||
}
|
||||
|
||||
// IBAN
|
||||
print '<tr><td>'.$langs->trans($ibankey).'</td>';
|
||||
print '<td>'.getIbanHumanReadable($object).' ';
|
||||
if (!empty($object->iban)) {
|
||||
if (!checkIbanForAccount($object)) {
|
||||
print img_picto($langs->trans("IbanNotValid"), 'warning');
|
||||
} else {
|
||||
print img_picto($langs->trans("IbanValid"), 'info');
|
||||
}
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// BIC
|
||||
print '<tr><td>'.$langs->trans($bickey).'</td>';
|
||||
print '<td>'.$object->bic.' ';
|
||||
if (!empty($object->bic)) {
|
||||
if (!checkSwiftForAccount($object)) {
|
||||
print img_picto($langs->trans("SwiftNotValid"), 'warning');
|
||||
} else {
|
||||
print img_picto($langs->trans("SwiftValid"), 'info');
|
||||
}
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// TODO Add a link "Show more..." for all ohter informations.
|
||||
|
||||
// Show fields of bank account
|
||||
foreach ($object->getFieldsToShow() as $val) {
|
||||
$content = '';
|
||||
@ -771,34 +804,6 @@ if ($action == 'create') {
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
$ibankey = FormBank::getIBANLabel($object);
|
||||
$bickey = "BICNumber";
|
||||
if ($object->getCountryCode() == 'IN') {
|
||||
$bickey = "SWIFT";
|
||||
}
|
||||
|
||||
print '<tr><td>'.$langs->trans($ibankey).'</td>';
|
||||
print '<td>'.getIbanHumanReadable($object).' ';
|
||||
if (!empty($object->iban)) {
|
||||
if (!checkIbanForAccount($object)) {
|
||||
print img_picto($langs->trans("IbanNotValid"), 'warning');
|
||||
} else {
|
||||
print img_picto($langs->trans("IbanValid"), 'info');
|
||||
}
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans($bickey).'</td>';
|
||||
print '<td>'.$object->bic.' ';
|
||||
if (!empty($object->bic)) {
|
||||
if (!checkSwiftForAccount($object)) {
|
||||
print img_picto($langs->trans("SwiftNotValid"), 'warning');
|
||||
} else {
|
||||
print img_picto($langs->trans("SwiftValid"), 'info');
|
||||
}
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
if (isModEnabled('prelevement')) {
|
||||
print '<tr><td>'.$form->textwithpicto($langs->trans("ICS"), $langs->trans("ICS").' ('.$langs->trans("UsedFor", $langs->transnoentitiesnoconv("StandingOrder")).')').'</td>';
|
||||
print '<td>'.$object->ics.'</td>';
|
||||
@ -1080,6 +1085,20 @@ if ($action == 'create') {
|
||||
print '<td><input type="text" class="flat width300" name="bank" value="'.$object->bank.'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
$ibankey = FormBank::getIBANLabel($object);
|
||||
$bickey = "BICNumber";
|
||||
if ($object->getCountryCode() == 'IN') {
|
||||
$bickey = "SWIFT";
|
||||
}
|
||||
|
||||
// IBAN
|
||||
print '<tr><td>'.$langs->trans($ibankey).'</td>';
|
||||
print '<td><input class="minwidth300 maxwidth200onsmartphone" maxlength="34" type="text" class="flat" name="iban" value="'.(GETPOSTISSET('iban') ? GETPOST('iban', 'alphanohtml') : $object->iban).'"></td></tr>';
|
||||
|
||||
// BIC
|
||||
print '<tr><td>'.$langs->trans($bickey).'</td>';
|
||||
print '<td><input class="minwidth150 maxwidth200onsmartphone" maxlength="11" type="text" class="flat" name="bic" value="'.(GETPOSTISSET('bic') ? GETPOST('bic', 'alphanohtml') : $object->bic).'"></td></tr>';
|
||||
|
||||
// Show fields of bank account
|
||||
foreach ($object->getFieldsToShow() as $val) {
|
||||
$content = '';
|
||||
@ -1106,19 +1125,6 @@ if ($action == 'create') {
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
$ibankey = FormBank::getIBANLabel($object);
|
||||
$bickey = "BICNumber";
|
||||
if ($object->getCountryCode() == 'IN') {
|
||||
$bickey = "SWIFT";
|
||||
}
|
||||
|
||||
// IBAN
|
||||
print '<tr><td>'.$langs->trans($ibankey).'</td>';
|
||||
print '<td><input class="minwidth300 maxwidth200onsmartphone" maxlength="34" type="text" class="flat" name="iban" value="'.(GETPOSTISSET('iban') ? GETPOST('iban', 'alphanohtml') : $object->iban).'"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans($bickey).'</td>';
|
||||
print '<td><input class="minwidth150 maxwidth200onsmartphone" maxlength="11" type="text" class="flat" name="bic" value="'.(GETPOSTISSET('bic') ? GETPOST('bic', 'alphanohtml') : $object->bic).'"></td></tr>';
|
||||
|
||||
if (isModEnabled('prelevement')) {
|
||||
print '<tr><td>'.$form->textwithpicto($langs->trans("ICS"), $langs->trans("ICS").' ('.$langs->trans("UsedFor", $langs->transnoentitiesnoconv("StandingOrder")).')').'</td>';
|
||||
print '<td><input class="minwidth150 maxwidth200onsmartphone" maxlength="32" type="text" class="flat" name="ics" value="'.(GETPOSTISSET('ics') ? GETPOST('ics', 'alphanohtml') : $object->ics).'"></td></tr>';
|
||||
|
||||
@ -30,6 +30,7 @@
|
||||
* \ingroup bank
|
||||
* \brief File of class to manage bank accounts
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
|
||||
|
||||
|
||||
@ -1844,10 +1845,10 @@ class Account extends CommonObject
|
||||
}
|
||||
if (method_exists($this, 'solde')) {
|
||||
$return .= '<br><a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?id='.$this->id.'">';
|
||||
$return .= '<span class="opacitymedium">'.$langs->trans("Balance").'</span> : <span class="amount">'.price($this->solde(1), 0, $langs, 1, -1, -1, $this->currency_code).'</span>';
|
||||
$return .= '<span class="opacitymedium">'.$langs->trans("Balance").'</span> : <span class="amount">'.price(price2num($this->solde(1), 'MT'), 0, $langs, 1, -1, -1, $this->currency_code).'</span>';
|
||||
}
|
||||
if (method_exists($this, 'getLibStatut')) {
|
||||
$return .= '<br><div class="info-box-status margintoponly">'.$this->getLibStatut(5).'</div>';
|
||||
$return .= '<br><div class="info-box-status margintoponly">'.$this->getLibStatut(3).'</div>';
|
||||
}
|
||||
$return .= '</div>';
|
||||
$return .= '</div>';
|
||||
@ -1857,6 +1858,8 @@ class Account extends CommonObject
|
||||
}
|
||||
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php';
|
||||
|
||||
/**
|
||||
* Class to manage bank transaction lines
|
||||
*/
|
||||
|
||||
@ -82,11 +82,10 @@ class BankAccounts extends DolibarrApi
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||
if ($errormessage) {
|
||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
$sql .= $this->db->order($sortfield, $sortorder);
|
||||
@ -440,11 +439,10 @@ class BankAccounts extends DolibarrApi
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||
if ($errormessage) {
|
||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
$sql .= " ORDER BY rowid";
|
||||
|
||||
@ -574,6 +574,7 @@ $total = array();
|
||||
$found = 0;
|
||||
$i = 0;
|
||||
$lastcurrencycode = '';
|
||||
$imaxinloop = ($limit ? min($num, $limit) : $num);
|
||||
|
||||
foreach ($accounts as $key => $type) {
|
||||
if ($i >= $limit) {
|
||||
@ -600,7 +601,7 @@ foreach ($accounts as $key => $type) {
|
||||
}
|
||||
// Output Kanban
|
||||
print $objecttmp->getKanbanView('');
|
||||
if ($i == (min($num, $limit) - 1)) {
|
||||
if ($i == ($imaxinloop - 1)) {
|
||||
print '</div>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -787,7 +788,7 @@ foreach ($accounts as $key => $type) {
|
||||
if (!empty($arrayfields['balance']['checked'])) {
|
||||
print '<td class="nowraponall right">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?id='.$objecttmp->id.'">';
|
||||
print '<span class="amount">'.price($solde, 0, $langs, 1, -1, -1, $objecttmp->currency_code).'</span>';
|
||||
print '<span class="amount">'.price(price2num($solde, 'MT'), 0, $langs, 1, -1, -1, $objecttmp->currency_code).'</span>';
|
||||
print '</a>';
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -495,7 +495,7 @@ class CashControl extends CommonObject
|
||||
$return .= '<br><span class="info-box-label opacitymedium" >'.$langs->trans("Year").'</span> : <span>'.$this->year_close.'</span>';
|
||||
}
|
||||
if (method_exists($this, 'getLibStatut')) {
|
||||
$return .= '<br><div class="info-box-status margintoponly">'.$this->getLibStatut(5).'</div>';
|
||||
$return .= '<br><div class="info-box-status margintoponly">'.$this->getLibStatut(3).'</div>';
|
||||
}
|
||||
$return .= '</div>';
|
||||
$return .= '</div>';
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2014-2019 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2015-2016 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2018-2023 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2022 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -2129,6 +2129,7 @@ if (empty($reshook)) {
|
||||
$date_start = dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), GETPOST('date_start'.$predef.'sec'), GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year'));
|
||||
$date_end = dol_mktime(GETPOST('date_end'.$predef.'hour'), GETPOST('date_end'.$predef.'min'), GETPOST('date_end'.$predef.'sec'), GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year'));
|
||||
$price_base_type = (GETPOST('price_base_type', 'alpha') ? GETPOST('price_base_type', 'alpha') : 'HT');
|
||||
$tva_npr = "";
|
||||
|
||||
// Define special_code for special lines
|
||||
$special_code = 0;
|
||||
@ -2157,8 +2158,7 @@ if (empty($reshook)) {
|
||||
|
||||
//$tva_tx = $datapriceofproduct['tva_tx'];
|
||||
//$tva_npr = $datapriceofproduct['tva_npr'];
|
||||
|
||||
$tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx));
|
||||
$tmpvat = (float) price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx));
|
||||
$tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx));
|
||||
|
||||
// Set unit price to use
|
||||
@ -3200,7 +3200,7 @@ if ($action == 'create') {
|
||||
} else {
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('Customer').'</td>';
|
||||
print '<td colspan="2">';
|
||||
print img_picto('', 'company').$form->select_company($soc->id, 'socid', '((s.client = 1 OR s.client = 3) AND s.status = 1)', 'SelectThirdParty', 1, 0, null, 0, 'minwidth300 widthcentpercentminusxx maxwidth500');
|
||||
print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company($soc->id, 'socid', '((s.client = 1 OR s.client = 3) AND s.status = 1)', 'SelectThirdParty', 1, 0, null, 0, 'minwidth300 widthcentpercentminusxx maxwidth500');
|
||||
// Option to reload page to retrieve customer informations.
|
||||
if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) {
|
||||
print '<script type="text/javascript">
|
||||
@ -3656,18 +3656,21 @@ if ($action == 'create') {
|
||||
|
||||
// Date invoice
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('DateInvoice').'</td><td colspan="2">';
|
||||
print img_picto('', 'action', 'class="pictofixedwidth"');
|
||||
print $form->selectDate($newdateinvoice ? $newdateinvoice : $dateinvoice, '', '', '', '', "add", 1, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Date point of tax
|
||||
if (!empty($conf->global->INVOICE_POINTOFTAX_DATE)) {
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('DatePointOfTax').'</td><td colspan="2">';
|
||||
print img_picto('', 'action', 'class="pictofixedwidth"');
|
||||
print $form->selectDate($date_pointoftax ? $date_pointoftax : -1, 'date_pointoftax', '', '', '', "add", 1, 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Payment term
|
||||
print '<tr><td class="nowrap fieldrequired">'.$langs->trans('PaymentConditionsShort').'</td><td colspan="2">';
|
||||
print img_picto('', 'payment', 'class="pictofixedwidth"');
|
||||
print $form->getSelectConditionsPaiements(GETPOSTISSET('cond_reglement_id') ? GETPOST('cond_reglement_id', 'int') : $cond_reglement_id, 'cond_reglement_id');
|
||||
print '</td></tr>';
|
||||
|
||||
@ -3724,7 +3727,7 @@ if ($action == 'create') {
|
||||
|
||||
// Payment mode
|
||||
print '<tr><td>'.$langs->trans('PaymentMode').'</td><td colspan="2">';
|
||||
print img_picto('', 'payment', 'class="pictofixedwidth"');
|
||||
print img_picto('', 'bank', 'class="pictofixedwidth"');
|
||||
print $form->select_types_paiements(GETPOSTISSET('mode_reglement_id') ? GETPOST('mode_reglement_id') : $mode_reglement_id, 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx', 1);
|
||||
print '</td></tr>';
|
||||
|
||||
@ -3740,7 +3743,7 @@ if ($action == 'create') {
|
||||
if (isModEnabled('project')) {
|
||||
$langs->load('projects');
|
||||
print '<tr><td>'.$langs->trans('Project').'</td><td colspan="2">';
|
||||
print img_picto('', 'project').$formproject->select_projects(($socid > 0 ? $socid : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx');
|
||||
print img_picto('', 'project', 'class="pictofixedwidth"').$formproject->select_projects(($socid > 0 ? $socid : -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.($fac_rec ? '&fac_rec='.$fac_rec : '')).'"><span class="fa fa-plus-circle valignmiddle" title="'.$langs->trans("AddProject").'"></span></a>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -3756,6 +3759,7 @@ if ($action == 'create') {
|
||||
$incoterm_id = (!empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms : $soc->fk_incoterms);
|
||||
$incoterm_location = (!empty($objectsrc->location_incoterms) ? $objectsrc->location_incoterms : $soc->location_incoterms);
|
||||
}
|
||||
print img_picto('', 'incoterm', 'class="pictofixedwidth"');
|
||||
print $form->select_incoterms($incoterm_id, $incoterm_location);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -237,11 +237,10 @@ class Invoices extends DolibarrApi
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||
if ($errormessage) {
|
||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
$sql .= $this->db->order($sortfield, $sortorder);
|
||||
|
||||
@ -181,7 +181,7 @@ class FactureRec extends CommonInvoice
|
||||
'total_ht' =>array('type'=>'double(24,8)', 'label'=>'Total', 'enabled'=>1, 'visible'=>-1, 'position'=>70, 'isameasure'=>1),
|
||||
'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'Total ttc', 'enabled'=>1, 'visible'=>-1, 'position'=>75, 'isameasure'=>1),
|
||||
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'position'=>80),
|
||||
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>"isModEnabled('project')", 'visible'=>-1, 'position'=>85),
|
||||
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:(fk_statut:=:1)', 'label'=>'Fk projet', 'enabled'=>"isModEnabled('project')", 'visible'=>-1, 'position'=>85),
|
||||
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'Fk cond reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>90),
|
||||
'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'Fk mode reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>95),
|
||||
'date_lim_reglement' =>array('type'=>'date', 'label'=>'Date lim reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>100),
|
||||
|
||||
@ -163,7 +163,12 @@ class Facture extends CommonInvoice
|
||||
// Warning: Do not set default value into property defintion. it must stay null.
|
||||
// For example to avoid to have substition done when object is generic and not yet defined.
|
||||
public $remise_absolue;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public $remise_percent;
|
||||
|
||||
public $total_ht;
|
||||
public $total_tva;
|
||||
public $total_localtax1;
|
||||
@ -320,7 +325,7 @@ class Facture extends CommonInvoice
|
||||
'date_closing' =>array('type'=>'datetime', 'label'=>'Date closing', 'enabled'=>1, 'visible'=>-1, 'position'=>30),
|
||||
'paye' =>array('type'=>'smallint(6)', 'label'=>'InvoicePaidCompletely', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>80),
|
||||
//'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>85),
|
||||
'remise_percent' =>array('type'=>'double', 'label'=>'RelativeDiscount', 'enabled'=>1, 'visible'=>-1, 'position'=>90),
|
||||
//'remise_percent' =>array('type'=>'double', 'label'=>'RelativeDiscount', 'enabled'=>1, 'visible'=>-1, 'position'=>90),
|
||||
'remise_absolue' =>array('type'=>'double', 'label'=>'CustomerRelativeDiscount', 'enabled'=>1, 'visible'=>-1, 'position'=>91),
|
||||
//'remise' =>array('type'=>'double', 'label'=>'Remise', 'enabled'=>1, 'visible'=>-1, 'position'=>100),
|
||||
'close_code' =>array('type'=>'varchar(16)', 'label'=>'EarlyClosingReason', 'enabled'=>1, 'visible'=>-1, 'position'=>92),
|
||||
@ -336,7 +341,7 @@ class Facture extends CommonInvoice
|
||||
'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>167),
|
||||
'fk_user_closing' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserClosing', 'enabled'=>1, 'visible'=>-1, 'position'=>168),
|
||||
'fk_facture_source' =>array('type'=>'integer', 'label'=>'SourceInvoice', 'enabled'=>1, 'visible'=>-1, 'position'=>170),
|
||||
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>175),
|
||||
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:(fk_statut:=:1)', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>175),
|
||||
'fk_account' =>array('type'=>'integer', 'label'=>'Fk account', 'enabled'=>1, 'visible'=>-1, 'position'=>180),
|
||||
'fk_currency' =>array('type'=>'varchar(3)', 'label'=>'CurrencyCode', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
|
||||
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>190),
|
||||
@ -560,7 +565,7 @@ class Facture extends CommonInvoice
|
||||
|
||||
// Fields always coming from template
|
||||
$this->remise_absolue = $_facrec->remise_absolue;
|
||||
$this->remise_percent = $_facrec->remise_percent;
|
||||
$this->remise_percent = $_facrec->remise_percent; // TODO deprecated
|
||||
$this->fk_incoterms = $_facrec->fk_incoterms;
|
||||
$this->location_incoterms = $_facrec->location_incoterms;
|
||||
|
||||
@ -664,7 +669,7 @@ class Facture extends CommonInvoice
|
||||
$sql .= ", fk_soc";
|
||||
$sql .= ", datec";
|
||||
$sql .= ", remise_absolue";
|
||||
$sql .= ", remise_percent";
|
||||
$sql .= ", remise_percent"; // TODO deprecated
|
||||
$sql .= ", datef";
|
||||
$sql .= ", date_pointoftax";
|
||||
$sql .= ", note_private";
|
||||
@ -690,7 +695,7 @@ class Facture extends CommonInvoice
|
||||
$sql .= ", ".((int) $socid);
|
||||
$sql .= ", '".$this->db->idate($now)."'";
|
||||
$sql .= ", ".($this->remise_absolue > 0 ? $this->remise_absolue : 'NULL');
|
||||
$sql .= ", ".($this->remise_percent > 0 ? $this->remise_percent : 'NULL');
|
||||
$sql .= ", ".($this->remise_percent > 0 ? $this->remise_percent : 'NULL'); // TODO deprecated
|
||||
$sql .= ", '".$this->db->idate($this->date)."'";
|
||||
$sql .= ", ".(empty($this->date_pointoftax) ? "null" : "'".$this->db->idate($this->date_pointoftax)."'");
|
||||
$sql .= ", ".($this->note_private ? "'".$this->db->escape($this->note_private)."'" : "null");
|
||||
@ -1154,7 +1159,7 @@ class Facture extends CommonInvoice
|
||||
$facture->cond_reglement_id = $this->cond_reglement_id;
|
||||
$facture->mode_reglement_id = $this->mode_reglement_id;
|
||||
$facture->remise_absolue = $this->remise_absolue;
|
||||
$facture->remise_percent = $this->remise_percent;
|
||||
$facture->remise_percent = $this->remise_percent; // TODO deprecated
|
||||
|
||||
$facture->origin = $this->origin;
|
||||
$facture->origin_id = $this->origin_id;
|
||||
@ -1330,8 +1335,7 @@ class Facture extends CommonInvoice
|
||||
$action = '';
|
||||
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) {
|
||||
$this->errors += $hookmanager->errors;
|
||||
$this->error = $hookmanager->error;
|
||||
$this->setErrorsFromObject($hookmanager);
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
@ -1465,8 +1469,7 @@ class Facture extends CommonInvoice
|
||||
$action = '';
|
||||
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) {
|
||||
$this->errors += $hookmanager->errors;
|
||||
$this->error = $hookmanager->error;
|
||||
$this->setErrorsFromObject($hookmanager);
|
||||
$error++;
|
||||
}
|
||||
|
||||
@ -2034,7 +2037,7 @@ class Facture extends CommonInvoice
|
||||
$this->date_validation = $this->db->jdate($obj->datev);
|
||||
$this->date_modification = $this->db->jdate($obj->datem);
|
||||
$this->datem = $this->db->jdate($obj->datem);
|
||||
$this->remise_percent = $obj->remise_percent;
|
||||
$this->remise_percent = $obj->remise_percent; // TODO deprecated
|
||||
$this->remise_absolue = $obj->remise_absolue;
|
||||
$this->total_ht = $obj->total_ht;
|
||||
$this->total_tva = $obj->total_tva;
|
||||
@ -2370,7 +2373,7 @@ class Facture extends CommonInvoice
|
||||
$sql .= " date_pointoftax=".(strval($this->date_pointoftax) != '' ? "'".$this->db->idate($this->date_pointoftax)."'" : 'null').",";
|
||||
$sql .= " date_valid=".(strval($this->date_validation) != '' ? "'".$this->db->idate($this->date_validation)."'" : 'null').",";
|
||||
$sql .= " paye=".(isset($this->paye) ? $this->db->escape($this->paye) : 0).",";
|
||||
$sql .= " remise_percent=".(isset($this->remise_percent) ? $this->db->escape($this->remise_percent) : "null").",";
|
||||
$sql .= " remise_percent=".(isset($this->remise_percent) ? $this->db->escape($this->remise_percent) : "null").","; // TODO deprecated
|
||||
$sql .= " remise_absolue=".(isset($this->remise_absolue) ? $this->db->escape($this->remise_absolue) : "null").",";
|
||||
$sql .= " close_code=".(isset($this->close_code) ? "'".$this->db->escape($this->close_code)."'" : "null").",";
|
||||
$sql .= " close_note=".(isset($this->close_note) ? "'".$this->db->escape($this->close_note)."'" : "null").",";
|
||||
@ -4287,6 +4290,7 @@ class Facture extends CommonInvoice
|
||||
* @param double $remise Discount
|
||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @deprecated remise_percent is a deprecated field for object parent
|
||||
*/
|
||||
public function setDiscount($user, $remise, $notrigger = 0)
|
||||
{
|
||||
@ -5770,6 +5774,7 @@ class Facture extends CommonInvoice
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture";
|
||||
$sql .= " WHERE type = " . (int) $this->type ;
|
||||
$sql .= " AND date_valid IS NOT NULL";
|
||||
$sql .= " AND entity IN (".getEntity('invoice').")";
|
||||
$sql .= " ORDER BY datef DESC LIMIT 1";
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
@ -5821,7 +5826,7 @@ class Facture extends CommonInvoice
|
||||
$return .= '<br><span class="info-box-label">'.$this->fk_user_author.'</span>';
|
||||
}
|
||||
if (method_exists($this, 'getLibStatut')) {
|
||||
$return .= '<br><div class="info-box-status margintoponly">'.$this->getLibStatut(5).'</div>';
|
||||
$return .= '<br><div class="info-box-status margintoponly">'.$this->getLibStatut(3).'</div>';
|
||||
}
|
||||
$return .= '</div>';
|
||||
$return .= '</div>';
|
||||
@ -6496,14 +6501,15 @@ class FactureLigne extends CommonInvoiceLine
|
||||
* Returns situation_percent of the previous line.
|
||||
* Warning: If invoice is a replacement invoice, this->fk_prev_id is id of the replaced line.
|
||||
*
|
||||
* @param int $invoiceid Invoice id
|
||||
* @param int $invoiceid Invoice id
|
||||
* @param bool $include_credit_note Include credit note or not
|
||||
* @return int >= 0
|
||||
* @return int >= 0
|
||||
*/
|
||||
public function get_prev_progress($invoiceid, $include_credit_note = true)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $invoicecache;
|
||||
|
||||
if (is_null($this->fk_prev_id) || empty($this->fk_prev_id) || $this->fk_prev_id == "") {
|
||||
return 0;
|
||||
} else {
|
||||
|
||||
@ -56,7 +56,6 @@ $mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hier
|
||||
|
||||
$socid = GETPOST('socid', 'int');
|
||||
|
||||
// Security check
|
||||
$id = (GETPOST('facid', 'int') ?GETPOST('facid', 'int') : GETPOST('id', 'int'));
|
||||
$lineid = GETPOST('lineid', 'int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
@ -140,7 +139,7 @@ $arrayfields = array(
|
||||
'f.titre'=>array('label'=>"Ref", 'checked'=>1),
|
||||
's.nom'=>array('label'=>"ThirdParty", 'checked'=>1),
|
||||
'f.total_ht'=>array('label'=>"AmountHT", 'checked'=>1),
|
||||
'f.total_tva'=>array('label'=>"AmountVAT", 'checked'=>1),
|
||||
'f.total_tva'=>array('label'=>"AmountVAT", 'checked'=>-1),
|
||||
'f.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>1),
|
||||
'f.fk_mode_reglement'=>array('label'=>"PaymentMode", 'checked'=>0),
|
||||
'f.fk_cond_reglement'=>array('label'=>"PaymentTerm", 'checked'=>0),
|
||||
@ -184,6 +183,7 @@ $permissionnote = $user->hasRight('facture', 'creer'); // Used by the include of
|
||||
$permissiondellink = $user->hasRight('facture', 'creer'); // Used by the include of actions_dellink.inc.php
|
||||
$permissiontoedit = $user->hasRight('facture', 'creer'); // Used by the include of actions_lineupdonw.inc.php
|
||||
|
||||
// Security check
|
||||
$result = restrictedArea($user, 'facture', $object->id, $objecttype);
|
||||
|
||||
|
||||
@ -588,7 +588,7 @@ print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwit
|
||||
|
||||
// Fields title search
|
||||
// --------------------------------------------------------------------
|
||||
print '<tr class="liste_titre">';
|
||||
print '<tr class="liste_titre_filter">';
|
||||
// Action column
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td class="liste_titre maxwidthsearch center">';
|
||||
@ -711,7 +711,7 @@ if (!empty($arrayfields['f.tms']['checked'])) {
|
||||
}
|
||||
// Status
|
||||
if (!empty($arrayfields['status']['checked'])) {
|
||||
print '<td class="liste_titre center">';
|
||||
print '<td class="liste_titre center minwidth75imp parentonrightofpage">';
|
||||
$liststatus = array(
|
||||
0=>$langs->trans("Draft"),
|
||||
1=>$langs->trans("Active"),
|
||||
@ -737,78 +737,97 @@ $totalarray['nbfield'] = 0;
|
||||
print '<tr class="liste_titre">';
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['f.titre']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['f.titre']['label'], $_SERVER['PHP_SELF'], "f.titre", "", $param, "", $sortfield, $sortorder);
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['s.nom']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER['PHP_SELF'], "s.nom", "", $param, "", $sortfield, $sortorder);
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['f.total_ht']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['f.total_ht']['label'], $_SERVER['PHP_SELF'], "f.total_ht", "", $param, 'class="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($arrayfields['f.total_ht']['label'], $_SERVER['PHP_SELF'], "f.total_ht", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['f.total_tva']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['f.total_tva']['label'], $_SERVER['PHP_SELF'], "f.total_tva", "", $param, 'class="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($arrayfields['f.total_tva']['label'], $_SERVER['PHP_SELF'], "f.total_tva", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['f.total_ttc']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['f.total_ttc']['label'], $_SERVER['PHP_SELF'], "f.total_ttc", "", $param, 'class="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($arrayfields['f.total_ttc']['label'], $_SERVER['PHP_SELF'], "f.total_ttc", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['f.fk_cond_reglement']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['f.fk_cond_reglement']['label'], $_SERVER['PHP_SELF'], "f.fk_cond_reglement", "", $param, '', $sortfield, $sortorder);
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['f.fk_mode_reglement']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['f.fk_mode_reglement']['label'], $_SERVER['PHP_SELF'], "f.fk_mode_reglement", "", $param, '', $sortfield, $sortorder);
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['recurring']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['recurring']['label'], $_SERVER['PHP_SELF'], "recurring", "", $param, 'class="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($arrayfields['recurring']['label'], $_SERVER['PHP_SELF'], "recurring", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['f.frequency']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['f.frequency']['label'], $_SERVER['PHP_SELF'], "f.frequency", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($arrayfields['f.frequency']['label'], $_SERVER['PHP_SELF'], "f.frequency", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['f.unit_frequency']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['f.unit_frequency']['label'], $_SERVER['PHP_SELF'], "f.unit_frequency", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($arrayfields['f.unit_frequency']['label'], $_SERVER['PHP_SELF'], "f.unit_frequency", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['f.nb_gen_done']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['f.nb_gen_done']['label'], $_SERVER['PHP_SELF'], "f.nb_gen_done", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($arrayfields['f.nb_gen_done']['label'], $_SERVER['PHP_SELF'], "f.nb_gen_done", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['f.date_last_gen']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['f.date_last_gen']['label'], $_SERVER['PHP_SELF'], "f.date_last_gen", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($arrayfields['f.date_last_gen']['label'], $_SERVER['PHP_SELF'], "f.date_last_gen", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['f.date_when']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['f.date_when']['label'], $_SERVER['PHP_SELF'], "f.date_when", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($arrayfields['f.date_when']['label'], $_SERVER['PHP_SELF'], "f.date_when", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['f.fk_user_author']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['f.fk_user_author']['label'], $_SERVER['PHP_SELF'], "f.fk_user_author", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($arrayfields['f.fk_user_author']['label'], $_SERVER['PHP_SELF'], "f.fk_user_author", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['f.fk_user_modif']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['f.fk_user_modif']['label'], $_SERVER['PHP_SELF'], "f.fk_user_modif", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($arrayfields['f.fk_user_modif']['label'], $_SERVER['PHP_SELF'], "f.fk_user_modif", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['f.datec']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['f.datec']['label'], $_SERVER['PHP_SELF'], "f.datec", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($arrayfields['f.datec']['label'], $_SERVER['PHP_SELF'], "f.datec", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['f.tms']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['f.tms']['label'], $_SERVER['PHP_SELF'], "f.tms", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($arrayfields['f.tms']['label'], $_SERVER['PHP_SELF'], "f.tms", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||
if (!empty($arrayfields['status']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['status']['label'], $_SERVER['PHP_SELF'], "f.suspended,f.frequency", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($arrayfields['status']['label'], $_SERVER['PHP_SELF'], "f.suspended,f.frequency", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
// Action column
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
$totalarray['nbfield']++; // For the column action
|
||||
print '</tr>'."\n";
|
||||
|
||||
$i = 0;
|
||||
$savnbfield = $totalarray['nbfield'];
|
||||
$totalarray = array();
|
||||
$totalarray['nbfield'] = 0;
|
||||
$totalarray['val']['f.total_ht'] = 0;
|
||||
$totalarray['val']['f.total_tva'] = 0;
|
||||
$totalarray['val']['f.total_ttc'] = 0;
|
||||
$imaxinloop = ($limit ? min($num, $limit) : $num);
|
||||
$i = 0;
|
||||
$savnbfield = $totalarray['nbfield'];
|
||||
$totalarray = array();
|
||||
$totalarray['nbfield'] = 0;
|
||||
$totalarray['val']['f.total_ht'] = 0;
|
||||
$totalarray['val']['f.total_tva'] = 0;
|
||||
$totalarray['val']['f.total_ttc'] = 0;
|
||||
$imaxinloop = ($limit ? min($num, $limit) : $num);
|
||||
while ($i < $imaxinloop) {
|
||||
$objp = $db->fetch_object($resql);
|
||||
if (empty($objp)) {
|
||||
|
||||
@ -1928,7 +1928,7 @@ if ($resql) {
|
||||
$userstatic->fetch($obj->fk_user_author);
|
||||
$facturestatic->fk_user_author = $userstatic->getNomUrl(1);
|
||||
print $facturestatic->getKanbanView('');
|
||||
if ($i == (min($num, $limit) - 1)) {
|
||||
if ($i == ($imaxinloop - 1)) {
|
||||
print '</div>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
<?php
|
||||
use Stripe\BankAccount;
|
||||
|
||||
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
@ -138,9 +140,24 @@ if (empty($reshook)) {
|
||||
}
|
||||
}
|
||||
|
||||
// Payment with Direct Debit Stripe
|
||||
if ($action == 'sepastripepayment' && $usercancreate) {
|
||||
// Make payment with Direct Debit Stripe
|
||||
if ($action == 'sepastripedirectdebit' && $usercancreate) {
|
||||
$result = $object->makeStripeSepaRequest($user, GETPOST('did', 'int'), 'direct-debit', 'facture');
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
} else {
|
||||
// We refresh object data
|
||||
$ret = $object->fetch($id, $ref);
|
||||
$isdraft = (($object->statut == Facture::STATUS_DRAFT) ? 1 : 0);
|
||||
if ($ret > 0) {
|
||||
$object->fetch_thirdparty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Make payment with Direct Debit Stripe
|
||||
if ($action == 'sepastripecredittransfer' && $usercancreate) {
|
||||
$result = $object->makeStripeSepaRequest($user, GETPOST('did', 'int'), 'bank-transfer', 'supplier_invoice');
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
} else {
|
||||
@ -153,7 +170,7 @@ if (empty($reshook)) {
|
||||
}
|
||||
}
|
||||
|
||||
// payments conditions
|
||||
// Set payments conditions
|
||||
if ($action == 'setconditions' && $usercancreate) {
|
||||
$object->fetch($id);
|
||||
$object->cond_reglement_code = 0; // To clean property
|
||||
@ -325,7 +342,7 @@ if ($object->id > 0) {
|
||||
$sql .= " WHERE fk_facture = ".((int) $object->id);
|
||||
}
|
||||
$sql .= " AND pfd.traite = 0";
|
||||
$sql .= " AND pfd.ext_payment_id IS NULL";
|
||||
$sql .= " AND pfd.type = 'ban'";
|
||||
$sql .= " ORDER BY pfd.date_demande DESC";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
@ -404,7 +421,7 @@ if ($object->id > 0) {
|
||||
print '<span class="badgeneutral">';
|
||||
print $object->getLibType();
|
||||
print '</span>';
|
||||
if ($object->module_source) {
|
||||
if (!empty($object->module_source)) {
|
||||
print ' <span class="opacitymediumbycolor paddingleft">('.$langs->trans("POS").' '.$object->module_source.' - '.$langs->trans("Terminal").' '.$object->pos_source.')</span>';
|
||||
}
|
||||
if ($object->type == $object::TYPE_REPLACEMENT) {
|
||||
@ -700,7 +717,7 @@ if ($object->id > 0) {
|
||||
$sql .= " WHERE fk_facture = ".((int) $object->id);
|
||||
}
|
||||
$sql .= " AND pfd.traite = 0";
|
||||
$sql .= " AND pfd.ext_payment_id IS NULL";
|
||||
$sql .= " AND pfd.type = 'ban'";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
@ -817,7 +834,8 @@ if ($object->id > 0) {
|
||||
print '</tr>';
|
||||
|
||||
$sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande,";
|
||||
$sql .= " pfd.date_traite as date_traite, pfd.amount,";
|
||||
$sql .= " pfd.date_traite as date_traite, pfd.amount, pfd.fk_prelevement_bons,";
|
||||
$sql .= " pb.ref, pb.date_trans, pb.method_trans, pb.credite, pb.date_credit, pb.datec, pb.statut as status, pb.amount as pb_amount,";
|
||||
$sql .= " u.rowid as user_id, u.email, u.lastname, u.firstname, u.login, u.statut as user_status";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pfd";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on pfd.fk_user_demande = u.rowid";
|
||||
@ -828,7 +846,7 @@ if ($object->id > 0) {
|
||||
$sql .= " WHERE fk_facture = ".((int) $object->id);
|
||||
}
|
||||
$sql .= " AND pfd.traite = 0";
|
||||
$sql .= " AND pfd.ext_payment_id IS NULL";
|
||||
$sql .= " AND pfd.type = 'ban'";
|
||||
$sql .= " ORDER BY pfd.date_demande DESC";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
@ -868,19 +886,47 @@ if ($object->id > 0) {
|
||||
print '<td class="center"><span class="opacitymedium">'.$langs->trans("OrderWaiting").'</span></td>';
|
||||
|
||||
// Link to make payment now
|
||||
print '<td>';
|
||||
if (!empty($conf->global->STRIPE_SEPA_DIRECT_DEBIT)) {
|
||||
$langs->load("stripe");
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=sepastripepayment&paymentservice=stripesepa&token='.newToken().'&did='.$obj->rowid.'&id='.$object->id.'&type='.urlencode($type).'">'.img_picto('', 'stripe', 'class="pictofixedwidth"').$langs->trans("RequestDirectDebitWithStripe").'</a>';
|
||||
print '<td class="center">';
|
||||
if ($obj->fk_prelevement_bons > 0) {
|
||||
$withdrawreceipt = new BonPrelevement($db);
|
||||
$withdrawreceipt->id = $obj->fk_prelevement_bons;
|
||||
$withdrawreceipt->ref = $obj->ref;
|
||||
$withdrawreceipt->date_trans = $db->jdate($obj->date_trans);
|
||||
$withdrawreceipt->date_credit = $db->jdate($obj->date_credit);
|
||||
$withdrawreceipt->date_creation = $db->jdate($obj->datec);
|
||||
$withdrawreceipt->statut = $obj->status;
|
||||
$withdrawreceipt->status = $obj->status;
|
||||
$withdrawreceipt->amount = $obj->pb_amount;
|
||||
//$withdrawreceipt->credite = $db->jdate($obj->credite);
|
||||
|
||||
print $withdrawreceipt->getNomUrl(1);
|
||||
}
|
||||
|
||||
if ($type != 'bank-transfer') {
|
||||
if (!empty($conf->global->STRIPE_SEPA_DIRECT_DEBIT)) {
|
||||
$langs->load("stripe");
|
||||
if ($obj->fk_prelevement_bons > 0) {
|
||||
print ' ';
|
||||
}
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=sepastripedirectdebit&paymentservice=stripesepa&token='.newToken().'&did='.$obj->rowid.'&id='.$object->id.'&type='.urlencode($type).'">'.img_picto('', 'stripe', 'class="pictofixedwidth"').$langs->trans("RequestDirectDebitWithStripe").'</a>';
|
||||
}
|
||||
} else {
|
||||
if (!empty($conf->global->STRIPE_SEPA_CREDIT_TRANSFER)) {
|
||||
$langs->load("stripe");
|
||||
if ($obj->fk_prelevement_bons > 0) {
|
||||
print ' ';
|
||||
}
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=sepastripecredittransfer&paymentservice=stripesepa&token='.newToken().'&did='.$obj->rowid.'&id='.$object->id.'&type='.urlencode($type).'">'.img_picto('', 'stripe', 'class="pictofixedwidth"').$langs->trans("RequestDirectDebitWithStripe").'</a>';
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
//
|
||||
print '<td align="center">-</td>';
|
||||
print '<td class="center">-</td>';
|
||||
|
||||
// Actions
|
||||
print '<td class="right">';
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&token='.newToken().'&did='.$obj->rowid.'&type='.$type.'">';
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&token='.newToken().'&did='.$obj->rowid.'&type='.urlencode($type).'">';
|
||||
print img_delete();
|
||||
print '</a></td>';
|
||||
|
||||
@ -897,7 +943,7 @@ if ($object->id > 0) {
|
||||
// Past requests
|
||||
|
||||
$sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande, pfd.date_traite, pfd.fk_prelevement_bons, pfd.amount,";
|
||||
$sql .= " pb.ref,";
|
||||
$sql .= " pb.ref, pb.date_trans, pb.method_trans, pb.credite, pb.date_credit, pb.datec, pb.statut as status, pb.fk_bank_account, pb.amount as pb_amount,";
|
||||
$sql .= " u.rowid as user_id, u.email, u.lastname, u.firstname, u.login, u.statut as user_status";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pfd";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on pfd.fk_user_demande = u.rowid";
|
||||
@ -908,19 +954,19 @@ if ($object->id > 0) {
|
||||
$sql .= " WHERE fk_facture = ".((int) $object->id);
|
||||
}
|
||||
$sql .= " AND pfd.traite = 1";
|
||||
$sql .= " AND pfd.ext_payment_id IS NULL";
|
||||
$sql .= " AND pfd.type = 'ban'";
|
||||
$sql .= " ORDER BY pfd.date_demande DESC";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$numclosed = $num;
|
||||
$i = 0;
|
||||
|
||||
$tmpuser = new User($db);
|
||||
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($result);
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$tmpuser->id = $obj->user_id;
|
||||
$tmpuser->login = $obj->login;
|
||||
@ -941,10 +987,10 @@ if ($object->id > 0) {
|
||||
print '</td>';
|
||||
|
||||
// Amount
|
||||
print '<td class="center">'.price($obj->amount).'</td>';
|
||||
print '<td class="center"><span class="amount">'.price($obj->amount).'</span></td>';
|
||||
|
||||
// Date process
|
||||
print '<td class="center">'.dol_print_date($db->jdate($obj->date_traite), 'day')."</td>\n";
|
||||
print '<td class="center">'.dol_print_date($db->jdate($obj->date_traite), 'dayhour', 'tzuserrel')."</td>\n";
|
||||
|
||||
// Link to payment request done
|
||||
print '<td class="center">';
|
||||
@ -952,7 +998,32 @@ if ($object->id > 0) {
|
||||
$withdrawreceipt = new BonPrelevement($db);
|
||||
$withdrawreceipt->id = $obj->fk_prelevement_bons;
|
||||
$withdrawreceipt->ref = $obj->ref;
|
||||
$withdrawreceipt->date_trans = $db->jdate($obj->date_trans);
|
||||
$withdrawreceipt->date_credit = $db->jdate($obj->date_credit);
|
||||
$withdrawreceipt->date_creation = $db->jdate($obj->datec);
|
||||
$withdrawreceipt->statut = $obj->status;
|
||||
$withdrawreceipt->status = $obj->status;
|
||||
$withdrawreceipt->fk_bank_account = $obj->fk_bank_account;
|
||||
$withdrawreceipt->amount = $obj->pb_amount;
|
||||
//$withdrawreceipt->credite = $db->jdate($obj->credite);
|
||||
|
||||
print $withdrawreceipt->getNomUrl(1);
|
||||
print ' ';
|
||||
print $withdrawreceipt->getLibStatut(2);
|
||||
|
||||
// Show the bank account
|
||||
$fk_bank_account = $withdrawreceipt->fk_bank_account;
|
||||
if (empty($fk_bank_account)) {
|
||||
$fk_bank_account = ($object->type == 'bank-transfer' ? $conf->global->PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT : $conf->global->PRELEVEMENT_ID_BANKACCOUNT);
|
||||
}
|
||||
if ($fk_bank_account > 0) {
|
||||
$bankaccount = new Account($db);
|
||||
$result = $bankaccount->fetch($fk_bank_account);
|
||||
if ($result > 0) {
|
||||
print ' - ';
|
||||
print $bankaccount->getNomUrl(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
print "</td>\n";
|
||||
|
||||
@ -970,7 +1041,7 @@ if ($object->id > 0) {
|
||||
print '<tr class="oddeven"><td colspan="7"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
|
||||
}
|
||||
|
||||
$db->free($result);
|
||||
$db->free($resql);
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
@ -28,15 +28,19 @@ require_once DOL_DOCUMENT_ROOT.'/compta/localtax/class/localtax.class.php';
|
||||
// Load translation files required by the page
|
||||
$langs->load("compta");
|
||||
|
||||
$limit = GETPOST('limit', 'int');
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST('socid', 'int');
|
||||
if ($user->socid) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
|
||||
$result = restrictedArea($user, 'tax', '', '', 'charges');
|
||||
$ltt = GETPOST("localTaxType", 'int');
|
||||
$mode = GETPOST('mode', 'alpha');
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
@ -80,8 +84,9 @@ if ($result) {
|
||||
print '<td class="nowrap" align="left">'.$langs->trans("DatePayment").'</td>';
|
||||
print "<td align=\"right\">".$langs->trans("PayedByThisPayment")."</td>";
|
||||
print "</tr>\n";
|
||||
$var = 1;
|
||||
while ($i < $num) {
|
||||
|
||||
$imaxinloop = ($limit ? min($num, $limit) : $num);
|
||||
while ($i < $imaxinloop) {
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
$localtax_static->label = $obj->label;
|
||||
@ -100,7 +105,7 @@ if ($result) {
|
||||
}
|
||||
// Output Kanban
|
||||
print $localtax_static->getKanbanView('');
|
||||
if ($i == ($num - 1)) {
|
||||
if ($i == ($imaxinloop - 1)) {
|
||||
print '</div>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user