diff --git a/ChangeLog b/ChangeLog index ef931857be0..1697b668934 100644 --- a/ChangeLog +++ b/ChangeLog @@ -49,7 +49,6 @@ NEW: Add employment anniversary in birthday box NEW: Add extrafield type "IP" to store IP addresses NEW: Add fail2ban rules examples to limit access to /public pages NEW: Add filter "Product subject to lot/Serial" in stock per lot/serial -NEW: Add free membership amounts at the membership type level NEW: Add hidden option MAIN_EMAIL_SUPPORT_ACK to restore Email ack checkbox (feature abandonned by mailers) NEW: Add IMAP port setting on email collector module NEW: Adding JAPAN Chart-of-Account and regions/departments @@ -67,7 +66,6 @@ NEW: Add option --force on CLI cron_run_jobs.php NEW: Add option "Show price on the generated documents for receptions" NEW: Add performance index (name for company and contact) and llx_bank_url(url_id) NEW: Add picto property on sub-module for password generation -NEW: Add price to product box in TakePOS NEW: add redirect on action confirm addconsumedline and addproduceline NEW: Add a new advanced permission "read price" NEW: Add substitution key __SENDEREMAIL_SIGNATURE__ @@ -89,18 +87,11 @@ NEW: Can set a commercial discount by entering amount including VAT NEW: Can set a monthly frequency (or multiple) in cron tasks. NEW: Can set start and end dates and comment on button "Activate all services" NEW: can sort and preselected best supplier price -NEW: Website Can delete a whole website if disabled -NEW: Website Can remove a website template -NEW: Website can set header "Strict-Transport-Security" in web sites. -NEW: Website Can switch status of website and page from the website toolbar -NEW: Website Templates of websites are now directories and not zip into core repo -NEW: Website Add 4 other templates in website module NEW: Can use products categories to make inventory NEW: Change filter type on tickets list into a multiselect combo NEW: conf TIMESPENT_ALWAYS_UPDATE_THM, when it's on we always check current thm of user to update it in task time line NEW: constant PROPAL_NEW_AS_SIGNED NEW: show date delivery planned on orders linked to company and product -NEW: default_lang for members NEW: Default template of contract is not mandatory NEW: Default values in extrafields are not more limited to 255 char. NEW: display currency in takepos menu @@ -108,11 +99,21 @@ NEW: Enable online signature for interventions NEW: Encrypt all sensitive constants in llx_const NEW: extrafield price with currency NEW: filter on reception dates (from / to) in cheque paiement card -NEW: TakePOS Header Scroll in TakePOS -NEW: TakePOS Add setup parameters, can setup terminal name -NEW: TakePOS support of Stripe Terminal with Takepos -NEW: TakePOS Receipt preview in TakePOS setup -NEW: TakePOS different product list on smartphone +NEW: Members: default_lang for members +NEW: Members: Table of membership types +NEW: Members: add free membership amounts at the membership type level +NEW: TakePOS: Header Scroll in TakePOS +NEW: TakePOS: add price to product box in TakePOS +NEW: TakePOS: add setup parameters, can setup terminal name +NEW: TakePOS: support of Stripe Terminal with TakePOS +NEW: TakePOS: Receipt preview in TakePOS setup +NEW: TakePOS: different product list on smartphone +NEW: Website: can delete a whole website if disabled +NEW: Website: can remove a website template +NEW: Website: can set header "Strict-Transport-Security" in web sites. +NEW: Website: can switch status of website and page from the website toolbar +NEW: Website: Templates of websites are now directories and not zip into core repo +NEW: Website: add 4 other templates in website module NEW: If we select another view list mode, we keep it NEW: Init module bookcal NEW: Introduce dolEncrypt and dolDecrypt to be able to encrypt data in db @@ -121,7 +122,7 @@ NEW: invoice export : add accounting affectation NEW: label on products categories filter NEW: The link "add to bookmark" is always on top in the bookmark popup NEW: MAIN_SEARCH_CATEGORY_PRODUCT_ON_LISTS const to show category customer filter -NEW: Make module WebservicesClient deprecated. Use module WebHook instead +NEW: Make module WebservicesClient deprecated. Use module WebHook instead. NEW: manage no email with thirdparties (better for GDPR) NEW: Manage Position (Rank) on Contract Lines NEW: Manage VAT on all lines on purchases cycle @@ -159,7 +160,6 @@ NEW: SMTP using oauth2 authentication NEW: can substitue project title in mail template NEW: Supplier order list - Add column private and public note NEW: Support IP type in extrafields -NEW: Table of membership types NEW: The purge of files can purge only if older than a number of seconds NEW: Update ActionComm type_code on email message ticket NEW: VAT - Admin - Add information on deadline day for submission of VAT declaration diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index c897a7c3e0b..4aba6bfeda4 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -4,7 +4,7 @@ * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2012 Regis Houssin * Copyright (C) 2013 Christophe Battarel - * Copyright (C) 2013-2021 Alexandre Spangaro + * Copyright (C) 2013-2022 Open-DSI * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2013-2014 Olivier Geffroy * Copyright (C) 2017-2021 Frédéric France @@ -1415,9 +1415,19 @@ function getSourceDocRef($val, $typerecord) $sqlmid = ''; if ($typerecord == 'payment') { - $sqlmid = 'SELECT payfac.fk_facture as id, f.ref as ref'; - $sqlmid .= " FROM ".MAIN_DB_PREFIX."paiement_facture as payfac, ".MAIN_DB_PREFIX."facture as f"; - $sqlmid .= " WHERE payfac.fk_facture = f.rowid AND payfac.fk_paiement=".((int) $val["paymentid"]); + if (getDolGlobalInt('FACTURE_DEPOSITS_ARE_JUST_PAYMENTS')) { + $sqlmid = "SELECT payfac.fk_facture as id, ".$db->ifsql('f1.rowid IS NULL', 'f.ref', 'f1.ref')." as ref"; + $sqlmid .= " FROM ".$db->prefix()."paiement_facture as payfac"; + $sqlmid .= " LEFT JOIN ".$db->prefix()."facture as f ON f.rowid = payfac.fk_facture"; + $sqlmid .= " LEFT JOIN ".$db->prefix()."societe_remise_except as sre ON sre.fk_facture_source = payfac.fk_facture"; + $sqlmid .= " LEFT JOIN ".$db->prefix()."facture as f1 ON f1.rowid = sre.fk_facture"; + $sqlmid .= " WHERE payfac.fk_paiement=".((int) $val['paymentid']); + } else { + $sqlmid = "SELECT payfac.fk_facture as id, f.ref as ref"; + $sqlmid .= " FROM ".$db->prefix()."paiement_facture as payfac"; + $sqlmid .= " INNER JOIN ".$db->prefix()."facture as f ON f.rowid = payfac.fk_facture"; + $sqlmid .= " WHERE payfac.fk_paiement=".((int) $val['paymentid']); + } $ref = $langs->transnoentitiesnoconv("Invoice"); } elseif ($typerecord == 'payment_supplier') { $sqlmid = 'SELECT payfac.fk_facturefourn as id, f.ref'; diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index 15af4a532fa..70ba9a2b531 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -204,6 +204,7 @@ class BlockedLog } // Add more action to track from a conf variable + // For example: STOCK_MOVEMENT,... if (!empty($conf->global->BLOCKEDLOG_ADD_ACTIONS_SUPPORTED)) { $tmparrayofmoresupportedevents = explode(',', $conf->global->BLOCKEDLOG_ADD_ACTIONS_SUPPORTED); foreach ($tmparrayofmoresupportedevents as $val) { @@ -305,6 +306,15 @@ class BlockedLog } else { $this->error++; } + } elseif ($this->element === 'stockmouvement') { + require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; + + $object = new MouvementStock($this->db); + if ($object->fetch($this->fk_object) > 0) { + return $object->getNomUrl(1); + } else { + $this->error++; + } } elseif ($this->action == 'MODULE_SET') { return ''.$langs->trans("BlockedLogEnabled").''; } elseif ($this->action == 'MODULE_RESET') { @@ -378,9 +388,14 @@ class BlockedLog $this->date_object = $object->dateh; } elseif ($object->element == 'cashcontrol') { $this->date_object = $object->date_creation; - } else { + } elseif (property_exists($object, 'date')) { + // Generic case $this->date_object = $object->date; + } elseif (property_exists($object, 'datem')) { + // Generic case (second chance, for example for stock movement) + $this->date_object = $object->datem; } + // ref $this->ref_object = ((!empty($object->newref)) ? $object->newref : $object->ref); // newref is set when validating a draft, ref is set in other cases // type of object @@ -395,11 +410,18 @@ class BlockedLog $arrayoffieldstoexclude = array( 'table_element', 'fields', 'ref_previous', 'ref_next', 'origin', 'origin_id', 'oldcopy', 'picto', 'error', 'errors', 'model_pdf', 'modelpdf', 'last_main_doc', 'civility_id', 'contact', 'contact_id', 'table_element_line', 'ismultientitymanaged', 'isextrafieldmanaged', + 'array_languages', + 'childtables', + 'contact_ids', + 'context', + 'labelStatus', + 'labelStatusShort', 'linkedObjectsIds', 'linkedObjects', 'fk_delivery_address', - 'context', - 'projet' // There is already ->fk_project + 'projet', // There is already ->fk_project + 'restrictiononfksoc', + 'specimen', ); // Add more fields to exclude depending on object type if ($this->element == 'cashcontrol') { @@ -428,7 +450,7 @@ class BlockedLog continue; // Discard if not into a dedicated list } if (!is_object($value) && !is_null($value) && $value !== '') { - $this->object_data->thirdparty->{$key} = $value; + $this->object_data->thirdparty->$key = $value; } } } @@ -448,7 +470,7 @@ class BlockedLog continue; // Discard if not into a dedicated list } if (!is_object($value) && !is_null($value) && $value !== '') { - $this->object_data->mycompany->{$key} = $value; + $this->object_data->mycompany->$key = $value; } } } @@ -486,12 +508,12 @@ class BlockedLog } if (!is_object($valueline) && !is_null($valueline) && $valueline !== '') { - $this->object_data->invoiceline[$lineid]->{$keyline} = $valueline; + $this->object_data->invoiceline[$lineid]->$keyline = $valueline; } } } } elseif (!is_object($value) && !is_null($value) && $value !== '') { - $this->object_data->{$key} = $value; + $this->object_data->$key = $value; } } @@ -509,7 +531,7 @@ class BlockedLog continue; // Discard if not into a dedicated list } if (!is_object($value) && !is_null($value) && $value !== '') { - $this->object_data->{$key} = $value; + $this->object_data->$key = $value; } } @@ -601,7 +623,7 @@ class BlockedLog continue; // Discard if not into a dedicated list } if (!is_object($value) && !is_null($value) && $value !== '') { - $paymentpart->thirdparty->{$key} = $value; + $paymentpart->thirdparty->$key = $value; } } } @@ -625,11 +647,11 @@ class BlockedLog } if (!is_object($value) && !is_null($value) && $value !== '') { if ($this->element == 'payment_donation') { - $paymentpart->donation->{$key} = $value; + $paymentpart->donation->$key = $value; } elseif ($this->element == 'payment_various') { - $paymentpart->various->{$key} = $value; + $paymentpart->various->$key = $value; } else { - $paymentpart->invoice->{$key} = $value; + $paymentpart->invoice->$key = $value; } } } @@ -664,21 +686,30 @@ class BlockedLog continue; // Discard if not into a dedicated list } if (!is_object($value) && !is_null($value) && $value !== '') { - $this->object_data->{$key} = $value; + $this->object_data->$key = $value; } } if (!empty($object->newref)) { $this->object_data->ref = $object->newref; } - } else // Generic case - { + } elseif ($this->element == 'stockmouvement') { foreach ($object as $key => $value) { if (in_array($key, $arrayoffieldstoexclude)) { continue; // Discard some properties } if (!is_object($value) && !is_null($value) && $value !== '') { - $this->object_data->{$key} = $value; + $this->object_data->$key = $value; + } + } + } else { + // Generic case + foreach ($object as $key => $value) { + if (in_array($key, $arrayoffieldstoexclude)) { + continue; // Discard some properties + } + if (!is_object($value) && !is_null($value) && $value !== '') { + $this->object_data->$key = $value; } } 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/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/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/ajax/selectsearchbox.php b/htdocs/core/ajax/selectsearchbox.php index f2e44577260..38c363654d3 100644 --- a/htdocs/core/ajax/selectsearchbox.php +++ b/htdocs/core/ajax/selectsearchbox.php @@ -68,22 +68,22 @@ $arrayresult = array(); // Define $searchform if (isModEnabled('adherent') && empty($conf->global->MAIN_SEARCHFORM_ADHERENT_DISABLED) && $user->hasRight('adherent', 'lire')) { - $arrayresult['searchintomember'] = array('position'=>8, 'shortcut'=>'M', 'img'=>'object_member', 'label'=>$langs->trans("SearchIntoMembers", $search_boxvalue), 'text'=>img_picto('', 'object_member', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoMembers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/adherents/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : '')); + $arrayresult['searchintomember'] = array('position'=>8, 'shortcut'=>'M', 'img'=>'object_member', 'label'=>$langs->trans("SearchIntoMembers", $search_boxvalue), 'text'=>img_picto('', 'object_member', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoMembers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/adherents/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } if (((isModEnabled('societe') && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled('supplier_order') || isModEnabled('supplier_invoice'))) && empty($conf->global->MAIN_SEARCHFORM_SOCIETE_DISABLED) && $user->hasRight('societe', 'lire')) { - $arrayresult['searchintothirdparty'] = array('position'=>10, 'shortcut'=>'T', 'img'=>'object_company', 'label'=>$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'text'=>img_picto('', 'object_company', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/societe/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : '')); + $arrayresult['searchintothirdparty'] = array('position'=>10, 'shortcut'=>'T', 'img'=>'object_company', 'label'=>$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'text'=>img_picto('', 'object_company', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/societe/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } if (isModEnabled('societe') && empty($conf->global->MAIN_SEARCHFORM_CONTACT_DISABLED) && $user->hasRight('societe', 'lire')) { - $arrayresult['searchintocontact'] = array('position'=>15, 'shortcut'=>'A', 'img'=>'object_contact', 'label'=>$langs->trans("SearchIntoContacts", $search_boxvalue), 'text'=>img_picto('', 'object_contact', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoContacts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contact/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : '')); + $arrayresult['searchintocontact'] = array('position'=>15, 'shortcut'=>'A', 'img'=>'object_contact', 'label'=>$langs->trans("SearchIntoContacts", $search_boxvalue), 'text'=>img_picto('', 'object_contact', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoContacts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contact/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } if (((isModEnabled('product') && $user->hasRight('product', 'read')) || (isModEnabled('service') && $user->hasRight('service', 'read'))) && empty($conf->global->MAIN_SEARCHFORM_PRODUITSERVICE_DISABLED)) { - $arrayresult['searchintoproduct'] = array('position'=>30, 'shortcut'=>'P', 'img'=>'object_product', 'label'=>$langs->trans("SearchIntoProductsOrServices", $search_boxvalue), 'text'=>img_picto('', 'object_product', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoProductsOrServices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/product/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : '')); + $arrayresult['searchintoproduct'] = array('position'=>30, 'shortcut'=>'P', 'img'=>'object_product', 'label'=>$langs->trans("SearchIntoProductsOrServices", $search_boxvalue), 'text'=>img_picto('', 'object_product', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoProductsOrServices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/product/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); // search on lot/serial numbers if (isModEnabled('productbatch')) { - $arrayresult['searchintobatch'] = array('position'=>32, 'shortcut'=>'B', 'img'=>'object_lot', 'label'=>$langs->trans("SearchIntoBatch", $search_boxvalue), 'text'=>img_picto('', 'object_lot', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoBatch", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/product/stock/productlot_list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : '')); + $arrayresult['searchintobatch'] = array('position'=>32, 'shortcut'=>'B', 'img'=>'object_lot', 'label'=>$langs->trans("SearchIntoBatch", $search_boxvalue), 'text'=>img_picto('', 'object_lot', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoBatch", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/product/stock/productlot_list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } } @@ -98,26 +98,26 @@ if (isModEnabled('project') && empty($conf->global->MAIN_SEARCHFORM_TASK_DISABLE } if (isModEnabled('propal') && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_PROPAL_DISABLED) && $user->hasRight('propal', 'lire')) { - $arrayresult['searchintopropal'] = array('position'=>60, 'img'=>'object_propal', 'label'=>$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'text'=>img_picto('', 'object_propal', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/comm/propal/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : '')); + $arrayresult['searchintopropal'] = array('position'=>60, 'img'=>'object_propal', 'label'=>$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'text'=>img_picto('', 'object_propal', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/comm/propal/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } if (isModEnabled('commande') && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_ORDER_DISABLED) && $user->hasRight('commande', 'lire')) { - $arrayresult['searchintoorder'] = array('position'=>70, 'img'=>'object_order', 'label'=>$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'text'=>img_picto('', 'object_order', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/commande/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : '')); + $arrayresult['searchintoorder'] = array('position'=>70, 'img'=>'object_order', 'label'=>$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'text'=>img_picto('', 'object_order', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/commande/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } if (isModEnabled('expedition') && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_SHIPMENT_DISABLED) && $user->hasRight('expedition', 'lire')) { - $arrayresult['searchintoshipment'] = array('position'=>80, 'img'=>'object_shipment', 'label'=>$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'text'=>img_picto('', 'object_shipment', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expedition/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : '')); + $arrayresult['searchintoshipment'] = array('position'=>80, 'img'=>'object_shipment', 'label'=>$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'text'=>img_picto('', 'object_shipment', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expedition/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } if (isModEnabled('facture') && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_INVOICE_DISABLED) && $user->hasRight('facture', 'lire')) { - $arrayresult['searchintoinvoice'] = array('position'=>90, 'img'=>'object_bill', 'label'=>$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'text'=>img_picto('', 'object_bill', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/compta/facture/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : '')); + $arrayresult['searchintoinvoice'] = array('position'=>90, 'img'=>'object_bill', 'label'=>$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'text'=>img_picto('', 'object_bill', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/compta/facture/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } if (isModEnabled('supplier_proposal') && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_PROPAL_DISABLED) && $user->hasRight('supplier_proposal', 'lire')) { - $arrayresult['searchintosupplierpropal'] = array('position'=>100, 'img'=>'object_supplier_proposal', 'label'=>$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'text'=>img_picto('', 'object_supplier_proposal', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/supplier_proposal/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : '')); + $arrayresult['searchintosupplierpropal'] = array('position'=>100, 'img'=>'object_supplier_proposal', 'label'=>$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'text'=>img_picto('', 'object_supplier_proposal', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/supplier_proposal/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } if (((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight('fournisseur', 'commande', 'lire')) || (isModEnabled('supplier_order') && $user->hasRight('supplier_order', 'lire'))) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_ORDER_DISABLED)) { $arrayresult['searchintosupplierorder'] = array('position'=>110, 'img'=>'object_supplier_order', 'label'=>$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'text'=>img_picto('', 'object_supplier_order', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/commande/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } if (((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight('fournisseur', 'facture', 'lire')) || (isModEnabled('supplier_invoice') && $user->hasRight('supplier_invoice', 'lire'))) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_INVOICE_DISABLED)) { - $arrayresult['searchintosupplierinvoice'] = array('position'=>120, 'img'=>'object_supplier_invoice', 'label'=>$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'text'=>img_picto('', 'object_supplier_invoice', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/facture/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : '')); + $arrayresult['searchintosupplierinvoice'] = array('position'=>120, 'img'=>'object_supplier_invoice', 'label'=>$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'text'=>img_picto('', 'object_supplier_invoice', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/facture/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } // Customer payments @@ -127,7 +127,7 @@ if (isModEnabled('facture') && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_INV 'img'=>'object_payment', 'label'=>$langs->trans("SearchIntoCustomerPayments", $search_boxvalue), 'text'=>img_picto('', 'object_payment', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoCustomerPayments", $search_boxvalue), - 'url'=>DOL_URL_ROOT.'/compta/paiement/list.php?leftmenu=customers_bills_payment'.($search_boxvalue ? '&sall='.urlencode($search_boxvalue) : '')); + 'url'=>DOL_URL_ROOT.'/compta/paiement/list.php?leftmenu=customers_bills_payment'.($search_boxvalue ? '&search_all='.urlencode($search_boxvalue) : '')); } // Vendor payments @@ -137,7 +137,7 @@ if (((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERM 'img'=>'object_payment', 'label'=>$langs->trans("SearchIntoVendorPayments", $search_boxvalue), 'text'=>img_picto('', 'object_payment', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoVendorPayments", $search_boxvalue), - 'url'=>DOL_URL_ROOT.'/fourn/paiement/list.php?leftmenu=suppliers_bills_payment'.($search_boxvalue ? '&sall='.urlencode($search_boxvalue) : '')); + 'url'=>DOL_URL_ROOT.'/fourn/paiement/list.php?leftmenu=suppliers_bills_payment'.($search_boxvalue ? '&search_all='.urlencode($search_boxvalue) : '')); } // Miscellaneous payments @@ -147,28 +147,31 @@ if (isModEnabled('banque') && empty($conf->global->MAIN_SEARCHFORM_MISC_PAYMENTS 'img'=>'object_payment', 'label'=>$langs->trans("SearchIntoMiscPayments", $search_boxvalue), 'text'=>img_picto('', 'object_payment', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoMiscPayments", $search_boxvalue), - 'url'=>DOL_URL_ROOT.'/compta/bank/various_payment/list.php?leftmenu=tax_various'.($search_boxvalue ? '&sall='.urlencode($search_boxvalue) : '')); + 'url'=>DOL_URL_ROOT.'/compta/bank/various_payment/list.php?leftmenu=tax_various'.($search_boxvalue ? '&search_all='.urlencode($search_boxvalue) : '')); } if (isModEnabled('contrat') && empty($conf->global->MAIN_SEARCHFORM_CONTRACT_DISABLED) && $user->hasRight('contrat', 'lire')) { - $arrayresult['searchintocontract'] = array('position'=>130, 'img'=>'object_contract', 'label'=>$langs->trans("SearchIntoContracts", $search_boxvalue), 'text'=>img_picto('', 'object_contract', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoContracts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contrat/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : '')); + $arrayresult['searchintocontract'] = array('position'=>130, 'img'=>'object_contract', 'label'=>$langs->trans("SearchIntoContracts", $search_boxvalue), 'text'=>img_picto('', 'object_contract', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoContracts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contrat/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } if (isModEnabled('ficheinter') && empty($conf->global->MAIN_SEARCHFORM_FICHINTER_DISABLED) && $user->hasRight('ficheinter', 'lire')) { - $arrayresult['searchintointervention'] = array('position'=>140, 'img'=>'object_intervention', 'label'=>$langs->trans("SearchIntoInterventions", $search_boxvalue), 'text'=>img_picto('', 'object_intervention', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoInterventions", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fichinter/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : '')); + $arrayresult['searchintointervention'] = array('position'=>140, 'img'=>'object_intervention', 'label'=>$langs->trans("SearchIntoInterventions", $search_boxvalue), 'text'=>img_picto('', 'object_intervention', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoInterventions", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fichinter/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); +} +if (isModEnabled('knowledgemanagement') && empty($conf->global->MAIN_SEARCHFORM_KNOWLEDGEMANAGEMENT_DISABLED) && $user->hasRight('knowledgemanagement', 'knowledgerecord', 'read')) { + $arrayresult['searchintoknowledgemanagement'] = array('position'=>145, 'img'=>'object_knowledgemanagement', 'label'=>$langs->trans("SearchIntoKM", $search_boxvalue), 'text'=>img_picto('', 'object_knowledgemanagement', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoKM", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/knowledgemanagement/knowledgerecord_list.php?mainmenu=ticket'.($search_boxvalue ? '&search_all='.urlencode($search_boxvalue) : '')); } if (isModEnabled('ticket') && empty($conf->global->MAIN_SEARCHFORM_TICKET_DISABLED) && $user->hasRight('ticket', 'read')) { - $arrayresult['searchintotickets'] = array('position'=>145, 'img'=>'object_ticket', 'label'=>$langs->trans("SearchIntoTickets", $search_boxvalue), 'text'=>img_picto('', 'object_ticket', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoTickets", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/ticket/list.php?mainmenu=ticket'.($search_boxvalue ? '&sall='.urlencode($search_boxvalue) : '')); + $arrayresult['searchintotickets'] = array('position'=>146, 'img'=>'object_ticket', 'label'=>$langs->trans("SearchIntoTickets", $search_boxvalue), 'text'=>img_picto('', 'object_ticket', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoTickets", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/ticket/list.php?mainmenu=ticket'.($search_boxvalue ? '&search_all='.urlencode($search_boxvalue) : '')); } // HR if (isModEnabled('user') && empty($conf->global->MAIN_SEARCHFORM_USER_DISABLED) && $user->hasRight('user', 'user', 'lire')) { - $arrayresult['searchintouser'] = array('position'=>200, 'shortcut'=>'U', 'img'=>'object_user', 'label'=>$langs->trans("SearchIntoUsers", $search_boxvalue), 'text'=>img_picto('', 'object_user', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoUsers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/user/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : '')); + $arrayresult['searchintouser'] = array('position'=>200, 'shortcut'=>'U', 'img'=>'object_user', 'label'=>$langs->trans("SearchIntoUsers", $search_boxvalue), 'text'=>img_picto('', 'object_user', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoUsers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/user/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } if (isModEnabled('expensereport') && empty($conf->global->MAIN_SEARCHFORM_EXPENSEREPORT_DISABLED) && $user->hasRight('expensereport', 'lire')) { - $arrayresult['searchintoexpensereport'] = array('position'=>210, 'img'=>'object_trip', 'label'=>$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'text'=>img_picto('', 'object_trip', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm'.($search_boxvalue ? '&sall='.urlencode($search_boxvalue) : '')); + $arrayresult['searchintoexpensereport'] = array('position'=>210, 'img'=>'object_trip', 'label'=>$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'text'=>img_picto('', 'object_trip', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm'.($search_boxvalue ? '&search_all='.urlencode($search_boxvalue) : '')); } if (isModEnabled('holiday') && empty($conf->global->MAIN_SEARCHFORM_HOLIDAY_DISABLED) && $user->hasRight('holiday', 'read')) { - $arrayresult['searchintoleaves'] = array('position'=>220, 'img'=>'object_holiday', 'label'=>$langs->trans("SearchIntoLeaves", $search_boxvalue), 'text'=>img_picto('', 'object_holiday', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoLeaves", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/holiday/list.php?mainmenu=hrm'.($search_boxvalue ? '&sall='.urlencode($search_boxvalue) : '')); + $arrayresult['searchintoleaves'] = array('position'=>220, 'img'=>'object_holiday', 'label'=>$langs->trans("SearchIntoLeaves", $search_boxvalue), 'text'=>img_picto('', 'object_holiday', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoLeaves", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/holiday/list.php?mainmenu=hrm'.($search_boxvalue ? '&search_all='.urlencode($search_boxvalue) : '')); } // Execute hook addSearchEntry 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 93e2e859196..a9c17a2edba 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5058,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 .= '