Merge branch 'develop' into kanbanPositionList

This commit is contained in:
Laurent Destailleur 2023-01-18 20:33:00 +01:00 committed by GitHub
commit 37a916ebd7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
236 changed files with 9536 additions and 5967 deletions

1
.gitignore vendored
View File

@ -14,7 +14,6 @@ default.properties
/.pydevproject
/.vscode
.DS_Store
.idea
*.iml
*.orig
Thumbs.db

5
.idea/php.xml Normal file
View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="7.0">
<component name="PhpProjectSharedConfiguration" php_language_level="7.0" />
</project>

152
ChangeLog
View File

@ -5,11 +5,16 @@ English Dolibarr ChangeLog
***** ChangeLog for 18.0.0 compared to 17.0.0 *****
NEW: PHP 8.2 compatibility:
WARNING:
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
* The deprecated method escapeunderscore() of database handlers has been removed. You must use escapeforlike instead.
* The method nb_expedition() has been renamed into countNbOfShipments()
* The deprecated method "escapeunderscore()" of database handlers has been removed. You must use "escapeforlike()" instead.
* The method "nb_expedition()" has been renamed into "countNbOfShipments()"
* Revert default type of hooks. Default is now 'addreplace' hooks (and exception become 'output' hooks, that become deprecated).
* Deprecated property libelle removed from entrepot class.
@ -41,26 +46,17 @@ NEW: #22676 massaction for updating product prices
NEW: #22735 Massaction to affect users on projects
NEW: #25594 can chose if VAT ID is unique or not for third parties
NEW: #4482 adding js to hide/show advanced option on the export data page
NEW: Accountancy - Add a graphic option to enable lettering function - FPC21
NEW: Accountancy - Add a way to clean some words when you generate thirdparty accounting account
NEW: Accountancy - Added an option during export to export or not the lettering FPC21
NEW: Accountancy - Manage supplier deposit with specific account
NEW: Accountancy - Model Digitaria - Add a way to clean some words when you generate thirdparty accounting account FPC22
NEW: Add a constant to disallow modification of the product reference.
NEW: Add a method doAutoRenewContracts that can be used as a cron task.
NEW: Add " as enclosure by default for CSV export. Keep removing CR/LF.
NEW: add attached file in presend email form of thirdparty card
NEW: Add a way to enter LICENSE file content in property of website
NEW: Add badge in admin extrafields setup
NEW: add constant PROPAL_BYPASS_VALIDATED_STATUS
NEW: Add date event (!= date project) and location on event organization
NEW: Add employment anniversary in birthday box
NEW: Add extrafield type "IP" to store IP addresses
NEW: Add fail2ban rules examples to limit access to /public pages
NEW: Add filter "Product subject to lot/Serial" in stock per lot/serial
NEW: Add hidden option MAIN_EMAIL_SUPPORT_ACK to restore Email ack checkbox (feature abandonned by mailers)
NEW: Add link to create an element from the category page
NEW: add margin infos to takepos invoice lines
NEW: Add max size send for "backup and link to mail" option
NEW: Add method httponly_accessforbidden()
NEW: Add more advices into the Setup security page
@ -77,78 +73,83 @@ NEW: Add a new advanced permission "read price"
NEW: Add substitution key __SENDEREMAIL_SIGNATURE__
NEW: Add the referrer-policy to "same-origin" by default on all public pages.
NEW: Add the SMTP header References on ticket email created by email
NEW: Add the thirdparty column to the time list (projet/tasks/time.php)
NEW: Add trigger to record the event of sending an email from a project #20912
NEW: Allow download link option in module configuration (propal,invoice,supplier proposal, order)
NEW: Bank - Add salaries & vat in tab planned entries
NEW: Bulk action to remove a category in list/search website pages
NEW: Can copy/paste images into emails sent.
NEW: Can edit label of an emailing even once sent
NEW: Can edit property css, cssview, csslist on extrafields
NEW: Can enter the unit price including the vat
NEW: Can invoice task time per different services
NEW: Can join several files by default on email form
NEW: Can send an email on scheduled job error
NEW: Can set a commercial discount by entering amount including VAT
NEW: Can set a monthly frequency (or multiple) in cron tasks.
NEW: Can set start and end dates and comment on button "Activate all services"
NEW: can sort and preselected best supplier price
NEW: Can use products categories to make inventory
NEW: Change filter type on tickets list into a multiselect combo
NEW: conf TIMESPENT_ALWAYS_UPDATE_THM, when it's on we always check current thm of user to update it in task time line
NEW: constant PROPAL_NEW_AS_SIGNED
NEW: show date delivery planned on orders linked to company and product
NEW: Default values in extrafields are not more limited to 255 char.
NEW: display currency in takepos menu
NEW: Enable online signature for interventions
NEW: Encrypt all sensitive constants in llx_const
NEW: extrafield price with currency
NEW: filter on reception dates (from / to) in cheque paiement card
NEW: Contracts: Default template of contract is not mandatory
NEW: Contracts: Manage Position (Rank) on Contract Lines
NEW: EMail-Collector: add IMAP port setting
NEW: EMail-Collector: add a button "Test collect"
NEW: Members: default_lang for members
NEW: Members: Table of membership types
NEW: Members: add free membership amounts at the membership type level
NEW: Projects: add author on list
NEW: Proposals: show delivery mode on PDF for proposals
NEW: Reception: add a from/to on search on date field
NEW: TakePOS: Header Scroll in TakePOS
NEW: TakePOS: add price to product box in TakePOS
NEW: TakePOS: add setup parameters, can setup terminal name
NEW: TakePOS: support of Stripe Terminal with TakePOS
NEW: TakePOS: Receipt preview in TakePOS setup
NEW: TakePOS: different product list on smartphone
NEW: Website: can delete a whole website if disabled
NEW: Website: can remove a website template
NEW: Website: can set header "Strict-Transport-Security" in web sites.
NEW: Website: can switch status of website and page from the website toolbar
NEW: Website: Templates of websites are now directories and not zip into core repo
NEW: Website: add 4 other templates in website module
NEW: If we select another view list mode, we keep it
NEW: Init module bookcal
NEW: Introduce dolEncrypt and dolDecrypt to be able to encrypt data in db
NEW: Accountancy - Add a graphic option to enable lettering function - FPC21
NEW: Accountancy - Add a way to clean some words when you generate thirdparty accounting account
NEW: Accountancy - Added an option during export to export or not the lettering FPC21
NEW: Accountancy - Manage supplier deposit with specific account
NEW: Accountancy - Model Digitaria - Add a way to clean some words when you generate thirdparty accounting account FPC22
NEW: Bank - add salaries & VAT in tab planned entries
NEW: Contracts - Default template of contract is not mandatory
NEW: Contracts - Manage Position (Rank) on Contract Lines
NEW: EMail - can copy/paste images into emails sent
NEW: EMail - can edit label of an emailing even once sent
NEW: EMail - can send an email on scheduled job error
NEW: EMail-Collector - add IMAP port setting
NEW: EMail-Collector - add a button "Test collect"
NEW: Event-Organization - add date event (!= date project) and location on event organization
NEW: Extrafields - add badge in admin extrafields setup
NEW: Extrafields - can edit property css, cssview, csslist on extrafields
NEW: Extrafields - default values in extrafields are not more limited to 255 char.
NEW: Extrafields - field price with currency
NEW: Extrafields - support IP type to store IP addresses
NEW: Interventions - enable online signature for interventions
NEW: Invoice - Add french mention on pdf when vat debit option is on
NEW: Members - default_lang for members
NEW: Members - Table of membership types
NEW: Members - add free membership amounts at the membership type level
NEW: Projects - add author on list
NEW: Projects - add the thirdparty column to the time list (projet/tasks/time.php)
NEW: Proposals - show delivery mode on PDF for proposals
NEW: Proposals - skip accept/refuse process for proposals (option PROPAL_SKIP_ACCEPT_REFUSE)
NEW: Reception - add a from/to on search on date field
NEW: Stock - page for mass stock transfer can be used with no source stock
NEW: Stock - product categories filter on inventory list
NEW: Stock - show product label on inventory
NEW: Stock - manage virtual stock at a future date
NEW: TakePOS - add margin infos to TakePOS invoice lines
NEW: TakePOS - display currency in TakePOS menu
NEW: TakePOS - Header Scroll in TakePOS
NEW: TakePOS - add price to product box in TakePOS
NEW: TakePOS - add setup parameters, can setup terminal name
NEW: TakePOS - support of Stripe Terminal with TakePOS
NEW: TakePOS - Receipt preview in TakePOS setup
NEW: TakePOS - different product list on smartphone
NEW: Thirdparty - set thirdparty type with company modify trigger
NEW: Website - can delete a whole website if disabled
NEW: Website - can remove a website template
NEW: Website - can set header "Strict-Transport-Security" in web sites.
NEW: Website - can switch status of website and page from the website toolbar
NEW: Website - Templates of websites are now directories and not zip into core repo
NEW: Website - add 4 other templates in website module
NEW: General - Bulk action to remove a category in list/search website pages
NEW: General - If we select another view list mode, we keep it
NEW: General - Introduce dolEncrypt and dolDecrypt to be able to encrypt data in db
NEW: invoice export : add accounting affectation
NEW: label on products categories filter
NEW: The link "add to bookmark" is always on top in the bookmark popup
NEW: MAIN_SEARCH_CATEGORY_PRODUCT_ON_LISTS const to show category customer filter
NEW: Make module WebservicesClient deprecated. Use module WebHook instead.
NEW: manage no email with thirdparties (better for GDPR)
NEW: Manage VAT on all lines on purchases cycle
NEW: manage virtual stock at a future date
NEW: On a bank reconciled line, we can modify the bank receipt
NEW: On a form to send an email, we show all emails of all contacts of object
NEW: Option PRODUCTBATCH_SHOW_WAREHOUSE_ON_SHIPMENT showing wh on PDF
NEW: Option PRODUIT_DESC_IN_FORM accept (desktop only or +smartphone)
NEW: Page for mass stock transfer can be used with no source stock
NEW: parent company column and filter in invoice and order list
NEW: Add show "Sales rep" option for PDF
NEW: Picto for shared link is clickable
NEW: possibility to select scopes with checkbox for Oauth tokens
NEW: private and public note on user, thirdparty and contact list
NEW: product categories filter on inventory list
NEW: Product supplier price: autofill default supplier VAT
NEW: Public counters feature
NEW: Start a simple support of recurrent events on agenda
@ -156,31 +157,36 @@ NEW: Resize parent company column in order list
NEW: Saved token of OAUTH module are now encrypted into llx_oauth_token
NEW: Save one click to select on delivery ack, on emails.
NEW: scheduled job to send unpaid invoice reminder can now use the cc and bcc from email template
NEW: set thirdparty type with company modify trigger
NEW: Show also scheduled task never finished in scheduled task widget
NEW: show badge with number of extrafields in setup
NEW: show category tree in sellist and chkbxlst for common object
NEW: Show picto and color into combo for selection of tags
NEW: show product label on inventory
NEW: show sell-by and eat-by dates only if not empty
NEW: show SellBy/EatBy dates for each batch product in shipment card
NEW: skip accept/refuse process for proposals (option PROPAL_SKIP_ACCEPT_REFUSE)
NEW: experimental SMTP using PhpImap allowing OAuth2 authentication (need to add option MAIN_IMAP_USE_PHPIMAP)
NEW: can substitue project title in mail template
NEW: Supplier order list - Add column private and public note
NEW: Support IP type in extrafields
NEW: The purge of files can purge only if older than a number of seconds
NEW: Update ActionComm type_code on email message ticket
NEW: VAT - Admin - Add information on deadline day for submission of VAT declaration
NEW: expand/collapse permissions on user permission page
NEW: Add the target to select attendees of event for emailings
Option / Const for System:
NEW: MAIN_SEARCH_CATEGORY_PRODUCT_ON_LISTS const to show category customer filter
NEW: PRODUCTBATCH_SHOW_WAREHOUSE_ON_SHIPMENT showing warehouse on PDF
NEW: PRODUIT_DESC_IN_FORM accept (desktop only or +smartphone)
NEW: PROPAL_NEW_AS_SIGNED
NEW: TIMESPENT_ALWAYS_UPDATE_THM, when it's on we always check current thm of user to update it in task time line
Localisation:
NEW: adding JAPAN Chart-of-Account and regions/departments
NEW: adding NIF verification for Algeria
Modules
NEW: Experimental module Asset
NEW: Init module bookcal
NEW: Make module WebservicesClient deprecated. Use module WebHook instead.
For developers or integrators:
@ -190,20 +196,26 @@ NEW: ModuleBuilder can generate code of class from an existing SQL table
NEW: #20912 Add trigger to record the event of sending an email from a project
NEW: #21750 Added "Get lines and Post lines from BOM" at the REST Service
NEW: #22370 Modulebuilder supports 'alwayseditable' (like extrafields)
NEW: Removed completely the need for the library adodbtime
NEW: hook on agenda pages
NEW: hook to complete payment in TakePOS
NEW: hook "changeHelpURL" to modify target of the help button
NEW: hook formConfirm on action comm card
NEW: hook to modify supplier product html select
NEW: Add new hook for show virtual stock details on product stock card
NEW: Add new hooks for actioncomm
NEW: conf->global->SYSLOG_FILE_ONEPERSESSION accept a string
NEW: translate for contact type API, setup/ticket API, shipping method API
NEW: All ajax pages have now a top_httphead()
NEW: support multilang in Civilities API
API:
NEW: Add API for the partnership module
NEW: Add "Get lines and Post lines from BOM" in the API
NEW: translate for contact type API, setup/ticket API, shipping method API
NEW: support multilang in Civilities API
Hooks:
NEW: Actioncomm - add new hooks for actioncomm
NEW: Actioncomm - hook formConfirm on action comm card
NEW: Agenda - hook on agenda pages
NEW: Help - hook "changeHelpURL" to modify target of the help button
NEW: Product - add hook to show virtual stock details on product stock card
NEW: Product - add hook to modify supplier product html select
NEW: TakePOS - add hook to complete payment in TakePOS
NEW: Removed completely the need for the library adodbtime
NEW: Replace fk_categories_product with categories_product in inventory
NEW: Rewrite of SQL request. Removed the join on category (for filter on categ), replaced with a EXISTS/NOT

View File

@ -53,16 +53,17 @@ ONLY vulnerabilities discovered, when the following setup on test platform is us
* $dolibarr_nocsrfcheck must be kept to the value 0 into conf.php (this is the default value)
* $dolibarr_main_force_https must be set to something else than 0.
* The constant MAIN_SECURITY_CSRF_WITH_TOKEN must be set to 3 into backoffice menu Home - Setup - Other (this protection should be set to 3 soon by default)
* The module DebugBar and ModuleBuilder must NOT be enabled (by default, these modules are not enabled. They are developer tools)
* ONLY security reports on modules provided by default and with the "stable" status are valid (troubles into "experimental", "developement" or external modules are not valid vulnerabilities).
* The root of web server must link to htdocs and the documents directory must be outside of the web server root (this is the default when using the default installer but may differs with external installer).
* The web server setup must be done so that only the documents directory is in write mode. The root directory called htdocs must be read-only.
* CSRF attacks are accepted but double check that you have set MAIN_SECURITY_CSRF_WITH_TOKEN to value 3.
* The module DebugBar and ModuleBuilder must NOT be enabled (by default, these modules are not enabled. They are developer tools)
* Ability for a high level user to edit web site pages into the CMS by including HTML or Javascript is an expected feature. Vulnerabilities into the website module are validated only if HTML or Javascript injection can be done by a non allowed user.
* Fail2ban rules for rate limit on the login page,password forgotten page and all public pages (/public/*) must be installed as recommendend into the section "About - Admin tools - Section Access limits and mitigation".
Scope is the web application (back office) and the APIs.
## Qualifying vulnerabilities for reporting
## Example of vulnerabilities Qualified for reporting.
* Remote code execution (RCE)
* Local files access and manipulation (LFI, RFI, XXE, SSRF, XSPA)
@ -78,7 +79,7 @@ Scope is the web application (back office) and the APIs.
* Software version disclosure (for non admin users only)
* Stack traces or path disclosure (for non admin users only)
## Non-qualifying vulnerabilities for reporting
## Example of vulnerabilities non Non-qualified for reporting.
* "Self" XSS
* SSL/TLS best practices
@ -95,3 +96,4 @@ Scope is the web application (back office) and the APIs.
* Software version or private IP disclosure when logged user is admin
* Stack traces or path disclosure when logged user is admin
* Any vulnerabilities due to a configuration different than the one defined into chapter "Scope for qualified vulnerabilities".
* Brute force attacks on login page, password forgotten page or any public pages (/public/*) are not qualified if the fail2ban recommended fail2ban rules were not installed.

View File

@ -1,4 +1,4 @@
FROM php:7.3-apache
FROM php:8.1-apache-bullseye
ENV PHP_INI_DATE_TIMEZONE 'UTC'
ENV PHP_INI_MEMORY_LIMIT 256M
@ -25,7 +25,7 @@ RUN apt-get update -y \
mailutils \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/* \
&& docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) calendar intl mysqli pdo_mysql gd soap zip \
&& docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ \
&& docker-php-ext-install -j$(nproc) ldap && \

View File

@ -25,7 +25,7 @@ The URL to go to the Dolibarr is :
The URL to go to PhpMyAdmin is (login/password is root/root) :
http://0.0.0.0:8080
In Dolibarr configuration Email let PHP mail function, To see all mail send by Dolibarr go to maildev
http://0.0.0.0:8081

View File

@ -34,6 +34,8 @@ services:
build: .
environment:
HOST_USER_ID: $HOST_USER_ID
PHP_INI_DATE_TIMEZONE: $PHP_INI_DATE_TIMEZONE
PHP_INI_MEMORY_LIMIT: $PHP_INI_MEMORY_LIMIT
volumes:
- ../../htdocs:/var/www/html/
- ../../documents:/var/documents

View File

@ -15,10 +15,10 @@ fi
echo "[docker-run] => Set Permission to www-data for /var/documents"
chown -R www-data:www-data /var/documents
if [ ! -f /usr/local/etc/php/php.ini ]; then
cat <<EOF > /usr/local/etc/php/php.ini
date.timezone = $PHP_INI_DATE_TIMEZONE
echo "[docker-run] => update ${PHP_INI_DIR}/conf.d/dolibarr-php.ini"
cat <<EOF > ${PHP_INI_DIR}/conf.d/dolibarr-php.ini
date.timezone = ${PHP_INI_DATE_TIMEZONE:-UTC}
memory_limit = ${PHP_INI_MEMORY_LIMIT:-256M}
EOF
fi
exec apache2-foreground

View File

@ -10,8 +10,7 @@ Signification des chiffres.
- 1 chiffre pour la somme de controle
Cette regle subit de nombreuses entorses pour ameliorer l'usage des chiffres disponibles.
Voici la liste des codes pays ou systeme :
Voici la liste des codes pays ou systeme, les préfixes qui ne sont pas explicitement mentionnés sont réservés par GS1 :
EN
@ -25,105 +24,139 @@ Meaning of the numbers:
This rule has been twisted many times to improve the use of the available numbers.
Here is the list of country codes or system:
Here is the list of country codes or system, prefixes not explicitly listed are reserved by GS1:
List
====
List (https://www.gs1.org/prefixes)
===================================
00 - 13 UCC (U.S.A / États-Unis & Canada)
20 - 29 Flag for internal numbering / Codification interne en magasin
30 - 37 GENCOD-EAN France
380 BCCI (Bulgaria)
383 SANA (Slovenia)
385 CRO-EAN (Croatia)
387 EAN-BIH (Bosnia-Herzegovina)
400-440 CCG (DE/Germany/Allemagne)
45 + 49 Distribution Code Center - DCC (Japan)
460-469 UNISCAN - EAN Russia (Federation de Russie)
471 CAN Taiwan
474 EAN Estonia
475 EAN Latvia
476 EAN Azerbaijan
477 EAN Lithuania
478 EAN Uzbekistan
479 EAN Sri Lanka
480 PANC Philippines
481 EAN Belarus
482 EAN Ukraine
484 EAN Moldova
485 EAN Armenia
486 EAN Georgia
487 EAN Kazakhstan
489 HKANA Hong Kong
50 E Centre UK - United Kingdom
520 HELLCAN-EAN HELLAS - Greece
528 EAN Lebanon
529 EAN Cyprus
531 EAN-MAC (FYR Macedonia)
535 EAN Malta
539 EAN Ireland
54 ICODIF/EAN Belgium & Luxembourg
560 CODIPOR (Portugal)
569 EAN Iceland/Islande
57 EAN Denmark
590 EAN Poland
594 EAN Romania
599 H.A.P.M.H. (Hungary)
600-601 EAN South Africa
609 EAN Mauritius Island
611 EAN Morocco
613 EAN Algeria
619 Tunicode (Tunisia)
621 EAN Syria
622 EAN Egypt
625 EAN Jordan/Jordanie
626 EAN Iran
628 EAN Saudi Arabia
64 EAN Finland
690-693 ANCC - Article Numbering Centre of China
70 EAN Norge (Norvege)
729 Israeli Bar Code Association - EAN Israel
73 EAN Suede
740 EAN Guatemala
741 EAN El Salvador
742 ICCC (Honduras)
743 EAN Nicaragua
744 EAN Costa Rica Panama
746 746 EAN Republique Dominicaine
750 AMECE (Mexique)
759 EAN Venezuela
76 EAN (Schweiz, Suisse, Svizzera)
770 IAC (Colombie)
773 EAN Uruguay
775 APC - EAN Peru (Perou)
777 EAN Bolivie
779 CODIGO - EAN Argentine
780 EAN Chili
784 EAN Paraguay
786 ECOP (Equateur)
789 EAN Bresil
80 - 83 INDICOD (Italy)
84 AECOC (Espagne)
850 Camera de Comercio de la Republica de Cuba (Cuba)
858 EAN Slovaquie
859 EAN Republique Tcheque
860 EAN YU (Yougoslavie)
867 EAN DPR Korea (Coree du Nord)
869 Union of Chambers of Commerce of Turkey (Turquie)
87 EAN Nederland (Hollande)
880 EAN Korea (Coree du Sud)
885 EAN Thailande
888 SANC (Singapour)
890 EAN Inde
893 EAN Vietnam
899 EAN Indonesie
90 - 91 EAN Autriche
93 EAN Australie
94 EAN Nouvelle Zelande
955 Malaysian Article Numbering Council (MANC) - Malaisie
977 Publications sirielles (ISSN)
978 - 979 Livres (ISBN)
980 Refus de remboursement
981 - 982 Coupons (monnaie courante)
99 Coupons
0000000 Flag for internal numbering / Codification interne en magasin
0000101999 GS1 US (U.S.A / États-Unis & Canada)
020-029 Restricted / Restreint
030-039 GS1 US (U.S.A / États-Unis & Canada)
040-049 Flag for internal numbering / Codification interne en magasin
050-059 GS1 US (U.S.A / États-Unis & Canada)
060-139 GS1 US (U.S.A / États-Unis & Canada)
300-379 GS1 France
380 GS1 Bulgaria
383 GS1 Slovenija
385 GS1 Croatia
387 GS1 BIH (Bosnia-Herzegovina)
389 GS1 Montenegro
400-440 GS1 Germany
450-459 GS1 Japan
460-469 GS1 Russia
470 GS1 Kyrgyzstan
471 GS1 Chinese Taipei
474 GS1 Estonia
475 GS1 Latvia
476 GS1 Azerbaijan
477 GS1 Lithuania
478 GS1 Uzbekistan
479 GS1 Sri Lanka
480 GS1 Philippines
481 GS1 Belarus
482 GS1 Ukraine
483 GS1 Turkmenistan
484 GS1 Moldova
485 GS1 Armenia
486 GS1 Georgia
487 GS1 Kazakstan
488 GS1 Tajikistan
489 GS1 Hong Kong, China
490-499 GS1 Japan
500-509 GS1 UK
520-521 GS1 Association Greece
528 GS1 Lebanon
529 GS1 Cyprus
530 GS1 Albania
531 GS1 Macedonia
535 GS1 Malta
539 GS1 Ireland
540-549 GS1 Belgium & Luxembourg
560 GS1 Portugal
569 GS1 Iceland
570-579 GS1 Denmark
590 GS1 Poland
594 GS1 Romania
599 GS1 Hungary
600-601 GS1 South Africa
603 GS1 Ghana
604 GS1 Senegal
607 GS1 Oman
608 GS1 Bahrain
609 GS1 Mauritius
611 GS1 Morocco
613 GS1 Algeria
615 GS1 Nigeria
616 GS1 Kenya
617 GS1 Cameroon
618 GS1 Côte d'Ivoire
619 GS1 Tunisia
620 GS1 Tanzania
621 GS1 Syria
622 GS1 Egypt
624 GS1 Libya
625 GS1 Jordan
626 GS1 Iran
627 GS1 Kuwait
628 GS1 Saudi Arabia
629 GS1 Emirates
630 GS1 Qatar
631 GS1 Namibia
640-649 GS1 Finland
690-699 GS1 China
700-709 GS1 Norway
729 GS1 Israel
730-739 GS1 Sweden
740 GS1 Guatemala
741 GS1 El Salvador
742 GS1 Honduras
743 GS1 Nicaragua
744 GS1 Costa Rica
745 GS1 Panama
746 GS1 Republica Dominicana
750 GS1 Mexico
754-755 GS1 Canada
759 GS1 Venezuela
760-769 GS1 Schweiz, Suisse, Svizzera
770-771 GS1 Colombia
773 GS1 Uruguay
775 GS1 Peru
777 GS1 Bolivia
778-779 GS1 Argentina
780 GS1 Chile
784 GS1 Paraguay
786 GS1 Ecuador
789-790 GS1 Brasil
800-839 GS1 Italy
840-849 GS1 Spain
850 GS1 Cuba
858 GS1 Slovakia
859 GS1 Czech
860 GS1 Serbia
865 GS1 Mongolia
867 GS1 North Korea
868-869 GS1 Türkiye
870-879 GS1 Netherlands
880 GS1 South Korea
883 GS1 Myanmar
884 GS1 Cambodia
885 GS1 Thailand
888 GS1 Singapore
890 GS1 India
893 GS1 Vietnam
896 GS1 Pakistan
899 GS1 Indonesia
900-919 GS1 Austria
930-939 GS1 Australia
940-949 GS1 New Zealand
950 GS1 Global Office
955 GS1 Malaysia
958 GS1 Macao, China
960-969 Global Office - GTIN-8
977 Serial publications / Publications en série (ISSN)
978-979 Bookland / Livres (ISBN)
980 Refund receipts / Remboursements
981-983 GS1 Coupons
99 GS1 Coupons

View File

@ -19,17 +19,18 @@
/**
* \file htdocs/accountancy/admin/subaccount.php
* \ingroup Accountancy (Double entries)
* \brief List of accounting sub-account (auxiliary accounts)
* \ingroup Accountancy (Double entries)
* \brief List of accounting sub-account (auxiliary accounts)
*/
// Load Dolibarr environment
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("compta", "bills", "admin", "accountancy", "salaries", "hrm", "errors"));
$langs->loadLangs(array("accountancy", "admin", "bills", "compta", "errors", "hrm", "salaries"));
$mesg = '';
$action = GETPOST('action', 'aZ09');
@ -81,6 +82,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL < 2) {
unset($arrayfields['reconcilable']);
}
/*
* Actions
*/
@ -120,11 +122,13 @@ if (empty($reshook)) {
$form = new Form($db);
$help_url = '';
$title = $langs->trans('ChartOfIndividualAccountsOfSubsidiaryLedger');
// Page Header
$help_url = 'EN:Module_Double_Entry_Accounting#Setup';
$title = $langs->trans('ChartOfIndividualAccountsOfSubsidiaryLedger');
llxHeader('', $title, $help_url);
// Customer
$sql = "SELECT sa.rowid, sa.nom as label, sa.code_compta as subaccount, '1' as type, sa.entity";
$sql .= " FROM ".MAIN_DB_PREFIX."societe sa";
@ -219,7 +223,7 @@ if (!empty($search_type) && $search_type >= 0) {
$sql .= " HAVING type LIKE '".$db->escape($search_type)."'";
}
// User
// User - Employee
$sql .= " UNION ";
$sql .= " SELECT u.rowid, u.lastname as label, u.accountancy_code as subaccount, '3' as type, u.entity FROM ".MAIN_DB_PREFIX."user u";
$sql .= " WHERE u.entity IN (".getEntity('user').")";
@ -400,6 +404,7 @@ if ($resql) {
if (!empty($arrayfields['type']['checked'])) {
print '<td class="center">';
$s = '';
// Customer
if ($obj->type == 1) {
$s .= '<a class="customer-back" style="padding-left: 6px; padding-right: 6px" title="'.$langs->trans("Customer").'" href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->rowid.'">'.$langs->trans("Customer").'</a>';
@ -407,7 +412,7 @@ if ($resql) {
// Supplier
$s .= '<a class="vendor-back" style="padding-left: 6px; padding-right: 6px" title="'.$langs->trans("Supplier").'" href="'.DOL_URL_ROOT.'/fourn/card.php?socid='.$obj->rowid.'">'.$langs->trans("Supplier").'</a>';
} elseif ($obj->type == 3) {
// User
// User - Employee
$s .= '<a class="user-back" style="padding-left: 6px; padding-right: 6px" title="'.$langs->trans("Employee").'" href="'.DOL_URL_ROOT.'/user/card.php?id='.$obj->rowid.'">'.$langs->trans("Employee").'</a>';
}
print $s;
@ -440,6 +445,7 @@ if ($resql) {
// Action
print '<td class="center">';
$e = '';
// Customer
if ($obj->type == 1) {
$e .= '<a class="editfielda" title="'.$langs->trans("Customer").'" href="'.DOL_URL_ROOT.'/societe/card.php?action=edit&token='.newToken().'&socid='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_edit().'</a>';
@ -447,7 +453,7 @@ if ($resql) {
// Supplier
$e .= '<a class="editfielda" title="'.$langs->trans("Supplier").'" href="'.DOL_URL_ROOT.'/societe/card.php?action=edit&token='.newToken().'&socid='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_edit().'</a>';
} elseif ($obj->type == 3) {
// User
// User - Employee
$e .= '<a class="editfielda" title="'.$langs->trans("Employee").'" href="'.DOL_URL_ROOT.'/user/card.php?action=edit&token='.newToken().'&id='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_edit().'</a>';
}
print $e;

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2016-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2016-2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -42,22 +42,13 @@ $langs->loadLangs(array("accountancy", "compta"));
$action = GETPOST('action', 'aZ09');
$optioncss = GETPOST('optioncss', 'alpha');
$contextpage = GETPOST('contextpage', 'aZ09');
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) {
$page = 0;
} // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
//if (! $sortfield) $sortfield="p.date_fin";
//if (! $sortorder) $sortorder="DESC";
$type = GETPOST('type', 'alpha');
if ($type == 'sub') {
$context_default = 'balancesubaccountlist';
} else {
$context_default = 'balancelist';
}
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : $context_default;
$show_subgroup = GETPOST('show_subgroup', 'alpha');
$search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int'));
$search_date_end = dol_mktime(23, 59, 59, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'));
@ -70,10 +61,29 @@ $search_accountancy_code_end = GETPOST('search_accountancy_code_end', 'alpha');
if ($search_accountancy_code_end == - 1) {
$search_accountancy_code_end = '';
}
$search_not_reconciled = GETPOST('search_not_reconciled', 'alpha');
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) {
$page = 0;
} // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if ($sortorder == "") {
$sortorder = "ASC";
}
if ($sortfield == "") {
$sortfield = "t.numero_compte";
}
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$object = new BookKeeping($db);
$hookmanager->initHooks(array('balancelist')); // Note that conf->hooks_modules contains array
$hookmanager->initHooks(array($contextpage)); // Note that conf->hooks_modules contains array
$formaccounting = new FormAccounting($db);
$formother = new FormOther($db);
@ -84,6 +94,7 @@ if (empty($search_date_start) && !GETPOSTISSET('formfilteraction')) {
$sql .= " WHERE date_start < '".$db->idate(dol_now())."' AND date_end > '".$db->idate(dol_now())."'";
$sql .= $db->plimit(1);
$res = $db->query($sql);
if ($res->num_rows > 0) {
$fiscalYear = $db->fetch_object($res);
$search_date_start = strtotime($fiscalYear->date_start);
@ -104,45 +115,6 @@ if (empty($search_date_start) && !GETPOSTISSET('formfilteraction')) {
$search_date_end = dol_get_last_day($year_end, $month_end);
}
}
if ($sortorder == "") {
$sortorder = "ASC";
}
if ($sortfield == "") {
$sortfield = "t.numero_compte";
}
$param = '';
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
}
$filter = array();
if (!empty($search_date_start)) {
$filter['t.doc_date>='] = $search_date_start;
$param .= '&date_startmonth='.GETPOST('date_startmonth', 'int').'&date_startday='.GETPOST('date_startday', 'int').'&date_startyear='.GETPOST('date_startyear', 'int');
}
if (!empty($search_date_end)) {
$filter['t.doc_date<='] = $search_date_end;
$param .= '&date_endmonth='.GETPOST('date_endmonth', 'int').'&date_endday='.GETPOST('date_endday', 'int').'&date_endyear='.GETPOST('date_endyear', 'int');
}
if (!empty($search_accountancy_code_start)) {
$filter['t.numero_compte>='] = $search_accountancy_code_start;
$param .= '&search_accountancy_code_start='.urlencode($search_accountancy_code_start);
}
if (!empty($search_accountancy_code_end)) {
$filter['t.numero_compte<='] = $search_accountancy_code_end;
$param .= '&search_accountancy_code_end='.urlencode($search_accountancy_code_end);
}
if (!empty($search_ledger_code)) {
$filter['t.code_journal'] = $search_ledger_code;
foreach ($search_ledger_code as $code) {
$param .= '&search_ledger_code[]='.urlencode($code);
}
}
if (!isModEnabled('accounting')) {
accessforbidden();
@ -154,14 +126,13 @@ if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
accessforbidden();
}
/*
* Action
*/
$parameters = array();
$arrayfields = array();
$param = '';
$parameters = array('socid'=>$socid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
@ -172,16 +143,67 @@ if (empty($reshook)) {
$show_subgroup = '';
$search_date_start = '';
$search_date_end = '';
$search_date_startyear = '';
$search_date_startmonth = '';
$search_date_startday = '';
$search_date_endyear = '';
$search_date_endmonth = '';
$search_date_endday = '';
$search_accountancy_code_start = '';
$search_accountancy_code_end = '';
$search_not_reconciled = '';
$search_ledger_code = array();
$filter = array();
}
}
/*
* View
*/
// Must be after the remove filter action, before the export.
$filter = array();
if (!empty($search_date_start)) {
$filter['t.doc_date>='] = $search_date_start;
$param .= '&amp;date_startmonth=' . GETPOST('date_startmonth', 'int') . '&amp;date_startday=' . GETPOST('date_startday', 'int') . '&amp;date_startyear=' . GETPOST('date_startyear', 'int');
}
if (!empty($search_date_end)) {
$filter['t.doc_date<='] = $search_date_end;
$param .= '&amp;date_endmonth=' . GETPOST('date_endmonth', 'int') . '&amp;date_endday=' . GETPOST('date_endday', 'int') . '&amp;date_endyear=' . GETPOST('date_endyear', 'int');
}
if (!empty($search_doc_date)) {
$filter['t.doc_date'] = $search_doc_date;
$param .= '&doc_datemonth=' . GETPOST('doc_datemonth', 'int') . '&doc_dateday=' . GETPOST('doc_dateday', 'int') . '&doc_dateyear=' . GETPOST('doc_dateyear', 'int');
}
if (!empty($search_accountancy_code_start)) {
if ($type == 'sub') {
$filter['t.subledger_account>='] = $search_accountancy_code_start;
} else {
$filter['t.numero_compte>='] = $search_accountancy_code_start;
}
$param .= '&amp;search_accountancy_code_start=' . urlencode($search_accountancy_code_start);
}
if (!empty($search_accountancy_code_end)) {
if ($type == 'sub') {
$filter['t.subledger_account<='] = $search_accountancy_code_end;
} else {
$filter['t.numero_compte<='] = $search_accountancy_code_end;
}
$param .= '&amp;search_accountancy_code_end=' . urlencode($search_accountancy_code_end);
}
if (!empty($search_ledger_code)) {
$filter['t.code_journal'] = $search_ledger_code;
foreach ($search_ledger_code as $code) {
$param .= '&search_ledger_code[]=' . urlencode($code);
}
}
if (!empty($search_not_reconciled)) {
$filter['t.reconciled_option'] = $search_not_reconciled;
$param .= '&search_not_reconciled='.urlencode($search_not_reconciled);
}
// param with type of list
$url_param = substr($param, 1); // remove first "&"
if (!empty($type)) {
$param = '&type=' . $type . $param;
}
}
if ($action == 'export_csv') {
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
@ -190,14 +212,23 @@ if ($action == 'export_csv') {
$type_export = 'balance';
include DOL_DOCUMENT_ROOT.'/accountancy/tpl/export_journal.tpl.php';
$result = $object->fetchAllBalance($sortorder, $sortfield, $limit, 0, $filter);
if ($type == 'sub') {
$result = $object->fetchAllBalance($sortorder, $sortfield, $limit, 0, $filter, 'AND', 1);
} else {
$result = $object->fetchAllBalance($sortorder, $sortfield, $limit, 0, $filter);
}
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
foreach ($object->lines as $line) {
print '"'.length_accountg($line->numero_compte).'"'.$sep;
print '"'.$object->get_compte_desc($line->numero_compte).'"'.$sep;
if ($type == 'sub') {
print '"' . length_accounta($line->subledger_account) . '"' . $sep;
print '"' . $line->subledger_label . '"' . $sep;
} else {
print '"' . length_accountg($line->numero_compte) . '"' . $sep;
print '"' . $object->get_compte_desc($line->numero_compte) . '"' . $sep;
}
print '"'.price($line->debit).'"'.$sep;
print '"'.price($line->credit).'"'.$sep;
print '"'.price($line->debit - $line->credit).'"'.$sep;
@ -207,8 +238,15 @@ if ($action == 'export_csv') {
exit;
}
/*
* View
*/
$title_page = $langs->trans("AccountBalance");
if ($type == 'sub') {
$title_page = $langs->trans("AccountBalanceSubAccount");
} else {
$title_page = $langs->trans("AccountBalance");
}
llxHeader('', $title_page);
@ -217,39 +255,52 @@ if ($action != 'export_csv') {
// List
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$nbtotalofrecords = $object->fetchAllBalance($sortorder, $sortfield, 0, 0, $filter);
if ($type == 'sub') {
$nbtotalofrecords = $object->fetchAllBalance($sortorder, $sortfield, 0, 0, $filter, 'AND', 1);
} else {
$nbtotalofrecords = $object->fetchAllBalance($sortorder, $sortfield, 0, 0, $filter);
}
if ($nbtotalofrecords < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
}
$result = $object->fetchAllBalance($sortorder, $sortfield, $limit, $offset, $filter);
if ($type == 'sub') {
$result = $object->fetchAllBalance($sortorder, $sortfield, $limit, $offset, $filter, 'AND', 1);
} else {
$result = $object->fetchAllBalance($sortorder, $sortfield, $limit, $offset, $filter);
}
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" id="action" value="list">';
if ($optioncss != '') {
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
}
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" id="action" value="list">';
print '<input type="hidden" name="type" value="'.$type.'">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
$parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtonsList', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
$button = empty($hookmanager->resPrint) ? '' : $hookmanager->resPrint;
$newcardbutton = empty($hookmanager->resPrint) ? '' : $hookmanager->resPrint;
if (empty($reshook)) {
$button .= '<input type="button" id="exportcsvbutton" name="exportcsvbutton" class="butAction" value="'.$langs->trans("Export").' ('.$conf->global->ACCOUNTING_EXPORT_FORMAT.')" />';
$newcardbutton = '<input type="button" id="exportcsvbutton" name="exportcsvbutton" class="butAction" value="'.$langs->trans("Export").' ('.$conf->global->ACCOUNTING_EXPORT_FORMAT.')" />';
print '<script type="text/javascript">
jQuery(document).ready(function() {
@ -262,12 +313,32 @@ if ($action != 'export_csv') {
});
});
</script>';
if ($type == 'sub') {
$newcardbutton .= dolGetButtonTitle($langs->trans('AccountBalance')." - ".$langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/balance.php?' . $url_param, '', 1, array('morecss' => 'marginleftonly'));
$newcardbutton .= dolGetButtonTitle($langs->trans('AccountBalance')." - ".$langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/balance.php?type=sub&' . $url_param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
} else {
$newcardbutton .= dolGetButtonTitle($langs->trans('AccountBalance')." - ".$langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/balance.php?' . $url_param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
$newcardbutton .= dolGetButtonTitle($langs->trans('AccountBalance')." - ".$langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/balance.php?type=sub&' . $url_param, '', 1, array('morecss' => 'marginleftonly'));
}
$newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?action=create');
}
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
}
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $button, $result, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1);
$selectedfields = '';
// Warning to explain why list of record is not consistent with the other list view (missing a lot of lines)
if ($type == 'sub') {
print info_admin($langs->trans("WarningRecordWithoutSubledgerAreExcluded"));
}
$moreforfilter = '';
$moreforfilter .= '<div class="divsearchfield">';
@ -275,18 +346,38 @@ if ($action != 'export_csv') {
$moreforfilter .= $form->selectDate($search_date_start ? $search_date_start : -1, 'date_start', 0, 0, 1, '', 1, 0);
$moreforfilter .= $langs->trans('DateEnd').': ';
$moreforfilter .= $form->selectDate($search_date_end ? $search_date_end : -1, 'date_end', 0, 0, 1, '', 1, 0);
$moreforfilter .= ' - ';
$moreforfilter .= '<label for="show_subgroup">'.$langs->trans('ShowSubtotalByGroup').'</label>: ';
$moreforfilter .= '<input type="checkbox" name="show_subgroup" id="show_subgroup" value="show_subgroup"'.($show_subgroup == 'show_subgroup' ? ' checked' : '').'>';
$moreforfilter .= '</div>';
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= '<label for="show_subgroup">'.$langs->trans('ShowSubtotalByGroup').'</label>: ';
$moreforfilter .= '<input type="checkbox" name="show_subgroup" id="show_subgroup" value="show_subgroup"'.($show_subgroup == 'show_subgroup' ? ' checked' : '').'>';
$moreforfilter .= '</div>';
$moreforfilter .= $langs->trans("Journal");
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans("Journals").': ';
$moreforfilter .= $formaccounting->multi_select_journal($search_ledger_code, 'search_ledger_code', 0, 1, 1, 1);
$moreforfilter .= '</div>';
$moreforfilter .= '</br>';
$moreforfilter .= '<div class="divsearchfield">';
// Accountancy account
$moreforfilter .= $langs->trans('AccountAccounting').': ';
if ($type == 'sub') {
$moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_start, 'search_accountancy_code_start', $langs->trans('From'), 'maxwidth200');
} else {
$moreforfilter .= $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', $langs->trans('From'), array(), 1, 1, 'maxwidth200', 'accounts');
}
$moreforfilter .= ' ';
if ($type == 'sub') {
$moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_end, 'search_accountancy_code_end', $langs->trans('to'), 'maxwidth200');
} else {
$moreforfilter .= $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', $langs->trans('to'), array(), 1, 1, 'maxwidth200', 'accounts');
}
$moreforfilter .= '</div>';
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= '<label for="notreconciled">'.$langs->trans('NotReconciled').'</label>: ';
$moreforfilter .= '<input type="checkbox" name="search_not_reconciled" id="notreconciled" value="notreconciled"'.($search_not_reconciled == 'notreconciled' ? ' checked' : '').'>';
$moreforfilter .= '</div>';
if (!empty($moreforfilter)) {
@ -305,9 +396,6 @@ if ($action != 'export_csv') {
print '<tr class="liste_titre_filter">';
print '<td class="liste_titre" colspan="'.$colspan.'">';
print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', $langs->trans('From'), array(), 1, 1, '', 'accounts');
print ' ';
print $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', $langs->trans('to'), array(), 1, 1, '', 'accounts');
print '</td>';
// Fields from hook
@ -324,6 +412,10 @@ if ($action != 'export_csv') {
print '<tr class="liste_titre">';
print_liste_field_titre("AccountAccounting", $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder);
// TODO : Retrieve the type of third party: Customer / Supplier / Employee
//if ($type == 'sub') {
// print_liste_field_titre("Type", $_SERVER['PHP_SELF'], "t.type", "", $param, "", $sortfield, $sortorder);
//}
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) {
print_liste_field_titre("OpeningBalance", $_SERVER['PHP_SELF'], "", $param, "", 'class="right"', $sortfield, $sortorder);
}
@ -359,7 +451,7 @@ if ($action != 'export_csv') {
$sql .= " GROUP BY t.numero_compte";
$resql = $db->query($sql);
$nrows = $db->num_rows($resql);
$nrows = $resql->num_rows;
$opening_balances = array();
for ($i = 0; $i < $nrows; $i++) {
$arr = $resql->fetch_array();
@ -372,11 +464,13 @@ if ($action != 'export_csv') {
$accountingaccountstatic->id = 0;
$accountingaccountstatic->account_number = '';
$accountingaccountstatic->fetch(null, $line->numero_compte, true);
if (!empty($accountingaccountstatic->account_number)) {
$accounting_account = $accountingaccountstatic->getNomUrl(0, 1, 0, '', 0, -1, 0, 'accountcard');
} else {
$accounting_account = length_accountg($line->numero_compte);
if ($type != 'sub') {
$accountingaccountstatic->fetch(null, $line->numero_compte, true);
if (!empty($accountingaccountstatic->account_number)) {
$accounting_account = $accountingaccountstatic->getNomUrl(0, 1, 1);
} else {
$accounting_account = length_accountg($line->numero_compte);
}
}
$link = '';
@ -427,7 +521,7 @@ if ($action != 'export_csv') {
// Show first line of a break
print '<tr class="trforbreak">';
print '<td colspan="'.($colspan+1).'" class="tdforbreak">'.$line->numero_compte.($root_account_description ? ' - '.$root_account_description : '').'</td>';
print '<td colspan="'.($colspan+1).'" style="font-weight:bold; border-bottom: 1pt solid black;">'.$line->numero_compte.($root_account_description ? ' - '.$root_account_description : '').'</td>';
print '</tr>';
$displayed_account = $root_account_number;
@ -438,19 +532,43 @@ if ($action != 'export_csv') {
}
print '<tr class="oddeven">';
print '<td>'.$accounting_account.'</td>';
// Accounting account
if ($type == 'sub') {
print '<td>'.$line->subledger_account.' <span class="opacitymedium">('.$line->subledger_label.')</span></td>';
} else {
print '<td>'.$accounting_account.'</td>';
}
// Type
// TODO Retrieve the type of third party: Customer / Supplier / Employee
//if ($type == 'sub') {
// print '<td></td>';
//}
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) {
print '<td class="right nowraponall amount">'.price(price2num($opening_balance, 'MT')).'</td>';
}
$urlzoom = '';
if ($line->numero_compte) {
$urlzoom = DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?search_accountancy_code_start='.urlencode($line->numero_compte).'&search_accountancy_code_end='.urlencode($line->numero_compte);
if (GETPOSTISSET('date_startmonth')) {
$urlzoom .= '&search_date_startmonth='.GETPOST('date_startmonth', 'int').'&search_date_startday='.GETPOST('date_startday', 'int').'&search_date_startyear='.GETPOST('date_startyear', 'int');
if ($type == 'sub') {
if ($line->subledger_account) {
$urlzoom = DOL_URL_ROOT . '/accountancy/bookkeeping/listbyaccount.php?type=sub&search_accountancy_code_start=' . urlencode($line->subledger_account) . '&search_accountancy_code_end=' . urlencode($line->subledger_account);
if (GETPOSTISSET('date_startmonth')) {
$urlzoom .= '&search_date_startmonth=' . GETPOST('date_startmonth', 'int') . '&search_date_startday=' . GETPOST('date_startday', 'int') . '&search_date_startyear=' . GETPOST('date_startyear', 'int');
}
if (GETPOSTISSET('date_endmonth')) {
$urlzoom .= '&search_date_endmonth=' . GETPOST('date_endmonth', 'int') . '&search_date_endday=' . GETPOST('date_endday', 'int') . '&search_date_endyear=' . GETPOST('date_endyear', 'int');
}
}
if (GETPOSTISSET('date_endmonth')) {
$urlzoom .= '&search_date_endmonth='.GETPOST('date_endmonth', 'int').'&search_date_endday='.GETPOST('date_endday', 'int').'&search_date_endyear='.GETPOST('date_endyear', 'int');
} else {
if ($line->numero_compte) {
$urlzoom = DOL_URL_ROOT . '/accountancy/bookkeeping/listbyaccount.php?search_accountancy_code_start=' . urlencode($line->numero_compte) . '&search_accountancy_code_end=' . urlencode($line->numero_compte);
if (GETPOSTISSET('date_startmonth')) {
$urlzoom .= '&search_date_startmonth=' . GETPOST('date_startmonth', 'int') . '&search_date_startday=' . GETPOST('date_startday', 'int') . '&search_date_startyear=' . GETPOST('date_startyear', 'int');
}
if (GETPOSTISSET('date_endmonth')) {
$urlzoom .= '&search_date_endmonth=' . GETPOST('date_endmonth', 'int') . '&search_date_endday=' . GETPOST('date_endday', 'int') . '&search_date_endyear=' . GETPOST('date_endyear', 'int');
}
}
}
// Debit

View File

@ -1154,9 +1154,10 @@ class BookKeeping extends CommonObject
* @param int $offset offset limit
* @param array $filter filter array
* @param string $filtermode filter mode (AND or OR)
* @param int $option option (0: general account or 1: subaccount)
* @return int <0 if KO, >0 if OK
*/
public function fetchAllBalance($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND')
public function fetchAllBalance($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND', $option = 0)
{
global $conf;
@ -1166,6 +1167,11 @@ class BookKeeping extends CommonObject
$sql = 'SELECT';
$sql .= " t.numero_compte,";
$sql .= " t.label_compte,";
if (!empty($option)) {
$sql .= " t.subledger_account,";
$sql .= " t.subledger_label,";
}
$sql .= " SUM(t.debit) as debit,";
$sql .= " SUM(t.credit) as credit";
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
@ -1191,6 +1197,8 @@ class BookKeeping extends CommonObject
} else {
$sqlwhere[] = natural_search("t.code_journal", $value, 3, 1);
}
} elseif ($key == 't.reconciled_option') {
$sqlwhere[] = 't.lettering_code IS NULL';
} else {
$sqlwhere[] = $key." LIKE '%".$this->db->escape($value)."%'";
}
@ -1201,7 +1209,17 @@ class BookKeeping extends CommonObject
$sql .= " AND ".implode(" ".$filtermode." ", $sqlwhere);
}
$sql .= ' GROUP BY t.numero_compte';
if (!empty($option)) {
$sql .= ' AND t.subledger_account IS NOT NULL';
$sql .= ' AND t.subledger_account != ""';
$sql .= ' GROUP BY t.numero_compte, t.label_compte, t.subledger_account, t.subledger_label';
$sortfield = 't.subledger_account'.($sortfield ? ','.$sortfield : '');
$sortorder = 'ASC'.($sortfield ? ','.$sortfield : '');
} else {
$sql .= ' GROUP BY t.numero_compte, t.label_compte';
$sortfield = 't.numero_compte'.($sortfield ? ','.$sortfield : '');
$sortorder = 'ASC'.($sortorder ? ','.$sortorder : '');
}
if (!empty($sortfield)) {
$sql .= $this->db->order($sortfield, $sortorder);
@ -1219,6 +1237,9 @@ class BookKeeping extends CommonObject
$line = new BookKeepingLine();
$line->numero_compte = $obj->numero_compte;
$line->label_compte = $obj->label_compte;
$line->subledger_account = $obj->subledger_account;
$line->subledger_label = $obj->subledger_label;
$line->debit = $obj->debit;
$line->credit = $obj->credit;

View File

@ -121,26 +121,12 @@ if (($action == 'clean' || $action == 'validatehistory') && $user->hasRight('acc
if ($action == 'validatehistory') {
$error = 0;
$nbbinddone = 0;
$nbbindfailed = 0;
$notpossible = 0;
$db->begin();
// Now make the binding. Bind automatically only for product with a dedicated account that exists into chart of account, others need a manual bind
/*if ($db->type == 'pgsql') {
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet";
$sql1 .= " SET fk_code_ventilation = accnt.rowid";
$sql1 .= " FROM " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst";
$sql1 .= " WHERE " . MAIN_DB_PREFIX . "facturedet.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . ((int) $conf->global->CHARTOFACCOUNTS).' AND accnt.entity = '.((int) $conf->entity);
$sql1 .= " AND accnt.active = 1 AND p.accountancy_code_sell=accnt.account_number";
$sql1 .= " AND " . MAIN_DB_PREFIX . "facturedet.fk_code_ventilation = 0";
} else {
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd, " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst";
$sql1 .= " SET fk_code_ventilation = accnt.rowid";
$sql1 .= " WHERE fd.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . ((int) $conf->global->CHARTOFACCOUNTS).' AND accnt.entity = '.((int) $conf->entity);
$sql1 .= " AND accnt.active = 1 AND p.accountancy_code_sell=accnt.account_number";
$sql1 .= " AND fd.fk_code_ventilation = 0";
}*/
// Customer Invoice lines (must be same request than into page list.php for manual binding)
$sql = "SELECT f.rowid as facid, f.ref as ref, f.datef, f.type as ftype, f.fk_facture_source,";
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
@ -281,12 +267,14 @@ if ($action == 'validatehistory') {
if (!$resqlupdate) {
$error++;
setEventMessages($db->lasterror(), null, 'errors');
$nbbindfailed++;
break;
} else {
$nbbinddone++;
}
} else {
$notpossible++;
$nbbindfailed++;
}
$i++;
@ -300,7 +288,10 @@ if ($action == 'validatehistory') {
$db->rollback();
} else {
$db->commit();
setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, 'mesgs');
setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, ($notpossible ? 'warnings' : 'mesgs'));
if ($nbbindfailed) {
setEventMessages($langs->trans('DoManualBindingForFailedRecord', $nbbindfailed), null, 'warnings');
}
}
}
@ -324,7 +315,7 @@ print '</span><br>';
$y = $year_current;
$buttonbind = '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=validatehistory&token='.newToken().'">'.$langs->trans("ValidateHistory").'</a>';
$buttonbind = '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=validatehistory&token='.newToken().'">'.img_picto($langs->trans("ValidateHistory"), 'link', 'class="pictofixedwidth fa-color-unset"').$langs->trans("ValidateHistory").'</a>';
print_barre_liste(img_picto('', 'unlink', 'class="paddingright fa-color-unset"').$langs->trans("OverviewOfAmountOfLinesNotBound"), '', '', '', '', '', '', -1, '', '', 0, $buttonbind, '', 0, 1, 1);
//print load_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
@ -405,7 +396,17 @@ if ($resql) {
print '</td>';
print '<td>';
if ($row[0] == 'tobind') {
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/customer/list.php?search_year='.((int) $y), $langs->transnoentitiesnoconv("ToBind"));
$startmonth = ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1);
if ($startmonth > 12) {
$startmonth -= 12;
}
$startyear = ($startmonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y;
$endmonth = ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) + 11;
if ($endmonth > 12) {
$endmonth -= 12;
}
$endyear = ($endmonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y;
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/customer/list.php?search_date_startday=1&search_date_startmonth='.((int) $startmonth).'&search_date_startyear='.((int) $startyear).'&search_date_endday=&search_date_endmonth='.((int) $endmonth).'&search_date_endyear='.((int) $endyear), $langs->transnoentitiesnoconv("ToBind"));
} else {
print $row[1];
}
@ -420,6 +421,12 @@ if ($resql) {
print '<td class="right nowraponall amount">';
print price($row[$i]);
// Add link to make binding
if (!empty(price2num($row[$i]))) {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=validatehistory&year='.$y.'&validatemonth='.((int) $cursormonth).'&validateyear='.((int) $cursoryear).'&token='.newToken().'">';
print img_picto($langs->trans("ValidateHistory").' ('.$langs->trans('Month'.str_pad($cursormonth, 2, '0', STR_PAD_LEFT)).' '.$cursoryear.')', 'link', 'class="marginleft2"');
print '</a>';
}
print '</td>';
}
print '<td class="right nowraponall amount"><b>'.price($row[14]).'</b></td>';
@ -558,7 +565,7 @@ print "</table>\n";
print '</div>';
if ($conf->global->MAIN_FEATURES_LEVEL > 0) { // This part of code looks strange. Why showing a report that should rely on result of this step ?
if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This part of code looks strange. Why showing a report that should rely on result of this step ?
print '<br>';
print '<br>';

View File

@ -101,6 +101,7 @@ if (($action == 'clean' || $action == 'validatehistory') && $user->rights->accou
if ($action == 'validatehistory') {
$error = 0;
$nbbinddone = 0;
$nbbindfailed = 0;
$notpossible = 0;
$db->begin();
@ -143,12 +144,14 @@ if ($action == 'validatehistory') {
if (!$resqlupdate) {
$error++;
setEventMessages($db->lasterror(), null, 'errors');
$nbbindfailed++;
break;
} else {
$nbbinddone++;
}
} else {
$notpossible++;
$nbbindfailed++;
}
$i++;
@ -162,7 +165,10 @@ if ($action == 'validatehistory') {
$db->rollback();
} else {
$db->commit();
setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, 'mesgs');
setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, ($notpossible ? 'warnings' : 'mesgs'));
if ($nbbindfailed) {
setEventMessages($langs->trans('DoManualBindingForFailedRecord', $nbbindfailed), null, 'warnings');
}
}
}
@ -185,7 +191,7 @@ print '</span><br>';
$y = $year_current;
$buttonbind = '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=validatehistory&token='.newToken().'&year='.$year_current.'">'.$langs->trans("ValidateHistory").'</a>';
$buttonbind = '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=validatehistory&token='.newToken().'&year='.$year_current.'">'.img_picto('', 'link', 'class="paddingright fa-color-unset"').$langs->trans("ValidateHistory").'</a>';
print_barre_liste(img_picto('', 'unlink', 'class="paddingright fa-color-unset"').$langs->trans("OverviewOfAmountOfLinesNotBound"), '', '', '', '', '', '', -1, '', '', 0, $buttonbind, '', 0, 1, 1);
@ -263,20 +269,49 @@ if ($resql) {
print '</td>';
print '<td>';
if ($row[0] == 'tobind') {
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/expensereport/list.php?search_year='.((int) $y), $langs->transnoentitiesnoconv("ToBind"));
$startmonth = ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1);
if ($startmonth > 12) {
$startmonth -= 12;
}
$startyear = ($startmonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y;
$endmonth = ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) + 11;
if ($endmonth > 12) {
$endmonth -= 12;
}
$endyear = ($endmonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y;
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/expensereport/list.php?search_date_startday=1&search_date_startmonth='.((int) $startmonth).'&search_date_startyear='.((int) $startyear).'&search_date_endday=&search_date_endmonth='.((int) $endmonth).'&search_date_endyear='.((int) $endyear), $langs->transnoentitiesnoconv("ToBind"));
} else {
print $row[1];
}
print '</td>';
for ($i = 2; $i <= 13; $i++) {
$cursormonth = (($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) + $i - 2);
if ($cursormonth > 12) {
$cursormonth -= 12;
}
$cursoryear = ($cursormonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y;
$tmp = dol_getdate(dol_get_last_day($cursoryear, $cursormonth, 'gmt'), false, 'gmt');
print '<td class="right nowraponall amount">';
print price($row[$i]);
// Add link to make binding
if (!empty(price2num($row[$i]))) {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=validatehistory&year='.$y.'&validatemonth='.((int) $cursormonth).'&validateyear='.((int) $cursoryear).'&token='.newToken().'">';
print img_picto($langs->trans("ValidateHistory").' ('.$langs->trans('Month'.str_pad($cursormonth, 2, '0', STR_PAD_LEFT)).' '.$cursoryear.')', 'link', 'class="marginleft2"');
print '</a>';
}
print '</td>';
}
print '<td class="right nowraponall amount"><b>'.price($row[14]).'</b></td>';
print '</tr>';
}
$db->free($resql);
if ($num == 0) {
print '<tr class="oddeven"><td colspan="16">';
print '<span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span>';
print '</td></tr>';
}
} else {
print $db->lasterror(); // Show last sql error
}
@ -359,6 +394,12 @@ if ($resql) {
print '</tr>';
}
$db->free($resql);
if ($num == 0) {
print '<tr class="oddeven"><td colspan="16">';
print '<span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span>';
print '</td></tr>';
}
} else {
print $db->lasterror(); // Show last sql error
}
@ -367,7 +408,7 @@ print '</div>';
if ($conf->global->MAIN_FEATURES_LEVEL > 0) { // This part of code looks strange. Why showing a report where results depends on next step (so not yet available) ?
if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This part of code looks strange. Why showing a report that should rely on result of this step ?
print '<br>';
print '<br>';

View File

@ -119,26 +119,12 @@ if (($action == 'clean' || $action == 'validatehistory') && $user->rights->accou
if ($action == 'validatehistory') {
$error = 0;
$nbbinddone = 0;
$nbbindfailed = 0;
$notpossible = 0;
$db->begin();
// Now make the binding. Bind automatically only for product with a dedicated account that exists into chart of account, others need a manual bind
/*if ($db->type == 'pgsql') {
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det";
$sql1 .= " SET fk_code_ventilation = accnt.rowid";
$sql1 .= " FROM " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst";
$sql1 .= " WHERE " . MAIN_DB_PREFIX . "facture_fourn_det.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . ((int) $conf->global->CHARTOFACCOUNTS).' AND accnt.entity = '.$conf->entity;
$sql1 .= " AND accnt.active = 1 AND p.accountancy_code_buy=accnt.account_number";
$sql1 .= " AND " . MAIN_DB_PREFIX . "facture_fourn_det.fk_code_ventilation = 0";
} else {
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as fd, " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst";
$sql1 .= " SET fk_code_ventilation = accnt.rowid";
$sql1 .= " WHERE fd.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . ((int) $conf->global->CHARTOFACCOUNTS).' AND accnt.entity = '.$conf->entity;
$sql1 .= " AND accnt.active = 1 AND p.accountancy_code_buy=accnt.account_number";
$sql1 .= " AND fd.fk_code_ventilation = 0";
}*/
// Supplier Invoice Lines (must be same request than into page list.php for manual binding)
$sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.type as ftype, f.fk_facture_source,";
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
@ -279,12 +265,14 @@ if ($action == 'validatehistory') {
if (!$resqlupdate) {
$error++;
setEventMessages($db->lasterror(), null, 'errors');
$nbbindfailed++;
break;
} else {
$nbbinddone++;
}
} else {
$notpossible++;
$nbbindfailed++;
}
$i++;
@ -298,7 +286,10 @@ if ($action == 'validatehistory') {
$db->rollback();
} else {
$db->commit();
setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, 'mesgs');
setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, ($notpossible ? 'warnings' : 'mesgs'));
if ($nbbindfailed) {
setEventMessages($langs->trans('DoManualBindingForFailedRecord', $nbbindfailed), null, 'warnings');
}
}
}
@ -320,7 +311,7 @@ print '</span><br>';
$y = $year_current;
$buttonbind = '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=validatehistory&token='.newToken().'">'.$langs->trans("ValidateHistory").'</a>';
$buttonbind = '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=validatehistory&token='.newToken().'">'.img_picto('', 'link', 'class="paddingright fa-color-unset"').$langs->trans("ValidateHistory").'</a>';
print_barre_liste(img_picto('', 'unlink', 'class="paddingright fa-color-unset"').$langs->trans("OverviewOfAmountOfLinesNotBound"), '', '', '', '', '', '', -1, '', '', 0, $buttonbind, '', 0, 1, 1);
@ -402,14 +393,37 @@ if ($resql) {
print '</td>';
print '<td>';
if ($row[0] == 'tobind') {
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/supplier/list.php?search_year='.((int) $y), $langs->transnoentitiesnoconv("ToBind"));
$startmonth = ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1);
if ($startmonth > 12) {
$startmonth -= 12;
}
$startyear = ($startmonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y;
$endmonth = ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) + 11;
if ($endmonth > 12) {
$endmonth -= 12;
}
$endyear = ($endmonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y;
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/supplier/list.php?search_date_startday=1&search_date_startmonth='.((int) $startmonth).'&search_date_startyear='.((int) $startyear).'&search_date_endday=&search_date_endmonth='.((int) $endmonth).'&search_date_endyear='.((int) $endyear), $langs->transnoentitiesnoconv("ToBind"));
} else {
print $row[1];
}
print '</td>';
for ($i = 2; $i <= 13; $i++) {
$cursormonth = (($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) + $i - 2);
if ($cursormonth > 12) {
$cursormonth -= 12;
}
$cursoryear = ($cursormonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y;
$tmp = dol_getdate(dol_get_last_day($cursoryear, $cursormonth, 'gmt'), false, 'gmt');
print '<td class="right nowraponall amount">';
print price($row[$i]);
// Add link to make binding
if (!empty(price2num($row[$i]))) {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=validatehistory&year='.$y.'&validatemonth='.((int) $cursormonth).'&validateyear='.((int) $cursoryear).'&token='.newToken().'">';
print img_picto($langs->trans("ValidateHistory").' ('.$langs->trans('Month'.str_pad($cursormonth, 2, '0', STR_PAD_LEFT)).' '.$cursoryear.')', 'link', 'class="marginleft2"');
print '</a>';
}
print '</td>';
}
print '<td class="right nowraponall amount"><b>'.price($row[14]).'</b></td>';
@ -541,7 +555,7 @@ print "</table>\n";
print '</div>';
if ($conf->global->MAIN_FEATURES_LEVEL > 0) { // This part of code looks strange. Why showing a report that should rely on result of this step ?
if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This part of code looks strange. Why showing a report that should rely on result of this step ?
print '<br>';
print '<br>';

View File

@ -3203,4 +3203,40 @@ class Adherent extends CommonObject
return $nbko;
}
/**
* Return clicable link of object (with eventually picto)
*
* @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link)
* @return string HTML Code for Kanban thumb.
*/
public function getKanbanView($option = '')
{
$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">';
if (property_exists($this, 'photo') || !empty($this->photo)) {
$return.= Form::showphoto('memberphoto', $this, 0, 60, 0, 'photokanban photoref photowithmargin photologintooltip', 'small', 0, 1);
} else {
$return .= img_picto('', 'user');
}
$return .= '</span>';
$return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>';
if (property_exists($this, 'type')) {
$return .= '<br><span class="info-box-label opacitymedium">'.$this->type.'</span>';
}
if (method_exists($this, 'getmorphylib')) {
$return .= '<br><span class="info-box-label">'.$this->getmorphylib('', 2).'</span>';
}
if (method_exists($this, 'getLibStatut')) {
$return .= '<br><div class="info-box-status margintoponly">'.$this->getLibStatut(5).'</div>';
}
$return .= '</div>';
$return .= '</div>';
$return .= '</div>';
return $return;
}
}

View File

@ -47,6 +47,7 @@ $show_files = GETPOST('show_files', 'int');
$confirm = GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'memberslist'; // To manage different context of search
$mode = GETPOST('mode', 'alpha');
// Search fields
@ -72,7 +73,7 @@ $search_categ = GETPOST("search_categ", 'int');
$search_filter = GETPOST("search_filter", 'alpha');
$search_status = GETPOST("search_status", 'intcomma');
$search_morphy = GETPOST("search_morphy", 'alpha');
$search_import_key = trim(GETPOST("search_import_key", "alpha"));
$search_import_key = trim(GETPOST("search_import_key", 'alpha'));
$catid = GETPOST("catid", 'int');
$optioncss = GETPOST('optioncss', 'alpha');
$socid = GETPOST('socid', 'int');
@ -140,6 +141,7 @@ $fieldstosearchall = array(
if ($db->type == 'pgsql') {
unset($fieldstosearchall['d.rowid']);
}
$arrayfields = array(
'd.ref'=>array('label'=>"Ref", 'checked'=>1),
'd.civility'=>array('label'=>"Civility", 'checked'=>0),
@ -168,6 +170,7 @@ $arrayfields = array(
'd.statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
'd.import_key'=>array('label'=>"ImportId", 'checked'=>0, 'position'=>1100),
);
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
@ -316,7 +319,11 @@ $formother = new FormOther($db);
$membertypestatic = new AdherentType($db);
$memberstatic = new Adherent($db);
$title = $langs->trans("Members");
// Page Header
$title = $langs->trans("Members")." - ".$langs->trans("List");;
$help_url = 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros|DE:Modul_Mitglieder';
llxHeader('', $title, $help_url);
$now = dol_now();
@ -334,12 +341,14 @@ $sql .= " s.nom,";
$sql .= " ".$db->ifsql("d.societe IS NULL", "s.nom", "d.societe")." as companyname,";
$sql .= " t.libelle as type, t.subscription,";
$sql .= " state.code_departement as state_code, state.nom as state_name,";
// Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key." as options_".$key.', ' : '');
}
}
// Add fields from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
@ -348,13 +357,16 @@ $sql = preg_replace('/,\s*$/', '', $sql);
$sqlfields = $sql; // $sql fields to remove for count total
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d";
// SQL Aliase adherent
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d"; // maybe better to use ad (adh) instead od d
if (!empty($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (d.rowid = ef.fk_object)";
}
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = d.country)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = d.state_id)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on (s.rowid = d.fk_soc)";
// SQL Aliase adherent_type
$sql .= ", ".MAIN_DB_PREFIX."adherent_type as t";
$sql .= " WHERE d.fk_adherent_type = t.rowid";
@ -524,8 +536,6 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $
exit;
}
$help_url = 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros';
llxHeader('', $title, $help_url);
if ($search_type > 0) {
$membertype = new AdherentType($db);
@ -533,7 +543,11 @@ if ($search_type > 0) {
$title .= " (".$membertype->label.")";
}
// $parameters
$param = '';
if (!empty($mode)) {
$param .= '&mode='.urlencode($mode);
}
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
@ -609,6 +623,7 @@ if ($search_type > 0) {
if ($optioncss != '') {
$param .= '&optioncss='.urlencode($optioncss);
}
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
@ -635,6 +650,8 @@ if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'pr
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
$newcardbutton = '';
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
if ($user->hasRight('adherent', 'creer')) {
$newcardbutton .= dolGetButtonTitle($langs->trans('NewMember'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/card.php?action=create');
}
@ -649,6 +666,8 @@ print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
@ -697,6 +716,7 @@ print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" :
// Line for filters fields
print '<tr class="liste_titre_filter">';
// Action column
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
print '<td class="liste_titre middle">';
@ -704,6 +724,7 @@ if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
print $searchpicto;
print '</td>';
}
// Line numbering
if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) {
print '<td class="liste_titre">&nbsp;</td>';
@ -715,32 +736,45 @@ if (!empty($arrayfields['d.ref']['checked'])) {
print '<input class="flat maxwidth75imp" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
print '</td>';
}
// Civility
if (!empty($arrayfields['d.civility']['checked'])) {
print '<td class="liste_titre left">';
print '<input class="flat maxwidth50imp" type="text" name="search_civility" value="'.dol_escape_htmltag($search_civility).'"></td>';
}
// First Name
if (!empty($arrayfields['d.firstname']['checked'])) {
print '<td class="liste_titre left">';
print '<input class="flat maxwidth75imp" type="text" name="search_firstname" value="'.dol_escape_htmltag($search_firstname).'"></td>';
}
// Last Name
if (!empty($arrayfields['d.lastname']['checked'])) {
print '<td class="liste_titre left">';
print '<input class="flat maxwidth75imp" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).'"></td>';
}
// Gender
if (!empty($arrayfields['d.gender']['checked'])) {
print '<td class="liste_titre">';
$arraygender = array('man'=>$langs->trans("Genderman"), 'woman'=>$langs->trans("Genderwoman"), 'other'=>$langs->trans("Genderother"));
print $form->selectarray('search_gender', $arraygender, $search_gender, 1);
print '</td>';
}
// Company
if (!empty($arrayfields['d.company']['checked'])) {
print '<td class="liste_titre left">';
print '<input class="flat maxwidth75imp" type="text" name="search_company" value="'.dol_escape_htmltag($search_company).'"></td>';
}
// Login
if (!empty($arrayfields['d.login']['checked'])) {
print '<td class="liste_titre left">';
print '<input class="flat maxwidth75imp" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).'"></td>';
}
// Nature
if (!empty($arrayfields['d.morphy']['checked'])) {
print '<td class="liste_titre center">';
@ -748,6 +782,8 @@ if (!empty($arrayfields['d.morphy']['checked'])) {
print $form->selectarray('search_morphy', $arraymorphy, $search_morphy, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100');
print '</td>';
}
// Member Type
if (!empty($arrayfields['t.libelle']['checked'])) {
print '</td>';
}
@ -758,51 +794,62 @@ if (!empty($arrayfields['t.libelle']['checked'])) {
print '</td>';
}
// Address - Street
if (!empty($arrayfields['d.address']['checked'])) {
print '<td class="liste_titre left">';
print '<input class="flat maxwidth75imp" type="text" name="search_address" value="'.dol_escape_htmltag($search_address).'"></td>';
}
// ZIP
if (!empty($arrayfields['d.zip']['checked'])) {
print '<td class="liste_titre left">';
print '<input class="flat maxwidth50imp" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).'"></td>';
}
// Town/City
if (!empty($arrayfields['d.town']['checked'])) {
print '<td class="liste_titre left">';
print '<input class="flat maxwidth75imp" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).'"></td>';
}
// State
// State / County / Departement
if (!empty($arrayfields['state.nom']['checked'])) {
print '<td class="liste_titre">';
print '<input class="flat searchstring maxwidth75imp" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).'">';
print '</td>';
}
// Country
if (!empty($arrayfields['country.code_iso']['checked'])) {
print '<td class="liste_titre center">';
print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100');
print '</td>';
}
// Phone pro
if (!empty($arrayfields['d.phone']['checked'])) {
print '<td class="liste_titre left">';
print '<input class="flat maxwidth75imp" type="text" name="search_phone" value="'.dol_escape_htmltag($search_phone).'"></td>';
}
// Phone perso
if (!empty($arrayfields['d.phone_perso']['checked'])) {
print '<td class="liste_titre left">';
print '<input class="flat maxwidth50" type="text" name="search_phone_perso" value="'.dol_escape_htmltag($search_phone_perso).'"></td>';
print '<input class="flat maxwidth75imp" type="text" name="search_phone_perso" value="'.dol_escape_htmltag($search_phone_perso).'"></td>';
}
// Phone mobile
if (!empty($arrayfields['d.phone_mobile']['checked'])) {
print '<td class="liste_titre left">';
print '<input class="flat maxwidth75imp" type="text" name="search_phone_mobile" value="'.dol_escape_htmltag($search_phone_mobile).'"></td>';
}
// Email
if (!empty($arrayfields['d.email']['checked'])) {
print '<td class="liste_titre left">';
print '<input class="flat maxwidth75imp" type="text" name="search_email" value="'.dol_escape_htmltag($search_email).'"></td>';
}
// End of subscription date
if (!empty($arrayfields['d.datefin']['checked'])) {
print '<td class="liste_titre center">';
@ -811,6 +858,7 @@ if (!empty($arrayfields['d.datefin']['checked'])) {
print $form->selectarray('search_filter', $selectarray, $search_filter);
print '</td>';
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
@ -818,21 +866,25 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
$parameters = array('arrayfields'=>$arrayfields);
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation
if (!empty($arrayfields['d.datec']['checked'])) {
print '<td class="liste_titre">';
print '</td>';
}
// Birthday
if (!empty($arrayfields['d.birth']['checked'])) {
print '<td class="liste_titre">';
print '</td>';
}
// Date modification
if (!empty($arrayfields['d.tms']['checked'])) {
print '<td class="liste_titre">';
print '</td>';
}
// Status
if (!empty($arrayfields['d.statut']['checked'])) {
print '<td class="liste_titre right parentonrightofpage">';
@ -845,11 +897,14 @@ if (!empty($arrayfields['d.statut']['checked'])) {
print $form->selectarray('search_status', $liststatus, $search_status, -3, 0, 0, '', 0, 0, 0, '', 'search_status width100 onrightofpage');
print '</td>';
}
// Import Key
if (!empty($arrayfields['d.import_key']['checked'])) {
print '<td class="liste_titre center">';
print '<input class="flat searchstring maxwidth50" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).'">';
print '</td>';
}
if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
// Action column
print '<td class="liste_titre middle">';
@ -930,6 +985,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (!empty($arrayfields['d.datec']['checked'])) {
print_liste_field_titre($arrayfields['d.datec']['label'], $_SERVER["PHP_SELF"], "d.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
}
@ -987,276 +1043,292 @@ while ($i < min($num, $limit)) {
}
$memberstatic->company = $companyname;
print '<tr class="oddeven">';
// Action column
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
print '<td class="center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($obj->rowid, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
if ($mode == 'kanban') {
if ($i == 0) {
print '<tr><td colspan="12">';
print '<div class="box-flex-container">';
}
print '</td>';
}
if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) {
print '<td class="center" data-key="id">'.$obj->rowid.'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Ref
if (!empty($arrayfields['d.ref']['checked'])) {
print "<td>";
print $memberstatic->getNomUrl(-1, 0, 'card', 'ref', '', -1, 0, 1);
print "</td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
}
// Civility
if (!empty($arrayfields['d.civility']['checked'])) {
print "<td>";
print $obj->civility;
print "</td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
}
// Firstname
if (!empty($arrayfields['d.firstname']['checked'])) {
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->firstname).'">';
print $memberstatic->getNomUrl(0, 0, 'card', 'firstname');
//print $obj->firstname;
print "</td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
}
// Lastname
if (!empty($arrayfields['d.lastname']['checked'])) {
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->lastname).'">';
print $memberstatic->getNomUrl(0, 0, 'card', 'lastname');
//print $obj->lastname;
print "</td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
}
// Gender
if (!empty($arrayfields['d.gender']['checked'])) {
print '<td>';
if ($obj->gender) {
print $langs->trans("Gender".$obj->gender);
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Company
if (!empty($arrayfields['d.company']['checked'])) {
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($companyname).'">';
print $companynametoshow;
print "</td>\n";
}
// Login
if (!empty($arrayfields['d.login']['checked'])) {
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->login).'">'.$obj->login."</td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
}
// Nature (Moral/Physical)
if (!empty($arrayfields['d.morphy']['checked'])) {
print '<td class="center">';
print $memberstatic->getmorphylib('', 2);
print "</td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
}
// Type label
if (!empty($arrayfields['t.libelle']['checked'])) {
$membertypestatic->id = $obj->type_id;
$membertypestatic->label = $obj->type;
print '<td class="nowraponall">';
print $membertypestatic->getNomUrl(1, 32);
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
$memberstatic->type = $membertypestatic->label;
$memberstatic->photo = $obj->photo;
// Output Kanban
print $memberstatic->getKanbanView('');
if ($i == (min($num, $limit) - 1)) {
print '</div>';
print '</td></tr>';
}
}
// Address
if (!empty($arrayfields['d.address']['checked'])) {
print '<td class="nocellnopadd tdoverflowmax200" title="'.dol_escape_htmltag($obj->address).'">';
print $obj->address;
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Zip
if (!empty($arrayfields['d.zip']['checked'])) {
print '<td class="nocellnopadd">';
print $obj->zip;
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Town
if (!empty($arrayfields['d.town']['checked'])) {
print '<td class="nocellnopadd">';
print $obj->town;
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// State
if (!empty($arrayfields['state.nom']['checked'])) {
print "<td>".$obj->state_name."</td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
}
// Country
if (!empty($arrayfields['country.code_iso']['checked'])) {
$tmparray = getCountry($obj->country, 'all');
print '<td class="center tdoverflowmax100" title="'.dol_escape_htmltag($tmparray['label']).'">';
print dol_escape_htmltag($tmparray['label']);
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Phone pro
if (!empty($arrayfields['d.phone']['checked'])) {
print '<td class="nocellnopadd">';
print $obj->phone;
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Phone perso
if (!empty($arrayfields['d.phone_perso']['checked'])) {
print '<td class="nocellnopadd">';
print $obj->phone_perso;
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Phone mobile
if (!empty($arrayfields['d.phone_mobile']['checked'])) {
print '<td class="nocellnopadd">';
print $obj->phone_mobile;
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// EMail
if (!empty($arrayfields['d.email']['checked'])) {
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->email).'">';
print dol_print_email($obj->email, 0, 0, 1, 64, 1, 1);
print "</td>\n";
}
// End of subscription date
$datefin = $db->jdate($obj->datefin);
if (!empty($arrayfields['d.datefin']['checked'])) {
print '<td class="nowrap center">';
if ($datefin) {
print dol_print_date($datefin, 'day');
if ($memberstatic->hasDelay()) {
$textlate = ' ('.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($conf->adherent->subscription->warning_delay / 60 / 60 / 24) >= 0 ? '+' : '').ceil($conf->adherent->subscription->warning_delay / 60 / 60 / 24).' '.$langs->trans("days").')';
print " ".img_warning($langs->trans("SubscriptionLate").$textlate);
} else {
print '<tr class="oddeven">';
// Action column
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
print '<td class="center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($obj->rowid, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
}
} else {
if (!empty($obj->subscription)) {
print '<span class="opacitymedium">'.$langs->trans("SubscriptionNotReceived").'</span>';
if ($obj->statut > 0) {
print " ".img_warning();
print '</td>';
}
// Technical ID
if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) {
print '<td class="center" data-key="id">'.$obj->rowid.'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Ref
if (!empty($arrayfields['d.ref']['checked'])) {
print "<td>";
print $memberstatic->getNomUrl(-1, 0, 'card', 'ref', '', -1, 0, 1);
print "</td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
}
// Civility
if (!empty($arrayfields['d.civility']['checked'])) {
print "<td>";
print $obj->civility;
print "</td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
}
// Firstname
if (!empty($arrayfields['d.firstname']['checked'])) {
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->firstname).'">';
print $memberstatic->getNomUrl(0, 0, 'card', 'firstname');
//print $obj->firstname;
print "</td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
}
// Lastname
if (!empty($arrayfields['d.lastname']['checked'])) {
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->lastname).'">';
print $memberstatic->getNomUrl(0, 0, 'card', 'lastname');
//print $obj->lastname;
print "</td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
}
// Gender
if (!empty($arrayfields['d.gender']['checked'])) {
print '<td>';
if ($obj->gender) {
print $langs->trans("Gender".$obj->gender);
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Company
if (!empty($arrayfields['d.company']['checked'])) {
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($companyname).'">';
print $companynametoshow;
print "</td>\n";
}
// Login
if (!empty($arrayfields['d.login']['checked'])) {
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->login).'">'.$obj->login."</td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
}
// Nature (Moral/Physical)
if (!empty($arrayfields['d.morphy']['checked'])) {
print '<td class="center">';
print $memberstatic->getmorphylib('', 2);
print "</td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
}
// Type label
if (!empty($arrayfields['t.libelle']['checked'])) {
$membertypestatic->id = $obj->type_id;
$membertypestatic->label = $obj->type;
print '<td class="nowraponall">';
print $membertypestatic->getNomUrl(1, 32);
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Address
if (!empty($arrayfields['d.address']['checked'])) {
print '<td class="nocellnopadd tdoverflowmax200" title="'.dol_escape_htmltag($obj->address).'">';
print $obj->address;
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Zip
if (!empty($arrayfields['d.zip']['checked'])) {
print '<td class="nocellnopadd">';
print $obj->zip;
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Town
if (!empty($arrayfields['d.town']['checked'])) {
print '<td class="nocellnopadd">';
print $obj->town;
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// State / County / Departement
if (!empty($arrayfields['state.nom']['checked'])) {
print "<td>".$obj->state_name."</td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
}
// Country
if (!empty($arrayfields['country.code_iso']['checked'])) {
$tmparray = getCountry($obj->country, 'all');
print '<td class="center tdoverflowmax100" title="'.dol_escape_htmltag($tmparray['label']).'">';
print dol_escape_htmltag($tmparray['label']);
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Phone pro
if (!empty($arrayfields['d.phone']['checked'])) {
print '<td class="nocellnopadd">';
print $obj->phone;
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Phone perso
if (!empty($arrayfields['d.phone_perso']['checked'])) {
print '<td class="nocellnopadd">';
print $obj->phone_perso;
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Phone mobile
if (!empty($arrayfields['d.phone_mobile']['checked'])) {
print '<td class="nocellnopadd">';
print $obj->phone_mobile;
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// EMail
if (!empty($arrayfields['d.email']['checked'])) {
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->email).'">';
print dol_print_email($obj->email, 0, 0, 1, 64, 1, 1);
print "</td>\n";
}
// End of subscription date
$datefin = $db->jdate($obj->datefin);
if (!empty($arrayfields['d.datefin']['checked'])) {
print '<td class="nowrap center">';
if ($datefin) {
print dol_print_date($datefin, 'day');
if ($memberstatic->hasDelay()) {
$textlate = ' ('.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($conf->adherent->subscription->warning_delay / 60 / 60 / 24) >= 0 ? '+' : '').ceil($conf->adherent->subscription->warning_delay / 60 / 60 / 24).' '.$langs->trans("days").')';
print " ".img_warning($langs->trans("SubscriptionLate").$textlate);
}
} else {
print '&nbsp;';
if (!empty($obj->subscription)) {
print '<span class="opacitymedium">'.$langs->trans("SubscriptionNotReceived").'</span>';
if ($obj->statut > 0) {
print " ".img_warning();
}
} else {
print '&nbsp;';
}
}
print '</td>';
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation
if (!empty($arrayfields['d.datec']['checked'])) {
print '<td class="nowrap center">';
print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
print '</td>';
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation
if (!empty($arrayfields['d.datec']['checked'])) {
print '<td class="nowrap center">';
print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Birth
if (!empty($arrayfields['d.birth']['checked'])) {
print '<td class="nowrap center">';
print dol_print_date($db->jdate($obj->birth), 'day', 'tzuser');
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Date modification
if (!empty($arrayfields['d.tms']['checked'])) {
print '<td class="nowrap center">';
print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Status
if (!empty($arrayfields['d.statut']['checked'])) {
print '<td class="nowrap right">';
print $memberstatic->LibStatut($obj->statut, $obj->subscription, $datefin, 5);
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
if (!empty($arrayfields['d.import_key']['checked'])) {
print '<td class="tdoverflowmax100 center" title="'.dol_escape_htmltag($obj->import_key).'">';
print dol_escape_htmltag($obj->import_key);
print "</td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
}
// Action column
if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
print '<td class="center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($obj->rowid, $arrayofselected)) {
$selected = 1;
// Birth
if (!empty($arrayfields['d.birth']['checked'])) {
print '<td class="nowrap center">';
print dol_print_date($db->jdate($obj->birth), 'day', 'tzuser');
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '</td>';
}
if (!$i) {
$totalarray['nbfield']++;
}
// Date modification
if (!empty($arrayfields['d.tms']['checked'])) {
print '<td class="nowrap center">';
print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Status
if (!empty($arrayfields['d.statut']['checked'])) {
print '<td class="nowrap right">';
print $memberstatic->LibStatut($obj->statut, $obj->subscription, $datefin, 5);
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
if (!empty($arrayfields['d.import_key']['checked'])) {
print '<td class="tdoverflowmax100 center" title="'.dol_escape_htmltag($obj->import_key).'">';
print dol_escape_htmltag($obj->import_key);
print "</td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
}
// Action column
if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
print '<td class="center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($obj->rowid, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '</td>';
}
if (!$i) {
$totalarray['nbfield']++;
}
print '</tr>'."\n";
print '</tr>'."\n";
}
$i++;
}

View File

@ -54,6 +54,9 @@ $type = 'action';
* Actions
*/
$error = 0;
$errors = array();
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
$reg = array();
@ -193,10 +196,9 @@ print dol_get_fiche_head($head, 'other', $langs->trans("Agenda"), -1, 'action');
/*
* Documents models for supplier orders
* Miscellaneous
*/
// Define array def of models
$def = array();
@ -308,8 +310,11 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
}
}
print '</table><br>';
print load_fiche_titre($langs->trans('MiscellaneousOptions'), '', '');
}
print '<form action="'.$_SERVER["PHP_SELF"].'" name="agenda">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="set">';
@ -395,13 +400,12 @@ print '</td></tr>'."\n";
print '</table>';
print dol_get_fiche_end();
print $form->buttonsSaveCancel("Save", '');
print '</form>';
print "<br>";
print dol_get_fiche_end();
// End of page
llxFooter();

View File

@ -150,7 +150,6 @@ $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_valu
print load_fiche_titre($langs->trans("AgendaSetup"), $linkback, 'title_setup');
$head = agenda_prepare_head();
print dol_get_fiche_head($head, 'reminders', $langs->trans("Agenda"), -1, 'action');

View File

@ -52,7 +52,7 @@ if ($action == 'setbarcodeproducton') {
$barcodenumberingmodule = GETPOST('value', 'alpha');
$res = dolibarr_set_const($db, "BARCODE_PRODUCT_ADDON_NUM", $barcodenumberingmodule, 'chaine', 0, '', $conf->entity);
if ($barcodenumberingmodule == 'mod_barcode_product_standard' && empty($conf->global->BARCODE_STANDARD_PRODUCT_MASK)) {
$res = dolibarr_set_const($db, "BARCODE_STANDARD_PRODUCT_MASK", '020{000000000}', 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "BARCODE_STANDARD_PRODUCT_MASK", '04{0000000000}', 'chaine', 0, '', $conf->entity);
}
} elseif ($action == 'setbarcodeproductoff') {
$res = dolibarr_del_const($db, "BARCODE_PRODUCT_ADDON_NUM", $conf->entity);
@ -62,7 +62,7 @@ if ($action == 'setbarcodethirdpartyon') {
$barcodenumberingmodule = GETPOST('value', 'alpha');
$res = dolibarr_set_const($db, "BARCODE_THIRDPARTY_ADDON_NUM", $barcodenumberingmodule, 'chaine', 0, '', $conf->entity);
if ($barcodenumberingmodule == 'mod_barcode_thirdparty_standard' && empty($conf->global->BARCODE_STANDARD_THIRDPARTY_MASK)) {
$res = dolibarr_set_const($db, "BARCODE_STANDARD_THIRDPARTY_MASK", '020{000000000}', 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "BARCODE_STANDARD_THIRDPARTY_MASK", '04{0000000000}', 'chaine', 0, '', $conf->entity);
}
} elseif ($action == 'setbarcodethirdpartyoff') {
$res = dolibarr_del_const($db, "BARCODE_THIRDPARTY_ADDON_NUM", $conf->entity);

View File

@ -2510,11 +2510,11 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
print '</td>';
} elseif ($value == 'block_if_negative') {
print '<td>';
print $form->selectyesno("block_if_negative", (!empty($obj->{$value}) ? $obj->{$value}:''), 1);
print $form->selectyesno("block_if_negative", (empty($obj->block_if_negative) ? '' : $obj->block_if_negative), 1);
print '</td>';
} elseif ($value == 'type_duration') {
print '<td>';
print $form->selectTypeDuration('', $obj->{$value}, array('i','h'));
print $form->selectTypeDuration('', (empty($obj->type_duration) ? '' : $obj->type_duration), array('i','h'));
print '</td>';
} else {
$fieldValue = isset($obj->{$value}) ? $obj->{$value}: '';

View File

@ -668,6 +668,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$arrayoftypes = array(
'loadthirdparty' => $langs->trans('LoadThirdPartyFromName', $langs->transnoentities("ThirdPartyName")),
'loadandcreatethirdparty' => $langs->trans('LoadThirdPartyFromNameOrCreate', $langs->transnoentities("ThirdPartyName")),
'loadandcreatecontact' => $langs->trans('LoadContactFromEmailOrCreate', $langs->transnoentities("Email")),
'recordjoinpiece' => 'AttachJoinedDocumentsToObject',
'recordevent' => 'RecordEvent'
);

View File

@ -498,7 +498,10 @@ if ($mode == 'feature') {
if (isset($objMod->boxes) && is_array($objMod->boxes) && count($objMod->boxes)) {
$i = 0;
foreach ($objMod->boxes as $val) {
$text .= ($i ? ', ' : '').($val['file'] ? $val['file'] : $val[0]);
$boxstring = (empty($val['file']) ? (empty($val[0]) ? '' : $val[0]) : $val['file']);
if ($boxstring) {
$text .= ($i ? ', ' : '').$boxstring;
}
$i++;
}
} else {

View File

@ -282,10 +282,39 @@ if ($action == 'set' && $user->admin) {
}
header("Location: ".$_SERVER["PHP_SELF"]."?mode=".$mode.$param.($page_y ? '&page_y='.$page_y : ''));
exit;
} elseif (getDolGlobalInt("MAIN_FEATURES_LEVEL") > 1 && $action == 'reload' && $user->admin && GETPOST('confirm') == 'yes') {
$result = unActivateModule($value, 0);
dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV + 1, 'chaine', 0, '', $conf->entity);
if ($result) {
setEventMessages($result, null, 'errors');
header("Location: ".$_SERVER["PHP_SELF"]."?mode=".$mode.$param.($page_y ? '&page_y='.$page_y : ''));
}
$resarray = activateModule($value, 0, 1);
dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV + 1, 'chaine', 0, '', $conf->entity);
if (!empty($resarray['errors'])) {
setEventMessages('', $resarray['errors'], 'errors');
} else {
if ($resarray['nbperms'] > 0) {
$tmpsql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."user WHERE admin <> 1";
$resqltmp = $db->query($tmpsql);
if ($resqltmp) {
$obj = $db->fetch_object($resqltmp);
if ($obj && $obj->nb > 1) {
$msg = $langs->trans('ModuleEnabledAdminMustCheckRights');
setEventMessages($msg, null, 'warnings');
}
} else {
dol_print_error($db);
}
}
}
header("Location: ".$_SERVER["PHP_SELF"]."?mode=".$mode.$param.($page_y ? '&page_y='.$page_y : ''));
exit;
}
/*
* View
*/
@ -464,6 +493,19 @@ if ($action == 'reset_confirm' && $user->admin) {
}
}
if ($action == 'reload_confirm' && $user->admin) {
if (!empty($modules[$value])) {
$objMod = $modules[$value];
if (!empty($objMod->langfiles)) {
$langs->loadLangs($objMod->langfiles);
}
$form = new Form($db);
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?value='.$value.'&mode='.$mode.$param, $langs->trans('ConfirmReload'), $langs->trans(GETPOST('confirm_message_code')), 'reload', '', 'no', 1);
}
}
print $formconfirm;
asort($orders);
@ -547,6 +589,7 @@ if ($mode == 'common' || $mode == 'commonkanban') {
$moreforfilter .= '<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
$moreforfilter .= $form->selectarray('search_nature', $arrayofnatures, dol_escape_htmltag($search_nature), $langs->trans('Origin'), 0, 0, '', 0, 0, 0, '', 'maxwidth250', 1);
$moreforfilter .= '</div>';
if (getDolGlobalInt('MAIN_FEATURES_LEVEL')) {
$array_version = array('stable'=>$langs->transnoentitiesnoconv("Stable"));
if ($conf->global->MAIN_FEATURES_LEVEL < 0) {
@ -559,11 +602,12 @@ if ($mode == 'common' || $mode == 'commonkanban') {
$array_version['development'] = $langs->trans("Development");
}
$moreforfilter .= '<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
$moreforfilter .= $form->selectarray('search_version', $array_version, $search_version, $langs->trans('Version'), 0, 0, '', 0, 0, 0, '', 'maxwidth150', 1);
$moreforfilter .= $form->selectarray('search_version', $array_version, $search_version, $langs->transnoentitiesnoconv('Version'), 0, 0, '', 0, 0, 0, '', 'maxwidth150', 1);
$moreforfilter .= '</div>';
}
$array_status = array('active'=>$langs->transnoentitiesnoconv("Enabled"), 'disabled'=>$langs->transnoentitiesnoconv("Disabled"));
$moreforfilter .= '<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
$moreforfilter .= $form->selectarray('search_status', array('active'=>$langs->transnoentitiesnoconv("Enabled"), 'disabled'=>$langs->transnoentitiesnoconv("Disabled")), $search_status, $langs->trans('Status'), 0, 0, '', 0, 0, 0, '', 'maxwidth150', 1);
$moreforfilter .= $form->selectarray('search_status', $array_status, $search_status, $langs->transnoentitiesnoconv('Status'), 0, 0, '', 0, 0, 0, '', 'maxwidth150', 1);
$moreforfilter .= '</div>';
$moreforfilter .= ' ';
$moreforfilter .= '<div class="divsearchfield valignmiddle inline-block">';
@ -734,15 +778,17 @@ if ($mode == 'common' || $mode == 'commonkanban') {
// Version (with picto warning or not)
$version = $objMod->getVersion(0);
$versiontrans = '';
$warningstring = '';
if (preg_match('/development/i', $version)) {
$versiontrans .= img_warning($langs->trans("Development"), '', 'floatleft paddingright');
$warningstring = $langs->trans("Development");
}
if (preg_match('/experimental/i', $version)) {
$versiontrans .= img_warning($langs->trans("Experimental"), '', 'floatleft paddingright');
$warningstring = $langs->trans("Experimental");
}
if (preg_match('/deprecated/i', $version)) {
$versiontrans .= img_warning($langs->trans("Deprecated"), '', 'floatleft paddingright');
$warningstring = $langs->trans("Deprecated");
}
if ($objMod->isCoreOrExternalModule() == 'external' || preg_match('/development|experimental|deprecated/i', $version)) {
$versiontrans .= $objMod->getVersion(1);
}
@ -800,12 +846,24 @@ if ($mode == 'common' || $mode == 'commonkanban') {
} else {
if (!empty($objMod->warnings_unactivation[$mysoc->country_code]) && method_exists($objMod, 'alreadyUsed') && $objMod->alreadyUsed()) {
$codeenabledisable .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&amp;token='.newToken().'&amp;module_position='.$module_position.'&amp;action=reset_confirm&amp;confirm_message_code='.urlencode($objMod->warnings_unactivation[$mysoc->country_code]).'&amp;value='.$modName.'&amp;mode='.$mode.$param.'">';
$codeenabledisable .= img_picto($langs->trans("Activated"), 'switch_on');
$codeenabledisable .= img_picto($langs->trans("Activated").($warningstring ? ' '.$warningstring : ''), 'switch_on');
$codeenabledisable .= '</a>';
if (getDolGlobalInt("MAIN_FEATURES_LEVEL") > 1) {
$codeenabledisable .= '&nbsp;';
$codeenabledisable .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&amp;token='.newToken().'&amp;module_position='.$module_position.'&amp;action=reload_confirm&amp;value='.$modName.'&amp;mode='.$mode.'&amp;confirm=yes'.$param.'">';
$codeenabledisable .= img_picto($langs->trans("Reload"), 'refresh', 'class="opacitymedium"');
$codeenabledisable .= '</a>';
}
} else {
$codeenabledisable .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&amp;token='.newToken().'&amp;module_position='.$module_position.'&amp;action=reset&amp;value='.$modName.'&amp;mode='.$mode.'&amp;confirm=yes'.$param.'">';
$codeenabledisable .= img_picto($langs->trans("Activated"), 'switch_on');
$codeenabledisable .= img_picto($langs->trans("Activated").($warningstring ? ' '.$warningstring : ''), 'switch_on');
$codeenabledisable .= '</a>';
if (getDolGlobalInt("MAIN_FEATURES_LEVEL") > 1) {
$codeenabledisable .= '&nbsp;';
$codeenabledisable .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&amp;token='.newToken().'&amp;module_position='.$module_position.'&amp;action=reload&amp;value='.$modName.'&amp;mode='.$mode.'&amp;confirm=yes'.$param.'">';
$codeenabledisable .= img_picto($langs->trans("Reload"), 'refresh', 'class="opacitymedium"');
$codeenabledisable .= '</a>';
}
}
}
@ -907,7 +965,7 @@ if ($mode == 'common' || $mode == 'commonkanban') {
// Output Kanban
print $objMod->getKanbanView($codeenabledisable, $codetoconfig);
} else {
print '<tr class="oddeven">'."\n";
print '<tr class="oddeven'.($warningstring ? ' info-box-content-warning' : '').'">'."\n";
if (!empty($conf->global->MAIN_MODULES_SHOW_LINENUMBERS)) {
print '<td class="width50">'.$linenum.'</td>';
}
@ -941,7 +999,7 @@ if ($mode == 'common' || $mode == 'commonkanban') {
print '</td>';
// Version
print '<td class="center nowrap" width="120px">';
print '<td class="center nowrap" width="150px" title="'.dol_escape_htmltag(dol_string_nohtmltag($versiontrans)).'">';
if ($objMod->needUpdate) {
$versionTitle = $langs->trans('ModuleUpdateAvailable').' : '.$objMod->lastVersion;
print '<span class="badge badge-warning classfortooltip" title="'.dol_escape_htmltag($versionTitle).'">'.$versiontrans.'</span>';
@ -951,7 +1009,7 @@ if ($mode == 'common' || $mode == 'commonkanban') {
print "</td>\n";
// Link enable/disable
print '<td class="center valignmiddle" width="60px">';
print '<td class="center valignmiddle left" width="60px">';
print $codeenabledisable;
print "</td>\n";

View File

@ -84,7 +84,7 @@ $tablib[1] = "Websites";
// Requests to extract data
$tabsql = array();
$tabsql[1] = "SELECT f.rowid as rowid, f.entity, f.ref, f.description, f.virtualhost, f.position, f.status, f.date_creation FROM ".MAIN_DB_PREFIX.'website as f WHERE f.entity IN ('.getEntity('website').')';
$tabsql[1] = "SELECT f.rowid as rowid, f.entity, f.ref, f.description, f.virtualhost, f.position, f.status, f.date_creation, f.lastaccess, f.pageviews_previous_month, f.pageviews_total FROM ".MAIN_DB_PREFIX.'website as f WHERE f.entity IN ('.getEntity('website').')';
// Criteria to sort dictionaries
$tabsqlsort = array();
@ -92,7 +92,7 @@ $tabsqlsort[1] = "ref ASC";
// Nom des champs en resultat de select pour affichage du dictionnaire
$tabfield = array();
$tabfield[1] = "ref,description,virtualhost,position,date_creation";
$tabfield[1] = "ref,description,virtualhost,position,date_creation,lastaccess,pageviews_previous_month,pageviews_total";
// Nom des champs d'edition pour modification d'un enregistrement
$tabfieldvalue = array();
@ -186,7 +186,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) {
$sql .= $tabrowid[$id].",";
}
$sql .= $tabfieldinsert[$id];
$sql .= ",status)";
$sql .= ", status, date_creation)";
$sql .= " VALUES(";
// List of values
@ -211,7 +211,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) {
}
$i++;
}
$sql .= ",1)";
$sql .= ", 1, '".$db->idate(dol_now())."')";
dol_syslog("actionadd", LOG_DEBUG);
$result = $db->query($sql);
@ -441,12 +441,10 @@ if ($id) {
// Form to add a new line
if ($tabname[$id]) {
$fieldlist = explode(',', $tabfield[$id]);
// Line for title
print '<tr class="liste_titre">';
foreach ($fieldlist as $field => $value) {
if ($fieldlist[$field] == 'date_creation') {
if (in_array($fieldlist[$field], array('date_creation', 'lastaccess', 'pageviews_previous_month', 'pageviews_month', 'pageviews_total'))) {
continue;
}
@ -522,6 +520,7 @@ if ($id) {
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
print '<div class="div-table-responsive">';
print '<table class="noborder centpercent">';
// Title of lines
@ -533,6 +532,10 @@ if ($id) {
$align = "left";
$sortable = 1;
$valuetoshow = '';
if (in_array($fieldlist[$field], array('pageviews_total', 'pageviews_previous_month'))) {
$align = 'right';
}
/*
$tmparray=getLabelOfField($fieldlist[$field]);
$showfield=$tmp['showfield'];
@ -554,14 +557,24 @@ if ($id) {
if ($fieldlist[$field] == 'date_creation') {
$valuetoshow = $langs->trans("DateCreation");
}
if ($fieldlist[$field] == 'lastaccess') {
$valuetoshow = $langs->trans("LastAccess");
}
if ($fieldlist[$field] == 'pageviews_previous_month') {
$valuetoshow = $langs->trans("PagesViewedPreviousMonth");
}
if ($fieldlist[$field] == 'pageviews_total') {
$valuetoshow = $langs->trans("PagesViewedTotal");
}
// Affiche nom du champ
if ($showfield) {
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable ? $fieldlist[$field] : ''), ($page ? 'page='.$page.'&' : ''), "", "align=".$align, $sortfield, $sortorder);
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable ? $fieldlist[$field] : ''), ($page ? 'page='.$page.'&' : ''), "", '', $sortfield, $sortorder, $align.' ');
}
}
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "status", ($page ? 'page='.$page.'&' : ''), "", 'align="center"', $sortfield, $sortorder);
// Status
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "status", ($page ? 'page='.$page.'&' : ''), "", '', $sortfield, $sortorder, 'center ');
print getTitleFieldOfList('');
print getTitleFieldOfList('');
print '</tr>';
@ -581,8 +594,9 @@ if ($id) {
fieldListWebsites($fieldlist, $obj, $tabname[$id], 'edit');
}
print '<td colspan="3" class="right"><a name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'">&nbsp;</a><input type="submit" class="button button-edit" name="actionmodify" value="'.$langs->trans("Modify").'">';
print '&nbsp;<input type="submit" class="button button-cancel" name="actioncancel" value="'.$langs->trans("Cancel").'"></td>';
print '<td colspan="7" class="right"><a name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'">&nbsp;</a>';
print '<input type="submit" class="button button-edit small" name="actionmodify" value="'.$langs->trans("Modify").'">';
print '&nbsp;<input type="submit" class="button button-cancel small" name="actioncancel" value="'.$langs->trans("Cancel").'"></td>';
} else {
$tmpaction = 'view';
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
@ -593,13 +607,16 @@ if ($id) {
if (empty($reshook)) {
foreach ($fieldlist as $field => $value) {
$showfield = 1;
$align = "left";
$fieldname = $fieldlist[$field];
$align = "left";
if (in_array($fieldname, array('pageviews_total', 'pageviews_previous_month'))) {
$align = 'right';
}
$valuetoshow = $obj->$fieldname;
// Show value for field
if ($showfield) {
print '<td align="'.$align.'">'.$valuetoshow.'</td>';
print '<td class="'.$align.'">'.$valuetoshow.'</td>';
}
}
}
@ -612,9 +629,10 @@ if ($id) {
$url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&amp;code='.(!empty($obj->code) ?urlencode($obj->code) : '').'&amp;';
// Active
print '<td align="center" class="nowrap">';
print '<a class="reposition" href="'.$url.'action='.$acts[($obj->status ? 1 : 0)].'">'.$actl[($obj->status ? 1 : 0)].'</a>';
print '<a class="reposition" href="'.$url.'action='.$acts[($obj->status ? 1 : 0)].'&token='.newToken().'">'.$actl[($obj->status ? 1 : 0)].'</a>';
print "</td>";
// Modify link
@ -633,6 +651,7 @@ if ($id) {
}
print '</table>';
print '</div>';
print '</form>';
}
@ -668,6 +687,10 @@ function fieldListWebsites($fieldlist, $obj = '', $tabname = '', $context = '')
$formadmin = new FormAdmin($db);
foreach ($fieldlist as $field => $value) {
if (in_array($fieldlist[$field], array('lastaccess', 'pageviews_previous_month', 'pageviews_month', 'pageviews_total'))) {
continue;
}
$fieldname = $fieldlist[$field];
if ($fieldlist[$field] == 'lang') {

View File

@ -142,12 +142,28 @@ class DolibarrApiAccess implements iAuthenticate
if (!$login) {
throw new RestException(503, 'Error when searching login user from api key');
}
$genericmessageerroruser = 'Error user not valid (not found or bad status or bad validity dates) (conf->entity='.$conf->entity.')';
$fuser = new User($this->db);
$result = $fuser->fetch('', $login, '', 0, (empty($userentity) ? -1 : $conf->entity)); // If user is not entity 0, we search in working entity $conf->entity (that may have been forced to a different value than user entity)
if ($result <= 0) {
throw new RestException(503, 'Error when fetching user :'.$fuser->error.' (conf->entity='.$conf->entity.')');
throw new RestException(503, $genericmessageerroruser);
}
$now = dol_now();
// Check date start validity
if ($fuser->datestartvalidity && $this->db->jdate($fuser->datestartvalidity) > $now) {
throw new RestException(503, $genericmessageerroruser);
}
// Check date end validity
if ($fuser->dateendvalidity && $this->db->jdate($fuser->dateendvalidity) < dol_get_first_hour($now)) {
throw new RestException(503, $genericmessageerroruser);
}
// User seems valid
$fuser->getrights();
// Set the property $user to the $user of API

View File

@ -121,6 +121,9 @@ class Login
include_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
$login = checkLoginPassEntity($login, $password, $entity, $authmode, 'api'); // Check credentials.
if ($login === '--bad-login-validity--') {
$login = '';
}
if (empty($login)) {
throw new RestException(403, 'Access denied');
}

View File

@ -389,13 +389,13 @@ if (!empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' &&
$usecompression = (empty($conf->global->API_DISABLE_COMPRESSION) && !empty($_SERVER['HTTP_ACCEPT_ENCODING']));
$foundonealgorithm = 0;
if ($usecompression) {
if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'br') !== false && is_callable('brotli_compress')) {
if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'br') !== false && function_exists('brotli_compress')) {
$foundonealgorithm++;
}
if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'bz') !== false && is_callable('bzcompress')) {
if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'bz') !== false && function_exists('bzcompress')) {
$foundonealgorithm++;
}
if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false && is_callable('gzencode')) {
if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false && function_exists('gzencode')) {
$foundonealgorithm++;
}
if (!$foundonealgorithm) {
@ -413,13 +413,13 @@ $result = $api->r->handle();
if (Luracast\Restler\Defaults::$returnResponse) {
// We try to compress the data received data
if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'br') !== false && is_callable('brotli_compress') && defined('BROTLI_TEXT')) {
if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'br') !== false && function_exists('brotli_compress') && defined('BROTLI_TEXT')) {
header('Content-Encoding: br');
$result = brotli_compress($result, 11, constant('BROTLI_TEXT'));
} elseif (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'bz') !== false && is_callable('bzcompress')) {
} elseif (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'bz') !== false && function_exists('bzcompress')) {
header('Content-Encoding: bz');
$result = bzcompress($result, 9);
} elseif (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false && is_callable('gzencode')) {
} elseif (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false && function_exists('gzencode')) {
header('Content-Encoding: gzip');
$result = gzencode($result, 9);
} else {

View File

@ -104,7 +104,7 @@ class Booking extends CommonObject
public $fields=array(
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"),
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>1.2, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'searchall'=>1, 'validate'=>'1', 'comment'=>"Reference of object"),
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'picto'=>'company', 'enabled'=>'$conf->societe->enabled', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx', 'help'=>"LinkToThirparty", 'validate'=>'1',),
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'picto'=>'company', 'enabled'=>'isModEnabled("societe")', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx', 'help'=>"LinkToThirparty", 'validate'=>'1',),
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'picto'=>'project', 'enabled'=>'$conf->project->enabled', 'position'=>52, 'notnull'=>-1, 'visible'=>-1, 'index'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx', 'validate'=>'1',),
'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>3, 'validate'=>'1',),
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>61, 'notnull'=>0, 'visible'=>0, 'cssview'=>'wordbreak', 'validate'=>'1',),

View File

@ -54,8 +54,8 @@ class ICal
/**
* Read text file, icalender text file
*
* @param string $file File
* @return string
* @param string $file File
* @return string|null Content of remote file read or null if error
*/
public function read_file($file)
{
@ -65,7 +65,7 @@ class ICal
$tmpresult = getURLContent($file, 'GET');
if ($tmpresult['http_code'] != 200) {
$file_text = '';
$file_text = null;
$this->error = 'Error: '.$tmpresult['http_code'].' '.$tmpresult['content'];
} else {
$file_text = preg_replace("/[\r\n]{1,} /", "", $tmpresult['content']);
@ -102,17 +102,40 @@ class ICal
/**
* Translate Calendar
*
* @param string $uri Url
* @param string $uri Url
* @param string $usecachefile Full path of a cache file to use a cache file
* @param string $delaycache Delay in seconds for cache (by default 3600 secondes)
* @return array|string
*/
public function parse($uri)
public function parse($uri, $usecachefile = '', $delaycache = 3600)
{
$this->cal = array(); // new empty array
$this->event_count = -1;
$this->file_text = null;
// Save file into a cache
if ($usecachefile) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$datefile = dol_filemtime($usecachefile);
$now = dol_now('gmt');
//print $datefile.' '.$now.' ...';
if ($datefile && $datefile > ($now - $delaycache)) {
// We reuse the cache file
$this->file_text = file_get_contents($usecachefile);
}
}
// read FILE text
$this->file_text = $this->read_file($uri);
if (is_null($this->file_text)) {
$this->file_text = $this->read_file($uri);
if ($usecachefile && !is_null($this->file_text)) {
// Save the file content into cache file
file_put_contents($usecachefile, $this->file_text, LOCK_EX);
dolChmod($usecachefile);
}
}
$this->file_text = preg_split("[\n]", $this->file_text);

View File

@ -49,6 +49,7 @@ if (empty($conf->global->AGENDA_EXT_NB)) {
$conf->global->AGENDA_EXT_NB = 5;
}
$MAXAGENDA = $conf->global->AGENDA_EXT_NB;
$DELAYFORCACHE = 300; // 300 seconds
$disabledefaultvalues = GETPOST('disabledefaultvalues', 'int');
@ -299,6 +300,7 @@ if (empty($user->conf->AGENDA_DISABLE_EXT)) {
$enabled = 'AGENDA_EXT_ENABLED_'.$user->id.'_'.$i;
$default = 'AGENDA_EXT_ACTIVEBYDEFAULT_'.$user->id.'_'.$i;
$buggedfile = 'AGENDA_EXT_BUGGEDFILE_'.$user->id.'_'.$i;
if (getDolUserString($source) && getDolUserString($name)) {
// Note: $conf->global->buggedfile can be empty or 'uselocalandtznodaylight' or 'uselocalandtzdaylight'
$listofextcals[] = array(
@ -427,36 +429,33 @@ if ($mode == 'show_day' || $mode == 'show_week' || $mode == 'show_month') {
}
// Show navigation bar
$nav = '';
$nav .= '<div class="navselectiondate inline-block nowraponall">';
if (empty($mode) || $mode == 'show_month') {
$nav = "<a href=\"?year=".$prev_year."&month=".$prev_month.$param."\"><i class=\"fa fa-chevron-left\"></i></a> &nbsp;\n";
$nav .= "<a href=\"?year=".$prev_year."&month=".$prev_month.$param."\"><i class=\"fa fa-chevron-left\"></i></a> &nbsp;\n";
$nav .= " <span id=\"month_name\">".dol_print_date(dol_mktime(0, 0, 0, $month, 1, $year), "%b %Y");
$nav .= " </span>\n";
$nav .= " &nbsp; <a href=\"?year=".$next_year."&month=".$next_month.$param."\"><i class=\"fa fa-chevron-right\"></i></a>\n";
if (empty($conf->dol_optimize_smallscreen)) {
$nav .= " &nbsp; <a href=\"?year=".$nowyear."&month=".$nowmonth.$param."\">".$langs->trans("Today")."</a> ";
}
$picto = 'calendar';
}
if ($mode == 'show_week') {
$nav = "<a href=\"?year=".$prev_year."&month=".$prev_month."&day=".$prev_day.$param."\"><i class=\"fa fa-chevron-left\" title=\"".dol_escape_htmltag($langs->trans("Previous"))."\"></i></a> &nbsp;\n";
$nav .= " <span id=\"month_name\">".dol_print_date(dol_mktime(0, 0, 0, $first_month, $first_day, $first_year), "%Y").", ".$langs->trans("Week")." ".$week;
$nav .= "<a href=\"?year=".$prev_year."&month=".$prev_month."&day=".$prev_day.$param."\"><i class=\"fa fa-chevron-left\" title=\"".dol_escape_htmltag($langs->trans("Previous"))."\"></i></a> &nbsp;\n";
$nav .= " <span id=\"month_name\">".dol_print_date(dol_mktime(0, 0, 0, $first_month, $first_day, $first_year), "%Y").", ".$langs->trans("WeekShort")." ".$week;
$nav .= " </span>\n";
$nav .= " &nbsp; <a href=\"?year=".$next_year."&month=".$next_month."&day=".$next_day.$param."\"><i class=\"fa fa-chevron-right\" title=\"".dol_escape_htmltag($langs->trans("Next"))."\"></i></a>\n";
if (empty($conf->dol_optimize_smallscreen)) {
$nav .= " &nbsp; <a href=\"?year=".$nowyear."&month=".$nowmonth."&day=".$nowday.$param."\">".$langs->trans("Today")."</a> ";
}
$picto = 'calendarweek';
}
if ($mode == 'show_day') {
$nav = "<a href=\"?year=".$prev_year."&month=".$prev_month."&day=".$prev_day.$param."\"><i class=\"fa fa-chevron-left\"></i></a> &nbsp;\n";
$nav .= "<a href=\"?year=".$prev_year."&month=".$prev_month."&day=".$prev_day.$param."\"><i class=\"fa fa-chevron-left\"></i></a> &nbsp;\n";
$nav .= " <span id=\"month_name\">".dol_print_date(dol_mktime(0, 0, 0, $month, $day, $year), "daytextshort");
$nav .= " </span>\n";
$nav .= " &nbsp; <a href=\"?year=".$next_year."&month=".$next_month."&day=".$next_day.$param."\"><i class=\"fa fa-chevron-right\"></i></a>\n";
if (empty($conf->dol_optimize_smallscreen)) {
$nav .= " &nbsp; <a href=\"?year=".$nowyear."&amp;month=".$nowmonth."&amp;day=".$nowday.$param."\">".$langs->trans("Today")."</a> ";
}
$picto = 'calendarday';
}
if (empty($conf->dol_optimize_smallscreen)) {
$nav .= ' &nbsp; <a href="?year='.$nowyear.'&month='.$nowmonth.'&day='.$nowday.$param.'" class="datenowlink">'.$langs->trans("Today").'</a> ';
}
$nav .= '</div>';
$nav .= $form->selectDate($dateselect, 'dateselect', 0, 0, 1, '', 1, 0);
//$nav .= ' <input type="submit" class="button button-save" name="submitdateselect" value="'.$langs->trans("Refresh").'">';
@ -495,7 +494,8 @@ print '<input type="hidden" name="mode" value="'.$mode.'">';
//print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, $listofextcals, $actioncode, $usergroup, '', $resourceid);
//print dol_get_fiche_end();
$viewmode = '';
$viewmode = '<div class="navmode inline-block">';
$viewmode .= '<a class="btnTitle reposition" href="'.DOL_URL_ROOT.'/comm/action/list.php?mode=show_list&restore_lastsearch_values=1'.$paramnoactionodate.'">';
//$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
$viewmode .= img_picto($langs->trans("List"), 'object_calendarlist', 'class="imgforviewmode pictoactionview block"');
@ -535,6 +535,8 @@ if (empty($reshook)) {
$viewmode = $hookmanager->resPrint;
}
$viewmode .= '</div>';
$viewmode .= '<span class="marginrightonly"></span>'; // To add a space before the navigation tools
@ -614,7 +616,7 @@ if (!empty($conf->use_javascript_ajax)) { // If javascript on
$default = '';
}
$s .= '<div class="nowrap inline-block minheight30"><input type="checkbox" id="check_ext'.$htmlname.'" name="check_ext'.$htmlname.'" value="1" '.$default.'> <label for="check_ext'.$htmlname.'">'.dol_escape_htmltag($val['name']).'</label> &nbsp; </div>';
$s .= '<div class="nowrap inline-block minheight30"><input type="checkbox" id="check_ext'.$htmlname.'" name="check_ext'.$htmlname.'" value="1" '.$default.'> <label for="check_ext'.$htmlname.'" title="'.dol_escape_htmltag($langs->trans("Cache").' '.round($DELAYFORCACHE / 60).'mn').'">'.dol_escape_htmltag($val['name']).'</label> &nbsp; </div>';
}
}
@ -1009,9 +1011,13 @@ if ($mode == 'show_day') {
// Request only leaves for the current selected day
$sql .= " AND '".$db->escape($year)."-".$db->escape($month)."-".$db->escape($day)."' BETWEEN x.date_debut AND x.date_fin"; // date_debut and date_fin are date without time
} elseif ($mode == 'show_week') {
// TODO: Add filter to reduce database request
// Restrict on current month (we get more, but we will filter later)
$sql .= " AND date_debut < '".dol_get_last_day($year, $month)."'";
$sql .= " AND date_fin >= '".dol_get_first_day($year, $month)."'";
} elseif ($mode == 'show_month') {
// TODO: Add filter to reduce database request
// Restrict on current month
$sql .= " AND date_debut <= '".dol_get_last_day($year, $month)."'";
$sql .= " AND date_fin >= '".dol_get_first_day($year, $month)."'";
}
$resql = $db->query($sql);
@ -1082,8 +1088,11 @@ if (count($listofextcals)) {
$colorcal = $extcal['color'];
$buggedfile = $extcal['buggedfile'];
$pathforcachefile = dol_sanitizePathName($conf->user->dir_temp).'/'.dol_sanitizeFileName('extcal_'.$namecal.'_user'.$user->id).'.cache';
//var_dump($pathforcachefile);exit;
$ical = new ICal();
$ical->parse($url);
$ical->parse($url, $pathforcachefile, $DELAYFORCACHE);
// After this $ical->cal['VEVENT'] contains array of events, $ical->cal['DAYLIGHT'] contains daylight info, $ical->cal['STANDARD'] contains non daylight info, ...
//var_dump($ical->cal); exit;

View File

@ -600,7 +600,7 @@ $num = $db->num_rows($resql);
$arrayofselected = is_array($toselect) ? $toselect : array();
// Local calendar
$newtitle = '<div class="nowrap clear inline-block minheight30 margintoponly">';
$newtitle = '<div class="nowrap clear inline-block minheight30">';
$newtitle .= '<input type="checkbox" id="check_mytasks" name="check_mytasks" checked disabled> '.$langs->trans("LocalAgenda").' &nbsp; ';
$newtitle .= '</div>';
//$newtitle=$langs->trans($title);
@ -887,6 +887,7 @@ print "</tr>\n";
$now = dol_now();
$delay_warning = $conf->global->MAIN_DELAY_ACTIONS_TODO * 24 * 60 * 60;
$today_start_time = dol_mktime(0, 0, 0, date('m', $now), date('d', $now), date('Y', $now));
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php';
$caction = new CActionComm($db);
@ -899,6 +900,7 @@ $i = 0;
//$savnbfield = $totalarray['nbfield'];
//$totalarray['nbfield'] = 0;
$imaxinloop = ($limit ? min($num, $limit) : $num);
$cache_user_list = array();
while ($i < $imaxinloop) {
$obj = $db->fetch_object($resql);
if (empty($obj)) {
@ -933,7 +935,55 @@ while ($i < $imaxinloop) {
$actionstatic->fetchResources();
}
print '<tr class="oddeven">';
// cache of user list (owners)
if ($obj->fk_user_action > 0 && !isset($cache_user_list[$obj->fk_user_action])) {
$userstatic = new User($db);
$res = $userstatic->fetch($obj->fk_user_action);
if ($res > 0) {
$cache_user_list[$obj->fk_user_action] = $userstatic;
}
}
// get event style for user owner
$event_owner_style = '';
// We decide to choose color of owner of event (event->userownerid is user id of owner, event->userassigned contains all users assigned to event)
if ($cache_user_list[$obj->fk_user_action]->color != '') {
$event_owner_style .= 'border-left: #' . $cache_user_list[$obj->fk_user_action]->color . ' 5px solid;';
}
// get event style for start and end date
$event_more_class = '';
$event_start_date_css = '';
$event_end_date_css = '';
$event_start_date_time = $actionstatic->datep;
if ($event_start_date_time > $now) {
// future event
$event_more_class = 'event-future';
$event_start_date_css = $event_end_date_css = $event_more_class;
} else {
if ($obj->fulldayevent == 1) {
$today_start_date_time = $today_start_time;
} else {
$today_start_date_time = $now;
}
// check event end date
$event_end_date_time = $db->jdate($obj->dp2);
if ($event_end_date_time != null && $event_end_date_time < $today_start_date_time) {
// past event
$event_more_class = 'event-past';
} elseif ($event_end_date_time == null && $event_start_date_time < $today_start_date_time) {
// past event
$event_more_class = 'event-past';
} else {
// current event
$event_more_class = 'event-current';
}
$event_start_date_css = $event_end_date_css = $event_more_class;
}
$event_start_date_css = $event_end_date_css = $event_more_class;
print '<tr class="oddeven' . ($event_more_class != '' ? ' '.$event_more_class : '') . '">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="nowrap center">';
@ -955,10 +1005,16 @@ while ($i < $imaxinloop) {
// User owner
if (!empty($arrayfields['owner']['checked'])) {
print '<td class="tdoverflowmax150">'; // With edge and chrome the td overflow is not supported correctly when content is not full text.
if ($obj->fk_user_action > 0) {
$userstatic->fetch($obj->fk_user_action);
print $userstatic->getNomUrl(-1);
print '<td class="tdoverflowmax150"' . ($event_owner_style != '' ? ' style="'.$event_owner_style.'"' : '') . '>'; // With edge and chrome the td overflow is not supported correctly when content is not full text.
if ($obj->fk_user_action > 0 && !isset($cache_user_list[$obj->fk_user_action])) {
$userstatic = new User($db);
$res = $userstatic->fetch($obj->fk_user_action);
if ($res > 0) {
$cache_user_list[$obj->fk_user_action] = $userstatic;
}
}
if (isset($cache_user_list[$obj->fk_user_action])) {
print $cache_user_list[$obj->fk_user_action]->getNomUrl(-1);
} else {
print '&nbsp;';
}
@ -1006,13 +1062,14 @@ while ($i < $imaxinloop) {
// Start date
if (!empty($arrayfields['a.datep']['checked'])) {
print '<td class="center nowraponall">';
print '<td class="center nowraponall'.($event_start_date_css ? ' '.$event_start_date_css : '').'"><span>';
if (empty($obj->fulldayevent)) {
print dol_print_date($db->jdate($obj->dp), $formatToUse, 'tzuserrel');
} else {
$tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT');
print dol_print_date($db->jdate($obj->dp), $formatToUse, ($tzforfullday ? $tzforfullday : 'tzuserrel'));
}
print '</span>';
$late = 0;
if ($actionstatic->hasDelay() && $actionstatic->percentage >= 0 && $actionstatic->percentage < 100 ) {
$late = 1;
@ -1025,13 +1082,14 @@ while ($i < $imaxinloop) {
// End date
if (!empty($arrayfields['a.datep2']['checked'])) {
print '<td class="center nowraponall">';
print '<td class="center nowraponall'.($event_end_date_css ? ' '.$event_end_date_css : '').'"><span>';
if (empty($obj->fulldayevent)) {
print dol_print_date($db->jdate($obj->dp2), $formatToUse, 'tzuserrel');
} else {
$tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT');
print dol_print_date($db->jdate($obj->dp2), $formatToUse, ($tzforfullday ? $tzforfullday : 'tzuserrel'));
}
print '</span>';
print '</td>';
}

View File

@ -368,12 +368,15 @@ $max_day_in_month = date("t", dol_mktime(0, 0, 0, $month, 1, $year, 'gmt'));
$tmpday = $first_day;
$picto = 'calendarweek';
$nav = "<a href=\"?year=".$prev_year."&amp;month=".$prev_month."&amp;day=".$prev_day.$param."\">".img_previous($langs->trans("Previous"))."</a>\n";
// Show navigation bar
$nav = '<div class="navselectiondate inline-block nowraponall">';
$nav .= "<a href=\"?year=".$prev_year."&amp;month=".$prev_month."&amp;day=".$prev_day.$param."\">".img_previous($langs->trans("Previous"))."</a>\n";
$nav .= " <span id=\"month_name\">".dol_print_date(dol_mktime(0, 0, 0, $first_month, $first_day, $first_year), "%Y")."</span> \n";
$nav .= "<a href=\"?year=".$next_year."&amp;month=".$next_month."&amp;day=".$next_day.$param."\">".img_next($langs->trans("Next"))."</a>\n";
if (empty($conf->dol_optimize_smallscreen)) {
$nav .= " &nbsp; (<a href=\"?year=".$nowyear."&amp;month=".$nowmonth."&amp;day=".$nowday.$param."\">".$langs->trans("Today")."</a>)";
$nav .= " &nbsp; (<a href=\"?year=".$nowyear."&amp;month=".$nowmonth."&amp;day=".$nowday.$param.'" class="datenowlink">'.$langs->trans("Today")."</a>)";
}
$nav .= '</div>';
$nav .= $form->selectDate($dateselect, 'dateselect', 0, 0, 1, '', 1, 0);
$nav .= ' <button type="submit" class="liste_titre button_search" name="button_search_x" value="x"><span class="fa fa-search"></span></button>';

View File

@ -363,13 +363,16 @@ $max_day_in_month = date("t", dol_mktime(0, 0, 0, $month, 1, $year, 'gmt'));
$tmpday = $first_day;
$picto = 'calendarweek';
$nav = "<a href=\"?year=".$prev_year."&amp;month=".$prev_month."&amp;day=".$prev_day.$param."\"><i class=\"fa fa-chevron-left\" title=\"".dol_escape_htmltag($langs->trans("Previous"))."\"></i></a> &nbsp; \n";
// Show navigation bar
$nav = '<div class="navselectiondate inline-block nowraponall">';
$nav .= "<a href=\"?year=".$prev_year."&amp;month=".$prev_month."&amp;day=".$prev_day.$param."\"><i class=\"fa fa-chevron-left\" title=\"".dol_escape_htmltag($langs->trans("Previous"))."\"></i></a> &nbsp; \n";
$nav .= " <span id=\"month_name\">".dol_print_date(dol_mktime(0, 0, 0, $first_month, $first_day, $first_year), "%Y").", ".$langs->trans("Week")." ".$week;
$nav .= " </span>\n";
$nav .= " &nbsp; <a href=\"?year=".$next_year."&amp;month=".$next_month."&amp;day=".$next_day.$param."\"><i class=\"fa fa-chevron-right\" title=\"".dol_escape_htmltag($langs->trans("Next"))."\"></i></a>\n";
if (empty($conf->dol_optimize_smallscreen)) {
$nav .= " &nbsp; <a href=\"?year=".$nowyear."&amp;month=".$nowmonth."&amp;day=".$nowday.$param."\">".$langs->trans("Today")."</a> ";
$nav .= " &nbsp; <a href=\"?year=".$nowyear."&amp;month=".$nowmonth."&amp;day=".$nowday.$param.'" class="datenowlink">'.$langs->trans("Today").'</a> ';
}
$nav .= '</div>';
$nav .= $form->selectDate($dateselect, 'dateselect', 0, 0, 1, '', 1, 0);
$nav .= ' <button type="submit" class="liste_titre button_search" name="button_search_x" value="x"><span class="fa fa-search"></span></button>';

View File

@ -15,6 +15,7 @@
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2020 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2022 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2023 Lenin Rivas <lenin.rivas777@gmail.com>
*
* 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
@ -938,12 +939,12 @@ if (empty($reshook)) {
$prod_entry_mode = GETPOST('prod_entry_mode', 'aZ09');
if ($prod_entry_mode == 'free') {
$idprod = 0;
$tva_tx = (GETPOST('tva_tx', 'alpha') ? price2num(preg_replace('/\s*\(.*\)/', '', GETPOST('tva_tx', 'alpha'))) : 0);
} else {
$idprod = GETPOST('idprod', 'int');
$tva_tx = '';
}
$tva_tx = GETPOST('tva_tx', 'alpha');
$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS', 2);
$remise_percent = (GETPOSTISSET('remise_percent'.$predef) ? price2num(GETPOST('remise_percent'.$predef, 'alpha'), '', 2) : 0);
if (empty($remise_percent)) {
@ -992,6 +993,8 @@ if (empty($reshook)) {
if (!$error && ($qty >= 0) && (!empty($product_desc) || (!empty($idprod) && $idprod > 0))) {
$pu_ht = 0;
$pu_ttc = 0;
$pu_ht_devise = 0;
$pu_ttc_devise = 0;
$price_min = 0;
$price_min_ttc = 0;
$price_base_type = (GETPOST('price_base_type', 'alpha') ? GETPOST('price_base_type', 'alpha') : 'HT');
@ -1002,7 +1005,6 @@ if (empty($reshook)) {
// Ecrase $pu par celui du produit
// Ecrase $desc par celui du produit
// Ecrase $tva_tx par celui du produit
// Replaces $fk_unit with the product unit
if (!empty($idprod) && $idprod > 0) {
$prod = new Product($db);
@ -1011,11 +1013,11 @@ if (empty($reshook)) {
$label = ((GETPOST('product_label') && GETPOST('product_label') != $prod->label) ? GETPOST('product_label') : '');
// Update if prices fields are defined
$tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id);
/*$tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id);
$tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id);
if (empty($tva_tx)) {
$tva_npr = 0;
}
}*/
// Price unique per product
$pu_ht = $prod->price;
@ -1056,14 +1058,14 @@ if (empty($reshook)) {
$price_min = price($prodcustprice->lines[0]->price_min);
$price_min_ttc = price($prodcustprice->lines[0]->price_min_ttc);
$price_base_type = $prodcustprice->lines[0]->price_base_type;
$tva_tx = ($prodcustprice->lines[0]->default_vat_code ? $prodcustprice->lines[0]->tva_tx.' ('.$prodcustprice->lines[0]->default_vat_code.' )' : $prodcustprice->lines[0]->tva_tx);
/*$tva_tx = ($prodcustprice->lines[0]->default_vat_code ? $prodcustprice->lines[0]->tva_tx.' ('.$prodcustprice->lines[0]->default_vat_code.' )' : $prodcustprice->lines[0]->tva_tx);
if ($prodcustprice->lines[0]->default_vat_code && !preg_match('/\(.*\)/', $tva_tx)) {
$tva_tx .= ' ('.$prodcustprice->lines[0]->default_vat_code.')';
}
$tva_npr = $prodcustprice->lines[0]->recuperableonly;
if (empty($tva_tx)) {
$tva_npr = 0;
}
}*/
}
}
} elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) {
@ -1114,12 +1116,12 @@ if (empty($reshook)) {
$tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx));
// Set unit price to use
if (!empty($price_ht) || $price_ht === '0') {
if (!empty($price_ht) || (string) $price_ht === '0') {
$pu_ht = price2num($price_ht, 'MU');
$pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');
} elseif (!empty($price_ttc) || $price_ttc === '0') {
$pu_ttc = price2num($pu_ht * (1 + ((float) $tmpvat / 100)), 'MU');
} elseif (!empty($price_ttc) || (string) $price_ttc === '0') {
$pu_ttc = price2num($price_ttc, 'MU');
$pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU');
$pu_ht = price2num($pu_ttc / (1 + ((float) $tmpvat / 100)), 'MU');
} elseif ($tmpvat != $tmpprodvat) {
// Is this still used ?
if ($price_base_type != 'HT') {
@ -1416,12 +1418,12 @@ if (empty($reshook)) {
//var_dump(price2num($price_min_ttc)); var_dump(price2num($pu_ttc)); var_dump($remise_percent);exit;
if ($usermustrespectpricemin) {
if ($pu_equivalent && $price_min && ((price2num($pu_equivalent) * (1 - $remise_percent / 100)) < price2num($price_min))) {
if ($pu_equivalent && $price_min && ((price2num($pu_equivalent) * (1 - (float) $remise_percent / 100)) < price2num($price_min))) {
$mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, -1, $conf->currency));
setEventMessages($mesg, null, 'errors');
$error++;
$action = 'editline';
} elseif ($pu_equivalent_ttc && $price_min_ttc && ((price2num($pu_equivalent_ttc) * (1 - $remise_percent / 100)) < price2num($price_min_ttc))) {
} elseif ($pu_equivalent_ttc && $price_min_ttc && ((price2num($pu_equivalent_ttc) * (1 - (float) $remise_percent / 100)) < price2num($price_min_ttc))) {
$mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min_ttc, 'MU'), 0, $langs, 0, 0, -1, $conf->currency));
setEventMessages($mesg, null, 'errors');
$error++;
@ -1928,7 +1930,7 @@ if ($action == 'create') {
print '<tr class="field_note_public">';
print '<td class="titlefieldcreate tdtop">'.$langs->trans('NotePublic').'</td>';
print '<td class="valuefieldcreate">';
$note_public = $object->getDefaultCreateValueFor('note_public', (!empty($objectsrc) ? $objectsrc->note_public : null));
$note_public = $object->getDefaultCreateValueFor('note_public', (!empty($objectsrc) ? $objectsrc->note_public : (!empty($conf->global->PROPALE_ADDON_NOTE_PUBLIC_DEFAULT) ? $conf->global->PROPALE_ADDON_NOTE_PUBLIC_DEFAULT : null)), 'restricthtml');
$doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PUBLIC) ? 0 : 1, ROWS_3, '90%');
print $doleditor->Create(1);

View File

@ -301,7 +301,7 @@ class Propal extends CommonObject
'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>20),
'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>22),
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'RefExt', 'enabled'=>1, 'visible'=>0, 'position'=>40),
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'position'=>23),
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'isModEnabled("societe")', 'visible'=>-1, 'position'=>23),
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>"isModEnabled('project')", 'visible'=>-1, 'position'=>24),
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>25),
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>55),
@ -2903,7 +2903,7 @@ class Propal extends CommonObject
* @param int $offset For pagination
* @param string $sortfield Sort criteria
* @param string $sortorder Sort order
* @return int -1 if KO, array with result if OK
* @return array|int -1 if KO, array with result if OK
*/
public function liste_array($shortlist = 0, $draft = 0, $notcurrentuser = 0, $socid = 0, $limit = 0, $offset = 0, $sortfield = 'p.datep', $sortorder = 'DESC')
{
@ -2982,8 +2982,8 @@ class Propal extends CommonObject
/**
* Returns an array with id and ref of related invoices
*
* @param int $id Id propal
* @return array Array of invoices id
* @param int $id Id propal
* @return array|int Array of invoices id
*/
public function InvoiceArrayList($id)
{
@ -3914,6 +3914,41 @@ class Propal extends CommonObject
return CommonObject::commonReplaceProduct($db, $origin_id, $dest_id, $tables);
}
/**
* Return clicable link of object (with eventually picto)
*
* @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link)
* @return string HTML Code for Kanban thumb.
*/
public function getKanbanView($option = '')
{
global $langs;
$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">';
$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>';
if (property_exists($this, 'fk_project')) {
$return .= '<span class="info-box-ref"> | '.$this->fk_project.'</span>';
}
if (property_exists($this, 'author')) {
$return .= '<br><span class="info-box-label">'.$this->author.'</span>';
}
if (property_exists($this, 'total_ht')) {
$return .='<br><span class="" >'.$langs->trans("AmountHT").' : </span><span class="info-box-label amount">'.price($this->total_ht).'</span>';
}
if (method_exists($this, 'getLibStatut')) {
$return .= '<br><div class="info-box-status margintoponly">'.$this->getLibStatut(5).'</div>';
}
$return .= '</div>';
$return .= '</div>';
$return .= '</div>';
return $return;
}
}
/**

File diff suppressed because it is too large Load Diff

View File

@ -676,12 +676,11 @@ if (empty($reshook)) {
$prod_entry_mode = GETPOST('prod_entry_mode', 'aZ09');
if ($prod_entry_mode == 'free') {
$idprod = 0;
$tva_tx = (GETPOST('tva_tx', 'alpha') ? price2num(preg_replace('/\s*\(.*\)/', '', GETPOST('tva_tx', 'alpha'))) : 0);
} else {
$idprod = GETPOST('idprod', 'int');
$tva_tx = '';
}
$tva_tx = GETPOST('tva_tx', 'alpha');
// Prepare a price equivalent for minimum price check
$pu_equivalent = $pu_ht;
@ -762,7 +761,6 @@ if (empty($reshook)) {
// Ecrase $pu par celui du produit
// Ecrase $desc par celui du produit
// Ecrase $tva_tx par celui du produit
// Ecrase $base_price_type par celui du produit
if (!empty($idprod) && $idprod > 0) {
$prod = new Product($db);
@ -771,11 +769,11 @@ if (empty($reshook)) {
$label = ((GETPOST('product_label') && GETPOST('product_label') != $prod->label) ? GETPOST('product_label') : '');
// Update if prices fields are defined
$tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id);
/*$tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id);
$tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id);
if (empty($tva_tx)) {
$tva_npr = 0;
}
}*/
$pu_ht = $prod->price;
$pu_ttc = $prod->price_ttc;

View File

@ -306,7 +306,7 @@ class Commande extends CommonOrder
'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>25),
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'RefExt', 'enabled'=>1, 'visible'=>0, 'position'=>26),
'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>28),
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>20),
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'isModEnabled("societe")', 'visible'=>-1, 'notnull'=>1, 'position'=>20),
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>"isModEnabled('project')", 'visible'=>-1, 'position'=>25),
'date_commande' =>array('type'=>'date', 'label'=>'Date', 'enabled'=>1, 'visible'=>1, 'position'=>60),
'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>62),
@ -4597,6 +4597,9 @@ class OrderLine extends CommonOrderLine
if (empty($this->remise_percent)) {
$this->remise_percent = 0;
}
if (empty($this->remise)) {
$this->remise = 0;
}
if (empty($this->info_bits)) {
$this->info_bits = 0;
}

View File

@ -1526,16 +1526,16 @@ if ($resql) {
}
// Town
if (!empty($arrayfields['s.town']['checked'])) {
print '<td class="liste_titre"><input class="flat" type="text" size="4" name="search_town" value="'.dol_escape_htmltag($search_town).'"></td>';
print '<td class="liste_titre"><input class="flat width50" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).'"></td>';
}
// Zip
if (!empty($arrayfields['s.zip']['checked'])) {
print '<td class="liste_titre"><input class="flat" type="text" size="4" name="search_zip" value="'.dol_escape_htmltag($search_zip).'"></td>';
print '<td class="liste_titre"><input class="flat width50" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).'"></td>';
}
// State
if (!empty($arrayfields['state.nom']['checked'])) {
print '<td class="liste_titre">';
print '<input class="flat" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).'">';
print '<input class="flat width50" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).'">';
print '</td>';
}
// Country
@ -1723,18 +1723,18 @@ if ($resql) {
}
// Status billed
if (!empty($arrayfields['c.facture']['checked'])) {
print '<td class="liste_titre maxwidthonsmartphone" align="center">';
print '<td class="liste_titre maxwidthonsmartphone center">';
print $form->selectyesno('search_billed', $search_billed, 1, 0, 1, 1);
print '</td>';
}
// Import key
if (!empty($arrayfields['c.import_key']['checked'])) {
print '<td class="liste_titre maxwidthonsmartphone" align="center">';
print '<td class="liste_titre maxwidthonsmartphone center">';
print '</td>';
}
// Status
if (!empty($arrayfields['c.fk_statut']['checked'])) {
print '<td class="liste_titre center parentonrightofpage">';
print '<td class="liste_titre right parentonrightofpage">';
$liststatus = array(
Commande::STATUS_DRAFT=>$langs->trans("StatusOrderDraftShort"),
Commande::STATUS_VALIDATED=>$langs->trans("StatusOrderValidated"),
@ -1907,7 +1907,7 @@ if ($resql) {
print_liste_field_titre($arrayfields['c.import_key']['label'], $_SERVER["PHP_SELF"], "c.import_key", "", $param, '', $sortfield, $sortorder, 'center ');
}
if (!empty($arrayfields['c.fk_statut']['checked'])) {
print_liste_field_titre($arrayfields['c.fk_statut']['label'], $_SERVER["PHP_SELF"], "c.fk_statut", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre($arrayfields['c.fk_statut']['label'], $_SERVER["PHP_SELF"], "c.fk_statut", "", $param, '', $sortfield, $sortorder, 'right ');
}
if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'maxwidthsearch center ');
@ -2623,7 +2623,7 @@ if ($resql) {
// Import key
if (!empty($arrayfields['c.import_key']['checked'])) {
print '<td class="nowrap center">'.$obj->import_key.'</td>';
print '<td class="nowrap center">'.dol_escape_htmltag($obj->import_key).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
@ -2631,7 +2631,7 @@ if ($resql) {
// Status
if (!empty($arrayfields['c.fk_statut']['checked'])) {
print '<td class="nowrap center">'.$generic_commande->LibStatut($obj->fk_statut, $obj->billed, 5, 1).'</td>';
print '<td class="nowrap right">'.$generic_commande->LibStatut($obj->fk_statut, $obj->billed, 5, 1).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}

View File

@ -793,6 +793,15 @@ if ($resql) {
if ($search_fk_input_reason > 0) {
$param .= '&search_fk_input_reason='.urlencode($search_fk_input_reason);
}
if (!empty($productobuy)) {
$param .= '&productobuy='.urlencode($productobuy);
}
if (!empty($productonly)) {
$param .= '&productonly='.urlencode($productonly);
}
if (!empty($disablelinefree)) {
$param .= '&disablelinefree='.urlencode($disablelinefree);
}
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
@ -830,10 +839,6 @@ if ($resql) {
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'order', 0, $newcardbutton, '', $limit, 0, 0, 1);
print '<input type="checkbox" name="productobuy"'.(!empty($productobuy)?'value="productobuychecked" checked':'' ).'><label for="productobuy">'.$langs->trans("productobuy").'</label>';
print '<input type="checkbox" name="productonly"'.(!empty($productonly)?'value="productonlychecked" checked':'' ).'><label for="productonly">'.$langs->trans("productonly").'</label>';
print '<input type="checkbox" name="disablelinefree"'.(!empty($disablelinefree)?'value="disablelinefreechecked" checked':'' ).'><label for="disablelinefree">'.$langs->trans("disablelinefree").'</label>';
$topicmail = "SendOrderRef";
$modelmail = "order_send";
$objecttmp = new Commande($db);
@ -849,6 +854,11 @@ if ($resql) {
$moreforfilter = '';
$moreforfilter .= '<input type="checkbox" name="productobuy"'.(!empty($productobuy)?'value="productobuychecked" checked':'' ).'><label for="productobuy">'.$langs->trans("productobuy").'</label>';
$moreforfilter .= '<input type="checkbox" name="productonly"'.(!empty($productonly)?'value="productonlychecked" checked':'' ).'><label for="productonly">'.$langs->trans("productonly").'</label>';
$moreforfilter .= '<input type="checkbox" name="disablelinefree"'.(!empty($disablelinefree)?'value="disablelinefreechecked" checked':'' ).'><label for="disablelinefree">'.$langs->trans("disablelinefree").'</label>';
$moreforfilter .= '<br>';
// If the user can view prospects other than his'
if ($user->rights->user->user->lire) {
$langs->load("commercial");
@ -888,6 +898,8 @@ if ($resql) {
$moreforfilter .= img_picto($tmptitle, 'stock', 'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse, 'search_warehouse', '', 1, 0, 0, $tmptitle, 0, 0, array(), 'maxwidth250 widthcentpercentminusx');
$moreforfilter .= '</div>';
}
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
if (empty($reshook)) {
@ -1402,6 +1414,7 @@ if ($resql) {
$total_ht = 0;
$total_margin = 0;
// Détail commande
$totalqty = 0;
@ -1419,6 +1432,15 @@ if ($resql) {
$text_warning = '';
$nbprod = 0;
// Print SubTotal
if (empty($i)) {
$oldref = $obj->product_ref;
}
if ($oldref != $obj->product_ref) {
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
$oldref = $obj->product_ref;
}
$companystatic->id = $obj->socid;
$companystatic->name = $obj->name;
$companystatic->name_alias = $obj->alias;
@ -1509,10 +1531,7 @@ if ($resql) {
}
// Product QtyOrdered
if (!empty($arrayfields['cdet.qty']['checked'])) {
print '<td class="nowrap tdoverflowmax200">'.$obj->qty.'</td>';
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 'cdet.qty';
}
print '<td class="nowrap right">'.$obj->qty.'</td>';
if (isset($totalarray['val']['cdet.qty'])) {
$totalarray['val']['cdet.qty'] += $obj->qty;
} else {
@ -1521,6 +1540,9 @@ if ($resql) {
if (!$i) {
$totalarray['nbfield']++;
}
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 'cdet.qty';
}
}
// Ref

View File

@ -1748,6 +1748,39 @@ class Account extends CommonObject
return false;
}
}
/**
* Return clicable link of object (with eventually picto)
*
* @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link)
* @return string HTML Code for Kanban thumb.
*/
public function getKanbanView($option = '')
{
global $langs;
$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">';
$return .= img_picto('', $this->picto);
$return .= '</span>';
$return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>';
if (property_exists($this, 'type_lib')) {
$return .= '<br><span class="info-box-label opacitymedium" title="'.$this->type_lib[$this->type].'">'.substr($this->type_lib[$this->type], 0, 24).'...</span>';
}
if (method_exists($this, 'solde')) {
$return .= '<br><a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?id='.$this->id.'">';
$return .= '<span class="opacitymedium">'.$langs->trans("Balance").'</span> : <span class="amount">'.price($this->solde(1), 0, $langs, 1, -1, -1, $this->currency_code).'</span>';
}
if (method_exists($this, 'getLibStatut')) {
$return .= '<br><div class="info-box-status margintoponly">'.$this->getLibStatut(5).'</div>';
}
$return .= '</div>';
$return .= '</div>';
$return .= '</div>';
return $return;
}
}

View File

@ -768,4 +768,41 @@ class PaymentVarious extends CommonObject
}
return 0;
}
/**
* Return clicable link of object (with eventually picto)
*
* @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link)
* @return string HTML Code for Kanban thumb.
*/
public function getKanbanView($option = '')
{
global $langs;
$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">';
$return .= img_picto('', $this->picto);
$return .= '</span>';
$return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</span>';
if (property_exists($this, 'fk_bank')) {
$return .= ' | <span class="info-box-status ">'.$this->fk_bank.'</span>';
}
if (property_exists($this, 'datep')) {
$return .= '<br><span class="opacitymedium">'.$langs->trans("Date").'</span> : <span class="info-box-label">'.dol_print_date($this->db->jdate($this->datep), 'day').'</span>';
}
if (property_exists($this, 'type_payment') && !empty($this->type_payment)) {
$return .= '<br><span class="opacitymedium">'.$langs->trans("Payment", $this->type_payment).'</span> : <span class="info-box-label">'.$this->type_payment.'</span>';
}
if (property_exists($this, 'accountancy_code')) {
$return .= '<br><span class="opacitymedium">'.$langs->trans("Account").'</span> : <span class="info-box-label" title="'.$this->accountancy_code.'">'.$this->accountancy_code.'</span>';
}
if (property_exists($this, 'amount')) {
$return .= '<br><span class="opacitymedium">'.$langs->trans("Debit").'</span> : <span class="info-box-label amount">'.price($this->amount).'</span>';
}
$return .= '</div>';
$return .= '</div>';
$return .= '</div>';
return $return;
}
}

View File

@ -52,6 +52,7 @@ $show_files = GETPOST('show_files', 'int');
$confirm = GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'bankaccountlist'; // To manage different context of search
$mode = GETPOST('mode', 'alpha');
$search_ref = GETPOST('search_ref', 'alpha');
$search_label = GETPOST('search_label', 'alpha');
@ -305,6 +306,9 @@ llxHeader('', $title, $help_url);
$arrayofselected = is_array($toselect) ? $toselect : array();
$param = '';
if (!empty($mode)) {
$param .= '&mode='.urlencode($mode);
}
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
@ -365,8 +369,13 @@ print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="search_status" value="'.$search_status.'">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
$newcardbutton = dolGetButtonTitle($langs->trans('NewFinancialAccount'), '', 'fa fa-plus-circle', 'card.php?action=create', '', $user->rights->banque->configurer);
$newcardbutton = '';
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('NewFinancialAccount'), '', 'fa fa-plus-circle', 'card.php?action=create', '', $user->rights->banque->configurer);
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'bank_account', 0, $newcardbutton, '', $limit, 1);
@ -584,224 +593,236 @@ foreach ($accounts as $key => $type) {
$lastcurrencycode = $objecttmp->currency_code;
}
print '<tr class="oddeven">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="nowrap center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($objecttmp->id, $arrayofselected)) {
$selected = 1;
if ($mode == 'kanban') {
if ($i == 0) {
print '<tr><td colspan="12">';
print '<div class="box-flex-container">';
}
// Output Kanban
print $objecttmp->getKanbanView('');
if ($i == (min($num, $limit) - 1)) {
print '</div>';
print '</td></tr>';
}
} else {
print '<tr class="oddeven">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="nowrap center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($objecttmp->id, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb'.$objecttmp->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$objecttmp->id.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '<input id="cb'.$objecttmp->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$objecttmp->id.'"'.($selected ? ' checked="checked"' : '').'>';
print '</td>';
}
print '</td>';
}
// Ref
if (!empty($arrayfields['b.ref']['checked'])) {
print '<td class="nowraponall">'.$objecttmp->getNomUrl(1).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Label
if (!empty($arrayfields['b.label']['checked'])) {
print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($objecttmp->label).'">'.dol_escape_htmltag($objecttmp->label).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Account type
if (!empty($arrayfields['accountype']['checked'])) {
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($objecttmp->type_lib[$objecttmp->type]).'">';
print $objecttmp->type_lib[$objecttmp->type];
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Number
if (!empty($arrayfields['b.number']['checked'])) {
print '<td>'.dol_escape_htmltag($objecttmp->number).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Account number
if (!empty($arrayfields['b.account_number']['checked'])) {
print '<td class="tdoverflowmax250">';
if (isModEnabled('accounting') && !empty($objecttmp->account_number)) {
$accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch('', $objecttmp->account_number, 1);
print '<span title="'.dol_escape_htmltag($accountingaccount->account_number.' - '.$accountingaccount->label).'">';
print $accountingaccount->getNomUrl(0, 1, 1, '', 0);
print '</span>';
} else {
print '<span title="'.dol_escape_htmltag($objecttmp->account_number).'">'.$objecttmp->account_number.'</span>';
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Accountancy journal
if (!empty($arrayfields['b.fk_accountancy_journal']['checked'])) {
print '<td class="tdoverflowmax125">';
if (isModEnabled('accounting')) {
if (empty($objecttmp->fk_accountancy_journal)) {
print img_warning($langs->trans("Mandatory"));
} else {
$accountingjournal = new AccountingJournal($db);
$accountingjournal->fetch($objecttmp->fk_accountancy_journal);
print $accountingjournal->getNomUrl(0, 1, 1, '', 1);
// Ref
if (!empty($arrayfields['b.ref']['checked'])) {
print '<td class="nowraponall">'.$objecttmp->getNomUrl(1).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
} else {
print '';
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Currency
if (!empty($arrayfields['b.currency_code']['checked'])) {
print '<td class="center nowraponall">';
print $objecttmp->currency_code;
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Transactions to reconcile
if (!empty($arrayfields['toreconcile']['checked'])) {
$conciliate = $objecttmp->canBeConciliated();
$labeltoshow = '';
if ($conciliate == -2) {
$labeltoshow = $langs->trans("CashAccount");
} elseif ($conciliate == -3) {
$labeltoshow = $langs->trans("Closed");
} elseif (empty($objecttmp->rappro)) {
$labeltoshow = $langs->trans("ConciliationDisabled");
}
print '<td class="center tdoverflowmax125"'.($labeltoshow ? ' title="'.dol_escape_htmltag($labeltoshow).'"' : '').'>';
if ($conciliate == -2) {
print '<span class="opacitymedium">'.$langs->trans("CashAccount").'</span>';
} elseif ($conciliate == -3) {
print '<span class="opacitymedium">'.$langs->trans("Closed").'</span>';
} elseif (empty($objecttmp->rappro)) {
print '<span class="opacitymedium">'.$langs->trans("ConciliationDisabled").'</span>';
} else {
$result = $objecttmp->load_board($user, $objecttmp->id);
if (is_numeric($result) && $result < 0) {
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
} else {
print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?action=reconcile&sortfield=b.datev,b.dateo,b.rowid&sortorder=asc,asc,asc&id='.$objecttmp->id.'&search_account='.$objecttmp->id.'&search_conciliated=0&contextpage=banktransactionlist">';
print '<span class="badge badge-info classfortooltip" title="'.dol_htmlentities($langs->trans("TransactionsToConciliate")).'">';
print $result->nbtodo;
// Label
if (!empty($arrayfields['b.label']['checked'])) {
print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($objecttmp->label).'">'.dol_escape_htmltag($objecttmp->label).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Account type
if (!empty($arrayfields['accountype']['checked'])) {
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($objecttmp->type_lib[$objecttmp->type]).'">';
print $objecttmp->type_lib[$objecttmp->type];
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Number
if (!empty($arrayfields['b.number']['checked'])) {
print '<td>'.dol_escape_htmltag($objecttmp->number).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Account number
if (!empty($arrayfields['b.account_number']['checked'])) {
print '<td class="tdoverflowmax250">';
if (isModEnabled('accounting') && !empty($objecttmp->account_number)) {
$accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch('', $objecttmp->account_number, 1);
print '<span title="'.dol_escape_htmltag($accountingaccount->account_number.' - '.$accountingaccount->label).'">';
print $accountingaccount->getNomUrl(0, 1, 1, '', 0);
print '</span>';
print '</a>';
if ($result->nbtodolate) {
print '<span title="'.dol_htmlentities($langs->trans("Late")).'" class="classfortooltip badge badge-danger marginleftonlyshort">';
print '<i class="fa fa-exclamation-triangle"></i> '.$result->nbtodolate;
} else {
print '<span title="'.dol_escape_htmltag($objecttmp->account_number).'">'.$objecttmp->account_number.'</span>';
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Accountancy journal
if (!empty($arrayfields['b.fk_accountancy_journal']['checked'])) {
print '<td class="tdoverflowmax125">';
if (isModEnabled('accounting')) {
if (empty($objecttmp->fk_accountancy_journal)) {
print img_warning($langs->trans("Mandatory"));
} else {
$accountingjournal = new AccountingJournal($db);
$accountingjournal->fetch($objecttmp->fk_accountancy_journal);
print $accountingjournal->getNomUrl(0, 1, 1, '', 1);
}
} else {
print '';
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Currency
if (!empty($arrayfields['b.currency_code']['checked'])) {
print '<td class="center nowraponall">';
print $objecttmp->currency_code;
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Transactions to reconcile
if (!empty($arrayfields['toreconcile']['checked'])) {
$conciliate = $objecttmp->canBeConciliated();
$labeltoshow = '';
if ($conciliate == -2) {
$labeltoshow = $langs->trans("CashAccount");
} elseif ($conciliate == -3) {
$labeltoshow = $langs->trans("Closed");
} elseif (empty($objecttmp->rappro)) {
$labeltoshow = $langs->trans("ConciliationDisabled");
}
print '<td class="center tdoverflowmax125"'.($labeltoshow ? ' title="'.dol_escape_htmltag($labeltoshow).'"' : '').'>';
if ($conciliate == -2) {
print '<span class="opacitymedium">'.$langs->trans("CashAccount").'</span>';
} elseif ($conciliate == -3) {
print '<span class="opacitymedium">'.$langs->trans("Closed").'</span>';
} elseif (empty($objecttmp->rappro)) {
print '<span class="opacitymedium">'.$langs->trans("ConciliationDisabled").'</span>';
} else {
$result = $objecttmp->load_board($user, $objecttmp->id);
if (is_numeric($result) && $result < 0) {
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
} else {
print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?action=reconcile&sortfield=b.datev,b.dateo,b.rowid&sortorder=asc,asc,asc&id='.$objecttmp->id.'&search_account='.$objecttmp->id.'&search_conciliated=0&contextpage=banktransactionlist">';
print '<span class="badge badge-info classfortooltip" title="'.dol_htmlentities($langs->trans("TransactionsToConciliate")).'">';
print $result->nbtodo;
print '</span>';
print '</a>';
if ($result->nbtodolate) {
print '<span title="'.dol_htmlentities($langs->trans("Late")).'" class="classfortooltip badge badge-danger marginleftonlyshort">';
print '<i class="fa fa-exclamation-triangle"></i> '.$result->nbtodolate;
print '</span>';
}
}
}
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Extra fields
if (is_array($objecttmp->array_options)) {
$obj = new stdClass();
foreach ($objecttmp->array_options as $k => $v) {
$obj->$k = $v;
}
}
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $objecttmp, $action); // Note that $action and $objecttmpect may have been modified by hook
print $hookmanager->resPrint;
// Date creation
if (!empty($arrayfields['b.datec']['checked'])) {
print '<td class="center nowraponall">';
print dol_print_date($objecttmp->date_creation, 'dayhour');
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Date modification
if (!empty($arrayfields['b.tms']['checked'])) {
print '<td class="center nowraponall">';
print dol_print_date($objecttmp->date_update, 'dayhour');
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Status
if (!empty($arrayfields['b.clos']['checked'])) {
print '<td class="center">'.$objecttmp->getLibStatut(5).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Balance
if (!empty($arrayfields['balance']['checked'])) {
print '<td class="nowraponall right">';
print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?id='.$objecttmp->id.'">';
print '<span class="amount">'.price($solde, 0, $langs, 1, -1, -1, $objecttmp->currency_code).'</span>';
print '</a>';
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 'balance';
}
$totalarray['val']['balance'] += $solde;
}
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="nowrap center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($objecttmp->id, $arrayofselected)) {
$selected = 1;
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
print '<input id="cb'.$objecttmp->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$objecttmp->id.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '</td>';
}
if (!$i) {
$totalarray['nbfield']++;
}
print '</tr>';
// Extra fields
if (is_array($objecttmp->array_options)) {
$obj = new stdClass();
foreach ($objecttmp->array_options as $k => $v) {
$obj->$k = $v;
}
}
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $objecttmp, $action); // Note that $action and $objecttmpect may have been modified by hook
print $hookmanager->resPrint;
// Date creation
if (!empty($arrayfields['b.datec']['checked'])) {
print '<td class="center nowraponall">';
print dol_print_date($objecttmp->date_creation, 'dayhour');
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Date modification
if (!empty($arrayfields['b.tms']['checked'])) {
print '<td class="center nowraponall">';
print dol_print_date($objecttmp->date_update, 'dayhour');
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
if (empty($total[$objecttmp->currency_code])) {
$total[$objecttmp->currency_code] = $solde;
} else {
$total[$objecttmp->currency_code] += $solde;
// Status
if (!empty($arrayfields['b.clos']['checked'])) {
print '<td class="center">'.$objecttmp->getLibStatut(5).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Balance
if (!empty($arrayfields['balance']['checked'])) {
print '<td class="nowraponall right">';
print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?id='.$objecttmp->id.'">';
print '<span class="amount">'.price($solde, 0, $langs, 1, -1, -1, $objecttmp->currency_code).'</span>';
print '</a>';
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 'balance';
}
$totalarray['val']['balance'] += $solde;
}
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="nowrap center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($objecttmp->id, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb'.$objecttmp->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$objecttmp->id.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '</td>';
}
if (!$i) {
$totalarray['nbfield']++;
}
print '</tr>';
if (empty($total[$objecttmp->currency_code])) {
$total[$objecttmp->currency_code] = $solde;
} else {
$total[$objecttmp->currency_code] += $solde;
}
}
$i++;
}

View File

@ -46,6 +46,7 @@ if ($user->socid) {
}
$optioncss = GETPOST('optioncss', 'alpha');
$mode = GETPOST('mode', 'alpha');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$search_ref = GETPOST('search_ref', 'int');
@ -313,6 +314,9 @@ if ($resql) {
$total = 0;
$param = '';
if (!empty($mode)) {
$param .= '&mode='.urlencode($mode);
}
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
@ -363,7 +367,10 @@ if ($resql) {
if (!empty($socid)) {
$url .= '&socid='.urlencode($socid);
}
$newcardbutton = dolGetButtonTitle($langs->trans('MenuNewVariousPayment'), '', 'fa fa-plus-circle', $url, '', $user->rights->banque->modifier);
$newcardbutton = '';
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('MenuNewVariousPayment'), '', 'fa fa-plus-circle', $url, '', $user->rights->banque->modifier);
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
@ -376,6 +383,8 @@ if ($resql) {
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
print_barre_liste($langs->trans("MenuVariousPayment"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'object_payment', 0, $newcardbutton, '', $limit, 0, 0, 1);
@ -569,166 +578,187 @@ if ($resql) {
$variousstatic->id = $obj->rowid;
$variousstatic->ref = $obj->rowid;
$variousstatic->label = $obj->label;
$variousstatic->datep = $obj->datep;
$variousstatic->type_payment = $obj->payment_code;
$bankline->fetch($obj->fk_bank);
$variousstatic->fk_bank = $bankline->getNomUrl(1);
$variousstatic->amount = $obj->amount;
print '<tr class="oddeven">';
$accountingaccount->fetch('', $obj->accountancy_code, 1);
$variousstatic->accountancy_code = $accountingaccount->getNomUrl(0, 0, 1, $obj->accountingaccount, 1);
// No
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
print '<td>'.(($offset * $limit) + $i).'</td>';
}
// Ref
if ($arrayfields['ref']['checked']) {
print '<td>'.$variousstatic->getNomUrl(1)."</td>";
if (!$i) {
$totalarray['nbfield']++;
if ($mode == 'kanban') {
if ($i == 0) {
print '<tr><td colspan="12">';
print '<div class="box-flex-container">';
}
}
// Output Kanban
// Label payment
if ($arrayfields['label']['checked']) {
print '<td class="tdoverflowmax150" title="'.$variousstatic->label.'">'.$variousstatic->label."</td>";
if (!$i) {
$totalarray['nbfield']++;
print $variousstatic->getKanbanView('');
if ($i == (min($num, $limit) - 1)) {
print '</div>';
print '</td></tr>';
}
}
} else {
print '<tr class="oddeven">';
// Date payment
if ($arrayfields['datep']['checked']) {
print '<td class="center">'.dol_print_date($obj->datep, 'day')."</td>";
if (!$i) {
$totalarray['nbfield']++;
// No
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
print '<td>'.(($offset * $limit) + $i).'</td>';
}
}
// Date value
if ($arrayfields['datev']['checked']) {
print '<td class="center">'.dol_print_date($obj->datev, 'day')."</td>";
if (!$i) {
$totalarray['nbfield']++;
}
}
// Type
if ($arrayfields['type']['checked']) {
print '<td class="center">';
if ($obj->payment_code) {
print $langs->trans("PaymentTypeShort".$obj->payment_code);
print ' ';
}
print $obj->num_payment;
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Project
if ($arrayfields['project']['checked']) {
print '<td class="nowraponall">';
if ($obj->fk_project > 0) {
$proj->fetch($obj->fk_project);
print $proj->getNomUrl(1);
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Bank account
if ($arrayfields['bank']['checked']) {
print '<td class="nowraponall">';
if ($obj->bid > 0) {
$accountstatic->id = $obj->bid;
$accountstatic->ref = $obj->bref;
$accountstatic->number = $obj->bnumber;
if (isModEnabled('accounting')) {
$accountstatic->account_number = $obj->bank_account_number;
$accountingjournal->fetch($obj->accountancy_journal);
$accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1);
// Ref
if ($arrayfields['ref']['checked']) {
print '<td>'.$variousstatic->getNomUrl(1)."</td>";
if (!$i) {
$totalarray['nbfield']++;
}
$accountstatic->label = $obj->blabel;
print $accountstatic->getNomUrl(1);
} else {
print '&nbsp;';
}
print '</td>';
// Label payment
if ($arrayfields['label']['checked']) {
print '<td class="tdoverflowmax150" title="'.$variousstatic->label.'">'.$variousstatic->label."</td>";
if (!$i) {
$totalarray['nbfield']++;
}
}
// Date payment
if ($arrayfields['datep']['checked']) {
print '<td class="center">'.dol_print_date($obj->datep, 'day')."</td>";
if (!$i) {
$totalarray['nbfield']++;
}
}
// Date value
if ($arrayfields['datev']['checked']) {
print '<td class="center">'.dol_print_date($obj->datev, 'day')."</td>";
if (!$i) {
$totalarray['nbfield']++;
}
}
// Type
if ($arrayfields['type']['checked']) {
print '<td class="center">';
if ($obj->payment_code) {
print $langs->trans("PaymentTypeShort".$obj->payment_code);
print ' ';
}
print $obj->num_payment;
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Project
if ($arrayfields['project']['checked']) {
print '<td class="nowraponall">';
if ($obj->fk_project > 0) {
$proj->fetch($obj->fk_project);
print $proj->getNomUrl(1);
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Bank account
if ($arrayfields['bank']['checked']) {
print '<td class="nowraponall">';
if ($obj->bid > 0) {
$accountstatic->id = $obj->bid;
$accountstatic->ref = $obj->bref;
$accountstatic->number = $obj->bnumber;
if (isModEnabled('accounting')) {
$accountstatic->account_number = $obj->bank_account_number;
$accountingjournal->fetch($obj->accountancy_journal);
$accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1);
}
$accountstatic->label = $obj->blabel;
print $accountstatic->getNomUrl(1);
} else {
print '&nbsp;';
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Bank entry
if ($arrayfields['entry']['checked']) {
$bankline->fetch($obj->fk_bank);
print '<td>'.$bankline->getNomUrl(1).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Accounting account
if (!empty($arrayfields['account']['checked'])) {
$accountingaccount->fetch('', $obj->accountancy_code, 1);
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->accountancy_code.' '.$accountingaccount->label).'">'.$accountingaccount->getNomUrl(0, 1, 1, '', 1).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Accounting subledger account
if (!empty($arrayfields['subledger']['checked'])) {
print '<td class="tdoverflowmax150">'.length_accounta($obj->subledger_account).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Debit
if ($arrayfields['debit']['checked']) {
print '<td class="nowrap right">';
if ($obj->sens == 0) {
print '<span class="amount">'.price($obj->amount).'</span>';
$totalarray['val']['total_deb'] += $obj->amount;
}
if (!$i) {
$totalarray['nbfield']++;
}
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 'total_deb';
}
print '</td>';
}
// Credit
if ($arrayfields['credit']['checked']) {
print '<td class="nowrap right">';
if ($obj->sens == 1) {
print '<span class="amount">'.price($obj->amount).'</span>';
$totalarray['val']['total_cred'] += $obj->amount;
}
if (!$i) {
$totalarray['nbfield']++;
}
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 'total_cred';
}
print '</td>';
}
print '<td></td>';
if (!$i) {
$totalarray['nbfield']++;
}
print '</tr>'."\n";
}
// Bank entry
if ($arrayfields['entry']['checked']) {
$bankline->fetch($obj->fk_bank);
print '<td>'.$bankline->getNomUrl(1).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Accounting account
if (!empty($arrayfields['account']['checked'])) {
$accountingaccount->fetch('', $obj->accountancy_code, 1);
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->accountancy_code.' '.$accountingaccount->label).'">'.$accountingaccount->getNomUrl(0, 1, 1, '', 1).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Accounting subledger account
if (!empty($arrayfields['subledger']['checked'])) {
print '<td class="tdoverflowmax150">'.length_accounta($obj->subledger_account).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Debit
if ($arrayfields['debit']['checked']) {
print '<td class="nowrap right">';
if ($obj->sens == 0) {
print '<span class="amount">'.price($obj->amount).'</span>';
$totalarray['val']['total_deb'] += $obj->amount;
}
if (!$i) {
$totalarray['nbfield']++;
}
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 'total_deb';
}
print '</td>';
}
// Credit
if ($arrayfields['credit']['checked']) {
print '<td class="nowrap right">';
if ($obj->sens == 1) {
print '<span class="amount">'.price($obj->amount).'</span>';
$totalarray['val']['total_cred'] += $obj->amount;
}
if (!$i) {
$totalarray['nbfield']++;
}
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 'total_cred';
}
print '</td>';
}
print '<td></td>';
if (!$i) {
$totalarray['nbfield']++;
}
print '</tr>'."\n";
$i++;
}

View File

@ -41,7 +41,7 @@ $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'cashcontrol'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
$mode = GETPOST('mode', 'alpha'); // for mode view result
$id = GETPOST('id', 'int');
// Load variable for pagination
@ -399,10 +399,14 @@ print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
$permforcashfence = 1;
$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/cashcontrol/cashcontrol_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permforcashfence);
$newcardbutton = '';
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/cashcontrol/cashcontrol_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permforcashfence);
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'cash-register', 0, $newcardbutton, '', $limit, 0, 0, 1);
@ -552,81 +556,101 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
// Store properties in $object
$object->setVarsFromFetchObj($obj);
// Show here line of result
$j = 0;
print '<tr data-rowid="'.$object->id.'" class="oddeven">';
foreach ($object->fields as $key => $val) {
$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'center';
} elseif ($key == 'status') {
$cssforfield .= ($cssforfield ? ' ' : '').'center';
// show kanban result
if ($mode == 'kanban') {
if ($i == 0) {
print '<tr><td colspan="12">';
print '<div class="box-flex-container">';
}
if (in_array($val['type'], array('timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
} elseif ($key == 'ref') {
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
}
$object->posmodule = $obj->posmodule;
$object->cash = $obj->cash;
$object->opening = $obj->opening;
$object->year_close = $obj->year_close;
$object->cheque = $obj->cheque;
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) {
$cssforfield .= ($cssforfield ? ' ' : '').'right';
}
//if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
if (!empty($arrayfields['t.'.$key]['checked'])) {
print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '');
if (preg_match('/tdoverflow/', $cssforfield)) {
print ' title="'.dol_escape_htmltag($object->$key).'"';
print $object->getKanbanView('');
if ($i == (min($num, $limit) - 1)) {
print '</div>';
print '</td></tr>';
}
} else {
// Show here line of result
$j = 0;
print '<tr data-rowid="'.$object->id.'" class="oddeven">';
foreach ($object->fields as $key => $val) {
$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'center';
} elseif ($key == 'status') {
$cssforfield .= ($cssforfield ? ' ' : '').'center';
}
print '>';
if ($key == 'status') {
print $object->getLibStatut(5);
} elseif ($key == 'rowid') {
print $object->showOutputField($val, $key, $object->id, '');
} else {
print $object->showOutputField($val, $key, $object->$key, '');
if (in_array($val['type'], array('timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
} elseif ($key == 'ref') {
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) {
$cssforfield .= ($cssforfield ? ' ' : '').'right';
}
if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
//if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
if (!empty($arrayfields['t.'.$key]['checked'])) {
print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '');
if (preg_match('/tdoverflow/', $cssforfield)) {
print ' title="'.dol_escape_htmltag($object->$key).'"';
}
print '>';
if ($key == 'status') {
print $object->getLibStatut(5);
} elseif ($key == 'rowid') {
print $object->showOutputField($val, $key, $object->id, '');
} else {
print $object->showOutputField($val, $key, $object->$key, '');
}
print '</td>';
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
$totalarray['nbfield']++;
}
if (!isset($totalarray['val'])) {
$totalarray['val'] = array();
if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
}
if (!isset($totalarray['val'])) {
$totalarray['val'] = array();
}
if (!isset($totalarray['val']['t.'.$key])) {
$totalarray['val']['t.'.$key] = 0;
}
$totalarray['val']['t.'.$key] += $object->$key;
}
if (!isset($totalarray['val']['t.'.$key])) {
$totalarray['val']['t.'.$key] = 0;
}
$totalarray['val']['t.'.$key] += $object->$key;
}
}
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
print '<td class="nowrap center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($object->id, $arrayofselected)) {
$selected = 1;
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
print '<td class="nowrap center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($object->id, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
print '</tr>'."\n";
print '</tr>'."\n";
}
$i++;
}

View File

@ -469,4 +469,36 @@ class CashControl extends CommonObject
return $result;
}
/**
* Return clicable link of object (with eventually picto)
*
* @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link)
* @return string HTML Code for Kanban thumb.
*/
public function getKanbanView($option = '')
{
global $langs;
$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">';
$return .= img_picto('', $this->picto);
//var_dump($this->fields['rowid']);exit;
$return .= '</span>';
$return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1, 1) : $this->ref).'</span>';
if (property_exists($this, 'posmodule')) {
$return .= '<br><span class="opacitymedium">'.substr($langs->trans("Module/Application"), 0, 12).'</span> : <span class="info-box-label">'.$this->posmodule.'</span>';
}
if (property_exists($this, 'year_close')) {
$return .= '<br><span class="info-box-label opacitymedium" >'.$langs->trans("Year").'</span> : <span>'.$this->year_close.'</span>';
}
if (method_exists($this, 'getLibStatut')) {
$return .= '<br><div class="info-box-status margintoponly">'.$this->getLibStatut(5).'</div>';
}
$return .= '</div>';
$return .= '</div>';
$return .= '</div>';
return $return;
}
}

View File

@ -2038,12 +2038,12 @@ if (empty($reshook)) {
$prod_entry_mode = GETPOST('prod_entry_mode', 'aZ09');
if ($prod_entry_mode == 'free') {
$idprod = 0;
$tva_tx = (GETPOST('tva_tx', 'alpha') ? price2num(preg_replace('/\s*\(.*\)/', '', GETPOST('tva_tx', 'alpha'))) : 0);
} else {
$idprod = GETPOST('idprod', 'int');
$tva_tx = '';
}
$tva_tx = GETPOST('tva_tx', 'alpha');
$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS', 2);
$remise_percent = (GETPOSTISSET('remise_percent'.$predef) ? price2num(GETPOST('remise_percent'.$predef, 'alpha'), '', 2) : 0);
if (empty($remise_percent)) {
@ -2137,7 +2137,6 @@ if (empty($reshook)) {
// Ecrase $pu par celui du produit
// Ecrase $desc par celui du produit
// Ecrase $tva_tx par celui du produit
// Ecrase $base_price_type par celui du produit
// Replaces $fk_unit with the product's
if (!empty($idprod) && $idprod > 0) {
@ -2157,8 +2156,8 @@ if (empty($reshook)) {
$price_min_ttc = $datapriceofproduct['price_min_ttc'];
$price_base_type = $datapriceofproduct['price_base_type'];
$tva_tx = $datapriceofproduct['tva_tx'];
$tva_npr = $datapriceofproduct['tva_npr'];
//$tva_tx = $datapriceofproduct['tva_tx'];
//$tva_npr = $datapriceofproduct['tva_npr'];
$tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx));
$tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx));

View File

@ -169,7 +169,7 @@ class FactureRec extends CommonInvoice
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
'titre' =>array('type'=>'varchar(100)', 'label'=>'Titre', 'enabled'=>1, 'showoncombobox' => 1, 'visible'=>-1, 'position'=>15),
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>20, 'index'=>1),
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>25),
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'isModEnabled("societe")', 'visible'=>-1, 'notnull'=>1, 'position'=>25),
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>30),
//'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35),
'remise' =>array('type'=>'double', 'label'=>'Remise', 'enabled'=>1, 'visible'=>-1, 'position'=>40),

View File

@ -5749,6 +5749,37 @@ class Facture extends CommonInvoice
return array();
}
/**
* Return clicable link of object (with eventually picto)
*
* @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link)
* @return string HTML Code for Kanban thumb.
*/
public function getKanbanView($option = '')
{
$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">';
$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(1) : $this->ref).'</span>';
if (property_exists($this, 'socid')) {
$return .= '<br><span class="info-box-label">'.$this->socid.'</span>';
}
if (property_exists($this, 'fk_user_author')) {
$return .= '<br><span class="info-box-label">'.$this->fk_user_author.'</span>';
}
if (method_exists($this, 'getLibStatut')) {
$return .= '<br><div class="info-box-status margintoponly">'.$this->getLibStatut(5).'</div>';
}
$return .= '</div>';
$return .= '</div>';
$return .= '</div>';
return $return;
}
}
/**

File diff suppressed because it is too large Load Diff

View File

@ -742,8 +742,8 @@ if ($object->id > 0) {
print '<input type="submit" class="butAction" value="'.$buttonlabel.'" />';
print '</form>';
if (!empty($conf->global->STRIPE_SEPA_DIRECT_DEBIT_SHOW_BUTTON)) {
// TODO Replace this with a checkbox for each payment mode: "Send request to PaymentModeManager immediatly..."
if (getDolGlobalString('STRIPE_SEPA_DIRECT_DEBIT_SHOW_OLD_BUTTON')) { // This is hidden, prefer to use mode enabled with STRIPE_SEPA_DIRECT_DEBIT
// TODO Replace this with a checkbox for each payment mode: "Send request to XXX immediatly..."
print "<br>";
//add stripe sepa button
$buttonlabel = $langs->trans("MakeWithdrawRequestStripe");
@ -781,14 +781,14 @@ if ($object->id > 0) {
if ($type == 'bank-transfer') {
print '<div class="opacitymedium">'.$langs->trans("DoCreditTransferBeforePayments");
if (isModEnabled('stripe')) {
if (isModEnabled('stripe') && getDolGlobalString('STRIPE_SEPA_DIRECT_DEBIT')) {
print ' '.$langs->trans("DoStandingOrdersBeforePayments2");
}
print ' '.$langs->trans("DoStandingOrdersBeforePayments3");
print '</div><br>';
} else {
print '<div class="opacitymedium">'.$langs->trans("DoStandingOrdersBeforePayments");
if (isModEnabled('stripe')) {
if (isModEnabled('stripe') && getDolGlobalString('STRIPE_SEPA_DIRECT_DEBIT')) {
print ' '.$langs->trans("DoStandingOrdersBeforePayments2");
}
print ' '.$langs->trans("DoStandingOrdersBeforePayments3");
@ -807,13 +807,13 @@ if ($object->id > 0) {
print '<td class="center">'.$langs->trans("User").'</td>';
print '<td class="center">'.$langs->trans("Amount").'</td>';
print '<td class="center">'.$langs->trans("DateProcess").'</td>';
print '<td>&nbsp;</td>';
if ($type == 'bank-transfer') {
print '<td class="center">'.$langs->trans("BankTransferReceipt").'</td>';
} else {
print '<td class="center">'.$langs->trans("WithdrawalReceipt").'</td>';
}
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
print '</tr>';
$sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande,";
@ -864,9 +864,10 @@ if ($object->id > 0) {
// Amount
print '<td class="center"><span class="amount">'.price($obj->amount).'</span></td>';
// Ref of SEPA request
// Date process
print '<td class="center"><span class="opacitymedium">'.$langs->trans("OrderWaiting").'</span></td>';
// Link to make payment now
print '<td>';
if (!empty($conf->global->STRIPE_SEPA_DIRECT_DEBIT)) {
$langs->load("stripe");
@ -874,8 +875,10 @@ if ($object->id > 0) {
}
print '</td>';
//
print '<td align="center">-</td>';
// Actions
print '<td class="right">';
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&token='.newToken().'&did='.$obj->rowid.'&type='.$type.'">';
print img_delete();
@ -929,14 +932,21 @@ if ($object->id > 0) {
print '<tr class="oddeven">';
// Date
print '<td class="left">'.dol_print_date($db->jdate($obj->date_demande), 'day')."</td>\n";
// User
print '<td align="center">';
print $tmpuser->getNomUrl(1, '', 0, 0, 0, 0, 'login');
print '</td>';
// Amount
print '<td class="center">'.price($obj->amount).'</td>';
// Date process
print '<td class="center">'.dol_print_date($db->jdate($obj->date_traite), 'day')."</td>\n";
// Link to payment request done
print '<td class="center">';
if ($obj->fk_prelevement_bons > 0) {
$withdrawreceipt = new BonPrelevement($db);
@ -946,10 +956,10 @@ if ($object->id > 0) {
}
print "</td>\n";
//
print '<td>&nbsp;</td>';
print '<td class="center">'.dol_print_date($db->jdate($obj->date_traite), 'day')."</td>\n";
// Actions
print '<td>&nbsp;</td>';
print "</tr>\n";

View File

@ -629,4 +629,38 @@ class Localtax extends CommonObject
return '';
}
/**
* Return clicable link of object (with eventually picto)
*
* @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link)
* @return string HTML Code for Kanban thumb.
*/
public function getKanbanView($option = '')
{
global $langs;
$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">';
$return .= img_picto('', $this->picto);
$return .= '</span>';
$return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>';
if (property_exists($this, 'label')) {
$return .= ' | <span class="info-box-label">'.$this->label.'</span>';
}
if (property_exists($this, 'datev')) {
$return .= '<br><span class="opacitymedium">'.$langs->trans("DateEnd").'</span> : <span class="info-box-label">'.dol_print_date($this->db->jdate($this->datev), 'day').'</span>';
}
if (property_exists($this, 'datep')) {
$return .= '<br><span class="opacitymedium">'.$langs->trans("DatePayment", '', '', '', '', 5).'</span> : <span class="info-box-label">'.dol_print_date($this->db->jdate($this->datep), 'day').'</span>';
}
if (property_exists($this, 'amount')) {
$return .= '<br><span class="opacitymedium">'.$langs->trans("Amount").'</span> : <span class="info-box-label amount">'.price($this->amount).'</span>';
}
$return .= '</div>';
$return .= '</div>';
$return .= '</div>';
return $return;
}
}

View File

@ -35,7 +35,7 @@ if ($user->socid) {
}
$result = restrictedArea($user, 'tax', '', '', 'charges');
$ltt = GETPOST("localTaxType", 'int');
$mode = GETPOST('mode', 'alpha');
/*
* View
@ -49,7 +49,14 @@ $url = DOL_URL_ROOT.'/compta/localtax/card.php?action=create&localTaxType='.$ltt
if (!empty($socid)) {
$url .= '&socid='.$socid;
}
$newcardbutton = dolGetButtonTitle($langs->trans('NewLocalTaxPayment', ($ltt + 1)), '', 'fa fa-plus-circle', $url, '', $user->rights->tax->charges->creer);
$param = '';
if (!empty($mode)) {
$param .= '&mode='.urlencode($mode);
}
$newcardbutton = '';
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?localTaxType='.$ltt.'&mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?localTaxType='.$ltt.'&mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('NewLocalTaxPayment', ($ltt + 1)), '', 'fa fa-plus-circle', $url, '', $user->rights->tax->charges->creer);
print load_fiche_titre($langs->transcountry($ltt == 2 ? "LT2Payments" : "LT1Payments", $mysoc->country_code), $newcardbutton, 'title_accountancy');
@ -77,19 +84,36 @@ if ($result) {
while ($i < $num) {
$obj = $db->fetch_object($result);
print '<tr class="oddeven">';
$localtax_static->label = $obj->label;
$localtax_static->id = $obj->rowid;
$localtax_static->ref = $obj->rowid;
print "<td>".$localtax_static->getNomUrl(1)."</td>\n";
print "<td>".dol_trunc($obj->label, 40)."</td>\n";
print '<td class="left">'.dol_print_date($db->jdate($obj->datev), 'day')."</td>\n";
print '<td class="left">'.dol_print_date($db->jdate($obj->datep), 'day')."</td>\n";
$localtax_static->datev = $obj->datev;
$localtax_static->datep = $obj->datep;
$localtax_static->amount = $obj->amount;
$total = $total + $obj->amount;
print '<td class="right nowraponall"><span class="amount">'.price($obj->amount).'</span></td>';
print "</tr>\n";
if ($mode == 'kanban') {
if ($i == 0) {
print '<tr><td colspan="12">';
print '<div class="box-flex-container">';
}
// Output Kanban
print $localtax_static->getKanbanView('');
if ($i == ($num - 1)) {
print '</div>';
print '</td></tr>';
}
} else {
print '<tr class="oddeven">';
print "<td>".$localtax_static->getNomUrl(1)."</td>\n";
print "<td>".dol_trunc($obj->label, 40)."</td>\n";
print '<td class="left">'.dol_print_date($db->jdate($obj->datev), 'day')."</td>\n";
print '<td class="left">'.dol_print_date($db->jdate($obj->datep), 'day')."</td>\n";
print '<td class="right nowraponall"><span class="amount">'.price($obj->amount).'</span></td>';
print "</tr>\n";
}
$i++;
}
print '<tr class="liste_total"><td colspan="4">'.$langs->trans("Total").'</td>';

View File

@ -1020,4 +1020,43 @@ class RemiseCheque extends CommonObject
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
}
/**
* Return clicable link of object (with eventually picto)
*
* @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link)
* @return string HTML Code for Kanban thumb.
*/
public function getKanbanView($option = '')
{
global $langs;
$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">';
$return .= img_picto('', $this->picto);
$return .= '</span>';
$return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>';
if (property_exists($this, 'date_bordereau')) {
$return .= '<br><span class="opacitymedium">'.$langs->trans("DateCreation").'</span> : <span class="info-box-label">'.dol_print_date($this->db->jdate($this->date_bordereau), 'day').'</span>';
}
if (property_exists($this, 'nbcheque')) {
$return .= '<br><span class="opacitymedium">'.$langs->trans("Cheque", '', '', '', '', 5).'</span> : <span class="info-box-label">'.$this->nbcheque.'</span>';
}
if (property_exists($this, 'account_id')) {
$return .= ' | <span class="info-box-label">'.$this->account_id.'</span>';
}
if (method_exists($this, 'LibStatut')) {
$return .= '<br><div style="display:inline-block" class="info-box-status margintoponly">'.$this->LibStatut($this->statut, 5).'</div>';
}
if (property_exists($this, 'amount')) {
$return .= ' | <div style="display:inline-block"><span class="opacitymedium">'.$langs->trans("Amount").'</span> : <span class="amount">'.price($this->amount).'</div>';
}
$return .= '</div>';
$return .= '</div>';
$return .= '</div>';
return $return;
}
}

View File

@ -44,6 +44,7 @@ $result = restrictedArea($user, 'banque', '', '');
$search_ref = GETPOST('search_ref', 'alpha');
$search_account = GETPOST('search_account', 'int');
$search_amount = GETPOST('search_amount', 'alpha');
$mode = GETPOST('mode', 'alpha');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
@ -149,6 +150,9 @@ if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
$param = '';
if (!empty($mode)) {
$param .= '&mode='.urlencode($mode);
}
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.$contextpage;
}
@ -160,7 +164,10 @@ if ($resql) {
if (!empty($socid)) {
$url .= '&socid='.$socid;
}
$newcardbutton = dolGetButtonTitle($langs->trans('NewCheckDeposit'), '', 'fa fa-plus-circle', $url, '', $user->rights->banque->cheque);
$newcardbutton = '';
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('NewCheckDeposit'), '', 'fa fa-plus-circle', $url, '', $user->rights->banque->cheque);
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') {
@ -172,6 +179,8 @@ if ($resql) {
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
print_barre_liste($langs->trans("MenuChequeDeposits"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'bank_account', 0, $newcardbutton, '', $limit);
@ -220,42 +229,64 @@ if ($resql) {
while ($i < min($num, $limit)) {
$objp = $db->fetch_object($resql);
print '<tr class="oddeven">';
// Num ref cheque
print '<td>';
$checkdepositstatic->id = $objp->rowid;
$checkdepositstatic->ref = ($objp->ref ? $objp->ref : $objp->rowid);
$checkdepositstatic->statut = $objp->statut;
print $checkdepositstatic->getNomUrl(1);
print '</td>';
$checkdepositstatic->nbcheque = $objp->nbcheque;
$checkdepositstatic->amount = $objp->amount;
$checkdepositstatic->date_bordereau = $objp->date_bordereau;
// Date
print '<td class="center">'.dol_print_date($db->jdate($objp->date_bordereau), 'day').'</td>'; // TODO Use date hour
$account = new Account($db);
$account->fetch($objp->bid);
$checkdepositstatic->account_id = $account->getNomUrl(1);
// Bank
print '<td>';
if ($objp->bid) {
print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?account='.$objp->bid.'">'.img_object($langs->trans("ShowAccount"), 'account').' '.$objp->label.'</a>';
if ($mode == 'kanban') {
if ($i == 0) {
print '<tr><td colspan="12">';
print '<div class="box-flex-container">';
}
// Output Kanban
print $checkdepositstatic->getKanbanView('');
if ($i == (min($num, $limit) - 1)) {
print '</div>';
print '</td></tr>';
}
} else {
print '&nbsp;';
print '<tr class="oddeven">';
// Num ref cheque
print '<td>';
print $checkdepositstatic->getNomUrl(1);
print '</td>';
// Date
print '<td class="center">'.dol_print_date($db->jdate($objp->date_bordereau), 'day').'</td>'; // TODO Use date hour
// Bank
print '<td>';
if ($objp->bid) {
print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?account='.$objp->bid.'">'.img_object($langs->trans("ShowAccount"), 'account').' '.$objp->label.'</a>';
} else {
print '&nbsp;';
}
print '</td>';
// Number of cheques
print '<td class="right">'.$objp->nbcheque.'</td>';
// Amount
print '<td class="right"><span class="amount">'.price($objp->amount).'</span></td>';
// Statut
print '<td class="right">';
print $checkdepositstatic->LibStatut($objp->statut, 5);
print '</td>';
print '<td></td>';
print "</tr>\n";
}
print '</td>';
// Number of cheques
print '<td class="right">'.$objp->nbcheque.'</td>';
// Amount
print '<td class="right"><span class="amount">'.price($objp->amount).'</span></td>';
// Statut
print '<td class="right">';
print $checkdepositstatic->LibStatut($objp->statut, 5);
print '</td>';
print '<td></td>';
print "</tr>\n";
$i++;
}
} else {

View File

@ -2407,4 +2407,38 @@ class BonPrelevement extends CommonObject
*/
return 0;
}
/**
* Return clicable link of object (with eventually picto)
*
* @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link)
* @return string HTML Code for Kanban thumb.
*/
public function getKanbanView($option = '')
{
global $langs;
$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">';
$return .= img_picto('', $this->picto);
$return .= '</span>';
$return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</span>';
if (property_exists($this, 'date_echeance')) {
$return .= '<br><span class="opacitymedium">'.$langs->trans("Date").'</span> : <span class="info-box-label">'.dol_print_date($this->db->jdate($this->date_echeance), 'day').'</span>';
}
if (property_exists($this, 'total')) {
$return .= '<br><span class="opacitymedium">'.$langs->trans("Amount").'</span> : <span class="amount">'.price($this->total).'</span>';
}
if (method_exists($this, 'LibStatut')) {
$return .= '<br><div class="info-box-status margintoponly">'.$this->LibStatut($this->statut, 5).'</div>';
}
$return .= '</div>';
$return .= '</div>';
$return .= '</div>';
return $return;
}
}

View File

@ -43,6 +43,7 @@ $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'directdebitcredittransferlinelist'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
$mode = GETPOST('mode', 'alpha');
$type = GETPOST('type', 'aZ09');
@ -188,12 +189,18 @@ if ($result) {
$param = "&amp;statut=".urlencode($statut);
$param .= "&amp;search_bon=".urlencode($search_bon);
if (!empty($mode)) {
$param .= '&mode='.urlencode($mode);
}
if ($type == 'bank-transfer') {
$param .= '&amp;type=bank-transfer';
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
}
$newcardbutton = '';
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
print"\n<!-- debut table -->\n";
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
@ -206,6 +213,8 @@ if ($result) {
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
if ($type != '') {
print '<input type="hidden" name="type" value="'.$type.'">';
}
@ -214,7 +223,7 @@ if ($result) {
if ($type == 'bank-transfer') {
$title = $langs->trans("CreditTransferLines");
}
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'generic', 0, '', '', $limit, 0, 0, 1);
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'generic', 0, $newcardbutton, '', $limit, 0, 0, 1);
$moreforfilter = '';
@ -262,61 +271,77 @@ if ($result) {
$bon->id = $obj->rowid;
$bon->ref = $obj->ref;
$bon->statut = $obj->status;
$bon->date_echeance = $obj->datec;
$bon->total = $obj->amount;
$company->id = $obj->socid;
$company->name = $obj->name;
$company->email = $obj->email;
$company->code_client = $obj->code_client;
print '<tr class="oddeven">';
if ($mode == 'kanban') {
if ($i == 0) {
print '<tr><td colspan="12">';
print '<div class="box-flex-container">';
}
// Output Kanban
print '<td>';
print $bon->getNomUrl(1);
print "</td>\n";
print $bon->getKanbanView('');
if ($i == (min($num, $limit) - 1)) {
print '</div>';
print '</td></tr>';
}
} else {
print '<tr class="oddeven">';
print '<td>';
print $line->LibStatut($obj->statut_ligne, 2);
print "&nbsp;";
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/line.php?id='.$obj->rowid_ligne.'">';
print substr('000000'.$obj->rowid_ligne, -6);
print '</a></td>';
print '<td>';
print $bon->getNomUrl(1);
print "</td>\n";
print '<td>';
$link_to_bill = '/compta/facture/card.php?facid=';
$link_title = 'Invoice';
$link_picto = 'bill';
if ($type == 'bank-transfer') {
$link_to_bill = '/fourn/facture/card.php?facid=';
$link_title = 'SupplierInvoice';
$link_picto = 'supplier_invoice';
print '<td>';
print $line->LibStatut($obj->statut_ligne, 2);
print "&nbsp;";
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/line.php?id='.$obj->rowid_ligne.'">';
print substr('000000'.$obj->rowid_ligne, -6);
print '</a></td>';
print '<td>';
$link_to_bill = '/compta/facture/card.php?facid=';
$link_title = 'Invoice';
$link_picto = 'bill';
if ($type == 'bank-transfer') {
$link_to_bill = '/fourn/facture/card.php?facid=';
$link_title = 'SupplierInvoice';
$link_picto = 'supplier_invoice';
}
print '<a href="'.DOL_URL_ROOT.$link_to_bill.$obj->facid.'">';
print img_object($langs->trans($link_title), $link_picto);
print '&nbsp;'.$obj->invoiceref."</td>\n";
print '</a>';
print '</td>';
print '<td>';
print $company->getNomUrl(1);
print "</td>\n";
print '<td class="center">';
$link_to_tab = '/comm/card.php?socid=';
$link_code = $obj->code_client;
if ($type == 'bank-transfer') {
$link_to_tab = '/fourn/card.php?socid=';
$link_code = $obj->code_fournisseur;
}
print '<a href="'.DOL_URL_ROOT.$link_to_tab.$company->id.'">'.$link_code."</a></td>\n";
print '<td class="center">'.dol_print_date($db->jdate($obj->datec), 'day')."</td>\n";
print '<td class="right"><span class="amount">'.price($obj->amount)."</span></td>\n";
print '<td>&nbsp;</td>';
print "</tr>\n";
}
print '<a href="'.DOL_URL_ROOT.$link_to_bill.$obj->facid.'">';
print img_object($langs->trans($link_title), $link_picto);
print '&nbsp;'.$obj->invoiceref."</td>\n";
print '</a>';
print '</td>';
print '<td>';
print $company->getNomUrl(1);
print "</td>\n";
print '<td class="center">';
$link_to_tab = '/comm/card.php?socid=';
$link_code = $obj->code_client;
if ($type == 'bank-transfer') {
$link_to_tab = '/fourn/card.php?socid=';
$link_code = $obj->code_fournisseur;
}
print '<a href="'.DOL_URL_ROOT.$link_to_tab.$company->id.'">'.$link_code."</a></td>\n";
print '<td class="center">'.dol_print_date($db->jdate($obj->datec), 'day')."</td>\n";
print '<td class="right"><span class="amount">'.price($obj->amount)."</span></td>\n";
print '<td>&nbsp;</td>';
print "</tr>\n";
$i++;
}
} else {

View File

@ -54,6 +54,8 @@ if (!$sortfield) {
}
$optioncss = GETPOST('optioncss', 'alpha');
$mode = GETPOST('mode', 'alpha');
// Get supervariables
$statut = GETPOST('statut', 'int');
@ -147,6 +149,9 @@ if ($result) {
$i = 0;
$param = '';
if (!empty($mode)) {
$param .= '&mode='.urlencode($mode);
}
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
@ -161,6 +166,8 @@ if ($result) {
$selectedfields = '';
$newcardbutton = '';
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
if ($usercancreate) {
$newcardbutton .= dolGetButtonTitle($langs->trans('NewStandingOrder'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/prelevement/create.php?type='.urlencode($type));
}
@ -176,6 +183,8 @@ if ($result) {
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
if ($type != '') {
print '<input type="hidden" name="type" value="'.$type.'">';
}
@ -220,27 +229,41 @@ if ($result) {
$directdebitorder->id = $obj->rowid;
$directdebitorder->ref = $obj->ref;
$directdebitorder->datec = $obj->datec;
$directdebitorder->amount = $obj->amount;
$directdebitorder->date_echeance = $obj->datec;
$directdebitorder->total = $obj->amount;
$directdebitorder->statut = $obj->statut;
print '<tr class="oddeven">';
if ($mode == 'kanban') {
if ($i == 0) {
print '<tr><td colspan="12">';
print '<div class="box-flex-container">';
}
// Output Kanban
print '<td>';
print $directdebitorder->getNomUrl(1);
print "</td>\n";
print $directdebitorder->getKanbanView('');
if ($i == (min($num, $limit) - 1)) {
print '</div>';
print '</td></tr>';
}
} else {
print '<tr class="oddeven">';
print '<td class="center">'.dol_print_date($db->jdate($obj->datec), 'day')."</td>\n";
print '<td>';
print $directdebitorder->getNomUrl(1);
print "</td>\n";
print '<td class="right"><span class="amount">'.price($obj->amount)."</span></td>\n";
print '<td class="center">'.dol_print_date($db->jdate($obj->datec), 'day')."</td>\n";
print '<td class="right">';
print $bon->LibStatut($obj->statut, 5);
print '</td>';
print '<td class="right"><span class="amount">'.price($obj->amount)."</span></td>\n";
print '<td class="right"></td>'."\n";
print '<td class="right">';
print $bon->LibStatut($obj->statut, 5);
print '</td>';
print "</tr>\n";
print '<td class="right"></td>'."\n";
print "</tr>\n";
}
$i++;
}
} else {

View File

@ -335,7 +335,7 @@ if ($modecompta == 'CREANCES-DETTES') {
// Previous Fiscal year (N-1)
foreach ($sommes as $code => $det) {
$vars[$code] = $det['NP'];
$vars[$code] = empty($det['NP']) ? 0 : $det['NP'];
}
$result = strtr($formula, $vars);
@ -355,12 +355,16 @@ if ($modecompta == 'CREANCES-DETTES') {
// Year N
$code = $cat['code']; // code of categorie ('VTE', 'MAR', ...)
$sommes[$code]['NP'] += $r;
if (empty($sommes[$code]['NP'])) {
$sommes[$code]['NP'] = $r;
} else {
$sommes[$code]['NP'] += $r;
}
// Current fiscal year (N)
if (is_array($sommes) && !empty($sommes)) {
foreach ($sommes as $code => $det) {
$vars[$code] = $det['N'];
$vars[$code] = empty($det['N']) ? 0 : $det['N'];
}
}
@ -371,13 +375,17 @@ if ($modecompta == 'CREANCES-DETTES') {
$r = dol_eval($result, 1, 1, '1');
print '<td class="liste_total right borderright"><span class="amount">'.price($r).'</span></td>';
$sommes[$code]['N'] += $r;
if (empty($sommes[$code]['N'])) {
$sommes[$code]['N'] = $r;
} else {
$sommes[$code]['N'] += $r;
}
// Detail by month
foreach ($months as $k => $v) {
if (($k + 1) >= $date_startmonth) {
foreach ($sommes as $code => $det) {
$vars[$code] = $det['M'][$k];
$vars[$code] = empty($det['M'][$k]) ? 0 : $det['M'][$k];
}
$result = strtr($formula, $vars);
$result = str_replace('--', '+', $result);
@ -386,14 +394,18 @@ if ($modecompta == 'CREANCES-DETTES') {
$r = dol_eval($result, 1, 1, '1');
print '<td class="liste_total right"><span class="amount">'.price($r).'</span></td>';
$sommes[$code]['M'][$k] += $r;
if (empty($sommes[$code]['M'][$k])) {
$sommes[$code]['M'][$k] = $r;
} else {
$sommes[$code]['M'][$k] += $r;
}
}
}
foreach ($months as $k => $v) {
if (($k + 1) < $date_startmonth) {
foreach ($sommes as $code => $det) {
$vars[$code] = $det['M'][$k];
$vars[$code] = empty($det['M'][$k]) ? 0 : $det['M'][$k];
}
$result = strtr($formula, $vars);
$result = str_replace('--', '+', $result);
@ -402,7 +414,11 @@ if ($modecompta == 'CREANCES-DETTES') {
$r = dol_eval($result, 1, 1, '1');
print '<td class="liste_total right"><span class="amount">'.price($r).'</span></td>';
$sommes[$code]['M'][$k] += $r;
if (empty($sommes[$code]['M'][$k])) {
$sommes[$code]['M'][$k] = $r;
} else {
$sommes[$code]['M'][$k] += $r;
}
}
}
@ -429,14 +445,14 @@ if ($modecompta == 'CREANCES-DETTES') {
$arrayofaccountforfilter = array();
foreach ($cpts as $i => $cpt) { // Loop on each account.
if (!is_null($cpt['account_number'])) {
if (isset($cpt['account_number'])) {
$arrayofaccountforfilter[] = $cpt['account_number'];
}
}
// N-1
if (!empty($arrayofaccountforfilter)) {
$return = $AccCat->getSumDebitCredit($arrayofaccountforfilter, $date_start_previous, $date_end_previous, $cat['dc'] ? $cat['dc'] : 0);
$return = $AccCat->getSumDebitCredit($arrayofaccountforfilter, $date_start_previous, $date_end_previous, empty($cat['dc']) ? 0 : $cat['dc']);
if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors');
$resultNP = 0;
@ -444,8 +460,16 @@ if ($modecompta == 'CREANCES-DETTES') {
foreach ($cpts as $i => $cpt) { // Loop on each account found
$resultNP = empty($AccCat->sdcperaccount[$cpt['account_number']]) ? 0 : $AccCat->sdcperaccount[$cpt['account_number']];
$totCat['NP'] += $resultNP;
$sommes[$code]['NP'] += $resultNP;
if (empty($totCat['NP'])) {
$totCat['NP'] = $resultNP;
} else {
$totCat['NP'] += $resultNP;
}
if (empty($sommes[$code]['NP'])) {
$sommes[$code]['NP'] = $resultNP;
} else {
$sommes[$code]['NP'] += $resultNP;
}
$totPerAccount[$cpt['account_number']]['NP'] = $resultNP;
}
}
@ -467,23 +491,47 @@ if ($modecompta == 'CREANCES-DETTES') {
}
//var_dump($monthtoprocess.'_'.$yeartoprocess);
$return = $AccCat->getSumDebitCredit($cpt['account_number'], $date_start, $date_end, $cat['dc'] ? $cat['dc'] : 0, 'nofilter', $monthtoprocess, $yeartoprocess);
if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors');
$resultM = 0;
if (isset($cpt['account_number'])) {
$return = $AccCat->getSumDebitCredit($cpt['account_number'], $date_start, $date_end, empty($cat['dc']) ? 0 : $cat['dc'], 'nofilter', $monthtoprocess, $yeartoprocess);
if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors');
$resultM = 0;
} else {
$resultM = $AccCat->sdc;
}
} else {
$resultM = $AccCat->sdc;
$resultM = 0;
}
if (empty($totCat['M'][$k])) {
$totCat['M'][$k] = $resultM;
} else {
$totCat['M'][$k] += $resultM;
}
if (empty($sommes[$code]['M'][$k])) {
$sommes[$code]['M'][$k] = $resultM;
} else {
$sommes[$code]['M'][$k] += $resultM;
}
if (isset($cpt['account_number'])) {
$totPerAccount[$cpt['account_number']]['M'][$k] = $resultM;
}
$totCat['M'][$k] += $resultM;
$sommes[$code]['M'][$k] += $resultM;
$totPerAccount[$cpt['account_number']]['M'][$k] = $resultM;
$resultN += $resultM;
}
$totCat['N'] += $resultN;
$sommes[$code]['N'] += $resultN;
$totPerAccount[$cpt['account_number']]['N'] = $resultN;
if (empty($totCat)) {
$totCat['N'] = $resultN;
} else {
$totCat['N'] += $resultN;
}
if (empty($sommes[$code]['N'])) {
$sommes[$code]['N'] = $resultN;
} else {
$sommes[$code]['N'] += $resultN;
}
if (isset($cpt['account_number'])) {
$totPerAccount[$cpt['account_number']]['N'] = $resultN;
}
}
@ -543,16 +591,26 @@ if ($modecompta == 'CREANCES-DETTES') {
// Loop on detail of all accounts to output the detail
if ($showaccountdetail != 'no') {
foreach ($cpts as $i => $cpt) {
$resultNP = $totPerAccount[$cpt['account_number']]['NP'];
$resultN = $totPerAccount[$cpt['account_number']]['N'];
if (isset($cpt['account_number'])) {
$resultNP = $totPerAccount[$cpt['account_number']]['NP'];
$resultN = $totPerAccount[$cpt['account_number']]['N'];
} else {
$resultNP = 0;
$resultN = 0;
}
if ($showaccountdetail == 'all' || $resultN != 0) {
print '<tr>';
print '<td></td>';
print '<td class="tdoverflowmax250 borderright">';
print ' &nbsp; &nbsp; '.length_accountg($cpt['account_number']);
print ' - ';
print $cpt['account_label'];
if (isset($cpt['account_number'])) {
$labeldetail = ' &nbsp; &nbsp; '.length_accountg($cpt['account_number']).' - '.$cpt['account_label'];
} else {
$labeldetail = '-';
}
print '<td class="tdoverflowmax250 borderright" title="'.dol_escape_htmltag($labeldetail).'">';
print dol_escape_htmltag($labeldetail);
print '</td>';
print '<td class="right"><span class="amount">'.price($resultNP).'</span></td>';
print '<td class="right borderright"><span class="amount">'.price($resultN).'</span></td>';
@ -560,13 +618,21 @@ if ($modecompta == 'CREANCES-DETTES') {
// Make one call for each month
foreach ($months as $k => $v) {
if (($k + 1) >= $date_startmonth) {
$resultM = $totPerAccount[$cpt['account_number']]['M'][$k];
if (isset($cpt['account_number'])) {
$resultM = $totPerAccount[$cpt['account_number']]['M'][$k];
} else {
$resultM = 0;
}
print '<td class="right"><span class="amount">'.price($resultM).'</span></td>';
}
}
foreach ($months as $k => $v) {
if (($k + 1) < $date_startmonth) {
$resultM = $totPerAccount[$cpt['account_number']]['M'][$k];
if (isset($cpt['account_number'])) {
$resultM = empty($totPerAccount[$cpt['account_number']]['M'][$k]) ? 0 : $totPerAccount[$cpt['account_number']]['M'][$k];
} else {
$resultM = 0;
}
print '<td class="right"><span class="amount">'.price($resultM).'</span></td>';
}
}

View File

@ -749,4 +749,38 @@ class ChargeSociales extends CommonObject
$this->type = 1;
$this->type_label = 'Type of social contribution';
}
/**
* Return clicable link of object (with eventually picto)
*
* @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link)
* @return string HTML Code for Kanban thumb.
*/
public function getKanbanView($option = '')
{
global $langs;
$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">';
$return .= img_picto('', $this->picto);
$return .= '</span>';
$return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</span>';
if (property_exists($this, 'fk_project') && !empty($this->fk_project)) {
$return .= ' | <span class="info-box-label">'.$this->fk_project.'</span>';
}
if (property_exists($this, 'date_ech')) {
$return .= '<br><span class="opacitymedium">'.$langs->trans("DateEnd").'</span>:<span class="info-box-label">'.dol_print_date($this->date_ech).'</span>';
}
if (property_exists($this, 'amount')) {
$return .= '<br><span class="opacitymedium">'.$langs->trans("Amount").'</span> : <span class="info-box-label amount">'.price($this->amount).'</span>';
}
if (method_exists($this, 'LibStatut')) {
$return .= '<br><div class="info-box-status margintoponly">'.$this->LibStatut($this->paye, 5, $this->alreadypaid).'</div>';
}
$return .= '</div>';
$return .= '</div>';
$return .= '</div>';
return $return;
}
}

View File

@ -47,6 +47,8 @@ $massaction = GETPOST('massaction', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
$optioncss = GETPOST('optioncss', 'alpha');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'sclist';
$mode = GETPOST('mode', 'alpha');
$search_ref = GETPOST('search_ref', 'int');
$search_label = GETPOST('search_label', 'alpha');
@ -294,6 +296,9 @@ $num = $db->num_rows($resql);
$i = 0;
$param = '';
if (!empty($mode)) {
$param .= '&mode='.urlencode($mode);
}
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
@ -367,6 +372,8 @@ if ($search_date_limit_endyear) {
}
$newcardbutton = '';
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
if ($user->rights->tax->charges->creer) {
$newcardbutton .= dolGetButtonTitle($langs->trans('MenuNewSocialContribution'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/sociales/card.php?action=create');
}
@ -382,6 +389,8 @@ print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="search_status" value="'.$search_status.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
$center = '';
@ -576,162 +585,179 @@ while ($i < min($num, $limit)) {
$chargesociale_static->ref = $obj->rowid;
$chargesociale_static->label = $obj->label;
$chargesociale_static->type_label = $obj->type_label;
$chargesociale_static->amount = $obj->amount;
$chargesociale_static->paye = $obj->paye;
$chargesociale_static->date_ech = $obj->date_ech;
if (isModEnabled('project')) {
$projectstatic->id = $obj->project_id;
$projectstatic->ref = $obj->project_ref;
$projectstatic->title = $obj->project_label;
}
print '<tr class="oddeven">';
// Line number
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
print '<td>'.(($offset * $limit) + $i).'</td>';
if (!$i) {
$totalarray['nbfield']++;
if ($mode == 'kanban') {
if ($i == 0) {
print '<tr><td colspan="12">';
print '<div class="box-flex-container">';
}
}
// Output Kanban
// Ref
if (!empty($arrayfields['cs.rowid']['checked'])) {
print '<td>'.$chargesociale_static->getNomUrl(1, '20').'</td>';
if (!$i) {
$totalarray['nbfield']++;
$chargesociale_static->fk_project = $projectstatic->getNomUrl();
print $chargesociale_static->getKanbanView('');
if ($i == (min($num, $limit) - 1)) {
print '</div>';
print '</td></tr>';
}
}
} else {
print '<tr class="oddeven">';
// Label
if (!empty($arrayfields['cs.libelle']['checked'])) {
print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->label).'">'.dol_escape_htmltag($obj->label).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Type
if (!empty($arrayfields['cs.fk_type']['checked'])) {
$typelabeltoshow = $obj->type_label;
$typelabelpopup = $obj->type_label;
if (isModEnabled('accounting')) {
$typelabelpopup .= ' - '.$langs->trans("AccountancyCode").': '.$obj->type_accountancy_code;
}
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($typelabelpopup).'">'.dol_escape_htmltag($typelabeltoshow).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Date
if (!empty($arrayfields['cs.date_ech']['checked'])) {
print '<td class="center nowraponall">'.dol_print_date($db->jdate($obj->date_ech), 'day').'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Date end period
if (!empty($arrayfields['cs.periode']['checked'])) {
print '<td class="center nowraponall">'.dol_print_date($db->jdate($obj->periode), 'day').'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Project ref
if (!empty($arrayfields['p.ref']['checked'])) {
print '<td class="nowraponall">';
if ($obj->project_id > 0) {
print $projectstatic->getNomUrl(1);
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
if (!empty($arrayfields['cs.fk_user']['checked'])) {
// Employee
print '<td class="tdoverflowmax150">';
if (!empty($obj->fk_user)) {
if (!empty($TLoadedUsers[$obj->fk_user])) {
$ustatic = $TLoadedUsers[$obj->fk_user];
} else {
$ustatic = new User($db);
$ustatic->fetch($obj->fk_user);
$TLoadedUsers[$obj->fk_user] = $ustatic;
// Line number
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
print '<td>'.(($offset * $limit) + $i).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
print $ustatic->getNomUrl(-1);
}
print "</td>\n";
// Ref
if (!empty($arrayfields['cs.rowid']['checked'])) {
print '<td>'.$chargesociale_static->getNomUrl(1, '20').'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Label
if (!empty($arrayfields['cs.libelle']['checked'])) {
print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->label).'">'.dol_escape_htmltag($obj->label).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Type
if (!empty($arrayfields['cs.fk_type']['checked'])) {
$typelabeltoshow = $obj->type_label;
$typelabelpopup = $obj->type_label;
if (isModEnabled('accounting')) {
$typelabelpopup .= ' - '.$langs->trans("AccountancyCode").': '.$obj->type_accountancy_code;
}
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($typelabelpopup).'">'.dol_escape_htmltag($typelabeltoshow).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Date
if (!empty($arrayfields['cs.date_ech']['checked'])) {
print '<td class="center nowraponall">'.dol_print_date($db->jdate($obj->date_ech), 'day').'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Date end period
if (!empty($arrayfields['cs.periode']['checked'])) {
print '<td class="center nowraponall">'.dol_print_date($db->jdate($obj->periode), 'day').'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Project ref
if (!empty($arrayfields['p.ref']['checked'])) {
print '<td class="nowraponall">';
if ($obj->project_id > 0) {
print $projectstatic->getNomUrl(1);
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
if (!empty($arrayfields['cs.fk_user']['checked'])) {
// Employee
print '<td class="tdoverflowmax150">';
if (!empty($obj->fk_user)) {
if (!empty($TLoadedUsers[$obj->fk_user])) {
$ustatic = $TLoadedUsers[$obj->fk_user];
} else {
$ustatic = new User($db);
$ustatic->fetch($obj->fk_user);
$TLoadedUsers[$obj->fk_user] = $ustatic;
}
print $ustatic->getNomUrl(-1);
}
print "</td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
}
// Type
if (!empty($arrayfields['cs.fk_mode_reglement']['checked'])) {
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($langs->trans("PaymentTypeShort".$obj->payment_code)).'">';
if (!empty($obj->payment_code)) {
print $langs->trans("PaymentTypeShort".$obj->payment_code);
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Account
if (!empty($arrayfields['cs.fk_account']['checked'])) {
print '<td class="toverflowmax150">';
if ($obj->fk_account > 0) {
$bankstatic->id = $obj->fk_account;
$bankstatic->ref = $obj->bref;
$bankstatic->number = $obj->bnumber;
$bankstatic->iban = $obj->iban;
$bankstatic->bic = $obj->bic;
$bankstatic->currency_code = $langs->trans("Currency".$obj->currency_code);
$bankstatic->account_number = $obj->account_number;
$bankstatic->clos = $obj->clos;
//$accountingjournal->fetch($obj->fk_accountancy_journal);
//$bankstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1);
$bankstatic->label = $obj->blabel;
print $bankstatic->getNomUrl(1);
}
print '</td>';
if (!$i) $totalarray['nbfield']++;
}
// Amount
if (!empty($arrayfields['cs.amount']['checked'])) {
print '<td class="nowraponall amount right">'.price($obj->amount).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 'totalttcfield';
}
$totalarray['val']['totalttcfield'] += $obj->amount;
}
// Status
if (!empty($arrayfields['cs.paye']['checked'])) {
print '<td class="nowraponall right">'.$chargesociale_static->LibStatut($obj->paye, 5, $obj->alreadypayed).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Buttons
print '<td></td>';
if (!$i) {
$totalarray['nbfield']++;
}
print '</tr>'."\n";
}
// Type
if (!empty($arrayfields['cs.fk_mode_reglement']['checked'])) {
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($langs->trans("PaymentTypeShort".$obj->payment_code)).'">';
if (!empty($obj->payment_code)) {
print $langs->trans("PaymentTypeShort".$obj->payment_code);
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Account
if (!empty($arrayfields['cs.fk_account']['checked'])) {
print '<td class="toverflowmax150">';
if ($obj->fk_account > 0) {
$bankstatic->id = $obj->fk_account;
$bankstatic->ref = $obj->bref;
$bankstatic->number = $obj->bnumber;
$bankstatic->iban = $obj->iban;
$bankstatic->bic = $obj->bic;
$bankstatic->currency_code = $langs->trans("Currency".$obj->currency_code);
$bankstatic->account_number = $obj->account_number;
$bankstatic->clos = $obj->clos;
//$accountingjournal->fetch($obj->fk_accountancy_journal);
//$bankstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1);
$bankstatic->label = $obj->blabel;
print $bankstatic->getNomUrl(1);
}
print '</td>';
if (!$i) $totalarray['nbfield']++;
}
// Amount
if (!empty($arrayfields['cs.amount']['checked'])) {
print '<td class="nowraponall amount right">'.price($obj->amount).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 'totalttcfield';
}
$totalarray['val']['totalttcfield'] += $obj->amount;
}
// Status
if (!empty($arrayfields['cs.paye']['checked'])) {
print '<td class="nowraponall right">'.$chargesociale_static->LibStatut($obj->paye, 5, $obj->alreadypayed).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Buttons
print '<td></td>';
if (!$i) {
$totalarray['nbfield']++;
}
print '</tr>'."\n";
$i++;
}

View File

@ -906,4 +906,39 @@ class Tva extends CommonObject
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
}
/**
* Return clicable link of object (with eventually picto)
*
* @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link)
* @return string HTML Code for Kanban thumb.
*/
public function getKanbanView($option = '')
{
global $langs;
$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">';
$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(1) : $this->ref).'</span>';
if (property_exists($this, 'amount')) {
$return .= ' | <span class="opacitymedium">'.$langs->trans("Amount").'</span> : <span class="info-box-label amount">'.price($this->amount).'</span>';
}
if (property_exists($this, 'type_payment')) {
$return .= '<br><span class="opacitymedium">'.$langs->trans("Payement").'</span> : <span class="info-box-label">'.$this->type_payment.'</span>';
}
if (property_exists($this, 'datev')) {
$return .= '<br><span class="opacitymedium">'.$langs->trans("DateEnd").'</span> : <span class="info-box-label" >'.dol_print_date($this->datev).'</span>';
}
if (method_exists($this, 'LibStatut')) {
$return .= '<br><div class="info-box-status margintoponly">'.$this->LibStatut($this->paiementtype, 5, $this->alreadypaid).'</div>';
}
$return .= '</div>';
$return .= '</div>';
$return .= '</div>';
return $return;
}
}

View File

@ -44,6 +44,7 @@ $massaction = GETPOST('massaction', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
$optioncss = GETPOST('optioncss', 'alpha');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'salestaxeslist';
$mode = GETPOST('mode', 'alpha');
$search_ref = GETPOST('search_ref', 'alpha');
$search_label = GETPOST('search_label', 'alpha');
@ -230,6 +231,9 @@ if (!$resql) {
$num = $db->num_rows($resql);
$param = '';
if (!empty($mode)) {
$param .= '&mode='.urlencode($mode);
}
if (!empty($contextpage) && $contextpage != $_SERVER['PHP_SELF']) {
$param .= '&contextpage='.$contextpage;
}
@ -317,7 +321,10 @@ $url = DOL_URL_ROOT.'/compta/tva/card.php?action=create';
if (!empty($socid)) {
$url .= '&socid='.$socid;
}
$newcardbutton = dolGetButtonTitle($langs->trans('NewVATPayment'), '', 'fa fa-plus-circle', $url, '', $user->rights->tax->charges->creer);
$newcardbutton = '';
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('NewVATPayment'), '', 'fa fa-plus-circle', $url, '', $user->rights->tax->charges->creer);
print_barre_liste($langs->trans("VATDeclarations"), $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1);
$varpage = empty($contextpage) ? $_SERVER['PHP_SELF'] : $contextpage;
@ -461,116 +468,134 @@ while ($i < min($num, $limit)) {
$tva_static->id = $obj->rowid;
$tva_static->ref = $obj->rowid;
$tva_static->label = $obj->label;
$tva_static->paiementtype = $obj->paye;
$tva_static->type_payment = $obj->payment_code;
$tva_static->datev = $obj->datev;
$tva_static->amount = $obj->amount;
print '<tr class="oddeven">';
// No
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
print '<td>'.(($offset * $limit) + $i).'</td>';
if (!$i) {
$totalarray['nbfield']++;
if ($mode == 'kanban') {
if ($i == 0) {
print '<tr><td colspan="12">';
print '<div class="box-flex-container">';
}
}
// Output Kanban
// Ref
if (!empty($arrayfields['t.rowid']['checked'])) {
print '<td>';
print $tva_static->getNomUrl(1);
$filename = dol_sanitizeFileName($tva_static->ref);
$filedir = $conf->tax->dir_output.'/vat/'.dol_sanitizeFileName($tva_static->ref);
$urlsource = $_SERVER['PHP_SELF'].'?id='.$tva_static->id;
print $formfile->getDocumentsLink($tva_static->element, $filename, $filedir, '', 'valignmiddle paddingleft2imp');
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
print $tva_static->getKanbanView('');
if ($i == (min($num, $limit) - 1)) {
print '</div>';
print '</td></tr>';
}
}
} else {
print '<tr class="oddeven">';
// Label
if (!empty($arrayfields['t.label']['checked'])) {
print '<td>'.dol_trunc($obj->label, 40).'</td>';
if (!$i) {
$totalarray['nbfield']++;
// No
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
print '<td>'.(($offset * $limit) + $i).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
}
// Date end period
if (!empty($arrayfields['t.datev']['checked'])) {
print '<td class="center">'.dol_print_date($db->jdate($obj->datev), 'day').'</td>';
if (!$i) {
$totalarray['nbfield']++;
// Ref
if (!empty($arrayfields['t.rowid']['checked'])) {
print '<td>';
print $tva_static->getNomUrl(1);
$filename = dol_sanitizeFileName($tva_static->ref);
$filedir = $conf->tax->dir_output.'/vat/'.dol_sanitizeFileName($tva_static->ref);
$urlsource = $_SERVER['PHP_SELF'].'?id='.$tva_static->id;
print $formfile->getDocumentsLink($tva_static->element, $filename, $filedir, '', 'valignmiddle paddingleft2imp');
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
}
// Date payment
/*if (!empty($arrayfields['t.datep']['checked'])) {
print '<td class="center">'.dol_print_date($db->jdate($obj->datep), 'day').'</td>';
if (!$i) $totalarray['nbfield']++;
}*/
// Type
if (!empty($arrayfields['t.fk_typepayment']['checked'])) {
print '<td>';
if (!empty($obj->payment_code)) print $langs->trans("PaymentTypeShort".$obj->payment_code);
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
// Label
if (!empty($arrayfields['t.label']['checked'])) {
print '<td>'.dol_trunc($obj->label, 40).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
}
// Account
if (!empty($arrayfields['t.fk_account']['checked'])) {
print '<td>';
if ($obj->fk_account > 0) {
$bankstatic->id = $obj->fk_account;
$bankstatic->ref = $obj->bref;
$bankstatic->number = $obj->bnumber;
$bankstatic->iban = $obj->iban;
$bankstatic->bic = $obj->bic;
$bankstatic->currency_code = $langs->trans("Currency".$obj->currency_code);
$bankstatic->account_number = $obj->account_number;
$bankstatic->clos = $obj->clos;
//$accountingjournal->fetch($obj->fk_accountancy_journal);
//$bankstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1);
$bankstatic->label = $obj->blabel;
print $bankstatic->getNomUrl(1);
// Date end period
if (!empty($arrayfields['t.datev']['checked'])) {
print '<td class="center">'.dol_print_date($db->jdate($obj->datev), 'day').'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
print '</td>';
if (!$i) $totalarray['nbfield']++;
}
// Amount
if (!empty($arrayfields['t.amount']['checked'])) {
$total = $total + $obj->amount;
print '<td class="nowrap right"><span class="amount">' . price($obj->amount) . '</span></td>';
if (!$i) {
$totalarray['nbfield']++;
}
$totalarray['pos'][$totalarray['nbfield']] = 'amount';
if (empty($totalarray['val']['amount'])) {
$totalarray['val']['amount'] = $obj->amount;
} else {
$totalarray['val']['amount'] += $obj->amount;
}
}
// Date payment
/*if (!empty($arrayfields['t.datep']['checked'])) {
print '<td class="center">'.dol_print_date($db->jdate($obj->datep), 'day').'</td>';
if (!$i) $totalarray['nbfield']++;
}*/
if (!empty($arrayfields['t.status']['checked'])) {
print '<td class="nowrap right">' . $tva_static->LibStatut($obj->paye, 5, $obj->alreadypayed) . '</td>';
if (!$i) {
$totalarray['nbfield']++;
// Type
if (!empty($arrayfields['t.fk_typepayment']['checked'])) {
print '<td>';
if (!empty($obj->payment_code)) print $langs->trans("PaymentTypeShort".$obj->payment_code);
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Account
if (!empty($arrayfields['t.fk_account']['checked'])) {
print '<td>';
if ($obj->fk_account > 0) {
$bankstatic->id = $obj->fk_account;
$bankstatic->ref = $obj->bref;
$bankstatic->number = $obj->bnumber;
$bankstatic->iban = $obj->iban;
$bankstatic->bic = $obj->bic;
$bankstatic->currency_code = $langs->trans("Currency".$obj->currency_code);
$bankstatic->account_number = $obj->account_number;
$bankstatic->clos = $obj->clos;
//$accountingjournal->fetch($obj->fk_accountancy_journal);
//$bankstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1);
$bankstatic->label = $obj->blabel;
print $bankstatic->getNomUrl(1);
}
print '</td>';
if (!$i) $totalarray['nbfield']++;
}
// Amount
if (!empty($arrayfields['t.amount']['checked'])) {
$totalarray['pos'][$totalarray['nbfield']] = '';
$total = $total + $obj->amount;
print '<td class="nowrap right"><span class="amount">' . price($obj->amount) . '</span></td>';
if (!$i) {
$totalarray['nbfield']++;
}
$totalarray['pos'][$totalarray['nbfield']] = 'amount';
if (empty($totalarray['val']['amount'])) {
$totalarray['val']['amount'] = $obj->amount;
} else {
$totalarray['val']['amount'] += $obj->amount;
}
}
if (!empty($arrayfields['t.status']['checked'])) {
print '<td class="nowrap right">' . $tva_static->LibStatut($obj->paye, 5, $obj->alreadypayed) . '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
if (!empty($arrayfields['t.amount']['checked'])) {
$totalarray['pos'][$totalarray['nbfield']] = '';
}
}
// Buttons
print '<td></td>';
print '</tr>';
}
// Buttons
print '<td></td>';
print '</tr>';
$i++;
}

View File

@ -1789,6 +1789,8 @@ class Contact extends CommonObject
$sql = "SELECT sc.fk_socpeople as id, sc.fk_c_type_contact";
$sql .= " FROM ".MAIN_DB_PREFIX."c_type_contact tc";
$sql .= ", ".MAIN_DB_PREFIX."societe_contacts sc";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."socpeople sp";
$sql .= " ON sc.fk_socpeople = sp.rowid AND sp.statut = 1";
$sql .= " WHERE sc.fk_soc =".((int) $this->socid);
$sql .= " AND sc.fk_c_type_contact=tc.rowid";
$sql .= " AND tc.element = '".$this->db->escape($element)."'";

View File

@ -101,10 +101,10 @@ $search_type = GETPOST('search_type', 'alpha');
$search_address = GETPOST('search_address', 'alpha');
$search_zip = GETPOST('search_zip', 'alpha');
$search_town = GETPOST('search_town', 'alpha');
$search_import_key = GETPOST("search_import_key", "alpha");
$search_import_key = GETPOST("search_import_key", 'alpha');
$search_country = GETPOST("search_country", 'intcomma');
$search_roles = GETPOST("search_roles", 'array');
$search_level = GETPOST("search_level", "array");
$search_level = GETPOST("search_level", 'array');
$search_stcomm = GETPOST('search_stcomm', 'int');
if ($search_status === '') {
@ -350,13 +350,21 @@ $formother = new FormOther($db);
$formcompany = new FormCompany($db);
$contactstatic = new Contact($db);
$morejs=array();
$morejs = array();
$morecss = array();
// Page Header
$title = $langs->trans("Contacts")." - ".$langs->trans("List");
$help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:M&oacute;dulo_Empresas';
llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist');
if (!empty($conf->global->THIRDPARTY_ENABLE_PROSPECTION_ON_ALTERNATIVE_ADRESSES)) {
$contactstatic->loadCacheOfProspStatus();
}
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
// Select every potentiels, and note each potentiels which fit in search parameters
$tab_level = array();
$sql = "SELECT code, label, sortorder";
@ -384,6 +392,7 @@ $sql .= " p.phone as phone_pro, p.phone_mobile, p.phone_perso, p.fax, p.fk_pays,
$sql .= " p.import_key,";
$sql .= " st.libelle as stcomm, st.picto as stcomm_picto, p.fk_stcommcontact as stcomm_id, p.fk_prospectlevel,";
$sql .= " co.label as country, co.code as country_code";
// Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
@ -393,13 +402,15 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) {
if (isModEnabled('mailing')) {
$sql .= ", (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = p.email) as unsubscribed";
}
// Add fields from hooks
// Add fields from hooks - ListSelect
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sqlfields = $sql; // $sql fields to remove for count total
// SQL Table Aliase
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p";
if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (p.rowid = ef.fk_object)";
@ -410,7 +421,8 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_stcommcontact as st ON st.id = p.fk_stco
if (empty($user->rights->societe->client->voir) && !$socid) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
}
// Add fields from hooks
// Add fields from hooks - ListFrom
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
@ -440,9 +452,13 @@ if ($search_priv != '0' && $search_priv != '1') {
}
}
// Search Categories
// Search Contact Categories
$searchCategoryContactList = $search_categ ? array($search_categ) : array();
$searchCategoryContactOperator = 0;
// Search for tag/category ($searchCategoryContactList is an array of ID)
// Search for tag/category ($searchCategoryContactList is an array of ID)
if (!empty($searchCategoryContactList)) {
$searchCategoryContactSqlList = array();
$listofcategoryid = '';
@ -470,9 +486,11 @@ if (!empty($searchCategoryContactList)) {
}
}
}
// Search Customer Categories
$searchCategoryCustomerList = $search_categ_thirdparty ? array($search_categ_thirdparty) : array();
$searchCategoryCustomerOperator = 0;
// Search for tag/category ($searchCategoryCustomerList is an array of ID)
// Search for tag/category ($searchCategoryCustomerList is an array of ID)
if (!empty($searchCategoryCustomerList)) {
$searchCategoryCustomerSqlList = array();
$listofcategoryid = '';
@ -500,9 +518,11 @@ if (!empty($searchCategoryCustomerList)) {
}
}
}
// Search Supplier Categories
$searchCategorySupplierList = $search_categ_supplier ? array($search_categ_supplier) : array();
$searchCategorySupplierOperator = 0;
// Search for tag/category ($searchCategorySupplierList is an array of ID)
// Search for tag/category ($searchCategorySupplierList is an array of ID)
if (!empty($searchCategorySupplierList)) {
$searchCategorySupplierSqlList = array();
$listofcategoryid = '';
@ -597,6 +617,7 @@ if (isModEnabled('socialnetworks')) {
}
}
//print $sql;
if (strlen($search_email)) {
$sql .= natural_search('p.email', $search_email);
}
@ -624,20 +645,22 @@ if ($search_status != '' && $search_status >= 0) {
if ($search_import_key) {
$sql .= natural_search("p.import_key", $search_import_key);
}
if ($type == "o") { // filtre sur type
if ($type == "o") { // filter on type
$sql .= " AND p.fk_soc IS NULL";
} elseif ($type == "f") { // filtre sur type
} elseif ($type == "f") { // filter on type
$sql .= " AND s.fournisseur = 1";
} elseif ($type == "c") { // filtre sur type
} elseif ($type == "c") { // filter on type
$sql .= " AND s.client IN (1, 3)";
} elseif ($type == "p") { // filtre sur type
} elseif ($type == "p") { // filter on type
$sql .= " AND s.client IN (2, 3)";
}
if (!empty($socid)) {
$sql .= " AND s.rowid = ".((int) $socid);
}
// Add where from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
// Add where from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
@ -692,11 +715,7 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && (
exit;
}
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
$help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:M&oacute;dulo_Empresas';
llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist');
$param = '';
if (!empty($mode)) {
@ -948,20 +967,25 @@ if (!empty($arrayfields['p.town']['checked'])) {
print '<input class="flat" type="text" name="search_town" size="5" value="'.dol_escape_htmltag($search_town).'">';
print '</td>';
}
/*
// State
/*if (!empty($arrayfields['state.nom']['checked']))
if (!empty($arrayfields['state.nom']['checked']))
{
print '<td class="liste_titre">';
print '<input class="flat searchstring" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).'">';
print '</td>';
}
// Region
if (!empty($arrayfields['region.nom']['checked']))
{
print '<td class="liste_titre">';
print '<input class="flat searchstring" size="4" type="text" name="search_region" value="'.dol_escape_htmltag($search_region).'">';
print '</td>';
}*/
}
*/
// Country
if (!empty($arrayfields['country.code_iso']['checked'])) {
print '<td class="liste_titre center">';
@ -1014,7 +1038,7 @@ if (!empty($arrayfields['p.fk_soc']['checked']) || !empty($arrayfields['s.nom'][
print '<input class="flat" type="text" name="search_societe" size="8" value="'.dol_escape_htmltag($search_societe).'">';
print '</td>';
}
// Alias
// Alias of ThirdParty
if (!empty($arrayfields['s.name_alias']['checked'])) {
print '<td class="liste_titre" align="left">';
print '<input class="flat maxwidth100" type="text" name="search_societe_alias" value="'.dol_escape_htmltag($search_societe_alias).'">';
@ -1079,7 +1103,7 @@ if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
}
print '</tr>';
// Ligne des titres
// Title line
print '<tr class="liste_titre">';
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
@ -1238,6 +1262,7 @@ while ($i < min($num, $limit)) {
}
print '</td>';
}
// ID
if (!empty($arrayfields['p.rowid']['checked'])) {
print '<td class="tdoverflowmax50">';
@ -1247,7 +1272,8 @@ while ($i < min($num, $limit)) {
$totalarray['nbfield']++;
}
}
// Name
// (Last) Name
if (!empty($arrayfields['p.lastname']['checked'])) {
print '<td class="middle tdoverflowmax150">';
print $contactstatic->getNomUrl(1);
@ -1256,6 +1282,7 @@ while ($i < min($num, $limit)) {
$totalarray['nbfield']++;
}
}
// Firstname
if (!empty($arrayfields['p.firstname']['checked'])) {
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->firstname).'">'.dol_escape_htmltag($obj->firstname).'</td>';
@ -1263,6 +1290,7 @@ while ($i < min($num, $limit)) {
$totalarray['nbfield']++;
}
}
// Job position
if (!empty($arrayfields['p.poste']['checked'])) {
print '<td class="tdoverflowmax100">'.dol_escape_htmltag($obj->poste).'</td>';
@ -1270,6 +1298,7 @@ while ($i < min($num, $limit)) {
$totalarray['nbfield']++;
}
}
// Address
if (!empty($arrayfields['p.address']['checked'])) {
print '<td>'.dol_escape_htmltag($obj->address).'</td>';
@ -1277,6 +1306,7 @@ while ($i < min($num, $limit)) {
$totalarray['nbfield']++;
}
}
// Zip
if (!empty($arrayfields['p.zip']['checked'])) {
print '<td>'.dol_escape_htmltag($obj->zip).'</td>';
@ -1284,6 +1314,7 @@ while ($i < min($num, $limit)) {
$totalarray['nbfield']++;
}
}
// Town
if (!empty($arrayfields['p.town']['checked'])) {
print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->town).'">'.dol_escape_htmltag($obj->town).'</td>';
@ -1291,18 +1322,22 @@ while ($i < min($num, $limit)) {
$totalarray['nbfield']++;
}
}
/*
// State
/*if (!empty($arrayfields['state.nom']['checked']))
if (!empty($arrayfields['state.nom']['checked']))
{
print "<td>".$obj->state_name."</td>\n";
if (! $i) $totalarray['nbfield']++;
}
// Region
if (!empty($arrayfields['region.nom']['checked']))
{
print "<td>".$obj->region_name."</td>\n";
if (! $i) $totalarray['nbfield']++;
}*/
// Country
if (!empty($arrayfields['country.code_iso']['checked'])) {
print '<td class="center">';
@ -1313,13 +1348,15 @@ while ($i < min($num, $limit)) {
$totalarray['nbfield']++;
}
}
// Phone
// Phone pro
if (!empty($arrayfields['p.phone']['checked'])) {
print '<td class="nowraponall tdoverflowmax150">'.dol_print_phone($obj->phone_pro, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'phone').'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Phone perso
if (!empty($arrayfields['p.phone_perso']['checked'])) {
print '<td class="nowraponall tdoverflowmax150">'.dol_print_phone($obj->phone_perso, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'phone').'</td>';
@ -1327,6 +1364,7 @@ while ($i < min($num, $limit)) {
$totalarray['nbfield']++;
}
}
// Phone mobile
if (!empty($arrayfields['p.phone_mobile']['checked'])) {
print '<td class="nowraponall tdoverflowmax150">'.dol_print_phone($obj->phone_mobile, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'mobile').'</td>';
@ -1334,6 +1372,7 @@ while ($i < min($num, $limit)) {
$totalarray['nbfield']++;
}
}
// Fax
if (!empty($arrayfields['p.fax']['checked'])) {
print '<td class="nowraponall tdoverflowmax150">'.dol_print_phone($obj->fax, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'fax').'</td>';
@ -1341,6 +1380,7 @@ while ($i < min($num, $limit)) {
$totalarray['nbfield']++;
}
}
// EMail
if (!empty($arrayfields['p.email']['checked'])) {
print '<td class="nowraponall tdoverflowmax300">'.dol_print_email($obj->email, $obj->rowid, $obj->socid, 'AC_EMAIL', 18, 0, 1).'</td>';
@ -1348,7 +1388,8 @@ while ($i < min($num, $limit)) {
$totalarray['nbfield']++;
}
}
// No EMail
// No EMail Subscription
if (!empty($arrayfields['unsubscribed']['checked'])) {
print '<td class="center">';
if (empty($obj->email)) {
@ -1361,6 +1402,8 @@ while ($i < min($num, $limit)) {
$totalarray['nbfield']++;
}
}
// Social Networks
if (isModEnabled('socialnetworks')) {
foreach ($socialnetworks as $key => $value) {
if ($value['active'] && !empty($arrayfields['p.'.$key]['checked'])) {
@ -1371,13 +1414,14 @@ while ($i < min($num, $limit)) {
}
}
}
// Company
// Company / Third Party
if (!empty($arrayfields['p.fk_soc']['checked']) || !empty($arrayfields['s.nom']['checked'])) {
print '<td class="tdoverflowmax200">';
if ($obj->socid) {
$objsoc = new Societe($db);
$objsoc->fetch($obj->socid);
print $objsoc->getNomUrl(1);
print $objsoc->getNomUrl(1, '', 100, 0, 1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1);
} else {
print '&nbsp;';
}
@ -1405,8 +1449,8 @@ while ($i < min($num, $limit)) {
}
}
// Prospect Level
if (!empty($arrayfields['p.fk_prospectlevel']['checked'])) {
// Prospect level
print '<td class="center">';
print $contactstatic->getLibProspLevel();
print "</td>";
@ -1415,8 +1459,8 @@ while ($i < min($num, $limit)) {
}
}
// Prospect status
if (!empty($arrayfields['p.fk_stcommcontact']['checked'])) {
// Prospect status
print '<td class="center nowrap"><div class="nowrap">';
print '<div class="inline-block">'.$contactstatic->libProspCommStatut($obj->stcomm_id, 2, $contactstatic->cacheprospectstatus[$obj->stcomm_id]['label'], $obj->stcomm_picto);
print '</div> - <div class="inline-block">';
@ -1437,6 +1481,7 @@ while ($i < min($num, $limit)) {
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
@ -1450,6 +1495,7 @@ while ($i < min($num, $limit)) {
$totalarray['nbfield']++;
}
}
// Date modification
if (!empty($arrayfields['p.tms']['checked'])) {
print '<td class="center nowraponall">';
@ -1459,6 +1505,7 @@ while ($i < min($num, $limit)) {
$totalarray['nbfield']++;
}
}
// Status
if (!empty($arrayfields['p.statut']['checked'])) {
print '<td class="center">'.$contactstatic->getLibStatut(5).'</td>';
@ -1466,6 +1513,7 @@ while ($i < min($num, $limit)) {
$totalarray['nbfield']++;
}
}
// Import key
if (!empty($arrayfields['p.import_key']['checked'])) {
print '<td class="tdoverflowmax100">';

View File

@ -427,6 +427,7 @@ if (empty($reshook)) {
} else {
$idprod = GETPOST('idprod', 'int');
}
$tva_tx = GETPOST('tva_tx', 'alpha');
$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS');
@ -474,11 +475,11 @@ if (empty($reshook)) {
$prod->fetch($idprod);
// Update if prices fields are defined
$tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id);
/*$tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id);
$tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id);
if (empty($tva_tx)) {
$tva_npr = 0;
}
}*/
$price_min = $prod->price_min;
$price_min_ttc = $prod->price_min_ttc;
@ -500,14 +501,14 @@ if (empty($reshook)) {
if (count($prodcustprice->lines) > 0) {
$price_min = price($prodcustprice->lines[0]->price_min);
$price_min_ttc = price($prodcustprice->lines[0]->price_min_ttc);
$tva_tx = $prodcustprice->lines[0]->tva_tx;
/*$tva_tx = $prodcustprice->lines[0]->tva_tx;
if ($prodcustprice->lines[0]->default_vat_code && !preg_match('/\(.*\)/', $tva_tx)) {
$tva_tx .= ' ('.$prodcustprice->lines[0]->default_vat_code.')';
}
$tva_npr = $prodcustprice->lines[0]->recuperableonly;
if (empty($tva_tx)) {
$tva_npr = 0;
}
}*/
}
}
}
@ -699,7 +700,7 @@ if (empty($reshook)) {
$date_end_real_update = $objectline->date_end_real;
}
$vat_rate = GETPOST('eltva_tx');
$vat_rate = GETPOST('eltva_tx', 'alpha');
// Define info_bits
$info_bits = 0;
if (preg_match('/\*/', $vat_rate)) {
@ -2046,11 +2047,12 @@ if ($action == 'create') {
$dateSelector = 1;
print "\n";
print ' <form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '#add' : '#line_'.GETPOST('lineid', 'int')).'" method="POST">
print ' <form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '' : '#line_'.GETPOST('lineid', 'int')).'" method="POST">
<input type="hidden" name="token" value="'.newToken().'">
<input type="hidden" name="action" value="'.(($action != 'editline') ? 'addline' : 'updateline').'">
<input type="hidden" name="mode" value="">
<input type="hidden" name="id" value="'.$object->id.'">
<input type="hidden" name="page_y" value="">
';
print '<div class="div-table-responsive-no-min">';

View File

@ -232,7 +232,7 @@ class Contrat extends CommonObject
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35),
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>40),
'date_contrat' =>array('type'=>'datetime', 'label'=>'Date contrat', 'enabled'=>1, 'visible'=>-1, 'position'=>45),
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>70),
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'isModEnabled("societe")', 'visible'=>-1, 'notnull'=>1, 'position'=>70),
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>"isModEnabled('project')", 'visible'=>-1, 'position'=>75),
'fk_commercial_signature' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'SaleRepresentative Signature', 'enabled'=>1, 'visible'=>-1, 'position'=>80),
'fk_commercial_suivi' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'SaleRepresentative follower', 'enabled'=>1, 'visible'=>-1, 'position'=>85),
@ -2789,6 +2789,38 @@ class Contrat extends CommonObject
return ($error ? 1: 0);
}
/**
* Return clicable link of object (with eventually picto)
*
* @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link)
* @return string HTML Code for Kanban thumb.
*/
public function getKanbanView($option = '')
{
global $langs;
$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">';
$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>';
if (property_exists($this, 'societe')) {
$return .= '<br><span class="info-box-label ">'.$this->societe.'</span>';
}
if (property_exists($this, 'date_contrat')) {
$return .= '<br><span class="opacitymedium">'.$langs->trans("DateContract").' : </span><span class="info-box-label">'.dol_print_date($this->date_contrat).'</span>';
}
if (method_exists($this, 'getLibStatut')) {
$return .= '<br><div class="info-box-status margintoponly">'.$this->getLibStatut(5).'</div>';
}
$return .= '</div>';
$return .= '</div>';
$return .= '</div>';
return $return;
}
}

View File

@ -51,6 +51,7 @@ $show_files = GETPOST('show_files', 'int');
$confirm = GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'contractlist'; // To manage different context of search
$mode = GETPOST('mode', 'alpha');
$search_name = GETPOST('search_name', 'alpha');
$search_email = GETPOST('search_email', 'alpha');
@ -510,6 +511,9 @@ if ($socid > 0) {
}
$param = '';
if (!empty($mode)) {
$param .= '&mode='.urlencode($mode);
}
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
@ -606,7 +610,10 @@ $url = DOL_URL_ROOT.'/contrat/card.php?action=create';
if (!empty($socid)) {
$url .= '&socid='.((int) $socid);
}
$newcardbutton = dolGetButtonTitle($langs->trans('NewContractSubscription'), '', 'fa fa-plus-circle', $url, '', $user->rights->contrat->creer);
$newcardbutton = '';
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('NewContractSubscription'), '', 'fa fa-plus-circle', $url, '', $user->rights->contrat->creer);
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
if ($optioncss != '') {
@ -618,6 +625,7 @@ print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
print_barre_liste($langs->trans("Contracts"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'contract', 0, $newcardbutton, '', $limit, 0, 0, 1);
@ -909,212 +917,227 @@ while ($i < min($num, $limit)) {
$socstatic->country_code = $cacheCountryIDCode[$obj->country_id]['code'];
$socstatic->country = $cacheCountryIDCode[$obj->country_id]['label'];
}
print '<tr class="oddeven">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="nowrap center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($obj->rowid, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '</td>';
}
// Ref
if (!empty($arrayfields['c.ref']['checked'])) {
print '<td class="nowraponall">';
print $contracttmp->getNomUrl(1);
if ($obj->nb_late) {
print img_warning($langs->trans("Late"));
}
if (!empty($obj->note_private) || !empty($obj->note_public)) {
print ' <span class="note">';
print '<a href="'.DOL_URL_ROOT.'/contrat/note.php?id='.$obj->rowid.'&save_lastsearch_values=1">'.img_picto($langs->trans("ViewPrivateNote"), 'note').'</a>';
print '</span>';
//mode kanban
if ($mode == 'kanban') {
if ($i == 0) {
print '<tr><td colspan="12">';
print '<div class="box-flex-container">';
}
$filename = dol_sanitizeFileName($obj->ref);
$filedir = $conf->contrat->multidir_output[$obj->entity].'/'.dol_sanitizeFileName($obj->ref);
$urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid;
print $formfile->getDocumentsLink($contracttmp->element, $filename, $filedir);
print '</td>';
print '</td>';
}
// Ref thirdparty
if (!empty($arrayfields['c.ref_customer']['checked'])) {
print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag(dol_string_nohtmltag($contracttmp->getFormatedCustomerRef($obj->ref_customer))).'">'.$contracttmp->getFormatedCustomerRef($obj->ref_customer).'</td>';
}
if (!empty($arrayfields['c.ref_supplier']['checked'])) {
print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->ref_supplier).'">'.dol_escape_htmltag($obj->ref_supplier).'</td>';
}
if (!empty($arrayfields['s.nom']['checked'])) {
print '<td class="tdoverflowmax150">';
if ($obj->socid > 0) {
// TODO Use a cache for this string
print $socstatic->getNomUrl(1, '');
// Output Kanban
$contracttmp->societe = $socstatic->getNomUrl();
$contracttmp->date_contrat = $obj->date_contrat;
print $contracttmp->getKanbanView('');
if ($i == (min($num, $limit) - 1)) {
print '</div>';
print '</td></tr>';
}
print '</td>';
}
// Email
if (!empty($arrayfields['s.email']['checked'])) {
print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->email).'">'.dol_print_email($obj->email, 0, $obj->socid, 0, 0, 1, 1).'</td>';
}
// Town
if (!empty($arrayfields['s.town']['checked'])) {
print '<td class="nocellnopadd">';
print $obj->town;
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Zip
if (!empty($arrayfields['s.zip']['checked'])) {
print '<td class="nocellnopadd">';
print $obj->zip;
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// State
if (!empty($arrayfields['state.nom']['checked'])) {
print "<td>".$obj->state_name."</td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
}
// Country
if (!empty($arrayfields['country.code_iso']['checked'])) {
print '<td class="center tdoverflowmax100" title="'.dol_escape_htmltag($socstatic->country).'">';
print dol_escape_htmltag($socstatic->country);
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Type ent
if (!empty($arrayfields['typent.code']['checked'])) {
print '<td class="center">';
if (count($typenArray) == 0) {
$typenArray = $formcompany->typent_array(1);
}
print $typenArray[$obj->typent_code];
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
if (!empty($arrayfields['sale_representative']['checked'])) {
// Sales representatives
print '<td>';
if ($obj->socid > 0) {
$listsalesrepresentatives = $socstatic->getSalesRepresentatives($user);
if ($listsalesrepresentatives < 0) {
dol_print_error($db);
}
$nbofsalesrepresentative = count($listsalesrepresentatives);
if ($nbofsalesrepresentative > 6) {
// We print only number
print $nbofsalesrepresentative;
} elseif ($nbofsalesrepresentative > 0) {
$userstatic = new User($db);
$j = 0;
foreach ($listsalesrepresentatives as $val) {
$userstatic->id = $val['id'];
$userstatic->lastname = $val['lastname'];
$userstatic->firstname = $val['firstname'];
$userstatic->email = $val['email'];
$userstatic->statut = $val['statut'];
$userstatic->entity = $val['entity'];
$userstatic->photo = $val['photo'];
$userstatic->login = $val['login'];
$userstatic->phone = $val['phone'];
$userstatic->job = $val['job'];
$userstatic->gender = $val['gender'];
//print '<div class="float">':
print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2);
$j++;
if ($j < $nbofsalesrepresentative) {
print ' ';
}
//print '</div>';
} else {
print '<tr class="oddeven">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="nowrap center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($obj->rowid, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
}
//else print $langs->trans("NoSalesRepresentativeAffected");
} else {
print '&nbsp;';
print '</td>';
}
print '</td>';
}
// Date
if (!empty($arrayfields['c.date_contrat']['checked'])) {
print '<td class="center">'.dol_print_date($db->jdate($obj->date_contrat), 'day', 'tzserver').'</td>';
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation
if (!empty($arrayfields['c.datec']['checked'])) {
print '<td class="center nowrap">';
print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Date modification
if (!empty($arrayfields['c.tms']['checked'])) {
print '<td class="center nowrap">';
print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Date lower end date
if (!empty($arrayfields['lower_planned_end_date']['checked'])) {
print '<td class="center nowrapforall">';
print dol_print_date($db->jdate($obj->lower_planned_end_date), 'day', 'tzuser');
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Status
if (!empty($arrayfields['status']['checked'])) {
print '<td class="center">'.($obj->nb_initial > 0 ? $obj->nb_initial : '').'</td>';
print '<td class="center">'.($obj->nb_running > 0 ? $obj->nb_running : '').'</td>';
print '<td class="center">'.($obj->nb_expired > 0 ? $obj->nb_expired : '').'</td>';
print '<td class="center">'.($obj->nb_closed > 0 ? $obj->nb_closed : '').'</td>';
}
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="nowrap center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($obj->rowid, $arrayofselected)) {
$selected = 1;
// Ref
if (!empty($arrayfields['c.ref']['checked'])) {
print '<td class="nowraponall">';
print $contracttmp->getNomUrl(1);
if ($obj->nb_late) {
print img_warning($langs->trans("Late"));
}
if (!empty($obj->note_private) || !empty($obj->note_public)) {
print ' <span class="note">';
print '<a href="'.DOL_URL_ROOT.'/contrat/note.php?id='.$obj->rowid.'&save_lastsearch_values=1">'.img_picto($langs->trans("ViewPrivateNote"), 'note').'</a>';
print '</span>';
}
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '</td>';
}
if (!$i) {
$totalarray['nbfield']++;
}
print "</tr>\n";
$filename = dol_sanitizeFileName($obj->ref);
$filedir = $conf->contrat->multidir_output[$obj->entity].'/'.dol_sanitizeFileName($obj->ref);
$urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid;
print $formfile->getDocumentsLink($contracttmp->element, $filename, $filedir);
print '</td>';
print '</td>';
}
// Ref thirdparty
if (!empty($arrayfields['c.ref_customer']['checked'])) {
print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag(dol_string_nohtmltag($contracttmp->getFormatedCustomerRef($obj->ref_customer))).'">'.$contracttmp->getFormatedCustomerRef($obj->ref_customer).'</td>';
}
if (!empty($arrayfields['c.ref_supplier']['checked'])) {
print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->ref_supplier).'">'.dol_escape_htmltag($obj->ref_supplier).'</td>';
}
if (!empty($arrayfields['s.nom']['checked'])) {
print '<td class="tdoverflowmax150">';
if ($obj->socid > 0) {
// TODO Use a cache for this string
print $socstatic->getNomUrl(1, '');
}
print '</td>';
}
// Email
if (!empty($arrayfields['s.email']['checked'])) {
print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->email).'">'.dol_print_email($obj->email, 0, $obj->socid, 0, 0, 1, 1).'</td>';
}
// Town
if (!empty($arrayfields['s.town']['checked'])) {
print '<td class="nocellnopadd">';
print $obj->town;
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Zip
if (!empty($arrayfields['s.zip']['checked'])) {
print '<td class="nocellnopadd">';
print $obj->zip;
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// State
if (!empty($arrayfields['state.nom']['checked'])) {
print "<td>".$obj->state_name."</td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
}
// Country
if (!empty($arrayfields['country.code_iso']['checked'])) {
print '<td class="center tdoverflowmax100" title="'.dol_escape_htmltag($socstatic->country).'">';
print dol_escape_htmltag($socstatic->country);
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Type ent
if (!empty($arrayfields['typent.code']['checked'])) {
print '<td class="center">';
if (count($typenArray) == 0) {
$typenArray = $formcompany->typent_array(1);
}
print $typenArray[$obj->typent_code];
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
if (!empty($arrayfields['sale_representative']['checked'])) {
// Sales representatives
print '<td>';
if ($obj->socid > 0) {
$listsalesrepresentatives = $socstatic->getSalesRepresentatives($user);
if ($listsalesrepresentatives < 0) {
dol_print_error($db);
}
$nbofsalesrepresentative = count($listsalesrepresentatives);
if ($nbofsalesrepresentative > 6) {
// We print only number
print $nbofsalesrepresentative;
} elseif ($nbofsalesrepresentative > 0) {
$userstatic = new User($db);
$j = 0;
foreach ($listsalesrepresentatives as $val) {
$userstatic->id = $val['id'];
$userstatic->lastname = $val['lastname'];
$userstatic->firstname = $val['firstname'];
$userstatic->email = $val['email'];
$userstatic->statut = $val['statut'];
$userstatic->entity = $val['entity'];
$userstatic->photo = $val['photo'];
$userstatic->login = $val['login'];
$userstatic->phone = $val['phone'];
$userstatic->job = $val['job'];
$userstatic->gender = $val['gender'];
//print '<div class="float">':
print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2);
$j++;
if ($j < $nbofsalesrepresentative) {
print ' ';
}
//print '</div>';
}
}
//else print $langs->trans("NoSalesRepresentativeAffected");
} else {
print '&nbsp;';
}
print '</td>';
}
// Date
if (!empty($arrayfields['c.date_contrat']['checked'])) {
print '<td class="center">'.dol_print_date($db->jdate($obj->date_contrat), 'day', 'tzserver').'</td>';
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation
if (!empty($arrayfields['c.datec']['checked'])) {
print '<td class="center nowrap">';
print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Date modification
if (!empty($arrayfields['c.tms']['checked'])) {
print '<td class="center nowrap">';
print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Date lower end date
if (!empty($arrayfields['lower_planned_end_date']['checked'])) {
print '<td class="center nowrapforall">';
print dol_print_date($db->jdate($obj->lower_planned_end_date), 'day', 'tzuser');
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Status
if (!empty($arrayfields['status']['checked'])) {
print '<td class="center">'.($obj->nb_initial > 0 ? $obj->nb_initial : '').'</td>';
print '<td class="center">'.($obj->nb_running > 0 ? $obj->nb_running : '').'</td>';
print '<td class="center">'.($obj->nb_expired > 0 ? $obj->nb_expired : '').'</td>';
print '<td class="center">'.($obj->nb_closed > 0 ? $obj->nb_closed : '').'</td>';
}
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="nowrap center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($obj->rowid, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '</td>';
}
if (!$i) {
$totalarray['nbfield']++;
}
print "</tr>\n";
}
$i++;
}

View File

@ -1708,6 +1708,66 @@ if (!$error && ($massaction == 'increaseholiday' || ($action == 'increaseholiday
}
}
//if (!$error && $massaction == 'clonetasks' && $user->rights->projet->creer) {
if (!$error && ($massaction == 'clonetasks' || ($action == 'clonetasks' && $confirm == 'yes'))) {
$num = 0;
dol_include_once('/projet/class/task.class.php');
$origin_task = new Task($db);
$clone_task = new Task($db);
foreach (GETPOST('selected') as $task) {
$origin_task->fetch($task, $ref = '', $loadparentdata = 0);
$defaultref = '';
$obj = empty($conf->global->PROJECT_TASK_ADDON) ? 'mod_task_simple' : $conf->global->PROJECT_TASK_ADDON;
if (!empty($conf->global->PROJECT_TASK_ADDON) && is_readable(DOL_DOCUMENT_ROOT . "/core/modules/project/task/" . $conf->global->PROJECT_TASK_ADDON . ".php")) {
require_once DOL_DOCUMENT_ROOT . "/core/modules/project/task/" . $conf->global->PROJECT_TASK_ADDON . '.php';
$modTask = new $obj;
$defaultref = $modTask->getNextValue(0, $clone_task);
}
if (!$error) {
$clone_task->fk_project = GETPOST('projectid', 'int');
$clone_task->ref = $defaultref;
$clone_task->label = $origin_task->label;
$clone_task->description = $origin_task->description;
$clone_task->planned_workload = $origin_task->planned_workload;
$clone_task->fk_task_parent = $origin_task->fk_task_parent;
$clone_task->date_c = dol_now();
$clone_task->date_start = $origin_task->date_start;
$clone_task->date_end = $origin_task->date_end;
$clone_task->progress = $origin_task->progress;
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost(null, $clone_task);
$taskid = $clone_task->create($user);
if ($taskid > 0) {
$result = $clone_task->add_contact(GETPOST("userid", 'int'), 'TASKEXECUTIVE', 'internal');
$num++;
} else {
if ($db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
$langs->load("projects");
setEventMessages($langs->trans('NewTaskRefSuggested'), '', 'warnings');
$duplicate_code_error = true;
} else {
setEventMessages($clone_task->error, $clone_task->errors, 'errors');
}
$action = 'list';
$error++;
}
}
}
if (!$error) {
setEventMessage($langs->trans('NumberOfTasksCloned', $num));
header("Refresh: 1;URL=".DOL_URL_ROOT.'/projet/tasks.php?id=' . GETPOST('projectid', 'int'));
}
}
$parameters['toselect'] = (empty($toselect) ? array() : $toselect);
$parameters['uploaddir'] = $uploaddir;
$parameters['massaction'] = $massaction;

View File

@ -36,9 +36,10 @@ if (!defined('NOREQUIREAJAX')) {
if (!defined('NOREQUIRESOC')) {
define('NOREQUIRESOC', '1');
}
if (!defined('NOREQUIRETRAN')) {
// We need langs because the getRandomPassword may use user language to define some rules of pass generation
/*if (!defined('NOREQUIRETRAN')) {
define('NOREQUIRETRAN', '1');
}
}*/
// Load Dolibarr environment
require '../../main.inc.php';
@ -55,9 +56,9 @@ top_httphead();
//print '<!-- Ajax page called with url '.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]).' -->'."\n";
// Registering the location of boxes
// Return a new generated password
if ($action) {
if ($action == 'getrandompassword' && ($user->admin || $user->rights->api->apikey->generate)) {
if ($action == 'getrandompassword') {
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
$generic = GETPOST('generic') ? true : false;
echo getRandomPassword($generic);

View File

@ -1288,7 +1288,8 @@ abstract class CommonDocGenerator
}
$extrafields = $this->extrafieldsCache;
$extrafieldOutputContent = $extrafields->showOutputField($extrafieldKey, $object->array_options[$extrafieldOptionsKey], '', $object->table_element);
$extrafieldOutputContent = '';
if (isset($object->array_options[$extrafieldOptionsKey])) $extrafieldOutputContent = $extrafields->showOutputField($extrafieldKey, $object->array_options[$extrafieldOptionsKey], '', $object->table_element);
// TODO : allow showOutputField to be pdf public friendly, ex: in a link to object, clean getNomUrl to remove link and images... like a getName methode ...
if ($extrafields->attributes[$object->table_element]['type'][$extrafieldKey] == 'link') {

View File

@ -865,7 +865,7 @@ abstract class CommonInvoice extends CommonObject
/**
* Create a withdrawal request for a direct debit order or a credit transfer order.
* Create a withdrawal request at Stripe for a direct debit order or a credit transfer order.
* Use the remain to pay excluding all existing open direct debit requests.
*
* @param User $fuser User asking the direct debit transfer
@ -900,6 +900,7 @@ abstract class CommonInvoice extends CommonObject
$sql = "SELECT rowid, date_demande, amount, fk_facture, fk_facture_fourn";
$sql .= " FROM ".$this->db->prefix()."prelevement_demande";
$sql .= " AND fk_facture = ".((int) $this->fk_facture); // Add a protection to not pay another invoice than current one
$sql .= " WHERE rowid = ".((int) $did);
dol_syslog(get_class($this)."::makeStripeSepaRequest 1", LOG_DEBUG);
@ -1035,9 +1036,9 @@ abstract class CommonInvoice extends CommonObject
}
dol_syslog("makeStripeSepaRequest get stripe account", LOG_DEBUG);
dol_syslog("makeStripeSepaRequest get stripe connet account", LOG_DEBUG);
$stripeacc = $stripe->getStripeAccount($service, $this->socid); // Get Stripe OAuth connect account if it exists (no network access here)
dol_syslog("makeStripeSepaRequest get stripe account return " . json_encode($stripeacc), LOG_DEBUG);
dol_syslog("makeStripeSepaRequest get stripe connect account return " . json_encode($stripeacc), LOG_DEBUG);
if ($foundalternativestripeaccount) {
if (empty($stripeacc)) { // If the Stripe connect account not set, we use common API usage
@ -1072,101 +1073,64 @@ abstract class CommonInvoice extends CommonObject
}
if (!$error) { // Payment was not canceled
//erics card or sepa ?
$sepaMode = false;
$stripecard = null;
if ($companypaymentmode->type == 'ban') {
$sepaMode = true;
$stripecard = $stripe->sepaStripe($customer, $companypaymentmode, $stripeacc, $servicestatus, 0);
} else {
$stripecard = $stripe->cardStripe($customer, $companypaymentmode, $stripeacc, $servicestatus, 0);
}
if ($stripecard) { // Can be card_... (old mode) or pm_... (new mode)
if ($stripecard) { // Can be src_... (for sepa) - Other card_... (old mode) or pm_... (new mode) should not happen here.
$FULLTAG = 'INV=' . $this->id . '-CUS=' . $thirdparty->id;
$description = 'Stripe payment from doTakePaymentStripeForThirdparty: ' . $FULLTAG . ' ref=' . $this->ref;
$description = 'Stripe payment from makeStripeSepaRequest: ' . $FULLTAG . ' ref=' . $this->ref;
$stripefailurecode = '';
$stripefailuremessage = '';
$stripefailuredeclinecode = '';
if (preg_match('/^card_/', $stripecard->id)) { // Using old method
dol_syslog("* Create charge on card " . $stripecard->id . ", amountstripe=" . $amountstripe . ", FULLTAG=" . $FULLTAG, LOG_DEBUG);
// Using new SCA method
dol_syslog("* Create payment on SEPA " . $stripecard->id . ", amounttopay=" . $amounttopay . ", amountstripe=" . $amountstripe . ", FULLTAG=" . $FULLTAG, LOG_DEBUG);
$ipaddress = getUserRemoteIP();
// Create payment intent and charge payment (confirmnow = true)
$paymentintent = $stripe->getPaymentIntent($amounttopay, $currency, $FULLTAG, $description, $this, $customer->id, $stripeacc, $servicestatus, 0, 'automatic', true, $stripecard->id, 1);
$charge = null; // Force reset of $charge, so, if already set from a previous fetch, it will be empty even if there is an exception at next step
try {
$charge = \Stripe\Charge::create([
'amount' => price2num($amountstripe, 'MU'),
'currency' => $currency,
'capture' => true, // Charge immediatly
'description' => $description,
'metadata' => ["FULLTAG" => $FULLTAG, 'Recipient' => $mysoc->name, 'dol_version' => DOL_VERSION, 'dol_entity' => $conf->entity, 'ipaddress' => $ipaddress],
'customer' => $customer->id,
//'customer' => 'bidon_to_force_error', // To use to force a stripe error
'source' => $stripecard,
'statement_descriptor' => dol_trunc('INV=' . $this->id, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description)
]);
} catch (\Stripe\Error\Card $e) {
// Since it's a decline, Stripe_CardError will be caught
$body = $e->getJsonBody();
$err = $body['error'];
$charge = new stdClass();
//erics add processing sepa is like success ?
if ($paymentintent->status === 'succeeded' || $paymentintent->status === 'processing') {
$charge->status = 'ok';
$charge->id = $paymentintent->id;
$charge->customer = $customer->id;
} elseif ($paymentintent->status === 'requires_action') {
//paymentintent->status may be => 'requires_action' (no error in such a case)
dol_syslog(var_export($paymentintent, true), LOG_DEBUG);
$stripefailurecode = $err['code'];
$stripefailuremessage = $err['message'];
$stripefailuredeclinecode = $err['decline_code'];
} catch (Exception $e) {
$stripefailurecode = 'UnknownChargeError';
$stripefailuremessage = $e->getMessage();
}
} else { // Using new SCA method
if ($sepaMode) {
dol_syslog("* Create payment on SEPA " . $stripecard->id . ", amounttopay=" . $amounttopay . ", amountstripe=" . $amountstripe . ", FULLTAG=" . $FULLTAG, LOG_DEBUG);
} else {
dol_syslog("* Create payment on card " . $stripecard->id . ", amounttopay=" . $amounttopay . ", amountstripe=" . $amountstripe . ", FULLTAG=" . $FULLTAG, LOG_DEBUG);
}
$charge->status = 'failed';
$charge->customer = $customer->id;
$charge->failure_code = $stripe->code;
$charge->failure_message = $stripe->error;
$charge->failure_declinecode = $stripe->declinecode;
$stripefailurecode = $stripe->code;
$stripefailuremessage = 'Action required. Contact the support at ';// . $conf->global->SELLYOURSAAS_MAIN_EMAIL;
$stripefailuredeclinecode = $stripe->declinecode;
} else {
dol_syslog(var_export($paymentintent, true), LOG_DEBUG);
// Create payment intent and charge payment (confirmnow = true)
$paymentintent = $stripe->getPaymentIntent($amounttopay, $currency, $FULLTAG, $description, $invoice, $customer->id, $stripeacc, $servicestatus, 0, 'automatic', true, $stripecard->id, 1);
$charge = new stdClass();
//erics add processing sepa is like success ?
if ($paymentintent->status === 'succeeded' || $paymentintent->status === 'processing') {
$charge->status = 'ok';
$charge->id = $paymentintent->id;
$charge->customer = $customer->id;
} elseif ($paymentintent->status === 'requires_action') {
//paymentintent->status may be => 'requires_action' (no error in such a case)
dol_syslog(var_export($paymentintent, true), LOG_DEBUG);
$charge->status = 'failed';
$charge->customer = $customer->id;
$charge->failure_code = $stripe->code;
$charge->failure_message = $stripe->error;
$charge->failure_declinecode = $stripe->declinecode;
$stripefailurecode = $stripe->code;
$stripefailuremessage = 'Action required. Contact the support at ';// . $conf->global->SELLYOURSAAS_MAIN_EMAIL;
$stripefailuredeclinecode = $stripe->declinecode;
} else {
dol_syslog(var_export($paymentintent, true), LOG_DEBUG);
$charge->status = 'failed';
$charge->customer = $customer->id;
$charge->failure_code = $stripe->code;
$charge->failure_message = $stripe->error;
$charge->failure_declinecode = $stripe->declinecode;
$stripefailurecode = $stripe->code;
$stripefailuremessage = $stripe->error;
$stripefailuredeclinecode = $stripe->declinecode;
}
//var_dump("stripefailurecode=".$stripefailurecode." stripefailuremessage=".$stripefailuremessage." stripefailuredeclinecode=".$stripefailuredeclinecode);
//exit;
$charge->status = 'failed';
$charge->customer = $customer->id;
$charge->failure_code = $stripe->code;
$charge->failure_message = $stripe->error;
$charge->failure_declinecode = $stripe->declinecode;
$stripefailurecode = $stripe->code;
$stripefailuremessage = $stripe->error;
$stripefailuredeclinecode = $stripe->declinecode;
}
//var_dump("stripefailurecode=".$stripefailurecode." stripefailuremessage=".$stripefailuremessage." stripefailuredeclinecode=".$stripefailuredeclinecode);
//exit;
// Return $charge = array('id'=>'ch_XXXX', 'status'=>'succeeded|pending|failed', 'failure_code'=>, 'failure_message'=>...)
if (empty($charge) || $charge->status == 'failed') {
dol_syslog('Failed to charge card or payment mode ' . $stripecard->id . ' stripefailurecode=' . $stripefailurecode . ' stripefailuremessage=' . $stripefailuremessage . ' stripefailuredeclinecode=' . $stripefailuredeclinecode, LOG_WARNING);
dol_syslog('Failed to charge payment mode ' . $stripecard->id . ' stripefailurecode=' . $stripefailurecode . ' stripefailuremessage=' . $stripefailuremessage . ' stripefailuredeclinecode=' . $stripefailuredeclinecode, LOG_WARNING);
// Save a stripe payment was in error
$this->stripechargeerror++;
@ -1202,20 +1166,20 @@ abstract class CommonInvoice extends CommonObject
$errmsg .= ($stripefailuredeclinecode ? ' - ' . $stripefailuredeclinecode : '');
}
$description = 'Stripe payment ERROR from doTakePaymentStripeForThirdparty: ' . $FULLTAG;
$description = 'Stripe payment ERROR from makeStripeSepaRequest: ' . $FULLTAG;
$postactionmessages[] = $errmsg . ' (' . $stripearrayofkeys['publishable_key'] . ')';
$this->errors[] = $errmsg;
} else {
dol_syslog('Successfuly charge card ' . $stripecard->id);
dol_syslog('Successfuly charge direct debit ' . $stripecard->id);
$postactionmessages[] = 'Success to charge card (' . $charge->id . ' with ' . $stripearrayofkeys['publishable_key'] . ')';
$postactionmessages[] = 'Success to charge direct debit (' . $charge->id . ' with ' . $stripearrayofkeys['publishable_key'] . ')';
// Save a stripe payment was done in realy life so later we will be able to force a commit on recorded payments
// even if in batch mode (method doTakePaymentStripe), we will always make all action in one transaction with a forced commit.
$this->stripechargedone++;
// Default description used for label of event. Will be overwrite by another value later.
$description = 'Stripe payment OK (' . $charge->id . ') from doTakePaymentStripeForThirdparty: ' . $FULLTAG;
$description = 'Stripe payment OK (' . $charge->id . ') from makeStripeSepaRequest: ' . $FULLTAG;
$db = $this->db;
@ -1300,13 +1264,8 @@ abstract class CommonInvoice extends CommonObject
if (!$errorforinvoice && isModEnabled('banque')) {
dol_syslog('* Add payment to bank');
// The bank used is the one defined into Stripe setup
$bankaccountid = 0;
if ($paymentmethod == 'paybox') {
$bankaccountid = $conf->global->PAYBOX_BANK_ACCOUNT_FOR_PAYMENTS;
}
if ($paymentmethod == 'paypal') {
$bankaccountid = $conf->global->PAYPAL_BANK_ACCOUNT_FOR_PAYMENTS;
}
if ($paymentmethod == 'stripe') {
$bankaccountid = $conf->global->STRIPE_BANK_ACCOUNT_FOR_PAYMENTS;
}
@ -1323,7 +1282,7 @@ abstract class CommonInvoice extends CommonObject
$error++;
$errorforinvoice++;
} else {
$postactionmessages[] = 'Bank transaction of payment created (by doTakePaymentStripeForThirdparty)';
$postactionmessages[] = 'Bank transaction of payment created (by makeStripeSepaRequest)';
}
} else {
$postactionmessages[] = 'Setup of bank account to use in module ' . $paymentmethod . ' was not set. No way to record the payment.';
@ -1334,13 +1293,13 @@ abstract class CommonInvoice extends CommonObject
}
if ($ispostactionok < 1) {
$description = 'Stripe payment OK (' . $charge->id . ' - ' . $amounttopay . ' ' . $conf->currency . ') but post action KO from doTakePaymentStripeForThirdparty: ' . $FULLTAG;
$description = 'Stripe payment OK (' . $charge->id . ' - ' . $amounttopay . ' ' . $conf->currency . ') but post action KO from makeStripeSepaRequest: ' . $FULLTAG;
} else {
$description = 'Stripe payment+post action OK (' . $charge->id . ' - ' . $amounttopay . ' ' . $conf->currency . ') from doTakePaymentStripeForThirdparty: ' . $FULLTAG;
$description = 'Stripe payment+post action OK (' . $charge->id . ' - ' . $amounttopay . ' ' . $conf->currency . ') from makeStripeSepaRequest: ' . $FULLTAG;
}
}
$object = $invoice;
$object = $this;
// Send emails
$labeltouse = 'InvoicePaymentSuccess';
@ -1366,8 +1325,8 @@ abstract class CommonInvoice extends CommonObject
} else {
$error++;
$errorforinvoice++;
dol_syslog("No card or payment method found for this stripe customer " . $customer->id, LOG_WARNING);
$this->errors[] = 'Failed to get card | payment method for stripe customer = ' . $customer->id;
dol_syslog("No direct debit payment method found for this stripe customer " . $customer->id, LOG_WARNING);
$this->errors[] = 'Failed to get direct debit payment method for stripe customer = ' . $customer->id;
$labeltouse = 'InvoicePaymentFailure';
$sendemailtocustomer = 1;
@ -1380,7 +1339,7 @@ abstract class CommonInvoice extends CommonObject
$stripefailuremessage = 'Failed to find or use the payment mode - no credit card defined for the customer account';
$postactionmessages[] = $description . ' (' . $stripearrayofkeys['publishable_key'] . ')';
$object = $invoice;
$object = $this;
$actioncode = 'PAYMENT_STRIPE_KO';
$extraparams = '';
@ -1394,7 +1353,7 @@ abstract class CommonInvoice extends CommonObject
$stripefailurecode = '';
$stripefailuremessage = '';
$object = $invoice;
$object = $this;
$actioncode = '';
$extraparams = '';
@ -1421,12 +1380,13 @@ abstract class CommonInvoice extends CommonObject
$stripefailuremessage = 'Failed to find or use your payment mode (no payment mode for this customer id)';
$postactionmessages = [];
$object = $invoice;
$object = $this;
$actioncode = 'PAYMENT_STRIPE_KO';
$extraparams = '';
}
/*
// Send email + create action after
if ($sendemailtocustomer && $labeltouse) {
dol_syslog("* Send email with result of payment - " . $labeltouse);
@ -1537,6 +1497,7 @@ abstract class CommonInvoice extends CommonObject
}
}
}
*/
if ($description) {
dol_syslog("* Record event for payment result - " . $description);
@ -1588,18 +1549,12 @@ abstract class CommonInvoice extends CommonObject
$this->errors[] = "Remain to pay is null for the invoice " . $this->id . " " . $this->ref . ". Why is the invoice not classified 'Paid' ?";
}
$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_demande(";
$sql .= "fk_facture, ";
$sql .= " amount, date_demande, fk_user_demande, ext_payment_id, ext_payment_site, sourcetype, entity)";
$sql .= " VALUES (".$this->id;
$sql .= ",".((float) price2num($amount));
$sql .= ",'".$this->db->idate($now)."'";
$sql .= ",".((int) $fuser->id);
$sql .= ",'".$this->db->escape($stripe_id)."'";
$sql .= ",'".$this->db->escape($stripe_uri)."'";
$sql .= ",'".$this->db->escape($sourcetype)."'";
$sql .= ",".$conf->entity;
$sql .= ")";
// TODO Create a prelevement_bon ?
// For the moment no
// We must update the direct debit payment request as "done"
$sql = "UPDATE".MAIN_DB_PREFIX."prelevement_demande SET traite = 1, date_traite = '".$this->db->idate(dol_now())."'";
$sql .= "WHERE rowid = ".((int) $did);
dol_syslog(get_class($this)."::makeStripeSepaRequest", LOG_DEBUG);
$resql = $this->db->query($sql);

View File

@ -16,6 +16,7 @@
* Copyright (C) 2018 Josep Lluís Amador <joseplluis@lliuretic.cat>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2021 Grégory Blémand <gregory.blemand@atm-consulting.fr>
* Copyright (C) 2023 Lenin Rivas <lenin.rivas777@gmail.com>
*
* 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
@ -5740,15 +5741,16 @@ abstract class CommonObject
*
* @param string $fieldname Name of field
* @param string $alternatevalue Alternate value to use
* @param string $type Type of data
* @return string|string[] Default value (can be an array if the GETPOST return an array)
**/
public function getDefaultCreateValueFor($fieldname, $alternatevalue = null)
public function getDefaultCreateValueFor($fieldname, $alternatevalue = null, $type = 'alphanohtml')
{
global $conf, $_POST;
// If param here has been posted, we use this value first.
if (GETPOSTISSET($fieldname)) {
return GETPOST($fieldname, 'alphanohtml', 3);
return GETPOST($fieldname, $type, 3);
}
if (isset($alternatevalue)) {
@ -8581,21 +8583,21 @@ abstract class CommonObject
/**
* Show photos of an object (nbmax maximum), into several columns
*
* @param string $modulepart 'product', 'ticket', ...
* @param string $sdir Directory to scan (full absolute path)
* @param int $size 0=original size, 1='small' use thumbnail if possible
* @param int $nbmax Nombre maximum de photos (0=pas de max)
* @param int $nbbyrow Number of image per line or -1 to use div separator or 0 to use no separator. Used only if size=1 or 'small'.
* @param int $showfilename 1=Show filename
* @param int $showaction 1=Show icon with action links (resize, delete)
* @param int $maxHeight Max height of original image when size='small' (so we can use original even if small requested). If 0, always use 'small' thumb image.
* @param int $maxWidth Max width of original image when size='small'
* @param int $nolink Do not add a href link to view enlarged imaged into a new tab
* @param int $notitle Do not add title tag on image
* @param int $usesharelink Use the public shared link of image (if not available, the 'nophoto' image will be shown instead)
* @return string Html code to show photo. Number of photos shown is saved in this->nbphoto
* @param string $modulepart 'product', 'ticket', ...
* @param string $sdir Directory to scan (full absolute path)
* @param int $size 0=original size, 1='small' use thumbnail if possible
* @param int $nbmax Nombre maximum de photos (0=pas de max)
* @param int $nbbyrow Number of image per line or -1 to use div separator or 0 to use no separator. Used only if size=1 or 'small'.
* @param int $showfilename 1=Show filename
* @param int $showaction 1=Show icon with action links (resize, delete)
* @param int $maxHeight Max height of original image when size='small' (so we can use original even if small requested). If 0, always use 'small' thumb image.
* @param int $maxWidth Max width of original image when size='small'
* @param int $nolink Do not add a href link to view enlarged imaged into a new tab
* @param int|string $overwritetitle Do not add title tag on image
* @param int $usesharelink Use the public shared link of image (if not available, the 'nophoto' image will be shown instead)
* @return string Html code to show photo. Number of photos shown is saved in this->nbphoto
*/
public function show_photos($modulepart, $sdir, $size = 0, $nbmax = 0, $nbbyrow = 5, $showfilename = 0, $showaction = 0, $maxHeight = 120, $maxWidth = 160, $nolink = 0, $notitle = 0, $usesharelink = 0)
public function show_photos($modulepart, $sdir, $size = 0, $nbmax = 0, $nbbyrow = 5, $showfilename = 0, $showaction = 0, $maxHeight = 120, $maxWidth = 160, $nolink = 0, $overwritetitle = 0, $usesharelink = 0)
{
// phpcs:enable
global $conf, $user, $langs;
@ -8698,8 +8700,12 @@ abstract class CommonObject
// Si fichier vignette disponible et image source trop grande, on utilise la vignette, sinon on utilise photo origine
$alt = $langs->transnoentitiesnoconv('File').': '.$relativefile;
$alt .= ' - '.$langs->transnoentitiesnoconv('Size').': '.$imgarray['width'].'x'.$imgarray['height'];
if ($notitle) {
$alt = '';
if ($overwritetitle) {
if (is_numeric($overwritetitle)) {
$alt = '';
} else {
$alt = $overwritetitle;
}
}
$addphotorefcss = 1;

View File

@ -144,10 +144,12 @@ class DolGeoIP
return '';
}
} else {
if (!function_exists('geoip_country_code_by_addr_v6')) {
if (function_exists('geoip_country_code_by_addr_v6')) {
return strtolower(geoip_country_code_by_addr_v6($this->gi, $ip));
} elseif (function_exists('geoip_country_code_by_name_v6')) {
return strtolower(geoip_country_code_by_name_v6($this->gi, $ip));
}
return strtolower(geoip_country_code_by_addr_v6($this->gi, $ip));
return '';
}
}
}

View File

@ -162,84 +162,44 @@ class HookManager
//dol_syslog(get_class($this).'::executeHooks method='.$method." action=".$action." context=".$parameters['context']);
// Define type of hook ('output' or 'addreplace').
// TODO Remove hooks with type 'output' (exemple getNomUrl). All hooks must be converted into 'addreplace' hooks.
$hooktype = 'output';
if (in_array(
$method,
array(
'addCalendarChoice',
'addCalendarView',
'addMoreActionsButtons',
'addMoreMassActions',
'addSearchEntry',
'addStatisticLine',
'addSectionECMAuto',
'checkSecureAccess',
'createDictionaryFieldlist',
'editDictionaryFieldlist',
'getFormMail',
'deleteFile',
'doActions',
'doMassActions',
'formatEvent',
'formConfirm',
'formCreateThirdpartyOptions',
'formObjectOptions',
'formattachOptions',
'formBuilddocLineOptions',
'formatNotificationMessage',
'formConfirm',
'getAccessForbiddenMessage',
'getDirList',
'hookGetEntity',
'getFormMail',
'getFormatedCustomerRef',
'getFormatedSupplierRef',
'getIdProfUrl',
'getInputIdProf',
'isPaymentOK',
'llxFooter',
'menuDropdownQuickaddItems',
'menuLeftMenuItems',
'moveUploadedFile',
'moreHtmlStatus',
'pdf_build_address',
'pdf_writelinedesc',
'pdf_getlinenum',
'pdf_getlineref',
'pdf_getlineref_supplier',
'pdf_getlinevatrate',
'pdf_getlineupexcltax',
'pdf_getlineupwithtax',
'pdf_getlineqty',
'pdf_getlineqty_asked',
'pdf_getlineqty_shipped',
'pdf_getlineqty_keeptoship',
'pdf_getlineunit',
'pdf_getlineremisepercent',
'pdf_getlineprogress',
'pdf_getlinetotalexcltax',
'pdf_getlinetotalwithtax',
'paymentsupplierinvoices',
'printAddress',
'printEmail',
'printSearchForm',
'printTabsHead',
'printObjectLine',
'printObjectSubLine',
'restrictedArea',
'sendMail',
'sendMailAfter',
'showOptionals',
'showLinkToObjectBlock',
'setContentSecurityPolicy',
'setHtmlTitle',
'completeTabsHead',
'formDolBanner',
'displayMarginInfos',
)
)) {
$hooktype = 'addreplace';
$hooktype = 'addreplace';
// TODO Remove hooks with type 'output' (exemple createFrom). All hooks must be converted into 'addreplace' hooks.
if (in_array($method, array(
'createFrom',
'dashboardMembers',
'dashboardEmailings',
'dashboardPropals',
'dashboardPropals',
'dashboardCommercials',
'dashboardOrders',
'dashboardSpecialBills',
'dashboardAccountancy',
'dashboardContracts',
'dashboardDonation',
'dashboardWarehouseSendings',
'dashboardExpenseReport',
'dashboardInterventions',
'dashboardOrdersSuppliers',
'dashboardHRM',
'dashboardMRP',
'dashboardOpensurvey',
'dashboardWarehouse',
'dashboardProductServices',
'dashboardActivities',
'dashboardProjects',
'dashboardWarehouseReceptions',
'dashboardThirdparties',
'dashboardSupplierProposal',
'dashboardTickets',
'dashboardUsersGroups',
'insertExtraHeader',
'insertExtraFooter',
'printLeftBlock',
'formAddObjectLine',
'formBuilddocOption',
'showSocinfoOnPrint'
))) {
$hooktype = 'output';
}
// Init return properties

View File

@ -2137,10 +2137,7 @@ class Form
$out .= ' selected';
}
$out .= ' data-html="';
$outhtml = '';
// if (!empty($obj->photo)) {
$outhtml .= $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1).' ';
// }
$outhtml = $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1).' ';
if ($showstatus >= 0 && $obj->status == 0) {
$outhtml .= '<strike class="opacitymediumxxx">';
}
@ -2344,11 +2341,7 @@ class Form
}
}
// mode=1 means customers products
$urloption = 'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=1&status='.$status.'&status_purchase='.$status_purchase.'&finished='.$finished.'&hidepriceinlabel='.$hidepriceinlabel.'&warehousestatus='.$warehouseStatus;
//Price by customer
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES) && !empty($socid)) {
$urloption .= '&socid='.$socid;
}
$urloption = ($socid > 0 ? 'socid='.$socid.'&' : '').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=1&status='.$status.'&status_purchase='.$status_purchase.'&finished='.$finished.'&hidepriceinlabel='.$hidepriceinlabel.'&warehousestatus='.$warehouseStatus;
$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
if (isModEnabled('variants') && is_array($selected_combinations)) {
@ -3247,6 +3240,7 @@ class Form
// mode=2 means suppliers products
$urloption = ($socid > 0 ? 'socid='.$socid.'&' : '').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=2&status='.$status.'&finished='.$finished.'&alsoproductwithnosupplierprice='.$alsoproductwithnosupplierprice;
print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
print ($hidelabel ? '' : $langs->trans("RefOrLabel").' : ').'<input type="text" class="minwidth300" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.$placeholder.'"' : '').'>';
} else {
print $this->select_produits_fournisseurs_list($socid, $selected, $htmlname, $filtertype, $filtre, '', $status, 0, 0, $alsoproductwithnosupplierprice, $morecss, 0, $placeholder);

View File

@ -36,7 +36,7 @@ class FormAdmin
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param DoliDB|null $db Database handler
*/
public function __construct($db)
{

View File

@ -449,6 +449,15 @@ class FormFile
$titletoshow = ($title == 'none' ? '' : $title);
}
$submodulepart = $modulepart;
// modulepart = 'nameofmodule' or 'nameofmodule:NameOfObject'
$tmp = explode(':', $modulepart);
if (!empty($tmp[1])) {
$modulepart = $tmp[0];
$submodulepart = $tmp[1];
}
// Show table
if ($genallowed) {
$modellist = array();
@ -648,15 +657,6 @@ class FormFile
$modellist = ModelePDFUserGroup::liste_modeles($this->db);
}
} else {
$submodulepart = $modulepart;
// modulepart = 'nameofmodule' or 'nameofmodule:NameOfObject'
$tmp = explode(':', $modulepart);
if (!empty($tmp[1])) {
$modulepart = $tmp[0];
$submodulepart = $tmp[1];
}
// For normalized standard modules
$file = dol_buildpath('/core/modules/'.$modulepart.'/modules_'.strtolower($submodulepart).'.php', 0);
if (file_exists($file)) {

View File

@ -237,7 +237,7 @@ abstract class Stats
/**
* @param int $year year number
* @return int value
* @return array array of values
*/
protected abstract function getAverageByMonth($year);

View File

@ -932,8 +932,10 @@ class Translate
$fonc = 'numberwords';
if (file_exists($newdir.'/functions_'.$fonc.'.lib.php')) {
include_once $newdir.'/functions_'.$fonc.'.lib.php';
$newnumber = numberwords_getLabelFromNumber($this, $number, $isamount);
break;
if (function_exists('numberwords_getLabelFromNumber')) {
$newnumber = numberwords_getLabelFromNumber($this, $number, $isamount);
break;
}
}
}

View File

@ -34,6 +34,9 @@ class Utils
*/
public $db;
public $error;
public $errors;
public $output; // Used by Cron method to return message
public $result; // Used by Cron method to return data

View File

@ -31,7 +31,7 @@
*/
function encode($string)
{
return str_replace(";", "\;", (dol_quoted_printable_encode(utf8_decode($string))));
return str_replace(";", "\;", (dol_quoted_printable_encode($string)));
}
@ -117,22 +117,25 @@ class vCard
if ($type != "") {
$key .= ";".$type;
}
$key .= ";".$this->encoding;
$this->properties[$key] = 'VALUE=uri:tel:'.encode($number);
$key .= ";VALUE=uri";
//$key .= ";".$this->encoding;
$this->properties[$key] = 'tel:'.$number;
}
/**
* mise en forme de la photo
* warning NON TESTE !
*
* @param string $type Type 'image/gif'
* @param string $type Type 'image/jpeg' or 'JPEG'
* @param string $photo Photo
* @return void
*/
public function setPhoto($type, $photo)
{
// $type = "GIF" | "JPEG"
$this->properties["PHOTO;MEDIATYPE=$type;ENCODING=BASE64"] = base64_encode($photo);
//$this->properties["PHOTO;MEDIATYPE=$type;ENCODING=BASE64"] = base64_encode($photo);
$this->properties["PHOTO;MEDIATYPE=$type"] = $photo; // must be url of photo
//$this->properties["PHOTO;TYPE=$type;ENCODING=BASE64"] = base64_encode($photo); // must be content of image
}
/**
@ -152,13 +155,14 @@ class vCard
* @param string $family Family name
* @param string $first First name
* @param string $additional Additional (e.g. second name, nick name)
* @param string $prefix Prefix (e.g. "Mr.", "Ms.", "Prof.")
* @param string $prefix Title prefix (e.g. "Mr.", "Ms.", "Prof.")
* @param string $suffix Suffix (e.g. "sen." for senior, "jun." for junior)
* @return void
*/
public function setName($family = "", $first = "", $additional = "", $prefix = "", $suffix = "")
{
$this->properties["N;".$this->encoding] = encode($family).";".encode($first).";".encode($additional).";".encode($prefix).";".encode($suffix);
//$this->properties["N;".$this->encoding] = encode($family).";".encode($first).";".encode($additional).";".encode($prefix).";".encode($suffix);
$this->properties["N"] = encode($family).";".encode($first).";".encode($additional).";".encode($prefix).";".encode($suffix);
$this->filename = "$first%20$family.vcf";
if (empty($this->properties["FN"])) {
$this->setFormattedName(trim("$prefix $first $additional $family $suffix"));
@ -173,12 +177,13 @@ class vCard
*/
public function setBirthday($date)
{
// $date format is YYYY-MM-DD - RFC 2425 and RFC 2426
$this->properties["BDAY"] = dol_print_date($date, 'dayrfc');
// $date format is YYYY-MM-DD - RFC 2425 and RFC 2426 for vcard v3
// $date format is YYYYMMDD or ISO8601 for vcard v4
$this->properties["BDAY"] = dol_print_date($date, 'dayxcard');
}
/**
* mise en forme de l'adresse
* Address
*
* @param string $postoffice Postoffice
* @param string $extended Extended
@ -191,7 +196,7 @@ class vCard
* @param string $label Label
* @return void
*/
public function setAddress($postoffice = "", $extended = "", $street = "", $city = "", $region = "", $zip = "", $country = "", $type = "HOME", $label = '')
public function setAddress($postoffice = "", $extended = "", $street = "", $city = "", $region = "", $zip = "", $country = "", $type = "", $label = "")
{
// $type may be DOM | INTL | POSTAL | PARCEL | HOME | WORK or any combination of these: e.g. "WORK;PARCEL;POSTAL"
$key = "ADR";
@ -202,7 +207,7 @@ class vCard
$key .= ';LABEL="'.encode($label).'"';
}
$key .= ";".$this->encoding;
$this->properties[$key] = ";".encode($extended).";".encode($street).";".encode($city).";".encode($region).";".encode($zip).";".encode($country);
$this->properties[$key] = encode($postoffice).";".encode($extended).";".encode($street).";".encode($city).";".encode($region).";".encode($zip).";".encode($country);
//if ($this->properties["LABEL;".$type.";".$this->encoding] == '') {
//$this->setLabel($postoffice, $extended, $street, $city, $region, $zip, $country, $type);
@ -210,7 +215,7 @@ class vCard
}
/**
* mise en forme du label
* Address (old standard)
*
* @param string $postoffice Postoffice
* @param string $extended Extended
@ -221,6 +226,7 @@ class vCard
* @param string $country Country
* @param string $type Type
* @return void
* @deprecated
*/
public function setLabel($postoffice = "", $extended = "", $street = "", $city = "", $region = "", $zip = "", $country = "", $type = "HOME")
{
@ -309,7 +315,7 @@ class vCard
*/
public function setProdId($prodid)
{
$this->properties["PRODID;".$this->encoding] = encode($prodid);
$this->properties["PRODID"] = encode($prodid);
}
@ -321,7 +327,7 @@ class vCard
*/
public function setUID($uid)
{
$this->properties["UID;".$this->encoding] = encode($uid);
$this->properties["UID"] = encode($uid);
}
@ -353,9 +359,10 @@ class vCard
$text .= "VERSION:4.0\r\n"; // With V4, all encoding are UTF-8
//$text.= "VERSION:2.1\r\n";
foreach ($this->properties as $key => $value) {
$text .= $key.":".$value."\r\n";
$newkey = preg_replace('/-.*$/', '', $key); // remove suffix -twitter, -facebook, ...
$text .= $newkey.":".$value."\r\n";
}
$text .= "REV:".date("Y-m-d")."T".date("H:i:s")."Z\r\n";
$text .= "REV:".date("Ymd")."T".date("His")."Z\r\n";
//$text .= "MAILER: Dolibarr\r\n";
$text .= "END:VCARD\r\n";
return $text;
@ -373,13 +380,15 @@ class vCard
/**
* Return a VCARD string
* See RFC https://datatracker.ietf.org/doc/html/rfc6350
*
* @param Object $object Object (User, Contact)
* @param Societe $company Company
* @param Translate $langs Lang object
* @return string String
* @param Object $object Object (User or Contact)
* @param Societe|null $company Company. May be null
* @param Translate $langs Lang object
* @param string $urlphoto Full public URL of photo
* @return string String
*/
public function buildVCardString($object, $company, $langs)
public function buildVCardString($object, $company, $langs, $urlphoto = '')
{
global $dolibarr_main_instance_unique_id;
@ -389,70 +398,136 @@ class vCard
$this->setName($object->lastname, $object->firstname, "", $object->civility_code, "");
$this->setFormattedName($object->getFullName($langs, 1));
$this->setPhoneNumber($object->office_phone, "TYPE=WORK,VOICE");
$this->setPhoneNumber($object->personal_mobile, "TYPE=HOME,VOICE");
$this->setPhoneNumber($object->user_mobile, "TYPE=CELL,VOICE");
$this->setPhoneNumber($object->office_fax, "TYPE=WORK,FAX");
$country = $object->country_code ? $object->country : '';
$this->setAddress("", "", $object->address, $object->town, $object->state, $object->zip, $country, "TYPE=WORK");
//$this->setLabel("", "", $object->address, $object->town, $object->state, $object->zip, $country, "TYPE=WORK");
$this->setEmail($object->email, "TYPE=WORK");
$this->setNote($object->note_public);
$this->setTitle($object->job);
// For user, type=home
// For contact, this is not defined
$this->setURL($object->url, "TYPE=HOME");
if (is_object($company)) {
$this->setURL($company->url, "TYPE=WORK");
if (!$object->office_phone) {
$this->setPhoneNumber($company->phone, "TYPE=WORK,VOICE");
}
if (!$object->office_fax) {
$this->setPhoneNumber($company->fax, "TYPE=WORK,FAX");
}
if (!$object->zip) {
$this->setAddress("", "", $company->address, $company->town, $company->state, $company->zip, $company->country, "TYPE=WORK");
}
// when company e-mail is empty, use only user e-mail
if (empty(trim($company->email))) {
// was set before, don't set twice
} elseif (empty(trim($object->email))) {
// when user e-mail is empty, use only company e-mail
$this->setEmail($company->email, "TYPE=WORK");
} else {
$tmpuser2 = explode("@", trim($object->email));
$tmpcompany = explode("@", trim($company->email));
if (strtolower(end($tmpuser2)) == strtolower(end($tmpcompany))) {
// when e-mail domain of user and company are the same, use user e-mail at first (and company e-mail at second)
$this->setEmail($object->email, "TYPE=WORK");
// support by Microsoft Outlook (2019 and possible earlier)
$this->setEmail($company->email, '');
} else {
// when e-mail of user and company complete different use company e-mail at first (and user e-mail at second)
$this->setEmail($company->email, "TYPE=WORK");
// support by Microsoft Outlook (2019 and possible earlier)
$this->setEmail($object->email, '');
}
}
// Si user lie a un tiers non de type "particulier"
if ($company->typent_code != 'TE_PRIVATE') {
$this->setOrg($company->name);
if ($urlphoto) {
$mimetype = dol_mimetype($urlphoto);
if ($mimetype) {
$this->setPhoto($mimetype, $urlphoto);
}
}
// Personal informations
$this->setPhoneNumber($object->personal_mobile, "TYPE=HOME,VOICE");
if ($object->office_phone) {
$this->setPhoneNumber($object->office_phone, "TYPE=WORK,VOICE");
}
/* disabled
if ($object->personal_mobile) {
$this->setPhoneNumber($object->personal_mobile, "TYPE=CELL,VOICE");
}*/
if ($object->user_mobile) {
$this->setPhoneNumber($object->user_mobile, "TYPE=CELL,VOICE");
}
if ($object->office_fax) {
$this->setPhoneNumber($object->office_fax, "TYPE=WORK,FAX");
}
if (!empty($object->socialnetworks)) {
foreach ($object->socialnetworks as $key => $val) {
$urlsn = '';
if ($key == 'linkedin') {
if (!preg_match('/^http/', $val)) {
$urlsn = 'https://www.'.$key.'.com/company/'.urlencode($val);
} else {
$urlsn = $val;
}
} elseif ($key == 'youtube') {
if (!preg_match('/^http/', $val)) {
$urlsn = 'https://www.'.$key.'.com/user/'.urlencode($val);
} else {
$urlsn = $val;
}
} else {
if (!preg_match('/^http/', $val)) {
$urlsn = 'https://www.'.$key.'.com/'.urlencode($val);
} else {
$urlsn = $val;
}
}
if ($urlsn) {
$this->properties["SOCIALPROFILE;TYPE=WORK-".$key] = $key.':'.$urlsn;
}
}
}
$country = $object->country_code ? $object->country : '';
if ($object->address || $object->town || $object->state || $object->zip || $object->country) {
$this->setAddress("", "", $object->address, $object->town, $object->state, $object->zip, $country, "");
//$this->setLabel("", "", $object->address, $object->town, $object->state, $object->zip, $country, "TYPE=HOME");
}
if ($object->email) {
$this->setEmail($object->email, "TYPE=WORK");
}
/* disabled
if ($object->personal_email) {
$this->setEmail($object->personal_email, "TYPE=HOME");
} */
if ($object->note_public) {
$this->setNote($object->note_public);
}
if ($object->job) {
$this->setTitle($object->job);
}
// For user, $object->url is not defined
// For contact, $object->url is not defined
if (!empty($object->url)) {
$this->setURL($object->url, "");
}
if (is_object($company)) {
// Si user linked to a thirdparty and not a physical people
if ($company->typent_code != 'TE_PRIVATE') {
$this->setOrg($company->name);
}
$this->setURL($company->url, "");
if ($company->phone && $company->phone != $object->office_phone) {
$this->setPhoneNumber($company->phone, "TYPE=WORK,VOICE");
}
if ($company->fax && $company->fax != $object->office_fax) {
$this->setPhoneNumber($company->fax, "TYPE=WORK,FAX");
}
if ($company->address || $company->town || $company->state || $company->zip || $company->country) {
$this->setAddress("", "", $company->address, $company->town, $company->state, $company->zip, $company->country, "TYPE=WORK");
}
if ($company->email && $company->email != $object->email) {
$this->setEmail($company->email, "TYPE=WORK");
}
/*
if (!empty($company->socialnetworks)) {
foreach ($company->socialnetworks as $key => $val) {
$urlsn = '';
if ($key == 'linkedin') {
if (!preg_match('/^http/', $val)) {
$urlsn = 'https://www.'.$key.'.com/company/'.urlencode($val);
} else {
$urlsn = $val;
}
} elseif ($key == 'youtube') {
if (!preg_match('/^http/', $val)) {
$urlsn = 'https://www.'.$key.'.com/user/'.urlencode($val);
} else {
$urlsn = $val;
}
} else {
if (!preg_match('/^http/', $val)) {
$urlsn = 'https://www.'.$key.'.com/'.urlencode($val);
} else {
$urlsn = $val;
}
}
if ($urlsn) {
$this->properties["socialProfile;type=".$key] = $urlsn;
}
}
}
*/
}
// Birthday
if ($object->birth) {
$this->setBirthday($object->birth);
}

View File

@ -1084,11 +1084,12 @@ function purgeSessions($mysessionid)
/**
* Enable a module
*
* @param string $value Name of module to activate
* @param int $withdeps Activate/Disable also all dependencies
* @return array array('nbmodules'=>nb modules activated with success, 'errors=>array of error messages, 'nbperms'=>Nb permission added);
* @param string $value Name of module to activate
* @param int $withdeps Activate/Disable also all dependencies
* @param int $noconfverification Remove verification of $conf variable for module
* @return array array('nbmodules'=>nb modules activated with success, 'errors=>array of error messages, 'nbperms'=>Nb permission added);
*/
function activateModule($value, $withdeps = 1)
function activateModule($value, $withdeps = 1, $noconfverification = 0)
{
global $db, $langs, $conf, $mysoc;
@ -1144,8 +1145,10 @@ function activateModule($value, $withdeps = 1)
}
$const_name = $objMod->const_name;
if (!empty($conf->global->$const_name)) {
return $ret;
if ($noconfverification == 0) {
if (!empty($conf->global->$const_name)) {
return $ret;
}
}
$result = $objMod->init(); // Enable module

View File

@ -957,7 +957,13 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl
$search_poste = GETPOST("search_poste", 'alpha');
$search_note_private = GETPOST('search_note_private', 'alphanohtml');
$search_roles = GETPOST("search_roles", 'array');
$search_birthday_dtstart = GETPOST("search_birthday_dtstart", 'alpha');
$search_birthday_dtend = GETPOST("search_birthday_dtend", 'alpha');
if ($search_birthday_dtstart != '' || $search_birthday_dtend != '') {
$search_birthday_dtstart = dol_mktime(0, 0, 0, GETPOST('search_birthday_dtstartmonth', 'int'), GETPOST('search_birthday_dtstartday', 'int'), GETPOST('search_birthday_dtstartyear', 'int'));
$search_birthday_dtend = dol_mktime(23, 59, 59, GETPOST('search_birthday_dtendmonth', 'int'), GETPOST('search_birthday_dtendday', 'int'), GETPOST('search_birthday_dtendyear', 'int'));
}
$socialnetworks = getArrayOfSocialNetworks();
$searchAddressPhoneDBFields = array(
@ -1007,6 +1013,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl
'address' =>array('type'=>'varchar(128)', 'label'=>'Address', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>3, 'index'=>1, 'position'=>30),
'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>(!getDolGlobalInt('MAIN_LIST_HIDE_PRIVATE_NOTES')), 'visible'=>3, 'position'=>35),
'role' =>array('type'=>'checkbox', 'label'=>'Role', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>4, 'index'=>1, 'position'=>40),
'birthday' =>array('type'=>'date', 'label'=>'Birthday', 'enabled'=>1, 'visible'=>-1, 'notnull'=> 0, 'position'=>45),
'statut' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>50, 'arrayofkeyval'=>array(0=>$contactstatic->LibStatut(0, 1), 1=>$contactstatic->LibStatut(1, 1))),
);
@ -1018,6 +1025,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl
't.address'=>array('label'=>(empty($conf->dol_optimize_smallscreen) ? $langs->trans("Address").' / '.$langs->trans("Phone").' / '.$langs->trans("Email") : $langs->trans("Address")), 'checked'=>1, 'position'=>30),
't.note_private' => array('label' => 'NotePrivate', 'checked' => 0, 'position'=>35),
'sc.role'=>array('label'=>"ContactByDefaultFor", 'checked'=>1, 'position'=>40),
't.birthday'=>array('label'=>"Birthday", 'checked'=>0, 'position'=>45),
't.statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>50, 'class'=>'center'),
);
// Extra fields
@ -1052,6 +1060,8 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl
$search_address = '';
$search_poste = '';
$search_note_private = '';
$search_birthday_dtstart = '';
$search_birthday_dtend = '';
$search = array();
$search_array_options = array();
@ -1111,6 +1121,9 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl
if ($search_note_private != '') {
$param .= '&search_note_private='.urlencode($search_note_private);
}
if ($search_birthday != '') {
$param .= '&search_birthday='.urlencode($search_birthday);
}
if ($optioncss != '') {
$param .= '&optioncss='.urlencode($optioncss);
}
@ -1120,7 +1133,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
$sql = "SELECT t.rowid, t.entity, t.lastname, t.firstname, t.fk_pays as country_id, t.civility, t.poste, t.phone as phone_pro, t.phone_mobile, t.phone_perso, t.fax, t.email, t.socialnetworks, t.statut, t.photo,";
$sql .= " t.civility as civility_id, t.address, t.zip, t.town";
$sql .= " t.civility as civility_id, t.address, t.zip, t.town, t.birthday";
$sql .= ", t.note_private";
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as t";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople_extrafields as ef on (t.rowid = ef.fk_object)";
@ -1144,6 +1157,12 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl
if ($search_note_private) {
$sql .= natural_search('t.note_private', $search_note_private);
}
if ($search_birthday_dtstart != '') {
$sql .= " AND t.birthday >= '".$db->idate($search_birthday_dtstart)."'";
}
if ($search_birthday_dtend != '') {
$sql .= " AND t.birthday <= '".$db->idate($search_birthday_dtend)."'";
}
if (count($search_roles) > 0) {
$sql .= " AND t.rowid IN (SELECT sc.fk_socpeople FROM ".MAIN_DB_PREFIX."societe_contacts as sc WHERE sc.fk_c_type_contact IN (".$db->sanitize(implode(',', $search_roles))."))";
}
@ -1188,6 +1207,13 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl
print $form->selectarray('search_status', array('-1'=>'', '0'=>$contactstatic->LibStatut(0, 1), '1'=>$contactstatic->LibStatut(1, 1)), $search_status, 0, 0, 0, '', 0, 0, 0, '', 'onrightofpage');
} elseif (in_array($key, array('role'))) {
print $formcompany->showRoles("search_roles", $contactstatic, 'edit', $search_roles, 'minwidth200 maxwidth300');
} elseif (in_array($key, array('birthday'))) {
print '<div class="nowrap">';
print $form->selectDate($search_birthday_dtstart ? $search_birthday_dtstart : '', "search_birthday_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
print '</div>';
print '<div class="nowrap">';
print $form->selectDate($search_birthday_dtend ? $search_birthday_dtend : '', "search_birthday_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
print '</div>';
} else {
print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.(!empty($search[$key]) ? dol_escape_htmltag($search[$key]) : '').'">';
}
@ -1342,6 +1368,13 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl
print '</td>';
}
// Birthday
if (!empty($arrayfields['t.birthday']['checked'])) {
print '<td>';
print dol_print_date($obj->birthday);
print '</td>';
}
// Status
if (!empty($arrayfields['t.statut']['checked'])) {
print '<td class="center">'.$contactstatic->getLibStatut(5).'</td>';
@ -1384,7 +1417,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl
$i++;
}
} else {
$colspan = 1;
$colspan = 2;
foreach ($arrayfields as $key => $val) {
if (!empty($val['checked'])) {
$colspan++;

View File

@ -117,6 +117,7 @@ function getServerTimeZoneInt($refgmtdate = 'now')
* @param int $duration_unit Unit of added delay (d, m, y, w, h, i)
* @param int $ruleforendofmonth Change the behavior of PHP over data-interval, 0 or 1
* @return int New timestamp
* @see convertSecondToTime(), convertTimeToSeconds()
*/
function dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth = 0)
{

View File

@ -2058,13 +2058,13 @@ function dol_compress_file($inputfile, $outputfile, $mode = "gz", &$errorstring
dol_syslog("dol_compress_file mode=".$mode." inputfile=".$inputfile." outputfile=".$outputfile);
$data = implode("", file(dol_osencode($inputfile)));
if ($mode == 'gz') {
if ($mode == 'gz' && function_exists('gzencode')) {
$foundhandler = 1;
$compressdata = gzencode($data, 9);
} elseif ($mode == 'bz') {
} elseif ($mode == 'bz' && function_exists('bzcompress')) {
$foundhandler = 1;
$compressdata = bzcompress($data, 9);
} elseif ($mode == 'zstd') {
} elseif ($mode == 'zstd' && function_exists('zstd_compress')) {
$foundhandler = 1;
$compressdata = zstd_compress($data, 9);
} elseif ($mode == 'zip') {

View File

@ -116,7 +116,7 @@ function getDolUserString($key, $default = '', $tmpuser = null)
}
// return $conf->global->$key ?? $default;
return (string) (empty($tmpuser->conf->$key) ? $default : $$tmpuser->conf->$key);
return (string) (empty($tmpuser->conf->$key) ? $default : $tmpuser->conf->$key);
}
/**
@ -2122,14 +2122,14 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
$maxvisiblephotos = 1;
}
if ($showimage) {
$morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref">'.$object->show_photos('product', $conf->product->multidir_output[$entity], 'small', $maxvisiblephotos, 0, 0, 0, $width, 0).'</div>';
$morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref">'.$object->show_photos('product', $conf->product->multidir_output[$entity], 'small', $maxvisiblephotos, 0, 0, 0, 0, $width, 0, '').'</div>';
} else {
if (!empty($conf->global->PRODUCT_NODISPLAYIFNOPHOTO)) {
$nophoto = '';
$morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref"></div>';
} else { // Show no photo link
$nophoto = '/public/theme/common/nophoto.png';
$morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="No photo"'.($width ? ' style="width: '.$width.'px"' : '').' src="'.DOL_URL_ROOT.$nophoto.'"></div>';
$morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" title="'.dol_escape_htmltag($langs->trans("UploadAnImageToSeeAPhotoHere", $langs->transnoentitiesnoconv("Documents"))).'" alt="No photo"'.($width ? ' style="width: '.$width.'px"' : '').' src="'.DOL_URL_ROOT.$nophoto.'"></div>';
}
}
} elseif ($object->element == 'ticket') {
@ -3170,7 +3170,7 @@ function dol_print_socialnetworks($value, $cid, $socid, $type, $dictsocialnetwor
if (!empty($type)) {
$htmllink = '<div class="divsocialnetwork inline-block valignmiddle">';
// Use dictionary definition for picto $dictsocialnetworks[$type]['icon']
$htmllink .= '<span class="fa paddingright pictofixedwidth '.($dictsocialnetworks[$type]['icon'] ? $dictsocialnetworks[$type]['icon'] : 'fa-link').'"></span>';
$htmllink .= '<span class="fa pictofixedwidth '.($dictsocialnetworks[$type]['icon'] ? $dictsocialnetworks[$type]['icon'] : 'fa-link').'"></span>';
if ($type == 'skype') {
$htmllink .= dol_escape_htmltag($value);
$htmllink .= '&nbsp; <a href="skype:';
@ -6844,6 +6844,22 @@ function dol_mkdir($dir, $dataroot = '', $newmask = '')
}
/**
* Change mod of a file
*
* @param string $filepath Full file path
* @return void
*/
function dolChmod($filepath)
{
global $conf;
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($filepath, octdec($conf->global->MAIN_UMASK));
}
}
/**
* Return picto saying a field is required
*
@ -8047,7 +8063,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
$substitutionarray['__AMOUNT_TEXT__'] = is_object($object) ? dol_convertToWord($object->total_ttc, $outputlangs, '', true) : '';
$substitutionarray['__AMOUNT_TEXTCURRENCY__'] = is_object($object) ? dol_convertToWord($object->total_ttc, $outputlangs, $conf->currency, true) : '';
$substitutionarray['__AMOUNT_REMAIN__'] = is_object($object) ? $object->total_ttc - $already_payed_all : '';
$substitutionarray['__AMOUNT_REMAIN__'] = is_object($object) ? price2num($object->total_ttc - $already_payed_all, 'MT') : '';
$substitutionarray['__AMOUNT_VAT__'] = is_object($object) ? (isset($object->total_vat) ? $object->total_vat : $object->total_tva) : '';
$substitutionarray['__AMOUNT_VAT_TEXT__'] = is_object($object) ? (isset($object->total_vat) ? dol_convertToWord($object->total_vat, $outputlangs, '', true) : dol_convertToWord($object->total_tva, $outputlangs, '', true)) : '';
@ -11559,7 +11575,6 @@ function dolForgeCriteriaCallback($matches)
}
/**
* Get timeline icon
* @param ActionComm $actionstatic actioncomm
@ -12275,3 +12290,63 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = '', $n
print $out;
}
}
/**
* Helper function that combines values of a dolibarr DatePicker (such as Form::selectDate) for year, month, day (and
* optionally hour, minute, second) fields to return a timestamp.
*
* @param string $prefix Prefix used to build the date selector (for instance using Form::selectDate)
* @param string $hourTime 'getpost' to include hour, minute, second values from the HTTP request, 'XX:YY:ZZ' to set
* hour, minute, second respectively (for instance '23:59:59')
* @param string $gm Passed to dol_mktime
* @return int|string Date as a timestamp, '' or false if error
*/
function GETPOSTDATE($prefix, $hourTime = '', $gm = 'auto')
{
if ($hourTime === 'getpost') {
$hour = GETPOSTINT($prefix . 'hour');
$minute = GETPOSTINT($prefix . 'minute');
$second = GETPOSTINT($prefix . 'second');
} elseif (preg_match('/^(\d\d):(\d\d):(\d\d)$/', $hourTime, $m)) {
$hour = intval($m[1]);
$minute = intval($m[2]);
$second = intval($m[3]);
} else {
$hour = $minute = $second = 0;
}
// normalize out of range values
$hour = min($hour, 23);
$minute = min($minute, 59);
$second = min($second, 59);
return dol_mktime($hour, $minute, $second, GETPOSTINT($prefix . 'month'), GETPOSTINT($prefix . 'day'), GETPOSTINT($prefix . 'year'), $gm);
}
/**
* Helper function that combines values of a dolibarr DatePicker (such as Form::selectDate) for year, month, day (and
* optionally hour, minute, second) fields to return a a portion of URL reproducing the values from the current HTTP
* request.
*
* @param string $prefix Prefix used to build the date selector (for instance using Form::selectDate)
* @param int $timestamp If null, the timestamp will be created from request data
* @param bool $hourTime If timestamp is null, will be passed to GETPOSTDATE to construct the timestamp
* @param bool $gm If timestamp is null, will be passed to GETPOSTDATE to construct the timestamp
* @return string Portion of URL with query parameters for the specified date
*/
function buildParamDate($prefix, $timestamp = null, $hourTime = '', $gm = 'auto')
{
if ($timestamp === null) $timestamp = GETPOSTDATE($prefix, $hourTime, $gm);
$TParam = array(
$prefix . 'day' => intval(dol_print_date($timestamp, '%d')),
$prefix . 'month' => intval(dol_print_date($timestamp, '%m')),
$prefix . 'year' => intval(dol_print_date($timestamp, '%Y')),
);
if ($hourTime === 'getpost' || ($timestamp !== null && dol_print_date($timestamp, '%H:%M:%S') !== '00:00:00')) {
$TParam = array_merge($TParam, array(
$prefix . 'hour' => intval(dol_print_date($timestamp, '%H')),
$prefix . 'minute' => intval(dol_print_date($timestamp, '%M')),
$prefix . 'second' => intval(dol_print_date($timestamp, '%S'))
));
}
return '&' . http_build_query($TParam);
}

View File

@ -569,9 +569,10 @@ function project_admin_prepare_head()
* @param string $filterprogresscalc filter text
* @param string $showbilltime Add the column 'TimeToBill' and 'TimeBilled'
* @param array $arrayfields Array with displayed coloumn information
* @param array $arrayofselected Array with selected fields
* @return int Nb of tasks shown
*/
function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$taskrole, $projectsListId = '', $addordertick = 0, $projectidfortotallink = 0, $filterprogresscalc = '', $showbilltime = 0, $arrayfields = array())
function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$taskrole, $projectsListId = '', $addordertick = 0, $projectidfortotallink = 0, $filterprogresscalc = '', $showbilltime = 0, $arrayfields = array(), $arrayofselected = array())
{
global $user, $langs, $conf, $db, $hookmanager;
global $projectstatic, $taskstatic, $extrafields;
@ -910,6 +911,16 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
// Tick to drag and drop
print '<td class="tdlineupdown center"></td>';
// Action column
print '<td class="nowrap" align="center">';
$selected = 0;
if (in_array($lines[$i]->id, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb' . $lines[$i]->id . '" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $lines[$i]->id . '"' . ($selected ? ' checked="checked"' : '') . '>';
print '</td>';
print "</tr>\n";
if (!$showlineingray) {

View File

@ -52,12 +52,11 @@ function dol_getwebuser($mode)
* @param string $entitytotest Instance of data we must check
* @param array $authmode Array list of selected authentication mode array('http', 'dolibarr', 'xxx'...)
* @param string $context Context checkLoginPassEntity was created for ('api', 'dav', 'ws', '')
* @return string Login or ''
* @return string Login or '' or '--bad-login-validity--'
*/
function checkLoginPassEntity($usertotest, $passwordtotest, $entitytotest, $authmode, $context = '')
{
global $conf, $langs;
//global $dolauthmode; // To return authentication finally used
// Check parameters
if ($entitytotest == '') {
@ -100,10 +99,10 @@ function checkLoginPassEntity($usertotest, $passwordtotest, $entitytotest, $auth
if ($login && $login != '--bad-login-validity--') { // Login is successfull
$test = false; // To stop once at first login success
$conf->authmode = $mode; // This properties is defined only when logged to say what mode was successfully used
$dol_tz = GETPOST('tz');
/*$dol_tz = GETPOST('tz');
$dol_dst = GETPOST('dst');
$dol_screenwidth = GETPOST('screenwidth');
$dol_screenheight = GETPOST('screenheight');
$dol_screenheight = GETPOST('screenheight');*/
}
} else {
dol_syslog("Authentication KO - failed to load file '".$authfile."'", LOG_ERR);
@ -561,10 +560,11 @@ function getRandomPassword($generic = false, $replaceambiguouschars = null, $len
*
* @param string $htmlname HTML name of element to insert key into
* @param string $htmlnameofbutton HTML name of button
* @param int $generic 1=Return a generic pass, 0=Return a pass following setup rules
* @return string HTML javascript code to set a password
* @see getRandomPassword()
*/
function dolJSToSetRandomPassword($htmlname, $htmlnameofbutton = 'generate_token')
function dolJSToSetRandomPassword($htmlname, $htmlnameofbutton = 'generate_token', $generic = 1)
{
global $conf;
@ -572,10 +572,10 @@ function dolJSToSetRandomPassword($htmlname, $htmlnameofbutton = 'generate_token
print "\n".'<!-- Js code to suggest a security key --><script type="text/javascript">';
print '$(document).ready(function () {
$("#'.dol_escape_js($htmlnameofbutton).'").click(function() {
console.log("We click on the button to suggest a key");
console.log("We click on the button '.dol_escape_js($htmlnameofbutton).' to suggest a key. We will fill '.dol_escape_js($htmlname).'");
$.get( "'.DOL_URL_ROOT.'/core/ajax/security.php", {
action: \'getrandompassword\',
generic: true,
generic: '.($generic ? '1' : '0').',
token: \''.dol_escape_js(newToken()).'\'
},
function(result) {

View File

@ -423,6 +423,40 @@ function dolWebsiteOutput($content, $contenttype = 'html', $containerid = '')
print $content;
}
/**
* Increase the website counter of page access.
*
* @param int $websiteid ID of website
* @param string $websitepagetype Type of page ('blogpost', 'page', ...)
* @param int $websitepageid ID of page
* @return int <0 if KO, >0 if OK
*/
function dolWebsiteIncrementCounter($websiteid, $websitepagetype, $websitepageid)
{
if (!getDolGlobalInt('WEBSITE_PERF_DISABLE_COUNTERS')) {
//dol_syslog("dolWebsiteIncrementCounter websiteid=".$websiteid." websitepagetype=".$websitepagetype." websitepageid=".$websitepageid);
if (in_array($websitepagetype, array('blogpost', 'page'))) {
global $db;
$tmpnow = dol_getdate(dol_now('gmt'), true, 'gmt');
$sql = "UPDATE ".$db->prefix()."website SET ";
$sql .= " pageviews_total = pageviews_total + 1,";
$sql .= " pageviews_month = pageviews_month + 1,";
// if last access was done during previous month, we save pageview_month into pageviews_previous_month
$sql .= " pageviews_previous_month = ".$db->ifsql("lastaccess < '".$db->idate(dol_mktime(0, 0, 0, $tmpnow['month'], 1, $tmpnow['year'], 'gmt', 0), 'gmt')."'", 'pageviews_month', 'pageviews_previous_month').",";
$sql .= " lastaccess = '".$db->idate(dol_now('gmt'), 'gmt')."'";
$sql .= " WHERE rowid = ".((int) $websiteid);
$resql = $db->query($sql);
if (! $resql) {
return -1;
}
}
}
return 1;
}
/**
* Format img tags to introduce viewimage on img src.

View File

@ -271,7 +271,7 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage,
$tplcontent .= '</html>'."\n";
$tplcontent .= '<?php // BEGIN PHP'."\n";
$tplcontent .= '$tmp = ob_get_contents(); ob_end_clean(); dolWebsiteOutput($tmp, "html", '.$objectpage->id.');'."\n";
$tplcontent .= '$tmp = ob_get_contents(); ob_end_clean(); dolWebsiteOutput($tmp, "html", '.$objectpage->id.'); dolWebsiteIncrementCounter('.$object->id.', "'.$objectpage->type_container.'", '.$objectpage->id.');'."\n";
$tplcontent .= "// END PHP ?>\n";
//var_dump($filetpl);exit;

View File

@ -86,6 +86,10 @@ function check_authentication($authentication, &$error, &$errorcode, &$errorlabe
include_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
$login = checkLoginPassEntity($authentication['login'], $authentication['password'], $authentication['entity'], $authmode, 'ws');
if ($login === '--bad-login-validity--') {
$login = '';
}
if (empty($login)) {
$error++;
$errorcode = 'BAD_CREDENTIALS';

View File

@ -28,6 +28,7 @@
/**
* Check validity of user/password/entity
* If test is ko, reason must be filled into $_SESSION["dol_loginmesg"]
* Note: On critical error (hack attempt), we put a log "functions_dolibarr::check_user_password_dolibarr authentication KO"
*
* @param string $usertotest Login
* @param string $passwordtotest Password
@ -56,7 +57,7 @@ function check_user_password_dolibarr($usertotest, $passwordtotest, $entitytotes
$usernamecol2 = 'email';
$entitycol = 'entity';
$sql = "SELECT rowid, login, entity, pass, pass_crypted, datestartvalidity, dateendvalidity";
$sql = "SELECT rowid, login, entity, pass, pass_crypted, datestartvalidity, dateendvalidity, flagdelsessionsbefore";
$sql .= " FROM ".$table;
$sql .= " WHERE (".$usernamecol1." = '".$db->escape($usertotest)."'";
if (preg_match('/@/', $usertotest)) {
@ -74,16 +75,20 @@ function check_user_password_dolibarr($usertotest, $passwordtotest, $entitytotes
$obj = $db->fetch_object($resql);
if ($obj) {
$now = dol_now();
// Check date start validity
if ($obj->datestartvalidity && $db->jdate($obj->datestartvalidity) > $now) {
// Load translation files required by the page
$langs->loadLangs(array('main', 'errors'));
$_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("ErrorLoginDateValidity");
dol_syslog("functions_dolibarr::check_user_password_dolibarr bad datestart validity", LOG_WARNING);
return '--bad-login-validity--';
}
// Check date end validity
if ($obj->dateendvalidity && $db->jdate($obj->dateendvalidity) < dol_get_first_hour($now)) {
// Load translation files required by the page
$langs->loadLangs(array('main', 'errors'));
$_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("ErrorLoginDateValidity");
dol_syslog("functions_dolibarr::check_user_password_dolibarr bad date end validity", LOG_WARNING);
return '--bad-login-validity--';
}

View File

@ -63,3 +63,25 @@ function check_user_password_http($usertotest, $passwordtotest, $entitytotest)
return $login;
}
/**
* Decode the value found into the Authorization HTTP header.
* Ex: "Authorization: Basic bG9naW46cGFzcw==", $value is "Basic bG9naW46cGFzcw==" and after base64decode is "login:pass"
* Note: the $_SERVER["REMOTE_USER"] contains only the login used in the HTTP Basic form
* Method not used yet, but we keep it for some dev/test purposes.
*
* @param string $value Ex: $_SERVER["REMOTE_USER"]
* @return Object object.login & object.password
*/
function decodeHttpBasicAuth($value)
{
$encoded_basic_auth = substr($value, 6); // Remove the "Basic " string
$decoded_basic_auth = base64_decode($encoded_basic_auth);
$credentials_basic_auth = explode(':', $decoded_basic_auth);
return (object) [
'username'=> $credentials_basic_auth[0],
'password' => $credentials_basic_auth[1]
];
}

View File

@ -12,7 +12,7 @@ delete from llx_menu where menu_handler=__HANDLER__ and entity=__ENTITY__;
-- Top-Menu
-- old: (module, enabled, rowid, ...)
insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 1__+MAX_llx_menu__, '', '1', __HANDLER__, 'top', 'home', '', 0, '/index.php?mainmenu=home&amp;leftmenu=', 'Home', -1, '', '', '', 2, 10, __ENTITY__);
insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 2__+MAX_llx_menu__, 'societe|fournisseur|supplier_order|supplier_invoice', '($conf->societe->enabled && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) || isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || $conf->supplier_order->enabled || $conf->supplier_invoice->enabled))', __HANDLER__, 'top', 'companies', '', 0, '/societe/index.php?mainmenu=companies&amp;leftmenu=', 'ThirdParties', -1, 'companies', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 20, __ENTITY__);
insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 2__+MAX_llx_menu__, 'societe|fournisseur|supplier_order|supplier_invoice', '(isModEnabled("societe") && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) || isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || $conf->supplier_order->enabled || $conf->supplier_invoice->enabled))', __HANDLER__, 'top', 'companies', '', 0, '/societe/index.php?mainmenu=companies&amp;leftmenu=', 'ThirdParties', -1, 'companies', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 20, __ENTITY__);
insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 3__+MAX_llx_menu__, 'product|service', '$conf->product->enabled || $conf->service->enabled', __HANDLER__, 'top', 'products', '', 0, '/product/index.php?mainmenu=products&amp;leftmenu=', 'ProductsPipeServices', -1, 'products', '$user->rights->produit->lire||$user->rights->service->lire', '', 0, 30, __ENTITY__);
insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 16__+MAX_llx_menu__, 'bom|mrp', '$conf->bom->enabled || $conf->mrp->enabled', __HANDLER__, 'top', 'mrp', '', 0, '/mrp/index.php?mainmenu=mrp&amp;leftmenu=', 'MRP', -1, 'mrp', '$user->rights->bom->read||$user->rights->mrp->read', '', 0, 31, __ENTITY__);
insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 7__+MAX_llx_menu__, 'projet', '$conf->project->enabled', __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&amp;leftmenu=', 'Projects', -1, 'projects', '$user->rights->projet->lire', '', 2, 32, __ENTITY__);
@ -83,36 +83,36 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="users"', __HANDLER__, 'left', 408__+MAX_llx_menu__, 'home', '', 407__+MAX_llx_menu__, '/user/group/card.php?mainmenu=home&amp;leftmenu=users&amp;action=create', 'NewGroup', 2, 'users', '(($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->write:$user->rights->user->user->creer) || $user->admin) && !(! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)', '', 2, 0, __ENTITY__);
-- Third parties
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 500__+MAX_llx_menu__, 'companies', 'thirdparties', 2__+MAX_llx_menu__, '/societe/index.php?mainmenu=companies&amp;leftmenu=thirdparties', 'ThirdParty', 0, 'companies', '$user->rights->societe->lire', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 501__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/card.php?mainmenu=companies&amp;action=create', 'MenuNewThirdParty', 1, 'companies', '$user->rights->societe->creer', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 502__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?mainmenu=companies&amp;leftmenu=thirdparties', 'List', 1, 'companies', '$user->rights->societe->lire', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))', __HANDLER__, 'left', 503__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?mainmenu=companies&amp;type=f&leftmenu=suppliers', 'ListSuppliersShort', 1, 'suppliers', '$user->rights->societe->lire && $user->rights->fournisseur->lire', '', 2, 5, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))', __HANDLER__, 'left', 504__+MAX_llx_menu__, 'companies', '', 503__+MAX_llx_menu__, '/societe/card.php?mainmenu=companies&amp;leftmenu=supplier&amp;action=create&amp;type=f', 'NewSupplier', 2, 'suppliers', '$user->rights->societe->creer', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 506__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?mainmenu=companies&amp;type=p&leftmenu=prospects', 'ListProspectsShort', 1, 'companies', '$user->rights->societe->lire', '', 2, 3, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 507__+MAX_llx_menu__, 'companies', '', 506__+MAX_llx_menu__, '/societe/card.php?mainmenu=companies&amp;leftmenu=prospects&amp;action=create&amp;type=p', 'MenuNewProspect', 2, 'companies', '$user->rights->societe->creer', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 509__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?mainmenu=companies&amp;type=c&leftmenu=customers', 'ListCustomersShort', 1, 'companies', '$user->rights->societe->lire', '', 2, 4, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 510__+MAX_llx_menu__, 'companies', '', 509__+MAX_llx_menu__, '/societe/card.php?mainmenu=companies&amp;leftmenu=customers&amp;action=create&amp;type=c', 'MenuNewCustomer', 2, 'companies', '$user->rights->societe->creer', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("societe")', __HANDLER__, 'left', 500__+MAX_llx_menu__, 'companies', 'thirdparties', 2__+MAX_llx_menu__, '/societe/index.php?mainmenu=companies&amp;leftmenu=thirdparties', 'ThirdParty', 0, 'companies', '$user->rights->societe->lire', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("societe")', __HANDLER__, 'left', 501__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/card.php?mainmenu=companies&amp;action=create', 'MenuNewThirdParty', 1, 'companies', '$user->rights->societe->creer', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("societe")', __HANDLER__, 'left', 502__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?mainmenu=companies&amp;leftmenu=thirdparties', 'List', 1, 'companies', '$user->rights->societe->lire', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("societe") && (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))', __HANDLER__, 'left', 503__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?mainmenu=companies&amp;type=f&leftmenu=suppliers', 'ListSuppliersShort', 1, 'suppliers', '$user->rights->societe->lire && $user->rights->fournisseur->lire', '', 2, 5, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("societe") && (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))', __HANDLER__, 'left', 504__+MAX_llx_menu__, 'companies', '', 503__+MAX_llx_menu__, '/societe/card.php?mainmenu=companies&amp;leftmenu=supplier&amp;action=create&amp;type=f', 'NewSupplier', 2, 'suppliers', '$user->rights->societe->creer', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("societe")', __HANDLER__, 'left', 506__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?mainmenu=companies&amp;type=p&leftmenu=prospects', 'ListProspectsShort', 1, 'companies', '$user->rights->societe->lire', '', 2, 3, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("societe")', __HANDLER__, 'left', 507__+MAX_llx_menu__, 'companies', '', 506__+MAX_llx_menu__, '/societe/card.php?mainmenu=companies&amp;leftmenu=prospects&amp;action=create&amp;type=p', 'MenuNewProspect', 2, 'companies', '$user->rights->societe->creer', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("societe")', __HANDLER__, 'left', 509__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?mainmenu=companies&amp;type=c&leftmenu=customers', 'ListCustomersShort', 1, 'companies', '$user->rights->societe->lire', '', 2, 4, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("societe")', __HANDLER__, 'left', 510__+MAX_llx_menu__, 'companies', '', 509__+MAX_llx_menu__, '/societe/card.php?mainmenu=companies&amp;leftmenu=customers&amp;action=create&amp;type=c', 'MenuNewCustomer', 2, 'companies', '$user->rights->societe->creer', '', 2, 0, __ENTITY__);
-- Third parties - Contacts
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 600__+MAX_llx_menu__, 'companies', 'contacts', 2__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&amp;leftmenu=contacts', 'ContactsAddresses', 0, 'companies', '$user->rights->societe->lire', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 601__+MAX_llx_menu__, 'companies', '', 600__+MAX_llx_menu__, '/contact/card.php?mainmenu=companies&amp;leftmenu=contacts&amp;action=create', 'NewContactAddress', 1, 'companies', '$user->rights->societe->creer', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 602__+MAX_llx_menu__, 'companies', '', 600__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&amp;leftmenu=contacts', 'List', 1, 'companies', '$user->rights->societe->lire', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 604__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&amp;leftmenu=contacts&amp;type=p', 'ThirdPartyProspects', 2, 'companies', '$user->rights->societe->contact->lire', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 605__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&amp;leftmenu=contacts&amp;type=c', 'ThirdPartyCustomers', 2, 'companies', '$user->rights->societe->contact->lire', '', 2, 2, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))', __HANDLER__, 'left', 606__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&amp;leftmenu=contacts&amp;type=f', 'ThirdPartySuppliers', 2, 'companies', '$user->rights->societe->contact->lire', '', 2, 3, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 607__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&amp;leftmenu=contacts&amp;type=o', 'Others', 2, 'companies', '$user->rights->societe->contact->lire', '', 2, 4, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("societe")', __HANDLER__, 'left', 600__+MAX_llx_menu__, 'companies', 'contacts', 2__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&amp;leftmenu=contacts', 'ContactsAddresses', 0, 'companies', '$user->rights->societe->lire', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("societe")', __HANDLER__, 'left', 601__+MAX_llx_menu__, 'companies', '', 600__+MAX_llx_menu__, '/contact/card.php?mainmenu=companies&amp;leftmenu=contacts&amp;action=create', 'NewContactAddress', 1, 'companies', '$user->rights->societe->creer', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("societe")', __HANDLER__, 'left', 602__+MAX_llx_menu__, 'companies', '', 600__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&amp;leftmenu=contacts', 'List', 1, 'companies', '$user->rights->societe->lire', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("societe")', __HANDLER__, 'left', 604__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&amp;leftmenu=contacts&amp;type=p', 'ThirdPartyProspects', 2, 'companies', '$user->rights->societe->contact->lire', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("societe")', __HANDLER__, 'left', 605__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&amp;leftmenu=contacts&amp;type=c', 'ThirdPartyCustomers', 2, 'companies', '$user->rights->societe->contact->lire', '', 2, 2, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("societe") && (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))', __HANDLER__, 'left', 606__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&amp;leftmenu=contacts&amp;type=f', 'ThirdPartySuppliers', 2, 'companies', '$user->rights->societe->contact->lire', '', 2, 3, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("societe")', __HANDLER__, 'left', 607__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&amp;leftmenu=contacts&amp;type=o', 'Others', 2, 'companies', '$user->rights->societe->contact->lire', '', 2, 4, __ENTITY__);
-- Third parties - Category customer
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 650__+MAX_llx_menu__, 'companies', 'cat', 2__+MAX_llx_menu__, '/categories/index.php?mainmenu=companies&amp;leftmenu=cat&amp;type=1', 'SuppliersCategoriesShort', 0, 'categories', '$user->rights->categorie->lire', '', 2, 3, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 651__+MAX_llx_menu__, 'companies', '', 650__+MAX_llx_menu__, '/categories/card.php?mainmenu=companies&amp;action=create&amp;type=1', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("societe") && $conf->categorie->enabled', __HANDLER__, 'left', 650__+MAX_llx_menu__, 'companies', 'cat', 2__+MAX_llx_menu__, '/categories/index.php?mainmenu=companies&amp;leftmenu=cat&amp;type=1', 'SuppliersCategoriesShort', 0, 'categories', '$user->rights->categorie->lire', '', 2, 3, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("societe") && $conf->categorie->enabled', __HANDLER__, 'left', 651__+MAX_llx_menu__, 'companies', '', 650__+MAX_llx_menu__, '/categories/card.php?mainmenu=companies&amp;action=create&amp;type=1', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__);
-- Third parties - Category supplier
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '(isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) && $conf->categorie->enabled', __HANDLER__, 'left', 660__+MAX_llx_menu__, 'companies', 'cat', 2__+MAX_llx_menu__, '/categories/index.php?mainmenu=companies&amp;leftmenu=cat&amp;type=2', 'CustomersProspectsCategoriesShort', 0, 'categories', '$user->rights->categorie->lire', '', 2, 4, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '(isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) && $conf->categorie->enabled', __HANDLER__, 'left', 661__+MAX_llx_menu__, 'companies', '', 660__+MAX_llx_menu__, '/categories/card.php?mainmenu=companies&amp;action=create&amp;type=2', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__);
-- Third parties - Category contact
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 670__+MAX_llx_menu__, 'companies', 'cat', 2__+MAX_llx_menu__, '/categories/index.php?mainmenu=companies&amp;leftmenu=cat&amp;type=4', 'ContactCategoriesShort', 0, 'categories', '$user->rights->categorie->lire', '', 2, 3, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 671__+MAX_llx_menu__, 'companies', '', 670__+MAX_llx_menu__, '/categories/card.php?mainmenu=companies&amp;action=create&amp;type=4', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("societe") && $conf->categorie->enabled', __HANDLER__, 'left', 670__+MAX_llx_menu__, 'companies', 'cat', 2__+MAX_llx_menu__, '/categories/index.php?mainmenu=companies&amp;leftmenu=cat&amp;type=4', 'ContactCategoriesShort', 0, 'categories', '$user->rights->categorie->lire', '', 2, 3, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("societe") && $conf->categorie->enabled', __HANDLER__, 'left', 671__+MAX_llx_menu__, 'companies', '', 670__+MAX_llx_menu__, '/categories/card.php?mainmenu=companies&amp;action=create&amp;type=4', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__);
-- Product - Product
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->product->enabled', __HANDLER__, 'left', 2800__+MAX_llx_menu__, 'products', 'product', 3__+MAX_llx_menu__, '/product/index.php?mainmenu=products&amp;leftmenu=product&amp;type=0', 'Products', 0, 'products', '$user->rights->produit->lire', '', 2, 0, __ENTITY__);

View File

@ -1273,7 +1273,7 @@ function get_left_menu_thridparties($mainmenu, &$newmenu, $usemenuhider = 1, $le
$newmenu->add("/contact/list.php?leftmenu=contacts&type=c", $langs->trans("Customers"), 2, $user->hasRight('societe', 'contact', 'lire'));
}
if ((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled('supplier_order') || isModEnabled('supplier_invoice')) {
$newmenu->add("/contact/list.php?leftmenu=contacts&type=f", $langs->trans("Suppliers"), 2, $user->hasRight('societe', 'contact', 'lire'));
$newmenu->add("/contact/list.php?leftmenu=contacts&type=f", $langs->trans("Suppliers"), 2, $user->hasRight('fournisseur', 'lire'));
}
$newmenu->add("/contact/list.php?leftmenu=contacts&type=o", $langs->trans("ContactOthers"), 2, $user->hasRight('societe', 'contact', 'lire'));
//$newmenu->add("/contact/list.php?userid=$user->id", $langs->trans("MyContacts"), 1, $user->hasRight('societe', 'contact', 'lire'));

View File

@ -792,8 +792,8 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
* For 'experimental' modules, gives 'experimental' translation
* For 'dolibarr' modules, gives Dolibarr version
*
* @param int $translated 1=Special version keys are translated, 0=Special version keys are not translated
* @return string Module version
* @param int $translated 1=Special version keys are translated, 0=Special version keys are not translated
* @return string Module version
*/
public function getVersion($translated = 1)
{
@ -976,8 +976,8 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
$tmp = json_decode($obj->note, true);
}
return array(
'authorid' => $tmp['authorid'],
'ip' => $tmp['ip'],
'authorid' => empty($tmp['authorid']) ? '' : $tmp['authorid'],
'ip' => empty($tmp['ip']) ? '' : $tmp['ip'],
'lastactivationdate' => $this->db->jdate($obj->tms),
'lastactivationversion' => (!empty($tmp['lastactivationversion']) ? $tmp['lastactivationversion'] : 'unknown'),
);

View File

@ -40,6 +40,11 @@ class CommActionRapport
*/
public $db;
public $error;
public $errors;
/**
* @var string description
*/

View File

@ -100,7 +100,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
$tooltip = $langs->trans("GenericMaskCodes", $langs->transnoentities("BarCode"), $langs->transnoentities("BarCode"));
$tooltip .= $langs->trans("GenericMaskCodes3EAN");
$tooltip .= '<strong>'.$langs->trans("Example").':</strong><br>';
$tooltip .= '020{000000000}? (for internal use)<br>';
$tooltip .= '04{0000000000}? (for internal use)<br>';
$tooltip .= '9771234{00000}? (example of ISSN code with prefix 1234)<br>';
$tooltip .= '9791234{00000}? (example of ISMN code with prefix 1234)<br>';
//$tooltip.=$langs->trans("GenericMaskCodes5");

Some files were not shown because too many files have changed in this diff Show More