diff --git a/ChangeLog b/ChangeLog index 1697b668934..3d9b0b04e5a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,16 @@ English Dolibarr ChangeLog -------------------------------------------------------------- +***** ChangeLog for 18.0.0 compared to 17.0.0 ***** + +WARNING: + +Following changes may create regressions for some external modules, but were necessary to make Dolibarr better: +* The deprecated method escapeunderscore() of database handlers has been removed. You must use escapeforlike instead. + + + + ***** ChangeLog for 17.0.0 compared to 16.0.0 ***** For users: diff --git a/dev/setup/fail2ban/filter.d/web-accesslog-limit403.conf b/dev/setup/fail2ban/filter.d/web-accesslog-limit403.conf new file mode 100644 index 00000000000..1356df80115 --- /dev/null +++ b/dev/setup/fail2ban/filter.d/web-accesslog-limit403.conf @@ -0,0 +1,19 @@ +# Fail2Ban configuration file +# +# Regexp to detect forbidden access on pages (public or not) so we can add mitigation on IP making too much +# access to your a Dolibarr instance. + + +[Definition] + +# To test, you can inject this example into log +# echo `myvirtualhost.com:443 1.2.3.4 - - [15/Dec/2022:09:57:47 +0000] "GET /public/abc" 403 123 "-" "Mozilla" >> /var/log/apache2/access.log +# +# then +# fail2ban-client status web-accesslog-limit403 +# +# To test rule file on a existing log file +# fail2ban-regex /var/log/apache2/access.log /etc/fail2ban/filter.d/web-accesslog-limit403.conf + +failregex = - - .*HTTP/[0-9]+(.[0-9]+)?" 403 +ignoreregex = diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index e63101594cb..4aba6bfeda4 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -1227,22 +1227,22 @@ if (empty($action) || $action == 'view') { $account_ledger = $k; // Try to force general ledger account depending on type if ($tabtype[$key] == 'payment') { - $account_ledger = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER; + $account_ledger = getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER'); } if ($tabtype[$key] == 'payment_supplier') { - $account_ledger = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER; + $account_ledger = getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER'); } if ($tabtype[$key] == 'payment_expensereport') { - $account_ledger = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT; + $account_ledger = getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT'); } if ($tabtype[$key] == 'payment_salary') { - $account_ledger = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT; + $account_ledger = getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT'); } if ($tabtype[$key] == 'payment_vat') { - $account_ledger = $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT; + $account_ledger = getDolGlobalString('ACCOUNTING_VAT_PAY_ACCOUNT'); } if ($tabtype[$key] == 'member') { - $account_ledger = $conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT; + $account_ledger = getDolGlobalString('ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT'); } if ($tabtype[$key] == 'payment_various') { $account_ledger = $tabpay[$key]["account_various"]; @@ -1281,7 +1281,7 @@ if (empty($action) || $action == 'view') { } } print ''; - print $accounttoshow; + print $accounttoshow; // This is a HTML string print ""; // Subledger account @@ -1310,7 +1310,7 @@ if (empty($action) || $action == 'view') { } } print ''; - print $accounttoshowsubledger; + print $accounttoshowsubledger; // This is a html string print ""; print "".$reflabel.""; diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php index 428b67cc67e..b3b2a1d36f4 100644 --- a/htdocs/blockedlog/admin/blockedlog_list.php +++ b/htdocs/blockedlog/admin/blockedlog_list.php @@ -451,8 +451,8 @@ print ''; // Status print ''; -$array = array("1"=>$langs->trans("OnlyNonValid")); -print $form->selectarray('search_showonlyerrors', $array, $search_showonlyerrors, 1); +$array = array("1" => "OnlyNonValid"); +print $form->selectarray('search_showonlyerrors', $array, $search_showonlyerrors, 1, 0, 0, '', 1, 0, 0, 'ASC', 'search_status maxwidth200 onrightofpage', 1); print ''; // Status note @@ -533,7 +533,7 @@ if (is_array($blocks)) { print ''.dol_escape_htmltag($block->id).''; // Date - print ''.dol_print_date($block->date_creation, 'dayhour').''; + print ''.dol_print_date($block->date_creation, 'dayhour').''; // User print ''; diff --git a/htdocs/bom/bom_list.php b/htdocs/bom/bom_list.php index 337ff51c3ef..b9b20c64d1f 100644 --- a/htdocs/bom/bom_list.php +++ b/htdocs/bom/bom_list.php @@ -555,7 +555,7 @@ foreach ($object->fields as $key => $val) { if (!empty($arrayfields['t.'.$key]['checked'])) { print ''; if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) { - print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1); + print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100'.($key == 'status' ? ' search_status onrightofpage' : ''), 1); } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) { print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', 'maxwidth125', 1); } elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) { diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 2560e3bef05..67af97cfe12 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -134,7 +134,7 @@ if ($tmp) { * Draft customer proposals */ -if (isModEnabled("propal") && $user->rights->propal->lire) { +if (isModEnabled("propal") && $user->hasRight("propal", "lire")) { $sql = "SELECT p.rowid, p.ref, p.ref_client, p.total_ht, p.total_tva, p.total_ttc, p.fk_statut as status"; $sql .= ", s.rowid as socid, s.nom as name, s.name_alias"; $sql .= ", s.code_client, s.code_compta, s.client"; @@ -232,7 +232,7 @@ if (isModEnabled("propal") && $user->rights->propal->lire) { * Draft supplier proposals */ -if (isModEnabled('supplier_proposal') && $user->rights->supplier_proposal->lire) { +if (isModEnabled('supplier_proposal') && $user->hasRight("supplier_proposal", "lire")) { $sql = "SELECT p.rowid, p.ref, p.total_ht, p.total_tva, p.total_ttc, p.fk_statut as status"; $sql .= ", s.rowid as socid, s.nom as name, s.name_alias"; $sql .= ", s.code_client, s.code_compta, s.client"; @@ -427,7 +427,7 @@ if (isModEnabled('commande') && $user->rights->commande->lire) { * Draft purchase orders */ -if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->commande->lire) || (isModEnabled("supplier_order") && $user->rights->supplier_order->lire)) { +if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "commande", "lire")) || (isModEnabled("supplier_order") && $user->hasRight("supplier_order", "lire"))) { $sql = "SELECT cf.rowid, cf.ref, cf.ref_supplier, cf.total_ht, cf.total_tva, cf.total_ttc, cf.fk_statut as status"; $sql .= ", s.rowid as socid, s.nom as name, s.name_alias"; $sql .= ", s.code_client, s.code_compta, s.client"; @@ -819,7 +819,7 @@ if (((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERM /* * Latest contracts */ -if (isModEnabled('contrat') && $user->rights->contrat->lire && 0) { // TODO A REFAIRE DEPUIS NOUVEAU CONTRAT +if (isModEnabled('contrat') && $user->hasRight("contrat", "lire") && 0) { // TODO A REFAIRE DEPUIS NOUVEAU CONTRAT $staticcontrat = new Contrat($db); $sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias"; @@ -897,7 +897,7 @@ if (isModEnabled('contrat') && $user->rights->contrat->lire && 0) { // TODO A RE /* * Opened (validated) proposals */ -if (isModEnabled("propal") && $user->rights->propal->lire) { +if (isModEnabled("propal") && $user->hasRight("propal", "lire")) { $sql = "SELECT p.rowid as propalid, p.entity, p.total_ttc, p.total_ht, p.total_tva, p.ref, p.ref_client, p.fk_statut, p.datep as dp, p.fin_validite as dfv"; $sql .= ", s.rowid as socid, s.nom as name, s.name_alias"; $sql .= ", s.code_client, s.code_compta, s.client"; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 786fb1a2ad2..383cf7581e9 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1868,7 +1868,7 @@ if ($action == 'create' && $usercancreate) { // Incoterms if (isModEnabled('incoterm')) { print ''; - print ''; + print ''; print ''; $incoterm_id = GETPOST('incoterm_id'); $incoterm_location = GETPOST('location_incoterms'); diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 4257d1414b1..e6338903f43 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -201,10 +201,10 @@ $arrayfields = array( 'c.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(!isModEnabled("multicurrency") ? 0 : 1), 'position'=>110), 'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>115), 'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>0, 'position'=>116), - 'total_pa' => array('label' => (getDolGlobalString('MARGIN_TYPE') == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (!isModEnabled('margin') || !$user->rights->margins->liretous ? 0 : 1)), - 'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (!isModEnabled('margin') || !$user->rights->margins->liretous ? 0 : 1)), - 'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (!isModEnabled('margin') || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)), - 'total_mark_rate' => array('label' => 'MarkRate', 'checked' => 0, 'position' => 303, 'enabled' => (!isModEnabled('margin') || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)), + 'total_pa' => array('label' => (getDolGlobalString('MARGIN_TYPE') == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (!isModEnabled('margin') || !$user->hasRight("margins", "liretous") ? 0 : 1)), + 'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (!isModEnabled('margin') || !$user->hasRight("margins", "liretous") ? 0 : 1)), + 'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (!isModEnabled('margin') || !$user->hasRight("margins", "liretous") || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)), + 'total_mark_rate' => array('label' => 'MarkRate', 'checked' => 0, 'position' => 303, 'enabled' => (!isModEnabled('margin') || !$user->hasRight("margins", "liretous") || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)), 'c.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>120), 'c.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>125), 'c.date_cloture'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>130), @@ -298,19 +298,19 @@ if (empty($reshook)) { // Mass actions $objectclass = 'Commande'; $objectlabel = 'Orders'; - $permissiontoread = $user->rights->commande->lire; - $permissiontoadd = $user->rights->commande->creer; - $permissiontodelete = $user->rights->commande->supprimer; + $permissiontoread = $user->hasRight("commande", "lire"); + $permissiontoadd = $user->hasRight("commande", "creer"); + $permissiontodelete = $user->hasRight("commande", "supprimer"); if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { - $permissiontovalidate = $user->rights->commande->order_advance->validate; - $permissiontoclose = $user->rights->commande->order_advance->close; - $permissiontocancel = $user->rights->commande->order_advance->annuler; - $permissiontosendbymail = $user->rights->commande->order_advance->send; + $permissiontovalidate = $user->hasRight("commande", "order_advance", "validate"); + $permissiontoclose = $user->hasRight("commande", "order_advance", "close"); + $permissiontocancel = $user->hasRight("commande", "order_advance", "annuler"); + $permissiontosendbymail = $user->hasRight("commande", "order_advance", "send"); } else { - $permissiontovalidate = $user->rights->commande->creer; - $permissiontoclose = $user->rights->commande->creer; - $permissiontocancel = $user->rights->commande->creer; - $permissiontosendbymail = $user->rights->commande->creer; + $permissiontovalidate = $user->hasRight("commande", "creer"); + $permissiontoclose = $user->hasRight("commande", "creer"); + $permissiontocancel = $user->hasRight("commande", "creer"); + $permissiontosendbymail = $user->hasRight("commande", "creer"); } $uploaddir = $conf->commande->multidir_output[$conf->entity]; $triggersendname = 'ORDER_SENTBYMAIL'; @@ -1287,7 +1287,7 @@ if ($resql) { if ($permissiontocancel) { $arrayofmassactions['cancelorders'] = img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Cancel"); } - if (isModEnabled('facture') && $user->rights->facture->creer) { + if (isModEnabled('facture') && $user->hasRight("facture", "creer")) { $arrayofmassactions['createbills'] = img_picto('', 'bill', 'class="pictofixedwidth"').$langs->trans("CreateInvoiceForThisCustomer"); } if ($permissiontoclose) { @@ -1394,7 +1394,7 @@ if ($resql) { $moreforfilter = ''; // If the user can view prospects? sales other than his own - if ($user->rights->user->user->lire) { + if ($user->hasRight("user", "user", "lire")) { $langs->load("commercial"); $moreforfilter .= '
'; $tmptitle = $langs->trans('ThirdPartiesOfSaleRepresentative'); @@ -1402,7 +1402,7 @@ if ($resql) { $moreforfilter .= '
'; } // If the user can view other users - if ($user->rights->user->user->lire) { + if ($user->hasRight("user", "user", "lire")) { $moreforfilter .= '
'; $tmptitle = $langs->trans('LinkedToSpecificUsers'); $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_user, 'search_user', $tmptitle, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth250 widthcentpercentminusx'); @@ -1410,7 +1410,7 @@ if ($resql) { } // If the user can view other products/services than his own - 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'); @@ -1419,7 +1419,7 @@ if ($resql) { $moreforfilter .= '
'; } // If Categories are enabled & user has rights to see - if (isModEnabled('categorie') && $user->rights->categorie->lire) { + if (isModEnabled('categorie') && $user->hasRight("categorie", "lire")) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $moreforfilter .= '
'; $tmptitle = $langs->trans('CustomersProspectsCategoriesShort'); diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index 0014245ee48..38b666cc2ef 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -488,7 +488,7 @@ if (!empty($arrayfields['b.clos']['checked'])) { 'opened'=>$langs->trans("Opened"), 'closed'=>$langs->trans("Closed") ); - print $form->selectarray("search_status", $array, $search_status, 1, 0, 0, '', 0, 0, 0, '', '', 1); + print $form->selectarray("search_status", $array, $search_status, 1, 0, 0, '', 0, 0, 0, '', 'search_status maxwidth125 onrightofpage', 1); print ''; } // Balance diff --git a/htdocs/compta/cashcontrol/cashcontrol_list.php b/htdocs/compta/cashcontrol/cashcontrol_list.php index 5b764cfb730..7d433282367 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_list.php +++ b/htdocs/compta/cashcontrol/cashcontrol_list.php @@ -17,7 +17,7 @@ */ /** - * \file cashcontrol_list.php + * \file htdocs/compta/cashcontrol/cashcontrol_list.php * \ingroup cashdesk|takepos * \brief List page for cashcontrol */ @@ -50,8 +50,9 @@ $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { + // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; -} // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action +} $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; @@ -105,11 +106,11 @@ $arrayfields = array(); foreach ($object->fields as $key => $val) { // If $val['visible']==0, then we never show the field if (!empty($val['visible'])) { - $visible = (int) dol_eval($val['visible'], 1, 1, '1'); + $visible = (int) dol_eval($val['visible'], 1); $arrayfields['t.'.$key] = array( 'label'=>$val['label'], 'checked'=>(($visible < 0) ? 0 : 1), - 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1, 1, '1')), + 'enabled'=>(abs($visible) != 3 && dol_eval($val['enabled'], 1)), 'position'=>$val['position'], 'help'=> isset($val['help']) ? $val['help'] : '' ); @@ -194,7 +195,8 @@ $now = dol_now(); //$help_url="EN:Module_pos_cash_fence|FR:Module_pos_cash_fence_FR|ES:Módulo_pos_cash_fence"; $help_url = ''; $title = $langs->trans('CashControl'); - +$morejs = array(); +$morecss = array(); // Build and execute select // -------------------------------------------------------------------- @@ -211,6 +213,9 @@ $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook $sql .= preg_replace('/^,/', '', $hookmanager->resPrint); $sql = preg_replace('/,\s*$/', '', $sql); + +$sqlfields = $sql; // $sql fields to remove for count total + $sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t"; if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)"; @@ -237,17 +242,17 @@ foreach ($search as $key => $val) { $mode_search = 2; } if ($search[$key] != '') { - $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search)); + $sql .= natural_search("t.".$db->escape($key), $search[$key], (($key == 'status') ? 2 : $mode_search)); } } else { if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') { $columnName=preg_replace('/(_dtstart|_dtend)$/', '', $key); if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) { if (preg_match('/_dtstart$/', $key)) { - $sql .= " AND t." . $columnName . " >= '" . $db->idate($search[$key]) . "'"; + $sql .= " AND t.".$db->escape($columnName)." >= '".$db->idate($search[$key])."'"; } if (preg_match('/_dtend$/', $key)) { - $sql .= " AND t." . $columnName . " <= '" . $db->idate($search[$key]) . "'"; + $sql .= " AND t.".$db->escape($columnName)." <= '".$db->idate($search[$key])."'"; } } } @@ -267,11 +272,13 @@ $sql .= $hookmanager->resPrint; /* If a group by is required $sql.= " GROUP BY "; foreach($object->fields as $key => $val) { - $sql .= "t.".$key.", "; + $sql .= "t.".$db->escape($key).", "; } // Add fields from extrafields if (!empty($extrafields->attributes[$object->table_element]['label'])) { - foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : ''); + foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { + $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : ''); + } } // Add where from hooks $parameters=array(); @@ -280,35 +287,43 @@ $sql.=$hookmanager->resPrint; $sql=preg_replace('/,\s*$/','', $sql); */ -$sql .= $db->order($sortfield, $sortorder); // Count total nb of records $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { - $resql = $db->query($sql); - $nbtotalofrecords = $db->num_rows($resql); - if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0 + /* The fast and low memory method to get and count full list converts the sql into a sql count */ + $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql); + $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount); + $resql = $db->query($sqlforcount); + if ($resql) { + $objforcount = $db->fetch_object($resql); + $nbtotalofrecords = $objforcount->nbtotalofrecords; + } else { + dol_print_error($db); + } + + if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0 $page = 0; $offset = 0; } + $db->free($resql); } -// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set. -if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) { - $num = $nbtotalofrecords; -} else { - if ($limit) { - $sql .= $db->plimit($limit + 1, $offset); - } - $resql = $db->query($sql); - if (!$resql) { - dol_print_error($db); - exit; - } - - $num = $db->num_rows($resql); +// Complete request and execute it with limit +$sql .= $db->order($sortfield, $sortorder); +if ($limit) { + $sql .= $db->plimit($limit + 1, $offset); } +$resql = $db->query($sql); +if (!$resql) { + dol_print_error($db); + exit; +} + +$num = $db->num_rows($resql); + + // Direct jump if only one record found if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) { $obj = $db->fetch_object($resql); @@ -326,6 +341,9 @@ llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'classforhorizontalscroll $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; +if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); +} if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -333,11 +351,17 @@ if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.urlencode($limit); } foreach ($search as $key => $val) { - if (is_array($search[$key]) && count($search[$key])) { + if (is_array($search[$key])) { foreach ($search[$key] as $skey) { - $param .= '&search_'.$key.'[]='.urlencode($skey); + if ($skey != '') { + $param .= '&search_'.$key.'[]='.urlencode($skey); + } } - } else { + } elseif (preg_match('/(_dtstart|_dtend)$/', $key) && !empty($val)) { + $param .= '&search_'.$key.'month='.((int) GETPOST('search_'.$key.'month', 'int')); + $param .= '&search_'.$key.'day='.((int) GETPOST('search_'.$key.'day', 'int')); + $param .= '&search_'.$key.'year='.((int) GETPOST('search_'.$key.'year', 'int')); + } elseif ($search[$key] != '') { $param .= '&search_'.$key.'='.urlencode($search[$key]); } } @@ -373,6 +397,7 @@ print ''; print ''; print ''; +print ''; print ''; $permforcashfence = 1; @@ -389,10 +414,13 @@ $trackid = 'cashfence'.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($search_all) { + $setupstring = ''; foreach ($fieldstosearchall as $key => $val) { $fieldstosearchall[$key] = $langs->trans($val); + $setupstring .= $key."=".$val.";"; } - print '
'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'
'; + print ''."\n"; + print '
'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'
'."\n"; } $moreforfilter = ''; @@ -433,13 +461,13 @@ foreach ($object->fields as $key => $val) { $cssforfield .= ($cssforfield ? ' ' : '').'center'; } elseif (in_array($val['type'], array('timestamp'))) { $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { + } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'rowid' && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { $cssforfield .= ($cssforfield ? ' ' : '').'right'; } if (!empty($arrayfields['t.'.$key]['checked'])) { print ''; if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) { - print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1); + print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100'.($key == 'status' ? ' search_status onrightofpage' : ''), 1); } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:')=== 0)) { print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', 'maxwidth125', 1); } elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) { @@ -525,7 +553,8 @@ while ($i < ($limit ? min($num, $limit) : $num)) { $object->setVarsFromFetchObj($obj); // Show here line of result - print ''; + $j = 0; + print ''; foreach ($object->fields as $key => $val) { $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { @@ -546,7 +575,11 @@ while ($i < ($limit ? min($num, $limit) : $num)) { //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; if (!empty($arrayfields['t.'.$key]['checked'])) { - print ''; + print ''; if ($key == 'status') { print $object->getLibStatut(5); } elseif ($key == 'rowid') { @@ -609,13 +642,13 @@ if ($num == 0) { $colspan++; } } - print ''.$langs->trans("NoRecordFound").''; + print ''.$langs->trans("NoRecordFound").''; } $db->free($resql); $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); -$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; print ''."\n"; diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 348897369ee..698f131aa09 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -376,9 +376,9 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', if (empty($reshook)) { $objectclass = 'Facture'; $objectlabel = 'Invoices'; - $permissiontoread = $user->rights->facture->lire; - $permissiontoadd = $user->rights->facture->creer; - $permissiontodelete = $user->rights->facture->supprimer; + $permissiontoread = $user->hasRight("facture", "lire"); + $permissiontoadd = $user->hasRight("facture", "creer"); + $permissiontodelete = $user->hasRight("facture", "supprimer"); $uploaddir = $conf->facture->dir_output; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } @@ -1185,7 +1185,7 @@ if ($resql) { if (!empty($socid)) { $url .= '&socid='.$socid; } - $newcardbutton = dolGetButtonTitle($langs->trans('NewBill'), '', 'fa fa-plus-circle', $url, '', $user->rights->facture->creer); + $newcardbutton = dolGetButtonTitle($langs->trans('NewBill'), '', 'fa fa-plus-circle', $url, '', $user->hasRight("facture", "creer")); } $i = 0; @@ -1237,7 +1237,7 @@ if ($resql) { // If the user can view prospects other than his' $moreforfilter = ''; - if ($user->rights->user->user->lire) { + if ($user->hasRight("user", "user", "lire")) { $langs->load("commercial"); $moreforfilter .= '
'; $tmptitle = $langs->trans('ThirdPartiesOfSaleRepresentative'); @@ -1245,14 +1245,14 @@ if ($resql) { $moreforfilter .= '
'; } // If the user can view prospects other than his' - if ($user->rights->user->user->lire) { + if ($user->hasRight("user", "user", "lire")) { $moreforfilter .= '
'; $tmptitle = $langs->trans('LinkedToSpecificUsers'); $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_user, 'search_user', $tmptitle, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth250'); $moreforfilter .= '
'; } // Filter on product tags - 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'); @@ -1260,7 +1260,7 @@ if ($resql) { $moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$form->selectarray('search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0, '', 0, 0, 0, 0, 'maxwidth250', 1); $moreforfilter .= '
'; } - if (isModEnabled('categorie') && $user->rights->categorie->lire) { + if (isModEnabled('categorie') && $user->hasRight("categorie", "lire")) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $moreforfilter .= '
'; $tmptitle = $langs->trans('CustomersProspectsCategoriesShort'); @@ -2574,8 +2574,8 @@ if ($resql) { $urlsource .= str_replace('&', '&', $param); $filedir = $diroutputmassaction; - $genallowed = $user->rights->facture->lire; - $delallowed = $user->rights->facture->creer; + $genallowed = $user->hasRight("facture", "lire"); + $delallowed = $user->hasRight("facture", "creer"); $title = ''; print $formfile->showdocuments('massfilesarea_invoices', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index c22b1925dbb..f25ae7ca600 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -281,7 +281,7 @@ if (isModEnabled('facture') && !empty($user->rights->facture->lire)) { // Last modified supplier invoices -if ((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire) || (isModEnabled('supplier_invoice') && $user->rights->supplier_invoice->lire)) { +if ((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire")) || (isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) { $langs->load("boxes"); $facstatic = new FactureFournisseur($db); @@ -590,7 +590,7 @@ if (isModEnabled('tax') && !empty($user->rights->tax->charges->lire)) { /* * Customers orders to be billed */ -if (isModEnabled('facture') && isModEnabled('commande') && $user->rights->commande->lire && empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) { +if (isModEnabled('facture') && isModEnabled('commande') && $user->hasRight("commande", "lire") && empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) { $commandestatic = new Commande($db); $langs->load("orders"); diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index f28ebf2ebcf..43443fb292e 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -385,14 +385,15 @@ if ($action == 'new') { print dol_get_fiche_end(); print '
'; - print ''; + print ''; if ($search_date_start || $search_date_end || $filteraccountid > 0) { print '   '; - print ''; + print ''; } print '
'; print ''; print '
'; + print '
'; $sql = "SELECT ba.rowid as bid, ba.label,"; $sql .= " b.rowid as transactionid, b.label as transactionlabel, b.datec as datec, b.dateo as date, "; diff --git a/htdocs/compta/paiement/cheque/index.php b/htdocs/compta/paiement/cheque/index.php index 92faa94dcee..394de095104 100644 --- a/htdocs/compta/paiement/cheque/index.php +++ b/htdocs/compta/paiement/cheque/index.php @@ -32,15 +32,23 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Load translation files required by the page $langs->loadLangs(array('banks', 'categories', 'compta', 'bills')); +$checkdepositstatic = new RemiseCheque($db); +$accountstatic = new Account($db); + // Security check if ($user->socid) { $socid = $user->socid; } $result = restrictedArea($user, 'banque', '', ''); +$usercancreate = $user->hasRight('banque', 'cheque'); -$checkdepositstatic = new RemiseCheque($db); -$accountstatic = new Account($db); + +/* + * Actions + */ + +// None /* @@ -49,7 +57,12 @@ $accountstatic = new Account($db); llxHeader('', $langs->trans("ChequesArea")); -print load_fiche_titre($langs->trans("ChequesArea"), '', $checkdepositstatic->picto); +$newcardbutton = ''; +if ($usercancreate) { + $newcardbutton .= dolGetButtonTitle($langs->trans('NewDeposit'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/paiement/cheque/card.php?action=new'); +} + +print load_fiche_titre($langs->trans("ChequesArea"), $newcardbutton, $checkdepositstatic->picto); print '
'; @@ -64,6 +77,7 @@ $sql .= " AND b.amount > 0"; $resql = $db->query($sql); +print '
'; print ''; print ''; print '\n"; @@ -79,10 +93,10 @@ if ($resql) { print ''; - print "
'.$langs->trans("BankChecks")."'; print ''.$num.''; print '
\n"; } else { dol_print_error($db); } +print "
\n"; print '
'; diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php index e4bf213c4eb..76531832776 100644 --- a/htdocs/core/ajax/ajaxdirpreview.php +++ b/htdocs/core/ajax/ajaxdirpreview.php @@ -362,31 +362,31 @@ if ($type == 'directory') { if ($module == 'medias') { $useinecm = 6; $modulepart = 'medias'; - $perm = ($user->rights->website->write || $user->rights->emailing->creer); + $perm = ($user->hasRight("website", "write") || $user->hasRight("emailing", "creer")); $title = 'none'; } elseif ($module == 'ecm') { // DMS/ECM -> manual structure - if ($user->rights->ecm->read) { + if ($user->hasRight("ecm", "read")) { // Buttons: Preview $useinecm = 2; } - if ($user->rights->ecm->upload) { + if ($user->hasRight("ecm", "upload")) { // Buttons: Preview + Delete $useinecm = 4; } - if ($user->rights->ecm->setup) { + if ($user->hasRight("ecm", "setup")) { // Buttons: Preview + Delete + Edit $useinecm = 5; } - $perm = $user->rights->ecm->upload; + $perm = $user->hasRight("ecm", "upload"); $modulepart = 'ecm'; $title = ''; // Use default } else { $useinecm = 5; $modulepart = 'ecm'; - $perm = $user->rights->ecm->upload; + $perm = $user->hasRight("ecm", "upload"); $title = ''; // Use default } diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php index 56fa8172bcb..4829b32a72a 100644 --- a/htdocs/core/boxes/box_activity.php +++ b/htdocs/core/boxes/box_activity.php @@ -84,7 +84,7 @@ class box_activity extends ModeleBoxes $totalnb = 0; $line = 0; $cachetime = 3600; - $fileid = '-e'.$conf->entity.'-u'.$user->id.'-s'.$user->socid.'-r'.($user->rights->societe->client->voir ? '1' : '0').'.cache'; + $fileid = '-e'.$conf->entity.'-u'.$user->id.'-s'.$user->socid.'-r'.($user->hasRight("societe", "client", "voir") ? '1' : '0').'.cache'; $now = dol_now(); $nbofperiod = 3; @@ -102,7 +102,7 @@ class box_activity extends ModeleBoxes // list the summary of the propals - if (isModEnabled("propal") && $user->rights->propal->lire) { + if (isModEnabled("propal") && $user->hasRight("propal", "lire")) { include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; $propalstatic = new Propal($this->db); @@ -189,7 +189,7 @@ class box_activity extends ModeleBoxes } // list the summary of the orders - if (isModEnabled('commande') && $user->rights->commande->lire) { + if (isModEnabled('commande') && $user->hasRight("commande", "lire")) { include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; $commandestatic = new Commande($this->db); @@ -278,7 +278,7 @@ class box_activity extends ModeleBoxes // list the summary of the bills - if (isModEnabled('facture') && $user->rights->facture->lire) { + if (isModEnabled('facture') && $user->hasRight("facture", "lire")) { include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $facturestatic = new Facture($this->db); diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index 5f87d81db9d..191887e1725 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -131,8 +131,10 @@ class HookManager dol_syslog(get_class($this)."::initHooks Loading hooks: ".join(', ', $arraytolog), LOG_DEBUG); } - if (!empty($this->hooks[$context])) { - ksort($this->hooks[$context], SORT_NATURAL); + foreach ($arraycontext as $context) { + if (!empty($this->hooks[$context])) { + ksort($this->hooks[$context], SORT_NATURAL); + } } return 1; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index da6339bdaec..a9c17a2edba 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3275,7 +3275,7 @@ class Form $langs->load('other'); } - $sql = "SELECT p.rowid, p.ref, p.label, p.price, p.duration, p.fk_product_type, p.stock,"; + $sql = "SELECT p.rowid, p.ref, p.label, p.price, p.duration, p.fk_product_type, p.stock, p.tva_tx as tva_tx_sale, p.default_vat_code as default_vat_code_sale,"; $sql .= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.quantity, pfp.remise_percent, pfp.remise, pfp.unitprice,"; $sql .= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, pfp.default_vat_code, pfp.fk_soc, s.nom as name,"; $sql .= " pfp.supplier_reputation"; @@ -3371,6 +3371,12 @@ class Form while ($i < $num) { $objp = $this->db->fetch_object($result); + if (is_null($objp->idprodfournprice)) { + // There is no supplier price found, we will use the vat rate for sale + $objp->tva_tx = $objp->tva_tx_sale; + $objp->default_vat_code = $objp->default_vat_code_sale; + } + $outkey = $objp->idprodfournprice; // id in table of price if (!$outkey && $alsoproductwithnosupplierprice) { $outkey = 'idprod_'.$objp->rowid; // id of product @@ -3566,14 +3572,17 @@ class Form if (empty($objp->idprodfournprice) && empty($alsoproductwithnosupplierprice)) { $optstart .= ' disabled'; } + if (!empty($objp->idprodfournprice) && $objp->idprodfournprice > 0) { - $opt .= ' data-product-id="'.dol_escape_htmltag($objp->rowid).'"'; - $opt .= ' data-price-id="'.dol_escape_htmltag($objp->idprodfournprice).'"'; - $opt .= ' data-qty="'.dol_escape_htmltag($objp->quantity).'"'; - $opt .= ' data-up="'.dol_escape_htmltag($objp->unitprice).'"'; - $opt .= ' data-up-locale="'.dol_escape_htmltag(price($objp->unitprice)).'"'; - $opt .= ' data-discount="'.dol_escape_htmltag($outdiscount).'"'; - $opt .= ' data-tvatx="'.dol_escape_htmltag($objp->tva_tx).'"'; + $optstart .= ' data-product-id="'.dol_escape_htmltag($objp->rowid).'"'; + $optstart .= ' data-price-id="'.dol_escape_htmltag($objp->idprodfournprice).'"'; + $optstart .= ' data-qty="'.dol_escape_htmltag($objp->quantity).'"'; + $optstart .= ' data-up="'.dol_escape_htmltag(price2num($objp->unitprice)).'"'; + $optstart .= ' data-up-locale="'.dol_escape_htmltag(price($objp->unitprice)).'"'; + $optstart .= ' data-discount="'.dol_escape_htmltag($outdiscount).'"'; + $optstart .= ' data-tvatx="'.dol_escape_htmltag(price2num($objp->tva_tx)).'"'; + $optstart .= ' data-tvatx-formated="'.dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)).'"'; + $optstart .= ' data-default-vat-code="'.dol_escape_htmltag($objp->default_vat_code).'"'; } $optstart .= ' data-description="'.dol_escape_htmltag($objp->description, 0, 1).'"'; @@ -3585,7 +3594,8 @@ class Form 'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty 'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price 'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility) - 'tva_tx' => $objp->tva_tx, + 'tva_tx_formated' => price($objp->tva_tx, 0, $langs, 1, -1, 2), + 'tva_tx' => price2num($objp->tva_tx), 'default_vat_code' => $objp->default_vat_code, 'discount' => $outdiscount, 'type' => $outtype, @@ -3613,14 +3623,15 @@ class Form $outarray, array('key'=>$outkey, 'value'=>$outref, - 'label'=>$outval, + 'label'=>$outvallabel, 'qty'=>$outqty, 'price_qty_ht'=>price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty - 'price_unit_ht'=>price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price - 'price_ht'=>price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility) 'price_qty_ht_locale'=>price($objp->fprice), + 'price_unit_ht'=>price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price 'price_unit_ht_locale'=>price($objp->unitprice), - 'tva_tx'=>$objp->tva_tx, + 'price_ht'=>price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility) + 'tva_tx_formated' => price($objp->tva_tx), + 'tva_tx'=>price2num($objp->tva_tx), 'default_vat_code'=>$objp->default_vat_code, 'discount'=>$outdiscount, 'type'=>$outtype, @@ -5047,9 +5058,9 @@ class Form $morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : ''); if ($input['type'] == 'text') { - $more .= '
'.$input['label'].'
'."\n"; + $more .= '
'.$input['label'].'
'."\n"; } elseif ($input['type'] == 'password') { - $more .= '
'.$input['label'].'
'."\n"; + $more .= '
'.$input['label'].'
'."\n"; } elseif ($input['type'] == 'textarea') { /*$more .= '
'.$input['label'].'
'; $more .= ''; $texte .= '
'; $texte .= ''; diff --git a/htdocs/core/tpl/filemanager.tpl.php b/htdocs/core/tpl/filemanager.tpl.php index 29506584e61..b3edcb7984f 100644 --- a/htdocs/core/tpl/filemanager.tpl.php +++ b/htdocs/core/tpl/filemanager.tpl.php @@ -44,13 +44,13 @@ $permtoadd = 0; $permtoupload = 0; $showroot = 0; if ($module == 'ecm') { - $permtoadd = $user->rights->ecm->setup; - $permtoupload = $user->rights->ecm->upload; + $permtoadd = $user->hasRight("ecm", "setup"); + $permtoupload = $user->hasRight("ecm", "upload"); $showroot = 0; } if ($module == 'medias') { - $permtoadd = ($user->rights->mailing->creer || $user->rights->website->write); - $permtoupload = ($user->rights->mailing->creer || $user->rights->website->write); + $permtoadd = ($user->hasRight("mailing", "creer") || $user->hasRight("website", "write")); + $permtoupload = ($user->hasRight("mailing", "creer") || $user->hasRight("website", "write")); $showroot = 1; } diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index c0382a39de4..c3b94332909 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -971,10 +971,11 @@ if (!empty($usemargins) && $user->rights->margins->creer) { } ?> - // Deal with supplier ref price + + // Deal with supplier ref price (idprodfournprice = int) if (jQuery('#idprodfournprice').val() > 0) { - console.log("objectline_create.tpl #idprodfournprice is > 0, so we set some properties into page"); + console.log("objectline_create.tpl #idprodfournprice is is an ID > 0, so we set some properties into page"); var up = parseFloat($('option:selected', this).attr('data-up')); // When select is done from HTML select if (isNaN(up)) { up = parseFloat(jQuery('#idprodfournprice').attr('data-up'));} // When select is done from HTML input with ajax autocomplete @@ -1023,14 +1024,15 @@ if (!empty($usemargins) && $user->rights->margins->creer) { } global->PRODUIT_AUTOFILL_DESC) && $conf->global->PRODUIT_AUTOFILL_DESC == 1) { + if (getDolGlobalInt('PRODUIT_AUTOFILL_DESC') == 1) { ?> var description = $('option:selected', this).attr('data-description'); if (typeof description == 'undefined') { description = jQuery('#idprodfournprice').attr('data-description'); } console.log("Load desciption into text area : "+description); global->FCKEDITOR_ENABLE_DETAILS)) { ?> + if (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS)) { + ?> if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined") { var editor = CKEDITOR.instances['dp_desc']; @@ -1039,15 +1041,41 @@ if (!empty($usemargins) && $user->rights->margins->creer) { } } + } else { + ?> jQuery('#dp_desc').text(description); + } + ?> } else if (jQuery('#idprodfournprice').length > 0) { + console.log("objectline_create.tpl #idprodfournprice is not an int but is a string so we set only few properties into page"); + + var tva_tx = parseFloat($('option:selected', this).attr('data-tvatx')); // When select is done from HTML select + if (isNaN(tva_tx)) { tva_tx = parseFloat(jQuery('#idprodfournprice').attr('data-tvatx'));} // When select is done from HTML input with ajax autocomplete + + var default_vat_code = $('option:selected', this).attr('data-default-vat-code'); // When select is done from HTML select + if (typeof default_vat_code === 'undefined') { default_vat_code = jQuery('#idprodfournprice').attr('data-default-vat-code');} // When select is done from HTML input with ajax autocomplete + + var stringforvatrateselection = tva_tx; + if (typeof default_vat_code != 'undefined' && default_vat_code != null) { + stringforvatrateselection = stringforvatrateselection+' ('+default_vat_code+')'; + } + + console.log("objectline_create.tpl We find data for price : tva_tx = "+tva_tx+", default_vat_code = "+default_vat_code+", stringforvatrateselection="+stringforvatrateselection+" for product id = "+jQuery('#idprodfournprice').val()); + + // Set vat rate if field is an input box + $('#tva_tx').val(tva_tx); + // Set vat rate by selecting the combo + //$('#tva_tx option').val(tva_tx); // This is bugged, it replaces the vat key of all options + $('#tva_tx option').removeAttr('selected'); + console.log("stringforvatrateselection="+stringforvatrateselection+" -> value of option label for this key="+$('#tva_tx option[value="'+stringforvatrateselection+'"]').val()); + $('#tva_tx option[value="'+stringforvatrateselection+'"]').prop('selected', true); + global->PRODUIT_AUTOFILL_DESC) && $conf->global->PRODUIT_AUTOFILL_DESC == 1) { - if (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS)) { ?> + if (getDolGlobalInt('PRODUIT_AUTOFILL_DESC') == 1) { + if (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS)) { + ?> if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined") { var editor = CKEDITOR.instances['dp_desc']; @@ -1056,11 +1084,13 @@ if (!empty($usemargins) && $user->rights->margins->creer) { } } + } else { + ?> jQuery('#dp_desc').text(''); + } + ?> } diff --git a/htdocs/ecm/dir_card.php b/htdocs/ecm/dir_card.php index 8be2511a0d7..e45175bb5c7 100644 --- a/htdocs/ecm/dir_card.php +++ b/htdocs/ecm/dir_card.php @@ -94,14 +94,14 @@ $permissiontoread = 0; $permissiontoadd = 0; $permissiontoupload = 0; if ($module == 'ecm') { - $permissiontoread = $user->rights->ecm->read; - $permissiontoadd = $user->rights->ecm->setup; - $permissiontoupload = $user->rights->ecm->upload; + $permissiontoread = $user->hasRight("ecm", "read"); + $permissiontoadd = $user->hasRight("ecm", "setup"); + $permissiontoupload = $user->hasRight("ecm", "upload"); } if ($module == 'medias') { - $permissiontoread = ($user->rights->mailing->lire || $user->rights->website->read); - $permissiontoadd = ($user->rights->mailing->creer || $user->rights->website->write); - $permissiontoupload = ($user->rights->mailing->creer || $user->rights->website->write); + $permissiontoread = ($user->hasRight("mailing", "lire") || $user->hasRight("website", "read")); + $permissiontoadd = ($user->hasRight("mailing", "creer") || $user->hasRight("website", "write")); + $permissiontoupload = ($user->hasRight("mailing", "creer") || $user->hasRight("website", "write")); } if (!$permissiontoread) { diff --git a/htdocs/ecm/index_medias.php b/htdocs/ecm/index_medias.php index 99a0ac4bc09..2e1edcdc269 100644 --- a/htdocs/ecm/index_medias.php +++ b/htdocs/ecm/index_medias.php @@ -37,6 +37,7 @@ $langs->loadLangs(array('ecm', 'companies', 'other', 'users', 'orders', 'propal' // Get parameters $action = GETPOST('action', 'aZ09'); +$backtopage = GETPOST('backtopage', 'alpha'); $socid = GETPOST('socid', 'int'); $file_manager = GETPOST('file_manager', 'alpha'); @@ -50,6 +51,7 @@ $overwritefile = GETPOST('overwritefile', 'int'); if (empty($action) && $file_manager) { $action = 'file_manager'; } +$pageid = GETPOST('pageid', 'int'); $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 4a6c5795602..3d458247bcf 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -67,7 +67,7 @@ $search_date_order_endyear = GETPOST('search_date_order_endyear', 'int'); $search_date_order_start = dol_mktime(0, 0, 0, $search_date_order_startmonth, $search_date_order_startday, $search_date_order_startyear); // Use tzserver $search_date_order_end = dol_mktime(23, 59, 59, $search_date_order_endmonth, $search_date_order_endday, $search_date_order_endyear); -$search_date_delivery_starvtday = GETPOST('search_date_delivery_startday', 'int'); +$search_date_delivery_startday = GETPOST('search_date_delivery_startday', 'int'); $search_date_delivery_startmonth = GETPOST('search_date_delivery_startmonth', 'int'); $search_date_delivery_startyear = GETPOST('search_date_delivery_startyear', 'int'); $search_date_delivery_endday = GETPOST('search_date_delivery_endday', 'int'); diff --git a/htdocs/includes/odtphp/odf.php b/htdocs/includes/odtphp/odf.php index 6c63da727b7..1a951292f94 100644 --- a/htdocs/includes/odtphp/odf.php +++ b/htdocs/includes/odtphp/odf.php @@ -796,7 +796,7 @@ IMG; // Export to PDF using LibreOffice - if ($conf->global->MAIN_ODT_AS_PDF == 'libreoffice') { + if (getDolGlobalString('MAIN_ODT_AS_PDF') == 'libreoffice') { dol_mkdir($conf->user->dir_temp); // We must be sure the directory exists and is writable // We delete and recreate a subdir because the soffice may have change pemrissions on it @@ -808,7 +808,7 @@ IMG; // using linux/mac libreoffice that must be in path // Note PHP Config "fastcgi.impersonate=0" must set to 0 - Default is 1 $command ='soffice --headless -env:UserInstallation=file:\''.$conf->user->dir_temp.'/odtaspdf\' --convert-to pdf --outdir '. escapeshellarg(dirname($name)). " ".escapeshellarg($name); - } elseif (preg_match('/unoconv/', $conf->global->MAIN_ODT_AS_PDF)) { + } elseif (preg_match('/unoconv/', getDolGlobalString('MAIN_ODT_AS_PDF'))) { // If issue with unoconv, see https://github.com/dagwieers/unoconv/issues/87 // MAIN_ODT_AS_PDF should be "sudo -u unoconv /usr/bin/unoconv" and userunoconv must have sudo to be root by adding file /etc/sudoers.d/unoconv with content www-data ALL=(unoconv) NOPASSWD: /usr/bin/unoconv . @@ -833,17 +833,17 @@ IMG; // - set shell of user to bash instead of nologin. // - set permission to read/write to user on home directory /var/www so user can create the libreoffice , dconf and .cache dir and files then set permission back - $command = $conf->global->MAIN_ODT_AS_PDF.' '.escapeshellcmd($name); + $command = getDolGlobalString('MAIN_ODT_AS_PDF').' '.escapeshellcmd($name); //$command = '/usr/bin/unoconv -vvv '.escapeshellcmd($name); } else { // deprecated old method using odt2pdf.sh (native, jodconverter, ...) $tmpname=preg_replace('/\.odt/i', '', $name); - if (!empty($conf->global->MAIN_DOL_SCRIPTS_ROOT)) { - $command = $conf->global->MAIN_DOL_SCRIPTS_ROOT.'/scripts/odt2pdf/odt2pdf.sh '.escapeshellcmd($tmpname).' '.(is_numeric($conf->global->MAIN_ODT_AS_PDF)?'jodconverter':$conf->global->MAIN_ODT_AS_PDF); + if (getDolGlobalString('MAIN_DOL_SCRIPTS_ROOT')) { + $command = getDolGlobalString('MAIN_DOL_SCRIPTS_ROOT').'/scripts/odt2pdf/odt2pdf.sh '.escapeshellcmd($tmpname).' '.(is_numeric(getDolGlobalString('MAIN_ODT_AS_PDF'))?'jodconverter':getDolGlobalString('MAIN_ODT_AS_PDF')); } else { dol_syslog(get_class($this).'::exportAsAttachedPDF is used but the constant MAIN_DOL_SCRIPTS_ROOT with path to script directory was not defined.', LOG_WARNING); - $command = '../../scripts/odt2pdf/odt2pdf.sh '.escapeshellcmd($tmpname).' '.(is_numeric($conf->global->MAIN_ODT_AS_PDF)?'jodconverter':$conf->global->MAIN_ODT_AS_PDF); + $command = '../../scripts/odt2pdf/odt2pdf.sh '.escapeshellcmd($tmpname).' '.(is_numeric(getDolGlobalString('MAIN_ODT_AS_PDF'))?'jodconverter':getDolGlobalString('MAIN_ODT_AS_PDF')); } } diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index e988764d8ba..a3ed5f9b7b6 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -178,31 +178,31 @@ ACCOUNTING_RESULT_PROFIT=Result accounting account (Profit) ACCOUNTING_RESULT_LOSS=Result accounting account (Loss) ACCOUNTING_CLOSURE_DEFAULT_JOURNAL=Journal of closure -ACCOUNTING_ACCOUNT_TRANSFER_CASH=Accounting account of transitional bank transfer +ACCOUNTING_ACCOUNT_TRANSFER_CASH=Account (from the Chart Of Account) to be used as the account for transitional bank transfers TransitionalAccount=Transitional bank transfer account -ACCOUNTING_ACCOUNT_SUSPENSE=Accounting account of wait -DONATION_ACCOUNTINGACCOUNT=Accounting account to register donations -ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT=Accounting account to register subscriptions +ACCOUNTING_ACCOUNT_SUSPENSE=Account (from the Chart Of Account) to be used as the account for unallocated funds either received or paid i.e. funds in "wait[ing]" +DONATION_ACCOUNTINGACCOUNT=Account (from the Chart Of Account) to be used to register donations (Donation module) +ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT=Account (from the Chart Of Account) to be used to register memberships subscriptions (Membership module - if membership recorded without invoice) -ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT=Accounting account by default to register customer deposit +ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT=Account (from the Chart Of Account) to be used as the default account to register customer deposit UseAuxiliaryAccountOnCustomerDeposit=Store customer account as individual account in subsidiary ledger for lines of down payments (if disabled, individual account for down payment lines will remain empty) -ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT=Accounting account by default to register supplier deposit +ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT=Account (from the Chart Of Account) to be used as the default UseAuxiliaryAccountOnSupplierDeposit=Store supplier account as individual account in subsidiary ledger for lines of down payments (if disabled, individual account for down payment lines will remain empty) -ACCOUNTING_PRODUCT_BUY_ACCOUNT=Accounting account by default for the bought products (used if not defined in the product sheet) -ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT=Accounting account by default for the bought products in EEC (used if not defined in the product sheet) -ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT=Accounting account by default for the bought products and imported out of EEC (used if not defined in the product sheet) -ACCOUNTING_PRODUCT_SOLD_ACCOUNT=Accounting account by default for the sold products (used if not defined in the product sheet) -ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT=Accounting account by default for the products sold in EEC (used if not defined in the product sheet) -ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT=Accounting account by default for the products sold and exported out of EEC (used if not defined in the product sheet) +ACCOUNTING_PRODUCT_BUY_ACCOUNT=Account (from the Chart Of Account) to be used as the default account for the products purchased within same country (used if not defined in the product sheet) +ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT=Account (from the Chart Of Account) to be used as the default account for the products purchased from EEC to another EEC country (used if not defined in the product sheet) +ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT=Account (from the Chart Of Account) to be used as the default account for the products purchased and imported from any other foreign country (used if not defined in the product sheet) +ACCOUNTING_PRODUCT_SOLD_ACCOUNT=Account (from the Chart Of Account) to be used as the default account for the sold products (used if not defined in the product sheet) +ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT=Account (from the Chart Of Account) to be used as the default account for the products sold from EEC to another EEC country (used if not defined in the product sheet) +ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT=Account (from the Chart Of Account) to be used as the default account for the products sold and exported to any other foreign country (used if not defined in the product sheet) -ACCOUNTING_SERVICE_BUY_ACCOUNT=Accounting account by default for the bought services (used if not defined in the service sheet) -ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT=Accounting account by default for the bought services in EEC (used if not defined in the service sheet) -ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT=Accounting account by default for the bought services and imported out of EEC (used if not defined in the service sheet) -ACCOUNTING_SERVICE_SOLD_ACCOUNT=Accounting account by default for the sold services (used if not defined in the service sheet) -ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT=Accounting account by default for the services sold in EEC (used if not defined in the service sheet) -ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT=Accounting account by default for the services sold and exported out of EEC (used if not defined in the service sheet) +ACCOUNTING_SERVICE_BUY_ACCOUNT=Account (from the Chart Of Account) to be used as the default account for the services purchased within same country (used if not defined in the service sheet) +ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT=Account (from the Chart Of Account) to be used as the default account for the services purchased from EEC to another EEC country (used if not defined in the service sheet) +ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT=Account (from the Chart Of Account) to be used as the default account for the services purchased and imported from other foreign country (used if not defined in the service sheet) +ACCOUNTING_SERVICE_SOLD_ACCOUNT=Account (from the Chart Of Account) to be used as the default account for the sold services (used if not defined in the service sheet) +ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT=Account (from the Chart Of Account) to be used as the default account for the services sold from EEC to another EEC country (used if not defined in the service sheet) +ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT=Account (from the Chart Of Account) to be used as the default account for the services sold and exported to any other foreign country (used if not defined in the service sheet) Doctype=Type of document Docdate=Date diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang index 4b623231511..b3d5f675830 100644 --- a/htdocs/langs/en_US/compta.lang +++ b/htdocs/langs/en_US/compta.lang @@ -246,12 +246,12 @@ TurnoverPerProductInCommitmentAccountingNotRelevant=The report of Turnover colle TurnoverPerSaleTaxRateInCommitmentAccountingNotRelevant=The report of Turnover collected per sale tax rate is not available. This report is only available for turnover invoiced. CalculationMode=Calculation mode AccountancyJournal=Accounting code journal -ACCOUNTING_VAT_SOLD_ACCOUNT=Accounting account by default for VAT on sales (used if not defined on VAT dictionary setup) -ACCOUNTING_VAT_BUY_ACCOUNT=Accounting account by default for VAT on purchases (used if not defined on VAT dictionary setup) -ACCOUNTING_VAT_PAY_ACCOUNT=Accounting account by default for paying VAT -ACCOUNTING_ACCOUNT_CUSTOMER=Accounting account used for customer third parties +ACCOUNTING_VAT_SOLD_ACCOUNT=Account (from the Chart Of Account) to be used as the default account for VAT on sales (used if not defined on VAT dictionary setup) +ACCOUNTING_VAT_BUY_ACCOUNT=Account (from the Chart Of Account) to be used as the default account for VAT on purchases (used if not defined on VAT dictionary setup) +ACCOUNTING_VAT_PAY_ACCOUNT=Account (from the Chart Of Account) to be used as the default account for paying VAT +ACCOUNTING_ACCOUNT_CUSTOMER=Account (from the Chart Of Account) used for "customer" third parties ACCOUNTING_ACCOUNT_CUSTOMER_Desc=The dedicated accounting account defined on third party card will be used for Subledger accounting only. This one will be used for General Ledger and as default value of Subledger accounting if dedicated customer accounting account on third party is not defined. -ACCOUNTING_ACCOUNT_SUPPLIER=Accounting account used for vendor third parties +ACCOUNTING_ACCOUNT_SUPPLIER=Account (from the Chart of Account) used for the "vendor" third parties ACCOUNTING_ACCOUNT_SUPPLIER_Desc=The dedicated accounting account defined on third party card will be used for Subledger accounting only. This one will be used for General Ledger and as default value of Subledger accounting if dedicated vendor accounting account on third party is not defined. ConfirmCloneTax=Confirm the clone of a social/fiscal tax ConfirmCloneVAT=Confirm the clone of a VAT declaration diff --git a/htdocs/langs/en_US/loan.lang b/htdocs/langs/en_US/loan.lang index 31a91f04d29..3bbb0e455d5 100644 --- a/htdocs/langs/en_US/loan.lang +++ b/htdocs/langs/en_US/loan.lang @@ -28,7 +28,7 @@ CantUseScheduleWithLoanStartedToPaid = Can't generate a timeline for a loan with CantModifyInterestIfScheduleIsUsed = You can't modify interest if you use schedule # Admin ConfigLoan=Configuration of the module loan -LOAN_ACCOUNTING_ACCOUNT_CAPITAL=Accounting account capital by default -LOAN_ACCOUNTING_ACCOUNT_INTEREST=Accounting account interest by default -LOAN_ACCOUNTING_ACCOUNT_INSURANCE=Accounting account insurance by default +LOAN_ACCOUNTING_ACCOUNT_CAPITAL=Account (from the Chart Of Account) to be used by default for capital (Loan module) +LOAN_ACCOUNTING_ACCOUNT_INTEREST=Account (from the Chart Of Account) to be used by default for interest (Loan module) +LOAN_ACCOUNTING_ACCOUNT_INSURANCE=Account (from the Chart Of Account) to be used by default for insurance (Loan module) CreateCalcSchedule=Edit financial commitment diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 64aa86149f0..bbb4ed227c4 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -1148,18 +1148,18 @@ EventReminder=Event Reminder UpdateForAllLines=Update for all lines OnHold=On hold Civility=Civility -AffectTag=Affect Tag -AffectUser=Affect User +AffectTag=Assign Tag +AffectUser=Assign User SetSupervisor=Set Supervisor CreateExternalUser=Create external user -ConfirmAffectTag=Bulk Tag Affect -ConfirmAffectUser=Bulk User Affect +ConfirmAffectTag=Bulk Tag Assignement +ConfirmAffectUser=Bulk User Assignement ProjectRole=Role assigned on each project TasksRole=Role assigned on each task of each project ConfirmSetSupervisor=Bulk Supervisor Set ConfirmUpdatePrice=Choose a increase/decrease price rate -ConfirmAffectTagQuestion=Are you sure you want to affect tags to the %s selected record(s)? -ConfirmAffectUserQuestion=Are you sure you want to affect users to the %s selected record(s)? +ConfirmAffectTagQuestion=Are you sure you want to assign tags to the %s selected record(s)? +ConfirmAffectUserQuestion=Are you sure you want to assign users to the %s selected record(s)? ConfirmSetSupervisorQuestion=Are you sure you want to set supervisor to the %s selected record(s)? ConfirmUpdatePriceQuestion=Are you sure you want to update the price of the %s selected record(s)? CategTypeNotFound=No tag type found for type of records @@ -1170,6 +1170,7 @@ InformationOnLinkToContract=This amount is only the total of all the lines of th ConfirmCancel=Are you sure you want to cancel EmailMsgID=Email MsgID EmailDate=Email date +SetToStatus=Set to status %s SetToEnabled=Set to enabled SetToDisabled=Set to disabled ConfirmMassEnabling=mass enabling confirmation @@ -1198,8 +1199,8 @@ Terminated=Terminated AddLineOnPosition=Add line on position (at the end if empty) ConfirmAllocateCommercial=Assign sales representative confirmation ConfirmAllocateCommercialQuestion=Are you sure you want to assign the %s selected record(s)? -CommercialsAffected=Sales representatives affected -CommercialAffected=Sales representative affected +CommercialsAffected=Sales representatives assigned +CommercialAffected=Sales representative assigned YourMessage=Your message YourMessageHasBeenReceived=Your message has been received. We will answer or contact you as soon as possible. UrlToCheck=Url to check diff --git a/htdocs/langs/en_US/salaries.lang b/htdocs/langs/en_US/salaries.lang index 20a10694500..d5f5b7e7544 100644 --- a/htdocs/langs/en_US/salaries.lang +++ b/htdocs/langs/en_US/salaries.lang @@ -1,6 +1,6 @@ # Dolibarr language file - Source file is en_US - salaries -SALARIES_ACCOUNTING_ACCOUNT_PAYMENT=Accounting account used for user third parties -SALARIES_ACCOUNTING_ACCOUNT_PAYMENT_Desc=The dedicated accounting account defined on user card will be used for Subledger accounting only. This one will be used for General Ledger and as default value of Subledger accounting if dedicated user accounting account on user is not defined. +SALARIES_ACCOUNTING_ACCOUNT_PAYMENT=Account (from the Chart of Account) used by default for "user" third parties +SALARIES_ACCOUNTING_ACCOUNT_PAYMENT_Desc=The dedicated account defined on user card will be used for Subledger accounting only. This one will be used for General Ledger and as default value of Subledger accounting if dedicated user accounting account on user is not defined. SALARIES_ACCOUNTING_ACCOUNT_CHARGE=Accounting account by default for wage payments CREATE_NEW_SALARY_WITHOUT_AUTO_PAYMENT=By default, leave empty the option "Automatically create a total payment" when creating a Salary Salary=Salary diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 06ad9a298ec..29c9205b1f0 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -572,7 +572,7 @@ foreach ($object->fields as $key => $val) { if (!empty($arrayfields['t.'.$key]['checked'])) { print ''; if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) { - print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1); + print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100'.($key == 'status' ? ' search_status onrightofpage' : ''), 1); } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) { print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth250', 1); } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) { diff --git a/htdocs/mrp/mo_list.php b/htdocs/mrp/mo_list.php index 723e4a76853..1a00a2dc052 100644 --- a/htdocs/mrp/mo_list.php +++ b/htdocs/mrp/mo_list.php @@ -123,7 +123,7 @@ foreach ($object->fields as $key => $val) { $visible = (int) dol_eval($val['visible'], 1); $arrayfields['t.'.$key] = array( 'label'=>$val['label'], - 'checked'=>(($visible < 0) ? 0 : 1), + 'checked'=>(($visible <= 0) ? 0 : 1), 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)), 'position'=>$val['position'], 'help'=> isset($val['help']) ? $val['help'] : '' diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index 069029d074b..40f67137acd 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -204,7 +204,7 @@ if ($action == 'set') { if ($action == 'del') { $ret = delDocumentModel($value, $type); if ($ret > 0) { - if ($conf->global->PRODUCT_ADDON_PDF == "$value") { + if (getDolGlobalString('PRODUCT_ADDON_PDF') == "$value") { dolibarr_del_const($db, 'PRODUCT_ADDON_PDF', $conf->entity); } } @@ -461,7 +461,7 @@ foreach ($dirmodels as $reldir) { // Defaut print ''; - if ($conf->global->PRODUCT_ADDON_PDF == $name) { + if (getDolGlobalString('PRODUCT_ADDON_PDF') == $name) { print img_picto($langs->trans("Default"), 'on'); } else { print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index e962b385931..11133d6a6e0 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -5158,11 +5158,7 @@ class Product extends CommonObject // Positionne le modele sur le nom du modele a utiliser if (!dol_strlen($modele)) { - if (!empty($conf->global->PRODUCT_ADDON_PDF)) { - $modele = $conf->global->PRODUCT_ADDON_PDF; - } else { - $modele = 'strato'; - } + $modele = getDolGlobalString('PRODUCT_ADDON_PDF', 'strato'); } $modelpath = "core/modules/product/doc/"; diff --git a/htdocs/product/list.php b/htdocs/product/list.php index da17d702820..14d43e038f1 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -1143,12 +1143,12 @@ if (!empty($arrayfields['p.tms']['checked'])) { } if (!empty($arrayfields['p.tosell']['checked'])) { print ''; - print $form->selectarray('search_tosell', array('0'=>$langs->trans('ProductStatusNotOnSellShort'), '1'=>$langs->trans('ProductStatusOnSellShort')), $search_tosell, 1); + print $form->selectarray('search_tosell', array('0'=>$langs->trans('ProductStatusNotOnSellShort'), '1'=>$langs->trans('ProductStatusOnSellShort')), $search_tosell, 1, 0, 0, '', 0, 0, 0, '', 'search_status width100 onrightofpage'); print ''; } if (!empty($arrayfields['p.tobuy']['checked'])) { print ''; - print $form->selectarray('search_tobuy', array('0'=>$langs->trans('ProductStatusNotOnBuyShort'), '1'=>$langs->trans('ProductStatusOnBuyShort')), $search_tobuy, 1); + print $form->selectarray('search_tobuy', array('0'=>$langs->trans('ProductStatusNotOnBuyShort'), '1'=>$langs->trans('ProductStatusOnBuyShort')), $search_tobuy, 1, 0, 0, '', 0, 0, 0, '', 'search_status width100 onrightofpage'); print ''; } if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 5a386792d1c..0424ddaf830 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -465,7 +465,8 @@ if (empty($reshook)) { break; } - if ($object->multiprices[$key] != $newprice || $object->multiprices_min[$key] != $newprice_min || $object->multiprices_base_type[$key] != $val['price_base_type'] || $object->multiprices_tva_tx[$key] != $newvattx) { + // If price has changed, we update it + if (!array_key_exists($key, $object->multiprices) || $object->multiprices[$key] != $newprice || $object->multiprices_min[$key] != $newprice_min || $object->multiprices_base_type[$key] != $val['price_base_type'] || $object->multiprices_tva_tx[$key] != $newvattx) { $res = $object->updatePrice($newprice, $val['price_base_type'], $user, $val['vat_tx'], $newprice_min, $key, $val['npr'], $psq, 0, $val['localtaxes_array'], $val['default_vat_code']); } else { $res = 0; diff --git a/htdocs/product/stats/card.php b/htdocs/product/stats/card.php index b0d06f15701..6871ad21adf 100644 --- a/htdocs/product/stats/card.php +++ b/htdocs/product/stats/card.php @@ -440,16 +440,16 @@ if ($result || !($id > 0)) { continue; } - if ($graphfiles == 'propal' && !$user->rights->propal->lire) { + if ($graphfiles == 'propal' && empty($user->rights->propal->lire)) { continue; } - if ($graphfiles == 'order' && !$user->rights->commande->lire) { + if ($graphfiles == 'order' && empty($user->rights->commande->lire)) { continue; } - if ($graphfiles == 'invoices' && !$user->rights->facture->lire) { + if ($graphfiles == 'invoices' && empty($user->rights->facture->lire)) { continue; } - if ($graphfiles == 'proposals_suppliers' && !$user->rights->supplier_proposal->lire) { + if ($graphfiles == 'proposals_suppliers' && empty($user->rights->supplier_proposal->lire)) { continue; } if ($graphfiles == 'invoices_suppliers' && empty($user->rights->fournisseur->facture->lire)) { @@ -458,7 +458,7 @@ if ($result || !($id > 0)) { if ($graphfiles == 'orders_suppliers' && empty($user->rights->fournisseur->commande->lire)) { continue; } - if ($graphfiles == 'mrp' && empty($user->rights->mrp->mo->read)) { + if ($graphfiles == 'mrp' && empty($user->rights->mrp->read)) { continue; } diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php index 14b98b82581..2e322ac2c3f 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -485,7 +485,7 @@ $formproject->selectTasks($socid ? $socid : -1, $taskid, 'taskid', 32, 0, '-- '. print '
'; print ' '; print $formcompany->selectTypeContact($object, '', 'type', 'internal', 'rowid', 0, 'maxwidth150onsmartphone'); -print ''; +print ''; print '
'; print '
'; diff --git a/htdocs/projet/activity/permonth.php b/htdocs/projet/activity/permonth.php index 49849b362ba..c013c07c23a 100644 --- a/htdocs/projet/activity/permonth.php +++ b/htdocs/projet/activity/permonth.php @@ -397,7 +397,7 @@ $formproject->selectTasks($socid ? $socid : -1, $taskid, 'taskid', 32, 0, '-- '. print '
'; print ' '; print $formcompany->selectTypeContact($object, '', 'type', 'internal', 'rowid', 0, 'maxwidth150onsmartphone'); -print ''; +print ''; print '
'; print '
'; diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index 7177f35e71c..d41dcc39494 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -498,7 +498,7 @@ $formproject->selectTasks($socid ? $socid : -1, $taskid, 'taskid', 32, 0, '-- '. print '
'; print ' '; print $formcompany->selectTypeContact($object, '', 'type', 'internal', 'rowid', 0, 'maxwidth150onsmartphone'); -print ''; +print ''; print '
'; print '
'; diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 994f4024b52..12b58799b5d 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -1542,7 +1542,11 @@ while ($i < $imaxinloop) { //if ($obj->opp_status_code) if (strcmp($obj->opp_amount, '')) { print ''.price($obj->opp_amount, 1, $langs, 1, -1, -1, '').''; - $totalarray['val']['p.opp_amount'] += $obj->opp_amount; + if (empty($totalarray['val']['p.opp_amount'])) { + $totalarray['val']['p.opp_amount'] = $obj->opp_amount; + } else { + $totalarray['val']['p.opp_amount'] += $obj->opp_amount; + } } print ''; if (!$i) { @@ -1571,7 +1575,11 @@ while ($i < $imaxinloop) { print ''; if ($obj->opp_weighted_amount) { print ''.price($obj->opp_weighted_amount, 1, $langs, 1, -1, -1, '').''; - $totalarray['val']['opp_weighted_amount'] += $obj->opp_weighted_amount; + if (empty($totalarray['val']['opp_weighted_amount'])) { + $totalarray['val']['opp_weighted_amount'] = $obj->opp_weighted_amount; + } else { + $totalarray['val']['opp_weighted_amount'] += $obj->opp_weighted_amount; + } } print ''; if (!$i) { @@ -1586,7 +1594,11 @@ while ($i < $imaxinloop) { print ''; if ($obj->budget_amount != '') { print ''.price($obj->budget_amount, 1, $langs, 1, -1, -1).''; - $totalarray['val']['p.budget_amount'] += $obj->budget_amount; + if (empty($totalarray['val']['p.budget_amount'])) { + $totalarray['val']['p.budget_amount'] = $obj->budget_amount; + } else { + $totalarray['val']['p.budget_amount'] += $obj->budget_amount; + } } print ''; if (!$i) { diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 27ccb40b4ed..ceddeedfd33 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -1239,7 +1239,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser } // Call Hook formConfirm - $parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid, "projectstatic" => $projectstatic, "withproject" => $withproject); + $parameters = array('formConfirm' => $formconfirm, "projectstatic" => $projectstatic, "withproject" => $withproject); $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if (empty($reshook)) { $formconfirm .= $hookmanager->resPrint; @@ -1265,7 +1265,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser } $arrayfields['author'] = array('label'=>$langs->trans("By"), 'checked'=>1); $arrayfields['t.note'] = array('label'=>$langs->trans("Note"), 'checked'=>1); - if ($conf->service->enabled && $projectstatic->thirdparty->id > 0 && $projectstatic->usage_bill_time) { + if (isModEnabled('service') && !empty($projectstatic->thirdparty) && $projectstatic->thirdparty->id > 0 && $projectstatic->usage_bill_time) { $arrayfields['t.fk_product'] = array('label' => $langs->trans("Product"), 'checked' => 1); } $arrayfields['t.task_duration'] = array('label'=>$langs->trans("Duration"), 'checked'=>1); @@ -1971,7 +1971,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser $total = 0; $totalvalue = 0; - $totalarray = array(); + $totalarray = array('nbfield'=>0); foreach ($tasks as $task_time) { if ($i >= $limit) { break; @@ -2168,11 +2168,19 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser if (!$i) { $totalarray['pos'][$totalarray['nbfield']] = 't.task_duration'; } - $totalarray['val']['t.task_duration'] += $task_time->task_duration; + if (empty($totalarray['val']['t.task_duration'])) { + $totalarray['val']['t.task_duration'] = $task_time->task_duration; + } else { + $totalarray['val']['t.task_duration'] += $task_time->task_duration; + } if (!$i) { $totalarray['totaldurationfield'] = $totalarray['nbfield']; } - $totalarray['totalduration'] += $task_time->task_duration; + if (empty($totalarray['totalduration'])) { + $totalarray['totalduration'] = $task_time->task_duration; + } else { + $totalarray['totalduration'] += $task_time->task_duration; + } } //Product @@ -2208,11 +2216,19 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser if (!$i) { $totalarray['pos'][$totalarray['nbfield']] = 'value'; } - $totalarray['val']['value'] += $value; + if (empty($totalarray['val']['value'])) { + $totalarray['val']['value'] = $value; + } else { + $totalarray['val']['value'] += $value; + } if (!$i) { $totalarray['totalvaluefield'] = $totalarray['nbfield']; } - $totalarray['totalvalue'] += $value; + if (empty($totalarray['totalvalue'])) { + $totalarray['totalvalue'] = $value; + } else { + $totalarray['totalvalue'] += $value; + } } // Invoiced diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index cac761023ef..d6e39e64eeb 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -927,7 +927,7 @@ if (!empty($arrayfields['e.date_delivery']['checked'])) { if (!empty($arrayfields['l.ref']['checked'])) { // Delivery ref print ''; - print ''; } if (!empty($arrayfields['l.date_delivery']['checked'])) { @@ -960,7 +960,7 @@ if (!empty($arrayfields['e.tms']['checked'])) { // Status if (!empty($arrayfields['e.fk_statut']['checked'])) { print ''; - print $form->selectarray('search_status', array('0'=>$langs->trans('StatusReceptionDraftShort'), '1'=>$langs->trans('StatusReceptionValidatedShort'), '2'=>$langs->trans('StatusReceptionProcessedShort')), $search_status, 1); + print $form->selectarray('search_status', array('0'=>$langs->trans('StatusReceptionDraftShort'), '1'=>$langs->trans('StatusReceptionValidatedShort'), '2'=>$langs->trans('StatusReceptionProcessedShort')), $search_status, 1, 0, 0, '', 0, 0, 0, '', 'search_status onrightofpage'); print ''; } // Status billed diff --git a/htdocs/recruitment/lib/recruitment.lib.php b/htdocs/recruitment/lib/recruitment.lib.php index acc7160f282..6fa58cc64f5 100644 --- a/htdocs/recruitment/lib/recruitment.lib.php +++ b/htdocs/recruitment/lib/recruitment.lib.php @@ -1,5 +1,6 @@ + * Copyright (C) 2022 Frédéric France * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,7 +29,11 @@ */ function recruitmentAdminPrepareHead() { - global $langs, $conf; + global $langs, $conf, $db; + + $extrafields = new ExtraFields($db); + $extrafields->fetch_name_optionals_label('recruitment_recruitmentjobposition'); + $extrafields->fetch_name_optionals_label('recruitment_recruitmentcandidature'); $langs->load("recruitment"); @@ -52,11 +57,19 @@ function recruitmentAdminPrepareHead() $head[$h][0] = dol_buildpath("/recruitment/admin/jobposition_extrafields.php", 1); $head[$h][1] = $langs->trans("ExtrafieldsJobPosition"); + $nbExtrafields = $extrafields->attributes['recruitment_recruitmentjobposition']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'jobposition_extrafields'; $h++; $head[$h][0] = dol_buildpath("/recruitment/admin/candidature_extrafields.php", 1); $head[$h][1] = $langs->trans("ExtrafieldsApplication"); + $nbExtrafields = $extrafields->attributes['recruitment_recruitmentcandidature']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'candidature_extrafields'; $h++; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 1fb149ba250..3643a404863 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -796,36 +796,41 @@ class Societe extends CommonObject */ public $bank_account; + + const STATUS_CEASED = 0; + const STATUS_INACTIVITY = 1; + /** - * Third party is no customer + * Third party type is no customer */ const NO_CUSTOMER = 0; /** - * Third party is a customer + * Third party type is a customer */ const CUSTOMER = 1; /** - * Third party is a prospect + * Third party type is a prospect */ const PROSPECT = 2; /** - * Third party is a customer and a prospect + * Third party type is a customer and a prospect */ const CUSTOMER_AND_PROSPECT = 3; /** - * Third party is no supplier + * Third party supplier flag is not supplier */ const NO_SUPPLIER = 0; /** - * Third party is a supplier + * Third party supplier flag is a supplier */ const SUPPLIER = 1; + /** * Constructor * diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php index e161cd8668c..a74d4ff3ae0 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -184,7 +184,7 @@ if (!empty($conf->use_javascript_ajax) && ((round($third['prospect']) ? 1 : 0) + $statstring .= ""; } $statstring2 = ''; - if (((isModEnabled('fournisseur') && $user->rights->fournisseur->facture->lire && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled('supplier_order') && $user->rights->supplier_order->lire) || (isModEnabled('supplier_invoice') && $user->rights->supplier_invoice->lire)) && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS)) { + if (((isModEnabled('fournisseur') && $user->hasRight('fournisseur', 'facture', 'lire') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled('supplier_order') && $user->hasRight('supplier_order', 'lire')) || (isModEnabled('supplier_invoice') && $user->hasRight('supplier_invoice', 'lire'))) && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS)) { $statstring2 = ""; $statstring2 .= ''.$langs->trans("Suppliers").''.round($third['supplier']).''; $statstring2 .= ""; diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 088e3ebe000..088f0b10055 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -321,7 +321,8 @@ if ($action == "change") { // Change customer for TakePOS } if (GETPOST('cancel', 'alpha')) { - $action = 'list'; $massaction = ''; + $action = 'list'; + $massaction = ''; } if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; @@ -936,10 +937,10 @@ if (isModEnabled('category') && $user->hasRight("societe", "creer")) { $arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag"); } if ($user->hasRight("societe", "creer")) { - $arrayofmassactions['preenable'] = img_picto('', 'stop-circle', 'class="pictofixedwidth"').$langs->trans("SetToEnabled"); + $arrayofmassactions['preenable'] = img_picto('', 'stop-circle', 'class="pictofixedwidth"').$langs->trans("SetToStatus", $object->LibStatut($object::STATUS_INACTIVITY)); } if ($user->hasRight("societe", "creer")) { - $arrayofmassactions['predisable'] = img_picto('', 'stop-circle', 'class="pictofixedwidth"').$langs->trans("SetToDisabled"); + $arrayofmassactions['predisable'] = img_picto('', 'stop-circle', 'class="pictofixedwidth"').$langs->trans("SetToStatus", $object->LibStatut($object::STATUS_CEASED)); } if ($user->hasRight("societe", "creer")) { $arrayofmassactions['presetcommercial'] = img_picto('', 'user', 'class="pictofixedwidth"').$langs->trans("AllocateCommercial"); @@ -1028,7 +1029,7 @@ if ($search_all) { // Filter on categories $moreforfilter = ''; if (empty($type) || $type == 'c' || $type == 'p') { - if (isModEnabled('categorie') && $user->rights->categorie->lire) { + if (isModEnabled('categorie') && $user->hasRight("categorie", "lire")) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $moreforfilter .= '
'; $tmptitle = $langs->trans('Categories'); @@ -1039,7 +1040,7 @@ if (empty($type) || $type == 'c' || $type == 'p') { } if (empty($type) || $type == 'f') { - if (isModEnabled("fournisseur") && isModEnabled('categorie') && $user->rights->categorie->lire) { + if (isModEnabled("fournisseur") && isModEnabled('categorie') && $user->hasRight("categorie", "lire")) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $moreforfilter .= '
'; $tmptitle = $langs->trans('Categories'); @@ -1050,7 +1051,7 @@ if (empty($type) || $type == 'f') { } // If the user can view prospects other than his' -if ($user->rights->societe->client->voir || $socid) { +if ($user->hasRight("societe", "client", "voir") || $socid) { $moreforfilter .= '
'; $tmptitle = $langs->trans('SalesRepresentatives'); $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"'); @@ -1310,7 +1311,7 @@ if (!empty($arrayfields['s.tms']['checked'])) { // Status if (!empty($arrayfields['s.status']['checked'])) { print ''; - print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), $search_status, 1, 0, 0, '', 0, 0, 0, '', '', 1); + print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), $search_status, 1, 0, 0, '', 0, 0, 0, '', 'search_status minwidth75 maxwidth125 onrightofpage', 1); print ''; } if (!empty($arrayfields['s.import_key']['checked'])) { diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php index 64a18cf2a74..2d706699447 100644 --- a/htdocs/variants/combinations.php +++ b/htdocs/variants/combinations.php @@ -71,7 +71,7 @@ if ($id > 0 || $ref) { } $selectedvariant = !empty($_SESSION['addvariant_'.$object->id]) ? $_SESSION['addvariant_'.$object->id] : array(); - +$selected = ""; // Security check if (!isModEnabled('variants')) { accessforbidden('Module not enabled'); @@ -140,7 +140,7 @@ $productCombination2ValuePairs1 = array(); if (($action == 'add' || $action == 'create') && empty($massaction) && !GETPOST('selectvariant', 'alpha') && empty($subaction)) { // We click on Create all defined combinations //$features = GETPOST('features', 'array'); - $features = $_SESSION['addvariant_'.$object->id]; + $features = !empty($_SESSION['addvariant_'.$object->id]) ? $_SESSION['addvariant_'.$object->id] : array(); if (!$features) { if ($action == 'create') { @@ -474,7 +474,7 @@ if (!empty($id) || !empty($ref)) { if ($action == 'add') { $title = $langs->trans('NewProductCombination'); // print dol_get_fiche_head(); - $features = $_SESSION['addvariant_'.$object->id]; + $features = !empty($_SESSION['addvariant_'.$object->id]) ? $_SESSION['addvariant_'.$object->id] : array(); //First, sanitize $listofvariantselected = '
'; if (!empty($features)) {