diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 692d70f4b68..44225dfca6b 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -644,8 +644,8 @@ if ($action == 'create') { print_liste_field_titre("AccountAccountingShort"); print_liste_field_titre("SubledgerAccount"); print_liste_field_titre("LabelOperation"); - print_liste_field_titre("Debit", "", "", "", "", 'class="right"'); - print_liste_field_titre("Credit", "", "", "", "", 'class="right"'); + print_liste_field_titre("AccountingDebit", "", "", "", "", 'class="right"'); + print_liste_field_titre("AccountingCredit", "", "", "", "", 'class="right"'); if (empty($object->date_validation)) { print_liste_field_titre("Action", "", "", "", "", 'width="60"', "", "", 'center '); } else { diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 1f4580787da..f0e95c3efb7 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -192,8 +192,8 @@ $arrayfields = array( 't.numero_compte'=>array('label'=>$langs->trans("AccountAccountingShort"), 'checked'=>1), 't.subledger_account'=>array('label'=>$langs->trans("SubledgerAccount"), 'checked'=>1), 't.label_operation'=>array('label'=>$langs->trans("Label"), 'checked'=>1), - 't.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1), - 't.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1), + 't.debit'=>array('label'=>$langs->trans("AccountingDebit"), 'checked'=>1), + 't.credit'=>array('label'=>$langs->trans("AccountingCredit"), 'checked'=>1), 't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1), 't.date_creation'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0), 't.tms'=>array('label'=>$langs->trans("DateModification"), 'checked'=>0), diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 0ec1a0b1090..06a84af4a97 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -163,8 +163,8 @@ $arrayfields = array( '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), - 't.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1), - 't.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1), + 't.debit'=>array('label'=>$langs->trans("AccountingDebit"), 'checked'=>1), + 't.credit'=>array('label'=>$langs->trans("AccountingCredit"), 'checked'=>1), 't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1), 't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>1), 't.date_validated'=>array('label'=>$langs->trans("DateValidation"), 'checked'=>1, 'enabled'=>!getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")), diff --git a/htdocs/accountancy/class/accountingjournal.class.php b/htdocs/accountancy/class/accountingjournal.class.php index ca6ea8cd5e5..4accf66e154 100644 --- a/htdocs/accountancy/class/accountingjournal.class.php +++ b/htdocs/accountancy/class/accountingjournal.class.php @@ -987,8 +987,8 @@ class AccountingJournal extends CommonObject $langs->transnoentitiesnoconv("LedgerAccount"), $langs->transnoentitiesnoconv("SubledgerAccount"), $langs->transnoentitiesnoconv("Label"), - $langs->transnoentitiesnoconv("Debit"), - $langs->transnoentitiesnoconv("Credit"), + $langs->transnoentitiesnoconv("AccountingDebit"), + $langs->transnoentitiesnoconv("AccountingCredit"), $langs->transnoentitiesnoconv("Journal"), $langs->transnoentitiesnoconv("Note"), ); @@ -998,8 +998,8 @@ class AccountingJournal extends CommonObject $langs->transnoentitiesnoconv("Piece"), $langs->transnoentitiesnoconv("AccountAccounting"), $langs->transnoentitiesnoconv("LabelOperation"), - $langs->transnoentitiesnoconv("Debit"), - $langs->transnoentitiesnoconv("Credit"), + $langs->transnoentitiesnoconv("AccountingDebit"), + $langs->transnoentitiesnoconv("AccountingCredit"), ); } elseif ($this->nature == 1) { $header = array( @@ -1007,8 +1007,8 @@ class AccountingJournal extends CommonObject $langs->transnoentitiesnoconv("Piece"), $langs->transnoentitiesnoconv("AccountAccounting"), $langs->transnoentitiesnoconv("LabelOperation"), - $langs->transnoentitiesnoconv("Debit"), - $langs->transnoentitiesnoconv("Credit"), + $langs->transnoentitiesnoconv("AccountingDebit"), + $langs->transnoentitiesnoconv("AccountingCredit"), ); } diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 3a2f4c40750..407dbc1aa53 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -912,8 +912,8 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! print '"'.$langs->transnoentitiesnoconv("LedgerAccount").'"'.$sep; print '"'.$langs->transnoentitiesnoconv("SubledgerAccount").'"'.$sep; print '"'.$langs->transnoentitiesnoconv("Label").'"'.$sep; - print '"'.$langs->transnoentitiesnoconv("Debit").'"'.$sep; - print '"'.$langs->transnoentitiesnoconv("Credit").'"'.$sep; + print '"'.$langs->transnoentitiesnoconv("AccountingDebit").'"'.$sep; + print '"'.$langs->transnoentitiesnoconv("AccountingCredit").'"'.$sep; print '"'.$langs->transnoentitiesnoconv("Journal").'"'.$sep; print '"'.$langs->transnoentitiesnoconv("Note").'"'.$sep; print "\n"; @@ -1136,8 +1136,8 @@ if (empty($action) || $action == 'view') { print "".$langs->trans("SubledgerAccount").""; print "".$langs->trans("LabelOperation").""; print ''.$langs->trans("PaymentMode").""; - print ''.$langs->trans("Debit").""; - print ''.$langs->trans("Credit").""; + print ''.$langs->trans("AccountingDebit").""; + print ''.$langs->trans("AccountingCredit").""; print "\n"; $r = ''; diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index 68e7ebda6ae..ffffc21a9f9 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -445,8 +445,8 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! print '"'.$langs->transnoentitiesnoconv("Piece").'"'.$sep; print '"'.$langs->transnoentitiesnoconv("AccountAccounting").'"'.$sep; print '"'.$langs->transnoentitiesnoconv("LabelOperation").'"'.$sep; - print '"'.$langs->transnoentitiesnoconv("Debit").'"'.$sep; - print '"'.$langs->transnoentitiesnoconv("Credit").'"'.$sep; + print '"'.$langs->transnoentitiesnoconv("AccountingDebit").'"'.$sep; + print '"'.$langs->transnoentitiesnoconv("AccountingCredit").'"'.$sep; print "\n"; foreach ($taber as $key => $val) { @@ -569,8 +569,8 @@ if (empty($action) || $action == 'view') { print "".$langs->trans("AccountAccounting").""; print "".$langs->trans("SubledgerAccount").""; print "".$langs->trans("LabelOperation").""; - print ''.$langs->trans("Debit").""; - print ''.$langs->trans("Credit").""; + print ''.$langs->trans("AccountingDebit").""; + print ''.$langs->trans("AccountingCredit").""; print "\n"; $r = ''; diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 248b0e41267..a5b82e7b2d0 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -833,8 +833,8 @@ if (empty($action) || $action == 'view') { print "".$langs->trans("AccountAccounting").""; print "".$langs->trans("SubledgerAccount").""; print "".$langs->trans("LabelOperation").""; - print ''.$langs->trans("Debit").""; - print ''.$langs->trans("Credit").""; + print ''.$langs->trans("AccountingDebit").""; + print ''.$langs->trans("AccountingCredit").""; print "\n"; $r = ''; diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 624b5a22335..0519762baef 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -776,8 +776,8 @@ if (empty($action) || $action == 'view') { print "".$langs->trans("AccountAccounting").""; print "".$langs->trans("SubledgerAccount").""; print "".$langs->trans("LabelOperation").""; - print ''.$langs->trans("Debit").""; - print ''.$langs->trans("Credit").""; + print ''.$langs->trans("AccountingDebit").""; + print ''.$langs->trans("AccountingCredit").""; print "\n"; $r = ''; diff --git a/htdocs/accountancy/journal/variousjournal.php b/htdocs/accountancy/journal/variousjournal.php index b58953043ff..cf652a29345 100644 --- a/htdocs/accountancy/journal/variousjournal.php +++ b/htdocs/accountancy/journal/variousjournal.php @@ -286,8 +286,8 @@ print '' . $langs->trans("AccountAccounting") . ''; print '' . $langs->trans("SubledgerAccount") . ''; print '' . $langs->trans("LabelOperation") . ''; if ($object->nature == 4) print '' . $langs->trans("PaymentMode") . ''; // bank -print '' . $langs->trans("Debit") . ''; -print '' . $langs->trans("Credit") . ''; +print '' . $langs->trans("AccountingDebit") . ''; +print '' . $langs->trans("AccountingCredit") . ''; print "\n"; if (is_array($journal_data) && !empty($journal_data)) { diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 346fa2f0aea..d928931c9ab 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1966,7 +1966,7 @@ if ($id > 0) { $valuetoshow = ($key != "Country".strtoupper($obj->country_code) ? $obj->country_code." - ".$key : $obj->country); } } elseif ($value == 'recuperableonly' || $value == 'deductible' || $value == 'category_type') { - $valuetoshow = yn($valuetoshow); + $valuetoshow = yn($valuetoshow ? 1 : 0); $class = "center"; } elseif ($value == 'type_cdr') { if (empty($valuetoshow)) { diff --git a/htdocs/compta/bank/annuel.php b/htdocs/compta/bank/annuel.php index 610cf17498c..177855c9302 100644 --- a/htdocs/compta/bank/annuel.php +++ b/htdocs/compta/bank/annuel.php @@ -39,6 +39,9 @@ $HEIGHT = DolGraph::getDefaultGraphSizeForStats('height', 160); $id = GETPOST('account') ?GETPOST('account', 'alpha') : GETPOST('id'); $ref = GETPOST('ref'); +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('bankannualreport', 'globalcard')); + // Security check $fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : '')); $fieldtype = (!empty($ref) ? 'ref' : 'rowid'); diff --git a/htdocs/compta/bank/document.php b/htdocs/compta/bank/document.php index 595d627609b..0960b984c04 100644 --- a/htdocs/compta/bank/document.php +++ b/htdocs/compta/bank/document.php @@ -38,6 +38,9 @@ $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('bankaccountdocuments', 'globalcard')); + // Security check if ($user->socid) { $action = ''; diff --git a/htdocs/compta/bank/graph.php b/htdocs/compta/bank/graph.php index a3fd0b0b15b..c11e13f1e71 100644 --- a/htdocs/compta/bank/graph.php +++ b/htdocs/compta/bank/graph.php @@ -35,6 +35,9 @@ $langs->loadLangs(array('banks', 'categories')); $WIDTH = DolGraph::getDefaultGraphSizeForStats('width', 768); $HEIGHT = DolGraph::getDefaultGraphSizeForStats('height', 200); +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('bankstats', 'globalcard')); + // Security check if (GETPOST('account') || GETPOST('ref')) { $id = GETPOST('account') ? GETPOST('account') : GETPOST('ref'); diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index 8f5e7f29069..2e532984d99 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -62,6 +62,9 @@ $newbankreceipt = GETPOST('newbankreceipt', 'alpha'); $rel = GETPOST("rel", 'alphanohtml'); $backtopage = GETPOST('backtopage', 'alpha'); +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('bankaccountstatement', 'globalcard')); + // Security check $fieldid = (!empty($ref) ? $ref : $id); $fieldname = (!empty($ref) ? 'ref' : 'rowid'); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 7cc4be35f70..87d28de8756 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -171,6 +171,8 @@ class Facture extends CommonInvoice public $total_ttc; public $revenuestamp; + public $resteapayer; + /** * ! Closing after partial payment: discount_vat, badcustomer or badsupplier, bankcharge, other * ! Closing when no payment: replaced, abandoned diff --git a/htdocs/compta/journal/purchasesjournal.php b/htdocs/compta/journal/purchasesjournal.php index e71a85004d1..dee5d8d628e 100644 --- a/htdocs/compta/journal/purchasesjournal.php +++ b/htdocs/compta/journal/purchasesjournal.php @@ -198,7 +198,9 @@ print ""; print "".$langs->trans("Date").""; print "".$langs->trans("Piece").' ('.$langs->trans("InvoiceRef").")"; print "".$langs->trans("Account").""; -print "".$langs->trans("Type")."".$langs->trans("Debit")."".$langs->trans("Credit").""; +print "".$langs->trans("Type").""; +print "".$langs->trans("AccountingDebit").""; +print "".$langs->trans("AccountingCredit").""; print "\n"; diff --git a/htdocs/compta/journal/sellsjournal.php b/htdocs/compta/journal/sellsjournal.php index 0fc5a192271..c3846280ee3 100644 --- a/htdocs/compta/journal/sellsjournal.php +++ b/htdocs/compta/journal/sellsjournal.php @@ -242,7 +242,9 @@ print ''; //print "".$langs->trans("JournalNum").""; print ''.$langs->trans('Date').''.$langs->trans('Piece').' ('.$langs->trans('InvoiceRef').')'; print ''.$langs->trans('Account').''; -print ''.$langs->trans('Type').''.$langs->trans('Debit').''.$langs->trans('Credit').''; +print ''.$langs->trans('Type').''; +print ''.$langs->trans('AccountingDebit').''; +print ''.$langs->trans('AccountingCredit').''; print "\n"; diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index eb76b7a7af7..5fdf7220662 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -1166,7 +1166,7 @@ if ($modecompta == 'BOOKKEEPING') { } print ''; print ' '; - print "".$langs->trans("Debit")."\n"; + print "".$langs->trans("AccountingDebit")."\n"; print ''; if ($modecompta == 'CREANCES-DETTES') { print ''.price(-$obj->amount).''; @@ -1185,7 +1185,7 @@ if ($modecompta == 'BOOKKEEPING') { $total_ttc_income += $obj->amount; } print ' '; - print "".$langs->trans("Credit")."\n"; + print "".$langs->trans("AccountingCredit")."\n"; print ''; if ($modecompta == 'CREANCES-DETTES') { print ''.price($obj->amount).''; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 7e78549e0fa..80011c8e885 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6270,7 +6270,7 @@ abstract class CommonObject case 'date': case 'datetime': // If data is a string instead of a timestamp, we convert it - if (!is_int($this->array_options[$key])) { + if (!is_numeric($this->array_options[$key]) || $this->array_options[$key] != intval($this->array_options[$key])) { $this->array_options[$key] = strtotime($this->array_options[$key]); } $new_array_options[$key] = $this->db->idate($this->array_options[$key]); @@ -8057,8 +8057,9 @@ abstract class CommonObject $out = ''; - $parameters = array(); + $parameters = array('mode'=>$mode, 'params'=>$params, 'keysuffix'=>$keysuffix, 'keyprefix'=>$keyprefix, 'display_type'=>$display_type); $reshook = $hookmanager->executeHooks('showOptionals', $parameters, $this, $action); // Note that $action and $object may have been modified by hook + if (empty($reshook)) { if (is_array($extrafields->attributes[$this->table_element]) && key_exists('label', $extrafields->attributes[$this->table_element]) && is_array($extrafields->attributes[$this->table_element]['label']) && count($extrafields->attributes[$this->table_element]['label']) > 0) { $out .= "\n"; diff --git a/htdocs/core/lib/expensereport.lib.php b/htdocs/core/lib/expensereport.lib.php index 19e2e0ca00d..ae9ca936c47 100644 --- a/htdocs/core/lib/expensereport.lib.php +++ b/htdocs/core/lib/expensereport.lib.php @@ -1,5 +1,6 @@ + * Copyright (C) 2022 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -130,11 +131,14 @@ function payment_expensereport_prepare_head(PaymentExpenseReport $object) */ function expensereport_admin_prepare_head() { - global $langs, $conf, $user; + global $langs, $conf, $user, $db; $h = 0; $head = array(); + $extrafields = new ExtraFields($db); + $extrafields->fetch_name_optionals_label('expensereport'); + $h = 0; $head[$h][0] = DOL_URL_ROOT."/admin/expensereport.php"; @@ -162,6 +166,10 @@ function expensereport_admin_prepare_head() $head[$h][0] = DOL_URL_ROOT.'/admin/expensereport_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFields"); + $nbExtrafields = $extrafields->attributes['expensereport']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'attributes'; $h++; diff --git a/htdocs/core/lib/fourn.lib.php b/htdocs/core/lib/fourn.lib.php index 93ac290e08c..c658916e359 100644 --- a/htdocs/core/lib/fourn.lib.php +++ b/htdocs/core/lib/fourn.lib.php @@ -3,6 +3,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2006 Marc Barilley * Copyright (C) 2011-2013 Philippe Grand + * Copyright (C) 2022 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -249,7 +250,13 @@ function ordersupplier_prepare_head(CommandeFournisseur $object) */ function supplierorder_admin_prepare_head() { - global $langs, $conf, $user; + global $langs, $conf, $user, $db; + + $extrafields = new ExtraFields($db); + $extrafields->fetch_name_optionals_label('commande_fournisseur'); + $extrafields->fetch_name_optionals_label('commande_fournisseurdet'); + $extrafields->fetch_name_optionals_label('facture_fourn'); + $extrafields->fetch_name_optionals_label('facture_fourn_det'); $h = 0; $head = array(); @@ -273,21 +280,37 @@ function supplierorder_admin_prepare_head() $head[$h][0] = DOL_URL_ROOT.'/admin/supplierorder_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsSupplierOrders"); + $nbExtrafields = $extrafields->attributes['commande_fournisseur']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'supplierorder'; $h++; $head[$h][0] = DOL_URL_ROOT.'/admin/supplierorderdet_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsSupplierOrdersLines"); + $nbExtrafields = $extrafields->attributes['commande_fournisseurdet']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'supplierorderdet'; $h++; $head[$h][0] = DOL_URL_ROOT.'/admin/supplierinvoice_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsSupplierInvoices"); + $nbExtrafields = $extrafields->attributes['facture_fourn']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'supplierinvoice'; $h++; $head[$h][0] = DOL_URL_ROOT.'/admin/supplierinvoicedet_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsSupplierInvoicesLines"); + $nbExtrafields = $extrafields->attributes['facture_fourn_det']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'supplierinvoicedet'; $h++; diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 8003c414dcb..9295c749732 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -2234,7 +2234,11 @@ function dolGetElementUrl($objectid, $objecttype, $withpicto = 0, $option = '') $classpath = 'compta/facture/class'; $classfile = 'facture-rec'; $classname = 'FactureRec'; - $module='facture'; + $module = 'facture'; + } elseif ($objecttype == 'mailing') { + $classpath = 'comm/mailing/class'; + $classfile = 'mailing'; + $classname = 'Mailing'; } if (isModEnabled($module)) { diff --git a/htdocs/core/lib/holiday.lib.php b/htdocs/core/lib/holiday.lib.php index 4f6da9f6d51..eb0ca243c90 100644 --- a/htdocs/core/lib/holiday.lib.php +++ b/htdocs/core/lib/holiday.lib.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2006-2011 Laurent Destailleur + * Copyright (C) 2022 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,7 +19,7 @@ /** * \file htdocs/core/lib/holiday.lib.php - * \brief Ensemble de fonctions de base pour les adherents + * \brief base functions for holiday */ /** @@ -53,6 +54,8 @@ function holiday_prepare_head($object) $head[$h][2] = 'documents'; $h++; + complete_head_from_modules($conf, $langs, $object, $head, $h, 'holiday', 'add', 'core'); + $head[$h][0] = DOL_URL_ROOT.'/holiday/info.php?id='.$object->id; $head[$h][1] = $langs->trans("Info"); $head[$h][2] = 'info'; @@ -62,7 +65,7 @@ function holiday_prepare_head($object) // Entries must be declared in modules descriptor with line // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab // $this->tabs = array('entity:-tabname); to remove a tab - complete_head_from_modules($conf, $langs, $object, $head, $h, 'holiday'); + complete_head_from_modules($conf, $langs, $object, $head, $h, 'holiday', 'add', 'external'); complete_head_from_modules($conf, $langs, $object, $head, $h, 'holiday', 'remove'); @@ -79,6 +82,9 @@ function holiday_admin_prepare_head() { global $db, $langs, $conf, $user; + $extrafields = new ExtraFields($db); + $extrafields->fetch_name_optionals_label('holiday'); + $h = 0; $head = array(); @@ -95,6 +101,10 @@ function holiday_admin_prepare_head() $head[$h][0] = DOL_URL_ROOT.'/admin/holiday_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFields"); + $nbExtrafields = $extrafields->attributes['holiday']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'attributes'; $h++; diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index 79d8ac57834..e919bf2c8b6 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -374,7 +374,10 @@ function product_admin_prepare_head() */ function product_lot_admin_prepare_head() { - global $langs, $conf, $user; + global $langs, $conf, $user, $db; + + $extrafields = new ExtraFields($db); + $extrafields->fetch_name_optionals_label('product_lot'); $h = 0; $head = array(); @@ -392,6 +395,10 @@ function product_lot_admin_prepare_head() $head[$h][0] = DOL_URL_ROOT.'/product/admin/product_lot_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFields"); + $nbExtrafields = $extrafields->attributes['product_lot']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'attributes'; $h++; diff --git a/htdocs/core/lib/reception.lib.php b/htdocs/core/lib/reception.lib.php index 7f5c6e865de..e697908e8cb 100644 --- a/htdocs/core/lib/reception.lib.php +++ b/htdocs/core/lib/reception.lib.php @@ -110,9 +110,13 @@ function reception_prepare_head(Reception $object) */ function reception_admin_prepare_head() { - global $langs, $conf, $user; + global $langs, $conf, $user, $db; $langs->load("receptions"); + $extrafields = new ExtraFields($db); + $extrafields->fetch_name_optionals_label('reception'); + $extrafields->fetch_name_optionals_label('commande_fournisseur_dispatch'); + $h = 0; $head = array(); @@ -126,6 +130,10 @@ function reception_admin_prepare_head() if (!empty($conf->global->MAIN_SUBMODULE_RECEPTION)) { $head[$h][0] = DOL_URL_ROOT.'/admin/reception_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFields"); + $nbExtrafields = $extrafields->attributes['reception']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'attributes_reception'; $h++; } @@ -133,6 +141,10 @@ function reception_admin_prepare_head() if (!empty($conf->global->MAIN_SUBMODULE_RECEPTION)) { $head[$h][0] = DOL_URL_ROOT.'/admin/commande_fournisseur_dispatch_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsLines"); + $nbExtrafields = $extrafields->attributes['commande_fournisseur_dispatch']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'attributeslines_reception'; $h++; } diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index 287a151f41c..8f19a273586 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -191,7 +191,23 @@ if (!function_exists('dol_loginfunction')) { // and the conf file is loaded. $prefix = dol_getprefix(''); $sessiontimeout = 'DOLSESSTIMEOUT_'.$prefix; + if (!empty($conf->global->MAIN_SESSION_TIMEOUT)) { + if (PHP_VERSION_ID < 70300) { + session_set_cookie_params(0, '/', null, ((empty($dolibarr_main_force_https) && isHTTPS() === false) ? false : true), true); // Add tag secure and httponly on session cookie (same as setting session.cookie_httponly into php.ini). Must be called before the session_start. + } else { + // Only available for php >= 7.3 + $sessioncookieparams = array( + 'lifetime' => 0, + 'path' => '/', + //'domain' => '.mywebsite.com', // the dot at the beginning allows compatibility with subdomains + 'secure' => ((empty($dolibarr_main_force_https) && isHTTPS() === false) ? false : true), + 'httponly' => true, + 'samesite' => 'Lax' // None || Lax || Strict + ); + session_set_cookie_params($sessioncookieparams); + } + setcookie($sessiontimeout, $conf->global->MAIN_SESSION_TIMEOUT, 0, "/", null, (empty($dolibarr_main_force_https) ? false : true), true); } diff --git a/htdocs/core/lib/supplier_proposal.lib.php b/htdocs/core/lib/supplier_proposal.lib.php index 3c9915bc951..11c0786802f 100644 --- a/htdocs/core/lib/supplier_proposal.lib.php +++ b/htdocs/core/lib/supplier_proposal.lib.php @@ -1,6 +1,7 @@ * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2022 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -110,7 +111,11 @@ function supplier_proposal_prepare_head($object) */ function supplier_proposal_admin_prepare_head() { - global $langs, $conf, $user; + global $langs, $conf, $user, $db; + + $extrafields = new ExtraFields($db); + $extrafields->fetch_name_optionals_label('supplier_proposal'); + $extrafields->fetch_name_optionals_label('supplier_proposaldet'); $h = 0; $head = array(); @@ -128,11 +133,19 @@ function supplier_proposal_admin_prepare_head() $head[$h][0] = DOL_URL_ROOT.'/supplier_proposal/admin/supplier_proposal_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFields"); + $nbExtrafields = $extrafields->attributes['supplier_proposal']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'attributes'; $h++; $head[$h][0] = DOL_URL_ROOT.'/supplier_proposal/admin/supplier_proposaldet_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsLines"); + $nbExtrafields = $extrafields->attributes['supplier_proposaldet']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'attributeslines'; $h++; diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index 940c4fb2f9a..5224f82a2f5 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -860,7 +860,7 @@ class modProduct extends DolibarrModules )); } - $this->import_updatekeys_array[$r] = array('sp.fk_product'=>'ProductOrService', 'sp.ref_fourn'=>'SupplierRef', 'sp.fk_soc'=>'Supplier'); + $this->import_updatekeys_array[$r] = array('sp.fk_product'=>'ProductOrService', 'sp.ref_fourn'=>'SupplierRef', 'sp.fk_soc'=>'Supplier', 'sp.quantity'=>"QtyMin"); } if (!empty($conf->global->PRODUIT_MULTIPRICES)) { diff --git a/htdocs/install/doctemplates/proposals/template_proposal.odt b/htdocs/install/doctemplates/proposals/template_proposal.odt index 8ece83c989c..31981d8c120 100644 Binary files a/htdocs/install/doctemplates/proposals/template_proposal.odt and b/htdocs/install/doctemplates/proposals/template_proposal.odt differ diff --git a/htdocs/install/doctemplates/recruitment/template_recruitment.odt b/htdocs/install/doctemplates/recruitment/template_recruitment.odt new file mode 100644 index 00000000000..5955d47e206 Binary files /dev/null and b/htdocs/install/doctemplates/recruitment/template_recruitment.odt differ diff --git a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql index e40204ea497..ba633ec671a 100644 --- a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql +++ b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql @@ -54,6 +54,8 @@ ALTER TABLE llx_user DROP COLUMN idpers3; UPDATE llx_c_actioncomm SET type = 'system' WHERE code = 'AC_OTH'; +ALTER TABLE llx_opensurvey_user_studs MODIFY reponses VARCHAR(200) NOT NULL; + -- v17 ALTER TABLE llx_mailing_cibles MODIFY COLUMN source_type varchar(32); diff --git a/htdocs/install/mysql/tables/llx_opensurvey_user_studs-opensurvey.sql b/htdocs/install/mysql/tables/llx_opensurvey_user_studs-opensurvey.sql index d0d1c2a06b8..e139816c3fa 100644 --- a/htdocs/install/mysql/tables/llx_opensurvey_user_studs-opensurvey.sql +++ b/htdocs/install/mysql/tables/llx_opensurvey_user_studs-opensurvey.sql @@ -19,7 +19,7 @@ CREATE TABLE llx_opensurvey_user_studs ( id_users INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, nom VARCHAR(64) NOT NULL, id_sondage VARCHAR(16) NOT NULL, - reponses VARCHAR(100) NOT NULL, -- Not used for 'F' surveys + reponses VARCHAR(200) NOT NULL, -- Not used for 'F' surveys tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP date_creation datetime NOT NULL, ) ENGINE=innodb; diff --git a/htdocs/knowledgemanagement/lib/knowledgemanagement.lib.php b/htdocs/knowledgemanagement/lib/knowledgemanagement.lib.php index 2f189b05f5c..d1de9e5e401 100644 --- a/htdocs/knowledgemanagement/lib/knowledgemanagement.lib.php +++ b/htdocs/knowledgemanagement/lib/knowledgemanagement.lib.php @@ -28,10 +28,13 @@ */ function knowledgemanagementAdminPrepareHead() { - global $langs, $conf; + global $langs, $conf, $db; $langs->load("knowledgemanagement"); + $extrafields = new ExtraFields($db); + $extrafields->fetch_name_optionals_label('knowledgemanagement_knowledgerecord'); + $h = 0; $head = array(); @@ -43,14 +46,13 @@ function knowledgemanagementAdminPrepareHead() $head[$h][0] = DOL_URL_ROOT.'/admin/knowledgerecord_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFields"); + $nbExtrafields = $extrafields->attributes['knowledgemanagement_knowledgerecord']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'extra'; $h++; - /*$head[$h][0] = DOL_URL_ROOT.'/knowledgemanagement/admin/about.php'; - $head[$h][1] = $langs->trans("About"); - $head[$h][2] = 'about'; - $h++;*/ - // Show more tabs from modules // Entries must be declared in modules descriptor with line //$this->tabs = array( diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang index 82ef7f0be9a..4b623231511 100644 --- a/htdocs/langs/en_US/compta.lang +++ b/htdocs/langs/en_US/compta.lang @@ -29,6 +29,8 @@ BalanceBefore=Balance (before) Balance=Balance Debit=Debit Credit=Credit +AccountingDebit=Debit +AccountingCredit=Credit Piece=Accounting Doc. AmountHTVATRealReceived=Net collected AmountHTVATRealPaid=Net paid diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 97af73b8fd1..b3eeae4606b 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -280,8 +280,8 @@ ErrorWrongFileName=Name of the file cannot have __SOMETHING__ in it ErrorNotInDictionaryPaymentConditions=Not in Payment Terms Dictionary, please modify. ErrorIsNotADraft=%s is not a draft ErrorExecIdFailed=Can't execute command "id" -ErrorBadCharIntoLoginName=Unauthorized character in the login name -ErrorRequestTooLarge=Error, request too large +ErrorBadCharIntoLoginName=Unauthorized character in the field %s +ErrorRequestTooLarge=Error, request too large or session expired ErrorNotApproverForHoliday=You are not the approver for leave %s ErrorAttributeIsUsedIntoProduct=This attribute is used in one or more product variants ErrorAttributeValueIsUsedIntoProduct=This attribute value is used in one or more product variants diff --git a/htdocs/loan/info.php b/htdocs/loan/info.php index 49618d0f46c..188a61c61e6 100644 --- a/htdocs/loan/info.php +++ b/htdocs/loan/info.php @@ -102,8 +102,6 @@ $morehtmlref .= ''; $linkback = ''.$langs->trans("BackToList").''; -$object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status - dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); print '
'; diff --git a/htdocs/opensurvey/wizard/choix_date.php b/htdocs/opensurvey/wizard/choix_date.php index 46983829c3b..d8f89b18e16 100644 --- a/htdocs/opensurvey/wizard/choix_date.php +++ b/htdocs/opensurvey/wizard/choix_date.php @@ -37,6 +37,7 @@ if (!$user->rights->opensurvey->write) { $_SESSION["formatsondage"] = "D"; $erreur = false; +$erreurNbchoice = 0; /* * Actions @@ -49,114 +50,120 @@ if (GETPOST('confirmation')) { $nbofchoice = count($_SESSION["totalchoixjour"]); $errheure = array(); - for ($i = 0; $i < $nbofchoice; $i++) { - // Show hours choices - for ($j = 0; $j < $_SESSION["nbrecaseshoraires"]; $j++) { - $horairesi = GETPOST("horaires".$i); - $_SESSION["horaires$i"][$j] = $horairesi[$j]; - - $tmphorairesi = GETPOST('horaires'.$i, 'array'); - - if (!is_array($tmphorairesi)) { - $errheure[$i][$j] = true; - $erreur = true; - continue; - } - - // A range like 8:00-11:00 - $creneaux = array(); - $heures = array(); - if (preg_match("/(\d{1,2}:\d{2})-(\d{1,2}:\d{2})/", $tmphorairesi[$j], $creneaux)) { - //on recupere les deux parties du preg_match qu'on redécoupe autour des ":" - $debutcreneau = explode(":", $creneaux[1]); - $fincreneau = explode(":", $creneaux[2]); - - //comparaison des heures de fin et de debut - //si correctes, on entre les données dans la variables de session - if ($debutcreneau[0] < 24 && $fincreneau[0] < 24 && $debutcreneau[1] < 60 && $fincreneau[1] < 60 && ($debutcreneau[0] < $fincreneau[0] || ($debutcreneau[0] == $fincreneau[0] && $debutcreneau[1] < $fincreneau[1]))) { - $_SESSION["horaires$i"][$j] = $creneaux[1].'-'.$creneaux[2]; - } else { //sinon message d'erreur et nettoyage de la case - $errheure[$i][$j] = true; - $erreur = true; - } - } elseif (preg_match(";^(\d{1,2}h\d{0,2})-(\d{1,2}h\d{0,2})$;i", $tmphorairesi[$j], $creneaux)) { //si c'est un creneau type 8h00-11h00 - //on recupere les deux parties du preg_match qu'on redécoupe autour des "H" - $debutcreneau = preg_split("/h/i", $creneaux[1]); - $fincreneau = preg_split("/h/i", $creneaux[2]); - - //comparaison des heures de fin et de debut - //si correctes, on entre les données dans la variables de session - if ($debutcreneau[0] < 24 && $fincreneau[0] < 24 && $debutcreneau[1] < 60 && $fincreneau[1] < 60 && ($debutcreneau[0] < $fincreneau[0] || ($debutcreneau[0] == $fincreneau[0] && $debutcreneau[1] < $fincreneau[1]))) { - $_SESSION["horaires$i"][$j] = $creneaux[1].'-'.$creneaux[2]; - } else { //sinon message d'erreur et nettoyage de la case - $errheure[$i][$j] = true; - $erreur = true; - } - } elseif (preg_match(";^(\d{1,2}):(\d{2})$;", $tmphorairesi[$j], $heures)) { //si c'est une heure simple type 8:00 - //si valeures correctes, on entre les données dans la variables de session - if ($heures[1] < 24 && $heures[2] < 60) { - $_SESSION["horaires$i"][$j] = $heures[0]; - } else { //sinon message d'erreur et nettoyage de la case - $errheure[$i][$j] = true; - $erreur = true; - } - } elseif (preg_match(";^(\d{1,2})h(\d{0,2})$;i", $tmphorairesi[$j], $heures)) { //si c'est une heure encore plus simple type 8h - //si valeures correctes, on entre les données dans la variables de session - if ($heures[1] < 24 && $heures[2] < 60) { - $_SESSION["horaires$i"][$j] = $heures[0]; - } else { //sinon message d'erreur et nettoyage de la case - $errheure[$i][$j] = true; - $erreur = true; - } - } elseif (preg_match(";^(\d{1,2})-(\d{1,2})$;", $tmphorairesi[$j], $heures)) { //si c'est un creneau simple type 8-11 - //si valeures correctes, on entre les données dans la variables de session - if ($heures[1] < $heures[2] && $heures[1] < 24 && $heures[2] < 24) { - $_SESSION["horaires$i"][$j] = $heures[0]; - } else { //sinon message d'erreur et nettoyage de la case - $errheure[$i][$j] = true; - $erreur = true; - } - } elseif (preg_match(";^(\d{1,2})h-(\d{1,2})h$;", $tmphorairesi[$j], $heures)) { //si c'est un creneau H type 8h-11h - //si valeures correctes, on entre les données dans la variables de session - if ($heures[1] < $heures[2] && $heures[1] < 24 && $heures[2] < 24) { - $_SESSION["horaires$i"][$j] = $heures[0]; - } else { //sinon message d'erreur et nettoyage de la case - $errheure[$i][$j] = true; - $erreur = true; - } - } elseif ($tmphorairesi[$j] == "") { //Si la case est vide - unset($_SESSION["horaires$i"][$j]); - } else { //pour tout autre format, message d'erreur - $errheure[$i][$j] = true; - $erreur = true; - } - - if (issetAndNoEmpty('horaires'.$i, $_SESSION) === false || issetAndNoEmpty($j, $_SESSION['horaires'.$i]) === false) { - if (issetAndNoEmpty('horaires'.$i, $_SESSION) === true) { - $_SESSION["horaires$i"][$j] = ''; - } else { - $_SESSION["horaires$i"] = array(); - $_SESSION["horaires$i"][$j] = ''; - } - } - } - - if ($_SESSION["horaires$i"][0] == "" && $_SESSION["horaires$i"][1] == "" && $_SESSION["horaires$i"][2] == "" && $_SESSION["horaires$i"][3] == "" && $_SESSION["horaires$i"][4] == "") { - $choixdate .= ","; - $choixdate .= $_SESSION["totalchoixjour"][$i]; - } else { + if ($nbofchoice * $_SESSION["nbrecaseshoraires"] > 200) { + setEventMessages($langs->trans("ErrorFieldTooLong"), null, 'errors'); + $erreurNb++; + } else { + for ($i = 0; $i < $nbofchoice; $i++) { + // Show hours choices for ($j = 0; $j < $_SESSION["nbrecaseshoraires"]; $j++) { - if ($_SESSION["horaires$i"][$j] != "") { - $choixdate .= ","; - $choixdate .= $_SESSION["totalchoixjour"][$i]; - $choixdate .= "@"; - // On remplace la virgule et l'arobase pour ne pas avoir de problème par la suite - $choixdate .= str_replace(array(',', '@'), array(',', '@'), $_SESSION["horaires$i"][$j]); + $horairesi = GETPOST("horaires".$i); + $_SESSION["horaires$i"][$j] = $horairesi[$j]; + + $tmphorairesi = GETPOST('horaires'.$i, 'array'); + + if (!is_array($tmphorairesi)) { + $errheure[$i][$j] = true; + $erreur = true; + continue; + } + + // A range like 8:00-11:00 + $creneaux = array(); + $heures = array(); + if (preg_match("/(\d{1,2}:\d{2})-(\d{1,2}:\d{2})/", $tmphorairesi[$j], $creneaux)) { + //on recupere les deux parties du preg_match qu'on redécoupe autour des ":" + $debutcreneau = explode(":", $creneaux[1]); + $fincreneau = explode(":", $creneaux[2]); + + //comparaison des heures de fin et de debut + //si correctes, on entre les données dans la variables de session + if ($debutcreneau[0] < 24 && $fincreneau[0] < 24 && $debutcreneau[1] < 60 && $fincreneau[1] < 60 && ($debutcreneau[0] < $fincreneau[0] || ($debutcreneau[0] == $fincreneau[0] && $debutcreneau[1] < $fincreneau[1]))) { + $_SESSION["horaires$i"][$j] = $creneaux[1].'-'.$creneaux[2]; + } else { //sinon message d'erreur et nettoyage de la case + $errheure[$i][$j] = true; + $erreur = true; + } + } elseif (preg_match(";^(\d{1,2}h\d{0,2})-(\d{1,2}h\d{0,2})$;i", $tmphorairesi[$j], $creneaux)) { //si c'est un creneau type 8h00-11h00 + //on recupere les deux parties du preg_match qu'on redécoupe autour des "H" + $debutcreneau = preg_split("/h/i", $creneaux[1]); + $fincreneau = preg_split("/h/i", $creneaux[2]); + + //comparaison des heures de fin et de debut + //si correctes, on entre les données dans la variables de session + if ($debutcreneau[0] < 24 && $fincreneau[0] < 24 && $debutcreneau[1] < 60 && $fincreneau[1] < 60 && ($debutcreneau[0] < $fincreneau[0] || ($debutcreneau[0] == $fincreneau[0] && $debutcreneau[1] < $fincreneau[1]))) { + $_SESSION["horaires$i"][$j] = $creneaux[1].'-'.$creneaux[2]; + } else { //sinon message d'erreur et nettoyage de la case + $errheure[$i][$j] = true; + $erreur = true; + } + } elseif (preg_match(";^(\d{1,2}):(\d{2})$;", $tmphorairesi[$j], $heures)) { //si c'est une heure simple type 8:00 + //si valeures correctes, on entre les données dans la variables de session + if ($heures[1] < 24 && $heures[2] < 60) { + $_SESSION["horaires$i"][$j] = $heures[0]; + } else { //sinon message d'erreur et nettoyage de la case + $errheure[$i][$j] = true; + $erreur = true; + } + } elseif (preg_match(";^(\d{1,2})h(\d{0,2})$;i", $tmphorairesi[$j], $heures)) { //si c'est une heure encore plus simple type 8h + //si valeures correctes, on entre les données dans la variables de session + if ($heures[1] < 24 && $heures[2] < 60) { + $_SESSION["horaires$i"][$j] = $heures[0]; + } else { //sinon message d'erreur et nettoyage de la case + $errheure[$i][$j] = true; + $erreur = true; + } + } elseif (preg_match(";^(\d{1,2})-(\d{1,2})$;", $tmphorairesi[$j], $heures)) { //si c'est un creneau simple type 8-11 + //si valeures correctes, on entre les données dans la variables de session + if ($heures[1] < $heures[2] && $heures[1] < 24 && $heures[2] < 24) { + $_SESSION["horaires$i"][$j] = $heures[0]; + } else { //sinon message d'erreur et nettoyage de la case + $errheure[$i][$j] = true; + $erreur = true; + } + } elseif (preg_match(";^(\d{1,2})h-(\d{1,2})h$;", $tmphorairesi[$j], $heures)) { //si c'est un creneau H type 8h-11h + //si valeures correctes, on entre les données dans la variables de session + if ($heures[1] < $heures[2] && $heures[1] < 24 && $heures[2] < 24) { + $_SESSION["horaires$i"][$j] = $heures[0]; + } else { //sinon message d'erreur et nettoyage de la case + $errheure[$i][$j] = true; + $erreur = true; + } + } elseif ($tmphorairesi[$j] == "") { //Si la case est vide + unset($_SESSION["horaires$i"][$j]); + } else { //pour tout autre format, message d'erreur + $errheure[$i][$j] = true; + $erreur = true; + } + + if (issetAndNoEmpty('horaires'.$i, $_SESSION) === false || issetAndNoEmpty($j, $_SESSION['horaires'.$i]) === false) { + if (issetAndNoEmpty('horaires'.$i, $_SESSION) === true) { + $_SESSION["horaires$i"][$j] = ''; + } else { + $_SESSION["horaires$i"] = array(); + $_SESSION["horaires$i"][$j] = ''; + } + } + } + + if ($_SESSION["horaires$i"][0] == "" && $_SESSION["horaires$i"][1] == "" && $_SESSION["horaires$i"][2] == "" && $_SESSION["horaires$i"][3] == "" && $_SESSION["horaires$i"][4] == "") { + $choixdate .= ","; + $choixdate .= $_SESSION["totalchoixjour"][$i]; + } else { + for ($j = 0; $j < $_SESSION["nbrecaseshoraires"]; $j++) { + if ($_SESSION["horaires$i"][$j] != "") { + $choixdate .= ","; + $choixdate .= $_SESSION["totalchoixjour"][$i]; + $choixdate .= "@"; + // On remplace la virgule et l'arobase pour ne pas avoir de problème par la suite + $choixdate .= str_replace(array(',', '@'), array(',', '@'), $_SESSION["horaires$i"][$j]); + } } } } } + if (!empty($errheure)) { setEventMessages($langs->trans("ErrorBadFormat"), null, 'errors'); } @@ -170,7 +177,7 @@ if (GETPOST('confirmation')) { } // Add survey into database - if (!$erreur) { + if (!$erreur && $erreurNb == 0) { $_SESSION["toutchoix"] = substr("$choixdate", 1); ajouter_sondage(); diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php index 93897771019..5908b964f2c 100644 --- a/htdocs/partnership/class/partnership.class.php +++ b/htdocs/partnership/class/partnership.class.php @@ -17,18 +17,14 @@ */ /** - * \file class/partnership.class.php + * \file htdocs/partnership/class/partnership.class.php * \ingroup partnership * \brief This file is a CRUD class file for Partnership (Create/Read/Update/Delete) */ -use Illuminate\Support\Arr; // Put here all includes required by your class file require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; -//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; -//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; - /** * Class for Partnership @@ -198,7 +194,7 @@ class Partnership extends CommonObject $this->db = $db; - if (!empty($conf->global->PARTNERSHIP_IS_MANAGED_FOR) && getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR') == 'member') { + if (getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR') == 'member') { $this->fields['fk_member'] = array('type'=>'integer:Adherent:adherents/class/adherent.class.php:1', 'label'=>'Member', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'picto'=>'member', 'csslist'=>'tdoverflowmax150'); } else { $this->fields['fk_soc'] = array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'picto'=>'company', 'css'=>'maxwidth500', 'csslist'=>'tdoverflowmax150'); diff --git a/htdocs/partnership/lib/partnership.lib.php b/htdocs/partnership/lib/partnership.lib.php index abf8dcca63b..5c30be6ffd1 100644 --- a/htdocs/partnership/lib/partnership.lib.php +++ b/htdocs/partnership/lib/partnership.lib.php @@ -28,10 +28,13 @@ */ function partnershipAdminPrepareHead() { - global $langs, $conf; + global $langs, $conf, $db; $langs->loadLangs(array("members", "partnership")); + $extrafields = new ExtraFields($db); + $extrafields->fetch_name_optionals_label('partnership'); + $h = 0; $head = array(); @@ -43,6 +46,10 @@ function partnershipAdminPrepareHead() $head[$h][0] = dol_buildpath("/partnership/admin/partnership_extrafields.php", 1); $head[$h][1] = $langs->trans("ExtraFields"); + $nbExtrafields = $extrafields->attributes['partnership']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'partnership_extrafields'; $h++; @@ -51,13 +58,6 @@ function partnershipAdminPrepareHead() $head[$h][2] = 'website'; $h++; - /* - $head[$h][0] = dol_buildpath("/partnership/admin/about.php", 1); - $head[$h][1] = $langs->trans("About"); - $head[$h][2] = 'about'; - $h++; - */ - // Show more tabs from modules // Entries must be declared in modules descriptor with line //$this->tabs = array( diff --git a/htdocs/recruitment/class/recruitmentjobposition.class.php b/htdocs/recruitment/class/recruitmentjobposition.class.php index dda796c243e..7a9d077f910 100644 --- a/htdocs/recruitment/class/recruitmentjobposition.class.php +++ b/htdocs/recruitment/class/recruitmentjobposition.class.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2020 Laurent Destailleur +/* Copyright (C) 2022 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -62,10 +63,24 @@ class RecruitmentJobPosition extends CommonObject */ public $picto = 'recruitmentjobposition'; - + /** + * Draft status + */ const STATUS_DRAFT = 0; + + /** + * Validated + */ const STATUS_VALIDATED = 1; + + /** + * Recruited + */ const STATUS_RECRUITED = 3; + + /** + * Canceled + */ const STATUS_CANCELED = 9; @@ -651,7 +666,7 @@ class RecruitmentJobPosition extends CommonObject } /** - * Close the commercial proposal + * Close the recruitment * * @param User $user Object user that close * @param int $status Statut @@ -683,12 +698,6 @@ class RecruitmentJobPosition extends CommonObject if ($status == self::STATUS_RECRUITED) { $triggerName = 'RECRUITMENTJOB_CLOSE_RECRUITED'; $modelpdf = $this->model_pdf; - - if ($result < 0) { - $this->error = $this->db->lasterror(); - $this->db->rollback(); - return -2; - } } if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { diff --git a/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php b/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php index 38e1ead836e..cfbf91463e8 100644 --- a/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php +++ b/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php @@ -287,7 +287,11 @@ class doc_generic_recruitmentjobposition_odt extends ModelePDFRecruitmentJobPosi //print "conf->societe->dir_temp=".$conf->societe->dir_temp; dol_mkdir($conf->recruitment->dir_temp); - + if (!is_writable($conf->recruitment->dir_temp)) { + $this->error = $langs->transnoentities("ErrorFailedToWriteInTempDirectory", $conf->recruitment->dir_temp); + dol_syslog('Error in write_file: ' . $this->error, LOG_ERR); + return -1; + } // If CUSTOMER contact defined on order, we use it $usecontact = false; diff --git a/htdocs/resource/contact.php b/htdocs/resource/contact.php index 45e4ce4b329..3b032fffb94 100644 --- a/htdocs/resource/contact.php +++ b/htdocs/resource/contact.php @@ -114,10 +114,6 @@ llxHeader('', $langs->trans("Resource")); // View and edit mode if ($id > 0 || !empty($ref)) { - $soc = new Societe($db); - $soc->fetch($object->socid); - - $head = resource_prepare_head($object); print dol_get_fiche_head($head, 'contact', $langs->trans("ResourceSingular"), -1, 'resource'); diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index d49f810f915..75c9f1b2bae 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1522,7 +1522,7 @@ class User extends CommonObject return -1; } elseif (preg_match('/['.preg_quote($badCharUnauthorizedIntoLoginName, '/').']/', $this->login)) { $langs->load("errors"); - $this->error = $langs->trans("ErrorBadCharIntoLoginName"); + $this->error = $langs->trans("ErrorBadCharIntoLoginName", $langs->transnoentitiesnoconv("Login")); return -1; } @@ -1918,7 +1918,7 @@ class User extends CommonObject return -1; } elseif (preg_match('/['.preg_quote($badCharUnauthorizedIntoLoginName, '/').']/', $this->login)) { $langs->load("errors"); - $this->error = $langs->trans("ErrorBadCharIntoLoginName"); + $this->error = $langs->trans("ErrorBadCharIntoLoginName", $langs->transnoentitiesnoconv("Login")); return -1; } diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index c34d49fc7ca..9cc470a5954 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -1157,7 +1157,7 @@ class Website extends CommonObject /** * Open a zip with all data of web site and load it into database. * - * @param string $pathtofile Path of zip file + * @param string $pathtofile Full path of zip file * @return int <0 if KO, Id of new website if OK */ public function importWebSite($pathtofile) @@ -1166,6 +1166,8 @@ class Website extends CommonObject $error = 0; + $pathtofile = dol_sanitizePathName($pathtofile); + $object = $this; if (empty($object->ref)) { $this->error = 'Function importWebSite called on object not loaded (object->ref is empty)'; diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 3593ddbcd95..a8dc2a716b3 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -2420,14 +2420,17 @@ if ($action == 'importsiteconfirm' && $usercanedit) { $fileofzip = ''; if (GETPOSTISSET('templateuserfile')) { - $fileofzip = DOL_DATA_ROOT.'/doctemplates/websites/'.GETPOST('templateuserfile', 'alpha'); + // Case we selected one template + $fileofzip = DOL_DATA_ROOT.'/doctemplates/websites/'.GETPOST('templateuserfile', 'alpha'); // $fileofzip will be sanitized later into the importWebSite() } elseif (!empty($_FILES)) { + // Case we upload a new template if (is_array($_FILES['userfile']['tmp_name'])) { $userfiles = $_FILES['userfile']['tmp_name']; } else { $userfiles = array($_FILES['userfile']['tmp_name']); } + // Check if $_FILES is ok foreach ($userfiles as $key => $userfile) { if (empty($_FILES['userfile']['tmp_name'][$key])) { $error++; @@ -2442,20 +2445,25 @@ if ($action == 'importsiteconfirm' && $usercanedit) { } if (!$error) { - $upload_dir = $conf->website->dir_temp; + //$upload_dir = $conf->website->dir_temp; + $upload_dir = DOL_DATA_ROOT.'/doctemplates/websites/'; $result = dol_add_file_process($upload_dir, 1, -1, 'userfile', ''); } // Get name of file (take last one if several name provided) + /* $fileofzip = $upload_dir.'/unknown'; foreach ($_FILES as $key => $ifile) { foreach ($ifile['name'] as $key2 => $ifile2) { $fileofzip = $upload_dir.'/'.$ifile2; } } + */ + + $action = 'importsite'; } - if (!$error) { + if (!$error && GETPOSTISSET('templateuserfile')) { $result = $object->importWebSite($fileofzip); if ($result < 0) {