diff --git a/.gitignore b/.gitignore index 55a4c417ce7..e9603bd2d8f 100644 --- a/.gitignore +++ b/.gitignore @@ -14,7 +14,6 @@ default.properties /.pydevproject /.vscode .DS_Store -.idea *.iml *.orig Thumbs.db diff --git a/.idea/php.xml b/.idea/php.xml new file mode 100644 index 00000000000..52e0bf0ae03 --- /dev/null +++ b/.idea/php.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ChangeLog b/ChangeLog index 9ec9fb4525a..76ec4faf452 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 diff --git a/SECURITY.md b/SECURITY.md index b121b606180..e095b64fdff 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -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. diff --git a/build/docker/Dockerfile b/build/docker/Dockerfile index ead2a8af1c5..69f4d27b26f 100644 --- a/build/docker/Dockerfile +++ b/build/docker/Dockerfile @@ -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 && \ diff --git a/build/docker/README.md b/build/docker/README.md index d469c7c7aae..007b5db6ace 100644 --- a/build/docker/README.md +++ b/build/docker/README.md @@ -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 diff --git a/build/docker/docker-compose.yml b/build/docker/docker-compose.yml index 8994043cd8a..e197d5dd06e 100644 --- a/build/docker/docker-compose.yml +++ b/build/docker/docker-compose.yml @@ -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 diff --git a/build/docker/docker-run.sh b/build/docker/docker-run.sh index 4e69ea4a3a2..fbd256ab625 100644 --- a/build/docker/docker-run.sh +++ b/build/docker/docker-run.sh @@ -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 < /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 < ${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 diff --git a/dev/resources/iso-normes/qr-bar-codes/barcode_EAN13.txt b/dev/resources/iso-normes/qr-bar-codes/barcode_EAN13.txt index e8000035788..549c6e29a1d 100644 --- a/dev/resources/iso-normes/qr-bar-codes/barcode_EAN13.txt +++ b/dev/resources/iso-normes/qr-bar-codes/barcode_EAN13.txt @@ -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 +00001–01999 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 diff --git a/htdocs/accountancy/admin/subaccount.php b/htdocs/accountancy/admin/subaccount.php index 4f2274269d8..40055a4b75f 100644 --- a/htdocs/accountancy/admin/subaccount.php +++ b/htdocs/accountancy/admin/subaccount.php @@ -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 ''; $s = ''; + // Customer if ($obj->type == 1) { $s .= ''.$langs->trans("Customer").''; @@ -407,7 +412,7 @@ if ($resql) { // Supplier $s .= ''.$langs->trans("Supplier").''; } elseif ($obj->type == 3) { - // User + // User - Employee $s .= ''.$langs->trans("Employee").''; } print $s; @@ -440,6 +445,7 @@ if ($resql) { // Action print ''; $e = ''; + // Customer if ($obj->type == 1) { $e .= ''.img_edit().''; @@ -447,7 +453,7 @@ if ($resql) { // Supplier $e .= ''.img_edit().''; } elseif ($obj->type == 3) { - // User + // User - Employee $e .= ''.img_edit().''; } print $e; diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index 01d89f1168d..fd8cd8ad688 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -1,7 +1,7 @@ * Copyright (C) 2016 Florian Henry - * Copyright (C) 2016-2022 Alexandre Spangaro + * Copyright (C) 2016-2023 Alexandre Spangaro * Copyright (C) 2018 Frédéric France * * 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 .= '&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_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 .= '&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 .= '&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 '
'; + print ''; + print ''; if ($optioncss != '') { print ''; } - print ''; print ''; - print ''; + print ''; print ''; print ''; + print ''; print ''; $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 .= 'global->ACCOUNTING_EXPORT_FORMAT.')" />'; + $newcardbutton = 'global->ACCOUNTING_EXPORT_FORMAT.')" />'; print ''; + + 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 .= '
'; @@ -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 .= ': '; - $moreforfilter .= ''; - $moreforfilter .= '
'; $moreforfilter .= '
'; + $moreforfilter .= ': '; + $moreforfilter .= ''; + $moreforfilter .= '
'; - $moreforfilter .= $langs->trans("Journal"); + $moreforfilter .= '
'; + $moreforfilter .= $langs->trans("Journals").': '; $moreforfilter .= $formaccounting->multi_select_journal($search_ledger_code, 'search_ledger_code', 0, 1, 1, 1); + $moreforfilter .= '
'; + $moreforfilter .= '
'; + $moreforfilter .= '
'; + // 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 .= '
'; + + $moreforfilter .= '
'; + $moreforfilter .= ': '; + $moreforfilter .= ''; $moreforfilter .= '
'; if (!empty($moreforfilter)) { @@ -305,9 +396,6 @@ if ($action != 'export_csv') { print ''; print ''; - 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 ''; // Fields from hook @@ -324,6 +412,10 @@ if ($action != 'export_csv') { print ''; 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 ''; - print ''.$line->numero_compte.($root_account_description ? ' - '.$root_account_description : '').''; + print ''.$line->numero_compte.($root_account_description ? ' - '.$root_account_description : '').''; print ''; $displayed_account = $root_account_number; @@ -438,19 +532,43 @@ if ($action != 'export_csv') { } print ''; - print ''.$accounting_account.''; + // Accounting account + if ($type == 'sub') { + print ''.$line->subledger_account.' ('.$line->subledger_label.')'; + } else { + print ''.$accounting_account.''; + } + + // Type + // TODO Retrieve the type of third party: Customer / Supplier / Employee + //if ($type == 'sub') { + // print ''; + //} + if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) { print ''.price(price2num($opening_balance, 'MT')).''; } $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 diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index bb5a6e472b1..897f60e8aaa 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -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; diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index 393629ae505..5f603a973c2 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -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 '
'; $y = $year_current; -$buttonbind = ''.$langs->trans("ValidateHistory").''; +$buttonbind = ''.img_picto($langs->trans("ValidateHistory"), 'link', 'class="pictofixedwidth fa-color-unset"').$langs->trans("ValidateHistory").''; 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 ''; print ''; 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 ''; print price($row[$i]); + // Add link to make binding + if (!empty(price2num($row[$i]))) { + print ''; + print img_picto($langs->trans("ValidateHistory").' ('.$langs->trans('Month'.str_pad($cursormonth, 2, '0', STR_PAD_LEFT)).' '.$cursoryear.')', 'link', 'class="marginleft2"'); + print ''; + } print ''; } print ''.price($row[14]).''; @@ -558,7 +565,7 @@ print "\n"; print ''; -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 '
'; print '
'; diff --git a/htdocs/accountancy/expensereport/index.php b/htdocs/accountancy/expensereport/index.php index 5064003c7ff..0929c9c9e24 100644 --- a/htdocs/accountancy/expensereport/index.php +++ b/htdocs/accountancy/expensereport/index.php @@ -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 '
'; $y = $year_current; -$buttonbind = ''.$langs->trans("ValidateHistory").''; +$buttonbind = ''.img_picto('', 'link', 'class="paddingright fa-color-unset"').$langs->trans("ValidateHistory").''; 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 ''; print ''; 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 ''; 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 ''; print price($row[$i]); + // Add link to make binding + if (!empty(price2num($row[$i]))) { + print ''; + print img_picto($langs->trans("ValidateHistory").' ('.$langs->trans('Month'.str_pad($cursormonth, 2, '0', STR_PAD_LEFT)).' '.$cursoryear.')', 'link', 'class="marginleft2"'); + print ''; + } print ''; } print ''.price($row[14]).''; print ''; } $db->free($resql); + + if ($num == 0) { + print ''; + print ''.$langs->trans("NoRecordFound").''; + print ''; + } } else { print $db->lasterror(); // Show last sql error } @@ -359,6 +394,12 @@ if ($resql) { print ''; } $db->free($resql); + + if ($num == 0) { + print ''; + print ''.$langs->trans("NoRecordFound").''; + print ''; + } } else { print $db->lasterror(); // Show last sql error } @@ -367,7 +408,7 @@ print ''; -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 '
'; print '
'; diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index b214b89734c..87e67bbfcb6 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -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 '
'; $y = $year_current; -$buttonbind = ''.$langs->trans("ValidateHistory").''; +$buttonbind = ''.img_picto('', 'link', 'class="paddingright fa-color-unset"').$langs->trans("ValidateHistory").''; 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 ''; print ''; 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 ''; 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 ''; print price($row[$i]); + // Add link to make binding + if (!empty(price2num($row[$i]))) { + print ''; + print img_picto($langs->trans("ValidateHistory").' ('.$langs->trans('Month'.str_pad($cursormonth, 2, '0', STR_PAD_LEFT)).' '.$cursoryear.')', 'link', 'class="marginleft2"'); + print ''; + } print ''; } print ''.price($row[14]).''; @@ -541,7 +555,7 @@ print "\n"; print ''; -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 '
'; print '
'; diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 6da25c8ef01..225261e8f9f 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -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 = '
'; + $return .= '
'; + $return .= ''; + + 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 .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).''; + if (property_exists($this, 'type')) { + $return .= '
'.$this->type.''; + } + if (method_exists($this, 'getmorphylib')) { + $return .= '
'.$this->getmorphylib('', 2).''; + } + if (method_exists($this, 'getLibStatut')) { + $return .= '
'.$this->getLibStatut(5).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 50bbbca42d7..d06d91cbea6 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -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érents|ES:Mó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érents|ES:Mó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 ''; print ''; print ''; print ''; +print ''; + 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 ''; + // Action column if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { print ''; } + // Line numbering if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) { print ''; @@ -715,32 +736,45 @@ if (!empty($arrayfields['d.ref']['checked'])) { print ''; print ''; } + +// Civility if (!empty($arrayfields['d.civility']['checked'])) { print ''; } + +// First Name if (!empty($arrayfields['d.firstname']['checked'])) { print ''; } + +// Last Name if (!empty($arrayfields['d.lastname']['checked'])) { print ''; } + +// Gender if (!empty($arrayfields['d.gender']['checked'])) { print ''; } + +// Company if (!empty($arrayfields['d.company']['checked'])) { print ''; } + +// Login if (!empty($arrayfields['d.login']['checked'])) { print ''; } + // Nature if (!empty($arrayfields['d.morphy']['checked'])) { print ''; } + +// Member Type if (!empty($arrayfields['t.libelle']['checked'])) { print ''; } @@ -758,51 +794,62 @@ if (!empty($arrayfields['t.libelle']['checked'])) { print ''; } +// Address - Street if (!empty($arrayfields['d.address']['checked'])) { print ''; } +// ZIP if (!empty($arrayfields['d.zip']['checked'])) { print ''; } + +// Town/City if (!empty($arrayfields['d.town']['checked'])) { print ''; } -// State + +// State / County / Departement if (!empty($arrayfields['state.nom']['checked'])) { print ''; } + // Country if (!empty($arrayfields['country.code_iso']['checked'])) { print ''; } + // Phone pro if (!empty($arrayfields['d.phone']['checked'])) { print ''; } + // Phone perso if (!empty($arrayfields['d.phone_perso']['checked'])) { print ''; + print ''; } + // Phone mobile if (!empty($arrayfields['d.phone_mobile']['checked'])) { print ''; } + // Email if (!empty($arrayfields['d.email']['checked'])) { print ''; } + // End of subscription date if (!empty($arrayfields['d.datefin']['checked'])) { print ''; } + // 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 ''; } + // Birthday if (!empty($arrayfields['d.birth']['checked'])) { print ''; } + // Date modification if (!empty($arrayfields['d.tms']['checked'])) { print ''; } + // Status if (!empty($arrayfields['d.statut']['checked'])) { print ''; } + +// Import Key if (!empty($arrayfields['d.import_key']['checked'])) { print ''; } + if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { // Action column print ''; - - // Action column - if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { - print ''; - } - - if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Ref - if (!empty($arrayfields['d.ref']['checked'])) { - print "\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Civility - if (!empty($arrayfields['d.civility']['checked'])) { - print "\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Firstname - if (!empty($arrayfields['d.firstname']['checked'])) { - print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Lastname - if (!empty($arrayfields['d.lastname']['checked'])) { - print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Gender - if (!empty($arrayfields['d.gender']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Company - if (!empty($arrayfields['d.company']['checked'])) { - print '\n"; - } - // Login - if (!empty($arrayfields['d.login']['checked'])) { - print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Nature (Moral/Physical) - if (!empty($arrayfields['d.morphy']['checked'])) { - print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Type label - if (!empty($arrayfields['t.libelle']['checked'])) { $membertypestatic->id = $obj->type_id; $membertypestatic->label = $obj->type; - print ''; - if (!$i) { - $totalarray['nbfield']++; + $memberstatic->type = $membertypestatic->label; + $memberstatic->photo = $obj->photo; + // Output Kanban + print $memberstatic->getKanbanView(''); + if ($i == (min($num, $limit) - 1)) { + print ''; + print ''; } - } - // Address - if (!empty($arrayfields['d.address']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Zip - if (!empty($arrayfields['d.zip']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Town - if (!empty($arrayfields['d.town']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // State - if (!empty($arrayfields['state.nom']['checked'])) { - print "\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Country - if (!empty($arrayfields['country.code_iso']['checked'])) { - $tmparray = getCountry($obj->country, 'all'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Phone pro - if (!empty($arrayfields['d.phone']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Phone perso - if (!empty($arrayfields['d.phone_perso']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Phone mobile - if (!empty($arrayfields['d.phone_mobile']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // EMail - if (!empty($arrayfields['d.email']['checked'])) { - print '\n"; - } - // End of subscription date - $datefin = $db->jdate($obj->datefin); - if (!empty($arrayfields['d.datefin']['checked'])) { - print ''; + + // Action column + if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; + } + // Technical ID + if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Ref + if (!empty($arrayfields['d.ref']['checked'])) { + print "\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Civility + if (!empty($arrayfields['d.civility']['checked'])) { + print "\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Firstname + if (!empty($arrayfields['d.firstname']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Lastname + if (!empty($arrayfields['d.lastname']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Gender + if (!empty($arrayfields['d.gender']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Company + if (!empty($arrayfields['d.company']['checked'])) { + print '\n"; + } + // Login + if (!empty($arrayfields['d.login']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Nature (Moral/Physical) + if (!empty($arrayfields['d.morphy']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Type label + if (!empty($arrayfields['t.libelle']['checked'])) { + $membertypestatic->id = $obj->type_id; + $membertypestatic->label = $obj->type; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Address + if (!empty($arrayfields['d.address']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Zip + if (!empty($arrayfields['d.zip']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Town + if (!empty($arrayfields['d.town']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // State / County / Departement + if (!empty($arrayfields['state.nom']['checked'])) { + print "\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Country + if (!empty($arrayfields['country.code_iso']['checked'])) { + $tmparray = getCountry($obj->country, 'all'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Phone pro + if (!empty($arrayfields['d.phone']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Phone perso + if (!empty($arrayfields['d.phone_perso']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Phone mobile + if (!empty($arrayfields['d.phone_mobile']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // EMail + if (!empty($arrayfields['d.email']['checked'])) { + print '\n"; + } + // End of subscription date + $datefin = $db->jdate($obj->datefin); + if (!empty($arrayfields['d.datefin']['checked'])) { + print ''; + } + // 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 ''; + if (!$i) { + $totalarray['nbfield']++; } } - print ''; - } - // 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 ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Birth - if (!empty($arrayfields['d.birth']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date modification - if (!empty($arrayfields['d.tms']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Status - if (!empty($arrayfields['d.statut']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['d.import_key']['checked'])) { - print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Action column - if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { - print ''; + if (!$i) { + $totalarray['nbfield']++; } - print ''; } - print ''; - } - if (!$i) { - $totalarray['nbfield']++; - } + // Date modification + if (!empty($arrayfields['d.tms']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Status + if (!empty($arrayfields['d.statut']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['d.import_key']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Action column + if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; + } + if (!$i) { + $totalarray['nbfield']++; + } - print ''."\n"; + print ''."\n"; + } $i++; } diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index 5003593905e..aef46db26ef 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -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 '
'; @@ -704,6 +724,7 @@ if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { print $searchpicto; print ' '; print ''; print ''; print ''; $arraygender = array('man'=>$langs->trans("Genderman"), 'woman'=>$langs->trans("Genderwoman"), 'other'=>$langs->trans("Genderother")); print $form->selectarray('search_gender', $arraygender, $search_gender, 1); print ''; print ''; print ''; @@ -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 ''; print ''; print ''; print ''; print ''; print ''; print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100'); print ''; print ''; - print ''; print ''; print ''; @@ -811,6 +858,7 @@ if (!empty($arrayfields['d.datefin']['checked'])) { print $form->selectarray('search_filter', $selectarray, $search_filter); print ''; print ''; print ''; print ''; @@ -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 ''; print ''; print ''; @@ -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 '
'; - 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 ''; + if ($mode == 'kanban') { + if ($i == 0) { + print '
'; + print '
'; } - print '
'.$obj->rowid.'"; - print $memberstatic->getNomUrl(-1, 0, 'card', 'ref', '', -1, 0, 1); - print ""; - print $obj->civility; - print "'; - print $memberstatic->getNomUrl(0, 0, 'card', 'firstname'); - //print $obj->firstname; - print "'; - print $memberstatic->getNomUrl(0, 0, 'card', 'lastname'); - //print $obj->lastname; - print "'; - if ($obj->gender) { - print $langs->trans("Gender".$obj->gender); - } - print ''; - print $companynametoshow; - print "'.$obj->login."'; - print $memberstatic->getmorphylib('', 2); - print "'; - print $membertypestatic->getNomUrl(1, 32); - print '
'; - print $obj->address; - print ''; - print $obj->zip; - print ''; - print $obj->town; - print '".$obj->state_name."'; - print dol_escape_htmltag($tmparray['label']); - print ''; - print $obj->phone; - print ''; - print $obj->phone_perso; - print ''; - print $obj->phone_mobile; - print ''; - print dol_print_email($obj->email, 0, 0, 1, 64, 1, 1); - print "'; - 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 '
'; + 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 ''; } - } else { - if (!empty($obj->subscription)) { - print ''.$langs->trans("SubscriptionNotReceived").''; - if ($obj->statut > 0) { - print " ".img_warning(); + print ''.$obj->rowid.'"; + print $memberstatic->getNomUrl(-1, 0, 'card', 'ref', '', -1, 0, 1); + print ""; + print $obj->civility; + print "'; + print $memberstatic->getNomUrl(0, 0, 'card', 'firstname'); + //print $obj->firstname; + print "'; + print $memberstatic->getNomUrl(0, 0, 'card', 'lastname'); + //print $obj->lastname; + print "'; + if ($obj->gender) { + print $langs->trans("Gender".$obj->gender); + } + print ''; + print $companynametoshow; + print "'.$obj->login."'; + print $memberstatic->getmorphylib('', 2); + print "'; + print $membertypestatic->getNomUrl(1, 32); + print ''; + print $obj->address; + print ''; + print $obj->zip; + print ''; + print $obj->town; + print '".$obj->state_name."'; + print dol_escape_htmltag($tmparray['label']); + print ''; + print $obj->phone; + print ''; + print $obj->phone_perso; + print ''; + print $obj->phone_mobile; + print ''; + print dol_print_email($obj->email, 0, 0, 1, 64, 1, 1); + print "'; + 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 ' '; + if (!empty($obj->subscription)) { + print ''.$langs->trans("SubscriptionNotReceived").''; + if ($obj->statut > 0) { + print " ".img_warning(); + } + } else { + print ' '; + } + } + print ''; + print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); + print ''; - print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); - print ''; - print dol_print_date($db->jdate($obj->birth), 'day', 'tzuser'); - print ''; - print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); - print ''; - print $memberstatic->LibStatut($obj->statut, $obj->subscription, $datefin, 5); - print ''; - print dol_escape_htmltag($obj->import_key); - print "'; - 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 ''; + print dol_print_date($db->jdate($obj->birth), 'day', 'tzuser'); + print ''; + print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); + print ''; + print $memberstatic->LibStatut($obj->statut, $obj->subscription, $datefin, 5); + print ''; + print dol_escape_htmltag($obj->import_key); + print "'; + 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 ''; + } + print '

'; + + print load_fiche_titre($langs->trans('MiscellaneousOptions'), '', ''); } + print ''; print ''; print ''; @@ -395,13 +400,12 @@ print ''."\n"; print ''; -print dol_get_fiche_end(); - print $form->buttonsSaveCancel("Save", ''); print '
'; -print "
"; + +print dol_get_fiche_end(); // End of page llxFooter(); diff --git a/htdocs/admin/agenda_reminder.php b/htdocs/admin/agenda_reminder.php index 76c717b669d..42967b4f275 100644 --- a/htdocs/admin/agenda_reminder.php +++ b/htdocs/admin/agenda_reminder.php @@ -150,7 +150,6 @@ $linkback = 'trans("Agenda"), -1, 'action'); diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php index 96dd7affdba..176816c0f88 100644 --- a/htdocs/admin/barcode.php +++ b/htdocs/admin/barcode.php @@ -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); diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index abf62b51fa7..8b63c5842ba 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -2510,11 +2510,11 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') print ''; } elseif ($value == 'block_if_negative') { print ''; - 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 ''; } elseif ($value == 'type_duration') { print ''; - print $form->selectTypeDuration('', $obj->{$value}, array('i','h')); + print $form->selectTypeDuration('', (empty($obj->type_duration) ? '' : $obj->type_duration), array('i','h')); print ''; } else { $fieldValue = isset($obj->{$value}) ? $obj->{$value}: ''; diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index 8dfafb19b63..b3d6e045470 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -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' ); diff --git a/htdocs/admin/modulehelp.php b/htdocs/admin/modulehelp.php index 9a0c34aea2b..1af4b25bb27 100644 --- a/htdocs/admin/modulehelp.php +++ b/htdocs/admin/modulehelp.php @@ -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 { diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index e93b5a58e96..6e0d90499d4 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -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 .= '
'; $moreforfilter .= $form->selectarray('search_nature', $arrayofnatures, dol_escape_htmltag($search_nature), $langs->trans('Origin'), 0, 0, '', 0, 0, 0, '', 'maxwidth250', 1); $moreforfilter .= '
'; + 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 .= '
'; - $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 .= '
'; } + $array_status = array('active'=>$langs->transnoentitiesnoconv("Enabled"), 'disabled'=>$langs->transnoentitiesnoconv("Disabled")); $moreforfilter .= '
'; - $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 .= '
'; $moreforfilter .= ' '; $moreforfilter .= '
'; @@ -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 .= 'warnings_unactivation[$mysoc->country_code]).'&value='.$modName.'&mode='.$mode.$param.'">'; - $codeenabledisable .= img_picto($langs->trans("Activated"), 'switch_on'); + $codeenabledisable .= img_picto($langs->trans("Activated").($warningstring ? ' '.$warningstring : ''), 'switch_on'); $codeenabledisable .= ''; + if (getDolGlobalInt("MAIN_FEATURES_LEVEL") > 1) { + $codeenabledisable .= ' '; + $codeenabledisable .= ''; + $codeenabledisable .= img_picto($langs->trans("Reload"), 'refresh', 'class="opacitymedium"'); + $codeenabledisable .= ''; + } } else { $codeenabledisable .= ''; - $codeenabledisable .= img_picto($langs->trans("Activated"), 'switch_on'); + $codeenabledisable .= img_picto($langs->trans("Activated").($warningstring ? ' '.$warningstring : ''), 'switch_on'); $codeenabledisable .= ''; + if (getDolGlobalInt("MAIN_FEATURES_LEVEL") > 1) { + $codeenabledisable .= ' '; + $codeenabledisable .= ''; + $codeenabledisable .= img_picto($langs->trans("Reload"), 'refresh', 'class="opacitymedium"'); + $codeenabledisable .= ''; + } } } @@ -907,7 +965,7 @@ if ($mode == 'common' || $mode == 'commonkanban') { // Output Kanban print $objMod->getKanbanView($codeenabledisable, $codetoconfig); } else { - print ''."\n"; + print ''."\n"; if (!empty($conf->global->MAIN_MODULES_SHOW_LINENUMBERS)) { print ''.$linenum.''; } @@ -941,7 +999,7 @@ if ($mode == 'common' || $mode == 'commonkanban') { print ''; // Version - print ''; + print ''; if ($objMod->needUpdate) { $versionTitle = $langs->trans('ModuleUpdateAvailable').' : '.$objMod->lastVersion; print ''.$versiontrans.''; @@ -951,7 +1009,7 @@ if ($mode == 'common' || $mode == 'commonkanban') { print "\n"; // Link enable/disable - print ''; + print ''; print $codeenabledisable; print "\n"; diff --git a/htdocs/admin/website.php b/htdocs/admin/website.php index 3c348d71a12..d8fb57b49f5 100644 --- a/htdocs/admin/website.php +++ b/htdocs/admin/website.php @@ -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 ''; 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 ''; print ''; + print '
'; print ''; // 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 ''; @@ -581,8 +594,9 @@ if ($id) { fieldListWebsites($fieldlist, $obj, $tabname[$id], 'edit'); } - print ''; + print ''; } 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 ''; + print ''; } } } @@ -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 : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : '').'&'; + // Active print '"; // Modify link @@ -633,6 +651,7 @@ if ($id) { } print '
 '; - print '  '; + print ''; + print ' '.$valuetoshow.''.$valuetoshow.''; - print ''.$actl[($obj->status ? 1 : 0)].''; + print ''.$actl[($obj->status ? 1 : 0)].''; print "
'; + print '
'; print ''; } @@ -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') { diff --git a/htdocs/api/class/api_access.class.php b/htdocs/api/class/api_access.class.php index f885677225e..37b7b079716 100644 --- a/htdocs/api/class/api_access.class.php +++ b/htdocs/api/class/api_access.class.php @@ -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 diff --git a/htdocs/api/class/api_login.class.php b/htdocs/api/class/api_login.class.php index d5362f4ac56..0b8d3e64828 100644 --- a/htdocs/api/class/api_login.class.php +++ b/htdocs/api/class/api_login.class.php @@ -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'); } diff --git a/htdocs/api/index.php b/htdocs/api/index.php index ba195b82c08..4e4da2c94cc 100644 --- a/htdocs/api/index.php +++ b/htdocs/api/index.php @@ -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 { diff --git a/htdocs/bookcal/class/booking.class.php b/htdocs/bookcal/class/booking.class.php index 98cb5077844..1a4f402626b 100644 --- a/htdocs/bookcal/class/booking.class.php +++ b/htdocs/bookcal/class/booking.class.php @@ -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',), diff --git a/htdocs/comm/action/class/ical.class.php b/htdocs/comm/action/class/ical.class.php index badd5db5c98..26db2cd5e6e 100644 --- a/htdocs/comm/action/class/ical.class.php +++ b/htdocs/comm/action/class/ical.class.php @@ -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); diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 5b51d48392b..8ec011f5e9d 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -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 .= ''; $nav .= $form->selectDate($dateselect, 'dateselect', 0, 0, 1, '', 1, 0); //$nav .= ' '; @@ -495,7 +494,8 @@ print ''; //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 = ''; + $viewmode .= ''; // To add a space before the navigation tools @@ -614,7 +616,7 @@ if (!empty($conf->use_javascript_ajax)) { // If javascript on $default = ''; } - $s .= '
 
'; + $s .= '
 
'; } } @@ -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; diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 4be3195561e..ab2037d5f76 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -600,7 +600,7 @@ $num = $db->num_rows($resql); $arrayofselected = is_array($toselect) ? $toselect : array(); // Local calendar -$newtitle = '
'; +$newtitle = '
'; $newtitle .= ' '.$langs->trans("LocalAgenda").'   '; $newtitle .= '
'; //$newtitle=$langs->trans($title); @@ -887,6 +887,7 @@ print "\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 ''; + // 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 ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; @@ -955,10 +1005,16 @@ while ($i < $imaxinloop) { // User owner if (!empty($arrayfields['owner']['checked'])) { - print ''; // 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 ''; // 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 ' '; } @@ -1006,13 +1062,14 @@ while ($i < $imaxinloop) { // Start date if (!empty($arrayfields['a.datep']['checked'])) { - print ''; + print ''; 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 ''; $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 ''; + print ''; 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 ''; print ''; } diff --git a/htdocs/comm/action/pertype.php b/htdocs/comm/action/pertype.php index ce33d0f40b2..c13de5fb183 100644 --- a/htdocs/comm/action/pertype.php +++ b/htdocs/comm/action/pertype.php @@ -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 = "
".img_previous($langs->trans("Previous"))."\n"; +// Show navigation bar +$nav = ''; $nav .= $form->selectDate($dateselect, 'dateselect', 0, 0, 1, '', 1, 0); $nav .= ' '; diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index bd35fc16e7d..0ee3b6db4a1 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -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 = "trans("Previous"))."\">   \n"; +// Show navigation bar +$nav = ''; $nav .= $form->selectDate($dateselect, 'dateselect', 0, 0, 1, '', 1, 0); $nav .= ' '; diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 5fb464a6e8e..b8a53aadba6 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -15,6 +15,7 @@ * Copyright (C) 2018-2021 Frédéric France * Copyright (C) 2020 Nicolas ZABOURI * Copyright (C) 2022 Gauthier VERDOL + * Copyright (C) 2023 Lenin Rivas * * 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 ''; print ''.$langs->trans('NotePublic').''; print ''; - $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); diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 2b429d0e8d1..150e2c99b66 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -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 = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + //$return .= ''; // Can be image + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).''; + if (property_exists($this, 'fk_project')) { + $return .= ' | '.$this->fk_project.''; + } + if (property_exists($this, 'author')) { + $return .= '
'.$this->author.''; + } + if (property_exists($this, 'total_ht')) { + $return .='
'.$langs->trans("AmountHT").' : '.price($this->total_ht).''; + } + if (method_exists($this, 'getLibStatut')) { + $return .= '
'.$this->getLibStatut(5).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } /** diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 0acc2ae4bd9..cc5872abb25 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -70,6 +70,7 @@ $show_files = GETPOST('show_files', 'int'); $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'proposallist'; +$mode = GETPOST('mode', 'alpha'); $search_user = GETPOST('search_user', 'int'); $search_sale = GETPOST('search_sale', 'int'); @@ -864,6 +865,9 @@ if ($resql) { } $param = '&search_status='.urlencode($search_status); + if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); + } if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -1072,6 +1076,9 @@ if ($resql) { if (!empty($socid)) { $url .= '&socid='.$socid; } + $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('NewPropal'), '', 'fa fa-plus-circle', $url, '', $user->rights->propal->creer); // Fields title search @@ -1085,6 +1092,7 @@ if ($resql) { print ''; print ''; print ''; + print ''; print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'propal', 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -1702,574 +1710,590 @@ if ($resql) { $total_margin += $marginInfo['total_margin']; } - print ''; + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; + } + // Output Kanban + $userstatic->fetch($obj->fk_user_author); + $objectstatic->author = $userstatic->getNomUrl(1); + $objectstatic->fk_project = $projectstatic->getNomUrl(1); + print $objectstatic->getKanbanView(''); + if ($i == (min($num, $limit) - 1)) { + print '
'; + print ''; + } + } else { + print ''; - // Action column - if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { - print ''; - 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; + // Action column + if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; + 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 ''; } - print ''; - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - if (!empty($arrayfields['p.ref']['checked'])) { - print ''; - - print ''; - // Picto + Ref - print ''; - // Warning - $warnornote = ''; - if ($obj->status == Propal::STATUS_VALIDATED && $db->jdate($obj->dfv) < ($now - $conf->propal->cloture->warning_delay)) { - $warnornote .= img_warning($langs->trans("Late")); - } - if ($warnornote) { - print ''; - } - // Other picto tool - print '
'; - print $objectstatic->getNomUrl(1, '', '', 0, 1, (isset($conf->global->PROPAL_LIST_SHOW_NOTES) ? $conf->global->PROPAL_LIST_SHOW_NOTES : 1)); - print ''; - print $warnornote; print ''; - $filename = dol_sanitizeFileName($obj->ref); - $filedir = $conf->propal->multidir_output[$obj->propal_entity].'/'.dol_sanitizeFileName($obj->ref); - $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid; - print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); - print '
'; - - print "\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - - if (!empty($arrayfields['p.ref_client']['checked'])) { - // Customer ref - print ''; - print dol_escape_htmltag($obj->ref_client); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - if (!empty($arrayfields['pr.ref']['checked'])) { - // Project ref - print ''; - if ($obj->project_id > 0) { - print $projectstatic->getNomUrl(1); - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - if (!empty($arrayfields['pr.title']['checked'])) { - // Project label - print ''; - if ($obj->project_id > 0) { - print dol_escape_htmltag($projectstatic->title); - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Thirdparty - if (!empty($arrayfields['s.nom']['checked'])) { - print ''; - print $companystatic->getNomUrl(1, 'customer', 0, 0, 1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Alias - if (!empty($arrayfields['s.name_alias']['checked'])) { - print ''; - print $obj->alias; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Town - if (!empty($arrayfields['s.town']['checked'])) { - print ''; - print $obj->town; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Zip - if (!empty($arrayfields['s.zip']['checked'])) { - print ''; - print $obj->zip; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // State - if (!empty($arrayfields['state.nom']['checked'])) { - print "".$obj->state_name."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Country - if (!empty($arrayfields['country.code_iso']['checked'])) { - print ''; - $tmparray = getCountry($obj->fk_pays, 'all'); - print $tmparray['label']; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Type ent - if (!empty($arrayfields['typent.code']['checked'])) { - if (!is_array($typenArray) || empty($typenArray)) { - $typenArray = $formcompany->typent_array(1); - } - - print ''; - print $typenArray[$obj->typent_code]; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Date proposal - if (!empty($arrayfields['p.date']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->dp), 'day'); - print "\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Date end validity - if (!empty($arrayfields['p.fin_validite']['checked'])) { - if ($obj->dfv) { - print ''.dol_print_date($db->jdate($obj->dfv), 'day'); - print ''; - } else { - print ' '; - } - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date delivery - if (!empty($arrayfields['p.date_livraison']['checked'])) { - if ($obj->ddelivery) { - print ''.dol_print_date($db->jdate($obj->ddelivery), 'day'); - print ''; - } else { - print ' '; - } - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date Signature - if (!empty($arrayfields['p.date_signature']['checked'])) { - if ($obj->dsignature) { - print ''.dol_print_date($db->jdate($obj->dsignature), 'day'); - print ''; - } else { - print ' '; - } - if (!$i) { - $totalarray['nbfield']++; - } - } - // Availability - if (!empty($arrayfields['ava.rowid']['checked'])) { - print ''; - $form->form_availability('', $obj->availability, 'none', 1); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Shipping Method - if (!empty($arrayfields['p.fk_shipping_method']['checked'])) { - print ''; - $form->formSelectShippingMethod('', $obj->fk_shipping_method, 'none', 1); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Source - input reason - if (!empty($arrayfields['p.fk_input_reason']['checked'])) { - print ''; - if ($obj->fk_input_reason > 0) { - print $form->cache_demand_reason[$obj->fk_input_reason]['label']; - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Payment terms - if (!empty($arrayfields['p.fk_cond_reglement']['checked'])) { - print ''; - $form->form_conditions_reglement($_SERVER['PHP_SELF'], $obj->fk_cond_reglement, 'none', 0, '', 1, $obj->deposit_percent); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Payment mode - if (!empty($arrayfields['p.fk_mode_reglement']['checked'])) { - print ''; - $form->form_modes_reglement($_SERVER['PHP_SELF'], $obj->fk_mode_reglement, 'none', '', -1); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Amount HT - if (!empty($arrayfields['p.total_ht']['checked'])) { - print ''.price($obj->total_ht)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'p.total_ht'; - } - if (empty($totalarray['val']['p.total_ht'])) { - $totalarray['val']['p.total_ht'] = $obj->total_ht; - } else { - $totalarray['val']['p.total_ht'] += $obj->total_ht; - } - } - // Amount VAT - if (!empty($arrayfields['p.total_tva']['checked'])) { - print ''.price($obj->total_tva)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'p.total_tva'; - } - if (empty($totalarray['val']['p.total_tva'])) { - $totalarray['val']['p.total_tva'] = $obj->total_tva; - } else { - $totalarray['val']['p.total_tva'] += $obj->total_tva; - } - } - // Amount TTC - if (!empty($arrayfields['p.total_ttc']['checked'])) { - print ''.price($obj->total_ttc)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'p.total_ttc'; - } - if (empty($totalarray['val']['p.total_ttc'])) { - $totalarray['val']['p.total_ttc'] = $obj->total_ttc; - } else { - $totalarray['val']['p.total_ttc'] += $obj->total_ttc; - } - } - // Amount invoiced HT - if (!empty($arrayfields['p.total_ht_invoiced']['checked'])) { - print ''.price($totalInvoicedHT)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'p.total_ht_invoiced'; - } - if (empty($totalarray['val']['p.total_ht_invoiced'])) { - $totalarray['val']['p.total_ht_invoiced'] = $totalInvoicedHT; - } else { - $totalarray['val']['p.total_ht_invoiced'] += $totalInvoicedHT; - } - } - // Amount invoiced TTC - if (!empty($arrayfields['p.total_invoiced']['checked'])) { - print ''.price($totalInvoicedTTC)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'p.total_invoiced'; - } - if (empty($totalarray['val']['p.total_invoiced'])) { - $totalarray['val']['p.total_invoiced'] = $totalInvoicedTTC; - } else { - $totalarray['val']['p.total_invoiced'] += $totalInvoicedTTC; - } - } - // Currency - if (!empty($arrayfields['p.multicurrency_code']['checked'])) { - print ''.$obj->multicurrency_code.' - '.$langs->trans('Currency'.$obj->multicurrency_code)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Currency rate - if (!empty($arrayfields['p.multicurrency_tx']['checked'])) { - print ''; - $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code); - print "\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Amount HT - if (!empty($arrayfields['p.multicurrency_total_ht']['checked'])) { - print ''.price($obj->multicurrency_total_ht)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Amount VAT - if (!empty($arrayfields['p.multicurrency_total_tva']['checked'])) { - print ''.price($obj->multicurrency_total_tva)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Amount TTC - if (!empty($arrayfields['p.multicurrency_total_ttc']['checked'])) { - print ''.price($obj->multicurrency_total_ttc)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Amount invoiced - if (!empty($arrayfields['p.multicurrency_total_ht_invoiced']['checked'])) { - print ''.price($multicurrency_totalInvoicedHT)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Amount invoiced - if (!empty($arrayfields['p.multicurrency_total_invoiced']['checked'])) { - print ''.price($multicurrency_totalInvoicedTTC)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - - $userstatic->id = $obj->fk_user_author; - $userstatic->login = $obj->login; - $userstatic->lastname = $obj->lastname; - $userstatic->firstname = $obj->firstname; - $userstatic->email = $obj->user_email; - $userstatic->statut = $obj->user_statut; - $userstatic->entity = $obj->user_entity; - $userstatic->photo = $obj->photo; - $userstatic->office_phone = $obj->office_phone; - $userstatic->office_fax = $obj->office_fax; - $userstatic->user_mobile = $obj->user_mobile; - $userstatic->job = $obj->job; - $userstatic->gender = $obj->gender; - - // Author - if (!empty($arrayfields['u.login']['checked'])) { - print ''; - if ($userstatic->id) { - print $userstatic->getNomUrl(-1); - } - print "\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - - if (!empty($arrayfields['sale_representative']['checked'])) { - // Sales representatives - print ''; - if ($obj->socid > 0) { - $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user); - if ($listsalesrepresentatives < 0) { - dol_print_error($db); + if (!$i) { + $totalarray['nbfield']++; } - $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->office_phone = $val['office_phone']; - $userstatic->office_fax = $val['office_fax']; - $userstatic->user_mobile = $val['user_mobile']; - $userstatic->job = $val['job']; - $userstatic->gender = $val['gender']; - //print '
': - print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2); - $j++; - if ($j < $nbofsalesrepresentative) { - print ' '; + } + + if (!empty($arrayfields['p.ref']['checked'])) { + print ''; + + print ''; + // Picto + Ref + print ''; + // Warning + $warnornote = ''; + if ($obj->status == Propal::STATUS_VALIDATED && $db->jdate($obj->dfv) < ($now - $conf->propal->cloture->warning_delay)) { + $warnornote .= img_warning($langs->trans("Late")); + } + if ($warnornote) { + print ''; + } + // Other picto tool + print '
'; + print $objectstatic->getNomUrl(1, '', '', 0, 1, (isset($conf->global->PROPAL_LIST_SHOW_NOTES) ? $conf->global->PROPAL_LIST_SHOW_NOTES : 1)); + print ''; + print $warnornote; + print ''; + $filename = dol_sanitizeFileName($obj->ref); + $filedir = $conf->propal->multidir_output[$obj->propal_entity].'/'.dol_sanitizeFileName($obj->ref); + $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid; + print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); + print '
'; + + print "\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + + if (!empty($arrayfields['p.ref_client']['checked'])) { + // Customer ref + print ''; + print dol_escape_htmltag($obj->ref_client); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + if (!empty($arrayfields['pr.ref']['checked'])) { + // Project ref + print ''; + if ($obj->project_id > 0) { + print $projectstatic->getNomUrl(1); + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + if (!empty($arrayfields['pr.title']['checked'])) { + // Project label + print ''; + if ($obj->project_id > 0) { + print dol_escape_htmltag($projectstatic->title); + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Thirdparty + if (!empty($arrayfields['s.nom']['checked'])) { + print ''; + print $companystatic->getNomUrl(1, 'customer', 0, 0, 1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Alias + if (!empty($arrayfields['s.name_alias']['checked'])) { + print ''; + print $obj->alias; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Town + if (!empty($arrayfields['s.town']['checked'])) { + print ''; + print $obj->town; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Zip + if (!empty($arrayfields['s.zip']['checked'])) { + print ''; + print $obj->zip; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // State + if (!empty($arrayfields['state.nom']['checked'])) { + print "".$obj->state_name."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Country + if (!empty($arrayfields['country.code_iso']['checked'])) { + print ''; + $tmparray = getCountry($obj->fk_pays, 'all'); + print $tmparray['label']; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Type ent + if (!empty($arrayfields['typent.code']['checked'])) { + if (!is_array($typenArray) || empty($typenArray)) { + $typenArray = $formcompany->typent_array(1); + } + + print ''; + print $typenArray[$obj->typent_code]; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Date proposal + if (!empty($arrayfields['p.date']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->dp), 'day'); + print "\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Date end validity + if (!empty($arrayfields['p.fin_validite']['checked'])) { + if ($obj->dfv) { + print ''.dol_print_date($db->jdate($obj->dfv), 'day'); + print ''; + } else { + print ' '; + } + if (!$i) { + $totalarray['nbfield']++; + } + } + // Date delivery + if (!empty($arrayfields['p.date_livraison']['checked'])) { + if ($obj->ddelivery) { + print ''.dol_print_date($db->jdate($obj->ddelivery), 'day'); + print ''; + } else { + print ' '; + } + if (!$i) { + $totalarray['nbfield']++; + } + } + // Date Signature + if (!empty($arrayfields['p.date_signature']['checked'])) { + if ($obj->dsignature) { + print ''.dol_print_date($db->jdate($obj->dsignature), 'day'); + print ''; + } else { + print ' '; + } + if (!$i) { + $totalarray['nbfield']++; + } + } + // Availability + if (!empty($arrayfields['ava.rowid']['checked'])) { + print ''; + $form->form_availability('', $obj->availability, 'none', 1); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Shipping Method + if (!empty($arrayfields['p.fk_shipping_method']['checked'])) { + print ''; + $form->formSelectShippingMethod('', $obj->fk_shipping_method, 'none', 1); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Source - input reason + if (!empty($arrayfields['p.fk_input_reason']['checked'])) { + print ''; + if ($obj->fk_input_reason > 0) { + print $form->cache_demand_reason[$obj->fk_input_reason]['label']; + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Payment terms + if (!empty($arrayfields['p.fk_cond_reglement']['checked'])) { + print ''; + $form->form_conditions_reglement($_SERVER['PHP_SELF'], $obj->fk_cond_reglement, 'none', 0, '', 1, $obj->deposit_percent); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Payment mode + if (!empty($arrayfields['p.fk_mode_reglement']['checked'])) { + print ''; + $form->form_modes_reglement($_SERVER['PHP_SELF'], $obj->fk_mode_reglement, 'none', '', -1); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Amount HT + if (!empty($arrayfields['p.total_ht']['checked'])) { + print ''.price($obj->total_ht)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'p.total_ht'; + } + if (empty($totalarray['val']['p.total_ht'])) { + $totalarray['val']['p.total_ht'] = $obj->total_ht; + } else { + $totalarray['val']['p.total_ht'] += $obj->total_ht; + } + } + // Amount VAT + if (!empty($arrayfields['p.total_tva']['checked'])) { + print ''.price($obj->total_tva)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'p.total_tva'; + } + if (empty($totalarray['val']['p.total_tva'])) { + $totalarray['val']['p.total_tva'] = $obj->total_tva; + } else { + $totalarray['val']['p.total_tva'] += $obj->total_tva; + } + } + // Amount TTC + if (!empty($arrayfields['p.total_ttc']['checked'])) { + print ''.price($obj->total_ttc)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'p.total_ttc'; + } + if (empty($totalarray['val']['p.total_ttc'])) { + $totalarray['val']['p.total_ttc'] = $obj->total_ttc; + } else { + $totalarray['val']['p.total_ttc'] += $obj->total_ttc; + } + } + // Amount invoiced HT + if (!empty($arrayfields['p.total_ht_invoiced']['checked'])) { + print ''.price($totalInvoicedHT)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'p.total_ht_invoiced'; + } + if (empty($totalarray['val']['p.total_ht_invoiced'])) { + $totalarray['val']['p.total_ht_invoiced'] = $totalInvoicedHT; + } else { + $totalarray['val']['p.total_ht_invoiced'] += $totalInvoicedHT; + } + } + // Amount invoiced TTC + if (!empty($arrayfields['p.total_invoiced']['checked'])) { + print ''.price($totalInvoicedTTC)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'p.total_invoiced'; + } + if (empty($totalarray['val']['p.total_invoiced'])) { + $totalarray['val']['p.total_invoiced'] = $totalInvoicedTTC; + } else { + $totalarray['val']['p.total_invoiced'] += $totalInvoicedTTC; + } + } + // Currency + if (!empty($arrayfields['p.multicurrency_code']['checked'])) { + print ''.$obj->multicurrency_code.' - '.$langs->trans('Currency'.$obj->multicurrency_code)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Currency rate + if (!empty($arrayfields['p.multicurrency_tx']['checked'])) { + print ''; + $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code); + print "\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Amount HT + if (!empty($arrayfields['p.multicurrency_total_ht']['checked'])) { + print ''.price($obj->multicurrency_total_ht)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Amount VAT + if (!empty($arrayfields['p.multicurrency_total_tva']['checked'])) { + print ''.price($obj->multicurrency_total_tva)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Amount TTC + if (!empty($arrayfields['p.multicurrency_total_ttc']['checked'])) { + print ''.price($obj->multicurrency_total_ttc)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Amount invoiced + if (!empty($arrayfields['p.multicurrency_total_ht_invoiced']['checked'])) { + print ''.price($multicurrency_totalInvoicedHT)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Amount invoiced + if (!empty($arrayfields['p.multicurrency_total_invoiced']['checked'])) { + print ''.price($multicurrency_totalInvoicedTTC)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + + $userstatic->id = $obj->fk_user_author; + $userstatic->login = $obj->login; + $userstatic->lastname = $obj->lastname; + $userstatic->firstname = $obj->firstname; + $userstatic->email = $obj->user_email; + $userstatic->statut = $obj->user_statut; + $userstatic->entity = $obj->user_entity; + $userstatic->photo = $obj->photo; + $userstatic->office_phone = $obj->office_phone; + $userstatic->office_fax = $obj->office_fax; + $userstatic->user_mobile = $obj->user_mobile; + $userstatic->job = $obj->job; + $userstatic->gender = $obj->gender; + + // Author + if (!empty($arrayfields['u.login']['checked'])) { + print ''; + if ($userstatic->id) { + print $userstatic->getNomUrl(-1); + } + print "\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + + if (!empty($arrayfields['sale_representative']['checked'])) { + // Sales representatives + print ''; + if ($obj->socid > 0) { + $listsalesrepresentatives = $companystatic->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->office_phone = $val['office_phone']; + $userstatic->office_fax = $val['office_fax']; + $userstatic->user_mobile = $val['user_mobile']; + $userstatic->job = $val['job']; + $userstatic->gender = $val['gender']; + //print '
': + print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2); + $j++; + if ($j < $nbofsalesrepresentative) { + print ' '; + } + //print '
'; } - //print '
'; + } + //else print $langs->trans("NoSalesRepresentativeAffected"); + } else { + print ' '; + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Total buying or cost price + if (!empty($arrayfields['total_pa']['checked'])) { + print ''.price($marginInfo['pa_total']).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Total margin + if (!empty($arrayfields['total_margin']['checked'])) { + print ''.price($marginInfo['total_margin']).''; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'total_margin'; + } + $totalarray['val']['total_margin'] = $total_margin; + } + // Total margin rate + if (!empty($arrayfields['total_margin_rate']['checked'])) { + print ''.(($marginInfo['total_margin_rate'] == '') ? '' : price($marginInfo['total_margin_rate'], null, null, null, null, 2).'%').''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Total mark rate + if (!empty($arrayfields['total_mark_rate']['checked'])) { + print ''.(($marginInfo['total_mark_rate'] == '') ? '' : price($marginInfo['total_mark_rate'], null, null, null, null, 2).'%').''; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'total_mark_rate'; + } + if ($i >= $imaxinloop - 1) { + if (!empty($total_ht)) { + $totalarray['val']['total_mark_rate'] = price2num($total_margin * 100 / $total_ht, 'MT'); + } else { + $totalarray['val']['total_mark_rate'] = ''; } } - //else print $langs->trans("NoSalesRepresentativeAffected"); - } else { - print ' '; } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Total buying or cost price - if (!empty($arrayfields['total_pa']['checked'])) { - print ''.price($marginInfo['pa_total']).''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Total margin - if (!empty($arrayfields['total_margin']['checked'])) { - print ''.price($marginInfo['total_margin']).''; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'total_margin'; - } - $totalarray['val']['total_margin'] = $total_margin; - } - // Total margin rate - if (!empty($arrayfields['total_margin_rate']['checked'])) { - print ''.(($marginInfo['total_margin_rate'] == '') ? '' : price($marginInfo['total_margin_rate'], null, null, null, null, 2).'%').''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Total mark rate - if (!empty($arrayfields['total_mark_rate']['checked'])) { - print ''.(($marginInfo['total_mark_rate'] == '') ? '' : price($marginInfo['total_mark_rate'], null, null, null, null, 2).'%').''; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'total_mark_rate'; - } - if ($i >= $imaxinloop - 1) { - if (!empty($total_ht)) { - $totalarray['val']['total_mark_rate'] = price2num($total_margin * 100 / $total_ht, 'MT'); - } else { - $totalarray['val']['total_mark_rate'] = ''; + // 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['p.datec']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); + print ''; + if (!$i) { + $totalarray['nbfield']++; } } - } - - // 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['p.datec']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date modification - if (!empty($arrayfields['p.tms']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date cloture - if (!empty($arrayfields['p.date_cloture']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_cloture), 'dayhour', 'tzuser'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Note public - if (!empty($arrayfields['p.note_public']['checked'])) { - print ''; - print dol_string_nohtmltag($obj->note_public); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Note private - if (!empty($arrayfields['p.note_private']['checked'])) { - print ''; - print dol_string_nohtmltag($obj->note_private); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Status - if (!empty($arrayfields['p.fk_statut']['checked'])) { - print ''.$objectstatic->getLibStatut(5).''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Action column - if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { - print ''; - 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; + // Date modification + if (!empty($arrayfields['p.tms']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); + print ''; + if (!$i) { + $totalarray['nbfield']++; } - print ''; } - print ''; - if (!$i) { - $totalarray['nbfield']++; + // Date cloture + if (!empty($arrayfields['p.date_cloture']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_cloture), 'dayhour', 'tzuser'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } + // Note public + if (!empty($arrayfields['p.note_public']['checked'])) { + print ''; + print dol_string_nohtmltag($obj->note_public); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Note private + if (!empty($arrayfields['p.note_private']['checked'])) { + print ''; + print dol_string_nohtmltag($obj->note_private); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Status + if (!empty($arrayfields['p.fk_statut']['checked'])) { + print ''.$objectstatic->getLibStatut(5).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Action column + if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; + 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 ''; + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + + print ''."\n"; } - - print ''."\n"; - $i++; } diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index ccf706c9ac7..c2ab4fcd3bc 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -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; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 29f990476ed..9b987cb603c 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -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; } diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 98d2b59d6a3..4fb5582e187 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -1526,16 +1526,16 @@ if ($resql) { } // Town if (!empty($arrayfields['s.town']['checked'])) { - print ''; + print ''; } // Zip if (!empty($arrayfields['s.zip']['checked'])) { - print ''; + print ''; } // State if (!empty($arrayfields['state.nom']['checked'])) { print ''; - print ''; + print ''; print ''; } // Country @@ -1723,18 +1723,18 @@ if ($resql) { } // Status billed if (!empty($arrayfields['c.facture']['checked'])) { - print ''; + print ''; print $form->selectyesno('search_billed', $search_billed, 1, 0, 1, 1); print ''; } // Import key if (!empty($arrayfields['c.import_key']['checked'])) { - print ''; + print ''; print ''; } // Status if (!empty($arrayfields['c.fk_statut']['checked'])) { - print ''; + print ''; $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 ''.$obj->import_key.''; + print ''.dol_escape_htmltag($obj->import_key).''; if (!$i) { $totalarray['nbfield']++; } @@ -2631,7 +2631,7 @@ if ($resql) { // Status if (!empty($arrayfields['c.fk_statut']['checked'])) { - print ''.$generic_commande->LibStatut($obj->fk_statut, $obj->billed, 5, 1).''; + print ''.$generic_commande->LibStatut($obj->fk_statut, $obj->billed, 5, 1).''; if (!$i) { $totalarray['nbfield']++; } diff --git a/htdocs/commande/list_det.php b/htdocs/commande/list_det.php index fd36f229e5c..2ef2d429900 100644 --- a/htdocs/commande/list_det.php +++ b/htdocs/commande/list_det.php @@ -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 ''; - print ''; - print ''; - $topicmail = "SendOrderRef"; $modelmail = "order_send"; $objecttmp = new Commande($db); @@ -849,6 +854,11 @@ if ($resql) { $moreforfilter = ''; + $moreforfilter .= ''; + $moreforfilter .= ''; + $moreforfilter .= ''; + $moreforfilter .= '
'; + // 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 .= '
'; } + + $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 ''.$obj->qty.''; - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'cdet.qty'; - } + print ''.$obj->qty.''; 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 diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 4aea92a510e..ab2ecf3a030 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -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 = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).''; + + if (property_exists($this, 'type_lib')) { + $return .= '
'.substr($this->type_lib[$this->type], 0, 24).'...'; + } + if (method_exists($this, 'solde')) { + $return .= '
'; + $return .= ''.$langs->trans("Balance").' : '.price($this->solde(1), 0, $langs, 1, -1, -1, $this->currency_code).''; + } + if (method_exists($this, 'getLibStatut')) { + $return .= '
'.$this->getLibStatut(5).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php index 3d07c280559..857b49d1576 100644 --- a/htdocs/compta/bank/class/paymentvarious.class.php +++ b/htdocs/compta/bank/class/paymentvarious.class.php @@ -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 = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).''; + if (property_exists($this, 'fk_bank')) { + $return .= ' | '.$this->fk_bank.''; + } + if (property_exists($this, 'datep')) { + $return .= '
'.$langs->trans("Date").' : '.dol_print_date($this->db->jdate($this->datep), 'day').''; + } + if (property_exists($this, 'type_payment') && !empty($this->type_payment)) { + $return .= '
'.$langs->trans("Payment", $this->type_payment).' : '.$this->type_payment.''; + } + if (property_exists($this, 'accountancy_code')) { + $return .= '
'.$langs->trans("Account").' : '.$this->accountancy_code.''; + } + if (property_exists($this, 'amount')) { + $return .= '
'.$langs->trans("Debit").' : '.price($this->amount).''; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index 098489e6f7b..2a0995af009 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -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 ''; print ''; print ''; +print ''; -$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 ''; - // Action column - if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - 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 ''; + print '
'; + } + // Output Kanban + print $objecttmp->getKanbanView(''); + if ($i == (min($num, $limit) - 1)) { + print '
'; + print ''; + } + } else { + print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + 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 ''; } - print ''; + print ''; } - print ''; - } - // Ref - if (!empty($arrayfields['b.ref']['checked'])) { - print ''.$objecttmp->getNomUrl(1).''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Label - if (!empty($arrayfields['b.label']['checked'])) { - print ''.dol_escape_htmltag($objecttmp->label).''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Account type - if (!empty($arrayfields['accountype']['checked'])) { - print ''; - print $objecttmp->type_lib[$objecttmp->type]; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Number - if (!empty($arrayfields['b.number']['checked'])) { - print ''.dol_escape_htmltag($objecttmp->number).''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Account number - if (!empty($arrayfields['b.account_number']['checked'])) { - print ''; - if (isModEnabled('accounting') && !empty($objecttmp->account_number)) { - $accountingaccount = new AccountingAccount($db); - $accountingaccount->fetch('', $objecttmp->account_number, 1); - print ''; - print $accountingaccount->getNomUrl(0, 1, 1, '', 0); - print ''; - } else { - print ''.$objecttmp->account_number.''; - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Accountancy journal - if (!empty($arrayfields['b.fk_accountancy_journal']['checked'])) { - print ''; - 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 ''.$objecttmp->getNomUrl(1).''; + if (!$i) { + $totalarray['nbfield']++; } - } else { - print ''; - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Currency - if (!empty($arrayfields['b.currency_code']['checked'])) { - print ''; - print $objecttmp->currency_code; - print ''; - 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 ''; - if ($conciliate == -2) { - print ''.$langs->trans("CashAccount").''; - } elseif ($conciliate == -3) { - print ''.$langs->trans("Closed").''; - } elseif (empty($objecttmp->rappro)) { - print ''.$langs->trans("ConciliationDisabled").''; - } else { - $result = $objecttmp->load_board($user, $objecttmp->id); - if (is_numeric($result) && $result < 0) { - setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); - } else { - print '
'; - print ''; - print $result->nbtodo; + // Label + if (!empty($arrayfields['b.label']['checked'])) { + print ''.dol_escape_htmltag($objecttmp->label).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Account type + if (!empty($arrayfields['accountype']['checked'])) { + print ''; + print $objecttmp->type_lib[$objecttmp->type]; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Number + if (!empty($arrayfields['b.number']['checked'])) { + print ''.dol_escape_htmltag($objecttmp->number).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Account number + if (!empty($arrayfields['b.account_number']['checked'])) { + print ''; + if (isModEnabled('accounting') && !empty($objecttmp->account_number)) { + $accountingaccount = new AccountingAccount($db); + $accountingaccount->fetch('', $objecttmp->account_number, 1); + print ''; + print $accountingaccount->getNomUrl(0, 1, 1, '', 0); print ''; - print ''; - if ($result->nbtodolate) { - print ''; - print ' '.$result->nbtodolate; + } else { + print ''.$objecttmp->account_number.''; + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Accountancy journal + if (!empty($arrayfields['b.fk_accountancy_journal']['checked'])) { + print ''; + 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 ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Currency + if (!empty($arrayfields['b.currency_code']['checked'])) { + print ''; + print $objecttmp->currency_code; + print ''; + 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 ''; + if ($conciliate == -2) { + print ''.$langs->trans("CashAccount").''; + } elseif ($conciliate == -3) { + print ''.$langs->trans("Closed").''; + } elseif (empty($objecttmp->rappro)) { + print ''.$langs->trans("ConciliationDisabled").''; + } else { + $result = $objecttmp->load_board($user, $objecttmp->id); + if (is_numeric($result) && $result < 0) { + setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); + } else { + print ''; + print ''; + print $result->nbtodo; print ''; + print ''; + if ($result->nbtodolate) { + print ''; + print ' '.$result->nbtodolate; + print ''; + } } } - } - print ''; - 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 ''; - print dol_print_date($objecttmp->date_creation, 'dayhour'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date modification - if (!empty($arrayfields['b.tms']['checked'])) { - print ''; - print dol_print_date($objecttmp->date_update, 'dayhour'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Status - if (!empty($arrayfields['b.clos']['checked'])) { - print ''.$objecttmp->getLibStatut(5).''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Balance - if (!empty($arrayfields['balance']['checked'])) { - print ''; - print ''; - print ''.price($solde, 0, $langs, 1, -1, -1, $objecttmp->currency_code).''; - print ''; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'balance'; - } - $totalarray['val']['balance'] += $solde; - } - - // Action column - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - 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 ''; + if (!$i) { + $totalarray['nbfield']++; } - print ''; } - print ''; - } - if (!$i) { - $totalarray['nbfield']++; - } - print ''; + // 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 ''; + print dol_print_date($objecttmp->date_creation, 'dayhour'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Date modification + if (!empty($arrayfields['b.tms']['checked'])) { + print ''; + print dol_print_date($objecttmp->date_update, 'dayhour'); + print ''; + 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 ''.$objecttmp->getLibStatut(5).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Balance + if (!empty($arrayfields['balance']['checked'])) { + print ''; + print ''; + print ''.price($solde, 0, $langs, 1, -1, -1, $objecttmp->currency_code).''; + print ''; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'balance'; + } + $totalarray['val']['balance'] += $solde; + } + + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + 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 ''; + } + print ''; + } + if (!$i) { + $totalarray['nbfield']++; + } + + print ''; + + if (empty($total[$objecttmp->currency_code])) { + $total[$objecttmp->currency_code] = $solde; + } else { + $total[$objecttmp->currency_code] += $solde; + } } - $i++; } diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index 5adde527f34..70abe873cba 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -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 '
'; @@ -376,6 +383,8 @@ if ($resql) { print ''; print ''; print ''; + print ''; + 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 ''; + $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 ''.(($offset * $limit) + $i).''; - } - - // Ref - if ($arrayfields['ref']['checked']) { - print ''.$variousstatic->getNomUrl(1).""; - if (!$i) { - $totalarray['nbfield']++; + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; } - } + // Output Kanban - // Label payment - if ($arrayfields['label']['checked']) { - print ''.$variousstatic->label.""; - if (!$i) { - $totalarray['nbfield']++; + print $variousstatic->getKanbanView(''); + if ($i == (min($num, $limit) - 1)) { + print '
'; + print ''; } - } + } else { + print ''; - // Date payment - if ($arrayfields['datep']['checked']) { - print ''.dol_print_date($obj->datep, 'day').""; - if (!$i) { - $totalarray['nbfield']++; + // No + if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { + print ''.(($offset * $limit) + $i).''; } - } - - // Date value - if ($arrayfields['datev']['checked']) { - print ''.dol_print_date($obj->datev, 'day').""; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Type - if ($arrayfields['type']['checked']) { - print ''; - if ($obj->payment_code) { - print $langs->trans("PaymentTypeShort".$obj->payment_code); - print ' '; - } - print $obj->num_payment; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Project - if ($arrayfields['project']['checked']) { - print ''; - if ($obj->fk_project > 0) { - $proj->fetch($obj->fk_project); - print $proj->getNomUrl(1); - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Bank account - if ($arrayfields['bank']['checked']) { - print ''; - 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 ''.$variousstatic->getNomUrl(1).""; + if (!$i) { + $totalarray['nbfield']++; } - - $accountstatic->label = $obj->blabel; - print $accountstatic->getNomUrl(1); - } else { - print ' '; } - print ''; + + // Label payment + if ($arrayfields['label']['checked']) { + print ''.$variousstatic->label.""; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Date payment + if ($arrayfields['datep']['checked']) { + print ''.dol_print_date($obj->datep, 'day').""; + if (!$i) { + $totalarray['nbfield']++; + } + } + + + // Date value + if ($arrayfields['datev']['checked']) { + print ''.dol_print_date($obj->datev, 'day').""; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Type + if ($arrayfields['type']['checked']) { + print ''; + if ($obj->payment_code) { + print $langs->trans("PaymentTypeShort".$obj->payment_code); + print ' '; + } + print $obj->num_payment; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Project + if ($arrayfields['project']['checked']) { + print ''; + if ($obj->fk_project > 0) { + $proj->fetch($obj->fk_project); + print $proj->getNomUrl(1); + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Bank account + if ($arrayfields['bank']['checked']) { + print ''; + 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 ' '; + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Bank entry + if ($arrayfields['entry']['checked']) { + $bankline->fetch($obj->fk_bank); + print ''.$bankline->getNomUrl(1).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Accounting account + if (!empty($arrayfields['account']['checked'])) { + $accountingaccount->fetch('', $obj->accountancy_code, 1); + + print ''.$accountingaccount->getNomUrl(0, 1, 1, '', 1).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Accounting subledger account + if (!empty($arrayfields['subledger']['checked'])) { + print ''.length_accounta($obj->subledger_account).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Debit + if ($arrayfields['debit']['checked']) { + print ''; + if ($obj->sens == 0) { + print ''.price($obj->amount).''; + $totalarray['val']['total_deb'] += $obj->amount; + } + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'total_deb'; + } + print ''; + } + + // Credit + if ($arrayfields['credit']['checked']) { + print ''; + if ($obj->sens == 1) { + print ''.price($obj->amount).''; + $totalarray['val']['total_cred'] += $obj->amount; + } + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'total_cred'; + } + print ''; + } + + print ''; + if (!$i) { $totalarray['nbfield']++; } + + print ''."\n"; } - - // Bank entry - if ($arrayfields['entry']['checked']) { - $bankline->fetch($obj->fk_bank); - print ''.$bankline->getNomUrl(1).''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Accounting account - if (!empty($arrayfields['account']['checked'])) { - $accountingaccount->fetch('', $obj->accountancy_code, 1); - - print ''.$accountingaccount->getNomUrl(0, 1, 1, '', 1).''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Accounting subledger account - if (!empty($arrayfields['subledger']['checked'])) { - print ''.length_accounta($obj->subledger_account).''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Debit - if ($arrayfields['debit']['checked']) { - print ''; - if ($obj->sens == 0) { - print ''.price($obj->amount).''; - $totalarray['val']['total_deb'] += $obj->amount; - } - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'total_deb'; - } - print ''; - } - - // Credit - if ($arrayfields['credit']['checked']) { - print ''; - if ($obj->sens == 1) { - print ''.price($obj->amount).''; - $totalarray['val']['total_cred'] += $obj->amount; - } - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'total_cred'; - } - print ''; - } - - print ''; - - if (!$i) { - $totalarray['nbfield']++; - } - - print ''."\n"; - $i++; } diff --git a/htdocs/compta/cashcontrol/cashcontrol_list.php b/htdocs/compta/cashcontrol/cashcontrol_list.php index 7d433282367..a1e5dae0c91 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_list.php +++ b/htdocs/compta/cashcontrol/cashcontrol_list.php @@ -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 ''; print ''; print ''; print ''; +print ''; $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 ''; - 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 ''; + print '
'; } - 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 'getKanbanView(''); + if ($i == (min($num, $limit) - 1)) { + print '
'; + print ''; + } + } else { + // Show here line of result + $j = 0; + print ''; + 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 ''; - 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 ''; + 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 ''; 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 ''; - 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 ''; + 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 ''; + } + print ''; + if (!$i) { + $totalarray['nbfield']++; } - print ''; - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - - print ''."\n"; + print ''."\n"; + } $i++; } diff --git a/htdocs/compta/cashcontrol/class/cashcontrol.class.php b/htdocs/compta/cashcontrol/class/cashcontrol.class.php index bc45f3b417d..01bebc35f5d 100644 --- a/htdocs/compta/cashcontrol/class/cashcontrol.class.php +++ b/htdocs/compta/cashcontrol/class/cashcontrol.class.php @@ -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 = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + //var_dump($this->fields['rowid']);exit; + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1, 1) : $this->ref).''; + if (property_exists($this, 'posmodule')) { + $return .= '
'.substr($langs->trans("Module/Application"), 0, 12).' : '.$this->posmodule.''; + } + if (property_exists($this, 'year_close')) { + $return .= '
'.$langs->trans("Year").' : '.$this->year_close.''; + } + if (method_exists($this, 'getLibStatut')) { + $return .= '
'.$this->getLibStatut(5).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index cc6b92f72cb..5f24ca87830 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -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)); diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 46262ab84b8..269c5267ab3 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -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), diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 0a9b0dcfe16..1af653e14d1 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -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 = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + //$return .= ''; // Can be image + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).''; + if (property_exists($this, 'socid')) { + $return .= '
'.$this->socid.''; + } + if (property_exists($this, 'fk_user_author')) { + $return .= '
'.$this->fk_user_author.''; + } + if (method_exists($this, 'getLibStatut')) { + $return .= '
'.$this->getLibStatut(5).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } /** diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 4f87cf8bc69..0b5903c54c4 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -75,6 +75,7 @@ $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); $optioncss = GETPOST('optioncss', 'alpha'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'invoicelist'; +$mode = GETPOST('mode', 'alpha'); if ($contextpage == 'poslist') { $optioncss = 'print'; @@ -974,6 +975,9 @@ if ($resql) { } $param = '&socid='.urlencode($socid); + if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); + } if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -1185,6 +1189,9 @@ if ($resql) { if (!empty($socid)) { $url .= '&socid='.$socid; } + $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('NewBill'), '', 'fa fa-plus-circle', $url, '', $user->hasRight("facture", "creer")); } @@ -1204,6 +1211,7 @@ if ($resql) { print ''; print ''; print ''; + print ''; print_barre_liste($langs->trans('BillsCustomers').' '.($socid > 0 ? ' '.$soc->name : ''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'bill', 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -1894,645 +1902,660 @@ if ($resql) { $total_margin += $marginInfo['total_margin']; } - print 'ref)); - print 'parent.place=\''.$place.'\''; + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; } - print '});"'; - } - print '>'; - - - // Action column - if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { - print ''; - if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // 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->id, $arrayofselected)) { - $selected = 1; + // Output Kanban + $facturestatic->socid = $companystatic->getNomUrl(1, 'company', 15); + $userstatic->fetch($obj->fk_user_author); + $facturestatic->fk_user_author = $userstatic->getNomUrl(1); + print $facturestatic->getKanbanView(''); + if ($i == (min($num, $limit) - 1)) { + print '
'; + print ''; + } + } else { + print 'ref)); + print 'parent.place=\''.$place.'\''; } - print ''; + print '});"'; } - print ''; - } + print '>'; - // No - if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { - print ''.(($offset * $limit) + $i).''; - } - // Ref - if (!empty($arrayfields['f.ref']['checked'])) { - print ''; - - print ''; - - print ''; - print ''; - print '
'; - if ($contextpage == 'poslist') { - print dol_escape_htmltag($obj->ref); - } else { - print $facturestatic->getNomUrl(1, '', 200, 0, '', 0, 1); - } - - $filename = dol_sanitizeFileName($obj->ref); - $filedir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($obj->ref); - $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->id; - print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir); - print '
'; - - print "\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Customer ref - if (!empty($arrayfields['f.ref_client']['checked'])) { - print ''; - print dol_escape_htmltag($obj->ref_client); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Type - if (!empty($arrayfields['f.type']['checked'])) { - print ''; - print $facturestatic->getLibType(2); - print ""; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Date - if (!empty($arrayfields['f.datef']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->datef), 'day'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Date - if (!empty($arrayfields['f.date_valid']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_valid), 'day'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Date limit - if (!empty($arrayfields['f.date_lim_reglement']['checked'])) { - print ''.dol_print_date($datelimit, 'day'); - if ($facturestatic->hasDelay()) { - print img_warning($langs->trans('Alert').' - '.$langs->trans('Late')); - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Project ref - if (!empty($arrayfields['p.ref']['checked'])) { - print ''; - if ($obj->project_id > 0) { - print $projectstatic->getNomUrl(1); - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Project title - if (!empty($arrayfields['p.title']['checked'])) { - print ''; - if ($obj->project_id > 0) { - print dol_escape_htmltag($projectstatic->title); - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Third party - if (!empty($arrayfields['s.nom']['checked'])) { - print ''; - if ($contextpage == 'poslist') { - print dol_escape_htmltag($companystatic->name); - } else { - print $companystatic->getNomUrl(1, 'customer', 0, 0, -1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1); - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Alias - if (!empty($arrayfields['s.name_alias']['checked'])) { - print ''; - print dol_escape_htmltag($companystatic->name_alias); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Parent company - if (!empty($arrayfields['s2.nom']['checked'])) { - print ''; - if ($obj->fk_parent > 0) { - if (!isset($company_url_list[$obj->fk_parent])) { - $companyparent = new Societe($db); - $res = $companyparent->fetch($obj->fk_parent); - if ($res > 0) { - $company_url_list[$obj->fk_parent] = $companyparent->getNomUrl(1); + // Action column + if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; + if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // 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->id, $arrayofselected)) { + $selected = 1; } + print ''; } - if (isset($company_url_list[$obj->fk_parent])) { - print $company_url_list[$obj->fk_parent]; + print ''; + } + + // No + if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { + print ''.(($offset * $limit) + $i).''; + } + + // Ref + if (!empty($arrayfields['f.ref']['checked'])) { + print ''; + + print ''; + + print ''; + print ''; + print '
'; + if ($contextpage == 'poslist') { + print dol_escape_htmltag($obj->ref); + } else { + print $facturestatic->getNomUrl(1, '', 200, 0, '', 0, 1); + } + + $filename = dol_sanitizeFileName($obj->ref); + $filedir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($obj->ref); + $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->id; + print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir); + print '
'; + + print "\n"; + if (!$i) { + $totalarray['nbfield']++; } } - print ""; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Town - if (!empty($arrayfields['s.town']['checked'])) { - print ''; - print dol_escape_htmltag($obj->town); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Zip - if (!empty($arrayfields['s.zip']['checked'])) { - print ''; - print dol_escape_htmltag($obj->zip); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // State - if (!empty($arrayfields['state.nom']['checked'])) { - print "".dol_escape_htmltag($obj->state_name)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Country - if (!empty($arrayfields['country.code_iso']['checked'])) { - print ''; - $tmparray = getCountry($obj->fk_pays, 'all'); - print $tmparray['label']; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Type ent - if (!empty($arrayfields['typent.code']['checked'])) { - print ''; - if (!is_array($typenArray) || count($typenArray) == 0) { - $typenArray = $formcompany->typent_array(1); - } - print $typenArray[$obj->typent_code]; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Staff - if (!empty($arrayfields['staff.code']['checked'])) { - print ''; - if (!is_array($conf->cache['staff']) || count($conf->cache['staff']) == 0) { - $conf->cache['staff'] = $formcompany->effectif_array(1); - } - print $conf->cache['staff'][$obj->staff_code]; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Payment mode - if (!empty($arrayfields['f.fk_mode_reglement']['checked'])) { - $s = $form->form_modes_reglement($_SERVER['PHP_SELF'], $obj->fk_mode_reglement, 'none', '', -1, 0, '', 1); - print ''; - print $s; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Payment terms - if (!empty($arrayfields['f.fk_cond_reglement']['checked'])) { - $s = $form->form_conditions_reglement($_SERVER['PHP_SELF'], $obj->fk_cond_reglement, 'none', 0, '', -1, -1, 1); - print ''; - print $s; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Module Source - if (!empty($arrayfields['f.module_source']['checked'])) { - print ''; - print dol_escape_htmltag($obj->module_source); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // POS Terminal - if (!empty($arrayfields['f.pos_source']['checked'])) { - print ''; - print dol_escape_htmltag($obj->pos_source); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Amount HT - if (!empty($arrayfields['f.total_ht']['checked'])) { - print ''.price($obj->total_ht)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'f.total_ht'; - } - $totalarray['val']['f.total_ht'] += $obj->total_ht; - } - // Amount VAT - if (!empty($arrayfields['f.total_tva']['checked'])) { - print ''.price($obj->total_tva)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'f.total_tva'; - } - $totalarray['val']['f.total_tva'] += $obj->total_tva; - } - // Amount LocalTax1 - if (!empty($arrayfields['f.total_localtax1']['checked'])) { - print ''.price($obj->total_localtax1)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'f.total_localtax1'; - } - $totalarray['val']['f.total_localtax1'] += $obj->total_localtax1; - } - // Amount LocalTax2 - if (!empty($arrayfields['f.total_localtax2']['checked'])) { - print ''.price($obj->total_localtax2)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'f.total_localtax2'; - } - $totalarray['val']['f.total_localtax2'] += $obj->total_localtax2; - } - // Amount TTC - if (!empty($arrayfields['f.total_ttc']['checked'])) { - print ''.price($obj->total_ttc)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'f.total_ttc'; - } - $totalarray['val']['f.total_ttc'] += $obj->total_ttc; - } - - $userstatic->id = $obj->fk_user_author; - $userstatic->login = $obj->login; - $userstatic->lastname = $obj->lastname; - $userstatic->firstname = $obj->firstname; - $userstatic->email = $obj->user_email; - $userstatic->statut = $obj->user_statut; - $userstatic->entity = $obj->entity; - $userstatic->photo = $obj->photo; - $userstatic->office_phone = $obj->office_phone; - $userstatic->office_fax = $obj->office_fax; - $userstatic->user_mobile = $obj->user_mobile; - $userstatic->job = $obj->job; - $userstatic->gender = $obj->gender; - - // Author - if (!empty($arrayfields['u.login']['checked'])) { - print ''; - if ($userstatic->id) { - print $userstatic->getNomUrl(-1); - } else { - print ' '; - } - print "\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - - if (!empty($arrayfields['sale_representative']['checked'])) { - // Sales representatives - print ''; - if ($obj->socid > 0) { - $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user); - if ($listsalesrepresentatives < 0) { - dol_print_error($db); + // Customer ref + if (!empty($arrayfields['f.ref_client']['checked'])) { + print ''; + print dol_escape_htmltag($obj->ref_client); + print ''; + if (!$i) { + $totalarray['nbfield']++; } - $nbofsalesrepresentative = count($listsalesrepresentatives); - if ($nbofsalesrepresentative > 6) { - // We print only number - print $nbofsalesrepresentative; - } elseif ($nbofsalesrepresentative > 0) { - $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->office_phone = $val['office_phone']; - $userstatic->office_fax = $val['office_fax']; - $userstatic->user_mobile = $val['user_mobile']; - $userstatic->job = $val['job']; - $userstatic->gender = $val['gender']; - //print '
': - print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2); - $j++; - if ($j < $nbofsalesrepresentative) { - print ' '; + } + + // Type + if (!empty($arrayfields['f.type']['checked'])) { + print ''; + print $facturestatic->getLibType(2); + print ""; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Date + if (!empty($arrayfields['f.datef']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->datef), 'day'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Date + if (!empty($arrayfields['f.date_valid']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_valid), 'day'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Date limit + if (!empty($arrayfields['f.date_lim_reglement']['checked'])) { + print ''.dol_print_date($datelimit, 'day'); + if ($facturestatic->hasDelay()) { + print img_warning($langs->trans('Alert').' - '.$langs->trans('Late')); + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Project ref + if (!empty($arrayfields['p.ref']['checked'])) { + print ''; + if ($obj->project_id > 0) { + print $projectstatic->getNomUrl(1); + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Project title + if (!empty($arrayfields['p.title']['checked'])) { + print ''; + if ($obj->project_id > 0) { + print dol_escape_htmltag($projectstatic->title); + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Third party + if (!empty($arrayfields['s.nom']['checked'])) { + print ''; + if ($contextpage == 'poslist') { + print dol_escape_htmltag($companystatic->name); + } else { + print $companystatic->getNomUrl(1, 'customer', 0, 0, -1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1); + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Alias + if (!empty($arrayfields['s.name_alias']['checked'])) { + print ''; + print dol_escape_htmltag($companystatic->name_alias); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Parent company + if (!empty($arrayfields['s2.nom']['checked'])) { + print ''; + if ($obj->fk_parent > 0) { + if (!isset($company_url_list[$obj->fk_parent])) { + $companyparent = new Societe($db); + $res = $companyparent->fetch($obj->fk_parent); + if ($res > 0) { + $company_url_list[$obj->fk_parent] = $companyparent->getNomUrl(1); } - //print '
'; + } + if (isset($company_url_list[$obj->fk_parent])) { + print $company_url_list[$obj->fk_parent]; } } - //else print $langs->trans("NoSalesRepresentativeAffected"); - } else { - print ' '; + print ""; + if (!$i) { + $totalarray['nbfield']++; + } } - print ''; - if (!$i) { - $totalarray['nbfield']++; + // Town + if (!empty($arrayfields['s.town']['checked'])) { + print ''; + print dol_escape_htmltag($obj->town); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Zip + if (!empty($arrayfields['s.zip']['checked'])) { + print ''; + print dol_escape_htmltag($obj->zip); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // State + if (!empty($arrayfields['state.nom']['checked'])) { + print "".dol_escape_htmltag($obj->state_name)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Country + if (!empty($arrayfields['country.code_iso']['checked'])) { + print ''; + $tmparray = getCountry($obj->fk_pays, 'all'); + print $tmparray['label']; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Type ent + if (!empty($arrayfields['typent.code']['checked'])) { + print ''; + if (!is_array($typenArray) || count($typenArray) == 0) { + $typenArray = $formcompany->typent_array(1); + } + print $typenArray[$obj->typent_code]; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Staff + if (!empty($arrayfields['staff.code']['checked'])) { + print ''; + if (!is_array($conf->cache['staff']) || count($conf->cache['staff']) == 0) { + $conf->cache['staff'] = $formcompany->effectif_array(1); + } + print $conf->cache['staff'][$obj->staff_code]; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } - } - if (!empty($arrayfields['f.retained_warranty']['checked'])) { - print ''.(!empty($obj->retained_warranty) ? price($obj->retained_warranty).'%' : ' ').''; - } + // Payment mode + if (!empty($arrayfields['f.fk_mode_reglement']['checked'])) { + $s = $form->form_modes_reglement($_SERVER['PHP_SELF'], $obj->fk_mode_reglement, 'none', '', -1, 0, '', 1); + print ''; + print $s; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } - if (!empty($arrayfields['dynamount_payed']['checked'])) { - print ''.(!empty($totalpay) ? price($totalpay, 0, $langs) : ' ').''; // TODO Use a denormalized field - if (!$i) { - $totalarray['nbfield']++; + // Payment terms + if (!empty($arrayfields['f.fk_cond_reglement']['checked'])) { + $s = $form->form_conditions_reglement($_SERVER['PHP_SELF'], $obj->fk_cond_reglement, 'none', 0, '', -1, -1, 1); + print ''; + print $s; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'totalam'; - } - $totalarray['val']['totalam'] += $totalpay; - } - // Pending amount - if (!empty($arrayfields['rtp']['checked'])) { - print ''; - print (!empty($remaintopay) ? price($remaintopay, 0, $langs) : ' '); - print ''; // TODO Use a denormalized field - if (!$i) { - $totalarray['nbfield']++; + // Module Source + if (!empty($arrayfields['f.module_source']['checked'])) { + print ''; + print dol_escape_htmltag($obj->module_source); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'rtp'; - } - $totalarray['val']['rtp'] += $remaintopay; - } + // POS Terminal + if (!empty($arrayfields['f.pos_source']['checked'])) { + print ''; + print dol_escape_htmltag($obj->pos_source); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } - // Currency - if (!empty($arrayfields['f.multicurrency_code']['checked'])) { - print ''; - if (empty($conf->global->MAIN_SHOW_ONLY_CODE_MULTICURRENCY)) { - print $langs->transnoentitiesnoconv('Currency'.$obj->multicurrency_code); - } else { - print dol_escape_htmltag($obj->multicurrency_code); + // Amount HT + if (!empty($arrayfields['f.total_ht']['checked'])) { + print ''.price($obj->total_ht)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'f.total_ht'; + } + $totalarray['val']['f.total_ht'] += $obj->total_ht; } - print "\n"; - if (!$i) { - $totalarray['nbfield']++; + // Amount VAT + if (!empty($arrayfields['f.total_tva']['checked'])) { + print ''.price($obj->total_tva)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'f.total_tva'; + } + $totalarray['val']['f.total_tva'] += $obj->total_tva; + } + // Amount LocalTax1 + if (!empty($arrayfields['f.total_localtax1']['checked'])) { + print ''.price($obj->total_localtax1)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'f.total_localtax1'; + } + $totalarray['val']['f.total_localtax1'] += $obj->total_localtax1; + } + // Amount LocalTax2 + if (!empty($arrayfields['f.total_localtax2']['checked'])) { + print ''.price($obj->total_localtax2)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'f.total_localtax2'; + } + $totalarray['val']['f.total_localtax2'] += $obj->total_localtax2; + } + // Amount TTC + if (!empty($arrayfields['f.total_ttc']['checked'])) { + print ''.price($obj->total_ttc)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'f.total_ttc'; + } + $totalarray['val']['f.total_ttc'] += $obj->total_ttc; } - } - // Currency rate - if (!empty($arrayfields['f.multicurrency_tx']['checked'])) { - print ''; - $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code); - print "\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Amount HT - if (!empty($arrayfields['f.multicurrency_total_ht']['checked'])) { - print ''.price($obj->multicurrency_total_ht)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Amount VAT - if (!empty($arrayfields['f.multicurrency_total_vat']['checked'])) { - print ''.price($obj->multicurrency_total_vat)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Amount TTC - if (!empty($arrayfields['f.multicurrency_total_ttc']['checked'])) { - print ''.price($obj->multicurrency_total_ttc)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['multicurrency_dynamount_payed']['checked'])) { - print ''.(!empty($multicurrency_totalpay) ?price($multicurrency_totalpay, 0, $langs) : ' ').''; // TODO Use a denormalized field - if (!$i) { - $totalarray['nbfield']++; - } - } + $userstatic->id = $obj->fk_user_author; + $userstatic->login = $obj->login; + $userstatic->lastname = $obj->lastname; + $userstatic->firstname = $obj->firstname; + $userstatic->email = $obj->user_email; + $userstatic->statut = $obj->user_statut; + $userstatic->entity = $obj->entity; + $userstatic->photo = $obj->photo; + $userstatic->office_phone = $obj->office_phone; + $userstatic->office_fax = $obj->office_fax; + $userstatic->user_mobile = $obj->user_mobile; + $userstatic->job = $obj->job; + $userstatic->gender = $obj->gender; - // Pending amount - if (!empty($arrayfields['multicurrency_rtp']['checked'])) { - print ''; - print (!empty($multicurrency_remaintopay) ? price($multicurrency_remaintopay, 0, $langs) : ' '); - print ''; // TODO Use a denormalized field - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Total buying or cost price - if (!empty($arrayfields['total_pa']['checked'])) { - print ''.price($marginInfo['pa_total']).''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Total margin - if (!empty($arrayfields['total_margin']['checked'])) { - print ''.price($marginInfo['total_margin']).''; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'total_margin'; - } - $totalarray['val']['total_margin'] += $marginInfo['total_margin']; - } - // Total margin rate - if (!empty($arrayfields['total_margin_rate']['checked'])) { - print ''.(($marginInfo['total_margin_rate'] == '') ? '' : price($marginInfo['total_margin_rate'], null, null, null, null, 2).'%').''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Total mark rate - if (!empty($arrayfields['total_mark_rate']['checked'])) { - print ''.(($marginInfo['total_mark_rate'] == '') ? '' : price($marginInfo['total_mark_rate'], null, null, null, null, 2).'%').''; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'total_mark_rate'; - } - if ($i >= $imaxinloop - 1) { - if (!empty($total_ht)) { - $totalarray['val']['total_mark_rate'] = price2num($total_margin * 100 / $total_ht, 'MT'); + // Author + if (!empty($arrayfields['u.login']['checked'])) { + print ''; + if ($userstatic->id) { + print $userstatic->getNomUrl(-1); } else { - $totalarray['val']['total_mark_rate'] = ''; + print ' '; + } + print "\n"; + if (!$i) { + $totalarray['nbfield']++; } } - } - // 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['f.datec']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date modification - if (!empty($arrayfields['f.tms']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date closing - if (!empty($arrayfields['f.date_closing']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_closing), 'dayhour', 'tzuser'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Note public - if (!empty($arrayfields['f.note_public']['checked'])) { - print ''; - print dol_string_nohtmltag($obj->note_public); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Note private - if (!empty($arrayfields['f.note_private']['checked'])) { - print ''; - print dol_string_nohtmltag($obj->note_private); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Template Invoice - if (!empty($arrayfields['f.fk_fac_rec_source']['checked'])) { - print ''; - if (!empty($obj->fk_fac_rec_source)) { - $facrec = new FactureRec($db); - $result = $facrec->fetch($obj->fk_fac_rec_source); - if ($result < 0) { - setEventMessages($facrec->error, $facrec->errors, 'errors'); + if (!empty($arrayfields['sale_representative']['checked'])) { + // Sales representatives + print ''; + if ($obj->socid > 0) { + $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user); + if ($listsalesrepresentatives < 0) { + dol_print_error($db); + } + $nbofsalesrepresentative = count($listsalesrepresentatives); + if ($nbofsalesrepresentative > 6) { + // We print only number + print $nbofsalesrepresentative; + } elseif ($nbofsalesrepresentative > 0) { + $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->office_phone = $val['office_phone']; + $userstatic->office_fax = $val['office_fax']; + $userstatic->user_mobile = $val['user_mobile']; + $userstatic->job = $val['job']; + $userstatic->gender = $val['gender']; + //print '
': + print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2); + $j++; + if ($j < $nbofsalesrepresentative) { + print ' '; + } + //print '
'; + } + } + //else print $langs->trans("NoSalesRepresentativeAffected"); } else { - print $facrec->getNomUrl(); + print ' '; + } + print ''; + if (!$i) { + $totalarray['nbfield']++; } } - print ''; + + if (!empty($arrayfields['f.retained_warranty']['checked'])) { + print ''.(!empty($obj->retained_warranty) ? price($obj->retained_warranty).'%' : ' ').''; + } + + if (!empty($arrayfields['dynamount_payed']['checked'])) { + print ''.(!empty($totalpay) ? price($totalpay, 0, $langs) : ' ').''; // TODO Use a denormalized field + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'totalam'; + } + $totalarray['val']['totalam'] += $totalpay; + } + + // Pending amount + if (!empty($arrayfields['rtp']['checked'])) { + print ''; + print (!empty($remaintopay) ? price($remaintopay, 0, $langs) : ' '); + print ''; // TODO Use a denormalized field + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'rtp'; + } + $totalarray['val']['rtp'] += $remaintopay; + } + + + // Currency + if (!empty($arrayfields['f.multicurrency_code']['checked'])) { + print ''; + if (empty($conf->global->MAIN_SHOW_ONLY_CODE_MULTICURRENCY)) { + print $langs->transnoentitiesnoconv('Currency'.$obj->multicurrency_code); + } else { + print dol_escape_htmltag($obj->multicurrency_code); + } + print "\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Currency rate + if (!empty($arrayfields['f.multicurrency_tx']['checked'])) { + print ''; + $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code); + print "\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Amount HT + if (!empty($arrayfields['f.multicurrency_total_ht']['checked'])) { + print ''.price($obj->multicurrency_total_ht)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Amount VAT + if (!empty($arrayfields['f.multicurrency_total_vat']['checked'])) { + print ''.price($obj->multicurrency_total_vat)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Amount TTC + if (!empty($arrayfields['f.multicurrency_total_ttc']['checked'])) { + print ''.price($obj->multicurrency_total_ttc)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['multicurrency_dynamount_payed']['checked'])) { + print ''.(!empty($multicurrency_totalpay) ?price($multicurrency_totalpay, 0, $langs) : ' ').''; // TODO Use a denormalized field + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Pending amount + if (!empty($arrayfields['multicurrency_rtp']['checked'])) { + print ''; + print (!empty($multicurrency_remaintopay) ? price($multicurrency_remaintopay, 0, $langs) : ' '); + print ''; // TODO Use a denormalized field + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Total buying or cost price + if (!empty($arrayfields['total_pa']['checked'])) { + print ''.price($marginInfo['pa_total']).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Total margin + if (!empty($arrayfields['total_margin']['checked'])) { + print ''.price($marginInfo['total_margin']).''; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'total_margin'; + } + $totalarray['val']['total_margin'] += $marginInfo['total_margin']; + } + // Total margin rate + if (!empty($arrayfields['total_margin_rate']['checked'])) { + print ''.(($marginInfo['total_margin_rate'] == '') ? '' : price($marginInfo['total_margin_rate'], null, null, null, null, 2).'%').''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Total mark rate + if (!empty($arrayfields['total_mark_rate']['checked'])) { + print ''.(($marginInfo['total_mark_rate'] == '') ? '' : price($marginInfo['total_mark_rate'], null, null, null, null, 2).'%').''; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'total_mark_rate'; + } + if ($i >= $imaxinloop - 1) { + if (!empty($total_ht)) { + $totalarray['val']['total_mark_rate'] = price2num($total_margin * 100 / $total_ht, 'MT'); + } else { + $totalarray['val']['total_mark_rate'] = ''; + } + } + } + + // 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['f.datec']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Date modification + if (!empty($arrayfields['f.tms']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Date closing + if (!empty($arrayfields['f.date_closing']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_closing), 'dayhour', 'tzuser'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Note public + if (!empty($arrayfields['f.note_public']['checked'])) { + print ''; + print dol_string_nohtmltag($obj->note_public); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Note private + if (!empty($arrayfields['f.note_private']['checked'])) { + print ''; + print dol_string_nohtmltag($obj->note_private); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Template Invoice + if (!empty($arrayfields['f.fk_fac_rec_source']['checked'])) { + print ''; + if (!empty($obj->fk_fac_rec_source)) { + $facrec = new FactureRec($db); + $result = $facrec->fetch($obj->fk_fac_rec_source); + if ($result < 0) { + setEventMessages($facrec->error, $facrec->errors, 'errors'); + } else { + print $facrec->getNomUrl(); + } + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Status + if (!empty($arrayfields['f.fk_statut']['checked'])) { + print ''; + print $facturestatic->getLibStatut(5, $paiement); + print ""; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Action column (Show the massaction button only when this page is not opend from the Extended POS) + + if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; + if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // 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->id, $arrayofselected)) { + $selected = 1; + } + print ''; + } + print ''; + } if (!$i) { $totalarray['nbfield']++; } + print "\n"; } - // Status - if (!empty($arrayfields['f.fk_statut']['checked'])) { - print ''; - print $facturestatic->getLibStatut(5, $paiement); - print ""; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Action column (Show the massaction button only when this page is not opend from the Extended POS) - - if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { - print ''; - if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // 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->id, $arrayofselected)) { - $selected = 1; - } - print ''; - } - print ''; - } - if (!$i) { - $totalarray['nbfield']++; - } - print "\n"; - $i++; } diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 195b04a2ed5..39e6446b573 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -742,8 +742,8 @@ if ($object->id > 0) { print ''; print ''; - 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 "
"; //add stripe sepa button $buttonlabel = $langs->trans("MakeWithdrawRequestStripe"); @@ -781,14 +781,14 @@ if ($object->id > 0) { if ($type == 'bank-transfer') { print '
'.$langs->trans("DoCreditTransferBeforePayments"); - if (isModEnabled('stripe')) { + if (isModEnabled('stripe') && getDolGlobalString('STRIPE_SEPA_DIRECT_DEBIT')) { print ' '.$langs->trans("DoStandingOrdersBeforePayments2"); } print ' '.$langs->trans("DoStandingOrdersBeforePayments3"); print '

'; } else { print '
'.$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 ''.$langs->trans("User").''; print ''.$langs->trans("Amount").''; print ''.$langs->trans("DateProcess").''; - print ' '; if ($type == 'bank-transfer') { print ''.$langs->trans("BankTransferReceipt").''; } else { print ''.$langs->trans("WithdrawalReceipt").''; } print ' '; + print ' '; print ''; $sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande,"; @@ -864,9 +864,10 @@ if ($object->id > 0) { // Amount print ''.price($obj->amount).''; - // Ref of SEPA request + // Date process print ''.$langs->trans("OrderWaiting").''; + // Link to make payment now print ''; if (!empty($conf->global->STRIPE_SEPA_DIRECT_DEBIT)) { $langs->load("stripe"); @@ -874,8 +875,10 @@ if ($object->id > 0) { } print ''; + // print '-'; + // Actions print ''; print ''; print img_delete(); @@ -929,14 +932,21 @@ if ($object->id > 0) { print ''; + // Date print ''.dol_print_date($db->jdate($obj->date_demande), 'day')."\n"; + // User print ''; print $tmpuser->getNomUrl(1, '', 0, 0, 0, 0, 'login'); print ''; + // Amount print ''.price($obj->amount).''; + // Date process + print ''.dol_print_date($db->jdate($obj->date_traite), 'day')."\n"; + + // Link to payment request done print ''; if ($obj->fk_prelevement_bons > 0) { $withdrawreceipt = new BonPrelevement($db); @@ -946,10 +956,10 @@ if ($object->id > 0) { } print "\n"; + // print ' '; - print ''.dol_print_date($db->jdate($obj->date_traite), 'day')."\n"; - + // Actions print ' '; print "\n"; diff --git a/htdocs/compta/localtax/class/localtax.class.php b/htdocs/compta/localtax/class/localtax.class.php index ed467ec91f4..d2300128550 100644 --- a/htdocs/compta/localtax/class/localtax.class.php +++ b/htdocs/compta/localtax/class/localtax.class.php @@ -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 = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).''; + if (property_exists($this, 'label')) { + $return .= ' | '.$this->label.''; + } + if (property_exists($this, 'datev')) { + $return .= '
'.$langs->trans("DateEnd").' : '.dol_print_date($this->db->jdate($this->datev), 'day').''; + } + if (property_exists($this, 'datep')) { + $return .= '
'.$langs->trans("DatePayment", '', '', '', '', 5).' : '.dol_print_date($this->db->jdate($this->datep), 'day').''; + } + if (property_exists($this, 'amount')) { + $return .= '
'.$langs->trans("Amount").' : '.price($this->amount).''; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/compta/localtax/list.php b/htdocs/compta/localtax/list.php index ee2e13e1d57..42f4d326811 100644 --- a/htdocs/compta/localtax/list.php +++ b/htdocs/compta/localtax/list.php @@ -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 ''; - + $localtax_static->label = $obj->label; $localtax_static->id = $obj->rowid; $localtax_static->ref = $obj->rowid; - print "".$localtax_static->getNomUrl(1)."\n"; - print "".dol_trunc($obj->label, 40)."\n"; - print ''.dol_print_date($db->jdate($obj->datev), 'day')."\n"; - print ''.dol_print_date($db->jdate($obj->datep), 'day')."\n"; + $localtax_static->datev = $obj->datev; + $localtax_static->datep = $obj->datep; + $localtax_static->amount = $obj->amount; + $total = $total + $obj->amount; - print ''.price($obj->amount).''; - print "\n"; + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; + } + // Output Kanban + print $localtax_static->getKanbanView(''); + if ($i == ($num - 1)) { + print '
'; + print ''; + } + } else { + print ''; + print "".$localtax_static->getNomUrl(1)."\n"; + print "".dol_trunc($obj->label, 40)."\n"; + print ''.dol_print_date($db->jdate($obj->datev), 'day')."\n"; + print ''.dol_print_date($db->jdate($obj->datep), 'day')."\n"; + print ''.price($obj->amount).''; + print "\n"; + } $i++; } print ''.$langs->trans("Total").''; diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index e193939cdd6..1e4e7d05a7d 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -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 = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).''; + + if (property_exists($this, 'date_bordereau')) { + $return .= '
'.$langs->trans("DateCreation").' : '.dol_print_date($this->db->jdate($this->date_bordereau), 'day').''; + } + if (property_exists($this, 'nbcheque')) { + $return .= '
'.$langs->trans("Cheque", '', '', '', '', 5).' : '.$this->nbcheque.''; + } + if (property_exists($this, 'account_id')) { + $return .= ' | '.$this->account_id.''; + } + if (method_exists($this, 'LibStatut')) { + $return .= '
'.$this->LibStatut($this->statut, 5).'
'; + } + if (property_exists($this, 'amount')) { + $return .= ' |
'.$langs->trans("Amount").' : '.price($this->amount).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php index 054ef800586..38db4fca14b 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -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 '
'; if ($optioncss != '') { @@ -172,6 +179,8 @@ if ($resql) { print ''; print ''; print ''; + print ''; + 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 ''; - - // Num ref cheque - print ''; $checkdepositstatic->id = $objp->rowid; $checkdepositstatic->ref = ($objp->ref ? $objp->ref : $objp->rowid); $checkdepositstatic->statut = $objp->statut; - print $checkdepositstatic->getNomUrl(1); - print ''; + $checkdepositstatic->nbcheque = $objp->nbcheque; + $checkdepositstatic->amount = $objp->amount; + $checkdepositstatic->date_bordereau = $objp->date_bordereau; - // Date - print ''.dol_print_date($db->jdate($objp->date_bordereau), 'day').''; // TODO Use date hour + $account = new Account($db); + $account->fetch($objp->bid); + $checkdepositstatic->account_id = $account->getNomUrl(1); - // Bank - print ''; - if ($objp->bid) { - print ''.img_object($langs->trans("ShowAccount"), 'account').' '.$objp->label.''; + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; + } + // Output Kanban + print $checkdepositstatic->getKanbanView(''); + if ($i == (min($num, $limit) - 1)) { + print '
'; + print ''; + } } else { - print ' '; + print ''; + + // Num ref cheque + print ''; + + print $checkdepositstatic->getNomUrl(1); + print ''; + + // Date + print ''.dol_print_date($db->jdate($objp->date_bordereau), 'day').''; // TODO Use date hour + + // Bank + print ''; + if ($objp->bid) { + print ''.img_object($langs->trans("ShowAccount"), 'account').' '.$objp->label.''; + } else { + print ' '; + } + print ''; + + // Number of cheques + print ''.$objp->nbcheque.''; + + // Amount + print ''.price($objp->amount).''; + + // Statut + print ''; + print $checkdepositstatic->LibStatut($objp->statut, 5); + print ''; + + print ''; + + print "\n"; } - print ''; - - // Number of cheques - print ''.$objp->nbcheque.''; - - // Amount - print ''.price($objp->amount).''; - - // Statut - print ''; - print $checkdepositstatic->LibStatut($objp->statut, 5); - print ''; - - print ''; - - print "\n"; $i++; } } else { diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 554933a2137..24db7fb5b64 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -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 = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).''; + + if (property_exists($this, 'date_echeance')) { + $return .= '
'.$langs->trans("Date").' : '.dol_print_date($this->db->jdate($this->date_echeance), 'day').''; + } + if (property_exists($this, 'total')) { + $return .= '
'.$langs->trans("Amount").' : '.price($this->total).''; + } + if (method_exists($this, 'LibStatut')) { + $return .= '
'.$this->LibStatut($this->statut, 5).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/compta/prelevement/list.php b/htdocs/compta/prelevement/list.php index 4906313cad1..8d9489bbec7 100644 --- a/htdocs/compta/prelevement/list.php +++ b/htdocs/compta/prelevement/list.php @@ -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 = "&statut=".urlencode($statut); $param .= "&search_bon=".urlencode($search_bon); + if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); + } if ($type == 'bank-transfer') { $param .= '&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\n"; print ''."\n"; @@ -206,6 +213,8 @@ if ($result) { print ''; print ''; print ''; + print ''; + if ($type != '') { print ''; } @@ -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 ''; + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; + } + // Output Kanban - print ''; - print $bon->getNomUrl(1); - print "\n"; + print $bon->getKanbanView(''); + if ($i == (min($num, $limit) - 1)) { + print '
'; + print ''; + } + } else { + print ''; - print ''; - print $line->LibStatut($obj->statut_ligne, 2); - print " "; - print ''; - print substr('000000'.$obj->rowid_ligne, -6); - print ''; + print ''; + print $bon->getNomUrl(1); + print "\n"; - print ''; - $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 ''; + print $line->LibStatut($obj->statut_ligne, 2); + print " "; + print ''; + print substr('000000'.$obj->rowid_ligne, -6); + print ''; + + print ''; + $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 ''; + print img_object($langs->trans($link_title), $link_picto); + print ' '.$obj->invoiceref."\n"; + print ''; + print ''; + + print ''; + print $company->getNomUrl(1); + print "\n"; + + + print ''; + $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 ''.$link_code."\n"; + + print ''.dol_print_date($db->jdate($obj->datec), 'day')."\n"; + + print ''.price($obj->amount)."\n"; + + print ' '; + + print "\n"; } - print ''; - print img_object($langs->trans($link_title), $link_picto); - print ' '.$obj->invoiceref."\n"; - print ''; - print ''; - - print ''; - print $company->getNomUrl(1); - print "\n"; - - - print ''; - $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 ''.$link_code."\n"; - - print ''.dol_print_date($db->jdate($obj->datec), 'day')."\n"; - - print ''.price($obj->amount)."\n"; - - print ' '; - - print "\n"; $i++; } } else { diff --git a/htdocs/compta/prelevement/orders_list.php b/htdocs/compta/prelevement/orders_list.php index 01ef33eea9d..bead580ab31 100644 --- a/htdocs/compta/prelevement/orders_list.php +++ b/htdocs/compta/prelevement/orders_list.php @@ -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 ''; print ''; print ''; + print ''; + if ($type != '') { print ''; } @@ -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 ''; + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; + } + // Output Kanban - print ''; - print $directdebitorder->getNomUrl(1); - print "\n"; + print $directdebitorder->getKanbanView(''); + if ($i == (min($num, $limit) - 1)) { + print '
'; + print ''; + } + } else { + print ''; - print ''.dol_print_date($db->jdate($obj->datec), 'day')."\n"; + print ''; + print $directdebitorder->getNomUrl(1); + print "\n"; - print ''.price($obj->amount)."\n"; + print ''.dol_print_date($db->jdate($obj->datec), 'day')."\n"; - print ''; - print $bon->LibStatut($obj->statut, 5); - print ''; + print ''.price($obj->amount)."\n"; - print ''."\n"; + print ''; + print $bon->LibStatut($obj->statut, 5); + print ''; - print "\n"; + print ''."\n"; + + print "\n"; + } $i++; } } else { diff --git a/htdocs/compta/resultat/result.php b/htdocs/compta/resultat/result.php index 743fd4c0506..e49f06034aa 100644 --- a/htdocs/compta/resultat/result.php +++ b/htdocs/compta/resultat/result.php @@ -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 ''.price($r).''; - $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 ''.price($r).''; - $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 ''.price($r).''; - $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 ''; print ''; - print ''; - print '     '.length_accountg($cpt['account_number']); - print ' - '; - print $cpt['account_label']; + + if (isset($cpt['account_number'])) { + $labeldetail = '     '.length_accountg($cpt['account_number']).' - '.$cpt['account_label']; + } else { + $labeldetail = '-'; + } + + print ''; + print dol_escape_htmltag($labeldetail); print ''; print ''.price($resultNP).''; print ''.price($resultN).''; @@ -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 ''.price($resultM).''; } } 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 ''.price($resultM).''; } } diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index 37b3540a0f5..b5e98b3b62e 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -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 = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).''; + if (property_exists($this, 'fk_project') && !empty($this->fk_project)) { + $return .= ' | '.$this->fk_project.''; + } + if (property_exists($this, 'date_ech')) { + $return .= '
'.$langs->trans("DateEnd").':'.dol_print_date($this->date_ech).''; + } + if (property_exists($this, 'amount')) { + $return .= '
'.$langs->trans("Amount").' : '.price($this->amount).''; + } + if (method_exists($this, 'LibStatut')) { + $return .= '
'.$this->LibStatut($this->paye, 5, $this->alreadypaid).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/compta/sociales/list.php b/htdocs/compta/sociales/list.php index 83690816801..a925fe6968d 100644 --- a/htdocs/compta/sociales/list.php +++ b/htdocs/compta/sociales/list.php @@ -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 ''; print ''; print ''; print ''; +print ''; + $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 ''; - - // Line number - if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { - print ''.(($offset * $limit) + $i).''; - if (!$i) { - $totalarray['nbfield']++; + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; } - } + // Output Kanban - // Ref - if (!empty($arrayfields['cs.rowid']['checked'])) { - print ''.$chargesociale_static->getNomUrl(1, '20').''; - if (!$i) { - $totalarray['nbfield']++; + $chargesociale_static->fk_project = $projectstatic->getNomUrl(); + print $chargesociale_static->getKanbanView(''); + if ($i == (min($num, $limit) - 1)) { + print '
'; + print ''; } - } + } else { + print ''; - // Label - if (!empty($arrayfields['cs.libelle']['checked'])) { - print ''.dol_escape_htmltag($obj->label).''; - 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 ''.dol_escape_htmltag($typelabeltoshow).''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Date - if (!empty($arrayfields['cs.date_ech']['checked'])) { - print ''.dol_print_date($db->jdate($obj->date_ech), 'day').''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Date end period - if (!empty($arrayfields['cs.periode']['checked'])) { - print ''.dol_print_date($db->jdate($obj->periode), 'day').''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Project ref - if (!empty($arrayfields['p.ref']['checked'])) { - print ''; - if ($obj->project_id > 0) { - print $projectstatic->getNomUrl(1); - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - if (!empty($arrayfields['cs.fk_user']['checked'])) { - // Employee - print ''; - 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 ''.(($offset * $limit) + $i).''; + if (!$i) { + $totalarray['nbfield']++; } - print $ustatic->getNomUrl(-1); } - print "\n"; + + // Ref + if (!empty($arrayfields['cs.rowid']['checked'])) { + print ''.$chargesociale_static->getNomUrl(1, '20').''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Label + if (!empty($arrayfields['cs.libelle']['checked'])) { + print ''.dol_escape_htmltag($obj->label).''; + 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 ''.dol_escape_htmltag($typelabeltoshow).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Date + if (!empty($arrayfields['cs.date_ech']['checked'])) { + print ''.dol_print_date($db->jdate($obj->date_ech), 'day').''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Date end period + if (!empty($arrayfields['cs.periode']['checked'])) { + print ''.dol_print_date($db->jdate($obj->periode), 'day').''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Project ref + if (!empty($arrayfields['p.ref']['checked'])) { + print ''; + if ($obj->project_id > 0) { + print $projectstatic->getNomUrl(1); + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + if (!empty($arrayfields['cs.fk_user']['checked'])) { + // Employee + print ''; + 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 "\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Type + if (!empty($arrayfields['cs.fk_mode_reglement']['checked'])) { + print 'payment_code)).'">'; + if (!empty($obj->payment_code)) { + print $langs->trans("PaymentTypeShort".$obj->payment_code); + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Account + if (!empty($arrayfields['cs.fk_account']['checked'])) { + print ''; + 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 ''; + if (!$i) $totalarray['nbfield']++; + } + + // Amount + if (!empty($arrayfields['cs.amount']['checked'])) { + print ''.price($obj->amount).''; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'totalttcfield'; + } + $totalarray['val']['totalttcfield'] += $obj->amount; + } + + // Status + if (!empty($arrayfields['cs.paye']['checked'])) { + print ''.$chargesociale_static->LibStatut($obj->paye, 5, $obj->alreadypayed).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Buttons + print ''; if (!$i) { $totalarray['nbfield']++; } + + print ''."\n"; } - - // Type - if (!empty($arrayfields['cs.fk_mode_reglement']['checked'])) { - print 'payment_code)).'">'; - if (!empty($obj->payment_code)) { - print $langs->trans("PaymentTypeShort".$obj->payment_code); - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Account - if (!empty($arrayfields['cs.fk_account']['checked'])) { - print ''; - 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 ''; - if (!$i) $totalarray['nbfield']++; - } - - // Amount - if (!empty($arrayfields['cs.amount']['checked'])) { - print ''.price($obj->amount).''; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'totalttcfield'; - } - $totalarray['val']['totalttcfield'] += $obj->amount; - } - - // Status - if (!empty($arrayfields['cs.paye']['checked'])) { - print ''.$chargesociale_static->LibStatut($obj->paye, 5, $obj->alreadypayed).''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Buttons - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - - print ''."\n"; - $i++; } diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index dffba34d59b..78fb178ff27 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -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 = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + //$return .= ''; // Can be image + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).''; + if (property_exists($this, 'amount')) { + $return .= ' | '.$langs->trans("Amount").' : '.price($this->amount).''; + } + if (property_exists($this, 'type_payment')) { + $return .= '
'.$langs->trans("Payement").' : '.$this->type_payment.''; + } + if (property_exists($this, 'datev')) { + $return .= '
'.$langs->trans("DateEnd").' : '.dol_print_date($this->datev).''; + } + if (method_exists($this, 'LibStatut')) { + $return .= '
'.$this->LibStatut($this->paiementtype, 5, $this->alreadypaid).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/compta/tva/list.php b/htdocs/compta/tva/list.php index 001ef1e7b38..c839625a705 100644 --- a/htdocs/compta/tva/list.php +++ b/htdocs/compta/tva/list.php @@ -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 ''; - - // No - if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { - print ''.(($offset * $limit) + $i).''; - if (!$i) { - $totalarray['nbfield']++; + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; } - } + // Output Kanban - // Ref - if (!empty($arrayfields['t.rowid']['checked'])) { - print ''; - 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 ''; - if (!$i) { - $totalarray['nbfield']++; + print $tva_static->getKanbanView(''); + if ($i == (min($num, $limit) - 1)) { + print '
'; + print ''; } - } + } else { + print ''; - // Label - if (!empty($arrayfields['t.label']['checked'])) { - print ''.dol_trunc($obj->label, 40).''; - if (!$i) { - $totalarray['nbfield']++; + // No + if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { + print ''.(($offset * $limit) + $i).''; + if (!$i) { + $totalarray['nbfield']++; + } } - } - // Date end period - if (!empty($arrayfields['t.datev']['checked'])) { - print ''.dol_print_date($db->jdate($obj->datev), 'day').''; - if (!$i) { - $totalarray['nbfield']++; + // Ref + if (!empty($arrayfields['t.rowid']['checked'])) { + print ''; + 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 ''; + if (!$i) { + $totalarray['nbfield']++; + } } - } - // Date payment - /*if (!empty($arrayfields['t.datep']['checked'])) { - print ''.dol_print_date($db->jdate($obj->datep), 'day').''; - if (!$i) $totalarray['nbfield']++; - }*/ - - // Type - if (!empty($arrayfields['t.fk_typepayment']['checked'])) { - print ''; - if (!empty($obj->payment_code)) print $langs->trans("PaymentTypeShort".$obj->payment_code); - print ''; - if (!$i) { - $totalarray['nbfield']++; + // Label + if (!empty($arrayfields['t.label']['checked'])) { + print ''.dol_trunc($obj->label, 40).''; + if (!$i) { + $totalarray['nbfield']++; + } } - } - // Account - if (!empty($arrayfields['t.fk_account']['checked'])) { - print ''; - 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 ''.dol_print_date($db->jdate($obj->datev), 'day').''; + if (!$i) { + $totalarray['nbfield']++; + } } - print ''; - if (!$i) $totalarray['nbfield']++; - } - // Amount - if (!empty($arrayfields['t.amount']['checked'])) { - $total = $total + $obj->amount; - print '' . price($obj->amount) . ''; - 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 ''.dol_print_date($db->jdate($obj->datep), 'day').''; + if (!$i) $totalarray['nbfield']++; + }*/ - if (!empty($arrayfields['t.status']['checked'])) { - print '' . $tva_static->LibStatut($obj->paye, 5, $obj->alreadypayed) . ''; - if (!$i) { - $totalarray['nbfield']++; + // Type + if (!empty($arrayfields['t.fk_typepayment']['checked'])) { + print ''; + if (!empty($obj->payment_code)) print $langs->trans("PaymentTypeShort".$obj->payment_code); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } + + // Account + if (!empty($arrayfields['t.fk_account']['checked'])) { + print ''; + 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 ''; + if (!$i) $totalarray['nbfield']++; + } + + // Amount if (!empty($arrayfields['t.amount']['checked'])) { - $totalarray['pos'][$totalarray['nbfield']] = ''; + $total = $total + $obj->amount; + print '' . price($obj->amount) . ''; + 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 '' . $tva_static->LibStatut($obj->paye, 5, $obj->alreadypayed) . ''; + if (!$i) { + $totalarray['nbfield']++; + } + if (!empty($arrayfields['t.amount']['checked'])) { + $totalarray['pos'][$totalarray['nbfield']] = ''; + } + } + + // Buttons + print ''; + + print ''; } - // Buttons - print ''; - - print ''; - $i++; } diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index e2094402ced..67b3ce2a38a 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -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)."'"; diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index da07a2b699b..f34c477ff71 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -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ó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ó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 ''; print ''; } + +/* // State -/*if (!empty($arrayfields['state.nom']['checked'])) + if (!empty($arrayfields['state.nom']['checked'])) { print ''; print ''; print ''; } + // Region if (!empty($arrayfields['region.nom']['checked'])) { print ''; print ''; print ''; - }*/ + } +*/ + // Country if (!empty($arrayfields['country.code_iso']['checked'])) { print ''; @@ -1014,7 +1038,7 @@ if (!empty($arrayfields['p.fk_soc']['checked']) || !empty($arrayfields['s.nom'][ print ''; print ''; } -// Alias +// Alias of ThirdParty if (!empty($arrayfields['s.name_alias']['checked'])) { print ''; print ''; @@ -1079,7 +1103,7 @@ if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { } print ''; -// Ligne des titres +// Title line print ''; 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 ''; } + // ID if (!empty($arrayfields['p.rowid']['checked'])) { print ''; @@ -1247,7 +1272,8 @@ while ($i < min($num, $limit)) { $totalarray['nbfield']++; } } - // Name + + // (Last) Name if (!empty($arrayfields['p.lastname']['checked'])) { print ''; print $contactstatic->getNomUrl(1); @@ -1256,6 +1282,7 @@ while ($i < min($num, $limit)) { $totalarray['nbfield']++; } } + // Firstname if (!empty($arrayfields['p.firstname']['checked'])) { print ''.dol_escape_htmltag($obj->firstname).''; @@ -1263,6 +1290,7 @@ while ($i < min($num, $limit)) { $totalarray['nbfield']++; } } + // Job position if (!empty($arrayfields['p.poste']['checked'])) { print ''.dol_escape_htmltag($obj->poste).''; @@ -1270,6 +1298,7 @@ while ($i < min($num, $limit)) { $totalarray['nbfield']++; } } + // Address if (!empty($arrayfields['p.address']['checked'])) { print ''.dol_escape_htmltag($obj->address).''; @@ -1277,6 +1306,7 @@ while ($i < min($num, $limit)) { $totalarray['nbfield']++; } } + // Zip if (!empty($arrayfields['p.zip']['checked'])) { print ''.dol_escape_htmltag($obj->zip).''; @@ -1284,6 +1314,7 @@ while ($i < min($num, $limit)) { $totalarray['nbfield']++; } } + // Town if (!empty($arrayfields['p.town']['checked'])) { print ''.dol_escape_htmltag($obj->town).''; @@ -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 "".$obj->state_name."\n"; if (! $i) $totalarray['nbfield']++; } + // Region if (!empty($arrayfields['region.nom']['checked'])) { print "".$obj->region_name."\n"; if (! $i) $totalarray['nbfield']++; }*/ + // Country if (!empty($arrayfields['country.code_iso']['checked'])) { print ''; @@ -1313,13 +1348,15 @@ while ($i < min($num, $limit)) { $totalarray['nbfield']++; } } - // Phone + + // Phone pro if (!empty($arrayfields['p.phone']['checked'])) { print ''.dol_print_phone($obj->phone_pro, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'phone').''; if (!$i) { $totalarray['nbfield']++; } } + // Phone perso if (!empty($arrayfields['p.phone_perso']['checked'])) { print ''.dol_print_phone($obj->phone_perso, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'phone').''; @@ -1327,6 +1364,7 @@ while ($i < min($num, $limit)) { $totalarray['nbfield']++; } } + // Phone mobile if (!empty($arrayfields['p.phone_mobile']['checked'])) { print ''.dol_print_phone($obj->phone_mobile, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'mobile').''; @@ -1334,6 +1372,7 @@ while ($i < min($num, $limit)) { $totalarray['nbfield']++; } } + // Fax if (!empty($arrayfields['p.fax']['checked'])) { print ''.dol_print_phone($obj->fax, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'fax').''; @@ -1341,6 +1380,7 @@ while ($i < min($num, $limit)) { $totalarray['nbfield']++; } } + // EMail if (!empty($arrayfields['p.email']['checked'])) { print ''.dol_print_email($obj->email, $obj->rowid, $obj->socid, 'AC_EMAIL', 18, 0, 1).''; @@ -1348,7 +1388,8 @@ while ($i < min($num, $limit)) { $totalarray['nbfield']++; } } - // No EMail + + // No EMail Subscription if (!empty($arrayfields['unsubscribed']['checked'])) { print ''; 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 ''; 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 ' '; } @@ -1405,8 +1449,8 @@ while ($i < min($num, $limit)) { } } + // Prospect Level if (!empty($arrayfields['p.fk_prospectlevel']['checked'])) { - // Prospect level print ''; print $contactstatic->getLibProspLevel(); print ""; @@ -1415,8 +1459,8 @@ while ($i < min($num, $limit)) { } } + // Prospect status if (!empty($arrayfields['p.fk_stcommcontact']['checked'])) { - // Prospect status print '
'; print '
'.$contactstatic->libProspCommStatut($obj->stcomm_id, 2, $contactstatic->cacheprospectstatus[$obj->stcomm_id]['label'], $obj->stcomm_picto); print '
-
'; @@ -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 ''; @@ -1459,6 +1505,7 @@ while ($i < min($num, $limit)) { $totalarray['nbfield']++; } } + // Status if (!empty($arrayfields['p.statut']['checked'])) { print ''.$contactstatic->getLibStatut(5).''; @@ -1466,6 +1513,7 @@ while ($i < min($num, $limit)) { $totalarray['nbfield']++; } } + // Import key if (!empty($arrayfields['p.import_key']['checked'])) { print ''; diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 79897cdc16d..123366fd630 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -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 ' + print ' + '; print '
'; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 1846d911cef..420d314cd43 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -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 = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + //$return .= ''; // Can be image + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).''; + if (property_exists($this, 'societe')) { + $return .= '
'.$this->societe.''; + } + if (property_exists($this, 'date_contrat')) { + $return .= '
'.$langs->trans("DateContract").' : '.dol_print_date($this->date_contrat).''; + } + if (method_exists($this, 'getLibStatut')) { + $return .= '
'.$this->getLibStatut(5).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 4b49840f681..7ea26bf6f1b 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -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 ''; if ($optioncss != '') { @@ -618,6 +625,7 @@ print ''; print ''; print ''; print ''; +print ''; 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 ''; - // Action column - if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - 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 ''; - } - print ''; - } - // Ref - if (!empty($arrayfields['c.ref']['checked'])) { - print ''; - print $contracttmp->getNomUrl(1); - if ($obj->nb_late) { - print img_warning($langs->trans("Late")); - } - if (!empty($obj->note_private) || !empty($obj->note_public)) { - print ' '; - print ''.img_picto($langs->trans("ViewPrivateNote"), 'note').''; - print ''; + //mode kanban + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; } - $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 ''; - - print ''; - } - - // Ref thirdparty - if (!empty($arrayfields['c.ref_customer']['checked'])) { - print ''.$contracttmp->getFormatedCustomerRef($obj->ref_customer).''; - } - if (!empty($arrayfields['c.ref_supplier']['checked'])) { - print ''.dol_escape_htmltag($obj->ref_supplier).''; - } - if (!empty($arrayfields['s.nom']['checked'])) { - print ''; - 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 '
'; + print ''; } - print ''; - } - // Email - if (!empty($arrayfields['s.email']['checked'])) { - print ''.dol_print_email($obj->email, 0, $obj->socid, 0, 0, 1, 1).''; - } - // Town - if (!empty($arrayfields['s.town']['checked'])) { - print ''; - print $obj->town; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Zip - if (!empty($arrayfields['s.zip']['checked'])) { - print ''; - print $obj->zip; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // State - if (!empty($arrayfields['state.nom']['checked'])) { - print "".$obj->state_name."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Country - if (!empty($arrayfields['country.code_iso']['checked'])) { - print ''; - print dol_escape_htmltag($socstatic->country); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Type ent - if (!empty($arrayfields['typent.code']['checked'])) { - print ''; - if (count($typenArray) == 0) { - $typenArray = $formcompany->typent_array(1); - } - print $typenArray[$obj->typent_code]; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['sale_representative']['checked'])) { - // Sales representatives - print ''; - 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 '
': - print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2); - $j++; - if ($j < $nbofsalesrepresentative) { - print ' '; - } - //print '
'; + } else { + print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + 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 ''; } - //else print $langs->trans("NoSalesRepresentativeAffected"); - } else { - print ' '; + print ''; } - print ''; - } - // Date - if (!empty($arrayfields['c.date_contrat']['checked'])) { - print ''.dol_print_date($db->jdate($obj->date_contrat), 'day', 'tzserver').''; - } - // 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 ''; - print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date modification - if (!empty($arrayfields['c.tms']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date lower end date - if (!empty($arrayfields['lower_planned_end_date']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->lower_planned_end_date), 'day', 'tzuser'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Status - if (!empty($arrayfields['status']['checked'])) { - print ''.($obj->nb_initial > 0 ? $obj->nb_initial : '').''; - print ''.($obj->nb_running > 0 ? $obj->nb_running : '').''; - print ''.($obj->nb_expired > 0 ? $obj->nb_expired : '').''; - print ''.($obj->nb_closed > 0 ? $obj->nb_closed : '').''; - } - // Action column - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - 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 ''; + print $contracttmp->getNomUrl(1); + if ($obj->nb_late) { + print img_warning($langs->trans("Late")); + } + if (!empty($obj->note_private) || !empty($obj->note_public)) { + print ' '; + print ''.img_picto($langs->trans("ViewPrivateNote"), 'note').''; + print ''; } - print ''; - } - print ''; - } - if (!$i) { - $totalarray['nbfield']++; - } - print "\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 ''; + + print ''; + } + + // Ref thirdparty + if (!empty($arrayfields['c.ref_customer']['checked'])) { + print ''.$contracttmp->getFormatedCustomerRef($obj->ref_customer).''; + } + if (!empty($arrayfields['c.ref_supplier']['checked'])) { + print ''.dol_escape_htmltag($obj->ref_supplier).''; + } + if (!empty($arrayfields['s.nom']['checked'])) { + print ''; + if ($obj->socid > 0) { + // TODO Use a cache for this string + print $socstatic->getNomUrl(1, ''); + } + print ''; + } + // Email + if (!empty($arrayfields['s.email']['checked'])) { + print ''.dol_print_email($obj->email, 0, $obj->socid, 0, 0, 1, 1).''; + } + // Town + if (!empty($arrayfields['s.town']['checked'])) { + print ''; + print $obj->town; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Zip + if (!empty($arrayfields['s.zip']['checked'])) { + print ''; + print $obj->zip; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // State + if (!empty($arrayfields['state.nom']['checked'])) { + print "".$obj->state_name."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Country + if (!empty($arrayfields['country.code_iso']['checked'])) { + print ''; + print dol_escape_htmltag($socstatic->country); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Type ent + if (!empty($arrayfields['typent.code']['checked'])) { + print ''; + if (count($typenArray) == 0) { + $typenArray = $formcompany->typent_array(1); + } + print $typenArray[$obj->typent_code]; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['sale_representative']['checked'])) { + // Sales representatives + print ''; + 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 '
': + print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2); + $j++; + if ($j < $nbofsalesrepresentative) { + print ' '; + } + //print '
'; + } + } + //else print $langs->trans("NoSalesRepresentativeAffected"); + } else { + print ' '; + } + print ''; + } + // Date + if (!empty($arrayfields['c.date_contrat']['checked'])) { + print ''.dol_print_date($db->jdate($obj->date_contrat), 'day', 'tzserver').''; + } + // 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 ''; + print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Date modification + if (!empty($arrayfields['c.tms']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Date lower end date + if (!empty($arrayfields['lower_planned_end_date']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->lower_planned_end_date), 'day', 'tzuser'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Status + if (!empty($arrayfields['status']['checked'])) { + print ''.($obj->nb_initial > 0 ? $obj->nb_initial : '').''; + print ''.($obj->nb_running > 0 ? $obj->nb_running : '').''; + print ''.($obj->nb_expired > 0 ? $obj->nb_expired : '').''; + print ''.($obj->nb_closed > 0 ? $obj->nb_closed : '').''; + } + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + 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 ''; + } + print ''; + } + if (!$i) { + $totalarray['nbfield']++; + } + + print "\n"; + } $i++; } diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 23c2159bc8f..ab041e63385 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -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; diff --git a/htdocs/core/ajax/security.php b/htdocs/core/ajax/security.php index e5dc91c05d1..b01c952662e 100644 --- a/htdocs/core/ajax/security.php +++ b/htdocs/core/ajax/security.php @@ -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 ''."\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); diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index abf30f2f3ee..7c136f446d9 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -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') { diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 3f53c3c4e94..93d125291ef 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -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); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index a23c0611589..d6be7c463a1 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -16,6 +16,7 @@ * Copyright (C) 2018 Josep Lluís Amador * Copyright (C) 2021 Gauthier VERDOL * Copyright (C) 2021 Grégory Blémand + * Copyright (C) 2023 Lenin Rivas * * 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; diff --git a/htdocs/core/class/dolgeoip.class.php b/htdocs/core/class/dolgeoip.class.php index a2eea7023d9..e5001270131 100644 --- a/htdocs/core/class/dolgeoip.class.php +++ b/htdocs/core/class/dolgeoip.class.php @@ -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 ''; } } } diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index 0659240c8c7..bcd5a506946 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -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 diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 1c54df24e06..276f7bacd69 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -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 .= ''; } @@ -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").' : ').''; } else { print $this->select_produits_fournisseurs_list($socid, $selected, $htmlname, $filtertype, $filtre, '', $status, 0, 0, $alsoproductwithnosupplierprice, $morecss, 0, $placeholder); diff --git a/htdocs/core/class/html.formadmin.class.php b/htdocs/core/class/html.formadmin.class.php index a0d0dd2758e..2cc15a3dd42 100644 --- a/htdocs/core/class/html.formadmin.class.php +++ b/htdocs/core/class/html.formadmin.class.php @@ -36,7 +36,7 @@ class FormAdmin /** * Constructor * - * @param DoliDB $db Database handler + * @param DoliDB|null $db Database handler */ public function __construct($db) { diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 7f5c2887e8b..b2bb2a5f8fa 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -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)) { diff --git a/htdocs/core/class/stats.class.php b/htdocs/core/class/stats.class.php index c8dbca747b9..60cdc5d5226 100644 --- a/htdocs/core/class/stats.class.php +++ b/htdocs/core/class/stats.class.php @@ -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); diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index 3f2f756977d..2315428b37a 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -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; + } } } diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index d58854ed9d0..0241431c8b7 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -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 diff --git a/htdocs/core/class/vcard.class.php b/htdocs/core/class/vcard.class.php index 8a62c0aea5e..7b5a320f678 100644 --- a/htdocs/core/class/vcard.class.php +++ b/htdocs/core/class/vcard.class.php @@ -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); } diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 71bcc082961..92895793082 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -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 diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index d49538f41dc..a29c22cbcf7 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -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 '
'; + print $form->selectDate($search_birthday_dtstart ? $search_birthday_dtstart : '', "search_birthday_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print '
'; + print '
'; + print $form->selectDate($search_birthday_dtend ? $search_birthday_dtend : '', "search_birthday_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); + print '
'; } else { print ''; } @@ -1342,6 +1368,13 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl print ''; } + // Birthday + if (!empty($arrayfields['t.birthday']['checked'])) { + print ''; + print dol_print_date($obj->birthday); + print ''; + } + // Status if (!empty($arrayfields['t.statut']['checked'])) { print ''.$contactstatic->getLibStatut(5).''; @@ -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++; diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 03223a7b65a..773cb6a1a97 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -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) { diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index ad7d7cecfa5..207f5bafeb7 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -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') { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 30d2d2327d8..a25d083c251 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -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 .= '
'.$object->show_photos('product', $conf->product->multidir_output[$entity], 'small', $maxvisiblephotos, 0, 0, 0, $width, 0).'
'; + $morehtmlleft .= '
'.$object->show_photos('product', $conf->product->multidir_output[$entity], 'small', $maxvisiblephotos, 0, 0, 0, 0, $width, 0, '').'
'; } else { if (!empty($conf->global->PRODUCT_NODISPLAYIFNOPHOTO)) { $nophoto = ''; $morehtmlleft .= '
'; } else { // Show no photo link $nophoto = '/public/theme/common/nophoto.png'; - $morehtmlleft .= '
No photo
'; + $morehtmlleft .= '
transnoentitiesnoconv("Documents"))).'" alt="No photo"'.($width ? ' style="width: '.$width.'px"' : '').' src="'.DOL_URL_ROOT.$nophoto.'">
'; } } } elseif ($object->element == 'ticket') { @@ -3170,7 +3170,7 @@ function dol_print_socialnetworks($value, $cid, $socid, $type, $dictsocialnetwor if (!empty($type)) { $htmllink = '
'; // Use dictionary definition for picto $dictsocialnetworks[$type]['icon'] - $htmllink .= ''; + $htmllink .= ''; if ($type == 'skype') { $htmllink .= dol_escape_htmltag($value); $htmllink .= '  '; + // Action column + print ''; + $selected = 0; + if (in_array($lines[$i]->id, $arrayofselected)) { + $selected = 1; + } + print ''; + + print ''; + print "\n"; if (!$showlineingray) { diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index b33ad1333ef..f450d390dff 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -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".''; @@ -111,7 +111,7 @@ print $langs->trans('ReductionShort'); if (in_array($object->element, array('propal', 'commande', 'facture')) && $object->status == $object::STATUS_DRAFT) { global $mysoc; - if (empty($disableedit)) { + if (empty($disableedit) && GETPOST('mode', 'aZ09') != 'remiseforalllines') { print 'id.'">'.img_edit($langs->trans("UpdateForAllLines"), 0, 'class="clickvatforalllines opacitymedium paddingleft cursorpointer"').''; } //print ''; diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index be78b6ecc18..ae53b01e19b 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -931,7 +931,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = 0; } else { // TODO Merge all previous cases into this generic one - // $action = BILL_DELETE, TICKET_CREATE, TICKET_MODIFY, TICKET_DELETE, CONTACT_SENTBYMAIL, RECRUITMENTCANDIDATURE_MODIFY, ... + // $action = PASSWORD, BILL_DELETE, TICKET_CREATE, TICKET_MODIFY, TICKET_DELETE, CONTACT_SENTBYMAIL, RECRUITMENTCANDIDATURE_MODIFY, ... // Can also be a value defined by an external module like SENTBYSMS, COMPANY_SENTBYSMS, MEMBER_SENTBYSMS, ... // Note: We are here only if $conf->global->MAIN_AGENDA_ACTIONAUTO_action is on (tested at begining of this function). // Note that these key can be set in agenda setup, only if defined into llx_c_action_trigger diff --git a/htdocs/debugbar/class/DataCollector/DolConfigCollector.php b/htdocs/debugbar/class/DataCollector/DolConfigCollector.php index 715d20abcf9..0920b140dbc 100644 --- a/htdocs/debugbar/class/DataCollector/DolConfigCollector.php +++ b/htdocs/debugbar/class/DataCollector/DolConfigCollector.php @@ -1,4 +1,25 @@ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/debugbar/class/DataCollector/DolConfigCollector.php + * \brief Class for debugbar collection + * \ingroup debugbar + */ use \DebugBar\DataCollector\ConfigCollector; diff --git a/htdocs/debugbar/class/DataCollector/DolExceptionsCollector.php b/htdocs/debugbar/class/DataCollector/DolExceptionsCollector.php index 15d433fd050..38d2b971dde 100644 --- a/htdocs/debugbar/class/DataCollector/DolExceptionsCollector.php +++ b/htdocs/debugbar/class/DataCollector/DolExceptionsCollector.php @@ -1,4 +1,25 @@ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/debugbar/class/DataCollector/DolexceptionsCollector.php + * \brief Class for debugbar collection + * \ingroup debugbar + */ use \DebugBar\DataCollector\ExceptionsCollector; diff --git a/htdocs/debugbar/class/DataCollector/DolLogsCollector.php b/htdocs/debugbar/class/DataCollector/DolLogsCollector.php index d21cdd6233f..44885296bae 100644 --- a/htdocs/debugbar/class/DataCollector/DolLogsCollector.php +++ b/htdocs/debugbar/class/DataCollector/DolLogsCollector.php @@ -1,4 +1,25 @@ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/debugbar/class/DataCollector/DolLogsCollector.php + * \brief Class for debugbar collection + * \ingroup debugbar + */ use DebugBar\DataCollector\MessagesCollector; use Psr\Log\LogLevel; diff --git a/htdocs/debugbar/class/DataCollector/DolMemoryCollector.php b/htdocs/debugbar/class/DataCollector/DolMemoryCollector.php index b52ac8ff8c4..3372e89c2b6 100644 --- a/htdocs/debugbar/class/DataCollector/DolMemoryCollector.php +++ b/htdocs/debugbar/class/DataCollector/DolMemoryCollector.php @@ -1,17 +1,37 @@ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/debugbar/class/DataCollector/DolMemoryCollector.php + * \brief Class for debugbar collection + * \ingroup debugbar + */ use \DebugBar\DataCollector\MemoryCollector; /** * DolMemoryCollector class */ - class DolMemoryCollector extends MemoryCollector { /** * Return value of indicator * - * @return void + * @return array */ public function collect() { @@ -28,7 +48,7 @@ class DolMemoryCollector extends MemoryCollector /** * Return widget settings * - * @return void + * @return array */ public function getWidgets() { diff --git a/htdocs/debugbar/class/DataCollector/DolMessagesCollector.php b/htdocs/debugbar/class/DataCollector/DolMessagesCollector.php index 1fcf60c8ba6..733009e77c6 100644 --- a/htdocs/debugbar/class/DataCollector/DolMessagesCollector.php +++ b/htdocs/debugbar/class/DataCollector/DolMessagesCollector.php @@ -1,4 +1,25 @@ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/debugbar/class/DataCollector/DolMessagesCollector.php + * \brief Class for debugbar collection + * \ingroup debugbar + */ use \DebugBar\DataCollector\MessagesCollector; diff --git a/htdocs/debugbar/class/DataCollector/DolPhpCollector.php b/htdocs/debugbar/class/DataCollector/DolPhpCollector.php index 3d6536bd258..bca2b2a7071 100644 --- a/htdocs/debugbar/class/DataCollector/DolPhpCollector.php +++ b/htdocs/debugbar/class/DataCollector/DolPhpCollector.php @@ -1,4 +1,25 @@ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/debugbar/class/DataCollector/DolPhpCollector.php + * \brief Class for debugbar collection + * \ingroup debugbar + */ use DebugBar\DataCollector\DataCollector; use DebugBar\DataCollector\Renderable; diff --git a/htdocs/debugbar/class/DataCollector/DolQueryCollector.php b/htdocs/debugbar/class/DataCollector/DolQueryCollector.php index ca5aa284dd2..8cc55e34df9 100644 --- a/htdocs/debugbar/class/DataCollector/DolQueryCollector.php +++ b/htdocs/debugbar/class/DataCollector/DolQueryCollector.php @@ -1,4 +1,25 @@ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/debugbar/class/DataCollector/DolQueryCollector.php + * \brief Class for debugbar collection + * \ingroup debugbar + */ use DebugBar\DataCollector\AssetProvider; use DebugBar\DataCollector\DataCollector; diff --git a/htdocs/debugbar/class/DataCollector/DolRequestDataCollector.php b/htdocs/debugbar/class/DataCollector/DolRequestDataCollector.php index 938643802d5..4ddcac9af7c 100644 --- a/htdocs/debugbar/class/DataCollector/DolRequestDataCollector.php +++ b/htdocs/debugbar/class/DataCollector/DolRequestDataCollector.php @@ -1,4 +1,25 @@ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/debugbar/class/DataCollector/DolRequestDataCollector.php + * \brief Class for debugbar collection + * \ingroup debugbar + */ use \DebugBar\DataCollector\RequestDataCollector; diff --git a/htdocs/debugbar/class/DataCollector/DolTimeDataCollector.php b/htdocs/debugbar/class/DataCollector/DolTimeDataCollector.php index ed5e979d539..d16622d329f 100644 --- a/htdocs/debugbar/class/DataCollector/DolTimeDataCollector.php +++ b/htdocs/debugbar/class/DataCollector/DolTimeDataCollector.php @@ -1,4 +1,25 @@ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/debugbar/class/DataCollector/DolTimeDataCollector.php + * \brief Class for debugbar collection + * \ingroup debugbar + */ use \DebugBar\DataCollector\TimeDataCollector; diff --git a/htdocs/debugbar/class/DataCollector/DolibarrCollector.php b/htdocs/debugbar/class/DataCollector/DolibarrCollector.php index 3193fe26176..11cedbe2b93 100644 --- a/htdocs/debugbar/class/DataCollector/DolibarrCollector.php +++ b/htdocs/debugbar/class/DataCollector/DolibarrCollector.php @@ -1,4 +1,25 @@ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/debugbar/class/DataCollector/DolibarrCollector.php + * \brief Class for debugbar collection + * \ingroup debugbar + */ use DebugBar\DataCollector\AssetProvider; use DebugBar\DataCollector\DataCollector; diff --git a/htdocs/debugbar/class/DebugBar.php b/htdocs/debugbar/class/DebugBar.php index bf797e638f7..6181ad7cd60 100644 --- a/htdocs/debugbar/class/DebugBar.php +++ b/htdocs/debugbar/class/DebugBar.php @@ -1,4 +1,25 @@ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/debugbar/class/DebugBar.php + * \brief Class for debugbar + * \ingroup debugbar + */ dol_include_once('/debugbar/class/autoloader.php'); diff --git a/htdocs/debugbar/class/TraceableDB.php b/htdocs/debugbar/class/TraceableDB.php index 9f0a83fae3c..8e28b0c59bd 100644 --- a/htdocs/debugbar/class/TraceableDB.php +++ b/htdocs/debugbar/class/TraceableDB.php @@ -1,4 +1,25 @@ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/debugbar/class/DataCollector/TraceableDB.php + * \brief Class for debugbar DB + * \ingroup debugbar + */ require_once DOL_DOCUMENT_ROOT.'/core/db/DoliDB.class.php'; diff --git a/htdocs/document.php b/htdocs/document.php index 4f6652fafda..eccf49de0be 100644 --- a/htdocs/document.php +++ b/htdocs/document.php @@ -286,9 +286,10 @@ $hookmanager->initHooks(array('document')); $parameters = array('ecmfile' => $ecmfile, 'modulepart' => $modulepart, 'original_file' => $original_file, 'entity' => $entity, 'refname' => $refname, 'fullpath_original_file' => $fullpath_original_file, 'filename' => $filename, 'fullpath_original_file_osencoded' => $fullpath_original_file_osencoded); -$reshook = $hookmanager->executeHooks('downloadDocument', $parameters); // Note that $action and $object may have been +$object = new stdClass(); +$reshook = $hookmanager->executeHooks('downloadDocument', $parameters, $object, $action); // Note that $action and $object may have been if ($reshook < 0) { - $errors = $hookmanager->error.(is_array($hookmanager->errors) ? (!empty($hookmanager->error) ? ', ' : '').join($separator, $hookmanager->errors) : ''); + $errors = $hookmanager->error.(is_array($hookmanager->errors) ? (!empty($hookmanager->error) ? ', ' : '').join(', ', $hookmanager->errors) : ''); dol_syslog("document.php - Errors when executing the hook 'downloadDocument' : ".$errors); print "ErrorDownloadDocumentHooks: ".$errors; exit; diff --git a/htdocs/don/card.php b/htdocs/don/card.php index 459c892a1d9..ec22c82543f 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -52,7 +52,7 @@ $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); $cancel = GETPOST('cancel', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); - +$socid = GETPOST('socid', 'int'); $amount = price2num(GETPOST('amount', 'alphanohtml'), 'MT'); $donation_date = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); $projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0); @@ -63,6 +63,13 @@ if ($id > 0 || $ref) { $object->fetch($id, $ref); } +if (!empty($socid) && $socid > 0) { + $soc = new Societe($db); + if ($socid > 0) { + $soc->fetch($socid); + } +} + $extrafields = new ExtraFields($db); // fetch optionals attributes and labels diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index 158c96cb441..c1d09a6cdd0 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -1141,4 +1141,39 @@ class Don extends CommonObject return (float) $this->amount - $sum_amount; } } + + /** + * 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 = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).''; + if (property_exists($this, 'date')) { + $return .= ' | '.$langs->trans("Date").' : '.dol_print_date($this->date).''; + } + if (property_exists($this, 'societe') && !empty($this->societe)) { + $return .= '
'.$langs->trans("Company").' : '.$this->societe.''; + } + if (property_exists($this, 'amount')) { + $return .= '
'.$langs->trans("Amount").' : '.price($this->amount).''; + } + if (method_exists($this, 'LibStatut')) { + $return .= '
'.$this->LibStatut($this->labelStatus, 5).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/don/list.php b/htdocs/don/list.php index 386a4bc2f6b..eb487be4768 100644 --- a/htdocs/don/list.php +++ b/htdocs/don/list.php @@ -42,6 +42,7 @@ $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $type = GETPOST('type', 'aZ'); +$mode = GETPOST('mode', 'alpha'); if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 @@ -59,6 +60,7 @@ $search_status = (GETPOST("search_status", 'intcomma') != '') ? GETPOST("search_ $search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); $search_ref = GETPOST('search_ref', 'alpha'); $search_company = GETPOST('search_company', 'alpha'); +$search_thirdparty = GETPOST('search_thirdparty', 'alpha'); $search_name = GETPOST('search_name', 'alpha'); $search_amount = GETPOST('search_amount', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha'); @@ -71,6 +73,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_all = ""; $search_ref = ""; $search_company = ""; + $search_thirdparty = ""; $search_name = ""; $search_amount = ""; $search_status = ''; @@ -153,6 +156,9 @@ if ($resql) { $i = 0; $param = ''; + if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); + } if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -179,6 +185,8 @@ if ($resql) { } $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->don->creer) { $newcardbutton .= dolGetButtonTitle($langs->trans('NewDonation'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/don/card.php?action=create'); } @@ -193,6 +201,9 @@ if ($resql) { print ''; print ''; print ''; + print ''; + + print_barre_liste($langs->trans("Donations"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'object_donation', 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -267,44 +278,70 @@ if ($resql) { while ($i < min($num, $limit)) { $objp = $db->fetch_object($resql); + $donationstatic->setVarsFromFetchObj($objp); + $company = new Societe($db); + $result = $company->fetch($objp->socid); + + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; + } + // Output Kanban + $donationstatic->amount = $objp->amount; + $donationstatic->date = $objp->datedon; + $donationstatic->labelStatus = $objp->status; + $donationstatic->id = $objp->rowid; + $donationstatic->ref = $objp->rowid; - print ''; - $donationstatic->id = $objp->rowid; - $donationstatic->ref = $objp->rowid; - $donationstatic->lastname = $objp->lastname; - $donationstatic->firstname = $objp->firstname; - print "".$donationstatic->getNomUrl(1).""; - if (!empty($conf->global->DONATION_USE_THIRDPARTIES)) { - $company = new Societe($db); - $result = $company->fetch($objp->socid); if (!empty($objp->socid) && $company->id > 0) { - print "".$company->getNomUrl(1).""; + $donationstatic->societe = $company->getNomUrl(1); + } else { + $donationstatic->societe = $objp->societe; + } + + print $donationstatic->getKanbanView(''); + if ($i == (min($num, $limit) - 1)) { + print '
'; + print ''; + } + } else { + print ''; + $donationstatic->id = $objp->rowid; + $donationstatic->ref = $objp->rowid; + $donationstatic->lastname = $objp->lastname; + $donationstatic->firstname = $objp->firstname; + print "".$donationstatic->getNomUrl(1).""; + if (!empty($conf->global->DONATION_USE_THIRDPARTIES)) { + if (!empty($objp->socid) && $company->id > 0) { + print "".$company->getNomUrl(1).""; + } else { + print "".$objp->societe.""; + } } else { print "".$objp->societe.""; } - } else { - print "".$objp->societe.""; - } - print "".$donationstatic->getFullName($langs).""; - print ''.dol_print_date($db->jdate($objp->datedon), 'day').''; - if (isModEnabled('project')) { - print ""; - if ($objp->pid) { - $projectstatic->id = $objp->pid; - $projectstatic->ref = $objp->ref; - $projectstatic->id = $objp->pid; - $projectstatic->public = $objp->public; - $projectstatic->title = $objp->title; - print $projectstatic->getNomUrl(1); - } else { - print ' '; + print "".$donationstatic->getFullName($langs).""; + print ''.dol_print_date($db->jdate($objp->datedon), 'day').''; + if (isModEnabled('project')) { + print ""; + if ($objp->pid) { + $projectstatic->id = $objp->pid; + $projectstatic->ref = $objp->ref; + $projectstatic->id = $objp->pid; + $projectstatic->public = $objp->public; + $projectstatic->title = $objp->title; + print $projectstatic->getNomUrl(1); + } else { + print ' '; + } + print "\n"; } - print "\n"; + print ''.price($objp->amount).''; + print ''.$donationstatic->LibStatut($objp->status, 5).''; + print ''; + print ""; } - print ''.price($objp->amount).''; - print ''.$donationstatic->LibStatut($objp->status, 5).''; - print ''; - print ""; $i++; } print ""; diff --git a/htdocs/ecm/class/ecmfiles.class.php b/htdocs/ecm/class/ecmfiles.class.php index ab7b13aba90..cf1a570f04f 100644 --- a/htdocs/ecm/class/ecmfiles.class.php +++ b/htdocs/ecm/class/ecmfiles.class.php @@ -240,12 +240,9 @@ class EcmFiles extends CommonObject } // If ref not defined - $ref = ''; - if (!empty($this->ref)) { - $ref = $this->ref; - } else { + if (empty($this->ref)) { include_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php'; - $ref = dol_hash($this->filepath.'/'.$this->filename, 3); + $this->ref = dol_hash($this->filepath.'/'.$this->filename, 3); } $maxposition = 0; @@ -300,7 +297,7 @@ class EcmFiles extends CommonObject $sql .= 'src_object_type,'; $sql .= 'src_object_id'; $sql .= ') VALUES ('; - $sql .= " '".$this->db->escape($ref)."', "; + $sql .= " '".$this->db->escape($this->ref)."', "; $sql .= ' '.(!isset($this->label) ? 'NULL' : "'".$this->db->escape($this->label)."'").','; $sql .= ' '.(!isset($this->share) ? 'NULL' : "'".$this->db->escape($this->share)."'").','; $sql .= ' '.((int) $this->entity).','; diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 7dae5bbb6e5..b2b3cb70f39 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -2158,6 +2158,118 @@ class EmailCollector extends CommonObject } } } + } elseif ($operation['type'] == 'loadandcreatecontact') { // Search and create contact + if (empty($operation['actionparam'])) { + $errorforactions++; + $this->error = "Action loadandcreatecontact has empty parameter. Must be 'SET:xxx' or 'EXTRACT:(body|subject):regex' to define how to extract data"; + $this->errors[] = $this->error; + } else { + $contact_static = new Contact($this->db); + // Overwrite values with values extracted from source email + $errorforthisaction = $this->overwritePropertiesOfObject($contact_static, $operation['actionparam'], $messagetext, $subject, $header, $operationslog); + if ($errorforthisaction) { + $errorforactions++; + } else { + if (!empty($contact_static->email) && $contact_static->email != $from) $from = $contact_static->email; + + $result = $contactstatic->fetch(0, null, '', $from); + if ($result < 0) { + $errorforactions++; + $this->error = 'Error when getting contact with email ' . $from; + $this->errors[] = $this->error; + break; + } elseif ($result == 0) { + dol_syslog("Contact with email " . $from . " was not found. We try to create it."); + $contactstatic = new Contact($this->db); + + // Create contact + $contactstatic->email = $from; + $operationslog .= '
We set property email='.dol_escape_htmltag($from); + + // Overwrite values with values extracted from source email + $errorforthisaction = $this->overwritePropertiesOfObject($contactstatic, $operation['actionparam'], $messagetext, $subject, $header, $operationslog); + + if ($errorforthisaction) { + $errorforactions++; + } else { + // Search country by name or code + if (!empty($contactstatic->country)) { + require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; + $result = getCountry('', 3, $this->db, '', 1, $contactstatic->country); + if ($result == 'NotDefined') { + $errorforactions++; + $this->error = "Error country not found by this name '" . $contactstatic->country . "'"; + } elseif (!($result > 0)) { + $errorforactions++; + $this->error = "Error when search country by this name '" . $contactstatic->country . "'"; + $this->errors[] = $this->db->lasterror(); + } else { + $contactstatic->country_id = $result; + $operationslog .= '
We set property country_id='.dol_escape_htmltag($result); + } + } elseif (!empty($contactstatic->country_code)) { + require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; + $result = getCountry($contactstatic->country_code, 3, $this->db); + if ($result == 'NotDefined') { + $errorforactions++; + $this->error = "Error country not found by this code '" . $contactstatic->country_code . "'"; + } elseif (!($result > 0)) { + $errorforactions++; + $this->error = "Error when search country by this code '" . $contactstatic->country_code . "'"; + $this->errors[] = $this->db->lasterror(); + } else { + $contactstatic->country_id = $result; + $operationslog .= '
We set property country_id='.dol_escape_htmltag($result); + } + } + + if (!$errorforactions) { + // Search state by name or code (for country if defined) + if (!empty($contactstatic->state)) { + require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php'; + $result = dol_getIdFromCode($this->db, $contactstatic->state, 'c_departements', 'nom', 'rowid'); + if (empty($result)) { + $errorforactions++; + $this->error = "Error state not found by this name '" . $contactstatic->state . "'"; + } elseif (!($result > 0)) { + $errorforactions++; + $this->error = "Error when search state by this name '" . $contactstatic->state . "'"; + $this->errors[] = $this->db->lasterror(); + } else { + $contactstatic->state_id = $result; + $operationslog .= '
We set property state_id='.dol_escape_htmltag($result); + } + } elseif (!empty($contactstatic->state_code)) { + require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php'; + $result = dol_getIdFromCode($this->db, $contactstatic->state_code, 'c_departements', 'code_departement', 'rowid'); + if (empty($result)) { + $errorforactions++; + $this->error = "Error state not found by this code '" . $contactstatic->state_code . "'"; + } elseif (!($result > 0)) { + $errorforactions++; + $this->error = "Error when search state by this code '" . $contactstatic->state_code . "'"; + $this->errors[] = $this->db->lasterror(); + } else { + $contactstatic->state_id = $result; + $operationslog .= '
We set property state_id='.dol_escape_htmltag($result); + } + } + } + + if (!$errorforactions) { + $result = $contactstatic->create($user); + if ($result <= 0) { + $errorforactions++; + $this->error = $contactstatic->error; + $this->errors = $contactstatic->errors; + } else { + $operationslog .= '
Contact created -> id = '.dol_escape_htmltag($contactstatic->id); + } + } + } + } + } + } } elseif ($operation['type'] == 'recordevent') { // Create event $actioncomm = new ActionComm($this->db); diff --git a/htdocs/eventorganization/class/conferenceorbooth.class.php b/htdocs/eventorganization/class/conferenceorbooth.class.php index 556443a25e8..50c681150b9 100644 --- a/htdocs/eventorganization/class/conferenceorbooth.class.php +++ b/htdocs/eventorganization/class/conferenceorbooth.class.php @@ -106,7 +106,7 @@ class ConferenceOrBooth extends ActionComm 'id' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), 'ref' => array('type'=>'integer', 'label'=>'Ref', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>2, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>0, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'csslist'=>'tdoverflowmax125', 'help'=>"OrganizationEvenLabelName", 'showoncombobox'=>'1',), - 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"OrganizationEventLinkToThirdParty", 'picto'=>'company', 'css'=>'tdoverflowmax150 maxwidth500'), + 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'isModEnabled("societe")', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"OrganizationEventLinkToThirdParty", 'picto'=>'company', 'css'=>'tdoverflowmax150 maxwidth500'), 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1:t.usage_organize_event=1', 'label'=>'Project', 'enabled'=>"isModEnabled('project')", 'position'=>52, 'notnull'=>-1, 'visible'=>-1, 'index'=>1, 'picto'=>'project', 'css'=>'tdoverflowmax150 maxwidth500'), 'note' => array('type'=>'text', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>1), 'fk_action' => array('type'=>'sellist:c_actioncomm:libelle:id::module LIKE (\'%@eventorganization\')', 'label'=>'Format', 'enabled'=>'1', 'position'=>60, 'notnull'=>1, 'visible'=>1, 'css'=>'width300'), diff --git a/htdocs/eventorganization/class/conferenceorboothattendee.class.php b/htdocs/eventorganization/class/conferenceorboothattendee.class.php index abb0046606c..d46f8b54817 100644 --- a/htdocs/eventorganization/class/conferenceorboothattendee.class.php +++ b/htdocs/eventorganization/class/conferenceorboothattendee.class.php @@ -108,7 +108,7 @@ class ConferenceOrBoothAttendee extends CommonObject 'email' => array('type'=>'mail', 'label'=>'EmailAttendee', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'autofocusoncreate'=>1, 'searchall'=>1), 'firstname' => array('type'=>'varchar(100)', 'label'=>'Firstname', 'enabled'=>'1', 'position'=>31, 'notnull'=>0, 'visible'=>1, 'index'=>1, 'searchall'=>1), 'lastname' => array('type'=>'varchar(100)', 'label'=>'Lastname', 'enabled'=>'1', 'position'=>32, 'notnull'=>0, 'visible'=>1, 'index'=>1, 'searchall'=>1), - 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status = 1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'position'=>40, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"OrganizationEventLinkToThirdParty", 'picto'=>'company', 'css'=>'tdoverflowmax150 maxwidth500'), + 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status = 1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'isModEnabled("societe")', 'position'=>40, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"OrganizationEventLinkToThirdParty", 'picto'=>'company', 'css'=>'tdoverflowmax150 maxwidth500'), 'email_company' => array('type'=>'mail', 'label'=>'EmailCompany', 'enabled'=>'1', 'position'=>41, 'notnull'=>0, 'visible'=>-2, 'searchall'=>1), 'date_subscription' => array('type'=>'datetime', 'label'=>'DateOfRegistration', 'enabled'=>'1', 'position'=>56, 'notnull'=>1, 'visible'=>1, 'showoncombobox'=>'1',), 'fk_invoice' => array('type'=>'integer:Facture:compta/facture/class/facture.class.php', 'label'=>'Invoice', 'enabled'=>'$conf->facture->enabled', 'position'=>57, 'notnull'=>0, 'visible'=>-1, 'index'=>0, 'picto'=>'bill', 'css'=>'tdoverflowmax150 maxwidth500'), diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 63cbeaad67b..e0b10319b45 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -2675,6 +2675,43 @@ class ExpenseReport extends CommonObject return -1; } } + + /** + * 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, $selected,$arrayofselected; + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).''; + if (in_array($this->id, $arrayofselected)) { + $selected = 1; + } + $return .= ''; + if (property_exists($this, 'fk_user_author') && !empty($this->id)) { + $return .= '
'.$this->fk_user_author.''; + } + if (property_exists($this, 'date_debut') && property_exists($this, 'date_fin')) { + $return .= '
'.dol_print_date($this->date_debut, 'day').''; + $return .= ' '.$langs->trans("To").' '; + $return .= ''.dol_print_date($this->date_fin, 'day').''; + } + if (method_exists($this, 'getLibStatut')) { + $return .= '
'.$this->getLibStatut(5).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/expensereport/class/paymentexpensereport.class.php b/htdocs/expensereport/class/paymentexpensereport.class.php index c0ba86d55ff..5ca4135dc30 100644 --- a/htdocs/expensereport/class/paymentexpensereport.class.php +++ b/htdocs/expensereport/class/paymentexpensereport.class.php @@ -713,4 +713,41 @@ class PaymentExpenseReport extends CommonObject dol_print_error($this->db); } } + + /** + * 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 = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).''; + if (property_exists($this, 'datep')) { + $return .= '
'.$langs->trans("Date").' : '.dol_print_date($this->db->jdate($this->datep), 'dayhour').''; + } + if (property_exists($this, 'fk_typepayment')) { + $return .= '
'.$langs->trans("Type").' : '.$this->fk_typepayment.''; + } + if (property_exists($this, 'fk_bank') && !is_null($this->fk_bank)) { + $return .= '
'.$langs->trans("Account").' : '.$this->fk_bank.''; + } + if (property_exists($this, 'amount') ) { + $return .= '
'.$langs->trans("Amount").' : '.price($this->amount).''; + } + if (method_exists($this, 'getLibStatut')) { + $return .= '
'.$this->getLibStatut(5).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index ad16d5fb09f..918c916a52c 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -50,6 +50,7 @@ $confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button $toselect = GETPOST('toselect', 'array'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'expensereportlist'; +$mode = GETPOST('mode', 'alpha'); $childids = $user->getAllChildIds(1); @@ -378,6 +379,9 @@ if ($resql) { $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); } @@ -471,6 +475,7 @@ if ($resql) { print ''; print ''; print ''; + print ''; if ($id > 0) { print ''; } @@ -512,7 +517,10 @@ if ($resql) { if (!empty($socid)) { $url .= '&socid='.$socid; } - $newcardbutton = dolGetButtonTitle($langs->trans('NewTrip'), '', 'fa fa-plus-circle', $url, '', $user->rights->expensereport->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('NewTrip'), '', 'fa fa-plus-circle', $url, '', $user->rights->expensereport->creer); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'trip', 0, $newcardbutton, '', $limit, 0, 0, 1); } @@ -739,185 +747,204 @@ if ($resql) { $expensereportstatic->note_private = $obj->note_private; $expensereportstatic->note_public = $obj->note_public; + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; + } + $usertmp->fetch($obj->id_user); + $expensereportstatic->fk_user_author = $usertmp->getNomUrl(1); - print ''; - // Action column - if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - 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; + // Output Kanban + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + if ($massactionbutton || $massaction) { + $selected = 0; + + print $expensereportstatic->getKanbanView(''); } - print ''; } - print ''; - } - // Ref - if (!empty($arrayfields['d.ref']['checked'])) { - print ''; - print ''; - print ''; - // Warning late icon and note - print ''; } - if ($expensereportstatic->status == 5 && $expensereportstatic->hasDelay('topay')) { - print img_warning($langs->trans("Late")); - } - if (!empty($obj->note_private) || !empty($obj->note_public)) { - print ' '; - print ''.img_picto($langs->trans("ViewPrivateNote"), 'object_generic').''; - print ''; - } - print ''; - print ''; - print '
'; - print $expensereportstatic->getNomUrl(1); - print ''; - if ($expensereportstatic->status == 2 && $expensereportstatic->hasDelay('toappove')) { - print img_warning($langs->trans("Late")); + if ($i == (min($num, $limit) - 1)) { + print ''; + print '
'; - $filename = dol_sanitizeFileName($obj->ref); - $filedir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($obj->ref); - $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid; - print $formfile->getDocumentsLink($expensereportstatic->element, $filename, $filedir); - print '
'; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // User - if (!empty($arrayfields['user']['checked'])) { - print ''; - $usertmp->id = $obj->id_user; - $usertmp->lastname = $obj->lastname; - $usertmp->firstname = $obj->firstname; - $usertmp->login = $obj->login; - $usertmp->statut = $obj->statut; - $usertmp->photo = $obj->photo; - $usertmp->email = $obj->email; - print $usertmp->getNomUrl(-1); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Start date - if (!empty($arrayfields['d.date_debut']['checked'])) { - print ''.($obj->date_debut > 0 ? dol_print_date($db->jdate($obj->date_debut), 'day') : '').''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // End date - if (!empty($arrayfields['d.date_fin']['checked'])) { - print ''.($obj->date_fin > 0 ? dol_print_date($db->jdate($obj->date_fin), 'day') : '').''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date validation - if (!empty($arrayfields['d.date_valid']['checked'])) { - print ''.($obj->date_valid > 0 ? dol_print_date($db->jdate($obj->date_valid), 'day') : '').''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date approval - if (!empty($arrayfields['d.date_approve']['checked'])) { - print ''.($obj->date_approve > 0 ? dol_print_date($db->jdate($obj->date_approve), 'day') : '').''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Amount HT - if (!empty($arrayfields['d.total_ht']['checked'])) { - print ''.price($obj->total_ht)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'd.total_ht'; - } - $totalarray['val']['d.total_ht'] += $obj->total_ht; - } - // Amount VAT - if (!empty($arrayfields['d.total_vat']['checked'])) { - print ''.price($obj->total_tva)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'd.total_tva'; - } - $totalarray['val']['d.total_tva'] += $obj->total_tva; - } - // Amount TTC - if (!empty($arrayfields['d.total_ttc']['checked'])) { - print ''.price($obj->total_ttc)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'd.total_ttc'; - } - $totalarray['val']['d.total_ttc'] += $obj->total_ttc; - } - - // 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.date_create']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_create), 'dayhour'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date modification - if (!empty($arrayfields['d.tms']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_modif), 'dayhour'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Status - if (!empty($arrayfields['d.fk_statut']['checked'])) { - print ''.$expensereportstatic->getLibStatut(5).''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Action column - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - 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; + } else { + print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + 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 ''; } - print ''; + print ''; } - print ''; + // Ref + if (!empty($arrayfields['d.ref']['checked'])) { + print ''; + print ''; + print ''; + // Warning late icon and note + print ''; + print ''; + print '
'; + print $expensereportstatic->getNomUrl(1); + print ''; + if ($expensereportstatic->status == 2 && $expensereportstatic->hasDelay('toappove')) { + print img_warning($langs->trans("Late")); + } + if ($expensereportstatic->status == 5 && $expensereportstatic->hasDelay('topay')) { + print img_warning($langs->trans("Late")); + } + if (!empty($obj->note_private) || !empty($obj->note_public)) { + print ' '; + print ''.img_picto($langs->trans("ViewPrivateNote"), 'object_generic').''; + print ''; + } + print ''; + $filename = dol_sanitizeFileName($obj->ref); + $filedir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($obj->ref); + $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid; + print $formfile->getDocumentsLink($expensereportstatic->element, $filename, $filedir); + print '
'; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // User + if (!empty($arrayfields['user']['checked'])) { + print ''; + $usertmp->id = $obj->id_user; + $usertmp->lastname = $obj->lastname; + $usertmp->firstname = $obj->firstname; + $usertmp->login = $obj->login; + $usertmp->statut = $obj->statut; + $usertmp->photo = $obj->photo; + $usertmp->email = $obj->email; + print $usertmp->getNomUrl(-1); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Start date + if (!empty($arrayfields['d.date_debut']['checked'])) { + print ''.($obj->date_debut > 0 ? dol_print_date($db->jdate($obj->date_debut), 'day') : '').''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // End date + if (!empty($arrayfields['d.date_fin']['checked'])) { + print ''.($obj->date_fin > 0 ? dol_print_date($db->jdate($obj->date_fin), 'day') : '').''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Date validation + if (!empty($arrayfields['d.date_valid']['checked'])) { + print ''.($obj->date_valid > 0 ? dol_print_date($db->jdate($obj->date_valid), 'day') : '').''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Date approval + if (!empty($arrayfields['d.date_approve']['checked'])) { + print ''.($obj->date_approve > 0 ? dol_print_date($db->jdate($obj->date_approve), 'day') : '').''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Amount HT + if (!empty($arrayfields['d.total_ht']['checked'])) { + print ''.price($obj->total_ht)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'd.total_ht'; + } + $totalarray['val']['d.total_ht'] += $obj->total_ht; + } + // Amount VAT + if (!empty($arrayfields['d.total_vat']['checked'])) { + print ''.price($obj->total_tva)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'd.total_tva'; + } + $totalarray['val']['d.total_tva'] += $obj->total_tva; + } + // Amount TTC + if (!empty($arrayfields['d.total_ttc']['checked'])) { + print ''.price($obj->total_ttc)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'd.total_ttc'; + } + $totalarray['val']['d.total_ttc'] += $obj->total_ttc; + } + + // 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.date_create']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_create), 'dayhour'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Date modification + if (!empty($arrayfields['d.tms']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_modif), 'dayhour'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Status + if (!empty($arrayfields['d.fk_statut']['checked'])) { + print ''.$expensereportstatic->getLibStatut(5).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + 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 ''; + } + print ''; + } + if (!$i) { + $totalarray['nbfield']++; + } + + print "\n"; } - if (!$i) { - $totalarray['nbfield']++; - } - - print "\n"; - - $total_total_ht = $total_total_ht + $obj->total_ht; - $total_total_tva = $total_total_tva + $obj->total_tva; - $total_total_ttc = $total_total_ttc + $obj->total_ttc; - + $total_total_ht = $total_total_ht + $obj->total_ht; + $total_total_tva = $total_total_tva + $obj->total_tva; + $total_total_ttc = $total_total_ttc + $obj->total_ttc; $i++; } } else { diff --git a/htdocs/expensereport/payment/list.php b/htdocs/expensereport/payment/list.php index cb93aae4ff0..4c838a73b1e 100644 --- a/htdocs/expensereport/payment/list.php +++ b/htdocs/expensereport/payment/list.php @@ -48,6 +48,7 @@ $action = GETPOST('action', 'alpha'); $massaction = GETPOST('massaction', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha'); $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'vendorpaymentlist'; +$mode = GETPOST('mode', 'alpha'); $socid = GETPOST('socid', 'int'); @@ -254,6 +255,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); } @@ -315,8 +319,13 @@ print ''; print ''; print ''; +print ''; -print_barre_liste($langs->trans('ExpenseReportPayments'), $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'expensereport', 0, '', '', $limit, 0, 0, 1); +$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_barre_liste($langs->trans('ExpenseReportPayments'), $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'expensereport', 0, $newcardbutton, '', $limit, 0, 0, 1); if ($search_all) { foreach ($fieldstosearchall as $key => $val) { @@ -473,116 +482,138 @@ while ($i < min($num, $limit)) { $paymentexpensereportstatic->id = $objp->rowid; $paymentexpensereportstatic->ref = $objp->ref; - $paymentexpensereportstatic->datepaye = $objp->datep; + $paymentexpensereportstatic->datep = $objp->datep; + $paymentexpensereportstatic->amount = $objp->pamount; + $paymentexpensereportstatic->fk_typepayment = $objp->paiement_type; + + if ($objp->bid) { + $accountstatic->fetch($objp->bid); + $paymentexpensereportstatic->fk_bank = $accountstatic->getNomUrl(1); + } else { + $paymentexpensereportstatic->fk_bank = null; + } $userstatic->id = $objp->userid; $userstatic->lastname = $objp->lastname; $userstatic->firstname = $objp->firstname; - print ''; + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; + } + // Output Kanban + print $paymentexpensereportstatic->getKanbanView(''); + if ($i == (min($num, $limit) - 1)) { + print '
'; + print ''; + } + } else { + print ''; - // No - if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { - print ''.(($offset * $limit) + $i).''; + // No + if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { + print ''.(($offset * $limit) + $i).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Ref + if (!empty($arrayfields['pndf.rowid']['checked'])) { + print ''.$paymentexpensereportstatic->getNomUrl(1).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Date + if (!empty($arrayfields['pndf.datep']['checked'])) { + $dateformatforpayment = 'dayhour'; + print ''.dol_print_date($db->jdate($objp->datep), $dateformatforpayment).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Thirdparty + if (!empty($arrayfields['u.login']['checked'])) { + print ''; + if ($userstatic->id > 0) { + print $userstatic->getNomUrl(1); + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Pyament type + if (!empty($arrayfields['c.libelle']['checked'])) { + $payment_type = $langs->trans("PaymentType".$objp->paiement_type) != ("PaymentType".$objp->paiement_type) ? $langs->trans("PaymentType".$objp->paiement_type) : $objp->paiement_libelle; + print ''.$payment_type.' '.dol_trunc($objp->num_payment, 32).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Cheque number (fund transfer) + if (!empty($arrayfields['pndf.num_payment']['checked'])) { + print ''.$objp->num_payment.''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Bank account + if (!empty($arrayfields['ba.label']['checked'])) { + print ''; + if ($objp->bid) { + $accountstatic->id = $objp->bid; + $accountstatic->ref = $objp->bref; + $accountstatic->label = $objp->blabel; + $accountstatic->number = $objp->number; + $accountstatic->iban = $objp->iban_prefix; + $accountstatic->bic = $objp->bic; + $accountstatic->currency_code = $objp->currency_code; + $accountstatic->account_number = $objp->account_number; + + $accountingjournal = new AccountingJournal($db); + $accountingjournal->fetch($objp->accountancy_journal); + $accountstatic->accountancy_journal = $accountingjournal->code; + + print $accountstatic->getNomUrl(1); + } else { + print ' '; + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Amount + if (!empty($arrayfields['pndf.amount']['checked'])) { + print ''.price($objp->pamount).''; + if (!$i) { + $totalarray['nbfield']++; + } + $totalarray['pos'][$checkedCount] = 'amount'; + if (empty($totalarray['val']['amount'])) { + $totalarray['val']['amount'] = $objp->pamount; + } else { + $totalarray['val']['amount'] += $objp->pamount; + } + } + + // Buttons + print ''; if (!$i) { $totalarray['nbfield']++; } + + print ''; } - - // Ref - if (!empty($arrayfields['pndf.rowid']['checked'])) { - print ''.$paymentexpensereportstatic->getNomUrl(1).''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Date - if (!empty($arrayfields['pndf.datep']['checked'])) { - $dateformatforpayment = 'dayhour'; - print ''.dol_print_date($db->jdate($objp->datep), $dateformatforpayment).''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Thirdparty - if (!empty($arrayfields['u.login']['checked'])) { - print ''; - if ($userstatic->id > 0) { - print $userstatic->getNomUrl(1); - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Pyament type - if (!empty($arrayfields['c.libelle']['checked'])) { - $payment_type = $langs->trans("PaymentType".$objp->paiement_type) != ("PaymentType".$objp->paiement_type) ? $langs->trans("PaymentType".$objp->paiement_type) : $objp->paiement_libelle; - print ''.$payment_type.' '.dol_trunc($objp->num_payment, 32).''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Cheque number (fund transfer) - if (!empty($arrayfields['pndf.num_payment']['checked'])) { - print ''.$objp->num_payment.''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Bank account - if (!empty($arrayfields['ba.label']['checked'])) { - print ''; - if ($objp->bid) { - $accountstatic->id = $objp->bid; - $accountstatic->ref = $objp->bref; - $accountstatic->label = $objp->blabel; - $accountstatic->number = $objp->number; - $accountstatic->iban = $objp->iban_prefix; - $accountstatic->bic = $objp->bic; - $accountstatic->currency_code = $objp->currency_code; - $accountstatic->account_number = $objp->account_number; - - $accountingjournal = new AccountingJournal($db); - $accountingjournal->fetch($objp->accountancy_journal); - $accountstatic->accountancy_journal = $accountingjournal->code; - - print $accountstatic->getNomUrl(1); - } else { - print ' '; - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Amount - if (!empty($arrayfields['pndf.amount']['checked'])) { - print ''.price($objp->pamount).''; - if (!$i) { - $totalarray['nbfield']++; - } - $totalarray['pos'][$checkedCount] = 'amount'; - if (empty($totalarray['val']['amount'])) { - $totalarray['val']['amount'] = $objp->pamount; - } else { - $totalarray['val']['amount'] += $objp->pamount; - } - } - - // Buttons - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - - print ''; $i++; } diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index b072f4c756d..01533698b1c 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -38,7 +38,7 @@ class Fichinter extends CommonObject { public $fields = array( 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), - 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>15), + 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'isModEnabled("societe")', 'visible'=>-1, 'notnull'=>1, 'position'=>15), 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>'isModEnabled("project")', 'visible'=>-1, 'position'=>20), 'fk_contrat' =>array('type'=>'integer', 'label'=>'Fk contrat', 'enabled'=>'$conf->contrat->enabled', 'visible'=>-1, 'position'=>25), 'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>30), @@ -749,25 +749,25 @@ class Fichinter extends CommonObject { // phpcs:enable // Init/load array of translation of status - if (empty($this->statuts) || empty($this->statuts_short) || empty($this->statuts_logo)) { + if (empty($this->labelStatus) || empty($this->labelStatusShort)) { global $langs; $langs->load("fichinter"); - $this->statuts[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft'); - $this->statuts[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Validated'); - $this->statuts[self::STATUS_BILLED] = $langs->transnoentitiesnoconv('StatusInterInvoiced'); - $this->statuts[self::STATUS_CLOSED] = $langs->transnoentitiesnoconv('Done'); - $this->statuts_short[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft'); - $this->statuts_short[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Validated'); - $this->statuts_short[self::STATUS_BILLED] = $langs->transnoentitiesnoconv('StatusInterInvoiced'); - $this->statuts_short[self::STATUS_CLOSED] = $langs->transnoentitiesnoconv('Done'); - $this->statuts_logo[self::STATUS_DRAFT] = 'status0'; - $this->statuts_logo[self::STATUS_VALIDATED] = 'status1'; - $this->statuts_logo[self::STATUS_BILLED] = 'status6'; - $this->statuts_logo[self::STATUS_CLOSED] = 'status6'; + $this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft'); + $this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Validated'); + $this->labelStatus[self::STATUS_BILLED] = $langs->transnoentitiesnoconv('StatusInterInvoiced'); + $this->labelStatus[self::STATUS_CLOSED] = $langs->transnoentitiesnoconv('Done'); + $this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft'); + $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Validated'); + $this->labelStatusShort[self::STATUS_BILLED] = $langs->transnoentitiesnoconv('StatusInterInvoiced'); + $this->labelStatusShort[self::STATUS_CLOSED] = $langs->transnoentitiesnoconv('Done'); } - return dolGetStatus($this->statuts[$status], $this->statuts_short[$status], '', $this->statuts_logo[$status], $mode); + $statuscode = 'status'.$status; + if ($status == self::STATUS_BILLED || $status == self::STATUS_CLOSED) { + $statuscode = 'status6'; + } + return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statuscode, $mode); } /** @@ -1454,6 +1454,38 @@ class Fichinter extends CommonObject return -1; } } + + /** + * 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 = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + //$return .= ''; // Can be image + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).''; + if (property_exists($this, 'socid')) { + $return .= '
'.$this->socid.''; + } + if (property_exists($this, 'duration')) { + $return .= '
'.$langs->trans("Duration").' : '.convertSecondToTime($this->duration, 'allhourmin').''; + } + if (method_exists($this, 'getLibStatut')) { + $return .= '
'.$this->getLibStatut(5).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } /** diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index 89be444d4af..705dac46e50 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -57,6 +57,7 @@ $show_files = GETPOST('show_files', 'int'); $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'interventionlist'; +$mode = GETPOST('mode', 'alpha'); $search_ref = GETPOST('search_ref') ?GETPOST('search_ref', 'alpha') : GETPOST('search_inter', 'alpha'); $search_ref_client = GETPOST('search_ref_client', 'alpha'); @@ -460,7 +461,10 @@ $url = DOL_URL_ROOT.'/fichinter/card.php?action=create'; if (!empty($socid)) { $url .= '&socid='.$socid; } -$newcardbutton = dolGetButtonTitle($langs->trans('NewIntervention'), '', 'fa fa-plus-circle', $url, '', $user->rights->ficheinter->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('NewIntervention'), '', 'fa fa-plus-circle', $url, '', $user->rights->ficheinter->creer); print_barre_liste($title, $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -695,200 +699,219 @@ while ($i < $imaxinloop) { $companystatic->email = $obj->email; $companystatic->status = $obj->thirdpartystatus; - print ''; - // Action column - if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - 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 ''; + //mode kanban + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; } - print ''; - } - if (!empty($arrayfields['f.ref']['checked'])) { - print ""; - print ''; - // Picto + Ref - print ''; - // Warning - $warnornote = ''; - //if ($obj->fk_statut == 1 && $db->jdate($obj->dfv) < ($now - $conf->fichinter->warning_delay)) $warnornote.=img_warning($langs->trans("Late")); - if (!empty($obj->note_private)) { - $warnornote .= ($warnornote ? ' ' : ''); - $warnornote .= ''; - $warnornote .= ''.img_picto($langs->trans("ViewPrivateNote"), 'object_generic').''; - $warnornote .= ''; + // Output Kanban + $objectstatic->duration = $obj->duree; + $objectstatic->socid = $companystatic->getNomUrl(1, '', 44); + + + print $objectstatic->getKanbanView(''); + if ($i == (min($num, $limit) - 1)) { + print ''; + print ''; } - if ($warnornote) { - print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; } + if (!empty($arrayfields['f.ref']['checked'])) { + print "
'; - print $objectstatic->getNomUrl(1); - print '
'; - print $warnornote; + } else { + print '
'; + 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 ''; + } print '"; - // Other picto tool - print ''; - $filename = dol_sanitizeFileName($obj->ref); - $filedir = $conf->ficheinter->dir_output.'/'.dol_sanitizeFileName($obj->ref); - $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid; - print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); - print '
'; + print ''; + // Picto + Ref + print ''; + // Warning + $warnornote = ''; + //if ($obj->fk_statut == 1 && $db->jdate($obj->dfv) < ($now - $conf->fichinter->warning_delay)) $warnornote.=img_warning($langs->trans("Late")); + if (!empty($obj->note_private)) { + $warnornote .= ($warnornote ? ' ' : ''); + $warnornote .= ''; + $warnornote .= ''.img_picto($langs->trans("ViewPrivateNote"), 'object_generic').''; + $warnornote .= ''; + } + if ($warnornote) { + print ''; + } - print "\n"; - if (!$i) { - $totalarray['nbfield']++; + // Other picto tool + print '
'; + print $objectstatic->getNomUrl(1); + print ''; + print $warnornote; + print ''; + $filename = dol_sanitizeFileName($obj->ref); + $filedir = $conf->ficheinter->dir_output.'/'.dol_sanitizeFileName($obj->ref); + $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid; + print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); + print '
'; + + print "\n"; + if (!$i) { + $totalarray['nbfield']++; + } } - } - if (!empty($arrayfields['f.ref_client']['checked'])) { - // Customer ref - print ''; - print dol_escape_htmltag($obj->ref_client); - print ''; - if (!$i) { - $totalarray['nbfield']++; + if (!empty($arrayfields['f.ref_client']['checked'])) { + // Customer ref + print ''; + print dol_escape_htmltag($obj->ref_client); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } - } - if (!empty($arrayfields['s.nom']['checked'])) { - print ''; - print $companystatic->getNomUrl(1, '', 44); - print ''; - if (!$i) { - $totalarray['nbfield']++; + if (!empty($arrayfields['s.nom']['checked'])) { + print ''; + print $companystatic->getNomUrl(1, '', 44); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } - } - if (!empty($arrayfields['pr.ref']['checked'])) { - print ''; - $projetstatic->id = $obj->projet_id; - $projetstatic->ref = $obj->projet_ref; - $projetstatic->title = $obj->projet_title; - if ($projetstatic->id > 0) { - print $projetstatic->getNomUrl(1, ''); + if (!empty($arrayfields['pr.ref']['checked'])) { + print ''; + $projetstatic->id = $obj->projet_id; + $projetstatic->ref = $obj->projet_ref; + $projetstatic->title = $obj->projet_title; + if ($projetstatic->id > 0) { + print $projetstatic->getNomUrl(1, ''); + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } - print ''; - if (!$i) { - $totalarray['nbfield']++; + if (!empty($arrayfields['c.ref']['checked'])) { + print ''; + $contratstatic->id = $obj->contrat_id; + $contratstatic->ref = $obj->contrat_ref; + $contratstatic->ref_customer = $obj->contrat_ref_customer; + $contratstatic->ref_supplier = $obj->contrat_ref_supplier; + if ($contratstatic->id > 0) { + print $contratstatic->getNomUrl(1, ''); + print ''; + } + if (!$i) { + $totalarray['nbfield']++; + } } - } - if (!empty($arrayfields['c.ref']['checked'])) { - print ''; - $contratstatic->id = $obj->contrat_id; - $contratstatic->ref = $obj->contrat_ref; - $contratstatic->ref_customer = $obj->contrat_ref_customer; - $contratstatic->ref_supplier = $obj->contrat_ref_supplier; - if ($contratstatic->id > 0) { - print $contratstatic->getNomUrl(1, ''); + if (!empty($arrayfields['f.description']['checked'])) { + print ''.dol_trunc(dolGetFirstLineOfText(dol_string_nohtmltag($obj->description, 1)), 48).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // 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['f.datec']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Date modification + if (!empty($arrayfields['f.tms']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Note public + if (!empty($arrayfields['f.note_public']['checked'])) { + print ''; + print dol_string_nohtmltag($obj->note_public); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Note private + if (!empty($arrayfields['f.note_private']['checked'])) { + print ''; + print dol_string_nohtmltag($obj->note_private); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Status + if (!empty($arrayfields['f.fk_statut']['checked'])) { + print ''.$objectstatic->getLibStatut(5).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Fields of detail of line + if (!empty($arrayfields['fd.description']['checked'])) { + print ''.dol_trunc(dolGetFirstLineOfText(dol_string_nohtmltag($obj->descriptiondetail, 1)), 48).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['fd.date']['checked'])) { + print ''.dol_print_date($db->jdate($obj->dp), 'dayhour')."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['fd.duree']['checked'])) { + print ''.convertSecondToTime($obj->duree, 'allhourmin').''; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['type'][$totalarray['nbfield']] = 'duration'; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'fd.duree'; + } + $totalarray['val']['fd.duree'] += $obj->duree; + } + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + 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 ''; + } print ''; } if (!$i) { $totalarray['nbfield']++; } - } - if (!empty($arrayfields['f.description']['checked'])) { - print ''.dol_trunc(dolGetFirstLineOfText(dol_string_nohtmltag($obj->description, 1)), 48).''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // 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['f.datec']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date modification - if (!empty($arrayfields['f.tms']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Note public - if (!empty($arrayfields['f.note_public']['checked'])) { - print ''; - print dol_string_nohtmltag($obj->note_public); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Note private - if (!empty($arrayfields['f.note_private']['checked'])) { - print ''; - print dol_string_nohtmltag($obj->note_private); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Status - if (!empty($arrayfields['f.fk_statut']['checked'])) { - print ''.$objectstatic->getLibStatut(5).''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Fields of detail of line - if (!empty($arrayfields['fd.description']['checked'])) { - print ''.dol_trunc(dolGetFirstLineOfText(dol_string_nohtmltag($obj->descriptiondetail, 1)), 48).''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['fd.date']['checked'])) { - print ''.dol_print_date($db->jdate($obj->dp), 'dayhour')."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['fd.duree']['checked'])) { - print ''.convertSecondToTime($obj->duree, 'allhourmin').''; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['type'][$totalarray['nbfield']] = 'duration'; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'fd.duree'; - } - $totalarray['val']['fd.duree'] += $obj->duree; - } - // Action column - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - 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 ''; - } - print ''; - } - if (!$i) { - $totalarray['nbfield']++; - } + print ''."\n"; - print ''."\n"; - - $total += $obj->duree; + $total += $obj->duree; + } $i++; } diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index aca15e9d7a3..a5b5264052d 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -138,10 +138,10 @@ if (!empty($dolibarr_main_prod)) { } // Clean parameters -$dolibarr_main_data_root = trim($dolibarr_main_data_root); -$dolibarr_main_url_root = trim(preg_replace('/\/+$/', '', $dolibarr_main_url_root)); +$dolibarr_main_data_root = (empty($dolibarr_main_data_root) ? '' : trim($dolibarr_main_data_root)); +$dolibarr_main_url_root = trim(preg_replace('/\/+$/', '', empty($dolibarr_main_url_root) ? '' : $dolibarr_main_url_root)); $dolibarr_main_url_root_alt = (empty($dolibarr_main_url_root_alt) ? '' : trim($dolibarr_main_url_root_alt)); -$dolibarr_main_document_root = trim($dolibarr_main_document_root); +$dolibarr_main_document_root = (empty($dolibarr_main_document_root) ? '' : trim($dolibarr_main_document_root)); $dolibarr_main_document_root_alt = (empty($dolibarr_main_document_root_alt) ? '' : trim($dolibarr_main_document_root_alt)); if (empty($dolibarr_main_db_port)) { diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 1ae5ffd04ce..a08f2046790 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -254,7 +254,7 @@ class CommandeFournisseur extends CommonOrder 'multicurrency_total_tva' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountVAT', 'enabled'=>'isModEnabled("multicurrency")', 'visible'=>-1, 'position'=>235), 'multicurrency_total_ttc' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountTTC', 'enabled'=>'isModEnabled("multicurrency")', 'visible'=>-1, 'position'=>240), 'date_creation' =>array('type'=>'datetime', 'label'=>'Date creation', 'enabled'=>1, 'visible'=>-1, 'position'=>500), - 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>1, 'notnull'=>1, 'position'=>46), + 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'isModEnabled("societe")', 'visible'=>1, 'notnull'=>1, 'position'=>46), 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>1000, 'index'=>1), 'tms'=>array('type'=>'datetime', 'label'=>"DateModificationShort", 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>501), 'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>1, 'visible'=>0, 'position'=>700), @@ -3544,6 +3544,38 @@ class CommandeFournisseur extends CommonOrder return -1; } } + + /** + * 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 = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + //$return .= ''; // Can be image + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).''; + if (property_exists($this, 'socid') || property_exists($this, 'total_tva')) { + $return .='
'.$this->socid.''; + } + if (property_exists($this, 'billed')) { + $return .= '
'.$langs->trans("Billed").' : '.yn($this->billed).''; + } + if (method_exists($this, 'getLibStatut')) { + $return .= '
'.$this->getLibStatut(5).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php index 1570f161582..8964213f83d 100644 --- a/htdocs/fourn/class/fournisseur.facture-rec.class.php +++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php @@ -181,7 +181,7 @@ class FactureFournisseurRec extends CommonInvoice 'titre' =>array('type'=>'varchar(100)', 'label'=>'Titre', 'enabled'=>1, 'showoncombobox' => 1, 'visible'=>-1, 'position'=>15), 'ref_supplier' =>array('type'=>'varchar(180)', 'label'=>'RefSupplier', 'enabled'=>1, 'showoncombobox' => 1, 'visible'=>-1, 'position'=>20), 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>25, 'index'=>1), - 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>30), + 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'isModEnabled("societe")', 'visible'=>-1, 'notnull'=>1, 'position'=>30), 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>35), 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>40), 'suspended' =>array('type'=>'integer', 'label'=>'Suspended', 'enabled'=>1, 'visible'=>-1, 'position'=>225), @@ -1331,7 +1331,7 @@ class FactureFournisseurRec extends CommonInvoice // We refresh the object in order to have all necessary data (like date_lim_reglement) $new_fac_fourn->fetch($new_fac_fourn->id); $result = $new_fac_fourn->generateDocument($facturerec->model_pdf, $langs); - if ($result <= 0) { + if ($result < 0) { $this->errors = $new_fac_fourn->errors; $this->error = $new_fac_fourn->error; $error++; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 4906ae21a09..9ca933b7c43 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -275,7 +275,7 @@ class FactureFournisseur extends CommonInvoice 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>25, 'index'=>1), 'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'RefExt', 'enabled'=>1, 'visible'=>0, 'position'=>30), 'type' =>array('type'=>'smallint(6)', 'label'=>'Type', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35), - 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>40), + 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'isModEnabled("societe")', 'visible'=>-1, 'notnull'=>1, 'position'=>40), 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>45), 'datef' =>array('type'=>'date', 'label'=>'Date', 'enabled'=>1, 'visible'=>-1, 'position'=>50), 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>55), @@ -3233,6 +3233,43 @@ class FactureFournisseur extends CommonInvoice return $isUsed; } + /** + * 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 = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).''; + if (property_exists($this, 'socid')) { + $return .= ' | '.$this->socid.''; + } + if (property_exists($this, 'date_echeance') && property_exists($this, 'date')) { + if (!empty($this->date_echeance)) { + $return .= '
'.dol_print_date($this->date_echeance).''; + } else { + $return .= '
'.dol_print_date($this->date).''; + } + } + if (property_exists($this, 'total_ht')) { + $return .= '
'.$langs->trans("AmountHT").' : '.price($this->total_ht).''; + } + if (method_exists($this, 'getLibStatut')) { + $return .= '
'.$this->getLibStatut(5).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 1b8dbed46e2..394660f3866 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -56,6 +56,7 @@ $show_files = GETPOST('show_files', 'int'); $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'supplierorderlist'; +$mode = GETPOST('mode', 'alpha'); // Search Criteria $search_date_order_startday = GETPOST('search_date_order_startday', 'int'); @@ -576,6 +577,9 @@ if (empty($reshook)) { // Make a redirect to avoid to bill twice if we make a refresh or back $param = ''; + if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); + } if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -998,6 +1002,9 @@ if ($resql) { llxHeader('', $title, $help_url); $param = ''; + if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); + } if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -1184,7 +1191,10 @@ if ($resql) { $url .= '&socid='.((int) $socid); $url .= '&backtopage='.urlencode(DOL_URL_ROOT.'/fourn/commande/list.php?socid='.((int) $socid)); } - $newcardbutton = dolGetButtonTitle($langs->trans('NewSupplierOrderShort'), '', 'fa fa-plus-circle', $url, '', $permissiontoadd); + $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('NewSupplierOrderShort'), '', 'fa fa-plus-circle', $url, '', $permissiontoadd); // Lines of title fields print ''; @@ -1198,6 +1208,7 @@ if ($resql) { print ''; print ''; print ''; + print ''; print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'supplier_order', 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -1660,344 +1671,365 @@ if ($resql) { $objectstatic->note_private = $obj->note_private; $objectstatic->statut = $obj->fk_statut; - print ''; - // Action column - if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - 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 ''; + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; } - print ''; - } - // Ref - if (!empty($arrayfields['cf.ref']['checked'])) { - print ''; - // Picto + Ref - print $objectstatic->getNomUrl(1, '', 0, -1, 1); - // Other picto tool - $filename = dol_sanitizeFileName($obj->ref); - $filedir = $conf->fournisseur->commande->dir_output.'/'.dol_sanitizeFileName($obj->ref); - print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); - - print ''."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Ref Supplier - if (!empty($arrayfields['cf.ref_supplier']['checked'])) { - print ''.dol_escape_htmltag($obj->ref_supplier).''."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Project - if (!empty($arrayfields['cf.fk_projet']['checked'])) { - $projectstatic->id = $obj->project_id; - $projectstatic->ref = $obj->project_ref; - $projectstatic->title = $obj->project_title; - print ''; - if ($obj->project_id > 0) { - print $projectstatic->getNomUrl(1); - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Author - $userstatic->id = $obj->fk_user_author; - $userstatic->lastname = $obj->lastname; - $userstatic->firstname = $obj->firstname; - $userstatic->login = $obj->login; - $userstatic->photo = $obj->photo; - $userstatic->email = $obj->user_email; - $userstatic->statut = $obj->user_status; - if (!empty($arrayfields['u.login']['checked'])) { - print ''; - if ($userstatic->id) { - print $userstatic->getNomUrl(1); - } - print ""; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Thirdparty - if (!empty($arrayfields['cf.fk_soc']['checked'])) { - print ''; $thirdpartytmp->id = $obj->socid; $thirdpartytmp->name = $obj->name; $thirdpartytmp->email = $obj->email; $thirdpartytmp->name_alias = $obj->alias; $thirdpartytmp->client = $obj->client; $thirdpartytmp->fournisseur = $obj->fournisseur; - print $thirdpartytmp->getNomUrl(1, 'supplier', 0, 0, -1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1); - print ''."\n"; - if (!$i) { - $totalarray['nbfield']++; + $objectstatic->socid = $thirdpartytmp->getNomUrl('supplier', 0, 0, -1); + // Output Kanban + print $objectstatic->getKanbanView(''); + if ($i == (min($num, $limit) - 1)) { + print '
'; + print ''; } - } - //alias - if (!empty($arrayfields['s.name_alias']['checked'])) { - print ''; - print $obj->alias; - print ''."\n"; - if (!$i) { - $totalarray['nbfield']++; + } else { + print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + 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 ''; + } + print ''; } - } - // Town - if (!empty($arrayfields['s.town']['checked'])) { - print ''; - print $obj->town; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Zip - if (!empty($arrayfields['s.zip']['checked'])) { - print ''; - print $obj->zip; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // State - if (!empty($arrayfields['state.nom']['checked'])) { - print "".$obj->state_name."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Country - if (!empty($arrayfields['country.code_iso']['checked'])) { - print ''; - $tmparray = getCountry($obj->fk_pays, 'all'); - print $tmparray['label']; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Type ent - if (!empty($arrayfields['typent.code']['checked'])) { - print ''; - if (empty($typenArray)) { - $typenArray = $formcompany->typent_array(1); - } - print $typenArray[$obj->typent_code]; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } + // Ref + if (!empty($arrayfields['cf.ref']['checked'])) { + print ''; - // Order date - if (!empty($arrayfields['cf.date_commande']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_commande), 'day'); - if ($objectstatic->statut != $objectstatic::STATUS_ORDERSENT && $objectstatic->statut != $objectstatic::STATUS_RECEIVED_PARTIALLY) { - if ($objectstatic->hasDelay()) { - print ' '.img_picto($langs->trans("Late").' : '.$objectstatic->showDelay(), "warning"); + // Picto + Ref + print $objectstatic->getNomUrl(1, '', 0, -1, 1); + // Other picto tool + $filename = dol_sanitizeFileName($obj->ref); + $filedir = $conf->fournisseur->commande->dir_output.'/'.dol_sanitizeFileName($obj->ref); + print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); + + print ''."\n"; + if (!$i) { + $totalarray['nbfield']++; } } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Plannned date of delivery - if (!empty($arrayfields['cf.date_livraison']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_livraison), 'day'); - if ($objectstatic->statut == $objectstatic::STATUS_ORDERSENT || $objectstatic->statut == $objectstatic::STATUS_RECEIVED_PARTIALLY) { - if ($objectstatic->hasDelay()) { - print ' '.img_picto($langs->trans("Late").' : '.$objectstatic->showDelay(), "warning"); + // Ref Supplier + if (!empty($arrayfields['cf.ref_supplier']['checked'])) { + print ''.dol_escape_htmltag($obj->ref_supplier).''."\n"; + if (!$i) { + $totalarray['nbfield']++; } } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Amount HT - if (!empty($arrayfields['cf.total_ht']['checked'])) { - print ''.price($obj->total_ht)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'cf.total_ht'; - } - $totalarray['val']['cf.total_ht'] += $obj->total_ht; - } - // Amount VAT - if (!empty($arrayfields['cf.total_tva']['checked'])) { - print ''.price($obj->total_tva)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'cf.total_tva'; - } - $totalarray['val']['cf.total_tva'] += $obj->total_tva; - } - // Amount TTC - if (!empty($arrayfields['cf.total_ttc']['checked'])) { - print ''.price($obj->total_ttc)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'cf.total_ttc'; - } - $totalarray['val']['cf.total_ttc'] += $obj->total_ttc; - } - - // Currency - if (!empty($arrayfields['cf.multicurrency_code']['checked'])) { - print ''.$obj->multicurrency_code.' - '.$langs->trans('Currency'.$obj->multicurrency_code)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Currency rate - if (!empty($arrayfields['cf.multicurrency_tx']['checked'])) { - print ''; - $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code); - print "\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Amount HT - if (!empty($arrayfields['cf.multicurrency_total_ht']['checked'])) { - print ''.price($obj->multicurrency_total_ht)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Amount VAT - if (!empty($arrayfields['cf.multicurrency_total_tva']['checked'])) { - print ''.price($obj->multicurrency_total_tva)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Amount TTC - if (!empty($arrayfields['cf.multicurrency_total_ttc']['checked'])) { - print ''.price($obj->multicurrency_total_ttc)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // 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['cf.date_creation']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date modification - if (!empty($arrayfields['cf.tms']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Status - if (!empty($arrayfields['cf.fk_statut']['checked'])) { - print ''.$objectstatic->LibStatut($obj->fk_statut, 5, $obj->billed).''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Billed - if (!empty($arrayfields['cf.billed']['checked'])) { - print ''.yn($obj->billed).''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // valid date - if (!empty($arrayfields['cf.date_valid']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_valid), 'day'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // approve date - if (!empty($arrayfields['cf.date_approve']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_approve), 'day'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Note public - if (!empty($arrayfields['cf.note_public']['checked'])) { - print ''; - print dol_string_nohtmltag($obj->note_public); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Note private - if (!empty($arrayfields['cf.note_private']['checked'])) { - print ''; - print dol_string_nohtmltag($obj->note_private); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Action column - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - 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; + // Project + if (!empty($arrayfields['cf.fk_projet']['checked'])) { + $projectstatic->id = $obj->project_id; + $projectstatic->ref = $obj->project_ref; + $projectstatic->title = $obj->project_title; + print ''; + if ($obj->project_id > 0) { + print $projectstatic->getNomUrl(1); + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Author + $userstatic->id = $obj->fk_user_author; + $userstatic->lastname = $obj->lastname; + $userstatic->firstname = $obj->firstname; + $userstatic->login = $obj->login; + $userstatic->photo = $obj->photo; + $userstatic->email = $obj->user_email; + $userstatic->statut = $obj->user_status; + if (!empty($arrayfields['u.login']['checked'])) { + print ''; + if ($userstatic->id) { + print $userstatic->getNomUrl(1); + } + print ""; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Thirdparty + if (!empty($arrayfields['cf.fk_soc']['checked'])) { + print ''; + $thirdpartytmp->id = $obj->socid; + $thirdpartytmp->name = $obj->name; + $thirdpartytmp->email = $obj->email; + $thirdpartytmp->name_alias = $obj->alias; + $thirdpartytmp->client = $obj->client; + $thirdpartytmp->fournisseur = $obj->fournisseur; + print $thirdpartytmp->getNomUrl(1, 'supplier', 0, 0, -1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1); + print ''."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + //alias + if (!empty($arrayfields['s.name_alias']['checked'])) { + print ''; + print $obj->alias; + print ''."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Town + if (!empty($arrayfields['s.town']['checked'])) { + print ''; + print $obj->town; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Zip + if (!empty($arrayfields['s.zip']['checked'])) { + print ''; + print $obj->zip; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // State + if (!empty($arrayfields['state.nom']['checked'])) { + print "".$obj->state_name."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Country + if (!empty($arrayfields['country.code_iso']['checked'])) { + print ''; + $tmparray = getCountry($obj->fk_pays, 'all'); + print $tmparray['label']; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Type ent + if (!empty($arrayfields['typent.code']['checked'])) { + print ''; + if (empty($typenArray)) { + $typenArray = $formcompany->typent_array(1); + } + print $typenArray[$obj->typent_code]; + print ''; + if (!$i) { + $totalarray['nbfield']++; } - print ''; } - print ''; - } - if (!$i) { - $totalarray['nbfield']++; - } - print "\n"; + // Order date + if (!empty($arrayfields['cf.date_commande']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_commande), 'day'); + if ($objectstatic->statut != $objectstatic::STATUS_ORDERSENT && $objectstatic->statut != $objectstatic::STATUS_RECEIVED_PARTIALLY) { + if ($objectstatic->hasDelay()) { + print ' '.img_picto($langs->trans("Late").' : '.$objectstatic->showDelay(), "warning"); + } + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Plannned date of delivery + if (!empty($arrayfields['cf.date_livraison']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_livraison), 'day'); + if ($objectstatic->statut == $objectstatic::STATUS_ORDERSENT || $objectstatic->statut == $objectstatic::STATUS_RECEIVED_PARTIALLY) { + if ($objectstatic->hasDelay()) { + print ' '.img_picto($langs->trans("Late").' : '.$objectstatic->showDelay(), "warning"); + } + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Amount HT + if (!empty($arrayfields['cf.total_ht']['checked'])) { + print ''.price($obj->total_ht)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'cf.total_ht'; + } + $totalarray['val']['cf.total_ht'] += $obj->total_ht; + } + // Amount VAT + if (!empty($arrayfields['cf.total_tva']['checked'])) { + print ''.price($obj->total_tva)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'cf.total_tva'; + } + $totalarray['val']['cf.total_tva'] += $obj->total_tva; + } + // Amount TTC + if (!empty($arrayfields['cf.total_ttc']['checked'])) { + print ''.price($obj->total_ttc)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'cf.total_ttc'; + } + $totalarray['val']['cf.total_ttc'] += $obj->total_ttc; + } - $total += $obj->total_ht; - $subtotal += $obj->total_ht; + // Currency + if (!empty($arrayfields['cf.multicurrency_code']['checked'])) { + print ''.$obj->multicurrency_code.' - '.$langs->trans('Currency'.$obj->multicurrency_code)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Currency rate + if (!empty($arrayfields['cf.multicurrency_tx']['checked'])) { + print ''; + $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code); + print "\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Amount HT + if (!empty($arrayfields['cf.multicurrency_total_ht']['checked'])) { + print ''.price($obj->multicurrency_total_ht)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Amount VAT + if (!empty($arrayfields['cf.multicurrency_total_tva']['checked'])) { + print ''.price($obj->multicurrency_total_tva)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Amount TTC + if (!empty($arrayfields['cf.multicurrency_total_ttc']['checked'])) { + print ''.price($obj->multicurrency_total_ttc)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // 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['cf.date_creation']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Date modification + if (!empty($arrayfields['cf.tms']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Status + if (!empty($arrayfields['cf.fk_statut']['checked'])) { + print ''.$objectstatic->LibStatut($obj->fk_statut, 5, $obj->billed).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Billed + if (!empty($arrayfields['cf.billed']['checked'])) { + print ''.yn($obj->billed).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // valid date + if (!empty($arrayfields['cf.date_valid']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_valid), 'day'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // approve date + if (!empty($arrayfields['cf.date_approve']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_approve), 'day'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Note public + if (!empty($arrayfields['cf.note_public']['checked'])) { + print ''; + print dol_string_nohtmltag($obj->note_public); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Note private + if (!empty($arrayfields['cf.note_private']['checked'])) { + print ''; + print dol_string_nohtmltag($obj->note_private); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + 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 ''; + } + print ''; + } + if (!$i) { + $totalarray['nbfield']++; + } + + print "\n"; + + $total += $obj->total_ht; + $subtotal += $obj->total_ht; + } $i++; } diff --git a/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php b/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php index 192a39c9b06..e2e9fb5f899 100644 --- a/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php +++ b/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php @@ -46,7 +46,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) { ?> trans("SupplierOrder"); ?> - trans("ShowOrder"), "order").' '.$objectlink->ref; ?> + getNomUrl(1); ?> ref_supplier; ?> date, 'day'); ?> 0 && $limit != $conf->liste_limit) { if ($search_all) { $param .= '&search_all='.urlencode($search_all); } -if ($search_date_startday) { - $param .= '&search_date_startday='.urlencode($search_date_startday); +if ($search_date_start) { + $param .= buildParamDate('search_date_start', null, '', 'tzserver'); } -if ($search_date_startmonth) { - $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); -} -if ($search_date_startyear) { - $param .= '&search_date_startyear='.urlencode($search_date_startyear); -} -if ($search_date_endday) { - $param .= '&search_date_endday='.urlencode($search_date_endday); -} -if ($search_date_endmonth) { - $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); -} -if ($search_date_endyear) { - $param .= '&search_date_endyear='.urlencode($search_date_endyear); +if ($search_date_end) { + $param .= buildParamDate('search_date_end', null, '', 'tzserver'); } if ($search_datelimit_startday) { $param .= '&search_datelimit_startday='.urlencode($search_datelimit_startday); @@ -918,7 +897,10 @@ $url = DOL_URL_ROOT.'/fourn/facture/card.php?action=create'; if (!empty($socid)) { $url .= '&socid='.urlencode($socid); } -$newcardbutton = dolGetButtonTitle($langs->trans('NewBill'), '', 'fa fa-plus-circle', $url, '', ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->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('NewBill'), '', 'fa fa-plus-circle', $url, '', ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer)); $i = 0; print ''."\n"; @@ -1430,409 +1412,423 @@ if ($num > 0) { $remaintopay = -$facturestatic->getSumFromThisCreditNotesNotUsed(); } } - - print ''; - // Action column - if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - 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->facid, $arrayofselected)) { - $selected = 1; + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; + } + // Output Kanban + $facturestatic->socid = $thirdparty->getNomUrl(1, 'supplier', 3); + $facturestatic->total_ht = $obj->total_ht; + $facturestatic->date = $obj->datef; + print $facturestatic->getKanbanView(''); + if ($i == (min($num, $limit) - 1)) { + print '
'; + print ''; + } + } else { + print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + 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->facid, $arrayofselected)) { + $selected = 1; + } + print ''; } - print ''; + print ''; } - print ''; - } - if (!empty($arrayfields['f.ref']['checked'])) { - print ''; + if (!empty($arrayfields['f.ref']['checked'])) { + print ''; - print ''; - // Picto + Ref - print '
'; - print $facturestatic->getNomUrl(1, '', 0, 0, '', 0, -1, 1); + print ''; + // Picto + Ref + print '
'; + print $facturestatic->getNomUrl(1, '', 0, 0, '', 0, -1, 1); - $filename = dol_sanitizeFileName($obj->ref); - $filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($obj->facid, 2, 0, 0, $facturestatic, 'invoice_supplier').dol_sanitizeFileName($obj->ref); - $subdir = get_exdir($obj->facid, 2, 0, 0, $facturestatic, 'invoice_supplier').dol_sanitizeFileName($obj->ref); - print $formfile->getDocumentsLink('facture_fournisseur', $subdir, $filedir); - print '
'; + $filename = dol_sanitizeFileName($obj->ref); + $filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($obj->facid, 2, 0, 0, $facturestatic, 'invoice_supplier').dol_sanitizeFileName($obj->ref); + $subdir = get_exdir($obj->facid, 2, 0, 0, $facturestatic, 'invoice_supplier').dol_sanitizeFileName($obj->ref); + print $formfile->getDocumentsLink('facture_fournisseur', $subdir, $filedir); + print '
'; - print "\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Supplier ref - if (!empty($arrayfields['f.ref_supplier']['checked'])) { - print ''; - print $obj->ref_supplier; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Type - if (!empty($arrayfields['f.type']['checked'])) { - print ''; - print $facturestatic->getLibType(); - print ""; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Label - if (!empty($arrayfields['f.label']['checked'])) { - print ''; - print $obj->label; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Date - if (!empty($arrayfields['f.datef']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->datef), 'day'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Date limit - if (!empty($arrayfields['f.date_lim_reglement']['checked'])) { - print ''.dol_print_date($datelimit, 'day'); - if ($facturestatic->hasDelay()) { - print img_warning($langs->trans('Alert').' - '.$langs->trans('Late')); - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Project - if (!empty($arrayfields['p.ref']['checked'])) { - print ''; - if ($obj->project_id > 0) { - $projectstatic->id = $obj->project_id; - $projectstatic->ref = $obj->project_ref; - $projectstatic->title = $obj->project_label; - print $projectstatic->getNomUrl(1); - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Third party - if (!empty($arrayfields['s.nom']['checked'])) { - print ''; - print $thirdparty->getNomUrl(1, 'supplier', 0, 0, -1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Alias - if (!empty($arrayfields['s.name_alias']['checked'])) { - print ''; - print $thirdparty->name_alias; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Town - if (!empty($arrayfields['s.town']['checked'])) { - print ''; - print $obj->town; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Zip - if (!empty($arrayfields['s.zip']['checked'])) { - print ''; - print dol_escape_htmltag($obj->zip); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // State - if (!empty($arrayfields['state.nom']['checked'])) { - print "".$obj->state_name."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Country - if (!empty($arrayfields['country.code_iso']['checked'])) { - print ''; - $tmparray = getCountry($obj->fk_pays, 'all'); - print $tmparray['label']; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Type ent - if (!empty($arrayfields['typent.code']['checked'])) { - print ''; - if (empty($typenArray)) { - $typenArray = $formcompany->typent_array(1); - } - print $typenArray[$obj->typent_code]; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Payment condition - if (!empty($arrayfields['f.fk_cond_reglement']['checked'])) { - $s = $form->form_conditions_reglement($_SERVER['PHP_SELF'], $obj->fk_cond_reglement, 'none', 1, '', -1, -1, 1); - print ''; - print dol_escape_htmltag($s); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Payment mode - if (!empty($arrayfields['f.fk_mode_reglement']['checked'])) { - $s = $form->form_modes_reglement($_SERVER['PHP_SELF'], $obj->fk_mode_reglement, 'none', '', -1, 0, '', 1); - print ''; - print dol_escape_htmltag($s); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Amount HT - if (!empty($arrayfields['f.total_ht']['checked'])) { - print ''.price($obj->total_ht)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'f.total_ht'; - } - $totalarray['val']['f.total_ht'] += $obj->total_ht; - } - // Amount VAT - if (!empty($arrayfields['f.total_vat']['checked'])) { - print ''.price($obj->total_vat)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'f.total_vat'; - } - $totalarray['val']['f.total_vat'] += $obj->total_vat; - } - // Amount LocalTax1 - if (!empty($arrayfields['f.total_localtax1']['checked'])) { - print ''.price($obj->total_localtax1)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'f.total_localtax1'; - } - $totalarray['val']['f.total_localtax1'] += $obj->total_localtax1; - } - // Amount LocalTax2 - if (!empty($arrayfields['f.total_localtax2']['checked'])) { - print ''.price($obj->total_localtax2)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'f.total_localtax2'; - } - $totalarray['val']['f.total_localtax2'] += $obj->total_localtax2; - } - // Amount TTC - if (!empty($arrayfields['f.total_ttc']['checked'])) { - print ''.price($obj->total_ttc)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'f.total_ttc'; - } - $totalarray['val']['f.total_ttc'] += $obj->total_ttc; - } - - $userstatic->id = $obj->fk_user_author; - $userstatic->login = $obj->login; - $userstatic->lastname = $obj->lastname; - $userstatic->firstname = $obj->firstname; - $userstatic->email = $obj->user_email; - $userstatic->statut = $obj->user_statut; - $userstatic->entity = $obj->entity; - $userstatic->photo = $obj->photo; - $userstatic->office_phone = $obj->office_phone; - $userstatic->office_fax = $obj->office_fax; - $userstatic->user_mobile = $obj->user_mobile; - $userstatic->job = $obj->job; - $userstatic->gender = $obj->gender; - - // Author - if (!empty($arrayfields['u.login']['checked'])) { - print ''; - if ($userstatic->id) { - print $userstatic->getLoginUrl(-1); - } else { - print ' '; - } - print "\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - - if (!empty($arrayfields['dynamount_payed']['checked'])) { - print ''.(!empty($totalpay) ?price($totalpay, 0, $langs) : '').''; // TODO Use a denormalized field - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'totalam'; - } - $totalarray['val']['totalam'] += $totalpay; - } - - if (!empty($arrayfields['rtp']['checked'])) { - print ''.(!empty($remaintopay) ?price($remaintopay, 0, $langs) : ' ').''; // TODO Use a denormalized field - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'rtp'; - } - $totalarray['val']['rtp'] += $remaintopay; - } - - // Currency - if (!empty($arrayfields['f.multicurrency_code']['checked'])) { - print ''.$obj->multicurrency_code.' - '.$langs->trans('Currency'.$obj->multicurrency_code)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Currency rate - if (!empty($arrayfields['f.multicurrency_tx']['checked'])) { - print ''; - $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code); - print "\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Amount HT - if (!empty($arrayfields['f.multicurrency_total_ht']['checked'])) { - print ''.price($obj->multicurrency_total_ht)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Amount VAT - if (!empty($arrayfields['f.multicurrency_total_vat']['checked'])) { - print ''.price($obj->multicurrency_total_vat)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Amount TTC - if (!empty($arrayfields['f.multicurrency_total_ttc']['checked'])) { - print ''.price($obj->multicurrency_total_ttc)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['multicurrency_dynamount_payed']['checked'])) { - print ''.(!empty($multicurrency_totalpay) ?price($multicurrency_totalpay, 0, $langs) : '').''; // TODO Use a denormalized field - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Pending amount - if (!empty($arrayfields['multicurrency_rtp']['checked'])) { - print ''; - print (!empty($multicurrency_remaintopay) ? price($multicurrency_remaintopay, 0, $langs) : ''); - print ''; // TODO Use a denormalized field - if (!$i) { - $totalarray['nbfield']++; - } - } - - - // 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['f.datec']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date modification - if (!empty($arrayfields['f.tms']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Status - if (!empty($arrayfields['f.fk_statut']['checked'])) { - print ''; - print $facturestatic->LibStatut($obj->paye, $obj->fk_statut, 5, $paiement, $obj->type); - print ""; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Action column - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - 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->facid, $arrayofselected)) { - $selected = 1; + print "\n"; + if (!$i) { + $totalarray['nbfield']++; } - print ''; } - print ''; - } - if (!$i) { - $totalarray['nbfield']++; - } - print "\n"; + // Supplier ref + if (!empty($arrayfields['f.ref_supplier']['checked'])) { + print ''; + print $obj->ref_supplier; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Type + if (!empty($arrayfields['f.type']['checked'])) { + print ''; + print $facturestatic->getLibType(); + print ""; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Label + if (!empty($arrayfields['f.label']['checked'])) { + print ''; + print $obj->label; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Date + if (!empty($arrayfields['f.datef']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->datef), 'day'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Date limit + if (!empty($arrayfields['f.date_lim_reglement']['checked'])) { + print ''.dol_print_date($datelimit, 'day'); + if ($facturestatic->hasDelay()) { + print img_warning($langs->trans('Alert').' - '.$langs->trans('Late')); + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Project + if (!empty($arrayfields['p.ref']['checked'])) { + print ''; + if ($obj->project_id > 0) { + $projectstatic->id = $obj->project_id; + $projectstatic->ref = $obj->project_ref; + $projectstatic->title = $obj->project_label; + print $projectstatic->getNomUrl(1); + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Third party + if (!empty($arrayfields['s.nom']['checked'])) { + print ''; + print $thirdparty->getNomUrl(1, 'supplier', 0, 0, -1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Alias + if (!empty($arrayfields['s.name_alias']['checked'])) { + print ''; + print $thirdparty->name_alias; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Town + if (!empty($arrayfields['s.town']['checked'])) { + print ''; + print $obj->town; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Zip + if (!empty($arrayfields['s.zip']['checked'])) { + print ''; + print dol_escape_htmltag($obj->zip); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // State + if (!empty($arrayfields['state.nom']['checked'])) { + print "".$obj->state_name."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Country + if (!empty($arrayfields['country.code_iso']['checked'])) { + print ''; + $tmparray = getCountry($obj->fk_pays, 'all'); + print $tmparray['label']; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Type ent + if (!empty($arrayfields['typent.code']['checked'])) { + print ''; + if (empty($typenArray)) { + $typenArray = $formcompany->typent_array(1); + } + print $typenArray[$obj->typent_code]; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Payment condition + if (!empty($arrayfields['f.fk_cond_reglement']['checked'])) { + $s = $form->form_conditions_reglement($_SERVER['PHP_SELF'], $obj->fk_cond_reglement, 'none', 1, '', -1, -1, 1); + print ''; + print dol_escape_htmltag($s); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Payment mode + if (!empty($arrayfields['f.fk_mode_reglement']['checked'])) { + $s = $form->form_modes_reglement($_SERVER['PHP_SELF'], $obj->fk_mode_reglement, 'none', '', -1, 0, '', 1); + print ''; + print dol_escape_htmltag($s); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Amount HT + if (!empty($arrayfields['f.total_ht']['checked'])) { + print ''.price($obj->total_ht)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'f.total_ht'; + } + $totalarray['val']['f.total_ht'] += $obj->total_ht; + } + // Amount VAT + if (!empty($arrayfields['f.total_vat']['checked'])) { + print ''.price($obj->total_vat)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'f.total_vat'; + } + $totalarray['val']['f.total_vat'] += $obj->total_vat; + } + // Amount LocalTax1 + if (!empty($arrayfields['f.total_localtax1']['checked'])) { + print ''.price($obj->total_localtax1)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'f.total_localtax1'; + } + $totalarray['val']['f.total_localtax1'] += $obj->total_localtax1; + } + // Amount LocalTax2 + if (!empty($arrayfields['f.total_localtax2']['checked'])) { + print ''.price($obj->total_localtax2)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'f.total_localtax2'; + } + $totalarray['val']['f.total_localtax2'] += $obj->total_localtax2; + } + // Amount TTC + if (!empty($arrayfields['f.total_ttc']['checked'])) { + print ''.price($obj->total_ttc)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'f.total_ttc'; + } + $totalarray['val']['f.total_ttc'] += $obj->total_ttc; + } + + $userstatic->id = $obj->fk_user_author; + $userstatic->login = $obj->login; + $userstatic->lastname = $obj->lastname; + $userstatic->firstname = $obj->firstname; + $userstatic->email = $obj->user_email; + $userstatic->statut = $obj->user_statut; + $userstatic->entity = $obj->entity; + $userstatic->photo = $obj->photo; + $userstatic->office_phone = $obj->office_phone; + $userstatic->office_fax = $obj->office_fax; + $userstatic->user_mobile = $obj->user_mobile; + $userstatic->job = $obj->job; + $userstatic->gender = $obj->gender; + + // Author + if (!empty($arrayfields['u.login']['checked'])) { + print ''; + if ($userstatic->id) { + print $userstatic->getLoginUrl(-1); + } else { + print ' '; + } + print "\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + + if (!empty($arrayfields['dynamount_payed']['checked'])) { + print ''.(!empty($totalpay) ?price($totalpay, 0, $langs) : '').''; // TODO Use a denormalized field + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'totalam'; + } + $totalarray['val']['totalam'] += $totalpay; + } + + if (!empty($arrayfields['rtp']['checked'])) { + print ''.(!empty($remaintopay) ?price($remaintopay, 0, $langs) : ' ').''; // TODO Use a denormalized field + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'rtp'; + } + $totalarray['val']['rtp'] += $remaintopay; + } + + // Currency + if (!empty($arrayfields['f.multicurrency_code']['checked'])) { + print ''.$obj->multicurrency_code.' - '.$langs->trans('Currency'.$obj->multicurrency_code)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Currency rate + if (!empty($arrayfields['f.multicurrency_tx']['checked'])) { + print ''; + $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code); + print "\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Amount HT + if (!empty($arrayfields['f.multicurrency_total_ht']['checked'])) { + print ''.price($obj->multicurrency_total_ht)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Amount VAT + if (!empty($arrayfields['f.multicurrency_total_vat']['checked'])) { + print ''.price($obj->multicurrency_total_vat)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Amount TTC + if (!empty($arrayfields['f.multicurrency_total_ttc']['checked'])) { + print ''.price($obj->multicurrency_total_ttc)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['multicurrency_dynamount_payed']['checked'])) { + print ''.(!empty($multicurrency_totalpay) ?price($multicurrency_totalpay, 0, $langs) : '').''; // TODO Use a denormalized field + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Pending amount + if (!empty($arrayfields['multicurrency_rtp']['checked'])) { + print ''; + print (!empty($multicurrency_remaintopay) ? price($multicurrency_remaintopay, 0, $langs) : ''); + print ''; // TODO Use a denormalized field + if (!$i) { + $totalarray['nbfield']++; + } + } + + + // 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['f.datec']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Date modification + if (!empty($arrayfields['f.tms']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Status + if (!empty($arrayfields['f.fk_statut']['checked'])) { + print ''; + print $facturestatic->LibStatut($obj->paye, $obj->fk_statut, 5, $paiement, $obj->type); + print ""; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + 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->facid, $arrayofselected)) { + $selected = 1; + } + print ''; + } + print ''; + } + if (!$i) { + $totalarray['nbfield']++; + } + + print "\n"; + } $i++; } diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 9b3f0a1ce16..e8f56659de9 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -2419,4 +2419,41 @@ class Holiday extends CommonObject return -1; } } + /** + * 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, $selected; + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).''; + if (property_exists($this, 'fk_user') && !empty($this->id)) { + $return .= '| '.$this->fk_user.''; + $return .= ''; + } + if (property_exists($this, 'fk_type')) { + $return .= '
'.$langs->trans("Type").' : '; + $return .= ''.$langs->trans($this->getTypes(1, -1)[$this->fk_type]['code']).''; + } + if (property_exists($this, 'date_debut') && property_exists($this, 'date_fin')) { + $return .= '
'.dol_print_date($this->date_debut, 'day').''; + $return .= ' '.$langs->trans("To").' '; + $return .= ''.dol_print_date($this->date_fin, 'day').''; + } + if (method_exists($this, 'getLibStatut')) { + $return .= '
'.$this->getLibStatut(5).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 564fb8a2a96..cef7375a4b6 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -52,6 +52,7 @@ $confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation $cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'holidaylist'; // To manage different context of search +$mode = GETPOST('mode', 'alpha'); // for switch mode view result $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') @@ -394,6 +395,9 @@ if ($resql) { $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); } @@ -476,6 +480,8 @@ if ($resql) { print ''; print ''; print ''; + print ''; + if ($id > 0) { print ''; } @@ -519,7 +525,11 @@ if ($resql) { } else { $title = $langs->trans("ListeCP"); - $newcardbutton = dolGetButtonTitle($langs->trans('MenuAddCP'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/holiday/card.php?action=create', '', $user->rights->holiday->write); + + $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('MenuAddCP'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/holiday/card.php?action=create', '', $user->rights->holiday->write); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_hrm', 0, $newcardbutton, '', $limit, 0, 0, 1); } @@ -787,7 +797,8 @@ if ($resql) { $holidaystatic->id = $obj->rowid; $holidaystatic->ref = ($obj->ref ? $obj->ref : $obj->rowid); $holidaystatic->statut = $obj->status; - $holidaystatic->date_debut = $db->jdate($obj->date_debut); + $holidaystatic->date_debut = $obj->date_debut; + $holidaystatic->date_fin = $obj->date_fin; // User $userstatic->id = $obj->fk_user; @@ -815,139 +826,163 @@ if ($resql) { $starthalfday = ($obj->halfday == -1 || $obj->halfday == 2) ? 'afternoon' : 'morning'; $endhalfday = ($obj->halfday == 1 || $obj->halfday == 2) ? 'morning' : 'afternoon'; - print ''; - // Action column - if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $nbopenedday = num_open_day($db->jdate($obj->date_debut, 1), $db->jdate($obj->date_fin, 1), 0, 1, $obj->halfday); // user jdate(..., 1) because num_open_day need UTC dates + $totalduration += $nbopenedday; + + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; + } + + $holidaystatic->fk_type = $holidaystatic->getTypes(1, -1)[$obj->fk_type]['rowid']; + $holidaystatic->fk_user = $userstatic->getNomUrl(1); + // Output Kanban + if ($massactionbutton || $massaction) { $selected = 0; - if (in_array($obj->rowid, $arrayofselected)) { + if (in_array($object->id, $arrayofselected)) { $selected = 1; } - print ''; + print $holidaystatic->getKanbanView(''); } - print ''; - } - if (!empty($arrayfields['cp.ref']['checked'])) { - print ''; - print $holidaystatic->getNomUrl(1, 1); - print ''; - if (!$i) { - $totalarray['nbfield']++; + if ($i == (min($num, $limit) - 1)) { + print '
'; + print ''; } - } - if (!empty($arrayfields['cp.fk_user']['checked'])) { - print ''.$userstatic->getNomUrl(-1, 'leave').''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['cp.fk_validator']['checked'])) { - print ''.$approbatorstatic->getNomUrl(-1).''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['cp.fk_type']['checked'])) { - $labeltypeleavetoshow = ($langs->trans($typeleaves[$obj->fk_type]['code']) != $typeleaves[$obj->fk_type]['code'] ? $langs->trans($typeleaves[$obj->fk_type]['code']) : $typeleaves[$obj->fk_type]['label']); - $labeltypeleavetoshow = empty($typeleaves[$obj->fk_type]['label']) ? $langs->trans("TypeWasDisabledOrRemoved", $obj->fk_type) : $labeltypeleavetoshow; - - print ''; - print $labeltypeleavetoshow; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['duration']['checked'])) { - print ''; - $nbopenedday = num_open_day($db->jdate($obj->date_debut, 1), $db->jdate($obj->date_fin, 1), 0, 1, $obj->halfday); // user jdate(..., 1) because num_open_day need UTC dates - $totalduration += $nbopenedday; - print $nbopenedday; - //print ' '.$langs->trans('DurationDays'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['cp.date_debut']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_debut), 'day'); - print ' ('.$langs->trans($listhalfday[$starthalfday]).')'; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['cp.date_fin']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_fin), 'day'); - print ' ('.$langs->trans($listhalfday[$endhalfday]).')'; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date validation - if (!empty($arrayfields['cp.date_valid']['checked'])) { // date_valid is both date_valid but also date_approval - print ''; - print dol_print_date($db->jdate($obj->date_valid), 'day'); - print ''; - if (!$i) $totalarray['nbfield']++; - } - // Date approval - if (!empty($arrayfields['cp.date_approval']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_approval), 'day'); - print ''; - if (!$i) $totalarray['nbfield']++; - } - - // 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['cp.date_create']['checked'])) { - print ''.dol_print_date($date, 'dayhour').''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['cp.tms']['checked'])) { - print ''.dol_print_date($date_modif, 'dayhour').''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['cp.statut']['checked'])) { - print ''.$holidaystatic->getLibStatut(5).''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Action column - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - 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; + } else { + print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + 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 ''; } - print ''; + print ''; } - print ''; - } - if (!$i) { - $totalarray['nbfield']++; - } + if (!empty($arrayfields['cp.ref']['checked'])) { + print ''; + print $holidaystatic->getNomUrl(1, 1); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['cp.fk_user']['checked'])) { + print ''.$userstatic->getNomUrl(-1, 'leave').''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['cp.fk_validator']['checked'])) { + print ''.$approbatorstatic->getNomUrl(-1).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['cp.fk_type']['checked'])) { + $labeltypeleavetoshow = ($langs->trans($typeleaves[$obj->fk_type]['code']) != $typeleaves[$obj->fk_type]['code'] ? $langs->trans($typeleaves[$obj->fk_type]['code']) : $typeleaves[$obj->fk_type]['label']); + $labeltypeleavetoshow = empty($typeleaves[$obj->fk_type]['label']) ? $langs->trans("TypeWasDisabledOrRemoved", $obj->fk_type) : $labeltypeleavetoshow; - print ''."\n"; + print ''; + print $labeltypeleavetoshow; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['duration']['checked'])) { + print ''; + $nbopenedday = num_open_day($db->jdate($obj->date_debut, 1), $db->jdate($obj->date_fin, 1), 0, 1, $obj->halfday); // user jdate(..., 1) because num_open_day need UTC dates + $totalduration += $nbopenedday; + print $nbopenedday; + //print ' '.$langs->trans('DurationDays'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['cp.date_debut']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_debut), 'day'); + print ' ('.$langs->trans($listhalfday[$starthalfday]).')'; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['cp.date_fin']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_fin), 'day'); + print ' ('.$langs->trans($listhalfday[$endhalfday]).')'; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Date validation + if (!empty($arrayfields['cp.date_valid']['checked'])) { // date_valid is both date_valid but also date_approval + print ''; + print dol_print_date($db->jdate($obj->date_valid), 'day'); + print ''; + if (!$i) $totalarray['nbfield']++; + } + // Date approval + if (!empty($arrayfields['cp.date_approval']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_approval), 'day'); + print ''; + if (!$i) $totalarray['nbfield']++; + } + // 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['cp.date_create']['checked'])) { + print ''.dol_print_date($date, 'dayhour').''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['cp.tms']['checked'])) { + print ''.dol_print_date($date_modif, 'dayhour').''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['cp.statut']['checked'])) { + print ''.$holidaystatic->getLibStatut(5).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + 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 ''; + } + print ''; + } + if (!$i) { + $totalarray['nbfield']++; + } + + print ''."\n"; + } $i++; } diff --git a/htdocs/hrm/class/evaluation.class.php b/htdocs/hrm/class/evaluation.class.php index 4a41f1c8e0e..c410ae8bd8f 100644 --- a/htdocs/hrm/class/evaluation.class.php +++ b/htdocs/hrm/class/evaluation.class.php @@ -1055,4 +1055,39 @@ class Evaluation extends CommonObject return $error; } + + /** + * 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 $selected, $langs; + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).''; + $return .= ''; + if (property_exists($this, 'fk_user') && !(empty($this->fk_user))) { + $return .= '
'.$langs->trans("Employee").' : '; + $return .= ''.$this->fk_user.''; + } + if (property_exists($this, 'fk_job') && !(empty($this->fk_job))) { + $return .= '
'.$langs->trans("Job").' : '; + $return .= ''.$this->fk_job.''; + } + + if (method_exists($this, 'getLibStatut')) { + $return .= '
'.$this->getLibStatut(5).'
'; + } + $return .= ''; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/hrm/class/job.class.php b/htdocs/hrm/class/job.class.php index 93950979a1a..a013bb57a36 100644 --- a/htdocs/hrm/class/job.class.php +++ b/htdocs/hrm/class/job.class.php @@ -1054,6 +1054,37 @@ class Job extends CommonObject return $error; } + + /** + * 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 $selected, $langs; + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).''; + $return .= ''; + if (property_exists($this, 'deplacement')) { + $return .= '
'.$langs->trans("Type").''; + $return .= ' : '.$this->fields['deplacement']['arrayofkeyval'][$this->deplacement].''; + } + if (property_exists($this, 'description') && !(empty($this->description))) { + $return .= '
'.$langs->trans("Description").' : '; + $return .= '
'.(strlen($this->description) > 30 ? dol_substr($this->description, 0, 25).'...' : $this->description).''; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/hrm/class/skill.class.php b/htdocs/hrm/class/skill.class.php index 3f56294a7b2..93a07fab66e 100644 --- a/htdocs/hrm/class/skill.class.php +++ b/htdocs/hrm/class/skill.class.php @@ -1113,4 +1113,35 @@ class Skill 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 $selected, $langs; + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).''; + $return .= ''; + if (property_exists($this, 'skill_type')) { + $return .= '
'.$langs->trans("Type").''; + $return .= ' : '.$this->fields['skill_type']['arrayofkeyval'][$this->skill_type].''; + } + if (property_exists($this, 'description')) { + $return .= '
'.$langs->trans("Description").' : '; + $return .= '
'.(strlen($this->description) > 30 ? dol_substr($this->description, 0, 25).'...' : $this->description).''; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/hrm/evaluation_list.php b/htdocs/hrm/evaluation_list.php index dea398ad6a6..999d6d0d44e 100644 --- a/htdocs/hrm/evaluation_list.php +++ b/htdocs/hrm/evaluation_list.php @@ -52,6 +52,7 @@ $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'evaluationlist'; // 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'); $ref = GETPOST('ref', 'alpha'); @@ -369,6 +370,9 @@ llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', ''); $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); } @@ -420,8 +424,12 @@ print ''; print ''; print ''; print ''; +print ''; -$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/hrm/evaluation_card.php', 1).'?action=create', '', $permissiontoadd); +$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_buildpath('/hrm/evaluation_card.php', 1).'?action=create', '', $permissiontoadd); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -568,75 +576,104 @@ while ($i < ($limit ? min($num, $limit) : $num)) { // Store properties in $object $object->setVarsFromFetchObj($obj); - // Show here line of result - print ''; - 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'; + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; } + // Output Kanban + $object->date_eval = $obj->date_eval; - if (in_array($val['type'], array('timestamp'))) { - $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } elseif ($key == 'ref') { - $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } + $job = new job($db); + $job->fetch($obj->fk_job); + $object->fk_job = $job->getNomUrl(); - 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'; + $userstatic = new User($db); + $userstatic->fetch($obj->fk_user); + $object->fk_user = $userstatic->getNomUrl(1); - if (!empty($arrayfields['t.'.$key]['checked'])) { - 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 ($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 ''; - if (!$i) { - $totalarray['nbfield']++; + print $object->getKanbanView(''); + } + if ($i == ($imaxinloop - 1)) { + print '
'; + print ''; + } + } else { + // Show here line of result + print ''; + 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'; } - if (!empty($val['isameasure']) && $val['isameasure'] == 1) { + + if (in_array($val['type'], array('timestamp'))) { + $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + } elseif ($key == 'ref') { + $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + } + + 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 ''; + 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 ''; 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 ''; - 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 ''; + 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 ''; + } + print ''; + if (!$i) { + $totalarray['nbfield']++; } - print ''; - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - print ''."\n"; + print ''."\n"; + } $i++; } diff --git a/htdocs/hrm/job_list.php b/htdocs/hrm/job_list.php index ed0fb480a3a..6e97c0d0483 100644 --- a/htdocs/hrm/job_list.php +++ b/htdocs/hrm/job_list.php @@ -52,6 +52,7 @@ $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'joblist'; // 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 view result with other mode $id = GETPOST('id', 'int'); @@ -362,6 +363,9 @@ llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', ''); $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); } @@ -413,8 +417,13 @@ print ''; print ''; print ''; print ''; +print ''; -$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/hrm/job_card.php', 1).'?action=create', '', $permissiontoadd); + +$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_buildpath('/hrm/job_card.php', 1).'?action=create', '', $permissiontoadd); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -561,78 +570,100 @@ while ($i < ($limit ? min($num, $limit) : $num)) { // Store properties in $object $object->setVarsFromFetchObj($obj); - // Show here line of result - print ''; - 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'; + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; } + // Output Kanban - if (in_array($val['type'], array('timestamp'))) { - $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } elseif ($key == 'ref') { - $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } + $object->deplacement = $obj->deplacement; + $object->description = $obj->description; - 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 ''; - if ($key == 'status') { - print $object->getLibStatut(5); - } elseif ($key == 'rowid') { - print $object->showOutputField($val, $key, $object->id, ''); - } elseif ($key == 'label') { - print $object->getNomUrl(1); - } else { - print $object->showOutputField($val, $key, $object->$key, ''); + 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 ''; - if (!$i) { - $totalarray['nbfield']++; + print $object->getKanbanView(''); + } + if ($i == (min($num, $limit) - 1)) { + print '
'; + print ''; + } + } else { + // Show here line of result + print ''; + 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'; } - if (!empty($val['isameasure']) && $val['isameasure'] == 1) { + + if (in_array($val['type'], array('timestamp'))) { + $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + } elseif ($key == 'ref') { + $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + } + + 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 ''; + if ($key == 'status') { + print $object->getLibStatut(5); + } elseif ($key == 'rowid') { + print $object->showOutputField($val, $key, $object->id, ''); + } elseif ($key == 'label') { + print $object->getNomUrl(1); + } else { + print $object->showOutputField($val, $key, $object->$key, ''); + } + print ''; 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 ''; - 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 ''; + 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 ''; + } + print ''; + if (!$i) { + $totalarray['nbfield']++; } - print ''; - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - - print ''."\n"; + print ''."\n"; + } $i++; } diff --git a/htdocs/hrm/skill_list.php b/htdocs/hrm/skill_list.php index ddf385b170e..03302a812ff 100644 --- a/htdocs/hrm/skill_list.php +++ b/htdocs/hrm/skill_list.php @@ -54,7 +54,7 @@ $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'skilllist'; // 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'); // Load variable for pagination $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); @@ -347,6 +347,9 @@ llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', ''); $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); } @@ -398,8 +401,12 @@ print ''; print ''; print ''; print ''; +print ''; -$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/hrm/skill_card.php?action=create', '', $permissiontoadd); +$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.'/hrm/skill_card.php?action=create', '', $permissiontoadd); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -546,78 +553,100 @@ while ($i < ($limit ? min($num, $limit) : $num)) { // Store properties in $object $object->setVarsFromFetchObj($obj); - // Show here line of result - print ''; - 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'; + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; } + // Output Kanban - if (in_array($val['type'], array('timestamp'))) { - $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } elseif ($key == 'ref') { - $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } + $object->skill_type = $obj->skill_type; + $object->description = $obj->description; - 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 ''; - if ($key == 'status') { - print $object->getLibStatut(5); - } elseif ($key == 'rowid') { - print $object->showOutputField($val, $key, $object->id, ''); - } elseif ($key == 'label') { - print $object->getNomUrl(1); - } else { - print $object->showOutputField($val, $key, $object->$key, ''); + 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 ''; - if (!$i) { - $totalarray['nbfield']++; + print $object->getKanbanView(''); + } + if ($i == (min($num, $limit) - 1)) { + print '
'; + print ''; + } + } else { + // Show here line of result + print ''; + 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'; } - if (!empty($val['isameasure']) && $val['isameasure'] == 1) { + + if (in_array($val['type'], array('timestamp'))) { + $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + } elseif ($key == 'ref') { + $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + } + + 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 ''; + if ($key == 'status') { + print $object->getLibStatut(5); + } elseif ($key == 'rowid') { + print $object->showOutputField($val, $key, $object->id, ''); + } elseif ($key == 'label') { + print $object->getNomUrl(1); + } else { + print $object->showOutputField($val, $key, $object->$key, ''); + } + print ''; 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 ''; - 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 ''; + 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 ''; + } + print ''; + if (!$i) { + $totalarray['nbfield']++; } - print ''; - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - - print ''."\n"; + print ''."\n"; + } $i++; } diff --git a/htdocs/hrm/skill_tab.php b/htdocs/hrm/skill_tab.php index b30484de54f..705b4fc200e 100644 --- a/htdocs/hrm/skill_tab.php +++ b/htdocs/hrm/skill_tab.php @@ -226,10 +226,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } else { $linkback = '' . $langs->trans("BackToList") . ''; - $morehtmlref = ''; + $morehtmlref = ''; $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"'); $morehtmlref .= ''; + $urltovirtualcard = '/user/virtualcard.php?id='.((int) $object->id); + $morehtmlref .= dolButtonToOpenUrlInDialogPopup('publicvirtualcard', $langs->trans("PublicVirtualCardUrl").' - '.$object->getFullName($langs), img_picto($langs->trans("PublicVirtualCardUrl"), 'card', 'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard, '', 'nohover'); + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'rowid', $morehtmlref, '&objecttype='.$objecttype); } diff --git a/htdocs/install/mysql/data/llx_c_tva.sql b/htdocs/install/mysql/data/llx_c_tva.sql index 6c96cb46605..72cff6afde7 100644 --- a/htdocs/install/mysql/data/llx_c_tva.sql +++ b/htdocs/install/mysql/data/llx_c_tva.sql @@ -194,7 +194,7 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (14 insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1402, 140, '14','0','VAT rate - intermediary',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1403, 140, '8','0','VAT rate - reduced', 1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1404, 140, '3','0','VAT rate - super-reduced', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1405, 140, '17','0','VAT rate - standard',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1405, 140, '16','0','VAT rate - standard',1); -- MALI (id country=147) insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1471, 147, '0','0','VAT rate 0', 1); diff --git a/htdocs/install/mysql/migration/17.0.0-18.0.0.sql b/htdocs/install/mysql/migration/17.0.0-18.0.0.sql index 84022422fba..5999acf05a8 100644 --- a/htdocs/install/mysql/migration/17.0.0-18.0.0.sql +++ b/htdocs/install/mysql/migration/17.0.0-18.0.0.sql @@ -56,3 +56,10 @@ ALTER TABLE llx_payment_salary MODIFY COLUMN datep datetime; INSERT INTO llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1179, 117, 'I-28' , 28, 0, '0', 0, '0', 0, 'IGST', 1); INSERT INTO llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1176, 117, 'C+S-18', 0, 9, '1', 9, '1', 0, 'CGST+SGST - Same state sales', 1); + +ALTER TABLE llx_user ADD COLUMN flagdelsessionsbefore datetime DEFAULT NULL; + +ALTER TABLE llx_website ADD COLUMN pageviews_previous_month BIGINT UNSIGNED DEFAULT 0; + +ALTER TABLE llx_product_stock ADD CONSTRAINT fk_product_product_rowid FOREIGN KEY (fk_product) REFERENCES llx_product (rowid); +ALTER TABLE llx_product_stock ADD CONSTRAINT fk_entrepot_entrepot_rowid FOREIGN KEY (fk_entrepot) REFERENCES llx_entrepot (rowid); diff --git a/htdocs/install/mysql/tables/llx_product_stock.key.sql b/htdocs/install/mysql/tables/llx_product_stock.key.sql index 358a0c74f19..b07719a5478 100644 --- a/htdocs/install/mysql/tables/llx_product_stock.key.sql +++ b/htdocs/install/mysql/tables/llx_product_stock.key.sql @@ -20,5 +20,7 @@ ALTER TABLE llx_product_stock ADD INDEX idx_product_stock_fk_product (fk_product); ALTER TABLE llx_product_stock ADD INDEX idx_product_stock_fk_entrepot (fk_entrepot); +ALTER TABLE llx_product_stock ADD CONSTRAINT fk_product_product_rowid FOREIGN KEY (fk_product) REFERENCES llx_product (rowid); +ALTER TABLE llx_product_stock ADD CONSTRAINT fk_entrepot_entrepot_rowid FOREIGN KEY (fk_entrepot) REFERENCES llx_entrepot (rowid); ALTER TABLE llx_product_stock ADD UNIQUE INDEX uk_product_stock (fk_product,fk_entrepot); diff --git a/htdocs/install/mysql/tables/llx_societe_account.sql b/htdocs/install/mysql/tables/llx_societe_account.sql index b200d4f3854..56eb4eb1985 100644 --- a/htdocs/install/mysql/tables/llx_societe_account.sql +++ b/htdocs/install/mysql/tables/llx_societe_account.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2016 Laurent Destailleur +-- Copyright (C) 2016-2022 Laurent Destailleur -- -- 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 @@ -19,16 +19,17 @@ CREATE TABLE llx_societe_account( -- BEGIN MODULEBUILDER FIELDS rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, - entity integer DEFAULT 1, - login varchar(128) NOT NULL, + entity integer DEFAULT 1, + + login varchar(128) NOT NULL, -- a login string into website or external system pass_encoding varchar(24), - pass_crypted varchar(128), + pass_crypted varchar(128), -- the hashed password pass_temp varchar(128), -- temporary password when asked for forget password - fk_soc integer, - fk_website integer, -- id of local web site - site varchar(128), -- name of external web site - site_account varchar(128), -- a key to identify the account on external web site - key_account varchar(128), -- the id of third party in external web site (for site_account if site_account defined) + fk_soc integer, -- if entry is linked to a thirdparty + fk_website integer, -- id of local web site (if dk_website is filled, site is empty) + site varchar(128), -- name of external web site (if site is filled, fk_website is empty) + site_account varchar(128), -- a key to identify the account on external web site (for example: 'stripe', 'paypal', 'myextapp') + key_account varchar(128), -- the id of an account in external web site (for site_account if site_account defined. some sites needs both an account name and a login that is different) note_private text, date_last_login datetime, date_previous_login datetime, diff --git a/htdocs/install/mysql/tables/llx_user.sql b/htdocs/install/mysql/tables/llx_user.sql index ca0c7bc818d..a10f8489bcb 100644 --- a/htdocs/install/mysql/tables/llx_user.sql +++ b/htdocs/install/mysql/tables/llx_user.sql @@ -84,6 +84,7 @@ create table llx_user datelastpassvalidation datetime, -- last date we change password or we made a disconnect all datestartvalidity datetime, dateendvalidity datetime, + flagdelsessionsbefore datetime DEFAULT NULL, -- set this to a date if we need to launch an external process to invalidate all sessions for the same login created before this date iplastlogin varchar(250), ippreviouslogin varchar(250), egroupware_id integer, diff --git a/htdocs/install/mysql/tables/llx_website-website.sql b/htdocs/install/mysql/tables/llx_website-website.sql index 0df6ccf8ef3..8ac580919aa 100644 --- a/htdocs/install/mysql/tables/llx_website-website.sql +++ b/htdocs/install/mysql/tables/llx_website-website.sql @@ -36,9 +36,10 @@ CREATE TABLE llx_website fk_user_modif integer, date_creation datetime, position integer DEFAULT 0, - lastaccess datetime NULL, - pageviews_month BIGINT UNSIGNED DEFAULT 0, - pageviews_total BIGINT UNSIGNED DEFAULT 0, + lastaccess datetime NULL, -- updated at each page access + pageviews_previous_month BIGINT UNSIGNED DEFAULT 0, + pageviews_month BIGINT UNSIGNED DEFAULT 0, -- increased by 1 at each page access, saved into pageviews_previous_month when on different month than lastaccess + pageviews_total BIGINT UNSIGNED DEFAULT 0, -- increased by 1 at each page access, no reset tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, import_key varchar(14) -- import key ) ENGINE=innodb; diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index c9f1eb76b41..1e153109140 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -4196,7 +4196,7 @@ function migrate_delete_old_dir($db, $langs, $conf) } foreach ($filetodeletearray as $filetodelete) { - //print ''.$filetodelete."
\n"; + $result = 1; if (file_exists($filetodelete)) { $result = dol_delete_dir_recursive($filetodelete); } diff --git a/htdocs/knowledgemanagement/class/knowledgerecord.class.php b/htdocs/knowledgemanagement/class/knowledgerecord.class.php index bf2bf38bbef..6dde2c42c19 100644 --- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php +++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php @@ -1066,6 +1066,42 @@ class KnowledgeRecord extends CommonObject require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; return parent::setCategoriesCommon($categories, Categorie::TYPE_KNOWLEDGEMANAGEMENT); } + + /** + * 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, $selected,$arrayofselected; + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).''; + if (in_array($this->id, $arrayofselected)) { + $selected = 1; + } + $return .= ''; + if (property_exists($this, 'question')) { + $return .= '
'.$langs->trans('Question').' : '.$this->question.''; + } + if (property_exists($this, 'lang') && !empty($this->lang)) { + $return .= '
'.$langs->trans("Language").' : lang).'">'.$langs->trans("Language_".$this->lang, '', '', '', '', 12).''; + $return .= picto_from_langcode($this->lang, 'class="paddingrightonly saturatemedium opacitylow"'); + } + if (method_exists($this, 'getLibStatut')) { + $return .= '
'.$this->getLibStatut(5).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/knowledgemanagement/knowledgerecord_list.php b/htdocs/knowledgemanagement/knowledgerecord_list.php index dffd3d63d7b..1c3fce89841 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_list.php +++ b/htdocs/knowledgemanagement/knowledgerecord_list.php @@ -447,8 +447,12 @@ print ''; print ''; print ''; print ''; +print ''; -$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/knowledgemanagement/knowledgerecord_card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd); +$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_buildpath('/knowledgemanagement/knowledgerecord_card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -636,131 +640,148 @@ while ($i < $imaxinloop) { // Store properties in $object $object->setVarsFromFetchObj($obj); - // Show here line of result - $j = 0; - print ''; - // Action column - if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { - print ''; - 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; + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; + } + // Output Kanban + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + if ($massactionbutton || $massaction) { + $selected = 0; } - print ''; + print $object->getKanbanView(''); } - print ''; - } - 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'; + if ($i == ($imaxinloop - 1)) { + print '
'; + print ''; } - - if (in_array($val['type'], array('timestamp'))) { - $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } elseif ($key == 'ref') { - $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } - - 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 ''; - if ($key == 'status') { - print $object->getLibStatut(5); - } elseif ($key == 'rowid') { - print $object->showOutputField($val, $key, $object->id, ''); - } elseif ($key == 'fk_user_creat') { - if ($object->fk_user_creat > 0) { - if (isset($conf->cache['user'][$object->fk_user_creat])) { - $user_temp = $conf->cache['user'][$object->fk_user_creat]; - } else { - $user_temp = new User($db); - $user_temp->fetch($object->fk_user_creat); - $conf->cache['user'][$object->fk_user_creat] = $user_temp; - } - print $user_temp->getNomUrl(-1); + } else { + // Show here line of result + $j = 0; + print ''; + // Action column + if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; + 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; } - } elseif ($key == 'fk_user_modif') { - if ($object->fk_user_modif > 0) { - if (isset($conf->cache['user'][$object->fk_user_modif])) { - $user_temp = $conf->cache['user'][$object->fk_user_modif]; - } else { - $user_temp = new User($db); - $user_temp->fetch($object->fk_user_modif); - $conf->cache['user'][$object->fk_user_modif] = $user_temp; - } - print $user_temp->getNomUrl(-1); - } - } elseif ($key == 'fk_user_valid') { - if ($object->fk_user_valid > 0) { - if (isset($conf->cache['user'][$object->fk_user_valid])) { - $user_temp = $conf->cache['user'][$object->fk_user_valid]; - } else { - $user_temp = new User($db); - $user_temp->fetch($object->fk_user_valid); - $conf->cache['user'][$object->fk_user_valid] = $user_temp; - } - print $user_temp->getNomUrl(-1); - } - } elseif ($key == 'lang') { - $labellang = ($object->lang ? $langs->trans('Language_'.$object->lang) : ''); - print picto_from_langcode($object->lang, 'class="paddingrightonly saturatemedium opacitylow"'); - print $labellang; - } else { - print $object->showOutputField($val, $key, $object->$key, ''); + print ''; } print ''; - if (!$i) { - $totalarray['nbfield']++; + } + 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'; } - if (!empty($val['isameasure']) && $val['isameasure'] == 1) { + + if (in_array($val['type'], array('timestamp'))) { + $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + } elseif ($key == 'ref') { + $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + } + + 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 ''; + if ($key == 'status') { + print $object->getLibStatut(5); + } elseif ($key == 'rowid') { + print $object->showOutputField($val, $key, $object->id, ''); + } elseif ($key == 'fk_user_creat') { + if ($object->fk_user_creat > 0) { + if (isset($conf->cache['user'][$object->fk_user_creat])) { + $user_temp = $conf->cache['user'][$object->fk_user_creat]; + } else { + $user_temp = new User($db); + $user_temp->fetch($object->fk_user_creat); + $conf->cache['user'][$object->fk_user_creat] = $user_temp; + } + print $user_temp->getNomUrl(-1); + } + } elseif ($key == 'fk_user_modif') { + if ($object->fk_user_modif > 0) { + if (isset($conf->cache['user'][$object->fk_user_modif])) { + $user_temp = $conf->cache['user'][$object->fk_user_modif]; + } else { + $user_temp = new User($db); + $user_temp->fetch($object->fk_user_modif); + $conf->cache['user'][$object->fk_user_modif] = $user_temp; + } + print $user_temp->getNomUrl(-1); + } + } elseif ($key == 'fk_user_valid') { + if ($object->fk_user_valid > 0) { + if (isset($conf->cache['user'][$object->fk_user_valid])) { + $user_temp = $conf->cache['user'][$object->fk_user_valid]; + } else { + $user_temp = new User($db); + $user_temp->fetch($object->fk_user_valid); + $conf->cache['user'][$object->fk_user_valid] = $user_temp; + } + print $user_temp->getNomUrl(-1); + } + } elseif ($key == 'lang') { + $labellang = ($object->lang ? $langs->trans('Language_'.$object->lang) : ''); + print picto_from_langcode($object->lang, 'class="paddingrightonly saturatemedium opacitylow"'); + print $labellang; + } else { + print $object->showOutputField($val, $key, $object->$key, ''); + } + print ''; 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 - if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { - print ''; - 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 + if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; + 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 ''; } - print ''; + print ''; + } + if (!$i) { + $totalarray['nbfield']++; } - print ''; - } - if (!$i) { - $totalarray['nbfield']++; - } - - print ''."\n"; + print ''."\n"; + } $i++; } diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 419b69a3f90..9e174dc3da1 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -126,6 +126,7 @@ WriteBookKeeping=Record transactions in accounting Bookkeeping=Ledger BookkeepingSubAccount=Subledger AccountBalance=Account balance +AccountBalanceSubAccount=Sub-accounts balance ObjectsRef=Source object ref CAHTF=Total purchase vendor before tax TotalExpenseReport=Total expense report @@ -297,6 +298,7 @@ DescValidateMovements=Any modification or deletion of writing, lettering and del ValidateHistory=Bind Automatically AutomaticBindingDone=Automatic bindings done (%s) - Automatic binding not possible for some record (%s) +DoManualBindingForFailedRecord=You have to do a manual link for the %s row(s) not linked automatically. ErrorAccountancyCodeIsAlreadyUse=Error, you cannot remove or disable this account of chart of account because it is used MvtNotCorrectlyBalanced=Movement not correctly balanced. Debit = %s & Credit = %s diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 421ba4f6fa2..934464db3de 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1272,6 +1272,7 @@ TriggerActiveAsModuleActive=Triggers in this file are active as module %s GeneratedPasswordDesc=Choose the method to be used for auto-generated passwords. DictionaryDesc=Insert all reference data. You can add your values to the default. ConstDesc=This page allows you to edit (override) parameters not available in other pages. These are mostly reserved parameters for developers/advanced troubleshooting only. +MiscellaneousOptions=Miscellaneous options MiscellaneousDesc=All other security related parameters are defined here. LimitsSetup=Limits/Precision setup LimitsDesc=You can define limits, precisions and optimizations used by Dolibarr here @@ -1828,6 +1829,9 @@ AGENDA_USE_EVENT_TYPE=Use events types (managed in menu Setup -> Dictionaries -> AGENDA_USE_EVENT_TYPE_DEFAULT=Automatically set this default value for type of event in event create form AGENDA_DEFAULT_FILTER_TYPE=Automatically set this type of event in search filter of agenda view AGENDA_DEFAULT_FILTER_STATUS=Automatically set this status for events in search filter of agenda view +AGENDA_EVENT_PAST_COLOR=Past event color +AGENDA_EVENT_CURRENT_COLOR=Current event color +AGENDA_EVENT_FUTURE_COLOR=Future event color AGENDA_DEFAULT_VIEW=Which view do you want to open by default when selecting menu Agenda AGENDA_REMINDER_BROWSER=Enable event reminder on user's browser (When remind date is reached, a popup is shown by the browser. Each user can disable such notifications from its browser notification setup). AGENDA_REMINDER_BROWSER_SOUND=Enable sound notification @@ -2131,6 +2135,7 @@ CodeLastResult=Latest result code NbOfEmailsInInbox=Number of emails in source directory LoadThirdPartyFromName=Load third party searching on %s (load only) LoadThirdPartyFromNameOrCreate=Load third party searching on %s (create if not found) +LoadContactFromEmailOrCreate=Load contact searching on %s (create if not found) AttachJoinedDocumentsToObject=Save attached files into object documents if a ref of an object is found into email topic. WithDolTrackingID=Message from a conversation initiated by a first email sent from Dolibarr WithoutDolTrackingID=Message from a conversation initiated by a first email NOT sent from Dolibarr @@ -2357,3 +2362,5 @@ AllowExternalDownload=Allow external download (without login, using a shared lin DeadlineDayVATSubmission=Deadline day for vat submission on the next month MaxNumberOfAttachementOnForms=Max number of joinded files in a form IfDefinedUseAValueBeetween=If defined, use a value between %s and %s +Reload=Reload +ConfirmReload=Confirm module reload diff --git a/htdocs/langs/en_US/bookmarks.lang b/htdocs/langs/en_US/bookmarks.lang index 26551eee4f0..bfbab1ef520 100644 --- a/htdocs/langs/en_US/bookmarks.lang +++ b/htdocs/langs/en_US/bookmarks.lang @@ -1,23 +1,24 @@ -# Dolibarr language file - Source file is en_US - marque pages -AddThisPageToBookmarks=Add current page to bookmarks -Bookmark=Bookmark -Bookmarks=Bookmarks -ListOfBookmarks=List of bookmarks -EditBookmarks=List/edit bookmarks -NewBookmark=New bookmark -ShowBookmark=Show bookmark -OpenANewWindow=Open a new tab -ReplaceWindow=Replace current tab -BookmarkTargetNewWindowShort=New tab -BookmarkTargetReplaceWindowShort=Current tab -BookmarkTitle=Bookmark name -UrlOrLink=URL -BehaviourOnClick=Behaviour when a bookmark URL is selected -CreateBookmark=Create bookmark -SetHereATitleForLink=Set a name for the bookmark -UseAnExternalHttpLinkOrRelativeDolibarrLink=Use an external/absolute link (https://externalurl.com) or an internal/relative link (/mypage.php). You can also use phone like tel:0123456. -ChooseIfANewWindowMustBeOpenedOnClickOnBookmark=Choose if the linked page should open in the current tab or a new tab -BookmarksManagement=Bookmarks management -BookmarksMenuShortCut=Ctrl + shift + m -NoBookmarks=No bookmarks defined -NoBookmarkFound=No bookmark found \ No newline at end of file +# Dolibarr language file - Source file is en_US - marque pages / bookmarks + +AddThisPageToBookmarks = Add current page to bookmarks +BehaviourOnClick = Behaviour when a bookmark URL is selected +Bookmark = Bookmark +Bookmarks = Bookmarks +BookmarkTargetNewWindowShort = New tab +BookmarkTargetReplaceWindowShort = Current tab +BookmarkTitle = Bookmark name +BookmarksManagement = Bookmarks management +BookmarksMenuShortCut = Ctrl + shift + m +ChooseIfANewWindowMustBeOpenedOnClickOnBookmark = Choose if the linked page should open in the current tab or a new tab +CreateBookmark = Create bookmark +EditBookmarks = List/edit bookmarks +ListOfBookmarks = List of bookmarks +NewBookmark = New bookmark +NoBookmarkFound = No bookmark found +NoBookmarks = No bookmarks defined +OpenANewWindow = Open a new tab +ReplaceWindow = Replace current tab +SetHereATitleForLink = Set a name for the bookmark +ShowBookmark = Show bookmark +UrlOrLink = URL +UseAnExternalHttpLinkOrRelativeDolibarrLink = Use an external/absolute link (https://externalurl.com) or an internal/relative link (/mypage.php). You can also use phone like tel:0123456. diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index e022c7cb09f..38b6892dbae 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -312,8 +312,8 @@ CustomerRelativeDiscountShort=Relative discount CustomerAbsoluteDiscountShort=Absolute discount CompanyHasRelativeDiscount=This customer has a default discount of %s%% CompanyHasNoRelativeDiscount=This customer has no relative discount by default -HasRelativeDiscountFromSupplier=You have a default discount of %s%% from this vendor -HasNoRelativeDiscountFromSupplier=No default relative discount from this vendor +HasRelativeDiscountFromSupplier=You have a default discount of %s%% with this vendor +HasNoRelativeDiscountFromSupplier=No default relative discount with this vendor CompanyHasAbsoluteDiscount=This customer has discounts available (credits notes or down payments) for %s %s CompanyHasDownPaymentOrCommercialDiscount=This customer has discounts available (commercial, down payments) for %s %s CompanyHasCreditNote=This customer still has credit notes for %s %s @@ -499,4 +499,5 @@ OutOfEurope=Out of Europe (EEC) CurrentOutstandingBillLate=Current outstanding bill late BecarefullChangeThirdpartyBeforeAddProductToInvoice=Be carefull, depending on your product price settings, you should change thirdparty before adding product to POS. EmailAlreadyExistsPleaseRewriteYourCompanyName=email already exists please rewrite your company name -TwoRecordsOfCompanyName=more than one record exists for this company please contact us to complete your partnership request" \ No newline at end of file +TwoRecordsOfCompanyName=more than one record exists for this company, please contact us to complete your partnership request +CompanySection=Company section \ No newline at end of file diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index b3eeae4606b..b779c901b54 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -303,6 +303,7 @@ ErrorValueForTooLow=Value for %s is too low ErrorValueCantBeNull=Value for %s can't be null ErrorDateOfMovementLowerThanDateOfFileTransmission=The date of the bank transaction can't be lower than the date of the file transmission ErrorTooMuchFileInForm=Too much files in form, the maximum number is %s file(s) +ErrorSessionInvalidatedAfterPasswordChange=The session was invalidated after a password change. Please relogin. # Warnings WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup. @@ -325,6 +326,7 @@ WarningPaymentDateLowerThanInvoiceDate=Payment date (%s) is earlier than invoice WarningTooManyDataPleaseUseMoreFilters=Too many data (more than %s lines). Please use more filters or set the constant %s to a higher limit. WarningSomeLinesWithNullHourlyRate=Some times were recorded by some users while their hourly rate was not defined. A value of 0 %s per hour was used but this may result in wrong valuation of time spent. WarningYourLoginWasModifiedPleaseLogin=Your login was modified. For security purpose you will have to login with your new login before next action. +WarningYourPasswordWasModifiedPleaseLogin=Your password was modified. For security purpose you will have to login now with your new password. WarningAnEntryAlreadyExistForTransKey=An entry already exists for the translation key for this language WarningNumberOfRecipientIsRestrictedInMassAction=Warning, number of different recipient is limited to %s when using the mass actions on lists WarningDateOfLineMustBeInExpenseReportRange=Warning, the date of line is not in the range of the expense report diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 2473659a5c7..0d06736a23d 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -898,6 +898,9 @@ MassFilesArea=Area for files built by mass actions ShowTempMassFilesArea=Show area of files built by mass actions ConfirmMassDeletion=Bulk Delete confirmation ConfirmMassDeletionQuestion=Are you sure you want to delete the %s selected record(s)? +ConfirmMassClone=Bulk clone confirmation +ConfirmMassCloneQuestion=Select project to clone to +ConfirmMassCloneToOneProject=Clone to project %s RelatedObjects=Related Objects ClassifyBilled=Classify billed ClassifyUnbilled=Classify unbilled @@ -1156,8 +1159,8 @@ SetSupervisor=Set the supervisor CreateExternalUser=Create external user ConfirmAffectTag=Bulk Tag Assignement ConfirmAffectUser=Bulk User Assignement -ProjectRole=Role assigned on each project -TasksRole=Role assigned on each task of each project +ProjectRole=Role assigned on each project/opportunity +TasksRole=Role assigned on each task (if used) ConfirmSetSupervisor=Bulk Supervisor Set ConfirmUpdatePrice=Choose a increase/decrease price rate ConfirmAffectTagQuestion=Are you sure you want to assign tags to the %s selected record(s)? @@ -1216,3 +1219,5 @@ NoSpecificContactAddress=No specific contact or address NoSpecificContactAddressBis=This tab is dedicated to force specific contacts or addresses for the current object. Use it only if you want to define one or several specific contacts or addresses for the object when the information on the thirdparty is not enough or not accurate. HideOnVCard=Hide %s AddToContacts=Add address to my contacts +LastAccess=Last access +UploadAnImageToSeeAPhotoHere=Upload an image from the tab %s to see a photo here \ No newline at end of file diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index 6d2f67ee675..6a7a0a6fbe1 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -259,6 +259,7 @@ RecordsClosed=%s project(s) closed SendProjectRef=Information project %s ModuleSalaryToDefineHourlyRateMustBeEnabled=Module 'Salaries' must be enabled to define employee hourly rate to have time spent valorized NewTaskRefSuggested=Task ref already used, a new task ref is required +NumberOfTasksCloned=%s task(s) cloned TimeSpentInvoiced=Time spent billed TimeSpentForIntervention=Time spent TimeSpentForInvoice=Time spent @@ -298,4 +299,4 @@ EnablePublicLeadForm=Enable the public form for contact NewLeadbyWeb=Your message or request has been recorded. We will answer or contact your soon. NewLeadForm=New contact form LeadFromPublicForm=Online lead from public form -ExportAccountingReportButtonLabel=Get report \ No newline at end of file +ExportAccountingReportButtonLabel=Get report diff --git a/htdocs/langs/en_US/users.lang b/htdocs/langs/en_US/users.lang index 2f691153292..05c9ebb339d 100644 --- a/htdocs/langs/en_US/users.lang +++ b/htdocs/langs/en_US/users.lang @@ -66,7 +66,8 @@ LinkedToDolibarrUser=Link to user LinkedToDolibarrThirdParty=Link to third party CreateDolibarrLogin=Create a user CreateDolibarrThirdParty=Create a third party -LoginAccountDisableInDolibarr=Account disabled in Dolibarr. +LoginAccountDisableInDolibarr=Account disabled in Dolibarr +PASSWORDInDolibarr=Password modified in Dolibarr UsePersonalValue=Use personal value ExportDataset_user_1=Users and their properties DomainUser=Domain user %s diff --git a/htdocs/langs/en_US/website.lang b/htdocs/langs/en_US/website.lang index 742e3afff67..7b2cc90f7ac 100644 --- a/htdocs/langs/en_US/website.lang +++ b/htdocs/langs/en_US/website.lang @@ -155,3 +155,5 @@ WebpageMustBeDisabled=The web page must have the status "%s" SetWebsiteOnlineBefore=When website is offline, all pages are offline. Change status of website first. Booking=Booking Reservation=Reservation +PagesViewedPreviousMonth=Pages viewed (previous month) +PagesViewedTotal=Pages viewed (total) \ No newline at end of file diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 7bc99f56b19..11721181cc8 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -1826,6 +1826,9 @@ AGENDA_USE_EVENT_TYPE=Utiliser les types d'événements (gérés dans le menu Co AGENDA_USE_EVENT_TYPE_DEFAULT=Configurez automatiquement cette valeur par défaut pour le type d'événement dans le formulaire de création d'événement. AGENDA_DEFAULT_FILTER_TYPE=Positionner automatiquement ce type d'événement dans le filtre de recherche de la vue agenda AGENDA_DEFAULT_FILTER_STATUS=Positionner automatiquement ce statut d'événement dans le filtre de recherche de la vue agenda +AGENDA_EVENT_PAST_COLOR=Couleur de l'événement passé +AGENDA_EVENT_CURRENT_COLOR=Couleur de l'événement en cours +AGENDA_EVENT_FUTURE_COLOR=Couleur de l'événement futur AGENDA_DEFAULT_VIEW=Quel onglet voulez-vous voir ouvrir par défaut quand on choisit le menu Agenda AGENDA_REMINDER_BROWSER=Activer le rappel d'événement sur le navigateur de l'utilisateur (lorsque la date de l'événement est atteinte, une popup est affichée sur la navigateur. Chaque utilisateur peut désactiver de telles notification depuis la configuration des notifications de son navigateur) AGENDA_REMINDER_BROWSER_SOUND=Activer les notifications sonores. @@ -2129,6 +2132,7 @@ CodeLastResult=Dernier code de retour NbOfEmailsInInbox=Nombre de courriels dans le répertoire source LoadThirdPartyFromName=Charger le Tiers en cherchant sur %s (chargement uniquement) LoadThirdPartyFromNameOrCreate=Charger le Tiers en cherchant sur %s (créer si non trouvé) +LoadContactFromEmailOrCreate=Charger le Contact en cherchant sur %s (créer si non trouvé) AttachJoinedDocumentsToObject=Enregistrez les fichiers joints dans des documents d'objet si la référence d'un objet est trouvée dans le sujet de l'e-mail. WithDolTrackingID=Message d'une conversation initiée par un premier mail envoyé depuis Dolibarr WithoutDolTrackingID=Message d'une conversation initiée par un premier e-mail NON envoyé depuis Dolibarr diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index b2c76218a5d..2904f576bf7 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -943,26 +943,35 @@ if (!defined('NOLOGIN')) { dol_syslog("- This is an already logged session. _SESSION['dol_login']=".$login." _SESSION['dol_entity']=".$entity, LOG_DEBUG); $resultFetchUser = $user->fetch('', $login, '', 1, ($entity > 0 ? $entity : -1)); - if ($resultFetchUser <= 0) { - // Account has been removed after login - dol_syslog("Can't load user even if session logged. _SESSION['dol_login']=".$login, LOG_WARNING); + if ($resultFetchUser <= 0 || ($user->flagdelsessionsbefore && !empty($_SESSION["dol_logindate"]) && $user->flagdelsessionsbefore > $_SESSION["dol_logindate"])) { + if ($resultFetchUser <= 0) { + // Account has been removed after login + dol_syslog("Can't load user even if session logged. _SESSION['dol_login']=".$login, LOG_WARNING); + } else { + // Session is no more valid + dol_syslog("The user has a date for session invalidation = ".$user->flagdelsessionsbefore." and a session date = ".$_SESSION["dol_logindate"].". We must invalidate its sessions."); + } session_destroy(); session_set_cookie_params(0, '/', null, (empty($dolibarr_main_force_https) ? false : true), true); // Add tag secure and httponly on session cookie session_name($sessionname); session_start(); if ($resultFetchUser == 0) { - // Load translation files required by page $langs->loadLangs(array('main', 'errors')); $_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("ErrorCantLoadUserFromDolibarrDatabase", $login); $user->trigger_mesg = 'ErrorCantLoadUserFromDolibarrDatabase - login='.$login; - } - if ($resultFetchUser < 0) { + } elseif ($resultFetchUser < 0) { $_SESSION["dol_loginmesg"] = $user->error; $user->trigger_mesg = $user->error; + } else { + $langs->loadLangs(array('main', 'errors')); + + $_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("ErrorSessionInvalidatedAfterPasswordChange"); + + $user->trigger_mesg = 'ErrorUserSessionWasInvalidated - login='.$login; } // Call trigger @@ -975,7 +984,7 @@ if (!defined('NOLOGIN')) { // Hooks on failed login $action = ''; $hookmanager->initHooks(array('login')); - $parameters = array('dol_authmode'=>$dol_authmode, 'dol_loginmesg'=>$_SESSION["dol_loginmesg"]); + $parameters = array('dol_authmode' => (isset($dol_authmode) ? $dol_authmode : ''), 'dol_loginmesg' => $_SESSION["dol_loginmesg"]); $reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { $error++; @@ -1048,6 +1057,7 @@ if (!defined('NOLOGIN')) { // Store value into session (values always stored) $_SESSION["dol_login"] = $user->login; + $_SESSION["dol_logindate"] = dol_now('gmt'); $_SESSION["dol_authmode"] = isset($dol_authmode) ? $dol_authmode : ''; $_SESSION["dol_tz"] = isset($dol_tz) ? $dol_tz : ''; $_SESSION["dol_tz_string"] = isset($dol_tz_string) ? $dol_tz_string : ''; @@ -2603,11 +2613,11 @@ function printDropdownQuickadd() $parameters = array(); $hook_items = $items; $reshook = $hookmanager->executeHooks('menuDropdownQuickaddItems', $parameters, $hook_items); // Note that $action and $object may have been modified by some hooks - if (is_numeric($reshook) && !empty($hookmanager->results) && is_array($hookmanager->results)) { + if (is_numeric($reshook) && !empty($hookmanager->resArray) && is_array($hookmanager->resArray)) { if ($reshook == 0) { - $items['items'] = array_merge($items['items'], $hookmanager->results); // add + $items['items'] = array_merge($items['items'], $hookmanager->resArray); // add } else { - $items = $hookmanager->results; // replace + $items = $hookmanager->resArray; // replace } // Sort menu items by 'position' value @@ -3208,7 +3218,6 @@ function printSearchForm($urlaction, $urlobject, $title, $htmlmorecss, $htmlinpu $ret = ''; $ret .= ''; $ret .= ''; - $ret .= ''; $ret .= ''; if ($showtitlebefore) { $ret .= '
'.$title.'
'; diff --git a/htdocs/margin/agentMargins.php b/htdocs/margin/agentMargins.php index f89cc60736d..e68576edd81 100644 --- a/htdocs/margin/agentMargins.php +++ b/htdocs/margin/agentMargins.php @@ -49,6 +49,11 @@ $pagenext = $page + 1; if (!$sortorder) { $sortorder = "ASC"; } +if ($user->rights->margins->read->all) { + $agentid = GETPOST('agentid', 'int'); +} else { + $agentid = $user->id; +} if (!$sortfield) { if ($agentid > 0) { $sortfield = "s.nom"; @@ -74,11 +79,6 @@ if (!empty($enddatemonth)) { } // Security check -if ($user->rights->margins->read->all) { - $agentid = GETPOST('agentid', 'int'); -} else { - $agentid = $user->id; -} $result = restrictedArea($user, 'margins'); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context @@ -317,7 +317,8 @@ if ($result) { $sortfield = 'name'; } $group_list = dol_sort_array($group_list, $sortfield, $sortorder); - + $cumul_achat = 0; + $cumul_vente = 0; foreach ($group_list as $group_id => $group_array) { $pa = $group_array['buying_price']; $pv = $group_array['selling_price']; diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 97e494a8a2e..b8810a2696d 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -4509,7 +4509,7 @@ if ($module == 'initmodule') { print ''; print ''; print ' ('.$langs->trans("GeneratedOn").' '.dol_print_date(dol_filemtime($outputfiledocpdf), 'dayhour').')'; - print ' '.img_picto($langs->trans("Delete"), 'delete').''; + print ' '.img_picto($langs->trans("Delete"), 'delete').''; } print '
'; diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index afd7b4860fb..4bee8d9529a 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -119,7 +119,7 @@ class MyObject extends CommonObject 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1, 'css'=>'minwidth300', 'cssview'=>'wordbreak', 'help'=>'Help text', 'showoncombobox'=>2, 'validate'=>1, 'alwayseditable'=>1), 'amount' => array('type'=>'price', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'default'=>'null', 'position'=>40, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for amount', 'validate'=>1), 'qty' => array('type'=>'real', 'label'=>'Qty', 'enabled'=>1, 'visible'=>1, 'default'=>'0', 'position'=>45, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for quantity', 'css'=>'maxwidth75imp', 'validate'=>1), - 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'picto'=>'company', 'label'=>'ThirdParty', 'visible'=> 1, 'enabled'=>'$conf->societe->enabled', 'position'=>50, 'notnull'=>-1, 'index'=>1, 'help'=>'OrganizationEventLinkToThirdParty', 'validate'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx', 'csslist'=>'tdoverflowmax150'), + 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'picto'=>'company', 'label'=>'ThirdParty', 'visible'=> 1, 'enabled'=>'isModEnabled("societe")', 'position'=>50, 'notnull'=>-1, 'index'=>1, 'help'=>'OrganizationEventLinkToThirdParty', 'validate'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx', 'csslist'=>'tdoverflowmax150'), 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'picto'=>'project', 'enabled'=>'$conf->project->enabled', 'visible'=>-1, 'position'=>52, 'notnull'=>-1, 'index'=>1, 'validate'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx', 'csslist'=>'tdoverflowmax150'), 'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>3, 'position'=>60, 'validate'=>1), 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61, 'validate'=>1, 'cssview'=>'wordbreak'), diff --git a/htdocs/mrp/class/api_mos.class.php b/htdocs/mrp/class/api_mos.class.php index 48396025957..794ab3d5378 100644 --- a/htdocs/mrp/class/api_mos.class.php +++ b/htdocs/mrp/class/api_mos.class.php @@ -203,6 +203,9 @@ class Mos extends DolibarrApi foreach ($request_data as $field => $value) { $this->mo->$field = $value; } + + $this->checkRefNumbering(); + if (!$this->mo->create(DolibarrApiAccess::$user)) { throw new RestException(500, "Error creating MO", array_merge(array($this->mo->error), $this->mo->errors)); } @@ -239,6 +242,8 @@ class Mos extends DolibarrApi $this->mo->$field = $value; } + $this->checkRefNumbering(); + if ($this->mo->update(DolibarrApiAccess::$user) > 0) { return $this->get($id); } else { @@ -723,4 +728,27 @@ class Mos extends DolibarrApi } return $myobject; } + + /** + * Validate the ref field and get the next Number if it's necessary. + * + * @return void + */ + private function checkRefNumbering(): void + { + $ref = substr($this->mo->ref, 1, 4); + if ($this->mo->status > 0 && $ref == 'PROV') { + throw new RestException(400, "Wrong naming scheme '(PROV%)' is only allowed on 'DRAFT' status. For automatic increment use 'auto' on the 'ref' field."); + } + + if (strtolower($this->mo->ref) == 'auto') { + if (empty($this->mo->id) && $this->mo->status == 0) { + $this->mo->ref = ''; // 'ref' will auto incremented with '(PROV' + newID + ')' + } else { + $this->mo->fetch_product(); + $numref = $this->mo->getNextNumRef($this->mo->product); + $this->mo->ref = $numref; + } + } + } } diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index c977a14d9ca..43e98bcd214 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -106,7 +106,7 @@ class Mo extends CommonObject 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:0', 'label'=>'Product', 'enabled'=>'$conf->product->enabled', 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'comment'=>"Product to produce", 'css'=>'maxwidth300', 'csslist'=>'tdoverflowmax100', 'picto'=>'product'), 'qty' => array('type'=>'real', 'label'=>'QtyToProduce', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'notnull'=>1, 'comment'=>"Qty to produce", 'css'=>'width75', 'default'=>1, 'isameasure'=>1), 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>42, 'notnull'=>-1, 'searchall'=>1, 'showoncombobox'=>'2', 'css'=>'maxwidth300', 'csslist'=>'tdoverflowmax200', 'alwayseditable'=>1), - 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1', 'label'=>'ThirdParty', 'picto'=>'company', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'css'=>'maxwidth400', 'csslist'=>'tdoverflowmax150'), + 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1', 'label'=>'ThirdParty', 'picto'=>'company', 'enabled'=>'isModEnabled("societe")', 'visible'=>-1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'css'=>'maxwidth400', 'csslist'=>'tdoverflowmax150'), 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'picto'=>'project', 'enabled'=>'$conf->project->enabled', 'visible'=>-1, 'position'=>51, 'notnull'=>-1, 'index'=>1, 'css'=>'minwidth200 maxwidth400', 'csslist'=>'tdoverflowmax100'), 'fk_warehouse' => array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php:0', 'label'=>'WarehouseForProduction', 'picto'=>'stock', 'enabled'=>'$conf->stock->enabled', 'visible'=>1, 'position'=>52, 'css'=>'maxwidth400', 'csslist'=>'tdoverflowmax200'), 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61, 'notnull'=>-1,), @@ -277,6 +277,7 @@ class Mo extends CommonObject if ($this->fk_bom > 0) { // If there is a nown BOM, we force the type of MO to the type of BOM + include_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php'; $tmpbom = new BOM($this->db); $tmpbom->fetch($this->fk_bom); @@ -1556,6 +1557,38 @@ class Mo extends CommonObject return $MoParent; } } + + /** + * 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 = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + //$return .= ''; // Can be image + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).''; + if (property_exists($this, 'fk_bom')) { + $return .= '
'.$this->fk_bom.''; + } + if (property_exists($this, 'qty')) { + $return .= '
'.$langs->trans('Quantity').' : '.$this->qty.''; + } + if (method_exists($this, 'getLibStatut')) { + $return .= '
'.$this->getLibStatut(5).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } /** diff --git a/htdocs/mrp/index.php b/htdocs/mrp/index.php index d7929ce1422..835a06cc7c6 100644 --- a/htdocs/mrp/index.php +++ b/htdocs/mrp/index.php @@ -249,11 +249,12 @@ if ($resql) { print '
'; +$object = new stdClass(); $parameters = array( //'type' => $type, 'user' => $user, ); -$reshook = $hookmanager->executeHooks('dashboardMRP', $parameters); +$reshook = $hookmanager->executeHooks('dashboardMRP', $parameters, $object); // End of page llxFooter(); diff --git a/htdocs/mrp/mo_list.php b/htdocs/mrp/mo_list.php index 1a00a2dc052..c3ae9247c9d 100644 --- a/htdocs/mrp/mo_list.php +++ b/htdocs/mrp/mo_list.php @@ -27,6 +27,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php'; // load mrp libraries require_once __DIR__.'/class/mo.class.php'; @@ -46,6 +47,7 @@ $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'molist'; // 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'); $id = GETPOST('id', 'int'); @@ -370,6 +372,9 @@ llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', ''); $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); } @@ -423,8 +428,12 @@ print ''; print ''; print ''; print ''; +print ''; -$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/mrp/mo_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd); +$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.'/mrp/mo_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -583,6 +592,7 @@ if (isset($extrafields->attributes[$object->table_element]['computed']) && is_ar // Loop on record // -------------------------------------------------------------------- +$bom = new Bom($db); $i = 0; $totalarray = array(); $totalarray['nbfield'] = 0; @@ -595,94 +605,113 @@ while ($i < ($limit ? min($num, $limit) : $num)) { // Store properties in $object $object->setVarsFromFetchObj($obj); - // Show here line of result - print ''; - // Action column - if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - 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 ''; - } - print ''; - } - 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'; - } elseif ($key == 'fk_parent_line') { - $cssforfield .= ($cssforfield ? ' ' : '').'center'; + //mode Kanban + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; } + $object->id = $obj->type_id; + $bom->id = $obj->fk_bom; + $objectBom = $bom->fetch($obj->fk_bom); + //var_dump($bom);exit; + $object->fk_bom = $bom->getNomUrl(); - if (in_array($val['type'], array('timestamp'))) { - $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } elseif ($key == 'ref') { - $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + // Output Kanban + print $object->getKanbanView(''); + if ($i == (min($num, $limit) - 1)) { + print '
'; + print ''; } - - 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($arrayfields['t.'.$key]['checked'])) { - print ''; - if ($key == 'status') { - print $object->getLibStatut(5); - } elseif ($key == 'fk_parent_line') { - $moparent = $object->getMoParent(); - if (is_object($moparent)) print $moparent->getNomUrl(1); - } elseif ($key == 'rowid') { - print $object->showOutputField($val, $key, $object->id, ''); - } else { - print $object->showOutputField($val, $key, $object->$key, ''); + } else { + // Show here line of result + print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + 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 ''; } print ''; - if (!$i) { - $totalarray['nbfield']++; + } + 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'; + } elseif ($key == 'fk_parent_line') { + $cssforfield .= ($cssforfield ? ' ' : '').'center'; } - if (!empty($val['isameasure']) && $val['isameasure'] == 1) { + + if (in_array($val['type'], array('timestamp'))) { + $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + } elseif ($key == 'ref') { + $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + } + + 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($arrayfields['t.'.$key]['checked'])) { + print ''; + if ($key == 'status') { + print $object->getLibStatut(5); + } elseif ($key == 'fk_parent_line') { + $moparent = $object->getMoParent(); + if (is_object($moparent)) print $moparent->getNomUrl(1); + } elseif ($key == 'rowid') { + print $object->showOutputField($val, $key, $object->id, ''); + } else { + print $object->showOutputField($val, $key, $object->$key, ''); + } + print ''; 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 - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - 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 + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + 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 ''; } - print ''; + print ''; + } + if (!$i) { + $totalarray['nbfield']++; } - print ''; - } - if (!$i) { - $totalarray['nbfield']++; - } - - print ''."\n"; + print ''."\n"; + } $i++; } diff --git a/htdocs/product/ajax/products.php b/htdocs/product/ajax/products.php index f61e92c56f3..e07aa4ab5c5 100644 --- a/htdocs/product/ajax/products.php +++ b/htdocs/product/ajax/products.php @@ -103,26 +103,36 @@ if ($action == 'fetch' && !empty($id)) { $price_level = 1; if ($socid > 0) { - $thirdpartytemp = new Societe($db); - $thirdpartytemp->fetch($socid); - - //Load translation description and label - if (getDolGlobalInt('MAIN_MULTILANGS') && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { - $newlang = $thirdpartytemp->default_lang; - - if (!empty($newlang)) { - $outputlangs = new Translate("", $conf); - $outputlangs->setDefaultLang($newlang); - $outdesc_trans = (!empty($object->multilangs[$outputlangs->defaultlang]["description"])) ? $object->multilangs[$outputlangs->defaultlang]["description"] : $object->description; - $outlabel_trans = (!empty($object->multilangs[$outputlangs->defaultlang]["label"])) ? $object->multilangs[$outputlangs->defaultlang]["label"] : $object->label; - } else { - $outdesc_trans = $object->description; - $outlabel_trans = $object->label; - } + $needchangeaccordingtothirdparty = 0; + if (getDolGlobalInt('MAIN_MULTILANGS') && getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE')) { + $needchangeaccordingtothirdparty = 1; } + if (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { + $needchangeaccordingtothirdparty = 1; + } + if ($needchangeaccordingtothirdparty) { + $thirdpartytemp = new Societe($db); + $thirdpartytemp->fetch($socid); - if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) { - $price_level = $thirdpartytemp->price_level; + //Load translation description and label according to thirdparty language + if (getDolGlobalInt('MAIN_MULTILANGS') && getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE')) { + $newlang = $thirdpartytemp->default_lang; + + if (!empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + $outdesc_trans = (!empty($object->multilangs[$outputlangs->defaultlang]["description"])) ? $object->multilangs[$outputlangs->defaultlang]["description"] : $object->description; + $outlabel_trans = (!empty($object->multilangs[$outputlangs->defaultlang]["label"])) ? $object->multilangs[$outputlangs->defaultlang]["label"] : $object->label; + } else { + $outdesc_trans = $object->description; + $outlabel_trans = $object->label; + } + } + + //Set price level according to thirdparty + if (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { + $price_level = $thirdpartytemp->price_level; + } } } @@ -185,7 +195,7 @@ if ($action == 'fetch' && !empty($id)) { } // Price by customer - if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES) && !empty($socid)) { + if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') && !empty($socid)) { require_once DOL_DOCUMENT_ROOT.'/product/class/productcustomerprice.class.php'; $prodcustprice = new Productcustomerprice($db); diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index c5b27a00c20..b91ae62f663 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -147,7 +147,6 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $obje $sql .= $hookmanager->resPrint; $sql .= ' FROM '.MAIN_DB_PREFIX.'product as p'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as s ON p.rowid = s.fk_product'; -$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot as e ON s.fk_entrepot = e.rowid AND e.entity IN ('.getEntity('stock').')'; if (!empty($conf->global->PRODUCT_USE_UNITS)) { $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_units as u on p.fk_unit = u.rowid'; } @@ -168,6 +167,7 @@ if (!empty($search_categ) && $search_categ != '-1') { } $sql .= ")"; } +$sql .= " AND EXISTS (SELECT e.rowid FROM ".MAIN_DB_PREFIX."entrepot as e WHERE e.rowid = s.fk_entrepot AND e.entity IN (".getEntity('stock')."))"; if ($sall) { $sql .= natural_search(array('p.ref', 'p.label', 'p.description', 'p.note'), $sall); } @@ -363,6 +363,13 @@ if ($resql) { // Fields title search print ''; + // Action column + if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; + $searchpicto = $form->showFilterAndCheckAddButtons(0); + print $searchpicto; + print ''; + } print ''; print ''; print ''; @@ -391,14 +398,20 @@ if ($resql) { $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - print ''; - $searchpicto = $form->showFilterAndCheckAddButtons(0); - print $searchpicto; - print ''; + if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; + $searchpicto = $form->showFilterAndCheckAddButtons(0); + print $searchpicto; + print ''; + } print ''; //Line for column titles print ""; + // Action column + if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print_liste_field_titre(''); + } print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "p.ref", '', $param, "", $sortfield, $sortorder); print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "p.label", '', $param, "", $sortfield, $sortorder); if (isModEnabled("service") && $type == 1) { @@ -429,7 +442,10 @@ if ($resql) { $parameters = array('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; - print_liste_field_titre(''); + // Action column + if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print_liste_field_titre(''); + } print "\n"; while ($i < min($num, $limit)) { @@ -440,6 +456,10 @@ if ($resql) { $product->load_stock(); print ''; + // Action column + if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; + } print ''; print $product->getNomUrl(1, '', 16); //if ($objp->stock_theorique < $objp->seuil_stock_alerte) print ' '.img_warning($langs->trans("StockTooLow")); @@ -504,7 +524,11 @@ if ($resql) { $parameters = array('obj'=>$objp); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $product); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - print ''; + // Action column + if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; + } + print "\n"; $i++; } diff --git a/htdocs/product/reassortlot.php b/htdocs/product/reassortlot.php index 40c8fcf4292..c07f0785e2c 100644 --- a/htdocs/product/reassortlot.php +++ b/htdocs/product/reassortlot.php @@ -227,7 +227,7 @@ $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as ps on p.rowid = ps.fk_pro $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot as e on ps.fk_entrepot = e.rowid'; // Link on unique key $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_batch as pb on pb.fk_product_stock = ps.rowid'; // Detail for each lot on each warehouse $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_lot as pl on pl.fk_product = p.rowid AND pl.batch = pb.batch'; // Link on unique key -$sql .= " WHERE p.entity IN (".getEntity('product').")"; +$sql .= " WHERE p.entity IN (".getEntity('product').") AND e.entity IN (".getEntity('stock').")"; if (!empty($search_categ) && $search_categ != '-1') { $sql .= " AND "; if ($search_categ == -2) { @@ -514,6 +514,13 @@ print ''; +// Action column +if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; +} print ''; @@ -571,6 +578,10 @@ $totalarray['nbfield'] = 0; // Fields title label // -------------------------------------------------------------------- print ''; +// Action column +if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print_liste_field_titre(''); +} print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "p.ref", '', $param, "", $sortfield, $sortorder); print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "p.label", '', $param, "", $sortfield, $sortorder); if (isModEnabled("service") && $type == 1) { @@ -591,7 +602,9 @@ print_liste_field_titre("PhysicalStock", $_SERVER["PHP_SELF"], "stock_physique", print_liste_field_titre(''); print_liste_field_titre("ProductStatusOnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre("ProductStatusOnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, '', $sortfield, $sortorder, 'right '); -print_liste_field_titre(''); +if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print_liste_field_titre(''); +} print "\n"; $product_static = new Product($db); @@ -648,6 +661,11 @@ while ($i < $imaxinloop) { print ''; + // Action column + if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; + } + // Ref print ''; - print ''; + // Action column + if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; + } print "\n"; $i++; diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 065883e7a2c..ce5bef9c939 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -182,16 +182,17 @@ class Entrepot extends CommonObject /** * Creation d'un entrepot en base * - * @param User $user Object user that create the warehouse + * @param User $user Object user that create the warehouse + * @param bool $notrigger false=launch triggers after, true=disable triggers * @return int >0 if OK, =<0 if KO */ - public function create($user) + public function create($user, $notrigger = false) { global $conf; $error = 0; - $this->label = trim(!empty($this->label) ? $this->label : $this->libelle); + $this->label = trim($this->label); // Error if label not defined if ($this->label == '') { @@ -222,14 +223,21 @@ class Entrepot extends CommonObject // Actions on extra fields if (!$error) { - if (!$error) { - $result = $this->insertExtraFields(); - if ($result < 0) { - $error++; - } + $result = $this->insertExtraFields(); + if ($result < 0) { + $error++; } } + if (!$error && !$notrigger) { + // Call triggers + $result = $this->call_trigger('WAREHOUSE_CREATE', $user); + if ($result < 0) { + $error++; + } + // End call triggers + } + if (!$error) { $this->db->commit(); return $id; @@ -254,11 +262,12 @@ class Entrepot extends CommonObject /** * Update properties of a warehouse * - * @param int $id id of warehouse to modify - * @param User $user User object + * @param int $id id of warehouse to modify + * @param User $user User object + * @param bool $notrigger false=launch triggers after, true=disable trigge * @return int >0 if OK, <0 if KO */ - public function update($id, $user) + public function update($id, $user, $notrigger = false) { global $conf; @@ -267,9 +276,6 @@ class Entrepot extends CommonObject if (empty($id)) { $id = $this->id; } - if (empty($this->label)) { - $this->label = $this->libelle; // For backward compatibility - } // Check if new parent is already a child of current warehouse if (!empty($this->fk_parent)) { @@ -281,7 +287,7 @@ class Entrepot extends CommonObject } } - $this->label = trim(!empty($this->label) ? $this->label : $this->libelle); + $this->label = trim($this->label); $this->description = trim($this->description); @@ -324,6 +330,15 @@ class Entrepot extends CommonObject } } + if (!$error && !$notrigger) { + // Call triggers + $result = $this->call_trigger('WAREHOUSE_MODIFY', $user); + if ($result < 0) { + $error++; + } + // End call triggers + } + if (!$error) { $this->db->commit(); return 1; @@ -461,7 +476,6 @@ class Entrepot extends CommonObject $this->fk_project = $obj->fk_project; $this->ref = $obj->label; $this->label = $obj->label; - $this->libelle = $obj->label; // deprecated $this->description = $obj->description; $this->statut = $obj->statut; $this->lieu = $obj->lieu; @@ -705,7 +719,7 @@ class Entrepot extends CommonObject if (isset($this->statut)) { $label .= ' '.$this->getLibStatut(5); } - $label .= '
'.$langs->trans('Ref').': '.(empty($this->ref) ? (empty($this->label) ? $this->libelle : $this->label) : $this->ref); + $label .= '
'.$langs->trans('Ref').': '.(empty($this->ref) ? $this->label : $this->ref); if (!empty($this->lieu)) { $label .= '
'.$langs->trans('LocationSummary').': '.$this->lieu; } @@ -742,7 +756,7 @@ class Entrepot extends CommonObject $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); } if ($withpicto != 2) { - $result .= (($showfullpath || !empty($conf->global->STOCK_ALWAYS_SHOW_FULL_ARBO)) ? $this->get_full_arbo() : (empty($this->label) ? $this->libelle : $this->label)); + $result .= (($showfullpath || !empty($conf->global->STOCK_ALWAYS_SHOW_FULL_ARBO)) ? $this->get_full_arbo() : $this->label); } $result .= $linkend; @@ -798,7 +812,7 @@ class Entrepot extends CommonObject // phpcs:enable global $user, $langs, $conf; - $TArbo = array(empty($this->label) ? $this->libelle : $this->label); + $TArbo = array($this->label); $protection = 100; // We limit depth of warehouses to 100 diff --git a/htdocs/projet/class/projectstats.class.php b/htdocs/projet/class/projectstats.class.php index 65d673a9ad2..e2b6c5129ff 100644 --- a/htdocs/projet/class/projectstats.class.php +++ b/htdocs/projet/class/projectstats.class.php @@ -298,7 +298,7 @@ class ProjectStats extends Stats * @param int $startyear End year * @param int $cachedelay Delay we accept for cache file (0=No read, no save of cache, -1=No read but save) * @param int $wonlostfilter Add a filter on status won/lost - * @return array Array of values + * @return array|int Array of values or <0 if error */ public function getWeightedAmountByMonthWithPrevYear($endyear, $startyear, $cachedelay = 0, $wonlostfilter = 1) { @@ -411,10 +411,10 @@ class ProjectStats extends Stats /** * Return amount of elements by month for several years * - * @param int $endyear End year - * @param int $startyear Start year - * @param int $cachedelay accept for cache file (0=No read, no save of cache, -1=No read but save) - * @return array of values + * @param int $endyear End year + * @param int $startyear Start year + * @param int $cachedelay accept for cache file (0=No read, no save of cache, -1=No read but save) + * @return array|int Array of values or <0 if error */ public function getTransformRateByMonthWithPrevYear($endyear, $startyear, $cachedelay = 0) { @@ -549,7 +549,7 @@ class ProjectStats extends Stats /** * Return average of entity by month * @param int $year year number - * @return int value + * @return array */ protected function getAverageByMonth($year) { diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index d836c1ef319..6c2e8ad29a4 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -2325,4 +2325,39 @@ class Task extends CommonObjectLine return ($datetouse > 0 && ($datetouse < ($now - $conf->project->task->warning_delay))); } + + /** + * 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, $conf; + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + //$return .= ''; // Can be image + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).''; + if (property_exists($this, 'fk_project') ) { + $return .= '
'.$this->fk_project.''; + } + if (property_exists($this, 'budget_amount')) { + $return .= '
'.$langs->trans("Budget").' : '.price($this->budget_amount, 0, $langs, 1, 0, 0, $conf->currency).''; + } + if (property_exists($this, 'fk_statut')) { + $return .= '
'.$this->fk_statut.''; + } + if (property_exists($this, 'duration_effective')) { + $return .= '
'.getTaskProgressView($this, false, false).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/projet/class/taskstats.class.php b/htdocs/projet/class/taskstats.class.php index ce7c6c4f4c5..6ff56fd8132 100644 --- a/htdocs/projet/class/taskstats.class.php +++ b/htdocs/projet/class/taskstats.class.php @@ -212,7 +212,7 @@ class TaskStats extends Stats /** * Return average of entity by month * @param int $year year number - * @return int value + * @return array array of values */ protected function getAverageByMonth($year) { diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index c966a34ea0b..877cd910311 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -183,6 +183,14 @@ $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; * Actions */ +if (GETPOST('cancel', 'alpha')) { + $action = 'list'; + $massaction = ''; +} +if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { + $massaction = ''; +} + $parameters = array('id'=>$id); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { @@ -413,6 +421,7 @@ $help_url = "EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos"; llxHeader("", $title, $help_url); +$arrayofselected = is_array($toselect) ? $toselect : array(); if ($id > 0 || !empty($ref)) { $result = $object->fetch($id, $ref); @@ -544,6 +553,18 @@ if ($id > 0 || !empty($ref)) { // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; + $arrayofmassactions = array(); + if ($user->rights->projet->creer) { + $arrayofmassactions['preclonetasks'] = img_picto('', 'rightarrow', 'class="pictofixedwidth"').$langs->trans("Clone"); + } + if ($permissiontodelete) { + $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); + } + if (in_array($massaction, array('presend', 'predelete'))) { + $arrayofmassactions = array(); + } + $massactionbutton = $form->selectMassAction('', $arrayofmassactions); + // Project card $linkback = ''.$langs->trans("BackToList").''; @@ -849,7 +870,11 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third $linktotasks .= dolGetButtonTitle($langs->trans('ViewGantt'), '', 'fa fa-stream imgforviewmode', DOL_URL_ROOT.'/projet/ganttview.php?id='.$object->id.'&withproject=1', '', 1, array('morecss'=>'reposition marginleftonly')); //print_barre_liste($title, 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, $linktotasks, $num, $totalnboflines, 'generic', 0, '', '', 0, 1); - print load_fiche_titre($title, $linktotasks.'   '.$linktocreatetask, 'projecttask'); + print load_fiche_titre($title, $linktotasks.'   '.$linktocreatetask, 'projecttask', '', '', '', $massactionbutton); + + $objecttmp = new Task($db); + $trackid = 'task'.$taskstatic->id; + include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; // Get list of tasks in tasksarray and taskarrayfiltered // We need all tasks (even not limited to a user because a task to user can have a parent that is not affected to him). @@ -884,6 +909,11 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third print ''; } + // Show the massaction checkboxes only when this page is not opend from the Extended POS + if ($massactionbutton && $contextpage != 'poslist') { + $selectedfields = $form->showCheckAddButtons('checkforselect', 1); + } + print '
'; print '
'; + $searchpicto = $form->showFilterButtons(); + print $searchpicto; + print ''; print ''; print '
'; print $product_static->getNomUrl(1, '', 16); @@ -711,7 +729,10 @@ while ($i < $imaxinloop) { print ''.$product_static->LibStatut($objp->tobuy, 5, 1).'
'; @@ -994,6 +1024,8 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; + print ''; + // Action column print ''; print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print "\n"; @@ -1069,7 +1102,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third if (count($tasksarray) > 0) { // Show all lines in taskarray (recursive function to go down on tree) $j = 0; $level = 0; - $nboftaskshown = projectLinesa($j, 0, $tasksarray, $level, true, 0, $tasksrole, $object->id, 1, $object->id, $filterprogresscalc, ($object->usage_bill_time ? 1 : 0), $arrayfields); + $nboftaskshown = projectLinesa($j, 0, $tasksarray, $level, true, 0, $tasksrole, $object->id, 1, $object->id, $filterprogresscalc, ($object->usage_bill_time ? 1 : 0), $arrayfields, $arrayofselected); } else { $colspan = 10; if ($object->usage_bill_time) { diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 72c5eb25874..bc4c8770f0f 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -580,6 +580,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); } @@ -697,7 +700,11 @@ if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'pr } $massactionbutton = $form->selectMassAction('', $arrayofmassactions); -$newcardbutton = dolGetButtonTitle($langs->trans('NewTask'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/projet/tasks.php?action=create', '', $user->rights->projet->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('NewTask'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/projet/tasks.php?action=create', '', $user->rights->projet->creer); print ''."\n"; if ($optioncss != '') { @@ -712,6 +719,8 @@ if (!empty($type)) { print ''; } print ''; +print ''; + // Show description of content $texthelp = ''; @@ -1121,6 +1130,8 @@ while ($i < $imaxinloop) { print '
'; } // Output Kanban + $object->fk_statut = $projectstatic->getLibStatut(1); + $object->fk_project = $projectstatic->getNomUrl(1, 'task'); print $object->getKanbanView(''); if ($i == ($imaxinloop - 1)) { print '
'; diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 7931c6a37c1..943280d6e2d 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -46,9 +46,6 @@ if (!defined('NOLOGIN')) { if (!defined('NOCSRFCHECK')) { define("NOCSRFCHECK", 1); // We accept to go on this page from external web site. } -if (!defined('NOIPCHECK')) { - define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip -} if (!defined('NOBROWSERNOTIF')) { define('NOBROWSERNOTIF', '1'); } diff --git a/htdocs/public/onlinesign/newonlinesign.php b/htdocs/public/onlinesign/newonlinesign.php index de6b27cba90..c47bbd7f734 100644 --- a/htdocs/public/onlinesign/newonlinesign.php +++ b/htdocs/public/onlinesign/newonlinesign.php @@ -549,6 +549,8 @@ if ($action == "dosign" && empty($cancel)) { $("#signbutton").attr("disabled",false); if(!$._data($("#signbutton")[0], "events")){ $("#signbutton").on("click",function(){ + console.log("We click on button sign"); + $("#signbutton").val(\''.dol_escape_js($langs->transnoentities('PleaseBePatient')).'\'); var signature = $("#signature").jSignature("getData", "image"); $.ajax({ type: "POST", diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index c4b2d502d3d..4f2b91a51e7 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -1033,6 +1033,7 @@ if ($source == 'order') { $amount = price2num($amount); } + $tag = ''; if (GETPOST('fulltag', 'alpha')) { $fulltag = GETPOST('fulltag', 'alpha'); } else { diff --git a/htdocs/public/payment/paymentko.php b/htdocs/public/payment/paymentko.php index 2504260cbc5..4174267a769 100644 --- a/htdocs/public/payment/paymentko.php +++ b/htdocs/public/payment/paymentko.php @@ -174,7 +174,7 @@ if (!empty($_SESSION['ipaddress'])) { // To avoid to make action twice $companylangs->setDefaultLang($mysoc->default_lang); $companylangs->loadLangs(array('main', 'members', 'bills', 'paypal', 'paybox')); - $from = $conf->global->MAILING_EMAIL_FROM; + $from = !empty($conf->global->MAILING_EMAIL_FROM) ? $conf->global->MAILING_EMAIL_FROM : getDolGlobalString("MAIN_MAIL_EMAIL_FROM"); $sendto = $sendemail; $urlback = $_SERVER["REQUEST_URI"]; diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 3bfdfc5f089..4a13de1ef7f 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -1327,7 +1327,9 @@ if ($ispaymentok) { if ($attendeetovalidate->email_company && $attendeetovalidate->email_company != $thirdparty->email) { $cc = ($cc ? ', ' : '').$attendeetovalidate->email_company; } - $from = $conf->global->MAILING_EMAIL_FROM; + + $from = !empty($conf->global->MAILING_EMAIL_FROM) ? $conf->global->MAILING_EMAIL_FROM : getDolGlobalString("MAIN_MAIL_EMAIL_FROM"); + $urlback = $_SERVER["REQUEST_URI"]; $ishtml = dol_textishtml($texttosend); // May contain urls @@ -1628,7 +1630,7 @@ if ($ispaymentok) { $companylangs->loadLangs(array('main', 'members', 'bills', 'paypal', 'paybox')); $sendto = $sendemail; - $from = $conf->global->MAILING_EMAIL_FROM; + $from = !empty($conf->global->MAILING_EMAIL_FROM) ? $conf->global->MAILING_EMAIL_FROM : getDolGlobalString("MAIN_MAIL_EMAIL_FROM"); // Define $urlwithroot $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file @@ -1756,7 +1758,7 @@ if ($ispaymentok) { $companylangs->loadLangs(array('main', 'members', 'bills', 'paypal', 'paybox')); $sendto = $sendemail; - $from = $conf->global->MAILING_EMAIL_FROM; + $from = !empty($conf->global->MAILING_EMAIL_FROM) ? $conf->global->MAILING_EMAIL_FROM : getDolGlobalString("MAIN_MAIL_EMAIL_FROM"); // Define $urlwithroot $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file diff --git a/htdocs/public/recruitment/index.php b/htdocs/public/recruitment/index.php index 8724e65ca4f..4f82139656c 100644 --- a/htdocs/public/recruitment/index.php +++ b/htdocs/public/recruitment/index.php @@ -252,7 +252,7 @@ if (is_array($results)) { } } print ''; - print $tmpuser->getFullName(); + print $tmpuser->getFullName($langs); print '   '.dol_print_email($emailforcontact, 0, 0, 1, 0, 0, 'envelope'); print ''; print '
'; diff --git a/htdocs/public/users/view.php b/htdocs/public/users/view.php index ba1a6dd0908..d63a2a66eee 100644 --- a/htdocs/public/users/view.php +++ b/htdocs/public/users/view.php @@ -91,19 +91,89 @@ if ($cancel) { */ $form = new Form($db); +$v = new vCard(); + $company = $mysoc; +$modulepart = 'userphotopublic'; +$dir = $conf->user->dir_output; + +// Show logo (search order: logo defined by ONLINE_SIGN_LOGO_suffix, then ONLINE_SIGN_LOGO_, then small company logo, large company logo, theme logo, common logo) +// Define logo and logosmall +$logo = ''; +$logosmall = ''; +if (!empty($object->photo)) { + if (dolIsAllowedForPreview($object->photo)) { + $logosmall = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.getImageFileNameForSize($object->photo, '_small'); + $logo = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo; + //$originalfile = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo; + } +} +//print ''."\n"; +// Define urllogo +$urllogo = ''; +$urllogofull = ''; +if (!empty($logosmall) && is_readable($dir.'/'.$logosmall)) { + $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.($conf->entity > 1 ? '&entity='.$conf->entity : '').'&securekey='.urlencode($securekey).'&file='.urlencode($logosmall); + $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart='.$modulepart.($conf->entity > 1 ? '&entity='.$conf->entity : '').'&securekey='.urlencode($securekey).'&file='.urlencode($logosmall); +} elseif (!empty($logo) && is_readable($dir.'/'.$logo)) { + $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.($conf->entity > 1 ? '&entity='.$conf->entity : '').'&securekey='.urlencode($securekey).'&file='.urlencode($logo); + $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart='.$modulepart.($conf->entity > 1 ? '&entity='.$conf->entity : '').'&securekey='.urlencode($securekey).'&file='.urlencode($logo); +} + +// Clean data we don't want on public page +if (getDolUserInt('USER_PUBLIC_HIDE_PHOTO', 0, $object)) { + $logo = ''; + $logosmall = ''; + $urllogo = ''; + $urllogofull = ''; +} +if (getDolUserInt('USER_PUBLIC_HIDE_JOBPOSITION', 0, $object)) { + $object->job = ''; +} +if (getDolUserInt('USER_PUBLIC_HIDE_EMAIL', 0, $object)) { + $object->email = ''; +} +if (getDolUserInt('USER_PUBLIC_HIDE_EMAIL', 0, $object)) { + $object->job = ''; +} +if (getDolUserInt('USER_PUBLIC_HIDE_OFFICE_PHONE', 0, $object)) { + $object->office_phone = ''; +} +if (getDolUserInt('USER_PUBLIC_HIDE_OFFICE_FAX', 0, $object)) { + $object->office_fax = ''; +} +if (getDolUserInt('USER_PUBLIC_HIDE_USER_MOBILE', 0, $object)) { + $object->user_mobile = ''; +} +if (getDolUserInt('USER_PUBLIC_HIDE_BIRTH', 0, $object)) { + $object->birth = ''; +} +if (getDolUserInt('USER_PUBLIC_HIDE_SOCIALNETWORKS', 0, $object)) { + $object->socialnetworks = ''; +} +if (getDolUserInt('USER_PUBLIC_HIDE_ADDRESS', 0, $object)) { + $object->address = ''; + $object->town = ''; + $object->zip = ''; + $object->state = ''; + $object->country = ''; +} +if (getDolUserInt('USER_PUBLIC_HIDE_COMPANY', 0, $object)) { + $company = null; +} + + +// Output vcard if ($mode == 'vcard') { // We create VCard - $v = new vCard(); - - $output = $v->buildVCardString($object, $company, $langs); + $output = $v->buildVCardString($object, $company, $langs, $urllogofull); $filename = trim(urldecode($v->getFileName())); // "Nom prenom.vcf" $filenameurlencoded = dol_sanitizeFileName(urlencode($filename)); //$filename = dol_sanitizeFileName($filename); - top_httphead('text/x-vcard; name="'.$filename.'"'); + top_httphead('text/vcard; name="'.$filename.'"'); header("Content-Disposition: attachment; filename=\"".$filename."\""); header("Content-Length: ".dol_strlen($output)); @@ -147,34 +217,6 @@ print ''; print "\n"; print ''."\n"; -$modulepart = 'userphotopublic'; -$imagesize = 'small'; -$dir = $conf->user->dir_output; -$email = $object->email; - -// Show logo (search order: logo defined by ONLINE_SIGN_LOGO_suffix, then ONLINE_SIGN_LOGO_, then small company logo, large company logo, theme logo, common logo) -// Define logo and logosmall -$logo = ''; -$logosmall = ''; -if (!empty($object->photo)) { - if (dolIsAllowedForPreview($object->photo)) { - $logosmall = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.getImageFileNameForSize($object->photo, '_small'); - $logo = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo; - //$originalfile = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo; - } -} -//print ''."\n"; -// Define urllogo -$urllogo = ''; -$urllogofull = ''; -if (!empty($logosmall) && is_readable($conf->user->dir_output.'/'.$logosmall)) { - $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$conf->entity.'&securekey='.urlencode($securekey).'&file='.urlencode($logosmall); - $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart='.$modulepart.'&entity='.$conf->entity.'&securekey='.urlencode($securekey).'&file='.urlencode($logosmall); -} elseif (!empty($logo) && is_readable($conf->user->dir_output.'/'.$logo)) { - $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$conf->entity.'&securekey='.urlencode($securekey).'&file='.urlencode($logo); - $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart='.$modulepart.'&entity='.$conf->entity.'&securekey='.urlencode($securekey).'&file='.urlencode($logo); -} - // Output html code for logo print '
'; print '
'; @@ -211,9 +253,11 @@ $socialnetworksdict = getArrayOfSocialNetworks(); // Show barcode $showbarcode = GETPOST('nobarcode') ? 0 : 1; if ($showbarcode) { + $qrcodecontent = $output = $v->buildVCardString($object, $company, $langs); + print '
'; print '
'; - print ''; + print ''; print '
'; print '
'; } @@ -347,11 +391,11 @@ if (!getDolUserInt('USER_PUBLIC_HIDE_COMPANY', 0, $object)) { $urllogo = ''; $urllogofull = ''; if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) { - $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); - $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); + $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany'.($conf->entity > 1 ? '&entity='.$conf->entity : '').'&file='.urlencode('logos/thumbs/'.$logosmall); + $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany'.($conf->entity > 1 ? '&entity='.$conf->entity : '').'&file='.urlencode('logos/thumbs/'.$logosmall); } elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) { - $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); - $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); + $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany'.($conf->entity > 1 ? '&entity='.$conf->entity : '').'&file='.urlencode('logos/'.$logo); + $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany'.($conf->entity > 1 ? '&entity='.$conf->entity : '').'&file='.urlencode('logos/'.$logo); } // Output html code for logo if ($urllogo) { @@ -406,8 +450,9 @@ print '
'; print '
'; print ''; //print '
'; diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 03ed28a2200..e9a89691c88 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -140,27 +140,6 @@ class Reception extends CommonObject public function __construct($db) { $this->db = $db; - - // List of long language codes for status - $this->statuts = array(); - $this->statuts[-1] = 'StatusReceptionCanceled'; - $this->statuts[0] = 'StatusReceptionDraft'; - // product to receive if stock increase is on close or already received if stock increase is on validation - $this->statuts[1] = 'StatusReceptionValidated'; - if (getDolGlobalInt("STOCK_CALCULATE_ON_RECEPTION")) { - $this->statuts[1] = 'StatusReceptionValidatedReceived'; - } - if (getDolGlobalInt("STOCK_CALCULATE_ON_RECEPTION_CLOSE")) { - $this->statuts[1] = 'StatusReceptionValidatedToReceive'; - } - $this->statuts[2] = 'StatusReceptionProcessed'; - - // List of short language codes for status - $this->statuts_short = array(); - $this->statuts_short[-1] = 'StatusReceptionCanceledShort'; - $this->statuts_short[0] = 'StatusReceptionDraftShort'; - $this->statuts_short[1] = 'StatusReceptionValidatedShort'; - $this->statuts_short[2] = 'StatusReceptionProcessedShort'; } /** @@ -1317,8 +1296,27 @@ class Reception extends CommonObject // phpcs:enable global $langs; - $labelStatus = $langs->transnoentitiesnoconv($this->statuts[$status]); - $labelStatusShort = $langs->transnoentitiesnoconv($this->statuts_short[$status]); + // List of long language codes for status + $this->labelStatus[-1] = 'StatusReceptionCanceled'; + $this->labelStatus[0] = 'StatusReceptionDraft'; + // product to receive if stock increase is on close or already received if stock increase is on validation + $this->labelStatus[1] = 'StatusReceptionValidated'; + if (getDolGlobalInt("STOCK_CALCULATE_ON_RECEPTION")) { + $this->labelStatus[1] = 'StatusReceptionValidatedReceived'; + } + if (getDolGlobalInt("STOCK_CALCULATE_ON_RECEPTION_CLOSE")) { + $this->labelStatus[1] = 'StatusReceptionValidatedToReceive'; + } + $this->labelStatus[2] = 'StatusReceptionProcessed'; + + // List of short language codes for status + $this->labelStatusShort[-1] = 'StatusReceptionCanceledShort'; + $this->labelStatusShort[0] = 'StatusReceptionDraftShort'; + $this->labelStatusShort[1] = 'StatusReceptionValidatedShort'; + $this->labelStatusShort[2] = 'StatusReceptionProcessedShort'; + + $labelStatus = $langs->transnoentitiesnoconv($this->labelStatus[$status]); + $labelStatusShort = $langs->transnoentitiesnoconv($this->labelStatusShort[$status]); $statusType = 'status'.$status; if ($status == self::STATUS_VALIDATED) { diff --git a/htdocs/recruitment/class/recruitmentcandidature.class.php b/htdocs/recruitment/class/recruitmentcandidature.class.php index 1690f13da56..a1e49560adb 100644 --- a/htdocs/recruitment/class/recruitmentcandidature.class.php +++ b/htdocs/recruitment/class/recruitmentcandidature.class.php @@ -1024,6 +1024,41 @@ class RecruitmentCandidature extends CommonObject return $error; } + + /** + * 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, $selected,$arrayofselected; + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).''; + if (in_array($this->id, $arrayofselected)) { + $selected = 1; + } + $return .= ''; + if (property_exists($this, 'fk_recruitmentjobposition')) { + $return .= '
'.$langs->trans('Job').' : '.$this->fk_recruitmentjobposition.''; + } + if (property_exists($this, 'phone')) { + $return .= '
'.$langs->trans("phone").' : '.$this->phone.''; + } + if (method_exists($this, 'getLibStatut')) { + $return .= '
'.$this->getLibStatut(5).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/recruitment/class/recruitmentjobposition.class.php b/htdocs/recruitment/class/recruitmentjobposition.class.php index 7a9d077f910..1ee8d8e51fd 100644 --- a/htdocs/recruitment/class/recruitmentjobposition.class.php +++ b/htdocs/recruitment/class/recruitmentjobposition.class.php @@ -124,7 +124,7 @@ class RecruitmentJobPosition extends CommonObject 'email_recruiter' => array('type'=>'varchar(255)', 'label'=>'EmailRecruiter', 'enabled'=>'1', 'position'=>54, 'notnull'=>0, 'visible'=>-1, 'help'=>'ToUseAGenericEmail', 'picto'=>'email'), 'fk_user_supervisor' => array('type'=>'integer:User:user/class/user.class.php:t.statut = 1', 'label'=>'FutureManager', 'enabled'=>'1', 'position'=>55, 'notnull'=>0, 'visible'=>-1, 'foreignkey'=>'user.rowid', 'css'=>'maxwidth500', 'csslist'=>'tdoverflowmax150', 'picto'=>'user'), 'fk_establishment' => array('type'=>'integer:Establishment:hrm/class/establishment.class.php', 'label'=>'Establishment', 'enabled'=>'$conf->hrm->enabled', 'position'=>56, 'notnull'=>0, 'visible'=>-1, 'foreignkey'=>'establishment.rowid',), - 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'WorkPlace', 'enabled'=>'$conf->societe->enabled', 'position'=>57, 'notnull'=>-1, 'visible'=>-1, 'css'=>'maxwidth500', 'index'=>1, 'help'=>"IfJobIsLocatedAtAPartner", 'picto'=>'company'), + 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'WorkPlace', 'enabled'=>'isModEnabled("societe")', 'position'=>57, 'notnull'=>-1, 'visible'=>-1, 'css'=>'maxwidth500', 'index'=>1, 'help'=>"IfJobIsLocatedAtAPartner", 'picto'=>'company'), 'date_planned' => array('type'=>'date', 'label'=>'DateExpected', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>1,), 'remuneration_suggested' => array('type'=>'varchar(255)', 'label'=>'Remuneration', 'enabled'=>'1', 'position'=>62, 'notnull'=>0, 'visible'=>1,), 'description' => array('type'=>'html', 'label'=>'Description', 'enabled'=>'1', 'position'=>65, 'notnull'=>0, 'visible'=>3,), @@ -1107,4 +1107,43 @@ class RecruitmentJobPosition extends CommonObject return $error; } + + + /** + * 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, $selected,$arrayofselected,$obj; + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).''; + if (in_array($this->id, $arrayofselected)) { + $selected = 1; + } + $return .= ''; + if (property_exists($this, 'date_planned')) { + $return .= '
'.$langs->trans("Date").' : '.dol_print_date($this->db->jdate($this->date_planned), 'day').''; + } + if (property_exists($this, 'qty')) { + $return .= '
'.$langs->trans("NbOfEmployeesExpected", '', '', '', '', 2).' : '.$this->qty.''; + } + if (property_exists($this, 'remuneration_suggested')) { + $return .= ' | '.$langs->trans("Remuneration").' : '.$this->remuneration_suggested.''; + } + if (method_exists($this, 'getLibStatut')) { + $return .= '
'.$this->getLibStatut(5).' | '.$langs->trans("RecruitmentCandidatures", '', '', '', '', 5).' : '.$obj->nbapplications.'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/recruitment/recruitmentcandidature_list.php b/htdocs/recruitment/recruitmentcandidature_list.php index 9b860ac54d5..8b62a5a202f 100644 --- a/htdocs/recruitment/recruitmentcandidature_list.php +++ b/htdocs/recruitment/recruitmentcandidature_list.php @@ -735,8 +735,18 @@ while ($i < $imaxinloop) { print '
'; diff --git a/htdocs/recruitment/recruitmentjobposition_card.php b/htdocs/recruitment/recruitmentjobposition_card.php index d1ca4ef2db1..b33ce55808e 100644 --- a/htdocs/recruitment/recruitmentjobposition_card.php +++ b/htdocs/recruitment/recruitmentjobposition_card.php @@ -108,7 +108,7 @@ if (empty($reshook)) { if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) { $backtopage = $backurlforlist; } else { - $backtopage = dol_buildpath('/recruitment/recruitmentjobposition_card.php', 1).'?id='.($id > 0 ? $id : '__ID__'); + $backtopage = dol_buildpath('/recruitment/recruitmentjobposition_card.php', 1).'?id='.((!empty($id) && $id > 0) ? $id : '__ID__'); } } } @@ -130,7 +130,7 @@ if (empty($reshook)) { include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; if ($action == 'set_thirdparty' && $permissiontoadd) { - $object->setValueFrom('fk_soc', GETPOST('fk_soc', 'int'), '', '', 'date', '', $user, 'RECRUITMENTJOBPOSITION_MODIFY'); + $object->setValueFrom('fk_soc', GETPOST('fk_soc', 'int'), '', '', 'date', '', $user, $triggermodname); } if ($action == 'classin' && $permissiontoadd) { $object->setProject(GETPOST('projectid', 'int')); @@ -257,8 +257,6 @@ if (($id || $ref) && $action == 'edit') { // Part to show record if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) { - $res = $object->fetch_optionals(); - $head = recruitmentjobpositionPrepareHead($object); print dol_get_fiche_head($head, 'card', $langs->trans("RecruitmentJobPosition"), -1, $object->picto); @@ -395,31 +393,27 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($reshook)) { // Send if (empty($user->socid)) { - print ''.$langs->trans('SendMail').''."\n"; + print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init&token='.newToken().'#formmailbeforetitle'); } // Back to draft if ($object->status == $object::STATUS_VALIDATED) { if ($permissiontoadd) { - print ''.$langs->trans("SetToDraft").''; + print dolGetButtonAction('', $langs->trans('SetToDraft'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_setdraft&confirm=yes&token='.newToken(), '', $permissiontoadd); } } // Modify - if ($permissiontoadd) { - print ''.$langs->trans("Modify").''."\n"; - } else { - print ''.$langs->trans('Modify').''."\n"; - } + print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd); // Validate if ($object->status == $object::STATUS_DRAFT) { if ($permissiontoadd) { if (empty($object->table_element_line) || (is_array($object->lines) && count($object->lines) > 0)) { - print ''.$langs->trans("Validate").''; + print dolGetButtonAction('', $langs->trans('Validate'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&confirm=yes&token='.newToken(), '', $permissiontoadd); } else { $langs->load("errors"); - print ''.$langs->trans("Validate").''; + print dolGetButtonAction($langs->trans("ErrorAddAtLeastOneLineFirst"), $langs->trans("Validate"), 'default', '#', '', 0); } } } @@ -442,9 +436,10 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea /* if ($permissiontoadd) { if ($object->status == $object::STATUS_ENABLED) { - print ''.$langs->trans("Disable").''."\n"; + print dolGetButtonAction('', $langs->trans('Disable'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=disable&token='.newToken(), '', $permissiontoadd); } else { - print ''.$langs->trans("Enable").''."\n"; + print dolGetButtonAction('', $langs->trans('Enable'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=enable&token='.newToken(), '', $permissiontoadd); + } } }*/ if ($permissiontoadd) { @@ -454,7 +449,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } // Delete - print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete); + $params = array(); + print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete, $params); } print ''."\n"; } diff --git a/htdocs/recruitment/recruitmentjobposition_list.php b/htdocs/recruitment/recruitmentjobposition_list.php index e6b538b5167..670eca08040 100644 --- a/htdocs/recruitment/recruitmentjobposition_list.php +++ b/htdocs/recruitment/recruitmentjobposition_list.php @@ -585,14 +585,21 @@ while ($i < $imaxinloop) { // Store properties in $object $object->setVarsFromFetchObj($obj); + $object->date_planned = $obj->date_planned; + if ($mode == 'kanban') { if ($i == 0) { print ''; diff --git a/htdocs/salaries/class/paymentsalary.class.php b/htdocs/salaries/class/paymentsalary.class.php index ca4df1df4f9..4817abec6c8 100644 --- a/htdocs/salaries/class/paymentsalary.class.php +++ b/htdocs/salaries/class/paymentsalary.class.php @@ -762,4 +762,39 @@ class PaymentSalary 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, $db; + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).''; + if (property_exists($this, 'fk_bank')) { + $return .= ' | '.$this->fk_bank.''; + } + if (property_exists($this, 'fk_user_author')) { + $return .= '
'.$this->fk_user_author.''; + } + + if (property_exists($this, 'fk_typepayment')) { + $return .= '
'.$langs->trans("PaymentMode").' : '.$this->fk_typepayment.''; + } + if (property_exists($this, 'amount')) { + $return .= '
'.$langs->trans("Amount").' : '.price($this->amount).''; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/salaries/class/salary.class.php b/htdocs/salaries/class/salary.class.php index 25adb60382c..7f9ea31cdc9 100644 --- a/htdocs/salaries/class/salary.class.php +++ b/htdocs/salaries/class/salary.class.php @@ -707,4 +707,38 @@ class Salary 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 = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).''; + if (property_exists($this, 'fk_user')) { + $return .= ' | '.$this->fk_user.''; + } + if (property_exists($this, 'type_payment')) { + $return .= '
'.$langs->trans("PaymentMode").' : '.$this->type_payment.''; + } + if (property_exists($this, 'amount')) { + $return .= '
'.$langs->trans("Amount").' : '.price($this->amount).''; + } + if (method_exists($this, 'LibStatut')) { + $return .= '
'.$this->LibStatut($this->paye, 5, $this->alreadypaid).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/salaries/list.php b/htdocs/salaries/list.php index f1e94eddd8f..fbbac2a2f3b 100644 --- a/htdocs/salaries/list.php +++ b/htdocs/salaries/list.php @@ -44,6 +44,8 @@ $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); // 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 + // Load variable for pagination $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; @@ -222,7 +224,7 @@ $now = dol_now(); $help_url = ''; $title = $langs->trans('Salaries'); -$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.admin, u.salary as current_salary, u.fk_soc as fk_soc, u.statut as status,"; +$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.admin, u.photo, u.salary as current_salary, u.fk_soc as fk_soc, u.statut as status,"; $sql .= " s.rowid, s.fk_account, s.paye, s.fk_user, s.amount, s.salary, s.label, s.datesp, s.dateep, s.fk_typepayment as paymenttype, "; $sql .= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel, ba.iban_prefix as iban, ba.bic, ba.currency_code, ba.clos,"; $sql .= " pst.code as payment_code,"; @@ -315,6 +317,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); } @@ -379,11 +384,16 @@ print ''; print ''; print ''; print ''; +print ''; + $url = DOL_URL_ROOT.'/salaries/card.php?action=create'; if (!empty($socid)) { $url .= '&socid='.$socid; } +$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('NewSalaryPayment'), '', 'fa fa-plus-circle', $url, '', $user->rights->salaries->write); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'salary', 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -448,7 +458,7 @@ if (isModEnabled("banque")) { // Amount print ''; -//Status +// Status print ''; + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + } + } else { + // Show here line of result + print ''; - // Ref - print "\n"; - if (!$i) { - $totalarray['nbfield']++; - } + // Ref + print "\n"; + if (!$i) { + $totalarray['nbfield']++; + } - // Label payment - print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } + // Label payment + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } - // Date Start - print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } + // Date Start + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } - // Date End - print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } + // Date End + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } - // Employee - print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } + // Employee + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } - // Type - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - - // Account - if (isModEnabled("banque")) { + // Type print ''; + if (!$i) { + $totalarray['nbfield']++; + } - if (isModEnabled('accounting')) { + // Account + if (isModEnabled("banque")) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'totalttcfield'; + + // Amount + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'totalttcfield'; + } + $totalarray['val']['totalttcfield'] += $obj->amount; + + print ''; + if (!$i) $totalarray['nbfield']++; + + // 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 ''; if (!$i) { $totalarray['nbfield']++; } + + print ''."\n"; } - - // if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'totalttcfield'; - - // Amount - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'totalttcfield'; - } - $totalarray['val']['totalttcfield'] += $obj->amount; - - print ''; - if (!$i) $totalarray['nbfield']++; - - // 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 ''; - if (!$i) { - $totalarray['nbfield']++; - } - - print ''."\n"; - $i++; } diff --git a/htdocs/salaries/payments.php b/htdocs/salaries/payments.php index 75a18621ea1..5a5ccb08bf6 100644 --- a/htdocs/salaries/payments.php +++ b/htdocs/salaries/payments.php @@ -45,6 +45,8 @@ $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'bomlist'; // 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'); // mode view for result + // Load variable for pagination $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; @@ -316,6 +318,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); } @@ -385,11 +390,16 @@ print ''; print ''; print ''; print ''; +print ''; + $url = DOL_URL_ROOT.'/salaries/card.php?action=create'; if (!empty($socid)) { $url .= '&socid='.$socid; } +$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('NewSalaryPayment'), '', 'fa fa-plus-circle', $url, '', $user->rights->salaries->write); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_payment', 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -532,8 +542,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { // Store properties in $object $object->setVarsFromFetchObj($obj); - // Show here line of result - print ''; + $userstatic->id = $obj->uid; $userstatic->lastname = $obj->lastname; @@ -549,136 +558,169 @@ while ($i < ($limit ? min($num, $limit) : $num)) { $paymentsalstatic->id = $obj->rowid; $paymentsalstatic->ref = $obj->rowid; + $paymentsalstatic->amount = $obj->amount; + $paymentsalstatic->fk_typepayment = $obj->payment_code; + $paymentsalstatic->datec = $obj->dateep; + $paymentsalstatic->datep = $obj->datep; - // Ref - print "\n"; - if (!$i) { - $totalarray['nbfield']++; - } + $accountlinestatic->id = $obj->fk_bank; + $accountlinestatic->ref = $obj->fk_bank; + $paymentsalstatic->fk_bank = $accountlinestatic->getNomUrl(1); + $paymentsalstatic->fk_user_author = $userstatic->getNomUrl(1); - // Ref salary - print "\n"; - if (!$i) { - $totalarray['nbfield']++; - } - // Label payment - print "\n"; - if (!$i) { - $totalarray['nbfield']++; - } - // Date end period - print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } + if ($mode == 'kanban') { + if ($i == 0) { + print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } - // Date value - /*print '\n"; - if (!$i) $totalarray['nbfield']++;*/ + print $paymentsalstatic->getKanbanView(''); + if ($i == (min($num, $limit) - 1)) { + print ''; + print ''; + } + } else { + // Show here line of result + print ''; + // Ref + print "\n"; + if (!$i) { + $totalarray['nbfield']++; + } - // Employee - print "\n"; - if (!$i) { - $totalarray['nbfield']++; - } + // Date payment + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } - // Type - print ''; - if (!$i) { - $totalarray['nbfield']++; - } + // Ref salary + print "\n"; + if (!$i) { + $totalarray['nbfield']++; + } - // Chq number - print ''; - if (!$i) { - $totalarray['nbfield']++; - } + // Label payment + print "\n"; + if (!$i) { + $totalarray['nbfield']++; + } - // Account - if (isModEnabled("banque")) { - // Bank transaction + // Date end period + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + + // Date payment + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + + // Date value + /*print '\n"; + if (!$i) $totalarray['nbfield']++;*/ + + // Employee + print "\n"; + if (!$i) { + $totalarray['nbfield']++; + } + + // Type print ''; if (!$i) { $totalarray['nbfield']++; } - print ''; + if (!$i) { + $totalarray['nbfield']++; + } - if (isModEnabled('accounting')) { - $accountstatic->account_number = $obj->account_number; - - $accountingjournal = new AccountingJournal($db); - $accountingjournal->fetch($obj->fk_accountancy_journal); - - $accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1); + // Account + if (isModEnabled("banque")) { + // Bank transaction + print ''; + if (!$i) { + $totalarray['nbfield']++; } - $accountstatic->label = $obj->blabel; - if ($accountstatic->id > 0) { - print $accountstatic->getNomUrl(1); + + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Amount + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'totalttcfield'; + } + $totalarray['val']['totalttcfield'] += $obj->amount; + + // 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 ''; if (!$i) { $totalarray['nbfield']++; } - } - // Amount - print ''; - if (!$i) { - $totalarray['nbfield']++; + print ''."\n"; } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'totalttcfield'; - } - $totalarray['val']['totalttcfield'] += $obj->amount; - - // 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 ''; - if (!$i) { - $totalarray['nbfield']++; - } - - print ''."\n"; - $i++; } diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index bb9d2376a47..8b5dcd251d2 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -95,6 +95,7 @@ $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); $backtopagejsfields = GETPOST('backtopagejsfields', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); +$dol_openinpopup = ''; if (!empty($backtopagejsfields)) { $tmpbacktopagejsfields = explode(':', $backtopagejsfields); $dol_openinpopup = $tmpbacktopagejsfields[0]; diff --git a/htdocs/societe/class/companybankaccount.class.php b/htdocs/societe/class/companybankaccount.class.php index 26305bb0013..26a6169dbe6 100644 --- a/htdocs/societe/class/companybankaccount.class.php +++ b/htdocs/societe/class/companybankaccount.class.php @@ -35,6 +35,17 @@ class CompanyBankAccount extends Account { public $socid; + /** + * @var string ID to identify managed object + */ + public $element = 'societe_rib'; + + /** + * @var string Name of table without prefix where object is stored + */ + public $table_element = 'societe_rib'; + + /** @var bool $default_rib 1 = this object is the third party's default bank information */ public $default_rib; /** @@ -64,6 +75,13 @@ class CompanyBankAccount extends Account */ public $datem; + /** + * @var string TRIGGER_PREFIX Dolibarr 16.0 and above use the prefix to prevent the creation of inconsistently + * named triggers + * @see CommonObject::call_trigger() + */ + const TRIGGER_PREFIX = 'COMPANY_RIB'; + /** * Constructor @@ -86,7 +104,7 @@ class CompanyBankAccount extends Account * * @param User $user User * @param int $notrigger 1=Disable triggers - * @return int <0 if KO, >= 0 if OK + * @return int <0 if KO, > 0 if OK (ID of newly created company bank account information) */ public function create(User $user = null, $notrigger = 0) { @@ -97,6 +115,7 @@ class CompanyBankAccount extends Account // Check paramaters if (empty($this->socid)) { $this->error = 'BadValueForParameter'; + $this->errors[] = $this->error; return -1; } @@ -114,6 +133,9 @@ class CompanyBankAccount extends Account } } + + $this->db->begin(); + $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_rib (fk_soc, type, datec)"; $sql .= " VALUES (".((int) $this->socid).", 'ban', '".$this->db->idate($now)."')"; $resql = $this->db->query($sql); @@ -128,19 +150,20 @@ class CompanyBankAccount extends Account $error++; } // End call triggers - - if (!$error) { - return $this->id; - } else { - return 0; - } - } else { - return 1; } } } else { + $error++; $this->error = $this->db->lasterror(); - return 0; + $this->errors[] = $this->error; + } + + if (!$error) { + $this->db->commit(); + return $this->id; + } else { + $this->db->rollback(); + return -1; } } @@ -168,6 +191,8 @@ class CompanyBankAccount extends Account $this->owner_address = dol_trunc($this->owner_address, 254, 'right', 'UTF-8', 1); } + $this->db->begin(); + $sql = "UPDATE ".MAIN_DB_PREFIX."societe_rib SET"; $sql .= " bank = '".$this->db->escape($this->bank)."'"; $sql .= ",code_banque='".$this->db->escape($this->code_banque)."'"; @@ -203,20 +228,22 @@ class CompanyBankAccount extends Account $error++; } // End call triggers - if (!$error) { - return 1; - } else { - return -1; - } - } else { - return 1; } } else { + $error++; if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $this->error = $langs->trans('ErrorDuplicateField'); } else { $this->error = $this->db->lasterror(); } + $this->errors[] = $this->error; + } + + if (!$error) { + $this->db->commit(); + return 1; + } else { + $this->db->rollback(); return -1; } } diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index d1dafde4622..bf4e1135f96 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -183,8 +183,10 @@ if (empty($reshook)) { $companybankaccount->stripe_card_ref = GETPOST('stripe_card_ref', 'alpha'); $result = $companybankaccount->update($user); - if (!$result) { + if ($result <= 0) { + // Display error message and get back to edit mode setEventMessages($companybankaccount->error, $companybankaccount->errors, 'errors'); + $action = 'edit'; } else { // If this account is the default bank account, we disable others if ($companybankaccount->default_rib) { @@ -255,13 +257,8 @@ if (empty($reshook)) { if ($action == 'add') { $error = 0; - if (!GETPOST('label', 'alpha') || !GETPOST('bank', 'alpha')) { - if (!GETPOST('label', 'alpha')) { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")), null, 'errors'); - } - if (!GETPOST('bank', 'alpha')) { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankName")), null, 'errors'); - } + if (!GETPOST('label', 'alpha')) { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")), null, 'errors'); $action = 'create'; $error++; } @@ -272,6 +269,8 @@ if (empty($reshook)) { $companybankaccount->socid = $object->id; + $companybankaccount->fetch_thirdparty(); + $companybankaccount->bank = GETPOST('bank', 'alpha'); $companybankaccount->label = GETPOST('label', 'alpha'); $companybankaccount->courant = GETPOST('courant', 'alpha'); @@ -291,6 +290,12 @@ if (empty($reshook)) { $companybankaccount->datec = dol_now(); $companybankaccount->status = 1; + $companybankaccount->bank = trim($companybankaccount->bank); + if (empty($companybankaccount->bank) && !empty($companybankaccount->thirdparty)) { + $companybankaccount->bank = $langs->trans("Bank").' '.$companybankaccount->thirdparty->name; + } + $companybankaccount->bic = str_replace(' ', '', $companybankaccount->bic); + $db->begin(); // This test can be done only once properties were set @@ -1978,7 +1983,7 @@ if ($socid && $action == 'create' && $permissiontoaddupdatepaymentinformation) { print ''; print ''; - print ''; + print ''; print ''; // Show fields of bank account diff --git a/htdocs/societe/societecontact.php b/htdocs/societe/societecontact.php index 1767973a001..f626139abcb 100644 --- a/htdocs/societe/societecontact.php +++ b/htdocs/societe/societecontact.php @@ -23,7 +23,7 @@ /** * \file htdocs/societe/societecontact.php * \ingroup societe - * \brief Onglet de gestion des contacts additionnel d'une société + * \brief Tab to manage differently contact. Used when unstable feature MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES is on. */ diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 4b898a75645..c9dc776c9c5 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -591,10 +591,8 @@ 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') ? GETPOST('tva_tx') : 0); // Can be '1.2' or '1.2 (CODE)' diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index f283295aeb5..e0e0ecdd40a 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -2584,7 +2584,7 @@ class SupplierProposal extends CommonObject // For other object, here we call fetch_lines. But fetch_lines does not exists on supplier proposal $sql = 'SELECT pt.rowid, pt.label as custom_label, pt.description, pt.fk_product, pt.fk_remise_except,'; - $sql .= ' pt.qty, pt.tva_tx, pt.remise_percent, pt.subprice, pt.info_bits,'; + $sql .= ' pt.qty, pt.tva_tx, pt.vat_src_code, pt.remise_percent, pt.subprice, pt.info_bits,'; $sql .= ' pt.total_ht, pt.total_tva, pt.total_ttc, pt.fk_product_fournisseur_price as fk_fournprice, pt.buy_price_ht as pa_ht, pt.special_code, pt.localtax1_tx, pt.localtax2_tx,'; $sql .= ' pt.product_type, pt.rang, pt.fk_parent_line,'; $sql .= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid,'; @@ -2620,6 +2620,7 @@ class SupplierProposal extends CommonObject $this->lines[$i]->fk_remise_except = $obj->fk_remise_except; $this->lines[$i]->remise_percent = $obj->remise_percent; $this->lines[$i]->tva_tx = $obj->tva_tx; + $this->lines[$i]->vat_src_code = $obj->vat_src_code; $this->lines[$i]->info_bits = $obj->info_bits; $this->lines[$i]->total_ht = $obj->total_ht; $this->lines[$i]->total_tva = $obj->total_tva; @@ -2723,6 +2724,42 @@ class SupplierProposal 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 = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + //$return .= ''; // Can be image + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).''; + if (property_exists($this, 'socid')) { + $return .= ' | '.$this->socid.''; + } + if (property_exists($this, 'delivery_date')) { + $return .= '
'.$langs->trans("DateEnd").' : '.dol_print_date($this->delivery_date).''; + } + if (property_exists($this, 'total_ttc')) { + $return .='
'.$langs->trans("AmountHT").' : '.price($this->total_ttc).''; + } + if (method_exists($this, 'getLibStatut')) { + $return .= '
'.$this->getLibStatut(5).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } @@ -2988,6 +3025,9 @@ class SupplierProposalLine extends CommonObjectLine if (empty($this->tva_tx)) { $this->tva_tx = 0; } + if (empty($this->vat_src_code)) { + $this->vat_src_code = ''; + } if (empty($this->localtax1_tx)) { $this->localtax1_tx = 0; } @@ -3056,7 +3096,7 @@ class SupplierProposalLine extends CommonObjectLine $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'supplier_proposaldet'; $sql .= ' (fk_supplier_proposal, fk_parent_line, label, description, fk_product, product_type,'; $sql .= ' date_start, date_end,'; - $sql .= ' fk_remise_except, qty, tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type,'; + $sql .= ' fk_remise_except, qty, tva_tx, vat_src_code, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type,'; $sql .= ' subprice, remise_percent, '; $sql .= ' info_bits, '; $sql .= ' total_ht, total_tva, total_localtax1, total_localtax2, total_ttc, fk_product_fournisseur_price, buy_price_ht, special_code, rang,'; @@ -3073,6 +3113,7 @@ class SupplierProposalLine extends CommonObjectLine $sql .= " ".($this->fk_remise_except ? ((int) $this->fk_remise_except) : "null").","; $sql .= " ".price2num($this->qty, 'MS').","; $sql .= " ".price2num($this->tva_tx).","; + $sql .= " '".$this->db->escape($this->vat_src_code)."',"; $sql .= " ".price2num($this->localtax1_tx).","; $sql .= " ".price2num($this->localtax2_tx).","; $sql .= " '".$this->db->escape($this->localtax1_type)."',"; diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index ab89c4a43b8..e5bde023024 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -57,6 +57,7 @@ $show_files = GETPOST('show_files', 'int'); $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'supplierproposallist'; +$mode = GETPOST('mode', 'alpha'); $search_user = GETPOST('search_user', 'int'); $search_sale = GETPOST('search_sale', 'int'); @@ -510,6 +511,9 @@ if ($resql) { } $param = ''; + if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); + } if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -630,7 +634,10 @@ if ($resql) { if (!empty($socid)) { $url .= '&socid='.$socid; } - $newcardbutton = dolGetButtonTitle($langs->trans('NewAskPrice'), '', 'fa fa-plus-circle', $url, '', $user->rights->supplier_proposal->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('NewAskPrice'), '', 'fa fa-plus-circle', $url, '', $user->rights->supplier_proposal->creer); // Fields title search print ''; @@ -642,6 +649,7 @@ if ($resql) { print ''; print ''; print ''; + print ''; print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'supplier_proposal', 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -973,288 +981,304 @@ if ($resql) { $companystatic->client = $obj->client; $companystatic->code_client = $obj->code_client; - print ''; - // Action column - if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - } - if (!empty($arrayfields['sp.ref']['checked'])) { - print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Thirdparty - if (!empty($arrayfields['s.nom']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Alias - if (!empty($arrayfields['s.name_alias']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Town - if (!empty($arrayfields['s.town']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Zip - if (!empty($arrayfields['s.zip']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // State - if (!empty($arrayfields['state.nom']['checked'])) { - print "\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Country - if (!empty($arrayfields['country.code_iso']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Type ent - if (!empty($arrayfields['typent.code']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Date proposal - if (!empty($arrayfields['sp.date_valid']['checked'])) { - print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Date delivery - if (!empty($arrayfields['sp.date_livraison']['checked'])) { - print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Amount HT - if (!empty($arrayfields['sp.total_ht']['checked'])) { - print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'sp.total_ht'; - } - $totalarray['val']['sp.total_ht'] += $obj->total_ht; - } - // Amount VAT - if (!empty($arrayfields['sp.total_tva']['checked'])) { - print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'sp.total_tva'; - } - $totalarray['val']['sp.total_tva'] += $obj->total_tva; - } - // Amount TTC - if (!empty($arrayfields['sp.total_ttc']['checked'])) { - print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'sp.total_ttc'; - } - $totalarray['val']['sp.total_ttc'] += $obj->total_ttc; - } - - // Currency - if (!empty($arrayfields['sp.multicurrency_code']['checked'])) { - print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Currency rate - if (!empty($arrayfields['sp.multicurrency_tx']['checked'])) { - print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Amount HT - if (!empty($arrayfields['sp.multicurrency_total_ht']['checked'])) { - print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Amount VAT - if (!empty($arrayfields['sp.multicurrency_total_vat']['checked'])) { - print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Amount TTC - if (!empty($arrayfields['sp.multicurrency_total_ttc']['checked'])) { - print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - - $userstatic->id = $obj->fk_user_author; - $userstatic->login = $obj->login; - $userstatic->status = $obj->ustatus; - $userstatic->lastname = $obj->name; - $userstatic->firstname = $obj->firstname; - $userstatic->photo = $obj->photo; - $userstatic->admin = $obj->admin; - $userstatic->ref = $obj->fk_user_author; - $userstatic->employee = $obj->employee; - $userstatic->email = $obj->uemail; - - // Author - if (!empty($arrayfields['u.login']['checked'])) { - print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // 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['sp.datec']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date modification - if (!empty($arrayfields['sp.tms']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Status - if (!empty($arrayfields['sp.fk_statut']['checked'])) { - print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Action column - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print '\n"; + if (!$i) { + $totalarray['nbfield']++; } - print ''; } - print ''; + + // Thirdparty + if (!empty($arrayfields['s.nom']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Alias + if (!empty($arrayfields['s.name_alias']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Town + if (!empty($arrayfields['s.town']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Zip + if (!empty($arrayfields['s.zip']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // State + if (!empty($arrayfields['state.nom']['checked'])) { + print "\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Country + if (!empty($arrayfields['country.code_iso']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Type ent + if (!empty($arrayfields['typent.code']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Date proposal + if (!empty($arrayfields['sp.date_valid']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Date delivery + if (!empty($arrayfields['sp.date_livraison']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Amount HT + if (!empty($arrayfields['sp.total_ht']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'sp.total_ht'; + } + $totalarray['val']['sp.total_ht'] += $obj->total_ht; + } + // Amount VAT + if (!empty($arrayfields['sp.total_tva']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'sp.total_tva'; + } + $totalarray['val']['sp.total_tva'] += $obj->total_tva; + } + // Amount TTC + if (!empty($arrayfields['sp.total_ttc']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'sp.total_ttc'; + } + $totalarray['val']['sp.total_ttc'] += $obj->total_ttc; + } + + // Currency + if (!empty($arrayfields['sp.multicurrency_code']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Currency rate + if (!empty($arrayfields['sp.multicurrency_tx']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Amount HT + if (!empty($arrayfields['sp.multicurrency_total_ht']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Amount VAT + if (!empty($arrayfields['sp.multicurrency_total_vat']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Amount TTC + if (!empty($arrayfields['sp.multicurrency_total_ttc']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + + $userstatic->id = $obj->fk_user_author; + $userstatic->login = $obj->login; + $userstatic->status = $obj->ustatus; + $userstatic->lastname = $obj->name; + $userstatic->firstname = $obj->firstname; + $userstatic->photo = $obj->photo; + $userstatic->admin = $obj->admin; + $userstatic->ref = $obj->fk_user_author; + $userstatic->employee = $obj->employee; + $userstatic->email = $obj->uemail; + + // Author + if (!empty($arrayfields['u.login']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // 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['sp.datec']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Date modification + if (!empty($arrayfields['sp.tms']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Status + if (!empty($arrayfields['sp.fk_statut']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } + if (!$i) { + $totalarray['nbfield']++; + } + + print "\n"; + + $total += $obj->total_ht; + $subtotal += $obj->total_ht; } - if (!$i) { - $totalarray['nbfield']++; - } - - print "\n"; - - $total += $obj->total_ht; - $subtotal += $obj->total_ht; - $i++; } diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 289f44333cc..bef2e6e7800 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -49,7 +49,7 @@ if (!defined('ISLOADEDBYSTEELSHEET')) { --colortextbacktab: #; --colorboxiconbg: #eee; --refidnocolor:#444; - --tableforfieldcolor:#666; + --tableforfieldcolor:#888; --amountremaintopaycolor:#880000; --amountpaymentcomplete:#008800; --amountremaintopaybackcolor:none; @@ -1432,6 +1432,9 @@ select.flat.selectlimit { .tablelistofcalendars { margin-top: 25px !important; } +.navselectiondate { + width: 250px; +} /* Styles for amount on card */ table.paymenttable td.amountpaymentcomplete, table.paymenttable td.amountremaintopay, table.paymenttable td.amountremaintopayback { @@ -1604,6 +1607,7 @@ table[summary="list_of_modules"] .fa-cog { .minwidth100 { min-width: 100px; } .minwidth150 { min-width: 150px; } .minwidth200 { min-width: 200px; } + .minwidth250 { min-width: 250px; } .minwidth300 { min-width: 300px; } .minwidth400 { min-width: 400px; } .minwidth500 { min-width: 500px; } @@ -1626,6 +1630,7 @@ table[summary="list_of_modules"] .fa-cog { .width125 { width: 125px; } .width150 { width: 150px; } .width200 { width: 200px; } +.width250 { width: 250px; } .width300 { width: 300px; } .width400 { width: 400px; } .width500 { width: 500px; } @@ -2007,11 +2012,12 @@ td.showDragHandle { z-index: 1005; } -global->THEME_DARKMODEENABLED)) { ?> -.side-nav-vert { - border-bottom: 1px solid #888; + +@media screen and (prefers-color-scheme: dark) { + .side-nav-vert { + border-bottom: 1px solid #888; + } } - .side-nav { /*display: block; @@ -5428,6 +5434,10 @@ td.cal_other_month { opacity: 0.8; } +td.event-past span { + opacity: 0.5; +} + /* ============================================================================== */ @@ -7528,6 +7538,14 @@ div.clipboardCPValue.hidewithsize { { .imgopensurveywizard, .imgautosize { width:95%; height: auto; } + .fiche > .listactionsfilter .table-fiche-title .col-title .titre { + display: none; + } + + .navselectiondate { + width: 220px; + } + #tooltip { position: absolute; width: px; diff --git a/htdocs/theme/eldy/info-box.inc.php b/htdocs/theme/eldy/info-box.inc.php index 9c1f3b443ef..5c010e21e26 100644 --- a/htdocs/theme/eldy/info-box.inc.php +++ b/htdocs/theme/eldy/info-box.inc.php @@ -491,10 +491,12 @@ if (GETPOSTISSET('THEME_SATURATE_RATIO')) { min-width: 350px; max-width: 350px; } + /**for make a checkbox in the right of the box in mode kanban */ .fright { float:right; } + @media only screen and (max-width: 1740px) { .info-box-module { min-width: 315px; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 39f6858570a..afc43936695 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1824,6 +1824,7 @@ tr.nobottom td { .minwidth100 { min-width: 100px; } .minwidth150 { min-width: 150px; } .minwidth200 { min-width: 200px; } + .minwidth250 { min-width: 250px; } .minwidth300 { min-width: 300px; } .minwidth400 { min-width: 400px; } .minwidth500 { min-width: 500px; } @@ -1847,6 +1848,7 @@ tr.nobottom td { .width125 { width: 125px; } .width150 { width: 150px; } .width200 { width: 200px; } +.width250 { width: 250px; } .width300 { width: 300px; } .width400 { width: 400px; } .width500 { width: 500px; } diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index ece50e0c6dd..d390fd6f351 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -280,7 +280,7 @@ class Ticket extends CommonObject 'type_code' => array('type'=>'varchar(32)', 'label'=>'Type', 'visible'=>1, 'enabled'=>1, 'position'=>20, 'notnull'=>-1, 'help'=>"", 'csslist'=>'maxwidth125 tdoverflowmax50'), 'category_code' => array('type'=>'varchar(32)', 'label'=>'TicketCategory', 'visible'=>-1, 'enabled'=>1, 'position'=>21, 'notnull'=>-1, 'help'=>"", 'css'=>'maxwidth100 tdoverflowmax200'), 'severity_code' => array('type'=>'varchar(32)', 'label'=>'Severity', 'visible'=>1, 'enabled'=>1, 'position'=>22, 'notnull'=>-1, 'help'=>"", 'css'=>'maxwidth100'), - 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>'$conf->societe->enabled', 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>1, 'help'=>"OrganizationEventLinkToThirdParty", 'css'=>'tdoverflowmax150 maxwidth150onsmartphone'), + 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>'isModEnabled("societe")', 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>1, 'help'=>"OrganizationEventLinkToThirdParty", 'css'=>'tdoverflowmax150 maxwidth150onsmartphone'), 'notify_tiers_at_create' => array('type'=>'integer', 'label'=>'NotifyThirdparty', 'visible'=>-1, 'enabled'=>0, 'position'=>51, 'notnull'=>1, 'index'=>1), 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php', 'label'=>'Project', 'visible'=>-1, 'enabled'=>'$conf->project->enabled', 'position'=>52, 'notnull'=>-1, 'index'=>1, 'help'=>"LinkToProject"), //'timing' => array('type'=>'varchar(20)', 'label'=>'Timing', 'visible'=>-1, 'enabled'=>1, 'position'=>42, 'notnull'=>-1, 'help'=>""), // what is this ? @@ -2932,6 +2932,42 @@ class Ticket extends CommonObject return CommonObject::commonReplaceThirdparty($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, $selected,$arrayofselected,$obj; + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).''; + if (in_array($this->id, $arrayofselected)) { + $selected = 1; + } + $return .= ''; + if (property_exists($this, 'fk_user_assign') && !empty($this->fk_user_assign)) { + $return .= '
'.$langs->trans("AssignedTo").' : '.$this->fk_user_assign.''; + } + if (property_exists($this, 'type_code') && !empty($this->type_code)) { + $return .= '
'.$langs->trans("Type").' : '; + $return .= $langs->getLabelFromKey($this->db, 'TicketTypeShort'.$this->type_code, 'c_ticket_type', 'code', 'label', $this->type_code); + } + if (method_exists($this, 'getLibStatut')) { + $return .= '
'.$this->getLibStatut(5).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 79db9e0e73e..1d2cefaf622 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -629,6 +629,9 @@ if ($projectid > 0 || $project_ref) { $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); } @@ -740,7 +743,10 @@ $url = DOL_URL_ROOT.'/ticket/card.php?action=create'.($socid ? '&socid='.$socid if (!empty($socid)) { $url .= '&socid='.$socid; } -$newcardbutton = dolGetButtonTitle($langs->trans('NewTicket'), '', 'fa fa-plus-circle', $url, '', $user->rights->ticket->write); +$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('NewTicket'), '', 'fa fa-plus-circle', $url, '', $user->rights->ticket->write); $picto = 'ticket'; if ($socid > 0) { @@ -999,176 +1005,199 @@ while ($i < ($limit ? min($num, $limit) : $num)) { $object->setVarsFromFetchObj($obj); $object->status = $object->fk_statut; // fk_statut is deprecated - // Show here line of result - print ''; - // Action column - if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - } - 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'; - } - if (in_array($val['type'], array('timestamp'))) { - $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } - if (in_array($key, array('ref', 'fk_project'))) { - $cssforfield .= ($cssforfield ? ' ' : '').'nowraponall'; - } - if ($key == 'fk_statut' || $key == 'severity_code') { - $cssforfield .= ($cssforfield ? ' ' : '').'center'; - } - if (!empty($arrayfields['t.'.$key]['checked'])) { - print ''; - if ($key == 'fk_statut') { - print $object->getLibStatut(5); - } elseif ($key == 'subject') { - $s = $obj->subject; - print ''; - print dol_escape_htmltag($s); - print ''; - } elseif ($key == 'type_code') { - $s = $langs->getLabelFromKey($db, 'TicketTypeShort'.$object->type_code, 'c_ticket_type', 'code', 'label', $object->type_code); - print ''; - print $s; - print ''; - } elseif ($key == 'category_code') { - $s = $langs->getLabelFromKey($db, 'TicketCategoryShort'.$object->category_code, 'c_ticket_category', 'code', 'label', $object->category_code); - print ''; - print $s; - print ''; - } elseif ($key == 'severity_code') { - $s = $langs->getLabelFromKey($db, 'TicketSeverityShort'.$object->severity_code, 'c_ticket_severity', 'code', 'label', $object->severity_code); - print ''; - print $s; - print ''; - } elseif ($key == 'tms') { - print dol_print_date($db->jdate($obj->$key), 'dayhour', 'tzuser'); - } elseif ($key == 'fk_user_create') { - if ($object->fk_user_create > 0) { - if (isset($conf->cache['user'][$object->fk_user_create])) { - $user_temp = $conf->cache['user'][$object->fk_user_create]; - } else { - $user_temp = new User($db); - $user_temp->fetch($object->fk_user_create); - $conf->cache['user'][$object->fk_user_create] = $user_temp; - } - print $user_temp->getNomUrl(-1); + print $object->getKanbanView(''); + } + if ($i == (min($num, $limit) - 1)) { + print ''; + print ''; + } + } else { + // Show here line of result + print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } + 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'; + } + if (in_array($val['type'], array('timestamp'))) { + $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + } + if (in_array($key, array('ref', 'fk_project'))) { + $cssforfield .= ($cssforfield ? ' ' : '').'nowraponall'; + } + if ($key == 'fk_statut' || $key == 'severity_code') { + $cssforfield .= ($cssforfield ? ' ' : '').'center'; + } + if (!empty($arrayfields['t.'.$key]['checked'])) { + print 'trans('Late') . ' : ' . $langs->trans('TicketsDelayForFirstResponseTooLong', $conf->global->TICKET_DELAY_BEFORE_FIRST_RESPONSE), 'warning', 'style="color: red;"', false, 0, 0, '', ''); + print $cssforfield; + if ($cssforfield && array_key_exists('css', $val) && $val['css']) { + print ' '; + } + if (array_key_exists('css', $val)) { + print $val['css']; + } + if ($cssforfield || (array_key_exists('css', $val) && $val['css'])) { + print '"'; + } + print '>'; + if ($key == 'fk_statut') { + print $object->getLibStatut(5); + } elseif ($key == 'subject') { + $s = $obj->subject; + print ''; + print dol_escape_htmltag($s); + print ''; + } elseif ($key == 'type_code') { + $s = $langs->getLabelFromKey($db, 'TicketTypeShort'.$object->type_code, 'c_ticket_type', 'code', 'label', $object->type_code); + print ''; + print $s; + print ''; + } elseif ($key == 'category_code') { + $s = $langs->getLabelFromKey($db, 'TicketCategoryShort'.$object->category_code, 'c_ticket_category', 'code', 'label', $object->category_code); + print ''; + print $s; + print ''; + } elseif ($key == 'severity_code') { + $s = $langs->getLabelFromKey($db, 'TicketSeverityShort'.$object->severity_code, 'c_ticket_severity', 'code', 'label', $object->severity_code); + print ''; + print $s; + print ''; + } elseif ($key == 'tms') { + print dol_print_date($db->jdate($obj->$key), 'dayhour', 'tzuser'); + } elseif ($key == 'fk_user_create') { + if ($object->fk_user_create > 0) { + if (isset($conf->cache['user'][$object->fk_user_create])) { + $user_temp = $conf->cache['user'][$object->fk_user_create]; + } else { + $user_temp = new User($db); + $user_temp->fetch($object->fk_user_create); + $conf->cache['user'][$object->fk_user_create] = $user_temp; } - } elseif (!empty($conf->global->TICKET_DELAY_SINCE_LAST_RESPONSE) && $hour_diff > $conf->global->TICKET_DELAY_SINCE_LAST_RESPONSE) { - print " " . img_picto($langs->trans('Late') . ' : ' . $langs->trans('TicketsDelayFromLastResponseTooLong', $conf->global->TICKET_DELAY_SINCE_LAST_RESPONSE), 'warning'); + print $user_temp->getNomUrl(-1); } - } - } else { // Example: key=fk_soc, obj->key=123 val=array('type'=>'integer', ... - $tmp = explode(':', $val['type']); - if ($tmp[0] == 'integer' && !empty($tmp[1]) && class_exists($tmp[1])) { - // It is a type of an foreign field. We will try to reduce the number of fetch that the showOutputField is making. - //var_dump('eeee-'.$key.'-'.$obj->$key.'-'.$val['type']); - if ($key && $obj->$key && $val['type'] && array_key_exists($key.'-'.$obj->$key.'-'.$val['type'], $cacheofoutputfield)) { - $result = $cacheofoutputfield[$key.'-'.$obj->$key.'-'.$val['type']]; + } elseif ($key == 'fk_user_assign') { + if ($object->fk_user_assign > 0) { + if (isset($conf->cache['user'][$object->fk_user_assign])) { + $user_temp = $conf->cache['user'][$object->fk_user_assign]; + } else { + $user_temp = new User($db); + $user_temp->fetch($object->fk_user_assign); + $conf->cache['user'][$object->fk_user_assign] = $user_temp; + } + print $user_temp->getNomUrl(-1); + } + } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { + print $object->showOutputField($val, $key, $db->jdate($obj->$key), ''); + } elseif ($key == 'ref') { + print $object->showOutputField($val, $key, $obj->$key, ''); + + // display a warning on untreated tickets + $is_open = ($object->status != Ticket::STATUS_CLOSED && $object->status != Ticket::STATUS_CANCELED ); + $should_show_warning = (!empty($conf->global->TICKET_DELAY_SINCE_LAST_RESPONSE) || !empty($conf->global->TICKET_DELAY_BEFORE_FIRST_RESPONSE)); + if ($is_open && $should_show_warning) { + $date_last_msg_sent = (int) $object->date_last_msg_sent; + $hour_diff = ($now - $date_last_msg_sent) / 3600 ; + + if (!empty($conf->global->TICKET_DELAY_BEFORE_FIRST_RESPONSE && $date_last_msg_sent == 0)) { + $creation_date = $object->datec; + $hour_diff_creation = ($now - $creation_date) / 3600 ; + if ($hour_diff_creation > $conf->global->TICKET_DELAY_BEFORE_FIRST_RESPONSE) { + print " " . img_picto($langs->trans('Late') . ' : ' . $langs->trans('TicketsDelayForFirstResponseTooLong', $conf->global->TICKET_DELAY_BEFORE_FIRST_RESPONSE), 'warning', 'style="color: red;"', false, 0, 0, '', ''); + } + } elseif (!empty($conf->global->TICKET_DELAY_SINCE_LAST_RESPONSE) && $hour_diff > $conf->global->TICKET_DELAY_SINCE_LAST_RESPONSE) { + print " " . img_picto($langs->trans('Late') . ' : ' . $langs->trans('TicketsDelayFromLastResponseTooLong', $conf->global->TICKET_DELAY_SINCE_LAST_RESPONSE), 'warning'); + } + } + } else { // Example: key=fk_soc, obj->key=123 val=array('type'=>'integer', ... + $tmp = explode(':', $val['type']); + if ($tmp[0] == 'integer' && !empty($tmp[1]) && class_exists($tmp[1])) { + // It is a type of an foreign field. We will try to reduce the number of fetch that the showOutputField is making. + //var_dump('eeee-'.$key.'-'.$obj->$key.'-'.$val['type']); + if ($key && $obj->$key && $val['type'] && array_key_exists($key.'-'.$obj->$key.'-'.$val['type'], $cacheofoutputfield)) { + $result = $cacheofoutputfield[$key.'-'.$obj->$key.'-'.$val['type']]; + } else { + $result = $object->showOutputField($val, $key, $obj->$key, ''); + $cacheofoutputfield[$key.'-'.$obj->$key.'-'.$val['type']] = $result; + } } else { $result = $object->showOutputField($val, $key, $obj->$key, ''); - $cacheofoutputfield[$key.'-'.$obj->$key.'-'.$val['type']] = $result; } - } else { - $result = $object->showOutputField($val, $key, $obj->$key, ''); + print $result; } - print $result; - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - if (!empty($val['isameasure']) && $val['isameasure'] == 1) { + print ''; 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 - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; + } + if (!$i) { + $totalarray['nbfield']++; } - print ''; - } - if (!$i) { - $totalarray['nbfield']++; - } - print ''."\n"; + print ''."\n"; + } $i++; } diff --git a/htdocs/user/agenda_extsites.php b/htdocs/user/agenda_extsites.php index 4891480cc2d..3b9ebd007f6 100644 --- a/htdocs/user/agenda_extsites.php +++ b/htdocs/user/agenda_extsites.php @@ -170,10 +170,13 @@ if ($user->rights->user->user->lire || $user->admin) { $linkback = ''.$langs->trans("BackToList").''; } -$morehtmlref = ''; +$morehtmlref = ''; $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"'); $morehtmlref .= ''; +$urltovirtualcard = '/user/virtualcard.php?id='.((int) $object->id); +$morehtmlref .= dolButtonToOpenUrlInDialogPopup('publicvirtualcard', $langs->trans("PublicVirtualCardUrl").' - '.$object->getFullName($langs), img_picto($langs->trans("PublicVirtualCardUrl"), 'card', 'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard, '', 'nohover'); + dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin, 'rowid', 'ref', $morehtmlref); diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index fb795ecc6e4..7040add3950 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -350,10 +350,13 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac $linkback = ''.$langs->trans("BackToList").''; } - $morehtmlref = ''; + $morehtmlref = ''; $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"'); $morehtmlref .= ''; + $urltovirtualcard = '/user/virtualcard.php?id='.((int) $object->id); + $morehtmlref .= dolButtonToOpenUrlInDialogPopup('publicvirtualcard', $langs->trans("PublicVirtualCardUrl").' - '.$object->getFullName($langs), img_picto($langs->trans("PublicVirtualCardUrl"), 'card', 'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard, '', 'nohover'); + dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin, 'rowid', 'ref', $morehtmlref); print '
'; diff --git a/htdocs/user/card.php b/htdocs/user/card.php index e7d001b1041..264e06f70da 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -71,6 +71,10 @@ $group = GETPOST("group", "int", 3); $cancel = GETPOST('cancel', 'alpha'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'useracard'; // To manage different context of search +if (empty($id)) { + $id = $user->id; +} + $dateemployment = dol_mktime(0, 0, 0, GETPOST('dateemploymentmonth', 'int'), GETPOST('dateemploymentday', 'int'), GETPOST('dateemploymentyear', 'int')); $dateemploymentend = dol_mktime(0, 0, 0, GETPOST('dateemploymentendmonth', 'int'), GETPOST('dateemploymentendday', 'int'), GETPOST('dateemploymentendyear', 'int')); $datestartvalidity = dol_mktime(0, 0, 0, GETPOST('datestartvaliditymonth', 'int'), GETPOST('datestartvalidityday', 'int'), GETPOST('datestartvalidityyear', 'int')); @@ -375,6 +379,7 @@ if (empty($reshook)) { $editgroup->oldcopy = clone $editgroup; $object->fetch($id); + if ($action == 'addgroup') { $result = $object->SetInGroup($group, $editgroup->entity); } @@ -516,7 +521,14 @@ if (empty($reshook)) { } if (!$error) { - $ret = $object->update($user); + $passwordismodified = 0; + if (!empty($object->pass)) { + if ($object->pass != $object->pass_indatabase && !dol_verifyHash($object->pass, $object->pass_indatabase_crypted)) { + $passwordismodified = 1; + } + } + + $ret = $object->update($user); // This may include call to setPassword if password has changed if ($ret < 0) { $error++; if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { @@ -610,6 +622,13 @@ if (empty($reshook)) { $langs->load("errors"); setEventMessages($langs->transnoentitiesnoconv("WarningYourLoginWasModifiedPleaseLogin"), null, 'warnings'); } + if ($passwordismodified && $object->login == $user->login) { // Current user has changed its password + $error++; + $langs->load("errors"); + setEventMessages($langs->transnoentitiesnoconv("WarningYourPasswordWasModifiedPleaseLogin"), null, 'warnings'); + header("Location: ".DOL_URL_ROOT.'/user/card.php?id='.$object->id); + exit; + } } else { $db->rollback(); } @@ -1018,7 +1037,10 @@ if ($action == 'create' || $action == 'adduserldap') { $valuetoshow .= preg_replace('/./i', '*', $ldap_pass); } else { // We do not use a field password but a field text to show new password to use. - $valuetoshow .= ($valuetoshow ? ' + '.$langs->trans("DolibarrPassword") : '').''; + $valuetoshow .= ($valuetoshow ? ' + '.$langs->trans("DolibarrPassword") : '').''; + if (!empty($conf->use_javascript_ajax)) { + $valuetoshow .= ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_password" class="linkobject"'); + } } } @@ -1039,7 +1061,7 @@ if ($action == 'create' || $action == 'adduserldap') { //$generated_password = getRandomPassword(false); print '
'; print ''; print "\n"; @@ -1543,7 +1565,7 @@ if ($action == 'create' || $action == 'adduserldap') { if (!empty($object->fk_user_holiday_validator)) { $hvuser = new User($db); $hvuser->fetch($object->fk_user_holiday_validator); - print $hvuser->getNomUrl(1); + print $hvuser->getNomUrl(-1); } print ''; print "\n"; @@ -2258,7 +2280,7 @@ if ($action == 'create' || $action == 'adduserldap') { print ''; $huser = new User($db); $huser->fetch($object->fk_user); - print $huser->getNomUrl(1); + print $huser->getNomUrl(-1); } print ''; print "\n"; @@ -2276,7 +2298,7 @@ if ($action == 'create' || $action == 'adduserldap') { print ''; $evuser = new User($db); $evuser->fetch($object->fk_user_expense_validator); - print $evuser->getNomUrl(1); + print $evuser->getNomUrl(-1); } print ''; print "\n"; @@ -2295,7 +2317,7 @@ if ($action == 'create' || $action == 'adduserldap') { print ''; $hvuser = new User($db); $hvuser->fetch($object->fk_user_holiday_validator); - print $hvuser->getNomUrl(1); + print $hvuser->getNomUrl(-1); } print ''; print "\n"; @@ -2387,7 +2409,7 @@ if ($action == 'create' || $action == 'adduserldap') { } if (preg_match('/dolibarr/', $dolibarr_main_authentication)) { if ($caneditpassword) { - $valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').''; + $valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').''; } else { $valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').preg_replace('/./i', '*', $object->pass); } @@ -2464,6 +2486,7 @@ if ($action == 'create' || $action == 'adduserldap') { // Country print '\n"; // Office fax print '\n"; // User mobile print '\n"; + // User mobile + print '\n"; + // Social networks print '\n"; + // Address + print '\n"; + // Company name print '\n"; diff --git a/htdocs/variants/class/ProductAttribute.class.php b/htdocs/variants/class/ProductAttribute.class.php index f89adcce0f8..74ff3fe238c 100644 --- a/htdocs/variants/class/ProductAttribute.class.php +++ b/htdocs/variants/class/ProductAttribute.class.php @@ -919,7 +919,7 @@ class ProductAttribute extends CommonObject $parameters = array('rowid' => $rowid, 'position' => $position); $action = ''; $reshook = $hookmanager->executeHooks('afterPositionOfAttributeUpdate', $parameters, $this, $action); - return 1; + return ($reshook >= 0 ? 1 : -1); } } diff --git a/htdocs/variants/tpl/productattributevalueline_edit.tpl.php b/htdocs/variants/tpl/productattributevalueline_edit.tpl.php index 3b842962258..60fc81c7418 100644 --- a/htdocs/variants/tpl/productattributevalueline_edit.tpl.php +++ b/htdocs/variants/tpl/productattributevalueline_edit.tpl.php @@ -54,7 +54,7 @@ $coldisplay++; ref); ?>"> $line); + $parameters = array('line' => $line); $reshook = $hookmanager->executeHooks('formEditProductOptions', $parameters, $object, $action); if (!empty($hookmanager->resPrint)) { print $hookmanager->resPrint; diff --git a/htdocs/webhook/target_card.php b/htdocs/webhook/target_card.php index 83f2008703f..a35f04d0138 100644 --- a/htdocs/webhook/target_card.php +++ b/htdocs/webhook/target_card.php @@ -430,7 +430,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $parameters = array(); $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + } if (empty($reshook)) $object->formAddObjectLine(1, $mysoc, $soc); } diff --git a/qodana.yaml b/qodana.yaml index 89cc459fdfa..44da591f9de 100644 --- a/qodana.yaml +++ b/qodana.yaml @@ -1,6 +1,6 @@ version: "1.0" linter: jetbrains/qodana-php:2022.3-eap -failThreshold: 0 +failThreshold: 20000 profile: name: qodana.recommended exclude: diff --git a/scripts/emailings/mailing-send.php b/scripts/emailings/mailing-send.php index ec1fbd293d6..cf3f1897638 100755 --- a/scripts/emailings/mailing-send.php +++ b/scripts/emailings/mailing-send.php @@ -71,6 +71,8 @@ if (empty($conf->global->MAILING_LIMIT_SENDBYCLI)) { $conf->global->MAILING_LIMIT_SENDBYCLI = 0; } +$langs->loadLangs(array("main", "mails")); + /* * Main diff --git a/test/phpunit/UserTest.php b/test/phpunit/UserTest.php index f318ae4cbac..9963007af15 100644 --- a/test/phpunit/UserTest.php +++ b/test/phpunit/UserTest.php @@ -204,7 +204,7 @@ class UserTest extends PHPUnit\Framework\TestCase $newlocalobject=new User($this->savdb); $newlocalobject->initAsSpecimen(); $this->changeProperties($newlocalobject); - $this->assertEquals($this->objCompare($localobject, $newlocalobject, true, array('id','socid','societe_id','specimen','note','ref','pass','pass_indatabase','pass_indatabase_crypted','pass_temp','datec','datem','datelastlogin','datepreviouslogin','iplastlogin','ippreviouslogin','trackid')), array()); // Actual, Expected + $this->assertEquals($this->objCompare($localobject, $newlocalobject, true, array('id','socid','societe_id','specimen','note','ref','pass','pass_indatabase','pass_indatabase_crypted','pass_temp','datec','datem','datelastlogin','datepreviouslogin','flagdelsessionsbefore','iplastlogin','ippreviouslogin','trackid')), array()); // Actual, Expected return $localobject; }
 '; $searchpicto = $form->showFilterButtons(); @@ -1062,6 +1094,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third $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; + print '
'; print '
'; } + $recuitment = new RecruitmentJobPosition($db); + $recuitment->fetch($obj->fk_recruitmentjobposition); + $object->fk_recruitmentjobposition = $recuitment->getNomUrl(); + $object->phone = $obj->phone; // Output Kanban - print $object->getKanbanView(''); + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + if ($massactionbutton || $massaction) { + $selected = 0; + } + // Output Kanban + print $object->getKanbanView(''); + } if ($i == ($imaxinloop - 1)) { print '
'; print '
'; print '
'; } - // Output Kanban - print $object->getKanbanView(''); + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + if ($massactionbutton || $massaction) { + $selected = 0; + } + // Output Kanban + print $object->getKanbanView(''); + } if ($i == ($imaxinloop - 1)) { print '
'; print '
'; $liststatus = array('0' => $langs->trans("Unpaid"), '1' => $langs->trans("Paid")); print $form->selectarray('search_status', $liststatus, $search_status, 1, 0, 0, '', 0, 0, 0, '', 'search_status width100 onrightofpage'); @@ -528,127 +538,144 @@ while ($i < ($limit ? min($num, $limit) : $num)) { $userstatic->login = $obj->login; $userstatic->email = $obj->email; $userstatic->socid = $obj->fk_soc; - $userstatic->statut = $obj->status; + $userstatic->statut = $obj->status; // deprecated + $userstatic->status = $obj->status; + $userstatic->photo = $obj->photo; $salstatic->id = $obj->rowid; $salstatic->ref = $obj->rowid; $salstatic->label = $obj->label; $salstatic->paye = $obj->paye; - $salstatic->datesp = $db->jdate($obj->datesp); - $salstatic->dateep = $db->jdate($obj->dateep); + $salstatic->datesp = $obj->datesp; + $salstatic->dateep = $obj->dateep; + $salstatic->amount = $obj->amount; + $salstatic->fk_user = $userstatic->getNomUrl(1); + $salstatic->type_payment = $obj->payment_code; - // Show here line of result - print '
'; + print '
'; + } + // Output Kanban + print $salstatic->getKanbanView(''); + if ($i == (min($num, $limit) - 1)) { + print '
'; + print '
".$salstatic->getNomUrl(1)."".$salstatic->getNomUrl(1)."'.dol_escape_htmltag($obj->label)."'.dol_escape_htmltag($obj->label)."'.dol_print_date($db->jdate($obj->datesp), 'day')."'.dol_print_date($db->jdate($obj->datesp), 'day')."'.dol_print_date($db->jdate($obj->dateep), 'day')."'.dol_print_date($db->jdate($obj->dateep), 'day')."'.$userstatic->getNomUrl(1)."'.$userstatic->getNomUrl(-1)."'; - if (!empty($obj->payment_code)) print $langs->trans("PaymentTypeShort".$obj->payment_code); - print ''; - if ($obj->fk_account > 0) { - //$accountstatic->fetch($obj->fk_bank); - $accountstatic->id = $obj->bid; - $accountstatic->ref = $obj->bref; - $accountstatic->label = $obj->blabel; - $accountstatic->number = $obj->bnumber; - $accountstatic->iban = $obj->iban; - $accountstatic->bic = $obj->bic; - $accountstatic->currency_code = $langs->trans("Currency".$obj->currency_code); - $accountstatic->account_number = $obj->account_number; - $accountstatic->clos = $obj->clos; + if (!empty($obj->payment_code)) print $langs->trans("PaymentTypeShort".$obj->payment_code); + print ''; + if ($obj->fk_account > 0) { + //$accountstatic->fetch($obj->fk_bank); + $accountstatic->id = $obj->bid; + $accountstatic->ref = $obj->bref; + $accountstatic->label = $obj->blabel; + $accountstatic->number = $obj->bnumber; + $accountstatic->iban = $obj->iban; + $accountstatic->bic = $obj->bic; + $accountstatic->currency_code = $langs->trans("Currency".$obj->currency_code); $accountstatic->account_number = $obj->account_number; + $accountstatic->clos = $obj->clos; - $accountingjournal = new AccountingJournal($db); - $accountingjournal->fetch($obj->fk_accountancy_journal); + if (isModEnabled('accounting')) { + $accountstatic->account_number = $obj->account_number; - $accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1); + $accountingjournal = new AccountingJournal($db); + $accountingjournal->fetch($obj->fk_accountancy_journal); + + $accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1); + } + //$accountstatic->label = $obj->blabel; + print $accountstatic->getNomUrl(1); + } else { + print ' '; } - //$accountstatic->label = $obj->blabel; - print $accountstatic->getNomUrl(1); - } else { - print ' '; + print ''.price($obj->amount).''.$salstatic->LibStatut($obj->paye, 5, $obj->alreadypayed).''; + 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 ''; } print '
'.price($obj->amount).''.$salstatic->LibStatut($obj->paye, 5, $obj->alreadypayed).''; - 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 ''; - } - print '
".$paymentsalstatic->getNomUrl(1)."".$salstatic->getNomUrl(1)."".dol_trunc($obj->label, 40)."'.dol_print_date($db->jdate($obj->dateep), 'day')."
'; + print '
'; + } + // Output Kanban - // Date payment - print '
'.dol_print_date($db->jdate($obj->datep), 'dayhour', 'tzuserrel')."'.dol_print_date($db->jdate($obj->datev), 'day')."
".$paymentsalstatic->getNomUrl(1)."".$userstatic->getNomUrl(1)."'.dol_print_date($db->jdate($obj->datep), 'dayhour', 'tzuserrel')."'; - print $langs->trans("PaymentTypeShort".$obj->payment_code); - print '".$salstatic->getNomUrl(1)."'.$obj->num_payment.'".dol_trunc($obj->label, 40)."'.dol_print_date($db->jdate($obj->dateep), 'day')."'.dol_print_date($db->jdate($obj->datep), 'day')."'.dol_print_date($db->jdate($obj->datev), 'day')."".$userstatic->getNomUrl(1)."'; - $accountlinestatic->id = $obj->fk_bank; - print $accountlinestatic->getNomUrl(1); + print $langs->trans("PaymentTypeShort".$obj->payment_code); print ''; - if ($obj->fk_bank > 0) { - //$accountstatic->fetch($obj->fk_bank); - $accountstatic->id = $obj->bid; - $accountstatic->ref = $obj->bref; - $accountstatic->number = $obj->bnumber; - $accountstatic->iban = $obj->iban; - $accountstatic->bic = $obj->bic; - $accountstatic->currency_code = $langs->trans("Currency".$obj->currency_code); - $accountstatic->clos = $obj->clos; + // Chq number + print ''.$obj->num_payment.''; + $accountlinestatic->id = $obj->fk_bank; + print $accountlinestatic->getNomUrl(1); + print ''; + if ($obj->fk_bank > 0) { + //$accountstatic->fetch($obj->fk_bank); + $accountstatic->id = $obj->bid; + $accountstatic->ref = $obj->bref; + $accountstatic->number = $obj->bnumber; + $accountstatic->iban = $obj->iban; + $accountstatic->bic = $obj->bic; + $accountstatic->currency_code = $langs->trans("Currency".$obj->currency_code); + $accountstatic->clos = $obj->clos; + + if (isModEnabled('accounting')) { + $accountstatic->account_number = $obj->account_number; + + $accountingjournal = new AccountingJournal($db); + $accountingjournal->fetch($obj->fk_accountancy_journal); + + $accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1); + } + $accountstatic->label = $obj->blabel; + if ($accountstatic->id > 0) { + print $accountstatic->getNomUrl(1); + } + } else { + print ' '; } - } else { - print ' '; + print ''.price($obj->amount).''; + 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 ''; } print ''.price($obj->amount).'
'; - 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 ''; - } - print '
'.$langs->trans("Label").'
'.$langs->trans("Bank").'
'.$langs->trans("Bank").'
'; - 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 ''; + if ($mode == 'kanban') { + if ($i == 0) { + print '
'; + print '
'; } - print '
'; - - print ''; - // Picto + Ref - print ''; - // Warning - $warnornote = ''; - //if ($obj->fk_statut == 1 && $db->jdate($obj->date_valid) < ($now - $conf->supplier_proposal->warning_delay)) $warnornote .= img_warning($langs->trans("Late")); - if ($warnornote) { - print ''; + } + } else { + print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; } - // Other picto tool - print '
'; - print $objectstatic->getNomUrl(1, '', '', 0, -1, 1); - print ''; - print $warnornote; + // Output Kanban + $userstatic->fetch($obj->fk_user_author); + $objectstatic->socid = $companystatic->getNomUrl(1); + $objectstatic->user_author_id = $userstatic->getNomUrl(1); + $objectstatic->delivery_date = $obj->dp; + print $objectstatic->getKanbanView(''); + if ($i == (min($num, $limit) - 1)) { + print ''; + print '
'; + 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 ''; + } print ''; - $filename = dol_sanitizeFileName($obj->ref); - $filedir = $conf->supplier_proposal->dir_output.'/'.dol_sanitizeFileName($obj->ref); - $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid; - print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); - print '
'; + if (!empty($arrayfields['sp.ref']['checked'])) { + print '
'; - print "'; - print $companystatic->getNomUrl(1, 'supplier', 0, 0, -1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1); - print ''; - print $companystatic->name_alias; - print ''; - print $obj->town; - print ''; - print $obj->zip; - print '".$obj->state_name."'; - $tmparray = getCountry($obj->fk_pays, 'all'); - print $tmparray['label']; - print ''; - if (empty($typenArray) || !is_array($typenArray) || count($typenArray) == 0) { - $typenArray = $formcompany->typent_array(1); - } - print $typenArray[$obj->typent_code]; - print ''; - print dol_print_date($db->jdate($obj->date_valid), 'day'); - print "'; - print dol_print_date($db->jdate($obj->dp), 'day'); - print "'.price($obj->total_ht)."'.price($obj->total_tva)."'.price($obj->total_ttc)."'.$obj->multicurrency_code.' - '.$langs->trans('Currency'.$obj->multicurrency_code)."'; - $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code); - print "'.price($obj->multicurrency_total_ht)."'.price($obj->multicurrency_total_vat)."'.price($obj->multicurrency_total_ttc)."'; - if ($userstatic->id > 0) { - print $userstatic->getNomUrl(-1, '', 0, 0, 24, 1, 'login', '', 1); - } else { - print ' '; - } - print "'; - print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); - print ''; - print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); - print ''.$objectstatic->getLibStatut(5)."'; - 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 ''; + // Picto + Ref + print ''; + // Warning + $warnornote = ''; + //if ($obj->fk_statut == 1 && $db->jdate($obj->date_valid) < ($now - $conf->supplier_proposal->warning_delay)) $warnornote .= img_warning($langs->trans("Late")); + if ($warnornote) { + print ''; + } + // Other picto tool + print '
'; + print $objectstatic->getNomUrl(1, '', '', 0, -1, 1); + print ''; + print $warnornote; + print ''; + $filename = dol_sanitizeFileName($obj->ref); + $filedir = $conf->supplier_proposal->dir_output.'/'.dol_sanitizeFileName($obj->ref); + $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid; + print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); + print '
'; + + print "
'; + print $companystatic->getNomUrl(1, 'supplier', 0, 0, -1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1); + print ''; + print $companystatic->name_alias; + print ''; + print $obj->town; + print ''; + print $obj->zip; + print '".$obj->state_name."'; + $tmparray = getCountry($obj->fk_pays, 'all'); + print $tmparray['label']; + print ''; + if (empty($typenArray) || !is_array($typenArray) || count($typenArray) == 0) { + $typenArray = $formcompany->typent_array(1); + } + print $typenArray[$obj->typent_code]; + print ''; + print dol_print_date($db->jdate($obj->date_valid), 'day'); + print "'; + print dol_print_date($db->jdate($obj->dp), 'day'); + print "'.price($obj->total_ht)."'.price($obj->total_tva)."'.price($obj->total_ttc)."'.$obj->multicurrency_code.' - '.$langs->trans('Currency'.$obj->multicurrency_code)."'; + $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code); + print "'.price($obj->multicurrency_total_ht)."'.price($obj->multicurrency_total_vat)."'.price($obj->multicurrency_total_ttc)."'; + if ($userstatic->id > 0) { + print $userstatic->getNomUrl(-1, '', 0, 0, 24, 1, 'login', '', 1); + } else { + print ' '; + } + print "'; + print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); + print ''; + print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); + print ''.$objectstatic->getLibStatut(5)."'; + 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 ''; + } + print '
'; - 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 ''; + if ($mode == 'kanban') { + if ($i == 0) { + print '
'; + print '
'; } - print '
'; + 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; } - } elseif ($key == 'fk_user_assign') { - if ($object->fk_user_assign > 0) { - if (isset($conf->cache['user'][$object->fk_user_assign])) { - $user_temp = $conf->cache['user'][$object->fk_user_assign]; - } else { - $user_temp = new User($db); - $user_temp->fetch($object->fk_user_assign); - $conf->cache['user'][$object->fk_user_assign] = $user_temp; - } - print $user_temp->getNomUrl(-1); + print ''; + } + print ''; - 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; + // 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 + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + 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 ''; } - print ''; + print '
'.$langs->trans("ApiKey").''; - print ''; + print ''; if (!empty($conf->use_javascript_ajax)) { print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_api_key" class="linkobject"'); } @@ -1432,7 +1454,7 @@ if ($action == 'create' || $action == 'adduserldap') { if ($action != 'edit') { print dol_get_fiche_head($head, 'user', $title, -1, 'user'); - $morehtmlref = ''; + $morehtmlref = ''; $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard").' ('.$langs->trans("AddToContacts").')', 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"'); $morehtmlref .= ''; @@ -1509,7 +1531,7 @@ if ($action == 'create' || $action == 'adduserldap') { $huser = new User($db); if ($object->fk_user > 0) { $huser->fetch($object->fk_user); - print $huser->getNomUrl(1); + print $huser->getNomUrl(-1); } else { print ''.$langs->trans("None").''; } @@ -1527,7 +1549,7 @@ if ($action == 'create' || $action == 'adduserldap') { if (!empty($object->fk_user_expense_validator)) { $evuser = new User($db); $evuser->fetch($object->fk_user_expense_validator); - print $evuser->getNomUrl(1); + print $evuser->getNomUrl(-1); } print '
'.$form->editfieldkey('Country', 'selectcounty_id', '', $object, 0).''; + print img_picto('', 'country', 'class="pictofixedwidth"'); if ($caneditfield) { print $form->select_country((GETPOST('country_id') != '' ?GETPOST('country_id') : $object->country_id), 'country_id'); if ($user->admin) { @@ -2869,11 +2892,10 @@ if ($action == 'create' || $action == 'adduserldap') { } if (!empty($conf->api->enabled)) { - $constname = 'api_key'; - // Add button to autosuggest a key include_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; - print dolJSToSetRandomPassword($constname, 'generate_api_key'); + print dolJSToSetRandomPassword('password', 'generate_password', 0); + print dolJSToSetRandomPassword('api_key', 'generate_api_key', 1); } // End of page diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 74093af63c6..22556d3e1c2 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -276,6 +276,7 @@ class User extends CommonObject public $datelastlogin; public $datepreviouslogin; + public $flagdelsessionsbefore; public $iplastlogin; public $ippreviouslogin; public $datestartvalidity; @@ -441,6 +442,7 @@ class User extends CommonObject $sql .= " u.tms as datem,"; $sql .= " u.datelastlogin as datel,"; $sql .= " u.datepreviouslogin as datep,"; + $sql .= " u.flagdelsessionsbefore,"; $sql .= " u.iplastlogin,"; $sql .= " u.ippreviouslogin,"; $sql .= " u.datelastpassvalidation,"; @@ -575,6 +577,7 @@ class User extends CommonObject $this->datem = $this->db->jdate($obj->datem); $this->datelastlogin = $this->db->jdate($obj->datel); $this->datepreviouslogin = $this->db->jdate($obj->datep); + $this->flagdelsessionsbefore = $this->db->jdate($obj->flagdelsessionsbefore, 'gmt'); $this->iplastlogin = $obj->iplastlogin; $this->ippreviouslogin = $obj->ippreviouslogin; $this->datestartvalidity = $this->db->jdate($obj->datestartvalidity); @@ -1776,9 +1779,9 @@ class User extends CommonObject } } - if ($result > 0 && $member->fk_soc) { // If member is linked to a thirdparty + if ($result > 0 && $member->socid) { // If member is linked to a thirdparty $sql = "UPDATE ".$this->db->prefix()."user"; - $sql .= " SET fk_soc=".((int) $member->fk_soc); + $sql .= " SET fk_soc=".((int) $member->socid); $sql .= " WHERE rowid=".((int) $this->id); dol_syslog(get_class($this)."::create_from_member", LOG_DEBUG); @@ -2031,9 +2034,9 @@ class User extends CommonObject // Update password if (!empty($this->pass)) { - if ($this->pass != $this->pass_indatabase && $this->pass != $this->pass_indatabase_crypted) { + if ($this->pass != $this->pass_indatabase && !dol_verifyHash($this->pass, $this->pass_indatabase_crypted)) { // If a new value for password is set and different than the one crypted into database - $result = $this->setPassword($user, $this->pass, 0, $notrigger, $nosyncmemberpass); + $result = $this->setPassword($user, $this->pass, 0, $notrigger, $nosyncmemberpass, 0, 1); if ($result < 0) { return -5; } @@ -2243,9 +2246,10 @@ class User extends CommonObject * @param int $notrigger 1=Does not launch triggers * @param int $nosyncmember Do not synchronize linked member * @param int $passwordalreadycrypted 0=Value is cleartext password, 1=Value is crypted value. + * @param int $flagdelsessionsbefore 1=Save also the current date to ask to invalidate all other session before this date. * @return string If OK return clear password, 0 if no change (warning, you may retreive 1 instead of 0 even if password was same), < 0 if error */ - public function setPassword($user, $password = '', $changelater = 0, $notrigger = 0, $nosyncmember = 0, $passwordalreadycrypted = 0) + public function setPassword($user, $password = '', $changelater = 0, $notrigger = 0, $nosyncmember = 0, $passwordalreadycrypted = 0, $flagdelsessionsbefore = 1) { global $conf, $langs; require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; @@ -2297,6 +2301,9 @@ class User extends CommonObject $sql = "UPDATE ".$this->db->prefix()."user"; $sql .= " SET pass_crypted = '".$this->db->escape($password_crypted)."',"; $sql .= " pass_temp = null"; + if (!empty($flagdelsessionsbefore)) { + $sql .= ", flagdelsessionsbefore = '".$this->db->idate(dol_now() - 5, 'gmt')."'"; + } if (!empty($conf->global->DATABASE_PWD_ENCRYPTED)) { $sql .= ", pass = null"; } else { @@ -2647,7 +2654,11 @@ class User extends CommonObject $sql = "DELETE FROM ".$this->db->prefix()."usergroup_user"; $sql .= " WHERE fk_user = ".((int) $this->id); $sql .= " AND fk_usergroup = ".((int) $group); - $sql .= " AND entity = ".((int) $entity); + if (empty($entity)) { + $sql .= " AND entity IN (0, 1)"; // group may be in entity 0 (so $entity=0) and link with user into entity 1. + } else { + $sql .= " AND entity = ".((int) $entity); + } $result = $this->db->query($sql); if ($result) { diff --git a/htdocs/user/clicktodial.php b/htdocs/user/clicktodial.php index 562ab081ab8..d2f9452bac5 100644 --- a/htdocs/user/clicktodial.php +++ b/htdocs/user/clicktodial.php @@ -106,10 +106,13 @@ if ($id > 0) { $linkback = ''.$langs->trans("BackToList").''; } - $morehtmlref = ''; + $morehtmlref = ''; $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"'); $morehtmlref .= ''; + $urltovirtualcard = '/user/virtualcard.php?id='.((int) $object->id); + $morehtmlref .= dolButtonToOpenUrlInDialogPopup('publicvirtualcard', $langs->trans("PublicVirtualCardUrl").' - '.$object->getFullName($langs), img_picto($langs->trans("PublicVirtualCardUrl"), 'card', 'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard, '', 'nohover'); + dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin, 'rowid', 'ref', $morehtmlref); print '
'; diff --git a/htdocs/user/document.php b/htdocs/user/document.php index b607cff7f3e..f99eb9982a2 100644 --- a/htdocs/user/document.php +++ b/htdocs/user/document.php @@ -152,10 +152,13 @@ if ($object->id) { $linkback = ''.$langs->trans("BackToList").''; } - $morehtmlref = ''; + $morehtmlref = ''; $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"'); $morehtmlref .= ''; + $urltovirtualcard = '/user/virtualcard.php?id='.((int) $object->id); + $morehtmlref .= dolButtonToOpenUrlInDialogPopup('publicvirtualcard', $langs->trans("PublicVirtualCardUrl").' - '.$object->getFullName($langs), img_picto($langs->trans("PublicVirtualCardUrl"), 'card', 'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard, '', 'nohover'); + dol_banner_tab($object, 'id', $linkback, $user->hasRight("user", "user", "read") || $user->admin, 'rowid', 'ref', $morehtmlref); print '
'; diff --git a/htdocs/user/info.php b/htdocs/user/info.php index 3f5d1aea604..7804579edd5 100644 --- a/htdocs/user/info.php +++ b/htdocs/user/info.php @@ -80,10 +80,13 @@ if ($user->rights->user->user->lire || $user->admin) { $linkback = ''.$langs->trans("BackToList").''; } -$morehtmlref = ''; +$morehtmlref = ''; $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"'); $morehtmlref .= ''; +$urltovirtualcard = '/user/virtualcard.php?id='.((int) $object->id); +$morehtmlref .= dolButtonToOpenUrlInDialogPopup('publicvirtualcard', $langs->trans("PublicVirtualCardUrl").' - '.$object->getFullName($langs), img_picto($langs->trans("PublicVirtualCardUrl"), 'card', 'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard, '', 'nohover'); + dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin, 'rowid', 'ref', $morehtmlref); diff --git a/htdocs/user/note.php b/htdocs/user/note.php index 4b64a15d217..b3ee9398374 100644 --- a/htdocs/user/note.php +++ b/htdocs/user/note.php @@ -94,10 +94,13 @@ if ($id) { $linkback = ''.$langs->trans("BackToList").''; } - $morehtmlref = ''; + $morehtmlref = ''; $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"'); $morehtmlref .= ''; + $urltovirtualcard = '/user/virtualcard.php?id='.((int) $object->id); + $morehtmlref .= dolButtonToOpenUrlInDialogPopup('publicvirtualcard', $langs->trans("PublicVirtualCardUrl").' - '.$object->getFullName($langs), img_picto($langs->trans("PublicVirtualCardUrl"), 'card', 'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard, '', 'nohover'); + dol_banner_tab($object, 'id', $linkback, $user->hasRight("user", "user", "read") || $user->admin, 'rowid', 'ref', $morehtmlref); print '
'; diff --git a/htdocs/user/notify/card.php b/htdocs/user/notify/card.php index e20d7be3d9a..e63269d5fa6 100644 --- a/htdocs/user/notify/card.php +++ b/htdocs/user/notify/card.php @@ -155,10 +155,13 @@ if ($result > 0) { $linkback = ''.$langs->trans("BackToList").''; - $morehtmlref = ''; + $morehtmlref = ''; $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"'); $morehtmlref .= ''; + $urltovirtualcard = '/user/virtualcard.php?id='.((int) $object->id); + $morehtmlref .= dolButtonToOpenUrlInDialogPopup('publicvirtualcard', $langs->trans("PublicVirtualCardUrl").' - '.$object->getFullName($langs), img_picto($langs->trans("PublicVirtualCardUrl"), 'card', 'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard, '', 'nohover'); + dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin, 'rowid', 'ref', $morehtmlref, '', 0, '', '', 0, ''); print '
'; diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php index 3d2e3240ce3..ee0f1d13914 100644 --- a/htdocs/user/param_ihm.php +++ b/htdocs/user/param_ihm.php @@ -343,10 +343,13 @@ if ($action == 'edit') { $linkback = ''.$langs->trans("BackToList").''; - $morehtmlref = ''; + $morehtmlref = ''; $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"'); $morehtmlref .= ''; + $urltovirtualcard = '/user/virtualcard.php?id='.((int) $object->id); + $morehtmlref .= dolButtonToOpenUrlInDialogPopup('publicvirtualcard', $langs->trans("PublicVirtualCardUrl").' - '.$object->getFullName($langs), img_picto($langs->trans("PublicVirtualCardUrl"), 'card', 'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard, '', 'nohover'); + dol_banner_tab($object, 'id', $linkback, $user->hasRight("user", "user", "read") || $user->admin, 'rowid', 'ref', $morehtmlref); print '
'; diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index a65762b6183..23265513730 100644 --- a/htdocs/user/perms.php +++ b/htdocs/user/perms.php @@ -255,10 +255,13 @@ if ($user->hasRight("user", "user", "read") || $user->admin) { $linkback = ''.$langs->trans("BackToList").''; } -$morehtmlref = ''; +$morehtmlref = ''; $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"'); $morehtmlref .= ''; +$urltovirtualcard = '/user/virtualcard.php?id='.((int) $object->id); +$morehtmlref .= dolButtonToOpenUrlInDialogPopup('publicvirtualcard', $langs->trans("PublicVirtualCardUrl").' - '.$object->getFullName($langs), img_picto($langs->trans("PublicVirtualCardUrl"), 'card', 'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard, '', 'nohover'); + dol_banner_tab($object, 'id', $linkback, $user->hasRight("user", "user", "read") || $user->admin, 'rowid', 'ref', $morehtmlref); diff --git a/htdocs/user/vcard.php b/htdocs/user/vcard.php index 576d2b90a5b..695cd0e556e 100644 --- a/htdocs/user/vcard.php +++ b/htdocs/user/vcard.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2004-2023 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2020 Tobias Sekan * Copyright (C) 2021-2022 Anthony Berton diff --git a/htdocs/user/virtualcard.php b/htdocs/user/virtualcard.php index 8d023c2c9a9..04f8fb42030 100644 --- a/htdocs/user/virtualcard.php +++ b/htdocs/user/virtualcard.php @@ -73,7 +73,9 @@ if ($action == 'update') { $tmparray['USER_PUBLIC_HIDE_OFFICE_PHONE'] = (GETPOST('USER_PUBLIC_HIDE_OFFICE_PHONE') ? 1 : 0); $tmparray['USER_PUBLIC_HIDE_OFFICE_FAX'] = (GETPOST('USER_PUBLIC_HIDE_OFFICE_FAX') ? 1 : 0); $tmparray['USER_PUBLIC_HIDE_USER_MOBILE'] = (GETPOST('USER_PUBLIC_HIDE_USER_MOBILE') ? 1 : 0); + $tmparray['USER_PUBLIC_HIDE_BIRTH'] = (GETPOST('USER_PUBLIC_HIDE_BIRTH') ? 1 : 0); $tmparray['USER_PUBLIC_HIDE_SOCIALNETWORKS'] = (GETPOST('USER_PUBLIC_HIDE_SOCIALNETWORKS') ? 1 : 0); + $tmparray['USER_PUBLIC_HIDE_ADDRESS'] = (GETPOST('USER_PUBLIC_HIDE_ADDRESS') ? 1 : 0); $tmparray['USER_PUBLIC_HIDE_COMPANY'] = (GETPOST('USER_PUBLIC_HIDE_COMPANY') ? 1 : 0); $tmparray['USER_PUBLIC_MORE'] = (GETPOST('USER_PUBLIC_MORE') ? GETPOST('USER_PUBLIC_MORE') : ''); @@ -113,10 +115,13 @@ if ($user->rights->user->user->lire || $user->admin) { $linkback = ''.$langs->trans("BackToList").''; } -$morehtmlref = ''; +$morehtmlref = ''; $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"'); $morehtmlref .= ''; +$urltovirtualcard = '/user/virtualcard.php?id='.((int) $object->id); +$morehtmlref .= dolButtonToOpenUrlInDialogPopup('publicvirtualcard', $langs->trans("PublicVirtualCardUrl").' - '.$object->getFullName($langs), img_picto($langs->trans("PublicVirtualCardUrl"), 'card', 'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard, '', 'nohover'); + //dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin, 'rowid', 'ref', $morehtmlref); @@ -125,12 +130,6 @@ print '
'; print '
'; /* - print ''.$langs->trans("VCard").'
'; - -print ''; -print img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"'); -print ''; - print '
'; //print '
'; @@ -211,32 +210,46 @@ if (getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) { // Office phone print '
'; - print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("OfficePhone")); + print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("PhonePro")); print ''; print $form->selectyesno("USER_PUBLIC_HIDE_OFFICE_PHONE", (getDolUserInt('USER_PUBLIC_HIDE_OFFICE_PHONE', 0, $object) ? getDolUserInt('USER_PUBLIC_HIDE_OFFICE_PHONE', 0, $object) : 0), 1); print "
'; - print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("OfficeFax")); + print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("Fax")); print ''; print $form->selectyesno("USER_PUBLIC_HIDE_OFFICE_FAX", (getDolUserInt('USER_PUBLIC_HIDE_OFFICE_FAX', 0, $object) ? getDolUserInt('USER_PUBLIC_HIDE_OFFICE_FAX', 0, $object) : 0), 1); print "
'; - print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("UserMobile")); + print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("PhoneMobile")); print ''; print $form->selectyesno("USER_PUBLIC_HIDE_USER_MOBILE", (getDolUserInt('USER_PUBLIC_HIDE_USER_MOBILE', 0, $object) ? getDolUserInt('USER_PUBLIC_HIDE_USER_MOBILE', 0, $object) : 0), 1); print "
'; + print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("Birthdate")); + print ''; + print $form->selectyesno("USER_PUBLIC_HIDE_BIRTH", (getDolUserInt('USER_PUBLIC_HIDE_BIRTH', 0, $object) ? getDolUserInt('USER_PUBLIC_HIDE_BIRTH', 0, $object) : 0), 1); + print "
'; - print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("SocialNetworks")); + print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("SocialNetworksInformation")); print ''; print $form->selectyesno("USER_PUBLIC_HIDE_SOCIALNETWORKS", (getDolUserInt('USER_PUBLIC_HIDE_SOCIALNETWORKS', 0, $object) ? getDolUserInt('USER_PUBLIC_HIDE_SOCIALNETWORKS', 0, $object) : 0), 1); print "
'; + print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("Address")); + print ''; + print $form->selectyesno("USER_PUBLIC_HIDE_ADDRESS", (getDolUserInt('USER_PUBLIC_HIDE_ADDRESS', 0, $object) ? getDolUserInt('USER_PUBLIC_HIDE_ADDRESS', 0, $object) : 0), 1); + print "
'; print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("CompanySection")); @@ -249,7 +262,8 @@ if (getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) { print $langs->trans("Text"); print ''; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor = new DolEditor('USER_PUBLIC_MORE', getDolUserString('USER_PUBLIC_MORE', '', $object), '', 160, 'dolibarr_notes', '', false, false, isModEnabled('fckeditor'), ROWS_5, '90%'); + $extendededitor = 0; // We force no WYSIWYG editor + $doleditor = new DolEditor('USER_PUBLIC_MORE', getDolUserString('USER_PUBLIC_MORE', '', $object), '', 160, 'dolibarr_notes', '', false, false, $extendededitor, ROWS_5, '90%'); $doleditor->Create(); print "