Merge branch 'develop' into patch-442

This commit is contained in:
Laurent Destailleur 2021-09-17 12:32:14 +02:00 committed by GitHub
commit 9784a8207c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
183 changed files with 2908 additions and 1315 deletions

View File

@ -2,6 +2,50 @@
English Dolibarr ChangeLog English Dolibarr ChangeLog
-------------------------------------------------------------- --------------------------------------------------------------
***** ChangeLog for 14.0.2 compared to 14.0.1 *****
FIX: #18353 Invoice list translation issue
FIX: #18375 SQL Error on tasks statistics
FIX: #18465
FIX: #18484
FIX: #18531
FIX: #18542 REST API: set global $user variable to DolibarrApiAccess::user.
FIX: #18544 Shipment REST API: load thirdparty object into the shipment before validating.
FIX: #18544 Shipment rest api: load thirdparty object when validating
FIX: #18565
FIX: #18589 #18617
FIX: #18591 : Remove double quotes of SQL Queries for postgresql compatibility
FIX: #18666 Order / Shipment list: Don't SQL JOIN category table when not necessary.
FIX: Accountancy - Some problems of length with general & subledger account
FIX: add DISTINCT
FIX: Add option $noescapecommand in executeCLI for better compatibility
FIX: Add token to remove error when removing widget
FIX: Add token when remove the last widget on home page
FIX: an approved holiday can be canceled by an admin.
FIX: better sql request
FIX: change LOG_DEBUG with LOG_WARNING in syslog and remove sql error in syslog (already done)
FIX: Collapsing of extrafields has disappeared.
FIX: Date of payment of subscription must not be set to 1970-01-01.
FIX: Export of website generates a package that contains a sql error
FIX: Field already present in SQL request
FIX: increase maxlength of password input
FIX: invoice fetch not found syslog debug level instead of error
FIX: Invoice list - Wrong name for column total_tva
FIX: invoice validation: when checking if any vat rate has a negative amount, prevent false positives with -1E-14 amounts
FIX: Manage credit note on situation invoice for calculate margin
FIX: Menu List of project was not visible.
FIX: migration script
FIX: multicompany transverse mode compatibility
FIX: option "Default value for field 'Refuse bulk emailings'"
FIX: Recommended session.cookie_samesite must be 'Lax' not 'Strict'.
FIX: Relative discount with high nb of decimals
FIX: salary extrafields don't work and table is not well named
FIX: Supplier invoice list - Wrong language key used
FIX: wrong table_element_line
FIX: wrong users count in multicompany transverse mode
FIX: #yogosha6944 Protection against traversal path.
***** ChangeLog for 14.0.1 compared to 14.0.0 ***** ***** ChangeLog for 14.0.1 compared to 14.0.0 *****
FIX: $conf->task used but it does not exist, use $conf->projet instead FIX: $conf->task used but it does not exist, use $conf->projet instead

View File

@ -4,10 +4,10 @@ This file contains some policies about the security reports on Dolibarr ERP CRM
## Supported Versions for security reports ## Supported Versions for security reports
| Version | Supported | | Version | Supported |
| --------- | ------------------ | | ---------- | ------------------ |
| <= 12.* | :x: | | <= 14.0.1 | :x: |
| >= 13.* | :white_check_mark: | | >= 14.0.2+ | :white_check_mark: |
## Reporting a Vulnerability ## Reporting a Vulnerability

View File

@ -239,10 +239,18 @@ fclose($fp);
if (empty($buildzip)) { if (empty($buildzip)) {
print "File ".$outputfile." generated\n"; print "File ".$outputfile." generated\n";
} else { } else {
$result = dol_compress_file($outputfile, $outputfile.'.zip'); if ($buildzip == '1' || $buildzip == 'zip') {
if ($result > 0) { $result = dol_compress_file($outputfile, $outputfile.'.zip', 'zip');
dol_delete_file($outputfile); if ($result > 0) {
print "File ".$outputfile.".zip generated\n"; dol_delete_file($outputfile);
print "File ".$outputfile.".zip generated\n";
}
} elseif ($buildzip == '2' || $buildzip == 'gz') {
$result = dol_compress_file($outputfile, $outputfile.'.gz', 'gz');
if ($result > 0) {
dol_delete_file($outputfile);
print "File ".$outputfile.".gz generated\n";
}
} }
} }

View File

@ -3,11 +3,26 @@
# #
# Use this sample to search into a ldap # Use this sample to search into a ldap
# #
# ldapsearch -h hostname -x
# ldapsearch -h hostname -x -b "ou=people,dc=teclib,dc=infra" # Anonymous access
# ldapsearch -h hostname -x -z 0 -b "o=somecompany.com" -D "cn=manager,o=somecompany.com" -w password "(objectclass=*)" # ldapsearch -h hostname -p 389
# ldapsearch -h hostname -x -b "o=somecompany.com" -D "cn=manager,o=somecompany.com" -w password "(objectclass=*)" #
# 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
#
# 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
# 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=*)"
# #
# Example to test a ldap search: # Example to test a ldap search:
# ldapsearch -h hostname -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

View File

@ -479,7 +479,7 @@ class AccountancyExport
/** /**
* Export format : CIEL (Format XIMPORT) * Export format : CIEL (Format XIMPORT)
* Format since 2003 compatible CIEL version > 2002 / Sage50 * Format since 2003 compatible CIEL version > 2002 / Sage50
* Last review for this format : 2021/07/28 Alexandre Spangaro (aspangaro@open-dsi.fr) * Last review for this format : 2021-09-13 Alexandre Spangaro (aspangaro@open-dsi.fr)
* *
* Help : https://sage50c.online-help.sage.fr/aide-technique/ * Help : https://sage50c.online-help.sage.fr/aide-technique/
* In sage software | Use menu : "Exchange" > "Importing entries..." * In sage software | Use menu : "Exchange" > "Importing entries..."
@ -507,7 +507,7 @@ class AccountancyExport
$Tab = array(); $Tab = array();
$Tab['num_ecriture'] = str_pad($data->piece_num, 5); $Tab['num_ecriture'] = str_pad($data->piece_num, 5);
$Tab['code_journal'] = str_pad($data->code_journal, 2); $Tab['code_journal'] = str_pad(self::trunc($data->code_journal, 2), 2);
$Tab['date_ecriture'] = str_pad($date_document, 8, ' ', STR_PAD_LEFT); $Tab['date_ecriture'] = str_pad($date_document, 8, ' ', STR_PAD_LEFT);
$Tab['date_echeance'] = str_pad($date_echeance, 8, ' ', STR_PAD_LEFT); $Tab['date_echeance'] = str_pad($date_echeance, 8, ' ', STR_PAD_LEFT);
$Tab['num_piece'] = str_pad(self::trunc($data->doc_ref, 12), 12); $Tab['num_piece'] = str_pad(self::trunc($data->doc_ref, 12), 12);
@ -515,9 +515,9 @@ class AccountancyExport
$Tab['libelle_ecriture'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref).dol_string_unaccent($data->label_operation), 25), 25); $Tab['libelle_ecriture'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref).dol_string_unaccent($data->label_operation), 25), 25);
$Tab['montant'] = str_pad(price2fec(abs($data->debit - $data->credit)), 13, ' ', STR_PAD_LEFT); $Tab['montant'] = str_pad(price2fec(abs($data->debit - $data->credit)), 13, ' ', STR_PAD_LEFT);
$Tab['type_montant'] = str_pad($data->sens, 1); $Tab['type_montant'] = str_pad($data->sens, 1);
$Tab['vide'] = str_repeat(' ', 18); $Tab['vide'] = str_repeat(' ', 18); // Analytical accounting - Not managed in Dolibarr
$Tab['intitule_compte'] = str_pad(self::trunc(dol_string_unaccent($data->label_operation), 34), 34); $Tab['intitule_compte'] = str_pad(self::trunc(dol_string_unaccent($data->label_operation), 34), 34);
$Tab['end'] = 'O2003'; $Tab['end'] = 'O2003'; // 0 = EUR | 2003 = Format Ciel
$Tab['end_line'] = $end_line; $Tab['end_line'] = $end_line;

View File

@ -260,13 +260,13 @@ $y = $year_current;
$buttonbind = '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?year='.$year_current.'&action=validatehistory">'.$langs->trans("ValidateHistory").'</a>'; $buttonbind = '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?year='.$year_current.'&action=validatehistory">'.$langs->trans("ValidateHistory").'</a>';
print_barre_liste($langs->trans("OverviewOfAmountOfLinesNotBound"), '', '', '', '', '', '', -1, '', '', 0, $buttonbind, '', 0, 1, 1); print_barre_liste(img_picto('', 'unlink', 'class="paddingright fa-color-unset"').$langs->trans("OverviewOfAmountOfLinesNotBound"), '', '', '', '', '', '', -1, '', '', 0, $buttonbind, '', 0, 1, 1);
//print load_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, ''); //print load_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td width="200">'.$langs->trans("Account").'</td>'; print '<tr class="liste_titre"><td class="minwidth100">'.$langs->trans("Account").'</td>';
print '<td width="200" class="left">'.$langs->trans("Label").'</td>'; print '<td>'.$langs->trans("Label").'</td>';
for ($i = 1; $i <= 12; $i++) { for ($i = 1; $i <= 12; $i++) {
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1; $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
if ($j > 12) { if ($j > 12) {
@ -314,12 +314,12 @@ if ($resql) {
while ($row = $db->fetch_row($resql)) { while ($row = $db->fetch_row($resql)) {
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
if ($row[0] == 'tobind') { if ($row[0] == 'tobind') {
print $langs->trans("Unknown"); print '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>';
} else { } else {
print length_accountg($row[0]); print length_accountg($row[0]);
} }
print '</td>'; print '</td>';
print '<td class="left">'; print '<td>';
if ($row[0] == 'tobind') { if ($row[0] == 'tobind') {
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/customer/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind")); print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/customer/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
} else { } else {
@ -344,13 +344,13 @@ print '</div>';
print '<br>'; print '<br>';
print_barre_liste($langs->trans("OverviewOfAmountOfLinesBound"), '', '', '', '', '', '', -1, '', '', 0, '', '', 0, 1, 1); print_barre_liste(img_picto('', 'link', 'class="paddingright fa-color-unset"').$langs->trans("OverviewOfAmountOfLinesBound"), '', '', '', '', '', '', -1, '', '', 0, '', '', 0, 1, 1);
//print load_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), '', ''); //print load_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), '', '');
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td width="200">'.$langs->trans("Account").'</td>'; print '<tr class="liste_titre"><td class="minwidth100">'.$langs->trans("Account").'</td>';
print '<td width="200" class="left">'.$langs->trans("Label").'</td>'; print '<td>'.$langs->trans("Label").'</td>';
for ($i = 1; $i <= 12; $i++) { for ($i = 1; $i <= 12; $i++) {
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1; $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
if ($j > 12) { if ($j > 12) {
@ -404,7 +404,7 @@ if ($resql) {
} }
print '</td>'; print '</td>';
print '<td class="left">'; print '<td>';
if ($row[0] == 'tobind') { if ($row[0] == 'tobind') {
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/customer/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind")); print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/customer/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
} else { } else {
@ -436,7 +436,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) { // This part of code looks strange
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td width="400" class="left">'.$langs->trans("TotalVente").'</td>'; print '<tr class="liste_titre"><td lass="left">'.$langs->trans("TotalVente").'</td>';
for ($i = 1; $i <= 12; $i++) { for ($i = 1; $i <= 12; $i++) {
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1; $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
if ($j > 12) { if ($j > 12) {
@ -497,7 +497,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) { // This part of code looks strange
print "<br>\n"; print "<br>\n";
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td width="400">'.$langs->trans("TotalMarge").'</td>'; print '<tr class="liste_titre"><td>'.$langs->trans("TotalMarge").'</td>';
for ($i = 1; $i <= 12; $i++) { for ($i = 1; $i <= 12; $i++) {
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1; $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
if ($j > 12) { if ($j > 12) {

View File

@ -149,13 +149,13 @@ $y = $year_current;
$buttonbind = '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?year='.$year_current.'&action=validatehistory">'.$langs->trans("ValidateHistory").'</a>'; $buttonbind = '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?year='.$year_current.'&action=validatehistory">'.$langs->trans("ValidateHistory").'</a>';
print_barre_liste($langs->trans("OverviewOfAmountOfLinesNotBound"), '', '', '', '', '', '', -1, '', '', 0, $buttonbind, '', 0, 1, 1); print_barre_liste(img_picto('', 'unlink', 'class="paddingright fa-color-unset"').$langs->trans("OverviewOfAmountOfLinesNotBound"), '', '', '', '', '', '', -1, '', '', 0, $buttonbind, '', 0, 1, 1);
//print load_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, ''); //print load_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td width="200">'.$langs->trans("Account").'</td>'; print '<tr class="liste_titre"><td class="minwidth100">'.$langs->trans("Account").'</td>';
print '<td width="200" class="left">'.$langs->trans("Label").'</td>'; print '<td>'.$langs->trans("Label").'</td>';
for ($i = 1; $i <= 12; $i++) { for ($i = 1; $i <= 12; $i++) {
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1; $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
if ($j > 12) { if ($j > 12) {
@ -197,12 +197,12 @@ if ($resql) {
while ($row = $db->fetch_row($resql)) { while ($row = $db->fetch_row($resql)) {
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
if ($row[0] == 'tobind') { if ($row[0] == 'tobind') {
print $langs->trans("Unknown"); print '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>';
} else { } else {
print length_accountg($row[0]); print length_accountg($row[0]);
} }
print '</td>'; print '</td>';
print '<td class="left">'; print '<td>';
if ($row[0] == 'tobind') { if ($row[0] == 'tobind') {
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/expensereport/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind")); print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/expensereport/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
} else { } else {
@ -227,14 +227,14 @@ print '</div>';
print '<br>'; print '<br>';
print_barre_liste($langs->trans("OverviewOfAmountOfLinesBound"), '', '', '', '', '', '', -1, '', '', 0, '', '', 0, 1, 1); print_barre_liste(img_picto('', 'link', 'class="paddingright fa-color-unset"').$langs->trans("OverviewOfAmountOfLinesBound"), '', '', '', '', '', '', -1, '', '', 0, '', '', 0, 1, 1);
//print load_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), '', ''); //print load_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), '', '');
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td width="200">'.$langs->trans("Account").'</td>'; print '<tr class="liste_titre"><td class="minwidth100">'.$langs->trans("Account").'</td>';
print '<td width="200" class="left">'.$langs->trans("Label").'</td>'; print '<td>'.$langs->trans("Label").'</td>';
for ($i = 1; $i <= 12; $i++) { for ($i = 1; $i <= 12; $i++) {
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1; $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
if ($j > 12) { if ($j > 12) {
@ -276,13 +276,13 @@ if ($resql) {
while ($row = $db->fetch_row($resql)) { while ($row = $db->fetch_row($resql)) {
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
if ($row[0] == 'tobind') { if ($row[0] == 'tobind') {
print $langs->trans("Unknown"); print '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>';
} else { } else {
print length_accountg($row[0]); print length_accountg($row[0]);
} }
print '</td>'; print '</td>';
print '<td class="left">'; print '<td>';
if ($row[0] == 'tobind') { if ($row[0] == 'tobind') {
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/expensereport/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind")); print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/expensereport/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
} else { } else {
@ -314,7 +314,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) { // This part of code looks strange
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td width="400" class="left">'.$langs->trans("Total").'</td>'; print '<tr class="liste_titre"><td class="left">'.$langs->trans("Total").'</td>';
for ($i = 1; $i <= 12; $i++) { for ($i = 1; $i <= 12; $i++) {
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1; $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
if ($j > 12) { if ($j > 12) {

View File

@ -610,7 +610,7 @@ if (empty($action) || $action == 'view') {
$userstatic->id = $tabuser[$key]['id']; $userstatic->id = $tabuser[$key]['id'];
$userstatic->name = $tabuser[$key]['name']; $userstatic->name = $tabuser[$key]['name'];
print "<td>".$userstatic->getNomUrl(0, 'user', 16).' - '.$accountingaccount->label."</td>"; print "<td>".$userstatic->getNomUrl(0, 'user', 16).' - '.$accountingaccount->label."</td>";
print '<td class="right nowraponall amount amount">'.($mt >= 0 ? price($mt) : '')."</td>"; print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>"; print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
print "</tr>"; print "</tr>";
} }

View File

@ -260,13 +260,13 @@ $y = $year_current;
$buttonbind = '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?year='.$year_current.'&action=validatehistory">'.$langs->trans("ValidateHistory").'</a>'; $buttonbind = '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?year='.$year_current.'&action=validatehistory">'.$langs->trans("ValidateHistory").'</a>';
print_barre_liste($langs->trans("OverviewOfAmountOfLinesNotBound"), '', '', '', '', '', '', -1, '', '', 0, $buttonbind, '', 0, 1, 1); print_barre_liste(img_picto('', 'unlink', 'class="paddingright fa-color-unset"').$langs->trans("OverviewOfAmountOfLinesNotBound"), '', '', '', '', '', '', -1, '', '', 0, $buttonbind, '', 0, 1, 1);
//print load_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, ''); //print load_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td width="200">'.$langs->trans("Account").'</td>'; print '<tr class="liste_titre"><td class="minwidth100">'.$langs->trans("Account").'</td>';
print '<td width="200" class="left">'.$langs->trans("Label").'</td>'; print '<td>'.$langs->trans("Label").'</td>';
for ($i = 1; $i <= 12; $i++) { for ($i = 1; $i <= 12; $i++) {
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1; $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
if ($j > 12) { if ($j > 12) {
@ -309,12 +309,12 @@ if ($resql) {
while ($row = $db->fetch_row($resql)) { while ($row = $db->fetch_row($resql)) {
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
if ($row[0] == 'tobind') { if ($row[0] == 'tobind') {
print $langs->trans("Unknown"); print '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>';
} else { } else {
print length_accountg($row[0]); print length_accountg($row[0]);
} }
print '</td>'; print '</td>';
print '<td class="left">'; print '<td>';
if ($row[0] == 'tobind') { if ($row[0] == 'tobind') {
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/supplier/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind")); print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/supplier/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
} else { } else {
@ -339,13 +339,13 @@ print '</div>';
print '<br>'; print '<br>';
print_barre_liste($langs->trans("OverviewOfAmountOfLinesBound"), '', '', '', '', '', '', -1, '', '', 0, '', '', 0, 1, 1); print_barre_liste(img_picto('', 'link', 'class="paddingright fa-color-unset"').$langs->trans("OverviewOfAmountOfLinesBound"), '', '', '', '', '', '', -1, '', '', 0, '', '', 0, 1, 1);
//print load_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), '', ''); //print load_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), '', '');
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td width="200">'.$langs->trans("Account").'</td>'; print '<tr class="liste_titre"><td class="minwidth100">'.$langs->trans("Account").'</td>';
print '<td width="200" class="left">'.$langs->trans("Label").'</td>'; print '<td>'.$langs->trans("Label").'</td>';
for ($i = 1; $i <= 12; $i++) { for ($i = 1; $i <= 12; $i++) {
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1; $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
if ($j > 12) { if ($j > 12) {
@ -393,7 +393,7 @@ if ($resql) {
print length_accountg($row[0]); print length_accountg($row[0]);
} }
print '</td>'; print '</td>';
print '<td class="left">'; print '<td>';
if ($row[0] == 'tobind') { if ($row[0] == 'tobind') {
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/supplier/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind")); print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/supplier/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
} else { } else {
@ -425,7 +425,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) { // This part of code looks strange
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td width="400" class="left">'.$langs->trans("Total").'</td>'; print '<tr class="liste_titre"><td>'.$langs->trans("Total").'</td>';
for ($i = 1; $i <= 12; $i++) { for ($i = 1; $i <= 12; $i++) {
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1; $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
if ($j > 12) { if ($j > 12) {

View File

@ -620,10 +620,12 @@ if ($result) {
} }
// Level 3: Search suggested account for this thirdparty (similar code exists in page index.php to make automatic binding) // Level 3: Search suggested account for this thirdparty (similar code exists in page index.php to make automatic binding)
if (!empty($objp->company_code_buy)) { if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
$objp->code_buy_t = $objp->company_code_buy; if (!empty($objp->company_code_buy)) {
$objp->aarowid_suggest = $objp->aarowid_thirdparty; $objp->code_buy_t = $objp->company_code_buy;
$suggestedaccountingaccountfor = ''; $objp->aarowid_suggest = $objp->aarowid_thirdparty;
$suggestedaccountingaccountfor = '';
}
} }
if (!empty($objp->code_buy_p)) { if (!empty($objp->code_buy_p)) {
@ -724,11 +726,13 @@ if ($result) {
$s .= $langs->trans("NotDefined"); $s .= $langs->trans("NotDefined");
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
} }
print '<br>'; if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
$s = '3. '.(($objp->type_l == 1) ? $langs->trans("ServiceForThisThirdparty") : $langs->trans("ProductForThisThirdparty")).': '; print '<br>';
$shelp = ''; $s = '3. '.(($objp->type_l == 1) ? $langs->trans("ServiceForThisThirdparty") : $langs->trans("ProductForThisThirdparty")).': ';
$s .= ($objp->code_buy_t > 0 ? length_accountg($objp->code_buy_t) : '<span style="'.$code_buy_t_notset.'">'.$langs->trans("NotDefined").'</span>'); $shelp = '';
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); $s .= ($objp->code_buy_t > 0 ? length_accountg($objp->code_buy_t) : '<span style="'.$code_buy_t_notset.'">'.$langs->trans("NotDefined").'</span>');
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
}
print '</td>'; print '</td>';
// Suggested accounting account // Suggested accounting account

View File

@ -25,7 +25,7 @@
*/ */
/** /**
* \file htdocs/adherents/admin/adherent.php * \file htdocs/adherents/admin/member.php
* \ingroup member * \ingroup member
* \brief Page to setup the module Foundation * \brief Page to setup the module Foundation
*/ */

View File

@ -56,7 +56,7 @@ if ($action == 'setMEMBER_ENABLE_PUBLIC') {
if ($action == 'update') { if ($action == 'update') {
$public = GETPOST('MEMBER_ENABLE_PUBLIC'); $public = GETPOST('MEMBER_ENABLE_PUBLIC');
$amount = GETPOST('MEMBER_NEWFORM_AMOUNT'); $amount = price2num(GETPOST('MEMBER_NEWFORM_AMOUNT'), 'MT', 2);
$editamount = GETPOST('MEMBER_NEWFORM_EDITAMOUNT'); $editamount = GETPOST('MEMBER_NEWFORM_EDITAMOUNT');
$payonline = GETPOST('MEMBER_NEWFORM_PAYONLINE'); $payonline = GETPOST('MEMBER_NEWFORM_PAYONLINE');
$forcetype = GETPOST('MEMBER_NEWFORM_FORCETYPE', 'int'); $forcetype = GETPOST('MEMBER_NEWFORM_FORCETYPE', 'int');
@ -205,7 +205,7 @@ if (!empty($conf->global->MEMBER_ENABLE_PUBLIC)) {
print '<tr class="oddeven" id="tramount"><td>'; print '<tr class="oddeven" id="tramount"><td>';
print $langs->trans("DefaultAmount"); print $langs->trans("DefaultAmount");
print '</td><td class="right">'; print '</td><td class="right">';
print '<input type="text" id="MEMBER_NEWFORM_AMOUNT" name="MEMBER_NEWFORM_AMOUNT" size="5" value="'.(!empty($conf->global->MEMBER_NEWFORM_AMOUNT) ? $conf->global->MEMBER_NEWFORM_AMOUNT : '').'">'; print '<input type="text" class="right width75" id="MEMBER_NEWFORM_AMOUNT" name="MEMBER_NEWFORM_AMOUNT" value="'.(!empty($conf->global->MEMBER_NEWFORM_AMOUNT) ? $conf->global->MEMBER_NEWFORM_AMOUNT : '').'">';
print "</td></tr>\n"; print "</td></tr>\n";
// Can edit // Can edit

View File

@ -660,7 +660,7 @@ if (empty($reshook)) {
$outputlangs = new Translate('', $conf); $outputlangs = new Translate('', $conf);
$outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang); $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
// Load traductions files required by page // Load traductions files required by page
$outputlangs->loadLangs(array("main", "members")); $outputlangs->loadLangs(array("main", "members", "companies", "install", "other"));
// Get email content from template // Get email content from template
$arraydefaultmessage = null; $arraydefaultmessage = null;
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION; $labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION;
@ -731,7 +731,7 @@ if (empty($reshook)) {
$outputlangs = new Translate('', $conf); $outputlangs = new Translate('', $conf);
$outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang); $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
// Load traductions files required by page // Load traductions files required by page
$outputlangs->loadLangs(array("main", "members")); $outputlangs->loadLangs(array("main", "members", "companies", "install", "other"));
// Get email content from template // Get email content from template
$arraydefaultmessage = null; $arraydefaultmessage = null;
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_CANCELATION; $labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_CANCELATION;
@ -802,7 +802,7 @@ if (empty($reshook)) {
$outputlangs = new Translate('', $conf); $outputlangs = new Translate('', $conf);
$outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang); $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
// Load traductions files required by page // Load traductions files required by page
$outputlangs->loadLangs(array("main", "members")); $outputlangs->loadLangs(array("main", "members", "companies", "install", "other"));
// Get email content from template // Get email content from template
$arraydefaultmessage = null; $arraydefaultmessage = null;
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_EXCLUSION; $labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_EXCLUSION;
@ -1509,7 +1509,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$outputlangs = new Translate('', $conf); $outputlangs = new Translate('', $conf);
$outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang); $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
// Load traductions files required by page // Load traductions files required by page
$outputlangs->loadLangs(array("main", "members")); $outputlangs->loadLangs(array("main", "members", "companies", "install", "other"));
// Get email content from template // Get email content from template
$arraydefaultmessage = null; $arraydefaultmessage = null;
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION; $labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION;

View File

@ -696,7 +696,7 @@ $tooltiphelp = '';
if ($mysoc->country_code == 'FR') { if ($mysoc->country_code == 'FR') {
$tooltiphelp = '<i>'.$langs->trans("Example").': '.$langs->trans("VATIsUsedExampleFR")."</i>"; $tooltiphelp = '<i>'.$langs->trans("Example").': '.$langs->trans("VATIsUsedExampleFR")."</i>";
} }
print "<label for=\"use_vat\">".$form->textwithpicto($langs->trans("VATIsUsedDesc"), $tooltiphelp)."</label>"; print '<label for="use_vat">'.$form->textwithpicto($langs->trans("VATIsUsedDesc"), $tooltiphelp)."</label>";
print "</td></tr>\n"; print "</td></tr>\n";
@ -706,7 +706,7 @@ $tooltiphelp = '';
if ($mysoc->country_code == 'FR') { if ($mysoc->country_code == 'FR') {
$tooltiphelp = "<i>".$langs->trans("Example").': '.$langs->trans("VATIsNotUsedExampleFR")."</i>\n"; $tooltiphelp = "<i>".$langs->trans("Example").': '.$langs->trans("VATIsNotUsedExampleFR")."</i>\n";
} }
print "<label for=\"no_vat\">".$form->textwithpicto($langs->trans("VATIsNotUsedDesc"), $tooltiphelp)."</label>"; print '<label for="no_vat">'.$form->textwithpicto($langs->trans("VATIsNotUsedDesc"), $tooltiphelp)."</label>";
print "</td></tr>\n"; print "</td></tr>\n";
print "</table>"; print "</table>";
@ -721,12 +721,12 @@ print "</tr>\n";
if ($mysoc->useLocalTax(1)) { if ($mysoc->useLocalTax(1)) {
// Note: When option is not set, it must not appears as set on on, because there is no default value for this option // Note: When option is not set, it must not appears as set on on, because there is no default value for this option
print '<tr class="oddeven"><td><input type="radio" name="optionlocaltax1" id="lt1" value="localtax1on"'.(($conf->global->FACTURE_LOCAL_TAX1_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX1_OPTION == "localtax1on") ? " checked" : "")."> ".$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code)."</td>"; print '<tr class="oddeven"><td><input type="radio" name="optionlocaltax1" id="lt1" value="localtax1on"'.(($conf->global->FACTURE_LOCAL_TAX1_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX1_OPTION == "localtax1on") ? " checked" : "").'> <label for="lt1">'.$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code)."</label></td>";
print '<td colspan="2">'; print '<td colspan="2">';
print '<div class="nobordernopadding">'; print '<div class="nobordernopadding">';
$tooltiphelp = $langs->transcountry("LocalTax1IsUsedExample", $mysoc->country_code); $tooltiphelp = $langs->transcountry("LocalTax1IsUsedExample", $mysoc->country_code);
$tooltiphelp = ($tooltiphelp != "LocalTax1IsUsedExample" ? "<i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsUsedExample", $mysoc->country_code)."</i>\n" : ""); $tooltiphelp = ($tooltiphelp != "LocalTax1IsUsedExample" ? "<i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsUsedExample", $mysoc->country_code)."</i>\n" : "");
print '<label for="lt1">'.$form->textwithpicto($langs->transcountry("LocalTax1IsUsedDesc", $mysoc->country_code), $tooltiphelp)."</label>"; print $form->textwithpicto($langs->transcountry("LocalTax1IsUsedDesc", $mysoc->country_code), $tooltiphelp);
if (!isOnlyOneLocalTax(1)) { if (!isOnlyOneLocalTax(1)) {
print '<br><label for="lt1">'.$langs->trans("LTRate").'</label>: '; print '<br><label for="lt1">'.$langs->trans("LTRate").'</label>: ';
$formcompany->select_localtax(1, $conf->global->MAIN_INFO_VALUE_LOCALTAX1, "lt1"); $formcompany->select_localtax(1, $conf->global->MAIN_INFO_VALUE_LOCALTAX1, "lt1");
@ -739,11 +739,11 @@ if ($mysoc->useLocalTax(1)) {
print "</div>"; print "</div>";
print "</td></tr>\n"; print "</td></tr>\n";
print '<tr class="oddeven"><td><input type="radio" name="optionlocaltax1" id="nolt1" value="localtax1off"'.((empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) || $conf->global->FACTURE_LOCAL_TAX1_OPTION == "localtax1off") ? " checked" : "")."> ".$langs->transcountry("LocalTax1IsNotUsed", $mysoc->country_code)."</td>"; print '<tr class="oddeven"><td><input type="radio" name="optionlocaltax1" id="nolt1" value="localtax1off"'.((empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) || $conf->global->FACTURE_LOCAL_TAX1_OPTION == "localtax1off") ? " checked" : "").'> <label for="nolt1">'.$langs->transcountry("LocalTax1IsNotUsed", $mysoc->country_code)."</label></td>";
print '<td colspan="2">'; print '<td colspan="2">';
$tooltiphelp = $langs->transcountry("LocalTax1IsNotUsedExample", $mysoc->country_code); $tooltiphelp = $langs->transcountry("LocalTax1IsNotUsedExample", $mysoc->country_code);
$tooltiphelp = ($tooltiphelp != "LocalTax1IsNotUsedExample" ? "<i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsNotUsedExample", $mysoc->country_code)."</i>\n" : ""); $tooltiphelp = ($tooltiphelp != "LocalTax1IsNotUsedExample" ? "<i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsNotUsedExample", $mysoc->country_code)."</i>\n" : "");
print "<label for=\"nolt1\">".$form->textwithpicto($langs->transcountry("LocalTax1IsNotUsedDesc", $mysoc->country_code), $tooltiphelp)."</label>"; print $form->textwithpicto($langs->transcountry("LocalTax1IsNotUsedDesc", $mysoc->country_code), $tooltiphelp);
print "</td></tr>\n"; print "</td></tr>\n";
} else { } else {
if (empty($mysoc->country_code)) { if (empty($mysoc->country_code)) {
@ -765,7 +765,7 @@ print "</tr>\n";
if ($mysoc->useLocalTax(2)) { if ($mysoc->useLocalTax(2)) {
// Note: When option is not set, it must not appears as set on on, because there is no default value for this option // Note: When option is not set, it must not appears as set on on, because there is no default value for this option
print '<tr class="oddeven"><td><input type="radio" name="optionlocaltax2" id="lt2" value="localtax2on"'.(($conf->global->FACTURE_LOCAL_TAX2_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2on") ? " checked" : "")."> ".$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code)."</td>"; print '<tr class="oddeven"><td><input type="radio" name="optionlocaltax2" id="lt2" value="localtax2on"'.(($conf->global->FACTURE_LOCAL_TAX2_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2on") ? " checked" : "").'> <label for="lt2">'.$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code)."</label></td>";
print '<td colspan="2">'; print '<td colspan="2">';
print '<div class="nobordernopadding">'; print '<div class="nobordernopadding">';
print '<label for="lt2">'.$langs->transcountry("LocalTax2IsUsedDesc", $mysoc->country_code)."</label>"; print '<label for="lt2">'.$langs->transcountry("LocalTax2IsUsedDesc", $mysoc->country_code)."</label>";
@ -780,7 +780,7 @@ if ($mysoc->useLocalTax(2)) {
print "</div>"; print "</div>";
print "</td></tr>\n"; print "</td></tr>\n";
print '<tr class="oddeven"><td><input type="radio" name="optionlocaltax2" id="nolt2" value="localtax2off"'.((empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2off") ? " checked" : "")."> ".$langs->transcountry("LocalTax2IsNotUsed", $mysoc->country_code)."</td>"; print '<tr class="oddeven"><td><input type="radio" name="optionlocaltax2" id="nolt2" value="localtax2off"'.((empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2off") ? " checked" : "").'> <label for="nolt2">'.$langs->transcountry("LocalTax2IsNotUsed", $mysoc->country_code)."</label></td>";
print '<td colspan="2">'; print '<td colspan="2">';
print "<div>"; print "<div>";
$tooltiphelp = $langs->transcountry("LocalTax2IsNotUsedExample", $mysoc->country_code); $tooltiphelp = $langs->transcountry("LocalTax2IsNotUsedExample", $mysoc->country_code);
@ -803,7 +803,7 @@ print "</table>";
print '<br>'; print '<br>';
print '<table class="noborder centpercent editmode">'; print '<table class="noborder centpercent editmode">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td width="25%">'.$form->textwithpicto($langs->trans("RevenueStamp"), $langs->trans("RevenueStampDesc")).'</td><td>'.$langs->trans("Description").'</td>'; print '<td>'.$form->textwithpicto($langs->trans("RevenueStamp"), $langs->trans("RevenueStampDesc")).'</td><td>'.$langs->trans("Description").'</td>';
print '<td class="right">&nbsp;</td>'; print '<td class="right">&nbsp;</td>';
print "</tr>\n"; print "</tr>\n";
if ($mysoc->useRevenueStamp()) { if ($mysoc->useRevenueStamp()) {

View File

@ -217,15 +217,15 @@ class Dolistore
for ($i = 0; $i < $nbofcateg; $i++) { for ($i = 0; $i < $nbofcateg; $i++) {
$cat = $this->categories[$i]; $cat = $this->categories[$i];
if ($cat->is_root_category == 1 && $parent == 0) { if ($cat->is_root_category == 1 && $parent == 0) {
$html .= '<li class="root"><h3 class="nomargesupinf"><a class="nomargesupinf link2cat" href="?mode=marketplace&categorie='.$cat->id.'" '; $html .= '<li class="root"><h3 class="nomargesupinf"><a class="nomargesupinf link2cat" href="?mode=marketplace&categorie='.((int) $cat->id).'" ';
$html .= 'title="'.dol_escape_htmltag(strip_tags($cat->description->language[$this->lang - 1])).'">'.$cat->name->language[$this->lang - 1].' <sup>'.$cat->nb_products_recursive.'</sup></a></h3>'; $html .= 'title="'.dol_escape_htmltag(strip_tags($cat->description->language[$this->lang - 1])).'">'.dol_escape_htmltag($cat->name->language[$this->lang - 1]).' <sup>'.dol_escape_htmltag($cat->nb_products_recursive).'</sup></a></h3>';
$html .= self::get_categories($cat->id); $html .= self::get_categories($cat->id);
$html .= "</li>\n"; $html .= "</li>\n";
} elseif (trim($cat->id_parent) == $parent && $cat->active == 1 && trim($cat->id_parent) != 0) { // si cat est de ce niveau } elseif (trim($cat->id_parent) == $parent && $cat->active == 1 && trim($cat->id_parent) != 0) { // si cat est de ce niveau
$select = ($cat->id == $this->categorie) ? ' selected' : ''; $select = ($cat->id == $this->categorie) ? ' selected' : '';
$html .= '<li><a class="link2cat'.$select.'" href="?mode=marketplace&categorie='.$cat->id.'"'; $html .= '<li><a class="link2cat'.$select.'" href="?mode=marketplace&categorie='.((int) $cat->id).'"';
$html .= ' title="'.dol_escape_htmltag(strip_tags($cat->description->language[$this->lang - 1])).'" '; $html .= ' title="'.dol_escape_htmltag(strip_tags($cat->description->language[$this->lang - 1])).'" ';
$html .= '>'.$cat->name->language[$this->lang - 1].' <sup>'.$cat->nb_products_recursive.'</sup></a>'; $html .= '>'.dol_escape_htmltag($cat->name->language[$this->lang - 1]).' <sup>'.dol_escape_htmltag($cat->nb_products_recursive).'</sup></a>';
$html .= self::get_categories($cat->id); $html .= self::get_categories($cat->id);
$html .= "</li>\n"; $html .= "</li>\n";
} }
@ -267,9 +267,9 @@ class Dolistore
// add image or default ? // add image or default ?
if ($product->id_default_image != '') { if ($product->id_default_image != '') {
$image_url = DOL_URL_ROOT.'/admin/dolistore/ajax/image.php?id_product='.$product->id.'&id_image='.$product->id_default_image; $image_url = DOL_URL_ROOT.'/admin/dolistore/ajax/image.php?id_product='.((int) $product->id).'&id_image='.((int) $product->id_default_image);
$images = '<a href="'.$image_url.'" class="documentpreview" target="_blank" mime="image/png" title="'.$product->name->language[$this->lang - 1].', '.$langs->trans('Version').' '.$product->module_version.'">'; $images = '<a href="'.urlencode($image_url).'" class="documentpreview" target="_blank" mime="image/png" title="'.dol_escape_htmltag($product->name->language[$this->lang - 1].', '.$langs->trans('Version').' '.$product->module_version).'">';
$images .= '<img src="'.$image_url.'&quality=home_default" style="max-height:250px;max-width: 210px;" alt="" /></a>'; $images .= '<img src="'.urlencode($image_url).'&quality=home_default" style="max-height:250px;max-width: 210px;" alt="" /></a>';
} else { } else {
$images = '<img src="'.DOL_URL_ROOT.'/admin/dolistore/img/NoImageAvailable.png" />'; $images = '<img src="'.DOL_URL_ROOT.'/admin/dolistore/img/NoImageAvailable.png" />';
} }
@ -277,11 +277,11 @@ class Dolistore
// free or pay ? // free or pay ?
if ($product->price > 0) { if ($product->price > 0) {
$price = '<h3>'.price(price2num($product->price, 'MT'), 0, $langs, 1, -1, -1, 'EUR').' '.$langs->trans("HT").'</h3>'; $price = '<h3>'.price(price2num($product->price, 'MT'), 0, $langs, 1, -1, -1, 'EUR').' '.$langs->trans("HT").'</h3>';
$download_link = '<a target="_blank" href="'.$this->shop_url.$product->id.'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/follow.png" /></a>'; $download_link = '<a target="_blank" href="'.urlencode($this->shop_url.$product->id).'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/follow.png" /></a>';
} else { } else {
$price = '<h3>'.$langs->trans('Free').'</h3>'; $price = '<h3>'.$langs->trans('Free').'</h3>';
$download_link = '<a target="_blank" href="'.$this->shop_url.$product->id.'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/Download-128.png" /></a>'; $download_link = '<a target="_blank" href="'.urlencode($this->shop_url.$product->id).'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/Download-128.png" /></a>';
$download_link .= '<br><br><a target="_blank" href="'.$this->shop_url.$product->id.'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/follow.png" /></a>'; $download_link .= '<br><br><a target="_blank" href="'.urlencode($this->shop_url.$product->id).'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/follow.png" /></a>';
} }
//checking versions //checking versions
@ -319,14 +319,14 @@ class Dolistore
//.'<br><a class="inline-block valignmiddle" target="_blank" href="'.$this->shop_url.$product->id.'"><span class="details button">'.$langs->trans("SeeInMarkerPlace").'</span></a> //.'<br><a class="inline-block valignmiddle" target="_blank" href="'.$this->shop_url.$product->id.'"><span class="details button">'.$langs->trans("SeeInMarkerPlace").'</span></a>
//output template //output template
$html .= '<tr class="app oddeven '.$compatible.'"> $html .= '<tr class="app oddeven '.dol_escape_htmltag($compatible).'">
<td class="center" width="210"><div class="newAppParent">'.$newapp.$images.'</div></td> <td class="center" width="210"><div class="newAppParent">'.dol_escape_htmltag($newapp.$images).'</div></td>
<td class="margeCote"><h2 class="appTitle">'.$product->name->language[$this->lang - 1] <td class="margeCote"><h2 class="appTitle">'.dol_escape_htmltag($product->name->language[$this->lang - 1])
.'<br><small>'.$version.'</small></h2> .'<br><small>'.dol_escape_htmltag($version).'</small></h2>
<small> '.dol_print_date(dol_stringtotime($product->date_upd), 'dayhour').' - '.$langs->trans('Ref').': '.$product->reference.' - '.$langs->trans('Id').': '.$product->id.'</small><br><br>'.$product->description_short->language[$this->lang - 1].'</td>'; <small> '.dol_print_date(dol_stringtotime($product->date_upd), 'dayhour').' - '.$langs->trans('Ref').': '.dol_escape_htmltag($product->reference).' - '.dol_escape_htmltag($langs->trans('Id')).': '.((int) $product->id).'</small><br><br>'.dol_escape_htmltag($product->description_short->language[$this->lang - 1]).'</td>';
// do not load if display none // do not load if display none
//$html .= '<td style="display:none;" class="long_description">'.$product->description->language[$this->lang - 1].'</td>'; //$html .= '<td style="display:none;" class="long_description">'.$product->description->language[$this->lang - 1].'</td>';
$html .= '<td class="margeCote center">'.$price.'</td>'; $html .= '<td class="margeCote center">'.dol_escape_htmltag($price).'</td>';
$html .= '<td class="margeCote">'.$download_link.'</td>'; $html .= '<td class="margeCote">'.$download_link.'</td>';
$html .= '</tr>'; $html .= '</tr>';
} }
@ -343,7 +343,7 @@ class Dolistore
public function get_previous_link($text = '<<') public function get_previous_link($text = '<<')
{ {
// phpcs:enable // phpcs:enable
return '<a href="'.$this->get_previous_url().'" class="button">'.$text.'</a>'; return '<a href="'.$this->get_previous_url().'" class="button">'.dol_escape_htmltag($text).'</a>';
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
@ -356,7 +356,7 @@ class Dolistore
public function get_next_link($text = '>>') public function get_next_link($text = '>>')
{ {
// phpcs:enable // phpcs:enable
return '<a href="'.$this->get_next_url().'" class="button">'.$text.'</a>'; return '<a href="'.$this->get_next_url().'" class="button">'.dol_escape_htmltag($text).'</a>';
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps

View File

@ -16,7 +16,7 @@
*/ */
/** /**
* \file htdocs/admin/setup.php * \file htdocs/admin/eventorganization.php
* \ingroup eventorganization * \ingroup eventorganization
* \brief EventOrganization setup page. * \brief EventOrganization setup page.
*/ */
@ -213,7 +213,7 @@ if ($action == 'edit') {
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="update">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>'; print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
foreach ($arrayofparameters as $constname => $val) { foreach ($arrayofparameters as $constname => $val) {
if ($val['enabled']==1) { if ($val['enabled']==1) {
@ -264,7 +264,7 @@ if ($action == 'edit') {
} elseif (preg_match('/thirdparty_type/', $val['type'])) { } elseif (preg_match('/thirdparty_type/', $val['type'])) {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
$formcompany = new FormCompany($db); $formcompany = new FormCompany($db);
print $formcompany->selectProspectCustomerType($conf->global->{$constname}, $constname); print $formcompany->selectProspectCustomerType($conf->global->{$constname}, $constname, 'customerorprospect', 'form', '', 1);
} elseif ($val['type'] == 'securekey') { } elseif ($val['type'] == 'securekey') {
print '<input required="required" type="text" class="flat" id="'.$constname.'" name="'.$constname.'" value="'.(GETPOST($constname, 'alpha') ?GETPOST($constname, 'alpha') : $conf->global->{$constname}).'" size="40">'; print '<input required="required" type="text" class="flat" id="'.$constname.'" name="'.$constname.'" value="'.(GETPOST($constname, 'alpha') ?GETPOST($constname, 'alpha') : $conf->global->{$constname}).'" size="40">';
if (!empty($conf->use_javascript_ajax)) { if (!empty($conf->use_javascript_ajax)) {
@ -305,7 +305,7 @@ if ($action == 'edit') {
} else { } else {
if (!empty($arrayofparameters)) { if (!empty($arrayofparameters)) {
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>'; print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
foreach ($arrayofparameters as $constname => $val) { foreach ($arrayofparameters as $constname => $val) {
if ($val['enabled']==1) { if ($val['enabled']==1) {
@ -362,7 +362,7 @@ if ($action == 'edit') {
$product = new Product($db); $product = new Product($db);
$resprod = $product->fetch($conf->global->{$constname}); $resprod = $product->fetch($conf->global->{$constname});
if ($resprod > 0) { if ($resprod > 0) {
print $product->ref; print $product->getNomUrl(1);
} elseif ($resprod < 0) { } elseif ($resprod < 0) {
setEventMessages(null, $object->errors, "errors"); setEventMessages(null, $object->errors, "errors");
} }

View File

@ -252,9 +252,8 @@ if ($resql) {
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print "<td>".$langs->trans("RSS")." ".($i + 1)."</td>"; print "<td>".$langs->trans("RSS")." ".($i + 1)."</td>";
print '<td class="right">'; print '<td class="right">';
print '<input type="submit" class="button buttongen" name="modify" value="'.$langs->trans("Modify").'">'; print '<input type="submit" class="button buttongen button-save" name="modify" value="'.$langs->trans("Modify").'">';
print " &nbsp; "; print '<input type="submit" class="button buttongen button-cancel" name="delete" value="'.$langs->trans("Delete").'">';
print '<input type="submit" class="button buttongen" name="delete" value="'.$langs->trans("Delete").'">';
print '<input type="hidden" name="norss" value="'.$idrss.'">'; print '<input type="hidden" name="norss" value="'.$idrss.'">';
print '</td>'; print '</td>';
print '</tr>'."\n"; print '</tr>'."\n";

View File

@ -47,6 +47,8 @@ if (!$user->admin) {
// Constant and translation of the module description // Constant and translation of the module description
$modules = array( $modules = array(
'NOTE_PUBLIC' => 'FCKeditorForNotePublic',
'NOTE_PRIVATE' => 'FCKeditorForNotePrivate',
'SOCIETE' => 'FCKeditorForCompany', 'SOCIETE' => 'FCKeditorForCompany',
'PRODUCTDESC' => 'FCKeditorForProduct', 'PRODUCTDESC' => 'FCKeditorForProduct',
'DETAILS' => 'FCKeditorForProductDetails', 'DETAILS' => 'FCKeditorForProductDetails',
@ -54,11 +56,11 @@ $modules = array(
'MAILING' => 'FCKeditorForMailing', 'MAILING' => 'FCKeditorForMailing',
'MAIL' => 'FCKeditorForMail', 'MAIL' => 'FCKeditorForMail',
'TICKET' => 'FCKeditorForTicket', 'TICKET' => 'FCKeditorForTicket',
'NOTE_PUBLIC' => 'FCKeditorForNotePublic',
'NOTE_PRIVATE' => 'FCKeditorForNotePrivate',
); );
// Conditions for the option to be offered // Conditions for the option to be offered
$conditions = array( $conditions = array(
'NOTE_PUBLIC' => 1,
'NOTE_PRIVATE' => 1,
'SOCIETE' => 1, 'SOCIETE' => 1,
'PRODUCTDESC' => (!empty($conf->product->enabled) || !empty($conf->service->enabled)), 'PRODUCTDESC' => (!empty($conf->product->enabled) || !empty($conf->service->enabled)),
'DETAILS' => (!empty($conf->facture->enabled) || !empty($conf->propal->enabled) || !empty($conf->commande->enabled) || !empty($conf->supplier_proposal->enabled) || (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)), 'DETAILS' => (!empty($conf->facture->enabled) || !empty($conf->propal->enabled) || !empty($conf->commande->enabled) || !empty($conf->supplier_proposal->enabled) || (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)),
@ -66,11 +68,11 @@ $conditions = array(
'MAILING' => !empty($conf->mailing->enabled), 'MAILING' => !empty($conf->mailing->enabled),
'MAIL' => (!empty($conf->facture->enabled) || !empty($conf->propal->enabled) || !empty($conf->commande->enabled)), 'MAIL' => (!empty($conf->facture->enabled) || !empty($conf->propal->enabled) || !empty($conf->commande->enabled)),
'TICKET' => !empty($conf->ticket->enabled), 'TICKET' => !empty($conf->ticket->enabled),
'NOTE_PUBLIC' => 1,
'NOTE_PRIVATE' => 1,
); );
// Picto // Picto
$picto = array( $picto = array(
'NOTE_PUBLIC' => 'generic',
'NOTE_PRIVATE' => 'generic',
'SOCIETE' => 'generic', 'SOCIETE' => 'generic',
'PRODUCTDESC' => 'product', 'PRODUCTDESC' => 'product',
'DETAILS' => 'product', 'DETAILS' => 'product',
@ -78,8 +80,6 @@ $picto = array(
'MAILING' => 'email', 'MAILING' => 'email',
'MAIL' => 'email', 'MAIL' => 'email',
'TICKET' => 'ticket', 'TICKET' => 'ticket',
'NOTE_PUBLIC' => 'generic',
'NOTE_PRIVATE' => 'generic',
); );

View File

@ -4,6 +4,7 @@
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -43,7 +44,7 @@ if (!$user->admin) {
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'adminihm'; // To manage different context of search $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'adminihm'; // To manage different context of search
$mode = GETPOST('mode', 'aZ09') ? GETPOST('mode', 'aZ09') : 'language'; // 'language', 'template', 'login', 'other' $mode = GETPOST('mode', 'aZ09') ? GETPOST('mode', 'aZ09') : 'other'; // 'template', 'dashboard', 'login', 'other'
if (!defined("MAIN_MOTD")) { if (!defined("MAIN_MOTD")) {
define("MAIN_MOTD", ""); define("MAIN_MOTD", "");
@ -96,12 +97,6 @@ if ($action == 'removebackgroundlogin' && !empty($conf->global->MAIN_LOGIN_BACKG
if ($action == 'update') { if ($action == 'update') {
$error = 0; $error = 0;
if ($mode == 'language') {
dolibarr_set_const($db, "MAIN_LANG_DEFAULT", GETPOST("MAIN_LANG_DEFAULT", 'aZ09'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV + 1, 'chaine', 0, '', $conf->entity);
//dolibarr_set_const($db, "MAIN_MULTILANGS", GETPOST("MAIN_MULTILANGS"), 'chaine', 0, '', $conf->entity);
}
if ($mode == 'template') { if ($mode == 'template') {
dolibarr_set_const($db, "MAIN_THEME", GETPOST("main_theme", 'aZ09'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_THEME", GETPOST("main_theme", 'aZ09'), 'chaine', 0, '', $conf->entity);
@ -206,7 +201,14 @@ if ($action == 'update') {
} }
} }
if ($mode == 'dashboard') {
dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr(GETPOST("main_motd", 'restricthtml')), 'chaine', 0, '', $conf->entity);
}
if ($mode == 'other') { if ($mode == 'other') {
dolibarr_set_const($db, "MAIN_LANG_DEFAULT", GETPOST("MAIN_LANG_DEFAULT", 'aZ09'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV + 1, 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_SIZE_LISTE_LIMIT", GETPOST("main_size_liste_limit", 'int'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_SIZE_LISTE_LIMIT", GETPOST("main_size_liste_limit", 'int'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_SIZE_SHORTLIST_LIMIT", GETPOST("main_size_shortliste_limit", 'int'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_SIZE_SHORTLIST_LIMIT", GETPOST("main_size_shortliste_limit", 'int'), 'chaine', 0, '', $conf->entity);
@ -221,8 +223,6 @@ if ($action == 'update') {
dolibarr_set_const($db, "MAIN_BUGTRACK_ENABLELINK", GETPOST("MAIN_BUGTRACK_ENABLELINK", 'alpha'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_BUGTRACK_ENABLELINK", GETPOST("MAIN_BUGTRACK_ENABLELINK", 'alpha'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_FIRSTNAME_NAME_POSITION", GETPOST("MAIN_FIRSTNAME_NAME_POSITION", 'aZ09'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_FIRSTNAME_NAME_POSITION", GETPOST("MAIN_FIRSTNAME_NAME_POSITION", 'aZ09'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr(GETPOST("main_motd", 'restricthtml')), 'chaine', 0, '', $conf->entity);
} }
if ($mode == 'login') { if ($mode == 'login') {
@ -301,10 +301,139 @@ print dol_get_fiche_head($head, $mode, '', -1, '');
clearstatcache(); clearstatcache();
if ($mode == 'language') { if ($mode == 'template') {
// Themes and themes options
showSkins(null, 1);
}
if ($mode == 'dashboard') {
print '<div class="div-table-responsive-no-min">';
print '<table summary="blockdashboard" class="noborder centpercent editmode tableforfield">';
// Message of the day on home page
$substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount'));
complete_substitutions_array($substitutionarray, $langs);
print '<tr class="oddeven width25p"><td>';
$texthelp = $langs->trans("FollowingConstantsWillBeSubstituted") . '<br>';
foreach ($substitutionarray as $key => $val) {
$texthelp .= $key . '<br>';
}
print $form->textwithpicto($langs->trans("MessageOfDay"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessageofday');
print '</td><td>';
$doleditor = new DolEditor('main_motd', (isset($conf->global->MAIN_MOTD) ? $conf->global->MAIN_MOTD : ''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%');
$doleditor->Create();
print '</td></tr>' . "\n";
/* no more need for this option. It is now a widget already controlled by end user
print '<tr class="oddeven"><td>' . $langs->trans('BoxstatsDisableGlobal') . '</td><td>';
print ajax_constantonoff("MAIN_DISABLE_GLOBAL_BOXSTATS", array(), $conf->entity, 0, 0, 1, 0);
print '</td>';
print '</tr>';
*/
print '</table>';
print '</div>';
print '<br>';
print '<div class="div-table-responsive-no-min">';
print '<table summary="blockdashboard" class="noborder centpercent editmode tableforfield">';
print '<tr class="liste_titre"><td class="titlefieldmiddle">';
print $langs->trans("DashboardDisableBlocks");
print '</td><td class="titlefieldmiddle">';
print '</td></tr>';
print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableGlobal') . '</td><td>';
print ajax_constantonoff("MAIN_DISABLE_GLOBAL_WORKBOARD", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
print '</td>';
print '</tr>';
if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
// Block meteo
print '<tr class="oddeven"><td>' . $langs->trans('MAIN_DISABLE_METEO') . '</td><td>';
print ajax_constantonoff("MAIN_DISABLE_METEO", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
print '</td>';
print '</tr>';
// Block agenda
print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockAgenda') . '</td><td>';
print ajax_constantonoff("MAIN_DISABLE_BLOCK_AGENDA", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
print '</td>';
print '</tr>';
// Block agenda
print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockProject') . '</td><td>';
print ajax_constantonoff("MAIN_DISABLE_BLOCK_PROJECT", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
print '</td>';
print '</tr>';
// Block customer
print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockCustomer') . '</td><td>';
print ajax_constantonoff("MAIN_DISABLE_BLOCK_CUSTOMER", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
print '</td>';
print '</tr>';
// Block supplier
print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockSupplier') . '</td><td>';
print ajax_constantonoff("MAIN_DISABLE_BLOCK_SUPPLIER", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
print '</td>';
print '</tr>';
// Block contract
print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockContract') . '</td><td>';
print ajax_constantonoff("MAIN_DISABLE_BLOCK_CONTRACT", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
print '</td>';
print '</tr>';
// Block ticket
print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockTicket') . '</td><td>';
print ajax_constantonoff("MAIN_DISABLE_BLOCK_TICKET", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
print '</td>';
print '</tr>';
// Block bank
print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockBank') . '</td><td>';
print ajax_constantonoff("MAIN_DISABLE_BLOCK_BANK", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
print '</td>';
print '</tr>';
// Block adherent
print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockAdherent') . '</td><td>';
print ajax_constantonoff("MAIN_DISABLE_BLOCK_ADHERENT", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
print '</td>';
print '</tr>';
// Block expense report
print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockExpenseReport') . '</td><td>';
print ajax_constantonoff("MAIN_DISABLE_BLOCK_EXPENSEREPORT", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
print '</td>';
print '</tr>';
// Block holiday
print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockHoliday') . '</td><td>';
print ajax_constantonoff("MAIN_DISABLE_BLOCK_HOLIDAY", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
print '</td>';
print '</tr>';
}
print '</table>' . "\n";
print '</div>';
}
if ($mode == 'other') {
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table summary="edit" class="noborder centpercent editmode tableforfield">'; print '<table summary="edit" class="noborder centpercent editmode tableforfield">';
print '<tr class="liste_titre"><td class="titlefieldmiddle">';
print $langs->trans("Language");
print '</td><td class="titlefieldmiddle">';
print '</td></tr>';
// Default language // Default language
print '<tr class="oddeven"><td>'.$langs->trans("DefaultLanguage").'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("DefaultLanguage").'</td><td>';
print img_picto('', 'language', 'class="pictofixedwidth"'); print img_picto('', 'language', 'class="pictofixedwidth"');
@ -315,32 +444,28 @@ if ($mode == 'language') {
// Multilingual GUI // Multilingual GUI
print '<tr class="oddeven"><td>' . $langs->trans("EnableMultilangInterface") . '</td><td>'; print '<tr class="oddeven"><td>' . $langs->trans("EnableMultilangInterface") . '</td><td>';
print ajax_constantonoff("MAIN_MULTILANGS", array(), $conf->entity, 0, 0, 1, 0); print ajax_constantonoff("MAIN_MULTILANGS", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'language');
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
print '</table>' . "\n"; print '</table>' . "\n";
print '</div>'; print '</div>';
}
if ($mode == 'template') { print '<br>';
// Themes and themes options print '<div class="center">';
showSkins(null, 1); print '<input class="button button-save reposition" type="submit" name="submit" value="' . $langs->trans("Save") . '">';
} print '</div>';
print '<br>';
if ($mode == 'other') {
// Other // Other
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table summary="otherparameters" class="noborder centpercent editmode tableforfield">'; print '<table summary="otherparameters" class="noborder centpercent editmode tableforfield">';
// Disable javascript and ajax print '<tr class="liste_titre"><td class="titlefieldmiddle">';
print '<tr class="oddeven"><td>' . $langs->trans("DisableJavascript") . '</td><td>'; print $langs->trans("Miscelaneous");
print ajax_constantonoff("MAIN_DISABLE_JAVASCRIPT", array(), $conf->entity, 0, 0, 1, 0); print '</td><td class="titlefieldmiddle">';
print ' <span class="opacitymedium"> &nbsp; &nbsp; ' . $langs->trans("DisableJavascriptNote") . '</span>'; print '</td></tr>';
print '</td>';
print '<td>';
print '</td>';
print '</tr>';
// Max size of lists // Max size of lists
print '<tr class="oddeven"><td>' . $langs->trans("DefaultMaxSizeList") . '</td><td><input class="flat" name="main_size_liste_limit" size="4" value="' . $conf->global->MAIN_SIZE_LISTE_LIMIT . '"></td>'; print '<tr class="oddeven"><td>' . $langs->trans("DefaultMaxSizeList") . '</td><td><input class="flat" name="main_size_liste_limit" size="4" value="' . $conf->global->MAIN_SIZE_LISTE_LIMIT . '"></td>';
@ -393,7 +518,7 @@ if ($mode == 'other') {
// Hide unauthorized menus // Hide unauthorized menus
print '<tr class="oddeven"><td>' . $langs->trans("HideUnauthorizedMenu") . '</td><td>'; print '<tr class="oddeven"><td>' . $langs->trans("HideUnauthorizedMenu") . '</td><td>';
//print $form->selectyesno('MAIN_MENU_HIDE_UNAUTHORIZED', isset($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) ? $conf->global->MAIN_MENU_HIDE_UNAUTHORIZED : 0, 1); //print $form->selectyesno('MAIN_MENU_HIDE_UNAUTHORIZED', isset($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) ? $conf->global->MAIN_MENU_HIDE_UNAUTHORIZED : 0, 1);
print ajax_constantonoff("MAIN_MENU_HIDE_UNAUTHORIZED", array(), $conf->entity, 0, 0, 1, 0); print ajax_constantonoff("MAIN_MENU_HIDE_UNAUTHORIZED", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other');
print '</td>'; print '</td>';
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
print '</tr>'; print '</tr>';
@ -401,7 +526,7 @@ if ($mode == 'other') {
// Hide unauthorized button // Hide unauthorized button
print '<tr class="oddeven"><td>' . $langs->trans("ButtonHideUnauthorized") . '</td><td>'; print '<tr class="oddeven"><td>' . $langs->trans("ButtonHideUnauthorized") . '</td><td>';
//print $form->selectyesno('MAIN_BUTTON_HIDE_UNAUTHORIZED', isset($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED) ? $conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED : 0, 1); //print $form->selectyesno('MAIN_BUTTON_HIDE_UNAUTHORIZED', isset($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED) ? $conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED : 0, 1);
print ajax_constantonoff("MAIN_BUTTON_HIDE_UNAUTHORIZED", array(), $conf->entity, 0, 0, 1, 0); print ajax_constantonoff("MAIN_BUTTON_HIDE_UNAUTHORIZED", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other');
print '</td>'; print '</td>';
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
print '</tr>'; print '</tr>';
@ -417,7 +542,9 @@ if ($mode == 'other') {
*/ */
// Show bugtrack link // Show bugtrack link
print '<tr class="oddeven"><td>' . $langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")) . '</td><td>'; print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")), $langs->trans("ShowBugTrackLinkDesc"));
print '</td><td>';
print '<input type="text" name="MAIN_BUGTRACK_ENABLELINK" value="' . (empty($conf->global->MAIN_BUGTRACK_ENABLELINK) ? '' : $conf->global->MAIN_BUGTRACK_ENABLELINK) . '">'; print '<input type="text" name="MAIN_BUGTRACK_ENABLELINK" value="' . (empty($conf->global->MAIN_BUGTRACK_ENABLELINK) ? '' : $conf->global->MAIN_BUGTRACK_ENABLELINK) . '">';
print '</td>'; print '</td>';
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
@ -426,29 +553,20 @@ if ($mode == 'other') {
// Hide wiki link on login page // Hide wiki link on login page
$pictohelp = '<span class="fa fa-question-circle"></span>'; $pictohelp = '<span class="fa fa-question-circle"></span>';
print '<tr class="oddeven"><td>' . str_replace('{picto}', $pictohelp, $langs->trans("DisableLinkToHelp", '{picto}')) . '</td><td>'; print '<tr class="oddeven"><td>' . str_replace('{picto}', $pictohelp, $langs->trans("DisableLinkToHelp", '{picto}')) . '</td><td>';
print ajax_constantonoff("MAIN_HELP_DISABLELINK", array(), $conf->entity, 0, 0, 1, 0); print ajax_constantonoff("MAIN_HELP_DISABLELINK", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other');
//print $form->selectyesno('MAIN_HELP_DISABLELINK', isset($conf->global->MAIN_HELP_DISABLELINK) ? $conf->global->MAIN_HELP_DISABLELINK : 0, 1); //print $form->selectyesno('MAIN_HELP_DISABLELINK', isset($conf->global->MAIN_HELP_DISABLELINK) ? $conf->global->MAIN_HELP_DISABLELINK : 0, 1);
print '</td>'; print '</td>';
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
print '</tr>'; print '</tr>';
// Message of the day on home page // Disable javascript and ajax
$substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount')); print '<tr class="oddeven"><td>' . $langs->trans("DisableJavascript") . '</td><td>';
complete_substitutions_array($substitutionarray, $langs); print ajax_constantonoff("MAIN_DISABLE_JAVASCRIPT", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other');
print ' <span class="opacitymedium paddingleft marginleft">' . $langs->trans("DisableJavascriptNote") . '</span>';
print '<tr class="oddeven"><td>'; print '</td>';
$texthelp = $langs->trans("FollowingConstantsWillBeSubstituted") . '<br>'; print '<td>';
foreach ($substitutionarray as $key => $val) { print '</td>';
$texthelp .= $key . '<br>'; print '</tr>';
}
print $form->textwithpicto($langs->trans("MessageOfDay"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessageofday');
print '</td><td colspan="2">';
$doleditor = new DolEditor('main_motd', (isset($conf->global->MAIN_MOTD) ? $conf->global->MAIN_MOTD : ''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%');
$doleditor->Create();
print '</td></tr>' . "\n";
print '</table>' . "\n"; print '</table>' . "\n";
print '</div>'; print '</div>';
@ -459,11 +577,16 @@ if ($mode == 'login') {
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table summary="edit" class="noborder centpercent editmode tableforfield">'; print '<table summary="edit" class="noborder centpercent editmode tableforfield">';
print '<tr class="liste_titre"><td class="titlefieldmiddle">';
print $langs->trans("Parameter");
print '</td><td class="titlefieldmiddle">';
print $langs->trans("Value");
print '</td></tr>';
// Hide helpcenter link on login page // Hide helpcenter link on login page
print '<tr class="oddeven"><td>' . $langs->trans("DisableLinkToHelpCenter") . '</td><td>'; print '<tr class="oddeven"><td>' . $langs->trans("DisableLinkToHelpCenter") . '</td><td>';
print ajax_constantonoff("MAIN_HELPCENTER_DISABLELINK", array(), $conf->entity, 0, 0, 0, 0); print ajax_constantonoff("MAIN_HELPCENTER_DISABLELINK", array(), $conf->entity, 0, 0, 0, 0, 0, 0, '', 'login');
print '</td>'; print '</td>';
print '<td width="20">&nbsp;</td>';
print '</tr>'; print '</tr>';
// Message on login page // Message on login page
@ -475,13 +598,13 @@ if ($mode == 'login') {
$texthelp .= $key . '<br>'; $texthelp .= $key . '<br>';
} }
print $form->textwithpicto($langs->trans("MessageLogin"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessagelogin'); print $form->textwithpicto($langs->trans("MessageLogin"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessagelogin');
print '</td><td colspan="2">'; print '</td><td>';
$doleditor = new DolEditor('main_home', (isset($conf->global->MAIN_HOME) ? $conf->global->MAIN_HOME : ''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%'); $doleditor = new DolEditor('main_home', (isset($conf->global->MAIN_HOME) ? $conf->global->MAIN_HOME : ''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%');
$doleditor->Create(); $doleditor->Create();
print '</td></tr>' . "\n"; print '</td></tr>' . "\n";
// Background // Background
print '<tr class="oddeven"><td><label for="imagebackground">' . $langs->trans("BackgroundImageLogin") . ' (png,jpg)</label></td><td colspan="2">'; print '<tr class="oddeven"><td><label for="imagebackground">' . $langs->trans("BackgroundImageLogin") . ' (png,jpg)</label></td><td>';
print '<div class="centpercent inline-block">'; print '<div class="centpercent inline-block">';
$disabled = ''; $disabled = '';
if (!empty($conf->global->ADD_UNSPLASH_LOGIN_BACKGROUND)) { if (!empty($conf->global->ADD_UNSPLASH_LOGIN_BACKGROUND)) {

View File

@ -43,6 +43,7 @@ $action = GETPOST('action', 'aZ09');
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('adminldap', 'globaladmin')); $hookmanager->initHooks(array('adminldap', 'globaladmin'));
/* /*
* Actions * Actions
*/ */
@ -150,7 +151,7 @@ $arraylist['0'] = $langs->trans("No");
$arraylist['ldap2dolibarr'] = $langs->trans("LDAPToDolibarr"); $arraylist['ldap2dolibarr'] = $langs->trans("LDAPToDolibarr");
$arraylist['dolibarr2ldap'] = $langs->trans("DolibarrToLDAP"); $arraylist['dolibarr2ldap'] = $langs->trans("DolibarrToLDAP");
print $form->selectarray('activesynchro', $arraylist, $conf->global->LDAP_SYNCHRO_ACTIVE); print $form->selectarray('activesynchro', $arraylist, $conf->global->LDAP_SYNCHRO_ACTIVE);
print '</td><td>'.$langs->trans("LDAPDnSynchroActiveExample"); print '</td><td><span class="opacitymedium">'.$langs->trans("LDAPDnSynchroActiveExample").'</span>';
if ($conf->global->LDAP_SYNCHRO_ACTIVE && !$conf->global->LDAP_USER_DN) { if ($conf->global->LDAP_SYNCHRO_ACTIVE && !$conf->global->LDAP_USER_DN) {
print '<br><font class="error">'.$langs->trans("LDAPSetupNotComplete").'</font>'; print '<br><font class="error">'.$langs->trans("LDAPSetupNotComplete").'</font>';
} }
@ -163,7 +164,7 @@ if (!empty($conf->societe->enabled)) {
$arraylist['0'] = $langs->trans("No"); $arraylist['0'] = $langs->trans("No");
$arraylist['1'] = $langs->trans("DolibarrToLDAP"); $arraylist['1'] = $langs->trans("DolibarrToLDAP");
print $form->selectarray('activecontact', $arraylist, $conf->global->LDAP_CONTACT_ACTIVE); print $form->selectarray('activecontact', $arraylist, $conf->global->LDAP_CONTACT_ACTIVE);
print '</td><td>'.$langs->trans("LDAPDnContactActiveExample").'</td></tr>'; print '</td><td><span class="opacitymedium">'.$langs->trans("LDAPDnContactActiveExample").'</span></td></tr>';
} }
// Synchro member active // Synchro member active
@ -174,7 +175,7 @@ if (!empty($conf->adherent->enabled)) {
$arraylist['1'] = $langs->trans("DolibarrToLDAP"); $arraylist['1'] = $langs->trans("DolibarrToLDAP");
$arraylist['ldap2dolibarr'] = $langs->trans("LDAPToDolibarr").' ('.$langs->trans("SupportedForLDAPImportScriptOnly").')'; $arraylist['ldap2dolibarr'] = $langs->trans("LDAPToDolibarr").' ('.$langs->trans("SupportedForLDAPImportScriptOnly").')';
print $form->selectarray('activemembers', $arraylist, $conf->global->LDAP_MEMBER_ACTIVE); print $form->selectarray('activemembers', $arraylist, $conf->global->LDAP_MEMBER_ACTIVE);
print '</td><td>'.$langs->trans("LDAPDnMemberActiveExample").'</td></tr>'; print '</td><td><span class="opacitymedium">'.$langs->trans("LDAPDnMemberActiveExample").'</span></td></tr>';
} }
// Synchro member type active // Synchro member type active
@ -185,7 +186,7 @@ if (!empty($conf->adherent->enabled)) {
$arraylist['1'] = $langs->trans("DolibarrToLDAP"); $arraylist['1'] = $langs->trans("DolibarrToLDAP");
$arraylist['ldap2dolibarr'] = $langs->trans("LDAPToDolibarr").' ('.$langs->trans("SupportedForLDAPImportScriptOnly").')'; $arraylist['ldap2dolibarr'] = $langs->trans("LDAPToDolibarr").' ('.$langs->trans("SupportedForLDAPImportScriptOnly").')';
print $form->selectarray('activememberstypes', $arraylist, $conf->global->LDAP_MEMBER_TYPE_ACTIVE); print $form->selectarray('activememberstypes', $arraylist, $conf->global->LDAP_MEMBER_TYPE_ACTIVE);
print '</td><td>'.$langs->trans("LDAPDnMemberTypeActiveExample").'</td></tr>'; print '</td><td><span class="opacitymedium">'.$langs->trans("LDAPDnMemberTypeActiveExample").'</span></td></tr>';
} }
// Fields from hook // Fields from hook
@ -214,33 +215,33 @@ $arraylist = array();
$arraylist['3'] = 'Version 3'; $arraylist['3'] = 'Version 3';
$arraylist['2'] = 'Version 2'; $arraylist['2'] = 'Version 2';
print $form->selectarray('LDAP_SERVER_PROTOCOLVERSION', $arraylist, $conf->global->LDAP_SERVER_PROTOCOLVERSION); print $form->selectarray('LDAP_SERVER_PROTOCOLVERSION', $arraylist, $conf->global->LDAP_SERVER_PROTOCOLVERSION);
print '</td><td>'.$langs->trans("LDAPServerProtocolVersion").'</td></tr>'; print '</td><td><span class="opacitymedium">'.$langs->trans("LDAPServerProtocolVersion").'</span></td></tr>';
// Serveur primaire // Serveur primaire
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
print $langs->trans("LDAPPrimaryServer").'</td><td>'; print $langs->trans("LDAPPrimaryServer").'</td><td>';
print '<input size="25" type="text" name="host" value="'.$conf->global->LDAP_SERVER_HOST.'">'; print '<input class="minwidth200" type="text" name="host" value="'.$conf->global->LDAP_SERVER_HOST.'">';
print '</td><td>'.$langs->trans("LDAPServerExample").'</td></tr>'; print '</td><td><span class="opacitymedium">'.$langs->trans("LDAPServerExample").'</span></td></tr>';
// Serveur secondaire // Serveur secondaire
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
print $langs->trans("LDAPSecondaryServer").'</td><td>'; print $langs->trans("LDAPSecondaryServer").'</td><td>';
print '<input size="25" type="text" name="slave" value="'.$conf->global->LDAP_SERVER_HOST_SLAVE.'">'; print '<input class="minwidth200" type="text" name="slave" value="'.$conf->global->LDAP_SERVER_HOST_SLAVE.'">';
print '</td><td>'.$langs->trans("LDAPServerExample").'</td></tr>'; print '</td><td><span class="opacitymedium">'.$langs->trans("LDAPServerExample").'</span></td></tr>';
// Port // Port
print '<tr class="oddeven"><td>'.$langs->trans("LDAPServerPort").'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("LDAPServerPort").'</td><td>';
if (!empty($conf->global->LDAP_SERVER_PORT)) { if (!empty($conf->global->LDAP_SERVER_PORT)) {
print '<input size="25" type="text" name="port" value="'.$conf->global->LDAP_SERVER_PORT.'">'; print '<input class="width75" type="text" name="port" value="'.$conf->global->LDAP_SERVER_PORT.'">';
} else { } else {
print '<input size="25" type="text" name="port" value="389">'; print '<input class="width75" type="text" name="port" value="389">';
} }
print '</td><td>'.$langs->trans("LDAPServerPortExample").'</td></tr>'; print '</td><td><span class="opacitymedium">'.$langs->trans("LDAPServerPortExample").'</span></td></tr>';
// DNserver // DNserver
print '<tr class="oddeven"><td>'.$langs->trans("LDAPServerDn").'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("LDAPServerDn").'</td><td>';
print '<input size="25" type="text" name="dn" value="'.$conf->global->LDAP_SERVER_DN.'">'; print '<input class="minwidth300" type="text" name="dn" value="'.$conf->global->LDAP_SERVER_DN.'">';
print '</td><td>'.$langs->trans("LDAPServerDnExample").'</td></tr>'; print '</td><td><span class="opacitymedium">'.$langs->trans("LDAPServerDnExample").'</span></td></tr>';
// Utiliser TLS // Utiliser TLS
print '<tr class="oddeven"><td>'.$langs->trans("LDAPServerUseTLS").'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("LDAPServerUseTLS").'</td><td>';
@ -248,7 +249,7 @@ $arraylist = array();
$arraylist['0'] = $langs->trans("No"); $arraylist['0'] = $langs->trans("No");
$arraylist['1'] = $langs->trans("Yes"); $arraylist['1'] = $langs->trans("Yes");
print $form->selectarray('usetls', $arraylist, $conf->global->LDAP_SERVER_USE_TLS); print $form->selectarray('usetls', $arraylist, $conf->global->LDAP_SERVER_USE_TLS);
print '</td><td>'.$langs->trans("LDAPServerUseTLSExample").'</td></tr>'; print '</td><td><span class="opacitymedium">'.$langs->trans("LDAPServerUseTLSExample").'</span></td></tr>';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td colspan="3">'.$langs->trans("ForANonAnonymousAccess").'</td>'; print '<td colspan="3">'.$langs->trans("ForANonAnonymousAccess").'</td>';
@ -257,18 +258,18 @@ print "</tr>\n";
// DNAdmin // DNAdmin
print '<!-- LDAP_ADMIN_DN -->'; print '<!-- LDAP_ADMIN_DN -->';
print '<tr class="oddeven"><td>'.$langs->trans("LDAPAdminDn").'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("LDAPAdminDn").'</td><td>';
print '<input size="25" type="text" name="admin" value="'.$conf->global->LDAP_ADMIN_DN.'">'; print '<input class="minwidth300" type="text" name="admin" value="'.$conf->global->LDAP_ADMIN_DN.'">';
print '</td><td>'.$langs->trans("LDAPAdminDnExample").'</td></tr>'; print '</td><td class="maxwidthhalf"><span class="opacitymedium">'.$langs->trans("LDAPAdminDnExample").'</span></td></tr>';
// Pass // Pass
print '<!-- LDAP_ADMIN_PASS -->'; print '<!-- LDAP_ADMIN_PASS -->';
print '<tr class="oddeven"><td>'.$langs->trans("LDAPPassword").'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("LDAPPassword").'</td><td>';
if (!empty($conf->global->LDAP_ADMIN_PASS)) { if (!empty($conf->global->LDAP_ADMIN_PASS)) {
print '<input size="25" type="password" name="pass" value="'.$conf->global->LDAP_ADMIN_PASS.'">'; // je le met en visible pour test print '<input class="minwidth150" type="password" name="pass" value="'.$conf->global->LDAP_ADMIN_PASS.'">'; // je le met en visible pour test
} else { } else {
print '<input size="25" type="text" name="pass" value="'.$conf->global->LDAP_ADMIN_PASS.'">'; print '<input class="minwidth150" type="text" name="pass" value="'.$conf->global->LDAP_ADMIN_PASS.'">';
} }
print '</td><td>'.$langs->trans('Password').' (ex: secret)</td></tr>'; print '</td><td><span class="opacitymedium">'.$langs->trans('Password').' (ex: secret)</span></td></tr>';
print '</table>'; print '</table>';

View File

@ -228,7 +228,7 @@ if (!empty($conf->agenda->enabled)) {
$elementList['actioncomm_send'] = img_picto('', 'action', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendEventPush')); $elementList['actioncomm_send'] = img_picto('', 'action', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendEventPush'));
} }
if (!empty($conf->eventorganization->enabled) && !empty($user->rights->eventorganization->read)) { if (!empty($conf->eventorganization->enabled) && !empty($user->rights->eventorganization->read)) {
$elementList['eventorganization_send'] = img_picto('', 'action', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendEventOrganization')); $elementList['conferenceorbooth'] = img_picto('', 'action', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendEventOrganization'));
} }
if (!empty($conf->partnership->enabled) && !empty($user->rights->partnership->read)) { if (!empty($conf->partnership->enabled) && !empty($user->rights->partnership->read)) {
$elementList['partnership_send'] = img_picto('', 'partnership', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToPartnership')); $elementList['partnership_send'] = img_picto('', 'partnership', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToPartnership'));
@ -935,7 +935,7 @@ if ($resql) {
print '<td class="center">'; print '<td class="center">';
print '<input type="hidden" name="page" value="'.$page.'">'; print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="rowid" value="'.$rowid.'">'; print '<input type="hidden" name="rowid" value="'.$rowid.'">';
print '<input type="submit" class="button buttongen" name="actionmodify" value="'.$langs->trans("Modify").'">'; print '<input type="submit" class="button buttongen button-save" name="actionmodify" value="'.$langs->trans("Modify").'">';
print '<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'"></div>'; print '<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'"></div>';
print '<input type="submit" class="button buttongen button-cancel" name="actioncancel" value="'.$langs->trans("Cancel").'">'; print '<input type="submit" class="button buttongen button-cancel" name="actioncancel" value="'.$langs->trans("Cancel").'">';
print '</td>'; print '</td>';
@ -1071,8 +1071,8 @@ if ($resql) {
if ($showfield) { if ($showfield) {
print '<!-- '.$fieldlist[$field].' -->'; print '<!-- '.$fieldlist[$field].' -->';
print '<td class="'.$class.'"'; print '<td class="'.$class.'"';
if ($value == 'topic') { if (in_array($value, array('code', 'label', 'topic'))) {
print ' title="'.$valuetoshow.'"'; print ' title="'.dol_escape_htmltag($valuetoshow).'"';
} }
print '>'; print '>';
print $valuetoshow; print $valuetoshow;

View File

@ -1025,16 +1025,16 @@ if ($mode == 'marketplace') {
print '<div class="liste_titre liste_titre_bydiv centpercent"><div class="divsearchfield">'; print '<div class="liste_titre liste_titre_bydiv centpercent"><div class="divsearchfield">';
print '<form method="POST" class="centpercent" id="searchFormList" action="'.$dolistore->url.'">'; print '<form method="POST" class="centpercent" id="searchFormList" action="'.urlencode($dolistore->url).'">';
?> ?>
<input type="hidden" name="token" value="<?php echo newToken(); ?>"> <input type="hidden" name="token" value="<?php echo newToken(); ?>">
<input type="hidden" name="mode" value="marketplace"> <input type="hidden" name="mode" value="marketplace">
<div class="divsearchfield"> <div class="divsearchfield">
<input name="search_keyword" placeholder="<?php echo $langs->trans('Keyword') ?>" id="search_keyword" type="text" class="minwidth200" value="<?php echo $options['search'] ?>"><br> <input name="search_keyword" placeholder="<?php echo $langs->trans('Keyword') ?>" id="search_keyword" type="text" class="minwidth200" value="<?php echo dol_escape_htmltag($options['search']) ?>"><br>
</div> </div>
<div class="divsearchfield"> <div class="divsearchfield">
<input class="button buttongen" value="<?php echo $langs->trans('Rechercher') ?>" type="submit"> <input class="button buttongen" value="<?php echo $langs->trans('Rechercher') ?>" type="submit">
<a class="buttonreset" href="<?php echo $dolistore->url ?>"><?php echo $langs->trans('Reset') ?></a> <a class="buttonreset" href="<?php echo urlencode($dolistore->url) ?>"><?php echo $langs->trans('Reset') ?></a>
&nbsp; &nbsp;
</div> </div>
@ -1051,7 +1051,7 @@ if ($mode == 'marketplace') {
<div id="category-tree-left"> <div id="category-tree-left">
<ul class="tree"> <ul class="tree">
<?php echo $dolistore->get_categories(); ?> <?php echo dol_escape_htmltag($dolistore->get_categories()); ?>
</ul> </ul>
</div> </div>
<div id="listing-content"> <div id="listing-content">

View File

@ -513,7 +513,7 @@ if ($resql) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td class="tdoverflowmax300">'.$obj->name.'</td>'."\n"; print '<td class="tdoverflowmax600" title="'.dol_escape_htmltag($obj->name).'">'.dol_escape_htmltag($obj->name).'</td>'."\n";
print '<td class="tdoverflowmax300">'; print '<td class="tdoverflowmax300">';
if (isASecretKey($obj->name)) { if (isASecretKey($obj->name)) {
if (empty($dolibarr_main_prod)) { if (empty($dolibarr_main_prod)) {

View File

@ -101,6 +101,10 @@ if ($action == 'setMAIN_ENABLE_OVERWRITE_TRANSLATION') {
} }
if ($action == 'update') { if ($action == 'update') {
if ($transkey == '') {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Key")), null, 'errors');
$error++;
}
if ($transvalue == '') { if ($transvalue == '') {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("NewTranslationStringToShow")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("NewTranslationStringToShow")), null, 'errors');
$error++; $error++;
@ -108,7 +112,7 @@ if ($action == 'update') {
if (!$error) { if (!$error) {
$db->begin(); $db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."overwrite_trans set transvalue = '".$db->escape($transvalue)."' WHERE rowid = ".GETPOST('rowid', 'int'); $sql = "UPDATE ".MAIN_DB_PREFIX."overwrite_trans set transkey = '".$db->escape($transkey)."', transvalue = '".$db->escape($transvalue)."' WHERE rowid = ".((int) GETPOST('rowid', 'int'));
$result = $db->query($sql); $result = $db->query($sql);
if ($result > 0) { if ($result > 0) {
$db->commit(); $db->commit();
@ -324,7 +328,13 @@ if ($mode == 'overwrite') {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$obj->lang.'</td>'."\n"; print '<td>'.$obj->lang.'</td>'."\n";
print '<td>'.$obj->transkey.'</td>'."\n"; print '<td>';
if ($action == 'edit' && $obj->rowid == GETPOST('rowid', 'int')) {
print '<input type="text" class="quatrevingtpercent" name="transkey" value="'.dol_escape_htmltag($obj->transkey).'">';
} else {
print $obj->transkey;
}
print '</td>'."\n";
// Value // Value
print '<td class="small">'; print '<td class="small">';
@ -541,7 +551,7 @@ if ($mode == 'searchkey') {
print $form->textwithpicto('', $htmltext, 1, 'info'); print $form->textwithpicto('', $htmltext, 1, 'info');
} elseif (!empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION)) { } elseif (!empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION)) {
//print $key.'-'.$val; //print $key.'-'.$val;
print '<a class="reposition paddingrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=overwrite&langcode='.urlencode($langcode).'&transkey='.urlencode($key).'">'.img_edit_add($langs->trans("Overwrite")).'</a>'; print '<a class="reposition paddingrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=overwrite&langcode='.urlencode($langcode).'&transkey='.urlencode($key).'">'.img_edit_add($langs->trans("TranslationOverwriteKey")).'</a>';
} }
if (!empty($conf->global->MAIN_FEATURES_LEVEL)) { if (!empty($conf->global->MAIN_FEATURES_LEVEL)) {

View File

@ -44,8 +44,9 @@ class Login
* Login * Login
* *
* Request the API token for a couple username / password. * Request the API token for a couple username / password.
* Using method POST is recommanded for security reasons (method GET is often logged by default by web servers with parameters so with login and pass into server log file). * WARNING: You should NEVER use this API, like you should never use the similare API that uses the POST method. This will expose your password.
* Both methods are provided for developer conveniance. Best is to not use at all the login API method and enter directly the "DOLAPIKEY" into field at the top right of page. Note: The API token (DOLAPIKEY) can be found/set on the user page. * To use the APIs, you should instead set an API token to the user you want to allow to use API (This API token called DOLAPIKEY can be found/set on the user page) and use this token as credential for any API call.
* From the API explorer, you can enter directly the "DOLAPIKEY" into the field at the top right of the page to get access to any allowed APIs.
* *
* @param string $login User login * @param string $login User login
* @param string $password User password * @param string $password User password
@ -67,8 +68,9 @@ class Login
* Login * Login
* *
* Request the API token for a couple username / password. * Request the API token for a couple username / password.
* Using method POST is recommanded for security reasons (method GET is often logged by default by web servers with parameters so with login and pass into server log file). * WARNING: You should NEVER use this API, like you should never use the similare API that uses the POST method. This will expose your password.
* Both methods are provided for developer conveniance. Best is to not use at all the login API method and enter directly the "DOLAPIKEY" into field at the top right of page. Note: The API token (DOLAPIKEY) can be found/set on the user page. * To use the APIs, you should instead set an API token to the user you want to allow to use API (This API token called DOLAPIKEY can be found/set on the user page) and use this token as credential for any API call.
* From the API explorer, you can enter directly the "DOLAPIKEY" into the field at the top right of the page to get access to any allowed APIs.
* *
* @param string $login User login * @param string $login User login
* @param string $password User password * @param string $password User password

View File

@ -946,7 +946,7 @@ class BOM extends CommonObject
$this->lines = array(); $this->lines = array();
$objectline = new BOMLine($this->db); $objectline = new BOMLine($this->db);
$result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql'=>'fk_bom = '.$this->id)); $result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql'=>'fk_bom = '.((int) $this->id)));
if (is_numeric($result)) { if (is_numeric($result)) {
$this->error = $this->error; $this->error = $this->error;

View File

@ -58,6 +58,7 @@ class Categorie extends CommonObject
const TYPE_ACTIONCOMM = 'actioncomm'; const TYPE_ACTIONCOMM = 'actioncomm';
const TYPE_WEBSITE_PAGE = 'website_page'; const TYPE_WEBSITE_PAGE = 'website_page';
const TYPE_TICKET = 'ticket'; const TYPE_TICKET = 'ticket';
const TYPE_KNOWLEDGEMANAGEMENT = 'knowledgemanagement';
/** /**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
@ -81,7 +82,8 @@ class Categorie extends CommonObject
'warehouse' => 9, 'warehouse' => 9,
'actioncomm' => 10, 'actioncomm' => 10,
'website_page' => 11, 'website_page' => 11,
'ticket' => 12 'ticket' => 12,
'knowledgemanagement' => 13
); );
/** /**
@ -102,7 +104,8 @@ class Categorie extends CommonObject
9 => 'warehouse', 9 => 'warehouse',
10 => 'actioncomm', 10 => 'actioncomm',
11 => 'website_page', 11 => 'website_page',
12 => 'ticket' 12 => 'ticket',
13 => 'knowledgemanagement'
); );
/** /**
@ -146,7 +149,8 @@ class Categorie extends CommonObject
'warehouse'=> 'Entrepot', 'warehouse'=> 'Entrepot',
'actioncomm' => 'ActionComm', 'actioncomm' => 'ActionComm',
'website_page' => 'WebsitePage', 'website_page' => 'WebsitePage',
'ticket' => 'Ticket' 'ticket' => 'Ticket',
'knowledgemanagement' => 'KnowledgeRecord'
); );
/** /**

View File

@ -205,10 +205,14 @@ foreach ($fulltree as $key => $val) {
$entry .= '<a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$val['id'].'&type='.$type.$moreparam.'&backtolist='.urlencode($_SERVER["PHP_SELF"].'?type='.$type).'">'.img_view().'</a>'; $entry .= '<a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$val['id'].'&type='.$type.$moreparam.'&backtolist='.urlencode($_SERVER["PHP_SELF"].'?type='.$type).'">'.img_view().'</a>';
$entry .= '</td>'; $entry .= '</td>';
$entry .= '<td class="right" width="20px;">'; $entry .= '<td class="right" width="20px;">';
$entry .= '<a class="editfielda" href="'.DOL_URL_ROOT.'/categories/edit.php?id='.$val['id'].'&type='.$type.$moreparam.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?type='.$type).'">'.img_edit().'</a>'; if ($user->rights->categorie->creer) {
$entry .= '<a class="editfielda" href="' . DOL_URL_ROOT . '/categories/edit.php?id=' . $val['id'] . '&type=' . $type . $moreparam . '&backtopage=' . urlencode($_SERVER["PHP_SELF"] . '?type=' . $type) . '">' . img_edit() . '</a>';
}
$entry .= '</td>'; $entry .= '</td>';
$entry .= '<td class="right" width="20px;">'; $entry .= '<td class="right" width="20px;">';
$entry .= '<a class="deletefilelink" href="'.DOL_URL_ROOT.'/categories/viewcat.php?action=delete&token='.newToken().'&id='.$val['id'].'&type='.$type.$moreparam.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?type='.$type.$moreparam).'&backtolist='.urlencode($_SERVER["PHP_SELF"].'?type='.$type.$moreparam).'">'.img_delete().'</a>'; if ($user->rights->categorie->supprimer) {
$entry .= '<a class="deletefilelink" href="' . DOL_URL_ROOT . '/categories/viewcat.php?action=delete&token=' . newToken() . '&id=' . $val['id'] . '&type=' . $type . $moreparam . '&backtopage=' . urlencode($_SERVER["PHP_SELF"] . '?type=' . $type . $moreparam) . '&backtolist=' . urlencode($_SERVER["PHP_SELF"] . '?type=' . $type . $moreparam) . '">' . img_delete() . '</a>';
}
$entry .= '</td>'; $entry .= '</td>';
$entry .= '</tr>'; $entry .= '</tr>';

View File

@ -898,15 +898,23 @@ while ($currentdaytoshow < $lastdaytoshow) {
} }
} else { } else {
/* Use this list to have for all users */ /* Use this list to have for all users */
$sql = "SELECT u.rowid, u.lastname as lastname, u.firstname, u.statut, u.login, u.admin, u.entity"; $sql = "SELECT DISTINCT u.rowid, u.lastname as lastname, u.firstname, u.statut, u.login, u.admin, u.entity";
$sql .= " FROM ".MAIN_DB_PREFIX."user as u"; $sql .= " FROM ".MAIN_DB_PREFIX."user as u";
if ($usergroup > 0) { if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ug ON u.rowid = ug.fk_user"; $sql .= ", ".MAIN_DB_PREFIX."usergroup_user as ug";
$sql .= " WHERE ug.entity IN (".getEntity('usergroup').")";
$sql .= " AND ug.fk_user = u.rowid ";
} else {
if ($usergroup > 0) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ug ON u.rowid = ug.fk_user";
}
$sql .= " WHERE u.entity IN (".getEntity('user').")";
} }
$sql .= " WHERE u.statut = 1 AND u.entity IN (".getEntity('user').")"; $sql .= " AND u.statut = 1";
if ($usergroup > 0) { if ($usergroup > 0) {
$sql .= " AND ug.fk_usergroup = ".((int) $usergroup); $sql .= " AND ug.fk_usergroup = ".((int) $usergroup);
} }
//print $sql; //print $sql;
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) { if ($resql) {

View File

@ -399,8 +399,8 @@ if (empty($reshook)) {
$object->cond_reglement_id = GETPOST('cond_reglement_id'); $object->cond_reglement_id = GETPOST('cond_reglement_id');
$object->mode_reglement_id = GETPOST('mode_reglement_id'); $object->mode_reglement_id = GETPOST('mode_reglement_id');
$object->fk_account = GETPOST('fk_account', 'int'); $object->fk_account = GETPOST('fk_account', 'int');
$object->remise_percent = price2num(GETPOST('remise_percent'), 2); $object->remise_percent = price2num(GETPOST('remise_percent'), '', 2);
$object->remise_absolue = price2num(GETPOST('remise_absolue'), 'MU'); $object->remise_absolue = price2num(GETPOST('remise_absolue'), 'MU', 2);
$object->socid = GETPOST('socid', 'int'); $object->socid = GETPOST('socid', 'int');
$object->contact_id = GETPOST('contactid', 'int'); $object->contact_id = GETPOST('contactid', 'int');
$object->fk_project = GETPOST('projectid', 'int'); $object->fk_project = GETPOST('projectid', 'int');
@ -841,8 +841,8 @@ if (empty($reshook)) {
$tva_tx = ''; $tva_tx = '';
} }
$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS'); $qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS', 2);
$remise_percent = price2num(GETPOST('remise_percent'.$predef), 2); $remise_percent = price2num(GETPOST('remise_percent'.$predef), '', 2);
if (empty($remise_percent)) { if (empty($remise_percent)) {
$remise_percent = 0; $remise_percent = 0;
} }
@ -1229,6 +1229,8 @@ if (empty($reshook)) {
$date_start = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear')); $date_start = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear'));
$date_end = dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear')); $date_end = dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear'));
$remise_percent = price2num(GETPOST('remise_percent'), '', 2);
// Extrafields // Extrafields
$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line); $extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
$array_options = $extrafields->getOptionalsFromPost($object->table_element_line); $array_options = $extrafields->getOptionalsFromPost($object->table_element_line);
@ -1241,7 +1243,7 @@ if (empty($reshook)) {
} }
// Define special_code for special lines // Define special_code for special lines
$special_code = GETPOST('special_code'); $special_code = GETPOST('special_code', 'int');
if (!GETPOST('qty')) { if (!GETPOST('qty')) {
$special_code = 3; $special_code = 3;
} }
@ -1260,7 +1262,7 @@ if (empty($reshook)) {
} }
$label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : ''); $label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : '');
if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && ($price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent'), 2) / 100) < price2num($price_min)))) { if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && ($price_min && (price2num($pu_ht) * (1 - $remise_percent / 100) < price2num($price_min)))) {
setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors'); setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors');
$error++; $error++;
} }
@ -1290,7 +1292,7 @@ if (empty($reshook)) {
$qty = price2num(GETPOST('qty', 'alpha'), 'MS'); $qty = price2num(GETPOST('qty', 'alpha'), 'MS');
$result = $object->updateline(GETPOST('lineid', 'int'), $pu_ht, $qty, price2num(GETPOST('remise_percent'), 2), $vat_rate, $localtax1_rate, $localtax2_rate, $description, 'HT', $info_bits, $special_code, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $type, $date_start, $date_end, $array_options, GETPOST("units"), $pu_ht_devise); $result = $object->updateline(GETPOST('lineid', 'int'), $pu_ht, $qty, $remise_percent, $vat_rate, $localtax1_rate, $localtax2_rate, $description, 'HT', $info_bits, $special_code, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $type, $date_start, $date_end, $array_options, GETPOST("units"), $pu_ht_devise);
if ($result >= 0) { if ($result >= 0) {
$db->commit(); $db->commit();
@ -1358,9 +1360,9 @@ if (empty($reshook)) {
// Terms of payment // Terms of payment
$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int')); $result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
} elseif ($action == 'setremisepercent' && $usercancreate) { } elseif ($action == 'setremisepercent' && $usercancreate) {
$result = $object->set_remise_percent($user, price2num(GETPOST('remise_percent'))); $result = $object->set_remise_percent($user, price2num(GETPOST('remise_percent'), '', 2));
} elseif ($action == 'setremiseabsolue' && $usercancreate) { } elseif ($action == 'setremiseabsolue' && $usercancreate) {
$result = $object->set_remise_absolue($user, price2num(GETPOST('remise_absolue'))); $result = $object->set_remise_absolue($user, price2num(GETPOST('remise_absolue'), 'MU', 2));
} elseif ($action == 'setmode' && $usercancreate) { } elseif ($action == 'setmode' && $usercancreate) {
// Payment choice // Payment choice
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int')); $result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));

View File

@ -613,9 +613,9 @@ if (empty($reshook)) {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} elseif ($action == 'setremisepercent' && $usercancreate) { } elseif ($action == 'setremisepercent' && $usercancreate) {
$result = $object->setDiscount($user, price2num(GETPOST('remise_percent'), 2)); $result = $object->setDiscount($user, price2num(GETPOST('remise_percent'), '', 2));
} elseif ($action == 'setremiseabsolue' && $usercancreate) { } elseif ($action == 'setremiseabsolue' && $usercancreate) {
$result = $object->set_remise_absolue($user, price2num(GETPOST('remise_absolue'), 'MU')); $result = $object->set_remise_absolue($user, price2num(GETPOST('remise_absolue'), 'MU', 2));
} elseif ($action == 'addline' && GETPOST('submitforalllines', 'alpha') && GETPOST('vatforalllines', 'alpha') !== '') { } elseif ($action == 'addline' && GETPOST('submitforalllines', 'alpha') && GETPOST('vatforalllines', 'alpha') !== '') {
// Define vat_rate // Define vat_rate
$vat_rate = (GETPOST('vatforalllines') ? GETPOST('vatforalllines') : 0); $vat_rate = (GETPOST('vatforalllines') ? GETPOST('vatforalllines') : 0);
@ -645,7 +645,7 @@ if (empty($reshook)) {
$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS'); $qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS');
$remise_percent = (GETPOSTISSET('remise_percent'.$predef) ? price2num(GETPOST('remise_percent'.$predef, 'alpha')) : 0); $remise_percent = (GETPOSTISSET('remise_percent'.$predef) ? price2num(GETPOST('remise_percent'.$predef, 'alpha'), '', 2) : 0);
if (empty($remise_percent)) { if (empty($remise_percent)) {
$remise_percent = 0; $remise_percent = 0;
} }
@ -1035,6 +1035,8 @@ if (empty($reshook)) {
$special_code = 3; $special_code = 3;
} }
$remise_percent = price2num(GETPOST('remise_percent'), '', 2);
// Check minimum price // Check minimum price
$productid = GETPOST('productid', 'int'); $productid = GETPOST('productid', 'int');
if (!empty($productid)) { if (!empty($productid)) {
@ -1050,7 +1052,7 @@ if (empty($reshook)) {
$label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : ''); $label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : '');
if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && ($price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent'), 2) / 100) < price2num($price_min)))) { if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && ($price_min && (price2num($pu_ht) * (1 - $remise_percent / 100) < price2num($price_min)))) {
setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors'); setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors');
$error++; $error++;
} }
@ -1075,7 +1077,7 @@ if (empty($reshook)) {
} }
} }
} }
$result = $object->updateline(GETPOST('lineid', 'int'), $description, $pu_ht, price2num(GETPOST('qty'), 'MS'), price2num(GETPOST('remise_percent'), 2), $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $info_bits, $date_start, $date_end, $type, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $special_code, $array_options, GETPOST('units'), $pu_ht_devise); $result = $object->updateline(GETPOST('lineid', 'int'), $description, $pu_ht, price2num(GETPOST('qty'), 'MS'), $remise_percent, $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $info_bits, $date_start, $date_end, $type, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $special_code, $array_options, GETPOST('units'), $pu_ht_devise);
if ($result >= 0) { if ($result >= 0) {
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {

View File

@ -429,7 +429,7 @@ $sql .= ' p.rowid as project_id, p.ref as project_ref, p.title as project_label,
$sql .= ' u.login, u.lastname, u.firstname, u.email, u.statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender,'; $sql .= ' u.login, u.lastname, u.firstname, u.email, u.statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender,';
$sql .= ' c.fk_cond_reglement,c.fk_mode_reglement,c.fk_shipping_method,'; $sql .= ' c.fk_cond_reglement,c.fk_mode_reglement,c.fk_shipping_method,';
$sql .= ' c.fk_input_reason'; $sql .= ' c.fk_input_reason';
if ($search_categ_cus) { if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
$sql .= ", cc.fk_categorie, cc.fk_soc"; $sql .= ", cc.fk_categorie, cc.fk_soc";
} }
// Add fields from extrafields // Add fields from extrafields
@ -446,7 +446,7 @@ $sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s';
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
if (!empty($search_categ_cus)) { if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ
} }
$sql .= ', '.MAIN_DB_PREFIX.'commande as c'; $sql .= ', '.MAIN_DB_PREFIX.'commande as c';
@ -799,7 +799,7 @@ if ($resql) {
if ($search_product_category != '') { if ($search_product_category != '') {
$param .= '&search_product_category='.urlencode($search_product_category); $param .= '&search_product_category='.urlencode($search_product_category);
} }
if ($search_categ_cus > 0) { if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
$param .= '&search_categ_cus='.urlencode($search_categ_cus); $param .= '&search_categ_cus='.urlencode($search_categ_cus);
} }
if ($show_files) { if ($show_files) {

View File

@ -889,7 +889,7 @@ if ($resql) {
print '</td>'; print '</td>';
}*/ }*/
print '<td class="center">'; print '<td class="center">';
print '<input type="submit" name="save" class="button buttongen marginbottomonly" value="'.$langs->trans("Add").'"><br>'; print '<input type="submit" name="save" class="button buttongen marginbottomonly button-add" value="'.$langs->trans("Add").'"><br>';
print '<input type="submit" name="cancel" class="button buttongen marginbottomonly button-cancel" value="'.$langs->trans("Cancel").'">'; print '<input type="submit" name="cancel" class="button buttongen marginbottomonly button-cancel" value="'.$langs->trans("Cancel").'">';
print '</td></tr>'; print '</td></tr>';

View File

@ -433,8 +433,8 @@ if (empty($reshook)) {
$tva_tx = ''; $tva_tx = '';
} }
$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS'); $qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS', 2);
$remise_percent = price2num(GETPOST('remise_percent'.$predef), 2); $remise_percent = price2num(GETPOST('remise_percent'.$predef), '', 2);
// Extrafields // Extrafields
$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line); $extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
@ -781,6 +781,8 @@ if (empty($reshook)) {
$result = -1; $result = -1;
}*/ }*/
$remise_percent = price2num(GETPOST('remise_percent'), '', 2);
// Check minimum price // Check minimum price
$productid = GETPOST('productid', 'int'); $productid = GETPOST('productid', 'int');
if (!empty($productid)) { if (!empty($productid)) {
@ -797,7 +799,7 @@ if (empty($reshook)) {
$label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : ''); $label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : '');
// Check price is not lower than minimum (check is done only for standard or replacement invoices) // Check price is not lower than minimum (check is done only for standard or replacement invoices)
if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT) && $price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent', 2)) / 100) < price2num($price_min)))) { if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT) && $price_min && (price2num($pu_ht) * (1 - $remise_percent / 100) < price2num($price_min)))) {
setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors'); setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors');
$error++; $error++;
} }
@ -830,8 +832,8 @@ if (empty($reshook)) {
$vat_rate, $vat_rate,
$localtax1_rate, $localtax1_rate,
$localtax1_rate, $localtax1_rate,
GETPOST('productid'), GETPOST('productid', 'int'),
price2num(GETPOST('remise_percent'), 2), $remise_percent,
'HT', 'HT',
$info_bits, $info_bits,
0, 0,
@ -1226,6 +1228,8 @@ if ($action == 'create') {
} }
$morehtmlref .= '</div>'; $morehtmlref .= '</div>';
$morehtmlright = '';
dol_banner_tab($object, 'ref', $linkback, 1, 'title', 'none', $morehtmlref, '', 0, '', $morehtmlright); dol_banner_tab($object, 'ref', $linkback, 1, 'title', 'none', $morehtmlref, '', 0, '', $morehtmlright);
print '<div class="fichecenter">'; print '<div class="fichecenter">';

View File

@ -521,7 +521,7 @@ if (empty($reshook)) {
$result = $object->setBankAccount(GETPOST('fk_account', 'int')); $result = $object->setBankAccount(GETPOST('fk_account', 'int'));
} elseif ($action == 'setremisepercent' && $usercancreate) { } elseif ($action == 'setremisepercent' && $usercancreate) {
$object->fetch($id); $object->fetch($id);
$result = $object->setDiscount($user, price2num(GETPOST('remise_percent'), 2)); $result = $object->setDiscount($user, price2num(GETPOST('remise_percent'), '', 2));
} elseif ($action == "setabsolutediscount" && $usercancreate) { } elseif ($action == "setabsolutediscount" && $usercancreate) {
// POST[remise_id] or POST[remise_id_for_payment] // POST[remise_id] or POST[remise_id_for_payment]
@ -1037,8 +1037,8 @@ if (empty($reshook)) {
$object->cond_reglement_id = GETPOST('cond_reglement_id', 'int'); $object->cond_reglement_id = GETPOST('cond_reglement_id', 'int');
$object->mode_reglement_id = GETPOST('mode_reglement_id', 'int'); $object->mode_reglement_id = GETPOST('mode_reglement_id', 'int');
$object->fk_account = GETPOST('fk_account', 'int'); $object->fk_account = GETPOST('fk_account', 'int');
$object->remise_absolue = price2num(GETPOST('remise_absolue'), 'MU'); $object->remise_absolue = price2num(GETPOST('remise_absolue'), 'MU', 2);
$object->remise_percent = price2num(GETPOST('remise_percent'), 2); $object->remise_percent = price2num(GETPOST('remise_percent'), '', 2);
$object->fk_incoterms = GETPOST('incoterm_id', 'int'); $object->fk_incoterms = GETPOST('incoterm_id', 'int');
$object->location_incoterms = GETPOST('location_incoterms', 'alpha'); $object->location_incoterms = GETPOST('location_incoterms', 'alpha');
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
@ -1094,7 +1094,7 @@ if (empty($reshook)) {
$object->mode_reglement_id = GETPOST('mode_reglement_id', 'int'); $object->mode_reglement_id = GETPOST('mode_reglement_id', 'int');
$object->fk_account = GETPOST('fk_account', 'int'); $object->fk_account = GETPOST('fk_account', 'int');
$object->remise_absolue = price2num(GETPOST('remise_absolue'), 'MU'); $object->remise_absolue = price2num(GETPOST('remise_absolue'), 'MU');
$object->remise_percent = price2num(GETPOST('remise_percent'), 2); $object->remise_percent = price2num(GETPOST('remise_percent'), '', 2);
$object->fk_incoterms = GETPOST('incoterm_id', 'int'); $object->fk_incoterms = GETPOST('incoterm_id', 'int');
$object->location_incoterms = GETPOST('location_incoterms', 'alpha'); $object->location_incoterms = GETPOST('location_incoterms', 'alpha');
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
@ -1309,7 +1309,7 @@ if (empty($reshook)) {
$object->fk_account = GETPOST('fk_account', 'int'); $object->fk_account = GETPOST('fk_account', 'int');
$object->amount = price2num(GETPOST('amount')); $object->amount = price2num(GETPOST('amount'));
$object->remise_absolue = price2num(GETPOST('remise_absolue'), 'MU'); $object->remise_absolue = price2num(GETPOST('remise_absolue'), 'MU');
$object->remise_percent = price2num(GETPOST('remise_percent'), 2); $object->remise_percent = price2num(GETPOST('remise_percent'), '', 2);
$object->fk_incoterms = GETPOST('incoterm_id', 'int'); $object->fk_incoterms = GETPOST('incoterm_id', 'int');
$object->location_incoterms = GETPOST('location_incoterms', 'alpha'); $object->location_incoterms = GETPOST('location_incoterms', 'alpha');
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
@ -1390,7 +1390,7 @@ if (empty($reshook)) {
$object->fk_account = GETPOST('fk_account', 'int'); $object->fk_account = GETPOST('fk_account', 'int');
$object->amount = price2num(GETPOST('amount')); $object->amount = price2num(GETPOST('amount'));
$object->remise_absolue = price2num(GETPOST('remise_absolue'), 'MU'); $object->remise_absolue = price2num(GETPOST('remise_absolue'), 'MU');
$object->remise_percent = price2num(GETPOST('remise_percent'), 2); $object->remise_percent = price2num(GETPOST('remise_percent'), '', 2);
$object->fk_incoterms = GETPOST('incoterm_id', 'int'); $object->fk_incoterms = GETPOST('incoterm_id', 'int');
$object->location_incoterms = GETPOST('location_incoterms', 'alpha'); $object->location_incoterms = GETPOST('location_incoterms', 'alpha');
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
@ -1813,7 +1813,7 @@ if (empty($reshook)) {
$product->fetch(GETPOST('idprod'.$i, 'int')); $product->fetch(GETPOST('idprod'.$i, 'int'));
$startday = dol_mktime(12, 0, 0, GETPOST('date_start'.$i.'month'), GETPOST('date_start'.$i.'day'), GETPOST('date_start'.$i.'year')); $startday = dol_mktime(12, 0, 0, GETPOST('date_start'.$i.'month'), GETPOST('date_start'.$i.'day'), GETPOST('date_start'.$i.'year'));
$endday = dol_mktime(12, 0, 0, GETPOST('date_end'.$i.'month'), GETPOST('date_end'.$i.'day'), GETPOST('date_end'.$i.'year')); $endday = dol_mktime(12, 0, 0, GETPOST('date_end'.$i.'month'), GETPOST('date_end'.$i.'day'), GETPOST('date_end'.$i.'year'));
$result = $object->addline($product->description, $product->price, price2num(GETPOST('qty'.$i), 'MS'), $product->tva_tx, $product->localtax1_tx, $product->localtax2_tx, GETPOST('idprod'.$i, 'int'), price2num(GETPOST('remise_percent'.$i)), $startday, $endday, 0, 0, '', $product->price_base_type, $product->price_ttc, $product->type, -1, 0, '', 0, 0, null, 0, '', 0, 100, '', $product->fk_unit); $result = $object->addline($product->description, $product->price, price2num(GETPOST('qty'.$i), 'MS'), $product->tva_tx, $product->localtax1_tx, $product->localtax2_tx, GETPOST('idprod'.$i, 'int'), price2num(GETPOST('remise_percent'.$i), '', 2), $startday, $endday, 0, 0, '', $product->price_base_type, $product->price_ttc, $product->type, -1, 0, '', 0, 0, null, 0, '', 0, 100, '', $product->fk_unit);
} }
} }
} }
@ -1914,8 +1914,8 @@ if (empty($reshook)) {
$object->fk_project = GETPOST('projectid', 'int'); $object->fk_project = GETPOST('projectid', 'int');
$object->cond_reglement_id = GETPOST('cond_reglement_id', 'int'); $object->cond_reglement_id = GETPOST('cond_reglement_id', 'int');
$object->mode_reglement_id = GETPOST('mode_reglement_id', 'int'); $object->mode_reglement_id = GETPOST('mode_reglement_id', 'int');
$object->remise_absolue =price2num(GETPOST('remise_absolue'), 'MU'); $object->remise_absolue =price2num(GETPOST('remise_absolue'), 'MU', 2);
$object->remise_percent = price2num(GETPOST('remise_percent'), 2); $object->remise_percent = price2num(GETPOST('remise_percent'), '', 2);
// Proprietes particulieres a facture de remplacement // Proprietes particulieres a facture de remplacement
@ -2001,8 +2001,8 @@ if (empty($reshook)) {
$tva_tx = ''; $tva_tx = '';
} }
$qty = price2num(GETPOST('qty'.$predef), 'MS'); $qty = price2num(GETPOST('qty'.$predef), 'MS', 2);
$remise_percent = price2num(GETPOST('remise_percent'.$predef), 2); $remise_percent = price2num(GETPOST('remise_percent'.$predef), '', 2);
// Extrafields // Extrafields
$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line); $extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
@ -2404,6 +2404,8 @@ if (empty($reshook)) {
} }
} }
$remise_percent = price2num(GETPOST('remise_percent'), '', 2);
// Check minimum price // Check minimum price
$productid = GETPOST('productid', 'int'); $productid = GETPOST('productid', 'int');
if (!empty($productid)) { if (!empty($productid)) {
@ -2420,7 +2422,7 @@ if (empty($reshook)) {
$label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : ''); $label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : '');
// Check price is not lower than minimum (check is done only for standard or replacement invoices) // Check price is not lower than minimum (check is done only for standard or replacement invoices)
if ($usercanproductignorepricemin && (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT) && $price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent'), 2) / 100) < price2num($price_min)))) { if ($usercanproductignorepricemin && (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT) && $price_min && (price2num($pu_ht) * (1 - $remise_percent / 100) < price2num($price_min)))) {
setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors'); setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors');
$error++; $error++;
} }
@ -2473,7 +2475,7 @@ if (empty($reshook)) {
$description, $description,
$pu_ht, $pu_ht,
$qty, $qty,
price2num(GETPOST('remise_percent'), 2), $remise_percent,
$date_start, $date_start,
$date_end, $date_end,
$vat_rate, $vat_rate,
@ -4671,7 +4673,7 @@ if ($action == 'create') {
print '<input type="hidden" name="revenuestamp" id="revenuestamp_val" value="'.price2num($object->revenuestamp).'">'; print '<input type="hidden" name="revenuestamp" id="revenuestamp_val" value="'.price2num($object->revenuestamp).'">';
print $formother->select_revenue_stamp('', 'revenuestamp_type', $mysoc->country_code); print $formother->select_revenue_stamp('', 'revenuestamp_type', $mysoc->country_code);
print ' &rarr; <span id="revenuestamp_span"></span>'; print ' &rarr; <span id="revenuestamp_span"></span>';
print ' <input type="submit" class="button buttongen" value="'.$langs->trans('Modify').'">'; print ' <input type="submit" class="button buttongen button-save" value="'.$langs->trans('Modify').'">';
print '</form>'; print '</form>';
print " <script> print " <script>
$(document).ready(function(){ $(document).ready(function(){

View File

@ -74,12 +74,22 @@ $search_montant_vat = GETPOST('search_montant_vat');
$search_montant_ttc = GETPOST('search_montant_ttc'); $search_montant_ttc = GETPOST('search_montant_ttc');
$search_payment_mode = GETPOST('search_payment_mode'); $search_payment_mode = GETPOST('search_payment_mode');
$search_payment_term = GETPOST('search_payment_term'); $search_payment_term = GETPOST('search_payment_term');
$search_day = GETPOST('search_day', 'int'); $search_date_startday = GETPOST('search_date_startday', 'int');
$search_year = GETPOST('search_year', 'int'); $search_date_startmonth = GETPOST('search_date_startmonth', 'int');
$search_month = GETPOST('search_month', 'int'); $search_date_startyear = GETPOST('search_date_startyear', 'int');
$search_day_date_when = GETPOST('search_day_date_when', 'int'); $search_date_endday = GETPOST('search_date_endday', 'int');
$search_year_date_when = GETPOST('search_year_date_when', 'int'); $search_date_endmonth = GETPOST('search_date_endmonth', 'int');
$search_month_date_when = GETPOST('search_month_date_when', 'int'); $search_date_endyear = GETPOST('search_date_endyear', 'int');
$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver
$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
$search_date_when_startday = GETPOST('search_date_when_startday', 'int');
$search_date_when_startmonth = GETPOST('search_date_when_startmonth', 'int');
$search_date_when_startyear = GETPOST('search_date_when_startyear', 'int');
$search_date_when_endday = GETPOST('search_date_when_endday', 'int');
$search_date_when_endmonth = GETPOST('search_date_when_endmonth', 'int');
$search_date_when_endyear = GETPOST('search_date_when_endyear', 'int');
$search_date_when_start = dol_mktime(0, 0, 0, $search_date_when_startmonth, $search_date_when_startday, $search_date_when_startyear); // Use tzserver
$search_date_when_end = dol_mktime(23, 59, 59, $search_date_when_endmonth, $search_date_when_endday, $search_date_when_endyear);
$search_recurring = GETPOST('search_recurring', 'int'); $search_recurring = GETPOST('search_recurring', 'int');
$search_frequency = GETPOST('search_frequency', 'alpha'); $search_frequency = GETPOST('search_frequency', 'alpha');
$search_unit_frequency = GETPOST('search_unit_frequency', 'alpha'); $search_unit_frequency = GETPOST('search_unit_frequency', 'alpha');
@ -206,12 +216,22 @@ if (empty($reshook)) {
$search_montant_ttc = ''; $search_montant_ttc = '';
$search_payment_mode = ''; $search_payment_mode = '';
$search_payment_term = ''; $search_payment_term = '';
$search_day = ''; $search_date_startday = '';
$search_year = ''; $search_date_startmonth = '';
$search_month = ''; $search_date_startyear = '';
$search_day_date_when = ''; $search_date_endday = '';
$search_year_date_when = ''; $search_date_endmonth = '';
$search_month_date_when = ''; $search_date_endyear = '';
$search_date_start = '';
$search_date_end = '';
$search_date_when_startday = '';
$search_date_when_startmonth = '';
$search_date_when_startyear = '';
$search_date_when_endday = '';
$search_date_when_endmonth = '';
$search_date_when_endyear = '';
$search_date_when_start = '';
$search_date_when_end = '';
$search_recurring = ''; $search_recurring = '';
$search_frequency = ''; $search_frequency = '';
$search_unit_frequency = ''; $search_unit_frequency = '';
@ -326,8 +346,18 @@ if ($search_status != '' && $search_status >= -1) {
$sql .= ' AND suspended = 1'; $sql .= ' AND suspended = 1';
} }
} }
$sql .= dolSqlDateFilter('f.date_last_gen', $search_day, $search_month, $search_year); if ($search_date_start) {
$sql .= dolSqlDateFilter('f.date_when', $search_day_date_when, $search_month_date_when, $search_year_date_when); $sql .= " AND f.date_last_gen >= '".$db->idate($search_date_start)."'";
}
if ($search_date_end) {
$sql .= " AND f.date_last_gen <= '".$db->idate($search_date_end)."'";
}
if ($search_date_when_start) {
$sql .= " AND f.date_when >= '".$db->idate($search_date_when_start)."'";
}
if ($search_date_when_end) {
$sql .= " AND f.date_when <= '".$db->idate($search_date_when_end)."'";
}
$sql .= $db->order($sortfield, $sortorder); $sql .= $db->order($sortfield, $sortorder);
@ -357,23 +387,41 @@ if ($resql) {
if ($socid > 0) { if ($socid > 0) {
$param .= '&socid='.urlencode($socid); $param .= '&socid='.urlencode($socid);
} }
if ($search_day) { if ($search_date_startday) {
$param .= '&search_day='.urlencode($search_day); $param .= '&search_date_startday='.urlencode($search_date_startday);
} }
if ($search_month) { if ($search_date_startmonth) {
$param .= '&search_month='.urlencode($search_month); $param .= '&search_date_startmonth='.urlencode($search_date_startmonth);
} }
if ($search_year) { if ($search_date_startyear) {
$param .= '&search_year='.urlencode($search_year); $param .= '&search_date_startyear='.urlencode($search_date_startyear);
} }
if ($search_day_date_when) { if ($search_date_endday) {
$param .= '&search_day_date_when='.urlencode($search_day_date_when); $param .= '&search_date_endday='.urlencode($search_date_endday);
} }
if ($search_month_date_when) { if ($search_date_endmonth) {
$param .= '&search_month_date_when='.urlencode($search_month_date_when); $param .= '&search_date_endmonth='.urlencode($search_date_endmonth);
} }
if ($search_year_date_when) { if ($search_date_endyear) {
$param .= '&search_year_date_when='.urlencode($search_year_date_when); $param .= '&search_date_endyear='.urlencode($search_date_endyear);
}
if ($search_date_when_startday) {
$param .= '&search_date_when_startday='.urlencode($search_date_when_startday);
}
if ($search_date_when_startmonth) {
$param .= '&search_date_when_startmonth='.urlencode($search_date_when_startmonth);
}
if ($search_date_when_startyear) {
$param .= '&search_date_when_startyear='.urlencode($search_date_when_startyear);
}
if ($search_date_when_endday) {
$param .= '&search_date_when_endday='.urlencode($search_date_when_endday);
}
if ($search_date_when_endmonth) {
$param .= '&search_date_when_endmonth='.urlencode($search_date_when_endmonth);
}
if ($search_date_when_endyear) {
$param .= '&search_date_when_endyear='.urlencode($search_date_when_endyear);
} }
if ($search_ref) { if ($search_ref) {
$param .= '&search_ref='.urlencode($search_ref); $param .= '&search_ref='.urlencode($search_ref);
@ -453,7 +501,7 @@ if ($resql) {
print '<input class="flat maxwidth100" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">'; print '<input class="flat maxwidth100" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
print '</td>'; print '</td>';
} }
// Thirpdarty // Thirdparty
if (!empty($arrayfields['s.nom']['checked'])) { if (!empty($arrayfields['s.nom']['checked'])) {
print '<td class="liste_titre left"><input class="flat" type="text" size="8" name="search_societe" value="'.dol_escape_htmltag($search_societe).'"></td>'; print '<td class="liste_titre left"><input class="flat" type="text" size="8" name="search_societe" value="'.dol_escape_htmltag($search_societe).'"></td>';
} }
@ -489,19 +537,19 @@ if ($resql) {
} }
if (!empty($arrayfields['recurring']['checked'])) { if (!empty($arrayfields['recurring']['checked'])) {
// Recurring or not // Recurring or not
print '<td class="liste_titre" align="center">'; print '<td class="liste_titre center">';
print $form->selectyesno('search_recurring', $search_recurring, 1, false, 1); print $form->selectyesno('search_recurring', $search_recurring, 1, false, 1);
print '</td>'; print '</td>';
} }
if (!empty($arrayfields['f.frequency']['checked'])) { if (!empty($arrayfields['f.frequency']['checked'])) {
// Recurring or not // Recurring or not
print '<td class="liste_titre" align="center">'; print '<td class="liste_titre center">';
print '<input class="flat" type="text" size="1" name="search_frequency" value="'.dol_escape_htmltag($search_frequency).'">'; print '<input class="flat" type="text" size="1" name="search_frequency" value="'.dol_escape_htmltag($search_frequency).'">';
print '</td>'; print '</td>';
} }
if (!empty($arrayfields['f.unit_frequency']['checked'])) { if (!empty($arrayfields['f.unit_frequency']['checked'])) {
// Frequency unit // Frequency unit
print '<td class="liste_titre" align="center">'; print '<td class="liste_titre center">';
print '<input class="flat" type="text" size="1" name="search_unit_frequency" value="'.dol_escape_htmltag($search_unit_frequency).'">'; print '<input class="flat" type="text" size="1" name="search_unit_frequency" value="'.dol_escape_htmltag($search_unit_frequency).'">';
print '</td>'; print '</td>';
} }
@ -512,22 +560,24 @@ if ($resql) {
} }
// Date invoice // Date invoice
if (!empty($arrayfields['f.date_last_gen']['checked'])) { if (!empty($arrayfields['f.date_last_gen']['checked'])) {
print '<td class="liste_titre nowraponall" align="center">'; print '<td class="liste_titre center">';
if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) { print '<div class="nowrap">';
print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_day" value="'.$search_day.'">'; print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
} print '</div>';
print '<input class="flat valignmiddle width25" type="text" size="1" maxlength="2" name="search_month" value="'.$search_month.'">'; print '<div class="nowrap">';
$formother->select_year($search_year ? $search_year : -1, 'search_year', 1, 20, 5, 0, 0, '', 'widthauto valignmiddle'); print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
print '</div>';
print '</td>'; print '</td>';
} }
// Date next generation // Date next generation
if (!empty($arrayfields['f.date_when']['checked'])) { if (!empty($arrayfields['f.date_when']['checked'])) {
print '<td class="liste_titre nowraponall" align="center">'; print '<td class="liste_titre center">';
if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) { print '<div class="nowrap">';
print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_day_date_when" value="'.$search_day_date_when.'">'; print $form->selectDate($search_date_when_start ? $search_date_when_start : -1, 'search_date_when_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
} print '</div>';
print '<input class="flat valignmiddle width25" type="text" size="1" maxlength="2" name="search_month_date_when" value="'.$search_month_date_when.'">'; print '<div class="nowrap">';
$formother->select_year($search_year_date_when ? $search_year_date_when : -1, 'search_year_date_when', 1, 20, 5, 0, 0, '', 'widthauto valignmiddle'); print $form->selectDate($search_date_when_end ? $search_date_when_end : -1, 'search_date_when_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
print '</div>';
print '</td>'; print '</td>';
} }
// Extra fields // Extra fields
@ -559,7 +609,7 @@ if ($resql) {
} }
// Status // Status
if (!empty($arrayfields['status']['checked'])) { if (!empty($arrayfields['status']['checked'])) {
print '<td class="liste_titre" align="center">'; print '<td class="liste_titre center">';
$liststatus = array( $liststatus = array(
0=>$langs->trans("Draft"), 0=>$langs->trans("Draft"),
1=>$langs->trans("Active"), 1=>$langs->trans("Active"),

View File

@ -321,6 +321,12 @@ if ($search_company) {
if ($search_amount != '') { if ($search_amount != '') {
$param .= '&search_amount='.urlencode($search_amount); $param .= '&search_amount='.urlencode($search_amount);
} }
if ($search_paymenttype) {
$param .= '&search_paymenttype='.urlencode($search_paymenttype);
}
if ($search_account) {
$param .= '&search_account='.urlencode($search_account);
}
if ($search_payment_num) { if ($search_payment_num) {
$param .= '&search_payment_num='.urlencode($search_payment_num); $param .= '&search_payment_num='.urlencode($search_payment_num);
} }

View File

@ -95,7 +95,9 @@ if (empty($reshook)) {
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$bank = new Account($db); $bank = new Account($db);
$bank->fetch($conf->global->{$default_account}); $bank->fetch($conf->global->{$default_account});
if (empty($bank->ics) || empty($bank->ics_transfer)) { if ((empty($bank->ics) && $type !== 'bank-transfer')
|| (empty($bank->ics_transfer) && $type === 'bank-transfer')
) {
$errormessage = str_replace('{url}', $bank->getNomUrl(1, '', '', -1, 1), $langs->trans("ErrorICSmissing", '{url}')); $errormessage = str_replace('{url}', $bank->getNomUrl(1, '', '', -1, 1), $langs->trans("ErrorICSmissing", '{url}'));
setEventMessages($errormessage, null, 'errors'); setEventMessages($errormessage, null, 'errors');
header("Location: ".DOL_URL_ROOT.'/compta/prelevement/create.php'); header("Location: ".DOL_URL_ROOT.'/compta/prelevement/create.php');

View File

@ -4,8 +4,9 @@
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2016 Frédéric France <frederic.france@free.fr> * Copyright (C) 2016 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2020 Pierre Ardoin <mapiolca@me.com> * Copyright (C) 2020 Pierre Ardoin <mapiolca@me.com>
* Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com> * Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr> * Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -50,9 +51,22 @@ $search_ref = GETPOST('search_ref', 'int');
$search_label = GETPOST('search_label', 'alpha'); $search_label = GETPOST('search_label', 'alpha');
$search_amount = GETPOST('search_amount', 'alpha'); $search_amount = GETPOST('search_amount', 'alpha');
$search_status = GETPOST('search_status', 'int'); $search_status = GETPOST('search_status', 'int');
$search_day_lim = GETPOST('search_day_lim', 'int'); $search_date_startday = GETPOST('search_date_startday', 'int');
$search_month_lim = GETPOST('search_month_lim', 'int'); $search_date_startmonth = GETPOST('search_date_startmonth', 'int');
$search_year_lim = GETPOST('search_year_lim', 'int'); $search_date_startyear = GETPOST('search_date_startyear', 'int');
$search_date_endday = GETPOST('search_date_endday', 'int');
$search_date_endmonth = GETPOST('search_date_endmonth', 'int');
$search_date_endyear = GETPOST('search_date_endyear', 'int');
$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver
$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
$search_date_limit_startday = GETPOST('search_date_limit_startday', 'int');
$search_date_limit_startmonth = GETPOST('search_date_limit_startmonth', 'int');
$search_date_limit_startyear = GETPOST('search_date_limit_startyear', 'int');
$search_date_limit_endday = GETPOST('search_date_limit_endday', 'int');
$search_date_limit_endmonth = GETPOST('search_date_limit_endmonth', 'int');
$search_date_limit_endyear = GETPOST('search_date_limit_endyear', 'int');
$search_date_limit_start = dol_mktime(0, 0, 0, $search_date_limit_startmonth, $search_date_limit_startday, $search_date_limit_startyear);
$search_date_limit_end = dol_mktime(23, 59, 59, $search_date_limit_endmonth, $search_date_limit_endday, $search_date_limit_endyear);
$search_project_ref = GETPOST('search_project_ref', 'alpha'); $search_project_ref = GETPOST('search_project_ref', 'alpha');
$search_project = GETPOST('search_project', 'alpha'); $search_project = GETPOST('search_project', 'alpha');
$search_users = GETPOST('search_users'); $search_users = GETPOST('search_users');
@ -78,7 +92,6 @@ if (!$sortorder) {
$sortorder = "DESC"; $sortorder = "DESC";
} }
$year = GETPOST("year", 'int');
$filtre = GETPOST("filtre", 'int'); $filtre = GETPOST("filtre", 'int');
if (!GETPOSTISSET('search_typeid')) { if (!GETPOSTISSET('search_typeid')) {
@ -146,10 +159,22 @@ if (empty($reshook)) {
$search_amount = ''; $search_amount = '';
$search_status = ''; $search_status = '';
$search_typeid = ''; $search_typeid = '';
$year = ''; $search_date_startday = '';
$search_day_lim = ''; $search_date_startmonth = '';
$search_year_lim = ''; $search_date_startyear = '';
$search_month_lim = ''; $search_date_endday = '';
$search_date_endmonth = '';
$search_date_endyear = '';
$search_date_start = '';
$search_date_end = '';
$search_date_limit_startday = '';
$search_date_limit_startmonth = '';
$search_date_limit_startyear = '';
$search_date_limit_endday = '';
$search_date_limit_endmonth = '';
$search_date_limit_endyear = '';
$search_date_limit_start = '';
$search_date_limit_end = '';
$search_project_ref = ''; $search_project_ref = '';
$search_project = ''; $search_project = '';
$search_users = ''; $search_users = '';
@ -192,7 +217,7 @@ if (!empty($conf->projet->enabled)) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiementcharge as pc ON pc.fk_charge = cs.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiementcharge as pc ON pc.fk_charge = cs.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON (cs.fk_user = u.rowid)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON (cs.fk_user = u.rowid)";
$sql .= " WHERE cs.fk_type = c.id"; $sql .= " WHERE cs.fk_type = c.id";
$sql .= " AND cs.entity = ".$conf->entity; $sql .= " AND cs.entity = ".((int) $conf->entity);
// Search criteria // Search criteria
if ($search_ref) { if ($search_ref) {
$sql .= " AND cs.ref = '".$db->escape($search_ref)."'"; $sql .= " AND cs.ref = '".$db->escape($search_ref)."'";
@ -220,15 +245,17 @@ if ($search_amount) {
if ($search_status != '' && $search_status >= 0) { if ($search_status != '' && $search_status >= 0) {
$sql .= " AND cs.paye = ".((int) $search_status); $sql .= " AND cs.paye = ".((int) $search_status);
} }
$sql .= dolSqlDateFilter("cs.periode", $search_day_lim, $search_month_lim, $search_year_lim); if ($search_date_start) {
//$sql.= dolSqlDateFilter("cs.periode", 0, 0, $year); $sql .= " AND cs.date_ech >= '".$db->idate($search_date_start)."'";
if ($year > 0) { }
$sql .= " AND ("; if ($search_date_end) {
// Si period renseignee on l'utilise comme critere de date, sinon on prend date echeance, $sql .= " AND cs.date_ech <= '".$db->idate($search_date_end)."'";
// ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire }
$sql .= " (cs.periode IS NOT NULL AND date_format(cs.periode, '%Y') = '".$db->escape($year)."') "; if ($search_date_limit_start) {
$sql .= "OR (cs.periode IS NULL AND date_format(cs.date_ech, '%Y') = '".$db->escape($year)."')"; $sql .= " AND cs.periode >= '".$db->idate($search_date_limit_start)."'";
$sql .= ")"; }
if ($search_date_limit_end) {
$sql .= " AND cs.periode <= '".$db->idate($search_date_limit_end)."'";
} }
if ($search_typeid > 0) { if ($search_typeid > 0) {
$sql .= " AND cs.fk_type = ".((int) $search_typeid); $sql .= " AND cs.fk_type = ".((int) $search_typeid);
@ -293,8 +320,41 @@ if ($search_account) {
if ($search_status != '' && $search_status != '-1') { if ($search_status != '' && $search_status != '-1') {
$param .= '&search_status='.urlencode($search_status); $param .= '&search_status='.urlencode($search_status);
} }
if ($year) { if ($search_date_startday) {
$param .= '&year='.urlencode($year); $param .= '&search_date_startday='.urlencode($search_date_startday);
}
if ($search_date_startmonth) {
$param .= '&search_date_startmonth='.urlencode($search_date_startmonth);
}
if ($search_date_startyear) {
$param .= '&search_date_startyear='.urlencode($search_date_startyear);
}
if ($search_date_endday) {
$param .= '&search_date_endday='.urlencode($search_date_endday);
}
if ($search_date_endmonth) {
$param .= '&search_date_endmonth='.urlencode($search_date_endmonth);
}
if ($search_date_endyear) {
$param .= '&search_date_endyear='.urlencode($search_date_endyear);
}
if ($search_date_limit_startday) {
$param .= '&search_date_limit_startday='.urlencode($search_date_limit_startday);
}
if ($search_date_limit_startmonth) {
$param .= '&search_date_limit_startmonth='.urlencode($search_date_limit_startmonth);
}
if ($search_date_limit_startyear) {
$param .= '&search_date_limit_startyear='.urlencode($search_date_limit_startyear);
}
if ($search_date_limit_endday) {
$param .= '&search_date_limit_endday='.urlencode($search_date_limit_endday);
}
if ($search_date_limit_endmonth) {
$param .= '&search_date_limit_endmonth='.urlencode($search_date_limit_endmonth);
}
if ($search_date_limit_endyear) {
$param .= '&search_date_limit_endyear='.urlencode($search_date_limit_endyear);
} }
$newcardbutton = ''; $newcardbutton = '';
@ -315,11 +375,6 @@ print '<input type="hidden" name="search_status" value="'.$search_status.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">'; print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
$center = ''; $center = '';
if ($year) {
$center = '<a href="list.php?year='.($year - 1).'">'.img_previous().'</a>';
$center .= ' '.$langs->trans("Year").' '.$year;
$center .= ' <a href="list.php?year='.($year + 1).'">'.img_next().'</a>';
}
print_barre_liste($langs->trans("SocialContributions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $totalnboflines, 'bill', 0, $newcardbutton, '', $limit, 0, 0, 1); print_barre_liste($langs->trans("SocialContributions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $totalnboflines, 'bill', 0, $newcardbutton, '', $limit, 0, 0, 1);
@ -375,18 +430,25 @@ if (!empty($arrayfields['cs.fk_type']['checked'])) {
// Filter: Date (placeholder) // Filter: Date (placeholder)
if (!empty($arrayfields['cs.date_ech']['checked'])) { if (!empty($arrayfields['cs.date_ech']['checked'])) {
print '<td class="liste_titre">'; print '<td class="liste_titre center">';
print '<div class="nowrap">';
print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
print '</div>';
print '<div class="nowrap">';
print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
print '</div>';
print '</td>'; print '</td>';
} }
// Filter: Period end date // Filter: Period end date
if (!empty($arrayfields['cs.periode']['checked'])) { if (!empty($arrayfields['cs.periode']['checked'])) {
print '<td class="liste_titre center">'; print '<td class="liste_titre center">';
if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) { print '<div class="nowrap">';
print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_day_lim" value="'.dol_escape_htmltag($search_day_lim).'">'; print $form->selectDate($search_date_limit_start ? $search_date_limit_start : -1, 'search_date_limit_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
} print '</div>';
print '<input class="flat valignmiddle width25" type="text" size="1" maxlength="2" name="search_month_lim" value="'.dol_escape_htmltag($search_month_lim).'">'; print '<div class="nowrap">';
$formother->select_year($search_year_lim ? $search_year_lim : -1, 'search_year_lim', 1, 20, 5, 0, 0, '', 'widthauto valignmiddle'); print $form->selectDate($search_date_limit_end ? $search_date_limit_end : -1, 'search_date_limit_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
print '</div>';
print '</td>'; print '</td>';
} }
@ -452,13 +514,13 @@ if (!empty($arrayfields['cs.rowid']['checked'])) {
print_liste_field_titre($arrayfields['cs.rowid']['label'], $_SERVER["PHP_SELF"], "cs.rowid", '', $param, '', $sortfield, $sortorder); print_liste_field_titre($arrayfields['cs.rowid']['label'], $_SERVER["PHP_SELF"], "cs.rowid", '', $param, '', $sortfield, $sortorder);
} }
if (!empty($arrayfields['cs.libelle']['checked'])) { if (!empty($arrayfields['cs.libelle']['checked'])) {
print_liste_field_titre($arrayfields['cs.libelle']['label'], $_SERVER["PHP_SELF"], "cs.libelle", '', $param, '', $sortfield, $sortorder); print_liste_field_titre($arrayfields['cs.libelle']['label'], $_SERVER["PHP_SELF"], "cs.libelle,cs.periode", '', $param, '', $sortfield, $sortorder);
} }
if (!empty($arrayfields['cs.fk_type']['checked'])) { if (!empty($arrayfields['cs.fk_type']['checked'])) {
print_liste_field_titre($arrayfields['cs.fk_type']['label'], $_SERVER["PHP_SELF"], "cs.fk_type", '', $param, '', $sortfield, $sortorder); print_liste_field_titre($arrayfields['cs.fk_type']['label'], $_SERVER["PHP_SELF"], "cs.fk_type,cs.periode", '', $param, '', $sortfield, $sortorder);
} }
if (!empty($arrayfields['cs.date_ech']['checked'])) { if (!empty($arrayfields['cs.date_ech']['checked'])) {
print_liste_field_titre($arrayfields['cs.date_ech']['label'], $_SERVER["PHP_SELF"], "cs.date_ech", '', $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre($arrayfields['cs.date_ech']['label'], $_SERVER["PHP_SELF"], "cs.date_ech,cs.periode", '', $param, '', $sortfield, $sortorder, 'center ');
} }
if (!empty($arrayfields['cs.periode']['checked'])) { if (!empty($arrayfields['cs.periode']['checked'])) {
print_liste_field_titre($arrayfields['cs.periode']['label'], $_SERVER["PHP_SELF"], "cs.periode", '', $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre($arrayfields['cs.periode']['label'], $_SERVER["PHP_SELF"], "cs.periode", '', $param, '', $sortfield, $sortorder, 'center ');
@ -467,19 +529,19 @@ if (!empty($arrayfields['p.ref']['checked'])) {
print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], "p.ref", '', $param, '', $sortfield, $sortorder); print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], "p.ref", '', $param, '', $sortfield, $sortorder);
} }
if (!empty($arrayfields['cs.fk_user']['checked'])) { if (!empty($arrayfields['cs.fk_user']['checked'])) {
print_liste_field_titre("Employee", $_SERVER["PHP_SELF"], "u.lastname", "", $param, 'class="left"', $sortfield, $sortorder); print_liste_field_titre("Employee", $_SERVER["PHP_SELF"], "u.lastname,cs.periode", "", $param, 'class="left"', $sortfield, $sortorder);
} }
if (!empty($arrayfields['cs.fk_mode_reglement']['checked'])) { if (!empty($arrayfields['cs.fk_mode_reglement']['checked'])) {
print_liste_field_titre($arrayfields['cs.fk_mode_reglement']['label'], $_SERVER["PHP_SELF"], "cs.fk_mode_reglement", '', $param, '', $sortfield, $sortorder); print_liste_field_titre($arrayfields['cs.fk_mode_reglement']['label'], $_SERVER["PHP_SELF"], "cs.fk_mode_reglement,cs.periode", '', $param, '', $sortfield, $sortorder);
} }
if (!empty($arrayfields['cs.fk_account']['checked'])) { if (!empty($arrayfields['cs.fk_account']['checked'])) {
print_liste_field_titre($arrayfields['cs.fk_account']['label'], $_SERVER["PHP_SELF"], "cs.fk_account", '', $param, '', $sortfield, $sortorder); print_liste_field_titre($arrayfields['cs.fk_account']['label'], $_SERVER["PHP_SELF"], "cs.fk_account,cs.periode", '', $param, '', $sortfield, $sortorder);
} }
if (!empty($arrayfields['cs.amount']['checked'])) { if (!empty($arrayfields['cs.amount']['checked'])) {
print_liste_field_titre($arrayfields['cs.amount']['label'], $_SERVER["PHP_SELF"], "cs.amount", '', $param, 'class="right"', $sortfield, $sortorder); print_liste_field_titre($arrayfields['cs.amount']['label'], $_SERVER["PHP_SELF"], "cs.amount,cs.periode", '', $param, 'class="right"', $sortfield, $sortorder);
} }
if (!empty($arrayfields['cs.paye']['checked'])) { if (!empty($arrayfields['cs.paye']['checked'])) {
print_liste_field_titre($arrayfields['cs.paye']['label'], $_SERVER["PHP_SELF"], "cs.paye", '', $param, 'class="right"', $sortfield, $sortorder); print_liste_field_titre($arrayfields['cs.paye']['label'], $_SERVER["PHP_SELF"], "cs.paye,cs.periode", '', $param, 'class="right"', $sortfield, $sortorder);
} }
// Hook fields // Hook fields
@ -549,13 +611,7 @@ while ($i < min($num, $limit)) {
// Date end period // Date end period
if (!empty($arrayfields['cs.periode']['checked'])) { if (!empty($arrayfields['cs.periode']['checked'])) {
print '<td class="center">'; print '<td class="center">'.dol_print_date($db->jdate($obj->periode), 'day').'</td>';
if ($obj->periode) {
print '<a href="list.php?search_year_lim='.dol_print_date($db->jdate($obj->periode), "%Y").'">';
print dol_print_date($db->jdate($obj->periode), 'day');
print '</a>';
}
print '</td>';
if (!$i) { if (!$i) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
} }

View File

@ -437,7 +437,7 @@ if ($action == 'create') {
print '<tr><td colspan="2"><hr></td></tr>'; print '<tr><td colspan="2"><hr></td></tr>';
// Auto create payment // Auto create payment
print '<tr><td>'.$langs->trans('AutomaticCreationPayment').'</td>'; print '<tr><td><label for="auto_create_paiement">'.$langs->trans('AutomaticCreationPayment').'</label></td>';
print '<td><input id="auto_create_paiement" name="auto_create_paiement" type="checkbox" ' . (empty($auto_create_payment) ? '' : 'checked="checked"') . ' value="1"></td></tr>'."\n"; print '<td><input id="auto_create_paiement" name="auto_create_paiement" type="checkbox" ' . (empty($auto_create_payment) ? '' : 'checked="checked"') . ' value="1"></td></tr>'."\n";
print '<tr class="hide_if_no_auto_create_payment">'; print '<tr class="hide_if_no_auto_create_payment">';

View File

@ -1172,25 +1172,25 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if (!empty($conf->commande->enabled)) { if (!empty($conf->commande->enabled)) {
print '<tr><td>'.$langs->trans("ContactForOrders").'</td><td colspan="3">'; print '<tr><td>'.$langs->trans("ContactForOrders").'</td><td colspan="3">';
print $object->ref_commande ? $object->ref_commande : $langs->trans("NoContactForAnyOrder"); print $object->ref_commande ? $object->ref_commande : ('<span class="opacitymedium">'.$langs->trans("NoContactForAnyOrder").'</span>');
print '</td></tr>'; print '</td></tr>';
} }
if (!empty($conf->propal->enabled)) { if (!empty($conf->propal->enabled)) {
print '<tr><td>'.$langs->trans("ContactForProposals").'</td><td colspan="3">'; print '<tr><td>'.$langs->trans("ContactForProposals").'</td><td colspan="3">';
print $object->ref_propal ? $object->ref_propal : $langs->trans("NoContactForAnyProposal"); print $object->ref_propal ? $object->ref_propal : ('<span class="opacitymedium">'.$langs->trans("NoContactForAnyProposal").'</span>');
print '</td></tr>'; print '</td></tr>';
} }
if (!empty($conf->contrat->enabled)) { if (!empty($conf->contrat->enabled)) {
print '<tr><td>'.$langs->trans("ContactForContracts").'</td><td colspan="3">'; print '<tr><td>'.$langs->trans("ContactForContracts").'</td><td colspan="3">';
print $object->ref_contrat ? $object->ref_contrat : $langs->trans("NoContactForAnyContract"); print $object->ref_contrat ? $object->ref_contrat : ('<span class="opacitymedium">'.$langs->trans("NoContactForAnyContract").'</span>');
print '</td></tr>'; print '</td></tr>';
} }
if (!empty($conf->facture->enabled)) { if (!empty($conf->facture->enabled)) {
print '<tr><td>'.$langs->trans("ContactForInvoices").'</td><td colspan="3">'; print '<tr><td>'.$langs->trans("ContactForInvoices").'</td><td colspan="3">';
print $object->ref_facturation ? $object->ref_facturation : $langs->trans("NoContactForAnyInvoice"); print $object->ref_facturation ? $object->ref_facturation : ('<span class="opacitymedium">'.$langs->trans("NoContactForAnyInvoice").'</span>');
print '</td></tr>'; print '</td></tr>';
} }
@ -1201,7 +1201,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$result = $dolibarr_user->fetch($object->user_id); $result = $dolibarr_user->fetch($object->user_id);
print $dolibarr_user->getLoginUrl(1); print $dolibarr_user->getLoginUrl(1);
} else { } else {
print $langs->trans("NoDolibarrAccess"); print '<span class="opacitymedium">'.$langs->trans("NoDolibarrAccess").'</span>';
} }
print '</td></tr>'; print '</td></tr>';

View File

@ -90,21 +90,19 @@ class Contact extends CommonObject
*/ */
public $fields = array( public $fields = array(
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>15),
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>20),
'fk_soc' =>array('type'=>'integer', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>1, 'position'=>25, 'searchall'=>1),
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>3, 'notnull'=>1, 'position'=>30, 'index'=>1), 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>3, 'notnull'=>1, 'position'=>30, 'index'=>1),
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>3, 'position'=>35), 'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>3, 'position'=>35),
'civility' =>array('type'=>'varchar(6)', 'label'=>'Civility', 'enabled'=>1, 'visible'=>3, 'position'=>40), 'civility' =>array('type'=>'varchar(6)', 'label'=>'Civility', 'enabled'=>1, 'visible'=>3, 'position'=>40),
'lastname' =>array('type'=>'varchar(50)', 'label'=>'Lastname', 'enabled'=>1, 'visible'=>1, 'position'=>45, 'showoncombobox'=>1, 'searchall'=>1), 'lastname' =>array('type'=>'varchar(50)', 'label'=>'Lastname', 'enabled'=>1, 'visible'=>1, 'position'=>45, 'showoncombobox'=>1, 'searchall'=>1),
'firstname' =>array('type'=>'varchar(50)', 'label'=>'Firstname', 'enabled'=>1, 'visible'=>1, 'position'=>50, 'showoncombobox'=>1, 'searchall'=>1), 'firstname' =>array('type'=>'varchar(50)', 'label'=>'Firstname', 'enabled'=>1, 'visible'=>1, 'position'=>50, 'showoncombobox'=>1, 'searchall'=>1),
'poste' =>array('type'=>'varchar(80)', 'label'=>'PostOrFunction', 'enabled'=>1, 'visible'=>-1, 'position'=>52),
'address' =>array('type'=>'varchar(255)', 'label'=>'Address', 'enabled'=>1, 'visible'=>-1, 'position'=>55), 'address' =>array('type'=>'varchar(255)', 'label'=>'Address', 'enabled'=>1, 'visible'=>-1, 'position'=>55),
'zip' =>array('type'=>'varchar(25)', 'label'=>'Zip', 'enabled'=>1, 'visible'=>1, 'position'=>60), 'zip' =>array('type'=>'varchar(25)', 'label'=>'Zip', 'enabled'=>1, 'visible'=>1, 'position'=>60),
'town' =>array('type'=>'text', 'label'=>'Town', 'enabled'=>1, 'visible'=>-1, 'position'=>65), 'town' =>array('type'=>'text', 'label'=>'Town', 'enabled'=>1, 'visible'=>-1, 'position'=>65),
'fk_departement' =>array('type'=>'integer', 'label'=>'Fk departement', 'enabled'=>1, 'visible'=>3, 'position'=>70), 'fk_departement' =>array('type'=>'integer', 'label'=>'Fk departement', 'enabled'=>1, 'visible'=>3, 'position'=>70),
'fk_pays' =>array('type'=>'integer', 'label'=>'Fk pays', 'enabled'=>1, 'visible'=>3, 'position'=>75), 'fk_pays' =>array('type'=>'integer', 'label'=>'Fk pays', 'enabled'=>1, 'visible'=>3, 'position'=>75),
'fk_soc' =>array('type'=>'integer', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>1, 'position'=>77, 'searchall'=>1),
'birthday' =>array('type'=>'date', 'label'=>'Birthday', 'enabled'=>1, 'visible'=>3, 'position'=>80), 'birthday' =>array('type'=>'date', 'label'=>'Birthday', 'enabled'=>1, 'visible'=>3, 'position'=>80),
'poste' =>array('type'=>'varchar(80)', 'label'=>'PostOrFunction', 'enabled'=>1, 'visible'=>-1, 'position'=>85),
'phone' =>array('type'=>'varchar(30)', 'label'=>'Phone', 'enabled'=>1, 'visible'=>1, 'position'=>90, 'searchall'=>1), 'phone' =>array('type'=>'varchar(30)', 'label'=>'Phone', 'enabled'=>1, 'visible'=>1, 'position'=>90, 'searchall'=>1),
'phone_perso' =>array('type'=>'varchar(30)', 'label'=>'PhonePerso', 'enabled'=>1, 'visible'=>-1, 'position'=>95, 'searchall'=>1), 'phone_perso' =>array('type'=>'varchar(30)', 'label'=>'PhonePerso', 'enabled'=>1, 'visible'=>-1, 'position'=>95, 'searchall'=>1),
'phone_mobile' =>array('type'=>'varchar(30)', 'label'=>'PhoneMobile', 'enabled'=>1, 'visible'=>1, 'position'=>100, 'searchall'=>1), 'phone_mobile' =>array('type'=>'varchar(30)', 'label'=>'PhoneMobile', 'enabled'=>1, 'visible'=>1, 'position'=>100, 'searchall'=>1),
@ -113,15 +111,17 @@ class Contact extends CommonObject
'socialnetworks' =>array('type'=>'text', 'label'=>'SocialNetworks', 'enabled'=>1, 'visible'=>3, 'position'=>115), 'socialnetworks' =>array('type'=>'text', 'label'=>'SocialNetworks', 'enabled'=>1, 'visible'=>3, 'position'=>115),
'photo' =>array('type'=>'varchar(255)', 'label'=>'Photo', 'enabled'=>1, 'visible'=>3, 'position'=>170), 'photo' =>array('type'=>'varchar(255)', 'label'=>'Photo', 'enabled'=>1, 'visible'=>3, 'position'=>170),
'priv' =>array('type'=>'smallint(6)', 'label'=>'ContactVisibility', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>175), 'priv' =>array('type'=>'smallint(6)', 'label'=>'ContactVisibility', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>175),
'fk_stcommcontact' =>array('type'=>'integer', 'label'=>'Fk stcommcontact', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>220), 'fk_stcommcontact' =>array('type'=>'integer', 'label'=>'ProspectStatus', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>220),
'fk_prospectlevel' =>array('type'=>'varchar(12)', 'label'=>'ProspectLevel', 'enabled'=>1, 'visible'=>-1, 'position'=>255), 'fk_prospectlevel' =>array('type'=>'varchar(12)', 'label'=>'ProspectLevel', 'enabled'=>1, 'visible'=>-1, 'position'=>255),
'no_email' =>array('type'=>'smallint(6)', 'label'=>'No_Email', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>180), 'no_email' =>array('type'=>'smallint(6)', 'label'=>'No_Email', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>180),
'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>3, 'position'=>185),
'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>3, 'position'=>190),
'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>3, 'position'=>195, 'searchall'=>1), 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>3, 'position'=>195, 'searchall'=>1),
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>3, 'position'=>200, 'searchall'=>1), 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>3, 'position'=>200, 'searchall'=>1),
'default_lang' =>array('type'=>'varchar(6)', 'label'=>'Default lang', 'enabled'=>1, 'visible'=>3, 'position'=>205), 'default_lang' =>array('type'=>'varchar(6)', 'label'=>'Default lang', 'enabled'=>1, 'visible'=>3, 'position'=>205),
'canvas' =>array('type'=>'varchar(32)', 'label'=>'Canvas', 'enabled'=>1, 'visible'=>3, 'position'=>210), 'canvas' =>array('type'=>'varchar(32)', 'label'=>'Canvas', 'enabled'=>1, 'visible'=>3, 'position'=>210),
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>300),
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>305),
'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>3, 'position'=>310),
'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>3, 'position'=>315),
'statut' =>array('type'=>'tinyint(4)', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>500), 'statut' =>array('type'=>'tinyint(4)', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>500),
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-1, 'position'=>1000), 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-1, 'position'=>1000),
); );

View File

@ -227,7 +227,7 @@ if (empty($reshook)) {
$object->note_private = GETPOST('note_private', 'alpha'); $object->note_private = GETPOST('note_private', 'alpha');
$object->note_public = GETPOST('note_public', 'alpha'); $object->note_public = GETPOST('note_public', 'alpha');
$object->fk_project = GETPOST('projectid', 'int'); $object->fk_project = GETPOST('projectid', 'int');
$object->remise_percent = price2num(GETPOST('remise_percent'), 2); $object->remise_percent = price2num(GETPOST('remise_percent'), '', 2);
$object->ref = GETPOST('ref', 'alpha'); $object->ref = GETPOST('ref', 'alpha');
$object->ref_customer = GETPOST('ref_customer', 'alpha'); $object->ref_customer = GETPOST('ref_customer', 'alpha');
$object->ref_supplier = GETPOST('ref_supplier', 'alpha'); $object->ref_supplier = GETPOST('ref_supplier', 'alpha');
@ -1202,12 +1202,8 @@ if ($action == 'create') {
} }
print "</form>\n"; print "</form>\n";
} else /* *************************************************************************** */ } else {
/* */ // View and edit mode
/* Mode vue et edition */
/* */
/* *************************************************************************** */
{
$now = dol_now(); $now = dol_now();
if ($object->id > 0) { if ($object->id > 0) {

View File

@ -131,6 +131,10 @@ if ($action == 'add' && !empty($permissiontoadd)) {
$result = $object->create($user); $result = $object->create($user);
if ($result > 0) { if ($result > 0) {
// Creation OK // Creation OK
if ($conf->categorie->enabled) {
$categories = GETPOST('categories', 'array');
$object->setCategories($categories);
}
$urltogo = $backtopage ? str_replace('__ID__', $result, $backtopage) : $backurlforlist; $urltogo = $backtopage ? str_replace('__ID__', $result, $backtopage) : $backurlforlist;
$urltogo = preg_replace('/--IDFORBACKTOPAGE--/', $object->id, $urltogo); // New method to autoselect project after a New on another form object creation $urltogo = preg_replace('/--IDFORBACKTOPAGE--/', $object->id, $urltogo); // New method to autoselect project after a New on another form object creation
header("Location: ".$urltogo); header("Location: ".$urltogo);
@ -229,6 +233,11 @@ if ($action == 'update' && !empty($permissiontoadd)) {
} }
} }
} }
if ($conf->categorie->enabled) {
$categories = GETPOST('categories', 'array');
$object->setCategories($categories);
}
} }
// Fill array 'array_options' with data from add form // Fill array 'array_options' with data from add form

View File

@ -1287,6 +1287,7 @@ if (!$error && ($massaction == 'delete' || ($action == 'delete' && $confirm == '
$objecttmp = new $objectclass($db); $objecttmp = new $objectclass($db);
$nbok = 0; $nbok = 0;
$TMsg = array();
foreach ($toselect as $toselectid) { foreach ($toselect as $toselectid) {
$result = $objecttmp->fetch($toselectid); $result = $objecttmp->fetch($toselectid);
if ($result > 0) { if ($result > 0) {
@ -1314,7 +1315,9 @@ if (!$error && ($massaction == 'delete' || ($action == 'delete' && $confirm == '
$result = $objecttmp->delete($user); $result = $objecttmp->delete($user);
} }
if ($result <= 0) { if (empty($result)) { // if delete returns 0, there is at least one object linked
$TMsg = array_merge($objecttmp->errors, $TMsg);
} elseif ($result < 0) { // if delete returns is < 0, there is an error, we break and rollback later
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
$error++; $error++;
break; break;
@ -1328,16 +1331,25 @@ if (!$error && ($massaction == 'delete' || ($action == 'delete' && $confirm == '
} }
} }
if (!$error) { if (empty($error)) {
// Message for elements well deleted
if ($nbok > 1) { if ($nbok > 1) {
setEventMessages($langs->trans("RecordsDeleted", $nbok), null, 'mesgs'); setEventMessages($langs->trans("RecordsDeleted", $nbok), null, 'mesgs');
} else { } elseif ($nbok == 1) {
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs'); setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
} }
// Message for elements which can't be deleted
if (!empty($TMsg)) {
sort($TMsg);
setEventMessages('', array_unique($TMsg), 'warnings');
}
$db->commit(); $db->commit();
} else { } else {
$db->rollback(); $db->rollback();
} }
//var_dump($listofobjectthirdparties);exit; //var_dump($listofobjectthirdparties);exit;
} }

View File

@ -0,0 +1,120 @@
<?php
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file /htdocs/core/ajax/fetchKnowledgeRecord.php
* \brief File to make Ajax action on Knowledge Management
*/
if (!defined('NOTOKENRENEWAL')) {
define('NOTOKENRENEWAL', '1'); // Disables token renewal
}
if (!defined('NOREQUIREHTML')) {
define('NOREQUIREHTML', '1');
}
if (!defined('NOREQUIREAJAX')) {
define('NOREQUIREAJAX', '1');
}
if (!defined('NOREQUIRESOC')) {
define('NOREQUIRESOC', '1');
}
if (!defined('NOCSRFCHECK')) {
define('NOCSRFCHECK', '1');
}
// Do not check anti CSRF attack test
if (!defined('NOREQUIREMENU')) {
define('NOREQUIREMENU', '1');
}
// If there is no need to load and show top and left menu
if (!defined("NOLOGIN")) {
define("NOLOGIN", '1');
}
if (!defined('NOIPCHECK')) {
define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
}
if (!defined('NOBROWSERNOTIF')) {
define('NOBROWSERNOTIF', '1');
}
include '../../main.inc.php';
$action = GETPOST('action', 'aZ09');
$idticketgroup = GETPOST('idticketgroup', 'aZ09');
$idticketgroup = GETPOST('idticketgroup', 'aZ09');
$lang = GETPOST('lang', 'aZ09');
$popupurl = GETPOST('popupurl', 'bool');
/*
* Actions
*/
// None
/*
* View
*/
if ($action == "getKnowledgeRecord") {
$response = '';
$sql = "SELECT kr.rowid, kr.ref, kr.question, kr.answer,l.url,ctc.code";
$sql .= " FROM ".MAIN_DB_PREFIX."links as l";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."knowledgemanagement_knowledgerecord as kr ON kr.rowid = l.objectid";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."c_ticket_category as ctc ON ctc.rowid = kr.fk_c_ticket_category";
$sql .= " WHERE ctc.code = '".$db->escape($idticketgroup)."'";
$sql .= " AND ctc.active = 1 AND ctc.public = 1 AND (kr.lang = '".$db->escape($lang)."' OR kr.lang = 0)";
$sql .= " AND kr.status = 1";
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
$response = array();
while ($i < $num) {
$obj = $db->fetch_object($resql);
if ($popupurl == "false") {
$url = "<a href=\"".$obj->url. "\" target=\"_blank\">".$obj->url."</a></li>";
$response[] = array('title'=>$obj->question,'ref'=>$obj->url,'answer'=>$obj->answer,'url'=>$url);
} else {
$name = $obj->ref;
$buttonstring = $obj->url;
$url = $obj->url;
$urltoprint = '<a class="button_'.$name.'" style="cursor:pointer">'.$buttonstring.'</a>';
$urltoprint .= '<!-- Add js code to open dialog popup on dialog -->';
$urltoprint .= '<script language="javascript">
jQuery(document).ready(function () {
jQuery(".button_'.$name.'").click(function () {
console.log("Open popup with jQuery(...).dialog() on URL '.dol_escape_js($url).'")
var $dialog = $(\'<div></div>\').html(\'<iframe class="iframedialog" style="border: 0px;" src="'.$url.'" width="100%" height="98%"></iframe>\')
.dialog({
autoOpen: false,
modal: true,
height: (window.innerHeight - 150),
width: \'80%\',
title: "'.dol_escape_js($label).'"
});
$dialog.dialog(\'open\');
});
});
</script>';
$response[] = array('title'=>$obj->question,'ref'=>$obj->url,'answer'=>$obj->answer,'url'=>$urltoprint);
}
$i++;
}
} else {
dol_print_error($db);
}
$response =json_encode($response);
echo $response;
}

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2010-2015 Regis Houssin <regis.houssin@inodbox.com> /* Copyright (C) 2010-2021 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -79,7 +79,7 @@ if (GETPOST('roworder', 'alpha', 3) && GETPOST('table_element_line', 'aZ09', 3)
$perm = 1; $perm = 1;
} elseif ($table_element_line == 'facturedet' && $user->rights->facture->creer) { } elseif ($table_element_line == 'facturedet' && $user->rights->facture->creer) {
$perm = 1; $perm = 1;
} elseif ($table_element_line == 'facturerecdet' && $user->rights->facture->creer) { } elseif ($table_element_line == 'facturedet_rec' && $user->rights->facture->creer) {
$perm = 1; $perm = 1;
} elseif ($table_element_line == 'ecm_files' && $user->rights->ecm->creer) { } elseif ($table_element_line == 'ecm_files' && $user->rights->ecm->creer) {
$perm = 1; $perm = 1;
@ -89,7 +89,7 @@ if (GETPOST('roworder', 'alpha', 3) && GETPOST('table_element_line', 'aZ09', 3)
$perm = 1; $perm = 1;
} elseif ($table_element_line == 'mrp_production' && $user->rights->mrp->write) { } elseif ($table_element_line == 'mrp_production' && $user->rights->mrp->write) {
$perm = 1; $perm = 1;
} elseif ($table_element_line == 'supplier_proposaldet' && $user->rights->supplier_proposal->write) { } elseif ($table_element_line == 'supplier_proposaldet' && $user->rights->supplier_proposal->creer) {
$perm = 1; $perm = 1;
} elseif ($table_element_line == 'commande_fournisseurdet' && $user->rights->fournisseur->commande->creer) { } elseif ($table_element_line == 'commande_fournisseurdet' && $user->rights->fournisseur->commande->creer) {
$perm = 1; $perm = 1;

View File

@ -53,7 +53,7 @@ top_httphead();
// Registering the location of boxes // Registering the location of boxes
if (isset($_GET['action']) && !empty($_GET['action'])) { if (isset($_GET['action']) && !empty($_GET['action'])) {
if ($_GET['action'] == 'getrandompassword' && $user->admin) { if ($_GET['action'] == 'getrandompassword' && ($user->admin || $user->rights->api->apikey->generate)) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
$generic = $_GET['generic'] ? true : false; $generic = $_GET['generic'] ? true : false;
echo getRandomPassword($generic); echo getRandomPassword($generic);

View File

@ -133,7 +133,8 @@ class box_customers_outstanding_bill_reached extends ModeleBoxes
$thirdpartystatic->entity = $objp->entity; $thirdpartystatic->entity = $objp->entity;
$thirdpartystatic->outstanding_limit = $objp->outstanding_limit; $thirdpartystatic->outstanding_limit = $objp->outstanding_limit;
$outstandingtotal = $thirdpartystatic->getOutstandingBills()['opened']; $tmp = $thirdpartystatic->getOutstandingBills();
$outstandingtotal = $tmp['opened'];
$outstandinglimit = $thirdpartystatic->outstanding_limit; $outstandinglimit = $thirdpartystatic->outstanding_limit;
if ($outstandingtotal >= $outstandinglimit) { if ($outstandingtotal >= $outstandinglimit) {

View File

@ -122,7 +122,7 @@ class box_task extends ModeleBoxes
$boxcontent .= '<input type="hidden" name="token" value="'.newToken().'">'."\n"; $boxcontent .= '<input type="hidden" name="token" value="'.newToken().'">'."\n";
$selectArray = array('all' => $langs->trans("NoFilter"), 'im_task_contact' => $langs->trans("WhichIamLinkedTo"), 'im_project_contact' => $langs->trans("WhichIamLinkedToProject")); $selectArray = array('all' => $langs->trans("NoFilter"), 'im_task_contact' => $langs->trans("WhichIamLinkedTo"), 'im_project_contact' => $langs->trans("WhichIamLinkedToProject"));
$boxcontent .= $form->selectArray($cookie_name, $selectArray, $filterValue); $boxcontent .= $form->selectArray($cookie_name, $selectArray, $filterValue);
$boxcontent .= '<button type="submit" class="button buttongen">'.$langs->trans("Refresh").'</button>'; $boxcontent .= '<button type="submit" class="button buttongen button-save">'.$langs->trans("Refresh").'</button>';
$boxcontent .= '</form>'."\n"; $boxcontent .= '</form>'."\n";
$boxcontent .= '</div>'."\n"; $boxcontent .= '</div>'."\n";
if (!empty($conf->use_javascript_ajax)) { if (!empty($conf->use_javascript_ajax)) {

View File

@ -447,6 +447,9 @@ abstract class CommonDocGenerator
$array_key.'_bank_iban'=>$bank_account->iban, $array_key.'_bank_iban'=>$bank_account->iban,
$array_key.'_bank_bic'=>$bank_account->bic, $array_key.'_bank_bic'=>$bank_account->bic,
$array_key.'_bank_label'=>$bank_account->label,
$array_key.'_bank_number'=>$bank_account->number,
$array_key.'_bank_proprio'=>$bank_account->proprio,
$array_key.'_total_ht_locale'=>price($object->total_ht, 0, $outputlangs), $array_key.'_total_ht_locale'=>price($object->total_ht, 0, $outputlangs),
$array_key.'_total_vat_locale'=>(!empty($object->total_vat) ?price($object->total_vat, 0, $outputlangs) : price($object->total_tva, 0, $outputlangs)), $array_key.'_total_vat_locale'=>(!empty($object->total_vat) ?price($object->total_vat, 0, $outputlangs) : price($object->total_tva, 0, $outputlangs)),

View File

@ -2010,6 +2010,11 @@ abstract class CommonObject
return 1; return 1;
} }
// For backward compatibility
if ($this->table_element == 'facture_rec' && $fieldid == 'title') {
$fieldid = 'titre';
}
// Security on socid // Security on socid
$socid = 0; $socid = 0;
if ($user->socid > 0) { if ($user->socid > 0) {
@ -3840,8 +3845,14 @@ abstract class CommonObject
$classfile = 'conferenceorbooth'; $classfile = 'conferenceorbooth';
$classname = 'ConferenceOrBooth'; $classname = 'ConferenceOrBooth';
$module = 'eventorganization'; $module = 'eventorganization';
} elseif ($objecttype == 'mo') {
$classpath = 'mrp/class';
$classfile = 'mo';
$classname = 'Mo';
$module = 'mrp';
} }
// Here $module, $classfile and $classname are set // Here $module, $classfile and $classname are set
if ($conf->$module->enabled && (($element != $this->element) || $alsosametype)) { if ($conf->$module->enabled && (($element != $this->element) || $alsosametype)) {
if ($loadalsoobjects) { if ($loadalsoobjects) {
@ -4292,10 +4303,10 @@ abstract class CommonObject
//print 'Found into table '.$table.', type '.$langs->transnoentitiesnoconv($elementname).', haschild='.$haschild; //print 'Found into table '.$table.', type '.$langs->transnoentitiesnoconv($elementname).', haschild='.$haschild;
$haschild += $obj->nb; $haschild += $obj->nb;
if (is_numeric($elementname)) { // old usage if (is_numeric($elementname)) { // old usage
$this->errors[] = $langs->trans("ErrorRecordHasAtLeastOneChildOfType", $table); $this->errors[] = $langs->transnoentities("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $table);
} else // new usage: $elementname=Translation key } else // new usage: $elementname=Translation key
{ {
$this->errors[] = $langs->trans("ErrorRecordHasAtLeastOneChildOfType", $langs->transnoentitiesnoconv($elementname)); $this->errors[] = $langs->transnoentities("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($elementname));
} }
break; // We found at least one, we stop here break; // We found at least one, we stop here
} }
@ -6721,9 +6732,9 @@ abstract class CommonObject
foreach ($fields_label as $field_toshow) { foreach ($fields_label as $field_toshow) {
$translabel = $langs->trans($obj->$field_toshow); $translabel = $langs->trans($obj->$field_toshow);
if ($translabel != $obj->$field_toshow) { if ($translabel != $obj->$field_toshow) {
$labeltoshow = dol_trunc($translabel, 18).' '; $labeltoshow = dol_trunc($translabel).' ';
} else { } else {
$labeltoshow = dol_trunc($obj->$field_toshow, 18).' '; $labeltoshow = dol_trunc($obj->$field_toshow).' ';
} }
} }
$out .= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>'; $out .= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>';
@ -6733,7 +6744,7 @@ abstract class CommonObject
if ($translabel != $obj->{$InfoFieldList[1]}) { if ($translabel != $obj->{$InfoFieldList[1]}) {
$labeltoshow = dol_trunc($translabel, 18); $labeltoshow = dol_trunc($translabel, 18);
} else { } else {
$labeltoshow = dol_trunc($obj->{$InfoFieldList[1]}, 18); $labeltoshow = dol_trunc($obj->{$InfoFieldList[1]});
} }
} }
if (empty($labeltoshow)) { if (empty($labeltoshow)) {
@ -6916,7 +6927,7 @@ abstract class CommonObject
} }
} }
} elseif ($type == 'link') { } elseif ($type == 'link') {
$param_list = array_keys($param['options']); // $param_list='ObjectName:classPath[:AddCreateButtonOrNot[:Filter]]' $param_list = array_keys($param['options']); // $param_list='ObjectName:classPath[:AddCreateButtonOrNot[:Filter[:Sortfield]]]'
$param_list_array = explode(':', $param_list[0]); $param_list_array = explode(':', $param_list[0]);
$showempty = (($required && $default != '') ? 0 : 1); $showempty = (($required && $default != '') ? 0 : 1);
@ -8961,7 +8972,7 @@ abstract class CommonObject
* @param User $user User that deletes * @param User $user User that deletes
* @param bool $notrigger false=launch triggers after, true=disable triggers * @param bool $notrigger false=launch triggers after, true=disable triggers
* @param int $forcechilddeletion 0=no, 1=Force deletion of children * @param int $forcechilddeletion 0=no, 1=Force deletion of children
* @return int <=0 if KO, >0 if OK * @return int <=0 if KO, 0=Nothing done because object has child, >0 if OK
*/ */
public function deleteCommon(User $user, $notrigger = false, $forcechilddeletion = 0) public function deleteCommon(User $user, $notrigger = false, $forcechilddeletion = 0)
{ {

View File

@ -388,9 +388,9 @@ class dolReceiptPrinter extends Printer
{ {
global $conf; global $conf;
$error = 0; $error = 0;
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'printer_receipt'; $sql = "INSERT INTO ".MAIN_DB_PREFIX."printer_receipt";
$sql .= ' (name, fk_type, fk_profile, parameter, entity)'; $sql .= " (name, fk_type, fk_profile, parameter, entity)";
$sql .= ' VALUES ("'.$this->db->escape($name).'", '.((int) $type).', '.((int) $profile).', "'.$this->db->escape($parameter).'", '.$conf->entity.')'; $sql .= " VALUES ('".$this->db->escape($name)."', ".((int) $type).", ".((int) $profile).", '".$this->db->escape($parameter)."', ".((int) $conf->entity).")";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (!$resql) { if (!$resql) {
$error++; $error++;
@ -413,12 +413,14 @@ class dolReceiptPrinter extends Printer
{ {
global $conf; global $conf;
$error = 0; $error = 0;
$sql = 'UPDATE '.MAIN_DB_PREFIX.'printer_receipt';
$sql .= ' SET name="'.$this->db->escape($name).'"'; $sql = "UPDATE ".MAIN_DB_PREFIX."printer_receipt";
$sql .= ', fk_type='.((int) $type); $sql .= " SET name='".$this->db->escape($name)."'";
$sql .= ', fk_profile='.((int) $profile); $sql .= ", fk_type=".((int) $type);
$sql .= ', parameter="'.$this->db->escape($parameter).'"'; $sql .= ", fk_profile=".((int) $profile);
$sql .= ' WHERE rowid='.((int) $printerid); $sql .= ", parameter='".$this->db->escape($parameter)."'";
$sql .= " WHERE rowid=".((int) $printerid);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (!$resql) { if (!$resql) {
$error++; $error++;
@ -458,9 +460,9 @@ class dolReceiptPrinter extends Printer
{ {
global $conf; global $conf;
$error = 0; $error = 0;
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'printer_receipt_template'; $sql = "INSERT INTO ".MAIN_DB_PREFIX."printer_receipt_template";
$sql .= ' (name, template, entity) VALUES ("'.$this->db->escape($name).'"'; $sql .= " (name, template, entity) VALUES ('".$this->db->escape($name)."'";
$sql .= ', "'.$this->db->escape($template).'", '.$conf->entity.')'; $sql .= ", '".$this->db->escape($template)."', ".$conf->entity.")";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (!$resql) { if (!$resql) {
$error++; $error++;
@ -502,10 +504,11 @@ class dolReceiptPrinter extends Printer
{ {
global $conf; global $conf;
$error = 0; $error = 0;
$sql = 'UPDATE '.MAIN_DB_PREFIX.'printer_receipt_template';
$sql .= ' SET name="'.$this->db->escape($name).'"'; $sql = "UPDATE ".MAIN_DB_PREFIX."printer_receipt_template";
$sql .= ', template="'.$this->db->escape($template).'"'; $sql .= " SET name='".$this->db->escape($name)."'";
$sql .= ' WHERE rowid='.((int) $templateid); $sql .= ", template='".$this->db->escape($template)."'";
$sql .= " WHERE rowid=".((int) $templateid);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (!$resql) { if (!$resql) {
$error++; $error++;

View File

@ -1976,7 +1976,7 @@ class ExtraFields
*/ */
public function showSeparator($key, $object, $colspan = 2, $display_type = 'card') public function showSeparator($key, $object, $colspan = 2, $display_type = 'card')
{ {
global $langs; global $conf, $langs;
if ($display_type=='card') { if ($display_type=='card') {
$tagtype='tr'; $tagtype='tr';
@ -1989,6 +1989,7 @@ class ExtraFields
$out = '<'.$tagtype.' id="trextrafieldseparator'.$key.(!empty($object->id)?'_'.$object->id:'').'" class="trextrafieldseparator trextrafieldseparator'.$key.(!empty($object->id)?'_'.$object->id:'').'">'; $out = '<'.$tagtype.' id="trextrafieldseparator'.$key.(!empty($object->id)?'_'.$object->id:'').'" class="trextrafieldseparator trextrafieldseparator'.$key.(!empty($object->id)?'_'.$object->id:'').'">';
$out .= '<'.$tagtype_dyn.' '.(!empty($colspan)?'colspan="' . $colspan . '"':'').'>'; $out .= '<'.$tagtype_dyn.' '.(!empty($colspan)?'colspan="' . $colspan . '"':'').'>';
// Some js code will be injected here to manage the collapsing of extrafields
$out .='<strong>'; $out .='<strong>';
$out .= $langs->trans($this->attributes[$object->table_element]['label'][$key]); $out .= $langs->trans($this->attributes[$object->table_element]['label'][$key]);
$out .= '</strong>'; $out .= '</strong>';
@ -2011,15 +2012,17 @@ class ExtraFields
$out .= '<script type="text/javascript">'."\n"; $out .= '<script type="text/javascript">'."\n";
$out .= 'jQuery(document).ready(function(){'."\n"; $out .= 'jQuery(document).ready(function(){'."\n";
if ($collapse_display === false) { if ($collapse_display === false) {
$out .= ' console.log("Inject js for the collapsing of extrafield '.$key.' - hide");';
$out .= ' jQuery("#trextrafieldseparator'.$key.(!empty($object->id)?'_'.$object->id:'').' '.$tagtype_dyn.'").prepend("<span class=\"cursorpointer far fa-plus-square\"></span>&nbsp;");'."\n"; $out .= ' jQuery("#trextrafieldseparator'.$key.(!empty($object->id)?'_'.$object->id:'').' '.$tagtype_dyn.'").prepend("<span class=\"cursorpointer far fa-plus-square\"></span>&nbsp;");'."\n";
$out .= ' jQuery(".trextrafields_collapse'.$extrafields_collapse_num.'").hide();'."\n"; $out .= ' jQuery(".trextrafields_collapse'.$extrafields_collapse_num.'").hide();'."\n";
} else { } else {
$out .= ' console.log("Inject js for collapsing of extrafield '.$key.' - keep visible and set cookie");';
$out .= ' jQuery("#trextrafieldseparator'.$key.(!empty($object->id)?'_'.$object->id:'').' '.$tagtype_dyn.'").prepend("<span class=\"cursorpointer far fa-minus-square\"></span>&nbsp;");'."\n"; $out .= ' jQuery("#trextrafieldseparator'.$key.(!empty($object->id)?'_'.$object->id:'').' '.$tagtype_dyn.'").prepend("<span class=\"cursorpointer far fa-minus-square\"></span>&nbsp;");'."\n";
$out .= ' document.cookie = "DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key.'=1; path='.$_SERVER["PHP_SELF"].'"'."\n"; $out .= ' document.cookie = "DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key.'=1; path='.$_SERVER["PHP_SELF"].'"'."\n";
} }
$out .= ' jQuery("#trextrafieldseparator'.$key.(!empty($object->id)?'_'.$object->id:'').'").click(function(){'."\n"; $out .= ' jQuery("#trextrafieldseparator'.$key.(!empty($object->id)?'_'.$object->id:'').'").click(function(){'."\n";
$out .= ' console.log("We click on collapse/uncollapse .trextrafields_collapse'.$extrafields_collapse_num.'");'."\n"; $out .= ' console.log("We click on collapse/uncollapse .trextrafields_collapse'.$extrafields_collapse_num.'");'."\n";
$out .= ' jQuery(".trextrafields_collapse'.$extrafields_collapse_num.'").toggle(300, function(){'."\n"; $out .= ' jQuery(".trextrafields_collapse'.$extrafields_collapse_num.'").toggle(100, function(){'."\n";
$out .= ' if (jQuery(".trextrafields_collapse'.$extrafields_collapse_num.'").is(":hidden")) {'."\n"; $out .= ' if (jQuery(".trextrafields_collapse'.$extrafields_collapse_num.'").is(":hidden")) {'."\n";
$out .= ' jQuery("#trextrafieldseparator'.$key.(!empty($object->id)?'_'.$object->id:'').' '.$tagtype_dyn.' span").addClass("fa-plus-square").removeClass("fa-minus-square");'."\n"; $out .= ' jQuery("#trextrafieldseparator'.$key.(!empty($object->id)?'_'.$object->id:'').' '.$tagtype_dyn.' span").addClass("fa-plus-square").removeClass("fa-minus-square");'."\n";
$out .= ' document.cookie = "DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key.'=0; path='.$_SERVER["PHP_SELF"].'"'."\n"; $out .= ' document.cookie = "DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key.'=0; path='.$_SERVER["PHP_SELF"].'"'."\n";

View File

@ -1363,7 +1363,7 @@ class Form
$sql .= " AND s.status <> 0"; $sql .= " AND s.status <> 0";
} }
if (!empty($excludeids)) { if (!empty($excludeids)) {
$sql .= " AND rowid NOT IN (".$this->db->sanitize(join(',', $excludeids)).")"; $sql .= " AND s.rowid NOT IN (".$this->db->sanitize(join(',', $excludeids)).")";
} }
// Add criteria // Add criteria
if ($filterkey && $filterkey != '') { if ($filterkey && $filterkey != '') {
@ -3383,9 +3383,9 @@ class Form
$opt .= ' disabled'; $opt .= ' disabled';
} }
if (!empty($objp->idprodfournprice) && $objp->idprodfournprice > 0) { if (!empty($objp->idprodfournprice) && $objp->idprodfournprice > 0) {
$opt .= ' data-qty="'.$objp->quantity.'" data-up="'.$objp->unitprice.'" data-discount="'.$outdiscount.'"'; $opt .= ' data-product-id="'.$objp->rowid.'" data-price-id="'.$objp->idprodfournprice.'" data-qty="'.$objp->quantity.'" data-up="'.$objp->unitprice.'" data-discount="'.$outdiscount.'"';
} }
$opt .= ' data-description="'.dol_escape_htmltag($objp->description).'"'; $opt .= ' data-description="'.dol_escape_htmltag($objp->description, 0, 1).'"';
$opt .= ' data-html="'.dol_escape_htmltag($optlabel).'"'; $opt .= ' data-html="'.dol_escape_htmltag($optlabel).'"';
$opt .= '>'; $opt .= '>';
@ -4727,7 +4727,7 @@ class Form
foreach ($formquestion as $key => $input) { foreach ($formquestion as $key => $input) {
if (is_array($input) && !empty($input)) { if (is_array($input) && !empty($input)) {
if ($input['type'] == 'hidden') { if ($input['type'] == 'hidden') {
$more .= '<input type="hidden" id="'.$input['name'].'" name="'.$input['name'].'" value="'.dol_escape_htmltag($input['value']).'">'."\n"; $more .= '<input type="hidden" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'" value="'.dol_escape_htmltag($input['value']).'">'."\n";
} }
} }
} }
@ -4742,9 +4742,21 @@ class Form
$morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : ''); $morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : '');
if ($input['type'] == 'text') { if ($input['type'] == 'text') {
$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div><div class="tagtd"><input type="text" class="flat'.$morecss.'" id="'.$input['name'].'" name="'.$input['name'].'"'.$size.' value="'.$input['value'].'"'.$moreattr.' /></div></div>'."\n"; $more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div><div class="tagtd"><input type="text" class="flat'.$morecss.'" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'"'.$size.' value="'.$input['value'].'"'.$moreattr.' /></div></div>'."\n";
} elseif ($input['type'] == 'password') { } elseif ($input['type'] == 'password') {
$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div><div class="tagtd"><input type="password" class="flat'.$morecss.'" id="'.$input['name'].'" name="'.$input['name'].'"'.$size.' value="'.$input['value'].'"'.$moreattr.' /></div></div>'."\n"; $more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div><div class="tagtd"><input type="password" class="flat'.$morecss.'" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'"'.$size.' value="'.$input['value'].'"'.$moreattr.' /></div></div>'."\n";
} elseif ($input['type'] == 'textarea') {
/*$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div><div class="tagtd">';
$more .= '<textarea name="'.$input['name'].'" class="'.$morecss.'"'.$moreattr.'>';
$more .= $input['value'];
$more .= '</textarea>';
$more .= '</div></div>'."\n";*/
$moreonecolumn .= '<div class="margintoponly">';
$moreonecolumn .= $input['label'].'<br>';
$moreonecolumn .= '<textarea name="'.dol_escape_htmltag($input['name']).'" id="'.dol_escape_htmltag($input['name']).'" class="'.$morecss.'"'.$moreattr.'>';
$moreonecolumn .= $input['value'];
$moreonecolumn .= '</textarea>';
$moreonecolumn .= '</div>';
} elseif ($input['type'] == 'select') { } elseif ($input['type'] == 'select') {
if (empty($morecss)) { if (empty($morecss)) {
$morecss = 'minwidth100'; $morecss = 'minwidth100';
@ -4767,7 +4779,7 @@ class Form
} elseif ($input['type'] == 'checkbox') { } elseif ($input['type'] == 'checkbox') {
$more .= '<div class="tagtr">'; $more .= '<div class="tagtr">';
$more .= '<div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].' </div><div class="tagtd">'; $more .= '<div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].' </div><div class="tagtd">';
$more .= '<input type="checkbox" class="flat'.$morecss.'" id="'.$input['name'].'" name="'.$input['name'].'"'.$moreattr; $more .= '<input type="checkbox" class="flat'.$morecss.'" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'"'.$moreattr;
if (!is_bool($input['value']) && $input['value'] != 'false' && $input['value'] != '0') { if (!is_bool($input['value']) && $input['value'] != 'false' && $input['value'] != '0') {
$more .= ' checked'; $more .= ' checked';
} }
@ -4788,7 +4800,7 @@ class Form
} else { } else {
$more .= '<div clas="tagtd'.(empty($input['tdclass']) ? '' : (' "'.$input['tdclass'])).'">&nbsp;</div>'; $more .= '<div clas="tagtd'.(empty($input['tdclass']) ? '' : (' "'.$input['tdclass'])).'">&nbsp;</div>';
} }
$more .= '<div class="tagtd'.($i == 0 ? ' tdtop' : '').'"><input type="radio" class="flat'.$morecss.'" id="'.$input['name'].$selkey.'" name="'.$input['name'].'" value="'.$selkey.'"'.$moreattr; $more .= '<div class="tagtd'.($i == 0 ? ' tdtop' : '').'"><input type="radio" class="flat'.$morecss.'" id="'.dol_escape_htmltag($input['name'].$selkey).'" name="'.dol_escape_htmltag($input['name']).'" value="'.$selkey.'"'.$moreattr;
if ($input['disabled']) { if ($input['disabled']) {
$more .= ' disabled'; $more .= ' disabled';
} }
@ -4796,7 +4808,7 @@ class Form
$more .= ' checked="checked"'; $more .= ' checked="checked"';
} }
$more .= ' /> '; $more .= ' /> ';
$more .= '<label for="'.$input['name'].$selkey.'">'.$selval.'</label>'; $more .= '<label for="'.dol_escape_htmltag($input['name'].$selkey).'">'.$selval.'</label>';
$more .= '</div></div>'."\n"; $more .= '</div></div>'."\n";
$i++; $i++;
} }
@ -4921,7 +4933,7 @@ class Form
inputvalue = $("#" + inputname + more).val(); inputvalue = $("#" + inputname + more).val();
} }
if (typeof inputvalue == "undefined") { inputvalue=""; } if (typeof inputvalue == "undefined") { inputvalue=""; }
console.log("check inputname="+inputname+" inputvalue="+inputvalue); console.log("formconfirm check inputname="+inputname+" inputvalue="+inputvalue);
options += "&" + inputname + "=" + encodeURIComponent(inputvalue); options += "&" + inputname + "=" + encodeURIComponent(inputvalue);
}); });
} }
@ -6813,7 +6825,7 @@ class Form
* Can use autocomplete with ajax after x key pressed or a full combo, depending on setup. * Can use autocomplete with ajax after x key pressed or a full combo, depending on setup.
* This is the generic method that will replace all specific existing methods. * This is the generic method that will replace all specific existing methods.
* *
* @param string $objectdesc ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]] * @param string $objectdesc ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]
* @param string $htmlname Name of HTML select component * @param string $htmlname Name of HTML select component
* @param int $preselectedvalue Preselected value (ID of element) * @param int $preselectedvalue Preselected value (ID of element)
* @param string $showempty ''=empty values not allowed, 'string'=value show if we allow empty values (for example 'All', ...) * @param string $showempty ''=empty values not allowed, 'string'=value show if we allow empty values (for example 'All', ...)
@ -6838,6 +6850,7 @@ class Form
$classpath = $InfoFieldList[1]; $classpath = $InfoFieldList[1];
$addcreatebuttonornot = empty($InfoFieldList[2]) ? 0 : $InfoFieldList[2]; $addcreatebuttonornot = empty($InfoFieldList[2]) ? 0 : $InfoFieldList[2];
$filter = empty($InfoFieldList[3]) ? '' : $InfoFieldList[3]; $filter = empty($InfoFieldList[3]) ? '' : $InfoFieldList[3];
$sortfield = empty($InfoFieldList[4]) ? '' : $InfoFieldList[4];
if (!empty($classpath)) { if (!empty($classpath)) {
dol_include_once($classpath); dol_include_once($classpath);
@ -6883,14 +6896,14 @@ class Form
$urlforajaxcall = DOL_URL_ROOT.'/core/ajax/selectobject.php'; $urlforajaxcall = DOL_URL_ROOT.'/core/ajax/selectobject.php';
// No immediate load of all database // No immediate load of all database
$urloption = 'htmlname='.$htmlname.'&outjson=1&objectdesc='.$objectdesc.'&filter='.urlencode($objecttmp->filter); $urloption = 'htmlname='.urlencode($htmlname).'&outjson=1&objectdesc='.urlencode($objectdesc).'&filter='.urlencode($objecttmp->filter).($sortfield ? '&sortfield='.urlencode($sortfield) : '');
// Activate the auto complete using ajax call. // Activate the auto complete using ajax call.
$out .= ajax_autocompleter($preselectedvalue, $htmlname, $urlforajaxcall, $urloption, $conf->global->$confkeyforautocompletemode, 0, array()); $out .= ajax_autocompleter($preselectedvalue, $htmlname, $urlforajaxcall, $urloption, $conf->global->$confkeyforautocompletemode, 0, array());
$out .= '<style type="text/css">.ui-autocomplete { z-index: 1003; }</style>'; $out .= '<style type="text/css">.ui-autocomplete { z-index: 1003; }</style>';
$out .= '<input type="text" class="'.$morecss.'"'.($disabled ? ' disabled="disabled"' : '').' name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.dol_escape_htmltag($placeholder).'"' : '') .' />'; $out .= '<input type="text" class="'.$morecss.'"'.($disabled ? ' disabled="disabled"' : '').' name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.dol_escape_htmltag($placeholder).'"' : '') .' />';
} else { } else {
// Immediate load of table record. Note: filter is inside $objecttmp->filter // Immediate load of table record. Note: filter is inside $objecttmp->filter
$out .= $this->selectForFormsList($objecttmp, $htmlname, $preselectedvalue, $showempty, $searchkey, $placeholder, $morecss, $moreparams, $forcecombo, 0, $disabled); $out .= $this->selectForFormsList($objecttmp, $htmlname, $preselectedvalue, $showempty, $searchkey, $placeholder, $morecss, $moreparams, $forcecombo, 0, $disabled, $sortfield);
} }
return $out; return $out;
@ -6940,10 +6953,11 @@ class Form
* @param int $forcecombo Force to load all values and output a standard combobox (with no beautification) * @param int $forcecombo Force to load all values and output a standard combobox (with no beautification)
* @param int $outputmode 0=HTML select string, 1=Array * @param int $outputmode 0=HTML select string, 1=Array
* @param int $disabled 1=Html component is disabled * @param int $disabled 1=Html component is disabled
* @param string $sortfield Sort field
* @return string|array Return HTML string * @return string|array Return HTML string
* @see selectForForms() * @see selectForForms()
*/ */
public function selectForFormsList($objecttmp, $htmlname, $preselectedvalue, $showempty = '', $searchkey = '', $placeholder = '', $morecss = '', $moreparams = '', $forcecombo = 0, $outputmode = 0, $disabled = 0) public function selectForFormsList($objecttmp, $htmlname, $preselectedvalue, $showempty = '', $searchkey = '', $placeholder = '', $morecss = '', $moreparams = '', $forcecombo = 0, $outputmode = 0, $disabled = 0, $sortfield = '')
{ {
global $conf, $langs, $user, $hookmanager; global $conf, $langs, $user, $hookmanager;
@ -6995,7 +7009,7 @@ class Form
$tmparray = explode('@', $objecttmp->ismultientitymanaged); $tmparray = explode('@', $objecttmp->ismultientitymanaged);
$sql .= " INNER JOIN ".MAIN_DB_PREFIX.$tmparray[1]." as parenttable ON parenttable.rowid = t.".$tmparray[0]; $sql .= " INNER JOIN ".MAIN_DB_PREFIX.$tmparray[1]." as parenttable ON parenttable.rowid = t.".$tmparray[0];
} }
if ($objecttmp->ismultientitymanaged == 'fk_soc@societe') { if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') {
if (!$user->rights->societe->client->voir && !$user->socid) { if (!$user->rights->societe->client->voir && !$user->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
} }
@ -7023,7 +7037,7 @@ class Form
$sql .= " AND t.fk_soc = ".((int) $user->socid); $sql .= " AND t.fk_soc = ".((int) $user->socid);
} }
} }
if ($objecttmp->ismultientitymanaged == 'fk_soc@societe') { if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') {
if (!$user->rights->societe->client->voir && !$user->socid) { if (!$user->rights->societe->client->voir && !$user->socid) {
$sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); $sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
} }
@ -7041,7 +7055,7 @@ class Form
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'Form::forgeCriteriaCallback', $objecttmp->filter).")"; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'Form::forgeCriteriaCallback', $objecttmp->filter).")";
} }
} }
$sql .= $this->db->order($fieldstoshow, "ASC"); $sql .= $this->db->order($sortfield ? $sortfield : $fieldstoshow, "ASC");
//$sql.=$this->db->plimit($limit, 0); //$sql.=$this->db->plimit($limit, 0);
//print $sql; //print $sql;
@ -7877,12 +7891,16 @@ class Form
$tplpath = 'eventorganization'; $tplpath = 'eventorganization';
} elseif ($objecttype == 'conferenceorboothattendee') { } elseif ($objecttype == 'conferenceorboothattendee') {
$tplpath = 'eventorganization'; $tplpath = 'eventorganization';
} elseif ($objecttype == 'mo') {
$tplpath = 'mrp';
if (empty($conf->mrp->enabled)) {
continue; // Do not show if module disabled
}
} }
global $linkedObjectBlock; global $linkedObjectBlock;
$linkedObjectBlock = $objects; $linkedObjectBlock = $objects;
// Output template part (modules that overwrite templates must declare this into descriptor) // Output template part (modules that overwrite templates must declare this into descriptor)
$dirtpls = array_merge($conf->modules_parts['tpl'], array('/'.$tplpath.'/tpl')); $dirtpls = array_merge($conf->modules_parts['tpl'], array('/'.$tplpath.'/tpl'));
foreach ($dirtpls as $reldir) { foreach ($dirtpls as $reldir) {
@ -7968,7 +7986,8 @@ class Form
'supplier_proposal'=>array('enabled'=>$conf->supplier_proposal->enabled, 'perms'=>1, 'label'=>'LinkToSupplierProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('supplier_proposal').')'), 'supplier_proposal'=>array('enabled'=>$conf->supplier_proposal->enabled, 'perms'=>1, 'label'=>'LinkToSupplierProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('supplier_proposal').')'),
'order_supplier'=>array('enabled'=>$conf->supplier_order->enabled, 'perms'=>1, 'label'=>'LinkToSupplierOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande_fournisseur').')'), 'order_supplier'=>array('enabled'=>$conf->supplier_order->enabled, 'perms'=>1, 'label'=>'LinkToSupplierOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande_fournisseur').')'),
'invoice_supplier'=>array('enabled'=>$conf->supplier_invoice->enabled, 'perms'=>1, 'label'=>'LinkToSupplierInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('facture_fourn').')'), 'invoice_supplier'=>array('enabled'=>$conf->supplier_invoice->enabled, 'perms'=>1, 'label'=>'LinkToSupplierInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('facture_fourn').')'),
'ticket'=>array('enabled'=>$conf->ticket->enabled, 'perms'=>1, 'label'=>'LinkToTicket', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.track_id, '0' as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."ticket as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('ticket').')') 'ticket'=>array('enabled'=>$conf->ticket->enabled, 'perms'=>1, 'label'=>'LinkToTicket', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.track_id, '0' as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."ticket as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('ticket').')'),
'mo'=>array('enabled'=>$conf->mrp->enabled, 'perms'=>1, 'label'=>'LinkToMO', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.rowid, '0' as total_ht FROM ".MAIN_DB_PREFIX."societe as s INNER JOIN ".MAIN_DB_PREFIX."mrp_mo as t ON t.fk_soc = s.rowid WHERE t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('mo').')')
); );
} }

View File

@ -717,6 +717,8 @@ class FormCompany extends Form
print ' onChange="'.$javaScript.'"'; print ' onChange="'.$javaScript.'"';
} }
print '>'; print '>';
print '<option value="-1">&nbsp;</option>';
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
$i = 0; $i = 0;
if ($num) { if ($num) {
@ -779,7 +781,7 @@ class FormCompany extends Form
$out .= '<select class="flat valignmiddle'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; $out .= '<select class="flat valignmiddle'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
if ($showempty) { if ($showempty) {
$out .= '<option value="0"></option>'; $out .= '<option value="0">&nbsp;</option>';
} }
foreach ($lesTypes as $key => $value) { foreach ($lesTypes as $key => $value) {
$out .= '<option value="'.$key.'"'; $out .= '<option value="'.$key.'"';
@ -996,16 +998,16 @@ class FormCompany extends Form
/** /**
* Return a HTML select for thirdparty type * Return a HTML select for thirdparty type
* *
* @param int $selected selected value * @param int $selected Selected value
* @param string $htmlname HTML select name * @param string $htmlname HTML select name
* @param string $htmlidname HTML select id * @param string $htmlidname HTML select id
* @param string $typeinput HTML output * @param string $typeinput HTML output
* @param string $morecss More css * @param string $morecss More css
* @return string HTML string * @param string $allowempty Allow empty value or not
* @return string HTML string
*/ */
public function selectProspectCustomerType($selected, $htmlname = 'client', $htmlidname = 'customerprospect', $typeinput = 'form', $morecss = '') public function selectProspectCustomerType($selected, $htmlname = 'client', $htmlidname = 'customerprospect', $typeinput = 'form', $morecss = '', $allowempty = '')
{ {
global $conf, $langs; global $conf, $langs;
if (!empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && !empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->fournisseur->enabled)) { if (!empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && !empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->fournisseur->enabled)) {
return '' ; return '' ;
@ -1013,8 +1015,14 @@ class FormCompany extends Form
$out = '<select class="flat '.$morecss.'" name="'.$htmlname.'" id="'.$htmlidname.'">'; $out = '<select class="flat '.$morecss.'" name="'.$htmlname.'" id="'.$htmlidname.'">';
if ($typeinput == 'form') { if ($typeinput == 'form') {
if ($selected == '' || $selected == '-1') { if ($allowempty || ($selected == '' || $selected == '-1')) {
$out .= '<option value="-1">&nbsp;</option>'; $out .= '<option value="-1">';
if (is_numeric($allowempty)) {
$out .= '&nbsp;';
} else {
$out .= $langs->trans($allowempty);
}
$out .= '</option>';
} }
if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) { if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) {
$out .= '<option value="2"'.($selected == 2 ? ' selected' : '').'>'.$langs->trans('Prospect').'</option>'; $out .= '<option value="2"'.($selected == 2 ? ' selected' : '').'>'.$langs->trans('Prospect').'</option>';

View File

@ -1209,7 +1209,7 @@ class FormOther
async: false async: false
}); });
// We force reload to be sure to get all boxes into list // We force reload to be sure to get all boxes into list
window.location.search=\'mainmenu='.GETPOST("mainmenu", "aZ09").'&leftmenu='.GETPOST('leftmenu', "aZ09").'&action=delbox\'; window.location.search=\'mainmenu='.GETPOST("mainmenu", "aZ09").'&leftmenu='.GETPOST('leftmenu', "aZ09").'&action=delbox&token='.newToken().'\';
} }
else else
{ {

View File

@ -243,6 +243,65 @@ class FormTicket
} }
} }
if ($conf->knowledgemanagement->enabled) {
// KM Articles
print '<tr id="KWwithajax"></tr>';
print '<!-- Script to manage change of ticket group -->
<script>
jQuery(document).ready(function() {
function groupticketchange(){
console.log("We called groupticketchange, so we try to load list KM linked to event");
$("#KWwithajax").html("");
idgroupticket = $("#selectcategory_code").val();
console.log("We have selected id="+idgroupticket);
if (idgroupticket != "") {
$.ajax({ url: \''.DOL_URL_ROOT.'/core/ajax/fetchKnowledgeRecord.php\',
data: { action: \'getKnowledgeRecord\', idticketgroup: idgroupticket, token: \''.newToken().'\', lang:\''.$langs->defaultlang.'\', popupurl:false},
type: \'GET\',
success: function(response) {
var urllist = \'\';
console.log("We received response "+response);
response = JSON.parse(response)
for (key in response) {
console.log(response[key])
urllist += "<li>" + response[key].title + ": " +response[key].url+"</li>";
}
if (urllist != "") {
console.log(urllist)
$("#KWwithajax").html(\'<td>'.$langs->trans("KMFoundForTicketGroup").'</td><td><ul style="list-style:none;padding-left: 0;">\'+urllist+\'</ul></td>\');
$("#KWwithajax").show();
}
},
error : function(output) {
console.log("error");
},
});
}
};
$("#selectcategory_code").bind("change",function() { groupticketchange(); });
MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
var trackChange = function(element) {
var observer = new MutationObserver(function(mutations, observer) {
if (mutations[0].attributeName == "value") {
$(element).trigger("change");
}
});
observer.observe(element, {
attributes: true
});
}
trackChange($("#selectcategory_code")[0]);
if ($("#selectcategory_code").val() != "") {
groupticketchange();
}
});
</script>'."\n";
}
// MESSAGE // MESSAGE
$msg = GETPOSTISSET('message') ? GETPOST('message', 'restricthtml') : ''; $msg = GETPOSTISSET('message') ? GETPOST('message', 'restricthtml') : '';
print '<tr><td><label for="message"><span class="fieldrequired">'.$langs->trans("Message").'</span></label></td><td>'; print '<tr><td><label for="message"><span class="fieldrequired">'.$langs->trans("Message").'</span></label></td><td>';
@ -589,23 +648,29 @@ class FormTicket
/** /**
* Return html list of ticket anaytic codes * Return html list of ticket anaytic codes
* *
* @param string $selected Id categorie pre-selectionnée * @param string $selected Id categorie pre-selectionnée
* @param string $htmlname Name of select component * @param string $htmlname Name of select component
* @param string $filtertype To filter on some properties in llx_c_ticket_category ('public = 1'). This parameter must not come from input of users. * @param string $filtertype To filter on some properties in llx_c_ticket_category ('public = 1'). This parameter must not come from input of users.
* @param int $format 0=id+libelle, 1=code+code, 2=code+libelle, 3=id+code * @param int $format 0=id+libelle, 1=code+code, 2=code+libelle, 3=id+code
* @param int $empty 1=peut etre vide, 0 sinon * @param int $empty 1=peut etre vide, 0 sinon
* @param int $noadmininfo 0=Add admin info, 1=Disable admin info * @param int $noadmininfo 0=Add admin info, 1=Disable admin info
* @param int $maxlength Max length of label * @param int $maxlength Max length of label
* @param string $morecss More CSS * @param string $morecss More CSS
* @param int $use_multilevel If > 0 create a multilevel select which use $htmlname example: $use_multilevel = 1 permit to have 2 select boxes. * @param int $use_multilevel If > 0 create a multilevel select which use $htmlname example: $use_multilevel = 1 permit to have 2 select boxes.
* @param Translate $outputlangs Output lnaguage
* @return void * @return void
*/ */
public function selectGroupTickets($selected = '', $htmlname = 'ticketcategory', $filtertype = '', $format = 0, $empty = 0, $noadmininfo = 0, $maxlength = 0, $morecss = '', $use_multilevel = 0) public function selectGroupTickets($selected = '', $htmlname = 'ticketcategory', $filtertype = '', $format = 0, $empty = 0, $noadmininfo = 0, $maxlength = 0, $morecss = '', $use_multilevel = 0, $outputlangs = null)
{ {
global $langs, $user; global $conf, $langs, $user;
dol_syslog(get_class($this)."::selectCategoryTickets ".$selected.", ".$htmlname.", ".$filtertype.", ".$format, LOG_DEBUG); dol_syslog(get_class($this)."::selectCategoryTickets ".$selected.", ".$htmlname.", ".$filtertype.", ".$format, LOG_DEBUG);
if (empty($outputlangs)) {
$outputlangs = $langs;
}
$outputlangs->load("ticket");
$ticketstat = new Ticket($this->db); $ticketstat = new Ticket($this->db);
$ticketstat->loadCacheCategoriesTickets(); $ticketstat->loadCacheCategoriesTickets();
@ -629,6 +694,13 @@ class FormTicket
continue; continue;
} }
$label = ($arraycategories['label'] != '-' ? $arraycategories['label'] : '');
if ($outputlangs->trans("TicketCategoryShort".$arraycategories['code']) != ("TicketCategoryShort".$arraycategories['code'])) {
$label = $outputlangs->trans("TicketCategoryShort".$arraycategories['code']);
} elseif ($outputlangs->trans($arraycategories['code']) != $arraycategories['code']) {
$label = $outputlangs->trans($arraycategories['code']);
}
if ($format == 0) { if ($format == 0) {
print '<option value="'.$id.'"'; print '<option value="'.$id.'"';
} }
@ -657,7 +729,7 @@ class FormTicket
print '>'; print '>';
if ($format == 0) { if ($format == 0) {
$value = ($maxlength ? dol_trunc($arraycategories['label'], $maxlength) : $arraycategories['label']); $value = ($maxlength ? dol_trunc($label, $maxlength) : $label);
} }
if ($format == 1) { if ($format == 1) {
@ -665,7 +737,7 @@ class FormTicket
} }
if ($format == 2) { if ($format == 2) {
$value = ($maxlength ? dol_trunc($arraycategories['label'], $maxlength) : $arraycategories['label']); $value = ($maxlength ? dol_trunc($label, $maxlength) : $label);
} }
if ($format == 3) { if ($format == 3) {
@ -691,15 +763,16 @@ class FormTicket
$stringtoprint .= '<select id ="'.$htmlname.'" class="maxwidth500 minwidth400" child_id="0">'; $stringtoprint .= '<select id ="'.$htmlname.'" class="maxwidth500 minwidth400" child_id="0">';
$stringtoprint .= '<option value="">&nbsp;</option>'; $stringtoprint .= '<option value="">&nbsp;</option>';
$sql = "SELECT ctc.rowid, ctc.code, ctc.label, ctc.fk_parent, "; $sql = "SELECT ctc.rowid, ctc.code, ctc.label, ctc.fk_parent, ctc.public, ";
$sql .= $this->db->ifsql("ctc.rowid NOT IN (SELECT ctcfather.rowid FROM llx_c_ticket_category as ctcfather JOIN llx_c_ticket_category as ctcjoin ON ctcfather.rowid = ctcjoin.fk_parent)", "'NOTPARENT'", "'PARENT'")." as isparent"; $sql .= $this->db->ifsql("ctc.rowid NOT IN (SELECT ctcfather.rowid FROM llx_c_ticket_category as ctcfather JOIN llx_c_ticket_category as ctcjoin ON ctcfather.rowid = ctcjoin.fk_parent)", "'NOTPARENT'", "'PARENT'")." as isparent";
$sql .= " FROM ".MAIN_DB_PREFIX."c_ticket_category as ctc"; $sql .= " FROM ".MAIN_DB_PREFIX."c_ticket_category as ctc";
$sql .= " WHERE ctc.active > 0"; $sql .= " WHERE ctc.active > 0 AND ctc.entity = ".((int) $conf->entity);
if ($filtertype == 'public=1') { if ($filtertype == 'public=1') {
$sql .= " AND ctc.public = 1"; $sql .= " AND ctc.public = 1";
} }
$sql .= " AND ctc.fk_parent = 0"; $sql .= " AND ctc.fk_parent = 0";
$sql .= $this->db->order('ctc.pos', 'ASC'); $sql .= $this->db->order('ctc.pos', 'ASC');
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { if ($resql) {
$num_rows_level0 = $this->db->num_rows($resql); $num_rows_level0 = $this->db->num_rows($resql);
@ -707,23 +780,31 @@ class FormTicket
while ($i < $num_rows_level0) { while ($i < $num_rows_level0) {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
if ($obj) { if ($obj) {
$label = ($obj->label != '-' ? $obj->label : '');
if ($outputlangs->trans("TicketCategoryShort".$obj->code) != ("TicketCategoryShort".$obj->code)) {
$label = $outputlangs->trans("TicketCategoryShort".$obj->code);
} elseif ($outputlangs->trans($obj->code) != $obj->code) {
$label = $outputlangs->trans($obj->code);
}
$grouprowid = $obj->rowid; $grouprowid = $obj->rowid;
$groupvalue = $obj->code; $groupvalue = $obj->code;
$grouplabel = $obj->label; $grouplabel = $label;
$isparent = $obj->isparent; $isparent = $obj->isparent;
$iselected = $groupticket == $obj->code ?'selected':''; $iselected = $groupticket == $obj->code ?'selected':'';
$stringtoprint .= '<option '.$iselected.' class="'.$htmlname.dol_escape_htmltag($grouprowid).'" value="'.dol_escape_htmltag($groupvalue).'" data-html="'.dol_escape_htmltag($grouplabel).'">'.dol_escape_htmltag($grouplabel).'</option>'; $stringtoprint .= '<option '.$iselected.' class="'.$htmlname.dol_escape_htmltag($grouprowid).'" value="'.dol_escape_htmltag($groupvalue).'" data-html="'.dol_escape_htmltag($grouplabel).'">'.dol_escape_htmltag($grouplabel).'</option>';
if ($isparent == 'NOTPARENT') { if ($isparent == 'NOTPARENT') {
$arraycodenotparent[] = $groupvalue; $arraycodenotparent[] = $groupvalue;
} }
$arrayidused[]=$grouprowid; $arrayidused[] = $grouprowid;
} }
$i++; $i++;
} }
} else { } else {
dol_print_error($this->db); dol_print_error($this->db);
} }
if ($num_rows_level0 == 1) { if (count($arrayidused) == 1) {
return '<input type="hidden" name="'.$htmlname.'" id="'.$htmlname.'" value="'.dol_escape_htmltag($groupvalue).'">'; return '<input type="hidden" name="'.$htmlname.'" id="'.$htmlname.'" value="'.dol_escape_htmltag($groupvalue).'">';
} else { } else {
$stringtoprint .= '<input type="hidden" name="'.$htmlname.'" id="'.$htmlname.'_select" class="maxwidth500 minwidth400">'; $stringtoprint .= '<input type="hidden" name="'.$htmlname.'" id="'.$htmlname.'_select" class="maxwidth500 minwidth400">';
@ -737,11 +818,11 @@ class FormTicket
$stringtoprint .= '<select id ="'.$htmlname.'_child_'.$levelid.'" class="maxwidth500 minwidth400 groupticketchild" child_id="'.$levelid.'">'; $stringtoprint .= '<select id ="'.$htmlname.'_child_'.$levelid.'" class="maxwidth500 minwidth400 groupticketchild" child_id="'.$levelid.'">';
$stringtoprint .= '<option value="">&nbsp;</option>'; $stringtoprint .= '<option value="">&nbsp;</option>';
$sql = "SELECT ctc.rowid, ctc.code, ctc.label, ctc.fk_parent, ctcjoin.code as codefather, "; $sql = "SELECT ctc.rowid, ctc.code, ctc.label, ctc.fk_parent, ctc.public, ctcjoin.code as codefather, ";
$sql .= $this->db->ifsql("ctc.rowid NOT IN (SELECT ctcfather.rowid FROM llx_c_ticket_category as ctcfather JOIN llx_c_ticket_category as ctcjoin ON ctcfather.rowid = ctcjoin.fk_parent)", "'NOTPARENT'", "'PARENT'")." as isparent"; $sql .= $this->db->ifsql("ctc.rowid NOT IN (SELECT ctcfather.rowid FROM llx_c_ticket_category as ctcfather JOIN llx_c_ticket_category as ctcjoin ON ctcfather.rowid = ctcjoin.fk_parent)", "'NOTPARENT'", "'PARENT'")." as isparent";
$sql .= " FROM ".MAIN_DB_PREFIX."c_ticket_category as ctc"; $sql .= " FROM ".MAIN_DB_PREFIX."c_ticket_category as ctc";
$sql .= " JOIN ".MAIN_DB_PREFIX."c_ticket_category as ctcjoin ON ctc.fk_parent = ctcjoin.rowid"; $sql .= " JOIN ".MAIN_DB_PREFIX."c_ticket_category as ctcjoin ON ctc.fk_parent = ctcjoin.rowid";
$sql .= " WHERE ctc.active = 1"; $sql .= " WHERE ctc.active > 0 AND ctc.entity = ".((int) $conf->entity);
if ($filtertype == 'public=1') { if ($filtertype == 'public=1') {
$sql .= " AND ctc.public = 1"; $sql .= " AND ctc.public = 1";
} }
@ -755,6 +836,7 @@ class FormTicket
} else { } else {
} }
$sql .= $this->db->order('ctc.pos', 'ASC'); $sql .= $this->db->order('ctc.pos', 'ASC');
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { if ($resql) {
$num_rows = $this->db->num_rows($resql); $num_rows = $this->db->num_rows($resql);
@ -763,9 +845,16 @@ class FormTicket
while ($i < $num_rows) { while ($i < $num_rows) {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
if ($obj) { if ($obj) {
$label = ($obj->label != '-' ? $obj->label : '');
if ($outputlangs->trans("TicketCategoryShort".$obj->code) != ("TicketCategoryShort".$obj->code)) {
$label = $outputlangs->trans("TicketCategoryShort".$obj->code);
} elseif ($outputlangs->trans($obj->code) != $obj->code) {
$label = $outputlangs->trans($obj->code);
}
$grouprowid = $obj->rowid; $grouprowid = $obj->rowid;
$groupvalue = $obj->code; $groupvalue = $obj->code;
$grouplabel = $obj->label; $grouplabel = $label;
$isparent = $obj->isparent; $isparent = $obj->isparent;
$fatherid = $obj->fk_parent; $fatherid = $obj->fk_parent;
$arrayidused[] = $grouprowid; $arrayidused[] = $grouprowid;

View File

@ -205,14 +205,26 @@ class Ldap
if ($this->serverPing($host, $this->serverPort) === true) { if ($this->serverPing($host, $this->serverPort) === true) {
$this->connection = ldap_connect($host, $this->serverPort); $this->connection = ldap_connect($host, $this->serverPort);
} else { } else {
continue; 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.
$this->connection = ldap_connect($host, $this->serverPort);
} else {
continue;
}
} }
if (is_resource($this->connection)) { if (is_resource($this->connection)) {
// Begin TLS if requested by the configuration // Upgrade connexion to TLS, if requested by the configuration
if (!empty($conf->global->LDAP_SERVER_USE_TLS)) { if (!empty($conf->global->LDAP_SERVER_USE_TLS)) {
if (!ldap_start_tls($this->connection)) { // For test/debug
//ldap_set_option($this->connection, LDAP_OPT_DEBUG_LEVEL, 7);
//ldap_set_option($this->connection, LDAP_OPT_PROTOCOL_VERSION, 3);
$resulttls = ldap_start_tls($this->connection);
if (!$resulttls) {
dol_syslog(get_class($this)."::connect_bind failed to start tls", LOG_WARNING); dol_syslog(get_class($this)."::connect_bind failed to start tls", LOG_WARNING);
$this->error = 'ldap_start_tls Failed to start TLS '.ldap_errno($this->connection).' '.ldap_error($this->connection);
$connected = 0; $connected = 0;
$this->close(); $this->close();
} }
@ -474,6 +486,11 @@ class Ldap
// For better compatibility with Samba4 AD // For better compatibility with Samba4 AD
if ($this->serverType == "activedirectory") { if ($this->serverType == "activedirectory") {
unset($info['cn']); // To avoid error : Operation not allowed on RDN (Code 67) unset($info['cn']); // To avoid error : Operation not allowed on RDN (Code 67)
// To avoid error : LDAP Error: 53 (Unwilling to perform)
if (isset($info['unicodePwd'])) {
$info['unicodePwd'] = mb_convert_encoding("\"".$info['unicodePwd']."\"", "UTF-16LE", "UTF-8");
}
} }
$result = @ldap_modify($this->connection, $dn, $info); $result = @ldap_modify($this->connection, $dn, $info);
@ -689,22 +706,38 @@ class Ldap
/** /**
* Ping a server before ldap_connect for avoid waiting * Ping a server before ldap_connect for avoid waiting
* *
* @param string $host Server host or address * @param string $host Server host or address
* @param int $port Server port (default 389) * @param int $port Server port (default 389)
* @param int $timeout Timeout in second (default 1s) * @param int $timeout Timeout in second (default 1s)
* @return boolean true or false * @return boolean true or false
*/ */
public function serverPing($host, $port = 389, $timeout = 1) public function serverPing($host, $port = 389, $timeout = 1)
{ {
// Replace ldaps:// by ssl:// $regs = array();
if (preg_match('/^ldaps:\/\/([^\/]+)\/?$/', $host, $regs)) { if (preg_match('/^ldaps:\/\/([^\/]+)\/?$/', $host, $regs)) {
// Replace ldaps:// by ssl://
$host = 'ssl://'.$regs[1]; $host = 'ssl://'.$regs[1];
} } elseif (preg_match('/^ldap:\/\/([^\/]+)\/?$/', $host, $regs)) {
// Remove ldap:// // Remove ldap://
if (preg_match('/^ldap:\/\/([^\/]+)\/?$/', $host, $regs)) {
$host = $regs[1]; $host = $regs[1];
} }
//var_dump($newhostforstream); var_dump($host); var_dump($port);
//$host = 'ssl://ldap.test.local:636';
//$port = 636;
$errno = $errstr = 0;
/*
if ($methodtochecktcpconnect == 'socket') {
Try to use socket_create() method.
Method that use stream_context_create() works only on registered listed in stream stream_get_wrappers(): http, https, ftp, ...
}
*/
// Use the method fsockopen to test tcp connect. No way to ignore ssl certificate errors with this method !
$op = @fsockopen($host, $port, $errno, $errstr, $timeout); $op = @fsockopen($host, $port, $errno, $errstr, $timeout);
//var_dump($op);
if (!$op) { if (!$op) {
return false; //DC is N/A return false; //DC is N/A
} else { } else {

View File

@ -349,7 +349,7 @@ foreach ($arrayoftype as $key => $val) {
} }
print $form->selectarray('objecttype', $newarrayoftype, $objecttype, 0, 0, 0, '', 1, 0, 0, '', 'minwidth200', 1); print $form->selectarray('objecttype', $newarrayoftype, $objecttype, 0, 0, 0, '', 1, 0, 0, '', 'minwidth200', 1);
if (empty($conf->use_javascript_ajax)) { if (empty($conf->use_javascript_ajax)) {
print '<input type="submit" class="button buttongen" name="changeobjecttype" value="'.$langs->trans("Refresh").'">'; print '<input type="submit" class="button buttongen button-save" name="changeobjecttype" value="'.$langs->trans("Refresh").'">';
} else { } else {
print '<script type="text/javascript" language="javascript"> print '<script type="text/javascript" language="javascript">
jQuery(document).ready(function() { jQuery(document).ready(function() {
@ -456,7 +456,7 @@ if ($mode == 'graph') {
print '</div>'; print '</div>';
} }
print '<div class="divadvancedsearchfield">'; print '<div class="divadvancedsearchfield">';
print '<input type="submit" class="button buttongen" value="'.$langs->trans("Refresh").'">'; print '<input type="submit" class="button buttongen button-save" value="'.$langs->trans("Refresh").'">';
print '</div>'; print '</div>';
print '</div>'; print '</div>';
print '</form>'; print '</form>';

View File

@ -110,14 +110,13 @@ print '
} }
a.alilevel0 { a.alilevel0 {
background-image: url(\''.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/next.png\') !important; background-image: url(\''.DOL_URL_ROOT.'/theme/'.urlencode($conf->theme).'/img/next.png\') !important;
background-repeat: no-repeat !important; background-repeat: no-repeat !important;
background-position-x: 10px; background-position-x: 10px;
background-position-y: 16px; background-position-y: 16px;
padding: 1em 15px 1em 40px; padding: 1em 15px 1em 40px;
} }
li.lilevel0 font.vsmenudisabled { li.lilevel0 font.vsmenudisabled {
/* background-image: url(/dolibarr_dev/htdocs/theme/eldy/img/next.png) !important; */
background-repeat: no-repeat !important; background-repeat: no-repeat !important;
background-position-x: 10px; background-position-x: 10px;
background-position-y: 16px; background-position-y: 16px;
@ -178,6 +177,9 @@ print '
white-space: nowrap; white-space: nowrap;
display: block; display: block;
} }
.vsmenudisabled .fa, .vsmenudisabled .fas, .vsmenudisabled .far {
color: #aaa !important;
}
</style> </style>
<script type="text/javascript"> <script type="text/javascript">

View File

@ -1135,7 +1135,7 @@ function price2numjs(amount) {
var res = Math.round10(amount, - rounding); var res = Math.round10(amount, - rounding);
// Other solution is // Other solution is
// var res = dolroundjs(amount, rounding) // var res = dolroundjs(amount, rounding)
console.log("res="+res) console.log("price2numjs text="+amount+" return="+res);
return res; return res;
} }

View File

@ -675,26 +675,26 @@ function ihm_prepare_head()
$h = 0; $h = 0;
$head = array(); $head = array();
$head[$h][0] = DOL_URL_ROOT."/admin/ihm.php?mode=language"; $head[$h][0] = DOL_URL_ROOT."/admin/ihm.php?mode=other";
$head[$h][1] = $langs->trans("DefaultLanguage"); $head[$h][1] = $langs->trans("LanguageAndPresentation");
$head[$h][2] = 'language'; $head[$h][2] = 'other';
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT."/admin/ihm.php?mode=template"; $head[$h][0] = DOL_URL_ROOT."/admin/ihm.php?mode=template";
$head[$h][1] = $langs->trans("DefaultSkin"); $head[$h][1] = $langs->trans("SkinAndColors");
$head[$h][2] = 'template'; $head[$h][2] = 'template';
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT."/admin/ihm.php?mode=dashboard";
$head[$h][1] = $langs->trans("Dashboard");
$head[$h][2] = 'dashboard';
$h++;
$head[$h][0] = DOL_URL_ROOT."/admin/ihm.php?mode=login"; $head[$h][0] = DOL_URL_ROOT."/admin/ihm.php?mode=login";
$head[$h][1] = $langs->trans("LoginPage"); $head[$h][1] = $langs->trans("LoginPage");
$head[$h][2] = 'login'; $head[$h][2] = 'login';
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT."/admin/ihm.php?mode=other";
$head[$h][1] = $langs->trans("Miscellaneous");
$head[$h][2] = 'other';
$h++;
complete_head_from_modules($conf, $langs, null, $head, $h, 'ihm_admin'); complete_head_from_modules($conf, $langs, null, $head, $h, 'ihm_admin');
complete_head_from_modules($conf, $langs, null, $head, $h, 'ihm_admin', 'remove'); complete_head_from_modules($conf, $langs, null, $head, $h, 'ihm_admin', 'remove');

View File

@ -34,7 +34,7 @@
* @param string $url Ajax Url to call for request: /path/page.php. Must return a json array ('key'=>id, 'value'=>String shown into input field once selected, 'label'=>String shown into combo list) * @param string $url Ajax Url to call for request: /path/page.php. Must return a json array ('key'=>id, 'value'=>String shown into input field once selected, 'label'=>String shown into combo list)
* @param string $urloption More parameters on URL request * @param string $urloption More parameters on URL request
* @param int $minLength Minimum number of chars to trigger that Ajax search * @param int $minLength Minimum number of chars to trigger that Ajax search
* @param int $autoselect Automatic selection if just one value (trigger("change") on field is done is search return only 1 result) * @param int $autoselect Automatic selection if just one value (trigger("change") on field is done if search return only 1 result)
* @param array $ajaxoptions Multiple options array * @param array $ajaxoptions Multiple options array
* - Ex: array('update'=>array('field1','field2'...)) will reset field1 and field2 once select done * - Ex: array('update'=>array('field1','field2'...)) will reset field1 and field2 once select done
* - Ex: array('disabled'=> ) * - Ex: array('disabled'=> )
@ -67,7 +67,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen
$script .= '<!-- Javascript code for autocomplete of field '.$htmlname.' -->'."\n"; $script .= '<!-- Javascript code for autocomplete of field '.$htmlname.' -->'."\n";
$script .= '<script>'."\n"; $script .= '<script>'."\n";
$script .= '$(document).ready(function() { $script .= '$(document).ready(function() {
var autoselect = '.$autoselect.'; var autoselect = '.((int) $autoselect).';
var options = '.json_encode($ajaxoptions).'; /* Option of actions to do after keyup, or after select */ var options = '.json_encode($ajaxoptions).'; /* Option of actions to do after keyup, or after select */
/* Remove selected id as soon as we type or delete a char (it means old selection is wrong). Use keyup/down instead of change to avoid loosing the product id. This is needed only for select of predefined product */ /* Remove selected id as soon as we type or delete a char (it means old selection is wrong). Use keyup/down instead of change to avoid loosing the product id. This is needed only for select of predefined product */
@ -543,12 +543,14 @@ function ajax_combobox($htmlname, $events = array(), $minLengthToAutocomplete =
* @param int $revertonoff 1=Revert on/off * @param int $revertonoff 1=Revert on/off
* @param int $strict Use only "disabled" with delConstant and "enabled" with setConstant * @param int $strict Use only "disabled" with delConstant and "enabled" with setConstant
* @param int $forcereload Force to reload page if we click/change value (this is supported only when there is no 'alert' option in input) * @param int $forcereload Force to reload page if we click/change value (this is supported only when there is no 'alert' option in input)
* @param string $marginleftonlyshort 1 = Add a short left margin on picto, 2 = Add a larger left margin on picto, 0 = No left margin. Works for fontawesome picto only. * @param string $marginleftonlyshort 1 = Add a short left margin on picto, 2 = Add a larger left margin on picto, 0 = No left margin.
* @param int $forcenoajax 1 = Force to use a ahref link instead of ajax code. * @param int $forcenoajax 1 = Force to use a ahref link instead of ajax code.
* @param int $setzeroinsteadofdel 1 = Set constantto '0' instead of deleting it * @param int $setzeroinsteadofdel 1 = Set constantto '0' instead of deleting it
* @param string $suffix Suffix to use on the name of the switch_on picto. Example: '', '_red'
* @param string $mode Add parameter &mode= to the href link (Used for href link)
* @return string * @return string
*/ */
function ajax_constantonoff($code, $input = array(), $entity = null, $revertonoff = 0, $strict = 0, $forcereload = 0, $marginleftonlyshort = 2, $forcenoajax = 0, $setzeroinsteadofdel = 0) function ajax_constantonoff($code, $input = array(), $entity = null, $revertonoff = 0, $strict = 0, $forcereload = 0, $marginleftonlyshort = 2, $forcenoajax = 0, $setzeroinsteadofdel = 0, $suffix = '', $mode = '')
{ {
global $conf, $langs, $user; global $conf, $langs, $user;
@ -559,9 +561,9 @@ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonof
if (empty($conf->use_javascript_ajax) || $forcenoajax) { if (empty($conf->use_javascript_ajax) || $forcenoajax) {
if (empty($conf->global->$code)) { if (empty($conf->global->$code)) {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_'.$code.'&token='.newToken().'&entity='.$entity.'">'.img_picto($langs->trans("Disabled"), 'off').'</a>'; print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_'.$code.'&token='.newToken().'&entity='.$entity.($mode ? '&mode='.$mode : '').'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
} else { } else {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_'.$code.'&token='.newToken().'&entity='.$entity.'">'.img_picto($langs->trans("Enabled"), 'on').'</a>'; print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_'.$code.'&token='.newToken().'&entity='.$entity.($mode ? '&mode='.$mode : '').'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
} }
} else { } else {
$out = "\n<!-- Ajax code to switch constant ".$code." -->".' $out = "\n<!-- Ajax code to switch constant ".$code." -->".'
@ -607,7 +609,7 @@ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonof
$out .= '<div id="confirm_'.$code.'" title="" style="display: none;"></div>'; $out .= '<div id="confirm_'.$code.'" title="" style="display: none;"></div>';
$out .= '<span id="set_'.$code.'" class="valignmiddle linkobject '.(!empty($conf->global->$code) ? 'hideobject' : '').'">'.($revertonoff ?img_picto($langs->trans("Enabled"), 'switch_on', '', false, 0, 0, '', '', $marginleftonlyshort) : img_picto($langs->trans("Disabled"), 'switch_off', '', false, 0, 0, '', '', $marginleftonlyshort)).'</span>'; $out .= '<span id="set_'.$code.'" class="valignmiddle linkobject '.(!empty($conf->global->$code) ? 'hideobject' : '').'">'.($revertonoff ?img_picto($langs->trans("Enabled"), 'switch_on', '', false, 0, 0, '', '', $marginleftonlyshort) : img_picto($langs->trans("Disabled"), 'switch_off', '', false, 0, 0, '', '', $marginleftonlyshort)).'</span>';
$out .= '<span id="del_'.$code.'" class="valignmiddle linkobject '.(!empty($conf->global->$code) ? '' : 'hideobject').'">'.($revertonoff ?img_picto($langs->trans("Disabled"), 'switch_off', '', false, 0, 0, '', '', $marginleftonlyshort) : img_picto($langs->trans("Enabled"), 'switch_on', '', false, 0, 0, '', '', $marginleftonlyshort)).'</span>'; $out .= '<span id="del_'.$code.'" class="valignmiddle linkobject '.(!empty($conf->global->$code) ? '' : 'hideobject').'">'.($revertonoff ?img_picto($langs->trans("Disabled"), 'switch_off'.$suffix, '', false, 0, 0, '', '', $marginleftonlyshort) : img_picto($langs->trans("Enabled"), 'switch_on'.$suffix, '', false, 0, 0, '', '', $marginleftonlyshort)).'</span>';
$out .= "\n"; $out .= "\n";
} }
@ -624,9 +626,10 @@ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonof
* @param string $text_on Text if on * @param string $text_on Text if on
* @param string $text_off Text if off * @param string $text_off Text if off
* @param array $input Array of type->list of CSS element to switch. Example: array('disabled'=>array(0=>'cssid')) * @param array $input Array of type->list of CSS element to switch. Example: array('disabled'=>array(0=>'cssid'))
* @param string $morecss More CSS
* @return string html for button on/off * @return string html for button on/off
*/ */
function ajax_object_onoff($object, $code, $field, $text_on, $text_off, $input = array()) function ajax_object_onoff($object, $code, $field, $text_on, $text_off, $input = array(), $morecss = '')
{ {
global $langs; global $langs;
@ -697,8 +700,8 @@ function ajax_object_onoff($object, $code, $field, $text_on, $text_off, $input =
}); });
}); });
</script>'; </script>';
$out .= '<span id="set_'.$code.'_'.$object->id.'" class="linkobject '.($object->$code == 1 ? 'hideobject' : '').'">'.img_picto($langs->trans($text_off), 'switch_off').'</span>'; $out .= '<span id="set_'.$code.'_'.$object->id.'" class="linkobject '.($object->$code == 1 ? 'hideobject' : '').($morecss ? ' '.$morecss : '').'">'.img_picto($langs->trans($text_off), 'switch_off').'</span>';
$out .= '<span id="del_'.$code.'_'.$object->id.'" class="linkobject '.($object->$code == 1 ? '' : 'hideobject').'">'.img_picto($langs->trans($text_on), 'switch_on').'</span>'; $out .= '<span id="del_'.$code.'_'.$object->id.'" class="linkobject '.($object->$code == 1 ? '' : 'hideobject').($morecss ? ' '.$morecss : '').'">'.img_picto($langs->trans($text_on), 'switch_on').'</span>';
return $out; return $out;
} }

View File

@ -1548,7 +1548,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
$sql .= "OR ("; $sql .= "OR (";
} }
if (!empty($code)) { if (!empty($code)) {
addEventTypeSQL($sql, $code, $donetodo, $now, $filters, ""); addEventTypeSQL($sql, $code);
} }
if ($key != 0) { if ($key != 0) {
$sql .= ")"; $sql .= ")";
@ -1556,9 +1556,11 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
} }
$sql .= ')'; $sql .= ')';
} elseif (!empty($actioncode)) { } elseif (!empty($actioncode)) {
addEventTypeSQL($sql, $actioncode, $donetodo, $now, $filters); addEventTypeSQL($sql, $actioncode);
} }
addOtherFilterSQL($sql, $donetodo, $now, $filters);
if (is_array($actioncode)) { if (is_array($actioncode)) {
foreach ($actioncode as $code) { foreach ($actioncode as $code) {
$sql2 = addMailingEventTypeSQL($code, $objcon, $filterobj); $sql2 = addMailingEventTypeSQL($code, $objcon, $filterobj);
@ -2021,13 +2023,10 @@ function show_subsidiaries($conf, $langs, $db, $object)
* *
* @param string $sql $sql modified * @param string $sql $sql modified
* @param string $actioncode Action code * @param string $actioncode Action code
* @param string $donetodo donetodo
* @param string $now now
* @param string $filters array
* @param string $sqlANDOR "AND", "OR" or "" sql condition * @param string $sqlANDOR "AND", "OR" or "" sql condition
* @return string sql request * @return string sql request
*/ */
function addEventTypeSQL(&$sql, $actioncode, $donetodo, $now, $filters, $sqlANDOR = "AND") function addEventTypeSQL(&$sql, $actioncode, $sqlANDOR = "AND")
{ {
global $conf, $db; global $conf, $db;
// Condition on actioncode // Condition on actioncode
@ -2054,6 +2053,23 @@ function addEventTypeSQL(&$sql, $actioncode, $donetodo, $now, $filters, $sqlANDO
} }
} }
return $sql;
}
/**
* Add Event Type SQL
*
* @param string $sql $sql modified
* @param string $donetodo donetodo
* @param string $now now
* @param string $filters array
* @return string sql request
*/
function addOtherFilterSQL(&$sql, $donetodo, $now, $filters)
{
global $conf, $db;
// Condition on actioncode
if ($donetodo == 'todo') { if ($donetodo == 'todo') {
$sql .= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))"; $sql .= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))";
} elseif ($donetodo == 'done') { } elseif ($donetodo == 'done') {

View File

@ -2303,9 +2303,13 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
$sqlprotectagainstexternals = ''; $sqlprotectagainstexternals = '';
$ret = array(); $ret = array();
// Find the subdirectory name as the reference. For exemple original_file='10/myfile.pdf' -> refname='10' // Find the subdirectory name as the reference. For example original_file='10/myfile.pdf' -> refname='10'
if (empty($refname)) { if (empty($refname)) {
$refname = basename(dirname($original_file)."/"); $refname = basename(dirname($original_file)."/");
if ($refname == 'thumbs') {
// If we get the thumbns directory, we must go one step higher. For example original_file='10/thumbs/myfile_small.jpg' -> refname='10'
$refname = basename(dirname(dirname($original_file))."/");
}
} }
// Define possible keys to use for permission check // Define possible keys to use for permission check

View File

@ -3615,7 +3615,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'margin', 'map-marker-alt', 'member', 'meeting', 'money-bill-alt', 'movement', 'mrp', 'note', 'next', 'margin', 'map-marker-alt', 'member', 'meeting', 'money-bill-alt', 'movement', 'mrp', 'note', 'next',
'off', 'on', 'order', 'off', 'on', 'order',
'paiment', 'paragraph', 'play', 'pdf', 'phone', 'phoning', 'phoning_mobile', 'phoning_fax', 'playdisabled', 'previous', 'poll', 'pos', 'printer', 'product', 'propal', 'stock', 'resize', 'service', 'stats', 'trip', 'paiment', 'paragraph', 'play', 'pdf', 'phone', 'phoning', 'phoning_mobile', 'phoning_fax', 'playdisabled', 'previous', 'poll', 'pos', 'printer', 'product', 'propal', 'stock', 'resize', 'service', 'stats', 'trip',
'security', 'setup', 'share-alt', 'sign-out', 'split', 'stripe', 'stripe-s', 'switch_off', 'switch_on', 'tools', 'unlink', 'uparrow', 'user', 'vcard', 'wrench', 'security', 'setup', 'share-alt', 'sign-out', 'split', 'stripe', 'stripe-s', 'switch_off', 'switch_on', 'switch_on_red', 'tools', 'unlink', 'uparrow', 'user', 'vcard', 'wrench',
'github', 'jabber', 'skype', 'twitter', 'facebook', 'linkedin', 'instagram', 'snapchat', 'youtube', 'google-plus-g', 'whatsapp', 'github', 'jabber', 'skype', 'twitter', 'facebook', 'linkedin', 'instagram', 'snapchat', 'youtube', 'google-plus-g', 'whatsapp',
'chevron-left', 'chevron-right', 'chevron-down', 'chevron-top', 'commercial', 'companies', 'chevron-left', 'chevron-right', 'chevron-down', 'chevron-top', 'commercial', 'companies',
'generic', 'home', 'hrm', 'members', 'products', 'invoicing', 'generic', 'home', 'hrm', 'members', 'products', 'invoicing',
@ -3659,7 +3659,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'member'=>'user-alt', 'meeting'=>'chalkboard-teacher', 'mrp'=>'cubes', 'next'=>'arrow-alt-circle-right', 'member'=>'user-alt', 'meeting'=>'chalkboard-teacher', 'mrp'=>'cubes', 'next'=>'arrow-alt-circle-right',
'trip'=>'wallet', 'expensereport'=>'wallet', 'group'=>'users', 'movement'=>'people-carry', 'trip'=>'wallet', 'expensereport'=>'wallet', 'group'=>'users', 'movement'=>'people-carry',
'sign-out'=>'sign-out-alt', 'sign-out'=>'sign-out-alt',
'switch_off'=>'toggle-off', 'switch_on'=>'toggle-on', 'check'=>'check', 'bookmark'=>'star', 'bookmark'=>'star', 'switch_off'=>'toggle-off', 'switch_on'=>'toggle-on', 'switch_on_red'=>'toggle-on', 'check'=>'check', 'bookmark'=>'star', 'bookmark'=>'star',
'bank'=>'university', 'close_title'=>'times', 'delete'=>'trash', 'edit'=>'pencil-alt', 'filter'=>'filter', 'bank'=>'university', 'close_title'=>'times', 'delete'=>'trash', 'edit'=>'pencil-alt', 'filter'=>'filter',
'list-alt'=>'list-alt', 'calendar'=>'calendar-alt', 'calendarmonth'=>'calendar-alt', 'calendarweek'=>'calendar-week', 'calendarmonth'=>'calendar-alt', 'calendarday'=>'calendar-day', 'calendarperuser'=>'table', 'list-alt'=>'list-alt', 'calendar'=>'calendar-alt', 'calendarmonth'=>'calendar-alt', 'calendarweek'=>'calendar-week', 'calendarmonth'=>'calendar-alt', 'calendarday'=>'calendar-day', 'calendarperuser'=>'table',
'intervention'=>'ambulance', 'invoice'=>'file-invoice-dollar', 'multicurrency'=>'dollar-sign', 'order'=>'file-invoice', 'intervention'=>'ambulance', 'invoice'=>'file-invoice-dollar', 'multicurrency'=>'dollar-sign', 'order'=>'file-invoice',
@ -3720,7 +3720,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
// Define $marginleftonlyshort // Define $marginleftonlyshort
$arrayconvpictotomarginleftonly = array( $arrayconvpictotomarginleftonly = array(
'bank', 'check', 'delete', 'generic', 'grip', 'grip_title', 'jabber', 'bank', 'check', 'delete', 'generic', 'grip', 'grip_title', 'jabber',
'grip_title', 'grip', 'listlight', 'note', 'on', 'off', 'playdisabled', 'printer', 'resize', 'sign-out', 'stats', 'switch_on', 'switch_off', 'grip_title', 'grip', 'listlight', 'note', 'on', 'off', 'playdisabled', 'printer', 'resize', 'sign-out', 'stats', 'switch_on', 'switch_on_red', 'switch_off',
'uparrow', '1uparrow', '1downarrow', '1leftarrow', '1rightarrow', '1uparrow_selected', '1downarrow_selected', '1leftarrow_selected', '1rightarrow_selected' 'uparrow', '1uparrow', '1downarrow', '1leftarrow', '1rightarrow', '1uparrow_selected', '1downarrow_selected', '1leftarrow_selected', '1rightarrow_selected'
); );
if (!isset($arrayconvpictotomarginleftonly[$pictowithouttext])) { if (!isset($arrayconvpictotomarginleftonly[$pictowithouttext])) {
@ -3742,7 +3742,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'members'=>'infobox-adherent', 'member'=>'infobox-adherent', 'money-bill-alt'=>'infobox-bank_account', 'members'=>'infobox-adherent', 'member'=>'infobox-adherent', 'money-bill-alt'=>'infobox-bank_account',
'order'=>'infobox-commande', 'order'=>'infobox-commande',
'user'=>'infobox-adherent', 'users'=>'infobox-adherent', 'user'=>'infobox-adherent', 'users'=>'infobox-adherent',
'error'=>'pictoerror', 'warning'=>'pictowarning', 'switch_on'=>'font-status4', 'error'=>'pictoerror', 'warning'=>'pictowarning', 'switch_on'=>'font-status4', 'switch_on_red'=>'font-status8',
'holiday'=>'infobox-holiday', 'info'=>'opacityhigh', 'invoice'=>'infobox-commande', 'holiday'=>'infobox-holiday', 'info'=>'opacityhigh', 'invoice'=>'infobox-commande',
'knowledgemanagement'=>'infobox-contrat rotate90', 'loan'=>'infobox-bank_account', 'knowledgemanagement'=>'infobox-contrat rotate90', 'loan'=>'infobox-bank_account',
'payment'=>'infobox-bank_account', 'poll'=>'infobox-adherent', 'pos'=>'infobox-bank_account', 'project'=>'infobox-project', 'projecttask'=>'infobox-project', 'propal'=>'infobox-propal', 'payment'=>'infobox-bank_account', 'poll'=>'infobox-adherent', 'pos'=>'infobox-bank_account', 'project'=>'infobox-project', 'projecttask'=>'infobox-project', 'propal'=>'infobox-propal',

View File

@ -31,16 +31,17 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
* Prepare array with list of tabs * Prepare array with list of tabs
* *
* @param Project $project Object related to tabs * @param Project $project Object related to tabs
* @param string $moreparam More param on url
* @return array Array of tabs to show * @return array Array of tabs to show
*/ */
function project_prepare_head(Project $project) function project_prepare_head(Project $project, $moreparam = '')
{ {
global $db, $langs, $conf, $user; global $db, $langs, $conf, $user;
$h = 0; $h = 0;
$head = array(); $head = array();
$head[$h][0] = DOL_URL_ROOT.'/projet/card.php?id='.$project->id; $head[$h][0] = DOL_URL_ROOT.'/projet/card.php?id='.((int) $project->id).($moreparam ? '&'.$moreparam : '');
$head[$h][1] = $langs->trans("Project"); $head[$h][1] = $langs->trans("Project");
$head[$h][2] = 'project'; $head[$h][2] = 'project';
$h++; $h++;
@ -56,7 +57,7 @@ function project_prepare_head(Project $project)
$nbContacts = count($project->liste_contact(-1, 'internal')) + count($project->liste_contact(-1, 'external')); $nbContacts = count($project->liste_contact(-1, 'internal')) + count($project->liste_contact(-1, 'external'));
dol_setcache($cachekey, $nbContacts, 120); // If setting cache fails, this is not a problem, so we do not test result. dol_setcache($cachekey, $nbContacts, 120); // If setting cache fails, this is not a problem, so we do not test result.
} }
$head[$h][0] = DOL_URL_ROOT.'/projet/contact.php?id='.$project->id; $head[$h][0] = DOL_URL_ROOT.'/projet/contact.php?id='.((int) $project->id).($moreparam ? '&'.$moreparam : '');
$head[$h][1] = $langs->trans("ProjectContact"); $head[$h][1] = $langs->trans("ProjectContact");
if ($nbContacts > 0) { if ($nbContacts > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbContacts.'</span>'; $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbContacts.'</span>';
@ -80,7 +81,7 @@ function project_prepare_head(Project $project)
$nbTasks = count($taskstatic->getTasksArray(0, 0, $project->id, 0, 0)); $nbTasks = count($taskstatic->getTasksArray(0, 0, $project->id, 0, 0));
dol_setcache($cachekey, $nbTasks, 120); // If setting cache fails, this is not a problem, so we do not test result. dol_setcache($cachekey, $nbTasks, 120); // If setting cache fails, this is not a problem, so we do not test result.
} }
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks.php?id='.$project->id; $head[$h][0] = DOL_URL_ROOT.'/projet/tasks.php?id='.((int) $project->id).($moreparam ? '&'.$moreparam : '');
$head[$h][1] = $langs->trans("Tasks"); $head[$h][1] = $langs->trans("Tasks");
if ($nbTasks > 0) { if ($nbTasks > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbTasks).'</span>'; $head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbTasks).'</span>';
@ -113,7 +114,7 @@ function project_prepare_head(Project $project)
} }
} }
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/time.php?withproject=1&projectid='.urlencode($project->id); $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/time.php?withproject=1&projectid='.((int) $project->id).($moreparam ? '&'.$moreparam : '');
$head[$h][1] = $langs->trans("TimeSpent"); $head[$h][1] = $langs->trans("TimeSpent");
if ($nbTimeSpent > 0) { if ($nbTimeSpent > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">...</span>'; $head[$h][1] .= '<span class="badge marginleftonlyshort">...</span>';
@ -207,7 +208,7 @@ function project_prepare_head(Project $project)
if ($conf->eventorganization->enabled && !empty($project->usage_organize_event)) { if ($conf->eventorganization->enabled && !empty($project->usage_organize_event)) {
$langs->load('eventorganization'); $langs->load('eventorganization');
$head[$h][0] = DOL_URL_ROOT . '/eventorganization/conferenceorbooth_list.php?projectid=' . $project->id; $head[$h][0] = DOL_URL_ROOT . '/eventorganization/conferenceorbooth_list.php?projectid=' . $project->id;
$head[$h][1] = $langs->trans("ConferenceOrBoothTab"); $head[$h][1] = $langs->trans("EventOrganization");
// Enable caching of conf or booth count // Enable caching of conf or booth count
$nbConfOrBooth = 0; $nbConfOrBooth = 0;

View File

@ -611,7 +611,7 @@ function checkUserAccessToObject($user, array $featuresarray, $objectid = 0, $ta
$feature = 'projet_task'; $feature = 'projet_task';
} }
$check = array('adherent', 'banque', 'bom', 'don', 'mrp', 'user', 'usergroup', 'payment', 'payment_supplier', 'product', 'produit', 'service', 'produit|service', 'categorie', 'resource', 'expensereport', 'holiday', 'salary', 'website'); // Test on entity only (Objects with no link to company) $check = array('adherent', 'banque', 'bom', 'don', 'mrp', 'user', 'usergroup', 'payment', 'payment_supplier', 'product', 'produit', 'service', 'produit|service', 'categorie', 'resource', 'expensereport', 'holiday', 'salaries', 'website'); // Test on entity only (Objects with no link to company)
$checksoc = array('societe'); // Test for societe object $checksoc = array('societe'); // Test for societe object
$checkother = array('contact', 'agenda'); // Test on entity + link to third party on field $dbt_keyfield. Allowed if link is empty (Ex: contacts...). $checkother = array('contact', 'agenda'); // Test on entity + link to third party on field $dbt_keyfield. Allowed if link is empty (Ex: contacts...).
$checkproject = array('projet', 'project'); // Test for project object $checkproject = array('projet', 'project'); // Test for project object

View File

@ -382,12 +382,18 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
'submenus' => array(), 'submenus' => array(),
); );
// Tickets and knwoledge base // Tickets and knowledge base
$tmpentry = array( $tmpentry = array(
'enabled'=>(!empty($conf->ticket->enabled) || !empty($conf->knwoledgemanagement->enabled)), 'enabled'=>(!empty($conf->ticket->enabled) || !empty($conf->knowledgemanagement->enabled)),
'perms'=>(!empty($user->rights->ticket->read) || !empty($user->rights->knwoledgemanagement->read)), 'perms'=>(!empty($user->rights->ticket->read) || !empty($user->rights->knowledgemanagement->knowledgerecord->read)),
'module'=>'ticket|knwoledgemanagement' 'module'=>'ticket|knowledgemanagement'
); );
$link = '';
if (!empty($conf->ticket->enabled)) {
$link = '/ticket/index.php?mainmenu=ticket&amp;leftmenu=';
} else {
$link = '/knowledgemanagement/knowledgerecord_list.php?mainmenu=ticket&amp;leftmenu=';
}
$menu_arr[] = array( $menu_arr[] = array(
'name' => 'Ticket', 'name' => 'Ticket',
'link' => '/ticket/index.php?mainmenu=ticket&amp;leftmenu=', 'link' => '/ticket/index.php?mainmenu=ticket&amp;leftmenu=',
@ -2092,8 +2098,10 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
$cssmenu = ' menu_contenu'.dol_string_nospecial(preg_replace('/\.php.*$/', '', $menu_array[$i]['url'])); $cssmenu = ' menu_contenu'.dol_string_nospecial(preg_replace('/\.php.*$/', '', $menu_array[$i]['url']));
} }
if ($menu_array[$i]['enabled'] && $lastlevel0 == 'enabled') { // Enabled so visible, except if parent was not enabled. if ($menu_array[$i]['enabled'] && $lastlevel0 == 'enabled') {
print '<div class="menu_contenu'.$cssmenu.'">'.$tabstring; // Enabled so visible, except if parent was not enabled.
print '<div class="menu_contenu'.$cssmenu.'">';
print $tabstring;
if ($shorturlwithoutparam) { if ($shorturlwithoutparam) {
print '<a class="vsmenu" title="'.dol_escape_htmltag(dol_string_nohtmltag($menu_array[$i]['titre'])).'" href="'.$url.'"'.($menu_array[$i]['target'] ? ' target="'.$menu_array[$i]['target'].'"' : '').'>'; print '<a class="vsmenu" title="'.dol_escape_htmltag(dol_string_nohtmltag($menu_array[$i]['titre'])).'" href="'.$url.'"'.($menu_array[$i]['target'] ? ' target="'.$menu_array[$i]['target'].'"' : '').'>';
} else { } else {
@ -2110,8 +2118,11 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
print '<br>'; print '<br>';
} }
print '</div>'."\n"; print '</div>'."\n";
} elseif ($showmenu && $lastlevel0 == 'enabled') { // Not enabled but visible (so greyed), except if parent was not enabled. } elseif ($showmenu && $lastlevel0 == 'enabled') {
print '<div class="menu_contenu'.$cssmenu.'">'.$tabstring.'<font class="vsmenudisabled vsmenudisabledmargin">'.$menu_array[$i]['titre'].'</font><br></div>'."\n"; // Not enabled but visible (so greyed), except if parent was not enabled.
print '<div class="menu_contenu'.$cssmenu.'">';
print $tabstring;
print '<font class="vsmenudisabled vsmenudisabledmargin">'.$menu_array[$i]['titre'].'</font><br></div>'."\n";
} }
} }

View File

@ -206,6 +206,7 @@ class MenuManager
$canonnexturl = preg_replace('/\?.*$/', '', $nexturl); $canonnexturl = preg_replace('/\?.*$/', '', $nexturl);
//var_dump($canonrelurl); //var_dump($canonrelurl);
//var_dump($canonnexturl); //var_dump($canonnexturl);
print '<ul>'."\n"; print '<ul>'."\n";
if (($canonrelurl != $canonnexturl && !in_array($val['mainmenu'], array('tools'))) if (($canonrelurl != $canonnexturl && !in_array($val['mainmenu'], array('tools')))
|| (strpos($canonrelurl, '/product/index.php') !== false || strpos($canonrelurl, '/compta/bank/list.php') !== false)) { || (strpos($canonrelurl, '/product/index.php') !== false || strpos($canonrelurl, '/compta/bank/list.php') !== false)) {
@ -225,15 +226,18 @@ class MenuManager
print '</li>'."\n"; print '</li>'."\n";
} }
/*
if ($val['level'] == 0) { if ($val['level'] == 0) {
if ($val['enabled']) { if ($val['enabled']) {
$lastlevel[0] = 'enabled'; $lastlevel[0] = 'enabled';
} elseif ($showmenu) { // Not enabled but visible (so greyed) } elseif ($showmenu) {
// Not enabled but visible (so greyed)
$lastlevel[0] = 'greyed'; $lastlevel[0] = 'greyed';
} else { } else {
$lastlevel[0] = 'hidden'; $lastlevel[0] = 'hidden';
} }
} }
*/
$lastlevel2 = array(); $lastlevel2 = array();
foreach ($submenu->liste as $key2 => $val2) { // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu' foreach ($submenu->liste as $key2 => $val2) { // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu'
@ -313,7 +317,14 @@ class MenuManager
print '</ul>'; print '</ul>';
} }
if ($val['enabled'] == 2) { if ($val['enabled'] == 2) {
print '<font class="vsmenudisabled">'.$val['titre'].'</font>'; print '<font class="vsmenudisabled">';
// Add font-awesome
if ($val['level'] == 0 && !empty($val['prefix'])) {
print $val['prefix'];
}
print $val['titre'];
print '</font>';
} }
print '</li>'; print '</li>';
print '</ul>'."\n"; print '</ul>'."\n";

View File

@ -285,13 +285,12 @@ class MenuManager
} }
print $disabled.'">'; // ui-btn to highlight on clic print $disabled.'">'; // ui-btn to highlight on clic
if ($relurl2) { if ($relurl2) {
if ($val2['enabled']) { // Allowed if ($val2['enabled']) {
print '<a href="'.$relurl2.'"'; // Allowed
//print ' data-ajax="false"'; print '<a href="'.$relurl2.'">';
print '>';
$lastlevel2[$val2['level']] = 'enabled'; $lastlevel2[$val2['level']] = 'enabled';
} else // Not allowed but visible (greyed) } else {
{ // Not allowed but visible (greyed)
print '<a href="#" class="vsmenudisabled">'; print '<a href="#" class="vsmenudisabled">';
$lastlevel2[$val2['level']] = 'greyed'; $lastlevel2[$val2['level']] = 'greyed';
} }
@ -310,6 +309,7 @@ class MenuManager
// Allowed // Allowed
print '</a>'; print '</a>';
} else { } else {
// Not allowed
print '</a>'; print '</a>';
} }
} }

View File

@ -1221,6 +1221,14 @@ class pdf_crabe extends ModelePDFFactures
$default_font_size = pdf_getPDFFontSize($outputlangs); $default_font_size = pdf_getPDFFontSize($outputlangs);
$outputlangsbis = null;
if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) {
$outputlangsbis = new Translate('', $conf);
$outputlangsbis->setDefaultLang($conf->global->PDF_USE_ALSO_LANGUAGE_CODE);
$outputlangsbis->loadLangs(array("main", "dict", "companies", "bills", "products", "propal"));
$default_font_size--;
}
$tab2_top = $posy; $tab2_top = $posy;
$tab2_hl = 4; $tab2_hl = 4;
$pdf->SetFont('', '', $default_font_size - 1); $pdf->SetFont('', '', $default_font_size - 1);
@ -1239,7 +1247,7 @@ class pdf_crabe extends ModelePDFFactures
// Total HT // Total HT
$pdf->SetFillColor(255, 255, 255); $pdf->SetFillColor(255, 255, 255);
$pdf->SetXY($col1x, $tab2_top + 0); $pdf->SetXY($col1x, $tab2_top + 0);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) ? "TotalHT" : "Total").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities(empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) ? "TotalHT" : "Total") : ''), 0, 'L', 1);
$total_ht = ((!empty($conf->multicurrency->enabled) && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht); $total_ht = ((!empty($conf->multicurrency->enabled) && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht);
$pdf->SetXY($col2x, $tab2_top + 0); $pdf->SetXY($col2x, $tab2_top + 0);

View File

@ -1368,7 +1368,7 @@ class pdf_sponge extends ModelePDFFactures
$posy = $pdf->GetY(); $posy = $pdf->GetY();
} }
// cumul TVA précédent // Cumulate preceding VAT
$index++; $index++;
$pdf->SetFillColor(255, 255, 255); $pdf->SetFillColor(255, 255, 255);
$pdf->SetXY($col1x, $posy); $pdf->SetXY($col1x, $posy);
@ -1442,7 +1442,7 @@ class pdf_sponge extends ModelePDFFactures
// Total remise // Total remise
$total_line_remise = 0; $total_line_remise = 0;
foreach ($object->lines as $i => $line) { foreach ($object->lines as $i => $line) {
$total_line_remise += pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, 2); // TODO: add this methode to core/lib/pdf.lib $total_line_remise += pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, 2); // TODO: add this method to core/lib/pdf.lib
// Gestion remise sous forme de ligne négative // Gestion remise sous forme de ligne négative
if ($line->total_ht < 0) { if ($line->total_ht < 0) {
$total_line_remise += -$line->total_ht; $total_line_remise += -$line->total_ht;
@ -1473,7 +1473,7 @@ class pdf_sponge extends ModelePDFFactures
// Total HT // Total HT
$pdf->SetFillColor(255, 255, 255); $pdf->SetFillColor(255, 255, 255);
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("TotalHT") : ''), 0, 'L', 1); $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) ? "TotalHT" : "Total").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities(empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) ? "TotalHT" : "Total") : ''), 0, 'L', 1);
$total_ht = ((!empty($conf->multicurrency->enabled) && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht); $total_ht = ((!empty($conf->multicurrency->enabled) && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);

View File

@ -134,16 +134,18 @@ class modApi extends DolibarrModules
// Permissions // Permissions
$this->rights = array(); // Permission array used by this module $this->rights = array(); // Permission array used by this module
$this->rights_admin_allowed = 1; // Admin is always granted of permission (even when module is disabled)
$r = 0; $r = 0;
// Add here list of permission defined by an id, a label, a boolean and two constant strings. // Add here list of permission defined by an id, a label, a boolean and two constant strings.
// Example: // Example:
// $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
// $this->rights[$r][1] = 'Permision label'; // Permission label $this->rights[$r][1] = 'Générer / modifier la clé API des utilisateurs'; // Permission label
// $this->rights[$r][3] = 0; // Permission by default for new user (0/1) $this->rights[$r][3] = 0; // Permission by default for new user (0/1)
// $this->rights[$r][4] = 'level1'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) $this->rights[$r][4] = 'apikey'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
// $this->rights[$r][5] = 'level2'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) $this->rights[$r][5] = 'generate'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
// $r++; $r++;
// Main menu entries // Main menu entries

View File

@ -69,12 +69,12 @@ class modFckeditor extends DolibarrModules
// Constants // Constants
$this->const = array(); $this->const = array();
$this->const[0] = array("FCKEDITOR_ENABLE_SOCIETE", "yesno", "1", "WYSIWIG for description and note (except products/services)"); $this->const[0] = array("FCKEDITOR_ENABLE_SOCIETE", "yesno", "1", "WYSIWIG for description and note (except products/services)");
$this->const[1] = array("FCKEDITOR_ENABLE_PRODUCTDESC", "yesno", "1", "WYSIWIG for products/services description and note"); $this->const[1] = array("FCKEDITOR_ENABLE_PRODUCTDESC", "yesno", "1", "WYSIWIG for products/services description and note");
$this->const[2] = array("FCKEDITOR_ENABLE_MAILING", "yesno", "1", "WYSIWIG for mass emailings"); $this->const[2] = array("FCKEDITOR_ENABLE_MAILING", "yesno", "1", "WYSIWIG for mass emailings");
$this->const[3] = array("FCKEDITOR_ENABLE_DETAILS", "yesno", "1", "WYSIWIG for products details lines for all entities"); $this->const[3] = array("FCKEDITOR_ENABLE_DETAILS", "yesno", "1", "WYSIWIG for products details lines for all entities");
$this->const[4] = array("FCKEDITOR_ENABLE_USERSIGN", "yesno", "1", "WYSIWIG for user signature"); $this->const[4] = array("FCKEDITOR_ENABLE_USERSIGN", "yesno", "1", "WYSIWIG for user signature");
$this->const[5] = array("FCKEDITOR_ENABLE_MAIL", "yesno", "1", "WYSIWIG for products details lines for all entities"); $this->const[5] = array("FCKEDITOR_ENABLE_MAIL", "yesno", "1", "WYSIWIG for products details lines for all entities");
$this->const[6] = array("FCKEDITOR_SKIN", "string", "moono-lisa", "Skin by default for fckeditor"); $this->const[6] = array("FCKEDITOR_SKIN", "string", "moono-lisa", "Skin by default for fckeditor");
// Boxes // Boxes

View File

@ -362,6 +362,19 @@ class modKnowledgeManagement extends DolibarrModules
// 0=Menu for internal users, 1=external users, 2=both // 0=Menu for internal users, 1=external users, 2=both
'user'=>2 'user'=>2
); );
$this->menu[$r++] = array(
'fk_menu' => 'fk_mainmenu=ticket,fk_leftmenu=knowledgemanagement_knowledgerecord',
'type' => 'left',
'titre' => 'Categories',
'mainmenu' => 'ticket',
'url' => '/categories/index.php?type=13',
'langs' => 'knowledgemanagement',
'position' => 112,
'enabled' => '$conf->knowledgemanagement->enabled',
'perms' => '$user->rights->knowledgemanagement->knowledgerecord->read',
'target' => '',
'user' => 0
);
/* END MODULEBUILDER LEFTMENU KNOWLEDGERECORD */ /* END MODULEBUILDER LEFTMENU KNOWLEDGERECORD */

View File

@ -84,18 +84,31 @@ if (isset($extrafields->attributes[$elementtype]['type']) && is_array($extrafiel
} }
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print "<td>".$extrafields->attributes[$elementtype]['pos'][$key]."</td>\n"; // Position
print "<td>".$extrafields->attributes[$elementtype]['label'][$key]."</td>\n"; // We don't translate here, we want admin to know what is the key not translated value print "<td>".dol_escape_htmltag($extrafields->attributes[$elementtype]['pos'][$key])."</td>\n";
print "<td>".$langs->trans($extrafields->attributes[$elementtype]['label'][$key])."</td>\n"; // Label
print "<td>".$key."</td>\n"; print "<td>".dol_escape_htmltag($extrafields->attributes[$elementtype]['label'][$key])."</td>\n"; // We don't translate here, we want admin to know what is the key not translated value
print "<td>".$type2label[$extrafields->attributes[$elementtype]['type'][$key]]."</td>\n"; // Label translated
print '<td class="right">'.$extrafields->attributes[$elementtype]['size'][$key]."</td>\n"; print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv($extrafields->attributes[$elementtype]['label'][$key])).'">'.dol_escape_htmltag($langs->transnoentitiesnoconv($extrafields->attributes[$elementtype]['label'][$key]))."</td>\n";
print '<td>'.dol_trunc($extrafields->attributes[$elementtype]['computed'][$key], 20)."</td>\n"; // Key
print "<td>".dol_escape_htmltag($key)."</td>\n";
// Type
print "<td>".dol_escape_htmltag($type2label[$extrafields->attributes[$elementtype]['type'][$key]])."</td>\n";
// Size
print '<td class="right">'.dol_escape_htmltag($extrafields->attributes[$elementtype]['size'][$key])."</td>\n";
// Computed field
print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($extrafields->attributes[$elementtype]['computed'][$key]).'">'.dol_escape_htmltag($extrafields->attributes[$elementtype]['computed'][$key])."</td>\n";
// Is unique ?
print '<td class="center">'.yn($extrafields->attributes[$elementtype]['unique'][$key])."</td>\n"; print '<td class="center">'.yn($extrafields->attributes[$elementtype]['unique'][$key])."</td>\n";
// Is mandatory ?
print '<td class="center">'.yn($extrafields->attributes[$elementtype]['required'][$key])."</td>\n"; print '<td class="center">'.yn($extrafields->attributes[$elementtype]['required'][$key])."</td>\n";
// Can always be editable ?
print '<td class="center">'.yn($extrafields->attributes[$elementtype]['alwayseditable'][$key])."</td>\n"; print '<td class="center">'.yn($extrafields->attributes[$elementtype]['alwayseditable'][$key])."</td>\n";
print '<td class="center">'.$extrafields->attributes[$elementtype]['list'][$key]."</td>\n"; // Visible
print '<td class="center">'.$extrafields->attributes[$elementtype]['printable'][$key]."</td>\n"; print '<td class="center tdoverflowmax100" title="'.dol_escape_htmltag($extrafields->attributes[$elementtype]['list'][$key]).'">'.dol_escape_htmltag($extrafields->attributes[$elementtype]['list'][$key])."</td>\n";
// Print on PDF
print '<td class="center tdoverflowmax100" title="'.dol_escape_htmltag($extrafields->attributes[$elementtype]['printable'][$key]).'">'.dol_escape_htmltag($extrafields->attributes[$elementtype]['printable'][$key])."</td>\n";
// Summable
print '<td class="center">'.yn($extrafields->attributes[$elementtype]['totalizable'][$key])."</td>\n"; print '<td class="center">'.yn($extrafields->attributes[$elementtype]['totalizable'][$key])."</td>\n";
if (!empty($conf->multicompany->enabled)) { if (!empty($conf->multicompany->enabled)) {
print '<td class="center">'; print '<td class="center">';
@ -116,8 +129,8 @@ if (isset($extrafields->attributes[$elementtype]['type']) && is_array($extrafiel
print '</td>'; print '</td>';
} }
print '<td class="right nowraponall">'; print '<td class="right nowraponall">';
print '<a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&attrname='.$key.'#formeditextrafield">'.img_edit().'</a>'; print '<a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&attrname='.urlencode($key).'#formeditextrafield">'.img_edit().'</a>';
print '&nbsp; <a class="paddingleft" href="'.$_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&attrname='.$key.'">'.img_delete().'</a>'; print '&nbsp; <a class="paddingleft" href="'.$_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&attrname='.urlencode($key).'">'.img_delete().'</a>';
print '</td>'."\n"; print '</td>'."\n";
print "</tr>"; print "</tr>";
} }

View File

@ -184,7 +184,7 @@ if ($action == 'presend') {
$listeuser = array(); $listeuser = array();
$fuserdest = new User($db); $fuserdest = new User($db);
$result = $fuserdest->fetchAll('ASC', 't.lastname', 0, 0, array('customsql'=>'t.statut=1 AND t.employee=1 AND t.email IS NOT NULL AND t.email<>\'\''), 'AND', true); $result = $fuserdest->fetchAll('ASC', 't.lastname', 0, 0, array('customsql'=>"t.statut=1 AND t.employee=1 AND t.email IS NOT NULL AND t.email <> ''"), 'AND', true);
if ($result > 0 && is_array($fuserdest->users) && count($fuserdest->users) > 0) { if ($result > 0 && is_array($fuserdest->users) && count($fuserdest->users) > 0) {
foreach ($fuserdest->users as $uuserdest) { foreach ($fuserdest->users as $uuserdest) {
$listeuser[$uuserdest->id] = $uuserdest->user_get_property($uuserdest->id, 'email'); $listeuser[$uuserdest->id] = $uuserdest->user_get_property($uuserdest->id, 'email');

View File

@ -58,7 +58,7 @@ foreach ($object->fields as $key => $val) {
$value = $object->$key; $value = $object->$key;
print '<tr class="field_'.$key.'"><td'; print '<tr class="field_'.$key.'"><td';
print ' class="titlefield fieldname_'.$key; print ' class="'.(empty($val['tdcss']) ? 'titlefield' : $val['tdcss']).' fieldname_'.$key;
//if ($val['notnull'] > 0) print ' fieldrequired'; // No fieldrequired on the view output //if ($val['notnull'] > 0) print ' fieldrequired'; // No fieldrequired on the view output
if ($val['type'] == 'text' || $val['type'] == 'html') { if ($val['type'] == 'text' || $val['type'] == 'html') {
print ' tdtop'; print ' tdtop';
@ -140,7 +140,7 @@ foreach ($object->fields as $key => $val) {
$value = $object->$key; $value = $object->$key;
print '<tr><td'; print '<tr><td';
print ' class="titlefield fieldname_'.$key; print ' class="'.(empty($val['tdcss']) ? 'titlefield' : $val['tdcss']).' fieldname_'.$key;
//if ($val['notnull'] > 0) print ' fieldrequired'; // No fieldrequired inthe view output //if ($val['notnull'] > 0) print ' fieldrequired'; // No fieldrequired inthe view output
if ($val['type'] == 'text' || $val['type'] == 'html') { if ($val['type'] == 'text' || $val['type'] == 'html') {
print ' tdtop'; print ' tdtop';

View File

@ -89,7 +89,7 @@ if ($permission) {
?> ?>
<form class="tagtr liste_titre"> <form class="tagtr liste_titre">
<div class="tagtd liste_titre"><?php echo $langs->trans("ThirdParty"); ?></div> <div class="tagtd liste_titre"><?php echo img_object('', 'company', 'class="optiongrey paddingright"').$langs->trans("ThirdParty"); ?></div>
<div class="tagtd liste_titre"><?php echo img_picto($langs->trans("Users"), 'user', 'class="optiongrey paddingright"').$langs->trans("Users").' | '.img_picto($langs->trans("Contacts"), 'contact', 'class="optiongrey paddingright"').$langs->trans("Contacts"); ?></div> <div class="tagtd liste_titre"><?php echo img_picto($langs->trans("Users"), 'user', 'class="optiongrey paddingright"').$langs->trans("Users").' | '.img_picto($langs->trans("Contacts"), 'contact', 'class="optiongrey paddingright"').$langs->trans("Contacts"); ?></div>
<div class="tagtd liste_titre"><?php echo $langs->trans("ContactType"); ?></div> <div class="tagtd liste_titre"><?php echo $langs->trans("ContactType"); ?></div>
<div class="tagtd liste_titre">&nbsp;</div> <div class="tagtd liste_titre">&nbsp;</div>
@ -140,11 +140,8 @@ if ($permission) {
} ?> } ?>
<div class="tagtd nowrap maxwidthonsmartphone noborderbottom"> <div class="tagtd nowrap maxwidthonsmartphone noborderbottom">
<?php $selectedCompany = isset($_GET["newcompany"]) ? $_GET["newcompany"] : (empty($object->socid) ? 0 : $object->socid); <?php
// add company icon before select list $selectedCompany = GETPOSTISSET("newcompany") ? GETPOST("newcompany", 'int') : (empty($object->socid) ? 0 : $object->socid);
if ($selectedCompany) {
echo img_object('', 'company', 'class="hideonsmartphone"');
}
$selectedCompany = $formcompany->selectCompaniesForNewContact($object, 'id', $selectedCompany, 'newcompany', '', 0, '', 'minwidth300imp'); ?> $selectedCompany = $formcompany->selectCompaniesForNewContact($object, 'id', $selectedCompany, 'newcompany', '', 0, '', 'minwidth300imp'); ?>
</div> </div>
<!-- <div class="tagtd nowrap noborderbottom"><?php echo img_object('', 'contact').' '.$langs->trans("ThirdPartyContacts"); ?></div>--> <!-- <div class="tagtd nowrap noborderbottom"><?php echo img_object('', 'contact').' '.$langs->trans("ThirdPartyContacts"); ?></div>-->

View File

@ -194,6 +194,9 @@ if (empty($reshook) && isset($extrafields->attributes[$object->table_element]['l
if ($object->element == 'contact') { if ($object->element == 'contact') {
$permok = $user->rights->societe->contact->creer; $permok = $user->rights->societe->contact->creer;
} }
if ($object->element == 'salary') {
$permok = $user->rights->salaries->read;
}
$isdraft = ((isset($object->statut) && $object->statut == 0) || (isset($object->status) && $object->status == 0)); $isdraft = ((isset($object->statut) && $object->statut == 0) || (isset($object->status) && $object->status == 0));
if (($isdraft || !empty($extrafields->attributes[$object->table_element]['alwayseditable'][$tmpkeyextra])) if (($isdraft || !empty($extrafields->attributes[$object->table_element]['alwayseditable'][$tmpkeyextra]))

View File

@ -73,7 +73,7 @@ class ConferenceOrBooth extends ActionComm
/** /**
* 'type' field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'sellist:TableName:LabelFieldName[:KeyFieldName[:KeyFieldParent[:Filter]]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'text:none', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password') * 'type' field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]', 'sellist:TableName:LabelFieldName[:KeyFieldName[:KeyFieldParent[:Filter]]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'text:none', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password')
* Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)"
* 'label' the translation key. * 'label' the translation key.
* 'picto' is code of a picto to show before value in forms * 'picto' is code of a picto to show before value in forms
@ -106,10 +106,10 @@ class ConferenceOrBooth extends ActionComm
'id' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), 'id' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"),
'ref' => array('type'=>'integer', 'label'=>'Ref', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>2, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), 'ref' => array('type'=>'integer', 'label'=>'Ref', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>2, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"),
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>0, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'help'=>"Help text", 'showoncombobox'=>'1',), 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>0, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'help'=>"Help text", 'showoncombobox'=>'1',),
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"LinkToThirparty",), 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"LinkToThirparty", 'picto'=>'company', 'css'=>'maxwidth500'),
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1::eventorganization', 'label'=>'Project', 'enabled'=>'1', 'position'=>52, 'notnull'=>-1, 'visible'=>-1, 'index'=>1,), 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1:t.usage_organize_event=1', 'label'=>'Project', 'enabled'=>'1', 'position'=>52, 'notnull'=>-1, 'visible'=>-1, 'index'=>1, 'picto'=>'project'),
'note' => array('type'=>'text', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>1), 'note' => array('type'=>'text', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>1),
'fk_action' => array('type'=>'sellist:c_actioncomm:libelle:id::module LIKE (\'%@eventorganization\')', 'label'=>'Format', 'enabled'=>'1', 'position'=>60, 'notnull'=>1, 'visible'=>1,), 'fk_action' => array('type'=>'sellist:c_actioncomm:libelle:id::module LIKE (\'%@eventorganization\')', 'label'=>'Format', 'enabled'=>'1', 'position'=>60, 'notnull'=>1, 'visible'=>1, 'css'=>'width300'),
'datep' => array('type'=>'datetime', 'label'=>'DateStart', 'enabled'=>'1', 'position'=>70, 'notnull'=>0, 'visible'=>1, 'showoncombobox'=>'2',), 'datep' => array('type'=>'datetime', 'label'=>'DateStart', 'enabled'=>'1', 'position'=>70, 'notnull'=>0, 'visible'=>1, 'showoncombobox'=>'2',),
'datep2' => array('type'=>'datetime', 'label'=>'DateEnd', 'enabled'=>'1', 'position'=>71, 'notnull'=>0, 'visible'=>1, 'showoncombobox'=>'3',), 'datep2' => array('type'=>'datetime', 'label'=>'DateEnd', 'enabled'=>'1', 'position'=>71, 'notnull'=>0, 'visible'=>1, 'showoncombobox'=>'3',),
'datec' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,), 'datec' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,),
@ -246,7 +246,7 @@ class ConferenceOrBooth extends ActionComm
$result = parent::fetch($id, $ref, $ref_ext, $email_msgid); $result = parent::fetch($id, $ref, $ref_ext, $email_msgid);
$link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_subscription.php?id='.urlencode($id).'&type=conf'; $link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_register.php?id='.urlencode($id).'&type=conf';
$encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 2); $encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 2);
$link_subscription .= '&securekey='.urlencode($encodedsecurekey); $link_subscription .= '&securekey='.urlencode($encodedsecurekey);
@ -565,7 +565,7 @@ class ConferenceOrBooth extends ActionComm
$label .= '<br>'; $label .= '<br>';
$label .= '<b>'.$langs->trans('Ref').':</b> '.$this->id; $label .= '<b>'.$langs->trans('Ref').':</b> '.$this->id;
$url = dol_buildpath('/eventorganization/conferenceorbooth_card.php', 1).'?id='.$this->id; $url = DOL_URL_ROOT.'/eventorganization/conferenceorbooth_card.php?id='.$this->id;
if ($option != 'nolink') { if ($option != 'nolink') {
// Add param to save lastsearch_values or not // Add param to save lastsearch_values or not
@ -749,7 +749,7 @@ class ConferenceOrBooth extends ActionComm
$this->lines = array(); $this->lines = array();
$objectline = new ConferenceOrBoothLine($this->db); $objectline = new ConferenceOrBoothLine($this->db);
$result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql'=>'fk_conferenceorbooth = '.$this->id)); $result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql'=>'fk_conferenceorbooth = '.((int) $this->id)));
if (is_numeric($result)) { if (is_numeric($result)) {
$this->error = $this->error; $this->error = $this->error;

View File

@ -63,6 +63,7 @@ class ConferenceOrBoothAttendee extends CommonObject
*/ */
public $picto = 'contact'; public $picto = 'contact';
public $paid = 0;
const STATUS_DRAFT = 0; const STATUS_DRAFT = 0;
const STATUS_VALIDATED = 1; const STATUS_VALIDATED = 1;
@ -102,12 +103,12 @@ class ConferenceOrBoothAttendee extends CommonObject
public $fields=array( public $fields=array(
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"),
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>2, 'index'=>1, 'comment'=>"Reference of object"), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>2, 'index'=>1, 'comment'=>"Reference of object"),
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'Attendee', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"LinkToThirparty",), 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status = 1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'Attendee', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"LinkToThirparty", 'picto'=>'company', 'css'=>'maxwidth500'),
'fk_actioncomm' => array('type'=>'integer:ActionComm:comm/action/class/actioncomm.class.php:1', 'label'=>'ConferenceOrBooth', 'enabled'=>'1', 'position'=>53, 'notnull'=>0, 'visible'=>0, 'index'=>1,), 'fk_actioncomm' => array('type'=>'integer:ActionComm:comm/action/class/actioncomm.class.php:1', 'label'=>'ConferenceOrBooth', 'enabled'=>'1', 'position'=>53, 'notnull'=>0, 'visible'=>0, 'index'=>1, 'picto'=>'agenda'),
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>'1', 'position'=>54, 'notnull'=>1, 'visible'=>0, 'index'=>1,), 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>'1', 'position'=>54, 'notnull'=>1, 'visible'=>0, 'index'=>1, 'picto'=>'project'),
'email' => array('type'=>'mail', 'label'=>'Email', 'enabled'=>'1', 'position'=>55, 'notnull'=>1, 'visible'=>1, 'index'=>1,), 'email' => array('type'=>'mail', 'label'=>'Email', 'enabled'=>'1', 'position'=>55, 'notnull'=>1, 'visible'=>1, 'index'=>1,),
'date_subscription' => array('type'=>'datetime', 'label'=>'DateSubscription', 'enabled'=>'1', 'position'=>56, 'notnull'=>0, 'visible'=>1, 'showoncombobox'=>'1',), 'date_subscription' => array('type'=>'datetime', 'label'=>'DateOfRegistration', 'enabled'=>'1', 'position'=>56, 'notnull'=>0, 'visible'=>1, 'showoncombobox'=>'1',),
'amount' => array('type'=>'price', 'label'=>'AmountOfSubscriptionPaid', 'enabled'=>'1', 'position'=>57, 'notnull'=>0, 'visible'=>1, 'default'=>'null', 'isameasure'=>'1', 'help'=>"AmountOfSubscriptionPaid",), 'amount' => array('type'=>'price', 'label'=>'AmountPaid', 'enabled'=>'1', 'position'=>57, 'notnull'=>0, 'visible'=>1, 'default'=>'null', 'isameasure'=>'1', 'help'=>"AmountOfSubscriptionPaid",),
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>61, 'notnull'=>0, 'visible'=>0,), 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>61, 'notnull'=>0, 'visible'=>0,),
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>'1', 'position'=>62, 'notnull'=>0, 'visible'=>0,), 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>'1', 'position'=>62, 'notnull'=>0, 'visible'=>0,),
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,), 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,),
@ -196,8 +197,10 @@ class ConferenceOrBoothAttendee extends CommonObject
if (!empty($conf->global->EVENTORGANIZATION_FILTERATTENDEES_CAT)) { if (!empty($conf->global->EVENTORGANIZATION_FILTERATTENDEES_CAT)) {
$this->fields['fk_soc']['type'] .= ' AND rowid IN (SELECT DISTINCT c.fk_soc FROM '.MAIN_DB_PREFIX.'categorie_societe as c WHERE c.fk_categorie='.(int) $conf->global->EVENTORGANIZATION_FILTERATTENDEES_CAT.')'; $this->fields['fk_soc']['type'] .= ' AND rowid IN (SELECT DISTINCT c.fk_soc FROM '.MAIN_DB_PREFIX.'categorie_societe as c WHERE c.fk_categorie='.(int) $conf->global->EVENTORGANIZATION_FILTERATTENDEES_CAT.')';
} }
if ($conf->global->EVENTORGANIZATION_FILTERATTENDEES_TYPE!=='') { if (isset($conf->global->EVENTORGANIZATION_FILTERATTENDEES_TYPE)
$this->fields['fk_soc']['type'] .= ' AND client='.(int) $conf->global->EVENTORGANIZATION_FILTERATTENDEES_TYPE; && $conf->global->EVENTORGANIZATION_FILTERATTENDEES_TYPE !== ''
&& $conf->global->EVENTORGANIZATION_FILTERATTENDEES_TYPE !== '-1') {
$this->fields['fk_soc']['type'] .= ' AND client = '.(int) $conf->global->EVENTORGANIZATION_FILTERATTENDEES_TYPE;
} }
// Example to show how to set values of fields definition dynamically // Example to show how to set values of fields definition dynamically
@ -389,7 +392,7 @@ class ConferenceOrBoothAttendee extends CommonObject
* @param string $sortfield Sort field * @param string $sortfield Sort field
* @param int $limit limit * @param int $limit limit
* @param int $offset Offset * @param int $offset Offset
* @param array $filter Filter array. Example array('field'=>'valueforlike', 'customurl'=>...) * @param array $filter Filter array. Example array('field'=>'valueforlike', 'customurl'=>...). WARNING: customerurl must be a sanitized SQL string.
* @param string $filtermode Filter mode (AND or OR) * @param string $filtermode Filter mode (AND or OR)
* @return array|int int <0 if KO, array of pages if OK * @return array|int int <0 if KO, array of pages if OK
*/ */
@ -404,7 +407,7 @@ class ConferenceOrBoothAttendee extends CommonObject
$sql = 'SELECT '; $sql = 'SELECT ';
$sql .= $this->getFieldList('t'); $sql .= $this->getFieldList('t');
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."actioncomm as a on a.id=t.fk_actioncomm"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."actioncomm as a on a.id = t.fk_actioncomm";
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) { if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
$sql .= ' WHERE t.entity IN ('.getEntity($this->table_element).')'; $sql .= ' WHERE t.entity IN ('.getEntity($this->table_element).')';
} else { } else {
@ -415,9 +418,9 @@ class ConferenceOrBoothAttendee extends CommonObject
if (count($filter) > 0) { if (count($filter) > 0) {
foreach ($filter as $key => $value) { foreach ($filter as $key => $value) {
if ($key == 't.rowid' || $key == 't.fk_soc' || $key == 't.fk_project' || $key == 't.fk_actioncomm') { if ($key == 't.rowid' || $key == 't.fk_soc' || $key == 't.fk_project' || $key == 't.fk_actioncomm') {
$sqlwhere[] = $key.'='.$value; $sqlwhere[] = $key.'='.((int) $value);
} elseif (in_array($this->fields[$key]['type'], array('date', 'datetime', 'timestamp'))) { } elseif (in_array($this->fields[$key]['type'], array('date', 'datetime', 'timestamp'))) {
$sqlwhere[] = $key.' = \''.$this->db->idate($value).'\''; $sqlwhere[] = $key." = '".$this->db->idate($value)."'";
} elseif ($key == 'customsql') { } elseif ($key == 'customsql') {
$sqlwhere[] = $value; $sqlwhere[] = $value;
} elseif (strpos($value, '%') === false) { } elseif (strpos($value, '%') === false) {
@ -730,6 +733,8 @@ class ConferenceOrBoothAttendee extends CommonObject
} }
$label .= '<br>'; $label .= '<br>';
$label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref; $label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref;
$label .= '<br><b>'.$langs->trans('DateOfRegistration').':</b> '.dol_print_date($this->date_subscription, 'dayhour');
$label .= '<br><b>'.$langs->trans('AmountPaid').':</b> '.$this->amount;
$url = dol_buildpath('/eventorganization/conferenceorboothattendee_card.php', 1).'?id='.$this->id; $url = dol_buildpath('/eventorganization/conferenceorboothattendee_card.php', 1).'?id='.$this->id;
@ -744,15 +749,15 @@ class ConferenceOrBoothAttendee extends CommonObject
} }
if ($option == 'conforboothid') { if ($option == 'conforboothid') {
$url .= '&conforboothid='.$this->fk_actioncomm; $url .= '&conforboothid='.((int) $this->fk_actioncomm);
} }
if ($option == 'projectid') { if ($option == 'projectid') {
$url .= '&fk_project='.$this->fk_project.'&withproject=1'; $url .= '&fk_project='.((int) $this->fk_project).'&withproject=1';
} }
if ($option == 'conforboothidproject') { if ($option == 'conforboothidproject') {
$url .= '&conforboothid='.$this->fk_actioncomm.'&withproject=1' ; $url .= '&conforboothid='.((int) $this->fk_actioncomm).'&withproject=1' ;
} }
} }
@ -853,14 +858,15 @@ class ConferenceOrBoothAttendee extends CommonObject
public function LibStatut($status, $mode = 0) public function LibStatut($status, $mode = 0)
{ {
// phpcs:enable // phpcs:enable
global $langs;
if (empty($this->labelStatus) || empty($this->labelStatusShort)) { if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
global $langs;
//$langs->load("eventorganization@eventorganization"); //$langs->load("eventorganization@eventorganization");
$this->labelStatus[self::STATUS_DRAFT] = $langs->trans('Draft'); $this->labelStatus[self::STATUS_DRAFT] = $langs->trans('Draft');
$this->labelStatus[self::STATUS_VALIDATED] = $langs->trans('Enabled'); $this->labelStatus[self::STATUS_VALIDATED] = $langs->trans('Validated');
$this->labelStatus[self::STATUS_CANCELED] = $langs->trans('Disabled'); $this->labelStatus[self::STATUS_CANCELED] = $langs->trans('Disabled');
$this->labelStatusShort[self::STATUS_DRAFT] = $langs->trans('Draft'); $this->labelStatusShort[self::STATUS_DRAFT] = $langs->trans('Draft');
$this->labelStatusShort[self::STATUS_VALIDATED] = $langs->trans('Enabled'); $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->trans('Validated');
$this->labelStatusShort[self::STATUS_CANCELED] = $langs->trans('Disabled'); $this->labelStatusShort[self::STATUS_CANCELED] = $langs->trans('Disabled');
} }
@ -870,6 +876,11 @@ class ConferenceOrBoothAttendee extends CommonObject
$statusType = 'status6'; $statusType = 'status6';
} }
if ($status == self::STATUS_VALIDATED && $this->date_subscription && $this->amount) {
$statusType = 'status4';
$this->labelStatus[self::STATUS_VALIDATED] = $langs->trans('Validated').' - '.$langs->trans("Paid");
}
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
} }
@ -940,7 +951,7 @@ class ConferenceOrBoothAttendee extends CommonObject
$this->lines = array(); $this->lines = array();
$objectline = new ConferenceOrBoothAttendeeLine($this->db); $objectline = new ConferenceOrBoothAttendeeLine($this->db);
$result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql'=>'fk_conferenceorboothattendee = '.$this->id)); $result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql'=>'fk_conferenceorboothattendee = '.((int) $this->id)));
if (is_numeric($result)) { if (is_numeric($result)) {
$this->error = $this->error; $this->error = $this->error;

View File

@ -182,7 +182,7 @@ $object->project = clone $projectstatic;
if (!empty($withproject)) { if (!empty($withproject)) {
// Tabs for project // Tabs for project
$tab = 'eventorganisation'; $tab = 'eventorganisation';
$withProjectUrl="&withproject=1"; $withProjectUrl = "&withproject=1";
$head = project_prepare_head($projectstatic); $head = project_prepare_head($projectstatic);
print dol_get_fiche_head($head, $tab, $langs->trans("Project"), -1, ($projectstatic->public ? 'projectpub' : 'project'), 0, '', ''); print dol_get_fiche_head($head, $tab, $langs->trans("Project"), -1, ($projectstatic->public ? 'projectpub' : 'project'), 0, '', '');

View File

@ -101,7 +101,7 @@ if ($action == 'addcontact' && $permission) { // Add a new contact
$result = $object->add_contact($contactid, $typeid, GETPOST("source", 'aZ09')); $result = $object->add_contact($contactid, $typeid, GETPOST("source", 'aZ09'));
if ($result >= 0) { if ($result >= 0) {
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id.(!empty($withproject)?'&withproject=1':'')); header("Location: ".$_SERVER['PHP_SELF']."?id=".((int) $object->id).(!empty($withproject)?'&withproject=1':''));
exit; exit;
} else { } else {
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
@ -119,7 +119,7 @@ if ($action == 'addcontact' && $permission) { // Add a new contact
$result = $object->delete_contact($lineid); $result = $object->delete_contact($lineid);
if ($result >= 0) { if ($result >= 0) {
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id.(!empty($withproject)?'&withproject=1':'')); header("Location: ".$_SERVER['PHP_SELF']."?id=".((int) $object->id).(!empty($withproject)?'&withproject=1':''));
exit; exit;
} else { } else {
dol_print_error($db); dol_print_error($db);
@ -161,7 +161,7 @@ $object->project = clone $projectstatic;
if (!empty($withproject)) { if (!empty($withproject)) {
// Tabs for project // Tabs for project
$tab = 'eventorganisation'; $tab = 'eventorganisation';
$withProjectUrl="&withproject=1"; $withProjectUrl = "&withproject=1";
$head = project_prepare_head($projectstatic); $head = project_prepare_head($projectstatic);
print dol_get_fiche_head($head, $tab, $langs->trans("Project"), -1, ($projectstatic->public ? 'projectpub' : 'project'), 0, '', ''); print dol_get_fiche_head($head, $tab, $langs->trans("Project"), -1, ($projectstatic->public ? 'projectpub' : 'project'), 0, '', '');

View File

@ -30,6 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php'; require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php';
require_once DOL_DOCUMENT_ROOT.'/eventorganization/lib/eventorganization_conferenceorbooth.lib.php'; require_once DOL_DOCUMENT_ROOT.'/eventorganization/lib/eventorganization_conferenceorbooth.lib.php';
require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorboothattendee.class.php';
if ($conf->categorie->enabled) { if ($conf->categorie->enabled) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
} }
@ -146,10 +147,12 @@ if ($user->socid > 0) { // Protection if external user
$result = restrictedArea($user, 'eventorganization'); $result = restrictedArea($user, 'eventorganization');
if (!$permissiontoread) accessforbidden(); if (!$permissiontoread) accessforbidden();
/* /*
* Actions * Actions
*/ */
if (preg_match('/^set/', $action) && $projectid > 0) {
if (preg_match('/^set/', $action) && $projectid > 0 && !empty($user->rights->eventorganization->write)) {
$project = new Project($db); $project = new Project($db);
//If "set" fields keys is in projects fields //If "set" fields keys is in projects fields
$project_attr=preg_replace('/^set/', '', $action); $project_attr=preg_replace('/^set/', '', $action);
@ -293,7 +296,7 @@ if ($projectid > 0) {
print '<div class="fichehalfleft">'; print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield" width="100%">'; print '<table class="border tableforfield centpercent">';
// Usage // Usage
print '<tr><td class="tdtop">'; print '<tr><td class="tdtop">';
@ -355,7 +358,7 @@ if ($projectid > 0) {
// Other attributes // Other attributes
$cols = 2; $cols = 2;
$objectconf=$object; $objectconf = $object;
$object = $project; $object = $project;
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
$object = $objectconf; $object = $objectconf;
@ -367,7 +370,7 @@ if ($projectid > 0) {
print '<div class="ficheaddleft">'; print '<div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield" width="100%">'; print '<table class="border tableforfield centpercent">';
// Description // Description
print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>'; print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>';
@ -398,15 +401,15 @@ if ($projectid > 0) {
print "</td></tr>"; print "</td></tr>";
print '<tr><td>'; print '<tr><td>';
print $form->editfieldkey('PriceOfRegistration', 'price_registration', '', $project, $permissiontoadd, 'amount', '', 0, 0, 'projectid'); print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', '', $project, $permissiontoadd, 'amount', '', 0, 0, 'projectid');
print '</td><td>'; print '</td><td>';
print $form->editfieldval('PriceOfRegistration', 'price_registration', $project->price_registration, $project, $permissiontoadd, 'amount', '', 0, 0, '', 0, '', 'projectid'); print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', $project->price_booth, $project, $permissiontoadd, 'amount', '', 0, 0, '', 0, '', 'projectid');
print "</td></tr>"; print "</td></tr>";
print '<tr><td>'; print '<tr><td>';
print $form->editfieldkey('PriceOfBooth', 'price_booth', '', $project, $permissiontoadd, 'amount', '', 0, 0, 'projectid'); print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', '', $project, $permissiontoadd, 'amount', '', 0, 0, 'projectid');
print '</td><td>'; print '</td><td>';
print $form->editfieldval('PriceOfBooth', 'price_booth', $project->price_booth, $project, $permissiontoadd, 'amount', '', 0, 0, '', 0, '', 'projectid'); print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', $project->price_registration, $project, $permissiontoadd, 'amount', '', 0, 0, '', 0, '', 'projectid');
print "</td></tr>"; print "</td></tr>";
print '<tr><td valign="middle">'.$langs->trans("EventOrganizationICSLink").'</td><td>'; print '<tr><td valign="middle">'.$langs->trans("EventOrganizationICSLink").'</td><td>';
@ -415,7 +418,7 @@ if ($projectid > 0) {
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
// Show message // Show message
$message = '<a target="blank" href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical'.($conf->entity > 1 ? "&entity=".$conf->entity : ""); $message = '<a target="_blank" href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical'.($conf->entity > 1 ? "&entity=".$conf->entity : "");
$message .= '&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...'); $message .= '&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...');
$message .= "&project=".$projectid.'&module='.urlencode('@eventorganization').'&status='.ConferenceOrBooth::STATUS_CONFIRMED.'">'.$langs->trans('DownloadICSLink').img_picto('', 'download', 'class="paddingleft"').'</a>'; $message .= "&project=".$projectid.'&module='.urlencode('@eventorganization').'&status='.ConferenceOrBooth::STATUS_CONFIRMED.'">'.$langs->trans('DownloadICSLink').img_picto('', 'download', 'class="paddingleft"').'</a>';
print $message; print $message;
@ -428,7 +431,7 @@ if ($projectid > 0) {
//print '</span>'; //print '</span>';
print '</td><td>'; print '</td><td>';
$linksuggest = $dolibarr_main_url_root.'/public/project/index.php?id='.$project->id; $linksuggest = $dolibarr_main_url_root.'/public/project/index.php?id='.$project->id;
$encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$project->id, 2); $encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$project->id, 'md5');
$linksuggest .= '&securekey='.urlencode($encodedsecurekey); $linksuggest .= '&securekey='.urlencode($encodedsecurekey);
//print '<div class="urllink">'; //print '<div class="urllink">';
//print '<input type="text" value="'.$linksuggest.'" id="linkregister" class="quatrevingtpercent paddingrightonly">'; //print '<input type="text" value="'.$linksuggest.'" id="linkregister" class="quatrevingtpercent paddingrightonly">';
@ -444,8 +447,8 @@ if ($projectid > 0) {
print $langs->trans("PublicAttendeeSubscriptionGlobalPage"); print $langs->trans("PublicAttendeeSubscriptionGlobalPage");
//print '</span>'; //print '</span>';
print '</td><td>'; print '</td><td>';
$link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_subscription.php?id='.$project->id.'&type=global'; $link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_register.php?id='.$project->id.'&type=global';
$encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$project->id, 2); $encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$project->id, 'md5');
$link_subscription .= '&securekey='.urlencode($encodedsecurekey); $link_subscription .= '&securekey='.urlencode($encodedsecurekey);
//print '<div class="urllink">'; //print '<div class="urllink">';
//print '<input type="text" value="'.$linkregister.'" id="linkregister" class="quatrevingtpercent paddingrightonly">'; //print '<input type="text" value="'.$linkregister.'" id="linkregister" class="quatrevingtpercent paddingrightonly">';
@ -638,6 +641,8 @@ print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">'; print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
$title = $langs->trans("ListOfConferencesOrBooths");
$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/eventorganization/conferenceorbooth_card.php?action=create'.(!empty($project->id)?'&withproject=1&fk_project='.$project->id:'').(!empty($project->socid)?'&fk_soc='.$project->socid:'').'&backtopage='.urlencode($_SERVER['PHP_SELF']).(!empty($project->id)?'?projectid='.$project->id:''), '', $permissiontoadd); $newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/eventorganization/conferenceorbooth_card.php?action=create'.(!empty($project->id)?'&withproject=1&fk_project='.$project->id:'').(!empty($project->socid)?'&fk_soc='.$project->socid:'').'&backtopage='.urlencode($_SERVER['PHP_SELF']).(!empty($project->id)?'?projectid='.$project->id:''), '', $permissiontoadd);
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);

View File

@ -111,22 +111,33 @@ if (empty($reshook)) {
$error = 0; $error = 0;
if (!empty($withproject)) { if (!empty($withproject)) {
$backurlforlist = dol_buildpath('/eventorganization/conferenceorboothattendee_list.php?withproject=1', 1); $backurlforlist = DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_list.php?withproject=1';
} else { } else {
$backurlforlist = dol_buildpath('/eventorganization/conferenceorboothattendee_list.php', 1); $backurlforlist = DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_list.php';
} }
if (empty($backtopage) || ($cancel && empty($id))) { if (empty($backtopage) || ($cancel && empty($id))) {
if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) { if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) { if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
$backtopage = $backurlforlist; $backtopage = $backurlforlist;
} else { } else {
$backtopage = dol_buildpath('/eventorganization/conferenceorboothattendee_card.php', 1).'?id='.($id > 0 ? $id : '__ID__'); $backtopage = DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_card.php?id='.($id > 0 ? $id : '__ID__');
} }
} }
} }
if ($cancel) {
if (!empty($backtopageforcancel)) {
header("Location: ".$backtopageforcancel);
exit;
} elseif (!empty($backtopage)) {
header("Location: ".$backtopage);
exit;
}
$action = '';
}
$triggermodname = 'EVENTORGANIZATION_CONFERENCEORBOOTHATTENDEE_MODIFY'; // Name of trigger action code to execute when we modify record $triggermodname = 'EVENTORGANIZATION_CONFERENCEORBOOTHATTENDEE_MODIFY'; // Name of trigger action code to execute when we modify record
// Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen // Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen
@ -189,7 +200,7 @@ $object->project = clone $projectstatic;
if (!empty($withproject)) { if (!empty($withproject)) {
// Tabs for project // Tabs for project
$tab = 'eventorganisation'; $tab = 'eventorganisation';
$withProjectUrl="&withproject=1"; $withProjectUrl = "&withproject=1";
$head = project_prepare_head($projectstatic); $head = project_prepare_head($projectstatic);
print dol_get_fiche_head($head, $tab, $langs->trans("Project"), -1, ($projectstatic->public ? 'projectpub' : 'project'), 0, '', ''); print dol_get_fiche_head($head, $tab, $langs->trans("Project"), -1, ($projectstatic->public ? 'projectpub' : 'project'), 0, '', '');
@ -371,7 +382,7 @@ if (!empty($withproject)) {
print $langs->trans("PublicAttendeeSubscriptionGlobalPage"); print $langs->trans("PublicAttendeeSubscriptionGlobalPage");
//print '</span>'; //print '</span>';
print '</td><td>'; print '</td><td>';
$link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_subscription.php?id='.$projectstatic->id.'&type=global'; $link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_register.php?id='.$projectstatic->id.'&type=global';
$encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$projectstatic->id, 2); $encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$projectstatic->id, 2);
$link_subscription .= '&securekey='.urlencode($encodedsecurekey); $link_subscription .= '&securekey='.urlencode($encodedsecurekey);
//print '<div class="urllink">'; //print '<div class="urllink">';
@ -407,6 +418,7 @@ if ($action == 'create') {
} }
if ($projectstatic->id > 0) { if ($projectstatic->id > 0) {
print '<input type="hidden" name="fk_project" value="'.$projectstatic->id.'">'; print '<input type="hidden" name="fk_project" value="'.$projectstatic->id.'">';
print '<input type="hidden" name="projectid" value="'.$projectstatic->id.'">';
} }
@ -484,7 +496,15 @@ if (($id || $ref) && $action == 'edit') {
// Part to show record // Part to show record
if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) { if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) {
$res = $object->fetch_optionals(); $object->fetch_optionals();
$moreparam = '';
if ($withproject) {
$moreparam .= '&withproject=1';
}
if ($fk_project) {
$moreparam .= '&fk_project='.((int) $fk_project);
}
$head = conferenceorboothattendeePrepareHead($object); $head = conferenceorboothattendeePrepareHead($object);
print dol_get_fiche_head($head, 'card', $langs->trans("ConferenceOrBoothAttendee"), -1, $object->picto); print dol_get_fiche_head($head, 'card', $langs->trans("ConferenceOrBoothAttendee"), -1, $object->picto);
@ -526,13 +546,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Object card // Object card
// ------------------------------------------------------------ // ------------------------------------------------------------
$linkback = '<a href="'.dol_buildpath('/eventorganization/conferenceorboothattendee_list.php', 1).'?restore_lastsearch_values=1&conforboothid='.$confOrBooth->id .$withProjectUrl.'">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.dol_buildpath('/eventorganization/conferenceorboothattendee_list.php', 1).'?restore_lastsearch_values=1'.($confOrBooth->id > 0 ? '&conforboothid='.((int) $confOrBooth->id) : '').$moreparam.'">'.$langs->trans("BackToList").'</a>';
$morehtmlref = '<div class="refidno">'; $morehtmlref = '<div class="refidno">';
$morehtmlref .= '</div>'; $morehtmlref .= '</div>';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $moreparam);
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="fichehalfleft">'; print '<div class="fichehalfleft">';

View File

@ -27,16 +27,16 @@ require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php'; require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php';
require_once DOL_DOCUMENT_ROOT.'/eventorganization/lib/eventorganization_conferenceorbooth.lib.php'; require_once DOL_DOCUMENT_ROOT.'/eventorganization/lib/eventorganization_conferenceorbooth.lib.php';
require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorboothattendee.class.php';
if ($conf->categorie->enabled) { if ($conf->categorie->enabled) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
} }
// load eventorganization libraries global $dolibarr_main_url_root;
require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorboothattendee.class.php';
// for other modules // for other modules
//dol_include_once('/othermodule/class/otherobject.class.php'); //dol_include_once('/othermodule/class/otherobject.class.php');
@ -58,8 +58,7 @@ $id = GETPOST('id', 'int');
$conf_or_booth_id = GETPOST('conforboothid', 'int'); $conf_or_booth_id = GETPOST('conforboothid', 'int');
$withproject = GETPOST('withproject', 'int'); $withproject = GETPOST('withproject', 'int');
$project_ref = GETPOST('project_ref', 'alpha'); $fk_project = GETPOST('fk_project', 'int') ? GETPOST('fk_project', 'int') : GETPOST('projectid', 'int');
$fk_project = GETPOST('fk_project', 'int');
$withProjectUrl=''; $withProjectUrl='';
@ -160,6 +159,24 @@ if (!$permissiontoread) accessforbidden();
* Actions * Actions
*/ */
if (preg_match('/^set/', $action) && $projectid > 0 && !empty($user->rights->eventorganization->write)) {
$project = new Project($db);
//If "set" fields keys is in projects fields
$project_attr=preg_replace('/^set/', '', $action);
if (array_key_exists($project_attr, $project->fields)) {
$result = $project->fetch($projectid);
if ($result < 0) {
setEventMessages(null, $project->errors, 'errors');
} else {
$project->{$project_attr}=GETPOST($project_attr);
$result=$project->update($user);
if ($result < 0) {
setEventMessages(null, $project->errors, 'errors');
}
}
}
}
if (GETPOST('cancel', 'alpha')) { if (GETPOST('cancel', 'alpha')) {
$action = 'list'; $action = 'list';
$massaction = ''; $massaction = '';
@ -209,8 +226,18 @@ if (empty($reshook)) {
*/ */
$form = new Form($db); $form = new Form($db);
$now = dol_now(); $now = dol_now();
//$help_url="EN:Module_ConferenceOrBoothAttendee|FR:Module_ConferenceOrBoothAttendee_FR|ES:Módulo_ConferenceOrBoothAttendee";
$help_url = '';
if ($confOrBooth->id > 0) {
$title = $langs->trans('ListOfAttendeesPerConference');
} else {
$title = $langs->trans('ListOfAttendeesOfEvent');
}
$morejs = array();
$morecss = array();
$confOrBooth = new ConferenceOrBooth($db); $confOrBooth = new ConferenceOrBooth($db);
if ($conf_or_booth_id > 0) { if ($conf_or_booth_id > 0) {
$result = $confOrBooth->fetch($conf_or_booth_id); $result = $confOrBooth->fetch($conf_or_booth_id);
@ -345,11 +372,6 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $
// Output page // Output page
// -------------------------------------------------------------------- // --------------------------------------------------------------------
//$help_url="EN:Module_ConferenceOrBoothAttendee|FR:Module_ConferenceOrBoothAttendee_FR|ES:Módulo_ConferenceOrBoothAttendee";
$help_url = '';
$title = $langs->trans('ListOf', $langs->transnoentitiesnoconv("ConferenceOrBoothAttendee"));
$morejs = array();
$morecss = array();
llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'classforhorizontalscrolloftabs'); llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'classforhorizontalscrolloftabs');
@ -368,8 +390,9 @@ if ($projectstatic->id > 0 || $confOrBooth > 0) {
if (!empty($withproject)) { if (!empty($withproject)) {
// Tabs for project // Tabs for project
$tab = 'eventorganisation'; $tab = 'eventorganisation';
$withProjectUrl="&withproject=1"; $withProjectUrl = "&withproject=1";
$head = project_prepare_head($projectstatic); $head = project_prepare_head($projectstatic);
print dol_get_fiche_head($head, $tab, $langs->trans("Project"), -1, ($projectstatic->public ? 'projectpub' : 'project'), 0, '', ''); print dol_get_fiche_head($head, $tab, $langs->trans("Project"), -1, ($projectstatic->public ? 'projectpub' : 'project'), 0, '', '');
$param = ($mode == 'mine' ? '&mode=mine' : ''); $param = ($mode == 'mine' ? '&mode=mine' : '');
@ -463,7 +486,10 @@ if ($projectstatic->id > 0 || $confOrBooth > 0) {
// Other attributes // Other attributes
$cols = 2; $cols = 2;
//include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; $objectconf = $object;
$object = $projectstatic;
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
$object = $objectconf;
print '</table>'; print '</table>';
@ -473,7 +499,7 @@ if ($projectstatic->id > 0 || $confOrBooth > 0) {
print '<div class="ficheaddleft">'; print '<div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield" width="100%">'; print '<table class="border tableforfield centpercent">';
// Description // Description
print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>'; print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>';
@ -487,7 +513,7 @@ if ($projectstatic->id > 0 || $confOrBooth > 0) {
print "</td></tr>"; print "</td></tr>";
} }
print '<tr><td>'; print '<tr><td class="nowrap">';
$typeofdata = 'checkbox:'.($projectstatic->accept_conference_suggestions ? ' checked="checked"' : ''); $typeofdata = 'checkbox:'.($projectstatic->accept_conference_suggestions ? ' checked="checked"' : '');
$htmltext = $langs->trans("AllowUnknownPeopleSuggestConfHelp"); $htmltext = $langs->trans("AllowUnknownPeopleSuggestConfHelp");
print $form->editfieldkey('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '', $projectstatic, 0, $typeofdata, '', 0, 0, 'projectid', $htmltext); print $form->editfieldkey('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '', $projectstatic, 0, $typeofdata, '', 0, 0, 'projectid', $htmltext);
@ -504,15 +530,15 @@ if ($projectstatic->id > 0 || $confOrBooth > 0) {
print "</td></tr>"; print "</td></tr>";
print '<tr><td>'; print '<tr><td>';
print $form->editfieldkey('PriceOfRegistration', 'price_registration', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid'); print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid');
print '</td><td>'; print '</td><td>';
print $form->editfieldval('PriceOfRegistration', 'price_registration', $projectstatic->price_registration, $projectstatic, 0, 'amount', '', 0, 0, '', 0, '', 'projectid'); print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', $projectstatic->price_booth, $projectstatic, 0, 'amount', '', 0, 0, '', 0, '', 'projectid');
print "</td></tr>"; print "</td></tr>";
print '<tr><td>'; print '<tr><td>';
print $form->editfieldkey('PriceOfBooth', 'price_booth', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid'); print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid');
print '</td><td>'; print '</td><td>';
print $form->editfieldval('PriceOfBooth', 'price_booth', $projectstatic->price_booth, $projectstatic, 0, 'amount', '', 0, 0, '', 0, '', 'projectid'); print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', $projectstatic->price_registration, $projectstatic, 0, 'amount', '', 0, 0, '', 0, '', 'projectid');
print "</td></tr>"; print "</td></tr>";
print '<tr><td valign="middle">'.$langs->trans("EventOrganizationICSLink").'</td><td>'; print '<tr><td valign="middle">'.$langs->trans("EventOrganizationICSLink").'</td><td>';
@ -521,7 +547,7 @@ if ($projectstatic->id > 0 || $confOrBooth > 0) {
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
// Show message // Show message
$message = '<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical'.($conf->entity > 1 ? "&entity=".$conf->entity : ""); $message = '<a target="_blank" href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical'.($conf->entity > 1 ? "&entity=".$conf->entity : "");
$message .= '&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...'); $message .= '&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...');
$message .= "&project=".$projectstatic->id.'&module='.urlencode('@eventorganization').'&status='.ConferenceOrBooth::STATUS_CONFIRMED.'">'.$langs->trans('DownloadICSLink').img_picto('', 'download', 'class="paddingleft"').'</a>'; $message .= "&project=".$projectstatic->id.'&module='.urlencode('@eventorganization').'&status='.ConferenceOrBooth::STATUS_CONFIRMED.'">'.$langs->trans('DownloadICSLink').img_picto('', 'download', 'class="paddingleft"').'</a>';
print $message; print $message;
@ -534,7 +560,7 @@ if ($projectstatic->id > 0 || $confOrBooth > 0) {
//print '</span>'; //print '</span>';
print '</td><td>'; print '</td><td>';
$linksuggest = $dolibarr_main_url_root.'/public/project/index.php?id='.$projectstatic->id; $linksuggest = $dolibarr_main_url_root.'/public/project/index.php?id='.$projectstatic->id;
$encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$projectstatic->id, 2); $encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$projectstatic->id, 'md5');
$linksuggest .= '&securekey='.urlencode($encodedsecurekey); $linksuggest .= '&securekey='.urlencode($encodedsecurekey);
//print '<div class="urllink">'; //print '<div class="urllink">';
//print '<input type="text" value="'.$linksuggest.'" id="linkregister" class="quatrevingtpercent paddingrightonly">'; //print '<input type="text" value="'.$linksuggest.'" id="linkregister" class="quatrevingtpercent paddingrightonly">';
@ -550,8 +576,8 @@ if ($projectstatic->id > 0 || $confOrBooth > 0) {
print $langs->trans("PublicAttendeeSubscriptionGlobalPage"); print $langs->trans("PublicAttendeeSubscriptionGlobalPage");
//print '</span>'; //print '</span>';
print '</td><td>'; print '</td><td>';
$link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_subscription.php?id='.$projectstatic->id.'&type=global'; $link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_register.php?id='.$projectstatic->id.'&type=global';
$encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$projectstatic->id, 2); $encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$projectstatic->id, 'md5');
$link_subscription .= '&securekey='.urlencode($encodedsecurekey); $link_subscription .= '&securekey='.urlencode($encodedsecurekey);
//print '<div class="urllink">'; //print '<div class="urllink">';
//print '<input type="text" value="'.$linkregister.'" id="linkregister" class="quatrevingtpercent paddingrightonly">'; //print '<input type="text" value="'.$linkregister.'" id="linkregister" class="quatrevingtpercent paddingrightonly">';
@ -580,12 +606,9 @@ if ($projectstatic->id > 0 || $confOrBooth > 0) {
if ($confOrBooth->id > 0) { if ($confOrBooth->id > 0) {
$head = conferenceorboothPrepareHead($confOrBooth, $withproject); $head = conferenceorboothPrepareHead($confOrBooth, $withproject);
print dol_get_fiche_head($head, 'attendees', $langs->trans("ConferenceOrBooth"), -1, $object->picto); print dol_get_fiche_head($head, 'attendees', $langs->trans("ConferenceOrBooth"), -1, $object->picto);
//$help_url = "EN:Module_Projects|FR:Module_Projets|ES:M&oacute;dulo_Proyectos";
$title = $langs->trans("ConferenceOrBooth") . ' - ' . $langs->trans("Attendees") . ' - ' . $confOrBooth->id;
$object_evt = $object; $object_evt = $object;
$object = $confOrBooth; $object = $confOrBooth;
@ -672,9 +695,9 @@ print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">'; print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_card.php?action=create'.(!empty($confOrBooth->id)?'&conforboothid='.$confOrBooth->id:'').(!empty($projectstatic->id)?'&fk_project='.$projectstatic->id:'').$withProjectUrl.'&backtopage='.urlencode($_SERVER['PHP_SELF'].(!empty($confOrBooth->id)?'?conforboothid='.$confOrBooth->id:'').$withProjectUrl), '', $permissiontoadd); $newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_card.php?action=create'.(!empty($confOrBooth->id)?'&conforboothid='.$confOrBooth->id:'').(!empty($projectstatic->id)?'&fk_project='.$projectstatic->id:'').$withProjectUrl.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?projectid='.$projectstatic->id.(empty($confOrBooth->id) ? '' : '&conforboothid='.$confOrBooth->id).$withProjectUrl), '', $permissiontoadd);
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
// Add code for pre mass action (confirmation or email presend form) // Add code for pre mass action (confirmation or email presend form)
$topicmail = "SendConferenceOrBoothAttendeeRef"; $topicmail = "SendConferenceOrBoothAttendeeRef";
@ -728,7 +751,7 @@ foreach ($object->fields as $key => $val) {
$cssforfield .= ($cssforfield ? ' ' : '').'center'; $cssforfield .= ($cssforfield ? ' ' : '').'center';
} elseif (in_array($val['type'], array('timestamp'))) { } elseif (in_array($val['type'], array('timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') { } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'ref')) && $val['label'] != 'TechnicalID') {
$cssforfield .= ($cssforfield ? ' ' : '').'right'; $cssforfield .= ($cssforfield ? ' ' : '').'right';
} }
if (!empty($arrayfields['t.'.$key]['checked'])) { if (!empty($arrayfields['t.'.$key]['checked'])) {
@ -776,7 +799,7 @@ foreach ($object->fields as $key => $val) {
$cssforfield .= ($cssforfield ? ' ' : '').'center'; $cssforfield .= ($cssforfield ? ' ' : '').'center';
} elseif (in_array($val['type'], array('timestamp'))) { } elseif (in_array($val['type'], array('timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') { } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'ref')) && $val['label'] != 'TechnicalID') {
$cssforfield .= ($cssforfield ? ' ' : '').'right'; $cssforfield .= ($cssforfield ? ' ' : '').'right';
} }
if (!empty($arrayfields['t.'.$key]['checked'])) { if (!empty($arrayfields['t.'.$key]['checked'])) {
@ -829,12 +852,12 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
} }
if (in_array($val['type'], array('timestamp'))) { if (in_array($val['type'], array('timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; $cssforfield .= ($cssforfield ? ' ' : '').'nowrap left';
} elseif ($key == 'ref') { } elseif ($key == 'ref') {
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
} }
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status'))) { if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'ref', 'status'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'right'; $cssforfield .= ($cssforfield ? ' ' : '').'right';
} }
//if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';

View File

@ -39,20 +39,20 @@ function conferenceorboothPrepareHead($object, $with_project = 0)
$withProjectUrl=''; $withProjectUrl='';
if ($with_project>0) { if ($with_project>0) {
$withProjectUrl="&withproject=1"; $withProjectUrl = "&withproject=1";
} }
$head[$h][0] = dol_buildpath("/eventorganization/conferenceorbooth_card.php", 1).'?id='.$object->id.$withProjectUrl; $head[$h][0] = DOL_URL_ROOT.'/eventorganization/conferenceorbooth_card.ph?id='.$object->id.$withProjectUrl;
$head[$h][1] = $langs->trans("Card"); $head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'card'; $head[$h][2] = 'card';
$h++; $h++;
$head[$h][0] = dol_buildpath("/eventorganization/conferenceorbooth_contact.php", 1).'?id='.$object->id.$withProjectUrl; $head[$h][0] = DOL_URL_ROOT.'/eventorganization/conferenceorbooth_contact.php?id='.$object->id.$withProjectUrl;
$head[$h][1] = $langs->trans("ContactsAddresses"); $head[$h][1] = $langs->trans("ContactsAddresses");
$head[$h][2] = 'contact'; $head[$h][2] = 'contact';
$h++; $h++;
$head[$h][0] = dol_buildpath("/eventorganization/conferenceorboothattendee_list.php", 1).'?conforboothid='.$object->id.$withProjectUrl; $head[$h][0] = DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_list.php?conforboothid='.$object->id.$withProjectUrl;
$head[$h][1] = $langs->trans("Attendees"); $head[$h][1] = $langs->trans("Attendees");
$head[$h][2] = 'attendees'; $head[$h][2] = 'attendees';
// Enable caching of conf or booth count attendees // Enable caching of conf or booth count attendees
@ -196,7 +196,7 @@ function conferenceorboothattendeePrepareHead($object)
$h = 0; $h = 0;
$head = array(); $head = array();
$head[$h][0] = dol_buildpath("/eventorganization/conferenceorboothattendee_card.php", 1).'?id='.$object->id.'&conforboothid='.$object->fk_actioncomm; $head[$h][0] = DOL_URL_ROOT."/eventorganization/conferenceorboothattendee_card.php?id=".((int) $object->id).($object->fk_actioncomm > 0 ? '&conforboothid='.((int) $object->fk_actioncomm) : '').($object->fk_project > 0 ? '&withproject=1&fk_project='.((int) $object->fk_project) : '');
$head[$h][1] = $langs->trans("Card"); $head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'card'; $head[$h][2] = 'card';
$h++; $h++;

View File

@ -1458,8 +1458,8 @@ class Expedition extends CommonObject
} }
} }
// delete batch expedition line // delete batch expedition line (we try deletion even if module not enabled in case of the module were enabled and disabled previously)
if (!$error && $conf->productbatch->enabled) { if (!$error) {
if (ExpeditionLineBatch::deletefromexp($this->db, $this->id) < 0) { if (ExpeditionLineBatch::deletefromexp($this->db, $this->id) < 0) {
$error++; $this->errors[] = "Error ".$this->db->lasterror(); $error++; $this->errors[] = "Error ".$this->db->lasterror();
} }

View File

@ -239,7 +239,7 @@ $sql .= " typent.code as typent_code,";
$sql .= " state.code_departement as state_code, state.nom as state_name,"; $sql .= " state.code_departement as state_code, state.nom as state_name,";
$sql .= " e.date_creation as date_creation, e.tms as date_update,"; $sql .= " e.date_creation as date_creation, e.tms as date_update,";
$sql .= " u.login"; $sql .= " u.login";
if ($search_categ_cus) { if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
$sql .= ", cc.fk_categorie, cc.fk_soc"; $sql .= ", cc.fk_categorie, cc.fk_soc";
} }
// Add fields from extrafields // Add fields from extrafields
@ -264,7 +264,7 @@ if ($search_product_category > 0) {
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=pd.fk_product'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=pd.fk_product';
} }
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = e.fk_soc"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = e.fk_soc";
if (!empty($search_categ_cus)) { if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ
} }
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
@ -459,7 +459,7 @@ if ($search_datereceipt_end) {
if ($search_product_category != '') { if ($search_product_category != '') {
$param .= '&search_product_category='.urlencode($search_product_category); $param .= '&search_product_category='.urlencode($search_product_category);
} }
if ($search_categ_cus > 0) { if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
$param .= '&search_categ_cus='.urlencode($search_categ_cus); $param .= '&search_categ_cus='.urlencode($search_categ_cus);
} }
if ($search_status != '') { if ($search_status != '') {

View File

@ -995,14 +995,14 @@ class ExpenseReport extends CommonObject
$sql .= " , total_tva = ".((float) price2num($total_tva, 'MT')); $sql .= " , total_tva = ".((float) price2num($total_tva, 'MT'));
$sql .= " WHERE rowid = ".((int) $id); $sql .= " WHERE rowid = ".((int) $id);
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) : if ($result) {
$this->db->free($result); $this->db->free($result);
return 1; return 1;
else : } else {
$this->error = $this->db->lasterror(); $this->error = $this->db->lasterror();
dol_syslog(get_class($this)."::recalculer: Error ".$this->error, LOG_ERR); dol_syslog(get_class($this)."::recalculer: Error ".$this->error, LOG_ERR);
return -3; return -3;
endif; }
} else { } else {
$this->error = $this->db->lasterror(); $this->error = $this->db->lasterror();
dol_syslog(get_class($this)."::recalculer: Error ".$this->error, LOG_ERR); dol_syslog(get_class($this)."::recalculer: Error ".$this->error, LOG_ERR);
@ -1749,12 +1749,12 @@ class ExpenseReport extends CommonObject
$sql .= " WHERE rowid = ".((int) $this->id); $sql .= " WHERE rowid = ".((int) $this->id);
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) : if ($result) {
return 1; return 1;
else : } else {
$this->error = $this->db->error(); $this->error = $this->db->error();
return -1; return -1;
endif; }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
@ -1779,12 +1779,12 @@ class ExpenseReport extends CommonObject
$sql .= " WHERE rowid = ".((int) $this->id); $sql .= " WHERE rowid = ".((int) $this->id);
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) : if ($result) {
return 1; return 1;
else : } else {
$this->error = $this->db->error(); $this->error = $this->db->error();
return -1; return -1;
endif; }
} }
/** /**

View File

@ -224,7 +224,7 @@ class SupplierOrders extends DolibarrApi
*/ */
public function post($request_data = null) public function post($request_data = null)
{ {
if (!DolibarrApiAccess::$user->rights->fournisseur->commande->creer || !DolibarrApiAccess::$user->rights->supplier_order->creer) { if (empty(DolibarrApiAccess::$user->rights->fournisseur->commande->creer) && empty(DolibarrApiAccess::$user->rights->supplier_order->creer)) {
throw new RestException(401, "Insuffisant rights"); throw new RestException(401, "Insuffisant rights");
} }
// Check mandatory fields // Check mandatory fields
@ -260,7 +260,7 @@ class SupplierOrders extends DolibarrApi
*/ */
public function put($id, $request_data = null) public function put($id, $request_data = null)
{ {
if (!DolibarrApiAccess::$user->rights->fournisseur->commande->creer || !DolibarrApiAccess::$user->rights->supplier_order->creer) { if (empty(DolibarrApiAccess::$user->rights->fournisseur->commande->creer) && empty(DolibarrApiAccess::$user->rights->supplier_order->creer)) {
throw new RestException(401); throw new RestException(401);
} }
@ -340,7 +340,7 @@ class SupplierOrders extends DolibarrApi
*/ */
public function validate($id, $idwarehouse = 0, $notrigger = 0) public function validate($id, $idwarehouse = 0, $notrigger = 0)
{ {
if (!DolibarrApiAccess::$user->rights->fournisseur->commande->creer || !DolibarrApiAccess::$user->rights->supplier_order->creer) { if (empty(DolibarrApiAccess::$user->rights->fournisseur->commande->creer) && empty(DolibarrApiAccess::$user->rights->supplier_order->creer)) {
throw new RestException(401); throw new RestException(401);
} }
$result = $this->order->fetch($id); $result = $this->order->fetch($id);

View File

@ -156,7 +156,7 @@ if ($reshook < 0) {
} }
if (empty($reshook)) { if (empty($reshook)) {
$backurlforlist = DOL_URL_ROOT.'/fourn/commande/list.php'.($socid > 0 ? '&socid='.((int) $socid) : ''); $backurlforlist = DOL_URL_ROOT.'/fourn/commande/list.php'.($socid > 0 ? '?socid='.((int) $socid) : '');
if (empty($backtopage) || ($cancel && empty($id))) { if (empty($backtopage) || ($cancel && empty($id))) {
if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) { if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
@ -759,7 +759,7 @@ if (empty($reshook)) {
GETPOST('product_desc', 'restricthtml'), GETPOST('product_desc', 'restricthtml'),
$ht, $ht,
price2num(GETPOST('qty'), 'MS'), price2num(GETPOST('qty'), 'MS'),
price2num(GETPOST('remise_percent'), 2), price2num(GETPOST('remise_percent'), '', 2),
$vat_rate, $vat_rate,
$localtax1_rate, $localtax1_rate,
$localtax2_rate, $localtax2_rate,

View File

@ -134,10 +134,6 @@ if (!$sortorder) {
$sortorder = 'DESC'; $sortorder = 'DESC';
} }
if ($search_status == '') {
$search_status = -1;
}
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$object = new CommandeFournisseur($db); $object = new CommandeFournisseur($db);
$hookmanager->initHooks(array('supplierorderlist')); $hookmanager->initHooks(array('supplierorderlist'));
@ -245,7 +241,7 @@ if (empty($reshook)) {
$search_multicurrency_montant_tva = ''; $search_multicurrency_montant_tva = '';
$search_multicurrency_montant_ttc = ''; $search_multicurrency_montant_ttc = '';
$search_project_ref = ''; $search_project_ref = '';
$search_status = -1; $search_status = '';
$search_date_order_startday = ''; $search_date_order_startday = '';
$search_date_order_startmonth = ''; $search_date_order_startmonth = '';
$search_date_order_startyear = ''; $search_date_order_startyear = '';
@ -277,9 +273,42 @@ if (empty($reshook)) {
$objectlabel = 'SupplierOrders'; $objectlabel = 'SupplierOrders';
$permissiontoread = $user->rights->fournisseur->commande->lire; $permissiontoread = $user->rights->fournisseur->commande->lire;
$permissiontodelete = $user->rights->fournisseur->commande->supprimer; $permissiontodelete = $user->rights->fournisseur->commande->supprimer;
$permissiontovalidate = $user->rights->fournisseur->commande->creer;
$uploaddir = $conf->fournisseur->commande->dir_output; $uploaddir = $conf->fournisseur->commande->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
if ($action == 'validate' && $permissiontovalidate) {
if (GETPOST('confirm') == 'yes') {
$objecttmp = new CommandeFournisseur($db);
$db->begin();
$error = 0;
foreach ($toselect as $checked) {
if ($objecttmp->fetch($checked)) {
if ($objecttmp->statut == 0) {
$objecttmp->date_commande = dol_now();
$result = $objecttmp->valid($user);
if ($result >= 0) {
// If we have permission, and if we don't need to provide the idwarehouse, we go directly on approved step
if (empty($conf->global->SUPPLIER_ORDER_NO_DIRECT_APPROVE) && $user->rights->fournisseur->commande->approuver && !(!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) && $objecttmp->hasProductsOrServices(1))) {
$result = $objecttmp->approve($user);
setEventMessages($langs->trans("SupplierOrderValidatedAndApproved"), array($objecttmp->ref));
} else {
setEventMessages($langs->trans("SupplierOrderValidated"), array($objecttmp->ref));
}
} else {
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
$error++;
}
}
}
}
if (!$error) $db->commit();
else $db->rollback();
}
}
// Mass action to generate vendor bills // Mass action to generate vendor bills
if ($massaction == 'confirm_createsupplierbills') { if ($massaction == 'confirm_createsupplierbills') {
$orders = GETPOST('toselect', 'array'); $orders = GETPOST('toselect', 'array');
@ -947,6 +976,15 @@ if ($resql) {
'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), 'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), 'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
); );
if ($permissiontovalidate) {
if ($user->rights->fournisseur->commande->approuver && empty($conf->global->SUPPLIER_ORDER_NO_DIRECT_APPROVE)) {
$arrayofmassactions['prevalidate'] = img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("ValidateAndApprove");
} else {
$arrayofmassactions['prevalidate'] = img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate");
}
}
if ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer) { if ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer) {
$arrayofmassactions['createbills'] = img_picto('', 'bill', 'class="pictofixedwidth"').$langs->trans("CreateInvoiceForThisSupplier"); $arrayofmassactions['createbills'] = img_picto('', 'bill', 'class="pictofixedwidth"').$langs->trans("CreateInvoiceForThisSupplier");
} }
@ -986,6 +1024,10 @@ if ($resql) {
$trackid = 'sord'.$object->id; $trackid = 'sord'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
if ($massaction == 'prevalidate') {
print $form->formconfirm($_SERVER["PHP_SELF"].$fieldstosearchall, $langs->trans("ConfirmMassValidation"), $langs->trans("ConfirmMassValidationQuestion"), "validate", null, '', 0, 200, 500, 1);
}
if ($massaction == 'createbills') { if ($massaction == 'createbills') {
//var_dump($_REQUEST); //var_dump($_REQUEST);
print '<input type="hidden" name="massaction" value="confirm_createsupplierbills">'; print '<input type="hidden" name="massaction" value="confirm_createsupplierbills">';

View File

@ -1287,8 +1287,8 @@ if (empty($reshook)) {
$localtax1_tx = get_localtax($tva_tx, 1, $mysoc, $object->thirdparty); $localtax1_tx = get_localtax($tva_tx, 1, $mysoc, $object->thirdparty);
$localtax2_tx = get_localtax($tva_tx, 2, $mysoc, $object->thirdparty); $localtax2_tx = get_localtax($tva_tx, 2, $mysoc, $object->thirdparty);
$remise_percent = price2num(GETPOST('remise_percent'), 2); $remise_percent = price2num(GETPOST('remise_percent'), '', 2);
$pu_ht_devise = price2num(GETPOST('multicurrency_subprice'), 'MU'); $pu_ht_devise = price2num(GETPOST('multicurrency_subprice'), 'MU', 2);
// Extrafields Lines // Extrafields Lines
$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line); $extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);

View File

@ -467,22 +467,24 @@ if (empty($reshook)) {
$message .= $langs->transnoentities("HolidaysToValidateBody")."\n"; $message .= $langs->transnoentities("HolidaysToValidateBody")."\n";
$delayForRequest = $object->getConfCP('delayForRequest');
//$delayForRequest = $delayForRequest * (60*60*24);
$nextMonth = dol_time_plus_duree($now, $delayForRequest, 'd');
// option to warn the validator in case of too short delay // option to warn the validator in case of too short delay
if ($object->getConfCP('AlertValidatorDelay')) { if (empty($conf->global->HOLIDAY_HIDE_APPROVER_ABOUT_TOO_LOW_DELAY)) {
if ($object->date_debut < $nextMonth) { $delayForRequest = 0; // TODO Set delay depending of holiday leave type
$message .= "\n"; if ($delayForRequest) {
$message .= $langs->transnoentities("HolidaysToValidateDelay", $object->getConfCP('delayForRequest'))."\n"; $nowplusdelay = dol_time_plus_duree($now, $delayForRequest, 'd');
if ($object->date_debut < $nowplusdelay) {
$message .= "\n";
$message .= $langs->transnoentities("HolidaysToValidateDelay", $delayForRequest)."\n";
}
} }
} }
// option to notify the validator if the balance is less than the request // option to notify the validator if the balance is less than the request
if ($object->getConfCP('AlertValidatorSolde')) { if (empty($conf->global->HOLIDAY_HIDE_APPROVER_ABOUT_NEGATIVE_BALANCE)) {
$nbopenedday = num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday); $nbopenedday = num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday);
if ($nbopenedday > $object->getCPforUser($object->fk_user, $object->fk_type)) { if ($nbopenedday > $object->getCPforUser($object->fk_user, $object->fk_type)) {
$message .= "\n"; $message .= "\n";
$message .= $langs->transnoentities("HolidaysToValidateAlertSolde")."\n"; $message .= $langs->transnoentities("HolidaysToValidateAlertSolde")."\n";
@ -565,9 +567,10 @@ if (empty($reshook)) {
$nbopenedday = num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday); $nbopenedday = num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday);
$soldeActuel = $object->getCpforUser($object->fk_user, $object->fk_type); $soldeActuel = $object->getCpforUser($object->fk_user, $object->fk_type);
$newSolde = ($soldeActuel - $nbopenedday); $newSolde = ($soldeActuel - $nbopenedday);
$label = $langs->transnoentitiesnoconv("Holidays").' - '.$object->ref;
// The modification is added to the LOG // The modification is added to the LOG
$result = $object->addLogCP($user->id, $object->fk_user, $langs->transnoentitiesnoconv("Holidays"), $newSolde, $object->fk_type); $result = $object->addLogCP($user->id, $object->fk_user, $label, $newSolde, $object->fk_type);
if ($result < 0) { if ($result < 0) {
$error++; $error++;
setEventMessages(null, $object->errors, 'errors'); setEventMessages(null, $object->errors, 'errors');
@ -925,12 +928,6 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') {
} }
$delayForRequest = $object->getConfCP('delayForRequest');
//$delayForRequest = $delayForRequest * (60*60*24);
$nextMonth = dol_time_plus_duree($now, $delayForRequest, 'd');
print '<script type="text/javascript"> print '<script type="text/javascript">
$( document ).ready(function() { $( document ).ready(function() {
$("input.button-save").click("submit", function(e) { $("input.button-save").click("submit", function(e) {

View File

@ -1601,7 +1601,7 @@ class Holiday extends CommonObject
/** /**
* Retourne le solde de congés payés pour un utilisateur * Return balance of holiday for one user
* *
* @param int $user_id ID de l'utilisateur * @param int $user_id ID de l'utilisateur
* @param int $fk_type Filter on type * @param int $fk_type Filter on type
@ -1936,7 +1936,7 @@ class Holiday extends CommonObject
* *
* @param int $fk_user_action Id user creation * @param int $fk_user_action Id user creation
* @param int $fk_user_update Id user update * @param int $fk_user_update Id user update
* @param string $label Label * @param string $label Label (Example: 'Leave', 'Manual update', 'Leave request cancelation'...)
* @param int $new_solde New value * @param int $new_solde New value
* @param int $fk_type Type of vacation * @param int $fk_type Type of vacation
* @return int Id of record added, 0 if nothing done, < 0 if KO * @return int Id of record added, 0 if nothing done, < 0 if KO

View File

@ -631,6 +631,12 @@ if ($resql) {
print '</td>'; print '</td>';
} }
// End date
if (!empty($arrayfields['cp.date_valid']['checked'])) {
print '<td class="liste_titre center nowraponall">';
print '</td>';
}
// Extra fields // Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
// Fields from hook // Fields from hook
@ -691,6 +697,9 @@ if ($resql) {
if (!empty($arrayfields['cp.date_fin']['checked'])) { if (!empty($arrayfields['cp.date_fin']['checked'])) {
print_liste_field_titre($arrayfields['cp.date_fin']['label'], $_SERVER["PHP_SELF"], "cp.date_fin", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre($arrayfields['cp.date_fin']['label'], $_SERVER["PHP_SELF"], "cp.date_fin", "", $param, '', $sortfield, $sortorder, 'center ');
} }
if (!empty($arrayfields['cp.date_valid']['checked'])) {
print_liste_field_titre($arrayfields['cp.date_valid']['label'], $_SERVER["PHP_SELF"], "cp.date_valid", "", $param, '', $sortfield, $sortorder, 'center ');
}
// Extra fields // Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields // Hook fields
@ -820,6 +829,18 @@ if ($resql) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
} }
} }
if (!empty($arrayfields['cp.date_valid']['checked'])) { // date_valid is both date_valid but also date_approval
print '<td class="center">';
print dol_print_date($db->jdate($obj->date_valid), 'day');
print '</td>';
if (!$i) $totalarray['nbfield']++;
}
/*if (!empty($arrayfields['cp.date_approve']['checked'])) {
print '<td class="center">';
print dol_print_date($db->jdate($obj->date_approve), 'day');
print '</td>';
if (!$i) $totalarray['nbfield']++;
}*/
// Extra fields // Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';

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