diff --git a/.gitignore b/.gitignore index e9603bd2d8f..3315a7eed88 100644 --- a/.gitignore +++ b/.gitignore @@ -57,3 +57,4 @@ yarn.lock package-lock.json doc/install.lock +/.asciidoctorconfig.adoc diff --git a/ChangeLog b/ChangeLog index 43caeb47679..06c6898993d 100644 --- a/ChangeLog +++ b/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. @@ -246,8 +224,6 @@ Following changes may create regressions for some external modules, but were nec * The property $url_last_version must be public if defined into module descriptor files; - - ***** ChangeLog for 16.0.4 compared to 16.0.3 ***** FIX: Amount of localtax1 and 2 not correctly save on purchase order (the rate was saved instead) diff --git a/README.md b/README.md index 826955aef92..e4b464d77b4 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ![Downloads per day](https://img.shields.io/sourceforge/dw/dolibarr.svg) ![Build status](https://img.shields.io/travis/Dolibarr/dolibarr/develop.svg) -[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%205.6-8892BF.svg?style=flat-square)](https://php.net/) +[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%207.0-8892BF.svg?style=flat-square)](https://php.net/) [![GitHub release](https://img.shields.io/github/v/release/Dolibarr/dolibarr)](https://github.com/Dolibarr/dolibarr) [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/5521/badge)](https://bestpractices.coreinfrastructure.org/projects/5521) diff --git a/htdocs/accountancy/class/accountancycategory.class.php b/htdocs/accountancy/class/accountancycategory.class.php index 92d493b8b29..5c13c2efba8 100644 --- a/htdocs/accountancy/class/accountancycategory.class.php +++ b/htdocs/accountancy/class/accountancycategory.class.php @@ -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 { diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index 5f603a973c2..17ac1d211ae 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -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 ''.$langs->trans("DescVentilCustomer").''.$langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")).'
'; print '
'; +if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) { + print info_admin($langs->trans("SorryThisModuleIsNotCompatibleWithTheExperimentalFeatureOfSituationInvoices")); + print "
"; +} $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 ''; print ''; 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 ''; print ''; if ($row[0] == 'tobind') { @@ -630,7 +644,6 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa print "\n"; print ''; - if (isModEnabled('margin')) { print "
\n"; print '
'; @@ -644,22 +657,41 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa print ''.$langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT)).''; } print ''.$langs->trans("Total").''; - $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)."'"; diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index b8df8890a01..888cc568cf8 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -189,8 +189,8 @@ print '