Merge remote-tracking branch 'Dolibarr/develop' into develop

This commit is contained in:
Francis Appels 2020-09-29 09:27:22 +02:00
commit bac4c0acc0
69 changed files with 1673 additions and 383 deletions

View File

@ -13,5 +13,5 @@ jobs:
- name: Exakat
uses: docker://exakat/exakat-ga
with:
ignore_rules: 'Classes/DontUnsetProperties,Classes/NonPpp,Classes/StaticMethodsCalledFromObject,Classes/UseClassOperator,Functions/UsesDefaultArguments,Php/NoClassInGlobal,Php/ShouldUseCoalesce,Structures/MergeIfThen,Structures/ElseIfElseif,Structures/RepeatedPrint,Structures/UselessParenthesis'
ignore_rules: 'Performances/PrePostIncrement,Functions/WrongNumberOfArguments,Variables/UndefinedVariable,Classes/DontUnsetProperties,Classes/NonPpp,Classes/StaticMethodsCalledFromObject,Classes/UseClassOperator,Functions/UsesDefaultArguments,Php/NoClassInGlobal,Php/ShouldUseCoalesce,Structures/MergeIfThen,Structures/ElseIfElseif,Structures/RepeatedPrint,Structures/UselessParenthesis'
ignore_dirs: '/htdocs/includes,/htdocs/build,/htdocs/dev,/htdocs/doc,/htdocs/scripts,/htdocs/test'

View File

@ -61,8 +61,6 @@ $list_binding = array(
* Actions
*/
$accounting_mode = empty($conf->global->ACCOUNTING_MODE) ? 'RECETTES-DEPENSES' : $conf->global->ACCOUNTING_MODE;
if ($action == 'update') {
$error = 0;
@ -227,36 +225,6 @@ print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update">';
// Default mode for calculating turnover (parameter ACCOUNTING_MODE)
/*
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>' . $langs->trans('OptionMode') . '</td><td>' . $langs->trans('Description') . '</td>';
print "</tr>\n";
print '<tr ' . $bc[false] . '><td width="200"><input type="radio" name="accounting_mode" value="RECETTES-DEPENSES"' . ($accounting_mode != 'CREANCES-DETTES' ? ' checked' : '') . '> ' . $langs->trans('OptionModeTrue') . '</td>';
print '<td colspan="2">' . nl2br($langs->trans('OptionModeTrueDesc'));
// Write info on way to count VAT
// if (! empty($conf->global->MAIN_MODULE_COMPTABILITE))
// {
// // print "<br>\n";
// // print nl2br($langs->trans('OptionModeTrueInfoModuleComptabilite'));
// }
// else
// {
// // print "<br>\n";
// // print nl2br($langs->trans('OptionModeTrueInfoExpert'));
// }
print "</td></tr>\n";
print '<tr ' . $bc[true] . '><td width="200"><input type="radio" name="accounting_mode" value="CREANCES-DETTES"' . ($accounting_mode == 'CREANCES-DETTES' ? ' checked' : '') . '> ' . $langs->trans('OptionModeVirtual') . '</td>';
print '<td colspan="2">' . nl2br($langs->trans('OptionModeVirtualDesc')) . "</td></tr>\n";
print "</table>\n";
print '<br>';
*/
// Params
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';

View File

@ -152,7 +152,7 @@ if ($action == 'update') {
}
if ($result <= 0) {
// setEventMessages(null, $accounting->errors, 'errors');
$msg .= '<div><font color="red">'.$langs->trans("ErrorDB").' : '.$langs->trans("Product").' '.$productid.' '.$langs->trans("NotVentilatedinAccount").' : id='.$accounting_account_id.'<br/> <pre>'.$sql.'</pre></font></div>';
$msg .= '<div><span style="color:red">'.$langs->trans("ErrorDB").' : '.$langs->trans("Product").' '.$productid.' '.$langs->trans("NotVentilatedinAccount").' : id='.$accounting_account_id.'<br/> <pre>'.$sql.'</pre></span></div>';
$ko++;
} else {
$db->begin();

View File

@ -142,7 +142,7 @@ if (empty($reshook))
if ($massaction == 'ventil') {
$msg = '';
//print '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>';
//print '<div><span style="color:red">' . $langs->trans("Processing") . '...</span></div>';
if (!empty($mesCasesCochees)) {
$msg = '<div>'.$langs->trans("SelectedLines").': '.count($mesCasesCochees).'</div>';
$msg .= '<div class="detail">';
@ -157,7 +157,7 @@ if ($massaction == 'ventil') {
if ($monCompte <= 0)
{
$msg .= '<div><font color="red">'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NoAccountSelected").'</font></div>';
$msg .= '<div><span style="color:red">'.$langs->trans("Lineofinvoice", $monId).' - '.$langs->trans("NoAccountSelected").'</span></div>';
$ko++;
} else {
$sql = " UPDATE ".MAIN_DB_PREFIX."facturedet";
@ -165,14 +165,14 @@ if ($massaction == 'ventil') {
$sql .= " WHERE rowid = ".((int) $monId);
$accountventilated = new AccountingAccount($db);
$accountventilated->fetch($monCompte, '');
$accountventilated->fetch($monCompte, '', 1);
dol_syslog("accountancy/customer/list.php sql=".$sql, LOG_DEBUG);
if ($db->query($sql)) {
$msg .= '<div><font color="green">'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("VentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'</font></div>';
$msg .= '<div><span style="color:green">'.$langs->trans("Lineofinvoice", $monId).' - '.$langs->trans("VentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'</span></div>';
$ok++;
} else {
$msg .= '<div><font color="red">'.$langs->trans("ErrorDB").' : '.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NotVentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'<br> <pre>'.$sql.'</pre></font></div>';
$msg .= '<div><span style="color:red">'.$langs->trans("ErrorDB").' : '.$langs->trans("Lineofinvoice", $monId).' - '.$langs->trans("NotVentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'<br> <pre>'.$sql.'</pre></span></div>';
$ko++;
}
}

View File

@ -124,7 +124,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
if ($massaction == 'ventil') {
$msg = '';
//print '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>';
//print '<div><span style="color:red">' . $langs->trans("Processing") . '...</span></div>';
if (!empty($mesCasesCochees)) {
$msg = '<div>'.$langs->trans("SelectedLines").': '.count($mesCasesCochees).'</div>';
$msg .= '<div class="detail">';
@ -139,7 +139,7 @@ if ($massaction == 'ventil') {
if ($monCompte <= 0)
{
$msg .= '<div><font color="red">'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NoAccountSelected").'</font></div>';
$msg .= '<div><span style="color:red">'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NoAccountSelected").'</span></div>';
$ko++;
} else {
$sql = " UPDATE ".MAIN_DB_PREFIX."expensereport_det";
@ -147,14 +147,14 @@ if ($massaction == 'ventil') {
$sql .= " WHERE rowid = ".$monId;
$accountventilated = new AccountingAccount($db);
$accountventilated->fetch($monCompte, '');
$accountventilated->fetch($monCompte, '', 1);
dol_syslog('accountancy/expensereport/list.php:: sql='.$sql, LOG_DEBUG);
if ($db->query($sql)) {
$msg .= '<div><font color="green">'.$langs->trans("LineOfExpenseReport").' '.$monId.' - '.$langs->trans("VentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'</font></div>';
$msg .= '<div><span style="color:green">'.$langs->trans("LineOfExpenseReport").' '.$monId.' - '.$langs->trans("VentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'</span></div>';
$ok++;
} else {
$msg .= '<div><font color="red">'.$langs->trans("ErrorDB").' : '.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NotVentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'<br/> <pre>'.$sql.'</pre></font></div>';
$msg .= '<div><span style="color:red">'.$langs->trans("ErrorDB").' : '.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NotVentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'<br/> <pre>'.$sql.'</pre></span></div>';
$ko++;
}
}

View File

@ -93,12 +93,15 @@ $error = 0;
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
// Period by default on transfer
$dates = getDefaultDatesForTransfer();
$date_start = $dates['date_start'];
$date_end = $dates['date_end'];
$pastmonthyear = $dates['pastmonthyear'];
$pastmonth = $dates['pastmonth'];
if (empty($date_startmonth) || empty($date_endmonth))
{
// Period by default on transfer
$dates = getDefaultDatesForTransfer();
$date_start = $dates['date_start'];
$date_end = $dates['date_end'];
$pastmonthyear = $dates['pastmonthyear'];
$pastmonth = $dates['pastmonth'];
}
if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))) // We define date_start and date_end, only if we did not submit the form
{

View File

@ -73,12 +73,15 @@ $journal_label = $accountingjournalstatic->label;
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
// Period by default on transfer
$dates = getDefaultDatesForTransfer();
$date_start = $dates['date_start'];
$date_end = $dates['date_end'];
$pastmonthyear = $dates['pastmonthyear'];
$pastmonth = $dates['pastmonth'];
if (empty($date_startmonth) || empty($date_endmonth))
{
// Period by default on transfer
$dates = getDefaultDatesForTransfer();
$date_start = $dates['date_start'];
$date_end = $dates['date_end'];
$pastmonthyear = $dates['pastmonthyear'];
$pastmonth = $dates['pastmonth'];
}
if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))) // We define date_start and date_end, only if we did not submit the form
{

View File

@ -78,12 +78,15 @@ $journal_label = $accountingjournalstatic->label;
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
// Period by default on transfer
$dates = getDefaultDatesForTransfer();
$date_start = $dates['date_start'];
$date_end = $dates['date_end'];
$pastmonthyear = $dates['pastmonthyear'];
$pastmonth = $dates['pastmonth'];
if (empty($date_startmonth) || empty($date_endmonth))
{
// Period by default on transfer
$dates = getDefaultDatesForTransfer();
$date_start = $dates['date_start'];
$date_end = $dates['date_end'];
$pastmonthyear = $dates['pastmonthyear'];
$pastmonth = $dates['pastmonth'];
}
if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))) // We define date_start and date_end, only if we did not submit the form
{

View File

@ -81,12 +81,15 @@ $journal_label = $accountingjournalstatic->label;
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
// Period by default on transfer
$dates = getDefaultDatesForTransfer();
$date_start = $dates['date_start'];
$date_end = $dates['date_end'];
$pastmonthyear = $dates['pastmonthyear'];
$pastmonth = $dates['pastmonth'];
if (empty($date_startmonth) || empty($date_endmonth))
{
// Period by default on transfer
$dates = getDefaultDatesForTransfer();
$date_start = $dates['date_start'];
$date_end = $dates['date_end'];
$pastmonthyear = $dates['pastmonthyear'];
$pastmonth = $dates['pastmonth'];
}
if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))) // We define date_start and date_end, only if we did not submit the form
{

View File

@ -146,7 +146,7 @@ if (empty($reshook))
if ($massaction == 'ventil') {
$msg = '';
//print '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>';
//print '<div><span style="color:red">' . $langs->trans("Processing") . '...</span></div>';
if (!empty($mesCasesCochees)) {
$msg = '<div>'.$langs->trans("SelectedLines").': '.count($mesCasesCochees).'</div>';
$msg .= '<div class="detail">';
@ -161,7 +161,7 @@ if ($massaction == 'ventil') {
if ($monCompte <= 0)
{
$msg .= '<div><font color="red">'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NoAccountSelected").'</font></div>';
$msg .= '<div><span style="color:red">'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NoAccountSelected").'</span></div>';
$ko++;
} else {
$sql = " UPDATE ".MAIN_DB_PREFIX."facture_fourn_det";
@ -169,14 +169,14 @@ if ($massaction == 'ventil') {
$sql .= " WHERE rowid = ".$monId;
$accountventilated = new AccountingAccount($db);
$accountventilated->fetch($monCompte, '');
$accountventilated->fetch($monCompte, '', 1);
dol_syslog('accountancy/supplier/list.php:: sql='.$sql, LOG_DEBUG);
if ($db->query($sql)) {
$msg .= '<div><font color="green">'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("VentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'</font></div>';
$msg .= '<div><span style="color:green">'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("VentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'</span></div>';
$ok++;
} else {
$msg .= '<div><font color="red">'.$langs->trans("ErrorDB").' : '.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NotVentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'<br/> <pre>'.$sql.'</pre></font></div>';
$msg .= '<div><span style="color:red">'.$langs->trans("ErrorDB").' : '.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NotVentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'<br/> <pre>'.$sql.'</pre></span></div>';
$ko++;
}
}

View File

@ -44,8 +44,6 @@ $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'mem
// Security check
$result = restrictedArea($user, 'adherent');
$filter = GETPOST("filter", 'alpha');
$statut = GETPOST("statut", 'intcomma');
$search = GETPOST("search", 'alpha');
$search_ref = GETPOST("search_ref", 'alpha');
$search_lastname = GETPOST("search_lastname", 'alpha');
@ -65,12 +63,19 @@ $search_phone_mobile = GETPOST("search_phone_mobile", 'alpha');
$search_type = GETPOST("search_type", 'alpha');
$search_email = GETPOST("search_email", 'alpha');
$search_categ = GETPOST("search_categ", 'int');
$search_filter = GETPOST("search_filter", 'alpha');
$search_status = GETPOST("search_status", 'intcomma');
$catid = GETPOST("catid", 'int');
$optioncss = GETPOST('optioncss', 'alpha');
$filter = GETPOST("filter", 'alpha');
if ($filter) $search_filter = $filter; // For backward compatibility
$statut = GETPOST("statut", 'alpha');
if ($statut != '') $search_status = $statut; // For backward compatibility
$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
if ($statut < -1) $statut = '';
if ($search_status < -1) $search_status = '';
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
@ -166,6 +171,9 @@ if (empty($reshook)) {
// Purge search criteria
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
$statut = '';
$filter = '';
$search = "";
$search_ref = "";
$search_lastname = "";
@ -186,9 +194,10 @@ if (empty($reshook)) {
$search_phone_mobile = '';
$search_morphy = "";
$search_categ = "";
$search_filter = "";
$search_status = "";
$catid = "";
$sall = "";
$statut = '';
$toselect = '';
$search_array_options = array();
}
@ -273,7 +282,10 @@ if ($search_categ == -2) $sql .= " AND cm.fk_categorie IS NULL";
$sql .= " AND d.entity IN (".getEntity('adherent').")";
if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall);
if ($search_type > 0) $sql .= " AND t.rowid=".$db->escape($search_type);
if ($statut != '') $sql .= " AND d.statut in (".$db->escape($statut).")"; // Peut valoir un nombre ou liste de nombre separes par virgules
if ($search_filter == 'withoutsubscription') $sql .= " AND (datefin IS NULL OR t.subscription = 0)";
if ($search_filter == 'uptodate') $sql .= " AND (datefin >= '".$db->idate($now)."' OR t.subscription = 0)";
if ($search_filter == 'outofdate') $sql .= " AND (datefin < '".$db->idate($now)."' AND t.subscription = 1)";
if ($search_status != '') $sql .= " AND d.statut in (".$db->sanitize($db->escape($search_status)).")"; // Peut valoir un nombre ou liste de nombre separes par virgules
if ($search_ref) {
if (is_numeric($search_ref)) $sql .= " AND (d.rowid = ".$db->escape($search_ref).")";
else $sql .= " AND 1 = 2"; // Always wrong
@ -293,8 +305,6 @@ if ($search_phone) $sql .= natural_search("d.phone", $search_phone);
if ($search_phone_perso) $sql .= natural_search("d.phone_perso", $search_phone_perso);
if ($search_phone_mobile) $sql .= natural_search("d.phone_mobile", $search_phone_mobile);
if ($search_country) $sql .= " AND d.country IN (".$search_country.')';
if ($filter == 'uptodate') $sql .= " AND (datefin >= '".$db->idate($now)."' OR t.subscription = 0)";
if ($filter == 'outofdate') $sql .= " AND ((datefin IS NULL OR datefin < '".$db->idate($now)."') AND t.subscription = 1)";
// Add where from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
@ -341,13 +351,14 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $
llxHeader('', $langs->trans("Member"), 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros');
$titre = $langs->trans("MembersList");
if (GETPOSTISSET("statut")) {
if ($statut == '-1,1') { $titre = $langs->trans("MembersListQualified"); }
if ($statut == '-1') { $titre = $langs->trans("MembersListToValid"); }
if ($statut == '1' && !$filter) { $titre = $langs->trans("MembersListValid"); }
if ($statut == '1' && $filter == 'uptodate') { $titre = $langs->trans("MembersListUpToDate"); }
if ($statut == '1' && $filter == 'outofdate') { $titre = $langs->trans("MembersListNotUpToDate"); }
if ($statut == '0') { $titre = $langs->trans("MembersListResiliated"); }
if (GETPOSTISSET("search_status")) {
if ($search_status == '-1,1') { $titre = $langs->trans("MembersListQualified"); }
if ($search_status == '-1') { $titre = $langs->trans("MembersListToValid"); }
if ($search_status == '1' && $filter == '') { $titre = $langs->trans("MembersValidated"); }
if ($search_status == '1' && $filter == 'withoutsubscription') { $titre = $langs->trans("MembersWithSubscriptionToReceive"); }
if ($search_status == '1' && $filter == 'uptodate') { $titre = $langs->trans("MembersListUpToDate"); }
if ($search_status == '1' && $filter == 'outofdate') { $titre = $langs->trans("MembersListNotUpToDate"); }
if ($search_status == '0') { $titre = $langs->trans("MembersListResiliated"); }
} elseif ($action == 'search') {
$titre = $langs->trans("MembersListQualified");
}
@ -362,7 +373,6 @@ $param = '';
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
if ($sall != "") $param .= "&sall=".urlencode($sall);
if ($statut != "") $param .= "&statut=".urlencode($statut);
if ($search_ref) $param .= "&search_ref=".urlencode($search_ref);
if ($search_civility) $param .= "&search_civility=".urlencode($search_civility);
if ($search_firstname) $param .= "&search_firstname=".urlencode($search_firstname);
@ -380,7 +390,8 @@ if ($search_country != '') $param .= "&search_country=".urlencode($search_countr
if ($search_phone != '') $param .= "&search_phone=".urlencode($search_phone);
if ($search_phone_perso != '') $param .= "&search_phone_perso=".urlencode($search_phone_perso);
if ($search_phone_mobile != '') $param .= "&search_phone_mobile=".urlencode($search_phone_mobile);
if ($filter) $param .= "&filter=".urlencode($filter);
if ($search_filter && $search_filter != '-1') $param .= "&search_filter=".urlencode($search_filter);
if ($search_status != "" && $search_status != '-1') $param .= "&search_status=".urlencode($search_status);
if ($search_type > 0) $param .= "&search_type=".urlencode($search_type);
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
// Add $param from extra fields
@ -549,6 +560,8 @@ if (!empty($arrayfields['d.email']['checked'])) {
// End of subscription date
if (!empty($arrayfields['d.datefin']['checked'])) {
print '<td class="liste_titre left">';
$selectarray=array('-1'=>'', 'withoutsubscription'=>$langs->trans("WithoutSubscription"), 'uptodate'=>$langs->trans("UpToDate"), 'outofdate'=>$langs->trans("OutOfDate"));
print $form->selectarray('search_filter', $selectarray, $search_filter);
print '</td>';
}
// Extra fields
@ -563,7 +576,7 @@ if (!empty($arrayfields['d.datec']['checked'])) {
print '<td class="liste_titre">';
print '</td>';
}
//Birthday
// Birthday
if (!empty($arrayfields['d.birth']['checked'])) {
print '<td class="liste_titre">';
print '</td>';
@ -581,7 +594,7 @@ if (!empty($arrayfields['d.statut']['checked'])) {
'1'=>$langs->trans("Validated"),
'0'=>$langs->trans("Resiliated")
);
print $form->selectarray('statut', $liststatus, $statut, -2);
print $form->selectarray('search_status', $liststatus, $search_status, -2);
print '</td>';
}
// Action column

View File

@ -31,10 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
dol_include_once('/emailcollector/class/emailcollector.class.php');
if (!$user->admin) accessforbidden();
if (empty($conf->emailcollector->enabled)) accessforbidden();
// Load traductions files required by page
// Load translation files required by page
$langs->loadLangs(array("admin", "other"));
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
@ -54,7 +51,7 @@ $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
@ -86,11 +83,11 @@ if ($user->socid > 0) // Protection if external user
//$result = restrictedArea($user, 'emailcollector', $id, '');
// Initialize array of search criterias
$search_all = GETPOST("search_all", 'alpha');
$search_all = GETPOST("search_all", 'alphanohtml');
$search = array();
foreach ($object->fields as $key => $val)
{
if (GETPOST('search_'.$key, 'alpha')) $search[$key] = GETPOST('search_'.$key, 'alpha');
if (GETPOST('search_'.$key, 'alpha') !== '') $search[$key] = GETPOST('search_'.$key, 'alpha');
}
// List of fields to search into when doing a "search in all"
@ -100,25 +97,47 @@ foreach ($object->fields as $key => $val)
if ($val['searchall']) $fieldstosearchall['t.'.$key] = $val['label'];
}
// Definition of fields for list
// Definition of array of fields for columns
$arrayfields = array();
foreach ($object->fields as $key => $val)
{
// If $val['visible']==0, then we never show the field
if (!empty($val['visible'])) $arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>$val['enabled'], 'position'=>$val['position']);
if (!empty($val['visible'])) {
$visible = dol_eval($val['visible'], 1);
$arrayfields['t.'.$key] = array(
'label'=>$val['label'],
'checked'=>(($visible < 0) ? 0 : 1),
'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)),
'position'=>$val['position']
);
}
}
// Extra fields
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
{
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val)
{
if (!empty($extrafields->attributes[$object->table_element]['list'][$key]))
$arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) {
$arrayfields["ef.".$key] = array(
'label'=>$extrafields->attributes[$object->table_element]['label'][$key],
'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1),
'position'=>$extrafields->attributes[$object->table_element]['pos'][$key],
'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]),
'langfile'=>$extrafields->attributes[$object->table_element]['langfile'][$key]
);
}
}
}
$object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position');
$permissiontoread = $user->rights->emailcollector->read;
$permissiontoadd = $user->rights->emailcollector->write;
$permissiontodelete = $user->rights->emailcollector->delete;
if (!$user->admin) accessforbidden();
if (empty($conf->emailcollector->enabled)) accessforbidden('Module not enabled');
/*
@ -182,13 +201,14 @@ foreach ($object->fields as $key => $val)
$sql .= 't.'.$key.', ';
}
// Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label']))
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.' as options_'.$key.', ' : '');
}
// Add fields from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql = preg_replace('/, $/', '', $sql);
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
$sql = preg_replace('/,\s*$/', '', $sql);
$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
if ($object->ismultientitymanaged == 1) $sql .= " WHERE t.entity IN (".getEntity($object->element).")";
@ -197,6 +217,10 @@ foreach ($search as $key => $val)
{
if ($key == 'status' && $search[$key] == -1) continue;
$mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
if (strpos($object->fields[$key]['type'], 'integer:') === 0) {
if ($search[$key] == '-1') $search[$key] = '';
$mode_search = 2;
}
if ($search[$key] != '') $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search));
}
if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
@ -208,7 +232,7 @@ $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $objec
$sql .= $hookmanager->resPrint;
/* If a group by is required
$sql.= " GROUP BY "
$sql.= " GROUP BY ";
foreach ($object->fields as $key => $val)
{
$sql.='t.'.$key.', ';
@ -216,6 +240,7 @@ foreach ($object->fields as $key => $val)
// Add fields from extrafields
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
}
// Add where from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $object may have been modified by hook
@ -238,11 +263,11 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
}
}
// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set.
if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords)
if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit)))
{
$num = $nbtotalofrecords;
} else {
$sql .= $db->plimit($limit + 1, $offset);
if ($limit) $sql .= $db->plimit($limit + 1, $offset);
$resql = $db->query($sql);
if (!$resql)
@ -255,7 +280,7 @@ if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords)
}
// Direct jump if only one record found
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all)
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page)
{
$obj = $db->fetch_object($resql);
$id = $obj->rowid;
@ -291,7 +316,8 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&co
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
foreach ($search as $key => $val)
{
$param .= '&search_'.$key.'='.urlencode($search[$key]);
if (is_array($search[$key]) && count($search[$key])) foreach ($search[$key] as $skey) $param .= '&search_'.$key.'[]='.urlencode($skey);
else $param .= '&search_'.$key.'='.urlencode($search[$key]);
}
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
// Add $param from extra fields
@ -302,7 +328,7 @@ $arrayofmassactions = array(
//'presend'=>$langs->trans("SendByMail"),
//'builddoc'=>$langs->trans("PDFMerge"),
);
if ($user->rights->emailcollector->delete) $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
if ($permissiontodelete) $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array();
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
@ -318,13 +344,9 @@ print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
$newcardbutton = '';
//if ($user->rights->emailcollector->creer)
//{
$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', 'emailcollector_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']));
//}
$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', 'emailcollector_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd);
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'email', 0, $newcardbutton.' '.$linkback, '', $limit);
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'email', 0, $newcardbutton.' '.$linkback, '', $limit, 0, 0, 1);
// Add code for pre mass action (confirmation or email presend form)
/*$topicmail="";
@ -355,7 +377,7 @@ $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfi
$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
// Fields title search
@ -363,11 +385,20 @@ print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" :
print '<tr class="liste_titre">';
foreach ($object->fields as $key => $val)
{
$cssforfield = '';
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
if (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
if ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center';
if (!empty($arrayfields['t.'.$key]['checked'])) print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'"><input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'"></td>';
$cssforfield = (empty($val['css']) ? '' : $val['css']);
if ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center';
elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
elseif (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield .= ($cssforfield ? ' ' : '').'right';
if (!empty($arrayfields['t.'.$key]['checked']))
{
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75');
elseif (strpos($val['type'], 'integer:') === 0) {
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1);
} elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
print '</td>';
}
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
@ -389,11 +420,12 @@ print '</tr>'."\n";
print '<tr class="liste_titre">';
foreach ($object->fields as $key => $val)
{
$cssforfield = '';
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
if (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
if ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center';
if (!empty($arrayfields['t.'.$key]['checked']))
$cssforfield = (empty($val['css']) ? '' : $val['css']);
if ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center';
elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
elseif (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield .= ($cssforfield ? ' ' : '').'right';
if (!empty($arrayfields['t.'.$key]['checked']))
{
print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n";
}
@ -404,6 +436,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
print '</tr>'."\n";
@ -423,52 +456,46 @@ if (is_array($extrafields->attributes[$object->table_element]['computed']) && co
// --------------------------------------------------------------------
$i = 0;
$totalarray = array();
while ($i < min($num, $limit))
while ($i < ($limit ? min($num, $limit) : $num))
{
$obj = $db->fetch_object($resql);
if (empty($obj)) break; // Should not happen
// Store properties in $object
$object->id = $obj->rowid;
foreach ($object->fields as $key => $val)
{
if (property_exists($obj, $key)) $object->$key = $obj->$key;
}
$object->setVarsFromFetchObj($obj);
// Show here line of result
print '<tr class="oddeven">';
foreach ($object->fields as $key => $val)
{
$cssforfield = '';
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
$cssforfield = (empty($val['css']) ? '' : $val['css']);
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
elseif ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center';
if (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
elseif ($key == 'ref') $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status'))) $cssforfield .= ($cssforfield ? ' ' : '').'right';
//if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
if (!empty($arrayfields['t.'.$key]['checked']))
{
print '<td';
if ($cssforfield || $val['css']) print ' class="';
print $cssforfield;
if ($cssforfield && $val['css']) print ' ';
print $val['css'];
if ($cssforfield || $val['css']) print '"';
print '>';
print $object->showOutputField($val, $key, $obj->$key, '');
print '</td>';
if (!$i) $totalarray['nbfield']++;
if (!empty($val['isameasure']))
{
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
$totalarray['val']['t.'.$key] += $obj->$key;
}
print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>';
if ($key == 'status') print $object->getLibStatut(5);
else print $object->showOutputField($val, $key, $object->$key, '');
print '</td>';
if (!$i) $totalarray['nbfield']++;
if (!empty($val['isameasure']))
{
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
$totalarray['val']['t.'.$key] += $object->$key;
}
}
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
@ -476,13 +503,13 @@ while ($i < min($num, $limit))
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
{
$selected = 0;
if (in_array($obj->rowid, $arrayofselected)) $selected = 1;
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
if (in_array($object->id, $arrayofselected)) $selected = 1;
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '</td>';
if (!$i) $totalarray['nbfield']++;
print '</tr>';
print '</tr>'."\n";
$i++;
}
@ -524,8 +551,8 @@ if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $n
$urlsource .= str_replace('&amp;', '&', $param);
$filedir = $diroutputmassaction;
$genallowed = $user->rights->emailcollector->read;
$delallowed = $user->rights->emailcollector->create;
$genallowed = $permissiontoread;
$delallowed = $permissiontoadd;
print $formfile->showdocuments('massfilesarea_emailcollector', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
}

View File

@ -95,7 +95,7 @@ print '</td></tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("ExportCsvSeparator").'</td>';
print '<td width="60" align="center">'."<input size=\"3\" class=\"flat\" type=\"text\" name=\"EXPORT_CSV_SEPARATOR_TO_USE\" value=\"".(empty($conf->global->EXPORT_CSV_SEPARATOR_TO_USE) ? ',' : $conf->global->EXPORT_CSV_SEPARATOR_TO_USE)."\"></td>";
print '<td width="60" align="center"><input class="flat width50" maxlength="3" type="text" name="EXPORT_CSV_SEPARATOR_TO_USE" value="'.(empty($conf->global->EXPORT_CSV_SEPARATOR_TO_USE) ? ',' : $conf->global->EXPORT_CSV_SEPARATOR_TO_USE).'"></td>';
print '<td class="right"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
print '</tr>';

View File

@ -128,9 +128,10 @@ print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Module").'</td>';
print '<td class="center">&nbsp;</td>';
print '<td class="center">'.$langs->trans("Default").'</td>';
print '<td class="center">&nbsp;</td>';
print '<td>'.$langs->trans("Permissions").'</td>';
if ($user->admin) print '<td class="right">'.$langs->trans("ID").'</td>';
print '</tr>'."\n";
//print "xx".$conf->global->MAIN_USE_ADVANCED_PERMS;
@ -178,7 +179,6 @@ if ($result)
$found = false;
foreach ($modules[$obj->module]->rights as $key => $val)
{
$rights_class = $objMod->rights_class;
if ($val[4] == $obj->perms && (empty($val[5]) || $val[5] == $obj->subperms))
{
$found = true;
@ -209,6 +209,8 @@ if ($result)
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
// Permission id
if ($user->admin) print '<td class="right"></td>';
print '</tr>'."\n";
}
@ -223,15 +225,21 @@ if ($result)
// Tick
if ($obj->bydefault == 1)
{
print '<td>';
print '<a class="reposition" href="perms.php?pid='.$obj->id.'&amp;action=remove">'.img_edit_remove().'</a>';
print '<td class="center">';
print '<a class="reposition" href="perms.php?pid='.$obj->id.'&amp;action=remove">';
//print img_edit_remove();
print img_picto('', 'switch_on');
print '</a>';
print '</td>';
print '<td class="center">';
print img_picto($langs->trans("Active"), 'tick');
//print img_picto($langs->trans("Active"), 'tick');
print '</td>';
} else {
print '<td>';
print '<a class="reposition" href="perms.php?pid='.$obj->id.'&amp;action=add">'.img_edit_add().'</a>';
print '<td class="center">';
print '<a class="reposition" href="perms.php?pid='.$obj->id.'&amp;action=add">';
//print img_edit_add();
print img_picto('', 'switch_off');
print '</a>';
print '</td>';
print '<td class="center">';
print '&nbsp;';
@ -241,6 +249,9 @@ if ($result)
// Permission and tick
print '<td>'.$perm_libelle.'</td>';
// Permission id
if ($user->admin) print '<td class="right"><span class="opacitymedium">'.$obj->id.'</span></td>';
print '</tr>'."\n";
$i++;

View File

@ -317,7 +317,7 @@ print '</tr>';
$cats = $object->get_filles();
if ($cats < 0)
{
dol_print_error($db, $cats->error, $cats->errors);
dol_print_error($db, $object->error, $object->errors);
} elseif (count($cats) < 1)
{
print '<tr class="oddeven">';
@ -432,7 +432,7 @@ if ($type == Categorie::TYPE_PRODUCT)
$prods = $object->getObjectsInCateg($type, 0, $limit, $offset);
if ($prods < 0)
{
dol_print_error($db, $prods->error, $prods->errors);
dol_print_error($db, $object->error, $object->errors);
} else {
// Form to add record into a category
$showclassifyform = 1;
@ -511,7 +511,7 @@ if ($type == Categorie::TYPE_SUPPLIER)
$socs = $object->getObjectsInCateg($type, 0, $limit, $offset);
if ($socs < 0)
{
dol_print_error($db, $socs->error, $socs->errors);
dol_print_error($db, $object->error, $object->errors);
} else {
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
@ -568,7 +568,7 @@ if ($type == Categorie::TYPE_CUSTOMER)
$socs = $object->getObjectsInCateg($type, 0, $limit, $offset);
if ($socs < 0)
{
dol_print_error($db, $socs->error, $socs->errors);
dol_print_error($db, $object->error, $object->errors);
} else {
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
@ -627,7 +627,7 @@ if ($type == Categorie::TYPE_MEMBER)
$prods = $object->getObjectsInCateg($type, 0, $limit, $offset);
if ($prods < 0)
{
dol_print_error($db, $prods->error, $prods->errors);
dol_print_error($db, $object->error, $object->errors);
} else {
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
@ -686,7 +686,7 @@ if ($type == Categorie::TYPE_CONTACT)
$contacts = $object->getObjectsInCateg($type, 0, $limit, $offset);
if ($contacts < 0)
{
dol_print_error($db, $contacts->error, $contacts->errors);
dol_print_error($db, $object->error, $object->errors);
} else {
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
@ -748,7 +748,7 @@ if ($type == Categorie::TYPE_ACCOUNT)
$accounts = $object->getObjectsInCateg($type, 0, $limit, $offset);
if ($accounts < 0)
{
dol_print_error($db, $accounts->error, $accounts->errors);
dol_print_error($db, $object->error, $object->errors);
} else {
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
@ -877,12 +877,14 @@ if ($type == Categorie::TYPE_USER)
print '<input type="hidden" name="action" value="list">';
print '<br>';
$param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($objects); $nbtotalofrecords = ''; $newcardbutton = '';
print_barre_liste($langs->trans("Users"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'user', 0, $newcardbutton, '', $limit);
$param = '&limit='.$limit.'&id='.$id.'&type='.$type;
$num = count($users);
print_barre_liste($langs->trans("Users"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, '', 'user', 0, '', '', $limit);
print "<table class='noborder' width='100%'>\n";
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Users").' <span class="badge">'.count($users).'</span></td></tr>'."\n";
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Users").' <span class="badge">'.$num.'</span></td></tr>'."\n";
if (count($users) > 0)
{
@ -916,7 +918,7 @@ if ($type == Categorie::TYPE_USER)
}
// List of Project
// List of warehouses
if ($type == Categorie::TYPE_WAREHOUSE)
{
$permission = $user->rights->stock->creer;

View File

@ -825,7 +825,7 @@ if (empty($reshook))
$error++;
}
if ($prod_entry_mode == 'free' && empty($idprod) && $price_ht == '' && $price_ht_devise == '') // Unit price can be 0 but not ''. Also price can be negative for proposal.
if ($prod_entry_mode == 'free' && empty($idprod) && $price_ht === '' && $price_ht_devise === '') // Unit price can be 0 but not ''. Also price can be negative for proposal.
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors');
$error++;
@ -966,7 +966,7 @@ if (empty($reshook))
$tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx));
// if price ht is forced (ie: calculated by margin rate and cost price). TODO Why this ?
if (!empty($price_ht)) {
if (!empty($price_ht) || $price_ht === '0') {
$pu_ht = price2num($price_ht, 'MU');
$pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');
} // On reevalue prix selon taux tva car taux tva transaction peut etre different

View File

@ -820,7 +820,7 @@ if (empty($reshook))
$tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx));
// if price ht is forced (ie: calculated by margin rate and cost price). TODO Why this ?
if (!empty($price_ht)) {
if (!empty($price_ht) || $price_ht === '0') {
$pu_ht = price2num($price_ht, 'MU');
$pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');
}

View File

@ -2012,7 +2012,7 @@ if (empty($reshook))
$tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx));
// if price ht was forced (ie: from gui when calculated by margin rate and cost price). TODO Why this ?
if (!empty($price_ht))
if (!empty($price_ht) || $price_ht === '0')
{
$pu_ht = price2num($price_ht, 'MU');
$pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');

View File

@ -333,7 +333,7 @@ if ($action == 'new')
if ($action == 'reject_check')
{
$formquestion = array(
array('type' => 'hidden', 'name' => 'bankid', 'value' => GETPOST('lineid')),
array('type' => 'hidden', 'name' => 'bankid', 'value' => GETPOST('lineid', 'int')),
array('type' => 'date', 'name' => 'rejectdate_', 'label' => $langs->trans("RejectCheckDate"), 'value' => dol_now())
);
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans("RejectCheck"), $langs->trans("ConfirmRejectCheck"), 'confirm_reject_check', $formquestion, '', 1);

View File

@ -240,18 +240,11 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
$permok = $user->rights->agenda->myactions->create;
if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok)
{
//$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
if (is_object($objthirdparty) && get_class($objthirdparty) == 'Societe') $out .= '&amp;socid='.$objthirdparty->id;
$out .= (!empty($objcon->id) ? '&amp;contactid='.$objcon->id : '').'&amp;backtopage=1&amp;percentage=-1';
//$out.=$langs->trans("AddAnAction").' ';
//$out.=img_picto($langs->trans("AddAnAction"),'filenew');
//$out.="</a>";
if (is_object($objthirdparty) && get_class($objthirdparty) == 'Societe') $out .= '&amp;originid='.$objthirdparty->id.($objthirdparty->id > 0 ? '&amp;socid='.$objthirdparty->id : '');
$out .= (!empty($objcon->id) ? '&amp;contactid='.$objcon->id : '').'&amp;origin=contact&amp;originid='.$object->id.'&amp;percentage=-1&amp;backtopage='.urlencode($_SERVER['PHP_SELF'].($objcon->id > 0 ? '?id='.$objcon->id : ''));
$out .= '&amp;datep='.urlencode(dol_print_date(dol_now(), 'dayhourlog'));
}
//print '<div class="tabsAction">';
//print '</div>';
$newcardbutton = '';
if (!empty($conf->agenda->enabled))
{

View File

@ -2256,7 +2256,7 @@ class Contrat extends CommonObject
{
while ($obj = $this->db->fetch_object($resql))
{
$this->nb["Contracts"] = $obj->nb;
$this->nb["contracts"] = $obj->nb;
}
$this->db->free($resql);
return 1;

View File

@ -46,8 +46,8 @@ if (!defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1');
require '../../main.inc.php';
$time = (int) GETPOST('time', 'int'); // Use the time parameter that is always increased by time_update, even if call is late
//$time=dol_now();
//$time = (int) GETPOST('time', 'int'); // Use the time parameter that is always increased by time_update, even if call is late
$time=dol_now();
$action = GETPOST('action', 'aZ09');
$listofreminderids = GETPOST('listofreminderids', 'aZ09');
@ -58,19 +58,20 @@ $listofreminderids = GETPOST('listofreminderids', 'aZ09');
if ($action == 'stopreminder') {
dol_syslog("Clear notification for listofreminderids=".$listofreminderids);
$listofreminderidsarray = explode('-', GETPOST('listofreminderids', 'aZ09'));
$listofreminderid = GETPOST('listofreminderids', 'intcomma');
// Set the reminder as done
foreach ($listofreminderidsarray as $listofreminderid) {
if (empty($listofreminderid)) continue;
//$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'action_reminder WHERE rowid = '.$listofreminderid.' AND fk_user = '.$user->id;
$sql = 'UPDATE '.MAIN_DB_PREFIX.'actioncomm_reminder SET status = 1';
$sql .= ' WHERE status = 0 AND rowid = '.$listofreminderid.' AND fk_user = '.$user->id.' AND entity = '.$conf->entity;
$resql = $db->query($sql);
if (!$resql) {
dol_print_error($db);
}
//foreach ($listofreminderidsarray as $listofreminderid) {
// if (empty($listofreminderid)) continue;
//$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'action_reminder WHERE rowid = '.$listofreminderid.' AND fk_user = '.$user->id;
$sql = 'UPDATE '.MAIN_DB_PREFIX.'actioncomm_reminder SET status = 1';
$sql .= ' WHERE status = 0 AND rowid IN ('.$db->sanitize($db->escape($listofreminderid)).')';
$sql .= ' AND fk_user = '.$user->id.' AND entity = '.$conf->entity;
$resql = $db->query($sql);
if (!$resql) {
dol_print_error($db);
}
//}
include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
@ -90,7 +91,7 @@ if ($action == 'stopreminder') {
* View
*/
top_httphead('text/html'); // TODO Use a json mime type
top_httphead('application/json');
global $user, $db, $langs, $conf;
@ -102,9 +103,9 @@ $eventfound = array();
// TODO Try to make a solution with only a javascript timer that is easier. Difficulty is to avoid notification twice when several tabs are opened.
// This need to extend period to be sure to not miss and save in session what we notified to avoid duplicate.
if ($time >= $_SESSION['auto_check_events_not_before'] || GETPOST('forcechecknow', 'int'))
if (empty($_SESSION['auto_check_events_not_before']) || $time >= $_SESSION['auto_check_events_not_before'] || GETPOST('forcechecknow', 'int'))
{
$time_update = (int) $conf->global->MAIN_BROWSER_NOTIFICATION_FREQUENCY; // Always defined
/*$time_update = (int) $conf->global->MAIN_BROWSER_NOTIFICATION_FREQUENCY; // Always defined
if (!empty($_SESSION['auto_check_events_not_before']))
{
// We start scan from the not before so if two tabs were opend at differents seconds and we close one (so the js timer),
@ -121,6 +122,7 @@ if ($time >= $_SESSION['auto_check_events_not_before'] || GETPOST('forcechecknow
}
$_SESSION['auto_check_events_not_before'] = $time + $time_update;
*/
// Force save of the session change we did.
// WARNING: Any change in sessions after that will not be saved !
@ -131,19 +133,19 @@ if ($time >= $_SESSION['auto_check_events_not_before'] || GETPOST('forcechecknow
dol_syslog('NEW $_SESSION[auto_check_events_not_before]='.$_SESSION['auto_check_events_not_before']);
$sql = 'SELECT a.id, a.code, a.datep, a.label, a.location, ar.rowid as id_reminder, ar.dateremind, ar.fk_user as id_user_reminder';
$sql = 'SELECT a.id as id_agenda, a.code, a.datep, a.label, a.location, ar.rowid as id_reminder, ar.dateremind, ar.fk_user as id_user_reminder';
$sql .= ' FROM '.MAIN_DB_PREFIX.'actioncomm as a';
if (!empty($user->conf->MAIN_USER_WANT_ALL_EVENTS_NOTIFICATIONS)) {
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'actioncomm_reminder as ar ON a.id = ar.fk_actioncomm AND ar.fk_user = '.$user->id;
$sql .= ' WHERE a.code <> "AC_OTH_AUTO"';
$sql .= ' AND (';
$sql .= " (ar.typeremind = 'browser' AND ar.dateremind < '".$db->idate(dol_now())."' AND ar.status = 0 AND ar.entity = ".$conf->entity;
$sql .= " OR (a.datep BETWEEN '".$db->idate($starttime)."' AND '".$db->idate($time + $time_update - 1)."')";
$sql .= ' )';
} else {
$sql .= ' JOIN '.MAIN_DB_PREFIX.'actioncomm_reminder as ar ON a.id = ar.fk_actioncomm AND ar.fk_user = '.$user->id;
$sql .= " AND ar.typeremind = 'browser' AND ar.dateremind < '".$db->idate(dol_now())."' AND ar.status = 0 AND ar.entity = ".$conf->entity;
}
$sql .= $db->order('datep', 'ASC');
$sql .= ' LIMIT 10'; // Avoid too many notification at once
$resql = $db->query($sql);
@ -153,8 +155,8 @@ if ($time >= $_SESSION['auto_check_events_not_before'] || GETPOST('forcechecknow
// Message must be formated and translated to be used with javascript directly
$event = array();
$event['type'] = 'agenda';
$event['id'] = $obj->id;
$event['id_reminder'] = $obj->id_reminder;
$event['id_agenda'] = $obj->id_agenda;
$event['id_user'] = $obj->id_user_reminder;
$event['code'] = $obj->code;
$event['label'] = $obj->label;
@ -162,11 +164,11 @@ if ($time >= $_SESSION['auto_check_events_not_before'] || GETPOST('forcechecknow
$event['reminder_date_formated'] = dol_print_date($db->jdate($obj->dateremind), 'standard');
$event['event_date_start_formated'] = dol_print_date($db->jdate($obj->datep), 'standard');
$eventfound[] = $event;
$eventfound[$obj->id_agenda] = $event;
}
} else {
dol_syslog("Error sql = ".$db->lasterror(), LOG_ERR);
}
}
print json_encode($eventfound);
print json_encode(array('pastreminders'=>$eventfound, 'nextreminder'=>''));

View File

@ -6639,7 +6639,7 @@ abstract class CommonObject
// Show only the key field in params
if (is_array($params) && array_key_exists('onlykey', $params) && $key != $params['onlykey']) continue;
// @todo Add test also on 'enabled' (different than 'list' that is 'visibility')
// Test on 'enabled' ('enabled' is different than 'list' = 'visibility')
$enabled = 1;
if ($enabled && isset($extrafields->attributes[$this->table_element]['enabled'][$key]))
{
@ -6684,13 +6684,17 @@ abstract class CommonObject
switch ($mode) {
case "view":
$value = $this->array_options["options_".$key.$keysuffix];
$value = $this->array_options["options_".$key.$keysuffix]; // Value may be clean or formated later
break;
case "create":
case "edit":
$check = 'restricthtml';
// TODO Use check = 'alphahtml' or 'int' for some types
$getposttemp = GETPOST($keyprefix.'options_'.$key.$keysuffix, $check); // GETPOST can get value from GET, POST or setup of default values.
// We get the value of property found with GETPOST so it takes into account:
// default values overwrite, restore back to list link, ... (but not 'default value in database' of field)
$check = 'alphanohtml';
if (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('html', 'text'))) {
$check = 'restricthtml';
}
$getposttemp = GETPOST($keyprefix.'options_'.$key.$keysuffix, $check, 3); // GETPOST can get value from GET, POST or setup of default values overwrite.
// GETPOST("options_" . $key) can be 'abc' or array(0=>'abc')
if (is_array($getposttemp) || $getposttemp != '' || GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix))
{
@ -6755,18 +6759,18 @@ abstract class CommonObject
{
$datenotinstring = $this->db->jdate($datenotinstring);
}
$value = GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix) ?dol_mktime(GETPOST($keyprefix.'options_'.$key.$keysuffix."hour", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."min", 'int', 3), 0, GETPOST($keyprefix.'options_'.$key.$keysuffix."month", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."day", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."year", 'int', 3)) : $datenotinstring;
$value = (GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix) || $value) ? dol_mktime(GETPOST($keyprefix.'options_'.$key.$keysuffix."hour", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."min", 'int', 3), 0, GETPOST($keyprefix.'options_'.$key.$keysuffix."month", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."day", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."year", 'int', 3)) : $datenotinstring;
}
// Convert float submited string into real php numeric (value in memory must be a php numeric)
if (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('price', 'double')))
{
$value = GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix) ?price2num(GETPOST($keyprefix.'options_'.$key.$keysuffix, 'alpha', 3)) : $this->array_options['options_'.$key];
$value = (GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix) || $value) ? price2num($value) : $this->array_options['options_'.$key];
}
// HTML, select, integer and text add default value
if (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('html', 'text', 'select', 'int')))
// HTML, text, select, integer and varchar: take into account default value in database if in create mode
if (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('html', 'text', 'varchar', 'select', 'int')))
{
if ($action == 'create') $value = GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix) ? GETPOST($keyprefix.'options_'.$key.$keysuffix, 'restricthtml', 3) : $extrafields->attributes[$this->table_element]['default'][$key];
else $value = $this->array_options['options_'.$key];
if ($action == 'create') $value = (GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix) || $value) ? $value : $extrafields->attributes[$this->table_element]['default'][$key];
}
$labeltoshow = $langs->trans($label);
@ -6800,6 +6804,8 @@ abstract class CommonObject
$out .= $extrafields->showOutputField($key, $value);
break;
case "create":
$out .= $extrafields->showInputField($key, $value, '', $keysuffix, '', 0, $this->id, $this->table_element);
break;
case "edit":
$out .= $extrafields->showInputField($key, $value, '', $keysuffix, '', 0, $this->id, $this->table_element);
break;

View File

@ -132,6 +132,19 @@ class ExtraFields
*/
public $attribute_list;
/**
* @var array Array to store if field is summable
* @deprecated
*/
public $attribute_totalizable;
/**
* @var array Array to store entity id of extrafield
* @deprecated
*/
public $attribute_entityid;
/**
* @var array New array to store extrafields definition
*/

View File

@ -202,7 +202,7 @@ class FormActions
$newcardbutton = '';
if (!empty($conf->agenda->enabled) && !empty($user->rights->agenda->myactions->create))
{
$newcardbutton .= dolGetButtonTitle($langs->trans("AddEvent"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.dol_print_date(dol_now(), 'dayhourlog').'&origin='.$typeelement.'&originid='.$object->id.($object->socid > 0 ? '&socid='.$object->socid : ($socid > 0 ? '&socid='.$socid : '')).($projectid > 0 ? '&projectid='.$projectid : '').'&backtopage='.urlencode($urlbacktopage));
$newcardbutton .= dolGetButtonTitle($langs->trans("AddEvent"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&amp;datep='.urlencode(dol_print_date(dol_now(), 'dayhourlog')).'&amp;origin='.urlencode($typeelement).'&amp;originid='.$object->id.($object->socid > 0 ? '&amp;socid='.$object->socid : ($socid > 0 ? '&amp;socid='.$socid : '')).($projectid > 0 ? '&amp;projectid='.$projectid : '').'&amp;backtopage='.urlencode($urlbacktopage));
}

View File

@ -74,10 +74,13 @@ if (!($_SERVER['HTTP_REFERER'] === $dolibarr_main_url_root.'/' || $_SERVER['HTTP
$.ajax("<?php print DOL_URL_ROOT.'/core/ajax/check_notifications.php'; ?>", {
type: "post", // Usually post or get
async: true,
data: { time_js_next_test: time_js_next_test },
data: { time_js_next_test: time_js_next_test, forcechecknow: 1, token: 'notrequired' },
dataType: "json",
success: function (result) {
var arr = JSON.parse(result);
if (arr.length > 0) {
console.log(result);
var arrayofpastreminders = Object.values(result.pastreminders);
console.log("arrayofpastreminders.length"+arrayofpastreminders.length);
if (arrayofpastreminders && arrayofpastreminders.length > 0) {
var audio = null;
<?php
if (!empty($conf->global->AGENDA_REMINDER_BROWSER_SOUND)) {
@ -85,48 +88,52 @@ if (!($_SERVER['HTTP_REFERER'] === $dolibarr_main_url_root.'/' || $_SERVER['HTTP
}
?>
var listofreminderids = '';
var noti = []
$.each(arr, function (index, value) {
$.each(arrayofpastreminders, function (index, value) {
console.log(value);
var url = "notdefined";
var title = "Not defined";
var body = value['type'] + ': ' + value['label'];
if (value['type'] == 'agenda' && value['location'] != null && value['location'] != '') {
body += '\n' + value['location'];
var body = value.label;
if (value.type == 'agenda' && value.location != null && value.location != '') {
body += '\n' + value.location;
}
if(value['type'] == 'agenda' && (value['event_date_start_formated'] != null || event_date_start_formated['event_date_start'] != '')) {
body += '\n' + value['event_date_start_formated'];
if (value.type == 'agenda' && (value.event_date_start_formated != null || value.event_date_start_formated['event_date_start'] != '')) {
body += '\n' + value.event_date_start_formated;
}
if (value['type'] == 'agenda')
if (value.type == 'agenda')
{
url = '<?php echo DOL_URL_ROOT.'/comm/action/card.php?id='; ?>' + value['id'];
title = '<?php print $langs->trans('Agenda') ?>';
url = '<?php echo DOL_URL_ROOT.'/comm/action/card.php?id='; ?>' + value.id_agenda;
title = '<?php print $langs->trans('EventReminder') ?>';
}
var extra = {
icon: '<?php print DOL_URL_ROOT.'/theme/common/bell.png'; ?>',
//image: '<?php print DOL_URL_ROOT.'/theme/common/bell.png'; ?>',
body: body,
tag: value['id']
tag: value.id_agenda,
requireInteraction: true
};
// We release the notify
console.log("Send notification on browser");
var noti = new Notification(title, extra);
noti[index] = new Notification(title, extra);
if (index==0 && audio)
{
audio.play();
}
if (noti) {
noti.onclick = function (event) {
if (noti[index]) {
noti[index].onclick = function (event) {
console.log("A click on notification on browser has been done");
event.preventDefault(); // prevent the browser from focusing the Notification's tab
window.focus();
window.open(url, '_blank');
noti.close();
noti[index].close();
};
listofreminderids = listofreminderids + '-' + value['id_reminder']
listofreminderids = (listofreminderids == '' ? '' : listofreminderids + ',') + value.id_reminder
}
});
@ -135,8 +142,10 @@ if (!($_SERVER['HTTP_REFERER'] === $dolibarr_main_url_root.'/' || $_SERVER['HTTP
$.ajax("<?php print DOL_URL_ROOT.'/core/ajax/check_notifications.php?action=stopreminder&listofreminderids='; ?>"+listofreminderids, {
type: "post", // Usually post or get
async: true,
data: { time_js_next_test: time_js_next_test }
});
data: { time_js_next_test: time_js_next_test, token: 'notrequired' }
});
} else {
console.log("No past reminder found, next try at "+time_js_next_test);
}
}
});

View File

@ -389,7 +389,6 @@ function GETPOST($paramname, $check = 'alphanohtml', $method = 0, $filter = null
if ($qualified)
{
//var_dump($user->default_values[$relativepathstring][$defkey]['createform']);
if (isset($user->default_values[$relativepathstring]['createform'][$defkey][$paramname]))
{
$out = $user->default_values[$relativepathstring]['createform'][$defkey][$paramname];
@ -6133,7 +6132,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
$birthday = dol_print_date($object->birth, 'day');
if (is_object($object) && $object->element == 'adherent' && $object->id > 0)
if (is_object($object) && ($object->element == 'adherent' || $object->element == 'member') && $object->id > 0)
{
$substitutionarray['__MEMBER_ID__'] = (isset($object->id) ? $object->id : '');
if (method_exists($object, 'getCivilityLabel')) $substitutionarray['__MEMBER_CIVILITY__'] = $object->getCivilityLabel();
@ -7735,7 +7734,7 @@ function dol_getmypid()
* If param $mode is 2, can contains a list of int id separated by comma like "1,3,4"
* If param $mode is 3, can contains a list of string separated by comma like "a,b,c"
* @param integer $mode 0=value is list of keyword strings, 1=value is a numeric test (Example ">5.5 <10"), 2=value is a list of ID separated with comma (Example '1,3,4')
* 3=value is list of string separated with comma (Example 'text 1,text 2'), 4=value is a list of ID separated with comma (Example '1,3,4') for search into a multiselect string ('1,2')
* 3=value is list of string separated with comma (Example 'text 1,text 2'), 4=value is a list of ID separated with comma (Example '2,7') to be used to search into a multiselect string '1,2,3,4'
* @param integer $nofirstand 1=Do not output the first 'AND'
* @return string $res The statement to append to the SQL query
*/
@ -7760,11 +7759,10 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0)
$res = '';
if (!is_array($fields)) $fields = array($fields);
$nboffields = count($fields);
$end2 = count($crits);
$j = 0;
foreach ($crits as $crit)
{
$crit = trim($crit);
$i = 0; $i2 = 0;
$newres = '';
foreach ($fields as $field)
@ -7772,10 +7770,10 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0)
if ($mode == 1)
{
$operator = '=';
$newcrit = preg_replace('/([<>=]+)/', '', trim($crit));
$newcrit = preg_replace('/([<>=]+)/', '', $crit);
$reg = array();
preg_match('/([<>=]+)/', trim($crit), $reg);
preg_match('/([<>=]+)/', $crit, $reg);
if ($reg[1])
{
$operator = $reg[1];
@ -7785,7 +7783,7 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0)
$numnewcrit = price2num($newcrit);
if (is_numeric($numnewcrit))
{
$newres .= ($i2 > 0 ? ' OR ' : '').$field.' '.$operator.' '.$numnewcrit;
$newres .= ($i2 > 0 ? ' OR ' : '').$field.' '.$operator.' '.$db->sanitize($numnewcrit); // should be a numeric
} else {
$newres .= ($i2 > 0 ? ' OR ' : '').'1 = 2'; // force false
}
@ -7793,41 +7791,45 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0)
}
} elseif ($mode == 2 || $mode == -2)
{
$newres .= ($i2 > 0 ? ' OR ' : '').$field." ".($mode == -2 ? 'NOT ' : '')."IN (".$db->escape(trim($crit)).")";
$crit = preg_replace('/[^0-9,]/', '', $crit); // ID are always integer
$newres .= ($i2 > 0 ? ' OR ' : '').$field." ".($mode == -2 ? 'NOT ' : '');
$newres .= $crit ? "IN (".$db->sanitize($db->escape($crit)).")" : "IN (0)";
if ($mode == -2) $newres .= ' OR '.$field.' IS NULL';
$i2++; // a criteria was added to string
} elseif ($mode == 3 || $mode == -3)
{
$tmparray = explode(',', trim($crit));
$tmparray = explode(',', $crit);
if (count($tmparray))
{
$listofcodes = '';
foreach ($tmparray as $val)
{
$val = trim($val);
if ($val)
{
$listofcodes .= ($listofcodes ? ',' : '');
$listofcodes .= "'".$db->escape(trim($val))."'";
$listofcodes .= "'".$db->escape($val)."'";
}
}
$newres .= ($i2 > 0 ? ' OR ' : '').$field." ".($mode == -3 ? 'NOT ' : '')."IN (".$listofcodes.")";
$newres .= ($i2 > 0 ? ' OR ' : '').$field." ".($mode == -3 ? 'NOT ' : '')."IN (".$db->sanitize($listofcodes).")";
$i2++; // a criteria was added to string
}
if ($mode == -3) $newres .= ' OR '.$field.' IS NULL';
} elseif ($mode == 4)
{
$tmparray = explode(',', trim($crit));
$tmparray = explode(',', $crit);
if (count($tmparray))
{
$listofcodes = '';
foreach ($tmparray as $val)
{
$val = trim($val);
if ($val)
{
$newres .= ($i2 > 0 ? ' OR (' : '(').$field.' LIKE \''.$db->escape(trim($val)).',%\'';
$newres .= ' OR '.$field.' = \''.$db->escape(trim($val)).'\'';
$newres .= ' OR '.$field.' LIKE \'%,'.$db->escape(trim($val)).'\'';
$newres .= ' OR '.$field.' LIKE \'%,'.$db->escape(trim($val)).',%\'';
$newres .= ($i2 > 0 ? ' OR (' : '(').$field.' LIKE \''.$db->escape($val).',%\'';
$newres .= ' OR '.$field.' = \''.$db->escape($val).'\'';
$newres .= ' OR '.$field.' LIKE \'%,'.$db->escape($val).'\'';
$newres .= ' OR '.$field.' LIKE \'%,'.$db->escape($val).',%\'';
$newres .= ')';
$i2++;
}

View File

@ -1182,6 +1182,7 @@ function check_value($mask, $value)
$hasglobalcounter = false;
// Extract value for mask counter, mask raz and mask offset
$reg = array();
if (preg_match('/\{(0+)([@\+][0-9]+)?([@\+][0-9]+)?\}/i', $mask, $reg))
{
$masktri = $reg[1].(isset($reg[2]) ? $reg[2] : '').(isset($reg[3]) ? $reg[3] : '');
@ -1192,12 +1193,12 @@ function check_value($mask, $value)
$masktri = '00000';
$maskcounter = '00000';
}
$maskraz = -1;
$maskoffset = 0;
if (dol_strlen($maskcounter) < 3) return 'ErrorCounterMustHaveMoreThan3Digits';
// Extract value for third party mask counter
$regClientRef = array();
if (preg_match('/\{(c+)(0*)\}/i', $mask, $regClientRef))
{
$maskrefclient = $regClientRef[1].$regClientRef[2];

View File

@ -245,9 +245,16 @@ function dol_json_decode($json, $assoc = false)
$out = _unval($out);
$array = array();
// Return an array
if ($out != '') eval('$array = '.$out.';');
else $array = array();
if ($out != '') {
try {
eval('$array = '.$out.';');
} catch (Exception $e) {
$array = array();
}
}
// Return an object
if (!$assoc)

View File

@ -431,6 +431,7 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
//TODO Add limit in nb of results
$sql .= $db->order($sortfield_new, $sortorder);
dol_syslog("company.lib::show_actions_done", LOG_DEBUG);
$resql = $db->query($sql);
if ($resql)
@ -529,6 +530,8 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
$out .= '<div class="filters-container" >';
$out .= '<form name="listactionsfilter" class="listactionsfilter" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
$out .= '<input type="hidden" name="token" value="'.newToken().'">';
if ($objcon && get_class($objcon) == 'Contact' &&
(is_null($filterobj) || get_class($filterobj) == 'Societe'))
{

View File

@ -389,8 +389,9 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4202__+MAX_llx_menu__, 'members', '', 4200__+MAX_llx_menu__, '/adherents/list.php', 'List', 1, 'members', '$user->rights->adherent->lire', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4203__+MAX_llx_menu__, 'members', '', 4202__+MAX_llx_menu__, '/adherents/list.php?mainmenu=members&amp;leftmenu=members&amp;statut=-1', 'MenuMembersToValidate', 2, 'members', '$user->rights->adherent->lire', '', 2, 2, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4204__+MAX_llx_menu__, 'members', '', 4202__+MAX_llx_menu__, '/adherents/list.php?mainmenu=members&amp;leftmenu=members&amp;statut=1', 'MenuMembersValidated', 2, 'members', '$user->rights->adherent->lire', '', 2, 3, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4205__+MAX_llx_menu__, 'members', '', 4202__+MAX_llx_menu__, '/adherents/list.php?mainmenu=members&amp;leftmenu=members&amp;statut=1&amp;filter=outofdate', 'MenuMembersNotUpToDate', 2, 'members', '$user->rights->adherent->lire', '', 2, 4, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4206__+MAX_llx_menu__, 'members', '', 4202__+MAX_llx_menu__, '/adherents/list.php?mainmenu=members&amp;leftmenu=members&amp;statut=1&amp;filter=uptodate', 'MenuMembersUpToDate', 2, 'members', '$user->rights->adherent->lire', '', 2, 5, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4205__+MAX_llx_menu__, 'members', '', 4204__+MAX_llx_menu__, '/adherents/list.php?mainmenu=members&amp;leftmenu=members&amp;statut=1&amp;filter=withoutsubscription', 'WithoutSubscription', 2, 'members', '$user->rights->adherent->lire', '', 2, 4, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4205__+MAX_llx_menu__, 'members', '', 4204__+MAX_llx_menu__, '/adherents/list.php?mainmenu=members&amp;leftmenu=members&amp;statut=1&amp;filter=outofdate', 'UpToDate', 2, 'members', '$user->rights->adherent->lire', '', 2, 4, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4206__+MAX_llx_menu__, 'members', '', 4204__+MAX_llx_menu__, '/adherents/list.php?mainmenu=members&amp;leftmenu=members&amp;statut=1&amp;filter=uptodate', 'OutOfDate', 2, 'members', '$user->rights->adherent->lire', '', 2, 5, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4207__+MAX_llx_menu__, 'members', '', 4202__+MAX_llx_menu__, '/adherents/list.php?mainmenu=members&amp;leftmenu=members&amp;statut=0', 'MenuMembersResiliated', 2, 'members', '$user->rights->adherent->lire', '', 2, 6, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4208__+MAX_llx_menu__, 'members', '', 4200__+MAX_llx_menu__, '/adherents/stats/geo.php?mainmenu=members&amp;leftmenu=members&amp;mode=memberbycountry', 'MenuMembersStats', 1, 'members', '$user->rights->adherent->lire', '', 2, 7, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '! empty($conf->global->MEMBER_LINK_TO_HTPASSWDFILE) && $conf->adherent->enabled', __HANDLER__, 'left', 4502__+MAX_llx_menu__, 'members', '', 4200__+MAX_llx_menu__, '/adherents/htpasswd.php?mainmenu=members&amp;leftmenu=export', 'Filehtpasswd', 1, 'members', '$user->rights->adherent->export', '', 2, 9, __ENTITY__);

View File

@ -1879,8 +1879,9 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
$newmenu->add("/adherents/list.php?leftmenu=members", $langs->trans("List"), 1, $user->rights->adherent->lire);
$newmenu->add("/adherents/list.php?leftmenu=members&amp;statut=-1", $langs->trans("MenuMembersToValidate"), 2, $user->rights->adherent->lire);
$newmenu->add("/adherents/list.php?leftmenu=members&amp;statut=1", $langs->trans("MenuMembersValidated"), 2, $user->rights->adherent->lire);
$newmenu->add("/adherents/list.php?leftmenu=members&amp;statut=1&amp;filter=uptodate", $langs->trans("MenuMembersUpToDate"), 2, $user->rights->adherent->lire);
$newmenu->add("/adherents/list.php?leftmenu=members&amp;statut=1&amp;filter=outofdate", $langs->trans("MenuMembersNotUpToDate"), 2, $user->rights->adherent->lire);
$newmenu->add("/adherents/list.php?leftmenu=members&amp;statut=1&amp;filter=withoutsubscription", $langs->trans("WithoutSubscription"), 3, $user->rights->adherent->lire);
$newmenu->add("/adherents/list.php?leftmenu=members&amp;statut=1&amp;filter=uptodate", $langs->trans("UpToDate"), 3, $user->rights->adherent->lire);
$newmenu->add("/adherents/list.php?leftmenu=members&amp;statut=1&amp;filter=outofdate", $langs->trans("OutOfDate"), 3, $user->rights->adherent->lire);
$newmenu->add("/adherents/list.php?leftmenu=members&amp;statut=0", $langs->trans("MenuMembersResiliated"), 2, $user->rights->adherent->lire);
$newmenu->add("/adherents/stats/index.php?leftmenu=members", $langs->trans("MenuMembersStats"), 1, $user->rights->adherent->lire);

View File

@ -329,7 +329,6 @@ class ExportCsv extends ModeleExports
global $conf;
$addquote = 0;
// Rule Dolibarr: No HTML
//print $charset.' '.$newvalue."\n";
//$newvalue=dol_string_nohtmltag($newvalue,0,$charset);

File diff suppressed because it is too large Load Diff

View File

@ -258,8 +258,8 @@ class modAccounting extends DolibarrModules
$this->export_label[$r] = 'Chartofaccounts';
$this->export_icon[$r] = 'accounting';
$this->export_permission[$r] = array(array("accounting", "chartofaccount"));
$this->export_fields_array[$r] = array('ac.rowid'=>'ChartofaccountsId', 'ac.pcg_version'=>'Chartofaccounts', 'aa.rowid'=>'Id', 'aa.account_number'=>"AccountAccounting", 'aa.label'=>"Label", 'aa.account_parent'=>"Accountparent", 'aa.pcg_type'=>"Pcgtype", 'aa.active'=>'Status');
$this->export_TypeFields_array[$r] = array('ac.rowid'=>'List:accounting_system:pcg_version', 'aa.account_number'=>"Text", 'aa.label'=>"Text", 'aa.account_parent'=>"Text", 'aa.pcg_type'=>'Text', 'aa.active'=>'Status');
$this->export_fields_array[$r] = array('ac.rowid'=>'ChartofaccountsId', 'ac.pcg_version'=>'Chartofaccounts', 'aa.rowid'=>'ID', 'aa.account_number'=>"AccountAccounting", 'aa.label'=>"Label", 'aa.account_parent'=>"Accountparent", 'aa.pcg_type'=>"Pcgtype", 'aa.active'=>'Status');
$this->export_TypeFields_array[$r] = array('ac.rowid'=>'List:accounting_system:pcg_version', 'ac.pcg_version'=>'Text', 'aa.rowid'=>'Numeric', 'aa.account_number'=>"Text", 'aa.label'=>"Text", 'aa.account_parent'=>"Text", 'aa.pcg_type'=>'Text', 'aa.active'=>'Status');
$this->export_entities_array[$r] = array('ac.rowid'=>"Accounting", 'ac.pcg_version'=>"Accounting", 'aa.rowid'=>'Accounting', 'aa.account_number'=>"Accounting", 'aa.label'=>"Accounting", 'aa.accountparent'=>"Accounting", 'aa.pcg_type'=>"Accounting", 'aa_active'=>"Accounting");
$this->export_sql_start[$r] = 'SELECT DISTINCT ';

View File

@ -71,7 +71,7 @@ class modBanque extends DolibarrModules
$this->depends = array();
$this->requiredby = array("modComptabilite", "modAccounting", "modPrelevement");
$this->conflictwith = array();
$this->langfiles = array("banks", "compta", "bills", "companies");
$this->langfiles = array("banks", "compta", "bills", "companies", "accounting");
// Constants
$this->const = array();
@ -202,6 +202,42 @@ class modBanque extends DolibarrModules
$this->export_sql_end[$r] .= ' AND p.fk_paiement = 7';
$this->export_sql_end[$r] .= ' AND ba.entity IN ('.getEntity('bank_account').')';
$this->export_sql_order[$r] = ' ORDER BY b.datev, b.num_releve';
// Various Payment
$r++;
$this->export_code[$r] = $this->rights_class.'_'.$r;
$this->export_label[$r] = 'VariousPayment';
$this->export_permission[$r] = array(array("banque", "export"));
$this->export_fields_array[$r] = array(
'v.rowid'=>'VariousPaymentId', 'v.label'=>'VariousPaymentLabel', 'v.datev'=>'DateValue', 'v.datep'=>'DateOperation',
'v.num_payment'=>'ChequeOrTransferNumber', 'v.amount'=>'Amount', 'v.sens'=>'Sens',
'cp.id'=>"PaymentMode",
'v.accountancy_code'=>'AccountAccounting', 'v.subledger_account'=>'SubledgerAccount',
'v.note'=>'Note', 'v.datec'=>'DateCreation',
'p.ref'=>'ProjectRef', 'p.title'=>'ProjectLabel'
);
$this->export_TypeFields_array[$r] = array(
'v.rowid'=>'Text', 'v.label'=>'Text', 'v.datep'=>'Date', 'v.datev'=>'Date',
'v.num_payment'=>'Text', 'v.amount'=>'Numeric', 'v.sens'=>'Numeric',
'cp.id'=>'List:c_paiement:code:id:code',
"v.accountancy_code"=>"Text", "v.subledger_account"=>"Text",
"v.note"=>"Text", 'v.datec'=>"Date",
"p.ref"=>"Text", "p.title"=>"Text"
);
$this->export_entities_array[$r] = array(
'v.rowid'=>'payment', 'v.label'=>'payment', 'v.datev'=>'payment', 'v.datep'=>'payment',
'v.num_payment'=>'payment', 'v.amount'=>'payment', 'v.sens'=>'payment',
'cp.id'=>'payment',
'v.accountancy_code'=>'payment', 'v.subledger_account'=>"payment",
'v.note'=>"payment", 'v.datec'=>"payment",
"p.ref"=>"project", "p.title"=>"project"
);
$this->export_sql_start[$r] = 'SELECT ';
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'payment_various as v';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX."projet as p ON v.fk_projet = p.rowid";
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX."c_paiement as cp ON v.fk_typepayment = cp.id";
$this->export_sql_end[$r] .= ' WHERE v.entity IN ('.getEntity('payment_various').')';
$this->export_sql_order[$r] = ' ORDER BY v.datep';
}

View File

@ -1672,8 +1672,10 @@ class EmailCollector extends CommonObject
$description = dol_concatdesc($description, $messagetext);
$descriptionfull = $description;
$descriptionfull = dol_concatdesc($descriptionfull, "----- Header");
$descriptionfull = dol_concatdesc($descriptionfull, $header);
if (empty($conf->global->MAIN_EMAILCOLLECTOR_MAIL_WITHOUT_HEADER)) {
$descriptionfull = dol_concatdesc($descriptionfull, "----- Header");
$descriptionfull = dol_concatdesc($descriptionfull, $header);
}
// Insert record of emails sent
$actioncomm->type_code = 'AC_OTH_AUTO'; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
@ -1760,8 +1762,10 @@ class EmailCollector extends CommonObject
$description = dol_concatdesc($description, $messagetext);
$descriptionfull = $description;
$descriptionfull = dol_concatdesc($descriptionfull, "----- Header");
$descriptionfull = dol_concatdesc($descriptionfull, $header);
if (empty($conf->global->MAIN_EMAILCOLLECTOR_MAIL_WITHOUT_HEADER)) {
$descriptionfull = dol_concatdesc($descriptionfull, "----- Header");
$descriptionfull = dol_concatdesc($descriptionfull, $header);
}
$id_opp_status = dol_getIdFromCode($this->db, 'PROSP', 'c_lead_status', 'code', 'rowid');
$percent_opp_status = dol_getIdFromCode($this->db, 'PROSP', 'c_lead_status', 'code', 'percent');
@ -1874,8 +1878,10 @@ class EmailCollector extends CommonObject
$description = dol_concatdesc($description, $messagetext);
$descriptionfull = $description;
$descriptionfull = dol_concatdesc($descriptionfull, "----- Header");
$descriptionfull = dol_concatdesc($descriptionfull, $header);
if (empty($conf->global->MAIN_EMAILCOLLECTOR_MAIL_WITHOUT_HEADER)) {
$descriptionfull = dol_concatdesc($descriptionfull, "----- Header");
$descriptionfull = dol_concatdesc($descriptionfull, $header);
}
$tickettocreate->subject = $subject;
$tickettocreate->message = $description;

View File

@ -539,6 +539,7 @@ class Export
if (empty($this->array_export_fields) || !is_array($this->array_export_fields))
{
$this->error = "ErrorBadParameter";
dol_syslog($this->error, LOG_ERR);
return -1;
}

View File

@ -173,7 +173,7 @@ if (empty($reshook))
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
exit;
} else {
$mesg = '<div class="error">'.$object->error.'</div>';
$mesg = $object->error;
}
} elseif ($action == 'confirm_modify' && $confirm == 'yes' && $user->rights->ficheinter->creer)
{
@ -198,7 +198,7 @@ if (empty($reshook))
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
exit;
} else {
$mesg = '<div class="error">'.$object->error.'</div>';
$mesg = $object->error;
}
} elseif ($action == 'add' && $user->rights->ficheinter->creer)
{
@ -372,11 +372,11 @@ if (empty($reshook))
}
}
} else {
$mesg = $srcobject->error;
$mesg = $srcobject->error;
$error++;
}
} else {
$mesg = $object->error;
$mesg = $object->error;
$error++;
}
} else {
@ -406,7 +406,7 @@ if (empty($reshook))
}
}
} else {
$mesg = '<div class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ThirdParty")).'</div>';
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ThirdParty"));
$action = 'create';
}
} elseif ($action == 'update' && $user->rights->ficheinter->creer)
@ -456,17 +456,17 @@ if (empty($reshook))
{
if (!GETPOST('np_desc', 'restricthtml') && empty($conf->global->FICHINTER_EMPTY_LINE_DESC))
{
$mesg = '<div class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Description")).'</div>';
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Description"));
$error++;
}
if (empty($conf->global->FICHINTER_WITHOUT_DURATION) && !GETPOST('durationhour', 'int') && !GETPOST('durationmin', 'int'))
{
$mesg = '<div class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Duration")).'</div>';
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Duration"));
$error++;
}
if (empty($conf->global->FICHINTER_WITHOUT_DURATION) && GETPOST('durationhour', 'int') >= 24 && GETPOST('durationmin', 'int') > 0)
{
$mesg = '<div class="error">'.$langs->trans("ErrorValueTooHigh").'</div>';
$mesg = $langs->trans("ErrorValueTooHigh");
$error++;
}
if (!$error)
@ -538,7 +538,7 @@ if (empty($reshook))
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
exit;
} else {
$mesg = '<div class="error">'.$object->error.'</div>';
$mesg = $object->error;
}
}
@ -555,6 +555,20 @@ if (empty($reshook))
}
}
// Reopen
elseif ($action == 'confirm_reopen' && $user->rights->ficheinter->creer)
{
$result = $object->setStatut(Fichinter::STATUS_VALIDATED);
if ($result > 0)
{
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
exit;
}
else {
$mesg = $object->error;
}
}
/*
* Mise a jour d'une ligne d'intervention
*/
@ -735,9 +749,9 @@ if (empty($reshook))
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
{
$langs->load("errors");
$mesg = '<div class="error">'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'</div>';
$mesg = $langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType");
} else {
$mesg = '<div class="error">'.$object->error.'</div>';
$mesg = $object->error;
}
}
}
@ -784,7 +798,11 @@ if ($action == 'create')
print load_fiche_titre($langs->trans("AddIntervention"), '', 'intervention');
dol_htmloutput_mesg($mesg);
if ($error > 0) {
dol_htmloutput_errors($mesg);
} else {
dol_htmloutput_mesg($mesg);
}
if ($socid) $res = $soc->fetch($socid);
@ -1058,7 +1076,11 @@ if ($action == 'create')
$soc = new Societe($db);
$soc->fetch($object->socid);
dol_htmloutput_mesg($mesg);
if ($error > 0) {
dol_htmloutput_errors($mesg);
} else {
dol_htmloutput_mesg($mesg);
}
$head = fichinter_prepare_head($object);
@ -1099,6 +1121,12 @@ if ($action == 'create')
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ModifyIntervention'), $langs->trans('ConfirmModifyIntervention'), 'confirm_modify', '', 0, 1);
}
// Confirm back to open
if ($action == 'reopen')
{
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('Reopen'), $langs->trans('ConfirmReopenIntervention', $object->ref), 'confirm_reopen', '', 0, 1);
}
// Confirm deletion of line
if ($action == 'ask_deleteline')
{
@ -1331,8 +1359,13 @@ if ($action == 'create')
{
print '<br>';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
// No.
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
print '<td width="5" class="center linecolnum"></td>';
}
print '<td class="liste_titre">'.$langs->trans('Description').'</td>';
print '<td class="liste_titre center">'.$langs->trans('Date').'</td>';
print '<td class="liste_titre right">'.(empty($conf->global->FICHINTER_WITHOUT_DURATION) ? $langs->trans('Duration') : '').'</td>';
@ -1344,11 +1377,16 @@ if ($action == 'create')
{
$objp = $db->fetch_object($resql);
// Ligne en mode visu
if ($action != 'editline' || GETPOST('line_id', 'int') != $objp->rowid)
{
print '<tr class="oddeven">';
// No.
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
print '<td class="center linecolnum">'.($i + 1).'</td>';
}
print '<td>';
print '<a name="'.$objp->rowid.'"></a>'; // ancre pour retourner sur la ligne
print dol_htmlentitiesbr($objp->description);
@ -1409,6 +1447,12 @@ if ($action == 'create')
if ($object->statut == 0 && $action == 'editline' && $user->rights->ficheinter->creer && GETPOST('line_id', 'int') == $objp->rowid)
{
print '<tr class="oddeven nohover">';
// No.
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
print '<td class="center linecolnum">'.($i + 1).'</td>';
}
print '<td>';
print '<a name="'.$objp->rowid.'"></a>'; // ancre pour retourner sur la ligne
@ -1461,9 +1505,15 @@ if ($action == 'create')
{
if (!$num)
{
print '<br><table class="noborder centpercent">';
print '<br>';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
// No.
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
print '<td width="5" class="center linecolnum"></td>';
}
print '<tr class="liste_titre">';
print '<td>';
print '<a name="add"></a>'; // ancre
print $langs->trans('Description').'</td>';
@ -1474,6 +1524,12 @@ if ($action == 'create')
}
print '<tr class="oddeven nohover">'."\n";
// No.
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
print '<td class="center linecolnum">'.($i + 1).'</td>';
}
print '<td>';
// editeur wysiwyg
if (empty($conf->global->FICHINTER_EMPTY_LINE_DESC)) {
@ -1568,6 +1624,15 @@ if ($action == 'create')
print '</a></div>';
}
// Reopen
if ($object->statut > Fichinter::STATUS_CLOSED)
{
if ($user->rights->ficheinter->creer)
{
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reopen">'.$langs->trans('Reopen').'</a></div>';
} else print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans('Reopen').'</a></div>';
}
// Send
if (empty($user->socid)) {
if ($object->statut > Fichinter::STATUS_DRAFT)

View File

@ -166,11 +166,11 @@ $arrayfields = array(
'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0),
'typent.code'=>array('label'=>$langs->trans("ThirdPartyType"), 'checked'=>$checkedtypetiers),
'f.fk_mode_reglement'=>array('label'=>$langs->trans("PaymentMode"), 'checked'=>1),
'f.total_ht'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1),
'f.total_vat'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>0),
'f.total_localtax1'=>array('label'=>$langs->transcountry("AmountLT1", $mysoc->country_code), 'checked'=>0, 'enabled'=>$mysoc->localtax1_assuj == "1"),
'f.total_localtax2'=>array('label'=>$langs->transcountry("AmountLT2", $mysoc->country_code), 'checked'=>0, 'enabled'=>$mysoc->localtax2_assuj == "1"),
'f.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>0),
'f.total_ht'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1, 'position'=>105),
'f.total_vat'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>0, 'position'=>110),
'f.total_localtax1'=>array('label'=>$langs->transcountry("AmountLT1", $mysoc->country_code), 'checked'=>0, 'enabled'=>$mysoc->localtax1_assuj == "1", 'position'=>95),
'f.total_localtax2'=>array('label'=>$langs->transcountry("AmountLT2", $mysoc->country_code), 'checked'=>0, 'enabled'=>$mysoc->localtax2_assuj == "1", 'position'=>100),
'f.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>0, 'position'=>115),
'u.login'=>array('label'=>"Author", 'checked'=>1),
'dynamount_payed'=>array('label'=>$langs->trans("Payed"), 'checked'=>0),
'rtp'=>array('label'=>$langs->trans("Rest"), 'checked'=>0),

View File

@ -32,14 +32,6 @@ if (!$user->admin)
$error = 0;
// List of statut
static $tmpstatus2label = array(
'0'=>'OpenEtablishment',
'1'=>'CloseEtablishment'
);
$status2label = array('');
foreach ($tmpstatus2label as $key => $val) $status2label[$key] = $langs->trans($val);
/*
* Actions

View File

@ -58,9 +58,11 @@ if ($action == 'update') {
}
}
/*
* View
*/
llxHeader('', $langs->trans('Parameters'));
$form = new Form($db);

View File

@ -148,10 +148,9 @@ class Establishment extends CommonObject
$now = dol_now();
// Clean parameters
$this->address = ($this->address > 0 ? $this->address : $this->address);
$this->zip = ($this->zip > 0 ? $this->zip : $this->zip);
$this->town = ($this->town > 0 ? $this->town : $this->town);
$this->country_id = ($this->country_id > 0 ? $this->country_id : $this->country_id);
$this->address = trim($this->address);
$this->zip = trim($this->zip);
$this->town = trim($this->town);
if (empty($this->ref)) $this->ref = '(PROV)';

View File

@ -77,8 +77,8 @@ $importmodelid = GETPOST('importmodelid');
$excludefirstline = (GETPOST('excludefirstline') ? GETPOST('excludefirstline') : 1);
$endatlinenb = (GETPOST('endatlinenb') ? GETPOST('endatlinenb') : '');
$updatekeys = (GETPOST('updatekeys', 'array') ? GETPOST('updatekeys', 'array') : array());
$separator = (GETPOST('separator') ? GETPOST('separator') : (!empty($conf->global->IMPORT_CSV_SEPARATOR_TO_USE) ? $conf->global->IMPORT_CSV_SEPARATOR_TO_USE : ','));
$enclosure = (GETPOST('enclosure') ? GETPOST('enclosure') : '"');
$separator = (GETPOST('separator', 'nohtml') ? GETPOST('separator', 'nohtml') : (!empty($conf->global->IMPORT_CSV_SEPARATOR_TO_USE) ? $conf->global->IMPORT_CSV_SEPARATOR_TO_USE : ','));
$enclosure = (GETPOST('enclosure', 'nohtml') ? GETPOST('enclosure', 'nohtml') : '"');
$objimport = new Import($db);
$objimport->load_arrays($user, ($step == 1 ? '' : $datatoimport));

View File

@ -28,7 +28,7 @@
-- Note: fields with type BLOB/TEXT can't have default value.
-- Missing in v12
-- Missing in v12 or lower
ALTER TABLE llx_prelevement_bons ADD COLUMN type varchar(16) DEFAULT 'debit-order';

View File

@ -18,7 +18,7 @@ DefaultForService=Default for service
DefaultForProduct=Default for product
CantSuggest=Can't suggest
AccountancySetupDoneFromAccountancyMenu=Most setup of the accountancy is done from the menu %s
ConfigAccountingExpert=Configuration of the module accounting expert
ConfigAccountingExpert=Configuration of the module accounting (double entry)
Journalization=Journalization
Journaux=Journals
JournalFinancial=Financial journals

View File

@ -896,7 +896,7 @@ Permission1185=Approve purchase orders
Permission1186=Order purchase orders
Permission1187=Acknowledge receipt of purchase orders
Permission1188=Delete purchase orders
Permission1189=Check/Uncheck a supplier order reception
Permission1189=Check/Uncheck a purchase order reception
Permission1190=Approve (second approval) purchase orders
Permission1191=Export supplier orders and their attributes
Permission1201=Get result of an export

View File

@ -166,6 +166,8 @@ VariousPayment=Miscellaneous payment
VariousPayments=Miscellaneous payments
ShowVariousPayment=Show miscellaneous payment
AddVariousPayment=Add miscellaneous payment
VariousPaymentId=Miscellaneous payment ID
VariousPaymentLabel=Miscellaneous payment label
SEPAMandate=SEPA mandate
YourSEPAMandate=Your SEPA mandate
FindYourSEPAMandate=This is your SEPA mandate to authorize our company to make direct debit order to your bank. Return it signed (scan of the signed document) or send it by mail to

View File

@ -64,3 +64,5 @@ InterLineDuration=Line duration intervention
InterLineDesc=Line description intervention
RepeatableIntervention=Template of intervention
ToCreateAPredefinedIntervention=To create a predefined or recurring intervention, create a common intervention and convert it into intervention template
Reopen=Reopen
ConfirmReopenIntervention=Are you sure you want to open back the intervention <b>%s</b>?

View File

@ -126,7 +126,7 @@ NoEmailSentBadSenderOrRecipientEmail=No email sent. Bad sender or recipient emai
# Module Notifications
Notifications=Notifications
NotificationsAuto=Notifications Auto.
NoNotificationsWillBeSent=No automtic email notifications are planned for this event type and company
NoNotificationsWillBeSent=No automatic email notifications are planned for this event type and company
ANotificationsWillBeSent=1 automatic notification will be sent by email
SomeNotificationsWillBeSent=%s automatic notifications will be sent by email
AddNewNotification=Activate a new automatic email notification target/event

View File

@ -1092,4 +1092,6 @@ APPROVEDInDolibarr=Record %s approved
DefaultMailModel=Default Mail Model
PublicVendorName=Public name of vendor
DateOfBirth=Date of birth
SecurityTokenHasExpiredSoActionHasBeenCanceledPleaseRetry=Security token has expired, so action has been canceled. Please try again.
SecurityTokenHasExpiredSoActionHasBeenCanceledPleaseRetry=Security token has expired, so action has been canceled. Please try again.
UpToDate=Up-to-date
OutOfDate=Out-of-date

View File

@ -19,14 +19,12 @@ MembersCards=Members business cards
MembersList=List of members
MembersListToValid=List of draft members (to be validated)
MembersListValid=List of valid members
MembersListUpToDate=List of valid members with up to date subscription
MembersListNotUpToDate=List of valid members with subscription out of date
MembersListUpToDate=List of valid members with up-to-date subscription
MembersListNotUpToDate=List of valid members with out-of-date subscription
MembersListResiliated=List of terminated members
MembersListQualified=List of qualified members
MenuMembersToValidate=Draft members
MenuMembersValidated=Validated members
MenuMembersUpToDate=Up to date members
MenuMembersNotUpToDate=Out of date members
MenuMembersResiliated=Terminated members
MembersWithSubscriptionToReceive=Members with subscription to receive
MembersWithSubscriptionToReceiveShort=Subscription to receive
@ -34,6 +32,7 @@ DateSubscription=Subscription date
DateEndSubscription=Subscription end date
EndSubscription=End subscription
SubscriptionId=Subscription id
WithoutSubscription=Without subscription
MemberId=Member id
NewMember=New member
MemberType=Member type

View File

@ -65,6 +65,7 @@ ValidateOrderFirstBeforeShipment=You must first validate the order before being
# Sending methods
# ModelDocument
DocumentModelTyphon=More complete document model for delivery receipts (logo...)
DocumentModelStorm=More complete document model for delivery receipts and extrafields compatibility (logo...)
Error_EXPEDITION_ADDON_NUMBER_NotDefined=Constant EXPEDITION_ADDON_NUMBER not defined
SumOfProductVolumes=Sum of product volumes
SumOfProductWeights=Sum of product weights

View File

@ -75,6 +75,7 @@ function testSqlAndScriptInject($val, $type)
$inj += preg_match('/into\s+(outfile|dumpfile)/i', $val);
$inj += preg_match('/user\s*\(/i', $val); // avoid to use function user() that return current database login
$inj += preg_match('/information_schema/i', $val); // avoid to use request that read information_schema database
$inj += preg_match('/<svg/i', $val); // <svg can be allowed in POST
}
if ($type == 3)
{
@ -117,7 +118,10 @@ function testSqlAndScriptInject($val, $type)
$inj += preg_match('/javascript\s*:/i', $val);
$inj += preg_match('/vbscript\s*:/i', $val);
// For XSS Injection done by adding javascript closing html tags like with onmousemove, etc... (closing a src or href tag with not cleaned param)
if ($type == 1) $inj += preg_match('/"/i', $val); // We refused " in GET parameters value
if ($type == 1) {
$val = str_replace('enclosure="', 'enclosure=X', $val); // We accept enclosure="
$inj += preg_match('/"/i', $val); // We refused " in GET parameters value.
}
if ($type == 2) $inj += preg_match('/[;"]/', $val); // PHP_SELF is a file system path. It can contains spaces.
return $inj;
}
@ -174,7 +178,10 @@ if (!empty($_SERVER["PHP_SELF"]))
// Sanity check on GET parameters
if (!defined('NOSCANGETFORINJECTION') && !empty($_SERVER["QUERY_STRING"]))
{
$morevaltochecklikeget = array($_SERVER["QUERY_STRING"]);
// Note: QUERY_STRING is url encoded, but $_GET and $_POST are already decoded
// Because the analyseVarsForSqlAndScriptsInjection is designed for already url decoded value, we must decode QUERY_STRING
// Another solution is to provide $_GET as parameter
$morevaltochecklikeget = array(urldecode($_SERVER["QUERY_STRING"]));
analyseVarsForSqlAndScriptsInjection($morevaltochecklikeget, 1);
}
// Sanity check on POST
@ -366,11 +373,11 @@ if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && !empty($conf->gl
|| defined('CSRFCHECK_WITH_TOKEN')) // Check validity of token, only if option MAIN_SECURITY_CSRF_WITH_TOKEN enabled or if constant CSRFCHECK_WITH_TOKEN is set
{
// Check all cases that need a token (all POST actions, all actions and mass actions on pages with CSRFCHECK_WITH_TOKEN set, all sensitive GET actions)
if ($_SERVER['REQUEST_METHOD'] == 'POST' || ((GETPOSTISSET('action') || GETPOSTISSET('massaction')) && defined('CSRFCHECK_WITH_TOKEN')) || in_array(GETPOST('action', 'aZ09'), array('add', 'update', 'install', 'delete')))
if ($_SERVER['REQUEST_METHOD'] == 'POST' || ((GETPOSTISSET('action') || GETPOSTISSET('massaction')) && defined('CSRFCHECK_WITH_TOKEN')) || in_array(GETPOST('action', 'aZ09'), array('add', 'addtimespent', 'update', 'install', 'delete', 'deleteprof')))
{
if (!GETPOSTISSET('token')) {
dol_syslog("--- Access to ".$_SERVER["PHP_SELF"]." refused by CSRFCHECK_WITH_TOKEN protection. Token not provided.");
print "Access by POST method (or to a page with CSRFCHECK_WITH_TOKEN on) is refused by CSRF protection in main.inc.php. Token not provided.\n";
print "Access to this page this way (POST method or page with CSRFCHECK_WITH_TOKEN on or having a sensible value for action parameter) is refused by CSRF protection in main.inc.php. Token not provided.\n";
print "If you access your server behind a proxy using url rewriting, you might check that all HTTP header is propagated (or add the line \$dolibarr_nocsrfcheck=1 into your conf.php file or MAIN_SECURITY_CSRF_WITH_TOKEN to 0 into setup).\n";
die;
}

View File

@ -134,7 +134,8 @@ foreach ($object->fields as $key => $val)
'label'=>$val['label'],
'checked'=>(($visible < 0) ? 0 : 1),
'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)),
'position'=>$val['position']
'position'=>$val['position'],
'help'=>$val['help']
);
}
}
@ -149,7 +150,8 @@ if (is_array($extrafields->attributes[$object->table_element]['label']) && count
'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1),
'position'=>$extrafields->attributes[$object->table_element]['pos'][$key],
'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]),
'langfile'=>$extrafields->attributes[$object->table_element]['langfile'][$key]
'langfile'=>$extrafields->attributes[$object->table_element]['langfile'][$key],
'help'=>$extrafields->attributes[$object->table_element]['help'][$key]
);
}
}

View File

@ -883,10 +883,8 @@ SCRIPT;
foreach ($extralabels as $key => $value) {
// Show field if not hidden
if (!empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && $extrafields->attributes["product_fournisseur_price"]['list'][$key] != 3) {
if (!empty($extrafields->attributes["product_fournisseur_price"]['langfile'][$key])) $langs->load($extrafields->attributes["product_fournisseur_price"]['langfile'][$key]);
if (!empty($extrafields->attributes["product_fournisseur_price"]['help'][$key])) $extratitle = $form->textwithpicto($langs->trans($value), $langs->trans($extrafields->attributes["product_fournisseur_price"]['help'][$key]));
else $extratitle = $langs->trans($value);
$arrayfields['ef.'.$key] = array('label'=>$extratitle, 'checked'=>0, 'position'=>(end($arrayfields)['position']+1));
$extratitle = $langs->trans($value);
$arrayfields['ef.'.$key] = array('label'=>$extratitle, 'checked'=>0, 'position'=>(end($arrayfields)['position']+1), 'langfile'=>$extrafields->attributes["product_fournisseur_price"]['langfile'][$key], 'help'=>$extrafields->attributes["product_fournisseur_price"]['help'][$key]);
}
}
}

View File

@ -86,9 +86,9 @@ if ($resql)
print '<tr class="oddeven">';
if ($objp->public)
{
print "<td>".dolGetFirstLastname($objp->firstname, $objp->lastname)." ".$objp->societe."</td>\n";
print "<td>".dolGetFirstLastname($objp->firstname, $objp->lastname)." ".dol_escape_htmltag($objp->societe)."</td>\n";
} else {
print "<td>Anonyme Anonyme</td>\n";
print "<td>".$langs->trans("Anonymous")."</td>\n";
}
print "<td>".dol_print_date($db->jdate($objp->datedon))."</td>\n";
print '<td class="right">'.number_format($objp->amount, 2, '.', ' ').' '.$langs->trans("Currency".$conf->currency).'</td>';
@ -97,7 +97,7 @@ if ($resql)
}
print "</table>";
} else {
print "Aucun don publique";
print $langs->trans("Donation");
}
} else {
dol_print_error($db);

View File

@ -24,3 +24,4 @@
require '../../master.inc.php';
header("Location: ".DOL_URL_ROOT.'/public/error-404.php');
exit;

View File

@ -194,6 +194,7 @@ $text = '';
if (!empty($conf->global->ONLINE_SIGN_NEWFORM_TEXT))
{
$langs->load("members");
$reg = array();
if (preg_match('/^\((.*)\)$/', $conf->global->ONLINE_SIGN_NEWFORM_TEXT, $reg)) $text .= $langs->trans($reg[1])."<br>\n";
else $text .= $conf->global->ONLINE_SIGN_NEWFORM_TEXT."<br>\n";
$text = '<tr><td align="center"><br>'.$text.'<br></td></tr>'."\n";
@ -256,9 +257,9 @@ if ($source == 'proposal')
if (!$found && !$mesg) $mesg = $langs->trans("ErrorBadParameters");
if (!$found && !$mesg) $mesg = $langs->transonentitiesnoconv("ErrorBadParameters");
if ($mesg) print '<tr><td align="center" colspan="2"><br><div class="warning">'.$mesg.'</div></td></tr>'."\n";
if ($mesg) print '<tr><td align="center" colspan="2"><br><div class="warning">'.dol_escape_htmltag($mesg).'</div></td></tr>'."\n";
print '</table>'."\n";
print "\n";

View File

@ -1629,7 +1629,7 @@ if ($source == 'donation')
if (!$found && !$mesg) $mesg = $langs->trans("ErrorBadParameters");
if ($mesg) print '<tr><td align="center" colspan="2"><br><div class="warning">'.$mesg.'</div></td></tr>'."\n";
if ($mesg) print '<tr><td align="center" colspan="2"><br><div class="warning">'.dol_escape_htmltag($mesg).'</div></td></tr>'."\n";
print '</table>'."\n";
print "\n";
@ -1655,7 +1655,7 @@ if ($action != 'dopayment')
{
$langs->load("members");
print '<br><span class="amountpaymentcomplete">'.$langs->trans("MembershipPaid", dol_print_date($object->datefin, 'day')).'</span><br>';
print '<span class="opacitymedium">'.$langs->trans("PaymentWillBeRecordedForNextPeriod").'</span><br>';
print '<div class="opacitymedium margintoponly">'.$langs->trans("PaymentWillBeRecordedForNextPeriod").'</div>';
}
// Buttons for all payments registration methods

View File

@ -241,14 +241,13 @@ print '<div with="100%" id="tablepublicpayment">';
print '<div class="opacitymedium">'.$langs->trans("ThisIsInformationOnJobPosition").' :</div>'."\n";
$error = 0;
$var = false;
$found = true;
print '<br>';
// Label
print $langs->trans("Label").' : ';
print '<b>'.$object->label.'</b><br>';
print '<b>'.dol_escape_htmltag($object->label).'</b><br>';
// Date
print $langs->trans("DateExpected").' : ';
@ -263,7 +262,7 @@ print '</b><br>';
// Remuneration
print $langs->trans("Remuneration").' : ';
print '<b>';
print $object->remuneration_suggested;
print dol_escape_htmltag($object->remuneration_suggested);
print '</b><br>';
// Contact

View File

@ -162,6 +162,7 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a
$url = 'view.php?action=view_ticket&track_id='.GETPOST('track_id', 'alpha');
header("Location: ".$url);
exit;
} else {
$action = '';
setEventMessages($object->error, $object->errors, 'errors');
@ -238,17 +239,17 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a
// Ref
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>';
print $object->dao->ref;
print dol_escape_htmltag($object->dao->ref);
print '</td></tr>';
// Tracking ID
print '<tr><td>'.$langs->trans("TicketTrackId").'</td><td>';
print $object->dao->track_id;
print dol_escape_htmltag($object->dao->track_id);
print '</td></tr>';
// Subject
print '<tr><td>'.$langs->trans("Subject").'</td><td>';
print $object->dao->subject;
print dol_escape_htmltag($object->dao->subject);
print '</td></tr>';
// Statut
@ -258,17 +259,17 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a
// Type
print '<tr><td>'.$langs->trans("Type").'</td><td>';
print $object->dao->type_label;
print dol_escape_htmltag($object->dao->type_label);
print '</td></tr>';
// Category
print '<tr><td>'.$langs->trans("Category").'</td><td>';
print $object->dao->category_label;
print dol_escape_htmltag($object->dao->category_label);
print '</td></tr>';
// Severity
print '<tr><td>'.$langs->trans("Severity").'</td><td>';
print $object->dao->severity_label;
print dol_escape_htmltag($object->dao->severity_label);
print '</td></tr>';
// Creation date
@ -314,7 +315,7 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a
// Progression
print '<tr><td>'.$langs->trans("Progression").'</td><td>';
print ($object->dao->progress > 0 ? $object->dao->progress : '0').'%';
print ($object->dao->progress > 0 ? dol_escape_htmltag($object->dao->progress) : '0').'%';
print '</td></tr>';
print '</table>';

View File

@ -139,19 +139,11 @@ if ($socid > 0)
$permok = $user->rights->agenda->myactions->create;
if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok)
{
//$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
if (get_class($objthirdparty) == 'Societe') $out .= '&amp;socid='.$objthirdparty->id;
$out .= (!empty($objcon->id) ? '&amp;contactid='.$objcon->id : '').'&amp;backtopage=1&amp;percentage=-1';
//$out.=$langs->trans("AddAnAction").' ';
//$out.=img_picto($langs->trans("AddAnAction"),'filenew');
//$out.="</a>";
if (is_object($objthirdparty) && get_class($objthirdparty) == 'Societe') $out .= '&amp;originid='.$objthirdparty->id.($objthirdparty->id > 0 ? '&amp;socid='.$objthirdparty->id : '').'&amp;backtopage='.urlencode($_SERVER['PHP_SELF'].($objthirdparty->id > 0 ? '?socid='.$objthirdparty->id : ''));
$out .= (!empty($objcon->id) ? '&amp;contactid='.$objcon->id : '').'&amp;percentage=-1';
$out .= '&amp;datep='.dol_print_date(dol_now(), 'dayhourlog');
}
//print '<div class="tabsAction">';
//print '</div>';
$newcardbutton = '';
if (!empty($conf->agenda->enabled))
{

View File

@ -1302,7 +1302,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
// Country
print '<tr><td>'.$form->editfieldkey('Country', 'selectcountry_id', '', $object, 0).'</td><td colspan="3" class="maxwidthonsmartphone">';
print img_picto('', 'globe-americas', 'class="paddingrightonly"');
print $form->select_country((GETPOST('country_id') != '' ? GETPOST('country_id') : $object->country_id), 'country_id', '', 0, 'minwidth300 widthcentpercentminusx');
print $form->select_country((GETPOSTISSET('country_id') ? GETPOST('country_id') : $object->country_id), 'country_id', '', 0, 'minwidth300 widthcentpercentminusx');
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
print '</td></tr>';
@ -1456,13 +1456,13 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
// Capital
print '<tr><td>'.$form->editfieldkey('Capital', 'capital', '', $object, 0).'</td>';
print '<td colspan="3"><input type="text" name="capital" id="capital" size="10" value="'.$object->capital.'"> ';
print '<td colspan="3"><input type="text" name="capital" id="capital" class="maxwidth100" value="'.$object->capital.'"> ';
print '<span class="hideonsmartphone">'.$langs->trans("Currency".$conf->currency).'</span></td></tr>';
if (!empty($conf->global->MAIN_MULTILANGS))
{
print '<tr><td>'.$form->editfieldkey('DefaultLang', 'default_lang', '', $object, 0).'</td><td colspan="3" class="maxwidthonsmartphone">'."\n";
print $formadmin->select_language(GETPOST('default_lang', 'alpha') ?GETPOST('default_lang', 'alpha') : ($object->default_lang ? $object->default_lang : ''), 'default_lang', 0, 0, 1, 0, 0, 'maxwidth200onsmartphone');
print $formadmin->select_language(GETPOST('default_lang', 'alpha') ? GETPOST('default_lang', 'alpha') : ($object->default_lang ? $object->default_lang : ''), 'default_lang', 0, 0, 1, 0, 0, 'maxwidth200onsmartphone');
print '</td>';
print '</tr>';
}

View File

@ -777,7 +777,7 @@ class Societe extends CommonObject
* $this->code_client = -1 and $this->code_fournisseur = -1 means automatic assignement.
*
* @param User $user Object of user that ask creation
* @return int >= 0 if OK, < 0 if KO
* @return int >=0 if OK, <0 if KO
*/
public function create(User $user)
{
@ -969,7 +969,10 @@ class Societe extends CommonObject
} elseif ($rescode == -4)
{
$this->errors[] = 'ErrorPrefixRequired';
} else {
$this->errors[] = 'ErrorUnknownOnCustomerCodeCheck';
}
$result = -3;
}
}
@ -988,9 +991,11 @@ class Societe extends CommonObject
} elseif ($rescode == -3)
{
$this->errors[] = 'ErrorSupplierCodeAlreadyUsed';
} elseif ($rescode == -5)
} elseif ($rescode == -4)
{
$this->errors[] = 'ErrorPrefixRequired';
} else {
$this->errors[] = 'ErrorUnknownOnSupplierCodeCheck';
}
$result = -3;
}
@ -2989,6 +2994,10 @@ class Societe extends CommonObject
dol_syslog(get_class($this)."::check_codeclient code_client=".$this->code_client." module=".$module);
$result = $mod->verif($this->db, $this->code_client, $this, 0);
if ($result) { // If error
$this->error = $mod->error;
$this->errors = $mod->errors;
}
return $result;
} else {
return 0;
@ -3024,6 +3033,10 @@ class Societe extends CommonObject
dol_syslog(get_class($this)."::check_codefournisseur code_fournisseur=".$this->code_fournisseur." module=".$module);
$result = $mod->verif($this->db, $this->code_fournisseur, $this, 1);
if ($result) { // If error
$this->error = $mod->error;
$this->errors = $mod->errors;
}
return $result;
} else {
return 0;

View File

@ -482,7 +482,7 @@ class Ticket extends CommonObject
global $langs;
// Check parameters
if (!$id && !$track_id && !$ref) {
if (!$id && !$track_id && !$ref && !$email_msgid) {
$this->error = 'ErrorWrongParameters';
dol_print_error(get_class($this)."::fetch ".$this->error);
return -1;

View File

@ -302,8 +302,8 @@ if ($object->id > 0)
}
print '<td colspan="2">&nbsp;</td>';
// Module id
if ($user->admin) print '<td class="right">'.$objMod->numero.'</td>';
// Permission id
if ($user->admin) print '<td class="right"></td>';
print '</tr>';
}
@ -323,7 +323,10 @@ if ($object->id > 0)
// Own permission by group
if ($caneditperms)
{
print '<td class="center"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delrights&amp;entity='.$entity.'&amp;rights='.$obj->id.'">'.img_edit_remove($langs->trans("Remove")).'</a></td>';
print '<td class="center"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delrights&amp;entity='.$entity.'&amp;rights='.$obj->id.'">';
//print img_edit_remove($langs->trans("Remove"));
print img_picto($langs->trans("Remove"), 'switch_on');
print '</a></td>';
}
print '<td class="center nowrap">';
print img_picto($langs->trans("Active"), 'tick');
@ -332,7 +335,10 @@ if ($object->id > 0)
// Do not own permission
if ($caneditperms)
{
print '<td class="center"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=addrights&amp;entity='.$entity.'&amp;rights='.$obj->id.'">'.img_edit_add($langs->trans("Add")).'</a></td>';
print '<td class="center"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=addrights&amp;entity='.$entity.'&amp;rights='.$obj->id.'">';
//print img_edit_add($langs->trans("Add"));
print img_picto($langs->trans("Add"), 'switch_off');
print '</a></td>';
}
print '<td>&nbsp</td>';
}
@ -340,7 +346,10 @@ if ($object->id > 0)
// Do not own permission
if ($caneditperms)
{
print '<td class="center"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=addrights&amp;entity='.$entity.'&amp;rights='.$obj->id.'">'.img_edit_add($langs->trans("Add")).'</a></td>';
print '<td class="center"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=addrights&amp;entity='.$entity.'&amp;rights='.$obj->id.'">';
//print img_edit_add($langs->trans("Add"));
print img_picto($langs->trans("Add"), 'switch_off');
print '</a></td>';
}
print '<td>&nbsp</td>';
}
@ -349,7 +358,7 @@ if ($object->id > 0)
print '<td class="maxwidthonsmartphone">'.$permlabel.'</td>';
// Permission id
if ($user->admin) print '<td class="right">'.$obj->id.'</td>';
if ($user->admin) print '<td class="right"><span class="opacitymedium">'.$obj->id.'</span></td>';
print '</tr>'."\n";

View File

@ -366,8 +366,8 @@ if ($result)
}
print '<td>&nbsp;</td>';
// Module Id
print '<td class="right"></td>';
// Permission id
if ($user->admin) print '<td class="right"></td>';
print '</tr>'."\n";
}
@ -394,7 +394,10 @@ if ($result)
{
if ($caneditperms)
{
print '<td class="center"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delrights&amp;entity='.$entity.'&amp;rights='.$obj->id.'&amp;confirm=yes&amp;token='.newToken().'">'.img_edit_remove($langs->trans("Remove")).'</a></td>';
print '<td class="center"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delrights&amp;entity='.$entity.'&amp;rights='.$obj->id.'&amp;confirm=yes&amp;token='.newToken().'">';
//print img_edit_remove($langs->trans("Remove"));
print img_picto($langs->trans("Remove"), 'switch_on');
print '</a></td>';
}
print '<td class="center nowrap">';
print img_picto($langs->trans("Active"), 'tick');
@ -416,7 +419,10 @@ if ($result)
// Do not own permission
if ($caneditperms)
{
print '<td class="center"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=addrights&amp;entity='.$entity.'&amp;rights='.$obj->id.'&amp;confirm=yes&amp;token='.newToken().'">'.img_edit_add($langs->trans("Add")).'</a></td>';
print '<td class="center"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=addrights&amp;entity='.$entity.'&amp;rights='.$obj->id.'&amp;confirm=yes&amp;token='.newToken().'">';
//print img_edit_add($langs->trans("Add"));
print img_picto($langs->trans("Add"), 'switch_off');
print '</a></td>';
}
print '<td>&nbsp</td>';
}
@ -424,7 +430,10 @@ if ($result)
// Do not own permission
if ($caneditperms)
{
print '<td class="center"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=addrights&amp;entity='.$entity.'&amp;rights='.$obj->id.'&amp;confirm=yes&amp;token='.newToken().'">'.img_edit_add($langs->trans("Add")).'</a></td>';
print '<td class="center"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=addrights&amp;entity='.$entity.'&amp;rights='.$obj->id.'&amp;confirm=yes&amp;token='.newToken().'">';
//print img_edit_add($langs->trans("Add"));
print img_picto($langs->trans("Add"), 'switch_off');
print '</a></td>';
}
print '<td>&nbsp</td>';
}
@ -434,7 +443,7 @@ if ($result)
print '<td class="maxwidthonsmartphone">'.$permlabel.'</td>';
// Permission id
if ($user->admin) print '<td class="right">'.$obj->id.'</td>';
if ($user->admin) print '<td class="right"><span class="opacitymedium">'.$obj->id.'</span></td>';
print '</tr>'."\n";

View File

@ -141,6 +141,9 @@ class ExportTest extends PHPUnit\Framework\TestCase
$model='csv';
$conf->global->EXPORT_CSV_SEPARATOR_TO_USE = ',';
print 'EXPORT_CSV_SEPARATOR_TO_USE = '.$conf->global->EXPORT_CSV_SEPARATOR_TO_USE;
// Creation of class to export using model ExportXXX
$dir = DOL_DOCUMENT_ROOT . "/core/modules/export/";
$file = "export_".$model.".modules.php";
@ -161,7 +164,7 @@ class ExportTest extends PHPUnit\Framework\TestCase
print __METHOD__." valtotest=".$valtotest."\n";
$result = $objmodel->csvClean($valtotest, $langs->charset_output);
print __METHOD__." result=".$result."\n";
$this->assertEquals($result, '"A string with , and ; inside"');
$this->assertEquals($result, '"A string with , and ; inside"', 'Error in csvClean for '.$file);
$valtotest='A string with " inside';
print __METHOD__." valtotest=".$valtotest."\n";
@ -182,7 +185,7 @@ class ExportTest extends PHPUnit\Framework\TestCase
$this->assertEquals($result, '"A string with <a href=""aaa""><strong>html<br>content</strong></a> inside"');
// Same tests with strict mode
$conf->global->USE_STRICT_CSV_RULES=1;
$conf->global->USE_STRICT_CSV_RULES = 1;
$valtotest='A simple string';
print __METHOD__." valtotest=".$valtotest."\n";
@ -245,7 +248,7 @@ class ExportTest extends PHPUnit\Framework\TestCase
// Build export file
print "Process build_file for model = ".$model."\n";
$result=$objexport->build_file($user, $model, $datatoexport, $array_selected, array(), $sql);
$expectedresult=1;
$expectedresult = 1;
$this->assertEquals($expectedresult, $result, 'Error in CSV export');
$model='tsv';
@ -360,7 +363,7 @@ class ExportTest extends PHPUnit\Framework\TestCase
// Build export file
$sql = "";
$result=$objexport->build_file($user, $model, $datatoexport, $array_selected, array(), $sql);
$expectedresult=1;
$expectedresult = 1;
$this->assertEquals($expectedresult, $result, "Call build_file() to export ".$exportfile.' failed');
$result=dol_is_file($exportfile);
$this->assertTrue($result, 'File '.$exportfile.' not found');