diff --git a/dev/setup/fail2ban/jail.local b/dev/setup/fail2ban/jail.local index bd1f7959f08..af74ed16671 100644 --- a/dev/setup/fail2ban/jail.local +++ b/dev/setup/fail2ban/jail.local @@ -24,8 +24,8 @@ filter = web-dolibarr-rulesbruteforce logpath = /mypath/documents/documents/dolibarr.log action = %(action_mw)s bantime = 86400 ; 1 day -findtime = 3600 ; 1 hour -maxretry = 10 +findtime = 14400 ; 4 hours +maxretry = 20 [web-dol-limitpublic] diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index 1670776ab6e..319ac308802 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -161,11 +161,11 @@ if (empty($reshook)) { if (!empty($search_date_start)) { $filter['t.doc_date>='] = $search_date_start; - $param .= '&date_startmonth=' . GETPOST('date_startmonth', 'int') . '&date_startday=' . GETPOST('date_startday', 'int') . '&date_startyear=' . GETPOST('date_startyear', 'int'); + $param .= '&date_startmonth=' . GETPOST('date_startmonth', 'int') . '&date_startday=' . GETPOST('date_startday', 'int') . '&date_startyear=' . GETPOST('date_startyear', 'int'); } if (!empty($search_date_end)) { $filter['t.doc_date<='] = $search_date_end; - $param .= '&date_endmonth=' . GETPOST('date_endmonth', 'int') . '&date_endday=' . GETPOST('date_endday', 'int') . '&date_endyear=' . GETPOST('date_endyear', 'int'); + $param .= '&date_endmonth=' . GETPOST('date_endmonth', 'int') . '&date_endday=' . GETPOST('date_endday', 'int') . '&date_endyear=' . GETPOST('date_endyear', 'int'); } if (!empty($search_doc_date)) { $filter['t.doc_date'] = $search_doc_date; @@ -177,7 +177,7 @@ if (empty($reshook)) { } else { $filter['t.numero_compte>='] = $search_accountancy_code_start; } - $param .= '&search_accountancy_code_start=' . urlencode($search_accountancy_code_start); + $param .= '&search_accountancy_code_start=' . urlencode($search_accountancy_code_start); } if (!empty($search_accountancy_code_end)) { if ($type == 'sub') { @@ -185,7 +185,7 @@ if (empty($reshook)) { } else { $filter['t.numero_compte<='] = $search_accountancy_code_end; } - $param .= '&search_accountancy_code_end=' . urlencode($search_accountancy_code_end); + $param .= '&search_accountancy_code_end=' . urlencode($search_accountancy_code_end); } if (!empty($search_ledger_code)) { $filter['t.code_journal'] = $search_ledger_code; @@ -375,10 +375,12 @@ if ($action != 'export_csv') { } $moreforfilter .= ''; - $moreforfilter .= '
'; - $moreforfilter .= ': '; - $moreforfilter .= ''; - $moreforfilter .= '
'; + if (!empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) { + $moreforfilter .= '
'; + $moreforfilter .= ': '; + $moreforfilter .= ''; + $moreforfilter .= '
'; + } if (!empty($moreforfilter)) { print '
'; @@ -395,6 +397,14 @@ if ($action != 'export_csv') { print ''; print ''; + + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } + print ''; @@ -404,13 +414,18 @@ if ($action != 'export_csv') { print $hookmanager->resPrint; // Action column - print ''; + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } print ''."\n"; print ''; + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; + } print_liste_field_titre("AccountAccounting", $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder); // TODO : Retrieve the type of third party: Customer / Supplier / Employee //if ($type == 'sub') { @@ -428,7 +443,9 @@ if ($action != 'export_csv') { $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column - print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; + } print ''."\n"; $total_debit = 0; @@ -532,6 +549,14 @@ if ($action != 'export_csv') { } print ''; + + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } + // Accounting account if ($type == 'sub') { print ''; @@ -581,9 +606,14 @@ if ($action != 'export_csv') { } else { print ''; } - print ''; + + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } + print "\n"; // Records the sub-total @@ -593,7 +623,12 @@ if ($action != 'export_csv') { } if (!empty($show_subgroup)) { - print ''; + print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print "\n"; + } + print ''; if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) { print ''; } @@ -604,11 +639,19 @@ if ($action != 'export_csv') { } else { print ''; } - print "\n"; + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print "\n"; + } print ''; } - print ''; + print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print "\n"; + } + print ''; if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) { print ''; } @@ -619,7 +662,10 @@ if ($action != 'export_csv') { } else { print ''; } - print "\n"; + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print "\n"; + } print ''; $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 585d5b664cb..53650a3cd28 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -720,7 +720,7 @@ if ($limit > 0 && $limit != $conf->liste_limit) { // List of mass actions available $arrayofmassactions = array(); -if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && $user->rights->accounting->mouvements->creer) { +if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && $user->hasRight('accounting', 'mouvements', 'creer')) { $arrayofmassactions['letteringauto'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('LetteringAuto'); $arrayofmassactions['preunletteringauto'] = img_picto('', 'uncheck', 'class="pictofixedwidth"') . $langs->trans('UnletteringAuto'); $arrayofmassactions['letteringmanual'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('LetteringManual'); diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 9031c73624b..b61b82aeca2 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -381,7 +381,7 @@ if (empty($reshook)) { $param = '&type='.$type.$param; } - //if ($action == 'delbookkeepingyearconfirm' && $user->rights->accounting->mouvements->supprimer_tous) { + //if ($action == 'delbookkeepingyearconfirm' && $user->hasRight('accounting', 'mouvements', 'supprimer')_tous) { // $delmonth = GETPOST('delmonth', 'int'); // $delyear = GETPOST('delyear', 'int'); // if ($delyear == -1) { diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 987d35512a5..8c46be39826 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -166,7 +166,7 @@ if (empty($reshook)) { } -if ($massaction == 'ventil' && $user->rights->accounting->bind->write) { +if ($massaction == 'ventil' && $user->hasRight('accounting', 'bind', 'write')) { $msg = ''; //print '
' . $langs->trans("Processing") . '...
'; @@ -446,7 +446,7 @@ if ($result) { //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), ); - //if ($user->rights->mymodule->supprimer) $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); + //if ($user->hasRight('mymodule', 'supprimer')) $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); //if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); if ($massaction !== 'set_default_account') { $massactionbutton = $form->selectMassAction('ventil', $arrayofmassactions, 1); diff --git a/htdocs/accountancy/expensereport/card.php b/htdocs/accountancy/expensereport/card.php index 0255e019138..63848372044 100644 --- a/htdocs/accountancy/expensereport/card.php +++ b/htdocs/accountancy/expensereport/card.php @@ -57,7 +57,7 @@ if (empty($user->rights->accounting->mouvements->lire)) { * Actions */ -if ($action == 'ventil' && $user->rights->accounting->bind->write) { +if ($action == 'ventil' && $user->hasRight('accounting', 'bind', 'write')) { if (!$cancel) { if ($codeventil < 0) { $codeventil = 0; diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php index ba98ebcaaa7..c523df85326 100644 --- a/htdocs/accountancy/expensereport/lines.php +++ b/htdocs/accountancy/expensereport/lines.php @@ -118,7 +118,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_date_end = ''; } -if (is_array($changeaccount) && count($changeaccount) > 0 && $user->rights->accounting->bind->write) { +if (is_array($changeaccount) && count($changeaccount) > 0 && $user->hasRight('accounting', 'bind', 'write')) { $error = 0; if (!(GETPOST('account_parent', 'int') >= 0)) { diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php index 253879eb462..67d8be1b38a 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -158,7 +158,7 @@ if (empty($reshook)) { } -if ($massaction == 'ventil' && $user->rights->accounting->bind->write) { +if ($massaction == 'ventil' && $user->hasRight('accounting', 'bind', 'write')) { $msg = ''; if (!empty($mesCasesCochees)) { diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 5e30325d2c7..fdce681f7ef 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -109,14 +109,14 @@ $sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.tva $sql .= " p.default_vat_code AS product_buy_default_vat_code, p.tva_tx as product_buy_vat, p.localtax1_tx as product_buy_localvat1, p.localtax2_tx as product_buy_localvat2,"; $sql .= " co.code as country_code, co.label as country_label,"; $sql .= " s.rowid as socid, s.nom as name, s.fournisseur, s.code_client, s.code_fournisseur, s.fk_pays,"; -if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { +if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) { $sql .= " spe.accountancy_code_customer as code_compta,"; $sql .= " spe.accountancy_code_supplier as code_compta_fournisseur,"; } else { $sql .= " s.code_compta as code_compta,"; $sql .= " s.code_compta_fournisseur,"; } -if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { +if (getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) { $sql .= " ppe.accountancy_code_buy,"; } else { $sql .= " p.accountancy_code_buy,"; @@ -124,20 +124,20 @@ if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { $sql .= " aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte"; $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as fd"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = fd.fk_product"; -if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { +if (getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) { $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); } $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = fd.fk_code_ventilation"; $sql .= " JOIN ".MAIN_DB_PREFIX."facture_fourn as f ON f.rowid = fd.fk_facture_fourn"; $sql .= " JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays "; -if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { +if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) { $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity); } $sql .= " WHERE f.fk_statut > 0"; $sql .= " AND fd.fk_code_ventilation > 0"; $sql .= " AND f.entity IN (".getEntity('facture_fourn', 0).")"; // We don't share object for accountancy -if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) { +if (getDolGlobalString('FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS')) { $sql .= " AND f.type IN (".FactureFournisseur::TYPE_STANDARD.",".FactureFournisseur::TYPE_REPLACEMENT.",".FactureFournisseur::TYPE_CREDIT_NOTE.",".FactureFournisseur::TYPE_SITUATION.")"; } else { $sql .= " AND f.type IN (".FactureFournisseur::TYPE_STANDARD.",".FactureFournisseur::TYPE_REPLACEMENT.",".FactureFournisseur::TYPE_CREDIT_NOTE.",".FactureFournisseur::TYPE_DEPOSIT.",".FactureFournisseur::TYPE_SITUATION.")"; @@ -146,8 +146,8 @@ if ($date_start && $date_end) { $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'"; } // Define begin binding date -if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) { - $sql .= " AND f.datef >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'"; +if (getDolGlobalString('ACCOUNTING_DATE_START_BINDING')) { + $sql .= " AND f.datef >= '".$db->idate(getDolGlobalString('ACCOUNTING_DATE_START_BINDING'))."'"; } // Already in bookkeeping or not if ($in_bookkeeping == 'already') { @@ -177,10 +177,10 @@ if ($result) { $num = $db->num_rows($result); // Variables - $cptfour = ($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER != "") ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : 'NotDefined'; - $cpttva = (!empty($conf->global->ACCOUNTING_VAT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_BUY_ACCOUNT : 'NotDefined'; - $rcctva = (!empty($conf->global->ACCOUNTING_VAT_BUY_REVERSE_CHARGES_CREDIT)) ? $conf->global->ACCOUNTING_VAT_BUY_REVERSE_CHARGES_CREDIT : 'NotDefined'; - $rcdtva = (!empty($conf->global->ACCOUNTING_VAT_BUY_REVERSE_CHARGES_DEBIT)) ? $conf->global->ACCOUNTING_VAT_BUY_REVERSE_CHARGES_DEBIT : 'NotDefined'; + $cptfour = getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER', 'NotDefined'); + $cpttva = getDolGlobalString('ACCOUNTING_VAT_BUY_ACCOUNT', 'NotDefined'); + $rcctva = getDolGlobalString('ACCOUNTING_VAT_BUY_REVERSE_CHARGES_CREDIT', 'NotDefined'); + $rcdtva = getDolGlobalString('ACCOUNTING_VAT_BUY_REVERSE_CHARGES_DEBIT', 'NotDefined'); $country_code_in_EEC = getCountriesInEEC(); // This make a database call but there is a cache done into $conf->cache['country_code_in_EEC'] $i = 0; @@ -193,9 +193,9 @@ if ($result) { $compta_prod = $obj->compte; if (empty($compta_prod)) { if ($obj->product_type == 0) { - $compta_prod = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : 'NotDefined'; + $compta_prod = getDolGlobalString('ACCOUNTING_PRODUCT_BUY_ACCOUNT', 'NotDefined'); } else { - $compta_prod = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : 'NotDefined'; + $compta_prod = getDolGlobalString('ACCOUNTING_SERVICE_BUY_ACCOUNT', 'NotDefined'); } } @@ -203,7 +203,7 @@ if ($result) { $compta_tva = (!empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $cpttva); $compta_localtax1 = (!empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $cpttva); $compta_localtax2 = (!empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $cpttva); - $compta_counterpart_tva_npr = (!empty($conf->global->ACCOUNTING_COUNTERPART_VAT_NPR)) ? $conf->global->ACCOUNTING_COUNTERPART_VAT_NPR : 'NotDefined'; + $compta_counterpart_tva_npr = getDolGlobalString('ACCOUNTING_COUNTERPART_VAT_NPR', 'NotDefined'); // Define array to display all VAT rates that use this accounting account $compta_tva if (price2num($obj->tva_tx) || !empty($obj->vat_src_code)) { @@ -241,7 +241,7 @@ if ($result) { } // VAT Reverse charge - if (($mysoc->country_code == 'FR' || !empty($conf->global->ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE)) && $obj->vat_reverse_charge == 1 && in_array($obj->country_code, $country_code_in_EEC)) { + if (($mysoc->country_code == 'FR' || getDolGlobalString('ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE')) && $obj->vat_reverse_charge == 1 && in_array($obj->country_code, $country_code_in_EEC)) { $rcvatdata = getTaxesFromId($obj->product_buy_vat . ($obj->product_buy_default_vat_code ? ' (' . $obj->product_buy_default_vat_code . ')' : ''), $mysoc, $mysoc, 0); $rcc_compta_tva = (!empty($vatdata['accountancy_code_vat_reverse_charge_credit']) ? $vatdata['accountancy_code_vat_reverse_charge_credit'] : $rcctva); $rcd_compta_tva = (!empty($vatdata['accountancy_code_vat_reverse_charge_debit']) ? $vatdata['accountancy_code_vat_reverse_charge_debit'] : $rcdtva); @@ -340,7 +340,7 @@ if ($action == 'writebookkeeping') { $invoicestatic = new FactureFournisseur($db); $accountingaccountsupplier = new AccountingAccount($db); - $accountingaccountsupplier->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER, true); + $accountingaccountsupplier->fetch(null, getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER'), true); foreach ($tabfac as $key => $val) { // Loop on each invoice $errorforline = 0; @@ -404,7 +404,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->subledger_account = $tabcompany[$key]['code_compta_fournisseur']; $bookkeeping->subledger_label = $tabcompany[$key]['name']; - $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER; + $bookkeeping->numero_compte = getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER'); $bookkeeping->label_compte = $accountingaccountsupplier->label; $bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref_supplier.' - '.$langs->trans("SubledgerAccount"); @@ -462,7 +462,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add $bookkeeping->thirdparty_code = $companystatic->code_fournisseur; - if (!empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT)) { + if (getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT')) { if ($k == getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT')) { $bookkeeping->subledger_account = $tabcompany[$key]['code_compta']; $bookkeeping->subledger_label = $tabcompany[$key]['name']; @@ -523,7 +523,7 @@ if ($action == 'writebookkeeping') { } // VAT Reverse charge - if ($mysoc->country_code == 'FR' || !empty($conf->global->ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE)) { + if ($mysoc->country_code == 'FR' || getDolGlobalString('ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE')) { $has_vat = false; foreach ($arrayofvat[$key] as $k => $mt) { if ($mt) { @@ -704,7 +704,7 @@ $form = new Form($db); // Export if ($action == 'exportcsv') { // ISO and not UTF8 ! - $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; + $sep = getDolGlobalString('ACCOUNTING_EXPORT_SEPARATORCSV'); $filename = 'journal'; $type_export = 'journal'; @@ -752,7 +752,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! print '"'.$val["refsologest"].'"'.$sep; print '"'.utf8_decode(dol_trunc($companystatic->name, 32)).'"'.$sep; print '"'.length_accounta(html_entity_decode($k)).'"'.$sep; - print '"'.length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER).'"'.$sep; + print '"'.length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER')).'"'.$sep; print '"'.length_accounta(html_entity_decode($k)).'"'.$sep; print '"'.$langs->trans("Thirdparty").'"'.$sep; print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.$val["refsuppliersologest"].' - '.$langs->trans("Thirdparty").'"'.$sep; @@ -796,7 +796,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! } // VAT Reverse charge - if ($mysoc->country_code == 'FR' || !empty($conf->global->ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE)) { + if ($mysoc->country_code == 'FR' || getDolGlobalString('ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE')) { $has_vat = false; foreach ($arrayofvat[$key] as $k => $mt) { if ($mt) { @@ -871,7 +871,7 @@ if (empty($action) || $action == 'view') { $exportlink = ''; $builddate = dol_now(); $description = $langs->trans("DescJournalOnlyBindedVisible").'
'; - if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) { + if (getDolGlobalString('FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS')) { $description .= $langs->trans("DepositsAreNotIncluded"); } else { $description .= $langs->trans("DepositsAreIncluded"); @@ -886,7 +886,8 @@ if (empty($action) || $action == 'view') { journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink); // Button to write into Ledger - if (($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') { + $acctSupplierNotConfigured = in_array(getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER'), ['','-1']); + if ($acctSupplierNotConfigured) { print '
'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone"); $desc = ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '{link}'); $desc = str_replace('{link}', ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'', $desc); @@ -894,10 +895,10 @@ if (empty($action) || $action == 'view') { print '
'; } print '
'; - if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping == 'notyet') { + if (getDolGlobalString('ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL') && $in_bookkeeping == 'notyet') { print ''; } - if (($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') { + if ($acctSupplierNotConfigured) { print ''; } else { if ($in_bookkeeping == 'notyet') { @@ -1023,7 +1024,7 @@ if (empty($action) || $action == 'view') { print "
"; // Account print ""; // Subledger account print ""; // Account print ""; // Account print ""; // Subledger account print "'; + print ''; } } diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index aaef5aa96a7..44b2fb349d6 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -1008,7 +1008,7 @@ class AdherentType extends CommonObject //$return .= ''; - if ($user->rights->adherent->configurer) { + if ($user->hasRight('adherent', 'configurer')) { $return .= 'ref).'">'.img_edit().''; } else { $return .= ' '; diff --git a/htdocs/adherents/ldap.php b/htdocs/adherents/ldap.php index c466ff7ff9d..a7503190a08 100644 --- a/htdocs/adherents/ldap.php +++ b/htdocs/adherents/ldap.php @@ -57,7 +57,7 @@ if ($id > 0 || !empty($ref)) { // $User is the user who edits, $object->user_id is the id of the related user in the edited member $caneditfielduser = ((($user->id == $object->user_id) && !empty($user->rights->user->self->creer)) || (($user->id != $object->user_id) && $user->hasRight('user', 'user', 'creer'))); - $caneditpassworduser = ((($user->id == $object->user_id) && $user->rights->user->self->password) + $caneditpassworduser = ((($user->id == $object->user_id) && $user->hasRight('user', 'self', 'password')) || (($user->id != $object->user_id) && $user->hasRight('user', 'user', 'password'))); } } diff --git a/htdocs/adherents/note.php b/htdocs/adherents/note.php index 4d3bc4dd638..f4f72fc93fa 100644 --- a/htdocs/adherents/note.php +++ b/htdocs/adherents/note.php @@ -85,7 +85,8 @@ $result = restrictedArea($user, 'adherent', $object->id, '', '', 'socid', 'rowid /* * Actions */ -$reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index 0e95afa523c..9f6ea1c74c9 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -135,7 +135,7 @@ if ($reshook < 0) { } // Create third party from a member -if (empty($reshook) && $action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights->societe->creer) { +if (empty($reshook) && $action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->hasRight('societe', 'creer')) { if ($result > 0) { // Creation of thirdparty $company = new Societe($db); diff --git a/htdocs/adherents/subscription/card.php b/htdocs/adherents/subscription/card.php index 6ff55e13a3a..5ab388e73d0 100644 --- a/htdocs/adherents/subscription/card.php +++ b/htdocs/adherents/subscription/card.php @@ -330,7 +330,7 @@ if ($rowid && $action != 'edit') { print ''; // Label - print ''; + print ''; // Bank line if (isModEnabled("banque") && (!empty($conf->global->ADHERENT_BANK_USE) || $object->fk_bank)) { diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 52c16a8ce4b..dcf8722fcbe 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -350,7 +350,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') { } else { print ''; if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - if ($user->rights->adherent->configurer) { + if ($user->hasRight('adherent', 'configurer')) { print ''; } } @@ -374,7 +374,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') { print ''; print ''; if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - if ($user->rights->adherent->configurer) { + if ($user->hasRight('adherent', 'configurer')) { print ''; } } @@ -537,10 +537,12 @@ if ($rowid > 0) { print ''; print '"; + print dol_string_onlythesehtmltags(dol_htmlentitiesbr($object->note_private)); + print ""; print '"; + print dol_string_onlythesehtmltags(dol_htmlentitiesbr($object->mail_valid)); + print ""; // Other attributes include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; diff --git a/htdocs/admin/security_file.php b/htdocs/admin/security_file.php index 5ea581296af..8bddb3579e7 100644 --- a/htdocs/admin/security_file.php +++ b/htdocs/admin/security_file.php @@ -64,8 +64,8 @@ if (GETPOST('sendit') && !empty($conf->global->MAIN_UPLOAD_DOC)) { if ($action == 'updateform') { $antivircommand = GETPOST('MAIN_ANTIVIRUS_COMMAND', 'restricthtml'); // Use GETPOST restricthtml because we must accept ". Example c:\Progra~1\ClamWin\bin\clamscan.exe $antivirparam = GETPOST('MAIN_ANTIVIRUS_PARAM', 'restricthtml'); // Use GETPOST restricthtml because we must accept ". Example --database="C:\Program Files (x86)\ClamWin\lib" - $antivircommand = dol_string_nospecial($antivircommand, '', array("|", ";", "<", ">", "&")); // Sanitize command - $antivirparam = dol_string_nospecial($antivirparam, '', array("|", ";", "<", ">", "&")); // Sanitize params + $antivircommand = dol_string_nospecial($antivircommand, '', array("|", ";", "<", ">", "&", "+")); // Sanitize command + $antivirparam = dol_string_nospecial($antivirparam, '', array("|", ";", "<", ">", "&", "+")); // Sanitize params if ($antivircommand && !empty($dolibarr_main_restrict_os_commands)) { $arrayofallowedcommand = explode(',', $dolibarr_main_restrict_os_commands); diff --git a/htdocs/admin/system/security.php b/htdocs/admin/system/security.php index 4229a6def80..cc564fdc5d4 100644 --- a/htdocs/admin/system/security.php +++ b/htdocs/admin/system/security.php @@ -631,6 +631,11 @@ print '
'; print 'MAIN_DISALLOW_EXT_URL_INTO_DESCRIPTIONS = '.getDolGlobalString('MAIN_DISALLOW_EXT_URL_INTO_DESCRIPTIONS', ''.$langs->trans("Undefined").'   ('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or").' 0)')."
"; print '
'; +print 'MAIN_ALLOW_SVG_FILES_AS_EXTERNAL_LINKS = '.getDolGlobalString('MAIN_ALLOW_SVG_FILES_AS_EXTERNAL_LINKS', ''.$langs->trans("Undefined").'   ('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or").' 0)')."
"; +print '
'; + +// MAIN_ALLOW_LOCAL_LINKS_AS_EXTERNAL_LINKS + print 'MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL = '.getDolGlobalString('MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL', ''.$langs->trans("Undefined").'   ('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or").' 0)')."
"; print '
'; diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index ee0ae57e0e2..059802e9e88 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -403,7 +403,7 @@ class Documents extends DolibarrApi throw new RestException(404, 'Purchase order not found'); } - $upload_dir = $conf->fournisseur->dir_output."/facture/".get_exdir($object->id, 2, 0, 0, $object, 'invoice_supplier').dol_sanitizeFileName($object->ref); + $upload_dir = $conf->fournisseur->dir_output."/commande/".dol_sanitizeFileName($object->ref); } elseif ($modulepart == 'shipment' || $modulepart == 'expedition') { require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; diff --git a/htdocs/asset/depreciation.php b/htdocs/asset/depreciation.php index eae2ff45e2b..a2d283ef94b 100644 --- a/htdocs/asset/depreciation.php +++ b/htdocs/asset/depreciation.php @@ -75,7 +75,8 @@ if ($result < 0) { * Actions */ -$reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } diff --git a/htdocs/asset/depreciation_options.php b/htdocs/asset/depreciation_options.php index 5d232670105..8a5aa58d1b7 100644 --- a/htdocs/asset/depreciation_options.php +++ b/htdocs/asset/depreciation_options.php @@ -73,7 +73,8 @@ if ($result < 0) { * Actions */ -$reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } diff --git a/htdocs/asset/disposal.php b/htdocs/asset/disposal.php index 46c5be78a79..e711516132b 100644 --- a/htdocs/asset/disposal.php +++ b/htdocs/asset/disposal.php @@ -66,7 +66,8 @@ if (!isset($object->disposal_date) || $object->disposal_date === "") accessforbi * Actions */ -$reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } diff --git a/htdocs/asset/model/accountancy_codes.php b/htdocs/asset/model/accountancy_codes.php index b39a72bb7a3..539e11204a3 100644 --- a/htdocs/asset/model/accountancy_codes.php +++ b/htdocs/asset/model/accountancy_codes.php @@ -53,8 +53,8 @@ if ($id > 0 || !empty($ref)) { $upload_dir = $conf->asset->multidir_output[$object->entity] . "/" . $object->id; } -$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->read))); -$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->write))); // Used by the include of actions_addupdatedelete.inc.php +$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('asset', 'read')) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->read))); +$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('asset', 'write')) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->write))); // Used by the include of actions_addupdatedelete.inc.php // Security check (enable the most restrictive one) if ($user->socid > 0) accessforbidden(); diff --git a/htdocs/asset/model/agenda.php b/htdocs/asset/model/agenda.php index 44a0fa504a3..31c49d5e40f 100644 --- a/htdocs/asset/model/agenda.php +++ b/htdocs/asset/model/agenda.php @@ -82,8 +82,8 @@ if ($id > 0 || !empty($ref)) { $upload_dir = $conf->asset->multidir_output[$object->entity] . "/model/" . $object->id; } -$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->read))); -$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->write))); // Used by the include of actions_addupdatedelete.inc.php +$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('asset', 'read')) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->read))); +$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('asset', 'write')) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->write))); // Used by the include of actions_addupdatedelete.inc.php // Security check (enable the most restrictive one) if ($user->socid > 0) accessforbidden(); diff --git a/htdocs/asset/model/card.php b/htdocs/asset/model/card.php index 3eb75eded08..11e94e53ace 100644 --- a/htdocs/asset/model/card.php +++ b/htdocs/asset/model/card.php @@ -69,9 +69,9 @@ if (empty($action) && empty($id) && empty($ref)) { // Load object include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once. -$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->read))); -$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->write))); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php -$permissiontodelete = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->delete) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->delete))) || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT); +$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('asset', 'read')) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->read))); +$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('asset', 'write')) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->write))); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +$permissiontodelete = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('asset', 'delete')) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->delete))) || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT); $permissionnote = $permissiontoadd; // Used by the include of actions_setnotes.inc.php $permissiondellink = $permissiontoadd; // Used by the include of actions_dellink.inc.php $upload_dir = $conf->asset->multidir_output[isset($object->entity) ? $object->entity : 1]; diff --git a/htdocs/asset/model/depreciation_options.php b/htdocs/asset/model/depreciation_options.php index e8519e581d9..5f4a3276202 100644 --- a/htdocs/asset/model/depreciation_options.php +++ b/htdocs/asset/model/depreciation_options.php @@ -53,8 +53,8 @@ if ($id > 0 || !empty($ref)) { $upload_dir = $conf->asset->multidir_output[$object->entity] . "/" . $object->id; } -$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->read))); -$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->write))); // Used by the include of actions_addupdatedelete.inc.php +$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('asset', 'read')) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->read))); +$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('asset', 'write')) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->write))); // Used by the include of actions_addupdatedelete.inc.php // Security check (enable the most restrictive one) if ($user->socid > 0) accessforbidden(); diff --git a/htdocs/asset/model/list.php b/htdocs/asset/model/list.php index d87a9ea55c8..dc6c544abaf 100644 --- a/htdocs/asset/model/list.php +++ b/htdocs/asset/model/list.php @@ -121,9 +121,9 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); -$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->read))); -$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->write))); -$permissiontodelete = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->delete) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->delete))); +$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('asset', 'read')) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->read))); +$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('asset', 'write')) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->write))); +$permissiontodelete = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('asset', 'delete')) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->delete))); // Security check if (!isModEnabled('asset')) { diff --git a/htdocs/asset/model/note.php b/htdocs/asset/model/note.php index 52d7e13e777..9e26aee3e19 100644 --- a/htdocs/asset/model/note.php +++ b/htdocs/asset/model/note.php @@ -51,8 +51,8 @@ if ($id > 0 || !empty($ref)) { $upload_dir = $conf->asset->multidir_output[$object->entity] . "/" . $object->id; } -$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->read))); -$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->write))); // Used by the include of actions_addupdatedelete.inc.php +$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('asset', 'read')) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->read))); +$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('asset', 'write')) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->write))); // Used by the include of actions_addupdatedelete.inc.php $permissionnote = $permissiontoadd; // Used by the include of actions_setnotes.inc.php // Security check (enable the most restrictive one) @@ -68,7 +68,8 @@ if (!$permissiontoread) accessforbidden(); * Actions */ -$reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } diff --git a/htdocs/asset/note.php b/htdocs/asset/note.php index dd31b723cea..10f1d81f1ae 100644 --- a/htdocs/asset/note.php +++ b/htdocs/asset/note.php @@ -65,7 +65,8 @@ if (!isModEnabled('asset')) accessforbidden(); * Actions */ -$reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } diff --git a/htdocs/bom/bom_note.php b/htdocs/bom/bom_note.php index 188c34c8c05..aba22ade7ca 100644 --- a/htdocs/bom/bom_note.php +++ b/htdocs/bom/bom_note.php @@ -74,7 +74,8 @@ restrictedArea($user, 'bom', $object->id, $object->table_element, '', '', 'rowid * Actions */ -$reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index a262e8d8885..3a01c3b9c2d 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -112,11 +112,11 @@ if ($id > 0 && $removeelem > 0 && $action == 'unlink') { $tmpobject = new Product($db); $result = $tmpobject->fetch($removeelem); $elementtype = 'product'; - } elseif ($type == Categorie::TYPE_SUPPLIER && $user->rights->societe->creer) { + } elseif ($type == Categorie::TYPE_SUPPLIER && $user->hasRight('societe', 'creer')) { $tmpobject = new Societe($db); $result = $tmpobject->fetch($removeelem); $elementtype = 'supplier'; - } elseif ($type == Categorie::TYPE_CUSTOMER && $user->rights->societe->creer) { + } elseif ($type == Categorie::TYPE_CUSTOMER && $user->hasRight('societe', 'creer')) { $tmpobject = new Societe($db); $result = $tmpobject->fetch($removeelem); $elementtype = 'customer'; @@ -125,7 +125,7 @@ if ($id > 0 && $removeelem > 0 && $action == 'unlink') { $tmpobject = new Adherent($db); $result = $tmpobject->fetch($removeelem); $elementtype = 'member'; - } elseif ($type == Categorie::TYPE_CONTACT && $user->rights->societe->creer) { + } elseif ($type == Categorie::TYPE_CONTACT && $user->hasRight('societe', 'creer')) { require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; $tmpobject = new Contact($db); $result = $tmpobject->fetch($removeelem); @@ -140,7 +140,7 @@ if ($id > 0 && $removeelem > 0 && $action == 'unlink') { $tmpobject = new Project($db); $result = $tmpobject->fetch($removeelem); $elementtype = 'project'; - } elseif ($type == Categorie::TYPE_USER && $user->rights->user->user->creer) { + } elseif ($type == Categorie::TYPE_USER && $user->hasRight('user', 'user', 'creer')) { require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; $tmpobject = new User($db); $result = $tmpobject->fetch($removeelem); @@ -174,13 +174,13 @@ if ($user->rights->categorie->supprimer && $action == 'confirm_delete' && $confi if ($elemid && $action == 'addintocategory' && (($type == Categorie::TYPE_PRODUCT && ($user->rights->produit->creer || $user->rights->service->creer)) || - ($type == Categorie::TYPE_CUSTOMER && $user->rights->societe->creer) || - ($type == Categorie::TYPE_SUPPLIER && $user->rights->societe->creer) || + ($type == Categorie::TYPE_CUSTOMER && $user->hasRight('societe', 'creer')) || + ($type == Categorie::TYPE_SUPPLIER && $user->hasRight('societe', 'creer')) || ($type == Categorie::TYPE_TICKET && $user->rights->ticket->write) || ($type == Categorie::TYPE_PROJECT && $user->rights->projet->creer) || ($type == Categorie::TYPE_MEMBER && $user->hasRight('adherent', 'creer')) || - ($type == Categorie::TYPE_CONTACT && $user->rights->societe->creer) || - ($type == Categorie::TYPE_USER && $user->rights->user->user->creer) || + ($type == Categorie::TYPE_CONTACT && $user->hasRight('societe', 'creer')) || + ($type == Categorie::TYPE_USER && $user->hasRight('user', 'user', 'creer')) || ($type == Categorie::TYPE_ACCOUNT && $user->rights->banque->configurer) )) { if ($type == Categorie::TYPE_PRODUCT) { diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 17f77a6f644..158cfc3aef0 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -155,7 +155,7 @@ $TDurationTypes = array('y'=>$langs->trans('Years'), 'm'=>$langs->trans('Month') $result = restrictedArea($user, 'agenda', $object, 'actioncomm&societe', 'myactions|allactions', 'fk_soc', 'id'); -$usercancreate = $user->hasRight('agenda', 'allactions', 'create') || (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->create); +$usercancreate = $user->hasRight('agenda', 'allactions', 'create') || (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->hasRight('agenda', 'myactions', 'create')); /* @@ -215,7 +215,7 @@ if (empty($reshook) && (GETPOST('addassignedtouser') || GETPOST('updateassignedt // Link to a project if (empty($reshook) && $action == 'classin' && ($user->hasRight('agenda', 'allactions', 'create') || - (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->create))) { + (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->hasRight('agenda', 'myactions', 'create')))) { //$object->fetch($id); $object->setProject(GETPOST('projectid', 'int')); } @@ -970,7 +970,7 @@ if (empty($reshook) && $action == 'confirm_delete' && GETPOST("confirm") == 'yes $object->fetch_userassigned(); $object->oldcopy = dol_clone($object); - if ($user->rights->agenda->myactions->delete + if ($user->hasRight('agenda', 'myactions', 'delete') || $user->rights->agenda->allactions->delete) { $result = $object->delete(); @@ -1089,7 +1089,7 @@ if (empty($reshook) && GETPOST('actionmove', 'alpha') == 'mupdate') { // Actions to delete doc $upload_dir = $conf->agenda->dir_output.'/'.dol_sanitizeFileName($object->ref); -$permissiontoadd = ($user->hasRight('agenda', 'allactions', 'create') || (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->read)); +$permissiontoadd = ($user->hasRight('agenda', 'allactions', 'create') || (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->hasRight('agenda', 'myactions', 'read'))); if (empty($reshook)) { include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; } @@ -2415,7 +2415,7 @@ if ($id > 0) { } // Description - print ''; @@ -2478,21 +2478,21 @@ if ($id > 0) { if (empty($reshook)) { if ($action != 'edit') { if ($user->hasRight('agenda', 'allactions', 'create') || - (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->create)) { + (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->hasRight('agenda', 'myactions', 'create'))) { print '
'.$langs->trans("Modify").'
'; } else { print '
'.$langs->trans("Modify").'
'; } if ($user->hasRight('agenda', 'allactions', 'create') || - (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->create)) { + (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->hasRight('agenda', 'myactions', 'create'))) { print '
'.$langs->trans("ToClone").'
'; } else { print '
'.$langs->trans("ToClone").'
'; } if ($user->rights->agenda->allactions->delete || - (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->delete)) { + (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->hasRight('agenda', 'myactions', 'delete'))) { print '
'.$langs->trans("Delete").'
'; } else { print '
'.$langs->trans("Delete").'
'; diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 8879e48edd6..b79dfb084c5 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -2179,7 +2179,7 @@ class ActionComm extends CommonObject if ($exportholiday == 1) { $langs->load("holiday"); - $title = $langs->trans("Holidays"); + $title = $langs->transnoentities("Holidays"); $sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.email, u.statut, x.rowid, x.date_debut as date_start, x.date_fin as date_end, x.halfday, x.statut as status"; $sql .= " FROM ".MAIN_DB_PREFIX."holiday as x, ".MAIN_DB_PREFIX."user as u"; diff --git a/htdocs/comm/action/class/api_agendaevents.class.php b/htdocs/comm/action/class/api_agendaevents.class.php index 4f7a944070b..908b4cc1d9a 100644 --- a/htdocs/comm/action/class/api_agendaevents.class.php +++ b/htdocs/comm/action/class/api_agendaevents.class.php @@ -289,7 +289,7 @@ class AgendaEvents extends DolibarrApi */ public function delete($id) { - if (!DolibarrApiAccess::$user->rights->agenda->myactions->delete) { + if (!DolibarrApiAccess::$user->hasRight('agenda', 'myactions', 'delete')) { throw new RestException(401, "Insufficient rights to delete your Agenda Event"); } diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php index 851f4419179..66d115c171c 100644 --- a/htdocs/comm/action/document.php +++ b/htdocs/comm/action/document.php @@ -92,7 +92,7 @@ if ($user->socid && $socid) { $result = restrictedArea($user, 'societe', $socid); } -$usercancreate = $user->hasRight('agenda', 'allactions', 'create') || (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->create); +$usercancreate = $user->hasRight('agenda', 'allactions', 'create') || (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->hasRight('agenda', 'myactions', 'create')); $permissiontoadd = $usercancreate; diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index d9089f03c14..461897ecab0 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -1875,7 +1875,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa } } else { if ($user->hasRight('agenda', 'allactions', 'create') || - (($event->authorid == $user->id || $event->userownerid == $user->id) && $user->rights->agenda->myactions->create)) { + (($event->authorid == $user->id || $event->userownerid == $user->id) && $user->hasRight('agenda', 'myactions', 'create'))) { $cssclass .= " movable cursormove"; } else { $cssclass .= " unmovable"; diff --git a/htdocs/comm/action/info.php b/htdocs/comm/action/info.php index ee34d07ea4b..9d9baff3c3e 100644 --- a/htdocs/comm/action/info.php +++ b/htdocs/comm/action/info.php @@ -53,7 +53,7 @@ if ($user->socid && $socid) { $result = restrictedArea($user, 'societe', $socid); } -$usercancreate = $user->hasRight('agenda', 'allactions', 'create') || (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->create); +$usercancreate = $user->hasRight('agenda', 'allactions', 'create') || (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->hasRight('agenda', 'myactions', 'create')); /* diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 342d0ba1a25..79330cd57bf 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -401,7 +401,7 @@ $arrayofmassactions = array( if ($user->rights->agenda->allactions->delete) { $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); } -if (isModEnabled('category') && $user->rights->agenda->myactions->create) { +if (isModEnabled('category') && $user->hasRight('agenda', 'myactions', 'create')) { $arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag"); } if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete','preaffecttag'))) { diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index f0fb4a9bf7d..067cbce8efe 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -405,7 +405,7 @@ if ($object->fetch($id) >= 0) { print load_fiche_titre($langs->trans("ToAddRecipientsChooseHere"), ($user->admin ?info_admin($langs->trans("YouCanAddYourOwnPredefindedListHere"), 1) : ''), 'generic'); print '
'; - print '
'; + print '
'; print '
'; print '
'; diff --git a/htdocs/comm/multiprix.php b/htdocs/comm/multiprix.php index 81e5cd0d9d2..fe6c733713b 100644 --- a/htdocs/comm/multiprix.php +++ b/htdocs/comm/multiprix.php @@ -54,7 +54,7 @@ $result = restrictedArea($user, 'societe', $id, '&societe', '', 'fk_soc', 'rowid * Actions */ -if ($action == 'setpricelevel' && $user->rights->societe->creer) { +if ($action == 'setpricelevel' && $user->hasRight('societe', 'creer')) { $soc = new Societe($db); $soc->fetch($id); $soc->setPriceLevel(GETPOST("price_level"), $user); diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 17231dde517..bc11bc8e4b1 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -2800,7 +2800,7 @@ if ($action == 'create') { print '
'; print ''; if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { - print ''; + print ''; } print ''; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index b3f3d387df3..d7fb02e14f3 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3721,6 +3721,7 @@ class Propal extends CommonObject { global $conf, $langs, $user; + $langs->load('propal'); $datas = []; $nofetch = !empty($params['nofetch']); diff --git a/htdocs/comm/propal/note.php b/htdocs/comm/propal/note.php index ace4556fb62..36eb458f252 100644 --- a/htdocs/comm/propal/note.php +++ b/htdocs/comm/propal/note.php @@ -68,7 +68,8 @@ $usercancreate = $user->hasRight("propal", "creer"); $permissionnote = $user->rights->propal->creer; // Used by the include of actions_setnotes.inc.php -$reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index c9ca03380a0..e7d386e348a 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -68,7 +68,7 @@ if (GETPOST('cancel', 'alpha') && !empty($backtopage)) { if ($action == 'confirm_split' && GETPOST("confirm", "alpha") == 'yes' && $permissiontocreate) { //if ($user->rights->societe->creer) - //if ($user->rights->facture->creer) + //if ($user->hasRight('facture', 'creer')) $amount_ttc_1 = GETPOST('amount_ttc_1', 'alpha'); $amount_ttc_1 = price2num($amount_ttc_1); @@ -159,7 +159,7 @@ if ($action == 'confirm_split' && GETPOST("confirm", "alpha") == 'yes' && $permi if ($action == 'setremise' && $permissiontocreate) { //if ($user->rights->societe->creer) - //if ($user->rights->facture->creer) + //if ($user->hasRight('facture', 'creer')) $amount = price2num(GETPOST('amount', 'alpha'), '', 2); $desc = GETPOST('desc', 'alpha'); @@ -199,7 +199,7 @@ if ($action == 'setremise' && $permissiontocreate) { if (GETPOST('action', 'aZ09') == 'confirm_remove' && GETPOST("confirm") == 'yes' && $permissiontocreate) { //if ($user->rights->societe->creer) - //if ($user->rights->facture->creer) + //if ($user->hasRight('facture', 'creer')) $db->begin(); diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 778df650514..2736bf80d64 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2742,7 +2742,7 @@ if ($action == 'create' && $usercancreate) { print ''; if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { // Multicurrency Amount TTC - print ''; + print ''; } print ''; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 2f58c5576c7..4036eca225c 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3753,7 +3753,7 @@ class Commande extends CommonOrder if ($user->hasRight('commande', 'lire')) { $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("Order").''; if (isset($this->statut)) { - $datas[] = ' '.$this->getLibStatut(5); + $datas['status'] = ' '.$this->getLibStatut(5); } $datas['Ref'] = '
'.$langs->trans('Ref').': '.$this->ref; if (!$nofetch) { @@ -4181,7 +4181,7 @@ class Commande extends CommonOrder $now = dol_now(); - return max($this->date, $this->date_livraison) < ($now - $conf->commande->client->warning_delay); + return max($this->date, $this->delivery_date) < ($now - $conf->commande->client->warning_delay); } /** @@ -4193,7 +4193,7 @@ class Commande extends CommonOrder { global $conf, $langs; - if (empty($this->date_livraison)) { + if (empty($this->delivery_date)) { $text = $langs->trans("OrderDate").' '.dol_print_date($this->date_commande, 'day'); } else { $text = $text = $langs->trans("DeliveryDate").' '.dol_print_date($this->date_livraison, 'day'); diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 3ada37889db..6344bcec5d2 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -2089,7 +2089,7 @@ if ($resql) { // If module invoices enabled and user with invoice creation permissions if (isModEnabled('facture') && !empty($conf->global->ORDER_BILLING_ALL_CUSTOMER)) { - if ($user->rights->facture->creer) { + if ($user->hasRight('facture', 'creer')) { if (($obj->fk_statut > 0 && $obj->fk_statut < 3) || ($obj->fk_statut == 3 && $obj->billed == 0)) { print ' '; print img_picto($langs->trans("CreateInvoiceForThisCustomer").' : '.$companystatic->name, 'object_bill', 'hideonsmartphone').''; diff --git a/htdocs/commande/list_det.php b/htdocs/commande/list_det.php index 166afaeb5b3..62122b71d52 100644 --- a/htdocs/commande/list_det.php +++ b/htdocs/commande/list_det.php @@ -813,7 +813,7 @@ if ($resql) { // List of mass actions available $arrayofmassactions = array( - 'GenerateOrdersSuppliers'=>img_picto('', 'doc', 'class="pictofixedwidth"').$langs->trans("GenerateOrdersSupplie"), + // TODO add mass action here ); $massactionbutton = $form->selectMassAction('', $arrayofmassactions); @@ -1436,7 +1436,8 @@ if ($resql) { if (empty($i)) { $oldref = $obj->product_ref; } - if ($oldref != $obj->product_ref) { + if ($oldref != $obj->product_ref && $sortfield == 'pr.ref') { + // TODO make new /core/tpl/list_print_sub_total.php include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; $oldref = $obj->product_ref; } @@ -1600,7 +1601,7 @@ if ($resql) { // If module invoices enabled and user with invoice creation permissions if (isModEnabled('facture') && !empty($conf->global->ORDER_BILLING_ALL_CUSTOMER)) { - if ($user->rights->facture->creer) { + if ($user->hasRight('facture', 'creer')) { if (($obj->fk_statut > 0 && $obj->fk_statut < 3) || ($obj->fk_statut == 3 && $obj->billed == 0)) { print ' '; print img_picto($langs->trans("CreateInvoiceForThisCustomer").' : '.$companystatic->name, 'object_bill', 'hideonsmartphone').''; @@ -1995,83 +1996,79 @@ if ($resql) { print ''; // Amount HT print ''; @@ -4849,7 +4848,7 @@ if ($action == 'create') { print ''; if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { // Multicurrency Amount TTC - print ''; + print ''; } print ''; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 1868e37038d..5702c078aca 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -237,9 +237,15 @@ class Facture extends CommonInvoice */ public $lines = array(); + /** + * @var FactureLigne + */ public $line; public $extraparams = array(); + /** + * @var int ID facture rec + */ public $fac_rec; public $date_pointoftax; @@ -2461,8 +2467,6 @@ class Facture extends CommonInvoice */ public function update(User $user, $notrigger = 0) { - global $conf; - $error = 0; // Clean parameters @@ -4436,7 +4440,7 @@ class Facture extends CommonInvoice $remise = 0; } - if ($user->rights->facture->creer) { + if ($user->hasRight('facture', 'creer')) { $remise = price2num($remise, 2); $error = 0; @@ -4500,7 +4504,7 @@ class Facture extends CommonInvoice $remise = 0; } - if ($user->rights->facture->creer) { + if ($user->hasRight('facture', 'creer')) { $error = 0; $this->db->begin(); @@ -6010,6 +6014,9 @@ class FactureLigne extends CommonInvoiceLine */ public $table_element = 'facturedet'; + /** + * @var FactureLigne + */ public $oldline; //! From llx_facturedet @@ -6067,6 +6074,16 @@ class FactureLigne extends CommonInvoiceLine public $multicurrency_total_tva; public $multicurrency_total_ttc; + /** + * Constructor + * + * @param DoliDB $db handler d'acces base de donnee + */ + public function __construct($db) + { + $this->db = $db; + } + /** * Load invoice line from database * diff --git a/htdocs/compta/facture/invoicetemplate_list.php b/htdocs/compta/facture/invoicetemplate_list.php index 8625be6438e..56ef08d1f1e 100644 --- a/htdocs/compta/facture/invoicetemplate_list.php +++ b/htdocs/compta/facture/invoicetemplate_list.php @@ -854,7 +854,7 @@ while ($i < $imaxinloop) { // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print '
'; + $searchpicto = $form->showFilterButtons(); + print $searchpicto; + print ''; print ''; - $searchpicto = $form->showFilterButtons(); - print $searchpicto; - print ''; + $searchpicto = $form->showFilterButtons(); + print $searchpicto; + print '
'; + print $link; + print ''.$line->subledger_account.' ('.$line->subledger_label.')'.price(price2num($line->debit - $line->credit, 'MT')).''; - print $link; - print ''; + print $link; + print '
'.$langs->trans("SubTotal").':
'.$langs->trans("SubTotal").':'.price(price2num($sous_total_opening_balance, 'MT')).'' . price(price2num($sous_total_debit - $sous_total_credit, 'MT')) . '
'.$langs->trans("AccountBalance").':
'.$langs->trans("AccountBalance").':'.price(price2num($total_opening_balance, 'MT')).'' . price(price2num($total_debit - $total_credit, 'MT')) . '
".$invoicestatic->getNomUrl(1).""; - $accountoshow = length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER); + $accountoshow = length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER')); if (($accountoshow == "") || $accountoshow == 'NotDefined') { print ''.$langs->trans("MainAccountForSuppliersNotDefined").''; } else { @@ -1067,7 +1068,7 @@ if (empty($action) || $action == 'view') { print ""; - if (!empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT)) { + if (getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT')) { if ($k == getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT')) { print length_accounta($tabcompany[$key]['code_compta']); } @@ -1097,7 +1098,7 @@ if (empty($action) || $action == 'view') { } // VAT Reverse charge - if ($mysoc->country_code == 'FR' || !empty($conf->global->ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE)) { + if ($mysoc->country_code == 'FR' || getDolGlobalString('ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE')) { $has_vat = false; foreach ($arrayofvat[$key] as $k => $mt) { if ($mt) { diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index e8178ad63d3..3f7b4ecdeb5 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -109,7 +109,7 @@ if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end)) $sql = "SELECT f.rowid, f.ref, f.type, f.situation_cycle_ref, f.datef as df, f.ref_client, f.date_lim_reglement as dlr, f.close_code, f.retained_warranty,"; $sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.situation_percent, fd.vat_src_code, fd.info_bits,"; $sql .= " s.rowid as socid, s.nom as name, s.code_client, s.code_fournisseur,"; -if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { +if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) { $sql .= " spe.accountancy_code_customer as code_compta,"; $sql .= " spe.accountancy_code_supplier as code_compta_fournisseur,"; } else { @@ -117,26 +117,26 @@ if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { $sql .= " s.code_compta_fournisseur,"; } $sql .= " p.rowid as pid, p.ref as pref, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte,"; -if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { +if (getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) { $sql .= " ppe.accountancy_code_sell"; } else { $sql .= " p.accountancy_code_sell"; } $sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = fd.fk_product"; -if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { +if (getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) { $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); } $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = fd.fk_code_ventilation"; $sql .= " JOIN ".MAIN_DB_PREFIX."facture as f ON f.rowid = fd.fk_facture"; $sql .= " JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc"; -if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { +if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) { $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity); } $sql .= " WHERE fd.fk_code_ventilation > 0"; $sql .= " AND f.entity IN (".getEntity('invoice', 0).')'; // We don't share object for accountancy, we use source object sharing $sql .= " AND f.fk_statut > 0"; -if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { // Non common setup +if (getDolGlobalString('FACTURE_DEPOSITS_ARE_JUST_PAYMENTS')) { // Non common setup $sql .= " AND f.type IN (".Facture::TYPE_STANDARD.",".Facture::TYPE_REPLACEMENT.",".Facture::TYPE_CREDIT_NOTE.",".Facture::TYPE_SITUATION.")"; } else { $sql .= " AND f.type IN (".Facture::TYPE_STANDARD.",".Facture::TYPE_REPLACEMENT.",".Facture::TYPE_CREDIT_NOTE.",".Facture::TYPE_DEPOSIT.",".Facture::TYPE_SITUATION.")"; @@ -146,8 +146,8 @@ if ($date_start && $date_end) { $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'"; } // Define begin binding date -if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) { - $sql .= " AND f.datef >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'"; +if (getDolGlobalString('ACCOUNTING_DATE_START_BINDING')) { + $sql .= " AND f.datef >= '".$db->idate(getDolGlobalString('ACCOUNTING_DATE_START_BINDING'))."'"; } // Already in bookkeeping or not if ($in_bookkeeping == 'already') { @@ -177,8 +177,8 @@ if ($result) { $num = $db->num_rows($result); // Variables - $cptcli = (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER != "")) ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : 'NotDefined'; - $cpttva = (!empty($conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT : 'NotDefined'; + $cptcli = getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER', 'NotDefined'); + $cpttva = getDolGlobalString('ACCOUNTING_VAT_SOLD_ACCOUNT', 'NotDefined'); $i = 0; while ($i < $num) { @@ -190,9 +190,9 @@ if ($result) { $compta_prod = $obj->compte; if (empty($compta_prod)) { if ($obj->product_type == 0) { - $compta_prod = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : 'NotDefined'; + $compta_prod = getDolGlobalString('ACCOUNTING_PRODUCT_SOLD_ACCOUNT', 'NotDefined'); } else { - $compta_prod = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : 'NotDefined'; + $compta_prod = getDolGlobalString('ACCOUNTING_SERVICE_SOLD_ACCOUNT', 'NotDefined'); } } @@ -257,7 +257,7 @@ if ($result) { // It also seems that credit notes on situation invoices are correctly saved (but it depends on the version used in fact). // For credit notes, we hope to have situation_ratio = 1 so the compensation has no effect to avoid introducing troubles with credit notes. $total_ttc = $obj->total_ttc * $situation_ratio; - if (!empty($conf->global->INVOICE_USE_RETAINED_WARRANTY) && $obj->retained_warranty > 0) { + if (getDolGlobalString('INVOICE_USE_RETAINED_WARRANTY') && $obj->retained_warranty > 0) { $retained_warranty = (double) price2num($total_ttc * $obj->retained_warranty / 100, 'MT'); $tabwarranty[$obj->rowid][$compta_soc] += $retained_warranty; $total_ttc -= $retained_warranty; @@ -315,11 +315,11 @@ if ($action == 'writebookkeeping') { $invoicestatic = new Facture($db); $accountingaccountcustomer = new AccountingAccount($db); - $accountingaccountcustomer->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER, true); + $accountingaccountcustomer->fetch(null, getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER'), true); $accountingaccountcustomerwarranty = new AccountingAccount($db); - $accountingaccountcustomerwarranty->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY, true); + $accountingaccountcustomerwarranty->fetch(null, getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY'), true); foreach ($tabfac as $key => $val) { // Loop on each invoice $errorforline = 0; @@ -381,7 +381,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->subledger_account = $tabcompany[$key]['code_compta']; $bookkeeping->subledger_label = $tabcompany[$key]['name']; - $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY; + $bookkeeping->numero_compte = getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY'); $bookkeeping->label_compte = $accountingaccountcustomerwarranty->label; $bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref.' - '.$langs->trans("Retainedwarranty"); @@ -430,7 +430,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->subledger_account = $tabcompany[$key]['code_compta']; $bookkeeping->subledger_label = $tabcompany[$key]['name']; - $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER; + $bookkeeping->numero_compte = getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER'); $bookkeeping->label_compte = $accountingaccountcustomer->label; $bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref.' - '.$langs->trans("SubledgerAccount"); @@ -488,7 +488,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add $bookkeeping->thirdparty_code = $companystatic->code_client; - if (!empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT)) { + if (getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT')) { if ($k == getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT')) { $bookkeeping->subledger_account = $tabcompany[$key]['code_compta']; $bookkeeping->subledger_label = $tabcompany[$key]['name']; @@ -657,7 +657,7 @@ $form = new Form($db); // Export if ($action == 'exportcsv') { // ISO and not UTF8 ! - $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; + $sep = getDolGlobalString('ACCOUNTING_EXPORT_SEPARATORCSV'); $filename = 'journal'; $type_export = 'journal'; @@ -704,7 +704,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! print '"'.$val["ref"].'"'.$sep; print '"'.utf8_decode(dol_trunc($companystatic->name, 32)).'"'.$sep; print '"'.length_accounta(html_entity_decode($k)).'"'.$sep; - print '"'.length_accountg($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY).'"'.$sep; + print '"'.length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY')).'"'.$sep; print '"'.length_accounta(html_entity_decode($k)).'"'.$sep; print '"'.$langs->trans("Thirdparty").'"'.$sep; print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.$invoicestatic->ref.' - '.$langs->trans("Retainedwarranty").'"'.$sep; @@ -723,7 +723,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! print '"'.$val["ref"].'"'.$sep; print '"'.utf8_decode(dol_trunc($companystatic->name, 32)).'"'.$sep; print '"'.length_accounta(html_entity_decode($k)).'"'.$sep; - print '"'.length_accountg($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER).'"'.$sep; + print '"'.length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER')).'"'.$sep; print '"'.length_accounta(html_entity_decode($k)).'"'.$sep; print '"'.$langs->trans("Thirdparty").'"'.$sep; print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.$invoicestatic->ref.' - '.$langs->trans("Thirdparty").'"'.$sep; @@ -800,7 +800,7 @@ if (empty($action) || $action == 'view') { $exportlink = ''; $builddate = dol_now(); $description = $langs->trans("DescJournalOnlyBindedVisible").'
'; - if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { + if (getDolGlobalString('FACTURE_DEPOSITS_ARE_JUST_PAYMENTS')) { $description .= $langs->trans("DepositsAreNotIncluded"); } else { $description .= $langs->trans("DepositsAreIncluded"); @@ -815,7 +815,8 @@ if (empty($action) || $action == 'view') { journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink); // Button to write into Ledger - if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') { + $acctCustomerNotConfigured = in_array(getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER'), ['','-1']); + if ($acctCustomerNotConfigured) { print '
'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone"); $desc = ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '{link}'); $desc = str_replace('{link}', ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'', $desc); @@ -823,10 +824,10 @@ if (empty($action) || $action == 'view') { print '
'; } print '
'; - if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping == 'notyet') { + if (getDolGlobalString('ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL') && $in_bookkeeping == 'notyet') { print ''; } - if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') { + if ($acctCustomerNotConfigured) { print ''; } else { if ($in_bookkeeping == 'notyet') { @@ -950,7 +951,7 @@ if (empty($action) || $action == 'view') { print "
".$invoicestatic->getNomUrl(1).""; - $accountoshow = length_accountg($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY); + $accountoshow = length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY')); if (($accountoshow == "") || $accountoshow == 'NotDefined') { print ''.$langs->trans("MainAccountForCustomersNotDefined").''; } else { @@ -980,7 +981,7 @@ if (empty($action) || $action == 'view') { print "".$invoicestatic->getNomUrl(1).""; - $accountoshow = length_accountg($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER); + $accountoshow = length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER')); if (($accountoshow == "") || $accountoshow == 'NotDefined') { print ''.$langs->trans("MainAccountForCustomersNotDefined").''; } else { @@ -1024,7 +1025,7 @@ if (empty($action) || $action == 'view') { print ""; - if (!empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT)) { + if (getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT')) { if ($k == getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT')) { print length_accounta($tabcompany[$key]['code_compta']); } diff --git a/htdocs/accountancy/supplier/card.php b/htdocs/accountancy/supplier/card.php index 306b88d11ea..b393c0f54ce 100644 --- a/htdocs/accountancy/supplier/card.php +++ b/htdocs/accountancy/supplier/card.php @@ -57,7 +57,7 @@ if (empty($user->rights->accounting->mouvements->lire)) { * Actions */ -if ($action == 'ventil' && $user->rights->accounting->bind->write) { +if ($action == 'ventil' && $user->hasRight('accounting', 'bind', 'write')) { if (!$cancel) { if ($codeventil < 0) { $codeventil = 0; diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index 5d212e57ccf..d6df336d979 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -91,7 +91,7 @@ if (empty($user->rights->accounting->mouvements->lire)) { * Actions */ -if (($action == 'clean' || $action == 'validatehistory') && $user->rights->accounting->bind->write) { +if (($action == 'clean' || $action == 'validatehistory') && $user->hasRight('accounting', 'bind', 'write')) { // Clean database $db->begin(); $sql1 = "UPDATE ".$db->prefix()."facture_fourn_det as fd"; diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 2c4fece83f0..06fd0369f03 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -133,7 +133,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_tvaintra = ''; } -if (is_array($changeaccount) && count($changeaccount) > 0 && $user->rights->accounting->bind->write) { +if (is_array($changeaccount) && count($changeaccount) > 0 && $user->hasRight('accounting', 'bind', 'write')) { $error = 0; if (!(GETPOST('account_parent', 'int') >= 0)) { diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 2b8fea60e51..8d227b7ce1b 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -169,7 +169,7 @@ if (empty($reshook)) { } -if ($massaction == 'ventil' && $user->rights->accounting->bind->write) { +if ($massaction == 'ventil' && $user->hasRight('accounting', 'bind', 'write')) { $msg = ''; if (!empty($mesCasesCochees)) { @@ -453,7 +453,7 @@ if ($result) { //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), ); - //if ($user->rights->mymodule->supprimer) $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); + //if ($user->hasRight('mymodule', 'supprimer')) $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); //if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); if ($massaction !== 'set_default_account') { $massactionbutton = $form->selectMassAction('ventil', $arrayofmassactions, 1); diff --git a/htdocs/adherents/canvas/actions_adherentcard_common.class.php b/htdocs/adherents/canvas/actions_adherentcard_common.class.php index 74330c65ccd..84ae98ac3c5 100644 --- a/htdocs/adherents/canvas/actions_adherentcard_common.class.php +++ b/htdocs/adherents/canvas/actions_adherentcard_common.class.php @@ -216,7 +216,7 @@ abstract class ActionsAdherentCardCommon $this->tpl['visibility'] = $this->object->getmorphylib($this->object->morphy); - $this->tpl['note'] = nl2br($this->object->note); + $this->tpl['note'] = $this->object->note_private; } if ($action == 'create_user') { @@ -251,7 +251,8 @@ abstract class ActionsAdherentCardCommon $this->object->old_name = GETPOST("old_name"); $this->object->old_firstname = GETPOST("old_firstname"); - $this->object->fk_soc = GETPOST("fk_soc"); + $this->object->fk_soc = GETPOST("fk_soc", 'int'); + $this->object->socid = GETPOST("fk_soc", 'int'); $this->object->lastname = GETPOST("lastname"); $this->object->firstname = GETPOST("firstname"); $this->object->civility_id = GETPOST("civility_id"); @@ -262,8 +263,8 @@ abstract class ActionsAdherentCardCommon $this->object->state_id = GETPOST("state_id", 'int'); $this->object->phone_perso = GETPOST("phone_perso"); $this->object->phone_mobile = GETPOST("phone_mobile"); - $this->object->email = GETPOST("email", 'alphawithlgt'); - $this->object->note = GETPOST("note", 'restricthtml'); + $this->object->email = GETPOST("email", 'alphawithlgt'); + $this->object->note_private = GETPOST("note", 'restricthtml'); $this->object->canvas = GETPOST("canvas"); // We set country_id, and country_code label of the chosen country diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 5816c5c4ea1..820e9455efb 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -316,7 +316,7 @@ if (empty($reshook)) { $object->birth = $birthdate; $object->default_lang = GETPOST('default_lang', 'alpha'); $object->typeid = GETPOST("typeid", 'int'); - //$object->note = trim(GETPOST("comment","alpha")); + //$object->note = trim(GETPOST("comment", "restricthtml")); $object->morphy = GETPOST("morphy", 'alpha'); if (GETPOST('deletephoto', 'alpha')) { @@ -1336,7 +1336,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if (!$value['active']) { break; } - print '
'.$langs->trans($value['label']).'
'.$langs->trans($value['label']).'
'.$langs->trans("Amount").''.price($object->amount).'
'.$langs->trans("Label").''.$object->note.'
'.$langs->trans("Label").''.dol_string_onlythesehtmltags(dol_htmlentitiesbr($object->note_private)).'
rowid.'">'.img_edit().''.yn($objp->vote).''.$membertype->getLibStatut(5).'rowid.'">'.img_edit().'
'.$langs->trans("Description").''; - print nl2br($object->note)."
'.$langs->trans("WelcomeEMail").''; - print nl2br($object->mail_valid)."
'.$langs->trans("Description").''; + print '
'.$langs->trans("Description").''; print dol_string_onlythesehtmltags(dol_htmlentitiesbr($object->note_private)); print '
' . $langs->trans('AmountTTC') . '' . price($object->total_ttc, '', $langs, 0, -1, -1, $conf->currency) . '' . price($object->total_ttc, '', $langs, 0, -1, -1, $object->multicurrency_code) . '' . price($object->multicurrency_total_ttc, '', $langs, 0, -1, -1, $object->multicurrency_code) . '
' . price($object->total_ttc, 1, '', 1, -1, -1, $conf->currency) . '' . price($object->total_ttc, 1, '', 1, -1, -1, $object->multicurrency_code) . '' . price($object->multicurrency_total_ttc, 1, '', 1, -1, -1, $object->multicurrency_code) . '
'; if (!empty($show_shippable_command) && !empty($conf->stock->enabled)) { if (($obj->fk_statut > $generic_commande::STATUS_DRAFT) && ($obj->fk_statut < $generic_commande::STATUS_CLOSED)) { - $generic_commande->getLinesArray(); // Load array ->lines $generic_commande->loadExpeditions(); // Load array ->expeditions - $numlines = count($generic_commande->lines); // Loop on each line of order - for ($lig = 0; $lig < $numlines; $lig++) { - if (isset($generic_commande->expeditions[$generic_commande->lines[$lig]->id])) { - $reliquat = $generic_commande->lines[$lig]->qty - $generic_commande->expeditions[$generic_commande->lines[$lig]->id]; + if (isset($generic_commande->expeditions[$obj->rowid])) { + $reliquat = $obj->qty - $generic_commande->expeditions[$obj->rowid]; + } else { + $reliquat = $obj->qty; + } + if ($obj->product_type == 0 && $obj->fk_product > 0) { // If line is a product and not a service + $nbprod++; // order contains real products + $generic_product->id = $obj->fk_product; + + // Get local and virtual stock and store it into cache + if (empty($productstat_cache[$obj->fk_product])) { + $generic_product->load_stock('nobatch'); // ->load_virtual_stock() is already included into load_stock() + $productstat_cache[$obj->fk_product]['stock_reel'] = $generic_product->stock_reel; + $productstat_cachevirtual[$obj->fk_product]['stock_reel'] = $generic_product->stock_theorique; } else { - $reliquat = $generic_commande->lines[$lig]->qty; + $generic_product->stock_reel = $productstat_cache[$obj->fk_product]['stock_reel']; + $generic_product->stock_theorique = $productstat_cachevirtual[$obj->fk_product]['stock_reel'] = $generic_product->stock_theorique; } - if ($generic_commande->lines[$lig]->product_type == 0 && $generic_commande->lines[$lig]->fk_product > 0) { // If line is a product and not a service - $nbprod++; // order contains real products - $generic_product->id = $generic_commande->lines[$lig]->fk_product; - // Get local and virtual stock and store it into cache - if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product])) { - $generic_product->load_stock('nobatch'); // ->load_virtual_stock() is already included into load_stock() - $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_reel; - $productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_theorique; - } else { - $generic_product->stock_reel = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stock_reel']; - $generic_product->stock_theorique = $productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_theorique; - } - - if ($reliquat > $generic_product->stock_reel) { - $notshippable++; - } - if (empty($conf->global->SHIPPABLE_ORDER_ICON_IN_LIST)) { // Default code. Default should be this case. - $text_info .= $reliquat.' x '.$generic_commande->lines[$lig]->product_ref.' '.dol_trunc($generic_commande->lines[$lig]->product_label, 20); - $text_info .= ' - '.$langs->trans("Stock").': '.$generic_product->stock_reel.''; - $text_info .= ' - '.$langs->trans("VirtualStock").': '.$generic_product->stock_theorique.''; - $text_info .= ($reliquat != $generic_commande->lines[$lig]->qty ? ' ('.$langs->trans("QtyInOtherShipments").' '.($generic_commande->lines[$lig]->qty - $reliquat).')' : ''); - $text_info .= '
'; - } else { // BUGGED CODE. - // DOES NOT TAKE INTO ACCOUNT MANUFACTURING. THIS CODE SHOULD BE USELESS. PREVIOUS CODE SEEMS COMPLETE. - // COUNT STOCK WHEN WE SHOULD ALREADY HAVE VALUE - // Detailed virtual stock, looks bugged, uncomplete and need heavy load. - // stock order and stock order_supplier - $stock_order = 0; - $stock_order_supplier = 0; - if (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) { // What about other options ? - if (!empty($conf->commande->enabled)) { - if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer'])) { - $generic_product->load_stats_commande(0, '1,2'); - $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer'] = $generic_product->stats_commande['qty']; - } else { - $generic_product->stats_commande['qty'] = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer']; - } - $stock_order = $generic_product->stats_commande['qty']; + if ($reliquat > $generic_product->stock_reel) { + $notshippable++; + } + if (empty($conf->global->SHIPPABLE_ORDER_ICON_IN_LIST)) { // Default code. Default should be this case. + $text_info .= $reliquat.' x '.$obj->product_ref.' '.dol_trunc($obj->product_label, 20); + $text_info .= ' - '.$langs->trans("Stock").': '.$generic_product->stock_reel.''; + $text_info .= ' - '.$langs->trans("VirtualStock").': '.$generic_product->stock_theorique.''; + $text_info .= ($reliquat != $obj->qty ? ' ('.$langs->trans("QtyInOtherShipments").' '.($obj->qty - $reliquat).')' : ''); + $text_info .= '
'; + } else { // BUGGED CODE. + // DOES NOT TAKE INTO ACCOUNT MANUFACTURING. THIS CODE SHOULD BE USELESS. PREVIOUS CODE SEEMS COMPLETE. + // COUNT STOCK WHEN WE SHOULD ALREADY HAVE VALUE + // Detailed virtual stock, looks bugged, uncomplete and need heavy load. + // stock order and stock order_supplier + $stock_order = 0; + $stock_order_supplier = 0; + if (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) { // What about other options ? + if (!empty($conf->commande->enabled)) { + if (empty($productstat_cache[$obj->fk_product]['stats_order_customer'])) { + $generic_product->load_stats_commande(0, '1,2'); + $productstat_cache[$obj->fk_product]['stats_order_customer'] = $generic_product->stats_commande['qty']; + } else { + $generic_product->stats_commande['qty'] = $productstat_cache[$obj->fk_product]['stats_order_customer']; } - if (isModEnabled('supplier_order')) { - if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_supplier'])) { - $generic_product->load_stats_commande_fournisseur(0, '3'); - $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_supplier'] = $generic_product->stats_commande_fournisseur['qty']; - } else { - $generic_product->stats_commande_fournisseur['qty'] = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_supplier']; - } - $stock_order_supplier = $generic_product->stats_commande_fournisseur['qty']; - } - } - $text_info .= $reliquat.' x '.$generic_commande->lines[$lig]->ref.' '.dol_trunc($generic_commande->lines[$lig]->product_label, 20); - $text_stock_reel = $generic_product->stock_reel.'/'.$stock_order; - if ($stock_order > $generic_product->stock_reel && !($generic_product->stock_reel < $generic_commande->lines[$lig]->qty)) { - $warning++; - $text_warning .= ''.$langs->trans('Available').' : '.$text_stock_reel.''; - } - if ($reliquat > $generic_product->stock_reel) { - $text_info .= ''.$langs->trans('Available').' : '.$text_stock_reel.''; - } else { - $text_info .= ''.$langs->trans('Available').' : '.$text_stock_reel.''; + $stock_order = $generic_product->stats_commande['qty']; } if (isModEnabled('supplier_order')) { - $text_info .= ' '.$langs->trans('SupplierOrder').' : '.$stock_order_supplier; + if (empty($productstat_cache[$obj->fk_product]['stats_order_supplier'])) { + $generic_product->load_stats_commande_fournisseur(0, '3'); + $productstat_cache[$obj->fk_product]['stats_order_supplier'] = $generic_product->stats_commande_fournisseur['qty']; + } else { + $generic_product->stats_commande_fournisseur['qty'] = $productstat_cache[$obj->fk_product]['stats_order_supplier']; + } + $stock_order_supplier = $generic_product->stats_commande_fournisseur['qty']; } - $text_info .= ($reliquat != $generic_commande->lines[$lig]->qty ? ' ('.$langs->trans("QtyInOtherShipments").' '.($generic_commande->lines[$lig]->qty - $reliquat).')' : ''); - $text_info .= '
'; } + $text_info .= $reliquat.' x '.$obj->product_ref.' '.dol_trunc($obj->product_label, 20); + $text_stock_reel = $generic_product->stock_reel.'/'.$stock_order; + if ($stock_order > $generic_product->stock_reel && !($generic_product->stock_reel < $obj->qty)) { + $warning++; + $text_warning .= ''.$langs->trans('Available').' : '.$text_stock_reel.''; + } + if ($reliquat > $generic_product->stock_reel) { + $text_info .= ''.$langs->trans('Available').' : '.$text_stock_reel.''; + } else { + $text_info .= ''.$langs->trans('Available').' : '.$text_stock_reel.''; + } + if (isModEnabled('supplier_order')) { + $text_info .= ' '.$langs->trans('SupplierOrder').' : '.$stock_order_supplier; + } + $text_info .= ($reliquat != $obj->qty ? ' ('.$langs->trans("QtyInOtherShipments").' '.($obj->qty - $reliquat).')' : ''); + $text_info .= '
'; } } if ($notshippable == 0) { diff --git a/htdocs/commande/note.php b/htdocs/commande/note.php index 57eb073bba3..edcd2a14f16 100644 --- a/htdocs/commande/note.php +++ b/htdocs/commande/note.php @@ -68,7 +68,8 @@ if (!$object->fetch($id, $ref) > 0) { * Actions */ -$reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php index 8e7ccc4183f..33342098dbc 100644 --- a/htdocs/compta/bank/class/paymentvarious.class.php +++ b/htdocs/compta/bank/class/paymentvarious.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2018-2020 Frédéric France + * Copyright (C) 2018-2023 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 @@ -34,7 +34,7 @@ class PaymentVarious extends CommonObject /** * @var string ID to identify managed object */ - public $element = 'variouspayment'; + public $element = 'payment_various'; /** * @var string Name of table without prefix where object is stored @@ -184,8 +184,6 @@ class PaymentVarious extends CommonObject public function __construct(DoliDB $db) { $this->db = $db; - $this->element = 'payment_various'; - $this->table_element = 'payment_various'; } /** diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php index 4efbabbaf49..374280d4f8a 100644 --- a/htdocs/compta/facture/card-rec.php +++ b/htdocs/compta/facture/card-rec.php @@ -1229,7 +1229,7 @@ if ($action == 'create') { if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; - if ($user->rights->facture->creer) { + if ($user->hasRight('facture', 'creer')) { if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; } @@ -1684,7 +1684,7 @@ if ($action == 'create') { ), ); if (empty($object->suspended)) { - if ($user->rights->facture->creer) { + if ($user->hasRight('facture', 'creer')) { if (!empty($object->frequency) && $object->nb_gen_max > 0 && ($object->nb_gen_done >= $object->nb_gen_max)) { print ''; } else { @@ -1699,7 +1699,7 @@ if ($action == 'create') { } } - if ($user->rights->facture->creer) { + if ($user->hasRight('facture', 'creer')) { if (empty($object->suspended)) { print ''; } else { diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 3580fa33e30..f1f69b76969 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -4801,7 +4801,6 @@ if ($action == 'create') { if (!empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE_SCREEN) && $object->type == $object::TYPE_CREDIT_NOTE) { $sign = -1; // We invert sign for output } - print '
' . $langs->trans('AmountHT') . '' . price($sign * $object->total_ttc, '', $langs, 0, -1, -1, $conf->currency) . '' . price($sign * $object->total_ttc, '', $langs, 0, -1, -1, $object->multicurrency_code) . '' . price($sign * $object->multicurrency_total_ttc, '', $langs, 0, -1, -1, $object->multicurrency_code) . '
'; - if ($user->rights->facture->creer && empty($invoicerectmp->suspended)) { + if ($user->hasRight('facture', 'creer') && empty($invoicerectmp->suspended)) { if ($invoicerectmp->isMaxNbGenReached()) { print $langs->trans("MaxNumberOfGenerationReached"); } elseif (empty($objp->frequency) || $db->jdate($objp->date_when) <= $today) { @@ -1044,7 +1044,7 @@ while ($i < $imaxinloop) { // Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; - if ($user->rights->facture->creer && empty($invoicerectmp->suspended)) { + if ($user->hasRight('facture', 'creer') && empty($invoicerectmp->suspended)) { if ($invoicerectmp->isMaxNbGenReached()) { print $langs->trans("MaxNumberOfGenerationReached"); } elseif (empty($objp->frequency) || $db->jdate($objp->date_when) <= $today) { diff --git a/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php index c3c774b79e7..84d9db320ef 100644 --- a/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php +++ b/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php @@ -51,7 +51,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) { date_when, 'day'); ?> rights->facture->lire) { + if ($user->hasRight('facture', 'lire')) { $total = $total + $objectlink->total_ht; echo price($objectlink->total_ht); } diff --git a/htdocs/compta/paiement/card.php b/htdocs/compta/paiement/card.php index 865ce719291..69aa54365cf 100644 --- a/htdocs/compta/paiement/card.php +++ b/htdocs/compta/paiement/card.php @@ -537,7 +537,7 @@ print '
'; if (!empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) { if ($user->socid == 0 && $object->statut == 0 && $action == '') { - if ($user->rights->facture->paiement) { + if ($user->hasRight('facture', 'paiement')) { print ''.$langs->trans('Valid').''; } } diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 7df61ebefcb..d8d538c8d7a 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -306,6 +306,7 @@ class Paiement extends CommonObject if (!empty($currencyofpayment)) { // We must check that the currency of invoices is the same than the currency of the bank + include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; $bankaccount = new Account($this->db); $bankaccount->fetch($this->fk_account); $bankcurrencycode = empty($bankaccount->currency_code) ? $conf->currency : $bankaccount->currency_code; diff --git a/htdocs/compta/payment_sc/card.php b/htdocs/compta/payment_sc/card.php index 11f7f1e454f..4a1d44b6c92 100644 --- a/htdocs/compta/payment_sc/card.php +++ b/htdocs/compta/payment_sc/card.php @@ -55,7 +55,7 @@ if ($id > 0) { } } -$result = restrictedArea($user, 'payment_sc', $id, ''); +$result = restrictedArea($user, 'payment_sc', $object, ''); /* @@ -130,26 +130,20 @@ print '
'; print ''; -// Ref -/*print ''; -print '';*/ - // Date -print ''; +print ''; // Mode -print ''; +print ''; // Numero -print ''; +print ''; // Amount -print ''; +print ''; // Note -print ''; +print ''; // Bank account if (isModEnabled("banque")) { @@ -159,7 +153,7 @@ if (isModEnabled("banque")) { print ''; print ''; - print ''; print ''; @@ -252,8 +246,7 @@ if (!empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) { if ($user->socid == 0 && $object->statut == 0 && $_GET['action'] == '') { - if ($user->rights->facture->paiement) - { + if ($user->hasRight('facture', 'paiement')){ print ''.$langs->trans('Valid').''; } } diff --git a/htdocs/compta/payment_vat/card.php b/htdocs/compta/payment_vat/card.php index 88650256ecc..bf4eb7ecaef 100644 --- a/htdocs/compta/payment_vat/card.php +++ b/htdocs/compta/payment_vat/card.php @@ -125,7 +125,6 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->tax->char llxHeader(); $tva = new TVA($db); - $form = new Form($db); $h = 0; @@ -173,26 +172,20 @@ print '
'; print '
'.$langs->trans('Ref').''; -print $form->showrefnav($object,'id','',1,'rowid','id'); -print '
'.$langs->trans('Date').''.dol_print_date($object->datep, 'day').'
'.$langs->trans('Date').''.dol_print_date($object->datep, 'day').'
'.$langs->trans('Mode').''.$langs->trans("PaymentType".$object->type_code).'
'.$langs->trans('Mode').''.$langs->trans("PaymentType".$object->type_code).'
'.$langs->trans('Numero').''.$object->num_payment.'
'.$langs->trans('Numero').''.dol_escape_htmltag($object->num_payment).'
'.$langs->trans('Amount').''.price($object->amount, 0, $langs, 1, -1, -1, $conf->currency).'
'.$langs->trans('Amount').''.price($object->amount, 0, $langs, 1, -1, -1, $conf->currency).'
'.$langs->trans('Note').''.nl2br($object->note).'
'.$langs->trans('Note').''.dol_string_onlythesehtmltags(dol_htmlcleanlastbr($object->note_private)).'
'.$langs->trans('BankTransactionLine').''; + print ''; print $bankline->getNomUrl(1, 0, 'showall'); print '
'; -// Ref -/*print ''; -print '';*/ - // Date -print ''; +print ''; // Mode -print ''; +print ''; // Numero -print ''; +print ''; // Montant -print ''; +print ''; // Note -print ''; +print ''; // Bank account if (isModEnabled("banque")) { @@ -202,7 +195,7 @@ if (isModEnabled("banque")) { print ''; print ''; - print ''; print ''; @@ -294,8 +287,7 @@ if (!empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) { if ($user->socid == 0 && $object->statut == 0 && $_GET['action'] == '') { - if ($user->rights->facture->paiement) - { + if ($user->hasRight('facture', 'paiement')) { print ''.$langs->trans('Valid').''; } } diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index a9ab57a7037..2a9a3219ba6 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -79,8 +79,8 @@ if (empty($action) && empty($id) && empty($ref)) { } // Load object -if ($id > 0) { - $object->fetch($id); +if ($id > 0 || $ref) { + $object->fetch($id, $ref); } $permissiontoread = $user->rights->tax->charges->lire; @@ -111,13 +111,11 @@ if ($reshook < 0) { if (empty($reshook)) { // Classify paid - if ($action == 'confirm_paid' && $user->rights->tax->charges->creer && $confirm == 'yes') { - $object->fetch($id); + if ($action == 'confirm_paid' && $permissiontoadd && $confirm == 'yes') { $result = $object->setPaid($user); } if ($action == 'reopen' && $user->rights->tax->charges->creer) { - $result = $object->fetch($id); if ($object->paye) { $result = $object->setUnpaid($user); if ($result > 0) { @@ -130,19 +128,16 @@ if (empty($reshook)) { } // Link to a project - if ($action == 'classin' && $user->rights->tax->charges->creer) { - $object->fetch($id); + if ($action == 'classin' && $permissiontoadd) { $object->setProject(GETPOST('fk_project')); } - if ($action == 'setfk_user' && $user->rights->tax->charges->creer) { - $object->fetch($id); + if ($action == 'setfk_user' && $permissiontoadd) { $object->fk_user = $fk_user; $object->update($user); } - if ($action == 'setlib' && $user->rights->tax->charges->creer) { - $object->fetch($id); + if ($action == 'setlib' && $permissiontoadd) { $result = $object->setValueFrom('libelle', GETPOST('lib'), '', '', 'text', '', $user, 'TAX_MODIFY'); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); @@ -150,8 +145,7 @@ if (empty($reshook)) { } // payment mode - if ($action == 'setmode' && $user->rights->tax->charges->creer) { - $object->fetch($id); + if ($action == 'setmode' && $permissiontoadd) { $result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int')); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); @@ -159,8 +153,7 @@ if (empty($reshook)) { } // Bank account - if ($action == 'setbankaccount' && $user->rights->tax->charges->creer) { - $object->fetch($id); + if ($action == 'setbankaccount' && $permissiontoadd) { $result = $object->setBankAccount(GETPOST('fk_account', 'int')); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); @@ -168,8 +161,7 @@ if (empty($reshook)) { } // Delete social contribution - if ($action == 'confirm_delete' && $confirm == 'yes') { - $object->fetch($id); + if ($action == 'confirm_delete' && $permissiontodelete && $confirm == 'yes') { $totalpaid = $object->getSommePaiement(); if (empty($totalpaid)) { $result = $object->delete($user); @@ -186,7 +178,7 @@ if (empty($reshook)) { // Add social contribution - if ($action == 'add' && $user->rights->tax->charges->creer) { + if ($action == 'add' && $permissiontoadd) { $amount = price2num(GETPOST('amount', 'alpha'), 'MT'); if (!$dateech) { @@ -224,7 +216,7 @@ if (empty($reshook)) { } - if ($action == 'update' && !GETPOST("cancel") && $user->rights->tax->charges->creer) { + if ($action == 'update' && !$cancel && $permissiontoadd) { $amount = price2num(GETPOST('amount', 'alpha'), 'MT'); if (!$dateech) { @@ -245,7 +237,7 @@ if (empty($reshook)) { $object->date_ech = $dateech; $object->periode = $dateperiod; $object->amount = $amount; - $object->fk_user = $fk_user; + $object->fk_user = $fk_user; $result = $object->update($user); if ($result <= 0) { @@ -259,12 +251,10 @@ if (empty($reshook)) { $action = ''; } - if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->rights->tax->charges->creer)) { + if ($action == 'confirm_clone' && $confirm == 'yes' && $permissiontoadd) { $db->begin(); - $originalId = $id; - - $object->fetch($id); + $originalId = $object->id; if ($object->id > 0) { $object->id = $object->ref = null; diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index d74d90c40be..66bd680739d 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -453,8 +453,12 @@ class ChargeSociales extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales SET"; $sql .= " paye = 1"; $sql .= " WHERE rowid = ".((int) $this->id); + $return = $this->db->query($sql); + if ($return) { + $this->paye = 1; + return 1; } else { return -1; @@ -488,8 +492,12 @@ class ChargeSociales extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales SET"; $sql .= " paye = 0"; $sql .= " WHERE rowid = ".((int) $this->id); + $return = $this->db->query($sql); + if ($return) { + $this->paye = 0; + return 1; } else { return -1; diff --git a/htdocs/compta/tva/class/paymentvat.class.php b/htdocs/compta/tva/class/paymentvat.class.php index 3a088ca30b5..db18debb26b 100644 --- a/htdocs/compta/tva/class/paymentvat.class.php +++ b/htdocs/compta/tva/class/paymentvat.class.php @@ -265,7 +265,6 @@ class PaymentVAT extends CommonObject */ public function fetch($id) { - global $langs; $sql = "SELECT"; $sql .= " t.rowid,"; $sql .= " t.fk_tva,"; @@ -275,7 +274,7 @@ class PaymentVAT extends CommonObject $sql .= " t.amount,"; $sql .= " t.fk_typepaiement,"; $sql .= " t.num_paiement as num_payment,"; - $sql .= " t.note,"; + $sql .= " t.note as note_private,"; $sql .= " t.fk_bank,"; $sql .= " t.fk_user_creat,"; $sql .= " t.fk_user_modif,"; @@ -303,7 +302,8 @@ class PaymentVAT extends CommonObject $this->fk_typepaiement = $obj->fk_typepaiement; $this->num_paiement = $obj->num_payment; $this->num_payment = $obj->num_payment; - $this->note = $obj->note; + $this->note = $obj->note_private; + $this->note_private = $obj->note_private; $this->fk_bank = $obj->fk_bank; $this->fk_user_creat = $obj->fk_user_creat; $this->fk_user_modif = $obj->fk_user_modif; diff --git a/htdocs/contact/canvas/actions_contactcard_common.class.php b/htdocs/contact/canvas/actions_contactcard_common.class.php index 4998b111504..306185cbc8a 100644 --- a/htdocs/contact/canvas/actions_contactcard_common.class.php +++ b/htdocs/contact/canvas/actions_contactcard_common.class.php @@ -253,7 +253,7 @@ abstract class ActionsContactCardCommon $this->tpl['visibility'] = $this->object->LibPubPriv($this->object->priv); - $this->tpl['note'] = nl2br($this->object->note); + $this->tpl['note'] = $this->object->note_private; } if ($action == 'create_user') { diff --git a/htdocs/contact/canvas/default/actions_contactcard_default.class.php b/htdocs/contact/canvas/default/actions_contactcard_default.class.php index 20be2b468b4..157e00c5c4a 100644 --- a/htdocs/contact/canvas/default/actions_contactcard_default.class.php +++ b/htdocs/contact/canvas/default/actions_contactcard_default.class.php @@ -110,7 +110,7 @@ class ActionsContactCardDefault extends ActionsContactCardCommon $this->tpl['actionsdone'] = show_actions_done($conf, $langs, $db, $objsoc, $this->object, 1); } else { // Confirm delete contact - if ($action == 'delete' && $user->rights->societe->contact->supprimer) { + if ($action == 'delete' && $user->hasRight('societe', 'contact', 'supprimer')) { $this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$this->object->id, $langs->trans("DeleteContact"), $langs->trans("ConfirmDeleteContact"), "confirm_delete", '', 0, 1); } } diff --git a/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php b/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php index adf5bb722d3..127375b8c92 100644 --- a/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php +++ b/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php @@ -142,7 +142,7 @@ if (empty($user->socid)) { print ''.$langs->trans('Modify').''; } - if (!$this->control->tpl['user_id'] && $user->rights->user->user->creer) { + if (!$this->control->tpl['user_id'] && $user->hasRight('user', 'user', 'creer')) { print ''.$langs->trans("CreateDolibarrLogin").''; } diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 739c4145db8..285201a574d 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -143,7 +143,7 @@ if (empty($reshook)) { } // Creation utilisateur depuis contact - if ($action == 'confirm_create_user' && $confirm == 'yes' && $user->rights->user->user->creer) { + if ($action == 'confirm_create_user' && $confirm == 'yes' && $user->hasRight('user', 'user', 'creer')) { // Recuperation contact actuel $result = $object->fetch($id); @@ -313,7 +313,7 @@ if (empty($reshook)) { } } - if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->societe->contact->supprimer) { + if ($action == 'confirm_delete' && $confirm == 'yes' && $user->hasRight('societe', 'contact', 'supprimer')) { $result = $object->fetch($id); $object->oldcopy = clone $object; @@ -1390,7 +1390,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print '
'.$langs->trans('Ref').''; -print $form->showrefnav($object,'id','',1,'rowid','id'); -print '
'.$langs->trans('Date').''.dol_print_date($object->datep, 'day').'
'.$langs->trans('Date').''.dol_print_date($object->datep, 'day').'
'.$langs->trans('Mode').''.$langs->trans("PaymentType".$object->type_code).'
'.$langs->trans('Mode').''.$langs->trans("PaymentType".$object->type_code).'
'.$langs->trans('Numero').''.$object->num_paiement.'
'.$langs->trans('Numero').''.dol_escape_htmltag($object->num_payment).'
'.$langs->trans('Amount').''.price($object->amount, 0, $outputlangs, 1, -1, -1, $conf->currency).'
'.$langs->trans('Amount').''.price($object->amount, 0, $outputlangs, 1, -1, -1, $conf->currency).'
'.$langs->trans('Note').''.nl2br($object->note).'
'.$langs->trans('Note').''.dol_string_onlythesehtmltags(dol_htmlcleanlastbr($object->note_private)).'
'.$langs->trans('BankTransactionLine').''; + print ''; print $bankline->getNomUrl(1, 0, 'showall'); print '
'; } print '
'; print $langs->trans('ProspectLevel'); print ''; - if ($action != 'editlevel' && $user->rights->societe->contact->creer) { + if ($action != 'editlevel' && $user->hasRight('societe', 'contact', 'creer')) { print 'id.'">'.img_edit($langs->trans('Modify'), 1).'
'; @@ -1491,7 +1491,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print $dolibarr_user->getLoginUrl(-1); } else { //print ''.$langs->trans("NoDolibarrAccess").''; - if (!$object->user_id && $user->rights->user->user->creer) { + if (!$object->user_id && $user->hasRight('user', 'user', 'creer')) { print ''.img_picto($langs->trans("CreateDolibarrLogin"), 'add', 'class="pictofixedwidth"').$langs->trans("CreateDolibarrLogin").''; } } @@ -1527,11 +1527,11 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } // Activer - if ($object->statut == 0 && $user->rights->societe->contact->creer) { + if ($object->statut == 0 && $user->hasRight('societe', 'contact', 'creer')) { print ''.$langs->trans("Reactivate").''; } // Desactiver - if ($object->statut == 1 && $user->rights->societe->contact->creer) { + if ($object->statut == 1 && $user->hasRight('societe', 'contact', 'creer')) { print ''.$langs->trans("DisableUser").''; } diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 2d64c5b8921..a9341cf5d63 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -847,7 +847,7 @@ $arrayofmassactions = array( if (!empty($permissiontodelete)) { $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); } -if (isModEnabled('category') && $user->rights->societe->creer) { +if (isModEnabled('category') && $user->hasRight('societe', 'creer')) { $arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag"); } if (in_array($massaction, array('presend', 'predelete','preaffecttag'))) { diff --git a/htdocs/contact/note.php b/htdocs/contact/note.php index e9e5d64f495..394dfbe7070 100644 --- a/htdocs/contact/note.php +++ b/htdocs/contact/note.php @@ -61,7 +61,9 @@ $hookmanager->initHooks(array('contactnote')); /* * Actions */ -$reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks + +$parameters = array(); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } diff --git a/htdocs/contact/perso.php b/htdocs/contact/perso.php index ba5fde87468..f2a05d0eb10 100644 --- a/htdocs/contact/perso.php +++ b/htdocs/contact/perso.php @@ -50,7 +50,7 @@ $errors = array(); * Action */ -if ($action == 'update' && !GETPOST("cancel") && $user->rights->societe->contact->creer) { +if ($action == 'update' && !GETPOST("cancel") && $user->hasRight('societe', 'contact', 'creer')) { $ret = $object->fetch($id); // Note: Correct date should be completed with location to have exact GM time of birth. diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index d5d0858ab38..46b475fd5e8 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -2150,7 +2150,7 @@ if ($action == 'create') { if (isModEnabled('facture') && $object->statut > 0) { $langs->load("bills"); - if ($user->rights->facture->creer) { + if ($user->hasRight('facture', 'creer')) { print dolGetButtonAction($langs->trans('CreateBill'), '', 'default', DOL_URL_ROOT.'/compta/facture/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->thirdparty->id, '', true, $params); } else { $params['attr']['title'] = $langs->trans("NotEnoughPermissions"); diff --git a/htdocs/contrat/class/api_contracts.class.php b/htdocs/contrat/class/api_contracts.class.php index fbcd3c0804d..329f61b1e76 100644 --- a/htdocs/contrat/class/api_contracts.class.php +++ b/htdocs/contrat/class/api_contracts.class.php @@ -660,11 +660,6 @@ class Contracts extends DolibarrApi $object = parent::_cleanObjectDatas($object); unset($object->address); - - unset($object->date_start); - unset($object->date_start_real); - unset($object->date_end); - unset($object->date_end_real); unset($object->civility_id); return $object; diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index d3ab453b484..8b4600d0e8c 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -692,7 +692,7 @@ if ($user->rights->user->user->lire) { $moreforfilter .= '
'; } // If the user can view categories of products -if (isModEnabled('categorie') && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire)) { +if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire') && ($user->hasRight('produit', 'lire') || $user->hasRight('service', 'lire'))) { include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $moreforfilter .= '
'; $tmptitle = $langs->trans('IncludingProductWithTag'); @@ -701,7 +701,7 @@ if (isModEnabled('categorie') && $user->rights->categorie->lire && ($user->right $moreforfilter .= '
'; } // Filter on customer categories -if (!empty($conf->global->MAIN_SEARCH_CATEGORY_CUSTOMER_ON_CONTRACT_LIST) && isModEnabled("categorie") && $user->rights->categorie->lire) { +if (!empty($conf->global->MAIN_SEARCH_CATEGORY_CUSTOMER_ON_CONTRACT_LIST) && isModEnabled("categorie") && $user->hasRight('categorie', 'lire')) { $moreforfilter .= '
'; $tmptitle = $langs->transnoentities('CustomersProspectsCategoriesShort'); $moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"'); @@ -974,7 +974,7 @@ while ($i < $imaxinloop) { $socstatic->name_alias = $obj->name_alias; $socstatic->email = $obj->email; $socstatic->status = $obj->company_status; - $socstatic->logo = $obj->logo; + $socstatic->logo = $obj->company_logo; $socstatic->country_id = $obj->country_id; $socstatic->country_code = ''; $socstatic->country = ''; diff --git a/htdocs/core/actions_linkedfiles.inc.php b/htdocs/core/actions_linkedfiles.inc.php index 6c5ac91c9bb..b680a81521c 100644 --- a/htdocs/core/actions_linkedfiles.inc.php +++ b/htdocs/core/actions_linkedfiles.inc.php @@ -92,7 +92,27 @@ if (GETPOST('sendit', 'alpha') && !empty($conf->global->MAIN_UPLOAD_DOC) && !emp if (substr($link, 0, 7) != 'http://' && substr($link, 0, 8) != 'https://' && substr($link, 0, 7) != 'file://' && substr($link, 0, 7) != 'davs://') { $link = 'http://'.$link; } - dol_add_file_process($upload_dir, 0, 1, 'userfile', null, $link, '', 0); + + // Parse $newUrl + $newUrlArray = parse_url($link); + + // Check URL is external + if (!getDolGlobalString('MAIN_ALLOW_SVG_FILES_AS_EXTERNAL_LINKS')) { + if (!empty($newUrlArray['path']) && preg_match('/\.svg$/i', $newUrlArray['path'])) { + $error++; + $langs->load("errors"); + setEventMessages($langs->trans('ErrorSVGFilesNotAllowedAsLinksWithout', 'MAIN_ALLOW_SVG_FILES_AS_EXTERNAL_LINKS'), null, 'errors'); + } + } + // Alow external links to svg ? + if (!getDolGlobalString('MAIN_ALLOW_LOCAL_LINKS_AS_EXTERNAL_LINKS')) { + // Test $newUrlAray['host'] to check link is external using isIPAllowed() + // TODO + } + + if (!$error) { + dol_add_file_process($upload_dir, 0, 1, 'userfile', null, $link, '', 0); + } } } diff --git a/htdocs/core/boxes/box_contacts.php b/htdocs/core/boxes/box_contacts.php index f051fe5ade3..47ad55399ad 100644 --- a/htdocs/core/boxes/box_contacts.php +++ b/htdocs/core/boxes/box_contacts.php @@ -85,7 +85,7 @@ class box_contacts extends ModeleBoxes $this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedContacts", $max)); - if ($user->hasRight('societe', 'lire') && $user->rights->societe->contact->lire) { + if ($user->hasRight('societe', 'lire') && $user->hasRight('societe', 'contact', 'lire')) { $sql = "SELECT sp.rowid as id, sp.lastname, sp.firstname, sp.civility as civility_id, sp.datec, sp.tms, sp.fk_soc, sp.statut as status"; $sql .= ", sp.address, sp.zip, sp.town, sp.phone, sp.phone_perso, sp.phone_mobile, sp.email as spemail"; diff --git a/htdocs/core/boxes/box_dolibarr_state_board.php b/htdocs/core/boxes/box_dolibarr_state_board.php index 17544d90299..4587e026968 100644 --- a/htdocs/core/boxes/box_dolibarr_state_board.php +++ b/htdocs/core/boxes/box_dolibarr_state_board.php @@ -78,9 +78,10 @@ class box_dolibarr_state_board extends ModeleBoxes if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS)) { $hookmanager = new HookManager($this->db); $hookmanager->initHooks(array('index')); - $object = new stdClass; + $object = new stdClass(); $action = ''; - $hookmanager->executeHooks('addStatisticLine', array(), $object, $action); + $parameters =array(); + $hookmanager->executeHooks('addStatisticLine', $parameters, $object, $action); $boxstatItems = array(); $boxstatFromHook = ''; $boxstatFromHook = $hookmanager->resPrint; @@ -300,7 +301,7 @@ class box_dolibarr_state_board extends ModeleBoxes $this->info_box_contents[0][0] = array( 'tr' => 'class="nohover"', - 'td' => '', + 'td' => 'class="tdwidgetstate"', 'textnoformat' => $boxstat ); } diff --git a/htdocs/core/boxes/box_factures.php b/htdocs/core/boxes/box_factures.php index 6a59c6f0d56..a724f26c0c3 100644 --- a/htdocs/core/boxes/box_factures.php +++ b/htdocs/core/boxes/box_factures.php @@ -87,7 +87,7 @@ class box_factures extends ModeleBoxes 'limit'=> dol_strlen($text) ); - if ($user->rights->facture->lire) { + if ($user->hasRight('facture', 'lire')) { $sql = "SELECT f.rowid as facid"; $sql .= ", f.ref, f.type, f.total_ht"; $sql .= ", f.total_tva"; diff --git a/htdocs/core/boxes/box_factures_fourn.php b/htdocs/core/boxes/box_factures_fourn.php index 06124d4ab35..ac05d51e607 100644 --- a/htdocs/core/boxes/box_factures_fourn.php +++ b/htdocs/core/boxes/box_factures_fourn.php @@ -84,7 +84,7 @@ class box_factures_fourn extends ModeleBoxes 'text' => $langs->trans("BoxTitleLast".(!empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) ? "" : "Modified")."SupplierBills", $max) ); - if ($user->rights->fournisseur->facture->lire) { + if ($user->hasRight('fournisseur', 'facture', 'lire')) { $langs->load("bills"); $sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias"; diff --git a/htdocs/core/boxes/box_factures_fourn_imp.php b/htdocs/core/boxes/box_factures_fourn_imp.php index ad6c6c97c27..15411e65bc8 100644 --- a/htdocs/core/boxes/box_factures_fourn_imp.php +++ b/htdocs/core/boxes/box_factures_fourn_imp.php @@ -20,7 +20,7 @@ /** * \file htdocs/core/boxes/box_factures_fourn_imp.php * \ingroup fournisseur - * \brief Fichier de gestion d'une box des factures fournisseurs impayees + * \brief Widget to show remain to get on purchase invoices */ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php'; @@ -72,73 +72,83 @@ class box_factures_fourn_imp extends ModeleBoxes global $conf, $user, $langs; $this->max = $max; + //$this->max = 1000; include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; - $facturestatic = new FactureFournisseur($this->db); include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; + + $facturestatic = new FactureFournisseur($this->db); $thirdpartystatic = new Fournisseur($this->db); - $this->info_box_head = array('text' => $langs->trans("BoxTitleOldestUnpaidSupplierBills", $max)); + $langs->load("bills"); - if ($user->rights->fournisseur->facture->lire) { - $langs->load("bills"); + $this->info_box_head = array('text' => $langs->trans("BoxTitleOldestUnpaidSupplierBills", $this->max)); - $sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias"; - $sql .= ", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur"; - $sql .= ", s.logo, s.email, s.entity"; - $sql .= ", f.rowid as facid, f.ref, f.ref_supplier, f.date_lim_reglement as datelimite"; - $sql .= ", f.datef as df"; - $sql .= ", f.total_ht as total_ht"; - $sql .= ", f.tva as total_tva"; - $sql .= ", f.total_ttc"; - $sql .= ", f.paye, f.fk_statut as status, f.type"; - $sql .= ", f.tms"; - $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; - $sql .= ",".MAIN_DB_PREFIX."facture_fourn as f"; + if ($user->hasRight('fournisseur', 'facture', 'lire')) { + $sql1 = "SELECT s.rowid as socid, s.nom as name, s.name_alias"; + $sql1 .= ", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur"; + $sql1 .= ", s.logo, s.email, s.entity, s.tva_intra, s.siren, s.siret, s.ape, s.idprof4, s.idprof5, s.idprof6"; + $sql1 .= ", f.rowid as facid, f.ref, f.ref_supplier, f.date_lim_reglement as datelimite"; + $sql1 .= ", f.datef as df"; + $sql1 .= ", f.total_ht"; + $sql1 .= ", f.total_tva"; + $sql1 .= ", f.total_ttc"; + $sql1 .= ", f.paye, f.fk_statut as status, f.type"; + $sql1 .= ", f.tms"; + $sql1 .= ", SUM(pf.amount) as am"; + $sql2 .= " FROM ".MAIN_DB_PREFIX."societe as s"; + $sql2 .= ",".MAIN_DB_PREFIX."facture_fourn as f"; + $sql2 .= " LEFT JOIN ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf ON f.rowid = pf.fk_facturefourn"; if (empty($user->rights->societe->client->voir) && !$user->socid) { - $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + $sql2 .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } - $sql .= " WHERE f.fk_soc = s.rowid"; - $sql .= " AND f.entity = ".$conf->entity; - $sql .= " AND f.paye = 0"; - $sql .= " AND fk_statut = 1"; + $sql2 .= " WHERE f.fk_soc = s.rowid"; + $sql2 .= " AND f.entity IN (".getEntity('supplier_invoice').")"; + $sql2 .= " AND f.paye = 0"; + $sql2 .= " AND fk_statut = 1"; if (empty($user->rights->societe->client->voir) && !$user->socid) { - $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); + $sql2 .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } if ($user->socid) { - $sql .= " AND s.rowid = ".((int) $user->socid); + $sql2 .= " AND s.rowid = ".((int) $user->socid); } - $sql .= " ORDER BY datelimite DESC, f.ref_supplier DESC "; - $sql .= $this->db->plimit($max, 0); + $sql3 .= " GROUP BY s.rowid, s.nom, s.name_alias, s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur, s.logo, s.email, s.entity, s.tva_intra, s.siren, s.siret, s.ape, s.idprof4, s.idprof5, s.idprof6,"; + $sql3 .= " f.rowid, f.ref, f.ref_supplier, f.date_lim_reglement,"; + $sql3 .= " f.type, f.datef, f.total_ht, f.total_tva, f.total_ttc, f.paye, f.fk_statut, f.tms"; + $sql3 .= " ORDER BY datelimite DESC, f.ref_supplier DESC "; + $sql3 .= $this->db->plimit($this->max + 1, 0); + + $sql = $sql1.$sql2.$sql3; $result = $this->db->query($sql); if ($result) { $num = $this->db->num_rows($result); $line = 0; - $l_due_date = $langs->trans('Late').' ('.$langs->trans('DateDue').': %s)'; + $l_due_date = $langs->trans('Late').' ('.strtolower($langs->trans('DateDue')).': %s)'; - $facturestatic = new FactureFournisseur($this->db); - - while ($line < $num) { + while ($line < min($num, $this->max)) { $objp = $this->db->fetch_object($result); + $datelimite = $this->db->jdate($objp->datelimite); $date = $this->db->jdate($objp->df); $datem = $this->db->jdate($objp->tms); $facturestatic->id = $objp->facid; $facturestatic->ref = $objp->ref; + $facturestatic->type = $objp->type; $facturestatic->total_ht = $objp->total_ht; $facturestatic->total_tva = $objp->total_tva; $facturestatic->total_ttc = $objp->total_ttc; - $facturestatic->date_echeance = $datelimite; $facturestatic->date = $date; + $facturestatic->date_echeance = $datelimite; $facturestatic->statut = $objp->status; $facturestatic->status = $objp->status; - $alreadypaid = $facturestatic->getSommePaiement(); + //$alreadypaid = $facturestatic->getSommePaiement(); - $facturestatic->alreadypaid = $alreadypaid ? $alreadypaid : 0; + $facturestatic->paye = $objp->paye; + $facturestatic->alreadypaid = $objp->am; $thirdpartystatic->id = $objp->socid; $thirdpartystatic->name = $objp->name; @@ -149,6 +159,13 @@ class box_factures_fourn_imp extends ModeleBoxes $thirdpartystatic->logo = $objp->logo; $thirdpartystatic->email = $objp->email; $thirdpartystatic->entity = $objp->entity; + $thirdpartystatic->tva_intra = $objp->tva_intra; + $thirdpartystatic->idprof1 = $objp->idprof1; + $thirdpartystatic->idprof2 = $objp->idprof2; + $thirdpartystatic->idprof3 = $objp->idprof3; + $thirdpartystatic->idprof4 = $objp->idprof4; + $thirdpartystatic->idprof5 = $objp->idprof5; + $thirdpartystatic->idprof6 = $objp->idprof6; $late = ''; if ($facturestatic->hasDelay()) { @@ -161,12 +178,12 @@ class box_factures_fourn_imp extends ModeleBoxes 'td' => 'class="nowraponall"', 'text' => $facturestatic->getNomUrl(1), 'text2'=> $late, - 'asis' => 1 + 'asis' => 1, ); $this->info_box_contents[$line][] = array( 'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"', - 'text' => $thirdpartystatic->getNomUrl(1, '', 40), + 'text' => $thirdpartystatic->getNomUrl(1, '', 44), 'asis' => 1, ); @@ -182,19 +199,52 @@ class box_factures_fourn_imp extends ModeleBoxes $this->info_box_contents[$line][] = array( 'td' => 'class="right" width="18"', - 'text' => $facturestatic->LibStatut($objp->paye, $objp->status, 3, $alreadypaid, $objp->type), + 'text' => $facturestatic->LibStatut($objp->paye, $objp->status, 3, $objp->am, $objp->type), ); $line++; } + if ($this->max < $num) { + $this->info_box_contents[$line][] = array('td' => 'colspan="6"', 'text' => '...'); + $line++; + } if ($num == 0) { $this->info_box_contents[$line][0] = array( - 'td' => 'class="center"', + 'td' => 'class="center opacitymedium"', 'text'=>$langs->trans("NoUnpaidSupplierBills"), ); } + $sql = "SELECT SUM(f.total_ht) as total_ht ".$sql2; + + $result = $this->db->query($sql); + $objp = $this->db->fetch_object($result); + $totalamount = $objp->total_ht; + + // Add the sum à the bottom of the boxes + $this->info_box_contents[$line][] = array( + 'tr' => 'class="liste_total_wrap"', + 'td' => 'class="liste_total"', + 'text' => $langs->trans("Total"), + ); + $this->info_box_contents[$line][] = array( + 'td' => 'class="liste_total"', + 'text' => " ", + ); + $this->info_box_contents[$line][] = array( + 'td' => 'class="right liste_total" ', + 'text' => price($totalamount, 0, $langs, 0, -1, -1, $conf->currency), + ); + $this->info_box_contents[$line][] = array( + 'td' => 'class="liste_total"', + 'text' => " ", + ); + $this->info_box_contents[$line][] = array( + 'td' => 'class="liste_total"', + 'text' => " ", + ); + $this->db->free($result); } else { $this->info_box_contents[0][0] = array( diff --git a/htdocs/core/boxes/box_factures_imp.php b/htdocs/core/boxes/box_factures_imp.php index a6103c26257..29b6b2dc483 100644 --- a/htdocs/core/boxes/box_factures_imp.php +++ b/htdocs/core/boxes/box_factures_imp.php @@ -21,7 +21,7 @@ /** * \file htdocs/core/boxes/box_factures_imp.php * \ingroup factures - * \brief Module de generation de l'affichage de la box factures impayees + * \brief Widget to show remain to get on sale invoices */ require_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php'; @@ -29,7 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; /** - * Class to manage the box to show last invoices + * Class to manage the box to show not paid sales invoices */ class box_factures_imp extends ModeleBoxes { @@ -61,7 +61,7 @@ class box_factures_imp extends ModeleBoxes $this->db = $db; - $this->hidden = empty($user->rights->facture->lire); + $this->hidden = !($user->hasRight('facture', 'lire')); } /** @@ -75,6 +75,7 @@ class box_factures_imp extends ModeleBoxes global $conf, $user, $langs; $this->max = $max; + //$this->max = 1000; include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; @@ -84,66 +85,66 @@ class box_factures_imp extends ModeleBoxes $langs->load("bills"); - $this->info_box_head = array('text' => $langs->trans("BoxTitleOldestUnpaidCustomerBills", $max)); + $textHead = $langs->trans("BoxTitleOldestUnpaidCustomerBills"); + $this->info_box_head = array('text' => $langs->trans("BoxTitleOldestUnpaidCustomerBills", $this->max), 'limit'=> dol_strlen($textHead)); - if ($user->rights->facture->lire) { - $sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias"; - $sql .= ", s.code_client, s.client"; + if ($user->hasRight('facture', 'lire')) { + $sql1 = "SELECT s.rowid as socid, s.nom as name, s.name_alias, s.code_client, s.client"; if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { - $sql .= ", spe.accountancy_code_customer as code_compta"; + $sql1 .= ", spe.accountancy_code_customer as code_compta"; } else { - $sql .= ", s.code_compta"; + $sql1 .= ", s.code_compta"; } - $sql .= ", s.logo, s.email, s.entity"; - $sql .= ", s.tva_intra, s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4, s.idprof5, s.idprof6"; - $sql .= ", f.ref, f.date_lim_reglement as datelimite"; - $sql .= ", f.type"; - $sql .= ", f.datef as date"; - $sql .= ", f.total_ht"; - $sql .= ", f.total_tva"; - $sql .= ", f.total_ttc"; - $sql .= ", f.paye, f.fk_statut as status, f.rowid as facid"; - $sql .= ", sum(pf.amount) as am"; - $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; + $sql1 .= ", s.logo, s.email, s.entity"; + $sql1 .= ", s.tva_intra, s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4, s.idprof5, s.idprof6"; + $sql1 .= ", f.ref, f.date_lim_reglement as datelimite"; + $sql1 .= ", f.type"; + $sql1 .= ", f.datef as date"; + $sql1 .= ", f.total_ht"; + $sql1 .= ", f.total_tva"; + $sql1 .= ", f.total_ttc"; + $sql1 .= ", f.paye, f.fk_statut as status, f.rowid as facid"; + $sql1 .= ", SUM(pf.amount) as am"; + $sql2 .= " FROM ".MAIN_DB_PREFIX."societe as s"; if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity); + $sql2 .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity); } if (empty($user->rights->societe->client->voir) && !$user->socid) { - $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + $sql2 .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } - $sql .= ", ".MAIN_DB_PREFIX."facture as f"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid=pf.fk_facture "; - $sql .= " WHERE f.fk_soc = s.rowid"; - $sql .= " AND f.entity IN (".getEntity('invoice').")"; - $sql .= " AND f.paye = 0"; - $sql .= " AND fk_statut = 1"; + $sql2 .= ", ".MAIN_DB_PREFIX."facture as f"; + $sql2 .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid = pf.fk_facture"; + $sql2 .= " WHERE f.fk_soc = s.rowid"; + $sql2 .= " AND f.entity IN (".getEntity('invoice').")"; + $sql2 .= " AND f.paye = 0"; + $sql2 .= " AND fk_statut = 1"; if (empty($user->rights->societe->client->voir) && !$user->socid) { - $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); + $sql2 .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } if ($user->socid) { - $sql .= " AND s.rowid = ".((int) $user->socid); + $sql2 .= " AND s.rowid = ".((int) $user->socid); } - $sql .= " GROUP BY s.rowid, s.nom, s.name_alias, s.code_client, s.client, s.logo, s.email, s.entity, s.tva_intra, s.siren, s.siret, s.ape, s.idprof4, s.idprof5, s.idprof6,"; + $sql3 .= " GROUP BY s.rowid, s.nom, s.name_alias, s.code_client, s.client, s.logo, s.email, s.entity, s.tva_intra, s.siren, s.siret, s.ape, s.idprof4, s.idprof5, s.idprof6,"; if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { - $sql .= " spe.accountancy_code_customer as code_compta,"; + $sql3 .= " spe.accountancy_code_customer as code_compta,"; } else { - $sql .= " s.code_compta,"; + $sql3 .= " s.code_compta,"; } - $sql .= " f.ref, f.date_lim_reglement,"; - $sql .= " f.type, f.datef, f.total_ht, f.total_tva, f.total_ttc, f.paye, f.fk_statut, f.rowid"; - //$sql.= " ORDER BY f.datef DESC, f.ref DESC "; - $sql .= " ORDER BY datelimite ASC, f.ref ASC "; - $sql .= $this->db->plimit($max, 0); + $sql3 .= " f.rowid, f.ref, f.date_lim_reglement,"; + $sql3 .= " f.type, f.datef, f.total_ht, f.total_tva, f.total_ttc, f.paye, f.fk_statut"; + $sql3 .= " ORDER BY datelimite ASC, f.ref ASC "; + $sql3 .= $this->db->plimit($this->max + 1, 0); + + $sql = $sql1.$sql2.$sql3; $result = $this->db->query($sql); if ($result) { $num = $this->db->num_rows($result); - $now = dol_now(); $line = 0; $l_due_date = $langs->trans('Late').' ('.strtolower($langs->trans('DateDue')).': %s)'; - while ($line < $num) { + while ($line < min($num, $this->max)) { $objp = $this->db->fetch_object($result); $datelimite = $this->db->jdate($objp->datelimite); @@ -158,7 +159,9 @@ class box_factures_imp extends ModeleBoxes $facturestatic->status = $objp->status; $facturestatic->date = $this->db->jdate($objp->date); $facturestatic->date_lim_reglement = $this->db->jdate($objp->datelimite); - $facturestatic->alreadypaid = $objp->paye; + + $facturestatic->paye = $objp->paye; + $facturestatic->alreadypaid = $objp->am; $societestatic->id = $objp->socid; $societestatic->name = $objp->name; @@ -212,14 +215,47 @@ class box_factures_imp extends ModeleBoxes $line++; } + if ($this->max < $num) { + $this->info_box_contents[$line][] = array('td' => 'colspan="6"', 'text' => '...'); + $line++; + } if ($num == 0) { $this->info_box_contents[$line][0] = array( - 'td' => 'class="center opacitymedium"', - 'text'=>$langs->trans("NoUnpaidCustomerBills") + 'td' => 'class="center opacitymedium"', + 'text'=>$langs->trans("NoUnpaidCustomerBills") ); } + $sql = "SELECT SUM(f.total_ht) as total_ht ".$sql2; + + $result = $this->db->query($sql); + $objp = $this->db->fetch_object($result); + $totalamount = $objp->total_ht; + + // Add the sum à the bottom of the boxes + $this->info_box_contents[$line][] = array( + 'tr' => 'class="liste_total_wrap"', + 'td' => 'class="liste_total"', + 'text' => $langs->trans("Total"), + ); + $this->info_box_contents[$line][] = array( + 'td' => 'class="liste_total"', + 'text' => " ", + ); + $this->info_box_contents[$line][] = array( + 'td' => 'class="right liste_total" ', + 'text' => price($totalamount, 0, $langs, 0, -1, -1, $conf->currency), + ); + $this->info_box_contents[$line][] = array( + 'td' => 'class="liste_total"', + 'text' => " ", + ); + $this->info_box_contents[$line][] = array( + 'td' => 'class="liste_total"', + 'text' => " ", + ); + $this->db->free($result); } else { $this->info_box_contents[0][0] = array( diff --git a/htdocs/core/boxes/box_graph_invoices_permonth.php b/htdocs/core/boxes/box_graph_invoices_permonth.php index 34dc015a1db..96b9fc63d84 100644 --- a/htdocs/core/boxes/box_graph_invoices_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_permonth.php @@ -103,7 +103,7 @@ class box_graph_invoices_permonth extends ModeleBoxes $prefix .= 'private-'.$user->id.'-'; // If user has no permission to see all, output dir is specific to user } - if ($user->rights->facture->lire) { + if ($user->hasRight('facture', 'lire')) { $mesg = ''; $param_year = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_year'; diff --git a/htdocs/core/boxes/box_graph_invoices_peryear.php b/htdocs/core/boxes/box_graph_invoices_peryear.php index 0f2c7bdb92f..915fb0336fe 100644 --- a/htdocs/core/boxes/box_graph_invoices_peryear.php +++ b/htdocs/core/boxes/box_graph_invoices_peryear.php @@ -95,7 +95,7 @@ class box_graph_invoices_peryear extends ModeleBoxes if ($user->socid) $socid = $user->socid; if (empty($user->rights->societe->client->voir) || $socid) $prefix .= 'private-'.$user->id.'-'; // If user has no permission to see all, output dir is specific to user - if ($user->rights->facture->lire) { + if ($user->hasRight('facture', 'lire')) { $mesg = ''; $param_year = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_year'; diff --git a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php index 87952f008c8..b92862d5089 100644 --- a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php @@ -102,7 +102,7 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes $prefix .= 'private-'.$user->id.'-'; // If user has no permission to see all, output dir is specific to user } - if ($user->rights->fournisseur->facture->lire) { + if ($user->hasRight('fournisseur', 'facture', 'lire')) { $param_year = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_year'; $param_shownb = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb'; $param_showtot = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot'; diff --git a/htdocs/core/boxes/box_members_by_tags.php b/htdocs/core/boxes/box_members_by_tags.php index e9404254b0a..efee61607ba 100644 --- a/htdocs/core/boxes/box_members_by_tags.php +++ b/htdocs/core/boxes/box_members_by_tags.php @@ -93,7 +93,7 @@ class box_members_by_tags extends ModeleBoxes $this->info_box_head = array('text' => $langs->trans("BoxTitleMembersByTags").($numberyears ? ' ('.($year - $numberyears).' - '.$year.')' : '')); - if ($user->rights->adherent->lire) { + if ($user->hasRight('adherent', 'lire')) { require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherentstats.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $stats = new AdherentStats($this->db, $user->socid, $user->id); diff --git a/htdocs/core/boxes/box_members_by_type.php b/htdocs/core/boxes/box_members_by_type.php index 046c7031ece..72db5ec4f92 100644 --- a/htdocs/core/boxes/box_members_by_type.php +++ b/htdocs/core/boxes/box_members_by_type.php @@ -94,7 +94,7 @@ class box_members_by_type extends ModeleBoxes $this->info_box_head = array('text' => $langs->trans("BoxTitleMembersByType").($numberyears ? ' ('.($year-$numberyears).' - '.$year.')' : '')); - if ($user->rights->adherent->lire) { + if ($user->hasRight('adherent', 'lire')) { require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherentstats.class.php'; $stats = new AdherentStats($this->db, $user->socid, $user->id); // Show array diff --git a/htdocs/core/boxes/box_members_last_modified.php b/htdocs/core/boxes/box_members_last_modified.php index 5c6082f1032..788695a1d36 100644 --- a/htdocs/core/boxes/box_members_last_modified.php +++ b/htdocs/core/boxes/box_members_last_modified.php @@ -90,7 +90,7 @@ class box_members_last_modified extends ModeleBoxes $this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedMembers", $max)); - if ($user->rights->adherent->lire) { + if ($user->hasRight('adherent', 'lire')) { $sql = "SELECT a.rowid, a.ref, a.lastname, a.firstname, a.societe as company, a.fk_soc,"; $sql .= " a.datec, a.tms as datem, a.statut as status, a.datefin as date_end_subscription,"; $sql .= ' a.photo, a.email, a.gender, a.morphy,'; diff --git a/htdocs/core/boxes/box_members_last_subscriptions.php b/htdocs/core/boxes/box_members_last_subscriptions.php index e7f1d99137d..324d0df218d 100644 --- a/htdocs/core/boxes/box_members_last_subscriptions.php +++ b/htdocs/core/boxes/box_members_last_subscriptions.php @@ -92,7 +92,7 @@ class box_members_last_subscriptions extends ModeleBoxes $this->info_box_head = array('text' => $langs->trans("LastSubscriptionsModified", $max)); - if ($user->rights->adherent->lire) { + if ($user->hasRight('adherent', 'lire')) { $sql = "SELECT a.rowid, a.statut as status, a.lastname, a.firstname, a.societe as company, a.fk_soc,"; $sql .= " a.gender, a.email, a.photo, a.morphy,"; $sql .= " a.datefin as date_end_subscription,"; diff --git a/htdocs/core/boxes/box_members_subscriptions_by_year.php b/htdocs/core/boxes/box_members_subscriptions_by_year.php index fe406ad29a3..f42ba94e688 100644 --- a/htdocs/core/boxes/box_members_subscriptions_by_year.php +++ b/htdocs/core/boxes/box_members_subscriptions_by_year.php @@ -90,7 +90,7 @@ class box_members_subscriptions_by_year extends ModeleBoxes $this->info_box_head = array('text' => $langs->trans("BoxTitleMembersSubscriptionsByYear", $max)); - if ($user->rights->adherent->lire) { + if ($user->hasRight('adherent', 'lire')) { $num = 0; $line = 0; // List of subscription by year diff --git a/htdocs/core/boxes/box_project_opportunities.php b/htdocs/core/boxes/box_project_opportunities.php index 733e57db831..1acae79469f 100644 --- a/htdocs/core/boxes/box_project_opportunities.php +++ b/htdocs/core/boxes/box_project_opportunities.php @@ -74,14 +74,10 @@ class box_project_opportunities extends ModeleBoxes */ public function loadBox($max = 5) { - global $conf, $user, $langs; + global $user, $langs; $this->max = $max; - $totalMnt = 0; - $totalnb = 0; - $totalnbTask = 0; - $textHead = $langs->trans("OpenedProjectsOpportunities"); $this->info_box_head = array('text' => $textHead, 'limit'=> dol_strlen($textHead)); @@ -158,9 +154,9 @@ class box_project_opportunities extends ModeleBoxes 'asis' => 1 ); - $this->info_box_contents[$i][] = array('td' => 'class="amount right"', 'text' => ($projectstatic->opp_amount ? price($projectstatic->opp_amount) : '')); + $this->info_box_contents[$i][] = array('td' => 'class="amount right nowraponall"', 'text' => ($projectstatic->opp_amount ? price($projectstatic->opp_amount) : '')); - $this->info_box_contents[$i][] = array('td' => 'class=""', 'asis'=>1, 'text' => ($projectstatic->opp_status_code ? $langs->trans("OppStatus".$projectstatic->opp_status_code).' ' : '').'('.round($projectstatic->opp_percent).'%)'); + $this->info_box_contents[$i][] = array('td' => 'class="nowraponall"', 'asis'=>1, 'text' => ($projectstatic->opp_status_code ? $langs->trans("OppStatus".$projectstatic->opp_status_code).' ' : '').'('.round($projectstatic->opp_percent).'%)'); $this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => $projectstatic->getLibStatut(3)); diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 65494e09e11..92acf87898a 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -1007,6 +1007,7 @@ class CMailFile $this->dump_mail(); } + $smtperrorcode = 0; if (! $result) { $smtperrorcode = $this->smtps->lastretval; // SMTP error code dol_syslog("CMailFile::sendfile: mail SMTP error code ".$smtperrorcode, LOG_WARNING); diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 11f2fca8226..4c0fda9cae0 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -106,6 +106,12 @@ abstract class CommonDocGenerator public $emetteur; + /** + * @var array Minimum version of PHP required by module. + * e.g.: PHP ≥ 7.1 = array(7, 1) + */ + public $phpmin = array(7, 1); + /** * @var array Array of columns */ diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index f7a993fd38f..8561b7e252f 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -793,7 +793,8 @@ abstract class CommonObject $hookmanager->initHooks(array($this->element . 'dao')); $parameters = array( - 'tooltipcontentarray' => &$datas + 'tooltipcontentarray' => &$datas, + 'params' => $params, ); // Note that $action and $object may have been modified by some hooks $hookmanager->executeHooks('getTooltipContent', $parameters, $this, $action); diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php index 9f5ea960c9a..c66bd73b96e 100644 --- a/htdocs/core/class/discount.class.php +++ b/htdocs/core/class/discount.class.php @@ -366,13 +366,14 @@ class DiscountAbsolute $sql .= " AND fk_invoice_supplier IS NULL)"; // Not used as credit note and not used as deposit dol_syslog(get_class($this)."::delete Delete discount", LOG_DEBUG); + require_once DOL_DOCUMENT_ROOT. '/core/class/commoninvoice.class.php'; $result = $this->db->query($sql); if ($result) { // If source of discount was a credit note or deposit, we change source statut. if ($this->fk_facture_source) { $sql = "UPDATE ".$this->db->prefix()."facture"; $sql .= " set paye=0, fk_statut=1"; - $sql .= " WHERE (type = 2 or type = 3) AND rowid = ".((int) $this->fk_facture_source); + $sql .= " WHERE (type IN (".$this->db->sanitize(CommonInvoice::TYPE_CREDIT_NOTE.", ".CommonInvoice::TYPE_DEPOSIT).") AND rowid = ".((int) $this->fk_facture_source); dol_syslog(get_class($this)."::delete Update credit note or deposit invoice statut", LOG_DEBUG); $result = $this->db->query($sql); @@ -387,7 +388,7 @@ class DiscountAbsolute } elseif ($this->fk_invoice_supplier_source) { $sql = "UPDATE ".$this->db->prefix()."facture_fourn"; $sql .= " set paye=0, fk_statut=1"; - $sql .= " WHERE (type = 2 or type = 3) AND rowid = ".((int) $this->fk_invoice_supplier_source); + $sql .= " WHERE (type IN (".$this->db->sanitize(CommonInvoice::TYPE_CREDIT_NOTE.", ".CommonInvoice::TYPE_DEPOSIT).") AND rowid = ".((int) $this->fk_invoice_supplier_source); dol_syslog(get_class($this)."::delete Update credit note or deposit invoice statut", LOG_DEBUG); $result = $this->db->query($sql); @@ -573,12 +574,12 @@ class DiscountAbsolute $sql = "SELECT sum(rc.amount_ttc) as amount, sum(rc.multicurrency_amount_ttc) as multicurrency_amount"; $sql .= " FROM ".$this->db->prefix()."societe_remise_except as rc, ".$this->db->prefix()."facture as f"; $sql .= " WHERE rc.fk_facture_source=f.rowid AND rc.fk_facture = ".((int) $invoice->id); - $sql .= " AND f.type = 3"; + $sql .= " AND f.type = ". (int) $invoice::TYPE_DEPOSIT; } elseif ($invoice->element == 'invoice_supplier') { $sql = "SELECT sum(rc.amount_ttc) as amount, sum(rc.multicurrency_amount_ttc) as multicurrency_amount"; $sql .= " FROM ".$this->db->prefix()."societe_remise_except as rc, ".$this->db->prefix()."facture_fourn as f"; $sql .= " WHERE rc.fk_invoice_supplier_source=f.rowid AND rc.fk_invoice_supplier = ".((int) $invoice->id); - $sql .= " AND f.type = 3"; + $sql .= " AND f.type = ". (int) $invoice::TYPE_DEPOSIT; } else { $this->error = get_class($this)."::getSumDepositsUsed was called with a bad object as a first parameter"; dol_print_error($this->error); diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index e25f970fad2..2c0610084aa 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -158,6 +158,10 @@ class HookManager if (!is_array($this->hooks) || empty($this->hooks)) { return 0; // No hook available, do nothing. } + if (!is_array($parameters)) { + dol_syslog('executeHooks was called with a non array $parameters. Surely a bug.', LOG_WARNING); + $parameters = array(); + } $parameters['context'] = join(':', $this->contextarray); //dol_syslog(get_class($this).'::executeHooks method='.$method." action=".$action." context=".$parameters['context']); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index d18404921a8..09d01924dda 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1336,7 +1336,7 @@ class Form // mode 1 $urloption = 'htmlname=' . urlencode(str_replace('.', '_', $htmlname)) . '&outjson=1&filter=' . urlencode($filter) . (empty($excludeids) ? '' : '&excludeids=' . join(',', $excludeids)) . ($showtype ? '&showtype=' . urlencode($showtype) : '') . ($showcode ? '&showcode=' . urlencode($showcode) : ''); - $out .= ''; + $out .= ''; if (empty($hidelabel)) { print $langs->trans("RefOrLabel") . ' : '; } elseif ($hidelabel > 1) { @@ -1706,22 +1706,22 @@ class Form /** * Return list of all contacts (for a third party or all) * - * @param int $socid Id ot third party or 0 for all - * @param string $selected Id contact pre-selectionne - * @param string $htmlname Name of HTML field ('none' for a not editable field) - * @param int $showempty 0=no empty value, 1=add an empty value, 2=add line 'Internal' (used by user edit), 3=add an empty value only if more than one record into list - * @param string $exclude List of contacts id to exclude - * @param string $limitto Disable answers that are not id in this array list - * @param integer $showfunction Add function into label - * @param string $morecss Add more class to class style - * @param integer $showsoc Add company into label - * @param int $forcecombo Force to use combo box - * @param array $events Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) - * @param bool $options_only Return options only (for ajax treatment) - * @param string $moreparam Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container - * @param string $htmlid Html id to use instead of htmlname - * @return int <0 if KO, Nb of contact in list if OK - * @deprecated You can use selectcontacts directly (warning order of param was changed) + * @param int $socid Id ot third party or 0 for all + * @param string $selected Id contact pre-selectionne + * @param string $htmlname Name of HTML field ('none' for a not editable field) + * @param int $showempty 0=no empty value, 1=add an empty value, 2=add line 'Internal' (used by user edit), 3=add an empty value only if more than one record into list + * @param string $exclude List of contacts id to exclude + * @param string $limitto Disable answers that are not id in this array list + * @param integer $showfunction Add function into label + * @param string $morecss Add more class to class style + * @param integer $showsoc Add company into label + * @param int $forcecombo Force to use combo box + * @param array $events Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) + * @param bool $options_only Return options only (for ajax treatment) + * @param string $moreparam Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container + * @param string $htmlid Html id to use instead of htmlname + * @return int <0 if KO, Nb of contact in list if OK + * @deprecated You can use selectcontacts directly (warning order of param was changed) */ public function select_contacts($socid, $selected = '', $htmlname = 'contactid', $showempty = 0, $exclude = '', $limitto = '', $showfunction = 0, $morecss = '', $showsoc = 0, $forcecombo = 0, $events = array(), $options_only = false, $moreparam = '', $htmlid = '') { @@ -1731,28 +1731,28 @@ class Form } /** - * Return HTML code of the SELECT of list of all contacts (for a third party or all). - * This also set the number of contacts found into $this->num + * Return HTML code of the SELECT of list of all contacts (for a third party or all). + * This also set the number of contacts found into $this->num * * @since 9.0 Add afterSelectContactOptions hook * - * @param int $socid Id ot third party or 0 for all or -1 for empty list - * @param array|int $selected Array of ID of pre-selected contact id - * @param string $htmlname Name of HTML field ('none' for a not editable field) - * @param int|string $showempty 0=no empty value, 1=add an empty value, 2=add line 'Internal' (used by user edit), 3=add an empty value only if more than one record into list - * @param string $exclude List of contacts id to exclude - * @param string $limitto Disable answers that are not id in this array list - * @param integer $showfunction Add function into label - * @param string $morecss Add more class to class style - * @param bool $options_only Return options only (for ajax treatment) - * @param integer $showsoc Add company into label - * @param int $forcecombo Force to use combo box (so no ajax beautify effect) - * @param array $events Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) - * @param string $moreparam Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container - * @param string $htmlid Html id to use instead of htmlname - * @param bool $multiple add [] in the name of element and add 'multiple' attribut - * @param integer $disableifempty Set tag 'disabled' on select if there is no choice - * @return int|string <0 if KO, HTML with select string if OK. + * @param int $socid Id ot third party or 0 for all or -1 for empty list + * @param array|int $selected Array of ID of pre-selected contact id + * @param string $htmlname Name of HTML field ('none' for a not editable field) + * @param int|string $showempty 0=no empty value, 1=add an empty value, 2=add line 'Internal' (used by user edit), 3=add an empty value only if more than one record into list + * @param string $exclude List of contacts id to exclude + * @param string $limitto Disable answers that are not id in this array list + * @param integer $showfunction Add function into label + * @param string $morecss Add more class to class style + * @param bool $options_only Return options only (for ajax treatment) + * @param integer $showsoc Add company into label + * @param int $forcecombo Force to use combo box (so no ajax beautify effect) + * @param array $events Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) + * @param string $moreparam Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container + * @param string $htmlid Html id to use instead of htmlname + * @param bool $multiple add [] in the name of element and add 'multiple' attribut + * @param integer $disableifempty Set tag 'disabled' on select if there is no choice + * @return int|string <0 if KO, HTML with select string if OK. */ public function selectcontacts($socid, $selected = '', $htmlname = 'contactid', $showempty = 0, $exclude = '', $limitto = '', $showfunction = 0, $morecss = '', $options_only = false, $showsoc = 0, $forcecombo = 0, $events = array(), $moreparam = '', $htmlid = '', $multiple = false, $disableifempty = 0) { @@ -2211,7 +2211,9 @@ class Form $outarray2[$userstatic->id] = array( 'id'=>$userstatic->id, 'label'=>$labeltoshow, - 'labelhtml'=>$labeltoshowhtml + 'labelhtml'=>$labeltoshowhtml, + 'color'=>'', + 'picto'=>'' ); $i++; @@ -7944,7 +7946,7 @@ class Form $urloption = 'htmlname=' . urlencode($htmlname) . '&outjson=1&objectdesc=' . urlencode($objectdesc) . '&filter=' . urlencode($filter) . ($sortfield ? '&sortfield=' . urlencode($sortfield) : ''); // Activate the auto complete using ajax call. $out .= ajax_autocompleter($preselectedvalue, $htmlname, $urlforajaxcall, $urloption, $conf->global->$confkeyforautocompletemode, 0, array()); - $out .= ''; + $out .= ''; $out .= ''; } else { // Immediate load of table record. @@ -9350,22 +9352,22 @@ class Form } /** - * Return a HTML area with the reference of object and a navigation bar for a business object - * Note: To complete search with a particular filter on select, you can set $object->next_prev_filter set to define SQL criterias. + * Return a HTML area with the reference of object and a navigation bar for a business object + * Note: To complete search with a particular filter on select, you can set $object->next_prev_filter set to define SQL criterias. * - * @param object $object Object to show. - * @param string $paramid Name of parameter to use to name the id into the URL next/previous link. - * @param string $morehtml More html content to output just before the nav bar. - * @param int $shownav Show Condition (navigation is shown if value is 1). - * @param string $fieldid Name of field id into database to use for select next and previous (we make the select max and min on this field compared to $object->ref). Use 'none' to disable next/prev. - * @param string $fieldref Name of field ref of object (object->ref) to show or 'none' to not show ref. - * @param string $morehtmlref More html to show after ref. - * @param string $moreparam More param to add in nav link url. Must start with '&...'. - * @param int $nodbprefix Do not include DB prefix to forge table name. - * @param string $morehtmlleft More html code to show before ref. - * @param string $morehtmlstatus More html code to show under navigation arrows (status place). - * @param string $morehtmlright More html code to show after ref. - * @return string Portion HTML with ref + navigation buttons + * @param object $object Object to show. + * @param string $paramid Name of parameter to use to name the id into the URL next/previous link. + * @param string $morehtml More html content to output just before the nav bar. + * @param int $shownav Show Condition (navigation is shown if value is 1). + * @param string $fieldid Name of field id into database to use for select next and previous (we make the select max and min on this field compared to $object->ref). Use 'none' to disable next/prev. + * @param string $fieldref Name of field ref of object (object->ref) to show or 'none' to not show ref. + * @param string $morehtmlref More html to show after ref. + * @param string $moreparam More param to add in nav link url. Must start with '&...'. + * @param int $nodbprefix Do not include DB prefix to forge table name. + * @param string $morehtmlleft More html code to show before ref. + * @param string $morehtmlstatus More html code to show under navigation arrows (status place). + * @param string $morehtmlright More html code to show after ref. + * @return string Portion HTML with ref + navigation buttons */ public function showrefnav($object, $paramid, $morehtml = '', $shownav = 1, $fieldid = 'rowid', $fieldref = 'ref', $morehtmlref = '', $moreparam = '', $nodbprefix = 0, $morehtmlleft = '', $morehtmlstatus = '', $morehtmlright = '') { @@ -9536,8 +9538,10 @@ class Form } else { $ret .= dol_htmlentities($fullname) . $addgendertxt . ((!empty($object->societe) && $object->societe != $fullname) ? ' (' . dol_htmlentities($object->societe) . ')' : ''); } - } elseif (in_array($object->element, array('contact', 'user', 'usergroup'))) { + } elseif (in_array($object->element, array('contact', 'user'))) { $ret .= dol_htmlentities($object->getFullName($langs)) . $addgendertxt; + } elseif ($object->element == 'usergroup') { + $ret .= dol_htmlentities($object->name); } elseif (in_array($object->element, array('action', 'agenda'))) { $ret .= $object->ref . '
' . $object->label; } elseif (in_array($object->element, array('adherent_type'))) { @@ -9547,7 +9551,6 @@ class Form } elseif ($fieldref != 'none') { $ret .= dol_htmlentities(!empty($object->$fieldref) ? $object->$fieldref : ""); } - if ($morehtmlref) { // don't add a additional space, when "$morehtmlref" starts with a HTML div tag if (substr($morehtmlref, 0, 4) != ''; diff --git a/htdocs/core/filemanagerdol/connectors/php/config.inc.php b/htdocs/core/filemanagerdol/connectors/php/config.inc.php index 368b82c42e7..7407ab706a7 100644 --- a/htdocs/core/filemanagerdol/connectors/php/config.inc.php +++ b/htdocs/core/filemanagerdol/connectors/php/config.inc.php @@ -160,7 +160,7 @@ $Config['QuickUploadPath']['File'] = $Config['UserFilesPath']; $Config['QuickUploadAbsolutePath']['File'] = $Config['UserFilesAbsolutePath']; $Config['AllowedExtensions']['Image'] = array('bmp', 'gif', 'jpeg', 'jpg', 'png', 'ai'); -if (!empty($conf->global->MAIN_ALLOW_SVG_FILES_AS_IMAGES)) { +if (getDolGlobalString('MAIN_ALLOW_SVG_FILES_AS_IMAGES')) { $Config['AllowedExtensions']['Image'][] = 'svg'; } $Config['DeniedExtensions']['Image'] = array(); diff --git a/htdocs/core/js/lib_foot.js.php b/htdocs/core/js/lib_foot.js.php index ae0de6ad0cb..5ed7dfb2eb1 100644 --- a/htdocs/core/js/lib_foot.js.php +++ b/htdocs/core/js/lib_foot.js.php @@ -128,7 +128,7 @@ if (empty($conf->dol_no_mouse_hover)) { print ' jQuery(".classfortooltiponclicktext").dialog({ closeOnEscape: true, classes: { "ui-dialog": "highlight" }, - maxHeight: window.innerHeight-60, width: '.($conf->browser->layout == 'phone' ? max($_SESSION['dol_screenwidth'] - 20, 320) : 700).', + maxHeight: window.innerHeight-60, width: '.($conf->browser->layout == 'phone' ? max((empty($_SESSION['dol_screenwidth']) ? 0 : $_SESSION['dol_screenwidth']) - 20, 320) : 700).', modal: true, autoOpen: false }).css("z-index: 5000"); diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php index c602d13cbf7..cfe7527cb02 100644 --- a/htdocs/core/js/lib_head.js.php +++ b/htdocs/core/js/lib_head.js.php @@ -1324,7 +1324,8 @@ $(document).on('select2:open', (e) => { console.log("Execute the focus (click on combo or use space when on component"); const target = $(e.target); if (target && target.length) { - const id = target[0].id || target[0].name; + let id = target[0].id || target[0].name; + if (id.substr(-2) == "[]") id = id.substr(0,id.length-2); document.querySelector('input[aria-controls*='+id+']').focus(); } }); diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 83fdc6bc043..46f4bdf4b2f 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1097,9 +1097,12 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl print ''; print ''; + $arrayofmassactions = array(); + $mode = 'view'; + $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; - $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields - //if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1); + $selectedfields = ($mode != 'kanban' ? $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')) : ''); // This also change content of $arrayfields + $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table print "\n".''."\n"; @@ -1199,6 +1202,12 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl // Fields title search // -------------------------------------------------------------------- print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } foreach ($contactstatic->fields as $key => $val) { $align = ''; if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { @@ -1241,15 +1250,21 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $contactstatic); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column - print ''; + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } print ''."\n"; // Fields title label // -------------------------------------------------------------------- print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'maxwidthsearch center ')."\n"; + } foreach ($contactstatic->fields as $key => $val) { $align = ''; if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { @@ -1281,7 +1296,10 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ')."\n"; + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'maxwidthsearch center ')."\n"; + } print ''."\n"; $i = -1; @@ -1331,6 +1349,27 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl print ''; + // Actions + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } + // ID if (!empty($arrayfields['t.rowid']['checked'])) { print ''; } - // Edit - if ($user->hasRight('societe', 'contact', 'creer')) { - print ''; - print img_edit(); - print ''; - } - - print ''; - print "\n"; $i++; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 787b09899a2..2f1082c7ca9 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1582,6 +1582,7 @@ function dol_escape_json($stringtoescape) /** * Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input fields. + * When we output string on pages, we use dol_string_onlythesehtmltags(dol_htmlentitiesbr()) for notes, and use dol_escape_htmltag() for simple labels. * * @param string $stringtoescape String to escape * @param int $keepb 1=Keep b tags, 0=remove them completely @@ -3297,7 +3298,7 @@ function dol_print_socialnetworks($value, $cid, $socid, $type, $dictsocialnetwor $htmllink .= '?chat" alt="'.$langs->trans("Chat").' '.$value.'" title="'.dol_escape_htmltag($langs->trans("Chat").' '.$value).'">'; $htmllink .= ''; $htmllink .= ''; - if (($cid || $socid) && isModEnabled('agenda') && $user->rights->agenda->myactions->create) { + if (($cid || $socid) && isModEnabled('agenda') && $user->hasRight('agenda', 'myactions', 'create')) { $addlink = 'AC_SKYPE'; $link = ''; if (!empty($conf->global->AGENDA_ADDACTIONFORSKYPE)) { @@ -3633,7 +3634,7 @@ function dol_print_phone($phone, $countrycode = '', $cid = 0, $socid = 0, $addli } } - //if (($cid || $socid) && isModEnabled('agenda') && $user->rights->agenda->myactions->create) + //if (($cid || $socid) && isModEnabled('agenda') && $user->hasRight('agenda', 'myactions', 'create')) if (isModEnabled('agenda') && $user->hasRight("agenda", "myactions", "create")) { $type = 'AC_TEL'; $link = ''; @@ -5253,7 +5254,7 @@ function dol_print_error_email($prefixcode, $errormessage = '', $errormessages = $now = dol_now(); print '
'; + } if ($showproject) { // Project ref @@ -936,14 +948,16 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t print ''; // Action column - print ''; + print ''; + } print "\n"; @@ -976,6 +990,11 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t if (($total_projectlinesa_planned > 0 || $total_projectlinesa_spent > 0 || $total_projectlinesa_tobill > 0 || $total_projectlinesa_billed > 0 || $total_budget_amount > 0) && $level <= 0) { print ''; + + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } + print ''; if ($showproject) { print ''; @@ -1092,18 +1111,21 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t print ''; } - //Check if Extrafields is totalizable - foreach ($extrafields->attributes['projet_task']['totalizable'] as $key=>$value) { - if ($arrayfields['ef.'.$key]['checked'] == 1) { - print ''; } } - print ''; + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } + print ''; } diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index b95253bf040..17b6d17114a 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -153,7 +153,7 @@ function dolEncrypt($chain, $key = '', $ciphering = 'AES-256-CTR', $forceseed = if (empty($forceseed)) { $ivseed = dolGetRandomBytes($ivlen); } else { - $ivseed = dol_trunc(md5($forceseed), $ivlen, 'right', 'UTF-8', 1); + $ivseed = dol_substr(md5($forceseed), 0, $ivlen, 'ascii', 1); } $newchain = openssl_encrypt($chain, $ciphering, $key, 0, $ivseed); @@ -608,13 +608,13 @@ function restrictedArea(User $user, $features, $object = 0, $tableandshare = '', } } elseif (!empty($feature2)) { // This is for permissions on 2 levels (module->object->write) foreach ($feature2 as $subfeature) { - if ($subfeature == 'user' && $user->id == $objectid && $user->rights->user->self->creer) { + if ($subfeature == 'user' && $user->id == $objectid && $user->hasRight('user', 'self', 'creer')) { continue; // User can edit its own card } - if ($subfeature == 'user' && $user->id == $objectid && $user->rights->user->self->password) { + if ($subfeature == 'user' && $user->id == $objectid && $user->hasRight('user', 'self', 'password')) { continue; // User can edit its own password } - if ($subfeature == 'user' && $user->id != $objectid && $user->rights->user->user->password) { + if ($subfeature == 'user' && $user->id != $objectid && $user->hasRight('user', 'user', 'password')) { continue; // User can edit another user's password } @@ -847,14 +847,15 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl $feature = 'agenda'; $dbtablename = 'actioncomm'; } - if ($feature == 'payment_sc') { $feature = "chargesociales"; + $objectid = $object->fk_charge; } + $checkonentitydone = 0; // Array to define rules of checks to do - $check = array('adherent', 'banque', 'bom', 'don', 'mrp', 'user', 'usergroup', 'payment', 'payment_supplier', 'product', 'produit', 'service', 'produit|service', 'categorie', 'resource', 'expensereport', 'holiday', 'salaries', 'website', 'recruitment','chargesociales'); // Test on entity only (Objects with no link to company) + $check = array('adherent', 'banque', 'bom', 'don', 'mrp', 'user', 'usergroup', 'payment', 'payment_supplier', 'product', 'produit', 'service', 'produit|service', 'categorie', 'resource', 'expensereport', 'holiday', 'salaries', 'website', 'recruitment', 'chargesociales'); // Test on entity only (Objects with no link to company) $checksoc = array('societe'); // Test for object Societe $checkother = array('agenda', 'contact', 'contrat'); // Test on entity + link to third party on field $dbt_keyfield. Allowed if link is empty (Ex: contacts...). $checkproject = array('projet', 'project'); // Test for project object @@ -1002,7 +1003,7 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl $checkonentitydone = 1; } - //var_dump($checkonentitydone); + //var_dump($sql); if (!$checkonentitydone && !in_array($feature, $nocheck) && $objectid > 0) { // By default (case of $checkdefault), we check on object entity + link to third party on field $dbt_keyfield // If external user: Check permission for external users diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index 8058deb387b..552881fd6cc 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -40,7 +40,7 @@ function user_prepare_head(User $object) $canreadperms = true; if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { - $canreadperms = ($user->admin || ($user->id != $object->id && $user->rights->user->user_advance->readperms) || ($user->id == $object->id && $user->rights->user->self_advance->readperms)); + $canreadperms = ($user->admin || ($user->id != $object->id && $user->hasRight('user', 'user_advance', 'readperms')) || ($user->id == $object->id && $user->hasRight('user', 'self_advance', 'readperms'))); } $h = 0; diff --git a/htdocs/core/login/functions_googleoauth.php b/htdocs/core/login/functions_googleoauth.php index 7130f9c6f2a..dd5c7ac15bb 100644 --- a/htdocs/core/login/functions_googleoauth.php +++ b/htdocs/core/login/functions_googleoauth.php @@ -49,7 +49,7 @@ function check_user_password_googleoauth($usertotest, $passwordtotest, $entityto if (GETPOST('actionlogin') == 'login') { if (GETPOST('beforeoauthloginredirect')) { // We post the form on the login page by clicking on the link to login using Google. - dol_syslog("We post the form on the login page by clicking on the link to login using Google"); + dol_syslog("We post the form on the login page by clicking on the link to login using Google. We save _SESSION['datafromloginform']"); // We save data of form into a variable $_SESSION['datafromloginform'] = array( @@ -114,7 +114,7 @@ function check_user_password_googleoauth($usertotest, $passwordtotest, $entityto } // If googleoauth_login has been set (by google_oauthcallback after a successfull OAUTH2 request on openid scope - if (dol_verifyHash($conf->file->instance_unique_id.$usertotest, $_SESSION['googleoauth_receivedlogin'], '0')) { + if (!empty($_SESSION['googleoauth_receivedlogin']) && dol_verifyHash($conf->file->instance_unique_id.$usertotest, $_SESSION['googleoauth_receivedlogin'], '0')) { unset($_SESSION['googleoauth_receivedlogin']); $login = $usertotest; } diff --git a/htdocs/core/modules/asset/doc/doc_generic_asset_odt.modules.php b/htdocs/core/modules/asset/doc/doc_generic_asset_odt.modules.php index a68b8fd2354..e281be6ff44 100644 --- a/htdocs/core/modules/asset/doc/doc_generic_asset_odt.modules.php +++ b/htdocs/core/modules/asset/doc/doc_generic_asset_odt.modules.php @@ -46,18 +46,11 @@ class doc_generic_asset_odt extends ModelePDFAsset */ public $emetteur; - /** - * @var array Minimum version of PHP required by module. - * e.g.: PHP ≥ 7.0 = array(7, 0) - */ - public $phpmin = array(7, 0); - /** * @var string Dolibarr version of the loaded document */ public $version = 'dolibarr'; - /** * Constructor * diff --git a/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php b/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php index d62a1eb6ada..75fb8025e42 100644 --- a/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php +++ b/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php @@ -68,12 +68,6 @@ class pdf_standard_asset extends ModelePDFAsset */ public $type; - /** - * @var array Minimum version of PHP required by module. - * e.g.: PHP ≥ 7.0 = array(7, 0) - */ - public $phpmin = array(7, 0); - /** * Dolibarr version of the loaded document * @var string diff --git a/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php b/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php index d34844f14f2..ede4554e98a 100644 --- a/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php +++ b/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php @@ -46,12 +46,6 @@ class doc_generic_bom_odt extends ModelePDFBom */ public $emetteur; - /** - * @var array Minimum version of PHP required by module. - * e.g.: PHP ≥ 7.0 = array(7, 0) - */ - public $phpmin = array(7, 0); - /** * @var string Dolibarr version of the loaded document */ diff --git a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php index 9172115903b..c4ecbee453c 100644 --- a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php +++ b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php @@ -46,12 +46,6 @@ class doc_generic_order_odt extends ModelePDFCommandes */ public $emetteur; - /** - * @var array Minimum version of PHP required by module. - * e.g.: PHP ≥ 7.0 = array(7, 0) - */ - public $phpmin = array(7, 0); - /** * Dolibarr version of the loaded document * @var string diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 20e738f14c8..9f8008dda11 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -72,12 +72,6 @@ class pdf_einstein extends ModelePDFCommandes */ public $type; - /** - * @var array Minimum version of PHP required by module. - * e.g.: PHP ≥ 7.0 = array(7, 0) - */ - public $phpmin = array(7, 0); - /** * Dolibarr version of the loaded document * @var string diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index ccb68a003bb..458cc39dd27 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -72,12 +72,6 @@ class pdf_eratosthene extends ModelePDFCommandes */ public $type; - /** - * @var array Minimum version of PHP required by module. - * e.g.: PHP ≥ 7.0 = array(7, 0) - */ - public $phpmin = array(7, 0); - /** * Dolibarr version of the loaded document * @var string diff --git a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php index aec1a96109a..a7cb5ada26c 100644 --- a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php +++ b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php @@ -44,12 +44,6 @@ class doc_generic_contract_odt extends ModelePDFContract */ public $emetteur; - /** - * @var array Minimum version of PHP required by module. - * e.g.: PHP ≥ 7.0 = array(7, 0) - */ - public $phpmin = array(7, 0); - /** * @var string Dolibarr version of the loaded document */ diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index 2f434af93a6..fe6f77b9b9a 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -70,12 +70,6 @@ class pdf_strato extends ModelePDFContract */ public $type; - /** - * @var array Minimum version of PHP required by module. - * e.g.: PHP ≥ 7.0 = array(7, 0) - */ - public $phpmin = array(7, 0); - /** * Dolibarr version of the loaded document * @var string diff --git a/htdocs/core/modules/delivery/doc/pdf_storm.modules.php b/htdocs/core/modules/delivery/doc/pdf_storm.modules.php index c84c9b7e6a0..fc55f6fe0f3 100644 --- a/htdocs/core/modules/delivery/doc/pdf_storm.modules.php +++ b/htdocs/core/modules/delivery/doc/pdf_storm.modules.php @@ -64,12 +64,6 @@ class pdf_storm extends ModelePDFDeliveryOrder */ public $type; - /** - * @var array Minimum version of PHP required by module. - * e.g.: PHP ≥ 7.0 = array(7, 0) - */ - public $phpmin = array(7, 0); - /** * Dolibarr version of the loaded document * @var string diff --git a/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php b/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php index af2fda0f7a8..31c46438992 100644 --- a/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php +++ b/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php @@ -63,12 +63,6 @@ class pdf_typhon extends ModelePDFDeliveryOrder */ public $type; - /** - * @var array Minimum version of PHP required by module. - * e.g.: PHP ≥ 7.0 = array(7, 0) - */ - public $phpmin = array(7, 0); - /** * Dolibarr version of the loaded document * @var string diff --git a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php index bf264b45c94..6b7998a121c 100644 --- a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php +++ b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php @@ -46,12 +46,6 @@ class doc_generic_shipment_odt extends ModelePdfExpedition */ public $emetteur; - /** - * @var array Minimum version of PHP required by module. - * e.g.: PHP ≥ 7.0 = array(7, 0) - */ - public $phpmin = array(7, 0); - /** * Dolibarr version of the loaded document * @var string diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index 9592330da2e..297013ed8ac 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -61,12 +61,6 @@ class pdf_espadon extends ModelePdfExpedition */ public $type; - /** - * @var array Minimum version of PHP required by module. - * e.g.: PHP ≥ 7.0 = array(7, 0) - */ - public $phpmin = array(7, 0); - /** * Dolibarr version of the loaded document * @var string diff --git a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php index 130608be433..1d8e0c3f19e 100644 --- a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php @@ -62,12 +62,6 @@ class pdf_merou extends ModelePdfExpedition */ public $type; - /** - * @var array Minimum version of PHP required by module. - * e.g.: PHP ≥ 7.0 = array(7, 0) - */ - public $phpmin = array(7, 0); - /** * Dolibarr version of the loaded document * @var string diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index f7c6599647b..11635c6511b 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -62,12 +62,6 @@ class pdf_rouget extends ModelePdfExpedition */ public $type; - /** - * @var array Minimum version of PHP required by module. - * e.g.: PHP ≥ 7.0 = array(7, 0) - */ - public $phpmin = array(7, 0); - /** * Dolibarr version of the loaded document * @var string diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index 5568cd28840..b8a58d3b517 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -69,12 +69,6 @@ class pdf_standard extends ModeleExpenseReport */ public $type; - /** - * @var array Minimum version of PHP required by module. - * e.g.: PHP ≥ 7.0 = array(7, 0) - */ - public $phpmin = array(7, 0); - /** * Dolibarr version of the loaded document * @var string diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index cc9bc723635..f1e30925d3f 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -45,12 +45,6 @@ class doc_generic_invoice_odt extends ModelePDFFactures */ public $emetteur; - /** - * @var array Minimum version of PHP required by module. - * e.g.: PHP ≥ 7.0 = array(7, 0) - */ - public $phpmin = array(7, 0); - /** * Dolibarr version of the loaded document * @var string diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index c55b6ce36bc..7941815ee24 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -69,12 +69,6 @@ class pdf_crabe extends ModelePDFFactures */ public $type; - /** - * @var array Minimum version of PHP required by module. - * e.g.: PHP ≥ 7.0 = array(7, 0) - */ - public $phpmin = array(7, 0); - /** * Dolibarr version of the loaded document * @var string diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 6a9877fbe3d..fbf1907ec7d 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -70,12 +70,6 @@ class pdf_sponge extends ModelePDFFactures */ public $type; - /** - * @var array Minimum version of PHP required by module. - * e.g.: PHP ≥ 7.0 = array(7, 0) - */ - public $phpmin = array(7, 0); - /** * Dolibarr version of the loaded document * @var string diff --git a/htdocs/core/modules/facture/modules_facture.php b/htdocs/core/modules/facture/modules_facture.php index 64545c8c2de..9524e0d9be3 100644 --- a/htdocs/core/modules/facture/modules_facture.php +++ b/htdocs/core/modules/facture/modules_facture.php @@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Required because used in classes that inherit -use \Sprain\SwissQrBill; +use Sprain\SwissQrBill; /** * Parent class of invoice document generators @@ -108,7 +108,7 @@ abstract class ModelePDFFactures extends CommonDocGenerator // Create a new instance of SwissQrBill, containing default headers with fixed values $qrBill = SwissQrBill\QrBill::create(); - // First, check creditor address + // First, set creditor address $address = SwissQrBill\DataGroup\Element\CombinedAddress::create( $this->emetteur->name, $this->emetteur->address, @@ -160,7 +160,7 @@ abstract class ModelePDFFactures extends CommonDocGenerator ) ); - // Check debtor address; We _know_ zip&town have to be filled, so skip that if unfilled. + // Set debtor address; We _know_ zip&town have to be filled, so skip that if unfilled. if (!empty($object->thirdparty->zip) && !empty($object->thirdparty->town)) { $address = SwissQrBill\DataGroup\Element\CombinedAddress::create( $object->thirdparty->name, @@ -181,12 +181,12 @@ abstract class ModelePDFFactures extends CommonDocGenerator /** * Get the height for bottom-page QR invoice in mm, depending on the page number. * - * @param int $pagenbr Page number - * @param Facture $object Invoice object - * @param Translate $langs Translation object - * @return int Height in mm of the bottom-page QR invoice. Can be zero if not on right page; not enabled + * @param int $pagenbr Page number + * @param Facture $object Invoice object + * @param Translate $langs Translation object + * @return int Height in mm of the bottom-page QR invoice. Can be zero if not on right page; not enabled */ - protected function getHeightForQRInvoice(int $pagenbr, \Facture $object, \Translate $langs) : int + protected function getHeightForQRInvoice(int $pagenbr, Facture $object, Translate $langs) : int { if (getDolGlobalString('INVOICE_ADD_SWISS_QR_CODE') == 'bottom') { // Keep it, to reset it after QRinvoice getter @@ -209,12 +209,12 @@ abstract class ModelePDFFactures extends CommonDocGenerator /** * Add SwissQR invoice at bottom of page 1 * - * @param TCPDF $pdf TCPDF object - * @param Facture $object Invoice object - * @param Translate $langs Translation object - * @return bool for success + * @param TCPDF $pdf TCPDF object + * @param Facture $object Invoice object + * @param Translate $langs Translation object + * @return bool True for for success */ - public function addBottomQRInvoice(\TCPDF $pdf, \Facture $object, \Translate $langs) : bool + public function addBottomQRInvoice(TCPDF $pdf, Facture $object, Translate $langs) : bool { if (!($qrBill = $this->getSwissQrBill($object, $langs))) { return false; diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index cd1cdf48f5e..d42f85cb3cf 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -64,12 +64,6 @@ class pdf_soleil extends ModelePDFFicheinter */ public $type; - /** - * @var array Minimum version of PHP required by module. - * e.g.: PHP ≥ 7.0 = array(7, 0) - */ - public $phpmin = array(7, 0); - /** * Dolibarr version of the loaded document * @var string diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index c742affdf26..29cd8ca5a21 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -782,26 +782,26 @@ class ImportCsv extends ModeleImports // Previously we processed the ->import_fields_array. if (!empty($listfields) && is_array($objimport->array_import_fieldshidden[0])) { // Loop on each hidden fields to add them into listfields/listvalues - foreach ($objimport->array_import_fieldshidden[0] as $key => $val) { - if (!preg_match('/^'.preg_quote($alias, '/').'\./', $key)) { + foreach ($objimport->array_import_fieldshidden[0] as $tmpkey => $tmpval) { + if (!preg_match('/^'.preg_quote($alias, '/').'\./', $tmpkey)) { continue; // Not a field of current table } - if ($val == 'user->id') { - $listfields[] = preg_replace('/^'.preg_quote($alias, '/').'\./', '', $key); + if ($tmpval == 'user->id') { + $listfields[] = preg_replace('/^'.preg_quote($alias, '/').'\./', '', $tmpkey); $listvalues[] = ((int) $user->id); - } elseif (preg_match('/^lastrowid-/', $val)) { - $tmp = explode('-', $val); + } elseif (preg_match('/^lastrowid-/', $tmpval)) { + $tmp = explode('-', $tmpval); $lastinsertid = (isset($last_insert_id_array[$tmp[1]])) ? $last_insert_id_array[$tmp[1]] : 0; - $keyfield = preg_replace('/^'.preg_quote($alias, '/').'\./', '', $key); + $keyfield = preg_replace('/^'.preg_quote($alias, '/').'\./', '', $tmpkey); $listfields[] = $keyfield; $listvalues[] = $lastinsertid; - //print $key."-".$val."-".$listfields."-".$listvalues."
";exit; - } elseif (preg_match('/^const-/', $val)) { - $tmp = explode('-', $val, 2); - $listfields[] = preg_replace('/^'.preg_quote($alias, '/').'\./', '', $key); + //print $tmpkey."-".$tmpval."-".$listfields."-".$listvalues."
";exit; + } elseif (preg_match('/^const-/', $tmpval)) { + $tmp = explode('-', $tmpval, 2); + $listfields[] = preg_replace('/^'.preg_quote($alias, '/').'\./', '', $tmpkey); $listvalues[] = "'".$this->db->escape($tmp[1])."'"; - } elseif (preg_match('/^rule-/', $val)) { - $fieldname = $key; + } elseif (preg_match('/^rule-/', $tmpval)) { + $fieldname = $tmpkey; if (!empty($objimport->array_import_convertvalue[0][$fieldname])) { if ($objimport->array_import_convertvalue[0][$fieldname]['rule'] == 'compute') { $file = (empty($objimport->array_import_convertvalue[0][$fieldname]['classfile']) ? $objimport->array_import_convertvalue[0][$fieldname]['file'] : $objimport->array_import_convertvalue[0][$fieldname]['classfile']); @@ -823,7 +823,7 @@ class ImportCsv extends ModeleImports } } } else { - $this->errors[$error]['lib'] = 'Bad value of profile setup '.$val.' for array_import_fieldshidden'; + $this->errors[$error]['lib'] = 'Bad value of profile setup '.$tmpval.' for array_import_fieldshidden'; $this->errors[$error]['type'] = 'Import profile setup'; $error++; } diff --git a/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php b/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php index f38f61e6d8a..b8cdb48a02f 100644 --- a/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php +++ b/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php @@ -41,12 +41,6 @@ class doc_generic_member_odt extends ModelePDFMember */ public $emetteur; - /** - * @var array Minimum version of PHP required by module. - * e.g.: PHP ≥ 7.0 = array(7, 0) - */ - public $phpmin = array(7, 0); - /** * Dolibarr version of the loaded document * @var string diff --git a/htdocs/core/modules/modFournisseur.class.php b/htdocs/core/modules/modFournisseur.class.php index c1d50648b24..81a8e6224cf 100644 --- a/htdocs/core/modules/modFournisseur.class.php +++ b/htdocs/core/modules/modFournisseur.class.php @@ -466,7 +466,7 @@ class modFournisseur extends DolibarrModules 'f.note_public'=>"NotePublic", 'f.note_private'=>"NotePrivate", 'uv.login'=>'UserValidation', 'ua1.login'=>'ApprovedBy', 'ua2.login'=>'ApprovedBy2', 'fd.rowid'=>'LineId', 'fd.description'=>"LineDescription", 'fd.tva_tx'=>"LineVATRate", 'fd.qty'=>"LineQty", 'fd.remise_percent'=>"Discount", 'fd.total_ht'=>"LineTotalHT", 'fd.total_ttc'=>"LineTotalTTC", 'fd.total_tva'=>"LineTotalVAT", 'fd.date_start'=>"DateStart", 'fd.date_end'=>"DateEnd", 'fd.special_code'=>'SpecialCode', - 'fd.product_type'=>'TypeOfLineServiceOrProduct', 'fd.ref'=>'RefSupplier', 'fd.fk_product'=>'ProductId', + 'fd.product_type'=>'TypeOfLineServiceOrProduct', 'fd.ref'=>'SupplierRef', 'fd.fk_product'=>'ProductId', 'p.ref'=>'ProductRef', 'p.label'=>'ProductLabel', 'project.rowid'=>'ProjectId', 'project.ref'=>'ProjectRef', 'project.title'=>'ProjectLabel' ); if (isModEnabled("multicurrency")) { @@ -814,6 +814,7 @@ class modFournisseur extends DolibarrModules 'cd.fk_commande' => 'PurchaseOrder*', 'cd.fk_parent_line' => 'ParentLine', 'cd.fk_product' => 'IdProduct', + 'cd.ref' => 'SupplierRef', 'cd.description' => 'LineDescription', 'cd.tva_tx' => 'LineVATRate', 'cd.qty' => 'LineQty', diff --git a/htdocs/core/modules/movement/doc/pdf_standard.modules.php b/htdocs/core/modules/movement/doc/pdf_standard.modules.php index 2d7a7e8f9fc..abdb0cc24af 100644 --- a/htdocs/core/modules/movement/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/movement/doc/pdf_standard.modules.php @@ -62,12 +62,6 @@ class pdf_standard extends ModelePDFMovement */ public $type; - /** - * @var array Minimum version of PHP required by module. - * e.g.: PHP ≥ 7.0 = array(7, 0) - */ - public $phpmin = array(7, 0); - /** * Dolibarr version of the loaded document * @var string diff --git a/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php b/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php index 2f0c11d0649..ee0532fd949 100644 --- a/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php +++ b/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php @@ -46,12 +46,6 @@ class doc_generic_mo_odt extends ModelePDFMo */ public $emetteur; - /** - * @var array Minimum version of PHP required by module. - * e.g.: PHP ≥ 7.0 = array(7, 0) - */ - public $phpmin = array(7, 0); - /** * @var string Dolibarr version of the loaded document */ diff --git a/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php b/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php index a36234b1026..e4d46662197 100644 --- a/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php +++ b/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php @@ -67,12 +67,6 @@ class pdf_vinci extends ModelePDFMo */ public $type; - /** - * @var array Minimum version of PHP required by module. - * e.g.: PHP ≥ 7.0 = array(7, 0) - */ - public $phpmin = array(7, 0); - /** * Dolibarr version of the loaded document * @var string diff --git a/htdocs/core/modules/oauth/generic_oauthcallback.php b/htdocs/core/modules/oauth/generic_oauthcallback.php index a394c7f4986..da8949ecbfb 100644 --- a/htdocs/core/modules/oauth/generic_oauthcallback.php +++ b/htdocs/core/modules/oauth/generic_oauthcallback.php @@ -127,6 +127,10 @@ if ($action == 'delete') { setEventMessages($langs->trans('TokenDeleted'), null, 'mesgs'); + if (empty($backtourl)) { + $backtourl = DOL_URL_ROOT.'/'; + } + header('Location: '.$backtourl); exit(); } diff --git a/htdocs/core/modules/oauth/github_oauthcallback.php b/htdocs/core/modules/oauth/github_oauthcallback.php index 7656a1cda37..d1c057d5c33 100644 --- a/htdocs/core/modules/oauth/github_oauthcallback.php +++ b/htdocs/core/modules/oauth/github_oauthcallback.php @@ -139,6 +139,10 @@ if (GETPOST('code')) { // We are coming from oauth provider page $backtourl = $_SESSION["backtourlsavedbeforeoauthjump"]; unset($_SESSION["backtourlsavedbeforeoauthjump"]); + if (empty($backtourl)) { + $backtourl = DOL_URL_ROOT.'/'; + } + header('Location: '.$backtourl); exit(); } catch (Exception $e) { diff --git a/htdocs/core/modules/oauth/google_oauthcallback.php b/htdocs/core/modules/oauth/google_oauthcallback.php index 67b027b0f1d..a043cf23e57 100644 --- a/htdocs/core/modules/oauth/google_oauthcallback.php +++ b/htdocs/core/modules/oauth/google_oauthcallback.php @@ -28,7 +28,7 @@ // Force keyforprovider $forlogin = 0; -if (preg_match('/^forlogin-/', $_GET['state'])) { +if (!empty($_GET['state']) && preg_match('/^forlogin-/', $_GET['state'])) { $forlogin = 1; $_GET['keyforprovider'] = 'Login'; } @@ -103,8 +103,14 @@ if ($state) { $statewithanticsrfonly = preg_replace('/^.*\-/', '', $state); } -if ($action != 'delete' && (empty($statewithscopeonly) || empty($requestedpermissionsarray))) { +// Add a test to check that the state parameter is provided into URL when we make the first call to ask the redirect or when we receive the callback +// but not when callback was ok and we recall the page +if ($action != 'delete' && !GETPOST('afteroauthloginreturn', 'int') && (empty($statewithscopeonly) || empty($requestedpermissionsarray))) { + dol_syslog("state or statewithscopeonly and/or requestedpermissionsarray are empty"); setEventMessages($langs->trans('ScopeUndefined'), null, 'errors'); + if (empty($backtourl)) { + $backtourl = DOL_URL_ROOT.'/'; + } header('Location: '.$backtourl); exit(); } @@ -147,12 +153,32 @@ if ($action == 'delete') { } if (!GETPOST('code')) { - // If we enter this page without 'code' parameter, we arrive here. This is the case when we want to get the redirect + dol_syslog("Page is called without code parameter defined"); + + // If we enter this page without 'code' parameter, it means we click on the link from login page and we want to get the redirect // to the OAuth provider login page. $_SESSION["backtourlsavedbeforeoauthjump"] = $backtourl; $_SESSION["oauthkeyforproviderbeforeoauthjump"] = $keyforprovider; $_SESSION['oauthstateanticsrf'] = $state; + // Save more data into session + // Not required. All data are savec into $_SESSION['datafromloginform'] when form is posted with a click on Login with + // Google with param actionlogin=login and beforeoauthloginredirect=1, by the functions_googleoauth.php. + /* + if (!empty($_POST["tz"])) { + $_SESSION["tz"] = $_POST["tz"]; + } + if (!empty($_POST["tz_string"])) { + $_SESSION["tz_string"] = $_POST["tz_string"]; + } + if (!empty($_POST["dst_first"])) { + $_SESSION["dst_first"] = $_POST["dst_first"]; + } + if (!empty($_POST["dst_second"])) { + $_SESSION["dst_second"] = $_POST["dst_second"]; + } + */ + if ($forlogin) { $apiService->setApprouvalPrompt('force'); } @@ -227,6 +253,7 @@ if (!GETPOST('code')) { $extraparams = $token->getExtraParams(); $jwt = explode('.', $extraparams['id_token']); + $username = ''; $useremail = ''; // Extract the middle part, base64 decode, then json_decode it @@ -272,6 +299,7 @@ if (!GETPOST('code')) { } // If you specified a hd parameter value in the request, verify that the ID token has a hd claim that matches an accepted G Suite hosted domain. + // $userinfo['hd'] is the domain name of Gmail account. // TODO } @@ -293,7 +321,7 @@ if (!GETPOST('code')) { $username = $tmpuser->login; $_SESSION['googleoauth_receivedlogin'] = dol_hash($conf->file->instance_unique_id.$username, '0'); - dol_syslog('$_SESSION[\'googleoauth_receivedlogin\']='.$_SESSION['googleoauth_receivedlogin']); + dol_syslog('We set $_SESSION[\'googleoauth_receivedlogin\']='.$_SESSION['googleoauth_receivedlogin']); } else { $errormessage = "Failed to login using Google. User with the Email '".$useremail."' was not found"; if ($entitytosearchuser > 0) { @@ -301,6 +329,8 @@ if (!GETPOST('code')) { } $_SESSION["dol_loginmesg"] = $errormessage; $errorincheck++; + + dol_syslog($errormessage); } } } else { @@ -321,12 +351,13 @@ if (!GETPOST('code')) { unset($_SESSION["backtourlsavedbeforeoauthjump"]); if (empty($backtourl)) { - $backtourl = DOL_URL_ROOT; + $backtourl = DOL_URL_ROOT.'/'; } - // If call back to url for a OAUTH2 login + // If call back to this url was for a OAUTH2 login if ($forlogin) { - $backtourl .= '?actionlogin=login&afteroauthloginreturn=1&username='.urlencode($username).'&token='.newToken(); + // _SESSION['googleoauth_receivedlogin'] has been set to the key to validate the next test by function_googleoauth(), so we can make the redirect + $backtourl .= '?actionlogin=login&afteroauthloginreturn=1'.($username ? '&username='.urlencode($username) : '').'&token='.newToken(); if (!empty($tmparray['entity'])) { $backtourl .= '&entity='.$tmparray['entity']; } diff --git a/htdocs/core/modules/oauth/microsoft_oauthcallback.php b/htdocs/core/modules/oauth/microsoft_oauthcallback.php index bf057676cf3..15ceccea0f3 100644 --- a/htdocs/core/modules/oauth/microsoft_oauthcallback.php +++ b/htdocs/core/modules/oauth/microsoft_oauthcallback.php @@ -134,6 +134,10 @@ if ($action == 'delete') { setEventMessages($langs->trans('TokenDeleted'), null, 'mesgs'); + if (empty($backtourl)) { + $backtourl = DOL_URL_ROOT.'/'; + } + header('Location: '.$backtourl); exit(); } diff --git a/htdocs/core/modules/oauth/stripelive_oauthcallback.php b/htdocs/core/modules/oauth/stripelive_oauthcallback.php index bc16b44461a..784ca628314 100644 --- a/htdocs/core/modules/oauth/stripelive_oauthcallback.php +++ b/htdocs/core/modules/oauth/stripelive_oauthcallback.php @@ -117,6 +117,10 @@ if ($action == 'delete') { setEventMessages($langs->trans('TokenDeleted'), null, 'mesgs'); + if (empty($backtourl)) { + $backtourl = DOL_URL_ROOT.'/'; + } + header('Location: '.$backtourl); exit(); } @@ -162,6 +166,10 @@ if (GETPOST('code')) { // We are coming from oauth provider page $url = 'https://connect.stripe.com/oauth/authorize?response_type=code&client_id='.$conf->global->$keyforparamid.'&scope=read_write'; } + if (empty($url)) { + $url = DOL_URL_ROOT.'/'; + } + // we go on oauth provider authorization page header('Location: '.$url); exit(); diff --git a/htdocs/core/modules/oauth/stripetest_oauthcallback.php b/htdocs/core/modules/oauth/stripetest_oauthcallback.php index 12d133da14c..8f4a15d7e77 100644 --- a/htdocs/core/modules/oauth/stripetest_oauthcallback.php +++ b/htdocs/core/modules/oauth/stripetest_oauthcallback.php @@ -141,6 +141,10 @@ if (GETPOST('code')) { // We are coming from oauth provider page $backtourl = $_SESSION["backtourlsavedbeforeoauthjump"]; unset($_SESSION["backtourlsavedbeforeoauthjump"]); + if (empty($backtourl)) { + $backtourl = DOL_URL_ROOT.'/'; + } + header('Location: '.$backtourl); exit(); } catch (Exception $e) { @@ -162,6 +166,10 @@ if (GETPOST('code')) { // We are coming from oauth provider page $url = 'https://connect.stripe.com/oauth/authorize?response_type=code&client_id='.$conf->global->$keyforparamid.'&scope=read_write'; } + if (empty($url)) { + $url = DOL_URL_ROOT.'/'; + } + // we go on oauth provider authorization page header('Location: '.$url); exit(); diff --git a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php index ba98d74fb3f..1d5116addba 100644 --- a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php +++ b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php @@ -43,12 +43,6 @@ class doc_generic_product_odt extends ModelePDFProduct */ public $emetteur; - /** - * @var array Minimum version of PHP required by module. - * e.g.: PHP ≥ 7.0 = array(7, 0) - */ - public $phpmin = array(7, 0); - /** * Dolibarr version of the loaded document * @var string diff --git a/htdocs/core/modules/product/doc/pdf_standard.modules.php b/htdocs/core/modules/product/doc/pdf_standard.modules.php index b244f01e0fa..afcb9503997 100644 --- a/htdocs/core/modules/product/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/product/doc/pdf_standard.modules.php @@ -57,12 +57,6 @@ class pdf_standard extends ModelePDFProduct */ public $type; - /** - * @var array Minimum version of PHP required by module. - * e.g.: PHP ≥ 7.0 = array(7, 0) - */ - public $phpmin = array(7, 0); - /** * Dolibarr version of the loaded document * @var string diff --git a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php index 853060f3b2c..a0c52ba3b8f 100644 --- a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php +++ b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php @@ -2,7 +2,7 @@ /* Copyright (C) 2010-2012 Laurent Destailleur * Copyright (C) 2012 Juanjo Menent * Copyright (C) 2013 Florian Henry - * Copyright (C) 2016 Charlie Benke + * Copyright (C) 2016-2023 Charlene Benke * Copyright (C) 2018 Frédéric France * Copyright (C) 2023 Gauthier VERDOL * @@ -83,12 +83,6 @@ class doc_generic_project_odt extends ModelePDFProjects */ public $emetteur; - /** - * @var array Minimum version of PHP required by module. - * e.g.: PHP ≥ 7.0 = array(7, 0) - */ - public $phpmin = array(7, 0); - /** * Dolibarr version of the loaded document * @var string @@ -201,6 +195,8 @@ class doc_generic_project_odt extends ModelePDFProjects 'task_fk_parent'=>$task->fk_parent, 'task_duration'=>$task->duration, 'task_duration_hour'=>convertSecondToTime($task->duration, 'all'), + 'task_planned_workload'=>$task->planned_workload, + 'task_planned_workload_hour'=>convertSecondToTime($task->planned_workload, 'all'), 'task_progress'=>$task->progress, 'task_public'=>$task->public, 'task_date_start'=>dol_print_date($task->date_start, 'day'), diff --git a/htdocs/core/modules/project/doc/pdf_baleine.modules.php b/htdocs/core/modules/project/doc/pdf_baleine.modules.php index 06f6e400b75..0a048837d7a 100644 --- a/htdocs/core/modules/project/doc/pdf_baleine.modules.php +++ b/htdocs/core/modules/project/doc/pdf_baleine.modules.php @@ -63,12 +63,6 @@ class pdf_baleine extends ModelePDFProjects */ public $type; - /** - * @var array Minimum version of PHP required by module. - * e.g.: PHP ≥ 7.0 = array(7, 0) - */ - public $phpmin = array(7, 0); - /** * Dolibarr version of the loaded document * @var string diff --git a/htdocs/core/modules/project/doc/pdf_beluga.modules.php b/htdocs/core/modules/project/doc/pdf_beluga.modules.php index 525c3bd2ece..b4ee7ec83b0 100644 --- a/htdocs/core/modules/project/doc/pdf_beluga.modules.php +++ b/htdocs/core/modules/project/doc/pdf_beluga.modules.php @@ -79,12 +79,6 @@ class pdf_beluga extends ModelePDFProjects */ public $type; - /** - * @var array Minimum version of PHP required by module. - * e.g.: PHP ≥ 7.0 = array(7, 0) - */ - public $phpmin = array(7, 0); - /** * Dolibarr version of the loaded document * @var string diff --git a/htdocs/core/modules/project/doc/pdf_timespent.modules.php b/htdocs/core/modules/project/doc/pdf_timespent.modules.php index 31a8127f733..c00ae37ab22 100644 --- a/htdocs/core/modules/project/doc/pdf_timespent.modules.php +++ b/htdocs/core/modules/project/doc/pdf_timespent.modules.php @@ -62,12 +62,6 @@ class pdf_timespent extends ModelePDFProjects */ public $type; - /** - * @var array Minimum version of PHP required by module. - * e.g.: PHP ≥ 7.0 = array(7, 0) - */ - public $phpmin = array(7, 0); - /** * Dolibarr version of the loaded document * @var string diff --git a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php index 96a5b75c626..fe87287cf54 100644 --- a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php +++ b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php @@ -82,12 +82,6 @@ class doc_generic_task_odt extends ModelePDFTask */ public $emetteur; - /** - * @var array Minimum version of PHP required by module. - * e.g.: PHP ≥ 7.0 = array(7, 0) - */ - public $phpmin = array(7, 0); - /** * Dolibarr version of the loaded document * @var string diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index 8a35edc7968..853329481fe 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -44,12 +44,6 @@ class doc_generic_proposal_odt extends ModelePDFPropales */ public $emetteur; - /** - * @var array Minimum version of PHP required by module. - * e.g.: PHP ≥ 7.0 = array(7, 0) - */ - public $phpmin = array(7, 0); - /** * @var string Dolibarr version of the loaded document */ diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 093a8c5b6be..de872e9e43c 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -73,12 +73,6 @@ class pdf_azur extends ModelePDFPropales */ public $type; - /** - * @var array Minimum version of PHP required by module. - * e.g.: PHP ≥ 7.0 = array(7, 0) - */ - public $phpmin = array(7, 0); - /** * Dolibarr version of the loaded document * @var string diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 24ccb210f12..0870e860d16 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -66,12 +66,6 @@ class pdf_cyan extends ModelePDFPropales */ public $type; - /** - * @var array Minimum version of PHP required by module. - * e.g.: PHP ≥ 7.0 = array(7, 0) - */ - public $phpmin = array(7, 0); - /** * Dolibarr version of the loaded document * @var string diff --git a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php index 463a794faee..76335afc7b5 100644 --- a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php +++ b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php @@ -41,12 +41,6 @@ class doc_generic_reception_odt extends ModelePdfReception */ public $emetteur; // Objet societe qui emet - /** - * @var array Minimum version of PHP required by module. - * e.g.: PHP ≥ 7.0 = array(7, 0) - */ - public $phpmin = array(7, 0); - /** * @var string Dolibarr version of the loaded document */ diff --git a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php index e8d6c8317dc..c052401203c 100644 --- a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php +++ b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php @@ -42,13 +42,6 @@ class doc_generic_odt extends ModeleThirdPartyDoc */ public $emetteur; - /** - * @var array Minimum version of PHP required by module. - * e.g.: PHP ≥ 7.0 = array(7, 0) - */ - public $phpmin = array(7, 0); - - /** * Constructor * diff --git a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php index 4ce652dd55b..612aa787dce 100644 --- a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php +++ b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php @@ -43,18 +43,11 @@ class doc_generic_stock_odt extends ModelePDFStock */ public $emetteur; - /** - * @var array Minimum version of PHP required by module. - * e.g.: PHP ≥ 7.0 = array(7, 0) - */ - public $phpmin = array(7, 0); - /** * @var string Dolibarr version of the loaded document */ public $version = 'dolibarr'; - /** * Constructor * diff --git a/htdocs/core/modules/stock/doc/pdf_standard.modules.php b/htdocs/core/modules/stock/doc/pdf_standard.modules.php index a5c1d87691d..338d81edc44 100644 --- a/htdocs/core/modules/stock/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/stock/doc/pdf_standard.modules.php @@ -58,12 +58,6 @@ class pdf_standard extends ModelePDFStock */ public $type; - /** - * @var array Minimum version of PHP required by module. - * e.g.: PHP ≥ 7.0 = array(7, 0) - */ - public $phpmin = array(7, 0); - /** * Dolibarr version of the loaded document * @var string diff --git a/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php b/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php index 449bd69f17d..e9bcdad28b3 100644 --- a/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php +++ b/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php @@ -59,12 +59,6 @@ class pdf_eagle extends ModelePdfStockTransfer */ public $type; - /** - * @var array Minimum version of PHP required by module. - * e.g.: PHP ≥ 5.5 = array(5, 5) - */ - public $phpmin = array(7, 0); - /** * Dolibarr version of the loaded document * @var string diff --git a/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php b/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php index 123048bbb2d..69c1ed27a51 100644 --- a/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php +++ b/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php @@ -68,12 +68,6 @@ class pdf_eagle_proforma extends ModelePDFCommandes */ public $type; - /** - * @var array Minimum version of PHP required by module. - * e.g.: PHP ≥ 5.5 = array(5, 5) - */ - public $phpmin = array(7, 0); - /** * Dolibarr version of the loaded document * @var string diff --git a/htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php b/htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php index 41ce5795ae6..94bb2d9fc0c 100644 --- a/htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php +++ b/htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php @@ -47,12 +47,6 @@ class doc_generic_supplier_invoice_odt extends ModelePDFSuppliersInvoices */ public $issuer; - /** - * @var array Minimum version of PHP required by module. - * e.g.: PHP ≥ 7.0 = array(7, 0) - */ - public $phpmin = array(7, 0); - /** * @var string Dolibarr version of the loaded document */ diff --git a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php index e0a4e0694dd..39d2074d8e6 100644 --- a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php @@ -63,12 +63,6 @@ class pdf_canelle extends ModelePDFSuppliersInvoices */ public $type; - /** - * @var array Minimum version of PHP required by module. - * e.g.: PHP ≥ 7.0 = array(7, 0) - */ - public $phpmin = array(7, 0); - /** * Dolibarr version of the loaded document * @var string diff --git a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php index 837a2faf881..253faa62882 100644 --- a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php +++ b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php @@ -246,7 +246,7 @@ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices return $prefix.$yymm."-".$num; } else { dol_print_error('', 'Bad parameter for getNextValue'); - retun -1; + return -1; } } diff --git a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php index 0aacecc69da..1a86dfbe611 100644 --- a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php +++ b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php @@ -67,7 +67,7 @@ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices */ public function info() { - global $conf, $langs, $db; + global $langs, $db; // Load translation files required by the page $langs->loadLangs(array("bills", "admin")); diff --git a/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php b/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php index 8e40a21a1e4..a305403d6a6 100644 --- a/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php +++ b/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php @@ -47,12 +47,6 @@ class doc_generic_supplier_order_odt extends ModelePDFSuppliersOrders */ public $issuer; - /** - * @var array Minimum version of PHP required by module. - * e.g.: PHP ≥ 7.0 = array(7, 0) - */ - public $phpmin = array(7, 0); - /** * @var string Dolibarr version of the loaded document */ diff --git a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php index c6e8434c955..cf94376b285 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php @@ -66,12 +66,6 @@ class pdf_cornas extends ModelePDFSuppliersOrders */ public $type; - /** - * @var array Minimum version of PHP required by module. - * e.g.: PHP ≥ 7.0 = array(7, 0) - */ - public $phpmin = array(7, 0); - /** * Dolibarr version of the loaded document * @var string diff --git a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php index 31cee8d94ed..1206d91a794 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php @@ -66,12 +66,6 @@ class pdf_muscadet extends ModelePDFSuppliersOrders */ public $type; - /** - * @var array Minimum version of PHP required by module. - * e.g.: PHP ≥ 7.0 = array(7, 0) - */ - public $phpmin = array(7, 0); - /** * Dolibarr version of the loaded document * @var string diff --git a/htdocs/core/modules/supplier_order/modules_commandefournisseur.php b/htdocs/core/modules/supplier_order/modules_commandefournisseur.php index e8b66bb84cf..5f099a33d39 100644 --- a/htdocs/core/modules/supplier_order/modules_commandefournisseur.php +++ b/htdocs/core/modules/supplier_order/modules_commandefournisseur.php @@ -37,6 +37,23 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // requir */ abstract class ModelePDFSuppliersOrders extends CommonDocGenerator { + public $posxpicture; + public $posxtva; + public $posxup; + public $posxqty; + public $posxunit; + public $posxdesc; + public $posxdiscount; + public $postotalht; + + public $tva; + public $tva_array; + public $localtax1; + public $localtax2; + + public $atleastoneratenotnull = 0; + public $atleastonediscount = 0; + /** * @var string Error code (or message) */ diff --git a/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php b/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php index bede0cc948e..ec3ec568a30 100644 --- a/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php @@ -64,12 +64,6 @@ class pdf_standard extends ModelePDFSuppliersPayments */ public $type; - /** - * @var array Minimum version of PHP required by module. - * e.g.: PHP ≥ 7.0 = array(7, 0) - */ - public $phpmin = array(7, 0); - /** * Dolibarr version of the loaded document * @var string diff --git a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php index 6a8ecbc28c6..fd71e68e003 100644 --- a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php @@ -44,12 +44,6 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal */ public $emetteur; - /** - * @var array Minimum version of PHP required by module. - * e.g.: PHP ≥ 7.0 = array(7, 0) - */ - public $phpmin = array(7, 0); - /** * Dolibarr version of the loaded document * @var string diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php index 95b661364ad..046c72cd06b 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -63,12 +63,6 @@ class pdf_aurore extends ModelePDFSupplierProposal */ public $type; - /** - * @var array Minimum version of PHP required by module. - * e.g.: PHP ≥ 7.0 = array(7, 0) - */ - public $phpmin = array(7, 0); - /** * Dolibarr version of the loaded document * @var string diff --git a/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php b/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php index de316dbc4b1..2d9f9a9e9ae 100644 --- a/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php +++ b/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php @@ -41,12 +41,6 @@ class doc_generic_ticket_odt extends ModelePDFTicket */ public $emetteur; - /** - * @var array Minimum version of PHP required by module. - * e.g.: PHP ≥ 7.0 = array(7, 0) - */ - public $phpmin = array(7, 0); - /** * Dolibarr version of the loaded document * @var string diff --git a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php index 81328821261..f1a7ca0f2a3 100644 --- a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php +++ b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php @@ -41,12 +41,6 @@ class doc_generic_user_odt extends ModelePDFUser */ public $emetteur; - /** - * @var array Minimum version of PHP required by module. - * e.g.: PHP ≥ 7.0 = array(7, 0) - */ - public $phpmin = array(7, 0); - /** * Dolibarr version of the loaded document * @var string diff --git a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php index 5ff9d4c8526..7c86061b057 100644 --- a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php +++ b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php @@ -44,12 +44,6 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup */ public $emetteur; - /** - * @var array Minimum version of PHP required by module. - * e.g.: PHP ≥ 7.0 = array(7, 0) - */ - public $phpmin = array(7, 0); - /** * Dolibarr version of the loaded document * @var string diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php index 25e0f914807..e4258d45aba 100644 --- a/htdocs/core/tpl/contacts.tpl.php +++ b/htdocs/core/tpl/contacts.tpl.php @@ -151,7 +151,7 @@ if ($permission) { $nbofcontacts = $form->num; $newcardbutton = ''; - if (!empty($object->socid) && $object->socid > 1 && $user->rights->societe->creer) { + if (!empty($object->socid) && $object->socid > 1 && $user->hasRight('societe', 'creer')) { $newcardbutton .= ''; } print $newcardbutton; diff --git a/htdocs/core/tpl/passwordforgotten.tpl.php b/htdocs/core/tpl/passwordforgotten.tpl.php index 6a54ee53e79..f2e72ef4fd2 100644 --- a/htdocs/core/tpl/passwordforgotten.tpl.php +++ b/htdocs/core/tpl/passwordforgotten.tpl.php @@ -27,7 +27,7 @@ if (empty($conf) || !is_object($conf)) { } // DDOS protection -$size = (int) $_SERVER['CONTENT_LENGTH']; +$size = (int) ($_SERVER['CONTENT_LENGTH'] ?? 0); if ($size > 10000) { $langs->loadLangs(array("errors", "install")); httponly_accessforbidden('
'.$langs->trans("ErrorRequestTooLarge").'
'.$langs->trans("ClickHereToGoToApp").'
', 413, 1); diff --git a/htdocs/datapolicy/class/actions_datapolicy.class.php b/htdocs/datapolicy/class/actions_datapolicy.class.php index 768ddd216d7..126e711f5c5 100644 --- a/htdocs/datapolicy/class/actions_datapolicy.class.php +++ b/htdocs/datapolicy/class/actions_datapolicy.class.php @@ -116,7 +116,7 @@ class ActionsDatapolicy $object->state_id = ''; $object->socialnetworks = ''; $object->country_id = ''; - $object->note_private = $object->note_private.'
'.$langs->trans('ANONYMISER_AT', dol_print_date(time())); + $object->note_private = dol_concatdesc($object->note_private, $langs->trans('ANONYMISER_AT', dol_print_date(dol_now()))); if ($object->update($object->id, $user, 0)) { // On supprime les contacts associé diff --git a/htdocs/delivery/card.php b/htdocs/delivery/card.php index abed76cff93..478b58cd1af 100644 --- a/htdocs/delivery/card.php +++ b/htdocs/delivery/card.php @@ -442,7 +442,7 @@ if ($action == 'create') { // Incoterms if (isModEnabled('incoterm')) { print '
'; + print $form->showFilterButtons(); + print ''; - print $form->showFilterButtons(); - print ''; + print $form->showFilterButtons(); + print '
'; + + // Add to agenda + if (isModEnabled('agenda')&& $user->hasRight('agenda', 'myactions', 'create')) { + print ''; + print img_object($langs->trans("Event"), "action"); + print '   '; + } + + // Edit + if ($user->hasRight('societe', 'contact', 'creer')) { + print ''; + print img_edit(); + print ''; + } + + print ''; @@ -1406,24 +1445,26 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Actions - print ''; + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; - // Add to agenda - if (isModEnabled('agenda')&& $user->hasRight('agenda', 'myactions', 'create')) { - print ''; - print img_object($langs->trans("Event"), "action"); - print '   '; + // Add to agenda + if (isModEnabled('agenda')&& $user->hasRight('agenda', 'myactions', 'create')) { + print ''; + print img_object($langs->trans("Event"), "action"); + print '   '; + } + + // Edit + if ($user->hasRight('societe', 'contact', 'creer')) { + print ''; + print img_edit(); + print ''; + } + + print '
'; + $selected = 0; + if (in_array($lines[$i]->id, $arrayofselected)) { + $selected = 1; + } + print ''; + print ''; - $selected = 0; - if (in_array($lines[$i]->id, $arrayofselected)) { - $selected = 1; - } - print ''; + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + $selected = 0; + if (in_array($lines[$i]->id, $arrayofselected)) { + $selected = 1; + } + print ''; - print '
'.$langs->trans("Total").''; + // Check if Extrafields is totalizable + foreach ($extrafields->attributes['projet_task']['totalizable'] as $key => $value) { + if (!empty($arrayfields['ef.'.$key]['checked']) && $arrayfields['ef.'.$key]['checked'] == 1) { + print ''; if ($value == 1) { - print $totalarray['totalizable'][$key]['total']; + print empty($totalarray['totalizable'][$key]['total']) ? '' : $totalarray['totalizable'][$key]['total']; } print '
'; - print '
'; + print ''; print '"; // Note Private print ''; print '"; */ diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index f2417aa4859..c730c7d0b08 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -478,7 +478,7 @@ class Don extends CommonObject */ public function update($user, $notrigger = 0) { - global $langs, $conf; + global $langs; $error = 0; @@ -566,7 +566,6 @@ class Don extends CommonObject */ public function delete($user, $notrigger = 0) { - global $user, $conf, $langs; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $error = 0; @@ -629,8 +628,6 @@ class Don extends CommonObject */ public function fetch($id, $ref = '') { - global $conf; - $sql = "SELECT d.rowid, d.datec, d.date_valid, d.tms as datem, d.datedon,"; $sql .= " d.fk_soc as socid,d.firstname, d.lastname, d.societe, d.amount, d.fk_statut, d.address, d.zip, d.town, "; $sql .= " d.fk_country, d.country as country_olddata, d.public, d.amount, d.fk_payment, d.paid, d.note_private, d.note_public, d.email, d.phone, "; @@ -728,7 +725,7 @@ class Don extends CommonObject public function valid_promesse($id, $userid, $notrigger = 0) { // phpcs:enable - global $langs, $user; + global $user; $error = 0; @@ -763,23 +760,6 @@ class Don extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Classify the donation as paid, the donation was received - * - * @deprecated - * @see setPaid() - * @param int $id id of donation - * @param int $modepayment mode of payment - * @return int <0 if KO, >0 if OK - */ - public function set_paid($id, $modepayment = 0) - { - // phpcs:enable - dol_syslog(get_class($this)."::set_paid is deprecated, use setPaid instead", LOG_NOTICE); - return $this->setPaid($id, $modepayment); - } - /** * Classify the donation as paid, the donation was received * @@ -897,8 +877,6 @@ class Don extends CommonObject public function load_state_board() { // phpcs:enable - global $conf; - $this->nb = array(); $sql = "SELECT count(d.rowid) as nb"; @@ -1042,7 +1020,7 @@ class Don extends CommonObject } } - $modelpath = "core/modules/dons/"; + //$modelpath = "core/modules/dons/"; // TODO Restore use of commonGenerateDocument instead of dedicated code here //return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); diff --git a/htdocs/don/payment/card.php b/htdocs/don/payment/card.php index 416e848d271..8a63efbc69d 100644 --- a/htdocs/don/payment/card.php +++ b/htdocs/don/payment/card.php @@ -116,13 +116,13 @@ print ''; // Number -print ''; +print ''; // Amount print ''; // Note public -print ''; +print ''; // Bank account if (isModEnabled("banque")) { diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 0a047ccc9db..2073d0bfd40 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -224,7 +224,8 @@ if (empty($reshook)) { $db->begin(); - $object->note = GETPOST('note', 'alpha'); + $object->note = GETPOST('note', 'restricthtml'); + $object->note_private = GETPOST('note', 'restricthtml'); $object->origin = $origin; $object->origin_id = $origin_id; $object->fk_project = GETPOST('projectid', 'int'); @@ -2592,7 +2593,7 @@ if ($action == 'create') { // Create bill if (isModEnabled('facture') && ($object->statut == Expedition::STATUS_VALIDATED || $object->statut == Expedition::STATUS_CLOSED)) { - if ($user->rights->facture->creer) { + if ($user->hasRight('facture', 'creer')) { // TODO show button only if (!empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) // If we do that, we must also make this option official. print dolGetButtonAction('', $langs->trans('CreateBill'), 'default', DOL_URL_ROOT.'/compta/facture/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid, ''); diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 0470da549e5..740cd7c380f 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -378,10 +378,6 @@ if ($id > 0 || !empty($ref)) { } } print ''; - // Note on several rows - //print ''; print ''; // Delivery delay diff --git a/htdocs/expensereport/payment/card.php b/htdocs/expensereport/payment/card.php index bdc7b51312a..8c5f603d03f 100644 --- a/htdocs/expensereport/payment/card.php +++ b/htdocs/expensereport/payment/card.php @@ -105,19 +105,19 @@ print '
'; print '
'; print $langs->trans('IncotermLabel'); print ''; if ($user->rights->expedition->delivery->creer) { @@ -465,13 +465,13 @@ if ($action == 'create') { // Note Public print '
'.$langs->trans("NotePublic").''; - print nl2br($object->note_public); + print dol_string_onlythesehtmltags(dol_htmlcleanlastbr($object->note_public)); print "
'.$langs->trans("NotePrivate").''; - print nl2br($object->note_private); + print dol_string_onlythesehtmltags(dol_htmlcleanlastbr($object->note_private)); print "
'.$langs->trans('Date').''.dol_print_ print '
'.$langs->trans('Mode').''.$langs->trans("PaymentType".$object->type_code).'
'.$langs->trans('Numero').''.$object->num_payment.'
'.$langs->trans('Numero').''.dol_escape_htmltag($object->num_payment).'
'.$langs->trans('Amount').''.price($object->amount, 0, $outputlangs, 1, -1, -1, $conf->currency).'
'.$langs->trans('Note').''.nl2br($object->note_public).'
'.$langs->trans('Note').''.dol_string_onlythesehtmltags(dol_htmlcleanlastbr($object->note_public)).'
'.$langs->trans('NotePublic').' :
'; - //print nl2br($object->note_public); - //print '
'."\n"; // Date payment -print ''; +print ''; // Mode -print ''; +print ''; // Number -print ''; +print ''; // Amount -print ''; +print ''; // Note public -print ''; +print ''; $disable_delete = 0; // Bank account diff --git a/htdocs/externalsite/admin/index.php b/htdocs/externalsite/admin/index.php index deb05ade024..3f90c53721a 100644 --- a/htdocs/externalsite/admin/index.php +++ b/htdocs/externalsite/admin/index.php @@ -59,7 +59,7 @@ if ($action == 'update') { // exturl can be an url or a HTML string $exturl = GETPOST('EXTERNALSITE_URL', 'restricthtml'); - $exturl = dol_string_onlythesehtmltags($exturl, 1, 1, 0, 1); + $exturl = dol_string_onlythesehtmltags($exturl, 1, 1, 0, 1, array(), 1); $exturl = dol_string_onlythesehtmlattributes($exturl); $i += dolibarr_set_const($db, 'EXTERNALSITE_LABEL', trim($label), 'chaine', 0, '', $conf->entity); @@ -112,7 +112,7 @@ print '"; print '
'.$langs->trans('Date').''.dol_print_date($object->datep, 'day').'
'.$langs->trans('Date').''.dol_print_date($object->datep, 'day').'
'.$langs->trans('PaymentMode').''.$langs->trans("PaymentType".$object->type_code).'
'.$langs->trans('PaymentMode').''.$langs->trans("PaymentType".$object->type_code).'
'.$langs->trans('Numero').''.$object->num_payment.'
'.$langs->trans('Numero').''.dol_escape_htmltag($object->num_payment).'
'.$langs->trans('Amount').''.price($object->amount, 0, $outputlangs, 1, -1, -1, $conf->currency).'
'.$langs->trans('Amount').''.price($object->amount, 0, $outputlangs, 1, -1, -1, $conf->currency).'
'.$langs->trans('Note').''.nl2br($object->note_public).'
'.$langs->trans('Note').''.dol_string_onlythesehtmltags(dol_htmlentitiesbr($object->note_public)).'
'.$langs->trans("ExternalSiteURL")."