diff --git a/build/makepack-dolibarrmodule.pl b/build/makepack-dolibarrmodule.pl index 4a9a217b570..8fbb28dc35f 100755 --- a/build/makepack-dolibarrmodule.pl +++ b/build/makepack-dolibarrmodule.pl @@ -293,6 +293,7 @@ foreach my $PROJECT (@PROJECTLIST) { } print "Clean $BUILDROOT\n"; $ret=`rm -fr $BUILDROOT/$PROJECTLC/.cache`; + $ret=`rm -fr $BUILDROOT/$PROJECTLC/.git`; $ret=`rm -fr $BUILDROOT/$PROJECTLC/.project`; $ret=`rm -fr $BUILDROOT/$PROJECTLC/.settings`; $ret=`rm -fr $BUILDROOT/$PROJECTLC/index.php`; diff --git a/build/rpm/dolibarr_generic.spec b/build/rpm/dolibarr_generic.spec index f6d81feaea4..a992c84f0f9 100755 --- a/build/rpm/dolibarr_generic.spec +++ b/build/rpm/dolibarr_generic.spec @@ -58,7 +58,7 @@ Requires: mysql, mysql-client %if 0%{?suse_version} # Voir http://en.opensuse.org/openSUSE:Packaging_Conventions_RPM_Macros Group: Productivity/Office/Management -Requires: apache2, apache2-mod_php5, php5 >= 5.3.0, php5-gd, php5-ldap, php5-imap, php5-mysql, php5-openssl, dejavu +Requires: apache2, apache2-mod_php, php >= 5.3.0, php-gd, php-ldap, php-imap, php-mysql, php-openssl, dejavu Requires: mysql-community-server, mysql-community-server-client BuildRequires: update-desktop-files fdupes %else diff --git a/build/rpm/dolibarr_opensuse.spec b/build/rpm/dolibarr_opensuse.spec index bd6834582ac..c7113828632 100755 --- a/build/rpm/dolibarr_opensuse.spec +++ b/build/rpm/dolibarr_opensuse.spec @@ -25,7 +25,7 @@ BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-build Group: Productivity/Office/Management -Requires: apache2, apache2-mod_php5, php5 >= 5.3.0, php5-gd, php5-ldap, php5-imap, php5-mysql, php5-openssl, dejavu +Requires: apache2, apache2-mod_php, php >= 5.3.0, php-gd, php-ldap, php-imap, php-mysql, php-openssl, dejavu Requires: mysql-community-server, mysql-community-server-client %if 0%{?suse_version} BuildRequires: update-desktop-files fdupes @@ -66,7 +66,6 @@ ed essere facile da usare. Programmo web, progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare. -%_datadir/dolibarr/htdocs/webhook #---- prep %prep diff --git a/dev/examples/ldap/ldapsearch_sample1.txt b/dev/examples/ldap/ldapsearch_sample1.txt index a02ad632cd0..2a30f19ab22 100644 --- a/dev/examples/ldap/ldapsearch_sample1.txt +++ b/dev/examples/ldap/ldapsearch_sample1.txt @@ -1,28 +1,29 @@ # ldapsearch_sample1.txt # ldapsearch is into package ldap-utils on debian. # -# Use this sample to search into a ldap +# Use this samples to test a ldap_bind or to make a search into a ldap # # Anonymous access -# ldapsearch -h hostname -p 389 +# ldapsearch -h hostname -p 389 # # Login access (using a Bind DN) -# ldapsearch -h hostname -p 389 -z 0 -D "uid=root,cn=users,dc=ldap,dc=test,dc=local" -w password -# ldapsearch -H ldap://hostname:389 -z 0 -D "uid=root,cn=users,dc=ldap,dc=test,dc=local" -w password -# ldapsearch -d1 -H ldap://hostname:389 -x -z 0 -D "uid=root,cn=users,dc=ldap,dc=test,dc=local" -w password -# ldapsearch -H ldap://hostname:389 -z 0 -D "uid=root,cn=users,dc=ldap,dc=test,dc=local" -w password +# Such access must succeed to use LDAP as login module. +# ldapsearch -h hostname -p 389 -z 0 -D "uid=root,cn=users,dc=ldap,dc=test,dc=local" -w password +# ldapsearch -H ldap://hostname:389 -z 0 -D "uid=root,cn=users,dc=ldap,dc=test,dc=local" -w password +# ldapsearch -d1 -H ldap://hostname:389 -x -z 0 -D "uid=root,cn=users,dc=ldap,dc=test,dc=local" -w password +# ldapsearch -H ldap://hostname:389 -z 0 -D "uid=root,cn=users,dc=ldap,dc=test,dc=local" -w password # # Login access in SSL (using a Bind DN) -# ldapsearch -H ldaps://hostnamme:636 -z 0 -D "uid=root,cn=users,dc=ldap,dc=test,dc=local" -w password -b "cn=users,dc=ldap,dc=test,dc=local +# ldapsearch -H ldaps://hostnamme:636 -z 0 -D "uid=root,cn=users,dc=ldap,dc=test,dc=local" -w password -b "cn=users,dc=ldap,dc=test,dc=local" # If it fails, you may try to use "hostname" that is real name of certificate. # You must also check that /etc/ldap/ldap.conf contains the line TLS_CACERT /etc/ssl/certs/ca-certificates.crt # What to search -# ldapsearch -h hostname -p 389 -x -D "uid=root,cn=users,dc=ldap,dc=test,dc=local" -w password -b "cn=users,dc=ldap,dc=test,dc=local" -# ldapsearch -h hostname -p 389 -x -D "cn=manager,o=somecompany.com" -w password -b "ou=people,dc=teclib,dc=infra" -# ldapsearch -h hostname -p 389 -x -D "cn=manager,o=somecompany.com" -w password -b "o=somecompany.com" "(objectclass=*)" +# ldapsearch -h hostname -p 389 -x -D "uid=root,cn=users,dc=ldap,dc=test,dc=local" -w password -b "cn=users,dc=ldap,dc=test,dc=local" +# ldapsearch -h hostname -p 389 -x -D "cn=manager,o=somecompany.com" -w password -b "ou=people,dc=teclib,dc=infra" +# ldapsearch -h hostname -p 389 -x -D "cn=manager,o=somecompany.com" -w password -b "o=somecompany.com" "(objectclass=*)" # # Example to test a ldap search: -# ldapsearch -h hostname -p 389 -x -z 5 -b 'OU=Collaborateurs,OU=Utilisateurs,OU=MyCompany,DC=bocal,DC=lan' -D 'CN=UserAdmin,OU=Informatique,OU=Utilisateurs,OU=MyCompany,DC=bocal,DC=lan' -w password +# ldapsearch -h hostname -p 389 -x -z 5 -b 'OU=Collaborateurs,OU=Utilisateurs,OU=MyCompany,DC=bocal,DC=lan' -D 'CN=UserAdmin,OU=Informatique,OU=Utilisateurs,OU=MyCompany,DC=bocal,DC=lan' -w password diff --git a/dev/setup/fail2ban/filter.d/web-dolibarr-limitpublic.conf b/dev/setup/fail2ban/filter.d/web-dolibarr-limitpublic.conf index 45b4a9b8084..2eedad18821 100644 --- a/dev/setup/fail2ban/filter.d/web-dolibarr-limitpublic.conf +++ b/dev/setup/fail2ban/filter.d/web-dolibarr-limitpublic.conf @@ -1,8 +1,7 @@ # Fail2Ban configuration file # -# Regexp to catch known spambots and software alike. Please verify -# that it is your intent to block IPs which were driven by -# above mentioned bots. +# Regexp to detect access on public pages so we can add mitigation on IP making too much +# access to your a Dolibarr instance. [Definition] @@ -11,7 +10,7 @@ # echo `date +'%Y-%m-%d %H:%M:%S'`" INFO 1.2.3.4 --- Access to GET /public/clicktodial/cidlookup.php" >> /mypath/documents/dolibarr.log # # then -# fail2ban-client status web-dol-passforgotten +# fail2ban-client status web-dolibarr-limitpublic # # To test rule file on a existing log file # fail2ban-regex /mypath/documents/dolibarr.log /etc/fail2ban/filter.d/web-dolibarr-limitpublic.conf diff --git a/dev/setup/fail2ban/filter.d/web-dolibarr-rulesbruteforce.conf b/dev/setup/fail2ban/filter.d/web-dolibarr-rulesbruteforce.conf index d5922909ba9..1e126c17693 100644 --- a/dev/setup/fail2ban/filter.d/web-dolibarr-rulesbruteforce.conf +++ b/dev/setup/fail2ban/filter.d/web-dolibarr-rulesbruteforce.conf @@ -1,8 +1,7 @@ # Fail2Ban configuration file # -# Regexp to catch known spambots and software alike. Please verify -# that it is your intent to block IPs which were driven by -# above mentioned bots. +# Regexp to detect try to check a couple login/password so we can add mitigation +# on IP making too much tries. [Definition] @@ -11,7 +10,7 @@ # echo `date +'%Y-%m-%d %H:%M:%S'`" INFO 1.2.3.4 functions_dolibarr::check_user_password_abcd Authentication KO" >> /mypath/documents/dolibarr.log # # then -# fail2ban-client status web-dol-bruteforce +# fail2ban-client status web-dolibarr-rulesbruteforce # # To test rule file on a existing log file # fail2ban-regex /mypath/documents/dolibarr.log /etc/fail2ban/filter.d/web-dolibarr-rulesbruteforce.conf diff --git a/dev/setup/fail2ban/filter.d/web-dolibarr-rulespassforgotten.conf b/dev/setup/fail2ban/filter.d/web-dolibarr-rulespassforgotten.conf index edc2ca68092..8cc20dd4be4 100644 --- a/dev/setup/fail2ban/filter.d/web-dolibarr-rulespassforgotten.conf +++ b/dev/setup/fail2ban/filter.d/web-dolibarr-rulespassforgotten.conf @@ -1,8 +1,7 @@ # Fail2Ban configuration file # -# Regexp to catch known spambots and software alike. Please verify -# that it is your intent to block IPs which were driven by -# above mentioned bots. +# Regexp to detect access on passwordforgotten.php page so we can add mitigation on IP making too much +# access to this Dolibarr page. [Definition] @@ -11,7 +10,7 @@ # echo `date +'%Y-%m-%d %H:%M:%S'`" INFO 1.2.3.4 --- Access to GET /passwordforgotten.php - action=buildnewpassword, massaction=" >> /mypath/documents/dolibarr.log # # then -# fail2ban-client status web-dol-passforgotten +# fail2ban-client status web-dolibarr-rulespassforgotten # # To test rule file on a existing log file # fail2ban-regex /mypath/documents/dolibarr.log /etc/fail2ban/filter.d/web-dolibarr-rulespassforgotten.conf diff --git a/dev/tools/github_lines_perusers.sh b/dev/tools/github_lines_perusers.sh index 5e65ddc6bf9..9a3fad09d62 100755 --- a/dev/tools/github_lines_perusers.sh +++ b/dev/tools/github_lines_perusers.sh @@ -12,5 +12,5 @@ fi echo "git log $1..$2 --shortstat | grep ... | perl ... > /tmp/github_lines_perusers.tmp" git log $1..$2 --shortstat | grep -e 'Author:' -e 'Date:' -e ' changed' -e ' insertion' -e ' deletion' | perl -n -e '/^(.*)$/; $line = $1; if ($line =~ /(changed|insertion|deletion)/) { $line =~ s/[^0-9\s]//g; my @arr=split /\s+/, $line; $tot=0; for (1..@arr) { $tot += $arr[$_]; }; print $tot."\n"; } else { print $line."\n"; };' > /tmp/github_lines_perusers.tmp -cat /tmp/github_lines_perusers.tmp | awk 'BEGIN { FS="\n"; print "user and nb of lines"; lastuser=""; } { if ($1 ~ /Author:/) { lastuser=$1 }; if ($1 ~ /^[0-9]+$/) { aaa[lastuser]=$1; } } END { for (var in aaa) print var," ",aaa[var]; } ' +cat /tmp/github_lines_perusers.tmp | awk 'BEGIN { FS="\n"; print "user and nb of lines"; lastuser=""; } { if ($1 ~ /Author:/) { lastuser=$1 }; if ($1 ~ /^[0-9]+$/) { aaa[lastuser]+=$1; } } END { for (var in aaa) print var," ",aaa[var]; } ' diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index e70bc39bfd0..9eabd378e11 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -85,7 +85,7 @@ if ($action == 'add' && $user->hasRight('accounting', 'chartofaccount')) { // Clean code // To manage zero or not at the end of the accounting account - if ($conf->global->ACCOUNTING_MANAGE_ZERO == 1) { + if (!empty($conf->global->ACCOUNTING_MANAGE_ZERO)) { $account_number = $account_number; } else { $account_number = clean_account($account_number); @@ -148,7 +148,7 @@ if ($action == 'add' && $user->hasRight('accounting', 'chartofaccount')) { // Clean code // To manage zero or not at the end of the accounting account - if (isset($conf->global->ACCOUNTING_MANAGE_ZERO) && $conf->global->ACCOUNTING_MANAGE_ZERO == 1) { + if (!empty($conf->global->ACCOUNTING_MANAGE_ZERO)) { $account_number = $account_number; } else { $account_number = clean_account($account_number); diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index bd105e7a672..35829b5dcbf 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1728,7 +1728,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''.$langs->trans("Type").''.$adht->getNomUrl(1)."\n"; // Morphy - print ''.$langs->trans("MemberNature").''.$object->getmorphylib().''; + print ''.$langs->trans("MemberNature").''.$object->getmorphylib('', 1).''; print ''; // Company diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 0e37981cc84..dd9d58eb7d3 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -520,21 +520,45 @@ class Adherent extends CommonObject * Return translated label by the nature of a adherent (physical or moral) * * @param string $morphy Nature of the adherent (physical or moral) + * @param int $addbadge Add badge (1=Full label, 2=First letter only) * @return string Label */ - public function getmorphylib($morphy = '') + public function getmorphylib($morphy = '', $addbadge = 0) { global $langs; + + // Clean var if (!$morphy) { $morphy = $this->morphy; } - if ($morphy == 'phy') { - return $langs->trans("Physical"); + + if ($addbadge) { + $s = ''; + if ($morphy == 'phy') { + if ($addbadge == 2) { + $labeltoshow = dol_substr($langs->trans("Physical"), 0, 1); + } else { + $labeltoshow = $langs->trans("Physical"); + } + $s .= ''.$labeltoshow.''; + } + if ($morphy == 'mor') { + if ($addbadge == 2) { + $labeltoshow = dol_substr($langs->trans("Moral"), 0, 1); + } else { + $labeltoshow = $langs->trans("Moral"); + } + $s .= ''.$labeltoshow.''; + } + } else { + if ($morphy == 'phy') { + $s = $langs->trans("Physical"); + } elseif ($morphy == 'mor') { + $s = $langs->trans("Moral"); + } } - if ($morphy == 'mor') { - return $langs->trans("Moral"); - } - return $morphy; + + return $s; } /** diff --git a/htdocs/adherents/class/api_members.class.php b/htdocs/adherents/class/api_members.class.php index 35ab65e9d82..8308c71fac0 100644 --- a/htdocs/adherents/class/api_members.class.php +++ b/htdocs/adherents/class/api_members.class.php @@ -480,11 +480,11 @@ class Members extends DolibarrApi /** * Add a subscription for a member * - * @param int $id ID of member - * @param int $start_date Start date {@from body} {@type timestamp} - * @param int $end_date End date {@from body} {@type timestamp} - * @param float $amount Amount (may be 0) {@from body} - * @param string $label Label {@from body} + * @param int $id ID of member + * @param string $start_date Start date {@from body} {@type timestamp} + * @param string $end_date End date {@from body} {@type timestamp} + * @param float $amount Amount (may be 0) {@from body} + * @param string $label Label {@from body} * @return int ID of subscription * * @url POST {id}/subscriptions diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 8118c4f9d4a..4b3a5cdb82c 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -947,6 +947,7 @@ while ($i < min($num, $limit)) { $obj = $db->fetch_object($resql); $datefin = $db->jdate($obj->datefin); + $memberstatic->id = $obj->rowid; $memberstatic->ref = $obj->ref; $memberstatic->civility_id = $obj->civility; @@ -1063,14 +1064,7 @@ while ($i < min($num, $limit)) { // Nature (Moral/Physical) if (!empty($arrayfields['d.morphy']['checked'])) { print ''; - $s = ''; - if ($obj->morphy == 'phy') { - $s .= ''.dol_substr($langs->trans("Physical"), 0, 1).''; - } - if ($obj->morphy == 'mor') { - $s .= ''.dol_substr($langs->trans("Moral"), 0, 1).''; - } - print $s; + print $memberstatic->getmorphylib('', 2); print "\n"; if (!$i) { $totalarray['nbfield']++; diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index c26a9d13536..cc3c697e032 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -720,7 +720,7 @@ if ($rowid > 0) { */ // Moral/Physique - print "".$adh->getmorphylib($objp->morphy)."\n"; + print "".$adh->getmorphylib($objp->morphy, 1)."\n"; // EMail print "".dol_print_email($objp->email, 0, 0, 1)."\n"; @@ -740,9 +740,9 @@ if ($rowid > 0) { } print ''; } else { - print ''; + print ''; if (!empty($objp->subscription)) { - print $langs->trans("SubscriptionNotReceived"); + print ''.$langs->trans("SubscriptionNotReceived").''; if ($objp->status > 0) { print " ".img_warning(); } @@ -758,7 +758,7 @@ if ($rowid > 0) { print ''.img_edit().''; } if ($user->rights->adherent->supprimer) { - print ''.img_picto($langs->trans("Resiliate"), 'disable.png').''; + print ''.img_picto($langs->trans("Resiliate"), 'disable.png').''; } print ""; @@ -845,7 +845,7 @@ if ($rowid > 0) { print ''.$langs->trans("Description").''; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor = new DolEditor('comment', $object->note, '', 280, 'dolibarr_notes', '', false, true, empty($conf->fckeditor->enabled) ? false : $conf->fckeditor->enabled, 15, '90%'); + $doleditor = new DolEditor('comment', $object->note_public, '', 220, 'dolibarr_notes', '', false, true, empty($conf->fckeditor->enabled) ? false : $conf->fckeditor->enabled, 15, '90%'); $doleditor->Create(); print ""; diff --git a/htdocs/admin/eventorganization.php b/htdocs/admin/eventorganization.php index 40c86d79e13..cc9b8d7bca8 100644 --- a/htdocs/admin/eventorganization.php +++ b/htdocs/admin/eventorganization.php @@ -220,7 +220,7 @@ if ($action == 'edit') { foreach ($arrayofparameters as $constname => $val) { if ($val['enabled']==1) { $setupnotempty++; - print ''; + print ''; $tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : ''); $tooltiphelp .= (($langs->trans($constname . 'Tooltip2') && $langs->trans($constname . 'Tooltip2') != $constname . 'Tooltip2') ? '

'."\n".$langs->trans($constname . 'Tooltip2') : ''); print ''.$form->textwithpicto($langs->trans($constname), $tooltiphelp, 1, 'info', '', 0, 3, 'tootips'.$constname).''; @@ -302,7 +302,8 @@ if ($action == 'edit') { foreach ($arrayofparameters as $constname => $val) { if ($val['enabled']==1) { $setupnotempty++; - print ''; + print ''; + print ''; $tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : ''); $tooltiphelp .= (($langs->trans($constname . 'Tooltip2') && $langs->trans($constname . 'Tooltip2') != $constname . 'Tooltip2') ? '

'."\n".$langs->trans($constname . 'Tooltip2') : ''); print $form->textwithpicto($langs->trans($constname), $tooltiphelp); @@ -320,12 +321,17 @@ if ($action == 'edit') { $formmail = new FormMail($db); $tmp = explode(':', $val['type']); - - $template = $formmail->getEMailTemplate($db, $tmp[1], $user, $langs, getDolGlobalString($constname)); - if ($template < 0) { - setEventMessages(null, $formmail->errors, 'errors'); + $labelemailtemplate = getDolGlobalString($constname); + if ($labelemailtemplate && $labelemailtemplate != '-1') { + $template = $formmail->getEMailTemplate($db, $tmp[1], $user, $langs, getDolGlobalString($constname)); + if (is_numeric($template) && $template < 0) { + setEventMessages($formmail->error, $formmail->errors, 'errors'); + } else { + if ($template->label != 'default') { + print $langs->trans($template->label); + } + } } - print $langs->trans($template->label); } } elseif (preg_match('/category:/', $val['type'])) { if (getDolGlobalString($constname)) { @@ -353,16 +359,21 @@ if ($action == 'edit') { } } elseif ($val['type'] == 'product') { $product = new Product($db); - $resprod = $product->fetch(getDolGlobalString($constname)); - if ($resprod > 0) { - print $product->getNomUrl(1); - } elseif ($resprod < 0) { - setEventMessages($product->error, $product->errors, "errors"); + $idproduct = getDolGlobalString($constname); + if ($idproduct > 0) { + $resprod = $product->fetch($idproduct); + if ($resprod > 0) { + print $product->getNomUrl(1); + } elseif ($resprod < 0) { + setEventMessages($product->error, $product->errors, "errors"); + } } } else { print getDolGlobalString($constname); } - print ''; + print ''; + + print ''; } } diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index 1b5f8353f12..5a4eac7bcca 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -1173,7 +1173,7 @@ if ($num) { $class .= ' tdoverflowmax100'; } if ($value == 'topic') { - $class .= 'tdoverflowmax200 small'; + $class .= ' tdoverflowmax200 small'; } if ($value == 'type_template') { $valuetoshow = isset($elementList[$valuetoshow]) ? $elementList[$valuetoshow] : $valuetoshow; diff --git a/htdocs/admin/system/security.php b/htdocs/admin/system/security.php index b0ea7571a2d..1ea81cd5dd3 100644 --- a/htdocs/admin/system/security.php +++ b/htdocs/admin/system/security.php @@ -570,9 +570,10 @@ print 'For a higher security, we also recommend to implement limits and mitigati print ''; print '
'; -print 'Login process -> This can be done using a fail2ban rule (see example into dev/setup)'."
"; -print DOL_URL_ROOT.'/passwordforgotten.php (see example into dev/setup)'."
"; -print DOL_URL_ROOT.'/public/* (see example into dev/setup)'."
"; +$urlexamplebase = 'https://github.com/Dolibarr/dolibarr/blob/develop/dev/setup/fail2ban/filter.d/'; +print '- Login process (see fail2ban example on GitHub)
'; +print '- '.DOL_URL_ROOT.'/passwordforgotten.php (see fail2ban example on GitHub)
'; +print '- '.DOL_URL_ROOT.'/public/* (see fail2ban example on GitHub)
'; diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php index 779db36fb2f..d01efa0ea5b 100644 --- a/htdocs/admin/tools/dolibarr_export.php +++ b/htdocs/admin/tools/dolibarr_export.php @@ -212,10 +212,10 @@ function hideoptions(){ if (div.style.display === "none") { div.style.display = "block"; - lnk.innerText="'.$langs->trans("HideAdvancedoptions").'"; + lnk.innerText="'.dol_escape_js($langs->transnoentitiesnoconv("HideAdvancedoptions")).'"; } else { div.style.display = "none"; - lnk.innerText="'.$langs->trans("ShowAdvancedOptions").'..."; + lnk.innerText="'.dol_escape_js($langs->transnoentitiesnoconv("ShowAdvancedOptions")).'..."; } } '; diff --git a/htdocs/admin/tools/export.php b/htdocs/admin/tools/export.php index 8299e2198ee..8e7643ffc5d 100644 --- a/htdocs/admin/tools/export.php +++ b/htdocs/admin/tools/export.php @@ -35,7 +35,7 @@ $langs->load("admin"); $action = GETPOST('action', 'aZ09'); $what = GETPOST('what', 'alpha'); $export_type = GETPOST('export_type', 'alpha'); -$file = GETPOST('filename_template', 'alpha'); +$file = dol_sanitizeFileName(GETPOST('filename_template', 'alpha')); // Load variable for pagination $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 45dbbbf12c0..228ff397607 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1591,16 +1591,16 @@ class ActionComm extends CommonObject $tooltip = img_picto('', $this->picto).' '.$langs->trans('Action').''; if (!empty($this->ref)) { - $tooltip .= '
'.$langs->trans('Ref').': '.$this->ref; + $tooltip .= '
'.$langs->trans('Ref').': '.dol_escape_htmltag($this->ref); } if (!empty($label)) { - $tooltip .= '
'.$langs->trans('Title').': '.$label; + $tooltip .= '
'.$langs->trans('Title').': '.dol_escape_htmltag($label); } if (!empty($labeltype)) { - $tooltip .= '
'.$langs->trans('Type').': '.$labeltype; + $tooltip .= '
'.$langs->trans('Type').': '.dol_escape_htmltag($labeltype); } if (!empty($this->location)) { - $tooltip .= '
'.$langs->trans('Location').': '.$this->location; + $tooltip .= '
'.$langs->trans('Location').': '.dol_escape_htmltag($this->location); } if (isset($this->transparency)) { $tooltip .= '
'.$langs->trans('Busy').': '.yn($this->transparency); @@ -1609,7 +1609,7 @@ class ActionComm extends CommonObject $langs->load("mails"); $tooltip .= '
'; //$tooltip .= '
'.img_picto('', 'email').' '.$langs->trans("Email").''; - $tooltip .= '
'.$langs->trans('MailTopic').': '.$this->email_subject; + $tooltip .= '
'.$langs->trans('MailTopic').': '.dol_escape_htmltag($this->email_subject); $tooltip .= '
'.$langs->trans('MailFrom').': '.str_replace(array('<', '>'), array('&lt', '&gt'), $this->email_from); $tooltip .= '
'.$langs->trans('MailTo').': '.str_replace(array('<', '>'), array('&lt', '&gt'), $this->email_to); if (!empty($this->email_tocc)) { @@ -1697,7 +1697,7 @@ class ActionComm extends CommonObject if ($withpicto) { $result .= img_object(($notooltip ? '' : $langs->trans("ShowAction").': '.$label), ($overwritepicto ? $overwritepicto : 'action'), (($this->type_color && $overwritepicto) ? 'style="color: #'.$this->type_color.' !important;" ' : '').($notooltip ? 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'"' : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); } - $result .= $labelshort; + $result .= dol_escape_htmltag($labelshort); $result .= $linkend; global $action; diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index f46b0adc3cb..bfb5ca991b9 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -1272,9 +1272,9 @@ if (count($listofextcals)) { $event->datef = $dateend + $usertime; if ($icalevent['SUMMARY']) { - $event->label = $icalevent['SUMMARY']; + $event->label = dol_string_nohtmltag($icalevent['SUMMARY']); } elseif ($icalevent['DESCRIPTION']) { - $event->label = dol_nl2br($icalevent['DESCRIPTION'], 1); + $event->label = dol_nl2br(dol_string_nohtmltag($icalevent['DESCRIPTION']), 1); } else { $event->label = $langs->trans("ExtSiteNoLabel"); } @@ -1985,7 +1985,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa // Show title $titletoshow = $daterange; - $titletoshow .= ($titletoshow ? ' ' : '').($event->label ? $event->label : $event->libelle); + $titletoshow .= ($titletoshow ? ' ' : '').dol_escape_htmltag($event->label ? $event->label : $event->libelle); if ($event->type_code != 'ICALEVENT') { $savlabel = $event->label ? $event->label : $event->libelle; diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index 1beefca8cf6..ed3cfce4163 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -544,7 +544,7 @@ if ($object->fetch($id) >= 0) { if ($allowaddtarget) { $morehtmlcenter = ''.$langs->trans("ToClearAllRecipientsClickHere").' id.'" class="button reposition smallpaddingimp">'.$langs->trans("TargetsReset").''; } - $morehtmlcenter .= '   id.'">'.$langs->trans("Download").''; + $morehtmlcenter .= '   id.'">'.img_picto('', 'download', 'class="pictofixedwidth"').$langs->trans("Download").''; $massactionbutton = ''; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index bb296fae10b..455420ce90a 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -2446,7 +2446,7 @@ if ($resql) { // Get local and virtual stock and store it into cache if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product])) { - $generic_product->load_stock('nobatch'); // ->load_virtual_stock() is already included into load_stock() + $generic_product->load_stock('nobatch,warehouseopen'); // ->load_virtual_stock() is already included into load_stock() $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_reel; $productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_theorique; } else { diff --git a/htdocs/compta/bank/class/api_bankaccounts.class.php b/htdocs/compta/bank/class/api_bankaccounts.class.php index 8e38d1ffe78..c9886a176f0 100644 --- a/htdocs/compta/bank/class/api_bankaccounts.class.php +++ b/htdocs/compta/bank/class/api_bankaccounts.class.php @@ -471,7 +471,7 @@ class BankAccounts extends DolibarrApi * Add a line to an account * * @param int $id ID of account - * @param int $date Payment date (timestamp) {@from body} {@type timestamp} + * @param string $date Payment date (timestamp) {@from body} {@type timestamp} * @param string $type Payment mode (TYP,VIR,PRE,LIQ,VAD,CB,CHQ...) {@from body} * @param string $label Label {@from body} * @param float $amount Amount (may be 0) {@from body} @@ -480,7 +480,7 @@ class BankAccounts extends DolibarrApi * @param string $cheque_writer Name of cheque writer {@from body} * @param string $cheque_bank Bank of cheque writer {@from body} * @param string $accountancycode Accountancy code {@from body} - * @param int $datev Payment date value (timestamp) {@from body} {@type timestamp} + * @param string $datev Payment date value (timestamp) {@from body} {@type timestamp} * @param string $num_releve Bank statement numero {@from body} * @return int ID of line * diff --git a/htdocs/compta/bank/line.php b/htdocs/compta/bank/line.php index 49edf3c3a1a..cb10a7310c6 100644 --- a/htdocs/compta/bank/line.php +++ b/htdocs/compta/bank/line.php @@ -657,13 +657,13 @@ if ($result) { if ($user->rights->banque->consolidate) { print ''; if ($objp->rappro) { - print 'rappro ? ' disabled' : '').'>'; - print ''; + print 'rappro ? ' disabled' : '').'>'; + print ''; } else { - print 'rappro ? ' disabled' : '').'>'; + print 'rappro ? ' disabled' : '').'>'; } if ($objp->num_releve) { - print '   ('.$langs->trans("AccountStatement").' '.$objp->num_releve.')'; + print '   ('.$langs->trans("AccountStatement").' '.$objp->num_releve.')'; } print ''; } else { @@ -675,6 +675,28 @@ if ($result) { if ($user->rights->banque->consolidate) { print ''; print 'rappro ? ' checked="checked"' : '')).'">'; + + print ' + + '; + print ''; } else { print ''.yn($objp->rappro).''; diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 51c094d898e..4c1392e28eb 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -1452,7 +1452,6 @@ class Invoices extends DolibarrApi $multicurrency_amounts[$id] = $newvalue; } - // Creation of payment line $paymentobj = new Paiement($this->db); $paymentobj->datepaye = $datepaye; diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index da72411528d..532140481ab 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -1272,6 +1272,8 @@ class FactureRec extends CommonInvoice $tmparray = dol_getdate($now); $today = dol_mktime(23, 59, 59, $tmparray['mon'], $tmparray['mday'], $tmparray['year']); // Today is last second of current day + $this->output = null; + dol_syslog("createRecurringInvoices restrictioninvoiceid=".$restrictioninvoiceid." forcevalidation=".$forcevalidation); $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'facture_rec'; diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index f6b31386215..8aaf8010dd2 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -353,7 +353,8 @@ class BonPrelevement extends CommonObject if ($this->fetched == 1) { if ($date < $this->date_trans) { - $this->error = 'DateOfMovementLowerThanDateOfFileTransmission'; + $langs->load("errors"); + $this->error = $langs->trans('ErrorDateOfMovementLowerThanDateOfFileTransmission'); dol_syslog("bon-prelevment::set_infocredit 1027 ".$this->error); return -1027; } diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 8f4c59bb2f8..e8396a4299c 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -553,7 +553,15 @@ if (strlen($search_fax)) { if (isModEnabled('socialnetworks')) { foreach ($socialnetworks as $key => $value) { if ($value['active'] && strlen($search_[$key])) { - $sql .= " AND p.socialnetworks LIKE '%\"".$key."\":\"".$search_[$key]."%'"; + $searchkeyinjsonformat = preg_replace('/"$/', '', preg_replace('/^"/', '', json_encode($search_[$key]))); + if (in_array($db->type, array('mysql', 'mysqli'))) { + $sql .= " AND p.socialnetworks REGEXP '\"".$db->escapeforlike($db->escape($key))."\":\"[^\"]*".$db->escapeforlike($db->escape($searchkeyinjsonformat))."'"; + } elseif ($db->type == 'pgsql') { + $sql .= " AND p.socialnetworks ~ '\"".$db->escapeforlike($db->escape($key))."\":\"[^\"]*".$db->escapeforlike($db->escape($searchkeyinjsonformat))."'"; + } else { + // Works with all database but not reliable because search only for social network code starting with earched value + $sql .= " AND p.socialnetworks LIKE '%\"".$db->escapeforlike($db->escape($key))."\":\"".$db->escapeforlike($db->escape($searchkeyinjsonformat))."%'"; + } } } } @@ -608,6 +616,7 @@ if ($view == "recent") { } else { $sql .= $db->order($sortfield, $sortorder); } +//print $sql; // Count total nb of records $nbtotalofrecords = ''; diff --git a/htdocs/core/ajax/selectsearchbox.php b/htdocs/core/ajax/selectsearchbox.php index 19f7523fd21..f2e44577260 100644 --- a/htdocs/core/ajax/selectsearchbox.php +++ b/htdocs/core/ajax/selectsearchbox.php @@ -21,12 +21,9 @@ * \brief This script returns content of possible search */ - // This script is called with a POST method or as an include. if (!isset($usedbyinclude) || empty($usedbyinclude)) { - top_httphead('application/json'); - if (!defined('NOTOKENRENEWAL')) { define('NOTOKENRENEWAL', 1); // Disables token renewal } @@ -45,6 +42,9 @@ if (!isset($usedbyinclude) || empty($usedbyinclude)) { } $res = @include '../../main.inc.php'; + + top_httphead('application/json'); + if ($res == 'ERROR_NOT_LOGGED') { $langs->load("other"); $arrayresult['jumptologin'] = array('img'=>'object_generic', 'label'=>$langs->trans("JumpToLogin"), 'text'=>' '.$langs->trans("JumpToLogin"), 'url'=>DOL_URL_ROOT.'/index.php'); @@ -90,7 +90,6 @@ if (((isModEnabled('product') && $user->hasRight('product', 'read')) || (isModEn if (isModEnabled('mrp') && $user->hasRight('mrp', 'read') && empty($conf->global->MAIN_SEARCHFORM_MRP_DISABLED)) { $arrayresult['searchintomo'] = array('position'=>35, 'shortcut'=>'', 'img'=>'object_mrp', 'label'=>$langs->trans("SearchIntoMO", $search_boxvalue), 'text'=>img_picto('', 'object_mrp', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoMO", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/mrp/mo_list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } - if (isModEnabled('project') && empty($conf->global->MAIN_SEARCHFORM_PROJECT_DISABLED) && $user->hasRight('projet', 'lire')) { $arrayresult['searchintoprojects'] = array('position'=>40, 'shortcut'=>'Q', 'img'=>'object_project', 'label'=>$langs->trans("SearchIntoProjects", $search_boxvalue), 'text'=>img_picto('', 'object_project', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoProjects", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 85fc7569505..a198d74f808 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3757,25 +3757,7 @@ abstract class CommonObject $fieldlocaltax2 = 'localtax2'; $fieldttc = 'total_ttc'; // Specific code for backward compatibility with old field names - if ($this->element == 'facture' || $this->element == 'facturerec') { - $fieldtva = 'total_tva'; - } - if ($this->element == 'facture_fourn' || $this->element == 'invoice_supplier' || $this->element == 'invoice_supplier_rec') { - $fieldtva = 'total_tva'; - } - if ($this->element == 'propal') { - $fieldtva = 'total_tva'; - } - if ($this->element == 'expensereport') { - $fieldtva = 'total_tva'; - } - if ($this->element == 'supplier_proposal') { - $fieldtva = 'total_tva'; - } - if ($this->element == 'commande') { - $fieldtva = 'total_tva'; - } - if ($this->element == 'order_supplier') { + if (in_array($this->element, array('propal', 'commande', 'facture', 'facturerec', 'supplier_proposal', 'order_supplier', 'facture_fourn', 'invoice_supplier', 'invoice_supplier_rec', 'expensereport'))) { $fieldtva = 'total_tva'; } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 1d94646d4f6..02f9dc5c712 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -8251,6 +8251,7 @@ class Form if(! data.id) return null;'; if ($callurlonselect) { + // We forge the url with 'sall=' $outdelayed .= ' var urlBase = data.url; diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index debfbbf1b8e..16302dc3c1a 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -1284,7 +1284,7 @@ class FormMail extends Form * @param int $id Id of template to get, or -1 for first found with position 0, or 0 for first found whatever is position (priority order depends on lang provided or not) or -2 for exact match with label (no answer if not found) * @param int $active 1=Only active template, 0=Only disabled, -1=All * @param string $label Label of template to get - * @return ModelMail|integer One instance of ModelMail or -1 if error + * @return ModelMail|integer One instance of ModelMail or < 0 if error */ public function getEMailTemplate($dbs, $type_template, $user, $outputlangs, $id = 0, $active = 1, $label = '') { diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php index 4f77cfbaae5..426dec37962 100644 --- a/htdocs/core/class/ldap.class.php +++ b/htdocs/core/class/ldap.class.php @@ -193,12 +193,20 @@ class Ldap { // phpcs:enable global $conf; + global $dolibarr_main_auth_ldap_debug; $connected = 0; $this->bind = 0; $this->error = 0; $this->connectedServer = ''; + $ldapdebug = ((empty($dolibarr_main_auth_ldap_debug) || $dolibarr_main_auth_ldap_debug == "false") ? false : true); + + if ($ldapdebug) { + dol_syslog(get_class($this)."::connect_bind"); + print "DEBUG: connect_bind
\n"; + } + // Check parameters if (count($this->server) == 0 || empty($this->server[0])) { $this->error = 'LDAP setup (file conf.php) is not complete'; @@ -223,18 +231,28 @@ class Ldap } if ($this->serverPing($host, $this->serverPort) === true) { + if ($ldapdebug) { + dol_syslog(get_class($this)."::connect_bind serverPing true, we try ldap_connect to ".$host); + } $this->connection = ldap_connect($host, $this->serverPort); } else { if (preg_match('/^ldaps/i', $host)) { // With host = ldaps://server, the serverPing to ssl://server sometimes fails, even if the ldap_connect succeed, so - // we test this case and continue in suche a case even if serverPing fails. + // we test this case and continue in such a case even if serverPing fails. + if ($ldapdebug) { + dol_syslog(get_class($this)."::connect_bind serverPing false, we try ldap_connect to ".$host); + } $this->connection = ldap_connect($host, $this->serverPort); } else { continue; } } - if (is_resource($this->connection) || is_object($this->connection)) { + if (is_resource($this->connection) || is_object($this->connection)) { + if ($ldapdebug) { + dol_syslog(get_class($this)."::connect_bind this->connection is ok", LOG_DEBUG); + } + // Upgrade connexion to TLS, if requested by the configuration if (!empty($conf->global->LDAP_SERVER_USE_TLS)) { // For test/debug diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index d67bee7abac..3ab8ff836bf 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -215,6 +215,9 @@ class Utils dol_syslog("Utils::dumpDatabase type=".$type." compression=".$compression." file=".$file, LOG_DEBUG); require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + // Clean data + $file = dol_sanitizeFileName($file); + // Check compression parameter if (!in_array($compression, array('none', 'gz', 'bz', 'zip', 'zstd'))) { $langs->load("errors"); @@ -354,6 +357,8 @@ class Utils $handle = ''; + // If $lowmemorydump is set, it means we want to make the compression using an external pipe instead retreiving the + // content of the dump in PHP memory array $output_arr and then print it into the PHP pipe open with xopen(). $lowmemorydump = GETPOSTISSET("lowmemorydump") ? GETPOST("lowmemorydump") : getDolGlobalString('MAIN_LOW_MEMORY_DUMP'); // Start call method to execute dump @@ -371,23 +376,23 @@ class Utils } } else { if ($compression == 'none') { - $fullcommandclear .= " > ".$outputfile; - $fullcommandcrypted .= " > ".$outputfile; + $fullcommandclear .= ' > "'.dol_sanitizePathName($outputfile).'"'; + $fullcommandcrypted .= ' > "'.dol_sanitizePathName($outputfile).'"'; $handle = 1; } elseif ($compression == 'gz') { - $fullcommandclear .= " | gzip > ".$outputfile; - $fullcommandcrypted .= " | gzip > ".$outputfile; - $paramcrypted.=" | gzip"; + $fullcommandclear .= ' | gzip > "'.dol_sanitizePathName($outputfile).'"'; + $fullcommandcrypted .= ' | gzip > "'.dol_sanitizePathName($outputfile).'"'; + $paramcrypted .= ' | gzip'; $handle = 1; } elseif ($compression == 'bz') { - $fullcommandclear .= " | bzip2 > ".$outputfile; - $fullcommandcrypted .= " | bzip2 > ".$outputfile; - $paramcrypted.=" | bzip2"; + $fullcommandclear .= ' | bzip2 > "'.dol_sanitizePathName($outputfile).'"'; + $fullcommandcrypted .= ' | bzip2 > "'.dol_sanitizePathName($outputfile).'"'; + $paramcrypted .= ' | bzip2'; $handle = 1; } elseif ($compression == 'zstd') { - $fullcommandclear .= " | zstd > ".$outputfile; - $fullcommandcrypted .= " | zstd > ".$outputfile; - $paramcrypted.=" | zstd"; + $fullcommandclear .= ' | zstd > "'.dol_sanitizePathName($outputfile).'"'; + $fullcommandcrypted .= ' | zstd > "'.dol_sanitizePathName($outputfile).'"'; + $paramcrypted .= ' | zstd'; $handle = 1; } } @@ -411,8 +416,8 @@ class Utils } - // TODO Replace with executeCLI function but - // we must first introduce a low memory mode + // TODO Replace with Utils->executeCLI() function but + // we must first introduce the variant with $lowmemorydump into this method. if ($execmethod == 1) { $output_arr = array(); $retval = null; @@ -471,15 +476,16 @@ class Utils } } - - if ($compression == 'none') { - fclose($handle); - } elseif ($compression == 'gz') { - gzclose($handle); - } elseif ($compression == 'bz') { - bzclose($handle); - } elseif ($compression == 'zstd') { - fclose($handle); + if (!$lowmemorydump) { + if ($compression == 'none') { + fclose($handle); + } elseif ($compression == 'gz') { + gzclose($handle); + } elseif ($compression == 'bz') { + bzclose($handle); + } elseif ($compression == 'zstd') { + fclose($handle); + } } if (!empty($conf->global->MAIN_UMASK)) { diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 9aaf0771d44..03223a7b65a 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -169,7 +169,7 @@ function dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforend } else { $date->add($interval); } - //Change the behavior of PHP over data-interval when the result of this function is Feb 29 (non-leap years), 30 or Feb 31 (php returns March 1, 2 or 3 respectively) + //Change the behavior of PHP over data-interval when the result of this function is Feb 29 (non-leap years), 30 or Feb 31 (so php returns March 1, 2 or 3 respectively) if ($ruleforendofmonth == 1 && $duration_unit == 'm') { $timeyear = dol_print_date($time, '%Y'); $timemonth = dol_print_date($time, '%m'); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 6c278f4764d..f026d58e2de 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1233,6 +1233,7 @@ function dol_sanitizeFileName($str, $newstr = '_', $unaccent = 1) $tmp = dol_string_nospecial($unaccent ? dol_string_unaccent($str) : $str, $newstr, $filesystem_forbidden_chars); $tmp = preg_replace('/\-\-+/', '_', $tmp); $tmp = preg_replace('/\s+\-([^\s])/', ' _$1', $tmp); + $tmp = preg_replace('/\s+\-$/', '', $tmp); $tmp = str_replace('..', '', $tmp); return $tmp; } @@ -1257,6 +1258,7 @@ function dol_sanitizePathName($str, $newstr = '_', $unaccent = 1) $tmp = dol_string_nospecial($unaccent ? dol_string_unaccent($str) : $str, $newstr, $filesystem_forbidden_chars); $tmp = preg_replace('/\-\-+/', '_', $tmp); $tmp = preg_replace('/\s+\-([^\s])/', ' _$1', $tmp); + $tmp = preg_replace('/\s+\-$/', '', $tmp); $tmp = str_replace('..', '', $tmp); return $tmp; } diff --git a/htdocs/core/login/functions_ldap.php b/htdocs/core/login/functions_ldap.php index cd4ed16eae6..faf0024d801 100644 --- a/htdocs/core/login/functions_ldap.php +++ b/htdocs/core/login/functions_ldap.php @@ -77,7 +77,7 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest) $ldapdn = $dolibarr_main_auth_ldap_dn; $ldapadminlogin = $dolibarr_main_auth_ldap_admin_login; $ldapadminpass = $dolibarr_main_auth_ldap_admin_pass; - $ldapdebug = (empty($dolibarr_main_auth_ldap_debug) || $dolibarr_main_auth_ldap_debug == "false" ? false : true); + $ldapdebug = ((empty($dolibarr_main_auth_ldap_debug) || $dolibarr_main_auth_ldap_debug == "false") ? false : true); if ($ldapdebug) { print "DEBUG: Logging LDAP steps
\n"; @@ -94,9 +94,9 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest) if ($ldapdebug) { dol_syslog("functions_ldap::check_user_password_ldap Server:".join(',', $ldap->server).", Port:".$ldap->serverPort.", Protocol:".$ldap->ldapProtocolVersion.", Type:".$ldap->serverType); - dol_syslog("functions_ldap::check_user_password_ldap uid/samacountname=".$ldapuserattr.", dn=".$ldapdn.", Admin:".$ldap->searchUser.", Pass:".$ldap->searchPassword); + dol_syslog("functions_ldap::check_user_password_ldap uid/samaccountname=".$ldapuserattr.", dn=".$ldapdn.", Admin:".$ldap->searchUser.", Pass:".dol_trunc($ldap->searchPassword, 3)); print "DEBUG: Server:".join(',', $ldap->server).", Port:".$ldap->serverPort.", Protocol:".$ldap->ldapProtocolVersion.", Type:".$ldap->serverType."
\n"; - print "DEBUG: uid/samacountname=".$ldapuserattr.", dn=".$ldapdn.", Admin:".$ldap->searchUser.", Pass:".$ldap->searchPassword."
\n"; + print "DEBUG: uid/samaccountname=".$ldapuserattr.", dn=".$ldapdn.", Admin:".$ldap->searchUser.", Pass:".dol_trunc($ldap->searchPassword, 3)."
\n"; } $resultFetchLdapUser = 0; diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index 594ab96d955..09f93a436ea 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -458,17 +458,27 @@ class ImportCsv extends ModeleImports $param_array = array('', $newval, 0, $arrayrecord[0]['val']); // Param to fetch parent from account, in chart. } - call_user_func_array(array($classinstance, $method), $param_array); + $result = call_user_func_array(array($classinstance, $method), $param_array); + + // If duplicate record found + if (!($classinstance->id != '') && $result == -2) { + $this->errors[$error]['lib'] = $langs->trans('ErrorMultipleRecordFoundFromRef', $newval); + $this->errors[$error]['type'] = 'FOREIGNKEY'; + $errorforthistable++; + $error++; + } + // If not found, try the fetch from label if (!($classinstance->id != '') && $objimport->array_import_convertvalue[0][$val]['rule'] == 'fetchidfromcodeorlabel') { $param_array = array('', '', $newval); call_user_func_array(array($classinstance, $method), $param_array); } $this->cacheconvert[$file.'_'.$class.'_'.$method.'_'][$newval] = $classinstance->id; + //print 'We have made a '.$class.'->'.$method.' to get id from code '.$newval.'. '; if ($classinstance->id != '') { // id may be 0, it is a found value $newval = $classinstance->id; - } else { + } elseif (! $error) { if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) { $this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', num2Alpha($key - 1), $newval, 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict'])); } elseif (!empty($objimport->array_import_convertvalue[0][$val]['element'])) { @@ -729,9 +739,13 @@ class ImportCsv extends ModeleImports if (isModEnabled("socialnetworks") && strpos($fieldname, "socialnetworks") !== false) { if (!in_array("socialnetworks", $listfields)) { $listfields[] = "socialnetworks"; + $socialkey = array_search("socialnetworks", $listfields); // Return position of 'socialnetworks' key in array + $listvalues[$socialkey] = ''; } + //var_dump($newval); var_dump($arrayrecord[($key - 1)]['type']); if (!empty($newval) && $arrayrecord[($key - 1)]['type'] > 0) { - $socialkey = array_search("socialnetworks", $listfields); + $socialkey = array_search("socialnetworks", $listfields); // Return position of 'socialnetworks' key in array + //var_dump('sk='.$socialkey); // socialkey=19 $socialnetwork = explode("_", $fieldname)[1]; if (empty($listvalues[$socialkey]) || $listvalues[$socialkey] == "null") { $json = new stdClass(); @@ -833,7 +847,6 @@ class ImportCsv extends ModeleImports if (empty($lastinsertid)) { // No insert done yet for a parent table $sqlSelect = "SELECT ".$fname." FROM ".$tablename; - $data = array_combine($listfields, $listvalues); $where = array(); // filters to forge SQL request $filters = array(); // filters to forge output error message diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index 3637ce105c1..ecf7d8b4a77 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -502,17 +502,28 @@ class ImportXlsx extends ModeleImports }*/ $param_array = array('', $newval, 0, $arrayrecord[0]['val']); // Param to fetch parent from account, in chart. } - call_user_func_array(array($classinstance, $method), $param_array); + + $result = call_user_func_array(array($classinstance, $method), $param_array); + + // If duplicate record found + if (!($classinstance->id != '') && $result == -2) { + $this->errors[$error]['lib'] = $langs->trans('ErrorMultipleRecordFoundFromRef', $newval); + $this->errors[$error]['type'] = 'FOREIGNKEY'; + $errorforthistable++; + $error++; + } + // If not found, try the fetch from label if (!($classinstance->id != '') && $objimport->array_import_convertvalue[0][$val]['rule'] == 'fetchidfromcodeorlabel') { $param_array = array('', '', $newval); call_user_func_array(array($classinstance, $method), $param_array); } $this->cacheconvert[$file . '_' . $class . '_' . $method . '_'][$newval] = $classinstance->id; + //print 'We have made a '.$class.'->'.$method.' to get id from code '.$newval.'. '; if ($classinstance->id != '') { // id may be 0, it is a found value $newval = $classinstance->id; - } else { + } elseif (! $error) { if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) { $this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', $key, $newval, 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict'])); } elseif (!empty($objimport->array_import_convertvalue[0][$val]['element'])) { @@ -770,12 +781,14 @@ class ImportXlsx extends ModeleImports } // Define $listfields and $listvalues to build SQL request - if ($conf->socialnetworks->enabled && strpos($fieldname, "socialnetworks") !== false) { + if (isModEnabled("socialnetworks") && strpos($fieldname, "socialnetworks") !== false) { if (!in_array("socialnetworks", $listfields)) { $listfields[] = "socialnetworks"; + $socialkey = array_search("socialnetworks", $listfields); // Return position of 'socialnetworks' key in array. Example socialkey=19 + $listvalues[$socialkey] = ''; } if (!empty($newval) && $arrayrecord[($key)]['type'] > 0) { - $socialkey = array_search("socialnetworks", $listfields); + $socialkey = array_search("socialnetworks", $listfields); // Return position of 'socialnetworks' key in array. Example socialkey=19 $socialnetwork = explode("_", $fieldname)[1]; if (empty($listvalues[$socialkey]) || $listvalues[$socialkey] == "null") { $json = new stdClass(); @@ -797,7 +810,7 @@ class ImportXlsx extends ModeleImports } elseif (empty($newval) && $arrayrecord[($key)]['type'] == 0) { $listvalues[] = "''"; } else { - $listvalues[] = "'" . $this->db->escape($newval) . "'"; + $listvalues[] = "'".$this->db->escape($newval)."'"; } } } @@ -810,7 +823,7 @@ class ImportXlsx extends ModeleImports if (!empty($listfields) && is_array($objimport->array_import_fieldshidden[0])) { // Loop on each hidden fields to add them into listfields/listvalues foreach ($objimport->array_import_fieldshidden[0] as $key => $val) { - if (!preg_match('/^' . preg_quote($alias, '/') . '\./', $key)) { + if (!preg_match('/^'.preg_quote($alias, '/').'\./', $key)) { continue; // Not a field of current table } if ($val == 'user->id') { @@ -876,17 +889,17 @@ class ImportXlsx extends ModeleImports if (!empty($updatekeys)) { // We do SELECT to get the rowid, if we already have the rowid, it's to be used below for related tables (extrafields) - $where = array(); - if (empty($lastinsertid)) { // No insert done yet for a parent table $sqlSelect = "SELECT ".$fname." FROM " . $tablename; $data = array_combine($listfields, $listvalues); - $filters = array(); + + $where = array(); // filters to forge SQL request + $filters = array(); // filters to forge output error message foreach ($updatekeys as $key) { $col = $objimport->array_import_updatekeys[0][$key]; $key = preg_replace('/^.*\./i', '', $key); - if ($conf->socialnetworks->enabled && strpos($key, "socialnetworks") !== false) { + if (isModEnabled("socialnetworks") && strpos($key, "socialnetworks") !== false) { $tmp = explode("_", $key); $key = $tmp[0]; $socialnetwork = $tmp[1]; diff --git a/htdocs/core/modules/modEventOrganization.class.php b/htdocs/core/modules/modEventOrganization.class.php index f600ef633aa..437fa691713 100644 --- a/htdocs/core/modules/modEventOrganization.class.php +++ b/htdocs/core/modules/modEventOrganization.class.php @@ -327,7 +327,7 @@ class modEventOrganization extends DolibarrModules */ public function init($options = '') { - global $conf, $langs; + global $conf, $langs, $user; // Permissions $this->remove($options); @@ -370,6 +370,28 @@ class modEventOrganization extends DolibarrModules $init = $this->_init($sql, $options); + + // Insert some vars + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; + $formmail = new FormMail($this->db); + + $template = $formmail->getEMailTemplate($this->db, 'conferenceorbooth', $user, $langs, 0, 1, '(EventOrganizationEmailAskConf)'); + if ($template->id > 0) { + dolibarr_set_const($this->db, 'EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_CONF', $template->id, 'chaine', 0, '', $conf->entity); + } + $template = $formmail->getEMailTemplate($this->db, 'conferenceorbooth', $user, $langs, 0, 1, '(EventOrganizationEmailAskBooth)'); + if ($template->id > 0) { + dolibarr_set_const($this->db, 'EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_BOOTH', $template->id, 'chaine', 0, '', $conf->entity); + } + $template = $formmail->getEMailTemplate($this->db, 'conferenceorbooth', $user, $langs, 0, 1, '(EventOrganizationEmailBoothPayment)'); + if ($template->id > 0) { + dolibarr_set_const($this->db, 'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_BOOTH', $template->id, 'chaine', 0, '', $conf->entity); + } + $template = $formmail->getEMailTemplate($this->db, 'conferenceorbooth', $user, $langs, 0, 1, '(EventOrganizationEmailRegistrationPayment)'); + if ($template->id > 0) { + dolibarr_set_const($this->db, 'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT', $template->id, 'chaine', 0, '', $conf->entity); + } + return $init; } diff --git a/htdocs/cron/card.php b/htdocs/cron/card.php index 87a054c699f..5de627a9a9a 100644 --- a/htdocs/cron/card.php +++ b/htdocs/cron/card.php @@ -473,6 +473,16 @@ if (($action == "create") || ($action == "edit")) { } $input .= ""; print $input; + + $input = " unitfrequency == "2678400") { + $input .= ' checked />'; + } else { + $input .= ' />'; + } + $input .= ""; + print $input; + print ""; print ""; print ""; @@ -664,6 +674,9 @@ if (($action == "create") || ($action == "edit")) { if ($object->unitfrequency == "604800") { print $langs->trans('CronEach')." ".($object->frequency)." ".$langs->trans('Weeks'); } + if ($object->unitfrequency == "2678400") { + print $langs->trans('CronEach')." ".($object->frequency)." ".$langs->trans('Month'); + } print ""; print ''; diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index db48c0e7fce..8f4b32ae502 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2007-2022 Laurent Destailleur * Copyright (C) 2013 Florian Henry * * This program is free software; you can redistribute it and/or modify @@ -23,6 +23,7 @@ // Put here all includes required by your class file require_once DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php"; +require_once DOL_DOCUMENT_ROOT."/core/lib/date.lib.php"; /** @@ -1408,21 +1409,30 @@ class Cronjob extends CommonObject if (empty($this->datenextrun)) { if (empty($this->datestart)) { - $this->datenextrun = $now + ($this->frequency * $this->unitfrequency); + if ($this->unitfrequency == 2678400) { + $this->datenextrun = dol_time_plus_duree($now, $this->frequency, 'm'); + } else { + $this->datenextrun = $now + ($this->frequency * $this->unitfrequency); + } } else { - $this->datenextrun = $this->datestart + ($this->frequency * $this->unitfrequency); + if ($this->unitfrequency == 2678400) { + $this->datenextrun = dol_time_plus_duree($this->datestart, $this->frequency, 'm'); + } else { + $this->datenextrun = $this->datestart + ($this->frequency * $this->unitfrequency); + } } } if ($this->datenextrun < $now && $this->frequency > 0 && $this->unitfrequency > 0) { // Loop until date is after future while ($this->datenextrun < $now) { - $this->datenextrun += ($this->frequency * $this->unitfrequency); - - // TODO For exact frequency (every month, every year, ...), use instead a dol_time_plus_duree($time, $duration_value, $duration_unit) + if ($this->unitfrequency == 2678400) { + $this->datenextrun = dol_time_plus_duree($this->datenextrun, $this->frequency, 'm'); + } else { + $this->datenextrun += ($this->frequency * $this->unitfrequency); + } } } else { - //$this->datenextrun=$this->datenextrun + ($this->frequency * $this->unitfrequency); dol_syslog(get_class($this)."::reprogram_jobs datenextrun is already in future, we do not change it"); } diff --git a/htdocs/datapolicy/class/datapolicycron.class.php b/htdocs/datapolicy/class/datapolicycron.class.php index 44152f0c68b..fb76767bf1e 100644 --- a/htdocs/datapolicy/class/datapolicycron.class.php +++ b/htdocs/datapolicy/class/datapolicycron.class.php @@ -451,8 +451,8 @@ class DataPolicyCron $this->db->begin(); foreach ($arrayofparameters as $key => $params) { - if ($conf->global->$key != '' && is_numeric($conf->global->$key) && (int) $conf->global->$key > 0) { - $sql = sprintf($params['sql'], (int) $conf->entity, (int) $conf->global->$key, (int) $conf->global->$key); + if (getDolGlobalInt($key) > 0) { + $sql = sprintf($params['sql'], (int) $conf->entity, (int) getDolGlobalInt($key), (int) getDolGlobalInt($key)); $resql = $this->db->query($sql); diff --git a/htdocs/eventorganization/class/conferenceorboothattendee.class.php b/htdocs/eventorganization/class/conferenceorboothattendee.class.php index 222a0c78946..909758ca3f2 100644 --- a/htdocs/eventorganization/class/conferenceorboothattendee.class.php +++ b/htdocs/eventorganization/class/conferenceorboothattendee.class.php @@ -103,12 +103,13 @@ class ConferenceOrBoothAttendee extends CommonObject public $fields = array( 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>2, 'index'=>1, 'comment'=>"Reference of object"), - 'fk_actioncomm' => array('type'=>'integer:ActionComm:comm/action/class/actioncomm.class.php:1', 'label'=>'ConferenceOrBooth', 'enabled'=>'1', 'position'=>55, 'notnull'=>0, 'visible'=>0, 'index'=>1, 'picto'=>'agenda'), + 'fk_actioncomm' => array('type'=>'integer:ActionComm:comm/action/class/actioncomm.class.php:1', 'label'=>'ConferenceOrBooth', 'enabled'=>'1', 'position'=>15, 'notnull'=>0, 'visible'=>0, 'index'=>1, 'picto'=>'agenda'), 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>"isModEnabled('project')", 'position'=>20, 'notnull'=>1, 'visible'=>0, 'index'=>1, 'picto'=>'project', 'css'=>'tdoverflowmax150 maxwidth500'), 'email' => array('type'=>'mail', 'label'=>'EmailAttendee', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'autofocusoncreate'=>1, 'searchall'=>1), 'firstname' => array('type'=>'varchar(100)', 'label'=>'Firstname', 'enabled'=>'1', 'position'=>31, 'notnull'=>0, 'visible'=>1, 'index'=>1, 'searchall'=>1), 'lastname' => array('type'=>'varchar(100)', 'label'=>'Lastname', 'enabled'=>'1', 'position'=>32, 'notnull'=>0, 'visible'=>1, 'index'=>1, 'searchall'=>1), 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status = 1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'position'=>40, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"OrganizationEventLinkToThirdParty", 'picto'=>'company', 'css'=>'tdoverflowmax150 maxwidth500'), + 'email_company' => array('type'=>'mail', 'label'=>'EmailCompany', 'enabled'=>'1', 'position'=>41, 'notnull'=>0, 'visible'=>-2, 'searchall'=>1), 'date_subscription' => array('type'=>'datetime', 'label'=>'DateOfRegistration', 'enabled'=>'1', 'position'=>56, 'notnull'=>1, 'visible'=>1, 'showoncombobox'=>'1',), 'fk_invoice' => array('type'=>'integer:Facture:compta/facture/class/facture.class.php', 'label'=>'Invoice', 'enabled'=>'$conf->facture->enabled', 'position'=>57, 'notnull'=>0, 'visible'=>-1, 'index'=>0, 'picto'=>'bill', 'css'=>'tdoverflowmax150 maxwidth500'), 'amount' => array('type'=>'price', 'label'=>'AmountPaid', 'enabled'=>'1', 'position'=>57, 'notnull'=>0, 'visible'=>1, 'default'=>'null', 'isameasure'=>'1', 'help'=>"AmountOfSubscriptionPaid",), @@ -125,11 +126,13 @@ class ConferenceOrBoothAttendee extends CommonObject ); public $rowid; public $ref; - public $fk_soc; public $fk_actioncomm; + public $fk_project; public $email; public $firstname; public $lastname; + public $fk_soc; + public $email_company; public $date_subscription; public $fk_invoice; public $amount; diff --git a/htdocs/hrm/class/evaluation.class.php b/htdocs/hrm/class/evaluation.class.php index 879acff61fa..b35a23a6389 100644 --- a/htdocs/hrm/class/evaluation.class.php +++ b/htdocs/hrm/class/evaluation.class.php @@ -119,7 +119,7 @@ class Evaluation extends CommonObject 'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>'1', 'position'=>1000, 'notnull'=>1, 'default'=>0, 'visible'=>5, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Validated', '6' => 'Closed'),), 'date_eval' => array('type'=>'date', 'label'=>'DateEval', 'enabled'=>'1', 'position'=>502, 'notnull'=>1, 'visible'=>1,), 'fk_user' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'User', 'enabled'=>'1', 'position'=>504, 'notnull'=>1, 'visible'=>1,), - 'fk_job' => array('type'=>'integer:Job:/hrm/class/job.class.php', 'label'=>'Job', 'enabled'=>'1', 'position'=>505, 'notnull'=>1, 'visible'=>1,), + 'fk_job' => array('type'=>'integer:Job:/hrm/class/job.class.php', 'label'=>'JobPosition', 'enabled'=>'1', 'position'=>505, 'notnull'=>1, 'visible'=>1,), ); public $rowid; public $ref; diff --git a/htdocs/hrm/class/position.class.php b/htdocs/hrm/class/position.class.php index 19246dc2313..5d0c04a4f47 100644 --- a/htdocs/hrm/class/position.class.php +++ b/htdocs/hrm/class/position.class.php @@ -110,10 +110,10 @@ class Position extends CommonObject 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>'1', 'position'=>501, 'notnull'=>0, 'visible'=>-2,), 'fk_contrat' => array('type'=>'integer:Contrat:contrat/class/contrat.class.php', 'label'=>'fk_contrat', 'enabled'=>'1', 'position'=>50, 'notnull'=>0, 'visible'=>0,), 'fk_user' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Employee', 'enabled'=>'1', 'position'=>55, 'notnull'=>1, 'visible'=>1, 'default'=>0), - 'fk_job' => array('type'=>'integer:Job:/hrm/class/job.class.php', 'label'=>'Job', 'enabled'=>'1', 'position'=>56, 'notnull'=>1, 'visible'=>1,), + 'fk_job' => array('type'=>'integer:Job:/hrm/class/job.class.php', 'label'=>'JobPosition', 'enabled'=>'1', 'position'=>56, 'notnull'=>1, 'visible'=>1,), 'date_start' => array('type'=>'date', 'label'=>'DateStart', 'enabled'=>'1', 'position'=>51, 'notnull'=>1, 'visible'=>1,), 'date_end' => array('type'=>'date', 'label'=>'DateEnd', 'enabled'=>'1', 'position'=>52, 'notnull'=>0, 'visible'=>1,), - 'abort_comment' => array('type'=>'varchar(255)', 'label'=>'AbandonmentComment', 'enabled'=>'1', 'position'=>502, 'notnull'=>0, 'visible'=>1,), + 'abort_comment' => array('type'=>'varchar(255)', 'label'=>'AbandonmentComment', 'enabled'=>'getDolGlobalInt("HRM_JOB_POSITON_ENDING_COMMENT")', 'position'=>502, 'notnull'=>0, 'visible'=>1,), 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>70, 'notnull'=>0, 'visible'=>0,), 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>'1', 'position'=>71, 'notnull'=>0, 'visible'=>0,), 'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>'1', 'position'=>510, 'notnull'=>1, 'visible'=>-2, 'foreignkey'=>'user.rowid',), diff --git a/htdocs/hrm/core/tpl/objectline_title.tpl.php b/htdocs/hrm/core/tpl/objectline_title.tpl.php index 3801288543a..ae835ea2bca 100644 --- a/htdocs/hrm/core/tpl/objectline_title.tpl.php +++ b/htdocs/hrm/core/tpl/objectline_title.tpl.php @@ -65,7 +65,7 @@ print ''.$langs->trans('Label').''; print ''.$langs->trans('Description').''; // Note -print ''.$langs->trans('EmployeeRank').''; +print ''.$form->textwithpicto($langs->trans("Level"), $langs->trans('EmployeeRank')).''; //print ''; // No width to allow autodim diff --git a/htdocs/hrm/evaluation_agenda.php b/htdocs/hrm/evaluation_agenda.php index a6c6c2a9406..732b91d756f 100644 --- a/htdocs/hrm/evaluation_agenda.php +++ b/htdocs/hrm/evaluation_agenda.php @@ -158,7 +158,7 @@ if ($object->id > 0) { $morehtmlref .= '
'.$langs->trans('Employee').' : '.$u_position->getNomUrl(1); $job = new Job($db); $job->fetch($object->fk_job); - $morehtmlref .= '
'.$langs->trans('Job').' : '.$job->getNomUrl(1); + $morehtmlref .= '
'.$langs->trans('JobPosition').' : '.$job->getNomUrl(1); $morehtmlref .= ''; diff --git a/htdocs/hrm/evaluation_card.php b/htdocs/hrm/evaluation_card.php index 9f9b937a467..08854e2d88e 100644 --- a/htdocs/hrm/evaluation_card.php +++ b/htdocs/hrm/evaluation_card.php @@ -94,7 +94,9 @@ $upload_dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->enti //if ($user->socid > 0) $socid = $user->socid; //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); //restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -if (empty($conf->hrm->enabled)) accessforbidden(); +if (!isModEnabled("hrm")) { + accessforbidden(); +} if (!$permissiontoread || ($action === 'create' && !$permissiontoadd)) accessforbidden(); @@ -283,11 +285,7 @@ if ($action == 'create') { print dol_get_fiche_end(); - print '
'; - print ''; - print '  '; - print ''; // Cancel for create does not post form if we don't know the backtopage - print '
'; + print $form->buttonsSaveCancel("Create", "Cancel"); print ''; } @@ -321,9 +319,7 @@ if (($id || $ref) && $action == 'edit') { print dol_get_fiche_end(); - print '
'; - print '   '; - print '
'; + print $form->buttonsSaveCancel(); print ''; } @@ -381,8 +377,10 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneAsk', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); } - // Confirmation of action xxxx + // Confirmation of action xxxx (You can use it for xxx = 'close', xxx = 'reopen', ...) if ($action == 'xxx') { + $text = $langs->trans('ConfirmActionMyObject', $object->ref); + $formquestion = array(); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220); @@ -412,7 +410,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $morehtmlref .= '
'.$langs->trans('Employee').' : '.$u_position->getNomUrl(1); $job = new Job($db); $job->fetch($object->fk_job); - $morehtmlref .= '
'.$langs->trans('Job').' : '.$job->getNomUrl(1); + $morehtmlref .= '
'.$langs->trans('JobPosition').' : '.$job->getNomUrl(1); $morehtmlref .= ''; @@ -446,11 +444,16 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea * Lines */ - if (!empty($object->table_element_line)) { - if ($object->status == Evaluation::STATUS_DRAFT) { - $result = $object->getLinesArray(); + if (!empty($object->table_element_line) && $object->status == Evaluation::STATUS_DRAFT) { + // Show object lines + $result = $object->getLinesArray(); + if ($result < 0) { + dol_print_error($db, $object->error, $object->errors); + } - print '
+ print '
'; + + print ' @@ -458,46 +461,44 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea '; - if (!empty($conf->use_javascript_ajax) && $object->status == 0) { - include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; - } - - print '
'; - /*if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) { - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - }*/ - - - if (!empty($object->lines)) { - $conf->modules_parts['tpl']['hrm']='/hrm/core/tpl/'; // Pour utilisation du tpl hrm sur cet Ʃcran - print '
'.$langs->trans('Skill').''.$langs->trans('Description').''.$langs->trans('Rank').'
'; - $object->printObjectLines($action, $mysoc, null, GETPOST('lineid', 'int'), 1, ''); - print '
'; - } - - - - if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) { - print ''; - - if ($object->status == $object::STATUS_DRAFT && $permissiontoadd) { - print '
'; - print ''; - print '
'; - } - } - - - print '
'; - - print "
\n"; - print "
"; + if (!empty($conf->use_javascript_ajax) && $object->status == 0) { + include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; } + + $conf->modules_parts['tpl']['hrm']='/hrm/core/tpl/'; // Pour utilisation du tpl hrm sur cet Ʃcran + + print '
'; + if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) { + print ''; + } + + //if (!empty($object->lines)) { + $object->printObjectLines($action, $mysoc, null, GETPOST('lineid', 'int'), 1); + //} + + // Form to add new line + /* + if ($object->status == 0 && $permissiontoadd && $action != 'selectlines') { + if ($action != 'editline') { + // Add products/services form + + $parameters = array(); + $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + if (empty($reshook)) + $object->formAddObjectLine(1, $mysoc, $soc); + } + } + */ + + if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) { + print '
'; + } + print '
'; + + print "\n"; + + print "
"; } // list of comparison diff --git a/htdocs/hrm/evaluation_contact.php b/htdocs/hrm/evaluation_contact.php index 1c1d9ed26fd..4ea2e8e81be 100644 --- a/htdocs/hrm/evaluation_contact.php +++ b/htdocs/hrm/evaluation_contact.php @@ -31,8 +31,9 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; -require_once DOL_DOCUMENT_ROOT . '/hrm/class/evaluation.class.php'; -require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_evaluation.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/hrm/class/evaluation.class.php'; +require_once DOL_DOCUMENT_ROOT.'/hrm/lib/hrm_evaluation.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/hrm/class/job.class.php'; // Load translation files required by the page $langs->loadLangs(array('hrm', 'companies', 'other', 'mails')); @@ -138,43 +139,13 @@ if ($object->id) { $linkback = ''.$langs->trans("BackToList").''; $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); - // Thirdparty - $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : ''); - // Project - if (isModEnabled('project')) - { - $langs->load("projects"); - $morehtmlref.='
'.$langs->trans('Project') . ' '; - if ($permissiontoadd) - { - 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); - } - } else { - if (!empty($object->fk_project)) { - $proj = new Project($db); - $proj->fetch($object->fk_project); - $morehtmlref .= ': '.$proj->getNomUrl(); - } else { - $morehtmlref .= ''; - } - } - }*/ + $morehtmlref .= $langs->trans('Label').' : '.$object->label; + $u_position = new User(($db)); + $u_position->fetch($object->fk_user); + $morehtmlref .= '
'.$langs->trans('Employee').' : '.$u_position->getNomUrl(1); + $job = new Job($db); + $job->fetch($object->fk_job); + $morehtmlref .= '
'.$langs->trans('JobPosition').' : '.$job->getNomUrl(1); $morehtmlref .= '
'; dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); diff --git a/htdocs/hrm/evaluation_document.php b/htdocs/hrm/evaluation_document.php index 23f9d260f0f..84bc6023291 100644 --- a/htdocs/hrm/evaluation_document.php +++ b/htdocs/hrm/evaluation_document.php @@ -33,9 +33,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; 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/class/html.formfile.class.php'; -require_once DOL_DOCUMENT_ROOT . '/hrm/class/evaluation.class.php'; -require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_evaluation.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/hrm/class/job.class.php'; +require_once DOL_DOCUMENT_ROOT.'/hrm/class/evaluation.class.php'; +require_once DOL_DOCUMENT_ROOT.'/hrm/lib/hrm_evaluation.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/hrm/class/job.class.php'; // Load translation files required by the page $langs->loadLangs(array('hrm', 'companies', 'other', 'mails')); @@ -138,7 +138,7 @@ if ($object->id) { $morehtmlref .= '
'.$langs->trans('Employee').' : '.$u_position->getNomUrl(1); $job = new Job($db); $job->fetch($object->fk_job); - $morehtmlref .= '
'.$langs->trans('Job').' : '.$job->getNomUrl(1); + $morehtmlref .= '
'.$langs->trans('JobPosition').' : '.$job->getNomUrl(1); $morehtmlref .= ''; dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/hrm/evaluation_list.php b/htdocs/hrm/evaluation_list.php index f475cef7af7..cf3272b894e 100644 --- a/htdocs/hrm/evaluation_list.php +++ b/htdocs/hrm/evaluation_list.php @@ -54,6 +54,7 @@ $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') $id = GETPOST('id', 'int'); +$ref = GETPOST('ref', 'alpha'); // Load variable for pagination $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; diff --git a/htdocs/hrm/evaluation_note.php b/htdocs/hrm/evaluation_note.php index 5c02b533bb7..ff0921cc59e 100644 --- a/htdocs/hrm/evaluation_note.php +++ b/htdocs/hrm/evaluation_note.php @@ -113,7 +113,7 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= '
'.$langs->trans('Employee').' : '.$u_position->getNomUrl(1); $job = new Job($db); $job->fetch($object->fk_job); - $morehtmlref .= '
'.$langs->trans('Job').' : '.$job->getNomUrl(1); + $morehtmlref .= '
'.$langs->trans('JobPosition').' : '.$job->getNomUrl(1); $morehtmlref .= ''; diff --git a/htdocs/hrm/position_list.php b/htdocs/hrm/position_list.php index e79af867a74..739dc8bee02 100644 --- a/htdocs/hrm/position_list.php +++ b/htdocs/hrm/position_list.php @@ -54,6 +54,7 @@ $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') $id = GETPOST('id', 'int'); +$ref = GETPOST('ref', 'alpha'); // Load variable for pagination $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; @@ -115,11 +116,11 @@ $arrayfields = array(); foreach ($object->fields as $key => $val) { // If $val['visible']==0, then we never show the field if (!empty($val['visible'])) { - $visible = (int) dol_eval($val['visible'], 1, 1, '1'); + $visible = (int) dol_eval($val['visible'], 1); $arrayfields['t.'.$key] = array( 'label'=>$val['label'], 'checked'=>(($visible < 0) ? 0 : 1), - 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1, 1, '1')), + 'enabled'=>(abs($visible) != 3 && dol_eval($val['enabled'], 1)), 'position'=>$val['position'], 'help'=> isset($val['help']) ? $val['help'] : '' ); @@ -136,18 +137,15 @@ $permissiontoread = $user->rights->hrm->all->read; $permissiontoadd = $user->rights->hrm->all->write; $permissiontodelete = $user->rights->hrm->all->delete; -// Security check -if (empty($conf->hrm->enabled)) { - accessforbidden('Module not enabled'); -} - // Security check (enable the most restrictive one) if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) accessforbidden(); //$socid = 0; if ($user->socid > 0) $socid = $user->socid; //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); //restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -if (empty($conf->hrm->enabled)) accessforbidden(); +if (!isModEnabled('hrm')) { + accessforbidden('Module hrm not enabled'); +} if (!$permissiontoread) accessforbidden(); @@ -250,23 +248,23 @@ foreach ($search as $key => $val) { } $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0); if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) { - if ($search[$key] == '-1' || $search[$key] === '0') { + if ($search[$key] == '-1' || ($search[$key] === '0' && (empty($object->fields[$key]['arrayofkeyval']) || !array_key_exists('0', $object->fields[$key]['arrayofkeyval'])))) { $search[$key] = ''; } $mode_search = 2; } if ($search[$key] != '') { - $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search)); + $sql .= natural_search("t.".$db->escape($key), $search[$key], (($key == 'status') ? 2 : $mode_search)); } } else { if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') { $columnName=preg_replace('/(_dtstart|_dtend)$/', '', $key); if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) { if (preg_match('/_dtstart$/', $key)) { - $sql .= " AND t." . $columnName . " >= '" . $db->idate($search[$key]) . "'"; + $sql .= " AND t.".$db->escape($columnName)." >= '".$db->idate($search[$key])."'"; } if (preg_match('/_dtend$/', $key)) { - $sql .= " AND t." . $columnName . " <= '" . $db->idate($search[$key]) . "'"; + $sql .= " AND t.".$db->escape($columnName)." <= '".$db->idate($search[$key])."'"; } } } @@ -290,7 +288,7 @@ $sql .= $hookmanager->resPrint; /* If a group by is required $sql .= " GROUP BY "; foreach($object->fields as $key => $val) { - $sql .= "t.".$key.", "; + $sql .= "t.".$db->escape($key).", "; } // Add fields from extrafields if (!empty($extrafields->attributes[$object->table_element]['label'])) { @@ -305,8 +303,6 @@ $sql .= $hookmanager->resPrint; $sql = preg_replace('/,\s*$/', '', $sql); */ -$sql .= $db->order($sortfield, $sortorder); - // Count total nb of records $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { @@ -316,24 +312,24 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $page = 0; $offset = 0; } + $db->free($resql); } -// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set. -if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) { - $num = $nbtotalofrecords; -} else { - if ($limit) { - $sql .= $db->plimit($limit + 1, $offset); - } - $resql = $db->query($sql); - if (!$resql) { - dol_print_error($db); - exit; - } - - $num = $db->num_rows($resql); +// Complete request and execute it with limit +$sql .= $db->order($sortfield, $sortorder); +if ($limit) { + $sql .= $db->plimit($limit + 1, $offset); } +$resql = $db->query($sql); +if (!$resql) { + dol_print_error($db); + exit; +} + +$num = $db->num_rows($resql); + + // Direct jump if only one record found if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) { $obj = $db->fetch_object($resql); @@ -366,6 +362,9 @@ llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', ''); $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; +if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); +} if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -374,11 +373,17 @@ if ($limit > 0 && $limit != $conf->liste_limit) { } foreach ($search as $key => $val) { - if (is_array($search[$key]) && count($search[$key])) { + if (is_array($search[$key])) { foreach ($search[$key] as $skey) { - $param .= '&search_'.$key.'[]='.urlencode($skey); + if ($skey != '') { + $param .= '&search_'.$key.'[]='.urlencode($skey); + } } - } else { + } elseif (preg_match('/(_dtstart|_dtend)$/', $key) && !empty($val)) { + $param .= '&search_'.$key.'month='.((int) GETPOST('search_'.$key.'month', 'int')); + $param .= '&search_'.$key.'day='.((int) GETPOST('search_'.$key.'day', 'int')); + $param .= '&search_'.$key.'year='.((int) GETPOST('search_'.$key.'year', 'int')); + } elseif ($search[$key] != '') { $param .= '&search_'.$key.'='.urlencode($search[$key]); } } @@ -399,7 +404,7 @@ $arrayofmassactions = array( //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), ); -if ($permissiontodelete) { +if (!empty($permissiontodelete)) { $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); } if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) { @@ -418,6 +423,7 @@ print ''; print ''; print ''; print ''; +print ''; $newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/hrm/position.php', 1).'?action=create', '', $permissiontoadd); @@ -431,9 +437,12 @@ $trackid = 'xxxx'.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($search_all) { + $setupstring = ''; foreach ($fieldstosearchall as $key => $val) { $fieldstosearchall[$key] = $langs->trans($val); + $setupstring .= $key."=".$val.";"; } + print ''."\n"; print '
'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'
'; } @@ -457,7 +466,7 @@ if (!empty($moreforfilter)) { } $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; -$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields +$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table @@ -467,7 +476,15 @@ print ''; +// Action column +if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; +} foreach ($object->fields as $key => $val) { + $searchkey = empty($search[$key]) ? '' : $search[$key]; $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); if ($key == 'status') { $cssforfield .= ($cssforfield ? ' ' : '').'center'; @@ -475,7 +492,7 @@ foreach ($object->fields as $key => $val) { $cssforfield .= ($cssforfield ? ' ' : '').'center'; } elseif (in_array($val['type'], array('timestamp'))) { $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { + } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'rowid' && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { $cssforfield .= ($cssforfield ? ' ' : '').'right'; } if (!empty($arrayfields['t.'.$key]['checked'])) { @@ -483,9 +500,7 @@ foreach ($object->fields as $key => $val) { if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) { print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1); } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) { - print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', 'maxwidth125', 1); - } elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) { - print ''; + print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth250', 1); } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) { print '
'; print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); @@ -493,6 +508,12 @@ foreach ($object->fields as $key => $val) { print '
'; print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); print '
'; + } elseif ($key == 'lang') { + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; + $formadmin = new FormAdmin($db); + print $formadmin->select_language($search[$key], 'search_lang', 0, null, 1, 0, 0, 'minwidth150 maxwidth200', 2); + } else { + print ''; } print ''; } @@ -505,16 +526,23 @@ $parameters = array('arrayfields'=>$arrayfields); $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column -print '
'; +if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; +} print ''."\n"; +$totalarray = array(); +$totalarray['nbfield'] = 0; // Fields title label // -------------------------------------------------------------------- print ''; +if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; +} foreach ($object->fields as $key => $val) { $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); if ($key == 'status') { @@ -523,21 +551,26 @@ foreach ($object->fields as $key => $val) { $cssforfield .= ($cssforfield ? ' ' : '').'center'; } elseif (in_array($val['type'], array('timestamp'))) { $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { + } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'rowid' && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { $cssforfield .= ($cssforfield ? ' ' : '').'right'; } + $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label if (!empty($arrayfields['t.'.$key]['checked'])) { print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n"; + $totalarray['nbfield']++; } } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields -$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); +$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column -print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; +if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; +} +$totalarray['nbfield']++; print ''."\n"; @@ -555,9 +588,11 @@ if (isset($extrafields->attributes[$object->table_element]['computed']) && is_ar // Loop on record // -------------------------------------------------------------------- $i = 0; +$savnbfield = $totalarray['nbfield']; $totalarray = array(); $totalarray['nbfield'] = 0; -while ($i < ($limit ? min($num, $limit) : $num)) { +$imaxinloop = ($limit ? min($num, $limit) : $num); +while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); if (empty($obj)) { break; // Should not happen @@ -566,75 +601,107 @@ while ($i < ($limit ? min($num, $limit) : $num)) { // Store properties in $object $object->setVarsFromFetchObj($obj); - // Show here line of result - print ''; - foreach ($object->fields as $key => $val) { - $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); - if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { - $cssforfield .= ($cssforfield ? ' ' : '').'center'; - } elseif ($key == 'status') { - $cssforfield .= ($cssforfield ? ' ' : '').'center'; + if ($mode == 'kanban') { + if ($i == 0) { + print ''; } - - if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) { - $cssforfield .= ($cssforfield ? ' ' : '').'right'; - } - //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; - - if (!empty($arrayfields['t.'.$key]['checked'])) { - print ''; - if ($key == 'status') { - print $object->getLibStatut(5); - } elseif ($key == 'rowid') { - print $object->getNomUrl(1); - } else { - print $object->showOutputField($val, $key, $object->$key, ''); + } else { + // Show here line of result + $j = 0; + print ''; + // Action column + if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; - if (!$i) { - $totalarray['nbfield']++; - } - if (!empty($val['isameasure']) && $val['isameasure'] == 1) { - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key; - } - if (!isset($totalarray['val'])) { - $totalarray['val'] = array(); - } - if (!isset($totalarray['val']['t.'.$key])) { - $totalarray['val']['t.'.$key] = 0; - } - $totalarray['val']['t.'.$key] += $object->$key; - } } - } - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; - // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - // Action column - print ''; - if (!$i) { - $totalarray['nbfield']++; - } + foreach ($object->fields as $key => $val) { + $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); + if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { + $cssforfield .= ($cssforfield ? ' ' : '').'center'; + } elseif ($key == 'status') { + $cssforfield .= ($cssforfield ? ' ' : '').'center'; + } - print ''."\n"; + if (in_array($val['type'], array('timestamp'))) { + $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + } elseif ($key == 'ref') { + $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + } + + if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) { + $cssforfield .= ($cssforfield ? ' ' : '').'right'; + } + //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; + + if (!empty($arrayfields['t.'.$key]['checked'])) { + print ''; + if ($key == 'status') { + print $object->getLibStatut(5); + } elseif ($key == 'rowid') { + print $object->showOutputField($val, $key, $object->id, ''); + } else { + print $object->showOutputField($val, $key, $object->$key, ''); + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + if (!empty($val['isameasure']) && $val['isameasure'] == 1) { + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key; + } + if (!isset($totalarray['val'])) { + $totalarray['val'] = array(); + } + if (!isset($totalarray['val']['t.'.$key])) { + $totalarray['val']['t.'.$key] = 0; + } + $totalarray['val']['t.'.$key] += $object->$key; + } + } + } + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + // Fields from hook + $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Action column + if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; + } + if (!$i) { + $totalarray['nbfield']++; + } + + print ''."\n"; + } $i++; } @@ -650,14 +717,14 @@ if ($num == 0) { $colspan++; } } - print ''; + print ''; } $db->free($resql); $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); -$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; print '
'; + $searchpicto = $form->showFilterButtons('left'); + print $searchpicto; + print ''; -$searchpicto = $form->showFilterButtons(); -print $searchpicto; -print ''; + $searchpicto = $form->showFilterButtons(); + print $searchpicto; + print '
'; + print '
'; } - - if (in_array($val['type'], array('timestamp'))) { - $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } elseif ($key == 'ref') { - $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + // Output Kanban + print $object->getKanbanView(''); + if ($i == ($imaxinloop - 1)) { + print '
'; + print '
'; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($object->id, $arrayofselected)) { + $selected = 1; + } + print ''; } print ''; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($object->id, $arrayofselected)) { - $selected = 1; - } - print ''; - } - print '
'; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($object->id, $arrayofselected)) { + $selected = 1; + } + print ''; + } + print '
'.$langs->trans("NoRecordFound").'
'.$langs->trans("NoRecordFound").'
'."\n"; diff --git a/htdocs/hrm/skill_list.php b/htdocs/hrm/skill_list.php index 664d54212a3..ddf385b170e 100644 --- a/htdocs/hrm/skill_list.php +++ b/htdocs/hrm/skill_list.php @@ -344,21 +344,6 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $ llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', ''); -// Example : Adding jquery code -// print ''; - $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; diff --git a/htdocs/index.php b/htdocs/index.php index c8c1a234f02..61a7d7f6d81 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -127,7 +127,7 @@ if ($user->admin && empty($conf->global->MAIN_REMOVE_INSTALL_WARNING)) { } if ($message) { - print $message; + print $message.'
'; //$message.='
'; //print info_admin($langs->trans("WarningUntilDirRemoved",DOL_DOCUMENT_ROOT."/install")); } diff --git a/htdocs/install/mysql/data/llx_c_email_templates.sql b/htdocs/install/mysql/data/llx_c_email_templates.sql index bce46a70e49..d2886631942 100644 --- a/htdocs/install/mysql/data/llx_c_email_templates.sql +++ b/htdocs/install/mysql/data/llx_c_email_templates.sql @@ -21,25 +21,26 @@ -- -- Bank Thirdparty -INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0, 'banque','thirdparty','',0,null,null,'(YourSEPAMandate)',1,'$conf->societe->enabled && $conf->banque->enabled && $conf->prelevement->enabled',0,'__(YourSEPAMandate)__','__(Hello)__,

\n\n__(FindYourSEPAMandate)__ :
\n__MYCOMPANY_NAME__
\n__MYCOMPANY_FULLADDRESS__

\n__(Sincerely)__
\n__USER_SIGNATURE__',null, 0); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0, 'banque','thirdparty','',0,null,null,'(YourSEPAMandate)',1,'isModEnabled("societe") && isModEnabled("banque") && isModEnabled("prelevement")',0,'__(YourSEPAMandate)__','__(Hello)__,

\n\n__(FindYourSEPAMandate)__ :
\n__MYCOMPANY_NAME__
\n__MYCOMPANY_FULLADDRESS__

\n__(Sincerely)__
\n__USER_SIGNATURE__',null, 0); -- Members -INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0, 'adherent','member','',0,null,null,'(SendingEmailOnAutoSubscription)' ,10,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourMembershipRequestWasReceived)__','__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(ThisIsContentOfYourMembershipRequestWasReceived)__
\n
__ONLINE_PAYMENT_TEXT_AND_URL__
\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); -INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0, 'adherent','member','',0,null,null,'(SendingEmailOnMemberValidation)' ,20,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourMembershipWasValidated)__', '__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(ThisIsContentOfYourMembershipWasValidated)__
__(FirstName)__ : __MEMBER_FIRSTNAME__
__(LastName)__ : __MEMBER_LASTNAME__
__(ID)__ : __MEMBER_ID__
\n
__ONLINE_PAYMENT_TEXT_AND_URL__
\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); -INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0, 'adherent','member','',0,null,null,'(SendingEmailOnNewSubscription)' ,30,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourSubscriptionWasRecorded)__', '__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(ThisIsContentOfYourSubscriptionWasRecorded)__
\n\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 1); -INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0, 'adherent','member','',0,null,null,'(SendingReminderForExpiredSubscription)',40,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(SubscriptionReminderEmail)__', '__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(ThisIsContentOfSubscriptionReminderEmail)__
\n
__ONLINE_PAYMENT_TEXT_AND_URL__
\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); -INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0, 'adherent','member','',0,null,null,'(SendingEmailOnCancelation)' ,50,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourMembershipWasCanceled)__', '__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(YourMembershipWasCanceled)__
\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); -INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0, 'adherent','member','',0,null,null,'(SendingAnEMailToMember)' ,60,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(CardContent)__', '__(Hello)__,

\n\n__(ThisIsContentOfYourCard)__
\n__(ID)__ : __ID__
\n__(Civility)__ : __MEMBER_CIVILITY__
\n__(Firstname)__ : __MEMBER_FIRSTNAME__
\n__(Lastname)__ : __MEMBER_LASTNAME__
\n__(Fullname)__ : __MEMBER_FULLNAME__
\n__(Company)__ : __MEMBER_COMPANY__
\n__(Address)__ : __MEMBER_ADDRESS__
\n__(Zip)__ : __MEMBER_ZIP__
\n__(Town)__ : __MEMBER_TOWN__
\n__(Country)__ : __MEMBER_COUNTRY__
\n__(Email)__ : __MEMBER_EMAIL__
\n__(Birthday)__ : __MEMBER_BIRTH__
\n__(Photo)__ : __MEMBER_PHOTO__
\n__(Login)__ : __MEMBER_LOGIN__
\n__(Phone)__ : __MEMBER_PHONE__
\n__(PhonePerso)__ : __MEMBER_PHONEPRO__
\n__(PhoneMobile)__ : __MEMBER_PHONEMOBILE__

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0, 'adherent','member','',0,null,null,'(SendingEmailOnAutoSubscription)' ,10, 'isModEnabled("adherent")',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourMembershipRequestWasReceived)__','__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(ThisIsContentOfYourMembershipRequestWasReceived)__
\n
__ONLINE_PAYMENT_TEXT_AND_URL__
\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0, 'adherent','member','',0,null,null,'(SendingEmailOnMemberValidation)' ,20, 'isModEnabled("adherent")',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourMembershipWasValidated)__', '__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(ThisIsContentOfYourMembershipWasValidated)__
__(FirstName)__ : __MEMBER_FIRSTNAME__
__(LastName)__ : __MEMBER_LASTNAME__
__(ID)__ : __MEMBER_ID__
\n
__ONLINE_PAYMENT_TEXT_AND_URL__
\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0, 'adherent','member','',0,null,null,'(SendingEmailOnNewSubscription)' ,30, 'isModEnabled("adherent")',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourSubscriptionWasRecorded)__', '__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(ThisIsContentOfYourSubscriptionWasRecorded)__
\n\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 1); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0, 'adherent','member','',0,null,null,'(SendingReminderForExpiredSubscription)',40, 'isModEnabled("adherent")',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(SubscriptionReminderEmail)__', '__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(ThisIsContentOfSubscriptionReminderEmail)__
\n
__ONLINE_PAYMENT_TEXT_AND_URL__
\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0, 'adherent','member','',0,null,null,'(SendingEmailOnCancelation)' ,50, 'isModEnabled("adherent")',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourMembershipWasCanceled)__', '__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(YourMembershipWasCanceled)__
\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0, 'adherent','member','',0,null,null,'(SendingAnEMailToMember)' ,60, 'isModEnabled("adherent")',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(CardContent)__', '__(Hello)__,

\n\n__(ThisIsContentOfYourCard)__
\n__(ID)__ : __ID__
\n__(Civility)__ : __MEMBER_CIVILITY__
\n__(Firstname)__ : __MEMBER_FIRSTNAME__
\n__(Lastname)__ : __MEMBER_LASTNAME__
\n__(Fullname)__ : __MEMBER_FULLNAME__
\n__(Company)__ : __MEMBER_COMPANY__
\n__(Address)__ : __MEMBER_ADDRESS__
\n__(Zip)__ : __MEMBER_ZIP__
\n__(Town)__ : __MEMBER_TOWN__
\n__(Country)__ : __MEMBER_COUNTRY__
\n__(Email)__ : __MEMBER_EMAIL__
\n__(Birthday)__ : __MEMBER_BIRTH__
\n__(Photo)__ : __MEMBER_PHOTO__
\n__(Login)__ : __MEMBER_LOGIN__
\n__(Phone)__ : __MEMBER_PHONE__
\n__(PhonePerso)__ : __MEMBER_PHONEPRO__
\n__(PhoneMobile)__ : __MEMBER_PHONEMOBILE__

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); -- Recruiting -INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0, 'recruitment','recruitmentcandidature_send','',0,null,null,'(AnswerCandidature)' ,100,'$conf->recruitment->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourCandidature)__', '__(Hello)__ __CANDIDATE_FULLNAME__,

\n\n__(YourCandidatureAnswerMessage)__
__ONLINE_INTERVIEW_SCHEDULER_TEXT_AND_URL__\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0, 'recruitment','recruitmentcandidature_send','',0,null,null,'(AnswerCandidature)' ,100,'isModEnabled("recruitment")',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourCandidature)__', '__(Hello)__ __CANDIDATE_FULLNAME__,

\n\n__(YourCandidatureAnswerMessage)__
__ONLINE_INTERVIEW_SCHEDULER_TEXT_AND_URL__\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); -- Event organization INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailAskConf)', 10, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailAskConf)__', '__(Hello)__,

__(OrganizationEventConfRequestWasReceived)__


__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailAskBooth)', 20, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailAskBooth)__', '__(Hello)__,

__(OrganizationEventBoothRequestWasReceived)__


__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); -- TODO Add message for registration only to event __ONLINE_PAYMENT_TEXT_AND_URL__ -INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailSubsBooth)', 30, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailBoothPayment)__', '__(Hello)__,

__(OrganizationEventPaymentOfBoothWasReceived)__


__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); -INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailSubsEvent)', 40, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailRegistrationPayment)__', '__(Hello)__,

__(OrganizationEventPaymentOfRegistrationWasReceived)__

__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailBoothPayment)', 30, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailBoothPayment)__', '__(Hello)__,

__(OrganizationEventPaymentOfBoothWasReceived)__


__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailRegistrationPayment)', 40, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailRegistrationPayment)__', '__(Hello)__,

__(OrganizationEventPaymentOfRegistrationWasReceived)__

__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); +-- INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationMassEmailAttendees)', 50, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailAttendees)__', '__(Hello)__,

__(OrganizationEventBulkMailToAttendees)__

__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationMassEmailSpeakers)', 60, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailSpeakers)__', '__(Hello)__,

__(OrganizationEventBulkMailToSpeakers)__

__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); 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 acbcbf7b0d3..60803396be3 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 @@ -737,3 +737,34 @@ ALTER TABLE llx_loan_schedule ADD UNIQUE INDEX uk_loan_schedule_ref (fk_loan, da -- We need when upgrade 15 to 16 with Dolibarr v17+ for upgrade2 function migrate_user_photospath2() ALTER TABLE llx_user CHANGE COLUMN note note_private text; + + +-- Bank Thirdparty +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0, 'banque','thirdparty','',0,null,null,'(YourSEPAMandate)',1,'isModEnabled("societe") && isModEnabled("banque") && isModEnabled("prelevement")',0,'__(YourSEPAMandate)__','__(Hello)__,

\n\n__(FindYourSEPAMandate)__ :
\n__MYCOMPANY_NAME__
\n__MYCOMPANY_FULLADDRESS__

\n__(Sincerely)__
\n__USER_SIGNATURE__',null, 0); + +-- Members +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0, 'adherent','member','',0,null,null,'(SendingEmailOnAutoSubscription)' ,10, 'isModEnabled("adherent")',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourMembershipRequestWasReceived)__','__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(ThisIsContentOfYourMembershipRequestWasReceived)__
\n
__ONLINE_PAYMENT_TEXT_AND_URL__
\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0, 'adherent','member','',0,null,null,'(SendingEmailOnMemberValidation)' ,20, 'isModEnabled("adherent")',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourMembershipWasValidated)__', '__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(ThisIsContentOfYourMembershipWasValidated)__
__(FirstName)__ : __MEMBER_FIRSTNAME__
__(LastName)__ : __MEMBER_LASTNAME__
__(ID)__ : __MEMBER_ID__
\n
__ONLINE_PAYMENT_TEXT_AND_URL__
\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0, 'adherent','member','',0,null,null,'(SendingEmailOnNewSubscription)' ,30, 'isModEnabled("adherent")',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourSubscriptionWasRecorded)__', '__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(ThisIsContentOfYourSubscriptionWasRecorded)__
\n\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 1); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0, 'adherent','member','',0,null,null,'(SendingReminderForExpiredSubscription)',40, 'isModEnabled("adherent")',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(SubscriptionReminderEmail)__', '__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(ThisIsContentOfSubscriptionReminderEmail)__
\n
__ONLINE_PAYMENT_TEXT_AND_URL__
\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0, 'adherent','member','',0,null,null,'(SendingEmailOnCancelation)' ,50, 'isModEnabled("adherent")',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourMembershipWasCanceled)__', '__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(YourMembershipWasCanceled)__
\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0, 'adherent','member','',0,null,null,'(SendingAnEMailToMember)' ,60, 'isModEnabled("adherent")',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(CardContent)__', '__(Hello)__,

\n\n__(ThisIsContentOfYourCard)__
\n__(ID)__ : __ID__
\n__(Civility)__ : __MEMBER_CIVILITY__
\n__(Firstname)__ : __MEMBER_FIRSTNAME__
\n__(Lastname)__ : __MEMBER_LASTNAME__
\n__(Fullname)__ : __MEMBER_FULLNAME__
\n__(Company)__ : __MEMBER_COMPANY__
\n__(Address)__ : __MEMBER_ADDRESS__
\n__(Zip)__ : __MEMBER_ZIP__
\n__(Town)__ : __MEMBER_TOWN__
\n__(Country)__ : __MEMBER_COUNTRY__
\n__(Email)__ : __MEMBER_EMAIL__
\n__(Birthday)__ : __MEMBER_BIRTH__
\n__(Photo)__ : __MEMBER_PHOTO__
\n__(Login)__ : __MEMBER_LOGIN__
\n__(Phone)__ : __MEMBER_PHONE__
\n__(PhonePerso)__ : __MEMBER_PHONEPRO__
\n__(PhoneMobile)__ : __MEMBER_PHONEMOBILE__

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); + +-- Recruiting +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0, 'recruitment','recruitmentcandidature_send','',0,null,null,'(AnswerCandidature)' ,100,'isModEnabled("recruitment")',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourCandidature)__', '__(Hello)__ __CANDIDATE_FULLNAME__,

\n\n__(YourCandidatureAnswerMessage)__
__ONLINE_INTERVIEW_SCHEDULER_TEXT_AND_URL__\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); + +-- Event organization +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailAskConf)', 10, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailAskConf)__', '__(Hello)__,

__(OrganizationEventConfRequestWasReceived)__


__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailAskBooth)', 20, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailAskBooth)__', '__(Hello)__,

__(OrganizationEventBoothRequestWasReceived)__


__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); +-- TODO Add message for registration only to event __ONLINE_PAYMENT_TEXT_AND_URL__ +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailBoothPayment)', 30, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailBoothPayment)__', '__(Hello)__,

__(OrganizationEventPaymentOfBoothWasReceived)__


__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailRegistrationPayment)', 40, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailRegistrationPayment)__', '__(Hello)__,

__(OrganizationEventPaymentOfRegistrationWasReceived)__

__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); +-- +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationMassEmailAttendees)', 50, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailAttendees)__', '__(Hello)__,

__(OrganizationEventBulkMailToAttendees)__

__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationMassEmailSpeakers)', 60, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailSpeakers)__', '__(Hello)__,

__(OrganizationEventBulkMailToSpeakers)__

__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); + +-- Partnership +INSERT INTO llx_c_email_templates (entity, module, type_template, label, lang, position, topic, joinfiles, content) VALUES (0, 'partnership', 'partnership_send', '(SendingEmailOnPartnershipWillSoonBeCanceled)', '', 100, '[__[MAIN_INFO_SOCIETE_NOM]__] - __(YourPartnershipWillSoonBeCanceledTopic)__', 0, '\n

__(Hello)__,

\n__(YourPartnershipWillSoonBeCanceledContent)__

\n
\n\n
\n\n __(Sincerely)__
\n __[MAIN_INFO_SOCIETE_NOM]__
\n \n'); +INSERT INTO llx_c_email_templates (entity, module, type_template, label, lang, position, topic, joinfiles, content) VALUES (0, 'partnership', 'partnership_send', '(SendingEmailOnPartnershipCanceled)', '', 100, '[__[MAIN_INFO_SOCIETE_NOM]__] - __(YourPartnershipCanceledTopic)__', 0, '\n

__(Hello)__,

\n__(YourPartnershipCanceledContent)__

\n
\n\n
\n\n __(Sincerely)__
\n __[MAIN_INFO_SOCIETE_NOM]__
\n \n'); +INSERT INTO llx_c_email_templates (entity, module, type_template, label, lang, position, topic, joinfiles, content) VALUES (0, 'partnership', 'partnership_send', '(SendingEmailOnPartnershipRefused)', '', 100, '[__[MAIN_INFO_SOCIETE_NOM]__] - __(YourPartnershipRefusedTopic)__', 0, '\n

__(Hello)__,

\n__(YourPartnershipRefusedContent)__

\n
\n\n
\n\n __(Sincerely)__
\n __[MAIN_INFO_SOCIETE_NOM]__
\n \n'); +INSERT INTO llx_c_email_templates (entity, module, type_template, label, lang, position, topic, joinfiles, content) VALUES (0, 'partnership', 'partnership_send', '(SendingEmailOnPartnershipAccepted)', '', 100, '[__[MAIN_INFO_SOCIETE_NOM]__] - __(YourPartnershipAcceptedTopic)__', 0, '\n

__(Hello)__,

\n__(YourPartnershipAcceptedContent)__

\n
\n\n
\n\n __(Sincerely)__
\n __[MAIN_INFO_SOCIETE_NOM]__
\n \n'); 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 618e001b21c..f9eb9968f4f 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 @@ -195,3 +195,4 @@ ALTER TABLE llx_bank_url ADD INDEX idx_bank_url_url_id (url_id); ALTER TABLE llx_societe_remise_except ADD COLUMN multicurrency_code varchar(3) NULL; ALTER TABLE llx_societe_remise_except ADD COLUMN multicurrency_tx double(24,8) NULL; +ALTER TABLE llx_hrm_evaluationdet CHANGE COLUMN rank rankorder integer; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index b26761b3a49..a78c19f5dd9 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -646,9 +646,9 @@ Module2400Name=Events/Agenda Module2400Desc=Track events. Log automatic events for tracking purposes or record manual events or meetings. This is the principal module for good Customer or Vendor Relationship Management. Module2500Name=DMS / ECM Module2500Desc=Document Management System / Electronic Content Management. Automatic organization of your generated or stored documents. Share them when you need. -Module2600Name=API/Web services (SOAP server) +Module2600Name=API / Web services (SOAP server) Module2600Desc=Enable the Dolibarr SOAP server providing API services -Module2610Name=API/Web services (REST server) +Module2610Name=API / Web services (REST server) Module2610Desc=Enable the Dolibarr REST server providing API services Module2660Name=Call WebServices (SOAP client) Module2660Desc=Enable the Dolibarr web services client (Can be used to push data/requests to external servers. Only Purchase orders are currently supported.) @@ -2270,7 +2270,7 @@ LateWarningAfter="Late" warning after TemplateforBusinessCards=Template for a business card in different size InventorySetup= Inventory Setup ExportUseLowMemoryMode=Use a low memory mode -ExportUseLowMemoryModeHelp=Use the low memory mode to execute the exec of the dump (compression is done through a pipe instead of into the PHP memory). This method does not allow to check that file is completed and error message can't be reported if it fails. +ExportUseLowMemoryModeHelp=Use the low memory mode to generate the dump file (compression is done through a pipe instead of into the PHP memory). This method does not allow to check that the file is complete and error message can't be reported if it fails. Use it if you experience not enough memory errors. ModuleWebhookName = Webhook ModuleWebhookDesc = Interface to catch dolibarr triggers and send it to an URL @@ -2329,4 +2329,6 @@ HelpCssOnViewDesc=The Css used when viewing the field. HelpCssOnListDesc=The Css used when field is inside a list table.
Example: "tdoverflowmax200" RECEPTION_PDF_HIDE_ORDERED=Hide the quantity ordered on the generated documents for receptions MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT=Show the price on the generated documents for receptions -WarningDisabled=Warning disabled \ No newline at end of file +WarningDisabled=Warning disabled +LimitsAndMitigation=Access limits and mitigation + \ No newline at end of file diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 6ff5a63196a..860ae75e604 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -97,6 +97,7 @@ ErrorWrongValueForField=Field %s: '%s' does not match regex rule < ErrorHtmlInjectionForField=Field %s: The value '%s' contains a malicious data not allowed ErrorFieldValueNotIn=Field %s: '%s' is not a value found in field %s of %s ErrorFieldRefNotIn=Field %s: '%s' is not a %s existing ref +ErrorMultipleRecordFoundFromRef=Several record found when searching from ref %s. No way to know which ID to use. ErrorsOnXLines=%s errors found ErrorFileIsInfectedWithAVirus=The antivirus program was not able to validate the file (file might be infected by a virus) ErrorNumRefModel=A reference exists into database (%s) and is not compatible with this numbering rule. Remove record or renamed reference to activate this module. @@ -299,6 +300,7 @@ ErrorCharPlusNotSupportedByImapForSearch=IMAP search is not able to search into ErrorTableNotFound=Table %s not found ErrorValueForTooLow=Value for %s is too low ErrorValueCantBeNull=Value for %s can't be null +ErrorDateOfMovementLowerThanDateOfFileTransmission=The date of the bank transaction can't be lower than the date of the file transmission # Warnings WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup. diff --git a/htdocs/langs/en_US/hrm.lang b/htdocs/langs/en_US/hrm.lang index cbd3dc91663..966f2399a13 100644 --- a/htdocs/langs/en_US/hrm.lang +++ b/htdocs/langs/en_US/hrm.lang @@ -26,8 +26,8 @@ HRM_DEFAULT_SKILL_DESCRIPTION=Default description of ranks when skill is created deplacement=Shift DateEval=Evaluation date JobCard=Job card -JobPosition=Job -JobsPosition=Jobs +JobPosition=Job profile +JobsPosition=Job profiles NewSkill=New Skill SkillType=Skill type Skilldets=List of ranks for this skill diff --git a/htdocs/langs/en_US/languages.lang b/htdocs/langs/en_US/languages.lang index 78378c6c5d3..b6368a7d374 100644 --- a/htdocs/langs/en_US/languages.lang +++ b/htdocs/langs/en_US/languages.lang @@ -36,6 +36,7 @@ Language_en_SA=English (Saudi Arabia) Language_en_SG=English (Singapore) Language_en_US=English (United States) Language_en_ZA=English (South Africa) +Language_en_ZW=English (Zimbabwe) Language_es_ES=Spanish Language_es_AR=Spanish (Argentina) Language_es_BO=Spanish (Bolivia) diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index bf2dabf5a0a..fa2ed9669d9 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -399,7 +399,7 @@ ActionAvailableOnVariantProductOnly=Action only available on the variant of prod ProductsPricePerCustomer=Product prices per customers ProductSupplierExtraFields=Additional Attributes (Supplier Prices) DeleteLinkedProduct=Delete the child product linked to the combination -AmountUsedToUpdateWAP=Amount to use to update the Weighted Average Price +AmountUsedToUpdateWAP=Unit amount to use to update the Weighted Average Price PMPValue=Weighted average price PMPValueShort=WAP mandatoryperiod=Mandatory periods diff --git a/htdocs/langs/en_US/users.lang b/htdocs/langs/en_US/users.lang index c6b5c2fe106..3f2c7f5f53a 100644 --- a/htdocs/langs/en_US/users.lang +++ b/htdocs/langs/en_US/users.lang @@ -47,7 +47,7 @@ RemoveFromGroup=Remove from group PasswordChangedAndSentTo=Password changed and sent to %s. PasswordChangeRequest=Request to change password for %s PasswordChangeRequestSent=Request to change password for %s sent to %s. -IfLoginExistPasswordRequestSent=If this login is a valid account, an email to reset password has been sent. +IfLoginExistPasswordRequestSent=If this login is a valid account (with a valid email), an email to reset password has been sent. IfEmailExistPasswordRequestSent=If this email is a valid account, an email to reset password has been sent. ConfirmPasswordReset=Confirm password reset MenuUsersAndGroups=Users & Groups diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index e247b5fabb5..705dc202932 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -1780,7 +1780,7 @@ if ($dirins && $action == 'generatepackage') { dol_mkdir($dirofmodule); } // Note: We exclude /bin/ to not include the already generated zip - $result = dol_compress_dir($dir, $outputfilezip, 'zip', '/\/bin\//', $modulelowercase); + $result = dol_compress_dir($dir, $outputfilezip, 'zip', '/\/bin\/|\.git/', $modulelowercase); } else { $result = -1; } diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index 093a17aed94..95f10b5b90c 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -356,6 +356,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea }*/ $formquestion = array(); + /* $forcecombo=0; if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 009b7b7de3a..30ccdd22e44 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -136,7 +136,7 @@ if (!$sortorder) { } // Initialize array of search criterias -$search_all = GETPOST('search_all', 'alphanohtml'); +$search_all = GETPOST('search_all', 'alphanohtml') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'); $search = array(); foreach ($object->fields as $key => $val) { if (GETPOST('search_'.$key, 'alpha') !== '') { @@ -198,7 +198,7 @@ if ($user->socid > 0) accessforbidden(); //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); //restrictedArea($user, $object->element, 0, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); if (!isModEnabled("mymodule")) { - accessforbidden(); + accessforbidden('Module mymodule not enabled'); } if (!$permissiontoread) accessforbidden(); diff --git a/htdocs/mrp/mo_list.php b/htdocs/mrp/mo_list.php index 7f0cc15f873..f7a6ed88571 100644 --- a/htdocs/mrp/mo_list.php +++ b/htdocs/mrp/mo_list.php @@ -84,7 +84,7 @@ if (!$sortorder) { } // Initialize array of search criterias -$search_all = GETPOST('search_all', 'alphanohtml'); +$search_all = GETPOST('search_all', 'alphanohtml') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'); $search = array(); foreach ($object->fields as $key => $val) { if (GETPOST('search_'.$key, 'alpha') !== '') { @@ -230,8 +230,8 @@ $sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t"; if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)"; } -$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."mrp_production lineparent ON t.fk_parent_line = lineparent.rowid"; -$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."mrp_mo moparent ON lineparent.fk_mo = moparent.rowid"; +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."mrp_production as lineparent ON t.fk_parent_line = lineparent.rowid"; +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."mrp_mo as moparent ON lineparent.fk_mo = moparent.rowid"; // Add table from hooks $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook @@ -266,17 +266,17 @@ foreach ($search as $key => $val) { $mode_search = 2; } if ($search[$key] != '') { - $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search)); + $sql .= natural_search("t.".$db->escape($key), $search[$key], (($key == 'status') ? 2 : $mode_search)); } } else { if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') { $columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key); if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) { if (preg_match('/_dtstart$/', $key)) { - $sql .= " AND t.".$columnName." >= '".$db->idate($search[$key])."'"; + $sql .= " AND t.".$db->escape($columnName)." >= '".$db->idate($search[$key])."'"; } if (preg_match('/_dtend$/', $key)) { - $sql .= " AND t." . $columnName . " <= '" . $db->idate($search[$key]) . "'"; + $sql .= " AND t.".$db->escape($columnName)." <= '".$db->idate($search[$key])."'"; } } } diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index 24b3516684e..64ae11909ef 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -814,6 +814,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Lines to consume + $bomcostupdated = 0; // We will recalculate the unitary cost to produce a product using the real "products to consume into MO" + if (!empty($object->lines)) { $nblinetoconsume = 0; foreach ($object->lines as $line) { @@ -832,7 +834,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $linecost = price2num($tmpproduct->pmp, 'MT'); if ($object->qty > 0) { - // add free consume line cost to bomcost + // add free consume line cost to $bomcostupdated $costprice = price2num((!empty($tmpproduct->cost_price)) ? $tmpproduct->cost_price : $tmpproduct->pmp); if (empty($costprice)) { require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; @@ -843,12 +845,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $costprice = 0; } } - $linecost = price2num(($line->qty * $costprice) / $object->qty, 'MT'); - $bomcost += $linecost; + $linecost = price2num(($line->qty * $costprice) / $object->qty, 'MT'); // price for line for all quantities + $bomcostupdated += price2num(($line->qty * $costprice) / $object->qty, 'MU'); // same but with full accuracy } - $bomcost = price2num($bomcost, 'MU'); - + $bomcostupdated = price2num($bomcostupdated, 'MU'); $arrayoflines = $object->fetchLinesLinked('consumed', $line->id); $alreadyconsumed = 0; foreach ($arrayoflines as $line2) { @@ -1136,7 +1137,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''.$langs->trans("Product").''; print ''.$langs->trans("Qty").''; if ($permissiontoupdatecost) { - if (empty($bomcost)) { + if (empty($bomcostupdated)) { print ''.$form->textwithpicto($langs->trans("UnitCost"), $langs->trans("AmountUsedToUpdateWAP")).''; } else { print ''.$form->textwithpicto($langs->trans("ManufacturingPrice"), $langs->trans("AmountUsedToUpdateWAP")).''; @@ -1230,17 +1231,25 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($permissiontoupdatecost) { // Defined $manufacturingcost $manufacturingcost = 0; - if ($object->mrptype == 0) { // If MO is a "Manufacture" type (and not "Disassemble" - $manufacturingcost = $bomcost; + $manufacturingcostsrc = ''; + if ($object->mrptype == 0) { // If MO is a "Manufacture" type (and not "Disassemble") + $manufacturingcost = $bomcostupdated; + $manufacturingcostsrc = $langs->trans("CalculatedFromProductsToConsume"); + if (empty($manufacturingcost)) { + $manufacturingcost = $bomcost; + $manufacturingcostsrc = $langs->trans("ValueFromBom"); + } if (empty($manufacturingcost)) { $manufacturingcost = price2num($tmpproduct->cost_price, 'MU'); + $manufacturingcostsrc = $langs->trans("CostPrice"); } if (empty($manufacturingcost)) { $manufacturingcost = price2num($tmpproduct->pmp, 'MU'); + $manufacturingcostsrc = $langs->trans("PMPValue"); } } - print ''; + print ''; if ($manufacturingcost) { print price($manufacturingcost); } @@ -1344,19 +1353,27 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($permissiontoupdatecost) { // Defined $manufacturingcost $manufacturingcost = 0; - if ($object->mrptype == 0) { // If MO is a "Manufacture" type (and not "Disassemble" - $manufacturingcost = $bomcost; + $manufacturingcostsrc = ''; + if ($object->mrptype == 0) { // If MO is a "Manufacture" type (and not "Disassemble") + $manufacturingcost = $bomcostupdated; + $manufacturingcostsrc = $langs->trans("CalculatedFromProductsToConsume"); + if (empty($manufacturingcost)) { + $manufacturingcost = $bomcost; + $manufacturingcostsrc = $langs->trans("ValueFromBom"); + } if (empty($manufacturingcost)) { $manufacturingcost = price2num($tmpproduct->cost_price, 'MU'); + $manufacturingcostsrc = $langs->trans("CostPrice"); } if (empty($manufacturingcost)) { $manufacturingcost = price2num($tmpproduct->pmp, 'MU'); + $manufacturingcostsrc = $langs->trans("PMPValue"); } } if ($tmpproduct->type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { $preselected = (GETPOSTISSET('pricetoproduce-'.$line->id.'-'.$i) ? GETPOST('pricetoproduce-'.$line->id.'-'.$i) : ($manufacturingcost ? price($manufacturingcost) : '')); - print ''; + print ''; } else { print ''; } diff --git a/htdocs/product/inventory/class/inventory.class.php b/htdocs/product/inventory/class/inventory.class.php index 281d58ea99e..9acc4232490 100644 --- a/htdocs/product/inventory/class/inventory.class.php +++ b/htdocs/product/inventory/class/inventory.class.php @@ -104,10 +104,10 @@ class Inventory extends CommonObject 'fk_warehouse' => array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Warehouse', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'index'=>1, 'help'=>'InventoryForASpecificWarehouse', 'picto'=>'stock', 'css'=>'minwidth300 maxwidth500 widthcentpercentminusx', 'csslist'=>'tdoverflowmax200'), 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'get_name_url_params' => '0::0:-1:0::1', 'visible'=>1, 'enabled'=>1, 'position'=>32, 'index'=>1, 'help'=>'InventoryForASpecificProduct', 'picto'=>'product', 'css'=>'minwidth300 maxwidth500 widthcentpercentminusx', 'csslist'=>'tdoverflowmax200'), 'categories_product' => array('type'=>'chkbxlst:categorie:label:rowid::type=0:0:', 'label'=>'OrProductsWithCategories', 'visible'=>3, 'enabled'=>1, 'position'=>33, 'help'=>'', 'picto'=>'category', 'css'=>'minwidth300 maxwidth500 widthcentpercentminusx'), - 'date_inventory' => array('type'=>'date', 'label'=>'DateValue', 'visible'=>1, 'enabled'=>'$conf->global->STOCK_INVENTORY_ADD_A_VALUE_DATE', 'position'=>35), // This date is not used so disabled by default. - 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>500), - 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>501), - 'date_validation' => array('type'=>'datetime', 'label'=>'DateValidation', 'visible'=>-2, 'enabled'=>1, 'position'=>502), + 'date_inventory' => array('type'=>'date', 'label'=>'DateValue', 'visible'=>1, 'enabled'=>'$conf->global->STOCK_INVENTORY_ADD_A_VALUE_DATE', 'position'=>35, 'csslist'=>'nowraponall'), // This date is not used so disabled by default. + 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>500, 'csslist'=>'nowraponall'), + 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>501, 'csslist'=>'nowraponall'), + 'date_validation' => array('type'=>'datetime', 'label'=>'DateValidation', 'visible'=>-2, 'enabled'=>1, 'position'=>502, 'csslist'=>'nowraponall'), 'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>510, 'foreignkey'=>'user.rowid', 'csslist'=>'tdoverflowmax200'), 'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>511, 'csslist'=>'tdoverflowmax200'), 'fk_user_valid' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'visible'=>-2, 'enabled'=>1, 'position'=>512, 'csslist'=>'tdoverflowmax200'), diff --git a/htdocs/product/stock/tpl/stockcorrection.tpl.php b/htdocs/product/stock/tpl/stockcorrection.tpl.php index 40181167baa..69ae5eda5e0 100644 --- a/htdocs/product/stock/tpl/stockcorrection.tpl.php +++ b/htdocs/product/stock/tpl/stockcorrection.tpl.php @@ -109,7 +109,7 @@ if ($object->element == 'product') { if (empty($ident) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE)) { $ident = $conf->global->MAIN_DEFAULT_WAREHOUSE; } - print img_picto('', 'stock').$formproduct->selectWarehouses($ident, 'id_entrepot', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, null, 'minwidth100'); + print img_picto('', 'stock', 'class="pictofixedwidth"').$formproduct->selectWarehouses($ident, 'id_entrepot', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, null, 'minwidth100 maxwidth300 widthcentpercentminusx'); print ''; } if ($object->element == 'stock') { @@ -155,10 +155,11 @@ if (ismodEnabled('productbatch') && print ''; print ''; } else { - print ''; + print img_picto('', 'barcode', 'class="pictofixedwidth"').''; } print ''; print ''; + print ''; if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { print ''.$langs->trans("SellByDate").''; diff --git a/htdocs/product/stock/tpl/stocktransfer.tpl.php b/htdocs/product/stock/tpl/stocktransfer.tpl.php index 819fa404d52..7d08f2014a0 100644 --- a/htdocs/product/stock/tpl/stocktransfer.tpl.php +++ b/htdocs/product/stock/tpl/stocktransfer.tpl.php @@ -104,7 +104,7 @@ if (isModEnabled('productbatch') && print ''; print ''; } else { - print ''; + print img_picto('', 'barcode', 'class="pictofixedwidth"').''; } print ''; print ''; diff --git a/htdocs/public/payment/paymentko.php b/htdocs/public/payment/paymentko.php index 29adb2947d0..2504260cbc5 100644 --- a/htdocs/public/payment/paymentko.php +++ b/htdocs/public/payment/paymentko.php @@ -136,6 +136,10 @@ foreach ($_POST as $k => $v) { dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_payment'); +// Set $appli for emails title +$appli = $mysoc->name; + + if (!empty($_SESSION['ipaddress'])) { // To avoid to make action twice // Get on url call $fulltag = $FULLTAG; @@ -173,21 +177,6 @@ if (!empty($_SESSION['ipaddress'])) { // To avoid to make action twice $from = $conf->global->MAILING_EMAIL_FROM; $sendto = $sendemail; - // Define link to login card - $appli = constant('DOL_APPLICATION_TITLE'); - if (!empty($conf->global->MAIN_APPLICATION_TITLE)) { - $appli = $conf->global->MAIN_APPLICATION_TITLE; - if (preg_match('/\d\.\d/', $appli)) { - if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) { - $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core - } - } else { - $appli .= " ".DOL_VERSION; - } - } else { - $appli .= " ".DOL_VERSION; - } - $urlback = $_SERVER["REQUEST_URI"]; $topic = '['.$appli.'] '.$companylangs->transnoentitiesnoconv("NewOnlinePaymentFailed"); $content = ""; diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 4d1336351b3..c56732f5938 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -1266,7 +1266,7 @@ if ($ispaymentok) { $thirdparty = new Societe($db); $resultthirdparty = $thirdparty->fetch($attendeetovalidate->fk_soc); if ($resultthirdparty < 0) { - setEventMessages(null, $attendeetovalidate->errors, "errors"); + setEventMessages($resultthirdparty->error, $resultthirdparty->errors, "errors"); } else { require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; @@ -1289,11 +1289,10 @@ if ($ispaymentok) { $subject = $arraydefaultmessage->topic; $msg = $arraydefaultmessage->content; } else { - $subject = '['.$object->ref.' - '.$outputlangs->trans("NewRegistration").']'; + $subject = '['.$appli.'] '.$object->ref.' - '.$outputlangs->trans("NewRegistration").']'; $msg = $outputlangs->trans("OrganizationEventPaymentOfRegistrationWasReceived"); } - $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $thirdparty); complete_substitutions_array($substitutionarray, $outputlangs, $object); @@ -1301,6 +1300,13 @@ if ($ispaymentok) { $texttosend = make_substitutions($msg, $substitutionarray, $outputlangs); $sendto = $attendeetovalidate->email; + $cc = ''; + if ($thirdparty->email) { + $cc = $thirdparty->email; + } + if ($attendeetovalidate->email_company && $attendeetovalidate->email_company != $thirdparty->email) { + $cc = ($cc ? ', ' : '').$attendeetovalidate->email_company; + } $from = $conf->global->MAILING_EMAIL_FROM; $urlback = $_SERVER["REQUEST_URI"]; @@ -1321,7 +1327,7 @@ if ($ispaymentok) { $listofmimes = array(dol_mimetype($file)); } - $mailfile = new CMailFile($subjecttosend, $sendto, $from, $texttosend, $listofpaths, $listofmimes, $listofnames, '', '', 0, $ishtml); + $mailfile = new CMailFile($subjecttosend, $sendto, $from, $texttosend, $listofpaths, $listofmimes, $listofnames, $cc, '', 0, $ishtml); $result = $mailfile->sendfile(); if ($result) { @@ -1493,7 +1499,7 @@ if ($ispaymentok) { $subject = $arraydefaultmessage->topic; $msg = $arraydefaultmessage->content; } else { - $subject = '['.$booth->ref.' - '.$outputlangs->trans("NewRegistration").']'; + $subject = '['.$appli.'] '.$booth->ref.' - '.$outputlangs->trans("NewRegistration").']'; $msg = $outputlangs->trans("OrganizationEventPaymentOfBoothWasReceived"); } @@ -1542,6 +1548,11 @@ if ($ispaymentok) { } } + +// Set $appli for emails title +$appli = $mysoc->name; + + if ($ispaymentok) { // Get on url call $onlinetoken = empty($PAYPALTOKEN) ? $_SESSION['onlinetoken'] : $PAYPALTOKEN; @@ -1600,19 +1611,6 @@ if ($ispaymentok) { //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current // Define link to login card - $appli = constant('DOL_APPLICATION_TITLE'); - if (!empty($conf->global->MAIN_APPLICATION_TITLE)) { - $appli = $conf->global->MAIN_APPLICATION_TITLE; - if (preg_match('/\d\.\d/', $appli)) { - if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) { - $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core - } - } else { - $appli .= " ".DOL_VERSION; - } - } else { - $appli .= " ".DOL_VERSION; - } $urlback = $_SERVER["REQUEST_URI"]; $topic = '['.$appli.'] '.$companylangs->transnoentitiesnoconv("NewOnlinePaymentReceived"); @@ -1740,21 +1738,6 @@ if ($ispaymentok) { $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current - // Define link to login card - $appli = constant('DOL_APPLICATION_TITLE'); - if (!empty($conf->global->MAIN_APPLICATION_TITLE)) { - $appli = $conf->global->MAIN_APPLICATION_TITLE; - if (preg_match('/\d\.\d/', $appli)) { - if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) { - $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core - } - } else { - $appli .= " ".DOL_VERSION; - } - } else { - $appli .= " ".DOL_VERSION; - } - $urlback = $_SERVER["REQUEST_URI"]; $topic = '['.$appli.'] '.$companylangs->transnoentitiesnoconv("ValidationOfPaymentFailed"); $content = ""; diff --git a/htdocs/public/recruitment/view.php b/htdocs/public/recruitment/view.php index 24c0eaf6088..57cb82d9b08 100644 --- a/htdocs/public/recruitment/view.php +++ b/htdocs/public/recruitment/view.php @@ -94,7 +94,7 @@ if ($cancel) { $action = 'view'; } -if ($action == "view" || $action == "presend" || $action == "close" || $action == "confirm_public_close" || $action == "add_message") { +if ($action == "view" || $action == "presend" || $action == "dosubmit") { $error = 0; $display_ticket = false; if (!strlen($ref)) { @@ -119,11 +119,11 @@ if ($action == "view" || $action == "presend" || $action == "close" || $action = } /* - if (!$error && $action == "add_message" && $display_ticket && GETPOSTISSET('btn_add_message')) + if (!$error && $action == "dosubmit") { - // TODO Add message... - $ret = $object->newMessage($user, $action, 0, 1); + // Test MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS + // TODO Create job application @@ -136,7 +136,7 @@ if ($action == "view" || $action == "presend" || $action == "close" || $action = if ($error || $errors) { setEventMessages($object->error, $object->errors, 'errors'); - if ($action == "add_message") { + if ($action == "dosubmit") { $action = 'presend'; } else { $action = ''; @@ -185,7 +185,7 @@ print ''."\n"; print '
'."\n"; print '
'."\n"; print ''."\n"; -print ''."\n"; +print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 9c0ac895a55..30427202cc1 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -846,6 +846,9 @@ textarea.centpercent { .paddingleft { padding-: 4px; } +.paddingleftimp { + padding-: 4px !important; +} .paddingleft2 { padding-: 2px; } @@ -855,6 +858,9 @@ textarea.centpercent { .paddingright { padding-: 4px; } +.paddingrightimp { + padding-: 4px !important; +} .paddingright2 { padding-: 2px; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 346b683f83c..8f06afd20d8 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -997,6 +997,9 @@ textarea.centpercent { .paddingleft { padding-: 4px; } +.paddingleftimp { + padding-: 4px !important; +} .paddingleft2 { padding-: 2px; } @@ -1006,6 +1009,9 @@ textarea.centpercent { .paddingright { padding-: 4px; } +.paddingrightimp { + padding-: 4px !important; +} .paddingright2 { padding-: 2px; } diff --git a/htdocs/ticket/class/api_tickets.class.php b/htdocs/ticket/class/api_tickets.class.php index 2fd77693984..35e01a74f0d 100644 --- a/htdocs/ticket/class/api_tickets.class.php +++ b/htdocs/ticket/class/api_tickets.class.php @@ -246,6 +246,7 @@ class Tickets extends DolibarrApi $socid = DolibarrApiAccess::$user->socid; } + $search_sale = null; // If the internal user must only see his customers, force searching by him $search_sale = 0; if (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) { diff --git a/htdocs/user/passwordforgotten.php b/htdocs/user/passwordforgotten.php index eee3816ca67..658c45a3753 100644 --- a/htdocs/user/passwordforgotten.php +++ b/htdocs/user/passwordforgotten.php @@ -128,36 +128,34 @@ if (empty($reshook)) { $result = $edituser->fetch('', '', '', 1, -1, $username); } + // Set the message to show (must be the same if login/email exists or not + // to avoid to guess them. + $messagewarning = ''; + if ($result <= 0 && $edituser->error == 'USERNOTFOUND') { - $message = ''; + $message .= $messagewarning; $username = ''; } else { - if (!$edituser->email) { - $message = '
'.$langs->trans("ErrorLoginHasNoEmail").'
'; + if (empty($edituser->email)) { + $message .= $messagewarning; } else { $newpassword = $edituser->setPassword($user, '', 1); if ($newpassword < 0) { - // Failed + // Technical failure $message = '
'.$langs->trans("ErrorFailedToChangePassword").'
'; } else { // Success if ($edituser->send_password($user, $newpassword, 1) > 0) { - $message = ''; + $message .= $messagewarning; $username = ''; } else { + // Technical failure $message .= '
'.$edituser->error.'
'; } } diff --git a/test/phpunit/CodingSqlTest.php b/test/phpunit/CodingSqlTest.php index b04f6ed4737..bdcf381c8bb 100644 --- a/test/phpunit/CodingSqlTest.php +++ b/test/phpunit/CodingSqlTest.php @@ -193,7 +193,7 @@ class CodingSqlTest extends PHPUnit\Framework\TestCase $result=strpos($filecontent, '"'); if ($result) { - $result=(! strpos($filecontent, '["') && ! strpos($filecontent, '{"')); + $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.');