Merge branch '13.0' of github.com:Dolibarr/dolibarr into 13.0

This commit is contained in:
Florian HENRY
2021-01-15 08:11:30 +01:00
31 changed files with 219 additions and 151 deletions

View File

@@ -224,9 +224,10 @@ if ($action == "confirm_update") {
$action = 'create';
$error++;
}
if (!GETPOST('next_num_mvt', 'alpha'))
if (!GETPOST('doc_ref', 'alpha'))
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("NumPiece")), null, 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Piece")), null, 'errors');
$action = 'create';
$error++;
}
@@ -371,7 +372,7 @@ if ($action == 'create')
print '</tr>';
print '<tr>';
print '<td>'.$langs->trans("Piece").'</td>';
print '<td class="fieldrequired">'.$langs->trans("Piece").'</td>';
print '<td><input type="text" class="minwidth200" name="doc_ref" value="'.GETPOST('doc_ref', 'alpha').'"></td>';
print '</tr>';
@@ -594,7 +595,8 @@ if ($action == 'create')
print '<input type="hidden" name="fk_docdet" value="'.$object->fk_docdet.'">'."\n";
print '<input type="hidden" name="mode" value="'.$mode.'">'."\n";
print "<table class=\"noborder\" width=\"100%\">";
print '<table class="noborder centpercent">';
if (count($object->linesmvt) > 0) {
$total_debit = 0;
$total_credit = 0;
@@ -616,18 +618,21 @@ if ($action == 'create')
$total_credit += $line->credit;
if ($action == 'update' && $line->id == $id) {
print '<!-- td columns in edit mode -->';
print '<td>';
print $formaccounting->select_account((GETPOSTISSET("accountingaccount_number") ? GETPOST("accountingaccount_number", "alpha") : $line->numero_compte), 'accountingaccount_number', 1, array(), 1, 1, '');
print '</td>';
print '<td>';
// TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because it does not
// use setup of keypress to select thirdparty and this hang browser on large database.
if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
{
// TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because:
// It does not use the setup of "key pressed" to select a thirdparty and this hang browser on large databases.
// Also, it is not possible to use a value that is not in the list.
// Also, the label is not automatically filled when a value is selected.
if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) {
print $formaccounting->select_auxaccount((GETPOSTISSET("subledger_account") ? GETPOST("subledger_account", "alpha") : $line->subledger_account), 'subledger_account', 1);
} else {
print '<input type="text" class="maxwidth150" name="subledger_account" value="'.(GETPOSTISSET("subledger_account") ? GETPOST("subledger_account", "alpha") : $line->subledger_account).'">';
}
// TODO Add also the label
print '</td>';
print '<td><input type="text" class="minwidth200" name="label_operation" value="'.(GETPOSTISSET("label_operation") ? GETPOST("label_operation", "alpha") : $line->label_operation).'"></td>';
print '<td class="right"><input type="text" size="6" class="right" name="debit" value="'.(GETPOSTISSET("debit") ? GETPOST("debit", "alpha") : price($line->debit)).'"></td>';
@@ -671,18 +676,21 @@ if ($action == 'create')
if ($action == "" || $action == 'add') {
print '<tr class="oddeven">';
print '<!-- td columns in add mode -->';
print '<td>';
print $formaccounting->select_account('', 'accountingaccount_number', 1, array(), 1, 1, '');
print '</td>';
print '<td>';
// TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because it does not
// use setup of keypress to select thirdparty and this hang browser on large database.
if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
{
// TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because:
// It does not use the setup of "key pressed" to select a thirdparty and this hang browser on large databases.
// Also, it is not possible to use a value that is not in the list.
// Also, the label is not automatically filled when a value is selected.
if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) {
print $formaccounting->select_auxaccount('', 'subledger_account', 1);
} else {
print '<input type="text" class="maxwidth150" name="subledger_account" value="">';
}
// TODO Add also the label
print '</td>';
print '<td><input type="text" class="minwidth200" name="label_operation" value="'.$label_operation.'"/></td>';
print '<td class="right"><input type="text" size="6" class="right" name="debit" value=""/></td>';

View File

@@ -140,6 +140,7 @@ if (!in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && !GE
$arrayfields = array(
't.piece_num'=>array('label'=>$langs->trans("TransactionNumShort"), 'checked'=>1),
't.code_journal'=>array('label'=>$langs->trans("Codejournal"), 'checked'=>1),
't.doc_date'=>array('label'=>$langs->trans("Docdate"), 'checked'=>1),
't.doc_ref'=>array('label'=>$langs->trans("Piece"), 'checked'=>1),
't.numero_compte'=>array('label'=>$langs->trans("AccountAccountingShort"), 'checked'=>1),
@@ -148,7 +149,6 @@ $arrayfields = array(
't.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1),
't.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1),
't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1),
't.code_journal'=>array('label'=>$langs->trans("Codejournal"), 'checked'=>1),
't.date_creation'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0),
't.tms'=>array('label'=>$langs->trans("DateModification"), 'checked'=>0),
't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>1),
@@ -642,7 +642,7 @@ if (empty($reshook)) {
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
$newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param, '', 1, array('morecss' => 'marginleftonly'));
$newcardbutton .= dolGetButtonTitle($langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbysubaccount.php', '', 1, array('morecss' => 'marginleftonly'));
$newcardbutton .= dolGetButtonTitle($langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbysubaccount.php?'.$param, '', 1, array('morecss' => 'marginleftonly'));
$url = './card.php?action=create';
if (!empty($socid)) $url .= '&socid='.$socid;
@@ -665,11 +665,17 @@ print '<table class="tagtable liste centpercent">';
// Filters lines
print '<tr class="liste_titre_filter">';
// Movement number
if (!empty($arrayfields['t.piece_num']['checked']))
{
print '<td class="liste_titre"><input type="text" name="search_mvt_num" size="6" value="'.dol_escape_htmltag($search_mvt_num).'"></td>';
}
// Code journal
if (!empty($arrayfields['t.code_journal']['checked']))
{
print '<td class="liste_titre center"><input type="text" name="search_ledger_code" size="3" value="'.$search_ledger_code.'"></td>';
}
// Date document
if (!empty($arrayfields['t.doc_date']['checked']))
{
@@ -758,11 +764,7 @@ if (!empty($arrayfields['t.lettering_code']['checked']))
print '<br><span class="nowrap"><input type="checkbox" name="search_reconciled_option" value="notreconciled"'.($search_not_reconciled == 'notreconciled' ? ' checked' : '').'>'.$langs->trans("NotReconciled").'</span>';
print '</td>';
}
// Code journal
if (!empty($arrayfields['t.code_journal']['checked']))
{
print '<td class="liste_titre center"><input type="text" name="search_ledger_code" size="3" value="'.$search_ledger_code.'"></td>';
}
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields);
@@ -814,6 +816,7 @@ print "</tr>\n";
print '<tr class="liste_titre">';
if (!empty($arrayfields['t.piece_num']['checked'])) print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, "", $sortfield, $sortorder);
if (!empty($arrayfields['t.code_journal']['checked'])) print_liste_field_titre($arrayfields['t.code_journal']['label'], $_SERVER['PHP_SELF'], "t.code_journal", "", $param, '', $sortfield, $sortorder, 'center ');
if (!empty($arrayfields['t.doc_date']['checked'])) print_liste_field_titre($arrayfields['t.doc_date']['label'], $_SERVER['PHP_SELF'], "t.doc_date", "", $param, '', $sortfield, $sortorder, 'center ');
if (!empty($arrayfields['t.doc_ref']['checked'])) print_liste_field_titre($arrayfields['t.doc_ref']['label'], $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder);
if (!empty($arrayfields['t.numero_compte']['checked'])) print_liste_field_titre($arrayfields['t.numero_compte']['label'], $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder);
@@ -822,7 +825,6 @@ if (!empty($arrayfields['t.label_operation']['checked'])) print_liste_field_tit
if (!empty($arrayfields['t.debit']['checked'])) print_liste_field_titre($arrayfields['t.debit']['label'], $_SERVER['PHP_SELF'], "t.debit", "", $param, '', $sortfield, $sortorder, 'right ');
if (!empty($arrayfields['t.credit']['checked'])) print_liste_field_titre($arrayfields['t.credit']['label'], $_SERVER['PHP_SELF'], "t.credit", "", $param, '', $sortfield, $sortorder, 'right ');
if (!empty($arrayfields['t.lettering_code']['checked'])) print_liste_field_titre($arrayfields['t.lettering_code']['label'], $_SERVER['PHP_SELF'], "t.lettering_code", "", $param, '', $sortfield, $sortorder, 'center ');
if (!empty($arrayfields['t.code_journal']['checked'])) print_liste_field_titre($arrayfields['t.code_journal']['label'], $_SERVER['PHP_SELF'], "t.code_journal", "", $param, '', $sortfield, $sortorder, 'center ');
// Hook fields
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
@@ -888,6 +890,16 @@ while ($i < min($num, $limit))
if (!$i) $totalarray['nbfield']++;
}
// Journal code
if (!empty($arrayfields['t.code_journal']['checked']))
{
$accountingjournal = new AccountingJournal($db);
$result = $accountingjournal->fetch('', $line->code_journal);
$journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $line->code_journal);
print '<td class="center">'.$journaltoshow.'</td>';
if (!$i) $totalarray['nbfield']++;
}
// Document date
if (!empty($arrayfields['t.doc_date']['checked']))
{
@@ -1006,16 +1018,6 @@ while ($i < min($num, $limit))
if (!$i) $totalarray['nbfield']++;
}
// Journal code
if (!empty($arrayfields['t.code_journal']['checked']))
{
$accountingjournal = new AccountingJournal($db);
$result = $accountingjournal->fetch('', $line->code_journal);
$journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $line->code_journal);
print '<td class="center">'.$journaltoshow.'</td>';
if (!$i) $totalarray['nbfield']++;
}
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook

View File

@@ -128,8 +128,8 @@ if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET('searc
$arrayfields = array(
// 't.subledger_account'=>array('label'=>$langs->trans("SubledgerAccount"), 'checked'=>1),
't.code_journal'=>array('label'=>$langs->trans("Codejournal"), 'checked'=>1),
't.piece_num'=>array('label'=>$langs->trans("TransactionNumShort"), 'checked'=>1),
't.code_journal'=>array('label'=>$langs->trans("Codejournal"), 'checked'=>1),
't.doc_date'=>array('label'=>$langs->trans("Docdate"), 'checked'=>1),
't.doc_ref'=>array('label'=>$langs->trans("Piece"), 'checked'=>1),
't.label_operation'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
@@ -426,7 +426,7 @@ $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $obj
if (empty($reshook)) {
$newcardbutton = dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param);
$newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
$newcardbutton .= dolGetButtonTitle($langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbysubaccount.php', '', 1, array('morecss' => 'marginleftonly'));
$newcardbutton .= dolGetButtonTitle($langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbysubaccount.php?'.$param, '', 1, array('morecss' => 'marginleftonly'));
$newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?action=create');
}
@@ -471,6 +471,11 @@ print '<table class="tagtable liste centpercent">';
// Filters lines
print '<tr class="liste_titre_filter">';
// Movement number
if (!empty($arrayfields['t.piece_num']['checked']))
{
print '<td class="liste_titre"><input type="text" name="search_mvt_num" size="6" value="'.dol_escape_htmltag($search_mvt_num).'"></td>';
}
// Code journal
if (!empty($arrayfields['t.code_journal']['checked'])) {
print '<td class="liste_titre center"><input type="text" name="search_ledger_code" size="3" value="'.dol_escape_htmltag($search_ledger_code).'"></td>';
@@ -486,11 +491,6 @@ if (!empty($arrayfields['t.doc_date']['checked'])) {
print '</div>';
print '</td>';
}
// Movement number
if (!empty($arrayfields['t.piece_num']['checked']))
{
print '<td class="liste_titre"><input type="text" name="search_mvt_num" size="6" value="'.dol_escape_htmltag($search_mvt_num).'"></td>';
}
// Ref document
if (!empty($arrayfields['t.doc_ref']['checked'])) {
print '<td class="liste_titre"><input type="text" size="7" class="flat" name="search_doc_ref" value="'.dol_escape_htmltag($search_doc_ref).'"/></td>';
@@ -540,9 +540,9 @@ print '</td>';
print "</tr>\n";
print '<tr class="liste_titre">';
if (!empty($arrayfields['t.piece_num']['checked'])) print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['t.code_journal']['checked'])) print_liste_field_titre($arrayfields['t.code_journal']['label'], $_SERVER['PHP_SELF'], "t.code_journal", "", $param, '', $sortfield, $sortorder, 'center ');
if (!empty($arrayfields['t.doc_date']['checked'])) print_liste_field_titre($arrayfields['t.doc_date']['label'], $_SERVER['PHP_SELF'], "t.doc_date", "", $param, '', $sortfield, $sortorder, 'center ');
if (!empty($arrayfields['t.piece_num']['checked'])) print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['t.doc_ref']['checked'])) print_liste_field_titre($arrayfields['t.doc_ref']['label'], $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder);
if (!empty($arrayfields['t.label_operation']['checked'])) print_liste_field_titre($arrayfields['t.label_operation']['label'], $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder);
if (!empty($arrayfields['t.debit']['checked'])) print_liste_field_titre($arrayfields['t.debit']['label'], $_SERVER['PHP_SELF'], "t.debit", "", $param, '', $sortfield, $sortorder, 'right ');
@@ -633,6 +633,17 @@ while ($i < min($num, $limit))
print '<tr class="oddeven">';
// Piece number
if (!empty($arrayfields['t.piece_num']['checked']))
{
print '<td>';
$object->id = $line->id;
$object->piece_num = $line->piece_num;
print $object->getNomUrl(1, '', 0, '', 1);
print '</td>';
if (!$i) $totalarray['nbfield']++;
}
// Journal code
if (!empty($arrayfields['t.code_journal']['checked']))
{
@@ -650,17 +661,6 @@ while ($i < min($num, $limit))
if (!$i) $totalarray['nbfield']++;
}
// Piece number
if (!empty($arrayfields['t.piece_num']['checked']))
{
print '<td>';
$object->id = $line->id;
$object->piece_num = $line->piece_num;
print $object->getNomUrl(1, '', 0, '', 1);
print '</td>';
if (!$i) $totalarray['nbfield']++;
}
// Document ref
if (!empty($arrayfields['t.doc_ref']['checked']))
{

View File

@@ -128,8 +128,8 @@ if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET('searc
$arrayfields = array(
// 't.subledger_account'=>array('label'=>$langs->trans("SubledgerAccount"), 'checked'=>1),
't.code_journal'=>array('label'=>$langs->trans("Codejournal"), 'checked'=>1),
't.piece_num'=>array('label'=>$langs->trans("TransactionNumShort"), 'checked'=>1),
't.code_journal'=>array('label'=>$langs->trans("Codejournal"), 'checked'=>1),
't.doc_date'=>array('label'=>$langs->trans("Docdate"), 'checked'=>1),
't.doc_ref'=>array('label'=>$langs->trans("Piece"), 'checked'=>1),
't.label_operation'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
@@ -427,8 +427,8 @@ $parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) {
$newcardbutton = dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param);
$newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php', '', 1, array('morecss' => 'marginleftonly'));
$newcardbutton .= dolGetButtonTitle($langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbysubaccount.php', '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
$newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param, '', 1, array('morecss' => 'marginleftonly'));
$newcardbutton .= dolGetButtonTitle($langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbysubaccount.php?'.$param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
$newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?action=create');
}
@@ -475,6 +475,11 @@ print '<table class="tagtable liste centpercent">';
// Filters lines
print '<tr class="liste_titre_filter">';
// Movement number
if (!empty($arrayfields['t.piece_num']['checked']))
{
print '<td class="liste_titre"><input type="text" name="search_mvt_num" size="6" value="'.dol_escape_htmltag($search_mvt_num).'"></td>';
}
// Code journal
if (!empty($arrayfields['t.code_journal']['checked'])) {
print '<td class="liste_titre center"><input type="text" name="search_ledger_code" size="3" value="'.dol_escape_htmltag($search_ledger_code).'"></td>';
@@ -490,11 +495,6 @@ if (!empty($arrayfields['t.doc_date']['checked'])) {
print '</div>';
print '</td>';
}
// Movement number
if (!empty($arrayfields['t.piece_num']['checked']))
{
print '<td class="liste_titre"><input type="text" name="search_mvt_num" size="6" value="'.dol_escape_htmltag($search_mvt_num).'"></td>';
}
// Ref document
if (!empty($arrayfields['t.doc_ref']['checked'])) {
print '<td class="liste_titre"><input type="text" size="7" class="flat" name="search_doc_ref" value="'.dol_escape_htmltag($search_doc_ref).'"/></td>';
@@ -544,9 +544,9 @@ print '</td>';
print "</tr>\n";
print '<tr class="liste_titre">';
if (!empty($arrayfields['t.piece_num']['checked'])) print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['t.code_journal']['checked'])) print_liste_field_titre($arrayfields['t.code_journal']['label'], $_SERVER['PHP_SELF'], "t.code_journal", "", $param, '', $sortfield, $sortorder, 'center ');
if (!empty($arrayfields['t.doc_date']['checked'])) print_liste_field_titre($arrayfields['t.doc_date']['label'], $_SERVER['PHP_SELF'], "t.doc_date", "", $param, '', $sortfield, $sortorder, 'center ');
if (!empty($arrayfields['t.piece_num']['checked'])) print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['t.doc_ref']['checked'])) print_liste_field_titre($arrayfields['t.doc_ref']['label'], $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder);
if (!empty($arrayfields['t.label_operation']['checked'])) print_liste_field_titre($arrayfields['t.label_operation']['label'], $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder);
if (!empty($arrayfields['t.debit']['checked'])) print_liste_field_titre($arrayfields['t.debit']['label'], $_SERVER['PHP_SELF'], "t.debit", "", $param, '', $sortfield, $sortorder, 'right ');
@@ -627,8 +627,12 @@ while ($i < min($num, $limit))
} else {
// Should not happen: subledger account must be null or a non empty value
print '<span class="error">'.$langs->trans("Unknown");
if ($line->subledger_label) print ' ('.$line->subledger_label.')';
$htmltext = 'EmptyStringForSubledgerAccountButSubledgerLabelDefined';
if ($line->subledger_label) {
print ' ('.$line->subledger_label.')';
$htmltext = 'EmptyStringForSubledgerAccountButSubledgerLabelDefined';
} else {
$htmltext = 'EmptyStringForSubledgerAccountAndSubledgerLabel';
}
print $form->textwithpicto('', $htmltext);
print '</span>';
}
@@ -645,6 +649,17 @@ while ($i < min($num, $limit))
print '<tr class="oddeven">';
// Piece number
if (!empty($arrayfields['t.piece_num']['checked']))
{
print '<td>';
$object->id = $line->id;
$object->piece_num = $line->piece_num;
print $object->getNomUrl(1, '', 0, '', 1);
print '</td>';
if (!$i) $totalarray['nbfield']++;
}
// Journal code
if (!empty($arrayfields['t.code_journal']['checked']))
{
@@ -662,17 +677,6 @@ while ($i < min($num, $limit))
if (!$i) $totalarray['nbfield']++;
}
// Piece number
if (!empty($arrayfields['t.piece_num']['checked']))
{
print '<td>';
$object->id = $line->id;
$object->piece_num = $line->piece_num;
print $object->getNomUrl(1, '', 0, '', 1);
print '</td>';
if (!$i) $totalarray['nbfield']++;
}
// Document ref
if (!empty($arrayfields['t.doc_ref']['checked']))
{

View File

@@ -820,6 +820,8 @@ class AccountancyExport
*/
public function exportFEC($objectLines)
{
global $langs;
$separator = "\t";
$end_line = "\r\n";
@@ -853,55 +855,55 @@ class AccountancyExport
$date_validation = dol_print_date($line->date_validated, '%Y%m%d');
// FEC:JournalCode
print $line->code_journal.$separator;
print $line->code_journal . $separator;
// FEC:JournalLib
print $line->journal_label.$separator;
print dol_string_unaccent($langs->transnoentities($line->journal_label)) . $separator;
// FEC:EcritureNum
print $line->piece_num.$separator;
print $line->piece_num . $separator;
// FEC:EcritureDate
print $date_document.$separator;
print $date_document . $separator;
// FEC:CompteNum
print $line->numero_compte.$separator;
print $line->numero_compte . $separator;
// FEC:CompteLib
print dol_string_unaccent($line->label_compte).$separator;
print dol_string_unaccent($line->label_compte) . $separator;
// FEC:CompAuxNum
print $line->subledger_account.$separator;
print $line->subledger_account . $separator;
// FEC:CompAuxLib
print dol_string_unaccent($line->subledger_label).$separator;
print dol_string_unaccent($line->subledger_label) . $separator;
// FEC:PieceRef
print $line->doc_ref.$separator;
print $line->doc_ref . $separator;
// FEC:PieceDate
print dol_string_unaccent($date_creation).$separator;
print dol_string_unaccent($date_creation) . $separator;
// FEC:EcritureLib
print dol_string_unaccent($line->label_operation).$separator;
print dol_string_unaccent($line->label_operation) . $separator;
// FEC:Debit
print price2fec($line->debit).$separator;
print price2fec($line->debit) . $separator;
// FEC:Credit
print price2fec($line->credit).$separator;
print price2fec($line->credit) . $separator;
// FEC:EcritureLet
print $line->lettering_code.$separator;
print $line->lettering_code . $separator;
// FEC:DateLet
print $date_lettering.$separator;
print $date_lettering . $separator;
// FEC:ValidDate
print $date_validation.$separator;
print $date_validation . $separator;
// FEC:Montantdevise
print $line->multicurrency_amount.$separator;
print $line->multicurrency_amount . $separator;
// FEC:Idevise
print $line->multicurrency_code;
@@ -919,6 +921,8 @@ class AccountancyExport
*/
public function exportFEC2($objectLines)
{
global $langs;
$separator = "\t";
$end_line = "\r\n";
@@ -955,7 +959,7 @@ class AccountancyExport
print $line->code_journal . $separator;
// FEC:JournalLib
print $line->journal_label . $separator;
print dol_string_unaccent($langs->transnoentities($line->journal_label)) . $separator;
// FEC:EcritureNum
print $line->piece_num . $separator;
@@ -1634,15 +1638,15 @@ class AccountancyExport
($line->doc_type == 'supplier_invoice' && !isset($supplier_invoices_infos[$line->fk_doc]))) {
if ($line->doc_type == 'customer_invoice') {
// Get new customer invoice ref and company name
$sql = 'SELECT f.facnumber, s.nom FROM ' . MAIN_DB_PREFIX . 'facture as f';
$sql = 'SELECT f.ref, s.nom FROM ' . MAIN_DB_PREFIX . 'facture as f';
$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'societe AS s ON f.fk_soc = s.rowid';
$sql .= ' WHERE f.rowid = ' . $line->fk_doc;
$resql = $this->db->query($sql);
if ($resql) {
if ($obj = $this->db->fetch_object($resql)) {
// Save invoice infos
$invoices_infos[$line->fk_doc] = array('ref' => $obj->facnumber, 'company_name' => $obj->nom);
$invoice_ref = $obj->facnumber;
$invoices_infos[$line->fk_doc] = array('ref' => $obj->ref, 'company_name' => $obj->nom);
$invoice_ref = $obj->ref;
$company_name = $obj->nom;
}
}

View File

@@ -126,7 +126,7 @@ class AccountingJournal extends CommonObject
$this->rowid = $obj->rowid;
$this->code = $obj->code;
$this->ref = $obj->code;
$this->ref = $obj->code;
$this->label = $obj->label;
$this->nature = $obj->nature;
$this->active = $obj->active;

View File

@@ -831,7 +831,11 @@ class BookKeeping extends CommonObject
} elseif ($key == 't.reconciled_option') {
$sqlwhere[] = 't.lettering_code IS NULL';
} elseif ($key == 't.code_journal' && !empty($value)) {
$sqlwhere[] = natural_search("t.code_journal", join(',', $value), 3, 1);
if (is_array($value)) {
$sqlwhere[] = natural_search("t.code_journal", join(',', $value), 3, 1);
} else {
$sqlwhere[] = natural_search("t.code_journal", $value, 3, 1);
}
} else {
$sqlwhere[] = natural_search($key, $value, 0, 1);
}

View File

@@ -549,7 +549,7 @@ if (!$error && $action == 'writebookkeeping') {
$bookkeeping->debit = ($mt >= 0 ? $mt : 0);
$bookkeeping->credit = ($mt < 0 ? -$mt : 0);
$bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label;
$bookkeeping->journal_label = $langs->transnoentities($journal_label);
$bookkeeping->fk_user_author = $user->id;
$bookkeeping->date_creation = $now;
@@ -605,7 +605,7 @@ if (!$error && $action == 'writebookkeeping') {
$bookkeeping->debit = ($mt < 0 ? -$mt : 0);
$bookkeeping->credit = ($mt >= 0) ? $mt : 0;
$bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label;
$bookkeeping->journal_label = $langs->transnoentities($journal_label);
$bookkeeping->fk_user_author = $user->id;
$bookkeeping->date_creation = $now;
@@ -737,7 +737,7 @@ if (!$error && $action == 'writebookkeeping') {
$bookkeeping->debit = ($mt < 0 ? -$mt : 0);
$bookkeeping->credit = ($mt >= 0) ? $mt : 0;
$bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label;
$bookkeeping->journal_label = $langs->transnoentities($journal_label);
$bookkeeping->fk_user_author = $user->id;
$bookkeeping->date_creation = $now;
$bookkeeping->label_compte = '';

View File

@@ -223,7 +223,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->debit = ($mt <= 0) ? -$mt : 0;
$bookkeeping->credit = ($mt > 0) ? $mt : 0;
$bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label;
$bookkeeping->journal_label = $langs->transnoentities($journal_label);
$bookkeeping->fk_user_author = $user->id;
$bookkeeping->entity = $conf->entity;
@@ -271,7 +271,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
$bookkeeping->credit = ($mt <= 0) ? -$mt : 0;
$bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label;
$bookkeeping->journal_label = $langs->transnoentities($journal_label);
$bookkeeping->fk_user_author = $user->id;
$bookkeeping->entity = $conf->entity;
@@ -329,7 +329,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
$bookkeeping->credit = ($mt <= 0) ? -$mt : 0;
$bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label;
$bookkeeping->journal_label = $langs->transnoentities($journal_label);
$bookkeeping->fk_user_author = $user->id;
$bookkeeping->entity = $conf->entity;

View File

@@ -322,7 +322,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->debit = ($mt <= 0) ? -$mt : 0;
$bookkeeping->credit = ($mt > 0) ? $mt : 0;
$bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label;
$bookkeeping->journal_label = $langs->transnoentities($journal_label);
$bookkeeping->fk_user_author = $user->id;
$bookkeeping->entity = $conf->entity;
@@ -372,7 +372,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
$bookkeeping->credit = ($mt <= 0) ? -$mt : 0;
$bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label;
$bookkeeping->journal_label = $langs->transnoentities($journal_label);
$bookkeeping->fk_user_author = $user->id;
$bookkeeping->entity = $conf->entity;
@@ -433,7 +433,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
$bookkeeping->credit = ($mt <= 0) ? -$mt : 0;
$bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label;
$bookkeeping->journal_label = $langs->transnoentities($journal_label);
$bookkeeping->fk_user_author = $user->id;
$bookkeeping->entity = $conf->entity;
@@ -484,7 +484,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
$bookkeeping->credit = ($mt <= 0) ? -$mt : 0;
$bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label;
$bookkeeping->journal_label = $langs->transnoentities($journal_label);
$bookkeeping->fk_user_author = $user->id;
$bookkeeping->entity = $conf->entity;

View File

@@ -333,7 +333,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->debit = ($mt >= 0) ? $mt : 0;
$bookkeeping->credit = ($mt < 0) ? -$mt : 0;
$bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label;
$bookkeeping->journal_label = $langs->transnoentities($journal_label);
$bookkeeping->fk_user_author = $user->id;
$bookkeeping->entity = $conf->entity;
@@ -383,7 +383,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->debit = ($mt < 0) ? -$mt : 0;
$bookkeeping->credit = ($mt >= 0) ? $mt : 0;
$bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label;
$bookkeeping->journal_label = $langs->transnoentities($journal_label);
$bookkeeping->fk_user_author = $user->id;
$bookkeeping->entity = $conf->entity;
@@ -443,7 +443,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->debit = ($mt < 0) ? -$mt : 0;
$bookkeeping->credit = ($mt >= 0) ? $mt : 0;
$bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label;
$bookkeeping->journal_label = $langs->transnoentities($journal_label);
$bookkeeping->fk_user_author = $user->id;
$bookkeeping->entity = $conf->entity;

View File

@@ -2896,19 +2896,20 @@ class Commande extends CommonOrder
* Classify the order as invoiced
*
* @param User $user Object user making the change
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if KO, >0 if OK
* @param int $notrigger 1=Does not execute triggers, 0=execute triggers
* @return int <0 if KO, 0 if already billed, >0 if OK
*/
public function classifyBilled(User $user, $notrigger = 0)
{
$error = 0;
$this->db->begin();
if ($this->billed)
{
return 0;
}
$this->db->begin();
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande SET facture = 1';
$sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > '.self::STATUS_DRAFT;

View File

@@ -401,6 +401,7 @@ class Paiement extends CommonObject
if ($result < 0)
{
$this->error = $invoice->error;
$this->errors = $invoice->errors;
$error++;
}
}
@@ -578,9 +579,10 @@ class Paiement extends CommonObject
* @param string $emetteur_nom Name of transmitter
* @param string $emetteur_banque Name of bank
* @param int $notrigger No trigger
* @param string $accountancycode When we record a free bank entry, we must provide accounting account if accountancy module is on.
* @return int <0 if KO, bank_line_id if OK
*/
public function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom, $emetteur_banque, $notrigger = 0)
public function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom, $emetteur_banque, $notrigger = 0, $accountancycode = '')
{
global $conf, $langs, $user;
@@ -625,7 +627,8 @@ class Paiement extends CommonObject
'',
$user,
$emetteur_nom,
$emetteur_banque
$emetteur_banque,
$accountancycode
);
// Mise a jour fk_bank dans llx_paiement

View File

@@ -6421,8 +6421,7 @@ class Form
$value = $tmpvalue;
$disabled = ''; $style = '';
}
if (!empty($disablebademail))
{
if (!empty($disablebademail)) {
if (($disablebademail == 1 && !preg_match('/&lt;.+@.+&gt;/', $value))
|| ($disablebademail == 2 && preg_match('/---/', $value)))
{
@@ -6431,8 +6430,7 @@ class Form
}
}
if ($key_in_label)
{
if ($key_in_label) {
if (empty($nohtmlescape)) $selectOptionValue = dol_escape_htmltag($key.' - '.($maxlen ?dol_trunc($value, $maxlen) : $value));
else $selectOptionValue = $key.' - '.($maxlen ?dol_trunc($value, $maxlen) : $value);
} else {

View File

@@ -347,7 +347,7 @@ class FormAccounting extends Form
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of auxilary thirdparty accounts
* Return list of auxilary accounts. Cumulate list from customers, suppliers and users.
*
* @param string $selectid Preselected pcg_type
* @param string $htmlname Name of field in html form
@@ -372,7 +372,7 @@ class FormAccounting extends Form
if ($resql) {
while ($obj = $this->db->fetch_object($resql)) {
if (!empty($obj->code_compta)) {
$aux_account[$obj->code_compta] = $obj->code_compta.' ('.$obj->nom.')';
$aux_account[$obj->code_compta] = $obj->code_compta.' <span class="opacitymedium">('.$obj->nom.')</span>';
}
}
} else {
@@ -392,7 +392,7 @@ class FormAccounting extends Form
if ($resql) {
while ($obj = $this->db->fetch_object($resql)) {
if ($obj->code_compta_fournisseur != "") {
$aux_account[$obj->code_compta_fournisseur] = $obj->code_compta_fournisseur.' ('.$obj->nom.')';
$aux_account[$obj->code_compta_fournisseur] = $obj->code_compta_fournisseur.' <span class="opacitymedium">('.$obj->nom.')</span>';
}
}
} else {
@@ -412,7 +412,7 @@ class FormAccounting extends Form
if ($resql) {
while ($obj = $this->db->fetch_object($resql)) {
if (!empty($obj->accountancy_code)) {
$aux_account[$obj->accountancy_code] = $obj->accountancy_code.' ('.dolGetFirstLastname($obj->firstname, $obj->lastname).')';
$aux_account[$obj->accountancy_code] = $obj->accountancy_code.' <span class="opacitymedium">('.dolGetFirstLastname($obj->firstname, $obj->lastname).')</span>';
}
}
} else {

View File

@@ -829,7 +829,7 @@ class FormCompany extends Form
*
* @param string $selected Preselected value
* @param string $htmlname HTML select name
* @param string $fields Fields
* @param array $fields Array with key of fields to refresh after selection
* @param int $fieldsize Field size
* @param int $disableautocomplete 1 To disable ajax autocomplete features (browser autocomplete may still occurs)
* @param string $moreattrib Add more attribute on HTML input field

View File

@@ -179,20 +179,29 @@ class Interfaces
$objMod = new $modName($this->db);
if ($objMod)
{
$dblevelbefore = $this->db->transaction_opened;
$result = 0;
if (method_exists($objMod, 'runTrigger')) // New method to implement
{
if (method_exists($objMod, 'runTrigger')) { // New method to implement
//dol_syslog(get_class($this)."::run_triggers action=".$action." Launch runTrigger for file '".$files[$key]."'", LOG_DEBUG);
$result = $objMod->runTrigger($action, $object, $user, $langs, $conf);
} elseif (method_exists($objMod, 'run_trigger')) // Deprecated method
{
} elseif (method_exists($objMod, 'run_trigger')) { // Deprecated method
dol_syslog(get_class($this)."::run_triggers action=".$action." Launch old method run_trigger (rename your trigger into runTrigger) for file '".$files[$key]."'", LOG_WARNING);
$result = $objMod->run_trigger($action, $object, $user, $langs, $conf);
} else {
dol_syslog(get_class($this)."::run_triggers action=".$action." A trigger was declared for class ".get_class($objMod)." but method runTrigger was not found", LOG_ERR);
}
$dblevelafter = $this->db->transaction_opened;
if ($dblevelbefore != $dblevelafter) {
$errormessage = "Error, the balance begin/close of db transactions has been broken into trigger ".$modName." with action=".$action." before=".$dblevelbefore." after=".$dblevelafter;
$this->errors[] = $errormessage;
dol_syslog($errormessage, LOG_ERR);
$result = -1;
}
if ($result > 0)
{
// Action OK

View File

@@ -227,7 +227,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen
* This use the jQuery "autocomplete" function.
*
* @param string $htmlname HTML name of input field
* @param string $fields Other fields to autocomplete
* @param array $fields Array of key of fields to autocomplete
* @param string $url URL for ajax request : /chemin/fichier.php
* @param string $option More parameters on URL request
* @param int $minLength Minimum number of chars to trigger that Ajax search

View File

@@ -675,7 +675,7 @@ function checkVal($out = '', $check = 'alphanohtml', $filter = null, $options =
case 'nohtml':
$out = dol_string_nohtmltag($out, 0);
break;
case 'alpha': // No html and no " and no ../
case 'alpha': // No html and no ../ and " replaced with ''
case 'alphanohtml': // Recommended for most scalar parameters and search parameters
if (!is_array($out)) {
// '"' is dangerous because param in url can close the href= or src= and add javascript functions.
@@ -686,6 +686,14 @@ function checkVal($out = '', $check = 'alphanohtml', $filter = null, $options =
$out = dol_string_nohtmltag($out, 0);
}
break;
case 'alphawithlgt': // No " and no ../ but we keep < > tags
if (!is_array($out)) {
// '"' is dangerous because param in url can close the href= or src= and add javascript functions.
// '../' is dangerous because it allows dir transversals
$out = str_replace(array('&quot;', '"'), "", trim($out));
$out = str_replace(array('../'), '', $out);
}
break;
case 'restricthtml': // Recommended for most html textarea
$out = dol_string_onlythesehtmltags($out, 0, 1, 1);
break;

View File

@@ -196,7 +196,7 @@ if ($action == 'presend')
}
$formmail->withto = $liste;
$formmail->withtofree = (GETPOSTISSET('sendto') ? (GETPOST('sendto') ? GETPOST('sendto') : '1') : '1');
$formmail->withtofree = (GETPOSTISSET('sendto') ? (GETPOST('sendto', 'alphawithlgt') ? GETPOST('sendto', 'alphawithlgt') : '1') : '1');
$formmail->withtocc = $liste;
$formmail->withtoccc = $conf->global->MAIN_EMAIL_USECCC;
$formmail->withtopic = $topicmail;

View File

@@ -891,11 +891,17 @@ class CommandeFournisseur extends CommonOrder
* Class invoiced the supplier order
*
* @param User $user Object user making the change
* @return int <0 if KO, >0 if KO
* @return int <0 if KO, 0 if already billed, >0 if OK
*/
public function classifyBilled(User $user)
{
$error = 0;
if ($this->billed)
{
return 0;
}
$this->db->begin();
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande_fournisseur SET billed = 1';

View File

@@ -51,6 +51,6 @@ CREATE TABLE llx_accounting_bookkeeping
journal_label varchar(255), -- FEC:JournalLib
date_validated datetime, -- FEC:ValidDate | if empty: movement not validated / if not empty: movement validated (No deleting / No modification)
date_export datetime DEFAULT NULL, --
import_key varchar(14),
import_key varchar(14), -- ID of import when data was inserted by a mass import
extraparams varchar(255) -- for other parameters with json format
) ENGINE=innodb;

View File

@@ -224,6 +224,7 @@ Value=Value
PersonalValue=Personal value
NewObject=New %s
NewValue=New value
OldValue=Old value %s
CurrentValue=Current value
Code=Code
Type=Type

View File

@@ -875,7 +875,7 @@ Permission773=Supprimer les notes de frais
Permission774=Lire toutes les notes de frais (même pour les utilisateurs en dehors de ma hierarchie)
Permission775=Approuver les notes de frais
Permission776=Payer les notes de frais
Permission777=Lisez les notes de frais de tout le monde
Permission777=Lire les notes de frais de tout le monde
Permission778=Créer / modifier les notes de frais de tout le monde
Permission779=Exporter les notes de frais
Permission1001=Consulter les stocks

View File

@@ -2,17 +2,17 @@
## Features
Description...
Description of the module...
<!--
![Screenshot mymodule](img/screenshot_mymodule.png?raw=true "MyModule"){imgmd}
-->
Other modules are available on [Dolistore.com](https://www.dolistore.com).
Other external modules are available on [Dolistore.com](https://www.dolistore.com).
## Translations
Translations can be define manually by editing files into directories *langs*.
Translations can be completed manually by editing files into directories *langs*.
<!--
This module contains also a sample configuration for Transifex, under the hidden directory [.tx](.tx), so it is possible to manage translation using this service.

View File

@@ -65,7 +65,7 @@ class modMyModule extends DolibarrModules
// Module description, used if translation string 'ModuleMyModuleDesc' not found (MyModule is name of module).
$this->description = "MyModuleDescription";
// Used only if file README.md and README-LL.md not found.
$this->descriptionlong = "MyModule description (Long)";
$this->descriptionlong = "MyModuleDescription";
// Author
$this->editor_name = 'Editor name';

View File

@@ -20,9 +20,8 @@
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
{
$sql = "SELECT p.fk_opp_status as opp_status, cls.code, COUNT(p.rowid) as nb, SUM(p.opp_amount) as opp_amount, SUM(p.opp_amount * p.opp_percent) as ponderated_opp_amount";
$sql .= " FROM ".MAIN_DB_PREFIX."projet as p, ".MAIN_DB_PREFIX."c_lead_status as cls";
$sql .= " FROM ".MAIN_DB_PREFIX."projet as p LEFT JOIN ".MAIN_DB_PREFIX."c_lead_status as cls ON p.fk_opp_status = cls.rowid"; // If lead status has been removed, we must show it in stats as unknown
$sql .= " WHERE p.entity IN (".getEntity('project').")";
$sql .= " AND p.fk_opp_status = cls.rowid";
$sql .= " AND p.fk_statut = 1"; // Opend projects only
if ($mine || empty($user->rights->projet->all->lire)) $sql .= " AND p.rowid IN (".$projectsListId.")";
if ($socid) $sql .= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
@@ -64,16 +63,25 @@ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
$ponderated_opp_amount = $ponderated_opp_amount / 100;
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder nohover centpercent">';
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").' - '.$langs->trans("OpportunitiesStatusForOpenedProjects").'</th></tr>'."\n";
$listofstatus = array_keys($listofoppstatus);
foreach ($listofstatus as $status)
{
$labelStatus = '';
print '<table class="noborder nohover centpercent">';
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").' - '.$langs->trans("OpportunitiesStatusForOpenedProjects").'</th></tr>'."\n";
$listofstatus = array_keys($listofoppstatus);
// Complete with values found into database and not into the dictionary
foreach($valsamount as $key => $val) {
if (!in_array($key, $listofstatus)) {
$listofstatus[] = $key;
}
}
foreach ($listofstatus as $status)
{
$labelStatus = '';
$code = dol_getIdFromCode($db, $status, 'c_lead_status', 'rowid', 'code');
if ($code) $labelStatus = $langs->transnoentitiesnoconv("OppStatus".$code);
if (empty($labelStatus)) $labelStatus = $listofopplabel[$status];
if ($code) $labelStatus = $langs->transnoentitiesnoconv("OppStatus".$code);
if (empty($labelStatus)) $labelStatus = $listofopplabel[$status];
if (empty($labelStatus)) $labelStatus = $langs->transnoentitiesnoconv('OldValue', $status); // When id is id of an entry no more in dictionary for example.
//$labelStatus .= ' ('.$langs->trans("Coeff").': '.price2num($listofoppstatus[$status]).')';
//$labelStatus .= ' - '.price2num($listofoppstatus[$status]).'%';

View File

@@ -1317,7 +1317,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
// Zip / Town
print '<tr><td>'.$form->editfieldkey('Zip', 'zipcode', '', $object, 0).'</td><td>';
print $formcompany->select_ziptown($object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 0, 0, '', 'maxwidth100 quatrevingtpercent');
print $formcompany->select_ziptown($object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 0, 0, '', 'maxwidth100');
print '</td>';
if ($conf->browser->layout == 'phone') print '</tr><tr>';
print '<td class="tdtop">'.$form->editfieldkey('Town', 'town', '', $object, 0).'</td><td>';
@@ -1913,7 +1913,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
// Zip / Town
print '<tr><td>'.$form->editfieldkey('Zip', 'zipcode', '', $object, 0).'</td><td>';
print $formcompany->select_ziptown($object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 0, 0, '', 'maxwidth50onsmartphone');
print $formcompany->select_ziptown($object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 0, 0, '', 'maxwidth100');
print '</td>';
if ($conf->browser->layout == 'phone') print '</tr><tr>';
print '<td>'.$form->editfieldkey('Town', 'town', '', $object, 0).'</td><td>';

View File

@@ -3750,9 +3750,8 @@ class Societe extends CommonObject
if (!empty($tmp[1])) { // If $conf->global->MAIN_INFO_SOCIETE_STATE is "id:code:label"
$state_code = $tmp[1];
$state_label = $tmp[2];
} else // For backward compatibility
{
dol_syslog("Your state setup use an old syntax. Reedit it using setup area.", LOG_ERR);
} else { // For backward compatibility
dol_syslog("Your state setup use an old syntax (entity=".$conf->entity."). Reedit it using setup area.", LOG_ERR);
include_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
$state_code = getState($state_id, 2, $this->db); // This need a SQL request, but it's the old feature that should not be used anymore
$state_label = getState($state_id, 0, $this->db); // This need a SQL request, but it's the old feature that should not be used anymore

View File

@@ -768,7 +768,7 @@ if ($action == 'create' || $action == 'adduserldap')
print '<input type="hidden" name="action" value="adduserldap">';
if (is_array($liste) && count($liste))
{
print $form->selectarray('users', $liste, '', 1);
print $form->selectarray('users', $liste, '', 1, 0, 0, '', 0, 0, 0, '', 'maxwidth500');
print ajax_combobox('users');
}
print '</td><td class="center">';

View File

@@ -287,6 +287,7 @@ class SecurityTest extends PHPUnit\Framework\TestCase
$_POST["param8"]="Hacker<svg o&#110;load='console.log(&quot;123&quot;)'"; // html tag is not closed so it is not detected as html tag but is still harmfull
$_POST["param9"]='is_object($object) ? ($object->id < 10 ? round($object->id / 2, 2) : (2 * $user->id) * (int) substr($mysoc->zip, 1, 2)) : \'objnotdefined\'';
$_POST["param10"]='is_object($object) ? ($object->id < 10 ? round($object->id / 2, 2) : (2 * $user->id) * (int) substr($mysoc->zip, 1, 2)) : \'<abc>objnotdefined\'';
$_POST["param11"]=' Name <email@email.com> ';
$result=GETPOST('id', 'int'); // Must return nothing
print __METHOD__." result=".$result."\n";
@@ -334,6 +335,10 @@ class SecurityTest extends PHPUnit\Framework\TestCase
print __METHOD__." result=".$result."\n";
$this->assertEquals($_GET["param5"], $result);
$result=GETPOST("param6", 'alpha');
print __METHOD__." result=".$result."\n";
$this->assertEquals('\'\'>', $result);
$result=GETPOST("param6", 'nohtml');
print __METHOD__." result=".$result."\n";
$this->assertEquals('">', $result);
@@ -356,6 +361,14 @@ class SecurityTest extends PHPUnit\Framework\TestCase
print __METHOD__." result=".$result."\n";
$this->assertEquals($_POST["param9"], $result, 'We should get param9 after processing param10');
$result=GETPOST("param11", 'alphanohtml');
print __METHOD__." result=".$result."\n";
$this->assertEquals("Name", $result, 'Test an email string with alphanohtml');
$result=GETPOST("param11", 'alphawithlgt');
print __METHOD__." result=".$result."\n";
$this->assertEquals(trim($_POST["param11"]), $result, 'Test an email string with alphawithlgt');
return $result;
}