diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index f37ff79a1fa..e5c104298bf 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -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 '
'; print ''; print ''; -// Default mode for calculating turnover (parameter ACCOUNTING_MODE) -/* -print ''; - -print ''; -print ''; -print "\n"; -print ''; -print '\n"; -print ''; -print '\n"; - -print "
' . $langs->trans('OptionMode') . '' . $langs->trans('Description') . '
' . $langs->trans('OptionModeTrue') . '' . nl2br($langs->trans('OptionModeTrueDesc')); -// Write info on way to count VAT -// if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) -// { -// // print "
\n"; -// // print nl2br($langs->trans('OptionModeTrueInfoModuleComptabilite')); -// } -// else -// { -// // print "
\n"; -// // print nl2br($langs->trans('OptionModeTrueInfoExpert')); -// } -print "
' . $langs->trans('OptionModeVirtual') . '' . nl2br($langs->trans('OptionModeVirtualDesc')) . "
\n"; - - -print '
'; -*/ - // Params print ''; print ''; diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 3c28cdaab84..a06d2f25d8c 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -142,7 +142,7 @@ if (empty($reshook)) if ($massaction == 'ventil') { $msg = ''; - //print '
' . $langs->trans("Processing") . '...
'; + //print '
' . $langs->trans("Processing") . '...
'; if (!empty($mesCasesCochees)) { $msg = '
'.$langs->trans("SelectedLines").': '.count($mesCasesCochees).'
'; $msg .= '
'; @@ -157,7 +157,7 @@ if ($massaction == 'ventil') { if ($monCompte <= 0) { - $msg .= '
'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NoAccountSelected").'
'; + $msg .= '
'.$langs->trans("Lineofinvoice", $monId).' - '.$langs->trans("NoAccountSelected").'
'; $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 .= '
'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("VentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'
'; + $msg .= '
'.$langs->trans("Lineofinvoice", $monId).' - '.$langs->trans("VentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'
'; $ok++; } else { - $msg .= '
'.$langs->trans("ErrorDB").' : '.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NotVentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'
'.$sql.'
'; + $msg .= '
'.$langs->trans("ErrorDB").' : '.$langs->trans("Lineofinvoice", $monId).' - '.$langs->trans("NotVentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'
'.$sql.'
'; $ko++; } } diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php index 77b8c6e57b9..c2fb21a911b 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -124,7 +124,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; if ($massaction == 'ventil') { $msg = ''; - //print '
' . $langs->trans("Processing") . '...
'; + //print '
' . $langs->trans("Processing") . '...
'; if (!empty($mesCasesCochees)) { $msg = '
'.$langs->trans("SelectedLines").': '.count($mesCasesCochees).'
'; $msg .= '
'; @@ -139,7 +139,7 @@ if ($massaction == 'ventil') { if ($monCompte <= 0) { - $msg .= '
'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NoAccountSelected").'
'; + $msg .= '
'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NoAccountSelected").'
'; $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 .= '
'.$langs->trans("LineOfExpenseReport").' '.$monId.' - '.$langs->trans("VentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'
'; + $msg .= '
'.$langs->trans("LineOfExpenseReport").' '.$monId.' - '.$langs->trans("VentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'
'; $ok++; } else { - $msg .= '
'.$langs->trans("ErrorDB").' : '.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NotVentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'
'.$sql.'
'; + $msg .= '
'.$langs->trans("ErrorDB").' : '.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NotVentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'
'.$sql.'
'; $ko++; } } diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 12fe8792401..4dd5df83152 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -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 { diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index b24f8550e50..bf8275cee1c 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -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 { diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 779c04f68fa..8e409b497b5 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -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 { diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 998f34745ac..589bad72749 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -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 { diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 9e1668e1a35..96b36fa8fa3 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -146,7 +146,7 @@ if (empty($reshook)) if ($massaction == 'ventil') { $msg = ''; - //print '
' . $langs->trans("Processing") . '...
'; + //print '
' . $langs->trans("Processing") . '...
'; if (!empty($mesCasesCochees)) { $msg = '
'.$langs->trans("SelectedLines").': '.count($mesCasesCochees).'
'; $msg .= '
'; @@ -161,7 +161,7 @@ if ($massaction == 'ventil') { if ($monCompte <= 0) { - $msg .= '
'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NoAccountSelected").'
'; + $msg .= '
'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NoAccountSelected").'
'; $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 .= '
'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("VentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'
'; + $msg .= '
'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("VentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'
'; $ok++; } else { - $msg .= '
'.$langs->trans("ErrorDB").' : '.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NotVentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'
'.$sql.'
'; + $msg .= '
'.$langs->trans("ErrorDB").' : '.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NotVentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'
'.$sql.'
'; $ko++; } } diff --git a/htdocs/admin/export.php b/htdocs/admin/export.php index d066197b580..ae7faafa937 100644 --- a/htdocs/admin/export.php +++ b/htdocs/admin/export.php @@ -95,7 +95,7 @@ print '
'; print ''; print ''; -print '"; +print ''; print ''; print ''; diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 32ed91becbe..616c97f3bb9 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -317,7 +317,7 @@ print ''; $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 ''; @@ -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 ''; print ''; @@ -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 ''; print ''; @@ -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 ''; print ''; @@ -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 ''; print ''; @@ -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 ''; print ''; @@ -877,12 +877,14 @@ if ($type == Categorie::TYPE_USER) print ''; print '
'; - $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 "
'.$langs->trans("ExportCsvSeparator").''."global->EXPORT_CSV_SEPARATOR_TO_USE) ? ',' : $conf->global->EXPORT_CSV_SEPARATOR_TO_USE)."\">
\n"; - print ''."\n"; + print ''."\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; diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index 2f9182f1693..24650ea343f 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -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); diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 6bed3b96954..e179bd50797 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -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; diff --git a/htdocs/core/lib/json.lib.php b/htdocs/core/lib/json.lib.php index 57ed320afda..e4dfa3a0830 100644 --- a/htdocs/core/lib/json.lib.php +++ b/htdocs/core/lib/json.lib.php @@ -251,7 +251,7 @@ function dol_json_decode($json, $assoc = false) if ($out != '') { try { eval('$array = '.$out.';'); - } catch(Exception $e) { + } catch (Exception $e) { $array = array(); } } diff --git a/htdocs/core/lib/ticket.lib.php b/htdocs/core/lib/ticket.lib.php index 66729369af1..826e2d6bc98 100644 --- a/htdocs/core/lib/ticket.lib.php +++ b/htdocs/core/lib/ticket.lib.php @@ -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 .= '
'; $out .= ''; + $out .= ''; + if ($objcon && get_class($objcon) == 'Contact' && (is_null($filterobj) || get_class($filterobj) == 'Societe')) { diff --git a/htdocs/core/modules/export/export_csv.modules.php b/htdocs/core/modules/export/export_csv.modules.php index 973e7ae536a..f4691ceb611 100644 --- a/htdocs/core/modules/export/export_csv.modules.php +++ b/htdocs/core/modules/export/export_csv.modules.php @@ -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); diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php index 747cae06573..e769441288f 100644 --- a/htdocs/core/modules/modAccounting.class.php +++ b/htdocs/core/modules/modAccounting.class.php @@ -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 '; diff --git a/htdocs/core/modules/modBanque.class.php b/htdocs/core/modules/modBanque.class.php index 822ebd81e03..11912cf778a 100644 --- a/htdocs/core/modules/modBanque.class.php +++ b/htdocs/core/modules/modBanque.class.php @@ -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'; } diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 4b84a97fde0..b070b69b4c9 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -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; diff --git a/htdocs/exports/class/export.class.php b/htdocs/exports/class/export.class.php index 4d4b3626f75..c7d7f4eea89 100644 --- a/htdocs/exports/class/export.class.php +++ b/htdocs/exports/class/export.class.php @@ -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; } diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index 93d3139ca90..9fdc5330103 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -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)); diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql index 710dcedab65..e76948808bb 100644 --- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql +++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql @@ -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'; diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 464823810b2..adb87bcb8ca 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -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 diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 49274730aeb..1498639d731 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -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 purhcase 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 diff --git a/htdocs/langs/en_US/banks.lang b/htdocs/langs/en_US/banks.lang index 75f9549dca5..3cfa7ad2538 100644 --- a/htdocs/langs/en_US/banks.lang +++ b/htdocs/langs/en_US/banks.lang @@ -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 diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index cc489befd63..6cdf59a078a 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -118,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; } @@ -370,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; } diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index f7813066a4c..2264fb3d9ee 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -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; diff --git a/test/phpunit/ExportTest.php b/test/phpunit/ExportTest.php index cf1cafe74b1..2a3cb079baf 100644 --- a/test/phpunit/ExportTest.php +++ b/test/phpunit/ExportTest.php @@ -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 html
content
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');
'.$langs->trans("Users").' '.count($users).'
'.$langs->trans("Users").' '.$num.'