diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index d0f43cfe3dd..21077dececd 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -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 ''; print ''; - print ''.$langs->trans("Piece").''; + print ''.$langs->trans("Piece").''; print ''; print ''; @@ -594,7 +595,8 @@ if ($action == 'create') print ''."\n"; print ''."\n"; - print ""; + print '
'; + 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 ''; print ''; print ''; print ''; print ''; @@ -671,18 +676,21 @@ if ($action == 'create') if ($action == "" || $action == 'add') { print ''; + print ''; print ''; print ''; print ''; print ''; diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 59ffdf2e899..8dd7a3c529a 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -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), @@ -665,7 +665,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; @@ -688,11 +688,17 @@ print '
'; print $formaccounting->select_account((GETPOSTISSET("accountingaccount_number") ? GETPOST("accountingaccount_number", "alpha") : $line->numero_compte), 'accountingaccount_number', 1, array(), 1, 1, ''); print ''; - // 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 'subledger_account).'">'; } + // TODO Add also the label print 'label_operation).'">debit)).'">
'; print $formaccounting->select_account('', 'accountingaccount_number', 1, array(), 1, 1, ''); print ''; - // 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 ''; } + // TODO Add also the label print '
'; // Filters lines print ''; + // Movement number if (!empty($arrayfields['t.piece_num']['checked'])) { print ''; } +// Code journal +if (!empty($arrayfields['t.code_journal']['checked'])) +{ + print ''; +} // Date document if (!empty($arrayfields['t.doc_date']['checked'])) { @@ -781,13 +787,6 @@ if (!empty($arrayfields['t.lettering_code']['checked'])) print '
'.$langs->trans("NotReconciled").''; print ''; } -// Code journal -if (!empty($arrayfields['t.code_journal']['checked'])) -{ - print ''; -} // Fields from hook $parameters = array('arrayfields'=>$arrayfields); @@ -839,6 +838,7 @@ print "\n"; print ''; 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); @@ -847,7 +847,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 @@ -913,6 +912,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 ''; + if (!$i) $totalarray['nbfield']++; + } + // Document date if (!empty($arrayfields['t.doc_date']['checked'])) { @@ -1040,16 +1049,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 ''; - 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 diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 9c7fef0232b..21b8c51380d 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -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), @@ -428,7 +428,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'); } @@ -473,6 +473,11 @@ print '
'; - print $formaccounting->multi_select_journal($search_ledger_code, 'search_ledger_code', 0, 1, 1, 1); - print '
'.$journaltoshow.''.$journaltoshow.'
'; // Filters lines print ''; +// Movement number +if (!empty($arrayfields['t.piece_num']['checked'])) +{ + print ''; +} // Code journal if (!empty($arrayfields['t.code_journal']['checked'])) { print ''; } -// Movement number -if (!empty($arrayfields['t.piece_num']['checked'])) -{ - print ''; -} // Ref document if (!empty($arrayfields['t.doc_ref']['checked'])) { print ''; @@ -544,9 +544,9 @@ print ''; print "\n"; print ''; +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 '); @@ -637,6 +637,17 @@ while ($i < min($num, $limit)) print ''; + // Piece number + if (!empty($arrayfields['t.piece_num']['checked'])) + { + print ''; + if (!$i) $totalarray['nbfield']++; + } + // Journal code if (!empty($arrayfields['t.code_journal']['checked'])) { @@ -654,17 +665,6 @@ while ($i < min($num, $limit)) if (!$i) $totalarray['nbfield']++; } - // Piece number - if (!empty($arrayfields['t.piece_num']['checked'])) - { - print ''; - if (!$i) $totalarray['nbfield']++; - } - // Document ref if (!empty($arrayfields['t.doc_ref']['checked'])) { diff --git a/htdocs/accountancy/bookkeeping/listbysubaccount.php b/htdocs/accountancy/bookkeeping/listbysubaccount.php index 2adcbe9f360..4800fb779c6 100644 --- a/htdocs/accountancy/bookkeeping/listbysubaccount.php +++ b/htdocs/accountancy/bookkeeping/listbysubaccount.php @@ -135,8 +135,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), @@ -442,8 +442,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'); } @@ -502,6 +502,11 @@ print '
'; @@ -490,11 +495,6 @@ if (!empty($arrayfields['t.doc_date']['checked'])) { print ''; print '
'; + $object->id = $line->id; + $object->piece_num = $line->piece_num; + print $object->getNomUrl(1, '', 0, '', 1); + print ''; - $object->id = $line->id; - $object->piece_num = $line->piece_num; - print $object->getNomUrl(1, '', 0, '', 1); - print '
'; // Filters lines print ''; +// Movement number +if (!empty($arrayfields['t.piece_num']['checked'])) +{ + print ''; +} // Code journal if (!empty($arrayfields['t.code_journal']['checked'])) { print ''; } -// Movement number -if (!empty($arrayfields['t.piece_num']['checked'])) { - print ''; -} // Ref document if (!empty($arrayfields['t.doc_ref']['checked'])) { print ''; @@ -571,15 +572,15 @@ print ''; print "\n"; print ''; +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); } @@ -673,8 +674,10 @@ while ($i < min($num, $limit)) { print ''.$langs->trans("Unknown"); if ($line->subledger_label) { print ' ('.$line->subledger_label.')'; + $htmltext = 'EmptyStringForSubledgerAccountButSubledgerLabelDefined'; + } else { + $htmltext = 'EmptyStringForSubledgerAccountAndSubledgerLabel'; } - $htmltext = 'EmptyStringForSubledgerAccountButSubledgerLabelDefined'; print $form->textwithpicto('', $htmltext); print ''; } @@ -691,6 +694,17 @@ while ($i < min($num, $limit)) { print ''; + // Piece number + if (!empty($arrayfields['t.piece_num']['checked'])) + { + print ''; + if (!$i) $totalarray['nbfield']++; + } + // Journal code if (!empty($arrayfields['t.code_journal']['checked'])) { $accountingjournal = new AccountingJournal($db); @@ -710,6 +724,7 @@ while ($i < min($num, $limit)) { } } +<<<<<<< HEAD // Piece number if (!empty($arrayfields['t.piece_num']['checked'])) { print '
'; @@ -519,10 +524,6 @@ if (!empty($arrayfields['t.doc_date']['checked'])) { print ''; print '
'; + $object->id = $line->id; + $object->piece_num = $line->piece_num; + print $object->getNomUrl(1, '', 0, '', 1); + print ''; @@ -722,6 +737,8 @@ while ($i < min($num, $limit)) { } } +======= +>>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git // Document ref if (!empty($arrayfields['t.doc_ref']['checked'])) { if ($line->doc_type == 'customer_invoice') { diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 201e3cac95a..b936f99925a 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -820,6 +820,8 @@ class AccountancyExport */ public function exportFEC($objectLines) { + global $langs; + $separator = "\t"; $end_line = "\r\n"; @@ -855,55 +857,55 @@ class AccountancyExport $date_limit_payment = dol_print_date($line->date_lim_reglement, '%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 length_accountg($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 length_accounta($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 $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.$separator; @@ -924,6 +926,8 @@ class AccountancyExport */ public function exportFEC2($objectLines) { + global $langs; + $separator = "\t"; $end_line = "\r\n"; @@ -962,7 +966,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; @@ -1644,15 +1648,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; } } diff --git a/htdocs/accountancy/class/accountingjournal.class.php b/htdocs/accountancy/class/accountingjournal.class.php index a76be081471..6ee8a03d8ff 100644 --- a/htdocs/accountancy/class/accountingjournal.class.php +++ b/htdocs/accountancy/class/accountingjournal.class.php @@ -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; diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index fe73ab9f376..f21d88bc363 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -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); } diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index d353041234f..c47255647cb 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -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 = ''; diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index 26e2b4cdf77..70ec097cd27 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -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; diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 94f878527dd..611dde36af5 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -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; diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 9f44e02aafa..62d2238a116 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -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; diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index dc0ada64eb3..016201be0f3 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -454,6 +454,15 @@ $viewmode .= ''; +// Add more views from hooks +$parameters = array(); $object = null; +$reshook = $hookmanager->executeHooks('addCalendarView', $parameters, $object, $action); +if (empty($reshook)) { + $viewmode .= $hookmanager->resPrint; +} elseif ($reshook > 1) { + $viewmode = $hookmanager->resPrint; +} + $newcardbutton = ''; if ($user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create) diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 7fc58b73c9f..16c2a315cdd 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -474,11 +474,9 @@ if ($resql) // Calendars from hooks $parameters = array(); $object = null; $reshook = $hookmanager->executeHooks('addCalendarChoice', $parameters, $object, $action); - if (empty($reshook)) - { + if (empty($reshook)) { $s .= $hookmanager->resPrint; - } elseif ($reshook > 1) - { + } elseif ($reshook > 1) { $s = $hookmanager->resPrint; } @@ -515,6 +513,15 @@ if ($resql) $viewmode .= ''; + // Add more views from hooks + $parameters = array(); $object = null; + $reshook = $hookmanager->executeHooks('addCalendarView', $parameters, $object, $action); + if (empty($reshook)) { + $viewmode .= $hookmanager->resPrint; + } elseif ($reshook > 1) { + $viewmode = $hookmanager->resPrint; + } + $tmpforcreatebutton = dol_getdate(dol_now(), true); $newparam .= '&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$tmpforcreatebutton['year']; diff --git a/htdocs/comm/action/pertype.php b/htdocs/comm/action/pertype.php index 29b86b96868..f956b5ae5f7 100644 --- a/htdocs/comm/action/pertype.php +++ b/htdocs/comm/action/pertype.php @@ -384,6 +384,15 @@ $viewmode .= ''; +// Add more views from hooks +$parameters = array(); $object = null; +$reshook = $hookmanager->executeHooks('addCalendarView', $parameters, $object, $action); +if (empty($reshook)) { + $viewmode .= $hookmanager->resPrint; +} elseif ($reshook > 1) { + $viewmode = $hookmanager->resPrint; +} + $newcardbutton = ''; if ($user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create) diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 55e6725ba8d..2dc62a52e91 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -389,6 +389,15 @@ $viewmode .= ''; +// Add more views from hooks +$parameters = array(); $object = null; +$reshook = $hookmanager->executeHooks('addCalendarView', $parameters, $object, $action); +if (empty($reshook)) { + $viewmode .= $hookmanager->resPrint; +} elseif ($reshook > 1) { + $viewmode = $hookmanager->resPrint; +} + $newcardbutton = ''; if ($user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create) diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index 89b5a79df4b..d610203b3ad 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -156,6 +156,7 @@ class HookManager $method, array( 'addCalendarChoice', + 'addCalendarView', 'addMoreActionsButtons', 'addMoreMassActions', 'addSearchEntry', diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index b66fcb77029..f1cb972ee03 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6497,8 +6497,7 @@ class Form $value = $tmpvalue; $disabled = ''; $style = ''; } - if (!empty($disablebademail)) - { + if (!empty($disablebademail)) { if (($disablebademail == 1 && !preg_match('/<.+@.+>/', $value)) || ($disablebademail == 2 && preg_match('/---/', $value))) { @@ -6507,8 +6506,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 { diff --git a/htdocs/core/class/html.formaccounting.class.php b/htdocs/core/class/html.formaccounting.class.php index 512e38072d0..e6236adffc5 100644 --- a/htdocs/core/class/html.formaccounting.class.php +++ b/htdocs/core/class/html.formaccounting.class.php @@ -427,7 +427,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 @@ -452,7 +452,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.' ('.$obj->nom.')'; } } } else { @@ -472,7 +472,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.' ('.$obj->nom.')'; } } } else { @@ -492,7 +492,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.' ('.dolGetFirstLastname($obj->firstname, $obj->lastname).')'; } } } else { diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index 26e184eb614..d9d0442e49e 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -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 diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 4722d5c5cbc..92748f8e26f 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -253,7 +253,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 diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 8318291753f..31d51ff290e 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -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('"', '"'), "", trim($out)); + $out = str_replace(array('../'), '', $out); + } + break; case 'restricthtml': // Recommended for most html textarea $out = dol_string_onlythesehtmltags($out, 0, 1, 1); break; diff --git a/htdocs/core/tpl/card_presend.tpl.php b/htdocs/core/tpl/card_presend.tpl.php index 92a767a23ea..5d3381b2719 100644 --- a/htdocs/core/tpl/card_presend.tpl.php +++ b/htdocs/core/tpl/card_presend.tpl.php @@ -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; diff --git a/htdocs/install/mysql/tables/llx_accounting_bookkeeping.sql b/htdocs/install/mysql/tables/llx_accounting_bookkeeping.sql index 3a612623298..dae9eb79c42 100644 --- a/htdocs/install/mysql/tables/llx_accounting_bookkeeping.sql +++ b/htdocs/install/mysql/tables/llx_accounting_bookkeeping.sql @@ -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; diff --git a/htdocs/modulebuilder/template/README.md b/htdocs/modulebuilder/template/README.md index c3afa63e1b7..45c5e4b51eb 100644 --- a/htdocs/modulebuilder/template/README.md +++ b/htdocs/modulebuilder/template/README.md @@ -2,17 +2,17 @@ ## Features -Description... +Description of the module... -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*.