diff --git a/.travis.yml b/.travis.yml
index c1bed319447..733e997bdf3 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -38,8 +38,8 @@ env:
jobs:
fast_finish: true
- allow_failures:
- - php: nightly
+ #allow_failures:
+ #- php: nightly
include:
- if: type = push
php: '5.6'
@@ -73,13 +73,6 @@ before_install:
phpenv config-rm xdebug.ini
echo
-- |
- if [ "$DB" = 'postgresql' ]; then
- echo "Check pgloader version"
- pgloader --version
- echo
- fi
-
install:
- |
echo "Updating Composer"
@@ -178,6 +171,10 @@ before_script:
mysql --version | head -
mysql -e "SELECT VERSION();" | head -
psql --version
+ if [ "$DB" = 'postgresql' ]; then
+ echo "Check pgloader version"
+ pgloader --version
+ fi
echo
- |
diff --git a/ChangeLog b/ChangeLog
index ecf20be261f..c35ca9ba9b1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,7 +7,8 @@ English Dolibarr ChangeLog
For users:
----------
-NEW: Add module "Credit transfer SEPA" to manage payment of vendors using bank credit transfer SEPA files.
+NEW: Module "Credit transfer SEPA" to manage payment of vendors using bank credit transfer SEPA files.
+NEW: Module Intracomm report
NEW: Module Reception (for a more accurate management of your receptions) moved from experimental to stable.
NEW: Module Recruitment to manage Job position and applications.
NEW: Several security issues after a private bug bounty campaign.
@@ -16,13 +17,12 @@ NEW: Accountancy - add options to disable binding on sales, purchases & expense
NEW: Accountancy balance - add a menu entry to show subtotal by group
NEW: Accountancy - change menu disposition
NEW: Accountancy - on transfers, select the periodicity by default
-NEW: Accountancy - Add export for Gestinum (v3 & v5)
+NEW: Accountancy - Add export for Gestinum (v3 & v5) #15180
NEW: new currency rate editor
NEW: Solve blocking feature. Can increase stock of a Kit without changing subproduct stock.
NEW: add a widget to show the customers with outstanding limits reached
NEW: add 2 rules for emailcollector: Message send/not sent from Dolibarr
NEW: add a counter of number of words for pages in website module
-NEW: add alert before changing thirdparty in TakePOS
NEW: add a page to list Stock at a given date in the past
NEW: add a start date to begin binding in accountancy
NEW: add a statistics page to list popularity of products on invoices
@@ -34,12 +34,12 @@ NEW: add column vat rate in page to define accounting account on product/service
NEW: add costprice in fields of products list
NEW: add an import profile for CUSTOMER ORDER, PO, PROPOSAL MODULE, SUPPLIER INVOICE
NEW: add employee link in expense report binding page
-NEW: add EORI No. as ProfID5
+NEW: add EORI No. as ProfID5 #15382
NEW: add export for various payments
NEW: add Extrafields labels and values in mail on create ticket
NEW: add Extrafields support on ECM module
NEW: add filter rules "is answer" and "is not answer" in email collector
-NEW: add focus when editing on product/stock/product.php Close #14548
+NEW: add focus when editing on product/stock/product.php -> close #14548
NEW: add free text on each terminal of cash desk
NEW: add global search for customer payments and vendor payments
NEW: add global search for miscellaneous payments
@@ -67,7 +67,6 @@ NEW: add search param for close date on order list
NEW: add show preview for mail attachement on form mail
NEW: add State/Province origin for products
NEW: add the workflow interaction close intervention on closing ticket
-NEW: add third order printer to TakePOS
NEW: add tracking number in list and search_all items
NEW: add vcard for adherent and user
NEW: add week number for month view in agenda
@@ -75,7 +74,6 @@ NEW: Algeria data (VAT and forme_juridique)
NEW: allow click on all header numbers on commerce area
NEW: allow to reopen interventions (green button)
NEW: allow zero quantity on supplier/vendor order line
-NEW: appearance tab in TakePOS with more visual parameters
NEW: better currency rate editor
NEW: can build vendor invoice from vendor orders
NEW: can change a product in lines of a recurring invoice or contract
@@ -88,16 +86,14 @@ NEW: can edit the list of sending email profiles
NEW: can enable/disable users in bulk actions
NEW: can filter on accounting system ref in export of chart of account
NEW: can filter on container type, language and tags in the list of web pages
-NEW: can hide eatby, sellby dates with option PRODUCT_DISABLE_SELLBY and PRODUCT_DISABLE_EATBY
+NEW: can hide eatby, sellby dates with option PRODUCT_DISABLE_EATBY and PRODUCT_DISABLE_SELLBY
NEW: can import proposals, sales orders, supplier invoices
NEW: can set a dedicated SMTP config for sending email from public ticket interface
NEW: can set tags/categories to website pages
NEW: can set type of price without tax per default for new sale price creation
NEW: can use desired stock of a given warehouse for replenishment
-NEW: change thirdparty with barcode scan in TakePOS
NEW: common behavior for monthly leave list view
NEW: convert all subscription in datetime
-NEW: can create a thirdparty customer from TakePOS
NEW: date shipment from order accepts hours
NEW: price level compatibility for variant
NEW: delayed payment in TakePOS
@@ -124,29 +120,24 @@ NEW: link on balance to the ledger
NEW: MAIN_EMAILCOLLECTOR_MAIL_WITHOUT_HEADER const in email collector
NEW: manage errors on update extra fields in ticket card
NEW: mass-actions for the event list view
-NEW: Module Intracomm report
NEW: more filter for "View change logs"
-NEW: multicurrency total in TakePOS
NEW: multiselect type and date to date filter
-NEW: Nature of product is now a dictionay
NEW: new line template: hidden conf to fill service dates from the last service line
NEW: PDF model storm for delivery
NEW: possibilty to group payments by mode and show their subtotal
-NEW: Print payment method and change in TakePOS
NEW: Priority and transparency from external calendar events
+NEW: Products - Nature of product is now a dictionary #13287
NEW: Products Import/Export 'default warehouse' and 'use batch number' fields
NEW: Purchase price table: added filterable table columns
NEW: rate editor for multicurrency
NEW: ref_ext field for Commande lines, order lines, Attributes and Combinations, Invoice lines, payments, order lines
NEW: remove new lines in mail on add ticket message
-NEW: restrict thirdparty to customer in TakePOS
NEW: Rule "email to" accept wildcard *
-NEW: Save filter of the project homepage
+NEW: save filter of the project homepage
NEW: select-able columns on customer and supplier invoice paymnet list
NEW: select-able columns on miscellaneous payments + more data columns
NEW: select-able columns on social taxes list
NEW: send context and remove new lines on create ticket
-NEW: show available stock in TakePOS
NEW: show category filter on lists only when user have rights to read categories
NEW: show header number and make it clickable in warehouse area, payment area, shipment area
NEW: show image of user in the combo select of users
@@ -159,24 +150,33 @@ NEW: show tags and status in search list of website pages
NEW: show user on external calender events (when found)
NEW: subject title with company name instead of application title in ticket message
NEW: Support for Samba4 AD
+NEW: TakePOS appearance tab with more visual parameters
+NEW: TakePOS add alert before changing thirdparty
+NEW: TakePOS add third order printer
+NEW: TakePOS can change thirdparty with barcode scan
+NEW: TakePOS can create a thirdparty customer from TakePOS frontend
NEW: TakePOS connector compatibility with RECEIPT PRINTERS module
NEW: TakePOS Gift Receipt
-NEW: TakePOS Multicurrency compatibility
-NEW: the global header of a website can also have dynamic content
-NEW: Third-Party Import new fields: mother company,outstanding debt limit,bank account,incoterms
+NEW: TakePOS multicurrency compatibility
+NEW: TakePOS multicurrency total
+NEW: TakePOS print payment method and change
+NEW: TakePOS restrict thirdparty to customer
+NEW: TakePOS show available stock
+NEW: TakePOS Weighing Scale compatibility with TakePOS connector #14725
+NEW: Thirdparty Import new fields: mother company,outstanding debt limit,bank account,incoterms
NEW: Thirdparty module : box on customer/supplier tab for invoice outsantding amount late
-NEW: ticket classification on create from email collector
+NEW: Ticket classification on create from email collector
NEW: Ticket message notifications when edited from public interface
-NEW: translate classification labels in ticket
+NEW: Ticket translate classification labels in ticket
NEW: VAT rate for Angola #15606
NEW: VAT and juridical status for Algeria
NEW: VAT report - Invert constant to show by default zero VAT in reports
NEW: website page fields selection
-NEW: Weighing Scale compatibility with TakePOS connector
+NEW: website - global header of a website can also have dynamic content
NEW: when creating a user from a member linked to a thirdparty, you can choose to create it as external or internal user
-NEW: add clone button on miscellaneous payment
-NEW: #15065 Add option to put the product label in bold in the PDF templates if configured
-NEW: Add option "If the feature to manage kits of module Stock is used, show details of subproducts of a kit on PDF."
+NEW: add clone button on miscellaneous payment
+NEW: add option to put the product label in bold in the PDF templates if configured #15065
+NEW: add option "If the feature to manage kits of module Stock is used, show details of subproducts of a kit on PDF."
For developers:
@@ -185,7 +185,7 @@ NEW: add substitution key __MEMBER_TYPE__
NEW: add substitution key __TYPE__
NEW: add function dolButtonToOpenUrlInDialogPopup() to be able to open page into a popup
NEW: show line number on intervention card (via MAIN_VIEW_LINE_NUMBER)
-NEW: Add some fields to link website page to an other object
+NEW: add some fields to link website page to an other object
NEW: fill ECM src object fields in dol_add_file_process
NEW: conf to allow to show the full tree in warehouse popup
NEW: can use parameter ?THEME_DARKMODEENABLED=2 for a preview of theme in dark mode
@@ -201,7 +201,7 @@ NEW: standardizes API thirdparties by email like other object
NEW: Thirdparty REST API: endpoint to set price level
NEW: use new category API for project list view
NEW: Triggers Attributes and Attributes values
-NEW: added incoterms data into the substitution array
+NEW: add incoterms data into the substitution array
NEW: add send context for ticket
NEW: add a message in error_log after detection of SQL or script injection
NEW: add validation of MX domain for emails
@@ -211,7 +211,7 @@ NEW: add param to not show links when output tags
APIs
NEW: API get contacts list of a given order
-NEW: API endpoint getContacts and Clean results
+NEW: API endpoint getContacts and clean results
NEW: API can update a payment
NEW: API get member by thirdparty
NEW: API get thirdparty by barcode
@@ -223,7 +223,7 @@ NEW: get state dictionary by REST API
NEW: improve Product API for product variants
HOOKs
-NEW: Hook on propal card
+NEW: add hook on propal card
NEW: add hooks on newpayment page to allow external payment modules
NEW: add hooks on stats pages
NEW: add formConfirm hook on product page
diff --git a/build/README b/build/README
index 14f2b92ae39..626953f9376 100644
--- a/build/README
+++ b/build/README
@@ -7,6 +7,9 @@ Building packages
##################################################
All sub-directories of "build" directory contains files (setup or binary tools) required to build automatically Dolibarr packages.
+The build directory and all its contents is absolutely not required to make Dolibarr working.
+It is here only to build Dolibarr packages, and those generated packages will not contains this "build" directory.
+
There are several tools:
@@ -17,8 +20,7 @@ There are several tools:
--------------------------------------------------------------------------------------------------
-Prerequisites to build tgz, debian, rpm package:
-
+Prerequisites to build tgz, debian and rpm packages:
> apt-get install tar dpkg dpatch p7zip-full rpm zip
@@ -58,10 +60,6 @@ Prerequisites to build autoexe DoliWamp package:
--------------------------------------------------------------------------------------------------
-Note:
-The build directory and all its contents is absolutely not required to make Dolibarr working.
-It is here only to build Dolibarr packages, and those generated packages will not contains this "build" directory.
-
You can find in "build", following sub-directories:
diff --git a/dev/README b/dev/README
index 337928507fc..78666d77f3a 100644
--- a/dev/README
+++ b/dev/README
@@ -1,13 +1,14 @@
README (English)
--------------------------------
-This directory contains sub-directories to provide tools or
-documentation for developers.
-Note: All files in this directory are in VCS only and are not
-provided with a standard release.
+This directory contains sub-directories to provide tools or documentation for developers.
+
+Note: All files in this directory are in the source repository only and are not provided with a standard release. They are useless to make Dolibarr working.
+
+You may find a more complete documentation on Dolibarr on the wiki:
-There is also some documentation on Dolibarr Wiki:
https://wiki.dolibarr.org/
-and
-https://doxygen.dolibarr.org/
+and on
+
+https://doxygen.dolibarr.org/
diff --git a/doc/index.html b/doc/index.html
index 5c655136e3e..333f96099c3 100644
--- a/doc/index.html
+++ b/doc/index.html
@@ -6,18 +6,15 @@
-This directory contains several subdirectories with entries for
-informations on Dolibarr.
-But if you are looking for other resources (downloads, documentation, addons, ...), you can find this
-on Internet on web following sites:
-
-* Dolibarr wiki (documentation)
+This directory contains several subdirectories with entries for informations on Dolibarr.
+But if you are looking for other resources (downloads, documentation, addons, ...), you can find this on Internet on web following sites:
+
* Dolibarr portal (official website)
-* Dolibarr demo (online)
+* Dolibarr wiki (documentation)
-* DoliWamp, the Dolibarr for Windows
+* Dolibarr demo (online)
* DoliStore (official addons/plugins market place)
diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php
index 029550192f0..c905ad25cd0 100644
--- a/htdocs/accountancy/admin/card.php
+++ b/htdocs/accountancy/admin/card.php
@@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
$error = 0;
// Load translation files required by the page
-$langs->loadLangs(array("bills", "accountancy"));
+$langs->loadLangs(array("bills", "accountancy", "compta"));
$mesg = '';
$action = GETPOST('action', 'aZ09');
@@ -41,7 +41,9 @@ $id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
$rowid = GETPOST('rowid', 'int');
$cancel = GETPOST('cancel', 'alpha');
-$accountingaccount = GETPOST('accountingaccount', 'alpha');
+
+$account_number = GETPOST('account_number', 'string');
+$label = GETPOST('label', 'alpha');
// Security check
if ($user->socid > 0) accessforbidden();
@@ -65,104 +67,118 @@ if (GETPOST('cancel', 'alpha'))
if ($action == 'add' && $user->rights->accounting->chartofaccount)
{
if (!$cancel) {
- $sql = 'SELECT pcg_version FROM '.MAIN_DB_PREFIX.'accounting_system WHERE rowid='.$conf->global->CHARTOFACCOUNTS;
-
- dol_syslog('accountancy/admin/card.php:: $sql='.$sql);
- $result = $db->query($sql);
- $obj = $db->fetch_object($result);
-
- // Clean code
-
- // To manage zero or not at the end of the accounting account
- if ($conf->global->ACCOUNTING_MANAGE_ZERO == 1)
+ if (!$account_number)
{
- $account_number = GETPOST('account_number', 'string');
+ setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("AccountNumber")), null, 'errors');
+ $action = 'create';
+ } elseif (!$label)
+ {
+ setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors');
+ $action = 'create';
} else {
- $account_number = clean_account(GETPOST('account_number', 'string'));
- }
+ $sql = 'SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS;
- if (GETPOST('account_parent', 'int') <= 0)
- {
- $account_parent = 0;
- } else {
- $account_parent = GETPOST('account_parent', 'int');
- }
+ dol_syslog('accountancy/admin/card.php:: $sql=' . $sql);
+ $result = $db->query($sql);
+ $obj = $db->fetch_object($result);
- $object->fk_pcg_version = $obj->pcg_version;
- $object->pcg_type = GETPOST('pcg_type', 'alpha');
- $object->account_number = $account_number;
- $object->account_parent = $account_parent;
- $object->account_category = GETPOST('account_category', 'alpha');
- $object->label = GETPOST('label', 'alpha');
- $object->labelshort = GETPOST('labelshort', 'alpha');
- $object->active = 1;
+ // Clean code
- $res = $object->create($user);
- if ($res == - 3) {
- $error = 1;
- $action = "create";
- setEventMessages($object->error, $object->errors, 'errors');
- } elseif ($res == - 4) {
- $error = 2;
- $action = "create";
- setEventMessages($object->error, $object->errors, 'errors');
- } elseif ($res < 0)
- {
- $error++;
- setEventMessages($object->error, $object->errors, 'errors');
- $action = "create";
- }
- if (!$error)
- {
- setEventMessages("RecordCreatedSuccessfully", null, 'mesgs');
- $urltogo = $backtopage ? $backtopage : dol_buildpath('/accountancy/admin/account.php', 1);
- header("Location: ".$urltogo);
- exit;
+ // To manage zero or not at the end of the accounting account
+ if ($conf->global->ACCOUNTING_MANAGE_ZERO == 1) {
+ $account_number = $account_number;
+ } else {
+ $account_number = clean_account($account_number);
+ }
+
+ if (GETPOST('account_parent', 'int') <= 0) {
+ $account_parent = 0;
+ } else {
+ $account_parent = GETPOST('account_parent', 'int');
+ }
+
+ $object->fk_pcg_version = $obj->pcg_version;
+ $object->pcg_type = GETPOST('pcg_type', 'alpha');
+ $object->account_number = $account_number;
+ $object->account_parent = $account_parent;
+ $object->account_category = GETPOST('account_category', 'alpha');
+ $object->label = $label;
+ $object->labelshort = GETPOST('labelshort', 'alpha');
+ $object->active = 1;
+
+ $res = $object->create($user);
+ if ($res == -3) {
+ $error = 1;
+ $action = "create";
+ setEventMessages($object->error, $object->errors, 'errors');
+ } elseif ($res == -4) {
+ $error = 2;
+ $action = "create";
+ setEventMessages($object->error, $object->errors, 'errors');
+ } elseif ($res < 0) {
+ $error++;
+ setEventMessages($object->error, $object->errors, 'errors');
+ $action = "create";
+ }
+ if (!$error) {
+ setEventMessages("RecordCreatedSuccessfully", null, 'mesgs');
+ $urltogo = $backtopage ? $backtopage : dol_buildpath('/accountancy/admin/account.php', 1);
+ header("Location: " . $urltogo);
+ exit;
+ }
}
}
} elseif ($action == 'edit' && $user->rights->accounting->chartofaccount) {
if (!$cancel) {
- $result = $object->fetch($id);
-
- $sql = 'SELECT pcg_version FROM '.MAIN_DB_PREFIX.'accounting_system WHERE rowid='.$conf->global->CHARTOFACCOUNTS;
-
- dol_syslog('accountancy/admin/card.php:: $sql='.$sql);
- $result2 = $db->query($sql);
- $obj = $db->fetch_object($result2);
-
- // Clean code
-
- // To manage zero or not at the end of the accounting account
- if ($conf->global->ACCOUNTING_MANAGE_ZERO == 1)
+ if (!$account_number)
{
- $account_number = GETPOST('account_number', 'string');
- } else {
- $account_number = clean_account(GETPOST('account_number', 'string'));
- }
-
- if (GETPOST('account_parent', 'int') <= 0)
+ setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("AccountNumber")), null, 'errors');
+ $action = 'update';
+ } elseif (!$label)
{
- $account_parent = 0;
+ setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors');
+ $action = 'update';
} else {
- $account_parent = GETPOST('account_parent', 'int');
- }
+ $result = $object->fetch($id);
- $object->fk_pcg_version = $obj->pcg_version;
- $object->pcg_type = GETPOST('pcg_type', 'alpha');
- $object->account_number = $account_number;
- $object->account_parent = $account_parent;
- $object->account_category = GETPOST('account_category', 'alpha');
- $object->label = GETPOST('label', 'alpha');
- $object->labelshort = GETPOST('labelshort', 'alpha');
+ $sql = 'SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS;
- $result = $object->update($user);
+ dol_syslog('accountancy/admin/card.php:: $sql=' . $sql);
+ $result2 = $db->query($sql);
+ $obj = $db->fetch_object($result2);
- if ($result > 0) {
- $urltogo = $backtopage ? $backtopage : ($_SERVER["PHP_SELF"]."?id=".$id);
- header("Location: ".$urltogo);
- exit();
- } else {
- $mesg = $object->error;
+ // Clean code
+
+ // To manage zero or not at the end of the accounting account
+ if ($conf->global->ACCOUNTING_MANAGE_ZERO == 1) {
+ $account_number = $account_number;
+ } else {
+ $account_number = clean_account($account_number);
+ }
+
+ if (GETPOST('account_parent', 'int') <= 0) {
+ $account_parent = 0;
+ } else {
+ $account_parent = GETPOST('account_parent', 'int');
+ }
+
+ $object->fk_pcg_version = $obj->pcg_version;
+ $object->pcg_type = GETPOST('pcg_type', 'alpha');
+ $object->account_number = $account_number;
+ $object->account_parent = $account_parent;
+ $object->account_category = GETPOST('account_category', 'alpha');
+ $object->label = $label;
+ $object->labelshort = GETPOST('labelshort', 'alpha');
+
+ $result = $object->update($user);
+
+ if ($result > 0) {
+ $urltogo = $backtopage ? $backtopage : ($_SERVER["PHP_SELF"] . "?id=" . $id);
+ header("Location: " . $urltogo);
+ exit();
+ } else {
+ $mesg = $object->error;
+ }
}
} else {
$urltogo = $backtopage ? $backtopage : ($_SERVER["PHP_SELF"]."?id=".$id);
@@ -222,7 +238,7 @@ if ($action == 'create') {
// Account number
print ''.$langs->trans("AccountNumber").' ';
- print ' ';
+ print ' ';
// Label
print ''.$langs->trans("Label").' ';
diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php
index 1547983da0c..fcd7efdab47 100644
--- a/htdocs/accountancy/bookkeeping/balance.php
+++ b/htdocs/accountancy/bookkeeping/balance.php
@@ -37,7 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
// Load translation files required by the page
-$langs->loadLangs(array("accountancy"));
+$langs->loadLangs(array("accountancy", "compta"));
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
$sortorder = GETPOST("sortorder", 'alpha');
@@ -88,6 +88,7 @@ if (empty($search_date_start) && !GETPOSTISSET('formfilteraction'))
} else {
$month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
$year_start = dol_print_date(dol_now(), '%Y');
+ if (dol_print_date(dol_now(), '%m') < $month_start) $year_start--; // If current month is lower that starting fiscal month, we start last year
$year_end = $year_start + 1;
$month_end = $month_start - 1;
if ($month_end < 1)
@@ -322,7 +323,9 @@ if ($action != 'export_csv')
$root_account_number = $tmparrayforrootaccount['account_number'];
if (empty($accountingaccountstatic->label) && $accountingaccountstatic->id > 0) {
- $link = ''.img_edit().' ';
+ $link = '' . img_edit() . ' ';
+ } elseif (empty($tmparrayforrootaccount['label'])) {
+ $link = '' . img_edit_add() . ' ';
}
if (!empty($show_subgroup))
diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php
index 830896776b5..59ffdf2e899 100644
--- a/htdocs/accountancy/bookkeeping/list.php
+++ b/htdocs/accountancy/bookkeeping/list.php
@@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
// Load translation files required by the page
-$langs->loadLangs(array("accountancy"));
+$langs->loadLangs(array("accountancy", "compta"));
$socid = GETPOST('socid', 'int');
@@ -661,7 +661,7 @@ if (empty($reshook)) {
}
$newcardbutton .= ''.$langs->trans("IncludeDocsAlreadyExported").' ';
- $newcardbutton .= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', 'fa fa-file-export paddingleft', $_SERVER["PHP_SELF"].'?action=export_file'.($param ? '&'.$param : ''), $user->rights->accounting->mouvements->export);
+ if (!empty($user->rights->accounting->mouvements->export)) $newcardbutton .= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', 'fa fa-file-export paddingleft', $_SERVER["PHP_SELF"].'?action=export_file'.($param ? '&'.$param : ''), $user->rights->accounting->mouvements->export);
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
$newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param, '', 1, array('morecss' => 'marginleftonly'));
diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php
index 34a6b2d5ffd..9c7fef0232b 100644
--- a/htdocs/accountancy/bookkeeping/listbyaccount.php
+++ b/htdocs/accountancy/bookkeeping/listbyaccount.php
@@ -48,6 +48,14 @@ $search_date_endday = GETPOST('search_date_endday', 'int');
$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
$search_date_end = dol_mktime(0, 0, 0, $search_date_endmonth, $search_date_endday, $search_date_endyear);
$search_doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int'));
+$search_date_export_startyear = GETPOST('search_date_export_startyear', 'int');
+$search_date_export_startmonth = GETPOST('search_date_export_startmonth', 'int');
+$search_date_export_startday = GETPOST('search_date_export_startday', 'int');
+$search_date_export_endyear = GETPOST('search_date_export_endyear', 'int');
+$search_date_export_endmonth = GETPOST('search_date_export_endmonth', 'int');
+$search_date_export_endday = GETPOST('search_date_export_endday', 'int');
+$search_date_export_start = dol_mktime(0, 0, 0, $search_date_export_startmonth, $search_date_export_startday, $search_date_export_startyear);
+$search_date_export_end = dol_mktime(0, 0, 0, $search_date_export_endmonth, $search_date_export_endday, $search_date_export_endyear);
$search_accountancy_code = GETPOST("search_accountancy_code");
$search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha');
@@ -128,6 +136,7 @@ $arrayfields = array(
't.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1),
't.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1),
't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1),
+ 't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>1),
);
if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) unset($arrayfields['t.lettering_code']);
@@ -181,6 +190,14 @@ if (empty($reshook))
$search_date_endyear = '';
$search_date_endmonth = '';
$search_date_endday = '';
+ $search_date_export_start = '';
+ $search_date_export_end = '';
+ $search_date_export_startyear = '';
+ $search_date_export_startmonth = '';
+ $search_date_export_startday = '';
+ $search_date_export_endyear = '';
+ $search_date_export_endmonth = '';
+ $search_date_export_endday = '';
$search_debit = '';
$search_credit = '';
$search_lettering_code = '';
@@ -253,6 +270,14 @@ if (empty($reshook))
$filter['t.reconciled_option'] = $search_not_reconciled;
$param .= '&search_not_reconciled='.urlencode($search_not_reconciled);
}
+ if (!empty($search_date_export_start)) {
+ $filter['t.date_export>='] = $search_date_export_start;
+ $param .= '&search_date_export_startmonth='.$search_date_export_startmonth.'&search_date_export_startday='.$search_date_export_startday.'&search_date_export_startyear='.$search_date_export_startyear;
+ }
+ if (!empty($search_date_export_end)) {
+ $filter['t.date_export<='] = $search_date_export_end;
+ $param .= '&search_date_export_endmonth='.$search_date_export_endmonth.'&search_date_export_endday='.$search_date_export_endday.'&search_date_export_endyear='.$search_date_export_endyear;
+ }
}
if ($action == 'delbookkeeping' && $user->rights->accounting->mouvements->supprimer) {
@@ -494,6 +519,17 @@ if (!empty($arrayfields['t.lettering_code']['checked']))
print ' '.$langs->trans("NotReconciled").' ';
print '';
}
+// Date export
+if (!empty($arrayfields['t.date_export']['checked'])) {
+ print '';
+ print '';
+ print $form->selectDate($search_date_export_start, 'search_date_export_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
+ print '
';
+ print '';
+ print $form->selectDate($search_date_export_end, 'search_date_export_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
+ print '
';
+ print ' ';
+}
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields);
@@ -516,6 +552,7 @@ if (!empty($arrayfields['t.label_operation']['checked'])) print_liste_field_tit
if (!empty($arrayfields['t.debit']['checked'])) print_liste_field_titre($arrayfields['t.debit']['label'], $_SERVER['PHP_SELF'], "t.debit", "", $param, '', $sortfield, $sortorder, 'right ');
if (!empty($arrayfields['t.credit']['checked'])) print_liste_field_titre($arrayfields['t.credit']['label'], $_SERVER['PHP_SELF'], "t.credit", "", $param, '', $sortfield, $sortorder, 'right ');
if (!empty($arrayfields['t.lettering_code']['checked'])) print_liste_field_titre($arrayfields['t.lettering_code']['label'], $_SERVER['PHP_SELF'], "t.lettering_code", "", $param, '', $sortfield, $sortorder, 'center ');
+if (!empty($arrayfields['t.date_export']['checked'])) print_liste_field_titre($arrayfields['t.date_export']['label'], $_SERVER['PHP_SELF'], "t.date_export", "", $param, '', $sortfield, $sortorder, 'center ');
// Hook fields
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
@@ -546,13 +583,12 @@ while ($i < min($num, $limit))
// Is it a break ?
if ($accountg != $displayed_account_number || !isset($displayed_account_number)) {
- if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) {
- $colnumber = 3;
- $colnumberend = 7;
- } else {
- $colnumber = 4;
- $colnumberend = 7;
- }
+ $colnumber = 5;
+ $colnumberend = 7;
+
+ if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) $colnumber--;
+ if (empty($arrayfields['t.date_export']['checked'])) $colnumber--;
+
$colspan = $totalarray['nbfield'] - $colnumber;
$colspanend = $totalarray['nbfield'] - $colnumberend;
// Show a subtotal by accounting account
@@ -585,7 +621,7 @@ while ($i < min($num, $limit))
// Show the break account
print "";
- print '';
+ print ' ';
if ($line->numero_compte != "" && $line->numero_compte != '-1') print length_accountg($line->numero_compte).' : '.$object->get_compte_desc($line->numero_compte);
else print ''.$langs->trans("Unknown").' ';
print ' ';
@@ -735,6 +771,13 @@ while ($i < min($num, $limit))
if (!$i) $totalarray['nbfield']++;
}
+ // Exported operation date
+ if (!empty($arrayfields['t.date_export']['checked']))
+ {
+ print ''.dol_print_date($line->date_export, 'dayhour').' ';
+ if (!$i) $totalarray['nbfield']++;
+ }
+
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
@@ -763,14 +806,6 @@ while ($i < min($num, $limit))
}
if ($num > 0) {
- // Show sub-total of last shown account
- if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) {
- $colnumber = 3;
- $colnumberend = 7;
- } else {
- $colnumber = 4;
- $colnumberend = 7;
- }
$colspan = $totalarray['nbfield'] - $colnumber;
$colspanend = $totalarray['nbfield'] - $colnumberend;
print ' ';
diff --git a/htdocs/accountancy/bookkeeping/listbysubaccount.php b/htdocs/accountancy/bookkeeping/listbysubaccount.php
index e30a9984949..2adcbe9f360 100644
--- a/htdocs/accountancy/bookkeeping/listbysubaccount.php
+++ b/htdocs/accountancy/bookkeeping/listbysubaccount.php
@@ -3,7 +3,7 @@
* Copyright (C) 2013-2016 Olivier Geffroy
* Copyright (C) 2013-2020 Florian Henry
* Copyright (C) 2013-2020 Alexandre Spangaro
- * Copyright (C) 2018 Frédéric France
+ * Copyright (C) 2018-2020 Frédéric France
*
* 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
@@ -39,15 +39,23 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
$langs->loadLangs(array("accountancy", "compta"));
$action = GETPOST('action', 'aZ09');
-$search_date_startyear = GETPOST('search_date_startyear', 'int');
-$search_date_startmonth = GETPOST('search_date_startmonth', 'int');
-$search_date_startday = GETPOST('search_date_startday', 'int');
-$search_date_endyear = GETPOST('search_date_endyear', 'int');
-$search_date_endmonth = GETPOST('search_date_endmonth', 'int');
-$search_date_endday = GETPOST('search_date_endday', 'int');
+$search_date_startyear = GETPOST('search_date_startyear', 'int');
+$search_date_startmonth = GETPOST('search_date_startmonth', 'int');
+$search_date_startday = GETPOST('search_date_startday', 'int');
+$search_date_endyear = GETPOST('search_date_endyear', 'int');
+$search_date_endmonth = GETPOST('search_date_endmonth', 'int');
+$search_date_endday = GETPOST('search_date_endday', 'int');
$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
$search_date_end = dol_mktime(0, 0, 0, $search_date_endmonth, $search_date_endday, $search_date_endyear);
$search_doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int'));
+$search_date_export_startyear = GETPOST('search_date_export_startyear', 'int');
+$search_date_export_startmonth = GETPOST('search_date_export_startmonth', 'int');
+$search_date_export_startday = GETPOST('search_date_export_startday', 'int');
+$search_date_export_endyear = GETPOST('search_date_export_endyear', 'int');
+$search_date_export_endmonth = GETPOST('search_date_export_endmonth', 'int');
+$search_date_export_endday = GETPOST('search_date_export_endday', 'int');
+$search_date_export_start = dol_mktime(0, 0, 0, $search_date_export_startmonth, $search_date_export_startday, $search_date_export_startyear);
+$search_date_export_end = dol_mktime(0, 0, 0, $search_date_export_endmonth, $search_date_export_endday, $search_date_export_endyear);
$search_accountancy_code = GETPOST("search_accountancy_code");
$search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha');
@@ -73,16 +81,22 @@ if (GETPOST("button_delmvt_x") || GETPOST("button_delmvt.x") || GETPOST("button_
}
// Load variable for pagination
-$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
+$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
-if (empty($page) || $page < 0) { $page = 0; }
+if (empty($page) || $page < 0) {
+ $page = 0;
+}
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
-if ($sortorder == "") $sortorder = "ASC";
-if ($sortfield == "") $sortfield = "t.doc_date,t.rowid";
+if ($sortorder == "") {
+ $sortorder = "ASC";
+}
+if ($sortfield == "") {
+ $sortfield = "t.doc_date,t.rowid";
+}
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$object = new BookKeeping($db);
@@ -105,11 +119,12 @@ if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET('searc
} else {
$month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
$year_start = dol_print_date(dol_now(), '%Y');
- if (dol_print_date(dol_now(), '%m') < $month_start) $year_start--; // If current month is lower that starting fiscal month, we start last year
+ if (dol_print_date(dol_now(), '%m') < $month_start) {
+ $year_start--; // If current month is lower that starting fiscal month, we start last year
+ }
$year_end = $year_start + 1;
$month_end = $month_start - 1;
- if ($month_end < 1)
- {
+ if ($month_end < 1) {
$month_end = 12;
$year_end--;
}
@@ -128,9 +143,12 @@ $arrayfields = array(
't.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1),
't.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1),
't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1),
+ 't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>1),
);
-if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) unset($arrayfields['t.lettering_code']);
+if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) {
+ unset($arrayfields['t.lettering_code']);
+}
if ($search_date_start && empty($search_date_startyear)) {
$tmparray = dol_getdate($search_date_start);
@@ -149,19 +167,23 @@ if ($search_date_end && empty($search_date_endyear)) {
/*
* Action
*/
-if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; }
-if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; }
+if (GETPOST('cancel', 'alpha')) {
+ $action = 'list'; $massaction = '';
+}
+if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
+ $massaction = '';
+}
$parameters = array('socid'=>$socid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
-if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
+if ($reshook < 0) {
+ setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
+}
-if (empty($reshook))
-{
+if (empty($reshook)) {
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
- if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
- {
+ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
$search_doc_date = '';
$search_accountancy_code = '';
$search_accountancy_code_start = '';
@@ -180,6 +202,14 @@ if (empty($reshook))
$search_date_endyear = '';
$search_date_endmonth = '';
$search_date_endday = '';
+ $search_date_export_start = '';
+ $search_date_export_end = '';
+ $search_date_export_startyear = '';
+ $search_date_export_startmonth = '';
+ $search_date_export_startday = '';
+ $search_date_export_endyear = '';
+ $search_date_export_endmonth = '';
+ $search_date_export_endday = '';
$search_debit = '';
$search_credit = '';
$search_lettering_code = '';
@@ -252,6 +282,14 @@ if (empty($reshook))
$filter['t.reconciled_option'] = $search_not_reconciled;
$param .= '&search_not_reconciled='.urlencode($search_not_reconciled);
}
+ if (!empty($search_date_export_start)) {
+ $filter['t.date_export>='] = $search_date_export_start;
+ $param .= '&search_date_export_startmonth='.$search_date_export_startmonth.'&search_date_export_startday='.$search_date_export_startday.'&search_date_export_startyear='.$search_date_export_startyear;
+ }
+ if (!empty($search_date_export_end)) {
+ $filter['t.date_export<='] = $search_date_export_end;
+ $param .= '&search_date_export_endmonth='.$search_date_export_endmonth.'&search_date_export_endday='.$search_date_export_endday.'&search_date_export_endyear='.$search_date_export_endyear;
+ }
}
if ($action == 'delbookkeeping' && $user->rights->accounting->mouvements->supprimer) {
@@ -279,8 +317,7 @@ if ($action == 'delbookkeepingyearconfirm' && $user->rights->accounting->mouveme
$deljournal = 0;
}
- if (!empty($delmonth) || !empty($delyear) || !empty($deljournal))
- {
+ if (!empty($delmonth) || !empty($delyear) || !empty($deljournal)) {
$result = $object->deleteByYearAndJournal($delyear, $deljournal, '', ($delmonth > 0 ? $delmonth : 0));
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
@@ -289,7 +326,7 @@ if ($action == 'delbookkeepingyearconfirm' && $user->rights->accounting->mouveme
}
// Make a redirect to avoid to launch the delete later after a back button
- header("Location: listbysubaccount.php".($param ? '?'.$param : ''));
+ header("Location: ".$_SERVER["PHP_SELF"].($param ? '?'.$param : ''));
exit;
} else {
setEventMessages("NoRecordDeleted", null, 'warnings');
@@ -306,7 +343,7 @@ if ($action == 'delmouvconfirm' && $user->rights->accounting->mouvements->suppri
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
}
- header("Location: listbysubaccount.php?noreset=1".($param ? '&'.$param : ''));
+ header("Location: ".$_SERVER["PHP_SELF"]."?noreset=1".($param ? '&'.$param : ''));
exit;
}
}
@@ -393,7 +430,9 @@ if ($action == 'delbookkeepingyear') {
print ' \n";
print '';
-if (!empty($arrayfields['t.code_journal']['checked'])) print_liste_field_titre($arrayfields['t.code_journal']['label'], $_SERVER['PHP_SELF'], "t.code_journal", "", $param, '', $sortfield, $sortorder, 'center ');
-if (!empty($arrayfields['t.doc_date']['checked'])) print_liste_field_titre($arrayfields['t.doc_date']['label'], $_SERVER['PHP_SELF'], "t.doc_date", "", $param, '', $sortfield, $sortorder, 'center ');
-if (!empty($arrayfields['t.piece_num']['checked'])) print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, '', $sortfield, $sortorder);
-if (!empty($arrayfields['t.doc_ref']['checked'])) print_liste_field_titre($arrayfields['t.doc_ref']['label'], $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder);
-if (!empty($arrayfields['t.label_operation']['checked'])) print_liste_field_titre($arrayfields['t.label_operation']['label'], $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder);
-if (!empty($arrayfields['t.debit']['checked'])) print_liste_field_titre($arrayfields['t.debit']['label'], $_SERVER['PHP_SELF'], "t.debit", "", $param, '', $sortfield, $sortorder, 'right ');
-if (!empty($arrayfields['t.credit']['checked'])) print_liste_field_titre($arrayfields['t.credit']['label'], $_SERVER['PHP_SELF'], "t.credit", "", $param, '', $sortfield, $sortorder, 'right ');
-if (!empty($arrayfields['t.lettering_code']['checked'])) print_liste_field_titre($arrayfields['t.lettering_code']['label'], $_SERVER['PHP_SELF'], "t.lettering_code", "", $param, '', $sortfield, $sortorder, 'center ');
+if (!empty($arrayfields['t.code_journal']['checked'])) {
+ print_liste_field_titre($arrayfields['t.code_journal']['label'], $_SERVER['PHP_SELF'], "t.code_journal", "", $param, '', $sortfield, $sortorder, 'center ');
+}
+if (!empty($arrayfields['t.doc_date']['checked'])) {
+ print_liste_field_titre($arrayfields['t.doc_date']['label'], $_SERVER['PHP_SELF'], "t.doc_date", "", $param, '', $sortfield, $sortorder, 'center ');
+}
+if (!empty($arrayfields['t.piece_num']['checked'])) {
+ print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, '', $sortfield, $sortorder);
+}
+if (!empty($arrayfields['t.doc_ref']['checked'])) {
+ print_liste_field_titre($arrayfields['t.doc_ref']['label'], $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder);
+}
+if (!empty($arrayfields['t.label_operation']['checked'])) {
+ print_liste_field_titre($arrayfields['t.label_operation']['label'], $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder);
+}
+if (!empty($arrayfields['t.debit']['checked'])) {
+ print_liste_field_titre($arrayfields['t.debit']['label'], $_SERVER['PHP_SELF'], "t.debit", "", $param, '', $sortfield, $sortorder, 'right ');
+}
+if (!empty($arrayfields['t.credit']['checked'])) {
+ print_liste_field_titre($arrayfields['t.credit']['label'], $_SERVER['PHP_SELF'], "t.credit", "", $param, '', $sortfield, $sortorder, 'right ');
+}
+if (!empty($arrayfields['t.lettering_code']['checked'])) {
+ print_liste_field_titre($arrayfields['t.lettering_code']['label'], $_SERVER['PHP_SELF'], "t.lettering_code", "", $param, '', $sortfield, $sortorder, 'center ');
+}
+if (!empty($arrayfields['t.date_export']['checked'])) {
+ print_liste_field_titre($arrayfields['t.date_export']['label'], $_SERVER['PHP_SELF'], "t.date_export", "", $param, '', $sortfield, $sortorder, 'center ');
+}
// Hook fields
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
@@ -538,8 +616,7 @@ $displayed_account_number = null; // Start with undefined to be able to distingu
// --------------------------------------------------------------------
$i = 0;
$totalarray = array();
-while ($i < min($num, $limit))
-{
+while ($i < min($num, $limit)) {
$line = $object->lines[$i];
$total_debit += $line->debit;
@@ -550,15 +627,15 @@ while ($i < min($num, $limit))
// Is it a break ?
if ($accountg != $displayed_account_number || !isset($displayed_account_number)) {
- if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) {
- $colnumber = 3;
- $colnumberend = 7;
- } else {
- $colnumber = 4;
- $colnumberend = 7;
- }
+ $colnumber = 5;
+ $colnumberend = 7;
+
+ if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) $colnumber--;
+ if (empty($arrayfields['t.date_export']['checked'])) $colnumber--;
+
$colspan = $totalarray['nbfield'] - $colnumber;
$colspanend = $totalarray['nbfield'] - $colnumberend;
+
// Show a subtotal by accounting account
if (isset($displayed_account_number)) {
print ' ';
@@ -571,8 +648,7 @@ while ($i < min($num, $limit))
$balance = $sous_total_debit - $sous_total_credit;
print ' ';
print ''.$langs->trans("Balance").': ';
- if ($balance > 0)
- {
+ if ($balance > 0) {
print '';
print price($sous_total_debit - $sous_total_credit);
print ' ';
@@ -589,13 +665,15 @@ while ($i < min($num, $limit))
// Show the break account
print " ";
- print '';
+ print ' ';
if ($line->subledger_account != "" && $line->subledger_account != '-1') {
print $object->get_compte_desc($line->numero_compte).' : '.length_accounta($line->subledger_account);
} else {
// Should not happen: subledger account must be null or a non empty value
print ''.$langs->trans("Unknown");
- if ($line->subledger_label) print ' ('.$line->subledger_label.')';
+ if ($line->subledger_label) {
+ print ' ('.$line->subledger_label.')';
+ }
$htmltext = 'EmptyStringForSubledgerAccountButSubledgerLabelDefined';
print $form->textwithpicto('', $htmltext);
print ' ';
@@ -614,38 +692,39 @@ while ($i < min($num, $limit))
print ' ';
// Journal code
- if (!empty($arrayfields['t.code_journal']['checked']))
- {
+ if (!empty($arrayfields['t.code_journal']['checked'])) {
$accountingjournal = new AccountingJournal($db);
$result = $accountingjournal->fetch('', $line->code_journal);
$journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $line->code_journal);
print ''.$journaltoshow.' ';
- if (!$i) $totalarray['nbfield']++;
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
// Document date
- if (!empty($arrayfields['t.doc_date']['checked']))
- {
+ if (!empty($arrayfields['t.doc_date']['checked'])) {
print ''.dol_print_date($line->doc_date, 'day').' ';
- if (!$i) $totalarray['nbfield']++;
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
// Piece number
- if (!empty($arrayfields['t.piece_num']['checked']))
- {
+ if (!empty($arrayfields['t.piece_num']['checked'])) {
print '';
$object->id = $line->id;
$object->piece_num = $line->piece_num;
print $object->getNomUrl(1, '', 0, '', 1);
print ' ';
- if (!$i) $totalarray['nbfield']++;
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
// Document ref
- if (!empty($arrayfields['t.doc_ref']['checked']))
- {
- if ($line->doc_type == 'customer_invoice')
- {
+ if (!empty($arrayfields['t.doc_ref']['checked'])) {
+ if ($line->doc_type == 'customer_invoice') {
$langs->loadLangs(array('bills'));
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
@@ -657,8 +736,7 @@ while ($i < min($num, $limit))
$filedir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($line->doc_ref);
$urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id;
$documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
- } elseif ($line->doc_type == 'supplier_invoice')
- {
+ } elseif ($line->doc_type == 'supplier_invoice') {
$langs->loadLangs(array('bills'));
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
@@ -670,8 +748,7 @@ while ($i < min($num, $limit))
$filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($line->fk_doc, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref);
$subdir = get_exdir($objectstatic->id, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref);
$documentlink = $formfile->getDocumentsLink($objectstatic->element, $subdir, $filedir);
- } elseif ($line->doc_type == 'expense_report')
- {
+ } elseif ($line->doc_type == 'expense_report') {
$langs->loadLangs(array('trips'));
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
@@ -683,8 +760,7 @@ while ($i < min($num, $limit))
$filedir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($line->doc_ref);
$urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id;
$documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
- } elseif ($line->doc_type == 'bank')
- {
+ } elseif ($line->doc_type == 'bank') {
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$objectstatic = new AccountLine($db);
$objectstatic->fetch($line->fk_doc);
@@ -698,8 +774,7 @@ while ($i < min($num, $limit))
// Picto + Ref
print '';
- if ($line->doc_type == 'customer_invoice' || $line->doc_type == 'supplier_invoice' || $line->doc_type == 'expense_report')
- {
+ if ($line->doc_type == 'customer_invoice' || $line->doc_type == 'supplier_invoice' || $line->doc_type == 'expense_report') {
print $objectstatic->getNomUrl(1, '', 0, 0, '', 0, -1, 1);
print $documentlink;
} elseif ($line->doc_type == 'bank') {
@@ -712,7 +787,9 @@ while ($i < min($num, $limit))
print ' ';
print "\n";
- if (!$i) $totalarray['nbfield']++;
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
// Label operation
@@ -720,30 +797,47 @@ while ($i < min($num, $limit))
// Affiche un lien vers la facture client/fournisseur
$doc_ref = preg_replace('/\(.*\)/', '', $line->doc_ref);
print strlen(length_accounta($line->subledger_account)) == 0 ? ''.$line->label_operation.' ' : ''.$line->label_operation.'('.length_accounta($line->subledger_account).') ';
- if (!$i) $totalarray['nbfield']++;
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
// Amount debit
- if (!empty($arrayfields['t.debit']['checked']))
- {
+ if (!empty($arrayfields['t.debit']['checked'])) {
print ''.($line->debit ? price($line->debit) : '').' ';
- if (!$i) $totalarray['nbfield']++;
- if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'totaldebit';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ if (!$i) {
+ $totalarray['pos'][$totalarray['nbfield']] = 'totaldebit';
+ }
$totalarray['val']['totaldebit'] += $line->debit;
}
// Amount credit
if (!empty($arrayfields['t.credit']['checked'])) {
print ''.($line->credit ? price($line->credit) : '').' ';
- if (!$i) $totalarray['nbfield']++;
- if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'totalcredit';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ if (!$i) {
+ $totalarray['pos'][$totalarray['nbfield']] = 'totalcredit';
+ }
$totalarray['val']['totalcredit'] += $line->credit;
}
// Lettering code
- if (!empty($arrayfields['t.lettering_code']['checked']))
- {
+ if (!empty($arrayfields['t.lettering_code']['checked'])) {
print ''.$line->lettering_code.' ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+
+ // Exported operation date
+ if (!empty($arrayfields['t.date_export']['checked']))
+ {
+ print ''.dol_print_date($line->date_export, 'dayhour').' ';
if (!$i) $totalarray['nbfield']++;
}
@@ -763,7 +857,9 @@ while ($i < min($num, $limit))
}
}
print '';
- if (!$i) $totalarray['nbfield']++;
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
// Comptabilise le sous-total
$sous_total_debit += $line->debit;
@@ -775,14 +871,6 @@ while ($i < min($num, $limit))
}
if ($num > 0) {
- // Show sub-total of last shown account
- if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) {
- $colnumber = 3;
- $colnumberend = 7;
- } else {
- $colnumber = 4;
- $colnumberend = 7;
- }
$colspan = $totalarray['nbfield'] - $colnumber;
$colspanend = $totalarray['nbfield'] - $colnumberend;
print '';
@@ -795,8 +883,7 @@ if ($num > 0) {
$balance = $sous_total_debit - $sous_total_credit;
print ' ';
print ''.$langs->trans("Balance").': ';
- if ($balance > 0)
- {
+ if ($balance > 0) {
print '';
print price($sous_total_debit - $sous_total_credit);
print ' ';
diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php b/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php
index e831e21f814..2d90c9a7b14 100644
--- a/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php
+++ b/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php
@@ -4,7 +4,7 @@
* Copyright (C) 2013 Olivier Geffroy
* Copyright (C) 2013 Florian Henry
* Copyright (C) 2013-2019 Alexandre Spangaro
- * Copyright (C) 2018-2019 Frédéric France
+ * Copyright (C) 2018-2020 Frédéric France
*
* 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
@@ -37,14 +37,17 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("compta", "accountancy"));
-$action = GETPOST('action', 'aZ09');
+$action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha');
$show_files = GETPOST('show_files', 'int');
-$confirm = GETPOST('confirm', 'alpha');
-$toselect = GETPOST('toselect', 'array');
-$socid = GETPOST('socid', 'int') ?GETPOST('socid', 'int') : GETPOST('id', 'int');
+$confirm = GETPOST('confirm', 'alpha');
+$toselect = GETPOST('toselect', 'array');
+// $socid = GETPOST('socid', 'int') ?GETPOST('socid', 'int') : GETPOST('id', 'int');
+// Security check
+$socid = GETPOSTINT("socid");
+// if ($user->socid) $socid=$user->socid;
-$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
+$limit = GETPOSTISSET('limit') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
@@ -54,10 +57,12 @@ if (empty($page) || $page == - 1) {
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
-if ($sortorder == "")
+if ($sortorder == "") {
$sortorder = "ASC";
-if ($sortfield == "")
+}
+if ($sortfield == "") {
$sortfield = "bk.doc_date";
+}
/*
$search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int'));
@@ -74,23 +79,18 @@ if (!empty($lettering)) {
/*
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
{
- $search_date_start = '';
- $search_date_end = '';
+ $search_date_start = '';
+ $search_date_end = '';
//$search_doc_type = '';
$search_doc_ref = '';
}
*/
-// Security check
-$socid = GETPOST("socid", 'int');
-// if ($user->socid) $socid=$user->socid;
-
$lettering = new Lettering($db);
$object = new Societe($db);
$object->id = $socid;
$result = $object->fetch($socid);
-if ($result < 0)
-{
+if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
@@ -208,30 +208,30 @@ if ($resql) {
print ''."\n";
/*
- print '';
- //print ' ';
+ print ' ';
+ //print ' ';
- // Date
- print '';
- print '';
- print $langs->trans('From') . ' ';
- print $form->selectDate($search_date_start, 'date_creation_start', 0, 0, 1);
- print '
';
- print '';
- print $langs->trans('to') . ' ';
- print $form->selectDate($search_date_end, 'date_creation_end', 0, 0, 1);
- print '
';
- print ' ';
+ // Date
+ print '';
+ print '';
+ print $langs->trans('From') . ' ';
+ print $form->selectDate($search_date_start, 'date_creation_start', 0, 0, 1);
+ print '
';
+ print '';
+ print $langs->trans('to') . ' ';
+ print $form->selectDate($search_date_end, 'date_creation_end', 0, 0, 1);
+ print '
';
+ print ' ';
- // Piece
- print ' ';
+ // Piece
+ print ' ';
- print ' ';
- print '';
- $searchpicto = $form->showFilterButtons();
- print $searchpicto;
- print ' ';
- print ' ';
+ print ' ';
+ print '';
+ $searchpicto = $form->showFilterButtons();
+ print $searchpicto;
+ print ' ';
+ print '';
*/
print '';
@@ -251,7 +251,9 @@ if ($resql) {
$tmp = '';
while ($obj = $db->fetch_object($resql)) {
- if ($tmp != $obj->lettering_code || empty($tmp)) $tmp = $obj->lettering_code;
+ if ($tmp != $obj->lettering_code || empty($tmp)) {
+ $tmp = $obj->lettering_code;
+ }
/*if ($tmp != $obj->lettering_code || empty($obj->lettering_code))*/ $solde += ($obj->credit - $obj->debit);
print ' ';
diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php b/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php
index b5620f3ec25..31acb9f0191 100644
--- a/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php
+++ b/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php
@@ -41,7 +41,11 @@ $massaction = GETPOST('massaction', 'alpha');
$show_files = GETPOST('show_files', 'int');
$confirm = GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array');
-$socid = GETPOST('socid', 'int') ? ((int) GETPOST('socid', 'int')) : ((int) GETPOST('id', 'int'));
+// $socid = GETPOST('socid', 'int') ? ((int) GETPOST('socid', 'int')) : ((int) GETPOST('id', 'int'));
+// Security check
+$socid = GETPOSTINT("socid");
+// if ($user->socid) $socid=$user->socid;
+
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
@@ -53,10 +57,12 @@ if (empty($page) || $page == - 1) {
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
-if ($sortorder == "")
+if ($sortorder == "") {
$sortorder = "ASC";
-if ($sortfield == "")
+}
+if ($sortfield == "") {
$sortfield = "bk.doc_date";
+}
/*
$search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int'));
@@ -73,24 +79,18 @@ if (!empty($lettering)) {
/*
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
{
- $search_date_start = '';
- $search_date_end = '';
+ $search_date_start = '';
+ $search_date_end = '';
//$search_doc_type='';
$search_doc_ref='';
}
*/
-
-// Security check
-$socid = GETPOST("socid", 'int');
-// if ($user->socid) $socid=$user->socid;
-
$lettering = new Lettering($db);
$object = new Societe($db);
$object->id = $socid;
$result = $object->fetch($socid);
-if ($result < 0)
-{
+if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
@@ -159,8 +159,7 @@ $solde = 0;
// Count total nb of records and calc total sum
$nbtotalofrecords = '';
$resql = $db->query($sql);
-if (!$resql)
-{
+if (!$resql) {
dol_print_error($db);
exit;
}
@@ -206,30 +205,30 @@ if ($resql) {
print ''."\n";
/*
- print '';
- //print ' ';
+ print ' ';
+ //print ' ';
- // Date
- print '';
- print '';
- print $langs->trans('From') . ' ';
- print $form->selectDate($search_date_start, 'date_creation_start', 0, 0, 1);
- print '
';
- print '';
- print $langs->trans('to') . ' ';
- print $form->selectDate($search_date_end, 'date_creation_end', 0, 0, 1);
- print '
';
- print ' ';
+ // Date
+ print '';
+ print '';
+ print $langs->trans('From') . ' ';
+ print $form->selectDate($search_date_start, 'date_creation_start', 0, 0, 1);
+ print '
';
+ print '';
+ print $langs->trans('to') . ' ';
+ print $form->selectDate($search_date_end, 'date_creation_end', 0, 0, 1);
+ print '
';
+ print ' ';
- // Piece
- print ' ';
+ // Piece
+ print ' ';
- print ' ';
- print '';
- $searchpicto = $form->showFilterButtons();
- print $searchpicto;
- print ' ';
- print ' ';
+ print ' ';
+ print '';
+ $searchpicto = $form->showFilterButtons();
+ print $searchpicto;
+ print ' ';
+ print '';
*/
print '';
@@ -248,7 +247,9 @@ if ($resql) {
$solde = 0;
$tmp = '';
while ($obj = $db->fetch_object($resql)) {
- if ($tmp != $obj->lettering_code || empty($tmp)) $tmp = $obj->lettering_code;
+ if ($tmp != $obj->lettering_code || empty($tmp)) {
+ $tmp = $obj->lettering_code;
+ }
/*if ($tmp != $obj->lettering_code || empty($obj->lettering_code))*/ $solde += ($obj->credit - $obj->debit);
print ' ';
diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php
index 3b03e6ae8ca..fe73ab9f376 100644
--- a/htdocs/accountancy/class/bookkeeping.class.php
+++ b/htdocs/accountancy/class/bookkeeping.class.php
@@ -795,7 +795,7 @@ class BookKeeping extends CommonObject
$sql .= " t.label_operation,";
$sql .= " t.debit,";
$sql .= " t.credit,";
- $sql .= " t.montant,";
+ $sql .= " t.montant as amount,";
$sql .= " t.sens,";
$sql .= " t.multicurrency_amount,";
$sql .= " t.multicurrency_code,";
@@ -806,7 +806,8 @@ class BookKeeping extends CommonObject
$sql .= " t.code_journal,";
$sql .= " t.journal_label,";
$sql .= " t.piece_num,";
- $sql .= " t.date_creation";
+ $sql .= " t.date_creation,";
+ $sql .= " t.date_export";
// Manage filter
$sqlwhere = array();
if (count($filter) > 0) {
@@ -823,6 +824,8 @@ class BookKeeping extends CommonObject
$sqlwhere[] = $key.' LIKE \''.$this->db->escape($value).'%\'';
} elseif ($key == 't.date_creation>=' || $key == 't.date_creation<=') {
$sqlwhere[] = $key.'\''.$this->db->idate($value).'\'';
+ } elseif ($key == 't.date_export>=' || $key == 't.date_export<=') {
+ $sqlwhere[] = $key.'\''.$this->db->idate($value).'\'';
} elseif ($key == 't.credit' || $key == 't.debit') {
$sqlwhere[] = natural_search($key, $value, 1, 1);
} elseif ($key == 't.reconciled_option') {
@@ -878,7 +881,8 @@ class BookKeeping extends CommonObject
$line->label_operation = $obj->label_operation;
$line->debit = $obj->debit;
$line->credit = $obj->credit;
- $line->montant = $obj->montant;
+ $line->montant = $obj->amount; // deprecated
+ $line->amount = $obj->amount;
$line->sens = $obj->sens;
$line->multicurrency_amount = $obj->multicurrency_amount;
$line->multicurrency_code = $obj->multicurrency_code;
@@ -889,7 +893,8 @@ class BookKeeping extends CommonObject
$line->code_journal = $obj->code_journal;
$line->journal_label = $obj->journal_label;
$line->piece_num = $obj->piece_num;
- $line->date_creation = $obj->date_creation;
+ $line->date_creation = $this->db->jdate($obj->date_creation);
+ $line->date_export = $this->db->jdate($obj->date_export);
$this->lines[] = $line;
@@ -941,7 +946,7 @@ class BookKeeping extends CommonObject
$sql .= " t.credit,";
$sql .= " t.lettering_code,";
$sql .= " t.date_lettering,";
- $sql .= " t.montant,";
+ $sql .= " t.montant as amount,";
$sql .= " t.sens,";
$sql .= " t.fk_user_author,";
$sql .= " t.import_key,";
@@ -1019,7 +1024,8 @@ class BookKeeping extends CommonObject
$line->label_operation = $obj->label_operation;
$line->debit = $obj->debit;
$line->credit = $obj->credit;
- $line->montant = $obj->montant;
+ $line->montant = $obj->amount; // deprecated
+ $line->amount = $obj->amount;
$line->sens = $obj->sens;
$line->lettering_code = $obj->lettering_code;
$line->date_lettering = $obj->date_lettering;
diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php
index 1a5098bda38..3634fba2e79 100644
--- a/htdocs/accountancy/customer/index.php
+++ b/htdocs/accountancy/customer/index.php
@@ -1,7 +1,7 @@
* Copyright (C) 2013-2014 Florian Henry
- * Copyright (C) 2013-2017 Alexandre Spangaro
+ * Copyright (C) 2013-2020 Alexandre Spangaro
* Copyright (C) 2014 Juanjo Menent
* Copyright (C) 2015 Jean-François Ferry
*
@@ -123,9 +123,9 @@ if ($action == 'validatehistory') {
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tva_tx as tva_tx_prod,";
$sql .= " p.accountancy_code_sell as code_sell, p.accountancy_code_sell_intra as code_sell_intra, p.accountancy_code_sell_export as code_sell_export,";
- $sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export,";
+ $sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export, aa4.rowid as aarowid_thirdparty,";
$sql .= " co.code as country_code, co.label as country_label,";
- $sql .= " s.tva_intra";
+ $sql .= " s.tva_intra, s.accountancy_code_sell as company_code_sell";
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays ";
@@ -134,6 +134,7 @@ if ($action == 'validatehistory') {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON p.accountancy_code_sell = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON p.accountancy_code_sell_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON p.accountancy_code_sell_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity;
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON s.accountancy_code_sell = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity;
$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
$sql .= " AND l.product_type <= 2";
@@ -153,7 +154,7 @@ if ($action == 'validatehistory') {
$isBuyerInEEC = isInEEC($objp);
- // Search suggested account for product/service (similar code exists in page list.php to make manual binding)
+ // Level 2: Search suggested account for product/service (similar code exists in page list.php to make manual binding)
$suggestedaccountingaccountfor = '';
if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
$objp->code_sell_p = $objp->code_sell;
@@ -179,6 +180,13 @@ if ($action == 'validatehistory') {
}
}
+ // Level 3: Search suggested account for this thirdparty (similar code exists in page index.php to make automatic binding)
+ if (!empty($objp->company_code_sell)) {
+ $objp->code_sell_t = $objp->company_code_sell;
+ $objp->aarowid_suggest = $objp->aarowid_thirdparty;
+ $suggestedaccountingaccountfor = '';
+ }
+
if ($objp->aarowid_suggest > 0)
{
$sqlupdate = "UPDATE ".MAIN_DB_PREFIX."facturedet";
diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php
index eb2743258d7..cb47e436cbd 100644
--- a/htdocs/accountancy/customer/list.php
+++ b/htdocs/accountancy/customer/list.php
@@ -211,9 +211,9 @@ $sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label,
$sql .= " p.accountancy_code_sell as code_sell, p.accountancy_code_sell_intra as code_sell_intra, p.accountancy_code_sell_export as code_sell_export,";
$sql .= " p.accountancy_code_buy as code_buy, p.accountancy_code_buy_intra as code_buy_intra, p.accountancy_code_buy_export as code_buy_export,";
$sql .= " p.tosell as status, p.tobuy as status_buy,";
-$sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export,";
+$sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export, aa4.rowid as aarowid_thirdparty,";
$sql .= " co.code as country_code, co.label as country_label,";
-$sql .= " s.rowid as socid, s.nom as name, s.tva_intra, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur";
+$sql .= " s.rowid as socid, s.nom as name, s.tva_intra, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur, s.accountancy_code_sell as company_code_sell";
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
@@ -225,6 +225,7 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON p.accountancy_code_sell = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON p.accountancy_code_sell_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON p.accountancy_code_sell_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity;
+$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON s.accountancy_code_sell = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity;
$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
$sql .= " AND l.product_type <= 2";
// Define begin binding date
@@ -456,11 +457,12 @@ if ($result) {
$facture_static->type = $objp->ftype;
$code_sell_p_notset = '';
+ $code_sell_t_notset = '';
$objp->aarowid_suggest = ''; // Will be set later
$isBuyerInEEC = isInEEC($objp);
- // Search suggested default account for product/service
+ // Level 1: Search suggested default account for product/service
$suggestedaccountingaccountbydefaultfor = '';
if ($objp->type_l == 1) {
if ($objp->country_code == $mysoc->country_code || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
@@ -503,7 +505,7 @@ if ($result) {
}
if ($objp->code_sell_l == -1) $objp->code_sell_l = '';
- // Search suggested account for product/service (similar code exists in page index.php to make automatic binding)
+ // Level 2: Search suggested account for product/service (similar code exists in page index.php to make automatic binding)
$suggestedaccountingaccountfor = '';
if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
$objp->code_sell_p = $objp->code_sell;
@@ -529,6 +531,13 @@ if ($result) {
}
}
+ // Level 3: Search suggested account for this thirdparty (similar code exists in page index.php to make automatic binding)
+ if (!empty($objp->company_code_sell)) {
+ $objp->code_sell_t = $objp->company_code_sell;
+ $objp->aarowid_suggest = $objp->aarowid_thirdparty;
+ $suggestedaccountingaccountfor = '';
+ }
+
// Manage Deposit
if ($objp->description == "(DEPOSIT)") {
$accountdeposittoventilated = new AccountingAccount($db);
@@ -547,6 +556,7 @@ if ($result) {
// $objp->code_sell_l is now default code of product/service
// $objp->code_sell_p is now code of product/service
+ // $objp->code_sell_t is now code of thirdparty
print '';
@@ -596,7 +606,7 @@ if ($result) {
// Found accounts
print '';
- $s = ''.(($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': ';
+ $s = '1. '.(($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': ';
$shelp = '';
if ($suggestedaccountingaccountbydefaultfor == 'eec') $shelp .= $langs->trans("SaleEEC");
elseif ($suggestedaccountingaccountbydefaultfor == 'export') $shelp .= $langs->trans("SaleExport");
@@ -605,7 +615,7 @@ if ($result) {
if ($objp->product_id > 0)
{
print ' ';
- $s = ''.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';
+ $s = '2. '.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';
$shelp = '';
if ($suggestedaccountingaccountfor == 'eec') $shelp = $langs->trans("SaleEEC");
elseif ($suggestedaccountingaccountfor == 'eecwithvat') $shelp = $langs->trans("SaleEECWithVAT");
@@ -613,16 +623,23 @@ if ($result) {
elseif ($suggestedaccountingaccountfor == 'export') $shelp = $langs->trans("SaleExport");
$s .= (empty($objp->code_sell_p) ? ''.$langs->trans("NotDefined").' ' : length_accountg($objp->code_sell_p));
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
+ } else {
+ print ' ';
+ $s = '2. '.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';
+ $shelp = '';
+ $s .= $langs->trans("NotDefined");
+ print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
}
+ print ' ';
+ $s = '3. '.(($objp->type_l == 1) ? $langs->trans("ServiceForThisThirdparty") : $langs->trans("ProductForThisThirdparty")).': ';
+ $shelp = '';
+ $s .= ($objp->code_sell_t > 0 ? length_accountg($objp->code_sell_t) : ''.$langs->trans("NotDefined").' ');
+ print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
print ' ';
// Suggested accounting account
- // $objp->code_sell_l = default (it takes the country into consideration), $objp->code_sell_p is value for product (it takes the country into consideration too)
print '';
$suggestedid = $objp->aarowid_suggest;
- /*var_dump($suggestedid);
- var_dump($objp->code_sell_p);
- var_dump($objp->code_sell_l);*/
if (empty($suggestedid) && empty($objp->code_sell_p) && !empty($objp->code_sell_l) && empty($conf->global->ACCOUNTANCY_DO_NOT_AUTOFILL_ACCOUNT_WITH_GENERIC))
{
if (empty($accountingaccount_codetotid_cache[$objp->code_sell_l]))
@@ -642,7 +659,6 @@ if ($result) {
// Column with checkbox
print ' ';
- //var_dump($objp->aarowid);var_dump($objp->aarowid_intra);var_dump($objp->aarowid_export);var_dump($objp->aarowid_suggest);
$ischecked = $objp->aarowid_suggest;
if ($suggestedaccountingaccountfor == 'eecwithoutvatnumber') $ischecked = 0;
print ' ';
diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php
index 0dbe09fa468..9dd097f3d0c 100644
--- a/htdocs/accountancy/supplier/index.php
+++ b/htdocs/accountancy/supplier/index.php
@@ -120,9 +120,9 @@ if ($action == 'validatehistory') {
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type,";
$sql .= " p.accountancy_code_buy as code_buy, p.accountancy_code_buy_intra as code_buy_intra, p.accountancy_code_buy_export as code_buy_export, p.tva_tx as tva_tx_prod,";
- $sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export,";
+ $sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export, aa4.rowid as aarowid_thirdparty,";
$sql .= " co.code as country_code, co.label as country_label,";
- $sql .= " s.tva_intra";
+ $sql .= " s.tva_intra, s.accountancy_code_buy as company_code_buy";
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays ";
@@ -131,6 +131,7 @@ if ($action == 'validatehistory') {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON p.accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON p.accountancy_code_buy_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON p.accountancy_code_buy_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity;
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON s.accountancy_code_buy = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity;
$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
$sql .= " AND l.product_type <= 2";
@@ -151,7 +152,7 @@ if ($action == 'validatehistory') {
$isSellerInEEC = isInEEC($objp);
- // Search suggested account for product/service
+ // Level 2: Search suggested account for product/service (similar code exists in page list.php to make manual binding)
$suggestedaccountingaccountfor = '';
if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
$objp->code_buy_p = $objp->code_buy;
@@ -169,6 +170,13 @@ if ($action == 'validatehistory') {
}
}
+ // Level 3: Search suggested account for this thirdparty (similar code exists in page index.php to make automatic binding)
+ if (!empty($objp->company_code_buy)) {
+ $objp->code_buy_t = $objp->company_code_buy;
+ $objp->aarowid_suggest = $objp->aarowid_thirdparty;
+ $suggestedaccountingaccountfor = '';
+ }
+
if ($objp->aarowid_suggest > 0)
{
$sqlupdate = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det";
diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php
index cbdecd2e85e..919130e80d3 100644
--- a/htdocs/accountancy/supplier/list.php
+++ b/htdocs/accountancy/supplier/list.php
@@ -215,9 +215,9 @@ $sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label,
$sql .= " p.accountancy_code_sell as code_sell, p.accountancy_code_sell_intra as code_sell_intra, p.accountancy_code_sell_export as code_sell_export,";
$sql .= " p.accountancy_code_buy as code_buy, p.accountancy_code_buy_intra as code_buy_intra, p.accountancy_code_buy_export as code_buy_export,";
$sql .= " p.tosell as status, p.tobuy as status_buy,";
-$sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export,";
+$sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export, aa4.rowid as aarowid_thirdparty,";
$sql .= " co.code as country_code, co.label as country_label,";
-$sql .= " s.rowid as socid, s.nom as name, s.tva_intra, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur";
+$sql .= " s.rowid as socid, s.nom as name, s.tva_intra, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur, s.accountancy_code_buy as company_code_buy";
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
@@ -229,6 +229,7 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON p.accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON p.accountancy_code_buy_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON p.accountancy_code_buy_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity;
+$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON s.accountancy_code_buy = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity;
$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
$sql .= " AND l.product_type <= 2";
// Define begin binding date
@@ -460,10 +461,12 @@ if ($result) {
$facturefourn_static->label = $objp->invoice_label;
$code_buy_p_notset = '';
+ $code_buy_t_notset = '';
$objp->aarowid_suggest = ''; // Will be set later
$isSellerInEEC = isInEEC($objp);
+ // Level 1: Search suggested default account for product/service
$suggestedaccountingaccountbydefaultfor = '';
if ($objp->type_l == 1) {
if ($objp->country_code == $mysoc->country_code || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
@@ -494,7 +497,7 @@ if ($result) {
}
if ($objp->code_sell_l == -1) $objp->code_sell_l = '';
- // Search suggested account for product/service
+ // Level 2: Search suggested account for product/service (similar code exists in page index.php to make automatic binding)
$suggestedaccountingaccountfor = '';
if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
$objp->code_buy_p = $objp->code_buy;
@@ -512,6 +515,13 @@ if ($result) {
}
}
+ // Level 3: Search suggested account for this thirdparty (similar code exists in page index.php to make automatic binding)
+ if (!empty($objp->company_code_buy)) {
+ $objp->code_buy_t = $objp->company_code_buy;
+ $objp->aarowid_suggest = $objp->aarowid_thirdparty;
+ $suggestedaccountingaccountfor = '';
+ }
+
if (!empty($objp->code_buy_p)) {
// Value was defined previously
} else {
@@ -521,6 +531,7 @@ if ($result) {
// $objp->code_buy_l is now default code of product/service
// $objp->code_buy_p is now code of product/service
+ // $objp->code_buy_t is now code of thirdparty
print ' ';
@@ -576,7 +587,7 @@ if ($result) {
// Found accounts
print '';
- $s = ''.(($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': ';
+ $s = '1. '.(($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': ';
$shelp = '';
if ($suggestedaccountingaccountbydefaultfor == 'eec') $shelp .= $langs->trans("SaleEEC");
elseif ($suggestedaccountingaccountbydefaultfor == 'export') $shelp .= $langs->trans("SaleExport");
@@ -585,13 +596,24 @@ if ($result) {
if ($objp->product_id > 0)
{
print ' ';
- $s = ''.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';
+ $s = '2. '.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';
$shelp = '';
if ($suggestedaccountingaccountfor == 'eec') $shelp = $langs->trans("SaleEEC");
elseif ($suggestedaccountingaccountfor == 'export') $shelp = $langs->trans("SaleExport");
$s .= (empty($objp->code_buy_p) ? ''.$langs->trans("NotDefined").' ' : length_accountg($objp->code_buy_p));
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
+ } else {
+ print ' ';
+ $s = '2. '.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';
+ $shelp = '';
+ $s .= $langs->trans("NotDefined");
+ print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
}
+ print ' ';
+ $s = '3. '.(($objp->type_l == 1) ? $langs->trans("ServiceForThisThirdparty") : $langs->trans("ProductForThisThirdparty")).': ';
+ $shelp = '';
+ $s .= ($objp->code_buy_t > 0 ? length_accountg($objp->code_buy_t) : ''.$langs->trans("NotDefined").' ');
+ print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
print ' ';
// Suggested accounting account
diff --git a/htdocs/admin/accountant.php b/htdocs/admin/accountant.php
index 7a1d5b66ece..8f20ab43c84 100644
--- a/htdocs/admin/accountant.php
+++ b/htdocs/admin/accountant.php
@@ -114,57 +114,57 @@ print ' '.$langs->trans(
// Name
print ' '.$langs->trans("CompanyName").' ';
-print ' global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'> '."\n";
+print ' global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'> '."\n";
// Address
print ''.$langs->trans("CompanyAddress").' ';
-print ' '."\n";
+print ''."\n";
print ''.$langs->trans("CompanyZip").' ';
-print ' '."\n";
+print ' '."\n";
print ''.$langs->trans("CompanyTown").' ';
-print ' '."\n";
+print ' '."\n";
// Country
print ''.$langs->trans("Country").' ';
print img_picto('', 'globe-americas', 'class="paddingrightonly"');
-print $form->select_country($conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY, 'country_id');
+print $form->select_country((GETPOSTISSET('country_id') ? GETPOST('country_id', 'int') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY) ? $conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY : '')), 'country_id');
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
print ' '."\n";
print ''.$langs->trans("State").' ';
-$formcompany->select_departement($conf->global->MAIN_INFO_ACCOUNTANT_STATE, $conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY, 'state_id');
+$formcompany->select_departement((GETPOSTISSET('state_id') ? GETPOST('state_id', 'alpha') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_STATE) ? $conf->global->MAIN_INFO_ACCOUNTANT_STATE : '')), (GETPOSTISSET('country_id') ? GETPOST('country_id', 'int') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY) ? $conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY : '')), 'state_id');
print ' '."\n";
print ''.$langs->trans("Phone").' ';
print img_picto('', 'object_phoning', '', false, 0, 0, '', 'paddingright');
-print ' ';
+print ' ';
print ''."\n";
print ''.$langs->trans("Fax").' ';
print img_picto('', 'object_phoning_fax', '', false, 0, 0, '', 'paddingright');
-print ' ';
+print ' ';
print ''."\n";
print ''.$langs->trans("EMail").' ';
print img_picto('', 'object_email', '', false, 0, 0, '', 'paddingright');
-print ' ';
+print ' ';
print ''."\n";
// Web
print ''.$langs->trans("Web").' ';
print img_picto('', 'globe', '', false, 0, 0, '', 'paddingright');
-print ' ';
+print ' ';
print ''."\n";
// Code
print ''.$langs->trans("AccountantFileNumber").' ';
-print ' '."\n";
+print ' '."\n";
// Note
print ''.$langs->trans("Note").' ';
-print ' ';
+print '';
print '';
print '
';
diff --git a/htdocs/admin/boxes.php b/htdocs/admin/boxes.php
index 63c3350fd9d..404ed12c235 100644
--- a/htdocs/admin/boxes.php
+++ b/htdocs/admin/boxes.php
@@ -446,14 +446,14 @@ print '';
print $langs->trans("MaxNbOfLinesForBoxes");
print ' '."\n";
print '';
-print ' ';
+print ' ';
print ' ';
print ' ';
// Activate FileCache - Developement
if ($conf->global->MAIN_FEATURES_LEVEL == 2 || !empty($conf->global->MAIN_ACTIVATE_FILECACHE)) {
print ''.$langs->trans("EnableFileCache").' ';
- print $form->selectyesno('MAIN_ACTIVATE_FILECACHE', $conf->global->MAIN_ACTIVATE_FILECACHE, 1);
+ print $form->selectyesno('MAIN_ACTIVATE_FILECACHE', (!empty($conf->global->MAIN_ACTIVATE_FILECACHE) ? $conf->global->MAIN_ACTIVATE_FILECACHE : 0), 1);
print ' ';
print ' ';
}
diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php
index b82f0fcd765..bb4f142cc2a 100644
--- a/htdocs/admin/company.php
+++ b/htdocs/admin/company.php
@@ -393,18 +393,18 @@ print ''.$langs->trans(
// Name
print ' '.$langs->trans("CompanyName").' ';
-print ' global->MAIN_INFO_SOCIETE_NOM) ? ' autofocus="autofocus"' : '').'> '."\n";
+print ' global->MAIN_INFO_SOCIETE_NOM) ? ' autofocus="autofocus"' : '').'>'."\n";
// Address
print ''.$langs->trans("CompanyAddress").' ';
-print ' '."\n";
+print ''."\n";
// Zip
print ''.$langs->trans("CompanyZip").' ';
-print ' '."\n";
+print ' '."\n";
print ''.$langs->trans("CompanyTown").' ';
-print ' '."\n";
+print ' '."\n";
// Country
print ''.$langs->trans("Country").' ';
@@ -431,25 +431,25 @@ print ' '."\n";
// Phone
print ''.$langs->trans("Phone").' ';
print img_picto('', 'object_phoning', '', false, 0, 0, '', 'paddingright');
-print ' ';
+print ' ';
print ''."\n";
// Fax
print ''.$langs->trans("Fax").' ';
print img_picto('', 'object_phoning_fax', '', false, 0, 0, '', 'paddingright');
-print ' ';
+print ' ';
print ''."\n";
// Email
print ''.$langs->trans("EMail").' ';
print img_picto('', 'object_email', '', false, 0, 0, '', 'paddingright');
-print ' ';
+print ' ';
print ''."\n";
// Web
print ''.$langs->trans("Web").' ';
print img_picto('', 'globe', '', false, 0, 0, '', 'paddingright');
-print ' ';
+print ' ';
print ''."\n";
// Barcode
@@ -457,7 +457,7 @@ if (!empty($conf->barcode->enabled)) {
print '';
print ''.$langs->trans("Gencod").' ';
print ' ';
- print ' ';
+ print ' ';
print '';
}
@@ -534,7 +534,7 @@ print '';
// Note
print ''.$langs->trans("Note").' ';
-print ' ';
+print '';
print '';
print '
';
@@ -549,17 +549,17 @@ $langs->load("companies");
// Managing Director(s)
print ''.$langs->trans("ManagingDirectors").' ';
-print ' ';
+print ' ';
// GDPR contact
print '';
print $form->textwithpicto($langs->trans("GDPRContact"), $langs->trans("GDPRContactDesc"));
print ' ';
-print ' ';
+print ' global->MAIN_INFO_GDPR) ? $conf->global->MAIN_INFO_GDPR : ''))).'">';
// Capital
print ''.$langs->trans("Capital").' ';
-print ' ';
+print ' ';
// Juridical Status
print ''.$langs->trans("JuridicalStatus").' ';
diff --git a/htdocs/admin/company_socialnetworks.php b/htdocs/admin/company_socialnetworks.php
index 5cbdb948b4a..93c6739d37d 100644
--- a/htdocs/admin/company_socialnetworks.php
+++ b/htdocs/admin/company_socialnetworks.php
@@ -117,11 +117,11 @@ foreach ($listofnetworks as $key => $value) {
$networkconstname = 'MAIN_INFO_SOCIETE_'.strtoupper($key).'_URL';
$networkconstid = 'MAIN_INFO_SOCIETE_'.strtoupper($key);
print ' ';
- print ' ';
+ print ' ';
print '';
- print ' ';
+ print ' ';
print ' ';
- print ''.dol_print_socialnetworks($conf->global->$networkconstid, 0, 0, $key, $listofnetworks).' ';
+ print ''.dol_print_socialnetworks((!empty($conf->global->$networkconstid) ? dol_escape_htmltag($conf->global->$networkconstid) : ''), 0, 0, $key, $listofnetworks).' ';
print ' '."\n";
}
}
diff --git a/htdocs/admin/defaultvalues.php b/htdocs/admin/defaultvalues.php
index 789762830e3..ae9427d70e0 100644
--- a/htdocs/admin/defaultvalues.php
+++ b/htdocs/admin/defaultvalues.php
@@ -72,9 +72,9 @@ $hookmanager->initHooks(array('admindefaultvalues', 'globaladmin'));
*/
if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; }
-if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; }
+if (!GETPOST('confirmmassaction', 'alpha') && !empty($massaction) && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; }
-$parameters = array('socid'=>$socid);
+$parameters = array();
$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');
@@ -186,7 +186,7 @@ llxHeader('', $langs->trans("Setup"), $wikihelp);
$param = '&mode='.$mode;
-$enabledisablehtml .= $langs->trans("EnableDefaultValues").' ';
+$enabledisablehtml = $langs->trans("EnableDefaultValues").' ';
if (empty($conf->global->MAIN_ENABLE_DEFAULT_VALUES))
{
// Button off, click to enable
@@ -213,7 +213,7 @@ if ($defaultkey) $param .= '&defaultkey='.urlencode($defaultkey);
if ($defaultvalue) $param .= '&defaultvalue='.urlencode($defaultvalue);
-print '