diff --git a/COPYRIGHT b/COPYRIGHT index 46e2f093900..d980219c420 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -23,7 +23,6 @@ Licence of dependencies of third-party components used by Dolibarr (all compatib Component Version License GPL Compatible Usage ------------------------------------------------------------------------------------- PHP libraries: -ADOdb-Date 0.36 Modified BSD License Yes Date convertion (not into rpm package) EvalMath 1.0 BSD Yes Safe math expressions evaluation Escpos-php 2.2 MIT License Yes Thermal receipt printer library, for use with ESC/POS compatible printers GeoIP2 0.2.0 Apache License 2.0 Yes Lib to make geoip convert diff --git a/build/debian/control b/build/debian/control index 059325eecb9..b2890253b32 100755 --- a/build/debian/control +++ b/build/debian/control @@ -19,7 +19,6 @@ Depends: libapache2-mod-php5 | libapache2-mod-php5filter | php5-cgi | php5-fpm | php-pear, php-mail-mime, # php-tcpdf, # libfpdf-tpl-php, php-fpdf, -# libphp-adodb, # libnusoap-php, # libphp-pclzip, # Required javascript libraries diff --git a/build/debian/copyright b/build/debian/copyright index 403763544a5..b99b8a65b5d 100644 --- a/build/debian/copyright +++ b/build/debian/copyright @@ -61,31 +61,6 @@ License: GPL-3+ ------------------------------------------------------------ -Files: htdocs/includes/adodbtime/* -Copyright: 2003-2005, John Lim - unknown, jackbbs -License: BSD-3-Clause - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - . - Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - . - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - . - Neither the name of the John Lim nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. -Comment: - Those files are not shipped in the binary package since we use - the library as packaged in "libphp-adodb". - - ------------------------------------------------------------- - Files: htdocs/includes/ckeditor/* Copyright: 2003-2012 CKSource - Frederico Knabben License: GPL-2+ diff --git a/build/debian/dolibarr.postinst b/build/debian/dolibarr.postinst index 26a08a55826..6ba9123ede4 100644 --- a/build/debian/dolibarr.postinst +++ b/build/debian/dolibarr.postinst @@ -146,7 +146,6 @@ case "$1" in #else # File already exist. We add params not found. #echo Add new params to overwrite path to use shared libraries/fonts - #grep -q -c "dolibarr_lib_ADODB_PATH" $config || [ ! -d "/usr/share/php/adodb" ] || echo "" >> $config ##grep -q -c "dolibarr_lib_GEOIP_PATH" $config || echo "" >> $config #grep -q -c "dolibarr_lib_NUSOAP_PATH" $config || [ ! -d "/usr/share/php/nusoap" ] || echo "" >> $config #grep -q -c "dolibarr_lib_ODTPHP_PATHTOPCLZIP" $config || [ ! -d "/usr/share/php/libphp-pclzip" ] || echo "" >> $config diff --git a/build/debian/install.forced.php.install b/build/debian/install.forced.php.install index 1d10699f1d4..801b1b372af 100644 --- a/build/debian/install.forced.php.install +++ b/build/debian/install.forced.php.install @@ -31,7 +31,6 @@ $force_install_distrib='debian'; // - not removed from package (see rm in rules file), // - declared into dependencies (see Depends in control file) //$force_dolibarr_lib_TCPDF_PATH=''; -//$force_dolibarr_lib_ADODB_PATH='/usr/share/php/adodb'; //$force_dolibarr_lib_GEOIP_PATH=''; //$force_dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap'; //$force_dolibarr_lib_ODTPHP_PATHTOPCLZIP='/usr/share/php/libphp-pclzip'; diff --git a/build/debian/rules b/build/debian/rules index dab5d84fd11..b63fcffde93 100755 --- a/build/debian/rules +++ b/build/debian/rules @@ -89,7 +89,6 @@ override_dh_install: rm -fr build/zip # clean from all PHP embedded libraries (we use package dependencies instead) -# rm -fr htdocs/includes/adodbtime # rm -fr htdocs/includes/geoip # rm -fr htdocs/includes/nusoap # rm -fr htdocs/includes/odtphp/zip/pclzip diff --git a/build/rpm/dolibarr_fedora.spec b/build/rpm/dolibarr_fedora.spec index 1c6716408b7..c94863e8919 100755 --- a/build/rpm/dolibarr_fedora.spec +++ b/build/rpm/dolibarr_fedora.spec @@ -25,7 +25,7 @@ BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-build Group: Applications/Productivity -Requires: httpd, php >= 5.3.0, php-cli, php-gd, php-ldap, php-imap, php-mysqli, php-adodb, php-nusoap, dejavu-sans-fonts +Requires: httpd, php >= 5.3.0, php-cli, php-gd, php-ldap, php-imap, php-mysqli, php-nusoap, dejavu-sans-fonts Requires: mysql-server, mysql #BuildRequires: desktop-file-utils @@ -104,7 +104,6 @@ cui hai bisogno ed essere facile da usare. %{__cp} -pr htdocs $RPM_BUILD_ROOT%{_datadir}/%{name} %{__cp} -pr scripts $RPM_BUILD_ROOT%{_datadir}/%{name} %{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/includes/ckeditor/_source -%{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/includes/adodbtime %{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/includes/nusoap %{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/includes/fonts @@ -274,7 +273,6 @@ if [ -s $config ] && grep -q "File generated by" $config then # File already exist. We add params not found. echo Add new params to overwrite path to use shared libraries/fonts - grep -q -c "dolibarr_lib_ADODB_PATH" $config || [ ! -d "/usr/share/php/adodb" ] || echo "" >> $config grep -q -c "dolibarr_lib_FPDI_PATH" $config || [ ! -d "/usr/share/php/fpdi" ] || echo "" >> $config #grep -q -c "dolibarr_lib_GEOIP_PATH" $config || echo "" >> $config grep -q -c "dolibarr_lib_NUSOAP_PATH" $config || [ ! -d "/usr/share/php/nusoap" ] || echo "" >> $config diff --git a/build/rpm/dolibarr_generic.spec b/build/rpm/dolibarr_generic.spec index a992c84f0f9..8e71713146e 100755 --- a/build/rpm/dolibarr_generic.spec +++ b/build/rpm/dolibarr_generic.spec @@ -46,7 +46,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-build %if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version} Group: Applications/Productivity -Requires: httpd, php >= 5.3.0, php-cli, php-gd, php-ldap, php-imap, php-mysqli, php-adodb, php-nusoap, dejavu-sans-fonts, php-mbstring, php-xml +Requires: httpd, php >= 5.3.0, php-cli, php-gd, php-ldap, php-imap, php-mysqli, php-nusoap, dejavu-sans-fonts, php-mbstring, php-xml Requires: mysql-server, mysql BuildRequires: desktop-file-utils %else @@ -169,7 +169,6 @@ cui hai bisogno ed essere facile da usare. %{__cp} -pr scripts $RPM_BUILD_ROOT%{_datadir}/%{name} %{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/includes/ckeditor/_source %if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version} -%{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/includes/adodbtime %{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/includes/nusoap %{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/includes/fonts %else @@ -425,7 +424,6 @@ if [ -s $config ] && grep -q "File generated by" $config then # File already exist. We add params not found. echo Add new params to overwrite path to use shared libraries/fonts - grep -q -c "dolibarr_lib_ADODB_PATH" $config || [ ! -d "/usr/share/php/adodb" ] || echo "" >> $config grep -q -c "dolibarr_lib_FPDI_PATH" $config || [ ! -d "/usr/share/php/fpdi" ] || echo "" >> $config #grep -q -c "dolibarr_lib_GEOIP_PATH" $config || echo "" >> $config grep -q -c "dolibarr_lib_NUSOAP_PATH" $config || [ ! -d "/usr/share/php/nusoap" ] || echo "" >> $config diff --git a/build/rpm/dolibarr_mandriva.spec b/build/rpm/dolibarr_mandriva.spec index a371e3ab02f..5c8a8e39aae 100755 --- a/build/rpm/dolibarr_mandriva.spec +++ b/build/rpm/dolibarr_mandriva.spec @@ -271,7 +271,6 @@ if [ -s $config ] && grep -q "File generated by" $config then # File already exist. We add params not found. echo Add new params to overwrite path to use shared libraries/fonts - grep -q -c "dolibarr_lib_ADODB_PATH" $config || [ ! -d "/usr/share/php/adodb" ] || echo "" >> $config grep -q -c "dolibarr_lib_FPDI_PATH" $config || [ ! -d "/usr/share/php/fpdi" ] || echo "" >> $config #grep -q -c "dolibarr_lib_GEOIP_PATH" $config || echo "" >> $config grep -q -c "dolibarr_lib_NUSOAP_PATH" $config || [ ! -d "/usr/share/php/nusoap" ] || echo "" >> $config diff --git a/build/rpm/dolibarr_opensuse.spec b/build/rpm/dolibarr_opensuse.spec index c7113828632..ea79a50af58 100755 --- a/build/rpm/dolibarr_opensuse.spec +++ b/build/rpm/dolibarr_opensuse.spec @@ -281,7 +281,6 @@ if [ -s $config ] && grep -q "File generated by" $config then # File already exist. We add params not found. echo Add new params to overwrite path to use shared libraries/fonts - grep -q -c "dolibarr_lib_ADODB_PATH" $config || [ ! -d "/usr/share/php/adodb" ] || echo "" >> $config grep -q -c "dolibarr_lib_FPDI_PATH" $config || [ ! -d "/usr/share/php/fpdi" ] || echo "" >> $config #grep -q -c "dolibarr_lib_GEOIP_PATH" $config || echo "" >> $config grep -q -c "dolibarr_lib_NUSOAP_PATH" $config || [ ! -d "/usr/share/php/nusoap" ] || echo "" >> $config diff --git a/build/rpm/install.forced.php.fedora b/build/rpm/install.forced.php.fedora index a8bc0d390c6..636514260cf 100644 --- a/build/rpm/install.forced.php.fedora +++ b/build/rpm/install.forced.php.fedora @@ -20,7 +20,6 @@ $force_install_lockinstall='444'; $force_install_distrib='rpmfedora'; // Value to overwrite path to use shared libraries/fonts instead of embedded one -$force_dolibarr_lib_ADODB_PATH='/usr/share/php/adodb'; //$force_dolibarr_lib_FPDI_PATH='/usr/share/php/fpdi'; //$force_dolibarr_lib_GEOIP_PATH=''; $force_dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap'; diff --git a/build/rpm/install.forced.php.mandriva b/build/rpm/install.forced.php.mandriva index a254eebbf7b..5471d146391 100644 --- a/build/rpm/install.forced.php.mandriva +++ b/build/rpm/install.forced.php.mandriva @@ -20,7 +20,6 @@ $force_install_lockinstall='444'; $force_install_distrib='rpmmandriva'; // Value to overwrite path to use shared libraries/fonts instead of embedded one -$force_dolibarr_lib_ADODB_PATH='/usr/share/php/adodb'; //$force_dolibarr_lib_FPDI_PATH='/usr/share/php/fpdi'; //$force_dolibarr_lib_GEOIP_PATH=''; $force_dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap'; diff --git a/build/rpm/install.forced.php.opensuse b/build/rpm/install.forced.php.opensuse index 24da4417121..ea50180caf4 100644 --- a/build/rpm/install.forced.php.opensuse +++ b/build/rpm/install.forced.php.opensuse @@ -20,7 +20,6 @@ $force_install_lockinstall='444'; $force_install_distrib='rpmopensuse'; // Value to overwrite path to use shared libraries/fonts instead of embedded one -//$force_dolibarr_lib_ADODB_PATH='/usr/share/php/adodb'; //$force_dolibarr_lib_FPDI_PATH='/usr/share/php/fpdi'; //$force_dolibarr_lib_GEOIP_PATH=''; //$force_dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap'; diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 1520897c4f7..e9836c4efbf 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -985,7 +985,7 @@ if (!empty($arrayfields['t.piece_num']['checked'])) { // Code journal if (!empty($arrayfields['t.code_journal']['checked'])) { print ''; - print $formaccounting->multi_select_journal($search_ledger_code, 'search_ledger_code', 0, 1, 1, 1, 'small maxwidth150'); + print $formaccounting->multi_select_journal($search_ledger_code, 'search_ledger_code', 0, 1, 1, 1, 'small maxwidth75'); print ''; } // Date document diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index c4b27dce418..7ab6666d4c4 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -743,12 +743,12 @@ print ''; // Movement number if (!empty($arrayfields['t.piece_num']['checked'])) { - print ''; + print ''; } // Code journal if (!empty($arrayfields['t.code_journal']['checked'])) { print ''; - print $formaccounting->multi_select_journal($search_ledger_code, 'search_ledger_code', 0, 1, 1, 1); + print $formaccounting->multi_select_journal($search_ledger_code, 'search_ledger_code', 0, 1, 1, 1, 'maxwidth75'); print ''; } // Date document diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 9dfd94d5729..4def8dfbef6 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -725,7 +725,7 @@ if ($result) { // Suggested accounting account print ''; - print $formaccounting->select_account(($default_account > 0 && $confirm === 'yes' && in_array($objp->rowid."_".$i, $toselect)) ? $default_account : $suggestedid, 'codeventil'.$facture_static_det->id, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone'); + print $formaccounting->select_account(($default_account > 0 && $confirm === 'yes' && in_array($objp->rowid."_".$i, $toselect)) ? $default_account : $suggestedid, 'codeventil'.$facture_static_det->id, 1, array(), 0, 0, 'codeventil maxwidth150 maxwidthonsmartphone', 'cachewithshowemptyone'); print ''; // Column with checkbox diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php index 7a02d0b4564..b90a8a2c573 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -503,7 +503,7 @@ if ($result) { // Suggested accounting account print ''; - print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone'); + print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone'); print ''; print ''; diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 4593541e87a..3c4a9e7f46b 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -749,7 +749,7 @@ if ($result) { // Suggested accounting account print ''; - print $formaccounting->select_account(($default_account > 0 && $confirm === 'yes' && in_array($objp->rowid."_".$i, $toselect)) ? $default_account : $suggestedid, 'codeventil'.$facturefourn_static_det->id, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone'); + print $formaccounting->select_account(($default_account > 0 && $confirm === 'yes' && in_array($objp->rowid."_".$i, $toselect)) ? $default_account : $suggestedid, 'codeventil'.$facturefourn_static_det->id, 1, array(), 0, 0, 'codeventil maxwidth150 maxwidthonsmartphone', 'cachewithshowemptyone'); print ''; // Column with checkbox diff --git a/htdocs/admin/fichinter.php b/htdocs/admin/fichinter.php index 4e4438263c3..cf637d37329 100644 --- a/htdocs/admin/fichinter.php +++ b/htdocs/admin/fichinter.php @@ -208,6 +208,32 @@ if ($action == 'updateMask') { $error++; } + if (!$error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'errors'); + } +} elseif ($action == "set_FICHINTER_ALLOW_ONLINE_SIGN") { + $val = GETPOST('FICHINTER_ALLOW_ONLINE_SIGN', 'alpha'); + $res = dolibarr_set_const($db, "FICHINTER_ALLOW_ONLINE_SIGN", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity); + + if (!($res > 0)) { + $error++; + } + + if (!$error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'errors'); + } +} elseif ($action == "set_FICHINTER_ALLOW_EXTERNAL_DOWNLOAD") { + $val = GETPOST('FICHINTER_ALLOW_EXTERNAL_DOWNLOAD', 'alpha'); + $res = dolibarr_set_const($db, "FICHINTER_ALLOW_EXTERNAL_DOWNLOAD", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity); + + if (!($res > 0)) { + $error++; + } + if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { @@ -594,6 +620,39 @@ print ''; print ''; print ''; +// Allow online signing +print '
'; +print ''; +print ''; +print ''; +print ''; +print $langs->trans("AllowOnlineSign"); +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print '
'; +// Allow external download +print '
'; +print ''; +print ''; +print ''; +print ''; +print $langs->trans("AllowExternalDownload"); +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print '
'; + print ''; print ''; diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 1a25af49789..dfa0bccb06b 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -34,14 +34,15 @@ $langs->loadLangs(array("companies", "products", "admin", "mails", "other", "err $action = GETPOST('action', 'aZ09'); $cancel = GETPOST('cancel', 'aZ09'); +$trackid = GETPOST('trackid'); + if (!$user->admin) { accessforbidden(); } $usersignature = $user->signature; -// For action = test or send, we ensure that content is not html, even for signature, because this we want a test with NO html. - -if ($action == 'test' || $action == 'send') { +// For action = test or send, we ensure that content is not html, even for signature, because for this we want a test with NO html. +if ($action == 'test' || ($action == 'send' && $trackid = 'test')) { $usersignature = dol_string_nohtmltag($usersignature, 2); } @@ -130,7 +131,7 @@ $actiontypecode = ''; // Not an event for agenda $triggersendname = ''; // Disable triggers $paramname = 'id'; $mode = 'emailfortest'; -$trackid = (($action == 'testhtml') ? "testhtml" : "test"); +$trackid = ($action == 'send' ? GETPOST('trackid', 'aZ09') : $action); $sendcontext = ''; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; @@ -143,7 +144,6 @@ if ($action == 'presend' && GETPOST('trackid', 'alphanohtml') == 'testhtml') { - /* * View */ diff --git a/htdocs/admin/system/constall.php b/htdocs/admin/system/constall.php index 4acb8e0ff59..dcf41aacf25 100644 --- a/htdocs/admin/system/constall.php +++ b/htdocs/admin/system/constall.php @@ -73,7 +73,6 @@ $configfileparameters = array( '?dolibarr_main_auth_ldap_admin_pass', '?dolibarr_main_auth_ldap_debug', 'separator', - '?dolibarr_lib_ADODB_PATH', '?dolibarr_lib_FPDF_PATH', '?dolibarr_lib_TCPDF_PATH', '?dolibarr_lib_FPDI_PATH', @@ -122,7 +121,6 @@ $configfilelib = array( 'dolibarr_main_auth_ldap_admin_pass', 'dolibarr_main_auth_ldap_debug', 'separator', - 'dolibarr_lib_ADODB_PATH', 'dolibarr_lib_TCPDF_PATH', 'dolibarr_lib_FPDI_PATH', 'dolibarr_lib_NUSOAP_PATH', diff --git a/htdocs/admin/system/dolibarr.php b/htdocs/admin/system/dolibarr.php index 86c76ca1604..7fa1ef252cb 100644 --- a/htdocs/admin/system/dolibarr.php +++ b/htdocs/admin/system/dolibarr.php @@ -342,7 +342,6 @@ $configfileparameters = array( '?dolibarr_main_auth_ldap_admin_pass' => 'dolibarr_main_auth_ldap_admin_pass', '?dolibarr_main_auth_ldap_debug' => 'dolibarr_main_auth_ldap_debug', 'separator3' => '', - '?dolibarr_lib_ADODB_PATH' => 'dolibarr_lib_ADODB_PATH', '?dolibarr_lib_FPDF_PATH' => 'dolibarr_lib_FPDF_PATH', '?dolibarr_lib_TCPDF_PATH' => 'dolibarr_lib_TCPDF_PATH', '?dolibarr_lib_FPDI_PATH' => 'dolibarr_lib_FPDI_PATH', diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index fa5e2ff1de8..e0acc8faac8 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -113,9 +113,8 @@ class DolibarrApi unset($object->pass); unset($object->pass_indatabase); - // Remove linkedObjects. We should already have linkedObjectsIds that avoid huge responses + // Remove linkedObjects. We should already have and keep only linkedObjectsIds that avoid huge responses unset($object->linkedObjects); - unset($object->linkedObjectsFullLoaded); //unset($object->lines[$i]->linked_objects); // This is the array to create linked object during create unset($object->fields); diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 39d5a43bc55..3aa6a16d3ef 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -90,6 +90,14 @@ if ($fulldayevent) { $datep = dol_mktime($aphour, $apmin, 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), 'tzuserrel'); $datef = dol_mktime($p2hour, $p2min, '59', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), 'tzuserrel'); } +$reg = array(); +if (GETPOST('datep')) { + if (GETPOST('datep') == 'now') { + $datep = dol_now(); + } elseif (preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])$/', GETPOST("datep"), $reg)) { // Try to not use this. Use insteead '&datep=now' + $datep = dol_mktime(0, 0, 0, $reg[2], $reg[3], $reg[1], 'tzuser'); + } +} // Security check $socid = GETPOST('socid', 'int'); @@ -151,6 +159,8 @@ if ($user->socid && $socid) { $result = restrictedArea($user, 'societe', $socid); } +$usercancreate = $user->rights->agenda->allactions->create || (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->create); + /* * Actions @@ -1068,7 +1078,6 @@ if (empty($reshook)) { } - /* * View */ @@ -1181,9 +1190,10 @@ if ($action == 'create') { // Type of event if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) { print ''.$langs->trans("Type").''; - $default = (empty($conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT) ? 'AC_RDV' : $conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT); + $default = getDolGlobalString('AGENDA_USE_EVENT_TYPE_DEFAULT', 'AC_RDV'); print img_picto($langs->trans("ActionType"), 'square', 'class="fawidth30 inline-block" style="color: #ddd;"'); - print $formactions->select_type_actions(GETPOSTISSET("actioncode") ? GETPOST("actioncode", 'aZ09') : ($object->type_code ? $object->type_code : $default), "actioncode", "systemauto", 0, -1, 0, 1); // TODO Replace 0 with -2 in onlyautoornot + $selectedvalue = GETPOSTISSET("actioncode") ? GETPOST("actioncode", 'aZ09') : ($object->type_code ? $object->type_code : $default); + print $formactions->select_type_actions($selectedvalue, "actioncode", "systemauto", 0, -1, 0, 1); // TODO Replace 0 with -2 in onlyautoornot print ''; } @@ -1495,11 +1505,6 @@ if ($action == 'create') { } } - $reg = array(); - if (GETPOST("datep") && preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])$/', GETPOST("datep"), $reg)) { - $object->datep = dol_mktime(0, 0, 0, $reg[2], $reg[3], $reg[1]); - } - // Priority if (!empty($conf->global->AGENDA_SUPPORT_PRIORITY_IN_EVENTS)) { print ''.$langs->trans("Priority").''; @@ -2151,34 +2156,21 @@ if ($id > 0) { // Project if (isModEnabled('project')) { $langs->load("projects"); - //$morehtmlref.='
'.$langs->trans('Project') . ' '; - $morehtmlref .= $langs->trans('Project').' '; - if ($user->rights->agenda->allactions->create || - (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->create)) { + //$morehtmlref .= '
'; + if ($usercancreate) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; - } - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= '
'; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= '
'; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php index 9a4a4e6a869..b02b2850346 100644 --- a/htdocs/comm/action/document.php +++ b/htdocs/comm/action/document.php @@ -89,7 +89,8 @@ if ($user->socid && $socid) { $result = restrictedArea($user, 'societe', $socid); } -$permissiontoadd = $user->rights->agenda->myactions->read; // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php +$usercancreate = $user->rights->agenda->allactions->create || (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->create); +$permissiontoadd = $usercancreate; /* @@ -162,17 +163,22 @@ if ($object->id > 0) { // Project if (isModEnabled('project')) { $langs->load("projects"); - //$morehtmlref.='
'.$langs->trans('Project') . ' '; - $morehtmlref .= $langs->trans('Project').': '; - if (!empty($object->fk_project)) { - $proj = new Project($db); - $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); - if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + //$morehtmlref .= '
'; + if (0) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); + if ($action != 'classify') { + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { - $morehtmlref .= ''; + if (!empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref .= $proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; + } + } } } $morehtmlref .= ''; diff --git a/htdocs/comm/action/info.php b/htdocs/comm/action/info.php index 807a8e6f412..749ca6a0c62 100644 --- a/htdocs/comm/action/info.php +++ b/htdocs/comm/action/info.php @@ -50,6 +50,8 @@ if ($user->socid && $socid) { $result = restrictedArea($user, 'societe', $socid); } +$usercancreate = $user->rights->agenda->allactions->create || (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->create); + /* * View @@ -89,17 +91,22 @@ $morehtmlref = '
'; // Project if (isModEnabled('project')) { $langs->load("projects"); - //$morehtmlref.='
'.$langs->trans('Project') . ' '; - $morehtmlref .= $langs->trans('Project').': '; - if (!empty($object->fk_project)) { - $proj = new Project($db); - $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); - if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + //$morehtmlref .= '
'; + if (0) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); + if ($action != 'classify') { + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { - $morehtmlref .= ''; + if (!empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref .= $proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; + } + } } } $morehtmlref .= '
'; diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 2372f24a929..72ec408524c 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -84,6 +84,8 @@ if (empty($user->rights->mailing->lire) || (empty($conf->global->EXTERNAL_USERS_ accessforbidden(); } +$upload_dir = $conf->mailing->dir_output."/".get_exdir($object->id, 2, 0, 1, $object, 'mailing'); + /* * Actions @@ -124,8 +126,6 @@ if (empty($reshook)) { setEventMessages($langs->trans("NotEnoughPermissions"), null, 'warnings'); $action = ''; } else { - $upload_dir = $conf->mailing->dir_output."/".get_exdir($object->id, 2, 0, 1, $object, 'mailing'); - if ($object->statut == 0) { dol_print_error('', 'ErrorMailIsNotValidated'); exit; @@ -318,7 +318,8 @@ if (empty($reshook)) { // Mail making $trackid = 'emailing-'.$obj->fk_mailing.'-'.$obj->rowid; - $mail = new CMailFile($newsubject, $sendto, $from, $newmessage, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $errorsto, $arr_css, $trackid, $moreinheader, 'emailing'); + $upload_dir_tmp = $upload_dir; + $mail = new CMailFile($newsubject, $sendto, $from, $newmessage, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $errorsto, $arr_css, $trackid, $moreinheader, 'emailing', '', $upload_dir_tmp); if ($mail->error) { $res = 0; @@ -478,7 +479,8 @@ if (empty($reshook)) { } $trackid = 'emailing-test'; - $mailfile = new CMailFile($tmpsujet, $object->sendto, $object->email_from, $tmpbody, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $object->email_errorsto, $arr_css, $trackid, '', 'emailing'); + $upload_dir_tmp = $upload_dir; + $mailfile = new CMailFile($tmpsujet, $object->sendto, $object->email_from, $tmpbody, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $object->email_errorsto, $arr_css, $trackid, '', 'emailing', '', $upload_dir_tmp); $result = $mailfile->sendfile(); if ($result) { @@ -729,8 +731,11 @@ if ($action == 'create') { print dol_get_fiche_head(); print ''; + print ''; + print ''; + print ''; // Other attributes @@ -742,7 +747,7 @@ if ($action == 'create') { } print '
'.$langs->trans("MailTitle").'
'.$langs->trans("MailFrom").'
'.$langs->trans("MailErrorsTo").'
'; - print '

'; + print '

'; print ''; print ''; @@ -887,16 +892,16 @@ if ($action == 'create') { // Description print ''; // From print ''; diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index f835ae3ae29..648fc6e18c4 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -2297,39 +2297,28 @@ if ($action == 'create') { $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string'.(isset($conf->global->THIRDPARTY_REF_INPUT_SIZE) ? ':'.$conf->global->THIRDPARTY_REF_INPUT_SIZE : ''), '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'customer'); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'customer'); if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) { $morehtmlref .= ' ('.$langs->trans("OtherProposals").')'; } // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').''; + $morehtmlref .= '
'; if ($usercancreate) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; - } - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= ''; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ': '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } - } else { - $morehtmlref .= ''; } } } @@ -2343,7 +2332,7 @@ if ($action == 'create') { print '
'; print '
'; - print '
'.$langs->trans("MailTopic").'
'; - print $form->editfieldkey("MailTitle", 'title', $object->title, $object, $user->rights->mailing->creer && $object->statut < 3, 'string'); + print $form->editfieldkey("MailTitle", 'title', $object->title, $object, $user->hasRight('mailing', 'creer'), 'string'); print ''; - print $form->editfieldval("MailTitle", 'title', $object->title, $object, $user->rights->mailing->creer && $object->statut < 3, 'string'); + print $form->editfieldval("MailTitle", 'title', $object->title, $object, $user->hasRight('mailing', 'creer'), 'string'); print '
'; - print $form->editfieldkey("MailFrom", 'email_from', $object->email_from, $object, $user->rights->mailing->creer && $object->statut < 3, 'string'); + print $form->editfieldkey("MailFrom", 'email_from', $object->email_from, $object, $user->hasRight('mailing', 'creer') && $object->statut < 3, 'string'); print ''; - print $form->editfieldval("MailFrom", 'email_from', $object->email_from, $object, $user->rights->mailing->creer && $object->statut < 3, 'string'); + print $form->editfieldval("MailFrom", 'email_from', $object->email_from, $object, $user->hasRight('mailing', 'creer') && $object->statut < 3, 'string'); $email = CMailFile::getValidAddress($object->email_from, 2); if ($email && !isValidEmail($email)) { $langs->load("errors"); @@ -910,9 +915,9 @@ if ($action == 'create') { // Errors to print '
'; - print $form->editfieldkey("MailErrorsTo", 'email_errorsto', $object->email_errorsto, $object, $user->rights->mailing->creer && $object->statut < 3, 'string'); + print $form->editfieldkey("MailErrorsTo", 'email_errorsto', $object->email_errorsto, $object, $user->hasRight('mailing', 'creer') && $object->statut < 3, 'string'); print ''; - print $form->editfieldval("MailErrorsTo", 'email_errorsto', $object->email_errorsto, $object, $user->rights->mailing->creer && $object->statut < 3, 'string'); + print $form->editfieldval("MailErrorsTo", 'email_errorsto', $object->email_errorsto, $object, $user->hasRight('mailing', 'creer') && $object->statut < 3, 'string'); $email = CMailFile::getValidAddress($object->email_errorsto, 2); if ($email && !isValidEmail($email)) { $langs->load("errors"); @@ -977,11 +982,11 @@ if ($action == 'create') { if (GETPOST('cancel', 'alpha') || $confirm == 'no' || $action == '' || in_array($action, array('settodraft', 'valid', 'delete', 'sendall', 'clone', 'test'))) { print "\n\n
\n"; - if (($object->statut == 1) && ($user->rights->mailing->valider || $object->user_validation == $user->id)) { + if (($object->statut == 1) && ($user->hasRight('mailing', 'valider') || $object->user_validation == $user->id)) { print ''.$langs->trans("SetToDraft").''; } - if (($object->statut == 0 || $object->statut == 1 || $object->statut == 2) && $user->rights->mailing->creer) { + if (($object->statut == 0 || $object->statut == 1 || $object->statut == 2) && $user->hasRight('mailing', 'creer')) { if (isModEnabled('fckeditor') && !empty($conf->global->FCKEDITOR_ENABLE_MAILING)) { print ''.$langs->trans("EditWithEditor").''; } else { @@ -1011,7 +1016,7 @@ if ($action == 'create') { } } - if (($object->statut == 1 || $object->statut == 2) && $object->nbemail > 0 && $user->rights->mailing->valider) { + if (($object->statut == 1 || $object->statut == 2) && $object->nbemail > 0 && $user->hasRight('mailing', 'valider')) { if ($conf->global->MAILING_LIMIT_SENDBYWEB < 0) { print ''.$langs->trans("SendMailing").''; } elseif (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !$user->rights->mailing->mailing_advance->send) { @@ -1021,11 +1026,11 @@ if ($action == 'create') { } } - if ($user->rights->mailing->creer) { + if ($user->hasRight('mailing', 'creer')) { print ''.$langs->trans("ToClone").''; } - if (($object->statut == 2 || $object->statut == 3) && $user->rights->mailing->valider) { + if (($object->statut == 2 || $object->statut == 3) && $user->hasRight('mailing', 'valider')) { if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !$user->rights->mailing->mailing_advance->send) { print ''.$langs->trans("ResetMailing").''; } else { @@ -1033,7 +1038,7 @@ if ($action == 'create') { } } - if (($object->statut <= 1 && $user->rights->mailing->creer) || $user->rights->mailing->supprimer) { + if (($object->statut <= 1 && $user->hasRight('mailing', 'creer')) || $user->hasRight('mailing', 'supprimer')) { if ($object->statut > 0 && (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !$user->rights->mailing->mailing_advance->delete)) { print ''.$langs->trans("DeleteMailing").''; } else { @@ -1262,8 +1267,9 @@ if ($action == 'create') { $out .= '
'; } } else { - $out .= ''.$langs->trans("NoAttachedFiles").'
'; + //$out .= ''.$langs->trans("NoAttachedFiles").'
'; } + // Add link to add file $maxfilesizearray = getMaxFileSizeArray(); $maxmin = $maxfilesizearray['maxmin']; @@ -1272,7 +1278,7 @@ if ($action == 'create') { } $out .= ''; $out .= ' '; - $out .= ''; + $out .= ''; print $out; print '
'; + print '
'; // Link for thirdparty discounts if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { @@ -2403,7 +2392,7 @@ if ($action == 'create') { // Date end proposal print ''; print ''; - print ''; } if (!empty($object->socid)) { print ''; - print ''; } // Other attributes - $cols = 3; $parameters = array('socid'=>$socid); include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; $object->load_ref_elements(); if (isModEnabled("propal")) { - print ''; } if (isModEnabled('commande') || isModEnabled("expedition")) { - print ''; } if (isModEnabled('facture')) { - print ''; } - print '\n"; } else { $out = '\n"; } return $out; diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index ab91cd8867b..216644876ba 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -1408,6 +1408,12 @@ class FormTicket $ticketstat = new Ticket($this->db); $res = $ticketstat->fetch('', '', $this->track_id); + print ''; + // Private message (not visible by customer/external user) if (!$user->socid) { print ''; } - print ''; - // Zone to select its email template if (count($modelmail_array) > 0) { print '
'; - print '
'; + print ''; if ($action != 'editecheance' && $usercancreate && $caneditfield) { diff --git a/htdocs/comm/propal/class/propalestats.class.php b/htdocs/comm/propal/class/propalestats.class.php index 1e688457623..81d49bb87ad 100644 --- a/htdocs/comm/propal/class/propalestats.class.php +++ b/htdocs/comm/propal/class/propalestats.class.php @@ -109,9 +109,7 @@ class PropaleStats extends Stats } if ($categid) { - $this->join .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_societe as cs ON cs.fk_soc = p.fk_soc'; - $this->join .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie as c ON c.rowid = cs.fk_categorie'; - $this->where .= ' AND c.rowid = '.((int) $categid); + $this->where .= ' AND EXISTS (SELECT rowid FROM '.MAIN_DB_PREFIX.'categorie_societe as cats WHERE cats.fk_soc = p.fk_soc AND cats.fk_categorie = '.((int) $categid).')'; } } diff --git a/htdocs/comm/propal/contact.php b/htdocs/comm/propal/contact.php index 051ee9de42c..42f3f34f8d4 100644 --- a/htdocs/comm/propal/contact.php +++ b/htdocs/comm/propal/contact.php @@ -69,6 +69,8 @@ if (!empty($user->socid)) { } restrictedArea($user, 'propal', $object->id); +$usercancreate = $user->hasRight("propal", "creer"); + /* * Add a new contact @@ -137,37 +139,25 @@ if ($object->id > 0) { $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'customer'); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'customer'); // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; - if ($user->rights->propal->creer) { + $morehtmlref .= '
'; + if (0) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { - //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ''; - $morehtmlref .= ' : '; - } - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= ''; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index 1bd6cc71d50..f1d1d7ef644 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -90,6 +90,8 @@ if (!empty($user->socid)) { } restrictedArea($user, 'propal', $object->id); +$usercancreate = $user->hasRight("propal", "creer"); + /* * Actions @@ -135,37 +137,25 @@ if ($object->id > 0) { $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'customer'); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'customer'); // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; - if ($user->rights->propal->creer) { + $morehtmlref .= '
'; + if (0) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { - //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ''; - $morehtmlref .= ' : '; - } - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= ''; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/comm/propal/info.php b/htdocs/comm/propal/info.php index 933791bbec2..986601a91bc 100644 --- a/htdocs/comm/propal/info.php +++ b/htdocs/comm/propal/info.php @@ -53,6 +53,8 @@ if (!empty($user->socid)) { } restrictedArea($user, 'propal', $object->id); +$usercancreate = $user->hasRight("propal", "creer"); + /* * View @@ -82,37 +84,25 @@ $morehtmlref = '
'; $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); // Thirdparty -$morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); +$morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; - if ($user->rights->propal->creer) { + $morehtmlref .= '
'; + if (0) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { - //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ''; - $morehtmlref .= ' : '; - } - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= '
'; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= ''; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/comm/propal/note.php b/htdocs/comm/propal/note.php index c3af3a9b73e..fe4895ad2f8 100644 --- a/htdocs/comm/propal/note.php +++ b/htdocs/comm/propal/note.php @@ -59,6 +59,8 @@ $hookmanager->initHooks(array('propalnote')); restrictedArea($user, 'propal', $object->id, 'propal'); +$usercancreate = $user->hasRight("propal", "creer"); + /* * Actions @@ -107,37 +109,25 @@ if ($object->id > 0) { $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; - if ($user->rights->propal->creer) { + $morehtmlref .= '
'; + if (0) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { - //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ''; - $morehtmlref .= ' : '; - } - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= '
'; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= ''; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 7b447aaf941..786fb1a2ad2 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2326,39 +2326,28 @@ if ($action == 'create' && $usercancreate) { $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string'.(isset($conf->global->THIRDPARTY_REF_INPUT_SIZE) ? ':'.$conf->global->THIRDPARTY_REF_INPUT_SIZE : ''), '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$soc->getNomUrl(1, 'customer'); + $morehtmlref .= '
'.$soc->getNomUrl(1, 'customer'); if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) { $morehtmlref .= ' ('.$langs->trans("OtherOrders").')'; } // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; + $morehtmlref .= '
'; if ($usercancreate) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; - } - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= '
'; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1, 0, 'maxwidth500'); - $morehtmlref .= ''; - $morehtmlref .= ''; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/commande/class/commandestats.class.php b/htdocs/commande/class/commandestats.class.php index d02d56175ff..5f13cf780f4 100644 --- a/htdocs/commande/class/commandestats.class.php +++ b/htdocs/commande/class/commandestats.class.php @@ -109,9 +109,7 @@ class CommandeStats extends Stats } if ($categid) { - $this->join .= ' LEFT JOIN '.$this->categ_link.' as cats ON cats.fk_soc = c.fk_soc'; - $this->join .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie as cat ON cat.rowid = cats.fk_categorie'; - $this->where .= ' AND cat.rowid = '.((int) $categid); + $this->where .= ' AND EXISTS (SELECT rowid FROM '.$this->categ_link.' as cats WHERE cats.fk_soc = c.fk_soc AND cats.fk_categorie = '.((int) $categid).')'; } } diff --git a/htdocs/commande/contact.php b/htdocs/commande/contact.php index c353287962e..04c16e68aa0 100644 --- a/htdocs/commande/contact.php +++ b/htdocs/commande/contact.php @@ -47,8 +47,11 @@ if ($user->socid) { } $result = restrictedArea($user, 'commande', $id, ''); +$usercancreate = $user->hasRight("commande", "creer"); + $object = new Commande($db); + /* * Ajout d'un nouveau contact */ @@ -130,37 +133,25 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; - if ($user->rights->commande->creer) { + $morehtmlref .= '
'; + if (0) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { - //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $morehtmlref .= ' : '; - } - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= '
'; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->thirdparty->id, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= ''; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php index c341ae59b4e..0c35c3489f7 100644 --- a/htdocs/commande/document.php +++ b/htdocs/commande/document.php @@ -73,7 +73,8 @@ if (!$sortfield) { $object = new Commande($db); -$permissiontoadd = $user->rights->commande->creer; +$usercancreate = $user->hasRight("commande", "creer"); +$permissiontoadd = $usercancreate; // Security check if ($user->socid) { @@ -129,37 +130,25 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; - if ($user->rights->commande->creer) { + $morehtmlref .= '
'; + if (0) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { - //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $morehtmlref .= ' : '; - } - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= '
'; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->thirdparty->id, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= ''; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/commande/info.php b/htdocs/commande/info.php index 4442af6a679..0acc5b793aa 100644 --- a/htdocs/commande/info.php +++ b/htdocs/commande/info.php @@ -50,6 +50,8 @@ if ($user->socid) { } $result = restrictedArea($user, 'commande', $comid, ''); +$usercancreate = $user->hasRight("commande", "creer"); + $object = new Commande($db); if (!$object->fetch($id, $ref) > 0) { dol_print_error($db); @@ -82,37 +84,25 @@ $morehtmlref = '
'; $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); // Thirdparty -$morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); +$morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; - if ($user->rights->commande->creer) { + $morehtmlref .= '
'; + if (0) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { - //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $morehtmlref .= ' : '; - } - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= '
'; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->thirdparty->id, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= ''; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/commande/note.php b/htdocs/commande/note.php index 452e58076c7..e84dd5ad6e1 100644 --- a/htdocs/commande/note.php +++ b/htdocs/commande/note.php @@ -52,6 +52,10 @@ $hookmanager->initHooks(array('ordernote')); $result = restrictedArea($user, 'commande', $id, ''); +$usercancreate = $user->hasRight("commande", "creer"); + +$permissionnote = $user->rights->commande->creer; // Used by the include of actions_setnotes.inc.php + $object = new Commande($db); if (!$object->fetch($id, $ref) > 0) { @@ -59,8 +63,6 @@ if (!$object->fetch($id, $ref) > 0) { exit; } -$permissionnote = $user->rights->commande->creer; // Used by the include of actions_setnotes.inc.php - /* * Actions @@ -101,37 +103,25 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; - if ($user->rights->commande->creer) { + $morehtmlref .= '
'; + if (0) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { - //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $morehtmlref .= ' : '; - } - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= '
'; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= ''; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 919c0372a21..10cf7b624fc 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -4363,39 +4363,28 @@ if ($action == 'create') { $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string'.(isset($conf->global->THIRDPARTY_REF_INPUT_SIZE) ? ':'.$conf->global->THIRDPARTY_REF_INPUT_SIZE : ''), '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'customer'); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'customer'); if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) { $morehtmlref .= ' ('.$langs->trans("OtherBills").')'; } // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; + $morehtmlref .= '
'; if ($usercancreate) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; - } - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= '
'; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= ''; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/compta/facture/class/facturestats.class.php b/htdocs/compta/facture/class/facturestats.class.php index 55ae05ff0a5..5637fd740a0 100644 --- a/htdocs/compta/facture/class/facturestats.class.php +++ b/htdocs/compta/facture/class/facturestats.class.php @@ -118,9 +118,7 @@ class FactureStats extends Stats } if ($categid) { - $this->join .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_societe as cs ON cs.fk_soc = f.fk_soc'; - $this->join .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie as c ON c.rowid = cs.fk_categorie'; - $this->where .= ' AND c.rowid = '.((int) $categid); + $this->where .= ' AND EXISTS (SELECT rowid FROM '.MAIN_DB_PREFIX.'categorie_societe as cats WHERE cats.fk_soc = f.fk_soc AND cats.fk_categorie = '.((int) $categid).')'; } } diff --git a/htdocs/compta/facture/contact.php b/htdocs/compta/facture/contact.php index 62705ffd876..b367301911d 100644 --- a/htdocs/compta/facture/contact.php +++ b/htdocs/compta/facture/contact.php @@ -58,6 +58,8 @@ if ($id > 0 || !empty($ref)) { $result = restrictedArea($user, 'facture', $object->id); +$usercancreate = $user->hasRight("facture", "creer"); + /* * Add a new contact @@ -136,37 +138,25 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'customer'); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'customer'); // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; - if ($user->rights->facture->creer) { + $morehtmlref .= '
'; + if (0) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { - //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $morehtmlref .= ' : '; - } - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= '
'; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= ''; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php index ee3700fd67e..5cec55e2439 100644 --- a/htdocs/compta/facture/document.php +++ b/htdocs/compta/facture/document.php @@ -81,6 +81,8 @@ if ($user->socid) { } $result = restrictedArea($user, 'facture', $object->id, ''); +$usercancreate = $user->hasRight("facture", "creer"); + /* * Actions @@ -140,37 +142,25 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'customer'); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'customer'); // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; - if ($user->rights->facture->creer) { + $morehtmlref .= '
'; + if (0) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { - //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $morehtmlref .= ' : '; - } - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= '
'; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= ''; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/compta/facture/info.php b/htdocs/compta/facture/info.php index 0d70f095d31..1ea28b295c3 100644 --- a/htdocs/compta/facture/info.php +++ b/htdocs/compta/facture/info.php @@ -59,6 +59,8 @@ $isdraft = (($object->statut == Facture::STATUS_DRAFT) ? 1 : 0); $result = restrictedArea($user, 'facture', $object->id, '', '', 'fk_soc', 'rowid', $isdraft); +$usercancreate = $user->hasRight("facture", "creer"); + /* * View @@ -96,37 +98,25 @@ $morehtmlref = '
'; $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); // Thirdparty -$morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'customer'); +$morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'customer'); // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; - if ($user->rights->facture->creer) { + $morehtmlref .= '
'; + if (0) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { - //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $morehtmlref .= ' : '; - } - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= '
'; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= ''; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 2618e688698..9b92e9e018e 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -1420,13 +1420,13 @@ if ($resql) { // Payment mode if (!empty($arrayfields['f.fk_mode_reglement']['checked'])) { print '
'; } // Payment terms if (!empty($arrayfields['f.fk_cond_reglement']['checked'])) { print ''; } // Module source @@ -2129,8 +2129,9 @@ if ($resql) { // Payment mode if (!empty($arrayfields['f.fk_mode_reglement']['checked'])) { - print ''; if (!$i) { $totalarray['nbfield']++; @@ -2139,8 +2140,9 @@ if ($resql) { // Payment terms if (!empty($arrayfields['f.fk_cond_reglement']['checked'])) { - print ''; if (!$i) { $totalarray['nbfield']++; diff --git a/htdocs/compta/facture/note.php b/htdocs/compta/facture/note.php index 451ccbab8c4..af08c6163e2 100644 --- a/htdocs/compta/facture/note.php +++ b/htdocs/compta/facture/note.php @@ -59,6 +59,8 @@ $hookmanager->initHooks(array('invoicenote')); $result = restrictedArea($user, 'facture', $id, ''); +$usercancreate = $user->hasRight("facture", "creer"); + /* * Actions @@ -118,37 +120,25 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'customer'); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'customer'); // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; - if ($user->rights->facture->creer) { + $morehtmlref .= '
'; + if (0) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { - //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $morehtmlref .= ' : '; - } - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= ''; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 531106be626..d475e83c55b 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -349,7 +349,7 @@ if ($object->id > 0) { $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); } // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); if ($type == 'bank-transfer') { if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) { $morehtmlref .= ' ('.$langs->trans("OtherBills").')'; @@ -363,33 +363,20 @@ if ($object->id > 0) { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; - if ($usercancreate) { + if (0) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { - //$morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; - $morehtmlref .= ' : '; - } - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= ''; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index c03a2eea6b5..8be48493d08 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -285,7 +285,7 @@ if ($id > 0 || $ref) { print ''; - print '
'; print $langs->trans('DateEndPropal'); print '
'; - print $form->select_types_paiements($search_paymentmode, 'search_paymentmode', '', 0, 1, 1, 10, 1, '', 1); + print $form->select_types_paiements($search_paymentmode, 'search_paymentmode', '', 0, 1, 1, 0, 1, 'minwidth100 maxwidth100', 1); print ''; - print $form->getSelectConditionsPaiements($search_paymentterms, 'search_paymentterms', -1, 1, 1); + print $form->getSelectConditionsPaiements($search_paymentterms, 'search_paymentterms', -1, 1, 1, 'minwidth100 maxwidth100'); print ''; - $form->form_modes_reglement($_SERVER['PHP_SELF'], $obj->fk_mode_reglement, 'none', '', -1); + $s = $form->form_modes_reglement($_SERVER['PHP_SELF'], $obj->fk_mode_reglement, 'none', '', -1, 0, '', 1); + print ''; + print $s; print ''; - $form->form_conditions_reglement($_SERVER['PHP_SELF'], $obj->fk_cond_reglement, 'none'); + $s = $form->form_conditions_reglement($_SERVER['PHP_SELF'], $obj->fk_cond_reglement, 'none', 0, '', -1, -1, 1); + print ''; + print $s; print '
'.$langs->trans("TransMetod").''; print $form->selectarray("methode", $object->methodes_trans); print '

'; + print '
'; print '
'; print ''; print '
'; diff --git a/htdocs/compta/sociales/note.php b/htdocs/compta/sociales/note.php index c65b731109d..0f85b6ddf06 100644 --- a/htdocs/compta/sociales/note.php +++ b/htdocs/compta/sociales/note.php @@ -102,7 +102,7 @@ if ($id > 0 || !empty($ref)) { $proj->fetch($object->fk_project); $morehtmlref .= ' : '.$proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title); + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } } else { $morehtmlref .= ''; diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index fbe8b4d0c04..8e9c6f2a321 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -1473,39 +1473,38 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Categories if (isModEnabled('categorie') && !empty($user->rights->categorie->lire)) { print '
'.$langs->trans("Categories").''; + print ''; print $form->showCategories($object->id, Categorie::TYPE_CONTACT, 1); print '
'.$langs->trans("ContactByDefaultFor").''; + print ''; print $formcompany->showRoles("roles", $object, 'view', $object->roles); print '
'.$langs->trans("ContactForProposals").''; + print '
'.$langs->trans("ContactForProposals").''; print $object->ref_propal ? $object->ref_propal : $langs->trans("NoContactForAnyProposal"); print '
'; + print '
'; if (isModEnabled("expedition")) { print $langs->trans("ContactForOrdersOrShipments"); } else { print $langs->trans("ContactForOrders"); } - print ''; + print ''; $none = $langs->trans("NoContactForAnyOrder"); if (isModEnabled("expedition")) { $none = $langs->trans("NoContactForAnyOrderOrShipments"); @@ -1515,18 +1514,18 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } if (isModEnabled('contrat')) { - print '
'.$langs->trans("ContactForContracts").''; + print '
'.$langs->trans("ContactForContracts").''; print $object->ref_contrat ? $object->ref_contrat : $langs->trans("NoContactForAnyContract"); print '
'.$langs->trans("ContactForInvoices").''; + print '
'.$langs->trans("ContactForInvoices").''; print $object->ref_facturation ? $object->ref_facturation : $langs->trans("NoContactForAnyInvoice"); print '
'.$langs->trans("DolibarrLogin").''; + print '
'.$langs->trans("DolibarrLogin").''; if ($object->user_id) { $dolibarr_user = new User($db); $result = $dolibarr_user->fetch($object->user_id); diff --git a/htdocs/contrat/agenda.php b/htdocs/contrat/agenda.php index d46f2cb24a7..3a3c5440b30 100644 --- a/htdocs/contrat/agenda.php +++ b/htdocs/contrat/agenda.php @@ -76,6 +76,8 @@ if (!$sortorder) { // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('agendacontract', 'globalcard')); +$permissiontoadd = $user->rights->contrat->creer; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php + /* * Actions @@ -166,40 +168,28 @@ if ($id > 0) { $morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $permtoedit, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $permtoedit, 'string', '', null, null, '', 1, 'getFormatedSupplierRef'); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) { $morehtmlref .= ' ('.$langs->trans("OtherContracts").')'; } // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; - if ($user->rights->contrat->creer) { + $morehtmlref .= '
'; + if (0) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { - //$morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).''; - $morehtmlref .= ' : '; - } - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= '
'; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->thirdparty->id, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= '
'; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 111b2d58fd9..b691524ad92 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -694,6 +694,8 @@ if (empty($reshook)) { $error++; } $objectline->fetch_optionals(); + + $objectline->oldcopy = dol_clone($objectline); } $db->begin(); @@ -977,7 +979,6 @@ if (empty($reshook)) { // Actions to build doc $upload_dir = $conf->contrat->multidir_output[$object->entity]; - $permissiontoadd = $user->rights->contrat->creer; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; // Actions to send emails @@ -1372,39 +1373,28 @@ if ($action == 'create') { $morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->contrat->creer, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->contrat->creer, 'string', '', null, null, '', 1, 'getFormatedSupplierRef'); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) { $morehtmlref .= ' ('.$langs->trans("OtherContracts").')'; } // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; - if ($user->rights->contrat->creer) { + $morehtmlref .= '
'; + if ($permissiontoadd) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; - } - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= '
'; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->thirdparty->id, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= '
'; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 4dd26d5d6a2..7d43da46b37 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -2441,18 +2441,15 @@ class Contrat extends CommonObject * @param int $hidedetails Hide details of lines * @param int $hidedesc Hide description * @param int $hideref Hide ref - * @param null|array $moreparams Array to provide more information - * @return int 0 if KO, 1 if OK + * @param null|array $moreparams Array to provide more information + * @return int < 0 if KO, 0 = no doc generated, > 0 if OK */ public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null) { global $conf, $langs; - $langs->load("contracts"); - $outputlangs->load("products"); - if (!dol_strlen($modele)) { - $modele = 'strato'; + $modele = ''; // No doc template/generation by default if (!empty($this->model_pdf)) { $modele = $this->model_pdf; @@ -2463,9 +2460,15 @@ class Contrat extends CommonObject } } - $modelpath = "core/modules/contract/doc/"; + if (empty($modele)) { + return 0; + } else { + $langs->load("contracts"); + $outputlangs->load("products"); - return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); + $modelpath = "core/modules/contract/doc/"; + return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); + } } /** @@ -2805,7 +2808,8 @@ class ContratLigne extends CommonObjectLine public $table_element = 'contratdet'; /** - * @var string Name to use for 'features' parameter to check module permissions with restrictedArea() + * @var string Name to use for 'features' parameter to check module permissions user->rights->feature with restrictedArea(). + * Undefined means same value than $element. Can be use to force a check on another element for example for class of line, we mention here the parent element. */ public $element_for_permission = 'contrat'; @@ -3388,7 +3392,7 @@ class ContratLigne extends CommonObjectLine } } - // If we change a planned date (start or end), sync dates for all services + // If we change a planned date (start or end) of one contract line, sync dates for all other services too if (!$error && !empty($conf->global->CONTRACT_SYNC_PLANNED_DATE_OF_SERVICES)) { dol_syslog(get_class($this)."::update CONTRACT_SYNC_PLANNED_DATE_OF_SERVICES is on so we update date for all lines", LOG_DEBUG); diff --git a/htdocs/contrat/contact.php b/htdocs/contrat/contact.php index 8ceefe2f168..e5557c28a5b 100644 --- a/htdocs/contrat/contact.php +++ b/htdocs/contrat/contact.php @@ -54,6 +54,8 @@ $object = new Contrat($db); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('contractcard', 'globalcard')); +$permissiontoadd = $user->rights->contrat->creer; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php + /* * Actions @@ -153,37 +155,25 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1, 'getFormatedSupplierRef'); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; - if ($user->rights->contrat->creer) { + $morehtmlref .= '
'; + if (0) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { - //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $morehtmlref .= ' : '; - } - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= '
'; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->thirdparty->id, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= '
'; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php index 19248769ef8..652738f10b5 100644 --- a/htdocs/contrat/document.php +++ b/htdocs/contrat/document.php @@ -139,40 +139,28 @@ if ($object->id) { $morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1, 'getFormatedSupplierRef'); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) { $morehtmlref .= ' ('.$langs->trans("OtherContracts").')'; } // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; - if ($user->rights->contrat->creer) { + $morehtmlref .= '
'; + if (0) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { - //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $morehtmlref .= ' : '; - } - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= '
'; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->thirdparty->id, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= '
'; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/contrat/note.php b/htdocs/contrat/note.php index 391b10718ce..f17cc11f748 100644 --- a/htdocs/contrat/note.php +++ b/htdocs/contrat/note.php @@ -54,6 +54,7 @@ $result = restrictedArea($user, 'contrat', $id); $object = new Contrat($db); $object->fetch($id, $ref); +$permissiontoadd = $user->rights->contrat->creer; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php $permissionnote = $user->rights->contrat->creer; // Used by the include of actions_setnotes.inc.php @@ -110,37 +111,25 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1, 'getFormatedSupplierRef'); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; - if ($user->rights->contrat->creer) { + $morehtmlref .= '
'; + if (0) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { - //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $morehtmlref .= ' : '; - } - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= '
'; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->thirdparty->id, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= '
'; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index 3749b403469..772d2b7ed5d 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -108,6 +108,10 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO $trackid = GETPOST('trackid', 'aZ09'); } + // Set tmp user directory (used to convert images embedded as img src=data:image) + $vardir = $conf->user->dir_output."/".$user->id; + $upload_dir_tmp = $vardir.'/temp'; // TODO Add $keytoavoidconflict in upload_dir path + $subject = ''; //$actionmsg = ''; $actionmsg2 = ''; @@ -359,7 +363,7 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO if (empty($sendcontext)) { $sendcontext = 'standard'; } - $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1, '', '', $trackid, '', $sendcontext); + $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1, '', '', $trackid, '', $sendcontext, '', $upload_dir_tmp); if (!empty($mailfile->error) || !empty($mailfile->errors)) { setEventMessages($mailfile->error, $mailfile->errors, 'errors'); diff --git a/htdocs/core/ajax/constantonoff.php b/htdocs/core/ajax/constantonoff.php index a38b353519f..3a8ffda3ae6 100644 --- a/htdocs/core/ajax/constantonoff.php +++ b/htdocs/core/ajax/constantonoff.php @@ -50,7 +50,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; $action = GETPOST('action', 'aZ09'); // set or del $name = GETPOST('name', 'alpha'); $entity = GETPOST('entity', 'int'); -$value = ((GETPOST('value', 'int') || GETPOST('value', 'int') == '0') ? GETPOST('value', 'int') : 1); +$value = (GETPOST('value', 'aZ09') != '' ? GETPOST('value', 'aZ09') : 1); /* diff --git a/htdocs/core/ajax/onlineSign.php b/htdocs/core/ajax/onlineSign.php index 7866b972db1..c71fed19f6d 100644 --- a/htdocs/core/ajax/onlineSign.php +++ b/htdocs/core/ajax/onlineSign.php @@ -314,6 +314,93 @@ if ($action == "importSignature") { // We should just create an image file with the signature. } } + } elseif ($mode == 'fichinter') { + require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; + require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; + $object = new Fichinter($db); + $object->fetch(0, $ref); + + $upload_dir = !empty($conf->ficheinter->multidir_output[$object->entity])?$conf->ficheinter->multidir_output[$object->entity]:$conf->ficheinter->dir_output; + $upload_dir .= '/'.dol_sanitizeFileName($object->ref).'/'; + $date = dol_print_date(dol_now(), "%Y%m%d%H%M%S"); + $filename = "signatures/".$date."_signature.png"; + if (!is_dir($upload_dir."signatures/")) { + if (!dol_mkdir($upload_dir."signatures/")) { + $response ="Error mkdir. Failed to create dir ".$upload_dir."signatures/"; + $error++; + } + } + + if (!$error) { + $return = file_put_contents($upload_dir.$filename, $data); + if ($return == false) { + $error++; + $response = 'Error file_put_content: failed to create signature file.'; + } + } + + if (!$error) { + // Defined modele of doc + $last_main_doc_file = $object->last_main_doc; + $directdownloadlink = $object->getLastMainDocLink('fichinter'); // url to download the $object->last_main_doc + if (preg_match('/\.pdf/i', $last_main_doc_file)) { + // TODO Use the $last_main_doc_file to defined the $newpdffilename and $sourcefile + $newpdffilename = $upload_dir.$ref."_signed-".$date.".pdf"; + $sourcefile = $upload_dir.$ref.".pdf"; + + if (dol_is_file($sourcefile)) { + // We build the new PDF + $pdf = pdf_getInstance(); + if (class_exists('TCPDF')) { + $pdf->setPrintHeader(false); + $pdf->setPrintFooter(false); + } + $pdf->SetFont(pdf_getPDFFont($langs)); + + if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { + $pdf->SetCompression(false); + } + + + //$pdf->Open(); + $pagecount = $pdf->setSourceFile($sourcefile); // original PDF + $s = array(); // Array with size of each page. Exemple array(w'=>210, 'h'=>297); + for ($i=1; $i<($pagecount+1); $i++) { + try { + $tppl = $pdf->importPage($i); + $s = $pdf->getTemplatesize($tppl); + $pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L'); + $pdf->useTemplate($tppl); + } catch (Exception $e) { + dol_syslog("Error when manipulating some PDF by onlineSign: ".$e->getMessage(), LOG_ERR); + $response = $e->getMessage(); + $error++; + } + } + + // A signature image file is 720 x 180 (ratio 1/4) but we use only the size into PDF + // TODO Get position of box from PDF template + $xforimgstart = 105; + $yforimgstart = (empty($s['h']) ? 250 : $s['h'] - 57); + $wforimg = $s['w']/1 - ($xforimgstart + 16); + $pdf->Image($upload_dir.$filename, $xforimgstart, $yforimgstart, $wforimg, round($wforimg / 4)); + //$pdf->Close(); + $pdf->Output($newpdffilename, "F"); + + // Index the new file and update the last_main_doc property of object. + $object->indexFile($newpdffilename, 1); + } + if (!$error) { + $response = "success"; + } + } elseif (preg_match('/\.odt/i', $last_main_doc_file)) { + // Adding signature on .ODT not yet supported + // TODO + } else { + // Document format not supported to insert online signature. + // We should just create an image file with the signature. + } + } } } else { $error++; diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index b3ff0aae930..ed2bcef8034 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -120,6 +120,10 @@ class CMailFile * @var array filenames list (List of attached file name in message) */ public $mimefilename_list = array(); + /** + * @var array filenames cid + */ + public $cid_list = array(); // Image public $html; @@ -159,8 +163,9 @@ class CMailFile * @param string $moreinheader More in header. $moreinheader must contains the "\r\n" (TODO not supported for other MAIL_SEND_MODE different than 'mail' and 'smtps' for the moment) * @param string $sendcontext 'standard', 'emailing', ... (used to define which sending mode and parameters to use) * @param string $replyto Reply-to email (will be set to same value than From by default if not provided) + * @param string $upload_dir_tmp Temporary directory (used to convert images embedded as img src=data:image) */ - public function __construct($subject, $to, $from, $msg, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array(), $addr_cc = "", $addr_bcc = "", $deliveryreceipt = 0, $msgishtml = 0, $errors_to = '', $css = '', $trackid = '', $moreinheader = '', $sendcontext = 'standard', $replyto = '') + public function __construct($subject, $to, $from, $msg, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array(), $addr_cc = "", $addr_bcc = "", $deliveryreceipt = 0, $msgishtml = 0, $errors_to = '', $css = '', $trackid = '', $moreinheader = '', $sendcontext = 'standard', $replyto = '', $upload_dir_tmp = '') { global $conf, $dolibarr_main_data_root, $user; @@ -171,6 +176,8 @@ class CMailFile } } + $cid_list = array(); + $this->sendcontext = $sendcontext; // Define this->sendmode ('mail', 'smtps', 'siwftmailer', ...) according to $sendcontext ('standard', 'emailing', 'ticket') @@ -248,26 +255,41 @@ class CMailFile $findimg = 0; if (!empty($conf->global->MAIN_MAIL_ADD_INLINE_IMAGES_IF_IN_MEDIAS)) { + // Search into the body for ]*>/", " ", $strContent); - $strContentAltText = html_entity_decode(strip_tags($strContentAltText)); + // TODO We could replace with [Filename.ext] like Gmail do. + $strContentAltText = html_entity_decode(strip_tags($strContentAltText)); // Remove any HTML tags $strContentAltText = trim(wordwrap($strContentAltText, 75, empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA) ? "\r\n" : "\n")); // Check if html header already in message, if not complete the message @@ -1447,9 +1470,10 @@ class CMailFile * @param array $filename_list Tableau * @param array $mimetype_list Tableau * @param array $mimefilename_list Tableau - * @return string Chaine fichiers encodes + * @param array $cidlist Array of CID if file must be completed with CID code + * @return string String with files encoded */ - public function write_files($filename_list, $mimetype_list, $mimefilename_list) + private function write_files($filename_list, $mimetype_list, $mimefilename_list, $cidlist) { // phpcs:enable $out = ''; @@ -1472,6 +1496,10 @@ class CMailFile $out .= "Content-Type: ".$mimetype_list[$i]."; name=\"".$filename_list[$i]."\"".$this->eol; $out .= "Content-Transfer-Encoding: base64".$this->eol; $out .= "Content-Description: ".$filename_list[$i].$this->eol; + if (!empty($cidlist) && is_array($cidlist) && $cidlist[$i]) { + $out .= "X-Attachment-Id: ".$cidlist[$i].$this->eol; + $out .= "Content-ID: <".$cidlist[$i].'>'.$this->eol; + } $out .= $this->eol; $out .= $encoded; $out .= $this->eol; @@ -1628,41 +1656,46 @@ class CMailFile /** * Seearch images into html message and init array this->images_encoded if found * - * @param string $images_dir Location of physical images files + * @param string $images_dir Location of physical images files. For example $dolibarr_main_data_root.'/medias' * @return int >0 if OK, <0 if KO */ - public function findHtmlImages($images_dir) + private function findHtmlImages($images_dir) { - // Build the list of image extensions + // Build the array of image extensions $extensions = array_keys($this->image_types); + // We search (into mail body this->html), if we find some strings like "... file=xxx.img" + // For example when: + // $matches = array(); preg_match_all('/(?:"|\')([^"\']+\.('.implode('|', $extensions).'))(?:"|\')/Ui', $this->html, $matches); // If "xxx.ext" or 'xxx.ext' found if (!empty($matches)) { $i = 0; + // We are interested in $matches[1] only (the second set of parenthesis into regex) foreach ($matches[1] as $full) { + $regs = array(); if (preg_match('/file=([A-Za-z0-9_\-\/]+[\.]?[A-Za-z0-9]+)?$/i', $full, $regs)) { // If xxx is 'file=aaa' $img = $regs[1]; if (file_exists($images_dir.'/'.$img)) { // Image path in src $src = preg_quote($full, '/'); - // Image full path $this->html_images[$i]["fullpath"] = $images_dir.'/'.$img; - // Image name $this->html_images[$i]["name"] = $img; - // Content type - if (preg_match('/^.+\.(\w{3,4})$/', $img, $reg)) { - $ext = strtolower($reg[1]); + $regext = array(); + if (preg_match('/^.+\.(\w{3,4})$/', $img, $regext)) { + $ext = strtolower($regext[1]); $this->html_images[$i]["content_type"] = $this->image_types[$ext]; } - // cid $this->html_images[$i]["cid"] = dol_hash(uniqid(time()), 3); // Force md5 hash (does not contains special chars) + // type + $this->html_images[$i]["type"] = 'cidfromurl'; + $this->html = preg_replace("/src=\"$src\"|src='$src'/i", "src=\"cid:".$this->html_images[$i]["cid"]."\"", $this->html); } $i++; @@ -1682,6 +1715,7 @@ class CMailFile // Read image file if ($image = file_get_contents($fullpath)) { // On garde que le nom de l'image + $regs = array(); preg_match('/([A-Za-z0-9_-]+[\.]?[A-Za-z0-9]+)?$/i', $img["name"], $regs); $imgName = $regs[1]; @@ -1706,6 +1740,85 @@ class CMailFile } } + /** + * Seearch images with data:image format into html message + * + * @param string $images_dir Location of where to store physicaly images files. For example $dolibarr_main_data_root.'/medias' + * @return int >0 if OK, <0 if KO + */ + private function findHtmlImagesIsSrcData($images_dir) + { + global $conf; + + // Build the array of image extensions + $extensions = array_keys($this->image_types); + + if ($images_dir && !dol_is_dir($images_dir)) { + dol_mkdir($images_dir, DOL_DATA_ROOT); + } + + // Uncomment this for debug + /* + global $dolibarr_main_data_root; + $outputfile = $dolibarr_main_data_root."/dolibarr_mail.log"; + $fp = fopen($outputfile, "w"); + fwrite($fp, $this->html); + fclose($fp); + */ + + // We search (into mail body this->html), if we find some strings like "... file=xxx.img" + // For example when: + // + $matches = array(); + preg_match_all('/src="data:image\/('.implode('|', $extensions).');base64,([^"]+)"/Ui', $this->html, $matches); // If "xxx.ext" or 'xxx.ext' found + + if (!empty($matches) && !empty($matches[1])) { + if (empty($images_dir)) { + // No temp directory provided, so we are not able to support convertion of data:image into physical images. + $this->error = 'NoTempDirProvidedInCMailConstructorSoCantConvertDataImgOnDisk'; + return -1; + } + + $i = 0; + foreach ($matches[1] as $key => $ext) { + // We save the image to send in disk + $filecontent = $matches[2][$key]; + $cid = dol_hash(uniqid(time()), 3); + $destfiletmp = $images_dir.'/'.$cid.'.'.$ext; + + $fhandle = @fopen($destfiletmp, 'w'); + if ($fhandle) { + $nbofbyteswrote = fwrite($fhandle, base64_decode($filecontent)); + fclose($fhandle); + @chmod($destfiletmp, octdec($conf->global->MAIN_UMASK)); + } else { + $this->errors[] = "Failed to open file '".$destfiletmp."' for write"; + return -1; + } + + if (file_exists($destfiletmp)) { + // Image full path + $this->html_images[$i]["fullpath"] = $destfiletmp; + // Image name + $this->html_images[$i]["name"] = basename($destfiletmp); + // Content type + $this->html_images[$i]["content_type"] = $this->image_types[strtolower($ext)]; + // cid + $this->html_images[$i]["cid"] = $cid; + // type + $this->html_images[$i]["type"] = 'cidfromdata'; + + $this->html = preg_replace('/src="data:image\/'.$ext.';base64,'.preg_quote($filecontent, '/').'"/', 'src="cid:'.$this->html_images[$i]["cid"].'"', $this->html); + } + $i++; + } + + return 1; + } else { + return 0; + } + } + /** * Return a formatted address string for SMTP protocol * diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index d8eb8789d6e..31ca9706889 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -78,7 +78,7 @@ abstract class CommonObject /** * @var array To store error results of ->validateField() */ - public $validateFieldsErrors = array(); + private $validateFieldsErrors = array(); /** * @var string ID to identify managed object @@ -86,7 +86,8 @@ abstract class CommonObject public $element; /** - * @var string Name to use for 'features' parameter to check module permissions with restrictedArea(). Undefined means same value than $element. + * @var string Name to use for 'features' parameter to check module permissions user->rights->feature with restrictedArea(). + * Undefined means same value than $element. Can be use to force a check on another element for example for class of line, we mention here the parent element. */ public $element_for_permission; @@ -136,9 +137,9 @@ abstract class CommonObject public $linkedObjects; /** - * @var boolean Array of boolean with object id as key and value as true if linkedObjects full loaded. Loaded by ->fetchObjectLinked. Important for pdf generation time reduction. + * @var boolean[] Array of boolean with object id as key and value as true if linkedObjects full loaded for object id. Loaded by ->fetchObjectLinked. Important for pdf generation time reduction. */ - public $linkedObjectsFullLoaded = array(); + private $linkedObjectsFullLoaded = array(); /** * @var CommonObject To store a cloned copy of object before to edit it and keep track of old properties @@ -7831,7 +7832,7 @@ abstract class CommonObject * get field error message * * @param string $fieldKey Key of attribute - * @return string + * @return string Error message of validation ('' if no error) */ public function getFieldError($fieldKey) { diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index 007210c8888..edaf088e949 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -163,7 +163,7 @@ class DolEditor $skin = 'moono-lisa'; // default with ckeditor 4.6 : moono-lisa } - $pluginstodisable = 'elementspath,save,flash,div,specialchar'; + $pluginstodisable = 'elementspath,save,flash,div,specialchar,anchor'; if (!empty($conf->dol_optimize_smallscreen)) { $pluginstodisable .= ',scayt,wsc,find,undo'; } @@ -198,7 +198,7 @@ class DolEditor htmlEncodeOutput:'.$htmlencode_force.', allowedContent:'.($disallowAnyContent ? 'false' : 'true').', /* Advanced Content Filter (ACF) is own when allowedContent is false */ extraAllowedContent: \'a[target];div{float,display}\', /* Add the style float and display into div to default other allowed tags */ - disallowedContent: '.($disallowAnyContent ? '\'\'' : '\'\'').', /* Tags that are not allowed */ + disallowedContent: '.($disallowAnyContent ? '\'\'' : '\'\'').', /* Tags that are not allowed */ fullPage: '.($fullpage ? 'true' : 'false').', /* if true, the html, header and body tags are kept */ toolbar: \''.$this->toolbarname.'\', toolbarStartupExpanded: '.($this->toolbarstartexpanded ? 'true' : 'false').', diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 02f9dc5c712..daff55c7615 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5384,9 +5384,10 @@ class Form * @param int $maxlength Max length * @param int $forcefocus Force focus on field (works with javascript only) * @param int $nooutput No print is done. String is returned. + * @param string $textifnoproject Text to show if no project * @return string Return html content */ - public function form_project($page, $socid, $selected = '', $htmlname = 'projectid', $discard_closed = 0, $maxlength = 20, $forcefocus = 0, $nooutput = 0) + public function form_project($page, $socid, $selected = '', $htmlname = 'projectid', $discard_closed = 0, $maxlength = 20, $forcefocus = 0, $nooutput = 0, $textifnoproject = '') { // phpcs:enable global $langs; @@ -5400,7 +5401,6 @@ class Form $langs->load("project"); if ($htmlname != "none") { - $out .= "\n"; $out .= '
'; $out .= ''; $out .= ''; @@ -5412,9 +5412,9 @@ class Form if ($selected) { $projet = new Project($this->db); $projet->fetch($selected); - $out .= $projet->getNomUrl(1, '', 1); + $out .= $projet->getNomUrl(0, '', 1); } else { - $out .= " "; + $out .= ''.$textifnoproject.''; } $out .= ''; } @@ -5439,22 +5439,26 @@ class Form * @param string $deposit_percent < 0 : deposit_percent input makes no sense (for example, in list filters) * 0 : use default deposit percentage from entry * > 0 : force deposit percentage (for example, from company object) + * @param int $nooutput No print is done. String is returned. * @return void */ - public function form_conditions_reglement($page, $selected = '', $htmlname = 'cond_reglement_id', $addempty = 0, $type = '', $filtertype = -1, $deposit_percent = -1) + public function form_conditions_reglement($page, $selected = '', $htmlname = 'cond_reglement_id', $addempty = 0, $type = '', $filtertype = -1, $deposit_percent = -1, $nooutput = 0) { // phpcs:enable global $langs; + + $out = ''; + if ($htmlname != "none") { - print ''; - print ''; - print ''; + $out .= ''; + $out .= ''; + $out .= ''; if ($type) { - print ''; + $out .= ''; } - print $this->getSelectConditionsPaiements($selected, $htmlname, $filtertype, $addempty, 0, '', $deposit_percent); - print ''; - print '
'; + $out .= $this->getSelectConditionsPaiements($selected, $htmlname, $filtertype, $addempty, 0, '', $deposit_percent); + $out .= ''; + $out .= ''; } else { if ($selected) { $this->load_cache_conditions_paiements(); @@ -5465,15 +5469,21 @@ class Form $label = str_replace('__DEPOSIT_PERCENT__', $deposit_percent > 0 ? $deposit_percent : $this->cache_conditions_paiements[$selected]['deposit_percent'], $label); } - print $label; + $out .= $label; } else { $langs->load('errors'); - print $langs->trans('ErrorNotInDictionaryPaymentConditions'); + $out .= $langs->trans('ErrorNotInDictionaryPaymentConditions'); } } else { - print " "; + $out .= ' '; } } + + if (empty($nooutput)) { + print $out; + return ''; + } + return $out; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -5916,19 +5926,20 @@ class Form /** * Output html select to select thirdparty * - * @param string $page Page - * @param string $selected Id preselected - * @param string $htmlname Name of HTML select - * @param string $filter Optional filters criteras. Do not use a filter coming from input of users. - * @param int $showempty Add an empty field - * @param int $showtype Show third party type in combolist (customer, prospect or supplier) - * @param int $forcecombo Force to use combo box - * @param array $events Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) - * @param int $nooutput No print output. Return it only. - * @param array $excludeids Exclude IDs from the select combo + * @param string $page Page + * @param string $selected Id preselected + * @param string $htmlname Name of HTML select + * @param string $filter Optional filters criteras. Do not use a filter coming from input of users. + * @param int $showempty Add an empty field + * @param int $showtype Show third party type in combolist (customer, prospect or supplier) + * @param int $forcecombo Force to use combo box + * @param array $events Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) + * @param int $nooutput No print output. Return it only. + * @param array $excludeids Exclude IDs from the select combo + * @param string $textifnothirdparty Text to show if no thirdparty * @return void|string */ - public function form_thirdparty($page, $selected = '', $htmlname = 'socid', $filter = '', $showempty = 0, $showtype = 0, $forcecombo = 0, $events = array(), $nooutput = 0, $excludeids = array()) + public function form_thirdparty($page, $selected = '', $htmlname = 'socid', $filter = '', $showempty = 0, $showtype = 0, $forcecombo = 0, $events = array(), $nooutput = 0, $excludeids = array(), $textifnothirdparty = '') { // phpcs:enable global $langs; @@ -5946,9 +5957,9 @@ class Form require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; $soc = new Societe($this->db); $soc->fetch($selected); - $out .= $soc->getNomUrl($langs); + $out .= $soc->getNomUrl(0, ''); } else { - $out .= " "; + $out .= ''.$textifnothirdparty.''; } } diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index 99003f00276..6342e08a34e 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -165,9 +165,10 @@ class FormActions * @param int $max Max number of record * @param string $moreparambacktopage More param for the backtopage * @param string $morehtmlcenter More html text on center of title line + * @param int $assignedtouser Assign event by default to this user id (will be ignored if not enough permissions) * @return int <0 if KO, >=0 if OK */ - public function showactions($object, $typeelement, $socid = 0, $forceshowtitle = 0, $morecss = 'listactions', $max = 0, $moreparambacktopage = '', $morehtmlcenter = '') + public function showactions($object, $typeelement, $socid = 0, $forceshowtitle = 0, $morecss = 'listactions', $max = 0, $moreparambacktopage = '', $morehtmlcenter = '', $assignedtouser = 0) { global $langs, $conf, $user; @@ -225,9 +226,21 @@ class FormActions $taskid = $object->id; } + $usercanaddaction = 0; + if (empty($assignedtouser) || $assignedtouser == $user->id) { + $usercanaddaction = $user->hasRight('agenda', 'myactions', 'create'); + $assignedtouser = 0; + } else { + $usercanaddaction = $user->hasRight('agenda', 'allactions', 'create'); + } + $newcardbutton = ''; - if (isModEnabled('agenda') && !empty($user->rights->agenda->myactions->create)) { - $url = DOL_URL_ROOT.'/comm/action/card.php?action=create&token='.newToken().'&datep='.urlencode(dol_print_date(dol_now(), 'dayhourlog', 'tzuser')).'&origin='.urlencode($typeelement).'&originid='.((int) $object->id).((!empty($object->socid) && $object->socid > 0) ? '&socid='.((int) $object->socid) : ((!empty($socid) && $socid > 0) ? '&socid='.((int) $socid) : '')).($projectid > 0 ? '&projectid='.((int) $projectid) : '').($taskid > 0 ? '&taskid='.((int) $taskid) : '').'&backtopage='.urlencode($urlbacktopage); + if (isModEnabled('agenda') && $usercanaddaction) { + $url = DOL_URL_ROOT.'/comm/action/card.php?action=create&token='.newToken().'&datep='.urlencode(dol_print_date(dol_now(), 'dayhourlog', 'tzuser')); + $url .= '&origin='.urlencode($typeelement).'&originid='.((int) $object->id).((!empty($object->socid) && $object->socid > 0) ? '&socid='.((int) $object->socid) : ((!empty($socid) && $socid > 0) ? '&socid='.((int) $socid) : '')); + $url .= ($projectid > 0 ? '&projectid='.((int) $projectid) : '').($taskid > 0 ? '&taskid='.((int) $taskid) : ''); + $url .= ($assignedtouser > 0 ? '&assignedtouser='.$assignedtouser : ''); + $url .= '&backtopage='.urlencode($urlbacktopage); $newcardbutton .= dolGetButtonTitle($langs->trans("AddEvent"), '', 'fa fa-plus-circle', $url); } diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 16302dc3c1a..41cf2482f9a 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -1193,7 +1193,7 @@ class FormMail extends Form $out .= "
'.$langs->trans("MailErrorsTo").''; - $out .= ''; + $out .= ''; $out .= "
'; + $checkbox_selected = (GETPOST('send_email') == "1" ? ' checked' : ($conf->global->TICKETS_MESSAGE_FORCE_MAIL?'checked':'')); + print ' '; + print ''; + print '
'; @@ -1418,12 +1424,6 @@ class FormTicket print '
'; - $checkbox_selected = (GETPOST('send_email') == "1" ? ' checked' : ($conf->global->TICKETS_MESSAGE_FORCE_MAIL?'checked':'')); - print ' '; - print ''; - print '
'; print '

'; - print ''; + print ''; if ($this->withcancel) { print "     "; print ''; diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index 06ada5c4911..92b835caf7f 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -1577,11 +1577,14 @@ class SMTPs // loop through all attachments foreach ($_content as $_file => $_data) { $content .= "--".$this->_getBoundary('mixed')."\r\n" - . 'Content-Disposition: attachment; filename="'.$_data['fileName'].'"'."\r\n" - . 'Content-Type: '.$_data['mimeType'].'; name="'.$_data['fileName'].'"'."\r\n" - . 'Content-Transfer-Encoding: base64'."\r\n" - . 'Content-Description: '.$_data['fileName']."\r\n"; - + . 'Content-Disposition: attachment; filename="'.$_data['fileName'].'"'."\r\n" + . 'Content-Type: '.$_data['mimeType'].'; name="'.$_data['fileName'].'"'."\r\n" + . 'Content-Transfer-Encoding: base64'."\r\n" + . 'Content-Description: '.$_data['fileName']."\r\n"; + if (!empty($_data['cid'])) { + $content .= "X-Attachment-Id: ".$_data['cid']."\r\n"; + $content .= "Content-ID: <".$_data['cid'].">\r\n"; + } if ($this->getMD5flag()) { $content .= 'Content-MD5: '.$_data['md5']."\r\n"; } @@ -1595,9 +1598,9 @@ class SMTPs $content .= "--".$this->_getBoundary('related')."\r\n"; // always related for an inline image $content .= 'Content-Type: '.$_data['mimeType'].'; name="'.$_data['imageName'].'"'."\r\n" - . 'Content-Transfer-Encoding: base64'."\r\n" - . 'Content-Disposition: inline; filename="'.$_data['imageName'].'"'."\r\n" - . 'Content-ID: <'.$_data['cid'].'> '."\r\n"; + . 'Content-Transfer-Encoding: base64'."\r\n" + . 'Content-Disposition: inline; filename="'.$_data['imageName'].'"'."\r\n" + . 'Content-ID: <'.$_data['cid'].'> '."\r\n"; if ($this->getMD5flag()) { $content .= 'Content-MD5: '.$_data['md5']."\r\n"; @@ -1664,9 +1667,10 @@ class SMTPs * @param string $strContent File data to attach to message * @param string $strFileName File Name to give to attachment * @param string $strMimeType File Mime Type of attachment + * @param string $strCid File Cid of attachment (if defined, to be shown inline) * @return void */ - public function setAttachment($strContent, $strFileName = 'unknown', $strMimeType = 'unknown') + public function setAttachment($strContent, $strFileName = 'unknown', $strMimeType = 'unknown', $strCid = '') { if ($strContent) { $strContent = rtrim(chunk_split(base64_encode($strContent), 76, "\r\n")); // 76 max is defined into http://tools.ietf.org/html/rfc2047 @@ -1674,6 +1678,7 @@ class SMTPs $this->_msgContent['attachment'][$strFileName]['mimeType'] = $strMimeType; $this->_msgContent['attachment'][$strFileName]['fileName'] = $strFileName; $this->_msgContent['attachment'][$strFileName]['data'] = $strContent; + $this->_msgContent['attachment'][$strFileName]['cid'] = $strCid; // If defined, it means this attachment must be shown inline if ($this->getMD5flag()) { $this->_msgContent['attachment'][$strFileName]['md5'] = dol_hash($strContent, 3); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 8d6a0ff9414..160dd0b7575 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1160,26 +1160,26 @@ function dol_buildpath($path, $type = 0, $returnemptyifnotfound = 0) /** * Create a clone of instance of object (new instance with same value for properties) - * With native = 0: Property that are reference are also new object (full isolation clone). This means $this->db of new object is not valid. + * With native = 0: Property that are reference are also new object (full isolation clone). This means $this->db of new object may not be valid. * With native = 1: Use PHP clone. Property that are reference are same pointer. This means $this->db of new object is still valid but point to same this->db than original object. * * @param object $object Object to clone - * @param int $native 0=Full isolation method, 1=Native PHP method + * @param int $native 0=Full isolation method, 1=Native PHP method, 2=Full isolation method+destroy non scalar or array properties (recommended) * @return object Clone object * @see https://php.net/manual/language.oop5.cloning.php */ function dol_clone($object, $native = 0) { - if (empty($native)) { + if ($native == 0) { $tmpsavdb = null; if (isset($object->db) && isset($object->db->db) && is_object($object->db->db) && get_class($object->db->db) == 'PgSql\Connection') { $tmpsavdb = $object->db; - unset($object->db); // Such property can not be serialized when PgSql/Connection + unset($object->db); // Such property can not be serialized with pgsl (when object->db->db = 'PgSql\Connection') } $myclone = unserialize(serialize($object)); // serialize then unserialize is hack to be sure to have a new object for all fields - if ($tmpsavdb) { + if (!empty($tmpsavdb)) { $object->db = $tmpsavdb; } } else { @@ -2302,13 +2302,13 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi // Add alias for thirdparty if (!empty($object->name_alias)) { - $morehtmlref .= '
'.$object->name_alias.'
'; + $morehtmlref .= '
'.$object->name_alias.'
'; } // Add label if (in_array($object->element, array('product', 'bank_account', 'project_task'))) { if (!empty($object->label)) { - $morehtmlref .= '
'.$object->label.'
'; + $morehtmlref .= '
'.$object->label.'
'; } } @@ -2323,7 +2323,7 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi } if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && ($conf->global->MAIN_SHOW_TECHNICAL_ID == '1' || preg_match('/'.preg_quote($object->element, '/').'/i', $conf->global->MAIN_SHOW_TECHNICAL_ID)) && !empty($object->id)) { $morehtmlref .= '
'; - $morehtmlref .= '
'; + $morehtmlref .= '
'; $morehtmlref .= $langs->trans("TechnicalID").': '.$object->id; $morehtmlref .= '
'; } @@ -2638,6 +2638,9 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs = $useadodb = getDolGlobalInt('MAIN_USE_LEGACY_ADODB_FOR_DATE', 0); //$useadodb = 1; // To switch to adodb + if (!empty($useadodb)) { + include_once DOL_DOCUMENT_ROOT.'/includes/adodbtime/adodb-time.inc.php'; + } // Analyze date $reg = array(); @@ -2667,8 +2670,8 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs = $dtts->setTimestamp($time); $dtts->setTimezone($tzo); $newformat = str_replace( - array('%Y', '%y', '%m', '%d', '%H', '%M', '%S', 'T', 'Z', '__a__', '__A__', '__b__', '__B__'), - array('Y', 'y', 'm', 'd', 'H', 'i', 's', '__£__', '__$__', '__{__', '__}__', '__[__', '__]__'), + array('%Y', '%y', '%m', '%d', '%H', '%I', '%M', '%S', '%p', 'T', 'Z', '__a__', '__A__', '__b__', '__B__'), + array('Y', 'y', 'm', 'd', 'H', 'h', 'i', 's', 'A', '__£__', '__$__', '__{__', '__}__', '__[__', '__]__'), $format); $ret = $dtts->format($newformat); $ret = str_replace( @@ -2693,8 +2696,8 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs = $dtts->setTimestamp($timetouse); $dtts->setTimezone($tzo); $newformat = str_replace( - array('%Y', '%y', '%m', '%d', '%H', '%M', '%S', 'T', 'Z', '__a__', '__A__', '__b__', '__B__'), - array('Y', 'y', 'm', 'd', 'H', 'i', 's', '__£__', '__$__', '__{__', '__}__', '__[__', '__]__'), + array('%Y', '%y', '%m', '%d', '%H', '%I', '%M', '%S', '%p', 'T', 'Z', '__a__', '__A__', '__b__', '__B__'), + array('Y', 'y', 'm', 'd', 'H', 'h', 'i', 's', 'A', '__£__', '__$__', '__{__', '__}__', '__[__', '__]__'), $format); $ret = $dtts->format($newformat); $ret = str_replace( @@ -8152,7 +8155,7 @@ function print_date_range($date_start, $date_end, $format = '', $outputlangs = ' * * @param int $date_start Start date * @param int $date_end End date - * @param string $format Output format + * @param string $format Output date format ('day', 'dayhour', ...) * @param Translate $outputlangs Output language * @param integer $withparenthesis 1=Add parenthesis, 0=no parenthesis * @return string String diff --git a/htdocs/core/lib/signature.lib.php b/htdocs/core/lib/signature.lib.php index 070cbe0801f..9cc8f1f03a9 100644 --- a/htdocs/core/lib/signature.lib.php +++ b/htdocs/core/lib/signature.lib.php @@ -131,6 +131,21 @@ function getOnlineSignatureUrl($mode, $type, $ref = '', $localorexternal = 1) } else { $out .= '&securekey='.dol_hash($securekeyseed.$type.$ref.(!isModEnabled('multicompany') ? '' : $object->entity), '0'); } + } elseif ($type == 'fichinter') { + $securekeyseed = isset($conf->global->FICHINTER_ONLINE_SIGNATURE_SECURITY_TOKEN) ? $conf->global->FICHINTER_ONLINE_SIGNATURE_SECURITY_TOKEN : ''; + $out = $urltouse.'/public/onlinesign/newonlinesign.php?source=fichinter&ref='.($mode ? '' : ''); + if ($mode == 1) { + $out .= 'fichinter_ref'; + } + if ($mode == 0) { + $out .= urlencode($ref); + } + $out .= ($mode ? '' : ''); + if ($mode == 1) { + $out .= "hash('".$securekeyseed."' + '".$type."' + fichinter_ref)"; + } else { + $out .= '&securekey='.dol_hash($securekeyseed.$type.$ref.(!isModEnabled('multicompany') ? '' : $object->entity), '0'); + } } // For multicompany diff --git a/htdocs/core/lib/ticket.lib.php b/htdocs/core/lib/ticket.lib.php index 9223c1c4dd8..42fbc9786cb 100644 --- a/htdocs/core/lib/ticket.lib.php +++ b/htdocs/core/lib/ticket.lib.php @@ -567,7 +567,7 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no } } - // Set $out to sow events + // Set $out to show events $out = ''; if (!isModEnabled('agenda')) { diff --git a/htdocs/core/modules/modStockTransfer.class.php b/htdocs/core/modules/modStockTransfer.class.php index c834900c2cf..6c8f068adf6 100644 --- a/htdocs/core/modules/modStockTransfer.class.php +++ b/htdocs/core/modules/modStockTransfer.class.php @@ -51,7 +51,7 @@ class modStockTransfer extends DolibarrModules $this->rights_class = 'stocktransfer'; // Family can be 'base' (core modules),'crm','financial','hr','projects','products','ecm','technic' (transverse modules),'interface' (link with external tools),'other','...' // It is used to group modules by family in module setup page - $this->family = "other"; + $this->family = "products"; // Module position in the family on 2 digits ('01', '10', '20', ...) $this->module_position = '90'; // Gives the possibility for the module, to provide his own family info and position of this family (Overwrite $this->family and $this->module_position. Avoid this) @@ -125,7 +125,6 @@ class modStockTransfer extends DolibarrModules $this->conflictwith = array(); // List of module class names as string this module is in conflict with. Example: array('modModuleToDisable1', ...) $this->langfiles = array("stocktransfer@stocktransfer"); $this->phpmin = array(7, 0); // Minimum version of PHP required by module - $this->need_dolibarr_version = array(11, -3); // Minimum version of Dolibarr required by module $this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...) $this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...) //$this->automatic_activation = array('FR'=>'StockTransferWasAutomaticallyActivatedBecauseOfYourCountryChoice'); @@ -138,12 +137,6 @@ class modStockTransfer extends DolibarrModules // ); $this->const = array(); - // Some keys to add into the overwriting translation tables - /*$this->overwrite_translation = array( - 'en_US:ParentCompany'=>'Parent company or reseller', - 'fr_FR:ParentCompany'=>'Maison mère ou revendeur' - )*/ - if (!isset($conf->stocktransfer) || !isset($conf->stocktransfer->enabled)) { $conf->stocktransfer = new stdClass(); $conf->stocktransfer->enabled = 0; @@ -435,15 +428,6 @@ class modStockTransfer extends DolibarrModules $result = $this->_load_tables('/install/mysql/tables/', 'stocktransfer'); if ($result < 0) return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default') - // Create extrafields during init - //include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - //$extrafields = new ExtraFields($this->db); - //$result1=$extrafields->addExtraField('stocktransfer_myattr1', "New Attr 1 label", 'boolean', 1, 3, 'thirdparty', 0, 0, '', '', 1, '', 0, 0, '', '', 'stocktransfer@stocktransfer', '$conf->stocktransfer->enabled'); - //$result2=$extrafields->addExtraField('stocktransfer_myattr2', "New Attr 2 label", 'varchar', 1, 10, 'project', 0, 0, '', '', 1, '', 0, 0, '', '', 'stocktransfer@stocktransfer', '$conf->stocktransfer->enabled'); - //$result3=$extrafields->addExtraField('stocktransfer_myattr3', "New Attr 3 label", 'varchar', 1, 10, 'bank_account', 0, 0, '', '', 1, '', 0, 0, '', '', 'stocktransfer@stocktransfer', '$conf->stocktransfer->enabled'); - //$result4=$extrafields->addExtraField('stocktransfer_myattr4', "New Attr 4 label", 'select', 1, 3, 'thirdparty', 0, 1, '', array('options'=>array('code1'=>'Val1','code2'=>'Val2','code3'=>'Val3')), 1,'', 0, 0, '', '', 'stocktransfer@stocktransfer', '$conf->stocktransfer->enabled'); - //$result5=$extrafields->addExtraField('stocktransfer_myattr5', "New Attr 5 label", 'text', 1, 10, 'user', 0, 0, '', '', 1, '', 0, 0, '', '', 'stocktransfer@stocktransfer', '$conf->stocktransfer->enabled'); - // Permissions $this->remove($options); diff --git a/htdocs/core/tpl/objectline_title.tpl.php b/htdocs/core/tpl/objectline_title.tpl.php index 6d8238cd885..7fe63613ea1 100644 --- a/htdocs/core/tpl/objectline_title.tpl.php +++ b/htdocs/core/tpl/objectline_title.tpl.php @@ -49,19 +49,19 @@ print ''; // Adds a line numbering column if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { - print ' '; + print ' '; } // Description -print ''.$langs->trans('Description').''; +print ''.$langs->trans('Description').''; // Supplier ref if ($this->element == 'supplier_proposal' || $this->element == 'order_supplier' || $this->element == 'invoice_supplier' || $this->element == 'invoice_supplier_rec') { - print ''.$langs->trans("SupplierRef").''; + print ''.$langs->trans("SupplierRef").''; } // VAT -print ''; +print ''; if (!empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) || !empty($conf->global->FACTURE_LOCAL_TAX2_OPTION)) { print $langs->trans('Taxes'); } else { @@ -82,30 +82,30 @@ if (in_array($object->element, array('propal', 'commande', 'facture', 'supplier_ print '
'; } } -print ''; +print ''; // Price HT -print ''.$langs->trans('PriceUHT').''; +print ''.$langs->trans('PriceUHT').''; // Multicurrency if (isModEnabled("multicurrency") && $this->multicurrency_code != $conf->currency) { - print ''.$langs->trans('PriceUHTCurrency', $this->multicurrency_code).''; + print ''.$langs->trans('PriceUHTCurrency', $this->multicurrency_code).''; } if ($inputalsopricewithtax) { - print ''.$langs->trans('PriceUTTC').''; + print ''.$langs->trans('PriceUTTC').''; } // Qty -print ''.$langs->trans('Qty').''; +print ''.$langs->trans('Qty').''; // Unit if (!empty($conf->global->PRODUCT_USE_UNITS)) { - print ''.$langs->trans('Unit').''; + print ''.$langs->trans('Unit').''; } // Reduction short -print ''; +print ''; print $langs->trans('ReductionShort'); if (in_array($object->element, array('propal', 'commande', 'facture')) && $object->status == $object::STATUS_DRAFT) { @@ -122,59 +122,59 @@ if (in_array($object->element, array('propal', 'commande', 'facture')) && $objec print ''; } } -print ''; +print ''; // Fields for situation invoice if (isset($this->situation_cycle_ref) && $this->situation_cycle_ref) { - print ''.$langs->trans('Progress').''; - print ''.$form->textwithpicto($langs->trans('TotalHT100Short'), $langs->trans('UnitPriceXQtyLessDiscount')).''; + print ''.$langs->trans('Progress').''; + print ''.$form->textwithpicto($langs->trans('TotalHT100Short'), $langs->trans('UnitPriceXQtyLessDiscount')).''; } // Purchase price if ($usemargins && isModEnabled('margin') && empty($user->socid)) { if (!empty($user->rights->margins->creer)) { if ($conf->global->MARGIN_TYPE == "1") { - print ''.$langs->trans('BuyingPrice').''; + print ''.$langs->trans('BuyingPrice').''; } else { - print ''.$langs->trans('CostPrice').''; + print ''.$langs->trans('CostPrice').''; } } if (!empty($conf->global->DISPLAY_MARGIN_RATES) && $user->rights->margins->liretous) { - print ''.$langs->trans('MarginRate').''; + print ''.$langs->trans('MarginRate').''; } if (!empty($conf->global->DISPLAY_MARK_RATES) && $user->rights->margins->liretous) { - print ''.$langs->trans('MarkRate').''; + print ''.$langs->trans('MarkRate').''; } } // Total HT -print ''.$langs->trans('TotalHTShort').''; +print ''.$langs->trans('TotalHTShort').''; // Multicurrency if (isModEnabled("multicurrency") && $this->multicurrency_code != $conf->currency) { - print ''.$langs->trans('TotalHTShortCurrency', $this->multicurrency_code).''; + print ''.$langs->trans('TotalHTShortCurrency', $this->multicurrency_code).''; } if ($outputalsopricetotalwithtax) { - print ''.$langs->trans('TotalTTCShort').''; + print ''.$langs->trans('TotalTTCShort').''; } if (isModEnabled('asset') && $object->element == 'invoice_supplier') { - print ''; + print ''; } -print ''; // No width to allow autodim +print ''; // No width to allow autodim -print ''; +print ''; -print ''; +print ''; if ($action == 'selectlines') { - print ''; + print ''; print ''; print ''; - print ''; + print ''; } print "\n"; diff --git a/htdocs/delivery/card.php b/htdocs/delivery/card.php index d458b14b0cb..b98b75015ab 100644 --- a/htdocs/delivery/card.php +++ b/htdocs/delivery/card.php @@ -328,37 +328,25 @@ if ($action == 'create') { $morehtmlref .= $form->editfieldval("RefCustomer", '', $expedition->ref_customer, $expedition, $user->rights->expedition->creer, 'string'.(isset($conf->global->THIRDPARTY_REF_INPUT_SIZE) ? ':'.$conf->global->THIRDPARTY_REF_INPUT_SIZE : ''), '', null, null, '', 1); $morehtmlref .= '
'.$langs->trans("RefDeliveryReceipt").' : '.$object->ref; // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$expedition->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$expedition->thirdparty->getNomUrl(1); // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; - if (0) { // Do not change on shipment + $morehtmlref .= '
'; + if (0) { // Do not change on shipment + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; - } - if ($action == 'classify') { - // $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $expedition->id, $expedition->socid, $expedition->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= '
'; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($expedition->socid, $expedition->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= '
'; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$expedition->id, $expedition->socid, $expedition->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $objectsrc->socid, $objectsrc->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { - $morehtmlref .= ' : '; if (!empty($objectsrc->fk_project)) { $proj = new Project($db); $proj->fetch($objectsrc->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/eventorganization/conferenceorbooth_card.php b/htdocs/eventorganization/conferenceorbooth_card.php index 46e41dec78e..b6932c2cf09 100644 --- a/htdocs/eventorganization/conferenceorbooth_card.php +++ b/htdocs/eventorganization/conferenceorbooth_card.php @@ -203,7 +203,7 @@ if (!empty($withproject)) { $morehtmlref .= $projectstatic->title; // Thirdparty if (isset($projectstatic->thirdparty->id) && $projectstatic->thirdparty->id > 0) { - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$projectstatic->thirdparty->getNomUrl(1, 'project'); + $morehtmlref .= '
'.$projectstatic->thirdparty->getNomUrl(1, 'project'); } $morehtmlref .= ''; diff --git a/htdocs/eventorganization/conferenceorbooth_contact.php b/htdocs/eventorganization/conferenceorbooth_contact.php index 2c304bd8562..7810114aec1 100644 --- a/htdocs/eventorganization/conferenceorbooth_contact.php +++ b/htdocs/eventorganization/conferenceorbooth_contact.php @@ -187,7 +187,7 @@ if (!empty($withproject)) { $morehtmlref .= $projectstatic->title; // Thirdparty if (isset($projectstatic->thirdparty->id) && $projectstatic->thirdparty->id > 0) { - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$projectstatic->thirdparty->getNomUrl(1, 'project'); + $morehtmlref .= '
'.$projectstatic->thirdparty->getNomUrl(1, 'project'); } $morehtmlref .= ''; diff --git a/htdocs/eventorganization/conferenceorbooth_document.php b/htdocs/eventorganization/conferenceorbooth_document.php index 56b34f68b03..78f74ded42d 100644 --- a/htdocs/eventorganization/conferenceorbooth_document.php +++ b/htdocs/eventorganization/conferenceorbooth_document.php @@ -160,7 +160,7 @@ if (!empty($withproject)) { $morehtmlref .= $projectstatic->title; // Thirdparty if (isset($projectstatic->thirdparty->id) && $projectstatic->thirdparty->id > 0) { - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$projectstatic->thirdparty->getNomUrl(1, 'project'); + $morehtmlref .= '
'.$projectstatic->thirdparty->getNomUrl(1, 'project'); } $morehtmlref .= ''; diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php index 520435c9cdc..f69d86c62e7 100644 --- a/htdocs/eventorganization/conferenceorbooth_list.php +++ b/htdocs/eventorganization/conferenceorbooth_list.php @@ -287,7 +287,7 @@ if ($projectid > 0) { $morehtmlref .= $project->title; // Thirdparty if (isset($project->thirdparty->id) && $project->thirdparty->id > 0) { - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$project->thirdparty->getNomUrl(1, 'project'); + $morehtmlref .= '
'.$project->thirdparty->getNomUrl(1, 'project'); } $morehtmlref .= ''; @@ -348,8 +348,15 @@ if ($projectid > 0) { } print ''; - // Date start - end - print ''.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; + // Budget + print ''.$langs->trans("Budget").''; + if (strcmp($project->budget_amount, '')) { + print ''.price($project->budget_amount, '', $langs, 1, 0, 0, $conf->currency).''; + } + print ''; + + // Date start - end project + print ''.$langs->trans("Dates").' ('.$langs->trans("Project").')'; $start = dol_print_date($project->date_start, 'day'); print ($start ? $start : '?'); $end = dol_print_date($project->date_end, 'day'); @@ -360,13 +367,23 @@ if ($projectid > 0) { } print ''; - // Budget - print ''.$langs->trans("Budget").''; - if (strcmp($project->budget_amount, '')) { - print price($project->budget_amount, '', $langs, 1, 0, 0, $conf->currency); + // Date start - end of event + print ''.$langs->trans("Dates").' ('.$langs->trans("Event").')'; + $start = dol_print_date($project->date_start_event, 'day'); + print ($start ? $start : '?'); + $end = dol_print_date($project->date_end_event, 'day'); + print ' - '; + print ($end ? $end : '?'); + if ($object->hasDelay()) { + print img_warning("Late"); } print ''; + // Location event + print ''.$langs->trans("Location").''; + print $project->location; + print ''; + // Other attributes $cols = 2; $objectconf = $object; diff --git a/htdocs/eventorganization/conferenceorboothattendee_card.php b/htdocs/eventorganization/conferenceorboothattendee_card.php index 20d7e588bf3..9bab2a7f49d 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_card.php +++ b/htdocs/eventorganization/conferenceorboothattendee_card.php @@ -234,7 +234,7 @@ if (!empty($withproject)) { $morehtmlref .= $projectstatic->title; // Thirdparty if ($projectstatic->thirdparty->id > 0) { - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$projectstatic->thirdparty->getNomUrl(1, 'project'); + $morehtmlref .= '
'.$projectstatic->thirdparty->getNomUrl(1, 'project'); } $morehtmlref .= ''; diff --git a/htdocs/eventorganization/conferenceorboothattendee_list.php b/htdocs/eventorganization/conferenceorboothattendee_list.php index 167a79959f5..1bc9c12d4f6 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_list.php +++ b/htdocs/eventorganization/conferenceorboothattendee_list.php @@ -413,7 +413,7 @@ if ($projectstatic->id > 0 || $confOrBooth > 0) { $morehtmlref .= $projectstatic->title; // Thirdparty if ($projectstatic->thirdparty->id > 0) { - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$projectstatic->thirdparty->getNomUrl(1, 'project'); + $morehtmlref .= '
'.$projectstatic->thirdparty->getNomUrl(1, 'project'); } $morehtmlref .= ''; @@ -474,8 +474,15 @@ if ($projectstatic->id > 0 || $confOrBooth > 0) { } print ''; - // Date start - end - print ''.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; + // Budget + print ''.$langs->trans("Budget").''; + if (strcmp($projectstatic->budget_amount, '')) { + print ''.price($projectstatic->budget_amount, '', $langs, 1, 0, 0, $conf->currency).''; + } + print ''; + + // Date start - end project + print ''.$langs->trans("Dates").' ('.$langs->trans("Project").')'; $start = dol_print_date($projectstatic->date_start, 'day'); print ($start ? $start : '?'); $end = dol_print_date($projectstatic->date_end, 'day'); @@ -486,13 +493,23 @@ if ($projectstatic->id > 0 || $confOrBooth > 0) { } print ''; - // Budget - print ''.$langs->trans("Budget").''; - if (strcmp($projectstatic->budget_amount, '')) { - print price($projectstatic->budget_amount, '', $langs, 1, 0, 0, $conf->currency); + // Date start - end of event + print ''.$langs->trans("Dates").' ('.$langs->trans("Event").')'; + $start = dol_print_date($projectstatic->date_start_event, 'day'); + print ($start ? $start : '?'); + $end = dol_print_date($projectstatic->date_end_event, 'day'); + print ' - '; + print ($end ? $end : '?'); + if ($projectstatic->hasDelay()) { + print img_warning("Late"); } print ''; + // Location event + print ''.$langs->trans("Location").''; + print $projectstatic->location; + print ''; + // Other attributes $cols = 2; $objectconf = $object; diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 6c880a6e425..f002dc8fe27 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1742,39 +1742,25 @@ if ($action == 'create') { $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, $user->rights->expedition->creer, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, $user->rights->expedition->creer, 'string'.(isset($conf->global->THIRDPARTY_REF_INPUT_SIZE) ? ':'.$conf->global->THIRDPARTY_REF_INPUT_SIZE : ''), '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; - if (0) { // Do not change on shipment + $morehtmlref .= '
'; + if (0) { // Do not change on shipment + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; - } - if ($action == 'classify') { - // $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= '
'; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= '
'; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $objectsrc->socid, $objectsrc->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { - // We don't have project on shipment, so we will use the project or source object instead - // TODO Add project on shipment - $morehtmlref .= ' : '; - if (!empty($objectsrc->fk_project)) { + if (!empty($objectsrc) && !empty($objectsrc->fk_project)) { $proj = new Project($db); $proj->fetch($objectsrc->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/expedition/contact.php b/htdocs/expedition/contact.php index 4c540adcd9e..48822121fa3 100644 --- a/htdocs/expedition/contact.php +++ b/htdocs/expedition/contact.php @@ -148,39 +148,25 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= $form->editfieldkey("RefCustomer", '', $object->ref_customer, $object, $user->rights->expedition->creer, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefCustomer", '', $object->ref_customer, $object, $user->rights->expedition->creer, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; - if (0) { // Do not change on shipment + $morehtmlref .= '
'; + if (0) { // Do not change on shipment + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; - } - if ($action == 'classify') { - // $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= '
'; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= '
'; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $objectsrc->socid, $objectsrc->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { - // We don't have project on shipment, so we will use the project or source object instead - // TODO Add project on shipment - $morehtmlref .= ' : '; - if (!empty($objectsrc->fk_project)) { + if (!empty($objectsrc) && !empty($objectsrc->fk_project)) { $proj = new Project($db); $proj->fetch($objectsrc->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/expedition/document.php b/htdocs/expedition/document.php index 71e325677e6..517c1cea8d2 100644 --- a/htdocs/expedition/document.php +++ b/htdocs/expedition/document.php @@ -66,8 +66,26 @@ if (!$sortfield) { $object = new Expedition($db); -if ($object->fetch($id, $ref)) { +if ($id > 0 || !empty($ref)) { + $object->fetch($id, $ref); $object->fetch_thirdparty(); + + if (!empty($object->origin)) { + $typeobject = $object->origin; + $origin = $object->origin; + $object->fetch_origin(); + } + + // Linked documents + if ($typeobject == 'commande' && $object->$typeobject->id && isModEnabled('commande')) { + $objectsrc = new Commande($db); + $objectsrc->fetch($object->$typeobject->id); + } + if ($typeobject == 'propal' && $object->$typeobject->id && isModEnabled("propal")) { + $objectsrc = new Propal($db); + $objectsrc->fetch($object->$typeobject->id); + } + $upload_dir = $conf->expedition->dir_output."/sending/".dol_sanitizeFileName($object->ref); } @@ -118,43 +136,29 @@ if ($id > 0 || !empty($ref)) { $morehtmlref = '
'; // Ref customer - $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); - $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); + $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, 0, 'string', '', 0, 1); + $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, 0, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; - if (0) { // Do not change on shipment + $morehtmlref .= '
'; + if (0) { // Do not change on shipment + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; - } - if ($action == 'classify') { - // $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= '
'; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= '
'; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $objectsrc->socid, $objectsrc->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { - // We don't have project on shipment, so we will use the project or source object instead - // TODO Add project on shipment - $morehtmlref .= ' : '; if (!empty($objectsrc->fk_project)) { $proj = new Project($db); $proj->fetch($objectsrc->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/expedition/note.php b/htdocs/expedition/note.php index d23bb0298ea..4401af0b20c 100644 --- a/htdocs/expedition/note.php +++ b/htdocs/expedition/note.php @@ -109,39 +109,25 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= $form->editfieldkey("RefCustomer", '', $object->ref_customer, $object, $user->rights->expedition->creer, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefCustomer", '', $object->ref_customer, $object, $user->rights->expedition->creer, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; - if (0) { // Do not change on shipment + $morehtmlref .= '
'; + if (0) { // Do not change on shipment + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; - } - if ($action == 'classify') { - // $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= '
'; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= '
'; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $objectsrc->socid, $objectsrc->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { - // We don't have project on shipment, so we will use the project or source object instead - // TODO Add project on shipment - $morehtmlref .= ' : '; - if (!empty($objectsrc->fk_project)) { + if (!empty($objectsrc) && !empty($objectsrc->fk_project)) { $proj = new Project($db); $proj->fetch($objectsrc->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 97162f4aaf2..9394269a03a 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -283,39 +283,28 @@ if ($id > 0 || !empty($ref)) { $morehtmlref = '
'; // Ref customer - $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', 0, 1); - $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', null, null, '', 1); + $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', 0, 1); + $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_customer', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$soc->getNomUrl(1); + $morehtmlref .= '
'.$soc->getNomUrl(1); // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; - if ($user->rights->commande->creer) { + $morehtmlref .= '
'; + if (0) { // Do not change on shipment + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; - } - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= '
'; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= '
'; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $objectsrc->socid, $objectsrc->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { - if (!empty($object->fk_project)) { + if (!empty($objectsrc) && !empty($objectsrc->fk_project)) { $proj = new Project($db); - $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $proj->fetch($objectsrc->fk_project); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index bb4f41861ec..4bb9bf378ee 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -1694,44 +1694,6 @@ if ($action == 'create') { $linkback = ''.$langs->trans("BackToList").''; $morehtmlref = '
'; - /* - // Ref customer - $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', 0, 1); - $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', null, null, '', 1); - // Thirdparty - $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1); - // Project - if (isModEnabled('project')) - { - $langs->load("projects"); - $morehtmlref.='
'.$langs->trans('Project') . ' '; - if ($user->rights->commande->creer) - { - if ($action != 'classify') - $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref.='
'; - $morehtmlref.=''; - $morehtmlref.=''; - $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref.=''; - $morehtmlref.='
'; - } else { - $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); - } - } else { - if (!empty($object->fk_project)) { - $proj = new Project($db); - $proj->fetch($object->fk_project); - $morehtmlref.=''; - $morehtmlref.=$proj->ref; - $morehtmlref.=''; - } else { - $morehtmlref.=''; - } - } - }*/ $morehtmlref .= '
'; dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index cef3f737c53..a0d7cab9f51 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -1159,7 +1159,7 @@ if ($action == 'create') { $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->ficheinter->creer, 'string', '', 0, 1); $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->ficheinter->creer, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'customer'); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'customer'); // Project if (isModEnabled('project')) { $langs->load("projects"); @@ -1713,6 +1713,13 @@ if ($action == 'create') { $linktoelem = $form->showLinkToObjectBlock($object, null, array('fichinter')); $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); + // Show online signature link + if ($object->statut != Fichinter::STATUS_DRAFT && $conf->global->FICHINTER_ALLOW_ONLINE_SIGN) { + print '
'; + require_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php'; + + print showOnlineSignatureUrl('fichinter', $object->ref).'
'; + } print '
'; diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 7a5f3bc73ad..e36598d04bc 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -442,7 +442,7 @@ class Fichinter extends CommonObject $sql .= " f.datec, f.dateo, f.datee, f.datet, f.fk_user_author,"; $sql .= " f.date_valid as datev,"; $sql .= " f.tms as datem,"; - $sql .= " f.duree, f.fk_projet as fk_project, f.note_public, f.note_private, f.model_pdf, f.extraparams, fk_contrat, f.entity as entity"; + $sql .= " f.duree, f.fk_projet as fk_project, f.note_public, f.note_private, f.model_pdf, f.last_main_doc, f.extraparams, fk_contrat, f.entity as entity"; $sql .= " FROM ".MAIN_DB_PREFIX."fichinter as f"; if ($ref) { $sql .= " WHERE f.entity IN (".getEntity('intervention').")"; @@ -482,6 +482,8 @@ class Fichinter extends CommonObject $this->extraparams = (array) json_decode($obj->extraparams, true); + $this->last_main_doc = $obj->last_main_doc; + if ($this->statut == 0) { $this->brouillon = 1; } diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index ccd85e47810..54c7885e080 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -311,9 +311,6 @@ define('MAIN_DB_PREFIX', $dolibarr_main_db_prefix); * To use other version than embeded libraries, define here constant to path. Use '' to use include class path autodetect. */ // Path to root libraries -if (!defined('ADODB_PATH')) { - define('ADODB_PATH', (!isset($dolibarr_lib_ADODB_PATH)) ?DOL_DOCUMENT_ROOT.'/includes/adodbtime/' : (empty($dolibarr_lib_ADODB_PATH) ? '' : $dolibarr_lib_ADODB_PATH.'/')); -} if (!defined('TCPDF_PATH')) { define('TCPDF_PATH', (empty($dolibarr_lib_TCPDF_PATH)) ?DOL_DOCUMENT_ROOT.'/includes/tecnickcom/tcpdf/' : $dolibarr_lib_TCPDF_PATH.'/'); } @@ -354,10 +351,6 @@ if (!defined('DOL_DEFAULT_TTF_BOLD')) { * Include functions */ -if (!defined('ADODB_DATE_VERSION')) { - include_once ADODB_PATH.'adodb-time.inc.php'; -} - // If password is encoded, we decode it. Note: When page is called for install, $dolibarr_main_db_pass may not be defined yet. if ((!empty($dolibarr_main_db_pass) && preg_match('/crypted:/i', $dolibarr_main_db_pass)) || !empty($dolibarr_main_db_encrypted_pass)) { if (!empty($dolibarr_main_db_pass) && preg_match('/crypted:/i', $dolibarr_main_db_pass)) { diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 9e59dbceda6..3e58ceddfce 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1398,7 +1398,7 @@ class CommandeFournisseur extends CommonOrder $sql .= ", '".$this->db->escape($this->ref_supplier)."'"; $sql .= ", '".$this->db->escape($this->note_private)."'"; $sql .= ", '".$this->db->escape($this->note_public)."'"; - $sql .= ", ".((int) $conf->entity); + $sql .= ", ".setEntity($this); $sql .= ", ".((int) $this->socid); $sql .= ", ".($this->fk_project > 0 ? ((int) $this->fk_project) : "null"); $sql .= ", '".$this->db->idate($date)."'"; @@ -3187,26 +3187,28 @@ class CommandeFournisseur extends CommonOrder * @param int $hidedesc Hide description * @param int $hideref Hide ref * @param null|array $moreparams Array to provide more information - * @return int 0 if KO, 1 if OK + * @return int < 0 if KO, 0 = no doc generated, > 0 if OK */ public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null) { global $conf, $langs; - $langs->load("suppliers"); - $outputlangs->load("products"); - if (!dol_strlen($modele)) { - $modele = ''; - if ($this->model_pdf) { + $modele = ''; // No doc template/generation by default + + if (!empty($this->model_pdf)) { $modele = $this->model_pdf; } elseif (!empty($conf->global->COMMANDE_SUPPLIER_ADDON_PDF)) { $modele = $conf->global->COMMANDE_SUPPLIER_ADDON_PDF; } } + if (empty($modele)) { return 0; } else { + $langs->load("suppliers"); + $outputlangs->load("products"); + $modelpath = "core/modules/supplier_order/doc/"; return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); } diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 67cfffdeb7c..5dbe81ca4a4 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -2033,9 +2033,8 @@ if ($action == 'create') { $morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $usercancreate, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $usercancreate, 'string'.(isset($conf->global->THIRDPARTY_REF_INPUT_SIZE) ? ':'.$conf->global->THIRDPARTY_REF_INPUT_SIZE : ''), '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty'); + $morehtmlref .= '
'; if (!empty($conf->global->MAIN_CAN_EDIT_SUPPLIER_ON_SUPPLIER_ORDER) && !empty($usercancreate) && $action == 'edit_thirdparty') { - $morehtmlref .= ' : '; $morehtmlref .= '
'; $morehtmlref .= ''; $morehtmlref .= ''; @@ -2047,7 +2046,7 @@ if ($action == 'create') { if (!empty($conf->global->MAIN_CAN_EDIT_SUPPLIER_ON_SUPPLIER_ORDER) && $object->statut == CommandeFournisseur::STATUS_DRAFT) { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetThirdParty')).''; } - $morehtmlref .= ' : '.$object->thirdparty->getNomUrl(1, 'supplier'); + $morehtmlref .= $object->thirdparty->getNomUrl(1, 'supplier'); if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) { $morehtmlref .= ' ('.$langs->trans("OtherOrders").')'; } @@ -2056,32 +2055,21 @@ if ($action == 'create') { // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; - if ($usercancreate) { + $morehtmlref .= '
'; + if ($permissiontoadd) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify' && $caneditproject) { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; - } - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $object->socid : -1), $object->fk_project, 'projectid', 0, 0, 1, 1, 1, 0, 0, '', 1, 0, 'maxwidth500'); - $morehtmlref .= ''; - $morehtmlref .= '
'; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $object->socid : -1), $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/fourn/commande/contact.php b/htdocs/fourn/commande/contact.php index 92859d2eb1f..3ca1eca77bf 100644 --- a/htdocs/fourn/commande/contact.php +++ b/htdocs/fourn/commande/contact.php @@ -50,9 +50,12 @@ $hookmanager->initHooks(array('ordersuppliercardcontact')); $object = new CommandeFournisseur($db); +$usercancreate = ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer); +$permissiontoadd = $usercancreate; // Used by the include of actions_addupdatedelete.inc.php + /* - * Add a new contact + * Actions */ if ($action == 'addcontact' && ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer)) { @@ -100,6 +103,7 @@ if ($action == 'addcontact' && ($user->rights->fournisseur->commande->creer || $ /* * View */ + $form = new Form($db); $formcompany = new FormCompany($db); $contactstatic = new Contact($db); @@ -134,37 +138,25 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; - if ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer) { - if ($action != 'classify') { - //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $morehtmlref .= ' : '; - } - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= '
'; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= '
'; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= '
'; + if (0) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); + if ($action != 'classify' && $caneditproject) { + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $object->socid : -1), $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 1a8834941c9..41c15dabb68 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -100,6 +100,9 @@ if (!isModEnabled('stock')) { accessforbidden(); } +$usercancreate = ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer); +$permissiontoadd = $usercancreate; // Used by the include of actions_addupdatedelete.inc.php + /* * Actions @@ -541,37 +544,25 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; - if ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer) { - if ($action != 'classify') { - //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $morehtmlref .= ' : '; - } - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= '
'; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= '
'; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= '
'; + if (0) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); + if ($action != 'classify' && $caneditproject) { + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $object->socid : -1), $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/fourn/commande/document.php b/htdocs/fourn/commande/document.php index 0eba3dbc601..b3dfb8b9ece 100644 --- a/htdocs/fourn/commande/document.php +++ b/htdocs/fourn/commande/document.php @@ -130,37 +130,25 @@ if ($object->id > 0) { $morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; - if ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer) { - if ($action != 'classify') { - //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $morehtmlref .= ' : '; - } - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= '
'; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= '
'; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= '
'; + if (0) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); + if ($action != 'classify' && $caneditproject) { + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $object->socid : -1), $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/fourn/commande/info.php b/htdocs/fourn/commande/info.php index 698fead1a43..fc3918a32f3 100644 --- a/htdocs/fourn/commande/info.php +++ b/htdocs/fourn/commande/info.php @@ -84,6 +84,8 @@ if (empty($user->rights->fournisseur->commande->lire)) { // Init Hooks $hookmanager->initHooks(array('ordersuppliercardinfo')); +$usercancreate = ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer); +$permissiontoadd = $usercancreate; // Used by the include of actions_addupdatedelete.inc.php /* @@ -141,37 +143,25 @@ $morehtmlref = '
'; $morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1); // Thirdparty -$morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); +$morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; - if ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer) { - if ($action != 'classify') { - //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $morehtmlref .= ' : '; - } - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= '
'; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= '
'; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= '
'; + if (0) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); + if ($action != 'classify' && $caneditproject) { + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $object->socid : -1), $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/fourn/commande/note.php b/htdocs/fourn/commande/note.php index 167c506b651..33648dd9817 100644 --- a/htdocs/fourn/commande/note.php +++ b/htdocs/fourn/commande/note.php @@ -56,6 +56,8 @@ $object->fetch($id, $ref); // Permissions $permissionnote = ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer); // Used by the include of actions_setnotes.inc.php +$usercancreate = ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer); +$permissiontoadd = $usercancreate; // Used by the include of actions_addupdatedelete.inc.php /* @@ -110,37 +112,25 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; - if ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer) { - if ($action != 'classify') { - //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $morehtmlref .= ' : '; - } - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= '
'; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= '
'; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= '
'; + if (0) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); + if ($action != 'classify' && $caneditproject) { + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $object->socid : -1), $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 44337454772..1738dd69868 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -2873,39 +2873,28 @@ if ($action == 'create') { $morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $usercancreate, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $usercancreate, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'supplier'); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'supplier'); if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) { $morehtmlref .= ' ('.$langs->trans("OtherBills").')'; } // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; - if ($usercancreate) { + $morehtmlref .= '
'; + if ($permissiontoadd) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; - } - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= '
'; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $object->socid : -1), $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= '
'; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $object->socid : -1), $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/fourn/facture/contact.php b/htdocs/fourn/facture/contact.php index f9f7a754b8f..542b37db092 100644 --- a/htdocs/fourn/facture/contact.php +++ b/htdocs/fourn/facture/contact.php @@ -51,6 +51,9 @@ $hookmanager->initHooks(array('invoicesuppliercardcontact')); $object = new FactureFournisseur($db); +$usercancreate = ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer); +$permissiontoadd = $usercancreate; + /* * Ajout d'un nouveau contact @@ -133,40 +136,28 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) { $morehtmlref .= ' ('.$langs->trans("OtherBills").')'; } // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; - if ($user->rights->facture->creer) { + $morehtmlref .= '
'; + if (0) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { - //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $morehtmlref .= ' : '; - } - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= '
'; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= '
'; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $object->socid : -1), $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/fourn/facture/document.php b/htdocs/fourn/facture/document.php index fa08b721370..03012acbcaf 100644 --- a/htdocs/fourn/facture/document.php +++ b/htdocs/fourn/facture/document.php @@ -112,40 +112,28 @@ if ($object->id > 0) { $morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) { $morehtmlref .= ' ('.$langs->trans("OtherBills").')'; } // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; - if ($user->rights->facture->creer) { + $morehtmlref .= '
'; + if (0) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { - //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $morehtmlref .= ' : '; - } - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= '
'; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= '
'; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $object->socid : -1), $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/fourn/facture/info.php b/htdocs/fourn/facture/info.php index a4322c2448e..9223d47b791 100644 --- a/htdocs/fourn/facture/info.php +++ b/htdocs/fourn/facture/info.php @@ -49,6 +49,9 @@ $hookmanager->initHooks(array('invoicesuppliercardinfo')); $object = new FactureFournisseur($db); +$usercancreate = ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer); +$permissiontoadd = $usercancreate; + /* * View @@ -75,40 +78,28 @@ $morehtmlref = '
'; $morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1); // Thirdparty -$morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); +$morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) { $morehtmlref .= ' ('.$langs->trans("OtherBills").')'; } // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; - if ($user->rights->facture->creer) { + $morehtmlref .= '
'; + if (0) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { - //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $morehtmlref .= ' : '; - } - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= '
'; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->thirdparty->id, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= '
'; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $object->socid : -1), $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/fourn/facture/note.php b/htdocs/fourn/facture/note.php index e1eb788723f..1c61fdc8e07 100644 --- a/htdocs/fourn/facture/note.php +++ b/htdocs/fourn/facture/note.php @@ -53,6 +53,8 @@ $result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture'); $object = new FactureFournisseur($db); $object->fetch($id, $ref); +$usercancreate = ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer); +$permissiontoadd = $usercancreate; $permissionnote = ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer); // Used by the include of actions_setnotes.inc.php @@ -106,40 +108,28 @@ if ($object->id > 0) { $morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) { $morehtmlref .= ' ('.$langs->trans("OtherBills").')'; } // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; - if ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer) { + $morehtmlref .= '
'; + if (0) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { - // $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $morehtmlref .= ' : '; - } - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= '
'; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= '
'; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $object->socid : -1), $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/fourn/paiement/document.php b/htdocs/fourn/paiement/document.php index e26734ed9c6..2e61322997a 100644 --- a/htdocs/fourn/paiement/document.php +++ b/htdocs/fourn/paiement/document.php @@ -123,7 +123,7 @@ if ($object->id > 0) { $morehtmlref .= $object->num_payment ? ' - '.$object->num_payment : ''; // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); // Amount $morehtmlref .= '
'.$langs->trans('Amount').' : '. price($object->amount, '', $langs, 0, 0, -1, $conf->currency); diff --git a/htdocs/hrm/admin/job_extrafields.php b/htdocs/hrm/admin/job_extrafields.php index 8dff50f4b6f..6ac0773c00f 100644 --- a/htdocs/hrm/admin/job_extrafields.php +++ b/htdocs/hrm/admin/job_extrafields.php @@ -67,7 +67,7 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; * View */ -$textobject = $langs->transnoentitiesnoconv("Job"); +$textobject = $langs->transnoentitiesnoconv("JobPosition"); $help_url = ''; $page_name = "HrmSetup"; diff --git a/htdocs/hrm/lib/hrm.lib.php b/htdocs/hrm/lib/hrm.lib.php index 2fef293784d..88a851f0137 100644 --- a/htdocs/hrm/lib/hrm.lib.php +++ b/htdocs/hrm/lib/hrm.lib.php @@ -54,13 +54,13 @@ function hrmAdminPrepareHead() $head[$h][2] = 'establishments'; $h++; - $head[$h][0] = DOL_URL_ROOT . '/hrm/admin/evaluation_extrafields.php'; - $head[$h][1] = $langs->trans("EvaluationsExtraFields"); - $nbExtrafields = $extrafields->attributes['hrm_evaluation']['count']; + $head[$h][0] = DOL_URL_ROOT . '/hrm/admin/skill_extrafields.php'; + $head[$h][1] = $langs->trans("SkillsExtraFields"); + $nbExtrafields = $extrafields->attributes['hrm_skill']['count']; if ($nbExtrafields > 0) { $head[$h][1] .= ''.$nbExtrafields.''; } - $head[$h][2] = 'evaluationsAttributes'; + $head[$h][2] = 'skillsAttributes'; $h++; $head[$h][0] = DOL_URL_ROOT . '/hrm/admin/job_extrafields.php'; @@ -72,13 +72,13 @@ function hrmAdminPrepareHead() $head[$h][2] = 'jobsAttributes'; $h++; - $head[$h][0] = DOL_URL_ROOT . '/hrm/admin/skill_extrafields.php'; - $head[$h][1] = $langs->trans("SkillsExtraFields"); - $nbExtrafields = $extrafields->attributes['hrm_skill']['count']; + $head[$h][0] = DOL_URL_ROOT . '/hrm/admin/evaluation_extrafields.php'; + $head[$h][1] = $langs->trans("EvaluationsExtraFields"); + $nbExtrafields = $extrafields->attributes['hrm_evaluation']['count']; if ($nbExtrafields > 0) { $head[$h][1] .= ''.$nbExtrafields.''; } - $head[$h][2] = 'skillsAttributes'; + $head[$h][2] = 'evaluationsAttributes'; $h++; // Show more tabs from modules diff --git a/htdocs/install/inc.php b/htdocs/install/inc.php index c717d55850e..e68f0d70a96 100644 --- a/htdocs/install/inc.php +++ b/htdocs/install/inc.php @@ -35,24 +35,16 @@ require_once '../filefunc.inc.php'; -// Define DOL_DOCUMENT_ROOT and ADODB_PATH used for install/upgrade process +// Define DOL_DOCUMENT_ROOT used for install/upgrade process if (!defined('DOL_DOCUMENT_ROOT')) { define('DOL_DOCUMENT_ROOT', '..'); } -if (!defined('ADODB_PATH')) { - $foundpath = DOL_DOCUMENT_ROOT.'/includes/adodbtime/'; - if (!is_dir($foundpath)) { - $foundpath = '/usr/share/php/adodb/'; - } - define('ADODB_PATH', $foundpath); -} require_once DOL_DOCUMENT_ROOT.'/core/class/translate.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/conf.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; -require_once ADODB_PATH.'adodb-time.inc.php'; $conf = new Conf(); diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index 60803396be3..d5deec862d0 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -698,6 +698,9 @@ ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD COLUMN firstnam ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD COLUMN lastname varchar(100); ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD COLUMN email_company varchar(128) after email; +-- VMYSQL4.3 ALTER TABLE llx_eventorganization_conferenceorboothattendee MODIFY COLUMN fk_user_creat integer NULL; +-- VPGSQL8.2 ALTER TABLE llx_eventorganization_conferenceorboothattendee ALTER COLUMN fk_user_creat DROP NOT NULL; + ALTER TABLE llx_c_email_templates ADD COLUMN joinfiles text; ALTER TABLE llx_c_email_templates ADD COLUMN email_from varchar(255); diff --git a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql index 1dfcd489ee9..91b45bc052f 100644 --- a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql +++ b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql @@ -197,3 +197,161 @@ ALTER TABLE llx_societe_remise_except ADD COLUMN multicurrency_tx double(24,8) N -- VMYSQL4.3 ALTER TABLE llx_hrm_evaluationdet CHANGE COLUMN `rank` rankorder integer; -- VPGSQL8.2 ALTER TABLE llx_hrm_evaluationdet CHANGE COLUMN rank rankorder integer; + +ALTER TABLE llx_projet ADD COLUMN date_start_event datetime; +ALTER TABLE llx_projet ADD COLUMN date_end_event datetime; +ALTER TABLE llx_projet ADD COLUMN location varchar(255); + + +ALTER TABLE llx_c_action_trigger MODIFY COLUMN code varchar(128); + +-- +-- List of all managed triggered events (used for trigger agenda automatic events and for notification) +-- + +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('COMPANY_CREATE','Third party created','Executed when a third party is created','societe',1); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('COMPANY_MODIFY','Third party update','Executed when you update third party','societe',1); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('COMPANY_SENTBYMAIL','Mails sent from third party card','Executed when you send email from third party card','societe',1); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('COMPANY_DELETE','Third party deleted','Executed when you delete third party','societe',1); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_VALIDATE','Customer proposal validated','Executed when a commercial proposal is validated','propal',2); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_MODIFY','Customer proposal modified','Executed when a customer proposal is modified','propal',2); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_SENTBYMAIL','Commercial proposal sent by mail','Executed when a commercial proposal is sent by mail','propal',3); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_CLOSE_SIGNED','Customer proposal closed signed','Executed when a customer proposal is closed signed','propal',2); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_CLOSE_REFUSED','Customer proposal closed refused','Executed when a customer proposal is closed refused','propal',2); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_CLASSIFY_BILLED','Customer proposal set billed','Executed when a customer proposal is set to billed','propal',2); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_DELETE','Customer proposal deleted','Executed when a customer proposal is deleted','propal',2); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_VALIDATE','Customer order validate','Executed when a customer order is validated','commande',4); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_CLOSE','Customer order classify delivered','Executed when a customer order is set delivered','commande',5); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_MODIFY','Customer order modified','Executed when a customer order is set modified','commande',5); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_CLASSIFY_BILLED','Customer order classify billed','Executed when a customer order is set to billed','commande',5); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_CANCEL','Customer order canceled','Executed when a customer order is canceled','commande',5); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SENTBYMAIL','Customer order sent by mail','Executed when a customer order is sent by mail ','commande',5); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_DELETE','Customer order deleted','Executed when a customer order is deleted','commande',5); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_VALIDATE','Customer invoice validated','Executed when a customer invoice is approved','facture',6); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_MODIFY','Customer invoice modified','Executed when a customer invoice is modified','facture',7); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_PAYED','Customer invoice payed','Executed when a customer invoice is payed','facture',7); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_CANCEL','Customer invoice canceled','Executed when a customer invoice is conceled','facture',8); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_SENTBYMAIL','Customer invoice sent by mail','Executed when a customer invoice is sent by mail','facture',9); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_UNVALIDATE','Customer invoice unvalidated','Executed when a customer invoice status set back to draft','facture',9); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_DELETE','Customer invoice deleted','Executed when a customer invoice is deleted','facture',9); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPOSAL_SUPPLIER_VALIDATE','Price request validated','Executed when a commercial proposal is validated','proposal_supplier',10); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPOSAL_SUPPLIER_MODIFY','Price request modified','Executed when a commercial proposal is modified','proposal_supplier',10); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPOSAL_SUPPLIER_SENTBYMAIL','Price request sent by mail','Executed when a commercial proposal is sent by mail','proposal_supplier',10); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPOSAL_SUPPLIER_CLOSE_SIGNED','Price request closed signed','Executed when a customer proposal is closed signed','proposal_supplier',10); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPOSAL_SUPPLIER_CLOSE_REFUSED','Price request closed refused','Executed when a customer proposal is closed refused','proposal_supplier',10); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPOSAL_SUPPLIER_DELETE','Price request deleted','Executed when a customer proposal delete','proposal_supplier',10); +--insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_CREATE','Supplier order created','Executed when a supplier order is created','order_supplier',11); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_VALIDATE','Supplier order validated','Executed when a supplier order is validated','order_supplier',12); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_APPROVE','Supplier order request approved','Executed when a supplier order is approved','order_supplier',13); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_MODIFY','Supplier order request modified','Executed when a supplier order is modified','order_supplier',13); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_SUBMIT','Supplier order request submited','Executed when a supplier order is approved','order_supplier',13); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_RECEIVE','Supplier order request received','Executed when a supplier order is received','order_supplier',13); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_REFUSE','Supplier order request refused','Executed when a supplier order is refused','order_supplier',13); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_CANCEL','Supplier order request canceled','Executed when a supplier order is canceled','order_supplier',13); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_SENTBYMAIL','Supplier order sent by mail','Executed when a supplier order is sent by mail','order_supplier',14); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_CLASSIFY_BILLED','Supplier order set billed','Executed when a supplier order is set as billed','order_supplier',14); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_DELETE','Supplier order deleted','Executed when a supplier order is deleted','order_supplier',14); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_SUPPLIER_VALIDATE','Supplier invoice validated','Executed when a supplier invoice is validated','invoice_supplier',15); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_SUPPLIER_MODIFY','Supplier invoice modified','Executed when a supplier invoice is modified','invoice_supplier',15); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_SUPPLIER_UNVALIDATE','Supplier invoice unvalidated','Executed when a supplier invoice status is set back to draft','invoice_supplier',15); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_SUPPLIER_PAYED','Supplier invoice payed','Executed when a supplier invoice is payed','invoice_supplier',16); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_SUPPLIER_SENTBYMAIL','Supplier invoice sent by mail','Executed when a supplier invoice is sent by mail','invoice_supplier',17); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_SUPPLIER_CANCELED','Supplier invoice cancelled','Executed when a supplier invoice is cancelled','invoice_supplier',17); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_SUPPLIER_DELETE','Supplier invoice deleted','Executed when a supplier invoice is deleted','invoice_supplier',17); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTRACT_VALIDATE','Contract validated','Executed when a contract is validated','contrat',18); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTRACT_MODIFY','Contract modified','Executed when a contract is modified','contrat',18); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTRACT_SENTBYMAIL','Contract sent by mail','Executed when a contract is sent by mail','contrat',18); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTRACT_DELETE','Contract deleted','Executed when a contract is deleted','contrat',18); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('SHIPPING_VALIDATE','Shipping validated','Executed when a shipping is validated','shipping',20); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('SHIPPING_MODIFY','Shipping modified','Executed when a shipping is modified','shipping',20); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('SHIPPING_SENTBYMAIL','Shipping sent by mail','Executed when a shipping is sent by mail','shipping',21); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('SHIPPING_DELETE','Shipping sent is deleted','Executed when a shipping is deleted','shipping',21); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECEPTION_VALIDATE','Reception validated','Executed when a reception is validated','reception',22); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECEPTION_SENTBYMAIL','Reception sent by mail','Executed when a reception is sent by mail','reception',22); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_VALIDATE','Member validated','Executed when a member is validated','member',22); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_MODIFY','Member modified','Executed when a member is modified','member',23); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_SENTBYMAIL','Mails sent from member card','Executed when you send email from member card','member',23); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_SUBSCRIPTION_CREATE','Member subscribtion recorded','Executed when a member subscribtion is deleted','member',24); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_SUBSCRIPTION_MODIFY','Member subscribtion modified','Executed when a member subscribtion is modified','member',24); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_SUBSCRIPTION_DELETE','Member subscribtion deleted','Executed when a member subscribtion is deleted','member',24); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_RESILIATE','Member resiliated','Executed when a member is resiliated','member',25); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_DELETE','Member deleted','Executed when a member is deleted','member',26); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_EXCLUDE','Member excluded','Executed when a member is excluded','member',27); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_VALIDATE','Intervention validated','Executed when a intervention is validated','ficheinter',30); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_MODIFY','Intervention modify','Executed when a intervention is modify','ficheinter',30); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_CLASSIFY_BILLED','Intervention set billed','Executed when a intervention is set to billed (when option FICHINTER_CLASSIFY_BILLED is set)','ficheinter',32); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_CLASSIFY_UNBILLED','Intervention set unbilled','Executed when a intervention is set to unbilled (when option FICHINTER_CLASSIFY_BILLED is set)','ficheinter',33); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_REOPEN','Intervention opened','Executed when a intervention is re-opened','ficheinter',34); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_SENTBYMAIL','Intervention sent by mail','Executed when a intervention is sent by mail','ficheinter',35); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_DELETE','Intervention is deleted','Executed when a intervention is deleted','ficheinter',35); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PRODUCT_CREATE','Product or service created','Executed when a product or sevice is created','product',40); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PRODUCT_MODIFY','Product or service modified','Executed when a product or sevice is modified','product',41); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PRODUCT_DELETE','Product or service deleted','Executed when a product or sevice is deleted','product',42); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_REPORT_CREATE','Expense report created','Executed when an expense report is created','expensereport',201); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_REPORT_VALIDATE','Expense report validated','Executed when an expense report is validated','expensereport',202); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_REPORT_MODIFY','Expense report modified','Executed when an expense report is modified','expensereport',202); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_REPORT_APPROVE','Expense report approved','Executed when an expense report is approved','expensereport',203); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_REPORT_PAID','Expense report billed','Executed when an expense report is set as billed','expensereport',204); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_REPORT_DELETE','Expense report deleted','Executed when an expense report is deleted','expensereport',205); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_VALIDATE','Expense report validated','Executed when an expense report is validated','expensereport',211); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_MODIFY','Expense report modified','Executed when an expense report is modified','expensereport',212); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_APPROVE','Expense report approved','Executed when an expense report is approved','expensereport',212); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_CREATE','Project creation','Executed when a project is created','project',140); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_VALIDATE','Project validation','Executed when a project is validated','project',141); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_MODIFY','Project modified','Executed when a project is modified','project',142); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_DELETE','Project deleted','Executed when a project is deleted','project',143); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_SENTBYMAIL','Project sent by mail','Executed when a project is sent by email','project',144); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TICKET_CREATE','Ticket created','Executed when a ticket is created','ticket',161); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TICKET_MODIFY','Ticket modified','Executed when a ticket is modified','ticket',163); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TICKET_ASSIGNED','Ticket assigned','Executed when a ticket is modified','ticket',164); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TICKET_CLOSE','Ticket closed','Executed when a ticket is closed','ticket',165); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TICKET_SENTBYMAIL','Ticket message sent by email','Executed when a message is sent from the ticket record','ticket',166); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TICKET_DELETE','Ticket deleted','Executed when a ticket is deleted','ticket',167); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('USER_SENTBYMAIL','Email sent','Executed when an email is sent from user card','user',300); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('USER_CREATE','User created','Executed when a user is created','user',301); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('USER_MODIFY','User update','Executed when a user is updated','user',302); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('USER_DELETE','User update','Executed when a user is deleted','user',303); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('USER_NEW_PASSWORD','User update','Executed when a user is change password','user',304); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('USER_ENABLEDISABLE','User update','Executed when a user is enable or disable','user',305); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_MODIFY','Intervention modified','Executed when a intervention is modified','ficheinter',19); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BOM_VALIDATE','BOM validated','Executed when a BOM is validated','bom',650); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BOM_UNVALIDATE','BOM unvalidated','Executed when a BOM is unvalidated','bom',651); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BOM_CLOSE','BOM disabled','Executed when a BOM is disabled','bom',652); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BOM_REOPEN','BOM reopen','Executed when a BOM is re-open','bom',653); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BOM_DELETE','BOM deleted','Executed when a BOM deleted','bom',654); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MRP_MO_VALIDATE','MO validated','Executed when a MO is validated','mrp',660); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MRP_MO_PRODUCED','MO produced','Executed when a MO is produced','mrp',661); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MRP_MO_DELETE','MO deleted','Executed when a MO is deleted','mrp',662); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MRP_MO_CANCEL','MO canceled','Executed when a MO is canceled','mrp',663); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTACT_CREATE','Contact address created','Executed when a contact is created','contact',50); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTACT_MODIFY','Contact address update','Executed when a contact is updated','contact',51); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTACT_SENTBYMAIL','Mails sent from third party card','Executed when you send email from contact address record','contact',52); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTACT_DELETE','Contact address deleted','Executed when a contact is deleted','contact',53); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTJOBPOSITION_CREATE','Job created','Executed when a job is created','recruitment',7500); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTJOBPOSITION_MODIFY','Job modified','Executed when a job is modified','recruitment',7502); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTJOBPOSITION_SENTBYMAIL','Mails sent from job record','Executed when you send email from job record','recruitment',7504); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTJOBPOSITION_DELETE','Job deleted','Executed when a job is deleted','recruitment',7506); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTCANDIDATURE_CREATE','Candidature created','Executed when a candidature is created','recruitment',7510); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTCANDIDATURE_MODIFY','Candidature modified','Executed when a candidature is modified','recruitment',7512); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTCANDIDATURE_SENTBYMAIL','Mails sent from candidature record','Executed when you send email from candidature record','recruitment',7514); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTCANDIDATURE_DELETE','Candidature deleted','Executed when a candidature is deleted','recruitment',7516); + +-- actions not enabled by default : they are excluded when we enable the module Agenda (except TASK_...) +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TASK_CREATE','Task created','Executed when a project task is created','project',150); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TASK_MODIFY','Task modified','Executed when a project task is modified','project',151); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TASK_DELETE','Task deleted','Executed when a project task is deleted','project',152); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ACTION_CREATE','Action added','Executed when an action is added to the agenda','agenda',700); + +-- holiday +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_CREATE','Holiday created','Executed when a holiday is created','holiday',800); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_MODIFY','Holiday modified','Executed when a holiday is modified','holiday',801); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_VALIDATE','Holiday validated','Executed when a holiday is validated','holiday',802); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_APPROVE','Holiday aprouved','Executed when a holiday is aprouved','holiday',803); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_CANCEL','Holiday canceled','Executed when a holiday is canceled','holiday',802); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_DELETE','Holiday deleted','Executed when a holiday is deleted','holiday',804); + +-- facture rec +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILLREC_CREATE','Template invoices created','Executed when a Template invoices is created','facturerec',900); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILLREC_MODIFY','Template invoices update','Executed when a Template invoices is updated','facturerec',901); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILLREC_DELETE','Template invoices deleted','Executed when a Template invoices is deleted','facturerec',902); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILLREC_AUTOCREATEBILL','Template invoices use to create invoices with auto batch','Executed when a Template invoices is use to create invoice with auto batch','facturerec',903); diff --git a/htdocs/install/mysql/tables/llx_c_action_trigger.sql b/htdocs/install/mysql/tables/llx_c_action_trigger.sql index 8f7450d0fe9..be1c8580541 100644 --- a/htdocs/install/mysql/tables/llx_c_action_trigger.sql +++ b/htdocs/install/mysql/tables/llx_c_action_trigger.sql @@ -23,7 +23,7 @@ create table llx_c_action_trigger ( rowid integer AUTO_INCREMENT PRIMARY KEY, elementtype varchar(64) NOT NULL, - code varchar(64) NOT NULL, + code varchar(128) NOT NULL, label varchar(128) NOT NULL, description varchar(255), rang integer DEFAULT 0 diff --git a/htdocs/install/mysql/tables/llx_establishment.sql b/htdocs/install/mysql/tables/llx_establishment.sql index 1b1f38074ad..a3542f6d9d6 100644 --- a/htdocs/install/mysql/tables/llx_establishment.sql +++ b/htdocs/install/mysql/tables/llx_establishment.sql @@ -22,7 +22,6 @@ CREATE TABLE llx_establishment ( rowid integer NOT NULL auto_increment PRIMARY KEY, entity integer NOT NULL DEFAULT 1, - label varchar(255), ref varchar(30), label varchar(255) NOT NULL, name varchar(128), diff --git a/htdocs/install/mysql/tables/llx_projet.sql b/htdocs/install/mysql/tables/llx_projet.sql index 197a92ac2be..5b3df54ba14 100644 --- a/htdocs/install/mysql/tables/llx_projet.sql +++ b/htdocs/install/mysql/tables/llx_projet.sql @@ -47,7 +47,10 @@ create table llx_projet usage_opportunity integer DEFAULT 0, -- Set to 1 if project is used to follow an opportunity usage_task integer DEFAULT 1, -- Set to 1 if project is used to manage tasks and/or record timesheet usage_bill_time integer DEFAULT 0, -- Set to 1 if time spent must be converted into invoices - usage_organize_event integer DEFAULT 0, -- Set to 1 if you want to use project to organize an event or receive attendees registration + usage_organize_event integer DEFAULT 0, -- Set to 1 if you want to use project to organize an event or receive attendees registration + date_start_event datetime, -- date start event + date_end_event datetime, -- date end event + location varchar(255), -- location accept_conference_suggestions integer DEFAULT 0, -- Set to 1 if you want to allow unknown people to suggest conferences accept_booth_suggestions integer DEFAULT 0, -- Set to 1 if you want to Allow unknown people to suggest booth max_attendees integer DEFAULT 0, diff --git a/htdocs/install/step1.php b/htdocs/install/step1.php index 24b5dba4d01..7958012b0a1 100644 --- a/htdocs/install/step1.php +++ b/htdocs/install/step1.php @@ -825,7 +825,7 @@ function write_conf_file($conffile) global $dolibarr_main_distrib; global $db_host, $db_port, $db_name, $db_user, $db_pass, $db_type, $db_character_set, $db_collation; global $conffile, $conffiletoshow, $conffiletoshowshort; - global $force_dolibarr_lib_ADODB_PATH, $force_dolibarr_lib_NUSOAP_PATH; + global $force_dolibarr_lib_NUSOAP_PATH; global $force_dolibarr_lib_TCPDF_PATH, $force_dolibarr_lib_FPDI_PATH; global $force_dolibarr_lib_GEOIP_PATH; global $force_dolibarr_lib_ODTPHP_PATH, $force_dolibarr_lib_ODTPHP_PATHTOPCLZIP; @@ -944,11 +944,6 @@ function write_conf_file($conffile) } fputs($fp, '$dolibarr_lib_TCPDI_PATH=\''.$force_dolibarr_lib_TCPDI_PATH.'\';'); fputs($fp, "\n"); - if (empty($force_dolibarr_lib_ADODB_PATH)) { - fputs($fp, '//'); $force_dolibarr_lib_ADODB_PATH = ''; - } - fputs($fp, '$dolibarr_lib_ADODB_PATH=\''.$force_dolibarr_lib_ADODB_PATH.'\';'); - fputs($fp, "\n"); if (empty($force_dolibarr_lib_GEOIP_PATH)) { fputs($fp, '//'); $force_dolibarr_lib_GEOIP_PATH = ''; } diff --git a/htdocs/langs/en_US/commercial.lang b/htdocs/langs/en_US/commercial.lang index 9978118f763..eba95a8aabb 100644 --- a/htdocs/langs/en_US/commercial.lang +++ b/htdocs/langs/en_US/commercial.lang @@ -76,10 +76,14 @@ NoLimit=No limit ToOfferALinkForOnlineSignature=Link for online signature WelcomeOnOnlineSignaturePageProposal=Welcome to the page to accept commercial proposals from %s WelcomeOnOnlineSignaturePageContract=Welcome to %s Contract PDF Signing Page +WelcomeOnOnlineSignaturePageFichinter=Welcome to %s Intervention PDF Signing Page ThisScreenAllowsYouToSignDocFromProposal=This screen allow you to accept and sign, or refuse, a quote/commercial proposal ThisScreenAllowsYouToSignDocFromContract=This screen allow you to sign contract on PDF format online. +ThisScreenAllowsYouToSignDocFromFichinter=This screen allow you to sign intervention on PDF format online. ThisIsInformationOnDocumentToSignProposal=This is information on document to accept or refuse ThisIsInformationOnDocumentToSignContract=This is information on contract to sign +ThisIsInformationOnDocumentToSignFichinter=This is information on intervention to sign SignatureProposalRef=Signature of quote/commercial proposal %s SignatureContractRef=Signature of contract %s +SignatureFichinterRef=Signature of intervention %s FeatureOnlineSignDisabled=Feature for online signing disabled or document generated before the feature was enabled diff --git a/htdocs/langs/en_US/eventorganization.lang b/htdocs/langs/en_US/eventorganization.lang index b4179b04be6..f9531260c97 100644 --- a/htdocs/langs/en_US/eventorganization.lang +++ b/htdocs/langs/en_US/eventorganization.lang @@ -122,7 +122,7 @@ ViewAndVote = View and vote for suggested events PublicAttendeeSubscriptionGlobalPage = Public link for registration to the event PublicAttendeeSubscriptionPage = Public link for registration to this event only MissingOrBadSecureKey = The security key is invalid or missing -EvntOrgWelcomeMessage = This form allows you to register as a new participant to the event : %s +EvntOrgWelcomeMessage = This form allows you to register as a new participant to the event EvntOrgDuration = This conference starts on %s and ends on %s. ConferenceAttendeeFee = Conference attendee fee for the event : '%s' occurring from %s to %s. BoothLocationFee = Booth location for the event : '%s' occurring from %s to %s @@ -132,7 +132,7 @@ LabelOfconference=Conference label ConferenceIsNotConfirmed=Registration not available, conference is not confirmed yet DateMustBeBeforeThan=%s must be before %s DateMustBeAfterThan=%s must be after %s - +MaxNbOfAttendeesReached=The maximum number of participants has been reached NewSubscription=Registration OrganizationEventConfRequestWasReceived=Your suggestion for a conference has been received OrganizationEventBoothRequestWasReceived=Your request for a booth has been received @@ -157,7 +157,7 @@ VoteOk = Your vote has been accepted. AlreadyVoted = You have already voted for this event. VoteError = An error has occurred during the vote, please try again. -SubscriptionOk = Your registration has been validated +SubscriptionOk=Your registration has been recorded ConfAttendeeSubscriptionConfirmation = Confirmation of your subscription to an event Attendee = Attendee PaymentConferenceAttendee = Conference attendee payment @@ -165,6 +165,7 @@ PaymentBoothLocation = Booth location payment DeleteConferenceOrBoothAttendee=Remove attendee RegistrationAndPaymentWereAlreadyRecorder=A registration and a payment were already recorded for the email %s EmailAttendee=Attendee email +EmailCompany=Company email EmailCompanyForInvoice=Company email (for invoice, if different of attendee email) ErrorSeveralCompaniesWithEmailContactUs=Several companies with this email has been found so we can't validate automaticaly your registration. Please contact us at %s for a manual validation ErrorSeveralCompaniesWithNameContactUs=Several companies with this name has been found so we can't validate automaticaly your registration. Please contact us at %s for a manual validation diff --git a/htdocs/langs/en_US/interventions.lang b/htdocs/langs/en_US/interventions.lang index 767688a4ce8..7524439f3ec 100644 --- a/htdocs/langs/en_US/interventions.lang +++ b/htdocs/langs/en_US/interventions.lang @@ -69,3 +69,5 @@ GenerateInter=Generate intervention FichinterNoContractLinked=Intervention %s has been created without a linked contract. ErrorFicheinterCompanyDoesNotExist=Company does not exist. Intervention has not been created. NextDateToIntervention=Date for next intervention generation +AllowOnlineSign=Allow online signing +AllowExternalDownload=Allow external download \ No newline at end of file diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index 037ddd1c4e1..b6001b2b27b 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -37,7 +37,9 @@ OpportunitiesStatusForOpenedProjects=Leads amount of open projects by status OpportunitiesStatusForProjects=Leads amount of projects by status ShowProject=Show project ShowTask=Show task +SetThirdParty=Set third party SetProject=Set project +OutOfProject=Out of project NoProject=No project defined or owned NbOfProjects=Number of projects NbOfTasks=Number of tasks diff --git a/htdocs/langs/en_US/propal.lang b/htdocs/langs/en_US/propal.lang index d07d6d2efba..7e9afd4e27c 100644 --- a/htdocs/langs/en_US/propal.lang +++ b/htdocs/langs/en_US/propal.lang @@ -104,6 +104,7 @@ IdProduct=Product ID LineBuyPriceHT=Buy Price Amount net of tax for line SignPropal=Accept proposal SignContract=Sign contract +SignFichinter=Sign intervention RefusePropal=Refuse proposal Sign=Sign NoSign=Refuse @@ -111,5 +112,6 @@ PropalAlreadySigned=Proposal already accepted PropalAlreadyRefused=Proposal already refused PropalSigned=Proposal accepted ContractSigned=Contract signed +FichinterSigned=Intervention signed PropalRefused=Proposal refused ConfirmRefusePropal=Are you sure you want to refuse this commercial proposal? diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index 3e1415c3625..1696018db89 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -194,8 +194,7 @@ TicketAssigned=Ticket is now assigned TicketChangeType=Change type TicketChangeCategory=Change analytic code TicketChangeSeverity=Change severity -TicketAddMessage=Add a message -AddMessage=Add a message +TicketAddMessage=Add private message MessageSuccessfullyAdded=Ticket added TicketMessageSuccessfullyAdded=Message successfully added TicketMessagesList=Message list diff --git a/htdocs/langs/es_ES/commercial.lang b/htdocs/langs/es_ES/commercial.lang index 5fe49a5b4f4..8292b6391d6 100644 --- a/htdocs/langs/es_ES/commercial.lang +++ b/htdocs/langs/es_ES/commercial.lang @@ -68,13 +68,22 @@ ActionAC_OTH_AUTO=Eventos creados automáticamente ActionAC_MANUAL=Eventos creados manualmente ActionAC_AUTO=Eventos creados automáticamente ActionAC_OTH_AUTOShort=Auto +ActionAC_EVENTORGANIZATION=Eventos de organización Stats=Estadísticas de venta StatusProsp=Estado prospección DraftPropals=Presupuestos borrador NoLimit=Sin límite ToOfferALinkForOnlineSignature=Enlace para la firma en línea -WelcomeOnOnlineSignaturePage=Bienvenido a la página para aceptar presupuestos de %s -ThisScreenAllowsYouToSignDocFrom=Esta pantalla le permite aceptar y firmar, o rechazar, una presupuesto/propuesta comercial -ThisIsInformationOnDocumentToSign=Esta es la información del documento para aceptar o rechazar +WelcomeOnOnlineSignaturePageProposal=Bienvenido a la página para firmar presupuestos de %s +WelcomeOnOnlineSignaturePageContract=Bienvenido a la página para firmar contratos de %s +WelcomeOnOnlineSignaturePageFichinter=Bienvenido a la página para firmar intervenciones de %s +ThisScreenAllowsYouToSignDocFromProposal=Esta página permite aceptar y firmar o rechazar un presupuesto o propuesta comercial. +ThisScreenAllowsYouToSignDocFromContract=Esta página permite aceptar y firmar el contrato PDF online. +ThisScreenAllowsYouToSignDocFromFichinter=Esta página permite aceptar y firmar una intervención en formato PDF online. +ThisIsInformationOnDocumentToSignProposal=Esta es la información del presupuesto para aceptar o rechazar +ThisIsInformationOnDocumentToSignContract=Esta es la información del contrato a firmar +ThisIsInformationOnDocumentToSignFichinter=Esta es la información de la intervención a firmar SignatureProposalRef=Firma del presupuesto/propuesta comercial %s +SignatureContractRef=Firma del contrato %s +SignatureFichinterRef=Firma de la intervención %s FeatureOnlineSignDisabled=Característica para la firma en línea inhabilitada o documento generado antes de que se habilitara la característica diff --git a/htdocs/langs/es_ES/interventions.lang b/htdocs/langs/es_ES/interventions.lang index 83471928031..b335c533713 100644 --- a/htdocs/langs/es_ES/interventions.lang +++ b/htdocs/langs/es_ES/interventions.lang @@ -66,3 +66,8 @@ RepeatableIntervention=Plantilla de intervención ToCreateAPredefinedIntervention=Para crear una intervención predefinida o recurrente, cree una intervención común y conviértala en plantilla de intervención ConfirmReopenIntervention=¿Está seguro de querer volver a abrir la intervención %s ? GenerateInter=Generar intervención +FichinterNoContractLinked=La intervención %s se ha creado sin un contacto vinculado. +ErrorFicheinterCompanyDoesNotExist=La compañía no existe, la intervención no se ha creado. +NextDateToIntervention=Fecha para la próxima generación de intervención +AllowOnlineSign=Permitir firma online +AllowExternalDownload=Permitir descarga externa \ No newline at end of file diff --git a/htdocs/langs/es_ES/main.lang b/htdocs/langs/es_ES/main.lang index 2af1c00c5cf..00488783f8a 100644 --- a/htdocs/langs/es_ES/main.lang +++ b/htdocs/langs/es_ES/main.lang @@ -926,6 +926,7 @@ DirectDownloadInternalLink=Enlace de descarga privado PrivateDownloadLinkDesc=Debe iniciar sesión y necesita permisos para ver o descargar el archivo Download=Descargar DownloadDocument=Descargar el documento +DownloadSignedDocument=Descargar el documento firmado ActualizeCurrency=Actualizar el tipo de cambio Fiscalyear=Año fiscal ModuleBuilder=Módulo Builder diff --git a/htdocs/langs/es_ES/propal.lang b/htdocs/langs/es_ES/propal.lang index 2f31aab4e89..159daf31178 100644 --- a/htdocs/langs/es_ES/propal.lang +++ b/htdocs/langs/es_ES/propal.lang @@ -103,11 +103,15 @@ IdProposal=ID de Presupuesto IdProduct=ID del Producto LineBuyPriceHT=Precio de compra Importe neto de impuestos por línea SignPropal=Aceptar presupuesto +SignContract=Firmar contrato +SignFichinter=Firmar intervención RefusePropal=Rechazar presupuesto Sign=Firma NoSign=Establecer no firmado PropalAlreadySigned=Presupuesto ya aceptado PropalAlreadyRefused=Presupuesto ya rechazado PropalSigned=Presupuesto aceptado +ContractSigned=Contrato firmado +FichinterSigned=Intervención firmada PropalRefused=Presupuesto rechazado ConfirmRefusePropal=¿Está seguro de querer rechazar este presupuesto? diff --git a/htdocs/partnership/class/partnership_type.class.php b/htdocs/partnership/class/partnership_type.class.php index 0074d2e80ee..0c42dae87d2 100644 --- a/htdocs/partnership/class/partnership_type.class.php +++ b/htdocs/partnership/class/partnership_type.class.php @@ -129,9 +129,6 @@ class PartnershipType extends CommonObject public function create(User $user, $notrigger = false) { $resultcreate = $this->createCommon($user, $notrigger); - - //$resultvalidate = $this->validate($user, $notrigger); - return $resultcreate; } @@ -145,9 +142,6 @@ class PartnershipType extends CommonObject public function fetch($id, $ref = null) { $result = $this->fetchCommon($id, $ref); - if ($result > 0 && !empty($this->table_element_line)) { - $this->fetchLines(); - } return $result; } @@ -253,79 +247,6 @@ class PartnershipType extends CommonObject public function delete(User $user, $notrigger = false) { return $this->deleteCommon($user, $notrigger); - //return $this->deleteCommon($user, $notrigger, 1); - } - - /** - * Set draft status - * - * @param User $user Object user that modify - * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers - * @return int <0 if KO, >0 if OK - */ - public function setDraft($user, $notrigger = 0) - { - // Protection - if ($this->status <= self::STATUS_DRAFT) { - return 0; - } - - /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->mymodule->write)) - || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->mymodule->mymodule_advance->validate)))) - { - $this->error='Permission denied'; - return -1; - }*/ - - return $this->setStatusCommon($user, self::STATUS_DRAFT, $notrigger, 'PARTNERSHIPTYPE_UNVALIDATE'); - } - - /** - * Set cancel status - * - * @param User $user Object user that modify - * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers - * @return int <0 if KO, 0=Nothing done, >0 if OK - */ - public function cancel($user, $notrigger = 0) - { - // Protection - if ($this->status != self::STATUS_VALIDATED) { - return 0; - } - - /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->mymodule->write)) - || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->mymodule->mymodule_advance->validate)))) - { - $this->error='Permission denied'; - return -1; - }*/ - - return $this->setStatusCommon($user, self::STATUS_CANCELED, $notrigger, 'PARTNERSHIPTYPE_CANCEL'); - } - - /** - * Set back to validated status - * - * @param User $user Object user that modify - * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers - * @return int <0 if KO, 0=Nothing done, >0 if OK - */ - public function reopen($user, $notrigger = 0) - { - // Protection - if ($this->status != self::STATUS_CANCELED) { - return 0; - } - - /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->mymodule->write)) - || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->mymodule->mymodule_advance->validate)))) - { - $this->error='Permission denied'; - return -1; - }*/ - - return $this->setStatusCommon($user, self::STATUS_VALIDATED, $notrigger, 'PARTNERSHIPTYPE_REOPEN'); } /** @@ -445,59 +366,6 @@ class PartnershipType extends CommonObject return $result; } - /** - * Return the label of the status - * - * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto - * @return string Label of status - */ - public function getLabelStatus($mode = 0) - { - return $this->LibStatut($this->status, $mode); - } - - /** - * Return the label of the status - * - * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto - * @return string Label of status - */ - public function getLibStatut($mode = 0) - { - return $this->LibStatut($this->status, $mode); - } - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Return the status - * - * @param int $status Id status - * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto - * @return string Label of status - */ - public function LibStatut($status, $mode = 0) - { - // phpcs:enable - if (empty($this->labelStatus) || empty($this->labelStatusShort)) { - global $langs; - //$langs->load("mymodule@mymodule"); - $this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft'); - $this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Enabled'); - $this->labelStatus[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Disabled'); - $this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft'); - $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Enabled'); - $this->labelStatusShort[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Disabled'); - } - - $statusType = 'status'.$status; - //if ($status == self::STATUS_VALIDATED) $statusType = 'status1'; - if ($status == self::STATUS_CANCELED) { - $statusType = 'status6'; - } - - return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); - } - /** * Load the info information in the object * diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 1dda1f4c89a..2171ef4aab3 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -2249,7 +2249,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { } print ''; - print ''; + print ''; print ' '; // Print the search button print ''; @@ -2261,7 +2261,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print ''; print ''.$langs->trans("ThirdParty").''; - print '' . $langs->trans('RefCustomer') . ''; + print ''.$langs->trans('RefCustomer').''; print ''.$langs->trans("AppliedPricesFrom").''; print ''.$langs->trans("PriceBase").''; print ''.$langs->trans("DefaultTaxRate").''; @@ -2298,6 +2298,8 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print '' . $langs->trans('Default') . ''; print ''.$langs->trans($object->price_base_type).""; + + // VAT Rate print ''; $positiverates = ''; @@ -2319,12 +2321,12 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { //print $object->default_vat_code?' ('.$object->default_vat_code.')':''; print ""; - print ''.price($object->price).""; + print ''.price($object->price).""; - print ''.price($object->price_ttc).""; + print ''.price($object->price_ttc).""; if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") { //print '' . price($object->price_ttc) . ""; - print ''.price($resultarray[2]).''; + print ''.price($resultarray[2]).''; } print ''.price($object->price_min).''; @@ -2376,6 +2378,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print ''.dol_escape_htmltag($line->ref_customer).''; print "".dol_print_date($line->datec, "dayhour", 'tzuserrel').""; print ''.$langs->trans($line->price_base_type).""; + // VAT Rate print ''; $positiverates = ''; @@ -2395,12 +2398,13 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { echo vatrate($positiverates.($line->default_vat_code ? ' ('.$line->default_vat_code.')' : ''), '%', ($line->tva_npr ? $line->tva_npr : $line->recuperableonly)); print ""; + print ''.price($line->price).""; print ''.price($line->price_ttc).""; if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") { //print '' . price($line->price_ttc) . ""; - print ''.price($resultarray[2]).''; + print ''.price($resultarray[2]).''; } print ''.price($line->price_min).''; diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 17d5c042389..718aeecec82 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -55,13 +55,15 @@ $dol_openinpopup = GETPOST('dol_openinpopup', 'aZ09'); $status = GETPOST('status', 'int'); $opp_status = GETPOST('opp_status', 'int'); -$opp_percent = price2num(GETPOST('opp_percent', 'alpha')); -$objcanvas = GETPOST("objcanvas", "alpha"); -$comefromclone = GETPOST("comefromclone", "alpha"); +$opp_percent = price2num(GETPOST('opp_percent', 'alphanohtml')); +$objcanvas = GETPOST("objcanvas", "alphanohtml"); +$comefromclone = GETPOST("comefromclone", "alphanohtml"); +$date_start = dol_mktime(0, 0, 0, GETPOST('projectstartmonth', 'int'), GETPOST('projectstartday', 'int'), GETPOST('projectstartyear', 'int')); +$date_end = dol_mktime(0, 0, 0, GETPOST('projectendmonth', 'int'), GETPOST('projectendday', 'int'), GETPOST('projectendyear', 'int')); +$date_start_event = dol_mktime(GETPOST('date_start_eventhour', 'int'), GETPOST('date_start_eventmin', 'int'), GETPOST('date_start_eventsec', 'int'), GETPOST('date_start_eventmonth', 'int'), GETPOST('date_start_eventday', 'int'), GETPOST('date_start_eventyear', 'int')); +$date_end_event = dol_mktime(GETPOST('date_end_eventhour', 'int'), GETPOST('date_end_eventmin', 'int'), GETPOST('date_end_eventsec', 'int'), GETPOST('date_end_eventmonth', 'int'), GETPOST('date_end_eventday', 'int'), GETPOST('date_end_eventyear', 'int')); +$location = GETPOST('location', 'alphanohtml'); -if ($id == '' && $ref == '' && ($action != "create" && $action != "add" && $action != "update" && !GETPOST("cancel"))) { - accessforbidden(); -} $mine = GETPOST('mode') == 'mine' ? 1 : 0; //if (! $user->rights->projet->all->lire) $mine=1; // Special for projects @@ -88,14 +90,15 @@ if ($id > 0 || !empty($ref)) { // fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); -$date_start = dol_mktime(0, 0, 0, GETPOST('projectstartmonth', 'int'), GETPOST('projectstartday', 'int'), GETPOST('projectstartyear', 'int')); -$date_end = dol_mktime(0, 0, 0, GETPOST('projectendmonth', 'int'), GETPOST('projectendday', 'int'), GETPOST('projectendyear', 'int')); - // Security check $socid = GETPOST('socid', 'int'); //if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement. restrictedArea($user, 'projet', $object->id, 'projet&project'); +if ($id == '' && $ref == '' && ($action != "create" && $action != "add" && $action != "update" && !GETPOST("cancel"))) { + accessforbidden(); +} + $permissiondellink = $user->rights->projet->creer; // Used by the include of actions_dellink.inc.php @@ -187,6 +190,9 @@ if (empty($reshook)) { $object->date_c = dol_now(); $object->date_start = $date_start; $object->date_end = $date_end; + $object->date_start_event = $date_start_event; + $object->date_end_event = $date_end_event; + $object->location = $location; $object->statut = $status; $object->opp_status = $opp_status; $object->opp_percent = $opp_percent; @@ -281,6 +287,9 @@ if (empty($reshook)) { $object->public = GETPOST('public', 'alpha'); $object->date_start = (!GETPOST('projectstart')) ? '' : $date_start; $object->date_end = (!GETPOST('projectend')) ? '' : $date_end; + $object->date_start_event = (!GETPOST('date_start_event')) ? '' : $date_start_event; + $object->date_end_event = (!GETPOST('date_end_event')) ? '' : $date_end_event; + $object->location = $location; if (GETPOSTISSET('opp_amount')) { $object->opp_amount = price2num(GETPOST('opp_amount', 'alpha')); } @@ -603,6 +612,23 @@ if ($action == 'create' && $user->rights->projet->creer) { print ' '; $htmltext = $langs->trans("EventOrganizationDescriptionLong"); print ''; + print ''; } print ''; print ''; @@ -673,16 +699,6 @@ if ($action == 'create' && $user->rights->projet->creer) { } print ''; - // Date start - print ''.$langs->trans("DateStart").''; - print $form->selectDate(($date_start ? $date_start : ''), 'projectstart', 0, 0, 0, '', 1, 0); - print ''; - - // Date end - print ''.$langs->trans("DateEnd").''; - print $form->selectDate(($date_end ? $date_end : -1), 'projectend', 0, 0, 0, '', 1, 0); - print ''; - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { // Opportunity status print ''.$langs->trans("OpportunityStatus").''; @@ -708,6 +724,27 @@ if ($action == 'create' && $user->rights->projet->creer) { print ''; print ''; + // Date project + print ''.$langs->trans("Date").(isModEnabled('eventorganization') ? ' ('.$langs->trans("Project").')' : '').''; + print $form->selectDate(($date_start ? $date_start : ''), 'projectstart', 0, 0, 0, '', 1, 0); + print ' '.$langs->trans("to").' '; + print $form->selectDate(($date_end ? $date_end : -1), 'projectend', 0, 0, 0, '', 1, 0); + print ''; + + if (isModEnabled('eventorganization')) { + // Date event + print ''.$langs->trans("Date").' ('.$langs->trans("Event").')'; + print $form->selectDate(($date_start_event ? $date_start_event : -1), 'date_start_event', 1, 1, 1, '', 1, 0); + print ' '.$langs->trans("to").' '; + print $form->selectDate(($date_end_event ? $date_end_event : -1), 'date_end_event', 1, 1, 1, '', 1, 0); + print ''; + + // Location + print ''.$langs->trans("Location").''; + print ''; + print ''; + } + // Description print ''.$langs->trans("Description").''; print ''; @@ -852,11 +889,12 @@ if ($action == 'create' && $user->rights->projet->creer) { // Status print ''.$langs->trans("Status").''; - print ''; foreach ($object->statuts_short as $key => $val) { - print ''; + print ''; } print ''; + print ajax_combobox('status'); print ''; // Usage @@ -902,6 +940,21 @@ if ($action == 'create' && $user->rights->projet->creer) { print 'usage_organize_event ? ' checked="checked"' : '')) . '"> '; $htmltext = $langs->trans("EventOrganizationDescriptionLong"); print ''; + print ''; } print ''; } @@ -981,9 +1034,18 @@ if ($action == 'create' && $user->rights->projet->creer) { print ''; } - // Date start - print ''.$langs->trans("DateStart").''; + // Budget + print ''.$langs->trans("Budget").''; + print ''; + print $langs->getCurrencySymbol($conf->currency); + print ''; + print ''; + + // Date project + print ''.$langs->trans("Date").(isModEnabled('eventorganization') ? ' ('.$langs->trans("Project").')' : '').''; print $form->selectDate($object->date_start ? $object->date_start : -1, 'projectstart', 0, 0, 0, '', 1, 0); + print ' '.$langs->trans("to").' '; + print $form->selectDate($object->date_end ? $object->date_end : -1, 'projectend', 0, 0, 0, '', 1, 0); print '     rights->projet->creer) { print '/>'; print ''; - // Date end - print ''.$langs->trans("DateEnd").''; - print $form->selectDate($object->date_end ? $object->date_end : -1, 'projectend', 0, 0, 0, '', 1, 0); - print ''; + if (isModEnabled('eventorganization')) { + // Date event + print ''.$langs->trans("Date").' ('.$langs->trans("Event").')'; + print $form->selectDate(($date_start_event ? $date_start_event : ($object->date_start_event ? $object->date_start_event : -1)), 'date_start_event', 1, 1, 1, '', 1, 0); + print ' '.$langs->trans("to").' '; + print $form->selectDate(($date_end_event ? $date_end_event : ($object->date_end_event ? $object->date_end_event : -1)), 'date_end_event', 1, 1, 1, '', 1, 0); + print ''; - // Budget - print ''.$langs->trans("Budget").''; - print ''; - print $langs->getCurrencySymbol($conf->currency); - print ''; - print ''; + // Location + print ''.$langs->trans("Location").''; + print ''; + print ''; + } // Description print ''.$langs->trans("Description").''; @@ -1043,7 +1107,7 @@ if ($action == 'create' && $user->rights->projet->creer) { // Title $morehtmlref .= dol_escape_htmltag($object->title); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '; + $morehtmlref .= '
'; if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) { $morehtmlref .= $object->thirdparty->getNomUrl(1, 'project'); } @@ -1143,18 +1207,6 @@ if ($action == 'create' && $user->rights->projet->creer) { */ } - // Date start - end - print ''.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; - $start = dol_print_date($object->date_start, 'day'); - print ($start ? $start : '?'); - $end = dol_print_date($object->date_end, 'day'); - print ' - '; - print ($end ? $end : '?'); - if ($object->hasDelay()) { - print img_warning("Late"); - } - print ''; - // Budget print ''.$langs->trans("Budget").''; if (strcmp($object->budget_amount, '')) { @@ -1162,6 +1214,18 @@ if ($action == 'create' && $user->rights->projet->creer) { } print ''; + // Date start - end project + print ''.$langs->trans("Dates").''; + $start = dol_print_date($object->date_start, 'day'); + print ($start ? $start : '?'); + $end = dol_print_date($object->date_end, 'day'); + print ' - '; + print ($end ? $end : '?'); + if ($object->hasDelay()) { + print img_warning("Late"); + } + print ''; + // Other attributes $cols = 2; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 9987f9bc4f0..c5dcf0d4bb4 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -87,29 +87,44 @@ class Project extends CommonObject public $title; /** - * @var int Date start + * @var int Date start * @deprecated * @see $date_start */ public $dateo; /** - * @var int Date start + * @var int Date start */ public $date_start; /** - * @var int Date end + * @var int Date end * @deprecated * @see $date_end */ public $datee; /** - * @var int Date end + * @var int Date end */ public $date_end; + /** + * @var int Date start event + */ + public $date_start_event; + + /** + * @var int Date end event + */ + public $date_end_event; + + /** + * @var string Location + */ + public $location; + /** * @var int Date close */ @@ -264,30 +279,35 @@ class Project extends CommonObject 'datee' =>array('type'=>'date', 'label'=>'DateEnd', 'enabled'=>1, 'visible'=>1, 'position'=>35), 'description' =>array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>3, 'position'=>55, 'searchall'=>1), 'public' =>array('type'=>'integer', 'label'=>'Visibility', 'enabled'=>1, 'visible'=>1, 'position'=>65), - 'fk_opp_status' =>array('type'=>'integer', 'label'=>'OpportunityStatusShort', 'enabled'=>'!empty($conf->global->PROJECT_USE_OPPORTUNITIES)', 'visible'=>1, 'position'=>75), - 'opp_percent' =>array('type'=>'double(5,2)', 'label'=>'OpportunityProbabilityShort', 'enabled'=>'!empty($conf->global->PROJECT_USE_OPPORTUNITIES)', 'visible'=>1, 'position'=>80), + 'fk_opp_status' =>array('type'=>'integer', 'label'=>'OpportunityStatusShort', 'enabled'=>'getDolGlobalString("PROJECT_USE_OPPORTUNITIES")', 'visible'=>1, 'position'=>75), + 'opp_percent' =>array('type'=>'double(5,2)', 'label'=>'OpportunityProbabilityShort', 'enabled'=>'getDolGlobalString("PROJECT_USE_OPPORTUNITIES")', 'visible'=>1, 'position'=>80), 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>85, 'searchall'=>1), 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>90, 'searchall'=>1), 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'ModelPdf', 'enabled'=>1, 'visible'=>0, 'position'=>95), 'date_close' =>array('type'=>'datetime', 'label'=>'DateClosing', 'enabled'=>1, 'visible'=>0, 'position'=>105), 'fk_user_close' =>array('type'=>'integer', 'label'=>'UserClosing', 'enabled'=>1, 'visible'=>0, 'position'=>110), - 'opp_amount' =>array('type'=>'double(24,8)', 'label'=>'OpportunityAmountShort', 'enabled'=>1, 'visible'=>'!empty($conf->global->PROJECT_USE_OPPORTUNITIES)', 'position'=>115), + 'opp_amount' =>array('type'=>'double(24,8)', 'label'=>'OpportunityAmountShort', 'enabled'=>1, 'visible'=>'getDolGlobalString("PROJECT_USE_OPPORTUNITIES")', 'position'=>115), 'budget_amount' =>array('type'=>'double(24,8)', 'label'=>'Budget', 'enabled'=>1, 'visible'=>1, 'position'=>119), 'usage_bill_time' =>array('type'=>'integer', 'label'=>'UsageBillTimeShort', 'enabled'=>1, 'visible'=>-1, 'position'=>130), 'usage_opportunity' =>array('type'=>'integer', 'label'=>'UsageOpportunity', 'enabled'=>1, 'visible'=>-1, 'position'=>135), 'usage_task' =>array('type'=>'integer', 'label'=>'UsageTasks', 'enabled'=>1, 'visible'=>-1, 'position'=>140), 'usage_organize_event' =>array('type'=>'integer', 'label'=>'UsageOrganizeEvent', 'enabled'=>1, 'visible'=>-1, 'position'=>145), - 'accept_conference_suggestions' =>array('type'=>'integer', 'label'=>'AllowUnknownPeopleSuggestConf', 'enabled'=>1, 'visible'=>-1, 'position'=>146), - 'accept_booth_suggestions' =>array('type'=>'integer', 'label'=>'AllowUnknownPeopleSuggestBooth', 'enabled'=>1, 'visible'=>-1, 'position'=>147), - 'price_registration' =>array('type'=>'double(24,8)', 'label'=>'PriceOfRegistration', 'enabled'=>1, 'visible'=>-1, 'position'=>148), - 'price_booth' =>array('type'=>'double(24,8)', 'label'=>'PriceOfBooth', 'enabled'=>1, 'visible'=>-1, 'position'=>149), - 'max_attendees' =>array('type'=>'integer', 'label'=>'MaxNbOfAttendees', 'enabled'=>1, 'visible'=>-1, 'position'=>150), - 'datec' =>array('type'=>'datetime', 'label'=>'DateCreationShort', 'enabled'=>1, 'visible'=>-2, 'position'=>200), - 'tms' =>array('type'=>'timestamp', 'label'=>'DateModificationShort', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>205), - 'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserCreation', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>210), - 'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModification', 'enabled'=>1, 'visible'=>0, 'position'=>215), - 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>0, 'position'=>220), - 'email_msgid'=>array('type'=>'varchar(255)', 'label'=>'EmailMsgID', 'enabled'=>1, 'visible'=>-1, 'position'=>250, 'help'=>'EmailMsgIDWhenSourceisEmail'), + // Properties for event organization + 'date_start_event' =>array('type'=>'date', 'label'=>'DateStartEvent', 'enabled'=>1, 'visible'=>1, 'position'=>200), + 'date_end_event' =>array('type'=>'date', 'label'=>'DateEndEvent', 'enabled'=>1, 'visible'=>1, 'position'=>201), + 'location' =>array('type'=>'text', 'label'=>'Location', 'enabled'=>1, 'visible'=>3, 'position'=>55, 'searchall'=>202), + 'accept_conference_suggestions' =>array('type'=>'integer', 'label'=>'AllowUnknownPeopleSuggestConf', 'enabled'=>1, 'visible'=>-1, 'position'=>210), + 'accept_booth_suggestions' =>array('type'=>'integer', 'label'=>'AllowUnknownPeopleSuggestBooth', 'enabled'=>1, 'visible'=>-1, 'position'=>211), + 'price_registration' =>array('type'=>'double(24,8)', 'label'=>'PriceOfRegistration', 'enabled'=>1, 'visible'=>-1, 'position'=>212), + 'price_booth' =>array('type'=>'double(24,8)', 'label'=>'PriceOfBooth', 'enabled'=>1, 'visible'=>-1, 'position'=>215), + 'max_attendees' =>array('type'=>'integer', 'label'=>'MaxNbOfAttendees', 'enabled'=>1, 'visible'=>-1, 'position'=>215), + // Generic + 'datec' =>array('type'=>'datetime', 'label'=>'DateCreationShort', 'enabled'=>1, 'visible'=>-2, 'position'=>400), + 'tms' =>array('type'=>'timestamp', 'label'=>'DateModificationShort', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>405), + 'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserCreation', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>410), + 'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModification', 'enabled'=>1, 'visible'=>0, 'position'=>415), + 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>0, 'position'=>420), + 'email_msgid'=>array('type'=>'varchar(255)', 'label'=>'EmailMsgID', 'enabled'=>1, 'visible'=>-1, 'position'=>450, 'help'=>'EmailMsgIDWhenSourceisEmail'), 'fk_statut' =>array('type'=>'smallint(6)', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>500) ); // END MODULEBUILDER PROPERTIES @@ -408,6 +428,9 @@ class Project extends CommonObject $sql .= ", price_registration"; $sql .= ", price_booth"; $sql .= ", max_attendees"; + $sql .= ", date_start_event"; + $sql .= ", date_end_event"; + $sql .= ", location"; $sql .= ", email_msgid"; $sql .= ", note_private"; $sql .= ", note_public"; @@ -436,6 +459,9 @@ class Project extends CommonObject $sql .= ", ".(strcmp($this->price_registration, '') ? price2num($this->price_registration) : 'null'); $sql .= ", ".(strcmp($this->price_booth, '') ? price2num($this->price_booth) : 'null'); $sql .= ", ".(strcmp($this->max_attendees, '') ? ((int) $this->max_attendees) : 'null'); + $sql .= ", ".($this->date_start_event != '' ? "'".$this->db->idate($this->date_start_event)."'" : 'null'); + $sql .= ", ".($this->date_end_event != '' ? "'".$this->db->idate($this->date_end_event)."'" : 'null'); + $sql .= ", ".($this->location ? "'".$this->db->escape($this->location)."'" : 'null'); $sql .= ", ".($this->email_msgid ? "'".$this->db->escape($this->email_msgid)."'" : 'null'); $sql .= ", ".($this->note_private ? "'".$this->db->escape($this->note_private)."'" : 'null'); $sql .= ", ".($this->note_public ? "'".$this->db->escape($this->note_public)."'" : 'null'); @@ -530,11 +556,11 @@ class Project extends CommonObject $sql .= ", fk_opp_status = ".((is_numeric($this->opp_status) && $this->opp_status > 0) ? $this->opp_status : 'null'); $sql .= ", opp_percent = ".((is_numeric($this->opp_percent) && $this->opp_percent != '') ? $this->opp_percent : 'null'); $sql .= ", public = ".($this->public ? 1 : 0); - $sql .= ", datec=".($this->date_c != '' ? "'".$this->db->idate($this->date_c)."'" : 'null'); - $sql .= ", dateo=".($this->date_start != '' ? "'".$this->db->idate($this->date_start)."'" : 'null'); - $sql .= ", datee=".($this->date_end != '' ? "'".$this->db->idate($this->date_end)."'" : 'null'); - $sql .= ", date_close=".($this->date_close != '' ? "'".$this->db->idate($this->date_close)."'" : 'null'); - $sql .= ", fk_user_close=".($this->fk_user_close > 0 ? $this->fk_user_close : "null"); + $sql .= ", datec = ".($this->date_c != '' ? "'".$this->db->idate($this->date_c)."'" : 'null'); + $sql .= ", dateo = ".($this->date_start != '' ? "'".$this->db->idate($this->date_start)."'" : 'null'); + $sql .= ", datee = ".($this->date_end != '' ? "'".$this->db->idate($this->date_end)."'" : 'null'); + $sql .= ", date_close = ".($this->date_close != '' ? "'".$this->db->idate($this->date_close)."'" : 'null'); + $sql .= ", fk_user_close = ".($this->fk_user_close > 0 ? $this->fk_user_close : "null"); $sql .= ", opp_amount = ".(strcmp($this->opp_amount, '') ? price2num($this->opp_amount) : "null"); $sql .= ", budget_amount = ".(strcmp($this->budget_amount, '') ? price2num($this->budget_amount) : "null"); $sql .= ", fk_user_modif = ".$user->id; @@ -547,6 +573,9 @@ class Project extends CommonObject $sql .= ", price_registration = ".(strcmp($this->price_registration, '') ? price2num($this->price_registration) : "null"); $sql .= ", price_booth = ".(strcmp($this->price_booth, '') ? price2num($this->price_booth) : "null"); $sql .= ", max_attendees = ".(strcmp($this->max_attendees, '') ? price2num($this->max_attendees) : "null"); + $sql .= ", date_start_event = ".($this->date_start_event != '' ? "'".$this->db->idate($this->date_start_event)."'" : 'null'); + $sql .= ", date_end_event = ".($this->date_end_event != '' ? "'".$this->db->idate($this->date_end_event)."'" : 'null'); + $sql .= ", location = '".$this->db->escape($this->location)."'"; $sql .= ", entity = ".((int) $this->entity); $sql .= " WHERE rowid = ".((int) $this->id); @@ -631,9 +660,9 @@ class Project extends CommonObject } $sql = "SELECT rowid, entity, ref, title, description, public, datec, opp_amount, budget_amount,"; - $sql .= " tms, dateo, datee, date_close, fk_soc, fk_user_creat, fk_user_modif, fk_user_close, fk_statut as status, fk_opp_status, opp_percent,"; + $sql .= " tms, dateo as date_start, datee as date_end, date_close, fk_soc, fk_user_creat, fk_user_modif, fk_user_close, fk_statut as status, fk_opp_status, opp_percent,"; $sql .= " note_private, note_public, model_pdf, usage_opportunity, usage_task, usage_bill_time, usage_organize_event, email_msgid,"; - $sql .= " accept_conference_suggestions, accept_booth_suggestions, price_registration, price_booth, max_attendees"; + $sql .= " accept_conference_suggestions, accept_booth_suggestions, price_registration, price_booth, max_attendees, date_start_event, date_end_event, location"; $sql .= " FROM ".MAIN_DB_PREFIX."projet"; if (!empty($id)) { $sql .= " WHERE rowid = ".((int) $id); @@ -665,8 +694,8 @@ class Project extends CommonObject $this->datec = $this->db->jdate($obj->datec); // TODO deprecated $this->date_m = $this->db->jdate($obj->tms); $this->datem = $this->db->jdate($obj->tms); // TODO deprecated - $this->date_start = $this->db->jdate($obj->dateo); - $this->date_end = $this->db->jdate($obj->datee); + $this->date_start = $this->db->jdate($obj->date_start); + $this->date_end = $this->db->jdate($obj->date_end); $this->date_close = $this->db->jdate($obj->date_close); $this->note_private = $obj->note_private; $this->note_public = $obj->note_public; @@ -692,6 +721,9 @@ class Project extends CommonObject $this->price_registration = $obj->price_registration; $this->price_booth = $obj->price_booth; $this->max_attendees = $obj->max_attendees; + $this->date_start_event = $this->db->jdate($obj->date_start_event); + $this->date_end_event = $this->db->jdate($obj->date_end_event); + $this->location = $obj->location; $this->email_msgid = $obj->email_msgid; $this->db->free($resql); @@ -1247,7 +1279,7 @@ class Project extends CommonObject $label .= ($label ? '
' : '').''.$langs->trans('Label').': '.$this->title; // The space must be after the : to not being explode when showing the title in img_picto if (isset($this->public)) { $label .= '
'.$langs->trans("Visibility").": "; - $label .= ($this->public ? img_picto($langs->trans('SharedProject'), 'world', 'class="paddingrightonly"').$langs->trans("SharedProject") : img_picto($langs->trans('PrivateProject'), 'private', 'class="paddingrightonly"').$langs->trans("PrivateProject")); + $label .= ($this->public ? img_picto($langs->trans('SharedProject'), 'world', 'class="pictofixedwidth"').$langs->trans("SharedProject") : img_picto($langs->trans('PrivateProject'), 'private', 'class="pictofixedwidth"').$langs->trans("PrivateProject")); } if (!empty($this->thirdparty_name)) { $label .= ($label ? '
' : '').''.$langs->trans('ThirdParty').': '.$this->thirdparty_name; // The space must be after the : to not being explode when showing the title in img_picto @@ -1308,14 +1340,14 @@ class Project extends CommonObject $result .= $linkstart; if ($withpicto) { - $result .= img_object(($notooltip ? '' : $label), $picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip pictofixedwidth em088"'), 0, 0, $notooltip ? 0 : 1); + $result .= img_object(($notooltip ? '' : $label), $picto, ($notooltip ? (($withpicto != 2) ? 'class="pictofixedwidth"' : '') : 'class="'.(($withpicto != 2) ? 'pictofixedwidth ' : '').'classfortooltip pictofixedwidth em088"'), 0, 0, $notooltip ? 0 : 1); } if ($withpicto != 2) { $result .= $this->ref; } $result .= $linkend; if ($withpicto != 2) { - $result .= (($addlabel && $this->title) ? $sep.dol_trunc($this->title, ($addlabel > 1 ? $addlabel : 0)) : ''); + $result .= (($addlabel && $this->title) ? ''.$sep.dol_trunc($this->title, ($addlabel > 1 ? $addlabel : 0)).'' : ''); } global $action; diff --git a/htdocs/projet/comment.php b/htdocs/projet/comment.php index 5ea5b920f8c..024dce3abc9 100644 --- a/htdocs/projet/comment.php +++ b/htdocs/projet/comment.php @@ -105,7 +105,7 @@ $morehtmlref = '
'; $morehtmlref .= $object->title; // Thirdparty if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) { - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project'); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'project'); } $morehtmlref .= '
'; @@ -134,15 +134,6 @@ if ($object->public) { } print ''; -// Date start - end -print ''.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; -print dol_print_date($object->date_start, 'day'); -$end = dol_print_date($object->date_end, 'day'); -if ($end) { - print ' - '.$end; -} -print ''; - // Budget print ''.$langs->trans("Budget").''; if (strcmp($object->budget_amount, '')) { @@ -150,6 +141,15 @@ if (strcmp($object->budget_amount, '')) { } print ''; +// Date start - end project +print ''.$langs->trans("Dates").''; +print dol_print_date($object->date_start, 'day'); +$end = dol_print_date($object->date_end, 'day'); +if ($end) { + print ' - '.$end; +} +print ''; + // Other attributes $cols = 2; // include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php index ee37aa68fdd..f6827fc19b3 100644 --- a/htdocs/projet/contact.php +++ b/htdocs/projet/contact.php @@ -296,7 +296,7 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= $object->title; // Thirdparty if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) { - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project'); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'project'); } $morehtmlref .= '
'; @@ -385,8 +385,15 @@ if ($id > 0 || !empty($ref)) { print ''; } - // Date start - end - print ''.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; + // Budget + print ''.$langs->trans("Budget").''; + if (strcmp($object->budget_amount, '')) { + print ''.price($object->budget_amount, '', $langs, 0, 0, 0, $conf->currency).''; + } + print ''; + + // Date start - end project + print ''.$langs->trans("Dates").''; $start = dol_print_date($object->date_start, 'day'); print ($start ? $start : '?'); $end = dol_print_date($object->date_end, 'day'); @@ -397,13 +404,6 @@ if ($id > 0 || !empty($ref)) { } print ''; - // Budget - print ''.$langs->trans("Budget").''; - if (strcmp($object->budget_amount, '')) { - print ''.price($object->budget_amount, '', $langs, 0, 0, 0, $conf->currency).''; - } - print ''; - // Other attributes $cols = 2; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php index 0a2acc4c3bc..bb50bf0def6 100644 --- a/htdocs/projet/document.php +++ b/htdocs/projet/document.php @@ -138,7 +138,7 @@ if ($object->id > 0) { $morehtmlref .= $object->title; // Thirdparty if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) { - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project'); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'project'); } $morehtmlref .= '
'; diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 346382c6294..f96f5737cf4 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -218,7 +218,7 @@ $morehtmlref = '
'; $morehtmlref .= $object->title; // Thirdparty if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) { - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project'); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'project'); } $morehtmlref .= '
'; @@ -307,8 +307,15 @@ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { print ''; } -// Date start - end -print ''.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; +// Budget +print ''.$langs->trans("Budget").''; +if (strcmp($object->budget_amount, '')) { + print ''.price($object->budget_amount, '', $langs, 1, 0, 0, $conf->currency).''; +} +print ''; + +// Date start - end project +print ''.$langs->trans("Dates").''; $start = dol_print_date($object->date_start, 'day'); print ($start ? $start : '?'); $end = dol_print_date($object->date_end, 'day'); @@ -319,13 +326,6 @@ if ($object->hasDelay()) { } print ''; -// Budget -print ''.$langs->trans("Budget").''; -if (strcmp($object->budget_amount, '')) { - print ''.price($object->budget_amount, '', $langs, 1, 0, 0, $conf->currency).''; -} -print ''; - // Other attributes $cols = 2; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; diff --git a/htdocs/projet/ganttview.php b/htdocs/projet/ganttview.php index c5549429edb..f2889d7c469 100644 --- a/htdocs/projet/ganttview.php +++ b/htdocs/projet/ganttview.php @@ -117,7 +117,7 @@ if (($id > 0 && is_numeric($id)) || !empty($ref)) { $morehtmlref .= $object->title; // Thirdparty if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) { - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project'); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'project'); } $morehtmlref .= '
'; @@ -179,8 +179,15 @@ if (($id > 0 && is_numeric($id)) || !empty($ref)) { } print ''; - // Date start - end - print ''.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; + // Budget + print ''.$langs->trans("Budget").''; + if (strcmp($object->budget_amount, '')) { + print price($object->budget_amount, '', $langs, 1, 0, 0, $conf->currency); + } + print ''; + + // Date start - end project + print ''.$langs->trans("Dates").''; $start = dol_print_date($object->date_start, 'day'); print ($start ? $start : '?'); $end = dol_print_date($object->date_end, 'day'); @@ -191,13 +198,6 @@ if (($id > 0 && is_numeric($id)) || !empty($ref)) { } print ''; - // Budget - print ''.$langs->trans("Budget").''; - if (strcmp($object->budget_amount, '')) { - print price($object->budget_amount, '', $langs, 1, 0, 0, $conf->currency); - } - print ''; - // Other attributes $cols = 2; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; diff --git a/htdocs/projet/info.php b/htdocs/projet/info.php index bef020d9a38..e6aaca355e1 100644 --- a/htdocs/projet/info.php +++ b/htdocs/projet/info.php @@ -132,7 +132,7 @@ $morehtmlref = '
'; $morehtmlref .= $object->title; // Thirdparty if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) { - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project'); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'project'); } $morehtmlref .= '
'; diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 9ca5fc63c76..696888a75dd 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -1355,7 +1355,8 @@ while ($i < $imaxinloop) { $totalarray['nbfield']++; } } - // Date start + + // Date start project if (!empty($arrayfields['p.dateo']['checked'])) { print ''; print dol_print_date($db->jdate($obj->date_start), 'day'); @@ -1364,7 +1365,7 @@ while ($i < $imaxinloop) { $totalarray['nbfield']++; } } - // Date end + // Date end project if (!empty($arrayfields['p.datee']['checked'])) { print ''; print dol_print_date($db->jdate($obj->date_end), 'day'); @@ -1373,6 +1374,7 @@ while ($i < $imaxinloop) { $totalarray['nbfield']++; } } + // Visibility if (!empty($arrayfields['p.public']['checked'])) { print ''; diff --git a/htdocs/projet/note.php b/htdocs/projet/note.php index ce099c04745..3ca7949b35a 100644 --- a/htdocs/projet/note.php +++ b/htdocs/projet/note.php @@ -102,7 +102,7 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= $object->title; // Thirdparty if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) { - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project'); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'project'); } $morehtmlref .= '
'; diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 73d3c238026..18a75449f24 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -553,7 +553,7 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= $object->title; // Thirdparty if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) { - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project'); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'project'); } $morehtmlref .= ''; @@ -614,8 +614,15 @@ if ($id > 0 || !empty($ref)) { } print ''; - // Date start - end - print ''.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; + // Budget + print ''.$langs->trans("Budget").''; + if (strcmp($object->budget_amount, '')) { + print ''.price($object->budget_amount, '', $langs, 1, 0, 0, $conf->currency).''; + } + print ''; + + // Date start - end project + print ''.$langs->trans("Dates").''; $start = dol_print_date($object->date_start, 'day'); print ($start ? $start : '?'); $end = dol_print_date($object->date_end, 'day'); @@ -626,13 +633,6 @@ if ($id > 0 || !empty($ref)) { } print ''; - // Budget - print ''.$langs->trans("Budget").''; - if (strcmp($object->budget_amount, '')) { - print ''.price($object->budget_amount, '', $langs, 1, 0, 0, $conf->currency).''; - } - print ''; - // Other attributes $cols = 2; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; @@ -750,12 +750,12 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third } print ''; - // Date start + // Date start task print ''.$langs->trans("DateStart").''; print $form->selectDate((!empty($date_start) ? $date_start : ''), 'dateo', 1, 1, 0, '', 1, 1); print ''; - // Date end + // Date end task print ''.$langs->trans("DateEnd").''; print $form->selectDate((!empty($date_end) ? $date_end : -1), 'datee', -1, 1, 0, '', 1, 1); print ''; diff --git a/htdocs/projet/tasks/comment.php b/htdocs/projet/tasks/comment.php index 1f5628bb050..4540112f4c3 100644 --- a/htdocs/projet/tasks/comment.php +++ b/htdocs/projet/tasks/comment.php @@ -132,7 +132,7 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= $projectstatic->title; // Thirdparty if ($projectstatic->thirdparty->id > 0) { - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$projectstatic->thirdparty->getNomUrl(1, 'project'); + $morehtmlref .= '
'.$projectstatic->thirdparty->getNomUrl(1, 'project'); } $morehtmlref .= ''; @@ -221,8 +221,15 @@ if ($id > 0 || !empty($ref)) { print ''; } - // Date start - end - print ''.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; + // Budget + print ''.$langs->trans("Budget").''; + if (strcmp($projectstatic->budget_amount, '')) { + print price($projectstatic->budget_amount, '', $langs, 1, 0, 0, $conf->currency); + } + print ''; + + // Date start - end project + print ''.$langs->trans("Dates").''; $start = dol_print_date($projectstatic->date_start, 'day'); print ($start ? $start : '?'); $end = dol_print_date($projectstatic->date_end, 'day'); @@ -233,13 +240,6 @@ if ($id > 0 || !empty($ref)) { } print ''; - // Budget - print ''.$langs->trans("Budget").''; - if (strcmp($projectstatic->budget_amount, '')) { - print price($projectstatic->budget_amount, '', $langs, 1, 0, 0, $conf->currency); - } - print ''; - // Other attributes $cols = 2; //include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php index 14a87b375e8..4bbc48900af 100644 --- a/htdocs/projet/tasks/contact.php +++ b/htdocs/projet/tasks/contact.php @@ -196,7 +196,7 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= $projectstatic->title; // Thirdparty if ($projectstatic->thirdparty->id > 0) { - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$projectstatic->thirdparty->getNomUrl(1, 'project'); + $morehtmlref .= '
'.$projectstatic->thirdparty->getNomUrl(1, 'project'); } $morehtmlref .= ''; @@ -257,8 +257,15 @@ if ($id > 0 || !empty($ref)) { } print ''; - // Date start - end - print ''.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; + // Budget + print ''.$langs->trans("Budget").''; + if (strcmp($projectstatic->budget_amount, '')) { + print price($projectstatic->budget_amount, '', $langs, 1, 0, 0, $conf->currency); + } + print ''; + + // Date start - end project + print ''.$langs->trans("Dates").''; $start = dol_print_date($projectstatic->date_start, 'day'); print ($start ? $start : '?'); $end = dol_print_date($projectstatic->date_end, 'day'); @@ -269,13 +276,6 @@ if ($id > 0 || !empty($ref)) { } print ''; - // Budget - print ''.$langs->trans("Budget").''; - if (strcmp($projectstatic->budget_amount, '')) { - print price($projectstatic->budget_amount, '', $langs, 1, 0, 0, $conf->currency); - } - print ''; - // Other attributes $cols = 2; //include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php index 3e569cd557f..6a62e973a62 100644 --- a/htdocs/projet/tasks/document.php +++ b/htdocs/projet/tasks/document.php @@ -153,7 +153,7 @@ if ($object->id > 0) { $morehtmlref .= $projectstatic->title; // Thirdparty if ($projectstatic->thirdparty->id > 0) { - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$projectstatic->thirdparty->getNomUrl(1, 'project'); + $morehtmlref .= '
'.$projectstatic->thirdparty->getNomUrl(1, 'project'); } $morehtmlref .= ''; @@ -214,8 +214,15 @@ if ($object->id > 0) { } print ''; - // Date start - end - print ''.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; + // Budget + print ''.$langs->trans("Budget").''; + if (strcmp($projectstatic->budget_amount, '')) { + print price($projectstatic->budget_amount, '', $langs, 1, 0, 0, $conf->currency); + } + print ''; + + // Date start - end project + print ''.$langs->trans("Dates").''; $start = dol_print_date($projectstatic->date_start, 'day'); print ($start ? $start : '?'); $end = dol_print_date($projectstatic->date_end, 'day'); @@ -226,13 +233,6 @@ if ($object->id > 0) { } print ''; - // Budget - print ''.$langs->trans("Budget").''; - if (strcmp($projectstatic->budget_amount, '')) { - print price($projectstatic->budget_amount, '', $langs, 1, 0, 0, $conf->currency); - } - print ''; - // Other attributes $cols = 2; //include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 1f0130bd7b4..76261480ffe 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -1117,7 +1117,8 @@ while ($i < $imaxinloop) { $totalarray['nbfield']++; } } - // Date start + + // Date start project if (!empty($arrayfields['t.dateo']['checked'])) { print ''; print dol_print_date($db->jdate($obj->date_start), 'day'); @@ -1126,7 +1127,7 @@ while ($i < $imaxinloop) { $totalarray['nbfield']++; } } - // Date end + // Date end project if (!empty($arrayfields['t.datee']['checked'])) { print ''; print dol_print_date($db->jdate($obj->date_end), 'day'); diff --git a/htdocs/projet/tasks/note.php b/htdocs/projet/tasks/note.php index 40f8f636e72..01c39c990f4 100644 --- a/htdocs/projet/tasks/note.php +++ b/htdocs/projet/tasks/note.php @@ -142,7 +142,7 @@ if ($object->id > 0) { $morehtmlref .= $projectstatic->title; // Thirdparty if ($projectstatic->thirdparty->id > 0) { - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$projectstatic->thirdparty->getNomUrl(1, 'project'); + $morehtmlref .= '
'.$projectstatic->thirdparty->getNomUrl(1, 'project'); } $morehtmlref .= ''; @@ -203,8 +203,15 @@ if ($object->id > 0) { } print ''; - // Date start - end - print ''.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; + // Budget + print ''.$langs->trans("Budget").''; + if (strcmp($projectstatic->budget_amount, '')) { + print price($projectstatic->budget_amount, '', $langs, 1, 0, 0, $conf->currency); + } + print ''; + + // Date start - end project + print ''.$langs->trans("Dates").''; $start = dol_print_date($projectstatic->date_start, 'day'); print ($start ? $start : '?'); $end = dol_print_date($projectstatic->date_end, 'day'); @@ -215,13 +222,6 @@ if ($object->id > 0) { } print ''; - // Budget - print ''.$langs->trans("Budget").''; - if (strcmp($projectstatic->budget_amount, '')) { - print price($projectstatic->budget_amount, '', $langs, 1, 0, 0, $conf->currency); - } - print ''; - // Other attributes $cols = 2; //include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 77cd9f09c9e..331b29acb96 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -264,7 +264,7 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= $projectstatic->title; // Thirdparty if (!empty($projectstatic->thirdparty->id) &&$projectstatic->thirdparty->id > 0) { - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$projectstatic->thirdparty->getNomUrl(1, 'project'); + $morehtmlref .= '
'.$projectstatic->thirdparty->getNomUrl(1, 'project'); } $morehtmlref .= ''; @@ -325,8 +325,15 @@ if ($id > 0 || !empty($ref)) { } print ''; - // Date start - end - print ''.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; + // Budget + print ''.$langs->trans("Budget").''; + if (strcmp($projectstatic->budget_amount, '')) { + print ''.price($projectstatic->budget_amount, '', $langs, 1, 0, 0, $conf->currency).''; + } + print ''; + + // Date start - end project + print ''.$langs->trans("Dates").''; $start = dol_print_date($projectstatic->date_start, 'day'); print ($start ? $start : '?'); $end = dol_print_date($projectstatic->date_end, 'day'); @@ -337,13 +344,6 @@ if ($id > 0 || !empty($ref)) { } print ''; - // Budget - print ''.$langs->trans("Budget").''; - if (strcmp($projectstatic->budget_amount, '')) { - print ''.price($projectstatic->budget_amount, '', $langs, 1, 0, 0, $conf->currency).''; - } - print ''; - // Other attributes $cols = 2; //include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; @@ -578,7 +578,7 @@ if ($id > 0 || !empty($ref)) { } print ''; - // Date start - Date end + // Date start - Date end task print ''.$langs->trans("DateStart").' - '.$langs->trans("Deadline").''; $start = dol_print_date($object->date_start, 'dayhour'); print ($start ? $start : '?'); diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 00d45eedea7..8e30664232b 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -906,7 +906,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser $morehtmlref .= $projectstatic->title; // Thirdparty if (!empty($projectstatic->thirdparty->id) && $projectstatic->thirdparty->id > 0) { - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$projectstatic->thirdparty->getNomUrl(1, 'project'); + $morehtmlref .= '
'.$projectstatic->thirdparty->getNomUrl(1, 'project'); } $morehtmlref .= ''; @@ -967,8 +967,15 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser } print ''; - // Date start - end - print ''.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; + // Budget + print ''.$langs->trans("Budget").''; + if (strcmp($projectstatic->budget_amount, '')) { + print ''.price($projectstatic->budget_amount, '', $langs, 1, 0, 0, $conf->currency).''; + } + print ''; + + // Date start - end project + print ''.$langs->trans("Dates").''; $start = dol_print_date($projectstatic->date_start, 'day'); print ($start ? $start : '?'); $end = dol_print_date($projectstatic->date_end, 'day'); @@ -979,16 +986,12 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser } print ''; - // Budget - print ''.$langs->trans("Budget").''; - if (strcmp($projectstatic->budget_amount, '')) { - print ''.price($projectstatic->budget_amount, '', $langs, 1, 0, 0, $conf->currency).''; - } - print ''; - // Other attributes $cols = 2; - //include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + $savobject = $object; + $object = $projectstatic; + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + $object = $savobject; print ''; @@ -1127,7 +1130,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser } print ''; - // Date start - Date end + // Date start - Date end task print ''.$langs->trans("DateStart").' - '.$langs->trans("Deadline").''; $start = dol_print_date($object->date_start, 'dayhour'); print ($start ? $start : '?'); diff --git a/htdocs/public/eventorganization/attendee_new.php b/htdocs/public/eventorganization/attendee_new.php index 589bf2c8dac..8d7e4503c6b 100644 --- a/htdocs/public/eventorganization/attendee_new.php +++ b/htdocs/public/eventorganization/attendee_new.php @@ -475,7 +475,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen $resultprod = $productforinvoicerow->fetch($conf->global->SERVICE_CONFERENCE_ATTENDEE_SUBSCRIPTION); } - // Create invoice + // Create the draft invoice for the payment if ($resultprod < 0) { $error++; $errmsg .= $productforinvoicerow->error; @@ -524,12 +524,19 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen $vattouse = get_default_tva($mysoc, $thirdparty, $productforinvoicerow->id); $labelforproduct = $outputlangs->trans("EventFee", $project->title); - $date_start = $project->date_start; - $date_end = $project->date_end; + if ($project->location) { + $labelforproduct .= ' - '.$project->location; + } + $date_start = $project->date_start_event; + $date_end = $project->date_end_event; // If there is no lines yet, we add one if (empty($facture->lines)) { - $result = $facture->addline($labelforproduct, floatval($project->price_registration), 1, $vattouse, 0, 0, $productforinvoicerow->id, 0, $date_start, $date_end, 0, 0, '', 'HT', 0, 1); + $pu_ttc = floatval($project->price_registration); + $pu_ht = 0; + $price_base_type = 'TTC'; + + $result = $facture->addline($labelforproduct, $pu_ht, 1, $vattouse, 0, 0, $productforinvoicerow->id, 0, $date_start, $date_end, 0, 0, '', $price_base_type, $pu_ttc, 1); if ($result <= 0) { $confattendee->error = $facture->error; $confattendee->errors = $facture->errors; @@ -642,28 +649,60 @@ print load_fiche_titre($langs->trans("NewRegistration"), '', '', 0, 0, 'center') print '
'; print '
'; -print '
'; +print '
'; // Welcome message -print $langs->trans("EvntOrgWelcomeMessage", $project->title . ' '. $conference->label); +print ''.$langs->trans("EvntOrgWelcomeMessage").''; print '
'; +print ''.$project->title . ' '. $conference->label.'
'; +if ($project->date_start_event || $project->date_end_event) { + print ''; +} +if ($project->date_start_event) { + $format = 'day'; + $tmparray = dol_getdate($project->date_start_event, false, ''); + if ($tmparray['hours'] || $tmparray['minutes'] || $tmparray['minutes']) { + $format = 'dayhour'; + } + print dol_print_date($project->date_start_event, $format); +} +if ($project->date_start_event && $project->date_end_event) { + print ' - '; +} +if ($project->date_end_event) { + $format = 'day'; + $tmparray = dol_getdate($project->date_end_event, false, ''); + if ($tmparray['hours'] || $tmparray['minutes'] || $tmparray['minutes']) { + $format = 'dayhour'; + } + print dol_print_date($project->date_end_event, $format); +} +if ($project->date_start_event || $project->date_end_event) { + print '
'; +} +if ($project->location) { + print ''.$project->location.'
'; +} + $maxattendees = 0; -if ($conference->id) { +if ($conference->id > 0) { + /* date of project is not date of event so commented print $langs->trans("Date").': '; print dol_print_date($conference->datep); if ($conference->date_end) { print ' - '; print dol_print_date($conference->datef); - } + }*/ } else { + /* date of project is not date of event so commented print $langs->trans("Date").': '; print dol_print_date($project->date_start); if ($project->date_end) { print ' - '; print dol_print_date($project->date_end); - } - $maxattendees = $project->max_attendees; + }*/ + $maxattendees = $project->max_attendees; // Max attendeed for the project/event } print '
'; @@ -674,7 +713,6 @@ if ($maxattendees && $currentnbofattendees >= $maxattendees) { } -print '
'; dol_htmloutput_errors($errmsg, $errors); @@ -691,8 +729,8 @@ if ((!empty($conference->id) && $conference->status == ConferenceOrBooth::STATUS print ''; print '
'; - - print '
' . $langs->trans("FieldsWithAreMandatory", '*') . '
'; + print '
'; + //print '' . $langs->trans("FieldsWithAreMandatory", '*') . '
'; //print $langs->trans("FieldsWithIsForPublic",'**').'
'; print dol_get_fiche_head(''); @@ -711,22 +749,26 @@ if ((!empty($conference->id) && $conference->status == ConferenceOrBooth::STATUS print '' . "\n"; // Email - print '' . "\n"; + print '' . "\n"; // Company - print '' . "\n"; + print 'price_registration)) ? '' : ' required').'>' . "\n"; // Email company for invoice if ($project->price_registration) { - print '' . "\n"; } @@ -743,7 +785,7 @@ if ((!empty($conference->id) && $conference->status == ConferenceOrBooth::STATUS print ''; // Country - print ''; } @@ -801,8 +843,8 @@ if ((!empty($conference->id) && $conference->status == ConferenceOrBooth::STATUS } print ''; - print "\n"; + print "
"; print ''; } diff --git a/htdocs/public/onlinesign/newonlinesign.php b/htdocs/public/onlinesign/newonlinesign.php index 91c3ec2ce73..fa16492a169 100644 --- a/htdocs/public/onlinesign/newonlinesign.php +++ b/htdocs/public/onlinesign/newonlinesign.php @@ -130,6 +130,8 @@ if ($source == 'proposal') { $securekeyseed = getDolGlobalString('PROPOSAL_ONLINE_SIGNATURE_SECURITY_TOKEN'); } elseif ($source == 'contract') { $securekeyseed = getDolGlobalString('CONTRACT_ONLINE_SIGNATURE_SECURITY_TOKEN'); +} elseif ($source == 'fichinter') { + $securekeyseed = getDolGlobalString('FICHINTER_ONLINE_SIGNATURE_SECURITY_TOKEN'); } if (!dol_verifyHash($securekeyseed.$type.$ref.(isModEnabled('multicompany') ? $entity : ''), $SECUREKEY, '0')) { httponly_accessforbidden('Bad value for securitykey. Value provided '.dol_escape_htmltag($SECUREKEY).' does not match expected value for ref='.dol_escape_htmltag($ref), 403, 1); @@ -143,6 +145,10 @@ if ($source == 'proposal') { require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; $object = new Contrat($db); $result= $object->fetch(0, $ref); +} elseif ($source == 'fichinter') { + require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; + $object = new Fichinter($db); + $result= $object->fetch(0, $ref); } else { httponly_accessforbidden($langs->trans('ErrorBadParameters')." - Bad value for source", 400, 1); } @@ -289,6 +295,9 @@ if (empty($text)) { } elseif ($source == 'contract') { $text .= ''."\n"; $text .= ''."\n"; + } elseif ($source == 'fichinter') { + $text .= ''."\n"; + $text .= ''."\n"; } } print $text; @@ -300,6 +309,8 @@ if ($source == 'proposal') { print ''."\n"; } elseif ($source == 'contract') { print ''."\n"; +} elseif ($source == 'fichinter') { + print ''."\n"; } $found = false; $error = 0; @@ -430,6 +441,55 @@ if ($source == 'proposal') { } + print ''; + print ''; + print ''."\n"; +} elseif ($source == 'fichinter') { // Signature on fichinter + $found = true; + $langs->load("fichinter"); + + $result = $object->fetch_thirdparty($object->socid); + // Proposer + print ''."\n"; + + // Target + print ''."\n"; + + // Object + $text = ''.$langs->trans("SignatureFichinterRef", $object->ref).''; + print ''."\n"; @@ -542,6 +602,12 @@ if ($action == "dosign" && empty($cancel)) { } else { print ''; } + } elseif ($source == 'fichinter') { + if ($message == 'signed') { + print ''.$langs->trans("FichinterSigned").''; + } else { + print ''; + } } } print ''."\n"; diff --git a/htdocs/public/ticket/view.php b/htdocs/public/ticket/view.php index 3f137148a89..bab3c501ca3 100644 --- a/htdocs/public/ticket/view.php +++ b/htdocs/public/ticket/view.php @@ -371,7 +371,7 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a if ($object->dao->fk_statut < Ticket::STATUS_CLOSED) { // New message - print ''; + print ''; // Close ticket if ($object->dao->fk_statut >= Ticket::STATUS_NOT_READ && $object->dao->fk_statut < Ticket::STATUS_CLOSED) { diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 011781f33e2..9afa6ec57d8 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -51,10 +51,8 @@ if (isModEnabled("product") || isModEnabled("service")) { if (isModEnabled("propal")) { require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; } -if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order")) { - require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; - require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.dispatch.class.php'; -} +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.dispatch.class.php'; if (isModEnabled('productbatch')) { require_once DOL_DOCUMENT_ROOT.'/product/class/productbatch.class.php'; } @@ -1380,39 +1378,25 @@ if ($action == 'create') { $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->reception->creer, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); // Project if (!empty($conf->project->enabled)) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; + $morehtmlref .= '
'; if (0) { // Do not change on reception - if ($action != 'classify') { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; - } - if ($action == 'classify') { - // $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= ''; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); + if ($action != 'classify' && $permissiontoadd) { + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $object->socid : -1), $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { - // We don't have project on reception, so we will use the project or source object instead - // TODO Add project on reception - $morehtmlref .= ' : '; - if (!empty($objectsrc->fk_project)) { + if (!empty($objectsrc) && !empty($objectsrc->fk_project)) { $proj = new Project($db); $proj->fetch($objectsrc->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/reception/class/receptionstats.class.php b/htdocs/reception/class/receptionstats.class.php index a27f458d01a..7a8562b706d 100644 --- a/htdocs/reception/class/receptionstats.class.php +++ b/htdocs/reception/class/receptionstats.class.php @@ -69,7 +69,7 @@ class ReceptionStats extends Stats $this->where .= " c.fk_statut > 0"; // Not draft and not cancelled //$this->where.= " AND c.fk_soc = s.rowid AND c.entity = ".$conf->entity; - $this->where .= " AND c.entity = ".$conf->entity; + $this->where .= " AND c.entity IN (".getEntity('reception').")"; if (empty($user->rights->societe->client->voir) && !$this->socid) { $this->where .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } @@ -128,6 +128,54 @@ class ReceptionStats extends Stats return $this->_getNbByYear($sql); } + /** + * Return the orders amount by month for a year + * + * @param int $year Year to scan + * @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month + * @return array Array with amount by month + */ + public function getAmountByMonth($year, $format = 0) + { + global $user; + + $sql = "SELECT date_format(c.date_valid,'%m') as dm, SUM(c.".$this->field.")"; + $sql .= " FROM ".$this->from; + if (empty($user->rights->societe->client->voir) && !$this->socid) { + $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + } + $sql .= " WHERE c.date_valid BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'"; + $sql .= " AND ".$this->where; + $sql .= " GROUP BY dm"; + $sql .= $this->db->order('dm', 'DESC'); + + $res = $this->_getAmountByMonth($year, $sql, $format); + return $res; + } + + /** + * Return the orders amount average by month for a year + * + * @param int $year year for stats + * @return array array with number by month + */ + public function getAverageByMonth($year) + { + global $user; + + $sql = "SELECT date_format(c.date_valid,'%m') as dm, AVG(c.".$this->field.")"; + $sql .= " FROM ".$this->from; + if (empty($user->rights->societe->client->voir) && !$this->socid) { + $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + } + $sql .= " WHERE c.date_valid BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'"; + $sql .= " AND ".$this->where; + $sql .= " GROUP BY dm"; + $sql .= $this->db->order('dm', 'DESC'); + + return $this->_getAverageByMonth($year, $sql); + } + /** * Return nb, total and average * diff --git a/htdocs/reception/contact.php b/htdocs/reception/contact.php index 442657ecf43..a03460b1e49 100644 --- a/htdocs/reception/contact.php +++ b/htdocs/reception/contact.php @@ -35,6 +35,8 @@ if (!empty($conf->project->enabled)) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; } +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.dispatch.class.php'; $langs->loadLangs(array("orders", "receptions", "companies")); @@ -75,6 +77,20 @@ if ($origin == 'reception') { } } +if (isModEnabled("reception")) { + $permissiontoread = $user->rights->reception->lire; + $permissiontoadd = $user->rights->reception->creer; + $permissiondellink = $user->rights->reception->creer; // Used by the include of actions_dellink.inc.php + $permissiontovalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->reception->creer)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->reception->reception_advance->validate))); + $permissiontodelete = $user->rights->reception->supprimer; +} else { + $permissiontoread = $user->rights->fournisseur->commande->receptionner; + $permissiontoadd = $user->rights->fournisseur->commande->receptionner; + $permissiondellink = $user->rights->fournisseur->commande->receptionner; // Used by the include of actions_dellink.inc.php + $permissiontovalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->fournisseur->commande->receptionner)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->fournisseur->commande_advance->check))); + $permissiontodelete = $user->rights->fournisseur->commande->receptionner; +} + /* * Actions @@ -146,39 +162,25 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= $form->editfieldkey("RefSupplier", '', $object->ref_supplier, $object, $user->rights->reception->creer, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefSupplier", '', $object->ref_supplier, $object, $user->rights->reception->creer, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); // Project if (!empty($conf->project->enabled)) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; + $morehtmlref .= '
'; if (0) { // Do not change on reception - if ($action != 'classify') { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; - } - if ($action == 'classify') { - // $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= ''; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); + if ($action != 'classify' && $permissiontoadd) { + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $object->socid : -1), $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { - // We don't have project on reception, so we will use the project or source object instead - // TODO Add project on reception - $morehtmlref .= ' : '; - if (!empty($objectsrc->fk_project)) { + if (!empty($objectsrc) && !empty($objectsrc->fk_project)) { $proj = new Project($db); $proj->fetch($objectsrc->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } - } else { - $morehtmlref .= ''; } } } @@ -191,7 +193,7 @@ if ($id > 0 || !empty($ref)) { //print '
'; print '
'; - print '
' . $langs->trans("EmailAttendee") . '*'; + print '
' . $langs->trans("EmailAttendee") . ''; print img_picto('', 'email', 'class="pictofixedwidth"'); - print '
' . $langs->trans("Company"); + print '
'; if (!empty(floatval($project->price_registration))) { - print '*'; + print ''; } - print ' '; + print $langs->trans("Company"); + if (!empty(floatval($project->price_registration))) { + print ''; + } + print ''; print img_picto('', 'company', 'class="pictofixedwidth"'); - print '
' . $langs->trans("EmailCompanyForInvoice") . ''; + print '
' . $form->textwithpicto($langs->trans("EmailCompany"), $langs->trans("EmailCompanyForInvoice")) . ''; print img_picto('', 'email', 'class="pictofixedwidth"'); print '
' . $langs->trans('Country') . '*'; + print '
trans('Country') . ''; print img_picto('', 'country', 'class="pictofixedwidth"'); $country_id = GETPOST('country_id'); if (!$country_id && !empty($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE)) { @@ -777,7 +819,7 @@ if ((!empty($conference->id) && $conference->status == ConferenceOrBooth::STATUS if ($project->price_registration) { print '
' . $langs->trans('Price') . ''; - print price($project->price_registration, 1, $langs, 1, -1, -1, $conf->currency); + print ''.price($project->price_registration, 1, $langs, 1, -1, -1, $conf->currency).''; print '

'.$langs->trans("WelcomeOnOnlineSignaturePageContract", $mysoc->name).'
'.$langs->trans("ThisScreenAllowsYouToSignDocFromContract", $creditor).'


'.$langs->trans("WelcomeOnOnlineSignaturePageFichinter", $mysoc->name).'
'.$langs->trans("ThisScreenAllowsYouToSignDocFromFichinter", $creditor).'

'.$langs->trans("ThisIsInformationOnDocumentToSignProposal").' :
'.$langs->trans("ThisIsInformationOnDocumentToSignContract").' :
'.$langs->trans("ThisIsInformationOnDocumentToSignFichinter").' :
'.$langs->trans("Proposer"); + print ''; + print img_picto('', 'company', 'class="pictofixedwidth"'); + print ''.$creditor.''; + print ''; + print '
'.$langs->trans("ThirdParty"); + print ''; + print img_picto('', 'company', 'class="pictofixedwidth"'); + print ''.$object->thirdparty->name.''; + print '
'.$langs->trans("Designation"); + print ''.$text; + + $last_main_doc_file = $object->last_main_doc; + + if (empty($last_main_doc_file) || !dol_is_file(DOL_DATA_ROOT.'/'.$object->last_main_doc)) { + // It seems document has never been generated, or was generated and then deleted. + // So we try to regenerate it with its default template. + $defaulttemplate = ''; // We force the use an empty string instead of $object->model_pdf to be sure to use a "main" default template and not the last one used. + $object->generateDocument($defaulttemplate, $langs); + } + + $directdownloadlink = $object->getLastMainDocLink('fichinter'); + if ($directdownloadlink) { + print '
'; + print img_mime($object->last_main_doc, ''); + if ($message == "signed") { + print $langs->trans("DownloadSignedDocument").''; + } else { + print $langs->trans("DownloadDocument").''; + } + } + + print ''; print ''; print '
'; + print '
'; // Linked documents if ($origin == 'order_supplier' && $object->$typeobject->id && (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || isModEnabled("supplier_order"))) { print '
'; diff --git a/htdocs/reception/document.php b/htdocs/reception/document.php index 10227373015..980b5e50a33 100644 --- a/htdocs/reception/document.php +++ b/htdocs/reception/document.php @@ -37,6 +37,8 @@ require_once DOL_DOCUMENT_ROOT.'/reception/class/reception.class.php'; if (!empty($conf->project->enabled)) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.dispatch.class.php'; // Load translation files required by the page $langs->loadLangs(array('companies', 'other')); @@ -65,19 +67,48 @@ if (!$sortfield) { } $object = new Reception($db); - -if ($object->fetch($id, $ref)) { +if ($id > 0 || !empty($ref)) { + $object->fetch($id, $ref); $object->fetch_thirdparty(); + + if (!empty($object->origin)) { + $origin = $object->origin; + + $object->fetch_origin(); + $typeobject = $object->origin; + } + + // Linked documents + if ($origin == 'order_supplier' && $object->$typeobject->id && (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || isModEnabled("supplier_order"))) { + $objectsrc = new CommandeFournisseur($db); + $objectsrc->fetch($object->$typeobject->id); + } + $upload_dir = $conf->reception->dir_output."/".dol_sanitizeFileName($object->ref); } +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('receptiondocument')); + // Security check -if ($user->socid) { +if ($user->socid > 0) { $socid = $user->socid; } $result = restrictedArea($user, 'reception', $object->id, ''); -$permissiontoadd = $user->rights->reception->creer; // Used by the include of actions_dellink.inc.php +if (isModEnabled("reception")) { + $permissiontoread = $user->rights->reception->lire; + $permissiontoadd = $user->rights->reception->creer; + $permissiondellink = $user->rights->reception->creer; // Used by the include of actions_dellink.inc.php + $permissiontovalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->reception->creer)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->reception->reception_advance->validate))); + $permissiontodelete = $user->rights->reception->supprimer; +} else { + $permissiontoread = $user->rights->fournisseur->commande->receptionner; + $permissiontoadd = $user->rights->fournisseur->commande->receptionner; + $permissiondellink = $user->rights->fournisseur->commande->receptionner; // Used by the include of actions_dellink.inc.php + $permissiontovalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->fournisseur->commande->receptionner)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->fournisseur->commande_advance->check))); + $permissiontodelete = $user->rights->fournisseur->commande->receptionner; +} /* @@ -117,41 +148,30 @@ if ($id > 0 || !empty($ref)) { $morehtmlref = '
'; + // Ref customer reception + $morehtmlref .= $form->editfieldkey("RefSupplier", '', $object->ref_supplier, $object, $user->rights->reception->creer, 'string', '', 0, 1); + $morehtmlref .= $form->editfieldval("RefSupplier", '', $object->ref_supplier, $object, $user->rights->reception->creer, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); // Project if (!empty($conf->project->enabled)) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; - if (0) { // Do not change on shipment - if ($action != 'classify') { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; - } - if ($action == 'classify') { - // $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= '
'; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= '
'; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= '
'; + if (0) { // Do not change on reception + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); + if ($action != 'classify' && $permissiontoadd) { + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $object->socid : -1), $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { - // We don't have project on shipment, so we will use the project or source object instead - // TODO Add project on shipment - $morehtmlref .= ' : '; - if (!empty($objectsrc->fk_project)) { + if (!empty($objectsrc) && !empty($objectsrc->fk_project)) { $proj = new Project($db); $proj->fetch($objectsrc->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/reception/note.php b/htdocs/reception/note.php index 617d260e643..d916099b872 100644 --- a/htdocs/reception/note.php +++ b/htdocs/reception/note.php @@ -28,11 +28,12 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/reception/class/reception.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/reception.lib.php'; -dol_include_once('/fourn/class/fournisseur.commande.class.php'); if (!empty($conf->project->enabled)) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; } +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.dispatch.class.php'; $langs->loadLangs(array("receptions", "companies", "bills", 'deliveries', 'orders', 'stocks', 'other', 'propal')); @@ -46,32 +47,41 @@ if ($id > 0 || !empty($ref)) { $object->fetch_thirdparty(); if (!empty($object->origin)) { - $typeobject = $object->origin; $origin = $object->origin; + $object->fetch_origin(); + $typeobject = $object->origin; } // Linked documents - if ($typeobject == 'commande' && $object->$typeobject->id && isModEnabled('commande')) { - $objectsrc = new Commande($db); - $objectsrc->fetch($object->$typeobject->id); - } - if ($typeobject == 'propal' && $object->$typeobject->id && isModEnabled("propal")) { - $objectsrc = new Propal($db); + if ($origin == 'order_supplier' && $object->$typeobject->id && (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || isModEnabled("supplier_order"))) { + $objectsrc = new CommandeFournisseur($db); $objectsrc->fetch($object->$typeobject->id); } } -$permissionnote = $user->rights->reception->creer; // Used by the include of actions_setnotes.inc.php +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('receptionnote')); // Security check if ($user->socid > 0) { $socid = $user->socid; } - -// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context -$hookmanager->initHooks(array('receptionnote')); +if (isModEnabled("reception")) { + $permissiontoread = $user->rights->reception->lire; + $permissiontoadd = $user->rights->reception->creer; + $permissiondellink = $user->rights->reception->creer; // Used by the include of actions_dellink.inc.php + $permissiontovalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->reception->creer)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->reception->reception_advance->validate))); + $permissiontodelete = $user->rights->reception->supprimer; +} else { + $permissiontoread = $user->rights->fournisseur->commande->receptionner; + $permissiontoadd = $user->rights->fournisseur->commande->receptionner; + $permissiondellink = $user->rights->fournisseur->commande->receptionner; // Used by the include of actions_dellink.inc.php + $permissiontovalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->fournisseur->commande->receptionner)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->fournisseur->commande_advance->check))); + $permissiontodelete = $user->rights->fournisseur->commande->receptionner; +} +$permissionnote = $user->rights->reception->creer; // Used by the include of actions_setnotes.inc.php if ($origin == 'reception') { $result = restrictedArea($user, $origin, $object->id); @@ -106,7 +116,7 @@ if (empty($reshook)) { * View */ -llxHeader('', 'Reception'); +llxHeader('', $langs->trans('Reception')); $form = new Form($db); @@ -123,39 +133,25 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= $form->editfieldkey("RefSupplier", '', $object->ref_supplier, $object, $user->rights->reception->creer, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefSupplier", '', $object->ref_supplier, $object, $user->rights->reception->creer, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); // Project if (!empty($conf->project->enabled)) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; + $morehtmlref .= '
'; if (0) { // Do not change on reception - if ($action != 'classify') { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; - } - if ($action == 'classify') { - // $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= '
'; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= '
'; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); + if ($action != 'classify' && $permissiontoadd) { + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $object->socid : -1), $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { - // We don't have project on reception, so we will use the project or source object instead - // TODO Add project on reception - $morehtmlref .= ' : '; - if (!empty($objectsrc->fk_project)) { + if (!empty($objectsrc) && !empty($objectsrc->fk_project)) { $proj = new Project($db); $proj->fetch($objectsrc->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/resource/element_resource.php b/htdocs/resource/element_resource.php index a5ca456310e..c063e049f44 100644 --- a/htdocs/resource/element_resource.php +++ b/htdocs/resource/element_resource.php @@ -350,21 +350,29 @@ if (!$ret) { // Thirdparty //$morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); // Project + $savobject = $object; + $object = $act; if (isModEnabled('project')) { $langs->load("projects"); - //$morehtmlref.='
'.$langs->trans('Project') . ' '; - $morehtmlref .= $langs->trans('Project').': '; - if (!empty($act->fk_project)) { - $proj = new Project($db); - $proj->fetch($act->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); - if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + //$morehtmlref .= '
'; + if (0) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); + if ($action != 'classify') { + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { - $morehtmlref .= ''; + if (!empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref .= $proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; + } + } } } + $object = $savobject; $morehtmlref .= '
'; dol_banner_tab($act, 'element_id', $linkback, ($user->socid ? 0 : 1), 'id', 'ref', $morehtmlref, '&element='.$element, 0, '', ''); diff --git a/htdocs/supplier_proposal/contact.php b/htdocs/supplier_proposal/contact.php index fde016c78c4..1fa344cbb5e 100644 --- a/htdocs/supplier_proposal/contact.php +++ b/htdocs/supplier_proposal/contact.php @@ -31,6 +31,8 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/supplier_proposal.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.dispatch.class.php'; // Load translation files required by the page $langs->loadLangs(array("propal", "supplier_proposal", "facture", "orders", "sendings", "companies")); @@ -133,37 +135,25 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); // Project if (!empty($conf->project->enabled)) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; + $morehtmlref .= '
'; if ($permissiontoedit) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { - //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $morehtmlref .= ' : '; - } - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= '
'; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= '
'; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $object->socid : -1), $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ' : '.$proj->getNomUrl(1); + $morehtmlref .= $proj->getNomUrl(1); if ($proj->title) { - $morehtmlref .= ' - '.$proj->title; + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; } - } else { - $morehtmlref .= ''; } } } diff --git a/htdocs/theme/eldy/ckeditor/config.js b/htdocs/theme/eldy/ckeditor/config.js index 4ec222217a1..d2a87a4a4d8 100644 --- a/htdocs/theme/eldy/ckeditor/config.js +++ b/htdocs/theme/eldy/ckeditor/config.js @@ -46,8 +46,8 @@ CKEDITOR.editorConfig = function( config ) ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'], ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], ['BidiLtr', 'BidiRtl'], - ['Link','Unlink','Anchor'], - ['Image','Table','HorizontalRule','Smiley','SpecialChar'], + ['Link','Unlink'], + ['Image','Table','HorizontalRule','Smiley'], ['Styles','Format','Font','FontSize'], ['TextColor','BGColor'], ['Source'] @@ -64,7 +64,7 @@ CKEDITOR.editorConfig = function( config ) ['Bold','Italic','Underline','Strike','-','TextColor','RemoveFormat'], ['NumberedList','BulletedList','Outdent','Indent'], ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], - ['Link','Unlink','Anchor','Image','Table','HorizontalRule','SpecialChar'], + ['Link','Unlink','Image','Table','HorizontalRule'], ['Source'] ]; @@ -78,7 +78,7 @@ CKEDITOR.editorConfig = function( config ) ['Bold','Italic','Underline','Strike','-','TextColor','RemoveFormat'], ['NumberedList','BulletedList','Outdent','Indent'], ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], - ['Link','Unlink','Image','Table','HorizontalRule','SpecialChar'], + ['Link','Unlink','Image','Table','HorizontalRule'], ['Source'] ]; diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 3fba934bf4e..05f00488123 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1393,6 +1393,7 @@ select.flat.selectlimit { -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; + height: auto !important; } .tablelistofcalendars { @@ -4875,8 +4876,13 @@ input#cardholder-name { } .divmainbodylarge { margin-left: 40px; margin-right: 40px; } +.publicnewmemberform div.titre { font-size: 2em; } #divsubscribe { max-width: 900px; } +#divsubscribe .eventlabel { font-size: 1.5em; } #tablesubscribe { width: 100%; } +#tablesubscribe tr td { font-size: 1.15em; } +#tablesubscribe .price-registration { font-size: 1.5em; } + div#card-element { border: 1px solid #ccc; @@ -6433,9 +6439,14 @@ ul.select2-results__options li { @media only screen and (min-width: 767px) { + /* CSS to have the dropdown boxes larger that the input search area */ .select2-container.select2-container--open .select2-dropdown.ui-dialog { - min-width: 200px !important; + min-width: 220px !important; } + .select2-container.select2-container--open .select2-dropdown--below { + min-width: 220px !important; + } + .select2-container--open .select2-dropdown--below { border-top: 1px solid var(--inputbordercolor); /* border-top: 1px solid #aaaaaa; */ @@ -6610,6 +6621,7 @@ dl.dropdown { max-height: 264px; overflow: auto; border-radius: 2px; + z-index: 1; } .dropdown dd ul.selectedfieldsleft { right: auto; diff --git a/htdocs/theme/md/ckeditor/config.js b/htdocs/theme/md/ckeditor/config.js index 06fa5746e7f..e463e6db9a3 100644 --- a/htdocs/theme/md/ckeditor/config.js +++ b/htdocs/theme/md/ckeditor/config.js @@ -46,8 +46,8 @@ CKEDITOR.editorConfig = function( config ) ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'], ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], ['BidiLtr', 'BidiRtl'], - ['Link','Unlink','Anchor'], - ['Image','Table','HorizontalRule','Smiley','SpecialChar'], + ['Link','Unlink'], + ['Image','Table','HorizontalRule','Smiley'], ['Styles','Format','Font','FontSize'], ['TextColor','BGColor'], ['Source'] @@ -64,7 +64,7 @@ CKEDITOR.editorConfig = function( config ) ['Bold','Italic','Underline','Strike','-','TextColor','RemoveFormat'], ['NumberedList','BulletedList','Outdent','Indent'], ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], - ['Link','Unlink','Anchor','Image','Table','HorizontalRule','SpecialChar'], + ['Link','Unlink','Image','Table','HorizontalRule'], ['Source'] ]; @@ -78,7 +78,7 @@ CKEDITOR.editorConfig = function( config ) ['Bold','Italic','Underline','Strike','-','TextColor','RemoveFormat'], ['NumberedList','BulletedList','Outdent','Indent'], ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], - ['Link','Unlink','Image','Table','HorizontalRule','SpecialChar'], + ['Link','Unlink','Image','Table','HorizontalRule'], ['Source'] ]; @@ -91,7 +91,7 @@ CKEDITOR.editorConfig = function( config ) ['Bold','Italic','Underline','Strike','-','TextColor','RemoveFormat'], // ,'Subscript','Superscript' useless ['NumberedList','BulletedList','Outdent','Indent'], ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], - ['Link','Unlink','SpecialChar'], + ['Link','Unlink'], ['Source'] ]; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 9ebabb5fc5f..df1bd11dc4f 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1512,6 +1512,7 @@ select.flat.selectlimit { -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; + height: auto !important; } .tablelistofcalendars { @@ -4728,8 +4729,13 @@ span.buttonpaymentsmall { #tablepublicpayment tr.liste_total td { border-top: none; } .divmainbodylarge { margin-left: 40px; margin-right: 40px; } +.publicnewmemberform div.titre { font-size: 2em; } #divsubscribe { max-width: 900px; } +#divsubscribe .eventlabel { font-size: 1.5em; } #tablesubscribe { width: 100%; } +#tablesubscribe tr td { font-size: 1.15em; } +#tablesubscribe .price-registration { font-size: 1.5em; } + div#card-element { border: 1px solid #ccc; @@ -6199,9 +6205,14 @@ ul.select2-results__options li { @media only screen and (min-width: 767px) { + /* CSS to have the dropdown boxes larger that the input search area */ .select2-container.select2-container--open .select2-dropdown.ui-dialog { - min-width: 200px !important; + min-width: 220px !important; } + .select2-container.select2-container--open .select2-dropdown--below { + min-width: 220px !important; + } + .select2-container--open .select2-dropdown--below { border-top: 1px solid var(--inputbordercolor); /* border-top: 1px solid #aaaaaa; */ @@ -6369,6 +6380,7 @@ dl.dropdown { list-style:none; max-height: 264px; overflow: auto; + z-index: 1; } .dropdown dd ul.selectedfieldsleft { right: auto; diff --git a/htdocs/ticket/agenda.php b/htdocs/ticket/agenda.php index 9adffdfd720..9111faedcb7 100644 --- a/htdocs/ticket/agenda.php +++ b/htdocs/ticket/agenda.php @@ -30,6 +30,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; +if (isModEnabled('project')) { + include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; +} // Load translation files required by the page $langs->loadLangs(array('companies', 'other', 'ticket')); @@ -94,6 +99,7 @@ if (!$user->socid && (!empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) && accessforbidden(); } +$permissiontoadd = $user->rights->ticket->write; /* @@ -177,45 +183,33 @@ if ($object->fk_user_create > 0) { // Thirdparty if (isModEnabled("societe")) { - $morehtmlref .= '
'.$langs->trans('ThirdParty'); - /*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) { - $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . ''; - }*/ - $morehtmlref .= ' : '; - if ($action == 'editcustomer') { - $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, 'editcustomer', '', 1, 0, 0, array(), 1); - } else { - $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, 'none', '', 1, 0, 0, array(), 1); + $morehtmlref .= '
'; + $morehtmlref .= img_picto($langs->trans("ThirdParty"), 'company', 'class="pictofixedwidth"'); + if ($action != 'editcustomer' && 0) { + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetThirdParty'), 0).' '; } + $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, $action == 'editcustomer' ? 'editcustomer' : 'none', '', 1, 0, 0, array(), 1); } // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project'); - if ($user->rights->ticket->write) { + if (0) { + $morehtmlref .= '
'; + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { - //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ''; - $morehtmlref .= ' : '; - } - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= '
'; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= '
'; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { + $morehtmlref .= '
'; $proj = new Project($db); $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); - } else { - $morehtmlref .= ''; + if ($proj->title) { + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; + } } } } @@ -259,7 +253,7 @@ if (!empty($object->id)) { // Show link to add event (if read and not closed) $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage"; - $url = DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.date('YmdHi').'&origin=ticket&originid='.$object->id.'&projectid='.$object->fk_project.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id); + $url = DOL_URL_ROOT.'/comm/action/card.php?action=create&datep=now&origin=ticket&originid='.$object->id.'&projectid='.$object->fk_project.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id); $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', $url, 'add-new-ticket-even-button', $btnstatus); print_barre_liste($langs->trans("ActionsOnTicket"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 1); diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index df46ff8e77c..1290a9a9a9b 100755 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -444,11 +444,7 @@ if (empty($reshook)) { if ($ret > 0) { if (!empty($backtopage)) { - if (empty($id)) { - $url = $backtopage; - } else { - $url = 'card.php?track_id='.urlencode($object->track_id); - } + $url = $backtopage; } else { $url = 'card.php?track_id='.urlencode($object->track_id); } @@ -456,7 +452,7 @@ if (empty($reshook)) { header("Location: ".$url); exit; } else { - setEventMessages($object->error, null, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); $action = 'presend'; } } @@ -690,6 +686,7 @@ if (empty($reshook)) { $permissiontoadd = $user->rights->ticket->write; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; //var_dump($action);exit; + // Actions to send emails $triggersendname = 'TICKET_SENTBYMAIL'; $paramname = 'id'; @@ -953,46 +950,37 @@ if ($action == 'create' || $action == 'presend') { $morehtmlref .= dol_escape_htmltag($object->origin_email).' - '.$form->textwithpicto($langs->trans("CreatedByPublicPortal"), $htmltooptip, 1, 'help', '', 0, 3, 'tooltip').''; } + $permissiontoedit = $object->status < 8 && !$user->socid && $user->rights->ticket->write; + //$permissiontoedit = 0; + // Thirdparty if (isModEnabled("societe")) { - $morehtmlref .= '
'.$langs->trans('ThirdParty').' '; - if ($action != 'editcustomer' && $object->status < 8 && !$user->socid && $user->rights->ticket->write) { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('Edit'), 0).' : '; - } - if ($action == 'editcustomer') { - $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, 'editcustomer', '', 1, 0, 0, array(), 1); - } else { - $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, 'none', '', 1, 0, 0, array(), 1); + $morehtmlref .= '
'; + $morehtmlref .= img_picto($langs->trans("ThirdParty"), 'company', 'class="pictofixedwidth"'); + if ($action != 'editcustomer' && $permissiontoedit) { + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetThirdParty'), 0).' '; } + $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, $action == 'editcustomer' ? 'editcustomer' : 'none', '', 1, 0, 0, array(), 1); } // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; - if ($user->rights->ticket->write) { + $morehtmlref .= '
'; + if ($permissiontoedit) { + $object->fetch_project(); + $morehtmlref .= img_picto($langs->trans("Project"), 'project'.((is_object($object->project) && $object->project->public) ? 'pub' : ''), 'class="pictofixedwidth"'); if ($action != 'classify') { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).''; - } - $morehtmlref .= ' : '; - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= '
'; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1, 0, 'maxwidth500'); - $morehtmlref .= ''; - $morehtmlref .= '
'; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { - $proj = new Project($db); - $proj->fetch($object->fk_project); - $morehtmlref .= $proj->getNomUrl(1); - } else { - $morehtmlref .= ''; + $object->fetch_project(); + $morehtmlref .= $object->project->getNomUrl(1); + if ($object->project->title) { + $morehtmlref .= ' - '.dol_escape_htmltag($object->project->title).''; + } } } } diff --git a/htdocs/ticket/class/actions_ticket.class.php b/htdocs/ticket/class/actions_ticket.class.php index 9a01c5cf7d2..133fb72e7f2 100644 --- a/htdocs/ticket/class/actions_ticket.class.php +++ b/htdocs/ticket/class/actions_ticket.class.php @@ -164,7 +164,7 @@ class ActionsTicket } elseif ($action == 'view') { return $langs->trans("TicketCard"); } elseif ($action == 'add_message') { - return $langs->trans("AddMessage"); + return $langs->trans("TicketAddMessage"); } else { return $langs->trans("TicketsManagement"); } diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 4acc9104454..4a03098b57c 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -2792,7 +2792,7 @@ class Ticket extends CommonObject if ($result) { // update last_msg_sent date $this->date_last_msg_sent = dol_now(); - $this->update($user); + $this->update($user, 1); // disable trigger when updatin date_last_msg_sent. sendTicketMessageByEmail already create an event in actioncomm table. } } } @@ -2800,8 +2800,8 @@ class Ticket extends CommonObject } } - // Set status to "answered" if not set yet, but only if internal user - if ($object->status < 3 && !$user->socid) { + // Set status to "answered" if not set yet, but only if internal user and not private message + if ($object->status < 3 && !$user->socid && !$private) { $object->setStatut(3); } return 1; diff --git a/htdocs/ticket/contact.php b/htdocs/ticket/contact.php index bf39f123708..7f5a36faf1b 100644 --- a/htdocs/ticket/contact.php +++ b/htdocs/ticket/contact.php @@ -34,6 +34,11 @@ require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT."/core/lib/company.lib.php"; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; +if (isModEnabled('project')) { + include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; +} // Load translation files required by the page $langs->loadLangs(array('companies', 'ticket')); @@ -212,45 +217,33 @@ if ($id > 0 || !empty($track_id) || !empty($ref)) { // Thirdparty if (isModEnabled("societe")) { - $morehtmlref .= '
'.$langs->trans('ThirdParty'); - /*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) { - $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . ''; - }*/ - $morehtmlref .= ' : '; - if ($action == 'editcustomer') { - $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, 'editcustomer', '', 1, 0, 0, array(), 1); - } else { - $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, 'none', '', 1, 0, 0, array(), 1); + $morehtmlref .= '
'; + $morehtmlref .= img_picto($langs->trans("ThirdParty"), 'company', 'class="pictofixedwidth"'); + if ($action != 'editcustomer' && 0) { + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetThirdParty'), 0).' '; } + $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, $action == 'editcustomer' ? 'editcustomer' : 'none', '', 1, 0, 0, array(), 1); } // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; - if ($user->rights->ticket->write) { + if (0) { + $morehtmlref .= '
'; + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { - //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ''; - $morehtmlref .= ' : '; - } - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= '
'; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= '
'; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { + $morehtmlref .= '
'; $proj = new Project($db); $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); - } else { - $morehtmlref .= ''; + if ($proj->title) { + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; + } } } } diff --git a/htdocs/ticket/document.php b/htdocs/ticket/document.php index 5a7d46540c4..8015cb32145 100644 --- a/htdocs/ticket/document.php +++ b/htdocs/ticket/document.php @@ -33,6 +33,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT."/core/lib/company.lib.php"; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; +if (isModEnabled('project')) { + include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; +} // Load translation files required by the page $langs->loadLangs(array("companies", "other", "ticket", "mails")); @@ -147,45 +152,33 @@ if ($object->id) { // Thirdparty if (isModEnabled("societe")) { - $morehtmlref .= '
'.$langs->trans('ThirdParty'); - /*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) { - $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . ''; - }*/ - $morehtmlref .= ' : '; - if ($action == 'editcustomer') { - $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, 'editcustomer', '', 1, 0, 0, array(), 1); - } else { - $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, 'none', '', 1, 0, 0, array(), 1); + $morehtmlref .= '
'; + $morehtmlref .= img_picto($langs->trans("ThirdParty"), 'company', 'class="pictofixedwidth"'); + if ($action != 'editcustomer' && 0) { + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetThirdParty'), 0).' '; } + $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, $action == 'editcustomer' ? 'editcustomer' : 'none', '', 1, 0, 0, array(), 1); } // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; - if ($user->rights->ticket->write) { + if (0) { + $morehtmlref .= '
'; + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { - //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ''; - $morehtmlref .= ' : '; - } - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= '
'; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= '
'; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { + $morehtmlref .= '
'; $proj = new Project($db); $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); - } else { - $morehtmlref .= ''; + if ($proj->title) { + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; + } } } } diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index e2f4d9c60ba..66bda452ccf 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -578,7 +578,7 @@ if ($projectid > 0 || $project_ref) { $morehtmlref .= $object->title; // Thirdparty if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) { - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project'); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'project'); } $morehtmlref .= ''; @@ -593,7 +593,7 @@ if ($projectid > 0 || $project_ref) { print '
'; print '
'; - print ''; + print '
'; // Visibility print '
'.$langs->trans("Visibility").''; diff --git a/htdocs/ticket/messaging.php b/htdocs/ticket/messaging.php index 88ac4ef686c..f1fd631234b 100644 --- a/htdocs/ticket/messaging.php +++ b/htdocs/ticket/messaging.php @@ -30,6 +30,11 @@ require_once DOL_DOCUMENT_ROOT."/core/lib/company.lib.php"; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; +if (isModEnabled('project')) { + include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; +} // Load translation files required by the page $langs->loadLangs(array('companies', 'other', 'ticket')); @@ -173,46 +178,34 @@ if ($object->fk_user_create > 0) { // Thirdparty if (isModEnabled("societe")) { - $morehtmlref .= '
'.$langs->trans('ThirdParty'); - /*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) { - $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . ''; - }*/ - $morehtmlref .= ' : '; - if ($action == 'editcustomer') { - $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, 'editcustomer', '', 1, 0, 0, array(), 1); - } else { - $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, 'none', '', 1, 0, 0, array(), 1); + if (isModEnabled("societe")) { + $morehtmlref .= '
'; + $morehtmlref .= img_picto($langs->trans("ThirdParty"), 'company', 'class="pictofixedwidth"'); + if ($action != 'editcustomer' && 0) { + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetThirdParty'), 0).' '; + } + $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, $action == 'editcustomer' ? 'editcustomer' : 'none', '', 1, 0, 0, array(), 1); } } // Project if (isModEnabled('project')) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project'); - if ($user->rights->ticket->write) { + $morehtmlref .= '
'; + if (0) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); if ($action != 'classify') { - //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ''; - $morehtmlref .= ' : '; - } - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= '
'; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= '
'; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, ''); } else { if (!empty($object->fk_project)) { - require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; $proj = new Project($db); $proj->fetch($object->fk_project); $morehtmlref .= $proj->getNomUrl(1); - } else { - $morehtmlref .= ''; + if ($proj->title) { + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; + } } } } @@ -256,7 +249,7 @@ if (!empty($object->id)) { // Show link to add event (if read and not closed) $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage"; - $url = DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.date('YmdHi').'&origin=ticket&originid='.$object->id.'&projectid='.$object->fk_project.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id); + $url = DOL_URL_ROOT.'/comm/action/card.php?action=create&datep=now&origin=ticket&originid='.$object->id.'&projectid='.$object->fk_project.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id); $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', $url, 'add-new-ticket-even-button', $btnstatus); diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 3c65d018e6b..a539dad3505 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -2829,7 +2829,7 @@ if ($action == 'create' || $action == 'adduserldap') { // List of actions on element include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; $formactions = new FormActions($db); - $somethingshown = $formactions->showactions($object, 'user', $socid, 1); + $somethingshown = $formactions->showactions($object, 'user', $socid, 1, 'listactions', 0, '', '', $object->id); print ''; } diff --git a/htdocs/user/group/card.php b/htdocs/user/group/card.php index c17893e7eb4..a9a16826ee3 100644 --- a/htdocs/user/group/card.php +++ b/htdocs/user/group/card.php @@ -418,6 +418,7 @@ if ($action == 'create') { print '
'."\n"; print ''; print ''; + print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table print ''."\n"; print ''."\n"; print ''."\n"; - print '
'.$langs->trans("NonAffectedUsers").''; @@ -426,8 +427,10 @@ if ($action == 'create') { print ''; print ''; print '
'."\n"; - print '
'; + print '
'; + print '
'; + print ''."\n"; + //print '
'; } /* diff --git a/scripts/emailings/mailing-send.php b/scripts/emailings/mailing-send.php index f427e42d8cb..78e4488ec46 100755 --- a/scripts/emailings/mailing-send.php +++ b/scripts/emailings/mailing-send.php @@ -307,7 +307,8 @@ if ($resql) { } // Fabrication du mail $trackid = 'emailing-'.$obj->fk_mailing.'-'.$obj->rowid; - $mail = new CMailFile($newsubject, $sendto, $from, $newmessage, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $errorsto, $arr_css, $trackid, $moreinheader, 'emailing'); + $upload_dir_tmp = $upload_dir; + $mail = new CMailFile($newsubject, $sendto, $from, $newmessage, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $errorsto, $arr_css, $trackid, $moreinheader, 'emailing', '', $upload_dir_tmp); if ($mail->error) { $res = 0; diff --git a/test/phpunit/CodingSqlTest.php b/test/phpunit/CodingSqlTest.php index bdcf381c8bb..00c7a5aebae 100644 --- a/test/phpunit/CodingSqlTest.php +++ b/test/phpunit/CodingSqlTest.php @@ -196,7 +196,7 @@ class CodingSqlTest extends PHPUnit\Framework\TestCase $result=(! strpos($filecontent, '["') && ! strpos($filecontent, '{"') && ! strpos($filecontent, '("')); } //print __METHOD__." Result for checking we don't have double quote = ".$result."\n"; - $this->assertTrue($result===false, 'Found double quote that is not [" neither {" (used for json content) into '.$file.'. Bad.'); + $this->assertTrue($result===false, 'Found double quote that is not [" neither {" (used for json content) neither (" (used for content with string like isModEnabled("")) into '.$file.'. Bad.'); $result=strpos($filecontent, 'int('); //print __METHOD__." Result for checking we don't have 'int(' instead of 'integer' = ".$result."\n";