Merge branch 'kanbanForJob' of github.com:lamrani002/dolibarr into kanbanForJob

This commit is contained in:
Lamrani Abdel 2023-01-16 15:06:26 +01:00
commit 6c572f5dc1
204 changed files with 7890 additions and 4992 deletions

1
.gitignore vendored
View File

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

5
.idea/php.xml Normal file
View File

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

View File

@ -5,11 +5,15 @@ English Dolibarr ChangeLog
***** ChangeLog for 18.0.0 compared to 17.0.0 ***** ***** ChangeLog for 18.0.0 compared to 17.0.0 *****
NEW: PHP 8.2 compatibility:
WARNING: WARNING:
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better: 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 deprecated method "escapeunderscore()" of database handlers has been removed. You must use "escapeforlike()" instead.
* The method nb_expedition() has been renamed into countNbOfShipments() * 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).
@ -96,18 +100,18 @@ NEW: can sort and preselected best supplier price
NEW: Can use products categories to make inventory NEW: Can use products categories to make inventory
NEW: Change filter type on tickets list into a multiselect combo 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: 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: show date delivery planned on orders linked to company and product
NEW: Default values in extrafields are not more limited to 255 char. NEW: Default values in extrafields are not more limited to 255 char.
NEW: display currency in takepos menu NEW: display currency in takepos menu
NEW: Enable online signature for interventions NEW: Enable online signature for interventions
NEW: Encrypt all sensitive constants in llx_const 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: filter on reception dates (from / to) in cheque paiement card
NEW: Contracts: Default template of contract is not mandatory NEW: Contracts: Default template of contract is not mandatory
NEW: Contracts: Manage Position (Rank) on Contract Lines NEW: Contracts: Manage Position (Rank) on Contract Lines
NEW: EMail-Collector: add IMAP port setting NEW: EMail-Collector: add IMAP port setting
NEW: EMail-Collector: add a button "Test collect" NEW: EMail-Collector: add a button "Test collect"
NEW: Extrafields: field price with currency
NEW: Extrafields: support IP type in extrafields
NEW: Members: default_lang for members NEW: Members: default_lang for members
NEW: Members: Table of membership types NEW: Members: Table of membership types
NEW: Members: add free membership amounts at the membership type level NEW: Members: add free membership amounts at the membership type level
@ -127,21 +131,17 @@ 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: Templates of websites are now directories and not zip into core repo
NEW: Website: add 4 other templates in website module NEW: Website: add 4 other templates in website module
NEW: If we select another view list mode, we keep it 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: Introduce dolEncrypt and dolDecrypt to be able to encrypt data in db
NEW: Invoice - Add french mention on pdf when vat debit option is on NEW: Invoice - Add french mention on pdf when vat debit option is on
NEW: invoice export : add accounting affectation NEW: invoice export : add accounting affectation
NEW: label on products categories filter NEW: label on products categories filter
NEW: The link "add to bookmark" is always on top in the bookmark popup 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: Make module WebservicesClient deprecated. Use module WebHook instead.
NEW: manage no email with thirdparties (better for GDPR) NEW: manage no email with thirdparties (better for GDPR)
NEW: Manage VAT on all lines on purchases cycle NEW: Manage VAT on all lines on purchases cycle
NEW: manage virtual stock at a future date NEW: manage virtual stock at a future date
NEW: On a bank reconciled line, we can modify the bank receipt 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: 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: Page for mass stock transfer can be used with no source stock
NEW: parent company column and filter in invoice and order list NEW: parent company column and filter in invoice and order list
NEW: Add show "Sales rep" option for PDF NEW: Add show "Sales rep" option for PDF
@ -168,19 +168,25 @@ 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: experimental SMTP using PhpImap allowing OAuth2 authentication (need to add option MAIN_IMAP_USE_PHPIMAP)
NEW: can substitue project title in mail template NEW: can substitue project title in mail template
NEW: Supplier order list - Add column private and public note 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: The purge of files can purge only if older than a number of seconds
NEW: Update ActionComm type_code on email message ticket NEW: Update ActionComm type_code on email message ticket
NEW: VAT - Admin - Add information on deadline day for submission of VAT declaration NEW: VAT - Admin - Add information on deadline day for submission of VAT declaration
NEW: expand/collapse permissions on user permission page NEW: expand/collapse permissions on user permission page
NEW: Add the target to select attendees of event for emailings NEW: Add the target to select attendees of event for emailings
Option / Const for System:
NEW: Option PRODUCTBATCH_SHOW_WAREHOUSE_ON_SHIPMENT showing warehouse on PDF
NEW: Option PRODUIT_DESC_IN_FORM accept (desktop only or +smartphone)
NEW: MAIN_SEARCH_CATEGORY_PRODUCT_ON_LISTS const to show category customer filter
NEW: constant PROPAL_NEW_AS_SIGNED
Localisation: Localisation:
NEW: adding JAPAN Chart-of-Account and regions/departments NEW: adding JAPAN Chart-of-Account and regions/departments
NEW: adding NIF verification for Algeria NEW: adding NIF verification for Algeria
Modules Modules
NEW: Experimental module Asset NEW: Experimental module Asset
NEW: Init module bookcal
For developers or integrators: 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: #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: #21750 Added "Get lines and Post lines from BOM" at the REST Service
NEW: #22370 Modulebuilder supports 'alwayseditable' (like extrafields) 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: 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: All ajax pages have now a top_httphead()
NEW: support multilang in Civilities API
API:
NEW: Add API for the partnership module NEW: Add API for the partnership module
NEW: Add "Get lines and Post lines from BOM" in the API 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: Replace fk_categories_product with categories_product in inventory
NEW: Rewrite of SQL request. Removed the join on category (for filter on categ), replaced with a EXISTS/NOT NEW: Rewrite of SQL request. Removed the join on category (for filter on categ), replaced with a EXISTS/NOT

View File

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

View File

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

View File

@ -1154,9 +1154,10 @@ class BookKeeping extends CommonObject
* @param int $offset offset limit * @param int $offset offset limit
* @param array $filter filter array * @param array $filter filter array
* @param string $filtermode filter mode (AND or OR) * @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 * @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; global $conf;
@ -1166,6 +1167,11 @@ class BookKeeping extends CommonObject
$sql = 'SELECT'; $sql = 'SELECT';
$sql .= " t.numero_compte,"; $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.debit) as debit,";
$sql .= " SUM(t.credit) as credit"; $sql .= " SUM(t.credit) as credit";
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
@ -1191,6 +1197,8 @@ class BookKeeping extends CommonObject
} else { } else {
$sqlwhere[] = natural_search("t.code_journal", $value, 3, 1); $sqlwhere[] = natural_search("t.code_journal", $value, 3, 1);
} }
} elseif ($key == 't.reconciled_option') {
$sqlwhere[] = 't.lettering_code IS NULL';
} else { } else {
$sqlwhere[] = $key." LIKE '%".$this->db->escape($value)."%'"; $sqlwhere[] = $key." LIKE '%".$this->db->escape($value)."%'";
} }
@ -1201,7 +1209,17 @@ class BookKeeping extends CommonObject
$sql .= " AND ".implode(" ".$filtermode." ", $sqlwhere); $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)) { if (!empty($sortfield)) {
$sql .= $this->db->order($sortfield, $sortorder); $sql .= $this->db->order($sortfield, $sortorder);
@ -1219,6 +1237,9 @@ class BookKeeping extends CommonObject
$line = new BookKeepingLine(); $line = new BookKeepingLine();
$line->numero_compte = $obj->numero_compte; $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->debit = $obj->debit;
$line->credit = $obj->credit; $line->credit = $obj->credit;

View File

@ -121,26 +121,12 @@ if (($action == 'clean' || $action == 'validatehistory') && $user->hasRight('acc
if ($action == 'validatehistory') { if ($action == 'validatehistory') {
$error = 0; $error = 0;
$nbbinddone = 0; $nbbinddone = 0;
$nbbindfailed = 0;
$notpossible = 0; $notpossible = 0;
$db->begin(); $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 // 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) // 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 = "SELECT f.rowid as facid, f.ref as ref, f.datef, f.type as ftype, f.fk_facture_source,";
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,"; $sql .= " 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) { if (!$resqlupdate) {
$error++; $error++;
setEventMessages($db->lasterror(), null, 'errors'); setEventMessages($db->lasterror(), null, 'errors');
$nbbindfailed++;
break; break;
} else { } else {
$nbbinddone++; $nbbinddone++;
} }
} else { } else {
$notpossible++; $notpossible++;
$nbbindfailed++;
} }
$i++; $i++;
@ -300,7 +288,10 @@ if ($action == 'validatehistory') {
$db->rollback(); $db->rollback();
} else { } else {
$db->commit(); $db->commit();
setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, 'mesgs'); setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, ($notpossible ? 'warnings' : 'mesgs'));
if ($nbbindfailed) {
setEventMessages($langs->trans('DoManualBindingForFailedRecord', $nbbindfailed), null, 'warnings');
}
} }
} }
@ -324,7 +315,7 @@ print '</span><br>';
$y = $year_current; $y = $year_current;
$buttonbind = '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=validatehistory&token='.newToken().'">'.$langs->trans("ValidateHistory").'</a>'; $buttonbind = '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=validatehistory&token='.newToken().'">'.img_picto($langs->trans("ValidateHistory"), 'link', 'class="pictofixedwidth fa-color-unset"').$langs->trans("ValidateHistory").'</a>';
print_barre_liste(img_picto('', 'unlink', 'class="paddingright fa-color-unset"').$langs->trans("OverviewOfAmountOfLinesNotBound"), '', '', '', '', '', '', -1, '', '', 0, $buttonbind, '', 0, 1, 1); print_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, ''); //print load_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
@ -405,7 +396,17 @@ if ($resql) {
print '</td>'; print '</td>';
print '<td>'; print '<td>';
if ($row[0] == 'tobind') { 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 { } else {
print $row[1]; print $row[1];
} }
@ -420,6 +421,12 @@ if ($resql) {
print '<td class="right nowraponall amount">'; print '<td class="right nowraponall amount">';
print price($row[$i]); print price($row[$i]);
// Add link to make binding
if (!empty(price2num($row[$i]))) {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=validatehistory&year='.$y.'&validatemonth='.((int) $cursormonth).'&validateyear='.((int) $cursoryear).'&token='.newToken().'">';
print img_picto($langs->trans("ValidateHistory").' ('.$langs->trans('Month'.str_pad($cursormonth, 2, '0', STR_PAD_LEFT)).' '.$cursoryear.')', 'link', 'class="marginleft2"');
print '</a>';
}
print '</td>'; print '</td>';
} }
print '<td class="right nowraponall amount"><b>'.price($row[14]).'</b></td>'; print '<td class="right nowraponall amount"><b>'.price($row[14]).'</b></td>';
@ -558,7 +565,7 @@ print "</table>\n";
print '</div>'; print '</div>';
if ($conf->global->MAIN_FEATURES_LEVEL > 0) { // This part of code looks strange. Why showing a report that should rely on result of this step ? if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This part of code looks strange. Why showing a report that should rely on result of this step ?
print '<br>'; print '<br>';
print '<br>'; print '<br>';

View File

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

View File

@ -119,26 +119,12 @@ if (($action == 'clean' || $action == 'validatehistory') && $user->rights->accou
if ($action == 'validatehistory') { if ($action == 'validatehistory') {
$error = 0; $error = 0;
$nbbinddone = 0; $nbbinddone = 0;
$nbbindfailed = 0;
$notpossible = 0; $notpossible = 0;
$db->begin(); $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 // 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) // 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 = "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,"; $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) { if (!$resqlupdate) {
$error++; $error++;
setEventMessages($db->lasterror(), null, 'errors'); setEventMessages($db->lasterror(), null, 'errors');
$nbbindfailed++;
break; break;
} else { } else {
$nbbinddone++; $nbbinddone++;
} }
} else { } else {
$notpossible++; $notpossible++;
$nbbindfailed++;
} }
$i++; $i++;
@ -298,7 +286,10 @@ if ($action == 'validatehistory') {
$db->rollback(); $db->rollback();
} else { } else {
$db->commit(); $db->commit();
setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, 'mesgs'); setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, ($notpossible ? 'warnings' : 'mesgs'));
if ($nbbindfailed) {
setEventMessages($langs->trans('DoManualBindingForFailedRecord', $nbbindfailed), null, 'warnings');
}
} }
} }
@ -320,7 +311,7 @@ print '</span><br>';
$y = $year_current; $y = $year_current;
$buttonbind = '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=validatehistory&token='.newToken().'">'.$langs->trans("ValidateHistory").'</a>'; $buttonbind = '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=validatehistory&token='.newToken().'">'.img_picto('', 'link', 'class="paddingright fa-color-unset"').$langs->trans("ValidateHistory").'</a>';
print_barre_liste(img_picto('', 'unlink', 'class="paddingright fa-color-unset"').$langs->trans("OverviewOfAmountOfLinesNotBound"), '', '', '', '', '', '', -1, '', '', 0, $buttonbind, '', 0, 1, 1); print_barre_liste(img_picto('', 'unlink', 'class="paddingright fa-color-unset"').$langs->trans("OverviewOfAmountOfLinesNotBound"), '', '', '', '', '', '', -1, '', '', 0, $buttonbind, '', 0, 1, 1);
@ -402,14 +393,37 @@ if ($resql) {
print '</td>'; print '</td>';
print '<td>'; print '<td>';
if ($row[0] == 'tobind') { 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 { } else {
print $row[1]; print $row[1];
} }
print '</td>'; print '</td>';
for ($i = 2; $i <= 13; $i++) { for ($i = 2; $i <= 13; $i++) {
$cursormonth = (($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) + $i - 2);
if ($cursormonth > 12) {
$cursormonth -= 12;
}
$cursoryear = ($cursormonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y;
$tmp = dol_getdate(dol_get_last_day($cursoryear, $cursormonth, 'gmt'), false, 'gmt');
print '<td class="right nowraponall amount">'; print '<td class="right nowraponall amount">';
print price($row[$i]); print price($row[$i]);
// Add link to make binding
if (!empty(price2num($row[$i]))) {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=validatehistory&year='.$y.'&validatemonth='.((int) $cursormonth).'&validateyear='.((int) $cursoryear).'&token='.newToken().'">';
print img_picto($langs->trans("ValidateHistory").' ('.$langs->trans('Month'.str_pad($cursormonth, 2, '0', STR_PAD_LEFT)).' '.$cursoryear.')', 'link', 'class="marginleft2"');
print '</a>';
}
print '</td>'; print '</td>';
} }
print '<td class="right nowraponall amount"><b>'.price($row[14]).'</b></td>'; print '<td class="right nowraponall amount"><b>'.price($row[14]).'</b></td>';
@ -541,7 +555,7 @@ print "</table>\n";
print '</div>'; print '</div>';
if ($conf->global->MAIN_FEATURES_LEVEL > 0) { // This part of code looks strange. Why showing a report that should rely on result of this step ? if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This part of code looks strange. Why showing a report that should rely on result of this step ?
print '<br>'; print '<br>';
print '<br>'; print '<br>';

View File

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

View File

@ -47,6 +47,7 @@ $show_files = GETPOST('show_files', 'int');
$confirm = GETPOST('confirm', 'alpha'); $confirm = GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array'); $toselect = GETPOST('toselect', 'array');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'memberslist'; // To manage different context of search $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'memberslist'; // To manage different context of search
$mode = GETPOST('mode', 'alpha');
// Search fields // Search fields
@ -534,6 +535,9 @@ if ($search_type > 0) {
} }
$param = ''; $param = '';
if (!empty($mode)) {
$param .= '&mode='.urlencode($mode);
}
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage); $param .= '&contextpage='.urlencode($contextpage);
} }
@ -635,6 +639,8 @@ if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'pr
$massactionbutton = $form->selectMassAction('', $arrayofmassactions); $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
$newcardbutton = ''; $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')) { if ($user->hasRight('adherent', 'creer')) {
$newcardbutton .= dolGetButtonTitle($langs->trans('NewMember'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/card.php?action=create'); $newcardbutton .= dolGetButtonTitle($langs->trans('NewMember'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/card.php?action=create');
} }
@ -649,6 +655,8 @@ print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">'; print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
@ -987,6 +995,22 @@ while ($i < min($num, $limit)) {
} }
$memberstatic->company = $companyname; $memberstatic->company = $companyname;
if ($mode == 'kanban') {
if ($i == 0) {
print '<tr><td colspan="12">';
print '<div class="box-flex-container">';
}
$membertypestatic->id = $obj->type_id;
$membertypestatic->label = $obj->type;
$memberstatic->type = $membertypestatic->label;
$memberstatic->photo = $obj->photo;
// Output Kanban
print $memberstatic->getKanbanView('');
if ($i == (min($num, $limit) - 1)) {
print '</div>';
print '</td></tr>';
}
} else {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
// Action column // Action column
@ -1257,6 +1281,7 @@ while ($i < min($num, $limit)) {
} }
print '</tr>'."\n"; print '</tr>'."\n";
}
$i++; $i++;
} }

View File

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

View File

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

View File

@ -52,7 +52,7 @@ if ($action == 'setbarcodeproducton') {
$barcodenumberingmodule = GETPOST('value', 'alpha'); $barcodenumberingmodule = GETPOST('value', 'alpha');
$res = dolibarr_set_const($db, "BARCODE_PRODUCT_ADDON_NUM", $barcodenumberingmodule, 'chaine', 0, '', $conf->entity); $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)) { 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') { } elseif ($action == 'setbarcodeproductoff') {
$res = dolibarr_del_const($db, "BARCODE_PRODUCT_ADDON_NUM", $conf->entity); $res = dolibarr_del_const($db, "BARCODE_PRODUCT_ADDON_NUM", $conf->entity);
@ -62,7 +62,7 @@ if ($action == 'setbarcodethirdpartyon') {
$barcodenumberingmodule = GETPOST('value', 'alpha'); $barcodenumberingmodule = GETPOST('value', 'alpha');
$res = dolibarr_set_const($db, "BARCODE_THIRDPARTY_ADDON_NUM", $barcodenumberingmodule, 'chaine', 0, '', $conf->entity); $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)) { 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') { } elseif ($action == 'setbarcodethirdpartyoff') {
$res = dolibarr_del_const($db, "BARCODE_THIRDPARTY_ADDON_NUM", $conf->entity); $res = dolibarr_del_const($db, "BARCODE_THIRDPARTY_ADDON_NUM", $conf->entity);

View File

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

View File

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

View File

@ -498,7 +498,10 @@ if ($mode == 'feature') {
if (isset($objMod->boxes) && is_array($objMod->boxes) && count($objMod->boxes)) { if (isset($objMod->boxes) && is_array($objMod->boxes) && count($objMod->boxes)) {
$i = 0; $i = 0;
foreach ($objMod->boxes as $val) { 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++; $i++;
} }
} else { } else {

View File

@ -282,7 +282,36 @@ if ($action == 'set' && $user->admin) {
} }
header("Location: ".$_SERVER["PHP_SELF"]."?mode=".$mode.$param.($page_y ? '&page_y='.$page_y : '')); header("Location: ".$_SERVER["PHP_SELF"]."?mode=".$mode.$param.($page_y ? '&page_y='.$page_y : ''));
exit; 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;
}
@ -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; print $formconfirm;
asort($orders); asort($orders);
@ -547,6 +589,7 @@ if ($mode == 'common' || $mode == 'commonkanban') {
$moreforfilter .= '<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">'; $moreforfilter .= '<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
$moreforfilter .= $form->selectarray('search_nature', $arrayofnatures, dol_escape_htmltag($search_nature), $langs->trans('Origin'), 0, 0, '', 0, 0, 0, '', 'maxwidth250', 1); $moreforfilter .= $form->selectarray('search_nature', $arrayofnatures, dol_escape_htmltag($search_nature), $langs->trans('Origin'), 0, 0, '', 0, 0, 0, '', 'maxwidth250', 1);
$moreforfilter .= '</div>'; $moreforfilter .= '</div>';
if (getDolGlobalInt('MAIN_FEATURES_LEVEL')) { if (getDolGlobalInt('MAIN_FEATURES_LEVEL')) {
$array_version = array('stable'=>$langs->transnoentitiesnoconv("Stable")); $array_version = array('stable'=>$langs->transnoentitiesnoconv("Stable"));
if ($conf->global->MAIN_FEATURES_LEVEL < 0) { if ($conf->global->MAIN_FEATURES_LEVEL < 0) {
@ -559,11 +602,12 @@ if ($mode == 'common' || $mode == 'commonkanban') {
$array_version['development'] = $langs->trans("Development"); $array_version['development'] = $langs->trans("Development");
} }
$moreforfilter .= '<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">'; $moreforfilter .= '<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
$moreforfilter .= $form->selectarray('search_version', $array_version, $search_version, $langs->trans('Version'), 0, 0, '', 0, 0, 0, '', 'maxwidth150', 1); $moreforfilter .= $form->selectarray('search_version', $array_version, $search_version, $langs->transnoentitiesnoconv('Version'), 0, 0, '', 0, 0, 0, '', 'maxwidth150', 1);
$moreforfilter .= '</div>'; $moreforfilter .= '</div>';
} }
$array_status = array('active'=>$langs->transnoentitiesnoconv("Enabled"), 'disabled'=>$langs->transnoentitiesnoconv("Disabled"));
$moreforfilter .= '<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">'; $moreforfilter .= '<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
$moreforfilter .= $form->selectarray('search_status', array('active'=>$langs->transnoentitiesnoconv("Enabled"), 'disabled'=>$langs->transnoentitiesnoconv("Disabled")), $search_status, $langs->trans('Status'), 0, 0, '', 0, 0, 0, '', 'maxwidth150', 1); $moreforfilter .= $form->selectarray('search_status', $array_status, $search_status, $langs->transnoentitiesnoconv('Status'), 0, 0, '', 0, 0, 0, '', 'maxwidth150', 1);
$moreforfilter .= '</div>'; $moreforfilter .= '</div>';
$moreforfilter .= ' '; $moreforfilter .= ' ';
$moreforfilter .= '<div class="divsearchfield valignmiddle inline-block">'; $moreforfilter .= '<div class="divsearchfield valignmiddle inline-block">';
@ -734,15 +778,17 @@ if ($mode == 'common' || $mode == 'commonkanban') {
// Version (with picto warning or not) // Version (with picto warning or not)
$version = $objMod->getVersion(0); $version = $objMod->getVersion(0);
$versiontrans = ''; $versiontrans = '';
$warningstring = '';
if (preg_match('/development/i', $version)) { if (preg_match('/development/i', $version)) {
$versiontrans .= img_warning($langs->trans("Development"), '', 'floatleft paddingright'); $warningstring = $langs->trans("Development");
} }
if (preg_match('/experimental/i', $version)) { if (preg_match('/experimental/i', $version)) {
$versiontrans .= img_warning($langs->trans("Experimental"), '', 'floatleft paddingright'); $warningstring = $langs->trans("Experimental");
} }
if (preg_match('/deprecated/i', $version)) { 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)) { if ($objMod->isCoreOrExternalModule() == 'external' || preg_match('/development|experimental|deprecated/i', $version)) {
$versiontrans .= $objMod->getVersion(1); $versiontrans .= $objMod->getVersion(1);
} }
@ -800,12 +846,24 @@ if ($mode == 'common' || $mode == 'commonkanban') {
} else { } else {
if (!empty($objMod->warnings_unactivation[$mysoc->country_code]) && method_exists($objMod, 'alreadyUsed') && $objMod->alreadyUsed()) { if (!empty($objMod->warnings_unactivation[$mysoc->country_code]) && method_exists($objMod, 'alreadyUsed') && $objMod->alreadyUsed()) {
$codeenabledisable .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&amp;token='.newToken().'&amp;module_position='.$module_position.'&amp;action=reset_confirm&amp;confirm_message_code='.urlencode($objMod->warnings_unactivation[$mysoc->country_code]).'&amp;value='.$modName.'&amp;mode='.$mode.$param.'">'; $codeenabledisable .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&amp;token='.newToken().'&amp;module_position='.$module_position.'&amp;action=reset_confirm&amp;confirm_message_code='.urlencode($objMod->warnings_unactivation[$mysoc->country_code]).'&amp;value='.$modName.'&amp;mode='.$mode.$param.'">';
$codeenabledisable .= img_picto($langs->trans("Activated"), 'switch_on'); $codeenabledisable .= img_picto($langs->trans("Activated").($warningstring ? ' '.$warningstring : ''), 'switch_on');
$codeenabledisable .= '</a>'; $codeenabledisable .= '</a>';
if (getDolGlobalInt("MAIN_FEATURES_LEVEL") > 1) {
$codeenabledisable .= '&nbsp;';
$codeenabledisable .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&amp;token='.newToken().'&amp;module_position='.$module_position.'&amp;action=reload_confirm&amp;value='.$modName.'&amp;mode='.$mode.'&amp;confirm=yes'.$param.'">';
$codeenabledisable .= img_picto($langs->trans("Reload"), 'refresh', 'class="opacitymedium"');
$codeenabledisable .= '</a>';
}
} else { } else {
$codeenabledisable .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&amp;token='.newToken().'&amp;module_position='.$module_position.'&amp;action=reset&amp;value='.$modName.'&amp;mode='.$mode.'&amp;confirm=yes'.$param.'">'; $codeenabledisable .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&amp;token='.newToken().'&amp;module_position='.$module_position.'&amp;action=reset&amp;value='.$modName.'&amp;mode='.$mode.'&amp;confirm=yes'.$param.'">';
$codeenabledisable .= img_picto($langs->trans("Activated"), 'switch_on'); $codeenabledisable .= img_picto($langs->trans("Activated").($warningstring ? ' '.$warningstring : ''), 'switch_on');
$codeenabledisable .= '</a>'; $codeenabledisable .= '</a>';
if (getDolGlobalInt("MAIN_FEATURES_LEVEL") > 1) {
$codeenabledisable .= '&nbsp;';
$codeenabledisable .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&amp;token='.newToken().'&amp;module_position='.$module_position.'&amp;action=reload&amp;value='.$modName.'&amp;mode='.$mode.'&amp;confirm=yes'.$param.'">';
$codeenabledisable .= img_picto($langs->trans("Reload"), 'refresh', 'class="opacitymedium"');
$codeenabledisable .= '</a>';
}
} }
} }
@ -907,7 +965,7 @@ if ($mode == 'common' || $mode == 'commonkanban') {
// Output Kanban // Output Kanban
print $objMod->getKanbanView($codeenabledisable, $codetoconfig); print $objMod->getKanbanView($codeenabledisable, $codetoconfig);
} else { } else {
print '<tr class="oddeven">'."\n"; print '<tr class="oddeven'.($warningstring ? ' info-box-content-warning' : '').'">'."\n";
if (!empty($conf->global->MAIN_MODULES_SHOW_LINENUMBERS)) { if (!empty($conf->global->MAIN_MODULES_SHOW_LINENUMBERS)) {
print '<td class="width50">'.$linenum.'</td>'; print '<td class="width50">'.$linenum.'</td>';
} }
@ -941,7 +999,7 @@ if ($mode == 'common' || $mode == 'commonkanban') {
print '</td>'; print '</td>';
// Version // Version
print '<td class="center nowrap" width="120px">'; print '<td class="center nowrap" width="150px" title="'.dol_escape_htmltag(dol_string_nohtmltag($versiontrans)).'">';
if ($objMod->needUpdate) { if ($objMod->needUpdate) {
$versionTitle = $langs->trans('ModuleUpdateAvailable').' : '.$objMod->lastVersion; $versionTitle = $langs->trans('ModuleUpdateAvailable').' : '.$objMod->lastVersion;
print '<span class="badge badge-warning classfortooltip" title="'.dol_escape_htmltag($versionTitle).'">'.$versiontrans.'</span>'; print '<span class="badge badge-warning classfortooltip" title="'.dol_escape_htmltag($versionTitle).'">'.$versiontrans.'</span>';
@ -951,7 +1009,7 @@ if ($mode == 'common' || $mode == 'commonkanban') {
print "</td>\n"; print "</td>\n";
// Link enable/disable // Link enable/disable
print '<td class="center valignmiddle" width="60px">'; print '<td class="center valignmiddle left" width="60px">';
print $codeenabledisable; print $codeenabledisable;
print "</td>\n"; print "</td>\n";

View File

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

View File

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

View File

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

View File

@ -104,7 +104,7 @@ class Booking extends CommonObject
public $fields=array( 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"), '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"), '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',), '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',), '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',), 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>61, 'notnull'=>0, 'visible'=>0, 'cssview'=>'wordbreak', 'validate'=>'1',),

View File

@ -55,7 +55,7 @@ class ICal
* Read text file, icalender text file * Read text file, icalender text file
* *
* @param string $file File * @param string $file File
* @return string * @return string|null Content of remote file read or null if error
*/ */
public function read_file($file) public function read_file($file)
{ {
@ -65,7 +65,7 @@ class ICal
$tmpresult = getURLContent($file, 'GET'); $tmpresult = getURLContent($file, 'GET');
if ($tmpresult['http_code'] != 200) { if ($tmpresult['http_code'] != 200) {
$file_text = ''; $file_text = null;
$this->error = 'Error: '.$tmpresult['http_code'].' '.$tmpresult['content']; $this->error = 'Error: '.$tmpresult['http_code'].' '.$tmpresult['content'];
} else { } else {
$file_text = preg_replace("/[\r\n]{1,} /", "", $tmpresult['content']); $file_text = preg_replace("/[\r\n]{1,} /", "", $tmpresult['content']);
@ -103,17 +103,40 @@ class ICal
* Translate Calendar * 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 * @return array|string
*/ */
public function parse($uri) public function parse($uri, $usecachefile = '', $delaycache = 3600)
{ {
$this->cal = array(); // new empty array $this->cal = array(); // new empty array
$this->event_count = -1; $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 // read FILE text
if (is_null($this->file_text)) {
$this->file_text = $this->read_file($uri); $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); $this->file_text = preg_split("[\n]", $this->file_text);
// is this text vcalendar standard text ? on line 1 is BEGIN:VCALENDAR // is this text vcalendar standard text ? on line 1 is BEGIN:VCALENDAR

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -301,7 +301,7 @@ class Propal extends CommonObject
'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>20), 'ref' =>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_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), '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), '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), '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), '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 int $offset For pagination
* @param string $sortfield Sort criteria * @param string $sortfield Sort criteria
* @param string $sortorder Sort order * @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') public function liste_array($shortlist = 0, $draft = 0, $notcurrentuser = 0, $socid = 0, $limit = 0, $offset = 0, $sortfield = 'p.datep', $sortorder = 'DESC')
{ {
@ -2983,7 +2983,7 @@ class Propal extends CommonObject
* Returns an array with id and ref of related invoices * Returns an array with id and ref of related invoices
* *
* @param int $id Id propal * @param int $id Id propal
* @return array Array of invoices id * @return array|int Array of invoices id
*/ */
public function InvoiceArrayList($id) public function InvoiceArrayList($id)
{ {
@ -3914,6 +3914,41 @@ class Propal extends CommonObject
return CommonObject::commonReplaceProduct($db, $origin_id, $dest_id, $tables); return CommonObject::commonReplaceProduct($db, $origin_id, $dest_id, $tables);
} }
/**
* Return clicable link of object (with eventually picto)
*
* @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link)
* @return string HTML Code for Kanban thumb.
*/
public function getKanbanView($option = '')
{
global $langs;
$return = '<div class="box-flex-item box-flex-grow-zero">';
$return .= '<div class="info-box info-box-sm">';
$return .= '<span class="info-box-icon bg-infobox-action">';
$return .= img_picto('', $this->picto);
//$return .= '<i class="fa fa-dol-action"></i>'; // Can be image
$return .= '</span>';
$return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>';
if (property_exists($this, 'fk_project')) {
$return .= '<span class="info-box-ref"> | '.$this->fk_project.'</span>';
}
if (property_exists($this, 'author')) {
$return .= '<br><span class="info-box-label">'.$this->author.'</span>';
}
if (property_exists($this, 'total_ht')) {
$return .='<br><span class="" >'.$langs->trans("AmountHT").' : </span><span class="info-box-label amount">'.price($this->total_ht).'</span>';
}
if (method_exists($this, 'getLibStatut')) {
$return .= '<br><div class="info-box-status margintoponly">'.$this->getLibStatut(5).'</div>';
}
$return .= '</div>';
$return .= '</div>';
$return .= '</div>';
return $return;
}
} }
/** /**

View File

@ -70,6 +70,7 @@ $show_files = GETPOST('show_files', 'int');
$confirm = GETPOST('confirm', 'alpha'); $confirm = GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array'); $toselect = GETPOST('toselect', 'array');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'proposallist'; $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'proposallist';
$mode = GETPOST('mode', 'alpha');
$search_user = GETPOST('search_user', 'int'); $search_user = GETPOST('search_user', 'int');
$search_sale = GETPOST('search_sale', 'int'); $search_sale = GETPOST('search_sale', 'int');
@ -864,6 +865,9 @@ if ($resql) {
} }
$param = '&search_status='.urlencode($search_status); $param = '&search_status='.urlencode($search_status);
if (!empty($mode)) {
$param .= '&mode='.urlencode($mode);
}
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage); $param .= '&contextpage='.urlencode($contextpage);
} }
@ -1072,6 +1076,9 @@ if ($resql) {
if (!empty($socid)) { if (!empty($socid)) {
$url .= '&socid='.$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); $newcardbutton = dolGetButtonTitle($langs->trans('NewPropal'), '', 'fa fa-plus-circle', $url, '', $user->rights->propal->creer);
// Fields title search // Fields title search
@ -1085,6 +1092,7 @@ if ($resql) {
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">'; print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="mode"value="'.$mode.'">';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'propal', 0, $newcardbutton, '', $limit, 0, 0, 1); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'propal', 0, $newcardbutton, '', $limit, 0, 0, 1);
@ -1702,6 +1710,21 @@ if ($resql) {
$total_margin += $marginInfo['total_margin']; $total_margin += $marginInfo['total_margin'];
} }
if ($mode == 'kanban') {
if ($i == 0) {
print '<tr><td colspan="12">';
print '<div class="box-flex-container">';
}
// 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 '</div>';
print '</td></tr>';
}
} else {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
// Action column // Action column
@ -2269,6 +2292,7 @@ if ($resql) {
print '</tr>'."\n"; print '</tr>'."\n";
}
$i++; $i++;
} }

View File

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

View File

@ -306,7 +306,7 @@ class Commande extends CommonOrder
'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>25), 'ref' =>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_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), '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), '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_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), '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)) { if (empty($this->remise_percent)) {
$this->remise_percent = 0; $this->remise_percent = 0;
} }
if (empty($this->remise)) {
$this->remise = 0;
}
if (empty($this->info_bits)) { if (empty($this->info_bits)) {
$this->info_bits = 0; $this->info_bits = 0;
} }

View File

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

View File

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

View File

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

View File

@ -52,6 +52,7 @@ $show_files = GETPOST('show_files', 'int');
$confirm = GETPOST('confirm', 'alpha'); $confirm = GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array'); $toselect = GETPOST('toselect', 'array');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'bankaccountlist'; // To manage different context of search $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_ref = GETPOST('search_ref', 'alpha');
$search_label = GETPOST('search_label', 'alpha'); $search_label = GETPOST('search_label', 'alpha');
@ -305,6 +306,9 @@ llxHeader('', $title, $help_url);
$arrayofselected = is_array($toselect) ? $toselect : array(); $arrayofselected = is_array($toselect) ? $toselect : array();
$param = ''; $param = '';
if (!empty($mode)) {
$param .= '&mode='.urlencode($mode);
}
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage); $param .= '&contextpage='.urlencode($contextpage);
} }
@ -365,8 +369,13 @@ print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="page" value="'.$page.'">'; print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="search_status" value="'.$search_status.'">'; print '<input type="hidden" name="search_status" value="'.$search_status.'">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
$newcardbutton = dolGetButtonTitle($langs->trans('NewFinancialAccount'), '', 'fa fa-plus-circle', 'card.php?action=create', '', $user->rights->banque->configurer);
$newcardbutton = '';
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('NewFinancialAccount'), '', 'fa fa-plus-circle', 'card.php?action=create', '', $user->rights->banque->configurer);
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'bank_account', 0, $newcardbutton, '', $limit, 1); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'bank_account', 0, $newcardbutton, '', $limit, 1);
@ -584,6 +593,18 @@ foreach ($accounts as $key => $type) {
$lastcurrencycode = $objecttmp->currency_code; $lastcurrencycode = $objecttmp->currency_code;
} }
if ($mode == 'kanban') {
if ($i == 0) {
print '<tr><td colspan="12">';
print '<div class="box-flex-container">';
}
// Output Kanban
print $objecttmp->getKanbanView('');
if ($i == (min($num, $limit) - 1)) {
print '</div>';
print '</td></tr>';
}
} else {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
// Action column // Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
@ -801,7 +822,7 @@ foreach ($accounts as $key => $type) {
} else { } else {
$total[$objecttmp->currency_code] += $solde; $total[$objecttmp->currency_code] += $solde;
} }
}
$i++; $i++;
} }

View File

@ -46,6 +46,7 @@ if ($user->socid) {
} }
$optioncss = GETPOST('optioncss', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha');
$mode = GETPOST('mode', 'alpha');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$search_ref = GETPOST('search_ref', 'int'); $search_ref = GETPOST('search_ref', 'int');
@ -313,6 +314,9 @@ if ($resql) {
$total = 0; $total = 0;
$param = ''; $param = '';
if (!empty($mode)) {
$param .= '&mode='.urlencode($mode);
}
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage); $param .= '&contextpage='.urlencode($contextpage);
} }
@ -363,7 +367,10 @@ if ($resql) {
if (!empty($socid)) { if (!empty($socid)) {
$url .= '&socid='.urlencode($socid); $url .= '&socid='.urlencode($socid);
} }
$newcardbutton = dolGetButtonTitle($langs->trans('MenuNewVariousPayment'), '', 'fa fa-plus-circle', $url, '', $user->rights->banque->modifier); $newcardbutton = '';
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('MenuNewVariousPayment'), '', 'fa fa-plus-circle', $url, '', $user->rights->banque->modifier);
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
@ -376,6 +383,8 @@ if ($resql) {
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">'; print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
print_barre_liste($langs->trans("MenuVariousPayment"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'object_payment', 0, $newcardbutton, '', $limit, 0, 0, 1); print_barre_liste($langs->trans("MenuVariousPayment"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'object_payment', 0, $newcardbutton, '', $limit, 0, 0, 1);
@ -569,7 +578,28 @@ if ($resql) {
$variousstatic->id = $obj->rowid; $variousstatic->id = $obj->rowid;
$variousstatic->ref = $obj->rowid; $variousstatic->ref = $obj->rowid;
$variousstatic->label = $obj->label; $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;
$accountingaccount->fetch('', $obj->accountancy_code, 1);
$variousstatic->accountancy_code = $accountingaccount->getNomUrl(0, 0, 1, $obj->accountingaccount, 1);
if ($mode == 'kanban') {
if ($i == 0) {
print '<tr><td colspan="12">';
print '<div class="box-flex-container">';
}
// Output Kanban
print $variousstatic->getKanbanView('');
if ($i == (min($num, $limit) - 1)) {
print '</div>';
print '</td></tr>';
}
} else {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
// No // No
@ -728,7 +758,7 @@ if ($resql) {
} }
print '</tr>'."\n"; print '</tr>'."\n";
}
$i++; $i++;
} }

View File

@ -41,7 +41,7 @@ $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'cashcontrol'; // To manage different context of search $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'cashcontrol'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') $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'); $id = GETPOST('id', 'int');
// Load variable for pagination // Load variable for pagination
@ -399,10 +399,14 @@ print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">'; print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">'; print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
$permforcashfence = 1; $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); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'cash-register', 0, $newcardbutton, '', $limit, 0, 0, 1);
@ -552,6 +556,26 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
// Store properties in $object // Store properties in $object
$object->setVarsFromFetchObj($obj); $object->setVarsFromFetchObj($obj);
// show kanban result
if ($mode == 'kanban') {
if ($i == 0) {
print '<tr><td colspan="12">';
print '<div class="box-flex-container">';
}
$object->posmodule = $obj->posmodule;
$object->cash = $obj->cash;
$object->opening = $obj->opening;
$object->year_close = $obj->year_close;
$object->cheque = $obj->cheque;
print $object->getKanbanView('');
if ($i == (min($num, $limit) - 1)) {
print '</div>';
print '</td></tr>';
}
} else {
// Show here line of result // Show here line of result
$j = 0; $j = 0;
print '<tr data-rowid="'.$object->id.'" class="oddeven">'; print '<tr data-rowid="'.$object->id.'" class="oddeven">';
@ -626,7 +650,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
} }
print '</tr>'."\n"; print '</tr>'."\n";
}
$i++; $i++;
} }

View File

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

View File

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

View File

@ -169,7 +169,7 @@ class FactureRec extends CommonInvoice
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), '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), '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), '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), '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), //'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), 'remise' =>array('type'=>'double', 'label'=>'Remise', 'enabled'=>1, 'visible'=>-1, 'position'=>40),

View File

@ -5749,6 +5749,37 @@ class Facture extends CommonInvoice
return array(); return array();
} }
/**
* Return clicable link of object (with eventually picto)
*
* @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link)
* @return string HTML Code for Kanban thumb.
*/
public function getKanbanView($option = '')
{
$return = '<div class="box-flex-item box-flex-grow-zero">';
$return .= '<div class="info-box info-box-sm">';
$return .= '<span class="info-box-icon bg-infobox-action">';
$return .= img_picto('', $this->picto);
//$return .= '<i class="fa fa-dol-action"></i>'; // Can be image
$return .= '</span>';
$return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</span>';
if (property_exists($this, 'socid')) {
$return .= '<br><span class="info-box-label">'.$this->socid.'</span>';
}
if (property_exists($this, 'fk_user_author')) {
$return .= '<br><span class="info-box-label">'.$this->fk_user_author.'</span>';
}
if (method_exists($this, 'getLibStatut')) {
$return .= '<br><div class="info-box-status margintoponly">'.$this->getLibStatut(5).'</div>';
}
$return .= '</div>';
$return .= '</div>';
$return .= '</div>';
return $return;
}
} }
/** /**

View File

@ -75,6 +75,7 @@ $confirm = GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array'); $toselect = GETPOST('toselect', 'array');
$optioncss = GETPOST('optioncss', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'invoicelist'; $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'invoicelist';
$mode = GETPOST('mode', 'alpha');
if ($contextpage == 'poslist') { if ($contextpage == 'poslist') {
$optioncss = 'print'; $optioncss = 'print';
@ -974,6 +975,9 @@ if ($resql) {
} }
$param = '&socid='.urlencode($socid); $param = '&socid='.urlencode($socid);
if (!empty($mode)) {
$param .= '&mode='.urlencode($mode);
}
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage); $param .= '&contextpage='.urlencode($contextpage);
} }
@ -1185,6 +1189,9 @@ if ($resql) {
if (!empty($socid)) { if (!empty($socid)) {
$url .= '&socid='.$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")); $newcardbutton = dolGetButtonTitle($langs->trans('NewBill'), '', 'fa fa-plus-circle', $url, '', $user->hasRight("facture", "creer"));
} }
@ -1204,6 +1211,7 @@ if ($resql) {
print '<input type="hidden" name="search_status" value="'.$search_status.'">'; print '<input type="hidden" name="search_status" value="'.$search_status.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">'; print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="socid" value="'.$socid.'">'; print '<input type="hidden" name="socid" value="'.$socid.'">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
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); 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,6 +1902,21 @@ if ($resql) {
$total_margin += $marginInfo['total_margin']; $total_margin += $marginInfo['total_margin'];
} }
if ($mode == 'kanban') {
if ($i == 0) {
print '<tr><td colspan="12">';
print '<div class="box-flex-container">';
}
// 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 '</div>';
print '</td></tr>';
}
} else {
print '<tr class="oddeven"'; print '<tr class="oddeven"';
if ($contextpage == 'poslist') { if ($contextpage == 'poslist') {
print ' onclick="parent.$(\'#poslines\').load(\'invoice.php?action=history&placeid='.$obj->id.'\', function() {parent.$.colorbox.close();'; print ' onclick="parent.$(\'#poslines\').load(\'invoice.php?action=history&placeid='.$obj->id.'\', function() {parent.$.colorbox.close();';
@ -2532,7 +2555,7 @@ if ($resql) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
} }
print "</tr>\n"; print "</tr>\n";
}
$i++; $i++;
} }

View File

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

View File

@ -35,7 +35,7 @@ if ($user->socid) {
} }
$result = restrictedArea($user, 'tax', '', '', 'charges'); $result = restrictedArea($user, 'tax', '', '', 'charges');
$ltt = GETPOST("localTaxType", 'int'); $ltt = GETPOST("localTaxType", 'int');
$mode = GETPOST('mode', 'alpha');
/* /*
* View * View
@ -49,7 +49,14 @@ $url = DOL_URL_ROOT.'/compta/localtax/card.php?action=create&localTaxType='.$ltt
if (!empty($socid)) { if (!empty($socid)) {
$url .= '&socid='.$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'); 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) { while ($i < $num) {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
print '<tr class="oddeven">'; $localtax_static->label = $obj->label;
$localtax_static->id = $obj->rowid; $localtax_static->id = $obj->rowid;
$localtax_static->ref = $obj->rowid; $localtax_static->ref = $obj->rowid;
$localtax_static->datev = $obj->datev;
$localtax_static->datep = $obj->datep;
$localtax_static->amount = $obj->amount;
$total = $total + $obj->amount;
if ($mode == 'kanban') {
if ($i == 0) {
print '<tr><td colspan="12">';
print '<div class="box-flex-container">';
}
// Output Kanban
print $localtax_static->getKanbanView('');
if ($i == ($num - 1)) {
print '</div>';
print '</td></tr>';
}
} else {
print '<tr class="oddeven">';
print "<td>".$localtax_static->getNomUrl(1)."</td>\n"; print "<td>".$localtax_static->getNomUrl(1)."</td>\n";
print "<td>".dol_trunc($obj->label, 40)."</td>\n"; print "<td>".dol_trunc($obj->label, 40)."</td>\n";
print '<td class="left">'.dol_print_date($db->jdate($obj->datev), 'day')."</td>\n"; print '<td class="left">'.dol_print_date($db->jdate($obj->datev), 'day')."</td>\n";
print '<td class="left">'.dol_print_date($db->jdate($obj->datep), 'day')."</td>\n"; print '<td class="left">'.dol_print_date($db->jdate($obj->datep), 'day')."</td>\n";
$total = $total + $obj->amount;
print '<td class="right nowraponall"><span class="amount">'.price($obj->amount).'</span></td>'; print '<td class="right nowraponall"><span class="amount">'.price($obj->amount).'</span></td>';
print "</tr>\n"; print "</tr>\n";
}
$i++; $i++;
} }
print '<tr class="liste_total"><td colspan="4">'.$langs->trans("Total").'</td>'; print '<tr class="liste_total"><td colspan="4">'.$langs->trans("Total").'</td>';

View File

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

View File

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

View File

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

View File

@ -43,6 +43,7 @@ $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'directdebitcredittransferlinelist'; // To manage different context of search $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'directdebitcredittransferlinelist'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
$mode = GETPOST('mode', 'alpha');
$type = GETPOST('type', 'aZ09'); $type = GETPOST('type', 'aZ09');
@ -188,12 +189,18 @@ if ($result) {
$param = "&amp;statut=".urlencode($statut); $param = "&amp;statut=".urlencode($statut);
$param .= "&amp;search_bon=".urlencode($search_bon); $param .= "&amp;search_bon=".urlencode($search_bon);
if (!empty($mode)) {
$param .= '&mode='.urlencode($mode);
}
if ($type == 'bank-transfer') { if ($type == 'bank-transfer') {
$param .= '&amp;type=bank-transfer'; $param .= '&amp;type=bank-transfer';
} }
if ($limit > 0 && $limit != $conf->liste_limit) { if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit); $param .= '&limit='.urlencode($limit);
} }
$newcardbutton = '';
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
print"\n<!-- debut table -->\n"; print"\n<!-- debut table -->\n";
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n"; print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
@ -206,6 +213,8 @@ if ($result) {
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">'; print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
if ($type != '') { if ($type != '') {
print '<input type="hidden" name="type" value="'.$type.'">'; print '<input type="hidden" name="type" value="'.$type.'">';
} }
@ -214,7 +223,7 @@ if ($result) {
if ($type == 'bank-transfer') { if ($type == 'bank-transfer') {
$title = $langs->trans("CreditTransferLines"); $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 = ''; $moreforfilter = '';
@ -262,12 +271,27 @@ if ($result) {
$bon->id = $obj->rowid; $bon->id = $obj->rowid;
$bon->ref = $obj->ref; $bon->ref = $obj->ref;
$bon->statut = $obj->status; $bon->statut = $obj->status;
$bon->date_echeance = $obj->datec;
$bon->total = $obj->amount;
$company->id = $obj->socid; $company->id = $obj->socid;
$company->name = $obj->name; $company->name = $obj->name;
$company->email = $obj->email; $company->email = $obj->email;
$company->code_client = $obj->code_client; $company->code_client = $obj->code_client;
if ($mode == 'kanban') {
if ($i == 0) {
print '<tr><td colspan="12">';
print '<div class="box-flex-container">';
}
// Output Kanban
print $bon->getKanbanView('');
if ($i == (min($num, $limit) - 1)) {
print '</div>';
print '</td></tr>';
}
} else {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'; print '<td>';
@ -317,6 +341,7 @@ if ($result) {
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
print "</tr>\n"; print "</tr>\n";
}
$i++; $i++;
} }
} else { } else {

View File

@ -54,6 +54,8 @@ if (!$sortfield) {
} }
$optioncss = GETPOST('optioncss', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha');
$mode = GETPOST('mode', 'alpha');
// Get supervariables // Get supervariables
$statut = GETPOST('statut', 'int'); $statut = GETPOST('statut', 'int');
@ -147,6 +149,9 @@ if ($result) {
$i = 0; $i = 0;
$param = ''; $param = '';
if (!empty($mode)) {
$param .= '&mode='.urlencode($mode);
}
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage); $param .= '&contextpage='.urlencode($contextpage);
} }
@ -161,6 +166,8 @@ if ($result) {
$selectedfields = ''; $selectedfields = '';
$newcardbutton = ''; $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) { if ($usercancreate) {
$newcardbutton .= dolGetButtonTitle($langs->trans('NewStandingOrder'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/prelevement/create.php?type='.urlencode($type)); $newcardbutton .= dolGetButtonTitle($langs->trans('NewStandingOrder'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/prelevement/create.php?type='.urlencode($type));
} }
@ -176,6 +183,8 @@ if ($result) {
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">'; print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
if ($type != '') { if ($type != '') {
print '<input type="hidden" name="type" value="'.$type.'">'; print '<input type="hidden" name="type" value="'.$type.'">';
} }
@ -220,10 +229,23 @@ if ($result) {
$directdebitorder->id = $obj->rowid; $directdebitorder->id = $obj->rowid;
$directdebitorder->ref = $obj->ref; $directdebitorder->ref = $obj->ref;
$directdebitorder->datec = $obj->datec; $directdebitorder->date_echeance = $obj->datec;
$directdebitorder->amount = $obj->amount; $directdebitorder->total = $obj->amount;
$directdebitorder->statut = $obj->statut; $directdebitorder->statut = $obj->statut;
if ($mode == 'kanban') {
if ($i == 0) {
print '<tr><td colspan="12">';
print '<div class="box-flex-container">';
}
// Output Kanban
print $directdebitorder->getKanbanView('');
if ($i == (min($num, $limit) - 1)) {
print '</div>';
print '</td></tr>';
}
} else {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'; print '<td>';
@ -241,6 +263,7 @@ if ($result) {
print '<td class="right"></td>'."\n"; print '<td class="right"></td>'."\n";
print "</tr>\n"; print "</tr>\n";
}
$i++; $i++;
} }
} else { } else {

View File

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

View File

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

View File

@ -47,6 +47,8 @@ $massaction = GETPOST('massaction', 'alpha');
$confirm = GETPOST('confirm', 'alpha'); $confirm = GETPOST('confirm', 'alpha');
$optioncss = GETPOST('optioncss', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'sclist'; $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'sclist';
$mode = GETPOST('mode', 'alpha');
$search_ref = GETPOST('search_ref', 'int'); $search_ref = GETPOST('search_ref', 'int');
$search_label = GETPOST('search_label', 'alpha'); $search_label = GETPOST('search_label', 'alpha');
@ -294,6 +296,9 @@ $num = $db->num_rows($resql);
$i = 0; $i = 0;
$param = ''; $param = '';
if (!empty($mode)) {
$param .= '&mode='.urlencode($mode);
}
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage); $param .= '&contextpage='.urlencode($contextpage);
} }
@ -367,6 +372,8 @@ if ($search_date_limit_endyear) {
} }
$newcardbutton = ''; $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) { if ($user->rights->tax->charges->creer) {
$newcardbutton .= dolGetButtonTitle($langs->trans('MenuNewSocialContribution'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/sociales/card.php?action=create'); $newcardbutton .= dolGetButtonTitle($langs->trans('MenuNewSocialContribution'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/sociales/card.php?action=create');
} }
@ -382,6 +389,8 @@ print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="search_status" value="'.$search_status.'">'; print '<input type="hidden" name="search_status" value="'.$search_status.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">'; print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
$center = ''; $center = '';
@ -576,13 +585,30 @@ while ($i < min($num, $limit)) {
$chargesociale_static->ref = $obj->rowid; $chargesociale_static->ref = $obj->rowid;
$chargesociale_static->label = $obj->label; $chargesociale_static->label = $obj->label;
$chargesociale_static->type_label = $obj->type_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')) { if (isModEnabled('project')) {
$projectstatic->id = $obj->project_id; $projectstatic->id = $obj->project_id;
$projectstatic->ref = $obj->project_ref; $projectstatic->ref = $obj->project_ref;
$projectstatic->title = $obj->project_label; $projectstatic->title = $obj->project_label;
} }
if ($mode == 'kanban') {
if ($i == 0) {
print '<tr><td colspan="12">';
print '<div class="box-flex-container">';
}
// Output Kanban
$chargesociale_static->fk_project = $projectstatic->getNomUrl();
print $chargesociale_static->getKanbanView('');
if ($i == (min($num, $limit) - 1)) {
print '</div>';
print '</td></tr>';
}
} else {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
// Line number // Line number
@ -731,7 +757,7 @@ while ($i < min($num, $limit)) {
} }
print '</tr>'."\n"; print '</tr>'."\n";
}
$i++; $i++;
} }

View File

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

View File

@ -44,6 +44,7 @@ $massaction = GETPOST('massaction', 'alpha');
$confirm = GETPOST('confirm', 'alpha'); $confirm = GETPOST('confirm', 'alpha');
$optioncss = GETPOST('optioncss', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'salestaxeslist'; $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'salestaxeslist';
$mode = GETPOST('mode', 'alpha');
$search_ref = GETPOST('search_ref', 'alpha'); $search_ref = GETPOST('search_ref', 'alpha');
$search_label = GETPOST('search_label', 'alpha'); $search_label = GETPOST('search_label', 'alpha');
@ -230,6 +231,9 @@ if (!$resql) {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$param = ''; $param = '';
if (!empty($mode)) {
$param .= '&mode='.urlencode($mode);
}
if (!empty($contextpage) && $contextpage != $_SERVER['PHP_SELF']) { if (!empty($contextpage) && $contextpage != $_SERVER['PHP_SELF']) {
$param .= '&contextpage='.$contextpage; $param .= '&contextpage='.$contextpage;
} }
@ -317,7 +321,10 @@ $url = DOL_URL_ROOT.'/compta/tva/card.php?action=create';
if (!empty($socid)) { if (!empty($socid)) {
$url .= '&socid='.$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); 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; $varpage = empty($contextpage) ? $_SERVER['PHP_SELF'] : $contextpage;
@ -461,7 +468,24 @@ while ($i < min($num, $limit)) {
$tva_static->id = $obj->rowid; $tva_static->id = $obj->rowid;
$tva_static->ref = $obj->rowid; $tva_static->ref = $obj->rowid;
$tva_static->label = $obj->label; $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;
if ($mode == 'kanban') {
if ($i == 0) {
print '<tr><td colspan="12">';
print '<div class="box-flex-container">';
}
// Output Kanban
print $tva_static->getKanbanView('');
if ($i == (min($num, $limit) - 1)) {
print '</div>';
print '</td></tr>';
}
} else {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
// No // No
@ -570,6 +594,7 @@ while ($i < min($num, $limit)) {
print '<td></td>'; print '<td></td>';
print '</tr>'; print '</tr>';
}
$i++; $i++;
} }

View File

@ -1789,6 +1789,8 @@ class Contact extends CommonObject
$sql = "SELECT sc.fk_socpeople as id, sc.fk_c_type_contact"; $sql = "SELECT sc.fk_socpeople as id, sc.fk_c_type_contact";
$sql .= " FROM ".MAIN_DB_PREFIX."c_type_contact tc"; $sql .= " FROM ".MAIN_DB_PREFIX."c_type_contact tc";
$sql .= ", ".MAIN_DB_PREFIX."societe_contacts sc"; $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 .= " WHERE sc.fk_soc =".((int) $this->socid);
$sql .= " AND sc.fk_c_type_contact=tc.rowid"; $sql .= " AND sc.fk_c_type_contact=tc.rowid";
$sql .= " AND tc.element = '".$this->db->escape($element)."'"; $sql .= " AND tc.element = '".$this->db->escape($element)."'";

View File

@ -357,6 +357,9 @@ if (!empty($conf->global->THIRDPARTY_ENABLE_PROSPECTION_ON_ALTERNATIVE_ADRESSES)
$contactstatic->loadCacheOfProspStatus(); $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 // Select every potentiels, and note each potentiels which fit in search parameters
$tab_level = array(); $tab_level = array();
$sql = "SELECT code, label, sortorder"; $sql = "SELECT code, label, sortorder";
@ -692,9 +695,6 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && (
exit; exit;
} }
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
$help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:M&oacute;dulo_Empresas'; $help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:M&oacute;dulo_Empresas';
llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist'); llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist');
@ -1377,7 +1377,7 @@ while ($i < min($num, $limit)) {
if ($obj->socid) { if ($obj->socid) {
$objsoc = new Societe($db); $objsoc = new Societe($db);
$objsoc->fetch($obj->socid); $objsoc->fetch($obj->socid);
print $objsoc->getNomUrl(1); print $objsoc->getNomUrl(1, '', 100, 0, 1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1);
} else { } else {
print '&nbsp;'; print '&nbsp;';
} }

View File

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

View File

@ -232,7 +232,7 @@ class Contrat extends CommonObject
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35), '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), '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), '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_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_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), '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 ($error ? 1: 0);
} }
/**
* Return clicable link of object (with eventually picto)
*
* @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link)
* @return string HTML Code for Kanban thumb.
*/
public function getKanbanView($option = '')
{
global $langs;
$return = '<div class="box-flex-item box-flex-grow-zero">';
$return .= '<div class="info-box info-box-sm">';
$return .= '<span class="info-box-icon bg-infobox-action">';
$return .= img_picto('', $this->picto);
//$return .= '<i class="fa fa-dol-action"></i>'; // Can be image
$return .= '</span>';
$return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>';
if (property_exists($this, 'societe')) {
$return .= '<br><span class="info-box-label ">'.$this->societe.'</span>';
}
if (property_exists($this, 'date_contrat')) {
$return .= '<br><span class="opacitymedium">'.$langs->trans("DateContract").' : </span><span class="info-box-label">'.dol_print_date($this->date_contrat).'</span>';
}
if (method_exists($this, 'getLibStatut')) {
$return .= '<br><div class="info-box-status margintoponly">'.$this->getLibStatut(5).'</div>';
}
$return .= '</div>';
$return .= '</div>';
$return .= '</div>';
return $return;
}
} }

View File

@ -51,6 +51,7 @@ $show_files = GETPOST('show_files', 'int');
$confirm = GETPOST('confirm', 'alpha'); $confirm = GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array'); $toselect = GETPOST('toselect', 'array');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'contractlist'; // To manage different context of search $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_name = GETPOST('search_name', 'alpha');
$search_email = GETPOST('search_email', 'alpha'); $search_email = GETPOST('search_email', 'alpha');
@ -510,6 +511,9 @@ if ($socid > 0) {
} }
$param = ''; $param = '';
if (!empty($mode)) {
$param .= '&mode='.urlencode($mode);
}
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage); $param .= '&contextpage='.urlencode($contextpage);
} }
@ -606,7 +610,10 @@ $url = DOL_URL_ROOT.'/contrat/card.php?action=create';
if (!empty($socid)) { if (!empty($socid)) {
$url .= '&socid='.((int) $socid); $url .= '&socid='.((int) $socid);
} }
$newcardbutton = dolGetButtonTitle($langs->trans('NewContractSubscription'), '', 'fa fa-plus-circle', $url, '', $user->rights->contrat->creer); $newcardbutton = '';
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('NewContractSubscription'), '', 'fa fa-plus-circle', $url, '', $user->rights->contrat->creer);
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">'; print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
if ($optioncss != '') { if ($optioncss != '') {
@ -618,6 +625,7 @@ print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">'; print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
print_barre_liste($langs->trans("Contracts"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'contract', 0, $newcardbutton, '', $limit, 0, 0, 1); print_barre_liste($langs->trans("Contracts"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'contract', 0, $newcardbutton, '', $limit, 0, 0, 1);
@ -909,8 +917,22 @@ while ($i < min($num, $limit)) {
$socstatic->country_code = $cacheCountryIDCode[$obj->country_id]['code']; $socstatic->country_code = $cacheCountryIDCode[$obj->country_id]['code'];
$socstatic->country = $cacheCountryIDCode[$obj->country_id]['label']; $socstatic->country = $cacheCountryIDCode[$obj->country_id]['label'];
} }
//mode kanban
if ($mode == 'kanban') {
if ($i == 0) {
print '<tr><td colspan="12">';
print '<div class="box-flex-container">';
}
// Output Kanban
$contracttmp->societe = $socstatic->getNomUrl();
$contracttmp->date_contrat = $obj->date_contrat;
print $contracttmp->getKanbanView('');
if ($i == (min($num, $limit) - 1)) {
print '</div>';
print '</td></tr>';
}
} else {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
// Action column // Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
@ -1115,6 +1137,7 @@ while ($i < min($num, $limit)) {
} }
print "</tr>\n"; print "</tr>\n";
}
$i++; $i++;
} }

View File

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

View File

@ -1288,7 +1288,8 @@ abstract class CommonDocGenerator
} }
$extrafields = $this->extrafieldsCache; $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 ... // 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') { if ($extrafields->attributes[$object->table_element]['type'][$extrafieldKey] == 'link') {

View File

@ -16,6 +16,7 @@
* Copyright (C) 2018 Josep Lluís Amador <joseplluis@lliuretic.cat> * Copyright (C) 2018 Josep Lluís Amador <joseplluis@lliuretic.cat>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr> * Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2021 Grégory Blémand <gregory.blemand@atm-consulting.fr> * Copyright (C) 2021 Grégory Blémand <gregory.blemand@atm-consulting.fr>
* Copyright (C) 2023 Lenin Rivas <lenin.rivas777@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * 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 $fieldname Name of field
* @param string $alternatevalue Alternate value to use * @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) * @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; global $conf, $_POST;
// If param here has been posted, we use this value first. // If param here has been posted, we use this value first.
if (GETPOSTISSET($fieldname)) { if (GETPOSTISSET($fieldname)) {
return GETPOST($fieldname, 'alphanohtml', 3); return GETPOST($fieldname, $type, 3);
} }
if (isset($alternatevalue)) { if (isset($alternatevalue)) {

View File

@ -144,10 +144,12 @@ class DolGeoIP
return ''; return '';
} }
} else { } 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_name_v6($this->gi, $ip));
} }
return strtolower(geoip_country_code_by_addr_v6($this->gi, $ip)); return '';
} }
} }
} }

View File

@ -162,84 +162,44 @@ class HookManager
//dol_syslog(get_class($this).'::executeHooks method='.$method." action=".$action." context=".$parameters['context']); //dol_syslog(get_class($this).'::executeHooks method='.$method." action=".$action." context=".$parameters['context']);
// Define type of hook ('output' or 'addreplace'). // 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 // Init return properties

View File

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

View File

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

View File

@ -449,6 +449,15 @@ class FormFile
$titletoshow = ($title == 'none' ? '' : $title); $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 // Show table
if ($genallowed) { if ($genallowed) {
$modellist = array(); $modellist = array();
@ -648,15 +657,6 @@ class FormFile
$modellist = ModelePDFUserGroup::liste_modeles($this->db); $modellist = ModelePDFUserGroup::liste_modeles($this->db);
} }
} else { } 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 // For normalized standard modules
$file = dol_buildpath('/core/modules/'.$modulepart.'/modules_'.strtolower($submodulepart).'.php', 0); $file = dol_buildpath('/core/modules/'.$modulepart.'/modules_'.strtolower($submodulepart).'.php', 0);
if (file_exists($file)) { if (file_exists($file)) {

View File

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

View File

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

View File

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

View File

@ -31,7 +31,7 @@
*/ */
function encode($string) 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 != "") { if ($type != "") {
$key .= ";".$type; $key .= ";".$type;
} }
$key .= ";".$this->encoding; $key .= ";VALUE=uri";
$this->properties[$key] = 'VALUE=uri:tel:'.encode($number); //$key .= ";".$this->encoding;
$this->properties[$key] = 'tel:'.$number;
} }
/** /**
* mise en forme de la photo * mise en forme de la photo
* warning NON TESTE ! * warning NON TESTE !
* *
* @param string $type Type 'image/gif' * @param string $type Type 'image/jpeg' or 'JPEG'
* @param string $photo Photo * @param string $photo Photo
* @return void * @return void
*/ */
public function setPhoto($type, $photo) public function setPhoto($type, $photo)
{ {
// $type = "GIF" | "JPEG" // $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 $family Family name
* @param string $first First name * @param string $first First name
* @param string $additional Additional (e.g. second name, nick 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) * @param string $suffix Suffix (e.g. "sen." for senior, "jun." for junior)
* @return void * @return void
*/ */
public function setName($family = "", $first = "", $additional = "", $prefix = "", $suffix = "") 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"; $this->filename = "$first%20$family.vcf";
if (empty($this->properties["FN"])) { if (empty($this->properties["FN"])) {
$this->setFormattedName(trim("$prefix $first $additional $family $suffix")); $this->setFormattedName(trim("$prefix $first $additional $family $suffix"));
@ -173,12 +177,13 @@ class vCard
*/ */
public function setBirthday($date) public function setBirthday($date)
{ {
// $date format is YYYY-MM-DD - RFC 2425 and RFC 2426 // $date format is YYYY-MM-DD - RFC 2425 and RFC 2426 for vcard v3
$this->properties["BDAY"] = dol_print_date($date, 'dayrfc'); // $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 $postoffice Postoffice
* @param string $extended Extended * @param string $extended Extended
@ -191,7 +196,7 @@ class vCard
* @param string $label Label * @param string $label Label
* @return void * @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" // $type may be DOM | INTL | POSTAL | PARCEL | HOME | WORK or any combination of these: e.g. "WORK;PARCEL;POSTAL"
$key = "ADR"; $key = "ADR";
@ -202,7 +207,7 @@ class vCard
$key .= ';LABEL="'.encode($label).'"'; $key .= ';LABEL="'.encode($label).'"';
} }
$key .= ";".$this->encoding; $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] == '') { //if ($this->properties["LABEL;".$type.";".$this->encoding] == '') {
//$this->setLabel($postoffice, $extended, $street, $city, $region, $zip, $country, $type); //$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 $postoffice Postoffice
* @param string $extended Extended * @param string $extended Extended
@ -221,6 +226,7 @@ class vCard
* @param string $country Country * @param string $country Country
* @param string $type Type * @param string $type Type
* @return void * @return void
* @deprecated
*/ */
public function setLabel($postoffice = "", $extended = "", $street = "", $city = "", $region = "", $zip = "", $country = "", $type = "HOME") public function setLabel($postoffice = "", $extended = "", $street = "", $city = "", $region = "", $zip = "", $country = "", $type = "HOME")
{ {
@ -309,7 +315,7 @@ class vCard
*/ */
public function setProdId($prodid) 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) 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:4.0\r\n"; // With V4, all encoding are UTF-8
//$text.= "VERSION:2.1\r\n"; //$text.= "VERSION:2.1\r\n";
foreach ($this->properties as $key => $value) { 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 .= "MAILER: Dolibarr\r\n";
$text .= "END:VCARD\r\n"; $text .= "END:VCARD\r\n";
return $text; return $text;
@ -373,13 +380,15 @@ class vCard
/** /**
* Return a VCARD string * Return a VCARD string
* See RFC https://datatracker.ietf.org/doc/html/rfc6350
* *
* @param Object $object Object (User, Contact) * @param Object $object Object (User or Contact)
* @param Societe $company Company * @param Societe|null $company Company. May be null
* @param Translate $langs Lang object * @param Translate $langs Lang object
* @param string $urlphoto Full public URL of photo
* @return string String * @return string String
*/ */
public function buildVCardString($object, $company, $langs) public function buildVCardString($object, $company, $langs, $urlphoto = '')
{ {
global $dolibarr_main_instance_unique_id; global $dolibarr_main_instance_unique_id;
@ -389,70 +398,136 @@ class vCard
$this->setName($object->lastname, $object->firstname, "", $object->civility_code, ""); $this->setName($object->lastname, $object->firstname, "", $object->civility_code, "");
$this->setFormattedName($object->getFullName($langs, 1)); $this->setFormattedName($object->getFullName($langs, 1));
if ($urlphoto) {
$mimetype = dol_mimetype($urlphoto);
if ($mimetype) {
$this->setPhoto($mimetype, $urlphoto);
}
}
if ($object->office_phone) {
$this->setPhoneNumber($object->office_phone, "TYPE=WORK,VOICE"); $this->setPhoneNumber($object->office_phone, "TYPE=WORK,VOICE");
$this->setPhoneNumber($object->personal_mobile, "TYPE=HOME,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"); $this->setPhoneNumber($object->user_mobile, "TYPE=CELL,VOICE");
}
if ($object->office_fax) {
$this->setPhoneNumber($object->office_fax, "TYPE=WORK,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 : ''; $country = $object->country_code ? $object->country : '';
$this->setAddress("", "", $object->address, $object->town, $object->state, $object->zip, $country, "TYPE=WORK"); if ($object->address || $object->town || $object->state || $object->zip || $object->country) {
//$this->setLabel("", "", $object->address, $object->town, $object->state, $object->zip, $country, "TYPE=WORK"); $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"); $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); $this->setNote($object->note_public);
}
if ($object->job) {
$this->setTitle($object->job); $this->setTitle($object->job);
}
// For user, type=home // For user, $object->url is not defined
// For contact, this is not defined // For contact, $object->url is not defined
$this->setURL($object->url, "TYPE=HOME"); if (!empty($object->url)) {
$this->setURL($object->url, "");
}
if (is_object($company)) { if (is_object($company)) {
$this->setURL($company->url, "TYPE=WORK"); // Si user linked to a thirdparty and not a physical people
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') { if ($company->typent_code != 'TE_PRIVATE') {
$this->setOrg($company->name); $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");
} }
// Personal informations if ($company->email && $company->email != $object->email) {
$this->setPhoneNumber($object->personal_mobile, "TYPE=HOME,VOICE"); $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) { if ($object->birth) {
$this->setBirthday($object->birth); $this->setBirthday($object->birth);
} }

View File

@ -1086,9 +1086,10 @@ function purgeSessions($mysessionid)
* *
* @param string $value Name of module to activate * @param string $value Name of module to activate
* @param int $withdeps Activate/Disable also all dependencies * @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); * @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; global $db, $langs, $conf, $mysoc;
@ -1144,9 +1145,11 @@ function activateModule($value, $withdeps = 1)
} }
$const_name = $objMod->const_name; $const_name = $objMod->const_name;
if ($noconfverification == 0) {
if (!empty($conf->global->$const_name)) { if (!empty($conf->global->$const_name)) {
return $ret; return $ret;
} }
}
$result = $objMod->init(); // Enable module $result = $objMod->init(); // Enable module

View File

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

View File

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

View File

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

View File

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

View File

@ -52,12 +52,11 @@ function dol_getwebuser($mode)
* @param string $entitytotest Instance of data we must check * @param string $entitytotest Instance of data we must check
* @param array $authmode Array list of selected authentication mode array('http', 'dolibarr', 'xxx'...) * @param array $authmode Array list of selected authentication mode array('http', 'dolibarr', 'xxx'...)
* @param string $context Context checkLoginPassEntity was created for ('api', 'dav', 'ws', '') * @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 = '') function checkLoginPassEntity($usertotest, $passwordtotest, $entitytotest, $authmode, $context = '')
{ {
global $conf, $langs; global $conf, $langs;
//global $dolauthmode; // To return authentication finally used
// Check parameters // Check parameters
if ($entitytotest == '') { if ($entitytotest == '') {
@ -100,10 +99,10 @@ function checkLoginPassEntity($usertotest, $passwordtotest, $entitytotest, $auth
if ($login && $login != '--bad-login-validity--') { // Login is successfull if ($login && $login != '--bad-login-validity--') { // Login is successfull
$test = false; // To stop once at first login success $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 $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_dst = GETPOST('dst');
$dol_screenwidth = GETPOST('screenwidth'); $dol_screenwidth = GETPOST('screenwidth');
$dol_screenheight = GETPOST('screenheight'); $dol_screenheight = GETPOST('screenheight');*/
} }
} else { } else {
dol_syslog("Authentication KO - failed to load file '".$authfile."'", LOG_ERR); dol_syslog("Authentication KO - failed to load file '".$authfile."'", LOG_ERR);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -976,8 +976,8 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
$tmp = json_decode($obj->note, true); $tmp = json_decode($obj->note, true);
} }
return array( return array(
'authorid' => $tmp['authorid'], 'authorid' => empty($tmp['authorid']) ? '' : $tmp['authorid'],
'ip' => $tmp['ip'], 'ip' => empty($tmp['ip']) ? '' : $tmp['ip'],
'lastactivationdate' => $this->db->jdate($obj->tms), 'lastactivationdate' => $this->db->jdate($obj->tms),
'lastactivationversion' => (!empty($tmp['lastactivationversion']) ? $tmp['lastactivationversion'] : 'unknown'), 'lastactivationversion' => (!empty($tmp['lastactivationversion']) ? $tmp['lastactivationversion'] : 'unknown'),
); );

View File

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

View File

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

View File

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

View File

@ -832,7 +832,7 @@ class pdf_espadon extends ModelePdfExpedition
$totalToShip = $tmparray['toship']; $totalToShip = $tmparray['toship'];
// Set trueVolume and volume_units not currently stored into database // Set trueVolume and volume_units not currently stored into database
if ($object->trueWidth && $object->trueHeight && $object->trueDepth) { if ($object->trueWidth && $object->trueHeight && $object->trueDepth) {
$object->trueVolume = price(($object->trueWidth * $object->trueHeight * $object->trueDepth), 0, $outputlangs, 0, 0); $object->trueVolume = $object->trueWidth * $object->trueHeight * $object->trueDepth;
$object->volume_units = $object->size_units * 3; $object->volume_units = $object->size_units * 3;
} }

View File

@ -54,7 +54,7 @@ class modPayBox extends DolibarrModules
// Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)
$this->description = "Module to offer an online payment page by credit card with PayBox"; $this->description = "Module to offer an online payment page by credit card with PayBox";
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
$this->version = 'dolibarr'; $this->version = 'dolibarr_deprecated';
// Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
// Name of image file used for this module. // Name of image file used for this module.

View File

@ -675,11 +675,19 @@ class pdf_azur extends ModelePDFPropales
// retrieve global local tax // retrieve global local tax
if ($localtax1_type && $localtax1ligne != 0) { if ($localtax1_type && $localtax1ligne != 0) {
if (empty($this->localtax1[$localtax1_type][$localtax1_rate])) {
$this->localtax1[$localtax1_type][$localtax1_rate] = $localtax1ligne;
} else {
$this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne; $this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne;
} }
}
if ($localtax2_type && $localtax2ligne != 0) { if ($localtax2_type && $localtax2ligne != 0) {
if (empty($this->localtax2[$localtax2_type][$localtax2_rate])) {
$this->localtax2[$localtax2_type][$localtax2_rate] = $localtax2ligne;
} else {
$this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne; $this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne;
} }
}
if (($object->lines[$i]->info_bits & 0x01) == 0x01) { if (($object->lines[$i]->info_bits & 0x01) == 0x01) {
$vatrate .= '*'; $vatrate .= '*';

View File

@ -567,7 +567,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
// Total HT line // Total HT line
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_TOTAL_COLUMN)) { if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_TOTAL_COLUMN)) {
$total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs); $total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails);
$pdf->SetXY($this->postotalht, $curY); $pdf->SetXY($this->postotalht, $curY);
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalht, 3, $total_excl_tax, 0, 'R', 0); $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalht, 3, $total_excl_tax, 0, 'R', 0);
} }

View File

@ -40,7 +40,7 @@ if ($action == 'presend') {
$titreform = 'SendMail'; $titreform = 'SendMail';
$object->fetch_projet(); $object->fetch_projet();
if (!isset($file)) $file = null;
$ref = dol_sanitizeFileName($object->ref); $ref = dol_sanitizeFileName($object->ref);
if (!in_array($object->element, array('user', 'member'))) { if (!in_array($object->element, array('user', 'member'))) {
//$fileparams['fullname'] can be filled from the card //$fileparams['fullname'] can be filled from the card
@ -57,7 +57,7 @@ if ($action == 'presend') {
} }
} }
$file = $fileparams['fullname']; $file = isset($fileparams['fullname'])?$fileparams['fullname']:null;
} }
// Define output language // Define output language

View File

@ -40,6 +40,18 @@ if ($massaction == 'predelete') {
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassDeletion"), $langs->trans("ConfirmMassDeletionQuestion", count($toselect)), "delete", null, '', 0, 200, 500, 1); print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassDeletion"), $langs->trans("ConfirmMassDeletionQuestion", count($toselect)), "delete", null, '', 0, 200, 500, 1);
} }
if ($massaction == 'preclonetasks') {
$selected = '';
foreach (GETPOST('toselect') as $tmpselected) {
$selected .= '&selected[]=' . $tmpselected;
}
$formquestion = array(
array('type' => 'other', 'name' => 'projectid', 'label' => $langs->trans('Project') .': ', 'value' => $form->selectProjects('', 'projectid', '', '', '', '', '', '', '', 1, 1)),
);
print $form->formconfirm($_SERVER['PHP_SELF'] . '?id=' . $object->id . $selected . '', $langs->trans('ConfirmMassClone'), '', 'clonetasks', $formquestion, '', 1, 300, 590);
}
if ($massaction == 'preaffecttag' && isModEnabled('category')) { if ($massaction == 'preaffecttag' && isModEnabled('category')) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$categ = new Categorie($db); $categ = new Categorie($db);

View File

@ -40,6 +40,7 @@ if (empty($object) || !is_object($object)) {
print "Error: this template page cannot be called directly as an URL"; print "Error: this template page cannot be called directly as an URL";
exit; exit;
} }
$usemargins = 0; $usemargins = 0;
if (isModEnabled('margin') && !empty($object->element) && in_array($object->element, array('facture', 'facturerec', 'propal', 'commande'))) { if (isModEnabled('margin') && !empty($object->element) && in_array($object->element, array('facture', 'facturerec', 'propal', 'commande'))) {
$usemargins = 1; $usemargins = 1;
@ -48,6 +49,7 @@ if (!isset($dateSelector)) {
global $dateSelector; // Take global var only if not already defined into function calling (for example formAddObjectLine) global $dateSelector; // Take global var only if not already defined into function calling (for example formAddObjectLine)
} }
global $forceall, $forcetoshowtitlelines, $senderissupplier, $inputalsopricewithtax; global $forceall, $forcetoshowtitlelines, $senderissupplier, $inputalsopricewithtax;
global $mysoc;
if (!isset($dateSelector)) { if (!isset($dateSelector)) {
$dateSelector = 1; // For backward compatibility $dateSelector = 1; // For backward compatibility
@ -776,6 +778,35 @@ if (!empty($usemargins) && $user->rights->margins->creer) {
var stringforvatrateselection = tva_tx; var stringforvatrateselection = tva_tx;
if (typeof default_vat_code != 'undefined' && default_vat_code != null && default_vat_code != '') { if (typeof default_vat_code != 'undefined' && default_vat_code != null && default_vat_code != '') {
stringforvatrateselection = stringforvatrateselection+' ('+default_vat_code+')'; stringforvatrateselection = stringforvatrateselection+' ('+default_vat_code+')';
<?php
// Special case for India
if (getDolGlobalString('MAIN_SALETAX_AUTOSWITCH_I_CS_FOR_INDIA')) {
?>
console.log("MAIN_SALETAX_AUTOSWITCH_I_CS_FOR_INDIA is on so we check if we need to autoswith the vat code");
console.log("mysoc->country_code=<?php echo $mysoc->country_code; ?> thirdparty->country_code=<?php echo $object->thirdparty->country_code; ?>");
new_default_vat_code = default_vat_code;
<?php
if ($mysoc->country_code == 'IN' && !empty($object->thirdparty) && $object->thirdparty->country_code == 'IN' && $mysoc->state_code == $object->thirdparty->state_code) {
// We are in India and states are same, we revert the vat code "I-x" into "CS-x"
?>
console.log("Countries are both IN and states are same, so we revert I into CS in default_vat_code="+default_vat_code);
new_default_vat_code = default_vat_code.replace(/^I\-/, 'C+S-');
<?php
} elseif ($mysoc->country_code == 'IN' && !empty($object->thirdparty) && $object->thirdparty->country_code == 'IN' && $mysoc->state_code != $object->thirdparty->state_code) {
// We are in India and states differs, we revert the vat code "CS-x" into "I-x"
?>
console.log("Countries are both IN and states differs, so we revert CS into I in default_vat_code="+default_vat_code);
new_default_vat_code = default_vat_code.replace(/^C\+S\-/, 'I-');
<?php
}
?>
if (new_default_vat_code != default_vat_code && jQuery('#tva_tx option:contains("'+new_default_vat_code+'")').val()) {
console.log("We found en entry into VAT with new default_vat_code, we will use it");
stringforvatrateselection = jQuery('#tva_tx option:contains("'+new_default_vat_code+'")').val();
}
<?php
}
?>
} }
// Set vat rate if field is an input box // Set vat rate if field is an input box
$('#tva_tx').val(tva_tx); $('#tva_tx').val(tva_tx);
@ -1113,7 +1144,7 @@ if (!empty($usemargins) && $user->rights->margins->creer) {
<?php } ?> <?php } ?>
}); });
/* Function to set fields from choice */ /* Function to set fields visibility after selecting a free product */
function setforfree() { function setforfree() {
console.log("objectline_create.tpl::setforfree. We show most fields"); console.log("objectline_create.tpl::setforfree. We show most fields");
jQuery("#idprodfournprice").val('0'); // Set cursor on not selected product jQuery("#idprodfournprice").val('0'); // Set cursor on not selected product
@ -1148,7 +1179,7 @@ if (!empty($usemargins) && $user->rights->margins->creer) {
jQuery("#multicurrency_price_ttc").val('').hide(); jQuery("#multicurrency_price_ttc").val('').hide();
jQuery("#title_up_ttc, #title_up_ttc_currency").hide(); jQuery("#title_up_ttc, #title_up_ttc_currency").hide();
<?php } ?> <?php } ?>
jQuery("#tva_tx, #title_vat").hide(); /* jQuery("#tva_tx, #title_vat").hide(); */
/* jQuery("#title_fourn_ref").hide(); */ /* jQuery("#title_fourn_ref").hide(); */
jQuery("#np_marginRate, #np_markRate, .np_marginRate, .np_markRate, #units, #title_units").hide(); jQuery("#np_marginRate, #np_markRate, .np_marginRate, .np_markRate, #units, #title_units").hide();
jQuery("#buying_price").show(); jQuery("#buying_price").show();

View File

@ -71,7 +71,7 @@ if (!empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) || !empty($conf->global->FA
if (in_array($object->element, array('propal', 'commande', 'facture', 'supplier_proposal', 'order_supplier', 'invoice_supplier')) && $object->status == $object::STATUS_DRAFT) { if (in_array($object->element, array('propal', 'commande', 'facture', 'supplier_proposal', 'order_supplier', 'invoice_supplier')) && $object->status == $object::STATUS_DRAFT) {
global $mysoc; global $mysoc;
if (empty($disableedit)) { if (empty($disableedit) && GETPOST('mode', 'aZ09') != 'vatforalllines') {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?mode=vatforalllines&id='.$object->id.'">'.img_edit($langs->trans("UpdateForAllLines"), 0, 'class="clickvatforalllines opacitymedium paddingleft cursorpointer"').'</a>'; print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?mode=vatforalllines&id='.$object->id.'">'.img_edit($langs->trans("UpdateForAllLines"), 0, 'class="clickvatforalllines opacitymedium paddingleft cursorpointer"').'</a>';
} }
//print '<script>$(document).ready(function() { $(".clickvatforalllines").click(function() { jQuery(".classvatforalllines").toggle(); }); });</script>'; //print '<script>$(document).ready(function() { $(".clickvatforalllines").click(function() { jQuery(".classvatforalllines").toggle(); }); });</script>';
@ -111,7 +111,7 @@ print $langs->trans('ReductionShort');
if (in_array($object->element, array('propal', 'commande', 'facture')) && $object->status == $object::STATUS_DRAFT) { if (in_array($object->element, array('propal', 'commande', 'facture')) && $object->status == $object::STATUS_DRAFT) {
global $mysoc; global $mysoc;
if (empty($disableedit)) { if (empty($disableedit) && GETPOST('mode', 'aZ09') != 'remiseforalllines') {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?mode=remiseforalllines&id='.$object->id.'">'.img_edit($langs->trans("UpdateForAllLines"), 0, 'class="clickvatforalllines opacitymedium paddingleft cursorpointer"').'</a>'; print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?mode=remiseforalllines&id='.$object->id.'">'.img_edit($langs->trans("UpdateForAllLines"), 0, 'class="clickvatforalllines opacitymedium paddingleft cursorpointer"').'</a>';
} }
//print '<script>$(document).ready(function() { $(".clickremiseforalllines").click(function() { jQuery(".classremiseforalllines").toggle(); }); });</script>'; //print '<script>$(document).ready(function() { $(".clickremiseforalllines").click(function() { jQuery(".classremiseforalllines").toggle(); }); });</script>';

View File

@ -931,7 +931,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
$object->sendtoid = 0; $object->sendtoid = 0;
} else { } else {
// TODO Merge all previous cases into this generic one // 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, ... // 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: 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 // Note that these key can be set in agenda setup, only if defined into llx_c_action_trigger

View File

@ -1,4 +1,25 @@
<?php <?php
/* Copyright (C) 2023 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/debugbar/class/DataCollector/DolConfigCollector.php
* \brief Class for debugbar collection
* \ingroup debugbar
*/
use \DebugBar\DataCollector\ConfigCollector; use \DebugBar\DataCollector\ConfigCollector;

View File

@ -1,4 +1,25 @@
<?php <?php
/* Copyright (C) 2023 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/debugbar/class/DataCollector/DolexceptionsCollector.php
* \brief Class for debugbar collection
* \ingroup debugbar
*/
use \DebugBar\DataCollector\ExceptionsCollector; use \DebugBar\DataCollector\ExceptionsCollector;

View File

@ -1,4 +1,25 @@
<?php <?php
/* Copyright (C) 2023 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/debugbar/class/DataCollector/DolLogsCollector.php
* \brief Class for debugbar collection
* \ingroup debugbar
*/
use DebugBar\DataCollector\MessagesCollector; use DebugBar\DataCollector\MessagesCollector;
use Psr\Log\LogLevel; use Psr\Log\LogLevel;

View File

@ -1,17 +1,37 @@
<?php <?php
/* Copyright (C) 2023 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/debugbar/class/DataCollector/DolMemoryCollector.php
* \brief Class for debugbar collection
* \ingroup debugbar
*/
use \DebugBar\DataCollector\MemoryCollector; use \DebugBar\DataCollector\MemoryCollector;
/** /**
* DolMemoryCollector class * DolMemoryCollector class
*/ */
class DolMemoryCollector extends MemoryCollector class DolMemoryCollector extends MemoryCollector
{ {
/** /**
* Return value of indicator * Return value of indicator
* *
* @return void * @return array
*/ */
public function collect() public function collect()
{ {
@ -28,7 +48,7 @@ class DolMemoryCollector extends MemoryCollector
/** /**
* Return widget settings * Return widget settings
* *
* @return void * @return array
*/ */
public function getWidgets() public function getWidgets()
{ {

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