Merge remote-tracking branch 'upstream/develop' into 18a3
This commit is contained in:
commit
13e9ca577e
458 changed files with 7227 additions and 3378 deletions
2
.github/workflows/code_quality.yml
vendored
2
.github/workflows/code_quality.yml
vendored
|
|
@ -18,7 +18,7 @@ jobs:
|
|||
fetch-depth: 1
|
||||
#php-version: '7.1'
|
||||
- name: 'Qodana Scan'
|
||||
uses: JetBrains/qodana-action@v2022.3.4
|
||||
uses: JetBrains/qodana-action@v2023.1.0
|
||||
#with:
|
||||
# php-version: '7.1'
|
||||
env:
|
||||
|
|
|
|||
190
ChangeLog
190
ChangeLog
|
|
@ -5,7 +5,185 @@ English Dolibarr ChangeLog
|
|||
|
||||
***** ChangeLog for 18.0.0 compared to 17.0.0 *****
|
||||
|
||||
NEW: PHP 8.2 compatibility.
|
||||
For uses:
|
||||
---------
|
||||
|
||||
NEW: PHP 8.2 compatibility (test not yet completed).
|
||||
NEW: #22740 Add OpenID Connect impl
|
||||
NEW: #23436 Group social networks fields
|
||||
NEW: Accountancy - Add specific page to export accounting data rather than the journals page
|
||||
NEW: Accountancy - Add sub-account balance FPC22
|
||||
NEW: Accountancy - Manage customer retained warranty FPC21+
|
||||
NEW: Accountancy - Manage intra-community VAT on supplier invoices - FPC22
|
||||
NEW: adapt category and product pictures sizes on takepos
|
||||
NEW: Add ability of ODT support to supplier invoices
|
||||
NEW: Add a public virtual card page for each user
|
||||
NEW: Add a status on supplier price ref (WIP to close a supplier ref)
|
||||
NEW: Add a trigger when create a shipping line batch and fix propagate missing errors
|
||||
NEW: add bookmarks in selectable landing pages for users
|
||||
NEW: Add column ext_payment_site for societe_rib
|
||||
NEW: add convertion of images to webp for a single image
|
||||
NEW: Add CRC for currency symbol before amount
|
||||
NEW: add css editor to admin ihm
|
||||
NEW: add customer code to invoices listing
|
||||
NEW: Add Customer Order delivered (ORDER_NEW) in module Notification
|
||||
NEW: add customize CSS in admin/ihm settings
|
||||
NEW: Add date due and labels into customer comm card
|
||||
NEW: Add dropdown button actions (example on Create button on project)
|
||||
NEW: added an option to display the progress of tickets on the public interface
|
||||
NEW: Add field reply-to in email collector as possible filter
|
||||
NEW: Add filter on nb of generation done in list of recurring invoices
|
||||
NEW: Add filters and sort on product unit column
|
||||
NEW: adding button Send Email on the salary file
|
||||
NEW: Add link to edit VAT list from error message of missing VAT
|
||||
NEW: add link to thirdparty tickets history
|
||||
NEW: add margin in paiement/card.php
|
||||
NEW: Add mass action delete on VAT
|
||||
NEW: Add more zip, town, country for owner of a bank account
|
||||
NEW: add numbering modules for members
|
||||
NEW: add option keepspace into dol_string_nospecialchar()
|
||||
NEW: Add origin info when create a product batch when created from a movement stock
|
||||
NEW: Add possibility to choose format #21426
|
||||
NEW: Add SQL contraint on product_stock table to allow only exsting product and warehouse#23543
|
||||
NEW: Add statistics by amount on statistics of products.
|
||||
NEW: Add STRIPE_DEBUG, a way to log Stripe IPN
|
||||
NEW: Add sub total in order list det
|
||||
NEW: Add warehouse create and modify triggers.
|
||||
NEW: Add widget box_members_by_tags.php
|
||||
NEW: An external module can modify the quick search fields
|
||||
NEW: Auto activate some modules on install (export/import/wysiwyg editor)
|
||||
NEW: Autofill email form with the email template with status "Default" on
|
||||
NEW: Bank name no more mandatory on creation. Can be generated if empty.
|
||||
NEW: batch referential objets
|
||||
NEW: Better responsive for mass actions
|
||||
NEW: Can add any contact on events if global MAIN_ACTIONCOM_CAN_ADD_ANY_CONTACT is set at 1
|
||||
NEW: Can add the add now link on date into addfieldvalue()
|
||||
NEW: Can bin accounting line for a given month
|
||||
NEW: Can edit account on miscellaneous payment (if not transfered)
|
||||
NEW: Can edit inline the vat number from supplier tab
|
||||
NEW: Can fill date of salary payment with date of start of salary
|
||||
NEW: Can filter on a custom group of accounts. Perf or ledger list.
|
||||
NEW: Can go back to draft on shipment when stock change not on validate
|
||||
NEW: Can modify bank account of sepa payment (if file not sent yet)
|
||||
NEW: Can modify margin rates in offers like VAT rates.
|
||||
NEW: Can modify the date of payment of a salary (if not reconciled)
|
||||
NEW: Can now edit service name for oauth token
|
||||
NEW: Can receive more than qty ordered on reception
|
||||
NEW: Can select several warehouses into the view stock at date in past
|
||||
NEW: Can select the export format during export of journals
|
||||
NEW: Can set a checkbox in formconfirm by clicking on the label
|
||||
NEW: Can set background style with MAIN_LOGIN_BACKGROUND_STYLE
|
||||
NEW: Can set flag default value on email templates
|
||||
NEW: Can set the page "List of opportunities" as landing page
|
||||
NEW: Can show the sql request used on emailing selection
|
||||
NEW: can stay on edit field when errors occurs
|
||||
NEW: Can test a geoip conversion from the geoip setup page
|
||||
NEW: Captcha for public member's subscription form
|
||||
NEW: category of operation for crabe PDF model
|
||||
NEW: color for start date and owner
|
||||
NEW: comment in api_mymodule for seperate methods
|
||||
NEW: constant PROPALE_ADDON_NOTE_PUBLIC_DEFAULT
|
||||
NEW: create email substitution variable for intervention signature URL
|
||||
NEW: Date for salary payment includes the hour/min
|
||||
NEW: Debug the custom CSS feature to avoid a directory search/scan at
|
||||
NEW: dev name
|
||||
NEW: Disable bad reputation product price
|
||||
NEW: dolExplodeIntoArray can accept regex
|
||||
NEW: dol_sort_array can sort on alphabetical order even if val is num
|
||||
NEW: don't have closed contact proposed as receiver for the mails
|
||||
NEW: Dynamic choice of warehouse and batch in MO production.
|
||||
NEW: element time integration code + sql
|
||||
NEW: events list with color
|
||||
NEW: expend/collapse list of social networks
|
||||
NEW: filter for Signed+Billed in proposals
|
||||
NEW: Filter on amount and qty on list of service's contracts
|
||||
NEW: filter on entity in import
|
||||
NEW: formconfirm can support field with format datetime
|
||||
NEW: getCommonSubstitutionArray to have more substitute keys
|
||||
NEW: helper functions for dates + small demo case
|
||||
NEW: hook printFieldListFrom in contact list
|
||||
NEW: inc.php: handle parameters from argv
|
||||
NEW: Increment website counter on each page access in website module
|
||||
NEW: Invalidate all sessions of a user when password is modified.
|
||||
NEW: Invoice - Show Category of operations
|
||||
NEW: iSuiteExpert export model
|
||||
NEW: Keep a link between user created from recruitment and application
|
||||
NEW: limit load products in takepos
|
||||
NEW: List product in orders
|
||||
NEW: Make it possible to select hours and minutes in form_confirm
|
||||
NEW: map table to element for get entity in import
|
||||
NEW: migration script + delete old table + rename fields and indexes
|
||||
NEW: Multicurrency REST API to create, update, delete, update rate...
|
||||
NEW: Multiselect for filter on prospection status
|
||||
NEW: Name and date to print on PDF Sign
|
||||
NEW: [Bulk delete Project tasks]
|
||||
NEW: No overwrite of optionals during put() contact
|
||||
NEW: Notification for Sign or Refused Propal from Online Page
|
||||
NEW: notify also the contributor affected to a ticket if a new message public is post (add global TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ALSO_CONTRIBUTOR)
|
||||
NEW: Now we can edit amount on vat and salaries clone action
|
||||
NEW: only get openned contact from liste_contact function, to not have acces to closed contact as mail receiver
|
||||
NEW: operation type in email collector to load or create contact
|
||||
NEW: option filter for NoSalesRepresentativeAffected in proposals list
|
||||
NEW: Option to manage deposit slips for more payment modes (not only
|
||||
NEW: Option to show column for field and line selection on the left
|
||||
NEW: Order export : allow to export field 'shipment method'.
|
||||
NEW: payment default values when supplier order created from reception
|
||||
NEW: Payment : manage contracts
|
||||
NEW: Possibility to link to German pages in help
|
||||
NEW: presend mass action in contact list
|
||||
NEW: product images on popup are cached
|
||||
NEW: Provide the oldcopy value when calling setValueFrom() function with a trigger key
|
||||
NEW: Quadratus export with attachments in accountancy export
|
||||
NEW: referential objects of batch
|
||||
NEW: remove default percentage for event creation url
|
||||
NEW: remove keys whose table element is the same as element in map list
|
||||
NEW: repair script skip views
|
||||
NEW: Save date to invalidate other session into user table
|
||||
NEW: search on time spent duration range
|
||||
NEW: Send an email when ticket assigned
|
||||
NEW: Send a notification email when ticket assigned
|
||||
NEW: sepaStripe now creates the payment mode with type pm_ using new API
|
||||
NEW: set payment default values when supplier order created from reception
|
||||
NEW: set ticket status to answered if the client has answered from the public interface
|
||||
NEW: set today start time at begining
|
||||
NEW: Setup emailcollector easier. Can also use ! for negative search.
|
||||
NEW: Show counter of access of website in website list
|
||||
NEW: Show main currency in company info user tooltip
|
||||
NEW: Show module into list of emails templates
|
||||
NEW: Show picto into the combobox of widgets
|
||||
NEW: Show supplier invoice ref of direct debit transfer tab invoices
|
||||
NEW: show supplier name in getNomUrl of supplier order
|
||||
NEW: sort of column of custom group of account
|
||||
NEW: Stock limit for alert and desired optimal stock by product and warehouse import
|
||||
NEW: substitute date now in email collector
|
||||
NEW: Support different bank account for several direct debit payments
|
||||
NEW: Support multiselect in the warehouse selection combo box
|
||||
NEW: Support option MAIN_SECURITY_MAXFILESIZE_DOWNLOADED #yogosha10660
|
||||
NEW: table llx_element_time to store time spent on several elements (mo, ticket...)
|
||||
NEW: The batch for remind on due date can be setup for using validation date
|
||||
NEW: The refresh link for imap collector is always visible
|
||||
NEW: The upgrade process can be done by creating a file upgrade.unlock
|
||||
NEW: Tooltip to explain how to add a photo on a product
|
||||
NEW: Use a cache file for external RSS in calendar
|
||||
NEW: Use by default the domain $dolibarr_main_url_root for SMTP HELO
|
||||
NEW: use more recent model by default
|
||||
NEW: VAT can be modified during add of line
|
||||
NEW: write all fields and their properties in asciidoc format
|
||||
|
||||
For developers or integrators:
|
||||
------------------------------
|
||||
|
||||
NEW: triggers on mailing
|
||||
NEW: add function for listiong objects from directory
|
||||
NEW: Add helplist property to describe fields of obects
|
||||
NEW: Add hook in loadLotStock() in html.formproduct.class.php file, add hook 'llxFooter', Add hook online sign
|
||||
NEW: Update lib parsedownto 1.7.4, phpspreadsheet lib to v1.12
|
||||
NEW: Support contact in post() document API
|
||||
NEW: updating in modulbuilder on tab Menu when adding object
|
||||
NEW: Add/Edit permissions in ModuleBuilder
|
||||
NEW: Better generated documentation for modulebuilder
|
||||
NEW: Add sent info in the parameters provided to the hook sendMailAfter
|
||||
NEW: add setAsSelectUser into factory for generic setup page
|
||||
|
||||
|
||||
WARNING:
|
||||
|
|
@ -269,18 +447,20 @@ WARNING:
|
|||
|
||||
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
|
||||
* Minimal PHP version is now PHP 7.0 instead of PHP 5.6
|
||||
* Core has introduced a Universal Filter Syntax for seach criteria. Example: ((((field1:=:value1) OR (field2:in:1,2,3)) AND ...). In rare case, some filters
|
||||
could be provided by URL parameters. For such cases (societe/ajax/company.php), use of Universal Filter Syntax become mandatory.
|
||||
* The signature of method getNomUrl() of class ProductFournisseur has been modified to match the signature of method Product->getNomUrl()
|
||||
* Trigger ORDER_SUPPLIER_DISPATCH is removed, use ORDER_SUPPLIER_RECEIVE and/or LINEORDER_SUPPLIER_DISPATCH instead.
|
||||
* All functions fetch_all() have been set to deprecated for naming consitency, use fetchAll() instead.
|
||||
* Code standardization: '$user->rights->propale' is now '$user->rights->propal' everywhere.
|
||||
* Deprecated method set_billed() on shipment and reception class has been removed. Use setBilled() instead.
|
||||
* Tables llx_prelevement_facture and llx_prelevement_facture_demande have been renamed into llx_prelevement and llx_prelevement_demande.
|
||||
* Rename MAIN_LIST_ALLOW_NOTES into MAIN_LIST_HIDE_NOTES and rename MAIN_LIST_ALLOW_PRIVATE_NOTES into MAIN_LIST_HIDE_PRIVATE_NOTES
|
||||
* Rename the substitution for "project label" instead of "project title" in substitution variables
|
||||
* You must use "$objectoffield" to manipulate the current object inside the formulare of computed custom extrafields instead of $obj/$object.
|
||||
* Renamed MAIN_LIST_ALLOW_NOTES into MAIN_LIST_HIDE_NOTES and renamed MAIN_LIST_ALLOW_PRIVATE_NOTES into MAIN_LIST_HIDE_PRIVATE_NOTES
|
||||
* Renamed the substitution for "project label" instead of "project title" in substitution variables
|
||||
* You must use "$objectoffield" to manipulate the current object inside the form of computed custom extrafields instead of $obj/$object.
|
||||
* Making a global search is sending the parameter using always the name search_all (instead of sometimes sall and search_all)
|
||||
* The property $url_last_version must be public if defined into module descriptor files;
|
||||
* Filters in class field definitions must be a Dolibarr filter syntax string.
|
||||
|
||||
|
||||
***** ChangeLog for 16.0.5 compared to 16.0.4 *****
|
||||
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ This file contains some policies about the security reports on Dolibarr ERP CRM
|
|||
|
||||
| Version | Supported |
|
||||
| ---------- | ---------------------- |
|
||||
| <= 16.0.2 | :x: |
|
||||
| >= 16.0.3 | :white_check_mark: |
|
||||
| <= 17.0.0 | :x: |
|
||||
| >= 17.0.1 | :white_check_mark: |
|
||||
| >= develop | :white_check_mark: |
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ $arrayfields = array(
|
|||
'aa.import_key'=>array('label'=>"ImportId", 'checked'=>-1)
|
||||
);
|
||||
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL < 2) {
|
||||
if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
|
||||
unset($arrayfields['categories']);
|
||||
unset($arrayfields['aa.reconcilable']);
|
||||
}
|
||||
|
|
@ -146,7 +146,7 @@ if (empty($reshook)) {
|
|||
$search_array_options = array();
|
||||
}
|
||||
if ((GETPOST('valid_change_chart', 'alpha') && GETPOST('chartofaccounts', 'int') > 0) // explicit click on button 'Change and load' with js on
|
||||
|| (GETPOST('chartofaccounts', 'int') > 0 && GETPOST('chartofaccounts', 'int') != $conf->global->CHARTOFACCOUNTS)) { // a submit of form is done and chartofaccounts combo has been modified
|
||||
|| (GETPOST('chartofaccounts', 'int') > 0 && GETPOST('chartofaccounts', 'int') != getDolGlobalInt('CHARTOFACCOUNTS'))) { // a submit of form is done and chartofaccounts combo has been modified
|
||||
if ($chartofaccounts > 0 && $permissiontoadd) {
|
||||
// Get language code for this $chartofaccounts
|
||||
$sql = 'SELECT code FROM '.MAIN_DB_PREFIX.'c_country as c, '.MAIN_DB_PREFIX.'accounting_system as a';
|
||||
|
|
@ -228,7 +228,7 @@ if ($action == 'delete') {
|
|||
print $formconfirm;
|
||||
}
|
||||
|
||||
$pcgver = $conf->global->CHARTOFACCOUNTS;
|
||||
$pcgver = getDolGlobalInt('CHARTOFACCOUNTS');
|
||||
|
||||
$sql = "SELECT aa.rowid, aa.fk_pcg_version, aa.pcg_type, aa.account_number, aa.account_parent, aa.label, aa.labelshort, aa.fk_accounting_category,";
|
||||
$sql .= " aa.reconcilable, aa.active, aa.import_key,";
|
||||
|
|
@ -240,8 +240,8 @@ $sql .= " WHERE asy.rowid = ".((int) $pcgver);
|
|||
//print $sql;
|
||||
if (strlen(trim($search_account))) {
|
||||
$lengthpaddingaccount = 0;
|
||||
if ($conf->global->ACCOUNTING_LENGTH_GACCOUNT || $conf->global->ACCOUNTING_LENGTH_AACCOUNT) {
|
||||
$lengthpaddingaccount = max($conf->global->ACCOUNTING_LENGTH_GACCOUNT, $conf->global->ACCOUNTING_LENGTH_AACCOUNT);
|
||||
if (getDolGlobalInt('ACCOUNTING_LENGTH_GACCOUNT') || getDolGlobalInt('ACCOUNTING_LENGTH_AACCOUNT')) {
|
||||
$lengthpaddingaccount = max(getDolGlobalInt('ACCOUNTING_LENGTH_GACCOUNT'), getDolGlobalInt('ACCOUNTING_LENGTH_AACCOUNT'));
|
||||
}
|
||||
$search_account_tmp = $search_account;
|
||||
$weremovedsomezero = 0;
|
||||
|
|
@ -289,7 +289,7 @@ $sql .= $db->order($sortfield, $sortorder);
|
|||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
$resql = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($resql);
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ if ($action == 'add' && $user->hasRight('accounting', 'chartofaccount')) {
|
|||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors');
|
||||
$action = 'create';
|
||||
} else {
|
||||
$sql = "SELECT pcg_version FROM " . MAIN_DB_PREFIX . "accounting_system WHERE rowid = ".((int) $conf->global->CHARTOFACCOUNTS);
|
||||
$sql = "SELECT pcg_version FROM " . MAIN_DB_PREFIX . "accounting_system WHERE rowid = ".((int) getDolGlobalInt('CHARTOFACCOUNTS'));
|
||||
|
||||
dol_syslog('accountancy/admin/card.php:: $sql=' . $sql);
|
||||
$result = $db->query($sql);
|
||||
|
|
@ -139,7 +139,7 @@ if ($action == 'add' && $user->hasRight('accounting', 'chartofaccount')) {
|
|||
} else {
|
||||
$result = $object->fetch($id);
|
||||
|
||||
$sql = "SELECT pcg_version FROM ".MAIN_DB_PREFIX."accounting_system WHERE rowid=".((int) $conf->global->CHARTOFACCOUNTS);
|
||||
$sql = "SELECT pcg_version FROM ".MAIN_DB_PREFIX."accounting_system WHERE rowid=".((int) getDolGlobalInt('CHARTOFACCOUNTS'));
|
||||
|
||||
dol_syslog('accountancy/admin/card.php:: $sql=' . $sql);
|
||||
$result2 = $db->query($sql);
|
||||
|
|
@ -211,7 +211,7 @@ $form = new Form($db);
|
|||
$formaccounting = new FormAccounting($db);
|
||||
|
||||
$accountsystem = new AccountancySystem($db);
|
||||
$accountsystem->fetch($conf->global->CHARTOFACCOUNTS);
|
||||
$accountsystem->fetch(getDolGlobalInt('CHARTOFACCOUNTS'));
|
||||
|
||||
$title = $langs->trans('AccountAccounting')." - ".$langs->trans('Card');
|
||||
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ $sql .= $db->order($sortfield, $sortorder);
|
|||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
|
|
|
|||
|
|
@ -361,7 +361,7 @@ print '</tr>';
|
|||
foreach ($list as $key) {
|
||||
print '<tr class="oddeven value">';
|
||||
|
||||
if (!empty($conf->global->ACCOUNTING_MANAGE_ZERO) && ($key == 'ACCOUNTING_LENGTH_GACCOUNT' || $key == 'ACCOUNTING_LENGTH_AACCOUNT')) {
|
||||
if (getDolGlobalInt('ACCOUNTING_MANAGE_ZERO') && ($key == 'ACCOUNTING_LENGTH_GACCOUNT' || $key == 'ACCOUNTING_LENGTH_AACCOUNT')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -394,7 +394,7 @@ if (empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
|||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
$resql = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($resql);
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ $arrayfields = array(
|
|||
'reconcilable'=>array('label'=>$langs->trans("Reconcilable"), 'checked'=>1)
|
||||
);
|
||||
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL < 2) {
|
||||
if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
|
||||
unset($arrayfields['reconcilable']);
|
||||
}
|
||||
|
||||
|
|
@ -137,8 +137,8 @@ $sql .= " AND sa.code_compta <> ''";
|
|||
//print $sql;
|
||||
if (strlen(trim($search_subaccount))) {
|
||||
$lengthpaddingaccount = 0;
|
||||
if ($conf->global->ACCOUNTING_LENGTH_AACCOUNT) {
|
||||
$lengthpaddingaccount = max($conf->global->ACCOUNTING_LENGTH_AACCOUNT);
|
||||
if (getDolGlobalInt('ACCOUNTING_LENGTH_AACCOUNT')) {
|
||||
$lengthpaddingaccount = getDolGlobalInt('ACCOUNTING_LENGTH_AACCOUNT');
|
||||
}
|
||||
$search_subaccount_tmp = $search_subaccount;
|
||||
$weremovedsomezero = 0;
|
||||
|
|
@ -184,8 +184,8 @@ $sql .= " AND sa.code_compta_fournisseur <> ''";
|
|||
//print $sql;
|
||||
if (strlen(trim($search_subaccount))) {
|
||||
$lengthpaddingaccount = 0;
|
||||
if ($conf->global->ACCOUNTING_LENGTH_AACCOUNT) {
|
||||
$lengthpaddingaccount = max($conf->global->ACCOUNTING_LENGTH_AACCOUNT);
|
||||
if (getDolGlobalInt('ACCOUNTING_LENGTH_AACCOUNT')) {
|
||||
$lengthpaddingaccount = getDolGlobalInt('ACCOUNTING_LENGTH_AACCOUNT');
|
||||
}
|
||||
$search_subaccount_tmp = $search_subaccount;
|
||||
$weremovedsomezero = 0;
|
||||
|
|
@ -231,8 +231,8 @@ $sql .= " AND u.accountancy_code <> ''";
|
|||
//print $sql;
|
||||
if (strlen(trim($search_subaccount))) {
|
||||
$lengthpaddingaccount = 0;
|
||||
if ($conf->global->ACCOUNTING_LENGTH_AACCOUNT) {
|
||||
$lengthpaddingaccount = max($conf->global->ACCOUNTING_LENGTH_AACCOUNT);
|
||||
if (getDolGlobalInt('ACCOUNTING_LENGTH_AACCOUNT')) {
|
||||
$lengthpaddingaccount = getDolGlobalInt('ACCOUNTING_LENGTH_AACCOUNT');
|
||||
}
|
||||
$search_subaccount_tmp = $search_subaccount;
|
||||
$weremovedsomezero = 0;
|
||||
|
|
@ -274,7 +274,7 @@ $sql .= $db->order($sortfield, $sortorder);
|
|||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
$resql = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($resql);
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
|
|
|
|||
|
|
@ -254,7 +254,7 @@ llxHeader('', $title_page);
|
|||
if ($action != 'export_csv') {
|
||||
// List
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
if ($type == 'sub') {
|
||||
$nbtotalofrecords = $object->fetchAllBalance($sortorder, $sortfield, 0, 0, $filter, 'AND', 1);
|
||||
} else {
|
||||
|
|
|
|||
1404
htdocs/accountancy/bookkeeping/export.php
Normal file
1404
htdocs/accountancy/bookkeeping/export.php
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2013-2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2022 Lionel Vessiller <lvessiller@open-dsi.fr>
|
||||
* Copyright (C) 2016-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
|
||||
|
|
@ -29,7 +29,6 @@
|
|||
|
||||
// Load Dolibarr environment
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancyexport.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/lettering.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
|
||||
|
|
@ -96,14 +95,6 @@ $search_date_validation_start = dol_mktime(0, 0, 0, $search_date_validation_star
|
|||
$search_date_validation_end = dol_mktime(23, 59, 59, $search_date_validation_endmonth, $search_date_validation_endday, $search_date_validation_endyear);
|
||||
$search_import_key = GETPOST("search_import_key", 'alpha');
|
||||
|
||||
//var_dump($search_date_start);exit;
|
||||
if (GETPOST("button_delmvt_x") || GETPOST("button_delmvt.x") || GETPOST("button_delmvt")) {
|
||||
$action = 'delbookkeepingyear';
|
||||
}
|
||||
if (GETPOST("button_export_file_x") || GETPOST("button_export_file.x") || GETPOST("button_export_file")) {
|
||||
$action = 'export_file';
|
||||
}
|
||||
|
||||
$search_account_category = GETPOST('search_account_category', 'int');
|
||||
|
||||
$search_accountancy_code = GETPOST("search_accountancy_code", 'alpha');
|
||||
|
|
@ -159,7 +150,7 @@ $hookmanager->initHooks(array('bookkeepinglist'));
|
|||
$formaccounting = new FormAccounting($db);
|
||||
$form = new Form($db);
|
||||
|
||||
if (!in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && !GETPOSTISSET('begin') && !GETPOSTISSET('formfilteraction') && GETPOST('page', 'int') == '' && !GETPOST('noreset', 'int') && $user->hasRight('accounting', 'mouvements', 'export')) {
|
||||
if (!in_array($action, array('delmouv', 'delmouvconfirm')) && !GETPOSTISSET('begin') && !GETPOSTISSET('formfilteraction') && GETPOST('page', 'int') == '' && !GETPOST('noreset', 'int') && $user->hasRight('accounting', 'mouvements', 'export')) {
|
||||
if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET('restore_lastsearch_values') && !GETPOST('search_accountancy_code_start')) {
|
||||
$query = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear ";
|
||||
$query .= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."' limit 1";
|
||||
|
|
@ -201,8 +192,8 @@ $arrayfields = array(
|
|||
't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1),
|
||||
't.date_creation'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0),
|
||||
't.tms'=>array('label'=>$langs->trans("DateModification"), 'checked'=>0),
|
||||
't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>1),
|
||||
't.date_validated'=>array('label'=>$langs->trans("DateValidationAndLock"), 'checked'=>1, 'enabled'=>!getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")),
|
||||
't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>0),
|
||||
't.date_validated'=>array('label'=>$langs->trans("DateValidationAndLock"), 'checked'=>0, 'enabled'=>!getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")),
|
||||
't.import_key'=>array('label'=>$langs->trans("ImportId"), 'checked'=>0, 'position'=>1100),
|
||||
);
|
||||
|
||||
|
|
@ -210,13 +201,6 @@ if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) {
|
|||
unset($arrayfields['t.lettering_code']);
|
||||
}
|
||||
|
||||
$accountancyexport = new AccountancyExport($db);
|
||||
$listofformat = $accountancyexport->getType();
|
||||
$formatexportset = getDolGlobalString('ACCOUNTING_EXPORT_MODELCSV');
|
||||
if (empty($listofformat[$formatexportset])) {
|
||||
$formatexportset = 1;
|
||||
}
|
||||
|
||||
$error = 0;
|
||||
|
||||
if (!isModEnabled('accounting')) {
|
||||
|
|
@ -457,49 +441,6 @@ if (empty($reshook)) {
|
|||
$param .= '&search_import_key='.urlencode($search_import_key);
|
||||
}
|
||||
|
||||
//if ($action == 'delbookkeepingyearconfirm' && !$user->hasRight('accounting', 'mouvements', 'supprimer_tous')) {
|
||||
// $delmonth = GETPOST('delmonth', 'int');
|
||||
// $delyear = GETPOST('delyear', 'int');
|
||||
// if ($delyear == -1) {
|
||||
// $delyear = 0;
|
||||
// }
|
||||
// $deljournal = GETPOST('deljournal', 'alpha');
|
||||
// if ($deljournal == -1) {
|
||||
// $deljournal = 0;
|
||||
// }
|
||||
//
|
||||
// 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');
|
||||
// } else {
|
||||
// setEventMessages("RecordDeleted", null, 'mesgs');
|
||||
// }
|
||||
//
|
||||
// // Make a redirect to avoid to launch the delete later after a back button
|
||||
// header("Location: list.php".($param ? '?'.$param : ''));
|
||||
// exit;
|
||||
// } else {
|
||||
// setEventMessages("NoRecordDeleted", null, 'warnings');
|
||||
// }
|
||||
//}
|
||||
if ($action == 'setreexport') {
|
||||
$setreexport = GETPOST('value', 'int');
|
||||
if (!dolibarr_set_const($db, "ACCOUNTING_REEXPORT", $setreexport, 'yesno', 0, '', $conf->entity)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
if ($conf->global->ACCOUNTING_REEXPORT == 1) {
|
||||
setEventMessages($langs->trans("ExportOfPiecesAlreadyExportedIsEnable"), null, 'mesgs');
|
||||
} else {
|
||||
setEventMessages($langs->trans("ExportOfPiecesAlreadyExportedIsDisable"), null, 'warnings');
|
||||
}
|
||||
} else {
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
// Mass actions
|
||||
$objectclass = 'Bookkeeping';
|
||||
$objectlabel = 'Bookkeeping';
|
||||
|
|
@ -707,103 +648,12 @@ if (count($filter) > 0) {
|
|||
}
|
||||
}
|
||||
$sql .= ' WHERE t.entity IN ('.getEntity('accountancy').')';
|
||||
if (empty($conf->global->ACCOUNTING_REEXPORT)) {
|
||||
$sql .= " AND t.date_export IS NULL";
|
||||
}
|
||||
|
||||
if (count($sqlwhere) > 0) {
|
||||
$sql .= ' AND '.implode(' AND ', $sqlwhere);
|
||||
}
|
||||
//print $sql;
|
||||
|
||||
|
||||
// Export into a file with format defined into setup (FEC, CSV, ...)
|
||||
// Must be after definition of $sql
|
||||
if ($action == 'export_fileconfirm' && $user->hasRight('accounting', 'mouvements', 'export')) {
|
||||
// TODO Replace the fetchAll to get all ->line followed by call to ->export(). It currently consumes too much memory on large export.
|
||||
// Replace this with the query($sql) and loop on each line to export them.
|
||||
$result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter, 'AND', (empty($conf->global->ACCOUNTING_REEXPORT) ? 0 : 1));
|
||||
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
} else {
|
||||
// Export files then exit
|
||||
$accountancyexport = new AccountancyExport($db);
|
||||
|
||||
$formatexport = GETPOST('formatexport', 'int');
|
||||
$notexportlettering = GETPOST('notexportlettering', 'alpha');
|
||||
|
||||
if (!empty($notexportlettering)) {
|
||||
if (is_array($object->lines)) {
|
||||
foreach ($object->lines as $k => $movement) {
|
||||
unset($object->lines[$k]->lettering_code);
|
||||
unset($object->lines[$k]->date_lettering);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$notifiedexportdate = GETPOST('notifiedexportdate', 'alpha');
|
||||
$notifiedvalidationdate = GETPOST('notifiedvalidationdate', 'alpha');
|
||||
$withAttachment = !empty(trim(GETPOST('notifiedexportfull', 'alphanohtml'))) ? 1 : 0;
|
||||
|
||||
// Output data on screen or download
|
||||
$result = $accountancyexport->export($object->lines, $formatexport, $withAttachment);
|
||||
|
||||
$error = 0;
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
} else {
|
||||
if (!empty($notifiedexportdate) || !empty($notifiedvalidationdate)) {
|
||||
if (is_array($object->lines)) {
|
||||
dol_syslog("/accountancy/bookkeeping/list.php Function export_file Specify movements as exported", LOG_DEBUG);
|
||||
|
||||
// Specify as export : update field date_export or date_validated
|
||||
$db->begin();
|
||||
|
||||
// TODO Merge update for each line into one gloacl using rowid IN (list of movement ids)
|
||||
foreach ($object->lines as $movement) {
|
||||
$now = dol_now();
|
||||
|
||||
$setfields = '';
|
||||
if (!empty($notifiedexportdate) && empty($movement->date_export)) {
|
||||
$setfields .= ($setfields ? "," : "")." date_export = '".$db->idate($now)."'";
|
||||
}
|
||||
if (!empty($notifiedvalidationdate) && empty($movement->date_validation)) {
|
||||
$setfields .= ($setfields ? "," : "")." date_validated = '".$db->idate($now)."'";
|
||||
}
|
||||
|
||||
if ($setfields) {
|
||||
$sql = " UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping";
|
||||
$sql .= " SET ".$setfields;
|
||||
$sql .= " WHERE rowid = ".((int) $movement->id);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if (!$result) {
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
} else {
|
||||
$error++;
|
||||
$accountancyexport->errors[] = $langs->trans('NotAllExportedMovementsCouldBeRecordedAsExportedOrValidated');
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($error) {
|
||||
setEventMessages('', $accountancyexport->errors, 'errors');
|
||||
header('Location: '.$_SERVER['PHP_SELF']);
|
||||
}
|
||||
exit(); // download or show errors
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
|
@ -815,7 +665,7 @@ $title_page = $langs->trans("Operations").' - '.$langs->trans("Journals");
|
|||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
/* The fast and low memory method to get and count full list converts the sql into a sql count */
|
||||
$sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
|
||||
$sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
|
||||
|
|
@ -857,111 +707,6 @@ llxHeader('', $title_page);
|
|||
|
||||
$formconfirm = '';
|
||||
|
||||
if ($action == 'export_file') {
|
||||
$form_question = array();
|
||||
|
||||
$form_question['formatexport'] = array(
|
||||
'name' => 'formatexport',
|
||||
'type' => 'select',
|
||||
'label' => $langs->trans('Modelcsv'), // TODO Use Selectmodelcsv and show a select combo
|
||||
'values' => $listofformat,
|
||||
'default' => $formatexportset,
|
||||
'morecss' => 'minwidth200 maxwidth200'
|
||||
);
|
||||
|
||||
$form_question['separator0'] = array('name'=>'separator0', 'type'=>'separator');
|
||||
|
||||
if (getDolGlobalInt("ACCOUNTING_ENABLE_LETTERING")) {
|
||||
// If 1, we check by default.
|
||||
$checked = !empty($conf->global->ACCOUNTING_DEFAULT_NOT_EXPORT_LETTERING) ? 'true' : 'false';
|
||||
$form_question['notexportlettering'] = array(
|
||||
'name' => 'notexportlettering',
|
||||
'type' => 'checkbox',
|
||||
'label' => $langs->trans('NotExportLettering'),
|
||||
'value' => $checked,
|
||||
);
|
||||
|
||||
$form_question['separator1'] = array('name'=>'separator1', 'type'=>'separator');
|
||||
}
|
||||
|
||||
// If 1 or not set, we check by default.
|
||||
$checked = (!isset($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE) || !empty($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE));
|
||||
$form_question['notifiedexportdate'] = array(
|
||||
'name' => 'notifiedexportdate',
|
||||
'type' => 'checkbox',
|
||||
'label' => $langs->trans('NotifiedExportDate'),
|
||||
'value' => (!empty($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE) ? 'false' : 'true'),
|
||||
);
|
||||
|
||||
$form_question['separator2'] = array('name'=>'separator2', 'type'=>'separator');
|
||||
|
||||
if (!getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")) {
|
||||
// If 0 or not set, we NOT check by default.
|
||||
$checked = (isset($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_VALIDATION_DATE) || !empty($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_VALIDATION_DATE));
|
||||
$form_question['notifiedvalidationdate'] = array(
|
||||
'name' => 'notifiedvalidationdate',
|
||||
'type' => 'checkbox',
|
||||
'label' => $langs->trans('NotifiedValidationDate', $langs->transnoentitiesnoconv("MenuAccountancyClosure")),
|
||||
'value' => $checked,
|
||||
);
|
||||
|
||||
$form_question['separator3'] = array('name'=>'separator3', 'type'=>'separator');
|
||||
}
|
||||
|
||||
// add documents in an archive for accountancy export (Quadratus)
|
||||
if (getDolGlobalString('ACCOUNTING_EXPORT_MODELCSV') == AccountancyExport::$EXPORT_TYPE_QUADRATUS) {
|
||||
$form_question['notifiedexportfull'] = array(
|
||||
'name' => 'notifiedexportfull',
|
||||
'type' => 'checkbox',
|
||||
'label' => $langs->trans('NotifiedExportFull'),
|
||||
'value' => 'false',
|
||||
);
|
||||
}
|
||||
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans("ExportFilteredList").'...', $langs->trans('ConfirmExportFile'), 'export_fileconfirm', $form_question, '', 1, 420, 600);
|
||||
}
|
||||
|
||||
//if ($action == 'delbookkeepingyear') {
|
||||
// $form_question = array();
|
||||
// $delyear = GETPOST('delyear', 'int');
|
||||
// $deljournal = GETPOST('deljournal', 'alpha');
|
||||
//
|
||||
// if (empty($delyear)) {
|
||||
// $delyear = dol_print_date(dol_now(), '%Y');
|
||||
// }
|
||||
// $month_array = array();
|
||||
// for ($i = 1; $i <= 12; $i++) {
|
||||
// $month_array[$i] = $langs->trans("Month".sprintf("%02d", $i));
|
||||
// }
|
||||
// $year_array = $formaccounting->selectyear_accountancy_bookkepping($delyear, 'delyear', 0, 'array');
|
||||
// $journal_array = $formaccounting->select_journal($deljournal, 'deljournal', '', 1, 1, 1, '', 0, 1);
|
||||
//
|
||||
// $form_question['delmonth'] = array(
|
||||
// 'name' => 'delmonth',
|
||||
// 'type' => 'select',
|
||||
// 'label' => $langs->trans('DelMonth'),
|
||||
// 'values' => $month_array,
|
||||
// 'morecss' => 'minwidth150',
|
||||
// 'default' => ''
|
||||
// );
|
||||
// $form_question['delyear'] = array(
|
||||
// 'name' => 'delyear',
|
||||
// 'type' => 'select',
|
||||
// 'label' => $langs->trans('DelYear'),
|
||||
// 'values' => $year_array,
|
||||
// 'default' => $delyear
|
||||
// );
|
||||
// $form_question['deljournal'] = array(
|
||||
// 'name' => 'deljournal',
|
||||
// 'type' => 'other', // We don't use select here, the journal_array is already a select html component
|
||||
// 'label' => $langs->trans('DelJournal'),
|
||||
// 'value' => $journal_array,
|
||||
// 'default' => $deljournal
|
||||
// );
|
||||
//
|
||||
// $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt', $langs->transnoentitiesnoconv("RegistrationInAccounting")), 'delbookkeepingyearconfirm', $form_question, '', 1, 320);
|
||||
//}
|
||||
|
||||
// Print form confirm
|
||||
print $formconfirm;
|
||||
|
||||
|
|
@ -1015,21 +760,6 @@ if ($reshook < 0) {
|
|||
$newcardbutton = empty($hookmanager->resPrint) ? '' : $hookmanager->resPrint;
|
||||
|
||||
if (empty($reshook)) {
|
||||
// Button re-export
|
||||
if (!empty($conf->global->ACCOUNTING_REEXPORT)) {
|
||||
$newcardbutton .= '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&token='.newToken().'&value=0'.($param ? '&'.$param : '').'&sortfield='.urlencode($sortfield).'&sortorder='.urlencode($sortorder).'">'.img_picto($langs->trans("ClickToHideAlreadyExportedLines"), 'switch_off', 'class="small size15x valignmiddle"');
|
||||
$newcardbutton .= '<span class="valignmiddle marginrightonly paddingleft">'.$langs->trans("ClickToHideAlreadyExportedLines").'</span>';
|
||||
$newcardbutton .= '</a>';
|
||||
} else {
|
||||
$newcardbutton .= '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&token='.newToken().'&value=1'.($param ? '&'.$param : '').'&sortfield='.urlencode($sortfield).'&sortorder='.urlencode($sortorder).'">'.img_picto($langs->trans("DocsAlreadyExportedAreExcluded"), 'switch_on', 'class="warning size15x valignmiddle"');
|
||||
$newcardbutton .= '<span class="valignmiddle marginrightonly paddingleft">'.$langs->trans("DocsAlreadyExportedAreExcluded").'</span>';
|
||||
$newcardbutton .= '</a>';
|
||||
}
|
||||
|
||||
if ($user->hasRight('accounting', 'mouvements', 'export')) {
|
||||
$newcardbutton .= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', 'fa fa-file-export paddingleft', $_SERVER["PHP_SELF"].'?action=export_file&token='.newToken().($param ? '&'.$param : '').'&sortfield='.urlencode($sortfield).'&sortorder='.urlencode($sortorder), $user->hasRight('accounting', 'mouvements', 'export'));
|
||||
}
|
||||
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param, '', 1, array('morecss' => 'marginleftonly'));
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?type=sub'.$param, '', 1, array('morecss' => 'marginleftonly'));
|
||||
|
|
@ -1608,13 +1338,6 @@ print $hookmanager->resPrint;
|
|||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
// TODO Replace this with mass delete action
|
||||
//if ($user->rights->accounting->mouvements->supprimer_tous) {
|
||||
// print '<div class="tabsAction tabsActionNoBottom">'."\n";
|
||||
// print '<a class="butActionDelete" name="button_delmvt" href="'.$_SERVER["PHP_SELF"].'?action=delbookkeepingyear&token='.newToken().($param ? '&'.$param : '').'">'.$langs->trans("DeleteMvt").'</a>';
|
||||
// print '</div>';
|
||||
//}
|
||||
|
||||
print '</form>';
|
||||
|
||||
// End of page
|
||||
|
|
|
|||
|
|
@ -559,7 +559,7 @@ llxHeader('', $title_page);
|
|||
|
||||
// List
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
// TODO Perf Replace this by a count
|
||||
if ($type == 'sub') {
|
||||
$nbtotalofrecords = $object->fetchAllByAccount($sortorder, $sortfield, 0, 0, $filter, 'AND', 1, 1);
|
||||
|
|
|
|||
|
|
@ -466,7 +466,7 @@ class AccountancyCategory // extends CommonObject
|
|||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as aa";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
||||
$sql .= " WHERE (aa.fk_accounting_category <> ".((int) $id)." OR aa.fk_accounting_category IS NULL)";
|
||||
$sql .= " AND asy.rowid = ".((int) $conf->global->CHARTOFACCOUNTS);
|
||||
$sql .= " AND asy.rowid = ".((int) getDolGlobalInt('CHARTOFACCOUNTS'));
|
||||
$sql .= " AND aa.active = 1";
|
||||
$sql .= " AND aa.entity = ".$conf->entity;
|
||||
$sql .= " GROUP BY aa.account_number, aa.label";
|
||||
|
|
@ -512,7 +512,7 @@ class AccountancyCategory // extends CommonObject
|
|||
$sql = "SELECT aa.rowid, aa.account_number";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as aa";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
||||
$sql .= " AND asy.rowid = ".((int) $conf->global->CHARTOFACCOUNTS);
|
||||
$sql .= " AND asy.rowid = ".((int) getDolGlobalInt('CHARTOFACCOUNTS'));
|
||||
$sql .= " AND aa.active = 1";
|
||||
$sql .= " AND aa.entity = ".$conf->entity;
|
||||
$sql .= " ORDER BY LENGTH(aa.account_number) DESC;"; // LENGTH is ok with mysql and postgresql
|
||||
|
|
@ -839,7 +839,7 @@ class AccountancyCategory // extends CommonObject
|
|||
exit();
|
||||
}
|
||||
|
||||
$pcgverid = $conf->global->CHARTOFACCOUNTS;
|
||||
$pcgverid = getDolGlobalInt('CHARTOFACCOUNTS');
|
||||
$pcgvercode = dol_getIdFromCode($this->db, $pcgverid, 'accounting_system', 'rowid', 'pcg_version');
|
||||
if (empty($pcgvercode)) {
|
||||
$pcgvercode = $pcgverid;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -169,7 +169,7 @@ class AccountingAccount extends CommonObject
|
|||
global $conf;
|
||||
|
||||
$this->db = $db;
|
||||
$this->next_prev_filter = "fk_pcg_version IN (SELECT pcg_version FROM ".MAIN_DB_PREFIX."accounting_system WHERE rowid = ".((int) $conf->global->CHARTOFACCOUNTS).")"; // Used to add a filter in Form::showrefnav method
|
||||
$this->next_prev_filter = "fk_pcg_version IN (SELECT pcg_version FROM ".MAIN_DB_PREFIX."accounting_system WHERE rowid = ".((int) getDolGlobalInt('CHARTOFACCOUNTS')).")"; // Used to add a filter in Form::showrefnav method
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -198,7 +198,7 @@ class AccountingAccount extends CommonObject
|
|||
$sql .= " AND a.entity = ".$conf->entity;
|
||||
}
|
||||
if (!empty($limittocurrentchart)) {
|
||||
$sql .= ' AND a.fk_pcg_version IN (SELECT pcg_version FROM '.MAIN_DB_PREFIX.'accounting_system WHERE rowid = '.((int) $conf->global->CHARTOFACCOUNTS).')';
|
||||
$sql .= ' AND a.fk_pcg_version IN (SELECT pcg_version FROM '.MAIN_DB_PREFIX.'accounting_system WHERE rowid = '.((int) getDolGlobalInt('CHARTOFACCOUNTS')).')';
|
||||
}
|
||||
if (!empty($limittoachartaccount)) {
|
||||
$sql .= " AND a.fk_pcg_version = '".$this->db->escape($limittoachartaccount)."'";
|
||||
|
|
|
|||
276
htdocs/accountancy/class/api_accountancy.class.php
Normal file
276
htdocs/accountancy/class/api_accountancy.class.php
Normal file
|
|
@ -0,0 +1,276 @@
|
|||
<?php
|
||||
/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2019 Cedric Ancelin <icedo.anc@gmail.com>
|
||||
* Copyright (C) 2023 Lionel Vessiller <lvessiller@open-dsi.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use Luracast\Restler\RestException;
|
||||
|
||||
/**
|
||||
* API class for accountancy
|
||||
*
|
||||
* @access protected
|
||||
* @class DolibarrApiAccess {@requires user,external}
|
||||
*
|
||||
*/
|
||||
class Accountancy extends DolibarrApi
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @var array $FIELDS Mandatory fields, checked when create and update object
|
||||
*/
|
||||
public static $FIELDS = array();
|
||||
|
||||
/**
|
||||
* @var BookKeeping $bookkeeping {@type BookKeeping}
|
||||
*/
|
||||
public $bookkeeping;
|
||||
|
||||
/**
|
||||
* @var AccountancyExport $accountancy_export {@type AccountancyExport}
|
||||
*/
|
||||
public $accountancyexport;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
global $db, $langs;
|
||||
$this->db = $db;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancyexport.class.php';
|
||||
|
||||
$langs->load('accountancy');
|
||||
|
||||
$this->bookkeeping = new BookKeeping($this->db);
|
||||
$this->accountancyexport = new AccountancyExport($this->db);
|
||||
}
|
||||
|
||||
/**
|
||||
* Accountancy export data
|
||||
*
|
||||
* @param string $period Period : 'lastmonth', 'currentmonth', 'last3months', 'last6months', 'currentyear', 'lastyear', 'fiscalyear', 'lastfiscalyear', 'actualandlastfiscalyear' or 'custom' (see above)
|
||||
* @param string $date_min [=''] Start date of period if 'custom' is set in period parameter
|
||||
* Date format is 'YYYY-MM-DD'
|
||||
* @param string $date_max [=''] End date of period if 'custom' is set in period parameter
|
||||
* Date format is 'YYYY-MM-DD'
|
||||
* @param string $format [=''] by default uses '1' for 'Configurable (CSV)' for format number
|
||||
* or '1000' for FEC
|
||||
* or '1010' for FEC2
|
||||
* (see AccountancyExport class)
|
||||
* @param int $lettering [=0] by default don't export or 1 to export lettering data (columns 'letterring_code' and 'date_lettering' returns empty or not)
|
||||
* @param int $alreadyexport [=0] by default export data only if it's not yet exported or 1 already exported (always export data even if 'date_export" is set)
|
||||
* @param int $notnotifiedasexport [=0] by default notified as exported or 1 not notified as exported (when the export is done, notified or not the column 'date_export')
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @url GET exportdata
|
||||
*
|
||||
* @throws RestException 401 Insufficient rights
|
||||
* @throws RestException 404 Accountancy export period not found
|
||||
* @throws RestException 404 Accountancy export start or end date not defined
|
||||
* @throws RestException 404 Accountancy export format not found
|
||||
* @throws RestException 500 Error on accountancy export
|
||||
*/
|
||||
public function exportData($period, $date_min = '', $date_max = '', $format = '', $lettering = 0, $alreadyexport = 0, $notnotifiedasexport = 0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
// check rights
|
||||
if (!DolibarrApiAccess::$user->rights->accounting->mouvements->export) {
|
||||
throw new RestException(401, 'No permission to export accounting');
|
||||
}
|
||||
|
||||
// check parameters
|
||||
$period_available_list = array('lastmonth', 'currentmonth', 'last3months', 'last6months', 'currentyear', 'lastyear', 'fiscalyear', 'lastfiscalyear', 'actualandlastfiscalyear', 'custom');
|
||||
if (!in_array($period, $period_available_list)) {
|
||||
throw new RestException(404, 'Accountancy export period not found');
|
||||
}
|
||||
if ($period == 'custom') {
|
||||
if ($date_min == '' && $date_max == '') {
|
||||
throw new RestException(404, 'Accountancy export start and end date for custom period not defined');
|
||||
}
|
||||
}
|
||||
if ($format == '') {
|
||||
$format = AccountancyExport::$EXPORT_TYPE_CONFIGURABLE; // uses default
|
||||
}
|
||||
|
||||
// get objects
|
||||
$bookkeeping = $this->bookkeeping;
|
||||
$accountancyexport = $this->accountancyexport;
|
||||
|
||||
// find export format code from format number
|
||||
$format_number_available_list = $accountancyexport->getType();
|
||||
if (is_numeric($format)) {
|
||||
$format_number = (int) $format;
|
||||
} else {
|
||||
$format_number = 0;
|
||||
$format_label_available_list = array_flip($format_number_available_list);
|
||||
if (isset($format_label_available_list[$format])) {
|
||||
$format_number = $format_label_available_list[$format];
|
||||
}
|
||||
}
|
||||
|
||||
// get all format available and check if exists
|
||||
if (!array_key_exists($format_number, $format_number_available_list)) {
|
||||
throw new RestException(404, 'Accountancy export format not found');
|
||||
}
|
||||
|
||||
$sortorder = 'ASC'; // by default
|
||||
$sortfield = 't.piece_num, t.rowid'; // by default
|
||||
|
||||
// set filter for each period available
|
||||
$filter = array();
|
||||
$doc_date_start = null;
|
||||
$doc_date_end= null;
|
||||
$now = dol_now();
|
||||
$now_arr = dol_getdate($now);
|
||||
$now_month = $now_arr['mon'];
|
||||
$now_year = $now_arr['year'];
|
||||
if ($period == 'custom') {
|
||||
if ($date_min != '') {
|
||||
$time_min = strtotime($date_min);
|
||||
if ($time_min !== false) {
|
||||
$doc_date_start = $time_min;
|
||||
}
|
||||
}
|
||||
if ($date_max != '') {
|
||||
$time_max = strtotime($date_max);
|
||||
if ($time_max !== false) {
|
||||
$doc_date_end = $time_max;
|
||||
}
|
||||
}
|
||||
} elseif ($period == 'lastmonth') {
|
||||
$prev_date_arr = dol_get_prev_month($now_month, $now_year); // get previous month and year if month is january
|
||||
$doc_date_start = dol_mktime(0, 0, 0, $prev_date_arr['month'], 1, $prev_date_arr['year']); // first day of previous month
|
||||
$doc_date_end = dol_get_last_day($prev_date_arr['year'], $prev_date_arr['month']); // last day of previous month
|
||||
} elseif ($period == 'currentmonth') {
|
||||
$doc_date_start = dol_mktime(0, 0, 0, $now_month, 1, $now_year); // first day of current month
|
||||
$doc_date_end = dol_get_last_day($now_year, $now_month); // last day of current month
|
||||
} elseif ($period == 'last3months' || $period == 'last6months') {
|
||||
if ($period == 'last3months') {
|
||||
// last 3 months
|
||||
$nb_prev_month = 3;
|
||||
} else {
|
||||
// last 6 months
|
||||
$nb_prev_month = 6;
|
||||
}
|
||||
$prev_month_date_list = array();
|
||||
$prev_month_date_list[] = dol_get_prev_month($now_month, $now_year); // get previous month for index = 0
|
||||
for ($i = 1; $i < $nb_prev_month; $i++) {
|
||||
$prev_month_date_list[] = dol_get_prev_month($prev_month_date_list[$i-1]['month'], $prev_month_date_list[$i-1]['year']); // get i+1 previous month for index=i
|
||||
}
|
||||
$doc_date_start = dol_mktime(0, 0, 0, $prev_month_date_list[$nb_prev_month-1]['month'], 1, $prev_month_date_list[$nb_prev_month-1]['year']); // first day of n previous month for index=n-1
|
||||
$doc_date_end = dol_get_last_day($prev_month_date_list[0]['year'], $prev_month_date_list[0]['month']); // last day of previous month for index = 0
|
||||
} elseif ($period == 'currentyear' || $period == 'lastyear') {
|
||||
$period_year = $now_year;
|
||||
if ($period == 'lastyear') {
|
||||
$period_year--;
|
||||
}
|
||||
$doc_date_start = dol_mktime(0, 0, 0, 1, 1, $period_year); // first day of year
|
||||
$doc_date_end = dol_mktime(23, 59, 59, 12, 31, $period_year); // last day of year
|
||||
} elseif ($period == 'fiscalyear' || $period == 'lastfiscalyear' || $period == 'actualandlastfiscalyear') {
|
||||
// find actual fiscal year
|
||||
$cur_fiscal_period = getCurrentPeriodOfFiscalYear($this->db, $conf);
|
||||
$cur_fiscal_date_start = $cur_fiscal_period['date_start'];
|
||||
$cur_fiscal_date_end = $cur_fiscal_period['date_end'];
|
||||
|
||||
if ($period == 'fiscalyear') {
|
||||
$doc_date_start = $cur_fiscal_date_start;
|
||||
$doc_date_end = $cur_fiscal_date_end;
|
||||
} else {
|
||||
// get one day before current fiscal date start (to find previous fiscal period)
|
||||
$prev_fiscal_date_search = dol_time_plus_duree($cur_fiscal_date_start, -1, 'd');
|
||||
|
||||
// find previous fiscal year from current fiscal year
|
||||
$prev_fiscal_period = getCurrentPeriodOfFiscalYear($this->db, $conf, $prev_fiscal_date_search);
|
||||
$prev_fiscal_date_start = $prev_fiscal_period['date_start'];
|
||||
$prev_fiscal_date_end = $prev_fiscal_period['date_end'];
|
||||
|
||||
if ($period == 'lastfiscalyear') {
|
||||
$doc_date_start = $prev_fiscal_date_start;
|
||||
$doc_date_end = $prev_fiscal_date_end;
|
||||
} else {
|
||||
// period == 'actualandlastfiscalyear'
|
||||
$doc_date_start = $prev_fiscal_date_start;
|
||||
$doc_date_end = $cur_fiscal_date_end;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (is_numeric($doc_date_start)) {
|
||||
$filter['t.doc_date>='] = $doc_date_start;
|
||||
}
|
||||
if (is_numeric($doc_date_end)) {
|
||||
$filter['t.doc_date<='] = $doc_date_end;
|
||||
}
|
||||
|
||||
$result = $bookkeeping->fetchAll($sortorder, $sortfield, 0, 0, $filter, 'AND', $alreadyexport);
|
||||
|
||||
if ($result < 0) {
|
||||
throw new RestException(500, 'Error bookkeeping fetch all : '.$bookkeeping->errorsToString());
|
||||
} else {
|
||||
// export files then exit
|
||||
if (empty($lettering)) {
|
||||
if (is_array($bookkeeping->lines)) {
|
||||
foreach ($bookkeeping->lines as $k => $movement) {
|
||||
unset($bookkeeping->lines[$k]->lettering_code);
|
||||
unset($bookkeeping->lines[$k]->date_lettering);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$error = 0;
|
||||
$this->db->begin();
|
||||
|
||||
if (empty($notnotifiedasexport)) {
|
||||
if (is_array($bookkeeping->lines)) {
|
||||
foreach ($bookkeeping->lines as $movement) {
|
||||
$now = dol_now();
|
||||
|
||||
$sql = " UPDATE " . MAIN_DB_PREFIX . "accounting_bookkeeping";
|
||||
$sql .= " SET date_export = '" . $this->db->idate($now) . "'";
|
||||
$sql .= " WHERE rowid = " . ((int) $movement->id);
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if (!$result) {
|
||||
$accountancyexport->errors[] = $langs->trans('NotAllExportedMovementsCouldBeRecordedAsExportedOrValidated');
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// export and only write file without downloading
|
||||
if (!$error) {
|
||||
$result = $accountancyexport->export($bookkeeping->lines, $format_number, 0, 1, 2);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($error) {
|
||||
$this->db->rollback();
|
||||
throw new RestException(500, 'Error accountancy export : '.implode(',', $accountancyexport->errors));
|
||||
} else {
|
||||
$this->db->commit();
|
||||
exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2031,7 +2031,7 @@ class BookKeeping extends CommonObject
|
|||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
|
||||
$pcgver = $conf->global->CHARTOFACCOUNTS;
|
||||
$pcgver = getDolGlobalInt('CHARTOFACCOUNTS');
|
||||
|
||||
$sql = "SELECT DISTINCT ab.numero_compte as account_number, aa.label as label, aa.rowid as rowid, aa.fk_pcg_version";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab";
|
||||
|
|
@ -2093,7 +2093,7 @@ class BookKeeping extends CommonObject
|
|||
public function getRootAccount($account = null)
|
||||
{
|
||||
global $conf;
|
||||
$pcgver = $conf->global->CHARTOFACCOUNTS;
|
||||
$pcgver = getDolGlobalInt('CHARTOFACCOUNTS');
|
||||
|
||||
$sql = "SELECT root.rowid, root.account_number, root.label as label,";
|
||||
$sql .= " parent.rowid as parent_rowid, parent.account_number as parent_account_number, parent.label as parent_label";
|
||||
|
|
@ -2135,7 +2135,7 @@ class BookKeeping extends CommonObject
|
|||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$pcgver = $conf->global->CHARTOFACCOUNTS;
|
||||
$pcgver = getDolGlobalInt('CHARTOFACCOUNTS');
|
||||
$sql = "SELECT aa.account_number, aa.label, aa.rowid, aa.fk_pcg_version, cat.label as category";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as aa ";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ $year_current = $year_start;
|
|||
// Validate History
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
|
||||
$chartaccountcode = dol_getIdFromCode($db, getDolGlobalInt('CHARTOFACCOUNTS'), 'accounting_system', 'rowid', 'pcg_version');
|
||||
|
||||
// Security check
|
||||
if (!isModEnabled('accounting')) {
|
||||
|
|
@ -102,9 +102,9 @@ if (($action == 'clean' || $action == 'validatehistory') && $user->hasRight('acc
|
|||
$sql1 .= ' (SELECT accnt.rowid ';
|
||||
$sql1 .= ' FROM '.MAIN_DB_PREFIX.'accounting_account as accnt';
|
||||
$sql1 .= ' INNER JOIN '.MAIN_DB_PREFIX.'accounting_system as syst';
|
||||
$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid='.((int) $conf->global->CHARTOFACCOUNTS).' AND accnt.entity = '.((int) $conf->entity).')';
|
||||
$sql1 .= ' AND fd.fk_facture IN (SELECT rowid FROM '.MAIN_DB_PREFIX.'facture WHERE entity = '.((int) $conf->entity).')';
|
||||
$sql1 .= ' AND fk_code_ventilation <> 0';
|
||||
$sql1 .= " ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid = ".((int) getDolGlobalInt('CHARTOFACCOUNTS'))." AND accnt.entity = ".((int) $conf->entity).")";
|
||||
$sql1 .= " AND fd.fk_facture IN (SELECT rowid FROM ".MAIN_DB_PREFIX."facture WHERE entity = ".((int) $conf->entity).")";
|
||||
$sql1 .= " AND fk_code_ventilation <> 0";
|
||||
|
||||
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
||||
$resql1 = $db->query($sql1);
|
||||
|
|
|
|||
|
|
@ -303,7 +303,7 @@ $sql .= $db->order($sortfield, $sortorder);
|
|||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ $hookmanager->initHooks(array('accountancycustomerlist'));
|
|||
$formaccounting = new FormAccounting($db);
|
||||
$accountingAccount = new AccountingAccount($db);
|
||||
|
||||
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
|
||||
$chartaccountcode = dol_getIdFromCode($db, getDolGlobalInt('CHARTOFACCOUNTS'), 'accounting_system', 'rowid', 'pcg_version');
|
||||
|
||||
// Security check
|
||||
if (!isModEnabled('accounting')) {
|
||||
|
|
@ -359,7 +359,7 @@ $sql .= $db->order($sortfield, $sortorder);
|
|||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ $year_current = $year_start;
|
|||
// Validate History
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
|
||||
$chartaccountcode = dol_getIdFromCode($db, getDolGlobalInt('CHARTOFACCOUNTS'), 'accounting_system', 'rowid', 'pcg_version');
|
||||
|
||||
// Security check
|
||||
if (!isModEnabled('accounting')) {
|
||||
|
|
@ -85,7 +85,7 @@ if (($action == 'clean' || $action == 'validatehistory') && $user->hasRight('acc
|
|||
$sql1 .= ' (SELECT accnt.rowid ';
|
||||
$sql1 .= ' FROM '.MAIN_DB_PREFIX.'accounting_account as accnt';
|
||||
$sql1 .= ' INNER JOIN '.MAIN_DB_PREFIX.'accounting_system as syst';
|
||||
$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid='.((int) $conf->global->CHARTOFACCOUNTS).' AND accnt.entity = '.((int) $conf->entity).')';
|
||||
$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid='.((int) getDolGlobalInt('CHARTOFACCOUNTS')).' AND accnt.entity = '.((int) $conf->entity).')';
|
||||
$sql1 .= ' AND erd.fk_expensereport IN (SELECT rowid FROM '.MAIN_DB_PREFIX.'expensereport WHERE entity = '.((int) $conf->entity).')';
|
||||
$sql1 .= ' AND fk_code_ventilation <> 0';
|
||||
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
||||
|
|
|
|||
|
|
@ -234,7 +234,7 @@ $sql .= $db->order($sortfield, $sortorder);
|
|||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ $hookmanager->initHooks(array('accountancyexpensereportlist'));
|
|||
$formaccounting = new FormAccounting($db);
|
||||
$accounting = new AccountingAccount($db);
|
||||
|
||||
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
|
||||
$chartaccountcode = dol_getIdFromCode($db, getDolGlobalInt('CHARTOFACCOUNTS'), 'accounting_system', 'rowid', 'pcg_version');
|
||||
|
||||
// Security check
|
||||
if (!isModEnabled('accounting')) {
|
||||
|
|
@ -283,7 +283,7 @@ $sql .= $db->order($sortfield, $sortorder);
|
|||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ $year_current = $year_start;
|
|||
// Validate History
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
|
||||
$chartaccountcode = dol_getIdFromCode($db, getDolGlobalInt('CHARTOFACCOUNTS'), 'accounting_system', 'rowid', 'pcg_version');
|
||||
|
||||
// Security check
|
||||
if (!isModEnabled('accounting')) {
|
||||
|
|
@ -100,9 +100,9 @@ if (($action == 'clean' || $action == 'validatehistory') && $user->rights->accou
|
|||
$sql1 .= ' (SELECT accnt.rowid ';
|
||||
$sql1 .= ' FROM '.MAIN_DB_PREFIX.'accounting_account as accnt';
|
||||
$sql1 .= ' INNER JOIN '.MAIN_DB_PREFIX.'accounting_system as syst';
|
||||
$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid='.$conf->global->CHARTOFACCOUNTS.' AND accnt.entity = '.$conf->entity.')';
|
||||
$sql1 .= ' AND fd.fk_facture_fourn IN (SELECT rowid FROM '.MAIN_DB_PREFIX.'facture_fourn WHERE entity = '.$conf->entity.')';
|
||||
$sql1 .= ' AND fk_code_ventilation <> 0';
|
||||
$sql1 .= " ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid = ".getDolGlobalInt('CHARTOFACCOUNTS')." AND accnt.entity = ".((int) $conf->entity).")";
|
||||
$sql1 .= " AND fd.fk_facture_fourn IN (SELECT rowid FROM '.MAIN_DB_PREFIX.'facture_fourn WHERE entity = ".((int) $conf->entity).")";
|
||||
$sql1 .= " AND fk_code_ventilation <> 0";
|
||||
|
||||
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
||||
$resql1 = $db->query($sql1);
|
||||
|
|
|
|||
|
|
@ -308,7 +308,7 @@ $sql .= $db->order($sortfield, $sortorder);
|
|||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ $hookmanager->initHooks(array('accountancysupplierlist'));
|
|||
$formaccounting = new FormAccounting($db);
|
||||
$accountingAccount = new AccountingAccount($db);
|
||||
|
||||
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
|
||||
$chartaccountcode = dol_getIdFromCode($db, getDolGlobalInt('CHARTOFACCOUNTS'), 'accounting_system', 'rowid', 'pcg_version');
|
||||
|
||||
// Security check
|
||||
if (!isModEnabled('accounting')) {
|
||||
|
|
@ -363,7 +363,7 @@ $sql .= $db->order($sortfield, $sortorder);
|
|||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
*/
|
||||
|
||||
// $formatexportset must be defined
|
||||
// $downloadMode =0 for direct download or =1 to download after writing files or =-1 not to download files
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || !is_object($conf)) {
|
||||
|
|
@ -35,7 +36,7 @@ $siren = getDolGlobalString('MAIN_INFO_SIREN');
|
|||
$date_export = "_".dol_print_date(dol_now(), '%Y%m%d%H%M%S');
|
||||
$endaccountingperiod = dol_print_date(dol_now(), '%Y%m%d');
|
||||
|
||||
if (empty($withAttachment)) {
|
||||
if (empty($downloadMode)) {
|
||||
header('Content-Type: text/csv');
|
||||
}
|
||||
|
||||
|
|
@ -70,6 +71,6 @@ if (($accountancyexport->getFormatCode($formatexportset) == 'fec' || $accountanc
|
|||
$completefilename = ($code ? $code."_" : "").($prefix ? $prefix."_" : "").$filename.($nodateexport ? "" : $date_export).".".$format;
|
||||
}
|
||||
|
||||
if (empty($withAttachment)) {
|
||||
if (empty($downloadMode)) {
|
||||
header('Content-Disposition: attachment;filename=' . $completefilename);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ $search_agenda_label = GETPOST('search_agenda_label');
|
|||
$objcanvas = null;
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('memberagenda'));
|
||||
$hookmanager->initHooks(array('memberagenda', 'globalcard'));
|
||||
|
||||
// Security check
|
||||
$result = restrictedArea($user, 'adherent', $id);
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@
|
|||
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/commonpeople.class.php';
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -45,6 +46,8 @@ require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
|||
*/
|
||||
class Adherent extends CommonObject
|
||||
{
|
||||
use CommonPeople;
|
||||
|
||||
/**
|
||||
* @var string ID to identify managed object
|
||||
*/
|
||||
|
|
@ -3303,7 +3306,7 @@ class Adherent extends CommonObject
|
|||
*/
|
||||
public function getKanbanView($option = '', $arraydata = null)
|
||||
{
|
||||
global $selected;
|
||||
$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
|
||||
|
||||
$return = '<div class="box-flex-item box-flex-grow-zero">';
|
||||
$return .= '<div class="info-box info-box-sm">';
|
||||
|
|
|
|||
|
|
@ -996,6 +996,8 @@ class AdherentType extends CommonObject
|
|||
{
|
||||
global $langs, $user;
|
||||
|
||||
//$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
|
||||
|
||||
$return = '<div class="box-flex-item box-flex-grow-zero">';
|
||||
$return .= '<div class="info-box info-box-sm">';
|
||||
$return .= '<span class="info-box-icon bg-infobox-action">';
|
||||
|
|
@ -1004,7 +1006,6 @@ class AdherentType extends CommonObject
|
|||
$return .= '<div class="info-box-content">';
|
||||
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>';
|
||||
|
||||
//$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
|
||||
//$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
|
||||
if ($user->rights->adherent->configurer) {
|
||||
|
|
|
|||
|
|
@ -222,7 +222,7 @@ class Members extends DolibarrApi
|
|||
}
|
||||
|
||||
$sql = "SELECT t.rowid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as t";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent AS t LEFT JOIN ".MAIN_DB_PREFIX."adherent_extrafields AS ef ON (ef.fk_object = t.rowid)"; // Modification VMR Global Solutions to include extrafields as search parameters in the API GET call
|
||||
if ($category > 0) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."categorie_member as c";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ class MembersTypes extends DolibarrApi
|
|||
}
|
||||
|
||||
$sql = "SELECT t.rowid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as t";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type AS t LEFT JOIN ".MAIN_DB_PREFIX."adherent_type_extrafields AS ef ON (ef.fk_object = t.rowid)"; // Modification VMR Global Solutions to include extrafields as search parameters in the API GET call, so we will be able to filter on extrafields
|
||||
$sql .= ' WHERE t.entity IN ('.getEntity('member_type').')';
|
||||
|
||||
// Add sql filters
|
||||
|
|
|
|||
|
|
@ -500,7 +500,7 @@ $sql .= $hookmanager->resPrint;
|
|||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
/* The fast and low memory method to get and count full list converts the sql into a sql count */
|
||||
$sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
|
||||
$sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
|
||||
|
|
@ -1068,7 +1068,7 @@ while ($i < $imaxinloop) {
|
|||
$memberstatic->type = $membertypestatic->label;
|
||||
$memberstatic->photo = $obj->photo;
|
||||
// Output Kanban
|
||||
print $memberstatic->getKanbanView('');
|
||||
print $memberstatic->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
|
||||
if ($i == (min($num, $limit) - 1)) {
|
||||
print '</div>';
|
||||
print '</td></tr>';
|
||||
|
|
|
|||
|
|
@ -287,7 +287,7 @@ if (count($arrayjs) && $mode == 'memberbycountry') {
|
|||
print "\tvar container = document.getElementById('".$mode."');\n";
|
||||
print "\tvar geomap = new google.visualization.GeoMap(container);\n";
|
||||
print "\tgeomap.draw(data, options);\n";
|
||||
print "};\n";
|
||||
print "}\n";
|
||||
print "</script>\n";
|
||||
|
||||
// print the div tag that will contain the map
|
||||
|
|
|
|||
|
|
@ -241,7 +241,7 @@ $sql .= $hookmanager->resPrint;
|
|||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
/* The fast and low memory method to get and count full list converts the sql into a sql count */
|
||||
$sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
|
||||
$sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
|
||||
|
|
@ -647,7 +647,7 @@ while ($i < $imaxinloop) {
|
|||
$subscription->fk_bank = $accountstatic->getNomUrl(1);
|
||||
}
|
||||
// Output Kanban
|
||||
print $subscription->getKanbanView('');
|
||||
print $subscription->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
|
||||
if ($i == ($imaxinloop - 1)) {
|
||||
print '</div>';
|
||||
print '</td></tr>';
|
||||
|
|
|
|||
|
|
@ -342,7 +342,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
|
|||
}
|
||||
//output kanban
|
||||
$membertype->label = $objp->label;
|
||||
print $membertype->getKanbanView('');
|
||||
print $membertype->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
|
||||
if ($i == ($imaxinloop - 1)) {
|
||||
print '</div>';
|
||||
print '</td></tr>';
|
||||
|
|
@ -634,7 +634,7 @@ if ($rowid > 0) {
|
|||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
/* The fast and low memory method to get and count full list converts the sql into a sql count */
|
||||
$sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
|
||||
$sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
|
||||
|
|
|
|||
|
|
@ -404,7 +404,7 @@ print '<input type="hidden" name="token" value="'.newToken().'">';
|
|||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
print '<table class="noborder centpercent editmode">';
|
||||
print '<tr class="liste_titre"><th class="titlefieldcreate wordbreak">'.$langs->trans("CompanyInfo").'</th><th>'.$langs->trans("Value").'</th></tr>'."\n";
|
||||
print '<tr class="liste_titre"><th class="titlefieldcreate wordbreak">'.$langs->trans("CompanyInfo").'</th><th></th></tr>'."\n";
|
||||
|
||||
// Name
|
||||
print '<tr class="oddeven"><td class="fieldrequired wordbreak"><label for="name">'.$langs->trans("CompanyName").'</label></td><td>';
|
||||
|
|
@ -572,12 +572,14 @@ print '</td></tr>';
|
|||
|
||||
print '</table>';
|
||||
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
// IDs of the company (country-specific)
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent editmode">';
|
||||
print '<tr class="liste_titre"><td class="titlefieldcreate wordbreak">'.$langs->trans("CompanyIds").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
print '<tr class="liste_titre"><td class="titlefieldcreate wordbreak">'.$langs->trans("CompanyIds").'</td><td></td></tr>';
|
||||
|
||||
$langs->load("companies");
|
||||
|
||||
|
|
@ -688,7 +690,7 @@ print '</div>';
|
|||
print '<br>';
|
||||
print '<table class="noborder centpercent editmode">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="titlefieldcreate">'.$langs->trans("FiscalYearInformation").'</td><td>'.$langs->trans("Value").'</td>';
|
||||
print '<td class="titlefieldcreate">'.$langs->trans("FiscalYearInformation").'</td><td></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="oddeven"><td><label for="SOCIETE_FISCAL_MONTH_START">'.$langs->trans("FiscalMonthStart").'</label></td><td>';
|
||||
|
|
@ -703,7 +705,7 @@ print load_fiche_titre($langs->trans("TypeOfSaleTaxes"), '', 'object_payment');
|
|||
|
||||
print '<table class="noborder centpercent editmode">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="titlefieldcreate">'.$langs->trans("VATManagement").'</td><td>'.$langs->trans("Description").'</td>';
|
||||
print '<td class="titlefieldcreate">'.$langs->trans("VATManagement").'</td><td></td>';
|
||||
print '<td class="right"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
|
|
@ -733,7 +735,7 @@ print "</table>";
|
|||
print '<br>';
|
||||
print '<table class="noborder centpercent editmode">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="titlefieldcreate">'.$form->textwithpicto($langs->transcountry("LocalTax1Management", $mysoc->country_code), $langs->transcountry("LocalTax1IsUsedDesc", $mysoc->country_code)).'</td><td>'.$langs->trans("Description").'</td>';
|
||||
print '<td class="titlefieldcreate">'.$form->textwithpicto($langs->transcountry("LocalTax1Management", $mysoc->country_code), $langs->transcountry("LocalTax1IsUsedDesc", $mysoc->country_code)).'</td><td></td>';
|
||||
print '<td class="right"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
|
|
@ -777,7 +779,7 @@ print "</table>";
|
|||
print '<br>';
|
||||
print '<table class="noborder centpercent editmode">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="titlefieldcreate">'.$form->textwithpicto($langs->transcountry("LocalTax2Management", $mysoc->country_code), $langs->transcountry("LocalTax2IsUsedDesc", $mysoc->country_code)).'</td><td>'.$langs->trans("Description").'</td>';
|
||||
print '<td class="titlefieldcreate">'.$form->textwithpicto($langs->transcountry("LocalTax2Management", $mysoc->country_code), $langs->transcountry("LocalTax2IsUsedDesc", $mysoc->country_code)).'</td><td></td>';
|
||||
print '<td class="right"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
|
|
@ -821,7 +823,7 @@ print "</table>";
|
|||
print '<br>';
|
||||
print '<table class="noborder centpercent editmode">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$form->textwithpicto($langs->trans("RevenueStamp"), $langs->trans("RevenueStampDesc")).'</td><td>'.$langs->trans("Description").'</td>';
|
||||
print '<td>'.$form->textwithpicto($langs->trans("RevenueStamp"), $langs->trans("RevenueStampDesc")).'</td><td></td>';
|
||||
print '<td class="right"> </td>';
|
||||
print "</tr>\n";
|
||||
if ($mysoc->useRevenueStamp()) {
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ $hookmanager->initHooks(array('admin', 'dictionaryadmin'));
|
|||
// Put here declaration of dictionaries properties
|
||||
|
||||
// Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this.
|
||||
$taborder = array(9, 15, 30, 0, 4, 3, 2, 0, 1, 8, 19, 16, 39, 27, 40, 38, 0, 5, 11, 0, 6, 24, 0, 29, 0, 33, 34, 32, 28, 17, 35, 36, 0, 10, 23, 12, 13, 7, 0, 14, 0, 22, 20, 18, 21, 41, 0, 37, 42, 0, 43, 0, 25, 0, 44, 0);
|
||||
$taborder = array(9, 15, 30, 0, 4, 3, 2, 0, 1, 8, 19, 16, 39, 27, 40, 38, 0, 5, 11, 0, 6, 24, 0, 29, 0, 33, 34, 32, 28, 17, 35, 36, 0, 10, 31, 23, 12, 13, 7, 0, 14, 0, 22, 20, 18, 21, 41, 0, 37, 42, 0, 43, 0, 25, 0, 44, 0);
|
||||
|
||||
// Name of SQL tables of dictionaries
|
||||
$tabname = array();
|
||||
|
|
@ -135,7 +135,7 @@ $tabname[27] = "c_stcomm";
|
|||
$tabname[28] = "c_holiday_types";
|
||||
$tabname[29] = "c_lead_status";
|
||||
$tabname[30] = "c_format_cards";
|
||||
//$tabname[31]= "accounting_system";
|
||||
$tabname[31] = "c_invoice_subtype";
|
||||
$tabname[32] = "c_hrm_public_holiday";
|
||||
$tabname[33] = "c_hrm_department";
|
||||
$tabname[34] = "c_hrm_function";
|
||||
|
|
@ -182,7 +182,7 @@ $tablib[27] = "DictionaryProspectStatus";
|
|||
$tablib[28] = "DictionaryHolidayTypes";
|
||||
$tablib[29] = "DictionaryOpportunityStatus";
|
||||
$tablib[30] = "DictionaryFormatCards";
|
||||
//$tablib[31]= "DictionaryAccountancysystem";
|
||||
$tablib[31] = "DictionaryInvoiceSubtype";
|
||||
$tablib[32] = "DictionaryPublicHolidays";
|
||||
$tablib[33] = "DictionaryDepartment";
|
||||
$tablib[34] = "DictionaryFunction";
|
||||
|
|
@ -205,7 +205,7 @@ $tabsql[3] = "SELECT r.rowid as rowid, r.code_region as state_code, r.nom as lib
|
|||
$tabsql[4] = "SELECT c.rowid as rowid, c.code, c.label, c.active, c.favorite, c.eec FROM ".MAIN_DB_PREFIX."c_country AS c";
|
||||
$tabsql[5] = "SELECT c.rowid as rowid, c.code as code, c.label, c.active FROM ".MAIN_DB_PREFIX."c_civility AS c";
|
||||
$tabsql[6] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.type, a.active, a.module, a.color, a.position FROM ".MAIN_DB_PREFIX."c_actioncomm AS a";
|
||||
$tabsql[7] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.accountancy_code as accountancy_code, c.code as country_code, c.label as country, a.fk_pays as country_id, a.active FROM ".MAIN_DB_PREFIX."c_chargesociales AS a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_pays=c.rowid and c.active=1";
|
||||
$tabsql[7] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.accountancy_code as accountancy_code, c.code as country_code, c.label as country, a.fk_pays as country_id, a.active FROM ".MAIN_DB_PREFIX."c_chargesociales AS a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_pays = c.rowid and c.active = 1";
|
||||
$tabsql[8] = "SELECT t.id as rowid, t.code as code, t.libelle, t.fk_country as country_id, c.code as country_code, c.label as country, t.position, t.active FROM ".MAIN_DB_PREFIX."c_typent as t LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON t.fk_country=c.rowid";
|
||||
$tabsql[9] = "SELECT c.code_iso as code, c.label, c.unicode, c.active FROM ".MAIN_DB_PREFIX."c_currencies AS c";
|
||||
$tabsql[10] = "SELECT t.rowid, t.type_vat, t.code, t.taux, t.localtax1_type, t.localtax1, t.localtax2_type, t.localtax2, c.label as country, c.code as country_code, t.fk_pays as country_id, t.recuperableonly, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid";
|
||||
|
|
@ -229,7 +229,7 @@ $tabsql[27] = "SELECT id as rowid, code, libelle, picto, active FROM ".MAIN
|
|||
$tabsql[28] = "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newbymonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.block_if_negative, h.sortorder, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid";
|
||||
$tabsql[29] = "SELECT rowid as rowid, code, label, percent, position, active FROM ".MAIN_DB_PREFIX."c_lead_status";
|
||||
$tabsql[30] = "SELECT rowid, code, name, paper_size, orientation, metric, leftmargin, topmargin, nx, ny, spacex, spacey, width, height, font_size, custom_x, custom_y, active FROM ".MAIN_DB_PREFIX."c_format_cards";
|
||||
//$tabsql[31]= "SELECT s.rowid as rowid, pcg_version, s.label, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s";
|
||||
$tabsql[31] = "SELECT t.rowid, t.code, t.label, c.label as country, c.code as country_code, t.fk_country as country_id, t.active FROM ".MAIN_DB_PREFIX."c_invoice_subtype as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_country = c.rowid";
|
||||
$tabsql[32] = "SELECT a.id as rowid, a.entity, a.code, a.fk_country as country_id, c.code as country_code, c.label as country, a.dayrule, a.day, a.month, a.year, a.active FROM ".MAIN_DB_PREFIX."c_hrm_public_holiday as a LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON a.fk_country=c.rowid AND c.active=1";
|
||||
$tabsql[33] = "SELECT rowid, pos, code, label, active FROM ".MAIN_DB_PREFIX."c_hrm_department";
|
||||
$tabsql[34] = "SELECT rowid, pos, code, label, c_level, active FROM ".MAIN_DB_PREFIX."c_hrm_function";
|
||||
|
|
@ -276,7 +276,7 @@ $tabsqlsort[27] = "code ASC";
|
|||
$tabsqlsort[28] = "sortorder ASC, country ASC, code ASC";
|
||||
$tabsqlsort[29] = "position ASC";
|
||||
$tabsqlsort[30] = "code ASC";
|
||||
//$tabsqlsort[31]="pcg_version ASC";
|
||||
$tabsqlsort[31] = "country ASC, code ASC";
|
||||
$tabsqlsort[32] = "country, year ASC, month ASC, day ASC";
|
||||
$tabsqlsort[33] = "code ASC";
|
||||
$tabsqlsort[34] = "code ASC";
|
||||
|
|
@ -323,7 +323,7 @@ $tabfield[27] = "code,libelle,picto";
|
|||
$tabfield[28] = "code,label,affect,delay,newbymonth,country_id,country,block_if_negative,sortorder";
|
||||
$tabfield[29] = "code,label,percent,position";
|
||||
$tabfield[30] = "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
|
||||
//$tabfield[31]= "pcg_version,label";
|
||||
$tabfield[31] = "country_id,country,code,label";
|
||||
$tabfield[32] = "code,dayrule,year,month,day,country_id,country";
|
||||
$tabfield[33] = "code,label";
|
||||
$tabfield[34] = "code,label";
|
||||
|
|
@ -370,7 +370,7 @@ $tabfieldvalue[27] = "code,libelle,picto";
|
|||
$tabfieldvalue[28] = "code,label,affect,delay,newbymonth,country,block_if_negative,sortorder";
|
||||
$tabfieldvalue[29] = "code,label,percent,position";
|
||||
$tabfieldvalue[30] = "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
|
||||
//$tabfieldvalue[31]= "pcg_version,label";
|
||||
$tabfieldvalue[31] = "country,code,label";
|
||||
$tabfieldvalue[32] = "code,dayrule,day,month,year,country";
|
||||
$tabfieldvalue[33] = "code,label";
|
||||
$tabfieldvalue[34] = "code,label";
|
||||
|
|
@ -417,8 +417,7 @@ $tabfieldinsert[27] = "code,libelle,picto";
|
|||
$tabfieldinsert[28] = "code,label,affect,delay,newbymonth,fk_country,block_if_negative,sortorder";
|
||||
$tabfieldinsert[29] = "code,label,percent,position";
|
||||
$tabfieldinsert[30] = "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
|
||||
//$tabfieldinsert[31]= "pcg_version,label";
|
||||
//$tabfieldinsert[32]= "code,label,range_account,sens,category_type,formula,position,fk_country";
|
||||
$tabfieldinsert[31] = "fk_country,code,label";
|
||||
$tabfieldinsert[32] = "code,dayrule,day,month,year,fk_country";
|
||||
$tabfieldinsert[33] = "code,label";
|
||||
$tabfieldinsert[34] = "code,label";
|
||||
|
|
@ -467,7 +466,7 @@ $tabrowid[27] = "id";
|
|||
$tabrowid[28] = "";
|
||||
$tabrowid[29] = "";
|
||||
$tabrowid[30] = "";
|
||||
//$tabrowid[31]= "";
|
||||
$tabrowid[31]= "";
|
||||
$tabrowid[32] = "id";
|
||||
$tabrowid[33] = "rowid";
|
||||
$tabrowid[34] = "rowid";
|
||||
|
|
@ -514,7 +513,7 @@ $tabcond[27] = isModEnabled("societe");
|
|||
$tabcond[28] = isModEnabled('holiday');
|
||||
$tabcond[29] = isModEnabled('project');
|
||||
$tabcond[30] = (isModEnabled('label') || isModEnabled('barcode') || isModEnabled('adherent')); // stickers format dictionary
|
||||
//$tabcond[31]= isModEnabled('accounting');
|
||||
$tabcond[31] = ((isModEnabled('facture') || isModEnabled('supplier_invoice')) && $mysoc->country_code == 'GR');
|
||||
$tabcond[32] = (isModEnabled('holiday') || isModEnabled('hrm'));
|
||||
$tabcond[33] = isModEnabled('hrm');
|
||||
$tabcond[34] = isModEnabled('hrm');
|
||||
|
|
@ -576,6 +575,7 @@ $tabcomplete = array(
|
|||
'c_product_nature'=>array('picto'=>'product', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
|
||||
'c_productbatch_qcstatus'=>array('picto'=>'lot', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
|
||||
'c_asset_disposal_type'=>array('picto'=>'asset', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
|
||||
'c_invoice_subtype'=>array('picto'=>'bill', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
|
||||
);
|
||||
|
||||
|
||||
|
|
@ -721,7 +721,7 @@ if (empty($reshook)) {
|
|||
$ok = 1;
|
||||
foreach ($listfield as $f => $value) {
|
||||
// Discard check of mandatory fields for country for some tables
|
||||
if ($value == 'country_id' && in_array($tablib[$id], array('DictionaryPublicHolidays', 'DictionaryVAT', 'DictionaryRegion', 'DictionaryCompanyType', 'DictionaryHolidayTypes', 'DictionaryRevenueStamp', 'DictionaryAccountancysystem', 'DictionaryAccountancyCategory'))) {
|
||||
if ($value == 'country_id' && in_array($tablib[$id], array('DictionaryPublicHolidays', 'DictionaryVAT', 'DictionaryInvoiceSubtype', 'DictionaryRegion', 'DictionaryCompanyType', 'DictionaryHolidayTypes', 'DictionaryRevenueStamp', 'DictionaryAccountancysystem', 'DictionaryAccountancyCategory'))) {
|
||||
continue; // For some pages, country is not mandatory
|
||||
}
|
||||
if ($value == 'country' && in_array($tablib[$id], array('DictionaryPublicHolidays', 'DictionaryCanton', 'DictionaryCompanyType', 'DictionaryHolidayTypes', 'DictionaryRevenueStamp'))) {
|
||||
|
|
@ -1208,7 +1208,7 @@ if ($search_country_id > 0) {
|
|||
$param .= '&search_country_id='.urlencode($search_country_id);
|
||||
}
|
||||
if ($search_code != '') {
|
||||
$param .= '&search_code='.urlencode($search_country_id);
|
||||
$param .= '&search_code='.urlencode($search_code);
|
||||
}
|
||||
if ($entity != '') {
|
||||
$param .= '&entity='.(int) $entity;
|
||||
|
|
@ -1590,7 +1590,9 @@ if ($id > 0) {
|
|||
}
|
||||
print '<td colspan="3" class="center">';
|
||||
if ($action != 'edit') {
|
||||
print '<input type="submit" class="button button-add" name="actionadd" value="'.$langs->trans("Add").'">';
|
||||
print '<input type="submit" class="button button-add small" name="actionadd" value="'.$langs->trans("Add").'">';
|
||||
} else {
|
||||
print '<input type="submit" class="button button-add small disabled" name="actionadd" value="'.$langs->trans("Add").'">';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
|
|
@ -1624,13 +1626,44 @@ if ($id > 0) {
|
|||
print '<div class="clearboth"></div>';
|
||||
}
|
||||
|
||||
$filterfound = 0;
|
||||
foreach ($fieldlist as $field => $value) {
|
||||
if ($value == 'entity') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$showfield = 1; // By default
|
||||
if ($value == 'region_id' || $value == 'country_id') {
|
||||
$showfield = 0;
|
||||
}
|
||||
|
||||
if ($showfield) {
|
||||
if ($value == 'country') {
|
||||
$filterfound++;
|
||||
} elseif ($value == 'code') {
|
||||
$filterfound++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
// Title line with search input fields
|
||||
print '<!-- line title to search record -->'."\n";
|
||||
print '<tr class="liste_titre_filter">';
|
||||
$filterfound = 0;
|
||||
|
||||
// Action button
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td class="liste_titre center">';
|
||||
if ($filterfound) {
|
||||
$searchpicto = $form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpicto;
|
||||
}
|
||||
print '</td>';
|
||||
$colspan++;
|
||||
}
|
||||
|
||||
$colspan = 0;
|
||||
foreach ($fieldlist as $field => $value) {
|
||||
if ($value == 'entity') {
|
||||
|
|
@ -1638,7 +1671,6 @@ if ($id > 0) {
|
|||
}
|
||||
|
||||
$showfield = 1; // By default
|
||||
|
||||
if ($value == 'region_id' || $value == 'country_id') {
|
||||
$showfield = 0;
|
||||
}
|
||||
|
|
@ -1648,13 +1680,11 @@ if ($id > 0) {
|
|||
print '<td class="liste_titre">';
|
||||
print $form->select_country($search_country_id, 'search_country_id', '', 28, 'minwidth100 maxwidth150 maxwidthonsmartphone');
|
||||
print '</td>';
|
||||
$filterfound++;
|
||||
$colspan++;
|
||||
} elseif ($value == 'code') {
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="maxwidth100" name="search_code" value="'.dol_escape_htmltag($search_code).'">';
|
||||
print '</td>';
|
||||
$filterfound++;
|
||||
$colspan++;
|
||||
} else {
|
||||
print '<td class="liste_titre">';
|
||||
|
|
@ -1669,20 +1699,32 @@ if ($id > 0) {
|
|||
print '<td></td>';
|
||||
$colspan++;
|
||||
}
|
||||
|
||||
print '<td class="liste_titre"></td>';
|
||||
$colspan++;
|
||||
print '<td class="liste_titre right" colspan="2">';
|
||||
if ($filterfound) {
|
||||
$searchpicto = $form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpicto;
|
||||
|
||||
// Action button
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td class="liste_titre center">';
|
||||
if ($filterfound) {
|
||||
$searchpicto = $form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpicto;
|
||||
}
|
||||
print '</td>';
|
||||
$colspan++;
|
||||
}
|
||||
print '</td>';
|
||||
$colspan+=2;
|
||||
|
||||
print '</tr>';
|
||||
|
||||
// Title of lines
|
||||
print '<!-- line title of record -->'."\n";
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
// Action button
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print getTitleFieldOfList('');
|
||||
}
|
||||
|
||||
foreach ($fieldlist as $field => $value) {
|
||||
if ($value == 'entity') {
|
||||
continue;
|
||||
|
|
@ -1917,9 +1959,13 @@ if ($id > 0) {
|
|||
print getTitleFieldOfList($langs->trans("Favorite"), 0, $_SERVER["PHP_SELF"], "favorite", ($page ? 'page='.$page.'&' : ''), $param, 'align="center"', $sortfield, $sortorder);
|
||||
}
|
||||
|
||||
// Status
|
||||
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page ? 'page='.$page.'&' : ''), $param, 'align="center"', $sortfield, $sortorder);
|
||||
print getTitleFieldOfList('');
|
||||
print getTitleFieldOfList('');
|
||||
|
||||
// Action button
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print getTitleFieldOfList('');
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
if ($num) {
|
||||
|
|
@ -1927,9 +1973,76 @@ if ($id > 0) {
|
|||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
// Can an entry be erased or disabled ?
|
||||
// all true by default
|
||||
$iserasable = 1;
|
||||
$canbedisabled = 1;
|
||||
$canbemodified = 1;
|
||||
if (isset($obj->code) && $id != 10 && $id != 42) {
|
||||
if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i', $obj->code))) {
|
||||
$iserasable = 0; $canbedisabled = 0;
|
||||
} elseif ($obj->code == 'RECEP') {
|
||||
$iserasable = 0; $canbedisabled = 0;
|
||||
} elseif ($obj->code == 'EF0') {
|
||||
$iserasable = 0; $canbedisabled = 0;
|
||||
}
|
||||
}
|
||||
if ($id == 25 && in_array($obj->code, array('banner', 'blogpost', 'other', 'page'))) {
|
||||
$iserasable = 0; $canbedisabled = 0;
|
||||
if (in_array($obj->code, array('banner'))) {
|
||||
$canbedisabled = 1;
|
||||
}
|
||||
}
|
||||
if (isset($obj->type) && in_array($obj->type, array('system', 'systemauto'))) {
|
||||
$iserasable = 0;
|
||||
}
|
||||
if (in_array(empty($obj->code) ? '' : $obj->code, array('AC_OTH', 'AC_OTH_AUTO')) || in_array(empty($obj->type) ? '' : $obj->type, array('systemauto'))) {
|
||||
$canbedisabled = 0; $canbedisabled = 0;
|
||||
}
|
||||
$canbemodified = $iserasable;
|
||||
|
||||
if (!empty($obj->code) && $obj->code == 'RECEP') {
|
||||
$canbemodified = 1;
|
||||
}
|
||||
if ($tabname[$id] == "c_actioncomm") {
|
||||
$canbemodified = 1;
|
||||
}
|
||||
|
||||
// Build Url. The table is id=, the id of line is rowid=
|
||||
$rowidcol = $tabrowid[$id];
|
||||
// If rowidcol not defined
|
||||
if (empty($rowidcol) || in_array($id, array(6, 7, 8, 13, 17, 19, 27, 32))) {
|
||||
$rowidcol = 'rowid';
|
||||
}
|
||||
$url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(isset($obj->{$rowidcol}) ? $obj->{$rowidcol} : (!empty($obj->code) ? urlencode($obj->code) : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : '');
|
||||
if (!empty($param)) {
|
||||
$url .= '&'.$param;
|
||||
}
|
||||
if (!is_null($withentity)) {
|
||||
$url .= '&entity='.$withentity;
|
||||
}
|
||||
$url .= '&';
|
||||
|
||||
|
||||
//print_r($obj);
|
||||
print '<tr class="oddeven" id="rowid-'.(empty($obj->rowid) ? '' : $obj->rowid).'">';
|
||||
|
||||
// Action button
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td class="center maxwidthsearch nowraponall">';
|
||||
// Modify link
|
||||
if ($canbemodified) {
|
||||
print '<a class="reposition editfielda marginleftonly paddingleft marginrightonly paddingright" href="'.$url.'action=edit&token='.newToken().'">'.img_edit().'</a>';
|
||||
}
|
||||
// Delete link
|
||||
if ($iserasable) {
|
||||
if ($user->admin) {
|
||||
print '<a class="reposition marginleftonly paddingleft marginrightonly paddingright" href="'.$url.'action=delete&token='.newToken().'">'.img_delete().'</a>';
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
if ($action == 'edit' && ($rowid == (!empty($obj->rowid) ? $obj->rowid : $obj->code))) {
|
||||
$tmpaction = 'edit';
|
||||
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
|
|
@ -2171,56 +2284,6 @@ if ($id > 0) {
|
|||
}
|
||||
}
|
||||
|
||||
// Can an entry be erased or disabled ?
|
||||
// all true by default
|
||||
$iserasable = 1;
|
||||
$canbedisabled = 1;
|
||||
$canbemodified = 1;
|
||||
if (isset($obj->code) && $id != 10 && $id != 42) {
|
||||
if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i', $obj->code))) {
|
||||
$iserasable = 0; $canbedisabled = 0;
|
||||
} elseif ($obj->code == 'RECEP') {
|
||||
$iserasable = 0; $canbedisabled = 0;
|
||||
} elseif ($obj->code == 'EF0') {
|
||||
$iserasable = 0; $canbedisabled = 0;
|
||||
}
|
||||
}
|
||||
if ($id == 25 && in_array($obj->code, array('banner', 'blogpost', 'other', 'page'))) {
|
||||
$iserasable = 0; $canbedisabled = 0;
|
||||
if (in_array($obj->code, array('banner'))) {
|
||||
$canbedisabled = 1;
|
||||
}
|
||||
}
|
||||
if (isset($obj->type) && in_array($obj->type, array('system', 'systemauto'))) {
|
||||
$iserasable = 0;
|
||||
}
|
||||
if (in_array(empty($obj->code) ? '' : $obj->code, array('AC_OTH', 'AC_OTH_AUTO')) || in_array(empty($obj->type) ? '' : $obj->type, array('systemauto'))) {
|
||||
$canbedisabled = 0; $canbedisabled = 0;
|
||||
}
|
||||
$canbemodified = $iserasable;
|
||||
|
||||
if (!empty($obj->code) && $obj->code == 'RECEP') {
|
||||
$canbemodified = 1;
|
||||
}
|
||||
if ($tabname[$id] == "c_actioncomm") {
|
||||
$canbemodified = 1;
|
||||
}
|
||||
|
||||
// Build Url. The table is id=, the id of line is rowid=
|
||||
$rowidcol = $tabrowid[$id];
|
||||
// If rowidcol not defined
|
||||
if (empty($rowidcol) || in_array($id, array(6, 7, 8, 13, 17, 19, 27, 32))) {
|
||||
$rowidcol = 'rowid';
|
||||
}
|
||||
$url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(isset($obj->{$rowidcol}) ? $obj->{$rowidcol} : (!empty($obj->code) ? urlencode($obj->code) : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : '');
|
||||
if (!empty($param)) {
|
||||
$url .= '&'.$param;
|
||||
}
|
||||
if (!is_null($withentity)) {
|
||||
$url .= '&entity='.$withentity;
|
||||
}
|
||||
$url .= '&';
|
||||
|
||||
// Favorite & EEC
|
||||
// Only activated on country dictionary
|
||||
if ($id == 4) {
|
||||
|
|
@ -2259,23 +2322,20 @@ if ($id > 0) {
|
|||
}
|
||||
print "</td>";
|
||||
|
||||
// Modify link
|
||||
if ($canbemodified) {
|
||||
print '<td align="center"><a class="reposition editfielda" href="'.$url.'action=edit&token='.newToken().'">'.img_edit().'</a></td>';
|
||||
} else {
|
||||
print '<td> </td>';
|
||||
}
|
||||
|
||||
// Delete link
|
||||
if ($iserasable) {
|
||||
print '<td class="center">';
|
||||
if ($user->admin) {
|
||||
print '<a class="reposition" href="'.$url.'action=delete&token='.newToken().'">'.img_delete().'</a>';
|
||||
// Action button
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td class="center maxwidthsearch">';
|
||||
// Modify link
|
||||
if ($canbemodified) {
|
||||
print '<a class="reposition marginleftonly paddingleft marginrightonly paddingright editfielda" href="'.$url.'action=edit&token='.newToken().'">'.img_edit().'</a>';
|
||||
}
|
||||
// Delete link
|
||||
if ($iserasable) {
|
||||
if ($user->admin) {
|
||||
print '<a class="reposition marginleftonly paddingleft marginrightonly paddingright" href="'.$url.'action=delete&token='.newToken().'">'.img_delete().'</a>';
|
||||
}
|
||||
}
|
||||
//else print '<a href="#">'.img_delete().'</a>'; // Some dictionary can be edited by other profile than admin
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td> </td>';
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ if (GETPOST('addfilter', 'alpha')) {
|
|||
if ($result > 0) {
|
||||
$object->fetchFilters();
|
||||
} else {
|
||||
setEventMessages($emailcollectorfilter->errors, $emailcollectorfilter->error, 'errors');
|
||||
setEventMessages($emailcollectorfilter->error, $emailcollectorfilter->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -161,7 +161,7 @@ if ($action == 'deletefilter') {
|
|||
if ($result > 0) {
|
||||
$object->fetchFilters();
|
||||
} else {
|
||||
setEventMessages($emailcollectorfilter->errors, $emailcollectorfilter->error, 'errors');
|
||||
setEventMessages($emailcollectorfilter->error, $emailcollectorfilter->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -192,7 +192,7 @@ if (GETPOST('addoperation', 'alpha')) {
|
|||
$object->fetchActions();
|
||||
} else {
|
||||
$error++;
|
||||
setEventMessages($emailcollectoroperation->errors, $emailcollectoroperation->error, 'errors');
|
||||
setEventMessages($emailcollectoroperation->error, $emailcollectoroperation->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -216,7 +216,7 @@ if ($action == 'updateoperation') {
|
|||
$object->fetchActions();
|
||||
} else {
|
||||
$error++;
|
||||
setEventMessages($emailcollectoroperation->errors, $emailcollectoroperation->error, 'errors');
|
||||
setEventMessages($emailcollectoroperation->error, $emailcollectoroperation->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -228,7 +228,7 @@ if ($action == 'deleteoperation') {
|
|||
if ($result > 0) {
|
||||
$object->fetchActions();
|
||||
} else {
|
||||
setEventMessages($emailcollectoroperation->errors, $emailcollectoroperation->error, 'errors');
|
||||
setEventMessages($emailcollectoroperation->error, $emailcollectoroperation->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -242,7 +242,7 @@ if ($action == 'collecttest') {
|
|||
setEventMessages($object->lastresult, null, 'mesgs');
|
||||
} else {
|
||||
$debuginfo = $object->debuginfo;
|
||||
setEventMessages($object->error, null, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
$action = '';
|
||||
|
|
@ -257,7 +257,7 @@ if ($action == 'confirm_collect') {
|
|||
setEventMessages($object->lastresult, null, 'mesgs');
|
||||
} else {
|
||||
$debuginfo = $object->debuginfo;
|
||||
setEventMessages($object->error, null, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
$action = '';
|
||||
|
|
|
|||
|
|
@ -275,7 +275,7 @@ $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $objec
|
|||
$sql .= $hookmanager->resPrint;
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
$resql = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($resql);
|
||||
|
||||
|
|
@ -555,7 +555,7 @@ while ($i < $imaxinloop) {
|
|||
print '<div class="box-flex-container kanban">';
|
||||
}
|
||||
// Output Kanban
|
||||
print $object->getKanbanView('');
|
||||
print $object->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
|
||||
if ($i == ($imaxinloop - 1)) {
|
||||
print '</div>';
|
||||
print '</td></tr>';
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ foreach ($rangesbycateg as $fk_c_exp_tax_cat => $Tab) {
|
|||
if ($range->range_active == 1) {
|
||||
if ($action == 'edit' && $range->ik->id == $id && $range->rowid == $fk_range && $range->fk_c_exp_tax_cat == $fk_c_exp_tax_cat) {
|
||||
echo '<input id="" class="button button-save" name="save" value="'.$langs->trans("Save").'" type="submit" />';
|
||||
echo '<input class="button button-cancel" value="'.$langs->trans("Cancel").'" onclick="javascript:history.go(-1)" type="button" />';
|
||||
echo '<input class="button button-cancel" value="'.$langs->trans("Cancel").'" onclick="history.go(-1)" type="button" />';
|
||||
} else {
|
||||
echo '<a class="editfielda marginrightonly paddingleft paddingright" href="'.$_SERVER['PHP_SELF'].'?action=edit&token='.newToken().'&id='.$range->ik->id.'&fk_c_exp_tax_cat='.$range->fk_c_exp_tax_cat.'&fk_range='.$range->rowid.'">'.img_edit().'</a>';
|
||||
if (!empty($range->ik->id)) {
|
||||
|
|
|
|||
|
|
@ -298,7 +298,7 @@ $sql .= $db->order($sortfield, $sortorder);
|
|||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
$resql = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($resql);
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0
|
||||
|
|
|
|||
|
|
@ -463,10 +463,10 @@ if (empty($reshook)) {
|
|||
$_POST['joinfiles'] = GETPOST('joinfiles-'.$rowid);
|
||||
}
|
||||
if ($field == 'content') {
|
||||
$_POST['content'] = GETPOST('content-'.$rowid);
|
||||
$_POST['content'] = GETPOST('content-'.$rowid, 'restricthtml');
|
||||
}
|
||||
if ($field == 'content_lines') {
|
||||
$_POST['content_lines'] = GETPOST('content_lines-'.$rowid);
|
||||
$_POST['content_lines'] = GETPOST('content_lines-'.$rowid, 'restricthtml');
|
||||
}
|
||||
|
||||
if ($i) {
|
||||
|
|
@ -494,7 +494,7 @@ if (empty($reshook)) {
|
|||
$i++;
|
||||
}
|
||||
|
||||
$sql .= " WHERE ".$rowidcol." = ".((int) $rowid);
|
||||
$sql .= " WHERE ".$db->escape($rowidcol)." = ".((int) $rowid);
|
||||
if (!$user->admin) { // A non admin user can only edit its own template
|
||||
$sql .= " AND fk_user = ".((int) $user->id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,10 +127,10 @@ foreach ($modulesdir as $dir) {
|
|||
|
||||
// We discard modules according to features level (PS: if module is activated we always show it)
|
||||
$const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i', '', get_class($objMod)));
|
||||
if ($objMod->version == 'development' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 2))) {
|
||||
if ($objMod->version == 'development' && (empty($conf->global->$const_name) && (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2))) {
|
||||
$modulequalified = 0;
|
||||
}
|
||||
if ($objMod->version == 'experimental' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 1))) {
|
||||
if ($objMod->version == 'experimental' && (empty($conf->global->$const_name) && (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1))) {
|
||||
$modulequalified = 0;
|
||||
}
|
||||
if (preg_match('/deprecated/', $objMod->version) && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL >= 0))) {
|
||||
|
|
|
|||
|
|
@ -396,10 +396,10 @@ foreach ($modulesdir as $dir) {
|
|||
|
||||
// We discard modules according to features level (PS: if module is activated we always show it)
|
||||
$const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i', '', get_class($objMod)));
|
||||
if ($objMod->version == 'development' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 2))) {
|
||||
if ($objMod->version == 'development' && (empty($conf->global->$const_name) && (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2))) {
|
||||
$modulequalified = 0;
|
||||
}
|
||||
if ($objMod->version == 'experimental' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 1))) {
|
||||
if ($objMod->version == 'experimental' && (empty($conf->global->$const_name) && (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1))) {
|
||||
$modulequalified = 0;
|
||||
}
|
||||
if (preg_match('/deprecated/', $objMod->version) && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL >= 0))) {
|
||||
|
|
@ -598,7 +598,7 @@ if ($mode == 'common' || $mode == 'commonkanban') {
|
|||
|
||||
if (getDolGlobalInt('MAIN_FEATURES_LEVEL')) {
|
||||
$array_version = array('stable'=>$langs->transnoentitiesnoconv("Stable"));
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL < 0) {
|
||||
if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 0) {
|
||||
$array_version['deprecated'] = $langs->trans("Deprecated");
|
||||
}
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 0) {
|
||||
|
|
|
|||
|
|
@ -143,6 +143,15 @@ if ($action == 'add_currency') {
|
|||
}
|
||||
|
||||
|
||||
$TAvailableCurrency = array();
|
||||
$sql = "SELECT code_iso, label, unicode, active FROM ".MAIN_DB_PREFIX."c_currencies";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
while ($obj = $db->fetch_object($resql)) {
|
||||
$TAvailableCurrency[$obj->code_iso] = array('code'=>$obj->code_iso, 'active'=>$obj->active);
|
||||
}
|
||||
}
|
||||
|
||||
$TCurrency = array();
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."multicurrency WHERE entity = ".((int) $conf->entity);
|
||||
$resql = $db->query($sql);
|
||||
|
|
@ -319,10 +328,15 @@ print '</tr>';
|
|||
|
||||
print '</form>';
|
||||
|
||||
// Main currency
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$conf->currency;
|
||||
print ' ('.$langs->getCurrencySymbol($conf->currency).')';
|
||||
print $form->textwithpicto(' ', $langs->trans("BaseCurrency")).'</td>';
|
||||
print $form->textwithpicto(' ', $langs->trans("BaseCurrency"));
|
||||
if (!empty($TAvailableCurrency[$conf->currency]) && empty($TAvailableCurrency[$conf->currency]['active'])) {
|
||||
print img_warning('Warning: This code has been disabled into Home - Setup - Dictionaries - Currencies');
|
||||
}
|
||||
print '</td>';
|
||||
print '<td class="right">1</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
|
@ -332,7 +346,11 @@ foreach ($TCurrency as &$currency) {
|
|||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$currency->code.' - '.$currency->name.'</td>';
|
||||
print '<td>'.$currency->code.' - '.$currency->name;
|
||||
if (!empty($TAvailableCurrency[$currency->code]) && empty($TAvailableCurrency[$currency->code]['active'])) {
|
||||
print img_warning('Warning: The code '.$currency->code.' has been disabled into Home - Setup - Dictionaries - Currencies');
|
||||
}
|
||||
print '</td>';
|
||||
print '<td class="right">';
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@ print '</td></tr>';
|
|||
//USTRD
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("USTRD").'</td>';
|
||||
print '<td>';
|
||||
print '<input type="text" name="PRELEVEMENT_USTRD" value="'.$conf->global->PRELEVEMENT_USTRD.'" class="width100"></td>';
|
||||
print '<input type="text" name="CREDITTRANSFER_USTRD" value="'.$conf->global->CREDITTRANSFER_USTRD.'" class="width100"></td>';
|
||||
print '</td></tr>';
|
||||
*/
|
||||
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ class DolibarrApi
|
|||
*
|
||||
* @param string $field Field name
|
||||
* @param string $value Value to check/clean
|
||||
* @param stdClass $object Object
|
||||
* @param Object $object Object
|
||||
* @return string Value cleaned
|
||||
*/
|
||||
protected function _checkValForAPI($field, $value, $object)
|
||||
|
|
@ -278,7 +278,6 @@ class DolibarrApi
|
|||
* @param string $dbt_keyfield Field name for socid foreign key if not fk_soc. Not used if objectid is null (optional)
|
||||
* @param string $dbt_select Field name for select if not rowid. Not used if objectid is null (optional)
|
||||
* @return bool
|
||||
* @throws RestException
|
||||
*/
|
||||
protected static function _checkAccessToResource($resource, $resource_id = 0, $dbtablename = '', $feature2 = '', $dbt_keyfield = 'fk_soc', $dbt_select = 'rowid')
|
||||
{
|
||||
|
|
|
|||
|
|
@ -30,11 +30,11 @@ require_once DOL_DOCUMENT_ROOT.'/includes/restler/framework/Luracast/Restler/iUs
|
|||
require_once DOL_DOCUMENT_ROOT.'/includes/restler/framework/Luracast/Restler/Resources.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/restler/framework/Luracast/Restler/Defaults.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/restler/framework/Luracast/Restler/RestException.php';
|
||||
use \Luracast\Restler\iAuthenticate;
|
||||
use \Luracast\Restler\iUseAuthentication;
|
||||
use \Luracast\Restler\Resources;
|
||||
use \Luracast\Restler\Defaults;
|
||||
use \Luracast\Restler\RestException;
|
||||
use Luracast\Restler\iAuthenticate;
|
||||
use Luracast\Restler\iUseAuthentication;
|
||||
use Luracast\Restler\Resources;
|
||||
use Luracast\Restler\Defaults;
|
||||
use Luracast\Restler\RestException;
|
||||
|
||||
/**
|
||||
* Dolibarr API access class
|
||||
|
|
|
|||
|
|
@ -544,7 +544,7 @@ if ($action == 'edit') {
|
|||
print '<datalist id="pcg_type_datalist">';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountancysystem.class.php';
|
||||
$accountsystem = new AccountancySystem($db);
|
||||
$accountsystem->fetch($conf->global->CHARTOFACCOUNTS);
|
||||
$accountsystem->fetch(getDolGlobalInt('CHARTOFACCOUNTS'));
|
||||
$sql = 'SELECT DISTINCT pcg_type FROM ' . MAIN_DB_PREFIX . 'accounting_account';
|
||||
$sql .= " WHERE fk_pcg_version = '" . $db->escape($accountsystem->ref) . "'";
|
||||
$sql .= ' AND entity in ('.getEntity('accounting_account', 0).')'; // Always limit to current entity. No sharing in accountancy.
|
||||
|
|
@ -645,7 +645,7 @@ if ($action == 'edit') {
|
|||
print getDolGlobalString($constname);
|
||||
}
|
||||
} else {
|
||||
print $conf->global->{$constname};
|
||||
print getDolGlobalString($constname);
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ class AssetAccountancyCodes extends CommonObject
|
|||
public function updateAccountancyCodes($user, $asset_id = 0, $asset_model_id = 0, $notrigger = 0)
|
||||
{
|
||||
global $langs, $hookmanager;
|
||||
dol_syslog(__METHOD__ . " user_id={$user->id}, asset_id=$asset_id, asset_model_id=$asset_model_id, notrigger=$notrigger");
|
||||
dol_syslog(__METHOD__ . " user_id=".$user->id.", asset_id=".$asset_id.", asset_model_id=".$asset_model_id.", notrigger=".$notrigger);
|
||||
|
||||
$error = 0;
|
||||
$this->errors = array();
|
||||
|
|
|
|||
|
|
@ -418,7 +418,7 @@ class AssetDepreciationOptions extends CommonObject
|
|||
public function updateDeprecationOptions($user, $asset_id = 0, $asset_model_id = 0, $notrigger = 0)
|
||||
{
|
||||
global $langs, $hookmanager;
|
||||
dol_syslog(__METHOD__ . " user_id={$user->id}, asset_id=$asset_id, asset_model_id=$asset_model_id, notrigger=$notrigger");
|
||||
dol_syslog(__METHOD__ . " user_id=".$user->id.", asset_id=".$asset_id.", asset_model_id=".$asset_model_id.", notrigger=".$notrigger);
|
||||
|
||||
$error = 0;
|
||||
$this->errors = array();
|
||||
|
|
|
|||
|
|
@ -299,7 +299,7 @@ $sql .= !empty($hookmanager->resPrint) ? (" HAVING 1=1 " . $hookmanager->resPrin
|
|||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
/* The fast and low memory method to get and count full list converts the sql into a sql count */
|
||||
$sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
|
||||
$sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
|
||||
|
|
|
|||
|
|
@ -301,7 +301,7 @@ $sql .= !empty($hookmanager->resPrint) ? (" HAVING 1=1 " . $hookmanager->resPrin
|
|||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
/* This old and fast method to get and count full list returns all record so use a high amount of memory.
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@ if (!empty($number)) {
|
|||
} else {
|
||||
$txt = "Call Asterisk dialer for caller: ".$caller.", called: ".$called." clicktodiallogin: ".$login;
|
||||
dol_syslog($txt);
|
||||
print '<body onload="javascript:history.go(-1);">'."\n";
|
||||
print '<body onload="history.go(-1);">'."\n";
|
||||
print '<!-- '.$txt.' -->';
|
||||
fputs($oSocket, "Action: login\r\n");
|
||||
fputs($oSocket, "Events: off\r\n");
|
||||
|
|
|
|||
|
|
@ -170,6 +170,13 @@ if (empty($reshook)) {
|
|||
$disable_stock_change = GETPOST('disable_stock_change', 'int');
|
||||
$efficiency = price2num(GETPOST('efficiency', 'alpha'));
|
||||
$fk_unit = GETPOST('fk_unit', 'alphanohtml');
|
||||
|
||||
if (!empty($idprod) && $conf->workstation->enabled) {
|
||||
$product = new Product($db);
|
||||
$res = $product->fetch($idprod);
|
||||
if ($res > 0 && $product->type == Product::TYPE_SERVICE) $fk_default_workstation = $product->fk_default_workstation;
|
||||
}
|
||||
|
||||
if ($qty == '') {
|
||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), null, 'errors');
|
||||
$error++;
|
||||
|
|
@ -206,7 +213,7 @@ if (empty($reshook)) {
|
|||
}
|
||||
}
|
||||
|
||||
$result = $object->addLine($idprod, $qty, $qty_frozen, $disable_stock_change, $efficiency, -1, $bom_child_id, null, $fk_unit, $array_options);
|
||||
$result = $object->addLine($idprod, $qty, $qty_frozen, $disable_stock_change, $efficiency, -1, $bom_child_id, null, $fk_unit, $array_options, $fk_default_workstation);
|
||||
|
||||
if ($result <= 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
|
|
@ -566,7 +573,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||
|
||||
if (!empty($object->table_element_line)) {
|
||||
// Products
|
||||
$res = $object->fetchLinesbytypeproduct(0);
|
||||
$res = $object->fetchLinesbytypeproduct(0); // Load all lines products into ->lines
|
||||
$object->calculateCosts();
|
||||
|
||||
print ($res == 0 && $object->status >= $object::STATUS_VALIDATED) ? '' : load_fiche_titre($langs->trans('BOMProductsList'), '', 'product');
|
||||
|
|
@ -615,7 +622,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||
|
||||
// Services
|
||||
$filtertype = 1;
|
||||
$res = $object->fetchLinesbytypeproduct(1);
|
||||
$res = $object->fetchLinesbytypeproduct(1); // Load all lines services into ->lines
|
||||
$object->calculateCosts();
|
||||
|
||||
print ($res == 0 && $object->status >= $object::STATUS_VALIDATED) ? '' : load_fiche_titre($langs->trans('BOMServicesList'), '', 'service');
|
||||
|
|
|
|||
|
|
@ -385,7 +385,7 @@ $sql=preg_replace('/,\s*$/','', $sql);
|
|||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
/* The fast and low memory method to get and count full list converts the sql into a sql count */
|
||||
$sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
|
||||
$sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
|
||||
|
|
@ -688,7 +688,7 @@ while ($i < $imaxinloop) {
|
|||
print '<div class="box-flex-container kanban">';
|
||||
}
|
||||
// Output kanban
|
||||
print $object->getKanbanView('');
|
||||
print $object->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
|
||||
if ($i == ($imaxinloop - 1)) {
|
||||
print '</div>';
|
||||
print '</td></tr>';
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ class Boms extends DolibarrApi
|
|||
if ($restrictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) {
|
||||
$sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$tmpobject->table_element." as t";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$tmpobject->table_element." AS t LEFT JOIN ".MAIN_DB_PREFIX.$tmpobject->table_element."_extrafields AS ef ON (ef.fk_object = t.rowid)"; // Modification VMR Global Solutions to include extrafields as search parameters in the API GET call, so we will be able to filter on extrafields
|
||||
|
||||
if ($restrictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
||||
|
|
|
|||
|
|
@ -227,7 +227,6 @@ class BOM extends CommonObject
|
|||
public $unit_cost = 0;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
|
|
@ -569,10 +568,11 @@ class BOM extends CommonObject
|
|||
* @param int $fk_bom_child Id of BOM Child
|
||||
* @param string $import_key Import Key
|
||||
* @param string $fk_unit Unit
|
||||
* @param array $array_options extrafields array
|
||||
* @param array $array_options extrafields array
|
||||
* @param int $fk_default_workstation Default workstation
|
||||
* @return int <0 if KO, Id of created object if OK
|
||||
*/
|
||||
public function addLine($fk_product, $qty, $qty_frozen = 0, $disable_stock_change = 0, $efficiency = 1.0, $position = -1, $fk_bom_child = null, $import_key = null, $fk_unit = '', $array_options = 0)
|
||||
public function addLine($fk_product, $qty, $qty_frozen = 0, $disable_stock_change = 0, $efficiency = 1.0, $position = -1, $fk_bom_child = null, $import_key = null, $fk_unit = '', $array_options = 0, $fk_default_workstation = null)
|
||||
{
|
||||
global $mysoc, $conf, $langs, $user;
|
||||
|
||||
|
|
@ -627,33 +627,34 @@ class BOM extends CommonObject
|
|||
}
|
||||
|
||||
// Insert line
|
||||
$this->line = new BOMLine($this->db);
|
||||
$line = new BOMLine($this->db);
|
||||
|
||||
$this->line->context = $this->context;
|
||||
$line->context = $this->context;
|
||||
|
||||
$this->line->fk_bom = $this->id;
|
||||
$this->line->fk_product = $fk_product;
|
||||
$this->line->qty = $qty;
|
||||
$this->line->qty_frozen = $qty_frozen;
|
||||
$this->line->disable_stock_change = $disable_stock_change;
|
||||
$this->line->efficiency = $efficiency;
|
||||
$this->line->fk_bom_child = $fk_bom_child;
|
||||
$this->line->import_key = $import_key;
|
||||
$this->line->position = $rankToUse;
|
||||
$this->line->fk_unit = $fk_unit;
|
||||
$line->fk_bom = $this->id;
|
||||
$line->fk_product = $fk_product;
|
||||
$line->qty = $qty;
|
||||
$line->qty_frozen = $qty_frozen;
|
||||
$line->disable_stock_change = $disable_stock_change;
|
||||
$line->efficiency = $efficiency;
|
||||
$line->fk_bom_child = $fk_bom_child;
|
||||
$line->import_key = $import_key;
|
||||
$line->position = $rankToUse;
|
||||
$line->fk_unit = $fk_unit;
|
||||
$line->fk_default_workstation = $fk_default_workstation;
|
||||
|
||||
if (is_array($array_options) && count($array_options) > 0) {
|
||||
$this->line->array_options = $array_options;
|
||||
$line->array_options = $array_options;
|
||||
}
|
||||
|
||||
$result = $this->line->create($user);
|
||||
$result = $line->create($user);
|
||||
|
||||
if ($result > 0) {
|
||||
$this->calculateCosts();
|
||||
$this->db->commit();
|
||||
return $result;
|
||||
} else {
|
||||
$this->error = $this->line->error;
|
||||
$this->setErrorsFromObject($line);
|
||||
dol_syslog(get_class($this)."::addLine error=".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
|
|
@ -722,8 +723,7 @@ class BOM extends CommonObject
|
|||
|
||||
$staticLine = clone $line;
|
||||
$line->oldcopy = $staticLine;
|
||||
$this->line = $line;
|
||||
$this->line->context = $this->context;
|
||||
$line->context = $this->context;
|
||||
|
||||
// Rank to use
|
||||
$rankToUse = (int) $position;
|
||||
|
|
@ -741,32 +741,32 @@ class BOM extends CommonObject
|
|||
}
|
||||
|
||||
|
||||
$this->line->fk_bom = $this->id;
|
||||
$this->line->qty = $qty;
|
||||
$this->line->qty_frozen = $qty_frozen;
|
||||
$this->line->disable_stock_change = $disable_stock_change;
|
||||
$this->line->efficiency = $efficiency;
|
||||
$this->line->import_key = $import_key;
|
||||
$this->line->position = $rankToUse;
|
||||
$line->fk_bom = $this->id;
|
||||
$line->qty = $qty;
|
||||
$line->qty_frozen = $qty_frozen;
|
||||
$line->disable_stock_change = $disable_stock_change;
|
||||
$line->efficiency = $efficiency;
|
||||
$line->import_key = $import_key;
|
||||
$line->position = $rankToUse;
|
||||
if (!empty($fk_unit)) {
|
||||
$this->line->fk_unit = $fk_unit;
|
||||
$line->fk_unit = $fk_unit;
|
||||
}
|
||||
|
||||
if (is_array($array_options) && count($array_options) > 0) {
|
||||
// We replace values in this->line->array_options only for entries defined into $array_options
|
||||
foreach ($array_options as $key => $value) {
|
||||
$this->line->array_options[$key] = $array_options[$key];
|
||||
$line->array_options[$key] = $array_options[$key];
|
||||
}
|
||||
}
|
||||
|
||||
$result = $this->line->update($user);
|
||||
$result = $line->update($user);
|
||||
|
||||
if ($result > 0) {
|
||||
$this->calculateCosts();
|
||||
$this->db->commit();
|
||||
return $result;
|
||||
} else {
|
||||
$this->error = $this->line->error;
|
||||
$this->setErrorsFromObject($line);
|
||||
dol_syslog(get_class($this)."::addLine error=".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
|
|
@ -801,10 +801,9 @@ class BOM extends CommonObject
|
|||
|
||||
$staticLine = clone $line;
|
||||
$line->oldcopy = $staticLine;
|
||||
$this->line = $line;
|
||||
$this->line->context = $this->context;
|
||||
$line->context = $this->context;
|
||||
|
||||
$result = $this->line->delete($user, $notrigger);
|
||||
$result = $line->delete($user, $notrigger);
|
||||
|
||||
//Positions (rank) reordering
|
||||
foreach ($this->lines as $bl) {
|
||||
|
|
@ -819,7 +818,7 @@ class BOM extends CommonObject
|
|||
$this->db->commit();
|
||||
return $result;
|
||||
} else {
|
||||
$this->error = $this->line->error;
|
||||
$this->setErrorsFromObject($line);
|
||||
dol_syslog(get_class($this)."::addLine error=".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
|
|
@ -1423,21 +1422,32 @@ class BOM extends CommonObject
|
|||
}
|
||||
}
|
||||
} else {
|
||||
//Convert qty to hour
|
||||
$unit = measuringUnitString($line->fk_unit, '', '', 1);
|
||||
$qty = convertDurationtoHour($line->qty, $unit);
|
||||
// Convert qty of line into hours
|
||||
$unitforline = measuringUnitString($line->fk_unit, '', '', 1);
|
||||
$qtyhourforline = convertDurationtoHour($line->qty, $unitforline);
|
||||
|
||||
if (isModEnabled('workstation') && !empty($tmpproduct->fk_default_workstation)) {
|
||||
$workstation = new Workstation($this->db);
|
||||
$res = $workstation->fetch($tmpproduct->fk_default_workstation);
|
||||
|
||||
if ($res > 0) $line->total_cost = price2num($qty * ($workstation->thm_operator_estimated + $workstation->thm_machine_estimated), 'MT');
|
||||
if ($res > 0) $line->total_cost = price2num($qtyhourforline * ($workstation->thm_operator_estimated + $workstation->thm_machine_estimated), 'MT');
|
||||
else {
|
||||
$this->error = $workstation->error;
|
||||
return -3;
|
||||
}
|
||||
} else {
|
||||
$line->total_cost = price2num($qty * $tmpproduct->cost_price, 'MT');
|
||||
$defaultdurationofservice = $tmpproduct->duration;
|
||||
$reg = array();
|
||||
$qtyhourservice = 0;
|
||||
if (preg_match('/^(\d+)([a-z]+)$/', $defaultdurationofservice, $reg)) {
|
||||
$qtyhourservice = convertDurationtoHour($reg[1], $reg[2]);
|
||||
}
|
||||
|
||||
if ($qtyhourservice) {
|
||||
$line->total_cost = price2num($qtyhourforline / $qtyhourservice * $tmpproduct->cost_price, 'MT');
|
||||
} else {
|
||||
$line->total_cost = price2num($line->qty * $tmpproduct->cost_price, 'MT');
|
||||
}
|
||||
}
|
||||
|
||||
$this->total_cost += $line->total_cost;
|
||||
|
|
@ -1670,6 +1680,7 @@ class BOMLine extends CommonObjectLine
|
|||
'fk_unit' => array('type'=>'integer', 'label'=>'Unit', 'enabled'=>1, 'visible'=>1, 'position'=>120, 'notnull'=>-1,),
|
||||
'position' => array('type'=>'integer', 'label'=>'Rank', 'enabled'=>1, 'visible'=>0, 'default'=>0, 'position'=>200, 'notnull'=>1,),
|
||||
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,),
|
||||
'fk_default_workstation' =>array('type'=>'integer', 'label'=>'DefaultWorkstation', 'enabled'=>1, 'visible'=>1, 'notnull'=>0, 'position'=>1050)
|
||||
);
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@
|
|||
* $type, $text, $description, $line
|
||||
*/
|
||||
|
||||
/** var ObjectLine $line */
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/workstation/class/workstation.class.php';
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
|
|
@ -78,10 +80,14 @@ $objectline = new BOMLine($object->db);
|
|||
$coldisplay = 0;
|
||||
print "<!-- BEGIN PHP TEMPLATE objectline_view.tpl.php -->\n";
|
||||
print '<tr id="row-'.$line->id.'" class="drag drop oddeven" '.$domData.' >';
|
||||
|
||||
// Line nb
|
||||
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
|
||||
print '<td class="linecolnum center">'.($i + 1).'</td>';
|
||||
$coldisplay++;
|
||||
}
|
||||
|
||||
// Product
|
||||
print '<td class="linecoldescription minwidth300imp">';
|
||||
print '<div id="line_'.$line->id.'"></div>';
|
||||
$coldisplay++;
|
||||
|
|
@ -113,6 +119,7 @@ if (!empty($extrafields)) {
|
|||
|
||||
print '</td>';
|
||||
|
||||
// Qty
|
||||
print '<td class="linecolqty nowrap right">';
|
||||
$coldisplay++;
|
||||
echo price($line->qty, 0, '', 0, 0); // Yes, it is a quantity, not a price, but we just want the formating role of function price
|
||||
|
|
@ -142,7 +149,7 @@ if ($filtertype != 1) {
|
|||
echo $line->efficiency;
|
||||
print '</td>';
|
||||
} else {
|
||||
//Unité
|
||||
// Unit
|
||||
print '<td class="linecolunit nowrap right">';
|
||||
$coldisplay++;
|
||||
|
||||
|
|
@ -158,14 +165,16 @@ if ($filtertype != 1) {
|
|||
// Work station
|
||||
if (isModEnabled('workstation')) {
|
||||
$workstation = new Workstation($object->db);
|
||||
$res = $workstation->fetch($tmpproduct->fk_default_workstation);
|
||||
$res = $workstation->fetch($line->fk_default_workstation);
|
||||
|
||||
print '<td class="linecolunit nowrap right">';
|
||||
print '<td class="linecolworkstation nowrap right">';
|
||||
$coldisplay++;
|
||||
if ($res > 0) echo $workstation->getNomUrl();
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
|
||||
// Cost
|
||||
$total_cost = 0;
|
||||
$tmpbom->calculateCosts();
|
||||
print '<td id="costline_'.$line->id.'" class="linecolcost nowrap right">';
|
||||
|
|
@ -312,10 +321,12 @@ if ($resql) {
|
|||
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'"><span class="amount">'.price(price2num($sub_bom_line->total_cost, 'MT')).'</span></td>';
|
||||
$this->total_cost += $line->total_cost;
|
||||
} elseif ($sub_bom_product->cost_price > 0) {
|
||||
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'"><span class="amount">'.price(price2num($sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty, 'MT')).'</span></td>';
|
||||
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'">';
|
||||
print '<span class="amount">'.price(price2num($sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty, 'MT')).'</span></td>';
|
||||
$total_cost+= $sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty;
|
||||
} elseif ($sub_bom_product->pmp > 0) { // PMP if cost price isn't defined
|
||||
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'"><span class="amount">'.price(price2num($sub_bom_product->pmp * $sub_bom_line->qty * $line->qty, 'MT')).'</span></td>';
|
||||
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'">';
|
||||
print '<span class="amount">'.price(price2num($sub_bom_product->pmp * $sub_bom_line->qty * $line->qty, 'MT')).'</span></td>';
|
||||
$total_cost.= $sub_bom_product->pmp * $sub_bom_line->qty * $line->qty;
|
||||
} else { // Minimum purchase price if cost price and PMP aren't defined
|
||||
$sql_supplier_price = 'SELECT MIN(price) AS min_price, quantity AS qty FROM '.MAIN_DB_PREFIX.'product_fournisseur_price';
|
||||
|
|
|
|||
|
|
@ -311,7 +311,7 @@ $sql .= empty($hookmanager->resPrint) ? "" : " HAVING 1=1 ".$hookmanager->resPri
|
|||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
/* This old and fast method to get and count full list returns all record so use a high amount of memory.
|
||||
$resql = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($resql);
|
||||
|
|
@ -641,7 +641,7 @@ while ($i < $imaxinloop) {
|
|||
print '<div class="box-flex-container kanban">';
|
||||
}
|
||||
// Output Kanban
|
||||
print $object->getKanbanView('');
|
||||
print $object->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
|
||||
if ($i == ($imaxinloop - 1)) {
|
||||
print '</div>';
|
||||
print '</td></tr>';
|
||||
|
|
|
|||
|
|
@ -311,7 +311,7 @@ $sql .= empty($hookmanager->resPrint) ? "" : " HAVING 1=1 ".$hookmanager->resPri
|
|||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
/* This old and fast method to get and count full list returns all record so use a high amount of memory.
|
||||
$resql = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($resql);
|
||||
|
|
@ -641,7 +641,7 @@ while ($i < $imaxinloop) {
|
|||
print '<div class="box-flex-container kanban">';
|
||||
}
|
||||
// Output Kanban
|
||||
print $object->getKanbanView('');
|
||||
print $object->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
|
||||
if ($i == ($imaxinloop - 1)) {
|
||||
print '</div>';
|
||||
print '</td></tr>';
|
||||
|
|
|
|||
|
|
@ -172,7 +172,7 @@ if (!$user->admin) {
|
|||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
/* The fast and low memory method to get and count full list converts the sql into a sql count */
|
||||
$sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
|
||||
$sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
|
||||
|
|
@ -350,7 +350,7 @@ while ($i < $imaxinloop) {
|
|||
print '<div class="box-flex-container">';
|
||||
}
|
||||
// Output Kanban
|
||||
print $object->getKanbanView('');
|
||||
print $object->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
|
||||
if ($i == ($imaxinloop - 1)) {
|
||||
print '</div>';
|
||||
print '</td></tr>';
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ class Categories extends DolibarrApi
|
|||
}
|
||||
|
||||
$sql = "SELECT t.rowid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."categorie as t";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."categorie AS t LEFT JOIN ".MAIN_DB_PREFIX."categories_extrafields AS ef ON (ef.fk_object = t.rowid)"; // Modification VMR Global Solutions to include extrafields as search parameters in the API GET call, so we will be able to filter on extrafields
|
||||
$sql .= ' WHERE t.entity IN ('.getEntity('category').')';
|
||||
if (!empty($type)) {
|
||||
$sql .= ' AND t.type='.array_search($type, Categories::$TYPES);
|
||||
|
|
|
|||
|
|
@ -983,7 +983,7 @@ class Categorie extends CommonObject
|
|||
|
||||
$offset = 0;
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
$result = $this->db->query($sql);
|
||||
$nbtotalofrecords = $this->db->num_rows($result);
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
|
|
|
|||
|
|
@ -590,7 +590,8 @@ if ($type == Categorie::TYPE_CUSTOMER) {
|
|||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td>';
|
||||
print $langs->trans("AddCustomerIntoCategory").' ';
|
||||
print $form->select_company('', 'elemid', 's.client IN (1,3)');
|
||||
$filter = '(s.client:IN:1,3)';
|
||||
print $form->select_company('', 'elemid', $filter);
|
||||
print '<input type="submit" class="button buttongen" value="'.$langs->trans("ClassifyInCategory").'"></td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
|
|
@ -670,7 +671,8 @@ if ($type == Categorie::TYPE_SUPPLIER) {
|
|||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td>';
|
||||
print $langs->trans("AddSupplierIntoCategory").' ';
|
||||
print $form->select_company('', 'elemid', 's.fournisseur = 1');
|
||||
$filter ='(s.fournisseur:=:1)';
|
||||
print $form->select_company('', 'elemid', $filter);
|
||||
print '<input type="submit" class="button buttongen" value="'.$langs->trans("ClassifyInCategory").'"></td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
|
|
|
|||
|
|
@ -2101,8 +2101,6 @@ class ActionComm extends CommonObject
|
|||
dol_syslog(get_class($this)."::build_exportfile select events", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
// Note: Output of sql request is encoded in $conf->file->character_set_client
|
||||
// This assignment in condition is not a bug. It allows walking the results.
|
||||
$diff = 0;
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$qualified = true;
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ class AgendaEvents extends DolibarrApi
|
|||
$sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
|
||||
}
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as t";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm AS t LEFT JOIN ".MAIN_DB_PREFIX."actioncomm_extrafields AS ef ON (ef.fk_object = t.id)"; // Modification VMR Global Solutions to include extrafields as search parameters in the API GET call, so we will be able to filter on extrafields
|
||||
if (isModEnabled("societe")) {
|
||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
||||
|
|
|
|||
|
|
@ -570,7 +570,7 @@ $sql .= $hookmanager->resPrint;
|
|||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
/* The fast and low memory method to get and count full list converts the sql into a sql count */
|
||||
$sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
|
||||
$sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ $sql .= " GROUP BY year, month, df";
|
|||
$sql .= " ORDER BY year DESC, month DESC, df DESC";
|
||||
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
|
|
|
|||
|
|
@ -593,7 +593,7 @@ if ($object->fetch($id) >= 0) {
|
|||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
|
|
|
|||
|
|
@ -208,7 +208,7 @@ $sql .= $hookmanager->resPrint;
|
|||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
/* The fast and low memory method to get and count full list converts the sql into a sql count */
|
||||
$sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
|
||||
$sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
|
||||
|
|
|
|||
|
|
@ -1810,7 +1810,8 @@ if ($action == 'create') {
|
|||
//$warehouse_id = $soc->warehouse_id;
|
||||
} else {
|
||||
print '<td class="valuefieldcreate">';
|
||||
print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company('', 'socid', '((s.client = 1 OR s.client = 2 OR s.client = 3) AND status=1)', 'SelectThirdParty', 1, 0, null, 0, 'minwidth300 maxwidth500 widthcentpercentminusxx');
|
||||
$filter = '((s.client:IN:1,2,3) AND (s.status:=:1))';
|
||||
print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company('', 'socid', $filter, 'SelectThirdParty', 1, 0, null, 0, 'minwidth300 maxwidth500 widthcentpercentminusxx');
|
||||
// reload page to retrieve customer informations
|
||||
if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) {
|
||||
print '<script>
|
||||
|
|
@ -2133,10 +2134,11 @@ if ($action == 'create') {
|
|||
// Clone confirmation
|
||||
if ($action == 'clone') {
|
||||
// Create an array for form
|
||||
$filter = '(s.client:IN:1,2,3)';
|
||||
$formquestion = array(
|
||||
// 'text' => $langs->trans("ConfirmClone"),
|
||||
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
||||
array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)', '', 0, 0, null, 0, 'maxwidth300')),
|
||||
array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', $filter, '', 0, 0, null, 0, 'maxwidth300')),
|
||||
array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans('PuttingPricesUpToDate'), 'value' => 0),
|
||||
array('type' => 'checkbox', 'name' => 'update_desc', 'label' => $langs->trans('PuttingDescUpToDate'), 'value' => 0),
|
||||
);
|
||||
|
|
@ -2753,53 +2755,50 @@ if ($action == 'create') {
|
|||
|
||||
print '<table class="border tableforfield centpercent">';
|
||||
|
||||
print '<tr>';
|
||||
print '<td class="titlefieldmiddle">' . $langs->trans('AmountHT') . '</td>';
|
||||
print '<td class="nowrap amountcard right">' . price($object->total_ht, '', $langs, 0, -1, -1, $conf->currency) . '</td>';
|
||||
if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
|
||||
// Multicurrency Amount HT
|
||||
print '<tr><td class="titlefieldmiddle">'.$form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0).'</td>';
|
||||
print '<td class="nowrap right amountcard">'.price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Multicurrency Amount VAT
|
||||
print '<tr><td>'.$form->editfieldkey('MulticurrencyAmountVAT', 'multicurrency_total_tva', '', $object, 0).'</td>';
|
||||
print '<td class="nowrap right amountcard">'.price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Multicurrency Amount TTC
|
||||
print '<tr><td>'.$form->editfieldkey('MulticurrencyAmountTTC', 'multicurrency_total_ttc', '', $object, 0).'</td>';
|
||||
print '<td class="nowrap right amountcard">'.price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
|
||||
print '</tr>';
|
||||
print '<td class="nowrap amountcard right">' . price($object->multicurrency_total_ht, '', $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
|
||||
}
|
||||
|
||||
// Amount HT
|
||||
print '<tr><td class="titlefieldmiddle">'.$langs->trans('AmountHT').'</td>';
|
||||
print '<td class="nowrap right amountcard">'.price($object->total_ht, '', $langs, 0, - 1, - 1, $conf->currency).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Amount VAT
|
||||
print '<tr><td>'.$langs->trans('AmountVAT').'</td>';
|
||||
print '<td class="nowrap right amountcard">'.price($object->total_tva, '', $langs, 0, - 1, - 1, $conf->currency).'</td>';
|
||||
print '<tr>';
|
||||
print '<td class="titlefieldmiddle">' . $langs->trans('AmountVAT') . '</td>';
|
||||
print '<td class="nowrap amountcard right">' . price($object->total_tva, '', $langs, 0, -1, -1, $conf->currency) . '</td>';
|
||||
if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
|
||||
print '<td class="nowrap amountcard right">' . price($object->multicurrency_total_tva, '', $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
// Amount Local Taxes
|
||||
if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) { // Localtax1
|
||||
print '<tr><td>'.$langs->transcountry("AmountLT1", $mysoc->country_code).'</td>';
|
||||
print '<td class="nowrap right amountcard">'.price($object->total_localtax1, '', $langs, 0, - 1, - 1, $conf->currency).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) { // Localtax2
|
||||
print '<tr><td>'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td>';
|
||||
print '<td class="nowrap right amountcard">'.price($object->total_localtax2, '', $langs, 0, - 1, - 1, $conf->currency).'</td>';
|
||||
if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) {
|
||||
print '<tr>';
|
||||
print '<td class="titlefieldmiddle">' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td>';
|
||||
print '<td class="nowrap amountcard right">' . price($object->total_localtax1, '', $langs, 0, -1, -1, $conf->currency) . '</td>';
|
||||
if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
|
||||
print '<td class="nowrap amountcard right">' . price($object->total_localtax1, '', $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
print '<tr>';
|
||||
if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) {
|
||||
print '<td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td>';
|
||||
print '<td class="nowrap amountcard right">' . price($object->total_localtax2, '', $langs, 0, -1, -1, $conf->currency) . '</td>';
|
||||
if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
|
||||
print '<td class="nowrap amountcard right">' . price($object->total_localtax2, '', $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
|
||||
}
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
// Amount TTC
|
||||
print '<tr><td>'.$langs->trans('AmountTTC').'</td>';
|
||||
print '<td class="nowrap right amountcard">'.price($object->total_ttc, '', $langs, 0, - 1, - 1, $conf->currency).'</td>';
|
||||
print '<tr>';
|
||||
print '<td>' . $langs->trans('AmountTTC') . '</td>';
|
||||
print '<td class="nowrap amountcard right">' . price($object->total_ttc, '', $langs, 0, -1, -1, $conf->currency) . '</td>';
|
||||
if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
|
||||
print '<td class="nowrap amountcard right">' . price($object->total_ttc, '', $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
// Statut
|
||||
//print '<tr><td height="10">' . $langs->trans('Status') . '</td><td class="left" colspan="2">' . $object->getLibStatut(4) . '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
// Margin Infos
|
||||
|
|
|
|||
|
|
@ -181,7 +181,8 @@ class Proposals extends DolibarrApi
|
|||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) {
|
||||
$sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."propal as t";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."propal AS t LEFT JOIN ".MAIN_DB_PREFIX."propal_extrafields AS ef ON (ef.fk_object = t.rowid)"; // Modification VMR Global Solutions to include extrafields as search parameters in the API GET call, so we will be able to filter on extrafields
|
||||
|
||||
|
||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
||||
|
|
|
|||
|
|
@ -122,6 +122,7 @@ class Propal extends CommonObject
|
|||
/**
|
||||
* Status of the quote
|
||||
* @var int
|
||||
* @deprecated Try to use $status now
|
||||
* @see Propal::STATUS_DRAFT, Propal::STATUS_VALIDATED, Propal::STATUS_SIGNED, Propal::STATUS_NOTSIGNED, Propal::STATUS_BILLED
|
||||
*/
|
||||
public $statut;
|
||||
|
|
@ -1606,7 +1607,8 @@ class Propal extends CommonObject
|
|||
|
||||
$this->ref = $obj->ref;
|
||||
$this->ref_client = $obj->ref_client;
|
||||
$this->ref_ext = $obj->ref_ext;
|
||||
$this->ref_customer = $obj->ref_client;
|
||||
$this->ref_ext = $obj->ref_ext;
|
||||
|
||||
$this->remise = $obj->remise; // TODO deprecated
|
||||
$this->remise_percent = $obj->remise_percent; // TODO deprecated
|
||||
|
|
@ -3998,7 +4000,6 @@ class Propal extends CommonObject
|
|||
$return .= '<div class="info-box info-box-sm">';
|
||||
$return .= '<span class="info-box-icon bg-infobox-action">';
|
||||
$return .= img_picto('', $this->picto);
|
||||
//$return .= '<i class="fa fa-dol-action"></i>'; // Can be image
|
||||
$return .= '</span>';
|
||||
$return .= '<div class="info-box-content">';
|
||||
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>';
|
||||
|
|
|
|||
|
|
@ -809,7 +809,7 @@ $sql .= empty($hookmanager->resPrint) ? "" : " HAVING 1=1 ".$hookmanager->resPri
|
|||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
/* The fast and low memory method to get and count full list converts the sql into a sql count */
|
||||
$sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
|
||||
$sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
|
||||
|
|
@ -1722,7 +1722,7 @@ if ($resql) {
|
|||
$userstatic->fetch($obj->fk_user_author);
|
||||
$objectstatic->author = $userstatic->getNomUrl(1);
|
||||
$objectstatic->fk_project = $projectstatic->getNomUrl(1);
|
||||
print $objectstatic->getKanbanView('');
|
||||
print $objectstatic->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
|
||||
if ($i == ($imaxinloop - 1)) {
|
||||
print '</div>';
|
||||
print '</td></tr>';
|
||||
|
|
|
|||
|
|
@ -263,8 +263,8 @@ print '<table class="noborder centpercent">';
|
|||
print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>';
|
||||
// Company
|
||||
print '<tr><td class="left">'.$langs->trans("ThirdParty").'</td><td class="left">';
|
||||
$filter = 's.client IN (1,2,3)';
|
||||
print img_picto('', 'company', 'class="pictofixedwidth"');
|
||||
$filter = '(s.client:IN:1,2,3)';
|
||||
print $form->select_company($socid, 'socid', $filter, 1, 0, 0, array(), 0, 'widthcentpercentminusx maxwidth300', '');
|
||||
print '</td></tr>';
|
||||
// ThirdParty Type
|
||||
|
|
|
|||
|
|
@ -1402,6 +1402,8 @@ if (empty($reshook)) {
|
|||
|
||||
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'confirm_shipped' && $confirm == 'yes' && $usercanclose) {
|
||||
|
|
@ -1787,8 +1789,9 @@ if ($action == 'create' && $usercancreate) {
|
|||
print '<input type="hidden" name="socid" value="'.$soc->id.'">';
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td>';
|
||||
print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company('', 'socid', '((s.client = 1 OR s.client = 2 OR s.client = 3) AND s.status=1)', 'SelectThirdParty', 1, 0, null, 0, 'minwidth175 maxwidth500 widthcentpercentminusxx');
|
||||
print '<td class="valuefieldcreate">';
|
||||
$filter = '((s.client:IN:1,2,3) AND (s.status:=:1))';
|
||||
print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company('', 'socid', $filter, 'SelectThirdParty', 1, 0, null, 0, 'minwidth175 maxwidth500 widthcentpercentminusxx');
|
||||
// reload page to retrieve customer informations
|
||||
if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) {
|
||||
print '<script>
|
||||
|
|
@ -2337,9 +2340,10 @@ if ($action == 'create' && $usercancreate) {
|
|||
|
||||
// Clone confirmation
|
||||
if ($action == 'clone') {
|
||||
$filter = '(s.client:IN:1,2,3)';
|
||||
// Create an array for form
|
||||
$formquestion = array(
|
||||
array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client = 2 OR s.client=3)', '', 0, 0, null, 0, 'maxwidth300'))
|
||||
array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', $filter, '', 0, 0, null, 0, 'maxwidth300'))
|
||||
);
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneOrder', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ class Orders extends DolibarrApi
|
|||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) {
|
||||
$sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."commande as t";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture AS t LEFT JOIN ".MAIN_DB_PREFIX."facture_extrafields AS ef ON (ef.fk_object = t.rowid)"; // Modification VMR Global Solutions to include extrafields as search parameters in the API GET call, so we will be able to filter on extrafields
|
||||
|
||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
||||
|
|
|
|||
|
|
@ -102,6 +102,11 @@ class Commande extends CommonOrder
|
|||
*/
|
||||
public $ref_client;
|
||||
|
||||
/**
|
||||
* @var string Thirdparty ref of order
|
||||
*/
|
||||
public $ref_customer;
|
||||
|
||||
/**
|
||||
* @var int Contact ID
|
||||
*/
|
||||
|
|
@ -1245,6 +1250,7 @@ class Commande extends CommonOrder
|
|||
$this->date_validation = '';
|
||||
if (empty($conf->global->MAIN_KEEP_REF_CUSTOMER_ON_CLONING)) {
|
||||
$this->ref_client = '';
|
||||
$this->ref_customer = '';
|
||||
}
|
||||
|
||||
// Do not clone ref_ext
|
||||
|
|
@ -1383,6 +1389,7 @@ class Commande extends CommonOrder
|
|||
$this->fk_delivery_address = $object->fk_delivery_address;
|
||||
$this->contact_id = $object->contact_id;
|
||||
$this->ref_client = $object->ref_client;
|
||||
$this->ref_customer = $object->ref_client;
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_PROPAGATE_NOTES_FROM_ORIGIN)) {
|
||||
$this->note_private = $object->note_private;
|
||||
|
|
@ -1899,7 +1906,7 @@ class Commande extends CommonOrder
|
|||
$this->ref = $obj->ref;
|
||||
$this->ref_client = $obj->ref_client;
|
||||
$this->ref_customer = $obj->ref_client;
|
||||
$this->ref_ext = $obj->ref_ext;
|
||||
$this->ref_ext = $obj->ref_ext;
|
||||
|
||||
$this->socid = $obj->fk_soc;
|
||||
$this->thirdparty = null; // Clear if another value was already set by fetch_thirdparty
|
||||
|
|
@ -2949,6 +2956,7 @@ class Commande extends CommonOrder
|
|||
if (!$error) {
|
||||
$this->oldcopy = clone $this;
|
||||
$this->ref_client = $ref_client;
|
||||
$this->ref_customer = $ref_client;
|
||||
}
|
||||
|
||||
if (!$notrigger && empty($error)) {
|
||||
|
|
@ -3337,6 +3345,9 @@ class Commande extends CommonOrder
|
|||
if (isset($this->ref_client)) {
|
||||
$this->ref_client = trim($this->ref_client);
|
||||
}
|
||||
if (isset($this->ref_customer)) {
|
||||
$this->ref_customer = trim($this->ref_customer);
|
||||
}
|
||||
if (isset($this->note) || isset($this->note_private)) {
|
||||
$this->note_private = (isset($this->note_private) ? trim($this->note_private) : trim($this->note));
|
||||
}
|
||||
|
|
@ -3870,7 +3881,7 @@ class Commande extends CommonOrder
|
|||
|
||||
$result .= $linkstart;
|
||||
if ($withpicto) {
|
||||
$result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1);
|
||||
$result .= img_object(($notooltip ? '' : $label), $this->picto, (($withpicto != 2) ? 'class="paddingright"' : ''), 0, 0, $notooltip ? 0 : 1);
|
||||
}
|
||||
if ($withpicto != 2) {
|
||||
$result .= $this->ref;
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ $sql .= $db->order($sortfield, $sortorder);
|
|||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
|
||||
|
|
|
|||
|
|
@ -1060,7 +1060,7 @@ $sql .= empty($hookmanager->resPrint) ? "" : " HAVING 1=1 ".$hookmanager->resPri
|
|||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
/* The fast and low memory method to get and count full list converts the sql into a sql count */
|
||||
$sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
|
||||
$sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
|
||||
|
|
@ -2002,7 +2002,7 @@ if ($resql) {
|
|||
print '<div class="box-flex-container kanban">';
|
||||
}
|
||||
|
||||
print $generic_commande->getKanbanView('');
|
||||
print $generic_commande->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
|
||||
|
||||
if ($i == ($imaxinloop - 1)) {
|
||||
print '</div>';
|
||||
|
|
|
|||
|
|
@ -602,7 +602,7 @@ $sql .= $db->order($sortfield, $sortorder);
|
|||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
|
||||
|
|
|
|||
|
|
@ -295,11 +295,12 @@ print '<table class="noborder centpercent">';
|
|||
print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>';
|
||||
// Company
|
||||
print '<tr><td class="left">'.$langs->trans("ThirdParty").'</td><td class="left">';
|
||||
$filter = '';
|
||||
if ($mode == 'customer') {
|
||||
$filter = 's.client IN (1,2,3)';
|
||||
$filter = '(s.client:IN:1,2,3)';
|
||||
}
|
||||
if ($mode == 'supplier') {
|
||||
$filter = 's.fournisseur = 1';
|
||||
$filter = '(s.fournisseur:=:1)';
|
||||
}
|
||||
print img_picto('', 'company', 'class="pictofixedwidth"');
|
||||
print $form->select_company($socid, 'socid', $filter, 1, 0, 0, array(), 0, 'widthcentpercentminusx maxwidth300');
|
||||
|
|
|
|||
|
|
@ -614,6 +614,7 @@ if (isModEnabled('projet')) {
|
|||
print '<br>';
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
foreach ($listofchoices as $choice => $val) {
|
||||
if (empty($val['enabled'])) {
|
||||
continue; // list not qualified
|
||||
|
|
@ -623,9 +624,10 @@ foreach ($listofchoices as $choice => $val) {
|
|||
$disabled = ' disabled';
|
||||
}
|
||||
$checked = (((!GETPOSTISSET('search') && $action != 'searchfiles') || GETPOST($choice)) ? ' checked="checked"' : '');
|
||||
print '<div class="paddingleft inline-block marginrightonly paddingright"><input type="checkbox" id="'.$choice.'" name="'.$choice.'" value="1"'.$checked.$disabled.'><label for="'.$choice.'"> ';
|
||||
print '<div class="'.($i > 0 ? 'paddingleft marginleftonly' : '').' inline-block marginrightonly paddingright"><input type="checkbox" id="'.$choice.'" name="'.$choice.'" value="1"'.$checked.$disabled.'><label for="'.$choice.'"> ';
|
||||
print img_picto($langs->trans($val['label']), $val['picto'], 'class=""').' '.$langs->trans($val['label']);
|
||||
print '</label></div>';
|
||||
$i++;
|
||||
}
|
||||
|
||||
print '<input type="submit" class="button small" name="search" value="'.$langs->trans("Search").'">';
|
||||
|
|
|
|||
|
|
@ -701,7 +701,7 @@ $sql .= $db->order($sortfield, $sortorder);
|
|||
|
||||
$nbtotalofrecords = '';
|
||||
$nbtotalofpages = 0;
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
$nbtotalofpages = ceil($nbtotalofrecords / $limit);
|
||||
|
|
|
|||
|
|
@ -1336,6 +1336,7 @@ class Account extends CommonObject
|
|||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Charge indicateurs this->nb de tableau de bord
|
||||
*
|
||||
* @param int $filteraccountid To get info for a particular account id
|
||||
* @return int <0 if ko, >0 if ok
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ class BankAccounts extends DolibarrApi
|
|||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."bank_account as t";
|
||||
$sql = "SELECT t.rowid FROM ".MAIN_DB_PREFIX."bank_account AS t LEFT JOIN ".MAIN_DB_PREFIX."bank_account_extrafields AS ef ON (ef.fk_object = t.rowid)"; // Modification VMR Global Solutions to include extrafields as search parameters in the API GET call, so we will be able to filter on extrafields
|
||||
if ($category > 0) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."categorie_account as c";
|
||||
}
|
||||
|
|
@ -144,8 +144,8 @@ class BankAccounts extends DolibarrApi
|
|||
/**
|
||||
* Create account object
|
||||
*
|
||||
* @param array $request_data Request data
|
||||
* @return int ID of account
|
||||
* @param array $request_data Request data
|
||||
* @return int ID of account
|
||||
*/
|
||||
public function post($request_data = null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -258,7 +258,7 @@ $sql .= $hookmanager->resPrint;
|
|||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
/* The fast and low memory method to get and count full list converts the sql into a sql count */
|
||||
$sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
|
||||
$sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
|
||||
|
|
@ -600,7 +600,7 @@ foreach ($accounts as $key => $type) {
|
|||
print '<div class="box-flex-container kanban">';
|
||||
}
|
||||
// Output Kanban
|
||||
print $objecttmp->getKanbanView('');
|
||||
print $objecttmp->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
|
||||
if ($i == ($imaxinloop - 1)) {
|
||||
print '</div>';
|
||||
print '</td></tr>';
|
||||
|
|
|
|||
|
|
@ -252,7 +252,7 @@ if (empty($numref)) {
|
|||
|
||||
// Count total nb of records
|
||||
$totalnboflines = 0;
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
$result = $db->query($sql);
|
||||
$totalnboflines = $db->num_rows($result);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -337,9 +337,9 @@ print '</div>';
|
|||
print '</form>';
|
||||
|
||||
print ' <script type="text/javascript">
|
||||
function increment(){
|
||||
function increment() {
|
||||
$(".numvir").nextAll(".hidejs:first").removeClass("hidejs").removeClass("hideobject").addClass("active").show();
|
||||
};
|
||||
}
|
||||
$(".number1").on("click",(function() {
|
||||
console.log("We click on number1");
|
||||
$(".hidejs").each(function (){$(this).hide()});
|
||||
|
|
|
|||
|
|
@ -296,7 +296,7 @@ if ($search_all) {
|
|||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
/* The fast and low memory method to get and count full list converts the sql into a sql count */
|
||||
$sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
|
||||
$sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
|
||||
|
|
@ -639,7 +639,7 @@ while ($i < $imaxinloop) {
|
|||
print '<div class="box-flex-container kanban">';
|
||||
}
|
||||
// Output Kanban
|
||||
print $variousstatic->getKanbanView('');
|
||||
print $variousstatic->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
|
||||
if ($i == ($imaxinloop) - 1) {
|
||||
print '</div>';
|
||||
print '</td></tr>';
|
||||
|
|
|
|||
|
|
@ -290,7 +290,7 @@ $sql=preg_replace('/,\s*$/','', $sql);
|
|||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
/* The fast and low memory method to get and count full list converts the sql into a sql count */
|
||||
$sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
|
||||
$sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
|
||||
|
|
@ -578,7 +578,6 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
|
|||
$object->year_close = $obj->year_close;
|
||||
$object->cheque = $obj->cheque;
|
||||
|
||||
|
||||
print $object->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
|
||||
if ($i == (min($num, $limit) - 1)) {
|
||||
print '</div>';
|
||||
|
|
|
|||
|
|
@ -242,9 +242,8 @@ print '<table class="border centpercent">';
|
|||
print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>';
|
||||
// Company
|
||||
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
|
||||
$filter = '';
|
||||
print img_picto('', 'company', 'class="pictofixedwidth"');
|
||||
print $form->select_company($socid, 'socid', $filter, 1, 1, 0, array(), 0, 'widthcentpercentminusx maxwidth300', '');
|
||||
print $form->select_company($socid, 'socid', '', 1, 1, 0, array(), 0, 'widthcentpercentminusx maxwidth300', '');
|
||||
print '</td></tr>';
|
||||
// User
|
||||
print '<tr><td>'.$langs->trans("User").'</td><td>';
|
||||
|
|
|
|||
|
|
@ -3205,7 +3205,8 @@ if ($action == 'create') {
|
|||
} else {
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('Customer').'</td>';
|
||||
print '<td colspan="2">';
|
||||
print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company($soc->id, 'socid', '((s.client = 1 OR s.client = 3) AND s.status = 1)', 'SelectThirdParty', 1, 0, null, 0, 'minwidth300 widthcentpercentminusxx maxwidth500');
|
||||
$filter = '((s.client:=:1,3) AND (s.status:=:1))';
|
||||
print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company($soc->id, 'socid', $filter, 'SelectThirdParty', 1, 0, null, 0, 'minwidth300 widthcentpercentminusxx maxwidth500');
|
||||
// Option to reload page to retrieve customer informations.
|
||||
if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) {
|
||||
print '<script>
|
||||
|
|
@ -4319,9 +4320,10 @@ if ($action == 'create') {
|
|||
|
||||
// Clone confirmation
|
||||
if ($action == 'clone') {
|
||||
$filter = '(s.client:IN:1,2,3)';
|
||||
// Create an array for form
|
||||
$formquestion = array(
|
||||
array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company($object->socid, 'socid', '(s.client=1 OR s.client=2 OR s.client=3)', 1)),
|
||||
array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company($object->socid, 'socid', $filter, 1)),
|
||||
array('type' => 'date', 'name' => 'newdate', 'label' => $langs->trans("Date"), 'value' => dol_now())
|
||||
);
|
||||
// Request confirmation to clone
|
||||
|
|
|
|||
|
|
@ -199,7 +199,7 @@ class Invoices extends DolibarrApi
|
|||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) {
|
||||
$sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as t";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture AS t LEFT JOIN ".MAIN_DB_PREFIX."facture_extrafields AS ef ON (ef.fk_object = t.rowid)"; // Modification VMR Global Solutions to include extrafields as search parameters in the API GET call, so we will be able to filter on extrafields
|
||||
|
||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
||||
|
|
|
|||
|
|
@ -1035,6 +1035,10 @@ class FactureRec extends CommonInvoice
|
|||
$this->error = $this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
$this->error = 'Recurring Invoice is suspended. adding lines not allowed.';
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -177,9 +177,6 @@ class Facture extends CommonInvoice
|
|||
*/
|
||||
public $ref_customer;
|
||||
|
||||
//Check constants for types
|
||||
public $type = self::TYPE_STANDARD;
|
||||
|
||||
// Warning: Do not set default value into property defintion. it must stay null.
|
||||
// For example to avoid to have substition done when object is generic and not yet defined.
|
||||
public $remise_absolue;
|
||||
|
|
@ -302,6 +299,7 @@ class Facture extends CommonInvoice
|
|||
public $retained_warranty_fk_cond_reglement;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password')
|
||||
* Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)"
|
||||
|
|
@ -492,7 +490,9 @@ class Facture extends CommonInvoice
|
|||
if (empty($this->type)) {
|
||||
$this->type = self::TYPE_STANDARD;
|
||||
}
|
||||
|
||||
$this->ref_client = trim($this->ref_client);
|
||||
|
||||
$this->note = (isset($this->note) ? trim($this->note) : trim($this->note_private)); // deprecated
|
||||
$this->note_private = (isset($this->note_private) ? trim($this->note_private) : trim($this->note_private));
|
||||
$this->note_public = trim($this->note_public);
|
||||
|
|
@ -5623,16 +5623,17 @@ class Facture extends CommonInvoice
|
|||
|
||||
|
||||
/**
|
||||
* Send reminders by emails for invoices that are due
|
||||
* Send reminders by emails for invoices validated that are due.
|
||||
* CAN BE A CRON TASK
|
||||
*
|
||||
* @param int $nbdays Delay before due date (or after if delay is negative)
|
||||
* @param string $paymentmode '' or 'all' by default (no filter), or 'LIQ', 'CHQ', CB', ...
|
||||
* @param int|string $template Name (or id) of email template (Must be a template of type 'facture_send')
|
||||
* @param string $forcerecipient Force email of recipient (for example to send the email to an accountant supervisor instead of the customer)
|
||||
* @param string $datetouse 'duedate' (default) or 'invoicedate'
|
||||
* @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK)
|
||||
*/
|
||||
public function sendEmailsRemindersOnInvoiceDueDate($nbdays = 0, $paymentmode = 'all', $template = '', $forcerecipient = '')
|
||||
public function sendEmailsRemindersOnInvoiceDueDate($nbdays = 0, $paymentmode = 'all', $template = '', $forcerecipient = '', $datetouse = 'duedate')
|
||||
{
|
||||
global $conf, $langs, $user;
|
||||
|
||||
|
|
@ -5648,6 +5649,10 @@ class Facture extends CommonInvoice
|
|||
$this->output .= $langs->trans('ModuleNotEnabled', $langs->transnoentitiesnoconv("Facture"));
|
||||
return 0;
|
||||
}
|
||||
if (!in_array($datetouse, array('duedate', 'invoicedate'))) {
|
||||
$this->output .= 'Bad value for parameter datetouse. Must be "duedate" or "invoicedate"';
|
||||
return 0;
|
||||
}
|
||||
/*if (empty($conf->global->FACTURE_REMINDER_EMAIL)) {
|
||||
$langs->load("bills");
|
||||
$this->output .= $langs->trans('EventRemindersByEmailNotEnabled', $langs->transnoentitiesnoconv("Facture"));
|
||||
|
|
@ -5672,15 +5677,23 @@ class Facture extends CommonInvoice
|
|||
if (!empty($paymentmode) && $paymentmode != 'all') {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."c_paiement as cp";
|
||||
}
|
||||
$sql .= " WHERE f.paye = 0";
|
||||
$sql .= " AND f.fk_statut = ".self::STATUS_VALIDATED;
|
||||
$sql .= " AND f.date_lim_reglement = '".$this->db->idate($tmpidate, 'gmt')."'";
|
||||
$sql .= " WHERE f.paye = 0"; // Only unpaid
|
||||
$sql .= " AND f.fk_statut = ".self::STATUS_VALIDATED; // Only validated status
|
||||
if ($datetouse == 'invoicedate') {
|
||||
$sql .= " AND f.datef = '".$this->db->idate($tmpidate, 'gmt')."'";
|
||||
} else {
|
||||
$sql .= " AND f.date_lim_reglement = '".$this->db->idate($tmpidate, 'gmt')."'";
|
||||
}
|
||||
$sql .= " AND f.entity IN (".getEntity('facture', 0).")"; // One batch process only one company (no sharing)
|
||||
if (!empty($paymentmode) && $paymentmode != 'all') {
|
||||
$sql .= " AND f.fk_mode_reglement = cp.id AND cp.code = '".$this->db->escape($paymentmode)."'";
|
||||
}
|
||||
// TODO Add a filter to check there is no payment started yet
|
||||
$sql .= $this->db->order("date_lim_reglement", "ASC");
|
||||
if ($datetouse == 'invoicedate') {
|
||||
$sql .= $this->db->order("datef", "ASC");
|
||||
} else {
|
||||
$sql .= $this->db->order("date_lim_reglement", "ASC");
|
||||
}
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
|
|
@ -5707,7 +5720,7 @@ class Facture extends CommonInvoice
|
|||
$outputlangs = $langs;
|
||||
}
|
||||
|
||||
// Select email template
|
||||
// Select email template according to language of recipient
|
||||
$arraymessage = $formmail->getEMailTemplate($this->db, 'facture_send', $user, $outputlangs, (is_numeric($template) ? $template : 0), 1, (is_numeric($template) ? '' : $template));
|
||||
if (is_numeric($arraymessage) && $arraymessage <= 0) {
|
||||
$langs->load("errors");
|
||||
|
|
@ -5749,8 +5762,9 @@ class Facture extends CommonInvoice
|
|||
}
|
||||
if (empty($to) && !empty($recipient->email)) {
|
||||
$to[] = $recipient->email;
|
||||
} else {
|
||||
$errormesg = "Failed to send remind to thirdparty id=".$tmpinvoice->socid.". No email defined for user.";
|
||||
}
|
||||
if (empty($to)) {
|
||||
$errormesg = "Failed to send remind to thirdparty id=".$tmpinvoice->socid.". No email defined for invoice or customer.";
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
|
|
@ -5811,7 +5825,7 @@ class Facture extends CommonInvoice
|
|||
$actioncomm->contact_id = 0;
|
||||
|
||||
$actioncomm->code = 'AC_EMAIL';
|
||||
$actioncomm->label = 'sendEmailsRemindersOnInvoiceDueDateOK (nbdays='.$nbdays.' paymentmode='.$paymentmode.' template='.$template.' forcerecipient='.$forcerecipient.')';
|
||||
$actioncomm->label = 'sendEmailsRemindersOnInvoiceDueDateOK (nbdays='.$nbdays.' paymentmode='.$paymentmode.' template='.$template.' forcerecipient='.$forcerecipient.' datetouse='.$datetouse.')';
|
||||
$actioncomm->note_private = $sendContent;
|
||||
$actioncomm->fk_project = $tmpinvoice->fk_project;
|
||||
$actioncomm->datep = dol_now();
|
||||
|
|
|
|||
|
|
@ -386,7 +386,7 @@ if ($search_date_when_end) {
|
|||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
/* The fast and low memory method to get and count full list converts the sql into a sql count */
|
||||
$sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
|
||||
$sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue